From 2b50d44a2f740e67b5fb2e83f7acab85ea94d256 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 17 Jul 2020 15:43:59 +0100 Subject: [PATCH] Remove vendor directory #4032 --- vendor/bazil.org/fuse/.gitattributes | 2 - vendor/bazil.org/fuse/.gitignore | 11 - vendor/bazil.org/fuse/LICENSE | 93 - vendor/bazil.org/fuse/README.md | 23 - vendor/bazil.org/fuse/buffer.go | 35 - vendor/bazil.org/fuse/debug.go | 21 - vendor/bazil.org/fuse/error_darwin.go | 17 - vendor/bazil.org/fuse/error_freebsd.go | 15 - vendor/bazil.org/fuse/error_linux.go | 17 - vendor/bazil.org/fuse/error_std.go | 31 - vendor/bazil.org/fuse/fs/serve.go | 1562 - vendor/bazil.org/fuse/fs/tree.go | 97 - vendor/bazil.org/fuse/fuse.go | 2338 -- vendor/bazil.org/fuse/fuse_darwin.go | 9 - vendor/bazil.org/fuse/fuse_freebsd.go | 6 - vendor/bazil.org/fuse/fuse_kernel.go | 772 - vendor/bazil.org/fuse/fuse_kernel_darwin.go | 88 - vendor/bazil.org/fuse/fuse_kernel_freebsd.go | 62 - vendor/bazil.org/fuse/fuse_kernel_linux.go | 70 - vendor/bazil.org/fuse/fuse_kernel_std.go | 1 - vendor/bazil.org/fuse/fuse_linux.go | 7 - vendor/bazil.org/fuse/fuseutil/fuseutil.go | 20 - vendor/bazil.org/fuse/go.mod | 8 - vendor/bazil.org/fuse/go.sum | 4 - vendor/bazil.org/fuse/mount.go | 38 - vendor/bazil.org/fuse/mount_darwin.go | 208 - vendor/bazil.org/fuse/mount_freebsd.go | 111 - vendor/bazil.org/fuse/mount_linux.go | 150 - vendor/bazil.org/fuse/options.go | 296 - vendor/bazil.org/fuse/options_darwin.go | 40 - vendor/bazil.org/fuse/options_freebsd.go | 32 - vendor/bazil.org/fuse/options_linux.go | 29 - vendor/bazil.org/fuse/protocol.go | 75 - vendor/bazil.org/fuse/unmount.go | 6 - vendor/bazil.org/fuse/unmount_linux.go | 21 - vendor/bazil.org/fuse/unmount_std.go | 17 - vendor/cloud.google.com/go/LICENSE | 202 - .../go/compute/metadata/metadata.go | 518 - .../Azure/azure-pipeline-go/LICENSE | 21 - .../Azure/azure-pipeline-go/pipeline/core.go | 284 - .../azure-pipeline-go/pipeline/defaultlog.go | 14 - .../pipeline/defaultlog_syslog.go | 33 - .../pipeline/defaultlog_windows.go | 61 - .../Azure/azure-pipeline-go/pipeline/doc.go | 161 - .../Azure/azure-pipeline-go/pipeline/error.go | 181 - .../azure-pipeline-go/pipeline/progress.go | 82 - .../azure-pipeline-go/pipeline/request.go | 147 - .../azure-pipeline-go/pipeline/response.go | 74 - .../azure-pipeline-go/pipeline/version.go | 9 - .../Azure/azure-storage-blob-go/LICENSE | 21 - .../azblob/access_conditions.go | 65 - .../azure-storage-blob-go/azblob/blob.json | 8009 ---- .../azblob/chunkwriting.go | 238 - .../azure-storage-blob-go/azblob/highlevel.go | 396 - .../azblob/parsing_urls.go | 153 - .../azblob/sas_service.go | 256 - .../azblob/service_codes_blob.go | 195 - .../azblob/storage_account_credential.go | 8 - .../azblob/url_append_blob.go | 138 - .../azure-storage-blob-go/azblob/url_blob.go | 225 - .../azblob/url_block_blob.go | 134 - .../azblob/url_container.go | 299 - .../azblob/url_page_blob.go | 233 - .../azblob/url_service.go | 159 - .../azblob/user_delegation_credential.go | 38 - .../azure-storage-blob-go/azblob/version.go | 3 - .../azblob/zc_credential_anonymous.go | 55 - .../azblob/zc_credential_shared_key.go | 205 - .../azblob/zc_credential_token.go | 137 - .../azblob/zc_mmf_unix.go | 28 - .../azblob/zc_mmf_windows.go | 38 - .../azblob/zc_pipeline.go | 46 - .../azblob/zc_policy_request_log.go | 182 - .../azblob/zc_policy_retry.go | 414 - .../azblob/zc_policy_telemetry.go | 51 - .../azblob/zc_policy_unique_request_id.go | 24 - .../azblob/zc_retry_reader.go | 184 - .../azblob/zc_sas_account.go | 219 - .../azblob/zc_sas_query_params.go | 358 - .../azblob/zc_service_codes_common.go | 131 - .../azblob/zc_storage_error.go | 111 - .../azblob/zc_util_validate.go | 64 - .../azure-storage-blob-go/azblob/zc_uuid.go | 77 - .../azure-storage-blob-go/azblob/zt_doc.go | 89 - .../azblob/zz_generated_append_blob.go | 403 - .../azblob/zz_generated_blob.go | 1620 - .../azblob/zz_generated_block_blob.go | 592 - .../azblob/zz_generated_client.go | 38 - .../azblob/zz_generated_container.go | 1037 - .../azblob/zz_generated_models.go | 6421 ---- .../azblob/zz_generated_page_blob.go | 977 - .../azblob/zz_generated_responder_policy.go | 74 - .../azblob/zz_generated_response_error.go | 95 - .../azblob/zz_generated_service.go | 526 - .../azblob/zz_generated_validation.go | 367 - .../azblob/zz_generated_version.go | 14 - .../azblob/zz_response_helpers.go | 242 - vendor/github.com/Unknwon/goconfig/.gitignore | 3 - vendor/github.com/Unknwon/goconfig/LICENSE | 191 - vendor/github.com/Unknwon/goconfig/README.md | 68 - .../github.com/Unknwon/goconfig/README_ZH.md | 64 - vendor/github.com/Unknwon/goconfig/conf.go | 555 - vendor/github.com/Unknwon/goconfig/read.go | 294 - vendor/github.com/Unknwon/goconfig/write.go | 117 - vendor/github.com/a8m/tree/.gitignore | 2 - vendor/github.com/a8m/tree/.travis.yml | 18 - vendor/github.com/a8m/tree/LICENSE | 21 - vendor/github.com/a8m/tree/README.md | 43 - vendor/github.com/a8m/tree/color.go | 74 - vendor/github.com/a8m/tree/compileall.sh | 27 - vendor/github.com/a8m/tree/csort_bsd.go | 18 - vendor/github.com/a8m/tree/csort_generic.go | 6 - vendor/github.com/a8m/tree/csort_unix.go | 18 - vendor/github.com/a8m/tree/modes_bsd.go | 7 - vendor/github.com/a8m/tree/modes_unix.go | 7 - .../github.com/a8m/tree/modes_unsupported.go | 5 - vendor/github.com/a8m/tree/node.go | 399 - vendor/github.com/a8m/tree/sort.go | 100 - vendor/github.com/a8m/tree/stat_unix.go | 20 - .../github.com/a8m/tree/stat_unsupported.go | 9 - vendor/github.com/aalpar/deheap/LICENSE.txt | 20 - vendor/github.com/aalpar/deheap/README.md | 14 - vendor/github.com/aalpar/deheap/deheap.go | 228 - vendor/github.com/aalpar/deheap/fuzz.go | 113 - .../github.com/abbot/go-http-auth/.gitignore | 5 - vendor/github.com/abbot/go-http-auth/LICENSE | 178 - vendor/github.com/abbot/go-http-auth/Makefile | 12 - .../github.com/abbot/go-http-auth/README.md | 71 - vendor/github.com/abbot/go-http-auth/auth.go | 109 - vendor/github.com/abbot/go-http-auth/basic.go | 163 - .../github.com/abbot/go-http-auth/digest.go | 274 - .../github.com/abbot/go-http-auth/md5crypt.go | 92 - vendor/github.com/abbot/go-http-auth/misc.go | 141 - .../abbot/go-http-auth/test.htdigest | 1 - .../abbot/go-http-auth/test.htpasswd | 4 - vendor/github.com/abbot/go-http-auth/users.go | 154 - vendor/github.com/anacrolix/dms/LICENSE | 24 - vendor/github.com/anacrolix/dms/dlna/dlna.go | 102 - vendor/github.com/anacrolix/dms/soap/soap.go | 68 - vendor/github.com/anacrolix/dms/ssdp/ssdp.go | 330 - .../github.com/anacrolix/dms/upnp/eventing.go | 91 - vendor/github.com/anacrolix/dms/upnp/upnp.go | 159 - .../github.com/atotto/clipboard/.travis.yml | 20 - vendor/github.com/atotto/clipboard/LICENSE | 27 - vendor/github.com/atotto/clipboard/README.md | 48 - .../github.com/atotto/clipboard/clipboard.go | 20 - .../atotto/clipboard/clipboard_darwin.go | 52 - .../atotto/clipboard/clipboard_unix.go | 129 - .../atotto/clipboard/clipboard_windows.go | 128 - vendor/github.com/atotto/clipboard/go.mod | 1 - vendor/github.com/aws/aws-sdk-go/LICENSE.txt | 202 - vendor/github.com/aws/aws-sdk-go/NOTICE.txt | 3 - .../github.com/aws/aws-sdk-go/aws/arn/arn.go | 93 - .../aws/aws-sdk-go/aws/awserr/error.go | 164 - .../aws/aws-sdk-go/aws/awserr/types.go | 221 - .../aws/aws-sdk-go/aws/awsutil/copy.go | 108 - .../aws/aws-sdk-go/aws/awsutil/equal.go | 27 - .../aws/aws-sdk-go/aws/awsutil/path_value.go | 221 - .../aws/aws-sdk-go/aws/awsutil/prettify.go | 113 - .../aws-sdk-go/aws/awsutil/string_value.go | 88 - .../aws/aws-sdk-go/aws/client/client.go | 97 - .../aws-sdk-go/aws/client/default_retryer.go | 177 - .../aws/aws-sdk-go/aws/client/logger.go | 194 - .../aws/client/metadata/client_info.go | 14 - .../aws-sdk-go/aws/client/no_op_retryer.go | 28 - .../github.com/aws/aws-sdk-go/aws/config.go | 587 - .../aws/aws-sdk-go/aws/context_1_5.go | 37 - .../aws/aws-sdk-go/aws/context_1_9.go | 11 - .../aws-sdk-go/aws/context_background_1_5.go | 22 - .../aws-sdk-go/aws/context_background_1_7.go | 20 - .../aws/aws-sdk-go/aws/context_sleep.go | 24 - .../aws/aws-sdk-go/aws/convert_types.go | 918 - .../aws-sdk-go/aws/corehandlers/handlers.go | 230 - .../aws/corehandlers/param_validator.go | 17 - .../aws-sdk-go/aws/corehandlers/user_agent.go | 37 - .../aws/credentials/chain_provider.go | 100 - .../credentials/context_background_go1.5.go | 22 - .../credentials/context_background_go1.7.go | 20 - .../aws/credentials/context_go1.5.go | 39 - .../aws/credentials/context_go1.9.go | 13 - .../aws-sdk-go/aws/credentials/credentials.go | 339 - .../ec2rolecreds/ec2_role_provider.go | 188 - .../aws/credentials/endpointcreds/provider.go | 210 - .../aws/credentials/env_provider.go | 74 - .../aws-sdk-go/aws/credentials/example.ini | 12 - .../aws/credentials/processcreds/provider.go | 426 - .../shared_credentials_provider.go | 151 - .../aws/credentials/static_provider.go | 57 - .../stscreds/assume_role_provider.go | 363 - .../stscreds/web_identity_provider.go | 135 - .../github.com/aws/aws-sdk-go/aws/csm/doc.go | 69 - .../aws/aws-sdk-go/aws/csm/enable.go | 89 - .../aws/aws-sdk-go/aws/csm/metric.go | 109 - .../aws/aws-sdk-go/aws/csm/metric_chan.go | 55 - .../aws-sdk-go/aws/csm/metric_exception.go | 26 - .../aws/aws-sdk-go/aws/csm/reporter.go | 264 - .../aws/aws-sdk-go/aws/defaults/defaults.go | 207 - .../aws-sdk-go/aws/defaults/shared_config.go | 27 - vendor/github.com/aws/aws-sdk-go/aws/doc.go | 56 - .../aws/aws-sdk-go/aws/ec2metadata/api.go | 250 - .../aws/aws-sdk-go/aws/ec2metadata/service.go | 228 - .../aws/ec2metadata/token_provider.go | 92 - .../aws/aws-sdk-go/aws/endpoints/decode.go | 216 - .../aws/aws-sdk-go/aws/endpoints/defaults.go | 9140 ----- .../aws/endpoints/dep_service_ids.go | 141 - .../aws/aws-sdk-go/aws/endpoints/doc.go | 66 - .../aws/aws-sdk-go/aws/endpoints/endpoints.go | 564 - .../aws/endpoints/legacy_regions.go | 24 - .../aws/aws-sdk-go/aws/endpoints/v3model.go | 351 - .../aws/endpoints/v3model_codegen.go | 351 - .../github.com/aws/aws-sdk-go/aws/errors.go | 13 - .../aws/aws-sdk-go/aws/jsonvalue.go | 12 - .../github.com/aws/aws-sdk-go/aws/logger.go | 118 - .../aws/request/connection_reset_error.go | 18 - .../aws/aws-sdk-go/aws/request/handlers.go | 343 - .../aws-sdk-go/aws/request/http_request.go | 24 - .../aws-sdk-go/aws/request/offset_reader.go | 65 - .../aws/aws-sdk-go/aws/request/request.go | 698 - .../aws/aws-sdk-go/aws/request/request_1_7.go | 39 - .../aws/aws-sdk-go/aws/request/request_1_8.go | 36 - .../aws-sdk-go/aws/request/request_context.go | 14 - .../aws/request/request_context_1_6.go | 14 - .../aws/request/request_pagination.go | 266 - .../aws/aws-sdk-go/aws/request/retryer.go | 309 - .../aws/request/timeout_read_closer.go | 94 - .../aws/aws-sdk-go/aws/request/validation.go | 286 - .../aws/aws-sdk-go/aws/request/waiter.go | 295 - .../aws/session/cabundle_transport.go | 26 - .../aws/session/cabundle_transport_1_5.go | 22 - .../aws/session/cabundle_transport_1_6.go | 23 - .../aws/aws-sdk-go/aws/session/credentials.go | 267 - .../aws/aws-sdk-go/aws/session/doc.go | 245 - .../aws/aws-sdk-go/aws/session/env_config.go | 345 - .../aws/aws-sdk-go/aws/session/session.go | 734 - .../aws-sdk-go/aws/session/shared_config.go | 555 - .../aws-sdk-go/aws/signer/v4/header_rules.go | 81 - .../aws/aws-sdk-go/aws/signer/v4/options.go | 7 - .../aws/signer/v4/request_context_go1.5.go | 13 - .../aws/signer/v4/request_context_go1.7.go | 13 - .../aws/aws-sdk-go/aws/signer/v4/stream.go | 63 - .../aws/aws-sdk-go/aws/signer/v4/uri_path.go | 24 - .../aws/aws-sdk-go/aws/signer/v4/v4.go | 846 - vendor/github.com/aws/aws-sdk-go/aws/types.go | 264 - vendor/github.com/aws/aws-sdk-go/aws/url.go | 12 - .../github.com/aws/aws-sdk-go/aws/url_1_7.go | 29 - .../github.com/aws/aws-sdk-go/aws/version.go | 8 - .../internal/context/background_go1.5.go | 40 - .../aws/aws-sdk-go/internal/ini/ast.go | 120 - .../aws-sdk-go/internal/ini/comma_token.go | 11 - .../aws-sdk-go/internal/ini/comment_token.go | 35 - .../aws/aws-sdk-go/internal/ini/doc.go | 29 - .../aws-sdk-go/internal/ini/empty_token.go | 4 - .../aws/aws-sdk-go/internal/ini/expression.go | 24 - .../aws/aws-sdk-go/internal/ini/fuzz.go | 17 - .../aws/aws-sdk-go/internal/ini/ini.go | 51 - .../aws/aws-sdk-go/internal/ini/ini_lexer.go | 165 - .../aws/aws-sdk-go/internal/ini/ini_parser.go | 356 - .../aws-sdk-go/internal/ini/literal_tokens.go | 324 - .../aws-sdk-go/internal/ini/newline_token.go | 30 - .../aws-sdk-go/internal/ini/number_helper.go | 152 - .../aws/aws-sdk-go/internal/ini/op_tokens.go | 39 - .../aws-sdk-go/internal/ini/parse_error.go | 43 - .../aws-sdk-go/internal/ini/parse_stack.go | 60 - .../aws/aws-sdk-go/internal/ini/sep_tokens.go | 41 - .../aws/aws-sdk-go/internal/ini/skipper.go | 45 - .../aws/aws-sdk-go/internal/ini/statement.go | 35 - .../aws/aws-sdk-go/internal/ini/value_util.go | 284 - .../aws/aws-sdk-go/internal/ini/visitor.go | 166 - .../aws/aws-sdk-go/internal/ini/walker.go | 25 - .../aws/aws-sdk-go/internal/ini/ws_token.go | 24 - .../aws/aws-sdk-go/internal/s3err/error.go | 57 - .../aws/aws-sdk-go/internal/sdkio/byte.go | 12 - .../aws/aws-sdk-go/internal/sdkio/io_go1.6.go | 10 - .../aws/aws-sdk-go/internal/sdkio/io_go1.7.go | 12 - .../aws/aws-sdk-go/internal/sdkmath/floor.go | 15 - .../internal/sdkmath/floor_go1.9.go | 56 - .../internal/sdkrand/locked_source.go | 29 - .../aws/aws-sdk-go/internal/sdkrand/read.go | 11 - .../aws-sdk-go/internal/sdkrand/read_1_5.go | 24 - .../aws/aws-sdk-go/internal/sdkuri/path.go | 23 - .../internal/shareddefaults/ecs_container.go | 12 - .../internal/shareddefaults/shared_config.go | 40 - .../aws-sdk-go/internal/strings/strings.go | 11 - .../internal/sync/singleflight/LICENSE | 27 - .../sync/singleflight/singleflight.go | 120 - .../private/checksum/content_md5.go | 53 - .../private/protocol/eventstream/debug.go | 144 - .../private/protocol/eventstream/decode.go | 216 - .../private/protocol/eventstream/encode.go | 162 - .../private/protocol/eventstream/error.go | 23 - .../eventstream/eventstreamapi/error.go | 77 - .../eventstream/eventstreamapi/reader.go | 160 - .../eventstream/eventstreamapi/shared.go | 23 - .../eventstream/eventstreamapi/signer.go | 123 - .../eventstreamapi/stream_writer.go | 129 - .../eventstream/eventstreamapi/writer.go | 109 - .../private/protocol/eventstream/header.go | 166 - .../protocol/eventstream/header_value.go | 506 - .../private/protocol/eventstream/message.go | 103 - .../aws/aws-sdk-go/private/protocol/host.go | 68 - .../private/protocol/host_prefix.go | 54 - .../private/protocol/idempotency.go | 75 - .../private/protocol/json/jsonutil/build.go | 296 - .../protocol/json/jsonutil/unmarshal.go | 282 - .../aws-sdk-go/private/protocol/jsonvalue.go | 76 - .../aws-sdk-go/private/protocol/payload.go | 81 - .../aws-sdk-go/private/protocol/protocol.go | 49 - .../private/protocol/query/build.go | 36 - .../protocol/query/queryutil/queryutil.go | 246 - .../private/protocol/query/unmarshal.go | 39 - .../private/protocol/query/unmarshal_error.go | 69 - .../aws-sdk-go/private/protocol/rest/build.go | 310 - .../private/protocol/rest/payload.go | 45 - .../private/protocol/rest/unmarshal.go | 257 - .../private/protocol/restxml/restxml.go | 79 - .../aws-sdk-go/private/protocol/timestamp.go | 85 - .../aws-sdk-go/private/protocol/unmarshal.go | 27 - .../private/protocol/unmarshal_error.go | 65 - .../private/protocol/xml/xmlutil/build.go | 315 - .../private/protocol/xml/xmlutil/sort.go | 32 - .../private/protocol/xml/xmlutil/unmarshal.go | 299 - .../protocol/xml/xmlutil/xml_to_struct.go | 159 - .../aws/aws-sdk-go/service/s3/api.go | 30737 ---------------- .../aws/aws-sdk-go/service/s3/body_hash.go | 202 - .../aws-sdk-go/service/s3/bucket_location.go | 107 - .../aws-sdk-go/service/s3/customizations.go | 75 - .../aws/aws-sdk-go/service/s3/doc.go | 26 - .../aws/aws-sdk-go/service/s3/doc_custom.go | 123 - .../aws/aws-sdk-go/service/s3/endpoint.go | 233 - .../aws-sdk-go/service/s3/endpoint_errors.go | 151 - .../aws/aws-sdk-go/service/s3/errors.go | 54 - .../service/s3/host_style_bucket.go | 136 - .../s3/internal/arn/accesspoint_arn.go | 45 - .../aws-sdk-go/service/s3/internal/arn/arn.go | 71 - .../service/s3/platform_handlers.go | 8 - .../service/s3/platform_handlers_go1.6.go | 28 - .../aws/aws-sdk-go/service/s3/service.go | 103 - .../aws/aws-sdk-go/service/s3/sse.go | 84 - .../aws-sdk-go/service/s3/statusok_error.go | 42 - .../aws-sdk-go/service/s3/unmarshal_error.go | 114 - .../aws/aws-sdk-go/service/s3/waiters.go | 214 - .../aws/aws-sdk-go/service/sts/api.go | 3115 -- .../aws-sdk-go/service/sts/customizations.go | 11 - .../aws/aws-sdk-go/service/sts/doc.go | 108 - .../aws/aws-sdk-go/service/sts/errors.go | 82 - .../aws/aws-sdk-go/service/sts/service.go | 98 - .../service/sts/stsiface/interface.go | 96 - vendor/github.com/beorn7/perks/LICENSE | 20 - .../beorn7/perks/quantile/exampledata.txt | 2388 -- .../beorn7/perks/quantile/stream.go | 316 - .../billziss-gh/cgofuse/fuse/errstr.go | 98 - .../billziss-gh/cgofuse/fuse/fsop.go | 589 - .../billziss-gh/cgofuse/fuse/fsop_cgo.go | 294 - .../cgofuse/fuse/fsop_nocgo_windows.go | 152 - .../billziss-gh/cgofuse/fuse/host.go | 965 - .../billziss-gh/cgofuse/fuse/host_cgo.go | 928 - .../cgofuse/fuse/host_nocgo_windows.go | 1000 - vendor/github.com/btcsuite/btcutil/LICENSE | 16 - .../btcsuite/btcutil/base58/README.md | 34 - .../btcsuite/btcutil/base58/alphabet.go | 49 - .../btcsuite/btcutil/base58/base58.go | 75 - .../btcsuite/btcutil/base58/base58check.go | 52 - .../btcsuite/btcutil/base58/cov_report.sh | 17 - .../github.com/btcsuite/btcutil/base58/doc.go | 29 - .../calebcase/tmpfile/.golangci.yml | 45 - vendor/github.com/calebcase/tmpfile/LICENSE | 19 - .../calebcase/tmpfile/LICENSE.golang | 27 - vendor/github.com/calebcase/tmpfile/README.md | 30 - vendor/github.com/calebcase/tmpfile/doc.go | 11 - vendor/github.com/calebcase/tmpfile/go.mod | 5 - vendor/github.com/calebcase/tmpfile/go.sum | 2 - .../github.com/calebcase/tmpfile/tmpfile.go | 32 - .../calebcase/tmpfile/tmpfile_windows.go | 94 - .../github.com/cespare/xxhash/v2/.travis.yml | 8 - .../github.com/cespare/xxhash/v2/LICENSE.txt | 22 - vendor/github.com/cespare/xxhash/v2/README.md | 67 - vendor/github.com/cespare/xxhash/v2/go.mod | 3 - vendor/github.com/cespare/xxhash/v2/go.sum | 0 vendor/github.com/cespare/xxhash/v2/xxhash.go | 236 - .../cespare/xxhash/v2/xxhash_amd64.go | 13 - .../cespare/xxhash/v2/xxhash_amd64.s | 215 - .../cespare/xxhash/v2/xxhash_other.go | 76 - .../cespare/xxhash/v2/xxhash_safe.go | 15 - .../cespare/xxhash/v2/xxhash_unsafe.go | 46 - vendor/github.com/coreos/go-semver/LICENSE | 202 - vendor/github.com/coreos/go-semver/NOTICE | 5 - .../coreos/go-semver/semver/semver.go | 296 - .../coreos/go-semver/semver/sort.go | 38 - .../cpuguy83/go-md2man/v2/LICENSE.md | 21 - .../cpuguy83/go-md2man/v2/md2man/md2man.go | 14 - .../cpuguy83/go-md2man/v2/md2man/roff.go | 345 - vendor/github.com/davecgh/go-spew/LICENSE | 15 - .../github.com/davecgh/go-spew/spew/bypass.go | 145 - .../davecgh/go-spew/spew/bypasssafe.go | 38 - .../github.com/davecgh/go-spew/spew/common.go | 341 - .../github.com/davecgh/go-spew/spew/config.go | 306 - vendor/github.com/davecgh/go-spew/spew/doc.go | 211 - .../github.com/davecgh/go-spew/spew/dump.go | 509 - .../github.com/davecgh/go-spew/spew/format.go | 419 - .../github.com/davecgh/go-spew/spew/spew.go | 148 - .../dropbox/dropbox-sdk-go-unofficial/LICENSE | 20 - .../dropbox/async/types.go | 168 - .../dropbox/auth/client.go | 166 - .../dropbox/auth/sdk.go | 67 - .../dropbox/auth/types.go | 227 - .../dropbox/common/types.go | 242 - .../dropbox/file_properties/client.go | 1105 - .../dropbox/file_properties/types.go | 1040 - .../dropbox/files/client.go | 4146 --- .../dropbox/files/types.go | 4149 --- .../dropbox-sdk-go-unofficial/dropbox/sdk.go | 241 - .../dropbox/seen_state/types.go | 41 - .../dropbox/sharing/client.go | 3075 -- .../dropbox/sharing/types.go | 4490 --- .../dropbox/team/client.go | 4479 --- .../dropbox/team/types.go | 4405 --- .../dropbox/team_common/types.go | 104 - .../dropbox/team_policies/types.go | 316 - .../dropbox/users/client.go | 301 - .../dropbox/users/types.go | 441 - .../dropbox/users_common/types.go | 37 - vendor/github.com/gogo/protobuf/AUTHORS | 15 - vendor/github.com/gogo/protobuf/CONTRIBUTORS | 23 - vendor/github.com/gogo/protobuf/LICENSE | 35 - .../github.com/gogo/protobuf/proto/Makefile | 43 - .../github.com/gogo/protobuf/proto/clone.go | 258 - .../gogo/protobuf/proto/custom_gogo.go | 39 - .../github.com/gogo/protobuf/proto/decode.go | 427 - .../gogo/protobuf/proto/deprecated.go | 63 - .../github.com/gogo/protobuf/proto/discard.go | 350 - .../gogo/protobuf/proto/duration.go | 100 - .../gogo/protobuf/proto/duration_gogo.go | 49 - .../github.com/gogo/protobuf/proto/encode.go | 205 - .../gogo/protobuf/proto/encode_gogo.go | 33 - .../github.com/gogo/protobuf/proto/equal.go | 300 - .../gogo/protobuf/proto/extensions.go | 605 - .../gogo/protobuf/proto/extensions_gogo.go | 389 - vendor/github.com/gogo/protobuf/proto/lib.go | 973 - .../gogo/protobuf/proto/lib_gogo.go | 50 - .../gogo/protobuf/proto/message_set.go | 181 - .../gogo/protobuf/proto/pointer_reflect.go | 357 - .../protobuf/proto/pointer_reflect_gogo.go | 59 - .../gogo/protobuf/proto/pointer_unsafe.go | 308 - .../protobuf/proto/pointer_unsafe_gogo.go | 56 - .../gogo/protobuf/proto/properties.go | 610 - .../gogo/protobuf/proto/properties_gogo.go | 36 - .../gogo/protobuf/proto/skip_gogo.go | 119 - .../gogo/protobuf/proto/table_marshal.go | 3009 -- .../gogo/protobuf/proto/table_marshal_gogo.go | 388 - .../gogo/protobuf/proto/table_merge.go | 676 - .../gogo/protobuf/proto/table_unmarshal.go | 2249 -- .../protobuf/proto/table_unmarshal_gogo.go | 385 - vendor/github.com/gogo/protobuf/proto/text.go | 930 - .../gogo/protobuf/proto/text_gogo.go | 57 - .../gogo/protobuf/proto/text_parser.go | 1018 - .../gogo/protobuf/proto/timestamp.go | 113 - .../gogo/protobuf/proto/timestamp_gogo.go | 49 - .../gogo/protobuf/proto/wrappers.go | 1888 - .../gogo/protobuf/proto/wrappers_gogo.go | 113 - vendor/github.com/golang/groupcache/LICENSE | 191 - .../github.com/golang/groupcache/lru/lru.go | 133 - vendor/github.com/golang/protobuf/AUTHORS | 3 - .../github.com/golang/protobuf/CONTRIBUTORS | 3 - vendor/github.com/golang/protobuf/LICENSE | 28 - .../golang/protobuf/proto/buffer.go | 324 - .../golang/protobuf/proto/defaults.go | 63 - .../golang/protobuf/proto/deprecated.go | 113 - .../golang/protobuf/proto/discard.go | 58 - .../golang/protobuf/proto/extensions.go | 356 - .../golang/protobuf/proto/properties.go | 306 - .../github.com/golang/protobuf/proto/proto.go | 167 - .../golang/protobuf/proto/registry.go | 323 - .../golang/protobuf/proto/text_decode.go | 801 - .../golang/protobuf/proto/text_encode.go | 560 - .../github.com/golang/protobuf/proto/wire.go | 78 - .../golang/protobuf/proto/wrappers.go | 34 - .../github.com/golang/protobuf/ptypes/any.go | 165 - .../golang/protobuf/ptypes/any/any.pb.go | 62 - .../github.com/golang/protobuf/ptypes/doc.go | 6 - .../golang/protobuf/ptypes/duration.go | 72 - .../protobuf/ptypes/duration/duration.pb.go | 63 - .../golang/protobuf/ptypes/timestamp.go | 103 - .../protobuf/ptypes/timestamp/timestamp.pb.go | 64 - .../github.com/google/go-querystring/LICENSE | 27 - .../google/go-querystring/query/encode.go | 320 - vendor/github.com/google/uuid/.travis.yml | 9 - vendor/github.com/google/uuid/CONTRIBUTING.md | 10 - vendor/github.com/google/uuid/CONTRIBUTORS | 9 - vendor/github.com/google/uuid/LICENSE | 27 - vendor/github.com/google/uuid/README.md | 19 - vendor/github.com/google/uuid/dce.go | 80 - vendor/github.com/google/uuid/doc.go | 12 - vendor/github.com/google/uuid/go.mod | 1 - vendor/github.com/google/uuid/hash.go | 53 - vendor/github.com/google/uuid/marshal.go | 37 - vendor/github.com/google/uuid/node.go | 90 - vendor/github.com/google/uuid/node_js.go | 12 - vendor/github.com/google/uuid/node_net.go | 33 - vendor/github.com/google/uuid/sql.go | 59 - vendor/github.com/google/uuid/time.go | 123 - vendor/github.com/google/uuid/util.go | 43 - vendor/github.com/google/uuid/uuid.go | 245 - vendor/github.com/google/uuid/version1.go | 44 - vendor/github.com/google/uuid/version4.go | 38 - .../github.com/googleapis/gax-go/v2/LICENSE | 27 - .../googleapis/gax-go/v2/call_option.go | 161 - vendor/github.com/googleapis/gax-go/v2/gax.go | 39 - vendor/github.com/googleapis/gax-go/v2/go.mod | 3 - vendor/github.com/googleapis/gax-go/v2/go.sum | 25 - .../github.com/googleapis/gax-go/v2/header.go | 53 - .../github.com/googleapis/gax-go/v2/invoke.go | 99 - vendor/github.com/hanwen/go-fuse/v2/AUTHORS | 20 - vendor/github.com/hanwen/go-fuse/v2/LICENSE | 30 - .../github.com/hanwen/go-fuse/v2/fs/README.md | 60 - vendor/github.com/hanwen/go-fuse/v2/fs/api.go | 613 - .../github.com/hanwen/go-fuse/v2/fs/bridge.go | 1029 - .../hanwen/go-fuse/v2/fs/constants.go | 29 - .../hanwen/go-fuse/v2/fs/constants_darwin.go | 10 - .../hanwen/go-fuse/v2/fs/constants_linux.go | 10 - .../hanwen/go-fuse/v2/fs/default.go | 5 - .../hanwen/go-fuse/v2/fs/dirstream.go | 34 - .../hanwen/go-fuse/v2/fs/dirstream_darwin.go | 48 - .../hanwen/go-fuse/v2/fs/dirstream_linux.go | 93 - .../github.com/hanwen/go-fuse/v2/fs/files.go | 230 - .../hanwen/go-fuse/v2/fs/files_darwin.go | 10 - .../hanwen/go-fuse/v2/fs/files_linux.go | 42 - .../github.com/hanwen/go-fuse/v2/fs/inode.go | 744 - .../hanwen/go-fuse/v2/fs/loopback.go | 405 - .../hanwen/go-fuse/v2/fs/loopback_darwin.go | 118 - .../hanwen/go-fuse/v2/fs/loopback_linux.go | 86 - vendor/github.com/hanwen/go-fuse/v2/fs/mem.go | 103 - .../github.com/hanwen/go-fuse/v2/fs/mount.go | 40 - .../hanwen/go-fuse/v2/fs/syscall_linux.go | 20 - .../hanwen/go-fuse/v2/fuse/.gitignore | 1 - .../github.com/hanwen/go-fuse/v2/fuse/api.go | 283 - .../github.com/hanwen/go-fuse/v2/fuse/attr.go | 79 - .../hanwen/go-fuse/v2/fuse/attr_darwin.go | 26 - .../hanwen/go-fuse/v2/fuse/attr_linux.go | 27 - .../hanwen/go-fuse/v2/fuse/bufferpool.go | 69 - .../hanwen/go-fuse/v2/fuse/constants.go | 37 - .../go-fuse/v2/fuse/constants_freebsd.go | 9 - .../hanwen/go-fuse/v2/fuse/constants_linux.go | 12 - .../hanwen/go-fuse/v2/fuse/context.go | 61 - .../hanwen/go-fuse/v2/fuse/defaultraw.go | 168 - .../hanwen/go-fuse/v2/fuse/direntry.go | 134 - .../github.com/hanwen/go-fuse/v2/fuse/misc.go | 100 - .../hanwen/go-fuse/v2/fuse/mount_darwin.go | 97 - .../hanwen/go-fuse/v2/fuse/mount_linux.go | 202 - .../hanwen/go-fuse/v2/fuse/opcode.go | 808 - .../github.com/hanwen/go-fuse/v2/fuse/poll.go | 43 - .../hanwen/go-fuse/v2/fuse/poll_darwin.go | 49 - .../hanwen/go-fuse/v2/fuse/poll_linux.go | 25 - .../hanwen/go-fuse/v2/fuse/print.go | 305 - .../hanwen/go-fuse/v2/fuse/print_darwin.go | 54 - .../hanwen/go-fuse/v2/fuse/print_linux.go | 61 - .../github.com/hanwen/go-fuse/v2/fuse/read.go | 75 - .../hanwen/go-fuse/v2/fuse/request.go | 254 - .../hanwen/go-fuse/v2/fuse/request_darwin.go | 13 - .../hanwen/go-fuse/v2/fuse/request_linux.go | 13 - .../hanwen/go-fuse/v2/fuse/server.go | 856 - .../hanwen/go-fuse/v2/fuse/server_darwin.go | 32 - .../hanwen/go-fuse/v2/fuse/server_linux.go | 42 - .../hanwen/go-fuse/v2/fuse/splice_darwin.go | 17 - .../hanwen/go-fuse/v2/fuse/splice_linux.go | 97 - .../hanwen/go-fuse/v2/fuse/syscall_darwin.go | 139 - .../hanwen/go-fuse/v2/fuse/syscall_linux.go | 49 - .../hanwen/go-fuse/v2/fuse/typeprint.go | 9 - .../hanwen/go-fuse/v2/fuse/types.go | 676 - .../hanwen/go-fuse/v2/fuse/types_darwin.go | 166 - .../hanwen/go-fuse/v2/fuse/types_linux.go | 134 - .../hanwen/go-fuse/v2/internal/access.go | 60 - .../v2/internal/utimens/utimens_darwin.go | 40 - .../v2/internal/utimens/utimens_linux.go | 7 - .../hanwen/go-fuse/v2/splice/copy.go | 70 - .../hanwen/go-fuse/v2/splice/pair.go | 68 - .../hanwen/go-fuse/v2/splice/pair_darwin.go | 22 - .../hanwen/go-fuse/v2/splice/pair_linux.go | 54 - .../hanwen/go-fuse/v2/splice/pool.go | 105 - .../hanwen/go-fuse/v2/splice/splice.go | 97 - .../inconshreveable/mousetrap/LICENSE | 13 - .../inconshreveable/mousetrap/README.md | 23 - .../inconshreveable/mousetrap/trap_others.go | 15 - .../inconshreveable/mousetrap/trap_windows.go | 98 - .../mousetrap/trap_windows_1.4.go | 46 - vendor/github.com/jlaffaye/ftp/.travis.yml | 14 - vendor/github.com/jlaffaye/ftp/LICENSE | 13 - vendor/github.com/jlaffaye/ftp/README.md | 57 - vendor/github.com/jlaffaye/ftp/debug.go | 21 - vendor/github.com/jlaffaye/ftp/ftp.go | 812 - vendor/github.com/jlaffaye/ftp/go.mod | 5 - vendor/github.com/jlaffaye/ftp/go.sum | 11 - vendor/github.com/jlaffaye/ftp/parse.go | 265 - vendor/github.com/jlaffaye/ftp/scanner.go | 58 - vendor/github.com/jlaffaye/ftp/status.go | 113 - vendor/github.com/jlaffaye/ftp/walker.go | 109 - .../jmespath/go-jmespath/.gitignore | 4 - .../jmespath/go-jmespath/.travis.yml | 17 - .../github.com/jmespath/go-jmespath/LICENSE | 13 - .../github.com/jmespath/go-jmespath/Makefile | 44 - .../github.com/jmespath/go-jmespath/README.md | 87 - vendor/github.com/jmespath/go-jmespath/api.go | 49 - .../go-jmespath/astnodetype_string.go | 16 - .../jmespath/go-jmespath/functions.go | 842 - vendor/github.com/jmespath/go-jmespath/go.mod | 5 - vendor/github.com/jmespath/go-jmespath/go.sum | 11 - .../jmespath/go-jmespath/interpreter.go | 418 - .../github.com/jmespath/go-jmespath/lexer.go | 420 - .../github.com/jmespath/go-jmespath/parser.go | 603 - .../jmespath/go-jmespath/toktype_string.go | 16 - .../github.com/jmespath/go-jmespath/util.go | 185 - .../github.com/json-iterator/go/.codecov.yml | 3 - vendor/github.com/json-iterator/go/.gitignore | 4 - .../github.com/json-iterator/go/.travis.yml | 14 - vendor/github.com/json-iterator/go/Gopkg.lock | 21 - vendor/github.com/json-iterator/go/Gopkg.toml | 26 - vendor/github.com/json-iterator/go/LICENSE | 21 - vendor/github.com/json-iterator/go/README.md | 87 - vendor/github.com/json-iterator/go/adapter.go | 150 - vendor/github.com/json-iterator/go/any.go | 325 - .../github.com/json-iterator/go/any_array.go | 278 - .../github.com/json-iterator/go/any_bool.go | 137 - .../github.com/json-iterator/go/any_float.go | 83 - .../github.com/json-iterator/go/any_int32.go | 74 - .../github.com/json-iterator/go/any_int64.go | 74 - .../json-iterator/go/any_invalid.go | 82 - vendor/github.com/json-iterator/go/any_nil.go | 69 - .../github.com/json-iterator/go/any_number.go | 123 - .../github.com/json-iterator/go/any_object.go | 374 - vendor/github.com/json-iterator/go/any_str.go | 166 - .../github.com/json-iterator/go/any_uint32.go | 74 - .../github.com/json-iterator/go/any_uint64.go | 74 - vendor/github.com/json-iterator/go/build.sh | 12 - vendor/github.com/json-iterator/go/config.go | 375 - .../go/fuzzy_mode_convert_table.md | 7 - vendor/github.com/json-iterator/go/go.mod | 11 - vendor/github.com/json-iterator/go/go.sum | 14 - vendor/github.com/json-iterator/go/iter.go | 349 - .../github.com/json-iterator/go/iter_array.go | 64 - .../github.com/json-iterator/go/iter_float.go | 339 - .../github.com/json-iterator/go/iter_int.go | 345 - .../json-iterator/go/iter_object.go | 267 - .../github.com/json-iterator/go/iter_skip.go | 130 - .../json-iterator/go/iter_skip_sloppy.go | 163 - .../json-iterator/go/iter_skip_strict.go | 99 - .../github.com/json-iterator/go/iter_str.go | 215 - .../github.com/json-iterator/go/jsoniter.go | 18 - vendor/github.com/json-iterator/go/pool.go | 42 - vendor/github.com/json-iterator/go/reflect.go | 337 - .../json-iterator/go/reflect_array.go | 104 - .../json-iterator/go/reflect_dynamic.go | 70 - .../json-iterator/go/reflect_extension.go | 483 - .../json-iterator/go/reflect_json_number.go | 112 - .../go/reflect_json_raw_message.go | 60 - .../json-iterator/go/reflect_map.go | 346 - .../json-iterator/go/reflect_marshaler.go | 225 - .../json-iterator/go/reflect_native.go | 453 - .../json-iterator/go/reflect_optional.go | 129 - .../json-iterator/go/reflect_slice.go | 99 - .../go/reflect_struct_decoder.go | 1092 - .../go/reflect_struct_encoder.go | 211 - vendor/github.com/json-iterator/go/stream.go | 210 - .../json-iterator/go/stream_float.go | 111 - .../github.com/json-iterator/go/stream_int.go | 190 - .../github.com/json-iterator/go/stream_str.go | 372 - vendor/github.com/json-iterator/go/test.sh | 12 - .../jzelinskie/whirlpool/.travis.yml | 1 - .../github.com/jzelinskie/whirlpool/LICENSE | 24 - .../github.com/jzelinskie/whirlpool/README.md | 43 - .../github.com/jzelinskie/whirlpool/const.go | 565 - .../jzelinskie/whirlpool/whirlpool.go | 240 - vendor/github.com/kardianos/osext/LICENSE | 27 - vendor/github.com/kardianos/osext/README.md | 21 - vendor/github.com/kardianos/osext/go.mod | 1 - vendor/github.com/kardianos/osext/osext.go | 33 - .../github.com/kardianos/osext/osext_go18.go | 9 - .../github.com/kardianos/osext/osext_plan9.go | 22 - .../kardianos/osext/osext_procfs.go | 36 - .../kardianos/osext/osext_sysctl.go | 126 - .../kardianos/osext/osext_windows.go | 36 - vendor/github.com/klauspost/cpuid/.gitignore | 24 - vendor/github.com/klauspost/cpuid/.travis.yml | 46 - .../klauspost/cpuid/CONTRIBUTING.txt | 35 - vendor/github.com/klauspost/cpuid/LICENSE | 22 - vendor/github.com/klauspost/cpuid/README.md | 187 - vendor/github.com/klauspost/cpuid/cpuid.go | 1504 - vendor/github.com/klauspost/cpuid/cpuid_386.s | 42 - .../github.com/klauspost/cpuid/cpuid_amd64.s | 42 - .../github.com/klauspost/cpuid/cpuid_arm64.s | 26 - .../klauspost/cpuid/detect_arm64.go | 215 - .../klauspost/cpuid/detect_intel.go | 33 - .../github.com/klauspost/cpuid/detect_ref.go | 14 - vendor/github.com/klauspost/cpuid/go.mod | 3 - .../go-windows-terminal-sequences/LICENSE | 9 - .../go-windows-terminal-sequences/README.md | 42 - .../go-windows-terminal-sequences/go.mod | 1 - .../sequences.go | 35 - .../sequences_dummy.go | 11 - .../github.com/koofr/go-httpclient/.gitignore | 11 - vendor/github.com/koofr/go-httpclient/LICENSE | 21 - .../github.com/koofr/go-httpclient/README.md | 17 - .../github.com/koofr/go-httpclient/errors.go | 38 - vendor/github.com/koofr/go-httpclient/go.mod | 8 - vendor/github.com/koofr/go-httpclient/go.sum | 31 - .../koofr/go-httpclient/httpclient.go | 375 - .../koofr/go-httpclient/requestdata.go | 98 - .../koofr/go-httpclient/requestdata_upload.go | 62 - .../koofr/go-httpclient/transport.go | 29 - .../github.com/koofr/go-httpclient/utils.go | 14 - .../koofr/go-koofrclient/.gitignore | 11 - .../github.com/koofr/go-koofrclient/LICENSE | 21 - .../github.com/koofr/go-koofrclient/README.md | 15 - .../koofr/go-koofrclient/api_scheme.go | 223 - .../github.com/koofr/go-koofrclient/client.go | 94 - .../koofr/go-koofrclient/client_device.go | 84 - .../koofr/go-koofrclient/client_files.go | 300 - .../koofr/go-koofrclient/client_mount.go | 38 - .../koofr/go-koofrclient/client_shared.go | 25 - .../koofr/go-koofrclient/client_user.go | 20 - vendor/github.com/kr/fs/LICENSE | 27 - vendor/github.com/kr/fs/Readme | 3 - vendor/github.com/kr/fs/filesystem.go | 36 - vendor/github.com/kr/fs/go.mod | 1 - vendor/github.com/kr/fs/walk.go | 95 - .../github.com/mattn/go-colorable/.travis.yml | 15 - vendor/github.com/mattn/go-colorable/LICENSE | 21 - .../github.com/mattn/go-colorable/README.md | 48 - .../mattn/go-colorable/colorable_appengine.go | 37 - .../mattn/go-colorable/colorable_others.go | 38 - .../mattn/go-colorable/colorable_windows.go | 1043 - vendor/github.com/mattn/go-colorable/go.mod | 8 - vendor/github.com/mattn/go-colorable/go.sum | 5 - .../github.com/mattn/go-colorable/go.test.sh | 12 - .../mattn/go-colorable/noncolorable.go | 55 - vendor/github.com/mattn/go-ieproxy/.gitignore | 1 - vendor/github.com/mattn/go-ieproxy/LICENSE | 23 - vendor/github.com/mattn/go-ieproxy/README.md | 49 - vendor/github.com/mattn/go-ieproxy/go.mod | 9 - vendor/github.com/mattn/go-ieproxy/go.sum | 11 - vendor/github.com/mattn/go-ieproxy/ieproxy.go | 51 - .../mattn/go-ieproxy/ieproxy_unix.go | 10 - .../mattn/go-ieproxy/ieproxy_windows.go | 213 - .../mattn/go-ieproxy/kernel32_data_windows.go | 19 - .../github.com/mattn/go-ieproxy/pac_unix.go | 7 - .../mattn/go-ieproxy/pac_windows.go | 72 - .../mattn/go-ieproxy/proxy_middleman.go | 11 - .../mattn/go-ieproxy/proxy_middleman_unix.go | 13 - .../go-ieproxy/proxy_middleman_windows.go | 52 - vendor/github.com/mattn/go-ieproxy/utils.go | 23 - .../mattn/go-ieproxy/winhttp_data_windows.go | 51 - vendor/github.com/mattn/go-isatty/.travis.yml | 14 - vendor/github.com/mattn/go-isatty/LICENSE | 9 - vendor/github.com/mattn/go-isatty/README.md | 50 - vendor/github.com/mattn/go-isatty/doc.go | 2 - vendor/github.com/mattn/go-isatty/go.mod | 5 - vendor/github.com/mattn/go-isatty/go.sum | 2 - vendor/github.com/mattn/go-isatty/go.test.sh | 12 - .../github.com/mattn/go-isatty/isatty_bsd.go | 18 - .../mattn/go-isatty/isatty_others.go | 15 - .../mattn/go-isatty/isatty_plan9.go | 22 - .../mattn/go-isatty/isatty_solaris.go | 22 - .../mattn/go-isatty/isatty_tcgets.go | 18 - .../mattn/go-isatty/isatty_windows.go | 125 - .../github.com/mattn/go-isatty/renovate.json | 8 - .../github.com/mattn/go-runewidth/.travis.yml | 16 - vendor/github.com/mattn/go-runewidth/LICENSE | 21 - .../github.com/mattn/go-runewidth/README.md | 27 - vendor/github.com/mattn/go-runewidth/go.mod | 3 - .../github.com/mattn/go-runewidth/go.test.sh | 12 - .../mattn/go-runewidth/runewidth.go | 257 - .../mattn/go-runewidth/runewidth_appengine.go | 8 - .../mattn/go-runewidth/runewidth_js.go | 9 - .../mattn/go-runewidth/runewidth_posix.go | 82 - .../mattn/go-runewidth/runewidth_table.go | 437 - .../mattn/go-runewidth/runewidth_windows.go | 28 - .../golang_protobuf_extensions/LICENSE | 201 - .../golang_protobuf_extensions/NOTICE | 1 - .../pbutil/.gitignore | 1 - .../pbutil/Makefile | 7 - .../pbutil/decode.go | 75 - .../golang_protobuf_extensions/pbutil/doc.go | 16 - .../pbutil/encode.go | 46 - vendor/github.com/minio/md5-simd/LICENSE | 202 - vendor/github.com/minio/md5-simd/README.md | 196 - .../minio/md5-simd/block-generic.go | 132 - .../github.com/minio/md5-simd/block16_amd64.s | 227 - .../github.com/minio/md5-simd/block8_amd64.s | 279 - .../github.com/minio/md5-simd/block_amd64.go | 199 - vendor/github.com/minio/md5-simd/go.mod | 7 - vendor/github.com/minio/md5-simd/go.sum | 2 - .../minio/md5-simd/md5-digest_amd64.go | 178 - .../minio/md5-simd/md5-server_amd64.go | 307 - .../minio/md5-simd/md5-server_fallback.go | 12 - .../minio/md5-simd/md5-util_amd64.go | 70 - vendor/github.com/minio/md5-simd/md5.go | 57 - .../github.com/minio/minio-go/v6/.gitignore | 4 - .../minio/minio-go/v6/.golangci.yml | 16 - .../minio/minio-go/v6/CONTRIBUTING.md | 23 - vendor/github.com/minio/minio-go/v6/LICENSE | 202 - .../minio/minio-go/v6/MAINTAINERS.md | 35 - vendor/github.com/minio/minio-go/v6/Makefile | 26 - vendor/github.com/minio/minio-go/v6/NOTICE | 2 - vendor/github.com/minio/minio-go/v6/README.md | 243 - .../minio/minio-go/v6/README_zh_CN.md | 244 - .../minio/minio-go/v6/api-bucket-tagging.go | 147 - .../minio/minio-go/v6/api-compose-object.go | 624 - .../minio/minio-go/v6/api-datatypes.go | 133 - .../minio/minio-go/v6/api-error-response.go | 286 - .../minio-go/v6/api-get-bucket-encryption.go | 71 - .../minio-go/v6/api-get-bucket-versioning.go | 78 - .../minio/minio-go/v6/api-get-lifecycle.go | 77 - .../minio-go/v6/api-get-object-acl-context.go | 140 - .../minio/minio-go/v6/api-get-object-acl.go | 27 - .../minio-go/v6/api-get-object-context.go | 26 - .../minio/minio-go/v6/api-get-object-file.go | 137 - .../minio/minio-go/v6/api-get-object.go | 644 - .../minio/minio-go/v6/api-get-options.go | 128 - .../minio/minio-go/v6/api-get-policy.go | 78 - .../github.com/minio/minio-go/v6/api-list.go | 849 - .../minio/minio-go/v6/api-notification.go | 263 - .../minio-go/v6/api-object-legal-hold.go | 176 - .../minio/minio-go/v6/api-object-lock.go | 241 - .../minio/minio-go/v6/api-object-retention.go | 168 - .../minio/minio-go/v6/api-object-tagging.go | 154 - .../minio/minio-go/v6/api-presigned.go | 215 - .../minio/minio-go/v6/api-put-bucket.go | 537 - .../minio-go/v6/api-put-object-common.go | 148 - .../minio-go/v6/api-put-object-context.go | 33 - .../minio/minio-go/v6/api-put-object-copy.go | 99 - .../v6/api-put-object-file-context.go | 64 - .../minio/minio-go/v6/api-put-object-file.go | 27 - .../minio-go/v6/api-put-object-multipart.go | 369 - .../minio-go/v6/api-put-object-streaming.go | 461 - .../minio/minio-go/v6/api-put-object.go | 321 - .../minio/minio-go/v6/api-remove.go | 380 - .../minio/minio-go/v6/api-s3-datatypes.go | 245 - .../minio/minio-go/v6/api-select.go | 751 - .../github.com/minio/minio-go/v6/api-stat.go | 110 - vendor/github.com/minio/minio-go/v6/api.go | 987 - .../minio/minio-go/v6/bucket-cache.go | 252 - .../minio/minio-go/v6/bucket-notification.go | 385 - .../github.com/minio/minio-go/v6/constants.go | 76 - vendor/github.com/minio/minio-go/v6/core.go | 185 - vendor/github.com/minio/minio-go/v6/go.mod | 16 - vendor/github.com/minio/minio-go/v6/go.sum | 57 - .../minio/minio-go/v6/hook-reader.go | 85 - .../v6/pkg/credentials/assume_role.go | 214 - .../minio-go/v6/pkg/credentials/chain.go | 89 - .../v6/pkg/credentials/config.json.sample | 17 - .../v6/pkg/credentials/credentials.go | 175 - .../v6/pkg/credentials/credentials.sample | 12 - .../minio/minio-go/v6/pkg/credentials/doc.go | 62 - .../minio-go/v6/pkg/credentials/env_aws.go | 71 - .../minio-go/v6/pkg/credentials/env_minio.go | 62 - .../pkg/credentials/file_aws_credentials.go | 120 - .../v6/pkg/credentials/file_minio_client.go | 135 - .../minio-go/v6/pkg/credentials/iam_aws.go | 322 - .../v6/pkg/credentials/signature-type.go | 77 - .../minio-go/v6/pkg/credentials/static.go | 67 - .../v6/pkg/credentials/sts_client_grants.go | 162 - .../v6/pkg/credentials/sts_ldap_identity.go | 119 - .../v6/pkg/credentials/sts_web_identity.go | 176 - .../minio-go/v6/pkg/encrypt/server-side.go | 198 - .../minio/minio-go/v6/pkg/s3utils/utils.go | 381 - .../minio/minio-go/v6/pkg/set/stringset.go | 200 - .../pkg/signer/request-signature-streaming.go | 306 - .../v6/pkg/signer/request-signature-v2.go | 316 - .../v6/pkg/signer/request-signature-v4.go | 318 - .../minio/minio-go/v6/pkg/signer/utils.go | 59 - .../minio/minio-go/v6/pkg/tags/tags.go | 330 - .../minio/minio-go/v6/post-policy.go | 291 - .../minio/minio-go/v6/retry-continous.go | 69 - vendor/github.com/minio/minio-go/v6/retry.go | 124 - .../minio/minio-go/v6/s3-endpoints.go | 57 - .../github.com/minio/minio-go/v6/s3-error.go | 61 - .../minio/minio-go/v6/staticcheck.conf | 1 - .../github.com/minio/minio-go/v6/transport.go | 83 - vendor/github.com/minio/minio-go/v6/utils.go | 411 - .../github.com/minio/sha256-simd/.gitignore | 1 - .../github.com/minio/sha256-simd/.travis.yml | 25 - vendor/github.com/minio/sha256-simd/LICENSE | 202 - vendor/github.com/minio/sha256-simd/README.md | 133 - .../github.com/minio/sha256-simd/appveyor.yml | 32 - vendor/github.com/minio/sha256-simd/cpuid.go | 119 - .../github.com/minio/sha256-simd/cpuid_386.go | 24 - .../github.com/minio/sha256-simd/cpuid_386.s | 53 - .../minio/sha256-simd/cpuid_amd64.go | 24 - .../minio/sha256-simd/cpuid_amd64.s | 53 - .../github.com/minio/sha256-simd/cpuid_arm.go | 32 - .../minio/sha256-simd/cpuid_linux_arm64.go | 49 - .../minio/sha256-simd/cpuid_other.go | 34 - vendor/github.com/minio/sha256-simd/go.mod | 3 - vendor/github.com/minio/sha256-simd/sha256.go | 409 - .../sha256-simd/sha256blockAvx2_amd64.go | 22 - .../minio/sha256-simd/sha256blockAvx2_amd64.s | 1449 - .../sha256-simd/sha256blockAvx512_amd64.asm | 686 - .../sha256-simd/sha256blockAvx512_amd64.go | 500 - .../sha256-simd/sha256blockAvx512_amd64.s | 267 - .../minio/sha256-simd/sha256blockAvx_amd64.go | 22 - .../minio/sha256-simd/sha256blockAvx_amd64.s | 408 - .../minio/sha256-simd/sha256blockSha_amd64.go | 6 - .../minio/sha256-simd/sha256blockSha_amd64.s | 266 - .../sha256-simd/sha256blockSsse_amd64.go | 22 - .../minio/sha256-simd/sha256blockSsse_amd64.s | 429 - .../minio/sha256-simd/sha256block_amd64.go | 53 - .../minio/sha256-simd/sha256block_arm64.go | 37 - .../minio/sha256-simd/sha256block_arm64.s | 192 - .../minio/sha256-simd/sha256block_other.go | 25 - .../minio/sha256-simd/test-architectures.sh | 15 - .../github.com/mitchellh/go-homedir/LICENSE | 21 - .../github.com/mitchellh/go-homedir/README.md | 14 - vendor/github.com/mitchellh/go-homedir/go.mod | 1 - .../mitchellh/go-homedir/homedir.go | 167 - .../modern-go/concurrent/.gitignore | 1 - .../modern-go/concurrent/.travis.yml | 14 - .../github.com/modern-go/concurrent/LICENSE | 201 - .../github.com/modern-go/concurrent/README.md | 49 - .../modern-go/concurrent/executor.go | 14 - .../modern-go/concurrent/go_above_19.go | 15 - .../modern-go/concurrent/go_below_19.go | 33 - vendor/github.com/modern-go/concurrent/log.go | 13 - .../github.com/modern-go/concurrent/test.sh | 12 - .../concurrent/unbounded_executor.go | 119 - .../github.com/modern-go/reflect2/.gitignore | 2 - .../github.com/modern-go/reflect2/.travis.yml | 15 - .../github.com/modern-go/reflect2/Gopkg.lock | 15 - .../github.com/modern-go/reflect2/Gopkg.toml | 35 - vendor/github.com/modern-go/reflect2/LICENSE | 201 - .../github.com/modern-go/reflect2/README.md | 71 - .../modern-go/reflect2/go_above_17.go | 8 - .../modern-go/reflect2/go_above_19.go | 14 - .../modern-go/reflect2/go_below_17.go | 9 - .../modern-go/reflect2/go_below_19.go | 14 - .../github.com/modern-go/reflect2/reflect2.go | 298 - .../modern-go/reflect2/reflect2_amd64.s | 0 .../modern-go/reflect2/reflect2_kind.go | 30 - .../modern-go/reflect2/relfect2_386.s | 0 .../modern-go/reflect2/relfect2_amd64p32.s | 0 .../modern-go/reflect2/relfect2_arm.s | 0 .../modern-go/reflect2/relfect2_arm64.s | 0 .../modern-go/reflect2/relfect2_mips64x.s | 0 .../modern-go/reflect2/relfect2_mipsx.s | 0 .../modern-go/reflect2/relfect2_ppc64x.s | 0 .../modern-go/reflect2/relfect2_s390x.s | 0 .../modern-go/reflect2/safe_field.go | 58 - .../github.com/modern-go/reflect2/safe_map.go | 101 - .../modern-go/reflect2/safe_slice.go | 92 - .../modern-go/reflect2/safe_struct.go | 29 - .../modern-go/reflect2/safe_type.go | 78 - vendor/github.com/modern-go/reflect2/test.sh | 12 - .../github.com/modern-go/reflect2/type_map.go | 113 - .../modern-go/reflect2/unsafe_array.go | 65 - .../modern-go/reflect2/unsafe_eface.go | 59 - .../modern-go/reflect2/unsafe_field.go | 74 - .../modern-go/reflect2/unsafe_iface.go | 64 - .../modern-go/reflect2/unsafe_link.go | 70 - .../modern-go/reflect2/unsafe_map.go | 138 - .../modern-go/reflect2/unsafe_ptr.go | 46 - .../modern-go/reflect2/unsafe_slice.go | 177 - .../modern-go/reflect2/unsafe_struct.go | 59 - .../modern-go/reflect2/unsafe_type.go | 85 - vendor/github.com/ncw/go-acd/.gitignore | 28 - vendor/github.com/ncw/go-acd/.travis.yml | 22 - vendor/github.com/ncw/go-acd/Godeps | 6 - vendor/github.com/ncw/go-acd/LICENSE | 14 - vendor/github.com/ncw/go-acd/Makefile | 55 - vendor/github.com/ncw/go-acd/README.md | 9 - vendor/github.com/ncw/go-acd/account.go | 142 - vendor/github.com/ncw/go-acd/changes.go | 85 - vendor/github.com/ncw/go-acd/client.go | 195 - vendor/github.com/ncw/go-acd/nodes.go | 766 - vendor/github.com/ncw/swift/.gitignore | 4 - vendor/github.com/ncw/swift/.travis.yml | 35 - vendor/github.com/ncw/swift/COPYING | 20 - vendor/github.com/ncw/swift/README.md | 163 - vendor/github.com/ncw/swift/auth.go | 335 - vendor/github.com/ncw/swift/auth_v3.go | 300 - .../github.com/ncw/swift/compatibility_1_0.go | 28 - .../github.com/ncw/swift/compatibility_1_1.go | 24 - .../github.com/ncw/swift/compatibility_1_6.go | 23 - .../ncw/swift/compatibility_not_1_6.go | 13 - vendor/github.com/ncw/swift/dlo.go | 149 - vendor/github.com/ncw/swift/doc.go | 19 - vendor/github.com/ncw/swift/go.mod | 1 - vendor/github.com/ncw/swift/largeobjects.go | 448 - vendor/github.com/ncw/swift/meta.go | 174 - vendor/github.com/ncw/swift/notes.txt | 55 - vendor/github.com/ncw/swift/slo.go | 171 - vendor/github.com/ncw/swift/swift.go | 2293 -- vendor/github.com/ncw/swift/timeout_reader.go | 59 - .../github.com/ncw/swift/travis_realserver.sh | 22 - .../github.com/ncw/swift/watchdog_reader.go | 55 - vendor/github.com/nsf/termbox-go/AUTHORS | 4 - vendor/github.com/nsf/termbox-go/LICENSE | 19 - vendor/github.com/nsf/termbox-go/README.md | 51 - vendor/github.com/nsf/termbox-go/api.go | 500 - .../github.com/nsf/termbox-go/api_common.go | 187 - .../github.com/nsf/termbox-go/api_windows.go | 257 - .../nsf/termbox-go/collect_terminfo.py | 110 - vendor/github.com/nsf/termbox-go/escwait.go | 11 - .../nsf/termbox-go/escwait_darwin.go | 9 - .../nsf/termbox-go/syscalls_darwin.go | 41 - .../nsf/termbox-go/syscalls_darwin_amd64.go | 40 - .../nsf/termbox-go/syscalls_dragonfly.go | 39 - .../nsf/termbox-go/syscalls_freebsd.go | 39 - .../nsf/termbox-go/syscalls_linux.go | 33 - .../nsf/termbox-go/syscalls_netbsd.go | 39 - .../nsf/termbox-go/syscalls_openbsd.go | 39 - .../nsf/termbox-go/syscalls_windows.go | 61 - vendor/github.com/nsf/termbox-go/termbox.go | 529 - .../nsf/termbox-go/termbox_common.go | 59 - .../nsf/termbox-go/termbox_windows.go | 952 - vendor/github.com/nsf/termbox-go/terminfo.go | 232 - .../nsf/termbox-go/terminfo_builtin.go | 64 - vendor/github.com/okzk/sdnotify/LICENSE | 21 - vendor/github.com/okzk/sdnotify/README.md | 15 - vendor/github.com/okzk/sdnotify/notify.go | 9 - .../github.com/okzk/sdnotify/notify_linux.go | 23 - vendor/github.com/okzk/sdnotify/util.go | 39 - .../patrickmn/go-cache/CONTRIBUTORS | 9 - vendor/github.com/patrickmn/go-cache/LICENSE | 19 - .../github.com/patrickmn/go-cache/README.md | 83 - vendor/github.com/patrickmn/go-cache/cache.go | 1161 - .../github.com/patrickmn/go-cache/sharded.go | 192 - vendor/github.com/pengsrc/go-shared/LICENSE | 202 - .../pengsrc/go-shared/buffer/bytes.go | 102 - .../pengsrc/go-shared/buffer/bytes_pool.go | 39 - .../github.com/pengsrc/go-shared/check/dir.go | 17 - .../pengsrc/go-shared/check/error.go | 37 - .../pengsrc/go-shared/check/host.go | 11 - .../pengsrc/go-shared/check/slice.go | 41 - .../pengsrc/go-shared/convert/string.go | 10 - .../pengsrc/go-shared/convert/time.go | 82 - .../pengsrc/go-shared/convert/types.go | 550 - .../go-shared/log/context_free_logger.go | 79 - .../github.com/pengsrc/go-shared/log/event.go | 456 - .../pengsrc/go-shared/log/exported.go | 151 - .../github.com/pengsrc/go-shared/log/level.go | 67 - .../pengsrc/go-shared/log/logger.go | 327 - .../pengsrc/go-shared/log/writer.go | 83 - .../pengsrc/go-shared/reopen/reopen.go | 182 - 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/pkg/sftp/.gitignore | 7 - vendor/github.com/pkg/sftp/.travis.yml | 40 - vendor/github.com/pkg/sftp/CONTRIBUTORS | 3 - vendor/github.com/pkg/sftp/LICENSE | 9 - vendor/github.com/pkg/sftp/Makefile | 11 - vendor/github.com/pkg/sftp/README.md | 44 - vendor/github.com/pkg/sftp/attrs.go | 246 - vendor/github.com/pkg/sftp/attrs_stubs.go | 11 - vendor/github.com/pkg/sftp/attrs_unix.go | 17 - vendor/github.com/pkg/sftp/client.go | 1348 - vendor/github.com/pkg/sftp/conn.go | 146 - vendor/github.com/pkg/sftp/debug.go | 9 - vendor/github.com/pkg/sftp/go.mod | 10 - vendor/github.com/pkg/sftp/go.sum | 23 - vendor/github.com/pkg/sftp/match.go | 295 - vendor/github.com/pkg/sftp/packet-manager.go | 203 - vendor/github.com/pkg/sftp/packet-typing.go | 136 - vendor/github.com/pkg/sftp/packet.go | 1022 - vendor/github.com/pkg/sftp/release.go | 5 - vendor/github.com/pkg/sftp/request-attrs.go | 63 - vendor/github.com/pkg/sftp/request-errors.go | 54 - vendor/github.com/pkg/sftp/request-example.go | 307 - .../github.com/pkg/sftp/request-interfaces.go | 64 - vendor/github.com/pkg/sftp/request-readme.md | 53 - vendor/github.com/pkg/sftp/request-server.go | 239 - vendor/github.com/pkg/sftp/request-unix.go | 23 - vendor/github.com/pkg/sftp/request.go | 387 - vendor/github.com/pkg/sftp/request_windows.go | 11 - vendor/github.com/pkg/sftp/server.go | 689 - .../pkg/sftp/server_statvfs_darwin.go | 21 - .../pkg/sftp/server_statvfs_impl.go | 25 - .../pkg/sftp/server_statvfs_linux.go | 22 - .../pkg/sftp/server_statvfs_stubs.go | 11 - vendor/github.com/pkg/sftp/server_stubs.go | 32 - vendor/github.com/pkg/sftp/server_unix.go | 54 - vendor/github.com/pkg/sftp/sftp.go | 259 - vendor/github.com/pkg/sftp/syscall_fixed.go | 9 - vendor/github.com/pkg/sftp/syscall_good.go | 8 - vendor/github.com/pmezard/go-difflib/LICENSE | 27 - .../pmezard/go-difflib/difflib/difflib.go | 772 - .../prometheus/client_golang/LICENSE | 201 - .../prometheus/client_golang/NOTICE | 23 - .../client_golang/prometheus/.gitignore | 1 - .../client_golang/prometheus/README.md | 1 - .../client_golang/prometheus/build_info.go | 29 - .../prometheus/build_info_pre_1.12.go | 22 - .../client_golang/prometheus/collector.go | 120 - .../client_golang/prometheus/counter.go | 321 - .../client_golang/prometheus/desc.go | 186 - .../client_golang/prometheus/doc.go | 199 - .../prometheus/expvar_collector.go | 119 - .../client_golang/prometheus/fnv.go | 42 - .../client_golang/prometheus/gauge.go | 289 - .../client_golang/prometheus/go_collector.go | 396 - .../client_golang/prometheus/histogram.go | 637 - .../prometheus/internal/metric.go | 85 - .../client_golang/prometheus/labels.go | 87 - .../client_golang/prometheus/metric.go | 176 - .../client_golang/prometheus/observer.go | 64 - .../prometheus/process_collector.go | 151 - .../prometheus/process_collector_other.go | 65 - .../prometheus/process_collector_windows.go | 116 - .../prometheus/promhttp/delegator.go | 370 - .../client_golang/prometheus/promhttp/http.go | 379 - .../prometheus/promhttp/instrument_client.go | 219 - .../prometheus/promhttp/instrument_server.go | 447 - .../client_golang/prometheus/registry.go | 948 - .../client_golang/prometheus/summary.go | 737 - .../client_golang/prometheus/timer.go | 54 - .../client_golang/prometheus/untyped.go | 42 - .../client_golang/prometheus/value.go | 205 - .../client_golang/prometheus/vec.go | 484 - .../client_golang/prometheus/wrap.go | 212 - .../prometheus/client_model/LICENSE | 201 - .../github.com/prometheus/client_model/NOTICE | 5 - .../prometheus/client_model/go/metrics.pb.go | 723 - vendor/github.com/prometheus/common/LICENSE | 201 - vendor/github.com/prometheus/common/NOTICE | 5 - .../prometheus/common/expfmt/decode.go | 429 - .../prometheus/common/expfmt/encode.go | 162 - .../prometheus/common/expfmt/expfmt.go | 41 - .../prometheus/common/expfmt/fuzz.go | 36 - .../common/expfmt/openmetrics_create.go | 527 - .../prometheus/common/expfmt/text_create.go | 465 - .../prometheus/common/expfmt/text_parse.go | 764 - .../bitbucket.org/ww/goautoneg/README.txt | 67 - .../bitbucket.org/ww/goautoneg/autoneg.go | 162 - .../prometheus/common/model/alert.go | 136 - .../prometheus/common/model/fingerprinting.go | 105 - .../github.com/prometheus/common/model/fnv.go | 42 - .../prometheus/common/model/labels.go | 210 - .../prometheus/common/model/labelset.go | 169 - .../prometheus/common/model/metric.go | 102 - .../prometheus/common/model/model.go | 16 - .../prometheus/common/model/signature.go | 144 - .../prometheus/common/model/silence.go | 106 - .../prometheus/common/model/time.go | 274 - .../prometheus/common/model/value.go | 416 - .../github.com/prometheus/procfs/.gitignore | 1 - .../prometheus/procfs/.golangci.yml | 4 - .../prometheus/procfs/CONTRIBUTING.md | 121 - vendor/github.com/prometheus/procfs/LICENSE | 201 - .../prometheus/procfs/MAINTAINERS.md | 2 - vendor/github.com/prometheus/procfs/Makefile | 29 - .../prometheus/procfs/Makefile.common | 300 - vendor/github.com/prometheus/procfs/NOTICE | 7 - vendor/github.com/prometheus/procfs/README.md | 61 - vendor/github.com/prometheus/procfs/arp.go | 85 - .../github.com/prometheus/procfs/buddyinfo.go | 85 - .../github.com/prometheus/procfs/cpuinfo.go | 420 - .../prometheus/procfs/cpuinfo_arm.go | 18 - .../prometheus/procfs/cpuinfo_arm64.go | 19 - .../prometheus/procfs/cpuinfo_default.go | 19 - .../prometheus/procfs/cpuinfo_mips.go | 18 - .../prometheus/procfs/cpuinfo_mips64.go | 18 - .../prometheus/procfs/cpuinfo_mips64le.go | 18 - .../prometheus/procfs/cpuinfo_mipsle.go | 18 - .../prometheus/procfs/cpuinfo_ppc64.go | 18 - .../prometheus/procfs/cpuinfo_ppc64le.go | 18 - .../prometheus/procfs/cpuinfo_s390x.go | 18 - vendor/github.com/prometheus/procfs/crypto.go | 153 - vendor/github.com/prometheus/procfs/doc.go | 45 - .../prometheus/procfs/fixtures.ttar | 6114 --- vendor/github.com/prometheus/procfs/fs.go | 43 - .../github.com/prometheus/procfs/fscache.go | 422 - vendor/github.com/prometheus/procfs/go.mod | 9 - vendor/github.com/prometheus/procfs/go.sum | 6 - .../prometheus/procfs/internal/fs/fs.go | 55 - .../prometheus/procfs/internal/util/parse.go | 97 - .../procfs/internal/util/readfile.go | 38 - .../procfs/internal/util/sysreadfile.go | 48 - .../internal/util/sysreadfile_compat.go | 26 - .../procfs/internal/util/valueparser.go | 91 - vendor/github.com/prometheus/procfs/ipvs.go | 241 - .../prometheus/procfs/kernel_random.go | 62 - .../github.com/prometheus/procfs/loadavg.go | 62 - vendor/github.com/prometheus/procfs/mdstat.go | 194 - .../github.com/prometheus/procfs/meminfo.go | 277 - .../github.com/prometheus/procfs/mountinfo.go | 180 - .../prometheus/procfs/mountstats.go | 629 - .../prometheus/procfs/net_conntrackstat.go | 153 - .../github.com/prometheus/procfs/net_dev.go | 205 - .../prometheus/procfs/net_sockstat.go | 163 - .../prometheus/procfs/net_softnet.go | 102 - .../github.com/prometheus/procfs/net_udp.go | 229 - .../github.com/prometheus/procfs/net_unix.go | 257 - vendor/github.com/prometheus/procfs/proc.go | 319 - .../prometheus/procfs/proc_cgroup.go | 98 - .../prometheus/procfs/proc_environ.go | 37 - .../prometheus/procfs/proc_fdinfo.go | 133 - .../github.com/prometheus/procfs/proc_io.go | 59 - .../prometheus/procfs/proc_limits.go | 157 - .../github.com/prometheus/procfs/proc_maps.go | 209 - .../github.com/prometheus/procfs/proc_ns.go | 68 - .../github.com/prometheus/procfs/proc_psi.go | 100 - .../prometheus/procfs/proc_smaps.go | 165 - .../github.com/prometheus/procfs/proc_stat.go | 192 - .../prometheus/procfs/proc_status.go | 166 - .../github.com/prometheus/procfs/schedstat.go | 118 - vendor/github.com/prometheus/procfs/stat.go | 244 - vendor/github.com/prometheus/procfs/swaps.go | 89 - vendor/github.com/prometheus/procfs/ttar | 413 - vendor/github.com/prometheus/procfs/vm.go | 210 - vendor/github.com/prometheus/procfs/xfrm.go | 187 - .../github.com/prometheus/procfs/zoneinfo.go | 196 - .../putdotio/go-putio/putio/LICENSE | 22 - .../putdotio/go-putio/putio/account.go | 42 - .../putdotio/go-putio/putio/client.go | 184 - .../github.com/putdotio/go-putio/putio/doc.go | 11 - .../putdotio/go-putio/putio/error.go | 37 - .../putdotio/go-putio/putio/events.go | 43 - .../putdotio/go-putio/putio/files.go | 429 - .../putdotio/go-putio/putio/friends.go | 124 - .../github.com/putdotio/go-putio/putio/go.mod | 3 - .../putdotio/go-putio/putio/time.go | 33 - .../putdotio/go-putio/putio/transfers.go | 154 - .../putdotio/go-putio/putio/types.go | 166 - .../putdotio/go-putio/putio/zips.go | 79 - vendor/github.com/rfjakob/eme/.travis.yml | 11 - vendor/github.com/rfjakob/eme/LICENSE | 21 - vendor/github.com/rfjakob/eme/README.md | 111 - vendor/github.com/rfjakob/eme/benchmark.bash | 3 - vendor/github.com/rfjakob/eme/eme.go | 206 - .../github.com/rfjakob/eme/paper-eme-fig2.png | Bin 9648 -> 0 bytes vendor/github.com/rfjakob/eme/test.bash | 5 - .../russross/blackfriday/v2/.gitignore | 8 - .../russross/blackfriday/v2/.travis.yml | 17 - .../russross/blackfriday/v2/LICENSE.txt | 29 - .../russross/blackfriday/v2/README.md | 291 - .../russross/blackfriday/v2/block.go | 1590 - .../github.com/russross/blackfriday/v2/doc.go | 18 - .../github.com/russross/blackfriday/v2/esc.go | 34 - .../github.com/russross/blackfriday/v2/go.mod | 1 - .../russross/blackfriday/v2/html.go | 949 - .../russross/blackfriday/v2/inline.go | 1228 - .../russross/blackfriday/v2/markdown.go | 950 - .../russross/blackfriday/v2/node.go | 354 - .../russross/blackfriday/v2/smartypants.go | 457 - .../github.com/sevlyar/go-daemon/.travis.yml | 15 - vendor/github.com/sevlyar/go-daemon/LICENSE | 7 - vendor/github.com/sevlyar/go-daemon/README.md | 63 - .../github.com/sevlyar/go-daemon/command.go | 99 - vendor/github.com/sevlyar/go-daemon/daemon.go | 44 - .../sevlyar/go-daemon/daemon_stub.go | 52 - .../sevlyar/go-daemon/daemon_unix.go | 260 - .../github.com/sevlyar/go-daemon/lock_file.go | 109 - .../sevlyar/go-daemon/lock_file_solaris.go | 40 - .../sevlyar/go-daemon/lock_file_stub.go | 11 - .../sevlyar/go-daemon/lock_file_unix.go | 23 - .../sevlyar/go-daemon/os_executable.go | 11 - .../sevlyar/go-daemon/os_executable_pre18.go | 11 - vendor/github.com/sevlyar/go-daemon/signal.go | 59 - .../sevlyar/go-daemon/syscall_dup.go | 11 - .../sevlyar/go-daemon/syscall_dup_arm64.go | 11 - .../sevlyar/go-daemon/syscall_dup_pre17.go | 13 - .../sanitized_anchor_name/.travis.yml | 16 - .../shurcooL/sanitized_anchor_name/LICENSE | 21 - .../shurcooL/sanitized_anchor_name/README.md | 36 - .../shurcooL/sanitized_anchor_name/go.mod | 1 - .../shurcooL/sanitized_anchor_name/main.go | 29 - vendor/github.com/sirupsen/logrus/.gitignore | 2 - .../github.com/sirupsen/logrus/.golangci.yml | 40 - vendor/github.com/sirupsen/logrus/.travis.yml | 17 - .../github.com/sirupsen/logrus/CHANGELOG.md | 223 - vendor/github.com/sirupsen/logrus/LICENSE | 21 - vendor/github.com/sirupsen/logrus/README.md | 513 - vendor/github.com/sirupsen/logrus/alt_exit.go | 76 - .../github.com/sirupsen/logrus/appveyor.yml | 14 - vendor/github.com/sirupsen/logrus/doc.go | 26 - vendor/github.com/sirupsen/logrus/entry.go | 426 - vendor/github.com/sirupsen/logrus/exported.go | 225 - .../github.com/sirupsen/logrus/formatter.go | 78 - vendor/github.com/sirupsen/logrus/go.mod | 11 - vendor/github.com/sirupsen/logrus/go.sum | 12 - vendor/github.com/sirupsen/logrus/hooks.go | 34 - .../sirupsen/logrus/json_formatter.go | 125 - vendor/github.com/sirupsen/logrus/logger.go | 352 - vendor/github.com/sirupsen/logrus/logrus.go | 186 - .../logrus/terminal_check_appengine.go | 11 - .../sirupsen/logrus/terminal_check_bsd.go | 13 - .../sirupsen/logrus/terminal_check_js.go | 7 - .../logrus/terminal_check_no_terminal.go | 11 - .../logrus/terminal_check_notappengine.go | 17 - .../sirupsen/logrus/terminal_check_solaris.go | 11 - .../sirupsen/logrus/terminal_check_unix.go | 13 - .../sirupsen/logrus/terminal_check_windows.go | 34 - .../sirupsen/logrus/text_formatter.go | 334 - vendor/github.com/sirupsen/logrus/writer.go | 70 - .../github.com/skratchdot/open-golang/LICENSE | 22 - .../skratchdot/open-golang/open/exec.go | 18 - .../open-golang/open/exec_darwin.go | 15 - .../open-golang/open/exec_windows.go | 33 - .../skratchdot/open-golang/open/open.go | 50 - .../spacemonkeygo/monkit/v3/AUTHORS | 1 - .../spacemonkeygo/monkit/v3/LICENSE | 191 - .../spacemonkeygo/monkit/v3/README.md | 637 - .../spacemonkeygo/monkit/v3/callers.go | 48 - .../spacemonkeygo/monkit/v3/cas_safe.go | 75 - .../spacemonkeygo/monkit/v3/cas_unsafe.go | 70 - .../spacemonkeygo/monkit/v3/counter.go | 129 - .../github.com/spacemonkeygo/monkit/v3/ctx.go | 390 - .../spacemonkeygo/monkit/v3/dist.go | 61 - .../spacemonkeygo/monkit/v3/distgen.go.m4 | 185 - .../github.com/spacemonkeygo/monkit/v3/doc.go | 579 - .../spacemonkeygo/monkit/v3/durdist.go | 185 - .../spacemonkeygo/monkit/v3/error_names.go | 114 - .../spacemonkeygo/monkit/v3/error_names_ae.go | 21 - .../monkit/v3/error_names_syscall.go | 24 - .../spacemonkeygo/monkit/v3/floatdist.go | 184 - .../spacemonkeygo/monkit/v3/func.go | 71 - .../spacemonkeygo/monkit/v3/funcset.go | 78 - .../spacemonkeygo/monkit/v3/funcstats.go | 219 - .../github.com/spacemonkeygo/monkit/v3/go.mod | 5 - .../github.com/spacemonkeygo/monkit/v3/go.sum | 5 - .../github.com/spacemonkeygo/monkit/v3/id.go | 48 - .../spacemonkeygo/monkit/v3/intdist.go | 184 - .../spacemonkeygo/monkit/v3/meter.go | 212 - .../monkit/v3/monotime/monotime.go | 7 - .../monkit/v3/monotime/monotime_fallback.go | 7 - .../monkit/v3/monotime/monotime_windows.go | 27 - .../spacemonkeygo/monkit/v3/registry.go | 256 - .../github.com/spacemonkeygo/monkit/v3/rng.go | 181 - .../spacemonkeygo/monkit/v3/scope.go | 301 - .../spacemonkeygo/monkit/v3/span.go | 146 - .../spacemonkeygo/monkit/v3/spanbag.go | 59 - .../spacemonkeygo/monkit/v3/spinlock.go | 35 - .../spacemonkeygo/monkit/v3/stats.go | 77 - .../spacemonkeygo/monkit/v3/struct.go | 59 - .../spacemonkeygo/monkit/v3/tags.go | 157 - .../spacemonkeygo/monkit/v3/task.go | 74 - .../spacemonkeygo/monkit/v3/timer.go | 96 - .../spacemonkeygo/monkit/v3/trace.go | 155 - .../github.com/spacemonkeygo/monkit/v3/val.go | 204 - vendor/github.com/spf13/cobra/.gitignore | 39 - vendor/github.com/spf13/cobra/.mailmap | 3 - vendor/github.com/spf13/cobra/.travis.yml | 29 - vendor/github.com/spf13/cobra/LICENSE.txt | 174 - vendor/github.com/spf13/cobra/Makefile | 36 - vendor/github.com/spf13/cobra/README.md | 770 - vendor/github.com/spf13/cobra/args.go | 109 - .../spf13/cobra/bash_completions.go | 641 - .../spf13/cobra/bash_completions.md | 383 - vendor/github.com/spf13/cobra/cobra.go | 207 - vendor/github.com/spf13/cobra/command.go | 1634 - .../github.com/spf13/cobra/command_notwin.go | 5 - vendor/github.com/spf13/cobra/command_win.go | 26 - .../spf13/cobra/custom_completions.go | 384 - vendor/github.com/spf13/cobra/doc/man_docs.go | 247 - vendor/github.com/spf13/cobra/doc/man_docs.md | 31 - vendor/github.com/spf13/cobra/doc/md_docs.go | 159 - vendor/github.com/spf13/cobra/doc/md_docs.md | 115 - .../github.com/spf13/cobra/doc/rest_docs.go | 185 - .../github.com/spf13/cobra/doc/rest_docs.md | 114 - vendor/github.com/spf13/cobra/doc/util.go | 51 - .../github.com/spf13/cobra/doc/yaml_docs.go | 169 - .../github.com/spf13/cobra/doc/yaml_docs.md | 112 - .../spf13/cobra/fish_completions.go | 172 - .../spf13/cobra/fish_completions.md | 7 - vendor/github.com/spf13/cobra/go.mod | 12 - vendor/github.com/spf13/cobra/go.sum | 149 - .../spf13/cobra/powershell_completions.go | 100 - .../spf13/cobra/powershell_completions.md | 14 - .../spf13/cobra/shell_completions.go | 85 - .../github.com/spf13/cobra/zsh_completions.go | 336 - .../github.com/spf13/cobra/zsh_completions.md | 39 - vendor/github.com/spf13/pflag/.gitignore | 2 - vendor/github.com/spf13/pflag/.travis.yml | 22 - vendor/github.com/spf13/pflag/LICENSE | 28 - vendor/github.com/spf13/pflag/README.md | 296 - vendor/github.com/spf13/pflag/bool.go | 94 - vendor/github.com/spf13/pflag/bool_slice.go | 185 - vendor/github.com/spf13/pflag/bytes.go | 209 - vendor/github.com/spf13/pflag/count.go | 96 - vendor/github.com/spf13/pflag/duration.go | 86 - .../github.com/spf13/pflag/duration_slice.go | 166 - vendor/github.com/spf13/pflag/flag.go | 1239 - vendor/github.com/spf13/pflag/float32.go | 88 - .../github.com/spf13/pflag/float32_slice.go | 174 - vendor/github.com/spf13/pflag/float64.go | 84 - .../github.com/spf13/pflag/float64_slice.go | 166 - vendor/github.com/spf13/pflag/go.mod | 3 - vendor/github.com/spf13/pflag/go.sum | 0 vendor/github.com/spf13/pflag/golangflag.go | 105 - vendor/github.com/spf13/pflag/int.go | 84 - vendor/github.com/spf13/pflag/int16.go | 88 - vendor/github.com/spf13/pflag/int32.go | 88 - vendor/github.com/spf13/pflag/int32_slice.go | 174 - vendor/github.com/spf13/pflag/int64.go | 84 - vendor/github.com/spf13/pflag/int64_slice.go | 166 - vendor/github.com/spf13/pflag/int8.go | 88 - vendor/github.com/spf13/pflag/int_slice.go | 158 - vendor/github.com/spf13/pflag/ip.go | 94 - vendor/github.com/spf13/pflag/ip_slice.go | 186 - vendor/github.com/spf13/pflag/ipmask.go | 122 - vendor/github.com/spf13/pflag/ipnet.go | 98 - vendor/github.com/spf13/pflag/string.go | 80 - vendor/github.com/spf13/pflag/string_array.go | 129 - vendor/github.com/spf13/pflag/string_slice.go | 163 - .../github.com/spf13/pflag/string_to_int.go | 149 - .../github.com/spf13/pflag/string_to_int64.go | 149 - .../spf13/pflag/string_to_string.go | 160 - vendor/github.com/spf13/pflag/uint.go | 88 - vendor/github.com/spf13/pflag/uint16.go | 88 - vendor/github.com/spf13/pflag/uint32.go | 88 - vendor/github.com/spf13/pflag/uint64.go | 88 - vendor/github.com/spf13/pflag/uint8.go | 88 - vendor/github.com/spf13/pflag/uint_slice.go | 168 - vendor/github.com/stretchr/testify/LICENSE | 21 - .../testify/assert/assertion_compare.go | 274 - .../testify/assert/assertion_format.go | 644 - .../testify/assert/assertion_format.go.tmpl | 5 - .../testify/assert/assertion_forward.go | 1276 - .../testify/assert/assertion_forward.go.tmpl | 5 - .../stretchr/testify/assert/assertions.go | 1695 - .../github.com/stretchr/testify/assert/doc.go | 45 - .../stretchr/testify/assert/errors.go | 10 - .../testify/assert/forward_assertions.go | 16 - .../testify/assert/http_assertions.go | 162 - .../stretchr/testify/require/doc.go | 28 - .../testify/require/forward_requirements.go | 16 - .../stretchr/testify/require/require.go | 1631 - .../stretchr/testify/require/require.go.tmpl | 6 - .../testify/require/require_forward.go | 1277 - .../testify/require/require_forward.go.tmpl | 5 - .../stretchr/testify/require/requirements.go | 29 - .../github.com/t3rm1n4l/go-mega/.travis.yml | 27 - vendor/github.com/t3rm1n4l/go-mega/LICENSE | 21 - vendor/github.com/t3rm1n4l/go-mega/Makefile | 18 - vendor/github.com/t3rm1n4l/go-mega/README.md | 65 - vendor/github.com/t3rm1n4l/go-mega/errors.go | 106 - vendor/github.com/t3rm1n4l/go-mega/go.mod | 3 - vendor/github.com/t3rm1n4l/go-mega/go.sum | 2 - vendor/github.com/t3rm1n4l/go-mega/mega.go | 2051 -- .../github.com/t3rm1n4l/go-mega/messages.go | 216 - vendor/github.com/t3rm1n4l/go-mega/utils.go | 376 - .../github.com/vivint/infectious/.travis.yml | 14 - vendor/github.com/vivint/infectious/LICENSE | 67 - vendor/github.com/vivint/infectious/README.md | 133 - .../vivint/infectious/addmul_amd64.go | 58 - .../vivint/infectious/addmul_amd64.s | 199 - .../vivint/infectious/addmul_noasm.go | 40 - .../vivint/infectious/addmul_tables_amd64.go | 288 - .../vivint/infectious/berlekamp_welch.go | 246 - vendor/github.com/vivint/infectious/common.go | 50 - vendor/github.com/vivint/infectious/fec.go | 323 - vendor/github.com/vivint/infectious/gf_alg.go | 423 - vendor/github.com/vivint/infectious/go.mod | 5 - vendor/github.com/vivint/infectious/go.sum | 2 - vendor/github.com/vivint/infectious/math.go | 182 - vendor/github.com/vivint/infectious/tables.go | 154 - vendor/github.com/xanzy/ssh-agent/.gitignore | 24 - vendor/github.com/xanzy/ssh-agent/LICENSE | 202 - vendor/github.com/xanzy/ssh-agent/README.md | 23 - vendor/github.com/xanzy/ssh-agent/go.mod | 6 - vendor/github.com/xanzy/ssh-agent/go.sum | 4 - .../xanzy/ssh-agent/pageant_windows.go | 146 - vendor/github.com/xanzy/ssh-agent/sshagent.go | 49 - .../xanzy/ssh-agent/sshagent_windows.go | 80 - vendor/github.com/youmark/pkcs8/.gitignore | 23 - vendor/github.com/youmark/pkcs8/.travis.yml | 11 - vendor/github.com/youmark/pkcs8/LICENSE | 21 - vendor/github.com/youmark/pkcs8/README | 1 - vendor/github.com/youmark/pkcs8/README.md | 22 - vendor/github.com/youmark/pkcs8/cipher.go | 60 - .../github.com/youmark/pkcs8/cipher_3des.go | 24 - vendor/github.com/youmark/pkcs8/cipher_aes.go | 84 - vendor/github.com/youmark/pkcs8/go.mod | 5 - vendor/github.com/youmark/pkcs8/go.sum | 7 - vendor/github.com/youmark/pkcs8/kdf_pbkdf2.go | 91 - vendor/github.com/youmark/pkcs8/kdf_scrypt.go | 62 - vendor/github.com/youmark/pkcs8/pkcs8.go | 309 - .../yunify/qingstor-sdk-go/v3/.gitignore | 29 - .../yunify/qingstor-sdk-go/v3/.gitmodules | 6 - .../yunify/qingstor-sdk-go/v3/.travis.yml | 39 - .../yunify/qingstor-sdk-go/v3/AUTHORS | 4 - .../yunify/qingstor-sdk-go/v3/CHANGELOG.md | 263 - .../yunify/qingstor-sdk-go/v3/LICENSE | 201 - .../yunify/qingstor-sdk-go/v3/MAINTAINERS | 1 - .../yunify/qingstor-sdk-go/v3/Makefile | 93 - .../yunify/qingstor-sdk-go/v3/README.md | 44 - .../yunify/qingstor-sdk-go/v3/README_zh-CN.md | 44 - .../qingstor-sdk-go/v3/config/config.go | 275 - .../qingstor-sdk-go/v3/config/contract.go | 73 - .../yunify/qingstor-sdk-go/v3/go.mod | 9 - .../yunify/qingstor-sdk-go/v3/go.sum | 13 - .../qingstor-sdk-go/v3/logger/logger.go | 102 - .../v3/request/builder/builder.go | 386 - .../qingstor-sdk-go/v3/request/data/input.go | 22 - .../v3/request/data/operation.go | 35 - .../v3/request/data/validation.go | 22 - .../v3/request/errors/parameters.go | 53 - .../v3/request/errors/qingstor.go | 36 - .../qingstor-sdk-go/v3/request/request.go | 240 - .../v3/request/signer/qingstor.go | 263 - .../v3/request/unpacker/base.go | 221 - .../v3/request/unpacker/qingstor.go | 103 - .../qingstor-sdk-go/v3/service/bucket.go | 1651 - .../v3/service/convert_types.go | 280 - .../qingstor-sdk-go/v3/service/object.go | 1199 - .../qingstor-sdk-go/v3/service/qingstor.go | 108 - .../qingstor-sdk-go/v3/service/types.go | 713 - .../v3/utils/check_metadata.go | 75 - .../yunify/qingstor-sdk-go/v3/utils/conn.go | 129 - .../yunify/qingstor-sdk-go/v3/utils/escape.go | 23 - .../yunify/qingstor-sdk-go/v3/version.go | 23 - vendor/github.com/zeebo/errs/.gitignore | 1 - vendor/github.com/zeebo/errs/AUTHORS | 4 - vendor/github.com/zeebo/errs/LICENSE | 21 - vendor/github.com/zeebo/errs/README.md | 235 - vendor/github.com/zeebo/errs/errs.go | 296 - vendor/github.com/zeebo/errs/go.mod | 3 - vendor/github.com/zeebo/errs/group.go | 100 - vendor/go.etcd.io/bbolt/.gitignore | 5 - vendor/go.etcd.io/bbolt/.travis.yml | 17 - vendor/go.etcd.io/bbolt/LICENSE | 20 - vendor/go.etcd.io/bbolt/Makefile | 38 - vendor/go.etcd.io/bbolt/README.md | 957 - vendor/go.etcd.io/bbolt/bolt_386.go | 7 - vendor/go.etcd.io/bbolt/bolt_amd64.go | 7 - vendor/go.etcd.io/bbolt/bolt_arm.go | 7 - vendor/go.etcd.io/bbolt/bolt_arm64.go | 9 - vendor/go.etcd.io/bbolt/bolt_linux.go | 10 - vendor/go.etcd.io/bbolt/bolt_mips64x.go | 9 - vendor/go.etcd.io/bbolt/bolt_mipsx.go | 9 - vendor/go.etcd.io/bbolt/bolt_openbsd.go | 27 - vendor/go.etcd.io/bbolt/bolt_ppc.go | 9 - vendor/go.etcd.io/bbolt/bolt_ppc64.go | 9 - vendor/go.etcd.io/bbolt/bolt_ppc64le.go | 9 - vendor/go.etcd.io/bbolt/bolt_riscv64.go | 9 - vendor/go.etcd.io/bbolt/bolt_s390x.go | 9 - vendor/go.etcd.io/bbolt/bolt_unix.go | 93 - vendor/go.etcd.io/bbolt/bolt_unix_aix.go | 90 - vendor/go.etcd.io/bbolt/bolt_unix_solaris.go | 88 - vendor/go.etcd.io/bbolt/bolt_windows.go | 141 - vendor/go.etcd.io/bbolt/boltsync_unix.go | 8 - vendor/go.etcd.io/bbolt/bucket.go | 777 - vendor/go.etcd.io/bbolt/cursor.go | 396 - vendor/go.etcd.io/bbolt/db.go | 1174 - vendor/go.etcd.io/bbolt/doc.go | 44 - vendor/go.etcd.io/bbolt/errors.go | 71 - vendor/go.etcd.io/bbolt/freelist.go | 404 - vendor/go.etcd.io/bbolt/freelist_hmap.go | 178 - vendor/go.etcd.io/bbolt/go.mod | 5 - vendor/go.etcd.io/bbolt/go.sum | 2 - vendor/go.etcd.io/bbolt/node.go | 602 - vendor/go.etcd.io/bbolt/page.go | 204 - vendor/go.etcd.io/bbolt/tx.go | 724 - vendor/go.etcd.io/bbolt/unsafe.go | 39 - vendor/go.opencensus.io/.gitignore | 9 - vendor/go.opencensus.io/.travis.yml | 17 - vendor/go.opencensus.io/AUTHORS | 1 - vendor/go.opencensus.io/CONTRIBUTING.md | 63 - vendor/go.opencensus.io/LICENSE | 202 - vendor/go.opencensus.io/Makefile | 97 - vendor/go.opencensus.io/README.md | 267 - vendor/go.opencensus.io/appveyor.yml | 24 - vendor/go.opencensus.io/go.mod | 15 - vendor/go.opencensus.io/go.sum | 74 - vendor/go.opencensus.io/internal/internal.go | 37 - vendor/go.opencensus.io/internal/sanitize.go | 50 - .../internal/tagencoding/tagencoding.go | 75 - .../internal/traceinternals.go | 53 - .../go.opencensus.io/metric/metricdata/doc.go | 19 - .../metric/metricdata/exemplar.go | 38 - .../metric/metricdata/label.go | 35 - .../metric/metricdata/metric.go | 46 - .../metric/metricdata/point.go | 193 - .../metric/metricdata/type_string.go | 16 - .../metric/metricdata/unit.go | 27 - .../metric/metricproducer/manager.go | 78 - .../metric/metricproducer/producer.go | 28 - vendor/go.opencensus.io/opencensus.go | 21 - .../go.opencensus.io/plugin/ochttp/client.go | 117 - .../plugin/ochttp/client_stats.go | 143 - vendor/go.opencensus.io/plugin/ochttp/doc.go | 19 - .../plugin/ochttp/propagation/b3/b3.go | 123 - .../go.opencensus.io/plugin/ochttp/route.go | 61 - .../go.opencensus.io/plugin/ochttp/server.go | 453 - .../ochttp/span_annotating_client_trace.go | 169 - .../go.opencensus.io/plugin/ochttp/stats.go | 292 - .../go.opencensus.io/plugin/ochttp/trace.go | 244 - .../plugin/ochttp/wrapped_body.go | 44 - vendor/go.opencensus.io/resource/resource.go | 164 - vendor/go.opencensus.io/stats/doc.go | 69 - .../go.opencensus.io/stats/internal/record.go | 25 - vendor/go.opencensus.io/stats/measure.go | 109 - .../go.opencensus.io/stats/measure_float64.go | 55 - .../go.opencensus.io/stats/measure_int64.go | 55 - vendor/go.opencensus.io/stats/record.go | 137 - vendor/go.opencensus.io/stats/units.go | 26 - .../stats/view/aggregation.go | 121 - .../stats/view/aggregation_data.go | 293 - .../go.opencensus.io/stats/view/collector.go | 86 - vendor/go.opencensus.io/stats/view/doc.go | 47 - vendor/go.opencensus.io/stats/view/export.go | 45 - vendor/go.opencensus.io/stats/view/view.go | 221 - .../stats/view/view_to_metric.go | 152 - vendor/go.opencensus.io/stats/view/worker.go | 413 - .../stats/view/worker_commands.go | 186 - vendor/go.opencensus.io/tag/context.go | 43 - vendor/go.opencensus.io/tag/doc.go | 26 - vendor/go.opencensus.io/tag/key.go | 44 - vendor/go.opencensus.io/tag/map.go | 229 - vendor/go.opencensus.io/tag/map_codec.go | 239 - vendor/go.opencensus.io/tag/metadata.go | 52 - vendor/go.opencensus.io/tag/profile_19.go | 31 - vendor/go.opencensus.io/tag/profile_not19.go | 23 - vendor/go.opencensus.io/tag/validate.go | 56 - vendor/go.opencensus.io/trace/basetypes.go | 119 - vendor/go.opencensus.io/trace/config.go | 86 - vendor/go.opencensus.io/trace/doc.go | 53 - vendor/go.opencensus.io/trace/evictedqueue.go | 38 - vendor/go.opencensus.io/trace/export.go | 97 - .../trace/internal/internal.go | 22 - vendor/go.opencensus.io/trace/lrumap.go | 61 - .../trace/propagation/propagation.go | 108 - vendor/go.opencensus.io/trace/sampling.go | 75 - vendor/go.opencensus.io/trace/spanbucket.go | 130 - vendor/go.opencensus.io/trace/spanstore.go | 306 - vendor/go.opencensus.io/trace/status_codes.go | 37 - vendor/go.opencensus.io/trace/trace.go | 598 - vendor/go.opencensus.io/trace/trace_go11.go | 32 - .../go.opencensus.io/trace/trace_nongo11.go | 25 - .../trace/tracestate/tracestate.go | 147 - vendor/go.uber.org/atomic/.codecov.yml | 15 - vendor/go.uber.org/atomic/.gitignore | 12 - vendor/go.uber.org/atomic/.travis.yml | 27 - vendor/go.uber.org/atomic/CHANGELOG.md | 64 - vendor/go.uber.org/atomic/LICENSE.txt | 19 - vendor/go.uber.org/atomic/Makefile | 35 - vendor/go.uber.org/atomic/README.md | 63 - vendor/go.uber.org/atomic/atomic.go | 356 - vendor/go.uber.org/atomic/error.go | 55 - vendor/go.uber.org/atomic/go.mod | 10 - vendor/go.uber.org/atomic/go.sum | 22 - vendor/go.uber.org/atomic/string.go | 49 - vendor/go.uber.org/multierr/.codecov.yml | 15 - vendor/go.uber.org/multierr/.gitignore | 4 - vendor/go.uber.org/multierr/.travis.yml | 29 - vendor/go.uber.org/multierr/CHANGELOG.md | 54 - vendor/go.uber.org/multierr/LICENSE.txt | 19 - vendor/go.uber.org/multierr/Makefile | 42 - vendor/go.uber.org/multierr/README.md | 23 - vendor/go.uber.org/multierr/error.go | 449 - vendor/go.uber.org/multierr/glide.yaml | 8 - vendor/go.uber.org/multierr/go.mod | 12 - vendor/go.uber.org/multierr/go.sum | 45 - vendor/go.uber.org/multierr/go113.go | 52 - vendor/go.uber.org/zap/.codecov.yml | 17 - vendor/go.uber.org/zap/.gitignore | 32 - vendor/go.uber.org/zap/.readme.tmpl | 109 - vendor/go.uber.org/zap/.travis.yml | 23 - vendor/go.uber.org/zap/CHANGELOG.md | 401 - vendor/go.uber.org/zap/CODE_OF_CONDUCT.md | 75 - vendor/go.uber.org/zap/CONTRIBUTING.md | 81 - vendor/go.uber.org/zap/FAQ.md | 155 - vendor/go.uber.org/zap/LICENSE.txt | 19 - vendor/go.uber.org/zap/Makefile | 63 - vendor/go.uber.org/zap/README.md | 134 - vendor/go.uber.org/zap/array.go | 320 - vendor/go.uber.org/zap/buffer/buffer.go | 123 - vendor/go.uber.org/zap/buffer/pool.go | 49 - vendor/go.uber.org/zap/checklicense.sh | 17 - vendor/go.uber.org/zap/config.go | 262 - vendor/go.uber.org/zap/doc.go | 113 - vendor/go.uber.org/zap/encoder.go | 79 - vendor/go.uber.org/zap/error.go | 80 - vendor/go.uber.org/zap/field.go | 533 - vendor/go.uber.org/zap/flag.go | 39 - vendor/go.uber.org/zap/glide.yaml | 34 - vendor/go.uber.org/zap/global.go | 168 - vendor/go.uber.org/zap/global_go112.go | 26 - vendor/go.uber.org/zap/global_prego112.go | 26 - vendor/go.uber.org/zap/go.mod | 12 - vendor/go.uber.org/zap/go.sum | 56 - vendor/go.uber.org/zap/http_handler.go | 81 - .../zap/internal/bufferpool/bufferpool.go | 31 - .../go.uber.org/zap/internal/color/color.go | 44 - vendor/go.uber.org/zap/internal/exit/exit.go | 64 - vendor/go.uber.org/zap/level.go | 132 - vendor/go.uber.org/zap/logger.go | 311 - vendor/go.uber.org/zap/options.go | 133 - vendor/go.uber.org/zap/sink.go | 161 - vendor/go.uber.org/zap/stacktrace.go | 126 - vendor/go.uber.org/zap/sugar.go | 304 - vendor/go.uber.org/zap/time.go | 27 - vendor/go.uber.org/zap/writer.go | 99 - .../zap/zapcore/console_encoder.go | 147 - vendor/go.uber.org/zap/zapcore/core.go | 113 - vendor/go.uber.org/zap/zapcore/doc.go | 24 - vendor/go.uber.org/zap/zapcore/encoder.go | 401 - vendor/go.uber.org/zap/zapcore/entry.go | 258 - vendor/go.uber.org/zap/zapcore/error.go | 115 - vendor/go.uber.org/zap/zapcore/field.go | 217 - vendor/go.uber.org/zap/zapcore/hook.go | 68 - .../go.uber.org/zap/zapcore/increase_level.go | 66 - .../go.uber.org/zap/zapcore/json_encoder.go | 524 - vendor/go.uber.org/zap/zapcore/level.go | 175 - .../go.uber.org/zap/zapcore/level_strings.go | 46 - vendor/go.uber.org/zap/zapcore/marshaler.go | 53 - .../go.uber.org/zap/zapcore/memory_encoder.go | 179 - vendor/go.uber.org/zap/zapcore/sampler.go | 208 - vendor/go.uber.org/zap/zapcore/tee.go | 81 - .../go.uber.org/zap/zapcore/write_syncer.go | 123 - vendor/goftp.io/server/.drone.yml | 47 - vendor/goftp.io/server/.gitignore | 4 - vendor/goftp.io/server/LICENSE | 20 - vendor/goftp.io/server/README.md | 91 - vendor/goftp.io/server/auth.go | 33 - vendor/goftp.io/server/cmd.go | 1246 - vendor/goftp.io/server/conn.go | 307 - vendor/goftp.io/server/doc.go | 14 - vendor/goftp.io/server/driver.go | 162 - vendor/goftp.io/server/driver_file.go | 223 - vendor/goftp.io/server/driver_minio.go | 327 - vendor/goftp.io/server/file_info.go | 35 - vendor/goftp.io/server/go.mod | 13 - vendor/goftp.io/server/go.sum | 55 - vendor/goftp.io/server/list_formatter.go | 49 - vendor/goftp.io/server/logger.go | 60 - vendor/goftp.io/server/notifier.go | 176 - vendor/goftp.io/server/perm.go | 61 - vendor/goftp.io/server/server.go | 285 - vendor/goftp.io/server/socket.go | 257 - vendor/golang.org/x/crypto/AUTHORS | 3 - vendor/golang.org/x/crypto/CONTRIBUTORS | 3 - vendor/golang.org/x/crypto/LICENSE | 27 - vendor/golang.org/x/crypto/PATENTS | 22 - vendor/golang.org/x/crypto/argon2/argon2.go | 285 - vendor/golang.org/x/crypto/argon2/blake2b.go | 53 - .../x/crypto/argon2/blamka_amd64.go | 60 - .../golang.org/x/crypto/argon2/blamka_amd64.s | 243 - .../x/crypto/argon2/blamka_generic.go | 163 - .../golang.org/x/crypto/argon2/blamka_ref.go | 15 - vendor/golang.org/x/crypto/bcrypt/base64.go | 35 - vendor/golang.org/x/crypto/bcrypt/bcrypt.go | 295 - vendor/golang.org/x/crypto/blake2b/blake2b.go | 291 - .../x/crypto/blake2b/blake2bAVX2_amd64.go | 37 - .../x/crypto/blake2b/blake2bAVX2_amd64.s | 750 - .../x/crypto/blake2b/blake2b_amd64.go | 24 - .../x/crypto/blake2b/blake2b_amd64.s | 281 - .../x/crypto/blake2b/blake2b_generic.go | 182 - .../x/crypto/blake2b/blake2b_ref.go | 11 - vendor/golang.org/x/crypto/blake2b/blake2x.go | 177 - .../golang.org/x/crypto/blake2b/register.go | 32 - vendor/golang.org/x/crypto/blowfish/block.go | 159 - vendor/golang.org/x/crypto/blowfish/cipher.go | 99 - vendor/golang.org/x/crypto/blowfish/const.go | 199 - .../x/crypto/chacha20/chacha_arm64.go | 16 - .../x/crypto/chacha20/chacha_arm64.s | 307 - .../x/crypto/chacha20/chacha_generic.go | 398 - .../x/crypto/chacha20/chacha_noasm.go | 13 - .../x/crypto/chacha20/chacha_ppc64le.go | 16 - .../x/crypto/chacha20/chacha_ppc64le.s | 449 - .../x/crypto/chacha20/chacha_s390x.go | 26 - .../x/crypto/chacha20/chacha_s390x.s | 224 - vendor/golang.org/x/crypto/chacha20/xor.go | 42 - .../x/crypto/curve25519/curve25519.go | 95 - .../x/crypto/curve25519/curve25519_amd64.go | 240 - .../x/crypto/curve25519/curve25519_amd64.s | 1793 - .../x/crypto/curve25519/curve25519_generic.go | 828 - .../x/crypto/curve25519/curve25519_noasm.go | 11 - vendor/golang.org/x/crypto/ed25519/ed25519.go | 222 - .../x/crypto/ed25519/ed25519_go113.go | 73 - .../ed25519/internal/edwards25519/const.go | 1422 - .../internal/edwards25519/edwards25519.go | 1793 - .../x/crypto/internal/subtle/aliasing.go | 32 - .../internal/subtle/aliasing_appengine.go | 35 - .../x/crypto/nacl/secretbox/secretbox.go | 173 - vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go | 77 - .../x/crypto/poly1305/bits_compat.go | 39 - .../x/crypto/poly1305/bits_go1.13.go | 21 - .../golang.org/x/crypto/poly1305/mac_noasm.go | 9 - .../golang.org/x/crypto/poly1305/poly1305.go | 99 - .../golang.org/x/crypto/poly1305/sum_amd64.go | 47 - .../golang.org/x/crypto/poly1305/sum_amd64.s | 108 - .../x/crypto/poly1305/sum_generic.go | 310 - .../x/crypto/poly1305/sum_ppc64le.go | 47 - .../x/crypto/poly1305/sum_ppc64le.s | 181 - .../golang.org/x/crypto/poly1305/sum_s390x.go | 75 - .../golang.org/x/crypto/poly1305/sum_s390x.s | 503 - .../x/crypto/salsa20/salsa/hsalsa20.go | 144 - .../x/crypto/salsa20/salsa/salsa208.go | 199 - .../x/crypto/salsa20/salsa/salsa20_amd64.go | 23 - .../x/crypto/salsa20/salsa/salsa20_amd64.s | 883 - .../x/crypto/salsa20/salsa/salsa20_noasm.go | 14 - .../x/crypto/salsa20/salsa/salsa20_ref.go | 231 - vendor/golang.org/x/crypto/scrypt/scrypt.go | 213 - .../golang.org/x/crypto/ssh/agent/client.go | 813 - .../golang.org/x/crypto/ssh/agent/forward.go | 103 - .../golang.org/x/crypto/ssh/agent/keyring.go | 241 - .../golang.org/x/crypto/ssh/agent/server.go | 570 - vendor/golang.org/x/crypto/ssh/buffer.go | 97 - vendor/golang.org/x/crypto/ssh/certs.go | 546 - vendor/golang.org/x/crypto/ssh/channel.go | 633 - vendor/golang.org/x/crypto/ssh/cipher.go | 781 - vendor/golang.org/x/crypto/ssh/client.go | 278 - vendor/golang.org/x/crypto/ssh/client_auth.go | 641 - vendor/golang.org/x/crypto/ssh/common.go | 404 - vendor/golang.org/x/crypto/ssh/connection.go | 143 - vendor/golang.org/x/crypto/ssh/doc.go | 21 - vendor/golang.org/x/crypto/ssh/handshake.go | 647 - .../ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go | 93 - vendor/golang.org/x/crypto/ssh/kex.go | 789 - vendor/golang.org/x/crypto/ssh/keys.go | 1474 - vendor/golang.org/x/crypto/ssh/mac.go | 61 - vendor/golang.org/x/crypto/ssh/messages.go | 866 - vendor/golang.org/x/crypto/ssh/mux.go | 351 - vendor/golang.org/x/crypto/ssh/server.go | 716 - vendor/golang.org/x/crypto/ssh/session.go | 647 - vendor/golang.org/x/crypto/ssh/ssh_gss.go | 139 - vendor/golang.org/x/crypto/ssh/streamlocal.go | 116 - vendor/golang.org/x/crypto/ssh/tcpip.go | 474 - .../x/crypto/ssh/terminal/terminal.go | 987 - .../golang.org/x/crypto/ssh/terminal/util.go | 114 - .../x/crypto/ssh/terminal/util_aix.go | 12 - .../x/crypto/ssh/terminal/util_bsd.go | 12 - .../x/crypto/ssh/terminal/util_linux.go | 10 - .../x/crypto/ssh/terminal/util_plan9.go | 58 - .../x/crypto/ssh/terminal/util_solaris.go | 124 - .../x/crypto/ssh/terminal/util_windows.go | 105 - vendor/golang.org/x/crypto/ssh/transport.go | 353 - vendor/golang.org/x/net/AUTHORS | 3 - vendor/golang.org/x/net/CONTRIBUTORS | 3 - vendor/golang.org/x/net/LICENSE | 27 - vendor/golang.org/x/net/PATENTS | 22 - vendor/golang.org/x/net/bpf/asm.go | 41 - vendor/golang.org/x/net/bpf/constants.go | 222 - vendor/golang.org/x/net/bpf/doc.go | 82 - vendor/golang.org/x/net/bpf/instructions.go | 726 - vendor/golang.org/x/net/bpf/setter.go | 10 - vendor/golang.org/x/net/bpf/vm.go | 150 - .../golang.org/x/net/bpf/vm_instructions.go | 182 - vendor/golang.org/x/net/context/context.go | 56 - .../x/net/context/ctxhttp/ctxhttp.go | 71 - vendor/golang.org/x/net/context/go17.go | 72 - vendor/golang.org/x/net/context/go19.go | 20 - vendor/golang.org/x/net/context/pre_go17.go | 300 - vendor/golang.org/x/net/context/pre_go19.go | 109 - vendor/golang.org/x/net/html/atom/atom.go | 78 - vendor/golang.org/x/net/html/atom/table.go | 783 - vendor/golang.org/x/net/html/const.go | 111 - vendor/golang.org/x/net/html/doc.go | 106 - vendor/golang.org/x/net/html/doctype.go | 156 - vendor/golang.org/x/net/html/entity.go | 2253 -- vendor/golang.org/x/net/html/escape.go | 258 - vendor/golang.org/x/net/html/foreign.go | 225 - vendor/golang.org/x/net/html/node.go | 225 - vendor/golang.org/x/net/html/parse.go | 2425 -- vendor/golang.org/x/net/html/render.go | 273 - vendor/golang.org/x/net/html/token.go | 1224 - vendor/golang.org/x/net/http/httpguts/guts.go | 50 - .../golang.org/x/net/http/httpguts/httplex.go | 346 - .../golang.org/x/net/http/httpproxy/proxy.go | 370 - vendor/golang.org/x/net/http2/.gitignore | 2 - vendor/golang.org/x/net/http2/Dockerfile | 51 - vendor/golang.org/x/net/http2/Makefile | 3 - vendor/golang.org/x/net/http2/README | 20 - vendor/golang.org/x/net/http2/ciphers.go | 641 - .../x/net/http2/client_conn_pool.go | 278 - vendor/golang.org/x/net/http2/databuffer.go | 146 - vendor/golang.org/x/net/http2/errors.go | 133 - vendor/golang.org/x/net/http2/flow.go | 52 - vendor/golang.org/x/net/http2/frame.go | 1614 - vendor/golang.org/x/net/http2/go111.go | 29 - vendor/golang.org/x/net/http2/gotrack.go | 170 - vendor/golang.org/x/net/http2/headermap.go | 88 - vendor/golang.org/x/net/http2/hpack/encode.go | 240 - vendor/golang.org/x/net/http2/hpack/hpack.go | 504 - .../golang.org/x/net/http2/hpack/huffman.go | 229 - vendor/golang.org/x/net/http2/hpack/tables.go | 479 - vendor/golang.org/x/net/http2/http2.go | 385 - vendor/golang.org/x/net/http2/not_go111.go | 20 - vendor/golang.org/x/net/http2/pipe.go | 168 - vendor/golang.org/x/net/http2/server.go | 2964 -- vendor/golang.org/x/net/http2/transport.go | 2732 -- vendor/golang.org/x/net/http2/write.go | 365 - vendor/golang.org/x/net/http2/writesched.go | 248 - .../x/net/http2/writesched_priority.go | 452 - .../x/net/http2/writesched_random.go | 77 - vendor/golang.org/x/net/idna/idna10.0.0.go | 734 - vendor/golang.org/x/net/idna/idna9.0.0.go | 682 - vendor/golang.org/x/net/idna/punycode.go | 203 - vendor/golang.org/x/net/idna/tables10.0.0.go | 4559 --- vendor/golang.org/x/net/idna/tables11.0.0.go | 4653 --- vendor/golang.org/x/net/idna/tables12.00.go | 4733 --- vendor/golang.org/x/net/idna/tables9.0.0.go | 4486 --- vendor/golang.org/x/net/idna/trie.go | 72 - vendor/golang.org/x/net/idna/trieval.go | 119 - .../golang.org/x/net/internal/iana/const.go | 223 - .../x/net/internal/socket/cmsghdr.go | 11 - .../x/net/internal/socket/cmsghdr_bsd.go | 13 - .../internal/socket/cmsghdr_linux_32bit.go | 14 - .../internal/socket/cmsghdr_linux_64bit.go | 14 - .../internal/socket/cmsghdr_solaris_64bit.go | 14 - .../x/net/internal/socket/cmsghdr_stub.go | 17 - .../golang.org/x/net/internal/socket/empty.s | 7 - .../x/net/internal/socket/error_unix.go | 31 - .../x/net/internal/socket/error_windows.go | 26 - .../x/net/internal/socket/iovec_32bit.go | 19 - .../x/net/internal/socket/iovec_64bit.go | 19 - .../internal/socket/iovec_solaris_64bit.go | 19 - .../x/net/internal/socket/iovec_stub.go | 11 - .../x/net/internal/socket/mmsghdr_stub.go | 21 - .../x/net/internal/socket/mmsghdr_unix.go | 42 - .../x/net/internal/socket/msghdr_bsd.go | 39 - .../x/net/internal/socket/msghdr_bsdvar.go | 16 - .../x/net/internal/socket/msghdr_linux.go | 36 - .../net/internal/socket/msghdr_linux_32bit.go | 24 - .../net/internal/socket/msghdr_linux_64bit.go | 24 - .../x/net/internal/socket/msghdr_openbsd.go | 14 - .../internal/socket/msghdr_solaris_64bit.go | 36 - .../x/net/internal/socket/msghdr_stub.go | 14 - .../x/net/internal/socket/norace.go | 12 - .../golang.org/x/net/internal/socket/race.go | 37 - .../x/net/internal/socket/rawconn.go | 64 - .../x/net/internal/socket/rawconn_mmsg.go | 79 - .../x/net/internal/socket/rawconn_msg.go | 78 - .../x/net/internal/socket/rawconn_nommsg.go | 15 - .../x/net/internal/socket/rawconn_nomsg.go | 15 - .../x/net/internal/socket/socket.go | 288 - .../golang.org/x/net/internal/socket/sys.go | 33 - .../x/net/internal/socket/sys_bsd.go | 15 - .../x/net/internal/socket/sys_bsdvar.go | 23 - .../x/net/internal/socket/sys_const_unix.go | 17 - .../x/net/internal/socket/sys_darwin.go | 7 - .../x/net/internal/socket/sys_dragonfly.go | 32 - .../net/internal/socket/sys_go1_11_darwin.go | 33 - .../x/net/internal/socket/sys_linkname.go | 42 - .../x/net/internal/socket/sys_linux.go | 27 - .../x/net/internal/socket/sys_linux_386.go | 55 - .../x/net/internal/socket/sys_linux_386.s | 11 - .../x/net/internal/socket/sys_linux_amd64.go | 10 - .../x/net/internal/socket/sys_linux_arm.go | 10 - .../x/net/internal/socket/sys_linux_arm64.go | 10 - .../x/net/internal/socket/sys_linux_mips.go | 10 - .../x/net/internal/socket/sys_linux_mips64.go | 10 - .../net/internal/socket/sys_linux_mips64le.go | 10 - .../x/net/internal/socket/sys_linux_mipsle.go | 10 - .../x/net/internal/socket/sys_linux_ppc64.go | 10 - .../net/internal/socket/sys_linux_ppc64le.go | 10 - .../net/internal/socket/sys_linux_riscv64.go | 12 - .../x/net/internal/socket/sys_linux_s390x.go | 55 - .../x/net/internal/socket/sys_linux_s390x.s | 11 - .../x/net/internal/socket/sys_netbsd.go | 25 - .../x/net/internal/socket/sys_posix.go | 183 - .../x/net/internal/socket/sys_solaris.go | 70 - .../x/net/internal/socket/sys_solaris_amd64.s | 11 - .../x/net/internal/socket/sys_stub.go | 63 - .../x/net/internal/socket/sys_unix.go | 33 - .../x/net/internal/socket/sys_windows.go | 71 - .../x/net/internal/socket/zsys_aix_ppc64.go | 60 - .../x/net/internal/socket/zsys_darwin_386.go | 51 - .../net/internal/socket/zsys_darwin_amd64.go | 53 - .../x/net/internal/socket/zsys_darwin_arm.go | 51 - .../net/internal/socket/zsys_darwin_arm64.go | 53 - .../internal/socket/zsys_dragonfly_amd64.go | 53 - .../x/net/internal/socket/zsys_freebsd_386.go | 51 - .../net/internal/socket/zsys_freebsd_amd64.go | 53 - .../x/net/internal/socket/zsys_freebsd_arm.go | 51 - .../net/internal/socket/zsys_freebsd_arm64.go | 53 - .../x/net/internal/socket/zsys_linux_386.go | 54 - .../x/net/internal/socket/zsys_linux_amd64.go | 57 - .../x/net/internal/socket/zsys_linux_arm.go | 55 - .../x/net/internal/socket/zsys_linux_arm64.go | 58 - .../x/net/internal/socket/zsys_linux_mips.go | 55 - .../net/internal/socket/zsys_linux_mips64.go | 58 - .../internal/socket/zsys_linux_mips64le.go | 58 - .../net/internal/socket/zsys_linux_mipsle.go | 55 - .../x/net/internal/socket/zsys_linux_ppc64.go | 58 - .../net/internal/socket/zsys_linux_ppc64le.go | 58 - .../net/internal/socket/zsys_linux_riscv64.go | 59 - .../x/net/internal/socket/zsys_linux_s390x.go | 58 - .../x/net/internal/socket/zsys_netbsd_386.go | 57 - .../net/internal/socket/zsys_netbsd_amd64.go | 60 - .../x/net/internal/socket/zsys_netbsd_arm.go | 57 - .../net/internal/socket/zsys_netbsd_arm64.go | 59 - .../x/net/internal/socket/zsys_openbsd_386.go | 51 - .../net/internal/socket/zsys_openbsd_amd64.go | 53 - .../x/net/internal/socket/zsys_openbsd_arm.go | 51 - .../net/internal/socket/zsys_openbsd_arm64.go | 53 - .../net/internal/socket/zsys_solaris_amd64.go | 52 - .../x/net/internal/timeseries/timeseries.go | 525 - vendor/golang.org/x/net/ipv4/batch.go | 194 - vendor/golang.org/x/net/ipv4/control.go | 144 - vendor/golang.org/x/net/ipv4/control_bsd.go | 41 - .../golang.org/x/net/ipv4/control_pktinfo.go | 39 - vendor/golang.org/x/net/ipv4/control_stub.go | 13 - vendor/golang.org/x/net/ipv4/control_unix.go | 73 - .../golang.org/x/net/ipv4/control_windows.go | 12 - vendor/golang.org/x/net/ipv4/dgramopt.go | 264 - vendor/golang.org/x/net/ipv4/doc.go | 244 - vendor/golang.org/x/net/ipv4/endpoint.go | 186 - vendor/golang.org/x/net/ipv4/genericopt.go | 55 - vendor/golang.org/x/net/ipv4/header.go | 172 - vendor/golang.org/x/net/ipv4/helper.go | 77 - vendor/golang.org/x/net/ipv4/iana.go | 38 - vendor/golang.org/x/net/ipv4/icmp.go | 57 - vendor/golang.org/x/net/ipv4/icmp_linux.go | 25 - vendor/golang.org/x/net/ipv4/icmp_stub.go | 25 - vendor/golang.org/x/net/ipv4/packet.go | 117 - vendor/golang.org/x/net/ipv4/payload.go | 23 - vendor/golang.org/x/net/ipv4/payload_cmsg.go | 84 - .../golang.org/x/net/ipv4/payload_nocmsg.go | 39 - vendor/golang.org/x/net/ipv4/sockopt.go | 44 - vendor/golang.org/x/net/ipv4/sockopt_posix.go | 71 - vendor/golang.org/x/net/ipv4/sockopt_stub.go | 42 - vendor/golang.org/x/net/ipv4/sys_aix.go | 38 - vendor/golang.org/x/net/ipv4/sys_asmreq.go | 122 - .../golang.org/x/net/ipv4/sys_asmreq_stub.go | 25 - vendor/golang.org/x/net/ipv4/sys_asmreqn.go | 42 - .../golang.org/x/net/ipv4/sys_asmreqn_stub.go | 21 - vendor/golang.org/x/net/ipv4/sys_bpf.go | 24 - vendor/golang.org/x/net/ipv4/sys_bpf_stub.go | 16 - vendor/golang.org/x/net/ipv4/sys_bsd.go | 37 - vendor/golang.org/x/net/ipv4/sys_darwin.go | 65 - vendor/golang.org/x/net/ipv4/sys_dragonfly.go | 35 - vendor/golang.org/x/net/ipv4/sys_freebsd.go | 76 - vendor/golang.org/x/net/ipv4/sys_linux.go | 60 - vendor/golang.org/x/net/ipv4/sys_solaris.go | 57 - vendor/golang.org/x/net/ipv4/sys_ssmreq.go | 52 - .../golang.org/x/net/ipv4/sys_ssmreq_stub.go | 21 - vendor/golang.org/x/net/ipv4/sys_stub.go | 13 - vendor/golang.org/x/net/ipv4/sys_windows.go | 67 - .../golang.org/x/net/ipv4/zsys_aix_ppc64.go | 33 - vendor/golang.org/x/net/ipv4/zsys_darwin.go | 99 - .../golang.org/x/net/ipv4/zsys_dragonfly.go | 31 - .../golang.org/x/net/ipv4/zsys_freebsd_386.go | 93 - .../x/net/ipv4/zsys_freebsd_amd64.go | 95 - .../golang.org/x/net/ipv4/zsys_freebsd_arm.go | 95 - .../x/net/ipv4/zsys_freebsd_arm64.go | 93 - .../golang.org/x/net/ipv4/zsys_linux_386.go | 130 - .../golang.org/x/net/ipv4/zsys_linux_amd64.go | 132 - .../golang.org/x/net/ipv4/zsys_linux_arm.go | 130 - .../golang.org/x/net/ipv4/zsys_linux_arm64.go | 132 - .../golang.org/x/net/ipv4/zsys_linux_mips.go | 130 - .../x/net/ipv4/zsys_linux_mips64.go | 132 - .../x/net/ipv4/zsys_linux_mips64le.go | 132 - .../x/net/ipv4/zsys_linux_mipsle.go | 130 - .../golang.org/x/net/ipv4/zsys_linux_ppc.go | 130 - .../golang.org/x/net/ipv4/zsys_linux_ppc64.go | 132 - .../x/net/ipv4/zsys_linux_ppc64le.go | 132 - .../x/net/ipv4/zsys_linux_riscv64.go | 134 - .../golang.org/x/net/ipv4/zsys_linux_s390x.go | 132 - vendor/golang.org/x/net/ipv4/zsys_netbsd.go | 30 - vendor/golang.org/x/net/ipv4/zsys_openbsd.go | 30 - vendor/golang.org/x/net/ipv4/zsys_solaris.go | 100 - vendor/golang.org/x/net/publicsuffix/list.go | 181 - vendor/golang.org/x/net/publicsuffix/table.go | 10150 ----- vendor/golang.org/x/net/trace/events.go | 532 - vendor/golang.org/x/net/trace/histogram.go | 365 - vendor/golang.org/x/net/trace/trace.go | 1130 - vendor/golang.org/x/net/webdav/file.go | 795 - vendor/golang.org/x/net/webdav/if.go | 173 - .../x/net/webdav/internal/xml/README | 11 - .../x/net/webdav/internal/xml/marshal.go | 1223 - .../x/net/webdav/internal/xml/read.go | 692 - .../x/net/webdav/internal/xml/typeinfo.go | 371 - .../x/net/webdav/internal/xml/xml.go | 1998 - vendor/golang.org/x/net/webdav/lock.go | 445 - vendor/golang.org/x/net/webdav/prop.go | 469 - vendor/golang.org/x/net/webdav/webdav.go | 706 - vendor/golang.org/x/net/webdav/xml.go | 519 - vendor/golang.org/x/net/websocket/client.go | 106 - vendor/golang.org/x/net/websocket/dial.go | 24 - vendor/golang.org/x/net/websocket/hybi.go | 583 - vendor/golang.org/x/net/websocket/server.go | 113 - .../golang.org/x/net/websocket/websocket.go | 451 - vendor/golang.org/x/oauth2/.travis.yml | 13 - vendor/golang.org/x/oauth2/AUTHORS | 3 - vendor/golang.org/x/oauth2/CONTRIBUTING.md | 26 - vendor/golang.org/x/oauth2/CONTRIBUTORS | 3 - vendor/golang.org/x/oauth2/LICENSE | 27 - vendor/golang.org/x/oauth2/README.md | 36 - vendor/golang.org/x/oauth2/go.mod | 10 - vendor/golang.org/x/oauth2/go.sum | 12 - .../golang.org/x/oauth2/google/appengine.go | 38 - .../x/oauth2/google/appengine_gen1.go | 77 - .../x/oauth2/google/appengine_gen2_flex.go | 27 - vendor/golang.org/x/oauth2/google/default.go | 154 - vendor/golang.org/x/oauth2/google/doc.go | 40 - vendor/golang.org/x/oauth2/google/google.go | 209 - vendor/golang.org/x/oauth2/google/jwt.go | 74 - vendor/golang.org/x/oauth2/google/sdk.go | 201 - .../x/oauth2/internal/client_appengine.go | 13 - vendor/golang.org/x/oauth2/internal/doc.go | 6 - vendor/golang.org/x/oauth2/internal/oauth2.go | 37 - vendor/golang.org/x/oauth2/internal/token.go | 294 - .../golang.org/x/oauth2/internal/transport.go | 33 - vendor/golang.org/x/oauth2/jws/jws.go | 182 - vendor/golang.org/x/oauth2/jwt/jwt.go | 185 - vendor/golang.org/x/oauth2/oauth2.go | 381 - vendor/golang.org/x/oauth2/token.go | 178 - vendor/golang.org/x/oauth2/transport.go | 89 - vendor/golang.org/x/sync/AUTHORS | 3 - vendor/golang.org/x/sync/CONTRIBUTORS | 3 - vendor/golang.org/x/sync/LICENSE | 27 - vendor/golang.org/x/sync/PATENTS | 22 - vendor/golang.org/x/sync/errgroup/errgroup.go | 66 - .../golang.org/x/sync/semaphore/semaphore.go | 136 - vendor/golang.org/x/sys/AUTHORS | 3 - vendor/golang.org/x/sys/CONTRIBUTORS | 3 - vendor/golang.org/x/sys/LICENSE | 27 - vendor/golang.org/x/sys/PATENTS | 22 - vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 17 - vendor/golang.org/x/sys/cpu/byteorder.go | 65 - vendor/golang.org/x/sys/cpu/cpu.go | 171 - vendor/golang.org/x/sys/cpu/cpu_aix.go | 34 - vendor/golang.org/x/sys/cpu/cpu_arm.go | 40 - vendor/golang.org/x/sys/cpu/cpu_arm64.go | 144 - vendor/golang.org/x/sys/cpu/cpu_arm64.s | 31 - vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 11 - vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 - vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 - .../golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 11 - .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 43 - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 26 - vendor/golang.org/x/sys/cpu/cpu_linux.go | 15 - vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 - .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 71 - .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 22 - .../golang.org/x/sys/cpu/cpu_linux_noinit.go | 9 - .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 33 - .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 161 - vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 9 - vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 9 - .../golang.org/x/sys/cpu/cpu_other_arm64.go | 9 - vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 9 - vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 - vendor/golang.org/x/sys/cpu/cpu_wasm.go | 13 - vendor/golang.org/x/sys/cpu/cpu_x86.go | 59 - vendor/golang.org/x/sys/cpu/cpu_x86.s | 27 - vendor/golang.org/x/sys/cpu/hwcap_linux.go | 56 - .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 - .../x/sys/cpu/syscall_aix_ppc64_gc.go | 36 - .../sys/internal/unsafeheader/unsafeheader.go | 30 - vendor/golang.org/x/sys/unix/.gitignore | 2 - vendor/golang.org/x/sys/unix/README.md | 184 - .../golang.org/x/sys/unix/affinity_linux.go | 86 - vendor/golang.org/x/sys/unix/aliases.go | 14 - vendor/golang.org/x/sys/unix/asm_aix_ppc64.s | 17 - vendor/golang.org/x/sys/unix/asm_darwin_386.s | 29 - .../golang.org/x/sys/unix/asm_darwin_amd64.s | 29 - vendor/golang.org/x/sys/unix/asm_darwin_arm.s | 30 - .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 - .../x/sys/unix/asm_dragonfly_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_386.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm64.s | 29 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 65 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 57 - vendor/golang.org/x/sys/unix/asm_linux_arm.s | 56 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 52 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 56 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 54 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 44 - .../golang.org/x/sys/unix/asm_linux_riscv64.s | 47 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 56 - vendor/golang.org/x/sys/unix/asm_netbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_amd64.s | 29 - vendor/golang.org/x/sys/unix/asm_netbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_arm64.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_arm64.s | 29 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 17 - .../golang.org/x/sys/unix/bluetooth_linux.go | 36 - vendor/golang.org/x/sys/unix/cap_freebsd.go | 195 - vendor/golang.org/x/sys/unix/constants.go | 13 - vendor/golang.org/x/sys/unix/dev_aix_ppc.go | 27 - vendor/golang.org/x/sys/unix/dev_aix_ppc64.go | 29 - vendor/golang.org/x/sys/unix/dev_darwin.go | 24 - vendor/golang.org/x/sys/unix/dev_dragonfly.go | 30 - vendor/golang.org/x/sys/unix/dev_freebsd.go | 30 - vendor/golang.org/x/sys/unix/dev_linux.go | 42 - vendor/golang.org/x/sys/unix/dev_netbsd.go | 29 - vendor/golang.org/x/sys/unix/dev_openbsd.go | 29 - vendor/golang.org/x/sys/unix/dirent.go | 102 - vendor/golang.org/x/sys/unix/endian_big.go | 9 - vendor/golang.org/x/sys/unix/endian_little.go | 9 - vendor/golang.org/x/sys/unix/env_unix.go | 31 - .../x/sys/unix/errors_freebsd_386.go | 233 - .../x/sys/unix/errors_freebsd_amd64.go | 233 - .../x/sys/unix/errors_freebsd_arm.go | 226 - .../x/sys/unix/errors_freebsd_arm64.go | 17 - vendor/golang.org/x/sys/unix/fcntl.go | 36 - vendor/golang.org/x/sys/unix/fcntl_darwin.go | 18 - .../x/sys/unix/fcntl_linux_32bit.go | 13 - vendor/golang.org/x/sys/unix/fdset.go | 29 - vendor/golang.org/x/sys/unix/gccgo.go | 62 - vendor/golang.org/x/sys/unix/gccgo_c.c | 39 - .../x/sys/unix/gccgo_linux_amd64.go | 20 - vendor/golang.org/x/sys/unix/ioctl.go | 65 - vendor/golang.org/x/sys/unix/mkall.sh | 240 - vendor/golang.org/x/sys/unix/mkerrors.sh | 703 - vendor/golang.org/x/sys/unix/pagesize_unix.go | 15 - .../golang.org/x/sys/unix/pledge_openbsd.go | 163 - vendor/golang.org/x/sys/unix/race.go | 30 - vendor/golang.org/x/sys/unix/race0.go | 25 - .../x/sys/unix/readdirent_getdents.go | 12 - .../x/sys/unix/readdirent_getdirentries.go | 19 - .../x/sys/unix/sockcmsg_dragonfly.go | 16 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 36 - vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 92 - .../x/sys/unix/sockcmsg_unix_other.go | 38 - vendor/golang.org/x/sys/unix/str.go | 26 - vendor/golang.org/x/sys/unix/syscall.go | 53 - vendor/golang.org/x/sys/unix/syscall_aix.go | 536 - .../golang.org/x/sys/unix/syscall_aix_ppc.go | 54 - .../x/sys/unix/syscall_aix_ppc64.go | 85 - vendor/golang.org/x/sys/unix/syscall_bsd.go | 631 - .../x/sys/unix/syscall_darwin.1_12.go | 29 - .../x/sys/unix/syscall_darwin.1_13.go | 108 - .../golang.org/x/sys/unix/syscall_darwin.go | 668 - .../x/sys/unix/syscall_darwin_386.1_11.go | 9 - .../x/sys/unix/syscall_darwin_386.go | 57 - .../x/sys/unix/syscall_darwin_amd64.1_11.go | 9 - .../x/sys/unix/syscall_darwin_amd64.go | 57 - .../x/sys/unix/syscall_darwin_arm.1_11.go | 11 - .../x/sys/unix/syscall_darwin_arm.go | 57 - .../x/sys/unix/syscall_darwin_arm64.1_11.go | 11 - .../x/sys/unix/syscall_darwin_arm64.go | 59 - .../x/sys/unix/syscall_darwin_libSystem.go | 33 - .../x/sys/unix/syscall_dragonfly.go | 539 - .../x/sys/unix/syscall_dragonfly_amd64.go | 56 - .../golang.org/x/sys/unix/syscall_freebsd.go | 874 - .../x/sys/unix/syscall_freebsd_386.go | 66 - .../x/sys/unix/syscall_freebsd_amd64.go | 66 - .../x/sys/unix/syscall_freebsd_arm.go | 62 - .../x/sys/unix/syscall_freebsd_arm64.go | 62 - .../golang.org/x/sys/unix/syscall_illumos.go | 57 - vendor/golang.org/x/sys/unix/syscall_linux.go | 2228 -- .../x/sys/unix/syscall_linux_386.go | 390 - .../x/sys/unix/syscall_linux_amd64.go | 194 - .../x/sys/unix/syscall_linux_amd64_gc.go | 13 - .../x/sys/unix/syscall_linux_arm.go | 291 - .../x/sys/unix/syscall_linux_arm64.go | 245 - .../golang.org/x/sys/unix/syscall_linux_gc.go | 14 - .../x/sys/unix/syscall_linux_gc_386.go | 16 - .../x/sys/unix/syscall_linux_gccgo_386.go | 30 - .../x/sys/unix/syscall_linux_gccgo_arm.go | 20 - .../x/sys/unix/syscall_linux_mips64x.go | 230 - .../x/sys/unix/syscall_linux_mipsx.go | 238 - .../x/sys/unix/syscall_linux_ppc64x.go | 156 - .../x/sys/unix/syscall_linux_riscv64.go | 230 - .../x/sys/unix/syscall_linux_s390x.go | 342 - .../x/sys/unix/syscall_linux_sparc64.go | 151 - .../golang.org/x/sys/unix/syscall_netbsd.go | 614 - .../x/sys/unix/syscall_netbsd_386.go | 37 - .../x/sys/unix/syscall_netbsd_amd64.go | 37 - .../x/sys/unix/syscall_netbsd_arm.go | 37 - .../x/sys/unix/syscall_netbsd_arm64.go | 37 - .../golang.org/x/sys/unix/syscall_openbsd.go | 401 - .../x/sys/unix/syscall_openbsd_386.go | 41 - .../x/sys/unix/syscall_openbsd_amd64.go | 41 - .../x/sys/unix/syscall_openbsd_arm.go | 41 - .../x/sys/unix/syscall_openbsd_arm64.go | 41 - .../golang.org/x/sys/unix/syscall_solaris.go | 724 - .../x/sys/unix/syscall_solaris_amd64.go | 27 - vendor/golang.org/x/sys/unix/syscall_unix.go | 430 - .../golang.org/x/sys/unix/syscall_unix_gc.go | 15 - .../x/sys/unix/syscall_unix_gc_ppc64x.go | 24 - vendor/golang.org/x/sys/unix/timestruct.go | 82 - .../golang.org/x/sys/unix/unveil_openbsd.go | 42 - vendor/golang.org/x/sys/unix/xattr_bsd.go | 240 - .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1384 - .../x/sys/unix/zerrors_aix_ppc64.go | 1385 - .../x/sys/unix/zerrors_darwin_386.go | 1784 - .../x/sys/unix/zerrors_darwin_amd64.go | 1784 - .../x/sys/unix/zerrors_darwin_arm.go | 1784 - .../x/sys/unix/zerrors_darwin_arm64.go | 1784 - .../x/sys/unix/zerrors_dragonfly_amd64.go | 1651 - .../x/sys/unix/zerrors_freebsd_386.go | 1930 - .../x/sys/unix/zerrors_freebsd_amd64.go | 1929 - .../x/sys/unix/zerrors_freebsd_arm.go | 1819 - .../x/sys/unix/zerrors_freebsd_arm64.go | 1930 - vendor/golang.org/x/sys/unix/zerrors_linux.go | 2417 -- .../x/sys/unix/zerrors_linux_386.go | 788 - .../x/sys/unix/zerrors_linux_amd64.go | 788 - .../x/sys/unix/zerrors_linux_arm.go | 794 - .../x/sys/unix/zerrors_linux_arm64.go | 781 - .../x/sys/unix/zerrors_linux_mips.go | 795 - .../x/sys/unix/zerrors_linux_mips64.go | 795 - .../x/sys/unix/zerrors_linux_mips64le.go | 795 - .../x/sys/unix/zerrors_linux_mipsle.go | 795 - .../x/sys/unix/zerrors_linux_ppc64.go | 851 - .../x/sys/unix/zerrors_linux_ppc64le.go | 851 - .../x/sys/unix/zerrors_linux_riscv64.go | 775 - .../x/sys/unix/zerrors_linux_s390x.go | 848 - .../x/sys/unix/zerrors_linux_sparc64.go | 845 - .../x/sys/unix/zerrors_netbsd_386.go | 1773 - .../x/sys/unix/zerrors_netbsd_amd64.go | 1763 - .../x/sys/unix/zerrors_netbsd_arm.go | 1752 - .../x/sys/unix/zerrors_netbsd_arm64.go | 1763 - .../x/sys/unix/zerrors_openbsd_386.go | 1657 - .../x/sys/unix/zerrors_openbsd_amd64.go | 1767 - .../x/sys/unix/zerrors_openbsd_arm.go | 1659 - .../x/sys/unix/zerrors_openbsd_arm64.go | 1790 - .../x/sys/unix/zerrors_solaris_amd64.go | 1533 - .../x/sys/unix/zptrace_armnn_linux.go | 41 - .../x/sys/unix/zptrace_linux_arm64.go | 17 - .../x/sys/unix/zptrace_mipsnn_linux.go | 50 - .../x/sys/unix/zptrace_mipsnnle_linux.go | 50 - .../x/sys/unix/zptrace_x86_linux.go | 80 - .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 1484 - .../x/sys/unix/zsyscall_aix_ppc64.go | 1442 - .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 1192 - .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 1070 - .../x/sys/unix/zsyscall_darwin_386.1_11.go | 1809 - .../x/sys/unix/zsyscall_darwin_386.1_13.go | 41 - .../x/sys/unix/zsyscall_darwin_386.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_386.go | 2497 -- .../x/sys/unix/zsyscall_darwin_386.s | 284 - .../x/sys/unix/zsyscall_darwin_amd64.1_11.go | 1809 - .../x/sys/unix/zsyscall_darwin_amd64.1_13.go | 41 - .../x/sys/unix/zsyscall_darwin_amd64.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_amd64.go | 2497 -- .../x/sys/unix/zsyscall_darwin_amd64.s | 284 - .../x/sys/unix/zsyscall_darwin_arm.1_11.go | 1782 - .../x/sys/unix/zsyscall_darwin_arm.1_13.go | 41 - .../x/sys/unix/zsyscall_darwin_arm.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_arm.go | 2482 -- .../x/sys/unix/zsyscall_darwin_arm.s | 282 - .../x/sys/unix/zsyscall_darwin_arm64.1_11.go | 1782 - .../x/sys/unix/zsyscall_darwin_arm64.1_13.go | 41 - .../x/sys/unix/zsyscall_darwin_arm64.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_arm64.go | 2482 -- .../x/sys/unix/zsyscall_darwin_arm64.s | 282 - .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1666 - .../x/sys/unix/zsyscall_freebsd_386.go | 2015 - .../x/sys/unix/zsyscall_freebsd_amd64.go | 2015 - .../x/sys/unix/zsyscall_freebsd_arm.go | 2015 - .../x/sys/unix/zsyscall_freebsd_arm64.go | 2015 - .../x/sys/unix/zsyscall_illumos_amd64.go | 87 - .../golang.org/x/sys/unix/zsyscall_linux.go | 1856 - .../x/sys/unix/zsyscall_linux_386.go | 578 - .../x/sys/unix/zsyscall_linux_amd64.go | 745 - .../x/sys/unix/zsyscall_linux_arm.go | 715 - .../x/sys/unix/zsyscall_linux_arm64.go | 602 - .../x/sys/unix/zsyscall_linux_mips.go | 758 - .../x/sys/unix/zsyscall_linux_mips64.go | 729 - .../x/sys/unix/zsyscall_linux_mips64le.go | 729 - .../x/sys/unix/zsyscall_linux_mipsle.go | 758 - .../x/sys/unix/zsyscall_linux_ppc64.go | 807 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 807 - .../x/sys/unix/zsyscall_linux_riscv64.go | 582 - .../x/sys/unix/zsyscall_linux_s390x.go | 577 - .../x/sys/unix/zsyscall_linux_sparc64.go | 740 - .../x/sys/unix/zsyscall_netbsd_386.go | 1851 - .../x/sys/unix/zsyscall_netbsd_amd64.go | 1851 - .../x/sys/unix/zsyscall_netbsd_arm.go | 1851 - .../x/sys/unix/zsyscall_netbsd_arm64.go | 1851 - .../x/sys/unix/zsyscall_openbsd_386.go | 1692 - .../x/sys/unix/zsyscall_openbsd_amd64.go | 1692 - .../x/sys/unix/zsyscall_openbsd_arm.go | 1692 - .../x/sys/unix/zsyscall_openbsd_arm64.go | 1692 - .../x/sys/unix/zsyscall_solaris_amd64.go | 1954 - .../x/sys/unix/zsysctl_openbsd_386.go | 273 - .../x/sys/unix/zsysctl_openbsd_amd64.go | 271 - .../x/sys/unix/zsysctl_openbsd_arm.go | 273 - .../x/sys/unix/zsysctl_openbsd_arm64.go | 275 - .../x/sys/unix/zsysnum_darwin_386.go | 436 - .../x/sys/unix/zsysnum_darwin_amd64.go | 438 - .../x/sys/unix/zsysnum_darwin_arm.go | 436 - .../x/sys/unix/zsysnum_darwin_arm64.go | 436 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 315 - .../x/sys/unix/zsysnum_freebsd_386.go | 396 - .../x/sys/unix/zsysnum_freebsd_amd64.go | 396 - .../x/sys/unix/zsysnum_freebsd_arm.go | 396 - .../x/sys/unix/zsysnum_freebsd_arm64.go | 396 - .../x/sys/unix/zsysnum_linux_386.go | 436 - .../x/sys/unix/zsysnum_linux_amd64.go | 358 - .../x/sys/unix/zsysnum_linux_arm.go | 400 - .../x/sys/unix/zsysnum_linux_arm64.go | 303 - .../x/sys/unix/zsysnum_linux_mips.go | 421 - .../x/sys/unix/zsysnum_linux_mips64.go | 351 - .../x/sys/unix/zsysnum_linux_mips64le.go | 351 - .../x/sys/unix/zsysnum_linux_mipsle.go | 421 - .../x/sys/unix/zsysnum_linux_ppc64.go | 400 - .../x/sys/unix/zsysnum_linux_ppc64le.go | 400 - .../x/sys/unix/zsysnum_linux_riscv64.go | 302 - .../x/sys/unix/zsysnum_linux_s390x.go | 365 - .../x/sys/unix/zsysnum_linux_sparc64.go | 379 - .../x/sys/unix/zsysnum_netbsd_386.go | 274 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 274 - .../x/sys/unix/zsysnum_netbsd_arm.go | 274 - .../x/sys/unix/zsysnum_netbsd_arm64.go | 274 - .../x/sys/unix/zsysnum_openbsd_386.go | 218 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 218 - .../x/sys/unix/zsysnum_openbsd_arm.go | 218 - .../x/sys/unix/zsysnum_openbsd_arm64.go | 217 - .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 352 - .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 356 - .../x/sys/unix/ztypes_darwin_386.go | 499 - .../x/sys/unix/ztypes_darwin_amd64.go | 509 - .../x/sys/unix/ztypes_darwin_arm.go | 500 - .../x/sys/unix/ztypes_darwin_arm64.go | 509 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 479 - .../x/sys/unix/ztypes_freebsd_386.go | 709 - .../x/sys/unix/ztypes_freebsd_amd64.go | 712 - .../x/sys/unix/ztypes_freebsd_arm.go | 693 - .../x/sys/unix/ztypes_freebsd_arm64.go | 690 - vendor/golang.org/x/sys/unix/ztypes_linux.go | 2419 -- .../golang.org/x/sys/unix/ztypes_linux_386.go | 599 - .../x/sys/unix/ztypes_linux_amd64.go | 614 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 591 - .../x/sys/unix/ztypes_linux_arm64.go | 593 - .../x/sys/unix/ztypes_linux_mips.go | 597 - .../x/sys/unix/ztypes_linux_mips64.go | 596 - .../x/sys/unix/ztypes_linux_mips64le.go | 596 - .../x/sys/unix/ztypes_linux_mipsle.go | 597 - .../x/sys/unix/ztypes_linux_ppc64.go | 603 - .../x/sys/unix/ztypes_linux_ppc64le.go | 603 - .../x/sys/unix/ztypes_linux_riscv64.go | 621 - .../x/sys/unix/ztypes_linux_s390x.go | 617 - .../x/sys/unix/ztypes_linux_sparc64.go | 598 - .../x/sys/unix/ztypes_netbsd_386.go | 498 - .../x/sys/unix/ztypes_netbsd_amd64.go | 506 - .../x/sys/unix/ztypes_netbsd_arm.go | 503 - .../x/sys/unix/ztypes_netbsd_arm64.go | 506 - .../x/sys/unix/ztypes_openbsd_386.go | 571 - .../x/sys/unix/ztypes_openbsd_amd64.go | 571 - .../x/sys/unix/ztypes_openbsd_arm.go | 572 - .../x/sys/unix/ztypes_openbsd_arm64.go | 565 - .../x/sys/unix/ztypes_solaris_amd64.go | 449 - vendor/golang.org/x/sys/windows/aliases.go | 13 - .../golang.org/x/sys/windows/dll_windows.go | 415 - vendor/golang.org/x/sys/windows/empty.s | 8 - .../golang.org/x/sys/windows/env_windows.go | 54 - vendor/golang.org/x/sys/windows/eventlog.go | 20 - .../golang.org/x/sys/windows/exec_windows.go | 97 - .../x/sys/windows/memory_windows.go | 31 - vendor/golang.org/x/sys/windows/mkerrors.bash | 63 - .../x/sys/windows/mkknownfolderids.bash | 27 - vendor/golang.org/x/sys/windows/mksyscall.go | 9 - vendor/golang.org/x/sys/windows/race.go | 30 - vendor/golang.org/x/sys/windows/race0.go | 25 - .../golang.org/x/sys/windows/registry/key.go | 198 - .../x/sys/windows/registry/mksyscall.go | 9 - .../x/sys/windows/registry/syscall.go | 32 - .../x/sys/windows/registry/value.go | 386 - .../sys/windows/registry/zsyscall_windows.go | 120 - .../x/sys/windows/security_windows.go | 1406 - vendor/golang.org/x/sys/windows/service.go | 229 - vendor/golang.org/x/sys/windows/str.go | 22 - vendor/golang.org/x/sys/windows/syscall.go | 74 - .../x/sys/windows/syscall_windows.go | 1489 - .../golang.org/x/sys/windows/types_windows.go | 1786 - .../x/sys/windows/types_windows_386.go | 22 - .../x/sys/windows/types_windows_amd64.go | 22 - .../x/sys/windows/types_windows_arm.go | 22 - .../x/sys/windows/zerrors_windows.go | 6853 ---- .../x/sys/windows/zknownfolderids_windows.go | 149 - .../x/sys/windows/zsyscall_windows.go | 4070 -- vendor/golang.org/x/text/AUTHORS | 3 - vendor/golang.org/x/text/CONTRIBUTORS | 3 - vendor/golang.org/x/text/LICENSE | 27 - vendor/golang.org/x/text/PATENTS | 22 - .../x/text/secure/bidirule/bidirule.go | 336 - .../x/text/secure/bidirule/bidirule10.0.0.go | 11 - .../x/text/secure/bidirule/bidirule9.0.0.go | 14 - .../golang.org/x/text/transform/transform.go | 709 - vendor/golang.org/x/text/unicode/bidi/bidi.go | 198 - .../golang.org/x/text/unicode/bidi/bracket.go | 335 - vendor/golang.org/x/text/unicode/bidi/core.go | 1058 - vendor/golang.org/x/text/unicode/bidi/prop.go | 206 - .../x/text/unicode/bidi/tables10.0.0.go | 1815 - .../x/text/unicode/bidi/tables11.0.0.go | 1887 - .../x/text/unicode/bidi/tables12.0.0.go | 1923 - .../x/text/unicode/bidi/tables9.0.0.go | 1781 - .../golang.org/x/text/unicode/bidi/trieval.go | 60 - .../x/text/unicode/norm/composition.go | 512 - .../x/text/unicode/norm/forminfo.go | 278 - .../golang.org/x/text/unicode/norm/input.go | 109 - vendor/golang.org/x/text/unicode/norm/iter.go | 458 - .../x/text/unicode/norm/normalize.go | 609 - .../x/text/unicode/norm/readwriter.go | 125 - .../x/text/unicode/norm/tables10.0.0.go | 7657 ---- .../x/text/unicode/norm/tables11.0.0.go | 7693 ---- .../x/text/unicode/norm/tables12.0.0.go | 7710 ---- .../x/text/unicode/norm/tables9.0.0.go | 7637 ---- .../x/text/unicode/norm/transform.go | 88 - vendor/golang.org/x/text/unicode/norm/trie.go | 54 - vendor/golang.org/x/time/AUTHORS | 3 - vendor/golang.org/x/time/CONTRIBUTORS | 3 - vendor/golang.org/x/time/LICENSE | 27 - vendor/golang.org/x/time/PATENTS | 22 - vendor/golang.org/x/time/rate/rate.go | 400 - vendor/google.golang.org/api/AUTHORS | 11 - vendor/google.golang.org/api/CONTRIBUTORS | 56 - vendor/google.golang.org/api/LICENSE | 27 - .../api/drive/v2/drive-api.json | 5889 --- .../api/drive/v2/drive-gen.go | 17051 --------- .../api/drive/v3/drive-api.json | 3837 -- .../api/drive/v3/drive-gen.go | 11168 ------ .../api/googleapi/googleapi.go | 420 - .../api/googleapi/transport/apikey.go | 44 - .../google.golang.org/api/googleapi/types.go | 202 - .../api/internal/conn_pool.go | 30 - .../google.golang.org/api/internal/creds.go | 105 - .../api/internal/gensupport/buffer.go | 79 - .../api/internal/gensupport/doc.go | 10 - .../api/internal/gensupport/json.go | 211 - .../api/internal/gensupport/jsonfloat.go | 47 - .../api/internal/gensupport/media.go | 372 - .../api/internal/gensupport/params.go | 51 - .../api/internal/gensupport/resumable.go | 258 - .../internal/gensupport/retryable_linux.go | 15 - .../api/internal/gensupport/send.go | 172 - .../api/internal/gensupport/version.go | 53 - .../api/internal/service-account.json | 12 - .../api/internal/settings.go | 105 - .../internal/third_party/uritemplates/LICENSE | 27 - .../third_party/uritemplates/METADATA | 14 - .../third_party/uritemplates/uritemplates.go | 248 - .../third_party/uritemplates/utils.go | 17 - .../api/option/credentials_go19.go | 23 - .../api/option/credentials_notgo19.go | 22 - .../option/internaloption/internaloption.go | 26 - vendor/google.golang.org/api/option/option.go | 271 - .../api/storage/v1/storage-api.json | 4459 --- .../api/storage/v1/storage-gen.go | 13409 ------- .../api/transport/cert/default_cert.go | 110 - .../transport/http/default_transport_go113.go | 20 - .../http/default_transport_not_go113.go | 15 - .../api/transport/http/dial.go | 327 - .../api/transport/http/dial_appengine.go | 20 - .../http/internal/propagation/http.go | 86 - .../google.golang.org/appengine/.travis.yml | 18 - .../appengine/CONTRIBUTING.md | 90 - vendor/google.golang.org/appengine/LICENSE | 202 - vendor/google.golang.org/appengine/README.md | 100 - .../google.golang.org/appengine/appengine.go | 135 - .../appengine/appengine_vm.go | 20 - vendor/google.golang.org/appengine/errors.go | 46 - vendor/google.golang.org/appengine/go.mod | 9 - vendor/google.golang.org/appengine/go.sum | 11 - .../google.golang.org/appengine/identity.go | 142 - .../appengine/internal/api.go | 678 - .../appengine/internal/api_classic.go | 169 - .../appengine/internal/api_common.go | 123 - .../appengine/internal/app_id.go | 28 - .../app_identity/app_identity_service.pb.go | 611 - .../app_identity/app_identity_service.proto | 64 - .../appengine/internal/base/api_base.pb.go | 308 - .../appengine/internal/base/api_base.proto | 33 - .../internal/datastore/datastore_v3.pb.go | 4367 --- .../internal/datastore/datastore_v3.proto | 551 - .../appengine/internal/identity.go | 55 - .../appengine/internal/identity_classic.go | 61 - .../appengine/internal/identity_flex.go | 11 - .../appengine/internal/identity_vm.go | 134 - .../appengine/internal/internal.go | 110 - .../appengine/internal/log/log_service.pb.go | 1313 - .../appengine/internal/log/log_service.proto | 150 - .../appengine/internal/main.go | 16 - .../appengine/internal/main_common.go | 7 - .../appengine/internal/main_vm.go | 69 - .../appengine/internal/metadata.go | 60 - .../internal/modules/modules_service.pb.go | 786 - .../internal/modules/modules_service.proto | 80 - .../appengine/internal/net.go | 56 - .../appengine/internal/regen.sh | 40 - .../internal/remote_api/remote_api.pb.go | 361 - .../internal/remote_api/remote_api.proto | 44 - .../appengine/internal/transaction.go | 115 - .../internal/urlfetch/urlfetch_service.pb.go | 527 - .../internal/urlfetch/urlfetch_service.proto | 64 - .../google.golang.org/appengine/namespace.go | 25 - vendor/google.golang.org/appengine/timeout.go | 20 - .../appengine/travis_install.sh | 18 - .../appengine/travis_test.sh | 12 - .../appengine/urlfetch/urlfetch.go | 210 - vendor/google.golang.org/genproto/LICENSE | 202 - .../googleapis/rpc/status/status.pb.go | 206 - vendor/google.golang.org/grpc/.travis.yml | 42 - vendor/google.golang.org/grpc/AUTHORS | 1 - .../google.golang.org/grpc/CODE-OF-CONDUCT.md | 3 - vendor/google.golang.org/grpc/CONTRIBUTING.md | 62 - vendor/google.golang.org/grpc/GOVERNANCE.md | 1 - vendor/google.golang.org/grpc/LICENSE | 202 - vendor/google.golang.org/grpc/MAINTAINERS.md | 27 - vendor/google.golang.org/grpc/Makefile | 63 - vendor/google.golang.org/grpc/README.md | 142 - .../grpc/attributes/attributes.go | 76 - vendor/google.golang.org/grpc/backoff.go | 58 - .../google.golang.org/grpc/backoff/backoff.go | 52 - .../grpc/balancer/balancer.go | 384 - .../grpc/balancer/base/balancer.go | 235 - .../grpc/balancer/base/base.go | 82 - .../grpc/balancer/grpclb/state/state.go | 51 - .../grpc/balancer/roundrobin/roundrobin.go | 81 - .../grpc/balancer_conn_wrappers.go | 246 - .../grpc_binarylog_v1/binarylog.pb.go | 812 - vendor/google.golang.org/grpc/call.go | 74 - vendor/google.golang.org/grpc/clientconn.go | 1550 - vendor/google.golang.org/grpc/codec.go | 50 - vendor/google.golang.org/grpc/codegen.sh | 17 - .../grpc/codes/code_string.go | 62 - vendor/google.golang.org/grpc/codes/codes.go | 198 - .../grpc/connectivity/connectivity.go | 73 - .../grpc/credentials/credentials.go | 289 - .../grpc/credentials/go12.go | 30 - .../grpc/credentials/internal/syscallconn.go | 61 - .../internal/syscallconn_appengine.go | 30 - .../google.golang.org/grpc/credentials/tls.go | 235 - vendor/google.golang.org/grpc/dialoptions.go | 606 - vendor/google.golang.org/grpc/doc.go | 26 - .../grpc/encoding/encoding.go | 122 - .../grpc/encoding/proto/proto.go | 110 - vendor/google.golang.org/grpc/go.mod | 15 - vendor/google.golang.org/grpc/go.sum | 68 - .../google.golang.org/grpc/grpclog/grpclog.go | 132 - .../google.golang.org/grpc/grpclog/logger.go | 87 - .../grpc/grpclog/loggerv2.go | 214 - vendor/google.golang.org/grpc/install_gae.sh | 6 - vendor/google.golang.org/grpc/interceptor.go | 77 - .../grpc/internal/backoff/backoff.go | 73 - .../grpc/internal/balancerload/load.go | 46 - .../grpc/internal/binarylog/binarylog.go | 168 - .../internal/binarylog/binarylog_testutil.go | 42 - .../grpc/internal/binarylog/env_config.go | 210 - .../grpc/internal/binarylog/method_logger.go | 423 - .../grpc/internal/binarylog/sink.go | 162 - .../grpc/internal/buffer/unbounded.go | 85 - .../grpc/internal/channelz/funcs.go | 739 - .../grpc/internal/channelz/logging.go | 100 - .../grpc/internal/channelz/types.go | 702 - .../grpc/internal/channelz/types_linux.go | 53 - .../grpc/internal/channelz/types_nonlinux.go | 44 - .../grpc/internal/channelz/util_linux.go | 39 - .../grpc/internal/channelz/util_nonlinux.go | 26 - .../grpc/internal/envconfig/envconfig.go | 38 - .../grpc/internal/grpclog/grpclog.go | 118 - .../grpc/internal/grpclog/prefixLogger.go | 63 - .../grpc/internal/grpcrand/grpcrand.go | 56 - .../grpc/internal/grpcsync/event.go | 61 - .../grpc/internal/grpcutil/method.go | 40 - .../grpc/internal/grpcutil/target.go | 55 - .../grpc/internal/internal.go | 76 - .../internal/resolver/dns/dns_resolver.go | 444 - .../grpc/internal/resolver/dns/go113.go | 33 - .../resolver/passthrough/passthrough.go | 57 - .../internal/serviceconfig/serviceconfig.go | 90 - .../grpc/internal/status/status.go | 162 - .../grpc/internal/syscall/syscall_linux.go | 114 - .../grpc/internal/syscall/syscall_nonlinux.go | 75 - .../grpc/internal/transport/bdp_estimator.go | 141 - .../grpc/internal/transport/controlbuf.go | 936 - .../grpc/internal/transport/defaults.go | 49 - .../grpc/internal/transport/flowcontrol.go | 217 - .../grpc/internal/transport/handler_server.go | 462 - .../grpc/internal/transport/http2_client.go | 1476 - .../grpc/internal/transport/http2_server.go | 1244 - .../grpc/internal/transport/http_util.go | 677 - .../grpc/internal/transport/log.go | 44 - .../grpc/internal/transport/transport.go | 802 - .../grpc/keepalive/keepalive.go | 85 - .../grpc/metadata/metadata.go | 209 - vendor/google.golang.org/grpc/peer/peer.go | 51 - .../google.golang.org/grpc/picker_wrapper.go | 178 - vendor/google.golang.org/grpc/pickfirst.go | 137 - vendor/google.golang.org/grpc/preloader.go | 64 - vendor/google.golang.org/grpc/proxy.go | 152 - vendor/google.golang.org/grpc/regenerate.sh | 79 - .../grpc/resolver/resolver.go | 256 - .../grpc/resolver_conn_wrapper.go | 222 - vendor/google.golang.org/grpc/rpc_util.go | 882 - vendor/google.golang.org/grpc/server.go | 1732 - .../google.golang.org/grpc/service_config.go | 434 - .../grpc/serviceconfig/serviceconfig.go | 41 - .../google.golang.org/grpc/stats/handlers.go | 63 - vendor/google.golang.org/grpc/stats/stats.go | 312 - .../google.golang.org/grpc/status/status.go | 127 - vendor/google.golang.org/grpc/stream.go | 1541 - vendor/google.golang.org/grpc/tap/tap.go | 51 - vendor/google.golang.org/grpc/trace.go | 123 - vendor/google.golang.org/grpc/version.go | 22 - vendor/google.golang.org/grpc/vet.sh | 189 - vendor/google.golang.org/protobuf/AUTHORS | 3 - .../google.golang.org/protobuf/CONTRIBUTORS | 3 - vendor/google.golang.org/protobuf/LICENSE | 27 - vendor/google.golang.org/protobuf/PATENTS | 22 - .../protobuf/encoding/prototext/decode.go | 791 - .../protobuf/encoding/prototext/doc.go | 7 - .../protobuf/encoding/prototext/encode.go | 433 - .../protobuf/encoding/protowire/wire.go | 538 - .../protobuf/internal/descfmt/stringer.go | 316 - .../protobuf/internal/descopts/options.go | 29 - .../protobuf/internal/detrand/rand.go | 61 - .../internal/encoding/defval/default.go | 213 - .../encoding/messageset/messageset.go | 258 - .../protobuf/internal/encoding/tag/tag.go | 207 - .../protobuf/internal/encoding/text/decode.go | 665 - .../internal/encoding/text/decode_number.go | 190 - .../internal/encoding/text/decode_string.go | 161 - .../internal/encoding/text/decode_token.go | 373 - .../protobuf/internal/encoding/text/doc.go | 29 - .../protobuf/internal/encoding/text/encode.go | 267 - .../protobuf/internal/errors/errors.go | 89 - .../protobuf/internal/errors/is_go112.go | 39 - .../protobuf/internal/errors/is_go113.go | 12 - .../protobuf/internal/fieldsort/fieldsort.go | 40 - .../protobuf/internal/filedesc/build.go | 155 - .../protobuf/internal/filedesc/desc.go | 614 - .../protobuf/internal/filedesc/desc_init.go | 471 - .../protobuf/internal/filedesc/desc_lazy.go | 704 - .../protobuf/internal/filedesc/desc_list.go | 282 - .../internal/filedesc/desc_list_gen.go | 345 - .../protobuf/internal/filedesc/placeholder.go | 107 - .../protobuf/internal/filetype/build.go | 297 - .../protobuf/internal/flags/flags.go | 24 - .../internal/flags/proto_legacy_disable.go | 9 - .../internal/flags/proto_legacy_enable.go | 9 - .../protobuf/internal/genid/any_gen.go | 34 - .../protobuf/internal/genid/api_gen.go | 106 - .../protobuf/internal/genid/descriptor_gen.go | 829 - .../protobuf/internal/genid/doc.go | 11 - .../protobuf/internal/genid/duration_gen.go | 34 - .../protobuf/internal/genid/empty_gen.go | 19 - .../protobuf/internal/genid/field_mask_gen.go | 31 - .../protobuf/internal/genid/goname.go | 25 - .../protobuf/internal/genid/map_entry.go | 16 - .../internal/genid/source_context_gen.go | 31 - .../protobuf/internal/genid/struct_gen.go | 116 - .../protobuf/internal/genid/timestamp_gen.go | 34 - .../protobuf/internal/genid/type_gen.go | 184 - .../protobuf/internal/genid/wrappers.go | 13 - .../protobuf/internal/genid/wrappers_gen.go | 175 - .../protobuf/internal/impl/api_export.go | 177 - .../protobuf/internal/impl/checkinit.go | 141 - .../protobuf/internal/impl/codec_extension.go | 223 - .../protobuf/internal/impl/codec_field.go | 828 - .../protobuf/internal/impl/codec_gen.go | 5637 --- .../protobuf/internal/impl/codec_map.go | 389 - .../protobuf/internal/impl/codec_map_go111.go | 37 - .../protobuf/internal/impl/codec_map_go112.go | 11 - .../protobuf/internal/impl/codec_message.go | 159 - .../internal/impl/codec_messageset.go | 120 - .../protobuf/internal/impl/codec_reflect.go | 209 - .../protobuf/internal/impl/codec_tables.go | 557 - .../protobuf/internal/impl/codec_unsafe.go | 17 - .../protobuf/internal/impl/convert.go | 467 - .../protobuf/internal/impl/convert_list.go | 141 - .../protobuf/internal/impl/convert_map.go | 121 - .../protobuf/internal/impl/decode.go | 274 - .../protobuf/internal/impl/encode.go | 199 - .../protobuf/internal/impl/enum.go | 21 - .../protobuf/internal/impl/extension.go | 156 - .../protobuf/internal/impl/legacy_enum.go | 219 - .../protobuf/internal/impl/legacy_export.go | 92 - .../internal/impl/legacy_extension.go | 175 - .../protobuf/internal/impl/legacy_file.go | 81 - .../protobuf/internal/impl/legacy_message.go | 502 - .../protobuf/internal/impl/merge.go | 176 - .../protobuf/internal/impl/merge_gen.go | 209 - .../protobuf/internal/impl/message.go | 215 - .../protobuf/internal/impl/message_reflect.go | 364 - .../internal/impl/message_reflect_field.go | 466 - .../internal/impl/message_reflect_gen.go | 249 - .../protobuf/internal/impl/pointer_reflect.go | 177 - .../protobuf/internal/impl/pointer_unsafe.go | 173 - .../protobuf/internal/impl/validate.go | 576 - .../protobuf/internal/impl/weak.go | 74 - .../protobuf/internal/mapsort/mapsort.go | 43 - .../protobuf/internal/pragma/pragma.go | 29 - .../protobuf/internal/set/ints.go | 58 - .../protobuf/internal/strs/strings.go | 196 - .../protobuf/internal/strs/strings_pure.go | 27 - .../protobuf/internal/strs/strings_unsafe.go | 94 - .../protobuf/internal/version/version.go | 79 - .../protobuf/proto/checkinit.go | 71 - .../protobuf/proto/decode.go | 274 - .../protobuf/proto/decode_gen.go | 603 - .../google.golang.org/protobuf/proto/doc.go | 94 - .../protobuf/proto/encode.go | 346 - .../protobuf/proto/encode_gen.go | 97 - .../google.golang.org/protobuf/proto/equal.go | 154 - .../protobuf/proto/extension.go | 92 - .../google.golang.org/protobuf/proto/merge.go | 139 - .../protobuf/proto/messageset.go | 88 - .../google.golang.org/protobuf/proto/proto.go | 34 - .../protobuf/proto/proto_methods.go | 19 - .../protobuf/proto/proto_reflect.go | 19 - .../google.golang.org/protobuf/proto/reset.go | 43 - .../google.golang.org/protobuf/proto/size.go | 97 - .../protobuf/proto/size_gen.go | 55 - .../protobuf/proto/wrappers.go | 29 - .../protobuf/reflect/protoreflect/methods.go | 77 - .../protobuf/reflect/protoreflect/proto.go | 504 - .../protobuf/reflect/protoreflect/source.go | 52 - .../protobuf/reflect/protoreflect/type.go | 631 - .../protobuf/reflect/protoreflect/value.go | 285 - .../reflect/protoreflect/value_pure.go | 59 - .../reflect/protoreflect/value_union.go | 411 - .../reflect/protoreflect/value_unsafe.go | 98 - .../reflect/protoregistry/registry.go | 800 - .../protobuf/runtime/protoiface/legacy.go | 15 - .../protobuf/runtime/protoiface/methods.go | 167 - .../protobuf/runtime/protoimpl/impl.go | 44 - .../protobuf/runtime/protoimpl/version.go | 56 - .../protobuf/types/known/anypb/any.pb.go | 494 - .../types/known/durationpb/duration.pb.go | 379 - .../types/known/timestamppb/timestamp.pb.go | 381 - vendor/gopkg.in/ini.v1/.gitignore | 6 - vendor/gopkg.in/ini.v1/LICENSE | 191 - vendor/gopkg.in/ini.v1/Makefile | 15 - vendor/gopkg.in/ini.v1/README.md | 43 - vendor/gopkg.in/ini.v1/codecov.yml | 9 - vendor/gopkg.in/ini.v1/data_source.go | 76 - vendor/gopkg.in/ini.v1/deprecated.go | 25 - vendor/gopkg.in/ini.v1/error.go | 34 - vendor/gopkg.in/ini.v1/file.go | 509 - vendor/gopkg.in/ini.v1/helper.go | 24 - vendor/gopkg.in/ini.v1/ini.go | 168 - vendor/gopkg.in/ini.v1/key.go | 829 - vendor/gopkg.in/ini.v1/parser.go | 535 - vendor/gopkg.in/ini.v1/section.go | 256 - vendor/gopkg.in/ini.v1/struct.go | 729 - vendor/gopkg.in/yaml.v2/.travis.yml | 16 - vendor/gopkg.in/yaml.v2/LICENSE | 201 - vendor/gopkg.in/yaml.v2/LICENSE.libyaml | 31 - vendor/gopkg.in/yaml.v2/NOTICE | 13 - vendor/gopkg.in/yaml.v2/README.md | 133 - vendor/gopkg.in/yaml.v2/apic.go | 740 - vendor/gopkg.in/yaml.v2/decode.go | 815 - vendor/gopkg.in/yaml.v2/emitterc.go | 1685 - vendor/gopkg.in/yaml.v2/encode.go | 390 - vendor/gopkg.in/yaml.v2/go.mod | 5 - vendor/gopkg.in/yaml.v2/parserc.go | 1095 - vendor/gopkg.in/yaml.v2/readerc.go | 412 - vendor/gopkg.in/yaml.v2/resolve.go | 258 - vendor/gopkg.in/yaml.v2/scannerc.go | 2711 -- vendor/gopkg.in/yaml.v2/sorter.go | 113 - vendor/gopkg.in/yaml.v2/writerc.go | 26 - vendor/gopkg.in/yaml.v2/yaml.go | 466 - vendor/gopkg.in/yaml.v2/yamlh.go | 739 - vendor/gopkg.in/yaml.v2/yamlprivateh.go | 173 - vendor/gopkg.in/yaml.v3/.travis.yml | 17 - vendor/gopkg.in/yaml.v3/LICENSE | 50 - vendor/gopkg.in/yaml.v3/NOTICE | 13 - vendor/gopkg.in/yaml.v3/README.md | 150 - vendor/gopkg.in/yaml.v3/apic.go | 747 - vendor/gopkg.in/yaml.v3/decode.go | 948 - vendor/gopkg.in/yaml.v3/emitterc.go | 2022 - vendor/gopkg.in/yaml.v3/encode.go | 572 - vendor/gopkg.in/yaml.v3/go.mod | 5 - vendor/gopkg.in/yaml.v3/parserc.go | 1249 - vendor/gopkg.in/yaml.v3/readerc.go | 434 - vendor/gopkg.in/yaml.v3/resolve.go | 326 - vendor/gopkg.in/yaml.v3/scannerc.go | 3028 -- vendor/gopkg.in/yaml.v3/sorter.go | 134 - vendor/gopkg.in/yaml.v3/writerc.go | 48 - vendor/gopkg.in/yaml.v3/yaml.go | 693 - vendor/gopkg.in/yaml.v3/yamlh.go | 807 - vendor/gopkg.in/yaml.v3/yamlprivateh.go | 198 - vendor/modules.txt | 584 - vendor/storj.io/common/LICENSE | 19 - vendor/storj.io/common/encryption/aesgcm.go | 165 - vendor/storj.io/common/encryption/bits.go | 30 - vendor/storj.io/common/encryption/common.go | 18 - .../storj.io/common/encryption/encryption.go | 156 - vendor/storj.io/common/encryption/pad.go | 89 - vendor/storj.io/common/encryption/password.go | 47 - vendor/storj.io/common/encryption/path.go | 510 - .../storj.io/common/encryption/secretbox.go | 119 - vendor/storj.io/common/encryption/store.go | 313 - .../storj.io/common/encryption/transform.go | 188 - vendor/storj.io/common/errs2/collect.go | 40 - vendor/storj.io/common/errs2/doc.go | 5 - vendor/storj.io/common/errs2/group.go | 38 - vendor/storj.io/common/errs2/ignore.go | 28 - vendor/storj.io/common/errs2/rpc.go | 17 - vendor/storj.io/common/errs2/sanatizer.go | 52 - vendor/storj.io/common/fpath/atomic.go | 42 - vendor/storj.io/common/fpath/doc.go | 5 - vendor/storj.io/common/fpath/editor.go | 62 - vendor/storj.io/common/fpath/os.go | 133 - vendor/storj.io/common/fpath/path.go | 148 - vendor/storj.io/common/fpath/temp_data.go | 38 - .../common/identity/certificate_authority.go | 501 - vendor/storj.io/common/identity/common.go | 16 - vendor/storj.io/common/identity/doc.go | 5 - vendor/storj.io/common/identity/generate.go | 89 - vendor/storj.io/common/identity/identity.go | 547 - vendor/storj.io/common/identity/utils.go | 108 - vendor/storj.io/common/macaroon/apikey.go | 303 - vendor/storj.io/common/macaroon/caveat.go | 15 - vendor/storj.io/common/macaroon/doc.go | 5 - vendor/storj.io/common/macaroon/macaroon.go | 128 - vendor/storj.io/common/macaroon/serialize.go | 215 - vendor/storj.io/common/macaroon/types.pb.go | 203 - vendor/storj.io/common/macaroon/types.proto | 33 - vendor/storj.io/common/memory/doc.go | 5 - vendor/storj.io/common/memory/size.go | 247 - vendor/storj.io/common/memory/sizes.go | 42 - vendor/storj.io/common/memory/string.go | 16 - vendor/storj.io/common/netutil/common.go | 8 - .../storj.io/common/netutil/timeout_linux.go | 56 - .../storj.io/common/netutil/timeout_other.go | 16 - vendor/storj.io/common/netutil/tracking.go | 36 - vendor/storj.io/common/paths/doc.go | 6 - vendor/storj.io/common/paths/path.go | 153 - vendor/storj.io/common/pb/alias.go | 12 - vendor/storj.io/common/pb/certificate.pb.go | 206 - vendor/storj.io/common/pb/certificate.proto | 20 - vendor/storj.io/common/pb/contact.pb.go | 483 - vendor/storj.io/common/pb/contact.proto | 42 - vendor/storj.io/common/pb/datarepair.pb.go | 103 - vendor/storj.io/common/pb/datarepair.proto | 16 - vendor/storj.io/common/pb/doc.go | 7 - vendor/storj.io/common/pb/encryption.pb.go | 125 - vendor/storj.io/common/pb/encryption.proto | 19 - .../common/pb/encryption_access.pb.go | 195 - .../common/pb/encryption_access.proto | 27 - vendor/storj.io/common/pb/gogo.proto | 143 - vendor/storj.io/common/pb/gracefulexit.pb.go | 1608 - vendor/storj.io/common/pb/gracefulexit.proto | 153 - vendor/storj.io/common/pb/heldamount.pb.go | 483 - vendor/storj.io/common/pb/heldamount.proto | 49 - vendor/storj.io/common/pb/inspector.pb.go | 1346 - vendor/storj.io/common/pb/inspector.proto | 130 - vendor/storj.io/common/pb/meta.pb.go | 93 - vendor/storj.io/common/pb/meta.proto | 13 - vendor/storj.io/common/pb/metainfo.pb.go | 5355 --- vendor/storj.io/common/pb/metainfo.proto | 536 - vendor/storj.io/common/pb/node.pb.go | 488 - vendor/storj.io/common/pb/node.proto | 72 - vendor/storj.io/common/pb/nodestats.pb.go | 654 - vendor/storj.io/common/pb/nodestats.proto | 61 - vendor/storj.io/common/pb/orders.pb.go | 821 - vendor/storj.io/common/pb/orders.proto | 168 - vendor/storj.io/common/pb/payments.pb.go | 625 - vendor/storj.io/common/pb/payments.proto | 48 - vendor/storj.io/common/pb/piecestore2.pb.go | 1164 - vendor/storj.io/common/pb/piecestore2.proto | 131 - vendor/storj.io/common/pb/pointerdb.pb.go | 533 - vendor/storj.io/common/pb/pointerdb.proto | 73 - .../storj.io/common/pb/referralmanager.pb.go | 326 - .../storj.io/common/pb/referralmanager.proto | 31 - vendor/storj.io/common/pb/scannerValuer.go | 39 - vendor/storj.io/common/pb/scope.pb.go | 98 - vendor/storj.io/common/pb/scope.proto | 18 - vendor/storj.io/common/pb/streams.pb.go | 234 - vendor/storj.io/common/pb/streams.proto | 27 - vendor/storj.io/common/pb/types.go | 36 - vendor/storj.io/common/pb/utils.go | 88 - vendor/storj.io/common/pb/vouchers.pb.go | 290 - vendor/storj.io/common/pb/vouchers.proto | 39 - vendor/storj.io/common/peertls/doc.go | 5 - .../storj.io/common/peertls/extensions/doc.go | 5 - .../common/peertls/extensions/extensions.go | 187 - .../common/peertls/extensions/fuzz.go | 29 - .../storj.io/common/peertls/extensions/gob.go | 231 - .../common/peertls/extensions/revocations.go | 177 - vendor/storj.io/common/peertls/peertls.go | 169 - vendor/storj.io/common/peertls/templates.go | 46 - .../storj.io/common/peertls/tlsopts/cert.go | 18 - .../storj.io/common/peertls/tlsopts/config.go | 17 - vendor/storj.io/common/peertls/tlsopts/doc.go | 5 - .../common/peertls/tlsopts/options.go | 194 - vendor/storj.io/common/peertls/tlsopts/tls.go | 86 - vendor/storj.io/common/peertls/utils.go | 96 - vendor/storj.io/common/pkcrypto/common.go | 38 - vendor/storj.io/common/pkcrypto/doc.go | 14 - vendor/storj.io/common/pkcrypto/encoding.go | 236 - vendor/storj.io/common/pkcrypto/hashing.go | 23 - .../storj.io/common/pkcrypto/hashing_std.go | 22 - vendor/storj.io/common/pkcrypto/signing.go | 172 - vendor/storj.io/common/ranger/common.go | 14 - vendor/storj.io/common/ranger/doc.go | 5 - vendor/storj.io/common/ranger/file.go | 81 - vendor/storj.io/common/ranger/reader.go | 117 - vendor/storj.io/common/ranger/readerat.go | 62 - vendor/storj.io/common/readcloser/doc.go | 5 - vendor/storj.io/common/readcloser/fatal.go | 23 - vendor/storj.io/common/readcloser/lazy.go | 35 - vendor/storj.io/common/readcloser/limit.go | 25 - vendor/storj.io/common/readcloser/multi.go | 71 - vendor/storj.io/common/rpc/common.go | 69 - vendor/storj.io/common/rpc/conn.go | 33 - vendor/storj.io/common/rpc/dial.go | 314 - vendor/storj.io/common/rpc/doc.go | 5 - vendor/storj.io/common/rpc/known_ids.go | 57 - vendor/storj.io/common/rpc/lookup.go | 48 - vendor/storj.io/common/rpc/rpcpeer/peer.go | 64 - vendor/storj.io/common/rpc/rpcpool/pool.go | 225 - .../storj.io/common/rpc/rpcstatus/status.go | 105 - .../storj.io/common/rpc/rpctracing/common.go | 18 - .../storj.io/common/rpc/rpctracing/handler.go | 57 - .../storj.io/common/rpc/rpctracing/tracing.go | 58 - vendor/storj.io/common/signing/doc.go | 5 - vendor/storj.io/common/signing/encode.go | 120 - vendor/storj.io/common/signing/peers.go | 74 - vendor/storj.io/common/signing/sign.go | 165 - vendor/storj.io/common/signing/verify.go | 117 - vendor/storj.io/common/storj/bucket.go | 36 - vendor/storj.io/common/storj/doc.go | 5 - vendor/storj.io/common/storj/encryption.go | 163 - .../storj.io/common/storj/identity_version.go | 140 - vendor/storj.io/common/storj/metainfo.go | 81 - vendor/storj.io/common/storj/node.go | 260 - vendor/storj.io/common/storj/nodeurl.go | 137 - vendor/storj.io/common/storj/object.go | 109 - .../storj.io/common/storj/object_list_item.go | 21 - vendor/storj.io/common/storj/path.go | 21 - vendor/storj.io/common/storj/pieceid.go | 140 - vendor/storj.io/common/storj/piecekey.go | 159 - vendor/storj.io/common/storj/redundancy.go | 69 - vendor/storj.io/common/storj/segment.go | 32 - vendor/storj.io/common/storj/segmentid.go | 81 - vendor/storj.io/common/storj/serialnumber.go | 117 - vendor/storj.io/common/storj/streamid.go | 101 - vendor/storj.io/common/sync2/cooldown.go | 139 - vendor/storj.io/common/sync2/copy.go | 32 - vendor/storj.io/common/sync2/cycle.go | 224 - vendor/storj.io/common/sync2/doc.go | 12 - vendor/storj.io/common/sync2/fence.go | 67 - vendor/storj.io/common/sync2/io.go | 81 - vendor/storj.io/common/sync2/limiter.go | 52 - vendor/storj.io/common/sync2/nocopy.go | 15 - .../common/sync2/parent_child_limiter.go | 59 - vendor/storj.io/common/sync2/pipe.go | 280 - vendor/storj.io/common/sync2/semaphore.go | 47 - vendor/storj.io/common/sync2/sleep.go | 22 - .../common/sync2/success_threshold.go | 109 - vendor/storj.io/common/sync2/tee.go | 204 - vendor/storj.io/common/sync2/throttle.go | 130 - vendor/storj.io/common/sync2/workgroup.go | 88 - vendor/storj.io/common/uuid/db.go | 62 - vendor/storj.io/common/uuid/fuzz.go | 28 - vendor/storj.io/common/uuid/uuid.go | 141 - vendor/storj.io/drpc/.gitignore | 3 - vendor/storj.io/drpc/.golangci.yml | 129 - vendor/storj.io/drpc/Dockerfile.jenkins | 11 - vendor/storj.io/drpc/Jenkinsfile | 27 - vendor/storj.io/drpc/LICENSE | 19 - vendor/storj.io/drpc/Makefile | 33 - vendor/storj.io/drpc/README.md | 137 - vendor/storj.io/drpc/doc.go | 5 - vendor/storj.io/drpc/drpc.go | 98 - vendor/storj.io/drpc/drpccache/README.md | 74 - vendor/storj.io/drpc/drpccache/cache.go | 101 - vendor/storj.io/drpc/drpccache/doc.go | 5 - vendor/storj.io/drpc/drpcconn/README.md | 79 - vendor/storj.io/drpc/drpcconn/conn.go | 156 - vendor/storj.io/drpc/drpcconn/doc.go | 9 - vendor/storj.io/drpc/drpcctx/README.md | 60 - vendor/storj.io/drpc/drpcctx/doc.go | 5 - vendor/storj.io/drpc/drpcctx/transport.go | 59 - vendor/storj.io/drpc/drpcdebug/README.md | 14 - vendor/storj.io/drpc/drpcdebug/doc.go | 5 - .../storj.io/drpc/drpcdebug/log_disabled.go | 9 - vendor/storj.io/drpc/drpcdebug/log_enabled.go | 18 - vendor/storj.io/drpc/drpcerr/README.md | 22 - vendor/storj.io/drpc/drpcerr/doc.go | 5 - vendor/storj.io/drpc/drpcerr/err.go | 40 - vendor/storj.io/drpc/drpcmanager/README.md | 79 - vendor/storj.io/drpc/drpcmanager/doc.go | 9 - vendor/storj.io/drpc/drpcmanager/manager.go | 338 - vendor/storj.io/drpc/drpcmetadata/README.md | 44 - vendor/storj.io/drpc/drpcmetadata/doc.go | 5 - .../drpc/drpcmetadata/invoke/README.md | 80 - .../storj.io/drpc/drpcmetadata/invoke/doc.go | 8 - .../drpc/drpcmetadata/invoke/metadata.pb.go | 79 - .../drpc/drpcmetadata/invoke/metadata.proto | 11 - vendor/storj.io/drpc/drpcmetadata/metadata.go | 58 - vendor/storj.io/drpc/drpcmux/README.md | 39 - vendor/storj.io/drpc/drpcmux/doc.go | 5 - vendor/storj.io/drpc/drpcmux/mux.go | 116 - vendor/storj.io/drpc/drpcsignal/README.md | 56 - vendor/storj.io/drpc/drpcsignal/doc.go | 5 - vendor/storj.io/drpc/drpcsignal/signal.go | 75 - vendor/storj.io/drpc/drpcstream/README.md | 147 - vendor/storj.io/drpc/drpcstream/chmutex.go | 38 - vendor/storj.io/drpc/drpcstream/doc.go | 9 - vendor/storj.io/drpc/drpcstream/stream.go | 424 - vendor/storj.io/drpc/drpcwire/README.md | 253 - vendor/storj.io/drpc/drpcwire/doc.go | 9 - vendor/storj.io/drpc/drpcwire/error.go | 27 - vendor/storj.io/drpc/drpcwire/packet.go | 160 - .../storj.io/drpc/drpcwire/packet_string.go | 30 - vendor/storj.io/drpc/drpcwire/split.go | 36 - vendor/storj.io/drpc/drpcwire/transport.go | 158 - vendor/storj.io/drpc/drpcwire/varint.go | 33 - vendor/storj.io/drpc/go.mod | 10 - vendor/storj.io/drpc/go.sum | 20 - vendor/storj.io/drpc/staticcheck.conf | 1 - vendor/storj.io/uplink/.clabot | 63 - vendor/storj.io/uplink/.gitignore | 37 - vendor/storj.io/uplink/CODE_OF_CONDUCT.md | 53 - vendor/storj.io/uplink/Jenkinsfile | 134 - vendor/storj.io/uplink/LICENSE | 19 - vendor/storj.io/uplink/MAINTAINERS.md | 51 - vendor/storj.io/uplink/Makefile | 7 - vendor/storj.io/uplink/README.md | 46 - vendor/storj.io/uplink/access.go | 314 - vendor/storj.io/uplink/bucket.go | 116 - vendor/storj.io/uplink/buckets.go | 128 - vendor/storj.io/uplink/common.go | 65 - vendor/storj.io/uplink/config.go | 84 - vendor/storj.io/uplink/doc.go | 132 - vendor/storj.io/uplink/download.go | 76 - vendor/storj.io/uplink/encryption.go | 116 - vendor/storj.io/uplink/go.mod | 14 - vendor/storj.io/uplink/go.sum | 101 - .../uplink/internal/expose/exposed.go | 14 - .../uplink/internal/telemetryclient/client.go | 42 - vendor/storj.io/uplink/object.go | 121 - vendor/storj.io/uplink/objects.go | 169 - .../uplink/private/ecclient/client.go | 445 - .../uplink/private/ecclient/common.go | 11 - .../uplink/private/eestream/common.go | 11 - .../uplink/private/eestream/decode.go | 230 - .../uplink/private/eestream/encode.go | 318 - .../uplink/private/eestream/piecebuf.go | 300 - vendor/storj.io/uplink/private/eestream/rs.go | 53 - .../uplink/private/eestream/stripe.go | 185 - .../uplink/private/eestream/unsafe_rs.go | 62 - .../storj.io/uplink/private/metainfo/batch.go | 149 - .../uplink/private/metainfo/client.go | 1143 - .../uplink/private/metainfo/interface.go | 83 - .../uplink/private/metainfo/metainfo.go | 84 - .../uplink/private/metainfo/objects.go | 533 - .../storj.io/uplink/private/metainfo/paths.go | 29 - .../uplink/private/metainfo/stream.go | 154 - .../uplink/private/piecestore/buffering.go | 103 - .../uplink/private/piecestore/client.go | 97 - .../uplink/private/piecestore/download.go | 306 - .../uplink/private/piecestore/upload.go | 261 - .../uplink/private/piecestore/verification.go | 55 - .../uplink/private/storage/segments/common.go | 11 - .../uplink/private/storage/segments/size.go | 29 - .../uplink/private/storage/segments/store.go | 101 - .../uplink/private/storage/streams/eof.go | 36 - .../uplink/private/storage/streams/path.go | 43 - .../uplink/private/storage/streams/peek.go | 61 - .../uplink/private/storage/streams/shim.go | 54 - .../uplink/private/storage/streams/store.go | 534 - .../storj.io/uplink/private/stream/common.go | 11 - .../uplink/private/stream/download.go | 121 - .../storj.io/uplink/private/stream/upload.go | 95 - .../uplink/private/testuplink/uplink.go | 23 - vendor/storj.io/uplink/project.go | 150 - vendor/storj.io/uplink/upload.go | 163 - 3157 files changed, 869833 deletions(-) delete mode 100644 vendor/bazil.org/fuse/.gitattributes delete mode 100644 vendor/bazil.org/fuse/.gitignore delete mode 100644 vendor/bazil.org/fuse/LICENSE delete mode 100644 vendor/bazil.org/fuse/README.md delete mode 100644 vendor/bazil.org/fuse/buffer.go delete mode 100644 vendor/bazil.org/fuse/debug.go delete mode 100644 vendor/bazil.org/fuse/error_darwin.go delete mode 100644 vendor/bazil.org/fuse/error_freebsd.go delete mode 100644 vendor/bazil.org/fuse/error_linux.go delete mode 100644 vendor/bazil.org/fuse/error_std.go delete mode 100644 vendor/bazil.org/fuse/fs/serve.go delete mode 100644 vendor/bazil.org/fuse/fs/tree.go delete mode 100644 vendor/bazil.org/fuse/fuse.go delete mode 100644 vendor/bazil.org/fuse/fuse_darwin.go delete mode 100644 vendor/bazil.org/fuse/fuse_freebsd.go delete mode 100644 vendor/bazil.org/fuse/fuse_kernel.go delete mode 100644 vendor/bazil.org/fuse/fuse_kernel_darwin.go delete mode 100644 vendor/bazil.org/fuse/fuse_kernel_freebsd.go delete mode 100644 vendor/bazil.org/fuse/fuse_kernel_linux.go delete mode 100644 vendor/bazil.org/fuse/fuse_kernel_std.go delete mode 100644 vendor/bazil.org/fuse/fuse_linux.go delete mode 100644 vendor/bazil.org/fuse/fuseutil/fuseutil.go delete mode 100644 vendor/bazil.org/fuse/go.mod delete mode 100644 vendor/bazil.org/fuse/go.sum delete mode 100644 vendor/bazil.org/fuse/mount.go delete mode 100644 vendor/bazil.org/fuse/mount_darwin.go delete mode 100644 vendor/bazil.org/fuse/mount_freebsd.go delete mode 100644 vendor/bazil.org/fuse/mount_linux.go delete mode 100644 vendor/bazil.org/fuse/options.go delete mode 100644 vendor/bazil.org/fuse/options_darwin.go delete mode 100644 vendor/bazil.org/fuse/options_freebsd.go delete mode 100644 vendor/bazil.org/fuse/options_linux.go delete mode 100644 vendor/bazil.org/fuse/protocol.go delete mode 100644 vendor/bazil.org/fuse/unmount.go delete mode 100644 vendor/bazil.org/fuse/unmount_linux.go delete mode 100644 vendor/bazil.org/fuse/unmount_std.go delete mode 100644 vendor/cloud.google.com/go/LICENSE delete mode 100644 vendor/cloud.google.com/go/compute/metadata/metadata.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/LICENSE delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/core.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_syslog.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_windows.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/doc.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/error.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/progress.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/request.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/response.go delete mode 100644 vendor/github.com/Azure/azure-pipeline-go/pipeline/version.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/LICENSE delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/access_conditions.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/blob.json delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/chunkwriting.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/highlevel.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/parsing_urls.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/sas_service.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/service_codes_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/storage_account_credential.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/url_append_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/url_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/url_block_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/url_container.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/url_page_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/url_service.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/user_delegation_credential.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/version.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_anonymous.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_shared_key.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_token.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_unix.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_windows.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_pipeline.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_request_log.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_retry.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_telemetry.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_unique_request_id.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_retry_reader.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_account.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_query_params.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_service_codes_common.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_storage_error.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_util_validate.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_uuid.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zt_doc.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_append_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_block_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_client.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_container.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_models.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_page_blob.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_responder_policy.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_response_error.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_service.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_validation.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_version.go delete mode 100644 vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_response_helpers.go delete mode 100644 vendor/github.com/Unknwon/goconfig/.gitignore delete mode 100644 vendor/github.com/Unknwon/goconfig/LICENSE delete mode 100644 vendor/github.com/Unknwon/goconfig/README.md delete mode 100644 vendor/github.com/Unknwon/goconfig/README_ZH.md delete mode 100644 vendor/github.com/Unknwon/goconfig/conf.go delete mode 100644 vendor/github.com/Unknwon/goconfig/read.go delete mode 100644 vendor/github.com/Unknwon/goconfig/write.go delete mode 100644 vendor/github.com/a8m/tree/.gitignore delete mode 100644 vendor/github.com/a8m/tree/.travis.yml delete mode 100644 vendor/github.com/a8m/tree/LICENSE delete mode 100644 vendor/github.com/a8m/tree/README.md delete mode 100644 vendor/github.com/a8m/tree/color.go delete mode 100644 vendor/github.com/a8m/tree/compileall.sh delete mode 100644 vendor/github.com/a8m/tree/csort_bsd.go delete mode 100644 vendor/github.com/a8m/tree/csort_generic.go delete mode 100644 vendor/github.com/a8m/tree/csort_unix.go delete mode 100644 vendor/github.com/a8m/tree/modes_bsd.go delete mode 100644 vendor/github.com/a8m/tree/modes_unix.go delete mode 100644 vendor/github.com/a8m/tree/modes_unsupported.go delete mode 100644 vendor/github.com/a8m/tree/node.go delete mode 100644 vendor/github.com/a8m/tree/sort.go delete mode 100644 vendor/github.com/a8m/tree/stat_unix.go delete mode 100644 vendor/github.com/a8m/tree/stat_unsupported.go delete mode 100644 vendor/github.com/aalpar/deheap/LICENSE.txt delete mode 100644 vendor/github.com/aalpar/deheap/README.md delete mode 100644 vendor/github.com/aalpar/deheap/deheap.go delete mode 100644 vendor/github.com/aalpar/deheap/fuzz.go delete mode 100644 vendor/github.com/abbot/go-http-auth/.gitignore delete mode 100644 vendor/github.com/abbot/go-http-auth/LICENSE delete mode 100644 vendor/github.com/abbot/go-http-auth/Makefile delete mode 100644 vendor/github.com/abbot/go-http-auth/README.md delete mode 100644 vendor/github.com/abbot/go-http-auth/auth.go delete mode 100644 vendor/github.com/abbot/go-http-auth/basic.go delete mode 100644 vendor/github.com/abbot/go-http-auth/digest.go delete mode 100644 vendor/github.com/abbot/go-http-auth/md5crypt.go delete mode 100644 vendor/github.com/abbot/go-http-auth/misc.go delete mode 100644 vendor/github.com/abbot/go-http-auth/test.htdigest delete mode 100644 vendor/github.com/abbot/go-http-auth/test.htpasswd delete mode 100644 vendor/github.com/abbot/go-http-auth/users.go delete mode 100644 vendor/github.com/anacrolix/dms/LICENSE delete mode 100644 vendor/github.com/anacrolix/dms/dlna/dlna.go delete mode 100644 vendor/github.com/anacrolix/dms/soap/soap.go delete mode 100644 vendor/github.com/anacrolix/dms/ssdp/ssdp.go delete mode 100644 vendor/github.com/anacrolix/dms/upnp/eventing.go delete mode 100644 vendor/github.com/anacrolix/dms/upnp/upnp.go delete mode 100644 vendor/github.com/atotto/clipboard/.travis.yml delete mode 100644 vendor/github.com/atotto/clipboard/LICENSE delete mode 100644 vendor/github.com/atotto/clipboard/README.md delete mode 100644 vendor/github.com/atotto/clipboard/clipboard.go delete mode 100644 vendor/github.com/atotto/clipboard/clipboard_darwin.go delete mode 100644 vendor/github.com/atotto/clipboard/clipboard_unix.go delete mode 100644 vendor/github.com/atotto/clipboard/clipboard_windows.go delete mode 100644 vendor/github.com/atotto/clipboard/go.mod delete mode 100644 vendor/github.com/aws/aws-sdk-go/LICENSE.txt delete mode 100644 vendor/github.com/aws/aws-sdk-go/NOTICE.txt delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/client.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/logger.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/config.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/convert_types.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.7.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.9.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/token_provider.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/logger.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/validation.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/session.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.7.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/stream.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/types.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/url.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/version.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/context/background_go1.5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/s3err/error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/strings/strings.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/LICENSE delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/singleflight.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/checksum/content_md5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/debug.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/decode.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/encode.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/reader.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/shared.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/signer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/stream_writer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/writer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header_value.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/message.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/host.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/protocol.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/body_hash.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/accesspoint_arn.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/arn.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/service.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/sse.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/api.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/doc.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/errors.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/service.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go delete mode 100644 vendor/github.com/beorn7/perks/LICENSE delete mode 100644 vendor/github.com/beorn7/perks/quantile/exampledata.txt delete mode 100644 vendor/github.com/beorn7/perks/quantile/stream.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/errstr.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/fsop.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/fsop_cgo.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/fsop_nocgo_windows.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/host.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/host_cgo.go delete mode 100644 vendor/github.com/billziss-gh/cgofuse/fuse/host_nocgo_windows.go delete mode 100644 vendor/github.com/btcsuite/btcutil/LICENSE delete mode 100644 vendor/github.com/btcsuite/btcutil/base58/README.md delete mode 100644 vendor/github.com/btcsuite/btcutil/base58/alphabet.go delete mode 100644 vendor/github.com/btcsuite/btcutil/base58/base58.go delete mode 100644 vendor/github.com/btcsuite/btcutil/base58/base58check.go delete mode 100644 vendor/github.com/btcsuite/btcutil/base58/cov_report.sh delete mode 100644 vendor/github.com/btcsuite/btcutil/base58/doc.go delete mode 100644 vendor/github.com/calebcase/tmpfile/.golangci.yml delete mode 100644 vendor/github.com/calebcase/tmpfile/LICENSE delete mode 100644 vendor/github.com/calebcase/tmpfile/LICENSE.golang delete mode 100644 vendor/github.com/calebcase/tmpfile/README.md delete mode 100644 vendor/github.com/calebcase/tmpfile/doc.go delete mode 100644 vendor/github.com/calebcase/tmpfile/go.mod delete mode 100644 vendor/github.com/calebcase/tmpfile/go.sum delete mode 100644 vendor/github.com/calebcase/tmpfile/tmpfile.go delete mode 100644 vendor/github.com/calebcase/tmpfile/tmpfile_windows.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/.travis.yml delete mode 100644 vendor/github.com/cespare/xxhash/v2/LICENSE.txt delete mode 100644 vendor/github.com/cespare/xxhash/v2/README.md delete mode 100644 vendor/github.com/cespare/xxhash/v2/go.mod delete mode 100644 vendor/github.com/cespare/xxhash/v2/go.sum delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_other.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_safe.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go delete mode 100644 vendor/github.com/coreos/go-semver/LICENSE delete mode 100644 vendor/github.com/coreos/go-semver/NOTICE delete mode 100644 vendor/github.com/coreos/go-semver/semver/semver.go delete mode 100644 vendor/github.com/coreos/go-semver/semver/sort.go delete mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md delete mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go delete mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go delete mode 100644 vendor/github.com/davecgh/go-spew/LICENSE delete mode 100644 vendor/github.com/davecgh/go-spew/spew/bypass.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/bypasssafe.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/common.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/config.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/doc.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/dump.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/format.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/spew.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go delete mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go delete mode 100644 vendor/github.com/gogo/protobuf/AUTHORS delete mode 100644 vendor/github.com/gogo/protobuf/CONTRIBUTORS delete mode 100644 vendor/github.com/gogo/protobuf/LICENSE delete mode 100644 vendor/github.com/gogo/protobuf/proto/Makefile delete mode 100644 vendor/github.com/gogo/protobuf/proto/clone.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/custom_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/decode.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/deprecated.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/discard.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/duration.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/duration_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/encode.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/encode_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/equal.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/extensions_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/lib.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/lib_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/message_set.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/properties.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/properties_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/skip_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_merge.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/text.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/text_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/text_parser.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/timestamp.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/wrappers.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go delete mode 100644 vendor/github.com/golang/groupcache/LICENSE delete mode 100644 vendor/github.com/golang/groupcache/lru/lru.go delete mode 100644 vendor/github.com/golang/protobuf/AUTHORS delete mode 100644 vendor/github.com/golang/protobuf/CONTRIBUTORS delete mode 100644 vendor/github.com/golang/protobuf/LICENSE delete mode 100644 vendor/github.com/golang/protobuf/proto/buffer.go delete mode 100644 vendor/github.com/golang/protobuf/proto/defaults.go delete mode 100644 vendor/github.com/golang/protobuf/proto/deprecated.go delete mode 100644 vendor/github.com/golang/protobuf/proto/discard.go delete mode 100644 vendor/github.com/golang/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/golang/protobuf/proto/properties.go delete mode 100644 vendor/github.com/golang/protobuf/proto/proto.go delete mode 100644 vendor/github.com/golang/protobuf/proto/registry.go delete mode 100644 vendor/github.com/golang/protobuf/proto/text_decode.go delete mode 100644 vendor/github.com/golang/protobuf/proto/text_encode.go delete mode 100644 vendor/github.com/golang/protobuf/proto/wire.go delete mode 100644 vendor/github.com/golang/protobuf/proto/wrappers.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/any.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/any/any.pb.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/doc.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/duration.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/timestamp.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go delete mode 100644 vendor/github.com/google/go-querystring/LICENSE delete mode 100644 vendor/github.com/google/go-querystring/query/encode.go delete mode 100644 vendor/github.com/google/uuid/.travis.yml delete mode 100644 vendor/github.com/google/uuid/CONTRIBUTING.md delete mode 100644 vendor/github.com/google/uuid/CONTRIBUTORS delete mode 100644 vendor/github.com/google/uuid/LICENSE delete mode 100644 vendor/github.com/google/uuid/README.md delete mode 100644 vendor/github.com/google/uuid/dce.go delete mode 100644 vendor/github.com/google/uuid/doc.go delete mode 100644 vendor/github.com/google/uuid/go.mod delete mode 100644 vendor/github.com/google/uuid/hash.go delete mode 100644 vendor/github.com/google/uuid/marshal.go delete mode 100644 vendor/github.com/google/uuid/node.go delete mode 100644 vendor/github.com/google/uuid/node_js.go delete mode 100644 vendor/github.com/google/uuid/node_net.go delete mode 100644 vendor/github.com/google/uuid/sql.go delete mode 100644 vendor/github.com/google/uuid/time.go delete mode 100644 vendor/github.com/google/uuid/util.go delete mode 100644 vendor/github.com/google/uuid/uuid.go delete mode 100644 vendor/github.com/google/uuid/version1.go delete mode 100644 vendor/github.com/google/uuid/version4.go delete mode 100644 vendor/github.com/googleapis/gax-go/v2/LICENSE delete mode 100644 vendor/github.com/googleapis/gax-go/v2/call_option.go delete mode 100644 vendor/github.com/googleapis/gax-go/v2/gax.go delete mode 100644 vendor/github.com/googleapis/gax-go/v2/go.mod delete mode 100644 vendor/github.com/googleapis/gax-go/v2/go.sum delete mode 100644 vendor/github.com/googleapis/gax-go/v2/header.go delete mode 100644 vendor/github.com/googleapis/gax-go/v2/invoke.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/AUTHORS delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/LICENSE delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/README.md delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/api.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/bridge.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/constants.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/constants_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/constants_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/default.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/dirstream.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/files.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/files_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/files_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/inode.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/loopback.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/loopback_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/loopback_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/mem.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/mount.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fs/syscall_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/.gitignore delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/api.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/attr.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/attr_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/attr_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/bufferpool.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/constants.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/constants_freebsd.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/constants_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/context.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/defaultraw.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/direntry.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/misc.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/mount_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/mount_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/opcode.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/poll.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/poll_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/poll_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/print.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/print_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/print_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/read.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/request.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/request_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/request_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/server.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/server_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/server_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/splice_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/splice_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/typeprint.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/types.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/types_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/fuse/types_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/internal/access.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/splice/copy.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/splice/pair.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/splice/pair_darwin.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/splice/pair_linux.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/splice/pool.go delete mode 100644 vendor/github.com/hanwen/go-fuse/v2/splice/splice.go delete mode 100644 vendor/github.com/inconshreveable/mousetrap/LICENSE delete mode 100644 vendor/github.com/inconshreveable/mousetrap/README.md delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_others.go delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_windows.go delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go delete mode 100644 vendor/github.com/jlaffaye/ftp/.travis.yml delete mode 100644 vendor/github.com/jlaffaye/ftp/LICENSE delete mode 100644 vendor/github.com/jlaffaye/ftp/README.md delete mode 100644 vendor/github.com/jlaffaye/ftp/debug.go delete mode 100644 vendor/github.com/jlaffaye/ftp/ftp.go delete mode 100644 vendor/github.com/jlaffaye/ftp/go.mod delete mode 100644 vendor/github.com/jlaffaye/ftp/go.sum delete mode 100644 vendor/github.com/jlaffaye/ftp/parse.go delete mode 100644 vendor/github.com/jlaffaye/ftp/scanner.go delete mode 100644 vendor/github.com/jlaffaye/ftp/status.go delete mode 100644 vendor/github.com/jlaffaye/ftp/walker.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/.gitignore delete mode 100644 vendor/github.com/jmespath/go-jmespath/.travis.yml delete mode 100644 vendor/github.com/jmespath/go-jmespath/LICENSE delete mode 100644 vendor/github.com/jmespath/go-jmespath/Makefile delete mode 100644 vendor/github.com/jmespath/go-jmespath/README.md delete mode 100644 vendor/github.com/jmespath/go-jmespath/api.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/astnodetype_string.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/functions.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/go.mod delete mode 100644 vendor/github.com/jmespath/go-jmespath/go.sum delete mode 100644 vendor/github.com/jmespath/go-jmespath/interpreter.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/lexer.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/parser.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/toktype_string.go delete mode 100644 vendor/github.com/jmespath/go-jmespath/util.go delete mode 100644 vendor/github.com/json-iterator/go/.codecov.yml delete mode 100644 vendor/github.com/json-iterator/go/.gitignore delete mode 100644 vendor/github.com/json-iterator/go/.travis.yml delete mode 100644 vendor/github.com/json-iterator/go/Gopkg.lock delete mode 100644 vendor/github.com/json-iterator/go/Gopkg.toml delete mode 100644 vendor/github.com/json-iterator/go/LICENSE delete mode 100644 vendor/github.com/json-iterator/go/README.md delete mode 100644 vendor/github.com/json-iterator/go/adapter.go delete mode 100644 vendor/github.com/json-iterator/go/any.go delete mode 100644 vendor/github.com/json-iterator/go/any_array.go delete mode 100644 vendor/github.com/json-iterator/go/any_bool.go delete mode 100644 vendor/github.com/json-iterator/go/any_float.go delete mode 100644 vendor/github.com/json-iterator/go/any_int32.go delete mode 100644 vendor/github.com/json-iterator/go/any_int64.go delete mode 100644 vendor/github.com/json-iterator/go/any_invalid.go delete mode 100644 vendor/github.com/json-iterator/go/any_nil.go delete mode 100644 vendor/github.com/json-iterator/go/any_number.go delete mode 100644 vendor/github.com/json-iterator/go/any_object.go delete mode 100644 vendor/github.com/json-iterator/go/any_str.go delete mode 100644 vendor/github.com/json-iterator/go/any_uint32.go delete mode 100644 vendor/github.com/json-iterator/go/any_uint64.go delete mode 100644 vendor/github.com/json-iterator/go/build.sh delete mode 100644 vendor/github.com/json-iterator/go/config.go delete mode 100644 vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md delete mode 100644 vendor/github.com/json-iterator/go/go.mod delete mode 100644 vendor/github.com/json-iterator/go/go.sum delete mode 100644 vendor/github.com/json-iterator/go/iter.go delete mode 100644 vendor/github.com/json-iterator/go/iter_array.go delete mode 100644 vendor/github.com/json-iterator/go/iter_float.go delete mode 100644 vendor/github.com/json-iterator/go/iter_int.go delete mode 100644 vendor/github.com/json-iterator/go/iter_object.go delete mode 100644 vendor/github.com/json-iterator/go/iter_skip.go delete mode 100644 vendor/github.com/json-iterator/go/iter_skip_sloppy.go delete mode 100644 vendor/github.com/json-iterator/go/iter_skip_strict.go delete mode 100644 vendor/github.com/json-iterator/go/iter_str.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter.go delete mode 100644 vendor/github.com/json-iterator/go/pool.go delete mode 100644 vendor/github.com/json-iterator/go/reflect.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_array.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_dynamic.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_extension.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_json_number.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_json_raw_message.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_map.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_marshaler.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_native.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_optional.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_slice.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_struct_decoder.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_struct_encoder.go delete mode 100644 vendor/github.com/json-iterator/go/stream.go delete mode 100644 vendor/github.com/json-iterator/go/stream_float.go delete mode 100644 vendor/github.com/json-iterator/go/stream_int.go delete mode 100644 vendor/github.com/json-iterator/go/stream_str.go delete mode 100644 vendor/github.com/json-iterator/go/test.sh delete mode 100644 vendor/github.com/jzelinskie/whirlpool/.travis.yml delete mode 100644 vendor/github.com/jzelinskie/whirlpool/LICENSE delete mode 100644 vendor/github.com/jzelinskie/whirlpool/README.md delete mode 100644 vendor/github.com/jzelinskie/whirlpool/const.go delete mode 100644 vendor/github.com/jzelinskie/whirlpool/whirlpool.go delete mode 100644 vendor/github.com/kardianos/osext/LICENSE delete mode 100644 vendor/github.com/kardianos/osext/README.md delete mode 100644 vendor/github.com/kardianos/osext/go.mod delete mode 100644 vendor/github.com/kardianos/osext/osext.go delete mode 100644 vendor/github.com/kardianos/osext/osext_go18.go delete mode 100644 vendor/github.com/kardianos/osext/osext_plan9.go delete mode 100644 vendor/github.com/kardianos/osext/osext_procfs.go delete mode 100644 vendor/github.com/kardianos/osext/osext_sysctl.go delete mode 100644 vendor/github.com/kardianos/osext/osext_windows.go delete mode 100644 vendor/github.com/klauspost/cpuid/.gitignore delete mode 100644 vendor/github.com/klauspost/cpuid/.travis.yml delete mode 100644 vendor/github.com/klauspost/cpuid/CONTRIBUTING.txt delete mode 100644 vendor/github.com/klauspost/cpuid/LICENSE delete mode 100644 vendor/github.com/klauspost/cpuid/README.md delete mode 100644 vendor/github.com/klauspost/cpuid/cpuid.go delete mode 100644 vendor/github.com/klauspost/cpuid/cpuid_386.s delete mode 100644 vendor/github.com/klauspost/cpuid/cpuid_amd64.s delete mode 100644 vendor/github.com/klauspost/cpuid/cpuid_arm64.s delete mode 100644 vendor/github.com/klauspost/cpuid/detect_arm64.go delete mode 100644 vendor/github.com/klauspost/cpuid/detect_intel.go delete mode 100644 vendor/github.com/klauspost/cpuid/detect_ref.go delete mode 100644 vendor/github.com/klauspost/cpuid/go.mod delete mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE delete mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/README.md delete mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod delete mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go delete mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go delete mode 100644 vendor/github.com/koofr/go-httpclient/.gitignore delete mode 100644 vendor/github.com/koofr/go-httpclient/LICENSE delete mode 100644 vendor/github.com/koofr/go-httpclient/README.md delete mode 100644 vendor/github.com/koofr/go-httpclient/errors.go delete mode 100644 vendor/github.com/koofr/go-httpclient/go.mod delete mode 100644 vendor/github.com/koofr/go-httpclient/go.sum delete mode 100644 vendor/github.com/koofr/go-httpclient/httpclient.go delete mode 100644 vendor/github.com/koofr/go-httpclient/requestdata.go delete mode 100644 vendor/github.com/koofr/go-httpclient/requestdata_upload.go delete mode 100644 vendor/github.com/koofr/go-httpclient/transport.go delete mode 100644 vendor/github.com/koofr/go-httpclient/utils.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/.gitignore delete mode 100644 vendor/github.com/koofr/go-koofrclient/LICENSE delete mode 100644 vendor/github.com/koofr/go-koofrclient/README.md delete mode 100644 vendor/github.com/koofr/go-koofrclient/api_scheme.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/client.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/client_device.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/client_files.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/client_mount.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/client_shared.go delete mode 100644 vendor/github.com/koofr/go-koofrclient/client_user.go delete mode 100644 vendor/github.com/kr/fs/LICENSE delete mode 100644 vendor/github.com/kr/fs/Readme delete mode 100644 vendor/github.com/kr/fs/filesystem.go delete mode 100644 vendor/github.com/kr/fs/go.mod delete mode 100644 vendor/github.com/kr/fs/walk.go delete mode 100644 vendor/github.com/mattn/go-colorable/.travis.yml delete mode 100644 vendor/github.com/mattn/go-colorable/LICENSE delete mode 100644 vendor/github.com/mattn/go-colorable/README.md delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_appengine.go delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_others.go delete mode 100644 vendor/github.com/mattn/go-colorable/colorable_windows.go delete mode 100644 vendor/github.com/mattn/go-colorable/go.mod delete mode 100644 vendor/github.com/mattn/go-colorable/go.sum delete mode 100644 vendor/github.com/mattn/go-colorable/go.test.sh delete mode 100644 vendor/github.com/mattn/go-colorable/noncolorable.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/.gitignore delete mode 100644 vendor/github.com/mattn/go-ieproxy/LICENSE delete mode 100644 vendor/github.com/mattn/go-ieproxy/README.md delete mode 100644 vendor/github.com/mattn/go-ieproxy/go.mod delete mode 100644 vendor/github.com/mattn/go-ieproxy/go.sum delete mode 100644 vendor/github.com/mattn/go-ieproxy/ieproxy.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/ieproxy_unix.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/ieproxy_windows.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/kernel32_data_windows.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/pac_unix.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/pac_windows.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/proxy_middleman.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/proxy_middleman_unix.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/proxy_middleman_windows.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/utils.go delete mode 100644 vendor/github.com/mattn/go-ieproxy/winhttp_data_windows.go delete mode 100644 vendor/github.com/mattn/go-isatty/.travis.yml delete mode 100644 vendor/github.com/mattn/go-isatty/LICENSE delete mode 100644 vendor/github.com/mattn/go-isatty/README.md delete mode 100644 vendor/github.com/mattn/go-isatty/doc.go delete mode 100644 vendor/github.com/mattn/go-isatty/go.mod delete mode 100644 vendor/github.com/mattn/go-isatty/go.sum delete mode 100644 vendor/github.com/mattn/go-isatty/go.test.sh delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_bsd.go delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_others.go delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_plan9.go delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_solaris.go delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_tcgets.go delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_windows.go delete mode 100644 vendor/github.com/mattn/go-isatty/renovate.json delete mode 100644 vendor/github.com/mattn/go-runewidth/.travis.yml delete mode 100644 vendor/github.com/mattn/go-runewidth/LICENSE delete mode 100644 vendor/github.com/mattn/go-runewidth/README.md delete mode 100644 vendor/github.com/mattn/go-runewidth/go.mod delete mode 100644 vendor/github.com/mattn/go-runewidth/go.test.sh delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth.go delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_appengine.go delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_js.go delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_posix.go delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_table.go delete mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_windows.go delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go delete mode 100644 vendor/github.com/minio/md5-simd/LICENSE delete mode 100644 vendor/github.com/minio/md5-simd/README.md delete mode 100644 vendor/github.com/minio/md5-simd/block-generic.go delete mode 100644 vendor/github.com/minio/md5-simd/block16_amd64.s delete mode 100644 vendor/github.com/minio/md5-simd/block8_amd64.s delete mode 100644 vendor/github.com/minio/md5-simd/block_amd64.go delete mode 100644 vendor/github.com/minio/md5-simd/go.mod delete mode 100644 vendor/github.com/minio/md5-simd/go.sum delete mode 100644 vendor/github.com/minio/md5-simd/md5-digest_amd64.go delete mode 100644 vendor/github.com/minio/md5-simd/md5-server_amd64.go delete mode 100644 vendor/github.com/minio/md5-simd/md5-server_fallback.go delete mode 100644 vendor/github.com/minio/md5-simd/md5-util_amd64.go delete mode 100644 vendor/github.com/minio/md5-simd/md5.go delete mode 100644 vendor/github.com/minio/minio-go/v6/.gitignore delete mode 100644 vendor/github.com/minio/minio-go/v6/.golangci.yml delete mode 100644 vendor/github.com/minio/minio-go/v6/CONTRIBUTING.md delete mode 100644 vendor/github.com/minio/minio-go/v6/LICENSE delete mode 100644 vendor/github.com/minio/minio-go/v6/MAINTAINERS.md delete mode 100644 vendor/github.com/minio/minio-go/v6/Makefile delete mode 100644 vendor/github.com/minio/minio-go/v6/NOTICE delete mode 100644 vendor/github.com/minio/minio-go/v6/README.md delete mode 100644 vendor/github.com/minio/minio-go/v6/README_zh_CN.md delete mode 100644 vendor/github.com/minio/minio-go/v6/api-bucket-tagging.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-compose-object.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-datatypes.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-error-response.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-bucket-encryption.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-bucket-versioning.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-lifecycle.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-object-acl-context.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-object-acl.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-object-context.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-object-file.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-object.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-options.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-get-policy.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-list.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-notification.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-object-legal-hold.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-object-lock.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-object-retention.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-object-tagging.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-presigned.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-bucket.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-common.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-context.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-copy.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-file-context.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-file.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-multipart.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object-streaming.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-put-object.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-remove.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-s3-datatypes.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-select.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api-stat.go delete mode 100644 vendor/github.com/minio/minio-go/v6/api.go delete mode 100644 vendor/github.com/minio/minio-go/v6/bucket-cache.go delete mode 100644 vendor/github.com/minio/minio-go/v6/bucket-notification.go delete mode 100644 vendor/github.com/minio/minio-go/v6/constants.go delete mode 100644 vendor/github.com/minio/minio-go/v6/core.go delete mode 100644 vendor/github.com/minio/minio-go/v6/go.mod delete mode 100644 vendor/github.com/minio/minio-go/v6/go.sum delete mode 100644 vendor/github.com/minio/minio-go/v6/hook-reader.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/assume_role.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/chain.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/config.json.sample delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/credentials.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/credentials.sample delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/doc.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/env_aws.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/env_minio.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/file_aws_credentials.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/file_minio_client.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/iam_aws.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/signature-type.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/static.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/sts_client_grants.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/sts_ldap_identity.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/credentials/sts_web_identity.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/encrypt/server-side.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/s3utils/utils.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/set/stringset.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/signer/request-signature-streaming.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/signer/request-signature-v2.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/signer/request-signature-v4.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/signer/utils.go delete mode 100644 vendor/github.com/minio/minio-go/v6/pkg/tags/tags.go delete mode 100644 vendor/github.com/minio/minio-go/v6/post-policy.go delete mode 100644 vendor/github.com/minio/minio-go/v6/retry-continous.go delete mode 100644 vendor/github.com/minio/minio-go/v6/retry.go delete mode 100644 vendor/github.com/minio/minio-go/v6/s3-endpoints.go delete mode 100644 vendor/github.com/minio/minio-go/v6/s3-error.go delete mode 100644 vendor/github.com/minio/minio-go/v6/staticcheck.conf delete mode 100644 vendor/github.com/minio/minio-go/v6/transport.go delete mode 100644 vendor/github.com/minio/minio-go/v6/utils.go delete mode 100644 vendor/github.com/minio/sha256-simd/.gitignore delete mode 100644 vendor/github.com/minio/sha256-simd/.travis.yml delete mode 100644 vendor/github.com/minio/sha256-simd/LICENSE delete mode 100644 vendor/github.com/minio/sha256-simd/README.md delete mode 100644 vendor/github.com/minio/sha256-simd/appveyor.yml delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid.go delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_386.go delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_386.s delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_amd64.s delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_arm.go delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_linux_arm64.go delete mode 100644 vendor/github.com/minio/sha256-simd/cpuid_other.go delete mode 100644 vendor/github.com/minio/sha256-simd/go.mod delete mode 100644 vendor/github.com/minio/sha256-simd/sha256.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx2_amd64.s delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.asm delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx512_amd64.s delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockAvx_amd64.s delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockSha_amd64.s delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256blockSsse_amd64.s delete mode 100644 vendor/github.com/minio/sha256-simd/sha256block_amd64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256block_arm64.go delete mode 100644 vendor/github.com/minio/sha256-simd/sha256block_arm64.s delete mode 100644 vendor/github.com/minio/sha256-simd/sha256block_other.go delete mode 100644 vendor/github.com/minio/sha256-simd/test-architectures.sh delete mode 100644 vendor/github.com/mitchellh/go-homedir/LICENSE delete mode 100644 vendor/github.com/mitchellh/go-homedir/README.md delete mode 100644 vendor/github.com/mitchellh/go-homedir/go.mod delete mode 100644 vendor/github.com/mitchellh/go-homedir/homedir.go delete mode 100644 vendor/github.com/modern-go/concurrent/.gitignore delete mode 100644 vendor/github.com/modern-go/concurrent/.travis.yml delete mode 100644 vendor/github.com/modern-go/concurrent/LICENSE delete mode 100644 vendor/github.com/modern-go/concurrent/README.md delete mode 100644 vendor/github.com/modern-go/concurrent/executor.go delete mode 100644 vendor/github.com/modern-go/concurrent/go_above_19.go delete mode 100644 vendor/github.com/modern-go/concurrent/go_below_19.go delete mode 100644 vendor/github.com/modern-go/concurrent/log.go delete mode 100644 vendor/github.com/modern-go/concurrent/test.sh delete mode 100644 vendor/github.com/modern-go/concurrent/unbounded_executor.go delete mode 100644 vendor/github.com/modern-go/reflect2/.gitignore delete mode 100644 vendor/github.com/modern-go/reflect2/.travis.yml delete mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.lock delete mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.toml delete mode 100644 vendor/github.com/modern-go/reflect2/LICENSE delete mode 100644 vendor/github.com/modern-go/reflect2/README.md delete mode 100644 vendor/github.com/modern-go/reflect2/go_above_17.go delete mode 100644 vendor/github.com/modern-go/reflect2/go_above_19.go delete mode 100644 vendor/github.com/modern-go/reflect2/go_below_17.go delete mode 100644 vendor/github.com/modern-go/reflect2/go_below_19.go delete mode 100644 vendor/github.com/modern-go/reflect2/reflect2.go delete mode 100644 vendor/github.com/modern-go/reflect2/reflect2_amd64.s delete mode 100644 vendor/github.com/modern-go/reflect2/reflect2_kind.go delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_386.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm64.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mips64x.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mipsx.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_s390x.s delete mode 100644 vendor/github.com/modern-go/reflect2/safe_field.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_map.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_slice.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_struct.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_type.go delete mode 100644 vendor/github.com/modern-go/reflect2/test.sh delete mode 100644 vendor/github.com/modern-go/reflect2/type_map.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_array.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_eface.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_field.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_iface.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_link.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_map.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_ptr.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_slice.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_struct.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_type.go delete mode 100644 vendor/github.com/ncw/go-acd/.gitignore delete mode 100644 vendor/github.com/ncw/go-acd/.travis.yml delete mode 100644 vendor/github.com/ncw/go-acd/Godeps delete mode 100644 vendor/github.com/ncw/go-acd/LICENSE delete mode 100644 vendor/github.com/ncw/go-acd/Makefile delete mode 100644 vendor/github.com/ncw/go-acd/README.md delete mode 100644 vendor/github.com/ncw/go-acd/account.go delete mode 100644 vendor/github.com/ncw/go-acd/changes.go delete mode 100644 vendor/github.com/ncw/go-acd/client.go delete mode 100644 vendor/github.com/ncw/go-acd/nodes.go delete mode 100644 vendor/github.com/ncw/swift/.gitignore delete mode 100644 vendor/github.com/ncw/swift/.travis.yml delete mode 100644 vendor/github.com/ncw/swift/COPYING delete mode 100644 vendor/github.com/ncw/swift/README.md delete mode 100644 vendor/github.com/ncw/swift/auth.go delete mode 100644 vendor/github.com/ncw/swift/auth_v3.go delete mode 100644 vendor/github.com/ncw/swift/compatibility_1_0.go delete mode 100644 vendor/github.com/ncw/swift/compatibility_1_1.go delete mode 100644 vendor/github.com/ncw/swift/compatibility_1_6.go delete mode 100644 vendor/github.com/ncw/swift/compatibility_not_1_6.go delete mode 100644 vendor/github.com/ncw/swift/dlo.go delete mode 100644 vendor/github.com/ncw/swift/doc.go delete mode 100644 vendor/github.com/ncw/swift/go.mod delete mode 100644 vendor/github.com/ncw/swift/largeobjects.go delete mode 100644 vendor/github.com/ncw/swift/meta.go delete mode 100644 vendor/github.com/ncw/swift/notes.txt delete mode 100644 vendor/github.com/ncw/swift/slo.go delete mode 100644 vendor/github.com/ncw/swift/swift.go delete mode 100644 vendor/github.com/ncw/swift/timeout_reader.go delete mode 100644 vendor/github.com/ncw/swift/travis_realserver.sh delete mode 100644 vendor/github.com/ncw/swift/watchdog_reader.go delete mode 100644 vendor/github.com/nsf/termbox-go/AUTHORS delete mode 100644 vendor/github.com/nsf/termbox-go/LICENSE delete mode 100644 vendor/github.com/nsf/termbox-go/README.md delete mode 100644 vendor/github.com/nsf/termbox-go/api.go delete mode 100644 vendor/github.com/nsf/termbox-go/api_common.go delete mode 100644 vendor/github.com/nsf/termbox-go/api_windows.go delete mode 100644 vendor/github.com/nsf/termbox-go/collect_terminfo.py delete mode 100644 vendor/github.com/nsf/termbox-go/escwait.go delete mode 100644 vendor/github.com/nsf/termbox-go/escwait_darwin.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_darwin.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_darwin_amd64.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_dragonfly.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_freebsd.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_linux.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_netbsd.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_openbsd.go delete mode 100644 vendor/github.com/nsf/termbox-go/syscalls_windows.go delete mode 100644 vendor/github.com/nsf/termbox-go/termbox.go delete mode 100644 vendor/github.com/nsf/termbox-go/termbox_common.go delete mode 100644 vendor/github.com/nsf/termbox-go/termbox_windows.go delete mode 100644 vendor/github.com/nsf/termbox-go/terminfo.go delete mode 100644 vendor/github.com/nsf/termbox-go/terminfo_builtin.go delete mode 100644 vendor/github.com/okzk/sdnotify/LICENSE delete mode 100644 vendor/github.com/okzk/sdnotify/README.md delete mode 100644 vendor/github.com/okzk/sdnotify/notify.go delete mode 100644 vendor/github.com/okzk/sdnotify/notify_linux.go delete mode 100644 vendor/github.com/okzk/sdnotify/util.go delete mode 100644 vendor/github.com/patrickmn/go-cache/CONTRIBUTORS delete mode 100644 vendor/github.com/patrickmn/go-cache/LICENSE delete mode 100644 vendor/github.com/patrickmn/go-cache/README.md delete mode 100644 vendor/github.com/patrickmn/go-cache/cache.go delete mode 100644 vendor/github.com/patrickmn/go-cache/sharded.go delete mode 100644 vendor/github.com/pengsrc/go-shared/LICENSE delete mode 100644 vendor/github.com/pengsrc/go-shared/buffer/bytes.go delete mode 100644 vendor/github.com/pengsrc/go-shared/buffer/bytes_pool.go delete mode 100644 vendor/github.com/pengsrc/go-shared/check/dir.go delete mode 100644 vendor/github.com/pengsrc/go-shared/check/error.go delete mode 100644 vendor/github.com/pengsrc/go-shared/check/host.go delete mode 100644 vendor/github.com/pengsrc/go-shared/check/slice.go delete mode 100644 vendor/github.com/pengsrc/go-shared/convert/string.go delete mode 100644 vendor/github.com/pengsrc/go-shared/convert/time.go delete mode 100644 vendor/github.com/pengsrc/go-shared/convert/types.go delete mode 100644 vendor/github.com/pengsrc/go-shared/log/context_free_logger.go delete mode 100644 vendor/github.com/pengsrc/go-shared/log/event.go delete mode 100644 vendor/github.com/pengsrc/go-shared/log/exported.go delete mode 100644 vendor/github.com/pengsrc/go-shared/log/level.go delete mode 100644 vendor/github.com/pengsrc/go-shared/log/logger.go delete mode 100644 vendor/github.com/pengsrc/go-shared/log/writer.go delete mode 100644 vendor/github.com/pengsrc/go-shared/reopen/reopen.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/pkg/sftp/.gitignore delete mode 100644 vendor/github.com/pkg/sftp/.travis.yml delete mode 100644 vendor/github.com/pkg/sftp/CONTRIBUTORS delete mode 100644 vendor/github.com/pkg/sftp/LICENSE delete mode 100644 vendor/github.com/pkg/sftp/Makefile delete mode 100644 vendor/github.com/pkg/sftp/README.md delete mode 100644 vendor/github.com/pkg/sftp/attrs.go delete mode 100644 vendor/github.com/pkg/sftp/attrs_stubs.go delete mode 100644 vendor/github.com/pkg/sftp/attrs_unix.go delete mode 100644 vendor/github.com/pkg/sftp/client.go delete mode 100644 vendor/github.com/pkg/sftp/conn.go delete mode 100644 vendor/github.com/pkg/sftp/debug.go delete mode 100644 vendor/github.com/pkg/sftp/go.mod delete mode 100644 vendor/github.com/pkg/sftp/go.sum delete mode 100644 vendor/github.com/pkg/sftp/match.go delete mode 100644 vendor/github.com/pkg/sftp/packet-manager.go delete mode 100644 vendor/github.com/pkg/sftp/packet-typing.go delete mode 100644 vendor/github.com/pkg/sftp/packet.go delete mode 100644 vendor/github.com/pkg/sftp/release.go delete mode 100644 vendor/github.com/pkg/sftp/request-attrs.go delete mode 100644 vendor/github.com/pkg/sftp/request-errors.go delete mode 100644 vendor/github.com/pkg/sftp/request-example.go delete mode 100644 vendor/github.com/pkg/sftp/request-interfaces.go delete mode 100644 vendor/github.com/pkg/sftp/request-readme.md delete mode 100644 vendor/github.com/pkg/sftp/request-server.go delete mode 100644 vendor/github.com/pkg/sftp/request-unix.go delete mode 100644 vendor/github.com/pkg/sftp/request.go delete mode 100644 vendor/github.com/pkg/sftp/request_windows.go delete mode 100644 vendor/github.com/pkg/sftp/server.go delete mode 100644 vendor/github.com/pkg/sftp/server_statvfs_darwin.go delete mode 100644 vendor/github.com/pkg/sftp/server_statvfs_impl.go delete mode 100644 vendor/github.com/pkg/sftp/server_statvfs_linux.go delete mode 100644 vendor/github.com/pkg/sftp/server_statvfs_stubs.go delete mode 100644 vendor/github.com/pkg/sftp/server_stubs.go delete mode 100644 vendor/github.com/pkg/sftp/server_unix.go delete mode 100644 vendor/github.com/pkg/sftp/sftp.go delete mode 100644 vendor/github.com/pkg/sftp/syscall_fixed.go delete mode 100644 vendor/github.com/pkg/sftp/syscall_good.go delete mode 100644 vendor/github.com/pmezard/go-difflib/LICENSE delete mode 100644 vendor/github.com/pmezard/go-difflib/difflib/difflib.go delete mode 100644 vendor/github.com/prometheus/client_golang/LICENSE delete mode 100644 vendor/github.com/prometheus/client_golang/NOTICE delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/.gitignore delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/README.md delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/build_info.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/collector.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/counter.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/desc.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/doc.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/fnv.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/gauge.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/histogram.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/labels.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/metric.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/observer.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/registry.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/summary.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/timer.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/untyped.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/value.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/vec.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/wrap.go delete mode 100644 vendor/github.com/prometheus/client_model/LICENSE delete mode 100644 vendor/github.com/prometheus/client_model/NOTICE delete mode 100644 vendor/github.com/prometheus/client_model/go/metrics.pb.go delete mode 100644 vendor/github.com/prometheus/common/LICENSE delete mode 100644 vendor/github.com/prometheus/common/NOTICE delete mode 100644 vendor/github.com/prometheus/common/expfmt/decode.go delete mode 100644 vendor/github.com/prometheus/common/expfmt/encode.go delete mode 100644 vendor/github.com/prometheus/common/expfmt/expfmt.go delete mode 100644 vendor/github.com/prometheus/common/expfmt/fuzz.go delete mode 100644 vendor/github.com/prometheus/common/expfmt/openmetrics_create.go delete mode 100644 vendor/github.com/prometheus/common/expfmt/text_create.go delete mode 100644 vendor/github.com/prometheus/common/expfmt/text_parse.go delete mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt delete mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go delete mode 100644 vendor/github.com/prometheus/common/model/alert.go delete mode 100644 vendor/github.com/prometheus/common/model/fingerprinting.go delete mode 100644 vendor/github.com/prometheus/common/model/fnv.go delete mode 100644 vendor/github.com/prometheus/common/model/labels.go delete mode 100644 vendor/github.com/prometheus/common/model/labelset.go delete mode 100644 vendor/github.com/prometheus/common/model/metric.go delete mode 100644 vendor/github.com/prometheus/common/model/model.go delete mode 100644 vendor/github.com/prometheus/common/model/signature.go delete mode 100644 vendor/github.com/prometheus/common/model/silence.go delete mode 100644 vendor/github.com/prometheus/common/model/time.go delete mode 100644 vendor/github.com/prometheus/common/model/value.go delete mode 100644 vendor/github.com/prometheus/procfs/.gitignore delete mode 100644 vendor/github.com/prometheus/procfs/.golangci.yml delete mode 100644 vendor/github.com/prometheus/procfs/CONTRIBUTING.md delete mode 100644 vendor/github.com/prometheus/procfs/LICENSE delete mode 100644 vendor/github.com/prometheus/procfs/MAINTAINERS.md delete mode 100644 vendor/github.com/prometheus/procfs/Makefile delete mode 100644 vendor/github.com/prometheus/procfs/Makefile.common delete mode 100644 vendor/github.com/prometheus/procfs/NOTICE delete mode 100644 vendor/github.com/prometheus/procfs/README.md delete mode 100644 vendor/github.com/prometheus/procfs/arp.go delete mode 100644 vendor/github.com/prometheus/procfs/buddyinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_arm.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_arm64.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_default.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mips.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mips64.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mips64le.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mipsle.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_ppc64.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_ppc64le.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_s390x.go delete mode 100644 vendor/github.com/prometheus/procfs/crypto.go delete mode 100644 vendor/github.com/prometheus/procfs/doc.go delete mode 100644 vendor/github.com/prometheus/procfs/fixtures.ttar delete mode 100644 vendor/github.com/prometheus/procfs/fs.go delete mode 100644 vendor/github.com/prometheus/procfs/fscache.go delete mode 100644 vendor/github.com/prometheus/procfs/go.mod delete mode 100644 vendor/github.com/prometheus/procfs/go.sum delete mode 100644 vendor/github.com/prometheus/procfs/internal/fs/fs.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/parse.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/readfile.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/valueparser.go delete mode 100644 vendor/github.com/prometheus/procfs/ipvs.go delete mode 100644 vendor/github.com/prometheus/procfs/kernel_random.go delete mode 100644 vendor/github.com/prometheus/procfs/loadavg.go delete mode 100644 vendor/github.com/prometheus/procfs/mdstat.go delete mode 100644 vendor/github.com/prometheus/procfs/meminfo.go delete mode 100644 vendor/github.com/prometheus/procfs/mountinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/mountstats.go delete mode 100644 vendor/github.com/prometheus/procfs/net_conntrackstat.go delete mode 100644 vendor/github.com/prometheus/procfs/net_dev.go delete mode 100644 vendor/github.com/prometheus/procfs/net_sockstat.go delete mode 100644 vendor/github.com/prometheus/procfs/net_softnet.go delete mode 100644 vendor/github.com/prometheus/procfs/net_udp.go delete mode 100644 vendor/github.com/prometheus/procfs/net_unix.go delete mode 100644 vendor/github.com/prometheus/procfs/proc.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_cgroup.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_environ.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_fdinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_io.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_limits.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_maps.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_ns.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_psi.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_smaps.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_stat.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_status.go delete mode 100644 vendor/github.com/prometheus/procfs/schedstat.go delete mode 100644 vendor/github.com/prometheus/procfs/stat.go delete mode 100644 vendor/github.com/prometheus/procfs/swaps.go delete mode 100644 vendor/github.com/prometheus/procfs/ttar delete mode 100644 vendor/github.com/prometheus/procfs/vm.go delete mode 100644 vendor/github.com/prometheus/procfs/xfrm.go delete mode 100644 vendor/github.com/prometheus/procfs/zoneinfo.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/LICENSE delete mode 100644 vendor/github.com/putdotio/go-putio/putio/account.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/client.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/doc.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/error.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/events.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/files.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/friends.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/go.mod delete mode 100644 vendor/github.com/putdotio/go-putio/putio/time.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/transfers.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/types.go delete mode 100644 vendor/github.com/putdotio/go-putio/putio/zips.go delete mode 100644 vendor/github.com/rfjakob/eme/.travis.yml delete mode 100644 vendor/github.com/rfjakob/eme/LICENSE delete mode 100644 vendor/github.com/rfjakob/eme/README.md delete mode 100644 vendor/github.com/rfjakob/eme/benchmark.bash delete mode 100644 vendor/github.com/rfjakob/eme/eme.go delete mode 100644 vendor/github.com/rfjakob/eme/paper-eme-fig2.png delete mode 100644 vendor/github.com/rfjakob/eme/test.bash delete mode 100644 vendor/github.com/russross/blackfriday/v2/.gitignore delete mode 100644 vendor/github.com/russross/blackfriday/v2/.travis.yml delete mode 100644 vendor/github.com/russross/blackfriday/v2/LICENSE.txt delete mode 100644 vendor/github.com/russross/blackfriday/v2/README.md delete mode 100644 vendor/github.com/russross/blackfriday/v2/block.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/doc.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/esc.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/go.mod delete mode 100644 vendor/github.com/russross/blackfriday/v2/html.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/inline.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/markdown.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/node.go delete mode 100644 vendor/github.com/russross/blackfriday/v2/smartypants.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/.travis.yml delete mode 100644 vendor/github.com/sevlyar/go-daemon/LICENSE delete mode 100644 vendor/github.com/sevlyar/go-daemon/README.md delete mode 100644 vendor/github.com/sevlyar/go-daemon/command.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/daemon.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/daemon_stub.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/daemon_unix.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/lock_file.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/lock_file_solaris.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/lock_file_stub.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/lock_file_unix.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/os_executable.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/os_executable_pre18.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/signal.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/syscall_dup.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/syscall_dup_arm64.go delete mode 100644 vendor/github.com/sevlyar/go-daemon/syscall_dup_pre17.go delete mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/.travis.yml delete mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE delete mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/README.md delete mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/go.mod delete mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/main.go delete mode 100644 vendor/github.com/sirupsen/logrus/.gitignore delete mode 100644 vendor/github.com/sirupsen/logrus/.golangci.yml delete mode 100644 vendor/github.com/sirupsen/logrus/.travis.yml delete mode 100644 vendor/github.com/sirupsen/logrus/CHANGELOG.md delete mode 100644 vendor/github.com/sirupsen/logrus/LICENSE delete mode 100644 vendor/github.com/sirupsen/logrus/README.md delete mode 100644 vendor/github.com/sirupsen/logrus/alt_exit.go delete mode 100644 vendor/github.com/sirupsen/logrus/appveyor.yml delete mode 100644 vendor/github.com/sirupsen/logrus/doc.go delete mode 100644 vendor/github.com/sirupsen/logrus/entry.go delete mode 100644 vendor/github.com/sirupsen/logrus/exported.go delete mode 100644 vendor/github.com/sirupsen/logrus/formatter.go delete mode 100644 vendor/github.com/sirupsen/logrus/go.mod delete mode 100644 vendor/github.com/sirupsen/logrus/go.sum delete mode 100644 vendor/github.com/sirupsen/logrus/hooks.go delete mode 100644 vendor/github.com/sirupsen/logrus/json_formatter.go delete mode 100644 vendor/github.com/sirupsen/logrus/logger.go delete mode 100644 vendor/github.com/sirupsen/logrus/logrus.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_appengine.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_bsd.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_js.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_solaris.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_unix.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_windows.go delete mode 100644 vendor/github.com/sirupsen/logrus/text_formatter.go delete mode 100644 vendor/github.com/sirupsen/logrus/writer.go delete mode 100644 vendor/github.com/skratchdot/open-golang/LICENSE delete mode 100644 vendor/github.com/skratchdot/open-golang/open/exec.go delete mode 100644 vendor/github.com/skratchdot/open-golang/open/exec_darwin.go delete mode 100644 vendor/github.com/skratchdot/open-golang/open/exec_windows.go delete mode 100644 vendor/github.com/skratchdot/open-golang/open/open.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/AUTHORS delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/LICENSE delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/README.md delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/callers.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/cas_safe.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/cas_unsafe.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/counter.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/ctx.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/dist.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/distgen.go.m4 delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/doc.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/durdist.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/error_names.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/error_names_ae.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/error_names_syscall.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/floatdist.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/func.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/funcset.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/funcstats.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/go.mod delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/go.sum delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/id.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/intdist.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/meter.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/monotime/monotime.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/monotime/monotime_fallback.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/monotime/monotime_windows.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/registry.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/rng.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/scope.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/span.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/spanbag.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/spinlock.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/stats.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/struct.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/tags.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/task.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/timer.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/trace.go delete mode 100644 vendor/github.com/spacemonkeygo/monkit/v3/val.go delete mode 100644 vendor/github.com/spf13/cobra/.gitignore delete mode 100644 vendor/github.com/spf13/cobra/.mailmap delete mode 100644 vendor/github.com/spf13/cobra/.travis.yml delete mode 100644 vendor/github.com/spf13/cobra/LICENSE.txt delete mode 100644 vendor/github.com/spf13/cobra/Makefile delete mode 100644 vendor/github.com/spf13/cobra/README.md delete mode 100644 vendor/github.com/spf13/cobra/args.go delete mode 100644 vendor/github.com/spf13/cobra/bash_completions.go delete mode 100644 vendor/github.com/spf13/cobra/bash_completions.md delete mode 100644 vendor/github.com/spf13/cobra/cobra.go delete mode 100644 vendor/github.com/spf13/cobra/command.go delete mode 100644 vendor/github.com/spf13/cobra/command_notwin.go delete mode 100644 vendor/github.com/spf13/cobra/command_win.go delete mode 100644 vendor/github.com/spf13/cobra/custom_completions.go delete mode 100644 vendor/github.com/spf13/cobra/doc/man_docs.go delete mode 100644 vendor/github.com/spf13/cobra/doc/man_docs.md delete mode 100644 vendor/github.com/spf13/cobra/doc/md_docs.go delete mode 100644 vendor/github.com/spf13/cobra/doc/md_docs.md delete mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.go delete mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.md delete mode 100644 vendor/github.com/spf13/cobra/doc/util.go delete mode 100644 vendor/github.com/spf13/cobra/doc/yaml_docs.go delete mode 100644 vendor/github.com/spf13/cobra/doc/yaml_docs.md delete mode 100644 vendor/github.com/spf13/cobra/fish_completions.go delete mode 100644 vendor/github.com/spf13/cobra/fish_completions.md delete mode 100644 vendor/github.com/spf13/cobra/go.mod delete mode 100644 vendor/github.com/spf13/cobra/go.sum delete mode 100644 vendor/github.com/spf13/cobra/powershell_completions.go delete mode 100644 vendor/github.com/spf13/cobra/powershell_completions.md delete mode 100644 vendor/github.com/spf13/cobra/shell_completions.go delete mode 100644 vendor/github.com/spf13/cobra/zsh_completions.go delete mode 100644 vendor/github.com/spf13/cobra/zsh_completions.md delete mode 100644 vendor/github.com/spf13/pflag/.gitignore delete mode 100644 vendor/github.com/spf13/pflag/.travis.yml delete mode 100644 vendor/github.com/spf13/pflag/LICENSE delete mode 100644 vendor/github.com/spf13/pflag/README.md delete mode 100644 vendor/github.com/spf13/pflag/bool.go delete mode 100644 vendor/github.com/spf13/pflag/bool_slice.go delete mode 100644 vendor/github.com/spf13/pflag/bytes.go delete mode 100644 vendor/github.com/spf13/pflag/count.go delete mode 100644 vendor/github.com/spf13/pflag/duration.go delete mode 100644 vendor/github.com/spf13/pflag/duration_slice.go delete mode 100644 vendor/github.com/spf13/pflag/flag.go delete mode 100644 vendor/github.com/spf13/pflag/float32.go delete mode 100644 vendor/github.com/spf13/pflag/float32_slice.go delete mode 100644 vendor/github.com/spf13/pflag/float64.go delete mode 100644 vendor/github.com/spf13/pflag/float64_slice.go delete mode 100644 vendor/github.com/spf13/pflag/go.mod delete mode 100644 vendor/github.com/spf13/pflag/go.sum delete mode 100644 vendor/github.com/spf13/pflag/golangflag.go delete mode 100644 vendor/github.com/spf13/pflag/int.go delete mode 100644 vendor/github.com/spf13/pflag/int16.go delete mode 100644 vendor/github.com/spf13/pflag/int32.go delete mode 100644 vendor/github.com/spf13/pflag/int32_slice.go delete mode 100644 vendor/github.com/spf13/pflag/int64.go delete mode 100644 vendor/github.com/spf13/pflag/int64_slice.go delete mode 100644 vendor/github.com/spf13/pflag/int8.go delete mode 100644 vendor/github.com/spf13/pflag/int_slice.go delete mode 100644 vendor/github.com/spf13/pflag/ip.go delete mode 100644 vendor/github.com/spf13/pflag/ip_slice.go delete mode 100644 vendor/github.com/spf13/pflag/ipmask.go delete mode 100644 vendor/github.com/spf13/pflag/ipnet.go delete mode 100644 vendor/github.com/spf13/pflag/string.go delete mode 100644 vendor/github.com/spf13/pflag/string_array.go delete mode 100644 vendor/github.com/spf13/pflag/string_slice.go delete mode 100644 vendor/github.com/spf13/pflag/string_to_int.go delete mode 100644 vendor/github.com/spf13/pflag/string_to_int64.go delete mode 100644 vendor/github.com/spf13/pflag/string_to_string.go delete mode 100644 vendor/github.com/spf13/pflag/uint.go delete mode 100644 vendor/github.com/spf13/pflag/uint16.go delete mode 100644 vendor/github.com/spf13/pflag/uint32.go delete mode 100644 vendor/github.com/spf13/pflag/uint64.go delete mode 100644 vendor/github.com/spf13/pflag/uint8.go delete mode 100644 vendor/github.com/spf13/pflag/uint_slice.go delete mode 100644 vendor/github.com/stretchr/testify/LICENSE delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_compare.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/assert/assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/doc.go delete mode 100644 vendor/github.com/stretchr/testify/assert/errors.go delete mode 100644 vendor/github.com/stretchr/testify/assert/forward_assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/http_assertions.go delete mode 100644 vendor/github.com/stretchr/testify/require/doc.go delete mode 100644 vendor/github.com/stretchr/testify/require/forward_requirements.go delete mode 100644 vendor/github.com/stretchr/testify/require/require.go delete mode 100644 vendor/github.com/stretchr/testify/require/require.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/require/require_forward.go delete mode 100644 vendor/github.com/stretchr/testify/require/require_forward.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/require/requirements.go delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/.travis.yml delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/LICENSE delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/Makefile delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/README.md delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/errors.go delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/go.mod delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/go.sum delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/mega.go delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/messages.go delete mode 100644 vendor/github.com/t3rm1n4l/go-mega/utils.go delete mode 100644 vendor/github.com/vivint/infectious/.travis.yml delete mode 100644 vendor/github.com/vivint/infectious/LICENSE delete mode 100644 vendor/github.com/vivint/infectious/README.md delete mode 100644 vendor/github.com/vivint/infectious/addmul_amd64.go delete mode 100644 vendor/github.com/vivint/infectious/addmul_amd64.s delete mode 100644 vendor/github.com/vivint/infectious/addmul_noasm.go delete mode 100644 vendor/github.com/vivint/infectious/addmul_tables_amd64.go delete mode 100644 vendor/github.com/vivint/infectious/berlekamp_welch.go delete mode 100644 vendor/github.com/vivint/infectious/common.go delete mode 100644 vendor/github.com/vivint/infectious/fec.go delete mode 100644 vendor/github.com/vivint/infectious/gf_alg.go delete mode 100644 vendor/github.com/vivint/infectious/go.mod delete mode 100644 vendor/github.com/vivint/infectious/go.sum delete mode 100644 vendor/github.com/vivint/infectious/math.go delete mode 100644 vendor/github.com/vivint/infectious/tables.go delete mode 100644 vendor/github.com/xanzy/ssh-agent/.gitignore delete mode 100644 vendor/github.com/xanzy/ssh-agent/LICENSE delete mode 100644 vendor/github.com/xanzy/ssh-agent/README.md delete mode 100644 vendor/github.com/xanzy/ssh-agent/go.mod delete mode 100644 vendor/github.com/xanzy/ssh-agent/go.sum delete mode 100644 vendor/github.com/xanzy/ssh-agent/pageant_windows.go delete mode 100644 vendor/github.com/xanzy/ssh-agent/sshagent.go delete mode 100644 vendor/github.com/xanzy/ssh-agent/sshagent_windows.go delete mode 100644 vendor/github.com/youmark/pkcs8/.gitignore delete mode 100644 vendor/github.com/youmark/pkcs8/.travis.yml delete mode 100644 vendor/github.com/youmark/pkcs8/LICENSE delete mode 100644 vendor/github.com/youmark/pkcs8/README delete mode 100644 vendor/github.com/youmark/pkcs8/README.md delete mode 100644 vendor/github.com/youmark/pkcs8/cipher.go delete mode 100644 vendor/github.com/youmark/pkcs8/cipher_3des.go delete mode 100644 vendor/github.com/youmark/pkcs8/cipher_aes.go delete mode 100644 vendor/github.com/youmark/pkcs8/go.mod delete mode 100644 vendor/github.com/youmark/pkcs8/go.sum delete mode 100644 vendor/github.com/youmark/pkcs8/kdf_pbkdf2.go delete mode 100644 vendor/github.com/youmark/pkcs8/kdf_scrypt.go delete mode 100644 vendor/github.com/youmark/pkcs8/pkcs8.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/.gitignore delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/.gitmodules delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/.travis.yml delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/AUTHORS delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/CHANGELOG.md delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/LICENSE delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/MAINTAINERS delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/Makefile delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/README.md delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/README_zh-CN.md delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/config/config.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/config/contract.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/go.mod delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/go.sum delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/logger/logger.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/builder/builder.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/data/input.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/data/operation.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/data/validation.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/errors/parameters.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/errors/qingstor.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/request.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/signer/qingstor.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/unpacker/base.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/request/unpacker/qingstor.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/service/bucket.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/service/convert_types.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/service/object.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/service/qingstor.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/service/types.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/utils/check_metadata.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/utils/conn.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/utils/escape.go delete mode 100644 vendor/github.com/yunify/qingstor-sdk-go/v3/version.go delete mode 100644 vendor/github.com/zeebo/errs/.gitignore delete mode 100644 vendor/github.com/zeebo/errs/AUTHORS delete mode 100644 vendor/github.com/zeebo/errs/LICENSE delete mode 100644 vendor/github.com/zeebo/errs/README.md delete mode 100644 vendor/github.com/zeebo/errs/errs.go delete mode 100644 vendor/github.com/zeebo/errs/go.mod delete mode 100644 vendor/github.com/zeebo/errs/group.go delete mode 100644 vendor/go.etcd.io/bbolt/.gitignore delete mode 100644 vendor/go.etcd.io/bbolt/.travis.yml delete mode 100644 vendor/go.etcd.io/bbolt/LICENSE delete mode 100644 vendor/go.etcd.io/bbolt/Makefile delete mode 100644 vendor/go.etcd.io/bbolt/README.md delete mode 100644 vendor/go.etcd.io/bbolt/bolt_386.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_amd64.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_arm.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_arm64.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_linux.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_mips64x.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_mipsx.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_openbsd.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_ppc.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_ppc64.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_ppc64le.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_riscv64.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_s390x.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_unix.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_unix_aix.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_unix_solaris.go delete mode 100644 vendor/go.etcd.io/bbolt/bolt_windows.go delete mode 100644 vendor/go.etcd.io/bbolt/boltsync_unix.go delete mode 100644 vendor/go.etcd.io/bbolt/bucket.go delete mode 100644 vendor/go.etcd.io/bbolt/cursor.go delete mode 100644 vendor/go.etcd.io/bbolt/db.go delete mode 100644 vendor/go.etcd.io/bbolt/doc.go delete mode 100644 vendor/go.etcd.io/bbolt/errors.go delete mode 100644 vendor/go.etcd.io/bbolt/freelist.go delete mode 100644 vendor/go.etcd.io/bbolt/freelist_hmap.go delete mode 100644 vendor/go.etcd.io/bbolt/go.mod delete mode 100644 vendor/go.etcd.io/bbolt/go.sum delete mode 100644 vendor/go.etcd.io/bbolt/node.go delete mode 100644 vendor/go.etcd.io/bbolt/page.go delete mode 100644 vendor/go.etcd.io/bbolt/tx.go delete mode 100644 vendor/go.etcd.io/bbolt/unsafe.go delete mode 100644 vendor/go.opencensus.io/.gitignore delete mode 100644 vendor/go.opencensus.io/.travis.yml delete mode 100644 vendor/go.opencensus.io/AUTHORS delete mode 100644 vendor/go.opencensus.io/CONTRIBUTING.md delete mode 100644 vendor/go.opencensus.io/LICENSE delete mode 100644 vendor/go.opencensus.io/Makefile delete mode 100644 vendor/go.opencensus.io/README.md delete mode 100644 vendor/go.opencensus.io/appveyor.yml delete mode 100644 vendor/go.opencensus.io/go.mod delete mode 100644 vendor/go.opencensus.io/go.sum delete mode 100644 vendor/go.opencensus.io/internal/internal.go delete mode 100644 vendor/go.opencensus.io/internal/sanitize.go delete mode 100644 vendor/go.opencensus.io/internal/tagencoding/tagencoding.go delete mode 100644 vendor/go.opencensus.io/internal/traceinternals.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/doc.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/exemplar.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/label.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/metric.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/point.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/type_string.go delete mode 100644 vendor/go.opencensus.io/metric/metricdata/unit.go delete mode 100644 vendor/go.opencensus.io/metric/metricproducer/manager.go delete mode 100644 vendor/go.opencensus.io/metric/metricproducer/producer.go delete mode 100644 vendor/go.opencensus.io/opencensus.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/client.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/client_stats.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/doc.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/propagation/b3/b3.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/route.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/server.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/span_annotating_client_trace.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/stats.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/trace.go delete mode 100644 vendor/go.opencensus.io/plugin/ochttp/wrapped_body.go delete mode 100644 vendor/go.opencensus.io/resource/resource.go delete mode 100644 vendor/go.opencensus.io/stats/doc.go delete mode 100644 vendor/go.opencensus.io/stats/internal/record.go delete mode 100644 vendor/go.opencensus.io/stats/measure.go delete mode 100644 vendor/go.opencensus.io/stats/measure_float64.go delete mode 100644 vendor/go.opencensus.io/stats/measure_int64.go delete mode 100644 vendor/go.opencensus.io/stats/record.go delete mode 100644 vendor/go.opencensus.io/stats/units.go delete mode 100644 vendor/go.opencensus.io/stats/view/aggregation.go delete mode 100644 vendor/go.opencensus.io/stats/view/aggregation_data.go delete mode 100644 vendor/go.opencensus.io/stats/view/collector.go delete mode 100644 vendor/go.opencensus.io/stats/view/doc.go delete mode 100644 vendor/go.opencensus.io/stats/view/export.go delete mode 100644 vendor/go.opencensus.io/stats/view/view.go delete mode 100644 vendor/go.opencensus.io/stats/view/view_to_metric.go delete mode 100644 vendor/go.opencensus.io/stats/view/worker.go delete mode 100644 vendor/go.opencensus.io/stats/view/worker_commands.go delete mode 100644 vendor/go.opencensus.io/tag/context.go delete mode 100644 vendor/go.opencensus.io/tag/doc.go delete mode 100644 vendor/go.opencensus.io/tag/key.go delete mode 100644 vendor/go.opencensus.io/tag/map.go delete mode 100644 vendor/go.opencensus.io/tag/map_codec.go delete mode 100644 vendor/go.opencensus.io/tag/metadata.go delete mode 100644 vendor/go.opencensus.io/tag/profile_19.go delete mode 100644 vendor/go.opencensus.io/tag/profile_not19.go delete mode 100644 vendor/go.opencensus.io/tag/validate.go delete mode 100644 vendor/go.opencensus.io/trace/basetypes.go delete mode 100644 vendor/go.opencensus.io/trace/config.go delete mode 100644 vendor/go.opencensus.io/trace/doc.go delete mode 100644 vendor/go.opencensus.io/trace/evictedqueue.go delete mode 100644 vendor/go.opencensus.io/trace/export.go delete mode 100644 vendor/go.opencensus.io/trace/internal/internal.go delete mode 100644 vendor/go.opencensus.io/trace/lrumap.go delete mode 100644 vendor/go.opencensus.io/trace/propagation/propagation.go delete mode 100644 vendor/go.opencensus.io/trace/sampling.go delete mode 100644 vendor/go.opencensus.io/trace/spanbucket.go delete mode 100644 vendor/go.opencensus.io/trace/spanstore.go delete mode 100644 vendor/go.opencensus.io/trace/status_codes.go delete mode 100644 vendor/go.opencensus.io/trace/trace.go delete mode 100644 vendor/go.opencensus.io/trace/trace_go11.go delete mode 100644 vendor/go.opencensus.io/trace/trace_nongo11.go delete mode 100644 vendor/go.opencensus.io/trace/tracestate/tracestate.go delete mode 100644 vendor/go.uber.org/atomic/.codecov.yml delete mode 100644 vendor/go.uber.org/atomic/.gitignore delete mode 100644 vendor/go.uber.org/atomic/.travis.yml delete mode 100644 vendor/go.uber.org/atomic/CHANGELOG.md delete mode 100644 vendor/go.uber.org/atomic/LICENSE.txt delete mode 100644 vendor/go.uber.org/atomic/Makefile delete mode 100644 vendor/go.uber.org/atomic/README.md delete mode 100644 vendor/go.uber.org/atomic/atomic.go delete mode 100644 vendor/go.uber.org/atomic/error.go delete mode 100644 vendor/go.uber.org/atomic/go.mod delete mode 100644 vendor/go.uber.org/atomic/go.sum delete mode 100644 vendor/go.uber.org/atomic/string.go delete mode 100644 vendor/go.uber.org/multierr/.codecov.yml delete mode 100644 vendor/go.uber.org/multierr/.gitignore delete mode 100644 vendor/go.uber.org/multierr/.travis.yml delete mode 100644 vendor/go.uber.org/multierr/CHANGELOG.md delete mode 100644 vendor/go.uber.org/multierr/LICENSE.txt delete mode 100644 vendor/go.uber.org/multierr/Makefile delete mode 100644 vendor/go.uber.org/multierr/README.md delete mode 100644 vendor/go.uber.org/multierr/error.go delete mode 100644 vendor/go.uber.org/multierr/glide.yaml delete mode 100644 vendor/go.uber.org/multierr/go.mod delete mode 100644 vendor/go.uber.org/multierr/go.sum delete mode 100644 vendor/go.uber.org/multierr/go113.go delete mode 100644 vendor/go.uber.org/zap/.codecov.yml delete mode 100644 vendor/go.uber.org/zap/.gitignore delete mode 100644 vendor/go.uber.org/zap/.readme.tmpl delete mode 100644 vendor/go.uber.org/zap/.travis.yml delete mode 100644 vendor/go.uber.org/zap/CHANGELOG.md delete mode 100644 vendor/go.uber.org/zap/CODE_OF_CONDUCT.md delete mode 100644 vendor/go.uber.org/zap/CONTRIBUTING.md delete mode 100644 vendor/go.uber.org/zap/FAQ.md delete mode 100644 vendor/go.uber.org/zap/LICENSE.txt delete mode 100644 vendor/go.uber.org/zap/Makefile delete mode 100644 vendor/go.uber.org/zap/README.md delete mode 100644 vendor/go.uber.org/zap/array.go delete mode 100644 vendor/go.uber.org/zap/buffer/buffer.go delete mode 100644 vendor/go.uber.org/zap/buffer/pool.go delete mode 100644 vendor/go.uber.org/zap/checklicense.sh delete mode 100644 vendor/go.uber.org/zap/config.go delete mode 100644 vendor/go.uber.org/zap/doc.go delete mode 100644 vendor/go.uber.org/zap/encoder.go delete mode 100644 vendor/go.uber.org/zap/error.go delete mode 100644 vendor/go.uber.org/zap/field.go delete mode 100644 vendor/go.uber.org/zap/flag.go delete mode 100644 vendor/go.uber.org/zap/glide.yaml delete mode 100644 vendor/go.uber.org/zap/global.go delete mode 100644 vendor/go.uber.org/zap/global_go112.go delete mode 100644 vendor/go.uber.org/zap/global_prego112.go delete mode 100644 vendor/go.uber.org/zap/go.mod delete mode 100644 vendor/go.uber.org/zap/go.sum delete mode 100644 vendor/go.uber.org/zap/http_handler.go delete mode 100644 vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go delete mode 100644 vendor/go.uber.org/zap/internal/color/color.go delete mode 100644 vendor/go.uber.org/zap/internal/exit/exit.go delete mode 100644 vendor/go.uber.org/zap/level.go delete mode 100644 vendor/go.uber.org/zap/logger.go delete mode 100644 vendor/go.uber.org/zap/options.go delete mode 100644 vendor/go.uber.org/zap/sink.go delete mode 100644 vendor/go.uber.org/zap/stacktrace.go delete mode 100644 vendor/go.uber.org/zap/sugar.go delete mode 100644 vendor/go.uber.org/zap/time.go delete mode 100644 vendor/go.uber.org/zap/writer.go delete mode 100644 vendor/go.uber.org/zap/zapcore/console_encoder.go delete mode 100644 vendor/go.uber.org/zap/zapcore/core.go delete mode 100644 vendor/go.uber.org/zap/zapcore/doc.go delete mode 100644 vendor/go.uber.org/zap/zapcore/encoder.go delete mode 100644 vendor/go.uber.org/zap/zapcore/entry.go delete mode 100644 vendor/go.uber.org/zap/zapcore/error.go delete mode 100644 vendor/go.uber.org/zap/zapcore/field.go delete mode 100644 vendor/go.uber.org/zap/zapcore/hook.go delete mode 100644 vendor/go.uber.org/zap/zapcore/increase_level.go delete mode 100644 vendor/go.uber.org/zap/zapcore/json_encoder.go delete mode 100644 vendor/go.uber.org/zap/zapcore/level.go delete mode 100644 vendor/go.uber.org/zap/zapcore/level_strings.go delete mode 100644 vendor/go.uber.org/zap/zapcore/marshaler.go delete mode 100644 vendor/go.uber.org/zap/zapcore/memory_encoder.go delete mode 100644 vendor/go.uber.org/zap/zapcore/sampler.go delete mode 100644 vendor/go.uber.org/zap/zapcore/tee.go delete mode 100644 vendor/go.uber.org/zap/zapcore/write_syncer.go delete mode 100644 vendor/goftp.io/server/.drone.yml delete mode 100644 vendor/goftp.io/server/.gitignore delete mode 100644 vendor/goftp.io/server/LICENSE delete mode 100644 vendor/goftp.io/server/README.md delete mode 100644 vendor/goftp.io/server/auth.go delete mode 100644 vendor/goftp.io/server/cmd.go delete mode 100644 vendor/goftp.io/server/conn.go delete mode 100644 vendor/goftp.io/server/doc.go delete mode 100644 vendor/goftp.io/server/driver.go delete mode 100644 vendor/goftp.io/server/driver_file.go delete mode 100644 vendor/goftp.io/server/driver_minio.go delete mode 100644 vendor/goftp.io/server/file_info.go delete mode 100644 vendor/goftp.io/server/go.mod delete mode 100644 vendor/goftp.io/server/go.sum delete mode 100644 vendor/goftp.io/server/list_formatter.go delete mode 100644 vendor/goftp.io/server/logger.go delete mode 100644 vendor/goftp.io/server/notifier.go delete mode 100644 vendor/goftp.io/server/perm.go delete mode 100644 vendor/goftp.io/server/server.go delete mode 100644 vendor/goftp.io/server/socket.go delete mode 100644 vendor/golang.org/x/crypto/AUTHORS delete mode 100644 vendor/golang.org/x/crypto/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/crypto/LICENSE delete mode 100644 vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/golang.org/x/crypto/argon2/argon2.go delete mode 100644 vendor/golang.org/x/crypto/argon2/blake2b.go delete mode 100644 vendor/golang.org/x/crypto/argon2/blamka_amd64.go delete mode 100644 vendor/golang.org/x/crypto/argon2/blamka_amd64.s delete mode 100644 vendor/golang.org/x/crypto/argon2/blamka_generic.go delete mode 100644 vendor/golang.org/x/crypto/argon2/blamka_ref.go delete mode 100644 vendor/golang.org/x/crypto/bcrypt/base64.go delete mode 100644 vendor/golang.org/x/crypto/bcrypt/bcrypt.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_generic.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_ref.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/blake2x.go delete mode 100644 vendor/golang.org/x/crypto/blake2b/register.go delete mode 100644 vendor/golang.org/x/crypto/blowfish/block.go delete mode 100644 vendor/golang.org/x/crypto/blowfish/cipher.go delete mode 100644 vendor/golang.org/x/crypto/blowfish/const.go delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_arm64.go delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_arm64.s delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_generic.go delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_noasm.go delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_s390x.go delete mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_s390x.s delete mode 100644 vendor/golang.org/x/crypto/chacha20/xor.go delete mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519.go delete mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_amd64.go delete mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_amd64.s delete mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_generic.go delete mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_noasm.go delete mode 100644 vendor/golang.org/x/crypto/ed25519/ed25519.go delete mode 100644 vendor/golang.org/x/crypto/ed25519/ed25519_go113.go delete mode 100644 vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go delete mode 100644 vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go delete mode 100644 vendor/golang.org/x/crypto/internal/subtle/aliasing.go delete mode 100644 vendor/golang.org/x/crypto/internal/subtle/aliasing_appengine.go delete mode 100644 vendor/golang.org/x/crypto/nacl/secretbox/secretbox.go delete mode 100644 vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/bits_compat.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/bits_go1.13.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/mac_noasm.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/poly1305.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_amd64.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_amd64.s delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_generic.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_s390x.go delete mode 100644 vendor/golang.org/x/crypto/poly1305/sum_s390x.s delete mode 100644 vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go delete mode 100644 vendor/golang.org/x/crypto/salsa20/salsa/salsa208.go delete mode 100644 vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.go delete mode 100644 vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.s delete mode 100644 vendor/golang.org/x/crypto/salsa20/salsa/salsa20_noasm.go delete mode 100644 vendor/golang.org/x/crypto/salsa20/salsa/salsa20_ref.go delete mode 100644 vendor/golang.org/x/crypto/scrypt/scrypt.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/client.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/forward.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/keyring.go delete mode 100644 vendor/golang.org/x/crypto/ssh/agent/server.go delete mode 100644 vendor/golang.org/x/crypto/ssh/buffer.go delete mode 100644 vendor/golang.org/x/crypto/ssh/certs.go delete mode 100644 vendor/golang.org/x/crypto/ssh/channel.go delete mode 100644 vendor/golang.org/x/crypto/ssh/cipher.go delete mode 100644 vendor/golang.org/x/crypto/ssh/client.go delete mode 100644 vendor/golang.org/x/crypto/ssh/client_auth.go delete mode 100644 vendor/golang.org/x/crypto/ssh/common.go delete mode 100644 vendor/golang.org/x/crypto/ssh/connection.go delete mode 100644 vendor/golang.org/x/crypto/ssh/doc.go delete mode 100644 vendor/golang.org/x/crypto/ssh/handshake.go delete mode 100644 vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go delete mode 100644 vendor/golang.org/x/crypto/ssh/kex.go delete mode 100644 vendor/golang.org/x/crypto/ssh/keys.go delete mode 100644 vendor/golang.org/x/crypto/ssh/mac.go delete mode 100644 vendor/golang.org/x/crypto/ssh/messages.go delete mode 100644 vendor/golang.org/x/crypto/ssh/mux.go delete mode 100644 vendor/golang.org/x/crypto/ssh/server.go delete mode 100644 vendor/golang.org/x/crypto/ssh/session.go delete mode 100644 vendor/golang.org/x/crypto/ssh/ssh_gss.go delete mode 100644 vendor/golang.org/x/crypto/ssh/streamlocal.go delete mode 100644 vendor/golang.org/x/crypto/ssh/tcpip.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/terminal.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util_aix.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util_linux.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go delete mode 100644 vendor/golang.org/x/crypto/ssh/terminal/util_windows.go delete mode 100644 vendor/golang.org/x/crypto/ssh/transport.go delete mode 100644 vendor/golang.org/x/net/AUTHORS delete mode 100644 vendor/golang.org/x/net/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/net/LICENSE delete mode 100644 vendor/golang.org/x/net/PATENTS delete mode 100644 vendor/golang.org/x/net/bpf/asm.go delete mode 100644 vendor/golang.org/x/net/bpf/constants.go delete mode 100644 vendor/golang.org/x/net/bpf/doc.go delete mode 100644 vendor/golang.org/x/net/bpf/instructions.go delete mode 100644 vendor/golang.org/x/net/bpf/setter.go delete mode 100644 vendor/golang.org/x/net/bpf/vm.go delete mode 100644 vendor/golang.org/x/net/bpf/vm_instructions.go delete mode 100644 vendor/golang.org/x/net/context/context.go delete mode 100644 vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go delete mode 100644 vendor/golang.org/x/net/context/go17.go delete mode 100644 vendor/golang.org/x/net/context/go19.go delete mode 100644 vendor/golang.org/x/net/context/pre_go17.go delete mode 100644 vendor/golang.org/x/net/context/pre_go19.go delete mode 100644 vendor/golang.org/x/net/html/atom/atom.go delete mode 100644 vendor/golang.org/x/net/html/atom/table.go delete mode 100644 vendor/golang.org/x/net/html/const.go delete mode 100644 vendor/golang.org/x/net/html/doc.go delete mode 100644 vendor/golang.org/x/net/html/doctype.go delete mode 100644 vendor/golang.org/x/net/html/entity.go delete mode 100644 vendor/golang.org/x/net/html/escape.go delete mode 100644 vendor/golang.org/x/net/html/foreign.go delete mode 100644 vendor/golang.org/x/net/html/node.go delete mode 100644 vendor/golang.org/x/net/html/parse.go delete mode 100644 vendor/golang.org/x/net/html/render.go delete mode 100644 vendor/golang.org/x/net/html/token.go delete mode 100644 vendor/golang.org/x/net/http/httpguts/guts.go delete mode 100644 vendor/golang.org/x/net/http/httpguts/httplex.go delete mode 100644 vendor/golang.org/x/net/http/httpproxy/proxy.go delete mode 100644 vendor/golang.org/x/net/http2/.gitignore delete mode 100644 vendor/golang.org/x/net/http2/Dockerfile delete mode 100644 vendor/golang.org/x/net/http2/Makefile delete mode 100644 vendor/golang.org/x/net/http2/README delete mode 100644 vendor/golang.org/x/net/http2/ciphers.go delete mode 100644 vendor/golang.org/x/net/http2/client_conn_pool.go delete mode 100644 vendor/golang.org/x/net/http2/databuffer.go delete mode 100644 vendor/golang.org/x/net/http2/errors.go delete mode 100644 vendor/golang.org/x/net/http2/flow.go delete mode 100644 vendor/golang.org/x/net/http2/frame.go delete mode 100644 vendor/golang.org/x/net/http2/go111.go delete mode 100644 vendor/golang.org/x/net/http2/gotrack.go delete mode 100644 vendor/golang.org/x/net/http2/headermap.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/encode.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/hpack.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/huffman.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/tables.go delete mode 100644 vendor/golang.org/x/net/http2/http2.go delete mode 100644 vendor/golang.org/x/net/http2/not_go111.go delete mode 100644 vendor/golang.org/x/net/http2/pipe.go delete mode 100644 vendor/golang.org/x/net/http2/server.go delete mode 100644 vendor/golang.org/x/net/http2/transport.go delete mode 100644 vendor/golang.org/x/net/http2/write.go delete mode 100644 vendor/golang.org/x/net/http2/writesched.go delete mode 100644 vendor/golang.org/x/net/http2/writesched_priority.go delete mode 100644 vendor/golang.org/x/net/http2/writesched_random.go delete mode 100644 vendor/golang.org/x/net/idna/idna10.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/idna9.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/punycode.go delete mode 100644 vendor/golang.org/x/net/idna/tables10.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/tables11.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/tables12.00.go delete mode 100644 vendor/golang.org/x/net/idna/tables9.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/trie.go delete mode 100644 vendor/golang.org/x/net/idna/trieval.go delete mode 100644 vendor/golang.org/x/net/internal/iana/const.go delete mode 100644 vendor/golang.org/x/net/internal/socket/cmsghdr.go delete mode 100644 vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go delete mode 100644 vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go delete mode 100644 vendor/golang.org/x/net/internal/socket/empty.s delete mode 100644 vendor/golang.org/x/net/internal/socket/error_unix.go delete mode 100644 vendor/golang.org/x/net/internal/socket/error_windows.go delete mode 100644 vendor/golang.org/x/net/internal/socket/iovec_32bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/iovec_64bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/iovec_stub.go delete mode 100644 vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go delete mode 100644 vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_bsd.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_linux.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go delete mode 100644 vendor/golang.org/x/net/internal/socket/msghdr_stub.go delete mode 100644 vendor/golang.org/x/net/internal/socket/norace.go delete mode 100644 vendor/golang.org/x/net/internal/socket/race.go delete mode 100644 vendor/golang.org/x/net/internal/socket/rawconn.go delete mode 100644 vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go delete mode 100644 vendor/golang.org/x/net/internal/socket/rawconn_msg.go delete mode 100644 vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go delete mode 100644 vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go delete mode 100644 vendor/golang.org/x/net/internal/socket/socket.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_bsd.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_bsdvar.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_const_unix.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_darwin.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_dragonfly.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linkname.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_386.s delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_arm.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_mips.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_netbsd.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_posix.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_solaris.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_stub.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_unix.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_windows.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go delete mode 100644 vendor/golang.org/x/net/internal/timeseries/timeseries.go delete mode 100644 vendor/golang.org/x/net/ipv4/batch.go delete mode 100644 vendor/golang.org/x/net/ipv4/control.go delete mode 100644 vendor/golang.org/x/net/ipv4/control_bsd.go delete mode 100644 vendor/golang.org/x/net/ipv4/control_pktinfo.go delete mode 100644 vendor/golang.org/x/net/ipv4/control_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/control_unix.go delete mode 100644 vendor/golang.org/x/net/ipv4/control_windows.go delete mode 100644 vendor/golang.org/x/net/ipv4/dgramopt.go delete mode 100644 vendor/golang.org/x/net/ipv4/doc.go delete mode 100644 vendor/golang.org/x/net/ipv4/endpoint.go delete mode 100644 vendor/golang.org/x/net/ipv4/genericopt.go delete mode 100644 vendor/golang.org/x/net/ipv4/header.go delete mode 100644 vendor/golang.org/x/net/ipv4/helper.go delete mode 100644 vendor/golang.org/x/net/ipv4/iana.go delete mode 100644 vendor/golang.org/x/net/ipv4/icmp.go delete mode 100644 vendor/golang.org/x/net/ipv4/icmp_linux.go delete mode 100644 vendor/golang.org/x/net/ipv4/icmp_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/packet.go delete mode 100644 vendor/golang.org/x/net/ipv4/payload.go delete mode 100644 vendor/golang.org/x/net/ipv4/payload_cmsg.go delete mode 100644 vendor/golang.org/x/net/ipv4/payload_nocmsg.go delete mode 100644 vendor/golang.org/x/net/ipv4/sockopt.go delete mode 100644 vendor/golang.org/x/net/ipv4/sockopt_posix.go delete mode 100644 vendor/golang.org/x/net/ipv4/sockopt_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_aix.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_asmreq.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_asmreqn.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_bpf.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_bpf_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_bsd.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_darwin.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_dragonfly.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_freebsd.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_linux.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_solaris.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_ssmreq.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_stub.go delete mode 100644 vendor/golang.org/x/net/ipv4/sys_windows.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_darwin.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_dragonfly.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_386.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_arm.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mips.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_netbsd.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_openbsd.go delete mode 100644 vendor/golang.org/x/net/ipv4/zsys_solaris.go delete mode 100644 vendor/golang.org/x/net/publicsuffix/list.go delete mode 100644 vendor/golang.org/x/net/publicsuffix/table.go delete mode 100644 vendor/golang.org/x/net/trace/events.go delete mode 100644 vendor/golang.org/x/net/trace/histogram.go delete mode 100644 vendor/golang.org/x/net/trace/trace.go delete mode 100644 vendor/golang.org/x/net/webdav/file.go delete mode 100644 vendor/golang.org/x/net/webdav/if.go delete mode 100644 vendor/golang.org/x/net/webdav/internal/xml/README delete mode 100644 vendor/golang.org/x/net/webdav/internal/xml/marshal.go delete mode 100644 vendor/golang.org/x/net/webdav/internal/xml/read.go delete mode 100644 vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go delete mode 100644 vendor/golang.org/x/net/webdav/internal/xml/xml.go delete mode 100644 vendor/golang.org/x/net/webdav/lock.go delete mode 100644 vendor/golang.org/x/net/webdav/prop.go delete mode 100644 vendor/golang.org/x/net/webdav/webdav.go delete mode 100644 vendor/golang.org/x/net/webdav/xml.go delete mode 100644 vendor/golang.org/x/net/websocket/client.go delete mode 100644 vendor/golang.org/x/net/websocket/dial.go delete mode 100644 vendor/golang.org/x/net/websocket/hybi.go delete mode 100644 vendor/golang.org/x/net/websocket/server.go delete mode 100644 vendor/golang.org/x/net/websocket/websocket.go delete mode 100644 vendor/golang.org/x/oauth2/.travis.yml delete mode 100644 vendor/golang.org/x/oauth2/AUTHORS delete mode 100644 vendor/golang.org/x/oauth2/CONTRIBUTING.md delete mode 100644 vendor/golang.org/x/oauth2/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/oauth2/LICENSE delete mode 100644 vendor/golang.org/x/oauth2/README.md delete mode 100644 vendor/golang.org/x/oauth2/go.mod delete mode 100644 vendor/golang.org/x/oauth2/go.sum delete mode 100644 vendor/golang.org/x/oauth2/google/appengine.go delete mode 100644 vendor/golang.org/x/oauth2/google/appengine_gen1.go delete mode 100644 vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go delete mode 100644 vendor/golang.org/x/oauth2/google/default.go delete mode 100644 vendor/golang.org/x/oauth2/google/doc.go delete mode 100644 vendor/golang.org/x/oauth2/google/google.go delete mode 100644 vendor/golang.org/x/oauth2/google/jwt.go delete mode 100644 vendor/golang.org/x/oauth2/google/sdk.go delete mode 100644 vendor/golang.org/x/oauth2/internal/client_appengine.go delete mode 100644 vendor/golang.org/x/oauth2/internal/doc.go delete mode 100644 vendor/golang.org/x/oauth2/internal/oauth2.go delete mode 100644 vendor/golang.org/x/oauth2/internal/token.go delete mode 100644 vendor/golang.org/x/oauth2/internal/transport.go delete mode 100644 vendor/golang.org/x/oauth2/jws/jws.go delete mode 100644 vendor/golang.org/x/oauth2/jwt/jwt.go delete mode 100644 vendor/golang.org/x/oauth2/oauth2.go delete mode 100644 vendor/golang.org/x/oauth2/token.go delete mode 100644 vendor/golang.org/x/oauth2/transport.go delete mode 100644 vendor/golang.org/x/sync/AUTHORS delete mode 100644 vendor/golang.org/x/sync/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/sync/LICENSE delete mode 100644 vendor/golang.org/x/sync/PATENTS delete mode 100644 vendor/golang.org/x/sync/errgroup/errgroup.go delete mode 100644 vendor/golang.org/x/sync/semaphore/semaphore.go delete mode 100644 vendor/golang.org/x/sys/AUTHORS delete mode 100644 vendor/golang.org/x/sys/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/sys/LICENSE delete mode 100644 vendor/golang.org/x/sys/PATENTS delete mode 100644 vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s delete mode 100644 vendor/golang.org/x/sys/cpu/byteorder.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_aix.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.s delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_x86.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_mips64x.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_mipsx.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_other_arm64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_riscv64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_s390x.s delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_wasm.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.s delete mode 100644 vendor/golang.org/x/sys/cpu/hwcap_linux.go delete mode 100644 vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go delete mode 100644 vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go delete mode 100644 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go delete mode 100644 vendor/golang.org/x/sys/unix/.gitignore delete mode 100644 vendor/golang.org/x/sys/unix/README.md delete mode 100644 vendor/golang.org/x/sys/unix/affinity_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/aliases.go delete mode 100644 vendor/golang.org/x/sys/unix/asm_aix_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mips64x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mipsx.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_s390x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_solaris_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/bluetooth_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/cap_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/constants.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dirent.go delete mode 100644 vendor/golang.org/x/sys/unix/endian_big.go delete mode 100644 vendor/golang.org/x/sys/unix/endian_little.go delete mode 100644 vendor/golang.org/x/sys/unix/env_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go delete mode 100644 vendor/golang.org/x/sys/unix/fdset.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_c.c delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl.go delete mode 100644 vendor/golang.org/x/sys/unix/mkall.sh delete mode 100644 vendor/golang.org/x/sys/unix/mkerrors.sh delete mode 100644 vendor/golang.org/x/sys/unix/pagesize_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/pledge_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/race.go delete mode 100644 vendor/golang.org/x/sys/unix/race0.go delete mode 100644 vendor/golang.org/x/sys/unix/readdirent_getdents.go delete mode 100644 vendor/golang.org/x/sys/unix/readdirent_getdirentries.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go delete mode 100644 vendor/golang.org/x/sys/unix/str.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_illumos.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/timestruct.go delete mode 100644 vendor/golang.org/x/sys/unix/unveil_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/xattr_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_x86_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/windows/aliases.go delete mode 100644 vendor/golang.org/x/sys/windows/dll_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/empty.s delete mode 100644 vendor/golang.org/x/sys/windows/env_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/eventlog.go delete mode 100644 vendor/golang.org/x/sys/windows/exec_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/memory_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/mkerrors.bash delete mode 100644 vendor/golang.org/x/sys/windows/mkknownfolderids.bash delete mode 100644 vendor/golang.org/x/sys/windows/mksyscall.go delete mode 100644 vendor/golang.org/x/sys/windows/race.go delete mode 100644 vendor/golang.org/x/sys/windows/race0.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/key.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/mksyscall.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/syscall.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/value.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/security_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/service.go delete mode 100644 vendor/golang.org/x/sys/windows/str.go delete mode 100644 vendor/golang.org/x/sys/windows/syscall.go delete mode 100644 vendor/golang.org/x/sys/windows/syscall_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_386.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_amd64.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm.go delete mode 100644 vendor/golang.org/x/sys/windows/zerrors_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/zknownfolderids_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/zsyscall_windows.go delete mode 100644 vendor/golang.org/x/text/AUTHORS delete mode 100644 vendor/golang.org/x/text/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/text/LICENSE delete mode 100644 vendor/golang.org/x/text/PATENTS delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go delete mode 100644 vendor/golang.org/x/text/transform/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bidi.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bracket.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/core.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/prop.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/trieval.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/input.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/trie.go delete mode 100644 vendor/golang.org/x/time/AUTHORS delete mode 100644 vendor/golang.org/x/time/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/time/LICENSE delete mode 100644 vendor/golang.org/x/time/PATENTS delete mode 100644 vendor/golang.org/x/time/rate/rate.go delete mode 100644 vendor/google.golang.org/api/AUTHORS delete mode 100644 vendor/google.golang.org/api/CONTRIBUTORS delete mode 100644 vendor/google.golang.org/api/LICENSE delete mode 100644 vendor/google.golang.org/api/drive/v2/drive-api.json delete mode 100644 vendor/google.golang.org/api/drive/v2/drive-gen.go delete mode 100644 vendor/google.golang.org/api/drive/v3/drive-api.json delete mode 100644 vendor/google.golang.org/api/drive/v3/drive-gen.go delete mode 100644 vendor/google.golang.org/api/googleapi/googleapi.go delete mode 100644 vendor/google.golang.org/api/googleapi/transport/apikey.go delete mode 100644 vendor/google.golang.org/api/googleapi/types.go delete mode 100644 vendor/google.golang.org/api/internal/conn_pool.go delete mode 100644 vendor/google.golang.org/api/internal/creds.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/buffer.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/doc.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/json.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/jsonfloat.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/media.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/params.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/resumable.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/retryable_linux.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/send.go delete mode 100644 vendor/google.golang.org/api/internal/gensupport/version.go delete mode 100644 vendor/google.golang.org/api/internal/service-account.json delete mode 100644 vendor/google.golang.org/api/internal/settings.go delete mode 100644 vendor/google.golang.org/api/internal/third_party/uritemplates/LICENSE delete mode 100644 vendor/google.golang.org/api/internal/third_party/uritemplates/METADATA delete mode 100644 vendor/google.golang.org/api/internal/third_party/uritemplates/uritemplates.go delete mode 100644 vendor/google.golang.org/api/internal/third_party/uritemplates/utils.go delete mode 100644 vendor/google.golang.org/api/option/credentials_go19.go delete mode 100644 vendor/google.golang.org/api/option/credentials_notgo19.go delete mode 100644 vendor/google.golang.org/api/option/internaloption/internaloption.go delete mode 100644 vendor/google.golang.org/api/option/option.go delete mode 100644 vendor/google.golang.org/api/storage/v1/storage-api.json delete mode 100644 vendor/google.golang.org/api/storage/v1/storage-gen.go delete mode 100644 vendor/google.golang.org/api/transport/cert/default_cert.go delete mode 100644 vendor/google.golang.org/api/transport/http/default_transport_go113.go delete mode 100644 vendor/google.golang.org/api/transport/http/default_transport_not_go113.go delete mode 100644 vendor/google.golang.org/api/transport/http/dial.go delete mode 100644 vendor/google.golang.org/api/transport/http/dial_appengine.go delete mode 100644 vendor/google.golang.org/api/transport/http/internal/propagation/http.go delete mode 100644 vendor/google.golang.org/appengine/.travis.yml delete mode 100644 vendor/google.golang.org/appengine/CONTRIBUTING.md delete mode 100644 vendor/google.golang.org/appengine/LICENSE delete mode 100644 vendor/google.golang.org/appengine/README.md delete mode 100644 vendor/google.golang.org/appengine/appengine.go delete mode 100644 vendor/google.golang.org/appengine/appengine_vm.go delete mode 100644 vendor/google.golang.org/appengine/errors.go delete mode 100644 vendor/google.golang.org/appengine/go.mod delete mode 100644 vendor/google.golang.org/appengine/go.sum delete mode 100644 vendor/google.golang.org/appengine/identity.go delete mode 100644 vendor/google.golang.org/appengine/internal/api.go delete mode 100644 vendor/google.golang.org/appengine/internal/api_classic.go delete mode 100644 vendor/google.golang.org/appengine/internal/api_common.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_id.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/base/api_base.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/base/api_base.proto delete mode 100644 vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto delete mode 100644 vendor/google.golang.org/appengine/internal/identity.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_classic.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_flex.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_vm.go delete mode 100644 vendor/google.golang.org/appengine/internal/internal.go delete mode 100644 vendor/google.golang.org/appengine/internal/log/log_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/log/log_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/main.go delete mode 100644 vendor/google.golang.org/appengine/internal/main_common.go delete mode 100644 vendor/google.golang.org/appengine/internal/main_vm.go delete mode 100644 vendor/google.golang.org/appengine/internal/metadata.go delete mode 100644 vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/modules/modules_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/net.go delete mode 100644 vendor/google.golang.org/appengine/internal/regen.sh delete mode 100644 vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto delete mode 100644 vendor/google.golang.org/appengine/internal/transaction.go delete mode 100644 vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto delete mode 100644 vendor/google.golang.org/appengine/namespace.go delete mode 100644 vendor/google.golang.org/appengine/timeout.go delete mode 100644 vendor/google.golang.org/appengine/travis_install.sh delete mode 100644 vendor/google.golang.org/appengine/travis_test.sh delete mode 100644 vendor/google.golang.org/appengine/urlfetch/urlfetch.go delete mode 100644 vendor/google.golang.org/genproto/LICENSE delete mode 100644 vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go delete mode 100644 vendor/google.golang.org/grpc/.travis.yml delete mode 100644 vendor/google.golang.org/grpc/AUTHORS delete mode 100644 vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md delete mode 100644 vendor/google.golang.org/grpc/CONTRIBUTING.md delete mode 100644 vendor/google.golang.org/grpc/GOVERNANCE.md delete mode 100644 vendor/google.golang.org/grpc/LICENSE delete mode 100644 vendor/google.golang.org/grpc/MAINTAINERS.md delete mode 100644 vendor/google.golang.org/grpc/Makefile delete mode 100644 vendor/google.golang.org/grpc/README.md delete mode 100644 vendor/google.golang.org/grpc/attributes/attributes.go delete mode 100644 vendor/google.golang.org/grpc/backoff.go delete mode 100644 vendor/google.golang.org/grpc/backoff/backoff.go delete mode 100644 vendor/google.golang.org/grpc/balancer/balancer.go delete mode 100644 vendor/google.golang.org/grpc/balancer/base/balancer.go delete mode 100644 vendor/google.golang.org/grpc/balancer/base/base.go delete mode 100644 vendor/google.golang.org/grpc/balancer/grpclb/state/state.go delete mode 100644 vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go delete mode 100644 vendor/google.golang.org/grpc/balancer_conn_wrappers.go delete mode 100644 vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go delete mode 100644 vendor/google.golang.org/grpc/call.go delete mode 100644 vendor/google.golang.org/grpc/clientconn.go delete mode 100644 vendor/google.golang.org/grpc/codec.go delete mode 100644 vendor/google.golang.org/grpc/codegen.sh delete mode 100644 vendor/google.golang.org/grpc/codes/code_string.go delete mode 100644 vendor/google.golang.org/grpc/codes/codes.go delete mode 100644 vendor/google.golang.org/grpc/connectivity/connectivity.go delete mode 100644 vendor/google.golang.org/grpc/credentials/credentials.go delete mode 100644 vendor/google.golang.org/grpc/credentials/go12.go delete mode 100644 vendor/google.golang.org/grpc/credentials/internal/syscallconn.go delete mode 100644 vendor/google.golang.org/grpc/credentials/internal/syscallconn_appengine.go delete mode 100644 vendor/google.golang.org/grpc/credentials/tls.go delete mode 100644 vendor/google.golang.org/grpc/dialoptions.go delete mode 100644 vendor/google.golang.org/grpc/doc.go delete mode 100644 vendor/google.golang.org/grpc/encoding/encoding.go delete mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto.go delete mode 100644 vendor/google.golang.org/grpc/go.mod delete mode 100644 vendor/google.golang.org/grpc/go.sum delete mode 100644 vendor/google.golang.org/grpc/grpclog/grpclog.go delete mode 100644 vendor/google.golang.org/grpc/grpclog/logger.go delete mode 100644 vendor/google.golang.org/grpc/grpclog/loggerv2.go delete mode 100644 vendor/google.golang.org/grpc/install_gae.sh delete mode 100644 vendor/google.golang.org/grpc/interceptor.go delete mode 100644 vendor/google.golang.org/grpc/internal/backoff/backoff.go delete mode 100644 vendor/google.golang.org/grpc/internal/balancerload/load.go delete mode 100644 vendor/google.golang.org/grpc/internal/binarylog/binarylog.go delete mode 100644 vendor/google.golang.org/grpc/internal/binarylog/binarylog_testutil.go delete mode 100644 vendor/google.golang.org/grpc/internal/binarylog/env_config.go delete mode 100644 vendor/google.golang.org/grpc/internal/binarylog/method_logger.go delete mode 100644 vendor/google.golang.org/grpc/internal/binarylog/sink.go delete mode 100644 vendor/google.golang.org/grpc/internal/buffer/unbounded.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/funcs.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/logging.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/types.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/types_linux.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/util_linux.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go delete mode 100644 vendor/google.golang.org/grpc/internal/envconfig/envconfig.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpclog/grpclog.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpcsync/event.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpcutil/method.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpcutil/target.go delete mode 100644 vendor/google.golang.org/grpc/internal/internal.go delete mode 100644 vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go delete mode 100644 vendor/google.golang.org/grpc/internal/resolver/dns/go113.go delete mode 100644 vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go delete mode 100644 vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go delete mode 100644 vendor/google.golang.org/grpc/internal/status/status.go delete mode 100644 vendor/google.golang.org/grpc/internal/syscall/syscall_linux.go delete mode 100644 vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/bdp_estimator.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/controlbuf.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/defaults.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/flowcontrol.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/handler_server.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/http2_client.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/http2_server.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/http_util.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/log.go delete mode 100644 vendor/google.golang.org/grpc/internal/transport/transport.go delete mode 100644 vendor/google.golang.org/grpc/keepalive/keepalive.go delete mode 100644 vendor/google.golang.org/grpc/metadata/metadata.go delete mode 100644 vendor/google.golang.org/grpc/peer/peer.go delete mode 100644 vendor/google.golang.org/grpc/picker_wrapper.go delete mode 100644 vendor/google.golang.org/grpc/pickfirst.go delete mode 100644 vendor/google.golang.org/grpc/preloader.go delete mode 100644 vendor/google.golang.org/grpc/proxy.go delete mode 100644 vendor/google.golang.org/grpc/regenerate.sh delete mode 100644 vendor/google.golang.org/grpc/resolver/resolver.go delete mode 100644 vendor/google.golang.org/grpc/resolver_conn_wrapper.go delete mode 100644 vendor/google.golang.org/grpc/rpc_util.go delete mode 100644 vendor/google.golang.org/grpc/server.go delete mode 100644 vendor/google.golang.org/grpc/service_config.go delete mode 100644 vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go delete mode 100644 vendor/google.golang.org/grpc/stats/handlers.go delete mode 100644 vendor/google.golang.org/grpc/stats/stats.go delete mode 100644 vendor/google.golang.org/grpc/status/status.go delete mode 100644 vendor/google.golang.org/grpc/stream.go delete mode 100644 vendor/google.golang.org/grpc/tap/tap.go delete mode 100644 vendor/google.golang.org/grpc/trace.go delete mode 100644 vendor/google.golang.org/grpc/version.go delete mode 100644 vendor/google.golang.org/grpc/vet.sh delete mode 100644 vendor/google.golang.org/protobuf/AUTHORS delete mode 100644 vendor/google.golang.org/protobuf/CONTRIBUTORS delete mode 100644 vendor/google.golang.org/protobuf/LICENSE delete mode 100644 vendor/google.golang.org/protobuf/PATENTS delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/decode.go delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/doc.go delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/encode.go delete mode 100644 vendor/google.golang.org/protobuf/encoding/protowire/wire.go delete mode 100644 vendor/google.golang.org/protobuf/internal/descfmt/stringer.go delete mode 100644 vendor/google.golang.org/protobuf/internal/descopts/options.go delete mode 100644 vendor/google.golang.org/protobuf/internal/detrand/rand.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/defval/default.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/doc.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/encode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/errors.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go112.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go113.go delete mode 100644 vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/build.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filetype/build.go delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/flags.go delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/any_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/api_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/doc.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/duration_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/empty_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/goname.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/map_entry.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/struct_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/type_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/wrappers.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/api_export.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/checkinit.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_extension.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_field.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_message.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_tables.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert_list.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert_map.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/decode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/encode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/enum.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/extension.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_export.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_file.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_message.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/merge.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/merge_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/validate.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/weak.go delete mode 100644 vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go delete mode 100644 vendor/google.golang.org/protobuf/internal/pragma/pragma.go delete mode 100644 vendor/google.golang.org/protobuf/internal/set/ints.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_pure.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/version/version.go delete mode 100644 vendor/google.golang.org/protobuf/proto/checkinit.go delete mode 100644 vendor/google.golang.org/protobuf/proto/decode.go delete mode 100644 vendor/google.golang.org/protobuf/proto/decode_gen.go delete mode 100644 vendor/google.golang.org/protobuf/proto/doc.go delete mode 100644 vendor/google.golang.org/protobuf/proto/encode.go delete mode 100644 vendor/google.golang.org/protobuf/proto/encode_gen.go delete mode 100644 vendor/google.golang.org/protobuf/proto/equal.go delete mode 100644 vendor/google.golang.org/protobuf/proto/extension.go delete mode 100644 vendor/google.golang.org/protobuf/proto/merge.go delete mode 100644 vendor/google.golang.org/protobuf/proto/messageset.go delete mode 100644 vendor/google.golang.org/protobuf/proto/proto.go delete mode 100644 vendor/google.golang.org/protobuf/proto/proto_methods.go delete mode 100644 vendor/google.golang.org/protobuf/proto/proto_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/proto/reset.go delete mode 100644 vendor/google.golang.org/protobuf/proto/size.go delete mode 100644 vendor/google.golang.org/protobuf/proto/size_gen.go delete mode 100644 vendor/google.golang.org/protobuf/proto/wrappers.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/source.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/type.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoiface/methods.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoimpl/version.go delete mode 100644 vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go delete mode 100644 vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go delete mode 100644 vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go delete mode 100644 vendor/gopkg.in/ini.v1/.gitignore delete mode 100644 vendor/gopkg.in/ini.v1/LICENSE delete mode 100644 vendor/gopkg.in/ini.v1/Makefile delete mode 100644 vendor/gopkg.in/ini.v1/README.md delete mode 100644 vendor/gopkg.in/ini.v1/codecov.yml delete mode 100644 vendor/gopkg.in/ini.v1/data_source.go delete mode 100644 vendor/gopkg.in/ini.v1/deprecated.go delete mode 100644 vendor/gopkg.in/ini.v1/error.go delete mode 100644 vendor/gopkg.in/ini.v1/file.go delete mode 100644 vendor/gopkg.in/ini.v1/helper.go delete mode 100644 vendor/gopkg.in/ini.v1/ini.go delete mode 100644 vendor/gopkg.in/ini.v1/key.go delete mode 100644 vendor/gopkg.in/ini.v1/parser.go delete mode 100644 vendor/gopkg.in/ini.v1/section.go delete mode 100644 vendor/gopkg.in/ini.v1/struct.go delete mode 100644 vendor/gopkg.in/yaml.v2/.travis.yml delete mode 100644 vendor/gopkg.in/yaml.v2/LICENSE delete mode 100644 vendor/gopkg.in/yaml.v2/LICENSE.libyaml delete mode 100644 vendor/gopkg.in/yaml.v2/NOTICE delete mode 100644 vendor/gopkg.in/yaml.v2/README.md delete mode 100644 vendor/gopkg.in/yaml.v2/apic.go delete mode 100644 vendor/gopkg.in/yaml.v2/decode.go delete mode 100644 vendor/gopkg.in/yaml.v2/emitterc.go delete mode 100644 vendor/gopkg.in/yaml.v2/encode.go delete mode 100644 vendor/gopkg.in/yaml.v2/go.mod delete mode 100644 vendor/gopkg.in/yaml.v2/parserc.go delete mode 100644 vendor/gopkg.in/yaml.v2/readerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/resolve.go delete mode 100644 vendor/gopkg.in/yaml.v2/scannerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/sorter.go delete mode 100644 vendor/gopkg.in/yaml.v2/writerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/yaml.go delete mode 100644 vendor/gopkg.in/yaml.v2/yamlh.go delete mode 100644 vendor/gopkg.in/yaml.v2/yamlprivateh.go delete mode 100644 vendor/gopkg.in/yaml.v3/.travis.yml delete mode 100644 vendor/gopkg.in/yaml.v3/LICENSE delete mode 100644 vendor/gopkg.in/yaml.v3/NOTICE delete mode 100644 vendor/gopkg.in/yaml.v3/README.md delete mode 100644 vendor/gopkg.in/yaml.v3/apic.go delete mode 100644 vendor/gopkg.in/yaml.v3/decode.go delete mode 100644 vendor/gopkg.in/yaml.v3/emitterc.go delete mode 100644 vendor/gopkg.in/yaml.v3/encode.go delete mode 100644 vendor/gopkg.in/yaml.v3/go.mod delete mode 100644 vendor/gopkg.in/yaml.v3/parserc.go delete mode 100644 vendor/gopkg.in/yaml.v3/readerc.go delete mode 100644 vendor/gopkg.in/yaml.v3/resolve.go delete mode 100644 vendor/gopkg.in/yaml.v3/scannerc.go delete mode 100644 vendor/gopkg.in/yaml.v3/sorter.go delete mode 100644 vendor/gopkg.in/yaml.v3/writerc.go delete mode 100644 vendor/gopkg.in/yaml.v3/yaml.go delete mode 100644 vendor/gopkg.in/yaml.v3/yamlh.go delete mode 100644 vendor/gopkg.in/yaml.v3/yamlprivateh.go delete mode 100644 vendor/modules.txt delete mode 100644 vendor/storj.io/common/LICENSE delete mode 100644 vendor/storj.io/common/encryption/aesgcm.go delete mode 100644 vendor/storj.io/common/encryption/bits.go delete mode 100644 vendor/storj.io/common/encryption/common.go delete mode 100644 vendor/storj.io/common/encryption/encryption.go delete mode 100644 vendor/storj.io/common/encryption/pad.go delete mode 100644 vendor/storj.io/common/encryption/password.go delete mode 100644 vendor/storj.io/common/encryption/path.go delete mode 100644 vendor/storj.io/common/encryption/secretbox.go delete mode 100644 vendor/storj.io/common/encryption/store.go delete mode 100644 vendor/storj.io/common/encryption/transform.go delete mode 100644 vendor/storj.io/common/errs2/collect.go delete mode 100644 vendor/storj.io/common/errs2/doc.go delete mode 100644 vendor/storj.io/common/errs2/group.go delete mode 100644 vendor/storj.io/common/errs2/ignore.go delete mode 100644 vendor/storj.io/common/errs2/rpc.go delete mode 100644 vendor/storj.io/common/errs2/sanatizer.go delete mode 100644 vendor/storj.io/common/fpath/atomic.go delete mode 100644 vendor/storj.io/common/fpath/doc.go delete mode 100644 vendor/storj.io/common/fpath/editor.go delete mode 100644 vendor/storj.io/common/fpath/os.go delete mode 100644 vendor/storj.io/common/fpath/path.go delete mode 100644 vendor/storj.io/common/fpath/temp_data.go delete mode 100644 vendor/storj.io/common/identity/certificate_authority.go delete mode 100644 vendor/storj.io/common/identity/common.go delete mode 100644 vendor/storj.io/common/identity/doc.go delete mode 100644 vendor/storj.io/common/identity/generate.go delete mode 100644 vendor/storj.io/common/identity/identity.go delete mode 100644 vendor/storj.io/common/identity/utils.go delete mode 100644 vendor/storj.io/common/macaroon/apikey.go delete mode 100644 vendor/storj.io/common/macaroon/caveat.go delete mode 100644 vendor/storj.io/common/macaroon/doc.go delete mode 100644 vendor/storj.io/common/macaroon/macaroon.go delete mode 100644 vendor/storj.io/common/macaroon/serialize.go delete mode 100644 vendor/storj.io/common/macaroon/types.pb.go delete mode 100644 vendor/storj.io/common/macaroon/types.proto delete mode 100644 vendor/storj.io/common/memory/doc.go delete mode 100644 vendor/storj.io/common/memory/size.go delete mode 100644 vendor/storj.io/common/memory/sizes.go delete mode 100644 vendor/storj.io/common/memory/string.go delete mode 100644 vendor/storj.io/common/netutil/common.go delete mode 100644 vendor/storj.io/common/netutil/timeout_linux.go delete mode 100644 vendor/storj.io/common/netutil/timeout_other.go delete mode 100644 vendor/storj.io/common/netutil/tracking.go delete mode 100644 vendor/storj.io/common/paths/doc.go delete mode 100644 vendor/storj.io/common/paths/path.go delete mode 100644 vendor/storj.io/common/pb/alias.go delete mode 100644 vendor/storj.io/common/pb/certificate.pb.go delete mode 100644 vendor/storj.io/common/pb/certificate.proto delete mode 100644 vendor/storj.io/common/pb/contact.pb.go delete mode 100644 vendor/storj.io/common/pb/contact.proto delete mode 100644 vendor/storj.io/common/pb/datarepair.pb.go delete mode 100644 vendor/storj.io/common/pb/datarepair.proto delete mode 100644 vendor/storj.io/common/pb/doc.go delete mode 100644 vendor/storj.io/common/pb/encryption.pb.go delete mode 100644 vendor/storj.io/common/pb/encryption.proto delete mode 100644 vendor/storj.io/common/pb/encryption_access.pb.go delete mode 100644 vendor/storj.io/common/pb/encryption_access.proto delete mode 100644 vendor/storj.io/common/pb/gogo.proto delete mode 100644 vendor/storj.io/common/pb/gracefulexit.pb.go delete mode 100644 vendor/storj.io/common/pb/gracefulexit.proto delete mode 100644 vendor/storj.io/common/pb/heldamount.pb.go delete mode 100644 vendor/storj.io/common/pb/heldamount.proto delete mode 100644 vendor/storj.io/common/pb/inspector.pb.go delete mode 100644 vendor/storj.io/common/pb/inspector.proto delete mode 100644 vendor/storj.io/common/pb/meta.pb.go delete mode 100644 vendor/storj.io/common/pb/meta.proto delete mode 100644 vendor/storj.io/common/pb/metainfo.pb.go delete mode 100644 vendor/storj.io/common/pb/metainfo.proto delete mode 100644 vendor/storj.io/common/pb/node.pb.go delete mode 100644 vendor/storj.io/common/pb/node.proto delete mode 100644 vendor/storj.io/common/pb/nodestats.pb.go delete mode 100644 vendor/storj.io/common/pb/nodestats.proto delete mode 100644 vendor/storj.io/common/pb/orders.pb.go delete mode 100644 vendor/storj.io/common/pb/orders.proto delete mode 100644 vendor/storj.io/common/pb/payments.pb.go delete mode 100644 vendor/storj.io/common/pb/payments.proto delete mode 100644 vendor/storj.io/common/pb/piecestore2.pb.go delete mode 100644 vendor/storj.io/common/pb/piecestore2.proto delete mode 100644 vendor/storj.io/common/pb/pointerdb.pb.go delete mode 100644 vendor/storj.io/common/pb/pointerdb.proto delete mode 100644 vendor/storj.io/common/pb/referralmanager.pb.go delete mode 100644 vendor/storj.io/common/pb/referralmanager.proto delete mode 100644 vendor/storj.io/common/pb/scannerValuer.go delete mode 100644 vendor/storj.io/common/pb/scope.pb.go delete mode 100644 vendor/storj.io/common/pb/scope.proto delete mode 100644 vendor/storj.io/common/pb/streams.pb.go delete mode 100644 vendor/storj.io/common/pb/streams.proto delete mode 100644 vendor/storj.io/common/pb/types.go delete mode 100644 vendor/storj.io/common/pb/utils.go delete mode 100644 vendor/storj.io/common/pb/vouchers.pb.go delete mode 100644 vendor/storj.io/common/pb/vouchers.proto delete mode 100644 vendor/storj.io/common/peertls/doc.go delete mode 100644 vendor/storj.io/common/peertls/extensions/doc.go delete mode 100644 vendor/storj.io/common/peertls/extensions/extensions.go delete mode 100644 vendor/storj.io/common/peertls/extensions/fuzz.go delete mode 100644 vendor/storj.io/common/peertls/extensions/gob.go delete mode 100644 vendor/storj.io/common/peertls/extensions/revocations.go delete mode 100644 vendor/storj.io/common/peertls/peertls.go delete mode 100644 vendor/storj.io/common/peertls/templates.go delete mode 100644 vendor/storj.io/common/peertls/tlsopts/cert.go delete mode 100644 vendor/storj.io/common/peertls/tlsopts/config.go delete mode 100644 vendor/storj.io/common/peertls/tlsopts/doc.go delete mode 100644 vendor/storj.io/common/peertls/tlsopts/options.go delete mode 100644 vendor/storj.io/common/peertls/tlsopts/tls.go delete mode 100644 vendor/storj.io/common/peertls/utils.go delete mode 100644 vendor/storj.io/common/pkcrypto/common.go delete mode 100644 vendor/storj.io/common/pkcrypto/doc.go delete mode 100644 vendor/storj.io/common/pkcrypto/encoding.go delete mode 100644 vendor/storj.io/common/pkcrypto/hashing.go delete mode 100644 vendor/storj.io/common/pkcrypto/hashing_std.go delete mode 100644 vendor/storj.io/common/pkcrypto/signing.go delete mode 100644 vendor/storj.io/common/ranger/common.go delete mode 100644 vendor/storj.io/common/ranger/doc.go delete mode 100644 vendor/storj.io/common/ranger/file.go delete mode 100644 vendor/storj.io/common/ranger/reader.go delete mode 100644 vendor/storj.io/common/ranger/readerat.go delete mode 100644 vendor/storj.io/common/readcloser/doc.go delete mode 100644 vendor/storj.io/common/readcloser/fatal.go delete mode 100644 vendor/storj.io/common/readcloser/lazy.go delete mode 100644 vendor/storj.io/common/readcloser/limit.go delete mode 100644 vendor/storj.io/common/readcloser/multi.go delete mode 100644 vendor/storj.io/common/rpc/common.go delete mode 100644 vendor/storj.io/common/rpc/conn.go delete mode 100644 vendor/storj.io/common/rpc/dial.go delete mode 100644 vendor/storj.io/common/rpc/doc.go delete mode 100644 vendor/storj.io/common/rpc/known_ids.go delete mode 100644 vendor/storj.io/common/rpc/lookup.go delete mode 100644 vendor/storj.io/common/rpc/rpcpeer/peer.go delete mode 100644 vendor/storj.io/common/rpc/rpcpool/pool.go delete mode 100644 vendor/storj.io/common/rpc/rpcstatus/status.go delete mode 100644 vendor/storj.io/common/rpc/rpctracing/common.go delete mode 100644 vendor/storj.io/common/rpc/rpctracing/handler.go delete mode 100644 vendor/storj.io/common/rpc/rpctracing/tracing.go delete mode 100644 vendor/storj.io/common/signing/doc.go delete mode 100644 vendor/storj.io/common/signing/encode.go delete mode 100644 vendor/storj.io/common/signing/peers.go delete mode 100644 vendor/storj.io/common/signing/sign.go delete mode 100644 vendor/storj.io/common/signing/verify.go delete mode 100644 vendor/storj.io/common/storj/bucket.go delete mode 100644 vendor/storj.io/common/storj/doc.go delete mode 100644 vendor/storj.io/common/storj/encryption.go delete mode 100644 vendor/storj.io/common/storj/identity_version.go delete mode 100644 vendor/storj.io/common/storj/metainfo.go delete mode 100644 vendor/storj.io/common/storj/node.go delete mode 100644 vendor/storj.io/common/storj/nodeurl.go delete mode 100644 vendor/storj.io/common/storj/object.go delete mode 100644 vendor/storj.io/common/storj/object_list_item.go delete mode 100644 vendor/storj.io/common/storj/path.go delete mode 100644 vendor/storj.io/common/storj/pieceid.go delete mode 100644 vendor/storj.io/common/storj/piecekey.go delete mode 100644 vendor/storj.io/common/storj/redundancy.go delete mode 100644 vendor/storj.io/common/storj/segment.go delete mode 100644 vendor/storj.io/common/storj/segmentid.go delete mode 100644 vendor/storj.io/common/storj/serialnumber.go delete mode 100644 vendor/storj.io/common/storj/streamid.go delete mode 100644 vendor/storj.io/common/sync2/cooldown.go delete mode 100644 vendor/storj.io/common/sync2/copy.go delete mode 100644 vendor/storj.io/common/sync2/cycle.go delete mode 100644 vendor/storj.io/common/sync2/doc.go delete mode 100644 vendor/storj.io/common/sync2/fence.go delete mode 100644 vendor/storj.io/common/sync2/io.go delete mode 100644 vendor/storj.io/common/sync2/limiter.go delete mode 100644 vendor/storj.io/common/sync2/nocopy.go delete mode 100644 vendor/storj.io/common/sync2/parent_child_limiter.go delete mode 100644 vendor/storj.io/common/sync2/pipe.go delete mode 100644 vendor/storj.io/common/sync2/semaphore.go delete mode 100644 vendor/storj.io/common/sync2/sleep.go delete mode 100644 vendor/storj.io/common/sync2/success_threshold.go delete mode 100644 vendor/storj.io/common/sync2/tee.go delete mode 100644 vendor/storj.io/common/sync2/throttle.go delete mode 100644 vendor/storj.io/common/sync2/workgroup.go delete mode 100644 vendor/storj.io/common/uuid/db.go delete mode 100644 vendor/storj.io/common/uuid/fuzz.go delete mode 100644 vendor/storj.io/common/uuid/uuid.go delete mode 100644 vendor/storj.io/drpc/.gitignore delete mode 100644 vendor/storj.io/drpc/.golangci.yml delete mode 100644 vendor/storj.io/drpc/Dockerfile.jenkins delete mode 100644 vendor/storj.io/drpc/Jenkinsfile delete mode 100644 vendor/storj.io/drpc/LICENSE delete mode 100644 vendor/storj.io/drpc/Makefile delete mode 100644 vendor/storj.io/drpc/README.md delete mode 100644 vendor/storj.io/drpc/doc.go delete mode 100644 vendor/storj.io/drpc/drpc.go delete mode 100644 vendor/storj.io/drpc/drpccache/README.md delete mode 100644 vendor/storj.io/drpc/drpccache/cache.go delete mode 100644 vendor/storj.io/drpc/drpccache/doc.go delete mode 100644 vendor/storj.io/drpc/drpcconn/README.md delete mode 100644 vendor/storj.io/drpc/drpcconn/conn.go delete mode 100644 vendor/storj.io/drpc/drpcconn/doc.go delete mode 100644 vendor/storj.io/drpc/drpcctx/README.md delete mode 100644 vendor/storj.io/drpc/drpcctx/doc.go delete mode 100644 vendor/storj.io/drpc/drpcctx/transport.go delete mode 100644 vendor/storj.io/drpc/drpcdebug/README.md delete mode 100644 vendor/storj.io/drpc/drpcdebug/doc.go delete mode 100644 vendor/storj.io/drpc/drpcdebug/log_disabled.go delete mode 100644 vendor/storj.io/drpc/drpcdebug/log_enabled.go delete mode 100644 vendor/storj.io/drpc/drpcerr/README.md delete mode 100644 vendor/storj.io/drpc/drpcerr/doc.go delete mode 100644 vendor/storj.io/drpc/drpcerr/err.go delete mode 100644 vendor/storj.io/drpc/drpcmanager/README.md delete mode 100644 vendor/storj.io/drpc/drpcmanager/doc.go delete mode 100644 vendor/storj.io/drpc/drpcmanager/manager.go delete mode 100644 vendor/storj.io/drpc/drpcmetadata/README.md delete mode 100644 vendor/storj.io/drpc/drpcmetadata/doc.go delete mode 100644 vendor/storj.io/drpc/drpcmetadata/invoke/README.md delete mode 100644 vendor/storj.io/drpc/drpcmetadata/invoke/doc.go delete mode 100644 vendor/storj.io/drpc/drpcmetadata/invoke/metadata.pb.go delete mode 100644 vendor/storj.io/drpc/drpcmetadata/invoke/metadata.proto delete mode 100644 vendor/storj.io/drpc/drpcmetadata/metadata.go delete mode 100644 vendor/storj.io/drpc/drpcmux/README.md delete mode 100644 vendor/storj.io/drpc/drpcmux/doc.go delete mode 100644 vendor/storj.io/drpc/drpcmux/mux.go delete mode 100644 vendor/storj.io/drpc/drpcsignal/README.md delete mode 100644 vendor/storj.io/drpc/drpcsignal/doc.go delete mode 100644 vendor/storj.io/drpc/drpcsignal/signal.go delete mode 100644 vendor/storj.io/drpc/drpcstream/README.md delete mode 100644 vendor/storj.io/drpc/drpcstream/chmutex.go delete mode 100644 vendor/storj.io/drpc/drpcstream/doc.go delete mode 100644 vendor/storj.io/drpc/drpcstream/stream.go delete mode 100644 vendor/storj.io/drpc/drpcwire/README.md delete mode 100644 vendor/storj.io/drpc/drpcwire/doc.go delete mode 100644 vendor/storj.io/drpc/drpcwire/error.go delete mode 100644 vendor/storj.io/drpc/drpcwire/packet.go delete mode 100644 vendor/storj.io/drpc/drpcwire/packet_string.go delete mode 100644 vendor/storj.io/drpc/drpcwire/split.go delete mode 100644 vendor/storj.io/drpc/drpcwire/transport.go delete mode 100644 vendor/storj.io/drpc/drpcwire/varint.go delete mode 100644 vendor/storj.io/drpc/go.mod delete mode 100644 vendor/storj.io/drpc/go.sum delete mode 100644 vendor/storj.io/drpc/staticcheck.conf delete mode 100644 vendor/storj.io/uplink/.clabot delete mode 100644 vendor/storj.io/uplink/.gitignore delete mode 100644 vendor/storj.io/uplink/CODE_OF_CONDUCT.md delete mode 100644 vendor/storj.io/uplink/Jenkinsfile delete mode 100644 vendor/storj.io/uplink/LICENSE delete mode 100644 vendor/storj.io/uplink/MAINTAINERS.md delete mode 100644 vendor/storj.io/uplink/Makefile delete mode 100644 vendor/storj.io/uplink/README.md delete mode 100644 vendor/storj.io/uplink/access.go delete mode 100644 vendor/storj.io/uplink/bucket.go delete mode 100644 vendor/storj.io/uplink/buckets.go delete mode 100644 vendor/storj.io/uplink/common.go delete mode 100644 vendor/storj.io/uplink/config.go delete mode 100644 vendor/storj.io/uplink/doc.go delete mode 100644 vendor/storj.io/uplink/download.go delete mode 100644 vendor/storj.io/uplink/encryption.go delete mode 100644 vendor/storj.io/uplink/go.mod delete mode 100644 vendor/storj.io/uplink/go.sum delete mode 100644 vendor/storj.io/uplink/internal/expose/exposed.go delete mode 100644 vendor/storj.io/uplink/internal/telemetryclient/client.go delete mode 100644 vendor/storj.io/uplink/object.go delete mode 100644 vendor/storj.io/uplink/objects.go delete mode 100644 vendor/storj.io/uplink/private/ecclient/client.go delete mode 100644 vendor/storj.io/uplink/private/ecclient/common.go delete mode 100644 vendor/storj.io/uplink/private/eestream/common.go delete mode 100644 vendor/storj.io/uplink/private/eestream/decode.go delete mode 100644 vendor/storj.io/uplink/private/eestream/encode.go delete mode 100644 vendor/storj.io/uplink/private/eestream/piecebuf.go delete mode 100644 vendor/storj.io/uplink/private/eestream/rs.go delete mode 100644 vendor/storj.io/uplink/private/eestream/stripe.go delete mode 100644 vendor/storj.io/uplink/private/eestream/unsafe_rs.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/batch.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/client.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/interface.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/metainfo.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/objects.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/paths.go delete mode 100644 vendor/storj.io/uplink/private/metainfo/stream.go delete mode 100644 vendor/storj.io/uplink/private/piecestore/buffering.go delete mode 100644 vendor/storj.io/uplink/private/piecestore/client.go delete mode 100644 vendor/storj.io/uplink/private/piecestore/download.go delete mode 100644 vendor/storj.io/uplink/private/piecestore/upload.go delete mode 100644 vendor/storj.io/uplink/private/piecestore/verification.go delete mode 100644 vendor/storj.io/uplink/private/storage/segments/common.go delete mode 100644 vendor/storj.io/uplink/private/storage/segments/size.go delete mode 100644 vendor/storj.io/uplink/private/storage/segments/store.go delete mode 100644 vendor/storj.io/uplink/private/storage/streams/eof.go delete mode 100644 vendor/storj.io/uplink/private/storage/streams/path.go delete mode 100644 vendor/storj.io/uplink/private/storage/streams/peek.go delete mode 100644 vendor/storj.io/uplink/private/storage/streams/shim.go delete mode 100644 vendor/storj.io/uplink/private/storage/streams/store.go delete mode 100644 vendor/storj.io/uplink/private/stream/common.go delete mode 100644 vendor/storj.io/uplink/private/stream/download.go delete mode 100644 vendor/storj.io/uplink/private/stream/upload.go delete mode 100644 vendor/storj.io/uplink/private/testuplink/uplink.go delete mode 100644 vendor/storj.io/uplink/project.go delete mode 100644 vendor/storj.io/uplink/upload.go diff --git a/vendor/bazil.org/fuse/.gitattributes b/vendor/bazil.org/fuse/.gitattributes deleted file mode 100644 index b65f2a9ff..000000000 --- a/vendor/bazil.org/fuse/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.go filter=gofmt -*.cgo filter=gofmt diff --git a/vendor/bazil.org/fuse/.gitignore b/vendor/bazil.org/fuse/.gitignore deleted file mode 100644 index 53589948c..000000000 --- a/vendor/bazil.org/fuse/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -*~ -.#* -## the next line needs to start with a backslash to avoid looking like -## a comment -\#*# -.*.swp - -*.test - -/clockfs -/hellofs diff --git a/vendor/bazil.org/fuse/LICENSE b/vendor/bazil.org/fuse/LICENSE deleted file mode 100644 index 70840eebc..000000000 --- a/vendor/bazil.org/fuse/LICENSE +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2013-2019 Tommi Virtanen. -Copyright (c) 2009, 2011, 2012 The Go Authors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -The following included software components have additional copyright -notices and license terms that may differ from the above. - - -File fuse.go: - -// Adapted from Plan 9 from User Space's src/cmd/9pfuse/fuse.c, -// which carries this notice: -// -// The files in this directory are subject to the following license. -// -// The author of this software is Russ Cox. -// -// Copyright (c) 2006 Russ Cox -// -// Permission to use, copy, modify, and distribute this software for any -// purpose without fee is hereby granted, provided that this entire notice -// is included in all copies of any software which is or includes a copy -// or modification of this software and in all copies of the supporting -// documentation for such software. -// -// THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION OR WARRANTY -// OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS -// FITNESS FOR ANY PARTICULAR PURPOSE. - - -File fuse_kernel.go: - -// Derived from FUSE's fuse_kernel.h -/* - This file defines the kernel interface of FUSE - Copyright (C) 2001-2007 Miklos Szeredi - - - This -- and only this -- header file may also be distributed under - the terms of the BSD Licence as follows: - - Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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/bazil.org/fuse/README.md b/vendor/bazil.org/fuse/README.md deleted file mode 100644 index 8c6d556ee..000000000 --- a/vendor/bazil.org/fuse/README.md +++ /dev/null @@ -1,23 +0,0 @@ -bazil.org/fuse -- Filesystems in Go -=================================== - -`bazil.org/fuse` is a Go library for writing FUSE userspace -filesystems. - -It is a from-scratch implementation of the kernel-userspace -communication protocol, and does not use the C library from the -project called FUSE. `bazil.org/fuse` embraces Go fully for safety and -ease of programming. - -Here’s how to get going: - - go get bazil.org/fuse - -Website: http://bazil.org/fuse/ - -Github repository: https://github.com/bazil/fuse - -API docs: http://godoc.org/bazil.org/fuse - -Our thanks to Russ Cox for his fuse library, which this project is -based on. diff --git a/vendor/bazil.org/fuse/buffer.go b/vendor/bazil.org/fuse/buffer.go deleted file mode 100644 index bb1d2b776..000000000 --- a/vendor/bazil.org/fuse/buffer.go +++ /dev/null @@ -1,35 +0,0 @@ -package fuse - -import "unsafe" - -// buffer provides a mechanism for constructing a message from -// multiple segments. -type buffer []byte - -// alloc allocates size bytes and returns a pointer to the new -// segment. -func (w *buffer) alloc(size uintptr) unsafe.Pointer { - s := int(size) - if len(*w)+s > cap(*w) { - old := *w - *w = make([]byte, len(*w), 2*cap(*w)+s) - copy(*w, old) - } - l := len(*w) - *w = (*w)[:l+s] - return unsafe.Pointer(&(*w)[l]) -} - -// reset clears out the contents of the buffer. -func (w *buffer) reset() { - for i := range (*w)[:cap(*w)] { - (*w)[i] = 0 - } - *w = (*w)[:0] -} - -func newBuffer(extra uintptr) buffer { - const hdrSize = unsafe.Sizeof(outHeader{}) - buf := make(buffer, hdrSize, hdrSize+extra) - return buf -} diff --git a/vendor/bazil.org/fuse/debug.go b/vendor/bazil.org/fuse/debug.go deleted file mode 100644 index be9f900d5..000000000 --- a/vendor/bazil.org/fuse/debug.go +++ /dev/null @@ -1,21 +0,0 @@ -package fuse - -import ( - "runtime" -) - -func stack() string { - buf := make([]byte, 1024) - return string(buf[:runtime.Stack(buf, false)]) -} - -func nop(msg interface{}) {} - -// Debug is called to output debug messages, including protocol -// traces. The default behavior is to do nothing. -// -// The messages have human-friendly string representations and are -// safe to marshal to JSON. -// -// Implementations must not retain msg. -var Debug func(msg interface{}) = nop diff --git a/vendor/bazil.org/fuse/error_darwin.go b/vendor/bazil.org/fuse/error_darwin.go deleted file mode 100644 index a3fb89ca2..000000000 --- a/vendor/bazil.org/fuse/error_darwin.go +++ /dev/null @@ -1,17 +0,0 @@ -package fuse - -import ( - "syscall" -) - -const ( - ENOATTR = Errno(syscall.ENOATTR) -) - -const ( - errNoXattr = ENOATTR -) - -func init() { - errnoNames[errNoXattr] = "ENOATTR" -} diff --git a/vendor/bazil.org/fuse/error_freebsd.go b/vendor/bazil.org/fuse/error_freebsd.go deleted file mode 100644 index c6ea6d6e7..000000000 --- a/vendor/bazil.org/fuse/error_freebsd.go +++ /dev/null @@ -1,15 +0,0 @@ -package fuse - -import "syscall" - -const ( - ENOATTR = Errno(syscall.ENOATTR) -) - -const ( - errNoXattr = ENOATTR -) - -func init() { - errnoNames[errNoXattr] = "ENOATTR" -} diff --git a/vendor/bazil.org/fuse/error_linux.go b/vendor/bazil.org/fuse/error_linux.go deleted file mode 100644 index 6f113e71e..000000000 --- a/vendor/bazil.org/fuse/error_linux.go +++ /dev/null @@ -1,17 +0,0 @@ -package fuse - -import ( - "syscall" -) - -const ( - ENODATA = Errno(syscall.ENODATA) -) - -const ( - errNoXattr = ENODATA -) - -func init() { - errnoNames[errNoXattr] = "ENODATA" -} diff --git a/vendor/bazil.org/fuse/error_std.go b/vendor/bazil.org/fuse/error_std.go deleted file mode 100644 index 398f43fbf..000000000 --- a/vendor/bazil.org/fuse/error_std.go +++ /dev/null @@ -1,31 +0,0 @@ -package fuse - -// There is very little commonality in extended attribute errors -// across platforms. -// -// getxattr return value for "extended attribute does not exist" is -// ENOATTR on OS X, and ENODATA on Linux and apparently at least -// NetBSD. There may be a #define ENOATTR on Linux too, but the value -// is ENODATA in the actual syscalls. FreeBSD and OpenBSD have no -// ENODATA, only ENOATTR. ENOATTR is not in any of the standards, -// ENODATA exists but is only used for STREAMs. -// -// Each platform will define it a errNoXattr constant, and this file -// will enforce that it implements the right interfaces and hide the -// implementation. -// -// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/getxattr.2.html -// http://mail-index.netbsd.org/tech-kern/2012/04/30/msg013090.html -// http://mail-index.netbsd.org/tech-kern/2012/04/30/msg013097.html -// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html -// http://www.freebsd.org/cgi/man.cgi?query=extattr_get_file&sektion=2 -// http://nixdoc.net/man-pages/openbsd/man2/extattr_get_file.2.html - -// ErrNoXattr is a platform-independent error value meaning the -// extended attribute was not found. It can be used to respond to -// GetxattrRequest and such. -const ErrNoXattr = errNoXattr - -var _ error = ErrNoXattr -var _ Errno = ErrNoXattr -var _ ErrorNumber = ErrNoXattr diff --git a/vendor/bazil.org/fuse/fs/serve.go b/vendor/bazil.org/fuse/fs/serve.go deleted file mode 100644 index b754e3f92..000000000 --- a/vendor/bazil.org/fuse/fs/serve.go +++ /dev/null @@ -1,1562 +0,0 @@ -// FUSE service loop, for servers that wish to use it. - -package fs // import "bazil.org/fuse/fs" - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "hash/fnv" - "io" - "log" - "reflect" - "runtime" - "strings" - "sync" - "syscall" - "time" - - "bazil.org/fuse" - "bazil.org/fuse/fuseutil" -) - -const ( - attrValidTime = 1 * time.Minute - entryValidTime = 1 * time.Minute -) - -// TODO: FINISH DOCS - -// An FS is the interface required of a file system. -// -// Other FUSE requests can be handled by implementing methods from the -// FS* interfaces, for example FSStatfser. -type FS interface { - // Root is called to obtain the Node for the file system root. - Root() (Node, error) -} - -type FSStatfser interface { - // Statfs is called to obtain file system metadata. - // It should write that data to resp. - Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error -} - -type FSDestroyer interface { - // Destroy is called when the file system is shutting down. - // - // Linux only sends this request for block device backed (fuseblk) - // filesystems, to allow them to flush writes to disk before the - // unmount completes. - Destroy() -} - -type FSInodeGenerator interface { - // GenerateInode is called to pick a dynamic inode number when it - // would otherwise be 0. - // - // Not all filesystems bother tracking inodes, but FUSE requires - // the inode to be set, and fewer duplicates in general makes UNIX - // tools work better. - // - // Operations where the nodes may return 0 inodes include Getattr, - // Setattr and ReadDir. - // - // If FS does not implement FSInodeGenerator, GenerateDynamicInode - // is used. - // - // Implementing this is useful to e.g. constrain the range of - // inode values used for dynamic inodes. - // - // Non-zero return values should be greater than 1, as that is - // always used for the root inode. - GenerateInode(parentInode uint64, name string) uint64 -} - -// A Node is the interface required of a file or directory. -// See the documentation for type FS for general information -// pertaining to all methods. -// -// A Node must be usable as a map key, that is, it cannot be a -// function, map or slice. -// -// Other FUSE requests can be handled by implementing methods from the -// Node* interfaces, for example NodeOpener. -// -// Methods returning Node should take care to return the same Node -// when the result is logically the same instance. Without this, each -// Node will get a new NodeID, causing spurious cache invalidations, -// extra lookups and aliasing anomalies. This may not matter for a -// simple, read-only filesystem. -type Node interface { - // Attr fills attr with the standard metadata for the node. - // - // Fields with reasonable defaults are prepopulated. For example, - // all times are set to a fixed moment when the program started. - // - // If Inode is left as 0, a dynamic inode number is chosen. - // - // The result may be cached for the duration set in Valid. - Attr(ctx context.Context, attr *fuse.Attr) error -} - -type NodeGetattrer interface { - // Getattr obtains the standard metadata for the receiver. - // It should store that metadata in resp. - // - // If this method is not implemented, the attributes will be - // generated based on Attr(), with zero values filled in. - Getattr(ctx context.Context, req *fuse.GetattrRequest, resp *fuse.GetattrResponse) error -} - -type NodeSetattrer interface { - // Setattr sets the standard metadata for the receiver. - // - // Note, this is also used to communicate changes in the size of - // the file, outside of Writes. - // - // req.Valid is a bitmask of what fields are actually being set. - // For example, the method should not change the mode of the file - // unless req.Valid.Mode() is true. - Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error -} - -type NodeSymlinker interface { - // Symlink creates a new symbolic link in the receiver, which must be a directory. - // - // TODO is the above true about directories? - Symlink(ctx context.Context, req *fuse.SymlinkRequest) (Node, error) -} - -// This optional request will be called only for symbolic link nodes. -type NodeReadlinker interface { - // Readlink reads a symbolic link. - Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) -} - -type NodeLinker interface { - // Link creates a new directory entry in the receiver based on an - // existing Node. Receiver must be a directory. - Link(ctx context.Context, req *fuse.LinkRequest, old Node) (Node, error) -} - -type NodeRemover interface { - // Remove removes the entry with the given name from - // the receiver, which must be a directory. The entry to be removed - // may correspond to a file (unlink) or to a directory (rmdir). - Remove(ctx context.Context, req *fuse.RemoveRequest) error -} - -type NodeAccesser interface { - // Access checks whether the calling context has permission for - // the given operations on the receiver. If so, Access should - // return nil. If not, Access should return EPERM. - // - // Note that this call affects the result of the access(2) system - // call but not the open(2) system call. If Access is not - // implemented, the Node behaves as if it always returns nil - // (permission granted), relying on checks in Open instead. - Access(ctx context.Context, req *fuse.AccessRequest) error -} - -type NodeStringLookuper interface { - // Lookup looks up a specific entry in the receiver, - // which must be a directory. Lookup should return a Node - // corresponding to the entry. If the name does not exist in - // the directory, Lookup should return ENOENT. - // - // Lookup need not to handle the names "." and "..". - Lookup(ctx context.Context, name string) (Node, error) -} - -type NodeRequestLookuper interface { - // Lookup looks up a specific entry in the receiver. - // See NodeStringLookuper for more. - Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (Node, error) -} - -type NodeMkdirer interface { - Mkdir(ctx context.Context, req *fuse.MkdirRequest) (Node, error) -} - -type NodeOpener interface { - // Open opens the receiver. After a successful open, a client - // process has a file descriptor referring to this Handle. - // - // Open can also be also called on non-files. For example, - // directories are Opened for ReadDir or fchdir(2). - // - // If this method is not implemented, the open will always - // succeed, and the Node itself will be used as the Handle. - // - // XXX note about access. XXX OpenFlags. - Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (Handle, error) -} - -type NodeCreater interface { - // Create creates a new directory entry in the receiver, which - // must be a directory. - Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (Node, Handle, error) -} - -type NodeForgetter interface { - // Forget about this node. This node will not receive further - // method calls. - // - // Forget is not necessarily seen on unmount, as all nodes are - // implicitly forgotten as part of the unmount. - Forget() -} - -type NodeRenamer interface { - Rename(ctx context.Context, req *fuse.RenameRequest, newDir Node) error -} - -type NodeMknoder interface { - Mknod(ctx context.Context, req *fuse.MknodRequest) (Node, error) -} - -// TODO this should be on Handle not Node -type NodeFsyncer interface { - Fsync(ctx context.Context, req *fuse.FsyncRequest) error -} - -type NodeGetxattrer interface { - // Getxattr gets an extended attribute by the given name from the - // node. - // - // If there is no xattr by that name, returns fuse.ErrNoXattr. - Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error -} - -type NodeListxattrer interface { - // Listxattr lists the extended attributes recorded for the node. - Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error -} - -type NodeSetxattrer interface { - // Setxattr sets an extended attribute with the given name and - // value for the node. - Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error -} - -type NodeRemovexattrer interface { - // Removexattr removes an extended attribute for the name. - // - // If there is no xattr by that name, returns fuse.ErrNoXattr. - Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error -} - -var startTime = time.Now() - -func nodeAttr(ctx context.Context, n Node, attr *fuse.Attr) error { - attr.Valid = attrValidTime - attr.Nlink = 1 - attr.Atime = startTime - attr.Mtime = startTime - attr.Ctime = startTime - attr.Crtime = startTime - if err := n.Attr(ctx, attr); err != nil { - return err - } - return nil -} - -// A Handle is the interface required of an opened file or directory. -// See the documentation for type FS for general information -// pertaining to all methods. -// -// Other FUSE requests can be handled by implementing methods from the -// Handle* interfaces. The most common to implement are HandleReader, -// HandleReadDirer, and HandleWriter. -// -// TODO implement methods: Getlk, Setlk, Setlkw -type Handle interface { -} - -type HandleFlusher interface { - // Flush is called each time the file or directory is closed. - // Because there can be multiple file descriptors referring to a - // single opened file, Flush can be called multiple times. - Flush(ctx context.Context, req *fuse.FlushRequest) error -} - -type HandleReadAller interface { - ReadAll(ctx context.Context) ([]byte, error) -} - -type HandleReadDirAller interface { - ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) -} - -type HandleReader interface { - // Read requests to read data from the handle. - // - // There is a page cache in the kernel that normally submits only - // page-aligned reads spanning one or more pages. However, you - // should not rely on this. To see individual requests as - // submitted by the file system clients, set OpenDirectIO. - // - // Note that reads beyond the size of the file as reported by Attr - // are not even attempted (except in OpenDirectIO mode). - Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error -} - -type HandleWriter interface { - // Write requests to write data into the handle at the given offset. - // Store the amount of data written in resp.Size. - // - // There is a writeback page cache in the kernel that normally submits - // only page-aligned writes spanning one or more pages. However, - // you should not rely on this. To see individual requests as - // submitted by the file system clients, set OpenDirectIO. - // - // Writes that grow the file are expected to update the file size - // (as seen through Attr). Note that file size changes are - // communicated also through Setattr. - Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error -} - -type HandleReleaser interface { - Release(ctx context.Context, req *fuse.ReleaseRequest) error -} - -type Config struct { - // Function to send debug log messages to. If nil, use fuse.Debug. - // Note that changing this or fuse.Debug may not affect existing - // calls to Serve. - // - // See fuse.Debug for the rules that log functions must follow. - Debug func(msg interface{}) - - // Function to put things into context for processing the request. - // The returned context must have ctx as its parent. - // - // Note that changing this may not affect existing calls to Serve. - // - // Must not retain req. - WithContext func(ctx context.Context, req fuse.Request) context.Context -} - -// New returns a new FUSE server ready to serve this kernel FUSE -// connection. -// -// Config may be nil. -func New(conn *fuse.Conn, config *Config) *Server { - s := &Server{ - conn: conn, - req: map[fuse.RequestID]*serveRequest{}, - nodeRef: map[Node]fuse.NodeID{}, - dynamicInode: GenerateDynamicInode, - } - if config != nil { - s.debug = config.Debug - s.context = config.WithContext - } - if s.debug == nil { - s.debug = fuse.Debug - } - return s -} - -type Server struct { - // set in New - conn *fuse.Conn - debug func(msg interface{}) - context func(ctx context.Context, req fuse.Request) context.Context - - // set once at Serve time - fs FS - dynamicInode func(parent uint64, name string) uint64 - - // state, protected by meta - meta sync.Mutex - req map[fuse.RequestID]*serveRequest - node []*serveNode - nodeRef map[Node]fuse.NodeID - handle []*serveHandle - freeNode []fuse.NodeID - freeHandle []fuse.HandleID - nodeGen uint64 - - // Used to ensure worker goroutines finish before Serve returns - wg sync.WaitGroup -} - -// Serve serves the FUSE connection by making calls to the methods -// of fs and the Nodes and Handles it makes available. It returns only -// when the connection has been closed or an unexpected error occurs. -func (s *Server) Serve(fs FS) error { - defer s.wg.Wait() // Wait for worker goroutines to complete before return - - s.fs = fs - if dyn, ok := fs.(FSInodeGenerator); ok { - s.dynamicInode = dyn.GenerateInode - } - - root, err := fs.Root() - if err != nil { - return fmt.Errorf("cannot obtain root node: %v", err) - } - // Recognize the root node if it's ever returned from Lookup, - // passed to Invalidate, etc. - s.nodeRef[root] = 1 - s.node = append(s.node, nil, &serveNode{ - inode: 1, - generation: s.nodeGen, - node: root, - refs: 1, - }) - s.handle = append(s.handle, nil) - - for { - req, err := s.conn.ReadRequest() - if err != nil { - if err == io.EOF { - break - } - return err - } - - s.wg.Add(1) - go func() { - defer s.wg.Done() - s.serve(req) - }() - } - return nil -} - -// Serve serves a FUSE connection with the default settings. See -// Server.Serve. -func Serve(c *fuse.Conn, fs FS) error { - server := New(c, nil) - return server.Serve(fs) -} - -type serveRequest struct { - Request fuse.Request - cancel func() -} - -type serveNode struct { - inode uint64 - generation uint64 - node Node - refs uint64 - - // Delay freeing the NodeID until waitgroup is done. This allows - // using the NodeID for short periods of time without holding the - // Server.meta lock. - // - // Rules: - // - // - hold Server.meta while calling wg.Add, then unlock - // - do NOT try to reacquire Server.meta - wg sync.WaitGroup -} - -func (sn *serveNode) attr(ctx context.Context, attr *fuse.Attr) error { - err := nodeAttr(ctx, sn.node, attr) - if attr.Inode == 0 { - attr.Inode = sn.inode - } - return err -} - -type serveHandle struct { - handle Handle - readData []byte -} - -// NodeRef is deprecated. It remains here to decrease code churn on -// FUSE library users. You may remove it from your program now; -// returning the same Node values are now recognized automatically, -// without needing NodeRef. -type NodeRef struct{} - -func (c *Server) saveNode(inode uint64, node Node) (id fuse.NodeID, gen uint64) { - c.meta.Lock() - defer c.meta.Unlock() - - if id, ok := c.nodeRef[node]; ok { - sn := c.node[id] - sn.refs++ - return id, sn.generation - } - - sn := &serveNode{inode: inode, node: node, refs: 1} - if n := len(c.freeNode); n > 0 { - id = c.freeNode[n-1] - c.freeNode = c.freeNode[:n-1] - c.node[id] = sn - c.nodeGen++ - } else { - id = fuse.NodeID(len(c.node)) - c.node = append(c.node, sn) - } - sn.generation = c.nodeGen - c.nodeRef[node] = id - return id, sn.generation -} - -func (c *Server) saveHandle(handle Handle) (id fuse.HandleID) { - c.meta.Lock() - shandle := &serveHandle{handle: handle} - if n := len(c.freeHandle); n > 0 { - id = c.freeHandle[n-1] - c.freeHandle = c.freeHandle[:n-1] - c.handle[id] = shandle - } else { - id = fuse.HandleID(len(c.handle)) - c.handle = append(c.handle, shandle) - } - c.meta.Unlock() - return -} - -type nodeRefcountDropBug struct { - N uint64 - Refs uint64 - Node fuse.NodeID -} - -func (n *nodeRefcountDropBug) String() string { - return fmt.Sprintf("bug: trying to drop %d of %d references to %v", n.N, n.Refs, n.Node) -} - -func (c *Server) dropNode(id fuse.NodeID, n uint64) (forget bool) { - c.meta.Lock() - defer c.meta.Unlock() - snode := c.node[id] - - if snode == nil { - // this should only happen if refcounts kernel<->us disagree - // *and* two ForgetRequests for the same node race each other; - // this indicates a bug somewhere - c.debug(nodeRefcountDropBug{N: n, Node: id}) - - // we may end up triggering Forget twice, but that's better - // than not even once, and that's the best we can do - return true - } - - if n > snode.refs { - c.debug(nodeRefcountDropBug{N: n, Refs: snode.refs, Node: id}) - n = snode.refs - } - - snode.refs -= n - if snode.refs == 0 { - snode.wg.Wait() - c.node[id] = nil - delete(c.nodeRef, snode.node) - c.freeNode = append(c.freeNode, id) - return true - } - return false -} - -func (c *Server) dropHandle(id fuse.HandleID) { - c.meta.Lock() - c.handle[id] = nil - c.freeHandle = append(c.freeHandle, id) - c.meta.Unlock() -} - -type missingHandle struct { - Handle fuse.HandleID - MaxHandle fuse.HandleID -} - -func (m missingHandle) String() string { - return fmt.Sprint("missing handle: ", m.Handle, m.MaxHandle) -} - -// Returns nil for invalid handles. -func (c *Server) getHandle(id fuse.HandleID) (shandle *serveHandle) { - c.meta.Lock() - defer c.meta.Unlock() - if id < fuse.HandleID(len(c.handle)) { - shandle = c.handle[uint(id)] - } - if shandle == nil { - c.debug(missingHandle{ - Handle: id, - MaxHandle: fuse.HandleID(len(c.handle)), - }) - } - return -} - -type request struct { - Op string - Request *fuse.Header - In interface{} `json:",omitempty"` -} - -func (r request) String() string { - return fmt.Sprintf("<- %s", r.In) -} - -type logResponseHeader struct { - ID fuse.RequestID -} - -func (m logResponseHeader) String() string { - return fmt.Sprintf("ID=%v", m.ID) -} - -type response struct { - Op string - Request logResponseHeader - Out interface{} `json:",omitempty"` - // Errno contains the errno value as a string, for example "EPERM". - Errno string `json:",omitempty"` - // Error may contain a free form error message. - Error string `json:",omitempty"` -} - -func (r response) errstr() string { - s := r.Errno - if r.Error != "" { - // prefix the errno constant to the long form message - s = s + ": " + r.Error - } - return s -} - -func (r response) String() string { - switch { - case r.Errno != "" && r.Out != nil: - return fmt.Sprintf("-> [%v] %v error=%s", r.Request, r.Out, r.errstr()) - case r.Errno != "": - return fmt.Sprintf("-> [%v] %s error=%s", r.Request, r.Op, r.errstr()) - case r.Out != nil: - // make sure (seemingly) empty values are readable - switch r.Out.(type) { - case string: - return fmt.Sprintf("-> [%v] %s %q", r.Request, r.Op, r.Out) - case []byte: - return fmt.Sprintf("-> [%v] %s [% x]", r.Request, r.Op, r.Out) - default: - return fmt.Sprintf("-> [%v] %v", r.Request, r.Out) - } - default: - return fmt.Sprintf("-> [%v] %s", r.Request, r.Op) - } -} - -type notification struct { - Op string - Node fuse.NodeID - Out interface{} `json:",omitempty"` - Err string `json:",omitempty"` -} - -func (n notification) String() string { - var buf bytes.Buffer - fmt.Fprintf(&buf, "=> %s %v", n.Op, n.Node) - if n.Out != nil { - // make sure (seemingly) empty values are readable - switch n.Out.(type) { - case string: - fmt.Fprintf(&buf, " %q", n.Out) - case []byte: - fmt.Fprintf(&buf, " [% x]", n.Out) - default: - fmt.Fprintf(&buf, " %s", n.Out) - } - } - if n.Err != "" { - fmt.Fprintf(&buf, " Err:%v", n.Err) - } - return buf.String() -} - -type logMissingNode struct { - MaxNode fuse.NodeID -} - -func opName(req fuse.Request) string { - t := reflect.Indirect(reflect.ValueOf(req)).Type() - s := t.Name() - s = strings.TrimSuffix(s, "Request") - return s -} - -type logLinkRequestOldNodeNotFound struct { - Request *fuse.Header - In *fuse.LinkRequest -} - -func (m *logLinkRequestOldNodeNotFound) String() string { - return fmt.Sprintf("In LinkRequest (request %v), node %d not found", m.Request.Hdr().ID, m.In.OldNode) -} - -type renameNewDirNodeNotFound struct { - Request *fuse.Header - In *fuse.RenameRequest -} - -func (m *renameNewDirNodeNotFound) String() string { - return fmt.Sprintf("In RenameRequest (request %v), node %d not found", m.Request.Hdr().ID, m.In.NewDir) -} - -type handlerPanickedError struct { - Request interface{} - Err interface{} -} - -var _ error = handlerPanickedError{} - -func (h handlerPanickedError) Error() string { - return fmt.Sprintf("handler panicked: %v", h.Err) -} - -var _ fuse.ErrorNumber = handlerPanickedError{} - -func (h handlerPanickedError) Errno() fuse.Errno { - if err, ok := h.Err.(fuse.ErrorNumber); ok { - return err.Errno() - } - return fuse.DefaultErrno -} - -// handlerTerminatedError happens when a handler terminates itself -// with runtime.Goexit. This is most commonly because of incorrect use -// of testing.TB.FailNow, typically via t.Fatal. -type handlerTerminatedError struct { - Request interface{} -} - -var _ error = handlerTerminatedError{} - -func (h handlerTerminatedError) Error() string { - return fmt.Sprintf("handler terminated (called runtime.Goexit)") -} - -var _ fuse.ErrorNumber = handlerTerminatedError{} - -func (h handlerTerminatedError) Errno() fuse.Errno { - return fuse.DefaultErrno -} - -type handleNotReaderError struct { - handle Handle -} - -var _ error = handleNotReaderError{} - -func (e handleNotReaderError) Error() string { - return fmt.Sprintf("handle has no Read: %T", e.handle) -} - -var _ fuse.ErrorNumber = handleNotReaderError{} - -func (e handleNotReaderError) Errno() fuse.Errno { - return fuse.Errno(syscall.ENOTSUP) -} - -func initLookupResponse(s *fuse.LookupResponse) { - s.EntryValid = entryValidTime -} - -func (c *Server) serve(r fuse.Request) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - parentCtx := ctx - if c.context != nil { - ctx = c.context(ctx, r) - } - - req := &serveRequest{Request: r, cancel: cancel} - - c.debug(request{ - Op: opName(r), - Request: r.Hdr(), - In: r, - }) - var node Node - var snode *serveNode - c.meta.Lock() - hdr := r.Hdr() - if id := hdr.Node; id != 0 { - if id < fuse.NodeID(len(c.node)) { - snode = c.node[uint(id)] - } - if snode == nil { - c.meta.Unlock() - err := syscall.ESTALE - c.debug(response{ - Op: opName(r), - Request: logResponseHeader{ID: hdr.ID}, - Error: fuse.Errno(err).ErrnoName(), - // this is the only place that sets both Error and - // Out; not sure if i want to do that; might get rid - // of len(c.node) things altogether - Out: logMissingNode{ - MaxNode: fuse.NodeID(len(c.node)), - }, - }) - r.RespondError(err) - return - } - node = snode.node - } - if c.req[hdr.ID] != nil { - // This happens with OSXFUSE. Assume it's okay and - // that we'll never see an interrupt for this one. - // Otherwise everything wedges. TODO: Report to OSXFUSE? - // - // TODO this might have been because of missing done() calls - } else { - c.req[hdr.ID] = req - } - c.meta.Unlock() - - // Call this before responding. - // After responding is too late: we might get another request - // with the same ID and be very confused. - done := func(resp interface{}) { - msg := response{ - Op: opName(r), - Request: logResponseHeader{ID: hdr.ID}, - } - if err, ok := resp.(error); ok { - errno := fuse.ToErrno(err) - msg.Errno = errno.ErrnoName() - if errno != err && syscall.Errno(errno) != err { - // if it's more than just a fuse.Errno or a - // syscall.Errno, log extra detail - msg.Error = err.Error() - } - } else { - msg.Out = resp - } - c.debug(msg) - - c.meta.Lock() - delete(c.req, hdr.ID) - c.meta.Unlock() - } - - var responded bool - defer func() { - if rec := recover(); rec != nil { - const size = 1 << 16 - buf := make([]byte, size) - n := runtime.Stack(buf, false) - buf = buf[:n] - log.Printf("fuse: panic in handler for %v: %v\n%s", r, rec, buf) - err := handlerPanickedError{ - Request: r, - Err: rec, - } - done(err) - r.RespondError(err) - return - } - - if !responded { - err := handlerTerminatedError{ - Request: r, - } - done(err) - r.RespondError(err) - } - }() - - if err := c.handleRequest(ctx, node, snode, r, done); err != nil { - if err == context.Canceled { - select { - case <-parentCtx.Done(): - // We canceled the parent context because of an - // incoming interrupt request, so return EINTR - // to trigger the right behavior in the client app. - // - // Only do this when it's the parent context that was - // canceled, not a context controlled by the program - // using this library, so we don't return EINTR too - // eagerly -- it might cause busy loops. - // - // Decent write-up on role of EINTR: - // http://250bpm.com/blog:12 - err = syscall.EINTR - default: - // nothing - } - } - done(err) - r.RespondError(err) - } - - // disarm runtime.Goexit protection - responded = true -} - -// handleRequest will either a) call done(s) and r.Respond(s) OR b) return an error. -func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, r fuse.Request, done func(resp interface{})) error { - switch r := r.(type) { - default: - // Note: To FUSE, ENOSYS means "this server never implements this request." - // It would be inappropriate to return ENOSYS for other operations in this - // switch that might only be unavailable in some contexts, not all. - return syscall.ENOSYS - - case *fuse.StatfsRequest: - s := &fuse.StatfsResponse{} - if fs, ok := c.fs.(FSStatfser); ok { - if err := fs.Statfs(ctx, r, s); err != nil { - return err - } - } - done(s) - r.Respond(s) - return nil - - // Node operations. - case *fuse.GetattrRequest: - s := &fuse.GetattrResponse{} - if n, ok := node.(NodeGetattrer); ok { - if err := n.Getattr(ctx, r, s); err != nil { - return err - } - } else { - if err := snode.attr(ctx, &s.Attr); err != nil { - return err - } - } - done(s) - r.Respond(s) - return nil - - case *fuse.SetattrRequest: - s := &fuse.SetattrResponse{} - if n, ok := node.(NodeSetattrer); ok { - if err := n.Setattr(ctx, r, s); err != nil { - return err - } - } - - if err := snode.attr(ctx, &s.Attr); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.SymlinkRequest: - s := &fuse.SymlinkResponse{} - initLookupResponse(&s.LookupResponse) - n, ok := node.(NodeSymlinker) - if !ok { - return syscall.EIO // XXX or EPERM like Mkdir? - } - n2, err := n.Symlink(ctx, r) - if err != nil { - return err - } - if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.NewName, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.ReadlinkRequest: - n, ok := node.(NodeReadlinker) - if !ok { - return syscall.EIO /// XXX or EPERM? - } - target, err := n.Readlink(ctx, r) - if err != nil { - return err - } - done(target) - r.Respond(target) - return nil - - case *fuse.LinkRequest: - n, ok := node.(NodeLinker) - if !ok { - return syscall.EIO /// XXX or EPERM? - } - c.meta.Lock() - var oldNode *serveNode - if int(r.OldNode) < len(c.node) { - oldNode = c.node[r.OldNode] - } - c.meta.Unlock() - if oldNode == nil { - c.debug(logLinkRequestOldNodeNotFound{ - Request: r.Hdr(), - In: r, - }) - return syscall.EIO - } - n2, err := n.Link(ctx, r, oldNode.node) - if err != nil { - return err - } - s := &fuse.LookupResponse{} - initLookupResponse(s) - if err := c.saveLookup(ctx, s, snode, r.NewName, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.RemoveRequest: - n, ok := node.(NodeRemover) - if !ok { - return syscall.EIO /// XXX or EPERM? - } - err := n.Remove(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.AccessRequest: - if n, ok := node.(NodeAccesser); ok { - if err := n.Access(ctx, r); err != nil { - return err - } - } - done(nil) - r.Respond() - return nil - - case *fuse.LookupRequest: - var n2 Node - var err error - s := &fuse.LookupResponse{} - initLookupResponse(s) - if n, ok := node.(NodeStringLookuper); ok { - n2, err = n.Lookup(ctx, r.Name) - } else if n, ok := node.(NodeRequestLookuper); ok { - n2, err = n.Lookup(ctx, r, s) - } else { - return syscall.ENOENT - } - if err != nil { - return err - } - if err := c.saveLookup(ctx, s, snode, r.Name, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.MkdirRequest: - s := &fuse.MkdirResponse{} - initLookupResponse(&s.LookupResponse) - n, ok := node.(NodeMkdirer) - if !ok { - return syscall.EPERM - } - n2, err := n.Mkdir(ctx, r) - if err != nil { - return err - } - if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.OpenRequest: - s := &fuse.OpenResponse{} - var h2 Handle - if n, ok := node.(NodeOpener); ok { - hh, err := n.Open(ctx, r, s) - if err != nil { - return err - } - h2 = hh - } else { - h2 = node - } - s.Handle = c.saveHandle(h2) - done(s) - r.Respond(s) - return nil - - case *fuse.CreateRequest: - n, ok := node.(NodeCreater) - if !ok { - // If we send back ENOSYS, FUSE will try mknod+open. - return syscall.EPERM - } - s := &fuse.CreateResponse{OpenResponse: fuse.OpenResponse{}} - initLookupResponse(&s.LookupResponse) - n2, h2, err := n.Create(ctx, r, s) - if err != nil { - return err - } - if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { - return err - } - s.Handle = c.saveHandle(h2) - done(s) - r.Respond(s) - return nil - - case *fuse.GetxattrRequest: - n, ok := node.(NodeGetxattrer) - if !ok { - return syscall.ENOTSUP - } - s := &fuse.GetxattrResponse{} - err := n.Getxattr(ctx, r, s) - if err != nil { - return err - } - if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { - return syscall.ERANGE - } - done(s) - r.Respond(s) - return nil - - case *fuse.ListxattrRequest: - n, ok := node.(NodeListxattrer) - if !ok { - return syscall.ENOTSUP - } - s := &fuse.ListxattrResponse{} - err := n.Listxattr(ctx, r, s) - if err != nil { - return err - } - if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { - return syscall.ERANGE - } - done(s) - r.Respond(s) - return nil - - case *fuse.SetxattrRequest: - n, ok := node.(NodeSetxattrer) - if !ok { - return syscall.ENOTSUP - } - err := n.Setxattr(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.RemovexattrRequest: - n, ok := node.(NodeRemovexattrer) - if !ok { - return syscall.ENOTSUP - } - err := n.Removexattr(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.ForgetRequest: - forget := c.dropNode(r.Hdr().Node, r.N) - if forget { - n, ok := node.(NodeForgetter) - if ok { - n.Forget() - } - } - done(nil) - r.Respond() - return nil - - // Handle operations. - case *fuse.ReadRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return syscall.ESTALE - } - handle := shandle.handle - - s := &fuse.ReadResponse{Data: make([]byte, 0, r.Size)} - if r.Dir { - if h, ok := handle.(HandleReadDirAller); ok { - // detect rewinddir(3) or similar seek and refresh - // contents - if r.Offset == 0 { - shandle.readData = nil - } - - if shandle.readData == nil { - dirs, err := h.ReadDirAll(ctx) - if err != nil { - return err - } - var data []byte - for _, dir := range dirs { - if dir.Inode == 0 { - dir.Inode = c.dynamicInode(snode.inode, dir.Name) - } - data = fuse.AppendDirent(data, dir) - } - shandle.readData = data - } - fuseutil.HandleRead(r, s, shandle.readData) - done(s) - r.Respond(s) - return nil - } - } else { - if h, ok := handle.(HandleReadAller); ok { - if shandle.readData == nil { - data, err := h.ReadAll(ctx) - if err != nil { - return err - } - if data == nil { - data = []byte{} - } - shandle.readData = data - } - fuseutil.HandleRead(r, s, shandle.readData) - done(s) - r.Respond(s) - return nil - } - h, ok := handle.(HandleReader) - if !ok { - err := handleNotReaderError{handle: handle} - return err - } - if err := h.Read(ctx, r, s); err != nil { - return err - } - } - done(s) - r.Respond(s) - return nil - - case *fuse.WriteRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return syscall.ESTALE - } - - s := &fuse.WriteResponse{} - if h, ok := shandle.handle.(HandleWriter); ok { - if err := h.Write(ctx, r, s); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - } - return syscall.EIO - - case *fuse.FlushRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return syscall.ESTALE - } - handle := shandle.handle - - if h, ok := handle.(HandleFlusher); ok { - if err := h.Flush(ctx, r); err != nil { - return err - } - } - done(nil) - r.Respond() - return nil - - case *fuse.ReleaseRequest: - shandle := c.getHandle(r.Handle) - if shandle == nil { - return syscall.ESTALE - } - handle := shandle.handle - - // No matter what, release the handle. - c.dropHandle(r.Handle) - - if h, ok := handle.(HandleReleaser); ok { - if err := h.Release(ctx, r); err != nil { - return err - } - } - done(nil) - r.Respond() - return nil - - case *fuse.DestroyRequest: - if fs, ok := c.fs.(FSDestroyer); ok { - fs.Destroy() - } - done(nil) - r.Respond() - return nil - - case *fuse.RenameRequest: - c.meta.Lock() - var newDirNode *serveNode - if int(r.NewDir) < len(c.node) { - newDirNode = c.node[r.NewDir] - } - c.meta.Unlock() - if newDirNode == nil { - c.debug(renameNewDirNodeNotFound{ - Request: r.Hdr(), - In: r, - }) - return syscall.EIO - } - n, ok := node.(NodeRenamer) - if !ok { - return syscall.EIO // XXX or EPERM like Mkdir? - } - err := n.Rename(ctx, r, newDirNode.node) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.MknodRequest: - n, ok := node.(NodeMknoder) - if !ok { - return syscall.EIO - } - n2, err := n.Mknod(ctx, r) - if err != nil { - return err - } - s := &fuse.LookupResponse{} - initLookupResponse(s) - if err := c.saveLookup(ctx, s, snode, r.Name, n2); err != nil { - return err - } - done(s) - r.Respond(s) - return nil - - case *fuse.FsyncRequest: - n, ok := node.(NodeFsyncer) - if !ok { - return syscall.EIO - } - err := n.Fsync(ctx, r) - if err != nil { - return err - } - done(nil) - r.Respond() - return nil - - case *fuse.InterruptRequest: - c.meta.Lock() - ireq := c.req[r.IntrID] - if ireq != nil && ireq.cancel != nil { - ireq.cancel() - ireq.cancel = nil - } - c.meta.Unlock() - done(nil) - r.Respond() - return nil - - /* case *FsyncdirRequest: - return ENOSYS - - case *GetlkRequest, *SetlkRequest, *SetlkwRequest: - return ENOSYS - - case *BmapRequest: - return ENOSYS - - case *SetvolnameRequest, *GetxtimesRequest, *ExchangeRequest: - return ENOSYS - */ - } - - panic("not reached") -} - -func (c *Server) saveLookup(ctx context.Context, s *fuse.LookupResponse, snode *serveNode, elem string, n2 Node) error { - if err := nodeAttr(ctx, n2, &s.Attr); err != nil { - return err - } - if s.Attr.Inode == 0 { - s.Attr.Inode = c.dynamicInode(snode.inode, elem) - } - - s.Node, s.Generation = c.saveNode(s.Attr.Inode, n2) - return nil -} - -type invalidateNodeDetail struct { - Off int64 - Size int64 -} - -func (i invalidateNodeDetail) String() string { - return fmt.Sprintf("Off:%d Size:%d", i.Off, i.Size) -} - -func errstr(err error) string { - if err == nil { - return "" - } - return err.Error() -} - -func (s *Server) invalidateNode(node Node, off int64, size int64) error { - s.meta.Lock() - id, ok := s.nodeRef[node] - if ok { - snode := s.node[id] - snode.wg.Add(1) - defer snode.wg.Done() - } - s.meta.Unlock() - if !ok { - // This is what the kernel would have said, if we had been - // able to send this message; it's not cached. - return fuse.ErrNotCached - } - // Delay logging until after we can record the error too. We - // consider a /dev/fuse write to be instantaneous enough to not - // need separate before and after messages. - err := s.conn.InvalidateNode(id, off, size) - s.debug(notification{ - Op: "InvalidateNode", - Node: id, - Out: invalidateNodeDetail{ - Off: off, - Size: size, - }, - Err: errstr(err), - }) - return err -} - -// InvalidateNodeAttr invalidates the kernel cache of the attributes -// of node. -// -// Returns fuse.ErrNotCached if the kernel is not currently caching -// the node. -func (s *Server) InvalidateNodeAttr(node Node) error { - return s.invalidateNode(node, 0, 0) -} - -// InvalidateNodeData invalidates the kernel cache of the attributes -// and data of node. -// -// Returns fuse.ErrNotCached if the kernel is not currently caching -// the node. -func (s *Server) InvalidateNodeData(node Node) error { - return s.invalidateNode(node, 0, -1) -} - -// InvalidateNodeDataRange invalidates the kernel cache of the -// attributes and a range of the data of node. -// -// Returns fuse.ErrNotCached if the kernel is not currently caching -// the node. -func (s *Server) InvalidateNodeDataRange(node Node, off int64, size int64) error { - return s.invalidateNode(node, off, size) -} - -type invalidateEntryDetail struct { - Name string -} - -func (i invalidateEntryDetail) String() string { - return fmt.Sprintf("%q", i.Name) -} - -// InvalidateEntry invalidates the kernel cache of the directory entry -// identified by parent node and entry basename. -// -// Kernel may or may not cache directory listings. To invalidate -// those, use InvalidateNode to invalidate all of the data for a -// directory. (As of 2015-06, Linux FUSE does not cache directory -// listings.) -// -// Returns ErrNotCached if the kernel is not currently caching the -// node. -func (s *Server) InvalidateEntry(parent Node, name string) error { - s.meta.Lock() - id, ok := s.nodeRef[parent] - if ok { - snode := s.node[id] - snode.wg.Add(1) - defer snode.wg.Done() - } - s.meta.Unlock() - if !ok { - // This is what the kernel would have said, if we had been - // able to send this message; it's not cached. - return fuse.ErrNotCached - } - err := s.conn.InvalidateEntry(id, name) - s.debug(notification{ - Op: "InvalidateEntry", - Node: id, - Out: invalidateEntryDetail{ - Name: name, - }, - Err: errstr(err), - }) - return err -} - -// DataHandle returns a read-only Handle that satisfies reads -// using the given data. -func DataHandle(data []byte) Handle { - return &dataHandle{data} -} - -type dataHandle struct { - data []byte -} - -func (d *dataHandle) ReadAll(ctx context.Context) ([]byte, error) { - return d.data, nil -} - -// GenerateDynamicInode returns a dynamic inode. -// -// The parent inode and current entry name are used as the criteria -// for choosing a pseudorandom inode. This makes it likely the same -// entry will get the same inode on multiple runs. -func GenerateDynamicInode(parent uint64, name string) uint64 { - h := fnv.New64a() - var buf [8]byte - binary.LittleEndian.PutUint64(buf[:], parent) - _, _ = h.Write(buf[:]) - _, _ = h.Write([]byte(name)) - var inode uint64 - for { - inode = h.Sum64() - if inode > 1 { - break - } - // there's a tiny probability that result is zero or the - // hardcoded root inode 1; change the input a little and try - // again - _, _ = h.Write([]byte{'x'}) - } - return inode -} diff --git a/vendor/bazil.org/fuse/fs/tree.go b/vendor/bazil.org/fuse/fs/tree.go deleted file mode 100644 index 329be1389..000000000 --- a/vendor/bazil.org/fuse/fs/tree.go +++ /dev/null @@ -1,97 +0,0 @@ -// FUSE directory tree, for servers that wish to use it with the service loop. - -package fs - -import ( - "context" - "os" - pathpkg "path" - "strings" - "syscall" - - "bazil.org/fuse" -) - -// A Tree implements a basic read-only directory tree for FUSE. -// The Nodes contained in it may still be writable. -type Tree struct { - tree -} - -func (t *Tree) Root() (Node, error) { - return &t.tree, nil -} - -// Add adds the path to the tree, resolving to the given node. -// If path or a prefix of path has already been added to the tree, -// Add panics. -// -// Add is only safe to call before starting to serve requests. -func (t *Tree) Add(path string, node Node) { - path = pathpkg.Clean("/" + path)[1:] - elems := strings.Split(path, "/") - dir := Node(&t.tree) - for i, elem := range elems { - dt, ok := dir.(*tree) - if !ok { - panic("fuse: Tree.Add for " + strings.Join(elems[:i], "/") + " and " + path) - } - n := dt.lookup(elem) - if n != nil { - if i+1 == len(elems) { - panic("fuse: Tree.Add for " + path + " conflicts with " + elem) - } - dir = n - } else { - if i+1 == len(elems) { - dt.add(elem, node) - } else { - dir = &tree{} - dt.add(elem, dir) - } - } - } -} - -type treeDir struct { - name string - node Node -} - -type tree struct { - dir []treeDir -} - -func (t *tree) lookup(name string) Node { - for _, d := range t.dir { - if d.name == name { - return d.node - } - } - return nil -} - -func (t *tree) add(name string, n Node) { - t.dir = append(t.dir, treeDir{name, n}) -} - -func (t *tree) Attr(ctx context.Context, a *fuse.Attr) error { - a.Mode = os.ModeDir | 0555 - return nil -} - -func (t *tree) Lookup(ctx context.Context, name string) (Node, error) { - n := t.lookup(name) - if n != nil { - return n, nil - } - return nil, syscall.ENOENT -} - -func (t *tree) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { - var out []fuse.Dirent - for _, d := range t.dir { - out = append(out, fuse.Dirent{Name: d.name}) - } - return out, nil -} diff --git a/vendor/bazil.org/fuse/fuse.go b/vendor/bazil.org/fuse/fuse.go deleted file mode 100644 index b774a25c5..000000000 --- a/vendor/bazil.org/fuse/fuse.go +++ /dev/null @@ -1,2338 +0,0 @@ -// See the file LICENSE for copyright and licensing information. - -// Adapted from Plan 9 from User Space's src/cmd/9pfuse/fuse.c, -// which carries this notice: -// -// The files in this directory are subject to the following license. -// -// The author of this software is Russ Cox. -// -// Copyright (c) 2006 Russ Cox -// -// Permission to use, copy, modify, and distribute this software for any -// purpose without fee is hereby granted, provided that this entire notice -// is included in all copies of any software which is or includes a copy -// or modification of this software and in all copies of the supporting -// documentation for such software. -// -// THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION OR WARRANTY -// OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS -// FITNESS FOR ANY PARTICULAR PURPOSE. - -// Package fuse enables writing FUSE file systems on Linux, OS X, and FreeBSD. -// -// On OS X, it requires OSXFUSE (http://osxfuse.github.com/). -// -// There are two approaches to writing a FUSE file system. The first is to speak -// the low-level message protocol, reading from a Conn using ReadRequest and -// writing using the various Respond methods. This approach is closest to -// the actual interaction with the kernel and can be the simplest one in contexts -// such as protocol translators. -// -// Servers of synthesized file systems tend to share common -// bookkeeping abstracted away by the second approach, which is to -// call fs.Serve to serve the FUSE protocol using an implementation of -// the service methods in the interfaces FS* (file system), Node* (file -// or directory), and Handle* (opened file or directory). -// There are a daunting number of such methods that can be written, -// but few are required. -// The specific methods are described in the documentation for those interfaces. -// -// The hellofs subdirectory contains a simple illustration of the fs.Serve approach. -// -// Service Methods -// -// The required and optional methods for the FS, Node, and Handle interfaces -// have the general form -// -// Op(ctx context.Context, req *OpRequest, resp *OpResponse) error -// -// where Op is the name of a FUSE operation. Op reads request -// parameters from req and writes results to resp. An operation whose -// only result is the error result omits the resp parameter. -// -// Multiple goroutines may call service methods simultaneously; the -// methods being called are responsible for appropriate -// synchronization. -// -// The operation must not hold on to the request or response, -// including any []byte fields such as WriteRequest.Data or -// SetxattrRequest.Xattr. -// -// Errors -// -// Operations can return errors. The FUSE interface can only -// communicate POSIX errno error numbers to file system clients, the -// message is not visible to file system clients. The returned error -// can implement ErrorNumber to control the errno returned. Without -// ErrorNumber, a generic errno (EIO) is returned. -// -// Error messages will be visible in the debug log as part of the -// response. -// -// Interrupted Operations -// -// In some file systems, some operations -// may take an undetermined amount of time. For example, a Read waiting for -// a network message or a matching Write might wait indefinitely. If the request -// is cancelled and no longer needed, the context will be cancelled. -// Blocking operations should select on a receive from ctx.Done() and attempt to -// abort the operation early if the receive succeeds (meaning the channel is closed). -// To indicate that the operation failed because it was aborted, return syscall.EINTR. -// -// If an operation does not block for an indefinite amount of time, supporting -// cancellation is not necessary. -// -// Authentication -// -// All requests types embed a Header, meaning that the method can -// inspect req.Pid, req.Uid, and req.Gid as necessary to implement -// permission checking. The kernel FUSE layer normally prevents other -// users from accessing the FUSE file system (to change this, see -// AllowOther), but does not enforce access modes (to change this, see -// DefaultPermissions). -// -// Mount Options -// -// Behavior and metadata of the mounted file system can be changed by -// passing MountOption values to Mount. -// -package fuse // import "bazil.org/fuse" - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "os" - "sync" - "syscall" - "time" - "unsafe" -) - -// A Conn represents a connection to a mounted FUSE file system. -type Conn struct { - // Ready is closed when the mount is complete or has failed. - Ready <-chan struct{} - - // MountError stores any error from the mount process. Only valid - // after Ready is closed. - MountError error - - // File handle for kernel communication. Only safe to access if - // rio or wio is held. - dev *os.File - wio sync.RWMutex - rio sync.RWMutex - - // Protocol version negotiated with InitRequest/InitResponse. - proto Protocol -} - -// MountpointDoesNotExistError is an error returned when the -// mountpoint does not exist. -type MountpointDoesNotExistError struct { - Path string -} - -var _ error = (*MountpointDoesNotExistError)(nil) - -func (e *MountpointDoesNotExistError) Error() string { - return fmt.Sprintf("mountpoint does not exist: %v", e.Path) -} - -// Mount mounts a new FUSE connection on the named directory -// and returns a connection for reading and writing FUSE messages. -// -// After a successful return, caller must call Close to free -// resources. -// -// Even on successful return, the new mount is not guaranteed to be -// visible until after Conn.Ready is closed. See Conn.MountError for -// possible errors. Incoming requests on Conn must be served to make -// progress. -func Mount(dir string, options ...MountOption) (*Conn, error) { - conf := mountConfig{ - options: make(map[string]string), - } - for _, option := range options { - if err := option(&conf); err != nil { - return nil, err - } - } - - ready := make(chan struct{}, 1) - c := &Conn{ - Ready: ready, - } - f, err := mount(dir, &conf, ready, &c.MountError) - if err != nil { - return nil, err - } - c.dev = f - - if err := initMount(c, &conf); err != nil { - c.Close() - if err == ErrClosedWithoutInit { - // see if we can provide a better error - <-c.Ready - if err := c.MountError; err != nil { - return nil, err - } - } - return nil, err - } - - return c, nil -} - -type OldVersionError struct { - Kernel Protocol - LibraryMin Protocol -} - -func (e *OldVersionError) Error() string { - return fmt.Sprintf("kernel FUSE version is too old: %v < %v", e.Kernel, e.LibraryMin) -} - -var ( - ErrClosedWithoutInit = errors.New("fuse connection closed without init") -) - -func initMount(c *Conn, conf *mountConfig) error { - req, err := c.ReadRequest() - if err != nil { - if err == io.EOF { - return ErrClosedWithoutInit - } - return err - } - r, ok := req.(*InitRequest) - if !ok { - return fmt.Errorf("missing init, got: %T", req) - } - - min := Protocol{protoVersionMinMajor, protoVersionMinMinor} - if r.Kernel.LT(min) { - req.RespondError(Errno(syscall.EPROTO)) - c.Close() - return &OldVersionError{ - Kernel: r.Kernel, - LibraryMin: min, - } - } - - proto := Protocol{protoVersionMaxMajor, protoVersionMaxMinor} - if r.Kernel.LT(proto) { - // Kernel doesn't support the latest version we have. - proto = r.Kernel - } - c.proto = proto - - s := &InitResponse{ - Library: proto, - MaxReadahead: conf.maxReadahead, - MaxWrite: maxWrite, - Flags: InitBigWrites | conf.initFlags, - } - r.Respond(s) - return nil -} - -// A Request represents a single FUSE request received from the kernel. -// Use a type switch to determine the specific kind. -// A request of unrecognized type will have concrete type *Header. -type Request interface { - // Hdr returns the Header associated with this request. - Hdr() *Header - - // RespondError responds to the request with the given error. - RespondError(error) - - String() string -} - -// A RequestID identifies an active FUSE request. -type RequestID uint64 - -func (r RequestID) String() string { - return fmt.Sprintf("%#x", uint64(r)) -} - -// A NodeID is a number identifying a directory or file. -// It must be unique among IDs returned in LookupResponses -// that have not yet been forgotten by ForgetRequests. -type NodeID uint64 - -func (n NodeID) String() string { - return fmt.Sprintf("%#x", uint64(n)) -} - -// A HandleID is a number identifying an open directory or file. -// It only needs to be unique while the directory or file is open. -type HandleID uint64 - -func (h HandleID) String() string { - return fmt.Sprintf("%#x", uint64(h)) -} - -// The RootID identifies the root directory of a FUSE file system. -const RootID NodeID = rootID - -// A Header describes the basic information sent in every request. -type Header struct { - Conn *Conn `json:"-"` // connection this request was received on - ID RequestID // unique ID for request - Node NodeID // file or directory the request is about - Uid uint32 // user ID of process making request - Gid uint32 // group ID of process making request - Pid uint32 // process ID of process making request - - // for returning to reqPool - msg *message -} - -func (h *Header) String() string { - return fmt.Sprintf("ID=%v Node=%v Uid=%d Gid=%d Pid=%d", h.ID, h.Node, h.Uid, h.Gid, h.Pid) -} - -func (h *Header) Hdr() *Header { - return h -} - -func (h *Header) noResponse() { - putMessage(h.msg) -} - -func (h *Header) respond(msg []byte) { - out := (*outHeader)(unsafe.Pointer(&msg[0])) - out.Unique = uint64(h.ID) - h.Conn.respond(msg) - putMessage(h.msg) -} - -// An ErrorNumber is an error with a specific error number. -// -// Operations may return an error value that implements ErrorNumber to -// control what specific error number (errno) to return. -type ErrorNumber interface { - // Errno returns the the error number (errno) for this error. - Errno() Errno -} - -// Deprecated: Return a syscall.Errno directly. See ToErrno for exact -// rules. -const ( - // ENOSYS indicates that the call is not supported. - ENOSYS = Errno(syscall.ENOSYS) - - // ESTALE is used by Serve to respond to violations of the FUSE protocol. - ESTALE = Errno(syscall.ESTALE) - - ENOENT = Errno(syscall.ENOENT) - EIO = Errno(syscall.EIO) - EPERM = Errno(syscall.EPERM) - - // EINTR indicates request was interrupted by an InterruptRequest. - // See also fs.Intr. - EINTR = Errno(syscall.EINTR) - - ERANGE = Errno(syscall.ERANGE) - ENOTSUP = Errno(syscall.ENOTSUP) - EEXIST = Errno(syscall.EEXIST) -) - -// DefaultErrno is the errno used when error returned does not -// implement ErrorNumber. -const DefaultErrno = EIO - -var errnoNames = map[Errno]string{ - ENOSYS: "ENOSYS", - ESTALE: "ESTALE", - ENOENT: "ENOENT", - EIO: "EIO", - EPERM: "EPERM", - EINTR: "EINTR", - EEXIST: "EEXIST", - Errno(syscall.ENAMETOOLONG): "ENAMETOOLONG", -} - -// Errno implements Error and ErrorNumber using a syscall.Errno. -type Errno syscall.Errno - -var _ = ErrorNumber(Errno(0)) -var _ = error(Errno(0)) - -func (e Errno) Errno() Errno { - return e -} - -func (e Errno) String() string { - return syscall.Errno(e).Error() -} - -func (e Errno) Error() string { - return syscall.Errno(e).Error() -} - -// ErrnoName returns the short non-numeric identifier for this errno. -// For example, "EIO". -func (e Errno) ErrnoName() string { - s := errnoNames[e] - if s == "" { - s = fmt.Sprint(e.Errno()) - } - return s -} - -func (e Errno) MarshalText() ([]byte, error) { - s := e.ErrnoName() - return []byte(s), nil -} - -// ToErrno converts arbitrary errors to Errno. -// -// If the underlying type of err is syscall.Errno, it is used -// directly. No unwrapping is done, to prevent wrong errors from -// leaking via e.g. *os.PathError. -// -// If err unwraps to implement ErrorNumber, that is used. -// -// Finally, returns DefaultErrno. -func ToErrno(err error) Errno { - if err, ok := err.(syscall.Errno); ok { - return Errno(err) - } - var errnum ErrorNumber - if errors.As(err, &errnum) { - return Errno(errnum.Errno()) - } - return DefaultErrno -} - -func (h *Header) RespondError(err error) { - errno := ToErrno(err) - // FUSE uses negative errors! - // TODO: File bug report against OSXFUSE: positive error causes kernel panic. - buf := newBuffer(0) - hOut := (*outHeader)(unsafe.Pointer(&buf[0])) - hOut.Error = -int32(errno) - h.respond(buf) -} - -// All requests read from the kernel, without data, are shorter than -// this. -var maxRequestSize = syscall.Getpagesize() -var bufSize = maxRequestSize + maxWrite - -// reqPool is a pool of messages. -// -// Lifetime of a logical message is from getMessage to putMessage. -// getMessage is called by ReadRequest. putMessage is called by -// Conn.ReadRequest, Request.Respond, or Request.RespondError. -// -// Messages in the pool are guaranteed to have conn and off zeroed, -// buf allocated and len==bufSize, and hdr set. -var reqPool = sync.Pool{ - New: allocMessage, -} - -func allocMessage() interface{} { - m := &message{buf: make([]byte, bufSize)} - m.hdr = (*inHeader)(unsafe.Pointer(&m.buf[0])) - return m -} - -func getMessage(c *Conn) *message { - m := reqPool.Get().(*message) - m.conn = c - return m -} - -func putMessage(m *message) { - m.buf = m.buf[:bufSize] - m.conn = nil - m.off = 0 - reqPool.Put(m) -} - -// a message represents the bytes of a single FUSE message -type message struct { - conn *Conn - buf []byte // all bytes - hdr *inHeader // header - off int // offset for reading additional fields -} - -func (m *message) len() uintptr { - return uintptr(len(m.buf) - m.off) -} - -func (m *message) data() unsafe.Pointer { - var p unsafe.Pointer - if m.off < len(m.buf) { - p = unsafe.Pointer(&m.buf[m.off]) - } - return p -} - -func (m *message) bytes() []byte { - return m.buf[m.off:] -} - -func (m *message) Header() Header { - h := m.hdr - return Header{ - Conn: m.conn, - ID: RequestID(h.Unique), - Node: NodeID(h.Nodeid), - Uid: h.Uid, - Gid: h.Gid, - Pid: h.Pid, - - msg: m, - } -} - -// fileMode returns a Go os.FileMode from a Unix mode. -func fileMode(unixMode uint32) os.FileMode { - mode := os.FileMode(unixMode & 0777) - switch unixMode & syscall.S_IFMT { - case syscall.S_IFREG: - // nothing - case syscall.S_IFDIR: - mode |= os.ModeDir - case syscall.S_IFCHR: - mode |= os.ModeCharDevice | os.ModeDevice - case syscall.S_IFBLK: - mode |= os.ModeDevice - case syscall.S_IFIFO: - mode |= os.ModeNamedPipe - case syscall.S_IFLNK: - mode |= os.ModeSymlink - case syscall.S_IFSOCK: - mode |= os.ModeSocket - case 0: - // apparently there's plenty of times when the FUSE request - // does not contain the file type - mode |= os.ModeIrregular - default: - // not just unavailable in the kernel codepath; known to - // kernel but unrecognized by us - Debug(fmt.Sprintf("unrecognized file mode type: %04o", unixMode)) - mode |= os.ModeIrregular - } - if unixMode&syscall.S_ISUID != 0 { - mode |= os.ModeSetuid - } - if unixMode&syscall.S_ISGID != 0 { - mode |= os.ModeSetgid - } - return mode -} - -type noOpcode struct { - Opcode uint32 -} - -func (m noOpcode) String() string { - return fmt.Sprintf("No opcode %v", m.Opcode) -} - -type malformedMessage struct { -} - -func (malformedMessage) String() string { - return "malformed message" -} - -// Close closes the FUSE connection. -func (c *Conn) Close() error { - c.wio.Lock() - defer c.wio.Unlock() - c.rio.Lock() - defer c.rio.Unlock() - return c.dev.Close() -} - -// caller must hold wio or rio -func (c *Conn) fd() int { - return int(c.dev.Fd()) -} - -func (c *Conn) Protocol() Protocol { - return c.proto -} - -// ReadRequest returns the next FUSE request from the kernel. -// -// Caller must call either Request.Respond or Request.RespondError in -// a reasonable time. Caller must not retain Request after that call. -func (c *Conn) ReadRequest() (Request, error) { - m := getMessage(c) -loop: - c.rio.RLock() - n, err := syscall.Read(c.fd(), m.buf) - c.rio.RUnlock() - if err == syscall.EINTR { - // OSXFUSE sends EINTR to userspace when a request interrupt - // completed before it got sent to userspace? - goto loop - } - if err != nil && err != syscall.ENODEV { - putMessage(m) - return nil, err - } - if n <= 0 { - putMessage(m) - return nil, io.EOF - } - m.buf = m.buf[:n] - - if n < inHeaderSize { - putMessage(m) - return nil, errors.New("fuse: message too short") - } - - // FreeBSD FUSE sends a short length in the header - // for FUSE_INIT even though the actual read length is correct. - if n == inHeaderSize+initInSize && m.hdr.Opcode == opInit && m.hdr.Len < uint32(n) { - m.hdr.Len = uint32(n) - } - - // OSXFUSE sometimes sends the wrong m.hdr.Len in a FUSE_WRITE message. - if m.hdr.Len < uint32(n) && m.hdr.Len >= uint32(unsafe.Sizeof(writeIn{})) && m.hdr.Opcode == opWrite { - m.hdr.Len = uint32(n) - } - - if m.hdr.Len != uint32(n) { - // prepare error message before returning m to pool - err := fmt.Errorf("fuse: read %d opcode %d but expected %d", n, m.hdr.Opcode, m.hdr.Len) - putMessage(m) - return nil, err - } - - m.off = inHeaderSize - - // Convert to data structures. - // Do not trust kernel to hand us well-formed data. - var req Request - switch m.hdr.Opcode { - default: - Debug(noOpcode{Opcode: m.hdr.Opcode}) - goto unrecognized - - case opLookup: - buf := m.bytes() - n := len(buf) - if n == 0 || buf[n-1] != '\x00' { - goto corrupt - } - req = &LookupRequest{ - Header: m.Header(), - Name: string(buf[:n-1]), - } - - case opForget: - in := (*forgetIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &ForgetRequest{ - Header: m.Header(), - N: in.Nlookup, - } - - case opGetattr: - switch { - case c.proto.LT(Protocol{7, 9}): - req = &GetattrRequest{ - Header: m.Header(), - } - - default: - in := (*getattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &GetattrRequest{ - Header: m.Header(), - Flags: GetattrFlags(in.GetattrFlags), - Handle: HandleID(in.Fh), - } - } - - case opSetattr: - in := (*setattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &SetattrRequest{ - Header: m.Header(), - Valid: SetattrValid(in.Valid), - Handle: HandleID(in.Fh), - Size: in.Size, - Atime: time.Unix(int64(in.Atime), int64(in.AtimeNsec)), - Mtime: time.Unix(int64(in.Mtime), int64(in.MtimeNsec)), - Mode: fileMode(in.Mode), - Uid: in.Uid, - Gid: in.Gid, - Bkuptime: in.BkupTime(), - Chgtime: in.Chgtime(), - Flags: in.Flags(), - } - - case opReadlink: - if len(m.bytes()) > 0 { - goto corrupt - } - req = &ReadlinkRequest{ - Header: m.Header(), - } - - case opSymlink: - // m.bytes() is "newName\0target\0" - names := m.bytes() - if len(names) == 0 || names[len(names)-1] != 0 { - goto corrupt - } - i := bytes.IndexByte(names, '\x00') - if i < 0 { - goto corrupt - } - newName, target := names[0:i], names[i+1:len(names)-1] - req = &SymlinkRequest{ - Header: m.Header(), - NewName: string(newName), - Target: string(target), - } - - case opLink: - in := (*linkIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - newName := m.bytes()[unsafe.Sizeof(*in):] - if len(newName) < 2 || newName[len(newName)-1] != 0 { - goto corrupt - } - newName = newName[:len(newName)-1] - req = &LinkRequest{ - Header: m.Header(), - OldNode: NodeID(in.Oldnodeid), - NewName: string(newName), - } - - case opMknod: - size := mknodInSize(c.proto) - if m.len() < size { - goto corrupt - } - in := (*mknodIn)(m.data()) - name := m.bytes()[size:] - if len(name) < 2 || name[len(name)-1] != '\x00' { - goto corrupt - } - name = name[:len(name)-1] - r := &MknodRequest{ - Header: m.Header(), - Mode: fileMode(in.Mode), - Rdev: in.Rdev, - Name: string(name), - } - if c.proto.GE(Protocol{7, 12}) { - r.Umask = fileMode(in.Umask) & os.ModePerm - } - req = r - - case opMkdir: - size := mkdirInSize(c.proto) - if m.len() < size { - goto corrupt - } - in := (*mkdirIn)(m.data()) - name := m.bytes()[size:] - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - r := &MkdirRequest{ - Header: m.Header(), - Name: string(name[:i]), - // observed on Linux: mkdirIn.Mode & syscall.S_IFMT == 0, - // and this causes fileMode to go into it's "no idea" - // code branch; enforce type to directory - Mode: fileMode((in.Mode &^ syscall.S_IFMT) | syscall.S_IFDIR), - } - if c.proto.GE(Protocol{7, 12}) { - r.Umask = fileMode(in.Umask) & os.ModePerm - } - req = r - - case opUnlink, opRmdir: - buf := m.bytes() - n := len(buf) - if n == 0 || buf[n-1] != '\x00' { - goto corrupt - } - req = &RemoveRequest{ - Header: m.Header(), - Name: string(buf[:n-1]), - Dir: m.hdr.Opcode == opRmdir, - } - - case opRename: - in := (*renameIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - newDirNodeID := NodeID(in.Newdir) - oldNew := m.bytes()[unsafe.Sizeof(*in):] - // oldNew should be "old\x00new\x00" - if len(oldNew) < 4 { - goto corrupt - } - if oldNew[len(oldNew)-1] != '\x00' { - goto corrupt - } - i := bytes.IndexByte(oldNew, '\x00') - if i < 0 { - goto corrupt - } - oldName, newName := string(oldNew[:i]), string(oldNew[i+1:len(oldNew)-1]) - req = &RenameRequest{ - Header: m.Header(), - NewDir: newDirNodeID, - OldName: oldName, - NewName: newName, - } - - case opOpendir, opOpen: - in := (*openIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &OpenRequest{ - Header: m.Header(), - Dir: m.hdr.Opcode == opOpendir, - Flags: openFlags(in.Flags), - } - - case opRead, opReaddir: - in := (*readIn)(m.data()) - if m.len() < readInSize(c.proto) { - goto corrupt - } - r := &ReadRequest{ - Header: m.Header(), - Dir: m.hdr.Opcode == opReaddir, - Handle: HandleID(in.Fh), - Offset: int64(in.Offset), - Size: int(in.Size), - } - if c.proto.GE(Protocol{7, 9}) { - r.Flags = ReadFlags(in.ReadFlags) - r.LockOwner = in.LockOwner - r.FileFlags = openFlags(in.Flags) - } - req = r - - case opWrite: - in := (*writeIn)(m.data()) - if m.len() < writeInSize(c.proto) { - goto corrupt - } - r := &WriteRequest{ - Header: m.Header(), - Handle: HandleID(in.Fh), - Offset: int64(in.Offset), - Flags: WriteFlags(in.WriteFlags), - } - if c.proto.GE(Protocol{7, 9}) { - r.LockOwner = in.LockOwner - r.FileFlags = openFlags(in.Flags) - } - buf := m.bytes()[writeInSize(c.proto):] - if uint32(len(buf)) < in.Size { - goto corrupt - } - r.Data = buf - req = r - - case opStatfs: - req = &StatfsRequest{ - Header: m.Header(), - } - - case opRelease, opReleasedir: - in := (*releaseIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &ReleaseRequest{ - Header: m.Header(), - Dir: m.hdr.Opcode == opReleasedir, - Handle: HandleID(in.Fh), - Flags: openFlags(in.Flags), - ReleaseFlags: ReleaseFlags(in.ReleaseFlags), - LockOwner: in.LockOwner, - } - - case opFsync, opFsyncdir: - in := (*fsyncIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &FsyncRequest{ - Dir: m.hdr.Opcode == opFsyncdir, - Header: m.Header(), - Handle: HandleID(in.Fh), - Flags: in.FsyncFlags, - } - - case opSetxattr: - in := (*setxattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - m.off += int(unsafe.Sizeof(*in)) - name := m.bytes() - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - xattr := name[i+1:] - if uint32(len(xattr)) < in.Size { - goto corrupt - } - xattr = xattr[:in.Size] - req = &SetxattrRequest{ - Header: m.Header(), - Flags: in.Flags, - Position: in.position(), - Name: string(name[:i]), - Xattr: xattr, - } - - case opGetxattr: - in := (*getxattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - name := m.bytes()[unsafe.Sizeof(*in):] - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - req = &GetxattrRequest{ - Header: m.Header(), - Name: string(name[:i]), - Size: in.Size, - Position: in.position(), - } - - case opListxattr: - in := (*getxattrIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &ListxattrRequest{ - Header: m.Header(), - Size: in.Size, - Position: in.position(), - } - - case opRemovexattr: - buf := m.bytes() - n := len(buf) - if n == 0 || buf[n-1] != '\x00' { - goto corrupt - } - req = &RemovexattrRequest{ - Header: m.Header(), - Name: string(buf[:n-1]), - } - - case opFlush: - in := (*flushIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &FlushRequest{ - Header: m.Header(), - Handle: HandleID(in.Fh), - Flags: in.FlushFlags, - LockOwner: in.LockOwner, - } - - case opInit: - in := (*initIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &InitRequest{ - Header: m.Header(), - Kernel: Protocol{in.Major, in.Minor}, - MaxReadahead: in.MaxReadahead, - Flags: InitFlags(in.Flags), - } - - case opGetlk: - panic("opGetlk") - case opSetlk: - panic("opSetlk") - case opSetlkw: - panic("opSetlkw") - - case opAccess: - in := (*accessIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &AccessRequest{ - Header: m.Header(), - Mask: in.Mask, - } - - case opCreate: - size := createInSize(c.proto) - if m.len() < size { - goto corrupt - } - in := (*createIn)(m.data()) - name := m.bytes()[size:] - i := bytes.IndexByte(name, '\x00') - if i < 0 { - goto corrupt - } - r := &CreateRequest{ - Header: m.Header(), - Flags: openFlags(in.Flags), - Mode: fileMode(in.Mode), - Name: string(name[:i]), - } - if c.proto.GE(Protocol{7, 12}) { - r.Umask = fileMode(in.Umask) & os.ModePerm - } - req = r - - case opInterrupt: - in := (*interruptIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - req = &InterruptRequest{ - Header: m.Header(), - IntrID: RequestID(in.Unique), - } - - case opBmap: - // bmap asks to map a byte offset within a file to a single - // uint64. On Linux, it triggers only with blkdev fuse mounts, - // that claim to be backed by an actual block device. FreeBSD - // seems to send it for just any fuse mount, whether there's a - // block device involved or not. - goto unrecognized - - case opDestroy: - req = &DestroyRequest{ - Header: m.Header(), - } - - // OS X - case opSetvolname: - panic("opSetvolname") - case opGetxtimes: - panic("opGetxtimes") - case opExchange: - in := (*exchangeIn)(m.data()) - if m.len() < unsafe.Sizeof(*in) { - goto corrupt - } - oldDirNodeID := NodeID(in.Olddir) - newDirNodeID := NodeID(in.Newdir) - oldNew := m.bytes()[unsafe.Sizeof(*in):] - // oldNew should be "oldname\x00newname\x00" - if len(oldNew) < 4 { - goto corrupt - } - if oldNew[len(oldNew)-1] != '\x00' { - goto corrupt - } - i := bytes.IndexByte(oldNew, '\x00') - if i < 0 { - goto corrupt - } - oldName, newName := string(oldNew[:i]), string(oldNew[i+1:len(oldNew)-1]) - req = &ExchangeDataRequest{ - Header: m.Header(), - OldDir: oldDirNodeID, - NewDir: newDirNodeID, - OldName: oldName, - NewName: newName, - // TODO options - } - } - - return req, nil - -corrupt: - Debug(malformedMessage{}) - putMessage(m) - return nil, fmt.Errorf("fuse: malformed message") - -unrecognized: - // Unrecognized message. - // Assume higher-level code will send a "no idea what you mean" error. - h := m.Header() - return &h, nil -} - -type bugShortKernelWrite struct { - Written int64 - Length int64 - Error string - Stack string -} - -func (b bugShortKernelWrite) String() string { - return fmt.Sprintf("short kernel write: written=%d/%d error=%q stack=\n%s", b.Written, b.Length, b.Error, b.Stack) -} - -type bugKernelWriteError struct { - Error string - Stack string -} - -func (b bugKernelWriteError) String() string { - return fmt.Sprintf("kernel write error: error=%q stack=\n%s", b.Error, b.Stack) -} - -// safe to call even with nil error -func errorString(err error) string { - if err == nil { - return "" - } - return err.Error() -} - -func (c *Conn) writeToKernel(msg []byte) error { - out := (*outHeader)(unsafe.Pointer(&msg[0])) - out.Len = uint32(len(msg)) - - c.wio.RLock() - defer c.wio.RUnlock() - nn, err := syscall.Write(c.fd(), msg) - if err == nil && nn != len(msg) { - Debug(bugShortKernelWrite{ - Written: int64(nn), - Length: int64(len(msg)), - Error: errorString(err), - Stack: stack(), - }) - } - return err -} - -func (c *Conn) respond(msg []byte) { - if err := c.writeToKernel(msg); err != nil { - Debug(bugKernelWriteError{ - Error: errorString(err), - Stack: stack(), - }) - } -} - -type notCachedError struct{} - -func (notCachedError) Error() string { - return "node not cached" -} - -var _ ErrorNumber = notCachedError{} - -func (notCachedError) Errno() Errno { - // Behave just like if the original syscall.ENOENT had been passed - // straight through. - return ENOENT -} - -var ( - ErrNotCached = notCachedError{} -) - -// sendInvalidate sends an invalidate notification to kernel. -// -// A returned ENOENT is translated to a friendlier error. -func (c *Conn) sendInvalidate(msg []byte) error { - switch err := c.writeToKernel(msg); err { - case syscall.ENOENT: - return ErrNotCached - default: - return err - } -} - -// InvalidateNode invalidates the kernel cache of the attributes and a -// range of the data of a node. -// -// Giving offset 0 and size -1 means all data. To invalidate just the -// attributes, give offset 0 and size 0. -// -// Returns ErrNotCached if the kernel is not currently caching the -// node. -func (c *Conn) InvalidateNode(nodeID NodeID, off int64, size int64) error { - buf := newBuffer(unsafe.Sizeof(notifyInvalInodeOut{})) - h := (*outHeader)(unsafe.Pointer(&buf[0])) - // h.Unique is 0 - h.Error = notifyCodeInvalInode - out := (*notifyInvalInodeOut)(buf.alloc(unsafe.Sizeof(notifyInvalInodeOut{}))) - out.Ino = uint64(nodeID) - out.Off = off - out.Len = size - return c.sendInvalidate(buf) -} - -// InvalidateEntry invalidates the kernel cache of the directory entry -// identified by parent directory node ID and entry basename. -// -// Kernel may or may not cache directory listings. To invalidate -// those, use InvalidateNode to invalidate all of the data for a -// directory. (As of 2015-06, Linux FUSE does not cache directory -// listings.) -// -// Returns ErrNotCached if the kernel is not currently caching the -// node. -func (c *Conn) InvalidateEntry(parent NodeID, name string) error { - const maxUint32 = ^uint32(0) - if uint64(len(name)) > uint64(maxUint32) { - // very unlikely, but we don't want to silently truncate - return syscall.ENAMETOOLONG - } - buf := newBuffer(unsafe.Sizeof(notifyInvalEntryOut{}) + uintptr(len(name)) + 1) - h := (*outHeader)(unsafe.Pointer(&buf[0])) - // h.Unique is 0 - h.Error = notifyCodeInvalEntry - out := (*notifyInvalEntryOut)(buf.alloc(unsafe.Sizeof(notifyInvalEntryOut{}))) - out.Parent = uint64(parent) - out.Namelen = uint32(len(name)) - buf = append(buf, name...) - buf = append(buf, '\x00') - return c.sendInvalidate(buf) -} - -// An InitRequest is the first request sent on a FUSE file system. -type InitRequest struct { - Header `json:"-"` - Kernel Protocol - // Maximum readahead in bytes that the kernel plans to use. - MaxReadahead uint32 - Flags InitFlags -} - -var _ = Request(&InitRequest{}) - -func (r *InitRequest) String() string { - return fmt.Sprintf("Init [%v] %v ra=%d fl=%v", &r.Header, r.Kernel, r.MaxReadahead, r.Flags) -} - -// An InitResponse is the response to an InitRequest. -type InitResponse struct { - Library Protocol - // Maximum readahead in bytes that the kernel can use. Ignored if - // greater than InitRequest.MaxReadahead. - MaxReadahead uint32 - Flags InitFlags - // Maximum size of a single write operation. - // Linux enforces a minimum of 4 KiB. - MaxWrite uint32 -} - -func (r *InitResponse) String() string { - return fmt.Sprintf("Init %v ra=%d fl=%v w=%d", r.Library, r.MaxReadahead, r.Flags, r.MaxWrite) -} - -// Respond replies to the request with the given response. -func (r *InitRequest) Respond(resp *InitResponse) { - buf := newBuffer(unsafe.Sizeof(initOut{})) - out := (*initOut)(buf.alloc(unsafe.Sizeof(initOut{}))) - out.Major = resp.Library.Major - out.Minor = resp.Library.Minor - out.MaxReadahead = resp.MaxReadahead - out.Flags = uint32(resp.Flags) - out.MaxWrite = resp.MaxWrite - - // MaxWrite larger than our receive buffer would just lead to - // errors on large writes. - if out.MaxWrite > maxWrite { - out.MaxWrite = maxWrite - } - r.respond(buf) -} - -// A StatfsRequest requests information about the mounted file system. -type StatfsRequest struct { - Header `json:"-"` -} - -var _ = Request(&StatfsRequest{}) - -func (r *StatfsRequest) String() string { - return fmt.Sprintf("Statfs [%s]", &r.Header) -} - -// Respond replies to the request with the given response. -func (r *StatfsRequest) Respond(resp *StatfsResponse) { - buf := newBuffer(unsafe.Sizeof(statfsOut{})) - out := (*statfsOut)(buf.alloc(unsafe.Sizeof(statfsOut{}))) - out.St = kstatfs{ - Blocks: resp.Blocks, - Bfree: resp.Bfree, - Bavail: resp.Bavail, - Files: resp.Files, - Ffree: resp.Ffree, - Bsize: resp.Bsize, - Namelen: resp.Namelen, - Frsize: resp.Frsize, - } - r.respond(buf) -} - -// A StatfsResponse is the response to a StatfsRequest. -type StatfsResponse struct { - Blocks uint64 // Total data blocks in file system. - Bfree uint64 // Free blocks in file system. - Bavail uint64 // Free blocks in file system if you're not root. - Files uint64 // Total files in file system. - Ffree uint64 // Free files in file system. - Bsize uint32 // Block size - Namelen uint32 // Maximum file name length? - Frsize uint32 // Fragment size, smallest addressable data size in the file system. -} - -func (r *StatfsResponse) String() string { - return fmt.Sprintf("Statfs blocks=%d/%d/%d files=%d/%d bsize=%d frsize=%d namelen=%d", - r.Bavail, r.Bfree, r.Blocks, - r.Ffree, r.Files, - r.Bsize, - r.Frsize, - r.Namelen, - ) -} - -// An AccessRequest asks whether the file can be accessed -// for the purpose specified by the mask. -type AccessRequest struct { - Header `json:"-"` - Mask uint32 -} - -var _ = Request(&AccessRequest{}) - -func (r *AccessRequest) String() string { - return fmt.Sprintf("Access [%s] mask=%#x", &r.Header, r.Mask) -} - -// Respond replies to the request indicating that access is allowed. -// To deny access, use RespondError. -func (r *AccessRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// An Attr is the metadata for a single file or directory. -type Attr struct { - Valid time.Duration // how long Attr can be cached - - Inode uint64 // inode number - Size uint64 // size in bytes - Blocks uint64 // size in 512-byte units - Atime time.Time // time of last access - Mtime time.Time // time of last modification - Ctime time.Time // time of last inode change - Crtime time.Time // time of creation (OS X only) - Mode os.FileMode // file mode - Nlink uint32 // number of links (usually 1) - Uid uint32 // owner uid - Gid uint32 // group gid - Rdev uint32 // device numbers - Flags uint32 // chflags(2) flags (OS X only) - BlockSize uint32 // preferred blocksize for filesystem I/O -} - -func (a Attr) String() string { - return fmt.Sprintf("valid=%v ino=%v size=%d mode=%v", a.Valid, a.Inode, a.Size, a.Mode) -} - -func unix(t time.Time) (sec uint64, nsec uint32) { - nano := t.UnixNano() - sec = uint64(nano / 1e9) - nsec = uint32(nano % 1e9) - return -} - -func (a *Attr) attr(out *attr, proto Protocol) { - out.Ino = a.Inode - out.Size = a.Size - out.Blocks = a.Blocks - out.Atime, out.AtimeNsec = unix(a.Atime) - out.Mtime, out.MtimeNsec = unix(a.Mtime) - out.Ctime, out.CtimeNsec = unix(a.Ctime) - out.SetCrtime(unix(a.Crtime)) - out.Mode = uint32(a.Mode) & 0777 - switch { - default: - out.Mode |= syscall.S_IFREG - case a.Mode&os.ModeDir != 0: - out.Mode |= syscall.S_IFDIR - case a.Mode&os.ModeDevice != 0: - if a.Mode&os.ModeCharDevice != 0 { - out.Mode |= syscall.S_IFCHR - } else { - out.Mode |= syscall.S_IFBLK - } - case a.Mode&os.ModeNamedPipe != 0: - out.Mode |= syscall.S_IFIFO - case a.Mode&os.ModeSymlink != 0: - out.Mode |= syscall.S_IFLNK - case a.Mode&os.ModeSocket != 0: - out.Mode |= syscall.S_IFSOCK - } - if a.Mode&os.ModeSetuid != 0 { - out.Mode |= syscall.S_ISUID - } - if a.Mode&os.ModeSetgid != 0 { - out.Mode |= syscall.S_ISGID - } - out.Nlink = a.Nlink - out.Uid = a.Uid - out.Gid = a.Gid - out.Rdev = a.Rdev - out.SetFlags(a.Flags) - if proto.GE(Protocol{7, 9}) { - out.Blksize = a.BlockSize - } -} - -// A GetattrRequest asks for the metadata for the file denoted by r.Node. -type GetattrRequest struct { - Header `json:"-"` - Flags GetattrFlags - Handle HandleID -} - -var _ = Request(&GetattrRequest{}) - -func (r *GetattrRequest) String() string { - return fmt.Sprintf("Getattr [%s] %v fl=%v", &r.Header, r.Handle, r.Flags) -} - -// Respond replies to the request with the given response. -func (r *GetattrRequest) Respond(resp *GetattrResponse) { - size := attrOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*attrOut)(buf.alloc(size)) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A GetattrResponse is the response to a GetattrRequest. -type GetattrResponse struct { - Attr Attr // file attributes -} - -func (r *GetattrResponse) String() string { - return fmt.Sprintf("Getattr %v", r.Attr) -} - -// A GetxattrRequest asks for the extended attributes associated with r.Node. -type GetxattrRequest struct { - Header `json:"-"` - - // Maximum size to return. - Size uint32 - - // Name of the attribute requested. - Name string - - // Offset within extended attributes. - // - // Only valid for OS X, and then only with the resource fork - // attribute. - Position uint32 -} - -var _ = Request(&GetxattrRequest{}) - -func (r *GetxattrRequest) String() string { - return fmt.Sprintf("Getxattr [%s] %q %d @%d", &r.Header, r.Name, r.Size, r.Position) -} - -// Respond replies to the request with the given response. -func (r *GetxattrRequest) Respond(resp *GetxattrResponse) { - if r.Size == 0 { - buf := newBuffer(unsafe.Sizeof(getxattrOut{})) - out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{}))) - out.Size = uint32(len(resp.Xattr)) - r.respond(buf) - } else { - buf := newBuffer(uintptr(len(resp.Xattr))) - buf = append(buf, resp.Xattr...) - r.respond(buf) - } -} - -// A GetxattrResponse is the response to a GetxattrRequest. -type GetxattrResponse struct { - Xattr []byte -} - -func (r *GetxattrResponse) String() string { - return fmt.Sprintf("Getxattr %q", r.Xattr) -} - -// A ListxattrRequest asks to list the extended attributes associated with r.Node. -type ListxattrRequest struct { - Header `json:"-"` - Size uint32 // maximum size to return - Position uint32 // offset within attribute list -} - -var _ = Request(&ListxattrRequest{}) - -func (r *ListxattrRequest) String() string { - return fmt.Sprintf("Listxattr [%s] %d @%d", &r.Header, r.Size, r.Position) -} - -// Respond replies to the request with the given response. -func (r *ListxattrRequest) Respond(resp *ListxattrResponse) { - if r.Size == 0 { - buf := newBuffer(unsafe.Sizeof(getxattrOut{})) - out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{}))) - out.Size = uint32(len(resp.Xattr)) - r.respond(buf) - } else { - buf := newBuffer(uintptr(len(resp.Xattr))) - buf = append(buf, resp.Xattr...) - r.respond(buf) - } -} - -// A ListxattrResponse is the response to a ListxattrRequest. -type ListxattrResponse struct { - Xattr []byte -} - -func (r *ListxattrResponse) String() string { - return fmt.Sprintf("Listxattr %q", r.Xattr) -} - -// Append adds an extended attribute name to the response. -func (r *ListxattrResponse) Append(names ...string) { - for _, name := range names { - r.Xattr = append(r.Xattr, name...) - r.Xattr = append(r.Xattr, '\x00') - } -} - -// A RemovexattrRequest asks to remove an extended attribute associated with r.Node. -type RemovexattrRequest struct { - Header `json:"-"` - Name string // name of extended attribute -} - -var _ = Request(&RemovexattrRequest{}) - -func (r *RemovexattrRequest) String() string { - return fmt.Sprintf("Removexattr [%s] %q", &r.Header, r.Name) -} - -// Respond replies to the request, indicating that the attribute was removed. -func (r *RemovexattrRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A SetxattrRequest asks to set an extended attribute associated with a file. -type SetxattrRequest struct { - Header `json:"-"` - - // Flags can make the request fail if attribute does/not already - // exist. Unfortunately, the constants are platform-specific and - // not exposed by Go1.2. Look for XATTR_CREATE, XATTR_REPLACE. - // - // TODO improve this later - // - // TODO XATTR_CREATE and exist -> EEXIST - // - // TODO XATTR_REPLACE and not exist -> ENODATA - Flags uint32 - - // Offset within extended attributes. - // - // Only valid for OS X, and then only with the resource fork - // attribute. - Position uint32 - - Name string - Xattr []byte -} - -var _ = Request(&SetxattrRequest{}) - -func trunc(b []byte, max int) ([]byte, string) { - if len(b) > max { - return b[:max], "..." - } - return b, "" -} - -func (r *SetxattrRequest) String() string { - xattr, tail := trunc(r.Xattr, 16) - return fmt.Sprintf("Setxattr [%s] %q %q%s fl=%v @%#x", &r.Header, r.Name, xattr, tail, r.Flags, r.Position) -} - -// Respond replies to the request, indicating that the extended attribute was set. -func (r *SetxattrRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A LookupRequest asks to look up the given name in the directory named by r.Node. -type LookupRequest struct { - Header `json:"-"` - Name string -} - -var _ = Request(&LookupRequest{}) - -func (r *LookupRequest) String() string { - return fmt.Sprintf("Lookup [%s] %q", &r.Header, r.Name) -} - -// Respond replies to the request with the given response. -func (r *LookupRequest) Respond(resp *LookupResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A LookupResponse is the response to a LookupRequest. -type LookupResponse struct { - Node NodeID - Generation uint64 - EntryValid time.Duration - Attr Attr -} - -func (r *LookupResponse) string() string { - return fmt.Sprintf("%v gen=%d valid=%v attr={%v}", r.Node, r.Generation, r.EntryValid, r.Attr) -} - -func (r *LookupResponse) String() string { - return fmt.Sprintf("Lookup %s", r.string()) -} - -// An OpenRequest asks to open a file or directory -type OpenRequest struct { - Header `json:"-"` - Dir bool // is this Opendir? - Flags OpenFlags -} - -var _ = Request(&OpenRequest{}) - -func (r *OpenRequest) String() string { - return fmt.Sprintf("Open [%s] dir=%v fl=%v", &r.Header, r.Dir, r.Flags) -} - -// Respond replies to the request with the given response. -func (r *OpenRequest) Respond(resp *OpenResponse) { - buf := newBuffer(unsafe.Sizeof(openOut{})) - out := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{}))) - out.Fh = uint64(resp.Handle) - out.OpenFlags = uint32(resp.Flags) - r.respond(buf) -} - -// A OpenResponse is the response to a OpenRequest. -type OpenResponse struct { - Handle HandleID - Flags OpenResponseFlags -} - -func (r *OpenResponse) string() string { - return fmt.Sprintf("%v fl=%v", r.Handle, r.Flags) -} - -func (r *OpenResponse) String() string { - return fmt.Sprintf("Open %s", r.string()) -} - -// A CreateRequest asks to create and open a file (not a directory). -type CreateRequest struct { - Header `json:"-"` - Name string - Flags OpenFlags - Mode os.FileMode - // Umask of the request. Not supported on OS X. - Umask os.FileMode -} - -var _ = Request(&CreateRequest{}) - -func (r *CreateRequest) String() string { - return fmt.Sprintf("Create [%s] %q fl=%v mode=%v umask=%v", &r.Header, r.Name, r.Flags, r.Mode, r.Umask) -} - -// Respond replies to the request with the given response. -func (r *CreateRequest) Respond(resp *CreateResponse) { - eSize := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(eSize + unsafe.Sizeof(openOut{})) - - e := (*entryOut)(buf.alloc(eSize)) - e.Nodeid = uint64(resp.Node) - e.Generation = resp.Generation - e.EntryValid = uint64(resp.EntryValid / time.Second) - e.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - e.AttrValid = uint64(resp.Attr.Valid / time.Second) - e.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&e.Attr, r.Header.Conn.proto) - - o := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{}))) - o.Fh = uint64(resp.Handle) - o.OpenFlags = uint32(resp.Flags) - - r.respond(buf) -} - -// A CreateResponse is the response to a CreateRequest. -// It describes the created node and opened handle. -type CreateResponse struct { - LookupResponse - OpenResponse -} - -func (r *CreateResponse) String() string { - return fmt.Sprintf("Create {%s} {%s}", r.LookupResponse.string(), r.OpenResponse.string()) -} - -// A MkdirRequest asks to create (but not open) a directory. -type MkdirRequest struct { - Header `json:"-"` - Name string - Mode os.FileMode - // Umask of the request. Not supported on OS X. - Umask os.FileMode -} - -var _ = Request(&MkdirRequest{}) - -func (r *MkdirRequest) String() string { - return fmt.Sprintf("Mkdir [%s] %q mode=%v umask=%v", &r.Header, r.Name, r.Mode, r.Umask) -} - -// Respond replies to the request with the given response. -func (r *MkdirRequest) Respond(resp *MkdirResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A MkdirResponse is the response to a MkdirRequest. -type MkdirResponse struct { - LookupResponse -} - -func (r *MkdirResponse) String() string { - return fmt.Sprintf("Mkdir %v", r.LookupResponse.string()) -} - -// A ReadRequest asks to read from an open file. -type ReadRequest struct { - Header `json:"-"` - Dir bool // is this Readdir? - Handle HandleID - Offset int64 - Size int - Flags ReadFlags - LockOwner uint64 - FileFlags OpenFlags -} - -var _ = Request(&ReadRequest{}) - -func (r *ReadRequest) String() string { - return fmt.Sprintf("Read [%s] %v %d @%#x dir=%v fl=%v lock=%d ffl=%v", &r.Header, r.Handle, r.Size, r.Offset, r.Dir, r.Flags, r.LockOwner, r.FileFlags) -} - -// Respond replies to the request with the given response. -func (r *ReadRequest) Respond(resp *ReadResponse) { - buf := newBuffer(uintptr(len(resp.Data))) - buf = append(buf, resp.Data...) - r.respond(buf) -} - -// A ReadResponse is the response to a ReadRequest. -type ReadResponse struct { - Data []byte -} - -func (r *ReadResponse) String() string { - return fmt.Sprintf("Read %d", len(r.Data)) -} - -type jsonReadResponse struct { - Len uint64 -} - -func (r *ReadResponse) MarshalJSON() ([]byte, error) { - j := jsonReadResponse{ - Len: uint64(len(r.Data)), - } - return json.Marshal(j) -} - -// A ReleaseRequest asks to release (close) an open file handle. -type ReleaseRequest struct { - Header `json:"-"` - Dir bool // is this Releasedir? - Handle HandleID - Flags OpenFlags // flags from OpenRequest - ReleaseFlags ReleaseFlags - LockOwner uint32 -} - -var _ = Request(&ReleaseRequest{}) - -func (r *ReleaseRequest) String() string { - return fmt.Sprintf("Release [%s] %v fl=%v rfl=%v owner=%#x", &r.Header, r.Handle, r.Flags, r.ReleaseFlags, r.LockOwner) -} - -// Respond replies to the request, indicating that the handle has been released. -func (r *ReleaseRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A DestroyRequest is sent by the kernel when unmounting the file system. -// No more requests will be received after this one, but it should still be -// responded to. -type DestroyRequest struct { - Header `json:"-"` -} - -var _ = Request(&DestroyRequest{}) - -func (r *DestroyRequest) String() string { - return fmt.Sprintf("Destroy [%s]", &r.Header) -} - -// Respond replies to the request. -func (r *DestroyRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A ForgetRequest is sent by the kernel when forgetting about r.Node -// as returned by r.N lookup requests. -type ForgetRequest struct { - Header `json:"-"` - N uint64 -} - -var _ = Request(&ForgetRequest{}) - -func (r *ForgetRequest) String() string { - return fmt.Sprintf("Forget [%s] %d", &r.Header, r.N) -} - -// Respond replies to the request, indicating that the forgetfulness has been recorded. -func (r *ForgetRequest) Respond() { - // Don't reply to forget messages. - r.noResponse() -} - -// A Dirent represents a single directory entry. -type Dirent struct { - // Inode this entry names. - Inode uint64 - - // Type of the entry, for example DT_File. - // - // Setting this is optional. The zero value (DT_Unknown) means - // callers will just need to do a Getattr when the type is - // needed. Providing a type can speed up operations - // significantly. - Type DirentType - - // Name of the entry - Name string -} - -// Type of an entry in a directory listing. -type DirentType uint32 - -const ( - // These don't quite match os.FileMode; especially there's an - // explicit unknown, instead of zero value meaning file. They - // are also not quite syscall.DT_*; nothing says the FUSE - // protocol follows those, and even if they were, we don't - // want each fs to fiddle with syscall. - - // The shift by 12 is hardcoded in the FUSE userspace - // low-level C library, so it's safe here. - - DT_Unknown DirentType = 0 - DT_Socket DirentType = syscall.S_IFSOCK >> 12 - DT_Link DirentType = syscall.S_IFLNK >> 12 - DT_File DirentType = syscall.S_IFREG >> 12 - DT_Block DirentType = syscall.S_IFBLK >> 12 - DT_Dir DirentType = syscall.S_IFDIR >> 12 - DT_Char DirentType = syscall.S_IFCHR >> 12 - DT_FIFO DirentType = syscall.S_IFIFO >> 12 -) - -func (t DirentType) String() string { - switch t { - case DT_Unknown: - return "unknown" - case DT_Socket: - return "socket" - case DT_Link: - return "link" - case DT_File: - return "file" - case DT_Block: - return "block" - case DT_Dir: - return "dir" - case DT_Char: - return "char" - case DT_FIFO: - return "fifo" - } - return "invalid" -} - -// AppendDirent appends the encoded form of a directory entry to data -// and returns the resulting slice. -func AppendDirent(data []byte, dir Dirent) []byte { - de := dirent{ - Ino: dir.Inode, - Namelen: uint32(len(dir.Name)), - Type: uint32(dir.Type), - } - de.Off = uint64(len(data) + direntSize + (len(dir.Name)+7)&^7) - data = append(data, (*[direntSize]byte)(unsafe.Pointer(&de))[:]...) - data = append(data, dir.Name...) - n := direntSize + uintptr(len(dir.Name)) - if n%8 != 0 { - var pad [8]byte - data = append(data, pad[:8-n%8]...) - } - return data -} - -// A WriteRequest asks to write to an open file. -type WriteRequest struct { - Header - Handle HandleID - Offset int64 - Data []byte - Flags WriteFlags - LockOwner uint64 - FileFlags OpenFlags -} - -var _ = Request(&WriteRequest{}) - -func (r *WriteRequest) String() string { - return fmt.Sprintf("Write [%s] %v %d @%d fl=%v lock=%d ffl=%v", &r.Header, r.Handle, len(r.Data), r.Offset, r.Flags, r.LockOwner, r.FileFlags) -} - -type jsonWriteRequest struct { - Handle HandleID - Offset int64 - Len uint64 - Flags WriteFlags -} - -func (r *WriteRequest) MarshalJSON() ([]byte, error) { - j := jsonWriteRequest{ - Handle: r.Handle, - Offset: r.Offset, - Len: uint64(len(r.Data)), - Flags: r.Flags, - } - return json.Marshal(j) -} - -// Respond replies to the request with the given response. -func (r *WriteRequest) Respond(resp *WriteResponse) { - buf := newBuffer(unsafe.Sizeof(writeOut{})) - out := (*writeOut)(buf.alloc(unsafe.Sizeof(writeOut{}))) - out.Size = uint32(resp.Size) - r.respond(buf) -} - -// A WriteResponse replies to a write indicating how many bytes were written. -type WriteResponse struct { - Size int -} - -func (r *WriteResponse) String() string { - return fmt.Sprintf("Write %d", r.Size) -} - -// A SetattrRequest asks to change one or more attributes associated with a file, -// as indicated by Valid. -type SetattrRequest struct { - Header `json:"-"` - Valid SetattrValid - Handle HandleID - Size uint64 - Atime time.Time - Mtime time.Time - // Mode is the file mode to set (when valid). - // - // The type of the node (as in os.ModeType, os.ModeDir etc) is not - // guaranteed to be sent by the kernel, in which case - // os.ModeIrregular will be set. - Mode os.FileMode - Uid uint32 - Gid uint32 - - // OS X only - Bkuptime time.Time - Chgtime time.Time - Crtime time.Time - Flags uint32 // see chflags(2) -} - -var _ = Request(&SetattrRequest{}) - -func (r *SetattrRequest) String() string { - var buf bytes.Buffer - fmt.Fprintf(&buf, "Setattr [%s]", &r.Header) - if r.Valid.Mode() { - fmt.Fprintf(&buf, " mode=%v", r.Mode) - } - if r.Valid.Uid() { - fmt.Fprintf(&buf, " uid=%d", r.Uid) - } - if r.Valid.Gid() { - fmt.Fprintf(&buf, " gid=%d", r.Gid) - } - if r.Valid.Size() { - fmt.Fprintf(&buf, " size=%d", r.Size) - } - if r.Valid.Atime() { - fmt.Fprintf(&buf, " atime=%v", r.Atime) - } - if r.Valid.AtimeNow() { - fmt.Fprintf(&buf, " atime=now") - } - if r.Valid.Mtime() { - fmt.Fprintf(&buf, " mtime=%v", r.Mtime) - } - if r.Valid.MtimeNow() { - fmt.Fprintf(&buf, " mtime=now") - } - if r.Valid.Handle() { - fmt.Fprintf(&buf, " handle=%v", r.Handle) - } else { - fmt.Fprintf(&buf, " handle=INVALID-%v", r.Handle) - } - if r.Valid.LockOwner() { - fmt.Fprintf(&buf, " lockowner") - } - if r.Valid.Crtime() { - fmt.Fprintf(&buf, " crtime=%v", r.Crtime) - } - if r.Valid.Chgtime() { - fmt.Fprintf(&buf, " chgtime=%v", r.Chgtime) - } - if r.Valid.Bkuptime() { - fmt.Fprintf(&buf, " bkuptime=%v", r.Bkuptime) - } - if r.Valid.Flags() { - fmt.Fprintf(&buf, " flags=%v", r.Flags) - } - return buf.String() -} - -// Respond replies to the request with the given response, -// giving the updated attributes. -func (r *SetattrRequest) Respond(resp *SetattrResponse) { - size := attrOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*attrOut)(buf.alloc(size)) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A SetattrResponse is the response to a SetattrRequest. -type SetattrResponse struct { - Attr Attr // file attributes -} - -func (r *SetattrResponse) String() string { - return fmt.Sprintf("Setattr %v", r.Attr) -} - -// A FlushRequest asks for the current state of an open file to be flushed -// to storage, as when a file descriptor is being closed. A single opened Handle -// may receive multiple FlushRequests over its lifetime. -type FlushRequest struct { - Header `json:"-"` - Handle HandleID - Flags uint32 - LockOwner uint64 -} - -var _ = Request(&FlushRequest{}) - -func (r *FlushRequest) String() string { - return fmt.Sprintf("Flush [%s] %v fl=%#x lk=%#x", &r.Header, r.Handle, r.Flags, r.LockOwner) -} - -// Respond replies to the request, indicating that the flush succeeded. -func (r *FlushRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A RemoveRequest asks to remove a file or directory from the -// directory r.Node. -type RemoveRequest struct { - Header `json:"-"` - Name string // name of the entry to remove - Dir bool // is this rmdir? -} - -var _ = Request(&RemoveRequest{}) - -func (r *RemoveRequest) String() string { - return fmt.Sprintf("Remove [%s] %q dir=%v", &r.Header, r.Name, r.Dir) -} - -// Respond replies to the request, indicating that the file was removed. -func (r *RemoveRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// A SymlinkRequest is a request to create a symlink making NewName point to Target. -type SymlinkRequest struct { - Header `json:"-"` - NewName, Target string -} - -var _ = Request(&SymlinkRequest{}) - -func (r *SymlinkRequest) String() string { - return fmt.Sprintf("Symlink [%s] from %q to target %q", &r.Header, r.NewName, r.Target) -} - -// Respond replies to the request, indicating that the symlink was created. -func (r *SymlinkRequest) Respond(resp *SymlinkResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A SymlinkResponse is the response to a SymlinkRequest. -type SymlinkResponse struct { - LookupResponse -} - -func (r *SymlinkResponse) String() string { - return fmt.Sprintf("Symlink %v", r.LookupResponse.string()) -} - -// A ReadlinkRequest is a request to read a symlink's target. -type ReadlinkRequest struct { - Header `json:"-"` -} - -var _ = Request(&ReadlinkRequest{}) - -func (r *ReadlinkRequest) String() string { - return fmt.Sprintf("Readlink [%s]", &r.Header) -} - -func (r *ReadlinkRequest) Respond(target string) { - buf := newBuffer(uintptr(len(target))) - buf = append(buf, target...) - r.respond(buf) -} - -// A LinkRequest is a request to create a hard link. -type LinkRequest struct { - Header `json:"-"` - OldNode NodeID - NewName string -} - -var _ = Request(&LinkRequest{}) - -func (r *LinkRequest) String() string { - return fmt.Sprintf("Link [%s] node %d to %q", &r.Header, r.OldNode, r.NewName) -} - -func (r *LinkRequest) Respond(resp *LookupResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -// A RenameRequest is a request to rename a file. -type RenameRequest struct { - Header `json:"-"` - NewDir NodeID - OldName, NewName string -} - -var _ = Request(&RenameRequest{}) - -func (r *RenameRequest) String() string { - return fmt.Sprintf("Rename [%s] from %q to dirnode %v %q", &r.Header, r.OldName, r.NewDir, r.NewName) -} - -func (r *RenameRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -type MknodRequest struct { - Header `json:"-"` - Name string - Mode os.FileMode - Rdev uint32 - // Umask of the request. Not supported on OS X. - Umask os.FileMode -} - -var _ = Request(&MknodRequest{}) - -func (r *MknodRequest) String() string { - return fmt.Sprintf("Mknod [%s] Name %q mode=%v umask=%v rdev=%d", &r.Header, r.Name, r.Mode, r.Umask, r.Rdev) -} - -func (r *MknodRequest) Respond(resp *LookupResponse) { - size := entryOutSize(r.Header.Conn.proto) - buf := newBuffer(size) - out := (*entryOut)(buf.alloc(size)) - out.Nodeid = uint64(resp.Node) - out.Generation = resp.Generation - out.EntryValid = uint64(resp.EntryValid / time.Second) - out.EntryValidNsec = uint32(resp.EntryValid % time.Second / time.Nanosecond) - out.AttrValid = uint64(resp.Attr.Valid / time.Second) - out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond) - resp.Attr.attr(&out.Attr, r.Header.Conn.proto) - r.respond(buf) -} - -type FsyncRequest struct { - Header `json:"-"` - Handle HandleID - // TODO bit 1 is datasync, not well documented upstream - Flags uint32 - Dir bool -} - -var _ = Request(&FsyncRequest{}) - -func (r *FsyncRequest) String() string { - return fmt.Sprintf("Fsync [%s] Handle %v Flags %v", &r.Header, r.Handle, r.Flags) -} - -func (r *FsyncRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} - -// An InterruptRequest is a request to interrupt another pending request. The -// response to that request should return an error status of EINTR. -type InterruptRequest struct { - Header `json:"-"` - IntrID RequestID // ID of the request to be interrupt. -} - -var _ = Request(&InterruptRequest{}) - -func (r *InterruptRequest) Respond() { - // nothing to do here - r.noResponse() -} - -func (r *InterruptRequest) String() string { - return fmt.Sprintf("Interrupt [%s] ID %v", &r.Header, r.IntrID) -} - -// An ExchangeDataRequest is a request to exchange the contents of two -// files, while leaving most metadata untouched. -// -// This request comes from OS X exchangedata(2) and represents its -// specific semantics. Crucially, it is very different from Linux -// renameat(2) RENAME_EXCHANGE. -// -// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/exchangedata.2.html -type ExchangeDataRequest struct { - Header `json:"-"` - OldDir, NewDir NodeID - OldName, NewName string - // TODO options -} - -var _ = Request(&ExchangeDataRequest{}) - -func (r *ExchangeDataRequest) String() string { - // TODO options - return fmt.Sprintf("ExchangeData [%s] %v %q and %v %q", &r.Header, r.OldDir, r.OldName, r.NewDir, r.NewName) -} - -func (r *ExchangeDataRequest) Respond() { - buf := newBuffer(0) - r.respond(buf) -} diff --git a/vendor/bazil.org/fuse/fuse_darwin.go b/vendor/bazil.org/fuse/fuse_darwin.go deleted file mode 100644 index b58dca97d..000000000 --- a/vendor/bazil.org/fuse/fuse_darwin.go +++ /dev/null @@ -1,9 +0,0 @@ -package fuse - -// Maximum file write size we are prepared to receive from the kernel. -// -// This value has to be >=16MB or OSXFUSE (3.4.0 observed) will -// forcibly close the /dev/fuse file descriptor on a Setxattr with a -// 16MB value. See TestSetxattr16MB and -// https://github.com/bazil/fuse/issues/42 -const maxWrite = 16 * 1024 * 1024 diff --git a/vendor/bazil.org/fuse/fuse_freebsd.go b/vendor/bazil.org/fuse/fuse_freebsd.go deleted file mode 100644 index 4aa83a0d4..000000000 --- a/vendor/bazil.org/fuse/fuse_freebsd.go +++ /dev/null @@ -1,6 +0,0 @@ -package fuse - -// Maximum file write size we are prepared to receive from the kernel. -// -// This number is just a guess. -const maxWrite = 128 * 1024 diff --git a/vendor/bazil.org/fuse/fuse_kernel.go b/vendor/bazil.org/fuse/fuse_kernel.go deleted file mode 100644 index 416d32aa1..000000000 --- a/vendor/bazil.org/fuse/fuse_kernel.go +++ /dev/null @@ -1,772 +0,0 @@ -// See the file LICENSE for copyright and licensing information. - -// Derived from FUSE's fuse_kernel.h, which carries this notice: -/* - This file defines the kernel interface of FUSE - Copyright (C) 2001-2007 Miklos Szeredi - - - This -- and only this -- header file may also be distributed under - the terms of the BSD Licence as follows: - - Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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. -*/ - -package fuse - -import ( - "fmt" - "syscall" - "unsafe" -) - -// The FUSE version implemented by the package. -const ( - protoVersionMinMajor = 7 - protoVersionMinMinor = 8 - protoVersionMaxMajor = 7 - protoVersionMaxMinor = 12 -) - -const ( - rootID = 1 -) - -type kstatfs struct { - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Bsize uint32 - Namelen uint32 - Frsize uint32 - _ uint32 - Spare [6]uint32 -} - -type fileLock struct { - Start uint64 - End uint64 - Type uint32 - Pid uint32 -} - -// GetattrFlags are bit flags that can be seen in GetattrRequest. -type GetattrFlags uint32 - -const ( - // Indicates the handle is valid. - GetattrFh GetattrFlags = 1 << 0 -) - -var getattrFlagsNames = []flagName{ - {uint32(GetattrFh), "GetattrFh"}, -} - -func (fl GetattrFlags) String() string { - return flagString(uint32(fl), getattrFlagsNames) -} - -// The SetattrValid are bit flags describing which fields in the SetattrRequest -// are included in the change. -type SetattrValid uint32 - -const ( - SetattrMode SetattrValid = 1 << 0 - SetattrUid SetattrValid = 1 << 1 - SetattrGid SetattrValid = 1 << 2 - SetattrSize SetattrValid = 1 << 3 - SetattrAtime SetattrValid = 1 << 4 - SetattrMtime SetattrValid = 1 << 5 - SetattrHandle SetattrValid = 1 << 6 - - // Linux only(?) - SetattrAtimeNow SetattrValid = 1 << 7 - SetattrMtimeNow SetattrValid = 1 << 8 - SetattrLockOwner SetattrValid = 1 << 9 // http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg27852.html - - // OS X only - SetattrCrtime SetattrValid = 1 << 28 - SetattrChgtime SetattrValid = 1 << 29 - SetattrBkuptime SetattrValid = 1 << 30 - SetattrFlags SetattrValid = 1 << 31 -) - -func (fl SetattrValid) Mode() bool { return fl&SetattrMode != 0 } -func (fl SetattrValid) Uid() bool { return fl&SetattrUid != 0 } -func (fl SetattrValid) Gid() bool { return fl&SetattrGid != 0 } -func (fl SetattrValid) Size() bool { return fl&SetattrSize != 0 } -func (fl SetattrValid) Atime() bool { return fl&SetattrAtime != 0 } -func (fl SetattrValid) Mtime() bool { return fl&SetattrMtime != 0 } -func (fl SetattrValid) Handle() bool { return fl&SetattrHandle != 0 } -func (fl SetattrValid) AtimeNow() bool { return fl&SetattrAtimeNow != 0 } -func (fl SetattrValid) MtimeNow() bool { return fl&SetattrMtimeNow != 0 } -func (fl SetattrValid) LockOwner() bool { return fl&SetattrLockOwner != 0 } -func (fl SetattrValid) Crtime() bool { return fl&SetattrCrtime != 0 } -func (fl SetattrValid) Chgtime() bool { return fl&SetattrChgtime != 0 } -func (fl SetattrValid) Bkuptime() bool { return fl&SetattrBkuptime != 0 } -func (fl SetattrValid) Flags() bool { return fl&SetattrFlags != 0 } - -func (fl SetattrValid) String() string { - return flagString(uint32(fl), setattrValidNames) -} - -var setattrValidNames = []flagName{ - {uint32(SetattrMode), "SetattrMode"}, - {uint32(SetattrUid), "SetattrUid"}, - {uint32(SetattrGid), "SetattrGid"}, - {uint32(SetattrSize), "SetattrSize"}, - {uint32(SetattrAtime), "SetattrAtime"}, - {uint32(SetattrMtime), "SetattrMtime"}, - {uint32(SetattrHandle), "SetattrHandle"}, - {uint32(SetattrAtimeNow), "SetattrAtimeNow"}, - {uint32(SetattrMtimeNow), "SetattrMtimeNow"}, - {uint32(SetattrLockOwner), "SetattrLockOwner"}, - {uint32(SetattrCrtime), "SetattrCrtime"}, - {uint32(SetattrChgtime), "SetattrChgtime"}, - {uint32(SetattrBkuptime), "SetattrBkuptime"}, - {uint32(SetattrFlags), "SetattrFlags"}, -} - -// Flags that can be seen in OpenRequest.Flags. -const ( - // Access modes. These are not 1-bit flags, but alternatives where - // only one can be chosen. See the IsReadOnly etc convenience - // methods. - OpenReadOnly OpenFlags = syscall.O_RDONLY - OpenWriteOnly OpenFlags = syscall.O_WRONLY - OpenReadWrite OpenFlags = syscall.O_RDWR - - // File was opened in append-only mode, all writes will go to end - // of file. OS X does not provide this information. - OpenAppend OpenFlags = syscall.O_APPEND - OpenCreate OpenFlags = syscall.O_CREAT - OpenDirectory OpenFlags = syscall.O_DIRECTORY - OpenExclusive OpenFlags = syscall.O_EXCL - OpenNonblock OpenFlags = syscall.O_NONBLOCK - OpenSync OpenFlags = syscall.O_SYNC - OpenTruncate OpenFlags = syscall.O_TRUNC -) - -// OpenAccessModeMask is a bitmask that separates the access mode -// from the other flags in OpenFlags. -const OpenAccessModeMask OpenFlags = syscall.O_ACCMODE - -// OpenFlags are the O_FOO flags passed to open/create/etc calls. For -// example, os.O_WRONLY | os.O_APPEND. -type OpenFlags uint32 - -func (fl OpenFlags) String() string { - // O_RDONLY, O_RWONLY, O_RDWR are not flags - s := accModeName(fl & OpenAccessModeMask) - flags := uint32(fl &^ OpenAccessModeMask) - if flags != 0 { - s = s + "+" + flagString(flags, openFlagNames) - } - return s -} - -// Return true if OpenReadOnly is set. -func (fl OpenFlags) IsReadOnly() bool { - return fl&OpenAccessModeMask == OpenReadOnly -} - -// Return true if OpenWriteOnly is set. -func (fl OpenFlags) IsWriteOnly() bool { - return fl&OpenAccessModeMask == OpenWriteOnly -} - -// Return true if OpenReadWrite is set. -func (fl OpenFlags) IsReadWrite() bool { - return fl&OpenAccessModeMask == OpenReadWrite -} - -func accModeName(flags OpenFlags) string { - switch flags { - case OpenReadOnly: - return "OpenReadOnly" - case OpenWriteOnly: - return "OpenWriteOnly" - case OpenReadWrite: - return "OpenReadWrite" - default: - return "" - } -} - -var openFlagNames = []flagName{ - {uint32(OpenAppend), "OpenAppend"}, - {uint32(OpenCreate), "OpenCreate"}, - {uint32(OpenDirectory), "OpenDirectory"}, - {uint32(OpenExclusive), "OpenExclusive"}, - {uint32(OpenNonblock), "OpenNonblock"}, - {uint32(OpenSync), "OpenSync"}, - {uint32(OpenTruncate), "OpenTruncate"}, -} - -// The OpenResponseFlags are returned in the OpenResponse. -type OpenResponseFlags uint32 - -const ( - OpenDirectIO OpenResponseFlags = 1 << 0 // bypass page cache for this open file - OpenKeepCache OpenResponseFlags = 1 << 1 // don't invalidate the data cache on open - OpenNonSeekable OpenResponseFlags = 1 << 2 // mark the file as non-seekable (not supported on OS X or FreeBSD) - - OpenPurgeAttr OpenResponseFlags = 1 << 30 // OS X - OpenPurgeUBC OpenResponseFlags = 1 << 31 // OS X -) - -func (fl OpenResponseFlags) String() string { - return flagString(uint32(fl), openResponseFlagNames) -} - -var openResponseFlagNames = []flagName{ - {uint32(OpenDirectIO), "OpenDirectIO"}, - {uint32(OpenKeepCache), "OpenKeepCache"}, - {uint32(OpenNonSeekable), "OpenNonSeekable"}, - {uint32(OpenPurgeAttr), "OpenPurgeAttr"}, - {uint32(OpenPurgeUBC), "OpenPurgeUBC"}, -} - -// The InitFlags are used in the Init exchange. -type InitFlags uint32 - -const ( - InitAsyncRead InitFlags = 1 << 0 - InitPosixLocks InitFlags = 1 << 1 - InitFileOps InitFlags = 1 << 2 - InitAtomicTrunc InitFlags = 1 << 3 - InitExportSupport InitFlags = 1 << 4 - InitBigWrites InitFlags = 1 << 5 - // Do not mask file access modes with umask. Not supported on OS X. - InitDontMask InitFlags = 1 << 6 - InitSpliceWrite InitFlags = 1 << 7 - InitSpliceMove InitFlags = 1 << 8 - InitSpliceRead InitFlags = 1 << 9 - InitFlockLocks InitFlags = 1 << 10 - InitHasIoctlDir InitFlags = 1 << 11 - InitAutoInvalData InitFlags = 1 << 12 - InitDoReaddirplus InitFlags = 1 << 13 - InitReaddirplusAuto InitFlags = 1 << 14 - InitAsyncDIO InitFlags = 1 << 15 - InitWritebackCache InitFlags = 1 << 16 - InitNoOpenSupport InitFlags = 1 << 17 - - InitCaseSensitive InitFlags = 1 << 29 // OS X only - InitVolRename InitFlags = 1 << 30 // OS X only - InitXtimes InitFlags = 1 << 31 // OS X only -) - -type flagName struct { - bit uint32 - name string -} - -var initFlagNames = []flagName{ - {uint32(InitAsyncRead), "InitAsyncRead"}, - {uint32(InitPosixLocks), "InitPosixLocks"}, - {uint32(InitFileOps), "InitFileOps"}, - {uint32(InitAtomicTrunc), "InitAtomicTrunc"}, - {uint32(InitExportSupport), "InitExportSupport"}, - {uint32(InitBigWrites), "InitBigWrites"}, - {uint32(InitDontMask), "InitDontMask"}, - {uint32(InitSpliceWrite), "InitSpliceWrite"}, - {uint32(InitSpliceMove), "InitSpliceMove"}, - {uint32(InitSpliceRead), "InitSpliceRead"}, - {uint32(InitFlockLocks), "InitFlockLocks"}, - {uint32(InitHasIoctlDir), "InitHasIoctlDir"}, - {uint32(InitAutoInvalData), "InitAutoInvalData"}, - {uint32(InitDoReaddirplus), "InitDoReaddirplus"}, - {uint32(InitReaddirplusAuto), "InitReaddirplusAuto"}, - {uint32(InitAsyncDIO), "InitAsyncDIO"}, - {uint32(InitWritebackCache), "InitWritebackCache"}, - {uint32(InitNoOpenSupport), "InitNoOpenSupport"}, - - {uint32(InitCaseSensitive), "InitCaseSensitive"}, - {uint32(InitVolRename), "InitVolRename"}, - {uint32(InitXtimes), "InitXtimes"}, -} - -func (fl InitFlags) String() string { - return flagString(uint32(fl), initFlagNames) -} - -func flagString(f uint32, names []flagName) string { - var s string - - if f == 0 { - return "0" - } - - for _, n := range names { - if f&n.bit != 0 { - s += "+" + n.name - f &^= n.bit - } - } - if f != 0 { - s += fmt.Sprintf("%+#x", f) - } - return s[1:] -} - -// The ReleaseFlags are used in the Release exchange. -type ReleaseFlags uint32 - -const ( - ReleaseFlush ReleaseFlags = 1 << 0 -) - -func (fl ReleaseFlags) String() string { - return flagString(uint32(fl), releaseFlagNames) -} - -var releaseFlagNames = []flagName{ - {uint32(ReleaseFlush), "ReleaseFlush"}, -} - -// Opcodes -const ( - opLookup = 1 - opForget = 2 // no reply - opGetattr = 3 - opSetattr = 4 - opReadlink = 5 - opSymlink = 6 - opMknod = 8 - opMkdir = 9 - opUnlink = 10 - opRmdir = 11 - opRename = 12 - opLink = 13 - opOpen = 14 - opRead = 15 - opWrite = 16 - opStatfs = 17 - opRelease = 18 - opFsync = 20 - opSetxattr = 21 - opGetxattr = 22 - opListxattr = 23 - opRemovexattr = 24 - opFlush = 25 - opInit = 26 - opOpendir = 27 - opReaddir = 28 - opReleasedir = 29 - opFsyncdir = 30 - opGetlk = 31 - opSetlk = 32 - opSetlkw = 33 - opAccess = 34 - opCreate = 35 - opInterrupt = 36 - opBmap = 37 - opDestroy = 38 - opIoctl = 39 // Linux? - opPoll = 40 // Linux? - - // OS X - opSetvolname = 61 - opGetxtimes = 62 - opExchange = 63 -) - -type entryOut struct { - Nodeid uint64 // Inode ID - Generation uint64 // Inode generation - EntryValid uint64 // Cache timeout for the name - AttrValid uint64 // Cache timeout for the attributes - EntryValidNsec uint32 - AttrValidNsec uint32 - Attr attr -} - -func entryOutSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(entryOut{}.Attr) + unsafe.Offsetof(entryOut{}.Attr.Blksize) - default: - return unsafe.Sizeof(entryOut{}) - } -} - -type forgetIn struct { - Nlookup uint64 -} - -type getattrIn struct { - GetattrFlags uint32 - _ uint32 - Fh uint64 -} - -type attrOut struct { - AttrValid uint64 // Cache timeout for the attributes - AttrValidNsec uint32 - _ uint32 - Attr attr -} - -func attrOutSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(attrOut{}.Attr) + unsafe.Offsetof(attrOut{}.Attr.Blksize) - default: - return unsafe.Sizeof(attrOut{}) - } -} - -// OS X -type getxtimesOut struct { - Bkuptime uint64 - Crtime uint64 - BkuptimeNsec uint32 - CrtimeNsec uint32 -} - -type mknodIn struct { - Mode uint32 - Rdev uint32 - Umask uint32 - _ uint32 - // "filename\x00" follows. -} - -func mknodInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 12}): - return unsafe.Offsetof(mknodIn{}.Umask) - default: - return unsafe.Sizeof(mknodIn{}) - } -} - -type mkdirIn struct { - Mode uint32 - Umask uint32 - // filename follows -} - -func mkdirInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 12}): - return unsafe.Offsetof(mkdirIn{}.Umask) + 4 - default: - return unsafe.Sizeof(mkdirIn{}) - } -} - -type renameIn struct { - Newdir uint64 - // "oldname\x00newname\x00" follows -} - -// OS X -type exchangeIn struct { - Olddir uint64 - Newdir uint64 - Options uint64 - // "oldname\x00newname\x00" follows -} - -type linkIn struct { - Oldnodeid uint64 -} - -type setattrInCommon struct { - Valid uint32 - _ uint32 - Fh uint64 - Size uint64 - LockOwner uint64 // unused on OS X? - Atime uint64 - Mtime uint64 - Unused2 uint64 - AtimeNsec uint32 - MtimeNsec uint32 - Unused3 uint32 - Mode uint32 - Unused4 uint32 - Uid uint32 - Gid uint32 - Unused5 uint32 -} - -type openIn struct { - Flags uint32 - Unused uint32 -} - -type openOut struct { - Fh uint64 - OpenFlags uint32 - _ uint32 -} - -type createIn struct { - Flags uint32 - Mode uint32 - Umask uint32 - _ uint32 -} - -func createInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 12}): - return unsafe.Offsetof(createIn{}.Umask) - default: - return unsafe.Sizeof(createIn{}) - } -} - -type releaseIn struct { - Fh uint64 - Flags uint32 - ReleaseFlags uint32 - LockOwner uint32 -} - -type flushIn struct { - Fh uint64 - FlushFlags uint32 - _ uint32 - LockOwner uint64 -} - -type readIn struct { - Fh uint64 - Offset uint64 - Size uint32 - ReadFlags uint32 - LockOwner uint64 - Flags uint32 - _ uint32 -} - -func readInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(readIn{}.ReadFlags) + 4 - default: - return unsafe.Sizeof(readIn{}) - } -} - -// The ReadFlags are passed in ReadRequest. -type ReadFlags uint32 - -const ( - // LockOwner field is valid. - ReadLockOwner ReadFlags = 1 << 1 -) - -var readFlagNames = []flagName{ - {uint32(ReadLockOwner), "ReadLockOwner"}, -} - -func (fl ReadFlags) String() string { - return flagString(uint32(fl), readFlagNames) -} - -type writeIn struct { - Fh uint64 - Offset uint64 - Size uint32 - WriteFlags uint32 - LockOwner uint64 - Flags uint32 - _ uint32 -} - -func writeInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(writeIn{}.LockOwner) - default: - return unsafe.Sizeof(writeIn{}) - } -} - -type writeOut struct { - Size uint32 - _ uint32 -} - -// The WriteFlags are passed in WriteRequest. -type WriteFlags uint32 - -const ( - WriteCache WriteFlags = 1 << 0 - // LockOwner field is valid. - WriteLockOwner WriteFlags = 1 << 1 -) - -var writeFlagNames = []flagName{ - {uint32(WriteCache), "WriteCache"}, - {uint32(WriteLockOwner), "WriteLockOwner"}, -} - -func (fl WriteFlags) String() string { - return flagString(uint32(fl), writeFlagNames) -} - -type statfsOut struct { - St kstatfs -} - -type fsyncIn struct { - Fh uint64 - FsyncFlags uint32 - _ uint32 -} - -type setxattrInCommon struct { - Size uint32 - Flags uint32 -} - -func (setxattrInCommon) position() uint32 { - return 0 -} - -type getxattrInCommon struct { - Size uint32 - _ uint32 -} - -func (getxattrInCommon) position() uint32 { - return 0 -} - -type getxattrOut struct { - Size uint32 - _ uint32 -} - -type lkIn struct { - Fh uint64 - Owner uint64 - Lk fileLock - LkFlags uint32 - _ uint32 -} - -func lkInSize(p Protocol) uintptr { - switch { - case p.LT(Protocol{7, 9}): - return unsafe.Offsetof(lkIn{}.LkFlags) - default: - return unsafe.Sizeof(lkIn{}) - } -} - -type lkOut struct { - Lk fileLock -} - -type accessIn struct { - Mask uint32 - _ uint32 -} - -type initIn struct { - Major uint32 - Minor uint32 - MaxReadahead uint32 - Flags uint32 -} - -const initInSize = int(unsafe.Sizeof(initIn{})) - -type initOut struct { - Major uint32 - Minor uint32 - MaxReadahead uint32 - Flags uint32 - Unused uint32 - MaxWrite uint32 -} - -type interruptIn struct { - Unique uint64 -} - -type bmapIn struct { - Block uint64 - BlockSize uint32 - _ uint32 -} - -type bmapOut struct { - Block uint64 -} - -type inHeader struct { - Len uint32 - Opcode uint32 - Unique uint64 - Nodeid uint64 - Uid uint32 - Gid uint32 - Pid uint32 - _ uint32 -} - -const inHeaderSize = int(unsafe.Sizeof(inHeader{})) - -type outHeader struct { - Len uint32 - Error int32 - Unique uint64 -} - -type dirent struct { - Ino uint64 - Off uint64 - Namelen uint32 - Type uint32 - Name [0]byte -} - -const direntSize = 8 + 8 + 4 + 4 - -const ( - notifyCodePoll int32 = 1 - notifyCodeInvalInode int32 = 2 - notifyCodeInvalEntry int32 = 3 -) - -type notifyInvalInodeOut struct { - Ino uint64 - Off int64 - Len int64 -} - -type notifyInvalEntryOut struct { - Parent uint64 - Namelen uint32 - _ uint32 -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_darwin.go b/vendor/bazil.org/fuse/fuse_kernel_darwin.go deleted file mode 100644 index b9873fdf3..000000000 --- a/vendor/bazil.org/fuse/fuse_kernel_darwin.go +++ /dev/null @@ -1,88 +0,0 @@ -package fuse - -import ( - "time" -) - -type attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - Crtime_ uint64 // OS X only - AtimeNsec uint32 - MtimeNsec uint32 - CtimeNsec uint32 - CrtimeNsec uint32 // OS X only - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint32 - Flags_ uint32 // OS X only; see chflags(2) - Blksize uint32 - padding uint32 -} - -func (a *attr) SetCrtime(s uint64, ns uint32) { - a.Crtime_, a.CrtimeNsec = s, ns -} - -func (a *attr) SetFlags(f uint32) { - a.Flags_ = f -} - -type setattrIn struct { - setattrInCommon - - // OS X only - Bkuptime_ uint64 - Chgtime_ uint64 - Crtime uint64 - BkuptimeNsec uint32 - ChgtimeNsec uint32 - CrtimeNsec uint32 - Flags_ uint32 // see chflags(2) -} - -func (in *setattrIn) BkupTime() time.Time { - return time.Unix(int64(in.Bkuptime_), int64(in.BkuptimeNsec)) -} - -func (in *setattrIn) Chgtime() time.Time { - return time.Unix(int64(in.Chgtime_), int64(in.ChgtimeNsec)) -} - -func (in *setattrIn) Flags() uint32 { - return in.Flags_ -} - -func openFlags(flags uint32) OpenFlags { - return OpenFlags(flags) -} - -type getxattrIn struct { - getxattrInCommon - - // OS X only - Position uint32 - Padding uint32 -} - -func (g *getxattrIn) position() uint32 { - return g.Position -} - -type setxattrIn struct { - setxattrInCommon - - // OS X only - Position uint32 - Padding uint32 -} - -func (s *setxattrIn) position() uint32 { - return s.Position -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_freebsd.go b/vendor/bazil.org/fuse/fuse_kernel_freebsd.go deleted file mode 100644 index b1141e41d..000000000 --- a/vendor/bazil.org/fuse/fuse_kernel_freebsd.go +++ /dev/null @@ -1,62 +0,0 @@ -package fuse - -import "time" - -type attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - AtimeNsec uint32 - MtimeNsec uint32 - CtimeNsec uint32 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint32 - Blksize uint32 - padding uint32 -} - -func (a *attr) Crtime() time.Time { - return time.Time{} -} - -func (a *attr) SetCrtime(s uint64, ns uint32) { - // ignored on freebsd -} - -func (a *attr) SetFlags(f uint32) { - // ignored on freebsd -} - -type setattrIn struct { - setattrInCommon -} - -func (in *setattrIn) BkupTime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Chgtime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Flags() uint32 { - return 0 -} - -func openFlags(flags uint32) OpenFlags { - return OpenFlags(flags) -} - -type getxattrIn struct { - getxattrInCommon -} - -type setxattrIn struct { - setxattrInCommon -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_linux.go b/vendor/bazil.org/fuse/fuse_kernel_linux.go deleted file mode 100644 index fe603de92..000000000 --- a/vendor/bazil.org/fuse/fuse_kernel_linux.go +++ /dev/null @@ -1,70 +0,0 @@ -package fuse - -import "time" - -type attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - AtimeNsec uint32 - MtimeNsec uint32 - CtimeNsec uint32 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint32 - Blksize uint32 - _ uint32 -} - -func (a *attr) Crtime() time.Time { - return time.Time{} -} - -func (a *attr) SetCrtime(s uint64, ns uint32) { - // Ignored on Linux. -} - -func (a *attr) SetFlags(f uint32) { - // Ignored on Linux. -} - -type setattrIn struct { - setattrInCommon -} - -func (in *setattrIn) BkupTime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Chgtime() time.Time { - return time.Time{} -} - -func (in *setattrIn) Flags() uint32 { - return 0 -} - -func openFlags(flags uint32) OpenFlags { - // on amd64, the 32-bit O_LARGEFILE flag is always seen; - // on i386, the flag probably depends on the app - // requesting, but in any case should be utterly - // uninteresting to us here; our kernel protocol messages - // are not directly related to the client app's kernel - // API/ABI - flags &^= 0x8000 - - return OpenFlags(flags) -} - -type getxattrIn struct { - getxattrInCommon -} - -type setxattrIn struct { - setxattrInCommon -} diff --git a/vendor/bazil.org/fuse/fuse_kernel_std.go b/vendor/bazil.org/fuse/fuse_kernel_std.go deleted file mode 100644 index 074cfd322..000000000 --- a/vendor/bazil.org/fuse/fuse_kernel_std.go +++ /dev/null @@ -1 +0,0 @@ -package fuse diff --git a/vendor/bazil.org/fuse/fuse_linux.go b/vendor/bazil.org/fuse/fuse_linux.go deleted file mode 100644 index 5fb96f9ae..000000000 --- a/vendor/bazil.org/fuse/fuse_linux.go +++ /dev/null @@ -1,7 +0,0 @@ -package fuse - -// Maximum file write size we are prepared to receive from the kernel. -// -// Linux 4.2.0 has been observed to cap this value at 128kB -// (FUSE_MAX_PAGES_PER_REQ=32, 4kB pages). -const maxWrite = 128 * 1024 diff --git a/vendor/bazil.org/fuse/fuseutil/fuseutil.go b/vendor/bazil.org/fuse/fuseutil/fuseutil.go deleted file mode 100644 index b3f52b73b..000000000 --- a/vendor/bazil.org/fuse/fuseutil/fuseutil.go +++ /dev/null @@ -1,20 +0,0 @@ -package fuseutil // import "bazil.org/fuse/fuseutil" - -import ( - "bazil.org/fuse" -) - -// HandleRead handles a read request assuming that data is the entire file content. -// It adjusts the amount returned in resp according to req.Offset and req.Size. -func HandleRead(req *fuse.ReadRequest, resp *fuse.ReadResponse, data []byte) { - if req.Offset >= int64(len(data)) { - data = nil - } else { - data = data[req.Offset:] - } - if len(data) > req.Size { - data = data[:req.Size] - } - n := copy(resp.Data[:req.Size], data) - resp.Data = resp.Data[:n] -} diff --git a/vendor/bazil.org/fuse/go.mod b/vendor/bazil.org/fuse/go.mod deleted file mode 100644 index a80fda910..000000000 --- a/vendor/bazil.org/fuse/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module bazil.org/fuse - -go 1.13 - -require ( - github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c - golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 -) diff --git a/vendor/bazil.org/fuse/go.sum b/vendor/bazil.org/fuse/go.sum deleted file mode 100644 index ef81dc7c2..000000000 --- a/vendor/bazil.org/fuse/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ= -github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 h1:gSbV7h1NRL2G1xTg/owz62CST1oJBmxy4QpMMregXVQ= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/bazil.org/fuse/mount.go b/vendor/bazil.org/fuse/mount.go deleted file mode 100644 index 8054e9021..000000000 --- a/vendor/bazil.org/fuse/mount.go +++ /dev/null @@ -1,38 +0,0 @@ -package fuse - -import ( - "bufio" - "errors" - "io" - "log" - "sync" -) - -var ( - // ErrOSXFUSENotFound is returned from Mount when the OSXFUSE - // installation is not detected. - // - // Only happens on OS X. Make sure OSXFUSE is installed, or see - // OSXFUSELocations for customization. - ErrOSXFUSENotFound = errors.New("cannot locate OSXFUSE") -) - -func neverIgnoreLine(line string) bool { - return false -} - -func lineLogger(wg *sync.WaitGroup, prefix string, ignore func(line string) bool, r io.ReadCloser) { - defer wg.Done() - - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := scanner.Text() - if ignore(line) { - continue - } - log.Printf("%s: %s", prefix, line) - } - if err := scanner.Err(); err != nil { - log.Printf("%s, error reading: %v", prefix, err) - } -} diff --git a/vendor/bazil.org/fuse/mount_darwin.go b/vendor/bazil.org/fuse/mount_darwin.go deleted file mode 100644 index c1c36e62b..000000000 --- a/vendor/bazil.org/fuse/mount_darwin.go +++ /dev/null @@ -1,208 +0,0 @@ -package fuse - -import ( - "errors" - "fmt" - "log" - "os" - "os/exec" - "path" - "strconv" - "strings" - "sync" - "syscall" -) - -var ( - errNoAvail = errors.New("no available fuse devices") - errNotLoaded = errors.New("osxfuse is not loaded") -) - -func loadOSXFUSE(bin string) error { - cmd := exec.Command(bin) - cmd.Dir = "/" - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - err := cmd.Run() - return err -} - -func openOSXFUSEDev(devPrefix string) (*os.File, error) { - var f *os.File - var err error - for i := uint64(0); ; i++ { - path := devPrefix + strconv.FormatUint(i, 10) - f, err = os.OpenFile(path, os.O_RDWR, 0000) - if os.IsNotExist(err) { - if i == 0 { - // not even the first device was found -> fuse is not loaded - return nil, errNotLoaded - } - - // we've run out of kernel-provided devices - return nil, errNoAvail - } - - if err2, ok := err.(*os.PathError); ok && err2.Err == syscall.EBUSY { - // try the next one - continue - } - - if err != nil { - return nil, err - } - return f, nil - } -} - -func handleMountOSXFUSE(helperName string, errCh chan<- error) func(line string) (ignore bool) { - var noMountpointPrefix = helperName + `: ` - const noMountpointSuffix = `: No such file or directory` - return func(line string) (ignore bool) { - if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) { - // re-extract it from the error message in case some layer - // changed the path - mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)] - err := &MountpointDoesNotExistError{ - Path: mountpoint, - } - select { - case errCh <- err: - return true - default: - // not the first error; fall back to logging it - return false - } - } - - return false - } -} - -// isBoringMountOSXFUSEError returns whether the Wait error is -// uninteresting; exit status 64 is. -func isBoringMountOSXFUSEError(err error) bool { - if err, ok := err.(*exec.ExitError); ok && err.Exited() { - if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 64 { - return true - } - } - return false -} - -func callMount(bin string, daemonVar string, dir string, conf *mountConfig, f *os.File, ready chan<- struct{}, errp *error) error { - for k, v := range conf.options { - if strings.Contains(k, ",") || strings.Contains(v, ",") { - // Silly limitation but the mount helper does not - // understand any escaping. See TestMountOptionCommaError. - return fmt.Errorf("mount options cannot contain commas on darwin: %q=%q", k, v) - } - } - cmd := exec.Command( - bin, - "-o", conf.getOptions(), - // Tell osxfuse-kext how large our buffer is. It must split - // writes larger than this into multiple writes. - // - // OSXFUSE seems to ignore InitResponse.MaxWrite, and uses - // this instead. - "-o", "iosize="+strconv.FormatUint(maxWrite, 10), - // refers to fd passed in cmd.ExtraFiles - "3", - dir, - ) - cmd.ExtraFiles = []*os.File{f} - cmd.Env = os.Environ() - // OSXFUSE <3.3.0 - cmd.Env = append(cmd.Env, "MOUNT_FUSEFS_CALL_BY_LIB=") - // OSXFUSE >=3.3.0 - cmd.Env = append(cmd.Env, "MOUNT_OSXFUSE_CALL_BY_LIB=") - - daemon := os.Args[0] - if daemonVar != "" { - cmd.Env = append(cmd.Env, daemonVar+"="+daemon) - } - - stdout, err := cmd.StdoutPipe() - if err != nil { - return fmt.Errorf("setting up mount_osxfusefs stderr: %v", err) - } - stderr, err := cmd.StderrPipe() - if err != nil { - return fmt.Errorf("setting up mount_osxfusefs stderr: %v", err) - } - - if err := cmd.Start(); err != nil { - return fmt.Errorf("mount_osxfusefs: %v", err) - } - helperErrCh := make(chan error, 1) - go func() { - var wg sync.WaitGroup - wg.Add(2) - go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout) - helperName := path.Base(bin) - go lineLogger(&wg, "mount helper error", handleMountOSXFUSE(helperName, helperErrCh), stderr) - wg.Wait() - if err := cmd.Wait(); err != nil { - // see if we have a better error to report - select { - case helperErr := <-helperErrCh: - // log the Wait error if it's not what we expected - if !isBoringMountOSXFUSEError(err) { - log.Printf("mount helper failed: %v", err) - } - // and now return what we grabbed from stderr as the real - // error - *errp = helperErr - close(ready) - return - default: - // nope, fall back to generic message - } - - *errp = fmt.Errorf("mount_osxfusefs: %v", err) - close(ready) - return - } - - *errp = nil - close(ready) - }() - return nil -} - -func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) { - locations := conf.osxfuseLocations - if locations == nil { - locations = []OSXFUSEPaths{ - OSXFUSELocationV3, - OSXFUSELocationV2, - } - } - for _, loc := range locations { - if _, err := os.Stat(loc.Mount); os.IsNotExist(err) { - // try the other locations - continue - } - - f, err := openOSXFUSEDev(loc.DevicePrefix) - if err == errNotLoaded { - err = loadOSXFUSE(loc.Load) - if err != nil { - return nil, err - } - // try again - f, err = openOSXFUSEDev(loc.DevicePrefix) - } - if err != nil { - return nil, err - } - err = callMount(loc.Mount, loc.DaemonVar, dir, conf, f, ready, errp) - if err != nil { - f.Close() - return nil, err - } - return f, nil - } - return nil, ErrOSXFUSENotFound -} diff --git a/vendor/bazil.org/fuse/mount_freebsd.go b/vendor/bazil.org/fuse/mount_freebsd.go deleted file mode 100644 index 70bb41024..000000000 --- a/vendor/bazil.org/fuse/mount_freebsd.go +++ /dev/null @@ -1,111 +0,0 @@ -package fuse - -import ( - "fmt" - "log" - "os" - "os/exec" - "strings" - "sync" - "syscall" -) - -func handleMountFusefsStderr(errCh chan<- error) func(line string) (ignore bool) { - return func(line string) (ignore bool) { - const ( - noMountpointPrefix = `mount_fusefs: ` - noMountpointSuffix = `: No such file or directory` - ) - if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) { - // re-extract it from the error message in case some layer - // changed the path - mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)] - err := &MountpointDoesNotExistError{ - Path: mountpoint, - } - select { - case errCh <- err: - return true - default: - // not the first error; fall back to logging it - return false - } - } - - return false - } -} - -// isBoringMountFusefsError returns whether the Wait error is -// uninteresting; exit status 1 is. -func isBoringMountFusefsError(err error) bool { - if err, ok := err.(*exec.ExitError); ok && err.Exited() { - if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 1 { - return true - } - } - return false -} - -func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) { - for k, v := range conf.options { - if strings.Contains(k, ",") || strings.Contains(v, ",") { - // Silly limitation but the mount helper does not - // understand any escaping. See TestMountOptionCommaError. - return nil, fmt.Errorf("mount options cannot contain commas on FreeBSD: %q=%q", k, v) - } - } - - f, err := os.OpenFile("/dev/fuse", os.O_RDWR, 0000) - if err != nil { - *errp = err - return nil, err - } - - cmd := exec.Command( - "/sbin/mount_fusefs", - "--safe", - "-o", conf.getOptions(), - "3", - dir, - ) - cmd.ExtraFiles = []*os.File{f} - - stdout, err := cmd.StdoutPipe() - if err != nil { - return nil, fmt.Errorf("setting up mount_fusefs stderr: %v", err) - } - stderr, err := cmd.StderrPipe() - if err != nil { - return nil, fmt.Errorf("setting up mount_fusefs stderr: %v", err) - } - - if err := cmd.Start(); err != nil { - return nil, fmt.Errorf("mount_fusefs: %v", err) - } - helperErrCh := make(chan error, 1) - var wg sync.WaitGroup - wg.Add(2) - go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout) - go lineLogger(&wg, "mount helper error", handleMountFusefsStderr(helperErrCh), stderr) - wg.Wait() - if err := cmd.Wait(); err != nil { - // see if we have a better error to report - select { - case helperErr := <-helperErrCh: - // log the Wait error if it's not what we expected - if !isBoringMountFusefsError(err) { - log.Printf("mount helper failed: %v", err) - } - // and now return what we grabbed from stderr as the real - // error - return nil, helperErr - default: - // nope, fall back to generic message - } - return nil, fmt.Errorf("mount_fusefs: %v", err) - } - - close(ready) - return f, nil -} diff --git a/vendor/bazil.org/fuse/mount_linux.go b/vendor/bazil.org/fuse/mount_linux.go deleted file mode 100644 index 197d1044e..000000000 --- a/vendor/bazil.org/fuse/mount_linux.go +++ /dev/null @@ -1,150 +0,0 @@ -package fuse - -import ( - "fmt" - "log" - "net" - "os" - "os/exec" - "strings" - "sync" - "syscall" -) - -func handleFusermountStderr(errCh chan<- error) func(line string) (ignore bool) { - return func(line string) (ignore bool) { - if line == `fusermount: failed to open /etc/fuse.conf: Permission denied` { - // Silence this particular message, it occurs way too - // commonly and isn't very relevant to whether the mount - // succeeds or not. - return true - } - - const ( - noMountpointPrefix = `fusermount: failed to access mountpoint ` - noMountpointSuffix = `: No such file or directory` - ) - if strings.HasPrefix(line, noMountpointPrefix) && strings.HasSuffix(line, noMountpointSuffix) { - // re-extract it from the error message in case some layer - // changed the path - mountpoint := line[len(noMountpointPrefix) : len(line)-len(noMountpointSuffix)] - err := &MountpointDoesNotExistError{ - Path: mountpoint, - } - select { - case errCh <- err: - return true - default: - // not the first error; fall back to logging it - return false - } - } - - return false - } -} - -// isBoringFusermountError returns whether the Wait error is -// uninteresting; exit status 1 is. -func isBoringFusermountError(err error) bool { - if err, ok := err.(*exec.ExitError); ok && err.Exited() { - if status, ok := err.Sys().(syscall.WaitStatus); ok && status.ExitStatus() == 1 { - return true - } - } - return false -} - -func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (fusefd *os.File, err error) { - // linux mount is never delayed - close(ready) - - fds, err := syscall.Socketpair(syscall.AF_FILE, syscall.SOCK_STREAM, 0) - if err != nil { - return nil, fmt.Errorf("socketpair error: %v", err) - } - - writeFile := os.NewFile(uintptr(fds[0]), "fusermount-child-writes") - defer writeFile.Close() - - readFile := os.NewFile(uintptr(fds[1]), "fusermount-parent-reads") - defer readFile.Close() - - cmd := exec.Command( - "fusermount", - "-o", conf.getOptions(), - "--", - dir, - ) - cmd.Env = append(os.Environ(), "_FUSE_COMMFD=3") - - cmd.ExtraFiles = []*os.File{writeFile} - - var wg sync.WaitGroup - stdout, err := cmd.StdoutPipe() - if err != nil { - return nil, fmt.Errorf("setting up fusermount stderr: %v", err) - } - stderr, err := cmd.StderrPipe() - if err != nil { - return nil, fmt.Errorf("setting up fusermount stderr: %v", err) - } - - if err := cmd.Start(); err != nil { - return nil, fmt.Errorf("fusermount: %v", err) - } - helperErrCh := make(chan error, 1) - wg.Add(2) - go lineLogger(&wg, "mount helper output", neverIgnoreLine, stdout) - go lineLogger(&wg, "mount helper error", handleFusermountStderr(helperErrCh), stderr) - wg.Wait() - if err := cmd.Wait(); err != nil { - // see if we have a better error to report - select { - case helperErr := <-helperErrCh: - // log the Wait error if it's not what we expected - if !isBoringFusermountError(err) { - log.Printf("mount helper failed: %v", err) - } - // and now return what we grabbed from stderr as the real - // error - return nil, helperErr - default: - // nope, fall back to generic message - } - - return nil, fmt.Errorf("fusermount: %v", err) - } - - c, err := net.FileConn(readFile) - if err != nil { - return nil, fmt.Errorf("FileConn from fusermount socket: %v", err) - } - defer c.Close() - - uc, ok := c.(*net.UnixConn) - if !ok { - return nil, fmt.Errorf("unexpected FileConn type; expected UnixConn, got %T", c) - } - - buf := make([]byte, 32) // expect 1 byte - oob := make([]byte, 32) // expect 24 bytes - _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob) - scms, err := syscall.ParseSocketControlMessage(oob[:oobn]) - if err != nil { - return nil, fmt.Errorf("ParseSocketControlMessage: %v", err) - } - if len(scms) != 1 { - return nil, fmt.Errorf("expected 1 SocketControlMessage; got scms = %#v", scms) - } - scm := scms[0] - gotFds, err := syscall.ParseUnixRights(&scm) - if err != nil { - return nil, fmt.Errorf("syscall.ParseUnixRights: %v", err) - } - if len(gotFds) != 1 { - return nil, fmt.Errorf("wanted 1 fd; got %#v", gotFds) - } - f := os.NewFile(uintptr(gotFds[0]), "/dev/fuse") - return f, nil -} diff --git a/vendor/bazil.org/fuse/options.go b/vendor/bazil.org/fuse/options.go deleted file mode 100644 index f09ffd4ed..000000000 --- a/vendor/bazil.org/fuse/options.go +++ /dev/null @@ -1,296 +0,0 @@ -package fuse - -import ( - "errors" - "strings" -) - -func dummyOption(conf *mountConfig) error { - return nil -} - -// mountConfig holds the configuration for a mount operation. -// Use it by passing MountOption values to Mount. -type mountConfig struct { - options map[string]string - maxReadahead uint32 - initFlags InitFlags - osxfuseLocations []OSXFUSEPaths -} - -func escapeComma(s string) string { - s = strings.Replace(s, `\`, `\\`, -1) - s = strings.Replace(s, `,`, `\,`, -1) - return s -} - -// getOptions makes a string of options suitable for passing to FUSE -// mount flag `-o`. Returns an empty string if no options were set. -// Any platform specific adjustments should happen before the call. -func (m *mountConfig) getOptions() string { - var opts []string - for k, v := range m.options { - k = escapeComma(k) - if v != "" { - k += "=" + escapeComma(v) - } - opts = append(opts, k) - } - return strings.Join(opts, ",") -} - -type mountOption func(*mountConfig) error - -// MountOption is passed to Mount to change the behavior of the mount. -type MountOption mountOption - -// FSName sets the file system name (also called source) that is -// visible in the list of mounted file systems. -// -// FreeBSD ignores this option. -func FSName(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["fsname"] = name - return nil - } -} - -// Subtype sets the subtype of the mount. The main type is always -// `fuse`. The type in a list of mounted file systems will look like -// `fuse.foo`. -// -// OS X ignores this option. -// FreeBSD ignores this option. -func Subtype(fstype string) MountOption { - return func(conf *mountConfig) error { - conf.options["subtype"] = fstype - return nil - } -} - -// LocalVolume sets the volume to be local (instead of network), -// changing the behavior of Finder, Spotlight, and such. -// -// OS X only. Others ignore this option. -func LocalVolume() MountOption { - return localVolume -} - -// VolumeName sets the volume name shown in Finder. -// -// OS X only. Others ignore this option. -func VolumeName(name string) MountOption { - return volumeName(name) -} - -// NoAppleDouble makes OSXFUSE disallow files with names used by OS X -// to store extended attributes on file systems that do not support -// them natively. -// -// Such file names are: -// -// ._* -// .DS_Store -// -// OS X only. Others ignore this option. -func NoAppleDouble() MountOption { - return noAppleDouble -} - -// NoAppleXattr makes OSXFUSE disallow extended attributes with the -// prefix "com.apple.". This disables persistent Finder state and -// other such information. -// -// OS X only. Others ignore this option. -func NoAppleXattr() MountOption { - return noAppleXattr -} - -// NoBrowse makes OSXFUSE mark the volume as non-browsable, so that -// Finder won't automatically browse it. -// -// OS X only. Others ignore this option. -func NoBrowse() MountOption { - return noBrowse -} - -// ExclCreate causes O_EXCL flag to be set for only "truly" exclusive creates, -// i.e. create calls for which the initiator explicitly set the O_EXCL flag. -// -// OSXFUSE expects all create calls to return EEXIST in case the file -// already exists, regardless of whether O_EXCL was specified or not. -// To ensure this behavior, it normally sets OpenExclusive for all -// Create calls, regardless of whether the original call had it set. -// For distributed filesystems, that may force every file create to be -// a distributed consensus action, causing undesirable delays. -// -// This option makes the FUSE filesystem see the original flag value, -// and better decide when to ensure global consensus. -// -// Note that returning EEXIST on existing file create is still -// expected with OSXFUSE, regardless of the presence of the -// OpenExclusive flag. -// -// For more information, see -// https://github.com/osxfuse/osxfuse/issues/209 -// -// OS X only. Others ignore this options. -// Requires OSXFUSE 3.4.1 or newer. -func ExclCreate() MountOption { - return exclCreate -} - -// DaemonTimeout sets the time in seconds between a request and a reply before -// the FUSE mount is declared dead. -// -// OS X and FreeBSD only. Others ignore this option. -func DaemonTimeout(name string) MountOption { - return daemonTimeout(name) -} - -// AllowOther allows other users to access the file system. -func AllowOther() MountOption { - return func(conf *mountConfig) error { - conf.options["allow_other"] = "" - return nil - } -} - -// AllowDev enables interpreting character or block special devices on the -// filesystem. -func AllowDev() MountOption { - return func(conf *mountConfig) error { - conf.options["dev"] = "" - return nil - } -} - -// AllowSUID allows set-user-identifier or set-group-identifier bits to take -// effect. -func AllowSUID() MountOption { - return func(conf *mountConfig) error { - conf.options["suid"] = "" - return nil - } -} - -// DefaultPermissions makes the kernel enforce access control based on -// the file mode (as in chmod). -// -// Without this option, the Node itself decides what is and is not -// allowed. This is normally ok because FUSE file systems cannot be -// accessed by other users without AllowOther. -// -// FreeBSD ignores this option. -func DefaultPermissions() MountOption { - return func(conf *mountConfig) error { - conf.options["default_permissions"] = "" - return nil - } -} - -// ReadOnly makes the mount read-only. -func ReadOnly() MountOption { - return func(conf *mountConfig) error { - conf.options["ro"] = "" - return nil - } -} - -// MaxReadahead sets the number of bytes that can be prefetched for -// sequential reads. The kernel can enforce a maximum value lower than -// this. -// -// This setting makes the kernel perform speculative reads that do not -// originate from any client process. This usually tremendously -// improves read performance. -func MaxReadahead(n uint32) MountOption { - return func(conf *mountConfig) error { - conf.maxReadahead = n - return nil - } -} - -// AsyncRead enables multiple outstanding read requests for the same -// handle. Without this, there is at most one request in flight at a -// time. -func AsyncRead() MountOption { - return func(conf *mountConfig) error { - conf.initFlags |= InitAsyncRead - return nil - } -} - -// WritebackCache enables the kernel to buffer writes before sending -// them to the FUSE server. Without this, writethrough caching is -// used. -func WritebackCache() MountOption { - return func(conf *mountConfig) error { - conf.initFlags |= InitWritebackCache - return nil - } -} - -// OSXFUSEPaths describes the paths used by an installed OSXFUSE -// version. See OSXFUSELocationV3 for typical values. -type OSXFUSEPaths struct { - // Prefix for the device file. At mount time, an incrementing - // number is suffixed until a free FUSE device is found. - DevicePrefix string - // Path of the load helper, used to load the kernel extension if - // no device files are found. - Load string - // Path of the mount helper, used for the actual mount operation. - Mount string - // Environment variable used to pass the path to the executable - // calling the mount helper. - DaemonVar string -} - -// Default paths for OSXFUSE. See OSXFUSELocations. -var ( - OSXFUSELocationV3 = OSXFUSEPaths{ - DevicePrefix: "/dev/osxfuse", - Load: "/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse", - Mount: "/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse", - DaemonVar: "MOUNT_OSXFUSE_DAEMON_PATH", - } - OSXFUSELocationV2 = OSXFUSEPaths{ - DevicePrefix: "/dev/osxfuse", - Load: "/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs", - Mount: "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs", - DaemonVar: "MOUNT_FUSEFS_DAEMON_PATH", - } -) - -// OSXFUSELocations sets where to look for OSXFUSE files. The -// arguments are all the possible locations. The previous locations -// are replaced. -// -// Without this option, OSXFUSELocationV3 and OSXFUSELocationV2 are -// used. -// -// OS X only. Others ignore this option. -func OSXFUSELocations(paths ...OSXFUSEPaths) MountOption { - return func(conf *mountConfig) error { - if len(paths) == 0 { - return errors.New("must specify at least one location for OSXFUSELocations") - } - // replace previous values, but make a copy so there's no - // worries about caller mutating their slice - conf.osxfuseLocations = append(conf.osxfuseLocations[:0], paths...) - return nil - } -} - -// AllowNonEmptyMount allows the mounting over a non-empty directory. -// -// The files in it will be shadowed by the freshly created mount. By -// default these mounts are rejected to prevent accidental covering up -// of data, which could for example prevent automatic backup. -func AllowNonEmptyMount() MountOption { - return func(conf *mountConfig) error { - conf.options["nonempty"] = "" - return nil - } -} diff --git a/vendor/bazil.org/fuse/options_darwin.go b/vendor/bazil.org/fuse/options_darwin.go deleted file mode 100644 index a85e64cbf..000000000 --- a/vendor/bazil.org/fuse/options_darwin.go +++ /dev/null @@ -1,40 +0,0 @@ -package fuse - -func localVolume(conf *mountConfig) error { - conf.options["local"] = "" - return nil -} - -func volumeName(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["volname"] = name - return nil - } -} - -func daemonTimeout(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["daemon_timeout"] = name - return nil - } -} - -func noAppleXattr(conf *mountConfig) error { - conf.options["noapplexattr"] = "" - return nil -} - -func noAppleDouble(conf *mountConfig) error { - conf.options["noappledouble"] = "" - return nil -} - -func exclCreate(conf *mountConfig) error { - conf.options["excl_create"] = "" - return nil -} - -func noBrowse(conf *mountConfig) error { - conf.options["nobrowse"] = "" - return nil -} diff --git a/vendor/bazil.org/fuse/options_freebsd.go b/vendor/bazil.org/fuse/options_freebsd.go deleted file mode 100644 index 2c956e7fb..000000000 --- a/vendor/bazil.org/fuse/options_freebsd.go +++ /dev/null @@ -1,32 +0,0 @@ -package fuse - -func localVolume(conf *mountConfig) error { - return nil -} - -func volumeName(name string) MountOption { - return dummyOption -} - -func daemonTimeout(name string) MountOption { - return func(conf *mountConfig) error { - conf.options["timeout"] = name - return nil - } -} - -func noAppleXattr(conf *mountConfig) error { - return nil -} - -func noAppleDouble(conf *mountConfig) error { - return nil -} - -func exclCreate(conf *mountConfig) error { - return nil -} - -func noBrowse(conf *mountConfig) error { - return nil -} diff --git a/vendor/bazil.org/fuse/options_linux.go b/vendor/bazil.org/fuse/options_linux.go deleted file mode 100644 index 2c925b18d..000000000 --- a/vendor/bazil.org/fuse/options_linux.go +++ /dev/null @@ -1,29 +0,0 @@ -package fuse - -func localVolume(conf *mountConfig) error { - return nil -} - -func volumeName(name string) MountOption { - return dummyOption -} - -func daemonTimeout(name string) MountOption { - return dummyOption -} - -func noAppleXattr(conf *mountConfig) error { - return nil -} - -func noAppleDouble(conf *mountConfig) error { - return nil -} - -func exclCreate(conf *mountConfig) error { - return nil -} - -func noBrowse(conf *mountConfig) error { - return nil -} diff --git a/vendor/bazil.org/fuse/protocol.go b/vendor/bazil.org/fuse/protocol.go deleted file mode 100644 index a77bbf72f..000000000 --- a/vendor/bazil.org/fuse/protocol.go +++ /dev/null @@ -1,75 +0,0 @@ -package fuse - -import ( - "fmt" -) - -// Protocol is a FUSE protocol version number. -type Protocol struct { - Major uint32 - Minor uint32 -} - -func (p Protocol) String() string { - return fmt.Sprintf("%d.%d", p.Major, p.Minor) -} - -// LT returns whether a is less than b. -func (a Protocol) LT(b Protocol) bool { - return a.Major < b.Major || - (a.Major == b.Major && a.Minor < b.Minor) -} - -// GE returns whether a is greater than or equal to b. -func (a Protocol) GE(b Protocol) bool { - return a.Major > b.Major || - (a.Major == b.Major && a.Minor >= b.Minor) -} - -func (a Protocol) is79() bool { - return a.GE(Protocol{7, 9}) -} - -// HasAttrBlockSize returns whether Attr.BlockSize is respected by the -// kernel. -func (a Protocol) HasAttrBlockSize() bool { - return a.is79() -} - -// HasReadWriteFlags returns whether ReadRequest/WriteRequest -// fields Flags and FileFlags are valid. -func (a Protocol) HasReadWriteFlags() bool { - return a.is79() -} - -// HasGetattrFlags returns whether GetattrRequest field Flags is -// valid. -func (a Protocol) HasGetattrFlags() bool { - return a.is79() -} - -func (a Protocol) is710() bool { - return a.GE(Protocol{7, 10}) -} - -// HasOpenNonSeekable returns whether OpenResponse field Flags flag -// OpenNonSeekable is supported. -func (a Protocol) HasOpenNonSeekable() bool { - return a.is710() -} - -func (a Protocol) is712() bool { - return a.GE(Protocol{7, 12}) -} - -// HasUmask returns whether CreateRequest/MkdirRequest/MknodRequest -// field Umask is valid. -func (a Protocol) HasUmask() bool { - return a.is712() -} - -// HasInvalidate returns whether InvalidateNode/InvalidateEntry are -// supported. -func (a Protocol) HasInvalidate() bool { - return a.is712() -} diff --git a/vendor/bazil.org/fuse/unmount.go b/vendor/bazil.org/fuse/unmount.go deleted file mode 100644 index ffe3f155c..000000000 --- a/vendor/bazil.org/fuse/unmount.go +++ /dev/null @@ -1,6 +0,0 @@ -package fuse - -// Unmount tries to unmount the filesystem mounted at dir. -func Unmount(dir string) error { - return unmount(dir) -} diff --git a/vendor/bazil.org/fuse/unmount_linux.go b/vendor/bazil.org/fuse/unmount_linux.go deleted file mode 100644 index 088f0cfee..000000000 --- a/vendor/bazil.org/fuse/unmount_linux.go +++ /dev/null @@ -1,21 +0,0 @@ -package fuse - -import ( - "bytes" - "errors" - "os/exec" -) - -func unmount(dir string) error { - cmd := exec.Command("fusermount", "-u", dir) - output, err := cmd.CombinedOutput() - if err != nil { - if len(output) > 0 { - output = bytes.TrimRight(output, "\n") - msg := err.Error() + ": " + string(output) - err = errors.New(msg) - } - return err - } - return nil -} diff --git a/vendor/bazil.org/fuse/unmount_std.go b/vendor/bazil.org/fuse/unmount_std.go deleted file mode 100644 index d6efe276f..000000000 --- a/vendor/bazil.org/fuse/unmount_std.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build !linux - -package fuse - -import ( - "os" - "syscall" -) - -func unmount(dir string) error { - err := syscall.Unmount(dir, 0) - if err != nil { - err = &os.PathError{Op: "unmount", Path: dir, Err: err} - return err - } - return nil -} diff --git a/vendor/cloud.google.com/go/LICENSE b/vendor/cloud.google.com/go/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/cloud.google.com/go/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go deleted file mode 100644 index 6b13424fd..000000000 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ /dev/null @@ -1,518 +0,0 @@ -// Copyright 2014 Google LLC -// -// 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 metadata provides access to Google Compute Engine (GCE) -// metadata and API service accounts. -// -// This package is a wrapper around the GCE metadata service, -// as documented at https://developers.google.com/compute/docs/metadata. -package metadata // import "cloud.google.com/go/compute/metadata" - -import ( - "context" - "encoding/json" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "runtime" - "strings" - "sync" - "time" -) - -const ( - // metadataIP is the documented metadata server IP address. - metadataIP = "169.254.169.254" - - // metadataHostEnv is the environment variable specifying the - // GCE metadata hostname. If empty, the default value of - // metadataIP ("169.254.169.254") is used instead. - // This is variable name is not defined by any spec, as far as - // I know; it was made up for the Go package. - metadataHostEnv = "GCE_METADATA_HOST" - - userAgent = "gcloud-golang/0.1" -) - -type cachedValue struct { - k string - trim bool - mu sync.Mutex - v string -} - -var ( - projID = &cachedValue{k: "project/project-id", trim: true} - projNum = &cachedValue{k: "project/numeric-project-id", trim: true} - instID = &cachedValue{k: "instance/id", trim: true} -) - -var defaultClient = &Client{hc: &http.Client{ - Transport: &http.Transport{ - Dial: (&net.Dialer{ - Timeout: 2 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - }, -}} - -// NotDefinedError is returned when requested metadata is not defined. -// -// The underlying string is the suffix after "/computeMetadata/v1/". -// -// This error is not returned if the value is defined to be the empty -// string. -type NotDefinedError string - -func (suffix NotDefinedError) Error() string { - return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix)) -} - -func (c *cachedValue) get(cl *Client) (v string, err error) { - defer c.mu.Unlock() - c.mu.Lock() - if c.v != "" { - return c.v, nil - } - if c.trim { - v, err = cl.getTrimmed(c.k) - } else { - v, err = cl.Get(c.k) - } - if err == nil { - c.v = v - } - return -} - -var ( - onGCEOnce sync.Once - onGCE bool -) - -// OnGCE reports whether this process is running on Google Compute Engine. -func OnGCE() bool { - onGCEOnce.Do(initOnGCE) - return onGCE -} - -func initOnGCE() { - onGCE = testOnGCE() -} - -func testOnGCE() bool { - // The user explicitly said they're on GCE, so trust them. - if os.Getenv(metadataHostEnv) != "" { - return true - } - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - resc := make(chan bool, 2) - - // Try two strategies in parallel. - // See https://github.com/googleapis/google-cloud-go/issues/194 - go func() { - req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) - req.Header.Set("User-Agent", userAgent) - res, err := defaultClient.hc.Do(req.WithContext(ctx)) - if err != nil { - resc <- false - return - } - defer res.Body.Close() - resc <- res.Header.Get("Metadata-Flavor") == "Google" - }() - - go func() { - addrs, err := net.DefaultResolver.LookupHost(ctx, "metadata.google.internal") - if err != nil || len(addrs) == 0 { - resc <- false - return - } - resc <- strsContains(addrs, metadataIP) - }() - - tryHarder := systemInfoSuggestsGCE() - if tryHarder { - res := <-resc - if res { - // The first strategy succeeded, so let's use it. - return true - } - // Wait for either the DNS or metadata server probe to - // contradict the other one and say we are running on - // GCE. Give it a lot of time to do so, since the system - // info already suggests we're running on a GCE BIOS. - timer := time.NewTimer(5 * time.Second) - defer timer.Stop() - select { - case res = <-resc: - return res - case <-timer.C: - // Too slow. Who knows what this system is. - return false - } - } - - // There's no hint from the system info that we're running on - // GCE, so use the first probe's result as truth, whether it's - // true or false. The goal here is to optimize for speed for - // users who are NOT running on GCE. We can't assume that - // either a DNS lookup or an HTTP request to a blackholed IP - // address is fast. Worst case this should return when the - // metaClient's Transport.ResponseHeaderTimeout or - // Transport.Dial.Timeout fires (in two seconds). - return <-resc -} - -// systemInfoSuggestsGCE reports whether the local system (without -// doing network requests) suggests that we're running on GCE. If this -// returns true, testOnGCE tries a bit harder to reach its metadata -// server. -func systemInfoSuggestsGCE() bool { - if runtime.GOOS != "linux" { - // We don't have any non-Linux clues available, at least yet. - return false - } - slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name") - name := strings.TrimSpace(string(slurp)) - return name == "Google" || name == "Google Compute Engine" -} - -// Subscribe calls Client.Subscribe on the default client. -func Subscribe(suffix string, fn func(v string, ok bool) error) error { - return defaultClient.Subscribe(suffix, fn) -} - -// Get calls Client.Get on the default client. -func Get(suffix string) (string, error) { return defaultClient.Get(suffix) } - -// ProjectID returns the current instance's project ID string. -func ProjectID() (string, error) { return defaultClient.ProjectID() } - -// NumericProjectID returns the current instance's numeric project ID. -func NumericProjectID() (string, error) { return defaultClient.NumericProjectID() } - -// InternalIP returns the instance's primary internal IP address. -func InternalIP() (string, error) { return defaultClient.InternalIP() } - -// ExternalIP returns the instance's primary external (public) IP address. -func ExternalIP() (string, error) { return defaultClient.ExternalIP() } - -// Email calls Client.Email on the default client. -func Email(serviceAccount string) (string, error) { return defaultClient.Email(serviceAccount) } - -// Hostname returns the instance's hostname. This will be of the form -// ".c..internal". -func Hostname() (string, error) { return defaultClient.Hostname() } - -// InstanceTags returns the list of user-defined instance tags, -// assigned when initially creating a GCE instance. -func InstanceTags() ([]string, error) { return defaultClient.InstanceTags() } - -// InstanceID returns the current VM's numeric instance ID. -func InstanceID() (string, error) { return defaultClient.InstanceID() } - -// InstanceName returns the current VM's instance ID string. -func InstanceName() (string, error) { return defaultClient.InstanceName() } - -// Zone returns the current VM's zone, such as "us-central1-b". -func Zone() (string, error) { return defaultClient.Zone() } - -// InstanceAttributes calls Client.InstanceAttributes on the default client. -func InstanceAttributes() ([]string, error) { return defaultClient.InstanceAttributes() } - -// ProjectAttributes calls Client.ProjectAttributes on the default client. -func ProjectAttributes() ([]string, error) { return defaultClient.ProjectAttributes() } - -// InstanceAttributeValue calls Client.InstanceAttributeValue on the default client. -func InstanceAttributeValue(attr string) (string, error) { - return defaultClient.InstanceAttributeValue(attr) -} - -// ProjectAttributeValue calls Client.ProjectAttributeValue on the default client. -func ProjectAttributeValue(attr string) (string, error) { - return defaultClient.ProjectAttributeValue(attr) -} - -// Scopes calls Client.Scopes on the default client. -func Scopes(serviceAccount string) ([]string, error) { return defaultClient.Scopes(serviceAccount) } - -func strsContains(ss []string, s string) bool { - for _, v := range ss { - if v == s { - return true - } - } - return false -} - -// A Client provides metadata. -type Client struct { - hc *http.Client -} - -// NewClient returns a Client that can be used to fetch metadata. -// Returns the client that uses the specified http.Client for HTTP requests. -// If nil is specified, returns the default client. -func NewClient(c *http.Client) *Client { - if c == nil { - return defaultClient - } - - return &Client{hc: c} -} - -// getETag returns a value from the metadata service as well as the associated ETag. -// This func is otherwise equivalent to Get. -func (c *Client) getETag(suffix string) (value, etag string, err error) { - // Using a fixed IP makes it very difficult to spoof the metadata service in - // a container, which is an important use-case for local testing of cloud - // deployments. To enable spoofing of the metadata service, the environment - // variable GCE_METADATA_HOST is first inspected to decide where metadata - // requests shall go. - host := os.Getenv(metadataHostEnv) - if host == "" { - // Using 169.254.169.254 instead of "metadata" here because Go - // binaries built with the "netgo" tag and without cgo won't - // know the search suffix for "metadata" is - // ".google.internal", and this IP address is documented as - // being stable anyway. - host = metadataIP - } - u := "http://" + host + "/computeMetadata/v1/" + suffix - req, err := http.NewRequest("GET", u, nil) - if err != nil { - return "", "", err - } - req.Header.Set("Metadata-Flavor", "Google") - req.Header.Set("User-Agent", userAgent) - res, err := c.hc.Do(req) - if err != nil { - return "", "", err - } - defer res.Body.Close() - if res.StatusCode == http.StatusNotFound { - return "", "", NotDefinedError(suffix) - } - all, err := ioutil.ReadAll(res.Body) - if err != nil { - return "", "", err - } - if res.StatusCode != 200 { - return "", "", &Error{Code: res.StatusCode, Message: string(all)} - } - return string(all), res.Header.Get("Etag"), nil -} - -// Get returns a value from the metadata service. -// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". -// -// If the GCE_METADATA_HOST environment variable is not defined, a default of -// 169.254.169.254 will be used instead. -// -// If the requested metadata is not defined, the returned error will -// be of type NotDefinedError. -func (c *Client) Get(suffix string) (string, error) { - val, _, err := c.getETag(suffix) - return val, err -} - -func (c *Client) getTrimmed(suffix string) (s string, err error) { - s, err = c.Get(suffix) - s = strings.TrimSpace(s) - return -} - -func (c *Client) lines(suffix string) ([]string, error) { - j, err := c.Get(suffix) - if err != nil { - return nil, err - } - s := strings.Split(strings.TrimSpace(j), "\n") - for i := range s { - s[i] = strings.TrimSpace(s[i]) - } - return s, nil -} - -// ProjectID returns the current instance's project ID string. -func (c *Client) ProjectID() (string, error) { return projID.get(c) } - -// NumericProjectID returns the current instance's numeric project ID. -func (c *Client) NumericProjectID() (string, error) { return projNum.get(c) } - -// InstanceID returns the current VM's numeric instance ID. -func (c *Client) InstanceID() (string, error) { return instID.get(c) } - -// InternalIP returns the instance's primary internal IP address. -func (c *Client) InternalIP() (string, error) { - return c.getTrimmed("instance/network-interfaces/0/ip") -} - -// Email returns the email address associated with the service account. -// The account may be empty or the string "default" to use the instance's -// main account. -func (c *Client) Email(serviceAccount string) (string, error) { - if serviceAccount == "" { - serviceAccount = "default" - } - return c.getTrimmed("instance/service-accounts/" + serviceAccount + "/email") -} - -// ExternalIP returns the instance's primary external (public) IP address. -func (c *Client) ExternalIP() (string, error) { - return c.getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip") -} - -// Hostname returns the instance's hostname. This will be of the form -// ".c..internal". -func (c *Client) Hostname() (string, error) { - return c.getTrimmed("instance/hostname") -} - -// InstanceTags returns the list of user-defined instance tags, -// assigned when initially creating a GCE instance. -func (c *Client) InstanceTags() ([]string, error) { - var s []string - j, err := c.Get("instance/tags") - if err != nil { - return nil, err - } - if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil { - return nil, err - } - return s, nil -} - -// InstanceName returns the current VM's instance ID string. -func (c *Client) InstanceName() (string, error) { - return c.getTrimmed("instance/name") -} - -// Zone returns the current VM's zone, such as "us-central1-b". -func (c *Client) Zone() (string, error) { - zone, err := c.getTrimmed("instance/zone") - // zone is of the form "projects//zones/". - if err != nil { - return "", err - } - return zone[strings.LastIndex(zone, "/")+1:], nil -} - -// InstanceAttributes returns the list of user-defined attributes, -// assigned when initially creating a GCE VM instance. The value of an -// attribute can be obtained with InstanceAttributeValue. -func (c *Client) InstanceAttributes() ([]string, error) { return c.lines("instance/attributes/") } - -// ProjectAttributes returns the list of user-defined attributes -// applying to the project as a whole, not just this VM. The value of -// an attribute can be obtained with ProjectAttributeValue. -func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project/attributes/") } - -// InstanceAttributeValue returns the value of the provided VM -// instance attribute. -// -// If the requested attribute is not defined, the returned error will -// be of type NotDefinedError. -// -// InstanceAttributeValue may return ("", nil) if the attribute was -// defined to be the empty string. -func (c *Client) InstanceAttributeValue(attr string) (string, error) { - return c.Get("instance/attributes/" + attr) -} - -// ProjectAttributeValue returns the value of the provided -// project attribute. -// -// If the requested attribute is not defined, the returned error will -// be of type NotDefinedError. -// -// ProjectAttributeValue may return ("", nil) if the attribute was -// defined to be the empty string. -func (c *Client) ProjectAttributeValue(attr string) (string, error) { - return c.Get("project/attributes/" + attr) -} - -// Scopes returns the service account scopes for the given account. -// The account may be empty or the string "default" to use the instance's -// main account. -func (c *Client) Scopes(serviceAccount string) ([]string, error) { - if serviceAccount == "" { - serviceAccount = "default" - } - return c.lines("instance/service-accounts/" + serviceAccount + "/scopes") -} - -// Subscribe subscribes to a value from the metadata service. -// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". -// The suffix may contain query parameters. -// -// Subscribe calls fn with the latest metadata value indicated by the provided -// suffix. If the metadata value is deleted, fn is called with the empty string -// and ok false. Subscribe blocks until fn returns a non-nil error or the value -// is deleted. Subscribe returns the error value returned from the last call to -// fn, which may be nil when ok == false. -func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) error { - const failedSubscribeSleep = time.Second * 5 - - // First check to see if the metadata value exists at all. - val, lastETag, err := c.getETag(suffix) - if err != nil { - return err - } - - if err := fn(val, true); err != nil { - return err - } - - ok := true - if strings.ContainsRune(suffix, '?') { - suffix += "&wait_for_change=true&last_etag=" - } else { - suffix += "?wait_for_change=true&last_etag=" - } - for { - val, etag, err := c.getETag(suffix + url.QueryEscape(lastETag)) - if err != nil { - if _, deleted := err.(NotDefinedError); !deleted { - time.Sleep(failedSubscribeSleep) - continue // Retry on other errors. - } - ok = false - } - lastETag = etag - - if err := fn(val, ok); err != nil || !ok { - return err - } - } -} - -// Error contains an error response from the server. -type Error struct { - // Code is the HTTP response status code. - Code int - // Message is the server response message. - Message string -} - -func (e *Error) Error() string { - return fmt.Sprintf("compute: Received %d `%s`", e.Code, e.Message) -} diff --git a/vendor/github.com/Azure/azure-pipeline-go/LICENSE b/vendor/github.com/Azure/azure-pipeline-go/LICENSE deleted file mode 100644 index d1ca00f20..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/core.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/core.go deleted file mode 100644 index d7b866cdf..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/core.go +++ /dev/null @@ -1,284 +0,0 @@ -package pipeline - -import ( - "context" - "github.com/mattn/go-ieproxy" - "net" - "net/http" - "os" - "time" -) - -// The Factory interface represents an object that can create its Policy object. Each HTTP request sent -// requires that this Factory create a new instance of its Policy object. -type Factory interface { - New(next Policy, po *PolicyOptions) Policy -} - -// FactoryFunc is an adapter that allows the use of an ordinary function as a Factory interface. -type FactoryFunc func(next Policy, po *PolicyOptions) PolicyFunc - -// New calls f(next,po). -func (f FactoryFunc) New(next Policy, po *PolicyOptions) Policy { - return f(next, po) -} - -// The Policy interface represents a mutable Policy object created by a Factory. The object can mutate/process -// the HTTP request and then forward it on to the next Policy object in the linked-list. The returned -// Response goes backward through the linked-list for additional processing. -// NOTE: Request is passed by value so changes do not change the caller's version of -// the request. However, Request has some fields that reference mutable objects (not strings). -// These references are copied; a deep copy is not performed. Specifically, this means that -// you should avoid modifying the objects referred to by these fields: URL, Header, Body, -// GetBody, TransferEncoding, Form, MultipartForm, Trailer, TLS, Cancel, and Response. -type Policy interface { - Do(ctx context.Context, request Request) (Response, error) -} - -// PolicyFunc is an adapter that allows the use of an ordinary function as a Policy interface. -type PolicyFunc func(ctx context.Context, request Request) (Response, error) - -// Do calls f(ctx, request). -func (f PolicyFunc) Do(ctx context.Context, request Request) (Response, error) { - return f(ctx, request) -} - -// Options configures a Pipeline's behavior. -type Options struct { - HTTPSender Factory // If sender is nil, then the pipeline's default client is used to send the HTTP requests. - Log LogOptions -} - -// LogLevel tells a logger the minimum level to log. When code reports a log entry, -// the LogLevel indicates the level of the log entry. The logger only records entries -// whose level is at least the level it was told to log. See the Log* constants. -// For example, if a logger is configured with LogError, then LogError, LogPanic, -// and LogFatal entries will be logged; lower level entries are ignored. -type LogLevel uint32 - -const ( - // LogNone tells a logger not to log any entries passed to it. - LogNone LogLevel = iota - - // LogFatal tells a logger to log all LogFatal entries passed to it. - LogFatal - - // LogPanic tells a logger to log all LogPanic and LogFatal entries passed to it. - LogPanic - - // LogError tells a logger to log all LogError, LogPanic and LogFatal entries passed to it. - LogError - - // LogWarning tells a logger to log all LogWarning, LogError, LogPanic and LogFatal entries passed to it. - LogWarning - - // LogInfo tells a logger to log all LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it. - LogInfo - - // LogDebug tells a logger to log all LogDebug, LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it. - LogDebug -) - -// LogOptions configures the pipeline's logging mechanism & level filtering. -type LogOptions struct { - Log func(level LogLevel, message string) - - // ShouldLog is called periodically allowing you to return whether the specified LogLevel should be logged or not. - // An application can return different values over the its lifetime; this allows the application to dynamically - // alter what is logged. NOTE: This method can be called by multiple goroutines simultaneously so make sure - // you implement it in a goroutine-safe way. If nil, nothing is logged (the equivalent of returning LogNone). - // Usually, the function will be implemented simply like this: return level <= LogWarning - ShouldLog func(level LogLevel) bool -} - -type pipeline struct { - factories []Factory - options Options -} - -// The Pipeline interface represents an ordered list of Factory objects and an object implementing the HTTPSender interface. -// You construct a Pipeline by calling the pipeline.NewPipeline function. To send an HTTP request, call pipeline.NewRequest -// and then call Pipeline's Do method passing a context, the request, and a method-specific Factory (or nil). Passing a -// method-specific Factory allows this one call to Do to inject a Policy into the linked-list. The policy is injected where -// the MethodFactoryMarker (see the pipeline.MethodFactoryMarker function) is in the slice of Factory objects. -// -// When Do is called, the Pipeline object asks each Factory object to construct its Policy object and adds each Policy to a linked-list. -// THen, Do sends the Context and Request through all the Policy objects. The final Policy object sends the request over the network -// (via the HTTPSender object passed to NewPipeline) and the response is returned backwards through all the Policy objects. -// Since Pipeline and Factory objects are goroutine-safe, you typically create 1 Pipeline object and reuse it to make many HTTP requests. -type Pipeline interface { - Do(ctx context.Context, methodFactory Factory, request Request) (Response, error) -} - -// NewPipeline creates a new goroutine-safe Pipeline object from the slice of Factory objects and the specified options. -func NewPipeline(factories []Factory, o Options) Pipeline { - if o.HTTPSender == nil { - o.HTTPSender = newDefaultHTTPClientFactory() - } - if o.Log.Log == nil { - o.Log.Log = func(LogLevel, string) {} // No-op logger - } - return &pipeline{factories: factories, options: o} -} - -// Do is called for each and every HTTP request. It tells each Factory to create its own (mutable) Policy object -// replacing a MethodFactoryMarker factory (if it exists) with the methodFactory passed in. Then, the Context and Request -// are sent through the pipeline of Policy objects (which can transform the Request's URL/query parameters/headers) and -// ultimately sends the transformed HTTP request over the network. -func (p *pipeline) Do(ctx context.Context, methodFactory Factory, request Request) (Response, error) { - response, err := p.newPolicies(methodFactory).Do(ctx, request) - request.close() - return response, err -} - -func (p *pipeline) newPolicies(methodFactory Factory) Policy { - // The last Policy is the one that actually sends the request over the wire and gets the response. - // It is overridable via the Options' HTTPSender field. - po := &PolicyOptions{pipeline: p} // One object shared by all policy objects - next := p.options.HTTPSender.New(nil, po) - - // Walk over the slice of Factory objects in reverse (from wire to API) - markers := 0 - for i := len(p.factories) - 1; i >= 0; i-- { - factory := p.factories[i] - if _, ok := factory.(methodFactoryMarker); ok { - markers++ - if markers > 1 { - panic("MethodFactoryMarker can only appear once in the pipeline") - } - if methodFactory != nil { - // Replace MethodFactoryMarker with passed-in methodFactory - next = methodFactory.New(next, po) - } - } else { - // Use the slice's Factory to construct its Policy - next = factory.New(next, po) - } - } - - // Each Factory has created its Policy - if markers == 0 && methodFactory != nil { - panic("Non-nil methodFactory requires MethodFactoryMarker in the pipeline") - } - return next // Return head of the Policy object linked-list -} - -// A PolicyOptions represents optional information that can be used by a node in the -// linked-list of Policy objects. A PolicyOptions is passed to the Factory's New method -// which passes it (if desired) to the Policy object it creates. Today, the Policy object -// uses the options to perform logging. But, in the future, this could be used for more. -type PolicyOptions struct { - pipeline *pipeline -} - -// ShouldLog returns true if the specified log level should be logged. -func (po *PolicyOptions) ShouldLog(level LogLevel) bool { - if po.pipeline.options.Log.ShouldLog != nil { - return po.pipeline.options.Log.ShouldLog(level) - } - return false -} - -// Log logs a string to the Pipeline's Logger. -func (po *PolicyOptions) Log(level LogLevel, msg string) { - if !po.ShouldLog(level) { - return // Short circuit message formatting if we're not logging it - } - - // We are logging it, ensure trailing newline - if len(msg) == 0 || msg[len(msg)-1] != '\n' { - msg += "\n" // Ensure trailing newline - } - po.pipeline.options.Log.Log(level, msg) - - // If logger doesn't handle fatal/panic, we'll do it here. - if level == LogFatal { - os.Exit(1) - } else if level == LogPanic { - panic(msg) - } -} - -var pipelineHTTPClient = newDefaultHTTPClient() - -func newDefaultHTTPClient() *http.Client { - // We want the Transport to have a large connection pool - return &http.Client{ - Transport: &http.Transport{ - Proxy: ieproxy.GetProxyFunc(), - // We use Dial instead of DialContext as DialContext has been reported to cause slower performance. - Dial /*Context*/ : (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).Dial, /*Context*/ - MaxIdleConns: 0, // No limit - MaxIdleConnsPerHost: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - DisableKeepAlives: false, - DisableCompression: false, - MaxResponseHeaderBytes: 0, - //ResponseHeaderTimeout: time.Duration{}, - //ExpectContinueTimeout: time.Duration{}, - }, - } -} - -// newDefaultHTTPClientFactory creates a DefaultHTTPClientPolicyFactory object that sends HTTP requests to a Go's default http.Client. -func newDefaultHTTPClientFactory() Factory { - return FactoryFunc(func(next Policy, po *PolicyOptions) PolicyFunc { - return func(ctx context.Context, request Request) (Response, error) { - r, err := pipelineHTTPClient.Do(request.WithContext(ctx)) - if err != nil { - err = NewError(err, "HTTP request failed") - } - return NewHTTPResponse(r), err - } - }) -} - -var mfm = methodFactoryMarker{} // Singleton - -// MethodFactoryMarker returns a special marker Factory object. When Pipeline's Do method is called, any -// MethodMarkerFactory object is replaced with the specified methodFactory object. If nil is passed fro Do's -// methodFactory parameter, then the MethodFactoryMarker is ignored as the linked-list of Policy objects is created. -func MethodFactoryMarker() Factory { - return mfm -} - -type methodFactoryMarker struct { -} - -func (methodFactoryMarker) New(next Policy, po *PolicyOptions) Policy { - panic("methodFactoryMarker policy should have been replaced with a method policy") -} - -// LogSanitizer can be implemented to clean secrets from lines logged by ForceLog -// By default no implemetation is provided here, because pipeline may be used in many different -// contexts, so the correct implementation is context-dependent -type LogSanitizer interface { - SanitizeLogMessage(raw string) string -} - -var sanitizer LogSanitizer -var enableForceLog bool = true - -// SetLogSanitizer can be called to supply a custom LogSanitizer. -// There is no threadsafety or locking on the underlying variable, -// so call this function just once at startup of your application -// (Don't later try to change the sanitizer on the fly). -func SetLogSanitizer(s LogSanitizer)(){ - sanitizer = s -} - -// SetForceLogEnabled can be used to disable ForceLog -// There is no threadsafety or locking on the underlying variable, -// so call this function just once at startup of your application -// (Don't later try to change the setting on the fly). -func SetForceLogEnabled(enable bool)() { - enableForceLog = enable -} - - diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog.go deleted file mode 100644 index e7ce4970b..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog.go +++ /dev/null @@ -1,14 +0,0 @@ -package pipeline - - -// ForceLog should rarely be used. It forceable logs an entry to the -// Windows Event Log (on Windows) or to the SysLog (on Linux) -func ForceLog(level LogLevel, msg string) { - if !enableForceLog { - return - } - if sanitizer != nil { - msg = sanitizer.SanitizeLogMessage(msg) - } - forceLog(level, msg) -} diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_syslog.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_syslog.go deleted file mode 100644 index 819509a1e..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_syslog.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build !windows,!nacl,!plan9 - -package pipeline - -import ( - "log" - "log/syslog" -) - -// forceLog should rarely be used. It forceable logs an entry to the -// Windows Event Log (on Windows) or to the SysLog (on Linux) -func forceLog(level LogLevel, msg string) { - if defaultLogger == nil { - return // Return fast if we failed to create the logger. - } - // We are logging it, ensure trailing newline - if len(msg) == 0 || msg[len(msg)-1] != '\n' { - msg += "\n" // Ensure trailing newline - } - switch level { - case LogFatal: - defaultLogger.Fatal(msg) - case LogPanic: - defaultLogger.Panic(msg) - case LogError, LogWarning, LogInfo: - defaultLogger.Print(msg) - } -} - -var defaultLogger = func() *log.Logger { - l, _ := syslog.NewLogger(syslog.LOG_USER|syslog.LOG_WARNING, log.LstdFlags) - return l -}() diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_windows.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_windows.go deleted file mode 100644 index 5fcf40014..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_windows.go +++ /dev/null @@ -1,61 +0,0 @@ -package pipeline - -import ( - "os" - "syscall" - "unsafe" -) - -// forceLog should rarely be used. It forceable logs an entry to the -// Windows Event Log (on Windows) or to the SysLog (on Linux) -func forceLog(level LogLevel, msg string) { - var el eventType - switch level { - case LogError, LogFatal, LogPanic: - el = elError - case LogWarning: - el = elWarning - case LogInfo: - el = elInfo - } - // We are logging it, ensure trailing newline - if len(msg) == 0 || msg[len(msg)-1] != '\n' { - msg += "\n" // Ensure trailing newline - } - reportEvent(el, 0, msg) -} - -type eventType int16 - -const ( - elSuccess eventType = 0 - elError eventType = 1 - elWarning eventType = 2 - elInfo eventType = 4 -) - -var reportEvent = func() func(eventType eventType, eventID int32, msg string) { - advAPI32 := syscall.MustLoadDLL("advapi32.dll") // lower case to tie in with Go's sysdll registration - registerEventSource := advAPI32.MustFindProc("RegisterEventSourceW") - - sourceName, _ := os.Executable() - sourceNameUTF16, _ := syscall.UTF16PtrFromString(sourceName) - handle, _, lastErr := registerEventSource.Call(uintptr(0), uintptr(unsafe.Pointer(sourceNameUTF16))) - if lastErr == nil { // On error, logging is a no-op - return func(eventType eventType, eventID int32, msg string) {} - } - reportEvent := advAPI32.MustFindProc("ReportEventW") - return func(eventType eventType, eventID int32, msg string) { - s, _ := syscall.UTF16PtrFromString(msg) - _, _, _ = reportEvent.Call( - uintptr(handle), // HANDLE hEventLog - uintptr(eventType), // WORD wType - uintptr(0), // WORD wCategory - uintptr(eventID), // DWORD dwEventID - uintptr(0), // PSID lpUserSid - uintptr(1), // WORD wNumStrings - uintptr(0), // DWORD dwDataSize - uintptr(unsafe.Pointer(&s)), // LPCTSTR *lpStrings - uintptr(0)) // LPVOID lpRawData - } -}() diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/doc.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/doc.go deleted file mode 100644 index b5ab05f4d..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/doc.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2017 Microsoft Corporation. All rights reserved. -// Use of this source code is governed by an MIT -// license that can be found in the LICENSE file. - -/* -Package pipeline implements an HTTP request/response middleware pipeline whose -policy objects mutate an HTTP request's URL, query parameters, and/or headers before -the request is sent over the wire. - -Not all policy objects mutate an HTTP request; some policy objects simply impact the -flow of requests/responses by performing operations such as logging, retry policies, -timeouts, failure injection, and deserialization of response payloads. - -Implementing the Policy Interface - -To implement a policy, define a struct that implements the pipeline.Policy interface's Do method. Your Do -method is called when an HTTP request wants to be sent over the network. Your Do method can perform any -operation(s) it desires. For example, it can log the outgoing request, mutate the URL, headers, and/or query -parameters, inject a failure, etc. Your Do method must then forward the HTTP request to next Policy object -in a linked-list ensuring that the remaining Policy objects perform their work. Ultimately, the last Policy -object sends the HTTP request over the network (by calling the HTTPSender's Do method). - -When an HTTP response comes back, each Policy object in the linked-list gets a chance to process the response -(in reverse order). The Policy object can log the response, retry the operation if due to a transient failure -or timeout, deserialize the response body, etc. Ultimately, the last Policy object returns the HTTP response -to the code that initiated the original HTTP request. - -Here is a template for how to define a pipeline.Policy object: - - type myPolicy struct { - node PolicyNode - // TODO: Add configuration/setting fields here (if desired)... - } - - func (p *myPolicy) Do(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - // TODO: Mutate/process the HTTP request here... - response, err := p.node.Do(ctx, request) // Forward HTTP request to next Policy & get HTTP response - // TODO: Mutate/process the HTTP response here... - return response, err // Return response/error to previous Policy - } - -Implementing the Factory Interface - -Each Policy struct definition requires a factory struct definition that implements the pipeline.Factory interface's New -method. The New method is called when application code wants to initiate a new HTTP request. Factory's New method is -passed a pipeline.PolicyNode object which contains a reference to the owning pipeline.Pipeline object (discussed later) and -a reference to the next Policy object in the linked list. The New method should create its corresponding Policy object -passing it the PolicyNode and any other configuration/settings fields appropriate for the specific Policy object. - -Here is a template for how to define a pipeline.Policy object: - - // NOTE: Once created & initialized, Factory objects should be goroutine-safe (ex: immutable); - // this allows reuse (efficient use of memory) and makes these objects usable by multiple goroutines concurrently. - type myPolicyFactory struct { - // TODO: Add any configuration/setting fields if desired... - } - - func (f *myPolicyFactory) New(node pipeline.PolicyNode) Policy { - return &myPolicy{node: node} // TODO: Also initialize any configuration/setting fields here (if desired)... - } - -Using your Factory and Policy objects via a Pipeline - -To use the Factory and Policy objects, an application constructs a slice of Factory objects and passes -this slice to the pipeline.NewPipeline function. - - func NewPipeline(factories []pipeline.Factory, sender pipeline.HTTPSender) Pipeline - -This function also requires an object implementing the HTTPSender interface. For simple scenarios, -passing nil for HTTPSender causes a standard Go http.Client object to be created and used to actually -send the HTTP response over the network. For more advanced scenarios, you can pass your own HTTPSender -object in. This allows sharing of http.Client objects or the use of custom-configured http.Client objects -or other objects that can simulate the network requests for testing purposes. - -Now that you have a pipeline.Pipeline object, you can create a pipeline.Request object (which is a simple -wrapper around Go's standard http.Request object) and pass it to Pipeline's Do method along with passing a -context.Context for cancelling the HTTP request (if desired). - - type Pipeline interface { - Do(ctx context.Context, methodFactory pipeline.Factory, request pipeline.Request) (pipeline.Response, error) - } - -Do iterates over the slice of Factory objects and tells each one to create its corresponding -Policy object. After the linked-list of Policy objects have been created, Do calls the first -Policy object passing it the Context & HTTP request parameters. These parameters now flow through -all the Policy objects giving each object a chance to look at and/or mutate the HTTP request. -The last Policy object sends the message over the network. - -When the network operation completes, the HTTP response and error return values pass -back through the same Policy objects in reverse order. Most Policy objects ignore the -response/error but some log the result, retry the operation (depending on the exact -reason the operation failed), or deserialize the response's body. Your own Policy -objects can do whatever they like when processing outgoing requests or incoming responses. - -Note that after an I/O request runs to completion, the Policy objects for that request -are garbage collected. However, Pipeline object (like Factory objects) are goroutine-safe allowing -them to be created once and reused over many I/O operations. This allows for efficient use of -memory and also makes them safely usable by multiple goroutines concurrently. - -Inserting a Method-Specific Factory into the Linked-List of Policy Objects - -While Pipeline and Factory objects can be reused over many different operations, it is -common to have special behavior for a specific operation/method. For example, a method -may need to deserialize the response's body to an instance of a specific data type. -To accommodate this, the Pipeline's Do method takes an additional method-specific -Factory object. The Do method tells this Factory to create a Policy object and -injects this method-specific Policy object into the linked-list of Policy objects. - -When creating a Pipeline object, the slice of Factory objects passed must have 1 -(and only 1) entry marking where the method-specific Factory should be injected. -The Factory marker is obtained by calling the pipeline.MethodFactoryMarker() function: - - func MethodFactoryMarker() pipeline.Factory - -Creating an HTTP Request Object - -The HTTP request object passed to Pipeline's Do method is not Go's http.Request struct. -Instead, it is a pipeline.Request struct which is a simple wrapper around Go's standard -http.Request. You create a pipeline.Request object by calling the pipeline.NewRequest function: - - func NewRequest(method string, url url.URL, options pipeline.RequestOptions) (request pipeline.Request, err error) - -To this function, you must pass a pipeline.RequestOptions that looks like this: - - type RequestOptions struct { - // The readable and seekable stream to be sent to the server as the request's body. - Body io.ReadSeeker - - // The callback method (if not nil) to be invoked to report progress as the stream is uploaded in the HTTP request. - Progress ProgressReceiver - } - -The method and struct ensure that the request's body stream is a read/seekable stream. -A seekable stream is required so that upon retry, the final Policy object can seek -the stream back to the beginning before retrying the network request and re-uploading the -body. In addition, you can associate a ProgressReceiver callback function which will be -invoked periodically to report progress while bytes are being read from the body stream -and sent over the network. - -Processing the HTTP Response - -When an HTTP response comes in from the network, a reference to Go's http.Response struct is -embedded in a struct that implements the pipeline.Response interface: - - type Response interface { - Response() *http.Response - } - -This interface is returned through all the Policy objects. Each Policy object can call the Response -interface's Response method to examine (or mutate) the embedded http.Response object. - -A Policy object can internally define another struct (implementing the pipeline.Response interface) -that embeds an http.Response and adds additional fields and return this structure to other Policy -objects. This allows a Policy object to deserialize the body to some other struct and return the -original http.Response and the additional struct back through the Policy chain. Other Policy objects -can see the Response but cannot see the additional struct with the deserialized body. After all the -Policy objects have returned, the pipeline.Response interface is returned by Pipeline's Do method. -The caller of this method can perform a type assertion attempting to get back to the struct type -really returned by the Policy object. If the type assertion is successful, the caller now has -access to both the http.Response and the deserialized struct object.*/ -package pipeline diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/error.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/error.go deleted file mode 100644 index 4aaf06650..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/error.go +++ /dev/null @@ -1,181 +0,0 @@ -package pipeline - -import ( - "fmt" - "runtime" -) - -type causer interface { - Cause() error -} - -func errorWithPC(msg string, pc uintptr) string { - s := "" - if fn := runtime.FuncForPC(pc); fn != nil { - file, line := fn.FileLine(pc) - s = fmt.Sprintf("-> %v, %v:%v\n", fn.Name(), file, line) - } - s += msg + "\n\n" - return s -} - -func getPC(callersToSkip int) uintptr { - // Get the PC of Initialize method's caller. - pc := [1]uintptr{} - _ = runtime.Callers(callersToSkip, pc[:]) - return pc[0] -} - -// ErrorNode can be an embedded field in a private error object. This field -// adds Program Counter support and a 'cause' (reference to a preceding error). -// When initializing a error type with this embedded field, initialize the -// ErrorNode field by calling ErrorNode{}.Initialize(cause). -type ErrorNode struct { - pc uintptr // Represents a Program Counter that you can get symbols for. - cause error // Refers to the preceding error (or nil) -} - -// Error returns a string with the PC's symbols or "" if the PC is invalid. -// When defining a new error type, have its Error method call this one passing -// it the string representation of the error. -func (e *ErrorNode) Error(msg string) string { - s := errorWithPC(msg, e.pc) - if e.cause != nil { - s += e.cause.Error() + "\n" - } - return s -} - -// Cause returns the error that preceded this error. -func (e *ErrorNode) Cause() error { return e.cause } - -// Temporary returns true if the error occurred due to a temporary condition. -func (e ErrorNode) Temporary() bool { - type temporary interface { - Temporary() bool - } - - for err := e.cause; err != nil; { - if t, ok := err.(temporary); ok { - return t.Temporary() - } - - if cause, ok := err.(causer); ok { - err = cause.Cause() - } else { - err = nil - } - } - return false -} - -// Timeout returns true if the error occurred due to time expiring. -func (e ErrorNode) Timeout() bool { - type timeout interface { - Timeout() bool - } - - for err := e.cause; err != nil; { - if t, ok := err.(timeout); ok { - return t.Timeout() - } - - if cause, ok := err.(causer); ok { - err = cause.Cause() - } else { - err = nil - } - } - return false -} - -// Initialize is used to initialize an embedded ErrorNode field. -// It captures the caller's program counter and saves the cause (preceding error). -// To initialize the field, use "ErrorNode{}.Initialize(cause, 3)". A callersToSkip -// value of 3 is very common; but, depending on your code nesting, you may need -// a different value. -func (ErrorNode) Initialize(cause error, callersToSkip int) ErrorNode { - pc := getPC(callersToSkip) - return ErrorNode{pc: pc, cause: cause} -} - -// Cause walks all the preceding errors and return the originating error. -func Cause(err error) error { - for err != nil { - cause, ok := err.(causer) - if !ok { - break - } - err = cause.Cause() - } - return err -} - -// ErrorNodeNoCause can be an embedded field in a private error object. This field -// adds Program Counter support. -// When initializing a error type with this embedded field, initialize the -// ErrorNodeNoCause field by calling ErrorNodeNoCause{}.Initialize(). -type ErrorNodeNoCause struct { - pc uintptr // Represents a Program Counter that you can get symbols for. -} - -// Error returns a string with the PC's symbols or "" if the PC is invalid. -// When defining a new error type, have its Error method call this one passing -// it the string representation of the error. -func (e *ErrorNodeNoCause) Error(msg string) string { - return errorWithPC(msg, e.pc) -} - -// Temporary returns true if the error occurred due to a temporary condition. -func (e ErrorNodeNoCause) Temporary() bool { - return false -} - -// Timeout returns true if the error occurred due to time expiring. -func (e ErrorNodeNoCause) Timeout() bool { - return false -} - -// Initialize is used to initialize an embedded ErrorNode field. -// It captures the caller's program counter. -// To initialize the field, use "ErrorNodeNoCause{}.Initialize(3)". A callersToSkip -// value of 3 is very common; but, depending on your code nesting, you may need -// a different value. -func (ErrorNodeNoCause) Initialize(callersToSkip int) ErrorNodeNoCause { - pc := getPC(callersToSkip) - return ErrorNodeNoCause{pc: pc} -} - -// NewError creates a simple string error (like Error.New). But, this -// error also captures the caller's Program Counter and the preceding error (if provided). -func NewError(cause error, msg string) error { - if cause != nil { - return &pcError{ - ErrorNode: ErrorNode{}.Initialize(cause, 3), - msg: msg, - } - } - return &pcErrorNoCause{ - ErrorNodeNoCause: ErrorNodeNoCause{}.Initialize(3), - msg: msg, - } -} - -// pcError is a simple string error (like error.New) with an ErrorNode (PC & cause). -type pcError struct { - ErrorNode - msg string -} - -// Error satisfies the error interface. It shows the error with Program Counter -// symbols and calls Error on the preceding error so you can see the full error chain. -func (e *pcError) Error() string { return e.ErrorNode.Error(e.msg) } - -// pcErrorNoCause is a simple string error (like error.New) with an ErrorNode (PC). -type pcErrorNoCause struct { - ErrorNodeNoCause - msg string -} - -// Error satisfies the error interface. It shows the error with Program Counter symbols. -func (e *pcErrorNoCause) Error() string { return e.ErrorNodeNoCause.Error(e.msg) } diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/progress.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/progress.go deleted file mode 100644 index efa3c8ed0..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/progress.go +++ /dev/null @@ -1,82 +0,0 @@ -package pipeline - -import "io" - -// ********** The following is common between the request body AND the response body. - -// ProgressReceiver defines the signature of a callback function invoked as progress is reported. -type ProgressReceiver func(bytesTransferred int64) - -// ********** The following are specific to the request body (a ReadSeekCloser) - -// This struct is used when sending a body to the network -type requestBodyProgress struct { - requestBody io.ReadSeeker // Seeking is required to support retries - pr ProgressReceiver -} - -// NewRequestBodyProgress adds progress reporting to an HTTP request's body stream. -func NewRequestBodyProgress(requestBody io.ReadSeeker, pr ProgressReceiver) io.ReadSeeker { - if pr == nil { - panic("pr must not be nil") - } - return &requestBodyProgress{requestBody: requestBody, pr: pr} -} - -// Read reads a block of data from an inner stream and reports progress -func (rbp *requestBodyProgress) Read(p []byte) (n int, err error) { - n, err = rbp.requestBody.Read(p) - if err != nil { - return - } - // Invokes the user's callback method to report progress - position, err := rbp.requestBody.Seek(0, io.SeekCurrent) - if err != nil { - panic(err) - } - rbp.pr(position) - return -} - -func (rbp *requestBodyProgress) Seek(offset int64, whence int) (offsetFromStart int64, err error) { - return rbp.requestBody.Seek(offset, whence) -} - -// requestBodyProgress supports Close but the underlying stream may not; if it does, Close will close it. -func (rbp *requestBodyProgress) Close() error { - if c, ok := rbp.requestBody.(io.Closer); ok { - return c.Close() - } - return nil -} - -// ********** The following are specific to the response body (a ReadCloser) - -// This struct is used when sending a body to the network -type responseBodyProgress struct { - responseBody io.ReadCloser - pr ProgressReceiver - offset int64 -} - -// NewResponseBodyProgress adds progress reporting to an HTTP response's body stream. -func NewResponseBodyProgress(responseBody io.ReadCloser, pr ProgressReceiver) io.ReadCloser { - if pr == nil { - panic("pr must not be nil") - } - return &responseBodyProgress{responseBody: responseBody, pr: pr, offset: 0} -} - -// Read reads a block of data from an inner stream and reports progress -func (rbp *responseBodyProgress) Read(p []byte) (n int, err error) { - n, err = rbp.responseBody.Read(p) - rbp.offset += int64(n) - - // Invokes the user's callback method to report progress - rbp.pr(rbp.offset) - return -} - -func (rbp *responseBodyProgress) Close() error { - return rbp.responseBody.Close() -} diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/request.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/request.go deleted file mode 100644 index 1fbe72bd4..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/request.go +++ /dev/null @@ -1,147 +0,0 @@ -package pipeline - -import ( - "io" - "net/http" - "net/url" - "strconv" -) - -// Request is a thin wrapper over an http.Request. The wrapper provides several helper methods. -type Request struct { - *http.Request -} - -// NewRequest initializes a new HTTP request object with any desired options. -func NewRequest(method string, url url.URL, body io.ReadSeeker) (request Request, err error) { - // Note: the url is passed by value so that any pipeline operations that modify it do so on a copy. - - // This code to construct an http.Request is copied from http.NewRequest(); we intentionally omitted removeEmptyPort for now. - request.Request = &http.Request{ - Method: method, - URL: &url, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: make(http.Header), - Host: url.Host, - } - - if body != nil { - err = request.SetBody(body) - } - return -} - -// SetBody sets the body and content length, assumes body is not nil. -func (r Request) SetBody(body io.ReadSeeker) error { - size, err := body.Seek(0, io.SeekEnd) - if err != nil { - return err - } - - body.Seek(0, io.SeekStart) - r.ContentLength = size - r.Header["Content-Length"] = []string{strconv.FormatInt(size, 10)} - - if size != 0 { - r.Body = &retryableRequestBody{body: body} - r.GetBody = func() (io.ReadCloser, error) { - _, err := body.Seek(0, io.SeekStart) - if err != nil { - return nil, err - } - return r.Body, nil - } - } else { - // in case the body is an empty stream, we need to use http.NoBody to explicitly provide no content - r.Body = http.NoBody - r.GetBody = func() (io.ReadCloser, error) { - return http.NoBody, nil - } - - // close the user-provided empty body - if c, ok := body.(io.Closer); ok { - c.Close() - } - } - - return nil -} - -// Copy makes a copy of an http.Request. Specifically, it makes a deep copy -// of its Method, URL, Host, Proto(Major/Minor), Header. ContentLength, Close, -// RemoteAddr, RequestURI. Copy makes a shallow copy of the Body, GetBody, TLS, -// Cancel, Response, and ctx fields. Copy panics if any of these fields are -// not nil: TransferEncoding, Form, PostForm, MultipartForm, or Trailer. -func (r Request) Copy() Request { - if r.TransferEncoding != nil || r.Form != nil || r.PostForm != nil || r.MultipartForm != nil || r.Trailer != nil { - panic("Can't make a deep copy of the http.Request because at least one of the following is not nil:" + - "TransferEncoding, Form, PostForm, MultipartForm, or Trailer.") - } - copy := *r.Request // Copy the request - urlCopy := *(r.Request.URL) // Copy the URL - copy.URL = &urlCopy - copy.Header = http.Header{} // Copy the header - for k, vs := range r.Header { - for _, value := range vs { - copy.Header.Add(k, value) - } - } - return Request{Request: ©} // Return the copy -} - -func (r Request) close() error { - if r.Body != nil && r.Body != http.NoBody { - c, ok := r.Body.(*retryableRequestBody) - if !ok { - panic("unexpected request body type (should be *retryableReadSeekerCloser)") - } - return c.realClose() - } - return nil -} - -// RewindBody seeks the request's Body stream back to the beginning so it can be resent when retrying an operation. -func (r Request) RewindBody() error { - if r.Body != nil && r.Body != http.NoBody { - s, ok := r.Body.(io.Seeker) - if !ok { - panic("unexpected request body type (should be io.Seeker)") - } - - // Reset the stream back to the beginning - _, err := s.Seek(0, io.SeekStart) - return err - } - return nil -} - -// ********** The following type/methods implement the retryableRequestBody (a ReadSeekCloser) - -// This struct is used when sending a body to the network -type retryableRequestBody struct { - body io.ReadSeeker // Seeking is required to support retries -} - -// Read reads a block of data from an inner stream and reports progress -func (b *retryableRequestBody) Read(p []byte) (n int, err error) { - return b.body.Read(p) -} - -func (b *retryableRequestBody) Seek(offset int64, whence int) (offsetFromStart int64, err error) { - return b.body.Seek(offset, whence) -} - -func (b *retryableRequestBody) Close() error { - // We don't want the underlying transport to close the request body on transient failures so this is a nop. - // The pipeline closes the request body upon success. - return nil -} - -func (b *retryableRequestBody) realClose() error { - if c, ok := b.body.(io.Closer); ok { - return c.Close() - } - return nil -} diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/response.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/response.go deleted file mode 100644 index f2dc16482..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/response.go +++ /dev/null @@ -1,74 +0,0 @@ -package pipeline - -import ( - "bytes" - "fmt" - "net/http" - "sort" - "strings" -) - -// The Response interface exposes an http.Response object as it returns through the pipeline of Policy objects. -// This ensures that Policy objects have access to the HTTP response. However, the object this interface encapsulates -// might be a struct with additional fields that is created by a Policy object (typically a method-specific Factory). -// The method that injected the method-specific Factory gets this returned Response and performs a type assertion -// to the expected struct and returns the struct to its caller. -type Response interface { - Response() *http.Response -} - -// This is the default struct that has the http.Response. -// A method can replace this struct with its own struct containing an http.Response -// field and any other additional fields. -type httpResponse struct { - response *http.Response -} - -// NewHTTPResponse is typically called by a Policy object to return a Response object. -func NewHTTPResponse(response *http.Response) Response { - return &httpResponse{response: response} -} - -// This method satisfies the public Response interface's Response method -func (r httpResponse) Response() *http.Response { - return r.response -} - -// WriteRequestWithResponse appends a formatted HTTP request into a Buffer. If request and/or err are -// not nil, then these are also written into the Buffer. -func WriteRequestWithResponse(b *bytes.Buffer, request *http.Request, response *http.Response, err error) { - // Write the request into the buffer. - fmt.Fprint(b, " "+request.Method+" "+request.URL.String()+"\n") - writeHeader(b, request.Header) - if response != nil { - fmt.Fprintln(b, " --------------------------------------------------------------------------------") - fmt.Fprint(b, " RESPONSE Status: "+response.Status+"\n") - writeHeader(b, response.Header) - } - if err != nil { - fmt.Fprintln(b, " --------------------------------------------------------------------------------") - fmt.Fprint(b, " ERROR:\n"+err.Error()+"\n") - } -} - -// formatHeaders appends an HTTP request's or response's header into a Buffer. -func writeHeader(b *bytes.Buffer, header map[string][]string) { - if len(header) == 0 { - b.WriteString(" (no headers)\n") - return - } - keys := make([]string, 0, len(header)) - // Alphabetize the headers - for k := range header { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - // Redact the value of any Authorization header to prevent security information from persisting in logs - value := interface{}("REDACTED") - if !strings.EqualFold(k, "Authorization") { - value = header[k] - } - fmt.Fprintf(b, " %s: %+v\n", k, value) - } -} diff --git a/vendor/github.com/Azure/azure-pipeline-go/pipeline/version.go b/vendor/github.com/Azure/azure-pipeline-go/pipeline/version.go deleted file mode 100644 index 899f996b5..000000000 --- a/vendor/github.com/Azure/azure-pipeline-go/pipeline/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package pipeline - -const ( - // UserAgent is the string to be used in the user agent string when making requests. - UserAgent = "azure-pipeline-go/" + Version - - // Version is the semantic version (see http://semver.org) of the pipeline package. - Version = "0.2.1" -) diff --git a/vendor/github.com/Azure/azure-storage-blob-go/LICENSE b/vendor/github.com/Azure/azure-storage-blob-go/LICENSE deleted file mode 100644 index d1ca00f20..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/access_conditions.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/access_conditions.go deleted file mode 100644 index 25fe68422..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/access_conditions.go +++ /dev/null @@ -1,65 +0,0 @@ -package azblob - -import ( - "time" -) - -// ModifiedAccessConditions identifies standard HTTP access conditions which you optionally set. -type ModifiedAccessConditions struct { - IfModifiedSince time.Time - IfUnmodifiedSince time.Time - IfMatch ETag - IfNoneMatch ETag -} - -// pointers is for internal infrastructure. It returns the fields as pointers. -func (ac ModifiedAccessConditions) pointers() (ims *time.Time, ius *time.Time, ime *ETag, inme *ETag) { - if !ac.IfModifiedSince.IsZero() { - ims = &ac.IfModifiedSince - } - if !ac.IfUnmodifiedSince.IsZero() { - ius = &ac.IfUnmodifiedSince - } - if ac.IfMatch != ETagNone { - ime = &ac.IfMatch - } - if ac.IfNoneMatch != ETagNone { - inme = &ac.IfNoneMatch - } - return -} - -// ContainerAccessConditions identifies container-specific access conditions which you optionally set. -type ContainerAccessConditions struct { - ModifiedAccessConditions - LeaseAccessConditions -} - -// BlobAccessConditions identifies blob-specific access conditions which you optionally set. -type BlobAccessConditions struct { - ModifiedAccessConditions - LeaseAccessConditions -} - -// LeaseAccessConditions identifies lease access conditions for a container or blob which you optionally set. -type LeaseAccessConditions struct { - LeaseID string -} - -// pointers is for internal infrastructure. It returns the fields as pointers. -func (ac LeaseAccessConditions) pointers() (leaseID *string) { - if ac.LeaseID != "" { - leaseID = &ac.LeaseID - } - return -} - -/* -// getInt32 is for internal infrastructure. It is used with access condition values where -// 0 (the default setting) is meaningful. The library interprets 0 as do not send the header -// and the privately-storage field in the access condition object is stored as +1 higher than desired. -// THis method returns true, if the value is > 0 (explicitly set) and the stored value - 1 (the set desired value). -func getInt32(value int32) (bool, int32) { - return value > 0, value - 1 -} -*/ diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/blob.json b/vendor/github.com/Azure/azure-storage-blob-go/azblob/blob.json deleted file mode 100644 index 09addf083..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/blob.json +++ /dev/null @@ -1,8009 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure Blob Storage", - "version": "2018-11-09", - "x-ms-code-generation-settings": { - "header": "MIT", - "strictSpecAdherence": false - } - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [ - { - "$ref": "#/parameters/Url" - } - ] - }, - "securityDefinitions": { - "blob_shared_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "schemes": [ - "https" - ], - "consumes": [ - "application/xml" - ], - "produces": [ - "application/xml" - ], - "paths": {}, - "x-ms-paths": { - "/?restype=service&comp=properties": { - "put": { - "tags": [ - "service" - ], - "operationId": "Service_SetProperties", - "description": "Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules", - "parameters": [ - { - "$ref": "#/parameters/StorageServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Success (Accepted)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetProperties", - "description": "gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/?restype=service&comp=stats": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetStatistics", - "description": "Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceStats" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListContainersSegment", - "description": "The List Containers Segment operation returns a list of the containers under the specified account", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListContainersInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/ListContainersSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/?restype=service&comp=userdelegationkey": { - "post": { - "tags": [ - "service" - ], - "operationId": "Service_GetUserDelegationKey", - "description": "Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication.", - "parameters": [ - { - "$ref": "#/parameters/KeyInfo" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/UserDelegationKey" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "userdelegationkey" - ] - } - ] - }, - "/?restype=account&comp=properties": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}?restype=container": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_Create", - "description": "creates a new container under the specified account. If the container with the same name already exists, the operation fails", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/BlobPublicAccess" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Success, Container created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetProperties", - "description": "returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-public-access": { - "x-ms-client-name": "BlobPublicAccess", - "description": "Indicated whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "x-ms-has-immutability-policy": { - "x-ms-client-name": "HasImmutabilityPolicy", - "description": "Indicates whether the container has an immutability policy set on it.", - "type": "boolean" - }, - "x-ms-has-legal-hold": { - "x-ms-client-name": "HasLegalHold", - "description": "Indicates whether the container has a legal hold.", - "type": "boolean" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "container" - ], - "operationId": "Container_Delete", - "description": "operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Accepted", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - } - ] - }, - "/{containerName}?restype=container&comp=metadata": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_SetMetadata", - "description": "operation sets one or more user-defined name-value pairs for the specified container.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{containerName}?restype=container&comp=acl": { - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetAccessPolicy", - "description": "gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-blob-public-access": { - "x-ms-client-name": "BlobPublicAccess", - "description": "Indicated whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "container" - ], - "operationId": "Container_SetAccessPolicy", - "description": "sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly.", - "parameters": [ - { - "$ref": "#/parameters/ContainerAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobPublicAccess" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{containerName}?comp=lease&restype=container&acquire": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_AcquireLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseDuration" - }, - { - "$ref": "#/parameters/ProposedLeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The Acquire operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "acquire" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&release": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_ReleaseLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Release operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "release" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&renew": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_RenewLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Renew operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "renew" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&break": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_BreakLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseBreakPeriod" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The Break operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-time": { - "x-ms-client-name": "LeaseTime", - "type": "integer", - "description": "Approximate time remaining in the lease period, in seconds." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "break" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&change": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_ChangeLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/ProposedLeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Change operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "change" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?restype=container&comp=list&flat": { - "get": { - "tags": [ - "containers" - ], - "operationId": "Container_ListBlobFlatSegment", - "description": "[Update] The List Blobs operation returns a list of the blobs under the specified container", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListBlobsInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For List Blobs this is 'application/xml'" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListBlobsFlatSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{containerName}?restype=container&comp=list&hierarchy": { - "get": { - "tags": [ - "containers" - ], - "operationId": "Container_ListBlobHierarchySegment", - "description": "[Update] The List Blobs operation returns a list of the blobs under the specified container", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Delimiter" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListBlobsInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For List Blobs this is 'application/xml'" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListBlobsHierarchySegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{containerName}?restype=account&comp=properties": { - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}": { - "get": { - "tags": [ - "blob" - ], - "operationId": "Blob_Download", - "description": "The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot.", - "parameters": [ - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/GetRangeContentMD5" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Returns the content of the entire blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Download Blob this is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-blob-content-md5": { - "x-ms-client-name": "BlobContentMD5", - "type": "string", - "format": "byte", - "description": "If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range" - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "206": { - "description": "Returns the content of a specified range of the blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Download Blob this is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-blob-content-md5": { - "x-ms-client-name": "BlobContentMD5", - "type": "string", - "format": "byte", - "description": "If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range" - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "head": { - "tags": [ - "blob" - ], - "operationId": "Blob_GetProperties", - "description": "The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.", - "parameters": [ - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Returns the properties of the blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-creation-time": { - "x-ms-client-name": "CreationTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was created." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-incremental-copy": { - "x-ms-client-name": "IsIncrementalCopy", - "type": "boolean", - "description": "Included if the blob is incremental copy blob." - }, - "x-ms-copy-destination-snapshot": { - "x-ms-client-name": "DestinationSnapshot", - "type": "string", - "description": "Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. Snapshot time of the last successful incremental copy snapshot for this blob." - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the blob. The default content type is 'application/octet-stream'" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-access-tier": { - "x-ms-client-name": "AccessTier", - "type": "string", - "description": "The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed premium page blob tiers, see https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. For blob storage LRS accounts, valid values are Hot/Cool/Archive." - }, - "x-ms-access-tier-inferred": { - "x-ms-client-name": "AccessTierInferred", - "type": "boolean", - "description": "For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred based on its content length and this header will be returned with true value." - }, - "x-ms-archive-status": { - "x-ms-client-name": "ArchiveStatus", - "type": "string", - "description": "For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being rehydrated and is not complete then this header is returned indicating that rehydrate is pending and also tells the destination tier." - }, - "x-ms-access-tier-change-time": { - "x-ms-client-name": "AccessTierChangeTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "blob" - ], - "operationId": "Blob_Delete", - "description": "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound).", - "parameters": [ - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/DeleteSnapshots" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The delete request was accepted and the blob will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - } - }, - "/{containerName}/{blob}?PageBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "PageBlob_Create", - "description": "The Create operation creates a new page blob.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentLengthRequired" - }, - { - "$ref": "#/parameters/BlobSequenceNumber" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "PageBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?AppendBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "AppendBlob_Create", - "description": "The Create Append Blob operation creates a new append blob.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?BlockBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "BlockBlob_Upload", - "description": "The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was updated.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "BlockBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=undelete": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_Undelete", - "description": "Undelete a blob that was previously soft deleted", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The blob was undeleted successfully.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "undelete" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&SetHTTPHeaders": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_SetHTTPHeaders", - "description": "The Set HTTP Headers operation sets system properties on the blob", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The properties were set successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=metadata": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_SetMetadata", - "description": "The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The metadata was set successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{containerName}/{blob}?comp=lease&acquire": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_AcquireLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseDuration" - }, - { - "$ref": "#/parameters/ProposedLeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The Acquire operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "acquire" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&release": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_ReleaseLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Release operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "release" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&renew": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_RenewLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Renew operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "renew" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&change": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_ChangeLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/ProposedLeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Change operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "change" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&break": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_BreakLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseBreakPeriod" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The Break operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-time": { - "x-ms-client-name": "LeaseTime", - "type": "integer", - "description": "Approximate time remaining in the lease period, in seconds." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "break" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=snapshot": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_CreateSnapshot", - "description": "The Create Snapshot operation creates a read-only snapshot of a blob", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The snaptshot was taken successfully.", - "headers": { - "x-ms-snapshot": { - "x-ms-client-name": "Snapshot", - "type": "string", - "description": "Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "snapshot" - ] - } - ] - }, - "/{containerName}/{blob}?comp=copy": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_StartCopyFromURL", - "description": "The Start Copy From URL operation copies a blob or an internet resource to a new blob.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The copy blob has been accepted with the specified copy status.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{containerName}/{blob}?comp=copy&sync": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_CopyFromURL", - "description": "The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The copy has completed.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "success" - ], - "x-ms-enum": { - "name": "SyncCopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-requires-sync", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "true" - ] - } - ] - }, - "/{containerName}/{blob}?comp=copy©id={CopyId}": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_AbortCopyFromURL", - "description": "The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata.", - "parameters": [ - { - "$ref": "#/parameters/CopyId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "The delete request was accepted and the blob will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "copy" - ] - }, - { - "name": "x-ms-copy-action", - "x-ms-client-name": "copyActionAbortConstant", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "abort" - ], - "x-ms-parameter-location": "method" - } - ] - }, - "/{containerName}/{blob}?comp=tier": { - "put": { - "tags": [ - "blobs" - ], - "operationId": "Blob_SetTier", - "description": "The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/AccessTier" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - } - ], - "responses": { - "200": { - "description": "The new tier will take effect immediately.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer." - } - } - }, - "202": { - "description": "The transition to the new tier is pending.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "tier" - ] - } - ] - }, - "/{containerName}/{blob}?restype=account&comp=properties": { - "get": { - "tags": [ - "blob" - ], - "operationId": "Blob_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=block": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_StageBlock", - "description": "The Stage Block operation creates a new block to be committed as part of a blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/BlockId" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "block" - ] - } - ] - }, - "/{containerName}/{blob}?comp=block&fromURL": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_StageBlockFromURL", - "description": "The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL.", - "parameters": [ - { - "$ref": "#/parameters/BlockId" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRange" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "block" - ] - } - ] - }, - "/{containerName}/{blob}?comp=blocklist": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_CommitBlockList", - "description": "The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "name": "blocks", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/BlockLookupList" - } - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block list was recorded.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_GetBlockList", - "description": "The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob", - "parameters": [ - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/BlockListType" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The page range was written.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Get Block List this is 'application/xml'" - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/BlockList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "blocklist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=page&update": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UploadPages", - "description": "The Upload Pages operation writes a range of pages to a page blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was written.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "update" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=page&clear": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_ClearPages", - "description": "The Clear Pages operation clears a set of pages from a page blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was cleared.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "clear" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=page&update&fromUrl": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UploadPagesFromURL", - "description": "The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRangeRequiredPutPageFromUrl" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/RangeRequiredPutPageFromUrl" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was written.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "update" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=pagelist": { - "get": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_GetPageRanges", - "description": "The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob", - "parameters": [ - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Information on the page blob was found.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "pagelist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=pagelist&diff": { - "get": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_GetPageRangesDiff", - "description": "The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot.", - "parameters": [ - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/PrevSnapshot" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Information on the page blob was found.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "pagelist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&Resize": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_Resize", - "description": "Resize the Blob", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentLengthRequired" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Blob was resized successfully", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&UpdateSequenceNumber": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UpdateSequenceNumber", - "description": "Update the sequence number of the blob", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SequenceNumberAction" - }, - { - "$ref": "#/parameters/BlobSequenceNumber" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The sequence numbers were updated successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=incrementalcopy": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_CopyIncremental", - "description": "The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The blob was copied.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "incrementalcopy" - ] - } - ] - }, - "/{containerName}/{blob}?comp=appendblock": { - "put": { - "tags": [ - "appendblob" - ], - "consumes": [ - "application/octet-stream" - ], - "operationId": "AppendBlob_AppendBlock", - "description": "The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.", - "parameters": [ - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobConditionMaxSize" - }, - { - "$ref": "#/parameters/BlobConditionAppendPos" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-append-offset": { - "x-ms-client-name": "BlobAppendOffset", - "type": "string", - "description": "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "appendblock" - ] - } - ] - }, - "/{containerName}/{blob}?comp=appendblock&fromUrl": { - "put": { - "tags": [ - "appendblob" - ], - "operationId": "AppendBlob_AppendBlockFromUrl", - "description": "The Append Block operation commits a new block of data to the end of an existing append blob where the contents are read from a source url. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.", - "parameters": [ - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRange" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobConditionMaxSize" - }, - { - "$ref": "#/parameters/BlobConditionAppendPos" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-append-offset": { - "x-ms-client-name": "BlobAppendOffset", - "type": "string", - "description": "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "appendblock" - ] - } - ] - } - }, - "definitions": { - "KeyInfo": { - "type": "object", - "required": [ - "Start", - "Expiry" - ], - "description": "Key information", - "properties": { - "Start": { - "description": "The date-time the key is active in ISO 8601 UTC time", - "type": "string" - }, - "Expiry": { - "description": "The date-time the key expires in ISO 8601 UTC time", - "type": "string" - } - } - }, - "UserDelegationKey": { - "type": "object", - "required": [ - "SignedOid", - "SignedTid", - "SignedStart", - "SignedExpiry", - "SignedService", - "SignedVersion", - "Value" - ], - "description": "A user delegation key", - "properties": { - "SignedOid": { - "description": "The Azure Active Directory object ID in GUID format.", - "type": "string" - }, - "SignedTid": { - "description": "The Azure Active Directory tenant ID in GUID format", - "type": "string" - }, - "SignedStart": { - "description": "The date-time the key is active", - "type": "string", - "format": "date-time" - }, - "SignedExpiry": { - "description": "The date-time the key expires", - "type": "string", - "format": "date-time" - }, - "SignedService": { - "description": "Abbreviation of the Azure Storage service that accepts the key", - "type": "string" - }, - "SignedVersion": { - "description": "The service version that created the key", - "type": "string" - }, - "Value": { - "description": "The key as a base64 string", - "type": "string" - } - } - }, - "PublicAccessType": { - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "CopyStatus": { - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "LeaseDuration": { - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "LeaseState": { - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "LeaseStatus": { - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "StorageError": { - "type": "object", - "properties": { - "Code": { - "type": "string" - }, - "Message": { - "type": "string" - } - } - }, - "AccessPolicy": { - "type": "object", - "required": [ - "Start", - "Expiry", - "Permission" - ], - "description": "An Access policy", - "properties": { - "Start": { - "description": "the date-time the policy is active", - "type": "string", - "format": "date-time" - }, - "Expiry": { - "description": "the date-time the policy expires", - "type": "string", - "format": "date-time" - }, - "Permission": { - "description": "the permissions for the acl policy", - "type": "string" - } - } - }, - "AccessTier": { - "type": "string", - "enum": [ - "P4", - "P6", - "P10", - "P20", - "P30", - "P40", - "P50", - "Hot", - "Cool", - "Archive" - ], - "x-ms-enum": { - "name": "AccessTier", - "modelAsString": true - } - }, - "ArchiveStatus": { - "type": "string", - "enum": [ - "rehydrate-pending-to-hot", - "rehydrate-pending-to-cool" - ], - "x-ms-enum": { - "name": "ArchiveStatus", - "modelAsString": true - } - }, - "BlobItem": { - "xml": { - "name": "Blob" - }, - "description": "An Azure Storage blob", - "type": "object", - "required": [ - "Name", - "Deleted", - "Snapshot", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Deleted": { - "type": "boolean" - }, - "Snapshot": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/BlobProperties" - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - } - }, - "BlobProperties": { - "xml": { - "name": "Properties" - }, - "description": "Properties of a blob", - "type": "object", - "required": [ - "Etag", - "Last-Modified" - ], - "properties": { - "Creation-Time": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "Size in bytes" - }, - "Content-Type": { - "type": "string" - }, - "Content-Encoding": { - "type": "string" - }, - "Content-Language": { - "type": "string" - }, - "Content-MD5": { - "type": "string", - "format": "byte" - }, - "Content-Disposition": { - "type": "string" - }, - "Cache-Control": { - "type": "string" - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "blobSequenceNumber", - "type": "integer", - "format": "int64" - }, - "BlobType": { - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "LeaseStatus": { - "$ref": "#/definitions/LeaseStatus" - }, - "LeaseState": { - "$ref": "#/definitions/LeaseState" - }, - "LeaseDuration": { - "$ref": "#/definitions/LeaseDuration" - }, - "CopyId": { - "type": "string" - }, - "CopyStatus": { - "$ref": "#/definitions/CopyStatus" - }, - "CopySource": { - "type": "string" - }, - "CopyProgress": { - "type": "string" - }, - "CopyCompletionTime": { - "type": "string", - "format": "date-time-rfc1123" - }, - "CopyStatusDescription": { - "type": "string" - }, - "ServerEncrypted": { - "type": "boolean" - }, - "IncrementalCopy": { - "type": "boolean" - }, - "DestinationSnapshot": { - "type": "string" - }, - "DeletedTime": { - "type": "string", - "format": "date-time-rfc1123" - }, - "RemainingRetentionDays": { - "type": "integer" - }, - "AccessTier": { - "$ref": "#/definitions/AccessTier" - }, - "AccessTierInferred": { - "type": "boolean" - }, - "ArchiveStatus": { - "$ref": "#/definitions/ArchiveStatus" - }, - "AccessTierChangeTime": { - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "ListBlobsFlatSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of blobs", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerName", - "Segment" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ContainerName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Delimiter": { - "type": "string" - }, - "Segment": { - "$ref": "#/definitions/BlobFlatListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListBlobsHierarchySegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of blobs", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerName", - "Segment" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ContainerName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Delimiter": { - "type": "string" - }, - "Segment": { - "$ref": "#/definitions/BlobHierarchyListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "BlobFlatListSegment": { - "xml": { - "name": "Blobs" - }, - "required": [ - "BlobItems" - ], - "type": "object", - "properties": { - "BlobItems": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobItem" - } - } - } - }, - "BlobHierarchyListSegment": { - "xml": { - "name": "Blobs" - }, - "type": "object", - "required": [ - "BlobItems" - ], - "properties": { - "BlobPrefixes": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobPrefix" - } - }, - "BlobItems": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobItem" - } - } - } - }, - "BlobPrefix": { - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string" - } - } - }, - "Block": { - "type": "object", - "required": [ - "Name", - "Size" - ], - "description": "Represents a single block in a block blob. It describes the block's ID and size.", - "properties": { - "Name": { - "description": "The base64 encoded block ID.", - "type": "string" - }, - "Size": { - "description": "The block size in bytes.", - "type": "integer" - } - } - }, - "BlockList": { - "type": "object", - "properties": { - "CommittedBlocks": { - "xml": { - "wrapped": true - }, - "type": "array", - "items": { - "$ref": "#/definitions/Block" - } - }, - "UncommittedBlocks": { - "xml": { - "wrapped": true - }, - "type": "array", - "items": { - "$ref": "#/definitions/Block" - } - } - } - }, - "BlockLookupList": { - "type": "object", - "properties": { - "Committed": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Committed" - } - } - }, - "Uncommitted": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Uncommitted" - } - } - }, - "Latest": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Latest" - } - } - } - }, - "xml": { - "name": "BlockList" - } - }, - "ContainerItem": { - "xml": { - "name": "Container" - }, - "type": "object", - "required": [ - "Name", - "Properties" - ], - "description": "An Azure Storage container", - "properties": { - "Name": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/ContainerProperties" - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - } - }, - "ContainerProperties": { - "type": "object", - "required": [ - "Last-Modified", - "Etag" - ], - "description": "Properties of a container", - "properties": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "LeaseStatus": { - "$ref": "#/definitions/LeaseStatus" - }, - "LeaseState": { - "$ref": "#/definitions/LeaseState" - }, - "LeaseDuration": { - "$ref": "#/definitions/LeaseDuration" - }, - "PublicAccess": { - "$ref": "#/definitions/PublicAccessType" - }, - "HasImmutabilityPolicy": { - "type": "boolean" - }, - "HasLegalHold": { - "type": "boolean" - } - } - }, - "ListContainersSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of containers", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerItems" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "ContainerItems": { - "xml": { - "wrapped": true, - "name": "Containers" - }, - "type": "array", - "items": { - "$ref": "#/definitions/ContainerItem" - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "CorsRule": { - "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain", - "type": "object", - "required": [ - "AllowedOrigins", - "AllowedMethods", - "AllowedHeaders", - "ExposedHeaders", - "MaxAgeInSeconds" - ], - "properties": { - "AllowedOrigins": { - "description": "The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", - "type": "string" - }, - "AllowedMethods": { - "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", - "type": "string" - }, - "AllowedHeaders": { - "description": "the request headers that the origin domain may specify on the CORS request.", - "type": "string" - }, - "ExposedHeaders": { - "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer", - "type": "string" - }, - "MaxAgeInSeconds": { - "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", - "type": "integer", - "minimum": 0 - } - } - }, - "ErrorCode": { - "description": "Error codes returned by the service", - "type": "string", - "enum": [ - "AccountAlreadyExists", - "AccountBeingCreated", - "AccountIsDisabled", - "AuthenticationFailed", - "AuthorizationFailure", - "ConditionHeadersNotSupported", - "ConditionNotMet", - "EmptyMetadataKey", - "InsufficientAccountPermissions", - "InternalError", - "InvalidAuthenticationInfo", - "InvalidHeaderValue", - "InvalidHttpVerb", - "InvalidInput", - "InvalidMd5", - "InvalidMetadata", - "InvalidQueryParameterValue", - "InvalidRange", - "InvalidResourceName", - "InvalidUri", - "InvalidXmlDocument", - "InvalidXmlNodeValue", - "Md5Mismatch", - "MetadataTooLarge", - "MissingContentLengthHeader", - "MissingRequiredQueryParameter", - "MissingRequiredHeader", - "MissingRequiredXmlNode", - "MultipleConditionHeadersNotSupported", - "OperationTimedOut", - "OutOfRangeInput", - "OutOfRangeQueryParameterValue", - "RequestBodyTooLarge", - "ResourceTypeMismatch", - "RequestUrlFailedToParse", - "ResourceAlreadyExists", - "ResourceNotFound", - "ServerBusy", - "UnsupportedHeader", - "UnsupportedXmlNode", - "UnsupportedQueryParameter", - "UnsupportedHttpVerb", - "AppendPositionConditionNotMet", - "BlobAlreadyExists", - "BlobNotFound", - "BlobOverwritten", - "BlobTierInadequateForContentLength", - "BlockCountExceedsLimit", - "BlockListTooLong", - "CannotChangeToLowerTier", - "CannotVerifyCopySource", - "ContainerAlreadyExists", - "ContainerBeingDeleted", - "ContainerDisabled", - "ContainerNotFound", - "ContentLengthLargerThanTierLimit", - "CopyAcrossAccountsNotSupported", - "CopyIdMismatch", - "FeatureVersionMismatch", - "IncrementalCopyBlobMismatch", - "IncrementalCopyOfEralierVersionSnapshotNotAllowed", - "IncrementalCopySourceMustBeSnapshot", - "InfiniteLeaseDurationRequired", - "InvalidBlobOrBlock", - "InvalidBlobTier", - "InvalidBlobType", - "InvalidBlockId", - "InvalidBlockList", - "InvalidOperation", - "InvalidPageRange", - "InvalidSourceBlobType", - "InvalidSourceBlobUrl", - "InvalidVersionForPageBlobOperation", - "LeaseAlreadyPresent", - "LeaseAlreadyBroken", - "LeaseIdMismatchWithBlobOperation", - "LeaseIdMismatchWithContainerOperation", - "LeaseIdMismatchWithLeaseOperation", - "LeaseIdMissing", - "LeaseIsBreakingAndCannotBeAcquired", - "LeaseIsBreakingAndCannotBeChanged", - "LeaseIsBrokenAndCannotBeRenewed", - "LeaseLost", - "LeaseNotPresentWithBlobOperation", - "LeaseNotPresentWithContainerOperation", - "LeaseNotPresentWithLeaseOperation", - "MaxBlobSizeConditionNotMet", - "NoPendingCopyOperation", - "OperationNotAllowedOnIncrementalCopyBlob", - "PendingCopyOperation", - "PreviousSnapshotCannotBeNewer", - "PreviousSnapshotNotFound", - "PreviousSnapshotOperationNotSupported", - "SequenceNumberConditionNotMet", - "SequenceNumberIncrementTooLarge", - "SnapshotCountExceeded", - "SnaphotOperationRateExceeded", - "SnapshotsPresent", - "SourceConditionNotMet", - "SystemInUse", - "TargetConditionNotMet", - "UnauthorizedBlobOverwrite", - "BlobBeingRehydrated", - "BlobArchived", - "BlobNotArchived" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "GeoReplication": { - "description": "Geo-Replication information for the Secondary Storage Service", - "type": "object", - "required": [ - "Status", - "LastSyncTime" - ], - "properties": { - "Status": { - "description": "The status of the secondary location", - "type": "string", - "enum": [ - "live", - "bootstrap", - "unavailable" - ], - "x-ms-enum": { - "name": "GeoReplicationStatusType", - "modelAsString": true - } - }, - "LastSyncTime": { - "description": "A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.", - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "Logging": { - "description": "Azure Analytics Logging settings.", - "type": "object", - "required": [ - "Version", - "Delete", - "Read", - "Write", - "RetentionPolicy" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Delete": { - "description": "Indicates whether all delete requests should be logged.", - "type": "boolean" - }, - "Read": { - "description": "Indicates whether all read requests should be logged.", - "type": "boolean" - }, - "Write": { - "description": "Indicates whether all write requests should be logged.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "Metrics": { - "description": "a summary of request statistics grouped by API in hour or minute aggregates for blobs", - "required": [ - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the Blob service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "PageList": { - "description": "the list of pages", - "type": "object", - "properties": { - "PageRange": { - "type": "array", - "items": { - "$ref": "#/definitions/PageRange" - } - }, - "ClearRange": { - "type": "array", - "items": { - "$ref": "#/definitions/ClearRange" - } - } - } - }, - "PageRange": { - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "xml": { - "name": "Start" - } - }, - "End": { - "type": "integer", - "format": "int64", - "xml": { - "name": "End" - } - } - }, - "xml": { - "name": "PageRange" - } - }, - "ClearRange": { - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "xml": { - "name": "Start" - } - }, - "End": { - "type": "integer", - "format": "int64", - "xml": { - "name": "End" - } - } - }, - "xml": { - "name": "ClearRange" - } - }, - "RetentionPolicy": { - "description": "the retention policy which determines how long the associated data should persist", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the storage service", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted", - "type": "integer", - "minimum": 1 - } - } - }, - "SignedIdentifier": { - "xml": { - "name": "SignedIdentifier" - }, - "description": "signed identifier", - "type": "object", - "required": [ - "Id", - "AccessPolicy" - ], - "properties": { - "Id": { - "type": "string", - "description": "a unique id" - }, - "AccessPolicy": { - "$ref": "#/definitions/AccessPolicy" - } - } - }, - "SignedIdentifiers": { - "description": "a collection of signed identifiers", - "type": "array", - "items": { - "$ref": "#/definitions/SignedIdentifier" - }, - "xml": { - "wrapped": true, - "name": "SignedIdentifiers" - } - }, - "StaticWebsite": { - "description": "The properties that enable an account to host a static website", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether this account is hosting a static website", - "type": "boolean" - }, - "IndexDocument": { - "description": "The default name of the index page under each directory", - "type": "string" - }, - "ErrorDocument404Path": { - "description": "The absolute path of the custom 404 page", - "type": "string" - } - } - }, - "StorageServiceProperties": { - "description": "Storage Service Properties.", - "type": "object", - "properties": { - "Logging": { - "$ref": "#/definitions/Logging" - }, - "HourMetrics": { - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule" - }, - "xml": { - "wrapped": true - } - }, - "DefaultServiceVersion": { - "description": "The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions", - "type": "string" - }, - "DeleteRetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - }, - "StaticWebsite": { - "$ref": "#/definitions/StaticWebsite" - } - } - }, - "StorageServiceStats": { - "description": "Stats for the storage service.", - "type": "object", - "properties": { - "GeoReplication": { - "$ref": "#/definitions/GeoReplication" - } - } - } - }, - "parameters": { - "Url": { - "name": "url", - "description": "The URL of the service account, container, or blob that is the targe of the desired operation.", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - }, - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "required": true, - "type": "string", - "description": "Specifies the version of the operation to use for this request.", - "enum": [ - "2018-11-09" - ] - }, - "Blob": { - "name": "blob", - "in": "path", - "required": true, - "type": "string", - "pattern": "^[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+)*(?:\\.[a-zA-Z0-9]+){0,1}$", - "minLength": 1, - "maxLength": 1024, - "x-ms-parameter-location": "method", - "description": "The blob name." - }, - "BlobCacheControl": { - "name": "x-ms-blob-cache-control", - "x-ms-client-name": "blobCacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobConditionAppendPos": { - "name": "x-ms-blob-condition-appendpos", - "x-ms-client-name": "appendPosition", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "append-position-access-conditions" - }, - "description": "Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed)." - }, - "BlobConditionMaxSize": { - "name": "x-ms-blob-condition-maxsize", - "x-ms-client-name": "maxSize", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "append-position-access-conditions" - }, - "description": "Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed)." - }, - "BlobPublicAccess": { - "name": "x-ms-blob-public-access", - "x-ms-client-name": "access", - "in": "header", - "required": false, - "x-ms-parameter-location": "method", - "description": "Specifies whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "AccessTier": { - "name": "x-ms-access-tier", - "x-ms-client-name": "tier", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "P4", - "P6", - "P10", - "P20", - "P30", - "P40", - "P50", - "Hot", - "Cool", - "Archive" - ], - "x-ms-enum": { - "name": "AccessTier", - "modelAsString": true - }, - "x-ms-parameter-location": "method", - "description": "Indicates the tier to be set on the blob." - }, - "BlobContentDisposition": { - "name": "x-ms-blob-content-disposition", - "x-ms-client-name": "blobContentDisposition", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's Content-Disposition header." - }, - "BlobContentEncoding": { - "name": "x-ms-blob-content-encoding", - "x-ms-client-name": "blobContentEncoding", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobContentLanguage": { - "name": "x-ms-blob-content-language", - "x-ms-client-name": "blobContentLanguage", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobContentLengthOptional": { - "name": "x-ms-blob-content-length", - "x-ms-client-name": "blobContentLength", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary." - }, - "BlobContentLengthRequired": { - "name": "x-ms-blob-content-length", - "x-ms-client-name": "blobContentLength", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary." - }, - "BlobContentMD5": { - "name": "x-ms-blob-content-md5", - "x-ms-client-name": "blobContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was uploaded." - }, - "BlobContentType": { - "name": "x-ms-blob-content-type", - "x-ms-client-name": "blobContentType", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobSequenceNumber": { - "name": "x-ms-blob-sequence-number", - "x-ms-client-name": "blobSequenceNumber", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "default": 0, - "x-ms-parameter-location": "method", - "description": "Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1." - }, - "BlockId": { - "name": "blockid", - "x-ms-client-name": "blockId", - "in": "query", - "type": "string", - "required": true, - "x-ms-parameter-location": "method", - "description": "A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block." - }, - "BlockListType": { - "name": "blocklisttype", - "x-ms-client-name": "listType", - "in": "query", - "required": true, - "default": "committed", - "x-ms-parameter-location": "method", - "description": "Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together.", - "type": "string", - "enum": [ - "committed", - "uncommitted", - "all" - ], - "x-ms-enum": { - "name": "BlockListType", - "modelAsString": false - } - }, - "Body": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method", - "description": "Initial data" - }, - "ContainerAcl": { - "name": "containerAcl", - "in": "body", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method", - "description": "the acls for the container" - }, - "CopyId": { - "name": "copyid", - "x-ms-client-name": "copyId", - "in": "query", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation." - }, - "ClientRequestId": { - "name": "x-ms-client-request-id", - "x-ms-client-name": "requestId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled." - }, - "ContainerName": { - "name": "containerName", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The container name." - }, - - "ContentLength": { - "name": "Content-Length", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "The length of the request." - }, - "ContentMD5": { - "name": "Content-MD5", - "x-ms-client-name": "transactionalContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the transactional md5 for the body, to be validated by the service." - }, - "CopySource": { - "name": "x-ms-copy-source", - "x-ms-client-name": "copySource", - "in": "header", - "required": true, - "type": "string", - "format": "url", - "x-ms-parameter-location": "method", - "description": "Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature." - }, - "DeleteSnapshots": { - "name": "x-ms-delete-snapshots", - "x-ms-client-name": "deleteSnapshots", - "description": "Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself", - "x-ms-parameter-location": "method", - "in": "header", - "required": false, - "type": "string", - "enum": [ - "include", - "only" - ], - "x-ms-enum": { - "name": "DeleteSnapshotsOptionType", - "modelAsString": false - } - }, - "Delimiter": { - "name": "delimiter", - "description": "When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string.", - "type": "string", - "x-ms-parameter-location": "method", - "in": "query", - "required": true - }, - "GetRangeContentMD5": { - "name": "x-ms-range-get-content-md5", - "x-ms-client-name": "rangeGetContentMD5", - "in": "header", - "required": false, - "type": "boolean", - "x-ms-parameter-location": "method", - "description": "When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size." - }, - "IfMatch": { - "name": "If-Match", - "x-ms-client-name": "ifMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs with a matching value." - }, - "IfModifiedSince": { - "name": "If-Modified-Since", - "x-ms-client-name": "ifModifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has been modified since the specified date/time." - }, - "IfNoneMatch": { - "name": "If-None-Match", - "x-ms-client-name": "ifNoneMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs without a matching value." - }, - "IfUnmodifiedSince": { - "name": "If-Unmodified-Since", - "x-ms-client-name": "ifUnmodifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has not been modified since the specified date/time." - }, - "IfSequenceNumberEqualTo": { - "name": "x-ms-if-sequence-number-eq", - "x-ms-client-name": "ifSequenceNumberEqualTo", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has the specified sequence number." - }, - "IfSequenceNumberLessThan": { - "name": "x-ms-if-sequence-number-lt", - "x-ms-client-name": "ifSequenceNumberLessThan", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has a sequence number less than the specified." - }, - "IfSequenceNumberLessThanOrEqualTo": { - "name": "x-ms-if-sequence-number-le", - "x-ms-client-name": "ifSequenceNumberLessThanOrEqualTo", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified." - }, - "KeyInfo": { - "name": "KeyInfo", - "in": "body", - "x-ms-parameter-location": "method", - "required": true, - "schema": { - "$ref": "#/definitions/KeyInfo" - } - }, - "ListBlobsInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "copy", - "deleted", - "metadata", - "snapshots", - "uncommittedblobs" - ], - "x-ms-enum": { - "name": "ListBlobsIncludeItem", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify one or more datasets to include in the response." - }, - "ListContainersInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "metadata" - ], - "x-ms-enum": { - "name": "ListContainersIncludeType", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify that the container's metadata be returned as part of the response body." - }, - "LeaseBreakPeriod": { - "name": "x-ms-lease-break-period", - "x-ms-client-name": "breakPeriod", - "in": "header", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method", - "description": "For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately." - }, - "LeaseDuration": { - "name": "x-ms-lease-duration", - "x-ms-client-name": "duration", - "in": "header", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method", - "description": "Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change." - }, - "LeaseIdOptional": { - "name": "x-ms-lease-id", - "x-ms-client-name": "leaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "lease-access-conditions" - }, - "description": "If specified, the operation only succeeds if the resource's lease is active and matches this ID." - }, - "LeaseIdRequired": { - "name": "x-ms-lease-id", - "x-ms-client-name": "leaseId", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Specifies the current lease ID on the resource." - }, - "Marker": { - "name": "marker", - "in": "query", - "required": false, - "type": "string", - "description": "A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000." - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "required": false, - "type": "string", - "description": "Filters the results to return only containers whose name begins with the specified prefix.", - "x-ms-parameter-location": "method" - }, - "PrevSnapshot": { - "name": "prevsnapshot", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016." - }, - "ProposedLeaseIdOptional": { - "name": "x-ms-proposed-lease-id", - "x-ms-client-name": "proposedLeaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats." - }, - "ProposedLeaseIdRequired": { - "name": "x-ms-proposed-lease-id", - "x-ms-client-name": "proposedLeaseId", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats." - }, - "Range": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Return only the bytes of the blob in the specified range." - }, - "RangeRequiredPutPageFromUrl": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required." - }, - "SequenceNumberAction": { - "name": "x-ms-sequence-number-action", - "x-ms-client-name": "sequenceNumberAction", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number", - "type": "string", - "enum": [ - "max", - "update", - "increment" - ], - "x-ms-enum": { - "name": "SequenceNumberActionType", - "modelAsString": false - } - }, - "Snapshot": { - "name": "snapshot", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see Creating a Snapshot of a Blob." - }, - "SourceContentMD5": { - "name": "x-ms-source-content-md5", - "x-ms-client-name": "sourceContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the md5 calculated for the range of bytes that must be read from the copy source." - }, - "SourceRange": { - "name": "x-ms-source-range", - "x-ms-client-name": "sourceRange", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Bytes of source data in the specified range." - }, - "SourceRangeRequiredPutPageFromUrl": { - "name": "x-ms-source-range", - "x-ms-client-name": "sourceRange", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header." - }, - "SourceIfMatch": { - "name": "x-ms-source-if-match", - "x-ms-client-name": "sourceIfMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs with a matching value." - }, - "SourceIfModifiedSince": { - "name": "x-ms-source-if-modified-since", - "x-ms-client-name": "sourceIfModifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has been modified since the specified date/time." - }, - "SourceIfNoneMatch": { - "name": "x-ms-source-if-none-match", - "x-ms-client-name": "sourceIfNoneMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs without a matching value." - }, - "SourceIfUnmodifiedSince": { - "name": "x-ms-source-if-unmodified-since", - "x-ms-client-name": "sourceIfUnmodifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has not been modified since the specified date/time." - }, - "SourceLeaseId": { - "name": "x-ms-source-lease-id", - "x-ms-client-name": "sourceLeaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match." - }, - "SourceUrl": { - "name": "x-ms-copy-source", - "x-ms-client-name": "sourceUrl", - "in": "header", - "required": true, - "type": "string", - "format": "url", - "x-ms-parameter-location": "method", - "description": "Specify a URL to the copy source." - }, - "StorageServiceProperties": { - "name": "StorageServiceProperties", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - }, - "x-ms-parameter-location": "method", - "description": "The StorageService properties." - }, - "Timeout": { - "name": "timeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method", - "description": "The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations." - } - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/chunkwriting.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/chunkwriting.go deleted file mode 100644 index 12b6c344e..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/chunkwriting.go +++ /dev/null @@ -1,238 +0,0 @@ -package azblob - -import ( - "bytes" - "context" - "encoding/base64" - "encoding/binary" - "errors" - "fmt" - "io" - "sync" - - guuid "github.com/google/uuid" -) - -// blockWriter provides methods to upload blocks that represent a file to a server and commit them. -// This allows us to provide a local implementation that fakes the server for hermetic testing. -type blockWriter interface { - StageBlock(context.Context, string, io.ReadSeeker, LeaseAccessConditions, []byte) (*BlockBlobStageBlockResponse, error) - CommitBlockList(context.Context, []string, BlobHTTPHeaders, Metadata, BlobAccessConditions) (*BlockBlobCommitBlockListResponse, error) -} - -// copyFromReader copies a source io.Reader to blob storage using concurrent uploads. -// TODO(someone): The existing model provides a buffer size and buffer limit as limiting factors. The buffer size is probably -// useless other than needing to be above some number, as the network stack is going to hack up the buffer over some size. The -// max buffers is providing a cap on how much memory we use (by multiplying it times the buffer size) and how many go routines can upload -// at a time. I think having a single max memory dial would be more efficient. We can choose an internal buffer size that works -// well, 4 MiB or 8 MiB, and autoscale to as many goroutines within the memory limit. This gives a single dial to tweak and we can -// choose a max value for the memory setting based on internal transfers within Azure (which will give us the maximum throughput model). -// We can even provide a utility to dial this number in for customer networks to optimize their copies. -func copyFromReader(ctx context.Context, from io.Reader, to blockWriter, o UploadStreamToBlockBlobOptions) (*BlockBlobCommitBlockListResponse, error) { - o.defaults() - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - cp := &copier{ - ctx: ctx, - cancel: cancel, - reader: from, - to: to, - id: newID(), - o: o, - ch: make(chan copierChunk, 1), - errCh: make(chan error, 1), - buffers: sync.Pool{ - New: func() interface{} { - return make([]byte, o.BufferSize) - }, - }, - } - - // Starts the pools of concurrent writers. - cp.wg.Add(o.MaxBuffers) - for i := 0; i < o.MaxBuffers; i++ { - go cp.writer() - } - - // Send all our chunks until we get an error. - var err error - for { - if err = cp.sendChunk(); err != nil { - break - } - } - // If the error is not EOF, then we have a problem. - if err != nil && !errors.Is(err, io.EOF) { - return nil, err - } - - // Close out our upload. - if err := cp.close(); err != nil { - return nil, err - } - - return cp.result, nil -} - -// copier streams a file via chunks in parallel from a reader representing a file. -// Do not use directly, instead use copyFromReader(). -type copier struct { - // ctx holds the context of a copier. This is normally a faux pas to store a Context in a struct. In this case, - // the copier has the lifetime of a function call, so its fine. - ctx context.Context - cancel context.CancelFunc - - // reader is the source to be written to storage. - reader io.Reader - // to is the location we are writing our chunks to. - to blockWriter - - id *id - o UploadStreamToBlockBlobOptions - - // num is the current chunk we are on. - num int32 - // ch is used to pass the next chunk of data from our reader to one of the writers. - ch chan copierChunk - // errCh is used to hold the first error from our concurrent writers. - errCh chan error - // wg provides a count of how many writers we are waiting to finish. - wg sync.WaitGroup - // buffers provides a pool of chunks that can be reused. - buffers sync.Pool - - // result holds the final result from blob storage after we have submitted all chunks. - result *BlockBlobCommitBlockListResponse -} - -type copierChunk struct { - buffer []byte - id string -} - -// getErr returns an error by priority. First, if a function set an error, it returns that error. Next, if the Context has an error -// it returns that error. Otherwise it is nil. getErr supports only returning an error once per copier. -func (c *copier) getErr() error { - select { - case err := <-c.errCh: - return err - default: - } - return c.ctx.Err() -} - -// sendChunk reads data from out internal reader, creates a chunk, and sends it to be written via a channel. -// sendChunk returns io.EOF when the reader returns an io.EOF or io.ErrUnexpectedEOF. -func (c *copier) sendChunk() error { - if err := c.getErr(); err != nil { - return err - } - - buffer := c.buffers.Get().([]byte) - n, err := io.ReadFull(c.reader, buffer) - switch { - case err == nil && n == 0: - return nil - case err == nil: - c.ch <- copierChunk{ - buffer: buffer[0:n], - id: c.id.next(), - } - return nil - case err != nil && (err == io.EOF || err == io.ErrUnexpectedEOF) && n == 0: - return io.EOF - } - - if err == io.EOF || err == io.ErrUnexpectedEOF { - c.ch <- copierChunk{ - buffer: buffer[0:n], - id: c.id.next(), - } - return io.EOF - } - if err := c.getErr(); err != nil { - return err - } - return err -} - -// writer writes chunks sent on a channel. -func (c *copier) writer() { - defer c.wg.Done() - - for chunk := range c.ch { - if err := c.write(chunk); err != nil { - if !errors.Is(err, context.Canceled) { - select { - case c.errCh <- err: - c.cancel() - default: - } - return - } - } - } -} - -// write uploads a chunk to blob storage. -func (c *copier) write(chunk copierChunk) error { - defer c.buffers.Put(chunk.buffer) - - if err := c.ctx.Err(); err != nil { - return err - } - - _, err := c.to.StageBlock(c.ctx, chunk.id, bytes.NewReader(chunk.buffer), LeaseAccessConditions{}, nil) - if err != nil { - return fmt.Errorf("write error: %w", err) - } - return nil -} - -// close commits our blocks to blob storage and closes our writer. -func (c *copier) close() error { - close(c.ch) - c.wg.Wait() - - if err := c.getErr(); err != nil { - return err - } - - var err error - c.result, err = c.to.CommitBlockList(c.ctx, c.id.issued(), c.o.BlobHTTPHeaders, c.o.Metadata, c.o.AccessConditions) - return err -} - -// id allows the creation of unique IDs based on UUID4 + an int32. This autoincrements. -type id struct { - u [64]byte - num uint32 - all []string -} - -// newID constructs a new id. -func newID() *id { - uu := guuid.New() - u := [64]byte{} - copy(u[:], uu[:]) - return &id{u: u} -} - -// next returns the next ID. This is not thread-safe. -func (id *id) next() string { - defer func() { id.num++ }() - - binary.BigEndian.PutUint32((id.u[len(guuid.UUID{}):]), id.num) - str := base64.StdEncoding.EncodeToString(id.u[:]) - id.all = append(id.all, str) - - return str -} - -// issued returns all ids that have been issued. This returned value shares the internal slice so it is not safe to modify the return. -// The value is only valid until the next time next() is called. -func (id *id) issued() []string { - return id.all -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/highlevel.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/highlevel.go deleted file mode 100644 index 7588aeb67..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/highlevel.go +++ /dev/null @@ -1,396 +0,0 @@ -package azblob - -import ( - "context" - "encoding/base64" - "io" - "net/http" - - "bytes" - "os" - "sync" - "time" - - "errors" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// CommonResponse returns the headers common to all blob REST API responses. -type CommonResponse interface { - // ETag returns the value for header ETag. - ETag() ETag - - // LastModified returns the value for header Last-Modified. - LastModified() time.Time - - // RequestID returns the value for header x-ms-request-id. - RequestID() string - - // Date returns the value for header Date. - Date() time.Time - - // Version returns the value for header x-ms-version. - Version() string - - // Response returns the raw HTTP response object. - Response() *http.Response -} - -// UploadToBlockBlobOptions identifies options used by the UploadBufferToBlockBlob and UploadFileToBlockBlob functions. -type UploadToBlockBlobOptions struct { - // BlockSize specifies the block size to use; the default (and maximum size) is BlockBlobMaxStageBlockBytes. - BlockSize int64 - - // Progress is a function that is invoked periodically as bytes are sent to the BlockBlobURL. - // Note that the progress reporting is not always increasing; it can go down when retrying a request. - Progress pipeline.ProgressReceiver - - // BlobHTTPHeaders indicates the HTTP headers to be associated with the blob. - BlobHTTPHeaders BlobHTTPHeaders - - // Metadata indicates the metadata to be associated with the blob when PutBlockList is called. - Metadata Metadata - - // AccessConditions indicates the access conditions for the block blob. - AccessConditions BlobAccessConditions - - // Parallelism indicates the maximum number of blocks to upload in parallel (0=default) - Parallelism uint16 -} - -// UploadBufferToBlockBlob uploads a buffer in blocks to a block blob. -func UploadBufferToBlockBlob(ctx context.Context, b []byte, - blockBlobURL BlockBlobURL, o UploadToBlockBlobOptions) (CommonResponse, error) { - bufferSize := int64(len(b)) - if o.BlockSize == 0 { - // If bufferSize > (BlockBlobMaxStageBlockBytes * BlockBlobMaxBlocks), then error - if bufferSize > BlockBlobMaxStageBlockBytes*BlockBlobMaxBlocks { - return nil, errors.New("buffer is too large to upload to a block blob") - } - // If bufferSize <= BlockBlobMaxUploadBlobBytes, then Upload should be used with just 1 I/O request - if bufferSize <= BlockBlobMaxUploadBlobBytes { - o.BlockSize = BlockBlobMaxUploadBlobBytes // Default if unspecified - } else { - o.BlockSize = bufferSize / BlockBlobMaxBlocks // buffer / max blocks = block size to use all 50,000 blocks - if o.BlockSize < BlobDefaultDownloadBlockSize { // If the block size is smaller than 4MB, round up to 4MB - o.BlockSize = BlobDefaultDownloadBlockSize - } - // StageBlock will be called with blockSize blocks and a Parallelism of (BufferSize / BlockSize). - } - } - - if bufferSize <= BlockBlobMaxUploadBlobBytes { - // If the size can fit in 1 Upload call, do it this way - var body io.ReadSeeker = bytes.NewReader(b) - if o.Progress != nil { - body = pipeline.NewRequestBodyProgress(body, o.Progress) - } - return blockBlobURL.Upload(ctx, body, o.BlobHTTPHeaders, o.Metadata, o.AccessConditions) - } - - var numBlocks = uint16(((bufferSize - 1) / o.BlockSize) + 1) - - blockIDList := make([]string, numBlocks) // Base-64 encoded block IDs - progress := int64(0) - progressLock := &sync.Mutex{} - - err := DoBatchTransfer(ctx, BatchTransferOptions{ - OperationName: "UploadBufferToBlockBlob", - TransferSize: bufferSize, - ChunkSize: o.BlockSize, - Parallelism: o.Parallelism, - Operation: func(offset int64, count int64, ctx context.Context) error { - // This function is called once per block. - // It is passed this block's offset within the buffer and its count of bytes - // Prepare to read the proper block/section of the buffer - var body io.ReadSeeker = bytes.NewReader(b[offset : offset+count]) - blockNum := offset / o.BlockSize - if o.Progress != nil { - blockProgress := int64(0) - body = pipeline.NewRequestBodyProgress(body, - func(bytesTransferred int64) { - diff := bytesTransferred - blockProgress - blockProgress = bytesTransferred - progressLock.Lock() // 1 goroutine at a time gets a progress report - progress += diff - o.Progress(progress) - progressLock.Unlock() - }) - } - - // Block IDs are unique values to avoid issue if 2+ clients are uploading blocks - // at the same time causing PutBlockList to get a mix of blocks from all the clients. - blockIDList[blockNum] = base64.StdEncoding.EncodeToString(newUUID().bytes()) - _, err := blockBlobURL.StageBlock(ctx, blockIDList[blockNum], body, o.AccessConditions.LeaseAccessConditions, nil) - return err - }, - }) - if err != nil { - return nil, err - } - // All put blocks were successful, call Put Block List to finalize the blob - return blockBlobURL.CommitBlockList(ctx, blockIDList, o.BlobHTTPHeaders, o.Metadata, o.AccessConditions) -} - -// UploadFileToBlockBlob uploads a file in blocks to a block blob. -func UploadFileToBlockBlob(ctx context.Context, file *os.File, - blockBlobURL BlockBlobURL, o UploadToBlockBlobOptions) (CommonResponse, error) { - - stat, err := file.Stat() - if err != nil { - return nil, err - } - m := mmf{} // Default to an empty slice; used for 0-size file - if stat.Size() != 0 { - m, err = newMMF(file, false, 0, int(stat.Size())) - if err != nil { - return nil, err - } - defer m.unmap() - } - return UploadBufferToBlockBlob(ctx, m, blockBlobURL, o) -} - -/////////////////////////////////////////////////////////////////////////////// - -const BlobDefaultDownloadBlockSize = int64(4 * 1024 * 1024) // 4MB - -// DownloadFromBlobOptions identifies options used by the DownloadBlobToBuffer and DownloadBlobToFile functions. -type DownloadFromBlobOptions struct { - // BlockSize specifies the block size to use for each parallel download; the default size is BlobDefaultDownloadBlockSize. - BlockSize int64 - - // Progress is a function that is invoked periodically as bytes are received. - Progress pipeline.ProgressReceiver - - // AccessConditions indicates the access conditions used when making HTTP GET requests against the blob. - AccessConditions BlobAccessConditions - - // Parallelism indicates the maximum number of blocks to download in parallel (0=default) - Parallelism uint16 - - // RetryReaderOptionsPerBlock is used when downloading each block. - RetryReaderOptionsPerBlock RetryReaderOptions -} - -// downloadBlobToBuffer downloads an Azure blob to a buffer with parallel. -func downloadBlobToBuffer(ctx context.Context, blobURL BlobURL, offset int64, count int64, - b []byte, o DownloadFromBlobOptions, initialDownloadResponse *DownloadResponse) error { - if o.BlockSize == 0 { - o.BlockSize = BlobDefaultDownloadBlockSize - } - - if count == CountToEnd { // If size not specified, calculate it - if initialDownloadResponse != nil { - count = initialDownloadResponse.ContentLength() - offset // if we have the length, use it - } else { - // If we don't have the length at all, get it - dr, err := blobURL.Download(ctx, 0, CountToEnd, o.AccessConditions, false) - if err != nil { - return err - } - count = dr.ContentLength() - offset - } - } - - // Prepare and do parallel download. - progress := int64(0) - progressLock := &sync.Mutex{} - - err := DoBatchTransfer(ctx, BatchTransferOptions{ - OperationName: "downloadBlobToBuffer", - TransferSize: count, - ChunkSize: o.BlockSize, - Parallelism: o.Parallelism, - Operation: func(chunkStart int64, count int64, ctx context.Context) error { - dr, err := blobURL.Download(ctx, chunkStart+offset, count, o.AccessConditions, false) - if err != nil { - return err - } - body := dr.Body(o.RetryReaderOptionsPerBlock) - if o.Progress != nil { - rangeProgress := int64(0) - body = pipeline.NewResponseBodyProgress( - body, - func(bytesTransferred int64) { - diff := bytesTransferred - rangeProgress - rangeProgress = bytesTransferred - progressLock.Lock() - progress += diff - o.Progress(progress) - progressLock.Unlock() - }) - } - _, err = io.ReadFull(body, b[chunkStart:chunkStart+count]) - body.Close() - return err - }, - }) - if err != nil { - return err - } - return nil -} - -// DownloadBlobToBuffer downloads an Azure blob to a buffer with parallel. -// Offset and count are optional, pass 0 for both to download the entire blob. -func DownloadBlobToBuffer(ctx context.Context, blobURL BlobURL, offset int64, count int64, - b []byte, o DownloadFromBlobOptions) error { - return downloadBlobToBuffer(ctx, blobURL, offset, count, b, o, nil) -} - -// DownloadBlobToFile downloads an Azure blob to a local file. -// The file would be truncated if the size doesn't match. -// Offset and count are optional, pass 0 for both to download the entire blob. -func DownloadBlobToFile(ctx context.Context, blobURL BlobURL, offset int64, count int64, - file *os.File, o DownloadFromBlobOptions) error { - // 1. Calculate the size of the destination file - var size int64 - - if count == CountToEnd { - // Try to get Azure blob's size - props, err := blobURL.GetProperties(ctx, o.AccessConditions) - if err != nil { - return err - } - size = props.ContentLength() - offset - } else { - size = count - } - - // 2. Compare and try to resize local file's size if it doesn't match Azure blob's size. - stat, err := file.Stat() - if err != nil { - return err - } - if stat.Size() != size { - if err = file.Truncate(size); err != nil { - return err - } - } - - if size > 0 { - // 3. Set mmap and call downloadBlobToBuffer. - m, err := newMMF(file, true, 0, int(size)) - if err != nil { - return err - } - defer m.unmap() - return downloadBlobToBuffer(ctx, blobURL, offset, size, m, o, nil) - } else { // if the blob's size is 0, there is no need in downloading it - return nil - } -} - -/////////////////////////////////////////////////////////////////////////////// - -// BatchTransferOptions identifies options used by DoBatchTransfer. -type BatchTransferOptions struct { - TransferSize int64 - ChunkSize int64 - Parallelism uint16 - Operation func(offset int64, chunkSize int64, ctx context.Context) error - OperationName string -} - -// DoBatchTransfer helps to execute operations in a batch manner. -// Can be used by users to customize batch works (for other scenarios that the SDK does not provide) -func DoBatchTransfer(ctx context.Context, o BatchTransferOptions) error { - if o.ChunkSize == 0 { - return errors.New("ChunkSize cannot be 0") - } - - if o.Parallelism == 0 { - o.Parallelism = 5 // default Parallelism - } - - // Prepare and do parallel operations. - numChunks := uint16(((o.TransferSize - 1) / o.ChunkSize) + 1) - operationChannel := make(chan func() error, o.Parallelism) // Create the channel that release 'Parallelism' goroutines concurrently - operationResponseChannel := make(chan error, numChunks) // Holds each response - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - // Create the goroutines that process each operation (in parallel). - for g := uint16(0); g < o.Parallelism; g++ { - //grIndex := g - go func() { - for f := range operationChannel { - err := f() - operationResponseChannel <- err - } - }() - } - - // Add each chunk's operation to the channel. - for chunkNum := uint16(0); chunkNum < numChunks; chunkNum++ { - curChunkSize := o.ChunkSize - - if chunkNum == numChunks-1 { // Last chunk - curChunkSize = o.TransferSize - (int64(chunkNum) * o.ChunkSize) // Remove size of all transferred chunks from total - } - offset := int64(chunkNum) * o.ChunkSize - - operationChannel <- func() error { - return o.Operation(offset, curChunkSize, ctx) - } - } - close(operationChannel) - - // Wait for the operations to complete. - var firstErr error = nil - for chunkNum := uint16(0); chunkNum < numChunks; chunkNum++ { - responseError := <-operationResponseChannel - // record the first error (the original error which should cause the other chunks to fail with canceled context) - if responseError != nil && firstErr == nil { - cancel() // As soon as any operation fails, cancel all remaining operation calls - firstErr = responseError - } - } - return firstErr -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -const _1MiB = 1024 * 1024 - -type UploadStreamToBlockBlobOptions struct { - // BufferSize sizes the buffer used to read data from source. If < 1 MiB, defaults to 1 MiB. - BufferSize int - // MaxBuffers defines the number of simultaneous uploads will be performed to upload the file. - MaxBuffers int - BlobHTTPHeaders BlobHTTPHeaders - Metadata Metadata - AccessConditions BlobAccessConditions -} - -func (u *UploadStreamToBlockBlobOptions) defaults() { - if u.MaxBuffers == 0 { - u.MaxBuffers = 1 - } - - if u.BufferSize < _1MiB { - u.BufferSize = _1MiB - } -} - -// UploadStreamToBlockBlob copies the file held in io.Reader to the Blob at blockBlobURL. -// A Context deadline or cancellation will cause this to error. -func UploadStreamToBlockBlob(ctx context.Context, reader io.Reader, blockBlobURL BlockBlobURL, - o UploadStreamToBlockBlobOptions) (CommonResponse, error) { - o.defaults() - - result, err := copyFromReader(ctx, reader, blockBlobURL, o) - if err != nil { - return nil, err - } - - return result, nil -} - -// UploadStreamOptions (defunct) was used internally. This will be removed or made private in a future version. -type UploadStreamOptions struct { - BufferSize int - MaxBuffers int -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/parsing_urls.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/parsing_urls.go deleted file mode 100644 index 067939b1a..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/parsing_urls.go +++ /dev/null @@ -1,153 +0,0 @@ -package azblob - -import ( - "net" - "net/url" - "strings" -) - -const ( - snapshot = "snapshot" - SnapshotTimeFormat = "2006-01-02T15:04:05.0000000Z07:00" -) - -// A BlobURLParts object represents the components that make up an Azure Storage Container/Blob URL. You parse an -// existing URL into its parts by calling NewBlobURLParts(). You construct a URL from parts by calling URL(). -// NOTE: Changing any SAS-related field requires computing a new SAS signature. -type BlobURLParts struct { - Scheme string // Ex: "https://" - Host string // Ex: "account.blob.core.windows.net", "10.132.141.33", "10.132.141.33:80" - IPEndpointStyleInfo IPEndpointStyleInfo - ContainerName string // "" if no container - BlobName string // "" if no blob - Snapshot string // "" if not a snapshot - SAS SASQueryParameters - UnparsedParams string -} - -// IPEndpointStyleInfo is used for IP endpoint style URL when working with Azure storage emulator. -// Ex: "https://10.132.141.33/accountname/containername" -type IPEndpointStyleInfo struct { - AccountName string // "" if not using IP endpoint style -} - -// isIPEndpointStyle checkes if URL's host is IP, in this case the storage account endpoint will be composed as: -// http(s)://IP(:port)/storageaccount/container/... -// As url's Host property, host could be both host or host:port -func isIPEndpointStyle(host string) bool { - if host == "" { - return false - } - if h, _, err := net.SplitHostPort(host); err == nil { - host = h - } - // For IPv6, there could be case where SplitHostPort fails for cannot finding port. - // In this case, eliminate the '[' and ']' in the URL. - // For details about IPv6 URL, please refer to https://tools.ietf.org/html/rfc2732 - if host[0] == '[' && host[len(host)-1] == ']' { - host = host[1 : len(host)-1] - } - return net.ParseIP(host) != nil -} - -// NewBlobURLParts parses a URL initializing BlobURLParts' fields including any SAS-related & snapshot query parameters. Any other -// query parameters remain in the UnparsedParams field. This method overwrites all fields in the BlobURLParts object. -func NewBlobURLParts(u url.URL) BlobURLParts { - up := BlobURLParts{ - Scheme: u.Scheme, - Host: u.Host, - } - - // Find the container & blob names (if any) - if u.Path != "" { - path := u.Path - if path[0] == '/' { - path = path[1:] // If path starts with a slash, remove it - } - if isIPEndpointStyle(up.Host) { - if accountEndIndex := strings.Index(path, "/"); accountEndIndex == -1 { // Slash not found; path has account name & no container name or blob - up.IPEndpointStyleInfo.AccountName = path - } else { - up.IPEndpointStyleInfo.AccountName = path[:accountEndIndex] // The account name is the part between the slashes - path = path[accountEndIndex+1:] // path refers to portion after the account name now (container & blob names) - } - } - - containerEndIndex := strings.Index(path, "/") // Find the next slash (if it exists) - if containerEndIndex == -1 { // Slash not found; path has container name & no blob name - up.ContainerName = path - } else { - up.ContainerName = path[:containerEndIndex] // The container name is the part between the slashes - up.BlobName = path[containerEndIndex+1:] // The blob name is after the container slash - } - } - - // Convert the query parameters to a case-sensitive map & trim whitespace - paramsMap := u.Query() - - up.Snapshot = "" // Assume no snapshot - if snapshotStr, ok := caseInsensitiveValues(paramsMap).Get(snapshot); ok { - up.Snapshot = snapshotStr[0] - // If we recognized the query parameter, remove it from the map - delete(paramsMap, snapshot) - } - up.SAS = newSASQueryParameters(paramsMap, true) - up.UnparsedParams = paramsMap.Encode() - return up -} - -type caseInsensitiveValues url.Values // map[string][]string -func (values caseInsensitiveValues) Get(key string) ([]string, bool) { - key = strings.ToLower(key) - for k, v := range values { - if strings.ToLower(k) == key { - return v, true - } - } - return []string{}, false -} - -// URL returns a URL object whose fields are initialized from the BlobURLParts fields. The URL's RawQuery -// field contains the SAS, snapshot, and unparsed query parameters. -func (up BlobURLParts) URL() url.URL { - path := "" - if isIPEndpointStyle(up.Host) && up.IPEndpointStyleInfo.AccountName != "" { - path += "/" + up.IPEndpointStyleInfo.AccountName - } - // Concatenate container & blob names (if they exist) - if up.ContainerName != "" { - path += "/" + up.ContainerName - if up.BlobName != "" { - path += "/" + up.BlobName - } - } - - rawQuery := up.UnparsedParams - - //If no snapshot is initially provided, fill it in from the SAS query properties to help the user - if up.Snapshot == "" && !up.SAS.snapshotTime.IsZero() { - up.Snapshot = up.SAS.snapshotTime.Format(SnapshotTimeFormat) - } - - // Concatenate blob snapshot query parameter (if it exists) - if up.Snapshot != "" { - if len(rawQuery) > 0 { - rawQuery += "&" - } - rawQuery += snapshot + "=" + up.Snapshot - } - sas := up.SAS.Encode() - if sas != "" { - if len(rawQuery) > 0 { - rawQuery += "&" - } - rawQuery += sas - } - u := url.URL{ - Scheme: up.Scheme, - Host: up.Host, - Path: path, - RawQuery: rawQuery, - } - return u -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/sas_service.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/sas_service.go deleted file mode 100644 index 4d45d3ec7..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/sas_service.go +++ /dev/null @@ -1,256 +0,0 @@ -package azblob - -import ( - "bytes" - "fmt" - "strings" - "time" -) - -// BlobSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage container or blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/constructing-a-service-sas -type BlobSASSignatureValues struct { - Version string `param:"sv"` // If not specified, this defaults to SASVersion - Protocol SASProtocol `param:"spr"` // See the SASProtocol* constants - StartTime time.Time `param:"st"` // Not specified if IsZero - ExpiryTime time.Time `param:"se"` // Not specified if IsZero - SnapshotTime time.Time - Permissions string `param:"sp"` // Create by initializing a ContainerSASPermissions or BlobSASPermissions and then call String() - IPRange IPRange `param:"sip"` - Identifier string `param:"si"` - ContainerName string - BlobName string // Use "" to create a Container SAS - CacheControl string // rscc - ContentDisposition string // rscd - ContentEncoding string // rsce - ContentLanguage string // rscl - ContentType string // rsct -} - -// NewSASQueryParameters uses an account's StorageAccountCredential to sign this signature values to produce -// the proper SAS query parameters. -// See: StorageAccountCredential. Compatible with both UserDelegationCredential and SharedKeyCredential -func (v BlobSASSignatureValues) NewSASQueryParameters(credential StorageAccountCredential) (SASQueryParameters, error) { - resource := "c" - if credential == nil { - return SASQueryParameters{}, fmt.Errorf("cannot sign SAS query without StorageAccountCredential") - } - - if !v.SnapshotTime.IsZero() { - resource = "bs" - //Make sure the permission characters are in the correct order - perms := &BlobSASPermissions{} - if err := perms.Parse(v.Permissions); err != nil { - return SASQueryParameters{}, err - } - v.Permissions = perms.String() - } else if v.BlobName == "" { - // Make sure the permission characters are in the correct order - perms := &ContainerSASPermissions{} - if err := perms.Parse(v.Permissions); err != nil { - return SASQueryParameters{}, err - } - v.Permissions = perms.String() - } else { - resource = "b" - // Make sure the permission characters are in the correct order - perms := &BlobSASPermissions{} - if err := perms.Parse(v.Permissions); err != nil { - return SASQueryParameters{}, err - } - v.Permissions = perms.String() - } - if v.Version == "" { - v.Version = SASVersion - } - startTime, expiryTime, snapshotTime := FormatTimesForSASSigning(v.StartTime, v.ExpiryTime, v.SnapshotTime) - - signedIdentifier := v.Identifier - - udk := credential.getUDKParams() - - if udk != nil { - udkStart, udkExpiry, _ := FormatTimesForSASSigning(udk.SignedStart, udk.SignedExpiry, time.Time{}) - //I don't like this answer to combining the functions - //But because signedIdentifier and the user delegation key strings share a place, this is an _OK_ way to do it. - signedIdentifier = strings.Join([]string{ - udk.SignedOid, - udk.SignedTid, - udkStart, - udkExpiry, - udk.SignedService, - udk.SignedVersion, - }, "\n") - } - - // String to sign: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx - stringToSign := strings.Join([]string{ - v.Permissions, - startTime, - expiryTime, - getCanonicalName(credential.AccountName(), v.ContainerName, v.BlobName), - signedIdentifier, - v.IPRange.String(), - string(v.Protocol), - v.Version, - resource, - snapshotTime, // signed timestamp - v.CacheControl, // rscc - v.ContentDisposition, // rscd - v.ContentEncoding, // rsce - v.ContentLanguage, // rscl - v.ContentType}, // rsct - "\n") - - signature := "" - signature = credential.ComputeHMACSHA256(stringToSign) - - p := SASQueryParameters{ - // Common SAS parameters - version: v.Version, - protocol: v.Protocol, - startTime: v.StartTime, - expiryTime: v.ExpiryTime, - permissions: v.Permissions, - ipRange: v.IPRange, - - // Container/Blob-specific SAS parameters - resource: resource, - identifier: v.Identifier, - cacheControl: v.CacheControl, - contentDisposition: v.ContentDisposition, - contentEncoding: v.ContentEncoding, - contentLanguage: v.ContentLanguage, - contentType: v.ContentType, - snapshotTime: v.SnapshotTime, - - // Calculated SAS signature - signature: signature, - } - - //User delegation SAS specific parameters - if udk != nil { - p.signedOid = udk.SignedOid - p.signedTid = udk.SignedTid - p.signedStart = udk.SignedStart - p.signedExpiry = udk.SignedExpiry - p.signedService = udk.SignedService - p.signedVersion = udk.SignedVersion - } - - return p, nil -} - -// getCanonicalName computes the canonical name for a container or blob resource for SAS signing. -func getCanonicalName(account string, containerName string, blobName string) string { - // Container: "/blob/account/containername" - // Blob: "/blob/account/containername/blobname" - elements := []string{"/blob/", account, "/", containerName} - if blobName != "" { - elements = append(elements, "/", strings.Replace(blobName, "\\", "/", -1)) - } - return strings.Join(elements, "") -} - -// The ContainerSASPermissions type simplifies creating the permissions string for an Azure Storage container SAS. -// Initialize an instance of this type and then call its String method to set BlobSASSignatureValues's Permissions field. -type ContainerSASPermissions struct { - Read, Add, Create, Write, Delete, List bool -} - -// String produces the SAS permissions string for an Azure Storage container. -// Call this method to set BlobSASSignatureValues's Permissions field. -func (p ContainerSASPermissions) String() string { - var b bytes.Buffer - if p.Read { - b.WriteRune('r') - } - if p.Add { - b.WriteRune('a') - } - if p.Create { - b.WriteRune('c') - } - if p.Write { - b.WriteRune('w') - } - if p.Delete { - b.WriteRune('d') - } - if p.List { - b.WriteRune('l') - } - return b.String() -} - -// Parse initializes the ContainerSASPermissions's fields from a string. -func (p *ContainerSASPermissions) Parse(s string) error { - *p = ContainerSASPermissions{} // Clear the flags - for _, r := range s { - switch r { - case 'r': - p.Read = true - case 'a': - p.Add = true - case 'c': - p.Create = true - case 'w': - p.Write = true - case 'd': - p.Delete = true - case 'l': - p.List = true - default: - return fmt.Errorf("Invalid permission: '%v'", r) - } - } - return nil -} - -// The BlobSASPermissions type simplifies creating the permissions string for an Azure Storage blob SAS. -// Initialize an instance of this type and then call its String method to set BlobSASSignatureValues's Permissions field. -type BlobSASPermissions struct{ Read, Add, Create, Write, Delete bool } - -// String produces the SAS permissions string for an Azure Storage blob. -// Call this method to set BlobSASSignatureValues's Permissions field. -func (p BlobSASPermissions) String() string { - var b bytes.Buffer - if p.Read { - b.WriteRune('r') - } - if p.Add { - b.WriteRune('a') - } - if p.Create { - b.WriteRune('c') - } - if p.Write { - b.WriteRune('w') - } - if p.Delete { - b.WriteRune('d') - } - return b.String() -} - -// Parse initializes the BlobSASPermissions's fields from a string. -func (p *BlobSASPermissions) Parse(s string) error { - *p = BlobSASPermissions{} // Clear the flags - for _, r := range s { - switch r { - case 'r': - p.Read = true - case 'a': - p.Add = true - case 'c': - p.Create = true - case 'w': - p.Write = true - case 'd': - p.Delete = true - default: - return fmt.Errorf("Invalid permission: '%v'", r) - } - } - return nil -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/service_codes_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/service_codes_blob.go deleted file mode 100644 index d260f8aee..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/service_codes_blob.go +++ /dev/null @@ -1,195 +0,0 @@ -package azblob - -// https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes - -// ServiceCode values indicate a service failure. -const ( - // ServiceCodeAppendPositionConditionNotMet means the append position condition specified was not met. - ServiceCodeAppendPositionConditionNotMet ServiceCodeType = "AppendPositionConditionNotMet" - - // ServiceCodeBlobAlreadyExists means the specified blob already exists. - ServiceCodeBlobAlreadyExists ServiceCodeType = "BlobAlreadyExists" - - // ServiceCodeBlobNotFound means the specified blob does not exist. - ServiceCodeBlobNotFound ServiceCodeType = "BlobNotFound" - - // ServiceCodeBlobOverwritten means the blob has been recreated since the previous snapshot was taken. - ServiceCodeBlobOverwritten ServiceCodeType = "BlobOverwritten" - - // ServiceCodeBlobTierInadequateForContentLength means the specified blob tier size limit cannot be less than content length. - ServiceCodeBlobTierInadequateForContentLength ServiceCodeType = "BlobTierInadequateForContentLength" - - // ServiceCodeBlockCountExceedsLimit means the committed block count cannot exceed the maximum limit of 50,000 blocks - // or that the uncommitted block count cannot exceed the maximum limit of 100,000 blocks. - ServiceCodeBlockCountExceedsLimit ServiceCodeType = "BlockCountExceedsLimit" - - // ServiceCodeBlockListTooLong means the block list may not contain more than 50,000 blocks. - ServiceCodeBlockListTooLong ServiceCodeType = "BlockListTooLong" - - // ServiceCodeCannotChangeToLowerTier means that a higher blob tier has already been explicitly set. - ServiceCodeCannotChangeToLowerTier ServiceCodeType = "CannotChangeToLowerTier" - - // ServiceCodeCannotVerifyCopySource means that the service could not verify the copy source within the specified time. - // Examine the HTTP status code and message for more information about the failure. - ServiceCodeCannotVerifyCopySource ServiceCodeType = "CannotVerifyCopySource" - - // ServiceCodeContainerAlreadyExists means the specified container already exists. - ServiceCodeContainerAlreadyExists ServiceCodeType = "ContainerAlreadyExists" - - // ServiceCodeContainerBeingDeleted means the specified container is being deleted. - ServiceCodeContainerBeingDeleted ServiceCodeType = "ContainerBeingDeleted" - - // ServiceCodeContainerDisabled means the specified container has been disabled by the administrator. - ServiceCodeContainerDisabled ServiceCodeType = "ContainerDisabled" - - // ServiceCodeContainerNotFound means the specified container does not exist. - ServiceCodeContainerNotFound ServiceCodeType = "ContainerNotFound" - - // ServiceCodeContentLengthLargerThanTierLimit means the blob's content length cannot exceed its tier limit. - ServiceCodeContentLengthLargerThanTierLimit ServiceCodeType = "ContentLengthLargerThanTierLimit" - - // ServiceCodeCopyAcrossAccountsNotSupported means the copy source account and destination account must be the same. - ServiceCodeCopyAcrossAccountsNotSupported ServiceCodeType = "CopyAcrossAccountsNotSupported" - - // ServiceCodeCopyIDMismatch means the specified copy ID did not match the copy ID for the pending copy operation. - ServiceCodeCopyIDMismatch ServiceCodeType = "CopyIdMismatch" - - // ServiceCodeFeatureVersionMismatch means the type of blob in the container is unrecognized by this version or - // that the operation for AppendBlob requires at least version 2015-02-21. - ServiceCodeFeatureVersionMismatch ServiceCodeType = "FeatureVersionMismatch" - - // ServiceCodeIncrementalCopyBlobMismatch means the specified source blob is different than the copy source of the existing incremental copy blob. - ServiceCodeIncrementalCopyBlobMismatch ServiceCodeType = "IncrementalCopyBlobMismatch" - - // ServiceCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed means the specified snapshot is earlier than the last snapshot copied into the incremental copy blob. - ServiceCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed ServiceCodeType = "IncrementalCopyOfEralierVersionSnapshotNotAllowed" - - // ServiceCodeIncrementalCopySourceMustBeSnapshot means the source for incremental copy request must be a snapshot. - ServiceCodeIncrementalCopySourceMustBeSnapshot ServiceCodeType = "IncrementalCopySourceMustBeSnapshot" - - // ServiceCodeInfiniteLeaseDurationRequired means the lease ID matched, but the specified lease must be an infinite-duration lease. - ServiceCodeInfiniteLeaseDurationRequired ServiceCodeType = "InfiniteLeaseDurationRequired" - - // ServiceCodeInvalidBlobOrBlock means the specified blob or block content is invalid. - ServiceCodeInvalidBlobOrBlock ServiceCodeType = "InvalidBlobOrBlock" - - // ServiceCodeInvalidBlobType means the blob type is invalid for this operation. - ServiceCodeInvalidBlobType ServiceCodeType = "InvalidBlobType" - - // ServiceCodeInvalidBlockID means the specified block ID is invalid. The block ID must be Base64-encoded. - ServiceCodeInvalidBlockID ServiceCodeType = "InvalidBlockId" - - // ServiceCodeInvalidBlockList means the specified block list is invalid. - ServiceCodeInvalidBlockList ServiceCodeType = "InvalidBlockList" - - // ServiceCodeInvalidOperation means an invalid operation against a blob snapshot. - ServiceCodeInvalidOperation ServiceCodeType = "InvalidOperation" - - // ServiceCodeInvalidPageRange means the page range specified is invalid. - ServiceCodeInvalidPageRange ServiceCodeType = "InvalidPageRange" - - // ServiceCodeInvalidSourceBlobType means the copy source blob type is invalid for this operation. - ServiceCodeInvalidSourceBlobType ServiceCodeType = "InvalidSourceBlobType" - - // ServiceCodeInvalidSourceBlobURL means the source URL for incremental copy request must be valid Azure Storage blob URL. - ServiceCodeInvalidSourceBlobURL ServiceCodeType = "InvalidSourceBlobUrl" - - // ServiceCodeInvalidVersionForPageBlobOperation means that all operations on page blobs require at least version 2009-09-19. - ServiceCodeInvalidVersionForPageBlobOperation ServiceCodeType = "InvalidVersionForPageBlobOperation" - - // ServiceCodeLeaseAlreadyPresent means there is already a lease present. - ServiceCodeLeaseAlreadyPresent ServiceCodeType = "LeaseAlreadyPresent" - - // ServiceCodeLeaseAlreadyBroken means the lease has already been broken and cannot be broken again. - ServiceCodeLeaseAlreadyBroken ServiceCodeType = "LeaseAlreadyBroken" - - // ServiceCodeLeaseIDMismatchWithBlobOperation means the lease ID specified did not match the lease ID for the blob. - ServiceCodeLeaseIDMismatchWithBlobOperation ServiceCodeType = "LeaseIdMismatchWithBlobOperation" - - // ServiceCodeLeaseIDMismatchWithContainerOperation means the lease ID specified did not match the lease ID for the container. - ServiceCodeLeaseIDMismatchWithContainerOperation ServiceCodeType = "LeaseIdMismatchWithContainerOperation" - - // ServiceCodeLeaseIDMismatchWithLeaseOperation means the lease ID specified did not match the lease ID for the blob/container. - ServiceCodeLeaseIDMismatchWithLeaseOperation ServiceCodeType = "LeaseIdMismatchWithLeaseOperation" - - // ServiceCodeLeaseIDMissing means there is currently a lease on the blob/container and no lease ID was specified in the request. - ServiceCodeLeaseIDMissing ServiceCodeType = "LeaseIdMissing" - - // ServiceCodeLeaseIsBreakingAndCannotBeAcquired means the lease ID matched, but the lease is currently in breaking state and cannot be acquired until it is broken. - ServiceCodeLeaseIsBreakingAndCannotBeAcquired ServiceCodeType = "LeaseIsBreakingAndCannotBeAcquired" - - // ServiceCodeLeaseIsBreakingAndCannotBeChanged means the lease ID matched, but the lease is currently in breaking state and cannot be changed. - ServiceCodeLeaseIsBreakingAndCannotBeChanged ServiceCodeType = "LeaseIsBreakingAndCannotBeChanged" - - // ServiceCodeLeaseIsBrokenAndCannotBeRenewed means the lease ID matched, but the lease has been broken explicitly and cannot be renewed. - ServiceCodeLeaseIsBrokenAndCannotBeRenewed ServiceCodeType = "LeaseIsBrokenAndCannotBeRenewed" - - // ServiceCodeLeaseLost means a lease ID was specified, but the lease for the blob/container has expired. - ServiceCodeLeaseLost ServiceCodeType = "LeaseLost" - - // ServiceCodeLeaseNotPresentWithBlobOperation means there is currently no lease on the blob. - ServiceCodeLeaseNotPresentWithBlobOperation ServiceCodeType = "LeaseNotPresentWithBlobOperation" - - // ServiceCodeLeaseNotPresentWithContainerOperation means there is currently no lease on the container. - ServiceCodeLeaseNotPresentWithContainerOperation ServiceCodeType = "LeaseNotPresentWithContainerOperation" - - // ServiceCodeLeaseNotPresentWithLeaseOperation means there is currently no lease on the blob/container. - ServiceCodeLeaseNotPresentWithLeaseOperation ServiceCodeType = "LeaseNotPresentWithLeaseOperation" - - // ServiceCodeMaxBlobSizeConditionNotMet means the max blob size condition specified was not met. - ServiceCodeMaxBlobSizeConditionNotMet ServiceCodeType = "MaxBlobSizeConditionNotMet" - - // ServiceCodeNoPendingCopyOperation means there is currently no pending copy operation. - ServiceCodeNoPendingCopyOperation ServiceCodeType = "NoPendingCopyOperation" - - // ServiceCodeOperationNotAllowedOnIncrementalCopyBlob means the specified operation is not allowed on an incremental copy blob. - ServiceCodeOperationNotAllowedOnIncrementalCopyBlob ServiceCodeType = "OperationNotAllowedOnIncrementalCopyBlob" - - // ServiceCodePendingCopyOperation means there is currently a pending copy operation. - ServiceCodePendingCopyOperation ServiceCodeType = "PendingCopyOperation" - - // ServiceCodePreviousSnapshotCannotBeNewer means the prevsnapshot query parameter value cannot be newer than snapshot query parameter value. - ServiceCodePreviousSnapshotCannotBeNewer ServiceCodeType = "PreviousSnapshotCannotBeNewer" - - // ServiceCodePreviousSnapshotNotFound means the previous snapshot is not found. - ServiceCodePreviousSnapshotNotFound ServiceCodeType = "PreviousSnapshotNotFound" - - // ServiceCodePreviousSnapshotOperationNotSupported means that differential Get Page Ranges is not supported on the previous snapshot. - ServiceCodePreviousSnapshotOperationNotSupported ServiceCodeType = "PreviousSnapshotOperationNotSupported" - - // ServiceCodeSequenceNumberConditionNotMet means the sequence number condition specified was not met. - ServiceCodeSequenceNumberConditionNotMet ServiceCodeType = "SequenceNumberConditionNotMet" - - // ServiceCodeSequenceNumberIncrementTooLarge means the sequence number increment cannot be performed because it would result in overflow of the sequence number. - ServiceCodeSequenceNumberIncrementTooLarge ServiceCodeType = "SequenceNumberIncrementTooLarge" - - // ServiceCodeSnapshotCountExceeded means the snapshot count against this blob has been exceeded. - ServiceCodeSnapshotCountExceeded ServiceCodeType = "SnapshotCountExceeded" - - // ServiceCodeSnaphotOperationRateExceeded means the rate of snapshot operations against this blob has been exceeded. - ServiceCodeSnaphotOperationRateExceeded ServiceCodeType = "SnaphotOperationRateExceeded" - - // ServiceCodeSnapshotsPresent means this operation is not permitted while the blob has snapshots. - ServiceCodeSnapshotsPresent ServiceCodeType = "SnapshotsPresent" - - // ServiceCodeSourceConditionNotMet means the source condition specified using HTTP conditional header(s) is not met. - ServiceCodeSourceConditionNotMet ServiceCodeType = "SourceConditionNotMet" - - // ServiceCodeSystemInUse means this blob is in use by the system. - ServiceCodeSystemInUse ServiceCodeType = "SystemInUse" - - // ServiceCodeTargetConditionNotMet means the target condition specified using HTTP conditional header(s) is not met. - ServiceCodeTargetConditionNotMet ServiceCodeType = "TargetConditionNotMet" - - // ServiceCodeUnauthorizedBlobOverwrite means this request is not authorized to perform blob overwrites. - ServiceCodeUnauthorizedBlobOverwrite ServiceCodeType = "UnauthorizedBlobOverwrite" - - // ServiceCodeBlobBeingRehydrated means this operation is not permitted because the blob is being rehydrated. - ServiceCodeBlobBeingRehydrated ServiceCodeType = "BlobBeingRehydrated" - - // ServiceCodeBlobArchived means this operation is not permitted on an archived blob. - ServiceCodeBlobArchived ServiceCodeType = "BlobArchived" - - // ServiceCodeBlobNotArchived means this blob is currently not in the archived state. - ServiceCodeBlobNotArchived ServiceCodeType = "BlobNotArchived" -) diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/storage_account_credential.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/storage_account_credential.go deleted file mode 100644 index b89b18bb4..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/storage_account_credential.go +++ /dev/null @@ -1,8 +0,0 @@ -package azblob - -// StorageAccountCredential is a wrapper interface for SharedKeyCredential and UserDelegationCredential -type StorageAccountCredential interface { - AccountName() string - ComputeHMACSHA256(message string) (base64String string) - getUDKParams() *UserDelegationKey -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_append_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_append_blob.go deleted file mode 100644 index 3cb6badc5..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_append_blob.go +++ /dev/null @@ -1,138 +0,0 @@ -package azblob - -import ( - "context" - "io" - "net/url" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -const ( - // AppendBlobMaxAppendBlockBytes indicates the maximum number of bytes that can be sent in a call to AppendBlock. - AppendBlobMaxAppendBlockBytes = 4 * 1024 * 1024 // 4MB - - // AppendBlobMaxBlocks indicates the maximum number of blocks allowed in an append blob. - AppendBlobMaxBlocks = 50000 -) - -// AppendBlobURL defines a set of operations applicable to append blobs. -type AppendBlobURL struct { - BlobURL - abClient appendBlobClient -} - -// NewAppendBlobURL creates an AppendBlobURL object using the specified URL and request policy pipeline. -func NewAppendBlobURL(url url.URL, p pipeline.Pipeline) AppendBlobURL { - blobClient := newBlobClient(url, p) - abClient := newAppendBlobClient(url, p) - return AppendBlobURL{BlobURL: BlobURL{blobClient: blobClient}, abClient: abClient} -} - -// WithPipeline creates a new AppendBlobURL object identical to the source but with the specific request policy pipeline. -func (ab AppendBlobURL) WithPipeline(p pipeline.Pipeline) AppendBlobURL { - return NewAppendBlobURL(ab.blobClient.URL(), p) -} - -// WithSnapshot creates a new AppendBlobURL object identical to the source but with the specified snapshot timestamp. -// Pass "" to remove the snapshot returning a URL to the base blob. -func (ab AppendBlobURL) WithSnapshot(snapshot string) AppendBlobURL { - p := NewBlobURLParts(ab.URL()) - p.Snapshot = snapshot - return NewAppendBlobURL(p.URL(), ab.blobClient.Pipeline()) -} - -func (ab AppendBlobURL) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error) { - return ab.blobClient.GetAccountInfo(ctx) -} - -// Create creates a 0-length append blob. Call AppendBlock to append data to an append blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob. -func (ab AppendBlobURL) Create(ctx context.Context, h BlobHTTPHeaders, metadata Metadata, ac BlobAccessConditions) (*AppendBlobCreateResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch := ac.ModifiedAccessConditions.pointers() - return ab.abClient.Create(ctx, 0, nil, - &h.ContentType, &h.ContentEncoding, &h.ContentLanguage, h.ContentMD5, - &h.CacheControl, metadata, ac.LeaseAccessConditions.pointers(), &h.ContentDisposition, - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, nil) -} - -// AppendBlock writes a stream to a new block of data to the end of the existing append blob. -// This method panics if the stream is not at position 0. -// Note that the http client closes the body stream after the request is sent to the service. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block. -func (ab AppendBlobURL) AppendBlock(ctx context.Context, body io.ReadSeeker, ac AppendBlobAccessConditions, transactionalMD5 []byte) (*AppendBlobAppendBlockResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - ifAppendPositionEqual, ifMaxSizeLessThanOrEqual := ac.AppendPositionAccessConditions.pointers() - count, err := validateSeekableStreamAt0AndGetCount(body) - if err != nil { - return nil, err - } - return ab.abClient.AppendBlock(ctx, body, count, nil, - transactionalMD5, - nil, // CRC - ac.LeaseAccessConditions.pointers(), - ifMaxSizeLessThanOrEqual, ifAppendPositionEqual, - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// AppendBlockFromURL copies a new block of data from source URL to the end of the existing append blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block-from-url. -func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.URL, offset int64, count int64, destinationAccessConditions AppendBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, transactionalMD5 []byte) (*AppendBlobAppendBlockFromURLResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := destinationAccessConditions.ModifiedAccessConditions.pointers() - sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag := sourceAccessConditions.pointers() - ifAppendPositionEqual, ifMaxSizeLessThanOrEqual := destinationAccessConditions.AppendPositionAccessConditions.pointers() - return ab.abClient.AppendBlockFromURL(ctx, sourceURL.String(), 0, httpRange{offset: offset, count: count}.pointers(), - transactionalMD5, nil, nil, nil, - nil, nil, EncryptionAlgorithmNone, // CPK - destinationAccessConditions.LeaseAccessConditions.pointers(), - ifMaxSizeLessThanOrEqual, ifAppendPositionEqual, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil) -} - -type AppendBlobAccessConditions struct { - ModifiedAccessConditions - LeaseAccessConditions - AppendPositionAccessConditions -} - -// AppendPositionAccessConditions identifies append blob-specific access conditions which you optionally set. -type AppendPositionAccessConditions struct { - // IfAppendPositionEqual ensures that the AppendBlock operation succeeds - // only if the append position is equal to a value. - // IfAppendPositionEqual=0 means no 'IfAppendPositionEqual' header specified. - // IfAppendPositionEqual>0 means 'IfAppendPositionEqual' header specified with its value - // IfAppendPositionEqual==-1 means IfAppendPositionEqual' header specified with a value of 0 - IfAppendPositionEqual int64 - - // IfMaxSizeLessThanOrEqual ensures that the AppendBlock operation succeeds - // only if the append blob's size is less than or equal to a value. - // IfMaxSizeLessThanOrEqual=0 means no 'IfMaxSizeLessThanOrEqual' header specified. - // IfMaxSizeLessThanOrEqual>0 means 'IfMaxSizeLessThanOrEqual' header specified with its value - // IfMaxSizeLessThanOrEqual==-1 means 'IfMaxSizeLessThanOrEqual' header specified with a value of 0 - IfMaxSizeLessThanOrEqual int64 -} - -// pointers is for internal infrastructure. It returns the fields as pointers. -func (ac AppendPositionAccessConditions) pointers() (iape *int64, imsltoe *int64) { - var zero int64 // defaults to 0 - switch ac.IfAppendPositionEqual { - case -1: - iape = &zero - case 0: - iape = nil - default: - iape = &ac.IfAppendPositionEqual - } - - switch ac.IfMaxSizeLessThanOrEqual { - case -1: - imsltoe = &zero - case 0: - imsltoe = nil - default: - imsltoe = &ac.IfMaxSizeLessThanOrEqual - } - return -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_blob.go deleted file mode 100644 index e6be6aaf0..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_blob.go +++ /dev/null @@ -1,225 +0,0 @@ -package azblob - -import ( - "context" - "net/url" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// A BlobURL represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob. -type BlobURL struct { - blobClient blobClient -} - -// NewBlobURL creates a BlobURL object using the specified URL and request policy pipeline. -func NewBlobURL(url url.URL, p pipeline.Pipeline) BlobURL { - blobClient := newBlobClient(url, p) - return BlobURL{blobClient: blobClient} -} - -// URL returns the URL endpoint used by the BlobURL object. -func (b BlobURL) URL() url.URL { - return b.blobClient.URL() -} - -// String returns the URL as a string. -func (b BlobURL) String() string { - u := b.URL() - return u.String() -} - -func (b BlobURL) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error) { - return b.blobClient.GetAccountInfo(ctx) -} - -// WithPipeline creates a new BlobURL object identical to the source but with the specified request policy pipeline. -func (b BlobURL) WithPipeline(p pipeline.Pipeline) BlobURL { - return NewBlobURL(b.blobClient.URL(), p) -} - -// WithSnapshot creates a new BlobURL object identical to the source but with the specified snapshot timestamp. -// Pass "" to remove the snapshot returning a URL to the base blob. -func (b BlobURL) WithSnapshot(snapshot string) BlobURL { - p := NewBlobURLParts(b.URL()) - p.Snapshot = snapshot - return NewBlobURL(p.URL(), b.blobClient.Pipeline()) -} - -// ToAppendBlobURL creates an AppendBlobURL using the source's URL and pipeline. -func (b BlobURL) ToAppendBlobURL() AppendBlobURL { - return NewAppendBlobURL(b.URL(), b.blobClient.Pipeline()) -} - -// ToBlockBlobURL creates a BlockBlobURL using the source's URL and pipeline. -func (b BlobURL) ToBlockBlobURL() BlockBlobURL { - return NewBlockBlobURL(b.URL(), b.blobClient.Pipeline()) -} - -// ToPageBlobURL creates a PageBlobURL using the source's URL and pipeline. -func (b BlobURL) ToPageBlobURL() PageBlobURL { - return NewPageBlobURL(b.URL(), b.blobClient.Pipeline()) -} - -// DownloadBlob reads a range of bytes from a blob. The response also includes the blob's properties and metadata. -// Passing azblob.CountToEnd (0) for count will download the blob from the offset to the end. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob. -func (b BlobURL) Download(ctx context.Context, offset int64, count int64, ac BlobAccessConditions, rangeGetContentMD5 bool) (*DownloadResponse, error) { - var xRangeGetContentMD5 *bool - if rangeGetContentMD5 { - xRangeGetContentMD5 = &rangeGetContentMD5 - } - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - dr, err := b.blobClient.Download(ctx, nil, nil, - httpRange{offset: offset, count: count}.pointers(), - ac.LeaseAccessConditions.pointers(), xRangeGetContentMD5, nil, - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) - if err != nil { - return nil, err - } - return &DownloadResponse{ - b: b, - r: dr, - ctx: ctx, - getInfo: HTTPGetterInfo{Offset: offset, Count: count, ETag: dr.ETag()}, - }, err -} - -// DeleteBlob marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. -// Note that deleting a blob also deletes all its snapshots. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob. -func (b BlobURL) Delete(ctx context.Context, deleteOptions DeleteSnapshotsOptionType, ac BlobAccessConditions) (*BlobDeleteResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return b.blobClient.Delete(ctx, nil, nil, ac.LeaseAccessConditions.pointers(), deleteOptions, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/undelete-blob. -func (b BlobURL) Undelete(ctx context.Context) (*BlobUndeleteResponse, error) { - return b.blobClient.Undelete(ctx, nil, nil) -} - -// SetTier operation sets the tier on a blob. The operation is allowed on a page -// blob in a premium storage account and on a block blob in a blob storage account (locally -// redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and -// bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation -// does not update the blob's ETag. -// For detailed information about block blob level tiering see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers. -func (b BlobURL) SetTier(ctx context.Context, tier AccessTierType, lac LeaseAccessConditions) (*BlobSetTierResponse, error) { - return b.blobClient.SetTier(ctx, tier, nil, RehydratePriorityNone, nil, lac.pointers()) -} - -// GetBlobProperties returns the blob's properties. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties. -func (b BlobURL) GetProperties(ctx context.Context, ac BlobAccessConditions) (*BlobGetPropertiesResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return b.blobClient.GetProperties(ctx, nil, nil, ac.LeaseAccessConditions.pointers(), - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// SetBlobHTTPHeaders changes a blob's HTTP headers. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties. -func (b BlobURL) SetHTTPHeaders(ctx context.Context, h BlobHTTPHeaders, ac BlobAccessConditions) (*BlobSetHTTPHeadersResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return b.blobClient.SetHTTPHeaders(ctx, nil, - &h.CacheControl, &h.ContentType, h.ContentMD5, &h.ContentEncoding, &h.ContentLanguage, - ac.LeaseAccessConditions.pointers(), ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, - &h.ContentDisposition, nil) -} - -// SetBlobMetadata changes a blob's metadata. -// https://docs.microsoft.com/rest/api/storageservices/set-blob-metadata. -func (b BlobURL) SetMetadata(ctx context.Context, metadata Metadata, ac BlobAccessConditions) (*BlobSetMetadataResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return b.blobClient.SetMetadata(ctx, nil, metadata, ac.LeaseAccessConditions.pointers(), - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// CreateSnapshot creates a read-only snapshot of a blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/snapshot-blob. -func (b BlobURL) CreateSnapshot(ctx context.Context, metadata Metadata, ac BlobAccessConditions) (*BlobCreateSnapshotResponse, error) { - // CreateSnapshot does NOT panic if the user tries to create a snapshot using a URL that already has a snapshot query parameter - // because checking this would be a performance hit for a VERY unusual path and I don't think the common case should suffer this - // performance hit. - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return b.blobClient.CreateSnapshot(ctx, nil, metadata, - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, ac.LeaseAccessConditions.pointers(), nil) -} - -// AcquireLease acquires a lease on the blob for write and delete operations. The lease duration must be between -// 15 to 60 seconds, or infinite (-1). -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob. -func (b BlobURL) AcquireLease(ctx context.Context, proposedID string, duration int32, ac ModifiedAccessConditions) (*BlobAcquireLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.pointers() - return b.blobClient.AcquireLease(ctx, nil, &duration, &proposedID, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// RenewLease renews the blob's previously-acquired lease. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob. -func (b BlobURL) RenewLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*BlobRenewLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.pointers() - return b.blobClient.RenewLease(ctx, leaseID, nil, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// ReleaseLease releases the blob's previously-acquired lease. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob. -func (b BlobURL) ReleaseLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*BlobReleaseLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.pointers() - return b.blobClient.ReleaseLease(ctx, leaseID, nil, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) -// constant to break a fixed-duration lease when it expires or an infinite lease immediately. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob. -func (b BlobURL) BreakLease(ctx context.Context, breakPeriodInSeconds int32, ac ModifiedAccessConditions) (*BlobBreakLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.pointers() - return b.blobClient.BreakLease(ctx, nil, leasePeriodPointer(breakPeriodInSeconds), - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// ChangeLease changes the blob's lease ID. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob. -func (b BlobURL) ChangeLease(ctx context.Context, leaseID string, proposedID string, ac ModifiedAccessConditions) (*BlobChangeLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.pointers() - return b.blobClient.ChangeLease(ctx, leaseID, proposedID, - nil, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// LeaseBreakNaturally tells ContainerURL's or BlobURL's BreakLease method to break the lease using service semantics. -const LeaseBreakNaturally = -1 - -func leasePeriodPointer(period int32) (p *int32) { - if period != LeaseBreakNaturally { - p = &period - } - return nil -} - -// StartCopyFromURL copies the data at the source URL to a blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/copy-blob. -func (b BlobURL) StartCopyFromURL(ctx context.Context, source url.URL, metadata Metadata, srcac ModifiedAccessConditions, dstac BlobAccessConditions) (*BlobStartCopyFromURLResponse, error) { - srcIfModifiedSince, srcIfUnmodifiedSince, srcIfMatchETag, srcIfNoneMatchETag := srcac.pointers() - dstIfModifiedSince, dstIfUnmodifiedSince, dstIfMatchETag, dstIfNoneMatchETag := dstac.ModifiedAccessConditions.pointers() - dstLeaseID := dstac.LeaseAccessConditions.pointers() - - return b.blobClient.StartCopyFromURL(ctx, source.String(), nil, metadata, - AccessTierNone, RehydratePriorityNone, srcIfModifiedSince, srcIfUnmodifiedSince, - srcIfMatchETag, srcIfNoneMatchETag, - dstIfModifiedSince, dstIfUnmodifiedSince, - dstIfMatchETag, dstIfNoneMatchETag, - dstLeaseID, nil) -} - -// AbortCopyFromURL stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/abort-copy-blob. -func (b BlobURL) AbortCopyFromURL(ctx context.Context, copyID string, ac LeaseAccessConditions) (*BlobAbortCopyFromURLResponse, error) { - return b.blobClient.AbortCopyFromURL(ctx, copyID, nil, ac.pointers(), nil) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_block_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_block_blob.go deleted file mode 100644 index 6fd35e2d2..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_block_blob.go +++ /dev/null @@ -1,134 +0,0 @@ -package azblob - -import ( - "context" - "io" - "net/url" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -const ( - // BlockBlobMaxUploadBlobBytes indicates the maximum number of bytes that can be sent in a call to Upload. - BlockBlobMaxUploadBlobBytes = 256 * 1024 * 1024 // 256MB - - // BlockBlobMaxStageBlockBytes indicates the maximum number of bytes that can be sent in a call to StageBlock. - BlockBlobMaxStageBlockBytes = 100 * 1024 * 1024 // 100MB - - // BlockBlobMaxBlocks indicates the maximum number of blocks allowed in a block blob. - BlockBlobMaxBlocks = 50000 -) - -// BlockBlobURL defines a set of operations applicable to block blobs. -type BlockBlobURL struct { - BlobURL - bbClient blockBlobClient -} - -// NewBlockBlobURL creates a BlockBlobURL object using the specified URL and request policy pipeline. -func NewBlockBlobURL(url url.URL, p pipeline.Pipeline) BlockBlobURL { - blobClient := newBlobClient(url, p) - bbClient := newBlockBlobClient(url, p) - return BlockBlobURL{BlobURL: BlobURL{blobClient: blobClient}, bbClient: bbClient} -} - -// WithPipeline creates a new BlockBlobURL object identical to the source but with the specific request policy pipeline. -func (bb BlockBlobURL) WithPipeline(p pipeline.Pipeline) BlockBlobURL { - return NewBlockBlobURL(bb.blobClient.URL(), p) -} - -// WithSnapshot creates a new BlockBlobURL object identical to the source but with the specified snapshot timestamp. -// Pass "" to remove the snapshot returning a URL to the base blob. -func (bb BlockBlobURL) WithSnapshot(snapshot string) BlockBlobURL { - p := NewBlobURLParts(bb.URL()) - p.Snapshot = snapshot - return NewBlockBlobURL(p.URL(), bb.blobClient.Pipeline()) -} - -func (bb BlockBlobURL) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error) { - return bb.blobClient.GetAccountInfo(ctx) -} - -// Upload creates a new block blob or overwrites an existing block blob. -// Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not -// supported with Upload; the content of the existing blob is overwritten with the new content. To -// perform a partial update of a block blob, use StageBlock and CommitBlockList. -// This method panics if the stream is not at position 0. -// Note that the http client closes the body stream after the request is sent to the service. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob. -func (bb BlockBlobURL) Upload(ctx context.Context, body io.ReadSeeker, h BlobHTTPHeaders, metadata Metadata, ac BlobAccessConditions) (*BlockBlobUploadResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - count, err := validateSeekableStreamAt0AndGetCount(body) - if err != nil { - return nil, err - } - return bb.bbClient.Upload(ctx, body, count, nil, nil, - &h.ContentType, &h.ContentEncoding, &h.ContentLanguage, h.ContentMD5, - &h.CacheControl, metadata, ac.LeaseAccessConditions.pointers(), &h.ContentDisposition, - nil, nil, EncryptionAlgorithmNone, // CPK - AccessTierNone, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, - nil) -} - -// StageBlock uploads the specified block to the block blob's "staging area" to be later committed by a call to CommitBlockList. -// Note that the http client closes the body stream after the request is sent to the service. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block. -func (bb BlockBlobURL) StageBlock(ctx context.Context, base64BlockID string, body io.ReadSeeker, ac LeaseAccessConditions, transactionalMD5 []byte) (*BlockBlobStageBlockResponse, error) { - count, err := validateSeekableStreamAt0AndGetCount(body) - if err != nil { - return nil, err - } - return bb.bbClient.StageBlock(ctx, base64BlockID, count, body, transactionalMD5, nil, nil, ac.pointers(), - nil, nil, EncryptionAlgorithmNone, // CPK - nil) -} - -// StageBlockFromURL copies the specified block from a source URL to the block blob's "staging area" to be later committed by a call to CommitBlockList. -// If count is CountToEnd (0), then data is read from specified offset to the end. -// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url. -func (bb BlockBlobURL) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL url.URL, offset int64, count int64, destinationAccessConditions LeaseAccessConditions, sourceAccessConditions ModifiedAccessConditions) (*BlockBlobStageBlockFromURLResponse, error) { - sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag := sourceAccessConditions.pointers() - return bb.bbClient.StageBlockFromURL(ctx, base64BlockID, 0, sourceURL.String(), httpRange{offset: offset, count: count}.pointers(), nil, nil, nil, - nil, nil, EncryptionAlgorithmNone, // CPK - destinationAccessConditions.pointers(), sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil) -} - -// CommitBlockList writes a blob by specifying the list of block IDs that make up the blob. -// In order to be written as part of a blob, a block must have been successfully written -// to the server in a prior PutBlock operation. You can call PutBlockList to update a blob -// by uploading only those blocks that have changed, then committing the new and existing -// blocks together. Any blocks not specified in the block list and permanently deleted. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block-list. -func (bb BlockBlobURL) CommitBlockList(ctx context.Context, base64BlockIDs []string, h BlobHTTPHeaders, - metadata Metadata, ac BlobAccessConditions) (*BlockBlobCommitBlockListResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return bb.bbClient.CommitBlockList(ctx, BlockLookupList{Latest: base64BlockIDs}, nil, - &h.CacheControl, &h.ContentType, &h.ContentEncoding, &h.ContentLanguage, h.ContentMD5, nil, nil, - metadata, ac.LeaseAccessConditions.pointers(), &h.ContentDisposition, - nil, nil, EncryptionAlgorithmNone, // CPK - AccessTierNone, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// GetBlockList returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-block-list. -func (bb BlockBlobURL) GetBlockList(ctx context.Context, listType BlockListType, ac LeaseAccessConditions) (*BlockList, error) { - return bb.bbClient.GetBlockList(ctx, listType, nil, nil, ac.pointers(), nil) -} - -// CopyFromURL synchronously copies the data at the source URL to a block blob, with sizes up to 256 MB. -// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url. -func (bb BlockBlobURL) CopyFromURL(ctx context.Context, source url.URL, metadata Metadata, - srcac ModifiedAccessConditions, dstac BlobAccessConditions, srcContentMD5 []byte) (*BlobCopyFromURLResponse, error) { - - srcIfModifiedSince, srcIfUnmodifiedSince, srcIfMatchETag, srcIfNoneMatchETag := srcac.pointers() - dstIfModifiedSince, dstIfUnmodifiedSince, dstIfMatchETag, dstIfNoneMatchETag := dstac.ModifiedAccessConditions.pointers() - dstLeaseID := dstac.LeaseAccessConditions.pointers() - - return bb.blobClient.CopyFromURL(ctx, source.String(), nil, metadata, AccessTierNone, - srcIfModifiedSince, srcIfUnmodifiedSince, - srcIfMatchETag, srcIfNoneMatchETag, - dstIfModifiedSince, dstIfUnmodifiedSince, - dstIfMatchETag, dstIfNoneMatchETag, - dstLeaseID, nil, srcContentMD5) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_container.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_container.go deleted file mode 100644 index 801239d8a..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_container.go +++ /dev/null @@ -1,299 +0,0 @@ -package azblob - -import ( - "bytes" - "context" - "errors" - "fmt" - "net/url" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// A ContainerURL represents a URL to the Azure Storage container allowing you to manipulate its blobs. -type ContainerURL struct { - client containerClient -} - -// NewContainerURL creates a ContainerURL object using the specified URL and request policy pipeline. -func NewContainerURL(url url.URL, p pipeline.Pipeline) ContainerURL { - client := newContainerClient(url, p) - return ContainerURL{client: client} -} - -// URL returns the URL endpoint used by the ContainerURL object. -func (c ContainerURL) URL() url.URL { - return c.client.URL() -} - -// String returns the URL as a string. -func (c ContainerURL) String() string { - u := c.URL() - return u.String() -} - -func (c ContainerURL) GetAccountInfo(ctx context.Context) (*ContainerGetAccountInfoResponse, error) { - return c.client.GetAccountInfo(ctx) -} - -// WithPipeline creates a new ContainerURL object identical to the source but with the specified request policy pipeline. -func (c ContainerURL) WithPipeline(p pipeline.Pipeline) ContainerURL { - return NewContainerURL(c.URL(), p) -} - -// NewBlobURL creates a new BlobURL object by concatenating blobName to the end of -// ContainerURL's URL. The new BlobURL uses the same request policy pipeline as the ContainerURL. -// To change the pipeline, create the BlobURL and then call its WithPipeline method passing in the -// desired pipeline object. Or, call this package's NewBlobURL instead of calling this object's -// NewBlobURL method. -func (c ContainerURL) NewBlobURL(blobName string) BlobURL { - blobURL := appendToURLPath(c.URL(), blobName) - return NewBlobURL(blobURL, c.client.Pipeline()) -} - -// NewAppendBlobURL creates a new AppendBlobURL object by concatenating blobName to the end of -// ContainerURL's URL. The new AppendBlobURL uses the same request policy pipeline as the ContainerURL. -// To change the pipeline, create the AppendBlobURL and then call its WithPipeline method passing in the -// desired pipeline object. Or, call this package's NewAppendBlobURL instead of calling this object's -// NewAppendBlobURL method. -func (c ContainerURL) NewAppendBlobURL(blobName string) AppendBlobURL { - blobURL := appendToURLPath(c.URL(), blobName) - return NewAppendBlobURL(blobURL, c.client.Pipeline()) -} - -// NewBlockBlobURL creates a new BlockBlobURL object by concatenating blobName to the end of -// ContainerURL's URL. The new BlockBlobURL uses the same request policy pipeline as the ContainerURL. -// To change the pipeline, create the BlockBlobURL and then call its WithPipeline method passing in the -// desired pipeline object. Or, call this package's NewBlockBlobURL instead of calling this object's -// NewBlockBlobURL method. -func (c ContainerURL) NewBlockBlobURL(blobName string) BlockBlobURL { - blobURL := appendToURLPath(c.URL(), blobName) - return NewBlockBlobURL(blobURL, c.client.Pipeline()) -} - -// NewPageBlobURL creates a new PageBlobURL object by concatenating blobName to the end of -// ContainerURL's URL. The new PageBlobURL uses the same request policy pipeline as the ContainerURL. -// To change the pipeline, create the PageBlobURL and then call its WithPipeline method passing in the -// desired pipeline object. Or, call this package's NewPageBlobURL instead of calling this object's -// NewPageBlobURL method. -func (c ContainerURL) NewPageBlobURL(blobName string) PageBlobURL { - blobURL := appendToURLPath(c.URL(), blobName) - return NewPageBlobURL(blobURL, c.client.Pipeline()) -} - -// Create creates a new container within a storage account. If a container with the same name already exists, the operation fails. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/create-container. -func (c ContainerURL) Create(ctx context.Context, metadata Metadata, publicAccessType PublicAccessType) (*ContainerCreateResponse, error) { - return c.client.Create(ctx, nil, metadata, publicAccessType, nil) -} - -// Delete marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-container. -func (c ContainerURL) Delete(ctx context.Context, ac ContainerAccessConditions) (*ContainerDeleteResponse, error) { - if ac.IfMatch != ETagNone || ac.IfNoneMatch != ETagNone { - return nil, errors.New("the IfMatch and IfNoneMatch access conditions must have their default values because they are ignored by the service") - } - - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.ModifiedAccessConditions.pointers() - return c.client.Delete(ctx, nil, ac.LeaseAccessConditions.pointers(), - ifModifiedSince, ifUnmodifiedSince, nil) -} - -// GetProperties returns the container's properties. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-metadata. -func (c ContainerURL) GetProperties(ctx context.Context, ac LeaseAccessConditions) (*ContainerGetPropertiesResponse, error) { - // NOTE: GetMetadata actually calls GetProperties internally because GetProperties returns the metadata AND the properties. - // This allows us to not expose a GetProperties method at all simplifying the API. - return c.client.GetProperties(ctx, nil, ac.pointers(), nil) -} - -// SetMetadata sets the container's metadata. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-metadata. -func (c ContainerURL) SetMetadata(ctx context.Context, metadata Metadata, ac ContainerAccessConditions) (*ContainerSetMetadataResponse, error) { - if !ac.IfUnmodifiedSince.IsZero() || ac.IfMatch != ETagNone || ac.IfNoneMatch != ETagNone { - return nil, errors.New("the IfUnmodifiedSince, IfMatch, and IfNoneMatch must have their default values because they are ignored by the blob service") - } - ifModifiedSince, _, _, _ := ac.ModifiedAccessConditions.pointers() - return c.client.SetMetadata(ctx, nil, ac.LeaseAccessConditions.pointers(), metadata, ifModifiedSince, nil) -} - -// GetAccessPolicy returns the container's access policy. The access policy indicates whether container's blobs may be accessed publicly. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-acl. -func (c ContainerURL) GetAccessPolicy(ctx context.Context, ac LeaseAccessConditions) (*SignedIdentifiers, error) { - return c.client.GetAccessPolicy(ctx, nil, ac.pointers(), nil) -} - -// The AccessPolicyPermission type simplifies creating the permissions string for a container's access policy. -// Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field. -type AccessPolicyPermission struct { - Read, Add, Create, Write, Delete, List bool -} - -// String produces the access policy permission string for an Azure Storage container. -// Call this method to set AccessPolicy's Permission field. -func (p AccessPolicyPermission) String() string { - var b bytes.Buffer - if p.Read { - b.WriteRune('r') - } - if p.Add { - b.WriteRune('a') - } - if p.Create { - b.WriteRune('c') - } - if p.Write { - b.WriteRune('w') - } - if p.Delete { - b.WriteRune('d') - } - if p.List { - b.WriteRune('l') - } - return b.String() -} - -// Parse initializes the AccessPolicyPermission's fields from a string. -func (p *AccessPolicyPermission) Parse(s string) error { - *p = AccessPolicyPermission{} // Clear the flags - for _, r := range s { - switch r { - case 'r': - p.Read = true - case 'a': - p.Add = true - case 'c': - p.Create = true - case 'w': - p.Write = true - case 'd': - p.Delete = true - case 'l': - p.List = true - default: - return fmt.Errorf("invalid permission: '%v'", r) - } - } - return nil -} - -// SetAccessPolicy sets the container's permissions. The access policy indicates whether blobs in a container may be accessed publicly. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-acl. -func (c ContainerURL) SetAccessPolicy(ctx context.Context, accessType PublicAccessType, si []SignedIdentifier, - ac ContainerAccessConditions) (*ContainerSetAccessPolicyResponse, error) { - if ac.IfMatch != ETagNone || ac.IfNoneMatch != ETagNone { - return nil, errors.New("the IfMatch and IfNoneMatch access conditions must have their default values because they are ignored by the service") - } - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.ModifiedAccessConditions.pointers() - return c.client.SetAccessPolicy(ctx, si, nil, ac.LeaseAccessConditions.pointers(), - accessType, ifModifiedSince, ifUnmodifiedSince, nil) -} - -// AcquireLease acquires a lease on the container for delete operations. The lease duration must be between 15 to 60 seconds, or infinite (-1). -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container. -func (c ContainerURL) AcquireLease(ctx context.Context, proposedID string, duration int32, ac ModifiedAccessConditions) (*ContainerAcquireLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.pointers() - return c.client.AcquireLease(ctx, nil, &duration, &proposedID, - ifModifiedSince, ifUnmodifiedSince, nil) -} - -// RenewLease renews the container's previously-acquired lease. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container. -func (c ContainerURL) RenewLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*ContainerRenewLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.pointers() - return c.client.RenewLease(ctx, leaseID, nil, ifModifiedSince, ifUnmodifiedSince, nil) -} - -// ReleaseLease releases the container's previously-acquired lease. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container. -func (c ContainerURL) ReleaseLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*ContainerReleaseLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.pointers() - return c.client.ReleaseLease(ctx, leaseID, nil, ifModifiedSince, ifUnmodifiedSince, nil) -} - -// BreakLease breaks the container's previously-acquired lease (if it exists). -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container. -func (c ContainerURL) BreakLease(ctx context.Context, period int32, ac ModifiedAccessConditions) (*ContainerBreakLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.pointers() - return c.client.BreakLease(ctx, nil, leasePeriodPointer(period), ifModifiedSince, ifUnmodifiedSince, nil) -} - -// ChangeLease changes the container's lease ID. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container. -func (c ContainerURL) ChangeLease(ctx context.Context, leaseID string, proposedID string, ac ModifiedAccessConditions) (*ContainerChangeLeaseResponse, error) { - ifModifiedSince, ifUnmodifiedSince, _, _ := ac.pointers() - return c.client.ChangeLease(ctx, leaseID, proposedID, nil, ifModifiedSince, ifUnmodifiedSince, nil) -} - -// ListBlobsFlatSegment returns a single segment of blobs starting from the specified Marker. Use an empty -// Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. -// After getting a segment, process it, and then call ListBlobsFlatSegment again (passing the the -// previously-returned Marker) to get the next segment. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs. -func (c ContainerURL) ListBlobsFlatSegment(ctx context.Context, marker Marker, o ListBlobsSegmentOptions) (*ListBlobsFlatSegmentResponse, error) { - prefix, include, maxResults := o.pointers() - return c.client.ListBlobFlatSegment(ctx, prefix, marker.Val, maxResults, include, nil, nil) -} - -// ListBlobsHierarchySegment returns a single segment of blobs starting from the specified Marker. Use an empty -// Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. -// After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the the -// previously-returned Marker) to get the next segment. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs. -func (c ContainerURL) ListBlobsHierarchySegment(ctx context.Context, marker Marker, delimiter string, o ListBlobsSegmentOptions) (*ListBlobsHierarchySegmentResponse, error) { - if o.Details.Snapshots { - return nil, errors.New("snapshots are not supported in this listing operation") - } - prefix, include, maxResults := o.pointers() - return c.client.ListBlobHierarchySegment(ctx, delimiter, prefix, marker.Val, maxResults, include, nil, nil) -} - -// ListBlobsSegmentOptions defines options available when calling ListBlobs. -type ListBlobsSegmentOptions struct { - Details BlobListingDetails // No IncludeType header is produced if "" - Prefix string // No Prefix header is produced if "" - - // SetMaxResults sets the maximum desired results you want the service to return. Note, the - // service may return fewer results than requested. - // MaxResults=0 means no 'MaxResults' header specified. - MaxResults int32 -} - -func (o *ListBlobsSegmentOptions) pointers() (prefix *string, include []ListBlobsIncludeItemType, maxResults *int32) { - if o.Prefix != "" { - prefix = &o.Prefix - } - include = o.Details.slice() - if o.MaxResults != 0 { - maxResults = &o.MaxResults - } - return -} - -// BlobListingDetails indicates what additional information the service should return with each blob. -type BlobListingDetails struct { - Copy, Metadata, Snapshots, UncommittedBlobs, Deleted bool -} - -// string produces the Include query parameter's value. -func (d *BlobListingDetails) slice() []ListBlobsIncludeItemType { - items := []ListBlobsIncludeItemType{} - // NOTE: Multiple strings MUST be appended in alphabetic order or signing the string for authentication fails! - if d.Copy { - items = append(items, ListBlobsIncludeItemCopy) - } - if d.Deleted { - items = append(items, ListBlobsIncludeItemDeleted) - } - if d.Metadata { - items = append(items, ListBlobsIncludeItemMetadata) - } - if d.Snapshots { - items = append(items, ListBlobsIncludeItemSnapshots) - } - if d.UncommittedBlobs { - items = append(items, ListBlobsIncludeItemUncommittedblobs) - } - return items -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_page_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_page_blob.go deleted file mode 100644 index 76fac2aa8..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_page_blob.go +++ /dev/null @@ -1,233 +0,0 @@ -package azblob - -import ( - "context" - "fmt" - "io" - "net/url" - "strconv" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -const ( - // PageBlobPageBytes indicates the number of bytes in a page (512). - PageBlobPageBytes = 512 - - // PageBlobMaxPutPagesBytes indicates the maximum number of bytes that can be sent in a call to PutPage. - PageBlobMaxUploadPagesBytes = 4 * 1024 * 1024 // 4MB -) - -// PageBlobURL defines a set of operations applicable to page blobs. -type PageBlobURL struct { - BlobURL - pbClient pageBlobClient -} - -// NewPageBlobURL creates a PageBlobURL object using the specified URL and request policy pipeline. -func NewPageBlobURL(url url.URL, p pipeline.Pipeline) PageBlobURL { - blobClient := newBlobClient(url, p) - pbClient := newPageBlobClient(url, p) - return PageBlobURL{BlobURL: BlobURL{blobClient: blobClient}, pbClient: pbClient} -} - -// WithPipeline creates a new PageBlobURL object identical to the source but with the specific request policy pipeline. -func (pb PageBlobURL) WithPipeline(p pipeline.Pipeline) PageBlobURL { - return NewPageBlobURL(pb.blobClient.URL(), p) -} - -// WithSnapshot creates a new PageBlobURL object identical to the source but with the specified snapshot timestamp. -// Pass "" to remove the snapshot returning a URL to the base blob. -func (pb PageBlobURL) WithSnapshot(snapshot string) PageBlobURL { - p := NewBlobURLParts(pb.URL()) - p.Snapshot = snapshot - return NewPageBlobURL(p.URL(), pb.blobClient.Pipeline()) -} - -func (pb PageBlobURL) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error) { - return pb.blobClient.GetAccountInfo(ctx) -} - -// Create creates a page blob of the specified length. Call PutPage to upload data data to a page blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob. -func (pb PageBlobURL) Create(ctx context.Context, size int64, sequenceNumber int64, h BlobHTTPHeaders, metadata Metadata, ac BlobAccessConditions) (*PageBlobCreateResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return pb.pbClient.Create(ctx, 0, size, nil, PremiumPageBlobAccessTierNone, - &h.ContentType, &h.ContentEncoding, &h.ContentLanguage, h.ContentMD5, &h.CacheControl, - metadata, ac.LeaseAccessConditions.pointers(), &h.ContentDisposition, - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, &sequenceNumber, nil) -} - -// UploadPages writes 1 or more pages to the page blob. The start offset and the stream size must be a multiple of 512 bytes. -// This method panics if the stream is not at position 0. -// Note that the http client closes the body stream after the request is sent to the service. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page. -func (pb PageBlobURL) UploadPages(ctx context.Context, offset int64, body io.ReadSeeker, ac PageBlobAccessConditions, transactionalMD5 []byte) (*PageBlobUploadPagesResponse, error) { - count, err := validateSeekableStreamAt0AndGetCount(body) - if err != nil { - return nil, err - } - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual := ac.SequenceNumberAccessConditions.pointers() - return pb.pbClient.UploadPages(ctx, body, count, transactionalMD5, nil, nil, - PageRange{Start: offset, End: offset + count - 1}.pointers(), - ac.LeaseAccessConditions.pointers(), - nil, nil, EncryptionAlgorithmNone, // CPK - ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// UploadPagesFromURL copies 1 or more pages from a source URL to the page blob. -// The sourceOffset specifies the start offset of source data to copy from. -// The destOffset specifies the start offset of data in page blob will be written to. -// The count must be a multiple of 512 bytes. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page-from-url. -func (pb PageBlobURL) UploadPagesFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, count int64, transactionalMD5 []byte, destinationAccessConditions PageBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions) (*PageBlobUploadPagesFromURLResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := destinationAccessConditions.ModifiedAccessConditions.pointers() - sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag := sourceAccessConditions.pointers() - ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual := destinationAccessConditions.SequenceNumberAccessConditions.pointers() - return pb.pbClient.UploadPagesFromURL(ctx, sourceURL.String(), *PageRange{Start: sourceOffset, End: sourceOffset + count - 1}.pointers(), 0, - *PageRange{Start: destOffset, End: destOffset + count - 1}.pointers(), transactionalMD5, nil, nil, - nil, nil, EncryptionAlgorithmNone, // CPK - destinationAccessConditions.LeaseAccessConditions.pointers(), - ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatchETag, sourceIfNoneMatchETag, nil) -} - -// ClearPages frees the specified pages from the page blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page. -func (pb PageBlobURL) ClearPages(ctx context.Context, offset int64, count int64, ac PageBlobAccessConditions) (*PageBlobClearPagesResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, ifSequenceNumberEqual := ac.SequenceNumberAccessConditions.pointers() - return pb.pbClient.ClearPages(ctx, 0, nil, - PageRange{Start: offset, End: offset + count - 1}.pointers(), - ac.LeaseAccessConditions.pointers(), - nil, nil, EncryptionAlgorithmNone, // CPK - ifSequenceNumberLessThanOrEqual, ifSequenceNumberLessThan, - ifSequenceNumberEqual, ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// GetPageRanges returns the list of valid page ranges for a page blob or snapshot of a page blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges. -func (pb PageBlobURL) GetPageRanges(ctx context.Context, offset int64, count int64, ac BlobAccessConditions) (*PageList, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return pb.pbClient.GetPageRanges(ctx, nil, nil, - httpRange{offset: offset, count: count}.pointers(), - ac.LeaseAccessConditions.pointers(), - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// GetPageRangesDiff gets the collection of page ranges that differ between a specified snapshot and this page blob. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges. -func (pb PageBlobURL) GetPageRangesDiff(ctx context.Context, offset int64, count int64, prevSnapshot string, ac BlobAccessConditions) (*PageList, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return pb.pbClient.GetPageRangesDiff(ctx, nil, nil, &prevSnapshot, - httpRange{offset: offset, count: count}.pointers(), - ac.LeaseAccessConditions.pointers(), - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, - nil) -} - -// Resize resizes the page blob to the specified size (which must be a multiple of 512). -// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties. -func (pb PageBlobURL) Resize(ctx context.Context, size int64, ac BlobAccessConditions) (*PageBlobResizeResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - return pb.pbClient.Resize(ctx, size, nil, ac.LeaseAccessConditions.pointers(), - nil, nil, EncryptionAlgorithmNone, // CPK - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -// SetSequenceNumber sets the page blob's sequence number. -func (pb PageBlobURL) UpdateSequenceNumber(ctx context.Context, action SequenceNumberActionType, sequenceNumber int64, - ac BlobAccessConditions) (*PageBlobUpdateSequenceNumberResponse, error) { - sn := &sequenceNumber - if action == SequenceNumberActionIncrement { - sn = nil - } - ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch := ac.ModifiedAccessConditions.pointers() - return pb.pbClient.UpdateSequenceNumber(ctx, action, nil, - ac.LeaseAccessConditions.pointers(), ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - sn, nil) -} - -// StartIncrementalCopy begins an operation to start an incremental copy from one page blob's snapshot to this page blob. -// The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. -// The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/incremental-copy-blob and -// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots. -func (pb PageBlobURL) StartCopyIncremental(ctx context.Context, source url.URL, snapshot string, ac BlobAccessConditions) (*PageBlobCopyIncrementalResponse, error) { - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers() - qp := source.Query() - qp.Set("snapshot", snapshot) - source.RawQuery = qp.Encode() - return pb.pbClient.CopyIncremental(ctx, source.String(), nil, - ifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil) -} - -func (pr PageRange) pointers() *string { - endOffset := strconv.FormatInt(int64(pr.End), 10) - asString := fmt.Sprintf("bytes=%v-%s", pr.Start, endOffset) - return &asString -} - -type PageBlobAccessConditions struct { - ModifiedAccessConditions - LeaseAccessConditions - SequenceNumberAccessConditions -} - -// SequenceNumberAccessConditions identifies page blob-specific access conditions which you optionally set. -type SequenceNumberAccessConditions struct { - // IfSequenceNumberLessThan ensures that the page blob operation succeeds - // only if the blob's sequence number is less than a value. - // IfSequenceNumberLessThan=0 means no 'IfSequenceNumberLessThan' header specified. - // IfSequenceNumberLessThan>0 means 'IfSequenceNumberLessThan' header specified with its value - // IfSequenceNumberLessThan==-1 means 'IfSequenceNumberLessThan' header specified with a value of 0 - IfSequenceNumberLessThan int64 - - // IfSequenceNumberLessThanOrEqual ensures that the page blob operation succeeds - // only if the blob's sequence number is less than or equal to a value. - // IfSequenceNumberLessThanOrEqual=0 means no 'IfSequenceNumberLessThanOrEqual' header specified. - // IfSequenceNumberLessThanOrEqual>0 means 'IfSequenceNumberLessThanOrEqual' header specified with its value - // IfSequenceNumberLessThanOrEqual=-1 means 'IfSequenceNumberLessThanOrEqual' header specified with a value of 0 - IfSequenceNumberLessThanOrEqual int64 - - // IfSequenceNumberEqual ensures that the page blob operation succeeds - // only if the blob's sequence number is equal to a value. - // IfSequenceNumberEqual=0 means no 'IfSequenceNumberEqual' header specified. - // IfSequenceNumberEqual>0 means 'IfSequenceNumberEqual' header specified with its value - // IfSequenceNumberEqual=-1 means 'IfSequenceNumberEqual' header specified with a value of 0 - IfSequenceNumberEqual int64 -} - -// pointers is for internal infrastructure. It returns the fields as pointers. -func (ac SequenceNumberAccessConditions) pointers() (snltoe *int64, snlt *int64, sne *int64) { - var zero int64 // Defaults to 0 - switch ac.IfSequenceNumberLessThan { - case -1: - snlt = &zero - case 0: - snlt = nil - default: - snlt = &ac.IfSequenceNumberLessThan - } - - switch ac.IfSequenceNumberLessThanOrEqual { - case -1: - snltoe = &zero - case 0: - snltoe = nil - default: - snltoe = &ac.IfSequenceNumberLessThanOrEqual - } - switch ac.IfSequenceNumberEqual { - case -1: - sne = &zero - case 0: - sne = nil - default: - sne = &ac.IfSequenceNumberEqual - } - return -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_service.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_service.go deleted file mode 100644 index 5d7481ad3..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/url_service.go +++ /dev/null @@ -1,159 +0,0 @@ -package azblob - -import ( - "context" - "net/url" - "strings" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -const ( - // ContainerNameRoot is the special Azure Storage name used to identify a storage account's root container. - ContainerNameRoot = "$root" - - // ContainerNameLogs is the special Azure Storage name used to identify a storage account's logs container. - ContainerNameLogs = "$logs" -) - -// A ServiceURL represents a URL to the Azure Storage Blob service allowing you to manipulate blob containers. -type ServiceURL struct { - client serviceClient -} - -// NewServiceURL creates a ServiceURL object using the specified URL and request policy pipeline. -func NewServiceURL(primaryURL url.URL, p pipeline.Pipeline) ServiceURL { - client := newServiceClient(primaryURL, p) - return ServiceURL{client: client} -} - -//GetUserDelegationCredential obtains a UserDelegationKey object using the base ServiceURL object. -//OAuth is required for this call, as well as any role that can delegate access to the storage account. -func (s ServiceURL) GetUserDelegationCredential(ctx context.Context, info KeyInfo, timeout *int32, requestID *string) (UserDelegationCredential, error) { - sc := newServiceClient(s.client.url, s.client.p) - udk, err := sc.GetUserDelegationKey(ctx, info, timeout, requestID) - if err != nil { - return UserDelegationCredential{}, err - } - return NewUserDelegationCredential(strings.Split(s.client.url.Host, ".")[0], *udk), nil -} - -//TODO this was supposed to be generated -//NewKeyInfo creates a new KeyInfo struct with the correct time formatting & conversion -func NewKeyInfo(Start, Expiry time.Time) KeyInfo { - return KeyInfo{ - Start: Start.UTC().Format(SASTimeFormat), - Expiry: Expiry.UTC().Format(SASTimeFormat), - } -} - -func (s ServiceURL) GetAccountInfo(ctx context.Context) (*ServiceGetAccountInfoResponse, error) { - return s.client.GetAccountInfo(ctx) -} - -// URL returns the URL endpoint used by the ServiceURL object. -func (s ServiceURL) URL() url.URL { - return s.client.URL() -} - -// String returns the URL as a string. -func (s ServiceURL) String() string { - u := s.URL() - return u.String() -} - -// WithPipeline creates a new ServiceURL object identical to the source but with the specified request policy pipeline. -func (s ServiceURL) WithPipeline(p pipeline.Pipeline) ServiceURL { - return NewServiceURL(s.URL(), p) -} - -// NewContainerURL creates a new ContainerURL object by concatenating containerName to the end of -// ServiceURL's URL. The new ContainerURL uses the same request policy pipeline as the ServiceURL. -// To change the pipeline, create the ContainerURL and then call its WithPipeline method passing in the -// desired pipeline object. Or, call this package's NewContainerURL instead of calling this object's -// NewContainerURL method. -func (s ServiceURL) NewContainerURL(containerName string) ContainerURL { - containerURL := appendToURLPath(s.URL(), containerName) - return NewContainerURL(containerURL, s.client.Pipeline()) -} - -// appendToURLPath appends a string to the end of a URL's path (prefixing the string with a '/' if required) -func appendToURLPath(u url.URL, name string) url.URL { - // e.g. "https://ms.com/a/b/?k1=v1&k2=v2#f" - // When you call url.Parse() this is what you'll get: - // Scheme: "https" - // Opaque: "" - // User: nil - // Host: "ms.com" - // Path: "/a/b/" This should start with a / and it might or might not have a trailing slash - // RawPath: "" - // ForceQuery: false - // RawQuery: "k1=v1&k2=v2" - // Fragment: "f" - if len(u.Path) == 0 || u.Path[len(u.Path)-1] != '/' { - u.Path += "/" // Append "/" to end before appending name - } - u.Path += name - return u -} - -// ListContainersFlatSegment returns a single segment of containers starting from the specified Marker. Use an empty -// Marker to start enumeration from the beginning. Container names are returned in lexicographic order. -// After getting a segment, process it, and then call ListContainersFlatSegment again (passing the the -// previously-returned Marker) to get the next segment. For more information, see -// https://docs.microsoft.com/rest/api/storageservices/list-containers2. -func (s ServiceURL) ListContainersSegment(ctx context.Context, marker Marker, o ListContainersSegmentOptions) (*ListContainersSegmentResponse, error) { - prefix, include, maxResults := o.pointers() - return s.client.ListContainersSegment(ctx, prefix, marker.Val, maxResults, include, nil, nil) -} - -// ListContainersOptions defines options available when calling ListContainers. -type ListContainersSegmentOptions struct { - Detail ListContainersDetail // No IncludeType header is produced if "" - Prefix string // No Prefix header is produced if "" - MaxResults int32 // 0 means unspecified - // TODO: update swagger to generate this type? -} - -func (o *ListContainersSegmentOptions) pointers() (prefix *string, include ListContainersIncludeType, maxResults *int32) { - if o.Prefix != "" { - prefix = &o.Prefix - } - if o.MaxResults != 0 { - maxResults = &o.MaxResults - } - include = ListContainersIncludeType(o.Detail.string()) - return -} - -// ListContainersFlatDetail indicates what additional information the service should return with each container. -type ListContainersDetail struct { - // Tells the service whether to return metadata for each container. - Metadata bool -} - -// string produces the Include query parameter's value. -func (d *ListContainersDetail) string() string { - items := make([]string, 0, 1) - // NOTE: Multiple strings MUST be appended in alphabetic order or signing the string for authentication fails! - if d.Metadata { - items = append(items, string(ListContainersIncludeMetadata)) - } - if len(items) > 0 { - return strings.Join(items, ",") - } - return string(ListContainersIncludeNone) -} - -func (bsu ServiceURL) GetProperties(ctx context.Context) (*StorageServiceProperties, error) { - return bsu.client.GetProperties(ctx, nil, nil) -} - -func (bsu ServiceURL) SetProperties(ctx context.Context, properties StorageServiceProperties) (*ServiceSetPropertiesResponse, error) { - return bsu.client.SetProperties(ctx, properties, nil, nil) -} - -func (bsu ServiceURL) GetStatistics(ctx context.Context) (*StorageServiceStats, error) { - return bsu.client.GetStatistics(ctx, nil, nil) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/user_delegation_credential.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/user_delegation_credential.go deleted file mode 100644 index 9fcbbc409..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/user_delegation_credential.go +++ /dev/null @@ -1,38 +0,0 @@ -package azblob - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/base64" -) - -// NewUserDelegationCredential creates a new UserDelegationCredential using a Storage account's name and a user delegation key from it -func NewUserDelegationCredential(accountName string, key UserDelegationKey) UserDelegationCredential { - return UserDelegationCredential{ - accountName: accountName, - accountKey: key, - } -} - -type UserDelegationCredential struct { - accountName string - accountKey UserDelegationKey -} - -// AccountName returns the Storage account's name -func (f UserDelegationCredential) AccountName() string { - return f.accountName -} - -// ComputeHMAC -func (f UserDelegationCredential) ComputeHMACSHA256(message string) (base64String string) { - bytes, _ := base64.StdEncoding.DecodeString(f.accountKey.Value) - h := hmac.New(sha256.New, bytes) - h.Write([]byte(message)) - return base64.StdEncoding.EncodeToString(h.Sum(nil)) -} - -// Private method to return important parameters for NewSASQueryParameters -func (f UserDelegationCredential) getUDKParams() *UserDelegationKey { - return &f.accountKey -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/version.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/version.go deleted file mode 100644 index 263441a52..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package azblob - -const serviceLibVersion = "0.10" diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_anonymous.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_anonymous.go deleted file mode 100644 index a81987d54..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_anonymous.go +++ /dev/null @@ -1,55 +0,0 @@ -package azblob - -import ( - "context" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// Credential represent any credential type; it is used to create a credential policy Factory. -type Credential interface { - pipeline.Factory - credentialMarker() -} - -type credentialFunc pipeline.FactoryFunc - -func (f credentialFunc) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy { - return f(next, po) -} - -// credentialMarker is a package-internal method that exists just to satisfy the Credential interface. -func (credentialFunc) credentialMarker() {} - -////////////////////////////// - -// NewAnonymousCredential creates an anonymous credential for use with HTTP(S) requests that read public resource -// or for use with Shared Access Signatures (SAS). -func NewAnonymousCredential() Credential { - return anonymousCredentialFactory -} - -var anonymousCredentialFactory Credential = &anonymousCredentialPolicyFactory{} // Singleton - -// anonymousCredentialPolicyFactory is the credential's policy factory. -type anonymousCredentialPolicyFactory struct { -} - -// New creates a credential policy object. -func (f *anonymousCredentialPolicyFactory) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy { - return &anonymousCredentialPolicy{next: next} -} - -// credentialMarker is a package-internal method that exists just to satisfy the Credential interface. -func (*anonymousCredentialPolicyFactory) credentialMarker() {} - -// anonymousCredentialPolicy is the credential's policy object. -type anonymousCredentialPolicy struct { - next pipeline.Policy -} - -// Do implements the credential's policy interface. -func (p anonymousCredentialPolicy) Do(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - // For anonymous credentials, this is effectively a no-op - return p.next.Do(ctx, request) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_shared_key.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_shared_key.go deleted file mode 100644 index 3e27552f2..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_shared_key.go +++ /dev/null @@ -1,205 +0,0 @@ -package azblob - -import ( - "bytes" - "context" - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "errors" - "net/http" - "net/url" - "sort" - "strings" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// NewSharedKeyCredential creates an immutable SharedKeyCredential containing the -// storage account's name and either its primary or secondary key. -func NewSharedKeyCredential(accountName, accountKey string) (*SharedKeyCredential, error) { - bytes, err := base64.StdEncoding.DecodeString(accountKey) - if err != nil { - return &SharedKeyCredential{}, err - } - return &SharedKeyCredential{accountName: accountName, accountKey: bytes}, nil -} - -// SharedKeyCredential contains an account's name and its primary or secondary key. -// It is immutable making it shareable and goroutine-safe. -type SharedKeyCredential struct { - // Only the NewSharedKeyCredential method should set these; all other methods should treat them as read-only - accountName string - accountKey []byte -} - -// AccountName returns the Storage account's name. -func (f SharedKeyCredential) AccountName() string { - return f.accountName -} - -func (f SharedKeyCredential) getAccountKey() []byte { - return f.accountKey -} - -// noop function to satisfy StorageAccountCredential interface -func (f SharedKeyCredential) getUDKParams() *UserDelegationKey { - return nil -} - -// New creates a credential policy object. -func (f *SharedKeyCredential) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy { - return pipeline.PolicyFunc(func(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - // Add a x-ms-date header if it doesn't already exist - if d := request.Header.Get(headerXmsDate); d == "" { - request.Header[headerXmsDate] = []string{time.Now().UTC().Format(http.TimeFormat)} - } - stringToSign, err := f.buildStringToSign(request) - if err != nil { - return nil, err - } - signature := f.ComputeHMACSHA256(stringToSign) - authHeader := strings.Join([]string{"SharedKey ", f.accountName, ":", signature}, "") - request.Header[headerAuthorization] = []string{authHeader} - - response, err := next.Do(ctx, request) - if err != nil && response != nil && response.Response() != nil && response.Response().StatusCode == http.StatusForbidden { - // Service failed to authenticate request, log it - po.Log(pipeline.LogError, "===== HTTP Forbidden status, String-to-Sign:\n"+stringToSign+"\n===============================\n") - } - return response, err - }) -} - -// credentialMarker is a package-internal method that exists just to satisfy the Credential interface. -func (*SharedKeyCredential) credentialMarker() {} - -// Constants ensuring that header names are correctly spelled and consistently cased. -const ( - headerAuthorization = "Authorization" - headerCacheControl = "Cache-Control" - headerContentEncoding = "Content-Encoding" - headerContentDisposition = "Content-Disposition" - headerContentLanguage = "Content-Language" - headerContentLength = "Content-Length" - headerContentMD5 = "Content-MD5" - headerContentType = "Content-Type" - headerDate = "Date" - headerIfMatch = "If-Match" - headerIfModifiedSince = "If-Modified-Since" - headerIfNoneMatch = "If-None-Match" - headerIfUnmodifiedSince = "If-Unmodified-Since" - headerRange = "Range" - headerUserAgent = "User-Agent" - headerXmsDate = "x-ms-date" - headerXmsVersion = "x-ms-version" -) - -// ComputeHMACSHA256 generates a hash signature for an HTTP request or for a SAS. -func (f SharedKeyCredential) ComputeHMACSHA256(message string) (base64String string) { - h := hmac.New(sha256.New, f.accountKey) - h.Write([]byte(message)) - return base64.StdEncoding.EncodeToString(h.Sum(nil)) -} - -func (f *SharedKeyCredential) buildStringToSign(request pipeline.Request) (string, error) { - // https://docs.microsoft.com/en-us/rest/api/storageservices/authentication-for-the-azure-storage-services - headers := request.Header - contentLength := headers.Get(headerContentLength) - if contentLength == "0" { - contentLength = "" - } - - canonicalizedResource, err := f.buildCanonicalizedResource(request.URL) - if err != nil { - return "", err - } - - stringToSign := strings.Join([]string{ - request.Method, - headers.Get(headerContentEncoding), - headers.Get(headerContentLanguage), - contentLength, - headers.Get(headerContentMD5), - headers.Get(headerContentType), - "", // Empty date because x-ms-date is expected (as per web page above) - headers.Get(headerIfModifiedSince), - headers.Get(headerIfMatch), - headers.Get(headerIfNoneMatch), - headers.Get(headerIfUnmodifiedSince), - headers.Get(headerRange), - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - return stringToSign, nil -} - -func buildCanonicalizedHeader(headers http.Header) string { - cm := map[string][]string{} - for k, v := range headers { - headerName := strings.TrimSpace(strings.ToLower(k)) - if strings.HasPrefix(headerName, "x-ms-") { - cm[headerName] = v // NOTE: the value must not have any whitespace around it. - } - } - if len(cm) == 0 { - return "" - } - - keys := make([]string, 0, len(cm)) - for key := range cm { - keys = append(keys, key) - } - sort.Strings(keys) - ch := bytes.NewBufferString("") - for i, key := range keys { - if i > 0 { - ch.WriteRune('\n') - } - ch.WriteString(key) - ch.WriteRune(':') - ch.WriteString(strings.Join(cm[key], ",")) - } - return string(ch.Bytes()) -} - -func (f *SharedKeyCredential) buildCanonicalizedResource(u *url.URL) (string, error) { - // https://docs.microsoft.com/en-us/rest/api/storageservices/authentication-for-the-azure-storage-services - cr := bytes.NewBufferString("/") - cr.WriteString(f.accountName) - - if len(u.Path) > 0 { - // Any portion of the CanonicalizedResource string that is derived from - // the resource's URI should be encoded exactly as it is in the URI. - // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx - cr.WriteString(u.EscapedPath()) - } else { - // a slash is required to indicate the root path - cr.WriteString("/") - } - - // params is a map[string][]string; param name is key; params values is []string - params, err := url.ParseQuery(u.RawQuery) // Returns URL decoded values - if err != nil { - return "", errors.New("parsing query parameters must succeed, otherwise there might be serious problems in the SDK/generated code") - } - - if len(params) > 0 { // There is at least 1 query parameter - paramNames := []string{} // We use this to sort the parameter key names - for paramName := range params { - paramNames = append(paramNames, paramName) // paramNames must be lowercase - } - sort.Strings(paramNames) - - for _, paramName := range paramNames { - paramValues := params[paramName] - sort.Strings(paramValues) - - // Join the sorted key values separated by ',' - // Then prepend "keyName:"; then add this string to the buffer - cr.WriteString("\n" + paramName + ":" + strings.Join(paramValues, ",")) - } - } - return string(cr.Bytes()), nil -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_token.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_token.go deleted file mode 100644 index 7e78d25f1..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_credential_token.go +++ /dev/null @@ -1,137 +0,0 @@ -package azblob - -import ( - "context" - "errors" - "sync/atomic" - - "runtime" - "sync" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// TokenRefresher represents a callback method that you write; this method is called periodically -// so you can refresh the token credential's value. -type TokenRefresher func(credential TokenCredential) time.Duration - -// TokenCredential represents a token credential (which is also a pipeline.Factory). -type TokenCredential interface { - Credential - Token() string - SetToken(newToken string) -} - -// NewTokenCredential creates a token credential for use with role-based access control (RBAC) access to Azure Storage -// resources. You initialize the TokenCredential with an initial token value. If you pass a non-nil value for -// tokenRefresher, then the function you pass will be called immediately so it can refresh and change the -// TokenCredential's token value by calling SetToken. Your tokenRefresher function must return a time.Duration -// indicating how long the TokenCredential object should wait before calling your tokenRefresher function again. -// If your tokenRefresher callback fails to refresh the token, you can return a duration of 0 to stop your -// TokenCredential object from ever invoking tokenRefresher again. Also, oen way to deal with failing to refresh a -// token is to cancel a context.Context object used by requests that have the TokenCredential object in their pipeline. -func NewTokenCredential(initialToken string, tokenRefresher TokenRefresher) TokenCredential { - tc := &tokenCredential{} - tc.SetToken(initialToken) // We don't set it above to guarantee atomicity - if tokenRefresher == nil { - return tc // If no callback specified, return the simple tokenCredential - } - - tcwr := &tokenCredentialWithRefresh{token: tc} - tcwr.token.startRefresh(tokenRefresher) - runtime.SetFinalizer(tcwr, func(deadTC *tokenCredentialWithRefresh) { - deadTC.token.stopRefresh() - deadTC.token = nil // Sanity (not really required) - }) - return tcwr -} - -// tokenCredentialWithRefresh is a wrapper over a token credential. -// When this wrapper object gets GC'd, it stops the tokenCredential's timer -// which allows the tokenCredential object to also be GC'd. -type tokenCredentialWithRefresh struct { - token *tokenCredential -} - -// credentialMarker is a package-internal method that exists just to satisfy the Credential interface. -func (*tokenCredentialWithRefresh) credentialMarker() {} - -// Token returns the current token value -func (f *tokenCredentialWithRefresh) Token() string { return f.token.Token() } - -// SetToken changes the current token value -func (f *tokenCredentialWithRefresh) SetToken(token string) { f.token.SetToken(token) } - -// New satisfies pipeline.Factory's New method creating a pipeline policy object. -func (f *tokenCredentialWithRefresh) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy { - return f.token.New(next, po) -} - -/////////////////////////////////////////////////////////////////////////////// - -// tokenCredential is a pipeline.Factory is the credential's policy factory. -type tokenCredential struct { - token atomic.Value - - // The members below are only used if the user specified a tokenRefresher callback function. - timer *time.Timer - tokenRefresher TokenRefresher - lock sync.Mutex - stopped bool -} - -// credentialMarker is a package-internal method that exists just to satisfy the Credential interface. -func (*tokenCredential) credentialMarker() {} - -// Token returns the current token value -func (f *tokenCredential) Token() string { return f.token.Load().(string) } - -// SetToken changes the current token value -func (f *tokenCredential) SetToken(token string) { f.token.Store(token) } - -// startRefresh calls refresh which immediately calls tokenRefresher -// and then starts a timer to call tokenRefresher in the future. -func (f *tokenCredential) startRefresh(tokenRefresher TokenRefresher) { - f.tokenRefresher = tokenRefresher - f.stopped = false // In case user calls StartRefresh, StopRefresh, & then StartRefresh again - f.refresh() -} - -// refresh calls the user's tokenRefresher so they can refresh the token (by -// calling SetToken) and then starts another time (based on the returned duration) -// in order to refresh the token again in the future. -func (f *tokenCredential) refresh() { - d := f.tokenRefresher(f) // Invoke the user's refresh callback outside of the lock - if d > 0 { // If duration is 0 or negative, refresher wants to not be called again - f.lock.Lock() - if !f.stopped { - f.timer = time.AfterFunc(d, f.refresh) - } - f.lock.Unlock() - } -} - -// stopRefresh stops any pending timer and sets stopped field to true to prevent -// any new timer from starting. -// NOTE: Stopping the timer allows the GC to destroy the tokenCredential object. -func (f *tokenCredential) stopRefresh() { - f.lock.Lock() - f.stopped = true - if f.timer != nil { - f.timer.Stop() - } - f.lock.Unlock() -} - -// New satisfies pipeline.Factory's New method creating a pipeline policy object. -func (f *tokenCredential) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy { - return pipeline.PolicyFunc(func(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - if request.URL.Scheme != "https" { - // HTTPS must be used, otherwise the tokens are at the risk of being exposed - return nil, errors.New("token credentials require a URL using the https protocol scheme") - } - request.Header[headerAuthorization] = []string{"Bearer " + f.Token()} - return next.Do(ctx, request) - }) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_unix.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_unix.go deleted file mode 100644 index 00642f93e..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_unix.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build linux darwin freebsd openbsd netbsd dragonfly solaris - -package azblob - -import ( - "os" - - "golang.org/x/sys/unix" -) - -type mmf []byte - -func newMMF(file *os.File, writable bool, offset int64, length int) (mmf, error) { - prot, flags := unix.PROT_READ, unix.MAP_SHARED // Assume read-only - if writable { - prot, flags = unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED - } - addr, err := unix.Mmap(int(file.Fd()), offset, length, prot, flags) - return mmf(addr), err -} - -func (m *mmf) unmap() { - err := unix.Munmap(*m) - *m = nil - if err != nil { - panic("if we are unable to unmap the memory-mapped file, there is serious concern for memory corruption") - } -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_windows.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_windows.go deleted file mode 100644 index 2743644e1..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_windows.go +++ /dev/null @@ -1,38 +0,0 @@ -package azblob - -import ( - "os" - "reflect" - "syscall" - "unsafe" -) - -type mmf []byte - -func newMMF(file *os.File, writable bool, offset int64, length int) (mmf, error) { - prot, access := uint32(syscall.PAGE_READONLY), uint32(syscall.FILE_MAP_READ) // Assume read-only - if writable { - prot, access = uint32(syscall.PAGE_READWRITE), uint32(syscall.FILE_MAP_WRITE) - } - hMMF, errno := syscall.CreateFileMapping(syscall.Handle(file.Fd()), nil, prot, uint32(int64(length)>>32), uint32(int64(length)&0xffffffff), nil) - if hMMF == 0 { - return nil, os.NewSyscallError("CreateFileMapping", errno) - } - defer syscall.CloseHandle(hMMF) - addr, errno := syscall.MapViewOfFile(hMMF, access, uint32(offset>>32), uint32(offset&0xffffffff), uintptr(length)) - m := mmf{} - h := (*reflect.SliceHeader)(unsafe.Pointer(&m)) - h.Data = addr - h.Len = length - h.Cap = h.Len - return m, nil -} - -func (m *mmf) unmap() { - addr := uintptr(unsafe.Pointer(&(([]byte)(*m)[0]))) - *m = mmf{} - err := syscall.UnmapViewOfFile(addr) - if err != nil { - panic("if we are unable to unmap the memory-mapped file, there is serious concern for memory corruption") - } -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_pipeline.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_pipeline.go deleted file mode 100644 index 7c249a298..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_pipeline.go +++ /dev/null @@ -1,46 +0,0 @@ -package azblob - -import ( - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// PipelineOptions is used to configure a request policy pipeline's retry policy and logging. -type PipelineOptions struct { - // Log configures the pipeline's logging infrastructure indicating what information is logged and where. - Log pipeline.LogOptions - - // Retry configures the built-in retry policy behavior. - Retry RetryOptions - - // RequestLog configures the built-in request logging policy. - RequestLog RequestLogOptions - - // Telemetry configures the built-in telemetry policy behavior. - Telemetry TelemetryOptions - - // HTTPSender configures the sender of HTTP requests - HTTPSender pipeline.Factory -} - -// NewPipeline creates a Pipeline using the specified credentials and options. -func NewPipeline(c Credential, o PipelineOptions) pipeline.Pipeline { - // Closest to API goes first; closest to the wire goes last - f := []pipeline.Factory{ - NewTelemetryPolicyFactory(o.Telemetry), - NewUniqueRequestIDPolicyFactory(), - NewRetryPolicyFactory(o.Retry), - } - - if _, ok := c.(*anonymousCredentialPolicyFactory); !ok { - // For AnonymousCredential, we optimize out the policy factory since it doesn't do anything - // NOTE: The credential's policy factory must appear close to the wire so it can sign any - // changes made by other factories (like UniqueRequestIDPolicyFactory) - f = append(f, c) - } - f = append(f, - NewRequestLogPolicyFactory(o.RequestLog), - pipeline.MethodFactoryMarker()) // indicates at what stage in the pipeline the method factory is invoked - - - return pipeline.NewPipeline(f, pipeline.Options{HTTPSender: o.HTTPSender, Log: o.Log}) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_request_log.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_request_log.go deleted file mode 100644 index 0a362ea8b..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_request_log.go +++ /dev/null @@ -1,182 +0,0 @@ -package azblob - -import ( - "bytes" - "context" - "fmt" - "net/http" - "net/url" - "runtime" - "strings" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// RequestLogOptions configures the retry policy's behavior. -type RequestLogOptions struct { - // LogWarningIfTryOverThreshold logs a warning if a tried operation takes longer than the specified - // duration (-1=no logging; 0=default threshold). - LogWarningIfTryOverThreshold time.Duration -} - -func (o RequestLogOptions) defaults() RequestLogOptions { - if o.LogWarningIfTryOverThreshold == 0 { - // It would be good to relate this to https://azure.microsoft.com/en-us/support/legal/sla/storage/v1_2/ - // But this monitors the time to get the HTTP response; NOT the time to download the response body. - o.LogWarningIfTryOverThreshold = 3 * time.Second // Default to 3 seconds - } - return o -} - -// NewRequestLogPolicyFactory creates a RequestLogPolicyFactory object configured using the specified options. -func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory { - o = o.defaults() // Force defaults to be calculated - return pipeline.FactoryFunc(func(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.PolicyFunc { - // These variables are per-policy; shared by multiple calls to Do - var try int32 - operationStart := time.Now() // If this is the 1st try, record the operation state time - return func(ctx context.Context, request pipeline.Request) (response pipeline.Response, err error) { - try++ // The first try is #1 (not #0) - - // Log the outgoing request as informational - if po.ShouldLog(pipeline.LogInfo) { - b := &bytes.Buffer{} - fmt.Fprintf(b, "==> OUTGOING REQUEST (Try=%d)\n", try) - pipeline.WriteRequestWithResponse(b, prepareRequestForLogging(request), nil, nil) - po.Log(pipeline.LogInfo, b.String()) - } - - // Set the time for this particular retry operation and then Do the operation. - tryStart := time.Now() - response, err = next.Do(ctx, request) // Make the request - tryEnd := time.Now() - tryDuration := tryEnd.Sub(tryStart) - opDuration := tryEnd.Sub(operationStart) - - logLevel, forceLog := pipeline.LogInfo, false // Default logging information - - // If the response took too long, we'll upgrade to warning. - if o.LogWarningIfTryOverThreshold > 0 && tryDuration > o.LogWarningIfTryOverThreshold { - // Log a warning if the try duration exceeded the specified threshold - logLevel, forceLog = pipeline.LogWarning, true - } - - if err == nil { // We got a response from the service - sc := response.Response().StatusCode - if ((sc >= 400 && sc <= 499) && sc != http.StatusNotFound && sc != http.StatusConflict && sc != http.StatusPreconditionFailed && sc != http.StatusRequestedRangeNotSatisfiable) || (sc >= 500 && sc <= 599) { - logLevel, forceLog = pipeline.LogError, true // Promote to Error any 4xx (except those listed is an error) or any 5xx - } else { - // For other status codes, we leave the level as is. - } - } else { // This error did not get an HTTP response from the service; upgrade the severity to Error - logLevel, forceLog = pipeline.LogError, true - } - - if shouldLog := po.ShouldLog(logLevel); forceLog || shouldLog { - // We're going to log this; build the string to log - b := &bytes.Buffer{} - slow := "" - if o.LogWarningIfTryOverThreshold > 0 && tryDuration > o.LogWarningIfTryOverThreshold { - slow = fmt.Sprintf("[SLOW >%v]", o.LogWarningIfTryOverThreshold) - } - fmt.Fprintf(b, "==> REQUEST/RESPONSE (Try=%d/%v%s, OpTime=%v) -- ", try, tryDuration, slow, opDuration) - if err != nil { // This HTTP request did not get a response from the service - fmt.Fprint(b, "REQUEST ERROR\n") - } else { - if logLevel == pipeline.LogError { - fmt.Fprint(b, "RESPONSE STATUS CODE ERROR\n") - } else { - fmt.Fprint(b, "RESPONSE SUCCESSFULLY RECEIVED\n") - } - } - - pipeline.WriteRequestWithResponse(b, prepareRequestForLogging(request), response.Response(), err) - if logLevel <= pipeline.LogError { - b.Write(stack()) // For errors (or lower levels), we append the stack trace (an expensive operation) - } - msg := b.String() - - if forceLog { - pipeline.ForceLog(logLevel, msg) - } - if shouldLog { - po.Log(logLevel, msg) - } - } - return response, err - } - }) -} - -// RedactSigQueryParam redacts the 'sig' query parameter in URL's raw query to protect secret. -func RedactSigQueryParam(rawQuery string) (bool, string) { - rawQuery = strings.ToLower(rawQuery) // lowercase the string so we can look for ?sig= and &sig= - sigFound := strings.Contains(rawQuery, "?sig=") - if !sigFound { - sigFound = strings.Contains(rawQuery, "&sig=") - if !sigFound { - return sigFound, rawQuery // [?|&]sig= not found; return same rawQuery passed in (no memory allocation) - } - } - // [?|&]sig= found, redact its value - values, _ := url.ParseQuery(rawQuery) - for name := range values { - if strings.EqualFold(name, "sig") { - values[name] = []string{"REDACTED"} - } - } - return sigFound, values.Encode() -} - -func prepareRequestForLogging(request pipeline.Request) *http.Request { - req := request - if sigFound, rawQuery := RedactSigQueryParam(req.URL.RawQuery); sigFound { - // Make copy so we don't destroy the query parameters we actually need to send in the request - req = request.Copy() - req.Request.URL.RawQuery = rawQuery - } - - return prepareRequestForServiceLogging(req) -} - -func stack() []byte { - buf := make([]byte, 1024) - for { - n := runtime.Stack(buf, false) - if n < len(buf) { - return buf[:n] - } - buf = make([]byte, 2*len(buf)) - } -} - -/////////////////////////////////////////////////////////////////////////////////////// -// Redact phase useful for blob and file service only. For other services, -// this method can directly return request.Request. -/////////////////////////////////////////////////////////////////////////////////////// -func prepareRequestForServiceLogging(request pipeline.Request) *http.Request { - req := request - if exist, key := doesHeaderExistCaseInsensitive(req.Header, xMsCopySourceHeader); exist { - req = request.Copy() - url, err := url.Parse(req.Header.Get(key)) - if err == nil { - if sigFound, rawQuery := RedactSigQueryParam(url.RawQuery); sigFound { - url.RawQuery = rawQuery - req.Header.Set(xMsCopySourceHeader, url.String()) - } - } - } - return req.Request -} - -const xMsCopySourceHeader = "x-ms-copy-source" - -func doesHeaderExistCaseInsensitive(header http.Header, key string) (bool, string) { - for keyInHeader := range header { - if strings.EqualFold(keyInHeader, key) { - return true, keyInHeader - } - } - return false, "" -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_retry.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_retry.go deleted file mode 100644 index 0894fcc32..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_retry.go +++ /dev/null @@ -1,414 +0,0 @@ -package azblob - -import ( - "context" - "errors" - "io" - "io/ioutil" - "math/rand" - "net" - "net/http" - "strconv" - "strings" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// RetryPolicy tells the pipeline what kind of retry policy to use. See the RetryPolicy* constants. -type RetryPolicy int32 - -const ( - // RetryPolicyExponential tells the pipeline to use an exponential back-off retry policy - RetryPolicyExponential RetryPolicy = 0 - - // RetryPolicyFixed tells the pipeline to use a fixed back-off retry policy - RetryPolicyFixed RetryPolicy = 1 -) - -// RetryOptions configures the retry policy's behavior. -type RetryOptions struct { - // Policy tells the pipeline what kind of retry policy to use. See the RetryPolicy* constants.\ - // A value of zero means that you accept our default policy. - Policy RetryPolicy - - // MaxTries specifies the maximum number of attempts an operation will be tried before producing an error (0=default). - // A value of zero means that you accept our default policy. A value of 1 means 1 try and no retries. - MaxTries int32 - - // TryTimeout indicates the maximum time allowed for any single try of an HTTP request. - // A value of zero means that you accept our default timeout. NOTE: When transferring large amounts - // of data, the default TryTimeout will probably not be sufficient. You should override this value - // based on the bandwidth available to the host machine and proximity to the Storage service. A good - // starting point may be something like (60 seconds per MB of anticipated-payload-size). - TryTimeout time.Duration - - // RetryDelay specifies the amount of delay to use before retrying an operation (0=default). - // When RetryPolicy is specified as RetryPolicyExponential, the delay increases exponentially - // with each retry up to a maximum specified by MaxRetryDelay. - // If you specify 0, then you must also specify 0 for MaxRetryDelay. - // If you specify RetryDelay, then you must also specify MaxRetryDelay, and MaxRetryDelay should be - // equal to or greater than RetryDelay. - RetryDelay time.Duration - - // MaxRetryDelay specifies the maximum delay allowed before retrying an operation (0=default). - // If you specify 0, then you must also specify 0 for RetryDelay. - MaxRetryDelay time.Duration - - // RetryReadsFromSecondaryHost specifies whether the retry policy should retry a read operation against another host. - // If RetryReadsFromSecondaryHost is "" (the default) then operations are not retried against another host. - // NOTE: Before setting this field, make sure you understand the issues around reading stale & potentially-inconsistent - // data at this webpage: https://docs.microsoft.com/en-us/azure/storage/common/storage-designing-ha-apps-with-ragrs - RetryReadsFromSecondaryHost string // Comment this our for non-Blob SDKs -} - -func (o RetryOptions) retryReadsFromSecondaryHost() string { - return o.RetryReadsFromSecondaryHost // This is for the Blob SDK only - //return "" // This is for non-blob SDKs -} - -func (o RetryOptions) defaults() RetryOptions { - // We assume the following: - // 1. o.Policy should either be RetryPolicyExponential or RetryPolicyFixed - // 2. o.MaxTries >= 0 - // 3. o.TryTimeout, o.RetryDelay, and o.MaxRetryDelay >=0 - // 4. o.RetryDelay <= o.MaxRetryDelay - // 5. Both o.RetryDelay and o.MaxRetryDelay must be 0 or neither can be 0 - - IfDefault := func(current *time.Duration, desired time.Duration) { - if *current == time.Duration(0) { - *current = desired - } - } - - // Set defaults if unspecified - if o.MaxTries == 0 { - o.MaxTries = 4 - } - switch o.Policy { - case RetryPolicyExponential: - IfDefault(&o.TryTimeout, 1*time.Minute) - IfDefault(&o.RetryDelay, 4*time.Second) - IfDefault(&o.MaxRetryDelay, 120*time.Second) - - case RetryPolicyFixed: - IfDefault(&o.TryTimeout, 1*time.Minute) - IfDefault(&o.RetryDelay, 30*time.Second) - IfDefault(&o.MaxRetryDelay, 120*time.Second) - } - return o -} - -func (o RetryOptions) calcDelay(try int32) time.Duration { // try is >=1; never 0 - pow := func(number int64, exponent int32) int64 { // pow is nested helper function - var result int64 = 1 - for n := int32(0); n < exponent; n++ { - result *= number - } - return result - } - - delay := time.Duration(0) - switch o.Policy { - case RetryPolicyExponential: - delay = time.Duration(pow(2, try-1)-1) * o.RetryDelay - - case RetryPolicyFixed: - if try > 1 { // Any try after the 1st uses the fixed delay - delay = o.RetryDelay - } - } - - // Introduce some jitter: [0.0, 1.0) / 2 = [0.0, 0.5) + 0.8 = [0.8, 1.3) - // For casts and rounding - be careful, as per https://github.com/golang/go/issues/20757 - delay = time.Duration(float32(delay) * (rand.Float32()/2 + 0.8)) // NOTE: We want math/rand; not crypto/rand - if delay > o.MaxRetryDelay { - delay = o.MaxRetryDelay - } - return delay -} - -// NewRetryPolicyFactory creates a RetryPolicyFactory object configured using the specified options. -func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory { - o = o.defaults() // Force defaults to be calculated - return pipeline.FactoryFunc(func(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.PolicyFunc { - return func(ctx context.Context, request pipeline.Request) (response pipeline.Response, err error) { - // Before each try, we'll select either the primary or secondary URL. - primaryTry := int32(0) // This indicates how many tries we've attempted against the primary DC - - // We only consider retrying against a secondary if we have a read request (GET/HEAD) AND this policy has a Secondary URL it can use - considerSecondary := (request.Method == http.MethodGet || request.Method == http.MethodHead) && o.retryReadsFromSecondaryHost() != "" - - // Exponential retry algorithm: ((2 ^ attempt) - 1) * delay * random(0.8, 1.2) - // When to retry: connection failure or temporary/timeout. NOTE: StorageError considers HTTP 500/503 as temporary & is therefore retryable - // If using a secondary: - // Even tries go against primary; odd tries go against the secondary - // For a primary wait ((2 ^ primaryTries - 1) * delay * random(0.8, 1.2) - // If secondary gets a 404, don't fail, retry but future retries are only against the primary - // When retrying against a secondary, ignore the retry count and wait (.1 second * random(0.8, 1.2)) - for try := int32(1); try <= o.MaxTries; try++ { - logf("\n=====> Try=%d\n", try) - - // Determine which endpoint to try. It's primary if there is no secondary or if it is an add # attempt. - tryingPrimary := !considerSecondary || (try%2 == 1) - // Select the correct host and delay - if tryingPrimary { - primaryTry++ - delay := o.calcDelay(primaryTry) - logf("Primary try=%d, Delay=%v\n", primaryTry, delay) - time.Sleep(delay) // The 1st try returns 0 delay - } else { - // For casts and rounding - be careful, as per https://github.com/golang/go/issues/20757 - delay := time.Duration(float32(time.Second) * (rand.Float32()/2 + 0.8)) - logf("Secondary try=%d, Delay=%v\n", try-primaryTry, delay) - time.Sleep(delay) // Delay with some jitter before trying secondary - } - - // Clone the original request to ensure that each try starts with the original (unmutated) request. - requestCopy := request.Copy() - - // For each try, seek to the beginning of the Body stream. We do this even for the 1st try because - // the stream may not be at offset 0 when we first get it and we want the same behavior for the - // 1st try as for additional tries. - err = requestCopy.RewindBody() - if err != nil { - return nil, errors.New("we must be able to seek on the Body Stream, otherwise retries would cause data corruption") - } - - if !tryingPrimary { - requestCopy.URL.Host = o.retryReadsFromSecondaryHost() - requestCopy.Host = o.retryReadsFromSecondaryHost() - } - - // Set the server-side timeout query parameter "timeout=[seconds]" - timeout := int32(o.TryTimeout.Seconds()) // Max seconds per try - if deadline, ok := ctx.Deadline(); ok { // If user's ctx has a deadline, make the timeout the smaller of the two - t := int32(deadline.Sub(time.Now()).Seconds()) // Duration from now until user's ctx reaches its deadline - logf("MaxTryTimeout=%d secs, TimeTilDeadline=%d sec\n", timeout, t) - if t < timeout { - timeout = t - } - if timeout < 0 { - timeout = 0 // If timeout ever goes negative, set it to zero; this happen while debugging - } - logf("TryTimeout adjusted to=%d sec\n", timeout) - } - q := requestCopy.Request.URL.Query() - q.Set("timeout", strconv.Itoa(int(timeout+1))) // Add 1 to "round up" - requestCopy.Request.URL.RawQuery = q.Encode() - logf("Url=%s\n", requestCopy.Request.URL.String()) - - // Set the time for this particular retry operation and then Do the operation. - tryCtx, tryCancel := context.WithTimeout(ctx, time.Second*time.Duration(timeout)) - //requestCopy.Body = &deadlineExceededReadCloser{r: requestCopy.Request.Body} - response, err = next.Do(tryCtx, requestCopy) // Make the request - /*err = improveDeadlineExceeded(err) - if err == nil { - response.Response().Body = &deadlineExceededReadCloser{r: response.Response().Body} - }*/ - logf("Err=%v, response=%v\n", err, response) - - action := "" // This MUST get changed within the switch code below - switch { - case ctx.Err() != nil: - action = "NoRetry: Op timeout" - case !tryingPrimary && response != nil && response.Response() != nil && response.Response().StatusCode == http.StatusNotFound: - // If attempt was against the secondary & it returned a StatusNotFound (404), then - // the resource was not found. This may be due to replication delay. So, in this - // case, we'll never try the secondary again for this operation. - considerSecondary = false - action = "Retry: Secondary URL returned 404" - case err != nil: - // NOTE: Protocol Responder returns non-nil if REST API returns invalid status code for the invoked operation. - // Use ServiceCode to verify if the error is related to storage service-side, - // ServiceCode is set only when error related to storage service happened. - if stErr, ok := err.(StorageError); ok { - if stErr.Temporary() { - action = "Retry: StorageError with error service code and Temporary()" - } else if stErr.Response() != nil && isSuccessStatusCode(stErr.Response()) { // TODO: This is a temporarily work around, remove this after protocol layer fix the issue that net.Error is wrapped as storageError - action = "Retry: StorageError with success status code" - } else { - action = "NoRetry: StorageError not Temporary() and without retriable status code" - } - } else if netErr, ok := err.(net.Error); ok { - // Use non-retriable net.Error list, but not retriable list. - // As there are errors without Temporary() implementation, - // while need be retried, like 'connection reset by peer', 'transport connection broken' and etc. - // So the SDK do retry for most of the case, unless the error should not be retried for sure. - if !isNotRetriable(netErr) { - action = "Retry: net.Error and not in the non-retriable list" - } else { - action = "NoRetry: net.Error and in the non-retriable list" - } - } else if err == io.ErrUnexpectedEOF { - action = "Retry: unexpected EOF" - } else { - action = "NoRetry: unrecognized error" - } - default: - action = "NoRetry: successful HTTP request" // no error - } - - logf("Action=%s\n", action) - // fmt.Println(action + "\n") // This is where we could log the retry operation; action is why we're retrying - if action[0] != 'R' { // Retry only if action starts with 'R' - if err != nil { - tryCancel() // If we're returning an error, cancel this current/last per-retry timeout context - } else { - // We wrap the last per-try context in a body and overwrite the Response's Body field with our wrapper. - // So, when the user closes the Body, the our per-try context gets closed too. - // Another option, is that the Last Policy do this wrapping for a per-retry context (not for the user's context) - if response == nil || response.Response() == nil { - // We do panic in the case response or response.Response() is nil, - // as for client, the response should not be nil if request is sent and the operations is executed successfully. - // Another option, is that execute the cancel function when response or response.Response() is nil, - // as in this case, current per-try has nothing to do in future. - return nil, errors.New("invalid state, response should not be nil when the operation is executed successfully") - } - response.Response().Body = &contextCancelReadCloser{cf: tryCancel, body: response.Response().Body} - } - break // Don't retry - } - if response != nil && response.Response() != nil && response.Response().Body != nil { - // If we're going to retry and we got a previous response, then flush its body to avoid leaking its TCP connection - body := response.Response().Body - io.Copy(ioutil.Discard, body) - body.Close() - } - // If retrying, cancel the current per-try timeout context - tryCancel() - } - return response, err // Not retryable or too many retries; return the last response/error - } - }) -} - -// contextCancelReadCloser helps to invoke context's cancelFunc properly when the ReadCloser is closed. -type contextCancelReadCloser struct { - cf context.CancelFunc - body io.ReadCloser -} - -func (rc *contextCancelReadCloser) Read(p []byte) (n int, err error) { - return rc.body.Read(p) -} - -func (rc *contextCancelReadCloser) Close() error { - err := rc.body.Close() - if rc.cf != nil { - rc.cf() - } - return err -} - -// isNotRetriable checks if the provided net.Error isn't retriable. -func isNotRetriable(errToParse net.Error) bool { - // No error, so this is NOT retriable. - if errToParse == nil { - return true - } - - // The error is either temporary or a timeout so it IS retriable (not not retriable). - if errToParse.Temporary() || errToParse.Timeout() { - return false - } - - genericErr := error(errToParse) - - // From here all the error are neither Temporary() nor Timeout(). - switch err := errToParse.(type) { - case *net.OpError: - // The net.Error is also a net.OpError but the inner error is nil, so this is not retriable. - if err.Err == nil { - return true - } - genericErr = err.Err - } - - switch genericErr.(type) { - case *net.AddrError, net.UnknownNetworkError, *net.DNSError, net.InvalidAddrError, *net.ParseError, *net.DNSConfigError: - // If the error is one of the ones listed, then it is NOT retriable. - return true - } - - // If it's invalid header field name/value error thrown by http module, then it is NOT retriable. - // This could happen when metadata's key or value is invalid. (RoundTrip in transport.go) - if strings.Contains(genericErr.Error(), "invalid header field") { - return true - } - - // Assume the error is retriable. - return false -} - -var successStatusCodes = []int{http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNoContent, http.StatusPartialContent} - -func isSuccessStatusCode(resp *http.Response) bool { - if resp == nil { - return false - } - for _, i := range successStatusCodes { - if i == resp.StatusCode { - return true - } - } - return false -} - -// According to https://github.com/golang/go/wiki/CompilerOptimizations, the compiler will inline this method and hopefully optimize all calls to it away -var logf = func(format string, a ...interface{}) {} - -// Use this version to see the retry method's code path (import "fmt") -//var logf = fmt.Printf - -/* -type deadlineExceededReadCloser struct { - r io.ReadCloser -} - -func (r *deadlineExceededReadCloser) Read(p []byte) (int, error) { - n, err := 0, io.EOF - if r.r != nil { - n, err = r.r.Read(p) - } - return n, improveDeadlineExceeded(err) -} -func (r *deadlineExceededReadCloser) Seek(offset int64, whence int) (int64, error) { - // For an HTTP request, the ReadCloser MUST also implement seek - // For an HTTP response, Seek MUST not be called (or this will panic) - o, err := r.r.(io.Seeker).Seek(offset, whence) - return o, improveDeadlineExceeded(err) -} -func (r *deadlineExceededReadCloser) Close() error { - if c, ok := r.r.(io.Closer); ok { - c.Close() - } - return nil -} - -// timeoutError is the internal struct that implements our richer timeout error. -type deadlineExceeded struct { - responseError -} - -var _ net.Error = (*deadlineExceeded)(nil) // Ensure deadlineExceeded implements the net.Error interface at compile time - -// improveDeadlineExceeded creates a timeoutError object that implements the error interface IF cause is a context.DeadlineExceeded error. -func improveDeadlineExceeded(cause error) error { - // If cause is not DeadlineExceeded, return the same error passed in. - if cause != context.DeadlineExceeded { - return cause - } - // Else, convert DeadlineExceeded to our timeoutError which gives a richer string message - return &deadlineExceeded{ - responseError: responseError{ - ErrorNode: pipeline.ErrorNode{}.Initialize(cause, 3), - }, - } -} - -// Error implements the error interface's Error method to return a string representation of the error. -func (e *deadlineExceeded) Error() string { - return e.ErrorNode.Error("context deadline exceeded; when creating a pipeline, consider increasing RetryOptions' TryTimeout field") -} -*/ diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_telemetry.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_telemetry.go deleted file mode 100644 index 608e1051c..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_telemetry.go +++ /dev/null @@ -1,51 +0,0 @@ -package azblob - -import ( - "bytes" - "context" - "fmt" - "os" - "runtime" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// TelemetryOptions configures the telemetry policy's behavior. -type TelemetryOptions struct { - // Value is a string prepended to each request's User-Agent and sent to the service. - // The service records the user-agent in logs for diagnostics and tracking of client requests. - Value string -} - -// NewTelemetryPolicyFactory creates a factory that can create telemetry policy objects -// which add telemetry information to outgoing HTTP requests. -func NewTelemetryPolicyFactory(o TelemetryOptions) pipeline.Factory { - b := &bytes.Buffer{} - b.WriteString(o.Value) - if b.Len() > 0 { - b.WriteRune(' ') - } - fmt.Fprintf(b, "Azure-Storage/%s %s", serviceLibVersion, platformInfo) - telemetryValue := b.String() - - return pipeline.FactoryFunc(func(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.PolicyFunc { - return func(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - request.Header.Set("User-Agent", telemetryValue) - return next.Do(ctx, request) - } - }) -} - -// NOTE: the ONLY function that should write to this variable is this func -var platformInfo = func() string { - // Azure-Storage/version (runtime; os type and version)” - // Azure-Storage/1.4.0 (NODE-VERSION v4.5.0; Windows_NT 10.0.14393)' - operatingSystem := runtime.GOOS // Default OS string - switch operatingSystem { - case "windows": - operatingSystem = os.Getenv("OS") // Get more specific OS information - case "linux": // accept default OS info - case "freebsd": // accept default OS info - } - return fmt.Sprintf("(%s; %s)", runtime.Version(), operatingSystem) -}() diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_unique_request_id.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_unique_request_id.go deleted file mode 100644 index a75c7d1d2..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_policy_unique_request_id.go +++ /dev/null @@ -1,24 +0,0 @@ -package azblob - -import ( - "context" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// NewUniqueRequestIDPolicyFactory creates a UniqueRequestIDPolicyFactory object -// that sets the request's x-ms-client-request-id header if it doesn't already exist. -func NewUniqueRequestIDPolicyFactory() pipeline.Factory { - return pipeline.FactoryFunc(func(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.PolicyFunc { - // This is Policy's Do method: - return func(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - id := request.Header.Get(xMsClientRequestID) - if id == "" { // Add a unique request ID if the caller didn't specify one already - request.Header.Set(xMsClientRequestID, newUUID().String()) - } - return next.Do(ctx, request) - } - }) -} - -const xMsClientRequestID = "x-ms-client-request-id" diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_retry_reader.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_retry_reader.go deleted file mode 100644 index 15b7c40ed..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_retry_reader.go +++ /dev/null @@ -1,184 +0,0 @@ -package azblob - -import ( - "context" - "io" - "net" - "net/http" - "strings" - "sync" -) - -const CountToEnd = 0 - -// HTTPGetter is a function type that refers to a method that performs an HTTP GET operation. -type HTTPGetter func(ctx context.Context, i HTTPGetterInfo) (*http.Response, error) - -// HTTPGetterInfo is passed to an HTTPGetter function passing it parameters -// that should be used to make an HTTP GET request. -type HTTPGetterInfo struct { - // Offset specifies the start offset that should be used when - // creating the HTTP GET request's Range header - Offset int64 - - // Count specifies the count of bytes that should be used to calculate - // the end offset when creating the HTTP GET request's Range header - Count int64 - - // ETag specifies the resource's etag that should be used when creating - // the HTTP GET request's If-Match header - ETag ETag -} - -// FailedReadNotifier is a function type that represents the notification function called when a read fails -type FailedReadNotifier func(failureCount int, lastError error, offset int64, count int64, willRetry bool) - -// RetryReaderOptions contains properties which can help to decide when to do retry. -type RetryReaderOptions struct { - // MaxRetryRequests specifies the maximum number of HTTP GET requests that will be made - // while reading from a RetryReader. A value of zero means that no additional HTTP - // GET requests will be made. - MaxRetryRequests int - doInjectError bool - doInjectErrorRound int - injectedError error - - // NotifyFailedRead is called, if non-nil, after any failure to read. Expected usage is diagnostic logging. - NotifyFailedRead FailedReadNotifier - - // TreatEarlyCloseAsError can be set to true to prevent retries after "read on closed response body". By default, - // retryReader has the following special behaviour: closing the response body before it is all read is treated as a - // retryable error. This is to allow callers to force a retry by closing the body from another goroutine (e.g. if the = - // read is too slow, caller may want to force a retry in the hope that the retry will be quicker). If - // TreatEarlyCloseAsError is true, then retryReader's special behaviour is suppressed, and "read on closed body" is instead - // treated as a fatal (non-retryable) error. - // Note that setting TreatEarlyCloseAsError only guarantees that Closing will produce a fatal error if the Close happens - // from the same "thread" (goroutine) as Read. Concurrent Close calls from other goroutines may instead produce network errors - // which will be retried. - TreatEarlyCloseAsError bool -} - -// retryReader implements io.ReaderCloser methods. -// retryReader tries to read from response, and if there is retriable network error -// returned during reading, it will retry according to retry reader option through executing -// user defined action with provided data to get a new response, and continue the overall reading process -// through reading from the new response. -type retryReader struct { - ctx context.Context - info HTTPGetterInfo - countWasBounded bool - o RetryReaderOptions - getter HTTPGetter - - // we support Close-ing during Reads (from other goroutines), so we protect the shared state, which is response - responseMu *sync.Mutex - response *http.Response -} - -// NewRetryReader creates a retry reader. -func NewRetryReader(ctx context.Context, initialResponse *http.Response, - info HTTPGetterInfo, o RetryReaderOptions, getter HTTPGetter) io.ReadCloser { - return &retryReader{ - ctx: ctx, - getter: getter, - info: info, - countWasBounded: info.Count != CountToEnd, - response: initialResponse, - responseMu: &sync.Mutex{}, - o: o} -} - -func (s *retryReader) setResponse(r *http.Response) { - s.responseMu.Lock() - defer s.responseMu.Unlock() - s.response = r -} - -func (s *retryReader) Read(p []byte) (n int, err error) { - for try := 0; ; try++ { - //fmt.Println(try) // Comment out for debugging. - if s.countWasBounded && s.info.Count == CountToEnd { - // User specified an original count and the remaining bytes are 0, return 0, EOF - return 0, io.EOF - } - - s.responseMu.Lock() - resp := s.response - s.responseMu.Unlock() - if resp == nil { // We don't have a response stream to read from, try to get one. - newResponse, err := s.getter(s.ctx, s.info) - if err != nil { - return 0, err - } - // Successful GET; this is the network stream we'll read from. - s.setResponse(newResponse) - resp = newResponse - } - n, err := resp.Body.Read(p) // Read from the stream (this will return non-nil err if forceRetry is called, from another goroutine, while it is running) - - // Injection mechanism for testing. - if s.o.doInjectError && try == s.o.doInjectErrorRound { - if s.o.injectedError != nil { - err = s.o.injectedError - } else { - err = &net.DNSError{IsTemporary: true} - } - } - - // We successfully read data or end EOF. - if err == nil || err == io.EOF { - s.info.Offset += int64(n) // Increments the start offset in case we need to make a new HTTP request in the future - if s.info.Count != CountToEnd { - s.info.Count -= int64(n) // Decrement the count in case we need to make a new HTTP request in the future - } - return n, err // Return the return to the caller - } - s.Close() // Error, close stream - s.setResponse(nil) // Our stream is no longer good - - // Check the retry count and error code, and decide whether to retry. - retriesExhausted := try >= s.o.MaxRetryRequests - _, isNetError := err.(net.Error) - isUnexpectedEOF := err == io.ErrUnexpectedEOF - willRetry := (isNetError || isUnexpectedEOF || s.wasRetryableEarlyClose(err)) && !retriesExhausted - - // Notify, for logging purposes, of any failures - if s.o.NotifyFailedRead != nil { - failureCount := try + 1 // because try is zero-based - s.o.NotifyFailedRead(failureCount, err, s.info.Offset, s.info.Count, willRetry) - } - - if willRetry { - continue - // Loop around and try to get and read from new stream. - } - return n, err // Not retryable, or retries exhausted, so just return - } -} - -// By default, we allow early Closing, from another concurrent goroutine, to be used to force a retry -// Is this safe, to close early from another goroutine? Early close ultimately ends up calling -// net.Conn.Close, and that is documented as "Any blocked Read or Write operations will be unblocked and return errors" -// which is exactly the behaviour we want. -// NOTE: that if caller has forced an early Close from a separate goroutine (separate from the Read) -// then there are two different types of error that may happen - either the one one we check for here, -// or a net.Error (due to closure of connection). Which one happens depends on timing. We only need this routine -// to check for one, since the other is a net.Error, which our main Read retry loop is already handing. -func (s *retryReader) wasRetryableEarlyClose(err error) bool { - if s.o.TreatEarlyCloseAsError { - return false // user wants all early closes to be errors, and so not retryable - } - // unfortunately, http.errReadOnClosedResBody is private, so the best we can do here is to check for its text - return strings.HasSuffix(err.Error(), ReadOnClosedBodyMessage) -} - -const ReadOnClosedBodyMessage = "read on closed response body" - -func (s *retryReader) Close() error { - s.responseMu.Lock() - defer s.responseMu.Unlock() - if s.response != nil && s.response.Body != nil { - return s.response.Body.Close() - } - return nil -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_account.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_account.go deleted file mode 100644 index c000c48ec..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_account.go +++ /dev/null @@ -1,219 +0,0 @@ -package azblob - -import ( - "bytes" - "errors" - "fmt" - "strings" - "time" -) - -// AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. -// For more information, see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas -type AccountSASSignatureValues struct { - Version string `param:"sv"` // If not specified, this defaults to SASVersion - Protocol SASProtocol `param:"spr"` // See the SASProtocol* constants - StartTime time.Time `param:"st"` // Not specified if IsZero - ExpiryTime time.Time `param:"se"` // Not specified if IsZero - Permissions string `param:"sp"` // Create by initializing a AccountSASPermissions and then call String() - IPRange IPRange `param:"sip"` - Services string `param:"ss"` // Create by initializing AccountSASServices and then call String() - ResourceTypes string `param:"srt"` // Create by initializing AccountSASResourceTypes and then call String() -} - -// NewSASQueryParameters uses an account's shared key credential to sign this signature values to produce -// the proper SAS query parameters. -func (v AccountSASSignatureValues) NewSASQueryParameters(sharedKeyCredential *SharedKeyCredential) (SASQueryParameters, error) { - // https://docs.microsoft.com/en-us/rest/api/storageservices/Constructing-an-Account-SAS - if v.ExpiryTime.IsZero() || v.Permissions == "" || v.ResourceTypes == "" || v.Services == "" { - return SASQueryParameters{}, errors.New("account SAS is missing at least one of these: ExpiryTime, Permissions, Service, or ResourceType") - } - if v.Version == "" { - v.Version = SASVersion - } - perms := &AccountSASPermissions{} - if err := perms.Parse(v.Permissions); err != nil { - return SASQueryParameters{}, err - } - v.Permissions = perms.String() - - startTime, expiryTime, _ := FormatTimesForSASSigning(v.StartTime, v.ExpiryTime, time.Time{}) - - stringToSign := strings.Join([]string{ - sharedKeyCredential.AccountName(), - v.Permissions, - v.Services, - v.ResourceTypes, - startTime, - expiryTime, - v.IPRange.String(), - string(v.Protocol), - v.Version, - ""}, // That right, the account SAS requires a terminating extra newline - "\n") - - signature := sharedKeyCredential.ComputeHMACSHA256(stringToSign) - p := SASQueryParameters{ - // Common SAS parameters - version: v.Version, - protocol: v.Protocol, - startTime: v.StartTime, - expiryTime: v.ExpiryTime, - permissions: v.Permissions, - ipRange: v.IPRange, - - // Account-specific SAS parameters - services: v.Services, - resourceTypes: v.ResourceTypes, - - // Calculated SAS signature - signature: signature, - } - - return p, nil -} - -// The AccountSASPermissions type simplifies creating the permissions string for an Azure Storage Account SAS. -// Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Permissions field. -type AccountSASPermissions struct { - Read, Write, Delete, List, Add, Create, Update, Process bool -} - -// String produces the SAS permissions string for an Azure Storage account. -// Call this method to set AccountSASSignatureValues's Permissions field. -func (p AccountSASPermissions) String() string { - var buffer bytes.Buffer - if p.Read { - buffer.WriteRune('r') - } - if p.Write { - buffer.WriteRune('w') - } - if p.Delete { - buffer.WriteRune('d') - } - if p.List { - buffer.WriteRune('l') - } - if p.Add { - buffer.WriteRune('a') - } - if p.Create { - buffer.WriteRune('c') - } - if p.Update { - buffer.WriteRune('u') - } - if p.Process { - buffer.WriteRune('p') - } - return buffer.String() -} - -// Parse initializes the AccountSASPermissions's fields from a string. -func (p *AccountSASPermissions) Parse(s string) error { - *p = AccountSASPermissions{} // Clear out the flags - for _, r := range s { - switch r { - case 'r': - p.Read = true - case 'w': - p.Write = true - case 'd': - p.Delete = true - case 'l': - p.List = true - case 'a': - p.Add = true - case 'c': - p.Create = true - case 'u': - p.Update = true - case 'p': - p.Process = true - default: - return fmt.Errorf("Invalid permission character: '%v'", r) - } - } - return nil -} - -// The AccountSASServices type simplifies creating the services string for an Azure Storage Account SAS. -// Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Services field. -type AccountSASServices struct { - Blob, Queue, File bool -} - -// String produces the SAS services string for an Azure Storage account. -// Call this method to set AccountSASSignatureValues's Services field. -func (s AccountSASServices) String() string { - var buffer bytes.Buffer - if s.Blob { - buffer.WriteRune('b') - } - if s.Queue { - buffer.WriteRune('q') - } - if s.File { - buffer.WriteRune('f') - } - return buffer.String() -} - -// Parse initializes the AccountSASServices' fields from a string. -func (a *AccountSASServices) Parse(s string) error { - *a = AccountSASServices{} // Clear out the flags - for _, r := range s { - switch r { - case 'b': - a.Blob = true - case 'q': - a.Queue = true - case 'f': - a.File = true - default: - return fmt.Errorf("Invalid service character: '%v'", r) - } - } - return nil -} - -// The AccountSASResourceTypes type simplifies creating the resource types string for an Azure Storage Account SAS. -// Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's ResourceTypes field. -type AccountSASResourceTypes struct { - Service, Container, Object bool -} - -// String produces the SAS resource types string for an Azure Storage account. -// Call this method to set AccountSASSignatureValues's ResourceTypes field. -func (rt AccountSASResourceTypes) String() string { - var buffer bytes.Buffer - if rt.Service { - buffer.WriteRune('s') - } - if rt.Container { - buffer.WriteRune('c') - } - if rt.Object { - buffer.WriteRune('o') - } - return buffer.String() -} - -// Parse initializes the AccountSASResourceType's fields from a string. -func (rt *AccountSASResourceTypes) Parse(s string) error { - *rt = AccountSASResourceTypes{} // Clear out the flags - for _, r := range s { - switch r { - case 's': - rt.Service = true - case 'c': - rt.Container = true - case 'o': - rt.Object = true - default: - return fmt.Errorf("Invalid resource type: '%v'", r) - } - } - return nil -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_query_params.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_query_params.go deleted file mode 100644 index 427b1709a..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_sas_query_params.go +++ /dev/null @@ -1,358 +0,0 @@ -package azblob - -import ( - "errors" - "net" - "net/url" - "strings" - "time" -) - -// SASVersion indicates the SAS version. -const SASVersion = ServiceVersion - -type SASProtocol string - -const ( - // SASProtocolHTTPS can be specified for a SAS protocol - SASProtocolHTTPS SASProtocol = "https" - - // SASProtocolHTTPSandHTTP can be specified for a SAS protocol - SASProtocolHTTPSandHTTP SASProtocol = "https,http" -) - -// FormatTimesForSASSigning converts a time.Time to a snapshotTimeFormat string suitable for a -// SASField's StartTime or ExpiryTime fields. Returns "" if value.IsZero(). -func FormatTimesForSASSigning(startTime, expiryTime, snapshotTime time.Time) (string, string, string) { - ss := "" - if !startTime.IsZero() { - ss = formatSASTimeWithDefaultFormat(&startTime) - } - se := "" - if !expiryTime.IsZero() { - se = formatSASTimeWithDefaultFormat(&expiryTime) - } - sh := "" - if !snapshotTime.IsZero() { - sh = snapshotTime.Format(SnapshotTimeFormat) - } - return ss, se, sh -} - -// SASTimeFormat represents the format of a SAS start or expiry time. Use it when formatting/parsing a time.Time. -const SASTimeFormat = "2006-01-02T15:04:05Z" //"2017-07-27T00:00:00Z" // ISO 8601 -var SASTimeFormats = []string{"2006-01-02T15:04:05.0000000Z", SASTimeFormat, "2006-01-02T15:04Z", "2006-01-02"} // ISO 8601 formats, please refer to https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas for more details. - -// formatSASTimeWithDefaultFormat format time with ISO 8601 in "yyyy-MM-ddTHH:mm:ssZ". -func formatSASTimeWithDefaultFormat(t *time.Time) string { - return formatSASTime(t, SASTimeFormat) // By default, "yyyy-MM-ddTHH:mm:ssZ" is used -} - -// formatSASTime format time with given format, use ISO 8601 in "yyyy-MM-ddTHH:mm:ssZ" by default. -func formatSASTime(t *time.Time, format string) string { - if format != "" { - return t.Format(format) - } - return t.Format(SASTimeFormat) // By default, "yyyy-MM-ddTHH:mm:ssZ" is used -} - -// parseSASTimeString try to parse sas time string. -func parseSASTimeString(val string) (t time.Time, timeFormat string, err error) { - for _, sasTimeFormat := range SASTimeFormats { - t, err = time.Parse(sasTimeFormat, val) - if err == nil { - timeFormat = sasTimeFormat - break - } - } - - if err != nil { - err = errors.New("fail to parse time with IOS 8601 formats, please refer to https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas for more details") - } - - return -} - -// https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas - -// A SASQueryParameters object represents the components that make up an Azure Storage SAS' query parameters. -// You parse a map of query parameters into its fields by calling NewSASQueryParameters(). You add the components -// to a query parameter map by calling AddToValues(). -// NOTE: Changing any field requires computing a new SAS signature using a XxxSASSignatureValues type. -// -// This type defines the components used by all Azure Storage resources (Containers, Blobs, Files, & Queues). -type SASQueryParameters struct { - // All members are immutable or values so copies of this struct are goroutine-safe. - version string `param:"sv"` - services string `param:"ss"` - resourceTypes string `param:"srt"` - protocol SASProtocol `param:"spr"` - startTime time.Time `param:"st"` - expiryTime time.Time `param:"se"` - snapshotTime time.Time `param:"snapshot"` - ipRange IPRange `param:"sip"` - identifier string `param:"si"` - resource string `param:"sr"` - permissions string `param:"sp"` - signature string `param:"sig"` - cacheControl string `param:"rscc"` - contentDisposition string `param:"rscd"` - contentEncoding string `param:"rsce"` - contentLanguage string `param:"rscl"` - contentType string `param:"rsct"` - signedOid string `param:"skoid"` - signedTid string `param:"sktid"` - signedStart time.Time `param:"skt"` - signedExpiry time.Time `param:"ske"` - signedService string `param:"sks"` - signedVersion string `param:"skv"` - - // private member used for startTime and expiryTime formatting. - stTimeFormat string - seTimeFormat string -} - -func (p *SASQueryParameters) SignedOid() string { - return p.signedOid -} - -func (p *SASQueryParameters) SignedTid() string { - return p.signedTid -} - -func (p *SASQueryParameters) SignedStart() time.Time { - return p.signedStart -} - -func (p *SASQueryParameters) SignedExpiry() time.Time { - return p.signedExpiry -} - -func (p *SASQueryParameters) SignedService() string { - return p.signedService -} - -func (p *SASQueryParameters) SignedVersion() string { - return p.signedVersion -} - -func (p *SASQueryParameters) SnapshotTime() time.Time { - return p.snapshotTime -} - -func (p *SASQueryParameters) Version() string { - return p.version -} - -func (p *SASQueryParameters) Services() string { - return p.services -} -func (p *SASQueryParameters) ResourceTypes() string { - return p.resourceTypes -} -func (p *SASQueryParameters) Protocol() SASProtocol { - return p.protocol -} -func (p *SASQueryParameters) StartTime() time.Time { - return p.startTime -} -func (p *SASQueryParameters) ExpiryTime() time.Time { - return p.expiryTime -} - -func (p *SASQueryParameters) IPRange() IPRange { - return p.ipRange -} - -func (p *SASQueryParameters) Identifier() string { - return p.identifier -} - -func (p *SASQueryParameters) Resource() string { - return p.resource -} -func (p *SASQueryParameters) Permissions() string { - return p.permissions -} - -func (p *SASQueryParameters) Signature() string { - return p.signature -} - -func (p *SASQueryParameters) CacheControl() string { - return p.cacheControl -} - -func (p *SASQueryParameters) ContentDisposition() string { - return p.contentDisposition -} - -func (p *SASQueryParameters) ContentEncoding() string { - return p.contentEncoding -} - -func (p *SASQueryParameters) ContentLanguage() string { - return p.contentLanguage -} - -func (p *SASQueryParameters) ContentType() string { - return p.contentType -} - -// IPRange represents a SAS IP range's start IP and (optionally) end IP. -type IPRange struct { - Start net.IP // Not specified if length = 0 - End net.IP // Not specified if length = 0 -} - -// String returns a string representation of an IPRange. -func (ipr *IPRange) String() string { - if len(ipr.Start) == 0 { - return "" - } - start := ipr.Start.String() - if len(ipr.End) == 0 { - return start - } - return start + "-" + ipr.End.String() -} - -// NewSASQueryParameters creates and initializes a SASQueryParameters object based on the -// query parameter map's passed-in values. If deleteSASParametersFromValues is true, -// all SAS-related query parameters are removed from the passed-in map. If -// deleteSASParametersFromValues is false, the map passed-in map is unaltered. -func newSASQueryParameters(values url.Values, deleteSASParametersFromValues bool) SASQueryParameters { - p := SASQueryParameters{} - for k, v := range values { - val := v[0] - isSASKey := true - switch strings.ToLower(k) { - case "sv": - p.version = val - case "ss": - p.services = val - case "srt": - p.resourceTypes = val - case "spr": - p.protocol = SASProtocol(val) - case "snapshot": - p.snapshotTime, _ = time.Parse(SnapshotTimeFormat, val) - case "st": - p.startTime, p.stTimeFormat, _ = parseSASTimeString(val) - case "se": - p.expiryTime, p.seTimeFormat, _ = parseSASTimeString(val) - case "sip": - dashIndex := strings.Index(val, "-") - if dashIndex == -1 { - p.ipRange.Start = net.ParseIP(val) - } else { - p.ipRange.Start = net.ParseIP(val[:dashIndex]) - p.ipRange.End = net.ParseIP(val[dashIndex+1:]) - } - case "si": - p.identifier = val - case "sr": - p.resource = val - case "sp": - p.permissions = val - case "sig": - p.signature = val - case "rscc": - p.cacheControl = val - case "rscd": - p.contentDisposition = val - case "rsce": - p.contentEncoding = val - case "rscl": - p.contentLanguage = val - case "rsct": - p.contentType = val - case "skoid": - p.signedOid = val - case "sktid": - p.signedTid = val - case "skt": - p.signedStart, _ = time.Parse(SASTimeFormat, val) - case "ske": - p.signedExpiry, _ = time.Parse(SASTimeFormat, val) - case "sks": - p.signedService = val - case "skv": - p.signedVersion = val - default: - isSASKey = false // We didn't recognize the query parameter - } - if isSASKey && deleteSASParametersFromValues { - delete(values, k) - } - } - return p -} - -// AddToValues adds the SAS components to the specified query parameters map. -func (p *SASQueryParameters) addToValues(v url.Values) url.Values { - if p.version != "" { - v.Add("sv", p.version) - } - if p.services != "" { - v.Add("ss", p.services) - } - if p.resourceTypes != "" { - v.Add("srt", p.resourceTypes) - } - if p.protocol != "" { - v.Add("spr", string(p.protocol)) - } - if !p.startTime.IsZero() { - v.Add("st", formatSASTime(&(p.startTime), p.stTimeFormat)) - } - if !p.expiryTime.IsZero() { - v.Add("se", formatSASTime(&(p.expiryTime), p.seTimeFormat)) - } - if len(p.ipRange.Start) > 0 { - v.Add("sip", p.ipRange.String()) - } - if p.identifier != "" { - v.Add("si", p.identifier) - } - if p.resource != "" { - v.Add("sr", p.resource) - } - if p.permissions != "" { - v.Add("sp", p.permissions) - } - if p.signedOid != "" { - v.Add("skoid", p.signedOid) - v.Add("sktid", p.signedTid) - v.Add("skt", p.signedStart.Format(SASTimeFormat)) - v.Add("ske", p.signedExpiry.Format(SASTimeFormat)) - v.Add("sks", p.signedService) - v.Add("skv", p.signedVersion) - } - if p.signature != "" { - v.Add("sig", p.signature) - } - if p.cacheControl != "" { - v.Add("rscc", p.cacheControl) - } - if p.contentDisposition != "" { - v.Add("rscd", p.contentDisposition) - } - if p.contentEncoding != "" { - v.Add("rsce", p.contentEncoding) - } - if p.contentLanguage != "" { - v.Add("rscl", p.contentLanguage) - } - if p.contentType != "" { - v.Add("rsct", p.contentType) - } - return v -} - -// Encode encodes the SAS query parameters into URL encoded form sorted by key. -func (p *SASQueryParameters) Encode() string { - v := url.Values{} - p.addToValues(v) - return v.Encode() -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_service_codes_common.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_service_codes_common.go deleted file mode 100644 index 765beb241..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_service_codes_common.go +++ /dev/null @@ -1,131 +0,0 @@ -package azblob - -// https://docs.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes - -const ( - // ServiceCodeNone is the default value. It indicates that the error was related to the service or that the service didn't return a code. - ServiceCodeNone ServiceCodeType = "" - - // ServiceCodeAccountAlreadyExists means the specified account already exists. - ServiceCodeAccountAlreadyExists ServiceCodeType = "AccountAlreadyExists" - - // ServiceCodeAccountBeingCreated means the specified account is in the process of being created (403). - ServiceCodeAccountBeingCreated ServiceCodeType = "AccountBeingCreated" - - // ServiceCodeAccountIsDisabled means the specified account is disabled (403). - ServiceCodeAccountIsDisabled ServiceCodeType = "AccountIsDisabled" - - // ServiceCodeAuthenticationFailed means the server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature (403). - ServiceCodeAuthenticationFailed ServiceCodeType = "AuthenticationFailed" - - // ServiceCodeConditionHeadersNotSupported means the condition headers are not supported (400). - ServiceCodeConditionHeadersNotSupported ServiceCodeType = "ConditionHeadersNotSupported" - - // ServiceCodeConditionNotMet means the condition specified in the conditional header(s) was not met for a read/write operation (304/412). - ServiceCodeConditionNotMet ServiceCodeType = "ConditionNotMet" - - // ServiceCodeEmptyMetadataKey means the key for one of the metadata key-value pairs is empty (400). - ServiceCodeEmptyMetadataKey ServiceCodeType = "EmptyMetadataKey" - - // ServiceCodeInsufficientAccountPermissions means read operations are currently disabled or Write operations are not allowed or The account being accessed does not have sufficient permissions to execute this operation (403). - ServiceCodeInsufficientAccountPermissions ServiceCodeType = "InsufficientAccountPermissions" - - // ServiceCodeInternalError means the server encountered an internal error. Please retry the request (500). - ServiceCodeInternalError ServiceCodeType = "InternalError" - - // ServiceCodeInvalidAuthenticationInfo means the authentication information was not provided in the correct format. Verify the value of Authorization header (400). - ServiceCodeInvalidAuthenticationInfo ServiceCodeType = "InvalidAuthenticationInfo" - - // ServiceCodeInvalidHeaderValue means the value provided for one of the HTTP headers was not in the correct format (400). - ServiceCodeInvalidHeaderValue ServiceCodeType = "InvalidHeaderValue" - - // ServiceCodeInvalidHTTPVerb means the HTTP verb specified was not recognized by the server (400). - ServiceCodeInvalidHTTPVerb ServiceCodeType = "InvalidHttpVerb" - - // ServiceCodeInvalidInput means one of the request inputs is not valid (400). - ServiceCodeInvalidInput ServiceCodeType = "InvalidInput" - - // ServiceCodeInvalidMd5 means the MD5 value specified in the request is invalid. The MD5 value must be 128 bits and Base64-encoded (400). - ServiceCodeInvalidMd5 ServiceCodeType = "InvalidMd5" - - // ServiceCodeInvalidMetadata means the specified metadata is invalid. It includes characters that are not permitted (400). - ServiceCodeInvalidMetadata ServiceCodeType = "InvalidMetadata" - - // ServiceCodeInvalidQueryParameterValue means an invalid value was specified for one of the query parameters in the request URI (400). - ServiceCodeInvalidQueryParameterValue ServiceCodeType = "InvalidQueryParameterValue" - - // ServiceCodeInvalidRange means the range specified is invalid for the current size of the resource (416). - ServiceCodeInvalidRange ServiceCodeType = "InvalidRange" - - // ServiceCodeInvalidResourceName means the specified resource name contains invalid characters (400). - ServiceCodeInvalidResourceName ServiceCodeType = "InvalidResourceName" - - // ServiceCodeInvalidURI means the requested URI does not represent any resource on the server (400). - ServiceCodeInvalidURI ServiceCodeType = "InvalidUri" - - // ServiceCodeInvalidXMLDocument means the specified XML is not syntactically valid (400). - ServiceCodeInvalidXMLDocument ServiceCodeType = "InvalidXmlDocument" - - // ServiceCodeInvalidXMLNodeValue means the value provided for one of the XML nodes in the request body was not in the correct format (400). - ServiceCodeInvalidXMLNodeValue ServiceCodeType = "InvalidXmlNodeValue" - - // ServiceCodeMd5Mismatch means the MD5 value specified in the request did not match the MD5 value calculated by the server (400). - ServiceCodeMd5Mismatch ServiceCodeType = "Md5Mismatch" - - // ServiceCodeMetadataTooLarge means the size of the specified metadata exceeds the maximum size permitted (400). - ServiceCodeMetadataTooLarge ServiceCodeType = "MetadataTooLarge" - - // ServiceCodeMissingContentLengthHeader means the Content-Length header was not specified (411). - ServiceCodeMissingContentLengthHeader ServiceCodeType = "MissingContentLengthHeader" - - // ServiceCodeMissingRequiredQueryParameter means a required query parameter was not specified for this request (400). - ServiceCodeMissingRequiredQueryParameter ServiceCodeType = "MissingRequiredQueryParameter" - - // ServiceCodeMissingRequiredHeader means a required HTTP header was not specified (400). - ServiceCodeMissingRequiredHeader ServiceCodeType = "MissingRequiredHeader" - - // ServiceCodeMissingRequiredXMLNode means a required XML node was not specified in the request body (400). - ServiceCodeMissingRequiredXMLNode ServiceCodeType = "MissingRequiredXmlNode" - - // ServiceCodeMultipleConditionHeadersNotSupported means multiple condition headers are not supported (400). - ServiceCodeMultipleConditionHeadersNotSupported ServiceCodeType = "MultipleConditionHeadersNotSupported" - - // ServiceCodeOperationTimedOut means the operation could not be completed within the permitted time (500). - ServiceCodeOperationTimedOut ServiceCodeType = "OperationTimedOut" - - // ServiceCodeOutOfRangeInput means one of the request inputs is out of range (400). - ServiceCodeOutOfRangeInput ServiceCodeType = "OutOfRangeInput" - - // ServiceCodeOutOfRangeQueryParameterValue means a query parameter specified in the request URI is outside the permissible range (400). - ServiceCodeOutOfRangeQueryParameterValue ServiceCodeType = "OutOfRangeQueryParameterValue" - - // ServiceCodeRequestBodyTooLarge means the size of the request body exceeds the maximum size permitted (413). - ServiceCodeRequestBodyTooLarge ServiceCodeType = "RequestBodyTooLarge" - - // ServiceCodeResourceTypeMismatch means the specified resource type does not match the type of the existing resource (409). - ServiceCodeResourceTypeMismatch ServiceCodeType = "ResourceTypeMismatch" - - // ServiceCodeRequestURLFailedToParse means the url in the request could not be parsed (400). - ServiceCodeRequestURLFailedToParse ServiceCodeType = "RequestUrlFailedToParse" - - // ServiceCodeResourceAlreadyExists means the specified resource already exists (409). - ServiceCodeResourceAlreadyExists ServiceCodeType = "ResourceAlreadyExists" - - // ServiceCodeResourceNotFound means the specified resource does not exist (404). - ServiceCodeResourceNotFound ServiceCodeType = "ResourceNotFound" - - // ServiceCodeServerBusy means the server is currently unable to receive requests. Please retry your request or Ingress/egress is over the account limit or operations per second is over the account limit (503). - ServiceCodeServerBusy ServiceCodeType = "ServerBusy" - - // ServiceCodeUnsupportedHeader means one of the HTTP headers specified in the request is not supported (400). - ServiceCodeUnsupportedHeader ServiceCodeType = "UnsupportedHeader" - - // ServiceCodeUnsupportedXMLNode means one of the XML nodes specified in the request body is not supported (400). - ServiceCodeUnsupportedXMLNode ServiceCodeType = "UnsupportedXmlNode" - - // ServiceCodeUnsupportedQueryParameter means one of the query parameters specified in the request URI is not supported (400). - ServiceCodeUnsupportedQueryParameter ServiceCodeType = "UnsupportedQueryParameter" - - // ServiceCodeUnsupportedHTTPVerb means the resource doesn't support the specified HTTP verb (405). - ServiceCodeUnsupportedHTTPVerb ServiceCodeType = "UnsupportedHttpVerb" -) diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_storage_error.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_storage_error.go deleted file mode 100644 index e7872a8a3..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_storage_error.go +++ /dev/null @@ -1,111 +0,0 @@ -package azblob - -import ( - "bytes" - "encoding/xml" - "fmt" - "net/http" - "sort" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -func init() { - // wire up our custom error handling constructor - responseErrorFactory = newStorageError -} - -// ServiceCodeType is a string identifying a storage service error. -// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/status-and-error-codes2 -type ServiceCodeType string - -// StorageError identifies a responder-generated network or response parsing error. -type StorageError interface { - // ResponseError implements error's Error(), net.Error's Temporary() and Timeout() methods & Response(). - ResponseError - - // ServiceCode returns a service error code. Your code can use this to make error recovery decisions. - ServiceCode() ServiceCodeType -} - -// storageError is the internal struct that implements the public StorageError interface. -type storageError struct { - responseError - serviceCode ServiceCodeType - details map[string]string -} - -// newStorageError creates an error object that implements the error interface. -func newStorageError(cause error, response *http.Response, description string) error { - return &storageError{ - responseError: responseError{ - ErrorNode: pipeline.ErrorNode{}.Initialize(cause, 3), - response: response, - description: description, - }, - serviceCode: ServiceCodeType(response.Header.Get("x-ms-error-code")), - } -} - -// ServiceCode returns service-error information. The caller may examine these values but should not modify any of them. -func (e *storageError) ServiceCode() ServiceCodeType { - return e.serviceCode -} - -// Error implements the error interface's Error method to return a string representation of the error. -func (e *storageError) Error() string { - b := &bytes.Buffer{} - fmt.Fprintf(b, "===== RESPONSE ERROR (ServiceCode=%s) =====\n", e.serviceCode) - fmt.Fprintf(b, "Description=%s, Details: ", e.description) - if len(e.details) == 0 { - b.WriteString("(none)\n") - } else { - b.WriteRune('\n') - keys := make([]string, 0, len(e.details)) - // Alphabetize the details - for k := range e.details { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - fmt.Fprintf(b, " %s: %+v\n", k, e.details[k]) - } - } - req := pipeline.Request{Request: e.response.Request}.Copy() // Make a copy of the response's request - pipeline.WriteRequestWithResponse(b, prepareRequestForLogging(req), e.response, nil) - return e.ErrorNode.Error(b.String()) -} - -// Temporary returns true if the error occurred due to a temporary condition (including an HTTP status of 500 or 503). -func (e *storageError) Temporary() bool { - if e.response != nil { - if (e.response.StatusCode == http.StatusInternalServerError) || (e.response.StatusCode == http.StatusServiceUnavailable) { - return true - } - } - return e.ErrorNode.Temporary() -} - -// UnmarshalXML performs custom unmarshalling of XML-formatted Azure storage request errors. -func (e *storageError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error) { - tokName := "" - var t xml.Token - for t, err = d.Token(); err == nil; t, err = d.Token() { - switch tt := t.(type) { - case xml.StartElement: - tokName = tt.Name.Local - break - case xml.CharData: - switch tokName { - case "Message": - e.description = string(tt) - default: - if e.details == nil { - e.details = map[string]string{} - } - e.details[tokName] = string(tt) - } - } - } - return nil -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_util_validate.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_util_validate.go deleted file mode 100644 index d7b2507e4..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_util_validate.go +++ /dev/null @@ -1,64 +0,0 @@ -package azblob - -import ( - "errors" - "fmt" - "io" - "strconv" -) - -// httpRange defines a range of bytes within an HTTP resource, starting at offset and -// ending at offset+count. A zero-value httpRange indicates the entire resource. An httpRange -// which has an offset but na zero value count indicates from the offset to the resource's end. -type httpRange struct { - offset int64 - count int64 -} - -func (r httpRange) pointers() *string { - if r.offset == 0 && r.count == CountToEnd { // Do common case first for performance - return nil // No specified range - } - endOffset := "" // if count == CountToEnd (0) - if r.count > 0 { - endOffset = strconv.FormatInt((r.offset+r.count)-1, 10) - } - dataRange := fmt.Sprintf("bytes=%v-%s", r.offset, endOffset) - return &dataRange -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -func validateSeekableStreamAt0AndGetCount(body io.ReadSeeker) (int64, error) { - if body == nil { // nil body's are "logically" seekable to 0 and are 0 bytes long - return 0, nil - } - - err := validateSeekableStreamAt0(body) - if err != nil { - return 0, err - } - - count, err := body.Seek(0, io.SeekEnd) - if err != nil { - return 0, errors.New("body stream must be seekable") - } - - body.Seek(0, io.SeekStart) - return count, nil -} - -// return an error if body is not a valid seekable stream at 0 -func validateSeekableStreamAt0(body io.ReadSeeker) error { - if body == nil { // nil body's are "logically" seekable to 0 - return nil - } - if pos, err := body.Seek(0, io.SeekCurrent); pos != 0 || err != nil { - // Help detect programmer error - if err != nil { - return errors.New("body stream must be seekable") - } - return errors.New("body stream must be set to position 0") - } - return nil -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_uuid.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_uuid.go deleted file mode 100644 index 66799f9cb..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_uuid.go +++ /dev/null @@ -1,77 +0,0 @@ -package azblob - -import ( - "crypto/rand" - "fmt" - "strconv" -) - -// The UUID reserved variants. -const ( - reservedNCS byte = 0x80 - reservedRFC4122 byte = 0x40 - reservedMicrosoft byte = 0x20 - reservedFuture byte = 0x00 -) - -// A UUID representation compliant with specification in RFC 4122 document. -type uuid [16]byte - -// NewUUID returns a new uuid using RFC 4122 algorithm. -func newUUID() (u uuid) { - u = uuid{} - // Set all bits to randomly (or pseudo-randomly) chosen values. - rand.Read(u[:]) - u[8] = (u[8] | reservedRFC4122) & 0x7F // u.setVariant(ReservedRFC4122) - - var version byte = 4 - u[6] = (u[6] & 0xF) | (version << 4) // u.setVersion(4) - return -} - -// String returns an unparsed version of the generated UUID sequence. -func (u uuid) String() string { - return fmt.Sprintf("%x-%x-%x-%x-%x", u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) -} - -// ParseUUID parses a string formatted as "003020100-0504-0706-0809-0a0b0c0d0e0f" -// or "{03020100-0504-0706-0809-0a0b0c0d0e0f}" into a UUID. -func parseUUID(uuidStr string) uuid { - char := func(hexString string) byte { - i, _ := strconv.ParseUint(hexString, 16, 8) - return byte(i) - } - if uuidStr[0] == '{' { - uuidStr = uuidStr[1:] // Skip over the '{' - } - // 03020100 - 05 04 - 07 06 - 08 09 - 0a 0b 0c 0d 0e 0f - // 1 11 1 11 11 1 12 22 2 22 22 22 33 33 33 - // 01234567 8 90 12 3 45 67 8 90 12 3 45 67 89 01 23 45 - uuidVal := uuid{ - char(uuidStr[0:2]), - char(uuidStr[2:4]), - char(uuidStr[4:6]), - char(uuidStr[6:8]), - - char(uuidStr[9:11]), - char(uuidStr[11:13]), - - char(uuidStr[14:16]), - char(uuidStr[16:18]), - - char(uuidStr[19:21]), - char(uuidStr[21:23]), - - char(uuidStr[24:26]), - char(uuidStr[26:28]), - char(uuidStr[28:30]), - char(uuidStr[30:32]), - char(uuidStr[32:34]), - char(uuidStr[34:36]), - } - return uuidVal -} - -func (u uuid) bytes() []byte { - return u[:] -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zt_doc.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zt_doc.go deleted file mode 100644 index 6b3779c0e..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zt_doc.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2017 Microsoft Corporation. All rights reserved. -// Use of this source code is governed by an MIT -// license that can be found in the LICENSE file. - -/* -Package azblob allows you to manipulate Azure Storage containers and blobs objects. - -URL Types - -The most common types you'll work with are the XxxURL types. The methods of these types make requests -against the Azure Storage Service. - - - ServiceURL's methods perform operations on a storage account. - - ContainerURL's methods perform operations on an account's container. - - BlockBlobURL's methods perform operations on a container's block blob. - - AppendBlobURL's methods perform operations on a container's append blob. - - PageBlobURL's methods perform operations on a container's page blob. - - BlobURL's methods perform operations on a container's blob regardless of the blob's type. - -Internally, each XxxURL object contains a URL and a request pipeline. The URL indicates the endpoint where each HTTP -request is sent and the pipeline indicates how the outgoing HTTP request and incoming HTTP response is processed. -The pipeline specifies things like retry policies, logging, deserialization of HTTP response payloads, and more. - -Pipelines are threadsafe and may be shared by multiple XxxURL objects. When you create a ServiceURL, you pass -an initial pipeline. When you call ServiceURL's NewContainerURL method, the new ContainerURL object has its own -URL but it shares the same pipeline as the parent ServiceURL object. - -To work with a blob, call one of ContainerURL's 4 NewXxxBlobURL methods depending on how you want to treat the blob. -To treat the blob as a block blob, append blob, or page blob, call NewBlockBlobURL, NewAppendBlobURL, or NewPageBlobURL -respectively. These three types are all identical except for the methods they expose; each type exposes the methods -relevant to the type of blob represented. If you're not sure how you want to treat a blob, you can call NewBlobURL; -this returns an object whose methods are relevant to any kind of blob. When you call ContainerURL's NewXxxBlobURL, -the new XxxBlobURL object has its own URL but it shares the same pipeline as the parent ContainerURL object. You -can easily switch between blob types (method sets) by calling a ToXxxBlobURL method. - -If you'd like to use a different pipeline with a ServiceURL, ContainerURL, or XxxBlobURL object, then call the XxxURL -object's WithPipeline method passing in the desired pipeline. The WithPipeline methods create a new XxxURL object -with the same URL as the original but with the specified pipeline. - -Note that XxxURL objects use little memory, are goroutine-safe, and many objects share the same pipeline. This means that -XxxURL objects share a lot of system resources making them very efficient. - -All of XxxURL's methods that make HTTP requests return rich error handling information so you can discern network failures, -transient failures, timeout failures, service failures, etc. See the StorageError interface for more information and an -example of how to do deal with errors. - -URL and Shared Access Signature Manipulation - -The library includes a BlobURLParts type for deconstructing and reconstructing URLs. And you can use the following types -for generating and parsing Shared Access Signature (SAS) - - Use the AccountSASSignatureValues type to create a SAS for a storage account. - - Use the BlobSASSignatureValues type to create a SAS for a container or blob. - - Use the SASQueryParameters type to turn signature values in to query parameres or to parse query parameters. - -To generate a SAS, you must use the SharedKeyCredential type. - -Credentials - -When creating a request pipeline, you must specify one of this package's credential types. - - Call the NewAnonymousCredential function for requests that contain a Shared Access Signature (SAS). - - Call the NewSharedKeyCredential function (with an account name & key) to access any account resources. You must also use this - to generate Shared Access Signatures. - -HTTP Request Policy Factories - -This package defines several request policy factories for use with the pipeline package. -Most applications will not use these factories directly; instead, the NewPipeline -function creates these factories, initializes them (via the PipelineOptions type) -and returns a pipeline object for use by the XxxURL objects. - -However, for advanced scenarios, developers can access these policy factories directly -and even create their own and then construct their own pipeline in order to affect HTTP -requests and responses performed by the XxxURL objects. For example, developers can -introduce their own logging, random failures, request recording & playback for fast -testing, HTTP request pacing, alternate retry mechanisms, metering, metrics, etc. The -possibilities are endless! - -Below are the request pipeline policy factory functions that are provided with this -package: - - NewRetryPolicyFactory Enables rich retry semantics for failed HTTP requests. - - NewRequestLogPolicyFactory Enables rich logging support for HTTP requests/responses & failures. - - NewTelemetryPolicyFactory Enables simple modification of the HTTP request's User-Agent header so each request reports the SDK version & language/runtime making the requests. - - NewUniqueRequestIDPolicyFactory Adds a x-ms-client-request-id header with a unique UUID value to an HTTP request to help with diagnosing failures. - -Also, note that all the NewXxxCredential functions return request policy factory objects which get injected into the pipeline. -*/ -package azblob - -// TokenCredential Use this to access resources using Role-Based Access Control (RBAC). diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_append_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_append_blob.go deleted file mode 100644 index f17c7f887..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_append_blob.go +++ /dev/null @@ -1,403 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/base64" - "github.com/Azure/azure-pipeline-go/pipeline" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "time" -) - -// appendBlobClient is the client for the AppendBlob methods of the Azblob service. -type appendBlobClient struct { - managementClient -} - -// newAppendBlobClient creates an instance of the appendBlobClient client. -func newAppendBlobClient(url url.URL, p pipeline.Pipeline) appendBlobClient { - return appendBlobClient{newManagementClient(url, p)} -} - -// AppendBlock the Append Block operation commits a new block of data to the end of an existing append blob. The Append -// Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is -// supported only on version 2015-02-21 version or later. -// -// body is initial data body will be closed upon successful return. Callers should ensure closure when receiving an -// error.contentLength is the length of the request. timeout is the timeout parameter is expressed in seconds. For more -// information, see Setting -// Timeouts for Blob Service Operations. transactionalContentMD5 is specify the transactional md5 for the body, to -// be validated by the service. transactionalContentCrc64 is specify the transactional crc64 for the body, to be -// validated by the service. leaseID is if specified, the operation only succeeds if the resource's lease is active and -// matches this ID. maxSize is optional conditional header. The max length in bytes permitted for the append blob. If -// the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the -// value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - -// Precondition Failed). appendPosition is optional conditional header, used only for the Append Block operation. A -// number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this -// number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - -// Precondition Failed). encryptionKey is optional. Specifies the encryption key to use to encrypt the data provided in -// the request. If not specified, encryption is performed with the root account encryption key. For more information, -// see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the provided -// encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the algorithm -// used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the -// x-ms-encryption-key header is provided. ifModifiedSince is specify this header value to operate only on a blob if it -// has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a -// blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on -// blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics -// logs when storage analytics logging is enabled. -func (client appendBlobClient) AppendBlock(ctx context.Context, body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, leaseID *string, maxSize *int64, appendPosition *int64, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*AppendBlobAppendBlockResponse, error) { - if err := validate([]validation{ - {targetValue: body, - constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.appendBlockPreparer(body, contentLength, timeout, transactionalContentMD5, transactionalContentCrc64, leaseID, maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.appendBlockResponder}, req) - if err != nil { - return nil, err - } - return resp.(*AppendBlobAppendBlockResponse), err -} - -// appendBlockPreparer prepares the AppendBlock request. -func (client appendBlobClient) appendBlockPreparer(body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, leaseID *string, maxSize *int64, appendPosition *int64, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, body) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "appendblock") - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if transactionalContentMD5 != nil { - req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5)) - } - if transactionalContentCrc64 != nil { - req.Header.Set("x-ms-content-crc64", base64.StdEncoding.EncodeToString(transactionalContentCrc64)) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if maxSize != nil { - req.Header.Set("x-ms-blob-condition-maxsize", strconv.FormatInt(*maxSize, 10)) - } - if appendPosition != nil { - req.Header.Set("x-ms-blob-condition-appendpos", strconv.FormatInt(*appendPosition, 10)) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// appendBlockResponder handles the response to the AppendBlock request. -func (client appendBlobClient) appendBlockResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &AppendBlobAppendBlockResponse{rawResponse: resp.Response()}, err -} - -// AppendBlockFromURL the Append Block operation commits a new block of data to the end of an existing append blob -// where the contents are read from a source url. The Append Block operation is permitted only if the blob was created -// with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. -// -// sourceURL is specify a URL to the copy source. contentLength is the length of the request. sourceRange is bytes of -// source data in the specified range. sourceContentMD5 is specify the md5 calculated for the range of bytes that must -// be read from the copy source. sourceContentcrc64 is specify the crc64 calculated for the range of bytes that must be -// read from the copy source. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. transactionalContentMD5 is specify the transactional md5 for the body, to -// be validated by the service. encryptionKey is optional. Specifies the encryption key to use to encrypt the data -// provided in the request. If not specified, encryption is performed with the root account encryption key. For more -// information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the -// provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the -// algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided -// if the x-ms-encryption-key header is provided. leaseID is if specified, the operation only succeeds if the -// resource's lease is active and matches this ID. maxSize is optional conditional header. The max length in bytes -// permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the -// blob size is already greater than the value specified in this header, the request will fail with -// MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). appendPosition is optional -// conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append -// Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the -// AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). ifModifiedSince is specify this -// header value to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is -// specify this header value to operate only on a blob if it has not been modified since the specified date/time. -// ifMatch is specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag -// value to operate only on blobs without a matching value. sourceIfModifiedSince is specify this header value to -// operate only on a blob if it has been modified since the specified date/time. sourceIfUnmodifiedSince is specify -// this header value to operate only on a blob if it has not been modified since the specified date/time. sourceIfMatch -// is specify an ETag value to operate only on blobs with a matching value. sourceIfNoneMatch is specify an ETag value -// to operate only on blobs without a matching value. requestID is provides a client-generated, opaque value with a 1 -// KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client appendBlobClient) AppendBlockFromURL(ctx context.Context, sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, transactionalContentMD5 []byte, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (*AppendBlobAppendBlockFromURLResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.appendBlockFromURLPreparer(sourceURL, contentLength, sourceRange, sourceContentMD5, sourceContentcrc64, timeout, transactionalContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseID, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.appendBlockFromURLResponder}, req) - if err != nil { - return nil, err - } - return resp.(*AppendBlobAppendBlockFromURLResponse), err -} - -// appendBlockFromURLPreparer prepares the AppendBlockFromURL request. -func (client appendBlobClient) appendBlockFromURLPreparer(sourceURL string, contentLength int64, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, transactionalContentMD5 []byte, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, leaseID *string, maxSize *int64, appendPosition *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "appendblock") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-copy-source", sourceURL) - if sourceRange != nil { - req.Header.Set("x-ms-source-range", *sourceRange) - } - if sourceContentMD5 != nil { - req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5)) - } - if sourceContentcrc64 != nil { - req.Header.Set("x-ms-source-content-crc64", base64.StdEncoding.EncodeToString(sourceContentcrc64)) - } - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if transactionalContentMD5 != nil { - req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5)) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if maxSize != nil { - req.Header.Set("x-ms-blob-condition-maxsize", strconv.FormatInt(*maxSize, 10)) - } - if appendPosition != nil { - req.Header.Set("x-ms-blob-condition-appendpos", strconv.FormatInt(*appendPosition, 10)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - if sourceIfModifiedSince != nil { - req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfUnmodifiedSince != nil { - req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfMatch != nil { - req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) - } - if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// appendBlockFromURLResponder handles the response to the AppendBlockFromURL request. -func (client appendBlobClient) appendBlockFromURLResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &AppendBlobAppendBlockFromURLResponse{rawResponse: resp.Response()}, err -} - -// Create the Create Append Blob operation creates a new append blob. -// -// contentLength is the length of the request. timeout is the timeout parameter is expressed in seconds. For more -// information, see Setting -// Timeouts for Blob Service Operations. blobContentType is optional. Sets the blob's content type. If specified, -// this property is stored with the blob and returned with a read request. blobContentEncoding is optional. Sets the -// blob's content encoding. If specified, this property is stored with the blob and returned with a read request. -// blobContentLanguage is optional. Set the blob's content language. If specified, this property is stored with the -// blob and returned with a read request. blobContentMD5 is optional. An MD5 hash of the blob content. Note that this -// hash is not validated, as the hashes for the individual blocks were validated when each was uploaded. -// blobCacheControl is optional. Sets the blob's cache control. If specified, this property is stored with the blob and -// returned with a read request. metadata is optional. Specifies a user-defined name-value pair associated with the -// blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the -// destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified -// metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, -// metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and -// Metadata for more information. leaseID is if specified, the operation only succeeds if the resource's lease is -// active and matches this ID. blobContentDisposition is optional. Sets the blob's Content-Disposition header. -// encryptionKey is optional. Specifies the encryption key to use to encrypt the data provided in the request. If not -// specified, encryption is performed with the root account encryption key. For more information, see Encryption at -// Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the provided encryption key. Must be -// provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the algorithm used to produce the -// encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key -// header is provided. ifModifiedSince is specify this header value to operate only on a blob if it has been modified -// since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has -// not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a -// matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. requestID is -// provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when -// storage analytics logging is enabled. -func (client appendBlobClient) Create(ctx context.Context, contentLength int64, timeout *int32, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*AppendBlobCreateResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.createPreparer(contentLength, timeout, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5, blobCacheControl, metadata, leaseID, blobContentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createResponder}, req) - if err != nil { - return nil, err - } - return resp.(*AppendBlobCreateResponse), err -} - -// createPreparer prepares the Create request. -func (client appendBlobClient) createPreparer(contentLength int64, timeout *int32, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if blobContentType != nil { - req.Header.Set("x-ms-blob-content-type", *blobContentType) - } - if blobContentEncoding != nil { - req.Header.Set("x-ms-blob-content-encoding", *blobContentEncoding) - } - if blobContentLanguage != nil { - req.Header.Set("x-ms-blob-content-language", *blobContentLanguage) - } - if blobContentMD5 != nil { - req.Header.Set("x-ms-blob-content-md5", base64.StdEncoding.EncodeToString(blobContentMD5)) - } - if blobCacheControl != nil { - req.Header.Set("x-ms-blob-cache-control", *blobCacheControl) - } - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if blobContentDisposition != nil { - req.Header.Set("x-ms-blob-content-disposition", *blobContentDisposition) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-blob-type", "AppendBlob") - return req, nil -} - -// createResponder handles the response to the Create request. -func (client appendBlobClient) createResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &AppendBlobCreateResponse{rawResponse: resp.Response()}, err -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_blob.go deleted file mode 100644 index 492dfdb2c..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_blob.go +++ /dev/null @@ -1,1620 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/base64" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "time" - - "github.com/Azure/azure-pipeline-go/pipeline" -) - -// blobClient is the client for the Blob methods of the Azblob service. -type blobClient struct { - managementClient -} - -// newBlobClient creates an instance of the blobClient client. -func newBlobClient(url url.URL, p pipeline.Pipeline) blobClient { - return blobClient{newManagementClient(url, p)} -} - -// AbortCopyFromURL the Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a -// destination blob with zero length and full metadata. -// -// copyID is the copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. timeout is -// the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) AbortCopyFromURL(ctx context.Context, copyID string, timeout *int32, leaseID *string, requestID *string) (*BlobAbortCopyFromURLResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.abortCopyFromURLPreparer(copyID, timeout, leaseID, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.abortCopyFromURLResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobAbortCopyFromURLResponse), err -} - -// abortCopyFromURLPreparer prepares the AbortCopyFromURL request. -func (client blobClient) abortCopyFromURLPreparer(copyID string, timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - params.Set("copyid", copyID) - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "copy") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-copy-action", "abort") - return req, nil -} - -// abortCopyFromURLResponder handles the response to the AbortCopyFromURL request. -func (client blobClient) abortCopyFromURLResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusNoContent) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobAbortCopyFromURLResponse{rawResponse: resp.Response()}, err -} - -// AcquireLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete -// operations -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. duration is specifies the duration of the lease, in seconds, or negative -// one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration -// cannot be changed using renew or change. proposedLeaseID is proposed lease ID, in a GUID string format. The Blob -// service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor -// (String) for a list of valid GUID string formats. ifModifiedSince is specify this header value to operate only on a -// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to -// operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value -// to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs -// without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is -// recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) AcquireLease(ctx context.Context, timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobAcquireLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.acquireLeasePreparer(timeout, duration, proposedLeaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.acquireLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobAcquireLeaseResponse), err -} - -// acquireLeasePreparer prepares the AcquireLease request. -func (client blobClient) acquireLeasePreparer(timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - req.URL.RawQuery = params.Encode() - if duration != nil { - req.Header.Set("x-ms-lease-duration", strconv.FormatInt(int64(*duration), 10)) - } - if proposedLeaseID != nil { - req.Header.Set("x-ms-proposed-lease-id", *proposedLeaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "acquire") - return req, nil -} - -// acquireLeaseResponder handles the response to the AcquireLease request. -func (client blobClient) acquireLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobAcquireLeaseResponse{rawResponse: resp.Response()}, err -} - -// BreakLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete -// operations -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. breakPeriod is for a break operation, proposed duration the lease should -// continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the -// time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available -// before the break period has expired, but the lease may be held for longer than the break period. If this header does -// not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an -// infinite lease breaks immediately. ifModifiedSince is specify this header value to operate only on a blob if it has -// been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a -// blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on -// blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics -// logs when storage analytics logging is enabled. -func (client blobClient) BreakLease(ctx context.Context, timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobBreakLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.breakLeasePreparer(timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.breakLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobBreakLeaseResponse), err -} - -// breakLeasePreparer prepares the BreakLease request. -func (client blobClient) breakLeasePreparer(timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - req.URL.RawQuery = params.Encode() - if breakPeriod != nil { - req.Header.Set("x-ms-lease-break-period", strconv.FormatInt(int64(*breakPeriod), 10)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "break") - return req, nil -} - -// breakLeaseResponder handles the response to the BreakLease request. -func (client blobClient) breakLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobBreakLeaseResponse{rawResponse: resp.Response()}, err -} - -// ChangeLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete -// operations -// -// leaseID is specifies the current lease ID on the resource. proposedLeaseID is proposed lease ID, in a GUID string -// format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See -// Guid Constructor (String) for a list of valid GUID string formats. timeout is the timeout parameter is expressed in -// seconds. For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate -// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a -// matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded -// in the analytics logs when storage analytics logging is enabled. -func (client blobClient) ChangeLease(ctx context.Context, leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobChangeLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.changeLeasePreparer(leaseID, proposedLeaseID, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.changeLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobChangeLeaseResponse), err -} - -// changeLeasePreparer prepares the ChangeLease request. -func (client blobClient) changeLeasePreparer(leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-lease-id", leaseID) - req.Header.Set("x-ms-proposed-lease-id", proposedLeaseID) - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "change") - return req, nil -} - -// changeLeaseResponder handles the response to the ChangeLease request. -func (client blobClient) changeLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobChangeLeaseResponse{rawResponse: resp.Response()}, err -} - -// CopyFromURL the Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a -// response until the copy is complete. -// -// copySource is specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that -// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob -// must either be public or must be authenticated via a shared access signature. timeout is the timeout parameter is -// expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. metadata is optional. Specifies a user-defined name-value pair associated -// with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or -// file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with -// the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version -// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing -// Containers, Blobs, and Metadata for more information. tier is optional. Indicates the tier to be set on the blob. -// sourceIfModifiedSince is specify this header value to operate only on a blob if it has been modified since the -// specified date/time. sourceIfUnmodifiedSince is specify this header value to operate only on a blob if it has not -// been modified since the specified date/time. sourceIfMatch is specify an ETag value to operate only on blobs with a -// matching value. sourceIfNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// ifModifiedSince is specify this header value to operate only on a blob if it has been modified since the specified -// date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified -// since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching value. -// ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. leaseID is if specified, the -// operation only succeeds if the resource's lease is active and matches this ID. requestID is provides a -// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage -// analytics logging is enabled. sourceContentMD5 is specify the md5 calculated for the range of bytes that must be -// read from the copy source. -func (client blobClient) CopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, leaseID *string, requestID *string, sourceContentMD5 []byte) (*BlobCopyFromURLResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.copyFromURLPreparer(copySource, timeout, metadata, tier, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, leaseID, requestID, sourceContentMD5) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.copyFromURLResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobCopyFromURLResponse), err -} - -// copyFromURLPreparer prepares the CopyFromURL request. -func (client blobClient) copyFromURLPreparer(copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, leaseID *string, requestID *string, sourceContentMD5 []byte) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if tier != AccessTierNone { - req.Header.Set("x-ms-access-tier", string(tier)) - } - if sourceIfModifiedSince != nil { - req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfUnmodifiedSince != nil { - req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfMatch != nil { - req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) - } - if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-copy-source", copySource) - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - if sourceContentMD5 != nil { - req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5)) - } - req.Header.Set("x-ms-requires-sync", "true") - return req, nil -} - -// copyFromURLResponder handles the response to the CopyFromURL request. -func (client blobClient) copyFromURLResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobCopyFromURLResponse{rawResponse: resp.Response()}, err -} - -// CreateSnapshot the Create Snapshot operation creates a read-only snapshot of a blob -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. metadata is optional. Specifies a user-defined name-value pair associated -// with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or -// file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with -// the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version -// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing -// Containers, Blobs, and Metadata for more information. encryptionKey is optional. Specifies the encryption key to use -// to encrypt the data provided in the request. If not specified, encryption is performed with the root account -// encryption key. For more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the -// SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. -// encryptionAlgorithm is the algorithm used to produce the encryption key hash. Currently, the only accepted value is -// "AES256". Must be provided if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header -// value to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify -// this header value to operate only on a blob if it has not been modified since the specified date/time. ifMatch is -// specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to -// operate only on blobs without a matching value. leaseID is if specified, the operation only succeeds if the -// resource's lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) CreateSnapshot(ctx context.Context, timeout *int32, metadata map[string]string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, leaseID *string, requestID *string) (*BlobCreateSnapshotResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.createSnapshotPreparer(timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, leaseID, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createSnapshotResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobCreateSnapshotResponse), err -} - -// createSnapshotPreparer prepares the CreateSnapshot request. -func (client blobClient) createSnapshotPreparer(timeout *int32, metadata map[string]string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, leaseID *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "snapshot") - req.URL.RawQuery = params.Encode() - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// createSnapshotResponder handles the response to the CreateSnapshot request. -func (client blobClient) createSnapshotResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobCreateSnapshotResponse{rawResponse: resp.Response()}, err -} - -// Delete if the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently -// removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is -// deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob -// or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] -// (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently -// removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it -// is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which -// blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. -// All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 -// (ResourceNotFound). -// -// snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to -// retrieve. For more information on working with blob snapshots, see Creating -// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. deleteSnapshots is required if the blob has associated snapshots. Specify one -// of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's -// snapshots and not the blob itself ifModifiedSince is specify this header value to operate only on a blob if it has -// been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a -// blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on -// blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics -// logs when storage analytics logging is enabled. -func (client blobClient) Delete(ctx context.Context, snapshot *string, timeout *int32, leaseID *string, deleteSnapshots DeleteSnapshotsOptionType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobDeleteResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.deletePreparer(snapshot, timeout, leaseID, deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.deleteResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobDeleteResponse), err -} - -// deletePreparer prepares the Delete request. -func (client blobClient) deletePreparer(snapshot *string, timeout *int32, leaseID *string, deleteSnapshots DeleteSnapshotsOptionType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("DELETE", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if snapshot != nil && len(*snapshot) > 0 { - params.Set("snapshot", *snapshot) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if deleteSnapshots != DeleteSnapshotsOptionNone { - req.Header.Set("x-ms-delete-snapshots", string(deleteSnapshots)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// deleteResponder handles the response to the Delete request. -func (client blobClient) deleteResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobDeleteResponse{rawResponse: resp.Response()}, err -} - -// Download the Download operation reads or downloads a blob from the system, including its metadata and properties. -// You can also call Download to read a snapshot. -// -// snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to -// retrieve. For more information on working with blob snapshots, see Creating -// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. rangeParameter is return only the bytes of the blob in the specified -// range. leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID. -// rangeGetContentMD5 is when set to true and specified together with the Range, the service returns the MD5 hash for -// the range, as long as the range is less than or equal to 4 MB in size. rangeGetContentCRC64 is when set to true and -// specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less -// than or equal to 4 MB in size. encryptionKey is optional. Specifies the encryption key to use to encrypt the data -// provided in the request. If not specified, encryption is performed with the root account encryption key. For more -// information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the -// provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the -// algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided -// if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header value to operate only on a -// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to -// operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value -// to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs -// without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is -// recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) Download(ctx context.Context, snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, rangeGetContentMD5 *bool, rangeGetContentCRC64 *bool, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*downloadResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.downloadPreparer(snapshot, timeout, rangeParameter, leaseID, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.downloadResponder}, req) - if err != nil { - return nil, err - } - return resp.(*downloadResponse), err -} - -// downloadPreparer prepares the Download request. -func (client blobClient) downloadPreparer(snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, rangeGetContentMD5 *bool, rangeGetContentCRC64 *bool, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if snapshot != nil && len(*snapshot) > 0 { - params.Set("snapshot", *snapshot) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - if rangeParameter != nil { - req.Header.Set("x-ms-range", *rangeParameter) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if rangeGetContentMD5 != nil { - req.Header.Set("x-ms-range-get-content-md5", strconv.FormatBool(*rangeGetContentMD5)) - } - if rangeGetContentCRC64 != nil { - req.Header.Set("x-ms-range-get-content-crc64", strconv.FormatBool(*rangeGetContentCRC64)) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// downloadResponder handles the response to the Download request. -func (client blobClient) downloadResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusPartialContent) - if resp == nil { - return nil, err - } - return &downloadResponse{rawResponse: resp.Response()}, err -} - -// GetAccessControl get the owner, group, permissions, or access control list for a blob. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. upn is optional. Valid only when Hierarchical Namespace is enabled for the -// account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will -// be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be -// returned as Azure Active Directory Object IDs. The default value is false. leaseID is if specified, the operation -// only succeeds if the resource's lease is active and matches this ID. ifMatch is specify an ETag value to operate -// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a -// matching value. ifModifiedSince is specify this header value to operate only on a blob if it has been modified since -// the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been -// modified since the specified date/time. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) GetAccessControl(ctx context.Context, timeout *int32, upn *bool, leaseID *string, ifMatch *ETag, ifNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*BlobGetAccessControlResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getAccessControlPreparer(timeout, upn, leaseID, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccessControlResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobGetAccessControlResponse), err -} - -// getAccessControlPreparer prepares the GetAccessControl request. -func (client blobClient) getAccessControlPreparer(timeout *int32, upn *bool, leaseID *string, ifMatch *ETag, ifNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("HEAD", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - if upn != nil { - params.Set("upn", strconv.FormatBool(*upn)) - } - params.Set("action", "getAccessControl") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// getAccessControlResponder handles the response to the GetAccessControl request. -func (client blobClient) getAccessControlResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobGetAccessControlResponse{rawResponse: resp.Response()}, err -} - -// GetAccountInfo returns the sku name and account kind -func (client blobClient) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error) { - req, err := client.getAccountInfoPreparer() - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccountInfoResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobGetAccountInfoResponse), err -} - -// getAccountInfoPreparer prepares the GetAccountInfo request. -func (client blobClient) getAccountInfoPreparer() (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - params.Set("restype", "account") - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// getAccountInfoResponder handles the response to the GetAccountInfo request. -func (client blobClient) getAccountInfoResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobGetAccountInfoResponse{rawResponse: resp.Response()}, err -} - -// GetProperties the Get Properties operation returns all user-defined metadata, standard HTTP properties, and system -// properties for the blob. It does not return the content of the blob. -// -// snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to -// retrieve. For more information on working with blob snapshots, see Creating -// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. encryptionKey is optional. Specifies the encryption key to use to encrypt the -// data provided in the request. If not specified, encryption is performed with the root account encryption key. For -// more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the -// provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the -// algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided -// if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header value to operate only on a -// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to -// operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value -// to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs -// without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is -// recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) GetProperties(ctx context.Context, snapshot *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobGetPropertiesResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getPropertiesPreparer(snapshot, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPropertiesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobGetPropertiesResponse), err -} - -// getPropertiesPreparer prepares the GetProperties request. -func (client blobClient) getPropertiesPreparer(snapshot *string, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("HEAD", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if snapshot != nil && len(*snapshot) > 0 { - params.Set("snapshot", *snapshot) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getPropertiesResponder handles the response to the GetProperties request. -func (client blobClient) getPropertiesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobGetPropertiesResponse{rawResponse: resp.Response()}, err -} - -// ReleaseLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete -// operations -// -// leaseID is specifies the current lease ID on the resource. timeout is the timeout parameter is expressed in seconds. -// For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate -// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a -// matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded -// in the analytics logs when storage analytics logging is enabled. -func (client blobClient) ReleaseLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobReleaseLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.releaseLeasePreparer(leaseID, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.releaseLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobReleaseLeaseResponse), err -} - -// releaseLeasePreparer prepares the ReleaseLease request. -func (client blobClient) releaseLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-lease-id", leaseID) - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "release") - return req, nil -} - -// releaseLeaseResponder handles the response to the ReleaseLease request. -func (client blobClient) releaseLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobReleaseLeaseResponse{rawResponse: resp.Response()}, err -} - -// RenewLease [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete -// operations -// -// leaseID is specifies the current lease ID on the resource. timeout is the timeout parameter is expressed in seconds. -// For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate -// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a -// matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded -// in the analytics logs when storage analytics logging is enabled. -func (client blobClient) RenewLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobRenewLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.renewLeasePreparer(leaseID, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.renewLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobRenewLeaseResponse), err -} - -// renewLeasePreparer prepares the RenewLease request. -func (client blobClient) renewLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-lease-id", leaseID) - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "renew") - return req, nil -} - -// renewLeaseResponder handles the response to the RenewLease request. -func (client blobClient) renewLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobRenewLeaseResponse{rawResponse: resp.Response()}, err -} - -// SetAccessControl set the owner, group, permissions, or access control list for a blob. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. owner is optional. The owner of the blob or directory. group is optional. The -// owning group of the blob or directory. posixPermissions is optional and only valid if Hierarchical Namespace is -// enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each -// class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic -// (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. posixACL is sets POSIX access control rights on -// files and directories. The value is a comma-separated list of access control entries. Each access control entry -// (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format -// "[scope:][type]:[id]:[permissions]". ifMatch is specify an ETag value to operate only on blobs with a matching -// value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. ifModifiedSince is -// specify this header value to operate only on a blob if it has been modified since the specified date/time. -// ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified since the -// specified date/time. requestID is provides a client-generated, opaque value with a 1 KB character limit that is -// recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) SetAccessControl(ctx context.Context, timeout *int32, leaseID *string, owner *string, group *string, posixPermissions *string, posixACL *string, ifMatch *ETag, ifNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*BlobSetAccessControlResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setAccessControlPreparer(timeout, leaseID, owner, group, posixPermissions, posixACL, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setAccessControlResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobSetAccessControlResponse), err -} - -// setAccessControlPreparer prepares the SetAccessControl request. -func (client blobClient) setAccessControlPreparer(timeout *int32, leaseID *string, owner *string, group *string, posixPermissions *string, posixACL *string, ifMatch *ETag, ifNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PATCH", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("action", "setAccessControl") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if owner != nil { - req.Header.Set("x-ms-owner", *owner) - } - if group != nil { - req.Header.Set("x-ms-group", *group) - } - if posixPermissions != nil { - req.Header.Set("x-ms-permissions", *posixPermissions) - } - if posixACL != nil { - req.Header.Set("x-ms-acl", *posixACL) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// setAccessControlResponder handles the response to the SetAccessControl request. -func (client blobClient) setAccessControlResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobSetAccessControlResponse{rawResponse: resp.Response()}, err -} - -// SetHTTPHeaders the Set HTTP Headers operation sets system properties on the blob -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. blobCacheControl is optional. Sets the blob's cache control. If specified, -// this property is stored with the blob and returned with a read request. blobContentType is optional. Sets the blob's -// content type. If specified, this property is stored with the blob and returned with a read request. blobContentMD5 -// is optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual -// blocks were validated when each was uploaded. blobContentEncoding is optional. Sets the blob's content encoding. If -// specified, this property is stored with the blob and returned with a read request. blobContentLanguage is optional. -// Set the blob's content language. If specified, this property is stored with the blob and returned with a read -// request. leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID. -// ifModifiedSince is specify this header value to operate only on a blob if it has been modified since the specified -// date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified -// since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching value. -// ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. blobContentDisposition is -// optional. Sets the blob's Content-Disposition header. requestID is provides a client-generated, opaque value with a -// 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) SetHTTPHeaders(ctx context.Context, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentMD5 []byte, blobContentEncoding *string, blobContentLanguage *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobContentDisposition *string, requestID *string) (*BlobSetHTTPHeadersResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setHTTPHeadersPreparer(timeout, blobCacheControl, blobContentType, blobContentMD5, blobContentEncoding, blobContentLanguage, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, blobContentDisposition, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setHTTPHeadersResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobSetHTTPHeadersResponse), err -} - -// setHTTPHeadersPreparer prepares the SetHTTPHeaders request. -func (client blobClient) setHTTPHeadersPreparer(timeout *int32, blobCacheControl *string, blobContentType *string, blobContentMD5 []byte, blobContentEncoding *string, blobContentLanguage *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobContentDisposition *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - if blobCacheControl != nil { - req.Header.Set("x-ms-blob-cache-control", *blobCacheControl) - } - if blobContentType != nil { - req.Header.Set("x-ms-blob-content-type", *blobContentType) - } - if blobContentMD5 != nil { - req.Header.Set("x-ms-blob-content-md5", base64.StdEncoding.EncodeToString(blobContentMD5)) - } - if blobContentEncoding != nil { - req.Header.Set("x-ms-blob-content-encoding", *blobContentEncoding) - } - if blobContentLanguage != nil { - req.Header.Set("x-ms-blob-content-language", *blobContentLanguage) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - if blobContentDisposition != nil { - req.Header.Set("x-ms-blob-content-disposition", *blobContentDisposition) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// setHTTPHeadersResponder handles the response to the SetHTTPHeaders request. -func (client blobClient) setHTTPHeadersResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobSetHTTPHeadersResponse{rawResponse: resp.Response()}, err -} - -// SetMetadata the Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more -// name-value pairs -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. metadata is optional. Specifies a user-defined name-value pair associated -// with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or -// file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with -// the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version -// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing -// Containers, Blobs, and Metadata for more information. leaseID is if specified, the operation only succeeds if the -// resource's lease is active and matches this ID. encryptionKey is optional. Specifies the encryption key to use to -// encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption -// key. For more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 -// hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. -// encryptionAlgorithm is the algorithm used to produce the encryption key hash. Currently, the only accepted value is -// "AES256". Must be provided if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header -// value to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify -// this header value to operate only on a blob if it has not been modified since the specified date/time. ifMatch is -// specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to -// operate only on blobs without a matching value. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) SetMetadata(ctx context.Context, timeout *int32, metadata map[string]string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlobSetMetadataResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setMetadataPreparer(timeout, metadata, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setMetadataResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobSetMetadataResponse), err -} - -// setMetadataPreparer prepares the SetMetadata request. -func (client blobClient) setMetadataPreparer(timeout *int32, metadata map[string]string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "metadata") - req.URL.RawQuery = params.Encode() - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// setMetadataResponder handles the response to the SetMetadata request. -func (client blobClient) setMetadataResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobSetMetadataResponse{rawResponse: resp.Response()}, err -} - -// SetTier the Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage -// account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier -// determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive -// storage type. This operation does not update the blob's ETag. -// -// tier is indicates the tier to be set on the blob. timeout is the timeout parameter is expressed in seconds. For more -// information, see Setting -// Timeouts for Blob Service Operations. rehydratePriority is optional: Indicates the priority with which to -// rehydrate an archived blob. requestID is provides a client-generated, opaque value with a 1 KB character limit that -// is recorded in the analytics logs when storage analytics logging is enabled. leaseID is if specified, the operation -// only succeeds if the resource's lease is active and matches this ID. -func (client blobClient) SetTier(ctx context.Context, tier AccessTierType, timeout *int32, rehydratePriority RehydratePriorityType, requestID *string, leaseID *string) (*BlobSetTierResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setTierPreparer(tier, timeout, rehydratePriority, requestID, leaseID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setTierResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobSetTierResponse), err -} - -// setTierPreparer prepares the SetTier request. -func (client blobClient) setTierPreparer(tier AccessTierType, timeout *int32, rehydratePriority RehydratePriorityType, requestID *string, leaseID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "tier") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-access-tier", string(tier)) - if rehydratePriority != RehydratePriorityNone { - req.Header.Set("x-ms-rehydrate-priority", string(rehydratePriority)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - return req, nil -} - -// setTierResponder handles the response to the SetTier request. -func (client blobClient) setTierResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobSetTierResponse{rawResponse: resp.Response()}, err -} - -// StartCopyFromURL the Start Copy From URL operation copies a blob or an internet resource to a new blob. -// -// copySource is specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that -// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob -// must either be public or must be authenticated via a shared access signature. timeout is the timeout parameter is -// expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. metadata is optional. Specifies a user-defined name-value pair associated -// with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or -// file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with -// the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version -// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing -// Containers, Blobs, and Metadata for more information. tier is optional. Indicates the tier to be set on the blob. -// rehydratePriority is optional: Indicates the priority with which to rehydrate an archived blob. -// sourceIfModifiedSince is specify this header value to operate only on a blob if it has been modified since the -// specified date/time. sourceIfUnmodifiedSince is specify this header value to operate only on a blob if it has not -// been modified since the specified date/time. sourceIfMatch is specify an ETag value to operate only on blobs with a -// matching value. sourceIfNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// ifModifiedSince is specify this header value to operate only on a blob if it has been modified since the specified -// date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified -// since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching value. -// ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. leaseID is if specified, the -// operation only succeeds if the resource's lease is active and matches this ID. requestID is provides a -// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage -// analytics logging is enabled. -func (client blobClient) StartCopyFromURL(ctx context.Context, copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, rehydratePriority RehydratePriorityType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, leaseID *string, requestID *string) (*BlobStartCopyFromURLResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.startCopyFromURLPreparer(copySource, timeout, metadata, tier, rehydratePriority, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, leaseID, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.startCopyFromURLResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobStartCopyFromURLResponse), err -} - -// startCopyFromURLPreparer prepares the StartCopyFromURL request. -func (client blobClient) startCopyFromURLPreparer(copySource string, timeout *int32, metadata map[string]string, tier AccessTierType, rehydratePriority RehydratePriorityType, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, leaseID *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if tier != AccessTierNone { - req.Header.Set("x-ms-access-tier", string(tier)) - } - if rehydratePriority != RehydratePriorityNone { - req.Header.Set("x-ms-rehydrate-priority", string(rehydratePriority)) - } - if sourceIfModifiedSince != nil { - req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfUnmodifiedSince != nil { - req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfMatch != nil { - req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) - } - if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-copy-source", copySource) - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// startCopyFromURLResponder handles the response to the StartCopyFromURL request. -func (client blobClient) startCopyFromURLResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobStartCopyFromURLResponse{rawResponse: resp.Response()}, err -} - -// Undelete undelete a blob that was previously soft deleted -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blobClient) Undelete(ctx context.Context, timeout *int32, requestID *string) (*BlobUndeleteResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.undeletePreparer(timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.undeleteResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlobUndeleteResponse), err -} - -// undeletePreparer prepares the Undelete request. -func (client blobClient) undeletePreparer(timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "undelete") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// undeleteResponder handles the response to the Undelete request. -func (client blobClient) undeleteResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlobUndeleteResponse{rawResponse: resp.Response()}, err -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_block_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_block_blob.go deleted file mode 100644 index a9e913ec1..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_block_blob.go +++ /dev/null @@ -1,592 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "bytes" - "context" - "encoding/base64" - "encoding/xml" - "github.com/Azure/azure-pipeline-go/pipeline" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "time" -) - -// blockBlobClient is the client for the BlockBlob methods of the Azblob service. -type blockBlobClient struct { - managementClient -} - -// newBlockBlobClient creates an instance of the blockBlobClient client. -func newBlockBlobClient(url url.URL, p pipeline.Pipeline) blockBlobClient { - return blockBlobClient{newManagementClient(url, p)} -} - -// CommitBlockList the Commit Block List operation writes a blob by specifying the list of block IDs that make up the -// blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior -// Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, -// then committing the new and existing blocks together. You can do this by specifying whether to commit a block from -// the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the -// block, whichever list it may belong to. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. blobCacheControl is optional. Sets the blob's cache control. If specified, -// this property is stored with the blob and returned with a read request. blobContentType is optional. Sets the blob's -// content type. If specified, this property is stored with the blob and returned with a read request. -// blobContentEncoding is optional. Sets the blob's content encoding. If specified, this property is stored with the -// blob and returned with a read request. blobContentLanguage is optional. Set the blob's content language. If -// specified, this property is stored with the blob and returned with a read request. blobContentMD5 is optional. An -// MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were -// validated when each was uploaded. transactionalContentMD5 is specify the transactional md5 for the body, to be -// validated by the service. transactionalContentCrc64 is specify the transactional crc64 for the body, to be validated -// by the service. metadata is optional. Specifies a user-defined name-value pair associated with the blob. If no -// name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination -// blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, -// and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names -// must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for -// more information. leaseID is if specified, the operation only succeeds if the resource's lease is active and matches -// this ID. blobContentDisposition is optional. Sets the blob's Content-Disposition header. encryptionKey is optional. -// Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is -// performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage -// Services. encryptionKeySha256 is the SHA-256 hash of the provided encryption key. Must be provided if the -// x-ms-encryption-key header is provided. encryptionAlgorithm is the algorithm used to produce the encryption key -// hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is -// provided. tier is optional. Indicates the tier to be set on the blob. ifModifiedSince is specify this header value -// to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this -// header value to operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify -// an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only -// on blobs without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blockBlobClient) CommitBlockList(ctx context.Context, blocks BlockLookupList, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, tier AccessTierType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlockBlobCommitBlockListResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.commitBlockListPreparer(blocks, timeout, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5, transactionalContentMD5, transactionalContentCrc64, metadata, leaseID, blobContentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.commitBlockListResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlockBlobCommitBlockListResponse), err -} - -// commitBlockListPreparer prepares the CommitBlockList request. -func (client blockBlobClient) commitBlockListPreparer(blocks BlockLookupList, timeout *int32, blobCacheControl *string, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, tier AccessTierType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "blocklist") - req.URL.RawQuery = params.Encode() - if blobCacheControl != nil { - req.Header.Set("x-ms-blob-cache-control", *blobCacheControl) - } - if blobContentType != nil { - req.Header.Set("x-ms-blob-content-type", *blobContentType) - } - if blobContentEncoding != nil { - req.Header.Set("x-ms-blob-content-encoding", *blobContentEncoding) - } - if blobContentLanguage != nil { - req.Header.Set("x-ms-blob-content-language", *blobContentLanguage) - } - if blobContentMD5 != nil { - req.Header.Set("x-ms-blob-content-md5", base64.StdEncoding.EncodeToString(blobContentMD5)) - } - if transactionalContentMD5 != nil { - req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5)) - } - if transactionalContentCrc64 != nil { - req.Header.Set("x-ms-content-crc64", base64.StdEncoding.EncodeToString(transactionalContentCrc64)) - } - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if blobContentDisposition != nil { - req.Header.Set("x-ms-blob-content-disposition", *blobContentDisposition) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if tier != AccessTierNone { - req.Header.Set("x-ms-access-tier", string(tier)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - b, err := xml.Marshal(blocks) - if err != nil { - return req, pipeline.NewError(err, "failed to marshal request body") - } - req.Header.Set("Content-Type", "application/xml") - err = req.SetBody(bytes.NewReader(b)) - if err != nil { - return req, pipeline.NewError(err, "failed to set request body") - } - return req, nil -} - -// commitBlockListResponder handles the response to the CommitBlockList request. -func (client blockBlobClient) commitBlockListResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlockBlobCommitBlockListResponse{rawResponse: resp.Response()}, err -} - -// GetBlockList the Get Block List operation retrieves the list of blocks that have been uploaded as part of a block -// blob -// -// listType is specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists -// together. snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob -// snapshot to retrieve. For more information on working with blob snapshots, see Creating -// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blockBlobClient) GetBlockList(ctx context.Context, listType BlockListType, snapshot *string, timeout *int32, leaseID *string, requestID *string) (*BlockList, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getBlockListPreparer(listType, snapshot, timeout, leaseID, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getBlockListResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlockList), err -} - -// getBlockListPreparer prepares the GetBlockList request. -func (client blockBlobClient) getBlockListPreparer(listType BlockListType, snapshot *string, timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if snapshot != nil && len(*snapshot) > 0 { - params.Set("snapshot", *snapshot) - } - params.Set("blocklisttype", string(listType)) - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "blocklist") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getBlockListResponder handles the response to the GetBlockList request. -func (client blockBlobClient) getBlockListResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &BlockList{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// StageBlock the Stage Block operation creates a new block to be committed as part of a blob -// -// blockID is a valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or -// equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the -// same size for each block. contentLength is the length of the request. body is initial data body will be closed upon -// successful return. Callers should ensure closure when receiving an error.transactionalContentMD5 is specify the -// transactional md5 for the body, to be validated by the service. transactionalContentCrc64 is specify the -// transactional crc64 for the body, to be validated by the service. timeout is the timeout parameter is expressed in -// seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. encryptionKey is optional. Specifies the encryption key to use to encrypt the -// data provided in the request. If not specified, encryption is performed with the root account encryption key. For -// more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the -// provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the -// algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided -// if the x-ms-encryption-key header is provided. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blockBlobClient) StageBlock(ctx context.Context, blockID string, contentLength int64, body io.ReadSeeker, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, requestID *string) (*BlockBlobStageBlockResponse, error) { - if err := validate([]validation{ - {targetValue: body, - constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.stageBlockPreparer(blockID, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.stageBlockResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlockBlobStageBlockResponse), err -} - -// stageBlockPreparer prepares the StageBlock request. -func (client blockBlobClient) stageBlockPreparer(blockID string, contentLength int64, body io.ReadSeeker, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, body) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - params.Set("blockid", blockID) - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "block") - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if transactionalContentMD5 != nil { - req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5)) - } - if transactionalContentCrc64 != nil { - req.Header.Set("x-ms-content-crc64", base64.StdEncoding.EncodeToString(transactionalContentCrc64)) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// stageBlockResponder handles the response to the StageBlock request. -func (client blockBlobClient) stageBlockResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlockBlobStageBlockResponse{rawResponse: resp.Response()}, err -} - -// StageBlockFromURL the Stage Block operation creates a new block to be committed as part of a blob where the contents -// are read from a URL. -// -// blockID is a valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or -// equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the -// same size for each block. contentLength is the length of the request. sourceURL is specify a URL to the copy source. -// sourceRange is bytes of source data in the specified range. sourceContentMD5 is specify the md5 calculated for the -// range of bytes that must be read from the copy source. sourceContentcrc64 is specify the crc64 calculated for the -// range of bytes that must be read from the copy source. timeout is the timeout parameter is expressed in seconds. For -// more information, see Setting -// Timeouts for Blob Service Operations. encryptionKey is optional. Specifies the encryption key to use to encrypt -// the data provided in the request. If not specified, encryption is performed with the root account encryption key. -// For more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of -// the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is -// the algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be -// provided if the x-ms-encryption-key header is provided. leaseID is if specified, the operation only succeeds if the -// resource's lease is active and matches this ID. sourceIfModifiedSince is specify this header value to operate only -// on a blob if it has been modified since the specified date/time. sourceIfUnmodifiedSince is specify this header -// value to operate only on a blob if it has not been modified since the specified date/time. sourceIfMatch is specify -// an ETag value to operate only on blobs with a matching value. sourceIfNoneMatch is specify an ETag value to operate -// only on blobs without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client blockBlobClient) StageBlockFromURL(ctx context.Context, blockID string, contentLength int64, sourceURL string, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, leaseID *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (*BlockBlobStageBlockFromURLResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.stageBlockFromURLPreparer(blockID, contentLength, sourceURL, sourceRange, sourceContentMD5, sourceContentcrc64, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseID, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.stageBlockFromURLResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlockBlobStageBlockFromURLResponse), err -} - -// stageBlockFromURLPreparer prepares the StageBlockFromURL request. -func (client blockBlobClient) stageBlockFromURLPreparer(blockID string, contentLength int64, sourceURL string, sourceRange *string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, leaseID *string, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - params.Set("blockid", blockID) - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "block") - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - req.Header.Set("x-ms-copy-source", sourceURL) - if sourceRange != nil { - req.Header.Set("x-ms-source-range", *sourceRange) - } - if sourceContentMD5 != nil { - req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5)) - } - if sourceContentcrc64 != nil { - req.Header.Set("x-ms-source-content-crc64", base64.StdEncoding.EncodeToString(sourceContentcrc64)) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if sourceIfModifiedSince != nil { - req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfUnmodifiedSince != nil { - req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfMatch != nil { - req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) - } - if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// stageBlockFromURLResponder handles the response to the StageBlockFromURL request. -func (client blockBlobClient) stageBlockFromURLResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlockBlobStageBlockFromURLResponse{rawResponse: resp.Response()}, err -} - -// Upload the Upload Block Blob operation updates the content of an existing block blob. Updating an existing block -// blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of -// the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a -// block blob, use the Put Block List operation. -// -// body is initial data body will be closed upon successful return. Callers should ensure closure when receiving an -// error.contentLength is the length of the request. timeout is the timeout parameter is expressed in seconds. For more -// information, see Setting -// Timeouts for Blob Service Operations. transactionalContentMD5 is specify the transactional md5 for the body, to -// be validated by the service. blobContentType is optional. Sets the blob's content type. If specified, this property -// is stored with the blob and returned with a read request. blobContentEncoding is optional. Sets the blob's content -// encoding. If specified, this property is stored with the blob and returned with a read request. blobContentLanguage -// is optional. Set the blob's content language. If specified, this property is stored with the blob and returned with -// a read request. blobContentMD5 is optional. An MD5 hash of the blob content. Note that this hash is not validated, -// as the hashes for the individual blocks were validated when each was uploaded. blobCacheControl is optional. Sets -// the blob's cache control. If specified, this property is stored with the blob and returned with a read request. -// metadata is optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are -// specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more -// name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not -// copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the -// naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. -// leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID. -// blobContentDisposition is optional. Sets the blob's Content-Disposition header. encryptionKey is optional. Specifies -// the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed -// with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. -// encryptionKeySha256 is the SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key -// header is provided. encryptionAlgorithm is the algorithm used to produce the encryption key hash. Currently, the -// only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. tier is optional. -// Indicates the tier to be set on the blob. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate -// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a -// matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded -// in the analytics logs when storage analytics logging is enabled. -func (client blockBlobClient) Upload(ctx context.Context, body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, tier AccessTierType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*BlockBlobUploadResponse, error) { - if err := validate([]validation{ - {targetValue: body, - constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.uploadPreparer(body, contentLength, timeout, transactionalContentMD5, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5, blobCacheControl, metadata, leaseID, blobContentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.uploadResponder}, req) - if err != nil { - return nil, err - } - return resp.(*BlockBlobUploadResponse), err -} - -// uploadPreparer prepares the Upload request. -func (client blockBlobClient) uploadPreparer(body io.ReadSeeker, contentLength int64, timeout *int32, transactionalContentMD5 []byte, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, tier AccessTierType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, body) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - if transactionalContentMD5 != nil { - req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5)) - } - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if blobContentType != nil { - req.Header.Set("x-ms-blob-content-type", *blobContentType) - } - if blobContentEncoding != nil { - req.Header.Set("x-ms-blob-content-encoding", *blobContentEncoding) - } - if blobContentLanguage != nil { - req.Header.Set("x-ms-blob-content-language", *blobContentLanguage) - } - if blobContentMD5 != nil { - req.Header.Set("x-ms-blob-content-md5", base64.StdEncoding.EncodeToString(blobContentMD5)) - } - if blobCacheControl != nil { - req.Header.Set("x-ms-blob-cache-control", *blobCacheControl) - } - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if blobContentDisposition != nil { - req.Header.Set("x-ms-blob-content-disposition", *blobContentDisposition) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if tier != AccessTierNone { - req.Header.Set("x-ms-access-tier", string(tier)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-blob-type", "BlockBlob") - return req, nil -} - -// uploadResponder handles the response to the Upload request. -func (client blockBlobClient) uploadResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &BlockBlobUploadResponse{rawResponse: resp.Response()}, err -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_client.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_client.go deleted file mode 100644 index a882b3254..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_client.go +++ /dev/null @@ -1,38 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/azure-pipeline-go/pipeline" - "net/url" -) - -const ( - // ServiceVersion specifies the version of the operations used in this package. - ServiceVersion = "2019-02-02" -) - -// managementClient is the base client for Azblob. -type managementClient struct { - url url.URL - p pipeline.Pipeline -} - -// newManagementClient creates an instance of the managementClient client. -func newManagementClient(url url.URL, p pipeline.Pipeline) managementClient { - return managementClient{ - url: url, - p: p, - } -} - -// URL returns a copy of the URL for this client. -func (mc managementClient) URL() url.URL { - return mc.url -} - -// Pipeline returns the pipeline for this client. -func (mc managementClient) Pipeline() pipeline.Pipeline { - return mc.p -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_container.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_container.go deleted file mode 100644 index 599e8118c..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_container.go +++ /dev/null @@ -1,1037 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "bytes" - "context" - "encoding/xml" - "github.com/Azure/azure-pipeline-go/pipeline" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "time" -) - -// containerClient is the client for the Container methods of the Azblob service. -type containerClient struct { - managementClient -} - -// newContainerClient creates an instance of the containerClient client. -func newContainerClient(url url.URL, p pipeline.Pipeline) containerClient { - return containerClient{newManagementClient(url, p)} -} - -// AcquireLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be -// 15 to 60 seconds, or can be infinite -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. duration is specifies the duration of the lease, in seconds, or negative -// one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration -// cannot be changed using renew or change. proposedLeaseID is proposed lease ID, in a GUID string format. The Blob -// service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor -// (String) for a list of valid GUID string formats. ifModifiedSince is specify this header value to operate only on a -// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to -// operate only on a blob if it has not been modified since the specified date/time. requestID is provides a -// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage -// analytics logging is enabled. -func (client containerClient) AcquireLease(ctx context.Context, timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerAcquireLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.acquireLeasePreparer(timeout, duration, proposedLeaseID, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.acquireLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerAcquireLeaseResponse), err -} - -// acquireLeasePreparer prepares the AcquireLease request. -func (client containerClient) acquireLeasePreparer(timeout *int32, duration *int32, proposedLeaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - if duration != nil { - req.Header.Set("x-ms-lease-duration", strconv.FormatInt(int64(*duration), 10)) - } - if proposedLeaseID != nil { - req.Header.Set("x-ms-proposed-lease-id", *proposedLeaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "acquire") - return req, nil -} - -// acquireLeaseResponder handles the response to the AcquireLease request. -func (client containerClient) acquireLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerAcquireLeaseResponse{rawResponse: resp.Response()}, err -} - -// BreakLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 -// to 60 seconds, or can be infinite -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. breakPeriod is for a break operation, proposed duration the lease should -// continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the -// time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available -// before the break period has expired, but the lease may be held for longer than the break period. If this header does -// not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an -// infinite lease breaks immediately. ifModifiedSince is specify this header value to operate only on a blob if it has -// been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a -// blob if it has not been modified since the specified date/time. requestID is provides a client-generated, opaque -// value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) BreakLease(ctx context.Context, timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerBreakLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.breakLeasePreparer(timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.breakLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerBreakLeaseResponse), err -} - -// breakLeasePreparer prepares the BreakLease request. -func (client containerClient) breakLeasePreparer(timeout *int32, breakPeriod *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - if breakPeriod != nil { - req.Header.Set("x-ms-lease-break-period", strconv.FormatInt(int64(*breakPeriod), 10)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "break") - return req, nil -} - -// breakLeaseResponder handles the response to the BreakLease request. -func (client containerClient) breakLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerBreakLeaseResponse{rawResponse: resp.Response()}, err -} - -// ChangeLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be -// 15 to 60 seconds, or can be infinite -// -// leaseID is specifies the current lease ID on the resource. proposedLeaseID is proposed lease ID, in a GUID string -// format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See -// Guid Constructor (String) for a list of valid GUID string formats. timeout is the timeout parameter is expressed in -// seconds. For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. requestID is provides a client-generated, -// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is -// enabled. -func (client containerClient) ChangeLease(ctx context.Context, leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerChangeLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.changeLeasePreparer(leaseID, proposedLeaseID, timeout, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.changeLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerChangeLeaseResponse), err -} - -// changeLeasePreparer prepares the ChangeLease request. -func (client containerClient) changeLeasePreparer(leaseID string, proposedLeaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-lease-id", leaseID) - req.Header.Set("x-ms-proposed-lease-id", proposedLeaseID) - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "change") - return req, nil -} - -// changeLeaseResponder handles the response to the ChangeLease request. -func (client containerClient) changeLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerChangeLeaseResponse{rawResponse: resp.Response()}, err -} - -// Create creates a new container under the specified account. If the container with the same name already exists, the -// operation fails -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. metadata is optional. Specifies a user-defined name-value pair associated -// with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or -// file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with -// the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version -// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing -// Containers, Blobs, and Metadata for more information. access is specifies whether data in the container may be -// accessed publicly and the level of access requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) Create(ctx context.Context, timeout *int32, metadata map[string]string, access PublicAccessType, requestID *string) (*ContainerCreateResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.createPreparer(timeout, metadata, access, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerCreateResponse), err -} - -// createPreparer prepares the Create request. -func (client containerClient) createPreparer(timeout *int32, metadata map[string]string, access PublicAccessType, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if access != PublicAccessNone { - req.Header.Set("x-ms-blob-public-access", string(access)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// createResponder handles the response to the Create request. -func (client containerClient) createResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerCreateResponse{rawResponse: resp.Response()}, err -} - -// Delete operation marks the specified container for deletion. The container and any blobs contained within it are -// later deleted during garbage collection -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. ifModifiedSince is specify this header value to operate only on a blob if it -// has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a -// blob if it has not been modified since the specified date/time. requestID is provides a client-generated, opaque -// value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) Delete(ctx context.Context, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerDeleteResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.deletePreparer(timeout, leaseID, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.deleteResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerDeleteResponse), err -} - -// deletePreparer prepares the Delete request. -func (client containerClient) deletePreparer(timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("DELETE", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// deleteResponder handles the response to the Delete request. -func (client containerClient) deleteResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerDeleteResponse{rawResponse: resp.Response()}, err -} - -// GetAccessPolicy gets the permissions for the specified container. The permissions indicate whether container data -// may be accessed publicly. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) GetAccessPolicy(ctx context.Context, timeout *int32, leaseID *string, requestID *string) (*SignedIdentifiers, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getAccessPolicyPreparer(timeout, leaseID, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccessPolicyResponder}, req) - if err != nil { - return nil, err - } - return resp.(*SignedIdentifiers), err -} - -// getAccessPolicyPreparer prepares the GetAccessPolicy request. -func (client containerClient) getAccessPolicyPreparer(timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - params.Set("comp", "acl") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getAccessPolicyResponder handles the response to the GetAccessPolicy request. -func (client containerClient) getAccessPolicyResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &SignedIdentifiers{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// GetAccountInfo returns the sku name and account kind -func (client containerClient) GetAccountInfo(ctx context.Context) (*ContainerGetAccountInfoResponse, error) { - req, err := client.getAccountInfoPreparer() - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccountInfoResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerGetAccountInfoResponse), err -} - -// getAccountInfoPreparer prepares the GetAccountInfo request. -func (client containerClient) getAccountInfoPreparer() (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - params.Set("restype", "account") - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// getAccountInfoResponder handles the response to the GetAccountInfo request. -func (client containerClient) getAccountInfoResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerGetAccountInfoResponse{rawResponse: resp.Response()}, err -} - -// GetProperties returns all user-defined metadata and system properties for the specified container. The data returned -// does not include the container's list of blobs -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. requestID is provides a client-generated, opaque value with a 1 KB character -// limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) GetProperties(ctx context.Context, timeout *int32, leaseID *string, requestID *string) (*ContainerGetPropertiesResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getPropertiesPreparer(timeout, leaseID, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPropertiesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerGetPropertiesResponse), err -} - -// getPropertiesPreparer prepares the GetProperties request. -func (client containerClient) getPropertiesPreparer(timeout *int32, leaseID *string, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getPropertiesResponder handles the response to the GetProperties request. -func (client containerClient) getPropertiesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerGetPropertiesResponse{rawResponse: resp.Response()}, err -} - -// ListBlobFlatSegment [Update] The List Blobs operation returns a list of the blobs under the specified container -// -// prefix is filters the results to return only containers whose name begins with the specified prefix. marker is a -// string value that identifies the portion of the list of containers to be returned with the next listing operation. -// The operation returns the NextMarker value within the response body if the listing operation did not return all -// containers remaining to be listed with the current page. The NextMarker value can be used as the value for the -// marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the -// client. maxresults is specifies the maximum number of containers to return. If the request does not specify -// maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the -// listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the -// remainder of the results. For this reason, it is possible that the service will return fewer results than specified -// by maxresults, or than the default of 5000. include is include this parameter to specify one or more datasets to -// include in the response. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) ListBlobFlatSegment(ctx context.Context, prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (*ListBlobsFlatSegmentResponse, error) { - if err := validate([]validation{ - {targetValue: maxresults, - constraints: []constraint{{target: "maxresults", name: null, rule: false, - chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.listBlobFlatSegmentPreparer(prefix, marker, maxresults, include, timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listBlobFlatSegmentResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ListBlobsFlatSegmentResponse), err -} - -// listBlobFlatSegmentPreparer prepares the ListBlobFlatSegment request. -func (client containerClient) listBlobFlatSegmentPreparer(prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if prefix != nil && len(*prefix) > 0 { - params.Set("prefix", *prefix) - } - if marker != nil && len(*marker) > 0 { - params.Set("marker", *marker) - } - if maxresults != nil { - params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10)) - } - if include != nil && len(include) > 0 { - params.Set("include", joinConst(include, ",")) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - params.Set("comp", "list") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// listBlobFlatSegmentResponder handles the response to the ListBlobFlatSegment request. -func (client containerClient) listBlobFlatSegmentResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &ListBlobsFlatSegmentResponse{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// ListBlobHierarchySegment [Update] The List Blobs operation returns a list of the blobs under the specified container -// -// delimiter is when the request includes this parameter, the operation returns a BlobPrefix element in the response -// body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the -// delimiter character. The delimiter may be a single character or a string. prefix is filters the results to return -// only containers whose name begins with the specified prefix. marker is a string value that identifies the portion of -// the list of containers to be returned with the next listing operation. The operation returns the NextMarker value -// within the response body if the listing operation did not return all containers remaining to be listed with the -// current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request -// the next page of list items. The marker value is opaque to the client. maxresults is specifies the maximum number of -// containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server -// will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will -// return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the -// service will return fewer results than specified by maxresults, or than the default of 5000. include is include this -// parameter to specify one or more datasets to include in the response. timeout is the timeout parameter is expressed -// in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) ListBlobHierarchySegment(ctx context.Context, delimiter string, prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (*ListBlobsHierarchySegmentResponse, error) { - if err := validate([]validation{ - {targetValue: maxresults, - constraints: []constraint{{target: "maxresults", name: null, rule: false, - chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.listBlobHierarchySegmentPreparer(delimiter, prefix, marker, maxresults, include, timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listBlobHierarchySegmentResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ListBlobsHierarchySegmentResponse), err -} - -// listBlobHierarchySegmentPreparer prepares the ListBlobHierarchySegment request. -func (client containerClient) listBlobHierarchySegmentPreparer(delimiter string, prefix *string, marker *string, maxresults *int32, include []ListBlobsIncludeItemType, timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if prefix != nil && len(*prefix) > 0 { - params.Set("prefix", *prefix) - } - params.Set("delimiter", delimiter) - if marker != nil && len(*marker) > 0 { - params.Set("marker", *marker) - } - if maxresults != nil { - params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10)) - } - if include != nil && len(include) > 0 { - params.Set("include", joinConst(include, ",")) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - params.Set("comp", "list") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// listBlobHierarchySegmentResponder handles the response to the ListBlobHierarchySegment request. -func (client containerClient) listBlobHierarchySegmentResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &ListBlobsHierarchySegmentResponse{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// ReleaseLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be -// 15 to 60 seconds, or can be infinite -// -// leaseID is specifies the current lease ID on the resource. timeout is the timeout parameter is expressed in seconds. -// For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. requestID is provides a client-generated, -// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is -// enabled. -func (client containerClient) ReleaseLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerReleaseLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.releaseLeasePreparer(leaseID, timeout, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.releaseLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerReleaseLeaseResponse), err -} - -// releaseLeasePreparer prepares the ReleaseLease request. -func (client containerClient) releaseLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-lease-id", leaseID) - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "release") - return req, nil -} - -// releaseLeaseResponder handles the response to the ReleaseLease request. -func (client containerClient) releaseLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerReleaseLeaseResponse{rawResponse: resp.Response()}, err -} - -// RenewLease [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 -// to 60 seconds, or can be infinite -// -// leaseID is specifies the current lease ID on the resource. timeout is the timeout parameter is expressed in seconds. -// For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. requestID is provides a client-generated, -// opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is -// enabled. -func (client containerClient) RenewLease(ctx context.Context, leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerRenewLeaseResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.renewLeasePreparer(leaseID, timeout, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.renewLeaseResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerRenewLeaseResponse), err -} - -// renewLeasePreparer prepares the RenewLease request. -func (client containerClient) renewLeasePreparer(leaseID string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "lease") - params.Set("restype", "container") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-lease-id", leaseID) - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-lease-action", "renew") - return req, nil -} - -// renewLeaseResponder handles the response to the RenewLease request. -func (client containerClient) renewLeaseResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerRenewLeaseResponse{rawResponse: resp.Response()}, err -} - -// SetAccessPolicy sets the permissions for the specified container. The permissions indicate whether blobs in a -// container may be accessed publicly. -// -// containerACL is the acls for the container timeout is the timeout parameter is expressed in seconds. For more -// information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. access is specifies whether data in the container may be accessed publicly and -// the level of access ifModifiedSince is specify this header value to operate only on a blob if it has been modified -// since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has -// not been modified since the specified date/time. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) SetAccessPolicy(ctx context.Context, containerACL []SignedIdentifier, timeout *int32, leaseID *string, access PublicAccessType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (*ContainerSetAccessPolicyResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setAccessPolicyPreparer(containerACL, timeout, leaseID, access, ifModifiedSince, ifUnmodifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setAccessPolicyResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerSetAccessPolicyResponse), err -} - -// setAccessPolicyPreparer prepares the SetAccessPolicy request. -func (client containerClient) setAccessPolicyPreparer(containerACL []SignedIdentifier, timeout *int32, leaseID *string, access PublicAccessType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - params.Set("comp", "acl") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if access != PublicAccessNone { - req.Header.Set("x-ms-blob-public-access", string(access)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - b, err := xml.Marshal(SignedIdentifiers{Items: containerACL}) - if err != nil { - return req, pipeline.NewError(err, "failed to marshal request body") - } - req.Header.Set("Content-Type", "application/xml") - err = req.SetBody(bytes.NewReader(b)) - if err != nil { - return req, pipeline.NewError(err, "failed to set request body") - } - return req, nil -} - -// setAccessPolicyResponder handles the response to the SetAccessPolicy request. -func (client containerClient) setAccessPolicyResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerSetAccessPolicyResponse{rawResponse: resp.Response()}, err -} - -// SetMetadata operation sets one or more user-defined name-value pairs for the specified container. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. metadata is optional. Specifies a user-defined name-value pair associated with -// the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to -// the destination blob. If one or more name-value pairs are specified, the destination blob is created with the -// specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version -// 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing -// Containers, Blobs, and Metadata for more information. ifModifiedSince is specify this header value to operate only -// on a blob if it has been modified since the specified date/time. requestID is provides a client-generated, opaque -// value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client containerClient) SetMetadata(ctx context.Context, timeout *int32, leaseID *string, metadata map[string]string, ifModifiedSince *time.Time, requestID *string) (*ContainerSetMetadataResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setMetadataPreparer(timeout, leaseID, metadata, ifModifiedSince, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setMetadataResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ContainerSetMetadataResponse), err -} - -// setMetadataPreparer prepares the SetMetadata request. -func (client containerClient) setMetadataPreparer(timeout *int32, leaseID *string, metadata map[string]string, ifModifiedSince *time.Time, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "container") - params.Set("comp", "metadata") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// setMetadataResponder handles the response to the SetMetadata request. -func (client containerClient) setMetadataResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ContainerSetMetadataResponse{rawResponse: resp.Response()}, err -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_models.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_models.go deleted file mode 100644 index 6c4e81d48..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_models.go +++ /dev/null @@ -1,6421 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "encoding/base64" - "encoding/xml" - "errors" - "io" - "net/http" - "reflect" - "strconv" - "strings" - "time" - "unsafe" -) - -// ETag is an entity tag. -type ETag string - -const ( - // ETagNone represents an empty entity tag. - ETagNone ETag = "" - - // ETagAny matches any entity tag. - ETagAny ETag = "*" -) - -// Metadata contains metadata key/value pairs. -type Metadata map[string]string - -const mdPrefix = "x-ms-meta-" - -const mdPrefixLen = len(mdPrefix) - -// UnmarshalXML implements the xml.Unmarshaler interface for Metadata. -func (md *Metadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - tokName := "" - for t, err := d.Token(); err == nil; t, err = d.Token() { - switch tt := t.(type) { - case xml.StartElement: - tokName = strings.ToLower(tt.Name.Local) - break - case xml.CharData: - if *md == nil { - *md = Metadata{} - } - (*md)[tokName] = string(tt) - break - } - } - return nil -} - -// Marker represents an opaque value used in paged responses. -type Marker struct { - Val *string -} - -// NotDone returns true if the list enumeration should be started or is not yet complete. Specifically, NotDone returns true -// for a just-initialized (zero value) Marker indicating that you should make an initial request to get a result portion from -// the service. NotDone also returns true whenever the service returns an interim result portion. NotDone returns false only -// after the service has returned the final result portion. -func (m Marker) NotDone() bool { - return m.Val == nil || *m.Val != "" -} - -// UnmarshalXML implements the xml.Unmarshaler interface for Marker. -func (m *Marker) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var out string - err := d.DecodeElement(&out, &start) - m.Val = &out - return err -} - -// concatenates a slice of const values with the specified separator between each item -func joinConst(s interface{}, sep string) string { - v := reflect.ValueOf(s) - if v.Kind() != reflect.Slice && v.Kind() != reflect.Array { - panic("s wasn't a slice or array") - } - ss := make([]string, 0, v.Len()) - for i := 0; i < v.Len(); i++ { - ss = append(ss, v.Index(i).String()) - } - return strings.Join(ss, sep) -} - -func validateError(err error) { - if err != nil { - panic(err) - } -} - -// AccessTierType enumerates the values for access tier type. -type AccessTierType string - -const ( - // AccessTierArchive ... - AccessTierArchive AccessTierType = "Archive" - // AccessTierCool ... - AccessTierCool AccessTierType = "Cool" - // AccessTierHot ... - AccessTierHot AccessTierType = "Hot" - // AccessTierNone represents an empty AccessTierType. - AccessTierNone AccessTierType = "" - // AccessTierP10 ... - AccessTierP10 AccessTierType = "P10" - // AccessTierP15 ... - AccessTierP15 AccessTierType = "P15" - // AccessTierP20 ... - AccessTierP20 AccessTierType = "P20" - // AccessTierP30 ... - AccessTierP30 AccessTierType = "P30" - // AccessTierP4 ... - AccessTierP4 AccessTierType = "P4" - // AccessTierP40 ... - AccessTierP40 AccessTierType = "P40" - // AccessTierP50 ... - AccessTierP50 AccessTierType = "P50" - // AccessTierP6 ... - AccessTierP6 AccessTierType = "P6" - // AccessTierP60 ... - AccessTierP60 AccessTierType = "P60" - // AccessTierP70 ... - AccessTierP70 AccessTierType = "P70" - // AccessTierP80 ... - AccessTierP80 AccessTierType = "P80" -) - -// PossibleAccessTierTypeValues returns an array of possible values for the AccessTierType const type. -func PossibleAccessTierTypeValues() []AccessTierType { - return []AccessTierType{AccessTierArchive, AccessTierCool, AccessTierHot, AccessTierNone, AccessTierP10, AccessTierP15, AccessTierP20, AccessTierP30, AccessTierP4, AccessTierP40, AccessTierP50, AccessTierP6, AccessTierP60, AccessTierP70, AccessTierP80} -} - -// AccountKindType enumerates the values for account kind type. -type AccountKindType string - -const ( - // AccountKindBlobStorage ... - AccountKindBlobStorage AccountKindType = "BlobStorage" - // AccountKindNone represents an empty AccountKindType. - AccountKindNone AccountKindType = "" - // AccountKindStorage ... - AccountKindStorage AccountKindType = "Storage" - // AccountKindStorageV2 ... - AccountKindStorageV2 AccountKindType = "StorageV2" -) - -// PossibleAccountKindTypeValues returns an array of possible values for the AccountKindType const type. -func PossibleAccountKindTypeValues() []AccountKindType { - return []AccountKindType{AccountKindBlobStorage, AccountKindNone, AccountKindStorage, AccountKindStorageV2} -} - -// ArchiveStatusType enumerates the values for archive status type. -type ArchiveStatusType string - -const ( - // ArchiveStatusNone represents an empty ArchiveStatusType. - ArchiveStatusNone ArchiveStatusType = "" - // ArchiveStatusRehydratePendingToCool ... - ArchiveStatusRehydratePendingToCool ArchiveStatusType = "rehydrate-pending-to-cool" - // ArchiveStatusRehydratePendingToHot ... - ArchiveStatusRehydratePendingToHot ArchiveStatusType = "rehydrate-pending-to-hot" -) - -// PossibleArchiveStatusTypeValues returns an array of possible values for the ArchiveStatusType const type. -func PossibleArchiveStatusTypeValues() []ArchiveStatusType { - return []ArchiveStatusType{ArchiveStatusNone, ArchiveStatusRehydratePendingToCool, ArchiveStatusRehydratePendingToHot} -} - -// BlobType enumerates the values for blob type. -type BlobType string - -const ( - // BlobAppendBlob ... - BlobAppendBlob BlobType = "AppendBlob" - // BlobBlockBlob ... - BlobBlockBlob BlobType = "BlockBlob" - // BlobNone represents an empty BlobType. - BlobNone BlobType = "" - // BlobPageBlob ... - BlobPageBlob BlobType = "PageBlob" -) - -// PossibleBlobTypeValues returns an array of possible values for the BlobType const type. -func PossibleBlobTypeValues() []BlobType { - return []BlobType{BlobAppendBlob, BlobBlockBlob, BlobNone, BlobPageBlob} -} - -// BlockListType enumerates the values for block list type. -type BlockListType string - -const ( - // BlockListAll ... - BlockListAll BlockListType = "all" - // BlockListCommitted ... - BlockListCommitted BlockListType = "committed" - // BlockListNone represents an empty BlockListType. - BlockListNone BlockListType = "" - // BlockListUncommitted ... - BlockListUncommitted BlockListType = "uncommitted" -) - -// PossibleBlockListTypeValues returns an array of possible values for the BlockListType const type. -func PossibleBlockListTypeValues() []BlockListType { - return []BlockListType{BlockListAll, BlockListCommitted, BlockListNone, BlockListUncommitted} -} - -// CopyStatusType enumerates the values for copy status type. -type CopyStatusType string - -const ( - // CopyStatusAborted ... - CopyStatusAborted CopyStatusType = "aborted" - // CopyStatusFailed ... - CopyStatusFailed CopyStatusType = "failed" - // CopyStatusNone represents an empty CopyStatusType. - CopyStatusNone CopyStatusType = "" - // CopyStatusPending ... - CopyStatusPending CopyStatusType = "pending" - // CopyStatusSuccess ... - CopyStatusSuccess CopyStatusType = "success" -) - -// PossibleCopyStatusTypeValues returns an array of possible values for the CopyStatusType const type. -func PossibleCopyStatusTypeValues() []CopyStatusType { - return []CopyStatusType{CopyStatusAborted, CopyStatusFailed, CopyStatusNone, CopyStatusPending, CopyStatusSuccess} -} - -// DeleteSnapshotsOptionType enumerates the values for delete snapshots option type. -type DeleteSnapshotsOptionType string - -const ( - // DeleteSnapshotsOptionInclude ... - DeleteSnapshotsOptionInclude DeleteSnapshotsOptionType = "include" - // DeleteSnapshotsOptionNone represents an empty DeleteSnapshotsOptionType. - DeleteSnapshotsOptionNone DeleteSnapshotsOptionType = "" - // DeleteSnapshotsOptionOnly ... - DeleteSnapshotsOptionOnly DeleteSnapshotsOptionType = "only" -) - -// PossibleDeleteSnapshotsOptionTypeValues returns an array of possible values for the DeleteSnapshotsOptionType const type. -func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType { - return []DeleteSnapshotsOptionType{DeleteSnapshotsOptionInclude, DeleteSnapshotsOptionNone, DeleteSnapshotsOptionOnly} -} - -// EncryptionAlgorithmType enumerates the values for encryption algorithm type. -type EncryptionAlgorithmType string - -const ( - // EncryptionAlgorithmAES256 ... - EncryptionAlgorithmAES256 EncryptionAlgorithmType = "AES256" - // EncryptionAlgorithmNone represents an empty EncryptionAlgorithmType. - EncryptionAlgorithmNone EncryptionAlgorithmType = "" -) - -// PossibleEncryptionAlgorithmTypeValues returns an array of possible values for the EncryptionAlgorithmType const type. -func PossibleEncryptionAlgorithmTypeValues() []EncryptionAlgorithmType { - return []EncryptionAlgorithmType{EncryptionAlgorithmAES256, EncryptionAlgorithmNone} -} - -// GeoReplicationStatusType enumerates the values for geo replication status type. -type GeoReplicationStatusType string - -const ( - // GeoReplicationStatusBootstrap ... - GeoReplicationStatusBootstrap GeoReplicationStatusType = "bootstrap" - // GeoReplicationStatusLive ... - GeoReplicationStatusLive GeoReplicationStatusType = "live" - // GeoReplicationStatusNone represents an empty GeoReplicationStatusType. - GeoReplicationStatusNone GeoReplicationStatusType = "" - // GeoReplicationStatusUnavailable ... - GeoReplicationStatusUnavailable GeoReplicationStatusType = "unavailable" -) - -// PossibleGeoReplicationStatusTypeValues returns an array of possible values for the GeoReplicationStatusType const type. -func PossibleGeoReplicationStatusTypeValues() []GeoReplicationStatusType { - return []GeoReplicationStatusType{GeoReplicationStatusBootstrap, GeoReplicationStatusLive, GeoReplicationStatusNone, GeoReplicationStatusUnavailable} -} - -// LeaseDurationType enumerates the values for lease duration type. -type LeaseDurationType string - -const ( - // LeaseDurationFixed ... - LeaseDurationFixed LeaseDurationType = "fixed" - // LeaseDurationInfinite ... - LeaseDurationInfinite LeaseDurationType = "infinite" - // LeaseDurationNone represents an empty LeaseDurationType. - LeaseDurationNone LeaseDurationType = "" -) - -// PossibleLeaseDurationTypeValues returns an array of possible values for the LeaseDurationType const type. -func PossibleLeaseDurationTypeValues() []LeaseDurationType { - return []LeaseDurationType{LeaseDurationFixed, LeaseDurationInfinite, LeaseDurationNone} -} - -// LeaseStateType enumerates the values for lease state type. -type LeaseStateType string - -const ( - // LeaseStateAvailable ... - LeaseStateAvailable LeaseStateType = "available" - // LeaseStateBreaking ... - LeaseStateBreaking LeaseStateType = "breaking" - // LeaseStateBroken ... - LeaseStateBroken LeaseStateType = "broken" - // LeaseStateExpired ... - LeaseStateExpired LeaseStateType = "expired" - // LeaseStateLeased ... - LeaseStateLeased LeaseStateType = "leased" - // LeaseStateNone represents an empty LeaseStateType. - LeaseStateNone LeaseStateType = "" -) - -// PossibleLeaseStateTypeValues returns an array of possible values for the LeaseStateType const type. -func PossibleLeaseStateTypeValues() []LeaseStateType { - return []LeaseStateType{LeaseStateAvailable, LeaseStateBreaking, LeaseStateBroken, LeaseStateExpired, LeaseStateLeased, LeaseStateNone} -} - -// LeaseStatusType enumerates the values for lease status type. -type LeaseStatusType string - -const ( - // LeaseStatusLocked ... - LeaseStatusLocked LeaseStatusType = "locked" - // LeaseStatusNone represents an empty LeaseStatusType. - LeaseStatusNone LeaseStatusType = "" - // LeaseStatusUnlocked ... - LeaseStatusUnlocked LeaseStatusType = "unlocked" -) - -// PossibleLeaseStatusTypeValues returns an array of possible values for the LeaseStatusType const type. -func PossibleLeaseStatusTypeValues() []LeaseStatusType { - return []LeaseStatusType{LeaseStatusLocked, LeaseStatusNone, LeaseStatusUnlocked} -} - -// ListBlobsIncludeItemType enumerates the values for list blobs include item type. -type ListBlobsIncludeItemType string - -const ( - // ListBlobsIncludeItemCopy ... - ListBlobsIncludeItemCopy ListBlobsIncludeItemType = "copy" - // ListBlobsIncludeItemDeleted ... - ListBlobsIncludeItemDeleted ListBlobsIncludeItemType = "deleted" - // ListBlobsIncludeItemMetadata ... - ListBlobsIncludeItemMetadata ListBlobsIncludeItemType = "metadata" - // ListBlobsIncludeItemNone represents an empty ListBlobsIncludeItemType. - ListBlobsIncludeItemNone ListBlobsIncludeItemType = "" - // ListBlobsIncludeItemSnapshots ... - ListBlobsIncludeItemSnapshots ListBlobsIncludeItemType = "snapshots" - // ListBlobsIncludeItemUncommittedblobs ... - ListBlobsIncludeItemUncommittedblobs ListBlobsIncludeItemType = "uncommittedblobs" -) - -// PossibleListBlobsIncludeItemTypeValues returns an array of possible values for the ListBlobsIncludeItemType const type. -func PossibleListBlobsIncludeItemTypeValues() []ListBlobsIncludeItemType { - return []ListBlobsIncludeItemType{ListBlobsIncludeItemCopy, ListBlobsIncludeItemDeleted, ListBlobsIncludeItemMetadata, ListBlobsIncludeItemNone, ListBlobsIncludeItemSnapshots, ListBlobsIncludeItemUncommittedblobs} -} - -// ListContainersIncludeType enumerates the values for list containers include type. -type ListContainersIncludeType string - -const ( - // ListContainersIncludeMetadata ... - ListContainersIncludeMetadata ListContainersIncludeType = "metadata" - // ListContainersIncludeNone represents an empty ListContainersIncludeType. - ListContainersIncludeNone ListContainersIncludeType = "" -) - -// PossibleListContainersIncludeTypeValues returns an array of possible values for the ListContainersIncludeType const type. -func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType { - return []ListContainersIncludeType{ListContainersIncludeMetadata, ListContainersIncludeNone} -} - -// PathRenameModeType enumerates the values for path rename mode type. -type PathRenameModeType string - -const ( - // PathRenameModeLegacy ... - PathRenameModeLegacy PathRenameModeType = "legacy" - // PathRenameModeNone represents an empty PathRenameModeType. - PathRenameModeNone PathRenameModeType = "" - // PathRenameModePosix ... - PathRenameModePosix PathRenameModeType = "posix" -) - -// PossiblePathRenameModeTypeValues returns an array of possible values for the PathRenameModeType const type. -func PossiblePathRenameModeTypeValues() []PathRenameModeType { - return []PathRenameModeType{PathRenameModeLegacy, PathRenameModeNone, PathRenameModePosix} -} - -// PremiumPageBlobAccessTierType enumerates the values for premium page blob access tier type. -type PremiumPageBlobAccessTierType string - -const ( - // PremiumPageBlobAccessTierNone represents an empty PremiumPageBlobAccessTierType. - PremiumPageBlobAccessTierNone PremiumPageBlobAccessTierType = "" - // PremiumPageBlobAccessTierP10 ... - PremiumPageBlobAccessTierP10 PremiumPageBlobAccessTierType = "P10" - // PremiumPageBlobAccessTierP15 ... - PremiumPageBlobAccessTierP15 PremiumPageBlobAccessTierType = "P15" - // PremiumPageBlobAccessTierP20 ... - PremiumPageBlobAccessTierP20 PremiumPageBlobAccessTierType = "P20" - // PremiumPageBlobAccessTierP30 ... - PremiumPageBlobAccessTierP30 PremiumPageBlobAccessTierType = "P30" - // PremiumPageBlobAccessTierP4 ... - PremiumPageBlobAccessTierP4 PremiumPageBlobAccessTierType = "P4" - // PremiumPageBlobAccessTierP40 ... - PremiumPageBlobAccessTierP40 PremiumPageBlobAccessTierType = "P40" - // PremiumPageBlobAccessTierP50 ... - PremiumPageBlobAccessTierP50 PremiumPageBlobAccessTierType = "P50" - // PremiumPageBlobAccessTierP6 ... - PremiumPageBlobAccessTierP6 PremiumPageBlobAccessTierType = "P6" - // PremiumPageBlobAccessTierP60 ... - PremiumPageBlobAccessTierP60 PremiumPageBlobAccessTierType = "P60" - // PremiumPageBlobAccessTierP70 ... - PremiumPageBlobAccessTierP70 PremiumPageBlobAccessTierType = "P70" - // PremiumPageBlobAccessTierP80 ... - PremiumPageBlobAccessTierP80 PremiumPageBlobAccessTierType = "P80" -) - -// PossiblePremiumPageBlobAccessTierTypeValues returns an array of possible values for the PremiumPageBlobAccessTierType const type. -func PossiblePremiumPageBlobAccessTierTypeValues() []PremiumPageBlobAccessTierType { - return []PremiumPageBlobAccessTierType{PremiumPageBlobAccessTierNone, PremiumPageBlobAccessTierP10, PremiumPageBlobAccessTierP15, PremiumPageBlobAccessTierP20, PremiumPageBlobAccessTierP30, PremiumPageBlobAccessTierP4, PremiumPageBlobAccessTierP40, PremiumPageBlobAccessTierP50, PremiumPageBlobAccessTierP6, PremiumPageBlobAccessTierP60, PremiumPageBlobAccessTierP70, PremiumPageBlobAccessTierP80} -} - -// PublicAccessType enumerates the values for public access type. -type PublicAccessType string - -const ( - // PublicAccessBlob ... - PublicAccessBlob PublicAccessType = "blob" - // PublicAccessContainer ... - PublicAccessContainer PublicAccessType = "container" - // PublicAccessNone represents an empty PublicAccessType. - PublicAccessNone PublicAccessType = "" -) - -// PossiblePublicAccessTypeValues returns an array of possible values for the PublicAccessType const type. -func PossiblePublicAccessTypeValues() []PublicAccessType { - return []PublicAccessType{PublicAccessBlob, PublicAccessContainer, PublicAccessNone} -} - -// RehydratePriorityType enumerates the values for rehydrate priority type. -type RehydratePriorityType string - -const ( - // RehydratePriorityHigh ... - RehydratePriorityHigh RehydratePriorityType = "High" - // RehydratePriorityNone represents an empty RehydratePriorityType. - RehydratePriorityNone RehydratePriorityType = "" - // RehydratePriorityStandard ... - RehydratePriorityStandard RehydratePriorityType = "Standard" -) - -// PossibleRehydratePriorityTypeValues returns an array of possible values for the RehydratePriorityType const type. -func PossibleRehydratePriorityTypeValues() []RehydratePriorityType { - return []RehydratePriorityType{RehydratePriorityHigh, RehydratePriorityNone, RehydratePriorityStandard} -} - -// SequenceNumberActionType enumerates the values for sequence number action type. -type SequenceNumberActionType string - -const ( - // SequenceNumberActionIncrement ... - SequenceNumberActionIncrement SequenceNumberActionType = "increment" - // SequenceNumberActionMax ... - SequenceNumberActionMax SequenceNumberActionType = "max" - // SequenceNumberActionNone represents an empty SequenceNumberActionType. - SequenceNumberActionNone SequenceNumberActionType = "" - // SequenceNumberActionUpdate ... - SequenceNumberActionUpdate SequenceNumberActionType = "update" -) - -// PossibleSequenceNumberActionTypeValues returns an array of possible values for the SequenceNumberActionType const type. -func PossibleSequenceNumberActionTypeValues() []SequenceNumberActionType { - return []SequenceNumberActionType{SequenceNumberActionIncrement, SequenceNumberActionMax, SequenceNumberActionNone, SequenceNumberActionUpdate} -} - -// SkuNameType enumerates the values for sku name type. -type SkuNameType string - -const ( - // SkuNameNone represents an empty SkuNameType. - SkuNameNone SkuNameType = "" - // SkuNamePremiumLRS ... - SkuNamePremiumLRS SkuNameType = "Premium_LRS" - // SkuNameStandardGRS ... - SkuNameStandardGRS SkuNameType = "Standard_GRS" - // SkuNameStandardLRS ... - SkuNameStandardLRS SkuNameType = "Standard_LRS" - // SkuNameStandardRAGRS ... - SkuNameStandardRAGRS SkuNameType = "Standard_RAGRS" - // SkuNameStandardZRS ... - SkuNameStandardZRS SkuNameType = "Standard_ZRS" -) - -// PossibleSkuNameTypeValues returns an array of possible values for the SkuNameType const type. -func PossibleSkuNameTypeValues() []SkuNameType { - return []SkuNameType{SkuNameNone, SkuNamePremiumLRS, SkuNameStandardGRS, SkuNameStandardLRS, SkuNameStandardRAGRS, SkuNameStandardZRS} -} - -// StorageErrorCodeType enumerates the values for storage error code type. -type StorageErrorCodeType string - -const ( - // StorageErrorCodeAccountAlreadyExists ... - StorageErrorCodeAccountAlreadyExists StorageErrorCodeType = "AccountAlreadyExists" - // StorageErrorCodeAccountBeingCreated ... - StorageErrorCodeAccountBeingCreated StorageErrorCodeType = "AccountBeingCreated" - // StorageErrorCodeAccountIsDisabled ... - StorageErrorCodeAccountIsDisabled StorageErrorCodeType = "AccountIsDisabled" - // StorageErrorCodeAppendPositionConditionNotMet ... - StorageErrorCodeAppendPositionConditionNotMet StorageErrorCodeType = "AppendPositionConditionNotMet" - // StorageErrorCodeAuthenticationFailed ... - StorageErrorCodeAuthenticationFailed StorageErrorCodeType = "AuthenticationFailed" - // StorageErrorCodeAuthorizationFailure ... - StorageErrorCodeAuthorizationFailure StorageErrorCodeType = "AuthorizationFailure" - // StorageErrorCodeAuthorizationPermissionMismatch ... - StorageErrorCodeAuthorizationPermissionMismatch StorageErrorCodeType = "AuthorizationPermissionMismatch" - // StorageErrorCodeAuthorizationProtocolMismatch ... - StorageErrorCodeAuthorizationProtocolMismatch StorageErrorCodeType = "AuthorizationProtocolMismatch" - // StorageErrorCodeAuthorizationResourceTypeMismatch ... - StorageErrorCodeAuthorizationResourceTypeMismatch StorageErrorCodeType = "AuthorizationResourceTypeMismatch" - // StorageErrorCodeAuthorizationServiceMismatch ... - StorageErrorCodeAuthorizationServiceMismatch StorageErrorCodeType = "AuthorizationServiceMismatch" - // StorageErrorCodeAuthorizationSourceIPMismatch ... - StorageErrorCodeAuthorizationSourceIPMismatch StorageErrorCodeType = "AuthorizationSourceIPMismatch" - // StorageErrorCodeBlobAlreadyExists ... - StorageErrorCodeBlobAlreadyExists StorageErrorCodeType = "BlobAlreadyExists" - // StorageErrorCodeBlobArchived ... - StorageErrorCodeBlobArchived StorageErrorCodeType = "BlobArchived" - // StorageErrorCodeBlobBeingRehydrated ... - StorageErrorCodeBlobBeingRehydrated StorageErrorCodeType = "BlobBeingRehydrated" - // StorageErrorCodeBlobNotArchived ... - StorageErrorCodeBlobNotArchived StorageErrorCodeType = "BlobNotArchived" - // StorageErrorCodeBlobNotFound ... - StorageErrorCodeBlobNotFound StorageErrorCodeType = "BlobNotFound" - // StorageErrorCodeBlobOverwritten ... - StorageErrorCodeBlobOverwritten StorageErrorCodeType = "BlobOverwritten" - // StorageErrorCodeBlobTierInadequateForContentLength ... - StorageErrorCodeBlobTierInadequateForContentLength StorageErrorCodeType = "BlobTierInadequateForContentLength" - // StorageErrorCodeBlockCountExceedsLimit ... - StorageErrorCodeBlockCountExceedsLimit StorageErrorCodeType = "BlockCountExceedsLimit" - // StorageErrorCodeBlockListTooLong ... - StorageErrorCodeBlockListTooLong StorageErrorCodeType = "BlockListTooLong" - // StorageErrorCodeCannotChangeToLowerTier ... - StorageErrorCodeCannotChangeToLowerTier StorageErrorCodeType = "CannotChangeToLowerTier" - // StorageErrorCodeCannotVerifyCopySource ... - StorageErrorCodeCannotVerifyCopySource StorageErrorCodeType = "CannotVerifyCopySource" - // StorageErrorCodeConditionHeadersNotSupported ... - StorageErrorCodeConditionHeadersNotSupported StorageErrorCodeType = "ConditionHeadersNotSupported" - // StorageErrorCodeConditionNotMet ... - StorageErrorCodeConditionNotMet StorageErrorCodeType = "ConditionNotMet" - // StorageErrorCodeContainerAlreadyExists ... - StorageErrorCodeContainerAlreadyExists StorageErrorCodeType = "ContainerAlreadyExists" - // StorageErrorCodeContainerBeingDeleted ... - StorageErrorCodeContainerBeingDeleted StorageErrorCodeType = "ContainerBeingDeleted" - // StorageErrorCodeContainerDisabled ... - StorageErrorCodeContainerDisabled StorageErrorCodeType = "ContainerDisabled" - // StorageErrorCodeContainerNotFound ... - StorageErrorCodeContainerNotFound StorageErrorCodeType = "ContainerNotFound" - // StorageErrorCodeContentLengthLargerThanTierLimit ... - StorageErrorCodeContentLengthLargerThanTierLimit StorageErrorCodeType = "ContentLengthLargerThanTierLimit" - // StorageErrorCodeCopyAcrossAccountsNotSupported ... - StorageErrorCodeCopyAcrossAccountsNotSupported StorageErrorCodeType = "CopyAcrossAccountsNotSupported" - // StorageErrorCodeCopyIDMismatch ... - StorageErrorCodeCopyIDMismatch StorageErrorCodeType = "CopyIdMismatch" - // StorageErrorCodeEmptyMetadataKey ... - StorageErrorCodeEmptyMetadataKey StorageErrorCodeType = "EmptyMetadataKey" - // StorageErrorCodeFeatureVersionMismatch ... - StorageErrorCodeFeatureVersionMismatch StorageErrorCodeType = "FeatureVersionMismatch" - // StorageErrorCodeIncrementalCopyBlobMismatch ... - StorageErrorCodeIncrementalCopyBlobMismatch StorageErrorCodeType = "IncrementalCopyBlobMismatch" - // StorageErrorCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed ... - StorageErrorCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed StorageErrorCodeType = "IncrementalCopyOfEralierVersionSnapshotNotAllowed" - // StorageErrorCodeIncrementalCopySourceMustBeSnapshot ... - StorageErrorCodeIncrementalCopySourceMustBeSnapshot StorageErrorCodeType = "IncrementalCopySourceMustBeSnapshot" - // StorageErrorCodeInfiniteLeaseDurationRequired ... - StorageErrorCodeInfiniteLeaseDurationRequired StorageErrorCodeType = "InfiniteLeaseDurationRequired" - // StorageErrorCodeInsufficientAccountPermissions ... - StorageErrorCodeInsufficientAccountPermissions StorageErrorCodeType = "InsufficientAccountPermissions" - // StorageErrorCodeInternalError ... - StorageErrorCodeInternalError StorageErrorCodeType = "InternalError" - // StorageErrorCodeInvalidAuthenticationInfo ... - StorageErrorCodeInvalidAuthenticationInfo StorageErrorCodeType = "InvalidAuthenticationInfo" - // StorageErrorCodeInvalidBlobOrBlock ... - StorageErrorCodeInvalidBlobOrBlock StorageErrorCodeType = "InvalidBlobOrBlock" - // StorageErrorCodeInvalidBlobTier ... - StorageErrorCodeInvalidBlobTier StorageErrorCodeType = "InvalidBlobTier" - // StorageErrorCodeInvalidBlobType ... - StorageErrorCodeInvalidBlobType StorageErrorCodeType = "InvalidBlobType" - // StorageErrorCodeInvalidBlockID ... - StorageErrorCodeInvalidBlockID StorageErrorCodeType = "InvalidBlockId" - // StorageErrorCodeInvalidBlockList ... - StorageErrorCodeInvalidBlockList StorageErrorCodeType = "InvalidBlockList" - // StorageErrorCodeInvalidHeaderValue ... - StorageErrorCodeInvalidHeaderValue StorageErrorCodeType = "InvalidHeaderValue" - // StorageErrorCodeInvalidHTTPVerb ... - StorageErrorCodeInvalidHTTPVerb StorageErrorCodeType = "InvalidHttpVerb" - // StorageErrorCodeInvalidInput ... - StorageErrorCodeInvalidInput StorageErrorCodeType = "InvalidInput" - // StorageErrorCodeInvalidMd5 ... - StorageErrorCodeInvalidMd5 StorageErrorCodeType = "InvalidMd5" - // StorageErrorCodeInvalidMetadata ... - StorageErrorCodeInvalidMetadata StorageErrorCodeType = "InvalidMetadata" - // StorageErrorCodeInvalidOperation ... - StorageErrorCodeInvalidOperation StorageErrorCodeType = "InvalidOperation" - // StorageErrorCodeInvalidPageRange ... - StorageErrorCodeInvalidPageRange StorageErrorCodeType = "InvalidPageRange" - // StorageErrorCodeInvalidQueryParameterValue ... - StorageErrorCodeInvalidQueryParameterValue StorageErrorCodeType = "InvalidQueryParameterValue" - // StorageErrorCodeInvalidRange ... - StorageErrorCodeInvalidRange StorageErrorCodeType = "InvalidRange" - // StorageErrorCodeInvalidResourceName ... - StorageErrorCodeInvalidResourceName StorageErrorCodeType = "InvalidResourceName" - // StorageErrorCodeInvalidSourceBlobType ... - StorageErrorCodeInvalidSourceBlobType StorageErrorCodeType = "InvalidSourceBlobType" - // StorageErrorCodeInvalidSourceBlobURL ... - StorageErrorCodeInvalidSourceBlobURL StorageErrorCodeType = "InvalidSourceBlobUrl" - // StorageErrorCodeInvalidURI ... - StorageErrorCodeInvalidURI StorageErrorCodeType = "InvalidUri" - // StorageErrorCodeInvalidVersionForPageBlobOperation ... - StorageErrorCodeInvalidVersionForPageBlobOperation StorageErrorCodeType = "InvalidVersionForPageBlobOperation" - // StorageErrorCodeInvalidXMLDocument ... - StorageErrorCodeInvalidXMLDocument StorageErrorCodeType = "InvalidXmlDocument" - // StorageErrorCodeInvalidXMLNodeValue ... - StorageErrorCodeInvalidXMLNodeValue StorageErrorCodeType = "InvalidXmlNodeValue" - // StorageErrorCodeLeaseAlreadyBroken ... - StorageErrorCodeLeaseAlreadyBroken StorageErrorCodeType = "LeaseAlreadyBroken" - // StorageErrorCodeLeaseAlreadyPresent ... - StorageErrorCodeLeaseAlreadyPresent StorageErrorCodeType = "LeaseAlreadyPresent" - // StorageErrorCodeLeaseIDMismatchWithBlobOperation ... - StorageErrorCodeLeaseIDMismatchWithBlobOperation StorageErrorCodeType = "LeaseIdMismatchWithBlobOperation" - // StorageErrorCodeLeaseIDMismatchWithContainerOperation ... - StorageErrorCodeLeaseIDMismatchWithContainerOperation StorageErrorCodeType = "LeaseIdMismatchWithContainerOperation" - // StorageErrorCodeLeaseIDMismatchWithLeaseOperation ... - StorageErrorCodeLeaseIDMismatchWithLeaseOperation StorageErrorCodeType = "LeaseIdMismatchWithLeaseOperation" - // StorageErrorCodeLeaseIDMissing ... - StorageErrorCodeLeaseIDMissing StorageErrorCodeType = "LeaseIdMissing" - // StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired ... - StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired StorageErrorCodeType = "LeaseIsBreakingAndCannotBeAcquired" - // StorageErrorCodeLeaseIsBreakingAndCannotBeChanged ... - StorageErrorCodeLeaseIsBreakingAndCannotBeChanged StorageErrorCodeType = "LeaseIsBreakingAndCannotBeChanged" - // StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed ... - StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed StorageErrorCodeType = "LeaseIsBrokenAndCannotBeRenewed" - // StorageErrorCodeLeaseLost ... - StorageErrorCodeLeaseLost StorageErrorCodeType = "LeaseLost" - // StorageErrorCodeLeaseNotPresentWithBlobOperation ... - StorageErrorCodeLeaseNotPresentWithBlobOperation StorageErrorCodeType = "LeaseNotPresentWithBlobOperation" - // StorageErrorCodeLeaseNotPresentWithContainerOperation ... - StorageErrorCodeLeaseNotPresentWithContainerOperation StorageErrorCodeType = "LeaseNotPresentWithContainerOperation" - // StorageErrorCodeLeaseNotPresentWithLeaseOperation ... - StorageErrorCodeLeaseNotPresentWithLeaseOperation StorageErrorCodeType = "LeaseNotPresentWithLeaseOperation" - // StorageErrorCodeMaxBlobSizeConditionNotMet ... - StorageErrorCodeMaxBlobSizeConditionNotMet StorageErrorCodeType = "MaxBlobSizeConditionNotMet" - // StorageErrorCodeMd5Mismatch ... - StorageErrorCodeMd5Mismatch StorageErrorCodeType = "Md5Mismatch" - // StorageErrorCodeMetadataTooLarge ... - StorageErrorCodeMetadataTooLarge StorageErrorCodeType = "MetadataTooLarge" - // StorageErrorCodeMissingContentLengthHeader ... - StorageErrorCodeMissingContentLengthHeader StorageErrorCodeType = "MissingContentLengthHeader" - // StorageErrorCodeMissingRequiredHeader ... - StorageErrorCodeMissingRequiredHeader StorageErrorCodeType = "MissingRequiredHeader" - // StorageErrorCodeMissingRequiredQueryParameter ... - StorageErrorCodeMissingRequiredQueryParameter StorageErrorCodeType = "MissingRequiredQueryParameter" - // StorageErrorCodeMissingRequiredXMLNode ... - StorageErrorCodeMissingRequiredXMLNode StorageErrorCodeType = "MissingRequiredXmlNode" - // StorageErrorCodeMultipleConditionHeadersNotSupported ... - StorageErrorCodeMultipleConditionHeadersNotSupported StorageErrorCodeType = "MultipleConditionHeadersNotSupported" - // StorageErrorCodeNone represents an empty StorageErrorCodeType. - StorageErrorCodeNone StorageErrorCodeType = "" - // StorageErrorCodeNoPendingCopyOperation ... - StorageErrorCodeNoPendingCopyOperation StorageErrorCodeType = "NoPendingCopyOperation" - // StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob ... - StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob StorageErrorCodeType = "OperationNotAllowedOnIncrementalCopyBlob" - // StorageErrorCodeOperationTimedOut ... - StorageErrorCodeOperationTimedOut StorageErrorCodeType = "OperationTimedOut" - // StorageErrorCodeOutOfRangeInput ... - StorageErrorCodeOutOfRangeInput StorageErrorCodeType = "OutOfRangeInput" - // StorageErrorCodeOutOfRangeQueryParameterValue ... - StorageErrorCodeOutOfRangeQueryParameterValue StorageErrorCodeType = "OutOfRangeQueryParameterValue" - // StorageErrorCodePendingCopyOperation ... - StorageErrorCodePendingCopyOperation StorageErrorCodeType = "PendingCopyOperation" - // StorageErrorCodePreviousSnapshotCannotBeNewer ... - StorageErrorCodePreviousSnapshotCannotBeNewer StorageErrorCodeType = "PreviousSnapshotCannotBeNewer" - // StorageErrorCodePreviousSnapshotNotFound ... - StorageErrorCodePreviousSnapshotNotFound StorageErrorCodeType = "PreviousSnapshotNotFound" - // StorageErrorCodePreviousSnapshotOperationNotSupported ... - StorageErrorCodePreviousSnapshotOperationNotSupported StorageErrorCodeType = "PreviousSnapshotOperationNotSupported" - // StorageErrorCodeRequestBodyTooLarge ... - StorageErrorCodeRequestBodyTooLarge StorageErrorCodeType = "RequestBodyTooLarge" - // StorageErrorCodeRequestURLFailedToParse ... - StorageErrorCodeRequestURLFailedToParse StorageErrorCodeType = "RequestUrlFailedToParse" - // StorageErrorCodeResourceAlreadyExists ... - StorageErrorCodeResourceAlreadyExists StorageErrorCodeType = "ResourceAlreadyExists" - // StorageErrorCodeResourceNotFound ... - StorageErrorCodeResourceNotFound StorageErrorCodeType = "ResourceNotFound" - // StorageErrorCodeResourceTypeMismatch ... - StorageErrorCodeResourceTypeMismatch StorageErrorCodeType = "ResourceTypeMismatch" - // StorageErrorCodeSequenceNumberConditionNotMet ... - StorageErrorCodeSequenceNumberConditionNotMet StorageErrorCodeType = "SequenceNumberConditionNotMet" - // StorageErrorCodeSequenceNumberIncrementTooLarge ... - StorageErrorCodeSequenceNumberIncrementTooLarge StorageErrorCodeType = "SequenceNumberIncrementTooLarge" - // StorageErrorCodeServerBusy ... - StorageErrorCodeServerBusy StorageErrorCodeType = "ServerBusy" - // StorageErrorCodeSnaphotOperationRateExceeded ... - StorageErrorCodeSnaphotOperationRateExceeded StorageErrorCodeType = "SnaphotOperationRateExceeded" - // StorageErrorCodeSnapshotCountExceeded ... - StorageErrorCodeSnapshotCountExceeded StorageErrorCodeType = "SnapshotCountExceeded" - // StorageErrorCodeSnapshotsPresent ... - StorageErrorCodeSnapshotsPresent StorageErrorCodeType = "SnapshotsPresent" - // StorageErrorCodeSourceConditionNotMet ... - StorageErrorCodeSourceConditionNotMet StorageErrorCodeType = "SourceConditionNotMet" - // StorageErrorCodeSystemInUse ... - StorageErrorCodeSystemInUse StorageErrorCodeType = "SystemInUse" - // StorageErrorCodeTargetConditionNotMet ... - StorageErrorCodeTargetConditionNotMet StorageErrorCodeType = "TargetConditionNotMet" - // StorageErrorCodeUnauthorizedBlobOverwrite ... - StorageErrorCodeUnauthorizedBlobOverwrite StorageErrorCodeType = "UnauthorizedBlobOverwrite" - // StorageErrorCodeUnsupportedHeader ... - StorageErrorCodeUnsupportedHeader StorageErrorCodeType = "UnsupportedHeader" - // StorageErrorCodeUnsupportedHTTPVerb ... - StorageErrorCodeUnsupportedHTTPVerb StorageErrorCodeType = "UnsupportedHttpVerb" - // StorageErrorCodeUnsupportedQueryParameter ... - StorageErrorCodeUnsupportedQueryParameter StorageErrorCodeType = "UnsupportedQueryParameter" - // StorageErrorCodeUnsupportedXMLNode ... - StorageErrorCodeUnsupportedXMLNode StorageErrorCodeType = "UnsupportedXmlNode" -) - -// PossibleStorageErrorCodeTypeValues returns an array of possible values for the StorageErrorCodeType const type. -func PossibleStorageErrorCodeTypeValues() []StorageErrorCodeType { - return []StorageErrorCodeType{StorageErrorCodeAccountAlreadyExists, StorageErrorCodeAccountBeingCreated, StorageErrorCodeAccountIsDisabled, StorageErrorCodeAppendPositionConditionNotMet, StorageErrorCodeAuthenticationFailed, StorageErrorCodeAuthorizationFailure, StorageErrorCodeAuthorizationPermissionMismatch, StorageErrorCodeAuthorizationProtocolMismatch, StorageErrorCodeAuthorizationResourceTypeMismatch, StorageErrorCodeAuthorizationServiceMismatch, StorageErrorCodeAuthorizationSourceIPMismatch, StorageErrorCodeBlobAlreadyExists, StorageErrorCodeBlobArchived, StorageErrorCodeBlobBeingRehydrated, StorageErrorCodeBlobNotArchived, StorageErrorCodeBlobNotFound, StorageErrorCodeBlobOverwritten, StorageErrorCodeBlobTierInadequateForContentLength, StorageErrorCodeBlockCountExceedsLimit, StorageErrorCodeBlockListTooLong, StorageErrorCodeCannotChangeToLowerTier, StorageErrorCodeCannotVerifyCopySource, StorageErrorCodeConditionHeadersNotSupported, StorageErrorCodeConditionNotMet, StorageErrorCodeContainerAlreadyExists, StorageErrorCodeContainerBeingDeleted, StorageErrorCodeContainerDisabled, StorageErrorCodeContainerNotFound, StorageErrorCodeContentLengthLargerThanTierLimit, StorageErrorCodeCopyAcrossAccountsNotSupported, StorageErrorCodeCopyIDMismatch, StorageErrorCodeEmptyMetadataKey, StorageErrorCodeFeatureVersionMismatch, StorageErrorCodeIncrementalCopyBlobMismatch, StorageErrorCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed, StorageErrorCodeIncrementalCopySourceMustBeSnapshot, StorageErrorCodeInfiniteLeaseDurationRequired, StorageErrorCodeInsufficientAccountPermissions, StorageErrorCodeInternalError, StorageErrorCodeInvalidAuthenticationInfo, StorageErrorCodeInvalidBlobOrBlock, StorageErrorCodeInvalidBlobTier, StorageErrorCodeInvalidBlobType, StorageErrorCodeInvalidBlockID, StorageErrorCodeInvalidBlockList, StorageErrorCodeInvalidHeaderValue, StorageErrorCodeInvalidHTTPVerb, StorageErrorCodeInvalidInput, StorageErrorCodeInvalidMd5, StorageErrorCodeInvalidMetadata, StorageErrorCodeInvalidOperation, StorageErrorCodeInvalidPageRange, StorageErrorCodeInvalidQueryParameterValue, StorageErrorCodeInvalidRange, StorageErrorCodeInvalidResourceName, StorageErrorCodeInvalidSourceBlobType, StorageErrorCodeInvalidSourceBlobURL, StorageErrorCodeInvalidURI, StorageErrorCodeInvalidVersionForPageBlobOperation, StorageErrorCodeInvalidXMLDocument, StorageErrorCodeInvalidXMLNodeValue, StorageErrorCodeLeaseAlreadyBroken, StorageErrorCodeLeaseAlreadyPresent, StorageErrorCodeLeaseIDMismatchWithBlobOperation, StorageErrorCodeLeaseIDMismatchWithContainerOperation, StorageErrorCodeLeaseIDMismatchWithLeaseOperation, StorageErrorCodeLeaseIDMissing, StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired, StorageErrorCodeLeaseIsBreakingAndCannotBeChanged, StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed, StorageErrorCodeLeaseLost, StorageErrorCodeLeaseNotPresentWithBlobOperation, StorageErrorCodeLeaseNotPresentWithContainerOperation, StorageErrorCodeLeaseNotPresentWithLeaseOperation, StorageErrorCodeMaxBlobSizeConditionNotMet, StorageErrorCodeMd5Mismatch, StorageErrorCodeMetadataTooLarge, StorageErrorCodeMissingContentLengthHeader, StorageErrorCodeMissingRequiredHeader, StorageErrorCodeMissingRequiredQueryParameter, StorageErrorCodeMissingRequiredXMLNode, StorageErrorCodeMultipleConditionHeadersNotSupported, StorageErrorCodeNone, StorageErrorCodeNoPendingCopyOperation, StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob, StorageErrorCodeOperationTimedOut, StorageErrorCodeOutOfRangeInput, StorageErrorCodeOutOfRangeQueryParameterValue, StorageErrorCodePendingCopyOperation, StorageErrorCodePreviousSnapshotCannotBeNewer, StorageErrorCodePreviousSnapshotNotFound, StorageErrorCodePreviousSnapshotOperationNotSupported, StorageErrorCodeRequestBodyTooLarge, StorageErrorCodeRequestURLFailedToParse, StorageErrorCodeResourceAlreadyExists, StorageErrorCodeResourceNotFound, StorageErrorCodeResourceTypeMismatch, StorageErrorCodeSequenceNumberConditionNotMet, StorageErrorCodeSequenceNumberIncrementTooLarge, StorageErrorCodeServerBusy, StorageErrorCodeSnaphotOperationRateExceeded, StorageErrorCodeSnapshotCountExceeded, StorageErrorCodeSnapshotsPresent, StorageErrorCodeSourceConditionNotMet, StorageErrorCodeSystemInUse, StorageErrorCodeTargetConditionNotMet, StorageErrorCodeUnauthorizedBlobOverwrite, StorageErrorCodeUnsupportedHeader, StorageErrorCodeUnsupportedHTTPVerb, StorageErrorCodeUnsupportedQueryParameter, StorageErrorCodeUnsupportedXMLNode} -} - -// SyncCopyStatusType enumerates the values for sync copy status type. -type SyncCopyStatusType string - -const ( - // SyncCopyStatusNone represents an empty SyncCopyStatusType. - SyncCopyStatusNone SyncCopyStatusType = "" - // SyncCopyStatusSuccess ... - SyncCopyStatusSuccess SyncCopyStatusType = "success" -) - -// PossibleSyncCopyStatusTypeValues returns an array of possible values for the SyncCopyStatusType const type. -func PossibleSyncCopyStatusTypeValues() []SyncCopyStatusType { - return []SyncCopyStatusType{SyncCopyStatusNone, SyncCopyStatusSuccess} -} - -// AccessPolicy - An Access policy -type AccessPolicy struct { - // Start - the date-time the policy is active - Start time.Time `xml:"Start"` - // Expiry - the date-time the policy expires - Expiry time.Time `xml:"Expiry"` - // Permission - the permissions for the acl policy - Permission string `xml:"Permission"` -} - -// MarshalXML implements the xml.Marshaler interface for AccessPolicy. -func (ap AccessPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - ap2 := (*accessPolicy)(unsafe.Pointer(&ap)) - return e.EncodeElement(*ap2, start) -} - -// UnmarshalXML implements the xml.Unmarshaler interface for AccessPolicy. -func (ap *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - ap2 := (*accessPolicy)(unsafe.Pointer(ap)) - return d.DecodeElement(ap2, &start) -} - -// AppendBlobAppendBlockFromURLResponse ... -type AppendBlobAppendBlockFromURLResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (ababfur AppendBlobAppendBlockFromURLResponse) Response() *http.Response { - return ababfur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (ababfur AppendBlobAppendBlockFromURLResponse) StatusCode() int { - return ababfur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (ababfur AppendBlobAppendBlockFromURLResponse) Status() string { - return ababfur.rawResponse.Status -} - -// BlobAppendOffset returns the value for header x-ms-blob-append-offset. -func (ababfur AppendBlobAppendBlockFromURLResponse) BlobAppendOffset() string { - return ababfur.rawResponse.Header.Get("x-ms-blob-append-offset") -} - -// BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count. -func (ababfur AppendBlobAppendBlockFromURLResponse) BlobCommittedBlockCount() int32 { - s := ababfur.rawResponse.Header.Get("x-ms-blob-committed-block-count") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 32) - if err != nil { - i = 0 - } - return int32(i) -} - -// ContentMD5 returns the value for header Content-MD5. -func (ababfur AppendBlobAppendBlockFromURLResponse) ContentMD5() []byte { - s := ababfur.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (ababfur AppendBlobAppendBlockFromURLResponse) Date() time.Time { - s := ababfur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (ababfur AppendBlobAppendBlockFromURLResponse) EncryptionKeySha256() string { - return ababfur.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (ababfur AppendBlobAppendBlockFromURLResponse) ErrorCode() string { - return ababfur.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (ababfur AppendBlobAppendBlockFromURLResponse) ETag() ETag { - return ETag(ababfur.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (ababfur AppendBlobAppendBlockFromURLResponse) IsServerEncrypted() string { - return ababfur.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (ababfur AppendBlobAppendBlockFromURLResponse) LastModified() time.Time { - s := ababfur.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (ababfur AppendBlobAppendBlockFromURLResponse) RequestID() string { - return ababfur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (ababfur AppendBlobAppendBlockFromURLResponse) Version() string { - return ababfur.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (ababfur AppendBlobAppendBlockFromURLResponse) XMsContentCrc64() []byte { - s := ababfur.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// AppendBlobAppendBlockResponse ... -type AppendBlobAppendBlockResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (ababr AppendBlobAppendBlockResponse) Response() *http.Response { - return ababr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (ababr AppendBlobAppendBlockResponse) StatusCode() int { - return ababr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (ababr AppendBlobAppendBlockResponse) Status() string { - return ababr.rawResponse.Status -} - -// BlobAppendOffset returns the value for header x-ms-blob-append-offset. -func (ababr AppendBlobAppendBlockResponse) BlobAppendOffset() string { - return ababr.rawResponse.Header.Get("x-ms-blob-append-offset") -} - -// BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count. -func (ababr AppendBlobAppendBlockResponse) BlobCommittedBlockCount() int32 { - s := ababr.rawResponse.Header.Get("x-ms-blob-committed-block-count") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 32) - if err != nil { - i = 0 - } - return int32(i) -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (ababr AppendBlobAppendBlockResponse) ClientRequestID() string { - return ababr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (ababr AppendBlobAppendBlockResponse) ContentMD5() []byte { - s := ababr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (ababr AppendBlobAppendBlockResponse) Date() time.Time { - s := ababr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (ababr AppendBlobAppendBlockResponse) EncryptionKeySha256() string { - return ababr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (ababr AppendBlobAppendBlockResponse) ErrorCode() string { - return ababr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (ababr AppendBlobAppendBlockResponse) ETag() ETag { - return ETag(ababr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (ababr AppendBlobAppendBlockResponse) IsServerEncrypted() string { - return ababr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (ababr AppendBlobAppendBlockResponse) LastModified() time.Time { - s := ababr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (ababr AppendBlobAppendBlockResponse) RequestID() string { - return ababr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (ababr AppendBlobAppendBlockResponse) Version() string { - return ababr.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (ababr AppendBlobAppendBlockResponse) XMsContentCrc64() []byte { - s := ababr.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// AppendBlobCreateResponse ... -type AppendBlobCreateResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (abcr AppendBlobCreateResponse) Response() *http.Response { - return abcr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (abcr AppendBlobCreateResponse) StatusCode() int { - return abcr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (abcr AppendBlobCreateResponse) Status() string { - return abcr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (abcr AppendBlobCreateResponse) ClientRequestID() string { - return abcr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (abcr AppendBlobCreateResponse) ContentMD5() []byte { - s := abcr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (abcr AppendBlobCreateResponse) Date() time.Time { - s := abcr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (abcr AppendBlobCreateResponse) EncryptionKeySha256() string { - return abcr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (abcr AppendBlobCreateResponse) ErrorCode() string { - return abcr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (abcr AppendBlobCreateResponse) ETag() ETag { - return ETag(abcr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (abcr AppendBlobCreateResponse) IsServerEncrypted() string { - return abcr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (abcr AppendBlobCreateResponse) LastModified() time.Time { - s := abcr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (abcr AppendBlobCreateResponse) RequestID() string { - return abcr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (abcr AppendBlobCreateResponse) Version() string { - return abcr.rawResponse.Header.Get("x-ms-version") -} - -// BlobAbortCopyFromURLResponse ... -type BlobAbortCopyFromURLResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bacfur BlobAbortCopyFromURLResponse) Response() *http.Response { - return bacfur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bacfur BlobAbortCopyFromURLResponse) StatusCode() int { - return bacfur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bacfur BlobAbortCopyFromURLResponse) Status() string { - return bacfur.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bacfur BlobAbortCopyFromURLResponse) ClientRequestID() string { - return bacfur.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bacfur BlobAbortCopyFromURLResponse) Date() time.Time { - s := bacfur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bacfur BlobAbortCopyFromURLResponse) ErrorCode() string { - return bacfur.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (bacfur BlobAbortCopyFromURLResponse) RequestID() string { - return bacfur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bacfur BlobAbortCopyFromURLResponse) Version() string { - return bacfur.rawResponse.Header.Get("x-ms-version") -} - -// BlobAcquireLeaseResponse ... -type BlobAcquireLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (balr BlobAcquireLeaseResponse) Response() *http.Response { - return balr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (balr BlobAcquireLeaseResponse) StatusCode() int { - return balr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (balr BlobAcquireLeaseResponse) Status() string { - return balr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (balr BlobAcquireLeaseResponse) ClientRequestID() string { - return balr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (balr BlobAcquireLeaseResponse) Date() time.Time { - s := balr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (balr BlobAcquireLeaseResponse) ErrorCode() string { - return balr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (balr BlobAcquireLeaseResponse) ETag() ETag { - return ETag(balr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (balr BlobAcquireLeaseResponse) LastModified() time.Time { - s := balr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseID returns the value for header x-ms-lease-id. -func (balr BlobAcquireLeaseResponse) LeaseID() string { - return balr.rawResponse.Header.Get("x-ms-lease-id") -} - -// RequestID returns the value for header x-ms-request-id. -func (balr BlobAcquireLeaseResponse) RequestID() string { - return balr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (balr BlobAcquireLeaseResponse) Version() string { - return balr.rawResponse.Header.Get("x-ms-version") -} - -// BlobBreakLeaseResponse ... -type BlobBreakLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bblr BlobBreakLeaseResponse) Response() *http.Response { - return bblr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bblr BlobBreakLeaseResponse) StatusCode() int { - return bblr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bblr BlobBreakLeaseResponse) Status() string { - return bblr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bblr BlobBreakLeaseResponse) ClientRequestID() string { - return bblr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bblr BlobBreakLeaseResponse) Date() time.Time { - s := bblr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bblr BlobBreakLeaseResponse) ErrorCode() string { - return bblr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bblr BlobBreakLeaseResponse) ETag() ETag { - return ETag(bblr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bblr BlobBreakLeaseResponse) LastModified() time.Time { - s := bblr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseTime returns the value for header x-ms-lease-time. -func (bblr BlobBreakLeaseResponse) LeaseTime() int32 { - s := bblr.rawResponse.Header.Get("x-ms-lease-time") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 32) - if err != nil { - i = 0 - } - return int32(i) -} - -// RequestID returns the value for header x-ms-request-id. -func (bblr BlobBreakLeaseResponse) RequestID() string { - return bblr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bblr BlobBreakLeaseResponse) Version() string { - return bblr.rawResponse.Header.Get("x-ms-version") -} - -// BlobChangeLeaseResponse ... -type BlobChangeLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bclr BlobChangeLeaseResponse) Response() *http.Response { - return bclr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bclr BlobChangeLeaseResponse) StatusCode() int { - return bclr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bclr BlobChangeLeaseResponse) Status() string { - return bclr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bclr BlobChangeLeaseResponse) ClientRequestID() string { - return bclr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bclr BlobChangeLeaseResponse) Date() time.Time { - s := bclr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bclr BlobChangeLeaseResponse) ErrorCode() string { - return bclr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bclr BlobChangeLeaseResponse) ETag() ETag { - return ETag(bclr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bclr BlobChangeLeaseResponse) LastModified() time.Time { - s := bclr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseID returns the value for header x-ms-lease-id. -func (bclr BlobChangeLeaseResponse) LeaseID() string { - return bclr.rawResponse.Header.Get("x-ms-lease-id") -} - -// RequestID returns the value for header x-ms-request-id. -func (bclr BlobChangeLeaseResponse) RequestID() string { - return bclr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bclr BlobChangeLeaseResponse) Version() string { - return bclr.rawResponse.Header.Get("x-ms-version") -} - -// BlobCopyFromURLResponse ... -type BlobCopyFromURLResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bcfur BlobCopyFromURLResponse) Response() *http.Response { - return bcfur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bcfur BlobCopyFromURLResponse) StatusCode() int { - return bcfur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bcfur BlobCopyFromURLResponse) Status() string { - return bcfur.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bcfur BlobCopyFromURLResponse) ClientRequestID() string { - return bcfur.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (bcfur BlobCopyFromURLResponse) ContentMD5() []byte { - s := bcfur.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// CopyID returns the value for header x-ms-copy-id. -func (bcfur BlobCopyFromURLResponse) CopyID() string { - return bcfur.rawResponse.Header.Get("x-ms-copy-id") -} - -// CopyStatus returns the value for header x-ms-copy-status. -func (bcfur BlobCopyFromURLResponse) CopyStatus() SyncCopyStatusType { - return SyncCopyStatusType(bcfur.rawResponse.Header.Get("x-ms-copy-status")) -} - -// Date returns the value for header Date. -func (bcfur BlobCopyFromURLResponse) Date() time.Time { - s := bcfur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bcfur BlobCopyFromURLResponse) ErrorCode() string { - return bcfur.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bcfur BlobCopyFromURLResponse) ETag() ETag { - return ETag(bcfur.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bcfur BlobCopyFromURLResponse) LastModified() time.Time { - s := bcfur.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bcfur BlobCopyFromURLResponse) RequestID() string { - return bcfur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bcfur BlobCopyFromURLResponse) Version() string { - return bcfur.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (bcfur BlobCopyFromURLResponse) XMsContentCrc64() []byte { - s := bcfur.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// BlobCreateSnapshotResponse ... -type BlobCreateSnapshotResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bcsr BlobCreateSnapshotResponse) Response() *http.Response { - return bcsr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bcsr BlobCreateSnapshotResponse) StatusCode() int { - return bcsr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bcsr BlobCreateSnapshotResponse) Status() string { - return bcsr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bcsr BlobCreateSnapshotResponse) ClientRequestID() string { - return bcsr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bcsr BlobCreateSnapshotResponse) Date() time.Time { - s := bcsr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bcsr BlobCreateSnapshotResponse) ErrorCode() string { - return bcsr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bcsr BlobCreateSnapshotResponse) ETag() ETag { - return ETag(bcsr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (bcsr BlobCreateSnapshotResponse) IsServerEncrypted() string { - return bcsr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (bcsr BlobCreateSnapshotResponse) LastModified() time.Time { - s := bcsr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bcsr BlobCreateSnapshotResponse) RequestID() string { - return bcsr.rawResponse.Header.Get("x-ms-request-id") -} - -// Snapshot returns the value for header x-ms-snapshot. -func (bcsr BlobCreateSnapshotResponse) Snapshot() string { - return bcsr.rawResponse.Header.Get("x-ms-snapshot") -} - -// Version returns the value for header x-ms-version. -func (bcsr BlobCreateSnapshotResponse) Version() string { - return bcsr.rawResponse.Header.Get("x-ms-version") -} - -// BlobDeleteResponse ... -type BlobDeleteResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bdr BlobDeleteResponse) Response() *http.Response { - return bdr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bdr BlobDeleteResponse) StatusCode() int { - return bdr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bdr BlobDeleteResponse) Status() string { - return bdr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bdr BlobDeleteResponse) ClientRequestID() string { - return bdr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bdr BlobDeleteResponse) Date() time.Time { - s := bdr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bdr BlobDeleteResponse) ErrorCode() string { - return bdr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (bdr BlobDeleteResponse) RequestID() string { - return bdr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bdr BlobDeleteResponse) Version() string { - return bdr.rawResponse.Header.Get("x-ms-version") -} - -// BlobFlatListSegment ... -type BlobFlatListSegment struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"Blobs"` - BlobItems []BlobItem `xml:"Blob"` -} - -// BlobGetAccessControlResponse ... -type BlobGetAccessControlResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bgacr BlobGetAccessControlResponse) Response() *http.Response { - return bgacr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bgacr BlobGetAccessControlResponse) StatusCode() int { - return bgacr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bgacr BlobGetAccessControlResponse) Status() string { - return bgacr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bgacr BlobGetAccessControlResponse) ClientRequestID() string { - return bgacr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bgacr BlobGetAccessControlResponse) Date() time.Time { - s := bgacr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (bgacr BlobGetAccessControlResponse) ETag() ETag { - return ETag(bgacr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bgacr BlobGetAccessControlResponse) LastModified() time.Time { - s := bgacr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bgacr BlobGetAccessControlResponse) RequestID() string { - return bgacr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bgacr BlobGetAccessControlResponse) Version() string { - return bgacr.rawResponse.Header.Get("x-ms-version") -} - -// XMsACL returns the value for header x-ms-acl. -func (bgacr BlobGetAccessControlResponse) XMsACL() string { - return bgacr.rawResponse.Header.Get("x-ms-acl") -} - -// XMsGroup returns the value for header x-ms-group. -func (bgacr BlobGetAccessControlResponse) XMsGroup() string { - return bgacr.rawResponse.Header.Get("x-ms-group") -} - -// XMsOwner returns the value for header x-ms-owner. -func (bgacr BlobGetAccessControlResponse) XMsOwner() string { - return bgacr.rawResponse.Header.Get("x-ms-owner") -} - -// XMsPermissions returns the value for header x-ms-permissions. -func (bgacr BlobGetAccessControlResponse) XMsPermissions() string { - return bgacr.rawResponse.Header.Get("x-ms-permissions") -} - -// BlobGetAccountInfoResponse ... -type BlobGetAccountInfoResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bgair BlobGetAccountInfoResponse) Response() *http.Response { - return bgair.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bgair BlobGetAccountInfoResponse) StatusCode() int { - return bgair.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bgair BlobGetAccountInfoResponse) Status() string { - return bgair.rawResponse.Status -} - -// AccountKind returns the value for header x-ms-account-kind. -func (bgair BlobGetAccountInfoResponse) AccountKind() AccountKindType { - return AccountKindType(bgair.rawResponse.Header.Get("x-ms-account-kind")) -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bgair BlobGetAccountInfoResponse) ClientRequestID() string { - return bgair.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bgair BlobGetAccountInfoResponse) Date() time.Time { - s := bgair.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bgair BlobGetAccountInfoResponse) ErrorCode() string { - return bgair.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (bgair BlobGetAccountInfoResponse) RequestID() string { - return bgair.rawResponse.Header.Get("x-ms-request-id") -} - -// SkuName returns the value for header x-ms-sku-name. -func (bgair BlobGetAccountInfoResponse) SkuName() SkuNameType { - return SkuNameType(bgair.rawResponse.Header.Get("x-ms-sku-name")) -} - -// Version returns the value for header x-ms-version. -func (bgair BlobGetAccountInfoResponse) Version() string { - return bgair.rawResponse.Header.Get("x-ms-version") -} - -// BlobGetPropertiesResponse ... -type BlobGetPropertiesResponse struct { - rawResponse *http.Response -} - -// NewMetadata returns user-defined key/value pairs. -func (bgpr BlobGetPropertiesResponse) NewMetadata() Metadata { - md := Metadata{} - for k, v := range bgpr.rawResponse.Header { - if len(k) > mdPrefixLen { - if prefix := k[0:mdPrefixLen]; strings.EqualFold(prefix, mdPrefix) { - md[strings.ToLower(k[mdPrefixLen:])] = v[0] - } - } - } - return md -} - -// Response returns the raw HTTP response object. -func (bgpr BlobGetPropertiesResponse) Response() *http.Response { - return bgpr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bgpr BlobGetPropertiesResponse) StatusCode() int { - return bgpr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bgpr BlobGetPropertiesResponse) Status() string { - return bgpr.rawResponse.Status -} - -// AcceptRanges returns the value for header Accept-Ranges. -func (bgpr BlobGetPropertiesResponse) AcceptRanges() string { - return bgpr.rawResponse.Header.Get("Accept-Ranges") -} - -// AccessTier returns the value for header x-ms-access-tier. -func (bgpr BlobGetPropertiesResponse) AccessTier() string { - return bgpr.rawResponse.Header.Get("x-ms-access-tier") -} - -// AccessTierChangeTime returns the value for header x-ms-access-tier-change-time. -func (bgpr BlobGetPropertiesResponse) AccessTierChangeTime() time.Time { - s := bgpr.rawResponse.Header.Get("x-ms-access-tier-change-time") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// AccessTierInferred returns the value for header x-ms-access-tier-inferred. -func (bgpr BlobGetPropertiesResponse) AccessTierInferred() string { - return bgpr.rawResponse.Header.Get("x-ms-access-tier-inferred") -} - -// ArchiveStatus returns the value for header x-ms-archive-status. -func (bgpr BlobGetPropertiesResponse) ArchiveStatus() string { - return bgpr.rawResponse.Header.Get("x-ms-archive-status") -} - -// BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count. -func (bgpr BlobGetPropertiesResponse) BlobCommittedBlockCount() int32 { - s := bgpr.rawResponse.Header.Get("x-ms-blob-committed-block-count") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 32) - if err != nil { - i = 0 - } - return int32(i) -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (bgpr BlobGetPropertiesResponse) BlobSequenceNumber() int64 { - s := bgpr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// BlobType returns the value for header x-ms-blob-type. -func (bgpr BlobGetPropertiesResponse) BlobType() BlobType { - return BlobType(bgpr.rawResponse.Header.Get("x-ms-blob-type")) -} - -// CacheControl returns the value for header Cache-Control. -func (bgpr BlobGetPropertiesResponse) CacheControl() string { - return bgpr.rawResponse.Header.Get("Cache-Control") -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bgpr BlobGetPropertiesResponse) ClientRequestID() string { - return bgpr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentDisposition returns the value for header Content-Disposition. -func (bgpr BlobGetPropertiesResponse) ContentDisposition() string { - return bgpr.rawResponse.Header.Get("Content-Disposition") -} - -// ContentEncoding returns the value for header Content-Encoding. -func (bgpr BlobGetPropertiesResponse) ContentEncoding() string { - return bgpr.rawResponse.Header.Get("Content-Encoding") -} - -// ContentLanguage returns the value for header Content-Language. -func (bgpr BlobGetPropertiesResponse) ContentLanguage() string { - return bgpr.rawResponse.Header.Get("Content-Language") -} - -// ContentLength returns the value for header Content-Length. -func (bgpr BlobGetPropertiesResponse) ContentLength() int64 { - s := bgpr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ContentMD5 returns the value for header Content-MD5. -func (bgpr BlobGetPropertiesResponse) ContentMD5() []byte { - s := bgpr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// ContentType returns the value for header Content-Type. -func (bgpr BlobGetPropertiesResponse) ContentType() string { - return bgpr.rawResponse.Header.Get("Content-Type") -} - -// CopyCompletionTime returns the value for header x-ms-copy-completion-time. -func (bgpr BlobGetPropertiesResponse) CopyCompletionTime() time.Time { - s := bgpr.rawResponse.Header.Get("x-ms-copy-completion-time") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// CopyID returns the value for header x-ms-copy-id. -func (bgpr BlobGetPropertiesResponse) CopyID() string { - return bgpr.rawResponse.Header.Get("x-ms-copy-id") -} - -// CopyProgress returns the value for header x-ms-copy-progress. -func (bgpr BlobGetPropertiesResponse) CopyProgress() string { - return bgpr.rawResponse.Header.Get("x-ms-copy-progress") -} - -// CopySource returns the value for header x-ms-copy-source. -func (bgpr BlobGetPropertiesResponse) CopySource() string { - return bgpr.rawResponse.Header.Get("x-ms-copy-source") -} - -// CopyStatus returns the value for header x-ms-copy-status. -func (bgpr BlobGetPropertiesResponse) CopyStatus() CopyStatusType { - return CopyStatusType(bgpr.rawResponse.Header.Get("x-ms-copy-status")) -} - -// CopyStatusDescription returns the value for header x-ms-copy-status-description. -func (bgpr BlobGetPropertiesResponse) CopyStatusDescription() string { - return bgpr.rawResponse.Header.Get("x-ms-copy-status-description") -} - -// CreationTime returns the value for header x-ms-creation-time. -func (bgpr BlobGetPropertiesResponse) CreationTime() time.Time { - s := bgpr.rawResponse.Header.Get("x-ms-creation-time") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// Date returns the value for header Date. -func (bgpr BlobGetPropertiesResponse) Date() time.Time { - s := bgpr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// DestinationSnapshot returns the value for header x-ms-copy-destination-snapshot. -func (bgpr BlobGetPropertiesResponse) DestinationSnapshot() string { - return bgpr.rawResponse.Header.Get("x-ms-copy-destination-snapshot") -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (bgpr BlobGetPropertiesResponse) EncryptionKeySha256() string { - return bgpr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bgpr BlobGetPropertiesResponse) ErrorCode() string { - return bgpr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bgpr BlobGetPropertiesResponse) ETag() ETag { - return ETag(bgpr.rawResponse.Header.Get("ETag")) -} - -// IsIncrementalCopy returns the value for header x-ms-incremental-copy. -func (bgpr BlobGetPropertiesResponse) IsIncrementalCopy() string { - return bgpr.rawResponse.Header.Get("x-ms-incremental-copy") -} - -// IsServerEncrypted returns the value for header x-ms-server-encrypted. -func (bgpr BlobGetPropertiesResponse) IsServerEncrypted() string { - return bgpr.rawResponse.Header.Get("x-ms-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (bgpr BlobGetPropertiesResponse) LastModified() time.Time { - s := bgpr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseDuration returns the value for header x-ms-lease-duration. -func (bgpr BlobGetPropertiesResponse) LeaseDuration() LeaseDurationType { - return LeaseDurationType(bgpr.rawResponse.Header.Get("x-ms-lease-duration")) -} - -// LeaseState returns the value for header x-ms-lease-state. -func (bgpr BlobGetPropertiesResponse) LeaseState() LeaseStateType { - return LeaseStateType(bgpr.rawResponse.Header.Get("x-ms-lease-state")) -} - -// LeaseStatus returns the value for header x-ms-lease-status. -func (bgpr BlobGetPropertiesResponse) LeaseStatus() LeaseStatusType { - return LeaseStatusType(bgpr.rawResponse.Header.Get("x-ms-lease-status")) -} - -// RequestID returns the value for header x-ms-request-id. -func (bgpr BlobGetPropertiesResponse) RequestID() string { - return bgpr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bgpr BlobGetPropertiesResponse) Version() string { - return bgpr.rawResponse.Header.Get("x-ms-version") -} - -// BlobHierarchyListSegment ... -type BlobHierarchyListSegment struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"Blobs"` - BlobPrefixes []BlobPrefix `xml:"BlobPrefix"` - BlobItems []BlobItem `xml:"Blob"` -} - -// BlobItem - An Azure Storage blob -type BlobItem struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"Blob"` - Name string `xml:"Name"` - Deleted bool `xml:"Deleted"` - Snapshot string `xml:"Snapshot"` - Properties BlobProperties `xml:"Properties"` - Metadata Metadata `xml:"Metadata"` -} - -// BlobPrefix ... -type BlobPrefix struct { - Name string `xml:"Name"` -} - -// BlobProperties - Properties of a blob -type BlobProperties struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"Properties"` - CreationTime *time.Time `xml:"Creation-Time"` - LastModified time.Time `xml:"Last-Modified"` - Etag ETag `xml:"Etag"` - // ContentLength - Size in bytes - ContentLength *int64 `xml:"Content-Length"` - ContentType *string `xml:"Content-Type"` - ContentEncoding *string `xml:"Content-Encoding"` - ContentLanguage *string `xml:"Content-Language"` - ContentMD5 []byte `xml:"Content-MD5"` - ContentDisposition *string `xml:"Content-Disposition"` - CacheControl *string `xml:"Cache-Control"` - BlobSequenceNumber *int64 `xml:"x-ms-blob-sequence-number"` - // BlobType - Possible values include: 'BlobBlockBlob', 'BlobPageBlob', 'BlobAppendBlob', 'BlobNone' - BlobType BlobType `xml:"BlobType"` - // LeaseStatus - Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked', 'LeaseStatusNone' - LeaseStatus LeaseStatusType `xml:"LeaseStatus"` - // LeaseState - Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken', 'LeaseStateNone' - LeaseState LeaseStateType `xml:"LeaseState"` - // LeaseDuration - Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed', 'LeaseDurationNone' - LeaseDuration LeaseDurationType `xml:"LeaseDuration"` - CopyID *string `xml:"CopyId"` - // CopyStatus - Possible values include: 'CopyStatusPending', 'CopyStatusSuccess', 'CopyStatusAborted', 'CopyStatusFailed', 'CopyStatusNone' - CopyStatus CopyStatusType `xml:"CopyStatus"` - CopySource *string `xml:"CopySource"` - CopyProgress *string `xml:"CopyProgress"` - CopyCompletionTime *time.Time `xml:"CopyCompletionTime"` - CopyStatusDescription *string `xml:"CopyStatusDescription"` - ServerEncrypted *bool `xml:"ServerEncrypted"` - IncrementalCopy *bool `xml:"IncrementalCopy"` - DestinationSnapshot *string `xml:"DestinationSnapshot"` - DeletedTime *time.Time `xml:"DeletedTime"` - RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"` - // AccessTier - Possible values include: 'AccessTierP4', 'AccessTierP6', 'AccessTierP10', 'AccessTierP15', 'AccessTierP20', 'AccessTierP30', 'AccessTierP40', 'AccessTierP50', 'AccessTierP60', 'AccessTierP70', 'AccessTierP80', 'AccessTierHot', 'AccessTierCool', 'AccessTierArchive', 'AccessTierNone' - AccessTier AccessTierType `xml:"AccessTier"` - AccessTierInferred *bool `xml:"AccessTierInferred"` - // ArchiveStatus - Possible values include: 'ArchiveStatusRehydratePendingToHot', 'ArchiveStatusRehydratePendingToCool', 'ArchiveStatusNone' - ArchiveStatus ArchiveStatusType `xml:"ArchiveStatus"` - CustomerProvidedKeySha256 *string `xml:"CustomerProvidedKeySha256"` - AccessTierChangeTime *time.Time `xml:"AccessTierChangeTime"` -} - -// MarshalXML implements the xml.Marshaler interface for BlobProperties. -func (bp BlobProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - bp2 := (*blobProperties)(unsafe.Pointer(&bp)) - return e.EncodeElement(*bp2, start) -} - -// UnmarshalXML implements the xml.Unmarshaler interface for BlobProperties. -func (bp *BlobProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - bp2 := (*blobProperties)(unsafe.Pointer(bp)) - return d.DecodeElement(bp2, &start) -} - -// BlobReleaseLeaseResponse ... -type BlobReleaseLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (brlr BlobReleaseLeaseResponse) Response() *http.Response { - return brlr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (brlr BlobReleaseLeaseResponse) StatusCode() int { - return brlr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (brlr BlobReleaseLeaseResponse) Status() string { - return brlr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (brlr BlobReleaseLeaseResponse) ClientRequestID() string { - return brlr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (brlr BlobReleaseLeaseResponse) Date() time.Time { - s := brlr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (brlr BlobReleaseLeaseResponse) ErrorCode() string { - return brlr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (brlr BlobReleaseLeaseResponse) ETag() ETag { - return ETag(brlr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (brlr BlobReleaseLeaseResponse) LastModified() time.Time { - s := brlr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (brlr BlobReleaseLeaseResponse) RequestID() string { - return brlr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (brlr BlobReleaseLeaseResponse) Version() string { - return brlr.rawResponse.Header.Get("x-ms-version") -} - -// BlobRenameResponse ... -type BlobRenameResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (brr BlobRenameResponse) Response() *http.Response { - return brr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (brr BlobRenameResponse) StatusCode() int { - return brr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (brr BlobRenameResponse) Status() string { - return brr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (brr BlobRenameResponse) ClientRequestID() string { - return brr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentLength returns the value for header Content-Length. -func (brr BlobRenameResponse) ContentLength() int64 { - s := brr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// Date returns the value for header Date. -func (brr BlobRenameResponse) Date() time.Time { - s := brr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (brr BlobRenameResponse) ETag() ETag { - return ETag(brr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (brr BlobRenameResponse) LastModified() time.Time { - s := brr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (brr BlobRenameResponse) RequestID() string { - return brr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (brr BlobRenameResponse) Version() string { - return brr.rawResponse.Header.Get("x-ms-version") -} - -// BlobRenewLeaseResponse ... -type BlobRenewLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (brlr BlobRenewLeaseResponse) Response() *http.Response { - return brlr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (brlr BlobRenewLeaseResponse) StatusCode() int { - return brlr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (brlr BlobRenewLeaseResponse) Status() string { - return brlr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (brlr BlobRenewLeaseResponse) ClientRequestID() string { - return brlr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (brlr BlobRenewLeaseResponse) Date() time.Time { - s := brlr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (brlr BlobRenewLeaseResponse) ErrorCode() string { - return brlr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (brlr BlobRenewLeaseResponse) ETag() ETag { - return ETag(brlr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (brlr BlobRenewLeaseResponse) LastModified() time.Time { - s := brlr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseID returns the value for header x-ms-lease-id. -func (brlr BlobRenewLeaseResponse) LeaseID() string { - return brlr.rawResponse.Header.Get("x-ms-lease-id") -} - -// RequestID returns the value for header x-ms-request-id. -func (brlr BlobRenewLeaseResponse) RequestID() string { - return brlr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (brlr BlobRenewLeaseResponse) Version() string { - return brlr.rawResponse.Header.Get("x-ms-version") -} - -// BlobSetAccessControlResponse ... -type BlobSetAccessControlResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bsacr BlobSetAccessControlResponse) Response() *http.Response { - return bsacr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bsacr BlobSetAccessControlResponse) StatusCode() int { - return bsacr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bsacr BlobSetAccessControlResponse) Status() string { - return bsacr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bsacr BlobSetAccessControlResponse) ClientRequestID() string { - return bsacr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bsacr BlobSetAccessControlResponse) Date() time.Time { - s := bsacr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (bsacr BlobSetAccessControlResponse) ETag() ETag { - return ETag(bsacr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bsacr BlobSetAccessControlResponse) LastModified() time.Time { - s := bsacr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bsacr BlobSetAccessControlResponse) RequestID() string { - return bsacr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bsacr BlobSetAccessControlResponse) Version() string { - return bsacr.rawResponse.Header.Get("x-ms-version") -} - -// BlobSetHTTPHeadersResponse ... -type BlobSetHTTPHeadersResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bshhr BlobSetHTTPHeadersResponse) Response() *http.Response { - return bshhr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bshhr BlobSetHTTPHeadersResponse) StatusCode() int { - return bshhr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bshhr BlobSetHTTPHeadersResponse) Status() string { - return bshhr.rawResponse.Status -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (bshhr BlobSetHTTPHeadersResponse) BlobSequenceNumber() int64 { - s := bshhr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bshhr BlobSetHTTPHeadersResponse) ClientRequestID() string { - return bshhr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bshhr BlobSetHTTPHeadersResponse) Date() time.Time { - s := bshhr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bshhr BlobSetHTTPHeadersResponse) ErrorCode() string { - return bshhr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bshhr BlobSetHTTPHeadersResponse) ETag() ETag { - return ETag(bshhr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bshhr BlobSetHTTPHeadersResponse) LastModified() time.Time { - s := bshhr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bshhr BlobSetHTTPHeadersResponse) RequestID() string { - return bshhr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bshhr BlobSetHTTPHeadersResponse) Version() string { - return bshhr.rawResponse.Header.Get("x-ms-version") -} - -// BlobSetMetadataResponse ... -type BlobSetMetadataResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bsmr BlobSetMetadataResponse) Response() *http.Response { - return bsmr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bsmr BlobSetMetadataResponse) StatusCode() int { - return bsmr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bsmr BlobSetMetadataResponse) Status() string { - return bsmr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bsmr BlobSetMetadataResponse) ClientRequestID() string { - return bsmr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bsmr BlobSetMetadataResponse) Date() time.Time { - s := bsmr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (bsmr BlobSetMetadataResponse) EncryptionKeySha256() string { - return bsmr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bsmr BlobSetMetadataResponse) ErrorCode() string { - return bsmr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bsmr BlobSetMetadataResponse) ETag() ETag { - return ETag(bsmr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (bsmr BlobSetMetadataResponse) IsServerEncrypted() string { - return bsmr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (bsmr BlobSetMetadataResponse) LastModified() time.Time { - s := bsmr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bsmr BlobSetMetadataResponse) RequestID() string { - return bsmr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bsmr BlobSetMetadataResponse) Version() string { - return bsmr.rawResponse.Header.Get("x-ms-version") -} - -// BlobSetTierResponse ... -type BlobSetTierResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bstr BlobSetTierResponse) Response() *http.Response { - return bstr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bstr BlobSetTierResponse) StatusCode() int { - return bstr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bstr BlobSetTierResponse) Status() string { - return bstr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bstr BlobSetTierResponse) ClientRequestID() string { - return bstr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bstr BlobSetTierResponse) ErrorCode() string { - return bstr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (bstr BlobSetTierResponse) RequestID() string { - return bstr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bstr BlobSetTierResponse) Version() string { - return bstr.rawResponse.Header.Get("x-ms-version") -} - -// BlobStartCopyFromURLResponse ... -type BlobStartCopyFromURLResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bscfur BlobStartCopyFromURLResponse) Response() *http.Response { - return bscfur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bscfur BlobStartCopyFromURLResponse) StatusCode() int { - return bscfur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bscfur BlobStartCopyFromURLResponse) Status() string { - return bscfur.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bscfur BlobStartCopyFromURLResponse) ClientRequestID() string { - return bscfur.rawResponse.Header.Get("x-ms-client-request-id") -} - -// CopyID returns the value for header x-ms-copy-id. -func (bscfur BlobStartCopyFromURLResponse) CopyID() string { - return bscfur.rawResponse.Header.Get("x-ms-copy-id") -} - -// CopyStatus returns the value for header x-ms-copy-status. -func (bscfur BlobStartCopyFromURLResponse) CopyStatus() CopyStatusType { - return CopyStatusType(bscfur.rawResponse.Header.Get("x-ms-copy-status")) -} - -// Date returns the value for header Date. -func (bscfur BlobStartCopyFromURLResponse) Date() time.Time { - s := bscfur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bscfur BlobStartCopyFromURLResponse) ErrorCode() string { - return bscfur.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bscfur BlobStartCopyFromURLResponse) ETag() ETag { - return ETag(bscfur.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bscfur BlobStartCopyFromURLResponse) LastModified() time.Time { - s := bscfur.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bscfur BlobStartCopyFromURLResponse) RequestID() string { - return bscfur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bscfur BlobStartCopyFromURLResponse) Version() string { - return bscfur.rawResponse.Header.Get("x-ms-version") -} - -// BlobUndeleteResponse ... -type BlobUndeleteResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bur BlobUndeleteResponse) Response() *http.Response { - return bur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bur BlobUndeleteResponse) StatusCode() int { - return bur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bur BlobUndeleteResponse) Status() string { - return bur.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bur BlobUndeleteResponse) ClientRequestID() string { - return bur.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (bur BlobUndeleteResponse) Date() time.Time { - s := bur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bur BlobUndeleteResponse) ErrorCode() string { - return bur.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (bur BlobUndeleteResponse) RequestID() string { - return bur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bur BlobUndeleteResponse) Version() string { - return bur.rawResponse.Header.Get("x-ms-version") -} - -// Block - Represents a single block in a block blob. It describes the block's ID and size. -type Block struct { - // Name - The base64 encoded block ID. - Name string `xml:"Name"` - // Size - The block size in bytes. - Size int32 `xml:"Size"` -} - -// BlockBlobCommitBlockListResponse ... -type BlockBlobCommitBlockListResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bbcblr BlockBlobCommitBlockListResponse) Response() *http.Response { - return bbcblr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bbcblr BlockBlobCommitBlockListResponse) StatusCode() int { - return bbcblr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bbcblr BlockBlobCommitBlockListResponse) Status() string { - return bbcblr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bbcblr BlockBlobCommitBlockListResponse) ClientRequestID() string { - return bbcblr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (bbcblr BlockBlobCommitBlockListResponse) ContentMD5() []byte { - s := bbcblr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (bbcblr BlockBlobCommitBlockListResponse) Date() time.Time { - s := bbcblr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (bbcblr BlockBlobCommitBlockListResponse) EncryptionKeySha256() string { - return bbcblr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bbcblr BlockBlobCommitBlockListResponse) ErrorCode() string { - return bbcblr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bbcblr BlockBlobCommitBlockListResponse) ETag() ETag { - return ETag(bbcblr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (bbcblr BlockBlobCommitBlockListResponse) IsServerEncrypted() string { - return bbcblr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (bbcblr BlockBlobCommitBlockListResponse) LastModified() time.Time { - s := bbcblr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bbcblr BlockBlobCommitBlockListResponse) RequestID() string { - return bbcblr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bbcblr BlockBlobCommitBlockListResponse) Version() string { - return bbcblr.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (bbcblr BlockBlobCommitBlockListResponse) XMsContentCrc64() []byte { - s := bbcblr.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// BlockBlobStageBlockFromURLResponse ... -type BlockBlobStageBlockFromURLResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bbsbfur BlockBlobStageBlockFromURLResponse) Response() *http.Response { - return bbsbfur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bbsbfur BlockBlobStageBlockFromURLResponse) StatusCode() int { - return bbsbfur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bbsbfur BlockBlobStageBlockFromURLResponse) Status() string { - return bbsbfur.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bbsbfur BlockBlobStageBlockFromURLResponse) ClientRequestID() string { - return bbsbfur.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (bbsbfur BlockBlobStageBlockFromURLResponse) ContentMD5() []byte { - s := bbsbfur.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (bbsbfur BlockBlobStageBlockFromURLResponse) Date() time.Time { - s := bbsbfur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (bbsbfur BlockBlobStageBlockFromURLResponse) EncryptionKeySha256() string { - return bbsbfur.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bbsbfur BlockBlobStageBlockFromURLResponse) ErrorCode() string { - return bbsbfur.rawResponse.Header.Get("x-ms-error-code") -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (bbsbfur BlockBlobStageBlockFromURLResponse) IsServerEncrypted() string { - return bbsbfur.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// RequestID returns the value for header x-ms-request-id. -func (bbsbfur BlockBlobStageBlockFromURLResponse) RequestID() string { - return bbsbfur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bbsbfur BlockBlobStageBlockFromURLResponse) Version() string { - return bbsbfur.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (bbsbfur BlockBlobStageBlockFromURLResponse) XMsContentCrc64() []byte { - s := bbsbfur.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// BlockBlobStageBlockResponse ... -type BlockBlobStageBlockResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bbsbr BlockBlobStageBlockResponse) Response() *http.Response { - return bbsbr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bbsbr BlockBlobStageBlockResponse) StatusCode() int { - return bbsbr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bbsbr BlockBlobStageBlockResponse) Status() string { - return bbsbr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bbsbr BlockBlobStageBlockResponse) ClientRequestID() string { - return bbsbr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (bbsbr BlockBlobStageBlockResponse) ContentMD5() []byte { - s := bbsbr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (bbsbr BlockBlobStageBlockResponse) Date() time.Time { - s := bbsbr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (bbsbr BlockBlobStageBlockResponse) EncryptionKeySha256() string { - return bbsbr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bbsbr BlockBlobStageBlockResponse) ErrorCode() string { - return bbsbr.rawResponse.Header.Get("x-ms-error-code") -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (bbsbr BlockBlobStageBlockResponse) IsServerEncrypted() string { - return bbsbr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// RequestID returns the value for header x-ms-request-id. -func (bbsbr BlockBlobStageBlockResponse) RequestID() string { - return bbsbr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bbsbr BlockBlobStageBlockResponse) Version() string { - return bbsbr.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (bbsbr BlockBlobStageBlockResponse) XMsContentCrc64() []byte { - s := bbsbr.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// BlockBlobUploadResponse ... -type BlockBlobUploadResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (bbur BlockBlobUploadResponse) Response() *http.Response { - return bbur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bbur BlockBlobUploadResponse) StatusCode() int { - return bbur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bbur BlockBlobUploadResponse) Status() string { - return bbur.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bbur BlockBlobUploadResponse) ClientRequestID() string { - return bbur.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (bbur BlockBlobUploadResponse) ContentMD5() []byte { - s := bbur.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (bbur BlockBlobUploadResponse) Date() time.Time { - s := bbur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (bbur BlockBlobUploadResponse) EncryptionKeySha256() string { - return bbur.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bbur BlockBlobUploadResponse) ErrorCode() string { - return bbur.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bbur BlockBlobUploadResponse) ETag() ETag { - return ETag(bbur.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (bbur BlockBlobUploadResponse) IsServerEncrypted() string { - return bbur.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (bbur BlockBlobUploadResponse) LastModified() time.Time { - s := bbur.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bbur BlockBlobUploadResponse) RequestID() string { - return bbur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bbur BlockBlobUploadResponse) Version() string { - return bbur.rawResponse.Header.Get("x-ms-version") -} - -// BlockList ... -type BlockList struct { - rawResponse *http.Response - CommittedBlocks []Block `xml:"CommittedBlocks>Block"` - UncommittedBlocks []Block `xml:"UncommittedBlocks>Block"` -} - -// Response returns the raw HTTP response object. -func (bl BlockList) Response() *http.Response { - return bl.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (bl BlockList) StatusCode() int { - return bl.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (bl BlockList) Status() string { - return bl.rawResponse.Status -} - -// BlobContentLength returns the value for header x-ms-blob-content-length. -func (bl BlockList) BlobContentLength() int64 { - s := bl.rawResponse.Header.Get("x-ms-blob-content-length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (bl BlockList) ClientRequestID() string { - return bl.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentType returns the value for header Content-Type. -func (bl BlockList) ContentType() string { - return bl.rawResponse.Header.Get("Content-Type") -} - -// Date returns the value for header Date. -func (bl BlockList) Date() time.Time { - s := bl.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (bl BlockList) ErrorCode() string { - return bl.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (bl BlockList) ETag() ETag { - return ETag(bl.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (bl BlockList) LastModified() time.Time { - s := bl.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (bl BlockList) RequestID() string { - return bl.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (bl BlockList) Version() string { - return bl.rawResponse.Header.Get("x-ms-version") -} - -// BlockLookupList ... -type BlockLookupList struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"BlockList"` - Committed []string `xml:"Committed"` - Uncommitted []string `xml:"Uncommitted"` - Latest []string `xml:"Latest"` -} - -// ClearRange ... -type ClearRange struct { - Start int64 `xml:"Start"` - End int64 `xml:"End"` -} - -// ContainerAcquireLeaseResponse ... -type ContainerAcquireLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (calr ContainerAcquireLeaseResponse) Response() *http.Response { - return calr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (calr ContainerAcquireLeaseResponse) StatusCode() int { - return calr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (calr ContainerAcquireLeaseResponse) Status() string { - return calr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (calr ContainerAcquireLeaseResponse) ClientRequestID() string { - return calr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (calr ContainerAcquireLeaseResponse) Date() time.Time { - s := calr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (calr ContainerAcquireLeaseResponse) ErrorCode() string { - return calr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (calr ContainerAcquireLeaseResponse) ETag() ETag { - return ETag(calr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (calr ContainerAcquireLeaseResponse) LastModified() time.Time { - s := calr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseID returns the value for header x-ms-lease-id. -func (calr ContainerAcquireLeaseResponse) LeaseID() string { - return calr.rawResponse.Header.Get("x-ms-lease-id") -} - -// RequestID returns the value for header x-ms-request-id. -func (calr ContainerAcquireLeaseResponse) RequestID() string { - return calr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (calr ContainerAcquireLeaseResponse) Version() string { - return calr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerBreakLeaseResponse ... -type ContainerBreakLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (cblr ContainerBreakLeaseResponse) Response() *http.Response { - return cblr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (cblr ContainerBreakLeaseResponse) StatusCode() int { - return cblr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (cblr ContainerBreakLeaseResponse) Status() string { - return cblr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (cblr ContainerBreakLeaseResponse) ClientRequestID() string { - return cblr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (cblr ContainerBreakLeaseResponse) Date() time.Time { - s := cblr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (cblr ContainerBreakLeaseResponse) ErrorCode() string { - return cblr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (cblr ContainerBreakLeaseResponse) ETag() ETag { - return ETag(cblr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (cblr ContainerBreakLeaseResponse) LastModified() time.Time { - s := cblr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseTime returns the value for header x-ms-lease-time. -func (cblr ContainerBreakLeaseResponse) LeaseTime() int32 { - s := cblr.rawResponse.Header.Get("x-ms-lease-time") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 32) - if err != nil { - i = 0 - } - return int32(i) -} - -// RequestID returns the value for header x-ms-request-id. -func (cblr ContainerBreakLeaseResponse) RequestID() string { - return cblr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (cblr ContainerBreakLeaseResponse) Version() string { - return cblr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerChangeLeaseResponse ... -type ContainerChangeLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (cclr ContainerChangeLeaseResponse) Response() *http.Response { - return cclr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (cclr ContainerChangeLeaseResponse) StatusCode() int { - return cclr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (cclr ContainerChangeLeaseResponse) Status() string { - return cclr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (cclr ContainerChangeLeaseResponse) ClientRequestID() string { - return cclr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (cclr ContainerChangeLeaseResponse) Date() time.Time { - s := cclr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (cclr ContainerChangeLeaseResponse) ErrorCode() string { - return cclr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (cclr ContainerChangeLeaseResponse) ETag() ETag { - return ETag(cclr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (cclr ContainerChangeLeaseResponse) LastModified() time.Time { - s := cclr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseID returns the value for header x-ms-lease-id. -func (cclr ContainerChangeLeaseResponse) LeaseID() string { - return cclr.rawResponse.Header.Get("x-ms-lease-id") -} - -// RequestID returns the value for header x-ms-request-id. -func (cclr ContainerChangeLeaseResponse) RequestID() string { - return cclr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (cclr ContainerChangeLeaseResponse) Version() string { - return cclr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerCreateResponse ... -type ContainerCreateResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (ccr ContainerCreateResponse) Response() *http.Response { - return ccr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (ccr ContainerCreateResponse) StatusCode() int { - return ccr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (ccr ContainerCreateResponse) Status() string { - return ccr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (ccr ContainerCreateResponse) ClientRequestID() string { - return ccr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (ccr ContainerCreateResponse) Date() time.Time { - s := ccr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (ccr ContainerCreateResponse) ErrorCode() string { - return ccr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (ccr ContainerCreateResponse) ETag() ETag { - return ETag(ccr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (ccr ContainerCreateResponse) LastModified() time.Time { - s := ccr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (ccr ContainerCreateResponse) RequestID() string { - return ccr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (ccr ContainerCreateResponse) Version() string { - return ccr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerDeleteResponse ... -type ContainerDeleteResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (cdr ContainerDeleteResponse) Response() *http.Response { - return cdr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (cdr ContainerDeleteResponse) StatusCode() int { - return cdr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (cdr ContainerDeleteResponse) Status() string { - return cdr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (cdr ContainerDeleteResponse) ClientRequestID() string { - return cdr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (cdr ContainerDeleteResponse) Date() time.Time { - s := cdr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (cdr ContainerDeleteResponse) ErrorCode() string { - return cdr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (cdr ContainerDeleteResponse) RequestID() string { - return cdr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (cdr ContainerDeleteResponse) Version() string { - return cdr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerGetAccountInfoResponse ... -type ContainerGetAccountInfoResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (cgair ContainerGetAccountInfoResponse) Response() *http.Response { - return cgair.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (cgair ContainerGetAccountInfoResponse) StatusCode() int { - return cgair.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (cgair ContainerGetAccountInfoResponse) Status() string { - return cgair.rawResponse.Status -} - -// AccountKind returns the value for header x-ms-account-kind. -func (cgair ContainerGetAccountInfoResponse) AccountKind() AccountKindType { - return AccountKindType(cgair.rawResponse.Header.Get("x-ms-account-kind")) -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (cgair ContainerGetAccountInfoResponse) ClientRequestID() string { - return cgair.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (cgair ContainerGetAccountInfoResponse) Date() time.Time { - s := cgair.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (cgair ContainerGetAccountInfoResponse) ErrorCode() string { - return cgair.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (cgair ContainerGetAccountInfoResponse) RequestID() string { - return cgair.rawResponse.Header.Get("x-ms-request-id") -} - -// SkuName returns the value for header x-ms-sku-name. -func (cgair ContainerGetAccountInfoResponse) SkuName() SkuNameType { - return SkuNameType(cgair.rawResponse.Header.Get("x-ms-sku-name")) -} - -// Version returns the value for header x-ms-version. -func (cgair ContainerGetAccountInfoResponse) Version() string { - return cgair.rawResponse.Header.Get("x-ms-version") -} - -// ContainerGetPropertiesResponse ... -type ContainerGetPropertiesResponse struct { - rawResponse *http.Response -} - -// NewMetadata returns user-defined key/value pairs. -func (cgpr ContainerGetPropertiesResponse) NewMetadata() Metadata { - md := Metadata{} - for k, v := range cgpr.rawResponse.Header { - if len(k) > mdPrefixLen { - if prefix := k[0:mdPrefixLen]; strings.EqualFold(prefix, mdPrefix) { - md[strings.ToLower(k[mdPrefixLen:])] = v[0] - } - } - } - return md -} - -// Response returns the raw HTTP response object. -func (cgpr ContainerGetPropertiesResponse) Response() *http.Response { - return cgpr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (cgpr ContainerGetPropertiesResponse) StatusCode() int { - return cgpr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (cgpr ContainerGetPropertiesResponse) Status() string { - return cgpr.rawResponse.Status -} - -// BlobPublicAccess returns the value for header x-ms-blob-public-access. -func (cgpr ContainerGetPropertiesResponse) BlobPublicAccess() PublicAccessType { - return PublicAccessType(cgpr.rawResponse.Header.Get("x-ms-blob-public-access")) -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (cgpr ContainerGetPropertiesResponse) ClientRequestID() string { - return cgpr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (cgpr ContainerGetPropertiesResponse) Date() time.Time { - s := cgpr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (cgpr ContainerGetPropertiesResponse) ErrorCode() string { - return cgpr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (cgpr ContainerGetPropertiesResponse) ETag() ETag { - return ETag(cgpr.rawResponse.Header.Get("ETag")) -} - -// HasImmutabilityPolicy returns the value for header x-ms-has-immutability-policy. -func (cgpr ContainerGetPropertiesResponse) HasImmutabilityPolicy() string { - return cgpr.rawResponse.Header.Get("x-ms-has-immutability-policy") -} - -// HasLegalHold returns the value for header x-ms-has-legal-hold. -func (cgpr ContainerGetPropertiesResponse) HasLegalHold() string { - return cgpr.rawResponse.Header.Get("x-ms-has-legal-hold") -} - -// LastModified returns the value for header Last-Modified. -func (cgpr ContainerGetPropertiesResponse) LastModified() time.Time { - s := cgpr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseDuration returns the value for header x-ms-lease-duration. -func (cgpr ContainerGetPropertiesResponse) LeaseDuration() LeaseDurationType { - return LeaseDurationType(cgpr.rawResponse.Header.Get("x-ms-lease-duration")) -} - -// LeaseState returns the value for header x-ms-lease-state. -func (cgpr ContainerGetPropertiesResponse) LeaseState() LeaseStateType { - return LeaseStateType(cgpr.rawResponse.Header.Get("x-ms-lease-state")) -} - -// LeaseStatus returns the value for header x-ms-lease-status. -func (cgpr ContainerGetPropertiesResponse) LeaseStatus() LeaseStatusType { - return LeaseStatusType(cgpr.rawResponse.Header.Get("x-ms-lease-status")) -} - -// RequestID returns the value for header x-ms-request-id. -func (cgpr ContainerGetPropertiesResponse) RequestID() string { - return cgpr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (cgpr ContainerGetPropertiesResponse) Version() string { - return cgpr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerItem - An Azure Storage container -type ContainerItem struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"Container"` - Name string `xml:"Name"` - Properties ContainerProperties `xml:"Properties"` - Metadata Metadata `xml:"Metadata"` -} - -// ContainerProperties - Properties of a container -type ContainerProperties struct { - LastModified time.Time `xml:"Last-Modified"` - Etag ETag `xml:"Etag"` - // LeaseStatus - Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked', 'LeaseStatusNone' - LeaseStatus LeaseStatusType `xml:"LeaseStatus"` - // LeaseState - Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken', 'LeaseStateNone' - LeaseState LeaseStateType `xml:"LeaseState"` - // LeaseDuration - Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed', 'LeaseDurationNone' - LeaseDuration LeaseDurationType `xml:"LeaseDuration"` - // PublicAccess - Possible values include: 'PublicAccessContainer', 'PublicAccessBlob', 'PublicAccessNone' - PublicAccess PublicAccessType `xml:"PublicAccess"` - HasImmutabilityPolicy *bool `xml:"HasImmutabilityPolicy"` - HasLegalHold *bool `xml:"HasLegalHold"` -} - -// MarshalXML implements the xml.Marshaler interface for ContainerProperties. -func (cp ContainerProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - cp2 := (*containerProperties)(unsafe.Pointer(&cp)) - return e.EncodeElement(*cp2, start) -} - -// UnmarshalXML implements the xml.Unmarshaler interface for ContainerProperties. -func (cp *ContainerProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - cp2 := (*containerProperties)(unsafe.Pointer(cp)) - return d.DecodeElement(cp2, &start) -} - -// ContainerReleaseLeaseResponse ... -type ContainerReleaseLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (crlr ContainerReleaseLeaseResponse) Response() *http.Response { - return crlr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (crlr ContainerReleaseLeaseResponse) StatusCode() int { - return crlr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (crlr ContainerReleaseLeaseResponse) Status() string { - return crlr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (crlr ContainerReleaseLeaseResponse) ClientRequestID() string { - return crlr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (crlr ContainerReleaseLeaseResponse) Date() time.Time { - s := crlr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (crlr ContainerReleaseLeaseResponse) ErrorCode() string { - return crlr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (crlr ContainerReleaseLeaseResponse) ETag() ETag { - return ETag(crlr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (crlr ContainerReleaseLeaseResponse) LastModified() time.Time { - s := crlr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (crlr ContainerReleaseLeaseResponse) RequestID() string { - return crlr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (crlr ContainerReleaseLeaseResponse) Version() string { - return crlr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerRenewLeaseResponse ... -type ContainerRenewLeaseResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (crlr ContainerRenewLeaseResponse) Response() *http.Response { - return crlr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (crlr ContainerRenewLeaseResponse) StatusCode() int { - return crlr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (crlr ContainerRenewLeaseResponse) Status() string { - return crlr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (crlr ContainerRenewLeaseResponse) ClientRequestID() string { - return crlr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (crlr ContainerRenewLeaseResponse) Date() time.Time { - s := crlr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (crlr ContainerRenewLeaseResponse) ErrorCode() string { - return crlr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (crlr ContainerRenewLeaseResponse) ETag() ETag { - return ETag(crlr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (crlr ContainerRenewLeaseResponse) LastModified() time.Time { - s := crlr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseID returns the value for header x-ms-lease-id. -func (crlr ContainerRenewLeaseResponse) LeaseID() string { - return crlr.rawResponse.Header.Get("x-ms-lease-id") -} - -// RequestID returns the value for header x-ms-request-id. -func (crlr ContainerRenewLeaseResponse) RequestID() string { - return crlr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (crlr ContainerRenewLeaseResponse) Version() string { - return crlr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerSetAccessPolicyResponse ... -type ContainerSetAccessPolicyResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (csapr ContainerSetAccessPolicyResponse) Response() *http.Response { - return csapr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (csapr ContainerSetAccessPolicyResponse) StatusCode() int { - return csapr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (csapr ContainerSetAccessPolicyResponse) Status() string { - return csapr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (csapr ContainerSetAccessPolicyResponse) ClientRequestID() string { - return csapr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (csapr ContainerSetAccessPolicyResponse) Date() time.Time { - s := csapr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (csapr ContainerSetAccessPolicyResponse) ErrorCode() string { - return csapr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (csapr ContainerSetAccessPolicyResponse) ETag() ETag { - return ETag(csapr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (csapr ContainerSetAccessPolicyResponse) LastModified() time.Time { - s := csapr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (csapr ContainerSetAccessPolicyResponse) RequestID() string { - return csapr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (csapr ContainerSetAccessPolicyResponse) Version() string { - return csapr.rawResponse.Header.Get("x-ms-version") -} - -// ContainerSetMetadataResponse ... -type ContainerSetMetadataResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (csmr ContainerSetMetadataResponse) Response() *http.Response { - return csmr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (csmr ContainerSetMetadataResponse) StatusCode() int { - return csmr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (csmr ContainerSetMetadataResponse) Status() string { - return csmr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (csmr ContainerSetMetadataResponse) ClientRequestID() string { - return csmr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (csmr ContainerSetMetadataResponse) Date() time.Time { - s := csmr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (csmr ContainerSetMetadataResponse) ErrorCode() string { - return csmr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (csmr ContainerSetMetadataResponse) ETag() ETag { - return ETag(csmr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (csmr ContainerSetMetadataResponse) LastModified() time.Time { - s := csmr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (csmr ContainerSetMetadataResponse) RequestID() string { - return csmr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (csmr ContainerSetMetadataResponse) Version() string { - return csmr.rawResponse.Header.Get("x-ms-version") -} - -// CorsRule - CORS is an HTTP feature that enables a web application running under one domain to access -// resources in another domain. Web browsers implement a security restriction known as same-origin policy that -// prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain -// (the origin domain) to call APIs in another domain -type CorsRule struct { - // AllowedOrigins - The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - AllowedOrigins string `xml:"AllowedOrigins"` - // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) - AllowedMethods string `xml:"AllowedMethods"` - // AllowedHeaders - the request headers that the origin domain may specify on the CORS request. - AllowedHeaders string `xml:"AllowedHeaders"` - // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer - ExposedHeaders string `xml:"ExposedHeaders"` - // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. - MaxAgeInSeconds int32 `xml:"MaxAgeInSeconds"` -} - -// DataLakeStorageError ... -type DataLakeStorageError struct { - // Error - The service error response object. - Error *DataLakeStorageErrorError `xml:"error"` -} - -// DataLakeStorageErrorError - The service error response object. -type DataLakeStorageErrorError struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"DataLakeStorageError_error"` - // Code - The service error code. - Code *string `xml:"Code"` - // Message - The service error message. - Message *string `xml:"Message"` -} - -// DirectoryCreateResponse ... -type DirectoryCreateResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (dcr DirectoryCreateResponse) Response() *http.Response { - return dcr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dcr DirectoryCreateResponse) StatusCode() int { - return dcr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dcr DirectoryCreateResponse) Status() string { - return dcr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dcr DirectoryCreateResponse) ClientRequestID() string { - return dcr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentLength returns the value for header Content-Length. -func (dcr DirectoryCreateResponse) ContentLength() int64 { - s := dcr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// Date returns the value for header Date. -func (dcr DirectoryCreateResponse) Date() time.Time { - s := dcr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (dcr DirectoryCreateResponse) ETag() ETag { - return ETag(dcr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (dcr DirectoryCreateResponse) LastModified() time.Time { - s := dcr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (dcr DirectoryCreateResponse) RequestID() string { - return dcr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dcr DirectoryCreateResponse) Version() string { - return dcr.rawResponse.Header.Get("x-ms-version") -} - -// DirectoryDeleteResponse ... -type DirectoryDeleteResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (ddr DirectoryDeleteResponse) Response() *http.Response { - return ddr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (ddr DirectoryDeleteResponse) StatusCode() int { - return ddr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (ddr DirectoryDeleteResponse) Status() string { - return ddr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (ddr DirectoryDeleteResponse) ClientRequestID() string { - return ddr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (ddr DirectoryDeleteResponse) Date() time.Time { - s := ddr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// Marker returns the value for header x-ms-continuation. -func (ddr DirectoryDeleteResponse) Marker() string { - return ddr.rawResponse.Header.Get("x-ms-continuation") -} - -// RequestID returns the value for header x-ms-request-id. -func (ddr DirectoryDeleteResponse) RequestID() string { - return ddr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (ddr DirectoryDeleteResponse) Version() string { - return ddr.rawResponse.Header.Get("x-ms-version") -} - -// DirectoryGetAccessControlResponse ... -type DirectoryGetAccessControlResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (dgacr DirectoryGetAccessControlResponse) Response() *http.Response { - return dgacr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dgacr DirectoryGetAccessControlResponse) StatusCode() int { - return dgacr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dgacr DirectoryGetAccessControlResponse) Status() string { - return dgacr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dgacr DirectoryGetAccessControlResponse) ClientRequestID() string { - return dgacr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (dgacr DirectoryGetAccessControlResponse) Date() time.Time { - s := dgacr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (dgacr DirectoryGetAccessControlResponse) ETag() ETag { - return ETag(dgacr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (dgacr DirectoryGetAccessControlResponse) LastModified() time.Time { - s := dgacr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (dgacr DirectoryGetAccessControlResponse) RequestID() string { - return dgacr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dgacr DirectoryGetAccessControlResponse) Version() string { - return dgacr.rawResponse.Header.Get("x-ms-version") -} - -// XMsACL returns the value for header x-ms-acl. -func (dgacr DirectoryGetAccessControlResponse) XMsACL() string { - return dgacr.rawResponse.Header.Get("x-ms-acl") -} - -// XMsGroup returns the value for header x-ms-group. -func (dgacr DirectoryGetAccessControlResponse) XMsGroup() string { - return dgacr.rawResponse.Header.Get("x-ms-group") -} - -// XMsOwner returns the value for header x-ms-owner. -func (dgacr DirectoryGetAccessControlResponse) XMsOwner() string { - return dgacr.rawResponse.Header.Get("x-ms-owner") -} - -// XMsPermissions returns the value for header x-ms-permissions. -func (dgacr DirectoryGetAccessControlResponse) XMsPermissions() string { - return dgacr.rawResponse.Header.Get("x-ms-permissions") -} - -// DirectoryRenameResponse ... -type DirectoryRenameResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (drr DirectoryRenameResponse) Response() *http.Response { - return drr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (drr DirectoryRenameResponse) StatusCode() int { - return drr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (drr DirectoryRenameResponse) Status() string { - return drr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (drr DirectoryRenameResponse) ClientRequestID() string { - return drr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentLength returns the value for header Content-Length. -func (drr DirectoryRenameResponse) ContentLength() int64 { - s := drr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// Date returns the value for header Date. -func (drr DirectoryRenameResponse) Date() time.Time { - s := drr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (drr DirectoryRenameResponse) ETag() ETag { - return ETag(drr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (drr DirectoryRenameResponse) LastModified() time.Time { - s := drr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// Marker returns the value for header x-ms-continuation. -func (drr DirectoryRenameResponse) Marker() string { - return drr.rawResponse.Header.Get("x-ms-continuation") -} - -// RequestID returns the value for header x-ms-request-id. -func (drr DirectoryRenameResponse) RequestID() string { - return drr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (drr DirectoryRenameResponse) Version() string { - return drr.rawResponse.Header.Get("x-ms-version") -} - -// DirectorySetAccessControlResponse ... -type DirectorySetAccessControlResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (dsacr DirectorySetAccessControlResponse) Response() *http.Response { - return dsacr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dsacr DirectorySetAccessControlResponse) StatusCode() int { - return dsacr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dsacr DirectorySetAccessControlResponse) Status() string { - return dsacr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dsacr DirectorySetAccessControlResponse) ClientRequestID() string { - return dsacr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (dsacr DirectorySetAccessControlResponse) Date() time.Time { - s := dsacr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ETag returns the value for header ETag. -func (dsacr DirectorySetAccessControlResponse) ETag() ETag { - return ETag(dsacr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (dsacr DirectorySetAccessControlResponse) LastModified() time.Time { - s := dsacr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (dsacr DirectorySetAccessControlResponse) RequestID() string { - return dsacr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dsacr DirectorySetAccessControlResponse) Version() string { - return dsacr.rawResponse.Header.Get("x-ms-version") -} - -// downloadResponse - Wraps the response from the blobClient.Download method. -type downloadResponse struct { - rawResponse *http.Response -} - -// NewMetadata returns user-defined key/value pairs. -func (dr downloadResponse) NewMetadata() Metadata { - md := Metadata{} - for k, v := range dr.rawResponse.Header { - if len(k) > mdPrefixLen { - if prefix := k[0:mdPrefixLen]; strings.EqualFold(prefix, mdPrefix) { - md[strings.ToLower(k[mdPrefixLen:])] = v[0] - } - } - } - return md -} - -// Response returns the raw HTTP response object. -func (dr downloadResponse) Response() *http.Response { - return dr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (dr downloadResponse) StatusCode() int { - return dr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (dr downloadResponse) Status() string { - return dr.rawResponse.Status -} - -// Body returns the raw HTTP response object's Body. -func (dr downloadResponse) Body() io.ReadCloser { - return dr.rawResponse.Body -} - -// AcceptRanges returns the value for header Accept-Ranges. -func (dr downloadResponse) AcceptRanges() string { - return dr.rawResponse.Header.Get("Accept-Ranges") -} - -// BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count. -func (dr downloadResponse) BlobCommittedBlockCount() int32 { - s := dr.rawResponse.Header.Get("x-ms-blob-committed-block-count") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 32) - if err != nil { - i = 0 - } - return int32(i) -} - -// BlobContentMD5 returns the value for header x-ms-blob-content-md5. -func (dr downloadResponse) BlobContentMD5() []byte { - s := dr.rawResponse.Header.Get("x-ms-blob-content-md5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (dr downloadResponse) BlobSequenceNumber() int64 { - s := dr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// BlobType returns the value for header x-ms-blob-type. -func (dr downloadResponse) BlobType() BlobType { - return BlobType(dr.rawResponse.Header.Get("x-ms-blob-type")) -} - -// CacheControl returns the value for header Cache-Control. -func (dr downloadResponse) CacheControl() string { - return dr.rawResponse.Header.Get("Cache-Control") -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (dr downloadResponse) ClientRequestID() string { - return dr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentCrc64 returns the value for header x-ms-content-crc64. -func (dr downloadResponse) ContentCrc64() []byte { - s := dr.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// ContentDisposition returns the value for header Content-Disposition. -func (dr downloadResponse) ContentDisposition() string { - return dr.rawResponse.Header.Get("Content-Disposition") -} - -// ContentEncoding returns the value for header Content-Encoding. -func (dr downloadResponse) ContentEncoding() string { - return dr.rawResponse.Header.Get("Content-Encoding") -} - -// ContentLanguage returns the value for header Content-Language. -func (dr downloadResponse) ContentLanguage() string { - return dr.rawResponse.Header.Get("Content-Language") -} - -// ContentLength returns the value for header Content-Length. -func (dr downloadResponse) ContentLength() int64 { - s := dr.rawResponse.Header.Get("Content-Length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ContentMD5 returns the value for header Content-MD5. -func (dr downloadResponse) ContentMD5() []byte { - s := dr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// ContentRange returns the value for header Content-Range. -func (dr downloadResponse) ContentRange() string { - return dr.rawResponse.Header.Get("Content-Range") -} - -// ContentType returns the value for header Content-Type. -func (dr downloadResponse) ContentType() string { - return dr.rawResponse.Header.Get("Content-Type") -} - -// CopyCompletionTime returns the value for header x-ms-copy-completion-time. -func (dr downloadResponse) CopyCompletionTime() time.Time { - s := dr.rawResponse.Header.Get("x-ms-copy-completion-time") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// CopyID returns the value for header x-ms-copy-id. -func (dr downloadResponse) CopyID() string { - return dr.rawResponse.Header.Get("x-ms-copy-id") -} - -// CopyProgress returns the value for header x-ms-copy-progress. -func (dr downloadResponse) CopyProgress() string { - return dr.rawResponse.Header.Get("x-ms-copy-progress") -} - -// CopySource returns the value for header x-ms-copy-source. -func (dr downloadResponse) CopySource() string { - return dr.rawResponse.Header.Get("x-ms-copy-source") -} - -// CopyStatus returns the value for header x-ms-copy-status. -func (dr downloadResponse) CopyStatus() CopyStatusType { - return CopyStatusType(dr.rawResponse.Header.Get("x-ms-copy-status")) -} - -// CopyStatusDescription returns the value for header x-ms-copy-status-description. -func (dr downloadResponse) CopyStatusDescription() string { - return dr.rawResponse.Header.Get("x-ms-copy-status-description") -} - -// Date returns the value for header Date. -func (dr downloadResponse) Date() time.Time { - s := dr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (dr downloadResponse) EncryptionKeySha256() string { - return dr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (dr downloadResponse) ErrorCode() string { - return dr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (dr downloadResponse) ETag() ETag { - return ETag(dr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-server-encrypted. -func (dr downloadResponse) IsServerEncrypted() string { - return dr.rawResponse.Header.Get("x-ms-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (dr downloadResponse) LastModified() time.Time { - s := dr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// LeaseDuration returns the value for header x-ms-lease-duration. -func (dr downloadResponse) LeaseDuration() LeaseDurationType { - return LeaseDurationType(dr.rawResponse.Header.Get("x-ms-lease-duration")) -} - -// LeaseState returns the value for header x-ms-lease-state. -func (dr downloadResponse) LeaseState() LeaseStateType { - return LeaseStateType(dr.rawResponse.Header.Get("x-ms-lease-state")) -} - -// LeaseStatus returns the value for header x-ms-lease-status. -func (dr downloadResponse) LeaseStatus() LeaseStatusType { - return LeaseStatusType(dr.rawResponse.Header.Get("x-ms-lease-status")) -} - -// RequestID returns the value for header x-ms-request-id. -func (dr downloadResponse) RequestID() string { - return dr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (dr downloadResponse) Version() string { - return dr.rawResponse.Header.Get("x-ms-version") -} - -// GeoReplication - Geo-Replication information for the Secondary Storage Service -type GeoReplication struct { - // Status - The status of the secondary location. Possible values include: 'GeoReplicationStatusLive', 'GeoReplicationStatusBootstrap', 'GeoReplicationStatusUnavailable', 'GeoReplicationStatusNone' - Status GeoReplicationStatusType `xml:"Status"` - // LastSyncTime - A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. - LastSyncTime time.Time `xml:"LastSyncTime"` -} - -// MarshalXML implements the xml.Marshaler interface for GeoReplication. -func (gr GeoReplication) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - gr2 := (*geoReplication)(unsafe.Pointer(&gr)) - return e.EncodeElement(*gr2, start) -} - -// UnmarshalXML implements the xml.Unmarshaler interface for GeoReplication. -func (gr *GeoReplication) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - gr2 := (*geoReplication)(unsafe.Pointer(gr)) - return d.DecodeElement(gr2, &start) -} - -// KeyInfo - Key information -type KeyInfo struct { - // Start - The date-time the key is active in ISO 8601 UTC time - Start string `xml:"Start"` - // Expiry - The date-time the key expires in ISO 8601 UTC time - Expiry string `xml:"Expiry"` -} - -// ListBlobsFlatSegmentResponse - An enumeration of blobs -type ListBlobsFlatSegmentResponse struct { - rawResponse *http.Response - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"EnumerationResults"` - ServiceEndpoint string `xml:"ServiceEndpoint,attr"` - ContainerName string `xml:"ContainerName,attr"` - Prefix *string `xml:"Prefix"` - Marker *string `xml:"Marker"` - MaxResults *int32 `xml:"MaxResults"` - Segment BlobFlatListSegment `xml:"Blobs"` - NextMarker Marker `xml:"NextMarker"` -} - -// Response returns the raw HTTP response object. -func (lbfsr ListBlobsFlatSegmentResponse) Response() *http.Response { - return lbfsr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (lbfsr ListBlobsFlatSegmentResponse) StatusCode() int { - return lbfsr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (lbfsr ListBlobsFlatSegmentResponse) Status() string { - return lbfsr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (lbfsr ListBlobsFlatSegmentResponse) ClientRequestID() string { - return lbfsr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentType returns the value for header Content-Type. -func (lbfsr ListBlobsFlatSegmentResponse) ContentType() string { - return lbfsr.rawResponse.Header.Get("Content-Type") -} - -// Date returns the value for header Date. -func (lbfsr ListBlobsFlatSegmentResponse) Date() time.Time { - s := lbfsr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (lbfsr ListBlobsFlatSegmentResponse) ErrorCode() string { - return lbfsr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (lbfsr ListBlobsFlatSegmentResponse) RequestID() string { - return lbfsr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (lbfsr ListBlobsFlatSegmentResponse) Version() string { - return lbfsr.rawResponse.Header.Get("x-ms-version") -} - -// ListBlobsHierarchySegmentResponse - An enumeration of blobs -type ListBlobsHierarchySegmentResponse struct { - rawResponse *http.Response - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"EnumerationResults"` - ServiceEndpoint string `xml:"ServiceEndpoint,attr"` - ContainerName string `xml:"ContainerName,attr"` - Prefix *string `xml:"Prefix"` - Marker *string `xml:"Marker"` - MaxResults *int32 `xml:"MaxResults"` - Delimiter *string `xml:"Delimiter"` - Segment BlobHierarchyListSegment `xml:"Blobs"` - NextMarker Marker `xml:"NextMarker"` -} - -// Response returns the raw HTTP response object. -func (lbhsr ListBlobsHierarchySegmentResponse) Response() *http.Response { - return lbhsr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (lbhsr ListBlobsHierarchySegmentResponse) StatusCode() int { - return lbhsr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (lbhsr ListBlobsHierarchySegmentResponse) Status() string { - return lbhsr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (lbhsr ListBlobsHierarchySegmentResponse) ClientRequestID() string { - return lbhsr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentType returns the value for header Content-Type. -func (lbhsr ListBlobsHierarchySegmentResponse) ContentType() string { - return lbhsr.rawResponse.Header.Get("Content-Type") -} - -// Date returns the value for header Date. -func (lbhsr ListBlobsHierarchySegmentResponse) Date() time.Time { - s := lbhsr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (lbhsr ListBlobsHierarchySegmentResponse) ErrorCode() string { - return lbhsr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (lbhsr ListBlobsHierarchySegmentResponse) RequestID() string { - return lbhsr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (lbhsr ListBlobsHierarchySegmentResponse) Version() string { - return lbhsr.rawResponse.Header.Get("x-ms-version") -} - -// ListContainersSegmentResponse - An enumeration of containers -type ListContainersSegmentResponse struct { - rawResponse *http.Response - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"EnumerationResults"` - ServiceEndpoint string `xml:"ServiceEndpoint,attr"` - Prefix *string `xml:"Prefix"` - Marker *string `xml:"Marker"` - MaxResults *int32 `xml:"MaxResults"` - ContainerItems []ContainerItem `xml:"Containers>Container"` - NextMarker Marker `xml:"NextMarker"` -} - -// Response returns the raw HTTP response object. -func (lcsr ListContainersSegmentResponse) Response() *http.Response { - return lcsr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (lcsr ListContainersSegmentResponse) StatusCode() int { - return lcsr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (lcsr ListContainersSegmentResponse) Status() string { - return lcsr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (lcsr ListContainersSegmentResponse) ClientRequestID() string { - return lcsr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (lcsr ListContainersSegmentResponse) ErrorCode() string { - return lcsr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (lcsr ListContainersSegmentResponse) RequestID() string { - return lcsr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (lcsr ListContainersSegmentResponse) Version() string { - return lcsr.rawResponse.Header.Get("x-ms-version") -} - -// Logging - Azure Analytics Logging settings. -type Logging struct { - // Version - The version of Storage Analytics to configure. - Version string `xml:"Version"` - // Delete - Indicates whether all delete requests should be logged. - Delete bool `xml:"Delete"` - // Read - Indicates whether all read requests should be logged. - Read bool `xml:"Read"` - // Write - Indicates whether all write requests should be logged. - Write bool `xml:"Write"` - RetentionPolicy RetentionPolicy `xml:"RetentionPolicy"` -} - -// Metrics - a summary of request statistics grouped by API in hour or minute aggregates for blobs -type Metrics struct { - // Version - The version of Storage Analytics to configure. - Version *string `xml:"Version"` - // Enabled - Indicates whether metrics are enabled for the Blob service. - Enabled bool `xml:"Enabled"` - // IncludeAPIs - Indicates whether metrics should generate summary statistics for called API operations. - IncludeAPIs *bool `xml:"IncludeAPIs"` - RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"` -} - -// PageBlobClearPagesResponse ... -type PageBlobClearPagesResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbcpr PageBlobClearPagesResponse) Response() *http.Response { - return pbcpr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbcpr PageBlobClearPagesResponse) StatusCode() int { - return pbcpr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbcpr PageBlobClearPagesResponse) Status() string { - return pbcpr.rawResponse.Status -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (pbcpr PageBlobClearPagesResponse) BlobSequenceNumber() int64 { - s := pbcpr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pbcpr PageBlobClearPagesResponse) ClientRequestID() string { - return pbcpr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (pbcpr PageBlobClearPagesResponse) ContentMD5() []byte { - s := pbcpr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (pbcpr PageBlobClearPagesResponse) Date() time.Time { - s := pbcpr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbcpr PageBlobClearPagesResponse) ErrorCode() string { - return pbcpr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbcpr PageBlobClearPagesResponse) ETag() ETag { - return ETag(pbcpr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (pbcpr PageBlobClearPagesResponse) LastModified() time.Time { - s := pbcpr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbcpr PageBlobClearPagesResponse) RequestID() string { - return pbcpr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbcpr PageBlobClearPagesResponse) Version() string { - return pbcpr.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (pbcpr PageBlobClearPagesResponse) XMsContentCrc64() []byte { - s := pbcpr.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// PageBlobCopyIncrementalResponse ... -type PageBlobCopyIncrementalResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbcir PageBlobCopyIncrementalResponse) Response() *http.Response { - return pbcir.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbcir PageBlobCopyIncrementalResponse) StatusCode() int { - return pbcir.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbcir PageBlobCopyIncrementalResponse) Status() string { - return pbcir.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pbcir PageBlobCopyIncrementalResponse) ClientRequestID() string { - return pbcir.rawResponse.Header.Get("x-ms-client-request-id") -} - -// CopyID returns the value for header x-ms-copy-id. -func (pbcir PageBlobCopyIncrementalResponse) CopyID() string { - return pbcir.rawResponse.Header.Get("x-ms-copy-id") -} - -// CopyStatus returns the value for header x-ms-copy-status. -func (pbcir PageBlobCopyIncrementalResponse) CopyStatus() CopyStatusType { - return CopyStatusType(pbcir.rawResponse.Header.Get("x-ms-copy-status")) -} - -// Date returns the value for header Date. -func (pbcir PageBlobCopyIncrementalResponse) Date() time.Time { - s := pbcir.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbcir PageBlobCopyIncrementalResponse) ErrorCode() string { - return pbcir.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbcir PageBlobCopyIncrementalResponse) ETag() ETag { - return ETag(pbcir.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (pbcir PageBlobCopyIncrementalResponse) LastModified() time.Time { - s := pbcir.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbcir PageBlobCopyIncrementalResponse) RequestID() string { - return pbcir.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbcir PageBlobCopyIncrementalResponse) Version() string { - return pbcir.rawResponse.Header.Get("x-ms-version") -} - -// PageBlobCreateResponse ... -type PageBlobCreateResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbcr PageBlobCreateResponse) Response() *http.Response { - return pbcr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbcr PageBlobCreateResponse) StatusCode() int { - return pbcr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbcr PageBlobCreateResponse) Status() string { - return pbcr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pbcr PageBlobCreateResponse) ClientRequestID() string { - return pbcr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (pbcr PageBlobCreateResponse) ContentMD5() []byte { - s := pbcr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (pbcr PageBlobCreateResponse) Date() time.Time { - s := pbcr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (pbcr PageBlobCreateResponse) EncryptionKeySha256() string { - return pbcr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbcr PageBlobCreateResponse) ErrorCode() string { - return pbcr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbcr PageBlobCreateResponse) ETag() ETag { - return ETag(pbcr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (pbcr PageBlobCreateResponse) IsServerEncrypted() string { - return pbcr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (pbcr PageBlobCreateResponse) LastModified() time.Time { - s := pbcr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbcr PageBlobCreateResponse) RequestID() string { - return pbcr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbcr PageBlobCreateResponse) Version() string { - return pbcr.rawResponse.Header.Get("x-ms-version") -} - -// PageBlobResizeResponse ... -type PageBlobResizeResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbrr PageBlobResizeResponse) Response() *http.Response { - return pbrr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbrr PageBlobResizeResponse) StatusCode() int { - return pbrr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbrr PageBlobResizeResponse) Status() string { - return pbrr.rawResponse.Status -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (pbrr PageBlobResizeResponse) BlobSequenceNumber() int64 { - s := pbrr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pbrr PageBlobResizeResponse) ClientRequestID() string { - return pbrr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (pbrr PageBlobResizeResponse) Date() time.Time { - s := pbrr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbrr PageBlobResizeResponse) ErrorCode() string { - return pbrr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbrr PageBlobResizeResponse) ETag() ETag { - return ETag(pbrr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (pbrr PageBlobResizeResponse) LastModified() time.Time { - s := pbrr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbrr PageBlobResizeResponse) RequestID() string { - return pbrr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbrr PageBlobResizeResponse) Version() string { - return pbrr.rawResponse.Header.Get("x-ms-version") -} - -// PageBlobUpdateSequenceNumberResponse ... -type PageBlobUpdateSequenceNumberResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbusnr PageBlobUpdateSequenceNumberResponse) Response() *http.Response { - return pbusnr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbusnr PageBlobUpdateSequenceNumberResponse) StatusCode() int { - return pbusnr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbusnr PageBlobUpdateSequenceNumberResponse) Status() string { - return pbusnr.rawResponse.Status -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (pbusnr PageBlobUpdateSequenceNumberResponse) BlobSequenceNumber() int64 { - s := pbusnr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pbusnr PageBlobUpdateSequenceNumberResponse) ClientRequestID() string { - return pbusnr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (pbusnr PageBlobUpdateSequenceNumberResponse) Date() time.Time { - s := pbusnr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbusnr PageBlobUpdateSequenceNumberResponse) ErrorCode() string { - return pbusnr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbusnr PageBlobUpdateSequenceNumberResponse) ETag() ETag { - return ETag(pbusnr.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (pbusnr PageBlobUpdateSequenceNumberResponse) LastModified() time.Time { - s := pbusnr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbusnr PageBlobUpdateSequenceNumberResponse) RequestID() string { - return pbusnr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbusnr PageBlobUpdateSequenceNumberResponse) Version() string { - return pbusnr.rawResponse.Header.Get("x-ms-version") -} - -// PageBlobUploadPagesFromURLResponse ... -type PageBlobUploadPagesFromURLResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbupfur PageBlobUploadPagesFromURLResponse) Response() *http.Response { - return pbupfur.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbupfur PageBlobUploadPagesFromURLResponse) StatusCode() int { - return pbupfur.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbupfur PageBlobUploadPagesFromURLResponse) Status() string { - return pbupfur.rawResponse.Status -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (pbupfur PageBlobUploadPagesFromURLResponse) BlobSequenceNumber() int64 { - s := pbupfur.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ContentMD5 returns the value for header Content-MD5. -func (pbupfur PageBlobUploadPagesFromURLResponse) ContentMD5() []byte { - s := pbupfur.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (pbupfur PageBlobUploadPagesFromURLResponse) Date() time.Time { - s := pbupfur.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (pbupfur PageBlobUploadPagesFromURLResponse) EncryptionKeySha256() string { - return pbupfur.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbupfur PageBlobUploadPagesFromURLResponse) ErrorCode() string { - return pbupfur.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbupfur PageBlobUploadPagesFromURLResponse) ETag() ETag { - return ETag(pbupfur.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (pbupfur PageBlobUploadPagesFromURLResponse) IsServerEncrypted() string { - return pbupfur.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (pbupfur PageBlobUploadPagesFromURLResponse) LastModified() time.Time { - s := pbupfur.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbupfur PageBlobUploadPagesFromURLResponse) RequestID() string { - return pbupfur.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbupfur PageBlobUploadPagesFromURLResponse) Version() string { - return pbupfur.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (pbupfur PageBlobUploadPagesFromURLResponse) XMsContentCrc64() []byte { - s := pbupfur.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// PageBlobUploadPagesResponse ... -type PageBlobUploadPagesResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (pbupr PageBlobUploadPagesResponse) Response() *http.Response { - return pbupr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pbupr PageBlobUploadPagesResponse) StatusCode() int { - return pbupr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pbupr PageBlobUploadPagesResponse) Status() string { - return pbupr.rawResponse.Status -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (pbupr PageBlobUploadPagesResponse) BlobSequenceNumber() int64 { - s := pbupr.rawResponse.Header.Get("x-ms-blob-sequence-number") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pbupr PageBlobUploadPagesResponse) ClientRequestID() string { - return pbupr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ContentMD5 returns the value for header Content-MD5. -func (pbupr PageBlobUploadPagesResponse) ContentMD5() []byte { - s := pbupr.rawResponse.Header.Get("Content-MD5") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// Date returns the value for header Date. -func (pbupr PageBlobUploadPagesResponse) Date() time.Time { - s := pbupr.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256. -func (pbupr PageBlobUploadPagesResponse) EncryptionKeySha256() string { - return pbupr.rawResponse.Header.Get("x-ms-encryption-key-sha256") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pbupr PageBlobUploadPagesResponse) ErrorCode() string { - return pbupr.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pbupr PageBlobUploadPagesResponse) ETag() ETag { - return ETag(pbupr.rawResponse.Header.Get("ETag")) -} - -// IsServerEncrypted returns the value for header x-ms-request-server-encrypted. -func (pbupr PageBlobUploadPagesResponse) IsServerEncrypted() string { - return pbupr.rawResponse.Header.Get("x-ms-request-server-encrypted") -} - -// LastModified returns the value for header Last-Modified. -func (pbupr PageBlobUploadPagesResponse) LastModified() time.Time { - s := pbupr.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pbupr PageBlobUploadPagesResponse) RequestID() string { - return pbupr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pbupr PageBlobUploadPagesResponse) Version() string { - return pbupr.rawResponse.Header.Get("x-ms-version") -} - -// XMsContentCrc64 returns the value for header x-ms-content-crc64. -func (pbupr PageBlobUploadPagesResponse) XMsContentCrc64() []byte { - s := pbupr.rawResponse.Header.Get("x-ms-content-crc64") - if s == "" { - return nil - } - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - b = nil - } - return b -} - -// PageList - the list of pages -type PageList struct { - rawResponse *http.Response - PageRange []PageRange `xml:"PageRange"` - ClearRange []ClearRange `xml:"ClearRange"` -} - -// Response returns the raw HTTP response object. -func (pl PageList) Response() *http.Response { - return pl.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (pl PageList) StatusCode() int { - return pl.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (pl PageList) Status() string { - return pl.rawResponse.Status -} - -// BlobContentLength returns the value for header x-ms-blob-content-length. -func (pl PageList) BlobContentLength() int64 { - s := pl.rawResponse.Header.Get("x-ms-blob-content-length") - if s == "" { - return -1 - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - i = 0 - } - return i -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (pl PageList) ClientRequestID() string { - return pl.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (pl PageList) Date() time.Time { - s := pl.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (pl PageList) ErrorCode() string { - return pl.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (pl PageList) ETag() ETag { - return ETag(pl.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (pl PageList) LastModified() time.Time { - s := pl.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (pl PageList) RequestID() string { - return pl.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (pl PageList) Version() string { - return pl.rawResponse.Header.Get("x-ms-version") -} - -// PageRange ... -type PageRange struct { - Start int64 `xml:"Start"` - End int64 `xml:"End"` -} - -// RetentionPolicy - the retention policy which determines how long the associated data should persist -type RetentionPolicy struct { - // Enabled - Indicates whether a retention policy is enabled for the storage service - Enabled bool `xml:"Enabled"` - // Days - Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted - Days *int32 `xml:"Days"` -} - -// ServiceGetAccountInfoResponse ... -type ServiceGetAccountInfoResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (sgair ServiceGetAccountInfoResponse) Response() *http.Response { - return sgair.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (sgair ServiceGetAccountInfoResponse) StatusCode() int { - return sgair.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (sgair ServiceGetAccountInfoResponse) Status() string { - return sgair.rawResponse.Status -} - -// AccountKind returns the value for header x-ms-account-kind. -func (sgair ServiceGetAccountInfoResponse) AccountKind() AccountKindType { - return AccountKindType(sgair.rawResponse.Header.Get("x-ms-account-kind")) -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (sgair ServiceGetAccountInfoResponse) ClientRequestID() string { - return sgair.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (sgair ServiceGetAccountInfoResponse) Date() time.Time { - s := sgair.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (sgair ServiceGetAccountInfoResponse) ErrorCode() string { - return sgair.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (sgair ServiceGetAccountInfoResponse) RequestID() string { - return sgair.rawResponse.Header.Get("x-ms-request-id") -} - -// SkuName returns the value for header x-ms-sku-name. -func (sgair ServiceGetAccountInfoResponse) SkuName() SkuNameType { - return SkuNameType(sgair.rawResponse.Header.Get("x-ms-sku-name")) -} - -// Version returns the value for header x-ms-version. -func (sgair ServiceGetAccountInfoResponse) Version() string { - return sgair.rawResponse.Header.Get("x-ms-version") -} - -// ServiceSetPropertiesResponse ... -type ServiceSetPropertiesResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (sspr ServiceSetPropertiesResponse) Response() *http.Response { - return sspr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (sspr ServiceSetPropertiesResponse) StatusCode() int { - return sspr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (sspr ServiceSetPropertiesResponse) Status() string { - return sspr.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (sspr ServiceSetPropertiesResponse) ClientRequestID() string { - return sspr.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (sspr ServiceSetPropertiesResponse) ErrorCode() string { - return sspr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (sspr ServiceSetPropertiesResponse) RequestID() string { - return sspr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (sspr ServiceSetPropertiesResponse) Version() string { - return sspr.rawResponse.Header.Get("x-ms-version") -} - -// SignedIdentifier - signed identifier -type SignedIdentifier struct { - // ID - a unique id - ID string `xml:"Id"` - AccessPolicy AccessPolicy `xml:"AccessPolicy"` -} - -// SignedIdentifiers - Wraps the response from the containerClient.GetAccessPolicy method. -type SignedIdentifiers struct { - rawResponse *http.Response - Items []SignedIdentifier `xml:"SignedIdentifier"` -} - -// Response returns the raw HTTP response object. -func (si SignedIdentifiers) Response() *http.Response { - return si.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (si SignedIdentifiers) StatusCode() int { - return si.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (si SignedIdentifiers) Status() string { - return si.rawResponse.Status -} - -// BlobPublicAccess returns the value for header x-ms-blob-public-access. -func (si SignedIdentifiers) BlobPublicAccess() PublicAccessType { - return PublicAccessType(si.rawResponse.Header.Get("x-ms-blob-public-access")) -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (si SignedIdentifiers) ClientRequestID() string { - return si.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (si SignedIdentifiers) Date() time.Time { - s := si.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (si SignedIdentifiers) ErrorCode() string { - return si.rawResponse.Header.Get("x-ms-error-code") -} - -// ETag returns the value for header ETag. -func (si SignedIdentifiers) ETag() ETag { - return ETag(si.rawResponse.Header.Get("ETag")) -} - -// LastModified returns the value for header Last-Modified. -func (si SignedIdentifiers) LastModified() time.Time { - s := si.rawResponse.Header.Get("Last-Modified") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// RequestID returns the value for header x-ms-request-id. -func (si SignedIdentifiers) RequestID() string { - return si.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (si SignedIdentifiers) Version() string { - return si.rawResponse.Header.Get("x-ms-version") -} - -// StaticWebsite - The properties that enable an account to host a static website -type StaticWebsite struct { - // Enabled - Indicates whether this account is hosting a static website - Enabled bool `xml:"Enabled"` - // IndexDocument - The default name of the index page under each directory - IndexDocument *string `xml:"IndexDocument"` - // ErrorDocument404Path - The absolute path of the custom 404 page - ErrorDocument404Path *string `xml:"ErrorDocument404Path"` -} - -// StorageServiceProperties - Storage Service Properties. -type StorageServiceProperties struct { - rawResponse *http.Response - Logging *Logging `xml:"Logging"` - HourMetrics *Metrics `xml:"HourMetrics"` - MinuteMetrics *Metrics `xml:"MinuteMetrics"` - // Cors - The set of CORS rules. - Cors []CorsRule `xml:"Cors>CorsRule"` - // DefaultServiceVersion - The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions - DefaultServiceVersion *string `xml:"DefaultServiceVersion"` - DeleteRetentionPolicy *RetentionPolicy `xml:"DeleteRetentionPolicy"` - StaticWebsite *StaticWebsite `xml:"StaticWebsite"` -} - -// Response returns the raw HTTP response object. -func (ssp StorageServiceProperties) Response() *http.Response { - return ssp.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (ssp StorageServiceProperties) StatusCode() int { - return ssp.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (ssp StorageServiceProperties) Status() string { - return ssp.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (ssp StorageServiceProperties) ClientRequestID() string { - return ssp.rawResponse.Header.Get("x-ms-client-request-id") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (ssp StorageServiceProperties) ErrorCode() string { - return ssp.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (ssp StorageServiceProperties) RequestID() string { - return ssp.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (ssp StorageServiceProperties) Version() string { - return ssp.rawResponse.Header.Get("x-ms-version") -} - -// StorageServiceStats - Stats for the storage service. -type StorageServiceStats struct { - rawResponse *http.Response - GeoReplication *GeoReplication `xml:"GeoReplication"` -} - -// Response returns the raw HTTP response object. -func (sss StorageServiceStats) Response() *http.Response { - return sss.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (sss StorageServiceStats) StatusCode() int { - return sss.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (sss StorageServiceStats) Status() string { - return sss.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (sss StorageServiceStats) ClientRequestID() string { - return sss.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (sss StorageServiceStats) Date() time.Time { - s := sss.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (sss StorageServiceStats) ErrorCode() string { - return sss.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (sss StorageServiceStats) RequestID() string { - return sss.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (sss StorageServiceStats) Version() string { - return sss.rawResponse.Header.Get("x-ms-version") -} - -// SubmitBatchResponse - Wraps the response from the serviceClient.SubmitBatch method. -type SubmitBatchResponse struct { - rawResponse *http.Response -} - -// Response returns the raw HTTP response object. -func (sbr SubmitBatchResponse) Response() *http.Response { - return sbr.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (sbr SubmitBatchResponse) StatusCode() int { - return sbr.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (sbr SubmitBatchResponse) Status() string { - return sbr.rawResponse.Status -} - -// Body returns the raw HTTP response object's Body. -func (sbr SubmitBatchResponse) Body() io.ReadCloser { - return sbr.rawResponse.Body -} - -// ContentType returns the value for header Content-Type. -func (sbr SubmitBatchResponse) ContentType() string { - return sbr.rawResponse.Header.Get("Content-Type") -} - -// ErrorCode returns the value for header x-ms-error-code. -func (sbr SubmitBatchResponse) ErrorCode() string { - return sbr.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (sbr SubmitBatchResponse) RequestID() string { - return sbr.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (sbr SubmitBatchResponse) Version() string { - return sbr.rawResponse.Header.Get("x-ms-version") -} - -// UserDelegationKey - A user delegation key -type UserDelegationKey struct { - rawResponse *http.Response - // SignedOid - The Azure Active Directory object ID in GUID format. - SignedOid string `xml:"SignedOid"` - // SignedTid - The Azure Active Directory tenant ID in GUID format - SignedTid string `xml:"SignedTid"` - // SignedStart - The date-time the key is active - SignedStart time.Time `xml:"SignedStart"` - // SignedExpiry - The date-time the key expires - SignedExpiry time.Time `xml:"SignedExpiry"` - // SignedService - Abbreviation of the Azure Storage service that accepts the key - SignedService string `xml:"SignedService"` - // SignedVersion - The service version that created the key - SignedVersion string `xml:"SignedVersion"` - // Value - The key as a base64 string - Value string `xml:"Value"` -} - -// MarshalXML implements the xml.Marshaler interface for UserDelegationKey. -func (udk UserDelegationKey) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - udk2 := (*userDelegationKey)(unsafe.Pointer(&udk)) - return e.EncodeElement(*udk2, start) -} - -// UnmarshalXML implements the xml.Unmarshaler interface for UserDelegationKey. -func (udk *UserDelegationKey) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - udk2 := (*userDelegationKey)(unsafe.Pointer(udk)) - return d.DecodeElement(udk2, &start) -} - -// Response returns the raw HTTP response object. -func (udk UserDelegationKey) Response() *http.Response { - return udk.rawResponse -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (udk UserDelegationKey) StatusCode() int { - return udk.rawResponse.StatusCode -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (udk UserDelegationKey) Status() string { - return udk.rawResponse.Status -} - -// ClientRequestID returns the value for header x-ms-client-request-id. -func (udk UserDelegationKey) ClientRequestID() string { - return udk.rawResponse.Header.Get("x-ms-client-request-id") -} - -// Date returns the value for header Date. -func (udk UserDelegationKey) Date() time.Time { - s := udk.rawResponse.Header.Get("Date") - if s == "" { - return time.Time{} - } - t, err := time.Parse(time.RFC1123, s) - if err != nil { - t = time.Time{} - } - return t -} - -// ErrorCode returns the value for header x-ms-error-code. -func (udk UserDelegationKey) ErrorCode() string { - return udk.rawResponse.Header.Get("x-ms-error-code") -} - -// RequestID returns the value for header x-ms-request-id. -func (udk UserDelegationKey) RequestID() string { - return udk.rawResponse.Header.Get("x-ms-request-id") -} - -// Version returns the value for header x-ms-version. -func (udk UserDelegationKey) Version() string { - return udk.rawResponse.Header.Get("x-ms-version") -} - -func init() { - if reflect.TypeOf((*UserDelegationKey)(nil)).Elem().Size() != reflect.TypeOf((*userDelegationKey)(nil)).Elem().Size() { - validateError(errors.New("size mismatch between UserDelegationKey and userDelegationKey")) - } - if reflect.TypeOf((*AccessPolicy)(nil)).Elem().Size() != reflect.TypeOf((*accessPolicy)(nil)).Elem().Size() { - validateError(errors.New("size mismatch between AccessPolicy and accessPolicy")) - } - if reflect.TypeOf((*BlobProperties)(nil)).Elem().Size() != reflect.TypeOf((*blobProperties)(nil)).Elem().Size() { - validateError(errors.New("size mismatch between BlobProperties and blobProperties")) - } - if reflect.TypeOf((*ContainerProperties)(nil)).Elem().Size() != reflect.TypeOf((*containerProperties)(nil)).Elem().Size() { - validateError(errors.New("size mismatch between ContainerProperties and containerProperties")) - } - if reflect.TypeOf((*GeoReplication)(nil)).Elem().Size() != reflect.TypeOf((*geoReplication)(nil)).Elem().Size() { - validateError(errors.New("size mismatch between GeoReplication and geoReplication")) - } -} - -const ( - rfc3339Format = "2006-01-02T15:04:05Z" //This was wrong in the generated code, FYI -) - -// used to convert times from UTC to GMT before sending across the wire -var gmt = time.FixedZone("GMT", 0) - -// internal type used for marshalling time in RFC1123 format -type timeRFC1123 struct { - time.Time -} - -// MarshalText implements the encoding.TextMarshaler interface for timeRFC1123. -func (t timeRFC1123) MarshalText() ([]byte, error) { - return []byte(t.Format(time.RFC1123)), nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface for timeRFC1123. -func (t *timeRFC1123) UnmarshalText(data []byte) (err error) { - t.Time, err = time.Parse(time.RFC1123, string(data)) - return -} - -// internal type used for marshalling time in RFC3339 format -type timeRFC3339 struct { - time.Time -} - -// MarshalText implements the encoding.TextMarshaler interface for timeRFC3339. -func (t timeRFC3339) MarshalText() ([]byte, error) { - return []byte(t.Format(rfc3339Format)), nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface for timeRFC3339. -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - t.Time, err = time.Parse(rfc3339Format, string(data)) - return -} - -// internal type used for marshalling base64 encoded strings -type base64Encoded struct { - b []byte -} - -// MarshalText implements the encoding.TextMarshaler interface for base64Encoded. -func (c base64Encoded) MarshalText() ([]byte, error) { - return []byte(base64.StdEncoding.EncodeToString(c.b)), nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface for base64Encoded. -func (c *base64Encoded) UnmarshalText(data []byte) error { - b, err := base64.StdEncoding.DecodeString(string(data)) - if err != nil { - return err - } - c.b = b - return nil -} - -// internal type used for marshalling -type userDelegationKey struct { - rawResponse *http.Response - SignedOid string `xml:"SignedOid"` - SignedTid string `xml:"SignedTid"` - SignedStart timeRFC3339 `xml:"SignedStart"` - SignedExpiry timeRFC3339 `xml:"SignedExpiry"` - SignedService string `xml:"SignedService"` - SignedVersion string `xml:"SignedVersion"` - Value string `xml:"Value"` -} - -// internal type used for marshalling -type accessPolicy struct { - Start timeRFC3339 `xml:"Start"` - Expiry timeRFC3339 `xml:"Expiry"` - Permission string `xml:"Permission"` -} - -// internal type used for marshalling -type blobProperties struct { - // XMLName is used for marshalling and is subject to removal in a future release. - XMLName xml.Name `xml:"Properties"` - CreationTime *timeRFC1123 `xml:"Creation-Time"` - LastModified timeRFC1123 `xml:"Last-Modified"` - Etag ETag `xml:"Etag"` - ContentLength *int64 `xml:"Content-Length"` - ContentType *string `xml:"Content-Type"` - ContentEncoding *string `xml:"Content-Encoding"` - ContentLanguage *string `xml:"Content-Language"` - ContentMD5 base64Encoded `xml:"Content-MD5"` - ContentDisposition *string `xml:"Content-Disposition"` - CacheControl *string `xml:"Cache-Control"` - BlobSequenceNumber *int64 `xml:"x-ms-blob-sequence-number"` - BlobType BlobType `xml:"BlobType"` - LeaseStatus LeaseStatusType `xml:"LeaseStatus"` - LeaseState LeaseStateType `xml:"LeaseState"` - LeaseDuration LeaseDurationType `xml:"LeaseDuration"` - CopyID *string `xml:"CopyId"` - CopyStatus CopyStatusType `xml:"CopyStatus"` - CopySource *string `xml:"CopySource"` - CopyProgress *string `xml:"CopyProgress"` - CopyCompletionTime *timeRFC1123 `xml:"CopyCompletionTime"` - CopyStatusDescription *string `xml:"CopyStatusDescription"` - ServerEncrypted *bool `xml:"ServerEncrypted"` - IncrementalCopy *bool `xml:"IncrementalCopy"` - DestinationSnapshot *string `xml:"DestinationSnapshot"` - DeletedTime *timeRFC1123 `xml:"DeletedTime"` - RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"` - AccessTier AccessTierType `xml:"AccessTier"` - AccessTierInferred *bool `xml:"AccessTierInferred"` - ArchiveStatus ArchiveStatusType `xml:"ArchiveStatus"` - CustomerProvidedKeySha256 *string `xml:"CustomerProvidedKeySha256"` - AccessTierChangeTime *timeRFC1123 `xml:"AccessTierChangeTime"` -} - -// internal type used for marshalling -type containerProperties struct { - LastModified timeRFC1123 `xml:"Last-Modified"` - Etag ETag `xml:"Etag"` - LeaseStatus LeaseStatusType `xml:"LeaseStatus"` - LeaseState LeaseStateType `xml:"LeaseState"` - LeaseDuration LeaseDurationType `xml:"LeaseDuration"` - PublicAccess PublicAccessType `xml:"PublicAccess"` - HasImmutabilityPolicy *bool `xml:"HasImmutabilityPolicy"` - HasLegalHold *bool `xml:"HasLegalHold"` -} - -// internal type used for marshalling -type geoReplication struct { - Status GeoReplicationStatusType `xml:"Status"` - LastSyncTime timeRFC1123 `xml:"LastSyncTime"` -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_page_blob.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_page_blob.go deleted file mode 100644 index b40873f38..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_page_blob.go +++ /dev/null @@ -1,977 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/base64" - "encoding/xml" - "github.com/Azure/azure-pipeline-go/pipeline" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "time" -) - -// pageBlobClient is the client for the PageBlob methods of the Azblob service. -type pageBlobClient struct { - managementClient -} - -// newPageBlobClient creates an instance of the pageBlobClient client. -func newPageBlobClient(url url.URL, p pipeline.Pipeline) pageBlobClient { - return pageBlobClient{newManagementClient(url, p)} -} - -// ClearPages the Clear Pages operation clears a set of pages from a page blob -// -// contentLength is the length of the request. timeout is the timeout parameter is expressed in seconds. For more -// information, see Setting -// Timeouts for Blob Service Operations. rangeParameter is return only the bytes of the blob in the specified -// range. leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID. -// encryptionKey is optional. Specifies the encryption key to use to encrypt the data provided in the request. If not -// specified, encryption is performed with the root account encryption key. For more information, see Encryption at -// Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the provided encryption key. Must be -// provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the algorithm used to produce the -// encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key -// header is provided. ifSequenceNumberLessThanOrEqualTo is specify this header value to operate only on a blob if it -// has a sequence number less than or equal to the specified. ifSequenceNumberLessThan is specify this header value to -// operate only on a blob if it has a sequence number less than the specified. ifSequenceNumberEqualTo is specify this -// header value to operate only on a blob if it has the specified sequence number. ifModifiedSince is specify this -// header value to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is -// specify this header value to operate only on a blob if it has not been modified since the specified date/time. -// ifMatch is specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag -// value to operate only on blobs without a matching value. requestID is provides a client-generated, opaque value with -// a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client pageBlobClient) ClearPages(ctx context.Context, contentLength int64, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobClearPagesResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.clearPagesPreparer(contentLength, timeout, rangeParameter, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.clearPagesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobClearPagesResponse), err -} - -// clearPagesPreparer prepares the ClearPages request. -func (client pageBlobClient) clearPagesPreparer(contentLength int64, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "page") - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if rangeParameter != nil { - req.Header.Set("x-ms-range", *rangeParameter) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifSequenceNumberLessThanOrEqualTo != nil { - req.Header.Set("x-ms-if-sequence-number-le", strconv.FormatInt(*ifSequenceNumberLessThanOrEqualTo, 10)) - } - if ifSequenceNumberLessThan != nil { - req.Header.Set("x-ms-if-sequence-number-lt", strconv.FormatInt(*ifSequenceNumberLessThan, 10)) - } - if ifSequenceNumberEqualTo != nil { - req.Header.Set("x-ms-if-sequence-number-eq", strconv.FormatInt(*ifSequenceNumberEqualTo, 10)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-page-write", "clear") - return req, nil -} - -// clearPagesResponder handles the response to the ClearPages request. -func (client pageBlobClient) clearPagesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobClearPagesResponse{rawResponse: resp.Response()}, err -} - -// CopyIncremental the Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. -// The snapshot is copied such that only the differential changes between the previously copied snapshot are -// transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or -// copied from as usual. This API is supported since REST version 2016-05-31. -// -// copySource is specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that -// specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob -// must either be public or must be authenticated via a shared access signature. timeout is the timeout parameter is -// expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. ifModifiedSince is specify this header value to operate only on a blob if -// it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only -// on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate -// only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a -// matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded -// in the analytics logs when storage analytics logging is enabled. -func (client pageBlobClient) CopyIncremental(ctx context.Context, copySource string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobCopyIncrementalResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.copyIncrementalPreparer(copySource, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.copyIncrementalResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobCopyIncrementalResponse), err -} - -// copyIncrementalPreparer prepares the CopyIncremental request. -func (client pageBlobClient) copyIncrementalPreparer(copySource string, timeout *int32, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "incrementalcopy") - req.URL.RawQuery = params.Encode() - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-copy-source", copySource) - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// copyIncrementalResponder handles the response to the CopyIncremental request. -func (client pageBlobClient) copyIncrementalResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobCopyIncrementalResponse{rawResponse: resp.Response()}, err -} - -// Create the Create operation creates a new page blob. -// -// contentLength is the length of the request. blobContentLength is this header specifies the maximum size for the page -// blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. timeout is the timeout parameter is -// expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. tier is optional. Indicates the tier to be set on the page blob. -// blobContentType is optional. Sets the blob's content type. If specified, this property is stored with the blob and -// returned with a read request. blobContentEncoding is optional. Sets the blob's content encoding. If specified, this -// property is stored with the blob and returned with a read request. blobContentLanguage is optional. Set the blob's -// content language. If specified, this property is stored with the blob and returned with a read request. -// blobContentMD5 is optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for -// the individual blocks were validated when each was uploaded. blobCacheControl is optional. Sets the blob's cache -// control. If specified, this property is stored with the blob and returned with a read request. metadata is optional. -// Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the -// operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value -// pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from -// the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules -// for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. leaseID is if -// specified, the operation only succeeds if the resource's lease is active and matches this ID. blobContentDisposition -// is optional. Sets the blob's Content-Disposition header. encryptionKey is optional. Specifies the encryption key to -// use to encrypt the data provided in the request. If not specified, encryption is performed with the root account -// encryption key. For more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the -// SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. -// encryptionAlgorithm is the algorithm used to produce the encryption key hash. Currently, the only accepted value is -// "AES256". Must be provided if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header -// value to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify -// this header value to operate only on a blob if it has not been modified since the specified date/time. ifMatch is -// specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to -// operate only on blobs without a matching value. blobSequenceNumber is set for page blobs only. The sequence number -// is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 -// and 2^63 - 1. requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in -// the analytics logs when storage analytics logging is enabled. -func (client pageBlobClient) Create(ctx context.Context, contentLength int64, blobContentLength int64, timeout *int32, tier PremiumPageBlobAccessTierType, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobSequenceNumber *int64, requestID *string) (*PageBlobCreateResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.createPreparer(contentLength, blobContentLength, timeout, tier, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5, blobCacheControl, metadata, leaseID, blobContentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, blobSequenceNumber, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobCreateResponse), err -} - -// createPreparer prepares the Create request. -func (client pageBlobClient) createPreparer(contentLength int64, blobContentLength int64, timeout *int32, tier PremiumPageBlobAccessTierType, blobContentType *string, blobContentEncoding *string, blobContentLanguage *string, blobContentMD5 []byte, blobCacheControl *string, metadata map[string]string, leaseID *string, blobContentDisposition *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobSequenceNumber *int64, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if tier != PremiumPageBlobAccessTierNone { - req.Header.Set("x-ms-access-tier", string(tier)) - } - if blobContentType != nil { - req.Header.Set("x-ms-blob-content-type", *blobContentType) - } - if blobContentEncoding != nil { - req.Header.Set("x-ms-blob-content-encoding", *blobContentEncoding) - } - if blobContentLanguage != nil { - req.Header.Set("x-ms-blob-content-language", *blobContentLanguage) - } - if blobContentMD5 != nil { - req.Header.Set("x-ms-blob-content-md5", base64.StdEncoding.EncodeToString(blobContentMD5)) - } - if blobCacheControl != nil { - req.Header.Set("x-ms-blob-cache-control", *blobCacheControl) - } - if metadata != nil { - for k, v := range metadata { - req.Header.Set("x-ms-meta-"+k, v) - } - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if blobContentDisposition != nil { - req.Header.Set("x-ms-blob-content-disposition", *blobContentDisposition) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-blob-content-length", strconv.FormatInt(blobContentLength, 10)) - if blobSequenceNumber != nil { - req.Header.Set("x-ms-blob-sequence-number", strconv.FormatInt(*blobSequenceNumber, 10)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-blob-type", "PageBlob") - return req, nil -} - -// createResponder handles the response to the Create request. -func (client pageBlobClient) createResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobCreateResponse{rawResponse: resp.Response()}, err -} - -// GetPageRanges the Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a -// page blob -// -// snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to -// retrieve. For more information on working with blob snapshots, see Creating -// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. rangeParameter is return only the bytes of the blob in the specified -// range. leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID. -// ifModifiedSince is specify this header value to operate only on a blob if it has been modified since the specified -// date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified -// since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching value. -// ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. requestID is provides a -// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage -// analytics logging is enabled. -func (client pageBlobClient) GetPageRanges(ctx context.Context, snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageList, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getPageRangesPreparer(snapshot, timeout, rangeParameter, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPageRangesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageList), err -} - -// getPageRangesPreparer prepares the GetPageRanges request. -func (client pageBlobClient) getPageRangesPreparer(snapshot *string, timeout *int32, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if snapshot != nil && len(*snapshot) > 0 { - params.Set("snapshot", *snapshot) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "pagelist") - req.URL.RawQuery = params.Encode() - if rangeParameter != nil { - req.Header.Set("x-ms-range", *rangeParameter) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getPageRangesResponder handles the response to the GetPageRanges request. -func (client pageBlobClient) getPageRangesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &PageList{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// GetPageRangesDiff the Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were -// changed between target blob and previous snapshot. -// -// snapshot is the snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to -// retrieve. For more information on working with blob snapshots, see Creating -// a Snapshot of a Blob. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. prevsnapshot is optional in version 2015-07-08 and newer. The prevsnapshot -// parameter is a DateTime value that specifies that the response will contain only pages that were changed between -// target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a -// snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots -// are currently supported only for blobs created on or after January 1, 2016. rangeParameter is return only the bytes -// of the blob in the specified range. leaseID is if specified, the operation only succeeds if the resource's lease is -// active and matches this ID. ifModifiedSince is specify this header value to operate only on a blob if it has been -// modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if -// it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs -// with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// requestID is provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics -// logs when storage analytics logging is enabled. -func (client pageBlobClient) GetPageRangesDiff(ctx context.Context, snapshot *string, timeout *int32, prevsnapshot *string, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageList, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getPageRangesDiffPreparer(snapshot, timeout, prevsnapshot, rangeParameter, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPageRangesDiffResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageList), err -} - -// getPageRangesDiffPreparer prepares the GetPageRangesDiff request. -func (client pageBlobClient) getPageRangesDiffPreparer(snapshot *string, timeout *int32, prevsnapshot *string, rangeParameter *string, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if snapshot != nil && len(*snapshot) > 0 { - params.Set("snapshot", *snapshot) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - if prevsnapshot != nil && len(*prevsnapshot) > 0 { - params.Set("prevsnapshot", *prevsnapshot) - } - params.Set("comp", "pagelist") - req.URL.RawQuery = params.Encode() - if rangeParameter != nil { - req.Header.Set("x-ms-range", *rangeParameter) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getPageRangesDiffResponder handles the response to the GetPageRangesDiff request. -func (client pageBlobClient) getPageRangesDiffResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &PageList{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// Resize resize the Blob -// -// blobContentLength is this header specifies the maximum size for the page blob, up to 1 TB. The page blob size must -// be aligned to a 512-byte boundary. timeout is the timeout parameter is expressed in seconds. For more information, -// see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. encryptionKey is optional. Specifies the encryption key to use to encrypt the -// data provided in the request. If not specified, encryption is performed with the root account encryption key. For -// more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the -// provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the -// algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided -// if the x-ms-encryption-key header is provided. ifModifiedSince is specify this header value to operate only on a -// blob if it has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to -// operate only on a blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value -// to operate only on blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs -// without a matching value. requestID is provides a client-generated, opaque value with a 1 KB character limit that is -// recorded in the analytics logs when storage analytics logging is enabled. -func (client pageBlobClient) Resize(ctx context.Context, blobContentLength int64, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobResizeResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.resizePreparer(blobContentLength, timeout, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.resizeResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobResizeResponse), err -} - -// resizePreparer prepares the Resize request. -func (client pageBlobClient) resizePreparer(blobContentLength int64, timeout *int32, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-blob-content-length", strconv.FormatInt(blobContentLength, 10)) - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// resizeResponder handles the response to the Resize request. -func (client pageBlobClient) resizeResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobResizeResponse{rawResponse: resp.Response()}, err -} - -// UpdateSequenceNumber update the sequence number of the blob -// -// sequenceNumberAction is required if the x-ms-blob-sequence-number header is set for the request. This property -// applies to page blobs only. This property indicates how the service should modify the blob's sequence number timeout -// is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. leaseID is if specified, the operation only succeeds if the resource's -// lease is active and matches this ID. ifModifiedSince is specify this header value to operate only on a blob if it -// has been modified since the specified date/time. ifUnmodifiedSince is specify this header value to operate only on a -// blob if it has not been modified since the specified date/time. ifMatch is specify an ETag value to operate only on -// blobs with a matching value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. -// blobSequenceNumber is set for page blobs only. The sequence number is a user-controlled value that you can use to -// track requests. The value of the sequence number must be between 0 and 2^63 - 1. requestID is provides a -// client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage -// analytics logging is enabled. -func (client pageBlobClient) UpdateSequenceNumber(ctx context.Context, sequenceNumberAction SequenceNumberActionType, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobSequenceNumber *int64, requestID *string) (*PageBlobUpdateSequenceNumberResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.updateSequenceNumberPreparer(sequenceNumberAction, timeout, leaseID, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, blobSequenceNumber, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.updateSequenceNumberResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobUpdateSequenceNumberResponse), err -} - -// updateSequenceNumberPreparer prepares the UpdateSequenceNumber request. -func (client pageBlobClient) updateSequenceNumberPreparer(sequenceNumberAction SequenceNumberActionType, timeout *int32, leaseID *string, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, blobSequenceNumber *int64, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-sequence-number-action", string(sequenceNumberAction)) - if blobSequenceNumber != nil { - req.Header.Set("x-ms-blob-sequence-number", strconv.FormatInt(*blobSequenceNumber, 10)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// updateSequenceNumberResponder handles the response to the UpdateSequenceNumber request. -func (client pageBlobClient) updateSequenceNumberResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobUpdateSequenceNumberResponse{rawResponse: resp.Response()}, err -} - -// UploadPages the Upload Pages operation writes a range of pages to a page blob -// -// body is initial data body will be closed upon successful return. Callers should ensure closure when receiving an -// error.contentLength is the length of the request. transactionalContentMD5 is specify the transactional md5 for the -// body, to be validated by the service. transactionalContentCrc64 is specify the transactional crc64 for the body, to -// be validated by the service. timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. rangeParameter is return only the bytes of the blob in the specified -// range. leaseID is if specified, the operation only succeeds if the resource's lease is active and matches this ID. -// encryptionKey is optional. Specifies the encryption key to use to encrypt the data provided in the request. If not -// specified, encryption is performed with the root account encryption key. For more information, see Encryption at -// Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of the provided encryption key. Must be -// provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is the algorithm used to produce the -// encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key -// header is provided. ifSequenceNumberLessThanOrEqualTo is specify this header value to operate only on a blob if it -// has a sequence number less than or equal to the specified. ifSequenceNumberLessThan is specify this header value to -// operate only on a blob if it has a sequence number less than the specified. ifSequenceNumberEqualTo is specify this -// header value to operate only on a blob if it has the specified sequence number. ifModifiedSince is specify this -// header value to operate only on a blob if it has been modified since the specified date/time. ifUnmodifiedSince is -// specify this header value to operate only on a blob if it has not been modified since the specified date/time. -// ifMatch is specify an ETag value to operate only on blobs with a matching value. ifNoneMatch is specify an ETag -// value to operate only on blobs without a matching value. requestID is provides a client-generated, opaque value with -// a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client pageBlobClient) UploadPages(ctx context.Context, body io.ReadSeeker, contentLength int64, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (*PageBlobUploadPagesResponse, error) { - if err := validate([]validation{ - {targetValue: body, - constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.uploadPagesPreparer(body, contentLength, transactionalContentMD5, transactionalContentCrc64, timeout, rangeParameter, leaseID, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.uploadPagesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobUploadPagesResponse), err -} - -// uploadPagesPreparer prepares the UploadPages request. -func (client pageBlobClient) uploadPagesPreparer(body io.ReadSeeker, contentLength int64, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, timeout *int32, rangeParameter *string, leaseID *string, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, body) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "page") - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - if transactionalContentMD5 != nil { - req.Header.Set("Content-MD5", base64.StdEncoding.EncodeToString(transactionalContentMD5)) - } - if transactionalContentCrc64 != nil { - req.Header.Set("x-ms-content-crc64", base64.StdEncoding.EncodeToString(transactionalContentCrc64)) - } - if rangeParameter != nil { - req.Header.Set("x-ms-range", *rangeParameter) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if ifSequenceNumberLessThanOrEqualTo != nil { - req.Header.Set("x-ms-if-sequence-number-le", strconv.FormatInt(*ifSequenceNumberLessThanOrEqualTo, 10)) - } - if ifSequenceNumberLessThan != nil { - req.Header.Set("x-ms-if-sequence-number-lt", strconv.FormatInt(*ifSequenceNumberLessThan, 10)) - } - if ifSequenceNumberEqualTo != nil { - req.Header.Set("x-ms-if-sequence-number-eq", strconv.FormatInt(*ifSequenceNumberEqualTo, 10)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-page-write", "update") - return req, nil -} - -// uploadPagesResponder handles the response to the UploadPages request. -func (client pageBlobClient) uploadPagesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobUploadPagesResponse{rawResponse: resp.Response()}, err -} - -// UploadPagesFromURL the Upload Pages operation writes a range of pages to a page blob where the contents are read -// from a URL -// -// sourceURL is specify a URL to the copy source. sourceRange is bytes of source data in the specified range. The -// length of this range should match the ContentLength header and x-ms-range/Range destination range header. -// contentLength is the length of the request. rangeParameter is the range of bytes to which the source range would be -// written. The range should be 512 aligned and range-end is required. sourceContentMD5 is specify the md5 calculated -// for the range of bytes that must be read from the copy source. sourceContentcrc64 is specify the crc64 calculated -// for the range of bytes that must be read from the copy source. timeout is the timeout parameter is expressed in -// seconds. For more information, see Setting -// Timeouts for Blob Service Operations. encryptionKey is optional. Specifies the encryption key to use to encrypt -// the data provided in the request. If not specified, encryption is performed with the root account encryption key. -// For more information, see Encryption at Rest for Azure Storage Services. encryptionKeySha256 is the SHA-256 hash of -// the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. encryptionAlgorithm is -// the algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be -// provided if the x-ms-encryption-key header is provided. leaseID is if specified, the operation only succeeds if the -// resource's lease is active and matches this ID. ifSequenceNumberLessThanOrEqualTo is specify this header value to -// operate only on a blob if it has a sequence number less than or equal to the specified. ifSequenceNumberLessThan is -// specify this header value to operate only on a blob if it has a sequence number less than the specified. -// ifSequenceNumberEqualTo is specify this header value to operate only on a blob if it has the specified sequence -// number. ifModifiedSince is specify this header value to operate only on a blob if it has been modified since the -// specified date/time. ifUnmodifiedSince is specify this header value to operate only on a blob if it has not been -// modified since the specified date/time. ifMatch is specify an ETag value to operate only on blobs with a matching -// value. ifNoneMatch is specify an ETag value to operate only on blobs without a matching value. sourceIfModifiedSince -// is specify this header value to operate only on a blob if it has been modified since the specified date/time. -// sourceIfUnmodifiedSince is specify this header value to operate only on a blob if it has not been modified since the -// specified date/time. sourceIfMatch is specify an ETag value to operate only on blobs with a matching value. -// sourceIfNoneMatch is specify an ETag value to operate only on blobs without a matching value. requestID is provides -// a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage -// analytics logging is enabled. -func (client pageBlobClient) UploadPagesFromURL(ctx context.Context, sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (*PageBlobUploadPagesFromURLResponse, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.uploadPagesFromURLPreparer(sourceURL, sourceRange, contentLength, rangeParameter, sourceContentMD5, sourceContentcrc64, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseID, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.uploadPagesFromURLResponder}, req) - if err != nil { - return nil, err - } - return resp.(*PageBlobUploadPagesFromURLResponse), err -} - -// uploadPagesFromURLPreparer prepares the UploadPagesFromURL request. -func (client pageBlobClient) uploadPagesFromURLPreparer(sourceURL string, sourceRange string, contentLength int64, rangeParameter string, sourceContentMD5 []byte, sourceContentcrc64 []byte, timeout *int32, encryptionKey *string, encryptionKeySha256 *string, encryptionAlgorithm EncryptionAlgorithmType, leaseID *string, ifSequenceNumberLessThanOrEqualTo *int64, ifSequenceNumberLessThan *int64, ifSequenceNumberEqualTo *int64, ifModifiedSince *time.Time, ifUnmodifiedSince *time.Time, ifMatch *ETag, ifNoneMatch *ETag, sourceIfModifiedSince *time.Time, sourceIfUnmodifiedSince *time.Time, sourceIfMatch *ETag, sourceIfNoneMatch *ETag, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "page") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-copy-source", sourceURL) - req.Header.Set("x-ms-source-range", sourceRange) - if sourceContentMD5 != nil { - req.Header.Set("x-ms-source-content-md5", base64.StdEncoding.EncodeToString(sourceContentMD5)) - } - if sourceContentcrc64 != nil { - req.Header.Set("x-ms-source-content-crc64", base64.StdEncoding.EncodeToString(sourceContentcrc64)) - } - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - req.Header.Set("x-ms-range", rangeParameter) - if encryptionKey != nil { - req.Header.Set("x-ms-encryption-key", *encryptionKey) - } - if encryptionKeySha256 != nil { - req.Header.Set("x-ms-encryption-key-sha256", *encryptionKeySha256) - } - if encryptionAlgorithm != EncryptionAlgorithmNone { - req.Header.Set("x-ms-encryption-algorithm", string(encryptionAlgorithm)) - } - if leaseID != nil { - req.Header.Set("x-ms-lease-id", *leaseID) - } - if ifSequenceNumberLessThanOrEqualTo != nil { - req.Header.Set("x-ms-if-sequence-number-le", strconv.FormatInt(*ifSequenceNumberLessThanOrEqualTo, 10)) - } - if ifSequenceNumberLessThan != nil { - req.Header.Set("x-ms-if-sequence-number-lt", strconv.FormatInt(*ifSequenceNumberLessThan, 10)) - } - if ifSequenceNumberEqualTo != nil { - req.Header.Set("x-ms-if-sequence-number-eq", strconv.FormatInt(*ifSequenceNumberEqualTo, 10)) - } - if ifModifiedSince != nil { - req.Header.Set("If-Modified-Since", (*ifModifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifUnmodifiedSince != nil { - req.Header.Set("If-Unmodified-Since", (*ifUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if ifMatch != nil { - req.Header.Set("If-Match", string(*ifMatch)) - } - if ifNoneMatch != nil { - req.Header.Set("If-None-Match", string(*ifNoneMatch)) - } - if sourceIfModifiedSince != nil { - req.Header.Set("x-ms-source-if-modified-since", (*sourceIfModifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfUnmodifiedSince != nil { - req.Header.Set("x-ms-source-if-unmodified-since", (*sourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)) - } - if sourceIfMatch != nil { - req.Header.Set("x-ms-source-if-match", string(*sourceIfMatch)) - } - if sourceIfNoneMatch != nil { - req.Header.Set("x-ms-source-if-none-match", string(*sourceIfNoneMatch)) - } - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - req.Header.Set("x-ms-page-write", "update") - return req, nil -} - -// uploadPagesFromURLResponder handles the response to the UploadPagesFromURL request. -func (client pageBlobClient) uploadPagesFromURLResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusCreated) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &PageBlobUploadPagesFromURLResponse{rawResponse: resp.Response()}, err -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_responder_policy.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_responder_policy.go deleted file mode 100644 index 8a023d0a0..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_responder_policy.go +++ /dev/null @@ -1,74 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "bytes" - "context" - "encoding/xml" - "github.com/Azure/azure-pipeline-go/pipeline" - "io/ioutil" -) - -type responder func(resp pipeline.Response) (result pipeline.Response, err error) - -// ResponderPolicyFactory is a Factory capable of creating a responder pipeline. -type responderPolicyFactory struct { - responder responder -} - -// New creates a responder policy factory. -func (arpf responderPolicyFactory) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy { - return responderPolicy{next: next, responder: arpf.responder} -} - -type responderPolicy struct { - next pipeline.Policy - responder responder -} - -// Do sends the request to the service and validates/deserializes the HTTP response. -func (arp responderPolicy) Do(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { - resp, err := arp.next.Do(ctx, request) - if err != nil { - return resp, err - } - return arp.responder(resp) -} - -// validateResponse checks an HTTP response's status code against a legal set of codes. -// If the response code is not legal, then validateResponse reads all of the response's body -// (containing error information) and returns a response error. -func validateResponse(resp pipeline.Response, successStatusCodes ...int) error { - if resp == nil { - return NewResponseError(nil, nil, "nil response") - } - responseCode := resp.Response().StatusCode - for _, i := range successStatusCodes { - if i == responseCode { - return nil - } - } - // only close the body in the failure case. in the - // success case responders will close the body as required. - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return err - } - // the service code, description and details will be populated during unmarshalling - responseError := NewResponseError(nil, resp.Response(), resp.Response().Status) - if len(b) > 0 { - if err = xml.Unmarshal(b, &responseError); err != nil { - return NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return responseError -} - -// removes any BOM from the byte slice -func removeBOM(b []byte) []byte { - // UTF8 - return bytes.TrimPrefix(b, []byte("\xef\xbb\xbf")) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_response_error.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_response_error.go deleted file mode 100644 index 3dcc75bb5..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_response_error.go +++ /dev/null @@ -1,95 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "bytes" - "fmt" - "github.com/Azure/azure-pipeline-go/pipeline" - "net" - "net/http" -) - -// if you want to provide custom error handling set this variable to your constructor function -var responseErrorFactory func(cause error, response *http.Response, description string) error - -// ResponseError identifies a responder-generated network or response parsing error. -type ResponseError interface { - // Error exposes the Error(), Temporary() and Timeout() methods. - net.Error // Includes the Go error interface - // Response returns the HTTP response. You may examine this but you should not modify it. - Response() *http.Response -} - -// NewResponseError creates an error object that implements the error interface. -func NewResponseError(cause error, response *http.Response, description string) error { - if responseErrorFactory != nil { - return responseErrorFactory(cause, response, description) - } - return &responseError{ - ErrorNode: pipeline.ErrorNode{}.Initialize(cause, 3), - response: response, - description: description, - } -} - -// responseError is the internal struct that implements the public ResponseError interface. -type responseError struct { - pipeline.ErrorNode // This is embedded so that responseError "inherits" Error, Temporary, Timeout, and Cause - response *http.Response - description string -} - -// Error implements the error interface's Error method to return a string representation of the error. -func (e *responseError) Error() string { - b := &bytes.Buffer{} - fmt.Fprintf(b, "===== RESPONSE ERROR (Code=%v) =====\n", e.response.StatusCode) - fmt.Fprintf(b, "Status=%s, Description: %s\n", e.response.Status, e.description) - s := b.String() - return e.ErrorNode.Error(s) -} - -// Response implements the ResponseError interface's method to return the HTTP response. -func (e *responseError) Response() *http.Response { - return e.response -} - -// RFC7807 PROBLEM ------------------------------------------------------------------------------------ -// RFC7807Problem ... This type can be publicly embedded in another type that wants to add additional members. -/*type RFC7807Problem struct { - // Mandatory: A (relative) URI reference identifying the problem type (it MAY refer to human-readable documentation). - typeURI string // Should default to "about:blank" - // Optional: Short, human-readable summary (maybe localized). - title string - // Optional: HTTP status code generated by the origin server - status int - // Optional: Human-readable explanation for this problem occurance. - // Should help client correct the problem. Clients should NOT parse this string. - detail string - // Optional: A (relative) URI identifying this specific problem occurence (it may or may not be dereferenced). - instance string -} -// NewRFC7807Problem ... -func NewRFC7807Problem(typeURI string, status int, titleFormat string, a ...interface{}) error { - return &RFC7807Problem{ - typeURI: typeURI, - status: status, - title: fmt.Sprintf(titleFormat, a...), - } -} -// Error returns the error information as a string. -func (e *RFC7807Problem) Error() string { - return e.title -} -// TypeURI ... -func (e *RFC7807Problem) TypeURI() string { - if e.typeURI == "" { - e.typeURI = "about:blank" - } - return e.typeURI -} -// Members ... -func (e *RFC7807Problem) Members() (status int, title, detail, instance string) { - return e.status, e.title, e.detail, e.instance -}*/ diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_service.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_service.go deleted file mode 100644 index ac41cd081..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_service.go +++ /dev/null @@ -1,526 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "bytes" - "context" - "encoding/xml" - "github.com/Azure/azure-pipeline-go/pipeline" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" -) - -// serviceClient is the client for the Service methods of the Azblob service. -type serviceClient struct { - managementClient -} - -// newServiceClient creates an instance of the serviceClient client. -func newServiceClient(url url.URL, p pipeline.Pipeline) serviceClient { - return serviceClient{newManagementClient(url, p)} -} - -// GetAccountInfo returns the sku name and account kind -func (client serviceClient) GetAccountInfo(ctx context.Context) (*ServiceGetAccountInfoResponse, error) { - req, err := client.getAccountInfoPreparer() - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getAccountInfoResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ServiceGetAccountInfoResponse), err -} - -// getAccountInfoPreparer prepares the GetAccountInfo request. -func (client serviceClient) getAccountInfoPreparer() (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - params.Set("restype", "account") - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - return req, nil -} - -// getAccountInfoResponder handles the response to the GetAccountInfo request. -func (client serviceClient) getAccountInfoResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ServiceGetAccountInfoResponse{rawResponse: resp.Response()}, err -} - -// GetProperties gets the properties of a storage account's Blob service, including properties for Storage Analytics -// and CORS (Cross-Origin Resource Sharing) rules. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client serviceClient) GetProperties(ctx context.Context, timeout *int32, requestID *string) (*StorageServiceProperties, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getPropertiesPreparer(timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPropertiesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*StorageServiceProperties), err -} - -// getPropertiesPreparer prepares the GetProperties request. -func (client serviceClient) getPropertiesPreparer(timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "service") - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getPropertiesResponder handles the response to the GetProperties request. -func (client serviceClient) getPropertiesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &StorageServiceProperties{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// GetStatistics retrieves statistics related to replication for the Blob service. It is only available on the -// secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client serviceClient) GetStatistics(ctx context.Context, timeout *int32, requestID *string) (*StorageServiceStats, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getStatisticsPreparer(timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getStatisticsResponder}, req) - if err != nil { - return nil, err - } - return resp.(*StorageServiceStats), err -} - -// getStatisticsPreparer prepares the GetStatistics request. -func (client serviceClient) getStatisticsPreparer(timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "service") - params.Set("comp", "stats") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// getStatisticsResponder handles the response to the GetStatistics request. -func (client serviceClient) getStatisticsResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &StorageServiceStats{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// GetUserDelegationKey retrieves a user delegation key for the Blob service. This is only a valid operation when using -// bearer token authentication. -// -// timeout is the timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client serviceClient) GetUserDelegationKey(ctx context.Context, keyInfo KeyInfo, timeout *int32, requestID *string) (*UserDelegationKey, error) { - if err := validate([]validation{ - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.getUserDelegationKeyPreparer(keyInfo, timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getUserDelegationKeyResponder}, req) - if err != nil { - return nil, err - } - return resp.(*UserDelegationKey), err -} - -// getUserDelegationKeyPreparer prepares the GetUserDelegationKey request. -func (client serviceClient) getUserDelegationKeyPreparer(keyInfo KeyInfo, timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("POST", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "service") - params.Set("comp", "userdelegationkey") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - b, err := xml.Marshal(keyInfo) - if err != nil { - return req, pipeline.NewError(err, "failed to marshal request body") - } - req.Header.Set("Content-Type", "application/xml") - err = req.SetBody(bytes.NewReader(b)) - if err != nil { - return req, pipeline.NewError(err, "failed to set request body") - } - return req, nil -} - -// getUserDelegationKeyResponder handles the response to the GetUserDelegationKey request. -func (client serviceClient) getUserDelegationKeyResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &UserDelegationKey{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// ListContainersSegment the List Containers Segment operation returns a list of the containers under the specified -// account -// -// prefix is filters the results to return only containers whose name begins with the specified prefix. marker is a -// string value that identifies the portion of the list of containers to be returned with the next listing operation. -// The operation returns the NextMarker value within the response body if the listing operation did not return all -// containers remaining to be listed with the current page. The NextMarker value can be used as the value for the -// marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the -// client. maxresults is specifies the maximum number of containers to return. If the request does not specify -// maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the -// listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the -// remainder of the results. For this reason, it is possible that the service will return fewer results than specified -// by maxresults, or than the default of 5000. include is include this parameter to specify that the container's -// metadata be returned as part of the response body. timeout is the timeout parameter is expressed in seconds. For -// more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client serviceClient) ListContainersSegment(ctx context.Context, prefix *string, marker *string, maxresults *int32, include ListContainersIncludeType, timeout *int32, requestID *string) (*ListContainersSegmentResponse, error) { - if err := validate([]validation{ - {targetValue: maxresults, - constraints: []constraint{{target: "maxresults", name: null, rule: false, - chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.listContainersSegmentPreparer(prefix, marker, maxresults, include, timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listContainersSegmentResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ListContainersSegmentResponse), err -} - -// listContainersSegmentPreparer prepares the ListContainersSegment request. -func (client serviceClient) listContainersSegmentPreparer(prefix *string, marker *string, maxresults *int32, include ListContainersIncludeType, timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("GET", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if prefix != nil && len(*prefix) > 0 { - params.Set("prefix", *prefix) - } - if marker != nil && len(*marker) > 0 { - params.Set("marker", *marker) - } - if maxresults != nil { - params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10)) - } - if include != ListContainersIncludeNone { - params.Set("include", string(include)) - } - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "list") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// listContainersSegmentResponder handles the response to the ListContainersSegment request. -func (client serviceClient) listContainersSegmentResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - result := &ListContainersSegmentResponse{rawResponse: resp.Response()} - if err != nil { - return result, err - } - defer resp.Response().Body.Close() - b, err := ioutil.ReadAll(resp.Response().Body) - if err != nil { - return result, err - } - if len(b) > 0 { - b = removeBOM(b) - err = xml.Unmarshal(b, result) - if err != nil { - return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body") - } - } - return result, nil -} - -// SetProperties sets properties for a storage account's Blob service endpoint, including properties for Storage -// Analytics and CORS (Cross-Origin Resource Sharing) rules -// -// storageServiceProperties is the StorageService properties. timeout is the timeout parameter is expressed in seconds. -// For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client serviceClient) SetProperties(ctx context.Context, storageServiceProperties StorageServiceProperties, timeout *int32, requestID *string) (*ServiceSetPropertiesResponse, error) { - if err := validate([]validation{ - {targetValue: storageServiceProperties, - constraints: []constraint{{target: "storageServiceProperties.Logging", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.Logging.RetentionPolicy", name: null, rule: true, - chain: []constraint{{target: "storageServiceProperties.Logging.RetentionPolicy.Days", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.Logging.RetentionPolicy.Days", name: inclusiveMinimum, rule: 1, chain: nil}}}, - }}, - }}, - {target: "storageServiceProperties.HourMetrics", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.HourMetrics.RetentionPolicy", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.HourMetrics.RetentionPolicy.Days", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.HourMetrics.RetentionPolicy.Days", name: inclusiveMinimum, rule: 1, chain: nil}}}, - }}, - }}, - {target: "storageServiceProperties.MinuteMetrics", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.MinuteMetrics.RetentionPolicy", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.MinuteMetrics.RetentionPolicy.Days", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.MinuteMetrics.RetentionPolicy.Days", name: inclusiveMinimum, rule: 1, chain: nil}}}, - }}, - }}, - {target: "storageServiceProperties.DeleteRetentionPolicy", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.DeleteRetentionPolicy.Days", name: null, rule: false, - chain: []constraint{{target: "storageServiceProperties.DeleteRetentionPolicy.Days", name: inclusiveMinimum, rule: 1, chain: nil}}}, - }}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.setPropertiesPreparer(storageServiceProperties, timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setPropertiesResponder}, req) - if err != nil { - return nil, err - } - return resp.(*ServiceSetPropertiesResponse), err -} - -// setPropertiesPreparer prepares the SetProperties request. -func (client serviceClient) setPropertiesPreparer(storageServiceProperties StorageServiceProperties, timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("PUT", client.url, nil) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("restype", "service") - params.Set("comp", "properties") - req.URL.RawQuery = params.Encode() - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - b, err := xml.Marshal(storageServiceProperties) - if err != nil { - return req, pipeline.NewError(err, "failed to marshal request body") - } - req.Header.Set("Content-Type", "application/xml") - err = req.SetBody(bytes.NewReader(b)) - if err != nil { - return req, pipeline.NewError(err, "failed to set request body") - } - return req, nil -} - -// setPropertiesResponder handles the response to the SetProperties request. -func (client serviceClient) setPropertiesResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK, http.StatusAccepted) - if resp == nil { - return nil, err - } - io.Copy(ioutil.Discard, resp.Response().Body) - resp.Response().Body.Close() - return &ServiceSetPropertiesResponse{rawResponse: resp.Response()}, err -} - -// SubmitBatch the Batch operation allows multiple API calls to be embedded into a single HTTP request. -// -// body is initial data body will be closed upon successful return. Callers should ensure closure when receiving an -// error.contentLength is the length of the request. multipartContentType is required. The value of this header must be -// multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_ timeout is the -// timeout parameter is expressed in seconds. For more information, see Setting -// Timeouts for Blob Service Operations. requestID is provides a client-generated, opaque value with a 1 KB -// character limit that is recorded in the analytics logs when storage analytics logging is enabled. -func (client serviceClient) SubmitBatch(ctx context.Context, body io.ReadSeeker, contentLength int64, multipartContentType string, timeout *int32, requestID *string) (*SubmitBatchResponse, error) { - if err := validate([]validation{ - {targetValue: body, - constraints: []constraint{{target: "body", name: null, rule: true, chain: nil}}}, - {targetValue: timeout, - constraints: []constraint{{target: "timeout", name: null, rule: false, - chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil { - return nil, err - } - req, err := client.submitBatchPreparer(body, contentLength, multipartContentType, timeout, requestID) - if err != nil { - return nil, err - } - resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.submitBatchResponder}, req) - if err != nil { - return nil, err - } - return resp.(*SubmitBatchResponse), err -} - -// submitBatchPreparer prepares the SubmitBatch request. -func (client serviceClient) submitBatchPreparer(body io.ReadSeeker, contentLength int64, multipartContentType string, timeout *int32, requestID *string) (pipeline.Request, error) { - req, err := pipeline.NewRequest("POST", client.url, body) - if err != nil { - return req, pipeline.NewError(err, "failed to create request") - } - params := req.URL.Query() - if timeout != nil { - params.Set("timeout", strconv.FormatInt(int64(*timeout), 10)) - } - params.Set("comp", "batch") - req.URL.RawQuery = params.Encode() - req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10)) - req.Header.Set("Content-Type", multipartContentType) - req.Header.Set("x-ms-version", ServiceVersion) - if requestID != nil { - req.Header.Set("x-ms-client-request-id", *requestID) - } - return req, nil -} - -// submitBatchResponder handles the response to the SubmitBatch request. -func (client serviceClient) submitBatchResponder(resp pipeline.Response) (pipeline.Response, error) { - err := validateResponse(resp, http.StatusOK) - if resp == nil { - return nil, err - } - return &SubmitBatchResponse{rawResponse: resp.Response()}, err -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_validation.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_validation.go deleted file mode 100644 index 98a2614e6..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_validation.go +++ /dev/null @@ -1,367 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "fmt" - "github.com/Azure/azure-pipeline-go/pipeline" - "reflect" - "regexp" - "strings" -) - -// Constraint stores constraint name, target field name -// Rule and chain validations. -type constraint struct { - // Target field name for validation. - target string - - // Constraint name e.g. minLength, MaxLength, Pattern, etc. - name string - - // Rule for constraint e.g. greater than 10, less than 5 etc. - rule interface{} - - // Chain validations for struct type - chain []constraint -} - -// Validation stores parameter-wise validation. -type validation struct { - targetValue interface{} - constraints []constraint -} - -// Constraint list -const ( - empty = "Empty" - null = "Null" - readOnly = "ReadOnly" - pattern = "Pattern" - maxLength = "MaxLength" - minLength = "MinLength" - maxItems = "MaxItems" - minItems = "MinItems" - multipleOf = "MultipleOf" - uniqueItems = "UniqueItems" - inclusiveMaximum = "InclusiveMaximum" - exclusiveMaximum = "ExclusiveMaximum" - exclusiveMinimum = "ExclusiveMinimum" - inclusiveMinimum = "InclusiveMinimum" -) - -// Validate method validates constraints on parameter -// passed in validation array. -func validate(m []validation) error { - for _, item := range m { - v := reflect.ValueOf(item.targetValue) - for _, constraint := range item.constraints { - var err error - switch v.Kind() { - case reflect.Ptr: - err = validatePtr(v, constraint) - case reflect.String: - err = validateString(v, constraint) - case reflect.Struct: - err = validateStruct(v, constraint) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - err = validateInt(v, constraint) - case reflect.Float32, reflect.Float64: - err = validateFloat(v, constraint) - case reflect.Array, reflect.Slice, reflect.Map: - err = validateArrayMap(v, constraint) - default: - err = createError(v, constraint, fmt.Sprintf("unknown type %v", v.Kind())) - } - if err != nil { - return err - } - } - } - return nil -} - -func validateStruct(x reflect.Value, v constraint, name ...string) error { - //Get field name from target name which is in format a.b.c - s := strings.Split(v.target, ".") - f := x.FieldByName(s[len(s)-1]) - if isZero(f) { - return createError(x, v, fmt.Sprintf("field %q doesn't exist", v.target)) - } - err := validate([]validation{ - { - targetValue: getInterfaceValue(f), - constraints: []constraint{v}, - }, - }) - return err -} - -func validatePtr(x reflect.Value, v constraint) error { - if v.name == readOnly { - if !x.IsNil() { - return createError(x.Elem(), v, "readonly parameter; must send as nil or empty in request") - } - return nil - } - if x.IsNil() { - return checkNil(x, v) - } - if v.chain != nil { - return validate([]validation{ - { - targetValue: getInterfaceValue(x.Elem()), - constraints: v.chain, - }, - }) - } - return nil -} - -func validateInt(x reflect.Value, v constraint) error { - i := x.Int() - r, ok := v.rule.(int) - if !ok { - return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.name, v.rule)) - } - switch v.name { - case multipleOf: - if i%int64(r) != 0 { - return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r)) - } - case exclusiveMinimum: - if i <= int64(r) { - return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) - } - case exclusiveMaximum: - if i >= int64(r) { - return createError(x, v, fmt.Sprintf("value must be less than %v", r)) - } - case inclusiveMinimum: - if i < int64(r) { - return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) - } - case inclusiveMaximum: - if i > int64(r) { - return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) - } - default: - return createError(x, v, fmt.Sprintf("constraint %v is not applicable for type integer", v.name)) - } - return nil -} - -func validateFloat(x reflect.Value, v constraint) error { - f := x.Float() - r, ok := v.rule.(float64) - if !ok { - return createError(x, v, fmt.Sprintf("rule must be float value for %v constraint; got: %v", v.name, v.rule)) - } - switch v.name { - case exclusiveMinimum: - if f <= r { - return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) - } - case exclusiveMaximum: - if f >= r { - return createError(x, v, fmt.Sprintf("value must be less than %v", r)) - } - case inclusiveMinimum: - if f < r { - return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) - } - case inclusiveMaximum: - if f > r { - return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) - } - default: - return createError(x, v, fmt.Sprintf("constraint %s is not applicable for type float", v.name)) - } - return nil -} - -func validateString(x reflect.Value, v constraint) error { - s := x.String() - switch v.name { - case empty: - if len(s) == 0 { - return checkEmpty(x, v) - } - case pattern: - reg, err := regexp.Compile(v.rule.(string)) - if err != nil { - return createError(x, v, err.Error()) - } - if !reg.MatchString(s) { - return createError(x, v, fmt.Sprintf("value doesn't match pattern %v", v.rule)) - } - case maxLength: - if _, ok := v.rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.name, v.rule)) - } - if len(s) > v.rule.(int) { - return createError(x, v, fmt.Sprintf("value length must be less than %v", v.rule)) - } - case minLength: - if _, ok := v.rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.name, v.rule)) - } - if len(s) < v.rule.(int) { - return createError(x, v, fmt.Sprintf("value length must be greater than %v", v.rule)) - } - case readOnly: - if len(s) > 0 { - return createError(reflect.ValueOf(s), v, "readonly parameter; must send as nil or empty in request") - } - default: - return createError(x, v, fmt.Sprintf("constraint %s is not applicable to string type", v.name)) - } - if v.chain != nil { - return validate([]validation{ - { - targetValue: getInterfaceValue(x), - constraints: v.chain, - }, - }) - } - return nil -} - -func validateArrayMap(x reflect.Value, v constraint) error { - switch v.name { - case null: - if x.IsNil() { - return checkNil(x, v) - } - case empty: - if x.IsNil() || x.Len() == 0 { - return checkEmpty(x, v) - } - case maxItems: - if _, ok := v.rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.name, v.rule)) - } - if x.Len() > v.rule.(int) { - return createError(x, v, fmt.Sprintf("maximum item limit is %v; got: %v", v.rule, x.Len())) - } - case minItems: - if _, ok := v.rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.name, v.rule)) - } - if x.Len() < v.rule.(int) { - return createError(x, v, fmt.Sprintf("minimum item limit is %v; got: %v", v.rule, x.Len())) - } - case uniqueItems: - if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { - if !checkForUniqueInArray(x) { - return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.target, x)) - } - } else if x.Kind() == reflect.Map { - if !checkForUniqueInMap(x) { - return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.target, x)) - } - } else { - return createError(x, v, fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", v.name, x.Kind())) - } - case readOnly: - if x.Len() != 0 { - return createError(x, v, "readonly parameter; must send as nil or empty in request") - } - case pattern: - reg, err := regexp.Compile(v.rule.(string)) - if err != nil { - return createError(x, v, err.Error()) - } - keys := x.MapKeys() - for _, k := range keys { - if !reg.MatchString(k.String()) { - return createError(k, v, fmt.Sprintf("map key doesn't match pattern %v", v.rule)) - } - } - default: - return createError(x, v, fmt.Sprintf("constraint %v is not applicable to array, slice and map type", v.name)) - } - if v.chain != nil { - return validate([]validation{ - { - targetValue: getInterfaceValue(x), - constraints: v.chain, - }, - }) - } - return nil -} - -func checkNil(x reflect.Value, v constraint) error { - if _, ok := v.rule.(bool); !ok { - return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.name, v.rule)) - } - if v.rule.(bool) { - return createError(x, v, "value can not be null; required parameter") - } - return nil -} - -func checkEmpty(x reflect.Value, v constraint) error { - if _, ok := v.rule.(bool); !ok { - return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.name, v.rule)) - } - if v.rule.(bool) { - return createError(x, v, "value can not be null or empty; required parameter") - } - return nil -} - -func checkForUniqueInArray(x reflect.Value) bool { - if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { - return false - } - arrOfInterface := make([]interface{}, x.Len()) - for i := 0; i < x.Len(); i++ { - arrOfInterface[i] = x.Index(i).Interface() - } - m := make(map[interface{}]bool) - for _, val := range arrOfInterface { - if m[val] { - return false - } - m[val] = true - } - return true -} - -func checkForUniqueInMap(x reflect.Value) bool { - if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { - return false - } - mapOfInterface := make(map[interface{}]interface{}, x.Len()) - keys := x.MapKeys() - for _, k := range keys { - mapOfInterface[k.Interface()] = x.MapIndex(k).Interface() - } - m := make(map[interface{}]bool) - for _, val := range mapOfInterface { - if m[val] { - return false - } - m[val] = true - } - return true -} - -func getInterfaceValue(x reflect.Value) interface{} { - if x.Kind() == reflect.Invalid { - return nil - } - return x.Interface() -} - -func isZero(x interface{}) bool { - return x == reflect.Zero(reflect.TypeOf(x)).Interface() -} - -func createError(x reflect.Value, v constraint, message string) error { - return pipeline.NewError(nil, fmt.Sprintf("validation failed: parameter=%s constraint=%s value=%#v details: %s", - v.target, v.name, getInterfaceValue(x), message)) -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_version.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_version.go deleted file mode 100644 index a193925c2..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_version.go +++ /dev/null @@ -1,14 +0,0 @@ -package azblob - -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/0.0.0 azblob/2019-02-02" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "0.0.0" -} diff --git a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_response_helpers.go b/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_response_helpers.go deleted file mode 100644 index 9dcc50634..000000000 --- a/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_response_helpers.go +++ /dev/null @@ -1,242 +0,0 @@ -package azblob - -import ( - "context" - "io" - "net/http" - "time" -) - -// BlobHTTPHeaders contains read/writeable blob properties. -type BlobHTTPHeaders struct { - ContentType string - ContentMD5 []byte - ContentEncoding string - ContentLanguage string - ContentDisposition string - CacheControl string -} - -// NewHTTPHeaders returns the user-modifiable properties for this blob. -func (bgpr BlobGetPropertiesResponse) NewHTTPHeaders() BlobHTTPHeaders { - return BlobHTTPHeaders{ - ContentType: bgpr.ContentType(), - ContentEncoding: bgpr.ContentEncoding(), - ContentLanguage: bgpr.ContentLanguage(), - ContentDisposition: bgpr.ContentDisposition(), - CacheControl: bgpr.CacheControl(), - ContentMD5: bgpr.ContentMD5(), - } -} - -/////////////////////////////////////////////////////////////////////////////// - -// NewHTTPHeaders returns the user-modifiable properties for this blob. -func (dr downloadResponse) NewHTTPHeaders() BlobHTTPHeaders { - return BlobHTTPHeaders{ - ContentType: dr.ContentType(), - ContentEncoding: dr.ContentEncoding(), - ContentLanguage: dr.ContentLanguage(), - ContentDisposition: dr.ContentDisposition(), - CacheControl: dr.CacheControl(), - ContentMD5: dr.ContentMD5(), - } -} - -/////////////////////////////////////////////////////////////////////////////// - -// DownloadResponse wraps AutoRest generated DownloadResponse and helps to provide info for retry. -type DownloadResponse struct { - r *downloadResponse - ctx context.Context - b BlobURL - getInfo HTTPGetterInfo -} - -// Body constructs new RetryReader stream for reading data. If a connection failes -// while reading, it will make additional requests to reestablish a connection and -// continue reading. Specifying a RetryReaderOption's with MaxRetryRequests set to 0 -// (the default), returns the original response body and no retries will be performed. -func (r *DownloadResponse) Body(o RetryReaderOptions) io.ReadCloser { - if o.MaxRetryRequests == 0 { // No additional retries - return r.Response().Body - } - return NewRetryReader(r.ctx, r.Response(), r.getInfo, o, - func(ctx context.Context, getInfo HTTPGetterInfo) (*http.Response, error) { - resp, err := r.b.Download(ctx, getInfo.Offset, getInfo.Count, - BlobAccessConditions{ - ModifiedAccessConditions: ModifiedAccessConditions{IfMatch: getInfo.ETag}, - }, - false) - if err != nil { - return nil, err - } - return resp.Response(), err - }, - ) -} - -// Response returns the raw HTTP response object. -func (r DownloadResponse) Response() *http.Response { - return r.r.Response() -} - -// NewHTTPHeaders returns the user-modifiable properties for this blob. -func (r DownloadResponse) NewHTTPHeaders() BlobHTTPHeaders { - return r.r.NewHTTPHeaders() -} - -// BlobContentMD5 returns the value for header x-ms-blob-content-md5. -func (r DownloadResponse) BlobContentMD5() []byte { - return r.r.BlobContentMD5() -} - -// ContentMD5 returns the value for header Content-MD5. -func (r DownloadResponse) ContentMD5() []byte { - return r.r.ContentMD5() -} - -// StatusCode returns the HTTP status code of the response, e.g. 200. -func (r DownloadResponse) StatusCode() int { - return r.r.StatusCode() -} - -// Status returns the HTTP status message of the response, e.g. "200 OK". -func (r DownloadResponse) Status() string { - return r.r.Status() -} - -// AcceptRanges returns the value for header Accept-Ranges. -func (r DownloadResponse) AcceptRanges() string { - return r.r.AcceptRanges() -} - -// BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count. -func (r DownloadResponse) BlobCommittedBlockCount() int32 { - return r.r.BlobCommittedBlockCount() -} - -// BlobSequenceNumber returns the value for header x-ms-blob-sequence-number. -func (r DownloadResponse) BlobSequenceNumber() int64 { - return r.r.BlobSequenceNumber() -} - -// BlobType returns the value for header x-ms-blob-type. -func (r DownloadResponse) BlobType() BlobType { - return r.r.BlobType() -} - -// CacheControl returns the value for header Cache-Control. -func (r DownloadResponse) CacheControl() string { - return r.r.CacheControl() -} - -// ContentDisposition returns the value for header Content-Disposition. -func (r DownloadResponse) ContentDisposition() string { - return r.r.ContentDisposition() -} - -// ContentEncoding returns the value for header Content-Encoding. -func (r DownloadResponse) ContentEncoding() string { - return r.r.ContentEncoding() -} - -// ContentLanguage returns the value for header Content-Language. -func (r DownloadResponse) ContentLanguage() string { - return r.r.ContentLanguage() -} - -// ContentLength returns the value for header Content-Length. -func (r DownloadResponse) ContentLength() int64 { - return r.r.ContentLength() -} - -// ContentRange returns the value for header Content-Range. -func (r DownloadResponse) ContentRange() string { - return r.r.ContentRange() -} - -// ContentType returns the value for header Content-Type. -func (r DownloadResponse) ContentType() string { - return r.r.ContentType() -} - -// CopyCompletionTime returns the value for header x-ms-copy-completion-time. -func (r DownloadResponse) CopyCompletionTime() time.Time { - return r.r.CopyCompletionTime() -} - -// CopyID returns the value for header x-ms-copy-id. -func (r DownloadResponse) CopyID() string { - return r.r.CopyID() -} - -// CopyProgress returns the value for header x-ms-copy-progress. -func (r DownloadResponse) CopyProgress() string { - return r.r.CopyProgress() -} - -// CopySource returns the value for header x-ms-copy-source. -func (r DownloadResponse) CopySource() string { - return r.r.CopySource() -} - -// CopyStatus returns the value for header x-ms-copy-status. -func (r DownloadResponse) CopyStatus() CopyStatusType { - return r.r.CopyStatus() -} - -// CopyStatusDescription returns the value for header x-ms-copy-status-description. -func (r DownloadResponse) CopyStatusDescription() string { - return r.r.CopyStatusDescription() -} - -// Date returns the value for header Date. -func (r DownloadResponse) Date() time.Time { - return r.r.Date() -} - -// ETag returns the value for header ETag. -func (r DownloadResponse) ETag() ETag { - return r.r.ETag() -} - -// IsServerEncrypted returns the value for header x-ms-server-encrypted. -func (r DownloadResponse) IsServerEncrypted() string { - return r.r.IsServerEncrypted() -} - -// LastModified returns the value for header Last-Modified. -func (r DownloadResponse) LastModified() time.Time { - return r.r.LastModified() -} - -// LeaseDuration returns the value for header x-ms-lease-duration. -func (r DownloadResponse) LeaseDuration() LeaseDurationType { - return r.r.LeaseDuration() -} - -// LeaseState returns the value for header x-ms-lease-state. -func (r DownloadResponse) LeaseState() LeaseStateType { - return r.r.LeaseState() -} - -// LeaseStatus returns the value for header x-ms-lease-status. -func (r DownloadResponse) LeaseStatus() LeaseStatusType { - return r.r.LeaseStatus() -} - -// RequestID returns the value for header x-ms-request-id. -func (r DownloadResponse) RequestID() string { - return r.r.RequestID() -} - -// Version returns the value for header x-ms-version. -func (r DownloadResponse) Version() string { - return r.r.Version() -} - -// NewMetadata returns user-defined key/value pairs. -func (r DownloadResponse) NewMetadata() Metadata { - return r.r.NewMetadata() -} diff --git a/vendor/github.com/Unknwon/goconfig/.gitignore b/vendor/github.com/Unknwon/goconfig/.gitignore deleted file mode 100644 index c81d5b374..000000000 --- a/vendor/github.com/Unknwon/goconfig/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -*.iml -.idea \ No newline at end of file diff --git a/vendor/github.com/Unknwon/goconfig/LICENSE b/vendor/github.com/Unknwon/goconfig/LICENSE deleted file mode 100644 index 8405e89a0..000000000 --- a/vendor/github.com/Unknwon/goconfig/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. \ No newline at end of file diff --git a/vendor/github.com/Unknwon/goconfig/README.md b/vendor/github.com/Unknwon/goconfig/README.md deleted file mode 100644 index 3a2218cb0..000000000 --- a/vendor/github.com/Unknwon/goconfig/README.md +++ /dev/null @@ -1,68 +0,0 @@ -goconfig [![Go Walker](http://gowalker.org/api/v1/badge)](http://gowalker.org/github.com/Unknwon/goconfig) -======== - -[中文文档](README_ZH.md) - -**IMPORTANT** - -- This library is under bug fix only mode, which means no more features will be added. -- I'm continuing working on better Go code with a different library: [ini](https://github.com/go-ini/ini). - -## About - -Package goconfig is a easy-use, comments-support configuration file parser for the Go Programming Language, which provides a structure similar to what you would find on Microsoft Windows INI files. - -The configuration file consists of sections, led by a `[section]` header and followed by `name:value` or `name=value` entries. Note that leading whitespace is removed from values. The optional values can contain format strings which refer to other values in the same section, or values in a special DEFAULT section. Comments are indicated by ";" or "#"; comments may begin anywhere on a single line. - -## Features - -- It simplified operation processes, easy to use and undersatnd; therefore, there are less chances to have errors. -- It uses exactly the same way to access a configuration file as you use Windows APIs, so you don't need to change your code style. -- It supports read recursion sections. -- It supports auto increment of key. -- It supports **READ** and **WRITE** configuration file with comments each section or key which all the other parsers don't support!!!!!!! -- It supports get value through type bool, float64, int, int64 and string, methods that start with "Must" means ignore errors and get zero-value if error occurs, or you can specify a default value. -- It's able to load multiple files to overwrite key values. - -## Installation - - go get github.com/unknwon/goconfig - -## API Documentation - -[Go Walker](http://gowalker.org/github.com/unknwon/goconfig). - -## Example - -Please see [conf.ini](testdata/conf.ini) as an example. - -### Usage - -- Function `LoadConfigFile` load file(s) depends on your situation, and return a variable with type `ConfigFile`. -- `GetValue` gives basic functionality of getting a value of given section and key. -- Methods like `Bool`, `Int`, `Int64` return corresponding type of values. -- Methods start with `Must` return corresponding type of values and returns zero-value of given type if something goes wrong. -- `SetValue` sets value to given section and key, and inserts somewhere if it does not exist. -- `DeleteKey` deletes by given section and key. -- Finally, `SaveConfigFile` saves your configuration to local file system. -- Use method `Reload` in case someone else modified your file(s). -- Methods contains `Comment` help you manipulate comments. -- `LoadFromReader` allows loading data without an intermediate file. -- `SaveConfigData` added, which writes configuration to an arbitrary writer. -- `ReloadData` allows to reload data from memory. - -Note that you cannot mix in-memory configuration with on-disk configuration. - -## More Information - -- All characters are CASE SENSITIVE, BE CAREFUL! - -## Credits - -- [goconf](http://code.google.com/p/goconf/) -- [robfig/config](https://github.com/robfig/config) -- [Delete an item from a slice](https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/lYz8ftASMQ0) - -## License - -This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text. diff --git a/vendor/github.com/Unknwon/goconfig/README_ZH.md b/vendor/github.com/Unknwon/goconfig/README_ZH.md deleted file mode 100644 index d5fcbb95b..000000000 --- a/vendor/github.com/Unknwon/goconfig/README_ZH.md +++ /dev/null @@ -1,64 +0,0 @@ -goconfig [![Build Status](https://drone.io/github.com/Unknwon/goconfig/status.png)](https://drone.io/github.com/Unknwon/goconfig/latest) [![Go Walker](http://gowalker.org/api/v1/badge)](http://gowalker.org/github.com/Unknwon/goconfig) -======== - -本库已被 [《Go名库讲解》](https://github.com/Unknwon/go-rock-libraries-showcases/tree/master/lectures/01-goconfig) 收录讲解,欢迎前往学习如何使用! - -编码规范:基于 [Go 编码规范](https://github.com/Unknwon/go-code-convention) - -## 关于 - -包 goconfig 是一个易于使用,支持注释的 Go 语言配置文件解析器,该文件的书写格式和 Windows 下的 INI 文件一样。 - -配置文件由形为 `[section]` 的节构成,内部使用 `name:value` 或 `name=value` 这样的键值对;每行开头和尾部的空白符号都将被忽略;如果未指定任何节,则会默认放入名为 `DEFAULT` 的节当中;可以使用 “;” 或 “#” 来作为注释的开头,并可以放置于任意的单独一行中。 - -## 特性 - -- 简化流程,易于理解,更少出错。 -- 提供与 Windows API 一模一样的操作方式。 -- 支持读取递归节。 -- 支持自增键名。 -- 支持对注释的 **读** 和 **写** 操作,其它所有解析器都不支持!!!! -- 可以直接返回 bool, float64, int, int64 和 string 类型的值,如果使用 “Must” 开头的方法,则一定会返回这个类型的一个值而不返回错误,如果错误发生则会返回零值。 -- 支持加载多个文件来重写值。 - -## 安装 - - go get github.com/Unknwon/goconfig - -或 - - gopm get github.com/Unknwon/goconfig - - -## API 文档 - -[Go Walker](http://gowalker.org/github.com/Unknwon/goconfig). - -## 示例 - -请查看 [conf.ini](testdata/conf.ini) 文件作为使用示例。 - -### 用例 - -- 函数 `LoadConfigFile` 加载一个或多个文件,然后返回一个类型为 `ConfigFile` 的变量。 -- `GetValue` 可以简单的获取某个值。 -- 像 `Bool`、`Int`、`Int64` 这样的方法会直接返回指定类型的值。 -- 以 `Must` 开头的方法不会返回错误,但当错误发生时会返回零值。 -- `SetValue` 可以设置某个值。 -- `DeleteKey` 可以删除某个键。 -- 最后,`SaveConfigFile` 可以保持您的配置到本地文件系统。 -- 使用方法 `Reload` 可以重载您的配置文件。 - -## 更多信息 - -- 所有字符都是大小写敏感的! - -## 参考信息 - -- [goconf](http://code.google.com/p/goconf/) -- [robfig/config](https://github.com/robfig/config) -- [Delete an item from a slice](https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/lYz8ftASMQ0) - -## 授权许可 - -本项目采用 Apache v2 开源授权许可证,完整的授权说明已放置在 [LICENSE](LICENSE) 文件中。 diff --git a/vendor/github.com/Unknwon/goconfig/conf.go b/vendor/github.com/Unknwon/goconfig/conf.go deleted file mode 100644 index dc19803e9..000000000 --- a/vendor/github.com/Unknwon/goconfig/conf.go +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright 2013 Unknwon -// -// 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 goconfig is a fully functional and comments-support configuration file(.ini) parser. -package goconfig - -import ( - "fmt" - "regexp" - "runtime" - "strconv" - "strings" - "sync" -) - -const ( - // Default section name. - DEFAULT_SECTION = "DEFAULT" - // Maximum allowed depth when recursively substituing variable names. - _DEPTH_VALUES = 200 -) - -type ParseError int - -const ( - ERR_SECTION_NOT_FOUND ParseError = iota + 1 - ERR_KEY_NOT_FOUND - ERR_BLANK_SECTION_NAME - ERR_COULD_NOT_PARSE -) - -var LineBreak = "\n" - -// Variable regexp pattern: %(variable)s -var varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`) - -func init() { - if runtime.GOOS == "windows" { - LineBreak = "\r\n" - } -} - -// A ConfigFile represents a INI formar configuration file. -type ConfigFile struct { - lock sync.RWMutex // Go map is not safe. - fileNames []string // Support mutil-files. - data map[string]map[string]string // Section -> key : value - - // Lists can keep sections and keys in order. - sectionList []string // Section name list. - keyList map[string][]string // Section -> Key name list - - sectionComments map[string]string // Sections comments. - keyComments map[string]map[string]string // Keys comments. - BlockMode bool // Indicates whether use lock or not. -} - -// newConfigFile creates an empty configuration representation. -func newConfigFile(fileNames []string) *ConfigFile { - c := new(ConfigFile) - c.fileNames = fileNames - c.data = make(map[string]map[string]string) - c.keyList = make(map[string][]string) - c.sectionComments = make(map[string]string) - c.keyComments = make(map[string]map[string]string) - c.BlockMode = true - return c -} - -// SetValue adds a new section-key-value to the configuration. -// It returns true if the key and value were inserted, -// or returns false if the value was overwritten. -// If the section does not exist in advance, it will be created. -func (c *ConfigFile) SetValue(section, key, value string) bool { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - if len(key) == 0 { - return false - } - - if c.BlockMode { - c.lock.Lock() - defer c.lock.Unlock() - } - - // Check if section exists. - if _, ok := c.data[section]; !ok { - // Execute add operation. - c.data[section] = make(map[string]string) - // Append section to list. - c.sectionList = append(c.sectionList, section) - } - - // Check if key exists. - _, ok := c.data[section][key] - c.data[section][key] = value - if !ok { - // If not exists, append to key list. - c.keyList[section] = append(c.keyList[section], key) - } - return !ok -} - -// DeleteKey deletes the key in given section. -// It returns true if the key was deleted, -// or returns false if the section or key didn't exist. -func (c *ConfigFile) DeleteKey(section, key string) bool { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - if c.BlockMode { - c.lock.Lock() - defer c.lock.Unlock() - } - - // Check if section exists. - if _, ok := c.data[section]; !ok { - return false - } - - // Check if key exists. - if _, ok := c.data[section][key]; ok { - delete(c.data[section], key) - // Remove comments of key. - c.SetKeyComments(section, key, "") - // Get index of key. - i := 0 - for _, keyName := range c.keyList[section] { - if keyName == key { - break - } - i++ - } - // Remove from key list. - c.keyList[section] = append(c.keyList[section][:i], c.keyList[section][i+1:]...) - return true - } - return false -} - -// GetValue returns the value of key available in the given section. -// If the value needs to be unfolded -// (see e.g. %(google)s example in the GoConfig_test.go), -// then String does this unfolding automatically, up to -// _DEPTH_VALUES number of iterations. -// It returns an error and empty string value if the section does not exist, -// or key does not exist in DEFAULT and current sections. -func (c *ConfigFile) GetValue(section, key string) (string, error) { - if c.BlockMode { - c.lock.RLock() - defer c.lock.RUnlock() - } - - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - // Check if section exists - if _, ok := c.data[section]; !ok { - // Section does not exist. - return "", getError{ERR_SECTION_NOT_FOUND, section} - } - - // Section exists. - // Check if key exists or empty value. - value, ok := c.data[section][key] - if !ok { - // Check if it is a sub-section. - if i := strings.LastIndex(section, "."); i > -1 { - return c.GetValue(section[:i], key) - } - - // Return empty value. - return "", getError{ERR_KEY_NOT_FOUND, key} - } - - // Key exists. - var i int - for i = 0; i < _DEPTH_VALUES; i++ { - vr := varPattern.FindString(value) - if len(vr) == 0 { - break - } - - // Take off leading '%(' and trailing ')s'. - noption := strings.TrimLeft(vr, "%(") - noption = strings.TrimRight(noption, ")s") - - // Search variable in default section. - nvalue, err := c.GetValue(DEFAULT_SECTION, noption) - if err != nil && section != DEFAULT_SECTION { - // Search in the same section. - if _, ok := c.data[section][noption]; ok { - nvalue = c.data[section][noption] - } - } - - // Substitute by new value and take off leading '%(' and trailing ')s'. - value = strings.Replace(value, vr, nvalue, -1) - } - return value, nil -} - -// Bool returns bool type value. -func (c *ConfigFile) Bool(section, key string) (bool, error) { - value, err := c.GetValue(section, key) - if err != nil { - return false, err - } - return strconv.ParseBool(value) -} - -// Float64 returns float64 type value. -func (c *ConfigFile) Float64(section, key string) (float64, error) { - value, err := c.GetValue(section, key) - if err != nil { - return 0.0, err - } - return strconv.ParseFloat(value, 64) -} - -// Int returns int type value. -func (c *ConfigFile) Int(section, key string) (int, error) { - value, err := c.GetValue(section, key) - if err != nil { - return 0, err - } - return strconv.Atoi(value) -} - -// Int64 returns int64 type value. -func (c *ConfigFile) Int64(section, key string) (int64, error) { - value, err := c.GetValue(section, key) - if err != nil { - return 0, err - } - return strconv.ParseInt(value, 10, 64) -} - -// MustValue always returns value without error. -// It returns empty string if error occurs, or the default value if given. -func (c *ConfigFile) MustValue(section, key string, defaultVal ...string) string { - val, err := c.GetValue(section, key) - if len(defaultVal) > 0 && (err != nil || len(val) == 0) { - return defaultVal[0] - } - return val -} - -// MustValueSet always returns value without error, -// It returns empty string if error occurs, or the default value if given, -// and a bool value indicates whether default value is returned. -func (c *ConfigFile) MustValueSet(section, key string, defaultVal ...string) (string, bool) { - val, err := c.GetValue(section, key) - if len(defaultVal) > 0 && (err != nil || len(val) == 0) { - c.SetValue(section, key, defaultVal[0]) - return defaultVal[0], true - } - return val, false -} - -// MustValueRange always returns value without error, -// it returns default value if error occurs or doesn't fit into range. -func (c *ConfigFile) MustValueRange(section, key, defaultVal string, candidates []string) string { - val, err := c.GetValue(section, key) - if err != nil || len(val) == 0 { - return defaultVal - } - - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// MustValueArray always returns value array without error, -// it returns empty array if error occurs, split by delimiter otherwise. -func (c *ConfigFile) MustValueArray(section, key, delim string) []string { - val, err := c.GetValue(section, key) - if err != nil || len(val) == 0 { - return []string{} - } - - vals := strings.Split(val, delim) - for i := range vals { - vals[i] = strings.TrimSpace(vals[i]) - } - return vals -} - -// MustBool always returns value without error, -// it returns false if error occurs. -func (c *ConfigFile) MustBool(section, key string, defaultVal ...bool) bool { - val, err := c.Bool(section, key) - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return val -} - -// MustFloat64 always returns value without error, -// it returns 0.0 if error occurs. -func (c *ConfigFile) MustFloat64(section, key string, defaultVal ...float64) float64 { - value, err := c.Float64(section, key) - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return value -} - -// MustInt always returns value without error, -// it returns 0 if error occurs. -func (c *ConfigFile) MustInt(section, key string, defaultVal ...int) int { - value, err := c.Int(section, key) - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return value -} - -// MustInt64 always returns value without error, -// it returns 0 if error occurs. -func (c *ConfigFile) MustInt64(section, key string, defaultVal ...int64) int64 { - value, err := c.Int64(section, key) - if len(defaultVal) > 0 && err != nil { - return defaultVal[0] - } - return value -} - -// GetSectionList returns the list of all sections -// in the same order in the file. -func (c *ConfigFile) GetSectionList() []string { - list := make([]string, len(c.sectionList)) - copy(list, c.sectionList) - return list -} - -// GetKeyList returns the list of all keys in give section -// in the same order in the file. -// It returns nil if given section does not exist. -func (c *ConfigFile) GetKeyList(section string) []string { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - if c.BlockMode { - c.lock.RLock() - defer c.lock.RUnlock() - } - - // Check if section exists. - if _, ok := c.data[section]; !ok { - return nil - } - - // Non-default section has a blank key as section keeper. - list := make([]string, 0, len(c.keyList[section])) - for _, key := range c.keyList[section] { - if key != " " { - list = append(list, key) - } - } - return list -} - -// DeleteSection deletes the entire section by given name. -// It returns true if the section was deleted, and false if the section didn't exist. -func (c *ConfigFile) DeleteSection(section string) bool { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - if c.BlockMode { - c.lock.Lock() - defer c.lock.Unlock() - } - - // Check if section exists. - if _, ok := c.data[section]; !ok { - return false - } - - delete(c.data, section) - // Remove comments of section. - c.SetSectionComments(section, "") - // Get index of section. - i := 0 - for _, secName := range c.sectionList { - if secName == section { - break - } - i++ - } - // Remove from section and key list. - c.sectionList = append(c.sectionList[:i], c.sectionList[i+1:]...) - delete(c.keyList, section) - return true -} - -// GetSection returns key-value pairs in given section. -// If section does not exist, returns nil and error. -func (c *ConfigFile) GetSection(section string) (map[string]string, error) { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - if c.BlockMode { - c.lock.Lock() - defer c.lock.Unlock() - } - - // Check if section exists. - if _, ok := c.data[section]; !ok { - // Section does not exist. - return nil, getError{ERR_SECTION_NOT_FOUND, section} - } - - // Remove pre-defined key. - secMap := c.data[section] - delete(c.data[section], " ") - - // Section exists. - return secMap, nil -} - -// SetSectionComments adds new section comments to the configuration. -// If comments are empty(0 length), it will remove its section comments! -// It returns true if the comments were inserted or removed, -// or returns false if the comments were overwritten. -func (c *ConfigFile) SetSectionComments(section, comments string) bool { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - if len(comments) == 0 { - if _, ok := c.sectionComments[section]; ok { - delete(c.sectionComments, section) - } - - // Not exists can be seen as remove. - return true - } - - // Check if comments exists. - _, ok := c.sectionComments[section] - if comments[0] != '#' && comments[0] != ';' { - comments = "; " + comments - } - c.sectionComments[section] = comments - return !ok -} - -// SetKeyComments adds new section-key comments to the configuration. -// If comments are empty(0 length), it will remove its section-key comments! -// It returns true if the comments were inserted or removed, -// or returns false if the comments were overwritten. -// If the section does not exist in advance, it is created. -func (c *ConfigFile) SetKeyComments(section, key, comments string) bool { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - // Check if section exists. - if _, ok := c.keyComments[section]; ok { - if len(comments) == 0 { - if _, ok := c.keyComments[section][key]; ok { - delete(c.keyComments[section], key) - } - - // Not exists can be seen as remove. - return true - } - } else { - if len(comments) == 0 { - // Not exists can be seen as remove. - return true - } else { - // Execute add operation. - c.keyComments[section] = make(map[string]string) - } - } - - // Check if key exists. - _, ok := c.keyComments[section][key] - if comments[0] != '#' && comments[0] != ';' { - comments = "; " + comments - } - c.keyComments[section][key] = comments - return !ok -} - -// GetSectionComments returns the comments in the given section. -// It returns an empty string(0 length) if the comments do not exist. -func (c *ConfigFile) GetSectionComments(section string) (comments string) { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - return c.sectionComments[section] -} - -// GetKeyComments returns the comments of key in the given section. -// It returns an empty string(0 length) if the comments do not exist. -func (c *ConfigFile) GetKeyComments(section, key string) (comments string) { - // Blank section name represents DEFAULT section. - if len(section) == 0 { - section = DEFAULT_SECTION - } - - if _, ok := c.keyComments[section]; ok { - return c.keyComments[section][key] - } - return "" -} - -// getError occurs when get value in configuration file with invalid parameter. -type getError struct { - Reason ParseError - Name string -} - -// Error implements Error interface. -func (err getError) Error() string { - switch err.Reason { - case ERR_SECTION_NOT_FOUND: - return fmt.Sprintf("section '%s' not found", err.Name) - case ERR_KEY_NOT_FOUND: - return fmt.Sprintf("key '%s' not found", err.Name) - } - return "invalid get error" -} diff --git a/vendor/github.com/Unknwon/goconfig/read.go b/vendor/github.com/Unknwon/goconfig/read.go deleted file mode 100644 index 37990fb69..000000000 --- a/vendor/github.com/Unknwon/goconfig/read.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2013 Unknwon -// -// 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 goconfig - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "path" - "strings" - "time" -) - -// Read reads an io.Reader and returns a configuration representation. -// This representation can be queried with GetValue. -func (c *ConfigFile) read(reader io.Reader) (err error) { - buf := bufio.NewReader(reader) - - // Handle BOM-UTF8. - // http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding - mask, err := buf.Peek(3) - if err == nil && len(mask) >= 3 && - mask[0] == 239 && mask[1] == 187 && mask[2] == 191 { - buf.Read(mask) - } - - count := 1 // Counter for auto increment. - // Current section name. - section := DEFAULT_SECTION - var comments string - // Parse line-by-line - for { - line, err := buf.ReadString('\n') - line = strings.TrimSpace(line) - lineLengh := len(line) //[SWH|+] - if err != nil { - if err != io.EOF { - return err - } - - // Reached end of file, if nothing to read then break, - // otherwise handle the last line. - if lineLengh == 0 { - break - } - } - - // switch written for readability (not performance) - switch { - case lineLengh == 0: // Empty line - continue - case line[0] == '#' || line[0] == ';': // Comment - // Append comments - if len(comments) == 0 { - comments = line - } else { - comments += LineBreak + line - } - continue - case line[0] == '[' && line[lineLengh-1] == ']': // New section. - // Get section name. - section = strings.TrimSpace(line[1 : lineLengh-1]) - // Set section comments and empty if it has comments. - if len(comments) > 0 { - c.SetSectionComments(section, comments) - comments = "" - } - // Make section exist even though it does not have any key. - c.SetValue(section, " ", " ") - // Reset counter. - count = 1 - continue - case section == "": // No section defined so far - return readError{ERR_BLANK_SECTION_NAME, line} - default: // Other alternatives - var ( - i int - keyQuote string - key string - valQuote string - value string - ) - //[SWH|+]:支持引号包围起来的字串 - if line[0] == '"' { - if lineLengh >= 6 && line[0:3] == `"""` { - keyQuote = `"""` - } else { - keyQuote = `"` - } - } else if line[0] == '`' { - keyQuote = "`" - } - if keyQuote != "" { - qLen := len(keyQuote) - pos := strings.Index(line[qLen:], keyQuote) - if pos == -1 { - return readError{ERR_COULD_NOT_PARSE, line} - } - pos = pos + qLen - i = strings.IndexAny(line[pos:], "=:") - if i <= 0 { - return readError{ERR_COULD_NOT_PARSE, line} - } - i = i + pos - key = line[qLen:pos] //保留引号内的两端的空格 - } else { - i = strings.IndexAny(line, "=:") - if i <= 0 { - return readError{ERR_COULD_NOT_PARSE, line} - } - key = strings.TrimSpace(line[0:i]) - } - //[SWH|+]; - - // Check if it needs auto increment. - if key == "-" { - key = "#" + fmt.Sprint(count) - count++ - } - - //[SWH|+]:支持引号包围起来的字串 - lineRight := strings.TrimSpace(line[i+1:]) - lineRightLength := len(lineRight) - firstChar := "" - if lineRightLength >= 2 { - firstChar = lineRight[0:1] - } - if firstChar == "`" { - valQuote = "`" - } else if lineRightLength >= 6 && lineRight[0:3] == `"""` { - valQuote = `"""` - } - if valQuote != "" { - qLen := len(valQuote) - pos := strings.LastIndex(lineRight[qLen:], valQuote) - if pos == -1 { - return readError{ERR_COULD_NOT_PARSE, line} - } - pos = pos + qLen - value = lineRight[qLen:pos] - } else { - value = strings.TrimSpace(lineRight[0:]) - } - //[SWH|+]; - - c.SetValue(section, key, value) - // Set key comments and empty if it has comments. - if len(comments) > 0 { - c.SetKeyComments(section, key, comments) - comments = "" - } - } - - // Reached end of file. - if err == io.EOF { - break - } - } - return nil -} - -// LoadFromData accepts raw data directly from memory -// and returns a new configuration representation. -// Note that the configuration is written to the system -// temporary folder, so your file should not contain -// sensitive information. -func LoadFromData(data []byte) (c *ConfigFile, err error) { - // Save memory data to temporary file to support further operations. - tmpName := path.Join(os.TempDir(), "goconfig", fmt.Sprintf("%d", time.Now().Nanosecond())) - if err = os.MkdirAll(path.Dir(tmpName), os.ModePerm); err != nil { - return nil, err - } - if err = ioutil.WriteFile(tmpName, data, 0655); err != nil { - return nil, err - } - - c = newConfigFile([]string{tmpName}) - err = c.read(bytes.NewBuffer(data)) - return c, err -} - -// LoadFromReader accepts raw data directly from a reader -// and returns a new configuration representation. -// You must use ReloadData to reload. -// You cannot append files a configfile read this way. -func LoadFromReader(in io.Reader) (c *ConfigFile, err error) { - c = newConfigFile([]string{""}) - err = c.read(in) - return c, err -} - -func (c *ConfigFile) loadFile(fileName string) (err error) { - f, err := os.Open(fileName) - if err != nil { - return err - } - defer f.Close() - - return c.read(f) -} - -// LoadConfigFile reads a file and returns a new configuration representation. -// This representation can be queried with GetValue. -func LoadConfigFile(fileName string, moreFiles ...string) (c *ConfigFile, err error) { - // Append files' name together. - fileNames := make([]string, 1, len(moreFiles)+1) - fileNames[0] = fileName - if len(moreFiles) > 0 { - fileNames = append(fileNames, moreFiles...) - } - - c = newConfigFile(fileNames) - - for _, name := range fileNames { - if err = c.loadFile(name); err != nil { - return nil, err - } - } - - return c, nil -} - -// Reload reloads configuration file in case it has changes. -func (c *ConfigFile) Reload() (err error) { - var cfg *ConfigFile - if len(c.fileNames) == 1 { - if c.fileNames[0] == "" { - return fmt.Errorf("file opened from in-memory data, use ReloadData to reload") - } - cfg, err = LoadConfigFile(c.fileNames[0]) - } else { - cfg, err = LoadConfigFile(c.fileNames[0], c.fileNames[1:]...) - } - - if err == nil { - *c = *cfg - } - return err -} - -// ReloadData reloads configuration file from memory -func (c *ConfigFile) ReloadData(in io.Reader) (err error) { - var cfg *ConfigFile - if len(c.fileNames) != 1 { - return fmt.Errorf("Multiple files loaded, unable to mix in-memory and file data") - } - - cfg, err = LoadFromReader(in) - if err == nil { - *c = *cfg - } - return err -} - -// AppendFiles appends more files to ConfigFile and reload automatically. -func (c *ConfigFile) AppendFiles(files ...string) error { - if len(c.fileNames) == 1 && c.fileNames[0] == "" { - return fmt.Errorf("Cannot append file data to in-memory data") - } - c.fileNames = append(c.fileNames, files...) - return c.Reload() -} - -// readError occurs when read configuration file with wrong format. -type readError struct { - Reason ParseError - Content string // Line content -} - -// Error implement Error interface. -func (err readError) Error() string { - switch err.Reason { - case ERR_BLANK_SECTION_NAME: - return "empty section name not allowed" - case ERR_COULD_NOT_PARSE: - return fmt.Sprintf("could not parse line: %s", string(err.Content)) - } - return "invalid read error" -} diff --git a/vendor/github.com/Unknwon/goconfig/write.go b/vendor/github.com/Unknwon/goconfig/write.go deleted file mode 100644 index af36d1ad8..000000000 --- a/vendor/github.com/Unknwon/goconfig/write.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2013 Unknwon -// -// 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 goconfig - -import ( - "bytes" - "io" - "os" - "strings" -) - -// Write spaces around "=" to look better. -var PrettyFormat = true - -// SaveConfigData writes configuration to a writer -func SaveConfigData(c *ConfigFile, out io.Writer) (err error) { - equalSign := "=" - if PrettyFormat { - equalSign = " = " - } - - buf := bytes.NewBuffer(nil) - for _, section := range c.sectionList { - // Write section comments. - if len(c.GetSectionComments(section)) > 0 { - if _, err = buf.WriteString(c.GetSectionComments(section) + LineBreak); err != nil { - return err - } - } - - if section != DEFAULT_SECTION { - // Write section name. - if _, err = buf.WriteString("[" + section + "]" + LineBreak); err != nil { - return err - } - } - - for _, key := range c.keyList[section] { - if key != " " { - // Write key comments. - if len(c.GetKeyComments(section, key)) > 0 { - if _, err = buf.WriteString(c.GetKeyComments(section, key) + LineBreak); err != nil { - return err - } - } - - keyName := key - // Check if it's auto increment. - if keyName[0] == '#' { - keyName = "-" - } - //[SWH|+]:支持键名包含等号和冒号 - if strings.Contains(keyName, `=`) || strings.Contains(keyName, `:`) { - if strings.Contains(keyName, "`") { - if strings.Contains(keyName, `"`) { - keyName = `"""` + keyName + `"""` - } else { - keyName = `"` + keyName + `"` - } - } else { - keyName = "`" + keyName + "`" - } - } - value := c.data[section][key] - // In case key value contains "`" or "\"". - if strings.Contains(value, "`") { - if strings.Contains(value, `"`) { - value = `"""` + value + `"""` - } else { - value = `"` + value + `"` - } - } - - // Write key and value. - if _, err = buf.WriteString(keyName + equalSign + value + LineBreak); err != nil { - return err - } - } - } - - // Put a line between sections. - if _, err = buf.WriteString(LineBreak); err != nil { - return err - } - } - - if _, err := buf.WriteTo(out); err != nil { - return err - } - return nil -} - -// SaveConfigFile writes configuration file to local file system -func SaveConfigFile(c *ConfigFile, filename string) (err error) { - // Write configuration file by filename. - var f *os.File - if f, err = os.Create(filename); err != nil { - return err - } - - if err := SaveConfigData(c, f); err != nil { - return err - } - return f.Close() -} diff --git a/vendor/github.com/a8m/tree/.gitignore b/vendor/github.com/a8m/tree/.gitignore deleted file mode 100644 index 793bf2ebc..000000000 --- a/vendor/github.com/a8m/tree/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -draft -coverage diff --git a/vendor/github.com/a8m/tree/.travis.yml b/vendor/github.com/a8m/tree/.travis.yml deleted file mode 100644 index 4002db36e..000000000 --- a/vendor/github.com/a8m/tree/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -sudo: false -go: - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - 1.11.x - - tip -matrix: - allow_failures: - - go: tip -install: - - go get -t -v ./... -script: - - go test -v ./... - - ./compileall.sh diff --git a/vendor/github.com/a8m/tree/LICENSE b/vendor/github.com/a8m/tree/LICENSE deleted file mode 100644 index fc36360ae..000000000 --- a/vendor/github.com/a8m/tree/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2015-2017 Ariel Mashraki - -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/a8m/tree/README.md b/vendor/github.com/a8m/tree/README.md deleted file mode 100644 index c79cc8ebc..000000000 --- a/vendor/github.com/a8m/tree/README.md +++ /dev/null @@ -1,43 +0,0 @@ -tree [![Build status][travis-image]][travis-url] [![License][license-image]][license-url] ---- -> An implementation of the [`tree`](http://mama.indstate.edu/users/ice/tree/) command written in Go, that can be used programmatically. - -tree command - -#### Installation: -```sh -$ go get github.com/a8m/tree/cmd/tree -``` - -#### How to use `tree` programmatically ? -You can take a look on [`cmd/tree`](https://github.com/a8m/tree/blob/master/cmd/tree/tree.go), and [s3tree](http://github.com/a8m/s3tree) or see the example below. -```go -import ( - "github.com/a8m/tree" -) - -func main() { - opts := &tree.Options{ - // Fs, and OutFile are required fields. - // fs should implement the tree file-system interface(see: tree.Fs), - // and OutFile should be type io.Writer - Fs: fs, - OutFile: os.Stdout, - // ... - } - inf.New("root-dir") - // Visit all nodes recursively - inf.Visit(opts) - // Print nodes - inf.Print(opts) -} -``` - -### License -MIT - - -[travis-image]: https://img.shields.io/travis/a8m/tree.svg?style=flat-square -[travis-url]: https://travis-ci.org/a8m/tree -[license-image]: http://img.shields.io/npm/l/deep-keys.svg?style=flat-square -[license-url]: LICENSE diff --git a/vendor/github.com/a8m/tree/color.go b/vendor/github.com/a8m/tree/color.go deleted file mode 100644 index 65bdf27dc..000000000 --- a/vendor/github.com/a8m/tree/color.go +++ /dev/null @@ -1,74 +0,0 @@ -package tree - -import ( - "fmt" - "os" - "path/filepath" - "strings" -) - -const Escape = "\x1b" -const ( - Reset int = 0 - // Not used, remove. - Bold int = 1 - Black int = iota + 28 - Red - Green - Yellow - Blue - Magenta - Cyan - White -) - -// ANSIColor -func ANSIColor(node *Node, s string) string { - var style string - var mode = node.Mode() - var ext = filepath.Ext(node.Name()) - switch { - case contains([]string{".bat", ".btm", ".cmd", ".com", ".dll", ".exe"}, ext): - style = "1;32" - case contains([]string{".arj", ".bz2", ".deb", ".gz", ".lzh", ".rpm", - ".tar", ".taz", ".tb2", ".tbz2", ".tbz", ".tgz", ".tz", ".tz2", ".z", - ".zip", ".zoo"}, ext): - style = "1;31" - case contains([]string{".asf", ".avi", ".bmp", ".flac", ".gif", ".jpg", - "jpeg", ".m2a", ".m2v", ".mov", ".mp3", ".mpeg", ".mpg", ".ogg", ".ppm", - ".rm", ".tga", ".tif", ".wav", ".wmv", - ".xbm", ".xpm"}, ext): - style = "1;35" - case node.IsDir() || mode&os.ModeDir != 0: - style = "1;34" - case mode&os.ModeNamedPipe != 0: - style = "40;33" - case mode&os.ModeSocket != 0: - style = "40;1;35" - case mode&os.ModeDevice != 0 || mode&os.ModeCharDevice != 0: - style = "40;1;33" - case mode&os.ModeSymlink != 0: - if _, err := filepath.EvalSymlinks(node.path); err != nil { - style = "40;1;31" - } else { - style = "1;36" - } - case mode&modeExecute != 0: - style = "1;32" - default: - return s - } - return fmt.Sprintf("%s[%sm%s%s[%dm", Escape, style, s, Escape, Reset) -} - -// case-insensitive contains helper -func contains(slice []string, str string) bool { - for _, val := range slice { - if val == strings.ToLower(str) { - return true - } - } - return false -} - -// TODO: HTMLColor diff --git a/vendor/github.com/a8m/tree/compileall.sh b/vendor/github.com/a8m/tree/compileall.sh deleted file mode 100644 index 1b4a1011b..000000000 --- a/vendor/github.com/a8m/tree/compileall.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -go tool dist list >/dev/null || { - echo 1>&2 "go tool dist list not supported - can't check compile" - exit 0 -} - -failures=0 -while read -r line; do - parts=(${line//\// }) - export GOOS=${parts[0]} - export GOARCH=${parts[1]} - if go tool compile -V >/dev/null 2>&1 ; then - echo Try GOOS=${GOOS} GOARCH=${GOARCH} - if ! go install; then - echo "*** Failed compiling GOOS=${GOOS} GOARCH=${GOARCH}" - failures=$((failures+1)) - fi - else - echo Skipping GOOS=${GOOS} GOARCH=${GOARCH} as not supported - fi -done < <(go tool dist list) - -if [ $failures -ne 0 ]; then - echo "*** $failures compile failures" - exit 1 -fi diff --git a/vendor/github.com/a8m/tree/csort_bsd.go b/vendor/github.com/a8m/tree/csort_bsd.go deleted file mode 100644 index f5895a62b..000000000 --- a/vendor/github.com/a8m/tree/csort_bsd.go +++ /dev/null @@ -1,18 +0,0 @@ -//+build darwin freebsd netbsd - -package tree - -import ( - "os" - "syscall" -) - -func CTimeSort(f1, f2 os.FileInfo) bool { - s1, ok1 := f1.Sys().(*syscall.Stat_t) - s2, ok2 := f2.Sys().(*syscall.Stat_t) - // If this type of node isn't an os node then revert to ModSort - if !ok1 || !ok2 { - return ModSort(f1, f2) - } - return s1.Ctimespec.Sec < s2.Ctimespec.Sec -} diff --git a/vendor/github.com/a8m/tree/csort_generic.go b/vendor/github.com/a8m/tree/csort_generic.go deleted file mode 100644 index 38be9aadb..000000000 --- a/vendor/github.com/a8m/tree/csort_generic.go +++ /dev/null @@ -1,6 +0,0 @@ -//+build !linux,!openbsd,!dragonfly,!android,!solaris,!darwin,!freebsd,!netbsd - -package tree - -// CtimeSort for unsupported OS - just compare ModTime -var CTimeSort = ModSort diff --git a/vendor/github.com/a8m/tree/csort_unix.go b/vendor/github.com/a8m/tree/csort_unix.go deleted file mode 100644 index 6acd09224..000000000 --- a/vendor/github.com/a8m/tree/csort_unix.go +++ /dev/null @@ -1,18 +0,0 @@ -//+build linux openbsd dragonfly android solaris - -package tree - -import ( - "os" - "syscall" -) - -func CTimeSort(f1, f2 os.FileInfo) bool { - s1, ok1 := f1.Sys().(*syscall.Stat_t) - s2, ok2 := f2.Sys().(*syscall.Stat_t) - // If this type of node isn't an os node then revert to ModSort - if !ok1 || !ok2 { - return ModSort(f1, f2) - } - return s1.Ctim.Sec < s2.Ctim.Sec -} diff --git a/vendor/github.com/a8m/tree/modes_bsd.go b/vendor/github.com/a8m/tree/modes_bsd.go deleted file mode 100644 index c97206541..000000000 --- a/vendor/github.com/a8m/tree/modes_bsd.go +++ /dev/null @@ -1,7 +0,0 @@ -//+build dragonfly freebsd openbsd solaris windows - -package tree - -import "syscall" - -const modeExecute = syscall.S_IXUSR diff --git a/vendor/github.com/a8m/tree/modes_unix.go b/vendor/github.com/a8m/tree/modes_unix.go deleted file mode 100644 index 1394bf6b6..000000000 --- a/vendor/github.com/a8m/tree/modes_unix.go +++ /dev/null @@ -1,7 +0,0 @@ -//+build android darwin linux nacl netbsd - -package tree - -import "syscall" - -const modeExecute = syscall.S_IXUSR | syscall.S_IXGRP | syscall.S_IXOTH diff --git a/vendor/github.com/a8m/tree/modes_unsupported.go b/vendor/github.com/a8m/tree/modes_unsupported.go deleted file mode 100644 index 2fe96cb46..000000000 --- a/vendor/github.com/a8m/tree/modes_unsupported.go +++ /dev/null @@ -1,5 +0,0 @@ -//+build !dragonfly,!freebsd,!openbsd,!solaris,!windows,!android,!darwin,!linux,!nacl,!netbsd - -package tree - -const modeExecute = 0 diff --git a/vendor/github.com/a8m/tree/node.go b/vendor/github.com/a8m/tree/node.go deleted file mode 100644 index 4d15e563e..000000000 --- a/vendor/github.com/a8m/tree/node.go +++ /dev/null @@ -1,399 +0,0 @@ -package tree - -import ( - "errors" - "fmt" - "io" - "os" - "os/user" - "path/filepath" - "regexp" - "sort" - "strconv" - "strings" -) - -// Node represent some node in the tree -// contains FileInfo, and its childs -type Node struct { - os.FileInfo - path string - depth int - err error - nodes Nodes - vpaths map[string]bool -} - -// List of nodes -type Nodes []*Node - -// To use this package programmatically, you must implement this -// interface. -// For example: PTAL on 'cmd/tree/tree.go' -type Fs interface { - Stat(path string) (os.FileInfo, error) - ReadDir(path string) ([]string, error) -} - -// Options store the configuration for specific tree. -// Note, that 'Fs', and 'OutFile' are required (OutFile can be os.Stdout). -type Options struct { - Fs Fs - OutFile io.Writer - // List - All bool - DirsOnly bool - FullPath bool - IgnoreCase bool - FollowLink bool - DeepLevel int - Pattern string - IPattern string - // File - ByteSize bool - UnitSize bool - FileMode bool - ShowUid bool - ShowGid bool - LastMod bool - Quotes bool - Inodes bool - Device bool - // Sort - NoSort bool - VerSort bool - ModSort bool - DirSort bool - NameSort bool - SizeSort bool - CTimeSort bool - ReverSort bool - // Graphics - NoIndent bool - Colorize bool -} - -// New get path and create new node(root). -func New(path string) *Node { - return &Node{path: path, vpaths: make(map[string]bool)} -} - -// Visit all files under the given node. -func (node *Node) Visit(opts *Options) (dirs, files int) { - // visited paths - if path, err := filepath.Abs(node.path); err == nil { - path = filepath.Clean(path) - node.vpaths[path] = true - } - // stat - fi, err := opts.Fs.Stat(node.path) - if err != nil { - node.err = err - return - } - node.FileInfo = fi - if !fi.IsDir() { - return 0, 1 - } - // increase dirs only if it's a dir, but not the root. - if node.depth != 0 { - dirs++ - } - // DeepLevel option - if opts.DeepLevel > 0 && opts.DeepLevel <= node.depth { - return - } - names, err := opts.Fs.ReadDir(node.path) - if err != nil { - node.err = err - return - } - node.nodes = make(Nodes, 0) - for _, name := range names { - // "all" option - if !opts.All && strings.HasPrefix(name, ".") { - continue - } - nnode := &Node{ - path: filepath.Join(node.path, name), - depth: node.depth + 1, - vpaths: node.vpaths, - } - d, f := nnode.Visit(opts) - if nnode.err == nil && !nnode.IsDir() { - // "dirs only" option - if opts.DirsOnly { - continue - } - var rePrefix string - if opts.IgnoreCase { - rePrefix = "(?i)" - } - // Pattern matching - if opts.Pattern != "" { - re, err := regexp.Compile(rePrefix + opts.Pattern) - if err == nil && !re.MatchString(name) { - continue - } - } - // IPattern matching - if opts.IPattern != "" { - re, err := regexp.Compile(rePrefix + opts.IPattern) - if err == nil && re.MatchString(name) { - continue - } - } - } - node.nodes = append(node.nodes, nnode) - dirs, files = dirs+d, files+f - } - // Sorting - if !opts.NoSort { - node.sort(opts) - } - return -} - -func (node *Node) sort(opts *Options) { - var fn SortFunc - switch { - case opts.ModSort: - fn = ModSort - case opts.CTimeSort: - fn = CTimeSort - case opts.DirSort: - fn = DirSort - case opts.VerSort: - fn = VerSort - case opts.SizeSort: - fn = SizeSort - case opts.NameSort: - fn = NameSort - default: - fn = NameSort // Default should be sorted, not unsorted. - } - if fn != nil { - if opts.ReverSort { - sort.Sort(sort.Reverse(ByFunc{node.nodes, fn})) - } else { - sort.Sort(ByFunc{node.nodes, fn}) - } - } -} - -// Print nodes based on the given configuration. -func (node *Node) Print(opts *Options) { node.print("", opts) } - -func dirRecursiveSize(opts *Options, node *Node) (size int64, err error) { - if opts.DeepLevel > 0 && node.depth >= opts.DeepLevel { - err = errors.New("Depth too high") - } - - for _, nnode := range node.nodes { - if nnode.err != nil { - err = nnode.err - continue - } - - if !nnode.IsDir() { - size += nnode.Size() - } else { - nsize, e := dirRecursiveSize(opts, nnode) - size += nsize - if e != nil { - err = e - } - } - } - return -} - -func (node *Node) print(indent string, opts *Options) { - if node.err != nil { - err := node.err.Error() - if msgs := strings.Split(err, ": "); len(msgs) > 1 { - err = msgs[1] - } - fmt.Printf("%s [%s]\n", node.path, err) - return - } - if !node.IsDir() { - var props []string - ok, inode, device, uid, gid := getStat(node) - // inodes - if ok && opts.Inodes { - props = append(props, fmt.Sprintf("%d", inode)) - } - // device - if ok && opts.Device { - props = append(props, fmt.Sprintf("%3d", device)) - } - // Mode - if opts.FileMode { - props = append(props, node.Mode().String()) - } - // Owner/Uid - if ok && opts.ShowUid { - uidStr := strconv.Itoa(int(uid)) - if u, err := user.LookupId(uidStr); err != nil { - props = append(props, fmt.Sprintf("%-8s", uidStr)) - } else { - props = append(props, fmt.Sprintf("%-8s", u.Username)) - } - } - // Gorup/Gid - // TODO: support groupname - if ok && opts.ShowGid { - gidStr := strconv.Itoa(int(gid)) - props = append(props, fmt.Sprintf("%-4s", gidStr)) - } - // Size - if opts.ByteSize || opts.UnitSize { - var size string - if opts.UnitSize { - size = fmt.Sprintf("%4s", formatBytes(node.Size())) - } else { - size = fmt.Sprintf("%11d", node.Size()) - } - props = append(props, size) - } - // Last modification - if opts.LastMod { - props = append(props, node.ModTime().Format("Jan 02 15:04")) - } - // Print properties - if len(props) > 0 { - fmt.Fprintf(opts.OutFile, "[%s] ", strings.Join(props, " ")) - } - } else { - var props []string - // Size - if opts.ByteSize || opts.UnitSize { - var size string - rsize, err := dirRecursiveSize(opts, node) - if err != nil && rsize <= 0 { - if opts.UnitSize { - size = "????" - } else { - size = "???????????" - } - } else if opts.UnitSize { - size = fmt.Sprintf("%4s", formatBytes(rsize)) - } else { - size = fmt.Sprintf("%11d", rsize) - } - props = append(props, size) - } - // Print properties - if len(props) > 0 { - fmt.Fprintf(opts.OutFile, "[%s] ", strings.Join(props, " ")) - } - } - // name/path - var name string - if node.depth == 0 || opts.FullPath { - name = node.path - } else { - name = node.Name() - } - // Quotes - if opts.Quotes { - name = fmt.Sprintf("\"%s\"", name) - } - // Colorize - if opts.Colorize { - name = ANSIColor(node, name) - } - // IsSymlink - if node.Mode()&os.ModeSymlink == os.ModeSymlink { - vtarget, err := os.Readlink(node.path) - if err != nil { - vtarget = node.path - } - targetPath, err := filepath.EvalSymlinks(node.path) - if err != nil { - targetPath = vtarget - } - fi, err := opts.Fs.Stat(targetPath) - if opts.Colorize && fi != nil { - vtarget = ANSIColor(&Node{FileInfo: fi, path: vtarget}, vtarget) - } - name = fmt.Sprintf("%s -> %s", name, vtarget) - // Follow symbolic links like directories - if opts.FollowLink { - path, err := filepath.Abs(targetPath) - if err == nil && fi != nil && fi.IsDir() { - if _, ok := node.vpaths[filepath.Clean(path)]; !ok { - inf := &Node{FileInfo: fi, path: targetPath} - inf.vpaths = node.vpaths - inf.Visit(opts) - node.nodes = inf.nodes - } else { - name += " [recursive, not followed]" - } - } - } - } - // Print file details - // the main idea of the print logic came from here: github.com/campoy/tools/tree - fmt.Fprintln(opts.OutFile, name) - add := "│ " - for i, nnode := range node.nodes { - if opts.NoIndent { - add = "" - } else { - if i == len(node.nodes)-1 { - fmt.Fprintf(opts.OutFile, indent+"└── ") - add = " " - } else { - fmt.Fprintf(opts.OutFile, indent+"├── ") - } - } - nnode.print(indent+add, opts) - } -} - -const ( - _ = iota // ignore first value by assigning to blank identifier - KB int64 = 1 << (10 * iota) - MB - GB - TB - PB - EB -) - -// Convert bytes to human readable string. Like a 2 MB, 64.2 KB, 52 B -func formatBytes(i int64) (result string) { - var n float64 - sFmt, eFmt := "%.01f", "" - switch { - case i > EB: - eFmt = "E" - n = float64(i) / float64(EB) - case i > PB: - eFmt = "P" - n = float64(i) / float64(PB) - case i > TB: - eFmt = "T" - n = float64(i) / float64(TB) - case i > GB: - eFmt = "G" - n = float64(i) / float64(GB) - case i > MB: - eFmt = "M" - n = float64(i) / float64(MB) - case i > KB: - eFmt = "K" - n = float64(i) / float64(KB) - default: - sFmt = "%.0f" - n = float64(i) - } - if eFmt != "" && n >= 10 { - sFmt = "%.0f" - } - result = fmt.Sprintf(sFmt+eFmt, n) - result = strings.Trim(result, " ") - return -} diff --git a/vendor/github.com/a8m/tree/sort.go b/vendor/github.com/a8m/tree/sort.go deleted file mode 100644 index 55299935c..000000000 --- a/vendor/github.com/a8m/tree/sort.go +++ /dev/null @@ -1,100 +0,0 @@ -package tree - -import "os" - -func (n Nodes) Len() int { return len(n) } -func (n Nodes) Swap(i, j int) { n[i], n[j] = n[j], n[i] } - -type ByFunc struct { - Nodes - Fn SortFunc -} - -func (b ByFunc) Less(i, j int) bool { - return b.Fn(b.Nodes[i].FileInfo, b.Nodes[j].FileInfo) -} - -type SortFunc func(f1, f2 os.FileInfo) bool - -func ModSort(f1, f2 os.FileInfo) bool { - return f1.ModTime().Before(f2.ModTime()) -} - -func DirSort(f1, f2 os.FileInfo) bool { - return f1.IsDir() && !f2.IsDir() -} - -func SizeSort(f1, f2 os.FileInfo) bool { - return f1.Size() < f2.Size() -} - -func NameSort(f1, f2 os.FileInfo) bool { - return f1.Name() < f2.Name() -} - -func VerSort(f1, f2 os.FileInfo) bool { - return NaturalLess(f1.Name(), f2.Name()) -} - -func isdigit(b byte) bool { return '0' <= b && b <= '9' } - -// NaturalLess compares two strings using natural ordering. This means that e.g. -// "abc2" < "abc12". -// -// Non-digit sequences and numbers are compared separately. The former are -// compared bytewise, while the latter are compared numerically (except that -// the number of leading zeros is used as a tie-breaker, so e.g. "2" < "02") -// -// Limitation: only ASCII digits (0-9) are considered. -// Code taken from: -// https://github.com/fvbommel/util/blob/master/sortorder/natsort.go -func NaturalLess(str1, str2 string) bool { - idx1, idx2 := 0, 0 - for idx1 < len(str1) && idx2 < len(str2) { - c1, c2 := str1[idx1], str2[idx2] - dig1, dig2 := isdigit(c1), isdigit(c2) - switch { - case dig1 != dig2: // Digits before other characters. - return dig1 // True if LHS is a digit, false if the RHS is one. - case !dig1: // && !dig2, because dig1 == dig2 - // UTF-8 compares bytewise-lexicographically, no need to decode - // codepoints. - if c1 != c2 { - return c1 < c2 - } - idx1++ - idx2++ - default: // Digits - // Eat zeros. - for ; idx1 < len(str1) && str1[idx1] == '0'; idx1++ { - } - for ; idx2 < len(str2) && str2[idx2] == '0'; idx2++ { - } - // Eat all digits. - nonZero1, nonZero2 := idx1, idx2 - for ; idx1 < len(str1) && isdigit(str1[idx1]); idx1++ { - } - for ; idx2 < len(str2) && isdigit(str2[idx2]); idx2++ { - } - // If lengths of numbers with non-zero prefix differ, the shorter - // one is less. - if len1, len2 := idx1-nonZero1, idx2-nonZero2; len1 != len2 { - return len1 < len2 - } - // If they're not equal, string comparison is correct. - if nr1, nr2 := str1[nonZero1:idx1], str2[nonZero2:idx2]; nr1 != nr2 { - return nr1 < nr2 - } - // Otherwise, the one with less zeros is less. - // Because everything up to the number is equal, comparing the index - // after the zeros is sufficient. - if nonZero1 != nonZero2 { - return nonZero1 < nonZero2 - } - } - // They're identical so far, so continue comparing. - } - // So far they are identical. At least one is ended. If the other continues, - // it sorts last. - return len(str1) < len(str2) -} diff --git a/vendor/github.com/a8m/tree/stat_unix.go b/vendor/github.com/a8m/tree/stat_unix.go deleted file mode 100644 index 5ed7b0a46..000000000 --- a/vendor/github.com/a8m/tree/stat_unix.go +++ /dev/null @@ -1,20 +0,0 @@ -//+build !plan9,!windows - -package tree - -import ( - "os" - "syscall" -) - -func getStat(fi os.FileInfo) (ok bool, inode, device, uid, gid uint64) { - sys := fi.Sys() - if sys == nil { - return false, 0, 0, 0, 0 - } - stat, ok := sys.(*syscall.Stat_t) - if !ok { - return false, 0, 0, 0, 0 - } - return true, uint64(stat.Ino), uint64(stat.Dev), uint64(stat.Uid), uint64(stat.Gid) -} diff --git a/vendor/github.com/a8m/tree/stat_unsupported.go b/vendor/github.com/a8m/tree/stat_unsupported.go deleted file mode 100644 index b37407daf..000000000 --- a/vendor/github.com/a8m/tree/stat_unsupported.go +++ /dev/null @@ -1,9 +0,0 @@ -//+build plan9 windows - -package tree - -import "os" - -func getStat(fi os.FileInfo) (ok bool, inode, device, uid, gid uint64) { - return false, 0, 0, 0, 0 -} diff --git a/vendor/github.com/aalpar/deheap/LICENSE.txt b/vendor/github.com/aalpar/deheap/LICENSE.txt deleted file mode 100644 index d8ef07fed..000000000 --- a/vendor/github.com/aalpar/deheap/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 2019 Aaron H. Alpar - -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/aalpar/deheap/README.md b/vendor/github.com/aalpar/deheap/README.md deleted file mode 100644 index a3a24f0ca..000000000 --- a/vendor/github.com/aalpar/deheap/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# deheap - -Package deheap provides the implementation of a doubly ended heap. -Doubly ended heaps are heaps with two sides, a min side and a max side. -Like normal single-sided heaps, elements can be pushed onto and pulled -off of a deheap. deheaps have an additional `Pop` function, `PopMax`, that -returns elements from the opposite side of the ordering. - -This implementation has emphasized compatibility with existing libraries -in the sort and heap packages. - -Performace of the deheap functions should be very close to the -performance of the functions of the heap library - diff --git a/vendor/github.com/aalpar/deheap/deheap.go b/vendor/github.com/aalpar/deheap/deheap.go deleted file mode 100644 index 6f53f6fea..000000000 --- a/vendor/github.com/aalpar/deheap/deheap.go +++ /dev/null @@ -1,228 +0,0 @@ -// -// Copyright 2019 Aaron H. Alpar -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files -// (the "Software"), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -// -// Package deheap provides the implementation of a doubly ended heap. -// Doubly ended heaps are heaps with two sides, a min side and a max side. -// Like normal single-sided heaps, elements can be pushed onto and pulled -// off of a deheap. deheaps have an additional Pop function, PopMax, that -// returns elements from the opposite side of the ordering. -// -// This implementation has emphasized compatibility with existing libraries -// in the sort and heap packages. -// -// Performace of the deheap functions should be very close to the -// performance of the functions of the heap library -// -package deheap - -import ( - "container/heap" - "math/bits" -) - -func hparent(i int) int { - return (i - 1) / 2 -} - -func hlchild(i int) int { - return (i * 2) + 1 -} - -func parent(i int) int { - return ((i + 1) / 4) - 1 -} - -func lchild(i int) int { - return ((i + 1 ) * 4) - 1 -} - -func level(i int) int { - return bits.Len(uint(i)+1) - 1 -} - -func isMinHeap(i int) bool { - return level(i) % 2 == 0 -} - -func min4(h heap.Interface, l int, min bool, i int) int { - q := i - i++ - if i >= l { - return q - } - if min == h.Less(i, q) { - q = i - } - i++ - if i >= l { - return q - } - if min == h.Less(i, q) { - q = i - } - i++ - if i >= l { - return q - } - if min == h.Less(i, q) { - q = i - } - return q -} - -// min2 -func min2(h heap.Interface, l int, min bool, i int) int { - if i+1 >= l { - return i - } - if min != h.Less(i+1, i) { - return i - } - return i + 1 -} - -// min3 -func min3(h heap.Interface, l int, min bool, i, j, k int) int { - q := i - if j < l && h.Less(j, q) == min { - q = j - } - if k < l && h.Less(k, q) == min { - q = k - } - return q -} - -// bubbledown -func bubbledown(h heap.Interface, l int, min bool, i int) (q int, r int) { - q = i - r = i - for { - // find min of children - j := min2(h, l, min, hlchild(i)) - if j >= l { - break - } - // find min of grandchildren - k := min4(h, l, min, lchild(i)) - // swap of less than the element at i - v := min3(h, l, min, i, j, k) - if v == i || v >= l { - break - } - // v == k - q = v - h.Swap(v, i) - if v == j { - break - } - p := hparent(v) - if h.Less(p, v) == min { - h.Swap(p, v) - r = p - } - i = v - } - return q, r -} - -// bubbleup -func bubbleup(h heap.Interface, min bool, i int) (q bool) { - if i < 0 { - return false - } - j := parent(i) - for j >= 0 && min == h.Less(i, j) { - q = true - h.Swap(i, j) - i = j - j = parent(i) - } - min = !min - j = hparent(i) - for j >= 0 && min == h.Less(i, j) { - q = true - h.Swap(i, j) - i = j - j = parent(i) - } - return q -} - -// Pop the smallest value off the heap. See heap.Pop(). -// Time complexity is O(log n), where n = h.Len() -func Pop(h heap.Interface) interface{} { - l := h.Len()-1 - h.Swap(0, l) - q := h.Pop() - bubbledown(h, l, true, 0) - return q -} - -// Pop the largest value off the heap. See heap.Pop(). -// Time complexity is O(log n), where n = h.Len() -func PopMax(h heap.Interface) interface{} { - l := h.Len() - j := 0 - if l > 1 { - j = min2(h, l,false, 1) - } - l = l - 1 - h.Swap(j, l) - q := h.Pop() - bubbledown(h, l,false, j) - return q -} - -// Remove element at index i. See heap.Remove(). -// The complexity is O(log n) where n = h.Len(). -func Remove(h heap.Interface, i int) (q interface{}) { - l := h.Len() - 1 - h.Swap(i, l) - q = h.Pop() - if l != i { - q, r := bubbledown(h, l, isMinHeap(i), i) - bubbleup(h, isMinHeap(q), q) - bubbleup(h, isMinHeap(r), r) - } - return q -} - -// Push an element onto the heap. See heap.Push() -// Time complexity is O(log n), where n = h.Len() -func Push(h heap.Interface, o interface{}) { - h.Push(o) - l := h.Len() - i := l - 1 - bubbleup(h, isMinHeap(i), i) -} - -// Init initializes the heap. -// This should be called once on non-empty heaps before calling Pop(), PopMax() or Push(). See heap.Init() -func Init(h heap.Interface) { - l := h.Len() - for i := 0; i < l; i++ { - bubbleup(h, isMinHeap(i), i) - } -} diff --git a/vendor/github.com/aalpar/deheap/fuzz.go b/vendor/github.com/aalpar/deheap/fuzz.go deleted file mode 100644 index 87de107f4..000000000 --- a/vendor/github.com/aalpar/deheap/fuzz.go +++ /dev/null @@ -1,113 +0,0 @@ -// Run fuzz tests on the package -// -// This is done with a byte heap to test and a simple reimplementation -// to check correctness against. -// -// First install go-fuzz -// -// go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build -// -// Next build the instrumented package -// -// go-fuzz-build -// -// Finally fuzz away -// -// go-fuzz -// -// See https://github.com/dvyukov/go-fuzz for more instructions - -//+build gofuzz - -package deheap - -import ( - "fmt" - "sort" -) - -// An byteHeap is a double ended heap of bytes -type byteDeheap []byte - -func (h byteDeheap) Len() int { return len(h) } -func (h byteDeheap) Less(i, j int) bool { return h[i] < h[j] } -func (h byteDeheap) Swap(i, j int) { h[i], h[j] = h[j], h[i] } - -func (h *byteDeheap) Push(x interface{}) { - *h = append(*h, x.(byte)) -} - -func (h *byteDeheap) Pop() interface{} { - old := *h - n := len(old) - x := old[n-1] - *h = old[:n-1] - return x -} - -// sortedHeap is an inefficient reimplementation for test purposes -type sortedHeap []byte - -func (h *sortedHeap) Push(x byte) { - data := *h - i := sort.Search(len(data), func(i int) bool { return data[i] >= x }) - // i is the either the position of x or where it should be inserted - data = append(data, 0) - copy(data[i+1:], data[i:]) - data[i] = x - *h = data -} - -func (h *sortedHeap) Pop() (x byte) { - data := *h - x = data[0] - *h = data[1:] - return x -} - -func (h *sortedHeap) PopMax() (x byte) { - data := *h - x = data[len(data)-1] - *h = data[:len(data)-1] - return x -} - -// Fuzzer input is a string of bytes. -// -// If the byte is one of these, then the action is performed -// '<' Pop (minimum) -// '>' PopMax -// Otherwise the bytes is Pushed onto the heap -func Fuzz(data []byte) int { - h := &byteDeheap{} - Init(h) - s := sortedHeap{} - - for _, c := range data { - switch c { - case '<': - if h.Len() > 0 { - got := Pop(h) - want := s.Pop() - if got != want { - panic(fmt.Sprintf("Pop: want = %d, got = %d", want, got)) - } - } - case '>': - if h.Len() > 0 { - got := PopMax(h) - want := s.PopMax() - if got != want { - panic(fmt.Sprintf("PopMax: want = %d, got = %d", want, got)) - } - } - default: - Push(h, c) - s.Push(c) - } - if len(s) != h.Len() { - panic("wrong length") - } - } - return 1 -} diff --git a/vendor/github.com/abbot/go-http-auth/.gitignore b/vendor/github.com/abbot/go-http-auth/.gitignore deleted file mode 100644 index 112ea3951..000000000 --- a/vendor/github.com/abbot/go-http-auth/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*~ -*.a -*.6 -*.out -_testmain.go diff --git a/vendor/github.com/abbot/go-http-auth/LICENSE b/vendor/github.com/abbot/go-http-auth/LICENSE deleted file mode 100644 index e454a5258..000000000 --- a/vendor/github.com/abbot/go-http-auth/LICENSE +++ /dev/null @@ -1,178 +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 - diff --git a/vendor/github.com/abbot/go-http-auth/Makefile b/vendor/github.com/abbot/go-http-auth/Makefile deleted file mode 100644 index 25f208da0..000000000 --- a/vendor/github.com/abbot/go-http-auth/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include $(GOROOT)/src/Make.inc - -TARG=auth_digest -GOFILES=\ - auth.go\ - digest.go\ - basic.go\ - misc.go\ - md5crypt.go\ - users.go\ - -include $(GOROOT)/src/Make.pkg diff --git a/vendor/github.com/abbot/go-http-auth/README.md b/vendor/github.com/abbot/go-http-auth/README.md deleted file mode 100644 index 73ae98522..000000000 --- a/vendor/github.com/abbot/go-http-auth/README.md +++ /dev/null @@ -1,71 +0,0 @@ -HTTP Authentication implementation in Go -======================================== - -This is an implementation of HTTP Basic and HTTP Digest authentication -in Go language. It is designed as a simple wrapper for -http.RequestHandler functions. - -Features --------- - - * Supports HTTP Basic and HTTP Digest authentication. - * Supports htpasswd and htdigest formatted files. - * Automatic reloading of password files. - * Pluggable interface for user/password storage. - * Supports MD5, SHA1 and BCrypt for Basic authentication password storage. - * Configurable Digest nonce cache size with expiration. - * Wrapper for legacy http handlers (http.HandlerFunc interface) - -Example usage -------------- - -This is a complete working example for Basic auth: - - package main - - import ( - "fmt" - "net/http" - - auth "github.com/abbot/go-http-auth" - ) - - func Secret(user, realm string) string { - if user == "john" { - // password is "hello" - return "$1$dlPL2MqE$oQmn16q49SqdmhenQuNgs1" - } - return "" - } - - func handle(w http.ResponseWriter, r *auth.AuthenticatedRequest) { - fmt.Fprintf(w, "

Hello, %s!

", r.Username) - } - - func main() { - authenticator := auth.NewBasicAuthenticator("example.com", Secret) - http.HandleFunc("/", authenticator.Wrap(handle)) - http.ListenAndServe(":8080", nil) - } - -See more examples in the "examples" directory. - -Legal ------ - -This module is developed under Apache 2.0 license, and can be used for -open and proprietary projects. - -Copyright 2012-2013 Lev Shamardin - -Licensed under the Apache License, Version 2.0 (the "License"); you -may not use this file or any other part of this project 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/abbot/go-http-auth/auth.go b/vendor/github.com/abbot/go-http-auth/auth.go deleted file mode 100644 index 05ded165e..000000000 --- a/vendor/github.com/abbot/go-http-auth/auth.go +++ /dev/null @@ -1,109 +0,0 @@ -// Package auth is an implementation of HTTP Basic and HTTP Digest authentication. -package auth - -import ( - "net/http" - - "golang.org/x/net/context" -) - -/* - Request handlers must take AuthenticatedRequest instead of http.Request -*/ -type AuthenticatedRequest struct { - http.Request - /* - Authenticated user name. Current API implies that Username is - never empty, which means that authentication is always done - before calling the request handler. - */ - Username string -} - -/* - AuthenticatedHandlerFunc is like http.HandlerFunc, but takes - AuthenticatedRequest instead of http.Request -*/ -type AuthenticatedHandlerFunc func(http.ResponseWriter, *AuthenticatedRequest) - -/* - Authenticator wraps an AuthenticatedHandlerFunc with - authentication-checking code. - - Typical Authenticator usage is something like: - - authenticator := SomeAuthenticator(...) - http.HandleFunc("/", authenticator(my_handler)) - - Authenticator wrapper checks the user authentication and calls the - wrapped function only after authentication has succeeded. Otherwise, - it returns a handler which initiates the authentication procedure. -*/ -type Authenticator func(AuthenticatedHandlerFunc) http.HandlerFunc - -// Info contains authentication information for the request. -type Info struct { - // Authenticated is set to true when request was authenticated - // successfully, i.e. username and password passed in request did - // pass the check. - Authenticated bool - - // Username contains a user name passed in the request when - // Authenticated is true. It's value is undefined if Authenticated - // is false. - Username string - - // ResponseHeaders contains extra headers that must be set by server - // when sending back HTTP response. - ResponseHeaders http.Header -} - -// UpdateHeaders updates headers with this Info's ResponseHeaders. It is -// safe to call this function on nil Info. -func (i *Info) UpdateHeaders(headers http.Header) { - if i == nil { - return - } - for k, values := range i.ResponseHeaders { - for _, v := range values { - headers.Add(k, v) - } - } -} - -type key int // used for context keys - -var infoKey key = 0 - -type AuthenticatorInterface interface { - // NewContext returns a new context carrying authentication - // information extracted from the request. - NewContext(ctx context.Context, r *http.Request) context.Context - - // Wrap returns an http.HandlerFunc which wraps - // AuthenticatedHandlerFunc with this authenticator's - // authentication checks. - Wrap(AuthenticatedHandlerFunc) http.HandlerFunc -} - -// FromContext returns authentication information from the context or -// nil if no such information present. -func FromContext(ctx context.Context) *Info { - info, ok := ctx.Value(infoKey).(*Info) - if !ok { - return nil - } - return info -} - -// AuthUsernameHeader is the header set by JustCheck functions. It -// contains an authenticated username (if authentication was -// successful). -const AuthUsernameHeader = "X-Authenticated-Username" - -func JustCheck(auth AuthenticatorInterface, wrapped http.HandlerFunc) http.HandlerFunc { - return auth.Wrap(func(w http.ResponseWriter, ar *AuthenticatedRequest) { - ar.Header.Set(AuthUsernameHeader, ar.Username) - wrapped(w, &ar.Request) - }) -} diff --git a/vendor/github.com/abbot/go-http-auth/basic.go b/vendor/github.com/abbot/go-http-auth/basic.go deleted file mode 100644 index b03dd5823..000000000 --- a/vendor/github.com/abbot/go-http-auth/basic.go +++ /dev/null @@ -1,163 +0,0 @@ -package auth - -import ( - "bytes" - "crypto/sha1" - "crypto/subtle" - "encoding/base64" - "errors" - "net/http" - "strings" - - "golang.org/x/crypto/bcrypt" - "golang.org/x/net/context" -) - -type compareFunc func(hashedPassword, password []byte) error - -var ( - errMismatchedHashAndPassword = errors.New("mismatched hash and password") - - compareFuncs = []struct { - prefix string - compare compareFunc - }{ - {"", compareMD5HashAndPassword}, // default compareFunc - {"{SHA}", compareShaHashAndPassword}, - // Bcrypt is complicated. According to crypt(3) from - // crypt_blowfish version 1.3 (fetched from - // http://www.openwall.com/crypt/crypt_blowfish-1.3.tar.gz), there - // are three different has prefixes: "$2a$", used by versions up - // to 1.0.4, and "$2x$" and "$2y$", used in all later - // versions. "$2a$" has a known bug, "$2x$" was added as a - // migration path for systems with "$2a$" prefix and still has a - // bug, and only "$2y$" should be used by modern systems. The bug - // has something to do with handling of 8-bit characters. Since - // both "$2a$" and "$2x$" are deprecated, we are handling them the - // same way as "$2y$", which will yield correct results for 7-bit - // character passwords, but is wrong for 8-bit character - // passwords. You have to upgrade to "$2y$" if you want sant 8-bit - // character password support with bcrypt. To add to the mess, - // OpenBSD 5.5. introduced "$2b$" prefix, which behaves exactly - // like "$2y$" according to the same source. - {"$2a$", bcrypt.CompareHashAndPassword}, - {"$2b$", bcrypt.CompareHashAndPassword}, - {"$2x$", bcrypt.CompareHashAndPassword}, - {"$2y$", bcrypt.CompareHashAndPassword}, - } -) - -type BasicAuth struct { - Realm string - Secrets SecretProvider - // Headers used by authenticator. Set to ProxyHeaders to use with - // proxy server. When nil, NormalHeaders are used. - Headers *Headers -} - -// check that BasicAuth implements AuthenticatorInterface -var _ = (AuthenticatorInterface)((*BasicAuth)(nil)) - -/* - Checks the username/password combination from the request. Returns - either an empty string (authentication failed) or the name of the - authenticated user. - - Supports MD5 and SHA1 password entries -*/ -func (a *BasicAuth) CheckAuth(r *http.Request) string { - s := strings.SplitN(r.Header.Get(a.Headers.V().Authorization), " ", 2) - if len(s) != 2 || s[0] != "Basic" { - return "" - } - - b, err := base64.StdEncoding.DecodeString(s[1]) - if err != nil { - return "" - } - pair := strings.SplitN(string(b), ":", 2) - if len(pair) != 2 { - return "" - } - user, password := pair[0], pair[1] - secret := a.Secrets(user, a.Realm) - if secret == "" { - return "" - } - compare := compareFuncs[0].compare - for _, cmp := range compareFuncs[1:] { - if strings.HasPrefix(secret, cmp.prefix) { - compare = cmp.compare - break - } - } - if compare([]byte(secret), []byte(password)) != nil { - return "" - } - return pair[0] -} - -func compareShaHashAndPassword(hashedPassword, password []byte) error { - d := sha1.New() - d.Write(password) - if subtle.ConstantTimeCompare(hashedPassword[5:], []byte(base64.StdEncoding.EncodeToString(d.Sum(nil)))) != 1 { - return errMismatchedHashAndPassword - } - return nil -} - -func compareMD5HashAndPassword(hashedPassword, password []byte) error { - parts := bytes.SplitN(hashedPassword, []byte("$"), 4) - if len(parts) != 4 { - return errMismatchedHashAndPassword - } - magic := []byte("$" + string(parts[1]) + "$") - salt := parts[2] - if subtle.ConstantTimeCompare(hashedPassword, MD5Crypt(password, salt, magic)) != 1 { - return errMismatchedHashAndPassword - } - return nil -} - -/* - http.Handler for BasicAuth which initiates the authentication process - (or requires reauthentication). -*/ -func (a *BasicAuth) RequireAuth(w http.ResponseWriter, r *http.Request) { - w.Header().Set(contentType, a.Headers.V().UnauthContentType) - w.Header().Set(a.Headers.V().Authenticate, `Basic realm="`+a.Realm+`"`) - w.WriteHeader(a.Headers.V().UnauthCode) - w.Write([]byte(a.Headers.V().UnauthResponse)) -} - -/* - BasicAuthenticator returns a function, which wraps an - AuthenticatedHandlerFunc converting it to http.HandlerFunc. This - wrapper function checks the authentication and either sends back - required authentication headers, or calls the wrapped function with - authenticated username in the AuthenticatedRequest. -*/ -func (a *BasicAuth) Wrap(wrapped AuthenticatedHandlerFunc) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - if username := a.CheckAuth(r); username == "" { - a.RequireAuth(w, r) - } else { - ar := &AuthenticatedRequest{Request: *r, Username: username} - wrapped(w, ar) - } - } -} - -// NewContext returns a context carrying authentication information for the request. -func (a *BasicAuth) NewContext(ctx context.Context, r *http.Request) context.Context { - info := &Info{Username: a.CheckAuth(r), ResponseHeaders: make(http.Header)} - info.Authenticated = (info.Username != "") - if !info.Authenticated { - info.ResponseHeaders.Set(a.Headers.V().Authenticate, `Basic realm="`+a.Realm+`"`) - } - return context.WithValue(ctx, infoKey, info) -} - -func NewBasicAuthenticator(realm string, secrets SecretProvider) *BasicAuth { - return &BasicAuth{Realm: realm, Secrets: secrets} -} diff --git a/vendor/github.com/abbot/go-http-auth/digest.go b/vendor/github.com/abbot/go-http-auth/digest.go deleted file mode 100644 index 21b09334c..000000000 --- a/vendor/github.com/abbot/go-http-auth/digest.go +++ /dev/null @@ -1,274 +0,0 @@ -package auth - -import ( - "crypto/subtle" - "fmt" - "net/http" - "net/url" - "sort" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/net/context" -) - -type digest_client struct { - nc uint64 - last_seen int64 -} - -type DigestAuth struct { - Realm string - Opaque string - Secrets SecretProvider - PlainTextSecrets bool - IgnoreNonceCount bool - // Headers used by authenticator. Set to ProxyHeaders to use with - // proxy server. When nil, NormalHeaders are used. - Headers *Headers - - /* - Approximate size of Client's Cache. When actual number of - tracked client nonces exceeds - ClientCacheSize+ClientCacheTolerance, ClientCacheTolerance*2 - older entries are purged. - */ - ClientCacheSize int - ClientCacheTolerance int - - clients map[string]*digest_client - mutex sync.Mutex -} - -// check that DigestAuth implements AuthenticatorInterface -var _ = (AuthenticatorInterface)((*DigestAuth)(nil)) - -type digest_cache_entry struct { - nonce string - last_seen int64 -} - -type digest_cache []digest_cache_entry - -func (c digest_cache) Less(i, j int) bool { - return c[i].last_seen < c[j].last_seen -} - -func (c digest_cache) Len() int { - return len(c) -} - -func (c digest_cache) Swap(i, j int) { - c[i], c[j] = c[j], c[i] -} - -/* - Remove count oldest entries from DigestAuth.clients -*/ -func (a *DigestAuth) Purge(count int) { - entries := make([]digest_cache_entry, 0, len(a.clients)) - for nonce, client := range a.clients { - entries = append(entries, digest_cache_entry{nonce, client.last_seen}) - } - cache := digest_cache(entries) - sort.Sort(cache) - for _, client := range cache[:count] { - delete(a.clients, client.nonce) - } -} - -/* - http.Handler for DigestAuth which initiates the authentication process - (or requires reauthentication). -*/ -func (a *DigestAuth) RequireAuth(w http.ResponseWriter, r *http.Request) { - if len(a.clients) > a.ClientCacheSize+a.ClientCacheTolerance { - a.Purge(a.ClientCacheTolerance * 2) - } - nonce := RandomKey() - a.clients[nonce] = &digest_client{nc: 0, last_seen: time.Now().UnixNano()} - w.Header().Set(contentType, a.Headers.V().UnauthContentType) - w.Header().Set(a.Headers.V().Authenticate, - fmt.Sprintf(`Digest realm="%s", nonce="%s", opaque="%s", algorithm="MD5", qop="auth"`, - a.Realm, nonce, a.Opaque)) - w.WriteHeader(a.Headers.V().UnauthCode) - w.Write([]byte(a.Headers.V().UnauthResponse)) -} - -/* - Parse Authorization header from the http.Request. Returns a map of - auth parameters or nil if the header is not a valid parsable Digest - auth header. -*/ -func DigestAuthParams(authorization string) map[string]string { - s := strings.SplitN(authorization, " ", 2) - if len(s) != 2 || s[0] != "Digest" { - return nil - } - - return ParsePairs(s[1]) -} - -/* - Check if request contains valid authentication data. Returns a pair - of username, authinfo where username is the name of the authenticated - user or an empty string and authinfo is the contents for the optional - Authentication-Info response header. -*/ -func (da *DigestAuth) CheckAuth(r *http.Request) (username string, authinfo *string) { - da.mutex.Lock() - defer da.mutex.Unlock() - username = "" - authinfo = nil - auth := DigestAuthParams(r.Header.Get(da.Headers.V().Authorization)) - if auth == nil { - return "", nil - } - // RFC2617 Section 3.2.1 specifies that unset value of algorithm in - // WWW-Authenticate Response header should be treated as - // "MD5". According to section 3.2.2 the "algorithm" value in - // subsequent Request Authorization header must be set to whatever - // was supplied in the WWW-Authenticate Response header. This - // implementation always returns an algorithm in WWW-Authenticate - // header, however there seems to be broken clients in the wild - // which do not set the algorithm. Assume the unset algorithm in - // Authorization header to be equal to MD5. - if _, ok := auth["algorithm"]; !ok { - auth["algorithm"] = "MD5" - } - if da.Opaque != auth["opaque"] || auth["algorithm"] != "MD5" || auth["qop"] != "auth" { - return "", nil - } - - // Check if the requested URI matches auth header - if r.RequestURI != auth["uri"] { - // We allow auth["uri"] to be a full path prefix of request-uri - // for some reason lost in history, which is probably wrong, but - // used to be like that for quite some time - // (https://tools.ietf.org/html/rfc2617#section-3.2.2 explicitly - // says that auth["uri"] is the request-uri). - // - // TODO: make an option to allow only strict checking. - switch u, err := url.Parse(auth["uri"]); { - case err != nil: - return "", nil - case r.URL == nil: - return "", nil - case len(u.Path) > len(r.URL.Path): - return "", nil - case !strings.HasPrefix(r.URL.Path, u.Path): - return "", nil - } - } - - HA1 := da.Secrets(auth["username"], da.Realm) - if da.PlainTextSecrets { - HA1 = H(auth["username"] + ":" + da.Realm + ":" + HA1) - } - HA2 := H(r.Method + ":" + auth["uri"]) - KD := H(strings.Join([]string{HA1, auth["nonce"], auth["nc"], auth["cnonce"], auth["qop"], HA2}, ":")) - - if subtle.ConstantTimeCompare([]byte(KD), []byte(auth["response"])) != 1 { - return "", nil - } - - // At this point crypto checks are completed and validated. - // Now check if the session is valid. - - nc, err := strconv.ParseUint(auth["nc"], 16, 64) - if err != nil { - return "", nil - } - - if client, ok := da.clients[auth["nonce"]]; !ok { - return "", nil - } else { - if client.nc != 0 && client.nc >= nc && !da.IgnoreNonceCount { - return "", nil - } - client.nc = nc - client.last_seen = time.Now().UnixNano() - } - - resp_HA2 := H(":" + auth["uri"]) - rspauth := H(strings.Join([]string{HA1, auth["nonce"], auth["nc"], auth["cnonce"], auth["qop"], resp_HA2}, ":")) - - info := fmt.Sprintf(`qop="auth", rspauth="%s", cnonce="%s", nc="%s"`, rspauth, auth["cnonce"], auth["nc"]) - return auth["username"], &info -} - -/* - Default values for ClientCacheSize and ClientCacheTolerance for DigestAuth -*/ -const DefaultClientCacheSize = 1000 -const DefaultClientCacheTolerance = 100 - -/* - Wrap returns an Authenticator which uses HTTP Digest - authentication. Arguments: - - realm: The authentication realm. - - secrets: SecretProvider which must return HA1 digests for the same - realm as above. -*/ -func (a *DigestAuth) Wrap(wrapped AuthenticatedHandlerFunc) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - if username, authinfo := a.CheckAuth(r); username == "" { - a.RequireAuth(w, r) - } else { - ar := &AuthenticatedRequest{Request: *r, Username: username} - if authinfo != nil { - w.Header().Set(a.Headers.V().AuthInfo, *authinfo) - } - wrapped(w, ar) - } - } -} - -/* - JustCheck returns function which converts an http.HandlerFunc into a - http.HandlerFunc which requires authentication. Username is passed as - an extra X-Authenticated-Username header. -*/ -func (a *DigestAuth) JustCheck(wrapped http.HandlerFunc) http.HandlerFunc { - return a.Wrap(func(w http.ResponseWriter, ar *AuthenticatedRequest) { - ar.Header.Set(AuthUsernameHeader, ar.Username) - wrapped(w, &ar.Request) - }) -} - -// NewContext returns a context carrying authentication information for the request. -func (a *DigestAuth) NewContext(ctx context.Context, r *http.Request) context.Context { - username, authinfo := a.CheckAuth(r) - info := &Info{Username: username, ResponseHeaders: make(http.Header)} - if username != "" { - info.Authenticated = true - info.ResponseHeaders.Set(a.Headers.V().AuthInfo, *authinfo) - } else { - // return back digest WWW-Authenticate header - if len(a.clients) > a.ClientCacheSize+a.ClientCacheTolerance { - a.Purge(a.ClientCacheTolerance * 2) - } - nonce := RandomKey() - a.clients[nonce] = &digest_client{nc: 0, last_seen: time.Now().UnixNano()} - info.ResponseHeaders.Set(a.Headers.V().Authenticate, - fmt.Sprintf(`Digest realm="%s", nonce="%s", opaque="%s", algorithm="MD5", qop="auth"`, - a.Realm, nonce, a.Opaque)) - } - return context.WithValue(ctx, infoKey, info) -} - -func NewDigestAuthenticator(realm string, secrets SecretProvider) *DigestAuth { - da := &DigestAuth{ - Opaque: RandomKey(), - Realm: realm, - Secrets: secrets, - PlainTextSecrets: false, - ClientCacheSize: DefaultClientCacheSize, - ClientCacheTolerance: DefaultClientCacheTolerance, - clients: map[string]*digest_client{}} - return da -} diff --git a/vendor/github.com/abbot/go-http-auth/md5crypt.go b/vendor/github.com/abbot/go-http-auth/md5crypt.go deleted file mode 100644 index a7a031c41..000000000 --- a/vendor/github.com/abbot/go-http-auth/md5crypt.go +++ /dev/null @@ -1,92 +0,0 @@ -package auth - -import "crypto/md5" -import "strings" - -const itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - -var md5_crypt_swaps = [16]int{12, 6, 0, 13, 7, 1, 14, 8, 2, 15, 9, 3, 5, 10, 4, 11} - -type MD5Entry struct { - Magic, Salt, Hash []byte -} - -func NewMD5Entry(e string) *MD5Entry { - parts := strings.SplitN(e, "$", 4) - if len(parts) != 4 { - return nil - } - return &MD5Entry{ - Magic: []byte("$" + parts[1] + "$"), - Salt: []byte(parts[2]), - Hash: []byte(parts[3]), - } -} - -/* - MD5 password crypt implementation -*/ -func MD5Crypt(password, salt, magic []byte) []byte { - d := md5.New() - - d.Write(password) - d.Write(magic) - d.Write(salt) - - d2 := md5.New() - d2.Write(password) - d2.Write(salt) - d2.Write(password) - - for i, mixin := 0, d2.Sum(nil); i < len(password); i++ { - d.Write([]byte{mixin[i%16]}) - } - - for i := len(password); i != 0; i >>= 1 { - if i&1 == 0 { - d.Write([]byte{password[0]}) - } else { - d.Write([]byte{0}) - } - } - - final := d.Sum(nil) - - for i := 0; i < 1000; i++ { - d2 := md5.New() - if i&1 == 0 { - d2.Write(final) - } else { - d2.Write(password) - } - - if i%3 != 0 { - d2.Write(salt) - } - - if i%7 != 0 { - d2.Write(password) - } - - if i&1 == 0 { - d2.Write(password) - } else { - d2.Write(final) - } - final = d2.Sum(nil) - } - - result := make([]byte, 0, 22) - v := uint(0) - bits := uint(0) - for _, i := range md5_crypt_swaps { - v |= (uint(final[i]) << bits) - for bits = bits + 8; bits > 6; bits -= 6 { - result = append(result, itoa64[v&0x3f]) - v >>= 6 - } - } - result = append(result, itoa64[v&0x3f]) - - return append(append(append(magic, salt...), '$'), result...) -} diff --git a/vendor/github.com/abbot/go-http-auth/misc.go b/vendor/github.com/abbot/go-http-auth/misc.go deleted file mode 100644 index 4536ce673..000000000 --- a/vendor/github.com/abbot/go-http-auth/misc.go +++ /dev/null @@ -1,141 +0,0 @@ -package auth - -import ( - "bytes" - "crypto/md5" - "crypto/rand" - "encoding/base64" - "fmt" - "net/http" - "strings" -) - -// RandomKey returns a random 16-byte base64 alphabet string -func RandomKey() string { - k := make([]byte, 12) - for bytes := 0; bytes < len(k); { - n, err := rand.Read(k[bytes:]) - if err != nil { - panic("rand.Read() failed") - } - bytes += n - } - return base64.StdEncoding.EncodeToString(k) -} - -// H function for MD5 algorithm (returns a lower-case hex MD5 digest) -func H(data string) string { - digest := md5.New() - digest.Write([]byte(data)) - return fmt.Sprintf("%x", digest.Sum(nil)) -} - -// ParseList parses a comma-separated list of values as described by -// RFC 2068 and returns list elements. -// -// Lifted from https://code.google.com/p/gorilla/source/browse/http/parser/parser.go -// which was ported from urllib2.parse_http_list, from the Python -// standard library. -func ParseList(value string) []string { - var list []string - var escape, quote bool - b := new(bytes.Buffer) - for _, r := range value { - switch { - case escape: - b.WriteRune(r) - escape = false - case quote: - if r == '\\' { - escape = true - } else { - if r == '"' { - quote = false - } - b.WriteRune(r) - } - case r == ',': - list = append(list, strings.TrimSpace(b.String())) - b.Reset() - case r == '"': - quote = true - b.WriteRune(r) - default: - b.WriteRune(r) - } - } - // Append last part. - if s := b.String(); s != "" { - list = append(list, strings.TrimSpace(s)) - } - return list -} - -// ParsePairs extracts key/value pairs from a comma-separated list of -// values as described by RFC 2068 and returns a map[key]value. The -// resulting values are unquoted. If a list element doesn't contain a -// "=", the key is the element itself and the value is an empty -// string. -// -// Lifted from https://code.google.com/p/gorilla/source/browse/http/parser/parser.go -func ParsePairs(value string) map[string]string { - m := make(map[string]string) - for _, pair := range ParseList(strings.TrimSpace(value)) { - if i := strings.Index(pair, "="); i < 0 { - m[pair] = "" - } else { - v := pair[i+1:] - if v[0] == '"' && v[len(v)-1] == '"' { - // Unquote it. - v = v[1 : len(v)-1] - } - m[pair[:i]] = v - } - } - return m -} - -// Headers contains header and error codes used by authenticator. -type Headers struct { - Authenticate string // WWW-Authenticate - Authorization string // Authorization - AuthInfo string // Authentication-Info - UnauthCode int // 401 - UnauthContentType string // text/plain - UnauthResponse string // Unauthorized. -} - -// V returns NormalHeaders when h is nil, or h otherwise. Allows to -// use uninitialized *Headers values in structs. -func (h *Headers) V() *Headers { - if h == nil { - return NormalHeaders - } - return h -} - -var ( - // NormalHeaders are the regular Headers used by an HTTP Server for - // request authentication. - NormalHeaders = &Headers{ - Authenticate: "WWW-Authenticate", - Authorization: "Authorization", - AuthInfo: "Authentication-Info", - UnauthCode: http.StatusUnauthorized, - UnauthContentType: "text/plain", - UnauthResponse: fmt.Sprintf("%d %s\n", http.StatusUnauthorized, http.StatusText(http.StatusUnauthorized)), - } - - // ProxyHeaders are Headers used by an HTTP Proxy server for proxy - // access authentication. - ProxyHeaders = &Headers{ - Authenticate: "Proxy-Authenticate", - Authorization: "Proxy-Authorization", - AuthInfo: "Proxy-Authentication-Info", - UnauthCode: http.StatusProxyAuthRequired, - UnauthContentType: "text/plain", - UnauthResponse: fmt.Sprintf("%d %s\n", http.StatusProxyAuthRequired, http.StatusText(http.StatusProxyAuthRequired)), - } -) - -const contentType = "Content-Type" diff --git a/vendor/github.com/abbot/go-http-auth/test.htdigest b/vendor/github.com/abbot/go-http-auth/test.htdigest deleted file mode 100644 index 6c8c75b4e..000000000 --- a/vendor/github.com/abbot/go-http-auth/test.htdigest +++ /dev/null @@ -1 +0,0 @@ -test:example.com:aa78524fceb0e50fd8ca96dd818b8cf9 diff --git a/vendor/github.com/abbot/go-http-auth/test.htpasswd b/vendor/github.com/abbot/go-http-auth/test.htpasswd deleted file mode 100644 index 4844a3ccb..000000000 --- a/vendor/github.com/abbot/go-http-auth/test.htpasswd +++ /dev/null @@ -1,4 +0,0 @@ -test:{SHA}qvTGHdzF6KLavt4PO0gs2a6pQ00= -test2:$apr1$a0j62R97$mYqFkloXH0/UOaUnAiV2b0 -test16:$apr1$JI4wh3am$AmhephVqLTUyAVpFQeHZC0 -test3:$2y$05$ih3C91zUBSTFcAh2mQnZYuob0UOZVEf16wl/ukgjDhjvj.xgM1WwS diff --git a/vendor/github.com/abbot/go-http-auth/users.go b/vendor/github.com/abbot/go-http-auth/users.go deleted file mode 100644 index 377181243..000000000 --- a/vendor/github.com/abbot/go-http-auth/users.go +++ /dev/null @@ -1,154 +0,0 @@ -package auth - -import ( - "encoding/csv" - "os" - "sync" -) - -/* - SecretProvider is used by authenticators. Takes user name and realm - as an argument, returns secret required for authentication (HA1 for - digest authentication, properly encrypted password for basic). - - Returning an empty string means failing the authentication. -*/ -type SecretProvider func(user, realm string) string - -/* - Common functions for file auto-reloading -*/ -type File struct { - Path string - Info os.FileInfo - /* must be set in inherited types during initialization */ - Reload func() - mu sync.Mutex -} - -func (f *File) ReloadIfNeeded() { - info, err := os.Stat(f.Path) - if err != nil { - panic(err) - } - f.mu.Lock() - defer f.mu.Unlock() - if f.Info == nil || f.Info.ModTime() != info.ModTime() { - f.Info = info - f.Reload() - } -} - -/* - Structure used for htdigest file authentication. Users map realms to - maps of users to their HA1 digests. -*/ -type HtdigestFile struct { - File - Users map[string]map[string]string - mu sync.RWMutex -} - -func reload_htdigest(hf *HtdigestFile) { - r, err := os.Open(hf.Path) - if err != nil { - panic(err) - } - csv_reader := csv.NewReader(r) - csv_reader.Comma = ':' - csv_reader.Comment = '#' - csv_reader.TrimLeadingSpace = true - - records, err := csv_reader.ReadAll() - if err != nil { - panic(err) - } - - hf.mu.Lock() - defer hf.mu.Unlock() - hf.Users = make(map[string]map[string]string) - for _, record := range records { - _, exists := hf.Users[record[1]] - if !exists { - hf.Users[record[1]] = make(map[string]string) - } - hf.Users[record[1]][record[0]] = record[2] - } -} - -/* - SecretProvider implementation based on htdigest-formated files. Will - reload htdigest file on changes. Will panic on syntax errors in - htdigest files. -*/ -func HtdigestFileProvider(filename string) SecretProvider { - hf := &HtdigestFile{File: File{Path: filename}} - hf.Reload = func() { reload_htdigest(hf) } - return func(user, realm string) string { - hf.ReloadIfNeeded() - hf.mu.RLock() - defer hf.mu.RUnlock() - _, exists := hf.Users[realm] - if !exists { - return "" - } - digest, exists := hf.Users[realm][user] - if !exists { - return "" - } - return digest - } -} - -/* - Structure used for htdigest file authentication. Users map users to - their salted encrypted password -*/ -type HtpasswdFile struct { - File - Users map[string]string - mu sync.RWMutex -} - -func reload_htpasswd(h *HtpasswdFile) { - r, err := os.Open(h.Path) - if err != nil { - panic(err) - } - csv_reader := csv.NewReader(r) - csv_reader.Comma = ':' - csv_reader.Comment = '#' - csv_reader.TrimLeadingSpace = true - - records, err := csv_reader.ReadAll() - if err != nil { - panic(err) - } - - h.mu.Lock() - defer h.mu.Unlock() - h.Users = make(map[string]string) - for _, record := range records { - h.Users[record[0]] = record[1] - } -} - -/* - SecretProvider implementation based on htpasswd-formated files. Will - reload htpasswd file on changes. Will panic on syntax errors in - htpasswd files. Realm argument of the SecretProvider is ignored. -*/ -func HtpasswdFileProvider(filename string) SecretProvider { - h := &HtpasswdFile{File: File{Path: filename}} - h.Reload = func() { reload_htpasswd(h) } - return func(user, realm string) string { - h.ReloadIfNeeded() - h.mu.RLock() - password, exists := h.Users[user] - h.mu.RUnlock() - if !exists { - return "" - } - return password - } -} diff --git a/vendor/github.com/anacrolix/dms/LICENSE b/vendor/github.com/anacrolix/dms/LICENSE deleted file mode 100644 index 3b827a441..000000000 --- a/vendor/github.com/anacrolix/dms/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2012, Matt Joiner . -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 the 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 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. \ No newline at end of file diff --git a/vendor/github.com/anacrolix/dms/dlna/dlna.go b/vendor/github.com/anacrolix/dms/dlna/dlna.go deleted file mode 100644 index 07f5880f2..000000000 --- a/vendor/github.com/anacrolix/dms/dlna/dlna.go +++ /dev/null @@ -1,102 +0,0 @@ -package dlna - -import ( - "fmt" - "strings" - "time" -) - -const ( - TimeSeekRangeDomain = "TimeSeekRange.dlna.org" - ContentFeaturesDomain = "contentFeatures.dlna.org" - TransferModeDomain = "transferMode.dlna.org" -) - -type ContentFeatures struct { - ProfileName string - SupportTimeSeek bool - SupportRange bool - // Play speeds, DLNA.ORG_PS would go here if supported. - Transcoded bool -} - -func BinaryInt(b bool) uint { - if b { - return 1 - } else { - return 0 - } -} - -// flags are in hex. trailing 24 zeroes, 26 are after the space -// "DLNA.ORG_OP=" time-seek-range-supp bytes-range-header-supp -func (cf ContentFeatures) String() (ret string) { - //DLNA.ORG_PN=[a-zA-Z0-9_]* - params := make([]string, 0, 2) - if cf.ProfileName != "" { - params = append(params, "DLNA.ORG_PN="+cf.ProfileName) - } - params = append(params, fmt.Sprintf( - "DLNA.ORG_OP=%b%b;DLNA.ORG_CI=%b", - BinaryInt(cf.SupportTimeSeek), - BinaryInt(cf.SupportRange), - BinaryInt(cf.Transcoded))) - return strings.Join(params, ";") -} - -func ParseNPTTime(s string) (time.Duration, error) { - var h, m, sec, ms time.Duration - n, err := fmt.Sscanf(s, "%d:%2d:%2d.%3d", &h, &m, &sec, &ms) - if err != nil { - return -1, err - } - if n < 3 { - return -1, fmt.Errorf("invalid npt time: %s", s) - } - ret := time.Duration(h) * time.Hour - ret += time.Duration(m) * time.Minute - ret += sec * time.Second - ret += ms * time.Millisecond - return ret, nil -} - -func FormatNPTTime(npt time.Duration) string { - npt /= time.Millisecond - ms := npt % 1000 - npt /= 1000 - s := npt % 60 - npt /= 60 - m := npt % 60 - npt /= 60 - h := npt - return fmt.Sprintf("%02d:%02d:%02d.%03d", h, m, s, ms) -} - -type NPTRange struct { - Start, End time.Duration -} - -func ParseNPTRange(s string) (ret NPTRange, err error) { - ss := strings.SplitN(s, "-", 2) - if ss[0] != "" { - ret.Start, err = ParseNPTTime(ss[0]) - if err != nil { - return - } - } - if ss[1] != "" { - ret.End, err = ParseNPTTime(ss[1]) - if err != nil { - return - } - } - return -} - -func (me NPTRange) String() (ret string) { - ret = me.Start.String() + "-" - if me.End >= 0 { - ret += me.End.String() - } - return -} diff --git a/vendor/github.com/anacrolix/dms/soap/soap.go b/vendor/github.com/anacrolix/dms/soap/soap.go deleted file mode 100644 index 5424bc855..000000000 --- a/vendor/github.com/anacrolix/dms/soap/soap.go +++ /dev/null @@ -1,68 +0,0 @@ -package soap - -import ( - "encoding/xml" -) - -const ( - EncodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" - EnvelopeNS = "http://schemas.xmlsoap.org/soap/envelope/" -) - -type Arg struct { - XMLName xml.Name - Value string `xml:",chardata"` -} - -type Action struct { - XMLName xml.Name - Args []Arg -} - -type Body struct { - Action []byte `xml:",innerxml"` -} - -type UPnPError struct { - XMLName xml.Name `xml:"urn:schemas-upnp-org:control-1-0 UPnPError"` - Code uint `xml:"errorCode"` - Desc string `xml:"errorDescription"` -} - -type FaultDetail struct { - XMLName xml.Name `xml:"detail"` - Data interface{} -} - -type Fault struct { - XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"` - FaultCode string `xml:"faultcode"` - FaultString string `xml:"faultstring"` - Detail FaultDetail `xml:"detail"` -} - -func NewFault(s string, detail interface{}) *Fault { - return &Fault{ - FaultCode: EnvelopeNS + ":Client", - FaultString: s, - Detail: FaultDetail{ - Data: detail, - }, - } -} - -type Envelope struct { - XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` - EncodingStyle string `xml:"encodingStyle,attr"` - Body Body `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"` -} - -/* XML marshalling of nested namespaces is broken. - -func NewEnvelope(action []byte) Envelope { - return Envelope{ - EncodingStyle: EncodingStyle, - Body: Body{action}, - } -} -*/ diff --git a/vendor/github.com/anacrolix/dms/ssdp/ssdp.go b/vendor/github.com/anacrolix/dms/ssdp/ssdp.go deleted file mode 100644 index 5b03c709f..000000000 --- a/vendor/github.com/anacrolix/dms/ssdp/ssdp.go +++ /dev/null @@ -1,330 +0,0 @@ -package ssdp - -import ( - "bufio" - "bytes" - "fmt" - "io" - "log" - "math/rand" - "net" - "net/http" - "net/textproto" - "strconv" - "strings" - "time" - - "golang.org/x/net/ipv4" -) - -const ( - AddrString = "239.255.255.250:1900" - rootDevice = "upnp:rootdevice" - aliveNTS = "ssdp:alive" - byebyeNTS = "ssdp:byebye" -) - -var ( - NetAddr *net.UDPAddr -) - -func init() { - var err error - NetAddr, err = net.ResolveUDPAddr("udp4", AddrString) - if err != nil { - log.Panicf("Could not resolve %s: %s", AddrString, err) - } -} - -type badStringError struct { - what string - str string -} - -func (e *badStringError) Error() string { return fmt.Sprintf("%s %q", e.what, e.str) } - -func ReadRequest(b *bufio.Reader) (req *http.Request, err error) { - tp := textproto.NewReader(b) - var s string - if s, err = tp.ReadLine(); err != nil { - return nil, err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - var f []string - // TODO a split that only allows N values? - if f = strings.SplitN(s, " ", 3); len(f) < 3 { - return nil, &badStringError{"malformed request line", s} - } - if f[1] != "*" { - return nil, &badStringError{"bad URL request", f[1]} - } - req = &http.Request{ - Method: f[0], - } - var ok bool - if req.ProtoMajor, req.ProtoMinor, ok = http.ParseHTTPVersion(strings.TrimSpace(f[2])); !ok { - return nil, &badStringError{"malformed HTTP version", f[2]} - } - - mimeHeader, err := tp.ReadMIMEHeader() - if err != nil { - return nil, err - } - req.Header = http.Header(mimeHeader) - return -} - -type Server struct { - conn *net.UDPConn - Interface net.Interface - Server string - Services []string - Devices []string - Location func(net.IP) string - UUID string - NotifyInterval time.Duration - closed chan struct{} -} - -func makeConn(ifi net.Interface) (ret *net.UDPConn, err error) { - ret, err = net.ListenMulticastUDP("udp", &ifi, NetAddr) - if err != nil { - return - } - p := ipv4.NewPacketConn(ret) - if err := p.SetMulticastTTL(2); err != nil { - log.Println(err) - } - if err := p.SetMulticastLoopback(true); err != nil { - log.Println(err) - } - return -} - -func (me *Server) serve() { - for { - b := make([]byte, me.Interface.MTU) - n, addr, err := me.conn.ReadFromUDP(b) - select { - case <-me.closed: - return - default: - } - if err != nil { - log.Printf("error reading from UDP socket: %s", err) - break - } - go me.handle(b[:n], addr) - } -} - -func (me *Server) Init() (err error) { - me.closed = make(chan struct{}) - me.conn, err = makeConn(me.Interface) - return -} - -func (me *Server) Close() { - close(me.closed) - me.sendByeBye() - me.conn.Close() -} - -func (me *Server) Serve() (err error) { - go me.serve() - for { - addrs, err := me.Interface.Addrs() - if err != nil { - return err - } - for _, addr := range addrs { - ip := func() net.IP { - switch val := addr.(type) { - case *net.IPNet: - return val.IP - case *net.IPAddr: - return val.IP - } - panic(fmt.Sprint("unexpected addr type:", addr)) - }() - extraHdrs := [][2]string{ - {"CACHE-CONTROL", fmt.Sprintf("max-age=%d", 5*me.NotifyInterval/2/time.Second)}, - {"LOCATION", me.Location(ip)}, - } - me.notifyAll(aliveNTS, extraHdrs) - } - time.Sleep(me.NotifyInterval) - } -} - -func (me *Server) usnFromTarget(target string) string { - if target == me.UUID { - return target - } - return me.UUID + "::" + target -} - -func (me *Server) makeNotifyMessage(target, nts string, extraHdrs [][2]string) []byte { - lines := [...][2]string{ - {"HOST", AddrString}, - {"NT", target}, - {"NTS", nts}, - {"SERVER", me.Server}, - {"USN", me.usnFromTarget(target)}, - } - buf := &bytes.Buffer{} - fmt.Fprint(buf, "NOTIFY * HTTP/1.1\r\n") - writeHdr := func(keyValue [2]string) { - fmt.Fprintf(buf, "%s: %s\r\n", keyValue[0], keyValue[1]) - } - for _, pair := range lines { - writeHdr(pair) - } - for _, pair := range extraHdrs { - writeHdr(pair) - } - fmt.Fprint(buf, "\r\n") - return buf.Bytes() -} - -func (me *Server) send(buf []byte, addr *net.UDPAddr) { - if n, err := me.conn.WriteToUDP(buf, addr); err != nil { - log.Printf("error writing to UDP socket: %s", err) - } else if n != len(buf) { - log.Printf("short write: %d/%d bytes", n, len(buf)) - } -} - -func (me *Server) delayedSend(delay time.Duration, buf []byte, addr *net.UDPAddr) { - go func() { - select { - case <-time.After(delay): - me.send(buf, addr) - case <-me.closed: - } - }() -} - -func (me *Server) log(args ...interface{}) { - args = append([]interface{}{me.Interface.Name + ":"}, args...) - log.Print(args...) -} - -func (me *Server) sendByeBye() { - for _, type_ := range me.allTypes() { - buf := me.makeNotifyMessage(type_, byebyeNTS, nil) - me.send(buf, NetAddr) - } -} - -func (me *Server) notifyAll(nts string, extraHdrs [][2]string) { - for _, type_ := range me.allTypes() { - buf := me.makeNotifyMessage(type_, nts, extraHdrs) - delay := time.Duration(rand.Int63n(int64(100 * time.Millisecond))) - me.delayedSend(delay, buf, NetAddr) - } -} - -func (me *Server) allTypes() (ret []string) { - for _, a := range [][]string{ - {rootDevice, me.UUID}, - me.Devices, - me.Services, - } { - ret = append(ret, a...) - } - return -} - -func (me *Server) handle(buf []byte, sender *net.UDPAddr) { - req, err := ReadRequest(bufio.NewReader(bytes.NewReader(buf))) - if err != nil { - log.Println(err) - return - } - if req.Method != "M-SEARCH" || req.Header.Get("man") != `"ssdp:discover"` { - return - } - var mx uint - if req.Header.Get("Host") == AddrString { - mxHeader := req.Header.Get("mx") - i, err := strconv.ParseUint(mxHeader, 0, 0) - if err != nil { - log.Printf("Invalid mx header %q: %s", mxHeader, err) - return - } - mx = uint(i) - } else { - mx = 1 - } - types := func(st string) []string { - if st == "ssdp:all" { - return me.allTypes() - } - for _, t := range me.allTypes() { - if t == st { - return []string{t} - } - } - return nil - }(req.Header.Get("st")) - for _, ip := range func() (ret []net.IP) { - addrs, err := me.Interface.Addrs() - if err != nil { - panic(err) - } - for _, addr := range addrs { - if ip, ok := func() (net.IP, bool) { - switch data := addr.(type) { - case *net.IPNet: - if data.Contains(sender.IP) { - return data.IP, true - } - return nil, false - case *net.IPAddr: - return data.IP, true - } - panic(addr) - }(); ok { - ret = append(ret, ip) - } - } - return - }() { - for _, type_ := range types { - resp := me.makeResponse(ip, type_, req) - delay := time.Duration(rand.Int63n(int64(time.Second) * int64(mx))) - me.delayedSend(delay, resp, sender) - } - } -} - -func (me *Server) makeResponse(ip net.IP, targ string, req *http.Request) (ret []byte) { - resp := &http.Response{ - StatusCode: 200, - ProtoMajor: 1, - ProtoMinor: 1, - Header: make(http.Header), - Request: req, - } - for _, pair := range [...][2]string{ - {"CACHE-CONTROL", fmt.Sprintf("max-age=%d", 5*me.NotifyInterval/2/time.Second)}, - {"EXT", ""}, - {"LOCATION", me.Location(ip)}, - {"SERVER", me.Server}, - {"ST", targ}, - {"USN", me.usnFromTarget(targ)}, - } { - resp.Header.Set(pair[0], pair[1]) - } - buf := &bytes.Buffer{} - if err := resp.Write(buf); err != nil { - panic(err) - } - return buf.Bytes() -} diff --git a/vendor/github.com/anacrolix/dms/upnp/eventing.go b/vendor/github.com/anacrolix/dms/upnp/eventing.go deleted file mode 100644 index 11cd88df5..000000000 --- a/vendor/github.com/anacrolix/dms/upnp/eventing.go +++ /dev/null @@ -1,91 +0,0 @@ -package upnp - -import ( - "crypto/rand" - "encoding/xml" - "fmt" - "io" - "log" - "net/url" - "regexp" - "time" -) - -// TODO: Why use namespace prefixes in PropertySet et al? Because the spec -// uses them, and I believe the Golang standard library XML spec implementers -// incorrectly assume that you can get away with just xmlns="". - -// propertyset is the root element sent in an event callback. -type PropertySet struct { - XMLName struct{} `xml:"e:propertyset"` - Properties []Property - // This should be set to `"urn:schemas-upnp-org:event-1-0"`. - Space string `xml:"xmlns:e,attr"` -} - -// propertys provide namespacing to the contained variables. -type Property struct { - XMLName struct{} `xml:"e:property"` - Variable Variable -} - -// Represents an evented state variable that has sendEvents="yes" in its -// service spec. -type Variable struct { - XMLName xml.Name - Value string `xml:",chardata"` -} - -type subscriber struct { - sid string - nextSeq uint32 // 0 for initial event, wraps from Uint32Max to 1. - urls []*url.URL - expiry time.Time -} - -// Intended to eventually be an embeddable implementation for managing -// eventing for a service. Not complete. -type Eventing struct { - subscribers map[string]*subscriber -} - -func (me *Eventing) Subscribe(callback []*url.URL, timeoutSeconds int) (sid string, actualTimeout int, err error) { - var uuid [16]byte - io.ReadFull(rand.Reader, uuid[:]) - sid = FormatUUID(uuid[:]) - if _, ok := me.subscribers[sid]; ok { - err = fmt.Errorf("already subscribed: %s", sid) - return - } - ssr := &subscriber{ - sid: sid, - urls: callback, - expiry: time.Now().Add(time.Duration(timeoutSeconds) * time.Second), - } - if me.subscribers == nil { - me.subscribers = make(map[string]*subscriber) - } - me.subscribers[sid] = ssr - actualTimeout = int(ssr.expiry.Sub(time.Now()) / time.Second) - return -} - -func (me *Eventing) Unsubscribe(sid string) error { - return nil -} - -var callbackURLRegexp = regexp.MustCompile("<(.*?)>") - -// Parse the CALLBACK HTTP header in an event subscription request. See UPnP -// Device Architecture 4.1.2. -func ParseCallbackURLs(callback string) (ret []*url.URL) { - for _, match := range callbackURLRegexp.FindAllStringSubmatch(callback, -1) { - _url, err := url.Parse(match[1]) - if err != nil { - log.Printf("bad callback url: %q", match[1]) - continue - } - ret = append(ret, _url) - } - return -} diff --git a/vendor/github.com/anacrolix/dms/upnp/upnp.go b/vendor/github.com/anacrolix/dms/upnp/upnp.go deleted file mode 100644 index 86cd5d86d..000000000 --- a/vendor/github.com/anacrolix/dms/upnp/upnp.go +++ /dev/null @@ -1,159 +0,0 @@ -package upnp - -import ( - "encoding/xml" - "errors" - "fmt" - "log" - "regexp" - "strconv" - "strings" -) - -var serviceURNRegexp *regexp.Regexp = regexp.MustCompile(`^urn:schemas-upnp-org:service:(\w+):(\d+)$`) - -type ServiceURN struct { - Type string - Version uint64 -} - -func (me ServiceURN) String() string { - return fmt.Sprintf("urn:schemas-upnp-org:service:%s:%d", me.Type, me.Version) -} - -func ParseServiceType(s string) (ret ServiceURN, err error) { - matches := serviceURNRegexp.FindStringSubmatch(s) - if matches == nil { - err = errors.New(s) - return - } - if len(matches) != 3 { - log.Panicf("Invalid serviceURNRegexp ?") - } - ret.Type = matches[1] - ret.Version, err = strconv.ParseUint(matches[2], 0, 0) - return -} - -type SoapAction struct { - ServiceURN - Action string -} - -func ParseActionHTTPHeader(s string) (ret SoapAction, err error) { - if s[0] != '"' || s[len(s)-1] != '"' { - return - } - s = s[1 : len(s)-1] - hashIndex := strings.LastIndex(s, "#") - if hashIndex == -1 { - return - } - ret.Action = s[hashIndex+1:] - ret.ServiceURN, err = ParseServiceType(s[:hashIndex]) - return -} - -type SpecVersion struct { - Major int `xml:"major"` - Minor int `xml:"minor"` -} - -type Icon struct { - Mimetype string `xml:"mimetype"` - Width int `xml:"width"` - Height int `xml:"height"` - Depth int `xml:"depth"` - URL string `xml:"url"` -} - -type Service struct { - XMLName xml.Name `xml:"service"` - ServiceType string `xml:"serviceType"` - ServiceId string `xml:"serviceId"` - SCPDURL string - ControlURL string `xml:"controlURL"` - EventSubURL string `xml:"eventSubURL"` -} - -type Device struct { - DeviceType string `xml:"deviceType"` - FriendlyName string `xml:"friendlyName"` - Manufacturer string `xml:"manufacturer"` - ModelName string `xml:"modelName"` - UDN string - IconList []Icon `xml:"iconList>icon"` - ServiceList []Service `xml:"serviceList>service"` -} - -type DeviceDesc struct { - XMLName xml.Name `xml:"urn:schemas-upnp-org:device-1-0 root"` - SpecVersion SpecVersion `xml:"specVersion"` - Device Device `xml:"device"` -} - -type Error struct { - XMLName xml.Name `xml:"urn:schemas-upnp-org:control-1-0 UPnPError"` - Code uint `xml:"errorCode"` - Desc string `xml:"errorDescription"` -} - -func (e *Error) Error() string { - return fmt.Sprintf("%d %s", e.Code, e.Desc) -} - -const ( - InvalidActionErrorCode = 401 - ActionFailedErrorCode = 501 - ArgumentValueInvalidErrorCode = 600 -) - -var ( - InvalidActionError = Errorf(401, "Invalid Action") - ArgumentValueInvalidError = Errorf(600, "The argument value is invalid") -) - -// Errorf creates an UPNP error from the given code and description -func Errorf(code uint, tpl string, args ...interface{}) *Error { - return &Error{Code: code, Desc: fmt.Sprintf(tpl, args...)} -} - -// ConvertError converts any error to an UPNP error -func ConvertError(err error) *Error { - if err == nil { - return nil - } - if e, ok := err.(*Error); ok { - return e - } - return Errorf(ActionFailedErrorCode, err.Error()) -} - -type Action struct { - Name string - Arguments []Argument -} - -type Argument struct { - Name string - Direction string - RelatedStateVar string -} - -type SCPD struct { - XMLName xml.Name `xml:"urn:schemas-upnp-org:service-1-0 scpd"` - SpecVersion SpecVersion `xml:"specVersion"` - ActionList []Action `xml:"actionList>action"` - ServiceStateTable []StateVariable `xml:"serviceStateTable>stateVariable"` -} - -type StateVariable struct { - SendEvents string `xml:"sendEvents,attr"` - Name string `xml:"name"` - DataType string `xml:"dataType"` - AllowedValues *[]string `xml:"allowedValueList>allowedValue,omitempty"` -} - -func FormatUUID(buf []byte) string { - return fmt.Sprintf("uuid:%x-%x-%x-%x-%x", buf[:4], buf[4:6], buf[6:8], buf[8:10], buf[10:16]) -} diff --git a/vendor/github.com/atotto/clipboard/.travis.yml b/vendor/github.com/atotto/clipboard/.travis.yml deleted file mode 100644 index 5bd5ae3b2..000000000 --- a/vendor/github.com/atotto/clipboard/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go - -go: - - go1.4.3 - - go1.5.4 - - go1.6.4 - - go1.7.6 - - go1.8.7 - - go1.9.4 - - go1.10 - -before_install: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - -script: - - sudo apt-get install xsel - - go test -v . - - sudo apt-get install xclip - - go test -v . diff --git a/vendor/github.com/atotto/clipboard/LICENSE b/vendor/github.com/atotto/clipboard/LICENSE deleted file mode 100644 index dee3257b0..000000000 --- a/vendor/github.com/atotto/clipboard/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 Ato Araki. 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 @atotto. 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/atotto/clipboard/README.md b/vendor/github.com/atotto/clipboard/README.md deleted file mode 100644 index 41fdd57b8..000000000 --- a/vendor/github.com/atotto/clipboard/README.md +++ /dev/null @@ -1,48 +0,0 @@ -[![Build Status](https://travis-ci.org/atotto/clipboard.svg?branch=master)](https://travis-ci.org/atotto/clipboard) - -[![GoDoc](https://godoc.org/github.com/atotto/clipboard?status.svg)](http://godoc.org/github.com/atotto/clipboard) - -# Clipboard for Go - -Provide copying and pasting to the Clipboard for Go. - -Build: - - $ go get github.com/atotto/clipboard - -Platforms: - -* OSX -* Windows 7 (probably work on other Windows) -* Linux, Unix (requires 'xclip' or 'xsel' command to be installed) - - -Document: - -* http://godoc.org/github.com/atotto/clipboard - -Notes: - -* Text string only -* UTF-8 text encoding only (no conversion) - -TODO: - -* Clipboard watcher(?) - -## Commands: - -paste shell command: - - $ go get github.com/atotto/clipboard/cmd/gopaste - $ # example: - $ gopaste > document.txt - -copy shell command: - - $ go get github.com/atotto/clipboard/cmd/gocopy - $ # example: - $ cat document.txt | gocopy - - - diff --git a/vendor/github.com/atotto/clipboard/clipboard.go b/vendor/github.com/atotto/clipboard/clipboard.go deleted file mode 100644 index d7907d3a7..000000000 --- a/vendor/github.com/atotto/clipboard/clipboard.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013 @atotto. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package clipboard read/write on clipboard -package clipboard - -// ReadAll read string from clipboard -func ReadAll() (string, error) { - return readAll() -} - -// WriteAll write string to clipboard -func WriteAll(text string) error { - return writeAll(text) -} - -// Unsupported might be set true during clipboard init, to help callers decide -// whether or not to offer clipboard options. -var Unsupported bool diff --git a/vendor/github.com/atotto/clipboard/clipboard_darwin.go b/vendor/github.com/atotto/clipboard/clipboard_darwin.go deleted file mode 100644 index 6f33078db..000000000 --- a/vendor/github.com/atotto/clipboard/clipboard_darwin.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2013 @atotto. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin - -package clipboard - -import ( - "os/exec" -) - -var ( - pasteCmdArgs = "pbpaste" - copyCmdArgs = "pbcopy" -) - -func getPasteCommand() *exec.Cmd { - return exec.Command(pasteCmdArgs) -} - -func getCopyCommand() *exec.Cmd { - return exec.Command(copyCmdArgs) -} - -func readAll() (string, error) { - pasteCmd := getPasteCommand() - out, err := pasteCmd.Output() - if err != nil { - return "", err - } - return string(out), nil -} - -func writeAll(text string) error { - copyCmd := getCopyCommand() - in, err := copyCmd.StdinPipe() - if err != nil { - return err - } - - if err := copyCmd.Start(); err != nil { - return err - } - if _, err := in.Write([]byte(text)); err != nil { - return err - } - if err := in.Close(); err != nil { - return err - } - return copyCmd.Wait() -} diff --git a/vendor/github.com/atotto/clipboard/clipboard_unix.go b/vendor/github.com/atotto/clipboard/clipboard_unix.go deleted file mode 100644 index 8f5e23c37..000000000 --- a/vendor/github.com/atotto/clipboard/clipboard_unix.go +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2013 @atotto. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build freebsd linux netbsd openbsd solaris dragonfly - -package clipboard - -import ( - "errors" - "os" - "os/exec" -) - -const ( - xsel = "xsel" - xclip = "xclip" - wlcopy = "wl-copy" - wlpaste = "wl-paste" - termuxClipboardGet = "termux-clipboard-get" - termuxClipboardSet = "termux-clipboard-set" -) - -var ( - Primary bool - - pasteCmdArgs []string - copyCmdArgs []string - - xselPasteArgs = []string{xsel, "--output", "--clipboard"} - xselCopyArgs = []string{xsel, "--input", "--clipboard"} - - xclipPasteArgs = []string{xclip, "-out", "-selection", "clipboard"} - xclipCopyArgs = []string{xclip, "-in", "-selection", "clipboard"} - - wlpasteArgs = []string{wlpaste, "--no-newline"} - wlcopyArgs = []string{wlcopy} - - termuxPasteArgs = []string{termuxClipboardGet} - termuxCopyArgs = []string{termuxClipboardSet} - - missingCommands = errors.New("No clipboard utilities available. Please install xsel, xclip, wl-clipboard or Termux:API add-on for termux-clipboard-get/set.") -) - -func init() { - if os.Getenv("WAYLAND_DISPLAY") != "" { - pasteCmdArgs = wlpasteArgs; - copyCmdArgs = wlcopyArgs; - - if _, err := exec.LookPath(wlcopy); err == nil { - if _, err := exec.LookPath(wlpaste); err == nil { - return - } - } - } - - pasteCmdArgs = xclipPasteArgs - copyCmdArgs = xclipCopyArgs - - if _, err := exec.LookPath(xclip); err == nil { - return - } - - pasteCmdArgs = xselPasteArgs - copyCmdArgs = xselCopyArgs - - if _, err := exec.LookPath(xsel); err == nil { - return - } - - pasteCmdArgs = termuxPasteArgs - copyCmdArgs = termuxCopyArgs - - if _, err := exec.LookPath(termuxClipboardSet); err == nil { - if _, err := exec.LookPath(termuxClipboardGet); err == nil { - return - } - } - - Unsupported = true -} - -func getPasteCommand() *exec.Cmd { - if Primary { - pasteCmdArgs = pasteCmdArgs[:1] - } - return exec.Command(pasteCmdArgs[0], pasteCmdArgs[1:]...) -} - -func getCopyCommand() *exec.Cmd { - if Primary { - copyCmdArgs = copyCmdArgs[:1] - } - return exec.Command(copyCmdArgs[0], copyCmdArgs[1:]...) -} - -func readAll() (string, error) { - if Unsupported { - return "", missingCommands - } - pasteCmd := getPasteCommand() - out, err := pasteCmd.Output() - if err != nil { - return "", err - } - return string(out), nil -} - -func writeAll(text string) error { - if Unsupported { - return missingCommands - } - copyCmd := getCopyCommand() - in, err := copyCmd.StdinPipe() - if err != nil { - return err - } - - if err := copyCmd.Start(); err != nil { - return err - } - if _, err := in.Write([]byte(text)); err != nil { - return err - } - if err := in.Close(); err != nil { - return err - } - return copyCmd.Wait() -} diff --git a/vendor/github.com/atotto/clipboard/clipboard_windows.go b/vendor/github.com/atotto/clipboard/clipboard_windows.go deleted file mode 100644 index 4b4aedb66..000000000 --- a/vendor/github.com/atotto/clipboard/clipboard_windows.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2013 @atotto. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows - -package clipboard - -import ( - "syscall" - "time" - "unsafe" -) - -const ( - cfUnicodetext = 13 - gmemMoveable = 0x0002 -) - -var ( - user32 = syscall.MustLoadDLL("user32") - openClipboard = user32.MustFindProc("OpenClipboard") - closeClipboard = user32.MustFindProc("CloseClipboard") - emptyClipboard = user32.MustFindProc("EmptyClipboard") - getClipboardData = user32.MustFindProc("GetClipboardData") - setClipboardData = user32.MustFindProc("SetClipboardData") - - kernel32 = syscall.NewLazyDLL("kernel32") - globalAlloc = kernel32.NewProc("GlobalAlloc") - globalFree = kernel32.NewProc("GlobalFree") - globalLock = kernel32.NewProc("GlobalLock") - globalUnlock = kernel32.NewProc("GlobalUnlock") - lstrcpy = kernel32.NewProc("lstrcpyW") -) - -// waitOpenClipboard opens the clipboard, waiting for up to a second to do so. -func waitOpenClipboard() error { - started := time.Now() - limit := started.Add(time.Second) - var r uintptr - var err error - for time.Now().Before(limit) { - r, _, err = openClipboard.Call(0) - if r != 0 { - return nil - } - time.Sleep(time.Millisecond) - } - return err -} - -func readAll() (string, error) { - err := waitOpenClipboard() - if err != nil { - return "", err - } - defer closeClipboard.Call() - - h, _, err := getClipboardData.Call(cfUnicodetext) - if h == 0 { - return "", err - } - - l, _, err := globalLock.Call(h) - if l == 0 { - return "", err - } - - text := syscall.UTF16ToString((*[1 << 20]uint16)(unsafe.Pointer(l))[:]) - - r, _, err := globalUnlock.Call(h) - if r == 0 { - return "", err - } - - return text, nil -} - -func writeAll(text string) error { - err := waitOpenClipboard() - if err != nil { - return err - } - defer closeClipboard.Call() - - r, _, err := emptyClipboard.Call(0) - if r == 0 { - return err - } - - data := syscall.StringToUTF16(text) - - // "If the hMem parameter identifies a memory object, the object must have - // been allocated using the function with the GMEM_MOVEABLE flag." - h, _, err := globalAlloc.Call(gmemMoveable, uintptr(len(data)*int(unsafe.Sizeof(data[0])))) - if h == 0 { - return err - } - defer func() { - if h != 0 { - globalFree.Call(h) - } - }() - - l, _, err := globalLock.Call(h) - if l == 0 { - return err - } - - r, _, err = lstrcpy.Call(l, uintptr(unsafe.Pointer(&data[0]))) - if r == 0 { - return err - } - - r, _, err = globalUnlock.Call(h) - if r == 0 { - if err.(syscall.Errno) != 0 { - return err - } - } - - r, _, err = setClipboardData.Call(cfUnicodetext, h) - if r == 0 { - return err - } - h = 0 // suppress deferred cleanup - return nil -} diff --git a/vendor/github.com/atotto/clipboard/go.mod b/vendor/github.com/atotto/clipboard/go.mod deleted file mode 100644 index 68ec980e7..000000000 --- a/vendor/github.com/atotto/clipboard/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/atotto/clipboard diff --git a/vendor/github.com/aws/aws-sdk-go/LICENSE.txt b/vendor/github.com/aws/aws-sdk-go/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/aws/aws-sdk-go/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt deleted file mode 100644 index 899129ecc..000000000 --- a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt +++ /dev/null @@ -1,3 +0,0 @@ -AWS SDK for Go -Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. -Copyright 2014-2015 Stripe, Inc. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go b/vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go deleted file mode 100644 index 1c4967429..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/arn/arn.go +++ /dev/null @@ -1,93 +0,0 @@ -// Package arn provides a parser for interacting with Amazon Resource Names. -package arn - -import ( - "errors" - "strings" -) - -const ( - arnDelimiter = ":" - arnSections = 6 - arnPrefix = "arn:" - - // zero-indexed - sectionPartition = 1 - sectionService = 2 - sectionRegion = 3 - sectionAccountID = 4 - sectionResource = 5 - - // errors - invalidPrefix = "arn: invalid prefix" - invalidSections = "arn: not enough sections" -) - -// ARN captures the individual fields of an Amazon Resource Name. -// See http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html for more information. -type ARN struct { - // The partition that the resource is in. For standard AWS regions, the partition is "aws". If you have resources in - // other partitions, the partition is "aws-partitionname". For example, the partition for resources in the China - // (Beijing) region is "aws-cn". - Partition string - - // The service namespace that identifies the AWS product (for example, Amazon S3, IAM, or Amazon RDS). For a list of - // namespaces, see - // http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces. - Service string - - // The region the resource resides in. Note that the ARNs for some resources do not require a region, so this - // component might be omitted. - Region string - - // The ID of the AWS account that owns the resource, without the hyphens. For example, 123456789012. Note that the - // ARNs for some resources don't require an account number, so this component might be omitted. - AccountID string - - // The content of this part of the ARN varies by service. It often includes an indicator of the type of resource — - // for example, an IAM user or Amazon RDS database - followed by a slash (/) or a colon (:), followed by the - // resource name itself. Some services allows paths for resource names, as described in - // http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arns-paths. - Resource string -} - -// Parse parses an ARN into its constituent parts. -// -// Some example ARNs: -// arn:aws:elasticbeanstalk:us-east-1:123456789012:environment/My App/MyEnvironment -// arn:aws:iam::123456789012:user/David -// arn:aws:rds:eu-west-1:123456789012:db:mysql-db -// arn:aws:s3:::my_corporate_bucket/exampleobject.png -func Parse(arn string) (ARN, error) { - if !strings.HasPrefix(arn, arnPrefix) { - return ARN{}, errors.New(invalidPrefix) - } - sections := strings.SplitN(arn, arnDelimiter, arnSections) - if len(sections) != arnSections { - return ARN{}, errors.New(invalidSections) - } - return ARN{ - Partition: sections[sectionPartition], - Service: sections[sectionService], - Region: sections[sectionRegion], - AccountID: sections[sectionAccountID], - Resource: sections[sectionResource], - }, nil -} - -// IsARN returns whether the given string is an ARN by looking for -// whether the string starts with "arn:" and contains the correct number -// of sections delimited by colons(:). -func IsARN(arn string) bool { - return strings.HasPrefix(arn, arnPrefix) && strings.Count(arn, ":") >= arnSections-1 -} - -// String returns the canonical representation of the ARN -func (arn ARN) String() string { - return arnPrefix + - arn.Partition + arnDelimiter + - arn.Service + arnDelimiter + - arn.Region + arnDelimiter + - arn.AccountID + arnDelimiter + - arn.Resource -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go deleted file mode 100644 index 99849c0e1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ /dev/null @@ -1,164 +0,0 @@ -// Package awserr represents API error interface accessors for the SDK. -package awserr - -// An Error wraps lower level errors with code, message and an original error. -// The underlying concrete error type may also satisfy other interfaces which -// can be to used to obtain more specific information about the error. -// -// Calling Error() or String() will always include the full information about -// an error based on its underlying type. -// -// Example: -// -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if awsErr, ok := err.(awserr.Error); ok { -// // Get error details -// log.Println("Error:", awsErr.Code(), awsErr.Message()) -// -// // Prints out full error message, including original error if there was one. -// log.Println("Error:", awsErr.Error()) -// -// // Get original error -// if origErr := awsErr.OrigErr(); origErr != nil { -// // operate on original error. -// } -// } else { -// fmt.Println(err.Error()) -// } -// } -// -type Error interface { - // Satisfy the generic error interface. - error - - // Returns the short phrase depicting the classification of the error. - Code() string - - // Returns the error details message. - Message() string - - // Returns the original error if one was set. Nil is returned if not set. - OrigErr() error -} - -// BatchError is a batch of errors which also wraps lower level errors with -// code, message, and original errors. Calling Error() will include all errors -// that occurred in the batch. -// -// Deprecated: Replaced with BatchedErrors. Only defined for backwards -// compatibility. -type BatchError interface { - // Satisfy the generic error interface. - error - - // Returns the short phrase depicting the classification of the error. - Code() string - - // Returns the error details message. - Message() string - - // Returns the original error if one was set. Nil is returned if not set. - OrigErrs() []error -} - -// BatchedErrors is a batch of errors which also wraps lower level errors with -// code, message, and original errors. Calling Error() will include all errors -// that occurred in the batch. -// -// Replaces BatchError -type BatchedErrors interface { - // Satisfy the base Error interface. - Error - - // Returns the original error if one was set. Nil is returned if not set. - OrigErrs() []error -} - -// New returns an Error object described by the code, message, and origErr. -// -// If origErr satisfies the Error interface it will not be wrapped within a new -// Error object and will instead be returned. -func New(code, message string, origErr error) Error { - var errs []error - if origErr != nil { - errs = append(errs, origErr) - } - return newBaseError(code, message, errs) -} - -// NewBatchError returns an BatchedErrors with a collection of errors as an -// array of errors. -func NewBatchError(code, message string, errs []error) BatchedErrors { - return newBaseError(code, message, errs) -} - -// A RequestFailure is an interface to extract request failure information from -// an Error such as the request ID of the failed request returned by a service. -// RequestFailures may not always have a requestID value if the request failed -// prior to reaching the service such as a connection error. -// -// Example: -// -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if reqerr, ok := err.(RequestFailure); ok { -// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) -// } else { -// log.Println("Error:", err.Error()) -// } -// } -// -// Combined with awserr.Error: -// -// output, err := s3manage.Upload(svc, input, opts) -// if err != nil { -// if awsErr, ok := err.(awserr.Error); ok { -// // Generic AWS Error with Code, Message, and original error (if any) -// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) -// -// if reqErr, ok := err.(awserr.RequestFailure); ok { -// // A service error occurred -// fmt.Println(reqErr.StatusCode(), reqErr.RequestID()) -// } -// } else { -// fmt.Println(err.Error()) -// } -// } -// -type RequestFailure interface { - Error - - // The status code of the HTTP response. - StatusCode() int - - // The request ID returned by the service for a request failure. This will - // be empty if no request ID is available such as the request failed due - // to a connection error. - RequestID() string -} - -// NewRequestFailure returns a wrapped error with additional information for -// request status code, and service requestID. -// -// Should be used to wrap all request which involve service requests. Even if -// the request failed without a service response, but had an HTTP status code -// that may be meaningful. -func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { - return newRequestError(err, statusCode, reqID) -} - -// UnmarshalError provides the interface for the SDK failing to unmarshal data. -type UnmarshalError interface { - awsError - Bytes() []byte -} - -// NewUnmarshalError returns an initialized UnmarshalError error wrapper adding -// the bytes that fail to unmarshal to the error. -func NewUnmarshalError(err error, msg string, bytes []byte) UnmarshalError { - return &unmarshalError{ - awsError: New("UnmarshalError", msg, err), - bytes: bytes, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go deleted file mode 100644 index 9cf7eaf40..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ /dev/null @@ -1,221 +0,0 @@ -package awserr - -import ( - "encoding/hex" - "fmt" -) - -// SprintError returns a string of the formatted error code. -// -// Both extra and origErr are optional. If they are included their lines -// will be added, but if they are not included their lines will be ignored. -func SprintError(code, message, extra string, origErr error) string { - msg := fmt.Sprintf("%s: %s", code, message) - if extra != "" { - msg = fmt.Sprintf("%s\n\t%s", msg, extra) - } - if origErr != nil { - msg = fmt.Sprintf("%s\ncaused by: %s", msg, origErr.Error()) - } - return msg -} - -// A baseError wraps the code and message which defines an error. It also -// can be used to wrap an original error object. -// -// Should be used as the root for errors satisfying the awserr.Error. Also -// for any error which does not fit into a specific error wrapper type. -type baseError struct { - // Classification of error - code string - - // Detailed information about error - message string - - // Optional original error this error is based off of. Allows building - // chained errors. - errs []error -} - -// newBaseError returns an error object for the code, message, and errors. -// -// code is a short no whitespace phrase depicting the classification of -// the error that is being created. -// -// message is the free flow string containing detailed information about the -// error. -// -// origErrs is the error objects which will be nested under the new errors to -// be returned. -func newBaseError(code, message string, origErrs []error) *baseError { - b := &baseError{ - code: code, - message: message, - errs: origErrs, - } - - return b -} - -// Error returns the string representation of the error. -// -// See ErrorWithExtra for formatting. -// -// Satisfies the error interface. -func (b baseError) Error() string { - size := len(b.errs) - if size > 0 { - return SprintError(b.code, b.message, "", errorList(b.errs)) - } - - return SprintError(b.code, b.message, "", nil) -} - -// String returns the string representation of the error. -// Alias for Error to satisfy the stringer interface. -func (b baseError) String() string { - return b.Error() -} - -// Code returns the short phrase depicting the classification of the error. -func (b baseError) Code() string { - return b.code -} - -// Message returns the error details message. -func (b baseError) Message() string { - return b.message -} - -// OrigErr returns the original error if one was set. Nil is returned if no -// error was set. This only returns the first element in the list. If the full -// list is needed, use BatchedErrors. -func (b baseError) OrigErr() error { - switch len(b.errs) { - case 0: - return nil - case 1: - return b.errs[0] - default: - if err, ok := b.errs[0].(Error); ok { - return NewBatchError(err.Code(), err.Message(), b.errs[1:]) - } - return NewBatchError("BatchedErrors", - "multiple errors occurred", b.errs) - } -} - -// OrigErrs returns the original errors if one was set. An empty slice is -// returned if no error was set. -func (b baseError) OrigErrs() []error { - return b.errs -} - -// So that the Error interface type can be included as an anonymous field -// in the requestError struct and not conflict with the error.Error() method. -type awsError Error - -// A requestError wraps a request or service error. -// -// Composed of baseError for code, message, and original error. -type requestError struct { - awsError - statusCode int - requestID string - bytes []byte -} - -// newRequestError returns a wrapped error with additional information for -// request status code, and service requestID. -// -// Should be used to wrap all request which involve service requests. Even if -// the request failed without a service response, but had an HTTP status code -// that may be meaningful. -// -// Also wraps original errors via the baseError. -func newRequestError(err Error, statusCode int, requestID string) *requestError { - return &requestError{ - awsError: err, - statusCode: statusCode, - requestID: requestID, - } -} - -// Error returns the string representation of the error. -// Satisfies the error interface. -func (r requestError) Error() string { - extra := fmt.Sprintf("status code: %d, request id: %s", - r.statusCode, r.requestID) - return SprintError(r.Code(), r.Message(), extra, r.OrigErr()) -} - -// String returns the string representation of the error. -// Alias for Error to satisfy the stringer interface. -func (r requestError) String() string { - return r.Error() -} - -// StatusCode returns the wrapped status code for the error -func (r requestError) StatusCode() int { - return r.statusCode -} - -// RequestID returns the wrapped requestID -func (r requestError) RequestID() string { - return r.requestID -} - -// OrigErrs returns the original errors if one was set. An empty slice is -// returned if no error was set. -func (r requestError) OrigErrs() []error { - if b, ok := r.awsError.(BatchedErrors); ok { - return b.OrigErrs() - } - return []error{r.OrigErr()} -} - -type unmarshalError struct { - awsError - bytes []byte -} - -// Error returns the string representation of the error. -// Satisfies the error interface. -func (e unmarshalError) Error() string { - extra := hex.Dump(e.bytes) - return SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -} - -// String returns the string representation of the error. -// Alias for Error to satisfy the stringer interface. -func (e unmarshalError) String() string { - return e.Error() -} - -// Bytes returns the bytes that failed to unmarshal. -func (e unmarshalError) Bytes() []byte { - return e.bytes -} - -// An error list that satisfies the golang interface -type errorList []error - -// Error returns the string representation of the error. -// -// Satisfies the error interface. -func (e errorList) Error() string { - msg := "" - // How do we want to handle the array size being zero - if size := len(e); size > 0 { - for i := 0; i < size; i++ { - msg += e[i].Error() - // We check the next index to see if it is within the slice. - // If it is, then we append a newline. We do this, because unit tests - // could be broken with the additional '\n' - if i+1 < size { - msg += "\n" - } - } - } - return msg -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go deleted file mode 100644 index 1a3d106d5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go +++ /dev/null @@ -1,108 +0,0 @@ -package awsutil - -import ( - "io" - "reflect" - "time" -) - -// Copy deeply copies a src structure to dst. Useful for copying request and -// response structures. -// -// Can copy between structs of different type, but will only copy fields which -// are assignable, and exist in both structs. Fields which are not assignable, -// or do not exist in both structs are ignored. -func Copy(dst, src interface{}) { - dstval := reflect.ValueOf(dst) - if !dstval.IsValid() { - panic("Copy dst cannot be nil") - } - - rcopy(dstval, reflect.ValueOf(src), true) -} - -// CopyOf returns a copy of src while also allocating the memory for dst. -// src must be a pointer type or this operation will fail. -func CopyOf(src interface{}) (dst interface{}) { - dsti := reflect.New(reflect.TypeOf(src).Elem()) - dst = dsti.Interface() - rcopy(dsti, reflect.ValueOf(src), true) - return -} - -// rcopy performs a recursive copy of values from the source to destination. -// -// root is used to skip certain aspects of the copy which are not valid -// for the root node of a object. -func rcopy(dst, src reflect.Value, root bool) { - if !src.IsValid() { - return - } - - switch src.Kind() { - case reflect.Ptr: - if _, ok := src.Interface().(io.Reader); ok { - if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { - dst.Elem().Set(src) - } else if dst.CanSet() { - dst.Set(src) - } - } else { - e := src.Type().Elem() - if dst.CanSet() && !src.IsNil() { - if _, ok := src.Interface().(*time.Time); !ok { - dst.Set(reflect.New(e)) - } else { - tempValue := reflect.New(e) - tempValue.Elem().Set(src.Elem()) - // Sets time.Time's unexported values - dst.Set(tempValue) - } - } - if src.Elem().IsValid() { - // Keep the current root state since the depth hasn't changed - rcopy(dst.Elem(), src.Elem(), root) - } - } - case reflect.Struct: - t := dst.Type() - for i := 0; i < t.NumField(); i++ { - name := t.Field(i).Name - srcVal := src.FieldByName(name) - dstVal := dst.FieldByName(name) - if srcVal.IsValid() && dstVal.CanSet() { - rcopy(dstVal, srcVal, false) - } - } - case reflect.Slice: - if src.IsNil() { - break - } - - s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) - dst.Set(s) - for i := 0; i < src.Len(); i++ { - rcopy(dst.Index(i), src.Index(i), false) - } - case reflect.Map: - if src.IsNil() { - break - } - - s := reflect.MakeMap(src.Type()) - dst.Set(s) - for _, k := range src.MapKeys() { - v := src.MapIndex(k) - v2 := reflect.New(v.Type()).Elem() - rcopy(v2, v, false) - dst.SetMapIndex(k, v2) - } - default: - // Assign the value if possible. If its not assignable, the value would - // need to be converted and the impact of that may be unexpected, or is - // not compatible with the dst type. - if src.Type().AssignableTo(dst.Type()) { - dst.Set(src) - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go deleted file mode 100644 index 142a7a01c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go +++ /dev/null @@ -1,27 +0,0 @@ -package awsutil - -import ( - "reflect" -) - -// DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. -// In addition to this, this method will also dereference the input values if -// possible so the DeepEqual performed will not fail if one parameter is a -// pointer and the other is not. -// -// DeepEqual will not perform indirection of nested values of the input parameters. -func DeepEqual(a, b interface{}) bool { - ra := reflect.Indirect(reflect.ValueOf(a)) - rb := reflect.Indirect(reflect.ValueOf(b)) - - if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { - // If the elements are both nil, and of the same type they are equal - // If they are of different types they are not equal - return reflect.TypeOf(a) == reflect.TypeOf(b) - } else if raValid != rbValid { - // Both values must be valid to be equal - return false - } - - return reflect.DeepEqual(ra.Interface(), rb.Interface()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go deleted file mode 100644 index a4eb6a7f4..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go +++ /dev/null @@ -1,221 +0,0 @@ -package awsutil - -import ( - "reflect" - "regexp" - "strconv" - "strings" - - "github.com/jmespath/go-jmespath" -) - -var indexRe = regexp.MustCompile(`(.+)\[(-?\d+)?\]$`) - -// rValuesAtPath returns a slice of values found in value v. The values -// in v are explored recursively so all nested values are collected. -func rValuesAtPath(v interface{}, path string, createPath, caseSensitive, nilTerm bool) []reflect.Value { - pathparts := strings.Split(path, "||") - if len(pathparts) > 1 { - for _, pathpart := range pathparts { - vals := rValuesAtPath(v, pathpart, createPath, caseSensitive, nilTerm) - if len(vals) > 0 { - return vals - } - } - return nil - } - - values := []reflect.Value{reflect.Indirect(reflect.ValueOf(v))} - components := strings.Split(path, ".") - for len(values) > 0 && len(components) > 0 { - var index *int64 - var indexStar bool - c := strings.TrimSpace(components[0]) - if c == "" { // no actual component, illegal syntax - return nil - } else if caseSensitive && c != "*" && strings.ToLower(c[0:1]) == c[0:1] { - // TODO normalize case for user - return nil // don't support unexported fields - } - - // parse this component - if m := indexRe.FindStringSubmatch(c); m != nil { - c = m[1] - if m[2] == "" { - index = nil - indexStar = true - } else { - i, _ := strconv.ParseInt(m[2], 10, 32) - index = &i - indexStar = false - } - } - - nextvals := []reflect.Value{} - for _, value := range values { - // pull component name out of struct member - if value.Kind() != reflect.Struct { - continue - } - - if c == "*" { // pull all members - for i := 0; i < value.NumField(); i++ { - if f := reflect.Indirect(value.Field(i)); f.IsValid() { - nextvals = append(nextvals, f) - } - } - continue - } - - value = value.FieldByNameFunc(func(name string) bool { - if c == name { - return true - } else if !caseSensitive && strings.EqualFold(name, c) { - return true - } - return false - }) - - if nilTerm && value.Kind() == reflect.Ptr && len(components[1:]) == 0 { - if !value.IsNil() { - value.Set(reflect.Zero(value.Type())) - } - return []reflect.Value{value} - } - - if createPath && value.Kind() == reflect.Ptr && value.IsNil() { - // TODO if the value is the terminus it should not be created - // if the value to be set to its position is nil. - value.Set(reflect.New(value.Type().Elem())) - value = value.Elem() - } else { - value = reflect.Indirect(value) - } - - if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { - if !createPath && value.IsNil() { - value = reflect.ValueOf(nil) - } - } - - if value.IsValid() { - nextvals = append(nextvals, value) - } - } - values = nextvals - - if indexStar || index != nil { - nextvals = []reflect.Value{} - for _, valItem := range values { - value := reflect.Indirect(valItem) - if value.Kind() != reflect.Slice { - continue - } - - if indexStar { // grab all indices - for i := 0; i < value.Len(); i++ { - idx := reflect.Indirect(value.Index(i)) - if idx.IsValid() { - nextvals = append(nextvals, idx) - } - } - continue - } - - // pull out index - i := int(*index) - if i >= value.Len() { // check out of bounds - if createPath { - // TODO resize slice - } else { - continue - } - } else if i < 0 { // support negative indexing - i = value.Len() + i - } - value = reflect.Indirect(value.Index(i)) - - if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { - if !createPath && value.IsNil() { - value = reflect.ValueOf(nil) - } - } - - if value.IsValid() { - nextvals = append(nextvals, value) - } - } - values = nextvals - } - - components = components[1:] - } - return values -} - -// ValuesAtPath returns a list of values at the case insensitive lexical -// path inside of a structure. -func ValuesAtPath(i interface{}, path string) ([]interface{}, error) { - result, err := jmespath.Search(path, i) - if err != nil { - return nil, err - } - - v := reflect.ValueOf(result) - if !v.IsValid() || (v.Kind() == reflect.Ptr && v.IsNil()) { - return nil, nil - } - if s, ok := result.([]interface{}); ok { - return s, err - } - if v.Kind() == reflect.Map && v.Len() == 0 { - return nil, nil - } - if v.Kind() == reflect.Slice { - out := make([]interface{}, v.Len()) - for i := 0; i < v.Len(); i++ { - out[i] = v.Index(i).Interface() - } - return out, nil - } - - return []interface{}{result}, nil -} - -// SetValueAtPath sets a value at the case insensitive lexical path inside -// of a structure. -func SetValueAtPath(i interface{}, path string, v interface{}) { - rvals := rValuesAtPath(i, path, true, false, v == nil) - for _, rval := range rvals { - if rval.Kind() == reflect.Ptr && rval.IsNil() { - continue - } - setValue(rval, v) - } -} - -func setValue(dstVal reflect.Value, src interface{}) { - if dstVal.Kind() == reflect.Ptr { - dstVal = reflect.Indirect(dstVal) - } - srcVal := reflect.ValueOf(src) - - if !srcVal.IsValid() { // src is literal nil - if dstVal.CanAddr() { - // Convert to pointer so that pointer's value can be nil'ed - // dstVal = dstVal.Addr() - } - dstVal.Set(reflect.Zero(dstVal.Type())) - - } else if srcVal.Kind() == reflect.Ptr { - if srcVal.IsNil() { - srcVal = reflect.Zero(dstVal.Type()) - } else { - srcVal = reflect.ValueOf(src).Elem() - } - dstVal.Set(srcVal) - } else { - dstVal.Set(srcVal) - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go deleted file mode 100644 index 710eb432f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go +++ /dev/null @@ -1,113 +0,0 @@ -package awsutil - -import ( - "bytes" - "fmt" - "io" - "reflect" - "strings" -) - -// Prettify returns the string representation of a value. -func Prettify(i interface{}) string { - var buf bytes.Buffer - prettify(reflect.ValueOf(i), 0, &buf) - return buf.String() -} - -// prettify will recursively walk value v to build a textual -// representation of the value. -func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { - for v.Kind() == reflect.Ptr { - v = v.Elem() - } - - switch v.Kind() { - case reflect.Struct: - strtype := v.Type().String() - if strtype == "time.Time" { - fmt.Fprintf(buf, "%s", v.Interface()) - break - } else if strings.HasPrefix(strtype, "io.") { - buf.WriteString("") - break - } - - buf.WriteString("{\n") - - names := []string{} - for i := 0; i < v.Type().NumField(); i++ { - name := v.Type().Field(i).Name - f := v.Field(i) - if name[0:1] == strings.ToLower(name[0:1]) { - continue // ignore unexported fields - } - if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice || f.Kind() == reflect.Map) && f.IsNil() { - continue // ignore unset fields - } - names = append(names, name) - } - - for i, n := range names { - val := v.FieldByName(n) - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(n + ": ") - prettify(val, indent+2, buf) - - if i < len(names)-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - case reflect.Slice: - strtype := v.Type().String() - if strtype == "[]uint8" { - fmt.Fprintf(buf, " len %d", v.Len()) - break - } - - nl, id, id2 := "", "", "" - if v.Len() > 3 { - nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) - } - buf.WriteString("[" + nl) - for i := 0; i < v.Len(); i++ { - buf.WriteString(id2) - prettify(v.Index(i), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString("," + nl) - } - } - - buf.WriteString(nl + id + "]") - case reflect.Map: - buf.WriteString("{\n") - - for i, k := range v.MapKeys() { - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(k.String() + ": ") - prettify(v.MapIndex(k), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - default: - if !v.IsValid() { - fmt.Fprint(buf, "") - return - } - format := "%v" - switch v.Interface().(type) { - case string: - format = "%q" - case io.ReadSeeker, io.Reader: - format = "buffer(%p)" - } - fmt.Fprintf(buf, format, v.Interface()) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go deleted file mode 100644 index 645df2450..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go +++ /dev/null @@ -1,88 +0,0 @@ -package awsutil - -import ( - "bytes" - "fmt" - "reflect" - "strings" -) - -// StringValue returns the string representation of a value. -func StringValue(i interface{}) string { - var buf bytes.Buffer - stringValue(reflect.ValueOf(i), 0, &buf) - return buf.String() -} - -func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { - for v.Kind() == reflect.Ptr { - v = v.Elem() - } - - switch v.Kind() { - case reflect.Struct: - buf.WriteString("{\n") - - for i := 0; i < v.Type().NumField(); i++ { - ft := v.Type().Field(i) - fv := v.Field(i) - - if ft.Name[0:1] == strings.ToLower(ft.Name[0:1]) { - continue // ignore unexported fields - } - if (fv.Kind() == reflect.Ptr || fv.Kind() == reflect.Slice) && fv.IsNil() { - continue // ignore unset fields - } - - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(ft.Name + ": ") - - if tag := ft.Tag.Get("sensitive"); tag == "true" { - buf.WriteString("") - } else { - stringValue(fv, indent+2, buf) - } - - buf.WriteString(",\n") - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - case reflect.Slice: - nl, id, id2 := "", "", "" - if v.Len() > 3 { - nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) - } - buf.WriteString("[" + nl) - for i := 0; i < v.Len(); i++ { - buf.WriteString(id2) - stringValue(v.Index(i), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString("," + nl) - } - } - - buf.WriteString(nl + id + "]") - case reflect.Map: - buf.WriteString("{\n") - - for i, k := range v.MapKeys() { - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(k.String() + ": ") - stringValue(v.MapIndex(k), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - default: - format := "%v" - switch v.Interface().(type) { - case string: - format = "%q" - } - fmt.Fprintf(buf, format, v.Interface()) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go deleted file mode 100644 index 03334d692..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ /dev/null @@ -1,97 +0,0 @@ -package client - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" -) - -// A Config provides configuration to a service client instance. -type Config struct { - Config *aws.Config - Handlers request.Handlers - PartitionID string - Endpoint string - SigningRegion string - SigningName string - - // States that the signing name did not come from a modeled source but - // was derived based on other data. Used by service client constructors - // to determine if the signin name can be overridden based on metadata the - // service has. - SigningNameDerived bool -} - -// ConfigProvider provides a generic way for a service client to receive -// the ClientConfig without circular dependencies. -type ConfigProvider interface { - ClientConfig(serviceName string, cfgs ...*aws.Config) Config -} - -// ConfigNoResolveEndpointProvider same as ConfigProvider except it will not -// resolve the endpoint automatically. The service client's endpoint must be -// provided via the aws.Config.Endpoint field. -type ConfigNoResolveEndpointProvider interface { - ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) Config -} - -// A Client implements the base client request and response handling -// used by all service clients. -type Client struct { - request.Retryer - metadata.ClientInfo - - Config aws.Config - Handlers request.Handlers -} - -// New will return a pointer to a new initialized service client. -func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, options ...func(*Client)) *Client { - svc := &Client{ - Config: cfg, - ClientInfo: info, - Handlers: handlers.Copy(), - } - - switch retryer, ok := cfg.Retryer.(request.Retryer); { - case ok: - svc.Retryer = retryer - case cfg.Retryer != nil && cfg.Logger != nil: - s := fmt.Sprintf("WARNING: %T does not implement request.Retryer; using DefaultRetryer instead", cfg.Retryer) - cfg.Logger.Log(s) - fallthrough - default: - maxRetries := aws.IntValue(cfg.MaxRetries) - if cfg.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { - maxRetries = DefaultRetryerMaxNumRetries - } - svc.Retryer = DefaultRetryer{NumMaxRetries: maxRetries} - } - - svc.AddDebugHandlers() - - for _, option := range options { - option(svc) - } - - return svc -} - -// NewRequest returns a new Request pointer for the service API -// operation and parameters. -func (c *Client) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { - return request.New(c.Config, c.ClientInfo, c.Handlers, c.Retryer, operation, params, data) -} - -// AddDebugHandlers injects debug logging handlers into the service to log request -// debug information. -func (c *Client) AddDebugHandlers() { - if !c.Config.LogLevel.AtLeast(aws.LogDebug) { - return - } - - c.Handlers.Send.PushFrontNamed(LogHTTPRequestHandler) - c.Handlers.Send.PushBackNamed(LogHTTPResponseHandler) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go deleted file mode 100644 index 9f6af19dd..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ /dev/null @@ -1,177 +0,0 @@ -package client - -import ( - "math" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/sdkrand" -) - -// DefaultRetryer implements basic retry logic using exponential backoff for -// most services. If you want to implement custom retry logic, you can implement the -// request.Retryer interface. -// -type DefaultRetryer struct { - // Num max Retries is the number of max retries that will be performed. - // By default, this is zero. - NumMaxRetries int - - // MinRetryDelay is the minimum retry delay after which retry will be performed. - // If not set, the value is 0ns. - MinRetryDelay time.Duration - - // MinThrottleRetryDelay is the minimum retry delay when throttled. - // If not set, the value is 0ns. - MinThrottleDelay time.Duration - - // MaxRetryDelay is the maximum retry delay before which retry must be performed. - // If not set, the value is 0ns. - MaxRetryDelay time.Duration - - // MaxThrottleDelay is the maximum retry delay when throttled. - // If not set, the value is 0ns. - MaxThrottleDelay time.Duration -} - -const ( - // DefaultRetryerMaxNumRetries sets maximum number of retries - DefaultRetryerMaxNumRetries = 3 - - // DefaultRetryerMinRetryDelay sets minimum retry delay - DefaultRetryerMinRetryDelay = 30 * time.Millisecond - - // DefaultRetryerMinThrottleDelay sets minimum delay when throttled - DefaultRetryerMinThrottleDelay = 500 * time.Millisecond - - // DefaultRetryerMaxRetryDelay sets maximum retry delay - DefaultRetryerMaxRetryDelay = 300 * time.Second - - // DefaultRetryerMaxThrottleDelay sets maximum delay when throttled - DefaultRetryerMaxThrottleDelay = 300 * time.Second -) - -// MaxRetries returns the number of maximum returns the service will use to make -// an individual API request. -func (d DefaultRetryer) MaxRetries() int { - return d.NumMaxRetries -} - -// setRetryerDefaults sets the default values of the retryer if not set -func (d *DefaultRetryer) setRetryerDefaults() { - if d.MinRetryDelay == 0 { - d.MinRetryDelay = DefaultRetryerMinRetryDelay - } - if d.MaxRetryDelay == 0 { - d.MaxRetryDelay = DefaultRetryerMaxRetryDelay - } - if d.MinThrottleDelay == 0 { - d.MinThrottleDelay = DefaultRetryerMinThrottleDelay - } - if d.MaxThrottleDelay == 0 { - d.MaxThrottleDelay = DefaultRetryerMaxThrottleDelay - } -} - -// RetryRules returns the delay duration before retrying this request again -func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { - - // if number of max retries is zero, no retries will be performed. - if d.NumMaxRetries == 0 { - return 0 - } - - // Sets default value for retryer members - d.setRetryerDefaults() - - // minDelay is the minimum retryer delay - minDelay := d.MinRetryDelay - - var initialDelay time.Duration - - isThrottle := r.IsErrorThrottle() - if isThrottle { - if delay, ok := getRetryAfterDelay(r); ok { - initialDelay = delay - } - minDelay = d.MinThrottleDelay - } - - retryCount := r.RetryCount - - // maxDelay the maximum retryer delay - maxDelay := d.MaxRetryDelay - - if isThrottle { - maxDelay = d.MaxThrottleDelay - } - - var delay time.Duration - - // Logic to cap the retry count based on the minDelay provided - actualRetryCount := int(math.Log2(float64(minDelay))) + 1 - if actualRetryCount < 63-retryCount { - delay = time.Duration(1< maxDelay { - delay = getJitterDelay(maxDelay / 2) - } - } else { - delay = getJitterDelay(maxDelay / 2) - } - return delay + initialDelay -} - -// getJitterDelay returns a jittered delay for retry -func getJitterDelay(duration time.Duration) time.Duration { - return time.Duration(sdkrand.SeededRand.Int63n(int64(duration)) + int64(duration)) -} - -// ShouldRetry returns true if the request should be retried. -func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { - - // ShouldRetry returns false if number of max retries is 0. - if d.NumMaxRetries == 0 { - return false - } - - // If one of the other handlers already set the retry state - // we don't want to override it based on the service's state - if r.Retryable != nil { - return *r.Retryable - } - return r.IsErrorRetryable() || r.IsErrorThrottle() -} - -// This will look in the Retry-After header, RFC 7231, for how long -// it will wait before attempting another request -func getRetryAfterDelay(r *request.Request) (time.Duration, bool) { - if !canUseRetryAfterHeader(r) { - return 0, false - } - - delayStr := r.HTTPResponse.Header.Get("Retry-After") - if len(delayStr) == 0 { - return 0, false - } - - delay, err := strconv.Atoi(delayStr) - if err != nil { - return 0, false - } - - return time.Duration(delay) * time.Second, true -} - -// Will look at the status code to see if the retry header pertains to -// the status code. -func canUseRetryAfterHeader(r *request.Request) bool { - switch r.HTTPResponse.StatusCode { - case 429: - case 503: - default: - return false - } - - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go deleted file mode 100644 index 8958c32d4..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ /dev/null @@ -1,194 +0,0 @@ -package client - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http/httputil" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -const logReqMsg = `DEBUG: Request %s/%s Details: ----[ REQUEST POST-SIGN ]----------------------------- -%s ------------------------------------------------------` - -const logReqErrMsg = `DEBUG ERROR: Request %s/%s: ----[ REQUEST DUMP ERROR ]----------------------------- -%s -------------------------------------------------------` - -type logWriter struct { - // Logger is what we will use to log the payload of a response. - Logger aws.Logger - // buf stores the contents of what has been read - buf *bytes.Buffer -} - -func (logger *logWriter) Write(b []byte) (int, error) { - return logger.buf.Write(b) -} - -type teeReaderCloser struct { - // io.Reader will be a tee reader that is used during logging. - // This structure will read from a body and write the contents to a logger. - io.Reader - // Source is used just to close when we are done reading. - Source io.ReadCloser -} - -func (reader *teeReaderCloser) Close() error { - return reader.Source.Close() -} - -// LogHTTPRequestHandler is a SDK request handler to log the HTTP request sent -// to a service. Will include the HTTP request body if the LogLevel of the -// request matches LogDebugWithHTTPBody. -var LogHTTPRequestHandler = request.NamedHandler{ - Name: "awssdk.client.LogRequest", - Fn: logRequest, -} - -func logRequest(r *request.Request) { - logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - bodySeekable := aws.IsReaderSeekable(r.Body) - - b, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) - if err != nil { - r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, - r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - - if logBody { - if !bodySeekable { - r.SetReaderBody(aws.ReadSeekCloser(r.HTTPRequest.Body)) - } - // Reset the request body because dumpRequest will re-wrap the - // r.HTTPRequest's Body as a NoOpCloser and will not be reset after - // read by the HTTP client reader. - if err := r.Error; err != nil { - r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, - r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - } - - r.Config.Logger.Log(fmt.Sprintf(logReqMsg, - r.ClientInfo.ServiceName, r.Operation.Name, string(b))) -} - -// LogHTTPRequestHeaderHandler is a SDK request handler to log the HTTP request sent -// to a service. Will only log the HTTP request's headers. The request payload -// will not be read. -var LogHTTPRequestHeaderHandler = request.NamedHandler{ - Name: "awssdk.client.LogRequestHeader", - Fn: logRequestHeader, -} - -func logRequestHeader(r *request.Request) { - b, err := httputil.DumpRequestOut(r.HTTPRequest, false) - if err != nil { - r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, - r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - - r.Config.Logger.Log(fmt.Sprintf(logReqMsg, - r.ClientInfo.ServiceName, r.Operation.Name, string(b))) -} - -const logRespMsg = `DEBUG: Response %s/%s Details: ----[ RESPONSE ]-------------------------------------- -%s ------------------------------------------------------` - -const logRespErrMsg = `DEBUG ERROR: Response %s/%s: ----[ RESPONSE DUMP ERROR ]----------------------------- -%s ------------------------------------------------------` - -// LogHTTPResponseHandler is a SDK request handler to log the HTTP response -// received from a service. Will include the HTTP response body if the LogLevel -// of the request matches LogDebugWithHTTPBody. -var LogHTTPResponseHandler = request.NamedHandler{ - Name: "awssdk.client.LogResponse", - Fn: logResponse, -} - -func logResponse(r *request.Request) { - lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} - - if r.HTTPResponse == nil { - lw.Logger.Log(fmt.Sprintf(logRespErrMsg, - r.ClientInfo.ServiceName, r.Operation.Name, "request's HTTPResponse is nil")) - return - } - - logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) - if logBody { - r.HTTPResponse.Body = &teeReaderCloser{ - Reader: io.TeeReader(r.HTTPResponse.Body, lw), - Source: r.HTTPResponse.Body, - } - } - - handlerFn := func(req *request.Request) { - b, err := httputil.DumpResponse(req.HTTPResponse, false) - if err != nil { - lw.Logger.Log(fmt.Sprintf(logRespErrMsg, - req.ClientInfo.ServiceName, req.Operation.Name, err)) - return - } - - lw.Logger.Log(fmt.Sprintf(logRespMsg, - req.ClientInfo.ServiceName, req.Operation.Name, string(b))) - - if logBody { - b, err := ioutil.ReadAll(lw.buf) - if err != nil { - lw.Logger.Log(fmt.Sprintf(logRespErrMsg, - req.ClientInfo.ServiceName, req.Operation.Name, err)) - return - } - - lw.Logger.Log(string(b)) - } - } - - const handlerName = "awsdk.client.LogResponse.ResponseBody" - - r.Handlers.Unmarshal.SetBackNamed(request.NamedHandler{ - Name: handlerName, Fn: handlerFn, - }) - r.Handlers.UnmarshalError.SetBackNamed(request.NamedHandler{ - Name: handlerName, Fn: handlerFn, - }) -} - -// LogHTTPResponseHeaderHandler is a SDK request handler to log the HTTP -// response received from a service. Will only log the HTTP response's headers. -// The response payload will not be read. -var LogHTTPResponseHeaderHandler = request.NamedHandler{ - Name: "awssdk.client.LogResponseHeader", - Fn: logResponseHeader, -} - -func logResponseHeader(r *request.Request) { - if r.Config.Logger == nil { - return - } - - b, err := httputil.DumpResponse(r.HTTPResponse, false) - if err != nil { - r.Config.Logger.Log(fmt.Sprintf(logRespErrMsg, - r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } - - r.Config.Logger.Log(fmt.Sprintf(logRespMsg, - r.ClientInfo.ServiceName, r.Operation.Name, string(b))) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go b/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go deleted file mode 100644 index 0c48f72e0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go +++ /dev/null @@ -1,14 +0,0 @@ -package metadata - -// ClientInfo wraps immutable data from the client.Client structure. -type ClientInfo struct { - ServiceName string - ServiceID string - APIVersion string - PartitionID string - Endpoint string - SigningName string - SigningRegion string - JSONVersion string - TargetPrefix string -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go deleted file mode 100644 index 881d575f0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go +++ /dev/null @@ -1,28 +0,0 @@ -package client - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws/request" -) - -// NoOpRetryer provides a retryer that performs no retries. -// It should be used when we do not want retries to be performed. -type NoOpRetryer struct{} - -// MaxRetries returns the number of maximum returns the service will use to make -// an individual API; For NoOpRetryer the MaxRetries will always be zero. -func (d NoOpRetryer) MaxRetries() int { - return 0 -} - -// ShouldRetry will always return false for NoOpRetryer, as it should never retry. -func (d NoOpRetryer) ShouldRetry(_ *request.Request) bool { - return false -} - -// RetryRules returns the delay duration before retrying this request again; -// since NoOpRetryer does not retry, RetryRules always returns 0. -func (d NoOpRetryer) RetryRules(_ *request.Request) time.Duration { - return 0 -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go deleted file mode 100644 index 2c002e152..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ /dev/null @@ -1,587 +0,0 @@ -package aws - -import ( - "net/http" - "time" - - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/endpoints" -) - -// UseServiceDefaultRetries instructs the config to use the service's own -// default number of retries. This will be the default action if -// Config.MaxRetries is nil also. -const UseServiceDefaultRetries = -1 - -// RequestRetryer is an alias for a type that implements the request.Retryer -// interface. -type RequestRetryer interface{} - -// A Config provides service configuration for service clients. By default, -// all clients will use the defaults.DefaultConfig structure. -// -// // Create Session with MaxRetries configuration to be shared by multiple -// // service clients. -// sess := session.Must(session.NewSession(&aws.Config{ -// MaxRetries: aws.Int(3), -// })) -// -// // Create S3 service client with a specific Region. -// svc := s3.New(sess, &aws.Config{ -// Region: aws.String("us-west-2"), -// }) -type Config struct { - // Enables verbose error printing of all credential chain errors. - // Should be used when wanting to see all errors while attempting to - // retrieve credentials. - CredentialsChainVerboseErrors *bool - - // The credentials object to use when signing requests. Defaults to a - // chain of credential providers to search for credentials in environment - // variables, shared credential file, and EC2 Instance Roles. - Credentials *credentials.Credentials - - // An optional endpoint URL (hostname only or fully qualified URI) - // that overrides the default generated endpoint for a client. Set this - // to `nil` to use the default generated endpoint. - // - // Note: You must still provide a `Region` value when specifying an - // endpoint for a client. - Endpoint *string - - // The resolver to use for looking up endpoints for AWS service clients - // to use based on region. - EndpointResolver endpoints.Resolver - - // EnforceShouldRetryCheck is used in the AfterRetryHandler to always call - // ShouldRetry regardless of whether or not if request.Retryable is set. - // This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck - // is not set, then ShouldRetry will only be called if request.Retryable is nil. - // Proper handling of the request.Retryable field is important when setting this field. - EnforceShouldRetryCheck *bool - - // The region to send requests to. This parameter is required and must - // be configured globally or on a per-client basis unless otherwise - // noted. A full list of regions is found in the "Regions and Endpoints" - // document. - // - // See http://docs.aws.amazon.com/general/latest/gr/rande.html for AWS - // Regions and Endpoints. - Region *string - - // Set this to `true` to disable SSL when sending requests. Defaults - // to `false`. - DisableSSL *bool - - // The HTTP client to use when sending requests. Defaults to - // `http.DefaultClient`. - HTTPClient *http.Client - - // An integer value representing the logging level. The default log level - // is zero (LogOff), which represents no logging. To enable logging set - // to a LogLevel Value. - LogLevel *LogLevelType - - // The logger writer interface to write logging messages to. Defaults to - // standard out. - Logger Logger - - // The maximum number of times that a request will be retried for failures. - // Defaults to -1, which defers the max retry setting to the service - // specific configuration. - MaxRetries *int - - // Retryer guides how HTTP requests should be retried in case of - // recoverable failures. - // - // When nil or the value does not implement the request.Retryer interface, - // the client.DefaultRetryer will be used. - // - // When both Retryer and MaxRetries are non-nil, the former is used and - // the latter ignored. - // - // To set the Retryer field in a type-safe manner and with chaining, use - // the request.WithRetryer helper function: - // - // cfg := request.WithRetryer(aws.NewConfig(), myRetryer) - // - Retryer RequestRetryer - - // Disables semantic parameter validation, which validates input for - // missing required fields and/or other semantic request input errors. - DisableParamValidation *bool - - // Disables the computation of request and response checksums, e.g., - // CRC32 checksums in Amazon DynamoDB. - DisableComputeChecksums *bool - - // Set this to `true` to force the request to use path-style addressing, - // i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client - // will use virtual hosted bucket addressing when possible - // (`http://BUCKET.s3.amazonaws.com/KEY`). - // - // Note: This configuration option is specific to the Amazon S3 service. - // - // See http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html - // for Amazon S3: Virtual Hosting of Buckets - S3ForcePathStyle *bool - - // Set this to `true` to disable the SDK adding the `Expect: 100-Continue` - // header to PUT requests over 2MB of content. 100-Continue instructs the - // HTTP client not to send the body until the service responds with a - // `continue` status. This is useful to prevent sending the request body - // until after the request is authenticated, and validated. - // - // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html - // - // 100-Continue is only enabled for Go 1.6 and above. See `http.Transport`'s - // `ExpectContinueTimeout` for information on adjusting the continue wait - // timeout. https://golang.org/pkg/net/http/#Transport - // - // You should use this flag to disble 100-Continue if you experience issues - // with proxies or third party S3 compatible services. - S3Disable100Continue *bool - - // Set this to `true` to enable S3 Accelerate feature. For all operations - // compatible with S3 Accelerate will use the accelerate endpoint for - // requests. Requests not compatible will fall back to normal S3 requests. - // - // The bucket must be enable for accelerate to be used with S3 client with - // accelerate enabled. If the bucket is not enabled for accelerate an error - // will be returned. The bucket name must be DNS compatible to also work - // with accelerate. - S3UseAccelerate *bool - - // S3DisableContentMD5Validation config option is temporarily disabled, - // For S3 GetObject API calls, #1837. - // - // Set this to `true` to disable the S3 service client from automatically - // adding the ContentMD5 to S3 Object Put and Upload API calls. This option - // will also disable the SDK from performing object ContentMD5 validation - // on GetObject API calls. - S3DisableContentMD5Validation *bool - - // Set this to `true` to have the S3 service client to use the region specified - // in the ARN, when an ARN is provided as an argument to a bucket parameter. - S3UseARNRegion *bool - - // Set this to `true` to enable the SDK to unmarshal API response header maps to - // normalized lower case map keys. - // - // For example S3's X-Amz-Meta prefixed header will be unmarshaled to lower case - // Metadata member's map keys. The value of the header in the map is unaffected. - LowerCaseHeaderMaps *bool - - // Set this to `true` to disable the EC2Metadata client from overriding the - // default http.Client's Timeout. This is helpful if you do not want the - // EC2Metadata client to create a new http.Client. This options is only - // meaningful if you're not already using a custom HTTP client with the - // SDK. Enabled by default. - // - // Must be set and provided to the session.NewSession() in order to disable - // the EC2Metadata overriding the timeout for default credentials chain. - // - // Example: - // sess := session.Must(session.NewSession(aws.NewConfig() - // .WithEC2MetadataDiableTimeoutOverride(true))) - // - // svc := s3.New(sess) - // - EC2MetadataDisableTimeoutOverride *bool - - // Instructs the endpoint to be generated for a service client to - // be the dual stack endpoint. The dual stack endpoint will support - // both IPv4 and IPv6 addressing. - // - // Setting this for a service which does not support dual stack will fail - // to make requets. It is not recommended to set this value on the session - // as it will apply to all service clients created with the session. Even - // services which don't support dual stack endpoints. - // - // If the Endpoint config value is also provided the UseDualStack flag - // will be ignored. - // - // Only supported with. - // - // sess := session.Must(session.NewSession()) - // - // svc := s3.New(sess, &aws.Config{ - // UseDualStack: aws.Bool(true), - // }) - UseDualStack *bool - - // SleepDelay is an override for the func the SDK will call when sleeping - // during the lifecycle of a request. Specifically this will be used for - // request delays. This value should only be used for testing. To adjust - // the delay of a request see the aws/client.DefaultRetryer and - // aws/request.Retryer. - // - // SleepDelay will prevent any Context from being used for canceling retry - // delay of an API operation. It is recommended to not use SleepDelay at all - // and specify a Retryer instead. - SleepDelay func(time.Duration) - - // DisableRestProtocolURICleaning will not clean the URL path when making rest protocol requests. - // Will default to false. This would only be used for empty directory names in s3 requests. - // - // Example: - // sess := session.Must(session.NewSession(&aws.Config{ - // DisableRestProtocolURICleaning: aws.Bool(true), - // })) - // - // svc := s3.New(sess) - // out, err := svc.GetObject(&s3.GetObjectInput { - // Bucket: aws.String("bucketname"), - // Key: aws.String("//foo//bar//moo"), - // }) - DisableRestProtocolURICleaning *bool - - // EnableEndpointDiscovery will allow for endpoint discovery on operations that - // have the definition in its model. By default, endpoint discovery is off. - // To use EndpointDiscovery, Endpoint should be unset or set to an empty string. - // - // Example: - // sess := session.Must(session.NewSession(&aws.Config{ - // EnableEndpointDiscovery: aws.Bool(true), - // })) - // - // svc := s3.New(sess) - // out, err := svc.GetObject(&s3.GetObjectInput { - // Bucket: aws.String("bucketname"), - // Key: aws.String("/foo/bar/moo"), - // }) - EnableEndpointDiscovery *bool - - // DisableEndpointHostPrefix will disable the SDK's behavior of prefixing - // request endpoint hosts with modeled information. - // - // Disabling this feature is useful when you want to use local endpoints - // for testing that do not support the modeled host prefix pattern. - DisableEndpointHostPrefix *bool - - // STSRegionalEndpoint will enable regional or legacy endpoint resolving - STSRegionalEndpoint endpoints.STSRegionalEndpoint - - // S3UsEast1RegionalEndpoint will enable regional or legacy endpoint resolving - S3UsEast1RegionalEndpoint endpoints.S3UsEast1RegionalEndpoint -} - -// NewConfig returns a new Config pointer that can be chained with builder -// methods to set multiple configuration values inline without using pointers. -// -// // Create Session with MaxRetries configuration to be shared by multiple -// // service clients. -// sess := session.Must(session.NewSession(aws.NewConfig(). -// WithMaxRetries(3), -// )) -// -// // Create S3 service client with a specific Region. -// svc := s3.New(sess, aws.NewConfig(). -// WithRegion("us-west-2"), -// ) -func NewConfig() *Config { - return &Config{} -} - -// WithCredentialsChainVerboseErrors sets a config verbose errors boolean and returning -// a Config pointer. -func (c *Config) WithCredentialsChainVerboseErrors(verboseErrs bool) *Config { - c.CredentialsChainVerboseErrors = &verboseErrs - return c -} - -// WithCredentials sets a config Credentials value returning a Config pointer -// for chaining. -func (c *Config) WithCredentials(creds *credentials.Credentials) *Config { - c.Credentials = creds - return c -} - -// WithEndpoint sets a config Endpoint value returning a Config pointer for -// chaining. -func (c *Config) WithEndpoint(endpoint string) *Config { - c.Endpoint = &endpoint - return c -} - -// WithEndpointResolver sets a config EndpointResolver value returning a -// Config pointer for chaining. -func (c *Config) WithEndpointResolver(resolver endpoints.Resolver) *Config { - c.EndpointResolver = resolver - return c -} - -// WithRegion sets a config Region value returning a Config pointer for -// chaining. -func (c *Config) WithRegion(region string) *Config { - c.Region = ®ion - return c -} - -// WithDisableSSL sets a config DisableSSL value returning a Config pointer -// for chaining. -func (c *Config) WithDisableSSL(disable bool) *Config { - c.DisableSSL = &disable - return c -} - -// WithHTTPClient sets a config HTTPClient value returning a Config pointer -// for chaining. -func (c *Config) WithHTTPClient(client *http.Client) *Config { - c.HTTPClient = client - return c -} - -// WithMaxRetries sets a config MaxRetries value returning a Config pointer -// for chaining. -func (c *Config) WithMaxRetries(max int) *Config { - c.MaxRetries = &max - return c -} - -// WithDisableParamValidation sets a config DisableParamValidation value -// returning a Config pointer for chaining. -func (c *Config) WithDisableParamValidation(disable bool) *Config { - c.DisableParamValidation = &disable - return c -} - -// WithDisableComputeChecksums sets a config DisableComputeChecksums value -// returning a Config pointer for chaining. -func (c *Config) WithDisableComputeChecksums(disable bool) *Config { - c.DisableComputeChecksums = &disable - return c -} - -// WithLogLevel sets a config LogLevel value returning a Config pointer for -// chaining. -func (c *Config) WithLogLevel(level LogLevelType) *Config { - c.LogLevel = &level - return c -} - -// WithLogger sets a config Logger value returning a Config pointer for -// chaining. -func (c *Config) WithLogger(logger Logger) *Config { - c.Logger = logger - return c -} - -// WithS3ForcePathStyle sets a config S3ForcePathStyle value returning a Config -// pointer for chaining. -func (c *Config) WithS3ForcePathStyle(force bool) *Config { - c.S3ForcePathStyle = &force - return c -} - -// WithS3Disable100Continue sets a config S3Disable100Continue value returning -// a Config pointer for chaining. -func (c *Config) WithS3Disable100Continue(disable bool) *Config { - c.S3Disable100Continue = &disable - return c -} - -// WithS3UseAccelerate sets a config S3UseAccelerate value returning a Config -// pointer for chaining. -func (c *Config) WithS3UseAccelerate(enable bool) *Config { - c.S3UseAccelerate = &enable - return c - -} - -// WithS3DisableContentMD5Validation sets a config -// S3DisableContentMD5Validation value returning a Config pointer for chaining. -func (c *Config) WithS3DisableContentMD5Validation(enable bool) *Config { - c.S3DisableContentMD5Validation = &enable - return c - -} - -// WithS3UseARNRegion sets a config S3UseARNRegion value and -// returning a Config pointer for chaining -func (c *Config) WithS3UseARNRegion(enable bool) *Config { - c.S3UseARNRegion = &enable - return c -} - -// WithUseDualStack sets a config UseDualStack value returning a Config -// pointer for chaining. -func (c *Config) WithUseDualStack(enable bool) *Config { - c.UseDualStack = &enable - return c -} - -// WithEC2MetadataDisableTimeoutOverride sets a config EC2MetadataDisableTimeoutOverride value -// returning a Config pointer for chaining. -func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config { - c.EC2MetadataDisableTimeoutOverride = &enable - return c -} - -// WithSleepDelay overrides the function used to sleep while waiting for the -// next retry. Defaults to time.Sleep. -func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config { - c.SleepDelay = fn - return c -} - -// WithEndpointDiscovery will set whether or not to use endpoint discovery. -func (c *Config) WithEndpointDiscovery(t bool) *Config { - c.EnableEndpointDiscovery = &t - return c -} - -// WithDisableEndpointHostPrefix will set whether or not to use modeled host prefix -// when making requests. -func (c *Config) WithDisableEndpointHostPrefix(t bool) *Config { - c.DisableEndpointHostPrefix = &t - return c -} - -// MergeIn merges the passed in configs into the existing config object. -func (c *Config) MergeIn(cfgs ...*Config) { - for _, other := range cfgs { - mergeInConfig(c, other) - } -} - -// WithSTSRegionalEndpoint will set whether or not to use regional endpoint flag -// when resolving the endpoint for a service -func (c *Config) WithSTSRegionalEndpoint(sre endpoints.STSRegionalEndpoint) *Config { - c.STSRegionalEndpoint = sre - return c -} - -// WithS3UsEast1RegionalEndpoint will set whether or not to use regional endpoint flag -// when resolving the endpoint for a service -func (c *Config) WithS3UsEast1RegionalEndpoint(sre endpoints.S3UsEast1RegionalEndpoint) *Config { - c.S3UsEast1RegionalEndpoint = sre - return c -} - -func mergeInConfig(dst *Config, other *Config) { - if other == nil { - return - } - - if other.CredentialsChainVerboseErrors != nil { - dst.CredentialsChainVerboseErrors = other.CredentialsChainVerboseErrors - } - - if other.Credentials != nil { - dst.Credentials = other.Credentials - } - - if other.Endpoint != nil { - dst.Endpoint = other.Endpoint - } - - if other.EndpointResolver != nil { - dst.EndpointResolver = other.EndpointResolver - } - - if other.Region != nil { - dst.Region = other.Region - } - - if other.DisableSSL != nil { - dst.DisableSSL = other.DisableSSL - } - - if other.HTTPClient != nil { - dst.HTTPClient = other.HTTPClient - } - - if other.LogLevel != nil { - dst.LogLevel = other.LogLevel - } - - if other.Logger != nil { - dst.Logger = other.Logger - } - - if other.MaxRetries != nil { - dst.MaxRetries = other.MaxRetries - } - - if other.Retryer != nil { - dst.Retryer = other.Retryer - } - - if other.DisableParamValidation != nil { - dst.DisableParamValidation = other.DisableParamValidation - } - - if other.DisableComputeChecksums != nil { - dst.DisableComputeChecksums = other.DisableComputeChecksums - } - - if other.S3ForcePathStyle != nil { - dst.S3ForcePathStyle = other.S3ForcePathStyle - } - - if other.S3Disable100Continue != nil { - dst.S3Disable100Continue = other.S3Disable100Continue - } - - if other.S3UseAccelerate != nil { - dst.S3UseAccelerate = other.S3UseAccelerate - } - - if other.S3DisableContentMD5Validation != nil { - dst.S3DisableContentMD5Validation = other.S3DisableContentMD5Validation - } - - if other.S3UseARNRegion != nil { - dst.S3UseARNRegion = other.S3UseARNRegion - } - - if other.UseDualStack != nil { - dst.UseDualStack = other.UseDualStack - } - - if other.EC2MetadataDisableTimeoutOverride != nil { - dst.EC2MetadataDisableTimeoutOverride = other.EC2MetadataDisableTimeoutOverride - } - - if other.SleepDelay != nil { - dst.SleepDelay = other.SleepDelay - } - - if other.DisableRestProtocolURICleaning != nil { - dst.DisableRestProtocolURICleaning = other.DisableRestProtocolURICleaning - } - - if other.EnforceShouldRetryCheck != nil { - dst.EnforceShouldRetryCheck = other.EnforceShouldRetryCheck - } - - if other.EnableEndpointDiscovery != nil { - dst.EnableEndpointDiscovery = other.EnableEndpointDiscovery - } - - if other.DisableEndpointHostPrefix != nil { - dst.DisableEndpointHostPrefix = other.DisableEndpointHostPrefix - } - - if other.STSRegionalEndpoint != endpoints.UnsetSTSEndpoint { - dst.STSRegionalEndpoint = other.STSRegionalEndpoint - } - - if other.S3UsEast1RegionalEndpoint != endpoints.UnsetS3UsEast1Endpoint { - dst.S3UsEast1RegionalEndpoint = other.S3UsEast1RegionalEndpoint - } -} - -// Copy will return a shallow copy of the Config object. If any additional -// configurations are provided they will be merged into the new config returned. -func (c *Config) Copy(cfgs ...*Config) *Config { - dst := &Config{} - dst.MergeIn(c) - - for _, cfg := range cfgs { - dst.MergeIn(cfg) - } - - return dst -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go deleted file mode 100644 index 2866f9a7f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go +++ /dev/null @@ -1,37 +0,0 @@ -// +build !go1.9 - -package aws - -import "time" - -// Context is an copy of the Go v1.7 stdlib's context.Context interface. -// It is represented as a SDK interface to enable you to use the "WithContext" -// API methods with Go v1.6 and a Context type such as golang.org/x/net/context. -// -// See https://golang.org/pkg/context on how to use contexts. -type Context interface { - // 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. - Deadline() (deadline time.Time, ok bool) - - // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. - Done() <-chan struct{} - - // Err returns a non-nil error value after Done is closed. Err returns - // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. - // After Done is closed, successive calls to Err return the same value. - Err() error - - // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with - // the same key returns the same result. - // - // Use context values only for request-scoped data that transits - // processes and API boundaries, not for passing optional parameters to - // functions. - Value(key interface{}) interface{} -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go deleted file mode 100644 index 3718b26e1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build go1.9 - -package aws - -import "context" - -// Context is an alias of the Go stdlib's context.Context interface. -// It can be used within the SDK's API operation "WithContext" methods. -// -// See https://golang.org/pkg/context on how to use contexts. -type Context = context.Context diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go b/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go deleted file mode 100644 index 2f9446333..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go +++ /dev/null @@ -1,22 +0,0 @@ -// +build !go1.7 - -package aws - -import ( - "github.com/aws/aws-sdk-go/internal/context" -) - -// BackgroundContext returns a context that will never be canceled, has no -// values, and no deadline. This context is used by the SDK to provide -// backwards compatibility with non-context API operations and functionality. -// -// Go 1.6 and before: -// This context function is equivalent to context.Background in the Go stdlib. -// -// Go 1.7 and later: -// The context returned will be the value returned by context.Background() -// -// See https://golang.org/pkg/context for more information on Contexts. -func BackgroundContext() Context { - return context.BackgroundCtx -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go deleted file mode 100644 index 9c29f29af..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build go1.7 - -package aws - -import "context" - -// BackgroundContext returns a context that will never be canceled, has no -// values, and no deadline. This context is used by the SDK to provide -// backwards compatibility with non-context API operations and functionality. -// -// Go 1.6 and before: -// This context function is equivalent to context.Background in the Go stdlib. -// -// Go 1.7 and later: -// The context returned will be the value returned by context.Background() -// -// See https://golang.org/pkg/context for more information on Contexts. -func BackgroundContext() Context { - return context.Background() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go b/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go deleted file mode 100644 index 304fd1561..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go +++ /dev/null @@ -1,24 +0,0 @@ -package aws - -import ( - "time" -) - -// SleepWithContext will wait for the timer duration to expire, or the context -// is canceled. Which ever happens first. If the context is canceled the Context's -// error will be returned. -// -// Expects Context to always return a non-nil error if the Done channel is closed. -func SleepWithContext(ctx Context, dur time.Duration) error { - t := time.NewTimer(dur) - defer t.Stop() - - select { - case <-t.C: - break - case <-ctx.Done(): - return ctx.Err() - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go deleted file mode 100644 index 4e076c183..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go +++ /dev/null @@ -1,918 +0,0 @@ -package aws - -import "time" - -// String returns a pointer to the string value passed in. -func String(v string) *string { - return &v -} - -// StringValue returns the value of the string pointer passed in or -// "" if the pointer is nil. -func StringValue(v *string) string { - if v != nil { - return *v - } - return "" -} - -// StringSlice converts a slice of string values into a slice of -// string pointers -func StringSlice(src []string) []*string { - dst := make([]*string, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// StringValueSlice converts a slice of string pointers into a slice of -// string values -func StringValueSlice(src []*string) []string { - dst := make([]string, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// StringMap converts a string map of string values into a string -// map of string pointers -func StringMap(src map[string]string) map[string]*string { - dst := make(map[string]*string) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// StringValueMap converts a string map of string pointers into a string -// map of string values -func StringValueMap(src map[string]*string) map[string]string { - dst := make(map[string]string) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Bool returns a pointer to the bool value passed in. -func Bool(v bool) *bool { - return &v -} - -// BoolValue returns the value of the bool pointer passed in or -// false if the pointer is nil. -func BoolValue(v *bool) bool { - if v != nil { - return *v - } - return false -} - -// BoolSlice converts a slice of bool values into a slice of -// bool pointers -func BoolSlice(src []bool) []*bool { - dst := make([]*bool, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// BoolValueSlice converts a slice of bool pointers into a slice of -// bool values -func BoolValueSlice(src []*bool) []bool { - dst := make([]bool, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// BoolMap converts a string map of bool values into a string -// map of bool pointers -func BoolMap(src map[string]bool) map[string]*bool { - dst := make(map[string]*bool) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// BoolValueMap converts a string map of bool pointers into a string -// map of bool values -func BoolValueMap(src map[string]*bool) map[string]bool { - dst := make(map[string]bool) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int returns a pointer to the int value passed in. -func Int(v int) *int { - return &v -} - -// IntValue returns the value of the int pointer passed in or -// 0 if the pointer is nil. -func IntValue(v *int) int { - if v != nil { - return *v - } - return 0 -} - -// IntSlice converts a slice of int values into a slice of -// int pointers -func IntSlice(src []int) []*int { - dst := make([]*int, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// IntValueSlice converts a slice of int pointers into a slice of -// int values -func IntValueSlice(src []*int) []int { - dst := make([]int, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// IntMap converts a string map of int values into a string -// map of int pointers -func IntMap(src map[string]int) map[string]*int { - dst := make(map[string]*int) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// IntValueMap converts a string map of int pointers into a string -// map of int values -func IntValueMap(src map[string]*int) map[string]int { - dst := make(map[string]int) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint returns a pointer to the uint value passed in. -func Uint(v uint) *uint { - return &v -} - -// UintValue returns the value of the uint pointer passed in or -// 0 if the pointer is nil. -func UintValue(v *uint) uint { - if v != nil { - return *v - } - return 0 -} - -// UintSlice converts a slice of uint values uinto a slice of -// uint pointers -func UintSlice(src []uint) []*uint { - dst := make([]*uint, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// UintValueSlice converts a slice of uint pointers uinto a slice of -// uint values -func UintValueSlice(src []*uint) []uint { - dst := make([]uint, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// UintMap converts a string map of uint values uinto a string -// map of uint pointers -func UintMap(src map[string]uint) map[string]*uint { - dst := make(map[string]*uint) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// UintValueMap converts a string map of uint pointers uinto a string -// map of uint values -func UintValueMap(src map[string]*uint) map[string]uint { - dst := make(map[string]uint) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int8 returns a pointer to the int8 value passed in. -func Int8(v int8) *int8 { - return &v -} - -// Int8Value returns the value of the int8 pointer passed in or -// 0 if the pointer is nil. -func Int8Value(v *int8) int8 { - if v != nil { - return *v - } - return 0 -} - -// Int8Slice converts a slice of int8 values into a slice of -// int8 pointers -func Int8Slice(src []int8) []*int8 { - dst := make([]*int8, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int8ValueSlice converts a slice of int8 pointers into a slice of -// int8 values -func Int8ValueSlice(src []*int8) []int8 { - dst := make([]int8, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int8Map converts a string map of int8 values into a string -// map of int8 pointers -func Int8Map(src map[string]int8) map[string]*int8 { - dst := make(map[string]*int8) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int8ValueMap converts a string map of int8 pointers into a string -// map of int8 values -func Int8ValueMap(src map[string]*int8) map[string]int8 { - dst := make(map[string]int8) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int16 returns a pointer to the int16 value passed in. -func Int16(v int16) *int16 { - return &v -} - -// Int16Value returns the value of the int16 pointer passed in or -// 0 if the pointer is nil. -func Int16Value(v *int16) int16 { - if v != nil { - return *v - } - return 0 -} - -// Int16Slice converts a slice of int16 values into a slice of -// int16 pointers -func Int16Slice(src []int16) []*int16 { - dst := make([]*int16, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int16ValueSlice converts a slice of int16 pointers into a slice of -// int16 values -func Int16ValueSlice(src []*int16) []int16 { - dst := make([]int16, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int16Map converts a string map of int16 values into a string -// map of int16 pointers -func Int16Map(src map[string]int16) map[string]*int16 { - dst := make(map[string]*int16) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int16ValueMap converts a string map of int16 pointers into a string -// map of int16 values -func Int16ValueMap(src map[string]*int16) map[string]int16 { - dst := make(map[string]int16) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int32 returns a pointer to the int32 value passed in. -func Int32(v int32) *int32 { - return &v -} - -// Int32Value returns the value of the int32 pointer passed in or -// 0 if the pointer is nil. -func Int32Value(v *int32) int32 { - if v != nil { - return *v - } - return 0 -} - -// Int32Slice converts a slice of int32 values into a slice of -// int32 pointers -func Int32Slice(src []int32) []*int32 { - dst := make([]*int32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int32ValueSlice converts a slice of int32 pointers into a slice of -// int32 values -func Int32ValueSlice(src []*int32) []int32 { - dst := make([]int32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int32Map converts a string map of int32 values into a string -// map of int32 pointers -func Int32Map(src map[string]int32) map[string]*int32 { - dst := make(map[string]*int32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int32ValueMap converts a string map of int32 pointers into a string -// map of int32 values -func Int32ValueMap(src map[string]*int32) map[string]int32 { - dst := make(map[string]int32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int64 returns a pointer to the int64 value passed in. -func Int64(v int64) *int64 { - return &v -} - -// Int64Value returns the value of the int64 pointer passed in or -// 0 if the pointer is nil. -func Int64Value(v *int64) int64 { - if v != nil { - return *v - } - return 0 -} - -// Int64Slice converts a slice of int64 values into a slice of -// int64 pointers -func Int64Slice(src []int64) []*int64 { - dst := make([]*int64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int64ValueSlice converts a slice of int64 pointers into a slice of -// int64 values -func Int64ValueSlice(src []*int64) []int64 { - dst := make([]int64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int64Map converts a string map of int64 values into a string -// map of int64 pointers -func Int64Map(src map[string]int64) map[string]*int64 { - dst := make(map[string]*int64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int64ValueMap converts a string map of int64 pointers into a string -// map of int64 values -func Int64ValueMap(src map[string]*int64) map[string]int64 { - dst := make(map[string]int64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint8 returns a pointer to the uint8 value passed in. -func Uint8(v uint8) *uint8 { - return &v -} - -// Uint8Value returns the value of the uint8 pointer passed in or -// 0 if the pointer is nil. -func Uint8Value(v *uint8) uint8 { - if v != nil { - return *v - } - return 0 -} - -// Uint8Slice converts a slice of uint8 values into a slice of -// uint8 pointers -func Uint8Slice(src []uint8) []*uint8 { - dst := make([]*uint8, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint8ValueSlice converts a slice of uint8 pointers into a slice of -// uint8 values -func Uint8ValueSlice(src []*uint8) []uint8 { - dst := make([]uint8, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint8Map converts a string map of uint8 values into a string -// map of uint8 pointers -func Uint8Map(src map[string]uint8) map[string]*uint8 { - dst := make(map[string]*uint8) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint8ValueMap converts a string map of uint8 pointers into a string -// map of uint8 values -func Uint8ValueMap(src map[string]*uint8) map[string]uint8 { - dst := make(map[string]uint8) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint16 returns a pointer to the uint16 value passed in. -func Uint16(v uint16) *uint16 { - return &v -} - -// Uint16Value returns the value of the uint16 pointer passed in or -// 0 if the pointer is nil. -func Uint16Value(v *uint16) uint16 { - if v != nil { - return *v - } - return 0 -} - -// Uint16Slice converts a slice of uint16 values into a slice of -// uint16 pointers -func Uint16Slice(src []uint16) []*uint16 { - dst := make([]*uint16, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint16ValueSlice converts a slice of uint16 pointers into a slice of -// uint16 values -func Uint16ValueSlice(src []*uint16) []uint16 { - dst := make([]uint16, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint16Map converts a string map of uint16 values into a string -// map of uint16 pointers -func Uint16Map(src map[string]uint16) map[string]*uint16 { - dst := make(map[string]*uint16) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint16ValueMap converts a string map of uint16 pointers into a string -// map of uint16 values -func Uint16ValueMap(src map[string]*uint16) map[string]uint16 { - dst := make(map[string]uint16) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint32 returns a pointer to the uint32 value passed in. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint32Value returns the value of the uint32 pointer passed in or -// 0 if the pointer is nil. -func Uint32Value(v *uint32) uint32 { - if v != nil { - return *v - } - return 0 -} - -// Uint32Slice converts a slice of uint32 values into a slice of -// uint32 pointers -func Uint32Slice(src []uint32) []*uint32 { - dst := make([]*uint32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint32ValueSlice converts a slice of uint32 pointers into a slice of -// uint32 values -func Uint32ValueSlice(src []*uint32) []uint32 { - dst := make([]uint32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint32Map converts a string map of uint32 values into a string -// map of uint32 pointers -func Uint32Map(src map[string]uint32) map[string]*uint32 { - dst := make(map[string]*uint32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint32ValueMap converts a string map of uint32 pointers into a string -// map of uint32 values -func Uint32ValueMap(src map[string]*uint32) map[string]uint32 { - dst := make(map[string]uint32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint64 returns a pointer to the uint64 value passed in. -func Uint64(v uint64) *uint64 { - return &v -} - -// Uint64Value returns the value of the uint64 pointer passed in or -// 0 if the pointer is nil. -func Uint64Value(v *uint64) uint64 { - if v != nil { - return *v - } - return 0 -} - -// Uint64Slice converts a slice of uint64 values into a slice of -// uint64 pointers -func Uint64Slice(src []uint64) []*uint64 { - dst := make([]*uint64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint64ValueSlice converts a slice of uint64 pointers into a slice of -// uint64 values -func Uint64ValueSlice(src []*uint64) []uint64 { - dst := make([]uint64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint64Map converts a string map of uint64 values into a string -// map of uint64 pointers -func Uint64Map(src map[string]uint64) map[string]*uint64 { - dst := make(map[string]*uint64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint64ValueMap converts a string map of uint64 pointers into a string -// map of uint64 values -func Uint64ValueMap(src map[string]*uint64) map[string]uint64 { - dst := make(map[string]uint64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Float32 returns a pointer to the float32 value passed in. -func Float32(v float32) *float32 { - return &v -} - -// Float32Value returns the value of the float32 pointer passed in or -// 0 if the pointer is nil. -func Float32Value(v *float32) float32 { - if v != nil { - return *v - } - return 0 -} - -// Float32Slice converts a slice of float32 values into a slice of -// float32 pointers -func Float32Slice(src []float32) []*float32 { - dst := make([]*float32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Float32ValueSlice converts a slice of float32 pointers into a slice of -// float32 values -func Float32ValueSlice(src []*float32) []float32 { - dst := make([]float32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Float32Map converts a string map of float32 values into a string -// map of float32 pointers -func Float32Map(src map[string]float32) map[string]*float32 { - dst := make(map[string]*float32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Float32ValueMap converts a string map of float32 pointers into a string -// map of float32 values -func Float32ValueMap(src map[string]*float32) map[string]float32 { - dst := make(map[string]float32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Float64 returns a pointer to the float64 value passed in. -func Float64(v float64) *float64 { - return &v -} - -// Float64Value returns the value of the float64 pointer passed in or -// 0 if the pointer is nil. -func Float64Value(v *float64) float64 { - if v != nil { - return *v - } - return 0 -} - -// Float64Slice converts a slice of float64 values into a slice of -// float64 pointers -func Float64Slice(src []float64) []*float64 { - dst := make([]*float64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Float64ValueSlice converts a slice of float64 pointers into a slice of -// float64 values -func Float64ValueSlice(src []*float64) []float64 { - dst := make([]float64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Float64Map converts a string map of float64 values into a string -// map of float64 pointers -func Float64Map(src map[string]float64) map[string]*float64 { - dst := make(map[string]*float64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Float64ValueMap converts a string map of float64 pointers into a string -// map of float64 values -func Float64ValueMap(src map[string]*float64) map[string]float64 { - dst := make(map[string]float64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Time returns a pointer to the time.Time value passed in. -func Time(v time.Time) *time.Time { - return &v -} - -// TimeValue returns the value of the time.Time pointer passed in or -// time.Time{} if the pointer is nil. -func TimeValue(v *time.Time) time.Time { - if v != nil { - return *v - } - return time.Time{} -} - -// SecondsTimeValue converts an int64 pointer to a time.Time value -// representing seconds since Epoch or time.Time{} if the pointer is nil. -func SecondsTimeValue(v *int64) time.Time { - if v != nil { - return time.Unix((*v / 1000), 0) - } - return time.Time{} -} - -// MillisecondsTimeValue converts an int64 pointer to a time.Time value -// representing milliseconds sinch Epoch or time.Time{} if the pointer is nil. -func MillisecondsTimeValue(v *int64) time.Time { - if v != nil { - return time.Unix(0, (*v * 1000000)) - } - return time.Time{} -} - -// TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". -// The result is undefined if the Unix time cannot be represented by an int64. -// Which includes calling TimeUnixMilli on a zero Time is undefined. -// -// This utility is useful for service API's such as CloudWatch Logs which require -// their unix time values to be in milliseconds. -// -// See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information. -func TimeUnixMilli(t time.Time) int64 { - return t.UnixNano() / int64(time.Millisecond/time.Nanosecond) -} - -// TimeSlice converts a slice of time.Time values into a slice of -// time.Time pointers -func TimeSlice(src []time.Time) []*time.Time { - dst := make([]*time.Time, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// TimeValueSlice converts a slice of time.Time pointers into a slice of -// time.Time values -func TimeValueSlice(src []*time.Time) []time.Time { - dst := make([]time.Time, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// TimeMap converts a string map of time.Time values into a string -// map of time.Time pointers -func TimeMap(src map[string]time.Time) map[string]*time.Time { - dst := make(map[string]*time.Time) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// TimeValueMap converts a string map of time.Time pointers into a string -// map of time.Time values -func TimeValueMap(src map[string]*time.Time) map[string]time.Time { - dst := make(map[string]time.Time) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go deleted file mode 100644 index aa902d708..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ /dev/null @@ -1,230 +0,0 @@ -package corehandlers - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "regexp" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" -) - -// Interface for matching types which also have a Len method. -type lener interface { - Len() int -} - -// BuildContentLengthHandler builds the content length of a request based on the body, -// or will use the HTTPRequest.Header's "Content-Length" if defined. If unable -// to determine request body length and no "Content-Length" was specified it will panic. -// -// The Content-Length will only be added to the request if the length of the body -// is greater than 0. If the body is empty or the current `Content-Length` -// header is <= 0, the header will also be stripped. -var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *request.Request) { - var length int64 - - if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { - length, _ = strconv.ParseInt(slength, 10, 64) - } else { - if r.Body != nil { - var err error - length, err = aws.SeekerLen(r.Body) - if err != nil { - r.Error = awserr.New(request.ErrCodeSerialization, "failed to get request body's length", err) - return - } - } - } - - if length > 0 { - r.HTTPRequest.ContentLength = length - r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) - } else { - r.HTTPRequest.ContentLength = 0 - r.HTTPRequest.Header.Del("Content-Length") - } -}} - -var reStatusCode = regexp.MustCompile(`^(\d{3})`) - -// ValidateReqSigHandler is a request handler to ensure that the request's -// signature doesn't expire before it is sent. This can happen when a request -// is built and signed significantly before it is sent. Or significant delays -// occur when retrying requests that would cause the signature to expire. -var ValidateReqSigHandler = request.NamedHandler{ - Name: "core.ValidateReqSigHandler", - Fn: func(r *request.Request) { - // Unsigned requests are not signed - if r.Config.Credentials == credentials.AnonymousCredentials { - return - } - - signedTime := r.Time - if !r.LastSignedAt.IsZero() { - signedTime = r.LastSignedAt - } - - // 5 minutes to allow for some clock skew/delays in transmission. - // Would be improved with aws/aws-sdk-go#423 - if signedTime.Add(5 * time.Minute).After(time.Now()) { - return - } - - fmt.Println("request expired, resigning") - r.Sign() - }, -} - -// SendHandler is a request handler to send service request using HTTP client. -var SendHandler = request.NamedHandler{ - Name: "core.SendHandler", - Fn: func(r *request.Request) { - sender := sendFollowRedirects - if r.DisableFollowRedirects { - sender = sendWithoutFollowRedirects - } - - if request.NoBody == r.HTTPRequest.Body { - // Strip off the request body if the NoBody reader was used as a - // place holder for a request body. This prevents the SDK from - // making requests with a request body when it would be invalid - // to do so. - // - // Use a shallow copy of the http.Request to ensure the race condition - // of transport on Body will not trigger - reqOrig, reqCopy := r.HTTPRequest, *r.HTTPRequest - reqCopy.Body = nil - r.HTTPRequest = &reqCopy - defer func() { - r.HTTPRequest = reqOrig - }() - } - - var err error - r.HTTPResponse, err = sender(r) - if err != nil { - handleSendError(r, err) - } - }, -} - -func sendFollowRedirects(r *request.Request) (*http.Response, error) { - return r.Config.HTTPClient.Do(r.HTTPRequest) -} - -func sendWithoutFollowRedirects(r *request.Request) (*http.Response, error) { - transport := r.Config.HTTPClient.Transport - if transport == nil { - transport = http.DefaultTransport - } - - return transport.RoundTrip(r.HTTPRequest) -} - -func handleSendError(r *request.Request, err error) { - // Prevent leaking if an HTTPResponse was returned. Clean up - // the body. - if r.HTTPResponse != nil { - r.HTTPResponse.Body.Close() - } - // Capture the case where url.Error is returned for error processing - // response. e.g. 301 without location header comes back as string - // error and r.HTTPResponse is nil. Other URL redirect errors will - // comeback in a similar method. - if e, ok := err.(*url.Error); ok && e.Err != nil { - if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { - code, _ := strconv.ParseInt(s[1], 10, 64) - r.HTTPResponse = &http.Response{ - StatusCode: int(code), - Status: http.StatusText(int(code)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - return - } - } - if r.HTTPResponse == nil { - // Add a dummy request response object to ensure the HTTPResponse - // value is consistent. - r.HTTPResponse = &http.Response{ - StatusCode: int(0), - Status: http.StatusText(int(0)), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), - } - } - // Catch all request errors, and let the default retrier determine - // if the error is retryable. - r.Error = awserr.New(request.ErrCodeRequestError, "send request failed", err) - - // Override the error with a context canceled error, if that was canceled. - ctx := r.Context() - select { - case <-ctx.Done(): - r.Error = awserr.New(request.CanceledErrorCode, - "request context canceled", ctx.Err()) - r.Retryable = aws.Bool(false) - default: - } -} - -// ValidateResponseHandler is a request handler to validate service response. -var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseHandler", Fn: func(r *request.Request) { - if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 { - // this may be replaced by an UnmarshalError handler - r.Error = awserr.New("UnknownError", "unknown error", nil) - } -}} - -// AfterRetryHandler performs final checks to determine if the request should -// be retried and how long to delay. -var AfterRetryHandler = request.NamedHandler{ - Name: "core.AfterRetryHandler", - Fn: func(r *request.Request) { - // If one of the other handlers already set the retry state - // we don't want to override it based on the service's state - if r.Retryable == nil || aws.BoolValue(r.Config.EnforceShouldRetryCheck) { - r.Retryable = aws.Bool(r.ShouldRetry(r)) - } - - if r.WillRetry() { - r.RetryDelay = r.RetryRules(r) - - if sleepFn := r.Config.SleepDelay; sleepFn != nil { - // Support SleepDelay for backwards compatibility and testing - sleepFn(r.RetryDelay) - } else if err := aws.SleepWithContext(r.Context(), r.RetryDelay); err != nil { - r.Error = awserr.New(request.CanceledErrorCode, - "request context canceled", err) - r.Retryable = aws.Bool(false) - return - } - - // when the expired token exception occurs the credentials - // need to be expired locally so that the next request to - // get credentials will trigger a credentials refresh. - if r.IsErrorExpired() { - r.Config.Credentials.Expire() - } - - r.RetryCount++ - r.Error = nil - } - }} - -// ValidateEndpointHandler is a request handler to validate a request had the -// appropriate Region and Endpoint set. Will set r.Error if the endpoint or -// region is not valid. -var ValidateEndpointHandler = request.NamedHandler{Name: "core.ValidateEndpointHandler", Fn: func(r *request.Request) { - if r.ClientInfo.SigningRegion == "" && aws.StringValue(r.Config.Region) == "" { - r.Error = aws.ErrMissingRegion - } else if r.ClientInfo.Endpoint == "" { - r.Error = aws.ErrMissingEndpoint - } -}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go deleted file mode 100644 index 7d50b1557..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go +++ /dev/null @@ -1,17 +0,0 @@ -package corehandlers - -import "github.com/aws/aws-sdk-go/aws/request" - -// ValidateParametersHandler is a request handler to validate the input parameters. -// Validating parameters only has meaning if done prior to the request being sent. -var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { - if !r.ParamsFilled() { - return - } - - if v, ok := r.Params.(request.Validator); ok { - if err := v.Validate(); err != nil { - r.Error = err - } - } -}} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go deleted file mode 100644 index ab69c7a6f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go +++ /dev/null @@ -1,37 +0,0 @@ -package corehandlers - -import ( - "os" - "runtime" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// SDKVersionUserAgentHandler is a request handler for adding the SDK Version -// to the user agent. -var SDKVersionUserAgentHandler = request.NamedHandler{ - Name: "core.SDKVersionUserAgentHandler", - Fn: request.MakeAddToUserAgentHandler(aws.SDKName, aws.SDKVersion, - runtime.Version(), runtime.GOOS, runtime.GOARCH), -} - -const execEnvVar = `AWS_EXECUTION_ENV` -const execEnvUAKey = `exec-env` - -// AddHostExecEnvUserAgentHander is a request handler appending the SDK's -// execution environment to the user agent. -// -// If the environment variable AWS_EXECUTION_ENV is set, its value will be -// appended to the user agent string. -var AddHostExecEnvUserAgentHander = request.NamedHandler{ - Name: "core.AddHostExecEnvUserAgentHander", - Fn: func(r *request.Request) { - v := os.Getenv(execEnvVar) - if len(v) == 0 { - return - } - - request.AddToUserAgent(r, execEnvUAKey+"/"+v) - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go deleted file mode 100644 index 3ad1e798d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go +++ /dev/null @@ -1,100 +0,0 @@ -package credentials - -import ( - "github.com/aws/aws-sdk-go/aws/awserr" -) - -var ( - // ErrNoValidProvidersFoundInChain Is returned when there are no valid - // providers in the ChainProvider. - // - // This has been deprecated. For verbose error messaging set - // aws.Config.CredentialsChainVerboseErrors to true. - ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", - `no valid providers in chain. Deprecated. - For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, - nil) -) - -// A ChainProvider will search for a provider which returns credentials -// and cache that provider until Retrieve is called again. -// -// The ChainProvider provides a way of chaining multiple providers together -// which will pick the first available using priority order of the Providers -// in the list. -// -// If none of the Providers retrieve valid credentials Value, ChainProvider's -// Retrieve() will return the error ErrNoValidProvidersFoundInChain. -// -// If a Provider is found which returns valid credentials Value ChainProvider -// will cache that Provider for all calls to IsExpired(), until Retrieve is -// called again. -// -// Example of ChainProvider to be used with an EnvProvider and EC2RoleProvider. -// In this example EnvProvider will first check if any credentials are available -// via the environment variables. If there are none ChainProvider will check -// the next Provider in the list, EC2RoleProvider in this case. If EC2RoleProvider -// does not return any credentials ChainProvider will return the error -// ErrNoValidProvidersFoundInChain -// -// creds := credentials.NewChainCredentials( -// []credentials.Provider{ -// &credentials.EnvProvider{}, -// &ec2rolecreds.EC2RoleProvider{ -// Client: ec2metadata.New(sess), -// }, -// }) -// -// // Usage of ChainCredentials with aws.Config -// svc := ec2.New(session.Must(session.NewSession(&aws.Config{ -// Credentials: creds, -// }))) -// -type ChainProvider struct { - Providers []Provider - curr Provider - VerboseErrors bool -} - -// NewChainCredentials returns a pointer to a new Credentials object -// wrapping a chain of providers. -func NewChainCredentials(providers []Provider) *Credentials { - return NewCredentials(&ChainProvider{ - Providers: append([]Provider{}, providers...), - }) -} - -// Retrieve returns the credentials value or error if no provider returned -// without error. -// -// If a provider is found it will be cached and any calls to IsExpired() -// will return the expired state of the cached provider. -func (c *ChainProvider) Retrieve() (Value, error) { - var errs []error - for _, p := range c.Providers { - creds, err := p.Retrieve() - if err == nil { - c.curr = p - return creds, nil - } - errs = append(errs, err) - } - c.curr = nil - - var err error - err = ErrNoValidProvidersFoundInChain - if c.VerboseErrors { - err = awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs) - } - return Value{}, err -} - -// IsExpired will returned the expired state of the currently cached provider -// if there is one. If there is no current provider, true will be returned. -func (c *ChainProvider) IsExpired() bool { - if c.curr != nil { - return c.curr.IsExpired() - } - - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.5.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.5.go deleted file mode 100644 index 5852b2648..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.5.go +++ /dev/null @@ -1,22 +0,0 @@ -// +build !go1.7 - -package credentials - -import ( - "github.com/aws/aws-sdk-go/internal/context" -) - -// backgroundContext returns a context that will never be canceled, has no -// values, and no deadline. This context is used by the SDK to provide -// backwards compatibility with non-context API operations and functionality. -// -// Go 1.6 and before: -// This context function is equivalent to context.Background in the Go stdlib. -// -// Go 1.7 and later: -// The context returned will be the value returned by context.Background() -// -// See https://golang.org/pkg/context for more information on Contexts. -func backgroundContext() Context { - return context.BackgroundCtx -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.7.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.7.go deleted file mode 100644 index 388b21541..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.7.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build go1.7 - -package credentials - -import "context" - -// backgroundContext returns a context that will never be canceled, has no -// values, and no deadline. This context is used by the SDK to provide -// backwards compatibility with non-context API operations and functionality. -// -// Go 1.6 and before: -// This context function is equivalent to context.Background in the Go stdlib. -// -// Go 1.7 and later: -// The context returned will be the value returned by context.Background() -// -// See https://golang.org/pkg/context for more information on Contexts. -func backgroundContext() Context { - return context.Background() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.5.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.5.go deleted file mode 100644 index 8152a864a..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.5.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build !go1.9 - -package credentials - -import "time" - -// Context is an copy of the Go v1.7 stdlib's context.Context interface. -// It is represented as a SDK interface to enable you to use the "WithContext" -// API methods with Go v1.6 and a Context type such as golang.org/x/net/context. -// -// This type, aws.Context, and context.Context are equivalent. -// -// See https://golang.org/pkg/context on how to use contexts. -type Context interface { - // 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. - Deadline() (deadline time.Time, ok bool) - - // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. - Done() <-chan struct{} - - // Err returns a non-nil error value after Done is closed. Err returns - // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. - // After Done is closed, successive calls to Err return the same value. - Err() error - - // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with - // the same key returns the same result. - // - // Use context values only for request-scoped data that transits - // processes and API boundaries, not for passing optional parameters to - // functions. - Value(key interface{}) interface{} -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.9.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.9.go deleted file mode 100644 index 4356edb3d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.9.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build go1.9 - -package credentials - -import "context" - -// Context is an alias of the Go stdlib's context.Context interface. -// It can be used within the SDK's API operation "WithContext" methods. -// -// This type, aws.Context, and context.Context are equivalent. -// -// See https://golang.org/pkg/context on how to use contexts. -type Context = context.Context diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go deleted file mode 100644 index 9f8fd92a5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ /dev/null @@ -1,339 +0,0 @@ -// Package credentials provides credential retrieval and management -// -// The Credentials is the primary method of getting access to and managing -// credentials Values. Using dependency injection retrieval of the credential -// values is handled by a object which satisfies the Provider interface. -// -// By default the Credentials.Get() will cache the successful result of a -// Provider's Retrieve() until Provider.IsExpired() returns true. At which -// point Credentials will call Provider's Retrieve() to get new credential Value. -// -// The Provider is responsible for determining when credentials Value have expired. -// It is also important to note that Credentials will always call Retrieve the -// first time Credentials.Get() is called. -// -// Example of using the environment variable credentials. -// -// creds := credentials.NewEnvCredentials() -// -// // Retrieve the credentials value -// credValue, err := creds.Get() -// if err != nil { -// // handle error -// } -// -// Example of forcing credentials to expire and be refreshed on the next Get(). -// This may be helpful to proactively expire credentials and refresh them sooner -// than they would naturally expire on their own. -// -// creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{}) -// creds.Expire() -// credsValue, err := creds.Get() -// // New credentials will be retrieved instead of from cache. -// -// -// Custom Provider -// -// Each Provider built into this package also provides a helper method to generate -// a Credentials pointer setup with the provider. To use a custom Provider just -// create a type which satisfies the Provider interface and pass it to the -// NewCredentials method. -// -// type MyProvider struct{} -// func (m *MyProvider) Retrieve() (Value, error) {...} -// func (m *MyProvider) IsExpired() bool {...} -// -// creds := credentials.NewCredentials(&MyProvider{}) -// credValue, err := creds.Get() -// -package credentials - -import ( - "fmt" - "sync/atomic" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/internal/sync/singleflight" -) - -// AnonymousCredentials is an empty Credential object that can be used as -// dummy placeholder credentials for requests that do not need signed. -// -// This Credentials can be used to configure a service to not sign requests -// when making service API calls. For example, when accessing public -// s3 buckets. -// -// svc := s3.New(session.Must(session.NewSession(&aws.Config{ -// Credentials: credentials.AnonymousCredentials, -// }))) -// // Access public S3 buckets. -var AnonymousCredentials = NewStaticCredentials("", "", "") - -// A Value is the AWS credentials value for individual credential fields. -type Value struct { - // AWS Access key ID - AccessKeyID string - - // AWS Secret Access Key - SecretAccessKey string - - // AWS Session Token - SessionToken string - - // Provider used to get credentials - ProviderName string -} - -// HasKeys returns if the credentials Value has both AccessKeyID and -// SecretAccessKey value set. -func (v Value) HasKeys() bool { - return len(v.AccessKeyID) != 0 && len(v.SecretAccessKey) != 0 -} - -// A Provider is the interface for any component which will provide credentials -// Value. A provider is required to manage its own Expired state, and what to -// be expired means. -// -// The Provider should not need to implement its own mutexes, because -// that will be managed by Credentials. -type Provider interface { - // Retrieve returns nil if it successfully retrieved the value. - // Error is returned if the value were not obtainable, or empty. - Retrieve() (Value, error) - - // IsExpired returns if the credentials are no longer valid, and need - // to be retrieved. - IsExpired() bool -} - -// ProviderWithContext is a Provider that can retrieve credentials with a Context -type ProviderWithContext interface { - Provider - - RetrieveWithContext(Context) (Value, error) -} - -// An Expirer is an interface that Providers can implement to expose the expiration -// time, if known. If the Provider cannot accurately provide this info, -// it should not implement this interface. -type Expirer interface { - // The time at which the credentials are no longer valid - ExpiresAt() time.Time -} - -// An ErrorProvider is a stub credentials provider that always returns an error -// this is used by the SDK when construction a known provider is not possible -// due to an error. -type ErrorProvider struct { - // The error to be returned from Retrieve - Err error - - // The provider name to set on the Retrieved returned Value - ProviderName string -} - -// Retrieve will always return the error that the ErrorProvider was created with. -func (p ErrorProvider) Retrieve() (Value, error) { - return Value{ProviderName: p.ProviderName}, p.Err -} - -// IsExpired will always return not expired. -func (p ErrorProvider) IsExpired() bool { - return false -} - -// A Expiry provides shared expiration logic to be used by credentials -// providers to implement expiry functionality. -// -// The best method to use this struct is as an anonymous field within the -// provider's struct. -// -// Example: -// type EC2RoleProvider struct { -// Expiry -// ... -// } -type Expiry struct { - // The date/time when to expire on - expiration time.Time - - // If set will be used by IsExpired to determine the current time. - // Defaults to time.Now if CurrentTime is not set. Available for testing - // to be able to mock out the current time. - CurrentTime func() time.Time -} - -// SetExpiration sets the expiration IsExpired will check when called. -// -// If window is greater than 0 the expiration time will be reduced by the -// window value. -// -// Using a window is helpful to trigger credentials to expire sooner than -// the expiration time given to ensure no requests are made with expired -// tokens. -func (e *Expiry) SetExpiration(expiration time.Time, window time.Duration) { - e.expiration = expiration - if window > 0 { - e.expiration = e.expiration.Add(-window) - } -} - -// IsExpired returns if the credentials are expired. -func (e *Expiry) IsExpired() bool { - curTime := e.CurrentTime - if curTime == nil { - curTime = time.Now - } - return e.expiration.Before(curTime()) -} - -// ExpiresAt returns the expiration time of the credential -func (e *Expiry) ExpiresAt() time.Time { - return e.expiration -} - -// A Credentials provides concurrency safe retrieval of AWS credentials Value. -// Credentials will cache the credentials value until they expire. Once the value -// expires the next Get will attempt to retrieve valid credentials. -// -// Credentials is safe to use across multiple goroutines and will manage the -// synchronous state so the Providers do not need to implement their own -// synchronization. -// -// The first Credentials.Get() will always call Provider.Retrieve() to get the -// first instance of the credentials Value. All calls to Get() after that -// will return the cached credentials Value until IsExpired() returns true. -type Credentials struct { - creds atomic.Value - sf singleflight.Group - - provider Provider -} - -// NewCredentials returns a pointer to a new Credentials with the provider set. -func NewCredentials(provider Provider) *Credentials { - c := &Credentials{ - provider: provider, - } - c.creds.Store(Value{}) - return c -} - -// GetWithContext returns the credentials value, or error if the credentials -// Value failed to be retrieved. Will return early if the passed in context is -// canceled. -// -// Will return the cached credentials Value if it has not expired. If the -// credentials Value has expired the Provider's Retrieve() will be called -// to refresh the credentials. -// -// If Credentials.Expire() was called the credentials Value will be force -// expired, and the next call to Get() will cause them to be refreshed. -// -// Passed in Context is equivalent to aws.Context, and context.Context. -func (c *Credentials) GetWithContext(ctx Context) (Value, error) { - if curCreds := c.creds.Load(); !c.isExpired(curCreds) { - return curCreds.(Value), nil - } - - // Cannot pass context down to the actual retrieve, because the first - // context would cancel the whole group when there is not direct - // association of items in the group. - resCh := c.sf.DoChan("", func() (interface{}, error) { - return c.singleRetrieve(&suppressedContext{ctx}) - }) - select { - case res := <-resCh: - return res.Val.(Value), res.Err - case <-ctx.Done(): - return Value{}, awserr.New("RequestCanceled", - "request context canceled", ctx.Err()) - } -} - -func (c *Credentials) singleRetrieve(ctx Context) (creds interface{}, err error) { - if curCreds := c.creds.Load(); !c.isExpired(curCreds) { - return curCreds.(Value), nil - } - - if p, ok := c.provider.(ProviderWithContext); ok { - creds, err = p.RetrieveWithContext(ctx) - } else { - creds, err = c.provider.Retrieve() - } - if err == nil { - c.creds.Store(creds) - } - - return creds, err -} - -// Get returns the credentials value, or error if the credentials Value failed -// to be retrieved. -// -// Will return the cached credentials Value if it has not expired. If the -// credentials Value has expired the Provider's Retrieve() will be called -// to refresh the credentials. -// -// If Credentials.Expire() was called the credentials Value will be force -// expired, and the next call to Get() will cause them to be refreshed. -func (c *Credentials) Get() (Value, error) { - return c.GetWithContext(backgroundContext()) -} - -// Expire expires the credentials and forces them to be retrieved on the -// next call to Get(). -// -// This will override the Provider's expired state, and force Credentials -// to call the Provider's Retrieve(). -func (c *Credentials) Expire() { - c.creds.Store(Value{}) -} - -// IsExpired returns if the credentials are no longer valid, and need -// to be retrieved. -// -// If the Credentials were forced to be expired with Expire() this will -// reflect that override. -func (c *Credentials) IsExpired() bool { - return c.isExpired(c.creds.Load()) -} - -// isExpired helper method wrapping the definition of expired credentials. -func (c *Credentials) isExpired(creds interface{}) bool { - return creds == nil || creds.(Value) == Value{} || c.provider.IsExpired() -} - -// ExpiresAt provides access to the functionality of the Expirer interface of -// the underlying Provider, if it supports that interface. Otherwise, it returns -// an error. -func (c *Credentials) ExpiresAt() (time.Time, error) { - expirer, ok := c.provider.(Expirer) - if !ok { - return time.Time{}, awserr.New("ProviderNotExpirer", - fmt.Sprintf("provider %s does not support ExpiresAt()", c.creds.Load().(Value).ProviderName), - nil) - } - if c.creds.Load().(Value) == (Value{}) { - // set expiration time to the distant past - return time.Time{}, nil - } - return expirer.ExpiresAt(), nil -} - -type suppressedContext struct { - Context -} - -func (s *suppressedContext) Deadline() (deadline time.Time, ok bool) { - return time.Time{}, false -} - -func (s *suppressedContext) Done() <-chan struct{} { - return nil -} - -func (s *suppressedContext) Err() error { - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go deleted file mode 100644 index 92af5b725..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go +++ /dev/null @@ -1,188 +0,0 @@ -package ec2rolecreds - -import ( - "bufio" - "encoding/json" - "fmt" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/sdkuri" -) - -// ProviderName provides a name of EC2Role provider -const ProviderName = "EC2RoleProvider" - -// A EC2RoleProvider retrieves credentials from the EC2 service, and keeps track if -// those credentials are expired. -// -// Example how to configure the EC2RoleProvider with custom http Client, Endpoint -// or ExpiryWindow -// -// p := &ec2rolecreds.EC2RoleProvider{ -// // Pass in a custom timeout to be used when requesting -// // IAM EC2 Role credentials. -// Client: ec2metadata.New(sess, aws.Config{ -// HTTPClient: &http.Client{Timeout: 10 * time.Second}, -// }), -// -// // Do not use early expiry of credentials. If a non zero value is -// // specified the credentials will be expired early -// ExpiryWindow: 0, -// } -type EC2RoleProvider struct { - credentials.Expiry - - // Required EC2Metadata client to use when connecting to EC2 metadata service. - Client *ec2metadata.EC2Metadata - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration -} - -// NewCredentials returns a pointer to a new Credentials object wrapping -// the EC2RoleProvider. Takes a ConfigProvider to create a EC2Metadata client. -// The ConfigProvider is satisfied by the session.Session type. -func NewCredentials(c client.ConfigProvider, options ...func(*EC2RoleProvider)) *credentials.Credentials { - p := &EC2RoleProvider{ - Client: ec2metadata.New(c), - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping -// the EC2RoleProvider. Takes a EC2Metadata client to use when connecting to EC2 -// metadata service. -func NewCredentialsWithClient(client *ec2metadata.EC2Metadata, options ...func(*EC2RoleProvider)) *credentials.Credentials { - p := &EC2RoleProvider{ - Client: client, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// Retrieve retrieves credentials from the EC2 service. -// Error will be returned if the request fails, or unable to extract -// the desired credentials. -func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { - return m.RetrieveWithContext(aws.BackgroundContext()) -} - -// RetrieveWithContext retrieves credentials from the EC2 service. -// Error will be returned if the request fails, or unable to extract -// the desired credentials. -func (m *EC2RoleProvider) RetrieveWithContext(ctx credentials.Context) (credentials.Value, error) { - credsList, err := requestCredList(ctx, m.Client) - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - if len(credsList) == 0 { - return credentials.Value{ProviderName: ProviderName}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) - } - credsName := credsList[0] - - roleCreds, err := requestCred(ctx, m.Client, credsName) - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - m.SetExpiration(roleCreds.Expiration, m.ExpiryWindow) - - return credentials.Value{ - AccessKeyID: roleCreds.AccessKeyID, - SecretAccessKey: roleCreds.SecretAccessKey, - SessionToken: roleCreds.Token, - ProviderName: ProviderName, - }, nil -} - -// A ec2RoleCredRespBody provides the shape for unmarshaling credential -// request responses. -type ec2RoleCredRespBody struct { - // Success State - Expiration time.Time - AccessKeyID string - SecretAccessKey string - Token string - - // Error state - Code string - Message string -} - -const iamSecurityCredsPath = "iam/security-credentials/" - -// requestCredList requests a list of credentials from the EC2 service. -// If there are no credentials, or there is an error making or receiving the request -func requestCredList(ctx aws.Context, client *ec2metadata.EC2Metadata) ([]string, error) { - resp, err := client.GetMetadataWithContext(ctx, iamSecurityCredsPath) - if err != nil { - return nil, awserr.New("EC2RoleRequestError", "no EC2 instance role found", err) - } - - credsList := []string{} - s := bufio.NewScanner(strings.NewReader(resp)) - for s.Scan() { - credsList = append(credsList, s.Text()) - } - - if err := s.Err(); err != nil { - return nil, awserr.New(request.ErrCodeSerialization, - "failed to read EC2 instance role from metadata service", err) - } - - return credsList, nil -} - -// requestCred requests the credentials for a specific credentials from the EC2 service. -// -// If the credentials cannot be found, or there is an error reading the response -// and error will be returned. -func requestCred(ctx aws.Context, client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCredRespBody, error) { - resp, err := client.GetMetadataWithContext(ctx, sdkuri.PathJoin(iamSecurityCredsPath, credsName)) - if err != nil { - return ec2RoleCredRespBody{}, - awserr.New("EC2RoleRequestError", - fmt.Sprintf("failed to get %s EC2 instance role credentials", credsName), - err) - } - - respCreds := ec2RoleCredRespBody{} - if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { - return ec2RoleCredRespBody{}, - awserr.New(request.ErrCodeSerialization, - fmt.Sprintf("failed to decode %s EC2 instance role credentials", credsName), - err) - } - - if respCreds.Code != "Success" { - // If an error code was returned something failed requesting the role. - return ec2RoleCredRespBody{}, awserr.New(respCreds.Code, respCreds.Message, nil) - } - - return respCreds, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go deleted file mode 100644 index 785f30d8e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go +++ /dev/null @@ -1,210 +0,0 @@ -// Package endpointcreds provides support for retrieving credentials from an -// arbitrary HTTP endpoint. -// -// The credentials endpoint Provider can receive both static and refreshable -// credentials that will expire. Credentials are static when an "Expiration" -// value is not provided in the endpoint's response. -// -// Static credentials will never expire once they have been retrieved. The format -// of the static credentials response: -// { -// "AccessKeyId" : "MUA...", -// "SecretAccessKey" : "/7PC5om....", -// } -// -// Refreshable credentials will expire within the "ExpiryWindow" of the Expiration -// value in the response. The format of the refreshable credentials response: -// { -// "AccessKeyId" : "MUA...", -// "SecretAccessKey" : "/7PC5om....", -// "Token" : "AQoDY....=", -// "Expiration" : "2016-02-25T06:03:31Z" -// } -// -// Errors should be returned in the following format and only returned with 400 -// or 500 HTTP status codes. -// { -// "code": "ErrorCode", -// "message": "Helpful error message." -// } -package endpointcreds - -import ( - "encoding/json" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" -) - -// ProviderName is the name of the credentials provider. -const ProviderName = `CredentialsEndpointProvider` - -// Provider satisfies the credentials.Provider interface, and is a client to -// retrieve credentials from an arbitrary endpoint. -type Provider struct { - staticCreds bool - credentials.Expiry - - // Requires a AWS Client to make HTTP requests to the endpoint with. - // the Endpoint the request will be made to is provided by the aws.Config's - // Endpoint value. - Client *client.Client - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration - - // Optional authorization token value if set will be used as the value of - // the Authorization header of the endpoint credential request. - AuthorizationToken string -} - -// NewProviderClient returns a credentials Provider for retrieving AWS credentials -// from arbitrary endpoint. -func NewProviderClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) credentials.Provider { - p := &Provider{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "CredentialsEndpoint", - Endpoint: endpoint, - }, - handlers, - ), - } - - p.Client.Handlers.Unmarshal.PushBack(unmarshalHandler) - p.Client.Handlers.UnmarshalError.PushBack(unmarshalError) - p.Client.Handlers.Validate.Clear() - p.Client.Handlers.Validate.PushBack(validateEndpointHandler) - - for _, option := range options { - option(p) - } - - return p -} - -// NewCredentialsClient returns a pointer to a new Credentials object -// wrapping the endpoint credentials Provider. -func NewCredentialsClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) *credentials.Credentials { - return credentials.NewCredentials(NewProviderClient(cfg, handlers, endpoint, options...)) -} - -// IsExpired returns true if the credentials retrieved are expired, or not yet -// retrieved. -func (p *Provider) IsExpired() bool { - if p.staticCreds { - return false - } - return p.Expiry.IsExpired() -} - -// Retrieve will attempt to request the credentials from the endpoint the Provider -// was configured for. And error will be returned if the retrieval fails. -func (p *Provider) Retrieve() (credentials.Value, error) { - return p.RetrieveWithContext(aws.BackgroundContext()) -} - -// RetrieveWithContext will attempt to request the credentials from the endpoint the Provider -// was configured for. And error will be returned if the retrieval fails. -func (p *Provider) RetrieveWithContext(ctx credentials.Context) (credentials.Value, error) { - resp, err := p.getCredentials(ctx) - if err != nil { - return credentials.Value{ProviderName: ProviderName}, - awserr.New("CredentialsEndpointError", "failed to load credentials", err) - } - - if resp.Expiration != nil { - p.SetExpiration(*resp.Expiration, p.ExpiryWindow) - } else { - p.staticCreds = true - } - - return credentials.Value{ - AccessKeyID: resp.AccessKeyID, - SecretAccessKey: resp.SecretAccessKey, - SessionToken: resp.Token, - ProviderName: ProviderName, - }, nil -} - -type getCredentialsOutput struct { - Expiration *time.Time - AccessKeyID string - SecretAccessKey string - Token string -} - -type errorOutput struct { - Code string `json:"code"` - Message string `json:"message"` -} - -func (p *Provider) getCredentials(ctx aws.Context) (*getCredentialsOutput, error) { - op := &request.Operation{ - Name: "GetCredentials", - HTTPMethod: "GET", - } - - out := &getCredentialsOutput{} - req := p.Client.NewRequest(op, nil, out) - req.SetContext(ctx) - req.HTTPRequest.Header.Set("Accept", "application/json") - if authToken := p.AuthorizationToken; len(authToken) != 0 { - req.HTTPRequest.Header.Set("Authorization", authToken) - } - - return out, req.Send() -} - -func validateEndpointHandler(r *request.Request) { - if len(r.ClientInfo.Endpoint) == 0 { - r.Error = aws.ErrMissingEndpoint - } -} - -func unmarshalHandler(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - out := r.Data.(*getCredentialsOutput) - if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&out); err != nil { - r.Error = awserr.New(request.ErrCodeSerialization, - "failed to decode endpoint credentials", - err, - ) - } -} - -func unmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - var errOut errorOutput - err := jsonutil.UnmarshalJSONError(&errOut, r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, - "failed to decode error message", err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - - // Response body format is not consistent between metadata endpoints. - // Grab the error message as a string and include that as the source error - r.Error = awserr.New(errOut.Code, errOut.Message, nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go deleted file mode 100644 index 54c5cf733..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go +++ /dev/null @@ -1,74 +0,0 @@ -package credentials - -import ( - "os" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// EnvProviderName provides a name of Env provider -const EnvProviderName = "EnvProvider" - -var ( - // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be - // found in the process's environment. - ErrAccessKeyIDNotFound = awserr.New("EnvAccessKeyNotFound", "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment", nil) - - // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key - // can't be found in the process's environment. - ErrSecretAccessKeyNotFound = awserr.New("EnvSecretNotFound", "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment", nil) -) - -// A EnvProvider retrieves credentials from the environment variables of the -// running process. Environment credentials never expire. -// -// Environment variables used: -// -// * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY -// -// * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY -type EnvProvider struct { - retrieved bool -} - -// NewEnvCredentials returns a pointer to a new Credentials object -// wrapping the environment variable provider. -func NewEnvCredentials() *Credentials { - return NewCredentials(&EnvProvider{}) -} - -// Retrieve retrieves the keys from the environment. -func (e *EnvProvider) Retrieve() (Value, error) { - e.retrieved = false - - id := os.Getenv("AWS_ACCESS_KEY_ID") - if id == "" { - id = os.Getenv("AWS_ACCESS_KEY") - } - - secret := os.Getenv("AWS_SECRET_ACCESS_KEY") - if secret == "" { - secret = os.Getenv("AWS_SECRET_KEY") - } - - if id == "" { - return Value{ProviderName: EnvProviderName}, ErrAccessKeyIDNotFound - } - - if secret == "" { - return Value{ProviderName: EnvProviderName}, ErrSecretAccessKeyNotFound - } - - e.retrieved = true - return Value{ - AccessKeyID: id, - SecretAccessKey: secret, - SessionToken: os.Getenv("AWS_SESSION_TOKEN"), - ProviderName: EnvProviderName, - }, nil -} - -// IsExpired returns if the credentials have been retrieved. -func (e *EnvProvider) IsExpired() bool { - return !e.retrieved -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini b/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini deleted file mode 100644 index 7fc91d9d2..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini +++ /dev/null @@ -1,12 +0,0 @@ -[default] -aws_access_key_id = accessKey -aws_secret_access_key = secret -aws_session_token = token - -[no_token] -aws_access_key_id = accessKey -aws_secret_access_key = secret - -[with_colon] -aws_access_key_id: accessKey -aws_secret_access_key: secret diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go deleted file mode 100644 index e62483600..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go +++ /dev/null @@ -1,426 +0,0 @@ -/* -Package processcreds is a credential Provider to retrieve `credential_process` -credentials. - -WARNING: The following describes a method of sourcing credentials from an external -process. This can potentially be dangerous, so proceed with caution. Other -credential providers should be preferred if at all possible. If using this -option, you should make sure that the config file is as locked down as possible -using security best practices for your operating system. - -You can use credentials from a `credential_process` in a variety of ways. - -One way is to setup your shared config file, located in the default -location, with the `credential_process` key and the command you want to be -called. You also need to set the AWS_SDK_LOAD_CONFIG environment variable -(e.g., `export AWS_SDK_LOAD_CONFIG=1`) to use the shared config file. - - [default] - credential_process = /command/to/call - -Creating a new session will use the credential process to retrieve credentials. -NOTE: If there are credentials in the profile you are using, the credential -process will not be used. - - // Initialize a session to load credentials. - sess, _ := session.NewSession(&aws.Config{ - Region: aws.String("us-east-1")}, - ) - - // Create S3 service client to use the credentials. - svc := s3.New(sess) - -Another way to use the `credential_process` method is by using -`credentials.NewCredentials()` and providing a command to be executed to -retrieve credentials: - - // Create credentials using the ProcessProvider. - creds := processcreds.NewCredentials("/path/to/command") - - // Create service client value configured for credentials. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -You can set a non-default timeout for the `credential_process` with another -constructor, `credentials.NewCredentialsTimeout()`, providing the timeout. To -set a one minute timeout: - - // Create credentials using the ProcessProvider. - creds := processcreds.NewCredentialsTimeout( - "/path/to/command", - time.Duration(500) * time.Millisecond) - -If you need more control, you can set any configurable options in the -credentials using one or more option functions. For example, you can set a two -minute timeout, a credential duration of 60 minutes, and a maximum stdout -buffer size of 2k. - - creds := processcreds.NewCredentials( - "/path/to/command", - func(opt *ProcessProvider) { - opt.Timeout = time.Duration(2) * time.Minute - opt.Duration = time.Duration(60) * time.Minute - opt.MaxBufSize = 2048 - }) - -You can also use your own `exec.Cmd`: - - // Create an exec.Cmd - myCommand := exec.Command("/path/to/command") - - // Create credentials using your exec.Cmd and custom timeout - creds := processcreds.NewCredentialsCommand( - myCommand, - func(opt *processcreds.ProcessProvider) { - opt.Timeout = time.Duration(1) * time.Second - }) -*/ -package processcreds - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "os" - "os/exec" - "runtime" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/internal/sdkio" -) - -const ( - // ProviderName is the name this credentials provider will label any - // returned credentials Value with. - ProviderName = `ProcessProvider` - - // ErrCodeProcessProviderParse error parsing process output - ErrCodeProcessProviderParse = "ProcessProviderParseError" - - // ErrCodeProcessProviderVersion version error in output - ErrCodeProcessProviderVersion = "ProcessProviderVersionError" - - // ErrCodeProcessProviderRequired required attribute missing in output - ErrCodeProcessProviderRequired = "ProcessProviderRequiredError" - - // ErrCodeProcessProviderExecution execution of command failed - ErrCodeProcessProviderExecution = "ProcessProviderExecutionError" - - // errMsgProcessProviderTimeout process took longer than allowed - errMsgProcessProviderTimeout = "credential process timed out" - - // errMsgProcessProviderProcess process error - errMsgProcessProviderProcess = "error in credential_process" - - // errMsgProcessProviderParse problem parsing output - errMsgProcessProviderParse = "parse failed of credential_process output" - - // errMsgProcessProviderVersion version error in output - errMsgProcessProviderVersion = "wrong version in process output (not 1)" - - // errMsgProcessProviderMissKey missing access key id in output - errMsgProcessProviderMissKey = "missing AccessKeyId in process output" - - // errMsgProcessProviderMissSecret missing secret acess key in output - errMsgProcessProviderMissSecret = "missing SecretAccessKey in process output" - - // errMsgProcessProviderPrepareCmd prepare of command failed - errMsgProcessProviderPrepareCmd = "failed to prepare command" - - // errMsgProcessProviderEmptyCmd command must not be empty - errMsgProcessProviderEmptyCmd = "command must not be empty" - - // errMsgProcessProviderPipe failed to initialize pipe - errMsgProcessProviderPipe = "failed to initialize pipe" - - // DefaultDuration is the default amount of time in minutes that the - // credentials will be valid for. - DefaultDuration = time.Duration(15) * time.Minute - - // DefaultBufSize limits buffer size from growing to an enormous - // amount due to a faulty process. - DefaultBufSize = int(8 * sdkio.KibiByte) - - // DefaultTimeout default limit on time a process can run. - DefaultTimeout = time.Duration(1) * time.Minute -) - -// ProcessProvider satisfies the credentials.Provider interface, and is a -// client to retrieve credentials from a process. -type ProcessProvider struct { - staticCreds bool - credentials.Expiry - originalCommand []string - - // Expiry duration of the credentials. Defaults to 15 minutes if not set. - Duration time.Duration - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration - - // A string representing an os command that should return a JSON with - // credential information. - command *exec.Cmd - - // MaxBufSize limits memory usage from growing to an enormous - // amount due to a faulty process. - MaxBufSize int - - // Timeout limits the time a process can run. - Timeout time.Duration -} - -// NewCredentials returns a pointer to a new Credentials object wrapping the -// ProcessProvider. The credentials will expire every 15 minutes by default. -func NewCredentials(command string, options ...func(*ProcessProvider)) *credentials.Credentials { - p := &ProcessProvider{ - command: exec.Command(command), - Duration: DefaultDuration, - Timeout: DefaultTimeout, - MaxBufSize: DefaultBufSize, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// NewCredentialsTimeout returns a pointer to a new Credentials object with -// the specified command and timeout, and default duration and max buffer size. -func NewCredentialsTimeout(command string, timeout time.Duration) *credentials.Credentials { - p := NewCredentials(command, func(opt *ProcessProvider) { - opt.Timeout = timeout - }) - - return p -} - -// NewCredentialsCommand returns a pointer to a new Credentials object with -// the specified command, and default timeout, duration and max buffer size. -func NewCredentialsCommand(command *exec.Cmd, options ...func(*ProcessProvider)) *credentials.Credentials { - p := &ProcessProvider{ - command: command, - Duration: DefaultDuration, - Timeout: DefaultTimeout, - MaxBufSize: DefaultBufSize, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -type credentialProcessResponse struct { - Version int - AccessKeyID string `json:"AccessKeyId"` - SecretAccessKey string - SessionToken string - Expiration *time.Time -} - -// Retrieve executes the 'credential_process' and returns the credentials. -func (p *ProcessProvider) Retrieve() (credentials.Value, error) { - out, err := p.executeCredentialProcess() - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - // Serialize and validate response - resp := &credentialProcessResponse{} - if err = json.Unmarshal(out, resp); err != nil { - return credentials.Value{ProviderName: ProviderName}, awserr.New( - ErrCodeProcessProviderParse, - fmt.Sprintf("%s: %s", errMsgProcessProviderParse, string(out)), - err) - } - - if resp.Version != 1 { - return credentials.Value{ProviderName: ProviderName}, awserr.New( - ErrCodeProcessProviderVersion, - errMsgProcessProviderVersion, - nil) - } - - if len(resp.AccessKeyID) == 0 { - return credentials.Value{ProviderName: ProviderName}, awserr.New( - ErrCodeProcessProviderRequired, - errMsgProcessProviderMissKey, - nil) - } - - if len(resp.SecretAccessKey) == 0 { - return credentials.Value{ProviderName: ProviderName}, awserr.New( - ErrCodeProcessProviderRequired, - errMsgProcessProviderMissSecret, - nil) - } - - // Handle expiration - p.staticCreds = resp.Expiration == nil - if resp.Expiration != nil { - p.SetExpiration(*resp.Expiration, p.ExpiryWindow) - } - - return credentials.Value{ - ProviderName: ProviderName, - AccessKeyID: resp.AccessKeyID, - SecretAccessKey: resp.SecretAccessKey, - SessionToken: resp.SessionToken, - }, nil -} - -// IsExpired returns true if the credentials retrieved are expired, or not yet -// retrieved. -func (p *ProcessProvider) IsExpired() bool { - if p.staticCreds { - return false - } - return p.Expiry.IsExpired() -} - -// prepareCommand prepares the command to be executed. -func (p *ProcessProvider) prepareCommand() error { - - var cmdArgs []string - if runtime.GOOS == "windows" { - cmdArgs = []string{"cmd.exe", "/C"} - } else { - cmdArgs = []string{"sh", "-c"} - } - - if len(p.originalCommand) == 0 { - p.originalCommand = make([]string, len(p.command.Args)) - copy(p.originalCommand, p.command.Args) - - // check for empty command because it succeeds - if len(strings.TrimSpace(p.originalCommand[0])) < 1 { - return awserr.New( - ErrCodeProcessProviderExecution, - fmt.Sprintf( - "%s: %s", - errMsgProcessProviderPrepareCmd, - errMsgProcessProviderEmptyCmd), - nil) - } - } - - cmdArgs = append(cmdArgs, p.originalCommand...) - p.command = exec.Command(cmdArgs[0], cmdArgs[1:]...) - p.command.Env = os.Environ() - - return nil -} - -// executeCredentialProcess starts the credential process on the OS and -// returns the results or an error. -func (p *ProcessProvider) executeCredentialProcess() ([]byte, error) { - - if err := p.prepareCommand(); err != nil { - return nil, err - } - - // Setup the pipes - outReadPipe, outWritePipe, err := os.Pipe() - if err != nil { - return nil, awserr.New( - ErrCodeProcessProviderExecution, - errMsgProcessProviderPipe, - err) - } - - p.command.Stderr = os.Stderr // display stderr on console for MFA - p.command.Stdout = outWritePipe // get creds json on process's stdout - p.command.Stdin = os.Stdin // enable stdin for MFA - - output := bytes.NewBuffer(make([]byte, 0, p.MaxBufSize)) - - stdoutCh := make(chan error, 1) - go readInput( - io.LimitReader(outReadPipe, int64(p.MaxBufSize)), - output, - stdoutCh) - - execCh := make(chan error, 1) - go executeCommand(*p.command, execCh) - - finished := false - var errors []error - for !finished { - select { - case readError := <-stdoutCh: - errors = appendError(errors, readError) - finished = true - case execError := <-execCh: - err := outWritePipe.Close() - errors = appendError(errors, err) - errors = appendError(errors, execError) - if errors != nil { - return output.Bytes(), awserr.NewBatchError( - ErrCodeProcessProviderExecution, - errMsgProcessProviderProcess, - errors) - } - case <-time.After(p.Timeout): - finished = true - return output.Bytes(), awserr.NewBatchError( - ErrCodeProcessProviderExecution, - errMsgProcessProviderTimeout, - errors) // errors can be nil - } - } - - out := output.Bytes() - - if runtime.GOOS == "windows" { - // windows adds slashes to quotes - out = []byte(strings.Replace(string(out), `\"`, `"`, -1)) - } - - return out, nil -} - -// appendError conveniently checks for nil before appending slice -func appendError(errors []error, err error) []error { - if err != nil { - return append(errors, err) - } - return errors -} - -func executeCommand(cmd exec.Cmd, exec chan error) { - // Start the command - err := cmd.Start() - if err == nil { - err = cmd.Wait() - } - - exec <- err -} - -func readInput(r io.Reader, w io.Writer, read chan error) { - tee := io.TeeReader(r, w) - - _, err := ioutil.ReadAll(tee) - - if err == io.EOF { - err = nil - } - - read <- err // will only arrive here when write end of pipe is closed -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go deleted file mode 100644 index 22b5c5d9f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go +++ /dev/null @@ -1,151 +0,0 @@ -package credentials - -import ( - "fmt" - "os" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/internal/ini" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -// SharedCredsProviderName provides a name of SharedCreds provider -const SharedCredsProviderName = "SharedCredentialsProvider" - -var ( - // ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found. - ErrSharedCredentialsHomeNotFound = awserr.New("UserHomeNotFound", "user home directory not found.", nil) -) - -// A SharedCredentialsProvider retrieves access key pair (access key ID, -// secret access key, and session token if present) credentials from the current -// user's home directory, and keeps track if those credentials are expired. -// -// Profile ini file example: $HOME/.aws/credentials -type SharedCredentialsProvider struct { - // Path to the shared credentials file. - // - // If empty will look for "AWS_SHARED_CREDENTIALS_FILE" env variable. If the - // env value is empty will default to current user's home directory. - // Linux/OSX: "$HOME/.aws/credentials" - // Windows: "%USERPROFILE%\.aws\credentials" - Filename string - - // AWS Profile to extract credentials from the shared credentials file. If empty - // will default to environment variable "AWS_PROFILE" or "default" if - // environment variable is also not set. - Profile string - - // retrieved states if the credentials have been successfully retrieved. - retrieved bool -} - -// NewSharedCredentials returns a pointer to a new Credentials object -// wrapping the Profile file provider. -func NewSharedCredentials(filename, profile string) *Credentials { - return NewCredentials(&SharedCredentialsProvider{ - Filename: filename, - Profile: profile, - }) -} - -// Retrieve reads and extracts the shared credentials from the current -// users home directory. -func (p *SharedCredentialsProvider) Retrieve() (Value, error) { - p.retrieved = false - - filename, err := p.filename() - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, err - } - - creds, err := loadProfile(filename, p.profile()) - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, err - } - - p.retrieved = true - return creds, nil -} - -// IsExpired returns if the shared credentials have expired. -func (p *SharedCredentialsProvider) IsExpired() bool { - return !p.retrieved -} - -// loadProfiles loads from the file pointed to by shared credentials filename for profile. -// The credentials retrieved from the profile will be returned or error. Error will be -// returned if it fails to read from the file, or the data is invalid. -func loadProfile(filename, profile string) (Value, error) { - config, err := ini.OpenFile(filename) - if err != nil { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to load shared credentials file", err) - } - - iniProfile, ok := config.GetSection(profile) - if !ok { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to get profile", nil) - } - - id := iniProfile.String("aws_access_key_id") - if len(id) == 0 { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsAccessKey", - fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename), - nil) - } - - secret := iniProfile.String("aws_secret_access_key") - if len(secret) == 0 { - return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsSecret", - fmt.Sprintf("shared credentials %s in %s did not contain aws_secret_access_key", profile, filename), - nil) - } - - // Default to empty string if not found - token := iniProfile.String("aws_session_token") - - return Value{ - AccessKeyID: id, - SecretAccessKey: secret, - SessionToken: token, - ProviderName: SharedCredsProviderName, - }, nil -} - -// filename returns the filename to use to read AWS shared credentials. -// -// Will return an error if the user's home directory path cannot be found. -func (p *SharedCredentialsProvider) filename() (string, error) { - if len(p.Filename) != 0 { - return p.Filename, nil - } - - if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); len(p.Filename) != 0 { - return p.Filename, nil - } - - if home := shareddefaults.UserHomeDir(); len(home) == 0 { - // Backwards compatibility of home directly not found error being returned. - // This error is too verbose, failure when opening the file would of been - // a better error to return. - return "", ErrSharedCredentialsHomeNotFound - } - - p.Filename = shareddefaults.SharedCredentialsFilename() - - return p.Filename, nil -} - -// profile returns the AWS shared credentials profile. If empty will read -// environment variable "AWS_PROFILE". If that is not set profile will -// return "default". -func (p *SharedCredentialsProvider) profile() string { - if p.Profile == "" { - p.Profile = os.Getenv("AWS_PROFILE") - } - if p.Profile == "" { - p.Profile = "default" - } - - return p.Profile -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go deleted file mode 100644 index cbba1e3d5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go +++ /dev/null @@ -1,57 +0,0 @@ -package credentials - -import ( - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// StaticProviderName provides a name of Static provider -const StaticProviderName = "StaticProvider" - -var ( - // ErrStaticCredentialsEmpty is emitted when static credentials are empty. - ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) -) - -// A StaticProvider is a set of credentials which are set programmatically, -// and will never expire. -type StaticProvider struct { - Value -} - -// NewStaticCredentials returns a pointer to a new Credentials object -// wrapping a static credentials value provider. Token is only required -// for temporary security credentials retrieved via STS, otherwise an empty -// string can be passed for this parameter. -func NewStaticCredentials(id, secret, token string) *Credentials { - return NewCredentials(&StaticProvider{Value: Value{ - AccessKeyID: id, - SecretAccessKey: secret, - SessionToken: token, - }}) -} - -// NewStaticCredentialsFromCreds returns a pointer to a new Credentials object -// wrapping the static credentials value provide. Same as NewStaticCredentials -// but takes the creds Value instead of individual fields -func NewStaticCredentialsFromCreds(creds Value) *Credentials { - return NewCredentials(&StaticProvider{Value: creds}) -} - -// Retrieve returns the credentials or error if the credentials are invalid. -func (s *StaticProvider) Retrieve() (Value, error) { - if s.AccessKeyID == "" || s.SecretAccessKey == "" { - return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty - } - - if len(s.Value.ProviderName) == 0 { - s.Value.ProviderName = StaticProviderName - } - return s.Value, nil -} - -// IsExpired returns if the credentials are expired. -// -// For StaticProvider, the credentials never expired. -func (s *StaticProvider) IsExpired() bool { - return false -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go deleted file mode 100644 index 6846ef6f8..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ /dev/null @@ -1,363 +0,0 @@ -/* -Package stscreds are credential Providers to retrieve STS AWS credentials. - -STS provides multiple ways to retrieve credentials which can be used when making -future AWS service API operation calls. - -The SDK will ensure that per instance of credentials.Credentials all requests -to refresh the credentials will be synchronized. But, the SDK is unable to -ensure synchronous usage of the AssumeRoleProvider if the value is shared -between multiple Credentials, Sessions or service clients. - -Assume Role - -To assume an IAM role using STS with the SDK you can create a new Credentials -with the SDKs's stscreds package. - - // Initial credentials loaded from SDK's default credential chain. Such as - // the environment, shared credentials (~/.aws/credentials), or EC2 Instance - // Role. These credentials will be used to to make the STS Assume Role API. - sess := session.Must(session.NewSession()) - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN. - creds := stscreds.NewCredentials(sess, "myRoleArn") - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -Assume Role with static MFA Token - -To assume an IAM role with a MFA token you can either specify a MFA token code -directly or provide a function to prompt the user each time the credentials -need to refresh the role's credentials. Specifying the TokenCode should be used -for short lived operations that will not need to be refreshed, and when you do -not want to have direct control over the user provides their MFA token. - -With TokenCode the AssumeRoleProvider will be not be able to refresh the role's -credentials. - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN using the MFA token code provided. - creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { - p.SerialNumber = aws.String("myTokenSerialNumber") - p.TokenCode = aws.String("00000000") - }) - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -Assume Role with MFA Token Provider - -To assume an IAM role with MFA for longer running tasks where the credentials -may need to be refreshed setting the TokenProvider field of AssumeRoleProvider -will allow the credential provider to prompt for new MFA token code when the -role's credentials need to be refreshed. - -The StdinTokenProvider function is available to prompt on stdin to retrieve -the MFA token code from the user. You can also implement custom prompts by -satisfing the TokenProvider function signature. - -Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will -have undesirable results as the StdinTokenProvider will not be synchronized. A -single Credentials with an AssumeRoleProvider can be shared safely. - - // Create the credentials from AssumeRoleProvider to assume the role - // referenced by the "myRoleARN" ARN. Prompting for MFA token from stdin. - creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { - p.SerialNumber = aws.String("myTokenSerialNumber") - p.TokenProvider = stscreds.StdinTokenProvider - }) - - // Create service client value configured for credentials - // from assumed role. - svc := s3.New(sess, &aws.Config{Credentials: creds}) - -*/ -package stscreds - -import ( - "fmt" - "os" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/sdkrand" - "github.com/aws/aws-sdk-go/service/sts" -) - -// StdinTokenProvider will prompt on stderr and read from stdin for a string value. -// An error is returned if reading from stdin fails. -// -// Use this function go read MFA tokens from stdin. The function makes no attempt -// to make atomic prompts from stdin across multiple gorouties. -// -// Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will -// have undesirable results as the StdinTokenProvider will not be synchronized. A -// single Credentials with an AssumeRoleProvider can be shared safely -// -// Will wait forever until something is provided on the stdin. -func StdinTokenProvider() (string, error) { - var v string - fmt.Fprintf(os.Stderr, "Assume Role MFA token code: ") - _, err := fmt.Scanln(&v) - - return v, err -} - -// ProviderName provides a name of AssumeRole provider -const ProviderName = "AssumeRoleProvider" - -// AssumeRoler represents the minimal subset of the STS client API used by this provider. -type AssumeRoler interface { - AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) -} - -type assumeRolerWithContext interface { - AssumeRoleWithContext(aws.Context, *sts.AssumeRoleInput, ...request.Option) (*sts.AssumeRoleOutput, error) -} - -// DefaultDuration is the default amount of time in minutes that the credentials -// will be valid for. -var DefaultDuration = time.Duration(15) * time.Minute - -// AssumeRoleProvider retrieves temporary credentials from the STS service, and -// keeps track of their expiration time. -// -// This credential provider will be used by the SDKs default credential change -// when shared configuration is enabled, and the shared config or shared credentials -// file configure assume role. See Session docs for how to do this. -// -// AssumeRoleProvider does not provide any synchronization and it is not safe -// to share this value across multiple Credentials, Sessions, or service clients -// without also sharing the same Credentials instance. -type AssumeRoleProvider struct { - credentials.Expiry - - // STS client to make assume role request with. - Client AssumeRoler - - // Role to be assumed. - RoleARN string - - // Session name, if you wish to reuse the credentials elsewhere. - RoleSessionName string - - // Optional, you can pass tag key-value pairs to your session. These tags are called session tags. - Tags []*sts.Tag - - // A list of keys for session tags that you want to set as transitive. - // If you set a tag key as transitive, the corresponding key and value passes to subsequent sessions in a role chain. - TransitiveTagKeys []*string - - // Expiry duration of the STS credentials. Defaults to 15 minutes if not set. - Duration time.Duration - - // Optional ExternalID to pass along, defaults to nil if not set. - ExternalID *string - - // The policy plain text must be 2048 bytes or shorter. However, an internal - // conversion compresses it into a packed binary format with a separate limit. - // The PackedPolicySize response element indicates by percentage how close to - // the upper size limit the policy is, with 100% equaling the maximum allowed - // size. - Policy *string - - // The ARNs of IAM managed policies you want to use as managed session policies. - // The policies must exist in the same account as the role. - // - // This parameter is optional. You can provide up to 10 managed policy ARNs. - // However, the plain text that you use for both inline and managed session - // policies can't exceed 2,048 characters. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - // - // Passing policies to this operation returns new temporary credentials. The - // resulting session's permissions are the intersection of the role's identity-based - // policy and the session policies. You can use the role's temporary credentials - // in subsequent AWS API calls to access resources in the account that owns - // the role. You cannot use session policies to grant more permissions than - // those allowed by the identity-based policy of the role that is being assumed. - // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - PolicyArns []*sts.PolicyDescriptorType - - // The identification number of the MFA device that is associated with the user - // who is making the AssumeRole call. Specify this value if the trust policy - // of the role being assumed includes a condition that requires MFA authentication. - // The value is either the serial number for a hardware device (such as GAHT12345678) - // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). - SerialNumber *string - - // The value provided by the MFA device, if the trust policy of the role being - // assumed requires MFA (that is, if the policy includes a condition that tests - // for MFA). If the role being assumed requires MFA and if the TokenCode value - // is missing or expired, the AssumeRole call returns an "access denied" error. - // - // If SerialNumber is set and neither TokenCode nor TokenProvider are also - // set an error will be returned. - TokenCode *string - - // Async method of providing MFA token code for assuming an IAM role with MFA. - // The value returned by the function will be used as the TokenCode in the Retrieve - // call. See StdinTokenProvider for a provider that prompts and reads from stdin. - // - // This token provider will be called when ever the assumed role's - // credentials need to be refreshed when SerialNumber is also set and - // TokenCode is not set. - // - // If both TokenCode and TokenProvider is set, TokenProvider will be used and - // TokenCode is ignored. - TokenProvider func() (string, error) - - // ExpiryWindow will allow the credentials to trigger refreshing prior to - // the credentials actually expiring. This is beneficial so race conditions - // with expiring credentials do not cause request to fail unexpectedly - // due to ExpiredTokenException exceptions. - // - // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true - // 10 seconds before the credentials are actually expired. - // - // If ExpiryWindow is 0 or less it will be ignored. - ExpiryWindow time.Duration - - // MaxJitterFrac reduces the effective Duration of each credential requested - // by a random percentage between 0 and MaxJitterFraction. MaxJitterFrac must - // have a value between 0 and 1. Any other value may lead to expected behavior. - // With a MaxJitterFrac value of 0, default) will no jitter will be used. - // - // For example, with a Duration of 30m and a MaxJitterFrac of 0.1, the - // AssumeRole call will be made with an arbitrary Duration between 27m and - // 30m. - // - // MaxJitterFrac should not be negative. - MaxJitterFrac float64 -} - -// NewCredentials returns a pointer to a new Credentials object wrapping the -// AssumeRoleProvider. The credentials will expire every 15 minutes and the -// role will be named after a nanosecond timestamp of this operation. -// -// Takes a Config provider to create the STS client. The ConfigProvider is -// satisfied by the session.Session type. -// -// It is safe to share the returned Credentials with multiple Sessions and -// service clients. All access to the credentials and refreshing them -// will be synchronized. -func NewCredentials(c client.ConfigProvider, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { - p := &AssumeRoleProvider{ - Client: sts.New(c), - RoleARN: roleARN, - Duration: DefaultDuration, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// NewCredentialsWithClient returns a pointer to a new Credentials object wrapping the -// AssumeRoleProvider. The credentials will expire every 15 minutes and the -// role will be named after a nanosecond timestamp of this operation. -// -// Takes an AssumeRoler which can be satisfied by the STS client. -// -// It is safe to share the returned Credentials with multiple Sessions and -// service clients. All access to the credentials and refreshing them -// will be synchronized. -func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(*AssumeRoleProvider)) *credentials.Credentials { - p := &AssumeRoleProvider{ - Client: svc, - RoleARN: roleARN, - Duration: DefaultDuration, - } - - for _, option := range options { - option(p) - } - - return credentials.NewCredentials(p) -} - -// Retrieve generates a new set of temporary credentials using STS. -func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { - return p.RetrieveWithContext(aws.BackgroundContext()) -} - -// RetrieveWithContext generates a new set of temporary credentials using STS. -func (p *AssumeRoleProvider) RetrieveWithContext(ctx credentials.Context) (credentials.Value, error) { - // Apply defaults where parameters are not set. - if p.RoleSessionName == "" { - // Try to work out a role name that will hopefully end up unique. - p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) - } - if p.Duration == 0 { - // Expire as often as AWS permits. - p.Duration = DefaultDuration - } - jitter := time.Duration(sdkrand.SeededRand.Float64() * p.MaxJitterFrac * float64(p.Duration)) - input := &sts.AssumeRoleInput{ - DurationSeconds: aws.Int64(int64((p.Duration - jitter) / time.Second)), - RoleArn: aws.String(p.RoleARN), - RoleSessionName: aws.String(p.RoleSessionName), - ExternalId: p.ExternalID, - Tags: p.Tags, - PolicyArns: p.PolicyArns, - TransitiveTagKeys: p.TransitiveTagKeys, - } - if p.Policy != nil { - input.Policy = p.Policy - } - if p.SerialNumber != nil { - if p.TokenCode != nil { - input.SerialNumber = p.SerialNumber - input.TokenCode = p.TokenCode - } else if p.TokenProvider != nil { - input.SerialNumber = p.SerialNumber - code, err := p.TokenProvider() - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - input.TokenCode = aws.String(code) - } else { - return credentials.Value{ProviderName: ProviderName}, - awserr.New("AssumeRoleTokenNotAvailable", - "assume role with MFA enabled, but neither TokenCode nor TokenProvider are set", nil) - } - } - - var roleOutput *sts.AssumeRoleOutput - var err error - - if c, ok := p.Client.(assumeRolerWithContext); ok { - roleOutput, err = c.AssumeRoleWithContext(ctx, input) - } else { - roleOutput, err = p.Client.AssumeRole(input) - } - - if err != nil { - return credentials.Value{ProviderName: ProviderName}, err - } - - // We will proactively generate new credentials before they expire. - p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow) - - return credentials.Value{ - AccessKeyID: *roleOutput.Credentials.AccessKeyId, - SecretAccessKey: *roleOutput.Credentials.SecretAccessKey, - SessionToken: *roleOutput.Credentials.SessionToken, - ProviderName: ProviderName, - }, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go deleted file mode 100644 index 6feb262b2..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go +++ /dev/null @@ -1,135 +0,0 @@ -package stscreds - -import ( - "fmt" - "io/ioutil" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/aws/aws-sdk-go/service/sts/stsiface" -) - -const ( - // ErrCodeWebIdentity will be used as an error code when constructing - // a new error to be returned during session creation or retrieval. - ErrCodeWebIdentity = "WebIdentityErr" - - // WebIdentityProviderName is the web identity provider name - WebIdentityProviderName = "WebIdentityCredentials" -) - -// now is used to return a time.Time object representing -// the current time. This can be used to easily test and -// compare test values. -var now = time.Now - -// TokenFetcher shuold return WebIdentity token bytes or an error -type TokenFetcher interface { - FetchToken(credentials.Context) ([]byte, error) -} - -// FetchTokenPath is a path to a WebIdentity token file -type FetchTokenPath string - -// FetchToken returns a token by reading from the filesystem -func (f FetchTokenPath) FetchToken(ctx credentials.Context) ([]byte, error) { - data, err := ioutil.ReadFile(string(f)) - if err != nil { - errMsg := fmt.Sprintf("unable to read file at %s", f) - return nil, awserr.New(ErrCodeWebIdentity, errMsg, err) - } - return data, nil -} - -// WebIdentityRoleProvider is used to retrieve credentials using -// an OIDC token. -type WebIdentityRoleProvider struct { - credentials.Expiry - PolicyArns []*sts.PolicyDescriptorType - - client stsiface.STSAPI - ExpiryWindow time.Duration - - tokenFetcher TokenFetcher - roleARN string - roleSessionName string -} - -// NewWebIdentityCredentials will return a new set of credentials with a given -// configuration, role arn, and token file path. -func NewWebIdentityCredentials(c client.ConfigProvider, roleARN, roleSessionName, path string) *credentials.Credentials { - svc := sts.New(c) - p := NewWebIdentityRoleProvider(svc, roleARN, roleSessionName, path) - return credentials.NewCredentials(p) -} - -// NewWebIdentityRoleProvider will return a new WebIdentityRoleProvider with the -// provided stsiface.STSAPI -func NewWebIdentityRoleProvider(svc stsiface.STSAPI, roleARN, roleSessionName, path string) *WebIdentityRoleProvider { - return NewWebIdentityRoleProviderWithToken(svc, roleARN, roleSessionName, FetchTokenPath(path)) -} - -// NewWebIdentityRoleProviderWithToken will return a new WebIdentityRoleProvider with the -// provided stsiface.STSAPI and a TokenFetcher -func NewWebIdentityRoleProviderWithToken(svc stsiface.STSAPI, roleARN, roleSessionName string, tokenFetcher TokenFetcher) *WebIdentityRoleProvider { - return &WebIdentityRoleProvider{ - client: svc, - tokenFetcher: tokenFetcher, - roleARN: roleARN, - roleSessionName: roleSessionName, - } -} - -// Retrieve will attempt to assume a role from a token which is located at -// 'WebIdentityTokenFilePath' specified destination and if that is empty an -// error will be returned. -func (p *WebIdentityRoleProvider) Retrieve() (credentials.Value, error) { - return p.RetrieveWithContext(aws.BackgroundContext()) -} - -// RetrieveWithContext will attempt to assume a role from a token which is located at -// 'WebIdentityTokenFilePath' specified destination and if that is empty an -// error will be returned. -func (p *WebIdentityRoleProvider) RetrieveWithContext(ctx credentials.Context) (credentials.Value, error) { - b, err := p.tokenFetcher.FetchToken(ctx) - if err != nil { - return credentials.Value{}, awserr.New(ErrCodeWebIdentity, "failed fetching WebIdentity token: ", err) - } - - sessionName := p.roleSessionName - if len(sessionName) == 0 { - // session name is used to uniquely identify a session. This simply - // uses unix time in nanoseconds to uniquely identify sessions. - sessionName = strconv.FormatInt(now().UnixNano(), 10) - } - req, resp := p.client.AssumeRoleWithWebIdentityRequest(&sts.AssumeRoleWithWebIdentityInput{ - PolicyArns: p.PolicyArns, - RoleArn: &p.roleARN, - RoleSessionName: &sessionName, - WebIdentityToken: aws.String(string(b)), - }) - - req.SetContext(ctx) - - // InvalidIdentityToken error is a temporary error that can occur - // when assuming an Role with a JWT web identity token. - req.RetryErrorCodes = append(req.RetryErrorCodes, sts.ErrCodeInvalidIdentityTokenException) - if err := req.Send(); err != nil { - return credentials.Value{}, awserr.New(ErrCodeWebIdentity, "failed to retrieve credentials", err) - } - - p.SetExpiration(aws.TimeValue(resp.Credentials.Expiration), p.ExpiryWindow) - - value := credentials.Value{ - AccessKeyID: aws.StringValue(resp.Credentials.AccessKeyId), - SecretAccessKey: aws.StringValue(resp.Credentials.SecretAccessKey), - SessionToken: aws.StringValue(resp.Credentials.SessionToken), - ProviderName: WebIdentityProviderName, - } - return value, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go deleted file mode 100644 index 25a66d1dd..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go +++ /dev/null @@ -1,69 +0,0 @@ -// Package csm provides the Client Side Monitoring (CSM) client which enables -// sending metrics via UDP connection to the CSM agent. This package provides -// control options, and configuration for the CSM client. The client can be -// controlled manually, or automatically via the SDK's Session configuration. -// -// Enabling CSM client via SDK's Session configuration -// -// The CSM client can be enabled automatically via SDK's Session configuration. -// The SDK's session configuration enables the CSM client if the AWS_CSM_PORT -// environment variable is set to a non-empty value. -// -// The configuration options for the CSM client via the SDK's session -// configuration are: -// -// * AWS_CSM_PORT= -// The port number the CSM agent will receive metrics on. -// -// * AWS_CSM_HOST= -// The hostname, or IP address the CSM agent will receive metrics on. -// Without port number. -// -// Manually enabling the CSM client -// -// The CSM client can be started, paused, and resumed manually. The Start -// function will enable the CSM client to publish metrics to the CSM agent. It -// is safe to call Start concurrently, but if Start is called additional times -// with different ClientID or address it will panic. -// -// r, err := csm.Start("clientID", ":31000") -// if err != nil { -// panic(fmt.Errorf("failed starting CSM: %v", err)) -// } -// -// When controlling the CSM client manually, you must also inject its request -// handlers into the SDK's Session configuration for the SDK's API clients to -// publish metrics. -// -// sess, err := session.NewSession(&aws.Config{}) -// if err != nil { -// panic(fmt.Errorf("failed loading session: %v", err)) -// } -// -// // Add CSM client's metric publishing request handlers to the SDK's -// // Session Configuration. -// r.InjectHandlers(&sess.Handlers) -// -// Controlling CSM client -// -// Once the CSM client has been enabled the Get function will return a Reporter -// value that you can use to pause and resume the metrics published to the CSM -// agent. If Get function is called before the reporter is enabled with the -// Start function or via SDK's Session configuration nil will be returned. -// -// The Pause method can be called to stop the CSM client publishing metrics to -// the CSM agent. The Continue method will resume metric publishing. -// -// // Get the CSM client Reporter. -// r := csm.Get() -// -// // Will pause monitoring -// r.Pause() -// resp, err = client.GetObject(&s3.GetObjectInput{ -// Bucket: aws.String("bucket"), -// Key: aws.String("key"), -// }) -// -// // Resume monitoring -// r.Continue() -package csm diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go deleted file mode 100644 index 4b19e2800..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go +++ /dev/null @@ -1,89 +0,0 @@ -package csm - -import ( - "fmt" - "strings" - "sync" -) - -var ( - lock sync.Mutex -) - -const ( - // DefaultPort is used when no port is specified. - DefaultPort = "31000" - - // DefaultHost is the host that will be used when none is specified. - DefaultHost = "127.0.0.1" -) - -// AddressWithDefaults returns a CSM address built from the host and port -// values. If the host or port is not set, default values will be used -// instead. If host is "localhost" it will be replaced with "127.0.0.1". -func AddressWithDefaults(host, port string) string { - if len(host) == 0 || strings.EqualFold(host, "localhost") { - host = DefaultHost - } - - if len(port) == 0 { - port = DefaultPort - } - - // Only IP6 host can contain a colon - if strings.Contains(host, ":") { - return "[" + host + "]:" + port - } - - return host + ":" + port -} - -// Start will start a long running go routine to capture -// client side metrics. Calling start multiple time will only -// start the metric listener once and will panic if a different -// client ID or port is passed in. -// -// r, err := csm.Start("clientID", "127.0.0.1:31000") -// if err != nil { -// panic(fmt.Errorf("expected no error, but received %v", err)) -// } -// sess := session.NewSession() -// r.InjectHandlers(sess.Handlers) -// -// svc := s3.New(sess) -// out, err := svc.GetObject(&s3.GetObjectInput{ -// Bucket: aws.String("bucket"), -// Key: aws.String("key"), -// }) -func Start(clientID string, url string) (*Reporter, error) { - lock.Lock() - defer lock.Unlock() - - if sender == nil { - sender = newReporter(clientID, url) - } else { - if sender.clientID != clientID { - panic(fmt.Errorf("inconsistent client IDs. %q was expected, but received %q", sender.clientID, clientID)) - } - - if sender.url != url { - panic(fmt.Errorf("inconsistent URLs. %q was expected, but received %q", sender.url, url)) - } - } - - if err := connect(url); err != nil { - sender = nil - return nil, err - } - - return sender, nil -} - -// Get will return a reporter if one exists, if one does not exist, nil will -// be returned. -func Get() *Reporter { - lock.Lock() - defer lock.Unlock() - - return sender -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go deleted file mode 100644 index 5bacc791a..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go +++ /dev/null @@ -1,109 +0,0 @@ -package csm - -import ( - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws" -) - -type metricTime time.Time - -func (t metricTime) MarshalJSON() ([]byte, error) { - ns := time.Duration(time.Time(t).UnixNano()) - return []byte(strconv.FormatInt(int64(ns/time.Millisecond), 10)), nil -} - -type metric struct { - ClientID *string `json:"ClientId,omitempty"` - API *string `json:"Api,omitempty"` - Service *string `json:"Service,omitempty"` - Timestamp *metricTime `json:"Timestamp,omitempty"` - Type *string `json:"Type,omitempty"` - Version *int `json:"Version,omitempty"` - - AttemptCount *int `json:"AttemptCount,omitempty"` - Latency *int `json:"Latency,omitempty"` - - Fqdn *string `json:"Fqdn,omitempty"` - UserAgent *string `json:"UserAgent,omitempty"` - AttemptLatency *int `json:"AttemptLatency,omitempty"` - - SessionToken *string `json:"SessionToken,omitempty"` - Region *string `json:"Region,omitempty"` - AccessKey *string `json:"AccessKey,omitempty"` - HTTPStatusCode *int `json:"HttpStatusCode,omitempty"` - XAmzID2 *string `json:"XAmzId2,omitempty"` - XAmzRequestID *string `json:"XAmznRequestId,omitempty"` - - AWSException *string `json:"AwsException,omitempty"` - AWSExceptionMessage *string `json:"AwsExceptionMessage,omitempty"` - SDKException *string `json:"SdkException,omitempty"` - SDKExceptionMessage *string `json:"SdkExceptionMessage,omitempty"` - - FinalHTTPStatusCode *int `json:"FinalHttpStatusCode,omitempty"` - FinalAWSException *string `json:"FinalAwsException,omitempty"` - FinalAWSExceptionMessage *string `json:"FinalAwsExceptionMessage,omitempty"` - FinalSDKException *string `json:"FinalSdkException,omitempty"` - FinalSDKExceptionMessage *string `json:"FinalSdkExceptionMessage,omitempty"` - - DestinationIP *string `json:"DestinationIp,omitempty"` - ConnectionReused *int `json:"ConnectionReused,omitempty"` - - AcquireConnectionLatency *int `json:"AcquireConnectionLatency,omitempty"` - ConnectLatency *int `json:"ConnectLatency,omitempty"` - RequestLatency *int `json:"RequestLatency,omitempty"` - DNSLatency *int `json:"DnsLatency,omitempty"` - TCPLatency *int `json:"TcpLatency,omitempty"` - SSLLatency *int `json:"SslLatency,omitempty"` - - MaxRetriesExceeded *int `json:"MaxRetriesExceeded,omitempty"` -} - -func (m *metric) TruncateFields() { - m.ClientID = truncateString(m.ClientID, 255) - m.UserAgent = truncateString(m.UserAgent, 256) - - m.AWSException = truncateString(m.AWSException, 128) - m.AWSExceptionMessage = truncateString(m.AWSExceptionMessage, 512) - - m.SDKException = truncateString(m.SDKException, 128) - m.SDKExceptionMessage = truncateString(m.SDKExceptionMessage, 512) - - m.FinalAWSException = truncateString(m.FinalAWSException, 128) - m.FinalAWSExceptionMessage = truncateString(m.FinalAWSExceptionMessage, 512) - - m.FinalSDKException = truncateString(m.FinalSDKException, 128) - m.FinalSDKExceptionMessage = truncateString(m.FinalSDKExceptionMessage, 512) -} - -func truncateString(v *string, l int) *string { - if v != nil && len(*v) > l { - nv := (*v)[:l] - return &nv - } - - return v -} - -func (m *metric) SetException(e metricException) { - switch te := e.(type) { - case awsException: - m.AWSException = aws.String(te.exception) - m.AWSExceptionMessage = aws.String(te.message) - case sdkException: - m.SDKException = aws.String(te.exception) - m.SDKExceptionMessage = aws.String(te.message) - } -} - -func (m *metric) SetFinalException(e metricException) { - switch te := e.(type) { - case awsException: - m.FinalAWSException = aws.String(te.exception) - m.FinalAWSExceptionMessage = aws.String(te.message) - case sdkException: - m.FinalSDKException = aws.String(te.exception) - m.FinalSDKExceptionMessage = aws.String(te.message) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go deleted file mode 100644 index 82a3e345e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go +++ /dev/null @@ -1,55 +0,0 @@ -package csm - -import ( - "sync/atomic" -) - -const ( - runningEnum = iota - pausedEnum -) - -var ( - // MetricsChannelSize of metrics to hold in the channel - MetricsChannelSize = 100 -) - -type metricChan struct { - ch chan metric - paused *int64 -} - -func newMetricChan(size int) metricChan { - return metricChan{ - ch: make(chan metric, size), - paused: new(int64), - } -} - -func (ch *metricChan) Pause() { - atomic.StoreInt64(ch.paused, pausedEnum) -} - -func (ch *metricChan) Continue() { - atomic.StoreInt64(ch.paused, runningEnum) -} - -func (ch *metricChan) IsPaused() bool { - v := atomic.LoadInt64(ch.paused) - return v == pausedEnum -} - -// Push will push metrics to the metric channel if the channel -// is not paused -func (ch *metricChan) Push(m metric) bool { - if ch.IsPaused() { - return false - } - - select { - case ch.ch <- m: - return true - default: - return false - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go deleted file mode 100644 index 54a99280c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go +++ /dev/null @@ -1,26 +0,0 @@ -package csm - -type metricException interface { - Exception() string - Message() string -} - -type requestException struct { - exception string - message string -} - -func (e requestException) Exception() string { - return e.exception -} -func (e requestException) Message() string { - return e.message -} - -type awsException struct { - requestException -} - -type sdkException struct { - requestException -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go deleted file mode 100644 index 835bcd49c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go +++ /dev/null @@ -1,264 +0,0 @@ -package csm - -import ( - "encoding/json" - "net" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// Reporter will gather metrics of API requests made and -// send those metrics to the CSM endpoint. -type Reporter struct { - clientID string - url string - conn net.Conn - metricsCh metricChan - done chan struct{} -} - -var ( - sender *Reporter -) - -func connect(url string) error { - const network = "udp" - if err := sender.connect(network, url); err != nil { - return err - } - - if sender.done == nil { - sender.done = make(chan struct{}) - go sender.start() - } - - return nil -} - -func newReporter(clientID, url string) *Reporter { - return &Reporter{ - clientID: clientID, - url: url, - metricsCh: newMetricChan(MetricsChannelSize), - } -} - -func (rep *Reporter) sendAPICallAttemptMetric(r *request.Request) { - if rep == nil { - return - } - - now := time.Now() - creds, _ := r.Config.Credentials.Get() - - m := metric{ - ClientID: aws.String(rep.clientID), - API: aws.String(r.Operation.Name), - Service: aws.String(r.ClientInfo.ServiceID), - Timestamp: (*metricTime)(&now), - UserAgent: aws.String(r.HTTPRequest.Header.Get("User-Agent")), - Region: r.Config.Region, - Type: aws.String("ApiCallAttempt"), - Version: aws.Int(1), - - XAmzRequestID: aws.String(r.RequestID), - - AttemptLatency: aws.Int(int(now.Sub(r.AttemptTime).Nanoseconds() / int64(time.Millisecond))), - AccessKey: aws.String(creds.AccessKeyID), - } - - if r.HTTPResponse != nil { - m.HTTPStatusCode = aws.Int(r.HTTPResponse.StatusCode) - } - - if r.Error != nil { - if awserr, ok := r.Error.(awserr.Error); ok { - m.SetException(getMetricException(awserr)) - } - } - - m.TruncateFields() - rep.metricsCh.Push(m) -} - -func getMetricException(err awserr.Error) metricException { - msg := err.Error() - code := err.Code() - - switch code { - case request.ErrCodeRequestError, - request.ErrCodeSerialization, - request.CanceledErrorCode: - return sdkException{ - requestException{exception: code, message: msg}, - } - default: - return awsException{ - requestException{exception: code, message: msg}, - } - } -} - -func (rep *Reporter) sendAPICallMetric(r *request.Request) { - if rep == nil { - return - } - - now := time.Now() - m := metric{ - ClientID: aws.String(rep.clientID), - API: aws.String(r.Operation.Name), - Service: aws.String(r.ClientInfo.ServiceID), - Timestamp: (*metricTime)(&now), - UserAgent: aws.String(r.HTTPRequest.Header.Get("User-Agent")), - Type: aws.String("ApiCall"), - AttemptCount: aws.Int(r.RetryCount + 1), - Region: r.Config.Region, - Latency: aws.Int(int(time.Since(r.Time) / time.Millisecond)), - XAmzRequestID: aws.String(r.RequestID), - MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())), - } - - if r.HTTPResponse != nil { - m.FinalHTTPStatusCode = aws.Int(r.HTTPResponse.StatusCode) - } - - if r.Error != nil { - if awserr, ok := r.Error.(awserr.Error); ok { - m.SetFinalException(getMetricException(awserr)) - } - } - - m.TruncateFields() - - // TODO: Probably want to figure something out for logging dropped - // metrics - rep.metricsCh.Push(m) -} - -func (rep *Reporter) connect(network, url string) error { - if rep.conn != nil { - rep.conn.Close() - } - - conn, err := net.Dial(network, url) - if err != nil { - return awserr.New("UDPError", "Could not connect", err) - } - - rep.conn = conn - - return nil -} - -func (rep *Reporter) close() { - if rep.done != nil { - close(rep.done) - } - - rep.metricsCh.Pause() -} - -func (rep *Reporter) start() { - defer func() { - rep.metricsCh.Pause() - }() - - for { - select { - case <-rep.done: - rep.done = nil - return - case m := <-rep.metricsCh.ch: - // TODO: What to do with this error? Probably should just log - b, err := json.Marshal(m) - if err != nil { - continue - } - - rep.conn.Write(b) - } - } -} - -// Pause will pause the metric channel preventing any new metrics from being -// added. It is safe to call concurrently with other calls to Pause, but if -// called concurently with Continue can lead to unexpected state. -func (rep *Reporter) Pause() { - lock.Lock() - defer lock.Unlock() - - if rep == nil { - return - } - - rep.close() -} - -// Continue will reopen the metric channel and allow for monitoring to be -// resumed. It is safe to call concurrently with other calls to Continue, but -// if called concurently with Pause can lead to unexpected state. -func (rep *Reporter) Continue() { - lock.Lock() - defer lock.Unlock() - if rep == nil { - return - } - - if !rep.metricsCh.IsPaused() { - return - } - - rep.metricsCh.Continue() -} - -// Client side metric handler names -const ( - APICallMetricHandlerName = "awscsm.SendAPICallMetric" - APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" -) - -// InjectHandlers will will enable client side metrics and inject the proper -// handlers to handle how metrics are sent. -// -// InjectHandlers is NOT safe to call concurrently. Calling InjectHandlers -// multiple times may lead to unexpected behavior, (e.g. duplicate metrics). -// -// // Start must be called in order to inject the correct handlers -// r, err := csm.Start("clientID", "127.0.0.1:8094") -// if err != nil { -// panic(fmt.Errorf("expected no error, but received %v", err)) -// } -// -// sess := session.NewSession() -// r.InjectHandlers(&sess.Handlers) -// -// // create a new service client with our client side metric session -// svc := s3.New(sess) -func (rep *Reporter) InjectHandlers(handlers *request.Handlers) { - if rep == nil { - return - } - - handlers.Complete.PushFrontNamed(request.NamedHandler{ - Name: APICallMetricHandlerName, - Fn: rep.sendAPICallMetric, - }) - - handlers.CompleteAttempt.PushFrontNamed(request.NamedHandler{ - Name: APICallAttemptMetricHandlerName, - Fn: rep.sendAPICallAttemptMetric, - }) -} - -// boolIntValue return 1 for true and 0 for false. -func boolIntValue(b bool) int { - if b { - return 1 - } - - return 0 -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go deleted file mode 100644 index 23bb639e0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ /dev/null @@ -1,207 +0,0 @@ -// Package defaults is a collection of helpers to retrieve the SDK's default -// configuration and handlers. -// -// Generally this package shouldn't be used directly, but session.Session -// instead. This package is useful when you need to reset the defaults -// of a session or service client to the SDK defaults before setting -// additional parameters. -package defaults - -import ( - "fmt" - "net" - "net/http" - "net/url" - "os" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -// A Defaults provides a collection of default values for SDK clients. -type Defaults struct { - Config *aws.Config - Handlers request.Handlers -} - -// Get returns the SDK's default values with Config and handlers pre-configured. -func Get() Defaults { - cfg := Config() - handlers := Handlers() - cfg.Credentials = CredChain(cfg, handlers) - - return Defaults{ - Config: cfg, - Handlers: handlers, - } -} - -// Config returns the default configuration without credentials. -// To retrieve a config with credentials also included use -// `defaults.Get().Config` instead. -// -// Generally you shouldn't need to use this method directly, but -// is available if you need to reset the configuration of an -// existing service client or session. -func Config() *aws.Config { - return aws.NewConfig(). - WithCredentials(credentials.AnonymousCredentials). - WithRegion(os.Getenv("AWS_REGION")). - WithHTTPClient(http.DefaultClient). - WithMaxRetries(aws.UseServiceDefaultRetries). - WithLogger(aws.NewDefaultLogger()). - WithLogLevel(aws.LogOff). - WithEndpointResolver(endpoints.DefaultResolver()) -} - -// Handlers returns the default request handlers. -// -// Generally you shouldn't need to use this method directly, but -// is available if you need to reset the request handlers of an -// existing service client or session. -func Handlers() request.Handlers { - var handlers request.Handlers - - handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) - handlers.Validate.AfterEachFn = request.HandlerListStopOnError - handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) - handlers.Build.PushBackNamed(corehandlers.AddHostExecEnvUserAgentHander) - handlers.Build.AfterEachFn = request.HandlerListStopOnError - handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) - handlers.Send.PushBackNamed(corehandlers.ValidateReqSigHandler) - handlers.Send.PushBackNamed(corehandlers.SendHandler) - handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) - handlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler) - - return handlers -} - -// CredChain returns the default credential chain. -// -// Generally you shouldn't need to use this method directly, but -// is available if you need to reset the credentials of an -// existing service client or session's Config. -func CredChain(cfg *aws.Config, handlers request.Handlers) *credentials.Credentials { - return credentials.NewCredentials(&credentials.ChainProvider{ - VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), - Providers: CredProviders(cfg, handlers), - }) -} - -// CredProviders returns the slice of providers used in -// the default credential chain. -// -// For applications that need to use some other provider (for example use -// different environment variables for legacy reasons) but still fall back -// on the default chain of providers. This allows that default chaint to be -// automatically updated -func CredProviders(cfg *aws.Config, handlers request.Handlers) []credentials.Provider { - return []credentials.Provider{ - &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - RemoteCredProvider(*cfg, handlers), - } -} - -const ( - httpProviderAuthorizationEnvVar = "AWS_CONTAINER_AUTHORIZATION_TOKEN" - httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" -) - -// RemoteCredProvider returns a credentials provider for the default remote -// endpoints such as EC2 or ECS Roles. -func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - if u := os.Getenv(httpProviderEnvVar); len(u) > 0 { - return localHTTPCredProvider(cfg, handlers, u) - } - - if uri := os.Getenv(shareddefaults.ECSCredsProviderEnvVar); len(uri) > 0 { - u := fmt.Sprintf("%s%s", shareddefaults.ECSContainerCredentialsURI, uri) - return httpCredProvider(cfg, handlers, u) - } - - return ec2RoleProvider(cfg, handlers) -} - -var lookupHostFn = net.LookupHost - -func isLoopbackHost(host string) (bool, error) { - ip := net.ParseIP(host) - if ip != nil { - return ip.IsLoopback(), nil - } - - // Host is not an ip, perform lookup - addrs, err := lookupHostFn(host) - if err != nil { - return false, err - } - for _, addr := range addrs { - if !net.ParseIP(addr).IsLoopback() { - return false, nil - } - } - - return true, nil -} - -func localHTTPCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { - var errMsg string - - parsed, err := url.Parse(u) - if err != nil { - errMsg = fmt.Sprintf("invalid URL, %v", err) - } else { - host := aws.URLHostname(parsed) - if len(host) == 0 { - errMsg = "unable to parse host from local HTTP cred provider URL" - } else if isLoopback, loopbackErr := isLoopbackHost(host); loopbackErr != nil { - errMsg = fmt.Sprintf("failed to resolve host %q, %v", host, loopbackErr) - } else if !isLoopback { - errMsg = fmt.Sprintf("invalid endpoint host, %q, only loopback hosts are allowed.", host) - } - } - - if len(errMsg) > 0 { - if cfg.Logger != nil { - cfg.Logger.Log("Ignoring, HTTP credential provider", errMsg, err) - } - return credentials.ErrorProvider{ - Err: awserr.New("CredentialsEndpointError", errMsg, err), - ProviderName: endpointcreds.ProviderName, - } - } - - return httpCredProvider(cfg, handlers, u) -} - -func httpCredProvider(cfg aws.Config, handlers request.Handlers, u string) credentials.Provider { - return endpointcreds.NewProviderClient(cfg, handlers, u, - func(p *endpointcreds.Provider) { - p.ExpiryWindow = 5 * time.Minute - p.AuthorizationToken = os.Getenv(httpProviderAuthorizationEnvVar) - }, - ) -} - -func ec2RoleProvider(cfg aws.Config, handlers request.Handlers) credentials.Provider { - resolver := cfg.EndpointResolver - if resolver == nil { - resolver = endpoints.DefaultResolver() - } - - e, _ := resolver.EndpointFor(endpoints.Ec2metadataServiceID, "") - return &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.NewClient(cfg, handlers, e.URL, e.SigningRegion), - ExpiryWindow: 5 * time.Minute, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go deleted file mode 100644 index ca0ee1dcc..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go +++ /dev/null @@ -1,27 +0,0 @@ -package defaults - -import ( - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -// SharedCredentialsFilename returns the SDK's default file path -// for the shared credentials file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/credentials -// - Windows: %USERPROFILE%\.aws\credentials -func SharedCredentialsFilename() string { - return shareddefaults.SharedCredentialsFilename() -} - -// SharedConfigFilename returns the SDK's default file path for -// the shared config file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/config -// - Windows: %USERPROFILE%\.aws\config -func SharedConfigFilename() string { - return shareddefaults.SharedConfigFilename() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/doc.go deleted file mode 100644 index 4fcb61618..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/doc.go +++ /dev/null @@ -1,56 +0,0 @@ -// Package aws provides the core SDK's utilities and shared types. Use this package's -// utilities to simplify setting and reading API operations parameters. -// -// Value and Pointer Conversion Utilities -// -// This package includes a helper conversion utility for each scalar type the SDK's -// API use. These utilities make getting a pointer of the scalar, and dereferencing -// a pointer easier. -// -// Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. -// The Pointer to value will safely dereference the pointer and return its value. -// If the pointer was nil, the scalar's zero value will be returned. -// -// The value to pointer functions will be named after the scalar type. So get a -// *string from a string value use the "String" function. This makes it easy to -// to get pointer of a literal string value, because getting the address of a -// literal requires assigning the value to a variable first. -// -// var strPtr *string -// -// // Without the SDK's conversion functions -// str := "my string" -// strPtr = &str -// -// // With the SDK's conversion functions -// strPtr = aws.String("my string") -// -// // Convert *string to string value -// str = aws.StringValue(strPtr) -// -// In addition to scalars the aws package also includes conversion utilities for -// map and slice for commonly types used in API parameters. The map and slice -// conversion functions use similar naming pattern as the scalar conversion -// functions. -// -// var strPtrs []*string -// var strs []string = []string{"Go", "Gophers", "Go"} -// -// // Convert []string to []*string -// strPtrs = aws.StringSlice(strs) -// -// // Convert []*string to []string -// strs = aws.StringValueSlice(strPtrs) -// -// SDK Default HTTP Client -// -// The SDK will use the http.DefaultClient if a HTTP client is not provided to -// the SDK's Session, or service client constructor. This means that if the -// http.DefaultClient is modified by other components of your application the -// modifications will be picked up by the SDK as well. -// -// In some cases this might be intended, but it is a better practice to create -// a custom HTTP Client to share explicitly through your application. You can -// configure the SDK to use the custom HTTP Client by setting the HTTPClient -// value of the SDK's Config type when creating a Session or service client. -package aws diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go deleted file mode 100644 index a716c021c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ /dev/null @@ -1,250 +0,0 @@ -package ec2metadata - -import ( - "encoding/json" - "fmt" - "net/http" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/sdkuri" -) - -// getToken uses the duration to return a token for EC2 metadata service, -// or an error if the request failed. -func (c *EC2Metadata) getToken(ctx aws.Context, duration time.Duration) (tokenOutput, error) { - op := &request.Operation{ - Name: "GetToken", - HTTPMethod: "PUT", - HTTPPath: "/api/token", - } - - var output tokenOutput - req := c.NewRequest(op, nil, &output) - req.SetContext(ctx) - - // remove the fetch token handler from the request handlers to avoid infinite recursion - req.Handlers.Sign.RemoveByName(fetchTokenHandlerName) - - // Swap the unmarshalMetadataHandler with unmarshalTokenHandler on this request. - req.Handlers.Unmarshal.Swap(unmarshalMetadataHandlerName, unmarshalTokenHandler) - - ttl := strconv.FormatInt(int64(duration/time.Second), 10) - req.HTTPRequest.Header.Set(ttlHeader, ttl) - - err := req.Send() - - // Errors with bad request status should be returned. - if err != nil { - err = awserr.NewRequestFailure( - awserr.New(req.HTTPResponse.Status, http.StatusText(req.HTTPResponse.StatusCode), err), - req.HTTPResponse.StatusCode, req.RequestID) - } - - return output, err -} - -// GetMetadata uses the path provided to request information from the EC2 -// instance metadata service. The content will be returned as a string, or -// error if the request failed. -func (c *EC2Metadata) GetMetadata(p string) (string, error) { - return c.GetMetadataWithContext(aws.BackgroundContext(), p) -} - -// GetMetadataWithContext uses the path provided to request information from the EC2 -// instance metadata service. The content will be returned as a string, or -// error if the request failed. -func (c *EC2Metadata) GetMetadataWithContext(ctx aws.Context, p string) (string, error) { - op := &request.Operation{ - Name: "GetMetadata", - HTTPMethod: "GET", - HTTPPath: sdkuri.PathJoin("/meta-data", p), - } - output := &metadataOutput{} - - req := c.NewRequest(op, nil, output) - - req.SetContext(ctx) - - err := req.Send() - return output.Content, err -} - -// GetUserData returns the userdata that was configured for the service. If -// there is no user-data setup for the EC2 instance a "NotFoundError" error -// code will be returned. -func (c *EC2Metadata) GetUserData() (string, error) { - return c.GetUserDataWithContext(aws.BackgroundContext()) -} - -// GetUserDataWithContext returns the userdata that was configured for the service. If -// there is no user-data setup for the EC2 instance a "NotFoundError" error -// code will be returned. -func (c *EC2Metadata) GetUserDataWithContext(ctx aws.Context) (string, error) { - op := &request.Operation{ - Name: "GetUserData", - HTTPMethod: "GET", - HTTPPath: "/user-data", - } - - output := &metadataOutput{} - req := c.NewRequest(op, nil, output) - req.SetContext(ctx) - - err := req.Send() - return output.Content, err -} - -// GetDynamicData uses the path provided to request information from the EC2 -// instance metadata service for dynamic data. The content will be returned -// as a string, or error if the request failed. -func (c *EC2Metadata) GetDynamicData(p string) (string, error) { - return c.GetDynamicDataWithContext(aws.BackgroundContext(), p) -} - -// GetDynamicDataWithContext uses the path provided to request information from the EC2 -// instance metadata service for dynamic data. The content will be returned -// as a string, or error if the request failed. -func (c *EC2Metadata) GetDynamicDataWithContext(ctx aws.Context, p string) (string, error) { - op := &request.Operation{ - Name: "GetDynamicData", - HTTPMethod: "GET", - HTTPPath: sdkuri.PathJoin("/dynamic", p), - } - - output := &metadataOutput{} - req := c.NewRequest(op, nil, output) - req.SetContext(ctx) - - err := req.Send() - return output.Content, err -} - -// GetInstanceIdentityDocument retrieves an identity document describing an -// instance. Error is returned if the request fails or is unable to parse -// the response. -func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument, error) { - return c.GetInstanceIdentityDocumentWithContext(aws.BackgroundContext()) -} - -// GetInstanceIdentityDocumentWithContext retrieves an identity document describing an -// instance. Error is returned if the request fails or is unable to parse -// the response. -func (c *EC2Metadata) GetInstanceIdentityDocumentWithContext(ctx aws.Context) (EC2InstanceIdentityDocument, error) { - resp, err := c.GetDynamicDataWithContext(ctx, "instance-identity/document") - if err != nil { - return EC2InstanceIdentityDocument{}, - awserr.New("EC2MetadataRequestError", - "failed to get EC2 instance identity document", err) - } - - doc := EC2InstanceIdentityDocument{} - if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { - return EC2InstanceIdentityDocument{}, - awserr.New(request.ErrCodeSerialization, - "failed to decode EC2 instance identity document", err) - } - - return doc, nil -} - -// IAMInfo retrieves IAM info from the metadata API -func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { - return c.IAMInfoWithContext(aws.BackgroundContext()) -} - -// IAMInfoWithContext retrieves IAM info from the metadata API -func (c *EC2Metadata) IAMInfoWithContext(ctx aws.Context) (EC2IAMInfo, error) { - resp, err := c.GetMetadataWithContext(ctx, "iam/info") - if err != nil { - return EC2IAMInfo{}, - awserr.New("EC2MetadataRequestError", - "failed to get EC2 IAM info", err) - } - - info := EC2IAMInfo{} - if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { - return EC2IAMInfo{}, - awserr.New(request.ErrCodeSerialization, - "failed to decode EC2 IAM info", err) - } - - if info.Code != "Success" { - errMsg := fmt.Sprintf("failed to get EC2 IAM Info (%s)", info.Code) - return EC2IAMInfo{}, - awserr.New("EC2MetadataError", errMsg, nil) - } - - return info, nil -} - -// Region returns the region the instance is running in. -func (c *EC2Metadata) Region() (string, error) { - return c.RegionWithContext(aws.BackgroundContext()) -} - -// RegionWithContext returns the region the instance is running in. -func (c *EC2Metadata) RegionWithContext(ctx aws.Context) (string, error) { - ec2InstanceIdentityDocument, err := c.GetInstanceIdentityDocumentWithContext(ctx) - if err != nil { - return "", err - } - // extract region from the ec2InstanceIdentityDocument - region := ec2InstanceIdentityDocument.Region - if len(region) == 0 { - return "", awserr.New("EC2MetadataError", "invalid region received for ec2metadata instance", nil) - } - // returns region - return region, nil -} - -// Available returns if the application has access to the EC2 Metadata service. -// Can be used to determine if application is running within an EC2 Instance and -// the metadata service is available. -func (c *EC2Metadata) Available() bool { - return c.AvailableWithContext(aws.BackgroundContext()) -} - -// AvailableWithContext returns if the application has access to the EC2 Metadata service. -// Can be used to determine if application is running within an EC2 Instance and -// the metadata service is available. -func (c *EC2Metadata) AvailableWithContext(ctx aws.Context) bool { - if _, err := c.GetMetadataWithContext(ctx, "instance-id"); err != nil { - return false - } - - return true -} - -// An EC2IAMInfo provides the shape for unmarshaling -// an IAM info from the metadata API -type EC2IAMInfo struct { - Code string - LastUpdated time.Time - InstanceProfileArn string - InstanceProfileID string -} - -// An EC2InstanceIdentityDocument provides the shape for unmarshaling -// an instance identity document -type EC2InstanceIdentityDocument struct { - DevpayProductCodes []string `json:"devpayProductCodes"` - MarketplaceProductCodes []string `json:"marketplaceProductCodes"` - AvailabilityZone string `json:"availabilityZone"` - PrivateIP string `json:"privateIp"` - Version string `json:"version"` - Region string `json:"region"` - InstanceID string `json:"instanceId"` - BillingProducts []string `json:"billingProducts"` - InstanceType string `json:"instanceType"` - AccountID string `json:"accountId"` - PendingTime time.Time `json:"pendingTime"` - ImageID string `json:"imageId"` - KernelID string `json:"kernelId"` - RamdiskID string `json:"ramdiskId"` - Architecture string `json:"architecture"` -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go deleted file mode 100644 index b8b2940d7..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ /dev/null @@ -1,228 +0,0 @@ -// Package ec2metadata provides the client for making API calls to the -// EC2 Metadata service. -// -// This package's client can be disabled completely by setting the environment -// variable "AWS_EC2_METADATA_DISABLED=true". This environment variable set to -// true instructs the SDK to disable the EC2 Metadata client. The client cannot -// be used while the environment variable is set to true, (case insensitive). -package ec2metadata - -import ( - "bytes" - "errors" - "io" - "net/http" - "os" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/request" -) - -const ( - // ServiceName is the name of the service. - ServiceName = "ec2metadata" - disableServiceEnvVar = "AWS_EC2_METADATA_DISABLED" - - // Headers for Token and TTL - ttlHeader = "x-aws-ec2-metadata-token-ttl-seconds" - tokenHeader = "x-aws-ec2-metadata-token" - - // Named Handler constants - fetchTokenHandlerName = "FetchTokenHandler" - unmarshalMetadataHandlerName = "unmarshalMetadataHandler" - unmarshalTokenHandlerName = "unmarshalTokenHandler" - enableTokenProviderHandlerName = "enableTokenProviderHandler" - - // TTL constants - defaultTTL = 21600 * time.Second - ttlExpirationWindow = 30 * time.Second -) - -// A EC2Metadata is an EC2 Metadata service Client. -type EC2Metadata struct { - *client.Client -} - -// New creates a new instance of the EC2Metadata client with a session. -// This client is safe to use across multiple goroutines. -// -// -// Example: -// // Create a EC2Metadata client from just a session. -// svc := ec2metadata.New(mySession) -// -// // Create a EC2Metadata client with additional configuration -// svc := ec2metadata.New(mySession, aws.NewConfig().WithLogLevel(aws.LogDebugHTTPBody)) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2Metadata { - c := p.ClientConfig(ServiceName, cfgs...) - return NewClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) -} - -// NewClient returns a new EC2Metadata client. Should be used to create -// a client when not using a session. Generally using just New with a session -// is preferred. -// -// If an unmodified HTTP client is provided from the stdlib default, or no client -// the EC2RoleProvider's EC2Metadata HTTP client's timeout will be shortened. -// To disable this set Config.EC2MetadataDisableTimeoutOverride to false. Enabled by default. -func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string, opts ...func(*client.Client)) *EC2Metadata { - if !aws.BoolValue(cfg.EC2MetadataDisableTimeoutOverride) && httpClientZero(cfg.HTTPClient) { - // If the http client is unmodified and this feature is not disabled - // set custom timeouts for EC2Metadata requests. - cfg.HTTPClient = &http.Client{ - // use a shorter timeout than default because the metadata - // service is local if it is running, and to fail faster - // if not running on an ec2 instance. - Timeout: 1 * time.Second, - } - // max number of retries on the client operation - cfg.MaxRetries = aws.Int(2) - } - - svc := &EC2Metadata{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceName, - Endpoint: endpoint, - APIVersion: "latest", - }, - handlers, - ), - } - - // token provider instance - tp := newTokenProvider(svc, defaultTTL) - - // NamedHandler for fetching token - svc.Handlers.Sign.PushBackNamed(request.NamedHandler{ - Name: fetchTokenHandlerName, - Fn: tp.fetchTokenHandler, - }) - // NamedHandler for enabling token provider - svc.Handlers.Complete.PushBackNamed(request.NamedHandler{ - Name: enableTokenProviderHandlerName, - Fn: tp.enableTokenProviderHandler, - }) - - svc.Handlers.Unmarshal.PushBackNamed(unmarshalHandler) - svc.Handlers.UnmarshalError.PushBack(unmarshalError) - svc.Handlers.Validate.Clear() - svc.Handlers.Validate.PushBack(validateEndpointHandler) - - // Disable the EC2 Metadata service if the environment variable is set. - // This short-circuits the service's functionality to always fail to send - // requests. - if strings.ToLower(os.Getenv(disableServiceEnvVar)) == "true" { - svc.Handlers.Send.SwapNamed(request.NamedHandler{ - Name: corehandlers.SendHandler.Name, - Fn: func(r *request.Request) { - r.HTTPResponse = &http.Response{ - Header: http.Header{}, - } - r.Error = awserr.New( - request.CanceledErrorCode, - "EC2 IMDS access disabled via "+disableServiceEnvVar+" env var", - nil) - }, - }) - } - - // Add additional options to the service config - for _, option := range opts { - option(svc.Client) - } - return svc -} - -func httpClientZero(c *http.Client) bool { - return c == nil || (c.Transport == nil && c.CheckRedirect == nil && c.Jar == nil && c.Timeout == 0) -} - -type metadataOutput struct { - Content string -} - -type tokenOutput struct { - Token string - TTL time.Duration -} - -// unmarshal token handler is used to parse the response of a getToken operation -var unmarshalTokenHandler = request.NamedHandler{ - Name: unmarshalTokenHandlerName, - Fn: func(r *request.Request) { - defer r.HTTPResponse.Body.Close() - var b bytes.Buffer - if _, err := io.Copy(&b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.NewRequestFailure(awserr.New(request.ErrCodeSerialization, - "unable to unmarshal EC2 metadata response", err), r.HTTPResponse.StatusCode, r.RequestID) - return - } - - v := r.HTTPResponse.Header.Get(ttlHeader) - data, ok := r.Data.(*tokenOutput) - if !ok { - return - } - - data.Token = b.String() - // TTL is in seconds - i, err := strconv.ParseInt(v, 10, 64) - if err != nil { - r.Error = awserr.NewRequestFailure(awserr.New(request.ParamFormatErrCode, - "unable to parse EC2 token TTL response", err), r.HTTPResponse.StatusCode, r.RequestID) - return - } - t := time.Duration(i) * time.Second - data.TTL = t - }, -} - -var unmarshalHandler = request.NamedHandler{ - Name: unmarshalMetadataHandlerName, - Fn: func(r *request.Request) { - defer r.HTTPResponse.Body.Close() - var b bytes.Buffer - if _, err := io.Copy(&b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.NewRequestFailure(awserr.New(request.ErrCodeSerialization, - "unable to unmarshal EC2 metadata response", err), r.HTTPResponse.StatusCode, r.RequestID) - return - } - - if data, ok := r.Data.(*metadataOutput); ok { - data.Content = b.String() - } - }, -} - -func unmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - var b bytes.Buffer - - if _, err := io.Copy(&b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata error response", err), - r.HTTPResponse.StatusCode, r.RequestID) - return - } - - // Response body format is not consistent between metadata endpoints. - // Grab the error message as a string and include that as the source error - r.Error = awserr.NewRequestFailure(awserr.New("EC2MetadataError", "failed to make EC2Metadata request", errors.New(b.String())), - r.HTTPResponse.StatusCode, r.RequestID) -} - -func validateEndpointHandler(r *request.Request) { - if r.ClientInfo.Endpoint == "" { - r.Error = aws.ErrMissingEndpoint - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/token_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/token_provider.go deleted file mode 100644 index d0a3a020d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/token_provider.go +++ /dev/null @@ -1,92 +0,0 @@ -package ec2metadata - -import ( - "net/http" - "sync/atomic" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" -) - -// A tokenProvider struct provides access to EC2Metadata client -// and atomic instance of a token, along with configuredTTL for it. -// tokenProvider also provides an atomic flag to disable the -// fetch token operation. -// The disabled member will use 0 as false, and 1 as true. -type tokenProvider struct { - client *EC2Metadata - token atomic.Value - configuredTTL time.Duration - disabled uint32 -} - -// A ec2Token struct helps use of token in EC2 Metadata service ops -type ec2Token struct { - token string - credentials.Expiry -} - -// newTokenProvider provides a pointer to a tokenProvider instance -func newTokenProvider(c *EC2Metadata, duration time.Duration) *tokenProvider { - return &tokenProvider{client: c, configuredTTL: duration} -} - -// fetchTokenHandler fetches token for EC2Metadata service client by default. -func (t *tokenProvider) fetchTokenHandler(r *request.Request) { - - // short-circuits to insecure data flow if tokenProvider is disabled. - if v := atomic.LoadUint32(&t.disabled); v == 1 { - return - } - - if ec2Token, ok := t.token.Load().(ec2Token); ok && !ec2Token.IsExpired() { - r.HTTPRequest.Header.Set(tokenHeader, ec2Token.token) - return - } - - output, err := t.client.getToken(r.Context(), t.configuredTTL) - - if err != nil { - - // change the disabled flag on token provider to true, - // when error is request timeout error. - if requestFailureError, ok := err.(awserr.RequestFailure); ok { - switch requestFailureError.StatusCode() { - case http.StatusForbidden, http.StatusNotFound, http.StatusMethodNotAllowed: - atomic.StoreUint32(&t.disabled, 1) - case http.StatusBadRequest: - r.Error = requestFailureError - } - - // Check if request timed out while waiting for response - if e, ok := requestFailureError.OrigErr().(awserr.Error); ok { - if e.Code() == request.ErrCodeRequestError { - atomic.StoreUint32(&t.disabled, 1) - } - } - } - return - } - - newToken := ec2Token{ - token: output.Token, - } - newToken.SetExpiration(time.Now().Add(output.TTL), ttlExpirationWindow) - t.token.Store(newToken) - - // Inject token header to the request. - if ec2Token, ok := t.token.Load().(ec2Token); ok { - r.HTTPRequest.Header.Set(tokenHeader, ec2Token.token) - } -} - -// enableTokenProviderHandler enables the token provider -func (t *tokenProvider) enableTokenProviderHandler(r *request.Request) { - // If the error code status is 401, we enable the token provider - if e, ok := r.Error.(awserr.RequestFailure); ok && e != nil && - e.StatusCode() == http.StatusUnauthorized { - atomic.StoreUint32(&t.disabled, 0) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go deleted file mode 100644 index 654fb1ad5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go +++ /dev/null @@ -1,216 +0,0 @@ -package endpoints - -import ( - "encoding/json" - "fmt" - "io" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -type modelDefinition map[string]json.RawMessage - -// A DecodeModelOptions are the options for how the endpoints model definition -// are decoded. -type DecodeModelOptions struct { - SkipCustomizations bool -} - -// Set combines all of the option functions together. -func (d *DecodeModelOptions) Set(optFns ...func(*DecodeModelOptions)) { - for _, fn := range optFns { - fn(d) - } -} - -// DecodeModel unmarshals a Regions and Endpoint model definition file into -// a endpoint Resolver. If the file format is not supported, or an error occurs -// when unmarshaling the model an error will be returned. -// -// Casting the return value of this func to a EnumPartitions will -// allow you to get a list of the partitions in the order the endpoints -// will be resolved in. -// -// resolver, err := endpoints.DecodeModel(reader) -// -// partitions := resolver.(endpoints.EnumPartitions).Partitions() -// for _, p := range partitions { -// // ... inspect partitions -// } -func DecodeModel(r io.Reader, optFns ...func(*DecodeModelOptions)) (Resolver, error) { - var opts DecodeModelOptions - opts.Set(optFns...) - - // Get the version of the partition file to determine what - // unmarshaling model to use. - modelDef := modelDefinition{} - if err := json.NewDecoder(r).Decode(&modelDef); err != nil { - return nil, newDecodeModelError("failed to decode endpoints model", err) - } - - var version string - if b, ok := modelDef["version"]; ok { - version = string(b) - } else { - return nil, newDecodeModelError("endpoints version not found in model", nil) - } - - if version == "3" { - return decodeV3Endpoints(modelDef, opts) - } - - return nil, newDecodeModelError( - fmt.Sprintf("endpoints version %s, not supported", version), nil) -} - -func decodeV3Endpoints(modelDef modelDefinition, opts DecodeModelOptions) (Resolver, error) { - b, ok := modelDef["partitions"] - if !ok { - return nil, newDecodeModelError("endpoints model missing partitions", nil) - } - - ps := partitions{} - if err := json.Unmarshal(b, &ps); err != nil { - return nil, newDecodeModelError("failed to decode endpoints model", err) - } - - if opts.SkipCustomizations { - return ps, nil - } - - // Customization - for i := 0; i < len(ps); i++ { - p := &ps[i] - custAddEC2Metadata(p) - custAddS3DualStack(p) - custRegionalS3(p) - custRmIotDataService(p) - custFixAppAutoscalingChina(p) - custFixAppAutoscalingUsGov(p) - } - - return ps, nil -} - -func custAddS3DualStack(p *partition) { - if !(p.ID == "aws" || p.ID == "aws-cn" || p.ID == "aws-us-gov") { - return - } - - custAddDualstack(p, "s3") - custAddDualstack(p, "s3-control") -} - -func custRegionalS3(p *partition) { - if p.ID != "aws" { - return - } - - service, ok := p.Services["s3"] - if !ok { - return - } - - // If global endpoint already exists no customization needed. - if _, ok := service.Endpoints["aws-global"]; ok { - return - } - - service.PartitionEndpoint = "aws-global" - service.Endpoints["us-east-1"] = endpoint{} - service.Endpoints["aws-global"] = endpoint{ - Hostname: "s3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - } - - p.Services["s3"] = service -} - -func custAddDualstack(p *partition, svcName string) { - s, ok := p.Services[svcName] - if !ok { - return - } - - s.Defaults.HasDualStack = boxedTrue - s.Defaults.DualStackHostname = "{service}.dualstack.{region}.{dnsSuffix}" - - p.Services[svcName] = s -} - -func custAddEC2Metadata(p *partition) { - p.Services["ec2metadata"] = service{ - IsRegionalized: boxedFalse, - PartitionEndpoint: "aws-global", - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - } -} - -func custRmIotDataService(p *partition) { - delete(p.Services, "data.iot") -} - -func custFixAppAutoscalingChina(p *partition) { - if p.ID != "aws-cn" { - return - } - - const serviceName = "application-autoscaling" - s, ok := p.Services[serviceName] - if !ok { - return - } - - const expectHostname = `autoscaling.{region}.amazonaws.com` - if e, a := s.Defaults.Hostname, expectHostname; e != a { - fmt.Printf("custFixAppAutoscalingChina: ignoring customization, expected %s, got %s\n", e, a) - return - } - - s.Defaults.Hostname = expectHostname + ".cn" - p.Services[serviceName] = s -} - -func custFixAppAutoscalingUsGov(p *partition) { - if p.ID != "aws-us-gov" { - return - } - - const serviceName = "application-autoscaling" - s, ok := p.Services[serviceName] - if !ok { - return - } - - if a := s.Defaults.CredentialScope.Service; a != "" { - fmt.Printf("custFixAppAutoscalingUsGov: ignoring customization, expected empty credential scope service, got %s\n", a) - return - } - - if a := s.Defaults.Hostname; a != "" { - fmt.Printf("custFixAppAutoscalingUsGov: ignoring customization, expected empty hostname, got %s\n", a) - return - } - - s.Defaults.CredentialScope.Service = "application-autoscaling" - s.Defaults.Hostname = "autoscaling.{region}.amazonaws.com" - - p.Services[serviceName] = s -} - -type decodeModelError struct { - awsError -} - -func newDecodeModelError(msg string, err error) decodeModelError { - return decodeModelError{ - awsError: awserr.New("DecodeEndpointsModelError", msg, err), - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go deleted file mode 100644 index efa7645ba..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ /dev/null @@ -1,9140 +0,0 @@ -// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. - -package endpoints - -import ( - "regexp" -) - -// Partition identifiers -const ( - AwsPartitionID = "aws" // AWS Standard partition. - AwsCnPartitionID = "aws-cn" // AWS China partition. - AwsUsGovPartitionID = "aws-us-gov" // AWS GovCloud (US) partition. - AwsIsoPartitionID = "aws-iso" // AWS ISO (US) partition. - AwsIsoBPartitionID = "aws-iso-b" // AWS ISOB (US) partition. -) - -// AWS Standard partition's regions. -const ( - AfSouth1RegionID = "af-south-1" // Africa (Cape Town). - ApEast1RegionID = "ap-east-1" // Asia Pacific (Hong Kong). - ApNortheast1RegionID = "ap-northeast-1" // Asia Pacific (Tokyo). - ApNortheast2RegionID = "ap-northeast-2" // Asia Pacific (Seoul). - ApSouth1RegionID = "ap-south-1" // Asia Pacific (Mumbai). - ApSoutheast1RegionID = "ap-southeast-1" // Asia Pacific (Singapore). - ApSoutheast2RegionID = "ap-southeast-2" // Asia Pacific (Sydney). - CaCentral1RegionID = "ca-central-1" // Canada (Central). - EuCentral1RegionID = "eu-central-1" // Europe (Frankfurt). - EuNorth1RegionID = "eu-north-1" // Europe (Stockholm). - EuSouth1RegionID = "eu-south-1" // Europe (Milan). - EuWest1RegionID = "eu-west-1" // Europe (Ireland). - EuWest2RegionID = "eu-west-2" // Europe (London). - EuWest3RegionID = "eu-west-3" // Europe (Paris). - MeSouth1RegionID = "me-south-1" // Middle East (Bahrain). - SaEast1RegionID = "sa-east-1" // South America (Sao Paulo). - UsEast1RegionID = "us-east-1" // US East (N. Virginia). - UsEast2RegionID = "us-east-2" // US East (Ohio). - UsWest1RegionID = "us-west-1" // US West (N. California). - UsWest2RegionID = "us-west-2" // US West (Oregon). -) - -// AWS China partition's regions. -const ( - CnNorth1RegionID = "cn-north-1" // China (Beijing). - CnNorthwest1RegionID = "cn-northwest-1" // China (Ningxia). -) - -// AWS GovCloud (US) partition's regions. -const ( - UsGovEast1RegionID = "us-gov-east-1" // AWS GovCloud (US-East). - UsGovWest1RegionID = "us-gov-west-1" // AWS GovCloud (US-West). -) - -// AWS ISO (US) partition's regions. -const ( - UsIsoEast1RegionID = "us-iso-east-1" // US ISO East. -) - -// AWS ISOB (US) partition's regions. -const ( - UsIsobEast1RegionID = "us-isob-east-1" // US ISOB East (Ohio). -) - -// DefaultResolver returns an Endpoint resolver that will be able -// to resolve endpoints for: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), and AWS ISOB (US). -// -// Use DefaultPartitions() to get the list of the default partitions. -func DefaultResolver() Resolver { - return defaultPartitions -} - -// DefaultPartitions returns a list of the partitions the SDK is bundled -// with. The available partitions are: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), and AWS ISOB (US). -// -// partitions := endpoints.DefaultPartitions -// for _, p := range partitions { -// // ... inspect partitions -// } -func DefaultPartitions() []Partition { - return defaultPartitions.Partitions() -} - -var defaultPartitions = partitions{ - awsPartition, - awscnPartition, - awsusgovPartition, - awsisoPartition, - awsisobPartition, -} - -// AwsPartition returns the Resolver for AWS Standard. -func AwsPartition() Partition { - return awsPartition.Partition() -} - -var awsPartition = partition{ - ID: "aws", - Name: "AWS Standard", - DNSSuffix: "amazonaws.com", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "af-south-1": region{ - Description: "Africa (Cape Town)", - }, - "ap-east-1": region{ - Description: "Asia Pacific (Hong Kong)", - }, - "ap-northeast-1": region{ - Description: "Asia Pacific (Tokyo)", - }, - "ap-northeast-2": region{ - Description: "Asia Pacific (Seoul)", - }, - "ap-south-1": region{ - Description: "Asia Pacific (Mumbai)", - }, - "ap-southeast-1": region{ - Description: "Asia Pacific (Singapore)", - }, - "ap-southeast-2": region{ - Description: "Asia Pacific (Sydney)", - }, - "ca-central-1": region{ - Description: "Canada (Central)", - }, - "eu-central-1": region{ - Description: "Europe (Frankfurt)", - }, - "eu-north-1": region{ - Description: "Europe (Stockholm)", - }, - "eu-south-1": region{ - Description: "Europe (Milan)", - }, - "eu-west-1": region{ - Description: "Europe (Ireland)", - }, - "eu-west-2": region{ - Description: "Europe (London)", - }, - "eu-west-3": region{ - Description: "Europe (Paris)", - }, - "me-south-1": region{ - Description: "Middle East (Bahrain)", - }, - "sa-east-1": region{ - Description: "South America (Sao Paulo)", - }, - "us-east-1": region{ - Description: "US East (N. Virginia)", - }, - "us-east-2": region{ - Description: "US East (Ohio)", - }, - "us-west-1": region{ - Description: "US West (N. California)", - }, - "us-west-2": region{ - Description: "US West (Oregon)", - }, - }, - Services: services{ - "a4b": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "access-analyzer": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "acm": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "ca-central-1-fips": endpoint{ - Hostname: "acm-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "acm-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "acm-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "acm-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "acm-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "acm-pca": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "acm-pca-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "acm-pca-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "acm-pca-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "acm-pca-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "acm-pca-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "api.detective": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "api.ecr": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{ - Hostname: "api.ecr.af-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "af-south-1", - }, - }, - "ap-east-1": endpoint{ - Hostname: "api.ecr.ap-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-east-1", - }, - }, - "ap-northeast-1": endpoint{ - Hostname: "api.ecr.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-northeast-2": endpoint{ - Hostname: "api.ecr.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-south-1": endpoint{ - Hostname: "api.ecr.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "ap-southeast-1": endpoint{ - Hostname: "api.ecr.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "api.ecr.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "api.ecr.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "api.ecr.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-north-1": endpoint{ - Hostname: "api.ecr.eu-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, - "eu-south-1": endpoint{ - Hostname: "api.ecr.eu-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-south-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "api.ecr.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "api.ecr.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "eu-west-3": endpoint{ - Hostname: "api.ecr.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "ecr-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "ecr-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "ecr-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "ecr-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{ - Hostname: "api.ecr.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, - "sa-east-1": endpoint{ - Hostname: "api.ecr.sa-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "us-east-1": endpoint{ - Hostname: "api.ecr.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "api.ecr.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{ - Hostname: "api.ecr.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{ - Hostname: "api.ecr.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "api.elastic-inference": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "api.elastic-inference.ap-northeast-1.amazonaws.com", - }, - "ap-northeast-2": endpoint{ - Hostname: "api.elastic-inference.ap-northeast-2.amazonaws.com", - }, - "eu-west-1": endpoint{ - Hostname: "api.elastic-inference.eu-west-1.amazonaws.com", - }, - "us-east-1": endpoint{ - Hostname: "api.elastic-inference.us-east-1.amazonaws.com", - }, - "us-east-2": endpoint{ - Hostname: "api.elastic-inference.us-east-2.amazonaws.com", - }, - "us-west-2": endpoint{ - Hostname: "api.elastic-inference.us-west-2.amazonaws.com", - }, - }, - }, - "api.mediatailor": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "api.pricing": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "pricing", - }, - }, - Endpoints: endpoints{ - "ap-south-1": endpoint{}, - "us-east-1": endpoint{}, - }, - }, - "api.sagemaker": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "api-fips.sagemaker.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "api-fips.sagemaker.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "api-fips.sagemaker.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "api-fips.sagemaker.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "apigateway": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "application-autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "appmesh": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "appstream2": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - CredentialScope: credentialScope{ - Service: "appstream", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "fips": endpoint{ - Hostname: "appstream2-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "appsync": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "athena": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "autoscaling-plans": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "backup": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "batch": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "fips.batch.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "fips.batch.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "fips.batch.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "fips.batch.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "budgets": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "budgets.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "ce": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "ce.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "chime": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - Defaults: endpoint{ - SSLCommonName: "service.chime.aws.amazon.com", - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "service.chime.aws.amazon.com", - Protocols: []string{"https"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "cloud9": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "clouddirectory": service{ - - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "cloudformation-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "cloudformation-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "cloudformation-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "cloudformation-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "cloudfront": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "cloudfront.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "cloudhsm": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudhsmv2": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "cloudhsm", - }, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudsearch": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "cloudtrail-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "cloudtrail-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "cloudtrail-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "cloudtrail-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codeartifact": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codebuild": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "codebuild-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "codebuild-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "codebuild-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "codebuild-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "codecommit": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips": endpoint{ - Hostname: "codecommit-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "codedeploy-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "codedeploy-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "codedeploy-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "codedeploy-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "codepipeline": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "codepipeline-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "codepipeline-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "codepipeline-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "codepipeline-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "codepipeline-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codestar": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "codestar-connections": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cognito-identity": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "cognito-identity-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "cognito-identity-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "cognito-identity-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cognito-idp": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "cognito-idp-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "cognito-idp-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "cognito-idp-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cognito-sync": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "comprehend": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "comprehend-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "comprehend-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "comprehend-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "comprehendmedical": service{ - - Endpoints: endpoints{ - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "comprehendmedical-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "comprehendmedical-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "comprehendmedical-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "connect": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "cur": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "data.mediastore": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "dataexchange": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "datapipeline": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "datasync": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "datasync-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "datasync-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "datasync-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "datasync-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "datasync-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "dax": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "devicefarm": service{ - - Endpoints: endpoints{ - "us-west-2": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "directconnect-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "directconnect-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "directconnect-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "directconnect-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "discovery": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "dms-fips": endpoint{ - Hostname: "dms-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "docdb": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "rds.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-northeast-2": endpoint{ - Hostname: "rds.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-south-1": endpoint{ - Hostname: "rds.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "ap-southeast-1": endpoint{ - Hostname: "rds.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "rds.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "rds.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "rds.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "rds.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "rds.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "eu-west-3": endpoint{ - Hostname: "rds.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "us-east-1": endpoint{ - Hostname: "rds.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "rds.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-2": endpoint{ - Hostname: "rds.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "ds": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "ds-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "ds-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "ds-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "ds-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "ds-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "ca-central-1-fips": endpoint{ - Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "local": endpoint{ - Hostname: "localhost:8000", - Protocols: []string{"http"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "ec2-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "ec2-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "ec2-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "ec2-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "ec2-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "ecs-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "ecs-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "ecs-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "ecs-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "eks": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "fips.eks.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "fips.eks.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "fips.eks.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips": endpoint{ - Hostname: "elasticache-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticbeanstalk": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "elasticbeanstalk-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "elasticbeanstalk-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "elasticbeanstalk-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "elasticbeanstalk-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticfilesystem": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-af-south-1": endpoint{ - Hostname: "elasticfilesystem-fips.af-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "af-south-1", - }, - }, - "fips-ap-east-1": endpoint{ - Hostname: "elasticfilesystem-fips.ap-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-east-1", - }, - }, - "fips-ap-northeast-1": endpoint{ - Hostname: "elasticfilesystem-fips.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "fips-ap-northeast-2": endpoint{ - Hostname: "elasticfilesystem-fips.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "fips-ap-south-1": endpoint{ - Hostname: "elasticfilesystem-fips.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "fips-ap-southeast-1": endpoint{ - Hostname: "elasticfilesystem-fips.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "fips-ap-southeast-2": endpoint{ - Hostname: "elasticfilesystem-fips.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "fips-ca-central-1": endpoint{ - Hostname: "elasticfilesystem-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-eu-central-1": endpoint{ - Hostname: "elasticfilesystem-fips.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "fips-eu-north-1": endpoint{ - Hostname: "elasticfilesystem-fips.eu-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, - "fips-eu-south-1": endpoint{ - Hostname: "elasticfilesystem-fips.eu-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-south-1", - }, - }, - "fips-eu-west-1": endpoint{ - Hostname: "elasticfilesystem-fips.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "fips-eu-west-2": endpoint{ - Hostname: "elasticfilesystem-fips.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "fips-eu-west-3": endpoint{ - Hostname: "elasticfilesystem-fips.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "fips-me-south-1": endpoint{ - Hostname: "elasticfilesystem-fips.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, - "fips-sa-east-1": endpoint{ - Hostname: "elasticfilesystem-fips.sa-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "elasticfilesystem-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "elasticfilesystem-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "elasticfilesystem-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "elasticfilesystem-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "elasticloadbalancing-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "elasticloadbalancing-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "elasticloadbalancing-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "elasticloadbalancing-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elasticmapreduce": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.{service}.{dnsSuffix}", - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{ - SSLCommonName: "{service}.{region}.{dnsSuffix}", - }, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "elasticmapreduce-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "elasticmapreduce-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "elasticmapreduce-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "elasticmapreduce-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "elasticmapreduce-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - SSLCommonName: "{service}.{region}.{dnsSuffix}", - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "elastictranscoder": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "email": service{ - - Endpoints: endpoints{ - "ap-south-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "entitlement.marketplace": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "aws-marketplace", - }, - }, - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "es": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips": endpoint{ - Hostname: "es-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "events-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "events-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "events-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "events-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "firehose": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "firehose-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "firehose-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "firehose-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "firehose-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "fms": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ap-northeast-1": endpoint{ - Hostname: "fms-fips.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "fips-ap-northeast-2": endpoint{ - Hostname: "fms-fips.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "fips-ap-south-1": endpoint{ - Hostname: "fms-fips.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "fips-ap-southeast-1": endpoint{ - Hostname: "fms-fips.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "fips-ap-southeast-2": endpoint{ - Hostname: "fms-fips.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "fips-ca-central-1": endpoint{ - Hostname: "fms-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-eu-central-1": endpoint{ - Hostname: "fms-fips.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "fips-eu-west-1": endpoint{ - Hostname: "fms-fips.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "fips-eu-west-2": endpoint{ - Hostname: "fms-fips.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "fips-eu-west-3": endpoint{ - Hostname: "fms-fips.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "fips-sa-east-1": endpoint{ - Hostname: "fms-fips.sa-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "fms-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "fms-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "fms-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "fms-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "forecast": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "forecastquery": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "fsx": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "gamelift": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "glacier": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "glacier-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "glacier-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "glacier-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "glacier-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "glacier-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "glue": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "glue-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "glue-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "glue-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "glue-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "greengrass": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "groundstation": service{ - - Endpoints: endpoints{ - "ap-southeast-2": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "me-south-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "guardduty": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "guardduty-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "guardduty-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "guardduty-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "guardduty-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "honeycode": service{ - - Endpoints: endpoints{ - "us-west-2": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "iam.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "iam-fips": endpoint{ - Hostname: "iam-fips.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "importexport": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "importexport.amazonaws.com", - SignatureVersions: []string{"v2", "v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - Service: "IngestionService", - }, - }, - }, - }, - "inspector": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "inspector-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "inspector-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "inspector-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "inspector-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "iot": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "execute-api", - }, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "iotanalytics": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "iotevents": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ioteventsdata": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "data.iotevents.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-northeast-2": endpoint{ - Hostname: "data.iotevents.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-southeast-1": endpoint{ - Hostname: "data.iotevents.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "data.iotevents.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "eu-central-1": endpoint{ - Hostname: "data.iotevents.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "data.iotevents.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "data.iotevents.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "us-east-1": endpoint{ - Hostname: "data.iotevents.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "data.iotevents.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-2": endpoint{ - Hostname: "data.iotevents.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "iotsecuredtunneling": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "iotthingsgraph": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "iotthingsgraph", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kafka": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "kinesis-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "kinesis-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "kinesis-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "kinesis-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesisanalytics": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesisvideo": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "lakeformation": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "lambda-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "lambda-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "lambda-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "lambda-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "license-manager": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "license-manager-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "license-manager-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "license-manager-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "license-manager-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "lightsail": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "logs-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "logs-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "logs-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "logs-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "machinelearning": service{ - - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - }, - }, - "macie": service{ - - Endpoints: endpoints{ - "fips-us-east-1": endpoint{ - Hostname: "macie-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "macie-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "managedblockchain": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - }, - }, - "marketplacecommerceanalytics": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "mediaconnect": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mediaconvert": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "mediaconvert-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "mediaconvert-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "mediaconvert-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "mediaconvert-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "mediaconvert-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "medialive": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mediapackage": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mediastore": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "metering.marketplace": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "aws-marketplace", - }, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mgh": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mobileanalytics": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "models.lex": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "lex", - }, - }, - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "monitoring": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "monitoring-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "monitoring-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "monitoring-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "monitoring-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mq": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "mq-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "mq-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "mq-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "mq-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "mturk-requester": service{ - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "sandbox": endpoint{ - Hostname: "mturk-requester-sandbox.us-east-1.amazonaws.com", - }, - "us-east-1": endpoint{}, - }, - }, - "neptune": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "rds.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-northeast-2": endpoint{ - Hostname: "rds.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-south-1": endpoint{ - Hostname: "rds.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "ap-southeast-1": endpoint{ - Hostname: "rds.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "rds.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "rds.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "rds.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-north-1": endpoint{ - Hostname: "rds.eu-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "rds.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "rds.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "eu-west-3": endpoint{ - Hostname: "rds.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "me-south-1": endpoint{ - Hostname: "rds.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, - "us-east-1": endpoint{ - Hostname: "rds.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "rds.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-2": endpoint{ - Hostname: "rds.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "oidc": service{ - - Endpoints: endpoints{ - "ap-southeast-1": endpoint{ - Hostname: "oidc.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "oidc.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "oidc.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "oidc.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "oidc.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "oidc.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "us-east-1": endpoint{ - Hostname: "oidc.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "oidc.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-2": endpoint{ - Hostname: "oidc.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "opsworks": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "opsworks-cm": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "organizations": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "organizations.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-aws-global": endpoint{ - Hostname: "organizations-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "outposts": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "outposts-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "outposts-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "outposts-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "outposts-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "outposts-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "pinpoint": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "mobiletargeting", - }, - }, - Endpoints: endpoints{ - "ap-south-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "pinpoint-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "pinpoint-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{ - Hostname: "pinpoint.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-west-2": endpoint{ - Hostname: "pinpoint.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "polly": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "polly-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "polly-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "polly-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "polly-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "portal.sso": service{ - - Endpoints: endpoints{ - "ap-southeast-1": endpoint{ - Hostname: "portal.sso.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "portal.sso.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "portal.sso.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "portal.sso.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "portal.sso.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "portal.sso.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "us-east-1": endpoint{ - Hostname: "portal.sso.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "portal.sso.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-2": endpoint{ - Hostname: "portal.sso.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "projects.iot1click": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "qldb": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ram": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "rds-fips.ca-central-1": endpoint{ - Hostname: "rds-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "rds-fips.us-east-1": endpoint{ - Hostname: "rds-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "rds-fips.us-east-2": endpoint{ - Hostname: "rds-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "rds-fips.us-west-1": endpoint{ - Hostname: "rds-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "rds-fips.us-west-2": endpoint{ - Hostname: "rds-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - SSLCommonName: "{service}.{dnsSuffix}", - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ca-central-1": endpoint{ - Hostname: "redshift-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "redshift-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "redshift-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "redshift-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "redshift-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "rekognition": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "resource-groups": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "resource-groups-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "resource-groups-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "resource-groups-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "resource-groups-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "robomaker": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "route53": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "route53.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "route53domains": service{ - - Endpoints: endpoints{ - "us-east-1": endpoint{}, - }, - }, - "route53resolver": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "runtime.lex": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "lex", - }, - }, - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "runtime.sagemaker": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "s3": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{ - Hostname: "s3.ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{ - Hostname: "s3.ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "ap-southeast-2": endpoint{ - Hostname: "s3.ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "aws-global": endpoint{ - Hostname: "s3.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{ - Hostname: "s3.eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "s3-external-1": endpoint{ - Hostname: "s3-external-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "sa-east-1": endpoint{ - Hostname: "s3.sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-1": endpoint{ - Hostname: "s3.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{ - Hostname: "s3.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - "us-west-2": endpoint{ - Hostname: "s3.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3", "s3v4"}, - }, - }, - }, - "s3-control": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - SignatureVersions: []string{"s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "s3-control.ap-northeast-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-northeast-2": endpoint{ - Hostname: "s3-control.ap-northeast-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-south-1": endpoint{ - Hostname: "s3-control.ap-south-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "ap-southeast-1": endpoint{ - Hostname: "s3-control.ap-southeast-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "s3-control.ap-southeast-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "s3-control.ca-central-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "s3-control.eu-central-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-north-1": endpoint{ - Hostname: "s3-control.eu-north-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "s3-control.eu-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "s3-control.eu-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "eu-west-3": endpoint{ - Hostname: "s3-control.eu-west-3.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "sa-east-1": endpoint{ - Hostname: "s3-control.sa-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "us-east-1": endpoint{ - Hostname: "s3-control.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-1-fips": endpoint{ - Hostname: "s3-control-fips.us-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "s3-control.us-east-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-east-2-fips": endpoint{ - Hostname: "s3-control-fips.us-east-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{ - Hostname: "s3-control.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-1-fips": endpoint{ - Hostname: "s3-control-fips.us-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{ - Hostname: "s3-control.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-west-2-fips": endpoint{ - Hostname: "s3-control-fips.us-west-2.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "savingsplans": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "savingsplans.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "schemas": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "sdb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"v2"}, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - Hostname: "sdb.amazonaws.com", - }, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "secretsmanager": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "secretsmanager-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "secretsmanager-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "secretsmanager-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "secretsmanager-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "securityhub": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "securityhub-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "securityhub-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "securityhub-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "securityhub-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "serverlessrepo": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{ - Protocols: []string{"https"}, - }, - "ap-northeast-1": endpoint{ - Protocols: []string{"https"}, - }, - "ap-northeast-2": endpoint{ - Protocols: []string{"https"}, - }, - "ap-south-1": endpoint{ - Protocols: []string{"https"}, - }, - "ap-southeast-1": endpoint{ - Protocols: []string{"https"}, - }, - "ap-southeast-2": endpoint{ - Protocols: []string{"https"}, - }, - "ca-central-1": endpoint{ - Protocols: []string{"https"}, - }, - "eu-central-1": endpoint{ - Protocols: []string{"https"}, - }, - "eu-north-1": endpoint{ - Protocols: []string{"https"}, - }, - "eu-west-1": endpoint{ - Protocols: []string{"https"}, - }, - "eu-west-2": endpoint{ - Protocols: []string{"https"}, - }, - "eu-west-3": endpoint{ - Protocols: []string{"https"}, - }, - "me-south-1": endpoint{ - Protocols: []string{"https"}, - }, - "sa-east-1": endpoint{ - Protocols: []string{"https"}, - }, - "us-east-1": endpoint{ - Protocols: []string{"https"}, - }, - "us-east-2": endpoint{ - Protocols: []string{"https"}, - }, - "us-west-1": endpoint{ - Protocols: []string{"https"}, - }, - "us-west-2": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "servicecatalog": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "servicecatalog-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "servicecatalog-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "servicecatalog-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "servicecatalog-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "servicediscovery": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "session.qldb": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "shield": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - Defaults: endpoint{ - SSLCommonName: "shield.us-east-1.amazonaws.com", - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "shield.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-aws-global": endpoint{ - Hostname: "shield-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "sms": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "sms-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "sms-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "sms-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "sms-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-ap-northeast-1": endpoint{ - Hostname: "snowball-fips.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "fips-ap-northeast-2": endpoint{ - Hostname: "snowball-fips.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "fips-ap-south-1": endpoint{ - Hostname: "snowball-fips.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "fips-ap-southeast-1": endpoint{ - Hostname: "snowball-fips.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "fips-ap-southeast-2": endpoint{ - Hostname: "snowball-fips.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "fips-ca-central-1": endpoint{ - Hostname: "snowball-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-eu-central-1": endpoint{ - Hostname: "snowball-fips.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "fips-eu-west-1": endpoint{ - Hostname: "snowball-fips.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "fips-eu-west-2": endpoint{ - Hostname: "snowball-fips.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "fips-eu-west-3": endpoint{ - Hostname: "snowball-fips.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "fips-sa-east-1": endpoint{ - Hostname: "snowball-fips.sa-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "snowball-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "snowball-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "snowball-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "snowball-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "sns-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "sns-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "sns-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "sns-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "sqs-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "sqs-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "sqs-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "sqs-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{ - SSLCommonName: "queue.{dnsSuffix}", - }, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "ssm-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "ssm-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "ssm-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "ssm-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "ssm-facade-fips-us-east-1": endpoint{ - Hostname: "ssm-facade-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "ssm-facade-fips-us-east-2": endpoint{ - Hostname: "ssm-facade-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "ssm-facade-fips-us-west-1": endpoint{ - Hostname: "ssm-facade-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "ssm-facade-fips-us-west-2": endpoint{ - Hostname: "ssm-facade-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "states-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "states-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "states-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "states-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "storagegateway": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "ca-central-1-fips": endpoint{ - Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "local": endpoint{ - Hostname: "localhost:8000", - Protocols: []string{"http"}, - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "sts": service{ - PartitionEndpoint: "aws-global", - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "aws-global": endpoint{ - Hostname: "sts.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "sts-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "sts-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "sts-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "sts-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "support": service{ - PartitionEndpoint: "aws-global", - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "support.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "swf-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "swf-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "swf-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "swf-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "tagging": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "transcribe": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "fips.transcribe.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "fips.transcribe.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "fips.transcribe.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "fips.transcribe.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "transcribestreaming": service{ - - Endpoints: endpoints{ - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "transfer": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "translate": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "translate-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "translate-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "translate-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "waf": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-fips": endpoint{ - Hostname: "waf-fips.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "aws-global": endpoint{ - Hostname: "waf.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - }, - }, - "waf-regional": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{ - Hostname: "waf-regional.ap-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-east-1", - }, - }, - "ap-northeast-1": endpoint{ - Hostname: "waf-regional.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-northeast-2": endpoint{ - Hostname: "waf-regional.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "ap-south-1": endpoint{ - Hostname: "waf-regional.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "ap-southeast-1": endpoint{ - Hostname: "waf-regional.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "waf-regional.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "ca-central-1": endpoint{ - Hostname: "waf-regional.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{ - Hostname: "waf-regional.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-north-1": endpoint{ - Hostname: "waf-regional.eu-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "waf-regional.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "eu-west-2": endpoint{ - Hostname: "waf-regional.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "eu-west-3": endpoint{ - Hostname: "waf-regional.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "fips-ap-east-1": endpoint{ - Hostname: "waf-regional-fips.ap-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-east-1", - }, - }, - "fips-ap-northeast-1": endpoint{ - Hostname: "waf-regional-fips.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "fips-ap-northeast-2": endpoint{ - Hostname: "waf-regional-fips.ap-northeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-2", - }, - }, - "fips-ap-south-1": endpoint{ - Hostname: "waf-regional-fips.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - "fips-ap-southeast-1": endpoint{ - Hostname: "waf-regional-fips.ap-southeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-1", - }, - }, - "fips-ap-southeast-2": endpoint{ - Hostname: "waf-regional-fips.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, - "fips-ca-central-1": endpoint{ - Hostname: "waf-regional-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "fips-eu-central-1": endpoint{ - Hostname: "waf-regional-fips.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "fips-eu-north-1": endpoint{ - Hostname: "waf-regional-fips.eu-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, - "fips-eu-west-1": endpoint{ - Hostname: "waf-regional-fips.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "fips-eu-west-2": endpoint{ - Hostname: "waf-regional-fips.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, - "fips-eu-west-3": endpoint{ - Hostname: "waf-regional-fips.eu-west-3.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-3", - }, - }, - "fips-me-south-1": endpoint{ - Hostname: "waf-regional-fips.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, - "fips-sa-east-1": endpoint{ - Hostname: "waf-regional-fips.sa-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "fips-us-east-1": endpoint{ - Hostname: "waf-regional-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "waf-regional-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "waf-regional-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "waf-regional-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{ - Hostname: "waf-regional.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, - "sa-east-1": endpoint{ - Hostname: "waf-regional.sa-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "sa-east-1", - }, - }, - "us-east-1": endpoint{ - Hostname: "waf-regional.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "waf-regional.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{ - Hostname: "waf-regional.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{ - Hostname: "waf-regional.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "workdocs": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "workdocs-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "workdocs-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "workmail": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "workspaces": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "xray": service{ - - Endpoints: endpoints{ - "af-south-1": endpoint{}, - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - }, -} - -// AwsCnPartition returns the Resolver for AWS China. -func AwsCnPartition() Partition { - return awscnPartition.Partition() -} - -var awscnPartition = partition{ - ID: "aws-cn", - Name: "AWS China", - DNSSuffix: "amazonaws.com.cn", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^cn\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "cn-north-1": region{ - Description: "China (Beijing)", - }, - "cn-northwest-1": region{ - Description: "China (Ningxia)", - }, - }, - Services: services{ - "acm": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "api.ecr": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{ - Hostname: "api.ecr.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - "cn-northwest-1": endpoint{ - Hostname: "api.ecr.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "api.sagemaker": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "apigateway": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "application-autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "appsync": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "athena": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "autoscaling-plans": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "backup": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "batch": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "budgets": service{ - PartitionEndpoint: "aws-cn-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "budgets.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "cloudfront": service{ - PartitionEndpoint: "aws-cn-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "cloudfront.cn-northwest-1.amazonaws.com.cn", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "codebuild": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "codecommit": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "cognito-identity": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "dax": service{ - - Endpoints: endpoints{ - "cn-northwest-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "ds": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "eks": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticbeanstalk": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticfilesystem": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - "fips-cn-north-1": endpoint{ - Hostname: "elasticfilesystem-fips.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - "fips-cn-northwest-1": endpoint{ - Hostname: "elasticfilesystem-fips.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "elasticloadbalancing": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticmapreduce": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "es": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "firehose": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "gamelift": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "glacier": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "glue": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "greengrass": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-cn-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "iam.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - }, - }, - "iot": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "execute-api", - }, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "iotsecuredtunneling": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "kafka": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "kinesisanalytics": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "license-manager": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "mediaconvert": service{ - - Endpoints: endpoints{ - "cn-northwest-1": endpoint{ - Hostname: "subscribe.mediaconvert.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "monitoring": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "neptune": service{ - - Endpoints: endpoints{ - "cn-northwest-1": endpoint{ - Hostname: "rds.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "organizations": service{ - PartitionEndpoint: "aws-cn-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "organizations.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - "fips-aws-cn-global": endpoint{ - Hostname: "organizations.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "polly": service{ - - Endpoints: endpoints{ - "cn-northwest-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "route53": service{ - PartitionEndpoint: "aws-cn-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "route53.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "runtime.sagemaker": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "s3-control": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - SignatureVersions: []string{"s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{ - Hostname: "s3-control.cn-north-1.amazonaws.com.cn", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - "cn-northwest-1": endpoint{ - Hostname: "s3-control.cn-northwest-1.amazonaws.com.cn", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "secretsmanager": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "serverlessrepo": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{ - Protocols: []string{"https"}, - }, - "cn-northwest-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "sms": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "fips-cn-north-1": endpoint{ - Hostname: "snowball-fips.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "storagegateway": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "support": service{ - PartitionEndpoint: "aws-cn-global", - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "support.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "tagging": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "transcribe": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{ - Hostname: "cn.transcribe.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - "cn-northwest-1": endpoint{ - Hostname: "cn.transcribe.cn-northwest-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-northwest-1", - }, - }, - }, - }, - "workspaces": service{ - - Endpoints: endpoints{ - "cn-northwest-1": endpoint{}, - }, - }, - "xray": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - }, -} - -// AwsUsGovPartition returns the Resolver for AWS GovCloud (US). -func AwsUsGovPartition() Partition { - return awsusgovPartition.Partition() -} - -var awsusgovPartition = partition{ - ID: "aws-us-gov", - Name: "AWS GovCloud (US)", - DNSSuffix: "amazonaws.com", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^us\\-gov\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-gov-east-1": region{ - Description: "AWS GovCloud (US-East)", - }, - "us-gov-west-1": region{ - Description: "AWS GovCloud (US-West)", - }, - }, - Services: services{ - "access-analyzer": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "acm": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "acm-pca": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "acm-pca.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "acm-pca.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "api.ecr": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "ecr-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "ecr-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{ - Hostname: "api.ecr.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "api.ecr.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "api.sagemaker": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "api-fips.sagemaker.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1-fips-secondary": endpoint{ - Hostname: "api.sagemaker.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "apigateway": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "application-autoscaling": service{ - Defaults: endpoint{ - Hostname: "autoscaling.{region}.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "application-autoscaling", - }, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "appstream2": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - CredentialScope: credentialScope{ - Service: "appstream", - }, - }, - Endpoints: endpoints{ - "fips": endpoint{ - Hostname: "appstream2-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, - "athena": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "athena-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "athena-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "autoscaling": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "autoscaling-plans": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "backup": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "batch": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "batch.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "batch.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "clouddirectory": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "cloudformation.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "cloudformation.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "cloudhsm": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "cloudhsmv2": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "cloudhsm", - }, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "cloudtrail.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "cloudtrail.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "codebuild": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "codebuild-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "codebuild-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "codecommit": service{ - - Endpoints: endpoints{ - "fips": endpoint{ - Hostname: "codecommit-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "codedeploy-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "codedeploy-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "codepipeline": service{ - - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "codepipeline-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, - "cognito-identity": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "cognito-idp": service{ - - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "cognito-idp-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, - "comprehend": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "comprehend-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, - "comprehendmedical": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "datasync": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "datasync-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "datasync-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "directconnect.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "directconnect.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "dms-fips": endpoint{ - Hostname: "dms.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "ds": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "ds-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "ds-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "dynamodb": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "ec2": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "ec2.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "ec2.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "ecs-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "ecs-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "eks": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "fips": endpoint{ - Hostname: "elasticache.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "elasticbeanstalk": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "elasticbeanstalk.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "elasticbeanstalk.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "elasticfilesystem": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "elasticfilesystem-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "elasticfilesystem-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "elasticloadbalancing-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "elasticloadbalancing-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "elasticmapreduce": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "elasticmapreduce.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "elasticmapreduce.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "email": service{ - - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "email-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, - "es": service{ - - Endpoints: endpoints{ - "fips": endpoint{ - Hostname: "es-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "events.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "events.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "firehose": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "firehose-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "firehose-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "glacier": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "glacier.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "glacier.us-gov-west-1.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "glue": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "glue-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "glue-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "greengrass": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Hostname: "greengrass.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "guardduty": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "guardduty.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-us-gov-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-us-gov-global": endpoint{ - Hostname: "iam.us-gov.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "iam-govcloud-fips": endpoint{ - Hostname: "iam.us-gov.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "inspector": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "inspector-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "inspector-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "iot": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "execute-api", - }, - }, - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "iotsecuredtunneling": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "kafka": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "kinesis-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "kinesis-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "kinesisanalytics": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "ProdFips": endpoint{ - Hostname: "kms-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "lambda-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "lambda-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "license-manager": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "license-manager-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "license-manager-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "logs.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "logs.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "mediaconvert": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{ - Hostname: "mediaconvert.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "metering.marketplace": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "aws-marketplace", - }, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "monitoring": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "monitoring.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "monitoring.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "neptune": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "rds.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "rds.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "organizations": service{ - PartitionEndpoint: "aws-us-gov-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-us-gov-global": endpoint{ - Hostname: "organizations.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "fips-aws-us-gov-global": endpoint{ - Hostname: "organizations.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "outposts": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "outposts.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "outposts.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "pinpoint": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "mobiletargeting", - }, - }, - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "polly": service{ - - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "polly-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, - "ram": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "rds.us-gov-east-1": endpoint{ - Hostname: "rds.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "rds.us-gov-west-1": endpoint{ - Hostname: "rds.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "redshift.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "redshift.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "rekognition": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "resource-groups": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "resource-groups.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "resource-groups.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "route53": service{ - PartitionEndpoint: "aws-us-gov-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-us-gov-global": endpoint{ - Hostname: "route53.us-gov.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "route53resolver": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "runtime.sagemaker": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - SignatureVersions: []string{"s3", "s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "s3-fips-us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{ - Hostname: "s3.us-gov-east-1.amazonaws.com", - Protocols: []string{"http", "https"}, - }, - "us-gov-west-1": endpoint{ - Hostname: "s3.us-gov-west-1.amazonaws.com", - Protocols: []string{"http", "https"}, - }, - }, - }, - "s3-control": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - SignatureVersions: []string{"s3v4"}, - - HasDualStack: boxedTrue, - DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "s3-control.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-east-1-fips": endpoint{ - Hostname: "s3-control-fips.us-gov-east-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "s3-control.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1-fips": endpoint{ - Hostname: "s3-control-fips.us-gov-west-1.amazonaws.com", - SignatureVersions: []string{"s3v4"}, - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "secretsmanager": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "secretsmanager-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "secretsmanager-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "securityhub": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "securityhub-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "securityhub-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "serverlessrepo": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "serverlessrepo.us-gov-east-1.amazonaws.com", - Protocols: []string{"https"}, - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "serverlessrepo.us-gov-west-1.amazonaws.com", - Protocols: []string{"https"}, - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "servicecatalog": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "servicecatalog-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "servicecatalog-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "sms": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "sms-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "sms-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "snowball-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "snowball-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "sns": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "sns.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "sns.us-gov-west-1.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "sqs": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "sqs.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "sqs.us-gov-west-1.amazonaws.com", - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "ssm.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "ssm.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "ssm-facade-fips-us-gov-east-1": endpoint{ - Hostname: "ssm-facade.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "ssm-facade-fips-us-gov-west-1": endpoint{ - Hostname: "ssm-facade.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "states-fips.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "states.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "storagegateway": service{ - - Endpoints: endpoints{ - "fips": endpoint{ - Hostname: "storagegateway-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "sts.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "sts.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "support": service{ - PartitionEndpoint: "aws-us-gov-global", - - Endpoints: endpoints{ - "aws-us-gov-global": endpoint{ - Hostname: "support.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "support.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "swf.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "swf.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "tagging": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "transcribe": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "fips.transcribe.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "fips.transcribe.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "translate": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "translate-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "waf-regional": service{ - - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "waf-regional-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "waf-regional.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "workspaces": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "xray": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - }, -} - -// AwsIsoPartition returns the Resolver for AWS ISO (US). -func AwsIsoPartition() Partition { - return awsisoPartition.Partition() -} - -var awsisoPartition = partition{ - ID: "aws-iso", - Name: "AWS ISO (US)", - DNSSuffix: "c2s.ic.gov", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^us\\-iso\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-iso-east-1": region{ - Description: "US ISO East", - }, - }, - Services: services{ - "api.ecr": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Hostname: "api.ecr.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "api.sagemaker": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "apigateway": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "application-autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "autoscaling": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "comprehend": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "datapipeline": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "dms-fips": endpoint{ - Hostname: "dms.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - "us-iso-east-1": endpoint{}, - }, - }, - "ds": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "dynamodb": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "ec2": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "elasticmapreduce": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "es": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "glacier": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-iso-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-iso-global": endpoint{ - Hostname: "iam.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "ProdFips": endpoint{ - Hostname: "kms-fips.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - "us-iso-east-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "monitoring": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "route53": service{ - PartitionEndpoint: "aws-iso-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-iso-global": endpoint{ - Hostname: "route53.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "runtime.sagemaker": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - SignatureVersions: []string{"s3v4"}, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - }, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "sns": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "sqs": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "support": service{ - PartitionEndpoint: "aws-iso-global", - - Endpoints: endpoints{ - "aws-iso-global": endpoint{ - Hostname: "support.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "workspaces": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - }, -} - -// AwsIsoBPartition returns the Resolver for AWS ISOB (US). -func AwsIsoBPartition() Partition { - return awsisobPartition.Partition() -} - -var awsisobPartition = partition{ - ID: "aws-iso-b", - Name: "AWS ISOB (US)", - DNSSuffix: "sc2s.sgov.gov", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^us\\-isob\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-isob-east-1": region{ - Description: "US ISOB East (Ohio)", - }, - }, - Services: services{ - "application-autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "dms-fips": endpoint{ - Hostname: "dms.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - "us-isob-east-1": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "elasticmapreduce": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "glacier": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-iso-b-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-iso-b-global": endpoint{ - Hostname: "iam.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "ProdFips": endpoint{ - Hostname: "kms-fips.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - "us-isob-east-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "license-manager": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "monitoring": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "support": service{ - PartitionEndpoint: "aws-iso-b-global", - - Endpoints: endpoints{ - "aws-iso-b-global": endpoint{ - Hostname: "support.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go deleted file mode 100644 index ca8fc828e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go +++ /dev/null @@ -1,141 +0,0 @@ -package endpoints - -// Service identifiers -// -// Deprecated: Use client package's EndpointsID value instead of these -// ServiceIDs. These IDs are not maintained, and are out of date. -const ( - A4bServiceID = "a4b" // A4b. - AcmServiceID = "acm" // Acm. - AcmPcaServiceID = "acm-pca" // AcmPca. - ApiMediatailorServiceID = "api.mediatailor" // ApiMediatailor. - ApiPricingServiceID = "api.pricing" // ApiPricing. - ApiSagemakerServiceID = "api.sagemaker" // ApiSagemaker. - ApigatewayServiceID = "apigateway" // Apigateway. - ApplicationAutoscalingServiceID = "application-autoscaling" // ApplicationAutoscaling. - Appstream2ServiceID = "appstream2" // Appstream2. - AppsyncServiceID = "appsync" // Appsync. - AthenaServiceID = "athena" // Athena. - AutoscalingServiceID = "autoscaling" // Autoscaling. - AutoscalingPlansServiceID = "autoscaling-plans" // AutoscalingPlans. - BatchServiceID = "batch" // Batch. - BudgetsServiceID = "budgets" // Budgets. - CeServiceID = "ce" // Ce. - ChimeServiceID = "chime" // Chime. - Cloud9ServiceID = "cloud9" // Cloud9. - ClouddirectoryServiceID = "clouddirectory" // Clouddirectory. - CloudformationServiceID = "cloudformation" // Cloudformation. - CloudfrontServiceID = "cloudfront" // Cloudfront. - CloudhsmServiceID = "cloudhsm" // Cloudhsm. - Cloudhsmv2ServiceID = "cloudhsmv2" // Cloudhsmv2. - CloudsearchServiceID = "cloudsearch" // Cloudsearch. - CloudtrailServiceID = "cloudtrail" // Cloudtrail. - CodebuildServiceID = "codebuild" // Codebuild. - CodecommitServiceID = "codecommit" // Codecommit. - CodedeployServiceID = "codedeploy" // Codedeploy. - CodepipelineServiceID = "codepipeline" // Codepipeline. - CodestarServiceID = "codestar" // Codestar. - CognitoIdentityServiceID = "cognito-identity" // CognitoIdentity. - CognitoIdpServiceID = "cognito-idp" // CognitoIdp. - CognitoSyncServiceID = "cognito-sync" // CognitoSync. - ComprehendServiceID = "comprehend" // Comprehend. - ConfigServiceID = "config" // Config. - CurServiceID = "cur" // Cur. - DatapipelineServiceID = "datapipeline" // Datapipeline. - DaxServiceID = "dax" // Dax. - DevicefarmServiceID = "devicefarm" // Devicefarm. - DirectconnectServiceID = "directconnect" // Directconnect. - DiscoveryServiceID = "discovery" // Discovery. - DmsServiceID = "dms" // Dms. - DsServiceID = "ds" // Ds. - DynamodbServiceID = "dynamodb" // Dynamodb. - Ec2ServiceID = "ec2" // Ec2. - Ec2metadataServiceID = "ec2metadata" // Ec2metadata. - EcrServiceID = "ecr" // Ecr. - EcsServiceID = "ecs" // Ecs. - ElasticacheServiceID = "elasticache" // Elasticache. - ElasticbeanstalkServiceID = "elasticbeanstalk" // Elasticbeanstalk. - ElasticfilesystemServiceID = "elasticfilesystem" // Elasticfilesystem. - ElasticloadbalancingServiceID = "elasticloadbalancing" // Elasticloadbalancing. - ElasticmapreduceServiceID = "elasticmapreduce" // Elasticmapreduce. - ElastictranscoderServiceID = "elastictranscoder" // Elastictranscoder. - EmailServiceID = "email" // Email. - EntitlementMarketplaceServiceID = "entitlement.marketplace" // EntitlementMarketplace. - EsServiceID = "es" // Es. - EventsServiceID = "events" // Events. - FirehoseServiceID = "firehose" // Firehose. - FmsServiceID = "fms" // Fms. - GameliftServiceID = "gamelift" // Gamelift. - GlacierServiceID = "glacier" // Glacier. - GlueServiceID = "glue" // Glue. - GreengrassServiceID = "greengrass" // Greengrass. - GuarddutyServiceID = "guardduty" // Guardduty. - HealthServiceID = "health" // Health. - IamServiceID = "iam" // Iam. - ImportexportServiceID = "importexport" // Importexport. - InspectorServiceID = "inspector" // Inspector. - IotServiceID = "iot" // Iot. - IotanalyticsServiceID = "iotanalytics" // Iotanalytics. - KinesisServiceID = "kinesis" // Kinesis. - KinesisanalyticsServiceID = "kinesisanalytics" // Kinesisanalytics. - KinesisvideoServiceID = "kinesisvideo" // Kinesisvideo. - KmsServiceID = "kms" // Kms. - LambdaServiceID = "lambda" // Lambda. - LightsailServiceID = "lightsail" // Lightsail. - LogsServiceID = "logs" // Logs. - MachinelearningServiceID = "machinelearning" // Machinelearning. - MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. - MediaconvertServiceID = "mediaconvert" // Mediaconvert. - MedialiveServiceID = "medialive" // Medialive. - MediapackageServiceID = "mediapackage" // Mediapackage. - MediastoreServiceID = "mediastore" // Mediastore. - MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. - MghServiceID = "mgh" // Mgh. - MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. - ModelsLexServiceID = "models.lex" // ModelsLex. - MonitoringServiceID = "monitoring" // Monitoring. - MturkRequesterServiceID = "mturk-requester" // MturkRequester. - NeptuneServiceID = "neptune" // Neptune. - OpsworksServiceID = "opsworks" // Opsworks. - OpsworksCmServiceID = "opsworks-cm" // OpsworksCm. - OrganizationsServiceID = "organizations" // Organizations. - PinpointServiceID = "pinpoint" // Pinpoint. - PollyServiceID = "polly" // Polly. - RdsServiceID = "rds" // Rds. - RedshiftServiceID = "redshift" // Redshift. - RekognitionServiceID = "rekognition" // Rekognition. - ResourceGroupsServiceID = "resource-groups" // ResourceGroups. - Route53ServiceID = "route53" // Route53. - Route53domainsServiceID = "route53domains" // Route53domains. - RuntimeLexServiceID = "runtime.lex" // RuntimeLex. - RuntimeSagemakerServiceID = "runtime.sagemaker" // RuntimeSagemaker. - S3ServiceID = "s3" // S3. - S3ControlServiceID = "s3-control" // S3Control. - SagemakerServiceID = "api.sagemaker" // Sagemaker. - SdbServiceID = "sdb" // Sdb. - SecretsmanagerServiceID = "secretsmanager" // Secretsmanager. - ServerlessrepoServiceID = "serverlessrepo" // Serverlessrepo. - ServicecatalogServiceID = "servicecatalog" // Servicecatalog. - ServicediscoveryServiceID = "servicediscovery" // Servicediscovery. - ShieldServiceID = "shield" // Shield. - SmsServiceID = "sms" // Sms. - SnowballServiceID = "snowball" // Snowball. - SnsServiceID = "sns" // Sns. - SqsServiceID = "sqs" // Sqs. - SsmServiceID = "ssm" // Ssm. - StatesServiceID = "states" // States. - StoragegatewayServiceID = "storagegateway" // Storagegateway. - StreamsDynamodbServiceID = "streams.dynamodb" // StreamsDynamodb. - StsServiceID = "sts" // Sts. - SupportServiceID = "support" // Support. - SwfServiceID = "swf" // Swf. - TaggingServiceID = "tagging" // Tagging. - TransferServiceID = "transfer" // Transfer. - TranslateServiceID = "translate" // Translate. - WafServiceID = "waf" // Waf. - WafRegionalServiceID = "waf-regional" // WafRegional. - WorkdocsServiceID = "workdocs" // Workdocs. - WorkmailServiceID = "workmail" // Workmail. - WorkspacesServiceID = "workspaces" // Workspaces. - XrayServiceID = "xray" // Xray. -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go deleted file mode 100644 index 84316b92c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go +++ /dev/null @@ -1,66 +0,0 @@ -// Package endpoints provides the types and functionality for defining regions -// and endpoints, as well as querying those definitions. -// -// The SDK's Regions and Endpoints metadata is code generated into the endpoints -// package, and is accessible via the DefaultResolver function. This function -// returns a endpoint Resolver will search the metadata and build an associated -// endpoint if one is found. The default resolver will search all partitions -// known by the SDK. e.g AWS Standard (aws), AWS China (aws-cn), and -// AWS GovCloud (US) (aws-us-gov). -// . -// -// Enumerating Regions and Endpoint Metadata -// -// Casting the Resolver returned by DefaultResolver to a EnumPartitions interface -// will allow you to get access to the list of underlying Partitions with the -// Partitions method. This is helpful if you want to limit the SDK's endpoint -// resolving to a single partition, or enumerate regions, services, and endpoints -// in the partition. -// -// resolver := endpoints.DefaultResolver() -// partitions := resolver.(endpoints.EnumPartitions).Partitions() -// -// for _, p := range partitions { -// fmt.Println("Regions for", p.ID()) -// for id, _ := range p.Regions() { -// fmt.Println("*", id) -// } -// -// fmt.Println("Services for", p.ID()) -// for id, _ := range p.Services() { -// fmt.Println("*", id) -// } -// } -// -// Using Custom Endpoints -// -// The endpoints package also gives you the ability to use your own logic how -// endpoints are resolved. This is a great way to define a custom endpoint -// for select services, without passing that logic down through your code. -// -// If a type implements the Resolver interface it can be used to resolve -// endpoints. To use this with the SDK's Session and Config set the value -// of the type to the EndpointsResolver field of aws.Config when initializing -// the session, or service client. -// -// In addition the ResolverFunc is a wrapper for a func matching the signature -// of Resolver.EndpointFor, converting it to a type that satisfies the -// Resolver interface. -// -// -// myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { -// if service == endpoints.S3ServiceID { -// return endpoints.ResolvedEndpoint{ -// URL: "s3.custom.endpoint.com", -// SigningRegion: "custom-signing-region", -// }, nil -// } -// -// return endpoints.DefaultResolver().EndpointFor(service, region, optFns...) -// } -// -// sess := session.Must(session.NewSession(&aws.Config{ -// Region: aws.String("us-west-2"), -// EndpointResolver: endpoints.ResolverFunc(myCustomResolver), -// })) -package endpoints diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go deleted file mode 100644 index ca956e5f1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ /dev/null @@ -1,564 +0,0 @@ -package endpoints - -import ( - "fmt" - "regexp" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// Options provide the configuration needed to direct how the -// endpoints will be resolved. -type Options struct { - // DisableSSL forces the endpoint to be resolved as HTTP. - // instead of HTTPS if the service supports it. - DisableSSL bool - - // Sets the resolver to resolve the endpoint as a dualstack endpoint - // for the service. If dualstack support for a service is not known and - // StrictMatching is not enabled a dualstack endpoint for the service will - // be returned. This endpoint may not be valid. If StrictMatching is - // enabled only services that are known to support dualstack will return - // dualstack endpoints. - UseDualStack bool - - // Enables strict matching of services and regions resolved endpoints. - // If the partition doesn't enumerate the exact service and region an - // error will be returned. This option will prevent returning endpoints - // that look valid, but may not resolve to any real endpoint. - StrictMatching bool - - // Enables resolving a service endpoint based on the region provided if the - // service does not exist. The service endpoint ID will be used as the service - // domain name prefix. By default the endpoint resolver requires the service - // to be known when resolving endpoints. - // - // If resolving an endpoint on the partition list the provided region will - // be used to determine which partition's domain name pattern to the service - // endpoint ID with. If both the service and region are unknown and resolving - // the endpoint on partition list an UnknownEndpointError error will be returned. - // - // If resolving and endpoint on a partition specific resolver that partition's - // domain name pattern will be used with the service endpoint ID. If both - // region and service do not exist when resolving an endpoint on a specific - // partition the partition's domain pattern will be used to combine the - // endpoint and region together. - // - // This option is ignored if StrictMatching is enabled. - ResolveUnknownService bool - - // STS Regional Endpoint flag helps with resolving the STS endpoint - STSRegionalEndpoint STSRegionalEndpoint - - // S3 Regional Endpoint flag helps with resolving the S3 endpoint - S3UsEast1RegionalEndpoint S3UsEast1RegionalEndpoint -} - -// STSRegionalEndpoint is an enum for the states of the STS Regional Endpoint -// options. -type STSRegionalEndpoint int - -func (e STSRegionalEndpoint) String() string { - switch e { - case LegacySTSEndpoint: - return "legacy" - case RegionalSTSEndpoint: - return "regional" - case UnsetSTSEndpoint: - return "" - default: - return "unknown" - } -} - -const ( - - // UnsetSTSEndpoint represents that STS Regional Endpoint flag is not specified. - UnsetSTSEndpoint STSRegionalEndpoint = iota - - // LegacySTSEndpoint represents when STS Regional Endpoint flag is specified - // to use legacy endpoints. - LegacySTSEndpoint - - // RegionalSTSEndpoint represents when STS Regional Endpoint flag is specified - // to use regional endpoints. - RegionalSTSEndpoint -) - -// GetSTSRegionalEndpoint function returns the STSRegionalEndpointFlag based -// on the input string provided in env config or shared config by the user. -// -// `legacy`, `regional` are the only case-insensitive valid strings for -// resolving the STS regional Endpoint flag. -func GetSTSRegionalEndpoint(s string) (STSRegionalEndpoint, error) { - switch { - case strings.EqualFold(s, "legacy"): - return LegacySTSEndpoint, nil - case strings.EqualFold(s, "regional"): - return RegionalSTSEndpoint, nil - default: - return UnsetSTSEndpoint, fmt.Errorf("unable to resolve the value of STSRegionalEndpoint for %v", s) - } -} - -// S3UsEast1RegionalEndpoint is an enum for the states of the S3 us-east-1 -// Regional Endpoint options. -type S3UsEast1RegionalEndpoint int - -func (e S3UsEast1RegionalEndpoint) String() string { - switch e { - case LegacyS3UsEast1Endpoint: - return "legacy" - case RegionalS3UsEast1Endpoint: - return "regional" - case UnsetS3UsEast1Endpoint: - return "" - default: - return "unknown" - } -} - -const ( - - // UnsetS3UsEast1Endpoint represents that S3 Regional Endpoint flag is not - // specified. - UnsetS3UsEast1Endpoint S3UsEast1RegionalEndpoint = iota - - // LegacyS3UsEast1Endpoint represents when S3 Regional Endpoint flag is - // specified to use legacy endpoints. - LegacyS3UsEast1Endpoint - - // RegionalS3UsEast1Endpoint represents when S3 Regional Endpoint flag is - // specified to use regional endpoints. - RegionalS3UsEast1Endpoint -) - -// GetS3UsEast1RegionalEndpoint function returns the S3UsEast1RegionalEndpointFlag based -// on the input string provided in env config or shared config by the user. -// -// `legacy`, `regional` are the only case-insensitive valid strings for -// resolving the S3 regional Endpoint flag. -func GetS3UsEast1RegionalEndpoint(s string) (S3UsEast1RegionalEndpoint, error) { - switch { - case strings.EqualFold(s, "legacy"): - return LegacyS3UsEast1Endpoint, nil - case strings.EqualFold(s, "regional"): - return RegionalS3UsEast1Endpoint, nil - default: - return UnsetS3UsEast1Endpoint, - fmt.Errorf("unable to resolve the value of S3UsEast1RegionalEndpoint for %v", s) - } -} - -// Set combines all of the option functions together. -func (o *Options) Set(optFns ...func(*Options)) { - for _, fn := range optFns { - fn(o) - } -} - -// DisableSSLOption sets the DisableSSL options. Can be used as a functional -// option when resolving endpoints. -func DisableSSLOption(o *Options) { - o.DisableSSL = true -} - -// UseDualStackOption sets the UseDualStack option. Can be used as a functional -// option when resolving endpoints. -func UseDualStackOption(o *Options) { - o.UseDualStack = true -} - -// StrictMatchingOption sets the StrictMatching option. Can be used as a functional -// option when resolving endpoints. -func StrictMatchingOption(o *Options) { - o.StrictMatching = true -} - -// ResolveUnknownServiceOption sets the ResolveUnknownService option. Can be used -// as a functional option when resolving endpoints. -func ResolveUnknownServiceOption(o *Options) { - o.ResolveUnknownService = true -} - -// STSRegionalEndpointOption enables the STS endpoint resolver behavior to resolve -// STS endpoint to their regional endpoint, instead of the global endpoint. -func STSRegionalEndpointOption(o *Options) { - o.STSRegionalEndpoint = RegionalSTSEndpoint -} - -// A Resolver provides the interface for functionality to resolve endpoints. -// The build in Partition and DefaultResolver return value satisfy this interface. -type Resolver interface { - EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) -} - -// ResolverFunc is a helper utility that wraps a function so it satisfies the -// Resolver interface. This is useful when you want to add additional endpoint -// resolving logic, or stub out specific endpoints with custom values. -type ResolverFunc func(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) - -// EndpointFor wraps the ResolverFunc function to satisfy the Resolver interface. -func (fn ResolverFunc) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return fn(service, region, opts...) -} - -var schemeRE = regexp.MustCompile("^([^:]+)://") - -// AddScheme adds the HTTP or HTTPS schemes to a endpoint URL if there is no -// scheme. If disableSSL is true HTTP will set HTTP instead of the default HTTPS. -// -// If disableSSL is set, it will only set the URL's scheme if the URL does not -// contain a scheme. -func AddScheme(endpoint string, disableSSL bool) string { - if !schemeRE.MatchString(endpoint) { - scheme := "https" - if disableSSL { - scheme = "http" - } - endpoint = fmt.Sprintf("%s://%s", scheme, endpoint) - } - - return endpoint -} - -// EnumPartitions a provides a way to retrieve the underlying partitions that -// make up the SDK's default Resolver, or any resolver decoded from a model -// file. -// -// Use this interface with DefaultResolver and DecodeModels to get the list of -// Partitions. -type EnumPartitions interface { - Partitions() []Partition -} - -// RegionsForService returns a map of regions for the partition and service. -// If either the partition or service does not exist false will be returned -// as the second parameter. -// -// This example shows how to get the regions for DynamoDB in the AWS partition. -// rs, exists := endpoints.RegionsForService(endpoints.DefaultPartitions(), endpoints.AwsPartitionID, endpoints.DynamodbServiceID) -// -// This is equivalent to using the partition directly. -// rs := endpoints.AwsPartition().Services()[endpoints.DynamodbServiceID].Regions() -func RegionsForService(ps []Partition, partitionID, serviceID string) (map[string]Region, bool) { - for _, p := range ps { - if p.ID() != partitionID { - continue - } - if _, ok := p.p.Services[serviceID]; !ok { - break - } - - s := Service{ - id: serviceID, - p: p.p, - } - return s.Regions(), true - } - - return map[string]Region{}, false -} - -// PartitionForRegion returns the first partition which includes the region -// passed in. This includes both known regions and regions which match -// a pattern supported by the partition which may include regions that are -// not explicitly known by the partition. Use the Regions method of the -// returned Partition if explicit support is needed. -func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { - for _, p := range ps { - if _, ok := p.p.Regions[regionID]; ok || p.p.RegionRegex.MatchString(regionID) { - return p, true - } - } - - return Partition{}, false -} - -// A Partition provides the ability to enumerate the partition's regions -// and services. -type Partition struct { - id, dnsSuffix string - p *partition -} - -// DNSSuffix returns the base domain name of the partition. -func (p Partition) DNSSuffix() string { return p.dnsSuffix } - -// ID returns the identifier of the partition. -func (p Partition) ID() string { return p.id } - -// EndpointFor attempts to resolve the endpoint based on service and region. -// See Options for information on configuring how the endpoint is resolved. -// -// If the service cannot be found in the metadata the UnknownServiceError -// error will be returned. This validation will occur regardless if -// StrictMatching is enabled. To enable resolving unknown services set the -// "ResolveUnknownService" option to true. When StrictMatching is disabled -// this option allows the partition resolver to resolve a endpoint based on -// the service endpoint ID provided. -// -// When resolving endpoints you can choose to enable StrictMatching. This will -// require the provided service and region to be known by the partition. -// If the endpoint cannot be strictly resolved an error will be returned. This -// mode is useful to ensure the endpoint resolved is valid. Without -// StrictMatching enabled the endpoint returned may look valid but may not work. -// StrictMatching requires the SDK to be updated if you want to take advantage -// of new regions and services expansions. -// -// Errors that can be returned. -// * UnknownServiceError -// * UnknownEndpointError -func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return p.p.EndpointFor(service, region, opts...) -} - -// Regions returns a map of Regions indexed by their ID. This is useful for -// enumerating over the regions in a partition. -func (p Partition) Regions() map[string]Region { - rs := make(map[string]Region, len(p.p.Regions)) - for id, r := range p.p.Regions { - rs[id] = Region{ - id: id, - desc: r.Description, - p: p.p, - } - } - - return rs -} - -// Services returns a map of Service indexed by their ID. This is useful for -// enumerating over the services in a partition. -func (p Partition) Services() map[string]Service { - ss := make(map[string]Service, len(p.p.Services)) - for id := range p.p.Services { - ss[id] = Service{ - id: id, - p: p.p, - } - } - - return ss -} - -// A Region provides information about a region, and ability to resolve an -// endpoint from the context of a region, given a service. -type Region struct { - id, desc string - p *partition -} - -// ID returns the region's identifier. -func (r Region) ID() string { return r.id } - -// Description returns the region's description. The region description -// is free text, it can be empty, and it may change between SDK releases. -func (r Region) Description() string { return r.desc } - -// ResolveEndpoint resolves an endpoint from the context of the region given -// a service. See Partition.EndpointFor for usage and errors that can be returned. -func (r Region) ResolveEndpoint(service string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return r.p.EndpointFor(service, r.id, opts...) -} - -// Services returns a list of all services that are known to be in this region. -func (r Region) Services() map[string]Service { - ss := map[string]Service{} - for id, s := range r.p.Services { - if _, ok := s.Endpoints[r.id]; ok { - ss[id] = Service{ - id: id, - p: r.p, - } - } - } - - return ss -} - -// A Service provides information about a service, and ability to resolve an -// endpoint from the context of a service, given a region. -type Service struct { - id string - p *partition -} - -// ID returns the identifier for the service. -func (s Service) ID() string { return s.id } - -// ResolveEndpoint resolves an endpoint from the context of a service given -// a region. See Partition.EndpointFor for usage and errors that can be returned. -func (s Service) ResolveEndpoint(region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - return s.p.EndpointFor(s.id, region, opts...) -} - -// Regions returns a map of Regions that the service is present in. -// -// A region is the AWS region the service exists in. Whereas a Endpoint is -// an URL that can be resolved to a instance of a service. -func (s Service) Regions() map[string]Region { - rs := map[string]Region{} - for id := range s.p.Services[s.id].Endpoints { - if r, ok := s.p.Regions[id]; ok { - rs[id] = Region{ - id: id, - desc: r.Description, - p: s.p, - } - } - } - - return rs -} - -// Endpoints returns a map of Endpoints indexed by their ID for all known -// endpoints for a service. -// -// A region is the AWS region the service exists in. Whereas a Endpoint is -// an URL that can be resolved to a instance of a service. -func (s Service) Endpoints() map[string]Endpoint { - es := make(map[string]Endpoint, len(s.p.Services[s.id].Endpoints)) - for id := range s.p.Services[s.id].Endpoints { - es[id] = Endpoint{ - id: id, - serviceID: s.id, - p: s.p, - } - } - - return es -} - -// A Endpoint provides information about endpoints, and provides the ability -// to resolve that endpoint for the service, and the region the endpoint -// represents. -type Endpoint struct { - id string - serviceID string - p *partition -} - -// ID returns the identifier for an endpoint. -func (e Endpoint) ID() string { return e.id } - -// ServiceID returns the identifier the endpoint belongs to. -func (e Endpoint) ServiceID() string { return e.serviceID } - -// ResolveEndpoint resolves an endpoint from the context of a service and -// region the endpoint represents. See Partition.EndpointFor for usage and -// errors that can be returned. -func (e Endpoint) ResolveEndpoint(opts ...func(*Options)) (ResolvedEndpoint, error) { - return e.p.EndpointFor(e.serviceID, e.id, opts...) -} - -// A ResolvedEndpoint is an endpoint that has been resolved based on a partition -// service, and region. -type ResolvedEndpoint struct { - // The endpoint URL - URL string - - // The endpoint partition - PartitionID string - - // The region that should be used for signing requests. - SigningRegion string - - // The service name that should be used for signing requests. - SigningName string - - // States that the signing name for this endpoint was derived from metadata - // passed in, but was not explicitly modeled. - SigningNameDerived bool - - // The signing method that should be used for signing requests. - SigningMethod string -} - -// So that the Error interface type can be included as an anonymous field -// in the requestError struct and not conflict with the error.Error() method. -type awsError awserr.Error - -// A EndpointNotFoundError is returned when in StrictMatching mode, and the -// endpoint for the service and region cannot be found in any of the partitions. -type EndpointNotFoundError struct { - awsError - Partition string - Service string - Region string -} - -// A UnknownServiceError is returned when the service does not resolve to an -// endpoint. Includes a list of all known services for the partition. Returned -// when a partition does not support the service. -type UnknownServiceError struct { - awsError - Partition string - Service string - Known []string -} - -// NewUnknownServiceError builds and returns UnknownServiceError. -func NewUnknownServiceError(p, s string, known []string) UnknownServiceError { - return UnknownServiceError{ - awsError: awserr.New("UnknownServiceError", - "could not resolve endpoint for unknown service", nil), - Partition: p, - Service: s, - Known: known, - } -} - -// String returns the string representation of the error. -func (e UnknownServiceError) Error() string { - extra := fmt.Sprintf("partition: %q, service: %q", - e.Partition, e.Service) - if len(e.Known) > 0 { - extra += fmt.Sprintf(", known: %v", e.Known) - } - return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -} - -// String returns the string representation of the error. -func (e UnknownServiceError) String() string { - return e.Error() -} - -// A UnknownEndpointError is returned when in StrictMatching mode and the -// service is valid, but the region does not resolve to an endpoint. Includes -// a list of all known endpoints for the service. -type UnknownEndpointError struct { - awsError - Partition string - Service string - Region string - Known []string -} - -// NewUnknownEndpointError builds and returns UnknownEndpointError. -func NewUnknownEndpointError(p, s, r string, known []string) UnknownEndpointError { - return UnknownEndpointError{ - awsError: awserr.New("UnknownEndpointError", - "could not resolve endpoint", nil), - Partition: p, - Service: s, - Region: r, - Known: known, - } -} - -// String returns the string representation of the error. -func (e UnknownEndpointError) Error() string { - extra := fmt.Sprintf("partition: %q, service: %q, region: %q", - e.Partition, e.Service, e.Region) - if len(e.Known) > 0 { - extra += fmt.Sprintf(", known: %v", e.Known) - } - return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) -} - -// String returns the string representation of the error. -func (e UnknownEndpointError) String() string { - return e.Error() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go deleted file mode 100644 index df75e899a..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go +++ /dev/null @@ -1,24 +0,0 @@ -package endpoints - -var legacyGlobalRegions = map[string]map[string]struct{}{ - "sts": { - "ap-northeast-1": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-north-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "eu-west-3": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {}, - }, - "s3": { - "us-east-1": {}, - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go deleted file mode 100644 index 773613722..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go +++ /dev/null @@ -1,351 +0,0 @@ -package endpoints - -import ( - "fmt" - "regexp" - "strconv" - "strings" -) - -var regionValidationRegex = regexp.MustCompile(`^[[:alnum:]]([[:alnum:]\-]*[[:alnum:]])?$`) - -type partitions []partition - -func (ps partitions) EndpointFor(service, region string, opts ...func(*Options)) (ResolvedEndpoint, error) { - var opt Options - opt.Set(opts...) - - for i := 0; i < len(ps); i++ { - if !ps[i].canResolveEndpoint(service, region, opt.StrictMatching) { - continue - } - - return ps[i].EndpointFor(service, region, opts...) - } - - // If loose matching fallback to first partition format to use - // when resolving the endpoint. - if !opt.StrictMatching && len(ps) > 0 { - return ps[0].EndpointFor(service, region, opts...) - } - - return ResolvedEndpoint{}, NewUnknownEndpointError("all partitions", service, region, []string{}) -} - -// Partitions satisfies the EnumPartitions interface and returns a list -// of Partitions representing each partition represented in the SDK's -// endpoints model. -func (ps partitions) Partitions() []Partition { - parts := make([]Partition, 0, len(ps)) - for i := 0; i < len(ps); i++ { - parts = append(parts, ps[i].Partition()) - } - - return parts -} - -type partition struct { - ID string `json:"partition"` - Name string `json:"partitionName"` - DNSSuffix string `json:"dnsSuffix"` - RegionRegex regionRegex `json:"regionRegex"` - Defaults endpoint `json:"defaults"` - Regions regions `json:"regions"` - Services services `json:"services"` -} - -func (p partition) Partition() Partition { - return Partition{ - dnsSuffix: p.DNSSuffix, - id: p.ID, - p: &p, - } -} - -func (p partition) canResolveEndpoint(service, region string, strictMatch bool) bool { - s, hasService := p.Services[service] - _, hasEndpoint := s.Endpoints[region] - - if hasEndpoint && hasService { - return true - } - - if strictMatch { - return false - } - - return p.RegionRegex.MatchString(region) -} - -func allowLegacyEmptyRegion(service string) bool { - legacy := map[string]struct{}{ - "budgets": {}, - "ce": {}, - "chime": {}, - "cloudfront": {}, - "ec2metadata": {}, - "iam": {}, - "importexport": {}, - "organizations": {}, - "route53": {}, - "sts": {}, - "support": {}, - "waf": {}, - } - - _, allowed := legacy[service] - return allowed -} - -func (p partition) EndpointFor(service, region string, opts ...func(*Options)) (resolved ResolvedEndpoint, err error) { - var opt Options - opt.Set(opts...) - - s, hasService := p.Services[service] - if len(service) == 0 || !(hasService || opt.ResolveUnknownService) { - // Only return error if the resolver will not fallback to creating - // endpoint based on service endpoint ID passed in. - return resolved, NewUnknownServiceError(p.ID, service, serviceList(p.Services)) - } - - if len(region) == 0 && allowLegacyEmptyRegion(service) && len(s.PartitionEndpoint) != 0 { - region = s.PartitionEndpoint - } - - if (service == "sts" && opt.STSRegionalEndpoint != RegionalSTSEndpoint) || - (service == "s3" && opt.S3UsEast1RegionalEndpoint != RegionalS3UsEast1Endpoint) { - if _, ok := legacyGlobalRegions[service][region]; ok { - region = "aws-global" - } - } - - e, hasEndpoint := s.endpointForRegion(region) - if len(region) == 0 || (!hasEndpoint && opt.StrictMatching) { - return resolved, NewUnknownEndpointError(p.ID, service, region, endpointList(s.Endpoints)) - } - - defs := []endpoint{p.Defaults, s.Defaults} - - return e.resolve(service, p.ID, region, p.DNSSuffix, defs, opt) -} - -func serviceList(ss services) []string { - list := make([]string, 0, len(ss)) - for k := range ss { - list = append(list, k) - } - return list -} -func endpointList(es endpoints) []string { - list := make([]string, 0, len(es)) - for k := range es { - list = append(list, k) - } - return list -} - -type regionRegex struct { - *regexp.Regexp -} - -func (rr *regionRegex) UnmarshalJSON(b []byte) (err error) { - // Strip leading and trailing quotes - regex, err := strconv.Unquote(string(b)) - if err != nil { - return fmt.Errorf("unable to strip quotes from regex, %v", err) - } - - rr.Regexp, err = regexp.Compile(regex) - if err != nil { - return fmt.Errorf("unable to unmarshal region regex, %v", err) - } - return nil -} - -type regions map[string]region - -type region struct { - Description string `json:"description"` -} - -type services map[string]service - -type service struct { - PartitionEndpoint string `json:"partitionEndpoint"` - IsRegionalized boxedBool `json:"isRegionalized,omitempty"` - Defaults endpoint `json:"defaults"` - Endpoints endpoints `json:"endpoints"` -} - -func (s *service) endpointForRegion(region string) (endpoint, bool) { - if s.IsRegionalized == boxedFalse { - return s.Endpoints[s.PartitionEndpoint], region == s.PartitionEndpoint - } - - if e, ok := s.Endpoints[region]; ok { - return e, true - } - - // Unable to find any matching endpoint, return - // blank that will be used for generic endpoint creation. - return endpoint{}, false -} - -type endpoints map[string]endpoint - -type endpoint struct { - Hostname string `json:"hostname"` - Protocols []string `json:"protocols"` - CredentialScope credentialScope `json:"credentialScope"` - - // Custom fields not modeled - HasDualStack boxedBool `json:"-"` - DualStackHostname string `json:"-"` - - // Signature Version not used - SignatureVersions []string `json:"signatureVersions"` - - // SSLCommonName not used. - SSLCommonName string `json:"sslCommonName"` -} - -const ( - defaultProtocol = "https" - defaultSigner = "v4" -) - -var ( - protocolPriority = []string{"https", "http"} - signerPriority = []string{"v4", "v2"} -) - -func getByPriority(s []string, p []string, def string) string { - if len(s) == 0 { - return def - } - - for i := 0; i < len(p); i++ { - for j := 0; j < len(s); j++ { - if s[j] == p[i] { - return s[j] - } - } - } - - return s[0] -} - -func (e endpoint) resolve(service, partitionID, region, dnsSuffix string, defs []endpoint, opts Options) (ResolvedEndpoint, error) { - var merged endpoint - for _, def := range defs { - merged.mergeIn(def) - } - merged.mergeIn(e) - e = merged - - signingRegion := e.CredentialScope.Region - if len(signingRegion) == 0 { - signingRegion = region - } - - signingName := e.CredentialScope.Service - var signingNameDerived bool - if len(signingName) == 0 { - signingName = service - signingNameDerived = true - } - - hostname := e.Hostname - // Offset the hostname for dualstack if enabled - if opts.UseDualStack && e.HasDualStack == boxedTrue { - hostname = e.DualStackHostname - region = signingRegion - } - - if !validateInputRegion(region) { - return ResolvedEndpoint{}, fmt.Errorf("invalid region identifier format provided") - } - - u := strings.Replace(hostname, "{service}", service, 1) - u = strings.Replace(u, "{region}", region, 1) - u = strings.Replace(u, "{dnsSuffix}", dnsSuffix, 1) - - scheme := getEndpointScheme(e.Protocols, opts.DisableSSL) - u = fmt.Sprintf("%s://%s", scheme, u) - - return ResolvedEndpoint{ - URL: u, - PartitionID: partitionID, - SigningRegion: signingRegion, - SigningName: signingName, - SigningNameDerived: signingNameDerived, - SigningMethod: getByPriority(e.SignatureVersions, signerPriority, defaultSigner), - }, nil -} - -func getEndpointScheme(protocols []string, disableSSL bool) string { - if disableSSL { - return "http" - } - - return getByPriority(protocols, protocolPriority, defaultProtocol) -} - -func (e *endpoint) mergeIn(other endpoint) { - if len(other.Hostname) > 0 { - e.Hostname = other.Hostname - } - if len(other.Protocols) > 0 { - e.Protocols = other.Protocols - } - if len(other.SignatureVersions) > 0 { - e.SignatureVersions = other.SignatureVersions - } - if len(other.CredentialScope.Region) > 0 { - e.CredentialScope.Region = other.CredentialScope.Region - } - if len(other.CredentialScope.Service) > 0 { - e.CredentialScope.Service = other.CredentialScope.Service - } - if len(other.SSLCommonName) > 0 { - e.SSLCommonName = other.SSLCommonName - } - if other.HasDualStack != boxedBoolUnset { - e.HasDualStack = other.HasDualStack - } - if len(other.DualStackHostname) > 0 { - e.DualStackHostname = other.DualStackHostname - } -} - -type credentialScope struct { - Region string `json:"region"` - Service string `json:"service"` -} - -type boxedBool int - -func (b *boxedBool) UnmarshalJSON(buf []byte) error { - v, err := strconv.ParseBool(string(buf)) - if err != nil { - return err - } - - if v { - *b = boxedTrue - } else { - *b = boxedFalse - } - - return nil -} - -const ( - boxedBoolUnset boxedBool = iota - boxedFalse - boxedTrue -) - -func validateInputRegion(region string) bool { - return regionValidationRegex.MatchString(region) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go deleted file mode 100644 index 0fdfcc56e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go +++ /dev/null @@ -1,351 +0,0 @@ -// +build codegen - -package endpoints - -import ( - "fmt" - "io" - "reflect" - "strings" - "text/template" - "unicode" -) - -// A CodeGenOptions are the options for code generating the endpoints into -// Go code from the endpoints model definition. -type CodeGenOptions struct { - // Options for how the model will be decoded. - DecodeModelOptions DecodeModelOptions - - // Disables code generation of the service endpoint prefix IDs defined in - // the model. - DisableGenerateServiceIDs bool -} - -// Set combines all of the option functions together -func (d *CodeGenOptions) Set(optFns ...func(*CodeGenOptions)) { - for _, fn := range optFns { - fn(d) - } -} - -// CodeGenModel given a endpoints model file will decode it and attempt to -// generate Go code from the model definition. Error will be returned if -// the code is unable to be generated, or decoded. -func CodeGenModel(modelFile io.Reader, outFile io.Writer, optFns ...func(*CodeGenOptions)) error { - var opts CodeGenOptions - opts.Set(optFns...) - - resolver, err := DecodeModel(modelFile, func(d *DecodeModelOptions) { - *d = opts.DecodeModelOptions - }) - if err != nil { - return err - } - - v := struct { - Resolver - CodeGenOptions - }{ - Resolver: resolver, - CodeGenOptions: opts, - } - - tmpl := template.Must(template.New("tmpl").Funcs(funcMap).Parse(v3Tmpl)) - if err := tmpl.ExecuteTemplate(outFile, "defaults", v); err != nil { - return fmt.Errorf("failed to execute template, %v", err) - } - - return nil -} - -func toSymbol(v string) string { - out := []rune{} - for _, c := range strings.Title(v) { - if !(unicode.IsNumber(c) || unicode.IsLetter(c)) { - continue - } - - out = append(out, c) - } - - return string(out) -} - -func quoteString(v string) string { - return fmt.Sprintf("%q", v) -} - -func regionConstName(p, r string) string { - return toSymbol(p) + toSymbol(r) -} - -func partitionGetter(id string) string { - return fmt.Sprintf("%sPartition", toSymbol(id)) -} - -func partitionVarName(id string) string { - return fmt.Sprintf("%sPartition", strings.ToLower(toSymbol(id))) -} - -func listPartitionNames(ps partitions) string { - names := []string{} - switch len(ps) { - case 1: - return ps[0].Name - case 2: - return fmt.Sprintf("%s and %s", ps[0].Name, ps[1].Name) - default: - for i, p := range ps { - if i == len(ps)-1 { - names = append(names, "and "+p.Name) - } else { - names = append(names, p.Name) - } - } - return strings.Join(names, ", ") - } -} - -func boxedBoolIfSet(msg string, v boxedBool) string { - switch v { - case boxedTrue: - return fmt.Sprintf(msg, "boxedTrue") - case boxedFalse: - return fmt.Sprintf(msg, "boxedFalse") - default: - return "" - } -} - -func stringIfSet(msg, v string) string { - if len(v) == 0 { - return "" - } - - return fmt.Sprintf(msg, v) -} - -func stringSliceIfSet(msg string, vs []string) string { - if len(vs) == 0 { - return "" - } - - names := []string{} - for _, v := range vs { - names = append(names, `"`+v+`"`) - } - - return fmt.Sprintf(msg, strings.Join(names, ",")) -} - -func endpointIsSet(v endpoint) bool { - return !reflect.DeepEqual(v, endpoint{}) -} - -func serviceSet(ps partitions) map[string]struct{} { - set := map[string]struct{}{} - for _, p := range ps { - for id := range p.Services { - set[id] = struct{}{} - } - } - - return set -} - -var funcMap = template.FuncMap{ - "ToSymbol": toSymbol, - "QuoteString": quoteString, - "RegionConst": regionConstName, - "PartitionGetter": partitionGetter, - "PartitionVarName": partitionVarName, - "ListPartitionNames": listPartitionNames, - "BoxedBoolIfSet": boxedBoolIfSet, - "StringIfSet": stringIfSet, - "StringSliceIfSet": stringSliceIfSet, - "EndpointIsSet": endpointIsSet, - "ServicesSet": serviceSet, -} - -const v3Tmpl = ` -{{ define "defaults" -}} -// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. - -package endpoints - -import ( - "regexp" -) - - {{ template "partition consts" $.Resolver }} - - {{ range $_, $partition := $.Resolver }} - {{ template "partition region consts" $partition }} - {{ end }} - - {{ if not $.DisableGenerateServiceIDs -}} - {{ template "service consts" $.Resolver }} - {{- end }} - - {{ template "endpoint resolvers" $.Resolver }} -{{- end }} - -{{ define "partition consts" }} - // Partition identifiers - const ( - {{ range $_, $p := . -}} - {{ ToSymbol $p.ID }}PartitionID = {{ QuoteString $p.ID }} // {{ $p.Name }} partition. - {{ end -}} - ) -{{- end }} - -{{ define "partition region consts" }} - // {{ .Name }} partition's regions. - const ( - {{ range $id, $region := .Regions -}} - {{ ToSymbol $id }}RegionID = {{ QuoteString $id }} // {{ $region.Description }}. - {{ end -}} - ) -{{- end }} - -{{ define "service consts" }} - // Service identifiers - const ( - {{ $serviceSet := ServicesSet . -}} - {{ range $id, $_ := $serviceSet -}} - {{ ToSymbol $id }}ServiceID = {{ QuoteString $id }} // {{ ToSymbol $id }}. - {{ end -}} - ) -{{- end }} - -{{ define "endpoint resolvers" }} - // DefaultResolver returns an Endpoint resolver that will be able - // to resolve endpoints for: {{ ListPartitionNames . }}. - // - // Use DefaultPartitions() to get the list of the default partitions. - func DefaultResolver() Resolver { - return defaultPartitions - } - - // DefaultPartitions returns a list of the partitions the SDK is bundled - // with. The available partitions are: {{ ListPartitionNames . }}. - // - // partitions := endpoints.DefaultPartitions - // for _, p := range partitions { - // // ... inspect partitions - // } - func DefaultPartitions() []Partition { - return defaultPartitions.Partitions() - } - - var defaultPartitions = partitions{ - {{ range $_, $partition := . -}} - {{ PartitionVarName $partition.ID }}, - {{ end }} - } - - {{ range $_, $partition := . -}} - {{ $name := PartitionGetter $partition.ID -}} - // {{ $name }} returns the Resolver for {{ $partition.Name }}. - func {{ $name }}() Partition { - return {{ PartitionVarName $partition.ID }}.Partition() - } - var {{ PartitionVarName $partition.ID }} = {{ template "gocode Partition" $partition }} - {{ end }} -{{ end }} - -{{ define "default partitions" }} - func DefaultPartitions() []Partition { - return []partition{ - {{ range $_, $partition := . -}} - // {{ ToSymbol $partition.ID}}Partition(), - {{ end }} - } - } -{{ end }} - -{{ define "gocode Partition" -}} -partition{ - {{ StringIfSet "ID: %q,\n" .ID -}} - {{ StringIfSet "Name: %q,\n" .Name -}} - {{ StringIfSet "DNSSuffix: %q,\n" .DNSSuffix -}} - RegionRegex: {{ template "gocode RegionRegex" .RegionRegex }}, - {{ if EndpointIsSet .Defaults -}} - Defaults: {{ template "gocode Endpoint" .Defaults }}, - {{- end }} - Regions: {{ template "gocode Regions" .Regions }}, - Services: {{ template "gocode Services" .Services }}, -} -{{- end }} - -{{ define "gocode RegionRegex" -}} -regionRegex{ - Regexp: func() *regexp.Regexp{ - reg, _ := regexp.Compile({{ QuoteString .Regexp.String }}) - return reg - }(), -} -{{- end }} - -{{ define "gocode Regions" -}} -regions{ - {{ range $id, $region := . -}} - "{{ $id }}": {{ template "gocode Region" $region }}, - {{ end -}} -} -{{- end }} - -{{ define "gocode Region" -}} -region{ - {{ StringIfSet "Description: %q,\n" .Description -}} -} -{{- end }} - -{{ define "gocode Services" -}} -services{ - {{ range $id, $service := . -}} - "{{ $id }}": {{ template "gocode Service" $service }}, - {{ end }} -} -{{- end }} - -{{ define "gocode Service" -}} -service{ - {{ StringIfSet "PartitionEndpoint: %q,\n" .PartitionEndpoint -}} - {{ BoxedBoolIfSet "IsRegionalized: %s,\n" .IsRegionalized -}} - {{ if EndpointIsSet .Defaults -}} - Defaults: {{ template "gocode Endpoint" .Defaults -}}, - {{- end }} - {{ if .Endpoints -}} - Endpoints: {{ template "gocode Endpoints" .Endpoints }}, - {{- end }} -} -{{- end }} - -{{ define "gocode Endpoints" -}} -endpoints{ - {{ range $id, $endpoint := . -}} - "{{ $id }}": {{ template "gocode Endpoint" $endpoint }}, - {{ end }} -} -{{- end }} - -{{ define "gocode Endpoint" -}} -endpoint{ - {{ StringIfSet "Hostname: %q,\n" .Hostname -}} - {{ StringIfSet "SSLCommonName: %q,\n" .SSLCommonName -}} - {{ StringSliceIfSet "Protocols: []string{%s},\n" .Protocols -}} - {{ StringSliceIfSet "SignatureVersions: []string{%s},\n" .SignatureVersions -}} - {{ if or .CredentialScope.Region .CredentialScope.Service -}} - CredentialScope: credentialScope{ - {{ StringIfSet "Region: %q,\n" .CredentialScope.Region -}} - {{ StringIfSet "Service: %q,\n" .CredentialScope.Service -}} - }, - {{- end }} - {{ BoxedBoolIfSet "HasDualStack: %s,\n" .HasDualStack -}} - {{ StringIfSet "DualStackHostname: %q,\n" .DualStackHostname -}} - -} -{{- end }} -` diff --git a/vendor/github.com/aws/aws-sdk-go/aws/errors.go b/vendor/github.com/aws/aws-sdk-go/aws/errors.go deleted file mode 100644 index fa06f7a8f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package aws - -import "github.com/aws/aws-sdk-go/aws/awserr" - -var ( - // ErrMissingRegion is an error that is returned if region configuration is - // not found. - ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) - - // ErrMissingEndpoint is an error that is returned if an endpoint cannot be - // resolved for a service. - ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go deleted file mode 100644 index 91a6f277a..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go +++ /dev/null @@ -1,12 +0,0 @@ -package aws - -// JSONValue is a representation of a grab bag type that will be marshaled -// into a json string. This type can be used just like any other map. -// -// Example: -// -// values := aws.JSONValue{ -// "Foo": "Bar", -// } -// values["Baz"] = "Qux" -type JSONValue map[string]interface{} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/logger.go deleted file mode 100644 index 6ed15b2ec..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/logger.go +++ /dev/null @@ -1,118 +0,0 @@ -package aws - -import ( - "log" - "os" -) - -// A LogLevelType defines the level logging should be performed at. Used to instruct -// the SDK which statements should be logged. -type LogLevelType uint - -// LogLevel returns the pointer to a LogLevel. Should be used to workaround -// not being able to take the address of a non-composite literal. -func LogLevel(l LogLevelType) *LogLevelType { - return &l -} - -// Value returns the LogLevel value or the default value LogOff if the LogLevel -// is nil. Safe to use on nil value LogLevelTypes. -func (l *LogLevelType) Value() LogLevelType { - if l != nil { - return *l - } - return LogOff -} - -// Matches returns true if the v LogLevel is enabled by this LogLevel. Should be -// used with logging sub levels. Is safe to use on nil value LogLevelTypes. If -// LogLevel is nil, will default to LogOff comparison. -func (l *LogLevelType) Matches(v LogLevelType) bool { - c := l.Value() - return c&v == v -} - -// AtLeast returns true if this LogLevel is at least high enough to satisfies v. -// Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default -// to LogOff comparison. -func (l *LogLevelType) AtLeast(v LogLevelType) bool { - c := l.Value() - return c >= v -} - -const ( - // LogOff states that no logging should be performed by the SDK. This is the - // default state of the SDK, and should be use to disable all logging. - LogOff LogLevelType = iota * 0x1000 - - // LogDebug state that debug output should be logged by the SDK. This should - // be used to inspect request made and responses received. - LogDebug -) - -// Debug Logging Sub Levels -const ( - // LogDebugWithSigning states that the SDK should log request signing and - // presigning events. This should be used to log the signing details of - // requests for debugging. Will also enable LogDebug. - LogDebugWithSigning LogLevelType = LogDebug | (1 << iota) - - // LogDebugWithHTTPBody states the SDK should log HTTP request and response - // HTTP bodys in addition to the headers and path. This should be used to - // see the body content of requests and responses made while using the SDK - // Will also enable LogDebug. - LogDebugWithHTTPBody - - // LogDebugWithRequestRetries states the SDK should log when service requests will - // be retried. This should be used to log when you want to log when service - // requests are being retried. Will also enable LogDebug. - LogDebugWithRequestRetries - - // LogDebugWithRequestErrors states the SDK should log when service requests fail - // to build, send, validate, or unmarshal. - LogDebugWithRequestErrors - - // LogDebugWithEventStreamBody states the SDK should log EventStream - // request and response bodys. This should be used to log the EventStream - // wire unmarshaled message content of requests and responses made while - // using the SDK Will also enable LogDebug. - LogDebugWithEventStreamBody -) - -// A Logger is a minimalistic interface for the SDK to log messages to. Should -// be used to provide custom logging writers for the SDK to use. -type Logger interface { - Log(...interface{}) -} - -// A LoggerFunc is a convenience type to convert a function taking a variadic -// list of arguments and wrap it so the Logger interface can be used. -// -// Example: -// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { -// fmt.Fprintln(os.Stdout, args...) -// })}) -type LoggerFunc func(...interface{}) - -// Log calls the wrapped function with the arguments provided -func (f LoggerFunc) Log(args ...interface{}) { - f(args...) -} - -// NewDefaultLogger returns a Logger which will write log messages to stdout, and -// use same formatting runes as the stdlib log.Logger -func NewDefaultLogger() Logger { - return &defaultLogger{ - logger: log.New(os.Stdout, "", log.LstdFlags), - } -} - -// A defaultLogger provides a minimalistic logger satisfying the Logger interface. -type defaultLogger struct { - logger *log.Logger -} - -// Log logs the parameters to the stdlib logger. See log.Println. -func (l defaultLogger) Log(args ...interface{}) { - l.logger.Println(args...) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go deleted file mode 100644 index d9b37f4d3..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go +++ /dev/null @@ -1,18 +0,0 @@ -package request - -import ( - "strings" -) - -func isErrConnectionReset(err error) bool { - if strings.Contains(err.Error(), "read: connection reset") { - return false - } - - if strings.Contains(err.Error(), "connection reset") || - strings.Contains(err.Error(), "broken pipe") { - return true - } - - return false -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go deleted file mode 100644 index e819ab6c0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ /dev/null @@ -1,343 +0,0 @@ -package request - -import ( - "fmt" - "strings" -) - -// A Handlers provides a collection of request handlers for various -// stages of handling requests. -type Handlers struct { - Validate HandlerList - Build HandlerList - BuildStream HandlerList - Sign HandlerList - Send HandlerList - ValidateResponse HandlerList - Unmarshal HandlerList - UnmarshalStream HandlerList - UnmarshalMeta HandlerList - UnmarshalError HandlerList - Retry HandlerList - AfterRetry HandlerList - CompleteAttempt HandlerList - Complete HandlerList -} - -// Copy returns a copy of this handler's lists. -func (h *Handlers) Copy() Handlers { - return Handlers{ - Validate: h.Validate.copy(), - Build: h.Build.copy(), - BuildStream: h.BuildStream.copy(), - Sign: h.Sign.copy(), - Send: h.Send.copy(), - ValidateResponse: h.ValidateResponse.copy(), - Unmarshal: h.Unmarshal.copy(), - UnmarshalStream: h.UnmarshalStream.copy(), - UnmarshalError: h.UnmarshalError.copy(), - UnmarshalMeta: h.UnmarshalMeta.copy(), - Retry: h.Retry.copy(), - AfterRetry: h.AfterRetry.copy(), - CompleteAttempt: h.CompleteAttempt.copy(), - Complete: h.Complete.copy(), - } -} - -// Clear removes callback functions for all handlers. -func (h *Handlers) Clear() { - h.Validate.Clear() - h.Build.Clear() - h.BuildStream.Clear() - h.Send.Clear() - h.Sign.Clear() - h.Unmarshal.Clear() - h.UnmarshalStream.Clear() - h.UnmarshalMeta.Clear() - h.UnmarshalError.Clear() - h.ValidateResponse.Clear() - h.Retry.Clear() - h.AfterRetry.Clear() - h.CompleteAttempt.Clear() - h.Complete.Clear() -} - -// IsEmpty returns if there are no handlers in any of the handlerlists. -func (h *Handlers) IsEmpty() bool { - if h.Validate.Len() != 0 { - return false - } - if h.Build.Len() != 0 { - return false - } - if h.BuildStream.Len() != 0 { - return false - } - if h.Send.Len() != 0 { - return false - } - if h.Sign.Len() != 0 { - return false - } - if h.Unmarshal.Len() != 0 { - return false - } - if h.UnmarshalStream.Len() != 0 { - return false - } - if h.UnmarshalMeta.Len() != 0 { - return false - } - if h.UnmarshalError.Len() != 0 { - return false - } - if h.ValidateResponse.Len() != 0 { - return false - } - if h.Retry.Len() != 0 { - return false - } - if h.AfterRetry.Len() != 0 { - return false - } - if h.CompleteAttempt.Len() != 0 { - return false - } - if h.Complete.Len() != 0 { - return false - } - - return true -} - -// A HandlerListRunItem represents an entry in the HandlerList which -// is being run. -type HandlerListRunItem struct { - Index int - Handler NamedHandler - Request *Request -} - -// A HandlerList manages zero or more handlers in a list. -type HandlerList struct { - list []NamedHandler - - // Called after each request handler in the list is called. If set - // and the func returns true the HandlerList will continue to iterate - // over the request handlers. If false is returned the HandlerList - // will stop iterating. - // - // Should be used if extra logic to be performed between each handler - // in the list. This can be used to terminate a list's iteration - // based on a condition such as error like, HandlerListStopOnError. - // Or for logging like HandlerListLogItem. - AfterEachFn func(item HandlerListRunItem) bool -} - -// A NamedHandler is a struct that contains a name and function callback. -type NamedHandler struct { - Name string - Fn func(*Request) -} - -// copy creates a copy of the handler list. -func (l *HandlerList) copy() HandlerList { - n := HandlerList{ - AfterEachFn: l.AfterEachFn, - } - if len(l.list) == 0 { - return n - } - - n.list = append(make([]NamedHandler, 0, len(l.list)), l.list...) - return n -} - -// Clear clears the handler list. -func (l *HandlerList) Clear() { - l.list = l.list[0:0] -} - -// Len returns the number of handlers in the list. -func (l *HandlerList) Len() int { - return len(l.list) -} - -// PushBack pushes handler f to the back of the handler list. -func (l *HandlerList) PushBack(f func(*Request)) { - l.PushBackNamed(NamedHandler{"__anonymous", f}) -} - -// PushBackNamed pushes named handler f to the back of the handler list. -func (l *HandlerList) PushBackNamed(n NamedHandler) { - if cap(l.list) == 0 { - l.list = make([]NamedHandler, 0, 5) - } - l.list = append(l.list, n) -} - -// PushFront pushes handler f to the front of the handler list. -func (l *HandlerList) PushFront(f func(*Request)) { - l.PushFrontNamed(NamedHandler{"__anonymous", f}) -} - -// PushFrontNamed pushes named handler f to the front of the handler list. -func (l *HandlerList) PushFrontNamed(n NamedHandler) { - if cap(l.list) == len(l.list) { - // Allocating new list required - l.list = append([]NamedHandler{n}, l.list...) - } else { - // Enough room to prepend into list. - l.list = append(l.list, NamedHandler{}) - copy(l.list[1:], l.list) - l.list[0] = n - } -} - -// Remove removes a NamedHandler n -func (l *HandlerList) Remove(n NamedHandler) { - l.RemoveByName(n.Name) -} - -// RemoveByName removes a NamedHandler by name. -func (l *HandlerList) RemoveByName(name string) { - for i := 0; i < len(l.list); i++ { - m := l.list[i] - if m.Name == name { - // Shift array preventing creating new arrays - copy(l.list[i:], l.list[i+1:]) - l.list[len(l.list)-1] = NamedHandler{} - l.list = l.list[:len(l.list)-1] - - // decrement list so next check to length is correct - i-- - } - } -} - -// SwapNamed will swap out any existing handlers with the same name as the -// passed in NamedHandler returning true if handlers were swapped. False is -// returned otherwise. -func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) { - for i := 0; i < len(l.list); i++ { - if l.list[i].Name == n.Name { - l.list[i].Fn = n.Fn - swapped = true - } - } - - return swapped -} - -// Swap will swap out all handlers matching the name passed in. The matched -// handlers will be swapped in. True is returned if the handlers were swapped. -func (l *HandlerList) Swap(name string, replace NamedHandler) bool { - var swapped bool - - for i := 0; i < len(l.list); i++ { - if l.list[i].Name == name { - l.list[i] = replace - swapped = true - } - } - - return swapped -} - -// SetBackNamed will replace the named handler if it exists in the handler list. -// If the handler does not exist the handler will be added to the end of the list. -func (l *HandlerList) SetBackNamed(n NamedHandler) { - if !l.SwapNamed(n) { - l.PushBackNamed(n) - } -} - -// SetFrontNamed will replace the named handler if it exists in the handler list. -// If the handler does not exist the handler will be added to the beginning of -// the list. -func (l *HandlerList) SetFrontNamed(n NamedHandler) { - if !l.SwapNamed(n) { - l.PushFrontNamed(n) - } -} - -// Run executes all handlers in the list with a given request object. -func (l *HandlerList) Run(r *Request) { - for i, h := range l.list { - h.Fn(r) - item := HandlerListRunItem{ - Index: i, Handler: h, Request: r, - } - if l.AfterEachFn != nil && !l.AfterEachFn(item) { - return - } - } -} - -// HandlerListLogItem logs the request handler and the state of the -// request's Error value. Always returns true to continue iterating -// request handlers in a HandlerList. -func HandlerListLogItem(item HandlerListRunItem) bool { - if item.Request.Config.Logger == nil { - return true - } - item.Request.Config.Logger.Log("DEBUG: RequestHandler", - item.Index, item.Handler.Name, item.Request.Error) - - return true -} - -// HandlerListStopOnError returns false to stop the HandlerList iterating -// over request handlers if Request.Error is not nil. True otherwise -// to continue iterating. -func HandlerListStopOnError(item HandlerListRunItem) bool { - return item.Request.Error == nil -} - -// WithAppendUserAgent will add a string to the user agent prefixed with a -// single white space. -func WithAppendUserAgent(s string) Option { - return func(r *Request) { - r.Handlers.Build.PushBack(func(r2 *Request) { - AddToUserAgent(r, s) - }) - } -} - -// MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request -// header. If the extra parameters are provided they will be added as metadata to the -// name/version pair resulting in the following format. -// "name/version (extra0; extra1; ...)" -// The user agent part will be concatenated with this current request's user agent string. -func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request) { - ua := fmt.Sprintf("%s/%s", name, version) - if len(extra) > 0 { - ua += fmt.Sprintf(" (%s)", strings.Join(extra, "; ")) - } - return func(r *Request) { - AddToUserAgent(r, ua) - } -} - -// MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. -// The input string will be concatenated with the current request's user agent string. -func MakeAddToUserAgentFreeFormHandler(s string) func(*Request) { - return func(r *Request) { - AddToUserAgent(r, s) - } -} - -// WithSetRequestHeaders updates the operation request's HTTP header to contain -// the header key value pairs provided. If the header key already exists in the -// request's HTTP header set, the existing value(s) will be replaced. -func WithSetRequestHeaders(h map[string]string) Option { - return withRequestHeader(h).SetRequestHeaders -} - -type withRequestHeader map[string]string - -func (h withRequestHeader) SetRequestHeaders(r *Request) { - for k, v := range h { - r.HTTPRequest.Header[k] = []string{v} - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go deleted file mode 100644 index 79f79602b..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go +++ /dev/null @@ -1,24 +0,0 @@ -package request - -import ( - "io" - "net/http" - "net/url" -) - -func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { - req := new(http.Request) - *req = *r - req.URL = &url.URL{} - *req.URL = *r.URL - req.Body = body - - req.Header = http.Header{} - for k, v := range r.Header { - for _, vv := range v { - req.Header.Add(k, vv) - } - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go deleted file mode 100644 index 9370fa50c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go +++ /dev/null @@ -1,65 +0,0 @@ -package request - -import ( - "io" - "sync" - - "github.com/aws/aws-sdk-go/internal/sdkio" -) - -// offsetReader is a thread-safe io.ReadCloser to prevent racing -// with retrying requests -type offsetReader struct { - buf io.ReadSeeker - lock sync.Mutex - closed bool -} - -func newOffsetReader(buf io.ReadSeeker, offset int64) (*offsetReader, error) { - reader := &offsetReader{} - _, err := buf.Seek(offset, sdkio.SeekStart) - if err != nil { - return nil, err - } - - reader.buf = buf - return reader, nil -} - -// Close will close the instance of the offset reader's access to -// the underlying io.ReadSeeker. -func (o *offsetReader) Close() error { - o.lock.Lock() - defer o.lock.Unlock() - o.closed = true - return nil -} - -// Read is a thread-safe read of the underlying io.ReadSeeker -func (o *offsetReader) Read(p []byte) (int, error) { - o.lock.Lock() - defer o.lock.Unlock() - - if o.closed { - return 0, io.EOF - } - - return o.buf.Read(p) -} - -// Seek is a thread-safe seeking operation. -func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { - o.lock.Lock() - defer o.lock.Unlock() - - return o.buf.Seek(offset, whence) -} - -// CloseAndCopy will return a new offsetReader with a copy of the old buffer -// and close the old buffer. -func (o *offsetReader) CloseAndCopy(offset int64) (*offsetReader, error) { - if err := o.Close(); err != nil { - return nil, err - } - return newOffsetReader(o.buf, offset) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go deleted file mode 100644 index d597c6ead..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ /dev/null @@ -1,698 +0,0 @@ -package request - -import ( - "bytes" - "fmt" - "io" - "net/http" - "net/url" - "reflect" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/internal/sdkio" -) - -const ( - // ErrCodeSerialization is the serialization error code that is received - // during protocol unmarshaling. - ErrCodeSerialization = "SerializationError" - - // ErrCodeRead is an error that is returned during HTTP reads. - ErrCodeRead = "ReadError" - - // ErrCodeResponseTimeout is the connection timeout error that is received - // during body reads. - ErrCodeResponseTimeout = "ResponseTimeout" - - // ErrCodeInvalidPresignExpire is returned when the expire time provided to - // presign is invalid - ErrCodeInvalidPresignExpire = "InvalidPresignExpireError" - - // CanceledErrorCode is the error code that will be returned by an - // API request that was canceled. Requests given a aws.Context may - // return this error when canceled. - CanceledErrorCode = "RequestCanceled" - - // ErrCodeRequestError is an error preventing the SDK from continuing to - // process the request. - ErrCodeRequestError = "RequestError" -) - -// A Request is the service request to be made. -type Request struct { - Config aws.Config - ClientInfo metadata.ClientInfo - Handlers Handlers - - Retryer - AttemptTime time.Time - Time time.Time - Operation *Operation - HTTPRequest *http.Request - HTTPResponse *http.Response - Body io.ReadSeeker - streamingBody io.ReadCloser - BodyStart int64 // offset from beginning of Body that the request body starts - Params interface{} - Error error - Data interface{} - RequestID string - RetryCount int - Retryable *bool - RetryDelay time.Duration - NotHoist bool - SignedHeaderVals http.Header - LastSignedAt time.Time - DisableFollowRedirects bool - - // Additional API error codes that should be retried. IsErrorRetryable - // will consider these codes in addition to its built in cases. - RetryErrorCodes []string - - // Additional API error codes that should be retried with throttle backoff - // delay. IsErrorThrottle will consider these codes in addition to its - // built in cases. - ThrottleErrorCodes []string - - // A value greater than 0 instructs the request to be signed as Presigned URL - // You should not set this field directly. Instead use Request's - // Presign or PresignRequest methods. - ExpireTime time.Duration - - context aws.Context - - built bool - - // Need to persist an intermediate body between the input Body and HTTP - // request body because the HTTP Client's transport can maintain a reference - // to the HTTP request's body after the client has returned. This value is - // safe to use concurrently and wrap the input Body for each HTTP request. - safeBody *offsetReader -} - -// An Operation is the service API operation to be made. -type Operation struct { - Name string - HTTPMethod string - HTTPPath string - *Paginator - - BeforePresignFn func(r *Request) error -} - -// New returns a new Request pointer for the service API operation and -// parameters. -// -// A Retryer should be provided to direct how the request is retried. If -// Retryer is nil, a default no retry value will be used. You can use -// NoOpRetryer in the Client package to disable retry behavior directly. -// -// Params is any value of input parameters to be the request payload. -// Data is pointer value to an object which the request's response -// payload will be deserialized to. -func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, - retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request { - - if retryer == nil { - retryer = noOpRetryer{} - } - - method := operation.HTTPMethod - if method == "" { - method = "POST" - } - - httpReq, _ := http.NewRequest(method, "", nil) - - var err error - httpReq.URL, err = url.Parse(clientInfo.Endpoint + operation.HTTPPath) - if err != nil { - httpReq.URL = &url.URL{} - err = awserr.New("InvalidEndpointURL", "invalid endpoint uri", err) - } - - r := &Request{ - Config: cfg, - ClientInfo: clientInfo, - Handlers: handlers.Copy(), - - Retryer: retryer, - Time: time.Now(), - ExpireTime: 0, - Operation: operation, - HTTPRequest: httpReq, - Body: nil, - Params: params, - Error: err, - Data: data, - } - r.SetBufferBody([]byte{}) - - return r -} - -// A Option is a functional option that can augment or modify a request when -// using a WithContext API operation method. -type Option func(*Request) - -// WithGetResponseHeader builds a request Option which will retrieve a single -// header value from the HTTP Response. If there are multiple values for the -// header key use WithGetResponseHeaders instead to access the http.Header -// map directly. The passed in val pointer must be non-nil. -// -// This Option can be used multiple times with a single API operation. -// -// var id2, versionID string -// svc.PutObjectWithContext(ctx, params, -// request.WithGetResponseHeader("x-amz-id-2", &id2), -// request.WithGetResponseHeader("x-amz-version-id", &versionID), -// ) -func WithGetResponseHeader(key string, val *string) Option { - return func(r *Request) { - r.Handlers.Complete.PushBack(func(req *Request) { - *val = req.HTTPResponse.Header.Get(key) - }) - } -} - -// WithGetResponseHeaders builds a request Option which will retrieve the -// headers from the HTTP response and assign them to the passed in headers -// variable. The passed in headers pointer must be non-nil. -// -// var headers http.Header -// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) -func WithGetResponseHeaders(headers *http.Header) Option { - return func(r *Request) { - r.Handlers.Complete.PushBack(func(req *Request) { - *headers = req.HTTPResponse.Header - }) - } -} - -// WithLogLevel is a request option that will set the request to use a specific -// log level when the request is made. -// -// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody) -func WithLogLevel(l aws.LogLevelType) Option { - return func(r *Request) { - r.Config.LogLevel = aws.LogLevel(l) - } -} - -// ApplyOptions will apply each option to the request calling them in the order -// the were provided. -func (r *Request) ApplyOptions(opts ...Option) { - for _, opt := range opts { - opt(r) - } -} - -// Context will always returns a non-nil context. If Request does not have a -// context aws.BackgroundContext will be returned. -func (r *Request) Context() aws.Context { - if r.context != nil { - return r.context - } - return aws.BackgroundContext() -} - -// SetContext adds a Context to the current request that can be used to cancel -// a in-flight request. The Context value must not be nil, or this method will -// panic. -// -// Unlike http.Request.WithContext, SetContext does not return a copy of the -// Request. It is not safe to use use a single Request value for multiple -// requests. A new Request should be created for each API operation request. -// -// Go 1.6 and below: -// The http.Request's Cancel field will be set to the Done() value of -// the context. This will overwrite the Cancel field's value. -// -// Go 1.7 and above: -// The http.Request.WithContext will be used to set the context on the underlying -// http.Request. This will create a shallow copy of the http.Request. The SDK -// may create sub contexts in the future for nested requests such as retries. -func (r *Request) SetContext(ctx aws.Context) { - if ctx == nil { - panic("context cannot be nil") - } - setRequestContext(r, ctx) -} - -// WillRetry returns if the request's can be retried. -func (r *Request) WillRetry() bool { - if !aws.IsReaderSeekable(r.Body) && r.HTTPRequest.Body != NoBody { - return false - } - return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() -} - -func fmtAttemptCount(retryCount, maxRetries int) string { - return fmt.Sprintf("attempt %v/%v", retryCount, maxRetries) -} - -// ParamsFilled returns if the request's parameters have been populated -// and the parameters are valid. False is returned if no parameters are -// provided or invalid. -func (r *Request) ParamsFilled() bool { - return r.Params != nil && reflect.ValueOf(r.Params).Elem().IsValid() -} - -// DataFilled returns true if the request's data for response deserialization -// target has been set and is a valid. False is returned if data is not -// set, or is invalid. -func (r *Request) DataFilled() bool { - return r.Data != nil && reflect.ValueOf(r.Data).Elem().IsValid() -} - -// SetBufferBody will set the request's body bytes that will be sent to -// the service API. -func (r *Request) SetBufferBody(buf []byte) { - r.SetReaderBody(bytes.NewReader(buf)) -} - -// SetStringBody sets the body of the request to be backed by a string. -func (r *Request) SetStringBody(s string) { - r.SetReaderBody(strings.NewReader(s)) -} - -// SetReaderBody will set the request's body reader. -func (r *Request) SetReaderBody(reader io.ReadSeeker) { - r.Body = reader - - if aws.IsReaderSeekable(reader) { - var err error - // Get the Bodies current offset so retries will start from the same - // initial position. - r.BodyStart, err = reader.Seek(0, sdkio.SeekCurrent) - if err != nil { - r.Error = awserr.New(ErrCodeSerialization, - "failed to determine start of request body", err) - return - } - } - r.ResetBody() -} - -// SetStreamingBody set the reader to be used for the request that will stream -// bytes to the server. Request's Body must not be set to any reader. -func (r *Request) SetStreamingBody(reader io.ReadCloser) { - r.streamingBody = reader - r.SetReaderBody(aws.ReadSeekCloser(reader)) -} - -// Presign returns the request's signed URL. Error will be returned -// if the signing fails. The expire parameter is only used for presigned Amazon -// S3 API requests. All other AWS services will use a fixed expiration -// time of 15 minutes. -// -// It is invalid to create a presigned URL with a expire duration 0 or less. An -// error is returned if expire duration is 0 or less. -func (r *Request) Presign(expire time.Duration) (string, error) { - r = r.copy() - - // Presign requires all headers be hoisted. There is no way to retrieve - // the signed headers not hoisted without this. Making the presigned URL - // useless. - r.NotHoist = false - - u, _, err := getPresignedURL(r, expire) - return u, err -} - -// PresignRequest behaves just like presign, with the addition of returning a -// set of headers that were signed. The expire parameter is only used for -// presigned Amazon S3 API requests. All other AWS services will use a fixed -// expiration time of 15 minutes. -// -// It is invalid to create a presigned URL with a expire duration 0 or less. An -// error is returned if expire duration is 0 or less. -// -// Returns the URL string for the API operation with signature in the query string, -// and the HTTP headers that were included in the signature. These headers must -// be included in any HTTP request made with the presigned URL. -// -// To prevent hoisting any headers to the query string set NotHoist to true on -// this Request value prior to calling PresignRequest. -func (r *Request) PresignRequest(expire time.Duration) (string, http.Header, error) { - r = r.copy() - return getPresignedURL(r, expire) -} - -// IsPresigned returns true if the request represents a presigned API url. -func (r *Request) IsPresigned() bool { - return r.ExpireTime != 0 -} - -func getPresignedURL(r *Request, expire time.Duration) (string, http.Header, error) { - if expire <= 0 { - return "", nil, awserr.New( - ErrCodeInvalidPresignExpire, - "presigned URL requires an expire duration greater than 0", - nil, - ) - } - - r.ExpireTime = expire - - if r.Operation.BeforePresignFn != nil { - if err := r.Operation.BeforePresignFn(r); err != nil { - return "", nil, err - } - } - - if err := r.Sign(); err != nil { - return "", nil, err - } - - return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil -} - -const ( - notRetrying = "not retrying" -) - -func debugLogReqError(r *Request, stage, retryStr string, err error) { - if !r.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { - return - } - - r.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", - stage, r.ClientInfo.ServiceName, r.Operation.Name, retryStr, err)) -} - -// Build will build the request's object so it can be signed and sent -// to the service. Build will also validate all the request's parameters. -// Any additional build Handlers set on this request will be run -// in the order they were set. -// -// The request will only be built once. Multiple calls to build will have -// no effect. -// -// If any Validate or Build errors occur the build will stop and the error -// which occurred will be returned. -func (r *Request) Build() error { - if !r.built { - r.Handlers.Validate.Run(r) - if r.Error != nil { - debugLogReqError(r, "Validate Request", notRetrying, r.Error) - return r.Error - } - r.Handlers.Build.Run(r) - if r.Error != nil { - debugLogReqError(r, "Build Request", notRetrying, r.Error) - return r.Error - } - r.built = true - } - - return r.Error -} - -// Sign will sign the request, returning error if errors are encountered. -// -// Sign will build the request prior to signing. All Sign Handlers will -// be executed in the order they were set. -func (r *Request) Sign() error { - r.Build() - if r.Error != nil { - debugLogReqError(r, "Build Request", notRetrying, r.Error) - return r.Error - } - - SanitizeHostForHeader(r.HTTPRequest) - - r.Handlers.Sign.Run(r) - return r.Error -} - -func (r *Request) getNextRequestBody() (body io.ReadCloser, err error) { - if r.streamingBody != nil { - return r.streamingBody, nil - } - - if r.safeBody != nil { - r.safeBody.Close() - } - - r.safeBody, err = newOffsetReader(r.Body, r.BodyStart) - if err != nil { - return nil, awserr.New(ErrCodeSerialization, - "failed to get next request body reader", err) - } - - // Go 1.8 tightened and clarified the rules code needs to use when building - // requests with the http package. Go 1.8 removed the automatic detection - // of if the Request.Body was empty, or actually had bytes in it. The SDK - // always sets the Request.Body even if it is empty and should not actually - // be sent. This is incorrect. - // - // Go 1.8 did add a http.NoBody value that the SDK can use to tell the http - // client that the request really should be sent without a body. The - // Request.Body cannot be set to nil, which is preferable, because the - // field is exported and could introduce nil pointer dereferences for users - // of the SDK if they used that field. - // - // Related golang/go#18257 - l, err := aws.SeekerLen(r.Body) - if err != nil { - return nil, awserr.New(ErrCodeSerialization, - "failed to compute request body size", err) - } - - if l == 0 { - body = NoBody - } else if l > 0 { - body = r.safeBody - } else { - // Hack to prevent sending bodies for methods where the body - // should be ignored by the server. Sending bodies on these - // methods without an associated ContentLength will cause the - // request to socket timeout because the server does not handle - // Transfer-Encoding: chunked bodies for these methods. - // - // This would only happen if a aws.ReaderSeekerCloser was used with - // a io.Reader that was not also an io.Seeker, or did not implement - // Len() method. - switch r.Operation.HTTPMethod { - case "GET", "HEAD", "DELETE": - body = NoBody - default: - body = r.safeBody - } - } - - return body, nil -} - -// GetBody will return an io.ReadSeeker of the Request's underlying -// input body with a concurrency safe wrapper. -func (r *Request) GetBody() io.ReadSeeker { - return r.safeBody -} - -// Send will send the request, returning error if errors are encountered. -// -// Send will sign the request prior to sending. All Send Handlers will -// be executed in the order they were set. -// -// Canceling a request is non-deterministic. If a request has been canceled, -// then the transport will choose, randomly, one of the state channels during -// reads or getting the connection. -// -// readLoop() and getConn(req *Request, cm connectMethod) -// https://github.com/golang/go/blob/master/src/net/http/transport.go -// -// Send will not close the request.Request's body. -func (r *Request) Send() error { - defer func() { - // Regardless of success or failure of the request trigger the Complete - // request handlers. - r.Handlers.Complete.Run(r) - }() - - if err := r.Error; err != nil { - return err - } - - for { - r.Error = nil - r.AttemptTime = time.Now() - - if err := r.Sign(); err != nil { - debugLogReqError(r, "Sign Request", notRetrying, err) - return err - } - - if err := r.sendRequest(); err == nil { - return nil - } - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) - - if r.Error != nil || !aws.BoolValue(r.Retryable) { - return r.Error - } - - if err := r.prepareRetry(); err != nil { - r.Error = err - return err - } - } -} - -func (r *Request) prepareRetry() error { - if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { - r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", - r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) - } - - // The previous http.Request will have a reference to the r.Body - // and the HTTP Client's Transport may still be reading from - // the request's body even though the Client's Do returned. - r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, nil) - r.ResetBody() - if err := r.Error; err != nil { - return awserr.New(ErrCodeSerialization, - "failed to prepare body for retry", err) - - } - - // Closing response body to ensure that no response body is leaked - // between retry attempts. - if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { - r.HTTPResponse.Body.Close() - } - - return nil -} - -func (r *Request) sendRequest() (sendErr error) { - defer r.Handlers.CompleteAttempt.Run(r) - - r.Retryable = nil - r.Handlers.Send.Run(r) - if r.Error != nil { - debugLogReqError(r, "Send Request", - fmtAttemptCount(r.RetryCount, r.MaxRetries()), - r.Error) - return r.Error - } - - r.Handlers.UnmarshalMeta.Run(r) - r.Handlers.ValidateResponse.Run(r) - if r.Error != nil { - r.Handlers.UnmarshalError.Run(r) - debugLogReqError(r, "Validate Response", - fmtAttemptCount(r.RetryCount, r.MaxRetries()), - r.Error) - return r.Error - } - - r.Handlers.Unmarshal.Run(r) - if r.Error != nil { - debugLogReqError(r, "Unmarshal Response", - fmtAttemptCount(r.RetryCount, r.MaxRetries()), - r.Error) - return r.Error - } - - return nil -} - -// copy will copy a request which will allow for local manipulation of the -// request. -func (r *Request) copy() *Request { - req := &Request{} - *req = *r - req.Handlers = r.Handlers.Copy() - op := *r.Operation - req.Operation = &op - return req -} - -// AddToUserAgent adds the string to the end of the request's current user agent. -func AddToUserAgent(r *Request, s string) { - curUA := r.HTTPRequest.Header.Get("User-Agent") - if len(curUA) > 0 { - s = curUA + " " + s - } - r.HTTPRequest.Header.Set("User-Agent", s) -} - -// SanitizeHostForHeader removes default port from host and updates request.Host -func SanitizeHostForHeader(r *http.Request) { - host := getHost(r) - port := portOnly(host) - if port != "" && isDefaultPort(r.URL.Scheme, port) { - r.Host = stripPort(host) - } -} - -// Returns host from request -func getHost(r *http.Request) string { - if r.Host != "" { - return r.Host - } - - if r.URL == nil { - return "" - } - - return r.URL.Host -} - -// Hostname returns u.Host, without any port number. -// -// If Host is an IPv6 literal with a port number, Hostname returns the -// IPv6 literal without the square brackets. IPv6 literals may include -// a zone identifier. -// -// Copied from the Go 1.8 standard library (net/url) -func stripPort(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return hostport - } - if i := strings.IndexByte(hostport, ']'); i != -1 { - return strings.TrimPrefix(hostport[:i], "[") - } - return hostport[:colon] -} - -// Port returns the port part of u.Host, without the leading colon. -// If u.Host doesn't contain a port, Port returns an empty string. -// -// Copied from the Go 1.8 standard library (net/url) -func portOnly(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return "" - } - if i := strings.Index(hostport, "]:"); i != -1 { - return hostport[i+len("]:"):] - } - if strings.Contains(hostport, "]") { - return "" - } - return hostport[colon+len(":"):] -} - -// Returns true if the specified URI is using the standard port -// (i.e. port 80 for HTTP URIs or 443 for HTTPS URIs) -func isDefaultPort(scheme, port string) bool { - if port == "" { - return true - } - - lowerCaseScheme := strings.ToLower(scheme) - if (lowerCaseScheme == "http" && port == "80") || (lowerCaseScheme == "https" && port == "443") { - return true - } - - return false -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go deleted file mode 100644 index e36e468b7..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build !go1.8 - -package request - -import "io" - -// NoBody is an io.ReadCloser with no bytes. Read always returns EOF -// and Close always returns nil. It can be used in an outgoing client -// request to explicitly signal that a request has zero bytes. -// An alternative, however, is to simply set Request.Body to nil. -// -// Copy of Go 1.8 NoBody type from net/http/http.go -type noBody struct{} - -func (noBody) Read([]byte) (int, error) { return 0, io.EOF } -func (noBody) Close() error { return nil } -func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } - -// NoBody is an empty reader that will trigger the Go HTTP client to not include -// and body in the HTTP request. -var NoBody = noBody{} - -// ResetBody rewinds the request body back to its starting position, and -// sets the HTTP Request body reference. When the body is read prior -// to being sent in the HTTP request it will need to be rewound. -// -// ResetBody will automatically be called by the SDK's build handler, but if -// the request is being used directly ResetBody must be called before the request -// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically -// call ResetBody. -func (r *Request) ResetBody() { - body, err := r.getNextRequestBody() - if err != nil { - r.Error = err - return - } - - r.HTTPRequest.Body = body -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go deleted file mode 100644 index de1292f45..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go +++ /dev/null @@ -1,36 +0,0 @@ -// +build go1.8 - -package request - -import ( - "net/http" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// NoBody is a http.NoBody reader instructing Go HTTP client to not include -// and body in the HTTP request. -var NoBody = http.NoBody - -// ResetBody rewinds the request body back to its starting position, and -// sets the HTTP Request body reference. When the body is read prior -// to being sent in the HTTP request it will need to be rewound. -// -// ResetBody will automatically be called by the SDK's build handler, but if -// the request is being used directly ResetBody must be called before the request -// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically -// call ResetBody. -// -// Will also set the Go 1.8's http.Request.GetBody member to allow retrying -// PUT/POST redirects. -func (r *Request) ResetBody() { - body, err := r.getNextRequestBody() - if err != nil { - r.Error = awserr.New(ErrCodeSerialization, - "failed to reset request body", err) - return - } - - r.HTTPRequest.Body = body - r.HTTPRequest.GetBody = r.getNextRequestBody -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go deleted file mode 100644 index a7365cd1e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build go1.7 - -package request - -import "github.com/aws/aws-sdk-go/aws" - -// setContext updates the Request to use the passed in context for cancellation. -// Context will also be used for request retry delay. -// -// Creates shallow copy of the http.Request with the WithContext method. -func setRequestContext(r *Request, ctx aws.Context) { - r.context = ctx - r.HTTPRequest = r.HTTPRequest.WithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go deleted file mode 100644 index 307fa0705..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !go1.7 - -package request - -import "github.com/aws/aws-sdk-go/aws" - -// setContext updates the Request to use the passed in context for cancellation. -// Context will also be used for request retry delay. -// -// Creates shallow copy of the http.Request with the WithContext method. -func setRequestContext(r *Request, ctx aws.Context) { - r.context = ctx - r.HTTPRequest.Cancel = ctx.Done() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go deleted file mode 100644 index 64784e16f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ /dev/null @@ -1,266 +0,0 @@ -package request - -import ( - "reflect" - "sync/atomic" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -// A Pagination provides paginating of SDK API operations which are paginatable. -// Generally you should not use this type directly, but use the "Pages" API -// operations method to automatically perform pagination for you. Such as, -// "S3.ListObjectsPages", and "S3.ListObjectsPagesWithContext" methods. -// -// Pagination differs from a Paginator type in that pagination is the type that -// does the pagination between API operations, and Paginator defines the -// configuration that will be used per page request. -// -// for p.Next() { -// data := p.Page().(*s3.ListObjectsOutput) -// // process the page's data -// // ... -// // break out of loop to stop fetching additional pages -// } -// -// return p.Err() -// -// See service client API operation Pages methods for examples how the SDK will -// use the Pagination type. -type Pagination struct { - // Function to return a Request value for each pagination request. - // Any configuration or handlers that need to be applied to the request - // prior to getting the next page should be done here before the request - // returned. - // - // NewRequest should always be built from the same API operations. It is - // undefined if different API operations are returned on subsequent calls. - NewRequest func() (*Request, error) - // EndPageOnSameToken, when enabled, will allow the paginator to stop on - // token that are the same as its previous tokens. - EndPageOnSameToken bool - - started bool - prevTokens []interface{} - nextTokens []interface{} - - err error - curPage interface{} -} - -// HasNextPage will return true if Pagination is able to determine that the API -// operation has additional pages. False will be returned if there are no more -// pages remaining. -// -// Will always return true if Next has not been called yet. -func (p *Pagination) HasNextPage() bool { - if !p.started { - return true - } - - hasNextPage := len(p.nextTokens) != 0 - if p.EndPageOnSameToken { - return hasNextPage && !awsutil.DeepEqual(p.nextTokens, p.prevTokens) - } - return hasNextPage -} - -// Err returns the error Pagination encountered when retrieving the next page. -func (p *Pagination) Err() error { - return p.err -} - -// Page returns the current page. Page should only be called after a successful -// call to Next. It is undefined what Page will return if Page is called after -// Next returns false. -func (p *Pagination) Page() interface{} { - return p.curPage -} - -// Next will attempt to retrieve the next page for the API operation. When a page -// is retrieved true will be returned. If the page cannot be retrieved, or there -// are no more pages false will be returned. -// -// Use the Page method to retrieve the current page data. The data will need -// to be cast to the API operation's output type. -// -// Use the Err method to determine if an error occurred if Page returns false. -func (p *Pagination) Next() bool { - if !p.HasNextPage() { - return false - } - - req, err := p.NewRequest() - if err != nil { - p.err = err - return false - } - - if p.started { - for i, intok := range req.Operation.InputTokens { - awsutil.SetValueAtPath(req.Params, intok, p.nextTokens[i]) - } - } - p.started = true - - err = req.Send() - if err != nil { - p.err = err - return false - } - - p.prevTokens = p.nextTokens - p.nextTokens = req.nextPageTokens() - p.curPage = req.Data - - return true -} - -// A Paginator is the configuration data that defines how an API operation -// should be paginated. This type is used by the API service models to define -// the generated pagination config for service APIs. -// -// The Pagination type is what provides iterating between pages of an API. It -// is only used to store the token metadata the SDK should use for performing -// pagination. -type Paginator struct { - InputTokens []string - OutputTokens []string - LimitToken string - TruncationToken string -} - -// nextPageTokens returns the tokens to use when asking for the next page of data. -func (r *Request) nextPageTokens() []interface{} { - if r.Operation.Paginator == nil { - return nil - } - if r.Operation.TruncationToken != "" { - tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken) - if len(tr) == 0 { - return nil - } - - switch v := tr[0].(type) { - case *bool: - if !aws.BoolValue(v) { - return nil - } - case bool: - if !v { - return nil - } - } - } - - tokens := []interface{}{} - tokenAdded := false - for _, outToken := range r.Operation.OutputTokens { - vs, _ := awsutil.ValuesAtPath(r.Data, outToken) - if len(vs) == 0 { - tokens = append(tokens, nil) - continue - } - v := vs[0] - - switch tv := v.(type) { - case *string: - if len(aws.StringValue(tv)) == 0 { - tokens = append(tokens, nil) - continue - } - case string: - if len(tv) == 0 { - tokens = append(tokens, nil) - continue - } - } - - tokenAdded = true - tokens = append(tokens, v) - } - if !tokenAdded { - return nil - } - - return tokens -} - -// Ensure a deprecated item is only logged once instead of each time its used. -func logDeprecatedf(logger aws.Logger, flag *int32, msg string) { - if logger == nil { - return - } - if atomic.CompareAndSwapInt32(flag, 0, 1) { - logger.Log(msg) - } -} - -var ( - logDeprecatedHasNextPage int32 - logDeprecatedNextPage int32 - logDeprecatedEachPage int32 -) - -// HasNextPage returns true if this request has more pages of data available. -// -// Deprecated Use Pagination type for configurable pagination of API operations -func (r *Request) HasNextPage() bool { - logDeprecatedf(r.Config.Logger, &logDeprecatedHasNextPage, - "Request.HasNextPage deprecated. Use Pagination type for configurable pagination of API operations") - - return len(r.nextPageTokens()) > 0 -} - -// NextPage returns a new Request that can be executed to return the next -// page of result data. Call .Send() on this request to execute it. -// -// Deprecated Use Pagination type for configurable pagination of API operations -func (r *Request) NextPage() *Request { - logDeprecatedf(r.Config.Logger, &logDeprecatedNextPage, - "Request.NextPage deprecated. Use Pagination type for configurable pagination of API operations") - - tokens := r.nextPageTokens() - if len(tokens) == 0 { - return nil - } - - data := reflect.New(reflect.TypeOf(r.Data).Elem()).Interface() - nr := New(r.Config, r.ClientInfo, r.Handlers, r.Retryer, r.Operation, awsutil.CopyOf(r.Params), data) - for i, intok := range nr.Operation.InputTokens { - awsutil.SetValueAtPath(nr.Params, intok, tokens[i]) - } - return nr -} - -// EachPage iterates over each page of a paginated request object. The fn -// parameter should be a function with the following sample signature: -// -// func(page *T, lastPage bool) bool { -// return true // return false to stop iterating -// } -// -// Where "T" is the structure type matching the output structure of the given -// operation. For example, a request object generated by -// DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput -// as the structure "T". The lastPage value represents whether the page is -// the last page of data or not. The return value of this function should -// return true to keep iterating or false to stop. -// -// Deprecated Use Pagination type for configurable pagination of API operations -func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error { - logDeprecatedf(r.Config.Logger, &logDeprecatedEachPage, - "Request.EachPage deprecated. Use Pagination type for configurable pagination of API operations") - - for page := r; page != nil; page = page.NextPage() { - if err := page.Send(); err != nil { - return err - } - if getNextPage := fn(page.Data, !page.HasNextPage()); !getNextPage { - return page.Error - } - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go deleted file mode 100644 index 752ae47f8..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ /dev/null @@ -1,309 +0,0 @@ -package request - -import ( - "net" - "net/url" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// Retryer provides the interface drive the SDK's request retry behavior. The -// Retryer implementation is responsible for implementing exponential backoff, -// and determine if a request API error should be retried. -// -// client.DefaultRetryer is the SDK's default implementation of the Retryer. It -// uses the which uses the Request.IsErrorRetryable and Request.IsErrorThrottle -// methods to determine if the request is retried. -type Retryer interface { - // RetryRules return the retry delay that should be used by the SDK before - // making another request attempt for the failed request. - RetryRules(*Request) time.Duration - - // ShouldRetry returns if the failed request is retryable. - // - // Implementations may consider request attempt count when determining if a - // request is retryable, but the SDK will use MaxRetries to limit the - // number of attempts a request are made. - ShouldRetry(*Request) bool - - // MaxRetries is the number of times a request may be retried before - // failing. - MaxRetries() int -} - -// WithRetryer sets a Retryer value to the given Config returning the Config -// value for chaining. The value must not be nil. -func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { - if retryer == nil { - if cfg.Logger != nil { - cfg.Logger.Log("ERROR: Request.WithRetryer called with nil retryer. Replacing with retry disabled Retryer.") - } - retryer = noOpRetryer{} - } - cfg.Retryer = retryer - return cfg - -} - -// noOpRetryer is a internal no op retryer used when a request is created -// without a retryer. -// -// Provides a retryer that performs no retries. -// It should be used when we do not want retries to be performed. -type noOpRetryer struct{} - -// MaxRetries returns the number of maximum returns the service will use to make -// an individual API; For NoOpRetryer the MaxRetries will always be zero. -func (d noOpRetryer) MaxRetries() int { - return 0 -} - -// ShouldRetry will always return false for NoOpRetryer, as it should never retry. -func (d noOpRetryer) ShouldRetry(_ *Request) bool { - return false -} - -// RetryRules returns the delay duration before retrying this request again; -// since NoOpRetryer does not retry, RetryRules always returns 0. -func (d noOpRetryer) RetryRules(_ *Request) time.Duration { - return 0 -} - -// retryableCodes is a collection of service response codes which are retry-able -// without any further action. -var retryableCodes = map[string]struct{}{ - ErrCodeRequestError: {}, - "RequestTimeout": {}, - ErrCodeResponseTimeout: {}, - "RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout -} - -var throttleCodes = map[string]struct{}{ - "ProvisionedThroughputExceededException": {}, - "ThrottledException": {}, // SNS, XRay, ResourceGroupsTagging API - "Throttling": {}, - "ThrottlingException": {}, - "RequestLimitExceeded": {}, - "RequestThrottled": {}, - "RequestThrottledException": {}, - "TooManyRequestsException": {}, // Lambda functions - "PriorRequestNotComplete": {}, // Route53 - "TransactionInProgressException": {}, - "EC2ThrottledException": {}, // EC2 -} - -// credsExpiredCodes is a collection of error codes which signify the credentials -// need to be refreshed. Expired tokens require refreshing of credentials, and -// resigning before the request can be retried. -var credsExpiredCodes = map[string]struct{}{ - "ExpiredToken": {}, - "ExpiredTokenException": {}, - "RequestExpired": {}, // EC2 Only -} - -func isCodeThrottle(code string) bool { - _, ok := throttleCodes[code] - return ok -} - -func isCodeRetryable(code string) bool { - if _, ok := retryableCodes[code]; ok { - return true - } - - return isCodeExpiredCreds(code) -} - -func isCodeExpiredCreds(code string) bool { - _, ok := credsExpiredCodes[code] - return ok -} - -var validParentCodes = map[string]struct{}{ - ErrCodeSerialization: {}, - ErrCodeRead: {}, -} - -func isNestedErrorRetryable(parentErr awserr.Error) bool { - if parentErr == nil { - return false - } - - if _, ok := validParentCodes[parentErr.Code()]; !ok { - return false - } - - err := parentErr.OrigErr() - if err == nil { - return false - } - - if aerr, ok := err.(awserr.Error); ok { - return isCodeRetryable(aerr.Code()) - } - - if t, ok := err.(temporary); ok { - return t.Temporary() || isErrConnectionReset(err) - } - - return isErrConnectionReset(err) -} - -// IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if error is nil. -func IsErrorRetryable(err error) bool { - if err == nil { - return false - } - return shouldRetryError(err) -} - -type temporary interface { - Temporary() bool -} - -func shouldRetryError(origErr error) bool { - switch err := origErr.(type) { - case awserr.Error: - if err.Code() == CanceledErrorCode { - return false - } - if isNestedErrorRetryable(err) { - return true - } - - origErr := err.OrigErr() - var shouldRetry bool - if origErr != nil { - shouldRetry = shouldRetryError(origErr) - if err.Code() == ErrCodeRequestError && !shouldRetry { - return false - } - } - if isCodeRetryable(err.Code()) { - return true - } - return shouldRetry - - case *url.Error: - if strings.Contains(err.Error(), "connection refused") { - // Refused connections should be retried as the service may not yet - // be running on the port. Go TCP dial considers refused - // connections as not temporary. - return true - } - // *url.Error only implements Temporary after golang 1.6 but since - // url.Error only wraps the error: - return shouldRetryError(err.Err) - - case temporary: - if netErr, ok := err.(*net.OpError); ok && netErr.Op == "dial" { - return true - } - // If the error is temporary, we want to allow continuation of the - // retry process - return err.Temporary() || isErrConnectionReset(origErr) - - case nil: - // `awserr.Error.OrigErr()` can be nil, meaning there was an error but - // because we don't know the cause, it is marked as retryable. See - // TestRequest4xxUnretryable for an example. - return true - - default: - switch err.Error() { - case "net/http: request canceled", - "net/http: request canceled while waiting for connection": - // known 1.5 error case when an http request is cancelled - return false - } - // here we don't know the error; so we allow a retry. - return true - } -} - -// IsErrorThrottle returns whether the error is to be throttled based on its code. -// Returns false if error is nil. -func IsErrorThrottle(err error) bool { - if aerr, ok := err.(awserr.Error); ok && aerr != nil { - return isCodeThrottle(aerr.Code()) - } - return false -} - -// IsErrorExpiredCreds returns whether the error code is a credential expiry -// error. Returns false if error is nil. -func IsErrorExpiredCreds(err error) bool { - if aerr, ok := err.(awserr.Error); ok && aerr != nil { - return isCodeExpiredCreds(aerr.Code()) - } - return false -} - -// IsErrorRetryable returns whether the error is retryable, based on its Code. -// Returns false if the request has no Error set. -// -// Alias for the utility function IsErrorRetryable -func (r *Request) IsErrorRetryable() bool { - if isErrCode(r.Error, r.RetryErrorCodes) { - return true - } - - // HTTP response status code 501 should not be retried. - // 501 represents Not Implemented which means the request method is not - // supported by the server and cannot be handled. - if r.HTTPResponse != nil { - // HTTP response status code 500 represents internal server error and - // should be retried without any throttle. - if r.HTTPResponse.StatusCode == 500 { - return true - } - } - return IsErrorRetryable(r.Error) -} - -// IsErrorThrottle returns whether the error is to be throttled based on its -// code. Returns false if the request has no Error set. -// -// Alias for the utility function IsErrorThrottle -func (r *Request) IsErrorThrottle() bool { - if isErrCode(r.Error, r.ThrottleErrorCodes) { - return true - } - - if r.HTTPResponse != nil { - switch r.HTTPResponse.StatusCode { - case - 429, // error caused due to too many requests - 502, // Bad Gateway error should be throttled - 503, // caused when service is unavailable - 504: // error occurred due to gateway timeout - return true - } - } - - return IsErrorThrottle(r.Error) -} - -func isErrCode(err error, codes []string) bool { - if aerr, ok := err.(awserr.Error); ok && aerr != nil { - for _, code := range codes { - if code == aerr.Code() { - return true - } - } - } - - return false -} - -// IsErrorExpired returns whether the error code is a credential expiry error. -// Returns false if the request has no Error set. -// -// Alias for the utility function IsErrorExpiredCreds -func (r *Request) IsErrorExpired() bool { - return IsErrorExpiredCreds(r.Error) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go deleted file mode 100644 index 09a44eb98..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go +++ /dev/null @@ -1,94 +0,0 @@ -package request - -import ( - "io" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -var timeoutErr = awserr.New( - ErrCodeResponseTimeout, - "read on body has reached the timeout limit", - nil, -) - -type readResult struct { - n int - err error -} - -// timeoutReadCloser will handle body reads that take too long. -// We will return a ErrReadTimeout error if a timeout occurs. -type timeoutReadCloser struct { - reader io.ReadCloser - duration time.Duration -} - -// Read will spin off a goroutine to call the reader's Read method. We will -// select on the timer's channel or the read's channel. Whoever completes first -// will be returned. -func (r *timeoutReadCloser) Read(b []byte) (int, error) { - timer := time.NewTimer(r.duration) - c := make(chan readResult, 1) - - go func() { - n, err := r.reader.Read(b) - timer.Stop() - c <- readResult{n: n, err: err} - }() - - select { - case data := <-c: - return data.n, data.err - case <-timer.C: - return 0, timeoutErr - } -} - -func (r *timeoutReadCloser) Close() error { - return r.reader.Close() -} - -const ( - // HandlerResponseTimeout is what we use to signify the name of the - // response timeout handler. - HandlerResponseTimeout = "ResponseTimeoutHandler" -) - -// adaptToResponseTimeoutError is a handler that will replace any top level error -// to a ErrCodeResponseTimeout, if its child is that. -func adaptToResponseTimeoutError(req *Request) { - if err, ok := req.Error.(awserr.Error); ok { - aerr, ok := err.OrigErr().(awserr.Error) - if ok && aerr.Code() == ErrCodeResponseTimeout { - req.Error = aerr - } - } -} - -// WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. -// This will allow for per read timeouts. If a timeout occurred, we will return the -// ErrCodeResponseTimeout. -// -// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) -func WithResponseReadTimeout(duration time.Duration) Option { - return func(r *Request) { - - var timeoutHandler = NamedHandler{ - HandlerResponseTimeout, - func(req *Request) { - req.HTTPResponse.Body = &timeoutReadCloser{ - reader: req.HTTPResponse.Body, - duration: duration, - } - }} - - // remove the handler so we are not stomping over any new durations. - r.Handlers.Send.RemoveByName(HandlerResponseTimeout) - r.Handlers.Send.PushBackNamed(timeoutHandler) - - r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) - r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go deleted file mode 100644 index 8630683f3..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go +++ /dev/null @@ -1,286 +0,0 @@ -package request - -import ( - "bytes" - "fmt" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -const ( - // InvalidParameterErrCode is the error code for invalid parameters errors - InvalidParameterErrCode = "InvalidParameter" - // ParamRequiredErrCode is the error code for required parameter errors - ParamRequiredErrCode = "ParamRequiredError" - // ParamMinValueErrCode is the error code for fields with too low of a - // number value. - ParamMinValueErrCode = "ParamMinValueError" - // ParamMinLenErrCode is the error code for fields without enough elements. - ParamMinLenErrCode = "ParamMinLenError" - // ParamMaxLenErrCode is the error code for value being too long. - ParamMaxLenErrCode = "ParamMaxLenError" - - // ParamFormatErrCode is the error code for a field with invalid - // format or characters. - ParamFormatErrCode = "ParamFormatInvalidError" -) - -// Validator provides a way for types to perform validation logic on their -// input values that external code can use to determine if a type's values -// are valid. -type Validator interface { - Validate() error -} - -// An ErrInvalidParams provides wrapping of invalid parameter errors found when -// validating API operation input parameters. -type ErrInvalidParams struct { - // Context is the base context of the invalid parameter group. - Context string - errs []ErrInvalidParam -} - -// Add adds a new invalid parameter error to the collection of invalid -// parameters. The context of the invalid parameter will be updated to reflect -// this collection. -func (e *ErrInvalidParams) Add(err ErrInvalidParam) { - err.SetContext(e.Context) - e.errs = append(e.errs, err) -} - -// AddNested adds the invalid parameter errors from another ErrInvalidParams -// value into this collection. The nested errors will have their nested context -// updated and base context to reflect the merging. -// -// Use for nested validations errors. -func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams) { - for _, err := range nested.errs { - err.SetContext(e.Context) - err.AddNestedContext(nestedCtx) - e.errs = append(e.errs, err) - } -} - -// Len returns the number of invalid parameter errors -func (e ErrInvalidParams) Len() int { - return len(e.errs) -} - -// Code returns the code of the error -func (e ErrInvalidParams) Code() string { - return InvalidParameterErrCode -} - -// Message returns the message of the error -func (e ErrInvalidParams) Message() string { - return fmt.Sprintf("%d validation error(s) found.", len(e.errs)) -} - -// Error returns the string formatted form of the invalid parameters. -func (e ErrInvalidParams) Error() string { - w := &bytes.Buffer{} - fmt.Fprintf(w, "%s: %s\n", e.Code(), e.Message()) - - for _, err := range e.errs { - fmt.Fprintf(w, "- %s\n", err.Message()) - } - - return w.String() -} - -// OrigErr returns the invalid parameters as a awserr.BatchedErrors value -func (e ErrInvalidParams) OrigErr() error { - return awserr.NewBatchError( - InvalidParameterErrCode, e.Message(), e.OrigErrs()) -} - -// OrigErrs returns a slice of the invalid parameters -func (e ErrInvalidParams) OrigErrs() []error { - errs := make([]error, len(e.errs)) - for i := 0; i < len(errs); i++ { - errs[i] = e.errs[i] - } - - return errs -} - -// An ErrInvalidParam represents an invalid parameter error type. -type ErrInvalidParam interface { - awserr.Error - - // Field name the error occurred on. - Field() string - - // SetContext updates the context of the error. - SetContext(string) - - // AddNestedContext updates the error's context to include a nested level. - AddNestedContext(string) -} - -type errInvalidParam struct { - context string - nestedContext string - field string - code string - msg string -} - -// Code returns the error code for the type of invalid parameter. -func (e *errInvalidParam) Code() string { - return e.code -} - -// Message returns the reason the parameter was invalid, and its context. -func (e *errInvalidParam) Message() string { - return fmt.Sprintf("%s, %s.", e.msg, e.Field()) -} - -// Error returns the string version of the invalid parameter error. -func (e *errInvalidParam) Error() string { - return fmt.Sprintf("%s: %s", e.code, e.Message()) -} - -// OrigErr returns nil, Implemented for awserr.Error interface. -func (e *errInvalidParam) OrigErr() error { - return nil -} - -// Field Returns the field and context the error occurred. -func (e *errInvalidParam) Field() string { - field := e.context - if len(field) > 0 { - field += "." - } - if len(e.nestedContext) > 0 { - field += fmt.Sprintf("%s.", e.nestedContext) - } - field += e.field - - return field -} - -// SetContext updates the base context of the error. -func (e *errInvalidParam) SetContext(ctx string) { - e.context = ctx -} - -// AddNestedContext prepends a context to the field's path. -func (e *errInvalidParam) AddNestedContext(ctx string) { - if len(e.nestedContext) == 0 { - e.nestedContext = ctx - } else { - e.nestedContext = fmt.Sprintf("%s.%s", ctx, e.nestedContext) - } - -} - -// An ErrParamRequired represents an required parameter error. -type ErrParamRequired struct { - errInvalidParam -} - -// NewErrParamRequired creates a new required parameter error. -func NewErrParamRequired(field string) *ErrParamRequired { - return &ErrParamRequired{ - errInvalidParam{ - code: ParamRequiredErrCode, - field: field, - msg: fmt.Sprintf("missing required field"), - }, - } -} - -// An ErrParamMinValue represents a minimum value parameter error. -type ErrParamMinValue struct { - errInvalidParam - min float64 -} - -// NewErrParamMinValue creates a new minimum value parameter error. -func NewErrParamMinValue(field string, min float64) *ErrParamMinValue { - return &ErrParamMinValue{ - errInvalidParam: errInvalidParam{ - code: ParamMinValueErrCode, - field: field, - msg: fmt.Sprintf("minimum field value of %v", min), - }, - min: min, - } -} - -// MinValue returns the field's require minimum value. -// -// float64 is returned for both int and float min values. -func (e *ErrParamMinValue) MinValue() float64 { - return e.min -} - -// An ErrParamMinLen represents a minimum length parameter error. -type ErrParamMinLen struct { - errInvalidParam - min int -} - -// NewErrParamMinLen creates a new minimum length parameter error. -func NewErrParamMinLen(field string, min int) *ErrParamMinLen { - return &ErrParamMinLen{ - errInvalidParam: errInvalidParam{ - code: ParamMinLenErrCode, - field: field, - msg: fmt.Sprintf("minimum field size of %v", min), - }, - min: min, - } -} - -// MinLen returns the field's required minimum length. -func (e *ErrParamMinLen) MinLen() int { - return e.min -} - -// An ErrParamMaxLen represents a maximum length parameter error. -type ErrParamMaxLen struct { - errInvalidParam - max int -} - -// NewErrParamMaxLen creates a new maximum length parameter error. -func NewErrParamMaxLen(field string, max int, value string) *ErrParamMaxLen { - return &ErrParamMaxLen{ - errInvalidParam: errInvalidParam{ - code: ParamMaxLenErrCode, - field: field, - msg: fmt.Sprintf("maximum size of %v, %v", max, value), - }, - max: max, - } -} - -// MaxLen returns the field's required minimum length. -func (e *ErrParamMaxLen) MaxLen() int { - return e.max -} - -// An ErrParamFormat represents a invalid format parameter error. -type ErrParamFormat struct { - errInvalidParam - format string -} - -// NewErrParamFormat creates a new invalid format parameter error. -func NewErrParamFormat(field string, format, value string) *ErrParamFormat { - return &ErrParamFormat{ - errInvalidParam: errInvalidParam{ - code: ParamFormatErrCode, - field: field, - msg: fmt.Sprintf("format %v, %v", format, value), - }, - format: format, - } -} - -// Format returns the field's required format. -func (e *ErrParamFormat) Format() string { - return e.format -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go b/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go deleted file mode 100644 index 4601f883c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go +++ /dev/null @@ -1,295 +0,0 @@ -package request - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" -) - -// WaiterResourceNotReadyErrorCode is the error code returned by a waiter when -// the waiter's max attempts have been exhausted. -const WaiterResourceNotReadyErrorCode = "ResourceNotReady" - -// A WaiterOption is a function that will update the Waiter value's fields to -// configure the waiter. -type WaiterOption func(*Waiter) - -// WithWaiterMaxAttempts returns the maximum number of times the waiter should -// attempt to check the resource for the target state. -func WithWaiterMaxAttempts(max int) WaiterOption { - return func(w *Waiter) { - w.MaxAttempts = max - } -} - -// WaiterDelay will return a delay the waiter should pause between attempts to -// check the resource state. The passed in attempt is the number of times the -// Waiter has checked the resource state. -// -// Attempt is the number of attempts the Waiter has made checking the resource -// state. -type WaiterDelay func(attempt int) time.Duration - -// ConstantWaiterDelay returns a WaiterDelay that will always return a constant -// delay the waiter should use between attempts. It ignores the number of -// attempts made. -func ConstantWaiterDelay(delay time.Duration) WaiterDelay { - return func(attempt int) time.Duration { - return delay - } -} - -// WithWaiterDelay will set the Waiter to use the WaiterDelay passed in. -func WithWaiterDelay(delayer WaiterDelay) WaiterOption { - return func(w *Waiter) { - w.Delay = delayer - } -} - -// WithWaiterLogger returns a waiter option to set the logger a waiter -// should use to log warnings and errors to. -func WithWaiterLogger(logger aws.Logger) WaiterOption { - return func(w *Waiter) { - w.Logger = logger - } -} - -// WithWaiterRequestOptions returns a waiter option setting the request -// options for each request the waiter makes. Appends to waiter's request -// options already set. -func WithWaiterRequestOptions(opts ...Option) WaiterOption { - return func(w *Waiter) { - w.RequestOptions = append(w.RequestOptions, opts...) - } -} - -// A Waiter provides the functionality to perform a blocking call which will -// wait for a resource state to be satisfied by a service. -// -// This type should not be used directly. The API operations provided in the -// service packages prefixed with "WaitUntil" should be used instead. -type Waiter struct { - Name string - Acceptors []WaiterAcceptor - Logger aws.Logger - - MaxAttempts int - Delay WaiterDelay - - RequestOptions []Option - NewRequest func([]Option) (*Request, error) - SleepWithContext func(aws.Context, time.Duration) error -} - -// ApplyOptions updates the waiter with the list of waiter options provided. -func (w *Waiter) ApplyOptions(opts ...WaiterOption) { - for _, fn := range opts { - fn(w) - } -} - -// WaiterState are states the waiter uses based on WaiterAcceptor definitions -// to identify if the resource state the waiter is waiting on has occurred. -type WaiterState int - -// String returns the string representation of the waiter state. -func (s WaiterState) String() string { - switch s { - case SuccessWaiterState: - return "success" - case FailureWaiterState: - return "failure" - case RetryWaiterState: - return "retry" - default: - return "unknown waiter state" - } -} - -// States the waiter acceptors will use to identify target resource states. -const ( - SuccessWaiterState WaiterState = iota // waiter successful - FailureWaiterState // waiter failed - RetryWaiterState // waiter needs to be retried -) - -// WaiterMatchMode is the mode that the waiter will use to match the WaiterAcceptor -// definition's Expected attribute. -type WaiterMatchMode int - -// Modes the waiter will use when inspecting API response to identify target -// resource states. -const ( - PathAllWaiterMatch WaiterMatchMode = iota // match on all paths - PathWaiterMatch // match on specific path - PathAnyWaiterMatch // match on any path - PathListWaiterMatch // match on list of paths - StatusWaiterMatch // match on status code - ErrorWaiterMatch // match on error -) - -// String returns the string representation of the waiter match mode. -func (m WaiterMatchMode) String() string { - switch m { - case PathAllWaiterMatch: - return "pathAll" - case PathWaiterMatch: - return "path" - case PathAnyWaiterMatch: - return "pathAny" - case PathListWaiterMatch: - return "pathList" - case StatusWaiterMatch: - return "status" - case ErrorWaiterMatch: - return "error" - default: - return "unknown waiter match mode" - } -} - -// WaitWithContext will make requests for the API operation using NewRequest to -// build API requests. The request's response will be compared against the -// Waiter's Acceptors to determine the successful state of the resource the -// waiter is inspecting. -// -// The passed in context must not be nil. If it is nil a panic will occur. The -// Context will be used to cancel the waiter's pending requests and retry delays. -// Use aws.BackgroundContext if no context is available. -// -// The waiter will continue until the target state defined by the Acceptors, -// or the max attempts expires. -// -// Will return the WaiterResourceNotReadyErrorCode error code if the waiter's -// retryer ShouldRetry returns false. This normally will happen when the max -// wait attempts expires. -func (w Waiter) WaitWithContext(ctx aws.Context) error { - - for attempt := 1; ; attempt++ { - req, err := w.NewRequest(w.RequestOptions) - if err != nil { - waiterLogf(w.Logger, "unable to create request %v", err) - return err - } - req.Handlers.Build.PushBack(MakeAddToUserAgentFreeFormHandler("Waiter")) - err = req.Send() - - // See if any of the acceptors match the request's response, or error - for _, a := range w.Acceptors { - if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched { - return matchErr - } - } - - // The Waiter should only check the resource state MaxAttempts times - // This is here instead of in the for loop above to prevent delaying - // unnecessary when the waiter will not retry. - if attempt == w.MaxAttempts { - break - } - - // Delay to wait before inspecting the resource again - delay := w.Delay(attempt) - if sleepFn := req.Config.SleepDelay; sleepFn != nil { - // Support SleepDelay for backwards compatibility and testing - sleepFn(delay) - } else { - sleepCtxFn := w.SleepWithContext - if sleepCtxFn == nil { - sleepCtxFn = aws.SleepWithContext - } - - if err := sleepCtxFn(ctx, delay); err != nil { - return awserr.New(CanceledErrorCode, "waiter context canceled", err) - } - } - } - - return awserr.New(WaiterResourceNotReadyErrorCode, "exceeded wait attempts", nil) -} - -// A WaiterAcceptor provides the information needed to wait for an API operation -// to complete. -type WaiterAcceptor struct { - State WaiterState - Matcher WaiterMatchMode - Argument string - Expected interface{} -} - -// match returns if the acceptor found a match with the passed in request -// or error. True is returned if the acceptor made a match, error is returned -// if there was an error attempting to perform the match. -func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err error) (bool, error) { - result := false - var vals []interface{} - - switch a.Matcher { - case PathAllWaiterMatch, PathWaiterMatch: - // Require all matches to be equal for result to match - vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) - if len(vals) == 0 { - break - } - result = true - for _, val := range vals { - if !awsutil.DeepEqual(val, a.Expected) { - result = false - break - } - } - case PathAnyWaiterMatch: - // Only a single match needs to equal for the result to match - vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) - for _, val := range vals { - if awsutil.DeepEqual(val, a.Expected) { - result = true - break - } - } - case PathListWaiterMatch: - // ignored matcher - case StatusWaiterMatch: - s := a.Expected.(int) - result = s == req.HTTPResponse.StatusCode - case ErrorWaiterMatch: - if aerr, ok := err.(awserr.Error); ok { - result = aerr.Code() == a.Expected.(string) - } - default: - waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s", - name, a.Matcher) - } - - if !result { - // If there was no matching result found there is nothing more to do - // for this response, retry the request. - return false, nil - } - - switch a.State { - case SuccessWaiterState: - // waiter completed - return true, nil - case FailureWaiterState: - // Waiter failure state triggered - return true, awserr.New(WaiterResourceNotReadyErrorCode, - "failed waiting for successful resource state", err) - case RetryWaiterState: - // clear the error and retry the operation - return false, nil - default: - waiterLogf(l, "WARNING: Waiter %s encountered unexpected state: %s", - name, a.State) - return false, nil - } -} - -func waiterLogf(logger aws.Logger, msg string, args ...interface{}) { - if logger != nil { - logger.Log(fmt.Sprintf(msg, args...)) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go deleted file mode 100644 index ea9ebb6f6..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go +++ /dev/null @@ -1,26 +0,0 @@ -// +build go1.7 - -package session - -import ( - "net" - "net/http" - "time" -) - -// Transport that should be used when a custom CA bundle is specified with the -// SDK. -func getCABundleTransport() *http.Transport { - return &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go deleted file mode 100644 index fec39dfc1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go +++ /dev/null @@ -1,22 +0,0 @@ -// +build !go1.6,go1.5 - -package session - -import ( - "net" - "net/http" - "time" -) - -// Transport that should be used when a custom CA bundle is specified with the -// SDK. -func getCABundleTransport() *http.Transport { - return &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - TLSHandshakeTimeout: 10 * time.Second, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go deleted file mode 100644 index 1c5a5391e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build !go1.7,go1.6 - -package session - -import ( - "net" - "net/http" - "time" -) - -// Transport that should be used when a custom CA bundle is specified with the -// SDK. -func getCABundleTransport() *http.Transport { - return &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go deleted file mode 100644 index fe6dac1f4..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go +++ /dev/null @@ -1,267 +0,0 @@ -package session - -import ( - "fmt" - "os" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/processcreds" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -func resolveCredentials(cfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) (*credentials.Credentials, error) { - - switch { - case len(sessOpts.Profile) != 0: - // User explicitly provided an Profile in the session's configuration - // so load that profile from shared config first. - // Github(aws/aws-sdk-go#2727) - return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) - - case envCfg.Creds.HasKeys(): - // Environment credentials - return credentials.NewStaticCredentialsFromCreds(envCfg.Creds), nil - - case len(envCfg.WebIdentityTokenFilePath) != 0: - // Web identity token from environment, RoleARN required to also be - // set. - return assumeWebIdentity(cfg, handlers, - envCfg.WebIdentityTokenFilePath, - envCfg.RoleARN, - envCfg.RoleSessionName, - ) - - default: - // Fallback to the "default" credential resolution chain. - return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) - } -} - -// WebIdentityEmptyRoleARNErr will occur if 'AWS_WEB_IDENTITY_TOKEN_FILE' was set but -// 'AWS_ROLE_ARN' was not set. -var WebIdentityEmptyRoleARNErr = awserr.New(stscreds.ErrCodeWebIdentity, "role ARN is not set", nil) - -// WebIdentityEmptyTokenFilePathErr will occur if 'AWS_ROLE_ARN' was set but -// 'AWS_WEB_IDENTITY_TOKEN_FILE' was not set. -var WebIdentityEmptyTokenFilePathErr = awserr.New(stscreds.ErrCodeWebIdentity, "token file path is not set", nil) - -func assumeWebIdentity(cfg *aws.Config, handlers request.Handlers, - filepath string, - roleARN, sessionName string, -) (*credentials.Credentials, error) { - - if len(filepath) == 0 { - return nil, WebIdentityEmptyTokenFilePathErr - } - - if len(roleARN) == 0 { - return nil, WebIdentityEmptyRoleARNErr - } - - creds := stscreds.NewWebIdentityCredentials( - &Session{ - Config: cfg, - Handlers: handlers.Copy(), - }, - roleARN, - sessionName, - filepath, - ) - - return creds, nil -} - -func resolveCredsFromProfile(cfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) (creds *credentials.Credentials, err error) { - - switch { - case sharedCfg.SourceProfile != nil: - // Assume IAM role with credentials source from a different profile. - creds, err = resolveCredsFromProfile(cfg, envCfg, - *sharedCfg.SourceProfile, handlers, sessOpts, - ) - - case sharedCfg.Creds.HasKeys(): - // Static Credentials from Shared Config/Credentials file. - creds = credentials.NewStaticCredentialsFromCreds( - sharedCfg.Creds, - ) - - case len(sharedCfg.CredentialProcess) != 0: - // Get credentials from CredentialProcess - creds = processcreds.NewCredentials(sharedCfg.CredentialProcess) - - case len(sharedCfg.CredentialSource) != 0: - creds, err = resolveCredsFromSource(cfg, envCfg, - sharedCfg, handlers, sessOpts, - ) - - case len(sharedCfg.WebIdentityTokenFile) != 0: - // Credentials from Assume Web Identity token require an IAM Role, and - // that roll will be assumed. May be wrapped with another assume role - // via SourceProfile. - return assumeWebIdentity(cfg, handlers, - sharedCfg.WebIdentityTokenFile, - sharedCfg.RoleARN, - sharedCfg.RoleSessionName, - ) - - default: - // Fallback to default credentials provider, include mock errors for - // the credential chain so user can identify why credentials failed to - // be retrieved. - creds = credentials.NewCredentials(&credentials.ChainProvider{ - VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), - Providers: []credentials.Provider{ - &credProviderError{ - Err: awserr.New("EnvAccessKeyNotFound", - "failed to find credentials in the environment.", nil), - }, - &credProviderError{ - Err: awserr.New("SharedCredsLoad", - fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil), - }, - defaults.RemoteCredProvider(*cfg, handlers), - }, - }) - } - if err != nil { - return nil, err - } - - if len(sharedCfg.RoleARN) > 0 { - cfgCp := *cfg - cfgCp.Credentials = creds - return credsFromAssumeRole(cfgCp, handlers, sharedCfg, sessOpts) - } - - return creds, nil -} - -// valid credential source values -const ( - credSourceEc2Metadata = "Ec2InstanceMetadata" - credSourceEnvironment = "Environment" - credSourceECSContainer = "EcsContainer" -) - -func resolveCredsFromSource(cfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) (creds *credentials.Credentials, err error) { - - switch sharedCfg.CredentialSource { - case credSourceEc2Metadata: - p := defaults.RemoteCredProvider(*cfg, handlers) - creds = credentials.NewCredentials(p) - - case credSourceEnvironment: - creds = credentials.NewStaticCredentialsFromCreds(envCfg.Creds) - - case credSourceECSContainer: - if len(os.Getenv(shareddefaults.ECSCredsProviderEnvVar)) == 0 { - return nil, ErrSharedConfigECSContainerEnvVarEmpty - } - - p := defaults.RemoteCredProvider(*cfg, handlers) - creds = credentials.NewCredentials(p) - - default: - return nil, ErrSharedConfigInvalidCredSource - } - - return creds, nil -} - -func credsFromAssumeRole(cfg aws.Config, - handlers request.Handlers, - sharedCfg sharedConfig, - sessOpts Options, -) (*credentials.Credentials, error) { - - if len(sharedCfg.MFASerial) != 0 && sessOpts.AssumeRoleTokenProvider == nil { - // AssumeRole Token provider is required if doing Assume Role - // with MFA. - return nil, AssumeRoleTokenProviderNotSetError{} - } - - return stscreds.NewCredentials( - &Session{ - Config: &cfg, - Handlers: handlers.Copy(), - }, - sharedCfg.RoleARN, - func(opt *stscreds.AssumeRoleProvider) { - opt.RoleSessionName = sharedCfg.RoleSessionName - - if sessOpts.AssumeRoleDuration == 0 && - sharedCfg.AssumeRoleDuration != nil && - *sharedCfg.AssumeRoleDuration/time.Minute > 15 { - opt.Duration = *sharedCfg.AssumeRoleDuration - } else if sessOpts.AssumeRoleDuration != 0 { - opt.Duration = sessOpts.AssumeRoleDuration - } - - // Assume role with external ID - if len(sharedCfg.ExternalID) > 0 { - opt.ExternalID = aws.String(sharedCfg.ExternalID) - } - - // Assume role with MFA - if len(sharedCfg.MFASerial) > 0 { - opt.SerialNumber = aws.String(sharedCfg.MFASerial) - opt.TokenProvider = sessOpts.AssumeRoleTokenProvider - } - }, - ), nil -} - -// AssumeRoleTokenProviderNotSetError is an error returned when creating a -// session when the MFAToken option is not set when shared config is configured -// load assume a role with an MFA token. -type AssumeRoleTokenProviderNotSetError struct{} - -// Code is the short id of the error. -func (e AssumeRoleTokenProviderNotSetError) Code() string { - return "AssumeRoleTokenProviderNotSetError" -} - -// Message is the description of the error -func (e AssumeRoleTokenProviderNotSetError) Message() string { - return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") -} - -// OrigErr is the underlying error that caused the failure. -func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e AssumeRoleTokenProviderNotSetError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} - -type credProviderError struct { - Err error -} - -func (c credProviderError) Retrieve() (credentials.Value, error) { - return credentials.Value{}, c.Err -} -func (c credProviderError) IsExpired() bool { - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go deleted file mode 100644 index 7ec66e7e5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ /dev/null @@ -1,245 +0,0 @@ -/* -Package session provides configuration for the SDK's service clients. Sessions -can be shared across service clients that share the same base configuration. - -Sessions are safe to use concurrently as long as the Session is not being -modified. Sessions should be cached when possible, because creating a new -Session will load all configuration values from the environment, and config -files each time the Session is created. Sharing the Session value across all of -your service clients will ensure the configuration is loaded the fewest number -of times possible. - -Sessions options from Shared Config - -By default NewSession will only load credentials from the shared credentials -file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is -set to a truthy value the Session will be created from the configuration -values from the shared config (~/.aws/config) and shared credentials -(~/.aws/credentials) files. Using the NewSessionWithOptions with -SharedConfigState set to SharedConfigEnable will create the session as if the -AWS_SDK_LOAD_CONFIG environment variable was set. - -Credential and config loading order - -The Session will attempt to load configuration and credentials from the -environment, configuration files, and other credential sources. The order -configuration is loaded in is: - - * Environment Variables - * Shared Credentials file - * Shared Configuration file (if SharedConfig is enabled) - * EC2 Instance Metadata (credentials only) - -The Environment variables for credentials will have precedence over shared -config even if SharedConfig is enabled. To override this behavior, and use -shared config credentials instead specify the session.Options.Profile, (e.g. -when using credential_source=Environment to assume a role). - - sess, err := session.NewSessionWithOptions(session.Options{ - Profile: "myProfile", - }) - -Creating Sessions - -Creating a Session without additional options will load credentials region, and -profile loaded from the environment and shared config automatically. See, -"Environment Variables" section for information on environment variables used -by Session. - - // Create Session - sess, err := session.NewSession() - - -When creating Sessions optional aws.Config values can be passed in that will -override the default, or loaded, config values the Session is being created -with. This allows you to provide additional, or case based, configuration -as needed. - - // Create a Session with a custom region - sess, err := session.NewSession(&aws.Config{ - Region: aws.String("us-west-2"), - }) - -Use NewSessionWithOptions to provide additional configuration driving how the -Session's configuration will be loaded. Such as, specifying shared config -profile, or override the shared config state, (AWS_SDK_LOAD_CONFIG). - - // Equivalent to session.NewSession() - sess, err := session.NewSessionWithOptions(session.Options{ - // Options - }) - - sess, err := session.NewSessionWithOptions(session.Options{ - // Specify profile to load for the session's config - Profile: "profile_name", - - // Provide SDK Config options, such as Region. - Config: aws.Config{ - Region: aws.String("us-west-2"), - }, - - // Force enable Shared Config support - SharedConfigState: session.SharedConfigEnable, - }) - -Adding Handlers - -You can add handlers to a session to decorate API operation, (e.g. adding HTTP -headers). All clients that use the Session receive a copy of the Session's -handlers. For example, the following request handler added to the Session logs -every requests made. - - // Create a session, and add additional handlers for all service - // clients created with the Session to inherit. Adds logging handler. - sess := session.Must(session.NewSession()) - - sess.Handlers.Send.PushFront(func(r *request.Request) { - // Log every request made and its payload - logger.Printf("Request: %s/%s, Params: %s", - r.ClientInfo.ServiceName, r.Operation, r.Params) - }) - -Shared Config Fields - -By default the SDK will only load the shared credentials file's -(~/.aws/credentials) credentials values, and all other config is provided by -the environment variables, SDK defaults, and user provided aws.Config values. - -If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnable -option is used to create the Session the full shared config values will be -loaded. This includes credentials, region, and support for assume role. In -addition the Session will load its configuration from both the shared config -file (~/.aws/config) and shared credentials file (~/.aws/credentials). Both -files have the same format. - -If both config files are present the configuration from both files will be -read. The Session will be created from configuration values from the shared -credentials file (~/.aws/credentials) over those in the shared config file -(~/.aws/config). - -Credentials are the values the SDK uses to authenticating requests with AWS -Services. When specified in a file, both aws_access_key_id and -aws_secret_access_key must be provided together in the same file to be -considered valid. They will be ignored if both are not present. -aws_session_token is an optional field that can be provided in addition to the -other two fields. - - aws_access_key_id = AKID - aws_secret_access_key = SECRET - aws_session_token = TOKEN - - ; region only supported if SharedConfigEnabled. - region = us-east-1 - -Assume Role configuration - -The role_arn field allows you to configure the SDK to assume an IAM role using -a set of credentials from another source. Such as when paired with static -credentials, "profile_source", "credential_process", or "credential_source" -fields. If "role_arn" is provided, a source of credentials must also be -specified, such as "source_profile", "credential_source", or -"credential_process". - - role_arn = arn:aws:iam:::role/ - source_profile = profile_with_creds - external_id = 1234 - mfa_serial = - role_session_name = session_name - - -The SDK supports assuming a role with MFA token. If "mfa_serial" is set, you -must also set the Session Option.AssumeRoleTokenProvider. The Session will fail -to load if the AssumeRoleTokenProvider is not specified. - - sess := session.Must(session.NewSessionWithOptions(session.Options{ - AssumeRoleTokenProvider: stscreds.StdinTokenProvider, - })) - -To setup Assume Role outside of a session see the stscreds.AssumeRoleProvider -documentation. - -Environment Variables - -When a Session is created several environment variables can be set to adjust -how the SDK functions, and what configuration data it loads when creating -Sessions. All environment values are optional, but some values like credentials -require multiple of the values to set or the partial values will be ignored. -All environment variable values are strings unless otherwise noted. - -Environment configuration values. If set both Access Key ID and Secret Access -Key must be provided. Session Token and optionally also be provided, but is -not required. - - # Access Key ID - AWS_ACCESS_KEY_ID=AKID - AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. - - # Secret Access Key - AWS_SECRET_ACCESS_KEY=SECRET - AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. - - # Session Token - AWS_SESSION_TOKEN=TOKEN - -Region value will instruct the SDK where to make service API requests to. If is -not provided in the environment the region must be provided before a service -client request is made. - - AWS_REGION=us-east-1 - - # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, - # and AWS_REGION is not also set. - AWS_DEFAULT_REGION=us-east-1 - -Profile name the SDK should load use when loading shared config from the -configuration files. If not provided "default" will be used as the profile name. - - AWS_PROFILE=my_profile - - # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, - # and AWS_PROFILE is not also set. - AWS_DEFAULT_PROFILE=my_profile - -SDK load config instructs the SDK to load the shared config in addition to -shared credentials. This also expands the configuration loaded so the shared -credentials will have parity with the shared config file. This also enables -Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE -env values as well. - - AWS_SDK_LOAD_CONFIG=1 - -Shared credentials file path can be set to instruct the SDK to use an alternative -file for the shared credentials. If not set the file will be loaded from -$HOME/.aws/credentials on Linux/Unix based systems, and -%USERPROFILE%\.aws\credentials on Windows. - - AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials - -Shared config file path can be set to instruct the SDK to use an alternative -file for the shared config. If not set the file will be loaded from -$HOME/.aws/config on Linux/Unix based systems, and -%USERPROFILE%\.aws\config on Windows. - - AWS_CONFIG_FILE=$HOME/my_shared_config - -Path to a custom Credentials Authority (CA) bundle PEM file that the SDK -will use instead of the default system's root CA bundle. Use this only -if you want to replace the CA bundle the SDK uses for TLS requests. - - AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle - -Enabling this option will attempt to merge the Transport into the SDK's HTTP -client. If the client's Transport is not a http.Transport an error will be -returned. If the Transport's TLS config is set this option will cause the SDK -to overwrite the Transport's TLS config's RootCAs value. If the CA bundle file -contains multiple certificates all of them will be loaded. - -The Session option CustomCABundle is also available when creating sessions -to also enable this feature. CustomCABundle session option field has priority -over the AWS_CA_BUNDLE environment variable, and will be used if both are set. - -Setting a custom HTTPClient in the aws.Config options will override this setting. -To use this option and custom HTTP client, the HTTP client needs to be provided -when creating the session. Not the service client. -*/ -package session diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go deleted file mode 100644 index c1e0e9c95..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ /dev/null @@ -1,345 +0,0 @@ -package session - -import ( - "fmt" - "os" - "strconv" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/endpoints" -) - -// EnvProviderName provides a name of the provider when config is loaded from environment. -const EnvProviderName = "EnvConfigCredentials" - -// envConfig is a collection of environment values the SDK will read -// setup config from. All environment values are optional. But some values -// such as credentials require multiple values to be complete or the values -// will be ignored. -type envConfig struct { - // Environment configuration values. If set both Access Key ID and Secret Access - // Key must be provided. Session Token and optionally also be provided, but is - // not required. - // - // # Access Key ID - // AWS_ACCESS_KEY_ID=AKID - // AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. - // - // # Secret Access Key - // AWS_SECRET_ACCESS_KEY=SECRET - // AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. - // - // # Session Token - // AWS_SESSION_TOKEN=TOKEN - Creds credentials.Value - - // Region value will instruct the SDK where to make service API requests to. If is - // not provided in the environment the region must be provided before a service - // client request is made. - // - // AWS_REGION=us-east-1 - // - // # AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set, - // # and AWS_REGION is not also set. - // AWS_DEFAULT_REGION=us-east-1 - Region string - - // Profile name the SDK should load use when loading shared configuration from the - // shared configuration files. If not provided "default" will be used as the - // profile name. - // - // AWS_PROFILE=my_profile - // - // # AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set, - // # and AWS_PROFILE is not also set. - // AWS_DEFAULT_PROFILE=my_profile - Profile string - - // SDK load config instructs the SDK to load the shared config in addition to - // shared credentials. This also expands the configuration loaded from the shared - // credentials to have parity with the shared config file. This also enables - // Region and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE - // env values as well. - // - // AWS_SDK_LOAD_CONFIG=1 - EnableSharedConfig bool - - // Shared credentials file path can be set to instruct the SDK to use an alternate - // file for the shared credentials. If not set the file will be loaded from - // $HOME/.aws/credentials on Linux/Unix based systems, and - // %USERPROFILE%\.aws\credentials on Windows. - // - // AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials - SharedCredentialsFile string - - // Shared config file path can be set to instruct the SDK to use an alternate - // file for the shared config. If not set the file will be loaded from - // $HOME/.aws/config on Linux/Unix based systems, and - // %USERPROFILE%\.aws\config on Windows. - // - // AWS_CONFIG_FILE=$HOME/my_shared_config - SharedConfigFile string - - // Sets the path to a custom Credentials Authority (CA) Bundle PEM file - // that the SDK will use instead of the system's root CA bundle. - // Only use this if you want to configure the SDK to use a custom set - // of CAs. - // - // Enabling this option will attempt to merge the Transport - // into the SDK's HTTP client. If the client's Transport is - // not a http.Transport an error will be returned. If the - // Transport's TLS config is set this option will cause the - // SDK to overwrite the Transport's TLS config's RootCAs value. - // - // Setting a custom HTTPClient in the aws.Config options will override this setting. - // To use this option and custom HTTP client, the HTTP client needs to be provided - // when creating the session. Not the service client. - // - // AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle - CustomCABundle string - - csmEnabled string - CSMEnabled *bool - CSMPort string - CSMHost string - CSMClientID string - - // Enables endpoint discovery via environment variables. - // - // AWS_ENABLE_ENDPOINT_DISCOVERY=true - EnableEndpointDiscovery *bool - enableEndpointDiscovery string - - // Specifies the WebIdentity token the SDK should use to assume a role - // with. - // - // AWS_WEB_IDENTITY_TOKEN_FILE=file_path - WebIdentityTokenFilePath string - - // Specifies the IAM role arn to use when assuming an role. - // - // AWS_ROLE_ARN=role_arn - RoleARN string - - // Specifies the IAM role session name to use when assuming a role. - // - // AWS_ROLE_SESSION_NAME=session_name - RoleSessionName string - - // Specifies the STS Regional Endpoint flag for the SDK to resolve the endpoint - // for a service. - // - // AWS_STS_REGIONAL_ENDPOINTS=regional - // This can take value as `regional` or `legacy` - STSRegionalEndpoint endpoints.STSRegionalEndpoint - - // Specifies the S3 Regional Endpoint flag for the SDK to resolve the - // endpoint for a service. - // - // AWS_S3_US_EAST_1_REGIONAL_ENDPOINT=regional - // This can take value as `regional` or `legacy` - S3UsEast1RegionalEndpoint endpoints.S3UsEast1RegionalEndpoint - - // Specifies if the S3 service should allow ARNs to direct the region - // the client's requests are sent to. - // - // AWS_S3_USE_ARN_REGION=true - S3UseARNRegion bool -} - -var ( - csmEnabledEnvKey = []string{ - "AWS_CSM_ENABLED", - } - csmHostEnvKey = []string{ - "AWS_CSM_HOST", - } - csmPortEnvKey = []string{ - "AWS_CSM_PORT", - } - csmClientIDEnvKey = []string{ - "AWS_CSM_CLIENT_ID", - } - credAccessEnvKey = []string{ - "AWS_ACCESS_KEY_ID", - "AWS_ACCESS_KEY", - } - credSecretEnvKey = []string{ - "AWS_SECRET_ACCESS_KEY", - "AWS_SECRET_KEY", - } - credSessionEnvKey = []string{ - "AWS_SESSION_TOKEN", - } - - enableEndpointDiscoveryEnvKey = []string{ - "AWS_ENABLE_ENDPOINT_DISCOVERY", - } - - regionEnvKeys = []string{ - "AWS_REGION", - "AWS_DEFAULT_REGION", // Only read if AWS_SDK_LOAD_CONFIG is also set - } - profileEnvKeys = []string{ - "AWS_PROFILE", - "AWS_DEFAULT_PROFILE", // Only read if AWS_SDK_LOAD_CONFIG is also set - } - sharedCredsFileEnvKey = []string{ - "AWS_SHARED_CREDENTIALS_FILE", - } - sharedConfigFileEnvKey = []string{ - "AWS_CONFIG_FILE", - } - webIdentityTokenFilePathEnvKey = []string{ - "AWS_WEB_IDENTITY_TOKEN_FILE", - } - roleARNEnvKey = []string{ - "AWS_ROLE_ARN", - } - roleSessionNameEnvKey = []string{ - "AWS_ROLE_SESSION_NAME", - } - stsRegionalEndpointKey = []string{ - "AWS_STS_REGIONAL_ENDPOINTS", - } - s3UsEast1RegionalEndpoint = []string{ - "AWS_S3_US_EAST_1_REGIONAL_ENDPOINT", - } - s3UseARNRegionEnvKey = []string{ - "AWS_S3_USE_ARN_REGION", - } -) - -// loadEnvConfig retrieves the SDK's environment configuration. -// See `envConfig` for the values that will be retrieved. -// -// If the environment variable `AWS_SDK_LOAD_CONFIG` is set to a truthy value -// the shared SDK config will be loaded in addition to the SDK's specific -// configuration values. -func loadEnvConfig() (envConfig, error) { - enableSharedConfig, _ := strconv.ParseBool(os.Getenv("AWS_SDK_LOAD_CONFIG")) - return envConfigLoad(enableSharedConfig) -} - -// loadEnvSharedConfig retrieves the SDK's environment configuration, and the -// SDK shared config. See `envConfig` for the values that will be retrieved. -// -// Loads the shared configuration in addition to the SDK's specific configuration. -// This will load the same values as `loadEnvConfig` if the `AWS_SDK_LOAD_CONFIG` -// environment variable is set. -func loadSharedEnvConfig() (envConfig, error) { - return envConfigLoad(true) -} - -func envConfigLoad(enableSharedConfig bool) (envConfig, error) { - cfg := envConfig{} - - cfg.EnableSharedConfig = enableSharedConfig - - // Static environment credentials - var creds credentials.Value - setFromEnvVal(&creds.AccessKeyID, credAccessEnvKey) - setFromEnvVal(&creds.SecretAccessKey, credSecretEnvKey) - setFromEnvVal(&creds.SessionToken, credSessionEnvKey) - if creds.HasKeys() { - // Require logical grouping of credentials - creds.ProviderName = EnvProviderName - cfg.Creds = creds - } - - // Role Metadata - setFromEnvVal(&cfg.RoleARN, roleARNEnvKey) - setFromEnvVal(&cfg.RoleSessionName, roleSessionNameEnvKey) - - // Web identity environment variables - setFromEnvVal(&cfg.WebIdentityTokenFilePath, webIdentityTokenFilePathEnvKey) - - // CSM environment variables - setFromEnvVal(&cfg.csmEnabled, csmEnabledEnvKey) - setFromEnvVal(&cfg.CSMHost, csmHostEnvKey) - setFromEnvVal(&cfg.CSMPort, csmPortEnvKey) - setFromEnvVal(&cfg.CSMClientID, csmClientIDEnvKey) - - if len(cfg.csmEnabled) != 0 { - v, _ := strconv.ParseBool(cfg.csmEnabled) - cfg.CSMEnabled = &v - } - - regionKeys := regionEnvKeys - profileKeys := profileEnvKeys - if !cfg.EnableSharedConfig { - regionKeys = regionKeys[:1] - profileKeys = profileKeys[:1] - } - - setFromEnvVal(&cfg.Region, regionKeys) - setFromEnvVal(&cfg.Profile, profileKeys) - - // endpoint discovery is in reference to it being enabled. - setFromEnvVal(&cfg.enableEndpointDiscovery, enableEndpointDiscoveryEnvKey) - if len(cfg.enableEndpointDiscovery) > 0 { - cfg.EnableEndpointDiscovery = aws.Bool(cfg.enableEndpointDiscovery != "false") - } - - setFromEnvVal(&cfg.SharedCredentialsFile, sharedCredsFileEnvKey) - setFromEnvVal(&cfg.SharedConfigFile, sharedConfigFileEnvKey) - - if len(cfg.SharedCredentialsFile) == 0 { - cfg.SharedCredentialsFile = defaults.SharedCredentialsFilename() - } - if len(cfg.SharedConfigFile) == 0 { - cfg.SharedConfigFile = defaults.SharedConfigFilename() - } - - cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE") - - var err error - // STS Regional Endpoint variable - for _, k := range stsRegionalEndpointKey { - if v := os.Getenv(k); len(v) != 0 { - cfg.STSRegionalEndpoint, err = endpoints.GetSTSRegionalEndpoint(v) - if err != nil { - return cfg, fmt.Errorf("failed to load, %v from env config, %v", k, err) - } - } - } - - // S3 Regional Endpoint variable - for _, k := range s3UsEast1RegionalEndpoint { - if v := os.Getenv(k); len(v) != 0 { - cfg.S3UsEast1RegionalEndpoint, err = endpoints.GetS3UsEast1RegionalEndpoint(v) - if err != nil { - return cfg, fmt.Errorf("failed to load, %v from env config, %v", k, err) - } - } - } - - var s3UseARNRegion string - setFromEnvVal(&s3UseARNRegion, s3UseARNRegionEnvKey) - if len(s3UseARNRegion) != 0 { - switch { - case strings.EqualFold(s3UseARNRegion, "false"): - cfg.S3UseARNRegion = false - case strings.EqualFold(s3UseARNRegion, "true"): - cfg.S3UseARNRegion = true - default: - return envConfig{}, fmt.Errorf( - "invalid value for environment variable, %s=%s, need true or false", - s3UseARNRegionEnvKey[0], s3UseARNRegion) - } - } - - return cfg, nil -} - -func setFromEnvVal(dst *string, keys []string) { - for _, k := range keys { - if v := os.Getenv(k); len(v) != 0 { - *dst = v - break - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go deleted file mode 100644 index 0ff499605..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ /dev/null @@ -1,734 +0,0 @@ -package session - -import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/csm" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" -) - -const ( - // ErrCodeSharedConfig represents an error that occurs in the shared - // configuration logic - ErrCodeSharedConfig = "SharedConfigErr" -) - -// ErrSharedConfigSourceCollision will be returned if a section contains both -// source_profile and credential_source -var ErrSharedConfigSourceCollision = awserr.New(ErrCodeSharedConfig, "only source profile or credential source can be specified, not both", nil) - -// ErrSharedConfigECSContainerEnvVarEmpty will be returned if the environment -// variables are empty and Environment was set as the credential source -var ErrSharedConfigECSContainerEnvVarEmpty = awserr.New(ErrCodeSharedConfig, "EcsContainer was specified as the credential_source, but 'AWS_CONTAINER_CREDENTIALS_RELATIVE_URI' was not set", nil) - -// ErrSharedConfigInvalidCredSource will be returned if an invalid credential source was provided -var ErrSharedConfigInvalidCredSource = awserr.New(ErrCodeSharedConfig, "credential source values must be EcsContainer, Ec2InstanceMetadata, or Environment", nil) - -// A Session provides a central location to create service clients from and -// store configurations and request handlers for those services. -// -// Sessions are safe to create service clients concurrently, but it is not safe -// to mutate the Session concurrently. -// -// The Session satisfies the service client's client.ConfigProvider. -type Session struct { - Config *aws.Config - Handlers request.Handlers -} - -// New creates a new instance of the handlers merging in the provided configs -// on top of the SDK's default configurations. Once the Session is created it -// can be mutated to modify the Config or Handlers. The Session is safe to be -// read concurrently, but it should not be written to concurrently. -// -// If the AWS_SDK_LOAD_CONFIG environment is set to a truthy value, the New -// method could now encounter an error when loading the configuration. When -// The environment variable is set, and an error occurs, New will return a -// session that will fail all requests reporting the error that occurred while -// loading the session. Use NewSession to get the error when creating the -// session. -// -// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value -// the shared config file (~/.aws/config) will also be loaded, in addition to -// the shared credentials file (~/.aws/credentials). Values set in both the -// shared config, and shared credentials will be taken from the shared -// credentials file. -// -// Deprecated: Use NewSession functions to create sessions instead. NewSession -// has the same functionality as New except an error can be returned when the -// func is called instead of waiting to receive an error until a request is made. -func New(cfgs ...*aws.Config) *Session { - // load initial config from environment - envCfg, envErr := loadEnvConfig() - - if envCfg.EnableSharedConfig { - var cfg aws.Config - cfg.MergeIn(cfgs...) - s, err := NewSessionWithOptions(Options{ - Config: cfg, - SharedConfigState: SharedConfigEnable, - }) - if err != nil { - // Old session.New expected all errors to be discovered when - // a request is made, and would report the errors then. This - // needs to be replicated if an error occurs while creating - // the session. - msg := "failed to create session with AWS_SDK_LOAD_CONFIG enabled. " + - "Use session.NewSession to handle errors occurring during session creation." - - // Session creation failed, need to report the error and prevent - // any requests from succeeding. - s = &Session{Config: defaults.Config()} - s.logDeprecatedNewSessionError(msg, err, cfgs) - } - - return s - } - - s := deprecatedNewSession(cfgs...) - if envErr != nil { - msg := "failed to load env config" - s.logDeprecatedNewSessionError(msg, envErr, cfgs) - } - - if csmCfg, err := loadCSMConfig(envCfg, []string{}); err != nil { - if l := s.Config.Logger; l != nil { - l.Log(fmt.Sprintf("ERROR: failed to load CSM configuration, %v", err)) - } - } else if csmCfg.Enabled { - err := enableCSM(&s.Handlers, csmCfg, s.Config.Logger) - if err != nil { - msg := "failed to enable CSM" - s.logDeprecatedNewSessionError(msg, err, cfgs) - } - } - - return s -} - -// NewSession returns a new Session created from SDK defaults, config files, -// environment, and user provided config files. Once the Session is created -// it can be mutated to modify the Config or Handlers. The Session is safe to -// be read concurrently, but it should not be written to concurrently. -// -// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value -// the shared config file (~/.aws/config) will also be loaded in addition to -// the shared credentials file (~/.aws/credentials). Values set in both the -// shared config, and shared credentials will be taken from the shared -// credentials file. Enabling the Shared Config will also allow the Session -// to be built with retrieving credentials with AssumeRole set in the config. -// -// See the NewSessionWithOptions func for information on how to override or -// control through code how the Session will be created, such as specifying the -// config profile, and controlling if shared config is enabled or not. -func NewSession(cfgs ...*aws.Config) (*Session, error) { - opts := Options{} - opts.Config.MergeIn(cfgs...) - - return NewSessionWithOptions(opts) -} - -// SharedConfigState provides the ability to optionally override the state -// of the session's creation based on the shared config being enabled or -// disabled. -type SharedConfigState int - -const ( - // SharedConfigStateFromEnv does not override any state of the - // AWS_SDK_LOAD_CONFIG env var. It is the default value of the - // SharedConfigState type. - SharedConfigStateFromEnv SharedConfigState = iota - - // SharedConfigDisable overrides the AWS_SDK_LOAD_CONFIG env var value - // and disables the shared config functionality. - SharedConfigDisable - - // SharedConfigEnable overrides the AWS_SDK_LOAD_CONFIG env var value - // and enables the shared config functionality. - SharedConfigEnable -) - -// Options provides the means to control how a Session is created and what -// configuration values will be loaded. -// -type Options struct { - // Provides config values for the SDK to use when creating service clients - // and making API requests to services. Any value set in with this field - // will override the associated value provided by the SDK defaults, - // environment or config files where relevant. - // - // If not set, configuration values from from SDK defaults, environment, - // config will be used. - Config aws.Config - - // Overrides the config profile the Session should be created from. If not - // set the value of the environment variable will be loaded (AWS_PROFILE, - // or AWS_DEFAULT_PROFILE if the Shared Config is enabled). - // - // If not set and environment variables are not set the "default" - // (DefaultSharedConfigProfile) will be used as the profile to load the - // session config from. - Profile string - - // Instructs how the Session will be created based on the AWS_SDK_LOAD_CONFIG - // environment variable. By default a Session will be created using the - // value provided by the AWS_SDK_LOAD_CONFIG environment variable. - // - // Setting this value to SharedConfigEnable or SharedConfigDisable - // will allow you to override the AWS_SDK_LOAD_CONFIG environment variable - // and enable or disable the shared config functionality. - SharedConfigState SharedConfigState - - // Ordered list of files the session will load configuration from. - // It will override environment variable AWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE. - SharedConfigFiles []string - - // When the SDK's shared config is configured to assume a role with MFA - // this option is required in order to provide the mechanism that will - // retrieve the MFA token. There is no default value for this field. If - // it is not set an error will be returned when creating the session. - // - // This token provider will be called when ever the assumed role's - // credentials need to be refreshed. Within the context of service clients - // all sharing the same session the SDK will ensure calls to the token - // provider are atomic. When sharing a token provider across multiple - // sessions additional synchronization logic is needed to ensure the - // token providers do not introduce race conditions. It is recommend to - // share the session where possible. - // - // stscreds.StdinTokenProvider is a basic implementation that will prompt - // from stdin for the MFA token code. - // - // This field is only used if the shared configuration is enabled, and - // the config enables assume role wit MFA via the mfa_serial field. - AssumeRoleTokenProvider func() (string, error) - - // When the SDK's shared config is configured to assume a role this option - // may be provided to set the expiry duration of the STS credentials. - // Defaults to 15 minutes if not set as documented in the - // stscreds.AssumeRoleProvider. - AssumeRoleDuration time.Duration - - // Reader for a custom Credentials Authority (CA) bundle in PEM format that - // the SDK will use instead of the default system's root CA bundle. Use this - // only if you want to replace the CA bundle the SDK uses for TLS requests. - // - // Enabling this option will attempt to merge the Transport into the SDK's HTTP - // client. If the client's Transport is not a http.Transport an error will be - // returned. If the Transport's TLS config is set this option will cause the SDK - // to overwrite the Transport's TLS config's RootCAs value. If the CA - // bundle reader contains multiple certificates all of them will be loaded. - // - // The Session option CustomCABundle is also available when creating sessions - // to also enable this feature. CustomCABundle session option field has priority - // over the AWS_CA_BUNDLE environment variable, and will be used if both are set. - CustomCABundle io.Reader - - // The handlers that the session and all API clients will be created with. - // This must be a complete set of handlers. Use the defaults.Handlers() - // function to initialize this value before changing the handlers to be - // used by the SDK. - Handlers request.Handlers -} - -// NewSessionWithOptions returns a new Session created from SDK defaults, config files, -// environment, and user provided config files. This func uses the Options -// values to configure how the Session is created. -// -// If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy value -// the shared config file (~/.aws/config) will also be loaded in addition to -// the shared credentials file (~/.aws/credentials). Values set in both the -// shared config, and shared credentials will be taken from the shared -// credentials file. Enabling the Shared Config will also allow the Session -// to be built with retrieving credentials with AssumeRole set in the config. -// -// // Equivalent to session.New -// sess := session.Must(session.NewSessionWithOptions(session.Options{})) -// -// // Specify profile to load for the session's config -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// Profile: "profile_name", -// })) -// -// // Specify profile for config and region for requests -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// Config: aws.Config{Region: aws.String("us-east-1")}, -// Profile: "profile_name", -// })) -// -// // Force enable Shared Config support -// sess := session.Must(session.NewSessionWithOptions(session.Options{ -// SharedConfigState: session.SharedConfigEnable, -// })) -func NewSessionWithOptions(opts Options) (*Session, error) { - var envCfg envConfig - var err error - if opts.SharedConfigState == SharedConfigEnable { - envCfg, err = loadSharedEnvConfig() - if err != nil { - return nil, fmt.Errorf("failed to load shared config, %v", err) - } - } else { - envCfg, err = loadEnvConfig() - if err != nil { - return nil, fmt.Errorf("failed to load environment config, %v", err) - } - } - - if len(opts.Profile) != 0 { - envCfg.Profile = opts.Profile - } - - switch opts.SharedConfigState { - case SharedConfigDisable: - envCfg.EnableSharedConfig = false - case SharedConfigEnable: - envCfg.EnableSharedConfig = true - } - - // Only use AWS_CA_BUNDLE if session option is not provided. - if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { - f, err := os.Open(envCfg.CustomCABundle) - if err != nil { - return nil, awserr.New("LoadCustomCABundleError", - "failed to open custom CA bundle PEM file", err) - } - defer f.Close() - opts.CustomCABundle = f - } - - return newSession(opts, envCfg, &opts.Config) -} - -// Must is a helper function to ensure the Session is valid and there was no -// error when calling a NewSession function. -// -// This helper is intended to be used in variable initialization to load the -// Session and configuration at startup. Such as: -// -// var sess = session.Must(session.NewSession()) -func Must(sess *Session, err error) *Session { - if err != nil { - panic(err) - } - - return sess -} - -func deprecatedNewSession(cfgs ...*aws.Config) *Session { - cfg := defaults.Config() - handlers := defaults.Handlers() - - // Apply the passed in configs so the configuration can be applied to the - // default credential chain - cfg.MergeIn(cfgs...) - if cfg.EndpointResolver == nil { - // An endpoint resolver is required for a session to be able to provide - // endpoints for service client configurations. - cfg.EndpointResolver = endpoints.DefaultResolver() - } - cfg.Credentials = defaults.CredChain(cfg, handlers) - - // Reapply any passed in configs to override credentials if set - cfg.MergeIn(cfgs...) - - s := &Session{ - Config: cfg, - Handlers: handlers, - } - - initHandlers(s) - return s -} - -func enableCSM(handlers *request.Handlers, cfg csmConfig, logger aws.Logger) error { - if logger != nil { - logger.Log("Enabling CSM") - } - - r, err := csm.Start(cfg.ClientID, csm.AddressWithDefaults(cfg.Host, cfg.Port)) - if err != nil { - return err - } - r.InjectHandlers(handlers) - - return nil -} - -func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { - cfg := defaults.Config() - - handlers := opts.Handlers - if handlers.IsEmpty() { - handlers = defaults.Handlers() - } - - // Get a merged version of the user provided config to determine if - // credentials were. - userCfg := &aws.Config{} - userCfg.MergeIn(cfgs...) - cfg.MergeIn(userCfg) - - // Ordered config files will be loaded in with later files overwriting - // previous config file values. - var cfgFiles []string - if opts.SharedConfigFiles != nil { - cfgFiles = opts.SharedConfigFiles - } else { - cfgFiles = []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} - if !envCfg.EnableSharedConfig { - // The shared config file (~/.aws/config) is only loaded if instructed - // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). - cfgFiles = cfgFiles[1:] - } - } - - // Load additional config from file(s) - sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles, envCfg.EnableSharedConfig) - if err != nil { - if len(envCfg.Profile) == 0 && !envCfg.EnableSharedConfig && (envCfg.Creds.HasKeys() || userCfg.Credentials != nil) { - // Special case where the user has not explicitly specified an AWS_PROFILE, - // or session.Options.profile, shared config is not enabled, and the - // environment has credentials, allow the shared config file to fail to - // load since the user has already provided credentials, and nothing else - // is required to be read file. Github(aws/aws-sdk-go#2455) - } else if _, ok := err.(SharedConfigProfileNotExistsError); !ok { - return nil, err - } - } - - if err := mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers, opts); err != nil { - return nil, err - } - - s := &Session{ - Config: cfg, - Handlers: handlers, - } - - initHandlers(s) - - if csmCfg, err := loadCSMConfig(envCfg, cfgFiles); err != nil { - if l := s.Config.Logger; l != nil { - l.Log(fmt.Sprintf("ERROR: failed to load CSM configuration, %v", err)) - } - } else if csmCfg.Enabled { - err = enableCSM(&s.Handlers, csmCfg, s.Config.Logger) - if err != nil { - return nil, err - } - } - - // Setup HTTP client with custom cert bundle if enabled - if opts.CustomCABundle != nil { - if err := loadCustomCABundle(s, opts.CustomCABundle); err != nil { - return nil, err - } - } - - return s, nil -} - -type csmConfig struct { - Enabled bool - Host string - Port string - ClientID string -} - -var csmProfileName = "aws_csm" - -func loadCSMConfig(envCfg envConfig, cfgFiles []string) (csmConfig, error) { - if envCfg.CSMEnabled != nil { - if *envCfg.CSMEnabled { - return csmConfig{ - Enabled: true, - ClientID: envCfg.CSMClientID, - Host: envCfg.CSMHost, - Port: envCfg.CSMPort, - }, nil - } - return csmConfig{}, nil - } - - sharedCfg, err := loadSharedConfig(csmProfileName, cfgFiles, false) - if err != nil { - if _, ok := err.(SharedConfigProfileNotExistsError); !ok { - return csmConfig{}, err - } - } - if sharedCfg.CSMEnabled != nil && *sharedCfg.CSMEnabled == true { - return csmConfig{ - Enabled: true, - ClientID: sharedCfg.CSMClientID, - Host: sharedCfg.CSMHost, - Port: sharedCfg.CSMPort, - }, nil - } - - return csmConfig{}, nil -} - -func loadCustomCABundle(s *Session, bundle io.Reader) error { - var t *http.Transport - switch v := s.Config.HTTPClient.Transport.(type) { - case *http.Transport: - t = v - default: - if s.Config.HTTPClient.Transport != nil { - return awserr.New("LoadCustomCABundleError", - "unable to load custom CA bundle, HTTPClient's transport unsupported type", nil) - } - } - if t == nil { - // Nil transport implies `http.DefaultTransport` should be used. Since - // the SDK cannot modify, nor copy the `DefaultTransport` specifying - // the values the next closest behavior. - t = getCABundleTransport() - } - - p, err := loadCertPool(bundle) - if err != nil { - return err - } - if t.TLSClientConfig == nil { - t.TLSClientConfig = &tls.Config{} - } - t.TLSClientConfig.RootCAs = p - - s.Config.HTTPClient.Transport = t - - return nil -} - -func loadCertPool(r io.Reader) (*x509.CertPool, error) { - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, awserr.New("LoadCustomCABundleError", - "failed to read custom CA bundle PEM file", err) - } - - p := x509.NewCertPool() - if !p.AppendCertsFromPEM(b) { - return nil, awserr.New("LoadCustomCABundleError", - "failed to load custom CA bundle PEM file", err) - } - - return p, nil -} - -func mergeConfigSrcs(cfg, userCfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) error { - - // Region if not already set by user - if len(aws.StringValue(cfg.Region)) == 0 { - if len(envCfg.Region) > 0 { - cfg.WithRegion(envCfg.Region) - } else if envCfg.EnableSharedConfig && len(sharedCfg.Region) > 0 { - cfg.WithRegion(sharedCfg.Region) - } - } - - if cfg.EnableEndpointDiscovery == nil { - if envCfg.EnableEndpointDiscovery != nil { - cfg.WithEndpointDiscovery(*envCfg.EnableEndpointDiscovery) - } else if envCfg.EnableSharedConfig && sharedCfg.EnableEndpointDiscovery != nil { - cfg.WithEndpointDiscovery(*sharedCfg.EnableEndpointDiscovery) - } - } - - // Regional Endpoint flag for STS endpoint resolving - mergeSTSRegionalEndpointConfig(cfg, []endpoints.STSRegionalEndpoint{ - userCfg.STSRegionalEndpoint, - envCfg.STSRegionalEndpoint, - sharedCfg.STSRegionalEndpoint, - endpoints.LegacySTSEndpoint, - }) - - // Regional Endpoint flag for S3 endpoint resolving - mergeS3UsEast1RegionalEndpointConfig(cfg, []endpoints.S3UsEast1RegionalEndpoint{ - userCfg.S3UsEast1RegionalEndpoint, - envCfg.S3UsEast1RegionalEndpoint, - sharedCfg.S3UsEast1RegionalEndpoint, - endpoints.LegacyS3UsEast1Endpoint, - }) - - // Configure credentials if not already set by the user when creating the - // Session. - if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { - creds, err := resolveCredentials(cfg, envCfg, sharedCfg, handlers, sessOpts) - if err != nil { - return err - } - cfg.Credentials = creds - } - - cfg.S3UseARNRegion = userCfg.S3UseARNRegion - if cfg.S3UseARNRegion == nil { - cfg.S3UseARNRegion = &envCfg.S3UseARNRegion - } - if cfg.S3UseARNRegion == nil { - cfg.S3UseARNRegion = &sharedCfg.S3UseARNRegion - } - - return nil -} - -func mergeSTSRegionalEndpointConfig(cfg *aws.Config, values []endpoints.STSRegionalEndpoint) { - for _, v := range values { - if v != endpoints.UnsetSTSEndpoint { - cfg.STSRegionalEndpoint = v - break - } - } -} - -func mergeS3UsEast1RegionalEndpointConfig(cfg *aws.Config, values []endpoints.S3UsEast1RegionalEndpoint) { - for _, v := range values { - if v != endpoints.UnsetS3UsEast1Endpoint { - cfg.S3UsEast1RegionalEndpoint = v - break - } - } -} - -func initHandlers(s *Session) { - // Add the Validate parameter handler if it is not disabled. - s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) - if !aws.BoolValue(s.Config.DisableParamValidation) { - s.Handlers.Validate.PushBackNamed(corehandlers.ValidateParametersHandler) - } -} - -// Copy creates and returns a copy of the current Session, copying the config -// and handlers. If any additional configs are provided they will be merged -// on top of the Session's copied config. -// -// // Create a copy of the current Session, configured for the us-west-2 region. -// sess.Copy(&aws.Config{Region: aws.String("us-west-2")}) -func (s *Session) Copy(cfgs ...*aws.Config) *Session { - newSession := &Session{ - Config: s.Config.Copy(cfgs...), - Handlers: s.Handlers.Copy(), - } - - initHandlers(newSession) - - return newSession -} - -// ClientConfig satisfies the client.ConfigProvider interface and is used to -// configure the service client instances. Passing the Session to the service -// client's constructor (New) will use this method to configure the client. -func (s *Session) ClientConfig(service string, cfgs ...*aws.Config) client.Config { - s = s.Copy(cfgs...) - - region := aws.StringValue(s.Config.Region) - resolved, err := s.resolveEndpoint(service, region, s.Config) - if err != nil { - s.Handlers.Validate.PushBack(func(r *request.Request) { - if len(r.ClientInfo.Endpoint) != 0 { - // Error occurred while resolving endpoint, but the request - // being invoked has had an endpoint specified after the client - // was created. - return - } - r.Error = err - }) - } - - return client.Config{ - Config: s.Config, - Handlers: s.Handlers, - PartitionID: resolved.PartitionID, - Endpoint: resolved.URL, - SigningRegion: resolved.SigningRegion, - SigningNameDerived: resolved.SigningNameDerived, - SigningName: resolved.SigningName, - } -} - -func (s *Session) resolveEndpoint(service, region string, cfg *aws.Config) (endpoints.ResolvedEndpoint, error) { - - if ep := aws.StringValue(cfg.Endpoint); len(ep) != 0 { - return endpoints.ResolvedEndpoint{ - URL: endpoints.AddScheme(ep, aws.BoolValue(cfg.DisableSSL)), - SigningRegion: region, - }, nil - } - - resolved, err := cfg.EndpointResolver.EndpointFor(service, region, - func(opt *endpoints.Options) { - opt.DisableSSL = aws.BoolValue(cfg.DisableSSL) - opt.UseDualStack = aws.BoolValue(cfg.UseDualStack) - // Support for STSRegionalEndpoint where the STSRegionalEndpoint is - // provided in envConfig or sharedConfig with envConfig getting - // precedence. - opt.STSRegionalEndpoint = cfg.STSRegionalEndpoint - - // Support for S3UsEast1RegionalEndpoint where the S3UsEast1RegionalEndpoint is - // provided in envConfig or sharedConfig with envConfig getting - // precedence. - opt.S3UsEast1RegionalEndpoint = cfg.S3UsEast1RegionalEndpoint - - // Support the condition where the service is modeled but its - // endpoint metadata is not available. - opt.ResolveUnknownService = true - }, - ) - if err != nil { - return endpoints.ResolvedEndpoint{}, err - } - - return resolved, nil -} - -// ClientConfigNoResolveEndpoint is the same as ClientConfig with the exception -// that the EndpointResolver will not be used to resolve the endpoint. The only -// endpoint set must come from the aws.Config.Endpoint field. -func (s *Session) ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) client.Config { - s = s.Copy(cfgs...) - - var resolved endpoints.ResolvedEndpoint - if ep := aws.StringValue(s.Config.Endpoint); len(ep) > 0 { - resolved.URL = endpoints.AddScheme(ep, aws.BoolValue(s.Config.DisableSSL)) - resolved.SigningRegion = aws.StringValue(s.Config.Region) - } - - return client.Config{ - Config: s.Config, - Handlers: s.Handlers, - Endpoint: resolved.URL, - SigningRegion: resolved.SigningRegion, - SigningNameDerived: resolved.SigningNameDerived, - SigningName: resolved.SigningName, - } -} - -// logDeprecatedNewSessionError function enables error handling for session -func (s *Session) logDeprecatedNewSessionError(msg string, err error, cfgs []*aws.Config) { - // Session creation failed, need to report the error and prevent - // any requests from succeeding. - s.Config.MergeIn(cfgs...) - s.Config.Logger.Log("ERROR:", msg, "Error:", err) - s.Handlers.Validate.PushBack(func(r *request.Request) { - r.Error = err - }) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go deleted file mode 100644 index 680805a38..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go +++ /dev/null @@ -1,555 +0,0 @@ -package session - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/internal/ini" -) - -const ( - // Static Credentials group - accessKeyIDKey = `aws_access_key_id` // group required - secretAccessKey = `aws_secret_access_key` // group required - sessionTokenKey = `aws_session_token` // optional - - // Assume Role Credentials group - roleArnKey = `role_arn` // group required - sourceProfileKey = `source_profile` // group required (or credential_source) - credentialSourceKey = `credential_source` // group required (or source_profile) - externalIDKey = `external_id` // optional - mfaSerialKey = `mfa_serial` // optional - roleSessionNameKey = `role_session_name` // optional - roleDurationSecondsKey = "duration_seconds" // optional - - // CSM options - csmEnabledKey = `csm_enabled` - csmHostKey = `csm_host` - csmPortKey = `csm_port` - csmClientIDKey = `csm_client_id` - - // Additional Config fields - regionKey = `region` - - // endpoint discovery group - enableEndpointDiscoveryKey = `endpoint_discovery_enabled` // optional - - // External Credential Process - credentialProcessKey = `credential_process` // optional - - // Web Identity Token File - webIdentityTokenFileKey = `web_identity_token_file` // optional - - // Additional config fields for regional or legacy endpoints - stsRegionalEndpointSharedKey = `sts_regional_endpoints` - - // Additional config fields for regional or legacy endpoints - s3UsEast1RegionalSharedKey = `s3_us_east_1_regional_endpoint` - - // DefaultSharedConfigProfile is the default profile to be used when - // loading configuration from the config files if another profile name - // is not provided. - DefaultSharedConfigProfile = `default` - - // S3 ARN Region Usage - s3UseARNRegionKey = "s3_use_arn_region" -) - -// sharedConfig represents the configuration fields of the SDK config files. -type sharedConfig struct { - // Credentials values from the config file. Both aws_access_key_id and - // aws_secret_access_key must be provided together in the same file to be - // considered valid. The values will be ignored if not a complete group. - // aws_session_token is an optional field that can be provided if both of - // the other two fields are also provided. - // - // aws_access_key_id - // aws_secret_access_key - // aws_session_token - Creds credentials.Value - - CredentialSource string - CredentialProcess string - WebIdentityTokenFile string - - RoleARN string - RoleSessionName string - ExternalID string - MFASerial string - AssumeRoleDuration *time.Duration - - SourceProfileName string - SourceProfile *sharedConfig - - // Region is the region the SDK should use for looking up AWS service - // endpoints and signing requests. - // - // region - Region string - - // EnableEndpointDiscovery can be enabled in the shared config by setting - // endpoint_discovery_enabled to true - // - // endpoint_discovery_enabled = true - EnableEndpointDiscovery *bool - - // CSM Options - CSMEnabled *bool - CSMHost string - CSMPort string - CSMClientID string - - // Specifies the Regional Endpoint flag for the SDK to resolve the endpoint for a service - // - // sts_regional_endpoints = regional - // This can take value as `LegacySTSEndpoint` or `RegionalSTSEndpoint` - STSRegionalEndpoint endpoints.STSRegionalEndpoint - - // Specifies the Regional Endpoint flag for the SDK to resolve the endpoint for a service - // - // s3_us_east_1_regional_endpoint = regional - // This can take value as `LegacyS3UsEast1Endpoint` or `RegionalS3UsEast1Endpoint` - S3UsEast1RegionalEndpoint endpoints.S3UsEast1RegionalEndpoint - - // Specifies if the S3 service should allow ARNs to direct the region - // the client's requests are sent to. - // - // s3_use_arn_region=true - S3UseARNRegion bool -} - -type sharedConfigFile struct { - Filename string - IniData ini.Sections -} - -// loadSharedConfig retrieves the configuration from the list of files using -// the profile provided. The order the files are listed will determine -// precedence. Values in subsequent files will overwrite values defined in -// earlier files. -// -// For example, given two files A and B. Both define credentials. If the order -// of the files are A then B, B's credential values will be used instead of -// A's. -// -// See sharedConfig.setFromFile for information how the config files -// will be loaded. -func loadSharedConfig(profile string, filenames []string, exOpts bool) (sharedConfig, error) { - if len(profile) == 0 { - profile = DefaultSharedConfigProfile - } - - files, err := loadSharedConfigIniFiles(filenames) - if err != nil { - return sharedConfig{}, err - } - - cfg := sharedConfig{} - profiles := map[string]struct{}{} - if err = cfg.setFromIniFiles(profiles, profile, files, exOpts); err != nil { - return sharedConfig{}, err - } - - return cfg, nil -} - -func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { - files := make([]sharedConfigFile, 0, len(filenames)) - - for _, filename := range filenames { - sections, err := ini.OpenFile(filename) - if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ini.ErrCodeUnableToReadFile { - // Skip files which can't be opened and read for whatever reason - continue - } else if err != nil { - return nil, SharedConfigLoadError{Filename: filename, Err: err} - } - - files = append(files, sharedConfigFile{ - Filename: filename, IniData: sections, - }) - } - - return files, nil -} - -func (cfg *sharedConfig) setFromIniFiles(profiles map[string]struct{}, profile string, files []sharedConfigFile, exOpts bool) error { - // Trim files from the list that don't exist. - var skippedFiles int - var profileNotFoundErr error - for _, f := range files { - if err := cfg.setFromIniFile(profile, f, exOpts); err != nil { - if _, ok := err.(SharedConfigProfileNotExistsError); ok { - // Ignore profiles not defined in individual files. - profileNotFoundErr = err - skippedFiles++ - continue - } - return err - } - } - if skippedFiles == len(files) { - // If all files were skipped because the profile is not found, return - // the original profile not found error. - return profileNotFoundErr - } - - if _, ok := profiles[profile]; ok { - // if this is the second instance of the profile the Assume Role - // options must be cleared because they are only valid for the - // first reference of a profile. The self linked instance of the - // profile only have credential provider options. - cfg.clearAssumeRoleOptions() - } else { - // First time a profile has been seen, It must either be a assume role - // or credentials. Assert if the credential type requires a role ARN, - // the ARN is also set. - if err := cfg.validateCredentialsRequireARN(profile); err != nil { - return err - } - } - profiles[profile] = struct{}{} - - if err := cfg.validateCredentialType(); err != nil { - return err - } - - // Link source profiles for assume roles - if len(cfg.SourceProfileName) != 0 { - // Linked profile via source_profile ignore credential provider - // options, the source profile must provide the credentials. - cfg.clearCredentialOptions() - - srcCfg := &sharedConfig{} - err := srcCfg.setFromIniFiles(profiles, cfg.SourceProfileName, files, exOpts) - if err != nil { - // SourceProfile that doesn't exist is an error in configuration. - if _, ok := err.(SharedConfigProfileNotExistsError); ok { - err = SharedConfigAssumeRoleError{ - RoleARN: cfg.RoleARN, - SourceProfile: cfg.SourceProfileName, - } - } - return err - } - - if !srcCfg.hasCredentials() { - return SharedConfigAssumeRoleError{ - RoleARN: cfg.RoleARN, - SourceProfile: cfg.SourceProfileName, - } - } - - cfg.SourceProfile = srcCfg - } - - return nil -} - -// setFromFile loads the configuration from the file using the profile -// provided. A sharedConfig pointer type value is used so that multiple config -// file loadings can be chained. -// -// Only loads complete logically grouped values, and will not set fields in cfg -// for incomplete grouped values in the config. Such as credentials. For -// example if a config file only includes aws_access_key_id but no -// aws_secret_access_key the aws_access_key_id will be ignored. -func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, exOpts bool) error { - section, ok := file.IniData.GetSection(profile) - if !ok { - // Fallback to to alternate profile name: profile - section, ok = file.IniData.GetSection(fmt.Sprintf("profile %s", profile)) - if !ok { - return SharedConfigProfileNotExistsError{Profile: profile, Err: nil} - } - } - - if exOpts { - // Assume Role Parameters - updateString(&cfg.RoleARN, section, roleArnKey) - updateString(&cfg.ExternalID, section, externalIDKey) - updateString(&cfg.MFASerial, section, mfaSerialKey) - updateString(&cfg.RoleSessionName, section, roleSessionNameKey) - updateString(&cfg.SourceProfileName, section, sourceProfileKey) - updateString(&cfg.CredentialSource, section, credentialSourceKey) - updateString(&cfg.Region, section, regionKey) - - if section.Has(roleDurationSecondsKey) { - d := time.Duration(section.Int(roleDurationSecondsKey)) * time.Second - cfg.AssumeRoleDuration = &d - } - - if v := section.String(stsRegionalEndpointSharedKey); len(v) != 0 { - sre, err := endpoints.GetSTSRegionalEndpoint(v) - if err != nil { - return fmt.Errorf("failed to load %s from shared config, %s, %v", - stsRegionalEndpointSharedKey, file.Filename, err) - } - cfg.STSRegionalEndpoint = sre - } - - if v := section.String(s3UsEast1RegionalSharedKey); len(v) != 0 { - sre, err := endpoints.GetS3UsEast1RegionalEndpoint(v) - if err != nil { - return fmt.Errorf("failed to load %s from shared config, %s, %v", - s3UsEast1RegionalSharedKey, file.Filename, err) - } - cfg.S3UsEast1RegionalEndpoint = sre - } - } - - updateString(&cfg.CredentialProcess, section, credentialProcessKey) - updateString(&cfg.WebIdentityTokenFile, section, webIdentityTokenFileKey) - - // Shared Credentials - creds := credentials.Value{ - AccessKeyID: section.String(accessKeyIDKey), - SecretAccessKey: section.String(secretAccessKey), - SessionToken: section.String(sessionTokenKey), - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), - } - if creds.HasKeys() { - cfg.Creds = creds - } - - // Endpoint discovery - updateBoolPtr(&cfg.EnableEndpointDiscovery, section, enableEndpointDiscoveryKey) - - // CSM options - updateBoolPtr(&cfg.CSMEnabled, section, csmEnabledKey) - updateString(&cfg.CSMHost, section, csmHostKey) - updateString(&cfg.CSMPort, section, csmPortKey) - updateString(&cfg.CSMClientID, section, csmClientIDKey) - - updateBool(&cfg.S3UseARNRegion, section, s3UseARNRegionKey) - - return nil -} - -func (cfg *sharedConfig) validateCredentialsRequireARN(profile string) error { - var credSource string - - switch { - case len(cfg.SourceProfileName) != 0: - credSource = sourceProfileKey - case len(cfg.CredentialSource) != 0: - credSource = credentialSourceKey - case len(cfg.WebIdentityTokenFile) != 0: - credSource = webIdentityTokenFileKey - } - - if len(credSource) != 0 && len(cfg.RoleARN) == 0 { - return CredentialRequiresARNError{ - Type: credSource, - Profile: profile, - } - } - - return nil -} - -func (cfg *sharedConfig) validateCredentialType() error { - // Only one or no credential type can be defined. - if !oneOrNone( - len(cfg.SourceProfileName) != 0, - len(cfg.CredentialSource) != 0, - len(cfg.CredentialProcess) != 0, - len(cfg.WebIdentityTokenFile) != 0, - ) { - return ErrSharedConfigSourceCollision - } - - return nil -} - -func (cfg *sharedConfig) hasCredentials() bool { - switch { - case len(cfg.SourceProfileName) != 0: - case len(cfg.CredentialSource) != 0: - case len(cfg.CredentialProcess) != 0: - case len(cfg.WebIdentityTokenFile) != 0: - case cfg.Creds.HasKeys(): - default: - return false - } - - return true -} - -func (cfg *sharedConfig) clearCredentialOptions() { - cfg.CredentialSource = "" - cfg.CredentialProcess = "" - cfg.WebIdentityTokenFile = "" - cfg.Creds = credentials.Value{} -} - -func (cfg *sharedConfig) clearAssumeRoleOptions() { - cfg.RoleARN = "" - cfg.ExternalID = "" - cfg.MFASerial = "" - cfg.RoleSessionName = "" - cfg.SourceProfileName = "" -} - -func oneOrNone(bs ...bool) bool { - var count int - - for _, b := range bs { - if b { - count++ - if count > 1 { - return false - } - } - } - - return true -} - -// updateString will only update the dst with the value in the section key, key -// is present in the section. -func updateString(dst *string, section ini.Section, key string) { - if !section.Has(key) { - return - } - *dst = section.String(key) -} - -// updateBool will only update the dst with the value in the section key, key -// is present in the section. -func updateBool(dst *bool, section ini.Section, key string) { - if !section.Has(key) { - return - } - *dst = section.Bool(key) -} - -// updateBoolPtr will only update the dst with the value in the section key, -// key is present in the section. -func updateBoolPtr(dst **bool, section ini.Section, key string) { - if !section.Has(key) { - return - } - *dst = new(bool) - **dst = section.Bool(key) -} - -// SharedConfigLoadError is an error for the shared config file failed to load. -type SharedConfigLoadError struct { - Filename string - Err error -} - -// Code is the short id of the error. -func (e SharedConfigLoadError) Code() string { - return "SharedConfigLoadError" -} - -// Message is the description of the error -func (e SharedConfigLoadError) Message() string { - return fmt.Sprintf("failed to load config file, %s", e.Filename) -} - -// OrigErr is the underlying error that caused the failure. -func (e SharedConfigLoadError) OrigErr() error { - return e.Err -} - -// Error satisfies the error interface. -func (e SharedConfigLoadError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", e.Err) -} - -// SharedConfigProfileNotExistsError is an error for the shared config when -// the profile was not find in the config file. -type SharedConfigProfileNotExistsError struct { - Profile string - Err error -} - -// Code is the short id of the error. -func (e SharedConfigProfileNotExistsError) Code() string { - return "SharedConfigProfileNotExistsError" -} - -// Message is the description of the error -func (e SharedConfigProfileNotExistsError) Message() string { - return fmt.Sprintf("failed to get profile, %s", e.Profile) -} - -// OrigErr is the underlying error that caused the failure. -func (e SharedConfigProfileNotExistsError) OrigErr() error { - return e.Err -} - -// Error satisfies the error interface. -func (e SharedConfigProfileNotExistsError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", e.Err) -} - -// SharedConfigAssumeRoleError is an error for the shared config when the -// profile contains assume role information, but that information is invalid -// or not complete. -type SharedConfigAssumeRoleError struct { - RoleARN string - SourceProfile string -} - -// Code is the short id of the error. -func (e SharedConfigAssumeRoleError) Code() string { - return "SharedConfigAssumeRoleError" -} - -// Message is the description of the error -func (e SharedConfigAssumeRoleError) Message() string { - return fmt.Sprintf( - "failed to load assume role for %s, source profile %s has no shared credentials", - e.RoleARN, e.SourceProfile, - ) -} - -// OrigErr is the underlying error that caused the failure. -func (e SharedConfigAssumeRoleError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e SharedConfigAssumeRoleError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} - -// CredentialRequiresARNError provides the error for shared config credentials -// that are incorrectly configured in the shared config or credentials file. -type CredentialRequiresARNError struct { - // type of credentials that were configured. - Type string - - // Profile name the credentials were in. - Profile string -} - -// Code is the short id of the error. -func (e CredentialRequiresARNError) Code() string { - return "CredentialRequiresARNError" -} - -// Message is the description of the error -func (e CredentialRequiresARNError) Message() string { - return fmt.Sprintf( - "credential type %s requires role_arn, profile %s", - e.Type, e.Profile, - ) -} - -// OrigErr is the underlying error that caused the failure. -func (e CredentialRequiresARNError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e CredentialRequiresARNError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go deleted file mode 100644 index 07ea799fb..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go +++ /dev/null @@ -1,81 +0,0 @@ -package v4 - -import ( - "github.com/aws/aws-sdk-go/internal/strings" -) - -// validator houses a set of rule needed for validation of a -// string value -type rules []rule - -// rule interface allows for more flexible rules and just simply -// checks whether or not a value adheres to that rule -type rule interface { - IsValid(value string) bool -} - -// IsValid will iterate through all rules and see if any rules -// apply to the value and supports nested rules -func (r rules) IsValid(value string) bool { - for _, rule := range r { - if rule.IsValid(value) { - return true - } - } - return false -} - -// mapRule generic rule for maps -type mapRule map[string]struct{} - -// IsValid for the map rule satisfies whether it exists in the map -func (m mapRule) IsValid(value string) bool { - _, ok := m[value] - return ok -} - -// whitelist is a generic rule for whitelisting -type whitelist struct { - rule -} - -// IsValid for whitelist checks if the value is within the whitelist -func (w whitelist) IsValid(value string) bool { - return w.rule.IsValid(value) -} - -// blacklist is a generic rule for blacklisting -type blacklist struct { - rule -} - -// IsValid for whitelist checks if the value is within the whitelist -func (b blacklist) IsValid(value string) bool { - return !b.rule.IsValid(value) -} - -type patterns []string - -// IsValid for patterns checks each pattern and returns if a match has -// been found -func (p patterns) IsValid(value string) bool { - for _, pattern := range p { - if strings.HasPrefixFold(value, pattern) { - return true - } - } - return false -} - -// inclusiveRules rules allow for rules to depend on one another -type inclusiveRules []rule - -// IsValid will return true if all rules are true -func (r inclusiveRules) IsValid(value string) bool { - for _, rule := range r { - if !rule.IsValid(value) { - return false - } - } - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go deleted file mode 100644 index 6aa2ed241..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go +++ /dev/null @@ -1,7 +0,0 @@ -package v4 - -// WithUnsignedPayload will enable and set the UnsignedPayload field to -// true of the signer. -func WithUnsignedPayload(v4 *Signer) { - v4.UnsignedPayload = true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.5.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.5.go deleted file mode 100644 index f35fc860b..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.5.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !go1.7 - -package v4 - -import ( - "net/http" - - "github.com/aws/aws-sdk-go/aws" -) - -func requestContext(r *http.Request) aws.Context { - return aws.BackgroundContext() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.7.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.7.go deleted file mode 100644 index fed5c859c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.7.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build go1.7 - -package v4 - -import ( - "net/http" - - "github.com/aws/aws-sdk-go/aws" -) - -func requestContext(r *http.Request) aws.Context { - return r.Context() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/stream.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/stream.go deleted file mode 100644 index 02cbd97e2..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/stream.go +++ /dev/null @@ -1,63 +0,0 @@ -package v4 - -import ( - "encoding/hex" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws/credentials" -) - -type credentialValueProvider interface { - Get() (credentials.Value, error) -} - -// StreamSigner implements signing of event stream encoded payloads -type StreamSigner struct { - region string - service string - - credentials credentialValueProvider - - prevSig []byte -} - -// NewStreamSigner creates a SigV4 signer used to sign Event Stream encoded messages -func NewStreamSigner(region, service string, seedSignature []byte, credentials *credentials.Credentials) *StreamSigner { - return &StreamSigner{ - region: region, - service: service, - credentials: credentials, - prevSig: seedSignature, - } -} - -// GetSignature takes an event stream encoded headers and payload and returns a signature -func (s *StreamSigner) GetSignature(headers, payload []byte, date time.Time) ([]byte, error) { - credValue, err := s.credentials.Get() - if err != nil { - return nil, err - } - - sigKey := deriveSigningKey(s.region, s.service, credValue.SecretAccessKey, date) - - keyPath := buildSigningScope(s.region, s.service, date) - - stringToSign := buildEventStreamStringToSign(headers, payload, s.prevSig, keyPath, date) - - signature := hmacSHA256(sigKey, []byte(stringToSign)) - s.prevSig = signature - - return signature, nil -} - -func buildEventStreamStringToSign(headers, payload, prevSig []byte, scope string, date time.Time) string { - return strings.Join([]string{ - "AWS4-HMAC-SHA256-PAYLOAD", - formatTime(date), - scope, - hex.EncodeToString(prevSig), - hex.EncodeToString(hashSHA256(headers)), - hex.EncodeToString(hashSHA256(payload)), - }, "\n") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go deleted file mode 100644 index bd082e9d1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build go1.5 - -package v4 - -import ( - "net/url" - "strings" -) - -func getURIPath(u *url.URL) string { - var uri string - - if len(u.Opaque) > 0 { - uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") - } else { - uri = u.EscapedPath() - } - - if len(uri) == 0 { - uri = "/" - } - - return uri -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go deleted file mode 100644 index d71f7b3f4..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ /dev/null @@ -1,846 +0,0 @@ -// Package v4 implements signing for AWS V4 signer -// -// Provides request signing for request that need to be signed with -// AWS V4 Signatures. -// -// Standalone Signer -// -// Generally using the signer outside of the SDK should not require any additional -// logic when using Go v1.5 or higher. The signer does this by taking advantage -// of the URL.EscapedPath method. If your request URI requires additional escaping -// you many need to use the URL.Opaque to define what the raw URI should be sent -// to the service as. -// -// The signer will first check the URL.Opaque field, and use its value if set. -// The signer does require the URL.Opaque field to be set in the form of: -// -// "///" -// -// // e.g. -// "//example.com/some/path" -// -// The leading "//" and hostname are required or the URL.Opaque escaping will -// not work correctly. -// -// If URL.Opaque is not set the signer will fallback to the URL.EscapedPath() -// method and using the returned value. If you're using Go v1.4 you must set -// URL.Opaque if the URI path needs escaping. If URL.Opaque is not set with -// Go v1.5 the signer will fallback to URL.Path. -// -// AWS v4 signature validation requires that the canonical string's URI path -// element must be the URI escaped form of the HTTP request's path. -// http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html -// -// The Go HTTP client will perform escaping automatically on the request. Some -// of these escaping may cause signature validation errors because the HTTP -// request differs from the URI path or query that the signature was generated. -// https://golang.org/pkg/net/url/#URL.EscapedPath -// -// Because of this, it is recommended that when using the signer outside of the -// SDK that explicitly escaping the request prior to being signed is preferable, -// and will help prevent signature validation errors. This can be done by setting -// the URL.Opaque or URL.RawPath. The SDK will use URL.Opaque first and then -// call URL.EscapedPath() if Opaque is not set. -// -// If signing a request intended for HTTP2 server, and you're using Go 1.6.2 -// through 1.7.4 you should use the URL.RawPath as the pre-escaped form of the -// request URL. https://github.com/golang/go/issues/16847 points to a bug in -// Go pre 1.8 that fails to make HTTP2 requests using absolute URL in the HTTP -// message. URL.Opaque generally will force Go to make requests with absolute URL. -// URL.RawPath does not do this, but RawPath must be a valid escaping of Path -// or url.EscapedPath will ignore the RawPath escaping. -// -// Test `TestStandaloneSign` provides a complete example of using the signer -// outside of the SDK and pre-escaping the URI path. -package v4 - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/hex" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "sort" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/sdkio" - "github.com/aws/aws-sdk-go/private/protocol/rest" -) - -const ( - authorizationHeader = "Authorization" - authHeaderSignatureElem = "Signature=" - signatureQueryKey = "X-Amz-Signature" - - authHeaderPrefix = "AWS4-HMAC-SHA256" - timeFormat = "20060102T150405Z" - shortTimeFormat = "20060102" - awsV4Request = "aws4_request" - - // emptyStringSHA256 is a SHA256 of an empty string - emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` -) - -var ignoredHeaders = rules{ - blacklist{ - mapRule{ - authorizationHeader: struct{}{}, - "User-Agent": struct{}{}, - "X-Amzn-Trace-Id": struct{}{}, - }, - }, -} - -// requiredSignedHeaders is a whitelist for build canonical headers. -var requiredSignedHeaders = rules{ - whitelist{ - mapRule{ - "Cache-Control": struct{}{}, - "Content-Disposition": struct{}{}, - "Content-Encoding": struct{}{}, - "Content-Language": struct{}{}, - "Content-Md5": struct{}{}, - "Content-Type": struct{}{}, - "Expires": struct{}{}, - "If-Match": struct{}{}, - "If-Modified-Since": struct{}{}, - "If-None-Match": struct{}{}, - "If-Unmodified-Since": struct{}{}, - "Range": struct{}{}, - "X-Amz-Acl": struct{}{}, - "X-Amz-Copy-Source": struct{}{}, - "X-Amz-Copy-Source-If-Match": struct{}{}, - "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, - "X-Amz-Copy-Source-If-None-Match": struct{}{}, - "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, - "X-Amz-Copy-Source-Range": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, - "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, - "X-Amz-Grant-Full-control": struct{}{}, - "X-Amz-Grant-Read": struct{}{}, - "X-Amz-Grant-Read-Acp": struct{}{}, - "X-Amz-Grant-Write": struct{}{}, - "X-Amz-Grant-Write-Acp": struct{}{}, - "X-Amz-Metadata-Directive": struct{}{}, - "X-Amz-Mfa": struct{}{}, - "X-Amz-Request-Payer": struct{}{}, - "X-Amz-Server-Side-Encryption": struct{}{}, - "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, - "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, - "X-Amz-Storage-Class": struct{}{}, - "X-Amz-Tagging": struct{}{}, - "X-Amz-Website-Redirect-Location": struct{}{}, - "X-Amz-Content-Sha256": struct{}{}, - }, - }, - patterns{"X-Amz-Meta-"}, -} - -// allowedHoisting is a whitelist for build query headers. The boolean value -// represents whether or not it is a pattern. -var allowedQueryHoisting = inclusiveRules{ - blacklist{requiredSignedHeaders}, - patterns{"X-Amz-"}, -} - -// Signer applies AWS v4 signing to given request. Use this to sign requests -// that need to be signed with AWS V4 Signatures. -type Signer struct { - // The authentication credentials the request will be signed against. - // This value must be set to sign requests. - Credentials *credentials.Credentials - - // Sets the log level the signer should use when reporting information to - // the logger. If the logger is nil nothing will be logged. See - // aws.LogLevelType for more information on available logging levels - // - // By default nothing will be logged. - Debug aws.LogLevelType - - // The logger loging information will be written to. If there the logger - // is nil, nothing will be logged. - Logger aws.Logger - - // Disables the Signer's moving HTTP header key/value pairs from the HTTP - // request header to the request's query string. This is most commonly used - // with pre-signed requests preventing headers from being added to the - // request's query string. - DisableHeaderHoisting bool - - // Disables the automatic escaping of the URI path of the request for the - // siganture's canonical string's path. For services that do not need additional - // escaping then use this to disable the signer escaping the path. - // - // S3 is an example of a service that does not need additional escaping. - // - // http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html - DisableURIPathEscaping bool - - // Disables the automatical setting of the HTTP request's Body field with the - // io.ReadSeeker passed in to the signer. This is useful if you're using a - // custom wrapper around the body for the io.ReadSeeker and want to preserve - // the Body value on the Request.Body. - // - // This does run the risk of signing a request with a body that will not be - // sent in the request. Need to ensure that the underlying data of the Body - // values are the same. - DisableRequestBodyOverwrite bool - - // currentTimeFn returns the time value which represents the current time. - // This value should only be used for testing. If it is nil the default - // time.Now will be used. - currentTimeFn func() time.Time - - // UnsignedPayload will prevent signing of the payload. This will only - // work for services that have support for this. - UnsignedPayload bool -} - -// NewSigner returns a Signer pointer configured with the credentials and optional -// option values provided. If not options are provided the Signer will use its -// default configuration. -func NewSigner(credentials *credentials.Credentials, options ...func(*Signer)) *Signer { - v4 := &Signer{ - Credentials: credentials, - } - - for _, option := range options { - option(v4) - } - - return v4 -} - -type signingCtx struct { - ServiceName string - Region string - Request *http.Request - Body io.ReadSeeker - Query url.Values - Time time.Time - ExpireTime time.Duration - SignedHeaderVals http.Header - - DisableURIPathEscaping bool - - credValues credentials.Value - isPresign bool - unsignedPayload bool - - bodyDigest string - signedHeaders string - canonicalHeaders string - canonicalString string - credentialString string - stringToSign string - signature string - authorization string -} - -// Sign signs AWS v4 requests with the provided body, service name, region the -// request is made to, and time the request is signed at. The signTime allows -// you to specify that a request is signed for the future, and cannot be -// used until then. -// -// Returns a list of HTTP headers that were included in the signature or an -// error if signing the request failed. Generally for signed requests this value -// is not needed as the full request context will be captured by the http.Request -// value. It is included for reference though. -// -// Sign will set the request's Body to be the `body` parameter passed in. If -// the body is not already an io.ReadCloser, it will be wrapped within one. If -// a `nil` body parameter passed to Sign, the request's Body field will be -// also set to nil. Its important to note that this functionality will not -// change the request's ContentLength of the request. -// -// Sign differs from Presign in that it will sign the request using HTTP -// header values. This type of signing is intended for http.Request values that -// will not be shared, or are shared in a way the header values on the request -// will not be lost. -// -// The requests body is an io.ReadSeeker so the SHA256 of the body can be -// generated. To bypass the signer computing the hash you can set the -// "X-Amz-Content-Sha256" header with a precomputed value. The signer will -// only compute the hash if the request header value is empty. -func (v4 Signer) Sign(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { - return v4.signWithBody(r, body, service, region, 0, false, signTime) -} - -// Presign signs AWS v4 requests with the provided body, service name, region -// the request is made to, and time the request is signed at. The signTime -// allows you to specify that a request is signed for the future, and cannot -// be used until then. -// -// Returns a list of HTTP headers that were included in the signature or an -// error if signing the request failed. For presigned requests these headers -// and their values must be included on the HTTP request when it is made. This -// is helpful to know what header values need to be shared with the party the -// presigned request will be distributed to. -// -// Presign differs from Sign in that it will sign the request using query string -// instead of header values. This allows you to share the Presigned Request's -// URL with third parties, or distribute it throughout your system with minimal -// dependencies. -// -// Presign also takes an exp value which is the duration the -// signed request will be valid after the signing time. This is allows you to -// set when the request will expire. -// -// The requests body is an io.ReadSeeker so the SHA256 of the body can be -// generated. To bypass the signer computing the hash you can set the -// "X-Amz-Content-Sha256" header with a precomputed value. The signer will -// only compute the hash if the request header value is empty. -// -// Presigning a S3 request will not compute the body's SHA256 hash by default. -// This is done due to the general use case for S3 presigned URLs is to share -// PUT/GET capabilities. If you would like to include the body's SHA256 in the -// presigned request's signature you can set the "X-Amz-Content-Sha256" -// HTTP header and that will be included in the request's signature. -func (v4 Signer) Presign(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { - return v4.signWithBody(r, body, service, region, exp, true, signTime) -} - -func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, isPresign bool, signTime time.Time) (http.Header, error) { - currentTimeFn := v4.currentTimeFn - if currentTimeFn == nil { - currentTimeFn = time.Now - } - - ctx := &signingCtx{ - Request: r, - Body: body, - Query: r.URL.Query(), - Time: signTime, - ExpireTime: exp, - isPresign: isPresign, - ServiceName: service, - Region: region, - DisableURIPathEscaping: v4.DisableURIPathEscaping, - unsignedPayload: v4.UnsignedPayload, - } - - for key := range ctx.Query { - sort.Strings(ctx.Query[key]) - } - - if ctx.isRequestSigned() { - ctx.Time = currentTimeFn() - ctx.handlePresignRemoval() - } - - var err error - ctx.credValues, err = v4.Credentials.GetWithContext(requestContext(r)) - if err != nil { - return http.Header{}, err - } - - ctx.sanitizeHostForHeader() - ctx.assignAmzQueryValues() - if err := ctx.build(v4.DisableHeaderHoisting); err != nil { - return nil, err - } - - // If the request is not presigned the body should be attached to it. This - // prevents the confusion of wanting to send a signed request without - // the body the request was signed for attached. - if !(v4.DisableRequestBodyOverwrite || ctx.isPresign) { - var reader io.ReadCloser - if body != nil { - var ok bool - if reader, ok = body.(io.ReadCloser); !ok { - reader = ioutil.NopCloser(body) - } - } - r.Body = reader - } - - if v4.Debug.Matches(aws.LogDebugWithSigning) { - v4.logSigningInfo(ctx) - } - - return ctx.SignedHeaderVals, nil -} - -func (ctx *signingCtx) sanitizeHostForHeader() { - request.SanitizeHostForHeader(ctx.Request) -} - -func (ctx *signingCtx) handlePresignRemoval() { - if !ctx.isPresign { - return - } - - // The credentials have expired for this request. The current signing - // is invalid, and needs to be request because the request will fail. - ctx.removePresign() - - // Update the request's query string to ensure the values stays in - // sync in the case retrieving the new credentials fails. - ctx.Request.URL.RawQuery = ctx.Query.Encode() -} - -func (ctx *signingCtx) assignAmzQueryValues() { - if ctx.isPresign { - ctx.Query.Set("X-Amz-Algorithm", authHeaderPrefix) - if ctx.credValues.SessionToken != "" { - ctx.Query.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) - } else { - ctx.Query.Del("X-Amz-Security-Token") - } - - return - } - - if ctx.credValues.SessionToken != "" { - ctx.Request.Header.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) - } -} - -// SignRequestHandler is a named request handler the SDK will use to sign -// service client request with using the V4 signature. -var SignRequestHandler = request.NamedHandler{ - Name: "v4.SignRequestHandler", Fn: SignSDKRequest, -} - -// SignSDKRequest signs an AWS request with the V4 signature. This -// request handler should only be used with the SDK's built in service client's -// API operation requests. -// -// This function should not be used on its on its own, but in conjunction with -// an AWS service client's API operation call. To sign a standalone request -// not created by a service client's API operation method use the "Sign" or -// "Presign" functions of the "Signer" type. -// -// If the credentials of the request's config are set to -// credentials.AnonymousCredentials the request will not be signed. -func SignSDKRequest(req *request.Request) { - SignSDKRequestWithCurrentTime(req, time.Now) -} - -// BuildNamedHandler will build a generic handler for signing. -func BuildNamedHandler(name string, opts ...func(*Signer)) request.NamedHandler { - return request.NamedHandler{ - Name: name, - Fn: func(req *request.Request) { - SignSDKRequestWithCurrentTime(req, time.Now, opts...) - }, - } -} - -// SignSDKRequestWithCurrentTime will sign the SDK's request using the time -// function passed in. Behaves the same as SignSDKRequest with the exception -// the request is signed with the value returned by the current time function. -func SignSDKRequestWithCurrentTime(req *request.Request, curTimeFn func() time.Time, opts ...func(*Signer)) { - // If the request does not need to be signed ignore the signing of the - // request if the AnonymousCredentials object is used. - if req.Config.Credentials == credentials.AnonymousCredentials { - return - } - - region := req.ClientInfo.SigningRegion - if region == "" { - region = aws.StringValue(req.Config.Region) - } - - name := req.ClientInfo.SigningName - if name == "" { - name = req.ClientInfo.ServiceName - } - - v4 := NewSigner(req.Config.Credentials, func(v4 *Signer) { - v4.Debug = req.Config.LogLevel.Value() - v4.Logger = req.Config.Logger - v4.DisableHeaderHoisting = req.NotHoist - v4.currentTimeFn = curTimeFn - if name == "s3" { - // S3 service should not have any escaping applied - v4.DisableURIPathEscaping = true - } - // Prevents setting the HTTPRequest's Body. Since the Body could be - // wrapped in a custom io.Closer that we do not want to be stompped - // on top of by the signer. - v4.DisableRequestBodyOverwrite = true - }) - - for _, opt := range opts { - opt(v4) - } - - curTime := curTimeFn() - signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.GetBody(), - name, region, req.ExpireTime, req.ExpireTime > 0, curTime, - ) - if err != nil { - req.Error = err - req.SignedHeaderVals = nil - return - } - - req.SignedHeaderVals = signedHeaders - req.LastSignedAt = curTime -} - -const logSignInfoMsg = `DEBUG: Request Signature: ----[ CANONICAL STRING ]----------------------------- -%s ----[ STRING TO SIGN ]-------------------------------- -%s%s ------------------------------------------------------` -const logSignedURLMsg = ` ----[ SIGNED URL ]------------------------------------ -%s` - -func (v4 *Signer) logSigningInfo(ctx *signingCtx) { - signedURLMsg := "" - if ctx.isPresign { - signedURLMsg = fmt.Sprintf(logSignedURLMsg, ctx.Request.URL.String()) - } - msg := fmt.Sprintf(logSignInfoMsg, ctx.canonicalString, ctx.stringToSign, signedURLMsg) - v4.Logger.Log(msg) -} - -func (ctx *signingCtx) build(disableHeaderHoisting bool) error { - ctx.buildTime() // no depends - ctx.buildCredentialString() // no depends - - if err := ctx.buildBodyDigest(); err != nil { - return err - } - - unsignedHeaders := ctx.Request.Header - if ctx.isPresign { - if !disableHeaderHoisting { - urlValues := url.Values{} - urlValues, unsignedHeaders = buildQuery(allowedQueryHoisting, unsignedHeaders) // no depends - for k := range urlValues { - ctx.Query[k] = urlValues[k] - } - } - } - - ctx.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) - ctx.buildCanonicalString() // depends on canon headers / signed headers - ctx.buildStringToSign() // depends on canon string - ctx.buildSignature() // depends on string to sign - - if ctx.isPresign { - ctx.Request.URL.RawQuery += "&" + signatureQueryKey + "=" + ctx.signature - } else { - parts := []string{ - authHeaderPrefix + " Credential=" + ctx.credValues.AccessKeyID + "/" + ctx.credentialString, - "SignedHeaders=" + ctx.signedHeaders, - authHeaderSignatureElem + ctx.signature, - } - ctx.Request.Header.Set(authorizationHeader, strings.Join(parts, ", ")) - } - - return nil -} - -// GetSignedRequestSignature attempts to extract the signature of the request. -// Returning an error if the request is unsigned, or unable to extract the -// signature. -func GetSignedRequestSignature(r *http.Request) ([]byte, error) { - - if auth := r.Header.Get(authorizationHeader); len(auth) != 0 { - ps := strings.Split(auth, ", ") - for _, p := range ps { - if idx := strings.Index(p, authHeaderSignatureElem); idx >= 0 { - sig := p[len(authHeaderSignatureElem):] - if len(sig) == 0 { - return nil, fmt.Errorf("invalid request signature authorization header") - } - return hex.DecodeString(sig) - } - } - } - - if sig := r.URL.Query().Get("X-Amz-Signature"); len(sig) != 0 { - return hex.DecodeString(sig) - } - - return nil, fmt.Errorf("request not signed") -} - -func (ctx *signingCtx) buildTime() { - if ctx.isPresign { - duration := int64(ctx.ExpireTime / time.Second) - ctx.Query.Set("X-Amz-Date", formatTime(ctx.Time)) - ctx.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) - } else { - ctx.Request.Header.Set("X-Amz-Date", formatTime(ctx.Time)) - } -} - -func (ctx *signingCtx) buildCredentialString() { - ctx.credentialString = buildSigningScope(ctx.Region, ctx.ServiceName, ctx.Time) - - if ctx.isPresign { - ctx.Query.Set("X-Amz-Credential", ctx.credValues.AccessKeyID+"/"+ctx.credentialString) - } -} - -func buildQuery(r rule, header http.Header) (url.Values, http.Header) { - query := url.Values{} - unsignedHeaders := http.Header{} - for k, h := range header { - if r.IsValid(k) { - query[k] = h - } else { - unsignedHeaders[k] = h - } - } - - return query, unsignedHeaders -} -func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { - var headers []string - headers = append(headers, "host") - for k, v := range header { - if !r.IsValid(k) { - continue // ignored header - } - if ctx.SignedHeaderVals == nil { - ctx.SignedHeaderVals = make(http.Header) - } - - lowerCaseKey := strings.ToLower(k) - if _, ok := ctx.SignedHeaderVals[lowerCaseKey]; ok { - // include additional values - ctx.SignedHeaderVals[lowerCaseKey] = append(ctx.SignedHeaderVals[lowerCaseKey], v...) - continue - } - - headers = append(headers, lowerCaseKey) - ctx.SignedHeaderVals[lowerCaseKey] = v - } - sort.Strings(headers) - - ctx.signedHeaders = strings.Join(headers, ";") - - if ctx.isPresign { - ctx.Query.Set("X-Amz-SignedHeaders", ctx.signedHeaders) - } - - headerValues := make([]string, len(headers)) - for i, k := range headers { - if k == "host" { - if ctx.Request.Host != "" { - headerValues[i] = "host:" + ctx.Request.Host - } else { - headerValues[i] = "host:" + ctx.Request.URL.Host - } - } else { - headerValues[i] = k + ":" + - strings.Join(ctx.SignedHeaderVals[k], ",") - } - } - stripExcessSpaces(headerValues) - ctx.canonicalHeaders = strings.Join(headerValues, "\n") -} - -func (ctx *signingCtx) buildCanonicalString() { - ctx.Request.URL.RawQuery = strings.Replace(ctx.Query.Encode(), "+", "%20", -1) - - uri := getURIPath(ctx.Request.URL) - - if !ctx.DisableURIPathEscaping { - uri = rest.EscapePath(uri, false) - } - - ctx.canonicalString = strings.Join([]string{ - ctx.Request.Method, - uri, - ctx.Request.URL.RawQuery, - ctx.canonicalHeaders + "\n", - ctx.signedHeaders, - ctx.bodyDigest, - }, "\n") -} - -func (ctx *signingCtx) buildStringToSign() { - ctx.stringToSign = strings.Join([]string{ - authHeaderPrefix, - formatTime(ctx.Time), - ctx.credentialString, - hex.EncodeToString(hashSHA256([]byte(ctx.canonicalString))), - }, "\n") -} - -func (ctx *signingCtx) buildSignature() { - creds := deriveSigningKey(ctx.Region, ctx.ServiceName, ctx.credValues.SecretAccessKey, ctx.Time) - signature := hmacSHA256(creds, []byte(ctx.stringToSign)) - ctx.signature = hex.EncodeToString(signature) -} - -func (ctx *signingCtx) buildBodyDigest() error { - hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") - if hash == "" { - includeSHA256Header := ctx.unsignedPayload || - ctx.ServiceName == "s3" || - ctx.ServiceName == "glacier" - - s3Presign := ctx.isPresign && ctx.ServiceName == "s3" - - if ctx.unsignedPayload || s3Presign { - hash = "UNSIGNED-PAYLOAD" - includeSHA256Header = !s3Presign - } else if ctx.Body == nil { - hash = emptyStringSHA256 - } else { - if !aws.IsReaderSeekable(ctx.Body) { - return fmt.Errorf("cannot use unseekable request body %T, for signed request with body", ctx.Body) - } - hashBytes, err := makeSha256Reader(ctx.Body) - if err != nil { - return err - } - hash = hex.EncodeToString(hashBytes) - } - - if includeSHA256Header { - ctx.Request.Header.Set("X-Amz-Content-Sha256", hash) - } - } - ctx.bodyDigest = hash - - return nil -} - -// isRequestSigned returns if the request is currently signed or presigned -func (ctx *signingCtx) isRequestSigned() bool { - if ctx.isPresign && ctx.Query.Get("X-Amz-Signature") != "" { - return true - } - if ctx.Request.Header.Get("Authorization") != "" { - return true - } - - return false -} - -// unsign removes signing flags for both signed and presigned requests. -func (ctx *signingCtx) removePresign() { - ctx.Query.Del("X-Amz-Algorithm") - ctx.Query.Del("X-Amz-Signature") - ctx.Query.Del("X-Amz-Security-Token") - ctx.Query.Del("X-Amz-Date") - ctx.Query.Del("X-Amz-Expires") - ctx.Query.Del("X-Amz-Credential") - ctx.Query.Del("X-Amz-SignedHeaders") -} - -func hmacSHA256(key []byte, data []byte) []byte { - hash := hmac.New(sha256.New, key) - hash.Write(data) - return hash.Sum(nil) -} - -func hashSHA256(data []byte) []byte { - hash := sha256.New() - hash.Write(data) - return hash.Sum(nil) -} - -func makeSha256Reader(reader io.ReadSeeker) (hashBytes []byte, err error) { - hash := sha256.New() - start, err := reader.Seek(0, sdkio.SeekCurrent) - if err != nil { - return nil, err - } - defer func() { - // ensure error is return if unable to seek back to start of payload. - _, err = reader.Seek(start, sdkio.SeekStart) - }() - - // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies - // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. - size, err := aws.SeekerLen(reader) - if err != nil { - io.Copy(hash, reader) - } else { - io.CopyN(hash, reader, size) - } - - return hash.Sum(nil), nil -} - -const doubleSpace = " " - -// stripExcessSpaces will rewrite the passed in slice's string values to not -// contain multiple side-by-side spaces. -func stripExcessSpaces(vals []string) { - var j, k, l, m, spaces int - for i, str := range vals { - // Trim trailing spaces - for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { - } - - // Trim leading spaces - for k = 0; k < j && str[k] == ' '; k++ { - } - str = str[k : j+1] - - // Strip multiple spaces. - j = strings.Index(str, doubleSpace) - if j < 0 { - vals[i] = str - continue - } - - buf := []byte(str) - for k, m, l = j, j, len(buf); k < l; k++ { - if buf[k] == ' ' { - if spaces == 0 { - // First space. - buf[m] = buf[k] - m++ - } - spaces++ - } else { - // End of multiple spaces. - spaces = 0 - buf[m] = buf[k] - m++ - } - } - - vals[i] = string(buf[:m]) - } -} - -func buildSigningScope(region, service string, dt time.Time) string { - return strings.Join([]string{ - formatShortTime(dt), - region, - service, - awsV4Request, - }, "/") -} - -func deriveSigningKey(region, service, secretKey string, dt time.Time) []byte { - kDate := hmacSHA256([]byte("AWS4"+secretKey), []byte(formatShortTime(dt))) - kRegion := hmacSHA256(kDate, []byte(region)) - kService := hmacSHA256(kRegion, []byte(service)) - signingKey := hmacSHA256(kService, []byte(awsV4Request)) - return signingKey -} - -func formatShortTime(dt time.Time) string { - return dt.UTC().Format(shortTimeFormat) -} - -func formatTime(dt time.Time) string { - return dt.UTC().Format(timeFormat) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go deleted file mode 100644 index 98751ee84..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ /dev/null @@ -1,264 +0,0 @@ -package aws - -import ( - "io" - "strings" - "sync" - - "github.com/aws/aws-sdk-go/internal/sdkio" -) - -// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the -// SDK to accept an io.Reader that is not also an io.Seeker for unsigned -// streaming payload API operations. -// -// A ReadSeekCloser wrapping an nonseekable io.Reader used in an API -// operation's input will prevent that operation being retried in the case of -// network errors, and cause operation requests to fail if the operation -// requires payload signing. -// -// Note: If using With S3 PutObject to stream an object upload The SDK's S3 -// Upload manager (s3manager.Uploader) provides support for streaming with the -// ability to retry network errors. -func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { - return ReaderSeekerCloser{r} -} - -// ReaderSeekerCloser represents a reader that can also delegate io.Seeker and -// io.Closer interfaces to the underlying object if they are available. -type ReaderSeekerCloser struct { - r io.Reader -} - -// IsReaderSeekable returns if the underlying reader type can be seeked. A -// io.Reader might not actually be seekable if it is the ReaderSeekerCloser -// type. -func IsReaderSeekable(r io.Reader) bool { - switch v := r.(type) { - case ReaderSeekerCloser: - return v.IsSeeker() - case *ReaderSeekerCloser: - return v.IsSeeker() - case io.ReadSeeker: - return true - default: - return false - } -} - -// Read reads from the reader up to size of p. The number of bytes read, and -// error if it occurred will be returned. -// -// If the reader is not an io.Reader zero bytes read, and nil error will be -// returned. -// -// Performs the same functionality as io.Reader Read -func (r ReaderSeekerCloser) Read(p []byte) (int, error) { - switch t := r.r.(type) { - case io.Reader: - return t.Read(p) - } - return 0, nil -} - -// Seek sets the offset for the next Read to offset, interpreted according to -// whence: 0 means relative to the origin of the file, 1 means relative to the -// current offset, and 2 means relative to the end. Seek returns the new offset -// and an error, if any. -// -// If the ReaderSeekerCloser is not an io.Seeker nothing will be done. -func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) { - switch t := r.r.(type) { - case io.Seeker: - return t.Seek(offset, whence) - } - return int64(0), nil -} - -// IsSeeker returns if the underlying reader is also a seeker. -func (r ReaderSeekerCloser) IsSeeker() bool { - _, ok := r.r.(io.Seeker) - return ok -} - -// HasLen returns the length of the underlying reader if the value implements -// the Len() int method. -func (r ReaderSeekerCloser) HasLen() (int, bool) { - type lenner interface { - Len() int - } - - if lr, ok := r.r.(lenner); ok { - return lr.Len(), true - } - - return 0, false -} - -// GetLen returns the length of the bytes remaining in the underlying reader. -// Checks first for Len(), then io.Seeker to determine the size of the -// underlying reader. -// -// Will return -1 if the length cannot be determined. -func (r ReaderSeekerCloser) GetLen() (int64, error) { - if l, ok := r.HasLen(); ok { - return int64(l), nil - } - - if s, ok := r.r.(io.Seeker); ok { - return seekerLen(s) - } - - return -1, nil -} - -// SeekerLen attempts to get the number of bytes remaining at the seeker's -// current position. Returns the number of bytes remaining or error. -func SeekerLen(s io.Seeker) (int64, error) { - // Determine if the seeker is actually seekable. ReaderSeekerCloser - // hides the fact that a io.Readers might not actually be seekable. - switch v := s.(type) { - case ReaderSeekerCloser: - return v.GetLen() - case *ReaderSeekerCloser: - return v.GetLen() - } - - return seekerLen(s) -} - -func seekerLen(s io.Seeker) (int64, error) { - curOffset, err := s.Seek(0, sdkio.SeekCurrent) - if err != nil { - return 0, err - } - - endOffset, err := s.Seek(0, sdkio.SeekEnd) - if err != nil { - return 0, err - } - - _, err = s.Seek(curOffset, sdkio.SeekStart) - if err != nil { - return 0, err - } - - return endOffset - curOffset, nil -} - -// Close closes the ReaderSeekerCloser. -// -// If the ReaderSeekerCloser is not an io.Closer nothing will be done. -func (r ReaderSeekerCloser) Close() error { - switch t := r.r.(type) { - case io.Closer: - return t.Close() - } - return nil -} - -// A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface -// Can be used with the s3manager.Downloader to download content to a buffer -// in memory. Safe to use concurrently. -type WriteAtBuffer struct { - buf []byte - m sync.Mutex - - // GrowthCoeff defines the growth rate of the internal buffer. By - // default, the growth rate is 1, where expanding the internal - // buffer will allocate only enough capacity to fit the new expected - // length. - GrowthCoeff float64 -} - -// NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer -// provided by buf. -func NewWriteAtBuffer(buf []byte) *WriteAtBuffer { - return &WriteAtBuffer{buf: buf} -} - -// WriteAt writes a slice of bytes to a buffer starting at the position provided -// The number of bytes written will be returned, or error. Can overwrite previous -// written slices if the write ats overlap. -func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { - pLen := len(p) - expLen := pos + int64(pLen) - b.m.Lock() - defer b.m.Unlock() - if int64(len(b.buf)) < expLen { - if int64(cap(b.buf)) < expLen { - if b.GrowthCoeff < 1 { - b.GrowthCoeff = 1 - } - newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen))) - copy(newBuf, b.buf) - b.buf = newBuf - } - b.buf = b.buf[:expLen] - } - copy(b.buf[pos:], p) - return pLen, nil -} - -// Bytes returns a slice of bytes written to the buffer. -func (b *WriteAtBuffer) Bytes() []byte { - b.m.Lock() - defer b.m.Unlock() - return b.buf -} - -// MultiCloser is a utility to close multiple io.Closers within a single -// statement. -type MultiCloser []io.Closer - -// Close closes all of the io.Closers making up the MultiClosers. Any -// errors that occur while closing will be returned in the order they -// occur. -func (m MultiCloser) Close() error { - var errs errors - for _, c := range m { - err := c.Close() - if err != nil { - errs = append(errs, err) - } - } - if len(errs) != 0 { - return errs - } - - return nil -} - -type errors []error - -func (es errors) Error() string { - var parts []string - for _, e := range es { - parts = append(parts, e.Error()) - } - - return strings.Join(parts, "\n") -} - -// CopySeekableBody copies the seekable body to an io.Writer -func CopySeekableBody(dst io.Writer, src io.ReadSeeker) (int64, error) { - curPos, err := src.Seek(0, sdkio.SeekCurrent) - if err != nil { - return 0, err - } - - // copy errors may be assumed to be from the body. - n, err := io.Copy(dst, src) - if err != nil { - return n, err - } - - // seek back to the first position after reading to reset - // the body for transmission. - _, err = src.Seek(curPos, sdkio.SeekStart) - if err != nil { - return n, err - } - - return n, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url.go b/vendor/github.com/aws/aws-sdk-go/aws/url.go deleted file mode 100644 index 6192b2455..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/url.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build go1.8 - -package aws - -import "net/url" - -// URLHostname will extract the Hostname without port from the URL value. -// -// Wrapper of net/url#URL.Hostname for backwards Go version compatibility. -func URLHostname(url *url.URL) string { - return url.Hostname() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go deleted file mode 100644 index 0210d2720..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go +++ /dev/null @@ -1,29 +0,0 @@ -// +build !go1.8 - -package aws - -import ( - "net/url" - "strings" -) - -// URLHostname will extract the Hostname without port from the URL value. -// -// Copy of Go 1.8's net/url#URL.Hostname functionality. -func URLHostname(url *url.URL) string { - return stripPort(url.Host) - -} - -// stripPort is copy of Go 1.8 url#URL.Hostname functionality. -// https://golang.org/src/net/url/url.go -func stripPort(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return hostport - } - if i := strings.IndexByte(hostport, ']'); i != -1 { - return strings.TrimPrefix(hostport[:i], "[") - } - return hostport[:colon] -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go deleted file mode 100644 index 571a406e1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ /dev/null @@ -1,8 +0,0 @@ -// Package aws provides core functionality for making requests to AWS services. -package aws - -// SDKName is the name of this AWS SDK -const SDKName = "aws-sdk-go" - -// SDKVersion is the version of this SDK -const SDKVersion = "1.32.11" diff --git a/vendor/github.com/aws/aws-sdk-go/internal/context/background_go1.5.go b/vendor/github.com/aws/aws-sdk-go/internal/context/background_go1.5.go deleted file mode 100644 index 876dcb3fd..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/context/background_go1.5.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build !go1.7 - -package context - -import "time" - -// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to -// provide a 1.6 and 1.5 safe version of context that is compatible with Go -// 1.7's Context. -// -// An emptyCtx is never canceled, has no values, and has no deadline. It is not -// struct{}, since vars of this type must have distinct addresses. -type emptyCtx int - -func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { - return -} - -func (*emptyCtx) Done() <-chan struct{} { - return nil -} - -func (*emptyCtx) Err() error { - return nil -} - -func (*emptyCtx) Value(key interface{}) interface{} { - return nil -} - -func (e *emptyCtx) String() string { - switch e { - case BackgroundCtx: - return "aws.BackgroundContext" - } - return "unknown empty Context" -} - -// BackgroundCtx is the common base context. -var BackgroundCtx = new(emptyCtx) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go deleted file mode 100644 index e83a99886..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go +++ /dev/null @@ -1,120 +0,0 @@ -package ini - -// ASTKind represents different states in the parse table -// and the type of AST that is being constructed -type ASTKind int - -// ASTKind* is used in the parse table to transition between -// the different states -const ( - ASTKindNone = ASTKind(iota) - ASTKindStart - ASTKindExpr - ASTKindEqualExpr - ASTKindStatement - ASTKindSkipStatement - ASTKindExprStatement - ASTKindSectionStatement - ASTKindNestedSectionStatement - ASTKindCompletedNestedSectionStatement - ASTKindCommentStatement - ASTKindCompletedSectionStatement -) - -func (k ASTKind) String() string { - switch k { - case ASTKindNone: - return "none" - case ASTKindStart: - return "start" - case ASTKindExpr: - return "expr" - case ASTKindStatement: - return "stmt" - case ASTKindSectionStatement: - return "section_stmt" - case ASTKindExprStatement: - return "expr_stmt" - case ASTKindCommentStatement: - return "comment" - case ASTKindNestedSectionStatement: - return "nested_section_stmt" - case ASTKindCompletedSectionStatement: - return "completed_stmt" - case ASTKindSkipStatement: - return "skip" - default: - return "" - } -} - -// AST interface allows us to determine what kind of node we -// are on and casting may not need to be necessary. -// -// The root is always the first node in Children -type AST struct { - Kind ASTKind - Root Token - RootToken bool - Children []AST -} - -func newAST(kind ASTKind, root AST, children ...AST) AST { - return AST{ - Kind: kind, - Children: append([]AST{root}, children...), - } -} - -func newASTWithRootToken(kind ASTKind, root Token, children ...AST) AST { - return AST{ - Kind: kind, - Root: root, - RootToken: true, - Children: children, - } -} - -// AppendChild will append to the list of children an AST has. -func (a *AST) AppendChild(child AST) { - a.Children = append(a.Children, child) -} - -// GetRoot will return the root AST which can be the first entry -// in the children list or a token. -func (a *AST) GetRoot() AST { - if a.RootToken { - return *a - } - - if len(a.Children) == 0 { - return AST{} - } - - return a.Children[0] -} - -// GetChildren will return the current AST's list of children -func (a *AST) GetChildren() []AST { - if len(a.Children) == 0 { - return []AST{} - } - - if a.RootToken { - return a.Children - } - - return a.Children[1:] -} - -// SetChildren will set and override all children of the AST. -func (a *AST) SetChildren(children []AST) { - if a.RootToken { - a.Children = children - } else { - a.Children = append(a.Children[:1], children...) - } -} - -// Start is used to indicate the starting state of the parse table. -var Start = newAST(ASTKindStart, AST{}) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go deleted file mode 100644 index 0895d53cb..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go +++ /dev/null @@ -1,11 +0,0 @@ -package ini - -var commaRunes = []rune(",") - -func isComma(b rune) bool { - return b == ',' -} - -func newCommaToken() Token { - return newToken(TokenComma, commaRunes, NoneType) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go deleted file mode 100644 index 0b76999ba..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go +++ /dev/null @@ -1,35 +0,0 @@ -package ini - -// isComment will return whether or not the next byte(s) is a -// comment. -func isComment(b []rune) bool { - if len(b) == 0 { - return false - } - - switch b[0] { - case ';': - return true - case '#': - return true - } - - return false -} - -// newCommentToken will create a comment token and -// return how many bytes were read. -func newCommentToken(b []rune) (Token, int, error) { - i := 0 - for ; i < len(b); i++ { - if b[i] == '\n' { - break - } - - if len(b)-i > 2 && b[i] == '\r' && b[i+1] == '\n' { - break - } - } - - return newToken(TokenComment, b[:i], NoneType), i, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go deleted file mode 100644 index 25ce0fe13..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go +++ /dev/null @@ -1,29 +0,0 @@ -// Package ini is an LL(1) parser for configuration files. -// -// Example: -// sections, err := ini.OpenFile("/path/to/file") -// if err != nil { -// panic(err) -// } -// -// profile := "foo" -// section, ok := sections.GetSection(profile) -// if !ok { -// fmt.Printf("section %q could not be found", profile) -// } -// -// Below is the BNF that describes this parser -// Grammar: -// stmt -> value stmt' -// stmt' -> epsilon | op stmt -// value -> number | string | boolean | quoted_string -// -// section -> [ section' -// section' -> value section_close -// section_close -> ] -// -// SkipState will skip (NL WS)+ -// -// comment -> # comment' | ; comment' -// comment' -> epsilon | value -package ini diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go deleted file mode 100644 index 04345a54c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go +++ /dev/null @@ -1,4 +0,0 @@ -package ini - -// emptyToken is used to satisfy the Token interface -var emptyToken = newToken(TokenNone, []rune{}, NoneType) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go deleted file mode 100644 index 91ba2a59d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go +++ /dev/null @@ -1,24 +0,0 @@ -package ini - -// newExpression will return an expression AST. -// Expr represents an expression -// -// grammar: -// expr -> string | number -func newExpression(tok Token) AST { - return newASTWithRootToken(ASTKindExpr, tok) -} - -func newEqualExpr(left AST, tok Token) AST { - return newASTWithRootToken(ASTKindEqualExpr, tok, left) -} - -// EqualExprKey will return a LHS value in the equal expr -func EqualExprKey(ast AST) string { - children := ast.GetChildren() - if len(children) == 0 || ast.Kind != ASTKindEqualExpr { - return "" - } - - return string(children[0].Root.Raw()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go deleted file mode 100644 index 8d462f77e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build gofuzz - -package ini - -import ( - "bytes" -) - -func Fuzz(data []byte) int { - b := bytes.NewReader(data) - - if _, err := Parse(b); err != nil { - return 0 - } - - return 1 -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go deleted file mode 100644 index 3b0ca7afe..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go +++ /dev/null @@ -1,51 +0,0 @@ -package ini - -import ( - "io" - "os" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// OpenFile takes a path to a given file, and will open and parse -// that file. -func OpenFile(path string) (Sections, error) { - f, err := os.Open(path) - if err != nil { - return Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open file", err) - } - defer f.Close() - - return Parse(f) -} - -// Parse will parse the given file using the shared config -// visitor. -func Parse(f io.Reader) (Sections, error) { - tree, err := ParseAST(f) - if err != nil { - return Sections{}, err - } - - v := NewDefaultVisitor() - if err = Walk(tree, v); err != nil { - return Sections{}, err - } - - return v.Sections, nil -} - -// ParseBytes will parse the given bytes and return the parsed sections. -func ParseBytes(b []byte) (Sections, error) { - tree, err := ParseASTBytes(b) - if err != nil { - return Sections{}, err - } - - v := NewDefaultVisitor() - if err = Walk(tree, v); err != nil { - return Sections{}, err - } - - return v.Sections, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go deleted file mode 100644 index 582c024ad..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go +++ /dev/null @@ -1,165 +0,0 @@ -package ini - -import ( - "bytes" - "io" - "io/ioutil" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -const ( - // ErrCodeUnableToReadFile is used when a file is failed to be - // opened or read from. - ErrCodeUnableToReadFile = "FailedRead" -) - -// TokenType represents the various different tokens types -type TokenType int - -func (t TokenType) String() string { - switch t { - case TokenNone: - return "none" - case TokenLit: - return "literal" - case TokenSep: - return "sep" - case TokenOp: - return "op" - case TokenWS: - return "ws" - case TokenNL: - return "newline" - case TokenComment: - return "comment" - case TokenComma: - return "comma" - default: - return "" - } -} - -// TokenType enums -const ( - TokenNone = TokenType(iota) - TokenLit - TokenSep - TokenComma - TokenOp - TokenWS - TokenNL - TokenComment -) - -type iniLexer struct{} - -// Tokenize will return a list of tokens during lexical analysis of the -// io.Reader. -func (l *iniLexer) Tokenize(r io.Reader) ([]Token, error) { - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, awserr.New(ErrCodeUnableToReadFile, "unable to read file", err) - } - - return l.tokenize(b) -} - -func (l *iniLexer) tokenize(b []byte) ([]Token, error) { - runes := bytes.Runes(b) - var err error - n := 0 - tokenAmount := countTokens(runes) - tokens := make([]Token, tokenAmount) - count := 0 - - for len(runes) > 0 && count < tokenAmount { - switch { - case isWhitespace(runes[0]): - tokens[count], n, err = newWSToken(runes) - case isComma(runes[0]): - tokens[count], n = newCommaToken(), 1 - case isComment(runes): - tokens[count], n, err = newCommentToken(runes) - case isNewline(runes): - tokens[count], n, err = newNewlineToken(runes) - case isSep(runes): - tokens[count], n, err = newSepToken(runes) - case isOp(runes): - tokens[count], n, err = newOpToken(runes) - default: - tokens[count], n, err = newLitToken(runes) - } - - if err != nil { - return nil, err - } - - count++ - - runes = runes[n:] - } - - return tokens[:count], nil -} - -func countTokens(runes []rune) int { - count, n := 0, 0 - var err error - - for len(runes) > 0 { - switch { - case isWhitespace(runes[0]): - _, n, err = newWSToken(runes) - case isComma(runes[0]): - _, n = newCommaToken(), 1 - case isComment(runes): - _, n, err = newCommentToken(runes) - case isNewline(runes): - _, n, err = newNewlineToken(runes) - case isSep(runes): - _, n, err = newSepToken(runes) - case isOp(runes): - _, n, err = newOpToken(runes) - default: - _, n, err = newLitToken(runes) - } - - if err != nil { - return 0 - } - - count++ - runes = runes[n:] - } - - return count + 1 -} - -// Token indicates a metadata about a given value. -type Token struct { - t TokenType - ValueType ValueType - base int - raw []rune -} - -var emptyValue = Value{} - -func newToken(t TokenType, raw []rune, v ValueType) Token { - return Token{ - t: t, - raw: raw, - ValueType: v, - } -} - -// Raw return the raw runes that were consumed -func (tok Token) Raw() []rune { - return tok.raw -} - -// Type returns the token type -func (tok Token) Type() TokenType { - return tok.t -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go deleted file mode 100644 index cf9fad81e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go +++ /dev/null @@ -1,356 +0,0 @@ -package ini - -import ( - "fmt" - "io" -) - -// State enums for the parse table -const ( - InvalidState = iota - // stmt -> value stmt' - StatementState - // stmt' -> MarkComplete | op stmt - StatementPrimeState - // value -> number | string | boolean | quoted_string - ValueState - // section -> [ section' - OpenScopeState - // section' -> value section_close - SectionState - // section_close -> ] - CloseScopeState - // SkipState will skip (NL WS)+ - SkipState - // SkipTokenState will skip any token and push the previous - // state onto the stack. - SkipTokenState - // comment -> # comment' | ; comment' - // comment' -> MarkComplete | value - CommentState - // MarkComplete state will complete statements and move that - // to the completed AST list - MarkCompleteState - // TerminalState signifies that the tokens have been fully parsed - TerminalState -) - -// parseTable is a state machine to dictate the grammar above. -var parseTable = map[ASTKind]map[TokenType]int{ - ASTKindStart: map[TokenType]int{ - TokenLit: StatementState, - TokenSep: OpenScopeState, - TokenWS: SkipTokenState, - TokenNL: SkipTokenState, - TokenComment: CommentState, - TokenNone: TerminalState, - }, - ASTKindCommentStatement: map[TokenType]int{ - TokenLit: StatementState, - TokenSep: OpenScopeState, - TokenWS: SkipTokenState, - TokenNL: SkipTokenState, - TokenComment: CommentState, - TokenNone: MarkCompleteState, - }, - ASTKindExpr: map[TokenType]int{ - TokenOp: StatementPrimeState, - TokenLit: ValueState, - TokenSep: OpenScopeState, - TokenWS: ValueState, - TokenNL: SkipState, - TokenComment: CommentState, - TokenNone: MarkCompleteState, - }, - ASTKindEqualExpr: map[TokenType]int{ - TokenLit: ValueState, - TokenWS: SkipTokenState, - TokenNL: SkipState, - }, - ASTKindStatement: map[TokenType]int{ - TokenLit: SectionState, - TokenSep: CloseScopeState, - TokenWS: SkipTokenState, - TokenNL: SkipTokenState, - TokenComment: CommentState, - TokenNone: MarkCompleteState, - }, - ASTKindExprStatement: map[TokenType]int{ - TokenLit: ValueState, - TokenSep: OpenScopeState, - TokenOp: ValueState, - TokenWS: ValueState, - TokenNL: MarkCompleteState, - TokenComment: CommentState, - TokenNone: TerminalState, - TokenComma: SkipState, - }, - ASTKindSectionStatement: map[TokenType]int{ - TokenLit: SectionState, - TokenOp: SectionState, - TokenSep: CloseScopeState, - TokenWS: SectionState, - TokenNL: SkipTokenState, - }, - ASTKindCompletedSectionStatement: map[TokenType]int{ - TokenWS: SkipTokenState, - TokenNL: SkipTokenState, - TokenLit: StatementState, - TokenSep: OpenScopeState, - TokenComment: CommentState, - TokenNone: MarkCompleteState, - }, - ASTKindSkipStatement: map[TokenType]int{ - TokenLit: StatementState, - TokenSep: OpenScopeState, - TokenWS: SkipTokenState, - TokenNL: SkipTokenState, - TokenComment: CommentState, - TokenNone: TerminalState, - }, -} - -// ParseAST will parse input from an io.Reader using -// an LL(1) parser. -func ParseAST(r io.Reader) ([]AST, error) { - lexer := iniLexer{} - tokens, err := lexer.Tokenize(r) - if err != nil { - return []AST{}, err - } - - return parse(tokens) -} - -// ParseASTBytes will parse input from a byte slice using -// an LL(1) parser. -func ParseASTBytes(b []byte) ([]AST, error) { - lexer := iniLexer{} - tokens, err := lexer.tokenize(b) - if err != nil { - return []AST{}, err - } - - return parse(tokens) -} - -func parse(tokens []Token) ([]AST, error) { - start := Start - stack := newParseStack(3, len(tokens)) - - stack.Push(start) - s := newSkipper() - -loop: - for stack.Len() > 0 { - k := stack.Pop() - - var tok Token - if len(tokens) == 0 { - // this occurs when all the tokens have been processed - // but reduction of what's left on the stack needs to - // occur. - tok = emptyToken - } else { - tok = tokens[0] - } - - step := parseTable[k.Kind][tok.Type()] - if s.ShouldSkip(tok) { - // being in a skip state with no tokens will break out of - // the parse loop since there is nothing left to process. - if len(tokens) == 0 { - break loop - } - // if should skip is true, we skip the tokens until should skip is set to false. - step = SkipTokenState - } - - switch step { - case TerminalState: - // Finished parsing. Push what should be the last - // statement to the stack. If there is anything left - // on the stack, an error in parsing has occurred. - if k.Kind != ASTKindStart { - stack.MarkComplete(k) - } - break loop - case SkipTokenState: - // When skipping a token, the previous state was popped off the stack. - // To maintain the correct state, the previous state will be pushed - // onto the stack. - stack.Push(k) - case StatementState: - if k.Kind != ASTKindStart { - stack.MarkComplete(k) - } - expr := newExpression(tok) - stack.Push(expr) - case StatementPrimeState: - if tok.Type() != TokenOp { - stack.MarkComplete(k) - continue - } - - if k.Kind != ASTKindExpr { - return nil, NewParseError( - fmt.Sprintf("invalid expression: expected Expr type, but found %T type", k), - ) - } - - k = trimSpaces(k) - expr := newEqualExpr(k, tok) - stack.Push(expr) - case ValueState: - // ValueState requires the previous state to either be an equal expression - // or an expression statement. - // - // This grammar occurs when the RHS is a number, word, or quoted string. - // equal_expr -> lit op equal_expr' - // equal_expr' -> number | string | quoted_string - // quoted_string -> " quoted_string' - // quoted_string' -> string quoted_string_end - // quoted_string_end -> " - // - // otherwise - // expr_stmt -> equal_expr (expr_stmt')* - // expr_stmt' -> ws S | op S | MarkComplete - // S -> equal_expr' expr_stmt' - switch k.Kind { - case ASTKindEqualExpr: - // assigning a value to some key - k.AppendChild(newExpression(tok)) - stack.Push(newExprStatement(k)) - case ASTKindExpr: - k.Root.raw = append(k.Root.raw, tok.Raw()...) - stack.Push(k) - case ASTKindExprStatement: - root := k.GetRoot() - children := root.GetChildren() - if len(children) == 0 { - return nil, NewParseError( - fmt.Sprintf("invalid expression: AST contains no children %s", k.Kind), - ) - } - - rhs := children[len(children)-1] - - if rhs.Root.ValueType != QuotedStringType { - rhs.Root.ValueType = StringType - rhs.Root.raw = append(rhs.Root.raw, tok.Raw()...) - - } - - children[len(children)-1] = rhs - k.SetChildren(children) - - stack.Push(k) - } - case OpenScopeState: - if !runeCompare(tok.Raw(), openBrace) { - return nil, NewParseError("expected '['") - } - // If OpenScopeState is not at the start, we must mark the previous ast as complete - // - // for example: if previous ast was a skip statement; - // we should mark it as complete before we create a new statement - if k.Kind != ASTKindStart { - stack.MarkComplete(k) - } - - stmt := newStatement() - stack.Push(stmt) - case CloseScopeState: - if !runeCompare(tok.Raw(), closeBrace) { - return nil, NewParseError("expected ']'") - } - - k = trimSpaces(k) - stack.Push(newCompletedSectionStatement(k)) - case SectionState: - var stmt AST - - switch k.Kind { - case ASTKindStatement: - // If there are multiple literals inside of a scope declaration, - // then the current token's raw value will be appended to the Name. - // - // This handles cases like [ profile default ] - // - // k will represent a SectionStatement with the children representing - // the label of the section - stmt = newSectionStatement(tok) - case ASTKindSectionStatement: - k.Root.raw = append(k.Root.raw, tok.Raw()...) - stmt = k - default: - return nil, NewParseError( - fmt.Sprintf("invalid statement: expected statement: %v", k.Kind), - ) - } - - stack.Push(stmt) - case MarkCompleteState: - if k.Kind != ASTKindStart { - stack.MarkComplete(k) - } - - if stack.Len() == 0 { - stack.Push(start) - } - case SkipState: - stack.Push(newSkipStatement(k)) - s.Skip() - case CommentState: - if k.Kind == ASTKindStart { - stack.Push(k) - } else { - stack.MarkComplete(k) - } - - stmt := newCommentStatement(tok) - stack.Push(stmt) - default: - return nil, NewParseError( - fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", - k, tok.Type())) - } - - if len(tokens) > 0 { - tokens = tokens[1:] - } - } - - // this occurs when a statement has not been completed - if stack.top > 1 { - return nil, NewParseError(fmt.Sprintf("incomplete ini expression")) - } - - // returns a sublist which excludes the start symbol - return stack.List(), nil -} - -// trimSpaces will trim spaces on the left and right hand side of -// the literal. -func trimSpaces(k AST) AST { - // trim left hand side of spaces - for i := 0; i < len(k.Root.raw); i++ { - if !isWhitespace(k.Root.raw[i]) { - break - } - - k.Root.raw = k.Root.raw[1:] - i-- - } - - // trim right hand side of spaces - for i := len(k.Root.raw) - 1; i >= 0; i-- { - if !isWhitespace(k.Root.raw[i]) { - break - } - - k.Root.raw = k.Root.raw[:len(k.Root.raw)-1] - } - - return k -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go deleted file mode 100644 index 24df543d3..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go +++ /dev/null @@ -1,324 +0,0 @@ -package ini - -import ( - "fmt" - "strconv" - "strings" -) - -var ( - runesTrue = []rune("true") - runesFalse = []rune("false") -) - -var literalValues = [][]rune{ - runesTrue, - runesFalse, -} - -func isBoolValue(b []rune) bool { - for _, lv := range literalValues { - if isLitValue(lv, b) { - return true - } - } - return false -} - -func isLitValue(want, have []rune) bool { - if len(have) < len(want) { - return false - } - - for i := 0; i < len(want); i++ { - if want[i] != have[i] { - return false - } - } - - return true -} - -// isNumberValue will return whether not the leading characters in -// a byte slice is a number. A number is delimited by whitespace or -// the newline token. -// -// A number is defined to be in a binary, octal, decimal (int | float), hex format, -// or in scientific notation. -func isNumberValue(b []rune) bool { - negativeIndex := 0 - helper := numberHelper{} - needDigit := false - - for i := 0; i < len(b); i++ { - negativeIndex++ - - switch b[i] { - case '-': - if helper.IsNegative() || negativeIndex != 1 { - return false - } - helper.Determine(b[i]) - needDigit = true - continue - case 'e', 'E': - if err := helper.Determine(b[i]); err != nil { - return false - } - negativeIndex = 0 - needDigit = true - continue - case 'b': - if helper.numberFormat == hex { - break - } - fallthrough - case 'o', 'x': - needDigit = true - if i == 0 { - return false - } - - fallthrough - case '.': - if err := helper.Determine(b[i]); err != nil { - return false - } - needDigit = true - continue - } - - if i > 0 && (isNewline(b[i:]) || isWhitespace(b[i])) { - return !needDigit - } - - if !helper.CorrectByte(b[i]) { - return false - } - needDigit = false - } - - return !needDigit -} - -func isValid(b []rune) (bool, int, error) { - if len(b) == 0 { - // TODO: should probably return an error - return false, 0, nil - } - - return isValidRune(b[0]), 1, nil -} - -func isValidRune(r rune) bool { - return r != ':' && r != '=' && r != '[' && r != ']' && r != ' ' && r != '\n' -} - -// ValueType is an enum that will signify what type -// the Value is -type ValueType int - -func (v ValueType) String() string { - switch v { - case NoneType: - return "NONE" - case DecimalType: - return "FLOAT" - case IntegerType: - return "INT" - case StringType: - return "STRING" - case BoolType: - return "BOOL" - } - - return "" -} - -// ValueType enums -const ( - NoneType = ValueType(iota) - DecimalType - IntegerType - StringType - QuotedStringType - BoolType -) - -// Value is a union container -type Value struct { - Type ValueType - raw []rune - - integer int64 - decimal float64 - boolean bool - str string -} - -func newValue(t ValueType, base int, raw []rune) (Value, error) { - v := Value{ - Type: t, - raw: raw, - } - var err error - - switch t { - case DecimalType: - v.decimal, err = strconv.ParseFloat(string(raw), 64) - case IntegerType: - if base != 10 { - raw = raw[2:] - } - - v.integer, err = strconv.ParseInt(string(raw), base, 64) - case StringType: - v.str = string(raw) - case QuotedStringType: - v.str = string(raw[1 : len(raw)-1]) - case BoolType: - v.boolean = runeCompare(v.raw, runesTrue) - } - - // issue 2253 - // - // if the value trying to be parsed is too large, then we will use - // the 'StringType' and raw value instead. - if nerr, ok := err.(*strconv.NumError); ok && nerr.Err == strconv.ErrRange { - v.Type = StringType - v.str = string(raw) - err = nil - } - - return v, err -} - -// Append will append values and change the type to a string -// type. -func (v *Value) Append(tok Token) { - r := tok.Raw() - if v.Type != QuotedStringType { - v.Type = StringType - r = tok.raw[1 : len(tok.raw)-1] - } - if tok.Type() != TokenLit { - v.raw = append(v.raw, tok.Raw()...) - } else { - v.raw = append(v.raw, r...) - } -} - -func (v Value) String() string { - switch v.Type { - case DecimalType: - return fmt.Sprintf("decimal: %f", v.decimal) - case IntegerType: - return fmt.Sprintf("integer: %d", v.integer) - case StringType: - return fmt.Sprintf("string: %s", string(v.raw)) - case QuotedStringType: - return fmt.Sprintf("quoted string: %s", string(v.raw)) - case BoolType: - return fmt.Sprintf("bool: %t", v.boolean) - default: - return "union not set" - } -} - -func newLitToken(b []rune) (Token, int, error) { - n := 0 - var err error - - token := Token{} - if b[0] == '"' { - n, err = getStringValue(b) - if err != nil { - return token, n, err - } - - token = newToken(TokenLit, b[:n], QuotedStringType) - } else if isNumberValue(b) { - var base int - base, n, err = getNumericalValue(b) - if err != nil { - return token, 0, err - } - - value := b[:n] - vType := IntegerType - if contains(value, '.') || hasExponent(value) { - vType = DecimalType - } - token = newToken(TokenLit, value, vType) - token.base = base - } else if isBoolValue(b) { - n, err = getBoolValue(b) - - token = newToken(TokenLit, b[:n], BoolType) - } else { - n, err = getValue(b) - token = newToken(TokenLit, b[:n], StringType) - } - - return token, n, err -} - -// IntValue returns an integer value -func (v Value) IntValue() int64 { - return v.integer -} - -// FloatValue returns a float value -func (v Value) FloatValue() float64 { - return v.decimal -} - -// BoolValue returns a bool value -func (v Value) BoolValue() bool { - return v.boolean -} - -func isTrimmable(r rune) bool { - switch r { - case '\n', ' ': - return true - } - return false -} - -// StringValue returns the string value -func (v Value) StringValue() string { - switch v.Type { - case StringType: - return strings.TrimFunc(string(v.raw), isTrimmable) - case QuotedStringType: - // preserve all characters in the quotes - return string(removeEscapedCharacters(v.raw[1 : len(v.raw)-1])) - default: - return strings.TrimFunc(string(v.raw), isTrimmable) - } -} - -func contains(runes []rune, c rune) bool { - for i := 0; i < len(runes); i++ { - if runes[i] == c { - return true - } - } - - return false -} - -func runeCompare(v1 []rune, v2 []rune) bool { - if len(v1) != len(v2) { - return false - } - - for i := 0; i < len(v1); i++ { - if v1[i] != v2[i] { - return false - } - } - - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go deleted file mode 100644 index e52ac399f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go +++ /dev/null @@ -1,30 +0,0 @@ -package ini - -func isNewline(b []rune) bool { - if len(b) == 0 { - return false - } - - if b[0] == '\n' { - return true - } - - if len(b) < 2 { - return false - } - - return b[0] == '\r' && b[1] == '\n' -} - -func newNewlineToken(b []rune) (Token, int, error) { - i := 1 - if b[0] == '\r' && isNewline(b[1:]) { - i++ - } - - if !isNewline([]rune(b[:i])) { - return emptyToken, 0, NewParseError("invalid new line token") - } - - return newToken(TokenNL, b[:i], NoneType), i, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go deleted file mode 100644 index a45c0bc56..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go +++ /dev/null @@ -1,152 +0,0 @@ -package ini - -import ( - "bytes" - "fmt" - "strconv" -) - -const ( - none = numberFormat(iota) - binary - octal - decimal - hex - exponent -) - -type numberFormat int - -// numberHelper is used to dictate what format a number is in -// and what to do for negative values. Since -1e-4 is a valid -// number, we cannot just simply check for duplicate negatives. -type numberHelper struct { - numberFormat numberFormat - - negative bool - negativeExponent bool -} - -func (b numberHelper) Exists() bool { - return b.numberFormat != none -} - -func (b numberHelper) IsNegative() bool { - return b.negative || b.negativeExponent -} - -func (b *numberHelper) Determine(c rune) error { - if b.Exists() { - return NewParseError(fmt.Sprintf("multiple number formats: 0%v", string(c))) - } - - switch c { - case 'b': - b.numberFormat = binary - case 'o': - b.numberFormat = octal - case 'x': - b.numberFormat = hex - case 'e', 'E': - b.numberFormat = exponent - case '-': - if b.numberFormat != exponent { - b.negative = true - } else { - b.negativeExponent = true - } - case '.': - b.numberFormat = decimal - default: - return NewParseError(fmt.Sprintf("invalid number character: %v", string(c))) - } - - return nil -} - -func (b numberHelper) CorrectByte(c rune) bool { - switch { - case b.numberFormat == binary: - if !isBinaryByte(c) { - return false - } - case b.numberFormat == octal: - if !isOctalByte(c) { - return false - } - case b.numberFormat == hex: - if !isHexByte(c) { - return false - } - case b.numberFormat == decimal: - if !isDigit(c) { - return false - } - case b.numberFormat == exponent: - if !isDigit(c) { - return false - } - case b.negativeExponent: - if !isDigit(c) { - return false - } - case b.negative: - if !isDigit(c) { - return false - } - default: - if !isDigit(c) { - return false - } - } - - return true -} - -func (b numberHelper) Base() int { - switch b.numberFormat { - case binary: - return 2 - case octal: - return 8 - case hex: - return 16 - default: - return 10 - } -} - -func (b numberHelper) String() string { - buf := bytes.Buffer{} - i := 0 - - switch b.numberFormat { - case binary: - i++ - buf.WriteString(strconv.Itoa(i) + ": binary format\n") - case octal: - i++ - buf.WriteString(strconv.Itoa(i) + ": octal format\n") - case hex: - i++ - buf.WriteString(strconv.Itoa(i) + ": hex format\n") - case exponent: - i++ - buf.WriteString(strconv.Itoa(i) + ": exponent format\n") - default: - i++ - buf.WriteString(strconv.Itoa(i) + ": integer format\n") - } - - if b.negative { - i++ - buf.WriteString(strconv.Itoa(i) + ": negative format\n") - } - - if b.negativeExponent { - i++ - buf.WriteString(strconv.Itoa(i) + ": negative exponent format\n") - } - - return buf.String() -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go deleted file mode 100644 index 8a84c7cbe..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go +++ /dev/null @@ -1,39 +0,0 @@ -package ini - -import ( - "fmt" -) - -var ( - equalOp = []rune("=") - equalColonOp = []rune(":") -) - -func isOp(b []rune) bool { - if len(b) == 0 { - return false - } - - switch b[0] { - case '=': - return true - case ':': - return true - default: - return false - } -} - -func newOpToken(b []rune) (Token, int, error) { - tok := Token{} - - switch b[0] { - case '=': - tok = newToken(TokenOp, equalOp, NoneType) - case ':': - tok = newToken(TokenOp, equalColonOp, NoneType) - default: - return tok, 0, NewParseError(fmt.Sprintf("unexpected op type, %v", b[0])) - } - return tok, 1, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go deleted file mode 100644 index 457287019..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go +++ /dev/null @@ -1,43 +0,0 @@ -package ini - -import "fmt" - -const ( - // ErrCodeParseError is returned when a parsing error - // has occurred. - ErrCodeParseError = "INIParseError" -) - -// ParseError is an error which is returned during any part of -// the parsing process. -type ParseError struct { - msg string -} - -// NewParseError will return a new ParseError where message -// is the description of the error. -func NewParseError(message string) *ParseError { - return &ParseError{ - msg: message, - } -} - -// Code will return the ErrCodeParseError -func (err *ParseError) Code() string { - return ErrCodeParseError -} - -// Message returns the error's message -func (err *ParseError) Message() string { - return err.msg -} - -// OrigError return nothing since there will never be any -// original error. -func (err *ParseError) OrigError() error { - return nil -} - -func (err *ParseError) Error() string { - return fmt.Sprintf("%s: %s", err.Code(), err.Message()) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go deleted file mode 100644 index 7f01cf7c7..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go +++ /dev/null @@ -1,60 +0,0 @@ -package ini - -import ( - "bytes" - "fmt" -) - -// ParseStack is a stack that contains a container, the stack portion, -// and the list which is the list of ASTs that have been successfully -// parsed. -type ParseStack struct { - top int - container []AST - list []AST - index int -} - -func newParseStack(sizeContainer, sizeList int) ParseStack { - return ParseStack{ - container: make([]AST, sizeContainer), - list: make([]AST, sizeList), - } -} - -// Pop will return and truncate the last container element. -func (s *ParseStack) Pop() AST { - s.top-- - return s.container[s.top] -} - -// Push will add the new AST to the container -func (s *ParseStack) Push(ast AST) { - s.container[s.top] = ast - s.top++ -} - -// MarkComplete will append the AST to the list of completed statements -func (s *ParseStack) MarkComplete(ast AST) { - s.list[s.index] = ast - s.index++ -} - -// List will return the completed statements -func (s ParseStack) List() []AST { - return s.list[:s.index] -} - -// Len will return the length of the container -func (s *ParseStack) Len() int { - return s.top -} - -func (s ParseStack) String() string { - buf := bytes.Buffer{} - for i, node := range s.list { - buf.WriteString(fmt.Sprintf("%d: %v\n", i+1, node)) - } - - return buf.String() -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go deleted file mode 100644 index f82095ba2..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go +++ /dev/null @@ -1,41 +0,0 @@ -package ini - -import ( - "fmt" -) - -var ( - emptyRunes = []rune{} -) - -func isSep(b []rune) bool { - if len(b) == 0 { - return false - } - - switch b[0] { - case '[', ']': - return true - default: - return false - } -} - -var ( - openBrace = []rune("[") - closeBrace = []rune("]") -) - -func newSepToken(b []rune) (Token, int, error) { - tok := Token{} - - switch b[0] { - case '[': - tok = newToken(TokenSep, openBrace, NoneType) - case ']': - tok = newToken(TokenSep, closeBrace, NoneType) - default: - return tok, 0, NewParseError(fmt.Sprintf("unexpected sep type, %v", b[0])) - } - return tok, 1, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go deleted file mode 100644 index da7a4049c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go +++ /dev/null @@ -1,45 +0,0 @@ -package ini - -// skipper is used to skip certain blocks of an ini file. -// Currently skipper is used to skip nested blocks of ini -// files. See example below -// -// [ foo ] -// nested = ; this section will be skipped -// a=b -// c=d -// bar=baz ; this will be included -type skipper struct { - shouldSkip bool - TokenSet bool - prevTok Token -} - -func newSkipper() skipper { - return skipper{ - prevTok: emptyToken, - } -} - -func (s *skipper) ShouldSkip(tok Token) bool { - // should skip state will be modified only if previous token was new line (NL); - // and the current token is not WhiteSpace (WS). - if s.shouldSkip && - s.prevTok.Type() == TokenNL && - tok.Type() != TokenWS { - s.Continue() - return false - } - s.prevTok = tok - return s.shouldSkip -} - -func (s *skipper) Skip() { - s.shouldSkip = true -} - -func (s *skipper) Continue() { - s.shouldSkip = false - // empty token is assigned as we return to default state, when should skip is false - s.prevTok = emptyToken -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go deleted file mode 100644 index 18f3fe893..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go +++ /dev/null @@ -1,35 +0,0 @@ -package ini - -// Statement is an empty AST mostly used for transitioning states. -func newStatement() AST { - return newAST(ASTKindStatement, AST{}) -} - -// SectionStatement represents a section AST -func newSectionStatement(tok Token) AST { - return newASTWithRootToken(ASTKindSectionStatement, tok) -} - -// ExprStatement represents a completed expression AST -func newExprStatement(ast AST) AST { - return newAST(ASTKindExprStatement, ast) -} - -// CommentStatement represents a comment in the ini definition. -// -// grammar: -// comment -> #comment' | ;comment' -// comment' -> epsilon | value -func newCommentStatement(tok Token) AST { - return newAST(ASTKindCommentStatement, newExpression(tok)) -} - -// CompletedSectionStatement represents a completed section -func newCompletedSectionStatement(ast AST) AST { - return newAST(ASTKindCompletedSectionStatement, ast) -} - -// SkipStatement is used to skip whole statements -func newSkipStatement(ast AST) AST { - return newAST(ASTKindSkipStatement, ast) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go deleted file mode 100644 index 305999d29..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go +++ /dev/null @@ -1,284 +0,0 @@ -package ini - -import ( - "fmt" -) - -// getStringValue will return a quoted string and the amount -// of bytes read -// -// an error will be returned if the string is not properly formatted -func getStringValue(b []rune) (int, error) { - if b[0] != '"' { - return 0, NewParseError("strings must start with '\"'") - } - - endQuote := false - i := 1 - - for ; i < len(b) && !endQuote; i++ { - if escaped := isEscaped(b[:i], b[i]); b[i] == '"' && !escaped { - endQuote = true - break - } else if escaped { - /*c, err := getEscapedByte(b[i]) - if err != nil { - return 0, err - } - - b[i-1] = c - b = append(b[:i], b[i+1:]...) - i--*/ - - continue - } - } - - if !endQuote { - return 0, NewParseError("missing '\"' in string value") - } - - return i + 1, nil -} - -// getBoolValue will return a boolean and the amount -// of bytes read -// -// an error will be returned if the boolean is not of a correct -// value -func getBoolValue(b []rune) (int, error) { - if len(b) < 4 { - return 0, NewParseError("invalid boolean value") - } - - n := 0 - for _, lv := range literalValues { - if len(lv) > len(b) { - continue - } - - if isLitValue(lv, b) { - n = len(lv) - } - } - - if n == 0 { - return 0, NewParseError("invalid boolean value") - } - - return n, nil -} - -// getNumericalValue will return a numerical string, the amount -// of bytes read, and the base of the number -// -// an error will be returned if the number is not of a correct -// value -func getNumericalValue(b []rune) (int, int, error) { - if !isDigit(b[0]) { - return 0, 0, NewParseError("invalid digit value") - } - - i := 0 - helper := numberHelper{} - -loop: - for negativeIndex := 0; i < len(b); i++ { - negativeIndex++ - - if !isDigit(b[i]) { - switch b[i] { - case '-': - if helper.IsNegative() || negativeIndex != 1 { - return 0, 0, NewParseError("parse error '-'") - } - - n := getNegativeNumber(b[i:]) - i += (n - 1) - helper.Determine(b[i]) - continue - case '.': - if err := helper.Determine(b[i]); err != nil { - return 0, 0, err - } - case 'e', 'E': - if err := helper.Determine(b[i]); err != nil { - return 0, 0, err - } - - negativeIndex = 0 - case 'b': - if helper.numberFormat == hex { - break - } - fallthrough - case 'o', 'x': - if i == 0 && b[i] != '0' { - return 0, 0, NewParseError("incorrect base format, expected leading '0'") - } - - if i != 1 { - return 0, 0, NewParseError(fmt.Sprintf("incorrect base format found %s at %d index", string(b[i]), i)) - } - - if err := helper.Determine(b[i]); err != nil { - return 0, 0, err - } - default: - if isWhitespace(b[i]) { - break loop - } - - if isNewline(b[i:]) { - break loop - } - - if !(helper.numberFormat == hex && isHexByte(b[i])) { - if i+2 < len(b) && !isNewline(b[i:i+2]) { - return 0, 0, NewParseError("invalid numerical character") - } else if !isNewline([]rune{b[i]}) { - return 0, 0, NewParseError("invalid numerical character") - } - - break loop - } - } - } - } - - return helper.Base(), i, nil -} - -// isDigit will return whether or not something is an integer -func isDigit(b rune) bool { - return b >= '0' && b <= '9' -} - -func hasExponent(v []rune) bool { - return contains(v, 'e') || contains(v, 'E') -} - -func isBinaryByte(b rune) bool { - switch b { - case '0', '1': - return true - default: - return false - } -} - -func isOctalByte(b rune) bool { - switch b { - case '0', '1', '2', '3', '4', '5', '6', '7': - return true - default: - return false - } -} - -func isHexByte(b rune) bool { - if isDigit(b) { - return true - } - return (b >= 'A' && b <= 'F') || - (b >= 'a' && b <= 'f') -} - -func getValue(b []rune) (int, error) { - i := 0 - - for i < len(b) { - if isNewline(b[i:]) { - break - } - - if isOp(b[i:]) { - break - } - - valid, n, err := isValid(b[i:]) - if err != nil { - return 0, err - } - - if !valid { - break - } - - i += n - } - - return i, nil -} - -// getNegativeNumber will return a negative number from a -// byte slice. This will iterate through all characters until -// a non-digit has been found. -func getNegativeNumber(b []rune) int { - if b[0] != '-' { - return 0 - } - - i := 1 - for ; i < len(b); i++ { - if !isDigit(b[i]) { - return i - } - } - - return i -} - -// isEscaped will return whether or not the character is an escaped -// character. -func isEscaped(value []rune, b rune) bool { - if len(value) == 0 { - return false - } - - switch b { - case '\'': // single quote - case '"': // quote - case 'n': // newline - case 't': // tab - case '\\': // backslash - default: - return false - } - - return value[len(value)-1] == '\\' -} - -func getEscapedByte(b rune) (rune, error) { - switch b { - case '\'': // single quote - return '\'', nil - case '"': // quote - return '"', nil - case 'n': // newline - return '\n', nil - case 't': // table - return '\t', nil - case '\\': // backslash - return '\\', nil - default: - return b, NewParseError(fmt.Sprintf("invalid escaped character %c", b)) - } -} - -func removeEscapedCharacters(b []rune) []rune { - for i := 0; i < len(b); i++ { - if isEscaped(b[:i], b[i]) { - c, err := getEscapedByte(b[i]) - if err != nil { - return b - } - - b[i-1] = c - b = append(b[:i], b[i+1:]...) - i-- - } - } - - return b -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go deleted file mode 100644 index 94841c324..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go +++ /dev/null @@ -1,166 +0,0 @@ -package ini - -import ( - "fmt" - "sort" -) - -// Visitor is an interface used by walkers that will -// traverse an array of ASTs. -type Visitor interface { - VisitExpr(AST) error - VisitStatement(AST) error -} - -// DefaultVisitor is used to visit statements and expressions -// and ensure that they are both of the correct format. -// In addition, upon visiting this will build sections and populate -// the Sections field which can be used to retrieve profile -// configuration. -type DefaultVisitor struct { - scope string - Sections Sections -} - -// NewDefaultVisitor return a DefaultVisitor -func NewDefaultVisitor() *DefaultVisitor { - return &DefaultVisitor{ - Sections: Sections{ - container: map[string]Section{}, - }, - } -} - -// VisitExpr visits expressions... -func (v *DefaultVisitor) VisitExpr(expr AST) error { - t := v.Sections.container[v.scope] - if t.values == nil { - t.values = values{} - } - - switch expr.Kind { - case ASTKindExprStatement: - opExpr := expr.GetRoot() - switch opExpr.Kind { - case ASTKindEqualExpr: - children := opExpr.GetChildren() - if len(children) <= 1 { - return NewParseError("unexpected token type") - } - - rhs := children[1] - - if rhs.Root.Type() != TokenLit { - return NewParseError("unexpected token type") - } - - key := EqualExprKey(opExpr) - v, err := newValue(rhs.Root.ValueType, rhs.Root.base, rhs.Root.Raw()) - if err != nil { - return err - } - - t.values[key] = v - default: - return NewParseError(fmt.Sprintf("unsupported expression %v", expr)) - } - default: - return NewParseError(fmt.Sprintf("unsupported expression %v", expr)) - } - - v.Sections.container[v.scope] = t - return nil -} - -// VisitStatement visits statements... -func (v *DefaultVisitor) VisitStatement(stmt AST) error { - switch stmt.Kind { - case ASTKindCompletedSectionStatement: - child := stmt.GetRoot() - if child.Kind != ASTKindSectionStatement { - return NewParseError(fmt.Sprintf("unsupported child statement: %T", child)) - } - - name := string(child.Root.Raw()) - v.Sections.container[name] = Section{} - v.scope = name - default: - return NewParseError(fmt.Sprintf("unsupported statement: %s", stmt.Kind)) - } - - return nil -} - -// Sections is a map of Section structures that represent -// a configuration. -type Sections struct { - container map[string]Section -} - -// GetSection will return section p. If section p does not exist, -// false will be returned in the second parameter. -func (t Sections) GetSection(p string) (Section, bool) { - v, ok := t.container[p] - return v, ok -} - -// values represents a map of union values. -type values map[string]Value - -// List will return a list of all sections that were successfully -// parsed. -func (t Sections) List() []string { - keys := make([]string, len(t.container)) - i := 0 - for k := range t.container { - keys[i] = k - i++ - } - - sort.Strings(keys) - return keys -} - -// Section contains a name and values. This represent -// a sectioned entry in a configuration file. -type Section struct { - Name string - values values -} - -// Has will return whether or not an entry exists in a given section -func (t Section) Has(k string) bool { - _, ok := t.values[k] - return ok -} - -// ValueType will returned what type the union is set to. If -// k was not found, the NoneType will be returned. -func (t Section) ValueType(k string) (ValueType, bool) { - v, ok := t.values[k] - return v.Type, ok -} - -// Bool returns a bool value at k -func (t Section) Bool(k string) bool { - return t.values[k].BoolValue() -} - -// Int returns an integer value at k -func (t Section) Int(k string) int64 { - return t.values[k].IntValue() -} - -// Float64 returns a float value at k -func (t Section) Float64(k string) float64 { - return t.values[k].FloatValue() -} - -// String returns the string value at k -func (t Section) String(k string) string { - _, ok := t.values[k] - if !ok { - return "" - } - return t.values[k].StringValue() -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go deleted file mode 100644 index 99915f7f7..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go +++ /dev/null @@ -1,25 +0,0 @@ -package ini - -// Walk will traverse the AST using the v, the Visitor. -func Walk(tree []AST, v Visitor) error { - for _, node := range tree { - switch node.Kind { - case ASTKindExpr, - ASTKindExprStatement: - - if err := v.VisitExpr(node); err != nil { - return err - } - case ASTKindStatement, - ASTKindCompletedSectionStatement, - ASTKindNestedSectionStatement, - ASTKindCompletedNestedSectionStatement: - - if err := v.VisitStatement(node); err != nil { - return err - } - } - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go deleted file mode 100644 index 7ffb4ae06..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go +++ /dev/null @@ -1,24 +0,0 @@ -package ini - -import ( - "unicode" -) - -// isWhitespace will return whether or not the character is -// a whitespace character. -// -// Whitespace is defined as a space or tab. -func isWhitespace(c rune) bool { - return unicode.IsSpace(c) && c != '\n' && c != '\r' -} - -func newWSToken(b []rune) (Token, int, error) { - i := 0 - for ; i < len(b); i++ { - if !isWhitespace(b[i]) { - break - } - } - - return newToken(TokenWS, b[:i], NoneType), i, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/s3err/error.go b/vendor/github.com/aws/aws-sdk-go/internal/s3err/error.go deleted file mode 100644 index 0b9b0dfce..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/s3err/error.go +++ /dev/null @@ -1,57 +0,0 @@ -package s3err - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// RequestFailure provides additional S3 specific metadata for the request -// failure. -type RequestFailure struct { - awserr.RequestFailure - - hostID string -} - -// NewRequestFailure returns a request failure error decordated with S3 -// specific metadata. -func NewRequestFailure(err awserr.RequestFailure, hostID string) *RequestFailure { - return &RequestFailure{RequestFailure: err, hostID: hostID} -} - -func (r RequestFailure) Error() string { - extra := fmt.Sprintf("status code: %d, request id: %s, host id: %s", - r.StatusCode(), r.RequestID(), r.hostID) - return awserr.SprintError(r.Code(), r.Message(), extra, r.OrigErr()) -} -func (r RequestFailure) String() string { - return r.Error() -} - -// HostID returns the HostID request response value. -func (r RequestFailure) HostID() string { - return r.hostID -} - -// RequestFailureWrapperHandler returns a handler to rap an -// awserr.RequestFailure with the S3 request ID 2 from the response. -func RequestFailureWrapperHandler() request.NamedHandler { - return request.NamedHandler{ - Name: "awssdk.s3.errorHandler", - Fn: func(req *request.Request) { - reqErr, ok := req.Error.(awserr.RequestFailure) - if !ok || reqErr == nil { - return - } - - hostID := req.HTTPResponse.Header.Get("X-Amz-Id-2") - if req.Error == nil { - return - } - - req.Error = NewRequestFailure(reqErr, hostID) - }, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go deleted file mode 100644 index 6c443988b..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go +++ /dev/null @@ -1,12 +0,0 @@ -package sdkio - -const ( - // Byte is 8 bits - Byte int64 = 1 - // KibiByte (KiB) is 1024 Bytes - KibiByte = Byte * 1024 - // MebiByte (MiB) is 1024 KiB - MebiByte = KibiByte * 1024 - // GibiByte (GiB) is 1024 MiB - GibiByte = MebiByte * 1024 -) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go deleted file mode 100644 index 5aa9137e0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go +++ /dev/null @@ -1,10 +0,0 @@ -// +build !go1.7 - -package sdkio - -// Copy of Go 1.7 io package's Seeker constants. -const ( - SeekStart = 0 // seek relative to the origin of the file - SeekCurrent = 1 // seek relative to the current offset - SeekEnd = 2 // seek relative to the end -) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go deleted file mode 100644 index e5f005613..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build go1.7 - -package sdkio - -import "io" - -// Alias for Go 1.7 io package Seeker constants -const ( - SeekStart = io.SeekStart // seek relative to the origin of the file - SeekCurrent = io.SeekCurrent // seek relative to the current offset - SeekEnd = io.SeekEnd // seek relative to the end -) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go deleted file mode 100644 index 44898eed0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build go1.10 - -package sdkmath - -import "math" - -// Round returns the nearest integer, rounding half away from zero. -// -// Special cases are: -// Round(±0) = ±0 -// Round(±Inf) = ±Inf -// Round(NaN) = NaN -func Round(x float64) float64 { - return math.Round(x) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go deleted file mode 100644 index 810ec7f08..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go +++ /dev/null @@ -1,56 +0,0 @@ -// +build !go1.10 - -package sdkmath - -import "math" - -// Copied from the Go standard library's (Go 1.12) math/floor.go for use in -// Go version prior to Go 1.10. -const ( - uvone = 0x3FF0000000000000 - mask = 0x7FF - shift = 64 - 11 - 1 - bias = 1023 - signMask = 1 << 63 - fracMask = 1<= 0.5 { - // return t + Copysign(1, x) - // } - // return t - // } - bits := math.Float64bits(x) - e := uint(bits>>shift) & mask - if e < bias { - // Round abs(x) < 1 including denormals. - bits &= signMask // +-0 - if e == bias-1 { - bits |= uvone // +-1 - } - } else if e < bias+shift { - // Round any abs(x) >= 1 containing a fractional component [0,1). - // - // Numbers with larger exponents are returned unchanged since they - // must be either an integer, infinity, or NaN. - const half = 1 << (shift - 1) - e -= bias - bits += half >> e - bits &^= fracMask >> e - } - return math.Float64frombits(bits) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go deleted file mode 100644 index 0c9802d87..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go +++ /dev/null @@ -1,29 +0,0 @@ -package sdkrand - -import ( - "math/rand" - "sync" - "time" -) - -// lockedSource is a thread-safe implementation of rand.Source -type lockedSource struct { - lk sync.Mutex - src rand.Source -} - -func (r *lockedSource) Int63() (n int64) { - r.lk.Lock() - n = r.src.Int63() - r.lk.Unlock() - return -} - -func (r *lockedSource) Seed(seed int64) { - r.lk.Lock() - r.src.Seed(seed) - r.lk.Unlock() -} - -// SeededRand is a new RNG using a thread safe implementation of rand.Source -var SeededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go deleted file mode 100644 index f4651da2d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build go1.6 - -package sdkrand - -import "math/rand" - -// Read provides the stub for math.Rand.Read method support for go version's -// 1.6 and greater. -func Read(r *rand.Rand, p []byte) (int, error) { - return r.Read(p) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go deleted file mode 100644 index b1d93a33d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build !go1.6 - -package sdkrand - -import "math/rand" - -// Read backfills Go 1.6's math.Rand.Reader for Go 1.5 -func Read(r *rand.Rand, p []byte) (n int, err error) { - // Copy of Go standard libraries math package's read function not added to - // standard library until Go 1.6. - var pos int8 - var val int64 - for n = 0; n < len(p); n++ { - if pos == 0 { - val = r.Int63() - pos = 7 - } - p[n] = byte(val) - val >>= 8 - pos-- - } - - return n, err -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go deleted file mode 100644 index 38ea61afe..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go +++ /dev/null @@ -1,23 +0,0 @@ -package sdkuri - -import ( - "path" - "strings" -) - -// PathJoin will join the elements of the path delimited by the "/" -// character. Similar to path.Join with the exception the trailing "/" -// character is preserved if present. -func PathJoin(elems ...string) string { - if len(elems) == 0 { - return "" - } - - hasTrailing := strings.HasSuffix(elems[len(elems)-1], "/") - str := path.Join(elems...) - if hasTrailing && str != "/" { - str += "/" - } - - return str -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go deleted file mode 100644 index 7da8a49ce..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go +++ /dev/null @@ -1,12 +0,0 @@ -package shareddefaults - -const ( - // ECSCredsProviderEnvVar is an environmental variable key used to - // determine which path needs to be hit. - ECSCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" -) - -// ECSContainerCredentialsURI is the endpoint to retrieve container -// credentials. This can be overridden to test to ensure the credential process -// is behaving correctly. -var ECSContainerCredentialsURI = "http://169.254.170.2" diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go deleted file mode 100644 index ebcbc2b40..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go +++ /dev/null @@ -1,40 +0,0 @@ -package shareddefaults - -import ( - "os" - "path/filepath" - "runtime" -) - -// SharedCredentialsFilename returns the SDK's default file path -// for the shared credentials file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/credentials -// - Windows: %USERPROFILE%\.aws\credentials -func SharedCredentialsFilename() string { - return filepath.Join(UserHomeDir(), ".aws", "credentials") -} - -// SharedConfigFilename returns the SDK's default file path for -// the shared config file. -// -// Builds the shared config file path based on the OS's platform. -// -// - Linux/Unix: $HOME/.aws/config -// - Windows: %USERPROFILE%\.aws\config -func SharedConfigFilename() string { - return filepath.Join(UserHomeDir(), ".aws", "config") -} - -// UserHomeDir returns the home directory for the user the process is -// running under. -func UserHomeDir() string { - if runtime.GOOS == "windows" { // Windows - return os.Getenv("USERPROFILE") - } - - // *nix - return os.Getenv("HOME") -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/strings/strings.go b/vendor/github.com/aws/aws-sdk-go/internal/strings/strings.go deleted file mode 100644 index d008ae27c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/strings/strings.go +++ /dev/null @@ -1,11 +0,0 @@ -package strings - -import ( - "strings" -) - -// HasPrefixFold tests whether the string s begins with prefix, interpreted as UTF-8 strings, -// under Unicode case-folding. -func HasPrefixFold(s, prefix string) bool { - return len(s) >= len(prefix) && strings.EqualFold(s[0:len(prefix)], prefix) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/LICENSE b/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/LICENSE deleted file mode 100644 index 6a66aea5e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/singleflight.go b/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/singleflight.go deleted file mode 100644 index 14ad0c589..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/singleflight.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package singleflight provides a duplicate function call suppression -// mechanism. -package singleflight - -import "sync" - -// call is an in-flight or completed singleflight.Do call -type call struct { - wg sync.WaitGroup - - // These fields are written once before the WaitGroup is done - // and are only read after the WaitGroup is done. - val interface{} - err error - - // forgotten indicates whether Forget was called with this call's key - // while the call was still in flight. - forgotten bool - - // These fields are read and written with the singleflight - // mutex held before the WaitGroup is done, and are read but - // not written after the WaitGroup is done. - dups int - chans []chan<- Result -} - -// Group represents a class of work and forms a namespace in -// which units of work can be executed with duplicate suppression. -type Group struct { - mu sync.Mutex // protects m - m map[string]*call // lazily initialized -} - -// Result holds the results of Do, so they can be passed -// on a channel. -type Result struct { - Val interface{} - Err error - Shared bool -} - -// Do executes and returns the results of the given function, making -// sure that only one execution is in-flight for a given key at a -// time. If a duplicate comes in, the duplicate caller waits for the -// original to complete and receives the same results. -// The return value shared indicates whether v was given to multiple callers. -func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool) { - g.mu.Lock() - if g.m == nil { - g.m = make(map[string]*call) - } - if c, ok := g.m[key]; ok { - c.dups++ - g.mu.Unlock() - c.wg.Wait() - return c.val, c.err, true - } - c := new(call) - c.wg.Add(1) - g.m[key] = c - g.mu.Unlock() - - g.doCall(c, key, fn) - return c.val, c.err, c.dups > 0 -} - -// DoChan is like Do but returns a channel that will receive the -// results when they are ready. -func (g *Group) DoChan(key string, fn func() (interface{}, error)) <-chan Result { - ch := make(chan Result, 1) - g.mu.Lock() - if g.m == nil { - g.m = make(map[string]*call) - } - if c, ok := g.m[key]; ok { - c.dups++ - c.chans = append(c.chans, ch) - g.mu.Unlock() - return ch - } - c := &call{chans: []chan<- Result{ch}} - c.wg.Add(1) - g.m[key] = c - g.mu.Unlock() - - go g.doCall(c, key, fn) - - return ch -} - -// doCall handles the single call for a key. -func (g *Group) doCall(c *call, key string, fn func() (interface{}, error)) { - c.val, c.err = fn() - c.wg.Done() - - g.mu.Lock() - if !c.forgotten { - delete(g.m, key) - } - for _, ch := range c.chans { - ch <- Result{c.val, c.err, c.dups > 0} - } - g.mu.Unlock() -} - -// Forget tells the singleflight to forget about a key. Future calls -// to Do for this key will call the function rather than waiting for -// an earlier call to complete. -func (g *Group) Forget(key string) { - g.mu.Lock() - if c, ok := g.m[key]; ok { - c.forgotten = true - } - delete(g.m, key) - g.mu.Unlock() -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/checksum/content_md5.go b/vendor/github.com/aws/aws-sdk-go/private/checksum/content_md5.go deleted file mode 100644 index e045f38d8..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/checksum/content_md5.go +++ /dev/null @@ -1,53 +0,0 @@ -package checksum - -import ( - "crypto/md5" - "encoding/base64" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -const contentMD5Header = "Content-Md5" - -// AddBodyContentMD5Handler computes and sets the HTTP Content-MD5 header for requests that -// require it. -func AddBodyContentMD5Handler(r *request.Request) { - // if Content-MD5 header is already present, return - if v := r.HTTPRequest.Header.Get(contentMD5Header); len(v) != 0 { - return - } - - // if S3DisableContentMD5Validation flag is set, return - if aws.BoolValue(r.Config.S3DisableContentMD5Validation) { - return - } - - // if request is presigned, return - if r.IsPresigned() { - return - } - - // if body is not seekable, return - if !aws.IsReaderSeekable(r.Body) { - if r.Config.Logger != nil { - r.Config.Logger.Log(fmt.Sprintf( - "Unable to compute Content-MD5 for unseekable body, S3.%s", - r.Operation.Name)) - } - return - } - - h := md5.New() - - if _, err := aws.CopySeekableBody(h, r.Body); err != nil { - r.Error = awserr.New("ContentMD5", "failed to compute body MD5", err) - return - } - - // encode the md5 checksum in base64 and set the request header. - v := base64.StdEncoding.EncodeToString(h.Sum(nil)) - r.HTTPRequest.Header.Set(contentMD5Header, v) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/debug.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/debug.go deleted file mode 100644 index 151054971..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/debug.go +++ /dev/null @@ -1,144 +0,0 @@ -package eventstream - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "strconv" -) - -type decodedMessage struct { - rawMessage - Headers decodedHeaders `json:"headers"` -} -type jsonMessage struct { - Length json.Number `json:"total_length"` - HeadersLen json.Number `json:"headers_length"` - PreludeCRC json.Number `json:"prelude_crc"` - Headers decodedHeaders `json:"headers"` - Payload []byte `json:"payload"` - CRC json.Number `json:"message_crc"` -} - -func (d *decodedMessage) UnmarshalJSON(b []byte) (err error) { - var jsonMsg jsonMessage - if err = json.Unmarshal(b, &jsonMsg); err != nil { - return err - } - - d.Length, err = numAsUint32(jsonMsg.Length) - if err != nil { - return err - } - d.HeadersLen, err = numAsUint32(jsonMsg.HeadersLen) - if err != nil { - return err - } - d.PreludeCRC, err = numAsUint32(jsonMsg.PreludeCRC) - if err != nil { - return err - } - d.Headers = jsonMsg.Headers - d.Payload = jsonMsg.Payload - d.CRC, err = numAsUint32(jsonMsg.CRC) - if err != nil { - return err - } - - return nil -} - -func (d *decodedMessage) MarshalJSON() ([]byte, error) { - jsonMsg := jsonMessage{ - Length: json.Number(strconv.Itoa(int(d.Length))), - HeadersLen: json.Number(strconv.Itoa(int(d.HeadersLen))), - PreludeCRC: json.Number(strconv.Itoa(int(d.PreludeCRC))), - Headers: d.Headers, - Payload: d.Payload, - CRC: json.Number(strconv.Itoa(int(d.CRC))), - } - - return json.Marshal(jsonMsg) -} - -func numAsUint32(n json.Number) (uint32, error) { - v, err := n.Int64() - if err != nil { - return 0, fmt.Errorf("failed to get int64 json number, %v", err) - } - - return uint32(v), nil -} - -func (d decodedMessage) Message() Message { - return Message{ - Headers: Headers(d.Headers), - Payload: d.Payload, - } -} - -type decodedHeaders Headers - -func (hs *decodedHeaders) UnmarshalJSON(b []byte) error { - var jsonHeaders []struct { - Name string `json:"name"` - Type valueType `json:"type"` - Value interface{} `json:"value"` - } - - decoder := json.NewDecoder(bytes.NewReader(b)) - decoder.UseNumber() - if err := decoder.Decode(&jsonHeaders); err != nil { - return err - } - - var headers Headers - for _, h := range jsonHeaders { - value, err := valueFromType(h.Type, h.Value) - if err != nil { - return err - } - headers.Set(h.Name, value) - } - *hs = decodedHeaders(headers) - - return nil -} - -func valueFromType(typ valueType, val interface{}) (Value, error) { - switch typ { - case trueValueType: - return BoolValue(true), nil - case falseValueType: - return BoolValue(false), nil - case int8ValueType: - v, err := val.(json.Number).Int64() - return Int8Value(int8(v)), err - case int16ValueType: - v, err := val.(json.Number).Int64() - return Int16Value(int16(v)), err - case int32ValueType: - v, err := val.(json.Number).Int64() - return Int32Value(int32(v)), err - case int64ValueType: - v, err := val.(json.Number).Int64() - return Int64Value(v), err - case bytesValueType: - v, err := base64.StdEncoding.DecodeString(val.(string)) - return BytesValue(v), err - case stringValueType: - v, err := base64.StdEncoding.DecodeString(val.(string)) - return StringValue(string(v)), err - case timestampValueType: - v, err := val.(json.Number).Int64() - return TimestampValue(timeFromEpochMilli(v)), err - case uuidValueType: - v, err := base64.StdEncoding.DecodeString(val.(string)) - var tv UUIDValue - copy(tv[:], v) - return tv, err - default: - panic(fmt.Sprintf("unknown type, %s, %T", typ.String(), val)) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/decode.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/decode.go deleted file mode 100644 index 474339391..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/decode.go +++ /dev/null @@ -1,216 +0,0 @@ -package eventstream - -import ( - "bytes" - "encoding/binary" - "encoding/hex" - "encoding/json" - "fmt" - "hash" - "hash/crc32" - "io" - - "github.com/aws/aws-sdk-go/aws" -) - -// Decoder provides decoding of an Event Stream messages. -type Decoder struct { - r io.Reader - logger aws.Logger -} - -// NewDecoder initializes and returns a Decoder for decoding event -// stream messages from the reader provided. -func NewDecoder(r io.Reader, opts ...func(*Decoder)) *Decoder { - d := &Decoder{ - r: r, - } - - for _, opt := range opts { - opt(d) - } - - return d -} - -// DecodeWithLogger adds a logger to be used by the decoder when decoding -// stream events. -func DecodeWithLogger(logger aws.Logger) func(*Decoder) { - return func(d *Decoder) { - d.logger = logger - } -} - -// Decode attempts to decode a single message from the event stream reader. -// Will return the event stream message, or error if Decode fails to read -// the message from the stream. -func (d *Decoder) Decode(payloadBuf []byte) (m Message, err error) { - reader := d.r - if d.logger != nil { - debugMsgBuf := bytes.NewBuffer(nil) - reader = io.TeeReader(reader, debugMsgBuf) - defer func() { - logMessageDecode(d.logger, debugMsgBuf, m, err) - }() - } - - m, err = Decode(reader, payloadBuf) - - return m, err -} - -// Decode attempts to decode a single message from the event stream reader. -// Will return the event stream message, or error if Decode fails to read -// the message from the reader. -func Decode(reader io.Reader, payloadBuf []byte) (m Message, err error) { - crc := crc32.New(crc32IEEETable) - hashReader := io.TeeReader(reader, crc) - - prelude, err := decodePrelude(hashReader, crc) - if err != nil { - return Message{}, err - } - - if prelude.HeadersLen > 0 { - lr := io.LimitReader(hashReader, int64(prelude.HeadersLen)) - m.Headers, err = decodeHeaders(lr) - if err != nil { - return Message{}, err - } - } - - if payloadLen := prelude.PayloadLen(); payloadLen > 0 { - buf, err := decodePayload(payloadBuf, io.LimitReader(hashReader, int64(payloadLen))) - if err != nil { - return Message{}, err - } - m.Payload = buf - } - - msgCRC := crc.Sum32() - if err := validateCRC(reader, msgCRC); err != nil { - return Message{}, err - } - - return m, nil -} - -func logMessageDecode(logger aws.Logger, msgBuf *bytes.Buffer, msg Message, decodeErr error) { - w := bytes.NewBuffer(nil) - defer func() { logger.Log(w.String()) }() - - fmt.Fprintf(w, "Raw message:\n%s\n", - hex.Dump(msgBuf.Bytes())) - - if decodeErr != nil { - fmt.Fprintf(w, "Decode error: %v\n", decodeErr) - return - } - - rawMsg, err := msg.rawMessage() - if err != nil { - fmt.Fprintf(w, "failed to create raw message, %v\n", err) - return - } - - decodedMsg := decodedMessage{ - rawMessage: rawMsg, - Headers: decodedHeaders(msg.Headers), - } - - fmt.Fprintf(w, "Decoded message:\n") - encoder := json.NewEncoder(w) - if err := encoder.Encode(decodedMsg); err != nil { - fmt.Fprintf(w, "failed to generate decoded message, %v\n", err) - } -} - -func decodePrelude(r io.Reader, crc hash.Hash32) (messagePrelude, error) { - var p messagePrelude - - var err error - p.Length, err = decodeUint32(r) - if err != nil { - return messagePrelude{}, err - } - - p.HeadersLen, err = decodeUint32(r) - if err != nil { - return messagePrelude{}, err - } - - if err := p.ValidateLens(); err != nil { - return messagePrelude{}, err - } - - preludeCRC := crc.Sum32() - if err := validateCRC(r, preludeCRC); err != nil { - return messagePrelude{}, err - } - - p.PreludeCRC = preludeCRC - - return p, nil -} - -func decodePayload(buf []byte, r io.Reader) ([]byte, error) { - w := bytes.NewBuffer(buf[0:0]) - - _, err := io.Copy(w, r) - return w.Bytes(), err -} - -func decodeUint8(r io.Reader) (uint8, error) { - type byteReader interface { - ReadByte() (byte, error) - } - - if br, ok := r.(byteReader); ok { - v, err := br.ReadByte() - return uint8(v), err - } - - var b [1]byte - _, err := io.ReadFull(r, b[:]) - return uint8(b[0]), err -} -func decodeUint16(r io.Reader) (uint16, error) { - var b [2]byte - bs := b[:] - _, err := io.ReadFull(r, bs) - if err != nil { - return 0, err - } - return binary.BigEndian.Uint16(bs), nil -} -func decodeUint32(r io.Reader) (uint32, error) { - var b [4]byte - bs := b[:] - _, err := io.ReadFull(r, bs) - if err != nil { - return 0, err - } - return binary.BigEndian.Uint32(bs), nil -} -func decodeUint64(r io.Reader) (uint64, error) { - var b [8]byte - bs := b[:] - _, err := io.ReadFull(r, bs) - if err != nil { - return 0, err - } - return binary.BigEndian.Uint64(bs), nil -} - -func validateCRC(r io.Reader, expect uint32) error { - msgCRC, err := decodeUint32(r) - if err != nil { - return err - } - - if msgCRC != expect { - return ChecksumError{} - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/encode.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/encode.go deleted file mode 100644 index ffade3bc0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/encode.go +++ /dev/null @@ -1,162 +0,0 @@ -package eventstream - -import ( - "bytes" - "encoding/binary" - "encoding/hex" - "encoding/json" - "fmt" - "hash" - "hash/crc32" - "io" - - "github.com/aws/aws-sdk-go/aws" -) - -// Encoder provides EventStream message encoding. -type Encoder struct { - w io.Writer - logger aws.Logger - - headersBuf *bytes.Buffer -} - -// NewEncoder initializes and returns an Encoder to encode Event Stream -// messages to an io.Writer. -func NewEncoder(w io.Writer, opts ...func(*Encoder)) *Encoder { - e := &Encoder{ - w: w, - headersBuf: bytes.NewBuffer(nil), - } - - for _, opt := range opts { - opt(e) - } - - return e -} - -// EncodeWithLogger adds a logger to be used by the encode when decoding -// stream events. -func EncodeWithLogger(logger aws.Logger) func(*Encoder) { - return func(d *Encoder) { - d.logger = logger - } -} - -// Encode encodes a single EventStream message to the io.Writer the Encoder -// was created with. An error is returned if writing the message fails. -func (e *Encoder) Encode(msg Message) (err error) { - e.headersBuf.Reset() - - writer := e.w - if e.logger != nil { - encodeMsgBuf := bytes.NewBuffer(nil) - writer = io.MultiWriter(writer, encodeMsgBuf) - defer func() { - logMessageEncode(e.logger, encodeMsgBuf, msg, err) - }() - } - - if err = EncodeHeaders(e.headersBuf, msg.Headers); err != nil { - return err - } - - crc := crc32.New(crc32IEEETable) - hashWriter := io.MultiWriter(writer, crc) - - headersLen := uint32(e.headersBuf.Len()) - payloadLen := uint32(len(msg.Payload)) - - if err = encodePrelude(hashWriter, crc, headersLen, payloadLen); err != nil { - return err - } - - if headersLen > 0 { - if _, err = io.Copy(hashWriter, e.headersBuf); err != nil { - return err - } - } - - if payloadLen > 0 { - if _, err = hashWriter.Write(msg.Payload); err != nil { - return err - } - } - - msgCRC := crc.Sum32() - return binary.Write(writer, binary.BigEndian, msgCRC) -} - -func logMessageEncode(logger aws.Logger, msgBuf *bytes.Buffer, msg Message, encodeErr error) { - w := bytes.NewBuffer(nil) - defer func() { logger.Log(w.String()) }() - - fmt.Fprintf(w, "Message to encode:\n") - encoder := json.NewEncoder(w) - if err := encoder.Encode(msg); err != nil { - fmt.Fprintf(w, "Failed to get encoded message, %v\n", err) - } - - if encodeErr != nil { - fmt.Fprintf(w, "Encode error: %v\n", encodeErr) - return - } - - fmt.Fprintf(w, "Raw message:\n%s\n", hex.Dump(msgBuf.Bytes())) -} - -func encodePrelude(w io.Writer, crc hash.Hash32, headersLen, payloadLen uint32) error { - p := messagePrelude{ - Length: minMsgLen + headersLen + payloadLen, - HeadersLen: headersLen, - } - if err := p.ValidateLens(); err != nil { - return err - } - - err := binaryWriteFields(w, binary.BigEndian, - p.Length, - p.HeadersLen, - ) - if err != nil { - return err - } - - p.PreludeCRC = crc.Sum32() - err = binary.Write(w, binary.BigEndian, p.PreludeCRC) - if err != nil { - return err - } - - return nil -} - -// EncodeHeaders writes the header values to the writer encoded in the event -// stream format. Returns an error if a header fails to encode. -func EncodeHeaders(w io.Writer, headers Headers) error { - for _, h := range headers { - hn := headerName{ - Len: uint8(len(h.Name)), - } - copy(hn.Name[:hn.Len], h.Name) - if err := hn.encode(w); err != nil { - return err - } - - if err := h.Value.encode(w); err != nil { - return err - } - } - - return nil -} - -func binaryWriteFields(w io.Writer, order binary.ByteOrder, vs ...interface{}) error { - for _, v := range vs { - if err := binary.Write(w, order, v); err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/error.go deleted file mode 100644 index 5481ef307..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/error.go +++ /dev/null @@ -1,23 +0,0 @@ -package eventstream - -import "fmt" - -// LengthError provides the error for items being larger than a maximum length. -type LengthError struct { - Part string - Want int - Have int - Value interface{} -} - -func (e LengthError) Error() string { - return fmt.Sprintf("%s length invalid, %d/%d, %v", - e.Part, e.Want, e.Have, e.Value) -} - -// ChecksumError provides the error for message checksum invalidation errors. -type ChecksumError struct{} - -func (e ChecksumError) Error() string { - return "message checksum mismatch" -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/error.go deleted file mode 100644 index 34c2e89d5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/error.go +++ /dev/null @@ -1,77 +0,0 @@ -package eventstreamapi - -import ( - "fmt" - "sync" -) - -type messageError struct { - code string - msg string -} - -func (e messageError) Code() string { - return e.code -} - -func (e messageError) Message() string { - return e.msg -} - -func (e messageError) Error() string { - return fmt.Sprintf("%s: %s", e.code, e.msg) -} - -func (e messageError) OrigErr() error { - return nil -} - -// OnceError wraps the behavior of recording an error -// once and signal on a channel when this has occurred. -// Signaling is done by closing of the channel. -// -// Type is safe for concurrent usage. -type OnceError struct { - mu sync.RWMutex - err error - ch chan struct{} -} - -// NewOnceError return a new OnceError -func NewOnceError() *OnceError { - return &OnceError{ - ch: make(chan struct{}, 1), - } -} - -// Err acquires a read-lock and returns an -// error if one has been set. -func (e *OnceError) Err() error { - e.mu.RLock() - err := e.err - e.mu.RUnlock() - - return err -} - -// SetError acquires a write-lock and will set -// the underlying error value if one has not been set. -func (e *OnceError) SetError(err error) { - if err == nil { - return - } - - e.mu.Lock() - if e.err == nil { - e.err = err - close(e.ch) - } - e.mu.Unlock() -} - -// ErrorSet returns a channel that will be used to signal -// that an error has been set. This channel will be closed -// when the error value has been set for OnceError. -func (e *OnceError) ErrorSet() <-chan struct{} { - return e.ch -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/reader.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/reader.go deleted file mode 100644 index bb8ea5da1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/reader.go +++ /dev/null @@ -1,160 +0,0 @@ -package eventstreamapi - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/eventstream" -) - -// Unmarshaler provides the interface for unmarshaling a EventStream -// message into a SDK type. -type Unmarshaler interface { - UnmarshalEvent(protocol.PayloadUnmarshaler, eventstream.Message) error -} - -// EventReader provides reading from the EventStream of an reader. -type EventReader struct { - decoder *eventstream.Decoder - - unmarshalerForEventType func(string) (Unmarshaler, error) - payloadUnmarshaler protocol.PayloadUnmarshaler - - payloadBuf []byte -} - -// NewEventReader returns a EventReader built from the reader and unmarshaler -// provided. Use ReadStream method to start reading from the EventStream. -func NewEventReader( - decoder *eventstream.Decoder, - payloadUnmarshaler protocol.PayloadUnmarshaler, - unmarshalerForEventType func(string) (Unmarshaler, error), -) *EventReader { - return &EventReader{ - decoder: decoder, - payloadUnmarshaler: payloadUnmarshaler, - unmarshalerForEventType: unmarshalerForEventType, - payloadBuf: make([]byte, 10*1024), - } -} - -// ReadEvent attempts to read a message from the EventStream and return the -// unmarshaled event value that the message is for. -// -// For EventStream API errors check if the returned error satisfies the -// awserr.Error interface to get the error's Code and Message components. -// -// EventUnmarshalers called with EventStream messages must take copies of the -// message's Payload. The payload will is reused between events read. -func (r *EventReader) ReadEvent() (event interface{}, err error) { - msg, err := r.decoder.Decode(r.payloadBuf) - if err != nil { - return nil, err - } - defer func() { - // Reclaim payload buffer for next message read. - r.payloadBuf = msg.Payload[0:0] - }() - - typ, err := GetHeaderString(msg, MessageTypeHeader) - if err != nil { - return nil, err - } - - switch typ { - case EventMessageType: - return r.unmarshalEventMessage(msg) - case ExceptionMessageType: - return nil, r.unmarshalEventException(msg) - case ErrorMessageType: - return nil, r.unmarshalErrorMessage(msg) - default: - return nil, fmt.Errorf("unknown eventstream message type, %v", typ) - } -} - -func (r *EventReader) unmarshalEventMessage( - msg eventstream.Message, -) (event interface{}, err error) { - eventType, err := GetHeaderString(msg, EventTypeHeader) - if err != nil { - return nil, err - } - - ev, err := r.unmarshalerForEventType(eventType) - if err != nil { - return nil, err - } - - err = ev.UnmarshalEvent(r.payloadUnmarshaler, msg) - if err != nil { - return nil, err - } - - return ev, nil -} - -func (r *EventReader) unmarshalEventException( - msg eventstream.Message, -) (err error) { - eventType, err := GetHeaderString(msg, ExceptionTypeHeader) - if err != nil { - return err - } - - ev, err := r.unmarshalerForEventType(eventType) - if err != nil { - return err - } - - err = ev.UnmarshalEvent(r.payloadUnmarshaler, msg) - if err != nil { - return err - } - - var ok bool - err, ok = ev.(error) - if !ok { - err = messageError{ - code: "SerializationError", - msg: fmt.Sprintf( - "event stream exception %s mapped to non-error %T, %v", - eventType, ev, ev, - ), - } - } - - return err -} - -func (r *EventReader) unmarshalErrorMessage(msg eventstream.Message) (err error) { - var msgErr messageError - - msgErr.code, err = GetHeaderString(msg, ErrorCodeHeader) - if err != nil { - return err - } - - msgErr.msg, err = GetHeaderString(msg, ErrorMessageHeader) - if err != nil { - return err - } - - return msgErr -} - -// GetHeaderString returns the value of the header as a string. If the header -// is not set or the value is not a string an error will be returned. -func GetHeaderString(msg eventstream.Message, headerName string) (string, error) { - headerVal := msg.Headers.Get(headerName) - if headerVal == nil { - return "", fmt.Errorf("error header %s not present", headerName) - } - - v, ok := headerVal.Get().(string) - if !ok { - return "", fmt.Errorf("error header value is not a string, %T", headerVal) - } - - return v, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/shared.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/shared.go deleted file mode 100644 index e46b8acc2..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/shared.go +++ /dev/null @@ -1,23 +0,0 @@ -package eventstreamapi - -// EventStream headers with specific meaning to async API functionality. -const ( - ChunkSignatureHeader = `:chunk-signature` // chunk signature for message - DateHeader = `:date` // Date header for signature - - // Message header and values - MessageTypeHeader = `:message-type` // Identifies type of message. - EventMessageType = `event` - ErrorMessageType = `error` - ExceptionMessageType = `exception` - - // Message Events - EventTypeHeader = `:event-type` // Identifies message event type e.g. "Stats". - - // Message Error - ErrorCodeHeader = `:error-code` - ErrorMessageHeader = `:error-message` - - // Message Exception - ExceptionTypeHeader = `:exception-type` -) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/signer.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/signer.go deleted file mode 100644 index 3a7ba5cd5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/signer.go +++ /dev/null @@ -1,123 +0,0 @@ -package eventstreamapi - -import ( - "bytes" - "strings" - "time" - - "github.com/aws/aws-sdk-go/private/protocol/eventstream" -) - -var timeNow = time.Now - -// StreamSigner defines an interface for the implementation of signing of event stream payloads -type StreamSigner interface { - GetSignature(headers, payload []byte, date time.Time) ([]byte, error) -} - -// SignEncoder envelopes event stream messages -// into an event stream message payload with included -// signature headers using the provided signer and encoder. -type SignEncoder struct { - signer StreamSigner - encoder Encoder - bufEncoder *BufferEncoder - - closeErr error - closed bool -} - -// NewSignEncoder returns a new SignEncoder using the provided stream signer and -// event stream encoder. -func NewSignEncoder(signer StreamSigner, encoder Encoder) *SignEncoder { - // TODO: Need to pass down logging - - return &SignEncoder{ - signer: signer, - encoder: encoder, - bufEncoder: NewBufferEncoder(), - } -} - -// Close encodes a final event stream signing envelope with an empty event stream -// payload. This final end-frame is used to mark the conclusion of the stream. -func (s *SignEncoder) Close() error { - if s.closed { - return s.closeErr - } - - if err := s.encode([]byte{}); err != nil { - if strings.Contains(err.Error(), "on closed pipe") { - return nil - } - - s.closeErr = err - s.closed = true - return s.closeErr - } - - return nil -} - -// Encode takes the provided message and add envelopes the message -// with the required signature. -func (s *SignEncoder) Encode(msg eventstream.Message) error { - payload, err := s.bufEncoder.Encode(msg) - if err != nil { - return err - } - - return s.encode(payload) -} - -func (s SignEncoder) encode(payload []byte) error { - date := timeNow() - - var msg eventstream.Message - msg.Headers.Set(DateHeader, eventstream.TimestampValue(date)) - msg.Payload = payload - - var headers bytes.Buffer - if err := eventstream.EncodeHeaders(&headers, msg.Headers); err != nil { - return err - } - - sig, err := s.signer.GetSignature(headers.Bytes(), msg.Payload, date) - if err != nil { - return err - } - - msg.Headers.Set(ChunkSignatureHeader, eventstream.BytesValue(sig)) - - return s.encoder.Encode(msg) -} - -// BufferEncoder is a utility that provides a buffered -// event stream encoder -type BufferEncoder struct { - encoder Encoder - buffer *bytes.Buffer -} - -// NewBufferEncoder returns a new BufferEncoder initialized -// with a 1024 byte buffer. -func NewBufferEncoder() *BufferEncoder { - buf := bytes.NewBuffer(make([]byte, 1024)) - return &BufferEncoder{ - encoder: eventstream.NewEncoder(buf), - buffer: buf, - } -} - -// Encode returns the encoded message as a byte slice. -// The returned byte slice will be modified on the next encode call -// and should not be held onto. -func (e *BufferEncoder) Encode(msg eventstream.Message) ([]byte, error) { - e.buffer.Reset() - - if err := e.encoder.Encode(msg); err != nil { - return nil, err - } - - return e.buffer.Bytes(), nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/stream_writer.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/stream_writer.go deleted file mode 100644 index 433bb1630..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/stream_writer.go +++ /dev/null @@ -1,129 +0,0 @@ -package eventstreamapi - -import ( - "fmt" - "io" - "sync" - - "github.com/aws/aws-sdk-go/aws" -) - -// StreamWriter provides concurrent safe writing to an event stream. -type StreamWriter struct { - eventWriter *EventWriter - stream chan eventWriteAsyncReport - - done chan struct{} - closeOnce sync.Once - err *OnceError - - streamCloser io.Closer -} - -// NewStreamWriter returns a StreamWriter for the event writer, and stream -// closer provided. -func NewStreamWriter(eventWriter *EventWriter, streamCloser io.Closer) *StreamWriter { - w := &StreamWriter{ - eventWriter: eventWriter, - streamCloser: streamCloser, - stream: make(chan eventWriteAsyncReport), - done: make(chan struct{}), - err: NewOnceError(), - } - go w.writeStream() - - return w -} - -// Close terminates the writers ability to write new events to the stream. Any -// future call to Send will fail with an error. -func (w *StreamWriter) Close() error { - w.closeOnce.Do(w.safeClose) - return w.Err() -} - -func (w *StreamWriter) safeClose() { - close(w.done) -} - -// ErrorSet returns a channel which will be closed -// if an error occurs. -func (w *StreamWriter) ErrorSet() <-chan struct{} { - return w.err.ErrorSet() -} - -// Err returns any error that occurred while attempting to write an event to the -// stream. -func (w *StreamWriter) Err() error { - return w.err.Err() -} - -// Send writes a single event to the stream returning an error if the write -// failed. -// -// Send may be called concurrently. Events will be written to the stream -// safely. -func (w *StreamWriter) Send(ctx aws.Context, event Marshaler) error { - if err := w.Err(); err != nil { - return err - } - - resultCh := make(chan error) - wrapped := eventWriteAsyncReport{ - Event: event, - Result: resultCh, - } - - select { - case w.stream <- wrapped: - case <-ctx.Done(): - return ctx.Err() - case <-w.done: - return fmt.Errorf("stream closed, unable to send event") - } - - select { - case err := <-resultCh: - return err - case <-ctx.Done(): - return ctx.Err() - case <-w.done: - return fmt.Errorf("stream closed, unable to send event") - } -} - -func (w *StreamWriter) writeStream() { - defer w.Close() - - for { - select { - case wrapper := <-w.stream: - err := w.eventWriter.WriteEvent(wrapper.Event) - wrapper.ReportResult(w.done, err) - if err != nil { - w.err.SetError(err) - return - } - - case <-w.done: - if err := w.streamCloser.Close(); err != nil { - w.err.SetError(err) - } - return - } - } -} - -type eventWriteAsyncReport struct { - Event Marshaler - Result chan<- error -} - -func (e eventWriteAsyncReport) ReportResult(cancel <-chan struct{}, err error) bool { - select { - case e.Result <- err: - return true - case <-cancel: - return false - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/writer.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/writer.go deleted file mode 100644 index 10a3823df..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi/writer.go +++ /dev/null @@ -1,109 +0,0 @@ -package eventstreamapi - -import ( - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/eventstream" -) - -// Marshaler provides a marshaling interface for event types to event stream -// messages. -type Marshaler interface { - MarshalEvent(protocol.PayloadMarshaler) (eventstream.Message, error) -} - -// Encoder is an stream encoder that will encode an event stream message for -// the transport. -type Encoder interface { - Encode(eventstream.Message) error -} - -// EventWriter provides a wrapper around the underlying event stream encoder -// for an io.WriteCloser. -type EventWriter struct { - encoder Encoder - payloadMarshaler protocol.PayloadMarshaler - eventTypeFor func(Marshaler) (string, error) -} - -// NewEventWriter returns a new event stream writer, that will write to the -// writer provided. Use the WriteEvent method to write an event to the stream. -func NewEventWriter(encoder Encoder, pm protocol.PayloadMarshaler, eventTypeFor func(Marshaler) (string, error), -) *EventWriter { - return &EventWriter{ - encoder: encoder, - payloadMarshaler: pm, - eventTypeFor: eventTypeFor, - } -} - -// WriteEvent writes an event to the stream. Returns an error if the event -// fails to marshal into a message, or writing to the underlying writer fails. -func (w *EventWriter) WriteEvent(event Marshaler) error { - msg, err := w.marshal(event) - if err != nil { - return err - } - - return w.encoder.Encode(msg) -} - -func (w *EventWriter) marshal(event Marshaler) (eventstream.Message, error) { - eventType, err := w.eventTypeFor(event) - if err != nil { - return eventstream.Message{}, err - } - - msg, err := event.MarshalEvent(w.payloadMarshaler) - if err != nil { - return eventstream.Message{}, err - } - - msg.Headers.Set(EventTypeHeader, eventstream.StringValue(eventType)) - return msg, nil -} - -//type EventEncoder struct { -// encoder Encoder -// ppayloadMarshaler protocol.PayloadMarshaler -// eventTypeFor func(Marshaler) (string, error) -//} -// -//func (e EventEncoder) Encode(event Marshaler) error { -// msg, err := e.marshal(event) -// if err != nil { -// return err -// } -// -// return w.encoder.Encode(msg) -//} -// -//func (e EventEncoder) marshal(event Marshaler) (eventstream.Message, error) { -// eventType, err := w.eventTypeFor(event) -// if err != nil { -// return eventstream.Message{}, err -// } -// -// msg, err := event.MarshalEvent(w.payloadMarshaler) -// if err != nil { -// return eventstream.Message{}, err -// } -// -// msg.Headers.Set(EventTypeHeader, eventstream.StringValue(eventType)) -// return msg, nil -//} -// -//func (w *EventWriter) marshal(event Marshaler) (eventstream.Message, error) { -// eventType, err := w.eventTypeFor(event) -// if err != nil { -// return eventstream.Message{}, err -// } -// -// msg, err := event.MarshalEvent(w.payloadMarshaler) -// if err != nil { -// return eventstream.Message{}, err -// } -// -// msg.Headers.Set(EventTypeHeader, eventstream.StringValue(eventType)) -// return msg, nil -//} -// diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header.go deleted file mode 100644 index 3b44dde2f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header.go +++ /dev/null @@ -1,166 +0,0 @@ -package eventstream - -import ( - "encoding/binary" - "fmt" - "io" -) - -// Headers are a collection of EventStream header values. -type Headers []Header - -// Header is a single EventStream Key Value header pair. -type Header struct { - Name string - Value Value -} - -// Set associates the name with a value. If the header name already exists in -// the Headers the value will be replaced with the new one. -func (hs *Headers) Set(name string, value Value) { - var i int - for ; i < len(*hs); i++ { - if (*hs)[i].Name == name { - (*hs)[i].Value = value - return - } - } - - *hs = append(*hs, Header{ - Name: name, Value: value, - }) -} - -// Get returns the Value associated with the header. Nil is returned if the -// value does not exist. -func (hs Headers) Get(name string) Value { - for i := 0; i < len(hs); i++ { - if h := hs[i]; h.Name == name { - return h.Value - } - } - return nil -} - -// Del deletes the value in the Headers if it exists. -func (hs *Headers) Del(name string) { - for i := 0; i < len(*hs); i++ { - if (*hs)[i].Name == name { - copy((*hs)[i:], (*hs)[i+1:]) - (*hs) = (*hs)[:len(*hs)-1] - } - } -} - -func decodeHeaders(r io.Reader) (Headers, error) { - hs := Headers{} - - for { - name, err := decodeHeaderName(r) - if err != nil { - if err == io.EOF { - // EOF while getting header name means no more headers - break - } - return nil, err - } - - value, err := decodeHeaderValue(r) - if err != nil { - return nil, err - } - - hs.Set(name, value) - } - - return hs, nil -} - -func decodeHeaderName(r io.Reader) (string, error) { - var n headerName - - var err error - n.Len, err = decodeUint8(r) - if err != nil { - return "", err - } - - name := n.Name[:n.Len] - if _, err := io.ReadFull(r, name); err != nil { - return "", err - } - - return string(name), nil -} - -func decodeHeaderValue(r io.Reader) (Value, error) { - var raw rawValue - - typ, err := decodeUint8(r) - if err != nil { - return nil, err - } - raw.Type = valueType(typ) - - var v Value - - switch raw.Type { - case trueValueType: - v = BoolValue(true) - case falseValueType: - v = BoolValue(false) - case int8ValueType: - var tv Int8Value - err = tv.decode(r) - v = tv - case int16ValueType: - var tv Int16Value - err = tv.decode(r) - v = tv - case int32ValueType: - var tv Int32Value - err = tv.decode(r) - v = tv - case int64ValueType: - var tv Int64Value - err = tv.decode(r) - v = tv - case bytesValueType: - var tv BytesValue - err = tv.decode(r) - v = tv - case stringValueType: - var tv StringValue - err = tv.decode(r) - v = tv - case timestampValueType: - var tv TimestampValue - err = tv.decode(r) - v = tv - case uuidValueType: - var tv UUIDValue - err = tv.decode(r) - v = tv - default: - panic(fmt.Sprintf("unknown value type %d", raw.Type)) - } - - // Error could be EOF, let caller deal with it - return v, err -} - -const maxHeaderNameLen = 255 - -type headerName struct { - Len uint8 - Name [maxHeaderNameLen]byte -} - -func (v headerName) encode(w io.Writer) error { - if err := binary.Write(w, binary.BigEndian, v.Len); err != nil { - return err - } - - _, err := w.Write(v.Name[:v.Len]) - return err -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header_value.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header_value.go deleted file mode 100644 index 9f509d8f6..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/header_value.go +++ /dev/null @@ -1,506 +0,0 @@ -package eventstream - -import ( - "encoding/base64" - "encoding/binary" - "fmt" - "io" - "strconv" - "time" -) - -const maxHeaderValueLen = 1<<15 - 1 // 2^15-1 or 32KB - 1 - -// valueType is the EventStream header value type. -type valueType uint8 - -// Header value types -const ( - trueValueType valueType = iota - falseValueType - int8ValueType // Byte - int16ValueType // Short - int32ValueType // Integer - int64ValueType // Long - bytesValueType - stringValueType - timestampValueType - uuidValueType -) - -func (t valueType) String() string { - switch t { - case trueValueType: - return "bool" - case falseValueType: - return "bool" - case int8ValueType: - return "int8" - case int16ValueType: - return "int16" - case int32ValueType: - return "int32" - case int64ValueType: - return "int64" - case bytesValueType: - return "byte_array" - case stringValueType: - return "string" - case timestampValueType: - return "timestamp" - case uuidValueType: - return "uuid" - default: - return fmt.Sprintf("unknown value type %d", uint8(t)) - } -} - -type rawValue struct { - Type valueType - Len uint16 // Only set for variable length slices - Value []byte // byte representation of value, BigEndian encoding. -} - -func (r rawValue) encodeScalar(w io.Writer, v interface{}) error { - return binaryWriteFields(w, binary.BigEndian, - r.Type, - v, - ) -} - -func (r rawValue) encodeFixedSlice(w io.Writer, v []byte) error { - binary.Write(w, binary.BigEndian, r.Type) - - _, err := w.Write(v) - return err -} - -func (r rawValue) encodeBytes(w io.Writer, v []byte) error { - if len(v) > maxHeaderValueLen { - return LengthError{ - Part: "header value", - Want: maxHeaderValueLen, Have: len(v), - Value: v, - } - } - r.Len = uint16(len(v)) - - err := binaryWriteFields(w, binary.BigEndian, - r.Type, - r.Len, - ) - if err != nil { - return err - } - - _, err = w.Write(v) - return err -} - -func (r rawValue) encodeString(w io.Writer, v string) error { - if len(v) > maxHeaderValueLen { - return LengthError{ - Part: "header value", - Want: maxHeaderValueLen, Have: len(v), - Value: v, - } - } - r.Len = uint16(len(v)) - - type stringWriter interface { - WriteString(string) (int, error) - } - - err := binaryWriteFields(w, binary.BigEndian, - r.Type, - r.Len, - ) - if err != nil { - return err - } - - if sw, ok := w.(stringWriter); ok { - _, err = sw.WriteString(v) - } else { - _, err = w.Write([]byte(v)) - } - - return err -} - -func decodeFixedBytesValue(r io.Reader, buf []byte) error { - _, err := io.ReadFull(r, buf) - return err -} - -func decodeBytesValue(r io.Reader) ([]byte, error) { - var raw rawValue - var err error - raw.Len, err = decodeUint16(r) - if err != nil { - return nil, err - } - - buf := make([]byte, raw.Len) - _, err = io.ReadFull(r, buf) - if err != nil { - return nil, err - } - - return buf, nil -} - -func decodeStringValue(r io.Reader) (string, error) { - v, err := decodeBytesValue(r) - return string(v), err -} - -// Value represents the abstract header value. -type Value interface { - Get() interface{} - String() string - valueType() valueType - encode(io.Writer) error -} - -// An BoolValue provides eventstream encoding, and representation -// of a Go bool value. -type BoolValue bool - -// Get returns the underlying type -func (v BoolValue) Get() interface{} { - return bool(v) -} - -// valueType returns the EventStream header value type value. -func (v BoolValue) valueType() valueType { - if v { - return trueValueType - } - return falseValueType -} - -func (v BoolValue) String() string { - return strconv.FormatBool(bool(v)) -} - -// encode encodes the BoolValue into an eventstream binary value -// representation. -func (v BoolValue) encode(w io.Writer) error { - return binary.Write(w, binary.BigEndian, v.valueType()) -} - -// An Int8Value provides eventstream encoding, and representation of a Go -// int8 value. -type Int8Value int8 - -// Get returns the underlying value. -func (v Int8Value) Get() interface{} { - return int8(v) -} - -// valueType returns the EventStream header value type value. -func (Int8Value) valueType() valueType { - return int8ValueType -} - -func (v Int8Value) String() string { - return fmt.Sprintf("0x%02x", int8(v)) -} - -// encode encodes the Int8Value into an eventstream binary value -// representation. -func (v Int8Value) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - - return raw.encodeScalar(w, v) -} - -func (v *Int8Value) decode(r io.Reader) error { - n, err := decodeUint8(r) - if err != nil { - return err - } - - *v = Int8Value(n) - return nil -} - -// An Int16Value provides eventstream encoding, and representation of a Go -// int16 value. -type Int16Value int16 - -// Get returns the underlying value. -func (v Int16Value) Get() interface{} { - return int16(v) -} - -// valueType returns the EventStream header value type value. -func (Int16Value) valueType() valueType { - return int16ValueType -} - -func (v Int16Value) String() string { - return fmt.Sprintf("0x%04x", int16(v)) -} - -// encode encodes the Int16Value into an eventstream binary value -// representation. -func (v Int16Value) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - return raw.encodeScalar(w, v) -} - -func (v *Int16Value) decode(r io.Reader) error { - n, err := decodeUint16(r) - if err != nil { - return err - } - - *v = Int16Value(n) - return nil -} - -// An Int32Value provides eventstream encoding, and representation of a Go -// int32 value. -type Int32Value int32 - -// Get returns the underlying value. -func (v Int32Value) Get() interface{} { - return int32(v) -} - -// valueType returns the EventStream header value type value. -func (Int32Value) valueType() valueType { - return int32ValueType -} - -func (v Int32Value) String() string { - return fmt.Sprintf("0x%08x", int32(v)) -} - -// encode encodes the Int32Value into an eventstream binary value -// representation. -func (v Int32Value) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - return raw.encodeScalar(w, v) -} - -func (v *Int32Value) decode(r io.Reader) error { - n, err := decodeUint32(r) - if err != nil { - return err - } - - *v = Int32Value(n) - return nil -} - -// An Int64Value provides eventstream encoding, and representation of a Go -// int64 value. -type Int64Value int64 - -// Get returns the underlying value. -func (v Int64Value) Get() interface{} { - return int64(v) -} - -// valueType returns the EventStream header value type value. -func (Int64Value) valueType() valueType { - return int64ValueType -} - -func (v Int64Value) String() string { - return fmt.Sprintf("0x%016x", int64(v)) -} - -// encode encodes the Int64Value into an eventstream binary value -// representation. -func (v Int64Value) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - return raw.encodeScalar(w, v) -} - -func (v *Int64Value) decode(r io.Reader) error { - n, err := decodeUint64(r) - if err != nil { - return err - } - - *v = Int64Value(n) - return nil -} - -// An BytesValue provides eventstream encoding, and representation of a Go -// byte slice. -type BytesValue []byte - -// Get returns the underlying value. -func (v BytesValue) Get() interface{} { - return []byte(v) -} - -// valueType returns the EventStream header value type value. -func (BytesValue) valueType() valueType { - return bytesValueType -} - -func (v BytesValue) String() string { - return base64.StdEncoding.EncodeToString([]byte(v)) -} - -// encode encodes the BytesValue into an eventstream binary value -// representation. -func (v BytesValue) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - - return raw.encodeBytes(w, []byte(v)) -} - -func (v *BytesValue) decode(r io.Reader) error { - buf, err := decodeBytesValue(r) - if err != nil { - return err - } - - *v = BytesValue(buf) - return nil -} - -// An StringValue provides eventstream encoding, and representation of a Go -// string. -type StringValue string - -// Get returns the underlying value. -func (v StringValue) Get() interface{} { - return string(v) -} - -// valueType returns the EventStream header value type value. -func (StringValue) valueType() valueType { - return stringValueType -} - -func (v StringValue) String() string { - return string(v) -} - -// encode encodes the StringValue into an eventstream binary value -// representation. -func (v StringValue) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - - return raw.encodeString(w, string(v)) -} - -func (v *StringValue) decode(r io.Reader) error { - s, err := decodeStringValue(r) - if err != nil { - return err - } - - *v = StringValue(s) - return nil -} - -// An TimestampValue provides eventstream encoding, and representation of a Go -// timestamp. -type TimestampValue time.Time - -// Get returns the underlying value. -func (v TimestampValue) Get() interface{} { - return time.Time(v) -} - -// valueType returns the EventStream header value type value. -func (TimestampValue) valueType() valueType { - return timestampValueType -} - -func (v TimestampValue) epochMilli() int64 { - nano := time.Time(v).UnixNano() - msec := nano / int64(time.Millisecond) - return msec -} - -func (v TimestampValue) String() string { - msec := v.epochMilli() - return strconv.FormatInt(msec, 10) -} - -// encode encodes the TimestampValue into an eventstream binary value -// representation. -func (v TimestampValue) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - - msec := v.epochMilli() - return raw.encodeScalar(w, msec) -} - -func (v *TimestampValue) decode(r io.Reader) error { - n, err := decodeUint64(r) - if err != nil { - return err - } - - *v = TimestampValue(timeFromEpochMilli(int64(n))) - return nil -} - -// MarshalJSON implements the json.Marshaler interface -func (v TimestampValue) MarshalJSON() ([]byte, error) { - return []byte(v.String()), nil -} - -func timeFromEpochMilli(t int64) time.Time { - secs := t / 1e3 - msec := t % 1e3 - return time.Unix(secs, msec*int64(time.Millisecond)).UTC() -} - -// An UUIDValue provides eventstream encoding, and representation of a UUID -// value. -type UUIDValue [16]byte - -// Get returns the underlying value. -func (v UUIDValue) Get() interface{} { - return v[:] -} - -// valueType returns the EventStream header value type value. -func (UUIDValue) valueType() valueType { - return uuidValueType -} - -func (v UUIDValue) String() string { - return fmt.Sprintf(`%X-%X-%X-%X-%X`, v[0:4], v[4:6], v[6:8], v[8:10], v[10:]) -} - -// encode encodes the UUIDValue into an eventstream binary value -// representation. -func (v UUIDValue) encode(w io.Writer) error { - raw := rawValue{ - Type: v.valueType(), - } - - return raw.encodeFixedSlice(w, v[:]) -} - -func (v *UUIDValue) decode(r io.Reader) error { - tv := (*v)[:] - return decodeFixedBytesValue(r, tv) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/message.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/message.go deleted file mode 100644 index 25c9783cd..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/message.go +++ /dev/null @@ -1,103 +0,0 @@ -package eventstream - -import ( - "bytes" - "encoding/binary" - "hash/crc32" -) - -const preludeLen = 8 -const preludeCRCLen = 4 -const msgCRCLen = 4 -const minMsgLen = preludeLen + preludeCRCLen + msgCRCLen -const maxPayloadLen = 1024 * 1024 * 16 // 16MB -const maxHeadersLen = 1024 * 128 // 128KB -const maxMsgLen = minMsgLen + maxHeadersLen + maxPayloadLen - -var crc32IEEETable = crc32.MakeTable(crc32.IEEE) - -// A Message provides the eventstream message representation. -type Message struct { - Headers Headers - Payload []byte -} - -func (m *Message) rawMessage() (rawMessage, error) { - var raw rawMessage - - if len(m.Headers) > 0 { - var headers bytes.Buffer - if err := EncodeHeaders(&headers, m.Headers); err != nil { - return rawMessage{}, err - } - raw.Headers = headers.Bytes() - raw.HeadersLen = uint32(len(raw.Headers)) - } - - raw.Length = raw.HeadersLen + uint32(len(m.Payload)) + minMsgLen - - hash := crc32.New(crc32IEEETable) - binaryWriteFields(hash, binary.BigEndian, raw.Length, raw.HeadersLen) - raw.PreludeCRC = hash.Sum32() - - binaryWriteFields(hash, binary.BigEndian, raw.PreludeCRC) - - if raw.HeadersLen > 0 { - hash.Write(raw.Headers) - } - - // Read payload bytes and update hash for it as well. - if len(m.Payload) > 0 { - raw.Payload = m.Payload - hash.Write(raw.Payload) - } - - raw.CRC = hash.Sum32() - - return raw, nil -} - -type messagePrelude struct { - Length uint32 - HeadersLen uint32 - PreludeCRC uint32 -} - -func (p messagePrelude) PayloadLen() uint32 { - return p.Length - p.HeadersLen - minMsgLen -} - -func (p messagePrelude) ValidateLens() error { - if p.Length == 0 || p.Length > maxMsgLen { - return LengthError{ - Part: "message prelude", - Want: maxMsgLen, - Have: int(p.Length), - } - } - if p.HeadersLen > maxHeadersLen { - return LengthError{ - Part: "message headers", - Want: maxHeadersLen, - Have: int(p.HeadersLen), - } - } - if payloadLen := p.PayloadLen(); payloadLen > maxPayloadLen { - return LengthError{ - Part: "message payload", - Want: maxPayloadLen, - Have: int(payloadLen), - } - } - - return nil -} - -type rawMessage struct { - messagePrelude - - Headers []byte - Payload []byte - - CRC uint32 -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go deleted file mode 100644 index d7d42db0a..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go +++ /dev/null @@ -1,68 +0,0 @@ -package protocol - -import ( - "strings" - - "github.com/aws/aws-sdk-go/aws/request" -) - -// ValidateEndpointHostHandler is a request handler that will validate the -// request endpoint's hosts is a valid RFC 3986 host. -var ValidateEndpointHostHandler = request.NamedHandler{ - Name: "awssdk.protocol.ValidateEndpointHostHandler", - Fn: func(r *request.Request) { - err := ValidateEndpointHost(r.Operation.Name, r.HTTPRequest.URL.Host) - if err != nil { - r.Error = err - } - }, -} - -// ValidateEndpointHost validates that the host string passed in is a valid RFC -// 3986 host. Returns error if the host is not valid. -func ValidateEndpointHost(opName, host string) error { - paramErrs := request.ErrInvalidParams{Context: opName} - labels := strings.Split(host, ".") - - for i, label := range labels { - if i == len(labels)-1 && len(label) == 0 { - // Allow trailing dot for FQDN hosts. - continue - } - - if !ValidHostLabel(label) { - paramErrs.Add(request.NewErrParamFormat( - "endpoint host label", "[a-zA-Z0-9-]{1,63}", label)) - } - } - - if len(host) > 255 { - paramErrs.Add(request.NewErrParamMaxLen( - "endpoint host", 255, host, - )) - } - - if paramErrs.Len() > 0 { - return paramErrs - } - return nil -} - -// ValidHostLabel returns if the label is a valid RFC 3986 host label. -func ValidHostLabel(label string) bool { - if l := len(label); l == 0 || l > 63 { - return false - } - for _, r := range label { - switch { - case r >= '0' && r <= '9': - case r >= 'A' && r <= 'Z': - case r >= 'a' && r <= 'z': - case r == '-': - default: - return false - } - } - - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go deleted file mode 100644 index 915b0fcaf..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go +++ /dev/null @@ -1,54 +0,0 @@ -package protocol - -import ( - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// HostPrefixHandlerName is the handler name for the host prefix request -// handler. -const HostPrefixHandlerName = "awssdk.endpoint.HostPrefixHandler" - -// NewHostPrefixHandler constructs a build handler -func NewHostPrefixHandler(prefix string, labelsFn func() map[string]string) request.NamedHandler { - builder := HostPrefixBuilder{ - Prefix: prefix, - LabelsFn: labelsFn, - } - - return request.NamedHandler{ - Name: HostPrefixHandlerName, - Fn: builder.Build, - } -} - -// HostPrefixBuilder provides the request handler to expand and prepend -// the host prefix into the operation's request endpoint host. -type HostPrefixBuilder struct { - Prefix string - LabelsFn func() map[string]string -} - -// Build updates the passed in Request with the HostPrefix template expanded. -func (h HostPrefixBuilder) Build(r *request.Request) { - if aws.BoolValue(r.Config.DisableEndpointHostPrefix) { - return - } - - var labels map[string]string - if h.LabelsFn != nil { - labels = h.LabelsFn() - } - - prefix := h.Prefix - for name, value := range labels { - prefix = strings.Replace(prefix, "{"+name+"}", value, -1) - } - - r.HTTPRequest.URL.Host = prefix + r.HTTPRequest.URL.Host - if len(r.HTTPRequest.Host) > 0 { - r.HTTPRequest.Host = prefix + r.HTTPRequest.Host - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go deleted file mode 100644 index 53831dff9..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go +++ /dev/null @@ -1,75 +0,0 @@ -package protocol - -import ( - "crypto/rand" - "fmt" - "reflect" -) - -// RandReader is the random reader the protocol package will use to read -// random bytes from. This is exported for testing, and should not be used. -var RandReader = rand.Reader - -const idempotencyTokenFillTag = `idempotencyToken` - -// CanSetIdempotencyToken returns true if the struct field should be -// automatically populated with a Idempotency token. -// -// Only *string and string type fields that are tagged with idempotencyToken -// which are not already set can be auto filled. -func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { - switch u := v.Interface().(type) { - // To auto fill an Idempotency token the field must be a string, - // tagged for auto fill, and have a zero value. - case *string: - return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 - case string: - return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 - } - - return false -} - -// GetIdempotencyToken returns a randomly generated idempotency token. -func GetIdempotencyToken() string { - b := make([]byte, 16) - RandReader.Read(b) - - return UUIDVersion4(b) -} - -// SetIdempotencyToken will set the value provided with a Idempotency Token. -// Given that the value can be set. Will panic if value is not setable. -func SetIdempotencyToken(v reflect.Value) { - if v.Kind() == reflect.Ptr { - if v.IsNil() && v.CanSet() { - v.Set(reflect.New(v.Type().Elem())) - } - v = v.Elem() - } - v = reflect.Indirect(v) - - if !v.CanSet() { - panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) - } - - b := make([]byte, 16) - _, err := rand.Read(b) - if err != nil { - // TODO handle error - return - } - - v.Set(reflect.ValueOf(UUIDVersion4(b))) -} - -// UUIDVersion4 returns a Version 4 random UUID from the byte slice provided -func UUIDVersion4(u []byte) string { - // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 - // 13th character is "4" - u[6] = (u[6] | 0x40) & 0x4F - // 17th character is "8", "9", "a", or "b" - u[8] = (u[8] | 0x80) & 0xBF - - return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go deleted file mode 100644 index 864fb6704..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go +++ /dev/null @@ -1,296 +0,0 @@ -// Package jsonutil provides JSON serialization of AWS requests and responses. -package jsonutil - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/private/protocol" -) - -var timeType = reflect.ValueOf(time.Time{}).Type() -var byteSliceType = reflect.ValueOf([]byte{}).Type() - -// BuildJSON builds a JSON string for a given object v. -func BuildJSON(v interface{}) ([]byte, error) { - var buf bytes.Buffer - - err := buildAny(reflect.ValueOf(v), &buf, "") - return buf.Bytes(), err -} - -func buildAny(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - origVal := value - value = reflect.Indirect(value) - if !value.IsValid() { - return nil - } - - vtype := value.Type() - - t := tag.Get("type") - if t == "" { - switch vtype.Kind() { - case reflect.Struct: - // also it can't be a time object - if value.Type() != timeType { - t = "structure" - } - case reflect.Slice: - // also it can't be a byte slice - if _, ok := value.Interface().([]byte); !ok { - t = "list" - } - case reflect.Map: - // cannot be a JSONValue map - if _, ok := value.Interface().(aws.JSONValue); !ok { - t = "map" - } - } - } - - switch t { - case "structure": - if field, ok := vtype.FieldByName("_"); ok { - tag = field.Tag - } - return buildStruct(value, buf, tag) - case "list": - return buildList(value, buf, tag) - case "map": - return buildMap(value, buf, tag) - default: - return buildScalar(origVal, buf, tag) - } -} - -func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - if !value.IsValid() { - return nil - } - - // unwrap payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := value.Type().FieldByName(payload) - tag = field.Tag - value = elemOf(value.FieldByName(payload)) - - if !value.IsValid() { - return nil - } - } - - buf.WriteByte('{') - - t := value.Type() - first := true - for i := 0; i < t.NumField(); i++ { - member := value.Field(i) - - // This allocates the most memory. - // Additionally, we cannot skip nil fields due to - // idempotency auto filling. - field := t.Field(i) - - if field.PkgPath != "" { - continue // ignore unexported fields - } - if field.Tag.Get("json") == "-" { - continue - } - if field.Tag.Get("location") != "" { - continue // ignore non-body elements - } - if field.Tag.Get("ignore") != "" { - continue - } - - if protocol.CanSetIdempotencyToken(member, field) { - token := protocol.GetIdempotencyToken() - member = reflect.ValueOf(&token) - } - - if (member.Kind() == reflect.Ptr || member.Kind() == reflect.Slice || member.Kind() == reflect.Map) && member.IsNil() { - continue // ignore unset fields - } - - if first { - first = false - } else { - buf.WriteByte(',') - } - - // figure out what this field is called - name := field.Name - if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - - writeString(name, buf) - buf.WriteString(`:`) - - err := buildAny(member, buf, field.Tag) - if err != nil { - return err - } - - } - - buf.WriteString("}") - - return nil -} - -func buildList(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - buf.WriteString("[") - - for i := 0; i < value.Len(); i++ { - buildAny(value.Index(i), buf, "") - - if i < value.Len()-1 { - buf.WriteString(",") - } - } - - buf.WriteString("]") - - return nil -} - -type sortedValues []reflect.Value - -func (sv sortedValues) Len() int { return len(sv) } -func (sv sortedValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv sortedValues) Less(i, j int) bool { return sv[i].String() < sv[j].String() } - -func buildMap(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - buf.WriteString("{") - - sv := sortedValues(value.MapKeys()) - sort.Sort(sv) - - for i, k := range sv { - if i > 0 { - buf.WriteByte(',') - } - - writeString(k.String(), buf) - buf.WriteString(`:`) - - buildAny(value.MapIndex(k), buf, "") - } - - buf.WriteString("}") - - return nil -} - -func buildScalar(v reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { - // prevents allocation on the heap. - scratch := [64]byte{} - switch value := reflect.Indirect(v); value.Kind() { - case reflect.String: - writeString(value.String(), buf) - case reflect.Bool: - if value.Bool() { - buf.WriteString("true") - } else { - buf.WriteString("false") - } - case reflect.Int64: - buf.Write(strconv.AppendInt(scratch[:0], value.Int(), 10)) - case reflect.Float64: - f := value.Float() - if math.IsInf(f, 0) || math.IsNaN(f) { - return &json.UnsupportedValueError{Value: v, Str: strconv.FormatFloat(f, 'f', -1, 64)} - } - buf.Write(strconv.AppendFloat(scratch[:0], f, 'f', -1, 64)) - default: - switch converted := value.Interface().(type) { - case time.Time: - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.UnixTimeFormatName - } - - ts := protocol.FormatTime(format, converted) - if format != protocol.UnixTimeFormatName { - ts = `"` + ts + `"` - } - - buf.WriteString(ts) - case []byte: - if !value.IsNil() { - buf.WriteByte('"') - if len(converted) < 1024 { - // for small buffers, using Encode directly is much faster. - dst := make([]byte, base64.StdEncoding.EncodedLen(len(converted))) - base64.StdEncoding.Encode(dst, converted) - buf.Write(dst) - } else { - // for large buffers, avoid unnecessary extra temporary - // buffer space. - enc := base64.NewEncoder(base64.StdEncoding, buf) - enc.Write(converted) - enc.Close() - } - buf.WriteByte('"') - } - case aws.JSONValue: - str, err := protocol.EncodeJSONValue(converted, protocol.QuotedEscape) - if err != nil { - return fmt.Errorf("unable to encode JSONValue, %v", err) - } - buf.WriteString(str) - default: - return fmt.Errorf("unsupported JSON value %v (%s)", value.Interface(), value.Type()) - } - } - return nil -} - -var hex = "0123456789abcdef" - -func writeString(s string, buf *bytes.Buffer) { - buf.WriteByte('"') - for i := 0; i < len(s); i++ { - if s[i] == '"' { - buf.WriteString(`\"`) - } else if s[i] == '\\' { - buf.WriteString(`\\`) - } else if s[i] == '\b' { - buf.WriteString(`\b`) - } else if s[i] == '\f' { - buf.WriteString(`\f`) - } else if s[i] == '\r' { - buf.WriteString(`\r`) - } else if s[i] == '\t' { - buf.WriteString(`\t`) - } else if s[i] == '\n' { - buf.WriteString(`\n`) - } else if s[i] < 32 { - buf.WriteString("\\u00") - buf.WriteByte(hex[s[i]>>4]) - buf.WriteByte(hex[s[i]&0xF]) - } else { - buf.WriteByte(s[i]) - } - } - buf.WriteByte('"') -} - -// Returns the reflection element of a value, if it is a pointer. -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go deleted file mode 100644 index 5e9499699..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go +++ /dev/null @@ -1,282 +0,0 @@ -package jsonutil - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "io" - "reflect" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/private/protocol" -) - -// UnmarshalJSONError unmarshal's the reader's JSON document into the passed in -// type. The value to unmarshal the json document into must be a pointer to the -// type. -func UnmarshalJSONError(v interface{}, stream io.Reader) error { - var errBuf bytes.Buffer - body := io.TeeReader(stream, &errBuf) - - err := json.NewDecoder(body).Decode(v) - if err != nil { - msg := "failed decoding error message" - if err == io.EOF { - msg = "error message missing" - err = nil - } - return awserr.NewUnmarshalError(err, msg, errBuf.Bytes()) - } - - return nil -} - -// UnmarshalJSON reads a stream and unmarshals the results in object v. -func UnmarshalJSON(v interface{}, stream io.Reader) error { - var out interface{} - - err := json.NewDecoder(stream).Decode(&out) - if err == io.EOF { - return nil - } else if err != nil { - return err - } - - return unmarshaler{}.unmarshalAny(reflect.ValueOf(v), out, "") -} - -// UnmarshalJSONCaseInsensitive reads a stream and unmarshals the result into the -// object v. Ignores casing for structure members. -func UnmarshalJSONCaseInsensitive(v interface{}, stream io.Reader) error { - var out interface{} - - err := json.NewDecoder(stream).Decode(&out) - if err == io.EOF { - return nil - } else if err != nil { - return err - } - - return unmarshaler{ - caseInsensitive: true, - }.unmarshalAny(reflect.ValueOf(v), out, "") -} - -type unmarshaler struct { - caseInsensitive bool -} - -func (u unmarshaler) unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag) error { - vtype := value.Type() - if vtype.Kind() == reflect.Ptr { - vtype = vtype.Elem() // check kind of actual element type - } - - t := tag.Get("type") - if t == "" { - switch vtype.Kind() { - case reflect.Struct: - // also it can't be a time object - if _, ok := value.Interface().(*time.Time); !ok { - t = "structure" - } - case reflect.Slice: - // also it can't be a byte slice - if _, ok := value.Interface().([]byte); !ok { - t = "list" - } - case reflect.Map: - // cannot be a JSONValue map - if _, ok := value.Interface().(aws.JSONValue); !ok { - t = "map" - } - } - } - - switch t { - case "structure": - if field, ok := vtype.FieldByName("_"); ok { - tag = field.Tag - } - return u.unmarshalStruct(value, data, tag) - case "list": - return u.unmarshalList(value, data, tag) - case "map": - return u.unmarshalMap(value, data, tag) - default: - return u.unmarshalScalar(value, data, tag) - } -} - -func (u unmarshaler) unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTag) error { - if data == nil { - return nil - } - mapData, ok := data.(map[string]interface{}) - if !ok { - return fmt.Errorf("JSON value is not a structure (%#v)", data) - } - - t := value.Type() - if value.Kind() == reflect.Ptr { - if value.IsNil() { // create the structure if it's nil - s := reflect.New(value.Type().Elem()) - value.Set(s) - value = s - } - - value = value.Elem() - t = t.Elem() - } - - // unwrap any payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := t.FieldByName(payload) - return u.unmarshalAny(value.FieldByName(payload), data, field.Tag) - } - - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - if field.PkgPath != "" { - continue // ignore unexported fields - } - - // figure out what this field is called - name := field.Name - if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - if u.caseInsensitive { - if _, ok := mapData[name]; !ok { - // Fallback to uncased name search if the exact name didn't match. - for kn, v := range mapData { - if strings.EqualFold(kn, name) { - mapData[name] = v - } - } - } - } - - member := value.FieldByIndex(field.Index) - err := u.unmarshalAny(member, mapData[name], field.Tag) - if err != nil { - return err - } - } - return nil -} - -func (u unmarshaler) unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag) error { - if data == nil { - return nil - } - listData, ok := data.([]interface{}) - if !ok { - return fmt.Errorf("JSON value is not a list (%#v)", data) - } - - if value.IsNil() { - l := len(listData) - value.Set(reflect.MakeSlice(value.Type(), l, l)) - } - - for i, c := range listData { - err := u.unmarshalAny(value.Index(i), c, "") - if err != nil { - return err - } - } - - return nil -} - -func (u unmarshaler) unmarshalMap(value reflect.Value, data interface{}, tag reflect.StructTag) error { - if data == nil { - return nil - } - mapData, ok := data.(map[string]interface{}) - if !ok { - return fmt.Errorf("JSON value is not a map (%#v)", data) - } - - if value.IsNil() { - value.Set(reflect.MakeMap(value.Type())) - } - - for k, v := range mapData { - kvalue := reflect.ValueOf(k) - vvalue := reflect.New(value.Type().Elem()).Elem() - - u.unmarshalAny(vvalue, v, "") - value.SetMapIndex(kvalue, vvalue) - } - - return nil -} - -func (u unmarshaler) unmarshalScalar(value reflect.Value, data interface{}, tag reflect.StructTag) error { - - switch d := data.(type) { - case nil: - return nil // nothing to do here - case string: - switch value.Interface().(type) { - case *string: - value.Set(reflect.ValueOf(&d)) - case []byte: - b, err := base64.StdEncoding.DecodeString(d) - if err != nil { - return err - } - value.Set(reflect.ValueOf(b)) - case *time.Time: - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.ISO8601TimeFormatName - } - - t, err := protocol.ParseTime(format, d) - if err != nil { - return err - } - value.Set(reflect.ValueOf(&t)) - case aws.JSONValue: - // No need to use escaping as the value is a non-quoted string. - v, err := protocol.DecodeJSONValue(d, protocol.NoEscape) - if err != nil { - return err - } - value.Set(reflect.ValueOf(v)) - default: - return fmt.Errorf("unsupported value: %v (%s)", value.Interface(), value.Type()) - } - case float64: - switch value.Interface().(type) { - case *int64: - di := int64(d) - value.Set(reflect.ValueOf(&di)) - case *float64: - value.Set(reflect.ValueOf(&d)) - case *time.Time: - // Time unmarshaled from a float64 can only be epoch seconds - t := time.Unix(int64(d), 0).UTC() - value.Set(reflect.ValueOf(&t)) - default: - return fmt.Errorf("unsupported value: %v (%s)", value.Interface(), value.Type()) - } - case bool: - switch value.Interface().(type) { - case *bool: - value.Set(reflect.ValueOf(&d)) - default: - return fmt.Errorf("unsupported value: %v (%s)", value.Interface(), value.Type()) - } - default: - return fmt.Errorf("unsupported JSON value (%v)", data) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go deleted file mode 100644 index 776d11018..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go +++ /dev/null @@ -1,76 +0,0 @@ -package protocol - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "strconv" - - "github.com/aws/aws-sdk-go/aws" -) - -// EscapeMode is the mode that should be use for escaping a value -type EscapeMode uint - -// The modes for escaping a value before it is marshaled, and unmarshaled. -const ( - NoEscape EscapeMode = iota - Base64Escape - QuotedEscape -) - -// EncodeJSONValue marshals the value into a JSON string, and optionally base64 -// encodes the string before returning it. -// -// Will panic if the escape mode is unknown. -func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error) { - b, err := json.Marshal(v) - if err != nil { - return "", err - } - - switch escape { - case NoEscape: - return string(b), nil - case Base64Escape: - return base64.StdEncoding.EncodeToString(b), nil - case QuotedEscape: - return strconv.Quote(string(b)), nil - } - - panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", escape)) -} - -// DecodeJSONValue will attempt to decode the string input as a JSONValue. -// Optionally decoding base64 the value first before JSON unmarshaling. -// -// Will panic if the escape mode is unknown. -func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error) { - var b []byte - var err error - - switch escape { - case NoEscape: - b = []byte(v) - case Base64Escape: - b, err = base64.StdEncoding.DecodeString(v) - case QuotedEscape: - var u string - u, err = strconv.Unquote(v) - b = []byte(u) - default: - panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", escape)) - } - - if err != nil { - return nil, err - } - - m := aws.JSONValue{} - err = json.Unmarshal(b, &m) - if err != nil { - return nil, err - } - - return m, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go deleted file mode 100644 index 0ea0647a5..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go +++ /dev/null @@ -1,81 +0,0 @@ -package protocol - -import ( - "io" - "io/ioutil" - "net/http" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" -) - -// PayloadUnmarshaler provides the interface for unmarshaling a payload's -// reader into a SDK shape. -type PayloadUnmarshaler interface { - UnmarshalPayload(io.Reader, interface{}) error -} - -// HandlerPayloadUnmarshal implements the PayloadUnmarshaler from a -// HandlerList. This provides the support for unmarshaling a payload reader to -// a shape without needing a SDK request first. -type HandlerPayloadUnmarshal struct { - Unmarshalers request.HandlerList -} - -// UnmarshalPayload unmarshals the io.Reader payload into the SDK shape using -// the Unmarshalers HandlerList provided. Returns an error if unable -// unmarshaling fails. -func (h HandlerPayloadUnmarshal) UnmarshalPayload(r io.Reader, v interface{}) error { - req := &request.Request{ - HTTPRequest: &http.Request{}, - HTTPResponse: &http.Response{ - StatusCode: 200, - Header: http.Header{}, - Body: ioutil.NopCloser(r), - }, - Data: v, - } - - h.Unmarshalers.Run(req) - - return req.Error -} - -// PayloadMarshaler provides the interface for marshaling a SDK shape into and -// io.Writer. -type PayloadMarshaler interface { - MarshalPayload(io.Writer, interface{}) error -} - -// HandlerPayloadMarshal implements the PayloadMarshaler from a HandlerList. -// This provides support for marshaling a SDK shape into an io.Writer without -// needing a SDK request first. -type HandlerPayloadMarshal struct { - Marshalers request.HandlerList -} - -// MarshalPayload marshals the SDK shape into the io.Writer using the -// Marshalers HandlerList provided. Returns an error if unable if marshal -// fails. -func (h HandlerPayloadMarshal) MarshalPayload(w io.Writer, v interface{}) error { - req := request.New( - aws.Config{}, - metadata.ClientInfo{}, - request.Handlers{}, - nil, - &request.Operation{HTTPMethod: "PUT"}, - v, - nil, - ) - - h.Marshalers.Run(req) - - if req.Error != nil { - return req.Error - } - - io.Copy(w, req.GetBody()) - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol.go deleted file mode 100644 index 9d521dcb9..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/protocol.go +++ /dev/null @@ -1,49 +0,0 @@ -package protocol - -import ( - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// RequireHTTPMinProtocol request handler is used to enforce that -// the target endpoint supports the given major and minor HTTP protocol version. -type RequireHTTPMinProtocol struct { - Major, Minor int -} - -// Handler will mark the request.Request with an error if the -// target endpoint did not connect with the required HTTP protocol -// major and minor version. -func (p RequireHTTPMinProtocol) Handler(r *request.Request) { - if r.Error != nil || r.HTTPResponse == nil { - return - } - - if !strings.HasPrefix(r.HTTPResponse.Proto, "HTTP") { - r.Error = newMinHTTPProtoError(p.Major, p.Minor, r) - } - - if r.HTTPResponse.ProtoMajor < p.Major || r.HTTPResponse.ProtoMinor < p.Minor { - r.Error = newMinHTTPProtoError(p.Major, p.Minor, r) - } -} - -// ErrCodeMinimumHTTPProtocolError error code is returned when the target endpoint -// did not match the required HTTP major and minor protocol version. -const ErrCodeMinimumHTTPProtocolError = "MinimumHTTPProtocolError" - -func newMinHTTPProtoError(major, minor int, r *request.Request) error { - return awserr.NewRequestFailure( - awserr.New("MinimumHTTPProtocolError", - fmt.Sprintf( - "operation requires minimum HTTP protocol of HTTP/%d.%d, but was %s", - major, minor, r.HTTPResponse.Proto, - ), - nil, - ), - r.HTTPResponse.StatusCode, r.RequestID, - ) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go deleted file mode 100644 index d40346a77..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go +++ /dev/null @@ -1,36 +0,0 @@ -// Package query provides serialization of AWS query requests, and responses. -package query - -//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/query.json build_test.go - -import ( - "net/url" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" -) - -// BuildHandler is a named request handler for building query protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} - -// Build builds a request for an AWS Query service. -func Build(r *request.Request) { - body := url.Values{ - "Action": {r.Operation.Name}, - "Version": {r.ClientInfo.APIVersion}, - } - if err := queryutil.Parse(body, r.Params, false); err != nil { - r.Error = awserr.New(request.ErrCodeSerialization, "failed encoding Query request", err) - return - } - - if !r.IsPresigned() { - r.HTTPRequest.Method = "POST" - r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") - r.SetBufferBody([]byte(body.Encode())) - } else { // This is a pre-signed request - r.HTTPRequest.Method = "GET" - r.HTTPRequest.URL.RawQuery = body.Encode() - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go deleted file mode 100644 index 75866d012..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go +++ /dev/null @@ -1,246 +0,0 @@ -package queryutil - -import ( - "encoding/base64" - "fmt" - "net/url" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/private/protocol" -) - -// Parse parses an object i and fills a url.Values object. The isEC2 flag -// indicates if this is the EC2 Query sub-protocol. -func Parse(body url.Values, i interface{}, isEC2 bool) error { - q := queryParser{isEC2: isEC2} - return q.parseValue(body, reflect.ValueOf(i), "", "") -} - -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} - -type queryParser struct { - isEC2 bool -} - -func (q *queryParser) parseValue(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - value = elemOf(value) - - // no need to handle zero values - if !value.IsValid() { - return nil - } - - t := tag.Get("type") - if t == "" { - switch value.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - return q.parseStruct(v, value, prefix) - case "list": - return q.parseList(v, value, prefix, tag) - case "map": - return q.parseMap(v, value, prefix, tag) - default: - return q.parseScalar(v, value, prefix, tag) - } -} - -func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix string) error { - if !value.IsValid() { - return nil - } - - t := value.Type() - for i := 0; i < value.NumField(); i++ { - elemValue := elemOf(value.Field(i)) - field := t.Field(i) - - if field.PkgPath != "" { - continue // ignore unexported fields - } - if field.Tag.Get("ignore") != "" { - continue - } - - if protocol.CanSetIdempotencyToken(value.Field(i), field) { - token := protocol.GetIdempotencyToken() - elemValue = reflect.ValueOf(token) - } - - var name string - if q.isEC2 { - name = field.Tag.Get("queryName") - } - if name == "" { - if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { - name = field.Tag.Get("locationNameList") - } else if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - if name != "" && q.isEC2 { - name = strings.ToUpper(name[0:1]) + name[1:] - } - } - if name == "" { - name = field.Name - } - - if prefix != "" { - name = prefix + "." + name - } - - if err := q.parseValue(v, elemValue, name, field.Tag); err != nil { - return err - } - } - return nil -} - -func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { - v.Set(prefix, "") - return nil - } - - if _, ok := value.Interface().([]byte); ok { - return q.parseScalar(v, value, prefix, tag) - } - - // check for unflattened list member - if !q.isEC2 && tag.Get("flattened") == "" { - if listName := tag.Get("locationNameList"); listName == "" { - prefix += ".member" - } else { - prefix += "." + listName - } - } - - for i := 0; i < value.Len(); i++ { - slicePrefix := prefix - if slicePrefix == "" { - slicePrefix = strconv.Itoa(i + 1) - } else { - slicePrefix = slicePrefix + "." + strconv.Itoa(i+1) - } - if err := q.parseValue(v, value.Index(i), slicePrefix, ""); err != nil { - return err - } - } - return nil -} - -func (q *queryParser) parseMap(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { - v.Set(prefix, "") - return nil - } - - // check for unflattened list member - if !q.isEC2 && tag.Get("flattened") == "" { - prefix += ".entry" - } - - // sort keys for improved serialization consistency. - // this is not strictly necessary for protocol support. - mapKeyValues := value.MapKeys() - mapKeys := map[string]reflect.Value{} - mapKeyNames := make([]string, len(mapKeyValues)) - for i, mapKey := range mapKeyValues { - name := mapKey.String() - mapKeys[name] = mapKey - mapKeyNames[i] = name - } - sort.Strings(mapKeyNames) - - for i, mapKeyName := range mapKeyNames { - mapKey := mapKeys[mapKeyName] - mapValue := value.MapIndex(mapKey) - - kname := tag.Get("locationNameKey") - if kname == "" { - kname = "key" - } - vname := tag.Get("locationNameValue") - if vname == "" { - vname = "value" - } - - // serialize key - var keyName string - if prefix == "" { - keyName = strconv.Itoa(i+1) + "." + kname - } else { - keyName = prefix + "." + strconv.Itoa(i+1) + "." + kname - } - - if err := q.parseValue(v, mapKey, keyName, ""); err != nil { - return err - } - - // serialize value - var valueName string - if prefix == "" { - valueName = strconv.Itoa(i+1) + "." + vname - } else { - valueName = prefix + "." + strconv.Itoa(i+1) + "." + vname - } - - if err := q.parseValue(v, mapValue, valueName, ""); err != nil { - return err - } - } - - return nil -} - -func (q *queryParser) parseScalar(v url.Values, r reflect.Value, name string, tag reflect.StructTag) error { - switch value := r.Interface().(type) { - case string: - v.Set(name, value) - case []byte: - if !r.IsNil() { - v.Set(name, base64.StdEncoding.EncodeToString(value)) - } - case bool: - v.Set(name, strconv.FormatBool(value)) - case int64: - v.Set(name, strconv.FormatInt(value, 10)) - case int: - v.Set(name, strconv.Itoa(value)) - case float64: - v.Set(name, strconv.FormatFloat(value, 'f', -1, 64)) - case float32: - v.Set(name, strconv.FormatFloat(float64(value), 'f', -1, 32)) - case time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.ISO8601TimeFormatName - } - - v.Set(name, protocol.FormatTime(format, value)) - default: - return fmt.Errorf("unsupported value for param %s: %v (%s)", name, r.Interface(), r.Type().Name()) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go deleted file mode 100644 index 9231e95d1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go +++ /dev/null @@ -1,39 +0,0 @@ -package query - -//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/query.json unmarshal_test.go - -import ( - "encoding/xml" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" -) - -// UnmarshalHandler is a named request handler for unmarshaling query protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} - -// Unmarshal unmarshals a response for an AWS Query service. -func Unmarshal(r *request.Request) { - defer r.HTTPResponse.Body.Close() - if r.DataFilled() { - decoder := xml.NewDecoder(r.HTTPResponse.Body) - err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, "failed decoding Query response", err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - } -} - -// UnmarshalMeta unmarshals header response values for an AWS Query service. -func UnmarshalMeta(r *request.Request) { - r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go deleted file mode 100644 index 831b0110c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go +++ /dev/null @@ -1,69 +0,0 @@ -package query - -import ( - "encoding/xml" - "fmt" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" -) - -// UnmarshalErrorHandler is a name request handler to unmarshal request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} - -type xmlErrorResponse struct { - Code string `xml:"Error>Code"` - Message string `xml:"Error>Message"` - RequestID string `xml:"RequestId"` -} - -type xmlResponseError struct { - xmlErrorResponse -} - -func (e *xmlResponseError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - const svcUnavailableTagName = "ServiceUnavailableException" - const errorResponseTagName = "ErrorResponse" - - switch start.Name.Local { - case svcUnavailableTagName: - e.Code = svcUnavailableTagName - e.Message = "service is unavailable" - return d.Skip() - - case errorResponseTagName: - return d.DecodeElement(&e.xmlErrorResponse, &start) - - default: - return fmt.Errorf("unknown error response tag, %v", start) - } -} - -// UnmarshalError unmarshals an error response for an AWS Query service. -func UnmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - var respErr xmlResponseError - err := xmlutil.UnmarshalXMLError(&respErr, r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, - "failed to unmarshal error message", err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - - reqID := respErr.RequestID - if len(reqID) == 0 { - reqID = r.RequestID - } - - r.Error = awserr.NewRequestFailure( - awserr.New(respErr.Code, respErr.Message, nil), - r.HTTPResponse.StatusCode, - reqID, - ) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go deleted file mode 100644 index 1301b149d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ /dev/null @@ -1,310 +0,0 @@ -// Package rest provides RESTful serialization of AWS requests and responses. -package rest - -import ( - "bytes" - "encoding/base64" - "fmt" - "io" - "net/http" - "net/url" - "path" - "reflect" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" -) - -// Whether the byte value can be sent without escaping in AWS URLs -var noEscape [256]bool - -var errValueNotSet = fmt.Errorf("value not set") - -var byteSliceType = reflect.TypeOf([]byte{}) - -func init() { - for i := 0; i < len(noEscape); i++ { - // AWS expects every character except these to be escaped - noEscape[i] = (i >= 'A' && i <= 'Z') || - (i >= 'a' && i <= 'z') || - (i >= '0' && i <= '9') || - i == '-' || - i == '.' || - i == '_' || - i == '~' - } -} - -// BuildHandler is a named request handler for building rest protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.rest.Build", Fn: Build} - -// Build builds the REST component of a service request. -func Build(r *request.Request) { - if r.ParamsFilled() { - v := reflect.ValueOf(r.Params).Elem() - buildLocationElements(r, v, false) - buildBody(r, v) - } -} - -// BuildAsGET builds the REST component of a service request with the ability to hoist -// data from the body. -func BuildAsGET(r *request.Request) { - if r.ParamsFilled() { - v := reflect.ValueOf(r.Params).Elem() - buildLocationElements(r, v, true) - buildBody(r, v) - } -} - -func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bool) { - query := r.HTTPRequest.URL.Query() - - // Setup the raw path to match the base path pattern. This is needed - // so that when the path is mutated a custom escaped version can be - // stored in RawPath that will be used by the Go client. - r.HTTPRequest.URL.RawPath = r.HTTPRequest.URL.Path - - for i := 0; i < v.NumField(); i++ { - m := v.Field(i) - if n := v.Type().Field(i).Name; n[0:1] == strings.ToLower(n[0:1]) { - continue - } - - if m.IsValid() { - field := v.Type().Field(i) - name := field.Tag.Get("locationName") - if name == "" { - name = field.Name - } - if kind := m.Kind(); kind == reflect.Ptr { - m = m.Elem() - } else if kind == reflect.Interface { - if !m.Elem().IsValid() { - continue - } - } - if !m.IsValid() { - continue - } - if field.Tag.Get("ignore") != "" { - continue - } - - // Support the ability to customize values to be marshaled as a - // blob even though they were modeled as a string. Required for S3 - // API operations like SSECustomerKey is modeled as stirng but - // required to be base64 encoded in request. - if field.Tag.Get("marshal-as") == "blob" { - m = m.Convert(byteSliceType) - } - - var err error - switch field.Tag.Get("location") { - case "headers": // header maps - err = buildHeaderMap(&r.HTTPRequest.Header, m, field.Tag) - case "header": - err = buildHeader(&r.HTTPRequest.Header, m, name, field.Tag) - case "uri": - err = buildURI(r.HTTPRequest.URL, m, name, field.Tag) - case "querystring": - err = buildQueryString(query, m, name, field.Tag) - default: - if buildGETQuery { - err = buildQueryString(query, m, name, field.Tag) - } - } - r.Error = err - } - if r.Error != nil { - return - } - } - - r.HTTPRequest.URL.RawQuery = query.Encode() - if !aws.BoolValue(r.Config.DisableRestProtocolURICleaning) { - cleanPath(r.HTTPRequest.URL) - } -} - -func buildBody(r *request.Request, v reflect.Value) { - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - pfield, _ := v.Type().FieldByName(payloadName) - if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { - payload := reflect.Indirect(v.FieldByName(payloadName)) - if payload.IsValid() && payload.Interface() != nil { - switch reader := payload.Interface().(type) { - case io.ReadSeeker: - r.SetReaderBody(reader) - case []byte: - r.SetBufferBody(reader) - case string: - r.SetStringBody(reader) - default: - r.Error = awserr.New(request.ErrCodeSerialization, - "failed to encode REST request", - fmt.Errorf("unknown payload type %s", payload.Type())) - } - } - } - } - } -} - -func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect.StructTag) error { - str, err := convertType(v, tag) - if err == errValueNotSet { - return nil - } else if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) - } - - name = strings.TrimSpace(name) - str = strings.TrimSpace(str) - - header.Add(name, str) - - return nil -} - -func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) error { - prefix := tag.Get("locationName") - for _, key := range v.MapKeys() { - str, err := convertType(v.MapIndex(key), tag) - if err == errValueNotSet { - continue - } else if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) - - } - keyStr := strings.TrimSpace(key.String()) - str = strings.TrimSpace(str) - - header.Add(prefix+keyStr, str) - } - return nil -} - -func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) error { - value, err := convertType(v, tag) - if err == errValueNotSet { - return nil - } else if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) - } - - u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) - u.Path = strings.Replace(u.Path, "{"+name+"+}", value, -1) - - u.RawPath = strings.Replace(u.RawPath, "{"+name+"}", EscapePath(value, true), -1) - u.RawPath = strings.Replace(u.RawPath, "{"+name+"+}", EscapePath(value, false), -1) - - return nil -} - -func buildQueryString(query url.Values, v reflect.Value, name string, tag reflect.StructTag) error { - switch value := v.Interface().(type) { - case []*string: - for _, item := range value { - query.Add(name, *item) - } - case map[string]*string: - for key, item := range value { - query.Add(key, *item) - } - case map[string][]*string: - for key, items := range value { - for _, item := range items { - query.Add(key, *item) - } - } - default: - str, err := convertType(v, tag) - if err == errValueNotSet { - return nil - } else if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) - } - query.Set(name, str) - } - - return nil -} - -func cleanPath(u *url.URL) { - hasSlash := strings.HasSuffix(u.Path, "/") - - // clean up path, removing duplicate `/` - u.Path = path.Clean(u.Path) - u.RawPath = path.Clean(u.RawPath) - - if hasSlash && !strings.HasSuffix(u.Path, "/") { - u.Path += "/" - u.RawPath += "/" - } -} - -// EscapePath escapes part of a URL path in Amazon style -func EscapePath(path string, encodeSep bool) string { - var buf bytes.Buffer - for i := 0; i < len(path); i++ { - c := path[i] - if noEscape[c] || (c == '/' && !encodeSep) { - buf.WriteByte(c) - } else { - fmt.Fprintf(&buf, "%%%02X", c) - } - } - return buf.String() -} - -func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error) { - v = reflect.Indirect(v) - if !v.IsValid() { - return "", errValueNotSet - } - - switch value := v.Interface().(type) { - case string: - str = value - case []byte: - str = base64.StdEncoding.EncodeToString(value) - case bool: - str = strconv.FormatBool(value) - case int64: - str = strconv.FormatInt(value, 10) - case float64: - str = strconv.FormatFloat(value, 'f', -1, 64) - case time.Time: - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.RFC822TimeFormatName - if tag.Get("location") == "querystring" { - format = protocol.ISO8601TimeFormatName - } - } - str = protocol.FormatTime(format, value) - case aws.JSONValue: - if len(value) == 0 { - return "", errValueNotSet - } - escaping := protocol.NoEscape - if tag.Get("location") == "header" { - escaping = protocol.Base64Escape - } - str, err = protocol.EncodeJSONValue(value, escaping) - if err != nil { - return "", fmt.Errorf("unable to encode JSONValue, %v", err) - } - default: - err := fmt.Errorf("unsupported value for param %v (%s)", v.Interface(), v.Type()) - return "", err - } - return str, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go deleted file mode 100644 index 4366de2e1..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go +++ /dev/null @@ -1,45 +0,0 @@ -package rest - -import "reflect" - -// PayloadMember returns the payload field member of i if there is one, or nil. -func PayloadMember(i interface{}) interface{} { - if i == nil { - return nil - } - - v := reflect.ValueOf(i).Elem() - if !v.IsValid() { - return nil - } - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - field, _ := v.Type().FieldByName(payloadName) - if field.Tag.Get("type") != "structure" { - return nil - } - - payload := v.FieldByName(payloadName) - if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { - return payload.Interface() - } - } - } - return nil -} - -// PayloadType returns the type of a payload field member of i if there is one, or "". -func PayloadType(i interface{}) string { - v := reflect.Indirect(reflect.ValueOf(i)) - if !v.IsValid() { - return "" - } - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - if member, ok := v.Type().FieldByName(payloadName); ok { - return member.Tag.Get("type") - } - } - } - return "" -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go deleted file mode 100644 index 92f8b4d9a..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ /dev/null @@ -1,257 +0,0 @@ -package rest - -import ( - "bytes" - "encoding/base64" - "fmt" - "io" - "io/ioutil" - "net/http" - "reflect" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - awsStrings "github.com/aws/aws-sdk-go/internal/strings" - "github.com/aws/aws-sdk-go/private/protocol" -) - -// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.rest.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling rest protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.rest.UnmarshalMeta", Fn: UnmarshalMeta} - -// Unmarshal unmarshals the REST component of a response in a REST service. -func Unmarshal(r *request.Request) { - if r.DataFilled() { - v := reflect.Indirect(reflect.ValueOf(r.Data)) - if err := unmarshalBody(r, v); err != nil { - r.Error = err - } - } -} - -// UnmarshalMeta unmarshals the REST metadata of a response in a REST service -func UnmarshalMeta(r *request.Request) { - r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") - if r.RequestID == "" { - // Alternative version of request id in the header - r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id") - } - if r.DataFilled() { - if err := UnmarshalResponse(r.HTTPResponse, r.Data, aws.BoolValue(r.Config.LowerCaseHeaderMaps)); err != nil { - r.Error = err - } - } -} - -// UnmarshalResponse attempts to unmarshal the REST response headers to -// the data type passed in. The type must be a pointer. An error is returned -// with any error unmarshaling the response into the target datatype. -func UnmarshalResponse(resp *http.Response, data interface{}, lowerCaseHeaderMaps bool) error { - v := reflect.Indirect(reflect.ValueOf(data)) - return unmarshalLocationElements(resp, v, lowerCaseHeaderMaps) -} - -func unmarshalBody(r *request.Request, v reflect.Value) error { - if field, ok := v.Type().FieldByName("_"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - pfield, _ := v.Type().FieldByName(payloadName) - if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { - payload := v.FieldByName(payloadName) - if payload.IsValid() { - switch payload.Interface().(type) { - case []byte: - defer r.HTTPResponse.Body.Close() - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) - } - - payload.Set(reflect.ValueOf(b)) - - case *string: - defer r.HTTPResponse.Body.Close() - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) - } - - str := string(b) - payload.Set(reflect.ValueOf(&str)) - - default: - switch payload.Type().String() { - case "io.ReadCloser": - payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) - - case "io.ReadSeeker": - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - return awserr.New(request.ErrCodeSerialization, - "failed to read response body", err) - } - payload.Set(reflect.ValueOf(ioutil.NopCloser(bytes.NewReader(b)))) - - default: - io.Copy(ioutil.Discard, r.HTTPResponse.Body) - r.HTTPResponse.Body.Close() - return awserr.New(request.ErrCodeSerialization, - "failed to decode REST response", - fmt.Errorf("unknown payload type %s", payload.Type())) - } - } - } - } - } - } - - return nil -} - -func unmarshalLocationElements(resp *http.Response, v reflect.Value, lowerCaseHeaderMaps bool) error { - for i := 0; i < v.NumField(); i++ { - m, field := v.Field(i), v.Type().Field(i) - if n := field.Name; n[0:1] == strings.ToLower(n[0:1]) { - continue - } - - if m.IsValid() { - name := field.Tag.Get("locationName") - if name == "" { - name = field.Name - } - - switch field.Tag.Get("location") { - case "statusCode": - unmarshalStatusCode(m, resp.StatusCode) - - case "header": - err := unmarshalHeader(m, resp.Header.Get(name), field.Tag) - if err != nil { - return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) - } - - case "headers": - prefix := field.Tag.Get("locationName") - err := unmarshalHeaderMap(m, resp.Header, prefix, lowerCaseHeaderMaps) - if err != nil { - awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) - } - } - } - } - - return nil -} - -func unmarshalStatusCode(v reflect.Value, statusCode int) { - if !v.IsValid() { - return - } - - switch v.Interface().(type) { - case *int64: - s := int64(statusCode) - v.Set(reflect.ValueOf(&s)) - } -} - -func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string, normalize bool) error { - if len(headers) == 0 { - return nil - } - switch r.Interface().(type) { - case map[string]*string: // we only support string map value types - out := map[string]*string{} - for k, v := range headers { - if awsStrings.HasPrefixFold(k, prefix) { - if normalize == true { - k = strings.ToLower(k) - } else { - k = http.CanonicalHeaderKey(k) - } - out[k[len(prefix):]] = &v[0] - } - } - if len(out) != 0 { - r.Set(reflect.ValueOf(out)) - } - - } - return nil -} - -func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) error { - switch tag.Get("type") { - case "jsonvalue": - if len(header) == 0 { - return nil - } - case "blob": - if len(header) == 0 { - return nil - } - default: - if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { - return nil - } - } - - switch v.Interface().(type) { - case *string: - v.Set(reflect.ValueOf(&header)) - case []byte: - b, err := base64.StdEncoding.DecodeString(header) - if err != nil { - return err - } - v.Set(reflect.ValueOf(b)) - case *bool: - b, err := strconv.ParseBool(header) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&b)) - case *int64: - i, err := strconv.ParseInt(header, 10, 64) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&i)) - case *float64: - f, err := strconv.ParseFloat(header, 64) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&f)) - case *time.Time: - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.RFC822TimeFormatName - } - t, err := protocol.ParseTime(format, header) - if err != nil { - return err - } - v.Set(reflect.ValueOf(&t)) - case aws.JSONValue: - escaping := protocol.NoEscape - if tag.Get("location") == "header" { - escaping = protocol.Base64Escape - } - m, err := protocol.DecodeJSONValue(header, escaping) - if err != nil { - return err - } - v.Set(reflect.ValueOf(m)) - default: - err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) - return err - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go deleted file mode 100644 index b1ae36487..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go +++ /dev/null @@ -1,79 +0,0 @@ -// Package restxml provides RESTful XML serialization of AWS -// requests and responses. -package restxml - -//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/rest-xml.json build_test.go -//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go - -import ( - "bytes" - "encoding/xml" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/query" - "github.com/aws/aws-sdk-go/private/protocol/rest" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" -) - -// BuildHandler is a named request handler for building restxml protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.restxml.Build", Fn: Build} - -// UnmarshalHandler is a named request handler for unmarshaling restxml protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restxml.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling restxml protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalMeta", Fn: UnmarshalMeta} - -// UnmarshalErrorHandler is a named request handler for unmarshaling restxml protocol request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalError", Fn: UnmarshalError} - -// Build builds a request payload for the REST XML protocol. -func Build(r *request.Request) { - rest.Build(r) - - if t := rest.PayloadType(r.Params); t == "structure" || t == "" { - var buf bytes.Buffer - err := xmlutil.BuildXML(r.Params, xml.NewEncoder(&buf)) - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, - "failed to encode rest XML request", err), - 0, - r.RequestID, - ) - return - } - r.SetBufferBody(buf.Bytes()) - } -} - -// Unmarshal unmarshals a payload response for the REST XML protocol. -func Unmarshal(r *request.Request) { - if t := rest.PayloadType(r.Data); t == "structure" || t == "" { - defer r.HTTPResponse.Body.Close() - decoder := xml.NewDecoder(r.HTTPResponse.Body) - err := xmlutil.UnmarshalXML(r.Data, decoder, "") - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, - "failed to decode REST XML response", err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - } else { - rest.Unmarshal(r) - } -} - -// UnmarshalMeta unmarshals response headers for the REST XML protocol. -func UnmarshalMeta(r *request.Request) { - rest.UnmarshalMeta(r) -} - -// UnmarshalError unmarshals a response error for the REST XML protocol. -func UnmarshalError(r *request.Request) { - query.UnmarshalError(r) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go deleted file mode 100644 index d2f6dae53..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go +++ /dev/null @@ -1,85 +0,0 @@ -package protocol - -import ( - "math" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/internal/sdkmath" -) - -// Names of time formats supported by the SDK -const ( - RFC822TimeFormatName = "rfc822" - ISO8601TimeFormatName = "iso8601" - UnixTimeFormatName = "unixTimestamp" -) - -// Time formats supported by the SDK -// Output time is intended to not contain decimals -const ( - // RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT - RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT" - - // This format is used for output time without seconds precision - RFC822OutputTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT" - - // RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z - ISO8601TimeFormat = "2006-01-02T15:04:05.999999999Z" - - // This format is used for output time without seconds precision - ISO8601OutputTimeFormat = "2006-01-02T15:04:05Z" -) - -// IsKnownTimestampFormat returns if the timestamp format name -// is know to the SDK's protocols. -func IsKnownTimestampFormat(name string) bool { - switch name { - case RFC822TimeFormatName: - fallthrough - case ISO8601TimeFormatName: - fallthrough - case UnixTimeFormatName: - return true - default: - return false - } -} - -// FormatTime returns a string value of the time. -func FormatTime(name string, t time.Time) string { - t = t.UTC() - - switch name { - case RFC822TimeFormatName: - return t.Format(RFC822OutputTimeFormat) - case ISO8601TimeFormatName: - return t.Format(ISO8601OutputTimeFormat) - case UnixTimeFormatName: - ms := t.UnixNano() / int64(time.Millisecond) - return strconv.FormatFloat(float64(ms)/1e3, 'f', -1, 64) - default: - panic("unknown timestamp format name, " + name) - } -} - -// ParseTime attempts to parse the time given the format. Returns -// the time if it was able to be parsed, and fails otherwise. -func ParseTime(formatName, value string) (time.Time, error) { - switch formatName { - case RFC822TimeFormatName: - return time.Parse(RFC822TimeFormat, value) - case ISO8601TimeFormatName: - return time.Parse(ISO8601TimeFormat, value) - case UnixTimeFormatName: - v, err := strconv.ParseFloat(value, 64) - _, dec := math.Modf(v) - dec = sdkmath.Round(dec*1e3) / 1e3 //Rounds 0.1229999 to 0.123 - if err != nil { - return time.Time{}, err - } - return time.Unix(int64(v), int64(dec*(1e9))), nil - default: - panic("unknown timestamp format name, " + formatName) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go deleted file mode 100644 index f614ef898..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go +++ /dev/null @@ -1,27 +0,0 @@ -package protocol - -import ( - "io" - "io/ioutil" - - "github.com/aws/aws-sdk-go/aws/request" -) - -// UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body -var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} - -// UnmarshalDiscardBody is a request handler to empty a response's body and closing it. -func UnmarshalDiscardBody(r *request.Request) { - if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { - return - } - - io.Copy(ioutil.Discard, r.HTTPResponse.Body) - r.HTTPResponse.Body.Close() -} - -// ResponseMetadata provides the SDK response metadata attributes. -type ResponseMetadata struct { - StatusCode int - RequestID string -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_error.go deleted file mode 100644 index cc857f136..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_error.go +++ /dev/null @@ -1,65 +0,0 @@ -package protocol - -import ( - "net/http" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// UnmarshalErrorHandler provides unmarshaling errors API response errors for -// both typed and untyped errors. -type UnmarshalErrorHandler struct { - unmarshaler ErrorUnmarshaler -} - -// ErrorUnmarshaler is an abstract interface for concrete implementations to -// unmarshal protocol specific response errors. -type ErrorUnmarshaler interface { - UnmarshalError(*http.Response, ResponseMetadata) (error, error) -} - -// NewUnmarshalErrorHandler returns an UnmarshalErrorHandler -// initialized for the set of exception names to the error unmarshalers -func NewUnmarshalErrorHandler(unmarshaler ErrorUnmarshaler) *UnmarshalErrorHandler { - return &UnmarshalErrorHandler{ - unmarshaler: unmarshaler, - } -} - -// UnmarshalErrorHandlerName is the name of the named handler. -const UnmarshalErrorHandlerName = "awssdk.protocol.UnmarshalError" - -// NamedHandler returns a NamedHandler for the unmarshaler using the set of -// errors the unmarshaler was initialized for. -func (u *UnmarshalErrorHandler) NamedHandler() request.NamedHandler { - return request.NamedHandler{ - Name: UnmarshalErrorHandlerName, - Fn: u.UnmarshalError, - } -} - -// UnmarshalError will attempt to unmarshal the API response's error message -// into either a generic SDK error type, or a typed error corresponding to the -// errors exception name. -func (u *UnmarshalErrorHandler) UnmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - - respMeta := ResponseMetadata{ - StatusCode: r.HTTPResponse.StatusCode, - RequestID: r.RequestID, - } - - v, err := u.unmarshaler.UnmarshalError(r.HTTPResponse, respMeta) - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, - "failed to unmarshal response error", err), - respMeta.StatusCode, - respMeta.RequestID, - ) - return - } - - r.Error = v -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go deleted file mode 100644 index 09ad95159..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go +++ /dev/null @@ -1,315 +0,0 @@ -// Package xmlutil provides XML serialization of AWS requests and responses. -package xmlutil - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/private/protocol" -) - -// BuildXML will serialize params into an xml.Encoder. Error will be returned -// if the serialization of any of the params or nested values fails. -func BuildXML(params interface{}, e *xml.Encoder) error { - return buildXML(params, e, false) -} - -func buildXML(params interface{}, e *xml.Encoder, sorted bool) error { - b := xmlBuilder{encoder: e, namespaces: map[string]string{}} - root := NewXMLElement(xml.Name{}) - if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { - return err - } - for _, c := range root.Children { - for _, v := range c { - return StructToXML(e, v, sorted) - } - } - return nil -} - -// Returns the reflection element of a value, if it is a pointer. -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} - -// A xmlBuilder serializes values from Go code to XML -type xmlBuilder struct { - encoder *xml.Encoder - namespaces map[string]string -} - -// buildValue generic XMLNode builder for any type. Will build value for their specific type -// struct, list, map, scalar. -// -// Also takes a "type" tag value to set what type a value should be converted to XMLNode as. If -// type is not provided reflect will be used to determine the value's type. -func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - value = elemOf(value) - if !value.IsValid() { // no need to handle zero values - return nil - } else if tag.Get("location") != "" { // don't handle non-body location values - return nil - } - - xml := tag.Get("xml") - if len(xml) != 0 { - name := strings.SplitAfterN(xml, ",", 2)[0] - if name == "-" { - return nil - } - } - - t := tag.Get("type") - if t == "" { - switch value.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := value.Type().FieldByName("_"); ok { - tag = tag + reflect.StructTag(" ") + field.Tag - } - return b.buildStruct(value, current, tag) - case "list": - return b.buildList(value, current, tag) - case "map": - return b.buildMap(value, current, tag) - default: - return b.buildScalar(value, current, tag) - } -} - -// buildStruct adds a struct and its fields to the current XMLNode. All fields and any nested -// types are converted to XMLNodes also. -func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if !value.IsValid() { - return nil - } - - // unwrap payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := value.Type().FieldByName(payload) - tag = field.Tag - value = elemOf(value.FieldByName(payload)) - - if !value.IsValid() { - return nil - } - } - - child := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) - - // there is an xmlNamespace associated with this struct - if prefix, uri := tag.Get("xmlPrefix"), tag.Get("xmlURI"); uri != "" { - ns := xml.Attr{ - Name: xml.Name{Local: "xmlns"}, - Value: uri, - } - if prefix != "" { - b.namespaces[prefix] = uri // register the namespace - ns.Name.Local = "xmlns:" + prefix - } - - child.Attr = append(child.Attr, ns) - } - - var payloadFields, nonPayloadFields int - - t := value.Type() - for i := 0; i < value.NumField(); i++ { - member := elemOf(value.Field(i)) - field := t.Field(i) - - if field.PkgPath != "" { - continue // ignore unexported fields - } - if field.Tag.Get("ignore") != "" { - continue - } - - mTag := field.Tag - if mTag.Get("location") != "" { // skip non-body members - nonPayloadFields++ - continue - } - payloadFields++ - - if protocol.CanSetIdempotencyToken(value.Field(i), field) { - token := protocol.GetIdempotencyToken() - member = reflect.ValueOf(token) - } - - memberName := mTag.Get("locationName") - if memberName == "" { - memberName = field.Name - mTag = reflect.StructTag(string(mTag) + ` locationName:"` + memberName + `"`) - } - if err := b.buildValue(member, child, mTag); err != nil { - return err - } - } - - // Only case where the child shape is not added is if the shape only contains - // non-payload fields, e.g headers/query. - if !(payloadFields == 0 && nonPayloadFields > 0) { - current.AddChild(child) - } - - return nil -} - -// buildList adds the value's list items to the current XMLNode as children nodes. All -// nested values in the list are converted to XMLNodes also. -func (b *xmlBuilder) buildList(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if value.IsNil() { // don't build omitted lists - return nil - } - - // check for unflattened list member - flattened := tag.Get("flattened") != "" - - xname := xml.Name{Local: tag.Get("locationName")} - if flattened { - for i := 0; i < value.Len(); i++ { - child := NewXMLElement(xname) - current.AddChild(child) - if err := b.buildValue(value.Index(i), child, ""); err != nil { - return err - } - } - } else { - list := NewXMLElement(xname) - current.AddChild(list) - - for i := 0; i < value.Len(); i++ { - iname := tag.Get("locationNameList") - if iname == "" { - iname = "member" - } - - child := NewXMLElement(xml.Name{Local: iname}) - list.AddChild(child) - if err := b.buildValue(value.Index(i), child, ""); err != nil { - return err - } - } - } - - return nil -} - -// buildMap adds the value's key/value pairs to the current XMLNode as children nodes. All -// nested values in the map are converted to XMLNodes also. -// -// Error will be returned if it is unable to build the map's values into XMLNodes -func (b *xmlBuilder) buildMap(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if value.IsNil() { // don't build omitted maps - return nil - } - - maproot := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) - current.AddChild(maproot) - current = maproot - - kname, vname := "key", "value" - if n := tag.Get("locationNameKey"); n != "" { - kname = n - } - if n := tag.Get("locationNameValue"); n != "" { - vname = n - } - - // sorting is not required for compliance, but it makes testing easier - keys := make([]string, value.Len()) - for i, k := range value.MapKeys() { - keys[i] = k.String() - } - sort.Strings(keys) - - for _, k := range keys { - v := value.MapIndex(reflect.ValueOf(k)) - - mapcur := current - if tag.Get("flattened") == "" { // add "entry" tag to non-flat maps - child := NewXMLElement(xml.Name{Local: "entry"}) - mapcur.AddChild(child) - mapcur = child - } - - kchild := NewXMLElement(xml.Name{Local: kname}) - kchild.Text = k - vchild := NewXMLElement(xml.Name{Local: vname}) - mapcur.AddChild(kchild) - mapcur.AddChild(vchild) - - if err := b.buildValue(v, vchild, ""); err != nil { - return err - } - } - - return nil -} - -// buildScalar will convert the value into a string and append it as a attribute or child -// of the current XMLNode. -// -// The value will be added as an attribute if tag contains a "xmlAttribute" attribute value. -// -// Error will be returned if the value type is unsupported. -func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - var str string - switch converted := value.Interface().(type) { - case string: - str = converted - case []byte: - if !value.IsNil() { - str = base64.StdEncoding.EncodeToString(converted) - } - case bool: - str = strconv.FormatBool(converted) - case int64: - str = strconv.FormatInt(converted, 10) - case int: - str = strconv.Itoa(converted) - case float64: - str = strconv.FormatFloat(converted, 'f', -1, 64) - case float32: - str = strconv.FormatFloat(float64(converted), 'f', -1, 32) - case time.Time: - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.ISO8601TimeFormatName - } - - str = protocol.FormatTime(format, converted) - default: - return fmt.Errorf("unsupported value for param %s: %v (%s)", - tag.Get("locationName"), value.Interface(), value.Type().Name()) - } - - xname := xml.Name{Local: tag.Get("locationName")} - if tag.Get("xmlAttribute") != "" { // put into current node's attribute list - attr := xml.Attr{Name: xname, Value: str} - current.Attr = append(current.Attr, attr) - } else { // regular text node - current.AddChild(&XMLNode{Name: xname, Text: str}) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go deleted file mode 100644 index c1a511851..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go +++ /dev/null @@ -1,32 +0,0 @@ -package xmlutil - -import ( - "encoding/xml" - "strings" -) - -type xmlAttrSlice []xml.Attr - -func (x xmlAttrSlice) Len() int { - return len(x) -} - -func (x xmlAttrSlice) Less(i, j int) bool { - spaceI, spaceJ := x[i].Name.Space, x[j].Name.Space - localI, localJ := x[i].Name.Local, x[j].Name.Local - valueI, valueJ := x[i].Value, x[j].Value - - spaceCmp := strings.Compare(spaceI, spaceJ) - localCmp := strings.Compare(localI, localJ) - valueCmp := strings.Compare(valueI, valueJ) - - if spaceCmp == -1 || (spaceCmp == 0 && (localCmp == -1 || (localCmp == 0 && valueCmp == -1))) { - return true - } - - return false -} - -func (x xmlAttrSlice) Swap(i, j int) { - x[i], x[j] = x[j], x[i] -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go deleted file mode 100644 index 107c053f8..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go +++ /dev/null @@ -1,299 +0,0 @@ -package xmlutil - -import ( - "bytes" - "encoding/base64" - "encoding/xml" - "fmt" - "io" - "reflect" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/private/protocol" -) - -// UnmarshalXMLError unmarshals the XML error from the stream into the value -// type specified. The value must be a pointer. If the message fails to -// unmarshal, the message content will be included in the returned error as a -// awserr.UnmarshalError. -func UnmarshalXMLError(v interface{}, stream io.Reader) error { - var errBuf bytes.Buffer - body := io.TeeReader(stream, &errBuf) - - err := xml.NewDecoder(body).Decode(v) - if err != nil && err != io.EOF { - return awserr.NewUnmarshalError(err, - "failed to unmarshal error message", errBuf.Bytes()) - } - - return nil -} - -// UnmarshalXML deserializes an xml.Decoder into the container v. V -// needs to match the shape of the XML expected to be decoded. -// If the shape doesn't match unmarshaling will fail. -func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error { - n, err := XMLToStruct(d, nil) - if err != nil { - return err - } - if n.Children != nil { - for _, root := range n.Children { - for _, c := range root { - if wrappedChild, ok := c.Children[wrapper]; ok { - c = wrappedChild[0] // pull out wrapped element - } - - err = parse(reflect.ValueOf(v), c, "") - if err != nil { - if err == io.EOF { - return nil - } - return err - } - } - } - return nil - } - return nil -} - -// parse deserializes any value from the XMLNode. The type tag is used to infer the type, or reflect -// will be used to determine the type from r. -func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - xml := tag.Get("xml") - if len(xml) != 0 { - name := strings.SplitAfterN(xml, ",", 2)[0] - if name == "-" { - return nil - } - } - - rtype := r.Type() - if rtype.Kind() == reflect.Ptr { - rtype = rtype.Elem() // check kind of actual element type - } - - t := tag.Get("type") - if t == "" { - switch rtype.Kind() { - case reflect.Struct: - // also it can't be a time object - if _, ok := r.Interface().(*time.Time); !ok { - t = "structure" - } - case reflect.Slice: - // also it can't be a byte slice - if _, ok := r.Interface().([]byte); !ok { - t = "list" - } - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := rtype.FieldByName("_"); ok { - tag = field.Tag - } - return parseStruct(r, node, tag) - case "list": - return parseList(r, node, tag) - case "map": - return parseMap(r, node, tag) - default: - return parseScalar(r, node, tag) - } -} - -// parseStruct deserializes a structure and its fields from an XMLNode. Any nested -// types in the structure will also be deserialized. -func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - if r.Kind() == reflect.Ptr { - if r.IsNil() { // create the structure if it's nil - s := reflect.New(r.Type().Elem()) - r.Set(s) - r = s - } - - r = r.Elem() - t = t.Elem() - } - - // unwrap any payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := t.FieldByName(payload) - return parseStruct(r.FieldByName(payload), node, field.Tag) - } - - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - if c := field.Name[0:1]; strings.ToLower(c) == c { - continue // ignore unexported fields - } - - // figure out what this field is called - name := field.Name - if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { - name = field.Tag.Get("locationNameList") - } else if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - - // try to find the field by name in elements - elems := node.Children[name] - - if elems == nil { // try to find the field in attributes - if val, ok := node.findElem(name); ok { - elems = []*XMLNode{{Text: val}} - } - } - - member := r.FieldByName(field.Name) - for _, elem := range elems { - err := parse(member, elem, field.Tag) - if err != nil { - return err - } - } - } - return nil -} - -// parseList deserializes a list of values from an XML node. Each list entry -// will also be deserialized. -func parseList(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - - if tag.Get("flattened") == "" { // look at all item entries - mname := "member" - if name := tag.Get("locationNameList"); name != "" { - mname = name - } - - if Children, ok := node.Children[mname]; ok { - if r.IsNil() { - r.Set(reflect.MakeSlice(t, len(Children), len(Children))) - } - - for i, c := range Children { - err := parse(r.Index(i), c, "") - if err != nil { - return err - } - } - } - } else { // flattened list means this is a single element - if r.IsNil() { - r.Set(reflect.MakeSlice(t, 0, 0)) - } - - childR := reflect.Zero(t.Elem()) - r.Set(reflect.Append(r, childR)) - err := parse(r.Index(r.Len()-1), node, "") - if err != nil { - return err - } - } - - return nil -} - -// parseMap deserializes a map from an XMLNode. The direct children of the XMLNode -// will also be deserialized as map entries. -func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - if r.IsNil() { - r.Set(reflect.MakeMap(r.Type())) - } - - if tag.Get("flattened") == "" { // look at all child entries - for _, entry := range node.Children["entry"] { - parseMapEntry(r, entry, tag) - } - } else { // this element is itself an entry - parseMapEntry(r, node, tag) - } - - return nil -} - -// parseMapEntry deserializes a map entry from a XML node. -func parseMapEntry(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - kname, vname := "key", "value" - if n := tag.Get("locationNameKey"); n != "" { - kname = n - } - if n := tag.Get("locationNameValue"); n != "" { - vname = n - } - - keys, ok := node.Children[kname] - values := node.Children[vname] - if ok { - for i, key := range keys { - keyR := reflect.ValueOf(key.Text) - value := values[i] - valueR := reflect.New(r.Type().Elem()).Elem() - - parse(valueR, value, "") - r.SetMapIndex(keyR, valueR) - } - } - return nil -} - -// parseScaller deserializes an XMLNode value into a concrete type based on the -// interface type of r. -// -// Error is returned if the deserialization fails due to invalid type conversion, -// or unsupported interface type. -func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - switch r.Interface().(type) { - case *string: - r.Set(reflect.ValueOf(&node.Text)) - return nil - case []byte: - b, err := base64.StdEncoding.DecodeString(node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(b)) - case *bool: - v, err := strconv.ParseBool(node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *int64: - v, err := strconv.ParseInt(node.Text, 10, 64) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *float64: - v, err := strconv.ParseFloat(node.Text, 64) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *time.Time: - format := tag.Get("timestampFormat") - if len(format) == 0 { - format = protocol.ISO8601TimeFormatName - } - - t, err := protocol.ParseTime(format, node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&t)) - default: - return fmt.Errorf("unsupported value: %v (%s)", r.Interface(), r.Type()) - } - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go deleted file mode 100644 index 42f71648e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go +++ /dev/null @@ -1,159 +0,0 @@ -package xmlutil - -import ( - "encoding/xml" - "fmt" - "io" - "sort" -) - -// A XMLNode contains the values to be encoded or decoded. -type XMLNode struct { - Name xml.Name `json:",omitempty"` - Children map[string][]*XMLNode `json:",omitempty"` - Text string `json:",omitempty"` - Attr []xml.Attr `json:",omitempty"` - - namespaces map[string]string - parent *XMLNode -} - -// NewXMLElement returns a pointer to a new XMLNode initialized to default values. -func NewXMLElement(name xml.Name) *XMLNode { - return &XMLNode{ - Name: name, - Children: map[string][]*XMLNode{}, - Attr: []xml.Attr{}, - } -} - -// AddChild adds child to the XMLNode. -func (n *XMLNode) AddChild(child *XMLNode) { - child.parent = n - if _, ok := n.Children[child.Name.Local]; !ok { - n.Children[child.Name.Local] = []*XMLNode{} - } - n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child) -} - -// XMLToStruct converts a xml.Decoder stream to XMLNode with nested values. -func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) { - out := &XMLNode{} - for { - tok, err := d.Token() - if err != nil { - if err == io.EOF { - break - } else { - return out, err - } - } - - if tok == nil { - break - } - - switch typed := tok.(type) { - case xml.CharData: - out.Text = string(typed.Copy()) - case xml.StartElement: - el := typed.Copy() - out.Attr = el.Attr - if out.Children == nil { - out.Children = map[string][]*XMLNode{} - } - - name := typed.Name.Local - slice := out.Children[name] - if slice == nil { - slice = []*XMLNode{} - } - node, e := XMLToStruct(d, &el) - out.findNamespaces() - if e != nil { - return out, e - } - node.Name = typed.Name - node.findNamespaces() - tempOut := *out - // Save into a temp variable, simply because out gets squashed during - // loop iterations - node.parent = &tempOut - slice = append(slice, node) - out.Children[name] = slice - case xml.EndElement: - if s != nil && s.Name.Local == typed.Name.Local { // matching end token - return out, nil - } - out = &XMLNode{} - } - } - return out, nil -} - -func (n *XMLNode) findNamespaces() { - ns := map[string]string{} - for _, a := range n.Attr { - if a.Name.Space == "xmlns" { - ns[a.Value] = a.Name.Local - } - } - - n.namespaces = ns -} - -func (n *XMLNode) findElem(name string) (string, bool) { - for node := n; node != nil; node = node.parent { - for _, a := range node.Attr { - namespace := a.Name.Space - if v, ok := node.namespaces[namespace]; ok { - namespace = v - } - if name == fmt.Sprintf("%s:%s", namespace, a.Name.Local) { - return a.Value, true - } - } - } - return "", false -} - -// StructToXML writes an XMLNode to a xml.Encoder as tokens. -func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { - // Sort Attributes - attrs := node.Attr - if sorted { - sortedAttrs := make([]xml.Attr, len(attrs)) - for _, k := range node.Attr { - sortedAttrs = append(sortedAttrs, k) - } - sort.Sort(xmlAttrSlice(sortedAttrs)) - attrs = sortedAttrs - } - - e.EncodeToken(xml.StartElement{Name: node.Name, Attr: attrs}) - - if node.Text != "" { - e.EncodeToken(xml.CharData([]byte(node.Text))) - } else if sorted { - sortedNames := []string{} - for k := range node.Children { - sortedNames = append(sortedNames, k) - } - sort.Strings(sortedNames) - - for _, k := range sortedNames { - for _, v := range node.Children[k] { - StructToXML(e, v, sorted) - } - } - } else { - for _, c := range node.Children { - for _, v := range c { - StructToXML(e, v, sorted) - } - } - } - - e.EncodeToken(xml.EndElement{Name: node.Name}) - return e.Flush() -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go deleted file mode 100644 index 228cd3cfe..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ /dev/null @@ -1,30737 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -import ( - "bytes" - "fmt" - "io" - "sync" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/checksum" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/eventstream" - "github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi" - "github.com/aws/aws-sdk-go/private/protocol/rest" - "github.com/aws/aws-sdk-go/private/protocol/restxml" - "github.com/aws/aws-sdk-go/service/s3/internal/arn" -) - -const opAbortMultipartUpload = "AbortMultipartUpload" - -// AbortMultipartUploadRequest generates a "aws/request.Request" representing the -// client's request for the AbortMultipartUpload operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AbortMultipartUpload for more information on using the AbortMultipartUpload -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AbortMultipartUploadRequest method. -// req, resp := client.AbortMultipartUploadRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUpload -func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req *request.Request, output *AbortMultipartUploadOutput) { - op := &request.Operation{ - Name: opAbortMultipartUpload, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &AbortMultipartUploadInput{} - } - - output = &AbortMultipartUploadOutput{} - req = c.newRequest(op, input, output) - return -} - -// AbortMultipartUpload API operation for Amazon Simple Storage Service. -// -// This operation aborts a multipart upload. After a multipart upload is aborted, -// no additional parts can be uploaded using that upload ID. The storage consumed -// by any previously uploaded parts will be freed. However, if any part uploads -// are currently in progress, those part uploads might or might not succeed. -// As a result, it might be necessary to abort a given multipart upload multiple -// times in order to completely free all storage consumed by all parts. -// -// To verify that all parts have been removed, so you don't get charged for -// the part storage, you should call the ListParts operation and ensure that -// the parts list is empty. -// -// For information about permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). -// -// The following operations are related to AbortMultipartUpload: -// -// * CreateMultipartUpload -// -// * UploadPart -// -// * CompleteMultipartUpload -// -// * ListParts -// -// * ListMultipartUploads -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation AbortMultipartUpload for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchUpload "NoSuchUpload" -// The specified multipart upload does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUpload -func (c *S3) AbortMultipartUpload(input *AbortMultipartUploadInput) (*AbortMultipartUploadOutput, error) { - req, out := c.AbortMultipartUploadRequest(input) - return out, req.Send() -} - -// AbortMultipartUploadWithContext is the same as AbortMultipartUpload with the addition of -// the ability to pass a context and additional request options. -// -// See AbortMultipartUpload for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) AbortMultipartUploadWithContext(ctx aws.Context, input *AbortMultipartUploadInput, opts ...request.Option) (*AbortMultipartUploadOutput, error) { - req, out := c.AbortMultipartUploadRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCompleteMultipartUpload = "CompleteMultipartUpload" - -// CompleteMultipartUploadRequest generates a "aws/request.Request" representing the -// client's request for the CompleteMultipartUpload operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CompleteMultipartUpload for more information on using the CompleteMultipartUpload -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CompleteMultipartUploadRequest method. -// req, resp := client.CompleteMultipartUploadRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUpload -func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) (req *request.Request, output *CompleteMultipartUploadOutput) { - op := &request.Operation{ - Name: opCompleteMultipartUpload, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &CompleteMultipartUploadInput{} - } - - output = &CompleteMultipartUploadOutput{} - req = c.newRequest(op, input, output) - return -} - -// CompleteMultipartUpload API operation for Amazon Simple Storage Service. -// -// Completes a multipart upload by assembling previously uploaded parts. -// -// You first initiate the multipart upload and then upload all parts using the -// UploadPart operation. After successfully uploading all relevant parts of -// an upload, you call this operation to complete the upload. Upon receiving -// this request, Amazon S3 concatenates all the parts in ascending order by -// part number to create a new object. In the Complete Multipart Upload request, -// you must provide the parts list. You must ensure that the parts list is complete. -// This operation concatenates the parts that you provide in the list. For each -// part in the list, you must provide the part number and the ETag value, returned -// after that part was uploaded. -// -// Processing of a Complete Multipart Upload request could take several minutes -// to complete. After Amazon S3 begins processing the request, it sends an HTTP -// response header that specifies a 200 OK response. While processing is in -// progress, Amazon S3 periodically sends white space characters to keep the -// connection from timing out. Because a request could fail after the initial -// 200 OK response has been sent, it is important that you check the response -// body to determine whether the request succeeded. -// -// Note that if CompleteMultipartUpload fails, applications should be prepared -// to retry the failed requests. For more information, see Amazon S3 Error Best -// Practices (https://docs.aws.amazon.com/AmazonS3/latest/dev/ErrorBestPractices.html). -// -// For more information about multipart uploads, see Uploading Objects Using -// Multipart Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html). -// -// For information about permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). -// -// GetBucketLifecycle has the following special errors: -// -// * Error code: EntityTooSmall Description: Your proposed upload is smaller -// than the minimum allowed object size. Each part must be at least 5 MB -// in size, except the last part. 400 Bad Request -// -// * Error code: InvalidPart Description: One or more of the specified parts -// could not be found. The part might not have been uploaded, or the specified -// entity tag might not have matched the part's entity tag. 400 Bad Request -// -// * Error code: InvalidPartOrder Description: The list of parts was not -// in ascending order. The parts list must be specified in order by part -// number. 400 Bad Request -// -// * Error code: NoSuchUpload Description: The specified multipart upload -// does not exist. The upload ID might be invalid, or the multipart upload -// might have been aborted or completed. 404 Not Found -// -// The following operations are related to CompleteMultipartUpload: -// -// * CreateMultipartUpload -// -// * UploadPart -// -// * AbortMultipartUpload -// -// * ListParts -// -// * ListMultipartUploads -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation CompleteMultipartUpload for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUpload -func (c *S3) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (*CompleteMultipartUploadOutput, error) { - req, out := c.CompleteMultipartUploadRequest(input) - return out, req.Send() -} - -// CompleteMultipartUploadWithContext is the same as CompleteMultipartUpload with the addition of -// the ability to pass a context and additional request options. -// -// See CompleteMultipartUpload for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) CompleteMultipartUploadWithContext(ctx aws.Context, input *CompleteMultipartUploadInput, opts ...request.Option) (*CompleteMultipartUploadOutput, error) { - req, out := c.CompleteMultipartUploadRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCopyObject = "CopyObject" - -// CopyObjectRequest generates a "aws/request.Request" representing the -// client's request for the CopyObject operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CopyObject for more information on using the CopyObject -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CopyObjectRequest method. -// req, resp := client.CopyObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject -func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, output *CopyObjectOutput) { - op := &request.Operation{ - Name: opCopyObject, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &CopyObjectInput{} - } - - output = &CopyObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// CopyObject API operation for Amazon Simple Storage Service. -// -// Creates a copy of an object that is already stored in Amazon S3. -// -// You can store individual objects of up to 5 TB in Amazon S3. You create a -// copy of your object up to 5 GB in size in a single atomic operation using -// this API. However, to copy an object greater than 5 GB, you must use the -// multipart upload Upload Part - Copy API. For more information, see Copy Object -// Using the REST Multipart Upload API (https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingRESTMPUapi.html). -// -// All copy requests must be authenticated. Additionally, you must have read -// access to the source object and write access to the destination bucket. For -// more information, see REST Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html). -// Both the Region that you want to copy the object from and the Region that -// you want to copy the object to must be enabled for your account. -// -// A copy request might return an error when Amazon S3 receives the copy request -// or while Amazon S3 is copying the files. If the error occurs before the copy -// operation starts, you receive a standard Amazon S3 error. If the error occurs -// during the copy operation, the error response is embedded in the 200 OK response. -// This means that a 200 OK response can contain either a success or an error. -// Design your application to parse the contents of the response and handle -// it appropriately. -// -// If the copy is successful, you receive a response with information about -// the copied object. -// -// If the request is an HTTP 1.1 request, the response is chunk encoded. If -// it were not, it would not contain the content-length, and you would need -// to read the entire body. -// -// The copy request charge is based on the storage class and Region that you -// specify for the destination object. For pricing information, see Amazon S3 -// pricing (https://aws.amazon.com/s3/pricing/). -// -// Amazon S3 transfer acceleration does not support cross-Region copies. If -// you request a cross-Region copy using a transfer acceleration endpoint, you -// get a 400 Bad Request error. For more information, see Transfer Acceleration -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html). -// -// Metadata -// -// When copying an object, you can preserve all metadata (default) or specify -// new metadata. However, the ACL is not preserved and is set to private for -// the user making the request. To override the default ACL setting, specify -// a new ACL when generating a copy request. For more information, see Using -// ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html). -// -// To specify whether you want the object metadata copied from the source object -// or replaced with metadata provided in the request, you can optionally add -// the x-amz-metadata-directive header. When you grant permissions, you can -// use the s3:x-amz-metadata-directive condition key to enforce certain metadata -// behavior when objects are uploaded. For more information, see Specifying -// Conditions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/amazon-s3-policy-keys.html) -// in the Amazon S3 Developer Guide. For a complete list of Amazon S3-specific -// condition keys, see Actions, Resources, and Condition Keys for Amazon S3 -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html). -// -// x-amz-copy-source-if Headers -// -// To only copy an object under certain conditions, such as whether the Etag -// matches or whether the object was modified before or after a specified date, -// use the following request parameters: -// -// * x-amz-copy-source-if-match -// -// * x-amz-copy-source-if-none-match -// -// * x-amz-copy-source-if-unmodified-since -// -// * x-amz-copy-source-if-modified-since -// -// If both the x-amz-copy-source-if-match and x-amz-copy-source-if-unmodified-since -// headers are present in the request and evaluate as follows, Amazon S3 returns -// 200 OK and copies the data: -// -// * x-amz-copy-source-if-match condition evaluates to true -// -// * x-amz-copy-source-if-unmodified-since condition evaluates to false -// -// If both the x-amz-copy-source-if-none-match and x-amz-copy-source-if-modified-since -// headers are present in the request and evaluate as follows, Amazon S3 returns -// the 412 Precondition Failed response code: -// -// * x-amz-copy-source-if-none-match condition evaluates to false -// -// * x-amz-copy-source-if-modified-since condition evaluates to true -// -// All headers with the x-amz- prefix, including x-amz-copy-source, must be -// signed. -// -// Encryption -// -// The source object that you are copying can be encrypted or unencrypted. The -// source object can be encrypted with server-side encryption using AWS managed -// encryption keys (SSE-S3 or SSE-KMS) or by using a customer-provided encryption -// key. With server-side encryption, Amazon S3 encrypts your data as it writes -// it to disks in its data centers and decrypts the data when you access it. -// -// You can optionally use the appropriate encryption-related headers to request -// server-side encryption for the target object. You have the option to provide -// your own encryption key or use SSE-S3 or SSE-KMS, regardless of the form -// of server-side encryption that was used to encrypt the source object. You -// can even request encryption if the source object was not encrypted. For more -// information about server-side encryption, see Using Server-Side Encryption -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html). -// -// Access Control List (ACL)-Specific Request Headers -// -// When copying an object, you can optionally use headers to grant ACL-based -// permissions. By default, all objects are private. Only the owner has full -// access control. When adding a new object, you can grant permissions to individual -// AWS accounts or to predefined groups defined by Amazon S3. These permissions -// are then added to the ACL on the object. For more information, see Access -// Control List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) -// and Managing ACLs Using the REST API (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-using-rest-api.html). -// -// Storage Class Options -// -// You can use the CopyObject operation to change the storage class of an object -// that is already stored in Amazon S3 using the StorageClass parameter. For -// more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) -// in the Amazon S3 Service Developer Guide. -// -// Versioning -// -// By default, x-amz-copy-source identifies the current version of an object -// to copy. If the current version is a delete marker, Amazon S3 behaves as -// if the object was deleted. To copy a different version, use the versionId -// subresource. -// -// If you enable versioning on the target bucket, Amazon S3 generates a unique -// version ID for the object being copied. This version ID is different from -// the version ID of the source object. Amazon S3 returns the version ID of -// the copied object in the x-amz-version-id response header in the response. -// -// If you do not enable versioning or suspend it on the target bucket, the version -// ID that Amazon S3 generates is always null. -// -// If the source object's storage class is GLACIER, you must restore a copy -// of this object before you can use it as a source object for the copy operation. -// For more information, see . -// -// The following operations are related to CopyObject: -// -// * PutObject -// -// * GetObject -// -// For more information, see Copying Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjectsExamples.html). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation CopyObject for usage and error information. -// -// Returned Error Codes: -// * ErrCodeObjectNotInActiveTierError "ObjectNotInActiveTierError" -// The source object of the COPY operation is not in the active tier and is -// only stored in Amazon S3 Glacier. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject -func (c *S3) CopyObject(input *CopyObjectInput) (*CopyObjectOutput, error) { - req, out := c.CopyObjectRequest(input) - return out, req.Send() -} - -// CopyObjectWithContext is the same as CopyObject with the addition of -// the ability to pass a context and additional request options. -// -// See CopyObject for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) CopyObjectWithContext(ctx aws.Context, input *CopyObjectInput, opts ...request.Option) (*CopyObjectOutput, error) { - req, out := c.CopyObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateBucket = "CreateBucket" - -// CreateBucketRequest generates a "aws/request.Request" representing the -// client's request for the CreateBucket operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateBucket for more information on using the CreateBucket -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CreateBucketRequest method. -// req, resp := client.CreateBucketRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucket -func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *request.Request, output *CreateBucketOutput) { - op := &request.Operation{ - Name: opCreateBucket, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}", - } - - if input == nil { - input = &CreateBucketInput{} - } - - output = &CreateBucketOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateBucket API operation for Amazon Simple Storage Service. -// -// Creates a new bucket. To create a bucket, you must register with Amazon S3 -// and have a valid AWS Access Key ID to authenticate requests. Anonymous requests -// are never allowed to create buckets. By creating the bucket, you become the -// bucket owner. -// -// Not every string is an acceptable bucket name. For information on bucket -// naming restrictions, see Working with Amazon S3 Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html). -// -// By default, the bucket is created in the US East (N. Virginia) Region. You -// can optionally specify a Region in the request body. You might choose a Region -// to optimize latency, minimize costs, or address regulatory requirements. -// For example, if you reside in Europe, you will probably find it advantageous -// to create buckets in the Europe (Ireland) Region. For more information, see -// How to Select a Region for Your Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro). -// -// If you send your create bucket request to the s3.amazonaws.com endpoint, -// the request goes to the us-east-1 Region. Accordingly, the signature calculations -// in Signature Version 4 must use us-east-1 as the Region, even if the location -// constraint in the request specifies another Region where the bucket is to -// be created. If you create a bucket in a Region other than US East (N. Virginia), -// your application must be able to handle 307 redirect. For more information, -// see Virtual Hosting of Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html). -// -// When creating a bucket using this operation, you can optionally specify the -// accounts or groups that should be granted specific permissions on the bucket. -// There are two ways to grant the appropriate permissions using the request -// headers. -// -// * Specify a canned ACL using the x-amz-acl request header. Amazon S3 supports -// a set of predefined ACLs, known as canned ACLs. Each canned ACL has a -// predefined set of grantees and permissions. For more information, see -// Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). -// -// * Specify access permissions explicitly using the x-amz-grant-read, x-amz-grant-write, -// x-amz-grant-read-acp, x-amz-grant-write-acp, and x-amz-grant-full-control -// headers. These headers map to the set of permissions Amazon S3 supports -// in an ACL. For more information, see Access Control List (ACL) Overview -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html). You -// specify each grantee as a type=value pair, where the type is one of the -// following: id – if the value specified is the canonical user ID of an -// AWS account uri – if you are granting permissions to a predefined group -// emailAddress – if the value specified is the email address of an AWS -// account Using email addresses to specify a grantee is only supported in -// the following AWS Regions: US East (N. Virginia) US West (N. California) -// US West (Oregon) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific -// (Tokyo) Europe (Ireland) South America (São Paulo) For a list of all -// the Amazon S3 supported Regions and endpoints, see Regions and Endpoints -// (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in -// the AWS General Reference. For example, the following x-amz-grant-read -// header grants the AWS accounts identified by account IDs permissions to -// read object data and its metadata: x-amz-grant-read: id="11112222333", -// id="444455556666" -// -// You can use either a canned ACL or specify access permissions explicitly. -// You cannot do both. -// -// The following operations are related to CreateBucket: -// -// * PutObject -// -// * DeleteBucket -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation CreateBucket for usage and error information. -// -// Returned Error Codes: -// * ErrCodeBucketAlreadyExists "BucketAlreadyExists" -// The requested bucket name is not available. The bucket namespace is shared -// by all users of the system. Please select a different name and try again. -// -// * ErrCodeBucketAlreadyOwnedByYou "BucketAlreadyOwnedByYou" -// The bucket you tried to create already exists, and you own it. Amazon S3 -// returns this error in all AWS Regions except in the North Virginia Region. -// For legacy compatibility, if you re-create an existing bucket that you already -// own in the North Virginia Region, Amazon S3 returns 200 OK and resets the -// bucket access control lists (ACLs). -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucket -func (c *S3) CreateBucket(input *CreateBucketInput) (*CreateBucketOutput, error) { - req, out := c.CreateBucketRequest(input) - return out, req.Send() -} - -// CreateBucketWithContext is the same as CreateBucket with the addition of -// the ability to pass a context and additional request options. -// -// See CreateBucket for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) CreateBucketWithContext(ctx aws.Context, input *CreateBucketInput, opts ...request.Option) (*CreateBucketOutput, error) { - req, out := c.CreateBucketRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateMultipartUpload = "CreateMultipartUpload" - -// CreateMultipartUploadRequest generates a "aws/request.Request" representing the -// client's request for the CreateMultipartUpload operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See CreateMultipartUpload for more information on using the CreateMultipartUpload -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the CreateMultipartUploadRequest method. -// req, resp := client.CreateMultipartUploadRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUpload -func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (req *request.Request, output *CreateMultipartUploadOutput) { - op := &request.Operation{ - Name: opCreateMultipartUpload, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?uploads", - } - - if input == nil { - input = &CreateMultipartUploadInput{} - } - - output = &CreateMultipartUploadOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateMultipartUpload API operation for Amazon Simple Storage Service. -// -// This operation initiates a multipart upload and returns an upload ID. This -// upload ID is used to associate all of the parts in the specific multipart -// upload. You specify this upload ID in each of your subsequent upload part -// requests (see UploadPart). You also include this upload ID in the final request -// to either complete or abort the multipart upload request. -// -// For more information about multipart uploads, see Multipart Upload Overview -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html). -// -// If you have configured a lifecycle rule to abort incomplete multipart uploads, -// the upload must complete within the number of days specified in the bucket -// lifecycle configuration. Otherwise, the incomplete multipart upload becomes -// eligible for an abort operation and Amazon S3 aborts the multipart upload. -// For more information, see Aborting Incomplete Multipart Uploads Using a Bucket -// Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config). -// -// For information about the permissions required to use the multipart upload -// API, see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). -// -// For request signing, multipart upload is just a series of regular requests. -// You initiate a multipart upload, send one or more requests to upload parts, -// and then complete the multipart upload process. You sign each request individually. -// There is nothing special about signing multipart upload requests. For more -// information about signing, see Authenticating Requests (AWS Signature Version -// 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html). -// -// After you initiate a multipart upload and upload one or more parts, to stop -// being charged for storing the uploaded parts, you must either complete or -// abort the multipart upload. Amazon S3 frees up the space used to store the -// parts and stop charging you for storing them only after you either complete -// or abort a multipart upload. -// -// You can optionally request server-side encryption. For server-side encryption, -// Amazon S3 encrypts your data as it writes it to disks in its data centers -// and decrypts it when you access it. You can provide your own encryption key, -// or use AWS Key Management Service (AWS KMS) customer master keys (CMKs) or -// Amazon S3-managed encryption keys. If you choose to provide your own encryption -// key, the request headers you provide in UploadPart) and UploadPartCopy) requests -// must match the headers you used in the request to initiate the upload by -// using CreateMultipartUpload. -// -// To perform a multipart upload with encryption using an AWS KMS CMK, the requester -// must have permission to the kms:Encrypt, kms:Decrypt, kms:ReEncrypt*, kms:GenerateDataKey*, -// and kms:DescribeKey actions on the key. These permissions are required because -// Amazon S3 must decrypt and read data from the encrypted file parts before -// it completes the multipart upload. -// -// If your AWS Identity and Access Management (IAM) user or role is in the same -// AWS account as the AWS KMS CMK, then you must have these permissions on the -// key policy. If your IAM user or role belongs to a different account than -// the key, then you must have the permissions on both the key policy and your -// IAM user or role. -// -// For more information, see Protecting Data Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html). -// -// Access Permissions -// -// When copying an object, you can optionally specify the accounts or groups -// that should be granted specific permissions on the new object. There are -// two ways to grant the permissions using the request headers: -// -// * Specify a canned ACL with the x-amz-acl request header. For more information, -// see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). -// -// * Specify access permissions explicitly with the x-amz-grant-read, x-amz-grant-read-acp, -// x-amz-grant-write-acp, and x-amz-grant-full-control headers. These parameters -// map to the set of permissions that Amazon S3 supports in an ACL. For more -// information, see Access Control List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html). -// -// You can use either a canned ACL or specify access permissions explicitly. -// You cannot do both. -// -// Server-Side- Encryption-Specific Request Headers -// -// You can optionally tell Amazon S3 to encrypt data at rest using server-side -// encryption. Server-side encryption is for data encryption at rest. Amazon -// S3 encrypts your data as it writes it to disks in its data centers and decrypts -// it when you access it. The option you use depends on whether you want to -// use AWS managed encryption keys or provide your own encryption key. -// -// * Use encryption keys managed by Amazon S3 or customer master keys (CMKs) -// stored in AWS Key Management Service (AWS KMS) – If you want AWS to -// manage the keys used to encrypt data, specify the following headers in -// the request. x-amz-server-side​-encryption x-amz-server-side-encryption-aws-kms-key-id -// x-amz-server-side-encryption-context If you specify x-amz-server-side-encryption:aws:kms, -// but don't provide x-amz-server-side-encryption-aws-kms-key-id, Amazon -// S3 uses the AWS managed CMK in AWS KMS to protect the data. All GET and -// PUT requests for an object protected by AWS KMS fail if you don't make -// them with SSL or by using SigV4. For more information about server-side -// encryption with CMKs stored in AWS KMS (SSE-KMS), see Protecting Data -// Using Server-Side Encryption with CMKs stored in AWS KMS (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html). -// -// * Use customer-provided encryption keys – If you want to manage your -// own encryption keys, provide all the following headers in the request. -// x-amz-server-side​-encryption​-customer-algorithm x-amz-server-side​-encryption​-customer-key -// x-amz-server-side​-encryption​-customer-key-MD5 For more information -// about server-side encryption with CMKs stored in AWS KMS (SSE-KMS), see -// Protecting Data Using Server-Side Encryption with CMKs stored in AWS KMS -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html). -// -// Access-Control-List (ACL)-Specific Request Headers -// -// You also can use the following access control–related headers with this -// operation. By default, all objects are private. Only the owner has full access -// control. When adding a new object, you can grant permissions to individual -// AWS accounts or to predefined groups defined by Amazon S3. These permissions -// are then added to the access control list (ACL) on the object. For more information, -// see Using ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html). -// With this operation, you can grant access permissions using one of the following -// two methods: -// -// * Specify a canned ACL (x-amz-acl) — Amazon S3 supports a set of predefined -// ACLs, known as canned ACLs. Each canned ACL has a predefined set of grantees -// and permissions. For more information, see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). -// -// * Specify access permissions explicitly — To explicitly grant access -// permissions to specific AWS accounts or groups, use the following headers. -// Each header maps to specific permissions that Amazon S3 supports in an -// ACL. For more information, see Access Control List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html). -// In the header, you specify a list of grantees who get the specific permission. -// To grant permissions explicitly, use: x-amz-grant-read x-amz-grant-write -// x-amz-grant-read-acp x-amz-grant-write-acp x-amz-grant-full-control You -// specify each grantee as a type=value pair, where the type is one of the -// following: id – if the value specified is the canonical user ID of an -// AWS account uri – if you are granting permissions to a predefined group -// emailAddress – if the value specified is the email address of an AWS -// account Using email addresses to specify a grantee is only supported in -// the following AWS Regions: US East (N. Virginia) US West (N. California) -// US West (Oregon) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific -// (Tokyo) Europe (Ireland) South America (São Paulo) For a list of all -// the Amazon S3 supported Regions and endpoints, see Regions and Endpoints -// (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in -// the AWS General Reference. For example, the following x-amz-grant-read -// header grants the AWS accounts identified by account IDs permissions to -// read object data and its metadata: x-amz-grant-read: id="11112222333", -// id="444455556666" -// -// The following operations are related to CreateMultipartUpload: -// -// * UploadPart -// -// * CompleteMultipartUpload -// -// * AbortMultipartUpload -// -// * ListParts -// -// * ListMultipartUploads -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation CreateMultipartUpload for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUpload -func (c *S3) CreateMultipartUpload(input *CreateMultipartUploadInput) (*CreateMultipartUploadOutput, error) { - req, out := c.CreateMultipartUploadRequest(input) - return out, req.Send() -} - -// CreateMultipartUploadWithContext is the same as CreateMultipartUpload with the addition of -// the ability to pass a context and additional request options. -// -// See CreateMultipartUpload for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) CreateMultipartUploadWithContext(ctx aws.Context, input *CreateMultipartUploadInput, opts ...request.Option) (*CreateMultipartUploadOutput, error) { - req, out := c.CreateMultipartUploadRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucket = "DeleteBucket" - -// DeleteBucketRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucket operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucket for more information on using the DeleteBucket -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketRequest method. -// req, resp := client.DeleteBucketRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket -func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) (req *request.Request, output *DeleteBucketOutput) { - op := &request.Operation{ - Name: opDeleteBucket, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}", - } - - if input == nil { - input = &DeleteBucketInput{} - } - - output = &DeleteBucketOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucket API operation for Amazon Simple Storage Service. -// -// Deletes the bucket. All objects (including all object versions and delete -// markers) in the bucket must be deleted before the bucket itself can be deleted. -// -// Related Resources -// -// * -// -// * -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucket for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket -func (c *S3) DeleteBucket(input *DeleteBucketInput) (*DeleteBucketOutput, error) { - req, out := c.DeleteBucketRequest(input) - return out, req.Send() -} - -// DeleteBucketWithContext is the same as DeleteBucket with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucket for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketWithContext(ctx aws.Context, input *DeleteBucketInput, opts ...request.Option) (*DeleteBucketOutput, error) { - req, out := c.DeleteBucketRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketAnalyticsConfiguration = "DeleteBucketAnalyticsConfiguration" - -// DeleteBucketAnalyticsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketAnalyticsConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketAnalyticsConfiguration for more information on using the DeleteBucketAnalyticsConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketAnalyticsConfigurationRequest method. -// req, resp := client.DeleteBucketAnalyticsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfiguration -func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyticsConfigurationInput) (req *request.Request, output *DeleteBucketAnalyticsConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteBucketAnalyticsConfiguration, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &DeleteBucketAnalyticsConfigurationInput{} - } - - output = &DeleteBucketAnalyticsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. -// -// Deletes an analytics configuration for the bucket (specified by the analytics -// configuration ID). -// -// To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about the Amazon S3 analytics feature, see Amazon S3 Analytics -// – Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html). -// -// The following operations are related to DeleteBucketAnalyticsConfiguration: -// -// * -// -// * -// -// * -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketAnalyticsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfiguration -func (c *S3) DeleteBucketAnalyticsConfiguration(input *DeleteBucketAnalyticsConfigurationInput) (*DeleteBucketAnalyticsConfigurationOutput, error) { - req, out := c.DeleteBucketAnalyticsConfigurationRequest(input) - return out, req.Send() -} - -// DeleteBucketAnalyticsConfigurationWithContext is the same as DeleteBucketAnalyticsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketAnalyticsConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *DeleteBucketAnalyticsConfigurationInput, opts ...request.Option) (*DeleteBucketAnalyticsConfigurationOutput, error) { - req, out := c.DeleteBucketAnalyticsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketCors = "DeleteBucketCors" - -// DeleteBucketCorsRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketCors operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketCors for more information on using the DeleteBucketCors -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketCorsRequest method. -// req, resp := client.DeleteBucketCorsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCors -func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) (req *request.Request, output *DeleteBucketCorsOutput) { - op := &request.Operation{ - Name: opDeleteBucketCors, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?cors", - } - - if input == nil { - input = &DeleteBucketCorsInput{} - } - - output = &DeleteBucketCorsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketCors API operation for Amazon Simple Storage Service. -// -// Deletes the cors configuration information set for the bucket. -// -// To use this operation, you must have permission to perform the s3:PutBucketCORS -// action. The bucket owner has this permission by default and can grant this -// permission to others. -// -// For information about cors, see Enabling Cross-Origin Resource Sharing (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Related Resources: -// -// * -// -// * RESTOPTIONSobject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketCors for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCors -func (c *S3) DeleteBucketCors(input *DeleteBucketCorsInput) (*DeleteBucketCorsOutput, error) { - req, out := c.DeleteBucketCorsRequest(input) - return out, req.Send() -} - -// DeleteBucketCorsWithContext is the same as DeleteBucketCors with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketCors for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketCorsWithContext(ctx aws.Context, input *DeleteBucketCorsInput, opts ...request.Option) (*DeleteBucketCorsOutput, error) { - req, out := c.DeleteBucketCorsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketEncryption = "DeleteBucketEncryption" - -// DeleteBucketEncryptionRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketEncryption operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketEncryption for more information on using the DeleteBucketEncryption -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketEncryptionRequest method. -// req, resp := client.DeleteBucketEncryptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryption -func (c *S3) DeleteBucketEncryptionRequest(input *DeleteBucketEncryptionInput) (req *request.Request, output *DeleteBucketEncryptionOutput) { - op := &request.Operation{ - Name: opDeleteBucketEncryption, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?encryption", - } - - if input == nil { - input = &DeleteBucketEncryptionInput{} - } - - output = &DeleteBucketEncryptionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketEncryption API operation for Amazon Simple Storage Service. -// -// This implementation of the DELETE operation removes default encryption from -// the bucket. For information about the Amazon S3 default encryption feature, -// see Amazon S3 Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// To use this operation, you must have permissions to perform the s3:PutEncryptionConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Related Resources -// -// * PutBucketEncryption -// -// * GetBucketEncryption -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketEncryption for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryption -func (c *S3) DeleteBucketEncryption(input *DeleteBucketEncryptionInput) (*DeleteBucketEncryptionOutput, error) { - req, out := c.DeleteBucketEncryptionRequest(input) - return out, req.Send() -} - -// DeleteBucketEncryptionWithContext is the same as DeleteBucketEncryption with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketEncryption for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketEncryptionWithContext(ctx aws.Context, input *DeleteBucketEncryptionInput, opts ...request.Option) (*DeleteBucketEncryptionOutput, error) { - req, out := c.DeleteBucketEncryptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketInventoryConfiguration = "DeleteBucketInventoryConfiguration" - -// DeleteBucketInventoryConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketInventoryConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketInventoryConfiguration for more information on using the DeleteBucketInventoryConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketInventoryConfigurationRequest method. -// req, resp := client.DeleteBucketInventoryConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfiguration -func (c *S3) DeleteBucketInventoryConfigurationRequest(input *DeleteBucketInventoryConfigurationInput) (req *request.Request, output *DeleteBucketInventoryConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteBucketInventoryConfiguration, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &DeleteBucketInventoryConfigurationInput{} - } - - output = &DeleteBucketInventoryConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketInventoryConfiguration API operation for Amazon Simple Storage Service. -// -// Deletes an inventory configuration (identified by the inventory ID) from -// the bucket. -// -// To use this operation, you must have permissions to perform the s3:PutInventoryConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about the Amazon S3 inventory feature, see Amazon S3 Inventory -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html). -// -// Operations related to DeleteBucketInventoryConfiguration include: -// -// * GetBucketInventoryConfiguration -// -// * PutBucketInventoryConfiguration -// -// * ListBucketInventoryConfigurations -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketInventoryConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfiguration -func (c *S3) DeleteBucketInventoryConfiguration(input *DeleteBucketInventoryConfigurationInput) (*DeleteBucketInventoryConfigurationOutput, error) { - req, out := c.DeleteBucketInventoryConfigurationRequest(input) - return out, req.Send() -} - -// DeleteBucketInventoryConfigurationWithContext is the same as DeleteBucketInventoryConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketInventoryConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketInventoryConfigurationWithContext(ctx aws.Context, input *DeleteBucketInventoryConfigurationInput, opts ...request.Option) (*DeleteBucketInventoryConfigurationOutput, error) { - req, out := c.DeleteBucketInventoryConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketLifecycle = "DeleteBucketLifecycle" - -// DeleteBucketLifecycleRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketLifecycle operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketLifecycle for more information on using the DeleteBucketLifecycle -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketLifecycleRequest method. -// req, resp := client.DeleteBucketLifecycleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycle -func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) (req *request.Request, output *DeleteBucketLifecycleOutput) { - op := &request.Operation{ - Name: opDeleteBucketLifecycle, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &DeleteBucketLifecycleInput{} - } - - output = &DeleteBucketLifecycleOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketLifecycle API operation for Amazon Simple Storage Service. -// -// Deletes the lifecycle configuration from the specified bucket. Amazon S3 -// removes all the lifecycle configuration rules in the lifecycle subresource -// associated with the bucket. Your objects never expire, and Amazon S3 no longer -// automatically deletes any objects on the basis of rules contained in the -// deleted lifecycle configuration. -// -// To use this operation, you must have permission to perform the s3:PutLifecycleConfiguration -// action. By default, the bucket owner has this permission and the bucket owner -// can grant this permission to others. -// -// There is usually some time lag before lifecycle configuration deletion is -// fully propagated to all the Amazon S3 systems. -// -// For more information about the object expiration, see Elements to Describe -// Lifecycle Actions (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#intro-lifecycle-rules-actions). -// -// Related actions include: -// -// * PutBucketLifecycleConfiguration -// -// * GetBucketLifecycleConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketLifecycle for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycle -func (c *S3) DeleteBucketLifecycle(input *DeleteBucketLifecycleInput) (*DeleteBucketLifecycleOutput, error) { - req, out := c.DeleteBucketLifecycleRequest(input) - return out, req.Send() -} - -// DeleteBucketLifecycleWithContext is the same as DeleteBucketLifecycle with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketLifecycle for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketLifecycleWithContext(ctx aws.Context, input *DeleteBucketLifecycleInput, opts ...request.Option) (*DeleteBucketLifecycleOutput, error) { - req, out := c.DeleteBucketLifecycleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketMetricsConfiguration = "DeleteBucketMetricsConfiguration" - -// DeleteBucketMetricsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketMetricsConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketMetricsConfiguration for more information on using the DeleteBucketMetricsConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketMetricsConfigurationRequest method. -// req, resp := client.DeleteBucketMetricsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfiguration -func (c *S3) DeleteBucketMetricsConfigurationRequest(input *DeleteBucketMetricsConfigurationInput) (req *request.Request, output *DeleteBucketMetricsConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteBucketMetricsConfiguration, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &DeleteBucketMetricsConfigurationInput{} - } - - output = &DeleteBucketMetricsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketMetricsConfiguration API operation for Amazon Simple Storage Service. -// -// Deletes a metrics configuration for the Amazon CloudWatch request metrics -// (specified by the metrics configuration ID) from the bucket. Note that this -// doesn't include the daily storage metrics. -// -// To use this operation, you must have permissions to perform the s3:PutMetricsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about CloudWatch request metrics for Amazon S3, see Monitoring -// Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). -// -// The following operations are related to DeleteBucketMetricsConfiguration: -// -// * GetBucketMetricsConfiguration -// -// * PutBucketMetricsConfiguration -// -// * ListBucketMetricsConfigurations -// -// * Monitoring Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketMetricsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfiguration -func (c *S3) DeleteBucketMetricsConfiguration(input *DeleteBucketMetricsConfigurationInput) (*DeleteBucketMetricsConfigurationOutput, error) { - req, out := c.DeleteBucketMetricsConfigurationRequest(input) - return out, req.Send() -} - -// DeleteBucketMetricsConfigurationWithContext is the same as DeleteBucketMetricsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketMetricsConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketMetricsConfigurationWithContext(ctx aws.Context, input *DeleteBucketMetricsConfigurationInput, opts ...request.Option) (*DeleteBucketMetricsConfigurationOutput, error) { - req, out := c.DeleteBucketMetricsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketPolicy = "DeleteBucketPolicy" - -// DeleteBucketPolicyRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketPolicy for more information on using the DeleteBucketPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketPolicyRequest method. -// req, resp := client.DeleteBucketPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicy -func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *request.Request, output *DeleteBucketPolicyOutput) { - op := &request.Operation{ - Name: opDeleteBucketPolicy, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?policy", - } - - if input == nil { - input = &DeleteBucketPolicyInput{} - } - - output = &DeleteBucketPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketPolicy API operation for Amazon Simple Storage Service. -// -// This implementation of the DELETE operation uses the policy subresource to -// delete the policy of a specified bucket. If you are using an identity other -// than the root user of the AWS account that owns the bucket, the calling identity -// must have the DeleteBucketPolicy permissions on the specified bucket and -// belong to the bucket owner's account to use this operation. -// -// If you don't have DeleteBucketPolicy permissions, Amazon S3 returns a 403 -// Access Denied error. If you have the correct permissions, but you're not -// using an identity that belongs to the bucket owner's account, Amazon S3 returns -// a 405 Method Not Allowed error. -// -// As a security precaution, the root user of the AWS account that owns a bucket -// can always use this operation, even if the policy explicitly denies the root -// user the ability to perform this action. -// -// For more information about bucket policies, see Using Bucket Policies and -// UserPolicies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). -// -// The following operations are related to DeleteBucketPolicy -// -// * CreateBucket -// -// * DeleteObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketPolicy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicy -func (c *S3) DeleteBucketPolicy(input *DeleteBucketPolicyInput) (*DeleteBucketPolicyOutput, error) { - req, out := c.DeleteBucketPolicyRequest(input) - return out, req.Send() -} - -// DeleteBucketPolicyWithContext is the same as DeleteBucketPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketPolicyWithContext(ctx aws.Context, input *DeleteBucketPolicyInput, opts ...request.Option) (*DeleteBucketPolicyOutput, error) { - req, out := c.DeleteBucketPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketReplication = "DeleteBucketReplication" - -// DeleteBucketReplicationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketReplication operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketReplication for more information on using the DeleteBucketReplication -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketReplicationRequest method. -// req, resp := client.DeleteBucketReplicationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplication -func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) (req *request.Request, output *DeleteBucketReplicationOutput) { - op := &request.Operation{ - Name: opDeleteBucketReplication, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?replication", - } - - if input == nil { - input = &DeleteBucketReplicationInput{} - } - - output = &DeleteBucketReplicationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketReplication API operation for Amazon Simple Storage Service. -// -// Deletes the replication configuration from the bucket. -// -// To use this operation, you must have permissions to perform the s3:PutReplicationConfiguration -// action. The bucket owner has these permissions by default and can grant it -// to others. For more information about permissions, see Permissions Related -// to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// It can take a while for the deletion of a replication configuration to fully -// propagate. -// -// For information about replication configuration, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) -// in the Amazon S3 Developer Guide. -// -// The following operations are related to DeleteBucketReplication: -// -// * PutBucketReplication -// -// * GetBucketReplication -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketReplication for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplication -func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (*DeleteBucketReplicationOutput, error) { - req, out := c.DeleteBucketReplicationRequest(input) - return out, req.Send() -} - -// DeleteBucketReplicationWithContext is the same as DeleteBucketReplication with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketReplication for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketReplicationWithContext(ctx aws.Context, input *DeleteBucketReplicationInput, opts ...request.Option) (*DeleteBucketReplicationOutput, error) { - req, out := c.DeleteBucketReplicationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketTagging = "DeleteBucketTagging" - -// DeleteBucketTaggingRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketTagging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketTagging for more information on using the DeleteBucketTagging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketTaggingRequest method. -// req, resp := client.DeleteBucketTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTagging -func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) (req *request.Request, output *DeleteBucketTaggingOutput) { - op := &request.Operation{ - Name: opDeleteBucketTagging, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?tagging", - } - - if input == nil { - input = &DeleteBucketTaggingInput{} - } - - output = &DeleteBucketTaggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketTagging API operation for Amazon Simple Storage Service. -// -// Deletes the tags from the bucket. -// -// To use this operation, you must have permission to perform the s3:PutBucketTagging -// action. By default, the bucket owner has this permission and can grant this -// permission to others. -// -// The following operations are related to DeleteBucketTagging: -// -// * GetBucketTagging -// -// * PutBucketTagging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTagging -func (c *S3) DeleteBucketTagging(input *DeleteBucketTaggingInput) (*DeleteBucketTaggingOutput, error) { - req, out := c.DeleteBucketTaggingRequest(input) - return out, req.Send() -} - -// DeleteBucketTaggingWithContext is the same as DeleteBucketTagging with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketTagging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketTaggingWithContext(ctx aws.Context, input *DeleteBucketTaggingInput, opts ...request.Option) (*DeleteBucketTaggingOutput, error) { - req, out := c.DeleteBucketTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketWebsite = "DeleteBucketWebsite" - -// DeleteBucketWebsiteRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketWebsite operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteBucketWebsite for more information on using the DeleteBucketWebsite -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteBucketWebsiteRequest method. -// req, resp := client.DeleteBucketWebsiteRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsite -func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *request.Request, output *DeleteBucketWebsiteOutput) { - op := &request.Operation{ - Name: opDeleteBucketWebsite, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?website", - } - - if input == nil { - input = &DeleteBucketWebsiteInput{} - } - - output = &DeleteBucketWebsiteOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketWebsite API operation for Amazon Simple Storage Service. -// -// This operation removes the website configuration for a bucket. Amazon S3 -// returns a 200 OK response upon successfully deleting a website configuration -// on the specified bucket. You will get a 200 OK response if the website configuration -// you are trying to delete does not exist on the bucket. Amazon S3 returns -// a 404 response if the bucket specified in the request does not exist. -// -// This DELETE operation requires the S3:DeleteBucketWebsite permission. By -// default, only the bucket owner can delete the website configuration attached -// to a bucket. However, bucket owners can grant other users permission to delete -// the website configuration by writing a bucket policy granting them the S3:DeleteBucketWebsite -// permission. -// -// For more information about hosting websites, see Hosting Websites on Amazon -// S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html). -// -// The following operations are related to DeleteBucketWebsite: -// -// * GetBucketWebsite -// -// * PutBucketWebsite -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteBucketWebsite for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsite -func (c *S3) DeleteBucketWebsite(input *DeleteBucketWebsiteInput) (*DeleteBucketWebsiteOutput, error) { - req, out := c.DeleteBucketWebsiteRequest(input) - return out, req.Send() -} - -// DeleteBucketWebsiteWithContext is the same as DeleteBucketWebsite with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketWebsite for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteBucketWebsiteWithContext(ctx aws.Context, input *DeleteBucketWebsiteInput, opts ...request.Option) (*DeleteBucketWebsiteOutput, error) { - req, out := c.DeleteBucketWebsiteRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteObject = "DeleteObject" - -// DeleteObjectRequest generates a "aws/request.Request" representing the -// client's request for the DeleteObject operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteObject for more information on using the DeleteObject -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteObjectRequest method. -// req, resp := client.DeleteObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject -func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *request.Request, output *DeleteObjectOutput) { - op := &request.Operation{ - Name: opDeleteObject, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &DeleteObjectInput{} - } - - output = &DeleteObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeleteObject API operation for Amazon Simple Storage Service. -// -// Removes the null version (if there is one) of an object and inserts a delete -// marker, which becomes the latest version of the object. If there isn't a -// null version, Amazon S3 does not remove any objects. -// -// To remove a specific version, you must be the bucket owner and you must use -// the version Id subresource. Using this subresource permanently deletes the -// version. If the object deleted is a delete marker, Amazon S3 sets the response -// header, x-amz-delete-marker, to true. -// -// If the object you want to delete is in a bucket where the bucket versioning -// configuration is MFA Delete enabled, you must include the x-amz-mfa request -// header in the DELETE versionId request. Requests that include x-amz-mfa must -// use HTTPS. -// -// For more information about MFA Delete, see Using MFA Delete (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMFADelete.html). -// To see sample requests that use versioning, see Sample Request (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html#ExampleVersionObjectDelete). -// -// You can delete objects by explicitly calling the DELETE Object API or configure -// its lifecycle (PutBucketLifecycle) to enable Amazon S3 to remove them for -// you. If you want to block users or accounts from removing or deleting objects -// from your bucket, you must deny them the s3:DeleteObject, s3:DeleteObjectVersion, -// and s3:PutLifeCycleConfiguration actions. -// -// The following operation is related to DeleteObject: -// -// * PutObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteObject for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject -func (c *S3) DeleteObject(input *DeleteObjectInput) (*DeleteObjectOutput, error) { - req, out := c.DeleteObjectRequest(input) - return out, req.Send() -} - -// DeleteObjectWithContext is the same as DeleteObject with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteObject for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteObjectWithContext(ctx aws.Context, input *DeleteObjectInput, opts ...request.Option) (*DeleteObjectOutput, error) { - req, out := c.DeleteObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteObjectTagging = "DeleteObjectTagging" - -// DeleteObjectTaggingRequest generates a "aws/request.Request" representing the -// client's request for the DeleteObjectTagging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteObjectTagging for more information on using the DeleteObjectTagging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteObjectTaggingRequest method. -// req, resp := client.DeleteObjectTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTagging -func (c *S3) DeleteObjectTaggingRequest(input *DeleteObjectTaggingInput) (req *request.Request, output *DeleteObjectTaggingOutput) { - op := &request.Operation{ - Name: opDeleteObjectTagging, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}?tagging", - } - - if input == nil { - input = &DeleteObjectTaggingInput{} - } - - output = &DeleteObjectTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeleteObjectTagging API operation for Amazon Simple Storage Service. -// -// Removes the entire tag set from the specified object. For more information -// about managing object tags, see Object Tagging (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). -// -// To use this operation, you must have permission to perform the s3:DeleteObjectTagging -// action. -// -// To delete tags of a specific object version, add the versionId query parameter -// in the request. You will need permission for the s3:DeleteObjectVersionTagging -// action. -// -// The following operations are related to DeleteBucketMetricsConfiguration: -// -// * PutObjectTagging -// -// * GetObjectTagging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteObjectTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTagging -func (c *S3) DeleteObjectTagging(input *DeleteObjectTaggingInput) (*DeleteObjectTaggingOutput, error) { - req, out := c.DeleteObjectTaggingRequest(input) - return out, req.Send() -} - -// DeleteObjectTaggingWithContext is the same as DeleteObjectTagging with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteObjectTagging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteObjectTaggingWithContext(ctx aws.Context, input *DeleteObjectTaggingInput, opts ...request.Option) (*DeleteObjectTaggingOutput, error) { - req, out := c.DeleteObjectTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteObjects = "DeleteObjects" - -// DeleteObjectsRequest generates a "aws/request.Request" representing the -// client's request for the DeleteObjects operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeleteObjects for more information on using the DeleteObjects -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeleteObjectsRequest method. -// req, resp := client.DeleteObjectsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjects -func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) (req *request.Request, output *DeleteObjectsOutput) { - op := &request.Operation{ - Name: opDeleteObjects, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}?delete", - } - - if input == nil { - input = &DeleteObjectsInput{} - } - - output = &DeleteObjectsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// DeleteObjects API operation for Amazon Simple Storage Service. -// -// This operation enables you to delete multiple objects from a bucket using -// a single HTTP request. If you know the object keys that you want to delete, -// then this operation provides a suitable alternative to sending individual -// delete requests, reducing per-request overhead. -// -// The request contains a list of up to 1000 keys that you want to delete. In -// the XML, you provide the object key names, and optionally, version IDs if -// you want to delete a specific version of the object from a versioning-enabled -// bucket. For each key, Amazon S3 performs a delete operation and returns the -// result of that delete, success, or failure, in the response. Note that if -// the object specified in the request is not found, Amazon S3 returns the result -// as deleted. -// -// The operation supports two modes for the response: verbose and quiet. By -// default, the operation uses verbose mode in which the response includes the -// result of deletion of each key in your request. In quiet mode the response -// includes only keys where the delete operation encountered an error. For a -// successful deletion, the operation does not return any information about -// the delete in the response body. -// -// When performing this operation on an MFA Delete enabled bucket, that attempts -// to delete any versioned objects, you must include an MFA token. If you do -// not provide one, the entire request will fail, even if there are non-versioned -// objects you are trying to delete. If you provide an invalid token, whether -// there are versioned keys in the request or not, the entire Multi-Object Delete -// request will fail. For information about MFA Delete, see MFA Delete (https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html#MultiFactorAuthenticationDelete). -// -// Finally, the Content-MD5 header is required for all Multi-Object Delete requests. -// Amazon S3 uses the header value to ensure that your request body has not -// been altered in transit. -// -// The following operations are related to DeleteObjects: -// -// * CreateMultipartUpload -// -// * UploadPart -// -// * CompleteMultipartUpload -// -// * ListParts -// -// * AbortMultipartUpload -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeleteObjects for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjects -func (c *S3) DeleteObjects(input *DeleteObjectsInput) (*DeleteObjectsOutput, error) { - req, out := c.DeleteObjectsRequest(input) - return out, req.Send() -} - -// DeleteObjectsWithContext is the same as DeleteObjects with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteObjects for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeleteObjectsWithContext(ctx aws.Context, input *DeleteObjectsInput, opts ...request.Option) (*DeleteObjectsOutput, error) { - req, out := c.DeleteObjectsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeletePublicAccessBlock = "DeletePublicAccessBlock" - -// DeletePublicAccessBlockRequest generates a "aws/request.Request" representing the -// client's request for the DeletePublicAccessBlock operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DeletePublicAccessBlock for more information on using the DeletePublicAccessBlock -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DeletePublicAccessBlockRequest method. -// req, resp := client.DeletePublicAccessBlockRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeletePublicAccessBlock -func (c *S3) DeletePublicAccessBlockRequest(input *DeletePublicAccessBlockInput) (req *request.Request, output *DeletePublicAccessBlockOutput) { - op := &request.Operation{ - Name: opDeletePublicAccessBlock, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?publicAccessBlock", - } - - if input == nil { - input = &DeletePublicAccessBlockInput{} - } - - output = &DeletePublicAccessBlockOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeletePublicAccessBlock API operation for Amazon Simple Storage Service. -// -// Removes the PublicAccessBlock configuration for an Amazon S3 bucket. To use -// this operation, you must have the s3:PutBucketPublicAccessBlock permission. -// For more information about permissions, see Permissions Related to Bucket -// Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// The following operations are related to DeletePublicAccessBlock: -// -// * Using Amazon S3 Block Public Access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) -// -// * GetPublicAccessBlock -// -// * PutPublicAccessBlock -// -// * GetBucketPolicyStatus -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation DeletePublicAccessBlock for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeletePublicAccessBlock -func (c *S3) DeletePublicAccessBlock(input *DeletePublicAccessBlockInput) (*DeletePublicAccessBlockOutput, error) { - req, out := c.DeletePublicAccessBlockRequest(input) - return out, req.Send() -} - -// DeletePublicAccessBlockWithContext is the same as DeletePublicAccessBlock with the addition of -// the ability to pass a context and additional request options. -// -// See DeletePublicAccessBlock for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) DeletePublicAccessBlockWithContext(ctx aws.Context, input *DeletePublicAccessBlockInput, opts ...request.Option) (*DeletePublicAccessBlockOutput, error) { - req, out := c.DeletePublicAccessBlockRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketAccelerateConfiguration = "GetBucketAccelerateConfiguration" - -// GetBucketAccelerateConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketAccelerateConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketAccelerateConfiguration for more information on using the GetBucketAccelerateConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketAccelerateConfigurationRequest method. -// req, resp := client.GetBucketAccelerateConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfiguration -func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateConfigurationInput) (req *request.Request, output *GetBucketAccelerateConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketAccelerateConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?accelerate", - } - - if input == nil { - input = &GetBucketAccelerateConfigurationInput{} - } - - output = &GetBucketAccelerateConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketAccelerateConfiguration API operation for Amazon Simple Storage Service. -// -// This implementation of the GET operation uses the accelerate subresource -// to return the Transfer Acceleration state of a bucket, which is either Enabled -// or Suspended. Amazon S3 Transfer Acceleration is a bucket-level feature that -// enables you to perform faster data transfers to and from Amazon S3. -// -// To use this operation, you must have permission to perform the s3:GetAccelerateConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// You set the Transfer Acceleration state of an existing bucket to Enabled -// or Suspended by using the PutBucketAccelerateConfiguration operation. -// -// A GET accelerate request does not return a state value for a bucket that -// has no transfer acceleration state. A bucket has no Transfer Acceleration -// state if a state has never been set on the bucket. -// -// For more information about transfer acceleration, see Transfer Acceleration -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Related Resources -// -// * PutBucketAccelerateConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketAccelerateConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfiguration -func (c *S3) GetBucketAccelerateConfiguration(input *GetBucketAccelerateConfigurationInput) (*GetBucketAccelerateConfigurationOutput, error) { - req, out := c.GetBucketAccelerateConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketAccelerateConfigurationWithContext is the same as GetBucketAccelerateConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketAccelerateConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketAccelerateConfigurationWithContext(ctx aws.Context, input *GetBucketAccelerateConfigurationInput, opts ...request.Option) (*GetBucketAccelerateConfigurationOutput, error) { - req, out := c.GetBucketAccelerateConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketAcl = "GetBucketAcl" - -// GetBucketAclRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketAcl operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketAcl for more information on using the GetBucketAcl -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketAclRequest method. -// req, resp := client.GetBucketAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAcl -func (c *S3) GetBucketAclRequest(input *GetBucketAclInput) (req *request.Request, output *GetBucketAclOutput) { - op := &request.Operation{ - Name: opGetBucketAcl, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?acl", - } - - if input == nil { - input = &GetBucketAclInput{} - } - - output = &GetBucketAclOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketAcl API operation for Amazon Simple Storage Service. -// -// This implementation of the GET operation uses the acl subresource to return -// the access control list (ACL) of a bucket. To use GET to return the ACL of -// the bucket, you must have READ_ACP access to the bucket. If READ_ACP permission -// is granted to the anonymous user, you can return the ACL of the bucket without -// using an authorization header. -// -// Related Resources -// -// * -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketAcl for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAcl -func (c *S3) GetBucketAcl(input *GetBucketAclInput) (*GetBucketAclOutput, error) { - req, out := c.GetBucketAclRequest(input) - return out, req.Send() -} - -// GetBucketAclWithContext is the same as GetBucketAcl with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketAcl for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketAclWithContext(ctx aws.Context, input *GetBucketAclInput, opts ...request.Option) (*GetBucketAclOutput, error) { - req, out := c.GetBucketAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketAnalyticsConfiguration = "GetBucketAnalyticsConfiguration" - -// GetBucketAnalyticsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketAnalyticsConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketAnalyticsConfiguration for more information on using the GetBucketAnalyticsConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketAnalyticsConfigurationRequest method. -// req, resp := client.GetBucketAnalyticsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfiguration -func (c *S3) GetBucketAnalyticsConfigurationRequest(input *GetBucketAnalyticsConfigurationInput) (req *request.Request, output *GetBucketAnalyticsConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketAnalyticsConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &GetBucketAnalyticsConfigurationInput{} - } - - output = &GetBucketAnalyticsConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. -// -// This implementation of the GET operation returns an analytics configuration -// (identified by the analytics configuration ID) from the bucket. -// -// To use this operation, you must have permissions to perform the s3:GetAnalyticsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// For information about Amazon S3 analytics feature, see Amazon S3 Analytics -// – Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Related Resources -// -// * -// -// * -// -// * -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketAnalyticsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfiguration -func (c *S3) GetBucketAnalyticsConfiguration(input *GetBucketAnalyticsConfigurationInput) (*GetBucketAnalyticsConfigurationOutput, error) { - req, out := c.GetBucketAnalyticsConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketAnalyticsConfigurationWithContext is the same as GetBucketAnalyticsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketAnalyticsConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *GetBucketAnalyticsConfigurationInput, opts ...request.Option) (*GetBucketAnalyticsConfigurationOutput, error) { - req, out := c.GetBucketAnalyticsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketCors = "GetBucketCors" - -// GetBucketCorsRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketCors operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketCors for more information on using the GetBucketCors -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketCorsRequest method. -// req, resp := client.GetBucketCorsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCors -func (c *S3) GetBucketCorsRequest(input *GetBucketCorsInput) (req *request.Request, output *GetBucketCorsOutput) { - op := &request.Operation{ - Name: opGetBucketCors, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?cors", - } - - if input == nil { - input = &GetBucketCorsInput{} - } - - output = &GetBucketCorsOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketCors API operation for Amazon Simple Storage Service. -// -// Returns the cors configuration information set for the bucket. -// -// To use this operation, you must have permission to perform the s3:GetBucketCORS -// action. By default, the bucket owner has this permission and can grant it -// to others. -// -// For more information about cors, see Enabling Cross-Origin Resource Sharing -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html). -// -// The following operations are related to GetBucketCors: -// -// * PutBucketCors -// -// * DeleteBucketCors -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketCors for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCors -func (c *S3) GetBucketCors(input *GetBucketCorsInput) (*GetBucketCorsOutput, error) { - req, out := c.GetBucketCorsRequest(input) - return out, req.Send() -} - -// GetBucketCorsWithContext is the same as GetBucketCors with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketCors for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketCorsWithContext(ctx aws.Context, input *GetBucketCorsInput, opts ...request.Option) (*GetBucketCorsOutput, error) { - req, out := c.GetBucketCorsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketEncryption = "GetBucketEncryption" - -// GetBucketEncryptionRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketEncryption operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketEncryption for more information on using the GetBucketEncryption -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketEncryptionRequest method. -// req, resp := client.GetBucketEncryptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryption -func (c *S3) GetBucketEncryptionRequest(input *GetBucketEncryptionInput) (req *request.Request, output *GetBucketEncryptionOutput) { - op := &request.Operation{ - Name: opGetBucketEncryption, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?encryption", - } - - if input == nil { - input = &GetBucketEncryptionInput{} - } - - output = &GetBucketEncryptionOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketEncryption API operation for Amazon Simple Storage Service. -// -// Returns the default encryption configuration for an Amazon S3 bucket. For -// information about the Amazon S3 default encryption feature, see Amazon S3 -// Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html). -// -// To use this operation, you must have permission to perform the s3:GetEncryptionConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// The following operations are related to GetBucketEncryption: -// -// * PutBucketEncryption -// -// * DeleteBucketEncryption -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketEncryption for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryption -func (c *S3) GetBucketEncryption(input *GetBucketEncryptionInput) (*GetBucketEncryptionOutput, error) { - req, out := c.GetBucketEncryptionRequest(input) - return out, req.Send() -} - -// GetBucketEncryptionWithContext is the same as GetBucketEncryption with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketEncryption for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketEncryptionWithContext(ctx aws.Context, input *GetBucketEncryptionInput, opts ...request.Option) (*GetBucketEncryptionOutput, error) { - req, out := c.GetBucketEncryptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketInventoryConfiguration = "GetBucketInventoryConfiguration" - -// GetBucketInventoryConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketInventoryConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketInventoryConfiguration for more information on using the GetBucketInventoryConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketInventoryConfigurationRequest method. -// req, resp := client.GetBucketInventoryConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfiguration -func (c *S3) GetBucketInventoryConfigurationRequest(input *GetBucketInventoryConfigurationInput) (req *request.Request, output *GetBucketInventoryConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketInventoryConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &GetBucketInventoryConfigurationInput{} - } - - output = &GetBucketInventoryConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketInventoryConfiguration API operation for Amazon Simple Storage Service. -// -// Returns an inventory configuration (identified by the inventory configuration -// ID) from the bucket. -// -// To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration -// action. The bucket owner has this permission by default and can grant this -// permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about the Amazon S3 inventory feature, see Amazon S3 Inventory -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html). -// -// The following operations are related to GetBucketInventoryConfiguration: -// -// * DeleteBucketInventoryConfiguration -// -// * ListBucketInventoryConfigurations -// -// * PutBucketInventoryConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketInventoryConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfiguration -func (c *S3) GetBucketInventoryConfiguration(input *GetBucketInventoryConfigurationInput) (*GetBucketInventoryConfigurationOutput, error) { - req, out := c.GetBucketInventoryConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketInventoryConfigurationWithContext is the same as GetBucketInventoryConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketInventoryConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketInventoryConfigurationWithContext(ctx aws.Context, input *GetBucketInventoryConfigurationInput, opts ...request.Option) (*GetBucketInventoryConfigurationOutput, error) { - req, out := c.GetBucketInventoryConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLifecycle = "GetBucketLifecycle" - -// GetBucketLifecycleRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLifecycle operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketLifecycle for more information on using the GetBucketLifecycle -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketLifecycleRequest method. -// req, resp := client.GetBucketLifecycleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycle -// -// Deprecated: GetBucketLifecycle has been deprecated -func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *request.Request, output *GetBucketLifecycleOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, GetBucketLifecycle, has been deprecated") - } - op := &request.Operation{ - Name: opGetBucketLifecycle, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &GetBucketLifecycleInput{} - } - - output = &GetBucketLifecycleOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLifecycle API operation for Amazon Simple Storage Service. -// -// -// For an updated version of this API, see GetBucketLifecycleConfiguration. -// If you configured a bucket lifecycle using the filter element, you should -// see the updated version of this topic. This topic is provided for backward -// compatibility. -// -// Returns the lifecycle configuration information set on the bucket. For information -// about lifecycle configuration, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html). -// -// To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// GetBucketLifecycle has the following special error: -// -// * Error code: NoSuchLifecycleConfiguration Description: The lifecycle -// configuration does not exist. HTTP Status Code: 404 Not Found SOAP Fault -// Code Prefix: Client -// -// The following operations are related to GetBucketLifecycle: -// -// * GetBucketLifecycleConfiguration -// -// * PutBucketLifecycle -// -// * DeleteBucketLifecycle -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketLifecycle for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycle -// -// Deprecated: GetBucketLifecycle has been deprecated -func (c *S3) GetBucketLifecycle(input *GetBucketLifecycleInput) (*GetBucketLifecycleOutput, error) { - req, out := c.GetBucketLifecycleRequest(input) - return out, req.Send() -} - -// GetBucketLifecycleWithContext is the same as GetBucketLifecycle with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLifecycle for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -// -// Deprecated: GetBucketLifecycleWithContext has been deprecated -func (c *S3) GetBucketLifecycleWithContext(ctx aws.Context, input *GetBucketLifecycleInput, opts ...request.Option) (*GetBucketLifecycleOutput, error) { - req, out := c.GetBucketLifecycleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLifecycleConfiguration = "GetBucketLifecycleConfiguration" - -// GetBucketLifecycleConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLifecycleConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketLifecycleConfiguration for more information on using the GetBucketLifecycleConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketLifecycleConfigurationRequest method. -// req, resp := client.GetBucketLifecycleConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfiguration -func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleConfigurationInput) (req *request.Request, output *GetBucketLifecycleConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketLifecycleConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &GetBucketLifecycleConfigurationInput{} - } - - output = &GetBucketLifecycleConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLifecycleConfiguration API operation for Amazon Simple Storage Service. -// -// -// Bucket lifecycle configuration now supports specifying a lifecycle rule using -// an object key name prefix, one or more object tags, or a combination of both. -// Accordingly, this section describes the latest API. The response describes -// the new filter element that you can use to specify a filter to select a subset -// of objects to which the rule applies. If you are still using previous version -// of the lifecycle configuration, it works. For the earlier API description, -// see GetBucketLifecycle. -// -// Returns the lifecycle configuration information set on the bucket. For information -// about lifecycle configuration, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html). -// -// To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration -// action. The bucket owner has this permission, by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// GetBucketLifecycleConfiguration has the following special error: -// -// * Error code: NoSuchLifecycleConfiguration Description: The lifecycle -// configuration does not exist. HTTP Status Code: 404 Not Found SOAP Fault -// Code Prefix: Client -// -// The following operations are related to GetBucketLifecycleConfiguration: -// -// * GetBucketLifecycle -// -// * PutBucketLifecycle -// -// * DeleteBucketLifecycle -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketLifecycleConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfiguration -func (c *S3) GetBucketLifecycleConfiguration(input *GetBucketLifecycleConfigurationInput) (*GetBucketLifecycleConfigurationOutput, error) { - req, out := c.GetBucketLifecycleConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketLifecycleConfigurationWithContext is the same as GetBucketLifecycleConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLifecycleConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketLifecycleConfigurationWithContext(ctx aws.Context, input *GetBucketLifecycleConfigurationInput, opts ...request.Option) (*GetBucketLifecycleConfigurationOutput, error) { - req, out := c.GetBucketLifecycleConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLocation = "GetBucketLocation" - -// GetBucketLocationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLocation operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketLocation for more information on using the GetBucketLocation -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketLocationRequest method. -// req, resp := client.GetBucketLocationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocation -func (c *S3) GetBucketLocationRequest(input *GetBucketLocationInput) (req *request.Request, output *GetBucketLocationOutput) { - op := &request.Operation{ - Name: opGetBucketLocation, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?location", - } - - if input == nil { - input = &GetBucketLocationInput{} - } - - output = &GetBucketLocationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLocation API operation for Amazon Simple Storage Service. -// -// Returns the Region the bucket resides in. You set the bucket's Region using -// the LocationConstraint request parameter in a CreateBucket request. For more -// information, see CreateBucket. -// -// To use this implementation of the operation, you must be the bucket owner. -// -// The following operations are related to GetBucketLocation: -// -// * GetObject -// -// * CreateBucket -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketLocation for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocation -func (c *S3) GetBucketLocation(input *GetBucketLocationInput) (*GetBucketLocationOutput, error) { - req, out := c.GetBucketLocationRequest(input) - return out, req.Send() -} - -// GetBucketLocationWithContext is the same as GetBucketLocation with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLocation for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketLocationWithContext(ctx aws.Context, input *GetBucketLocationInput, opts ...request.Option) (*GetBucketLocationOutput, error) { - req, out := c.GetBucketLocationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLogging = "GetBucketLogging" - -// GetBucketLoggingRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLogging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketLogging for more information on using the GetBucketLogging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketLoggingRequest method. -// req, resp := client.GetBucketLoggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLogging -func (c *S3) GetBucketLoggingRequest(input *GetBucketLoggingInput) (req *request.Request, output *GetBucketLoggingOutput) { - op := &request.Operation{ - Name: opGetBucketLogging, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?logging", - } - - if input == nil { - input = &GetBucketLoggingInput{} - } - - output = &GetBucketLoggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLogging API operation for Amazon Simple Storage Service. -// -// Returns the logging status of a bucket and the permissions users have to -// view and modify that status. To use GET, you must be the bucket owner. -// -// The following operations are related to GetBucketLogging: -// -// * CreateBucket -// -// * PutBucketLogging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketLogging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLogging -func (c *S3) GetBucketLogging(input *GetBucketLoggingInput) (*GetBucketLoggingOutput, error) { - req, out := c.GetBucketLoggingRequest(input) - return out, req.Send() -} - -// GetBucketLoggingWithContext is the same as GetBucketLogging with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLogging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketLoggingWithContext(ctx aws.Context, input *GetBucketLoggingInput, opts ...request.Option) (*GetBucketLoggingOutput, error) { - req, out := c.GetBucketLoggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketMetricsConfiguration = "GetBucketMetricsConfiguration" - -// GetBucketMetricsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketMetricsConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketMetricsConfiguration for more information on using the GetBucketMetricsConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketMetricsConfigurationRequest method. -// req, resp := client.GetBucketMetricsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfiguration -func (c *S3) GetBucketMetricsConfigurationRequest(input *GetBucketMetricsConfigurationInput) (req *request.Request, output *GetBucketMetricsConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketMetricsConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &GetBucketMetricsConfigurationInput{} - } - - output = &GetBucketMetricsConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketMetricsConfiguration API operation for Amazon Simple Storage Service. -// -// Gets a metrics configuration (specified by the metrics configuration ID) -// from the bucket. Note that this doesn't include the daily storage metrics. -// -// To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about CloudWatch request metrics for Amazon S3, see Monitoring -// Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). -// -// The following operations are related to GetBucketMetricsConfiguration: -// -// * PutBucketMetricsConfiguration -// -// * DeleteBucketMetricsConfiguration -// -// * ListBucketMetricsConfigurations -// -// * Monitoring Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketMetricsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfiguration -func (c *S3) GetBucketMetricsConfiguration(input *GetBucketMetricsConfigurationInput) (*GetBucketMetricsConfigurationOutput, error) { - req, out := c.GetBucketMetricsConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketMetricsConfigurationWithContext is the same as GetBucketMetricsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketMetricsConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketMetricsConfigurationWithContext(ctx aws.Context, input *GetBucketMetricsConfigurationInput, opts ...request.Option) (*GetBucketMetricsConfigurationOutput, error) { - req, out := c.GetBucketMetricsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketNotification = "GetBucketNotification" - -// GetBucketNotificationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketNotification operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketNotification for more information on using the GetBucketNotification -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketNotificationRequest method. -// req, resp := client.GetBucketNotificationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotification -// -// Deprecated: GetBucketNotification has been deprecated -func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfigurationDeprecated) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, GetBucketNotification, has been deprecated") - } - op := &request.Operation{ - Name: opGetBucketNotification, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &GetBucketNotificationConfigurationRequest{} - } - - output = &NotificationConfigurationDeprecated{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketNotification API operation for Amazon Simple Storage Service. -// -// No longer used, see GetBucketNotificationConfiguration. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketNotification for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotification -// -// Deprecated: GetBucketNotification has been deprecated -func (c *S3) GetBucketNotification(input *GetBucketNotificationConfigurationRequest) (*NotificationConfigurationDeprecated, error) { - req, out := c.GetBucketNotificationRequest(input) - return out, req.Send() -} - -// GetBucketNotificationWithContext is the same as GetBucketNotification with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketNotification for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -// -// Deprecated: GetBucketNotificationWithContext has been deprecated -func (c *S3) GetBucketNotificationWithContext(ctx aws.Context, input *GetBucketNotificationConfigurationRequest, opts ...request.Option) (*NotificationConfigurationDeprecated, error) { - req, out := c.GetBucketNotificationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketNotificationConfiguration = "GetBucketNotificationConfiguration" - -// GetBucketNotificationConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketNotificationConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketNotificationConfiguration for more information on using the GetBucketNotificationConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketNotificationConfigurationRequest method. -// req, resp := client.GetBucketNotificationConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfiguration -func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfiguration) { - op := &request.Operation{ - Name: opGetBucketNotificationConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &GetBucketNotificationConfigurationRequest{} - } - - output = &NotificationConfiguration{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketNotificationConfiguration API operation for Amazon Simple Storage Service. -// -// Returns the notification configuration of a bucket. -// -// If notifications are not enabled on the bucket, the operation returns an -// empty NotificationConfiguration element. -// -// By default, you must be the bucket owner to read the notification configuration -// of a bucket. However, the bucket owner can use a bucket policy to grant permission -// to other users to read this configuration with the s3:GetBucketNotification -// permission. -// -// For more information about setting and reading the notification configuration -// on a bucket, see Setting Up Notification of Bucket Events (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html). -// For more information about bucket policies, see Using Bucket Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). -// -// The following operation is related to GetBucketNotification: -// -// * PutBucketNotification -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketNotificationConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfiguration -func (c *S3) GetBucketNotificationConfiguration(input *GetBucketNotificationConfigurationRequest) (*NotificationConfiguration, error) { - req, out := c.GetBucketNotificationConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketNotificationConfigurationWithContext is the same as GetBucketNotificationConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketNotificationConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketNotificationConfigurationWithContext(ctx aws.Context, input *GetBucketNotificationConfigurationRequest, opts ...request.Option) (*NotificationConfiguration, error) { - req, out := c.GetBucketNotificationConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketPolicy = "GetBucketPolicy" - -// GetBucketPolicyRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketPolicy for more information on using the GetBucketPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketPolicyRequest method. -// req, resp := client.GetBucketPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicy -func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) (req *request.Request, output *GetBucketPolicyOutput) { - op := &request.Operation{ - Name: opGetBucketPolicy, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?policy", - } - - if input == nil { - input = &GetBucketPolicyInput{} - } - - output = &GetBucketPolicyOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketPolicy API operation for Amazon Simple Storage Service. -// -// Returns the policy of a specified bucket. If you are using an identity other -// than the root user of the AWS account that owns the bucket, the calling identity -// must have the GetBucketPolicy permissions on the specified bucket and belong -// to the bucket owner's account in order to use this operation. -// -// If you don't have GetBucketPolicy permissions, Amazon S3 returns a 403 Access -// Denied error. If you have the correct permissions, but you're not using an -// identity that belongs to the bucket owner's account, Amazon S3 returns a -// 405 Method Not Allowed error. -// -// As a security precaution, the root user of the AWS account that owns a bucket -// can always use this operation, even if the policy explicitly denies the root -// user the ability to perform this action. -// -// For more information about bucket policies, see Using Bucket Policies and -// User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). -// -// The following operation is related to GetBucketPolicy: -// -// * GetObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketPolicy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicy -func (c *S3) GetBucketPolicy(input *GetBucketPolicyInput) (*GetBucketPolicyOutput, error) { - req, out := c.GetBucketPolicyRequest(input) - return out, req.Send() -} - -// GetBucketPolicyWithContext is the same as GetBucketPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketPolicyWithContext(ctx aws.Context, input *GetBucketPolicyInput, opts ...request.Option) (*GetBucketPolicyOutput, error) { - req, out := c.GetBucketPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketPolicyStatus = "GetBucketPolicyStatus" - -// GetBucketPolicyStatusRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketPolicyStatus operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketPolicyStatus for more information on using the GetBucketPolicyStatus -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketPolicyStatusRequest method. -// req, resp := client.GetBucketPolicyStatusRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicyStatus -func (c *S3) GetBucketPolicyStatusRequest(input *GetBucketPolicyStatusInput) (req *request.Request, output *GetBucketPolicyStatusOutput) { - op := &request.Operation{ - Name: opGetBucketPolicyStatus, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?policyStatus", - } - - if input == nil { - input = &GetBucketPolicyStatusInput{} - } - - output = &GetBucketPolicyStatusOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketPolicyStatus API operation for Amazon Simple Storage Service. -// -// Retrieves the policy status for an Amazon S3 bucket, indicating whether the -// bucket is public. In order to use this operation, you must have the s3:GetBucketPolicyStatus -// permission. For more information about Amazon S3 permissions, see Specifying -// Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html). -// -// For more information about when Amazon S3 considers a bucket public, see -// The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status). -// -// The following operations are related to GetBucketPolicyStatus: -// -// * Using Amazon S3 Block Public Access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) -// -// * GetPublicAccessBlock -// -// * PutPublicAccessBlock -// -// * DeletePublicAccessBlock -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketPolicyStatus for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicyStatus -func (c *S3) GetBucketPolicyStatus(input *GetBucketPolicyStatusInput) (*GetBucketPolicyStatusOutput, error) { - req, out := c.GetBucketPolicyStatusRequest(input) - return out, req.Send() -} - -// GetBucketPolicyStatusWithContext is the same as GetBucketPolicyStatus with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketPolicyStatus for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketPolicyStatusWithContext(ctx aws.Context, input *GetBucketPolicyStatusInput, opts ...request.Option) (*GetBucketPolicyStatusOutput, error) { - req, out := c.GetBucketPolicyStatusRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketReplication = "GetBucketReplication" - -// GetBucketReplicationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketReplication operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketReplication for more information on using the GetBucketReplication -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketReplicationRequest method. -// req, resp := client.GetBucketReplicationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplication -func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req *request.Request, output *GetBucketReplicationOutput) { - op := &request.Operation{ - Name: opGetBucketReplication, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?replication", - } - - if input == nil { - input = &GetBucketReplicationInput{} - } - - output = &GetBucketReplicationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketReplication API operation for Amazon Simple Storage Service. -// -// Returns the replication configuration of a bucket. -// -// It can take a while to propagate the put or delete a replication configuration -// to all Amazon S3 systems. Therefore, a get request soon after put or delete -// can return a wrong result. -// -// For information about replication configuration, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// This operation requires permissions for the s3:GetReplicationConfiguration -// action. For more information about permissions, see Using Bucket Policies -// and User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). -// -// If you include the Filter element in a replication configuration, you must -// also include the DeleteMarkerReplication and Priority elements. The response -// also returns those elements. -// -// For information about GetBucketReplication errors, see ReplicationErrorCodeList -// -// The following operations are related to GetBucketReplication: -// -// * PutBucketReplication -// -// * DeleteBucketReplication -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketReplication for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplication -func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (*GetBucketReplicationOutput, error) { - req, out := c.GetBucketReplicationRequest(input) - return out, req.Send() -} - -// GetBucketReplicationWithContext is the same as GetBucketReplication with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketReplication for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketReplicationWithContext(ctx aws.Context, input *GetBucketReplicationInput, opts ...request.Option) (*GetBucketReplicationOutput, error) { - req, out := c.GetBucketReplicationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketRequestPayment = "GetBucketRequestPayment" - -// GetBucketRequestPaymentRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketRequestPayment operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketRequestPayment for more information on using the GetBucketRequestPayment -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketRequestPaymentRequest method. -// req, resp := client.GetBucketRequestPaymentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPayment -func (c *S3) GetBucketRequestPaymentRequest(input *GetBucketRequestPaymentInput) (req *request.Request, output *GetBucketRequestPaymentOutput) { - op := &request.Operation{ - Name: opGetBucketRequestPayment, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?requestPayment", - } - - if input == nil { - input = &GetBucketRequestPaymentInput{} - } - - output = &GetBucketRequestPaymentOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketRequestPayment API operation for Amazon Simple Storage Service. -// -// Returns the request payment configuration of a bucket. To use this version -// of the operation, you must be the bucket owner. For more information, see -// Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html). -// -// The following operations are related to GetBucketRequestPayment: -// -// * ListObjects -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketRequestPayment for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPayment -func (c *S3) GetBucketRequestPayment(input *GetBucketRequestPaymentInput) (*GetBucketRequestPaymentOutput, error) { - req, out := c.GetBucketRequestPaymentRequest(input) - return out, req.Send() -} - -// GetBucketRequestPaymentWithContext is the same as GetBucketRequestPayment with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketRequestPayment for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketRequestPaymentWithContext(ctx aws.Context, input *GetBucketRequestPaymentInput, opts ...request.Option) (*GetBucketRequestPaymentOutput, error) { - req, out := c.GetBucketRequestPaymentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketTagging = "GetBucketTagging" - -// GetBucketTaggingRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketTagging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketTagging for more information on using the GetBucketTagging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketTaggingRequest method. -// req, resp := client.GetBucketTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTagging -func (c *S3) GetBucketTaggingRequest(input *GetBucketTaggingInput) (req *request.Request, output *GetBucketTaggingOutput) { - op := &request.Operation{ - Name: opGetBucketTagging, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?tagging", - } - - if input == nil { - input = &GetBucketTaggingInput{} - } - - output = &GetBucketTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketTagging API operation for Amazon Simple Storage Service. -// -// Returns the tag set associated with the bucket. -// -// To use this operation, you must have permission to perform the s3:GetBucketTagging -// action. By default, the bucket owner has this permission and can grant this -// permission to others. -// -// GetBucketTagging has the following special error: -// -// * Error code: NoSuchTagSetError Description: There is no tag set associated -// with the bucket. -// -// The following operations are related to GetBucketTagging: -// -// * PutBucketTagging -// -// * DeleteBucketTagging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTagging -func (c *S3) GetBucketTagging(input *GetBucketTaggingInput) (*GetBucketTaggingOutput, error) { - req, out := c.GetBucketTaggingRequest(input) - return out, req.Send() -} - -// GetBucketTaggingWithContext is the same as GetBucketTagging with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketTagging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketTaggingWithContext(ctx aws.Context, input *GetBucketTaggingInput, opts ...request.Option) (*GetBucketTaggingOutput, error) { - req, out := c.GetBucketTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketVersioning = "GetBucketVersioning" - -// GetBucketVersioningRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketVersioning operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketVersioning for more information on using the GetBucketVersioning -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketVersioningRequest method. -// req, resp := client.GetBucketVersioningRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning -func (c *S3) GetBucketVersioningRequest(input *GetBucketVersioningInput) (req *request.Request, output *GetBucketVersioningOutput) { - op := &request.Operation{ - Name: opGetBucketVersioning, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?versioning", - } - - if input == nil { - input = &GetBucketVersioningInput{} - } - - output = &GetBucketVersioningOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketVersioning API operation for Amazon Simple Storage Service. -// -// Returns the versioning state of a bucket. -// -// To retrieve the versioning state of a bucket, you must be the bucket owner. -// -// This implementation also returns the MFA Delete status of the versioning -// state. If the MFA Delete status is enabled, the bucket owner must use an -// authentication device to change the versioning state of the bucket. -// -// The following operations are related to GetBucketVersioning: -// -// * GetObject -// -// * PutObject -// -// * DeleteObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketVersioning for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning -func (c *S3) GetBucketVersioning(input *GetBucketVersioningInput) (*GetBucketVersioningOutput, error) { - req, out := c.GetBucketVersioningRequest(input) - return out, req.Send() -} - -// GetBucketVersioningWithContext is the same as GetBucketVersioning with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketVersioning for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketVersioningWithContext(ctx aws.Context, input *GetBucketVersioningInput, opts ...request.Option) (*GetBucketVersioningOutput, error) { - req, out := c.GetBucketVersioningRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketWebsite = "GetBucketWebsite" - -// GetBucketWebsiteRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketWebsite operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetBucketWebsite for more information on using the GetBucketWebsite -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetBucketWebsiteRequest method. -// req, resp := client.GetBucketWebsiteRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsite -func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) (req *request.Request, output *GetBucketWebsiteOutput) { - op := &request.Operation{ - Name: opGetBucketWebsite, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?website", - } - - if input == nil { - input = &GetBucketWebsiteInput{} - } - - output = &GetBucketWebsiteOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketWebsite API operation for Amazon Simple Storage Service. -// -// Returns the website configuration for a bucket. To host website on Amazon -// S3, you can configure a bucket as website by adding a website configuration. -// For more information about hosting websites, see Hosting Websites on Amazon -// S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html). -// -// This GET operation requires the S3:GetBucketWebsite permission. By default, -// only the bucket owner can read the bucket website configuration. However, -// bucket owners can allow other users to read the website configuration by -// writing a bucket policy granting them the S3:GetBucketWebsite permission. -// -// The following operations are related to DeleteBucketWebsite: -// -// * DeleteBucketWebsite -// -// * PutBucketWebsite -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetBucketWebsite for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsite -func (c *S3) GetBucketWebsite(input *GetBucketWebsiteInput) (*GetBucketWebsiteOutput, error) { - req, out := c.GetBucketWebsiteRequest(input) - return out, req.Send() -} - -// GetBucketWebsiteWithContext is the same as GetBucketWebsite with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketWebsite for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetBucketWebsiteWithContext(ctx aws.Context, input *GetBucketWebsiteInput, opts ...request.Option) (*GetBucketWebsiteOutput, error) { - req, out := c.GetBucketWebsiteRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObject = "GetObject" - -// GetObjectRequest generates a "aws/request.Request" representing the -// client's request for the GetObject operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObject for more information on using the GetObject -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectRequest method. -// req, resp := client.GetObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject -func (c *S3) GetObjectRequest(input *GetObjectInput) (req *request.Request, output *GetObjectOutput) { - op := &request.Operation{ - Name: opGetObject, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &GetObjectInput{} - } - - output = &GetObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObject API operation for Amazon Simple Storage Service. -// -// Retrieves objects from Amazon S3. To use GET, you must have READ access to -// the object. If you grant READ access to the anonymous user, you can return -// the object without using an authorization header. -// -// An Amazon S3 bucket has no directory hierarchy such as you would find in -// a typical computer file system. You can, however, create a logical hierarchy -// by using object key names that imply a folder structure. For example, instead -// of naming an object sample.jpg, you can name it photos/2006/February/sample.jpg. -// -// To get an object from such a logical hierarchy, specify the full key name -// for the object in the GET operation. For a virtual hosted-style request example, -// if you have the object photos/2006/February/sample.jpg, specify the resource -// as /photos/2006/February/sample.jpg. For a path-style request example, if -// you have the object photos/2006/February/sample.jpg in the bucket named examplebucket, -// specify the resource as /examplebucket/photos/2006/February/sample.jpg. For -// more information about request types, see HTTP Host Header Bucket Specification -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingSpecifyBucket). -// -// To distribute large files to many people, you can save bandwidth costs by -// using BitTorrent. For more information, see Amazon S3 Torrent (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3Torrent.html). -// For more information about returning the ACL of an object, see GetObjectAcl. -// -// If the object you are retrieving is stored in the GLACIER or DEEP_ARCHIVE -// storage classes, before you can retrieve the object you must first restore -// a copy using . Otherwise, this operation returns an InvalidObjectStateError -// error. For information about restoring archived objects, see Restoring Archived -// Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html). -// -// Encryption request headers, like x-amz-server-side-encryption, should not -// be sent for GET requests if your object uses server-side encryption with -// CMKs stored in AWS KMS (SSE-KMS) or server-side encryption with Amazon S3–managed -// encryption keys (SSE-S3). If your object does use these types of keys, you’ll -// get an HTTP 400 BadRequest error. -// -// If you encrypt an object by using server-side encryption with customer-provided -// encryption keys (SSE-C) when you store the object in Amazon S3, then when -// you GET the object, you must use the following headers: -// -// * x-amz-server-side​-encryption​-customer-algorithm -// -// * x-amz-server-side​-encryption​-customer-key -// -// * x-amz-server-side​-encryption​-customer-key-MD5 -// -// For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided -// Encryption Keys) (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). -// -// Assuming you have permission to read object tags (permission for the s3:GetObjectVersionTagging -// action), the response also returns the x-amz-tagging-count header that provides -// the count of number of tags associated with the object. You can use GetObjectTagging -// to retrieve the tag set associated with an object. -// -// Permissions -// -// You need the s3:GetObject permission for this operation. For more information, -// see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html). -// If the object you request does not exist, the error Amazon S3 returns depends -// on whether you also have the s3:ListBucket permission. -// -// * If you have the s3:ListBucket permission on the bucket, Amazon S3 will -// return an HTTP status code 404 ("no such key") error. -// -// * If you don’t have the s3:ListBucket permission, Amazon S3 will return -// an HTTP status code 403 ("access denied") error. -// -// Versioning -// -// By default, the GET operation returns the current version of an object. To -// return a different version, use the versionId subresource. -// -// If the current version of the object is a delete marker, Amazon S3 behaves -// as if the object was deleted and includes x-amz-delete-marker: true in the -// response. -// -// For more information about versioning, see PutBucketVersioning. -// -// Overriding Response Header Values -// -// There are times when you want to override certain response header values -// in a GET response. For example, you might override the Content-Disposition -// response header value in your GET request. -// -// You can override values for a set of response headers using the following -// query parameters. These response header values are sent only on a successful -// request, that is, when status code 200 OK is returned. The set of headers -// you can override using these parameters is a subset of the headers that Amazon -// S3 accepts when you create an object. The response headers that you can override -// for the GET response are Content-Type, Content-Language, Expires, Cache-Control, -// Content-Disposition, and Content-Encoding. To override these header values -// in the GET response, you use the following request parameters. -// -// You must sign the request, either using an Authorization header or a presigned -// URL, when using these parameters. They cannot be used with an unsigned (anonymous) -// request. -// -// * response-content-type -// -// * response-content-language -// -// * response-expires -// -// * response-cache-control -// -// * response-content-disposition -// -// * response-content-encoding -// -// Additional Considerations about Request Headers -// -// If both of the If-Match and If-Unmodified-Since headers are present in the -// request as follows: If-Match condition evaluates to true, and; If-Unmodified-Since -// condition evaluates to false; then, S3 returns 200 OK and the data requested. -// -// If both of the If-None-Match and If-Modified-Since headers are present in -// the request as follows:If-None-Match condition evaluates to false, and; If-Modified-Since -// condition evaluates to true; then, S3 returns 304 Not Modified response code. -// -// For more information about conditional requests, see RFC 7232 (https://tools.ietf.org/html/rfc7232). -// -// The following operations are related to GetObject: -// -// * ListBuckets -// -// * GetObjectAcl -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObject for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchKey "NoSuchKey" -// The specified key does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject -func (c *S3) GetObject(input *GetObjectInput) (*GetObjectOutput, error) { - req, out := c.GetObjectRequest(input) - return out, req.Send() -} - -// GetObjectWithContext is the same as GetObject with the addition of -// the ability to pass a context and additional request options. -// -// See GetObject for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectWithContext(ctx aws.Context, input *GetObjectInput, opts ...request.Option) (*GetObjectOutput, error) { - req, out := c.GetObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectAcl = "GetObjectAcl" - -// GetObjectAclRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectAcl operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObjectAcl for more information on using the GetObjectAcl -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectAclRequest method. -// req, resp := client.GetObjectAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAcl -func (c *S3) GetObjectAclRequest(input *GetObjectAclInput) (req *request.Request, output *GetObjectAclOutput) { - op := &request.Operation{ - Name: opGetObjectAcl, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?acl", - } - - if input == nil { - input = &GetObjectAclInput{} - } - - output = &GetObjectAclOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectAcl API operation for Amazon Simple Storage Service. -// -// Returns the access control list (ACL) of an object. To use this operation, -// you must have READ_ACP access to the object. -// -// Versioning -// -// By default, GET returns ACL information about the current version of an object. -// To return ACL information about a different version, use the versionId subresource. -// -// The following operations are related to GetObjectAcl: -// -// * GetObject -// -// * DeleteObject -// -// * PutObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObjectAcl for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchKey "NoSuchKey" -// The specified key does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAcl -func (c *S3) GetObjectAcl(input *GetObjectAclInput) (*GetObjectAclOutput, error) { - req, out := c.GetObjectAclRequest(input) - return out, req.Send() -} - -// GetObjectAclWithContext is the same as GetObjectAcl with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectAcl for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectAclWithContext(ctx aws.Context, input *GetObjectAclInput, opts ...request.Option) (*GetObjectAclOutput, error) { - req, out := c.GetObjectAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectLegalHold = "GetObjectLegalHold" - -// GetObjectLegalHoldRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectLegalHold operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObjectLegalHold for more information on using the GetObjectLegalHold -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectLegalHoldRequest method. -// req, resp := client.GetObjectLegalHoldRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectLegalHold -func (c *S3) GetObjectLegalHoldRequest(input *GetObjectLegalHoldInput) (req *request.Request, output *GetObjectLegalHoldOutput) { - op := &request.Operation{ - Name: opGetObjectLegalHold, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?legal-hold", - } - - if input == nil { - input = &GetObjectLegalHoldInput{} - } - - output = &GetObjectLegalHoldOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectLegalHold API operation for Amazon Simple Storage Service. -// -// Gets an object's current Legal Hold status. For more information, see Locking -// Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObjectLegalHold for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectLegalHold -func (c *S3) GetObjectLegalHold(input *GetObjectLegalHoldInput) (*GetObjectLegalHoldOutput, error) { - req, out := c.GetObjectLegalHoldRequest(input) - return out, req.Send() -} - -// GetObjectLegalHoldWithContext is the same as GetObjectLegalHold with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectLegalHold for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectLegalHoldWithContext(ctx aws.Context, input *GetObjectLegalHoldInput, opts ...request.Option) (*GetObjectLegalHoldOutput, error) { - req, out := c.GetObjectLegalHoldRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectLockConfiguration = "GetObjectLockConfiguration" - -// GetObjectLockConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectLockConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObjectLockConfiguration for more information on using the GetObjectLockConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectLockConfigurationRequest method. -// req, resp := client.GetObjectLockConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectLockConfiguration -func (c *S3) GetObjectLockConfigurationRequest(input *GetObjectLockConfigurationInput) (req *request.Request, output *GetObjectLockConfigurationOutput) { - op := &request.Operation{ - Name: opGetObjectLockConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?object-lock", - } - - if input == nil { - input = &GetObjectLockConfigurationInput{} - } - - output = &GetObjectLockConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectLockConfiguration API operation for Amazon Simple Storage Service. -// -// Gets the Object Lock configuration for a bucket. The rule specified in the -// Object Lock configuration will be applied by default to every new object -// placed in the specified bucket. For more information, see Locking Objects -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObjectLockConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectLockConfiguration -func (c *S3) GetObjectLockConfiguration(input *GetObjectLockConfigurationInput) (*GetObjectLockConfigurationOutput, error) { - req, out := c.GetObjectLockConfigurationRequest(input) - return out, req.Send() -} - -// GetObjectLockConfigurationWithContext is the same as GetObjectLockConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectLockConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectLockConfigurationWithContext(ctx aws.Context, input *GetObjectLockConfigurationInput, opts ...request.Option) (*GetObjectLockConfigurationOutput, error) { - req, out := c.GetObjectLockConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectRetention = "GetObjectRetention" - -// GetObjectRetentionRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectRetention operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObjectRetention for more information on using the GetObjectRetention -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectRetentionRequest method. -// req, resp := client.GetObjectRetentionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectRetention -func (c *S3) GetObjectRetentionRequest(input *GetObjectRetentionInput) (req *request.Request, output *GetObjectRetentionOutput) { - op := &request.Operation{ - Name: opGetObjectRetention, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?retention", - } - - if input == nil { - input = &GetObjectRetentionInput{} - } - - output = &GetObjectRetentionOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectRetention API operation for Amazon Simple Storage Service. -// -// Retrieves an object's retention settings. For more information, see Locking -// Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObjectRetention for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectRetention -func (c *S3) GetObjectRetention(input *GetObjectRetentionInput) (*GetObjectRetentionOutput, error) { - req, out := c.GetObjectRetentionRequest(input) - return out, req.Send() -} - -// GetObjectRetentionWithContext is the same as GetObjectRetention with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectRetention for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectRetentionWithContext(ctx aws.Context, input *GetObjectRetentionInput, opts ...request.Option) (*GetObjectRetentionOutput, error) { - req, out := c.GetObjectRetentionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectTagging = "GetObjectTagging" - -// GetObjectTaggingRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectTagging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObjectTagging for more information on using the GetObjectTagging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectTaggingRequest method. -// req, resp := client.GetObjectTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTagging -func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) (req *request.Request, output *GetObjectTaggingOutput) { - op := &request.Operation{ - Name: opGetObjectTagging, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?tagging", - } - - if input == nil { - input = &GetObjectTaggingInput{} - } - - output = &GetObjectTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectTagging API operation for Amazon Simple Storage Service. -// -// Returns the tag-set of an object. You send the GET request against the tagging -// subresource associated with the object. -// -// To use this operation, you must have permission to perform the s3:GetObjectTagging -// action. By default, the GET operation returns information about current version -// of an object. For a versioned bucket, you can have multiple versions of an -// object in your bucket. To retrieve tags of any other version, use the versionId -// query parameter. You also need permission for the s3:GetObjectVersionTagging -// action. -// -// By default, the bucket owner has this permission and can grant this permission -// to others. -// -// For information about the Amazon S3 object tagging feature, see Object Tagging -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). -// -// The following operation is related to GetObjectTagging: -// -// * PutObjectTagging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObjectTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTagging -func (c *S3) GetObjectTagging(input *GetObjectTaggingInput) (*GetObjectTaggingOutput, error) { - req, out := c.GetObjectTaggingRequest(input) - return out, req.Send() -} - -// GetObjectTaggingWithContext is the same as GetObjectTagging with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectTagging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectTaggingWithContext(ctx aws.Context, input *GetObjectTaggingInput, opts ...request.Option) (*GetObjectTaggingOutput, error) { - req, out := c.GetObjectTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectTorrent = "GetObjectTorrent" - -// GetObjectTorrentRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectTorrent operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetObjectTorrent for more information on using the GetObjectTorrent -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetObjectTorrentRequest method. -// req, resp := client.GetObjectTorrentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrent -func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) (req *request.Request, output *GetObjectTorrentOutput) { - op := &request.Operation{ - Name: opGetObjectTorrent, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?torrent", - } - - if input == nil { - input = &GetObjectTorrentInput{} - } - - output = &GetObjectTorrentOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectTorrent API operation for Amazon Simple Storage Service. -// -// Return torrent files from a bucket. BitTorrent can save you bandwidth when -// you're distributing large files. For more information about BitTorrent, see -// Amazon S3 Torrent (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3Torrent.html). -// -// You can get torrent only for objects that are less than 5 GB in size and -// that are not encrypted using server-side encryption with customer-provided -// encryption key. -// -// To use GET, you must have READ access to the object. -// -// The following operation is related to GetObjectTorrent: -// -// * GetObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetObjectTorrent for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrent -func (c *S3) GetObjectTorrent(input *GetObjectTorrentInput) (*GetObjectTorrentOutput, error) { - req, out := c.GetObjectTorrentRequest(input) - return out, req.Send() -} - -// GetObjectTorrentWithContext is the same as GetObjectTorrent with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectTorrent for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetObjectTorrentWithContext(ctx aws.Context, input *GetObjectTorrentInput, opts ...request.Option) (*GetObjectTorrentOutput, error) { - req, out := c.GetObjectTorrentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetPublicAccessBlock = "GetPublicAccessBlock" - -// GetPublicAccessBlockRequest generates a "aws/request.Request" representing the -// client's request for the GetPublicAccessBlock operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetPublicAccessBlock for more information on using the GetPublicAccessBlock -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetPublicAccessBlockRequest method. -// req, resp := client.GetPublicAccessBlockRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetPublicAccessBlock -func (c *S3) GetPublicAccessBlockRequest(input *GetPublicAccessBlockInput) (req *request.Request, output *GetPublicAccessBlockOutput) { - op := &request.Operation{ - Name: opGetPublicAccessBlock, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?publicAccessBlock", - } - - if input == nil { - input = &GetPublicAccessBlockInput{} - } - - output = &GetPublicAccessBlockOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetPublicAccessBlock API operation for Amazon Simple Storage Service. -// -// Retrieves the PublicAccessBlock configuration for an Amazon S3 bucket. To -// use this operation, you must have the s3:GetBucketPublicAccessBlock permission. -// For more information about Amazon S3 permissions, see Specifying Permissions -// in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html). -// -// When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket -// or an object, it checks the PublicAccessBlock configuration for both the -// bucket (or the bucket that contains the object) and the bucket owner's account. -// If the PublicAccessBlock settings are different between the bucket and the -// account, Amazon S3 uses the most restrictive combination of the bucket-level -// and account-level settings. -// -// For more information about when Amazon S3 considers a bucket or an object -// public, see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status). -// -// The following operations are related to GetPublicAccessBlock: -// -// * Using Amazon S3 Block Public Access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) -// -// * PutPublicAccessBlock -// -// * GetPublicAccessBlock -// -// * DeletePublicAccessBlock -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation GetPublicAccessBlock for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetPublicAccessBlock -func (c *S3) GetPublicAccessBlock(input *GetPublicAccessBlockInput) (*GetPublicAccessBlockOutput, error) { - req, out := c.GetPublicAccessBlockRequest(input) - return out, req.Send() -} - -// GetPublicAccessBlockWithContext is the same as GetPublicAccessBlock with the addition of -// the ability to pass a context and additional request options. -// -// See GetPublicAccessBlock for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) GetPublicAccessBlockWithContext(ctx aws.Context, input *GetPublicAccessBlockInput, opts ...request.Option) (*GetPublicAccessBlockOutput, error) { - req, out := c.GetPublicAccessBlockRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opHeadBucket = "HeadBucket" - -// HeadBucketRequest generates a "aws/request.Request" representing the -// client's request for the HeadBucket operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See HeadBucket for more information on using the HeadBucket -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the HeadBucketRequest method. -// req, resp := client.HeadBucketRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucket -func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *request.Request, output *HeadBucketOutput) { - op := &request.Operation{ - Name: opHeadBucket, - HTTPMethod: "HEAD", - HTTPPath: "/{Bucket}", - } - - if input == nil { - input = &HeadBucketInput{} - } - - output = &HeadBucketOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// HeadBucket API operation for Amazon Simple Storage Service. -// -// This operation is useful to determine if a bucket exists and you have permission -// to access it. The operation returns a 200 OK if the bucket exists and you -// have permission to access it. Otherwise, the operation might return responses -// such as 404 Not Found and 403 Forbidden. -// -// To use this operation, you must have permissions to perform the s3:ListBucket -// action. The bucket owner has this permission by default and can grant this -// permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation HeadBucket for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchBucket "NoSuchBucket" -// The specified bucket does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucket -func (c *S3) HeadBucket(input *HeadBucketInput) (*HeadBucketOutput, error) { - req, out := c.HeadBucketRequest(input) - return out, req.Send() -} - -// HeadBucketWithContext is the same as HeadBucket with the addition of -// the ability to pass a context and additional request options. -// -// See HeadBucket for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) HeadBucketWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.Option) (*HeadBucketOutput, error) { - req, out := c.HeadBucketRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opHeadObject = "HeadObject" - -// HeadObjectRequest generates a "aws/request.Request" representing the -// client's request for the HeadObject operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See HeadObject for more information on using the HeadObject -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the HeadObjectRequest method. -// req, resp := client.HeadObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObject -func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, output *HeadObjectOutput) { - op := &request.Operation{ - Name: opHeadObject, - HTTPMethod: "HEAD", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &HeadObjectInput{} - } - - output = &HeadObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// HeadObject API operation for Amazon Simple Storage Service. -// -// The HEAD operation retrieves metadata from an object without returning the -// object itself. This operation is useful if you're only interested in an object's -// metadata. To use HEAD, you must have READ access to the object. -// -// A HEAD request has the same options as a GET operation on an object. The -// response is identical to the GET response except that there is no response -// body. -// -// If you encrypt an object by using server-side encryption with customer-provided -// encryption keys (SSE-C) when you store the object in Amazon S3, then when -// you retrieve the metadata from the object, you must use the following headers: -// -// * x-amz-server-side​-encryption​-customer-algorithm -// -// * x-amz-server-side​-encryption​-customer-key -// -// * x-amz-server-side​-encryption​-customer-key-MD5 -// -// For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided -// Encryption Keys) (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). -// -// Encryption request headers, like x-amz-server-side-encryption, should not -// be sent for GET requests if your object uses server-side encryption with -// CMKs stored in AWS KMS (SSE-KMS) or server-side encryption with Amazon S3–managed -// encryption keys (SSE-S3). If your object does use these types of keys, you’ll -// get an HTTP 400 BadRequest error. -// -// Request headers are limited to 8 KB in size. For more information, see Common -// Request Headers (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html). -// -// Consider the following when using request headers: -// -// * Consideration 1 – If both of the If-Match and If-Unmodified-Since -// headers are present in the request as follows: If-Match condition evaluates -// to true, and; If-Unmodified-Since condition evaluates to false; Then Amazon -// S3 returns 200 OK and the data requested. -// -// * Consideration 2 – If both of the If-None-Match and If-Modified-Since -// headers are present in the request as follows: If-None-Match condition -// evaluates to false, and; If-Modified-Since condition evaluates to true; -// Then Amazon S3 returns the 304 Not Modified response code. -// -// For more information about conditional requests, see RFC 7232 (https://tools.ietf.org/html/rfc7232). -// -// Permissions -// -// You need the s3:GetObject permission for this operation. For more information, -// see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html). -// If the object you request does not exist, the error Amazon S3 returns depends -// on whether you also have the s3:ListBucket permission. -// -// * If you have the s3:ListBucket permission on the bucket, Amazon S3 returns -// an HTTP status code 404 ("no such key") error. -// -// * If you don’t have the s3:ListBucket permission, Amazon S3 returns -// an HTTP status code 403 ("access denied") error. -// -// The following operation is related to HeadObject: -// -// * GetObject -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses -// for more information on returned errors. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation HeadObject for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObject -func (c *S3) HeadObject(input *HeadObjectInput) (*HeadObjectOutput, error) { - req, out := c.HeadObjectRequest(input) - return out, req.Send() -} - -// HeadObjectWithContext is the same as HeadObject with the addition of -// the ability to pass a context and additional request options. -// -// See HeadObject for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) HeadObjectWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.Option) (*HeadObjectOutput, error) { - req, out := c.HeadObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBucketAnalyticsConfigurations = "ListBucketAnalyticsConfigurations" - -// ListBucketAnalyticsConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the ListBucketAnalyticsConfigurations operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListBucketAnalyticsConfigurations for more information on using the ListBucketAnalyticsConfigurations -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListBucketAnalyticsConfigurationsRequest method. -// req, resp := client.ListBucketAnalyticsConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurations -func (c *S3) ListBucketAnalyticsConfigurationsRequest(input *ListBucketAnalyticsConfigurationsInput) (req *request.Request, output *ListBucketAnalyticsConfigurationsOutput) { - op := &request.Operation{ - Name: opListBucketAnalyticsConfigurations, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &ListBucketAnalyticsConfigurationsInput{} - } - - output = &ListBucketAnalyticsConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBucketAnalyticsConfigurations API operation for Amazon Simple Storage Service. -// -// Lists the analytics configurations for the bucket. You can have up to 1,000 -// analytics configurations per bucket. -// -// This operation supports list pagination and does not return more than 100 -// configurations at a time. You should always check the IsTruncated element -// in the response. If there are no more configurations to list, IsTruncated -// is set to false. If there are more configurations to list, IsTruncated is -// set to true, and there will be a value in NextContinuationToken. You use -// the NextContinuationToken value to continue the pagination of the list by -// passing the value in continuation-token in the request to GET the next page. -// -// To use this operation, you must have permissions to perform the s3:GetAnalyticsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about Amazon S3 analytics feature, see Amazon S3 Analytics -// – Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html). -// -// The following operations are related to ListBucketAnalyticsConfigurations: -// -// * GetBucketAnalyticsConfiguration -// -// * DeleteBucketAnalyticsConfiguration -// -// * PutBucketAnalyticsConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListBucketAnalyticsConfigurations for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurations -func (c *S3) ListBucketAnalyticsConfigurations(input *ListBucketAnalyticsConfigurationsInput) (*ListBucketAnalyticsConfigurationsOutput, error) { - req, out := c.ListBucketAnalyticsConfigurationsRequest(input) - return out, req.Send() -} - -// ListBucketAnalyticsConfigurationsWithContext is the same as ListBucketAnalyticsConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See ListBucketAnalyticsConfigurations for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListBucketAnalyticsConfigurationsWithContext(ctx aws.Context, input *ListBucketAnalyticsConfigurationsInput, opts ...request.Option) (*ListBucketAnalyticsConfigurationsOutput, error) { - req, out := c.ListBucketAnalyticsConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBucketInventoryConfigurations = "ListBucketInventoryConfigurations" - -// ListBucketInventoryConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the ListBucketInventoryConfigurations operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListBucketInventoryConfigurations for more information on using the ListBucketInventoryConfigurations -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListBucketInventoryConfigurationsRequest method. -// req, resp := client.ListBucketInventoryConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurations -func (c *S3) ListBucketInventoryConfigurationsRequest(input *ListBucketInventoryConfigurationsInput) (req *request.Request, output *ListBucketInventoryConfigurationsOutput) { - op := &request.Operation{ - Name: opListBucketInventoryConfigurations, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &ListBucketInventoryConfigurationsInput{} - } - - output = &ListBucketInventoryConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBucketInventoryConfigurations API operation for Amazon Simple Storage Service. -// -// Returns a list of inventory configurations for the bucket. You can have up -// to 1,000 analytics configurations per bucket. -// -// This operation supports list pagination and does not return more than 100 -// configurations at a time. Always check the IsTruncated element in the response. -// If there are no more configurations to list, IsTruncated is set to false. -// If there are more configurations to list, IsTruncated is set to true, and -// there is a value in NextContinuationToken. You use the NextContinuationToken -// value to continue the pagination of the list by passing the value in continuation-token -// in the request to GET the next page. -// -// To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about the Amazon S3 inventory feature, see Amazon S3 Inventory -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) -// -// The following operations are related to ListBucketInventoryConfigurations: -// -// * GetBucketInventoryConfiguration -// -// * DeleteBucketInventoryConfiguration -// -// * PutBucketInventoryConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListBucketInventoryConfigurations for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurations -func (c *S3) ListBucketInventoryConfigurations(input *ListBucketInventoryConfigurationsInput) (*ListBucketInventoryConfigurationsOutput, error) { - req, out := c.ListBucketInventoryConfigurationsRequest(input) - return out, req.Send() -} - -// ListBucketInventoryConfigurationsWithContext is the same as ListBucketInventoryConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See ListBucketInventoryConfigurations for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListBucketInventoryConfigurationsWithContext(ctx aws.Context, input *ListBucketInventoryConfigurationsInput, opts ...request.Option) (*ListBucketInventoryConfigurationsOutput, error) { - req, out := c.ListBucketInventoryConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBucketMetricsConfigurations = "ListBucketMetricsConfigurations" - -// ListBucketMetricsConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the ListBucketMetricsConfigurations operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListBucketMetricsConfigurations for more information on using the ListBucketMetricsConfigurations -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListBucketMetricsConfigurationsRequest method. -// req, resp := client.ListBucketMetricsConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurations -func (c *S3) ListBucketMetricsConfigurationsRequest(input *ListBucketMetricsConfigurationsInput) (req *request.Request, output *ListBucketMetricsConfigurationsOutput) { - op := &request.Operation{ - Name: opListBucketMetricsConfigurations, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &ListBucketMetricsConfigurationsInput{} - } - - output = &ListBucketMetricsConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBucketMetricsConfigurations API operation for Amazon Simple Storage Service. -// -// Lists the metrics configurations for the bucket. The metrics configurations -// are only for the request metrics of the bucket and do not provide information -// on daily storage metrics. You can have up to 1,000 configurations per bucket. -// -// This operation supports list pagination and does not return more than 100 -// configurations at a time. Always check the IsTruncated element in the response. -// If there are no more configurations to list, IsTruncated is set to false. -// If there are more configurations to list, IsTruncated is set to true, and -// there is a value in NextContinuationToken. You use the NextContinuationToken -// value to continue the pagination of the list by passing the value in continuation-token -// in the request to GET the next page. -// -// To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For more information about metrics configurations and CloudWatch request -// metrics, see Monitoring Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). -// -// The following operations are related to ListBucketMetricsConfigurations: -// -// * PutBucketMetricsConfiguration -// -// * GetBucketMetricsConfiguration -// -// * DeleteBucketMetricsConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListBucketMetricsConfigurations for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurations -func (c *S3) ListBucketMetricsConfigurations(input *ListBucketMetricsConfigurationsInput) (*ListBucketMetricsConfigurationsOutput, error) { - req, out := c.ListBucketMetricsConfigurationsRequest(input) - return out, req.Send() -} - -// ListBucketMetricsConfigurationsWithContext is the same as ListBucketMetricsConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See ListBucketMetricsConfigurations for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListBucketMetricsConfigurationsWithContext(ctx aws.Context, input *ListBucketMetricsConfigurationsInput, opts ...request.Option) (*ListBucketMetricsConfigurationsOutput, error) { - req, out := c.ListBucketMetricsConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBuckets = "ListBuckets" - -// ListBucketsRequest generates a "aws/request.Request" representing the -// client's request for the ListBuckets operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListBuckets for more information on using the ListBuckets -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListBucketsRequest method. -// req, resp := client.ListBucketsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets -func (c *S3) ListBucketsRequest(input *ListBucketsInput) (req *request.Request, output *ListBucketsOutput) { - op := &request.Operation{ - Name: opListBuckets, - HTTPMethod: "GET", - HTTPPath: "/", - } - - if input == nil { - input = &ListBucketsInput{} - } - - output = &ListBucketsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBuckets API operation for Amazon Simple Storage Service. -// -// Returns a list of all buckets owned by the authenticated sender of the request. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListBuckets for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets -func (c *S3) ListBuckets(input *ListBucketsInput) (*ListBucketsOutput, error) { - req, out := c.ListBucketsRequest(input) - return out, req.Send() -} - -// ListBucketsWithContext is the same as ListBuckets with the addition of -// the ability to pass a context and additional request options. -// -// See ListBuckets for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListBucketsWithContext(ctx aws.Context, input *ListBucketsInput, opts ...request.Option) (*ListBucketsOutput, error) { - req, out := c.ListBucketsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListMultipartUploads = "ListMultipartUploads" - -// ListMultipartUploadsRequest generates a "aws/request.Request" representing the -// client's request for the ListMultipartUploads operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListMultipartUploads for more information on using the ListMultipartUploads -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListMultipartUploadsRequest method. -// req, resp := client.ListMultipartUploadsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploads -func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req *request.Request, output *ListMultipartUploadsOutput) { - op := &request.Operation{ - Name: opListMultipartUploads, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?uploads", - Paginator: &request.Paginator{ - InputTokens: []string{"KeyMarker", "UploadIdMarker"}, - OutputTokens: []string{"NextKeyMarker", "NextUploadIdMarker"}, - LimitToken: "MaxUploads", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListMultipartUploadsInput{} - } - - output = &ListMultipartUploadsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListMultipartUploads API operation for Amazon Simple Storage Service. -// -// This operation lists in-progress multipart uploads. An in-progress multipart -// upload is a multipart upload that has been initiated using the Initiate Multipart -// Upload request, but has not yet been completed or aborted. -// -// This operation returns at most 1,000 multipart uploads in the response. 1,000 -// multipart uploads is the maximum number of uploads a response can include, -// which is also the default value. You can further limit the number of uploads -// in a response by specifying the max-uploads parameter in the response. If -// additional multipart uploads satisfy the list criteria, the response will -// contain an IsTruncated element with the value true. To list the additional -// multipart uploads, use the key-marker and upload-id-marker request parameters. -// -// In the response, the uploads are sorted by key. If your application has initiated -// more than one multipart upload using the same object key, then uploads in -// the response are first sorted by key. Additionally, uploads are sorted in -// ascending order within each key by the upload initiation time. -// -// For more information on multipart uploads, see Uploading Objects Using Multipart -// Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html). -// -// For information on permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). -// -// The following operations are related to ListMultipartUploads: -// -// * CreateMultipartUpload -// -// * UploadPart -// -// * CompleteMultipartUpload -// -// * ListParts -// -// * AbortMultipartUpload -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListMultipartUploads for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploads -func (c *S3) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListMultipartUploadsOutput, error) { - req, out := c.ListMultipartUploadsRequest(input) - return out, req.Send() -} - -// ListMultipartUploadsWithContext is the same as ListMultipartUploads with the addition of -// the ability to pass a context and additional request options. -// -// See ListMultipartUploads for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListMultipartUploadsWithContext(ctx aws.Context, input *ListMultipartUploadsInput, opts ...request.Option) (*ListMultipartUploadsOutput, error) { - req, out := c.ListMultipartUploadsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListMultipartUploadsPages iterates over the pages of a ListMultipartUploads operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListMultipartUploads method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListMultipartUploads operation. -// pageNum := 0 -// err := client.ListMultipartUploadsPages(params, -// func(page *s3.ListMultipartUploadsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool) error { - return c.ListMultipartUploadsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListMultipartUploadsPagesWithContext same as ListMultipartUploadsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListMultipartUploadsPagesWithContext(ctx aws.Context, input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListMultipartUploadsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListMultipartUploadsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListMultipartUploadsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListObjectVersions = "ListObjectVersions" - -// ListObjectVersionsRequest generates a "aws/request.Request" representing the -// client's request for the ListObjectVersions operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListObjectVersions for more information on using the ListObjectVersions -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListObjectVersionsRequest method. -// req, resp := client.ListObjectVersionsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersions -func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) (req *request.Request, output *ListObjectVersionsOutput) { - op := &request.Operation{ - Name: opListObjectVersions, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?versions", - Paginator: &request.Paginator{ - InputTokens: []string{"KeyMarker", "VersionIdMarker"}, - OutputTokens: []string{"NextKeyMarker", "NextVersionIdMarker"}, - LimitToken: "MaxKeys", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListObjectVersionsInput{} - } - - output = &ListObjectVersionsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListObjectVersions API operation for Amazon Simple Storage Service. -// -// Returns metadata about all of the versions of objects in a bucket. You can -// also use request parameters as selection criteria to return metadata about -// a subset of all the object versions. -// -// A 200 OK response can contain valid or invalid XML. Make sure to design your -// application to parse the contents of the response and handle it appropriately. -// -// To use this operation, you must have READ access to the bucket. -// -// The following operations are related to ListObjectVersions: -// -// * ListObjectsV2 -// -// * GetObject -// -// * PutObject -// -// * DeleteObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListObjectVersions for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersions -func (c *S3) ListObjectVersions(input *ListObjectVersionsInput) (*ListObjectVersionsOutput, error) { - req, out := c.ListObjectVersionsRequest(input) - return out, req.Send() -} - -// ListObjectVersionsWithContext is the same as ListObjectVersions with the addition of -// the ability to pass a context and additional request options. -// -// See ListObjectVersions for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListObjectVersionsWithContext(ctx aws.Context, input *ListObjectVersionsInput, opts ...request.Option) (*ListObjectVersionsOutput, error) { - req, out := c.ListObjectVersionsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListObjectVersionsPages iterates over the pages of a ListObjectVersions operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListObjectVersions method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListObjectVersions operation. -// pageNum := 0 -// err := client.ListObjectVersionsPages(params, -// func(page *s3.ListObjectVersionsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListObjectVersionsPages(input *ListObjectVersionsInput, fn func(*ListObjectVersionsOutput, bool) bool) error { - return c.ListObjectVersionsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListObjectVersionsPagesWithContext same as ListObjectVersionsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListObjectVersionsPagesWithContext(ctx aws.Context, input *ListObjectVersionsInput, fn func(*ListObjectVersionsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListObjectVersionsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListObjectVersionsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListObjectVersionsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListObjects = "ListObjects" - -// ListObjectsRequest generates a "aws/request.Request" representing the -// client's request for the ListObjects operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListObjects for more information on using the ListObjects -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListObjectsRequest method. -// req, resp := client.ListObjectsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects -func (c *S3) ListObjectsRequest(input *ListObjectsInput) (req *request.Request, output *ListObjectsOutput) { - op := &request.Operation{ - Name: opListObjects, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker || Contents[-1].Key"}, - LimitToken: "MaxKeys", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListObjectsInput{} - } - - output = &ListObjectsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListObjects API operation for Amazon Simple Storage Service. -// -// Returns some or all (up to 1,000) of the objects in a bucket. You can use -// the request parameters as selection criteria to return a subset of the objects -// in a bucket. A 200 OK response can contain valid or invalid XML. Be sure -// to design your application to parse the contents of the response and handle -// it appropriately. -// -// This API has been revised. We recommend that you use the newer version, ListObjectsV2, -// when developing applications. For backward compatibility, Amazon S3 continues -// to support ListObjects. -// -// The following operations are related to ListObjects: -// -// * ListObjectsV2 -// -// * GetObject -// -// * PutObject -// -// * CreateBucket -// -// * ListBuckets -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListObjects for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchBucket "NoSuchBucket" -// The specified bucket does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects -func (c *S3) ListObjects(input *ListObjectsInput) (*ListObjectsOutput, error) { - req, out := c.ListObjectsRequest(input) - return out, req.Send() -} - -// ListObjectsWithContext is the same as ListObjects with the addition of -// the ability to pass a context and additional request options. -// -// See ListObjects for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListObjectsWithContext(ctx aws.Context, input *ListObjectsInput, opts ...request.Option) (*ListObjectsOutput, error) { - req, out := c.ListObjectsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListObjectsPages iterates over the pages of a ListObjects operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListObjects method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListObjects operation. -// pageNum := 0 -// err := client.ListObjectsPages(params, -// func(page *s3.ListObjectsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListObjectsPages(input *ListObjectsInput, fn func(*ListObjectsOutput, bool) bool) error { - return c.ListObjectsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListObjectsPagesWithContext same as ListObjectsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListObjectsPagesWithContext(ctx aws.Context, input *ListObjectsInput, fn func(*ListObjectsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListObjectsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListObjectsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListObjectsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListObjectsV2 = "ListObjectsV2" - -// ListObjectsV2Request generates a "aws/request.Request" representing the -// client's request for the ListObjectsV2 operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListObjectsV2 for more information on using the ListObjectsV2 -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListObjectsV2Request method. -// req, resp := client.ListObjectsV2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2 -func (c *S3) ListObjectsV2Request(input *ListObjectsV2Input) (req *request.Request, output *ListObjectsV2Output) { - op := &request.Operation{ - Name: opListObjectsV2, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?list-type=2", - Paginator: &request.Paginator{ - InputTokens: []string{"ContinuationToken"}, - OutputTokens: []string{"NextContinuationToken"}, - LimitToken: "MaxKeys", - TruncationToken: "", - }, - } - - if input == nil { - input = &ListObjectsV2Input{} - } - - output = &ListObjectsV2Output{} - req = c.newRequest(op, input, output) - return -} - -// ListObjectsV2 API operation for Amazon Simple Storage Service. -// -// Returns some or all (up to 1,000) of the objects in a bucket. You can use -// the request parameters as selection criteria to return a subset of the objects -// in a bucket. A 200 OK response can contain valid or invalid XML. Make sure -// to design your application to parse the contents of the response and handle -// it appropriately. -// -// To use this operation, you must have READ access to the bucket. -// -// To use this operation in an AWS Identity and Access Management (IAM) policy, -// you must have permissions to perform the s3:ListBucket action. The bucket -// owner has this permission by default and can grant this permission to others. -// For more information about permissions, see Permissions Related to Bucket -// Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// This section describes the latest revision of the API. We recommend that -// you use this revised API for application development. For backward compatibility, -// Amazon S3 continues to support the prior version of this API, ListObjects. -// -// To get a list of your buckets, see ListBuckets. -// -// The following operations are related to ListObjectsV2: -// -// * GetObject -// -// * PutObject -// -// * CreateBucket -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListObjectsV2 for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchBucket "NoSuchBucket" -// The specified bucket does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2 -func (c *S3) ListObjectsV2(input *ListObjectsV2Input) (*ListObjectsV2Output, error) { - req, out := c.ListObjectsV2Request(input) - return out, req.Send() -} - -// ListObjectsV2WithContext is the same as ListObjectsV2 with the addition of -// the ability to pass a context and additional request options. -// -// See ListObjectsV2 for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListObjectsV2WithContext(ctx aws.Context, input *ListObjectsV2Input, opts ...request.Option) (*ListObjectsV2Output, error) { - req, out := c.ListObjectsV2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListObjectsV2Pages iterates over the pages of a ListObjectsV2 operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListObjectsV2 method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListObjectsV2 operation. -// pageNum := 0 -// err := client.ListObjectsV2Pages(params, -// func(page *s3.ListObjectsV2Output, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListObjectsV2Pages(input *ListObjectsV2Input, fn func(*ListObjectsV2Output, bool) bool) error { - return c.ListObjectsV2PagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListObjectsV2PagesWithContext same as ListObjectsV2Pages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListObjectsV2PagesWithContext(ctx aws.Context, input *ListObjectsV2Input, fn func(*ListObjectsV2Output, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListObjectsV2Input - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListObjectsV2Request(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListObjectsV2Output), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opListParts = "ListParts" - -// ListPartsRequest generates a "aws/request.Request" representing the -// client's request for the ListParts operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See ListParts for more information on using the ListParts -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the ListPartsRequest method. -// req, resp := client.ListPartsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListParts -func (c *S3) ListPartsRequest(input *ListPartsInput) (req *request.Request, output *ListPartsOutput) { - op := &request.Operation{ - Name: opListParts, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - Paginator: &request.Paginator{ - InputTokens: []string{"PartNumberMarker"}, - OutputTokens: []string{"NextPartNumberMarker"}, - LimitToken: "MaxParts", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListPartsInput{} - } - - output = &ListPartsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListParts API operation for Amazon Simple Storage Service. -// -// Lists the parts that have been uploaded for a specific multipart upload. -// This operation must include the upload ID, which you obtain by sending the -// initiate multipart upload request (see CreateMultipartUpload). This request -// returns a maximum of 1,000 uploaded parts. The default number of parts returned -// is 1,000 parts. You can restrict the number of parts returned by specifying -// the max-parts request parameter. If your multipart upload consists of more -// than 1,000 parts, the response returns an IsTruncated field with the value -// of true, and a NextPartNumberMarker element. In subsequent ListParts requests -// you can include the part-number-marker query string parameter and set its -// value to the NextPartNumberMarker field value from the previous response. -// -// For more information on multipart uploads, see Uploading Objects Using Multipart -// Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html). -// -// For information on permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). -// -// The following operations are related to ListParts: -// -// * CreateMultipartUpload -// -// * UploadPart -// -// * CompleteMultipartUpload -// -// * AbortMultipartUpload -// -// * ListMultipartUploads -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation ListParts for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListParts -func (c *S3) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { - req, out := c.ListPartsRequest(input) - return out, req.Send() -} - -// ListPartsWithContext is the same as ListParts with the addition of -// the ability to pass a context and additional request options. -// -// See ListParts for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListPartsWithContext(ctx aws.Context, input *ListPartsInput, opts ...request.Option) (*ListPartsOutput, error) { - req, out := c.ListPartsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListPartsPages iterates over the pages of a ListParts operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListParts method for more information on how to use this operation. -// -// Note: This operation can generate multiple requests to a service. -// -// // Example iterating over at most 3 pages of a ListParts operation. -// pageNum := 0 -// err := client.ListPartsPages(params, -// func(page *s3.ListPartsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListPartsPages(input *ListPartsInput, fn func(*ListPartsOutput, bool) bool) error { - return c.ListPartsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListPartsPagesWithContext same as ListPartsPages except -// it takes a Context and allows setting request options on the pages. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) ListPartsPagesWithContext(ctx aws.Context, input *ListPartsInput, fn func(*ListPartsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListPartsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListPartsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - for p.Next() { - if !fn(p.Page().(*ListPartsOutput), !p.HasNextPage()) { - break - } - } - - return p.Err() -} - -const opPutBucketAccelerateConfiguration = "PutBucketAccelerateConfiguration" - -// PutBucketAccelerateConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketAccelerateConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketAccelerateConfiguration for more information on using the PutBucketAccelerateConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketAccelerateConfigurationRequest method. -// req, resp := client.PutBucketAccelerateConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfiguration -func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateConfigurationInput) (req *request.Request, output *PutBucketAccelerateConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketAccelerateConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?accelerate", - } - - if input == nil { - input = &PutBucketAccelerateConfigurationInput{} - } - - output = &PutBucketAccelerateConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketAccelerateConfiguration API operation for Amazon Simple Storage Service. -// -// Sets the accelerate configuration of an existing bucket. Amazon S3 Transfer -// Acceleration is a bucket-level feature that enables you to perform faster -// data transfers to Amazon S3. -// -// To use this operation, you must have permission to perform the s3:PutAccelerateConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// The Transfer Acceleration state of a bucket can be set to one of the following -// two values: -// -// * Enabled – Enables accelerated data transfers to the bucket. -// -// * Suspended – Disables accelerated data transfers to the bucket. -// -// The GetBucketAccelerateConfiguration operation returns the transfer acceleration -// state of a bucket. -// -// After setting the Transfer Acceleration state of a bucket to Enabled, it -// might take up to thirty minutes before the data transfer rates to the bucket -// increase. -// -// The name of the bucket used for Transfer Acceleration must be DNS-compliant -// and must not contain periods ("."). -// -// For more information about transfer acceleration, see Transfer Acceleration -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html). -// -// The following operations are related to PutBucketAccelerateConfiguration: -// -// * GetBucketAccelerateConfiguration -// -// * CreateBucket -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketAccelerateConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfiguration -func (c *S3) PutBucketAccelerateConfiguration(input *PutBucketAccelerateConfigurationInput) (*PutBucketAccelerateConfigurationOutput, error) { - req, out := c.PutBucketAccelerateConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketAccelerateConfigurationWithContext is the same as PutBucketAccelerateConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketAccelerateConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketAccelerateConfigurationWithContext(ctx aws.Context, input *PutBucketAccelerateConfigurationInput, opts ...request.Option) (*PutBucketAccelerateConfigurationOutput, error) { - req, out := c.PutBucketAccelerateConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketAcl = "PutBucketAcl" - -// PutBucketAclRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketAcl operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketAcl for more information on using the PutBucketAcl -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketAclRequest method. -// req, resp := client.PutBucketAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAcl -func (c *S3) PutBucketAclRequest(input *PutBucketAclInput) (req *request.Request, output *PutBucketAclOutput) { - op := &request.Operation{ - Name: opPutBucketAcl, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?acl", - } - - if input == nil { - input = &PutBucketAclInput{} - } - - output = &PutBucketAclOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketAcl API operation for Amazon Simple Storage Service. -// -// Sets the permissions on an existing bucket using access control lists (ACL). -// For more information, see Using ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html). -// To set the ACL of a bucket, you must have WRITE_ACP permission. -// -// You can use one of the following two ways to set a bucket's permissions: -// -// * Specify the ACL in the request body -// -// * Specify permissions using request headers -// -// You cannot specify access permission using both the body and the request -// headers. -// -// Depending on your application needs, you may choose to set the ACL on a bucket -// using either the request body or the headers. For example, if you have an -// existing application that updates a bucket ACL using the request body, then -// you can continue to use that approach. -// -// Access Permissions -// -// You can set access permissions using one of the following methods: -// -// * Specify a canned ACL with the x-amz-acl request header. Amazon S3 supports -// a set of predefined ACLs, known as canned ACLs. Each canned ACL has a -// predefined set of grantees and permissions. Specify the canned ACL name -// as the value of x-amz-acl. If you use this header, you cannot use other -// access control-specific headers in your request. For more information, -// see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). -// -// * Specify access permissions explicitly with the x-amz-grant-read, x-amz-grant-read-acp, -// x-amz-grant-write-acp, and x-amz-grant-full-control headers. When using -// these headers, you specify explicit access permissions and grantees (AWS -// accounts or Amazon S3 groups) who will receive the permission. If you -// use these ACL-specific headers, you cannot use the x-amz-acl header to -// set a canned ACL. These parameters map to the set of permissions that -// Amazon S3 supports in an ACL. For more information, see Access Control -// List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html). -// You specify each grantee as a type=value pair, where the type is one of -// the following: id – if the value specified is the canonical user ID -// of an AWS account uri – if you are granting permissions to a predefined -// group emailAddress – if the value specified is the email address of -// an AWS account Using email addresses to specify a grantee is only supported -// in the following AWS Regions: US East (N. Virginia) US West (N. California) -// US West (Oregon) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific -// (Tokyo) Europe (Ireland) South America (São Paulo) For a list of all -// the Amazon S3 supported Regions and endpoints, see Regions and Endpoints -// (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in -// the AWS General Reference. For example, the following x-amz-grant-write -// header grants create, overwrite, and delete objects permission to LogDelivery -// group predefined by Amazon S3 and two AWS accounts identified by their -// email addresses. x-amz-grant-write: uri="http://acs.amazonaws.com/groups/s3/LogDelivery", -// id="111122223333", id="555566667777" -// -// You can use either a canned ACL or specify access permissions explicitly. -// You cannot do both. -// -// Grantee Values -// -// You can specify the person (grantee) to whom you're assigning access rights -// (using request elements) in the following ways: -// -// * By the person's ID: <>ID<><>GranteesEmail<> -// DisplayName is optional and ignored in the request -// -// * By URI: <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<> -// -// * By Email address: <>Grantees@email.com<>lt;/Grantee> -// The grantee is resolved to the CanonicalUser and, in a response to a GET -// Object acl request, appears as the CanonicalUser. Using email addresses -// to specify a grantee is only supported in the following AWS Regions: US -// East (N. Virginia) US West (N. California) US West (Oregon) Asia Pacific -// (Singapore) Asia Pacific (Sydney) Asia Pacific (Tokyo) Europe (Ireland) -// South America (São Paulo) For a list of all the Amazon S3 supported Regions -// and endpoints, see Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) -// in the AWS General Reference. -// -// Related Resources -// -// * CreateBucket -// -// * DeleteBucket -// -// * GetObjectAcl -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketAcl for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAcl -func (c *S3) PutBucketAcl(input *PutBucketAclInput) (*PutBucketAclOutput, error) { - req, out := c.PutBucketAclRequest(input) - return out, req.Send() -} - -// PutBucketAclWithContext is the same as PutBucketAcl with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketAcl for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketAclWithContext(ctx aws.Context, input *PutBucketAclInput, opts ...request.Option) (*PutBucketAclOutput, error) { - req, out := c.PutBucketAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketAnalyticsConfiguration = "PutBucketAnalyticsConfiguration" - -// PutBucketAnalyticsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketAnalyticsConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketAnalyticsConfiguration for more information on using the PutBucketAnalyticsConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketAnalyticsConfigurationRequest method. -// req, resp := client.PutBucketAnalyticsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfiguration -func (c *S3) PutBucketAnalyticsConfigurationRequest(input *PutBucketAnalyticsConfigurationInput) (req *request.Request, output *PutBucketAnalyticsConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketAnalyticsConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &PutBucketAnalyticsConfigurationInput{} - } - - output = &PutBucketAnalyticsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. -// -// Sets an analytics configuration for the bucket (specified by the analytics -// configuration ID). You can have up to 1,000 analytics configurations per -// bucket. -// -// You can choose to have storage class analysis export analysis reports sent -// to a comma-separated values (CSV) flat file. See the DataExport request element. -// Reports are updated daily and are based on the object filters that you configure. -// When selecting data export, you specify a destination bucket and an optional -// destination prefix where the file is written. You can export the data to -// a destination bucket in a different account. However, the destination bucket -// must be in the same Region as the bucket that you are making the PUT analytics -// configuration to. For more information, see Amazon S3 Analytics – Storage -// Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html). -// -// You must create a bucket policy on the destination bucket where the exported -// file is written to grant permissions to Amazon S3 to write objects to the -// bucket. For an example policy, see Granting Permissions for Amazon S3 Inventory -// and Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-9). -// -// To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// Special Errors -// -// * HTTP Error: HTTP 400 Bad Request Code: InvalidArgument Cause: Invalid -// argument. -// -// * HTTP Error: HTTP 400 Bad Request Code: TooManyConfigurations Cause: -// You are attempting to create a new configuration but have already reached -// the 1,000-configuration limit. -// -// * HTTP Error: HTTP 403 Forbidden Code: AccessDenied Cause: You are not -// the owner of the specified bucket, or you do not have the s3:PutAnalyticsConfiguration -// bucket permission to set the configuration on the bucket. -// -// Related Resources -// -// * -// -// * -// -// * -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketAnalyticsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfiguration -func (c *S3) PutBucketAnalyticsConfiguration(input *PutBucketAnalyticsConfigurationInput) (*PutBucketAnalyticsConfigurationOutput, error) { - req, out := c.PutBucketAnalyticsConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketAnalyticsConfigurationWithContext is the same as PutBucketAnalyticsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketAnalyticsConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *PutBucketAnalyticsConfigurationInput, opts ...request.Option) (*PutBucketAnalyticsConfigurationOutput, error) { - req, out := c.PutBucketAnalyticsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketCors = "PutBucketCors" - -// PutBucketCorsRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketCors operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketCors for more information on using the PutBucketCors -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketCorsRequest method. -// req, resp := client.PutBucketCorsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCors -func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) (req *request.Request, output *PutBucketCorsOutput) { - op := &request.Operation{ - Name: opPutBucketCors, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?cors", - } - - if input == nil { - input = &PutBucketCorsInput{} - } - - output = &PutBucketCorsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketCors API operation for Amazon Simple Storage Service. -// -// Sets the cors configuration for your bucket. If the configuration exists, -// Amazon S3 replaces it. -// -// To use this operation, you must be allowed to perform the s3:PutBucketCORS -// action. By default, the bucket owner has this permission and can grant it -// to others. -// -// You set this configuration on a bucket so that the bucket can service cross-origin -// requests. For example, you might want to enable a request whose origin is -// http://www.example.com to access your Amazon S3 bucket at my.example.bucket.com -// by using the browser's XMLHttpRequest capability. -// -// To enable cross-origin resource sharing (CORS) on a bucket, you add the cors -// subresource to the bucket. The cors subresource is an XML document in which -// you configure rules that identify origins and the HTTP methods that can be -// executed on your bucket. The document is limited to 64 KB in size. -// -// When Amazon S3 receives a cross-origin request (or a pre-flight OPTIONS request) -// against a bucket, it evaluates the cors configuration on the bucket and uses -// the first CORSRule rule that matches the incoming browser request to enable -// a cross-origin request. For a rule to match, the following conditions must -// be met: -// -// * The request's Origin header must match AllowedOrigin elements. -// -// * The request method (for example, GET, PUT, HEAD, and so on) or the Access-Control-Request-Method -// header in case of a pre-flight OPTIONS request must be one of the AllowedMethod -// elements. -// -// * Every header specified in the Access-Control-Request-Headers request -// header of a pre-flight request must match an AllowedHeader element. -// -// For more information about CORS, go to Enabling Cross-Origin Resource Sharing -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon -// Simple Storage Service Developer Guide. -// -// Related Resources -// -// * GetBucketCors -// -// * DeleteBucketCors -// -// * RESTOPTIONSobject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketCors for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCors -func (c *S3) PutBucketCors(input *PutBucketCorsInput) (*PutBucketCorsOutput, error) { - req, out := c.PutBucketCorsRequest(input) - return out, req.Send() -} - -// PutBucketCorsWithContext is the same as PutBucketCors with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketCors for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketCorsWithContext(ctx aws.Context, input *PutBucketCorsInput, opts ...request.Option) (*PutBucketCorsOutput, error) { - req, out := c.PutBucketCorsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketEncryption = "PutBucketEncryption" - -// PutBucketEncryptionRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketEncryption operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketEncryption for more information on using the PutBucketEncryption -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketEncryptionRequest method. -// req, resp := client.PutBucketEncryptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryption -func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) (req *request.Request, output *PutBucketEncryptionOutput) { - op := &request.Operation{ - Name: opPutBucketEncryption, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?encryption", - } - - if input == nil { - input = &PutBucketEncryptionInput{} - } - - output = &PutBucketEncryptionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketEncryption API operation for Amazon Simple Storage Service. -// -// This implementation of the PUT operation uses the encryption subresource -// to set the default encryption state of an existing bucket. -// -// This implementation of the PUT operation sets default encryption for a bucket -// using server-side encryption with Amazon S3-managed keys SSE-S3 or AWS KMS -// customer master keys (CMKs) (SSE-KMS). For information about the Amazon S3 -// default encryption feature, see Amazon S3 Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html). -// -// This operation requires AWS Signature Version 4. For more information, see -// Authenticating Requests (AWS Signature Version 4) (sig-v4-authenticating-requests.html). -// -// To use this operation, you must have permissions to perform the s3:PutEncryptionConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Related Resources -// -// * GetBucketEncryption -// -// * DeleteBucketEncryption -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketEncryption for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryption -func (c *S3) PutBucketEncryption(input *PutBucketEncryptionInput) (*PutBucketEncryptionOutput, error) { - req, out := c.PutBucketEncryptionRequest(input) - return out, req.Send() -} - -// PutBucketEncryptionWithContext is the same as PutBucketEncryption with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketEncryption for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketEncryptionWithContext(ctx aws.Context, input *PutBucketEncryptionInput, opts ...request.Option) (*PutBucketEncryptionOutput, error) { - req, out := c.PutBucketEncryptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketInventoryConfiguration = "PutBucketInventoryConfiguration" - -// PutBucketInventoryConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketInventoryConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketInventoryConfiguration for more information on using the PutBucketInventoryConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketInventoryConfigurationRequest method. -// req, resp := client.PutBucketInventoryConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfiguration -func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryConfigurationInput) (req *request.Request, output *PutBucketInventoryConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketInventoryConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &PutBucketInventoryConfigurationInput{} - } - - output = &PutBucketInventoryConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketInventoryConfiguration API operation for Amazon Simple Storage Service. -// -// This implementation of the PUT operation adds an inventory configuration -// (identified by the inventory ID) to the bucket. You can have up to 1,000 -// inventory configurations per bucket. -// -// Amazon S3 inventory generates inventories of the objects in the bucket on -// a daily or weekly basis, and the results are published to a flat file. The -// bucket that is inventoried is called the source bucket, and the bucket where -// the inventory flat file is stored is called the destination bucket. The destination -// bucket must be in the same AWS Region as the source bucket. -// -// When you configure an inventory for a source bucket, you specify the destination -// bucket where you want the inventory to be stored, and whether to generate -// the inventory daily or weekly. You can also configure what object metadata -// to include and whether to inventory all object versions or only current versions. -// For more information, see Amazon S3 Inventory (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// You must create a bucket policy on the destination bucket to grant permissions -// to Amazon S3 to write objects to the bucket in the defined location. For -// an example policy, see Granting Permissions for Amazon S3 Inventory and Storage -// Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-9). -// -// To use this operation, you must have permissions to perform the s3:PutInventoryConfiguration -// action. The bucket owner has this permission by default and can grant this -// permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Special Errors -// -// * HTTP 400 Bad Request Error Code: InvalidArgument Cause: Invalid Argument -// -// * HTTP 400 Bad Request Error Code: TooManyConfigurations Cause: You are -// attempting to create a new configuration but have already reached the -// 1,000-configuration limit. -// -// * HTTP 403 Forbidden Error Code: AccessDenied Cause: You are not the owner -// of the specified bucket, or you do not have the s3:PutInventoryConfiguration -// bucket permission to set the configuration on the bucket. -// -// Related Resources -// -// * GetBucketInventoryConfiguration -// -// * DeleteBucketInventoryConfiguration -// -// * ListBucketInventoryConfigurations -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketInventoryConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfiguration -func (c *S3) PutBucketInventoryConfiguration(input *PutBucketInventoryConfigurationInput) (*PutBucketInventoryConfigurationOutput, error) { - req, out := c.PutBucketInventoryConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketInventoryConfigurationWithContext is the same as PutBucketInventoryConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketInventoryConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketInventoryConfigurationWithContext(ctx aws.Context, input *PutBucketInventoryConfigurationInput, opts ...request.Option) (*PutBucketInventoryConfigurationOutput, error) { - req, out := c.PutBucketInventoryConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketLifecycle = "PutBucketLifecycle" - -// PutBucketLifecycleRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketLifecycle operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketLifecycle for more information on using the PutBucketLifecycle -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketLifecycleRequest method. -// req, resp := client.PutBucketLifecycleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycle -// -// Deprecated: PutBucketLifecycle has been deprecated -func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *request.Request, output *PutBucketLifecycleOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, PutBucketLifecycle, has been deprecated") - } - op := &request.Operation{ - Name: opPutBucketLifecycle, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &PutBucketLifecycleInput{} - } - - output = &PutBucketLifecycleOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketLifecycle API operation for Amazon Simple Storage Service. -// -// -// For an updated version of this API, see PutBucketLifecycleConfiguration. -// This version has been deprecated. Existing lifecycle configurations will -// work. For new lifecycle configurations, use the updated API. -// -// Creates a new lifecycle configuration for the bucket or replaces an existing -// lifecycle configuration. For information about lifecycle configuration, see -// Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// By default, all Amazon S3 resources, including buckets, objects, and related -// subresources (for example, lifecycle configuration and website configuration) -// are private. Only the resource owner, the AWS account that created the resource, -// can access it. The resource owner can optionally grant access permissions -// to others by writing an access policy. For this operation, users must get -// the s3:PutLifecycleConfiguration permission. -// -// You can also explicitly deny permissions. Explicit denial also supersedes -// any other permissions. If you want to prevent users or accounts from removing -// or deleting objects from your bucket, you must deny them permissions for -// the following actions: -// -// * s3:DeleteObject -// -// * s3:DeleteObjectVersion -// -// * s3:PutLifecycleConfiguration -// -// For more information about permissions, see Managing Access Permissions to -// your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// For more examples of transitioning objects to storage classes such as STANDARD_IA -// or ONEZONE_IA, see Examples of Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#lifecycle-configuration-examples). -// -// Related Resources -// -// * GetBucketLifecycle(Deprecated) -// -// * GetBucketLifecycleConfiguration -// -// * -// -// * By default, a resource owner—in this case, a bucket owner, which is -// the AWS account that created the bucket—can perform any of the operations. -// A resource owner can also grant others permission to perform the operation. -// For more information, see the following topics in the Amazon Simple Storage -// Service Developer Guide: Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) -// Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketLifecycle for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycle -// -// Deprecated: PutBucketLifecycle has been deprecated -func (c *S3) PutBucketLifecycle(input *PutBucketLifecycleInput) (*PutBucketLifecycleOutput, error) { - req, out := c.PutBucketLifecycleRequest(input) - return out, req.Send() -} - -// PutBucketLifecycleWithContext is the same as PutBucketLifecycle with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketLifecycle for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -// -// Deprecated: PutBucketLifecycleWithContext has been deprecated -func (c *S3) PutBucketLifecycleWithContext(ctx aws.Context, input *PutBucketLifecycleInput, opts ...request.Option) (*PutBucketLifecycleOutput, error) { - req, out := c.PutBucketLifecycleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketLifecycleConfiguration = "PutBucketLifecycleConfiguration" - -// PutBucketLifecycleConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketLifecycleConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketLifecycleConfiguration for more information on using the PutBucketLifecycleConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketLifecycleConfigurationRequest method. -// req, resp := client.PutBucketLifecycleConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfiguration -func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleConfigurationInput) (req *request.Request, output *PutBucketLifecycleConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketLifecycleConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &PutBucketLifecycleConfigurationInput{} - } - - output = &PutBucketLifecycleConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketLifecycleConfiguration API operation for Amazon Simple Storage Service. -// -// Creates a new lifecycle configuration for the bucket or replaces an existing -// lifecycle configuration. For information about lifecycle configuration, see -// Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// Bucket lifecycle configuration now supports specifying a lifecycle rule using -// an object key name prefix, one or more object tags, or a combination of both. -// Accordingly, this section describes the latest API. The previous version -// of the API supported filtering based only on an object key name prefix, which -// is supported for backward compatibility. For the related API description, -// see PutBucketLifecycle. -// -// Rules -// -// You specify the lifecycle configuration in your request body. The lifecycle -// configuration is specified as XML consisting of one or more rules. Each rule -// consists of the following: -// -// * Filter identifying a subset of objects to which the rule applies. The -// filter can be based on a key name prefix, object tags, or a combination -// of both. -// -// * Status whether the rule is in effect. -// -// * One or more lifecycle transition and expiration actions that you want -// Amazon S3 to perform on the objects identified by the filter. If the state -// of your bucket is versioning-enabled or versioning-suspended, you can -// have many versions of the same object (one current version and zero or -// more noncurrent versions). Amazon S3 provides predefined actions that -// you can specify for current and noncurrent object versions. -// -// For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// and Lifecycle Configuration Elements (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html). -// -// Permissions -// -// By default, all Amazon S3 resources are private, including buckets, objects, -// and related subresources (for example, lifecycle configuration and website -// configuration). Only the resource owner (that is, the AWS account that created -// it) can access the resource. The resource owner can optionally grant access -// permissions to others by writing an access policy. For this operation, a -// user must get the s3:PutLifecycleConfiguration permission. -// -// You can also explicitly deny permissions. Explicit deny also supersedes any -// other permissions. If you want to block users or accounts from removing or -// deleting objects from your bucket, you must deny them permissions for the -// following actions: -// -// * s3:DeleteObject -// -// * s3:DeleteObjectVersion -// -// * s3:PutLifecycleConfiguration -// -// For more information about permissions, see Managing Access Permissions to -// Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// The following are related to PutBucketLifecycleConfiguration: -// -// * Examples of Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-configuration-examples.html) -// -// * GetBucketLifecycleConfiguration -// -// * DeleteBucketLifecycle -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketLifecycleConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfiguration -func (c *S3) PutBucketLifecycleConfiguration(input *PutBucketLifecycleConfigurationInput) (*PutBucketLifecycleConfigurationOutput, error) { - req, out := c.PutBucketLifecycleConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketLifecycleConfigurationWithContext is the same as PutBucketLifecycleConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketLifecycleConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketLifecycleConfigurationWithContext(ctx aws.Context, input *PutBucketLifecycleConfigurationInput, opts ...request.Option) (*PutBucketLifecycleConfigurationOutput, error) { - req, out := c.PutBucketLifecycleConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketLogging = "PutBucketLogging" - -// PutBucketLoggingRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketLogging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketLogging for more information on using the PutBucketLogging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketLoggingRequest method. -// req, resp := client.PutBucketLoggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLogging -func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) (req *request.Request, output *PutBucketLoggingOutput) { - op := &request.Operation{ - Name: opPutBucketLogging, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?logging", - } - - if input == nil { - input = &PutBucketLoggingInput{} - } - - output = &PutBucketLoggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketLogging API operation for Amazon Simple Storage Service. -// -// Set the logging parameters for a bucket and to specify permissions for who -// can view and modify the logging parameters. All logs are saved to buckets -// in the same AWS Region as the source bucket. To set the logging status of -// a bucket, you must be the bucket owner. -// -// The bucket owner is automatically granted FULL_CONTROL to all logs. You use -// the Grantee request element to grant access to other people. The Permissions -// request element specifies the kind of access the grantee has to the logs. -// -// Grantee Values -// -// You can specify the person (grantee) to whom you're assigning access rights -// (using request elements) in the following ways: -// -// * By the person's ID: <>ID<><>GranteesEmail<> -// DisplayName is optional and ignored in the request. -// -// * By Email address: <>Grantees@email.com<> -// The grantee is resolved to the CanonicalUser and, in a response to a GET -// Object acl request, appears as the CanonicalUser. -// -// * By URI: <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<> -// -// To enable logging, you use LoggingEnabled and its children request elements. -// To disable logging, you use an empty BucketLoggingStatus request element: -// -// -// -// For more information about server access logging, see Server Access Logging -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html). -// -// For more information about creating a bucket, see CreateBucket. For more -// information about returning the logging status of a bucket, see GetBucketLogging. -// -// The following operations are related to PutBucketLogging: -// -// * PutObject -// -// * DeleteBucket -// -// * CreateBucket -// -// * GetBucketLogging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketLogging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLogging -func (c *S3) PutBucketLogging(input *PutBucketLoggingInput) (*PutBucketLoggingOutput, error) { - req, out := c.PutBucketLoggingRequest(input) - return out, req.Send() -} - -// PutBucketLoggingWithContext is the same as PutBucketLogging with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketLogging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketLoggingWithContext(ctx aws.Context, input *PutBucketLoggingInput, opts ...request.Option) (*PutBucketLoggingOutput, error) { - req, out := c.PutBucketLoggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketMetricsConfiguration = "PutBucketMetricsConfiguration" - -// PutBucketMetricsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketMetricsConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketMetricsConfiguration for more information on using the PutBucketMetricsConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketMetricsConfigurationRequest method. -// req, resp := client.PutBucketMetricsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfiguration -func (c *S3) PutBucketMetricsConfigurationRequest(input *PutBucketMetricsConfigurationInput) (req *request.Request, output *PutBucketMetricsConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketMetricsConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &PutBucketMetricsConfigurationInput{} - } - - output = &PutBucketMetricsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketMetricsConfiguration API operation for Amazon Simple Storage Service. -// -// Sets a metrics configuration (specified by the metrics configuration ID) -// for the bucket. You can have up to 1,000 metrics configurations per bucket. -// If you're updating an existing metrics configuration, note that this is a -// full replacement of the existing metrics configuration. If you don't include -// the elements you want to keep, they are erased. -// -// To use this operation, you must have permissions to perform the s3:PutMetricsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// For information about CloudWatch request metrics for Amazon S3, see Monitoring -// Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). -// -// The following operations are related to PutBucketMetricsConfiguration: -// -// * DeleteBucketMetricsConfiguration -// -// * PutBucketMetricsConfiguration -// -// * ListBucketMetricsConfigurations -// -// GetBucketLifecycle has the following special error: -// -// * Error code: TooManyConfigurations Description: You are attempting to -// create a new configuration but have already reached the 1,000-configuration -// limit. HTTP Status Code: HTTP 400 Bad Request -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketMetricsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfiguration -func (c *S3) PutBucketMetricsConfiguration(input *PutBucketMetricsConfigurationInput) (*PutBucketMetricsConfigurationOutput, error) { - req, out := c.PutBucketMetricsConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketMetricsConfigurationWithContext is the same as PutBucketMetricsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketMetricsConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketMetricsConfigurationWithContext(ctx aws.Context, input *PutBucketMetricsConfigurationInput, opts ...request.Option) (*PutBucketMetricsConfigurationOutput, error) { - req, out := c.PutBucketMetricsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketNotification = "PutBucketNotification" - -// PutBucketNotificationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketNotification operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketNotification for more information on using the PutBucketNotification -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketNotificationRequest method. -// req, resp := client.PutBucketNotificationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotification -// -// Deprecated: PutBucketNotification has been deprecated -func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (req *request.Request, output *PutBucketNotificationOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, PutBucketNotification, has been deprecated") - } - op := &request.Operation{ - Name: opPutBucketNotification, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &PutBucketNotificationInput{} - } - - output = &PutBucketNotificationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketNotification API operation for Amazon Simple Storage Service. -// -// No longer used, see the PutBucketNotificationConfiguration operation. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketNotification for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotification -// -// Deprecated: PutBucketNotification has been deprecated -func (c *S3) PutBucketNotification(input *PutBucketNotificationInput) (*PutBucketNotificationOutput, error) { - req, out := c.PutBucketNotificationRequest(input) - return out, req.Send() -} - -// PutBucketNotificationWithContext is the same as PutBucketNotification with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketNotification for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -// -// Deprecated: PutBucketNotificationWithContext has been deprecated -func (c *S3) PutBucketNotificationWithContext(ctx aws.Context, input *PutBucketNotificationInput, opts ...request.Option) (*PutBucketNotificationOutput, error) { - req, out := c.PutBucketNotificationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketNotificationConfiguration = "PutBucketNotificationConfiguration" - -// PutBucketNotificationConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketNotificationConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketNotificationConfiguration for more information on using the PutBucketNotificationConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketNotificationConfigurationRequest method. -// req, resp := client.PutBucketNotificationConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfiguration -func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificationConfigurationInput) (req *request.Request, output *PutBucketNotificationConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketNotificationConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &PutBucketNotificationConfigurationInput{} - } - - output = &PutBucketNotificationConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketNotificationConfiguration API operation for Amazon Simple Storage Service. -// -// Enables notifications of specified events for a bucket. For more information -// about event notifications, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html). -// -// Using this API, you can replace an existing notification configuration. The -// configuration is an XML file that defines the event types that you want Amazon -// S3 to publish and the destination where you want Amazon S3 to publish an -// event notification when it detects an event of the specified type. -// -// By default, your bucket has no event notifications configured. That is, the -// notification configuration will be an empty NotificationConfiguration. -// -// -// -// -// -// This operation replaces the existing notification configuration with the -// configuration you include in the request body. -// -// After Amazon S3 receives this request, it first verifies that any Amazon -// Simple Notification Service (Amazon SNS) or Amazon Simple Queue Service (Amazon -// SQS) destination exists, and that the bucket owner has permission to publish -// to it by sending a test notification. In the case of AWS Lambda destinations, -// Amazon S3 verifies that the Lambda function permissions grant Amazon S3 permission -// to invoke the function from the Amazon S3 bucket. For more information, see -// Configuring Notifications for Amazon S3 Events (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html). -// -// You can disable notifications by adding the empty NotificationConfiguration -// element. -// -// By default, only the bucket owner can configure notifications on a bucket. -// However, bucket owners can use a bucket policy to grant permission to other -// users to set this configuration with s3:PutBucketNotification permission. -// -// The PUT notification is an atomic operation. For example, suppose your notification -// configuration includes SNS topic, SQS queue, and Lambda function configurations. -// When you send a PUT request with this configuration, Amazon S3 sends test -// messages to your SNS topic. If the message fails, the entire PUT operation -// will fail, and Amazon S3 will not add the configuration to your bucket. -// -// Responses -// -// If the configuration in the request body includes only one TopicConfiguration -// specifying only the s3:ReducedRedundancyLostObject event type, the response -// will also include the x-amz-sns-test-message-id header containing the message -// ID of the test notification sent to the topic. -// -// The following operation is related to PutBucketNotificationConfiguration: -// -// * GetBucketNotificationConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketNotificationConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfiguration -func (c *S3) PutBucketNotificationConfiguration(input *PutBucketNotificationConfigurationInput) (*PutBucketNotificationConfigurationOutput, error) { - req, out := c.PutBucketNotificationConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketNotificationConfigurationWithContext is the same as PutBucketNotificationConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketNotificationConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketNotificationConfigurationWithContext(ctx aws.Context, input *PutBucketNotificationConfigurationInput, opts ...request.Option) (*PutBucketNotificationConfigurationOutput, error) { - req, out := c.PutBucketNotificationConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketPolicy = "PutBucketPolicy" - -// PutBucketPolicyRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketPolicy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketPolicy for more information on using the PutBucketPolicy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketPolicyRequest method. -// req, resp := client.PutBucketPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicy -func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.Request, output *PutBucketPolicyOutput) { - op := &request.Operation{ - Name: opPutBucketPolicy, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?policy", - } - - if input == nil { - input = &PutBucketPolicyInput{} - } - - output = &PutBucketPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketPolicy API operation for Amazon Simple Storage Service. -// -// Applies an Amazon S3 bucket policy to an Amazon S3 bucket. If you are using -// an identity other than the root user of the AWS account that owns the bucket, -// the calling identity must have the PutBucketPolicy permissions on the specified -// bucket and belong to the bucket owner's account in order to use this operation. -// -// If you don't have PutBucketPolicy permissions, Amazon S3 returns a 403 Access -// Denied error. If you have the correct permissions, but you're not using an -// identity that belongs to the bucket owner's account, Amazon S3 returns a -// 405 Method Not Allowed error. -// -// As a security precaution, the root user of the AWS account that owns a bucket -// can always use this operation, even if the policy explicitly denies the root -// user the ability to perform this action. -// -// For more information about bucket policies, see Using Bucket Policies and -// User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). -// -// The following operations are related to PutBucketPolicy: -// -// * CreateBucket -// -// * DeleteBucket -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketPolicy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicy -func (c *S3) PutBucketPolicy(input *PutBucketPolicyInput) (*PutBucketPolicyOutput, error) { - req, out := c.PutBucketPolicyRequest(input) - return out, req.Send() -} - -// PutBucketPolicyWithContext is the same as PutBucketPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketPolicy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketPolicyWithContext(ctx aws.Context, input *PutBucketPolicyInput, opts ...request.Option) (*PutBucketPolicyOutput, error) { - req, out := c.PutBucketPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketReplication = "PutBucketReplication" - -// PutBucketReplicationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketReplication operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketReplication for more information on using the PutBucketReplication -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketReplicationRequest method. -// req, resp := client.PutBucketReplicationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplication -func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req *request.Request, output *PutBucketReplicationOutput) { - op := &request.Operation{ - Name: opPutBucketReplication, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?replication", - } - - if input == nil { - input = &PutBucketReplicationInput{} - } - - output = &PutBucketReplicationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketReplication API operation for Amazon Simple Storage Service. -// -// Creates a replication configuration or replaces an existing one. For more -// information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) -// in the Amazon S3 Developer Guide. -// -// To perform this operation, the user or role performing the operation must -// have the iam:PassRole (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html) -// permission. -// -// Specify the replication configuration in the request body. In the replication -// configuration, you provide the name of the destination bucket where you want -// Amazon S3 to replicate objects, the IAM role that Amazon S3 can assume to -// replicate objects on your behalf, and other relevant information. -// -// A replication configuration must include at least one rule, and can contain -// a maximum of 1,000. Each rule identifies a subset of objects to replicate -// by filtering the objects in the source bucket. To choose additional subsets -// of objects to replicate, add a rule for each subset. All rules must specify -// the same destination bucket. -// -// To specify a subset of the objects in the source bucket to apply a replication -// rule to, add the Filter element as a child of the Rule element. You can filter -// objects based on an object key prefix, one or more object tags, or both. -// When you add the Filter element in the configuration, you must also add the -// following elements: DeleteMarkerReplication, Status, and Priority. -// -// For information about enabling versioning on a bucket, see Using Versioning -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html). -// -// By default, a resource owner, in this case the AWS account that created the -// bucket, can perform this operation. The resource owner can also grant others -// permissions to perform the operation. For more information about permissions, -// see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// Handling Replication of Encrypted Objects -// -// By default, Amazon S3 doesn't replicate objects that are stored at rest using -// server-side encryption with CMKs stored in AWS KMS. To replicate AWS KMS-encrypted -// objects, add the following: SourceSelectionCriteria, SseKmsEncryptedObjects, -// Status, EncryptionConfiguration, and ReplicaKmsKeyID. For information about -// replication configuration, see Replicating Objects Created with SSE Using -// CMKs stored in AWS KMS (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-config-for-kms-objects.html). -// -// For information on PutBucketReplication errors, see ReplicationErrorCodeList -// -// The following operations are related to PutBucketReplication: -// -// * GetBucketReplication -// -// * DeleteBucketReplication -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketReplication for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplication -func (c *S3) PutBucketReplication(input *PutBucketReplicationInput) (*PutBucketReplicationOutput, error) { - req, out := c.PutBucketReplicationRequest(input) - return out, req.Send() -} - -// PutBucketReplicationWithContext is the same as PutBucketReplication with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketReplication for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketReplicationWithContext(ctx aws.Context, input *PutBucketReplicationInput, opts ...request.Option) (*PutBucketReplicationOutput, error) { - req, out := c.PutBucketReplicationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketRequestPayment = "PutBucketRequestPayment" - -// PutBucketRequestPaymentRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketRequestPayment operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketRequestPayment for more information on using the PutBucketRequestPayment -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketRequestPaymentRequest method. -// req, resp := client.PutBucketRequestPaymentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPayment -func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) (req *request.Request, output *PutBucketRequestPaymentOutput) { - op := &request.Operation{ - Name: opPutBucketRequestPayment, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?requestPayment", - } - - if input == nil { - input = &PutBucketRequestPaymentInput{} - } - - output = &PutBucketRequestPaymentOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketRequestPayment API operation for Amazon Simple Storage Service. -// -// Sets the request payment configuration for a bucket. By default, the bucket -// owner pays for downloads from the bucket. This configuration parameter enables -// the bucket owner (only) to specify that the person requesting the download -// will be charged for the download. For more information, see Requester Pays -// Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html). -// -// The following operations are related to PutBucketRequestPayment: -// -// * CreateBucket -// -// * GetBucketRequestPayment -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketRequestPayment for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPayment -func (c *S3) PutBucketRequestPayment(input *PutBucketRequestPaymentInput) (*PutBucketRequestPaymentOutput, error) { - req, out := c.PutBucketRequestPaymentRequest(input) - return out, req.Send() -} - -// PutBucketRequestPaymentWithContext is the same as PutBucketRequestPayment with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketRequestPayment for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketRequestPaymentWithContext(ctx aws.Context, input *PutBucketRequestPaymentInput, opts ...request.Option) (*PutBucketRequestPaymentOutput, error) { - req, out := c.PutBucketRequestPaymentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketTagging = "PutBucketTagging" - -// PutBucketTaggingRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketTagging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketTagging for more information on using the PutBucketTagging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketTaggingRequest method. -// req, resp := client.PutBucketTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTagging -func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request.Request, output *PutBucketTaggingOutput) { - op := &request.Operation{ - Name: opPutBucketTagging, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?tagging", - } - - if input == nil { - input = &PutBucketTaggingInput{} - } - - output = &PutBucketTaggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketTagging API operation for Amazon Simple Storage Service. -// -// Sets the tags for a bucket. -// -// Use tags to organize your AWS bill to reflect your own cost structure. To -// do this, sign up to get your AWS account bill with tag key values included. -// Then, to see the cost of combined resources, organize your billing information -// according to resources with the same tag key values. For example, you can -// tag several resources with a specific application name, and then organize -// your billing information to see the total cost of that application across -// several services. For more information, see Cost Allocation and Tagging (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html). -// -// Within a bucket, if you add a tag that has the same key as an existing tag, -// the new value overwrites the old value. For more information, see Using Cost -// Allocation in Amazon S3 Bucket Tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/CostAllocTagging.html). -// -// To use this operation, you must have permissions to perform the s3:PutBucketTagging -// action. The bucket owner has this permission by default and can grant this -// permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). -// -// PutBucketTagging has the following special errors: -// -// * Error code: InvalidTagError Description: The tag provided was not a -// valid tag. This error can occur if the tag did not pass input validation. -// For information about tag restrictions, see User-Defined Tag Restrictions -// (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html) -// and AWS-Generated Cost Allocation Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/aws-tag-restrictions.html). -// -// * Error code: MalformedXMLError Description: The XML provided does not -// match the schema. -// -// * Error code: OperationAbortedError Description: A conflicting conditional -// operation is currently in progress against this resource. Please try again. -// -// * Error code: InternalError Description: The service was unable to apply -// the provided tag to the bucket. -// -// The following operations are related to PutBucketTagging: -// -// * GetBucketTagging -// -// * DeleteBucketTagging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTagging -func (c *S3) PutBucketTagging(input *PutBucketTaggingInput) (*PutBucketTaggingOutput, error) { - req, out := c.PutBucketTaggingRequest(input) - return out, req.Send() -} - -// PutBucketTaggingWithContext is the same as PutBucketTagging with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketTagging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketTaggingWithContext(ctx aws.Context, input *PutBucketTaggingInput, opts ...request.Option) (*PutBucketTaggingOutput, error) { - req, out := c.PutBucketTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketVersioning = "PutBucketVersioning" - -// PutBucketVersioningRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketVersioning operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketVersioning for more information on using the PutBucketVersioning -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketVersioningRequest method. -// req, resp := client.PutBucketVersioningRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioning -func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) (req *request.Request, output *PutBucketVersioningOutput) { - op := &request.Operation{ - Name: opPutBucketVersioning, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?versioning", - } - - if input == nil { - input = &PutBucketVersioningInput{} - } - - output = &PutBucketVersioningOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketVersioning API operation for Amazon Simple Storage Service. -// -// Sets the versioning state of an existing bucket. To set the versioning state, -// you must be the bucket owner. -// -// You can set the versioning state with one of the following values: -// -// Enabled—Enables versioning for the objects in the bucket. All objects added -// to the bucket receive a unique version ID. -// -// Suspended—Disables versioning for the objects in the bucket. All objects -// added to the bucket receive the version ID null. -// -// If the versioning state has never been set on a bucket, it has no versioning -// state; a GetBucketVersioning request does not return a versioning state value. -// -// If the bucket owner enables MFA Delete in the bucket versioning configuration, -// the bucket owner must include the x-amz-mfa request header and the Status -// and the MfaDelete request elements in a request to set the versioning state -// of the bucket. -// -// If you have an object expiration lifecycle policy in your non-versioned bucket -// and you want to maintain the same permanent delete behavior when you enable -// versioning, you must add a noncurrent expiration policy. The noncurrent expiration -// lifecycle policy will manage the deletes of the noncurrent object versions -// in the version-enabled bucket. (A version-enabled bucket maintains one current -// and zero or more noncurrent object versions.) For more information, see Lifecycle -// and Versioning (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html#lifecycle-and-other-bucket-config). -// -// Related Resources -// -// * CreateBucket -// -// * DeleteBucket -// -// * GetBucketVersioning -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketVersioning for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioning -func (c *S3) PutBucketVersioning(input *PutBucketVersioningInput) (*PutBucketVersioningOutput, error) { - req, out := c.PutBucketVersioningRequest(input) - return out, req.Send() -} - -// PutBucketVersioningWithContext is the same as PutBucketVersioning with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketVersioning for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketVersioningWithContext(ctx aws.Context, input *PutBucketVersioningInput, opts ...request.Option) (*PutBucketVersioningOutput, error) { - req, out := c.PutBucketVersioningRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketWebsite = "PutBucketWebsite" - -// PutBucketWebsiteRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketWebsite operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutBucketWebsite for more information on using the PutBucketWebsite -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutBucketWebsiteRequest method. -// req, resp := client.PutBucketWebsiteRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsite -func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request.Request, output *PutBucketWebsiteOutput) { - op := &request.Operation{ - Name: opPutBucketWebsite, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?website", - } - - if input == nil { - input = &PutBucketWebsiteInput{} - } - - output = &PutBucketWebsiteOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutBucketWebsite API operation for Amazon Simple Storage Service. -// -// Sets the configuration of the website that is specified in the website subresource. -// To configure a bucket as a website, you can add this subresource on the bucket -// with website configuration information such as the file name of the index -// document and any redirect rules. For more information, see Hosting Websites -// on Amazon S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html). -// -// This PUT operation requires the S3:PutBucketWebsite permission. By default, -// only the bucket owner can configure the website attached to a bucket; however, -// bucket owners can allow other users to set the website configuration by writing -// a bucket policy that grants them the S3:PutBucketWebsite permission. -// -// To redirect all website requests sent to the bucket's website endpoint, you -// add a website configuration with the following elements. Because all requests -// are sent to another website, you don't need to provide index document name -// for the bucket. -// -// * WebsiteConfiguration -// -// * RedirectAllRequestsTo -// -// * HostName -// -// * Protocol -// -// If you want granular control over redirects, you can use the following elements -// to add routing rules that describe conditions for redirecting requests and -// information about the redirect destination. In this case, the website configuration -// must provide an index document for the bucket, because some requests might -// not be redirected. -// -// * WebsiteConfiguration -// -// * IndexDocument -// -// * Suffix -// -// * ErrorDocument -// -// * Key -// -// * RoutingRules -// -// * RoutingRule -// -// * Condition -// -// * HttpErrorCodeReturnedEquals -// -// * KeyPrefixEquals -// -// * Redirect -// -// * Protocol -// -// * HostName -// -// * ReplaceKeyPrefixWith -// -// * ReplaceKeyWith -// -// * HttpRedirectCode -// -// Amazon S3 has a limitation of 50 routing rules per website configuration. -// If you require more than 50 routing rules, you can use object redirect. For -// more information, see Configuring an Object Redirect (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutBucketWebsite for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsite -func (c *S3) PutBucketWebsite(input *PutBucketWebsiteInput) (*PutBucketWebsiteOutput, error) { - req, out := c.PutBucketWebsiteRequest(input) - return out, req.Send() -} - -// PutBucketWebsiteWithContext is the same as PutBucketWebsite with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketWebsite for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutBucketWebsiteWithContext(ctx aws.Context, input *PutBucketWebsiteInput, opts ...request.Option) (*PutBucketWebsiteOutput, error) { - req, out := c.PutBucketWebsiteRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObject = "PutObject" - -// PutObjectRequest generates a "aws/request.Request" representing the -// client's request for the PutObject operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutObject for more information on using the PutObject -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutObjectRequest method. -// req, resp := client.PutObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject -func (c *S3) PutObjectRequest(input *PutObjectInput) (req *request.Request, output *PutObjectOutput) { - op := &request.Operation{ - Name: opPutObject, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &PutObjectInput{} - } - - output = &PutObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// PutObject API operation for Amazon Simple Storage Service. -// -// Adds an object to a bucket. You must have WRITE permissions on a bucket to -// add an object to it. -// -// Amazon S3 never adds partial objects; if you receive a success response, -// Amazon S3 added the entire object to the bucket. -// -// Amazon S3 is a distributed system. If it receives multiple write requests -// for the same object simultaneously, it overwrites all but the last object -// written. Amazon S3 does not provide object locking; if you need this, make -// sure to build it into your application layer or use versioning instead. -// -// To ensure that data is not corrupted traversing the network, use the Content-MD5 -// header. When you use this header, Amazon S3 checks the object against the -// provided MD5 value and, if they do not match, returns an error. Additionally, -// you can calculate the MD5 while putting an object to Amazon S3 and compare -// the returned ETag to the calculated MD5 value. -// -// The Content-MD5 header is required for any request to upload an object with -// a retention period configured using Amazon S3 Object Lock. For more information -// about Amazon S3 Object Lock, see Amazon S3 Object Lock Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Server-side Encryption -// -// You can optionally request server-side encryption. With server-side encryption, -// Amazon S3 encrypts your data as it writes it to disks in its data centers -// and decrypts the data when you access it. You have the option to provide -// your own encryption key or use AWS managed encryption keys. For more information, -// see Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html). -// -// Access Control List (ACL)-Specific Request Headers -// -// You can use headers to grant ACL- based permissions. By default, all objects -// are private. Only the owner has full access control. When adding a new object, -// you can grant permissions to individual AWS accounts or to predefined groups -// defined by Amazon S3. These permissions are then added to the ACL on the -// object. For more information, see Access Control List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) -// and Managing ACLs Using the REST API (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-using-rest-api.html). -// -// Storage Class Options -// -// By default, Amazon S3 uses the STANDARD storage class to store newly created -// objects. The STANDARD storage class provides high durability and high availability. -// Depending on performance needs, you can specify a different storage class. -// For more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) -// in the Amazon S3 Service Developer Guide. -// -// Versioning -// -// If you enable versioning for a bucket, Amazon S3 automatically generates -// a unique version ID for the object being stored. Amazon S3 returns this ID -// in the response. When you enable versioning for a bucket, if Amazon S3 receives -// multiple write requests for the same object simultaneously, it stores all -// of the objects. -// -// For more information about versioning, see Adding Objects to Versioning Enabled -// Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/AddingObjectstoVersioningEnabledBuckets.html). -// For information about returning the versioning state of a bucket, see GetBucketVersioning. -// -// Related Resources -// -// * CopyObject -// -// * DeleteObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutObject for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject -func (c *S3) PutObject(input *PutObjectInput) (*PutObjectOutput, error) { - req, out := c.PutObjectRequest(input) - return out, req.Send() -} - -// PutObjectWithContext is the same as PutObject with the addition of -// the ability to pass a context and additional request options. -// -// See PutObject for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutObjectWithContext(ctx aws.Context, input *PutObjectInput, opts ...request.Option) (*PutObjectOutput, error) { - req, out := c.PutObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectAcl = "PutObjectAcl" - -// PutObjectAclRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectAcl operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutObjectAcl for more information on using the PutObjectAcl -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutObjectAclRequest method. -// req, resp := client.PutObjectAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAcl -func (c *S3) PutObjectAclRequest(input *PutObjectAclInput) (req *request.Request, output *PutObjectAclOutput) { - op := &request.Operation{ - Name: opPutObjectAcl, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?acl", - } - - if input == nil { - input = &PutObjectAclInput{} - } - - output = &PutObjectAclOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutObjectAcl API operation for Amazon Simple Storage Service. -// -// Uses the acl subresource to set the access control list (ACL) permissions -// for an object that already exists in a bucket. You must have WRITE_ACP permission -// to set the ACL of an object. -// -// Depending on your application needs, you can choose to set the ACL on an -// object using either the request body or the headers. For example, if you -// have an existing application that updates a bucket ACL using the request -// body, you can continue to use that approach. For more information, see Access -// Control List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) -// in the Amazon S3 Developer Guide. -// -// Access Permissions -// -// You can set access permissions using one of the following methods: -// -// * Specify a canned ACL with the x-amz-acl request header. Amazon S3 supports -// a set of predefined ACLs, known as canned ACLs. Each canned ACL has a -// predefined set of grantees and permissions. Specify the canned ACL name -// as the value of x-amz-acl. If you use this header, you cannot use other -// access control-specific headers in your request. For more information, -// see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). -// -// * Specify access permissions explicitly with the x-amz-grant-read, x-amz-grant-read-acp, -// x-amz-grant-write-acp, and x-amz-grant-full-control headers. When using -// these headers, you specify explicit access permissions and grantees (AWS -// accounts or Amazon S3 groups) who will receive the permission. If you -// use these ACL-specific headers, you cannot use x-amz-acl header to set -// a canned ACL. These parameters map to the set of permissions that Amazon -// S3 supports in an ACL. For more information, see Access Control List (ACL) -// Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html). -// You specify each grantee as a type=value pair, where the type is one of -// the following: id – if the value specified is the canonical user ID -// of an AWS account uri – if you are granting permissions to a predefined -// group emailAddress – if the value specified is the email address of -// an AWS account Using email addresses to specify a grantee is only supported -// in the following AWS Regions: US East (N. Virginia) US West (N. California) -// US West (Oregon) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific -// (Tokyo) Europe (Ireland) South America (São Paulo) For a list of all -// the Amazon S3 supported Regions and endpoints, see Regions and Endpoints -// (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in -// the AWS General Reference. For example, the following x-amz-grant-read -// header grants list objects permission to the two AWS accounts identified -// by their email addresses. x-amz-grant-read: emailAddress="xyz@amazon.com", -// emailAddress="abc@amazon.com" -// -// You can use either a canned ACL or specify access permissions explicitly. -// You cannot do both. -// -// Grantee Values -// -// You can specify the person (grantee) to whom you're assigning access rights -// (using request elements) in the following ways: -// -// * By the person's ID: <>ID<><>GranteesEmail<> -// DisplayName is optional and ignored in the request. -// -// * By URI: <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<> -// -// * By Email address: <>Grantees@email.com<>lt;/Grantee> -// The grantee is resolved to the CanonicalUser and, in a response to a GET -// Object acl request, appears as the CanonicalUser. Using email addresses -// to specify a grantee is only supported in the following AWS Regions: US -// East (N. Virginia) US West (N. California) US West (Oregon) Asia Pacific -// (Singapore) Asia Pacific (Sydney) Asia Pacific (Tokyo) Europe (Ireland) -// South America (São Paulo) For a list of all the Amazon S3 supported Regions -// and endpoints, see Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) -// in the AWS General Reference. -// -// Versioning -// -// The ACL of an object is set at the object version level. By default, PUT -// sets the ACL of the current version of an object. To set the ACL of a different -// version, use the versionId subresource. -// -// Related Resources -// -// * CopyObject -// -// * GetObject -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutObjectAcl for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchKey "NoSuchKey" -// The specified key does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAcl -func (c *S3) PutObjectAcl(input *PutObjectAclInput) (*PutObjectAclOutput, error) { - req, out := c.PutObjectAclRequest(input) - return out, req.Send() -} - -// PutObjectAclWithContext is the same as PutObjectAcl with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectAcl for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutObjectAclWithContext(ctx aws.Context, input *PutObjectAclInput, opts ...request.Option) (*PutObjectAclOutput, error) { - req, out := c.PutObjectAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectLegalHold = "PutObjectLegalHold" - -// PutObjectLegalHoldRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectLegalHold operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutObjectLegalHold for more information on using the PutObjectLegalHold -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutObjectLegalHoldRequest method. -// req, resp := client.PutObjectLegalHoldRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectLegalHold -func (c *S3) PutObjectLegalHoldRequest(input *PutObjectLegalHoldInput) (req *request.Request, output *PutObjectLegalHoldOutput) { - op := &request.Operation{ - Name: opPutObjectLegalHold, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?legal-hold", - } - - if input == nil { - input = &PutObjectLegalHoldInput{} - } - - output = &PutObjectLegalHoldOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutObjectLegalHold API operation for Amazon Simple Storage Service. -// -// Applies a Legal Hold configuration to the specified object. -// -// Related Resources -// -// * Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutObjectLegalHold for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectLegalHold -func (c *S3) PutObjectLegalHold(input *PutObjectLegalHoldInput) (*PutObjectLegalHoldOutput, error) { - req, out := c.PutObjectLegalHoldRequest(input) - return out, req.Send() -} - -// PutObjectLegalHoldWithContext is the same as PutObjectLegalHold with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectLegalHold for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutObjectLegalHoldWithContext(ctx aws.Context, input *PutObjectLegalHoldInput, opts ...request.Option) (*PutObjectLegalHoldOutput, error) { - req, out := c.PutObjectLegalHoldRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectLockConfiguration = "PutObjectLockConfiguration" - -// PutObjectLockConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectLockConfiguration operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutObjectLockConfiguration for more information on using the PutObjectLockConfiguration -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutObjectLockConfigurationRequest method. -// req, resp := client.PutObjectLockConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectLockConfiguration -func (c *S3) PutObjectLockConfigurationRequest(input *PutObjectLockConfigurationInput) (req *request.Request, output *PutObjectLockConfigurationOutput) { - op := &request.Operation{ - Name: opPutObjectLockConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?object-lock", - } - - if input == nil { - input = &PutObjectLockConfigurationInput{} - } - - output = &PutObjectLockConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutObjectLockConfiguration API operation for Amazon Simple Storage Service. -// -// Places an Object Lock configuration on the specified bucket. The rule specified -// in the Object Lock configuration will be applied by default to every new -// object placed in the specified bucket. -// -// DefaultRetention requires either Days or Years. You can't specify both at -// the same time. -// -// Related Resources -// -// * Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutObjectLockConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectLockConfiguration -func (c *S3) PutObjectLockConfiguration(input *PutObjectLockConfigurationInput) (*PutObjectLockConfigurationOutput, error) { - req, out := c.PutObjectLockConfigurationRequest(input) - return out, req.Send() -} - -// PutObjectLockConfigurationWithContext is the same as PutObjectLockConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectLockConfiguration for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutObjectLockConfigurationWithContext(ctx aws.Context, input *PutObjectLockConfigurationInput, opts ...request.Option) (*PutObjectLockConfigurationOutput, error) { - req, out := c.PutObjectLockConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectRetention = "PutObjectRetention" - -// PutObjectRetentionRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectRetention operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutObjectRetention for more information on using the PutObjectRetention -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutObjectRetentionRequest method. -// req, resp := client.PutObjectRetentionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectRetention -func (c *S3) PutObjectRetentionRequest(input *PutObjectRetentionInput) (req *request.Request, output *PutObjectRetentionOutput) { - op := &request.Operation{ - Name: opPutObjectRetention, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?retention", - } - - if input == nil { - input = &PutObjectRetentionInput{} - } - - output = &PutObjectRetentionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutObjectRetention API operation for Amazon Simple Storage Service. -// -// Places an Object Retention configuration on an object. -// -// Related Resources -// -// * Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutObjectRetention for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectRetention -func (c *S3) PutObjectRetention(input *PutObjectRetentionInput) (*PutObjectRetentionOutput, error) { - req, out := c.PutObjectRetentionRequest(input) - return out, req.Send() -} - -// PutObjectRetentionWithContext is the same as PutObjectRetention with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectRetention for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutObjectRetentionWithContext(ctx aws.Context, input *PutObjectRetentionInput, opts ...request.Option) (*PutObjectRetentionOutput, error) { - req, out := c.PutObjectRetentionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectTagging = "PutObjectTagging" - -// PutObjectTaggingRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectTagging operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutObjectTagging for more information on using the PutObjectTagging -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutObjectTaggingRequest method. -// req, resp := client.PutObjectTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTagging -func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request.Request, output *PutObjectTaggingOutput) { - op := &request.Operation{ - Name: opPutObjectTagging, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?tagging", - } - - if input == nil { - input = &PutObjectTaggingInput{} - } - - output = &PutObjectTaggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutObjectTagging API operation for Amazon Simple Storage Service. -// -// Sets the supplied tag-set to an object that already exists in a bucket. -// -// A tag is a key-value pair. You can associate tags with an object by sending -// a PUT request against the tagging subresource that is associated with the -// object. You can retrieve tags by sending a GET request. For more information, -// see GetObjectTagging. -// -// For tagging-related restrictions related to characters and encodings, see -// Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html). -// Note that Amazon S3 limits the maximum number of tags to 10 tags per object. -// -// To use this operation, you must have permission to perform the s3:PutObjectTagging -// action. By default, the bucket owner has this permission and can grant this -// permission to others. -// -// To put tags of any other version, use the versionId query parameter. You -// also need permission for the s3:PutObjectVersionTagging action. -// -// For information about the Amazon S3 object tagging feature, see Object Tagging -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). -// -// Special Errors -// -// * Code: InvalidTagError Cause: The tag provided was not a valid tag. This -// error can occur if the tag did not pass input validation. For more information, -// see Object Tagging (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). -// -// * Code: MalformedXMLError Cause: The XML provided does not match the schema. -// -// * Code: OperationAbortedError Cause: A conflicting conditional operation -// is currently in progress against this resource. Please try again. -// -// * Code: InternalError Cause: The service was unable to apply the provided -// tag to the object. -// -// Related Resources -// -// * GetObjectTagging -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutObjectTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTagging -func (c *S3) PutObjectTagging(input *PutObjectTaggingInput) (*PutObjectTaggingOutput, error) { - req, out := c.PutObjectTaggingRequest(input) - return out, req.Send() -} - -// PutObjectTaggingWithContext is the same as PutObjectTagging with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectTagging for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutObjectTaggingWithContext(ctx aws.Context, input *PutObjectTaggingInput, opts ...request.Option) (*PutObjectTaggingOutput, error) { - req, out := c.PutObjectTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutPublicAccessBlock = "PutPublicAccessBlock" - -// PutPublicAccessBlockRequest generates a "aws/request.Request" representing the -// client's request for the PutPublicAccessBlock operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See PutPublicAccessBlock for more information on using the PutPublicAccessBlock -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the PutPublicAccessBlockRequest method. -// req, resp := client.PutPublicAccessBlockRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutPublicAccessBlock -func (c *S3) PutPublicAccessBlockRequest(input *PutPublicAccessBlockInput) (req *request.Request, output *PutPublicAccessBlockOutput) { - op := &request.Operation{ - Name: opPutPublicAccessBlock, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?publicAccessBlock", - } - - if input == nil { - input = &PutPublicAccessBlockInput{} - } - - output = &PutPublicAccessBlockOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) - req.Handlers.Build.PushBackNamed(request.NamedHandler{ - Name: "contentMd5Handler", - Fn: checksum.AddBodyContentMD5Handler, - }) - return -} - -// PutPublicAccessBlock API operation for Amazon Simple Storage Service. -// -// Creates or modifies the PublicAccessBlock configuration for an Amazon S3 -// bucket. To use this operation, you must have the s3:PutBucketPublicAccessBlock -// permission. For more information about Amazon S3 permissions, see Specifying -// Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html). -// -// When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket -// or an object, it checks the PublicAccessBlock configuration for both the -// bucket (or the bucket that contains the object) and the bucket owner's account. -// If the PublicAccessBlock configurations are different between the bucket -// and the account, Amazon S3 uses the most restrictive combination of the bucket-level -// and account-level settings. -// -// For more information about when Amazon S3 considers a bucket or an object -// public, see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status). -// -// Related Resources -// -// * GetPublicAccessBlock -// -// * DeletePublicAccessBlock -// -// * GetBucketPolicyStatus -// -// * Using Amazon S3 Block Public Access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation PutPublicAccessBlock for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutPublicAccessBlock -func (c *S3) PutPublicAccessBlock(input *PutPublicAccessBlockInput) (*PutPublicAccessBlockOutput, error) { - req, out := c.PutPublicAccessBlockRequest(input) - return out, req.Send() -} - -// PutPublicAccessBlockWithContext is the same as PutPublicAccessBlock with the addition of -// the ability to pass a context and additional request options. -// -// See PutPublicAccessBlock for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) PutPublicAccessBlockWithContext(ctx aws.Context, input *PutPublicAccessBlockInput, opts ...request.Option) (*PutPublicAccessBlockOutput, error) { - req, out := c.PutPublicAccessBlockRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRestoreObject = "RestoreObject" - -// RestoreObjectRequest generates a "aws/request.Request" representing the -// client's request for the RestoreObject operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See RestoreObject for more information on using the RestoreObject -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the RestoreObjectRequest method. -// req, resp := client.RestoreObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject -func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Request, output *RestoreObjectOutput) { - op := &request.Operation{ - Name: opRestoreObject, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?restore", - } - - if input == nil { - input = &RestoreObjectInput{} - } - - output = &RestoreObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// RestoreObject API operation for Amazon Simple Storage Service. -// -// Restores an archived copy of an object back into Amazon S3 -// -// This operation performs the following types of requests: -// -// * select - Perform a select query on an archived object -// -// * restore an archive - Restore an archived object -// -// To use this operation, you must have permissions to perform the s3:RestoreObject -// action. The bucket owner has this permission by default and can grant this -// permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Querying Archives with Select Requests -// -// You use a select type of request to perform SQL queries on archived objects. -// The archived objects that are being queried by the select request must be -// formatted as uncompressed comma-separated values (CSV) files. You can run -// queries and custom analytics on your archived data without having to restore -// your data to a hotter Amazon S3 tier. For an overview about select requests, -// see Querying Archived Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/querying-glacier-archives.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// When making a select request, do the following: -// -// * Define an output location for the select query's output. This must be -// an Amazon S3 bucket in the same AWS Region as the bucket that contains -// the archive object that is being queried. The AWS account that initiates -// the job must have permissions to write to the S3 bucket. You can specify -// the storage class and encryption for the output objects stored in the -// bucket. For more information about output, see Querying Archived Objects -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/querying-glacier-archives.html) -// in the Amazon Simple Storage Service Developer Guide. For more information -// about the S3 structure in the request body, see the following: PutObject -// Managing Access with ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html) -// in the Amazon Simple Storage Service Developer Guide Protecting Data Using -// Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) -// in the Amazon Simple Storage Service Developer Guide -// -// * Define the SQL expression for the SELECT type of restoration for your -// query in the request body's SelectParameters structure. You can use expressions -// like the following examples. The following expression returns all records -// from the specified object. SELECT * FROM Object Assuming that you are -// not using any headers for data stored in the object, you can specify columns -// with positional headers. SELECT s._1, s._2 FROM Object s WHERE s._3 > -// 100 If you have headers and you set the fileHeaderInfo in the CSV structure -// in the request body to USE, you can specify headers in the query. (If -// you set the fileHeaderInfo field to IGNORE, the first row is skipped for -// the query.) You cannot mix ordinal positions with header column names. -// SELECT s.Id, s.FirstName, s.SSN FROM S3Object s -// -// For more information about using SQL with S3 Glacier Select restore, see -// SQL Reference for Amazon S3 Select and S3 Glacier Select (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// When making a select request, you can also do the following: -// -// * To expedite your queries, specify the Expedited tier. For more information -// about tiers, see "Restoring Archives," later in this topic. -// -// * Specify details about the data serialization format of both the input -// object that is being queried and the serialization of the CSV-encoded -// query results. -// -// The following are additional important facts about the select feature: -// -// * The output results are new Amazon S3 objects. Unlike archive retrievals, -// they are stored until explicitly deleted-manually or through a lifecycle -// policy. -// -// * You can issue more than one select request on the same Amazon S3 object. -// Amazon S3 doesn't deduplicate requests, so avoid issuing duplicate requests. -// -// * Amazon S3 accepts a select request even if the object has already been -// restored. A select request doesn’t return error response 409. -// -// Restoring Archives -// -// Objects in the GLACIER and DEEP_ARCHIVE storage classes are archived. To -// access an archived object, you must first initiate a restore request. This -// restores a temporary copy of the archived object. In a restore request, you -// specify the number of days that you want the restored copy to exist. After -// the specified period, Amazon S3 deletes the temporary copy but the object -// remains archived in the GLACIER or DEEP_ARCHIVE storage class that object -// was restored from. -// -// To restore a specific object version, you can provide a version ID. If you -// don't provide a version ID, Amazon S3 restores the current version. -// -// The time it takes restore jobs to finish depends on which storage class the -// object is being restored from and which data access tier you specify. -// -// When restoring an archived object (or using a select request), you can specify -// one of the following data access tier options in the Tier element of the -// request body: -// -// * Expedited - Expedited retrievals allow you to quickly access your data -// stored in the GLACIER storage class when occasional urgent requests for -// a subset of archives are required. For all but the largest archived objects -// (250 MB+), data accessed using Expedited retrievals are typically made -// available within 1–5 minutes. Provisioned capacity ensures that retrieval -// capacity for Expedited retrievals is available when you need it. Expedited -// retrievals and provisioned capacity are not available for the DEEP_ARCHIVE -// storage class. -// -// * Standard - S3 Standard retrievals allow you to access any of your archived -// objects within several hours. This is the default option for the GLACIER -// and DEEP_ARCHIVE retrieval requests that do not specify the retrieval -// option. S3 Standard retrievals typically complete within 3-5 hours from -// the GLACIER storage class and typically complete within 12 hours from -// the DEEP_ARCHIVE storage class. -// -// * Bulk - Bulk retrievals are Amazon S3 Glacier’s lowest-cost retrieval -// option, enabling you to retrieve large amounts, even petabytes, of data -// inexpensively in a day. Bulk retrievals typically complete within 5-12 -// hours from the GLACIER storage class and typically complete within 48 -// hours from the DEEP_ARCHIVE storage class. -// -// For more information about archive retrieval options and provisioned capacity -// for Expedited data access, see Restoring Archived Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// You can use Amazon S3 restore speed upgrade to change the restore speed to -// a faster speed while it is in progress. You upgrade the speed of an in-progress -// restoration by issuing another restore request to the same object, setting -// a new Tier request element. When issuing a request to upgrade the restore -// tier, you must choose a tier that is faster than the tier that the in-progress -// restore is using. You must not change any other parameters, such as the Days -// request element. For more information, see Upgrading the Speed of an In-Progress -// Restore (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html#restoring-objects-upgrade-tier.title.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// To get the status of object restoration, you can send a HEAD request. Operations -// return the x-amz-restore header, which provides information about the restoration -// status, in the response. You can use Amazon S3 event notifications to notify -// you when a restore is initiated or completed. For more information, see Configuring -// Amazon S3 Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// After restoring an archived object, you can update the restoration period -// by reissuing the request with a new period. Amazon S3 updates the restoration -// period relative to the current time and charges only for the request-there -// are no data transfer charges. You cannot update the restoration period when -// Amazon S3 is actively processing your current restore request for the object. -// -// If your bucket has a lifecycle configuration with a rule that includes an -// expiration action, the object expiration overrides the life span that you -// specify in a restore request. For example, if you restore an object copy -// for 10 days, but the object is scheduled to expire in 3 days, Amazon S3 deletes -// the object in 3 days. For more information about lifecycle configuration, -// see PutBucketLifecycleConfiguration and Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in Amazon Simple Storage Service Developer Guide. -// -// Responses -// -// A successful operation returns either the 200 OK or 202 Accepted status code. -// -// * If the object copy is not previously restored, then Amazon S3 returns -// 202 Accepted in the response. -// -// * If the object copy is previously restored, Amazon S3 returns 200 OK -// in the response. -// -// Special Errors -// -// * Code: RestoreAlreadyInProgress Cause: Object restore is already in progress. -// (This error does not apply to SELECT type requests.) HTTP Status Code: -// 409 Conflict SOAP Fault Code Prefix: Client -// -// * Code: GlacierExpeditedRetrievalNotAvailable Cause: S3 Glacier expedited -// retrievals are currently not available. Try again later. (Returned if -// there is insufficient capacity to process the Expedited request. This -// error applies only to Expedited retrievals and not to S3 Standard or Bulk -// retrievals.) HTTP Status Code: 503 SOAP Fault Code Prefix: N/A -// -// Related Resources -// -// * PutBucketLifecycleConfiguration -// -// * GetBucketNotificationConfiguration -// -// * SQL Reference for Amazon S3 Select and S3 Glacier Select (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference.html) -// in the Amazon Simple Storage Service Developer Guide -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation RestoreObject for usage and error information. -// -// Returned Error Codes: -// * ErrCodeObjectAlreadyInActiveTierError "ObjectAlreadyInActiveTierError" -// This operation is not allowed against this storage tier. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject -func (c *S3) RestoreObject(input *RestoreObjectInput) (*RestoreObjectOutput, error) { - req, out := c.RestoreObjectRequest(input) - return out, req.Send() -} - -// RestoreObjectWithContext is the same as RestoreObject with the addition of -// the ability to pass a context and additional request options. -// -// See RestoreObject for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) RestoreObjectWithContext(ctx aws.Context, input *RestoreObjectInput, opts ...request.Option) (*RestoreObjectOutput, error) { - req, out := c.RestoreObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opSelectObjectContent = "SelectObjectContent" - -// SelectObjectContentRequest generates a "aws/request.Request" representing the -// client's request for the SelectObjectContent operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See SelectObjectContent for more information on using the SelectObjectContent -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the SelectObjectContentRequest method. -// req, resp := client.SelectObjectContentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SelectObjectContent -func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *request.Request, output *SelectObjectContentOutput) { - op := &request.Operation{ - Name: opSelectObjectContent, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?select&select-type=2", - } - - if input == nil { - input = &SelectObjectContentInput{} - } - - output = &SelectObjectContentOutput{} - req = c.newRequest(op, input, output) - - es := newSelectObjectContentEventStream() - req.Handlers.Unmarshal.PushBack(es.setStreamCloser) - output.EventStream = es - - req.Handlers.Send.Swap(client.LogHTTPResponseHandler.Name, client.LogHTTPResponseHeaderHandler) - req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, rest.UnmarshalHandler) - req.Handlers.Unmarshal.PushBack(es.runOutputStream) - req.Handlers.Unmarshal.PushBack(es.runOnStreamPartClose) - return -} - -// SelectObjectContent API operation for Amazon Simple Storage Service. -// -// This operation filters the contents of an Amazon S3 object based on a simple -// structured query language (SQL) statement. In the request, along with the -// SQL expression, you must also specify a data serialization format (JSON, -// CSV, or Apache Parquet) of the object. Amazon S3 uses this format to parse -// object data into records, and returns only records that match the specified -// SQL expression. You must also specify the data serialization format for the -// response. -// -// For more information about Amazon S3 Select, see Selecting Content from Objects -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/selecting-content-from-objects.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// For more information about using SQL with Amazon S3 Select, see SQL Reference -// for Amazon S3 Select and S3 Glacier Select (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Permissions -// -// You must have s3:GetObject permission for this operation. Amazon S3 Select -// does not support anonymous access. For more information about permissions, -// see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Object Data Formats -// -// You can use Amazon S3 Select to query objects that have the following format -// properties: -// -// * CSV, JSON, and Parquet - Objects must be in CSV, JSON, or Parquet format. -// -// * UTF-8 - UTF-8 is the only encoding type Amazon S3 Select supports. -// -// * GZIP or BZIP2 - CSV and JSON files can be compressed using GZIP or BZIP2. -// GZIP and BZIP2 are the only compression formats that Amazon S3 Select -// supports for CSV and JSON files. Amazon S3 Select supports columnar compression -// for Parquet using GZIP or Snappy. Amazon S3 Select does not support whole-object -// compression for Parquet objects. -// -// * Server-side encryption - Amazon S3 Select supports querying objects -// that are protected with server-side encryption. For objects that are encrypted -// with customer-provided encryption keys (SSE-C), you must use HTTPS, and -// you must use the headers that are documented in the GetObject. For more -// information about SSE-C, see Server-Side Encryption (Using Customer-Provided -// Encryption Keys) (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html) -// in the Amazon Simple Storage Service Developer Guide. For objects that -// are encrypted with Amazon S3 managed encryption keys (SSE-S3) and customer -// master keys (CMKs) stored in AWS Key Management Service (SSE-KMS), server-side -// encryption is handled transparently, so you don't need to specify anything. -// For more information about server-side encryption, including SSE-S3 and -// SSE-KMS, see Protecting Data Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Working with the Response Body -// -// Given the response size is unknown, Amazon S3 Select streams the response -// as a series of messages and includes a Transfer-Encoding header with chunked -// as its value in the response. For more information, see RESTSelectObjectAppendix . -// -// GetObject Support -// -// The SelectObjectContent operation does not support the following GetObject -// functionality. For more information, see GetObject. -// -// * Range: Although you can specify a scan range for an Amazon S3 Select -// request (see SelectObjectContentRequest$ScanRange in the request parameters), -// you cannot specify the range of bytes of an object to return. -// -// * GLACIER, DEEP_ARCHIVE and REDUCED_REDUNDANCY storage classes: You cannot -// specify the GLACIER, DEEP_ARCHIVE, or REDUCED_REDUNDANCY storage classes. -// For more information, about storage classes see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#storage-class-intro) -// in the Amazon Simple Storage Service Developer Guide. -// -// Special Errors -// -// For a list of special errors for this operation, see SelectObjectContentErrorCodeList -// -// Related Resources -// -// * GetObject -// -// * GetBucketLifecycleConfiguration -// -// * PutBucketLifecycleConfiguration -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation SelectObjectContent for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SelectObjectContent -func (c *S3) SelectObjectContent(input *SelectObjectContentInput) (*SelectObjectContentOutput, error) { - req, out := c.SelectObjectContentRequest(input) - return out, req.Send() -} - -// SelectObjectContentWithContext is the same as SelectObjectContent with the addition of -// the ability to pass a context and additional request options. -// -// See SelectObjectContent for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) SelectObjectContentWithContext(ctx aws.Context, input *SelectObjectContentInput, opts ...request.Option) (*SelectObjectContentOutput, error) { - req, out := c.SelectObjectContentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// SelectObjectContentEventStream provides the event stream handling for the SelectObjectContent. -type SelectObjectContentEventStream struct { - - // Reader is the EventStream reader for the SelectObjectContentEventStream - // events. This value is automatically set by the SDK when the API call is made - // Use this member when unit testing your code with the SDK to mock out the - // EventStream Reader. - // - // Must not be nil. - Reader SelectObjectContentEventStreamReader - - outputReader io.ReadCloser - - // StreamCloser is the io.Closer for the EventStream connection. For HTTP - // EventStream this is the response Body. The stream will be closed when - // the Close method of the EventStream is called. - StreamCloser io.Closer - - done chan struct{} - closeOnce sync.Once - err *eventstreamapi.OnceError -} - -func newSelectObjectContentEventStream() *SelectObjectContentEventStream { - return &SelectObjectContentEventStream{ - done: make(chan struct{}), - err: eventstreamapi.NewOnceError(), - } -} - -func (es *SelectObjectContentEventStream) setStreamCloser(r *request.Request) { - es.StreamCloser = r.HTTPResponse.Body -} - -func (es *SelectObjectContentEventStream) runOnStreamPartClose(r *request.Request) { - if es.done == nil { - return - } - go es.waitStreamPartClose() - -} - -func (es *SelectObjectContentEventStream) waitStreamPartClose() { - var outputErrCh <-chan struct{} - if v, ok := es.Reader.(interface{ ErrorSet() <-chan struct{} }); ok { - outputErrCh = v.ErrorSet() - } - var outputClosedCh <-chan struct{} - if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok { - outputClosedCh = v.Closed() - } - - select { - case <-es.done: - case <-outputErrCh: - es.err.SetError(es.Reader.Err()) - es.Close() - case <-outputClosedCh: - if err := es.Reader.Err(); err != nil { - es.err.SetError(es.Reader.Err()) - } - es.Close() - } -} - -// Events returns a channel to read events from. -// -// These events are: -// -// * ContinuationEvent -// * EndEvent -// * ProgressEvent -// * RecordsEvent -// * StatsEvent -func (es *SelectObjectContentEventStream) Events() <-chan SelectObjectContentEventStreamEvent { - return es.Reader.Events() -} - -func (es *SelectObjectContentEventStream) runOutputStream(r *request.Request) { - var opts []func(*eventstream.Decoder) - if r.Config.Logger != nil && r.Config.LogLevel.Matches(aws.LogDebugWithEventStreamBody) { - opts = append(opts, eventstream.DecodeWithLogger(r.Config.Logger)) - } - - unmarshalerForEvent := unmarshalerForSelectObjectContentEventStreamEvent{ - metadata: protocol.ResponseMetadata{ - StatusCode: r.HTTPResponse.StatusCode, - RequestID: r.RequestID, - }, - }.UnmarshalerForEventName - - decoder := eventstream.NewDecoder(r.HTTPResponse.Body, opts...) - eventReader := eventstreamapi.NewEventReader(decoder, - protocol.HandlerPayloadUnmarshal{ - Unmarshalers: r.Handlers.UnmarshalStream, - }, - unmarshalerForEvent, - ) - - es.outputReader = r.HTTPResponse.Body - es.Reader = newReadSelectObjectContentEventStream(eventReader) -} - -// Close closes the stream. This will also cause the stream to be closed. -// Close must be called when done using the stream API. Not calling Close -// may result in resource leaks. -// -// You can use the closing of the Reader's Events channel to terminate your -// application's read from the API's stream. -// -func (es *SelectObjectContentEventStream) Close() (err error) { - es.closeOnce.Do(es.safeClose) - return es.Err() -} - -func (es *SelectObjectContentEventStream) safeClose() { - if es.done != nil { - close(es.done) - } - - es.Reader.Close() - if es.outputReader != nil { - es.outputReader.Close() - } - - es.StreamCloser.Close() -} - -// Err returns any error that occurred while reading or writing EventStream -// Events from the service API's response. Returns nil if there were no errors. -func (es *SelectObjectContentEventStream) Err() error { - if err := es.err.Err(); err != nil { - return err - } - if err := es.Reader.Err(); err != nil { - return err - } - - return nil -} - -const opUploadPart = "UploadPart" - -// UploadPartRequest generates a "aws/request.Request" representing the -// client's request for the UploadPart operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UploadPart for more information on using the UploadPart -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the UploadPartRequest method. -// req, resp := client.UploadPartRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPart -func (c *S3) UploadPartRequest(input *UploadPartInput) (req *request.Request, output *UploadPartOutput) { - op := &request.Operation{ - Name: opUploadPart, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &UploadPartInput{} - } - - output = &UploadPartOutput{} - req = c.newRequest(op, input, output) - return -} - -// UploadPart API operation for Amazon Simple Storage Service. -// -// Uploads a part in a multipart upload. -// -// In this operation, you provide part data in your request. However, you have -// an option to specify your existing Amazon S3 object as a data source for -// the part you are uploading. To upload a part from an existing object, you -// use the UploadPartCopy operation. -// -// You must initiate a multipart upload (see CreateMultipartUpload) before you -// can upload any part. In response to your initiate request, Amazon S3 returns -// an upload ID, a unique identifier, that you must include in your upload part -// request. -// -// Part numbers can be any number from 1 to 10,000, inclusive. A part number -// uniquely identifies a part and also defines its position within the object -// being created. If you upload a new part using the same part number that was -// used with a previous part, the previously uploaded part is overwritten. Each -// part must be at least 5 MB in size, except the last part. There is no size -// limit on the last part of your multipart upload. -// -// To ensure that data is not corrupted when traversing the network, specify -// the Content-MD5 header in the upload part request. Amazon S3 checks the part -// data against the provided MD5 value. If they do not match, Amazon S3 returns -// an error. -// -// Note: After you initiate multipart upload and upload one or more parts, you -// must either complete or abort multipart upload in order to stop getting charged -// for storage of the uploaded parts. Only after you either complete or abort -// multipart upload, Amazon S3 frees up the parts storage and stops charging -// you for the parts storage. -// -// For more information on multipart uploads, go to Multipart Upload Overview -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html) in the -// Amazon Simple Storage Service Developer Guide . -// -// For information on the permissions required to use the multipart upload API, -// go to Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// You can optionally request server-side encryption where Amazon S3 encrypts -// your data as it writes it to disks in its data centers and decrypts it for -// you when you access it. You have the option of providing your own encryption -// key, or you can use the AWS managed encryption keys. If you choose to provide -// your own encryption key, the request headers you provide in the request must -// match the headers you used in the request to initiate the upload by using -// CreateMultipartUpload. For more information, go to Using Server-Side Encryption -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Server-side encryption is supported by the S3 Multipart Upload actions. Unless -// you are using a customer-provided encryption key, you don't need to specify -// the encryption parameters in each UploadPart request. Instead, you only need -// to specify the server-side encryption parameters in the initial Initiate -// Multipart request. For more information, see CreateMultipartUpload. -// -// If you requested server-side encryption using a customer-provided encryption -// key in your initiate multipart upload request, you must provide identical -// encryption information in each part upload using the following headers. -// -// * x-amz-server-side​-encryption​-customer-algorithm -// -// * x-amz-server-side​-encryption​-customer-key -// -// * x-amz-server-side​-encryption​-customer-key-MD5 -// -// Special Errors -// -// * Code: NoSuchUpload Cause: The specified multipart upload does not exist. -// The upload ID might be invalid, or the multipart upload might have been -// aborted or completed. HTTP Status Code: 404 Not Found SOAP Fault Code -// Prefix: Client -// -// Related Resources -// -// * CreateMultipartUpload -// -// * CompleteMultipartUpload -// -// * AbortMultipartUpload -// -// * ListParts -// -// * ListMultipartUploads -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation UploadPart for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPart -func (c *S3) UploadPart(input *UploadPartInput) (*UploadPartOutput, error) { - req, out := c.UploadPartRequest(input) - return out, req.Send() -} - -// UploadPartWithContext is the same as UploadPart with the addition of -// the ability to pass a context and additional request options. -// -// See UploadPart for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) UploadPartWithContext(ctx aws.Context, input *UploadPartInput, opts ...request.Option) (*UploadPartOutput, error) { - req, out := c.UploadPartRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUploadPartCopy = "UploadPartCopy" - -// UploadPartCopyRequest generates a "aws/request.Request" representing the -// client's request for the UploadPartCopy operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See UploadPartCopy for more information on using the UploadPartCopy -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the UploadPartCopyRequest method. -// req, resp := client.UploadPartCopyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopy -func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *request.Request, output *UploadPartCopyOutput) { - op := &request.Operation{ - Name: opUploadPartCopy, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &UploadPartCopyInput{} - } - - output = &UploadPartCopyOutput{} - req = c.newRequest(op, input, output) - return -} - -// UploadPartCopy API operation for Amazon Simple Storage Service. -// -// Uploads a part by copying data from an existing object as data source. You -// specify the data source by adding the request header x-amz-copy-source in -// your request and a byte range by adding the request header x-amz-copy-source-range -// in your request. -// -// The minimum allowable part size for a multipart upload is 5 MB. For more -// information about multipart upload limits, go to Quick Facts (https://docs.aws.amazon.com/AmazonS3/latest/dev/qfacts.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// Instead of using an existing object as part data, you might use the UploadPart -// operation and provide data in your request. -// -// You must initiate a multipart upload before you can upload any part. In response -// to your initiate request. Amazon S3 returns a unique identifier, the upload -// ID, that you must include in your upload part request. -// -// For more information about using the UploadPartCopy operation, see the following: -// -// * For conceptual information about multipart uploads, see Uploading Objects -// Using Multipart Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// * For information about permissions required to use the multipart upload -// API, see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// * For information about copying objects using a single atomic operation -// vs. the multipart upload, see Operations on Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectOperations.html) -// in the Amazon Simple Storage Service Developer Guide. -// -// * For information about using server-side encryption with customer-provided -// encryption keys with the UploadPartCopy operation, see CopyObject and -// UploadPart. -// -// Note the following additional considerations about the request headers x-amz-copy-source-if-match, -// x-amz-copy-source-if-none-match, x-amz-copy-source-if-unmodified-since, and -// x-amz-copy-source-if-modified-since: -// -// * Consideration 1 - If both of the x-amz-copy-source-if-match and x-amz-copy-source-if-unmodified-since -// headers are present in the request as follows: x-amz-copy-source-if-match -// condition evaluates to true, and; x-amz-copy-source-if-unmodified-since -// condition evaluates to false; Amazon S3 returns 200 OK and copies the -// data. -// -// * Consideration 2 - If both of the x-amz-copy-source-if-none-match and -// x-amz-copy-source-if-modified-since headers are present in the request -// as follows: x-amz-copy-source-if-none-match condition evaluates to false, -// and; x-amz-copy-source-if-modified-since condition evaluates to true; -// Amazon S3 returns 412 Precondition Failed response code. -// -// Versioning -// -// If your bucket has versioning enabled, you could have multiple versions of -// the same object. By default, x-amz-copy-source identifies the current version -// of the object to copy. If the current version is a delete marker and you -// don't specify a versionId in the x-amz-copy-source, Amazon S3 returns a 404 -// error, because the object does not exist. If you specify versionId in the -// x-amz-copy-source and the versionId is a delete marker, Amazon S3 returns -// an HTTP 400 error, because you are not allowed to specify a delete marker -// as a version for the x-amz-copy-source. -// -// You can optionally specify a specific version of the source object to copy -// by adding the versionId subresource as shown in the following example: -// -// x-amz-copy-source: /bucket/object?versionId=version id -// -// Special Errors -// -// * Code: NoSuchUpload Cause: The specified multipart upload does not exist. -// The upload ID might be invalid, or the multipart upload might have been -// aborted or completed. HTTP Status Code: 404 Not Found -// -// * Code: InvalidRequest Cause: The specified copy source is not supported -// as a byte-range copy source. HTTP Status Code: 400 Bad Request -// -// Related Resources -// -// * CreateMultipartUpload -// -// * UploadPart -// -// * CompleteMultipartUpload -// -// * AbortMultipartUpload -// -// * ListParts -// -// * ListMultipartUploads -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon Simple Storage Service's -// API operation UploadPartCopy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopy -func (c *S3) UploadPartCopy(input *UploadPartCopyInput) (*UploadPartCopyOutput, error) { - req, out := c.UploadPartCopyRequest(input) - return out, req.Send() -} - -// UploadPartCopyWithContext is the same as UploadPartCopy with the addition of -// the ability to pass a context and additional request options. -// -// See UploadPartCopy for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) UploadPartCopyWithContext(ctx aws.Context, input *UploadPartCopyInput, opts ...request.Option) (*UploadPartCopyOutput, error) { - req, out := c.UploadPartCopyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Specifies the days since the initiation of an incomplete multipart upload -// that Amazon S3 will wait before permanently removing all parts of the upload. -// For more information, see Aborting Incomplete Multipart Uploads Using a Bucket -// Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) -// in the Amazon Simple Storage Service Developer Guide. -type AbortIncompleteMultipartUpload struct { - _ struct{} `type:"structure"` - - // Specifies the number of days after which Amazon S3 aborts an incomplete multipart - // upload. - DaysAfterInitiation *int64 `type:"integer"` -} - -// String returns the string representation -func (s AbortIncompleteMultipartUpload) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AbortIncompleteMultipartUpload) GoString() string { - return s.String() -} - -// SetDaysAfterInitiation sets the DaysAfterInitiation field's value. -func (s *AbortIncompleteMultipartUpload) SetDaysAfterInitiation(v int64) *AbortIncompleteMultipartUpload { - s.DaysAfterInitiation = &v - return s -} - -type AbortMultipartUploadInput struct { - _ struct{} `locationName:"AbortMultipartUploadRequest" type:"structure"` - - // The bucket name to which the upload was taking place. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key of the object for which the multipart upload was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Upload ID that identifies the multipart upload. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s AbortMultipartUploadInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AbortMultipartUploadInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AbortMultipartUploadInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AbortMultipartUploadInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *AbortMultipartUploadInput) SetBucket(v string) *AbortMultipartUploadInput { - s.Bucket = &v - return s -} - -func (s *AbortMultipartUploadInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *AbortMultipartUploadInput) SetKey(v string) *AbortMultipartUploadInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *AbortMultipartUploadInput) SetRequestPayer(v string) *AbortMultipartUploadInput { - s.RequestPayer = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *AbortMultipartUploadInput) SetUploadId(v string) *AbortMultipartUploadInput { - s.UploadId = &v - return s -} - -func (s *AbortMultipartUploadInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *AbortMultipartUploadInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type AbortMultipartUploadOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s AbortMultipartUploadOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AbortMultipartUploadOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *AbortMultipartUploadOutput) SetRequestCharged(v string) *AbortMultipartUploadOutput { - s.RequestCharged = &v - return s -} - -// Configures the transfer acceleration state for an Amazon S3 bucket. For more -// information, see Amazon S3 Transfer Acceleration (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) -// in the Amazon Simple Storage Service Developer Guide. -type AccelerateConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies the transfer acceleration status of the bucket. - Status *string `type:"string" enum:"BucketAccelerateStatus"` -} - -// String returns the string representation -func (s AccelerateConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AccelerateConfiguration) GoString() string { - return s.String() -} - -// SetStatus sets the Status field's value. -func (s *AccelerateConfiguration) SetStatus(v string) *AccelerateConfiguration { - s.Status = &v - return s -} - -// Contains the elements that set the ACL permissions for an object per grantee. -type AccessControlPolicy struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - // Container for the bucket owner's display name and ID. - Owner *Owner `type:"structure"` -} - -// String returns the string representation -func (s AccessControlPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AccessControlPolicy) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AccessControlPolicy) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AccessControlPolicy"} - if s.Grants != nil { - for i, v := range s.Grants { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Grants", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrants sets the Grants field's value. -func (s *AccessControlPolicy) SetGrants(v []*Grant) *AccessControlPolicy { - s.Grants = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *AccessControlPolicy) SetOwner(v *Owner) *AccessControlPolicy { - s.Owner = v - return s -} - -// A container for information about access control for replicas. -type AccessControlTranslation struct { - _ struct{} `type:"structure"` - - // Specifies the replica ownership. For default and valid values, see PUT bucket - // replication (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) - // in the Amazon Simple Storage Service API Reference. - // - // Owner is a required field - Owner *string `type:"string" required:"true" enum:"OwnerOverride"` -} - -// String returns the string representation -func (s AccessControlTranslation) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AccessControlTranslation) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AccessControlTranslation) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AccessControlTranslation"} - if s.Owner == nil { - invalidParams.Add(request.NewErrParamRequired("Owner")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetOwner sets the Owner field's value. -func (s *AccessControlTranslation) SetOwner(v string) *AccessControlTranslation { - s.Owner = &v - return s -} - -// A conjunction (logical AND) of predicates, which is used in evaluating a -// metrics filter. The operator must have at least two predicates in any combination, -// and an object must match all of the predicates for the filter to apply. -type AnalyticsAndOperator struct { - _ struct{} `type:"structure"` - - // The prefix to use when evaluating an AND predicate: The prefix that an object - // must have to be included in the metrics results. - Prefix *string `type:"string"` - - // The list of tags to use when evaluating an AND predicate. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s AnalyticsAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *AnalyticsAndOperator) SetPrefix(v string) *AnalyticsAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *AnalyticsAndOperator) SetTags(v []*Tag) *AnalyticsAndOperator { - s.Tags = v - return s -} - -// Specifies the configuration and any analyses for the analytics filter of -// an Amazon S3 bucket. -type AnalyticsConfiguration struct { - _ struct{} `type:"structure"` - - // The filter used to describe a set of objects for analyses. A filter must - // have exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). - // If no filter is provided, all objects will be considered in any analysis. - Filter *AnalyticsFilter `type:"structure"` - - // The ID that identifies the analytics configuration. - // - // Id is a required field - Id *string `type:"string" required:"true"` - - // Contains data related to access patterns to be collected and made available - // to analyze the tradeoffs between different storage classes. - // - // StorageClassAnalysis is a required field - StorageClassAnalysis *StorageClassAnalysis `type:"structure" required:"true"` -} - -// String returns the string representation -func (s AnalyticsConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsConfiguration"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.StorageClassAnalysis == nil { - invalidParams.Add(request.NewErrParamRequired("StorageClassAnalysis")) - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - if s.StorageClassAnalysis != nil { - if err := s.StorageClassAnalysis.Validate(); err != nil { - invalidParams.AddNested("StorageClassAnalysis", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFilter sets the Filter field's value. -func (s *AnalyticsConfiguration) SetFilter(v *AnalyticsFilter) *AnalyticsConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *AnalyticsConfiguration) SetId(v string) *AnalyticsConfiguration { - s.Id = &v - return s -} - -// SetStorageClassAnalysis sets the StorageClassAnalysis field's value. -func (s *AnalyticsConfiguration) SetStorageClassAnalysis(v *StorageClassAnalysis) *AnalyticsConfiguration { - s.StorageClassAnalysis = v - return s -} - -// Where to publish the analytics results. -type AnalyticsExportDestination struct { - _ struct{} `type:"structure"` - - // A destination signifying output to an S3 bucket. - // - // S3BucketDestination is a required field - S3BucketDestination *AnalyticsS3BucketDestination `type:"structure" required:"true"` -} - -// String returns the string representation -func (s AnalyticsExportDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsExportDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsExportDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsExportDestination"} - if s.S3BucketDestination == nil { - invalidParams.Add(request.NewErrParamRequired("S3BucketDestination")) - } - if s.S3BucketDestination != nil { - if err := s.S3BucketDestination.Validate(); err != nil { - invalidParams.AddNested("S3BucketDestination", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetS3BucketDestination sets the S3BucketDestination field's value. -func (s *AnalyticsExportDestination) SetS3BucketDestination(v *AnalyticsS3BucketDestination) *AnalyticsExportDestination { - s.S3BucketDestination = v - return s -} - -// The filter used to describe a set of objects for analyses. A filter must -// have exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). -// If no filter is provided, all objects will be considered in any analysis. -type AnalyticsFilter struct { - _ struct{} `type:"structure"` - - // A conjunction (logical AND) of predicates, which is used in evaluating an - // analytics filter. The operator must have at least two predicates. - And *AnalyticsAndOperator `type:"structure"` - - // The prefix to use when evaluating an analytics filter. - Prefix *string `type:"string"` - - // The tag to use when evaluating an analytics filter. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s AnalyticsFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *AnalyticsFilter) SetAnd(v *AnalyticsAndOperator) *AnalyticsFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *AnalyticsFilter) SetPrefix(v string) *AnalyticsFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *AnalyticsFilter) SetTag(v *Tag) *AnalyticsFilter { - s.Tag = v - return s -} - -// Contains information about where to publish the analytics results. -type AnalyticsS3BucketDestination struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the bucket to which data is exported. - // - // Bucket is a required field - Bucket *string `type:"string" required:"true"` - - // The account ID that owns the destination S3 bucket. If no account ID is provided, - // the owner is not validated before exporting data. - // - // Although this value is optional, we strongly recommend that you set it to - // help prevent problems if the destination bucket ownership changes. - BucketAccountId *string `type:"string"` - - // Specifies the file format used when exporting data to Amazon S3. - // - // Format is a required field - Format *string `type:"string" required:"true" enum:"AnalyticsS3ExportFileFormat"` - - // The prefix to use when exporting data. The prefix is prepended to all results. - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s AnalyticsS3BucketDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsS3BucketDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsS3BucketDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsS3BucketDestination"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Format == nil { - invalidParams.Add(request.NewErrParamRequired("Format")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *AnalyticsS3BucketDestination) SetBucket(v string) *AnalyticsS3BucketDestination { - s.Bucket = &v - return s -} - -func (s *AnalyticsS3BucketDestination) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBucketAccountId sets the BucketAccountId field's value. -func (s *AnalyticsS3BucketDestination) SetBucketAccountId(v string) *AnalyticsS3BucketDestination { - s.BucketAccountId = &v - return s -} - -// SetFormat sets the Format field's value. -func (s *AnalyticsS3BucketDestination) SetFormat(v string) *AnalyticsS3BucketDestination { - s.Format = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *AnalyticsS3BucketDestination) SetPrefix(v string) *AnalyticsS3BucketDestination { - s.Prefix = &v - return s -} - -// In terms of implementation, a Bucket is a resource. An Amazon S3 bucket name -// is globally unique, and the namespace is shared by all AWS accounts. -type Bucket struct { - _ struct{} `type:"structure"` - - // Date the bucket was created. - CreationDate *time.Time `type:"timestamp"` - - // The name of the bucket. - Name *string `type:"string"` -} - -// String returns the string representation -func (s Bucket) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Bucket) GoString() string { - return s.String() -} - -// SetCreationDate sets the CreationDate field's value. -func (s *Bucket) SetCreationDate(v time.Time) *Bucket { - s.CreationDate = &v - return s -} - -// SetName sets the Name field's value. -func (s *Bucket) SetName(v string) *Bucket { - s.Name = &v - return s -} - -// Specifies the lifecycle configuration for objects in an Amazon S3 bucket. -// For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in the Amazon Simple Storage Service Developer Guide. -type BucketLifecycleConfiguration struct { - _ struct{} `type:"structure"` - - // A lifecycle rule for individual objects in an Amazon S3 bucket. - // - // Rules is a required field - Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s BucketLifecycleConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s BucketLifecycleConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BucketLifecycleConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BucketLifecycleConfiguration"} - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRules sets the Rules field's value. -func (s *BucketLifecycleConfiguration) SetRules(v []*LifecycleRule) *BucketLifecycleConfiguration { - s.Rules = v - return s -} - -// Container for logging status information. -type BucketLoggingStatus struct { - _ struct{} `type:"structure"` - - // Describes where logs are stored and the prefix that Amazon S3 assigns to - // all log object keys for a bucket. For more information, see PUT Bucket logging - // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) - // in the Amazon Simple Storage Service API Reference. - LoggingEnabled *LoggingEnabled `type:"structure"` -} - -// String returns the string representation -func (s BucketLoggingStatus) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s BucketLoggingStatus) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BucketLoggingStatus) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BucketLoggingStatus"} - if s.LoggingEnabled != nil { - if err := s.LoggingEnabled.Validate(); err != nil { - invalidParams.AddNested("LoggingEnabled", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoggingEnabled sets the LoggingEnabled field's value. -func (s *BucketLoggingStatus) SetLoggingEnabled(v *LoggingEnabled) *BucketLoggingStatus { - s.LoggingEnabled = v - return s -} - -// Describes the cross-origin access configuration for objects in an Amazon -// S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon -// Simple Storage Service Developer Guide. -type CORSConfiguration struct { - _ struct{} `type:"structure"` - - // A set of origins and methods (cross-origin access that you want to allow). - // You can add up to 100 rules to the configuration. - // - // CORSRules is a required field - CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s CORSConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CORSConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CORSConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CORSConfiguration"} - if s.CORSRules == nil { - invalidParams.Add(request.NewErrParamRequired("CORSRules")) - } - if s.CORSRules != nil { - for i, v := range s.CORSRules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CORSRules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCORSRules sets the CORSRules field's value. -func (s *CORSConfiguration) SetCORSRules(v []*CORSRule) *CORSConfiguration { - s.CORSRules = v - return s -} - -// Specifies a cross-origin access rule for an Amazon S3 bucket. -type CORSRule struct { - _ struct{} `type:"structure"` - - // Headers that are specified in the Access-Control-Request-Headers header. - // These headers are allowed in a preflight OPTIONS request. In response to - // any preflight OPTIONS request, Amazon S3 returns any requested headers that - // are allowed. - AllowedHeaders []*string `locationName:"AllowedHeader" type:"list" flattened:"true"` - - // An HTTP method that you allow the origin to execute. Valid values are GET, - // PUT, HEAD, POST, and DELETE. - // - // AllowedMethods is a required field - AllowedMethods []*string `locationName:"AllowedMethod" type:"list" flattened:"true" required:"true"` - - // One or more origins you want customers to be able to access the bucket from. - // - // AllowedOrigins is a required field - AllowedOrigins []*string `locationName:"AllowedOrigin" type:"list" flattened:"true" required:"true"` - - // One or more headers in the response that you want customers to be able to - // access from their applications (for example, from a JavaScript XMLHttpRequest - // object). - ExposeHeaders []*string `locationName:"ExposeHeader" type:"list" flattened:"true"` - - // The time in seconds that your browser is to cache the preflight response - // for the specified resource. - MaxAgeSeconds *int64 `type:"integer"` -} - -// String returns the string representation -func (s CORSRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CORSRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CORSRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CORSRule"} - if s.AllowedMethods == nil { - invalidParams.Add(request.NewErrParamRequired("AllowedMethods")) - } - if s.AllowedOrigins == nil { - invalidParams.Add(request.NewErrParamRequired("AllowedOrigins")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAllowedHeaders sets the AllowedHeaders field's value. -func (s *CORSRule) SetAllowedHeaders(v []*string) *CORSRule { - s.AllowedHeaders = v - return s -} - -// SetAllowedMethods sets the AllowedMethods field's value. -func (s *CORSRule) SetAllowedMethods(v []*string) *CORSRule { - s.AllowedMethods = v - return s -} - -// SetAllowedOrigins sets the AllowedOrigins field's value. -func (s *CORSRule) SetAllowedOrigins(v []*string) *CORSRule { - s.AllowedOrigins = v - return s -} - -// SetExposeHeaders sets the ExposeHeaders field's value. -func (s *CORSRule) SetExposeHeaders(v []*string) *CORSRule { - s.ExposeHeaders = v - return s -} - -// SetMaxAgeSeconds sets the MaxAgeSeconds field's value. -func (s *CORSRule) SetMaxAgeSeconds(v int64) *CORSRule { - s.MaxAgeSeconds = &v - return s -} - -// Describes how an uncompressed comma-separated values (CSV)-formatted input -// object is formatted. -type CSVInput struct { - _ struct{} `type:"structure"` - - // Specifies that CSV field values may contain quoted record delimiters and - // such records should be allowed. Default value is FALSE. Setting this value - // to TRUE may lower performance. - AllowQuotedRecordDelimiter *bool `type:"boolean"` - - // A single character used to indicate that a row should be ignored when the - // character is present at the start of that row. You can specify any character - // to indicate a comment line. - Comments *string `type:"string"` - - // A single character used to separate individual fields in a record. You can - // specify an arbitrary delimiter. - FieldDelimiter *string `type:"string"` - - // Describes the first line of input. Valid values are: - // - // * NONE: First line is not a header. - // - // * IGNORE: First line is a header, but you can't use the header values - // to indicate the column in an expression. You can use column position (such - // as _1, _2, …) to indicate the column (SELECT s._1 FROM OBJECT s). - // - // * Use: First line is a header, and you can use the header value to identify - // a column in an expression (SELECT "name" FROM OBJECT). - FileHeaderInfo *string `type:"string" enum:"FileHeaderInfo"` - - // A single character used for escaping when the field delimiter is part of - // the value. For example, if the value is a, b, Amazon S3 wraps this field - // value in quotation marks, as follows: " a , b ". - // - // Type: String - // - // Default: " - // - // Ancestors: CSV - QuoteCharacter *string `type:"string"` - - // A single character used for escaping the quotation mark character inside - // an already escaped value. For example, the value """ a , b """ is parsed - // as " a , b ". - QuoteEscapeCharacter *string `type:"string"` - - // A single character used to separate individual records in the input. Instead - // of the default value, you can specify an arbitrary delimiter. - RecordDelimiter *string `type:"string"` -} - -// String returns the string representation -func (s CSVInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CSVInput) GoString() string { - return s.String() -} - -// SetAllowQuotedRecordDelimiter sets the AllowQuotedRecordDelimiter field's value. -func (s *CSVInput) SetAllowQuotedRecordDelimiter(v bool) *CSVInput { - s.AllowQuotedRecordDelimiter = &v - return s -} - -// SetComments sets the Comments field's value. -func (s *CSVInput) SetComments(v string) *CSVInput { - s.Comments = &v - return s -} - -// SetFieldDelimiter sets the FieldDelimiter field's value. -func (s *CSVInput) SetFieldDelimiter(v string) *CSVInput { - s.FieldDelimiter = &v - return s -} - -// SetFileHeaderInfo sets the FileHeaderInfo field's value. -func (s *CSVInput) SetFileHeaderInfo(v string) *CSVInput { - s.FileHeaderInfo = &v - return s -} - -// SetQuoteCharacter sets the QuoteCharacter field's value. -func (s *CSVInput) SetQuoteCharacter(v string) *CSVInput { - s.QuoteCharacter = &v - return s -} - -// SetQuoteEscapeCharacter sets the QuoteEscapeCharacter field's value. -func (s *CSVInput) SetQuoteEscapeCharacter(v string) *CSVInput { - s.QuoteEscapeCharacter = &v - return s -} - -// SetRecordDelimiter sets the RecordDelimiter field's value. -func (s *CSVInput) SetRecordDelimiter(v string) *CSVInput { - s.RecordDelimiter = &v - return s -} - -// Describes how uncompressed comma-separated values (CSV)-formatted results -// are formatted. -type CSVOutput struct { - _ struct{} `type:"structure"` - - // The value used to separate individual fields in a record. You can specify - // an arbitrary delimiter. - FieldDelimiter *string `type:"string"` - - // A single character used for escaping when the field delimiter is part of - // the value. For example, if the value is a, b, Amazon S3 wraps this field - // value in quotation marks, as follows: " a , b ". - QuoteCharacter *string `type:"string"` - - // The single character used for escaping the quote character inside an already - // escaped value. - QuoteEscapeCharacter *string `type:"string"` - - // Indicates whether to use quotation marks around output fields. - // - // * ALWAYS: Always use quotation marks for output fields. - // - // * ASNEEDED: Use quotation marks for output fields when needed. - QuoteFields *string `type:"string" enum:"QuoteFields"` - - // A single character used to separate individual records in the output. Instead - // of the default value, you can specify an arbitrary delimiter. - RecordDelimiter *string `type:"string"` -} - -// String returns the string representation -func (s CSVOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CSVOutput) GoString() string { - return s.String() -} - -// SetFieldDelimiter sets the FieldDelimiter field's value. -func (s *CSVOutput) SetFieldDelimiter(v string) *CSVOutput { - s.FieldDelimiter = &v - return s -} - -// SetQuoteCharacter sets the QuoteCharacter field's value. -func (s *CSVOutput) SetQuoteCharacter(v string) *CSVOutput { - s.QuoteCharacter = &v - return s -} - -// SetQuoteEscapeCharacter sets the QuoteEscapeCharacter field's value. -func (s *CSVOutput) SetQuoteEscapeCharacter(v string) *CSVOutput { - s.QuoteEscapeCharacter = &v - return s -} - -// SetQuoteFields sets the QuoteFields field's value. -func (s *CSVOutput) SetQuoteFields(v string) *CSVOutput { - s.QuoteFields = &v - return s -} - -// SetRecordDelimiter sets the RecordDelimiter field's value. -func (s *CSVOutput) SetRecordDelimiter(v string) *CSVOutput { - s.RecordDelimiter = &v - return s -} - -// Container for specifying the AWS Lambda notification configuration. -type CloudFunctionConfiguration struct { - _ struct{} `type:"structure"` - - // Lambda cloud function ARN that Amazon S3 can invoke when it detects events - // of the specified type. - CloudFunction *string `type:"string"` - - // The bucket event for which to send notifications. - // - // Deprecated: Event has been deprecated - Event *string `deprecated:"true" type:"string" enum:"Event"` - - // Bucket events for which to send notifications. - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - // An optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // The role supporting the invocation of the Lambda function - InvocationRole *string `type:"string"` -} - -// String returns the string representation -func (s CloudFunctionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CloudFunctionConfiguration) GoString() string { - return s.String() -} - -// SetCloudFunction sets the CloudFunction field's value. -func (s *CloudFunctionConfiguration) SetCloudFunction(v string) *CloudFunctionConfiguration { - s.CloudFunction = &v - return s -} - -// SetEvent sets the Event field's value. -func (s *CloudFunctionConfiguration) SetEvent(v string) *CloudFunctionConfiguration { - s.Event = &v - return s -} - -// SetEvents sets the Events field's value. -func (s *CloudFunctionConfiguration) SetEvents(v []*string) *CloudFunctionConfiguration { - s.Events = v - return s -} - -// SetId sets the Id field's value. -func (s *CloudFunctionConfiguration) SetId(v string) *CloudFunctionConfiguration { - s.Id = &v - return s -} - -// SetInvocationRole sets the InvocationRole field's value. -func (s *CloudFunctionConfiguration) SetInvocationRole(v string) *CloudFunctionConfiguration { - s.InvocationRole = &v - return s -} - -// Container for all (if there are any) keys between Prefix and the next occurrence -// of the string specified by a delimiter. CommonPrefixes lists keys that act -// like subdirectories in the directory specified by Prefix. For example, if -// the prefix is notes/ and the delimiter is a slash (/) as in notes/summer/july, -// the common prefix is notes/summer/. -type CommonPrefix struct { - _ struct{} `type:"structure"` - - // Container for the specified common prefix. - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s CommonPrefix) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CommonPrefix) GoString() string { - return s.String() -} - -// SetPrefix sets the Prefix field's value. -func (s *CommonPrefix) SetPrefix(v string) *CommonPrefix { - s.Prefix = &v - return s -} - -type CompleteMultipartUploadInput struct { - _ struct{} `locationName:"CompleteMultipartUploadRequest" type:"structure" payload:"MultipartUpload"` - - // Name of the bucket to which the multipart upload was initiated. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Object key for which the multipart upload was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // The container for the multipart upload request information. - MultipartUpload *CompletedMultipartUpload `locationName:"CompleteMultipartUpload" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // ID for the initiated multipart upload. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s CompleteMultipartUploadInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompleteMultipartUploadInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CompleteMultipartUploadInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CompleteMultipartUploadInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *CompleteMultipartUploadInput) SetBucket(v string) *CompleteMultipartUploadInput { - s.Bucket = &v - return s -} - -func (s *CompleteMultipartUploadInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *CompleteMultipartUploadInput) SetKey(v string) *CompleteMultipartUploadInput { - s.Key = &v - return s -} - -// SetMultipartUpload sets the MultipartUpload field's value. -func (s *CompleteMultipartUploadInput) SetMultipartUpload(v *CompletedMultipartUpload) *CompleteMultipartUploadInput { - s.MultipartUpload = v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *CompleteMultipartUploadInput) SetRequestPayer(v string) *CompleteMultipartUploadInput { - s.RequestPayer = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *CompleteMultipartUploadInput) SetUploadId(v string) *CompleteMultipartUploadInput { - s.UploadId = &v - return s -} - -func (s *CompleteMultipartUploadInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *CompleteMultipartUploadInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type CompleteMultipartUploadOutput struct { - _ struct{} `type:"structure"` - - // The name of the bucket that contains the newly created object. - Bucket *string `type:"string"` - - // Entity tag that identifies the newly created object's data. Objects with - // different object data will have different entity tags. The entity tag is - // an opaque string. The entity tag may or may not be an MD5 digest of the object - // data. If the entity tag is not an MD5 digest of the object data, it will - // contain one or more nonhexadecimal characters and/or will consist of less - // than 32 or more than 32 hexadecimal digits. - ETag *string `type:"string"` - - // If the object expiration is configured, this will contain the expiration - // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The object key of the newly created object. - Key *string `min:"1" type:"string"` - - // The URI that identifies the newly created object. - Location *string `type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // If you specified server-side encryption either with an Amazon S3-managed - // encryption key or an AWS KMS customer master key (CMK) in your initiate multipart - // upload request, the response includes this header. It confirms the encryption - // algorithm that Amazon S3 used to encrypt the object. - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Version ID of the newly created object, in case the bucket has versioning - // turned on. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s CompleteMultipartUploadOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompleteMultipartUploadOutput) GoString() string { - return s.String() -} - -// SetBucket sets the Bucket field's value. -func (s *CompleteMultipartUploadOutput) SetBucket(v string) *CompleteMultipartUploadOutput { - s.Bucket = &v - return s -} - -func (s *CompleteMultipartUploadOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetETag sets the ETag field's value. -func (s *CompleteMultipartUploadOutput) SetETag(v string) *CompleteMultipartUploadOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *CompleteMultipartUploadOutput) SetExpiration(v string) *CompleteMultipartUploadOutput { - s.Expiration = &v - return s -} - -// SetKey sets the Key field's value. -func (s *CompleteMultipartUploadOutput) SetKey(v string) *CompleteMultipartUploadOutput { - s.Key = &v - return s -} - -// SetLocation sets the Location field's value. -func (s *CompleteMultipartUploadOutput) SetLocation(v string) *CompleteMultipartUploadOutput { - s.Location = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *CompleteMultipartUploadOutput) SetRequestCharged(v string) *CompleteMultipartUploadOutput { - s.RequestCharged = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CompleteMultipartUploadOutput) SetSSEKMSKeyId(v string) *CompleteMultipartUploadOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CompleteMultipartUploadOutput) SetServerSideEncryption(v string) *CompleteMultipartUploadOutput { - s.ServerSideEncryption = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *CompleteMultipartUploadOutput) SetVersionId(v string) *CompleteMultipartUploadOutput { - s.VersionId = &v - return s -} - -// The container for the completed multipart upload details. -type CompletedMultipartUpload struct { - _ struct{} `type:"structure"` - - // Array of CompletedPart data types. - Parts []*CompletedPart `locationName:"Part" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s CompletedMultipartUpload) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompletedMultipartUpload) GoString() string { - return s.String() -} - -// SetParts sets the Parts field's value. -func (s *CompletedMultipartUpload) SetParts(v []*CompletedPart) *CompletedMultipartUpload { - s.Parts = v - return s -} - -// Details of the parts that were uploaded. -type CompletedPart struct { - _ struct{} `type:"structure"` - - // Entity tag returned when the part was uploaded. - ETag *string `type:"string"` - - // Part number that identifies the part. This is a positive integer between - // 1 and 10,000. - PartNumber *int64 `type:"integer"` -} - -// String returns the string representation -func (s CompletedPart) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompletedPart) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *CompletedPart) SetETag(v string) *CompletedPart { - s.ETag = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *CompletedPart) SetPartNumber(v int64) *CompletedPart { - s.PartNumber = &v - return s -} - -// A container for describing a condition that must be met for the specified -// redirect to apply. For example, 1. If request is for pages in the /docs folder, -// redirect to the /documents folder. 2. If request results in HTTP error 4xx, -// redirect request to another host where you might process the error. -type Condition struct { - _ struct{} `type:"structure"` - - // The HTTP error code when the redirect is applied. In the event of an error, - // if the error code equals this value, then the specified redirect is applied. - // Required when parent element Condition is specified and sibling KeyPrefixEquals - // is not specified. If both are specified, then both must be true for the redirect - // to be applied. - HttpErrorCodeReturnedEquals *string `type:"string"` - - // The object key name prefix when the redirect is applied. For example, to - // redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. - // To redirect request for all pages with the prefix docs/, the key prefix will - // be /docs, which identifies all objects in the docs/ folder. Required when - // the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals - // is not specified. If both conditions are specified, both must be true for - // the redirect to be applied. - KeyPrefixEquals *string `type:"string"` -} - -// String returns the string representation -func (s Condition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Condition) GoString() string { - return s.String() -} - -// SetHttpErrorCodeReturnedEquals sets the HttpErrorCodeReturnedEquals field's value. -func (s *Condition) SetHttpErrorCodeReturnedEquals(v string) *Condition { - s.HttpErrorCodeReturnedEquals = &v - return s -} - -// SetKeyPrefixEquals sets the KeyPrefixEquals field's value. -func (s *Condition) SetKeyPrefixEquals(v string) *Condition { - s.KeyPrefixEquals = &v - return s -} - -type ContinuationEvent struct { - _ struct{} `locationName:"ContinuationEvent" type:"structure"` -} - -// String returns the string representation -func (s ContinuationEvent) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ContinuationEvent) GoString() string { - return s.String() -} - -// The ContinuationEvent is and event in the SelectObjectContentEventStream group of events. -func (s *ContinuationEvent) eventSelectObjectContentEventStream() {} - -// UnmarshalEvent unmarshals the EventStream Message into the ContinuationEvent value. -// This method is only used internally within the SDK's EventStream handling. -func (s *ContinuationEvent) UnmarshalEvent( - payloadUnmarshaler protocol.PayloadUnmarshaler, - msg eventstream.Message, -) error { - return nil -} - -func (s *ContinuationEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { - msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) - return msg, err -} - -type CopyObjectInput struct { - _ struct{} `locationName:"CopyObjectRequest" type:"structure"` - - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // The name of the destination bucket. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The name of the source bucket and key name of the source object, separated - // by a slash (/). Must be URL-encoded. - // - // CopySource is a required field - CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` - - // Copies the object if its entity tag (ETag) matches the specified tag. - CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` - - // Copies the object if it has been modified since the specified time. - CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp"` - - // Copies the object if its entity tag (ETag) is different than the specified - // ETag. - CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` - - // Copies the object if it hasn't been modified since the specified time. - CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp"` - - // Specifies the algorithm to use when decrypting the source object (for example, - // AES256). - CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt - // the source object. The encryption key provided in this header must be one - // that was used when the source object was created. - CopySourceSSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // The key of the destination object. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Specifies whether the metadata is copied from the source object or replaced - // with metadata provided in the request. - MetadataDirective *string `location:"header" locationName:"x-amz-metadata-directive" type:"string" enum:"MetadataDirective"` - - // Specifies whether you want to apply a Legal Hold to the copied object. - ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - - // The Object Lock mode that you want to apply to the copied object. - ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - - // The date and time when you want the copied object's Object Lock to expire. - ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS Encryption Context to use for object encryption. The - // value of this header is a base64-encoded UTF-8 string holding JSON with the - // encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. For information about configuring using any of the officially - // supported AWS SDKs and AWS CLI, see Specifying the Signature Version in Request - // Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version) - // in the Amazon S3 Developer Guide. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The tag-set for the object destination object this value must be used in - // conjunction with the TaggingDirective. The tag-set must be encoded as URL - // Query parameters. - Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` - - // Specifies whether the object tag-set are copied from the source object or - // replaced with tag-set provided in the request. - TaggingDirective *string `location:"header" locationName:"x-amz-tagging-directive" type:"string" enum:"TaggingDirective"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s CopyObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CopyObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CopyObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.CopySource == nil { - invalidParams.Add(request.NewErrParamRequired("CopySource")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *CopyObjectInput) SetACL(v string) *CopyObjectInput { - s.ACL = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CopyObjectInput) SetBucket(v string) *CopyObjectInput { - s.Bucket = &v - return s -} - -func (s *CopyObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCacheControl sets the CacheControl field's value. -func (s *CopyObjectInput) SetCacheControl(v string) *CopyObjectInput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *CopyObjectInput) SetContentDisposition(v string) *CopyObjectInput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *CopyObjectInput) SetContentEncoding(v string) *CopyObjectInput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *CopyObjectInput) SetContentLanguage(v string) *CopyObjectInput { - s.ContentLanguage = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *CopyObjectInput) SetContentType(v string) *CopyObjectInput { - s.ContentType = &v - return s -} - -// SetCopySource sets the CopySource field's value. -func (s *CopyObjectInput) SetCopySource(v string) *CopyObjectInput { - s.CopySource = &v - return s -} - -// SetCopySourceIfMatch sets the CopySourceIfMatch field's value. -func (s *CopyObjectInput) SetCopySourceIfMatch(v string) *CopyObjectInput { - s.CopySourceIfMatch = &v - return s -} - -// SetCopySourceIfModifiedSince sets the CopySourceIfModifiedSince field's value. -func (s *CopyObjectInput) SetCopySourceIfModifiedSince(v time.Time) *CopyObjectInput { - s.CopySourceIfModifiedSince = &v - return s -} - -// SetCopySourceIfNoneMatch sets the CopySourceIfNoneMatch field's value. -func (s *CopyObjectInput) SetCopySourceIfNoneMatch(v string) *CopyObjectInput { - s.CopySourceIfNoneMatch = &v - return s -} - -// SetCopySourceIfUnmodifiedSince sets the CopySourceIfUnmodifiedSince field's value. -func (s *CopyObjectInput) SetCopySourceIfUnmodifiedSince(v time.Time) *CopyObjectInput { - s.CopySourceIfUnmodifiedSince = &v - return s -} - -// SetCopySourceSSECustomerAlgorithm sets the CopySourceSSECustomerAlgorithm field's value. -func (s *CopyObjectInput) SetCopySourceSSECustomerAlgorithm(v string) *CopyObjectInput { - s.CopySourceSSECustomerAlgorithm = &v - return s -} - -// SetCopySourceSSECustomerKey sets the CopySourceSSECustomerKey field's value. -func (s *CopyObjectInput) SetCopySourceSSECustomerKey(v string) *CopyObjectInput { - s.CopySourceSSECustomerKey = &v - return s -} - -func (s *CopyObjectInput) getCopySourceSSECustomerKey() (v string) { - if s.CopySourceSSECustomerKey == nil { - return v - } - return *s.CopySourceSSECustomerKey -} - -// SetCopySourceSSECustomerKeyMD5 sets the CopySourceSSECustomerKeyMD5 field's value. -func (s *CopyObjectInput) SetCopySourceSSECustomerKeyMD5(v string) *CopyObjectInput { - s.CopySourceSSECustomerKeyMD5 = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *CopyObjectInput) SetExpires(v time.Time) *CopyObjectInput { - s.Expires = &v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *CopyObjectInput) SetGrantFullControl(v string) *CopyObjectInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *CopyObjectInput) SetGrantRead(v string) *CopyObjectInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *CopyObjectInput) SetGrantReadACP(v string) *CopyObjectInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *CopyObjectInput) SetGrantWriteACP(v string) *CopyObjectInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *CopyObjectInput) SetKey(v string) *CopyObjectInput { - s.Key = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *CopyObjectInput) SetMetadata(v map[string]*string) *CopyObjectInput { - s.Metadata = v - return s -} - -// SetMetadataDirective sets the MetadataDirective field's value. -func (s *CopyObjectInput) SetMetadataDirective(v string) *CopyObjectInput { - s.MetadataDirective = &v - return s -} - -// SetObjectLockLegalHoldStatus sets the ObjectLockLegalHoldStatus field's value. -func (s *CopyObjectInput) SetObjectLockLegalHoldStatus(v string) *CopyObjectInput { - s.ObjectLockLegalHoldStatus = &v - return s -} - -// SetObjectLockMode sets the ObjectLockMode field's value. -func (s *CopyObjectInput) SetObjectLockMode(v string) *CopyObjectInput { - s.ObjectLockMode = &v - return s -} - -// SetObjectLockRetainUntilDate sets the ObjectLockRetainUntilDate field's value. -func (s *CopyObjectInput) SetObjectLockRetainUntilDate(v time.Time) *CopyObjectInput { - s.ObjectLockRetainUntilDate = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *CopyObjectInput) SetRequestPayer(v string) *CopyObjectInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CopyObjectInput) SetSSECustomerAlgorithm(v string) *CopyObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *CopyObjectInput) SetSSECustomerKey(v string) *CopyObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *CopyObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CopyObjectInput) SetSSECustomerKeyMD5(v string) *CopyObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CopyObjectInput) SetSSEKMSEncryptionContext(v string) *CopyObjectInput { - s.SSEKMSEncryptionContext = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CopyObjectInput) SetSSEKMSKeyId(v string) *CopyObjectInput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CopyObjectInput) SetServerSideEncryption(v string) *CopyObjectInput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *CopyObjectInput) SetStorageClass(v string) *CopyObjectInput { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *CopyObjectInput) SetTagging(v string) *CopyObjectInput { - s.Tagging = &v - return s -} - -// SetTaggingDirective sets the TaggingDirective field's value. -func (s *CopyObjectInput) SetTaggingDirective(v string) *CopyObjectInput { - s.TaggingDirective = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *CopyObjectInput) SetWebsiteRedirectLocation(v string) *CopyObjectInput { - s.WebsiteRedirectLocation = &v - return s -} - -func (s *CopyObjectInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *CopyObjectInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type CopyObjectOutput struct { - _ struct{} `type:"structure" payload:"CopyObjectResult"` - - // Container for all response elements. - CopyObjectResult *CopyObjectResult `type:"structure"` - - // Version of the copied object in the destination bucket. - CopySourceVersionId *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` - - // If the object expiration is configured, the response includes this header. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the AWS KMS Encryption Context to use for object encryption. - // The value of this header is a base64-encoded UTF-8 string holding JSON with - // the encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Version ID of the newly created copy. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s CopyObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyObjectOutput) GoString() string { - return s.String() -} - -// SetCopyObjectResult sets the CopyObjectResult field's value. -func (s *CopyObjectOutput) SetCopyObjectResult(v *CopyObjectResult) *CopyObjectOutput { - s.CopyObjectResult = v - return s -} - -// SetCopySourceVersionId sets the CopySourceVersionId field's value. -func (s *CopyObjectOutput) SetCopySourceVersionId(v string) *CopyObjectOutput { - s.CopySourceVersionId = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *CopyObjectOutput) SetExpiration(v string) *CopyObjectOutput { - s.Expiration = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *CopyObjectOutput) SetRequestCharged(v string) *CopyObjectOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CopyObjectOutput) SetSSECustomerAlgorithm(v string) *CopyObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CopyObjectOutput) SetSSECustomerKeyMD5(v string) *CopyObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CopyObjectOutput) SetSSEKMSEncryptionContext(v string) *CopyObjectOutput { - s.SSEKMSEncryptionContext = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CopyObjectOutput) SetSSEKMSKeyId(v string) *CopyObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CopyObjectOutput) SetServerSideEncryption(v string) *CopyObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *CopyObjectOutput) SetVersionId(v string) *CopyObjectOutput { - s.VersionId = &v - return s -} - -// Container for all response elements. -type CopyObjectResult struct { - _ struct{} `type:"structure"` - - // Returns the ETag of the new object. The ETag reflects only changes to the - // contents of an object, not its metadata. The source and destination ETag - // is identical for a successfully copied object. - ETag *string `type:"string"` - - // Returns the date that the object was last modified. - LastModified *time.Time `type:"timestamp"` -} - -// String returns the string representation -func (s CopyObjectResult) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyObjectResult) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *CopyObjectResult) SetETag(v string) *CopyObjectResult { - s.ETag = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *CopyObjectResult) SetLastModified(v time.Time) *CopyObjectResult { - s.LastModified = &v - return s -} - -// Container for all response elements. -type CopyPartResult struct { - _ struct{} `type:"structure"` - - // Entity tag of the object. - ETag *string `type:"string"` - - // Date and time at which the object was uploaded. - LastModified *time.Time `type:"timestamp"` -} - -// String returns the string representation -func (s CopyPartResult) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyPartResult) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *CopyPartResult) SetETag(v string) *CopyPartResult { - s.ETag = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *CopyPartResult) SetLastModified(v time.Time) *CopyPartResult { - s.LastModified = &v - return s -} - -// The configuration information for the bucket. -type CreateBucketConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies the Region where the bucket will be created. If you don't specify - // a Region, the bucket is created in the US East (N. Virginia) Region (us-east-1). - LocationConstraint *string `type:"string" enum:"BucketLocationConstraint"` -} - -// String returns the string representation -func (s CreateBucketConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateBucketConfiguration) GoString() string { - return s.String() -} - -// SetLocationConstraint sets the LocationConstraint field's value. -func (s *CreateBucketConfiguration) SetLocationConstraint(v string) *CreateBucketConfiguration { - s.LocationConstraint = &v - return s -} - -type CreateBucketInput struct { - _ struct{} `locationName:"CreateBucketRequest" type:"structure" payload:"CreateBucketConfiguration"` - - // The canned ACL to apply to the bucket. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` - - // The name of the bucket to create. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The configuration information for the bucket. - CreateBucketConfiguration *CreateBucketConfiguration `locationName:"CreateBucketConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Specifies whether you want S3 Object Lock to be enabled for the new bucket. - ObjectLockEnabledForBucket *bool `location:"header" locationName:"x-amz-bucket-object-lock-enabled" type:"boolean"` -} - -// String returns the string representation -func (s CreateBucketInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateBucketInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateBucketInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateBucketInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *CreateBucketInput) SetACL(v string) *CreateBucketInput { - s.ACL = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CreateBucketInput) SetBucket(v string) *CreateBucketInput { - s.Bucket = &v - return s -} - -func (s *CreateBucketInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCreateBucketConfiguration sets the CreateBucketConfiguration field's value. -func (s *CreateBucketInput) SetCreateBucketConfiguration(v *CreateBucketConfiguration) *CreateBucketInput { - s.CreateBucketConfiguration = v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *CreateBucketInput) SetGrantFullControl(v string) *CreateBucketInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *CreateBucketInput) SetGrantRead(v string) *CreateBucketInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *CreateBucketInput) SetGrantReadACP(v string) *CreateBucketInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWrite sets the GrantWrite field's value. -func (s *CreateBucketInput) SetGrantWrite(v string) *CreateBucketInput { - s.GrantWrite = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *CreateBucketInput) SetGrantWriteACP(v string) *CreateBucketInput { - s.GrantWriteACP = &v - return s -} - -// SetObjectLockEnabledForBucket sets the ObjectLockEnabledForBucket field's value. -func (s *CreateBucketInput) SetObjectLockEnabledForBucket(v bool) *CreateBucketInput { - s.ObjectLockEnabledForBucket = &v - return s -} - -type CreateBucketOutput struct { - _ struct{} `type:"structure"` - - // Specifies the Region where the bucket will be created. If you are creating - // a bucket on the US East (N. Virginia) Region (us-east-1), you do not need - // to specify the location. - Location *string `location:"header" locationName:"Location" type:"string"` -} - -// String returns the string representation -func (s CreateBucketOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateBucketOutput) GoString() string { - return s.String() -} - -// SetLocation sets the Location field's value. -func (s *CreateBucketOutput) SetLocation(v string) *CreateBucketOutput { - s.Location = &v - return s -} - -type CreateMultipartUploadInput struct { - _ struct{} `locationName:"CreateMultipartUploadRequest" type:"structure"` - - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // The name of the bucket to which to initiate the upload - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Object key for which the multipart upload is to be initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Specifies whether you want to apply a Legal Hold to the uploaded object. - ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - - // Specifies the Object Lock mode that you want to apply to the uploaded object. - ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - - // Specifies the date and time when you want the Object Lock to expire. - ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS Encryption Context to use for object encryption. The - // value of this header is a base64-encoded UTF-8 string holding JSON with the - // encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - - // Specifies the ID of the symmetric customer managed AWS KMS CMK to use for - // object encryption. All GET and PUT requests for an object protected by AWS - // KMS will fail if not made via SSL or using SigV4. For information about configuring - // using any of the officially supported AWS SDKs and AWS CLI, see Specifying - // the Signature Version in Request Authentication (https://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version) - // in the Amazon S3 Developer Guide. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The tag-set for the object. The tag-set must be encoded as URL Query parameters. - Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s CreateMultipartUploadInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateMultipartUploadInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateMultipartUploadInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateMultipartUploadInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *CreateMultipartUploadInput) SetACL(v string) *CreateMultipartUploadInput { - s.ACL = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CreateMultipartUploadInput) SetBucket(v string) *CreateMultipartUploadInput { - s.Bucket = &v - return s -} - -func (s *CreateMultipartUploadInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCacheControl sets the CacheControl field's value. -func (s *CreateMultipartUploadInput) SetCacheControl(v string) *CreateMultipartUploadInput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *CreateMultipartUploadInput) SetContentDisposition(v string) *CreateMultipartUploadInput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *CreateMultipartUploadInput) SetContentEncoding(v string) *CreateMultipartUploadInput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *CreateMultipartUploadInput) SetContentLanguage(v string) *CreateMultipartUploadInput { - s.ContentLanguage = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *CreateMultipartUploadInput) SetContentType(v string) *CreateMultipartUploadInput { - s.ContentType = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *CreateMultipartUploadInput) SetExpires(v time.Time) *CreateMultipartUploadInput { - s.Expires = &v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *CreateMultipartUploadInput) SetGrantFullControl(v string) *CreateMultipartUploadInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *CreateMultipartUploadInput) SetGrantRead(v string) *CreateMultipartUploadInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *CreateMultipartUploadInput) SetGrantReadACP(v string) *CreateMultipartUploadInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *CreateMultipartUploadInput) SetGrantWriteACP(v string) *CreateMultipartUploadInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *CreateMultipartUploadInput) SetKey(v string) *CreateMultipartUploadInput { - s.Key = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *CreateMultipartUploadInput) SetMetadata(v map[string]*string) *CreateMultipartUploadInput { - s.Metadata = v - return s -} - -// SetObjectLockLegalHoldStatus sets the ObjectLockLegalHoldStatus field's value. -func (s *CreateMultipartUploadInput) SetObjectLockLegalHoldStatus(v string) *CreateMultipartUploadInput { - s.ObjectLockLegalHoldStatus = &v - return s -} - -// SetObjectLockMode sets the ObjectLockMode field's value. -func (s *CreateMultipartUploadInput) SetObjectLockMode(v string) *CreateMultipartUploadInput { - s.ObjectLockMode = &v - return s -} - -// SetObjectLockRetainUntilDate sets the ObjectLockRetainUntilDate field's value. -func (s *CreateMultipartUploadInput) SetObjectLockRetainUntilDate(v time.Time) *CreateMultipartUploadInput { - s.ObjectLockRetainUntilDate = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *CreateMultipartUploadInput) SetRequestPayer(v string) *CreateMultipartUploadInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CreateMultipartUploadInput) SetSSECustomerAlgorithm(v string) *CreateMultipartUploadInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *CreateMultipartUploadInput) SetSSECustomerKey(v string) *CreateMultipartUploadInput { - s.SSECustomerKey = &v - return s -} - -func (s *CreateMultipartUploadInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CreateMultipartUploadInput) SetSSECustomerKeyMD5(v string) *CreateMultipartUploadInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CreateMultipartUploadInput) SetSSEKMSEncryptionContext(v string) *CreateMultipartUploadInput { - s.SSEKMSEncryptionContext = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CreateMultipartUploadInput) SetSSEKMSKeyId(v string) *CreateMultipartUploadInput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CreateMultipartUploadInput) SetServerSideEncryption(v string) *CreateMultipartUploadInput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *CreateMultipartUploadInput) SetStorageClass(v string) *CreateMultipartUploadInput { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *CreateMultipartUploadInput) SetTagging(v string) *CreateMultipartUploadInput { - s.Tagging = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *CreateMultipartUploadInput) SetWebsiteRedirectLocation(v string) *CreateMultipartUploadInput { - s.WebsiteRedirectLocation = &v - return s -} - -func (s *CreateMultipartUploadInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *CreateMultipartUploadInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type CreateMultipartUploadOutput struct { - _ struct{} `type:"structure"` - - // If the bucket has a lifecycle rule configured with an action to abort incomplete - // multipart uploads and the prefix in the lifecycle rule matches the object - // name in the request, the response includes this header. The header indicates - // when the initiated multipart upload becomes eligible for an abort operation. - // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket - // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config). - // - // The response also includes the x-amz-abort-rule-id header that provides the - // ID of the lifecycle configuration rule that defines this action. - AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp"` - - // This header is returned along with the x-amz-abort-date header. It identifies - // the applicable lifecycle configuration rule that defines the action to abort - // incomplete multipart uploads. - AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` - - // Name of the bucket to which the multipart upload was initiated. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - Bucket *string `locationName:"Bucket" type:"string"` - - // Object key for which the multipart upload was initiated. - Key *string `min:"1" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the AWS KMS Encryption Context to use for object encryption. - // The value of this header is a base64-encoded UTF-8 string holding JSON with - // the encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // ID for the initiated multipart upload. - UploadId *string `type:"string"` -} - -// String returns the string representation -func (s CreateMultipartUploadOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateMultipartUploadOutput) GoString() string { - return s.String() -} - -// SetAbortDate sets the AbortDate field's value. -func (s *CreateMultipartUploadOutput) SetAbortDate(v time.Time) *CreateMultipartUploadOutput { - s.AbortDate = &v - return s -} - -// SetAbortRuleId sets the AbortRuleId field's value. -func (s *CreateMultipartUploadOutput) SetAbortRuleId(v string) *CreateMultipartUploadOutput { - s.AbortRuleId = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CreateMultipartUploadOutput) SetBucket(v string) *CreateMultipartUploadOutput { - s.Bucket = &v - return s -} - -func (s *CreateMultipartUploadOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *CreateMultipartUploadOutput) SetKey(v string) *CreateMultipartUploadOutput { - s.Key = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *CreateMultipartUploadOutput) SetRequestCharged(v string) *CreateMultipartUploadOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CreateMultipartUploadOutput) SetSSECustomerAlgorithm(v string) *CreateMultipartUploadOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CreateMultipartUploadOutput) SetSSECustomerKeyMD5(v string) *CreateMultipartUploadOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CreateMultipartUploadOutput) SetSSEKMSEncryptionContext(v string) *CreateMultipartUploadOutput { - s.SSEKMSEncryptionContext = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CreateMultipartUploadOutput) SetSSEKMSKeyId(v string) *CreateMultipartUploadOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CreateMultipartUploadOutput) SetServerSideEncryption(v string) *CreateMultipartUploadOutput { - s.ServerSideEncryption = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *CreateMultipartUploadOutput) SetUploadId(v string) *CreateMultipartUploadOutput { - s.UploadId = &v - return s -} - -// The container element for specifying the default Object Lock retention settings -// for new objects placed in the specified bucket. -type DefaultRetention struct { - _ struct{} `type:"structure"` - - // The number of days that you want to specify for the default retention period. - Days *int64 `type:"integer"` - - // The default Object Lock retention mode you want to apply to new objects placed - // in the specified bucket. - Mode *string `type:"string" enum:"ObjectLockRetentionMode"` - - // The number of years that you want to specify for the default retention period. - Years *int64 `type:"integer"` -} - -// String returns the string representation -func (s DefaultRetention) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DefaultRetention) GoString() string { - return s.String() -} - -// SetDays sets the Days field's value. -func (s *DefaultRetention) SetDays(v int64) *DefaultRetention { - s.Days = &v - return s -} - -// SetMode sets the Mode field's value. -func (s *DefaultRetention) SetMode(v string) *DefaultRetention { - s.Mode = &v - return s -} - -// SetYears sets the Years field's value. -func (s *DefaultRetention) SetYears(v int64) *DefaultRetention { - s.Years = &v - return s -} - -// Container for the objects to delete. -type Delete struct { - _ struct{} `type:"structure"` - - // The objects to delete. - // - // Objects is a required field - Objects []*ObjectIdentifier `locationName:"Object" type:"list" flattened:"true" required:"true"` - - // Element to enable quiet mode for the request. When you add this element, - // you must set its value to true. - Quiet *bool `type:"boolean"` -} - -// String returns the string representation -func (s Delete) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Delete) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Delete) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Delete"} - if s.Objects == nil { - invalidParams.Add(request.NewErrParamRequired("Objects")) - } - if s.Objects != nil { - for i, v := range s.Objects { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Objects", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetObjects sets the Objects field's value. -func (s *Delete) SetObjects(v []*ObjectIdentifier) *Delete { - s.Objects = v - return s -} - -// SetQuiet sets the Quiet field's value. -func (s *Delete) SetQuiet(v bool) *Delete { - s.Quiet = &v - return s -} - -type DeleteBucketAnalyticsConfigurationInput struct { - _ struct{} `locationName:"DeleteBucketAnalyticsConfigurationRequest" type:"structure"` - - // The name of the bucket from which an analytics configuration is deleted. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID that identifies the analytics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketAnalyticsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketAnalyticsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketAnalyticsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketAnalyticsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketAnalyticsConfigurationInput) SetBucket(v string) *DeleteBucketAnalyticsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketAnalyticsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *DeleteBucketAnalyticsConfigurationInput) SetId(v string) *DeleteBucketAnalyticsConfigurationInput { - s.Id = &v - return s -} - -func (s *DeleteBucketAnalyticsConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketAnalyticsConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketAnalyticsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketAnalyticsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketAnalyticsConfigurationOutput) GoString() string { - return s.String() -} - -type DeleteBucketCorsInput struct { - _ struct{} `locationName:"DeleteBucketCorsRequest" type:"structure"` - - // Specifies the bucket whose cors configuration is being deleted. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketCorsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketCorsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketCorsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketCorsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketCorsInput) SetBucket(v string) *DeleteBucketCorsInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketCorsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketCorsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketCorsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketCorsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketCorsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketCorsOutput) GoString() string { - return s.String() -} - -type DeleteBucketEncryptionInput struct { - _ struct{} `locationName:"DeleteBucketEncryptionRequest" type:"structure"` - - // The name of the bucket containing the server-side encryption configuration - // to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketEncryptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketEncryptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketEncryptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketEncryptionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketEncryptionInput) SetBucket(v string) *DeleteBucketEncryptionInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketEncryptionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketEncryptionInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketEncryptionInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketEncryptionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketEncryptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketEncryptionOutput) GoString() string { - return s.String() -} - -type DeleteBucketInput struct { - _ struct{} `locationName:"DeleteBucketRequest" type:"structure"` - - // Specifies the bucket being deleted. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketInput) SetBucket(v string) *DeleteBucketInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketInventoryConfigurationInput struct { - _ struct{} `locationName:"DeleteBucketInventoryConfigurationRequest" type:"structure"` - - // The name of the bucket containing the inventory configuration to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketInventoryConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketInventoryConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketInventoryConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketInventoryConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketInventoryConfigurationInput) SetBucket(v string) *DeleteBucketInventoryConfigurationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketInventoryConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *DeleteBucketInventoryConfigurationInput) SetId(v string) *DeleteBucketInventoryConfigurationInput { - s.Id = &v - return s -} - -func (s *DeleteBucketInventoryConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketInventoryConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketInventoryConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketInventoryConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketInventoryConfigurationOutput) GoString() string { - return s.String() -} - -type DeleteBucketLifecycleInput struct { - _ struct{} `locationName:"DeleteBucketLifecycleRequest" type:"structure"` - - // The bucket name of the lifecycle to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketLifecycleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketLifecycleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketLifecycleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketLifecycleInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketLifecycleInput) SetBucket(v string) *DeleteBucketLifecycleInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketLifecycleInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketLifecycleInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketLifecycleInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketLifecycleOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketLifecycleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketLifecycleOutput) GoString() string { - return s.String() -} - -type DeleteBucketMetricsConfigurationInput struct { - _ struct{} `locationName:"DeleteBucketMetricsConfigurationRequest" type:"structure"` - - // The name of the bucket containing the metrics configuration to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketMetricsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketMetricsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketMetricsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketMetricsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketMetricsConfigurationInput) SetBucket(v string) *DeleteBucketMetricsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketMetricsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *DeleteBucketMetricsConfigurationInput) SetId(v string) *DeleteBucketMetricsConfigurationInput { - s.Id = &v - return s -} - -func (s *DeleteBucketMetricsConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketMetricsConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketMetricsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketMetricsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketMetricsConfigurationOutput) GoString() string { - return s.String() -} - -type DeleteBucketOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketOutput) GoString() string { - return s.String() -} - -type DeleteBucketPolicyInput struct { - _ struct{} `locationName:"DeleteBucketPolicyRequest" type:"structure"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketPolicyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketPolicyInput) SetBucket(v string) *DeleteBucketPolicyInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketPolicyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketPolicyInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketPolicyInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketPolicyOutput) GoString() string { - return s.String() -} - -type DeleteBucketReplicationInput struct { - _ struct{} `locationName:"DeleteBucketReplicationRequest" type:"structure"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketReplicationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketReplicationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketReplicationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketReplicationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketReplicationInput) SetBucket(v string) *DeleteBucketReplicationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketReplicationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketReplicationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketReplicationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketReplicationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketReplicationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketReplicationOutput) GoString() string { - return s.String() -} - -type DeleteBucketTaggingInput struct { - _ struct{} `locationName:"DeleteBucketTaggingRequest" type:"structure"` - - // The bucket that has the tag set to be removed. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketTaggingInput) SetBucket(v string) *DeleteBucketTaggingInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketTaggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketTaggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketTaggingOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketTaggingOutput) GoString() string { - return s.String() -} - -type DeleteBucketWebsiteInput struct { - _ struct{} `locationName:"DeleteBucketWebsiteRequest" type:"structure"` - - // The bucket name for which you want to remove the website configuration. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketWebsiteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketWebsiteInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketWebsiteInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketWebsiteInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketWebsiteInput) SetBucket(v string) *DeleteBucketWebsiteInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketWebsiteInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeleteBucketWebsiteInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteBucketWebsiteInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteBucketWebsiteOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketWebsiteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketWebsiteOutput) GoString() string { - return s.String() -} - -// Information about the delete marker. -type DeleteMarkerEntry struct { - _ struct{} `type:"structure"` - - // Specifies whether the object is (true) or is not (false) the latest version - // of an object. - IsLatest *bool `type:"boolean"` - - // The object key. - Key *string `min:"1" type:"string"` - - // Date and time the object was last modified. - LastModified *time.Time `type:"timestamp"` - - // The account that created the delete marker.> - Owner *Owner `type:"structure"` - - // Version ID of an object. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s DeleteMarkerEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteMarkerEntry) GoString() string { - return s.String() -} - -// SetIsLatest sets the IsLatest field's value. -func (s *DeleteMarkerEntry) SetIsLatest(v bool) *DeleteMarkerEntry { - s.IsLatest = &v - return s -} - -// SetKey sets the Key field's value. -func (s *DeleteMarkerEntry) SetKey(v string) *DeleteMarkerEntry { - s.Key = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *DeleteMarkerEntry) SetLastModified(v time.Time) *DeleteMarkerEntry { - s.LastModified = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *DeleteMarkerEntry) SetOwner(v *Owner) *DeleteMarkerEntry { - s.Owner = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteMarkerEntry) SetVersionId(v string) *DeleteMarkerEntry { - s.VersionId = &v - return s -} - -// Specifies whether Amazon S3 replicates the delete markers. If you specify -// a Filter, you must specify this element. However, in the latest version of -// replication configuration (when Filter is specified), Amazon S3 doesn't replicate -// delete markers. Therefore, the DeleteMarkerReplication element can contain -// only Disabled. For an example configuration, see Basic Rule -// Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-config-min-rule-config). -// -// If you don't specify the Filter element, Amazon S3 assumes that the replication -// configuration is the earlier version, V1. In the earlier version, Amazon -// S3 handled replication of delete markers differently. For more information, -// see Backward Compatibility (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations). -type DeleteMarkerReplication struct { - _ struct{} `type:"structure"` - - // Indicates whether to replicate delete markers. - // - // In the current implementation, Amazon S3 doesn't replicate the delete markers. - // The status must be Disabled. - Status *string `type:"string" enum:"DeleteMarkerReplicationStatus"` -} - -// String returns the string representation -func (s DeleteMarkerReplication) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteMarkerReplication) GoString() string { - return s.String() -} - -// SetStatus sets the Status field's value. -func (s *DeleteMarkerReplication) SetStatus(v string) *DeleteMarkerReplication { - s.Status = &v - return s -} - -type DeleteObjectInput struct { - _ struct{} `locationName:"DeleteObjectRequest" type:"structure"` - - // The bucket name of the bucket containing the object. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Indicates whether S3 Object Lock should bypass Governance-mode restrictions - // to process this operation. - BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` - - // Key name of the object to delete. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. Required to - // permanently delete a versioned object if versioning is configured with MFA - // delete enabled. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteObjectInput) SetBucket(v string) *DeleteObjectInput { - s.Bucket = &v - return s -} - -func (s *DeleteObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBypassGovernanceRetention sets the BypassGovernanceRetention field's value. -func (s *DeleteObjectInput) SetBypassGovernanceRetention(v bool) *DeleteObjectInput { - s.BypassGovernanceRetention = &v - return s -} - -// SetKey sets the Key field's value. -func (s *DeleteObjectInput) SetKey(v string) *DeleteObjectInput { - s.Key = &v - return s -} - -// SetMFA sets the MFA field's value. -func (s *DeleteObjectInput) SetMFA(v string) *DeleteObjectInput { - s.MFA = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *DeleteObjectInput) SetRequestPayer(v string) *DeleteObjectInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectInput) SetVersionId(v string) *DeleteObjectInput { - s.VersionId = &v - return s -} - -func (s *DeleteObjectInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteObjectInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteObjectOutput struct { - _ struct{} `type:"structure"` - - // Specifies whether the versioned object that was permanently deleted was (true) - // or was not (false) a delete marker. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Returns the version ID of the delete marker created as a result of the DELETE - // operation. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectOutput) GoString() string { - return s.String() -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *DeleteObjectOutput) SetDeleteMarker(v bool) *DeleteObjectOutput { - s.DeleteMarker = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *DeleteObjectOutput) SetRequestCharged(v string) *DeleteObjectOutput { - s.RequestCharged = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectOutput) SetVersionId(v string) *DeleteObjectOutput { - s.VersionId = &v - return s -} - -type DeleteObjectTaggingInput struct { - _ struct{} `locationName:"DeleteObjectTaggingRequest" type:"structure"` - - // The bucket name containing the objects from which to remove the tags. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Name of the tag. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // The versionId of the object that the tag-set will be removed from. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteObjectTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteObjectTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteObjectTaggingInput) SetBucket(v string) *DeleteObjectTaggingInput { - s.Bucket = &v - return s -} - -func (s *DeleteObjectTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *DeleteObjectTaggingInput) SetKey(v string) *DeleteObjectTaggingInput { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectTaggingInput) SetVersionId(v string) *DeleteObjectTaggingInput { - s.VersionId = &v - return s -} - -func (s *DeleteObjectTaggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteObjectTaggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteObjectTaggingOutput struct { - _ struct{} `type:"structure"` - - // The versionId of the object the tag-set was removed from. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectTaggingOutput) GoString() string { - return s.String() -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectTaggingOutput) SetVersionId(v string) *DeleteObjectTaggingOutput { - s.VersionId = &v - return s -} - -type DeleteObjectsInput struct { - _ struct{} `locationName:"DeleteObjectsRequest" type:"structure" payload:"Delete"` - - // The bucket name containing the objects to delete. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies whether you want to delete this object even if it has a Governance-type - // Object Lock in place. You must have sufficient permissions to perform this - // operation. - BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` - - // Container for the request. - // - // Delete is a required field - Delete *Delete `locationName:"Delete" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. Required to - // permanently delete a versioned object if versioning is configured with MFA - // delete enabled. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` -} - -// String returns the string representation -func (s DeleteObjectsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteObjectsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteObjectsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Delete == nil { - invalidParams.Add(request.NewErrParamRequired("Delete")) - } - if s.Delete != nil { - if err := s.Delete.Validate(); err != nil { - invalidParams.AddNested("Delete", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteObjectsInput) SetBucket(v string) *DeleteObjectsInput { - s.Bucket = &v - return s -} - -func (s *DeleteObjectsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBypassGovernanceRetention sets the BypassGovernanceRetention field's value. -func (s *DeleteObjectsInput) SetBypassGovernanceRetention(v bool) *DeleteObjectsInput { - s.BypassGovernanceRetention = &v - return s -} - -// SetDelete sets the Delete field's value. -func (s *DeleteObjectsInput) SetDelete(v *Delete) *DeleteObjectsInput { - s.Delete = v - return s -} - -// SetMFA sets the MFA field's value. -func (s *DeleteObjectsInput) SetMFA(v string) *DeleteObjectsInput { - s.MFA = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *DeleteObjectsInput) SetRequestPayer(v string) *DeleteObjectsInput { - s.RequestPayer = &v - return s -} - -func (s *DeleteObjectsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeleteObjectsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeleteObjectsOutput struct { - _ struct{} `type:"structure"` - - // Container element for a successful delete. It identifies the object that - // was successfully deleted. - Deleted []*DeletedObject `type:"list" flattened:"true"` - - // Container for a failed delete operation that describes the object that Amazon - // S3 attempted to delete and the error it encountered. - Errors []*Error `locationName:"Error" type:"list" flattened:"true"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s DeleteObjectsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectsOutput) GoString() string { - return s.String() -} - -// SetDeleted sets the Deleted field's value. -func (s *DeleteObjectsOutput) SetDeleted(v []*DeletedObject) *DeleteObjectsOutput { - s.Deleted = v - return s -} - -// SetErrors sets the Errors field's value. -func (s *DeleteObjectsOutput) SetErrors(v []*Error) *DeleteObjectsOutput { - s.Errors = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *DeleteObjectsOutput) SetRequestCharged(v string) *DeleteObjectsOutput { - s.RequestCharged = &v - return s -} - -type DeletePublicAccessBlockInput struct { - _ struct{} `locationName:"DeletePublicAccessBlockRequest" type:"structure"` - - // The Amazon S3 bucket whose PublicAccessBlock configuration you want to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeletePublicAccessBlockInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletePublicAccessBlockInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeletePublicAccessBlockInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeletePublicAccessBlockInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeletePublicAccessBlockInput) SetBucket(v string) *DeletePublicAccessBlockInput { - s.Bucket = &v - return s -} - -func (s *DeletePublicAccessBlockInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *DeletePublicAccessBlockInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *DeletePublicAccessBlockInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type DeletePublicAccessBlockOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeletePublicAccessBlockOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletePublicAccessBlockOutput) GoString() string { - return s.String() -} - -// Information about the deleted object. -type DeletedObject struct { - _ struct{} `type:"structure"` - - // Specifies whether the versioned object that was permanently deleted was (true) - // or was not (false) a delete marker. In a simple DELETE, this header indicates - // whether (true) or not (false) a delete marker was created. - DeleteMarker *bool `type:"boolean"` - - // The version ID of the delete marker created as a result of the DELETE operation. - // If you delete a specific object version, the value returned by this header - // is the version ID of the object version deleted. - DeleteMarkerVersionId *string `type:"string"` - - // The name of the deleted object. - Key *string `min:"1" type:"string"` - - // The version ID of the deleted object. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s DeletedObject) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletedObject) GoString() string { - return s.String() -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *DeletedObject) SetDeleteMarker(v bool) *DeletedObject { - s.DeleteMarker = &v - return s -} - -// SetDeleteMarkerVersionId sets the DeleteMarkerVersionId field's value. -func (s *DeletedObject) SetDeleteMarkerVersionId(v string) *DeletedObject { - s.DeleteMarkerVersionId = &v - return s -} - -// SetKey sets the Key field's value. -func (s *DeletedObject) SetKey(v string) *DeletedObject { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeletedObject) SetVersionId(v string) *DeletedObject { - s.VersionId = &v - return s -} - -// Specifies information about where to publish analysis or configuration results -// for an Amazon S3 bucket and S3 Replication Time Control (S3 RTC). -type Destination struct { - _ struct{} `type:"structure"` - - // Specify this only in a cross-account scenario (where source and destination - // bucket owners are not the same), and you want to change replica ownership - // to the AWS account that owns the destination bucket. If this is not specified - // in the replication configuration, the replicas are owned by same AWS account - // that owns the source object. - AccessControlTranslation *AccessControlTranslation `type:"structure"` - - // Destination bucket owner account ID. In a cross-account scenario, if you - // direct Amazon S3 to change replica ownership to the AWS account that owns - // the destination bucket by specifying the AccessControlTranslation property, - // this is the account ID of the destination bucket owner. For more information, - // see Replication Additional Configuration: Changing the Replica Owner (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html) - // in the Amazon Simple Storage Service Developer Guide. - Account *string `type:"string"` - - // The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to - // store the results. - // - // Bucket is a required field - Bucket *string `type:"string" required:"true"` - - // A container that provides information about encryption. If SourceSelectionCriteria - // is specified, you must specify this element. - EncryptionConfiguration *EncryptionConfiguration `type:"structure"` - - // A container specifying replication metrics-related settings enabling metrics - // and Amazon S3 events for S3 Replication Time Control (S3 RTC). Must be specified - // together with a ReplicationTime block. - Metrics *Metrics `type:"structure"` - - // A container specifying S3 Replication Time Control (S3 RTC), including whether - // S3 RTC is enabled and the time when all objects and operations on objects - // must be replicated. Must be specified together with a Metrics block. - ReplicationTime *ReplicationTime `type:"structure"` - - // The storage class to use when replicating objects, such as S3 Standard or - // reduced redundancy. By default, Amazon S3 uses the storage class of the source - // object to create the object replica. - // - // For valid values, see the StorageClass element of the PUT Bucket replication - // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) - // action in the Amazon Simple Storage Service API Reference. - StorageClass *string `type:"string" enum:"StorageClass"` -} - -// String returns the string representation -func (s Destination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Destination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Destination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Destination"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.AccessControlTranslation != nil { - if err := s.AccessControlTranslation.Validate(); err != nil { - invalidParams.AddNested("AccessControlTranslation", err.(request.ErrInvalidParams)) - } - } - if s.Metrics != nil { - if err := s.Metrics.Validate(); err != nil { - invalidParams.AddNested("Metrics", err.(request.ErrInvalidParams)) - } - } - if s.ReplicationTime != nil { - if err := s.ReplicationTime.Validate(); err != nil { - invalidParams.AddNested("ReplicationTime", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessControlTranslation sets the AccessControlTranslation field's value. -func (s *Destination) SetAccessControlTranslation(v *AccessControlTranslation) *Destination { - s.AccessControlTranslation = v - return s -} - -// SetAccount sets the Account field's value. -func (s *Destination) SetAccount(v string) *Destination { - s.Account = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *Destination) SetBucket(v string) *Destination { - s.Bucket = &v - return s -} - -func (s *Destination) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetEncryptionConfiguration sets the EncryptionConfiguration field's value. -func (s *Destination) SetEncryptionConfiguration(v *EncryptionConfiguration) *Destination { - s.EncryptionConfiguration = v - return s -} - -// SetMetrics sets the Metrics field's value. -func (s *Destination) SetMetrics(v *Metrics) *Destination { - s.Metrics = v - return s -} - -// SetReplicationTime sets the ReplicationTime field's value. -func (s *Destination) SetReplicationTime(v *ReplicationTime) *Destination { - s.ReplicationTime = v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Destination) SetStorageClass(v string) *Destination { - s.StorageClass = &v - return s -} - -// Contains the type of server-side encryption used. -type Encryption struct { - _ struct{} `type:"structure"` - - // The server-side encryption algorithm used when storing job results in Amazon - // S3 (for example, AES256, aws:kms). - // - // EncryptionType is a required field - EncryptionType *string `type:"string" required:"true" enum:"ServerSideEncryption"` - - // If the encryption type is aws:kms, this optional value can be used to specify - // the encryption context for the restore results. - KMSContext *string `type:"string"` - - // If the encryption type is aws:kms, this optional value specifies the ID of - // the symmetric customer managed AWS KMS CMK to use for encryption of job results. - // Amazon S3 only supports symmetric CMKs. For more information, see Using Symmetric - // and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) - // in the AWS Key Management Service Developer Guide. - KMSKeyId *string `type:"string" sensitive:"true"` -} - -// String returns the string representation -func (s Encryption) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Encryption) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Encryption) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Encryption"} - if s.EncryptionType == nil { - invalidParams.Add(request.NewErrParamRequired("EncryptionType")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionType sets the EncryptionType field's value. -func (s *Encryption) SetEncryptionType(v string) *Encryption { - s.EncryptionType = &v - return s -} - -// SetKMSContext sets the KMSContext field's value. -func (s *Encryption) SetKMSContext(v string) *Encryption { - s.KMSContext = &v - return s -} - -// SetKMSKeyId sets the KMSKeyId field's value. -func (s *Encryption) SetKMSKeyId(v string) *Encryption { - s.KMSKeyId = &v - return s -} - -// Specifies encryption-related information for an Amazon S3 bucket that is -// a destination for replicated objects. -type EncryptionConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies the ID (Key ARN or Alias ARN) of the customer managed customer - // master key (CMK) stored in AWS Key Management Service (KMS) for the destination - // bucket. Amazon S3 uses this key to encrypt replica objects. Amazon S3 only - // supports symmetric customer managed CMKs. For more information, see Using - // Symmetric and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) - // in the AWS Key Management Service Developer Guide. - ReplicaKmsKeyID *string `type:"string"` -} - -// String returns the string representation -func (s EncryptionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s EncryptionConfiguration) GoString() string { - return s.String() -} - -// SetReplicaKmsKeyID sets the ReplicaKmsKeyID field's value. -func (s *EncryptionConfiguration) SetReplicaKmsKeyID(v string) *EncryptionConfiguration { - s.ReplicaKmsKeyID = &v - return s -} - -// A message that indicates the request is complete and no more messages will -// be sent. You should not assume that the request is complete until the client -// receives an EndEvent. -type EndEvent struct { - _ struct{} `locationName:"EndEvent" type:"structure"` -} - -// String returns the string representation -func (s EndEvent) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s EndEvent) GoString() string { - return s.String() -} - -// The EndEvent is and event in the SelectObjectContentEventStream group of events. -func (s *EndEvent) eventSelectObjectContentEventStream() {} - -// UnmarshalEvent unmarshals the EventStream Message into the EndEvent value. -// This method is only used internally within the SDK's EventStream handling. -func (s *EndEvent) UnmarshalEvent( - payloadUnmarshaler protocol.PayloadUnmarshaler, - msg eventstream.Message, -) error { - return nil -} - -func (s *EndEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { - msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) - return msg, err -} - -// Container for all error elements. -type Error struct { - _ struct{} `type:"structure"` - - // The error code is a string that uniquely identifies an error condition. It - // is meant to be read and understood by programs that detect and handle errors - // by type. - // - // Amazon S3 error codes - // - // * Code: AccessDenied Description: Access Denied HTTP Status Code: 403 - // Forbidden SOAP Fault Code Prefix: Client - // - // * Code: AccountProblem Description: There is a problem with your AWS account - // that prevents the operation from completing successfully. Contact AWS - // Support for further assistance. HTTP Status Code: 403 Forbidden SOAP Fault - // Code Prefix: Client - // - // * Code: AllAccessDisabled Description: All access to this Amazon S3 resource - // has been disabled. Contact AWS Support for further assistance. HTTP Status - // Code: 403 Forbidden SOAP Fault Code Prefix: Client - // - // * Code: AmbiguousGrantByEmailAddress Description: The email address you - // provided is associated with more than one account. HTTP Status Code: 400 - // Bad Request SOAP Fault Code Prefix: Client - // - // * Code: AuthorizationHeaderMalformed Description: The authorization header - // you provided is invalid. HTTP Status Code: 400 Bad Request HTTP Status - // Code: N/A - // - // * Code: BadDigest Description: The Content-MD5 you specified did not match - // what we received. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: - // Client - // - // * Code: BucketAlreadyExists Description: The requested bucket name is - // not available. The bucket namespace is shared by all users of the system. - // Please select a different name and try again. HTTP Status Code: 409 Conflict - // SOAP Fault Code Prefix: Client - // - // * Code: BucketAlreadyOwnedByYou Description: The bucket you tried to create - // already exists, and you own it. Amazon S3 returns this error in all AWS - // Regions except in the North Virginia Region. For legacy compatibility, - // if you re-create an existing bucket that you already own in the North - // Virginia Region, Amazon S3 returns 200 OK and resets the bucket access - // control lists (ACLs). Code: 409 Conflict (in all Regions except the North - // Virginia Region) SOAP Fault Code Prefix: Client - // - // * Code: BucketNotEmpty Description: The bucket you tried to delete is - // not empty. HTTP Status Code: 409 Conflict SOAP Fault Code Prefix: Client - // - // * Code: CredentialsNotSupported Description: This request does not support - // credentials. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: - // Client - // - // * Code: CrossLocationLoggingProhibited Description: Cross-location logging - // not allowed. Buckets in one geographic location cannot log information - // to a bucket in another location. HTTP Status Code: 403 Forbidden SOAP - // Fault Code Prefix: Client - // - // * Code: EntityTooSmall Description: Your proposed upload is smaller than - // the minimum allowed object size. HTTP Status Code: 400 Bad Request SOAP - // Fault Code Prefix: Client - // - // * Code: EntityTooLarge Description: Your proposed upload exceeds the maximum - // allowed object size. HTTP Status Code: 400 Bad Request SOAP Fault Code - // Prefix: Client - // - // * Code: ExpiredToken Description: The provided token has expired. HTTP - // Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: IllegalVersioningConfigurationException Description: Indicates - // that the versioning configuration specified in the request is invalid. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: IncompleteBody Description: You did not provide the number of - // bytes specified by the Content-Length HTTP header HTTP Status Code: 400 - // Bad Request SOAP Fault Code Prefix: Client - // - // * Code: IncorrectNumberOfFilesInPostRequest Description: POST requires - // exactly one file upload per request. HTTP Status Code: 400 Bad Request - // SOAP Fault Code Prefix: Client - // - // * Code: InlineDataTooLarge Description: Inline data exceeds the maximum - // allowed size. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: - // Client - // - // * Code: InternalError Description: We encountered an internal error. Please - // try again. HTTP Status Code: 500 Internal Server Error SOAP Fault Code - // Prefix: Server - // - // * Code: InvalidAccessKeyId Description: The AWS access key ID you provided - // does not exist in our records. HTTP Status Code: 403 Forbidden SOAP Fault - // Code Prefix: Client - // - // * Code: InvalidAddressingHeader Description: You must specify the Anonymous - // role. HTTP Status Code: N/A SOAP Fault Code Prefix: Client - // - // * Code: InvalidArgument Description: Invalid Argument HTTP Status Code: - // 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidBucketName Description: The specified bucket is not valid. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidBucketState Description: The request is not valid with - // the current state of the bucket. HTTP Status Code: 409 Conflict SOAP Fault - // Code Prefix: Client - // - // * Code: InvalidDigest Description: The Content-MD5 you specified is not - // valid. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidEncryptionAlgorithmError Description: The encryption request - // you specified is not valid. The valid value is AES256. HTTP Status Code: - // 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidLocationConstraint Description: The specified location - // constraint is not valid. For more information about Regions, see How to - // Select a Region for Your Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro). - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidObjectState Description: The operation is not valid for - // the current state of the object. HTTP Status Code: 403 Forbidden SOAP - // Fault Code Prefix: Client - // - // * Code: InvalidPart Description: One or more of the specified parts could - // not be found. The part might not have been uploaded, or the specified - // entity tag might not have matched the part's entity tag. HTTP Status Code: - // 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidPartOrder Description: The list of parts was not in ascending - // order. Parts list must be specified in order by part number. HTTP Status - // Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidPayer Description: All access to this object has been disabled. - // Please contact AWS Support for further assistance. HTTP Status Code: 403 - // Forbidden SOAP Fault Code Prefix: Client - // - // * Code: InvalidPolicyDocument Description: The content of the form does - // not meet the conditions specified in the policy document. HTTP Status - // Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidRange Description: The requested range cannot be satisfied. - // HTTP Status Code: 416 Requested Range Not Satisfiable SOAP Fault Code - // Prefix: Client - // - // * Code: InvalidRequest Description: Please use AWS4-HMAC-SHA256. HTTP - // Status Code: 400 Bad Request Code: N/A - // - // * Code: InvalidRequest Description: SOAP requests must be made over an - // HTTPS connection. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: - // Client - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Acceleration is - // not supported for buckets with non-DNS compliant names. HTTP Status Code: - // 400 Bad Request Code: N/A - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Acceleration is - // not supported for buckets with periods (.) in their names. HTTP Status - // Code: 400 Bad Request Code: N/A - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Accelerate endpoint - // only supports virtual style requests. HTTP Status Code: 400 Bad Request - // Code: N/A - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Accelerate is not - // configured on this bucket. HTTP Status Code: 400 Bad Request Code: N/A - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Accelerate is disabled - // on this bucket. HTTP Status Code: 400 Bad Request Code: N/A - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Acceleration is - // not supported on this bucket. Contact AWS Support for more information. - // HTTP Status Code: 400 Bad Request Code: N/A - // - // * Code: InvalidRequest Description: Amazon S3 Transfer Acceleration cannot - // be enabled on this bucket. Contact AWS Support for more information. HTTP - // Status Code: 400 Bad Request Code: N/A - // - // * Code: InvalidSecurity Description: The provided security credentials - // are not valid. HTTP Status Code: 403 Forbidden SOAP Fault Code Prefix: - // Client - // - // * Code: InvalidSOAPRequest Description: The SOAP request body is invalid. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidStorageClass Description: The storage class you specified - // is not valid. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: - // Client - // - // * Code: InvalidTargetBucketForLogging Description: The target bucket for - // logging does not exist, is not owned by you, or does not have the appropriate - // grants for the log-delivery group. HTTP Status Code: 400 Bad Request SOAP - // Fault Code Prefix: Client - // - // * Code: InvalidToken Description: The provided token is malformed or otherwise - // invalid. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: InvalidURI Description: Couldn't parse the specified URI. HTTP - // Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: KeyTooLongError Description: Your key is too long. HTTP Status - // Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: MalformedACLError Description: The XML you provided was not well-formed - // or did not validate against our published schema. HTTP Status Code: 400 - // Bad Request SOAP Fault Code Prefix: Client - // - // * Code: MalformedPOSTRequest Description: The body of your POST request - // is not well-formed multipart/form-data. HTTP Status Code: 400 Bad Request - // SOAP Fault Code Prefix: Client - // - // * Code: MalformedXML Description: This happens when the user sends malformed - // XML (XML that doesn't conform to the published XSD) for the configuration. - // The error message is, "The XML you provided was not well-formed or did - // not validate against our published schema." HTTP Status Code: 400 Bad - // Request SOAP Fault Code Prefix: Client - // - // * Code: MaxMessageLengthExceeded Description: Your request was too big. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: MaxPostPreDataLengthExceededError Description: Your POST request - // fields preceding the upload file were too large. HTTP Status Code: 400 - // Bad Request SOAP Fault Code Prefix: Client - // - // * Code: MetadataTooLarge Description: Your metadata headers exceed the - // maximum allowed metadata size. HTTP Status Code: 400 Bad Request SOAP - // Fault Code Prefix: Client - // - // * Code: MethodNotAllowed Description: The specified method is not allowed - // against this resource. HTTP Status Code: 405 Method Not Allowed SOAP Fault - // Code Prefix: Client - // - // * Code: MissingAttachment Description: A SOAP attachment was expected, - // but none were found. HTTP Status Code: N/A SOAP Fault Code Prefix: Client - // - // * Code: MissingContentLength Description: You must provide the Content-Length - // HTTP header. HTTP Status Code: 411 Length Required SOAP Fault Code Prefix: - // Client - // - // * Code: MissingRequestBodyError Description: This happens when the user - // sends an empty XML document as a request. The error message is, "Request - // body is empty." HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: - // Client - // - // * Code: MissingSecurityElement Description: The SOAP 1.1 request is missing - // a security element. HTTP Status Code: 400 Bad Request SOAP Fault Code - // Prefix: Client - // - // * Code: MissingSecurityHeader Description: Your request is missing a required - // header. HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: NoLoggingStatusForKey Description: There is no such thing as a - // logging status subresource for a key. HTTP Status Code: 400 Bad Request - // SOAP Fault Code Prefix: Client - // - // * Code: NoSuchBucket Description: The specified bucket does not exist. - // HTTP Status Code: 404 Not Found SOAP Fault Code Prefix: Client - // - // * Code: NoSuchBucketPolicy Description: The specified bucket does not - // have a bucket policy. HTTP Status Code: 404 Not Found SOAP Fault Code - // Prefix: Client - // - // * Code: NoSuchKey Description: The specified key does not exist. HTTP - // Status Code: 404 Not Found SOAP Fault Code Prefix: Client - // - // * Code: NoSuchLifecycleConfiguration Description: The lifecycle configuration - // does not exist. HTTP Status Code: 404 Not Found SOAP Fault Code Prefix: - // Client - // - // * Code: NoSuchUpload Description: The specified multipart upload does - // not exist. The upload ID might be invalid, or the multipart upload might - // have been aborted or completed. HTTP Status Code: 404 Not Found SOAP Fault - // Code Prefix: Client - // - // * Code: NoSuchVersion Description: Indicates that the version ID specified - // in the request does not match an existing version. HTTP Status Code: 404 - // Not Found SOAP Fault Code Prefix: Client - // - // * Code: NotImplemented Description: A header you provided implies functionality - // that is not implemented. HTTP Status Code: 501 Not Implemented SOAP Fault - // Code Prefix: Server - // - // * Code: NotSignedUp Description: Your account is not signed up for the - // Amazon S3 service. You must sign up before you can use Amazon S3. You - // can sign up at the following URL: https://aws.amazon.com/s3 HTTP Status - // Code: 403 Forbidden SOAP Fault Code Prefix: Client - // - // * Code: OperationAborted Description: A conflicting conditional operation - // is currently in progress against this resource. Try again. HTTP Status - // Code: 409 Conflict SOAP Fault Code Prefix: Client - // - // * Code: PermanentRedirect Description: The bucket you are attempting to - // access must be addressed using the specified endpoint. Send all future - // requests to this endpoint. HTTP Status Code: 301 Moved Permanently SOAP - // Fault Code Prefix: Client - // - // * Code: PreconditionFailed Description: At least one of the preconditions - // you specified did not hold. HTTP Status Code: 412 Precondition Failed - // SOAP Fault Code Prefix: Client - // - // * Code: Redirect Description: Temporary redirect. HTTP Status Code: 307 - // Moved Temporarily SOAP Fault Code Prefix: Client - // - // * Code: RestoreAlreadyInProgress Description: Object restore is already - // in progress. HTTP Status Code: 409 Conflict SOAP Fault Code Prefix: Client - // - // * Code: RequestIsNotMultiPartContent Description: Bucket POST must be - // of the enclosure-type multipart/form-data. HTTP Status Code: 400 Bad Request - // SOAP Fault Code Prefix: Client - // - // * Code: RequestTimeout Description: Your socket connection to the server - // was not read from or written to within the timeout period. HTTP Status - // Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: RequestTimeTooSkewed Description: The difference between the request - // time and the server's time is too large. HTTP Status Code: 403 Forbidden - // SOAP Fault Code Prefix: Client - // - // * Code: RequestTorrentOfBucketError Description: Requesting the torrent - // file of a bucket is not permitted. HTTP Status Code: 400 Bad Request SOAP - // Fault Code Prefix: Client - // - // * Code: SignatureDoesNotMatch Description: The request signature we calculated - // does not match the signature you provided. Check your AWS secret access - // key and signing method. For more information, see REST Authentication - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) - // and SOAP Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/SOAPAuthentication.html) - // for details. HTTP Status Code: 403 Forbidden SOAP Fault Code Prefix: Client - // - // * Code: ServiceUnavailable Description: Reduce your request rate. HTTP - // Status Code: 503 Service Unavailable SOAP Fault Code Prefix: Server - // - // * Code: SlowDown Description: Reduce your request rate. HTTP Status Code: - // 503 Slow Down SOAP Fault Code Prefix: Server - // - // * Code: TemporaryRedirect Description: You are being redirected to the - // bucket while DNS updates. HTTP Status Code: 307 Moved Temporarily SOAP - // Fault Code Prefix: Client - // - // * Code: TokenRefreshRequired Description: The provided token must be refreshed. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: TooManyBuckets Description: You have attempted to create more - // buckets than allowed. HTTP Status Code: 400 Bad Request SOAP Fault Code - // Prefix: Client - // - // * Code: UnexpectedContent Description: This request does not support content. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - // - // * Code: UnresolvableGrantByEmailAddress Description: The email address - // you provided does not match any account on record. HTTP Status Code: 400 - // Bad Request SOAP Fault Code Prefix: Client - // - // * Code: UserKeyMustBeSpecified Description: The bucket POST must contain - // the specified field name. If it is specified, check the order of the fields. - // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client - Code *string `type:"string"` - - // The error key. - Key *string `min:"1" type:"string"` - - // The error message contains a generic description of the error condition in - // English. It is intended for a human audience. Simple programs display the - // message directly to the end user if they encounter an error condition they - // don't know how or don't care to handle. Sophisticated programs with more - // exhaustive error handling and proper internationalization are more likely - // to ignore the error message. - Message *string `type:"string"` - - // The version ID of the error. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s Error) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Error) GoString() string { - return s.String() -} - -// SetCode sets the Code field's value. -func (s *Error) SetCode(v string) *Error { - s.Code = &v - return s -} - -// SetKey sets the Key field's value. -func (s *Error) SetKey(v string) *Error { - s.Key = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *Error) SetMessage(v string) *Error { - s.Message = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *Error) SetVersionId(v string) *Error { - s.VersionId = &v - return s -} - -// The error information. -type ErrorDocument struct { - _ struct{} `type:"structure"` - - // The object key name to use when a 4XX class error occurs. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation -func (s ErrorDocument) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ErrorDocument) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ErrorDocument) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ErrorDocument"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *ErrorDocument) SetKey(v string) *ErrorDocument { - s.Key = &v - return s -} - -// Optional configuration to replicate existing source bucket objects. For more -// information, see Replicating Existing Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-what-is-isnot-replicated.html#existing-object-replication) -// in the Amazon S3 Developer Guide. -type ExistingObjectReplication struct { - _ struct{} `type:"structure"` - - // Status is a required field - Status *string `type:"string" required:"true" enum:"ExistingObjectReplicationStatus"` -} - -// String returns the string representation -func (s ExistingObjectReplication) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ExistingObjectReplication) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ExistingObjectReplication) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ExistingObjectReplication"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetStatus sets the Status field's value. -func (s *ExistingObjectReplication) SetStatus(v string) *ExistingObjectReplication { - s.Status = &v - return s -} - -// Specifies the Amazon S3 object key name to filter on and whether to filter -// on the suffix or prefix of the key name. -type FilterRule struct { - _ struct{} `type:"structure"` - - // The object key name prefix or suffix identifying one or more objects to which - // the filtering rule applies. The maximum length is 1,024 characters. Overlapping - // prefixes and suffixes are not supported. For more information, see Configuring - // Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - Name *string `type:"string" enum:"FilterRuleName"` - - // The value that the filter searches for in object key names. - Value *string `type:"string"` -} - -// String returns the string representation -func (s FilterRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s FilterRule) GoString() string { - return s.String() -} - -// SetName sets the Name field's value. -func (s *FilterRule) SetName(v string) *FilterRule { - s.Name = &v - return s -} - -// SetValue sets the Value field's value. -func (s *FilterRule) SetValue(v string) *FilterRule { - s.Value = &v - return s -} - -type GetBucketAccelerateConfigurationInput struct { - _ struct{} `locationName:"GetBucketAccelerateConfigurationRequest" type:"structure"` - - // Name of the bucket for which the accelerate configuration is retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketAccelerateConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAccelerateConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketAccelerateConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketAccelerateConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketAccelerateConfigurationInput) SetBucket(v string) *GetBucketAccelerateConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketAccelerateConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketAccelerateConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketAccelerateConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketAccelerateConfigurationOutput struct { - _ struct{} `type:"structure"` - - // The accelerate configuration of the bucket. - Status *string `type:"string" enum:"BucketAccelerateStatus"` -} - -// String returns the string representation -func (s GetBucketAccelerateConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAccelerateConfigurationOutput) GoString() string { - return s.String() -} - -// SetStatus sets the Status field's value. -func (s *GetBucketAccelerateConfigurationOutput) SetStatus(v string) *GetBucketAccelerateConfigurationOutput { - s.Status = &v - return s -} - -type GetBucketAclInput struct { - _ struct{} `locationName:"GetBucketAclRequest" type:"structure"` - - // Specifies the S3 bucket whose ACL is being requested. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketAclInput) SetBucket(v string) *GetBucketAclInput { - s.Bucket = &v - return s -} - -func (s *GetBucketAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketAclInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketAclInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketAclOutput struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - // Container for the bucket owner's display name and ID. - Owner *Owner `type:"structure"` -} - -// String returns the string representation -func (s GetBucketAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAclOutput) GoString() string { - return s.String() -} - -// SetGrants sets the Grants field's value. -func (s *GetBucketAclOutput) SetGrants(v []*Grant) *GetBucketAclOutput { - s.Grants = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *GetBucketAclOutput) SetOwner(v *Owner) *GetBucketAclOutput { - s.Owner = v - return s -} - -type GetBucketAnalyticsConfigurationInput struct { - _ struct{} `locationName:"GetBucketAnalyticsConfigurationRequest" type:"structure"` - - // The name of the bucket from which an analytics configuration is retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID that identifies the analytics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketAnalyticsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAnalyticsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketAnalyticsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketAnalyticsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketAnalyticsConfigurationInput) SetBucket(v string) *GetBucketAnalyticsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketAnalyticsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *GetBucketAnalyticsConfigurationInput) SetId(v string) *GetBucketAnalyticsConfigurationInput { - s.Id = &v - return s -} - -func (s *GetBucketAnalyticsConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketAnalyticsConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketAnalyticsConfigurationOutput struct { - _ struct{} `type:"structure" payload:"AnalyticsConfiguration"` - - // The configuration and any analyses for the analytics filter. - AnalyticsConfiguration *AnalyticsConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketAnalyticsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAnalyticsConfigurationOutput) GoString() string { - return s.String() -} - -// SetAnalyticsConfiguration sets the AnalyticsConfiguration field's value. -func (s *GetBucketAnalyticsConfigurationOutput) SetAnalyticsConfiguration(v *AnalyticsConfiguration) *GetBucketAnalyticsConfigurationOutput { - s.AnalyticsConfiguration = v - return s -} - -type GetBucketCorsInput struct { - _ struct{} `locationName:"GetBucketCorsRequest" type:"structure"` - - // The bucket name for which to get the cors configuration. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketCorsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketCorsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketCorsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketCorsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketCorsInput) SetBucket(v string) *GetBucketCorsInput { - s.Bucket = &v - return s -} - -func (s *GetBucketCorsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketCorsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketCorsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketCorsOutput struct { - _ struct{} `type:"structure"` - - // A set of origins and methods (cross-origin access that you want to allow). - // You can add up to 100 rules to the configuration. - CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s GetBucketCorsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketCorsOutput) GoString() string { - return s.String() -} - -// SetCORSRules sets the CORSRules field's value. -func (s *GetBucketCorsOutput) SetCORSRules(v []*CORSRule) *GetBucketCorsOutput { - s.CORSRules = v - return s -} - -type GetBucketEncryptionInput struct { - _ struct{} `locationName:"GetBucketEncryptionRequest" type:"structure"` - - // The name of the bucket from which the server-side encryption configuration - // is retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketEncryptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketEncryptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketEncryptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketEncryptionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketEncryptionInput) SetBucket(v string) *GetBucketEncryptionInput { - s.Bucket = &v - return s -} - -func (s *GetBucketEncryptionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketEncryptionInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketEncryptionInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketEncryptionOutput struct { - _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - - // Specifies the default server-side-encryption configuration. - ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketEncryptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketEncryptionOutput) GoString() string { - return s.String() -} - -// SetServerSideEncryptionConfiguration sets the ServerSideEncryptionConfiguration field's value. -func (s *GetBucketEncryptionOutput) SetServerSideEncryptionConfiguration(v *ServerSideEncryptionConfiguration) *GetBucketEncryptionOutput { - s.ServerSideEncryptionConfiguration = v - return s -} - -type GetBucketInventoryConfigurationInput struct { - _ struct{} `locationName:"GetBucketInventoryConfigurationRequest" type:"structure"` - - // The name of the bucket containing the inventory configuration to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketInventoryConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketInventoryConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketInventoryConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketInventoryConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketInventoryConfigurationInput) SetBucket(v string) *GetBucketInventoryConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketInventoryConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *GetBucketInventoryConfigurationInput) SetId(v string) *GetBucketInventoryConfigurationInput { - s.Id = &v - return s -} - -func (s *GetBucketInventoryConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketInventoryConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketInventoryConfigurationOutput struct { - _ struct{} `type:"structure" payload:"InventoryConfiguration"` - - // Specifies the inventory configuration. - InventoryConfiguration *InventoryConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketInventoryConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketInventoryConfigurationOutput) GoString() string { - return s.String() -} - -// SetInventoryConfiguration sets the InventoryConfiguration field's value. -func (s *GetBucketInventoryConfigurationOutput) SetInventoryConfiguration(v *InventoryConfiguration) *GetBucketInventoryConfigurationOutput { - s.InventoryConfiguration = v - return s -} - -type GetBucketLifecycleConfigurationInput struct { - _ struct{} `locationName:"GetBucketLifecycleConfigurationRequest" type:"structure"` - - // The name of the bucket for which to get the lifecycle information. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLifecycleConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLifecycleConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLifecycleConfigurationInput) SetBucket(v string) *GetBucketLifecycleConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLifecycleConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketLifecycleConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketLifecycleConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketLifecycleConfigurationOutput struct { - _ struct{} `type:"structure"` - - // Container for a lifecycle rule. - Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleConfigurationOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *GetBucketLifecycleConfigurationOutput) SetRules(v []*LifecycleRule) *GetBucketLifecycleConfigurationOutput { - s.Rules = v - return s -} - -type GetBucketLifecycleInput struct { - _ struct{} `locationName:"GetBucketLifecycleRequest" type:"structure"` - - // The name of the bucket for which to get the lifecycle information. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLifecycleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLifecycleInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLifecycleInput) SetBucket(v string) *GetBucketLifecycleInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLifecycleInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketLifecycleInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketLifecycleInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketLifecycleOutput struct { - _ struct{} `type:"structure"` - - // Container for a lifecycle rule. - Rules []*Rule `locationName:"Rule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *GetBucketLifecycleOutput) SetRules(v []*Rule) *GetBucketLifecycleOutput { - s.Rules = v - return s -} - -type GetBucketLocationInput struct { - _ struct{} `locationName:"GetBucketLocationRequest" type:"structure"` - - // The name of the bucket for which to get the location. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLocationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLocationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLocationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLocationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLocationInput) SetBucket(v string) *GetBucketLocationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLocationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketLocationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketLocationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketLocationOutput struct { - _ struct{} `type:"structure"` - - // Specifies the Region where the bucket resides. For a list of all the Amazon - // S3 supported location constraints by Region, see Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region). - // Buckets in Region us-east-1 have a LocationConstraint of null. - LocationConstraint *string `type:"string" enum:"BucketLocationConstraint"` -} - -// String returns the string representation -func (s GetBucketLocationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLocationOutput) GoString() string { - return s.String() -} - -// SetLocationConstraint sets the LocationConstraint field's value. -func (s *GetBucketLocationOutput) SetLocationConstraint(v string) *GetBucketLocationOutput { - s.LocationConstraint = &v - return s -} - -type GetBucketLoggingInput struct { - _ struct{} `locationName:"GetBucketLoggingRequest" type:"structure"` - - // The bucket name for which to get the logging information. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLoggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLoggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLoggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLoggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLoggingInput) SetBucket(v string) *GetBucketLoggingInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLoggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketLoggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketLoggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketLoggingOutput struct { - _ struct{} `type:"structure"` - - // Describes where logs are stored and the prefix that Amazon S3 assigns to - // all log object keys for a bucket. For more information, see PUT Bucket logging - // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) - // in the Amazon Simple Storage Service API Reference. - LoggingEnabled *LoggingEnabled `type:"structure"` -} - -// String returns the string representation -func (s GetBucketLoggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLoggingOutput) GoString() string { - return s.String() -} - -// SetLoggingEnabled sets the LoggingEnabled field's value. -func (s *GetBucketLoggingOutput) SetLoggingEnabled(v *LoggingEnabled) *GetBucketLoggingOutput { - s.LoggingEnabled = v - return s -} - -type GetBucketMetricsConfigurationInput struct { - _ struct{} `locationName:"GetBucketMetricsConfigurationRequest" type:"structure"` - - // The name of the bucket containing the metrics configuration to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketMetricsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketMetricsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketMetricsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketMetricsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketMetricsConfigurationInput) SetBucket(v string) *GetBucketMetricsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketMetricsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *GetBucketMetricsConfigurationInput) SetId(v string) *GetBucketMetricsConfigurationInput { - s.Id = &v - return s -} - -func (s *GetBucketMetricsConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketMetricsConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketMetricsConfigurationOutput struct { - _ struct{} `type:"structure" payload:"MetricsConfiguration"` - - // Specifies the metrics configuration. - MetricsConfiguration *MetricsConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketMetricsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketMetricsConfigurationOutput) GoString() string { - return s.String() -} - -// SetMetricsConfiguration sets the MetricsConfiguration field's value. -func (s *GetBucketMetricsConfigurationOutput) SetMetricsConfiguration(v *MetricsConfiguration) *GetBucketMetricsConfigurationOutput { - s.MetricsConfiguration = v - return s -} - -type GetBucketNotificationConfigurationRequest struct { - _ struct{} `locationName:"GetBucketNotificationConfigurationRequest" type:"structure"` - - // Name of the bucket for which to get the notification configuration. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketNotificationConfigurationRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketNotificationConfigurationRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketNotificationConfigurationRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketNotificationConfigurationRequest"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketNotificationConfigurationRequest) SetBucket(v string) *GetBucketNotificationConfigurationRequest { - s.Bucket = &v - return s -} - -func (s *GetBucketNotificationConfigurationRequest) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketNotificationConfigurationRequest) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketNotificationConfigurationRequest) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketPolicyInput struct { - _ struct{} `locationName:"GetBucketPolicyRequest" type:"structure"` - - // The bucket name for which to get the bucket policy. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketPolicyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketPolicyInput) SetBucket(v string) *GetBucketPolicyInput { - s.Bucket = &v - return s -} - -func (s *GetBucketPolicyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketPolicyInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketPolicyInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketPolicyOutput struct { - _ struct{} `type:"structure" payload:"Policy"` - - // The bucket policy as a JSON document. - Policy *string `type:"string"` -} - -// String returns the string representation -func (s GetBucketPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketPolicyOutput) GoString() string { - return s.String() -} - -// SetPolicy sets the Policy field's value. -func (s *GetBucketPolicyOutput) SetPolicy(v string) *GetBucketPolicyOutput { - s.Policy = &v - return s -} - -type GetBucketPolicyStatusInput struct { - _ struct{} `locationName:"GetBucketPolicyStatusRequest" type:"structure"` - - // The name of the Amazon S3 bucket whose policy status you want to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketPolicyStatusInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketPolicyStatusInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketPolicyStatusInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketPolicyStatusInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketPolicyStatusInput) SetBucket(v string) *GetBucketPolicyStatusInput { - s.Bucket = &v - return s -} - -func (s *GetBucketPolicyStatusInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketPolicyStatusInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketPolicyStatusInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketPolicyStatusOutput struct { - _ struct{} `type:"structure" payload:"PolicyStatus"` - - // The policy status for the specified bucket. - PolicyStatus *PolicyStatus `type:"structure"` -} - -// String returns the string representation -func (s GetBucketPolicyStatusOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketPolicyStatusOutput) GoString() string { - return s.String() -} - -// SetPolicyStatus sets the PolicyStatus field's value. -func (s *GetBucketPolicyStatusOutput) SetPolicyStatus(v *PolicyStatus) *GetBucketPolicyStatusOutput { - s.PolicyStatus = v - return s -} - -type GetBucketReplicationInput struct { - _ struct{} `locationName:"GetBucketReplicationRequest" type:"structure"` - - // The bucket name for which to get the replication information. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketReplicationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketReplicationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketReplicationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketReplicationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketReplicationInput) SetBucket(v string) *GetBucketReplicationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketReplicationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketReplicationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketReplicationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketReplicationOutput struct { - _ struct{} `type:"structure" payload:"ReplicationConfiguration"` - - // A container for replication rules. You can add up to 1,000 rules. The maximum - // size of a replication configuration is 2 MB. - ReplicationConfiguration *ReplicationConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketReplicationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketReplicationOutput) GoString() string { - return s.String() -} - -// SetReplicationConfiguration sets the ReplicationConfiguration field's value. -func (s *GetBucketReplicationOutput) SetReplicationConfiguration(v *ReplicationConfiguration) *GetBucketReplicationOutput { - s.ReplicationConfiguration = v - return s -} - -type GetBucketRequestPaymentInput struct { - _ struct{} `locationName:"GetBucketRequestPaymentRequest" type:"structure"` - - // The name of the bucket for which to get the payment request configuration - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketRequestPaymentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketRequestPaymentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketRequestPaymentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketRequestPaymentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketRequestPaymentInput) SetBucket(v string) *GetBucketRequestPaymentInput { - s.Bucket = &v - return s -} - -func (s *GetBucketRequestPaymentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketRequestPaymentInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketRequestPaymentInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketRequestPaymentOutput struct { - _ struct{} `type:"structure"` - - // Specifies who pays for the download and request fees. - Payer *string `type:"string" enum:"Payer"` -} - -// String returns the string representation -func (s GetBucketRequestPaymentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketRequestPaymentOutput) GoString() string { - return s.String() -} - -// SetPayer sets the Payer field's value. -func (s *GetBucketRequestPaymentOutput) SetPayer(v string) *GetBucketRequestPaymentOutput { - s.Payer = &v - return s -} - -type GetBucketTaggingInput struct { - _ struct{} `locationName:"GetBucketTaggingRequest" type:"structure"` - - // The name of the bucket for which to get the tagging information. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketTaggingInput) SetBucket(v string) *GetBucketTaggingInput { - s.Bucket = &v - return s -} - -func (s *GetBucketTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketTaggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketTaggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketTaggingOutput struct { - _ struct{} `type:"structure"` - - // Contains the tag set. - // - // TagSet is a required field - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` -} - -// String returns the string representation -func (s GetBucketTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketTaggingOutput) GoString() string { - return s.String() -} - -// SetTagSet sets the TagSet field's value. -func (s *GetBucketTaggingOutput) SetTagSet(v []*Tag) *GetBucketTaggingOutput { - s.TagSet = v - return s -} - -type GetBucketVersioningInput struct { - _ struct{} `locationName:"GetBucketVersioningRequest" type:"structure"` - - // The name of the bucket for which to get the versioning information. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketVersioningInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketVersioningInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketVersioningInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketVersioningInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketVersioningInput) SetBucket(v string) *GetBucketVersioningInput { - s.Bucket = &v - return s -} - -func (s *GetBucketVersioningInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketVersioningInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketVersioningInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketVersioningOutput struct { - _ struct{} `type:"structure"` - - // Specifies whether MFA delete is enabled in the bucket versioning configuration. - // This element is only returned if the bucket has been configured with MFA - // delete. If the bucket has never been so configured, this element is not returned. - MFADelete *string `locationName:"MfaDelete" type:"string" enum:"MFADeleteStatus"` - - // The versioning state of the bucket. - Status *string `type:"string" enum:"BucketVersioningStatus"` -} - -// String returns the string representation -func (s GetBucketVersioningOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketVersioningOutput) GoString() string { - return s.String() -} - -// SetMFADelete sets the MFADelete field's value. -func (s *GetBucketVersioningOutput) SetMFADelete(v string) *GetBucketVersioningOutput { - s.MFADelete = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *GetBucketVersioningOutput) SetStatus(v string) *GetBucketVersioningOutput { - s.Status = &v - return s -} - -type GetBucketWebsiteInput struct { - _ struct{} `locationName:"GetBucketWebsiteRequest" type:"structure"` - - // The bucket name for which to get the website configuration. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketWebsiteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketWebsiteInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketWebsiteInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketWebsiteInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketWebsiteInput) SetBucket(v string) *GetBucketWebsiteInput { - s.Bucket = &v - return s -} - -func (s *GetBucketWebsiteInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetBucketWebsiteInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetBucketWebsiteInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetBucketWebsiteOutput struct { - _ struct{} `type:"structure"` - - // The object key name of the website error document to use for 4XX class errors. - ErrorDocument *ErrorDocument `type:"structure"` - - // The name of the index document for the website (for example index.html). - IndexDocument *IndexDocument `type:"structure"` - - // Specifies the redirect behavior of all requests to a website endpoint of - // an Amazon S3 bucket. - RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - - // Rules that define when a redirect is applied and the redirect behavior. - RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` -} - -// String returns the string representation -func (s GetBucketWebsiteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketWebsiteOutput) GoString() string { - return s.String() -} - -// SetErrorDocument sets the ErrorDocument field's value. -func (s *GetBucketWebsiteOutput) SetErrorDocument(v *ErrorDocument) *GetBucketWebsiteOutput { - s.ErrorDocument = v - return s -} - -// SetIndexDocument sets the IndexDocument field's value. -func (s *GetBucketWebsiteOutput) SetIndexDocument(v *IndexDocument) *GetBucketWebsiteOutput { - s.IndexDocument = v - return s -} - -// SetRedirectAllRequestsTo sets the RedirectAllRequestsTo field's value. -func (s *GetBucketWebsiteOutput) SetRedirectAllRequestsTo(v *RedirectAllRequestsTo) *GetBucketWebsiteOutput { - s.RedirectAllRequestsTo = v - return s -} - -// SetRoutingRules sets the RoutingRules field's value. -func (s *GetBucketWebsiteOutput) SetRoutingRules(v []*RoutingRule) *GetBucketWebsiteOutput { - s.RoutingRules = v - return s -} - -type GetObjectAclInput struct { - _ struct{} `locationName:"GetObjectAclRequest" type:"structure"` - - // The bucket name that contains the object for which to get the ACL information. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The key of the object for which to get the ACL information. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectAclInput) SetBucket(v string) *GetObjectAclInput { - s.Bucket = &v - return s -} - -func (s *GetObjectAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectAclInput) SetKey(v string) *GetObjectAclInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectAclInput) SetRequestPayer(v string) *GetObjectAclInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectAclInput) SetVersionId(v string) *GetObjectAclInput { - s.VersionId = &v - return s -} - -func (s *GetObjectAclInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectAclInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectAclOutput struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - // Container for the bucket owner's display name and ID. - Owner *Owner `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s GetObjectAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectAclOutput) GoString() string { - return s.String() -} - -// SetGrants sets the Grants field's value. -func (s *GetObjectAclOutput) SetGrants(v []*Grant) *GetObjectAclOutput { - s.Grants = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *GetObjectAclOutput) SetOwner(v *Owner) *GetObjectAclOutput { - s.Owner = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *GetObjectAclOutput) SetRequestCharged(v string) *GetObjectAclOutput { - s.RequestCharged = &v - return s -} - -type GetObjectInput struct { - _ struct{} `locationName:"GetObjectRequest" type:"structure"` - - // The bucket name containing the object. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Return the object only if its entity tag (ETag) is the same as the one specified, - // otherwise return a 412 (precondition failed). - IfMatch *string `location:"header" locationName:"If-Match" type:"string"` - - // Return the object only if it has been modified since the specified time, - // otherwise return a 304 (not modified). - IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp"` - - // Return the object only if its entity tag (ETag) is different from the one - // specified, otherwise return a 304 (not modified). - IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` - - // Return the object only if it has not been modified since the specified time, - // otherwise return a 412 (precondition failed). - IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp"` - - // Key of the object to get. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of the object being read. This is a positive integer between - // 1 and 10,000. Effectively performs a 'ranged' GET request for the part specified. - // Useful for downloading just a part of an object. - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer"` - - // Downloads the specified range bytes of an object. For more information about - // the HTTP Range header, see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 - // (https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35). - // - // Amazon S3 doesn't support retrieving multiple ranges of data per GET request. - Range *string `location:"header" locationName:"Range" type:"string"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Sets the Cache-Control header of the response. - ResponseCacheControl *string `location:"querystring" locationName:"response-cache-control" type:"string"` - - // Sets the Content-Disposition header of the response - ResponseContentDisposition *string `location:"querystring" locationName:"response-content-disposition" type:"string"` - - // Sets the Content-Encoding header of the response. - ResponseContentEncoding *string `location:"querystring" locationName:"response-content-encoding" type:"string"` - - // Sets the Content-Language header of the response. - ResponseContentLanguage *string `location:"querystring" locationName:"response-content-language" type:"string"` - - // Sets the Content-Type header of the response. - ResponseContentType *string `location:"querystring" locationName:"response-content-type" type:"string"` - - // Sets the Expires header of the response. - ResponseExpires *time.Time `location:"querystring" locationName:"response-expires" type:"timestamp"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectInput) SetBucket(v string) *GetObjectInput { - s.Bucket = &v - return s -} - -func (s *GetObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetIfMatch sets the IfMatch field's value. -func (s *GetObjectInput) SetIfMatch(v string) *GetObjectInput { - s.IfMatch = &v - return s -} - -// SetIfModifiedSince sets the IfModifiedSince field's value. -func (s *GetObjectInput) SetIfModifiedSince(v time.Time) *GetObjectInput { - s.IfModifiedSince = &v - return s -} - -// SetIfNoneMatch sets the IfNoneMatch field's value. -func (s *GetObjectInput) SetIfNoneMatch(v string) *GetObjectInput { - s.IfNoneMatch = &v - return s -} - -// SetIfUnmodifiedSince sets the IfUnmodifiedSince field's value. -func (s *GetObjectInput) SetIfUnmodifiedSince(v time.Time) *GetObjectInput { - s.IfUnmodifiedSince = &v - return s -} - -// SetKey sets the Key field's value. -func (s *GetObjectInput) SetKey(v string) *GetObjectInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *GetObjectInput) SetPartNumber(v int64) *GetObjectInput { - s.PartNumber = &v - return s -} - -// SetRange sets the Range field's value. -func (s *GetObjectInput) SetRange(v string) *GetObjectInput { - s.Range = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectInput) SetRequestPayer(v string) *GetObjectInput { - s.RequestPayer = &v - return s -} - -// SetResponseCacheControl sets the ResponseCacheControl field's value. -func (s *GetObjectInput) SetResponseCacheControl(v string) *GetObjectInput { - s.ResponseCacheControl = &v - return s -} - -// SetResponseContentDisposition sets the ResponseContentDisposition field's value. -func (s *GetObjectInput) SetResponseContentDisposition(v string) *GetObjectInput { - s.ResponseContentDisposition = &v - return s -} - -// SetResponseContentEncoding sets the ResponseContentEncoding field's value. -func (s *GetObjectInput) SetResponseContentEncoding(v string) *GetObjectInput { - s.ResponseContentEncoding = &v - return s -} - -// SetResponseContentLanguage sets the ResponseContentLanguage field's value. -func (s *GetObjectInput) SetResponseContentLanguage(v string) *GetObjectInput { - s.ResponseContentLanguage = &v - return s -} - -// SetResponseContentType sets the ResponseContentType field's value. -func (s *GetObjectInput) SetResponseContentType(v string) *GetObjectInput { - s.ResponseContentType = &v - return s -} - -// SetResponseExpires sets the ResponseExpires field's value. -func (s *GetObjectInput) SetResponseExpires(v time.Time) *GetObjectInput { - s.ResponseExpires = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *GetObjectInput) SetSSECustomerAlgorithm(v string) *GetObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *GetObjectInput) SetSSECustomerKey(v string) *GetObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *GetObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *GetObjectInput) SetSSECustomerKeyMD5(v string) *GetObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectInput) SetVersionId(v string) *GetObjectInput { - s.VersionId = &v - return s -} - -func (s *GetObjectInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectLegalHoldInput struct { - _ struct{} `locationName:"GetObjectLegalHoldRequest" type:"structure"` - - // The bucket name containing the object whose Legal Hold status you want to - // retrieve. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The key name for the object whose Legal Hold status you want to retrieve. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // The version ID of the object whose Legal Hold status you want to retrieve. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectLegalHoldInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectLegalHoldInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectLegalHoldInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectLegalHoldInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectLegalHoldInput) SetBucket(v string) *GetObjectLegalHoldInput { - s.Bucket = &v - return s -} - -func (s *GetObjectLegalHoldInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectLegalHoldInput) SetKey(v string) *GetObjectLegalHoldInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectLegalHoldInput) SetRequestPayer(v string) *GetObjectLegalHoldInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectLegalHoldInput) SetVersionId(v string) *GetObjectLegalHoldInput { - s.VersionId = &v - return s -} - -func (s *GetObjectLegalHoldInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectLegalHoldInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectLegalHoldOutput struct { - _ struct{} `type:"structure" payload:"LegalHold"` - - // The current Legal Hold status for the specified object. - LegalHold *ObjectLockLegalHold `type:"structure"` -} - -// String returns the string representation -func (s GetObjectLegalHoldOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectLegalHoldOutput) GoString() string { - return s.String() -} - -// SetLegalHold sets the LegalHold field's value. -func (s *GetObjectLegalHoldOutput) SetLegalHold(v *ObjectLockLegalHold) *GetObjectLegalHoldOutput { - s.LegalHold = v - return s -} - -type GetObjectLockConfigurationInput struct { - _ struct{} `locationName:"GetObjectLockConfigurationRequest" type:"structure"` - - // The bucket whose Object Lock configuration you want to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetObjectLockConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectLockConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectLockConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectLockConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectLockConfigurationInput) SetBucket(v string) *GetObjectLockConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetObjectLockConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetObjectLockConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectLockConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectLockConfigurationOutput struct { - _ struct{} `type:"structure" payload:"ObjectLockConfiguration"` - - // The specified bucket's Object Lock configuration. - ObjectLockConfiguration *ObjectLockConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetObjectLockConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectLockConfigurationOutput) GoString() string { - return s.String() -} - -// SetObjectLockConfiguration sets the ObjectLockConfiguration field's value. -func (s *GetObjectLockConfigurationOutput) SetObjectLockConfiguration(v *ObjectLockConfiguration) *GetObjectLockConfigurationOutput { - s.ObjectLockConfiguration = v - return s -} - -type GetObjectOutput struct { - _ struct{} `type:"structure" payload:"Body"` - - // Indicates that a range of bytes was specified. - AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` - - // Object data. - Body io.ReadCloser `type:"blob"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // The portion of the object returned in the response. - ContentRange *string `location:"header" locationName:"Content-Range" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // Specifies whether the object retrieved was (true) or was not (false) a Delete - // Marker. If false, this response header does not appear in the response. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // An ETag is an opaque identifier assigned by a web server to a specific version - // of a resource found at a URL. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured (see PUT Bucket lifecycle), the response - // includes this header. It includes the expiry-date and rule-id key-value pairs - // providing object expiration information. The value of the rule-id is URL - // encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *string `location:"header" locationName:"Expires" type:"string"` - - // Last modified date of the object - LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp"` - - // A map of metadata to store with the object in S3. - // - // By default unmarshaled keys are written as a map keys in following canonicalized format: - // the first letter and any letter following a hyphen will be capitalized, and the rest as lowercase. - // Set `aws.Config.LowerCaseHeaderMaps` to `true` to write unmarshaled keys to the map as lowercase. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // This is set to the number of metadata entries not returned in x-amz-meta - // headers. This can happen if you create metadata using an API like SOAP that - // supports more flexible metadata than the REST API. For example, using SOAP, - // you can create metadata whose values are not legal HTTP headers. - MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` - - // Indicates whether this object has an active legal hold. This field is only - // returned if you have permission to view an object's legal hold status. - ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - - // The Object Lock mode currently in place for this object. - ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - - // The date and time when this object's Object Lock will expire. - ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` - - // The count of parts this object has. - PartsCount *int64 `location:"header" locationName:"x-amz-mp-parts-count" type:"integer"` - - // Amazon S3 can return this if your request involves a bucket that is either - // a source or destination in a replication rule. - ReplicationStatus *string `location:"header" locationName:"x-amz-replication-status" type:"string" enum:"ReplicationStatus"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Provides information about object restoration operation and expiration time - // of the restored object copy. - Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Provides storage class information of the object. Amazon S3 returns this - // header for all objects except for S3 Standard storage class objects. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The number of tags, if any, on the object. - TagCount *int64 `location:"header" locationName:"x-amz-tagging-count" type:"integer"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s GetObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectOutput) GoString() string { - return s.String() -} - -// SetAcceptRanges sets the AcceptRanges field's value. -func (s *GetObjectOutput) SetAcceptRanges(v string) *GetObjectOutput { - s.AcceptRanges = &v - return s -} - -// SetBody sets the Body field's value. -func (s *GetObjectOutput) SetBody(v io.ReadCloser) *GetObjectOutput { - s.Body = v - return s -} - -// SetCacheControl sets the CacheControl field's value. -func (s *GetObjectOutput) SetCacheControl(v string) *GetObjectOutput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *GetObjectOutput) SetContentDisposition(v string) *GetObjectOutput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *GetObjectOutput) SetContentEncoding(v string) *GetObjectOutput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *GetObjectOutput) SetContentLanguage(v string) *GetObjectOutput { - s.ContentLanguage = &v - return s -} - -// SetContentLength sets the ContentLength field's value. -func (s *GetObjectOutput) SetContentLength(v int64) *GetObjectOutput { - s.ContentLength = &v - return s -} - -// SetContentRange sets the ContentRange field's value. -func (s *GetObjectOutput) SetContentRange(v string) *GetObjectOutput { - s.ContentRange = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *GetObjectOutput) SetContentType(v string) *GetObjectOutput { - s.ContentType = &v - return s -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *GetObjectOutput) SetDeleteMarker(v bool) *GetObjectOutput { - s.DeleteMarker = &v - return s -} - -// SetETag sets the ETag field's value. -func (s *GetObjectOutput) SetETag(v string) *GetObjectOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *GetObjectOutput) SetExpiration(v string) *GetObjectOutput { - s.Expiration = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *GetObjectOutput) SetExpires(v string) *GetObjectOutput { - s.Expires = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *GetObjectOutput) SetLastModified(v time.Time) *GetObjectOutput { - s.LastModified = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *GetObjectOutput) SetMetadata(v map[string]*string) *GetObjectOutput { - s.Metadata = v - return s -} - -// SetMissingMeta sets the MissingMeta field's value. -func (s *GetObjectOutput) SetMissingMeta(v int64) *GetObjectOutput { - s.MissingMeta = &v - return s -} - -// SetObjectLockLegalHoldStatus sets the ObjectLockLegalHoldStatus field's value. -func (s *GetObjectOutput) SetObjectLockLegalHoldStatus(v string) *GetObjectOutput { - s.ObjectLockLegalHoldStatus = &v - return s -} - -// SetObjectLockMode sets the ObjectLockMode field's value. -func (s *GetObjectOutput) SetObjectLockMode(v string) *GetObjectOutput { - s.ObjectLockMode = &v - return s -} - -// SetObjectLockRetainUntilDate sets the ObjectLockRetainUntilDate field's value. -func (s *GetObjectOutput) SetObjectLockRetainUntilDate(v time.Time) *GetObjectOutput { - s.ObjectLockRetainUntilDate = &v - return s -} - -// SetPartsCount sets the PartsCount field's value. -func (s *GetObjectOutput) SetPartsCount(v int64) *GetObjectOutput { - s.PartsCount = &v - return s -} - -// SetReplicationStatus sets the ReplicationStatus field's value. -func (s *GetObjectOutput) SetReplicationStatus(v string) *GetObjectOutput { - s.ReplicationStatus = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *GetObjectOutput) SetRequestCharged(v string) *GetObjectOutput { - s.RequestCharged = &v - return s -} - -// SetRestore sets the Restore field's value. -func (s *GetObjectOutput) SetRestore(v string) *GetObjectOutput { - s.Restore = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *GetObjectOutput) SetSSECustomerAlgorithm(v string) *GetObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *GetObjectOutput) SetSSECustomerKeyMD5(v string) *GetObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *GetObjectOutput) SetSSEKMSKeyId(v string) *GetObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *GetObjectOutput) SetServerSideEncryption(v string) *GetObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *GetObjectOutput) SetStorageClass(v string) *GetObjectOutput { - s.StorageClass = &v - return s -} - -// SetTagCount sets the TagCount field's value. -func (s *GetObjectOutput) SetTagCount(v int64) *GetObjectOutput { - s.TagCount = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectOutput) SetVersionId(v string) *GetObjectOutput { - s.VersionId = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *GetObjectOutput) SetWebsiteRedirectLocation(v string) *GetObjectOutput { - s.WebsiteRedirectLocation = &v - return s -} - -type GetObjectRetentionInput struct { - _ struct{} `locationName:"GetObjectRetentionRequest" type:"structure"` - - // The bucket name containing the object whose retention settings you want to - // retrieve. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The key name for the object whose retention settings you want to retrieve. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // The version ID for the object whose retention settings you want to retrieve. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectRetentionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectRetentionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectRetentionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectRetentionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectRetentionInput) SetBucket(v string) *GetObjectRetentionInput { - s.Bucket = &v - return s -} - -func (s *GetObjectRetentionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectRetentionInput) SetKey(v string) *GetObjectRetentionInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectRetentionInput) SetRequestPayer(v string) *GetObjectRetentionInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectRetentionInput) SetVersionId(v string) *GetObjectRetentionInput { - s.VersionId = &v - return s -} - -func (s *GetObjectRetentionInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectRetentionInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectRetentionOutput struct { - _ struct{} `type:"structure" payload:"Retention"` - - // The container element for an object's retention settings. - Retention *ObjectLockRetention `type:"structure"` -} - -// String returns the string representation -func (s GetObjectRetentionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectRetentionOutput) GoString() string { - return s.String() -} - -// SetRetention sets the Retention field's value. -func (s *GetObjectRetentionOutput) SetRetention(v *ObjectLockRetention) *GetObjectRetentionOutput { - s.Retention = v - return s -} - -type GetObjectTaggingInput struct { - _ struct{} `locationName:"GetObjectTaggingRequest" type:"structure"` - - // The bucket name containing the object for which to get the tagging information. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Object key for which to get the tagging information. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // The versionId of the object for which to get the tagging information. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectTaggingInput) SetBucket(v string) *GetObjectTaggingInput { - s.Bucket = &v - return s -} - -func (s *GetObjectTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectTaggingInput) SetKey(v string) *GetObjectTaggingInput { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectTaggingInput) SetVersionId(v string) *GetObjectTaggingInput { - s.VersionId = &v - return s -} - -func (s *GetObjectTaggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectTaggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectTaggingOutput struct { - _ struct{} `type:"structure"` - - // Contains the tag set. - // - // TagSet is a required field - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` - - // The versionId of the object for which you got the tagging information. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s GetObjectTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTaggingOutput) GoString() string { - return s.String() -} - -// SetTagSet sets the TagSet field's value. -func (s *GetObjectTaggingOutput) SetTagSet(v []*Tag) *GetObjectTaggingOutput { - s.TagSet = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectTaggingOutput) SetVersionId(v string) *GetObjectTaggingOutput { - s.VersionId = &v - return s -} - -type GetObjectTorrentInput struct { - _ struct{} `locationName:"GetObjectTorrentRequest" type:"structure"` - - // The name of the bucket containing the object for which to get the torrent - // files. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The object key for which to get the information. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` -} - -// String returns the string representation -func (s GetObjectTorrentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTorrentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectTorrentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectTorrentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectTorrentInput) SetBucket(v string) *GetObjectTorrentInput { - s.Bucket = &v - return s -} - -func (s *GetObjectTorrentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectTorrentInput) SetKey(v string) *GetObjectTorrentInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectTorrentInput) SetRequestPayer(v string) *GetObjectTorrentInput { - s.RequestPayer = &v - return s -} - -func (s *GetObjectTorrentInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetObjectTorrentInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetObjectTorrentOutput struct { - _ struct{} `type:"structure" payload:"Body"` - - // A Bencoded dictionary as defined by the BitTorrent specification - Body io.ReadCloser `type:"blob"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s GetObjectTorrentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTorrentOutput) GoString() string { - return s.String() -} - -// SetBody sets the Body field's value. -func (s *GetObjectTorrentOutput) SetBody(v io.ReadCloser) *GetObjectTorrentOutput { - s.Body = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *GetObjectTorrentOutput) SetRequestCharged(v string) *GetObjectTorrentOutput { - s.RequestCharged = &v - return s -} - -type GetPublicAccessBlockInput struct { - _ struct{} `locationName:"GetPublicAccessBlockRequest" type:"structure"` - - // The name of the Amazon S3 bucket whose PublicAccessBlock configuration you - // want to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetPublicAccessBlockInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetPublicAccessBlockInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetPublicAccessBlockInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetPublicAccessBlockInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetPublicAccessBlockInput) SetBucket(v string) *GetPublicAccessBlockInput { - s.Bucket = &v - return s -} - -func (s *GetPublicAccessBlockInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *GetPublicAccessBlockInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *GetPublicAccessBlockInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type GetPublicAccessBlockOutput struct { - _ struct{} `type:"structure" payload:"PublicAccessBlockConfiguration"` - - // The PublicAccessBlock configuration currently in effect for this Amazon S3 - // bucket. - PublicAccessBlockConfiguration *PublicAccessBlockConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetPublicAccessBlockOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetPublicAccessBlockOutput) GoString() string { - return s.String() -} - -// SetPublicAccessBlockConfiguration sets the PublicAccessBlockConfiguration field's value. -func (s *GetPublicAccessBlockOutput) SetPublicAccessBlockConfiguration(v *PublicAccessBlockConfiguration) *GetPublicAccessBlockOutput { - s.PublicAccessBlockConfiguration = v - return s -} - -// Container for S3 Glacier job parameters. -type GlacierJobParameters struct { - _ struct{} `type:"structure"` - - // S3 Glacier retrieval tier at which the restore will be processed. - // - // Tier is a required field - Tier *string `type:"string" required:"true" enum:"Tier"` -} - -// String returns the string representation -func (s GlacierJobParameters) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GlacierJobParameters) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GlacierJobParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GlacierJobParameters"} - if s.Tier == nil { - invalidParams.Add(request.NewErrParamRequired("Tier")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTier sets the Tier field's value. -func (s *GlacierJobParameters) SetTier(v string) *GlacierJobParameters { - s.Tier = &v - return s -} - -// Container for grant information. -type Grant struct { - _ struct{} `type:"structure"` - - // The person being granted permissions. - Grantee *Grantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - // Specifies the permission given to the grantee. - Permission *string `type:"string" enum:"Permission"` -} - -// String returns the string representation -func (s Grant) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Grant) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Grant) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Grant"} - if s.Grantee != nil { - if err := s.Grantee.Validate(); err != nil { - invalidParams.AddNested("Grantee", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantee sets the Grantee field's value. -func (s *Grant) SetGrantee(v *Grantee) *Grant { - s.Grantee = v - return s -} - -// SetPermission sets the Permission field's value. -func (s *Grant) SetPermission(v string) *Grant { - s.Permission = &v - return s -} - -// Container for the person being granted permissions. -type Grantee struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - // Screen name of the grantee. - DisplayName *string `type:"string"` - - // Email address of the grantee. - // - // Using email addresses to specify a grantee is only supported in the following - // AWS Regions: - // - // * US East (N. Virginia) - // - // * US West (N. California) - // - // * US West (Oregon) - // - // * Asia Pacific (Singapore) - // - // * Asia Pacific (Sydney) - // - // * Asia Pacific (Tokyo) - // - // * Europe (Ireland) - // - // * South America (São Paulo) - // - // For a list of all the Amazon S3 supported Regions and endpoints, see Regions - // and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) - // in the AWS General Reference. - EmailAddress *string `type:"string"` - - // The canonical user ID of the grantee. - ID *string `type:"string"` - - // Type of grantee - // - // Type is a required field - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true" required:"true" enum:"Type"` - - // URI of the grantee group. - URI *string `type:"string"` -} - -// String returns the string representation -func (s Grantee) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Grantee) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Grantee) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Grantee"} - if s.Type == nil { - invalidParams.Add(request.NewErrParamRequired("Type")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDisplayName sets the DisplayName field's value. -func (s *Grantee) SetDisplayName(v string) *Grantee { - s.DisplayName = &v - return s -} - -// SetEmailAddress sets the EmailAddress field's value. -func (s *Grantee) SetEmailAddress(v string) *Grantee { - s.EmailAddress = &v - return s -} - -// SetID sets the ID field's value. -func (s *Grantee) SetID(v string) *Grantee { - s.ID = &v - return s -} - -// SetType sets the Type field's value. -func (s *Grantee) SetType(v string) *Grantee { - s.Type = &v - return s -} - -// SetURI sets the URI field's value. -func (s *Grantee) SetURI(v string) *Grantee { - s.URI = &v - return s -} - -type HeadBucketInput struct { - _ struct{} `locationName:"HeadBucketRequest" type:"structure"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s HeadBucketInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadBucketInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *HeadBucketInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "HeadBucketInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *HeadBucketInput) SetBucket(v string) *HeadBucketInput { - s.Bucket = &v - return s -} - -func (s *HeadBucketInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *HeadBucketInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *HeadBucketInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type HeadBucketOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s HeadBucketOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadBucketOutput) GoString() string { - return s.String() -} - -type HeadObjectInput struct { - _ struct{} `locationName:"HeadObjectRequest" type:"structure"` - - // The name of the bucket containing the object. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Return the object only if its entity tag (ETag) is the same as the one specified, - // otherwise return a 412 (precondition failed). - IfMatch *string `location:"header" locationName:"If-Match" type:"string"` - - // Return the object only if it has been modified since the specified time, - // otherwise return a 304 (not modified). - IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp"` - - // Return the object only if its entity tag (ETag) is different from the one - // specified, otherwise return a 304 (not modified). - IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` - - // Return the object only if it has not been modified since the specified time, - // otherwise return a 412 (precondition failed). - IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp"` - - // The object key. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of the object being read. This is a positive integer between - // 1 and 10,000. Effectively performs a 'ranged' HEAD request for the part specified. - // Useful querying about the size of the part and the number of parts in this - // object. - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer"` - - // Downloads the specified range bytes of an object. For more information about - // the HTTP Range header, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. - // - // Amazon S3 doesn't support retrieving multiple ranges of data per GET request. - Range *string `location:"header" locationName:"Range" type:"string"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s HeadObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *HeadObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "HeadObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *HeadObjectInput) SetBucket(v string) *HeadObjectInput { - s.Bucket = &v - return s -} - -func (s *HeadObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetIfMatch sets the IfMatch field's value. -func (s *HeadObjectInput) SetIfMatch(v string) *HeadObjectInput { - s.IfMatch = &v - return s -} - -// SetIfModifiedSince sets the IfModifiedSince field's value. -func (s *HeadObjectInput) SetIfModifiedSince(v time.Time) *HeadObjectInput { - s.IfModifiedSince = &v - return s -} - -// SetIfNoneMatch sets the IfNoneMatch field's value. -func (s *HeadObjectInput) SetIfNoneMatch(v string) *HeadObjectInput { - s.IfNoneMatch = &v - return s -} - -// SetIfUnmodifiedSince sets the IfUnmodifiedSince field's value. -func (s *HeadObjectInput) SetIfUnmodifiedSince(v time.Time) *HeadObjectInput { - s.IfUnmodifiedSince = &v - return s -} - -// SetKey sets the Key field's value. -func (s *HeadObjectInput) SetKey(v string) *HeadObjectInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *HeadObjectInput) SetPartNumber(v int64) *HeadObjectInput { - s.PartNumber = &v - return s -} - -// SetRange sets the Range field's value. -func (s *HeadObjectInput) SetRange(v string) *HeadObjectInput { - s.Range = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *HeadObjectInput) SetRequestPayer(v string) *HeadObjectInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *HeadObjectInput) SetSSECustomerAlgorithm(v string) *HeadObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *HeadObjectInput) SetSSECustomerKey(v string) *HeadObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *HeadObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *HeadObjectInput) SetSSECustomerKeyMD5(v string) *HeadObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *HeadObjectInput) SetVersionId(v string) *HeadObjectInput { - s.VersionId = &v - return s -} - -func (s *HeadObjectInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *HeadObjectInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type HeadObjectOutput struct { - _ struct{} `type:"structure"` - - // Indicates that a range of bytes was specified. - AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // Specifies whether the object retrieved was (true) or was not (false) a Delete - // Marker. If false, this response header does not appear in the response. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // An ETag is an opaque identifier assigned by a web server to a specific version - // of a resource found at a URL. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured (see PUT Bucket lifecycle), the response - // includes this header. It includes the expiry-date and rule-id key-value pairs - // providing object expiration information. The value of the rule-id is URL - // encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *string `location:"header" locationName:"Expires" type:"string"` - - // Last modified date of the object - LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp"` - - // A map of metadata to store with the object in S3. - // - // By default unmarshaled keys are written as a map keys in following canonicalized format: - // the first letter and any letter following a hyphen will be capitalized, and the rest as lowercase. - // Set `aws.Config.LowerCaseHeaderMaps` to `true` to write unmarshaled keys to the map as lowercase. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // This is set to the number of metadata entries not returned in x-amz-meta - // headers. This can happen if you create metadata using an API like SOAP that - // supports more flexible metadata than the REST API. For example, using SOAP, - // you can create metadata whose values are not legal HTTP headers. - MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` - - // Specifies whether a legal hold is in effect for this object. This header - // is only returned if the requester has the s3:GetObjectLegalHold permission. - // This header is not returned if the specified version of this object has never - // had a legal hold applied. For more information about S3 Object Lock, see - // Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). - ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - - // The Object Lock mode, if any, that's in effect for this object. This header - // is only returned if the requester has the s3:GetObjectRetention permission. - // For more information about S3 Object Lock, see Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). - ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - - // The date and time when the Object Lock retention period expires. This header - // is only returned if the requester has the s3:GetObjectRetention permission. - ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` - - // The count of parts this object has. - PartsCount *int64 `location:"header" locationName:"x-amz-mp-parts-count" type:"integer"` - - // Amazon S3 can return this header if your request involves a bucket that is - // either a source or destination in a replication rule. - // - // In replication, you have a source bucket on which you configure replication - // and destination bucket where Amazon S3 stores object replicas. When you request - // an object (GetObject) or object metadata (HeadObject) from these buckets, - // Amazon S3 will return the x-amz-replication-status header in the response - // as follows: - // - // * If requesting an object from the source bucket — Amazon S3 will return - // the x-amz-replication-status header if the object in your request is eligible - // for replication. For example, suppose that in your replication configuration, - // you specify object prefix TaxDocs requesting Amazon S3 to replicate objects - // with key prefix TaxDocs. Any objects you upload with this key name prefix, - // for example TaxDocs/document1.pdf, are eligible for replication. For any - // object request with this key name prefix, Amazon S3 will return the x-amz-replication-status - // header with value PENDING, COMPLETED or FAILED indicating object replication - // status. - // - // * If requesting an object from the destination bucket — Amazon S3 will - // return the x-amz-replication-status header with value REPLICA if the object - // in your request is a replica that Amazon S3 created. - // - // For more information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html). - ReplicationStatus *string `location:"header" locationName:"x-amz-replication-status" type:"string" enum:"ReplicationStatus"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If the object is an archived object (an object whose storage class is GLACIER), - // the response includes this header if either the archive restoration is in - // progress (see RestoreObject or an archive copy is already restored. - // - // If an archive copy is already restored, the header value indicates when Amazon - // S3 is scheduled to delete the object copy. For example: - // - // x-amz-restore: ongoing-request="false", expiry-date="Fri, 23 Dec 2012 00:00:00 - // GMT" - // - // If the object restoration is in progress, the header returns the value ongoing-request="true". - // - // For more information about archiving objects, see Transitioning Objects: - // General Considerations (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html#lifecycle-transition-general-considerations). - Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // If the object is stored using server-side encryption either with an AWS KMS - // customer master key (CMK) or an Amazon S3-managed encryption key, the response - // includes this header with the value of the server-side encryption algorithm - // used when storing this object in Amazon S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Provides storage class information of the object. Amazon S3 returns this - // header for all objects except for S3 Standard storage class objects. - // - // For more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html). - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s HeadObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadObjectOutput) GoString() string { - return s.String() -} - -// SetAcceptRanges sets the AcceptRanges field's value. -func (s *HeadObjectOutput) SetAcceptRanges(v string) *HeadObjectOutput { - s.AcceptRanges = &v - return s -} - -// SetCacheControl sets the CacheControl field's value. -func (s *HeadObjectOutput) SetCacheControl(v string) *HeadObjectOutput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *HeadObjectOutput) SetContentDisposition(v string) *HeadObjectOutput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *HeadObjectOutput) SetContentEncoding(v string) *HeadObjectOutput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *HeadObjectOutput) SetContentLanguage(v string) *HeadObjectOutput { - s.ContentLanguage = &v - return s -} - -// SetContentLength sets the ContentLength field's value. -func (s *HeadObjectOutput) SetContentLength(v int64) *HeadObjectOutput { - s.ContentLength = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *HeadObjectOutput) SetContentType(v string) *HeadObjectOutput { - s.ContentType = &v - return s -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *HeadObjectOutput) SetDeleteMarker(v bool) *HeadObjectOutput { - s.DeleteMarker = &v - return s -} - -// SetETag sets the ETag field's value. -func (s *HeadObjectOutput) SetETag(v string) *HeadObjectOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *HeadObjectOutput) SetExpiration(v string) *HeadObjectOutput { - s.Expiration = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *HeadObjectOutput) SetExpires(v string) *HeadObjectOutput { - s.Expires = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *HeadObjectOutput) SetLastModified(v time.Time) *HeadObjectOutput { - s.LastModified = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *HeadObjectOutput) SetMetadata(v map[string]*string) *HeadObjectOutput { - s.Metadata = v - return s -} - -// SetMissingMeta sets the MissingMeta field's value. -func (s *HeadObjectOutput) SetMissingMeta(v int64) *HeadObjectOutput { - s.MissingMeta = &v - return s -} - -// SetObjectLockLegalHoldStatus sets the ObjectLockLegalHoldStatus field's value. -func (s *HeadObjectOutput) SetObjectLockLegalHoldStatus(v string) *HeadObjectOutput { - s.ObjectLockLegalHoldStatus = &v - return s -} - -// SetObjectLockMode sets the ObjectLockMode field's value. -func (s *HeadObjectOutput) SetObjectLockMode(v string) *HeadObjectOutput { - s.ObjectLockMode = &v - return s -} - -// SetObjectLockRetainUntilDate sets the ObjectLockRetainUntilDate field's value. -func (s *HeadObjectOutput) SetObjectLockRetainUntilDate(v time.Time) *HeadObjectOutput { - s.ObjectLockRetainUntilDate = &v - return s -} - -// SetPartsCount sets the PartsCount field's value. -func (s *HeadObjectOutput) SetPartsCount(v int64) *HeadObjectOutput { - s.PartsCount = &v - return s -} - -// SetReplicationStatus sets the ReplicationStatus field's value. -func (s *HeadObjectOutput) SetReplicationStatus(v string) *HeadObjectOutput { - s.ReplicationStatus = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *HeadObjectOutput) SetRequestCharged(v string) *HeadObjectOutput { - s.RequestCharged = &v - return s -} - -// SetRestore sets the Restore field's value. -func (s *HeadObjectOutput) SetRestore(v string) *HeadObjectOutput { - s.Restore = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *HeadObjectOutput) SetSSECustomerAlgorithm(v string) *HeadObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *HeadObjectOutput) SetSSECustomerKeyMD5(v string) *HeadObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *HeadObjectOutput) SetSSEKMSKeyId(v string) *HeadObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *HeadObjectOutput) SetServerSideEncryption(v string) *HeadObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *HeadObjectOutput) SetStorageClass(v string) *HeadObjectOutput { - s.StorageClass = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *HeadObjectOutput) SetVersionId(v string) *HeadObjectOutput { - s.VersionId = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *HeadObjectOutput) SetWebsiteRedirectLocation(v string) *HeadObjectOutput { - s.WebsiteRedirectLocation = &v - return s -} - -// Container for the Suffix element. -type IndexDocument struct { - _ struct{} `type:"structure"` - - // A suffix that is appended to a request that is for a directory on the website - // endpoint (for example,if the suffix is index.html and you make a request - // to samplebucket/images/ the data that is returned will be for the object - // with the key name images/index.html) The suffix must not be empty and must - // not include a slash character. - // - // Suffix is a required field - Suffix *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s IndexDocument) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s IndexDocument) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *IndexDocument) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "IndexDocument"} - if s.Suffix == nil { - invalidParams.Add(request.NewErrParamRequired("Suffix")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetSuffix sets the Suffix field's value. -func (s *IndexDocument) SetSuffix(v string) *IndexDocument { - s.Suffix = &v - return s -} - -// Container element that identifies who initiated the multipart upload. -type Initiator struct { - _ struct{} `type:"structure"` - - // Name of the Principal. - DisplayName *string `type:"string"` - - // If the principal is an AWS account, it provides the Canonical User ID. If - // the principal is an IAM User, it provides a user ARN value. - ID *string `type:"string"` -} - -// String returns the string representation -func (s Initiator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Initiator) GoString() string { - return s.String() -} - -// SetDisplayName sets the DisplayName field's value. -func (s *Initiator) SetDisplayName(v string) *Initiator { - s.DisplayName = &v - return s -} - -// SetID sets the ID field's value. -func (s *Initiator) SetID(v string) *Initiator { - s.ID = &v - return s -} - -// Describes the serialization format of the object. -type InputSerialization struct { - _ struct{} `type:"structure"` - - // Describes the serialization of a CSV-encoded object. - CSV *CSVInput `type:"structure"` - - // Specifies object's compression format. Valid values: NONE, GZIP, BZIP2. Default - // Value: NONE. - CompressionType *string `type:"string" enum:"CompressionType"` - - // Specifies JSON as object's input serialization format. - JSON *JSONInput `type:"structure"` - - // Specifies Parquet as object's input serialization format. - Parquet *ParquetInput `type:"structure"` -} - -// String returns the string representation -func (s InputSerialization) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InputSerialization) GoString() string { - return s.String() -} - -// SetCSV sets the CSV field's value. -func (s *InputSerialization) SetCSV(v *CSVInput) *InputSerialization { - s.CSV = v - return s -} - -// SetCompressionType sets the CompressionType field's value. -func (s *InputSerialization) SetCompressionType(v string) *InputSerialization { - s.CompressionType = &v - return s -} - -// SetJSON sets the JSON field's value. -func (s *InputSerialization) SetJSON(v *JSONInput) *InputSerialization { - s.JSON = v - return s -} - -// SetParquet sets the Parquet field's value. -func (s *InputSerialization) SetParquet(v *ParquetInput) *InputSerialization { - s.Parquet = v - return s -} - -// Specifies the inventory configuration for an Amazon S3 bucket. For more information, -// see GET Bucket inventory (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETInventoryConfig.html) -// in the Amazon Simple Storage Service API Reference. -type InventoryConfiguration struct { - _ struct{} `type:"structure"` - - // Contains information about where to publish the inventory results. - // - // Destination is a required field - Destination *InventoryDestination `type:"structure" required:"true"` - - // Specifies an inventory filter. The inventory only includes objects that meet - // the filter's criteria. - Filter *InventoryFilter `type:"structure"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `type:"string" required:"true"` - - // Object versions to include in the inventory list. If set to All, the list - // includes all the object versions, which adds the version-related fields VersionId, - // IsLatest, and DeleteMarker to the list. If set to Current, the list does - // not contain these version-related fields. - // - // IncludedObjectVersions is a required field - IncludedObjectVersions *string `type:"string" required:"true" enum:"InventoryIncludedObjectVersions"` - - // Specifies whether the inventory is enabled or disabled. If set to True, an - // inventory list is generated. If set to False, no inventory list is generated. - // - // IsEnabled is a required field - IsEnabled *bool `type:"boolean" required:"true"` - - // Contains the optional fields that are included in the inventory results. - OptionalFields []*string `locationNameList:"Field" type:"list"` - - // Specifies the schedule for generating inventory results. - // - // Schedule is a required field - Schedule *InventorySchedule `type:"structure" required:"true"` -} - -// String returns the string representation -func (s InventoryConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryConfiguration"} - if s.Destination == nil { - invalidParams.Add(request.NewErrParamRequired("Destination")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.IncludedObjectVersions == nil { - invalidParams.Add(request.NewErrParamRequired("IncludedObjectVersions")) - } - if s.IsEnabled == nil { - invalidParams.Add(request.NewErrParamRequired("IsEnabled")) - } - if s.Schedule == nil { - invalidParams.Add(request.NewErrParamRequired("Schedule")) - } - if s.Destination != nil { - if err := s.Destination.Validate(); err != nil { - invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) - } - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - if s.Schedule != nil { - if err := s.Schedule.Validate(); err != nil { - invalidParams.AddNested("Schedule", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDestination sets the Destination field's value. -func (s *InventoryConfiguration) SetDestination(v *InventoryDestination) *InventoryConfiguration { - s.Destination = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *InventoryConfiguration) SetFilter(v *InventoryFilter) *InventoryConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *InventoryConfiguration) SetId(v string) *InventoryConfiguration { - s.Id = &v - return s -} - -// SetIncludedObjectVersions sets the IncludedObjectVersions field's value. -func (s *InventoryConfiguration) SetIncludedObjectVersions(v string) *InventoryConfiguration { - s.IncludedObjectVersions = &v - return s -} - -// SetIsEnabled sets the IsEnabled field's value. -func (s *InventoryConfiguration) SetIsEnabled(v bool) *InventoryConfiguration { - s.IsEnabled = &v - return s -} - -// SetOptionalFields sets the OptionalFields field's value. -func (s *InventoryConfiguration) SetOptionalFields(v []*string) *InventoryConfiguration { - s.OptionalFields = v - return s -} - -// SetSchedule sets the Schedule field's value. -func (s *InventoryConfiguration) SetSchedule(v *InventorySchedule) *InventoryConfiguration { - s.Schedule = v - return s -} - -// Specifies the inventory configuration for an Amazon S3 bucket. -type InventoryDestination struct { - _ struct{} `type:"structure"` - - // Contains the bucket name, file format, bucket owner (optional), and prefix - // (optional) where inventory results are published. - // - // S3BucketDestination is a required field - S3BucketDestination *InventoryS3BucketDestination `type:"structure" required:"true"` -} - -// String returns the string representation -func (s InventoryDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryDestination"} - if s.S3BucketDestination == nil { - invalidParams.Add(request.NewErrParamRequired("S3BucketDestination")) - } - if s.S3BucketDestination != nil { - if err := s.S3BucketDestination.Validate(); err != nil { - invalidParams.AddNested("S3BucketDestination", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetS3BucketDestination sets the S3BucketDestination field's value. -func (s *InventoryDestination) SetS3BucketDestination(v *InventoryS3BucketDestination) *InventoryDestination { - s.S3BucketDestination = v - return s -} - -// Contains the type of server-side encryption used to encrypt the inventory -// results. -type InventoryEncryption struct { - _ struct{} `type:"structure"` - - // Specifies the use of SSE-KMS to encrypt delivered inventory reports. - SSEKMS *SSEKMS `locationName:"SSE-KMS" type:"structure"` - - // Specifies the use of SSE-S3 to encrypt delivered inventory reports. - SSES3 *SSES3 `locationName:"SSE-S3" type:"structure"` -} - -// String returns the string representation -func (s InventoryEncryption) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryEncryption) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryEncryption) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryEncryption"} - if s.SSEKMS != nil { - if err := s.SSEKMS.Validate(); err != nil { - invalidParams.AddNested("SSEKMS", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetSSEKMS sets the SSEKMS field's value. -func (s *InventoryEncryption) SetSSEKMS(v *SSEKMS) *InventoryEncryption { - s.SSEKMS = v - return s -} - -// SetSSES3 sets the SSES3 field's value. -func (s *InventoryEncryption) SetSSES3(v *SSES3) *InventoryEncryption { - s.SSES3 = v - return s -} - -// Specifies an inventory filter. The inventory only includes objects that meet -// the filter's criteria. -type InventoryFilter struct { - _ struct{} `type:"structure"` - - // The prefix that an object must have to be included in the inventory results. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s InventoryFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryFilter"} - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *InventoryFilter) SetPrefix(v string) *InventoryFilter { - s.Prefix = &v - return s -} - -// Contains the bucket name, file format, bucket owner (optional), and prefix -// (optional) where inventory results are published. -type InventoryS3BucketDestination struct { - _ struct{} `type:"structure"` - - // The account ID that owns the destination S3 bucket. If no account ID is provided, - // the owner is not validated before exporting data. - // - // Although this value is optional, we strongly recommend that you set it to - // help prevent problems if the destination bucket ownership changes. - AccountId *string `type:"string"` - - // The Amazon Resource Name (ARN) of the bucket where inventory results will - // be published. - // - // Bucket is a required field - Bucket *string `type:"string" required:"true"` - - // Contains the type of server-side encryption used to encrypt the inventory - // results. - Encryption *InventoryEncryption `type:"structure"` - - // Specifies the output format of the inventory results. - // - // Format is a required field - Format *string `type:"string" required:"true" enum:"InventoryFormat"` - - // The prefix that is prepended to all inventory results. - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s InventoryS3BucketDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryS3BucketDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryS3BucketDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryS3BucketDestination"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Format == nil { - invalidParams.Add(request.NewErrParamRequired("Format")) - } - if s.Encryption != nil { - if err := s.Encryption.Validate(); err != nil { - invalidParams.AddNested("Encryption", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccountId sets the AccountId field's value. -func (s *InventoryS3BucketDestination) SetAccountId(v string) *InventoryS3BucketDestination { - s.AccountId = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *InventoryS3BucketDestination) SetBucket(v string) *InventoryS3BucketDestination { - s.Bucket = &v - return s -} - -func (s *InventoryS3BucketDestination) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetEncryption sets the Encryption field's value. -func (s *InventoryS3BucketDestination) SetEncryption(v *InventoryEncryption) *InventoryS3BucketDestination { - s.Encryption = v - return s -} - -// SetFormat sets the Format field's value. -func (s *InventoryS3BucketDestination) SetFormat(v string) *InventoryS3BucketDestination { - s.Format = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *InventoryS3BucketDestination) SetPrefix(v string) *InventoryS3BucketDestination { - s.Prefix = &v - return s -} - -// Specifies the schedule for generating inventory results. -type InventorySchedule struct { - _ struct{} `type:"structure"` - - // Specifies how frequently inventory results are produced. - // - // Frequency is a required field - Frequency *string `type:"string" required:"true" enum:"InventoryFrequency"` -} - -// String returns the string representation -func (s InventorySchedule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventorySchedule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventorySchedule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventorySchedule"} - if s.Frequency == nil { - invalidParams.Add(request.NewErrParamRequired("Frequency")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFrequency sets the Frequency field's value. -func (s *InventorySchedule) SetFrequency(v string) *InventorySchedule { - s.Frequency = &v - return s -} - -// Specifies JSON as object's input serialization format. -type JSONInput struct { - _ struct{} `type:"structure"` - - // The type of JSON. Valid values: Document, Lines. - Type *string `type:"string" enum:"JSONType"` -} - -// String returns the string representation -func (s JSONInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s JSONInput) GoString() string { - return s.String() -} - -// SetType sets the Type field's value. -func (s *JSONInput) SetType(v string) *JSONInput { - s.Type = &v - return s -} - -// Specifies JSON as request's output serialization format. -type JSONOutput struct { - _ struct{} `type:"structure"` - - // The value used to separate individual records in the output. If no value - // is specified, Amazon S3 uses a newline character ('\n'). - RecordDelimiter *string `type:"string"` -} - -// String returns the string representation -func (s JSONOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s JSONOutput) GoString() string { - return s.String() -} - -// SetRecordDelimiter sets the RecordDelimiter field's value. -func (s *JSONOutput) SetRecordDelimiter(v string) *JSONOutput { - s.RecordDelimiter = &v - return s -} - -// A container for object key name prefix and suffix filtering rules. -type KeyFilter struct { - _ struct{} `type:"structure"` - - // A list of containers for the key-value pair that defines the criteria for - // the filter rule. - FilterRules []*FilterRule `locationName:"FilterRule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s KeyFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s KeyFilter) GoString() string { - return s.String() -} - -// SetFilterRules sets the FilterRules field's value. -func (s *KeyFilter) SetFilterRules(v []*FilterRule) *KeyFilter { - s.FilterRules = v - return s -} - -// A container for specifying the configuration for AWS Lambda notifications. -type LambdaFunctionConfiguration struct { - _ struct{} `type:"structure"` - - // The Amazon S3 bucket event for which to invoke the AWS Lambda function. For - // more information, see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Events is a required field - Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - - // Specifies object key name filtering rules. For information about key name - // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - Filter *NotificationConfigurationFilter `type:"structure"` - - // An optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // The Amazon Resource Name (ARN) of the AWS Lambda function that Amazon S3 - // invokes when the specified event type occurs. - // - // LambdaFunctionArn is a required field - LambdaFunctionArn *string `locationName:"CloudFunction" type:"string" required:"true"` -} - -// String returns the string representation -func (s LambdaFunctionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LambdaFunctionConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LambdaFunctionConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LambdaFunctionConfiguration"} - if s.Events == nil { - invalidParams.Add(request.NewErrParamRequired("Events")) - } - if s.LambdaFunctionArn == nil { - invalidParams.Add(request.NewErrParamRequired("LambdaFunctionArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEvents sets the Events field's value. -func (s *LambdaFunctionConfiguration) SetEvents(v []*string) *LambdaFunctionConfiguration { - s.Events = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *LambdaFunctionConfiguration) SetFilter(v *NotificationConfigurationFilter) *LambdaFunctionConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *LambdaFunctionConfiguration) SetId(v string) *LambdaFunctionConfiguration { - s.Id = &v - return s -} - -// SetLambdaFunctionArn sets the LambdaFunctionArn field's value. -func (s *LambdaFunctionConfiguration) SetLambdaFunctionArn(v string) *LambdaFunctionConfiguration { - s.LambdaFunctionArn = &v - return s -} - -// Container for lifecycle rules. You can add as many as 1000 rules. -type LifecycleConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies lifecycle configuration rules for an Amazon S3 bucket. - // - // Rules is a required field - Rules []*Rule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s LifecycleConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleConfiguration"} - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRules sets the Rules field's value. -func (s *LifecycleConfiguration) SetRules(v []*Rule) *LifecycleConfiguration { - s.Rules = v - return s -} - -// Container for the expiration for the lifecycle of the object. -type LifecycleExpiration struct { - _ struct{} `type:"structure"` - - // Indicates at what date the object is to be moved or deleted. Should be in - // GMT ISO 8601 Format. - Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Indicates the lifetime, in days, of the objects that are subject to the rule. - // The value must be a non-zero positive integer. - Days *int64 `type:"integer"` - - // Indicates whether Amazon S3 will remove a delete marker with no noncurrent - // versions. If set to true, the delete marker will be expired; if set to false - // the policy takes no action. This cannot be specified with Days or Date in - // a Lifecycle Expiration Policy. - ExpiredObjectDeleteMarker *bool `type:"boolean"` -} - -// String returns the string representation -func (s LifecycleExpiration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleExpiration) GoString() string { - return s.String() -} - -// SetDate sets the Date field's value. -func (s *LifecycleExpiration) SetDate(v time.Time) *LifecycleExpiration { - s.Date = &v - return s -} - -// SetDays sets the Days field's value. -func (s *LifecycleExpiration) SetDays(v int64) *LifecycleExpiration { - s.Days = &v - return s -} - -// SetExpiredObjectDeleteMarker sets the ExpiredObjectDeleteMarker field's value. -func (s *LifecycleExpiration) SetExpiredObjectDeleteMarker(v bool) *LifecycleExpiration { - s.ExpiredObjectDeleteMarker = &v - return s -} - -// A lifecycle rule for individual objects in an Amazon S3 bucket. -type LifecycleRule struct { - _ struct{} `type:"structure"` - - // Specifies the days since the initiation of an incomplete multipart upload - // that Amazon S3 will wait before permanently removing all parts of the upload. - // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket - // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) - // in the Amazon Simple Storage Service Developer Guide. - AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` - - // Specifies the expiration for the lifecycle of the object in the form of date, - // days and, whether the object has a delete marker. - Expiration *LifecycleExpiration `type:"structure"` - - // The Filter is used to identify objects that a Lifecycle Rule applies to. - // A Filter must have exactly one of Prefix, Tag, or And specified. - Filter *LifecycleRuleFilter `type:"structure"` - - // Unique identifier for the rule. The value cannot be longer than 255 characters. - ID *string `type:"string"` - - // Specifies when noncurrent object versions expire. Upon expiration, Amazon - // S3 permanently deletes the noncurrent object versions. You set this lifecycle - // configuration action on a bucket that has versioning enabled (or suspended) - // to request that Amazon S3 delete noncurrent object versions at a specific - // period in the object's lifetime. - NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` - - // Specifies the transition rule for the lifecycle rule that describes when - // noncurrent objects transition to a specific storage class. If your bucket - // is versioning-enabled (or versioning is suspended), you can set this action - // to request that Amazon S3 transition noncurrent object versions to a specific - // storage class at a set period in the object's lifetime. - NoncurrentVersionTransitions []*NoncurrentVersionTransition `locationName:"NoncurrentVersionTransition" type:"list" flattened:"true"` - - // Prefix identifying one or more objects to which the rule applies. This is - // No longer used; use Filter instead. - // - // Deprecated: Prefix has been deprecated - Prefix *string `deprecated:"true" type:"string"` - - // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule - // is not currently being applied. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ExpirationStatus"` - - // Specifies when an Amazon S3 object transitions to a specified storage class. - Transitions []*Transition `locationName:"Transition" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s LifecycleRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleRule"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAbortIncompleteMultipartUpload sets the AbortIncompleteMultipartUpload field's value. -func (s *LifecycleRule) SetAbortIncompleteMultipartUpload(v *AbortIncompleteMultipartUpload) *LifecycleRule { - s.AbortIncompleteMultipartUpload = v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *LifecycleRule) SetExpiration(v *LifecycleExpiration) *LifecycleRule { - s.Expiration = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *LifecycleRule) SetFilter(v *LifecycleRuleFilter) *LifecycleRule { - s.Filter = v - return s -} - -// SetID sets the ID field's value. -func (s *LifecycleRule) SetID(v string) *LifecycleRule { - s.ID = &v - return s -} - -// SetNoncurrentVersionExpiration sets the NoncurrentVersionExpiration field's value. -func (s *LifecycleRule) SetNoncurrentVersionExpiration(v *NoncurrentVersionExpiration) *LifecycleRule { - s.NoncurrentVersionExpiration = v - return s -} - -// SetNoncurrentVersionTransitions sets the NoncurrentVersionTransitions field's value. -func (s *LifecycleRule) SetNoncurrentVersionTransitions(v []*NoncurrentVersionTransition) *LifecycleRule { - s.NoncurrentVersionTransitions = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *LifecycleRule) SetPrefix(v string) *LifecycleRule { - s.Prefix = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *LifecycleRule) SetStatus(v string) *LifecycleRule { - s.Status = &v - return s -} - -// SetTransitions sets the Transitions field's value. -func (s *LifecycleRule) SetTransitions(v []*Transition) *LifecycleRule { - s.Transitions = v - return s -} - -// This is used in a Lifecycle Rule Filter to apply a logical AND to two or -// more predicates. The Lifecycle Rule will apply to any object matching all -// of the predicates configured inside the And operator. -type LifecycleRuleAndOperator struct { - _ struct{} `type:"structure"` - - // Prefix identifying one or more objects to which the rule applies. - Prefix *string `type:"string"` - - // All of these tags must exist in the object's tag set in order for the rule - // to apply. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s LifecycleRuleAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleRuleAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleRuleAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleRuleAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *LifecycleRuleAndOperator) SetPrefix(v string) *LifecycleRuleAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *LifecycleRuleAndOperator) SetTags(v []*Tag) *LifecycleRuleAndOperator { - s.Tags = v - return s -} - -// The Filter is used to identify objects that a Lifecycle Rule applies to. -// A Filter must have exactly one of Prefix, Tag, or And specified. -type LifecycleRuleFilter struct { - _ struct{} `type:"structure"` - - // This is used in a Lifecycle Rule Filter to apply a logical AND to two or - // more predicates. The Lifecycle Rule will apply to any object matching all - // of the predicates configured inside the And operator. - And *LifecycleRuleAndOperator `type:"structure"` - - // Prefix identifying one or more objects to which the rule applies. - Prefix *string `type:"string"` - - // This tag must exist in the object's tag set in order for the rule to apply. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s LifecycleRuleFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleRuleFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleRuleFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleRuleFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *LifecycleRuleFilter) SetAnd(v *LifecycleRuleAndOperator) *LifecycleRuleFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *LifecycleRuleFilter) SetPrefix(v string) *LifecycleRuleFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *LifecycleRuleFilter) SetTag(v *Tag) *LifecycleRuleFilter { - s.Tag = v - return s -} - -type ListBucketAnalyticsConfigurationsInput struct { - _ struct{} `locationName:"ListBucketAnalyticsConfigurationsRequest" type:"structure"` - - // The name of the bucket from which analytics configurations are retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ContinuationToken that represents a placeholder from where this request - // should begin. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` -} - -// String returns the string representation -func (s ListBucketAnalyticsConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketAnalyticsConfigurationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListBucketAnalyticsConfigurationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListBucketAnalyticsConfigurationsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListBucketAnalyticsConfigurationsInput) SetBucket(v string) *ListBucketAnalyticsConfigurationsInput { - s.Bucket = &v - return s -} - -func (s *ListBucketAnalyticsConfigurationsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketAnalyticsConfigurationsInput) SetContinuationToken(v string) *ListBucketAnalyticsConfigurationsInput { - s.ContinuationToken = &v - return s -} - -func (s *ListBucketAnalyticsConfigurationsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListBucketAnalyticsConfigurationsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListBucketAnalyticsConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // The list of analytics configurations for a bucket. - AnalyticsConfigurationList []*AnalyticsConfiguration `locationName:"AnalyticsConfiguration" type:"list" flattened:"true"` - - // The marker that is used as a starting point for this analytics configuration - // list response. This value is present if it was sent in the request. - ContinuationToken *string `type:"string"` - - // Indicates whether the returned list of analytics configurations is complete. - // A value of true indicates that the list is not complete and the NextContinuationToken - // will be provided for a subsequent request. - IsTruncated *bool `type:"boolean"` - - // NextContinuationToken is sent when isTruncated is true, which indicates that - // there are more analytics configurations to list. The next request must include - // this NextContinuationToken. The token is obfuscated and is not a usable value. - NextContinuationToken *string `type:"string"` -} - -// String returns the string representation -func (s ListBucketAnalyticsConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketAnalyticsConfigurationsOutput) GoString() string { - return s.String() -} - -// SetAnalyticsConfigurationList sets the AnalyticsConfigurationList field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetAnalyticsConfigurationList(v []*AnalyticsConfiguration) *ListBucketAnalyticsConfigurationsOutput { - s.AnalyticsConfigurationList = v - return s -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetContinuationToken(v string) *ListBucketAnalyticsConfigurationsOutput { - s.ContinuationToken = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetIsTruncated(v bool) *ListBucketAnalyticsConfigurationsOutput { - s.IsTruncated = &v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetNextContinuationToken(v string) *ListBucketAnalyticsConfigurationsOutput { - s.NextContinuationToken = &v - return s -} - -type ListBucketInventoryConfigurationsInput struct { - _ struct{} `locationName:"ListBucketInventoryConfigurationsRequest" type:"structure"` - - // The name of the bucket containing the inventory configurations to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The marker used to continue an inventory configuration listing that has been - // truncated. Use the NextContinuationToken from a previously truncated list - // response to continue the listing. The continuation token is an opaque value - // that Amazon S3 understands. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` -} - -// String returns the string representation -func (s ListBucketInventoryConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketInventoryConfigurationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListBucketInventoryConfigurationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListBucketInventoryConfigurationsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListBucketInventoryConfigurationsInput) SetBucket(v string) *ListBucketInventoryConfigurationsInput { - s.Bucket = &v - return s -} - -func (s *ListBucketInventoryConfigurationsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketInventoryConfigurationsInput) SetContinuationToken(v string) *ListBucketInventoryConfigurationsInput { - s.ContinuationToken = &v - return s -} - -func (s *ListBucketInventoryConfigurationsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListBucketInventoryConfigurationsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListBucketInventoryConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // If sent in the request, the marker that is used as a starting point for this - // inventory configuration list response. - ContinuationToken *string `type:"string"` - - // The list of inventory configurations for a bucket. - InventoryConfigurationList []*InventoryConfiguration `locationName:"InventoryConfiguration" type:"list" flattened:"true"` - - // Tells whether the returned list of inventory configurations is complete. - // A value of true indicates that the list is not complete and the NextContinuationToken - // is provided for a subsequent request. - IsTruncated *bool `type:"boolean"` - - // The marker used to continue this inventory configuration listing. Use the - // NextContinuationToken from this response to continue the listing in a subsequent - // request. The continuation token is an opaque value that Amazon S3 understands. - NextContinuationToken *string `type:"string"` -} - -// String returns the string representation -func (s ListBucketInventoryConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketInventoryConfigurationsOutput) GoString() string { - return s.String() -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetContinuationToken(v string) *ListBucketInventoryConfigurationsOutput { - s.ContinuationToken = &v - return s -} - -// SetInventoryConfigurationList sets the InventoryConfigurationList field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetInventoryConfigurationList(v []*InventoryConfiguration) *ListBucketInventoryConfigurationsOutput { - s.InventoryConfigurationList = v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetIsTruncated(v bool) *ListBucketInventoryConfigurationsOutput { - s.IsTruncated = &v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetNextContinuationToken(v string) *ListBucketInventoryConfigurationsOutput { - s.NextContinuationToken = &v - return s -} - -type ListBucketMetricsConfigurationsInput struct { - _ struct{} `locationName:"ListBucketMetricsConfigurationsRequest" type:"structure"` - - // The name of the bucket containing the metrics configurations to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The marker that is used to continue a metrics configuration listing that - // has been truncated. Use the NextContinuationToken from a previously truncated - // list response to continue the listing. The continuation token is an opaque - // value that Amazon S3 understands. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` -} - -// String returns the string representation -func (s ListBucketMetricsConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketMetricsConfigurationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListBucketMetricsConfigurationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListBucketMetricsConfigurationsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListBucketMetricsConfigurationsInput) SetBucket(v string) *ListBucketMetricsConfigurationsInput { - s.Bucket = &v - return s -} - -func (s *ListBucketMetricsConfigurationsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketMetricsConfigurationsInput) SetContinuationToken(v string) *ListBucketMetricsConfigurationsInput { - s.ContinuationToken = &v - return s -} - -func (s *ListBucketMetricsConfigurationsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListBucketMetricsConfigurationsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListBucketMetricsConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // The marker that is used as a starting point for this metrics configuration - // list response. This value is present if it was sent in the request. - ContinuationToken *string `type:"string"` - - // Indicates whether the returned list of metrics configurations is complete. - // A value of true indicates that the list is not complete and the NextContinuationToken - // will be provided for a subsequent request. - IsTruncated *bool `type:"boolean"` - - // The list of metrics configurations for a bucket. - MetricsConfigurationList []*MetricsConfiguration `locationName:"MetricsConfiguration" type:"list" flattened:"true"` - - // The marker used to continue a metrics configuration listing that has been - // truncated. Use the NextContinuationToken from a previously truncated list - // response to continue the listing. The continuation token is an opaque value - // that Amazon S3 understands. - NextContinuationToken *string `type:"string"` -} - -// String returns the string representation -func (s ListBucketMetricsConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketMetricsConfigurationsOutput) GoString() string { - return s.String() -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetContinuationToken(v string) *ListBucketMetricsConfigurationsOutput { - s.ContinuationToken = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetIsTruncated(v bool) *ListBucketMetricsConfigurationsOutput { - s.IsTruncated = &v - return s -} - -// SetMetricsConfigurationList sets the MetricsConfigurationList field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetMetricsConfigurationList(v []*MetricsConfiguration) *ListBucketMetricsConfigurationsOutput { - s.MetricsConfigurationList = v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetNextContinuationToken(v string) *ListBucketMetricsConfigurationsOutput { - s.NextContinuationToken = &v - return s -} - -type ListBucketsInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s ListBucketsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketsInput) GoString() string { - return s.String() -} - -type ListBucketsOutput struct { - _ struct{} `type:"structure"` - - // The list of buckets owned by the requestor. - Buckets []*Bucket `locationNameList:"Bucket" type:"list"` - - // The owner of the buckets listed. - Owner *Owner `type:"structure"` -} - -// String returns the string representation -func (s ListBucketsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketsOutput) GoString() string { - return s.String() -} - -// SetBuckets sets the Buckets field's value. -func (s *ListBucketsOutput) SetBuckets(v []*Bucket) *ListBucketsOutput { - s.Buckets = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *ListBucketsOutput) SetOwner(v *Owner) *ListBucketsOutput { - s.Owner = v - return s -} - -type ListMultipartUploadsInput struct { - _ struct{} `locationName:"ListMultipartUploadsRequest" type:"structure"` - - // Name of the bucket to which the multipart upload was initiated. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Character you use to group keys. - // - // All keys that contain the same string between the prefix, if specified, and - // the first occurrence of the delimiter after the prefix are grouped under - // a single result element, CommonPrefixes. If you don't specify the prefix - // parameter, then the substring starts at the beginning of the key. The keys - // that are grouped under CommonPrefixes result element are not returned elsewhere - // in the response. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // Together with upload-id-marker, this parameter specifies the multipart upload - // after which listing should begin. - // - // If upload-id-marker is not specified, only the keys lexicographically greater - // than the specified key-marker will be included in the list. - // - // If upload-id-marker is specified, any multipart uploads for a key equal to - // the key-marker might also be included, provided those multipart uploads have - // upload IDs lexicographically greater than the specified upload-id-marker. - KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` - - // Sets the maximum number of multipart uploads, from 1 to 1,000, to return - // in the response body. 1,000 is the maximum number of uploads that can be - // returned in a response. - MaxUploads *int64 `location:"querystring" locationName:"max-uploads" type:"integer"` - - // Lists in-progress uploads only for those keys that begin with the specified - // prefix. You can use prefixes to separate a bucket into different grouping - // of keys. (You can think of using prefix to make groups in the same way you'd - // use a folder in a file system.) - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Together with key-marker, specifies the multipart upload after which listing - // should begin. If key-marker is not specified, the upload-id-marker parameter - // is ignored. Otherwise, any multipart uploads for a key equal to the key-marker - // might be included in the list only if they have an upload ID lexicographically - // greater than the specified upload-id-marker. - UploadIdMarker *string `location:"querystring" locationName:"upload-id-marker" type:"string"` -} - -// String returns the string representation -func (s ListMultipartUploadsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListMultipartUploadsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListMultipartUploadsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListMultipartUploadsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListMultipartUploadsInput) SetBucket(v string) *ListMultipartUploadsInput { - s.Bucket = &v - return s -} - -func (s *ListMultipartUploadsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListMultipartUploadsInput) SetDelimiter(v string) *ListMultipartUploadsInput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListMultipartUploadsInput) SetEncodingType(v string) *ListMultipartUploadsInput { - s.EncodingType = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListMultipartUploadsInput) SetKeyMarker(v string) *ListMultipartUploadsInput { - s.KeyMarker = &v - return s -} - -// SetMaxUploads sets the MaxUploads field's value. -func (s *ListMultipartUploadsInput) SetMaxUploads(v int64) *ListMultipartUploadsInput { - s.MaxUploads = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListMultipartUploadsInput) SetPrefix(v string) *ListMultipartUploadsInput { - s.Prefix = &v - return s -} - -// SetUploadIdMarker sets the UploadIdMarker field's value. -func (s *ListMultipartUploadsInput) SetUploadIdMarker(v string) *ListMultipartUploadsInput { - s.UploadIdMarker = &v - return s -} - -func (s *ListMultipartUploadsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListMultipartUploadsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListMultipartUploadsOutput struct { - _ struct{} `type:"structure"` - - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `type:"string"` - - // If you specify a delimiter in the request, then the result returns each distinct - // key prefix containing the delimiter in a CommonPrefixes element. The distinct - // key prefixes are returned in the Prefix child element. - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - // Contains the delimiter you specified in the request. If you don't specify - // a delimiter in your request, this element is absent from the response. - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - // - // If you specify encoding-type request parameter, Amazon S3 includes this element - // in the response, and returns encoded key name values in the following response - // elements: - // - // Delimiter, KeyMarker, Prefix, NextKeyMarker, Key. - EncodingType *string `type:"string" enum:"EncodingType"` - - // Indicates whether the returned list of multipart uploads is truncated. A - // value of true indicates that the list was truncated. The list can be truncated - // if the number of multipart uploads exceeds the limit allowed or specified - // by max uploads. - IsTruncated *bool `type:"boolean"` - - // The key at or after which the listing began. - KeyMarker *string `type:"string"` - - // Maximum number of multipart uploads that could have been included in the - // response. - MaxUploads *int64 `type:"integer"` - - // When a list is truncated, this element specifies the value that should be - // used for the key-marker request parameter in a subsequent request. - NextKeyMarker *string `type:"string"` - - // When a list is truncated, this element specifies the value that should be - // used for the upload-id-marker request parameter in a subsequent request. - NextUploadIdMarker *string `type:"string"` - - // When a prefix is provided in the request, this field contains the specified - // prefix. The result contains only keys starting with the specified prefix. - Prefix *string `type:"string"` - - // Upload ID after which listing began. - UploadIdMarker *string `type:"string"` - - // Container for elements related to a particular multipart upload. A response - // can contain zero or more Upload elements. - Uploads []*MultipartUpload `locationName:"Upload" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s ListMultipartUploadsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListMultipartUploadsOutput) GoString() string { - return s.String() -} - -// SetBucket sets the Bucket field's value. -func (s *ListMultipartUploadsOutput) SetBucket(v string) *ListMultipartUploadsOutput { - s.Bucket = &v - return s -} - -func (s *ListMultipartUploadsOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListMultipartUploadsOutput) SetCommonPrefixes(v []*CommonPrefix) *ListMultipartUploadsOutput { - s.CommonPrefixes = v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListMultipartUploadsOutput) SetDelimiter(v string) *ListMultipartUploadsOutput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListMultipartUploadsOutput) SetEncodingType(v string) *ListMultipartUploadsOutput { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListMultipartUploadsOutput) SetIsTruncated(v bool) *ListMultipartUploadsOutput { - s.IsTruncated = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListMultipartUploadsOutput) SetKeyMarker(v string) *ListMultipartUploadsOutput { - s.KeyMarker = &v - return s -} - -// SetMaxUploads sets the MaxUploads field's value. -func (s *ListMultipartUploadsOutput) SetMaxUploads(v int64) *ListMultipartUploadsOutput { - s.MaxUploads = &v - return s -} - -// SetNextKeyMarker sets the NextKeyMarker field's value. -func (s *ListMultipartUploadsOutput) SetNextKeyMarker(v string) *ListMultipartUploadsOutput { - s.NextKeyMarker = &v - return s -} - -// SetNextUploadIdMarker sets the NextUploadIdMarker field's value. -func (s *ListMultipartUploadsOutput) SetNextUploadIdMarker(v string) *ListMultipartUploadsOutput { - s.NextUploadIdMarker = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListMultipartUploadsOutput) SetPrefix(v string) *ListMultipartUploadsOutput { - s.Prefix = &v - return s -} - -// SetUploadIdMarker sets the UploadIdMarker field's value. -func (s *ListMultipartUploadsOutput) SetUploadIdMarker(v string) *ListMultipartUploadsOutput { - s.UploadIdMarker = &v - return s -} - -// SetUploads sets the Uploads field's value. -func (s *ListMultipartUploadsOutput) SetUploads(v []*MultipartUpload) *ListMultipartUploadsOutput { - s.Uploads = v - return s -} - -type ListObjectVersionsInput struct { - _ struct{} `locationName:"ListObjectVersionsRequest" type:"structure"` - - // The bucket name that contains the objects. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A delimiter is a character that you specify to group keys. All keys that - // contain the same string between the prefix and the first occurrence of the - // delimiter are grouped under a single result element in CommonPrefixes. These - // groups are counted as one result against the max-keys limitation. These keys - // are not returned elsewhere in the response. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // Specifies the key to start with when listing objects in a bucket. - KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` - - // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys - // but will never contain more. If additional keys satisfy the search criteria, - // but were not returned because max-keys was exceeded, the response contains - // true. To return the additional keys, see key-marker - // and version-id-marker. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Use this parameter to select only those keys that begin with the specified - // prefix. You can use prefixes to separate a bucket into different groupings - // of keys. (You can think of using prefix to make groups in the same way you'd - // use a folder in a file system.) You can use prefix with delimiter to roll - // up numerous objects into a single result under CommonPrefixes. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Specifies the object version you want to start listing from. - VersionIdMarker *string `location:"querystring" locationName:"version-id-marker" type:"string"` -} - -// String returns the string representation -func (s ListObjectVersionsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectVersionsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListObjectVersionsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListObjectVersionsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListObjectVersionsInput) SetBucket(v string) *ListObjectVersionsInput { - s.Bucket = &v - return s -} - -func (s *ListObjectVersionsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectVersionsInput) SetDelimiter(v string) *ListObjectVersionsInput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectVersionsInput) SetEncodingType(v string) *ListObjectVersionsInput { - s.EncodingType = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListObjectVersionsInput) SetKeyMarker(v string) *ListObjectVersionsInput { - s.KeyMarker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectVersionsInput) SetMaxKeys(v int64) *ListObjectVersionsInput { - s.MaxKeys = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectVersionsInput) SetPrefix(v string) *ListObjectVersionsInput { - s.Prefix = &v - return s -} - -// SetVersionIdMarker sets the VersionIdMarker field's value. -func (s *ListObjectVersionsInput) SetVersionIdMarker(v string) *ListObjectVersionsInput { - s.VersionIdMarker = &v - return s -} - -func (s *ListObjectVersionsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListObjectVersionsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListObjectVersionsOutput struct { - _ struct{} `type:"structure"` - - // All of the keys rolled up into a common prefix count as a single return when - // calculating the number of returns. - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - // Container for an object that is a delete marker. - DeleteMarkers []*DeleteMarkerEntry `locationName:"DeleteMarker" type:"list" flattened:"true"` - - // The delimiter grouping the included keys. A delimiter is a character that - // you specify to group keys. All keys that contain the same string between - // the prefix and the first occurrence of the delimiter are grouped under a - // single result element in CommonPrefixes. These groups are counted as one - // result against the max-keys limitation. These keys are not returned elsewhere - // in the response. - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object key names in the XML response. - // - // If you specify encoding-type request parameter, Amazon S3 includes this element - // in the response, and returns encoded key name values in the following response - // elements: - // - // KeyMarker, NextKeyMarker, Prefix, Key, and Delimiter. - EncodingType *string `type:"string" enum:"EncodingType"` - - // A flag that indicates whether Amazon S3 returned all of the results that - // satisfied the search criteria. If your results were truncated, you can make - // a follow-up paginated request using the NextKeyMarker and NextVersionIdMarker - // response parameters as a starting place in another request to return the - // rest of the results. - IsTruncated *bool `type:"boolean"` - - // Marks the last key returned in a truncated response. - KeyMarker *string `type:"string"` - - // Specifies the maximum number of objects to return. - MaxKeys *int64 `type:"integer"` - - // Bucket name. - Name *string `type:"string"` - - // When the number of responses exceeds the value of MaxKeys, NextKeyMarker - // specifies the first key not returned that satisfies the search criteria. - // Use this value for the key-marker request parameter in a subsequent request. - NextKeyMarker *string `type:"string"` - - // When the number of responses exceeds the value of MaxKeys, NextVersionIdMarker - // specifies the first object version not returned that satisfies the search - // criteria. Use this value for the version-id-marker request parameter in a - // subsequent request. - NextVersionIdMarker *string `type:"string"` - - // Selects objects that start with the value supplied by this parameter. - Prefix *string `type:"string"` - - // Marks the last version of the key returned in a truncated response. - VersionIdMarker *string `type:"string"` - - // Container for version information. - Versions []*ObjectVersion `locationName:"Version" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s ListObjectVersionsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectVersionsOutput) GoString() string { - return s.String() -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListObjectVersionsOutput) SetCommonPrefixes(v []*CommonPrefix) *ListObjectVersionsOutput { - s.CommonPrefixes = v - return s -} - -// SetDeleteMarkers sets the DeleteMarkers field's value. -func (s *ListObjectVersionsOutput) SetDeleteMarkers(v []*DeleteMarkerEntry) *ListObjectVersionsOutput { - s.DeleteMarkers = v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectVersionsOutput) SetDelimiter(v string) *ListObjectVersionsOutput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectVersionsOutput) SetEncodingType(v string) *ListObjectVersionsOutput { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListObjectVersionsOutput) SetIsTruncated(v bool) *ListObjectVersionsOutput { - s.IsTruncated = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListObjectVersionsOutput) SetKeyMarker(v string) *ListObjectVersionsOutput { - s.KeyMarker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectVersionsOutput) SetMaxKeys(v int64) *ListObjectVersionsOutput { - s.MaxKeys = &v - return s -} - -// SetName sets the Name field's value. -func (s *ListObjectVersionsOutput) SetName(v string) *ListObjectVersionsOutput { - s.Name = &v - return s -} - -// SetNextKeyMarker sets the NextKeyMarker field's value. -func (s *ListObjectVersionsOutput) SetNextKeyMarker(v string) *ListObjectVersionsOutput { - s.NextKeyMarker = &v - return s -} - -// SetNextVersionIdMarker sets the NextVersionIdMarker field's value. -func (s *ListObjectVersionsOutput) SetNextVersionIdMarker(v string) *ListObjectVersionsOutput { - s.NextVersionIdMarker = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectVersionsOutput) SetPrefix(v string) *ListObjectVersionsOutput { - s.Prefix = &v - return s -} - -// SetVersionIdMarker sets the VersionIdMarker field's value. -func (s *ListObjectVersionsOutput) SetVersionIdMarker(v string) *ListObjectVersionsOutput { - s.VersionIdMarker = &v - return s -} - -// SetVersions sets the Versions field's value. -func (s *ListObjectVersionsOutput) SetVersions(v []*ObjectVersion) *ListObjectVersionsOutput { - s.Versions = v - return s -} - -type ListObjectsInput struct { - _ struct{} `locationName:"ListObjectsRequest" type:"structure"` - - // The name of the bucket containing the objects. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // Specifies the key to start with when listing objects in a bucket. - Marker *string `location:"querystring" locationName:"marker" type:"string"` - - // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys - // but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // list objects request. Bucket owners need not specify this parameter in their - // requests. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` -} - -// String returns the string representation -func (s ListObjectsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListObjectsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListObjectsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListObjectsInput) SetBucket(v string) *ListObjectsInput { - s.Bucket = &v - return s -} - -func (s *ListObjectsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsInput) SetDelimiter(v string) *ListObjectsInput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsInput) SetEncodingType(v string) *ListObjectsInput { - s.EncodingType = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListObjectsInput) SetMarker(v string) *ListObjectsInput { - s.Marker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsInput) SetMaxKeys(v int64) *ListObjectsInput { - s.MaxKeys = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsInput) SetPrefix(v string) *ListObjectsInput { - s.Prefix = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *ListObjectsInput) SetRequestPayer(v string) *ListObjectsInput { - s.RequestPayer = &v - return s -} - -func (s *ListObjectsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListObjectsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListObjectsOutput struct { - _ struct{} `type:"structure"` - - // All of the keys rolled up in a common prefix count as a single return when - // calculating the number of returns. - // - // A response can contain CommonPrefixes only if you specify a delimiter. - // - // CommonPrefixes contains all (if there are any) keys between Prefix and the - // next occurrence of the string specified by the delimiter. - // - // CommonPrefixes lists keys that act like subdirectories in the directory specified - // by Prefix. - // - // For example, if the prefix is notes/ and the delimiter is a slash (/) as - // in notes/summer/july, the common prefix is notes/summer/. All of the keys - // that roll up into a common prefix count as a single return when calculating - // the number of returns. - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - // Metadata about each object returned. - Contents []*Object `type:"list" flattened:"true"` - - // Causes keys that contain the same string between the prefix and the first - // occurrence of the delimiter to be rolled up into a single result element - // in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere - // in the response. Each rolled-up result counts as only one return against - // the MaxKeys value. - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string" enum:"EncodingType"` - - // A flag that indicates whether Amazon S3 returned all of the results that - // satisfied the search criteria. - IsTruncated *bool `type:"boolean"` - - // Indicates where in the bucket listing begins. Marker is included in the response - // if it was sent with the request. - Marker *string `type:"string"` - - // The maximum number of keys returned in the response body. - MaxKeys *int64 `type:"integer"` - - // Bucket name. - Name *string `type:"string"` - - // When response is truncated (the IsTruncated element value in the response - // is true), you can use the key name in this field as marker in the subsequent - // request to get next set of objects. Amazon S3 lists objects in alphabetical - // order Note: This element is returned only if you have delimiter request parameter - // specified. If response does not include the NextMaker and it is truncated, - // you can use the value of the last Key in the response as the marker in the - // subsequent request to get the next set of object keys. - NextMarker *string `type:"string"` - - // Keys that begin with the indicated prefix. - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s ListObjectsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsOutput) GoString() string { - return s.String() -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListObjectsOutput) SetCommonPrefixes(v []*CommonPrefix) *ListObjectsOutput { - s.CommonPrefixes = v - return s -} - -// SetContents sets the Contents field's value. -func (s *ListObjectsOutput) SetContents(v []*Object) *ListObjectsOutput { - s.Contents = v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsOutput) SetDelimiter(v string) *ListObjectsOutput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsOutput) SetEncodingType(v string) *ListObjectsOutput { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListObjectsOutput) SetIsTruncated(v bool) *ListObjectsOutput { - s.IsTruncated = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListObjectsOutput) SetMarker(v string) *ListObjectsOutput { - s.Marker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsOutput) SetMaxKeys(v int64) *ListObjectsOutput { - s.MaxKeys = &v - return s -} - -// SetName sets the Name field's value. -func (s *ListObjectsOutput) SetName(v string) *ListObjectsOutput { - s.Name = &v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListObjectsOutput) SetNextMarker(v string) *ListObjectsOutput { - s.NextMarker = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsOutput) SetPrefix(v string) *ListObjectsOutput { - s.Prefix = &v - return s -} - -type ListObjectsV2Input struct { - _ struct{} `locationName:"ListObjectsV2Request" type:"structure"` - - // Bucket name to list. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // ContinuationToken indicates Amazon S3 that the list is being continued on - // this bucket with a token. ContinuationToken is obfuscated and is not a real - // key. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // The owner field is not present in listV2 by default, if you want to return - // owner field with each key in the result then set the fetch owner field to - // true. - FetchOwner *bool `location:"querystring" locationName:"fetch-owner" type:"boolean"` - - // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys - // but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // list objects request in V2 style. Bucket owners need not specify this parameter - // in their requests. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts - // listing after this specified key. StartAfter can be any key in the bucket. - StartAfter *string `location:"querystring" locationName:"start-after" type:"string"` -} - -// String returns the string representation -func (s ListObjectsV2Input) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsV2Input) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListObjectsV2Input) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListObjectsV2Input"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListObjectsV2Input) SetBucket(v string) *ListObjectsV2Input { - s.Bucket = &v - return s -} - -func (s *ListObjectsV2Input) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListObjectsV2Input) SetContinuationToken(v string) *ListObjectsV2Input { - s.ContinuationToken = &v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsV2Input) SetDelimiter(v string) *ListObjectsV2Input { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsV2Input) SetEncodingType(v string) *ListObjectsV2Input { - s.EncodingType = &v - return s -} - -// SetFetchOwner sets the FetchOwner field's value. -func (s *ListObjectsV2Input) SetFetchOwner(v bool) *ListObjectsV2Input { - s.FetchOwner = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsV2Input) SetMaxKeys(v int64) *ListObjectsV2Input { - s.MaxKeys = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsV2Input) SetPrefix(v string) *ListObjectsV2Input { - s.Prefix = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *ListObjectsV2Input) SetRequestPayer(v string) *ListObjectsV2Input { - s.RequestPayer = &v - return s -} - -// SetStartAfter sets the StartAfter field's value. -func (s *ListObjectsV2Input) SetStartAfter(v string) *ListObjectsV2Input { - s.StartAfter = &v - return s -} - -func (s *ListObjectsV2Input) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListObjectsV2Input) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListObjectsV2Output struct { - _ struct{} `type:"structure"` - - // All of the keys rolled up into a common prefix count as a single return when - // calculating the number of returns. - // - // A response can contain CommonPrefixes only if you specify a delimiter. - // - // CommonPrefixes contains all (if there are any) keys between Prefix and the - // next occurrence of the string specified by a delimiter. - // - // CommonPrefixes lists keys that act like subdirectories in the directory specified - // by Prefix. - // - // For example, if the prefix is notes/ and the delimiter is a slash (/) as - // in notes/summer/july, the common prefix is notes/summer/. All of the keys - // that roll up into a common prefix count as a single return when calculating - // the number of returns. - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - // Metadata about each object returned. - Contents []*Object `type:"list" flattened:"true"` - - // If ContinuationToken was sent with the request, it is included in the response. - ContinuationToken *string `type:"string"` - - // Causes keys that contain the same string between the prefix and the first - // occurrence of the delimiter to be rolled up into a single result element - // in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere - // in the response. Each rolled-up result counts as only one return against - // the MaxKeys value. - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object key names in the XML response. - // - // If you specify the encoding-type request parameter, Amazon S3 includes this - // element in the response, and returns encoded key name values in the following - // response elements: - // - // Delimiter, Prefix, Key, and StartAfter. - EncodingType *string `type:"string" enum:"EncodingType"` - - // Set to false if all of the results were returned. Set to true if more keys - // are available to return. If the number of results exceeds that specified - // by MaxKeys, all of the results might not be returned. - IsTruncated *bool `type:"boolean"` - - // KeyCount is the number of keys returned with this request. KeyCount will - // always be less than equals to MaxKeys field. Say you ask for 50 keys, your - // result will include less than equals 50 keys - KeyCount *int64 `type:"integer"` - - // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys - // but will never contain more. - MaxKeys *int64 `type:"integer"` - - // Bucket name. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - Name *string `type:"string"` - - // NextContinuationToken is sent when isTruncated is true, which means there - // are more keys in the bucket that can be listed. The next list requests to - // Amazon S3 can be continued with this NextContinuationToken. NextContinuationToken - // is obfuscated and is not a real key - NextContinuationToken *string `type:"string"` - - // Keys that begin with the indicated prefix. - Prefix *string `type:"string"` - - // If StartAfter was sent with the request, it is included in the response. - StartAfter *string `type:"string"` -} - -// String returns the string representation -func (s ListObjectsV2Output) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsV2Output) GoString() string { - return s.String() -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListObjectsV2Output) SetCommonPrefixes(v []*CommonPrefix) *ListObjectsV2Output { - s.CommonPrefixes = v - return s -} - -// SetContents sets the Contents field's value. -func (s *ListObjectsV2Output) SetContents(v []*Object) *ListObjectsV2Output { - s.Contents = v - return s -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListObjectsV2Output) SetContinuationToken(v string) *ListObjectsV2Output { - s.ContinuationToken = &v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsV2Output) SetDelimiter(v string) *ListObjectsV2Output { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsV2Output) SetEncodingType(v string) *ListObjectsV2Output { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListObjectsV2Output) SetIsTruncated(v bool) *ListObjectsV2Output { - s.IsTruncated = &v - return s -} - -// SetKeyCount sets the KeyCount field's value. -func (s *ListObjectsV2Output) SetKeyCount(v int64) *ListObjectsV2Output { - s.KeyCount = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsV2Output) SetMaxKeys(v int64) *ListObjectsV2Output { - s.MaxKeys = &v - return s -} - -// SetName sets the Name field's value. -func (s *ListObjectsV2Output) SetName(v string) *ListObjectsV2Output { - s.Name = &v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListObjectsV2Output) SetNextContinuationToken(v string) *ListObjectsV2Output { - s.NextContinuationToken = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsV2Output) SetPrefix(v string) *ListObjectsV2Output { - s.Prefix = &v - return s -} - -// SetStartAfter sets the StartAfter field's value. -func (s *ListObjectsV2Output) SetStartAfter(v string) *ListObjectsV2Output { - s.StartAfter = &v - return s -} - -type ListPartsInput struct { - _ struct{} `locationName:"ListPartsRequest" type:"structure"` - - // Name of the bucket to which the parts are being uploaded. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Object key for which the multipart upload was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Sets the maximum number of parts to return. - MaxParts *int64 `location:"querystring" locationName:"max-parts" type:"integer"` - - // Specifies the part after which listing should begin. Only parts with higher - // part numbers will be listed. - PartNumberMarker *int64 `location:"querystring" locationName:"part-number-marker" type:"integer"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Upload ID identifying the multipart upload whose parts are being listed. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s ListPartsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPartsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListPartsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListPartsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListPartsInput) SetBucket(v string) *ListPartsInput { - s.Bucket = &v - return s -} - -func (s *ListPartsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *ListPartsInput) SetKey(v string) *ListPartsInput { - s.Key = &v - return s -} - -// SetMaxParts sets the MaxParts field's value. -func (s *ListPartsInput) SetMaxParts(v int64) *ListPartsInput { - s.MaxParts = &v - return s -} - -// SetPartNumberMarker sets the PartNumberMarker field's value. -func (s *ListPartsInput) SetPartNumberMarker(v int64) *ListPartsInput { - s.PartNumberMarker = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *ListPartsInput) SetRequestPayer(v string) *ListPartsInput { - s.RequestPayer = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *ListPartsInput) SetUploadId(v string) *ListPartsInput { - s.UploadId = &v - return s -} - -func (s *ListPartsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *ListPartsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type ListPartsOutput struct { - _ struct{} `type:"structure"` - - // If the bucket has a lifecycle rule configured with an action to abort incomplete - // multipart uploads and the prefix in the lifecycle rule matches the object - // name in the request, then the response includes this header indicating when - // the initiated multipart upload will become eligible for abort operation. - // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket - // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config). - // - // The response will also include the x-amz-abort-rule-id header that will provide - // the ID of the lifecycle configuration rule that defines this action. - AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp"` - - // This header is returned along with the x-amz-abort-date header. It identifies - // applicable lifecycle configuration rule that defines the action to abort - // incomplete multipart uploads. - AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` - - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `type:"string"` - - // Container element that identifies who initiated the multipart upload. If - // the initiator is an AWS account, this element provides the same information - // as the Owner element. If the initiator is an IAM User, this element provides - // the user ARN and display name. - Initiator *Initiator `type:"structure"` - - // Indicates whether the returned list of parts is truncated. A true value indicates - // that the list was truncated. A list can be truncated if the number of parts - // exceeds the limit returned in the MaxParts element. - IsTruncated *bool `type:"boolean"` - - // Object key for which the multipart upload was initiated. - Key *string `min:"1" type:"string"` - - // Maximum number of parts that were allowed in the response. - MaxParts *int64 `type:"integer"` - - // When a list is truncated, this element specifies the last part in the list, - // as well as the value to use for the part-number-marker request parameter - // in a subsequent request. - NextPartNumberMarker *int64 `type:"integer"` - - // Container element that identifies the object owner, after the object is created. - // If multipart upload is initiated by an IAM user, this element provides the - // parent account ID and display name. - Owner *Owner `type:"structure"` - - // When a list is truncated, this element specifies the last part in the list, - // as well as the value to use for the part-number-marker request parameter - // in a subsequent request. - PartNumberMarker *int64 `type:"integer"` - - // Container for elements related to a particular part. A response can contain - // zero or more Part elements. - Parts []*Part `locationName:"Part" type:"list" flattened:"true"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Class of storage (STANDARD or REDUCED_REDUNDANCY) used to store the uploaded - // object. - StorageClass *string `type:"string" enum:"StorageClass"` - - // Upload ID identifying the multipart upload whose parts are being listed. - UploadId *string `type:"string"` -} - -// String returns the string representation -func (s ListPartsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPartsOutput) GoString() string { - return s.String() -} - -// SetAbortDate sets the AbortDate field's value. -func (s *ListPartsOutput) SetAbortDate(v time.Time) *ListPartsOutput { - s.AbortDate = &v - return s -} - -// SetAbortRuleId sets the AbortRuleId field's value. -func (s *ListPartsOutput) SetAbortRuleId(v string) *ListPartsOutput { - s.AbortRuleId = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *ListPartsOutput) SetBucket(v string) *ListPartsOutput { - s.Bucket = &v - return s -} - -func (s *ListPartsOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetInitiator sets the Initiator field's value. -func (s *ListPartsOutput) SetInitiator(v *Initiator) *ListPartsOutput { - s.Initiator = v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListPartsOutput) SetIsTruncated(v bool) *ListPartsOutput { - s.IsTruncated = &v - return s -} - -// SetKey sets the Key field's value. -func (s *ListPartsOutput) SetKey(v string) *ListPartsOutput { - s.Key = &v - return s -} - -// SetMaxParts sets the MaxParts field's value. -func (s *ListPartsOutput) SetMaxParts(v int64) *ListPartsOutput { - s.MaxParts = &v - return s -} - -// SetNextPartNumberMarker sets the NextPartNumberMarker field's value. -func (s *ListPartsOutput) SetNextPartNumberMarker(v int64) *ListPartsOutput { - s.NextPartNumberMarker = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *ListPartsOutput) SetOwner(v *Owner) *ListPartsOutput { - s.Owner = v - return s -} - -// SetPartNumberMarker sets the PartNumberMarker field's value. -func (s *ListPartsOutput) SetPartNumberMarker(v int64) *ListPartsOutput { - s.PartNumberMarker = &v - return s -} - -// SetParts sets the Parts field's value. -func (s *ListPartsOutput) SetParts(v []*Part) *ListPartsOutput { - s.Parts = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *ListPartsOutput) SetRequestCharged(v string) *ListPartsOutput { - s.RequestCharged = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *ListPartsOutput) SetStorageClass(v string) *ListPartsOutput { - s.StorageClass = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *ListPartsOutput) SetUploadId(v string) *ListPartsOutput { - s.UploadId = &v - return s -} - -// Describes an Amazon S3 location that will receive the results of the restore -// request. -type Location struct { - _ struct{} `type:"structure"` - - // A list of grants that control access to the staged results. - AccessControlList []*Grant `locationNameList:"Grant" type:"list"` - - // The name of the bucket where the restore results will be placed. - // - // BucketName is a required field - BucketName *string `type:"string" required:"true"` - - // The canned ACL to apply to the restore results. - CannedACL *string `type:"string" enum:"ObjectCannedACL"` - - // Contains the type of server-side encryption used. - Encryption *Encryption `type:"structure"` - - // The prefix that is prepended to the restore results for this request. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` - - // The class of storage used to store the restore results. - StorageClass *string `type:"string" enum:"StorageClass"` - - // The tag-set that is applied to the restore results. - Tagging *Tagging `type:"structure"` - - // A list of metadata to store with the restore results in S3. - UserMetadata []*MetadataEntry `locationNameList:"MetadataEntry" type:"list"` -} - -// String returns the string representation -func (s Location) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Location) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Location) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Location"} - if s.BucketName == nil { - invalidParams.Add(request.NewErrParamRequired("BucketName")) - } - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - if s.AccessControlList != nil { - for i, v := range s.AccessControlList { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "AccessControlList", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Encryption != nil { - if err := s.Encryption.Validate(); err != nil { - invalidParams.AddNested("Encryption", err.(request.ErrInvalidParams)) - } - } - if s.Tagging != nil { - if err := s.Tagging.Validate(); err != nil { - invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessControlList sets the AccessControlList field's value. -func (s *Location) SetAccessControlList(v []*Grant) *Location { - s.AccessControlList = v - return s -} - -// SetBucketName sets the BucketName field's value. -func (s *Location) SetBucketName(v string) *Location { - s.BucketName = &v - return s -} - -// SetCannedACL sets the CannedACL field's value. -func (s *Location) SetCannedACL(v string) *Location { - s.CannedACL = &v - return s -} - -// SetEncryption sets the Encryption field's value. -func (s *Location) SetEncryption(v *Encryption) *Location { - s.Encryption = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *Location) SetPrefix(v string) *Location { - s.Prefix = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Location) SetStorageClass(v string) *Location { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *Location) SetTagging(v *Tagging) *Location { - s.Tagging = v - return s -} - -// SetUserMetadata sets the UserMetadata field's value. -func (s *Location) SetUserMetadata(v []*MetadataEntry) *Location { - s.UserMetadata = v - return s -} - -// Describes where logs are stored and the prefix that Amazon S3 assigns to -// all log object keys for a bucket. For more information, see PUT Bucket logging -// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) -// in the Amazon Simple Storage Service API Reference. -type LoggingEnabled struct { - _ struct{} `type:"structure"` - - // Specifies the bucket where you want Amazon S3 to store server access logs. - // You can have your logs delivered to any bucket that you own, including the - // same bucket that is being logged. You can also configure multiple buckets - // to deliver their logs to the same target bucket. In this case, you should - // choose a different TargetPrefix for each source bucket so that the delivered - // log files can be distinguished by key. - // - // TargetBucket is a required field - TargetBucket *string `type:"string" required:"true"` - - // Container for granting information. - TargetGrants []*TargetGrant `locationNameList:"Grant" type:"list"` - - // A prefix for all log object keys. If you store log files from multiple Amazon - // S3 buckets in a single bucket, you can use a prefix to distinguish which - // log files came from which bucket. - // - // TargetPrefix is a required field - TargetPrefix *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s LoggingEnabled) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LoggingEnabled) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LoggingEnabled) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LoggingEnabled"} - if s.TargetBucket == nil { - invalidParams.Add(request.NewErrParamRequired("TargetBucket")) - } - if s.TargetPrefix == nil { - invalidParams.Add(request.NewErrParamRequired("TargetPrefix")) - } - if s.TargetGrants != nil { - for i, v := range s.TargetGrants { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TargetGrants", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetBucket sets the TargetBucket field's value. -func (s *LoggingEnabled) SetTargetBucket(v string) *LoggingEnabled { - s.TargetBucket = &v - return s -} - -// SetTargetGrants sets the TargetGrants field's value. -func (s *LoggingEnabled) SetTargetGrants(v []*TargetGrant) *LoggingEnabled { - s.TargetGrants = v - return s -} - -// SetTargetPrefix sets the TargetPrefix field's value. -func (s *LoggingEnabled) SetTargetPrefix(v string) *LoggingEnabled { - s.TargetPrefix = &v - return s -} - -// A metadata key-value pair to store with an object. -type MetadataEntry struct { - _ struct{} `type:"structure"` - - // Name of the Object. - Name *string `type:"string"` - - // Value of the Object. - Value *string `type:"string"` -} - -// String returns the string representation -func (s MetadataEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetadataEntry) GoString() string { - return s.String() -} - -// SetName sets the Name field's value. -func (s *MetadataEntry) SetName(v string) *MetadataEntry { - s.Name = &v - return s -} - -// SetValue sets the Value field's value. -func (s *MetadataEntry) SetValue(v string) *MetadataEntry { - s.Value = &v - return s -} - -// A container specifying replication metrics-related settings enabling metrics -// and Amazon S3 events for S3 Replication Time Control (S3 RTC). Must be specified -// together with a ReplicationTime block. -type Metrics struct { - _ struct{} `type:"structure"` - - // A container specifying the time threshold for emitting the s3:Replication:OperationMissedThreshold - // event. - // - // EventThreshold is a required field - EventThreshold *ReplicationTimeValue `type:"structure" required:"true"` - - // Specifies whether the replication metrics are enabled. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"MetricsStatus"` -} - -// String returns the string representation -func (s Metrics) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Metrics) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Metrics) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Metrics"} - if s.EventThreshold == nil { - invalidParams.Add(request.NewErrParamRequired("EventThreshold")) - } - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEventThreshold sets the EventThreshold field's value. -func (s *Metrics) SetEventThreshold(v *ReplicationTimeValue) *Metrics { - s.EventThreshold = v - return s -} - -// SetStatus sets the Status field's value. -func (s *Metrics) SetStatus(v string) *Metrics { - s.Status = &v - return s -} - -// A conjunction (logical AND) of predicates, which is used in evaluating a -// metrics filter. The operator must have at least two predicates, and an object -// must match all of the predicates in order for the filter to apply. -type MetricsAndOperator struct { - _ struct{} `type:"structure"` - - // The prefix used when evaluating an AND predicate. - Prefix *string `type:"string"` - - // The list of tags used when evaluating an AND predicate. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s MetricsAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetricsAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricsAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricsAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *MetricsAndOperator) SetPrefix(v string) *MetricsAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *MetricsAndOperator) SetTags(v []*Tag) *MetricsAndOperator { - s.Tags = v - return s -} - -// Specifies a metrics configuration for the CloudWatch request metrics (specified -// by the metrics configuration ID) from an Amazon S3 bucket. If you're updating -// an existing metrics configuration, note that this is a full replacement of -// the existing metrics configuration. If you don't include the elements you -// want to keep, they are erased. For more information, see PUT Bucket metrics -// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html) -// in the Amazon Simple Storage Service API Reference. -type MetricsConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies a metrics configuration filter. The metrics configuration will - // only include objects that meet the filter's criteria. A filter must be a - // prefix, a tag, or a conjunction (MetricsAndOperator). - Filter *MetricsFilter `type:"structure"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s MetricsConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetricsConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricsConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricsConfiguration"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFilter sets the Filter field's value. -func (s *MetricsConfiguration) SetFilter(v *MetricsFilter) *MetricsConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *MetricsConfiguration) SetId(v string) *MetricsConfiguration { - s.Id = &v - return s -} - -// Specifies a metrics configuration filter. The metrics configuration only -// includes objects that meet the filter's criteria. A filter must be a prefix, -// a tag, or a conjunction (MetricsAndOperator). -type MetricsFilter struct { - _ struct{} `type:"structure"` - - // A conjunction (logical AND) of predicates, which is used in evaluating a - // metrics filter. The operator must have at least two predicates, and an object - // must match all of the predicates in order for the filter to apply. - And *MetricsAndOperator `type:"structure"` - - // The prefix used when evaluating a metrics filter. - Prefix *string `type:"string"` - - // The tag used when evaluating a metrics filter. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s MetricsFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetricsFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricsFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricsFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *MetricsFilter) SetAnd(v *MetricsAndOperator) *MetricsFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *MetricsFilter) SetPrefix(v string) *MetricsFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *MetricsFilter) SetTag(v *Tag) *MetricsFilter { - s.Tag = v - return s -} - -// Container for the MultipartUpload for the Amazon S3 object. -type MultipartUpload struct { - _ struct{} `type:"structure"` - - // Date and time at which the multipart upload was initiated. - Initiated *time.Time `type:"timestamp"` - - // Identifies who initiated the multipart upload. - Initiator *Initiator `type:"structure"` - - // Key of the object for which the multipart upload was initiated. - Key *string `min:"1" type:"string"` - - // Specifies the owner of the object that is part of the multipart upload. - Owner *Owner `type:"structure"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"StorageClass"` - - // Upload ID that identifies the multipart upload. - UploadId *string `type:"string"` -} - -// String returns the string representation -func (s MultipartUpload) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MultipartUpload) GoString() string { - return s.String() -} - -// SetInitiated sets the Initiated field's value. -func (s *MultipartUpload) SetInitiated(v time.Time) *MultipartUpload { - s.Initiated = &v - return s -} - -// SetInitiator sets the Initiator field's value. -func (s *MultipartUpload) SetInitiator(v *Initiator) *MultipartUpload { - s.Initiator = v - return s -} - -// SetKey sets the Key field's value. -func (s *MultipartUpload) SetKey(v string) *MultipartUpload { - s.Key = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *MultipartUpload) SetOwner(v *Owner) *MultipartUpload { - s.Owner = v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *MultipartUpload) SetStorageClass(v string) *MultipartUpload { - s.StorageClass = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *MultipartUpload) SetUploadId(v string) *MultipartUpload { - s.UploadId = &v - return s -} - -// Specifies when noncurrent object versions expire. Upon expiration, Amazon -// S3 permanently deletes the noncurrent object versions. You set this lifecycle -// configuration action on a bucket that has versioning enabled (or suspended) -// to request that Amazon S3 delete noncurrent object versions at a specific -// period in the object's lifetime. -type NoncurrentVersionExpiration struct { - _ struct{} `type:"structure"` - - // Specifies the number of days an object is noncurrent before Amazon S3 can - // perform the associated action. For information about the noncurrent days - // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) - // in the Amazon Simple Storage Service Developer Guide. - NoncurrentDays *int64 `type:"integer"` -} - -// String returns the string representation -func (s NoncurrentVersionExpiration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NoncurrentVersionExpiration) GoString() string { - return s.String() -} - -// SetNoncurrentDays sets the NoncurrentDays field's value. -func (s *NoncurrentVersionExpiration) SetNoncurrentDays(v int64) *NoncurrentVersionExpiration { - s.NoncurrentDays = &v - return s -} - -// Container for the transition rule that describes when noncurrent objects -// transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, -// or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning -// is suspended), you can set this action to request that Amazon S3 transition -// noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, -// GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's -// lifetime. -type NoncurrentVersionTransition struct { - _ struct{} `type:"structure"` - - // Specifies the number of days an object is noncurrent before Amazon S3 can - // perform the associated action. For information about the noncurrent days - // calculations, see How Amazon S3 Calculates How Long an Object Has Been Noncurrent - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) - // in the Amazon Simple Storage Service Developer Guide. - NoncurrentDays *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"TransitionStorageClass"` -} - -// String returns the string representation -func (s NoncurrentVersionTransition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NoncurrentVersionTransition) GoString() string { - return s.String() -} - -// SetNoncurrentDays sets the NoncurrentDays field's value. -func (s *NoncurrentVersionTransition) SetNoncurrentDays(v int64) *NoncurrentVersionTransition { - s.NoncurrentDays = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *NoncurrentVersionTransition) SetStorageClass(v string) *NoncurrentVersionTransition { - s.StorageClass = &v - return s -} - -// A container for specifying the notification configuration of the bucket. -// If this element is empty, notifications are turned off for the bucket. -type NotificationConfiguration struct { - _ struct{} `type:"structure"` - - // Describes the AWS Lambda functions to invoke and the events for which to - // invoke them. - LambdaFunctionConfigurations []*LambdaFunctionConfiguration `locationName:"CloudFunctionConfiguration" type:"list" flattened:"true"` - - // The Amazon Simple Queue Service queues to publish messages to and the events - // for which to publish messages. - QueueConfigurations []*QueueConfiguration `locationName:"QueueConfiguration" type:"list" flattened:"true"` - - // The topic to which notifications are sent and the events for which notifications - // are generated. - TopicConfigurations []*TopicConfiguration `locationName:"TopicConfiguration" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s NotificationConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NotificationConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *NotificationConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "NotificationConfiguration"} - if s.LambdaFunctionConfigurations != nil { - for i, v := range s.LambdaFunctionConfigurations { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LambdaFunctionConfigurations", i), err.(request.ErrInvalidParams)) - } - } - } - if s.QueueConfigurations != nil { - for i, v := range s.QueueConfigurations { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "QueueConfigurations", i), err.(request.ErrInvalidParams)) - } - } - } - if s.TopicConfigurations != nil { - for i, v := range s.TopicConfigurations { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TopicConfigurations", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLambdaFunctionConfigurations sets the LambdaFunctionConfigurations field's value. -func (s *NotificationConfiguration) SetLambdaFunctionConfigurations(v []*LambdaFunctionConfiguration) *NotificationConfiguration { - s.LambdaFunctionConfigurations = v - return s -} - -// SetQueueConfigurations sets the QueueConfigurations field's value. -func (s *NotificationConfiguration) SetQueueConfigurations(v []*QueueConfiguration) *NotificationConfiguration { - s.QueueConfigurations = v - return s -} - -// SetTopicConfigurations sets the TopicConfigurations field's value. -func (s *NotificationConfiguration) SetTopicConfigurations(v []*TopicConfiguration) *NotificationConfiguration { - s.TopicConfigurations = v - return s -} - -type NotificationConfigurationDeprecated struct { - _ struct{} `type:"structure"` - - // Container for specifying the AWS Lambda notification configuration. - CloudFunctionConfiguration *CloudFunctionConfiguration `type:"structure"` - - // This data type is deprecated. This data type specifies the configuration - // for publishing messages to an Amazon Simple Queue Service (Amazon SQS) queue - // when Amazon S3 detects specified events. - QueueConfiguration *QueueConfigurationDeprecated `type:"structure"` - - // This data type is deprecated. A container for specifying the configuration - // for publication of messages to an Amazon Simple Notification Service (Amazon - // SNS) topic when Amazon S3 detects specified events. - TopicConfiguration *TopicConfigurationDeprecated `type:"structure"` -} - -// String returns the string representation -func (s NotificationConfigurationDeprecated) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NotificationConfigurationDeprecated) GoString() string { - return s.String() -} - -// SetCloudFunctionConfiguration sets the CloudFunctionConfiguration field's value. -func (s *NotificationConfigurationDeprecated) SetCloudFunctionConfiguration(v *CloudFunctionConfiguration) *NotificationConfigurationDeprecated { - s.CloudFunctionConfiguration = v - return s -} - -// SetQueueConfiguration sets the QueueConfiguration field's value. -func (s *NotificationConfigurationDeprecated) SetQueueConfiguration(v *QueueConfigurationDeprecated) *NotificationConfigurationDeprecated { - s.QueueConfiguration = v - return s -} - -// SetTopicConfiguration sets the TopicConfiguration field's value. -func (s *NotificationConfigurationDeprecated) SetTopicConfiguration(v *TopicConfigurationDeprecated) *NotificationConfigurationDeprecated { - s.TopicConfiguration = v - return s -} - -// Specifies object key name filtering rules. For information about key name -// filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) -// in the Amazon Simple Storage Service Developer Guide. -type NotificationConfigurationFilter struct { - _ struct{} `type:"structure"` - - // A container for object key name prefix and suffix filtering rules. - Key *KeyFilter `locationName:"S3Key" type:"structure"` -} - -// String returns the string representation -func (s NotificationConfigurationFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NotificationConfigurationFilter) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *NotificationConfigurationFilter) SetKey(v *KeyFilter) *NotificationConfigurationFilter { - s.Key = v - return s -} - -// An object consists of data and its descriptive metadata. -type Object struct { - _ struct{} `type:"structure"` - - // The entity tag is an MD5 hash of the object. ETag reflects only changes to - // the contents of an object, not its metadata. - ETag *string `type:"string"` - - // The name that you assign to an object. You use the object key to retrieve - // the object. - Key *string `min:"1" type:"string"` - - // The date the Object was Last Modified - LastModified *time.Time `type:"timestamp"` - - // The owner of the object - Owner *Owner `type:"structure"` - - // Size in bytes of the object - Size *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"ObjectStorageClass"` -} - -// String returns the string representation -func (s Object) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Object) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *Object) SetETag(v string) *Object { - s.ETag = &v - return s -} - -// SetKey sets the Key field's value. -func (s *Object) SetKey(v string) *Object { - s.Key = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *Object) SetLastModified(v time.Time) *Object { - s.LastModified = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *Object) SetOwner(v *Owner) *Object { - s.Owner = v - return s -} - -// SetSize sets the Size field's value. -func (s *Object) SetSize(v int64) *Object { - s.Size = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Object) SetStorageClass(v string) *Object { - s.StorageClass = &v - return s -} - -// Object Identifier is unique value to identify objects. -type ObjectIdentifier struct { - _ struct{} `type:"structure"` - - // Key name of the object to delete. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // VersionId for the specific version of the object to delete. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s ObjectIdentifier) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectIdentifier) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ObjectIdentifier) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ObjectIdentifier"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *ObjectIdentifier) SetKey(v string) *ObjectIdentifier { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *ObjectIdentifier) SetVersionId(v string) *ObjectIdentifier { - s.VersionId = &v - return s -} - -// The container element for Object Lock configuration parameters. -type ObjectLockConfiguration struct { - _ struct{} `type:"structure"` - - // Indicates whether this bucket has an Object Lock configuration enabled. - ObjectLockEnabled *string `type:"string" enum:"ObjectLockEnabled"` - - // The Object Lock rule in place for the specified object. - Rule *ObjectLockRule `type:"structure"` -} - -// String returns the string representation -func (s ObjectLockConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectLockConfiguration) GoString() string { - return s.String() -} - -// SetObjectLockEnabled sets the ObjectLockEnabled field's value. -func (s *ObjectLockConfiguration) SetObjectLockEnabled(v string) *ObjectLockConfiguration { - s.ObjectLockEnabled = &v - return s -} - -// SetRule sets the Rule field's value. -func (s *ObjectLockConfiguration) SetRule(v *ObjectLockRule) *ObjectLockConfiguration { - s.Rule = v - return s -} - -// A Legal Hold configuration for an object. -type ObjectLockLegalHold struct { - _ struct{} `type:"structure"` - - // Indicates whether the specified object has a Legal Hold in place. - Status *string `type:"string" enum:"ObjectLockLegalHoldStatus"` -} - -// String returns the string representation -func (s ObjectLockLegalHold) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectLockLegalHold) GoString() string { - return s.String() -} - -// SetStatus sets the Status field's value. -func (s *ObjectLockLegalHold) SetStatus(v string) *ObjectLockLegalHold { - s.Status = &v - return s -} - -// A Retention configuration for an object. -type ObjectLockRetention struct { - _ struct{} `type:"structure"` - - // Indicates the Retention mode for the specified object. - Mode *string `type:"string" enum:"ObjectLockRetentionMode"` - - // The date on which this Object Lock Retention will expire. - RetainUntilDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` -} - -// String returns the string representation -func (s ObjectLockRetention) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectLockRetention) GoString() string { - return s.String() -} - -// SetMode sets the Mode field's value. -func (s *ObjectLockRetention) SetMode(v string) *ObjectLockRetention { - s.Mode = &v - return s -} - -// SetRetainUntilDate sets the RetainUntilDate field's value. -func (s *ObjectLockRetention) SetRetainUntilDate(v time.Time) *ObjectLockRetention { - s.RetainUntilDate = &v - return s -} - -// The container element for an Object Lock rule. -type ObjectLockRule struct { - _ struct{} `type:"structure"` - - // The default retention period that you want to apply to new objects placed - // in the specified bucket. - DefaultRetention *DefaultRetention `type:"structure"` -} - -// String returns the string representation -func (s ObjectLockRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectLockRule) GoString() string { - return s.String() -} - -// SetDefaultRetention sets the DefaultRetention field's value. -func (s *ObjectLockRule) SetDefaultRetention(v *DefaultRetention) *ObjectLockRule { - s.DefaultRetention = v - return s -} - -// The version of an object. -type ObjectVersion struct { - _ struct{} `type:"structure"` - - // The entity tag is an MD5 hash of that version of the object. - ETag *string `type:"string"` - - // Specifies whether the object is (true) or is not (false) the latest version - // of an object. - IsLatest *bool `type:"boolean"` - - // The object key. - Key *string `min:"1" type:"string"` - - // Date and time the object was last modified. - LastModified *time.Time `type:"timestamp"` - - // Specifies the owner of the object. - Owner *Owner `type:"structure"` - - // Size in bytes of the object. - Size *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"ObjectVersionStorageClass"` - - // Version ID of an object. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s ObjectVersion) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectVersion) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *ObjectVersion) SetETag(v string) *ObjectVersion { - s.ETag = &v - return s -} - -// SetIsLatest sets the IsLatest field's value. -func (s *ObjectVersion) SetIsLatest(v bool) *ObjectVersion { - s.IsLatest = &v - return s -} - -// SetKey sets the Key field's value. -func (s *ObjectVersion) SetKey(v string) *ObjectVersion { - s.Key = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *ObjectVersion) SetLastModified(v time.Time) *ObjectVersion { - s.LastModified = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *ObjectVersion) SetOwner(v *Owner) *ObjectVersion { - s.Owner = v - return s -} - -// SetSize sets the Size field's value. -func (s *ObjectVersion) SetSize(v int64) *ObjectVersion { - s.Size = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *ObjectVersion) SetStorageClass(v string) *ObjectVersion { - s.StorageClass = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *ObjectVersion) SetVersionId(v string) *ObjectVersion { - s.VersionId = &v - return s -} - -// Describes the location where the restore job's output is stored. -type OutputLocation struct { - _ struct{} `type:"structure"` - - // Describes an S3 location that will receive the results of the restore request. - S3 *Location `type:"structure"` -} - -// String returns the string representation -func (s OutputLocation) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s OutputLocation) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *OutputLocation) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "OutputLocation"} - if s.S3 != nil { - if err := s.S3.Validate(); err != nil { - invalidParams.AddNested("S3", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetS3 sets the S3 field's value. -func (s *OutputLocation) SetS3(v *Location) *OutputLocation { - s.S3 = v - return s -} - -// Describes how results of the Select job are serialized. -type OutputSerialization struct { - _ struct{} `type:"structure"` - - // Describes the serialization of CSV-encoded Select results. - CSV *CSVOutput `type:"structure"` - - // Specifies JSON as request's output serialization format. - JSON *JSONOutput `type:"structure"` -} - -// String returns the string representation -func (s OutputSerialization) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s OutputSerialization) GoString() string { - return s.String() -} - -// SetCSV sets the CSV field's value. -func (s *OutputSerialization) SetCSV(v *CSVOutput) *OutputSerialization { - s.CSV = v - return s -} - -// SetJSON sets the JSON field's value. -func (s *OutputSerialization) SetJSON(v *JSONOutput) *OutputSerialization { - s.JSON = v - return s -} - -// Container for the owner's display name and ID. -type Owner struct { - _ struct{} `type:"structure"` - - // Container for the display name of the owner. - DisplayName *string `type:"string"` - - // Container for the ID of the owner. - ID *string `type:"string"` -} - -// String returns the string representation -func (s Owner) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Owner) GoString() string { - return s.String() -} - -// SetDisplayName sets the DisplayName field's value. -func (s *Owner) SetDisplayName(v string) *Owner { - s.DisplayName = &v - return s -} - -// SetID sets the ID field's value. -func (s *Owner) SetID(v string) *Owner { - s.ID = &v - return s -} - -// Container for Parquet. -type ParquetInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s ParquetInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ParquetInput) GoString() string { - return s.String() -} - -// Container for elements related to a part. -type Part struct { - _ struct{} `type:"structure"` - - // Entity tag returned when the part was uploaded. - ETag *string `type:"string"` - - // Date and time at which the part was uploaded. - LastModified *time.Time `type:"timestamp"` - - // Part number identifying the part. This is a positive integer between 1 and - // 10,000. - PartNumber *int64 `type:"integer"` - - // Size in bytes of the uploaded part data. - Size *int64 `type:"integer"` -} - -// String returns the string representation -func (s Part) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Part) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *Part) SetETag(v string) *Part { - s.ETag = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *Part) SetLastModified(v time.Time) *Part { - s.LastModified = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *Part) SetPartNumber(v int64) *Part { - s.PartNumber = &v - return s -} - -// SetSize sets the Size field's value. -func (s *Part) SetSize(v int64) *Part { - s.Size = &v - return s -} - -// The container element for a bucket's policy status. -type PolicyStatus struct { - _ struct{} `type:"structure"` - - // The policy status for this bucket. TRUE indicates that this bucket is public. - // FALSE indicates that the bucket is not public. - IsPublic *bool `locationName:"IsPublic" type:"boolean"` -} - -// String returns the string representation -func (s PolicyStatus) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PolicyStatus) GoString() string { - return s.String() -} - -// SetIsPublic sets the IsPublic field's value. -func (s *PolicyStatus) SetIsPublic(v bool) *PolicyStatus { - s.IsPublic = &v - return s -} - -// This data type contains information about progress of an operation. -type Progress struct { - _ struct{} `type:"structure"` - - // The current number of uncompressed object bytes processed. - BytesProcessed *int64 `type:"long"` - - // The current number of bytes of records payload data returned. - BytesReturned *int64 `type:"long"` - - // The current number of object bytes scanned. - BytesScanned *int64 `type:"long"` -} - -// String returns the string representation -func (s Progress) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Progress) GoString() string { - return s.String() -} - -// SetBytesProcessed sets the BytesProcessed field's value. -func (s *Progress) SetBytesProcessed(v int64) *Progress { - s.BytesProcessed = &v - return s -} - -// SetBytesReturned sets the BytesReturned field's value. -func (s *Progress) SetBytesReturned(v int64) *Progress { - s.BytesReturned = &v - return s -} - -// SetBytesScanned sets the BytesScanned field's value. -func (s *Progress) SetBytesScanned(v int64) *Progress { - s.BytesScanned = &v - return s -} - -// This data type contains information about the progress event of an operation. -type ProgressEvent struct { - _ struct{} `locationName:"ProgressEvent" type:"structure" payload:"Details"` - - // The Progress event details. - Details *Progress `locationName:"Details" type:"structure"` -} - -// String returns the string representation -func (s ProgressEvent) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ProgressEvent) GoString() string { - return s.String() -} - -// SetDetails sets the Details field's value. -func (s *ProgressEvent) SetDetails(v *Progress) *ProgressEvent { - s.Details = v - return s -} - -// The ProgressEvent is and event in the SelectObjectContentEventStream group of events. -func (s *ProgressEvent) eventSelectObjectContentEventStream() {} - -// UnmarshalEvent unmarshals the EventStream Message into the ProgressEvent value. -// This method is only used internally within the SDK's EventStream handling. -func (s *ProgressEvent) UnmarshalEvent( - payloadUnmarshaler protocol.PayloadUnmarshaler, - msg eventstream.Message, -) error { - if err := payloadUnmarshaler.UnmarshalPayload( - bytes.NewReader(msg.Payload), s, - ); err != nil { - return err - } - return nil -} - -func (s *ProgressEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { - msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) - var buf bytes.Buffer - if err = pm.MarshalPayload(&buf, s); err != nil { - return eventstream.Message{}, err - } - msg.Payload = buf.Bytes() - return msg, err -} - -// The PublicAccessBlock configuration that you want to apply to this Amazon -// S3 bucket. You can enable the configuration options in any combination. For -// more information about when Amazon S3 considers a bucket or object public, -// see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) -// in the Amazon Simple Storage Service Developer Guide. -type PublicAccessBlockConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies whether Amazon S3 should block public access control lists (ACLs) - // for this bucket and objects in this bucket. Setting this element to TRUE - // causes the following behavior: - // - // * PUT Bucket acl and PUT Object acl calls fail if the specified ACL is - // public. - // - // * PUT Object calls fail if the request includes a public ACL. - // - // * PUT Bucket calls fail if the request includes a public ACL. - // - // Enabling this setting doesn't affect existing policies or ACLs. - BlockPublicAcls *bool `locationName:"BlockPublicAcls" type:"boolean"` - - // Specifies whether Amazon S3 should block public bucket policies for this - // bucket. Setting this element to TRUE causes Amazon S3 to reject calls to - // PUT Bucket policy if the specified bucket policy allows public access. - // - // Enabling this setting doesn't affect existing bucket policies. - BlockPublicPolicy *bool `locationName:"BlockPublicPolicy" type:"boolean"` - - // Specifies whether Amazon S3 should ignore public ACLs for this bucket and - // objects in this bucket. Setting this element to TRUE causes Amazon S3 to - // ignore all public ACLs on this bucket and objects in this bucket. - // - // Enabling this setting doesn't affect the persistence of any existing ACLs - // and doesn't prevent new public ACLs from being set. - IgnorePublicAcls *bool `locationName:"IgnorePublicAcls" type:"boolean"` - - // Specifies whether Amazon S3 should restrict public bucket policies for this - // bucket. Setting this element to TRUE restricts access to this bucket to only - // AWS services and authorized users within this account if the bucket has a - // public policy. - // - // Enabling this setting doesn't affect previously stored bucket policies, except - // that public and cross-account access within any public bucket policy, including - // non-public delegation to specific accounts, is blocked. - RestrictPublicBuckets *bool `locationName:"RestrictPublicBuckets" type:"boolean"` -} - -// String returns the string representation -func (s PublicAccessBlockConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PublicAccessBlockConfiguration) GoString() string { - return s.String() -} - -// SetBlockPublicAcls sets the BlockPublicAcls field's value. -func (s *PublicAccessBlockConfiguration) SetBlockPublicAcls(v bool) *PublicAccessBlockConfiguration { - s.BlockPublicAcls = &v - return s -} - -// SetBlockPublicPolicy sets the BlockPublicPolicy field's value. -func (s *PublicAccessBlockConfiguration) SetBlockPublicPolicy(v bool) *PublicAccessBlockConfiguration { - s.BlockPublicPolicy = &v - return s -} - -// SetIgnorePublicAcls sets the IgnorePublicAcls field's value. -func (s *PublicAccessBlockConfiguration) SetIgnorePublicAcls(v bool) *PublicAccessBlockConfiguration { - s.IgnorePublicAcls = &v - return s -} - -// SetRestrictPublicBuckets sets the RestrictPublicBuckets field's value. -func (s *PublicAccessBlockConfiguration) SetRestrictPublicBuckets(v bool) *PublicAccessBlockConfiguration { - s.RestrictPublicBuckets = &v - return s -} - -type PutBucketAccelerateConfigurationInput struct { - _ struct{} `locationName:"PutBucketAccelerateConfigurationRequest" type:"structure" payload:"AccelerateConfiguration"` - - // Container for setting the transfer acceleration state. - // - // AccelerateConfiguration is a required field - AccelerateConfiguration *AccelerateConfiguration `locationName:"AccelerateConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Name of the bucket for which the accelerate configuration is set. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s PutBucketAccelerateConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAccelerateConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketAccelerateConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketAccelerateConfigurationInput"} - if s.AccelerateConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("AccelerateConfiguration")) - } - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccelerateConfiguration sets the AccelerateConfiguration field's value. -func (s *PutBucketAccelerateConfigurationInput) SetAccelerateConfiguration(v *AccelerateConfiguration) *PutBucketAccelerateConfigurationInput { - s.AccelerateConfiguration = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketAccelerateConfigurationInput) SetBucket(v string) *PutBucketAccelerateConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketAccelerateConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -func (s *PutBucketAccelerateConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketAccelerateConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketAccelerateConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketAccelerateConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAccelerateConfigurationOutput) GoString() string { - return s.String() -} - -type PutBucketAclInput struct { - _ struct{} `locationName:"PutBucketAclRequest" type:"structure" payload:"AccessControlPolicy"` - - // The canned ACL to apply to the bucket. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` - - // Contains the elements that set the ACL permissions for an object per grantee. - AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The bucket to which to apply the ACL. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` -} - -// String returns the string representation -func (s PutBucketAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.AccessControlPolicy != nil { - if err := s.AccessControlPolicy.Validate(); err != nil { - invalidParams.AddNested("AccessControlPolicy", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *PutBucketAclInput) SetACL(v string) *PutBucketAclInput { - s.ACL = &v - return s -} - -// SetAccessControlPolicy sets the AccessControlPolicy field's value. -func (s *PutBucketAclInput) SetAccessControlPolicy(v *AccessControlPolicy) *PutBucketAclInput { - s.AccessControlPolicy = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketAclInput) SetBucket(v string) *PutBucketAclInput { - s.Bucket = &v - return s -} - -func (s *PutBucketAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *PutBucketAclInput) SetGrantFullControl(v string) *PutBucketAclInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *PutBucketAclInput) SetGrantRead(v string) *PutBucketAclInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *PutBucketAclInput) SetGrantReadACP(v string) *PutBucketAclInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWrite sets the GrantWrite field's value. -func (s *PutBucketAclInput) SetGrantWrite(v string) *PutBucketAclInput { - s.GrantWrite = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *PutBucketAclInput) SetGrantWriteACP(v string) *PutBucketAclInput { - s.GrantWriteACP = &v - return s -} - -func (s *PutBucketAclInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketAclInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketAclOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAclOutput) GoString() string { - return s.String() -} - -type PutBucketAnalyticsConfigurationInput struct { - _ struct{} `locationName:"PutBucketAnalyticsConfigurationRequest" type:"structure" payload:"AnalyticsConfiguration"` - - // The configuration and any analyses for the analytics filter. - // - // AnalyticsConfiguration is a required field - AnalyticsConfiguration *AnalyticsConfiguration `locationName:"AnalyticsConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The name of the bucket to which an analytics configuration is stored. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID that identifies the analytics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s PutBucketAnalyticsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAnalyticsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketAnalyticsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketAnalyticsConfigurationInput"} - if s.AnalyticsConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("AnalyticsConfiguration")) - } - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.AnalyticsConfiguration != nil { - if err := s.AnalyticsConfiguration.Validate(); err != nil { - invalidParams.AddNested("AnalyticsConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnalyticsConfiguration sets the AnalyticsConfiguration field's value. -func (s *PutBucketAnalyticsConfigurationInput) SetAnalyticsConfiguration(v *AnalyticsConfiguration) *PutBucketAnalyticsConfigurationInput { - s.AnalyticsConfiguration = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketAnalyticsConfigurationInput) SetBucket(v string) *PutBucketAnalyticsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketAnalyticsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *PutBucketAnalyticsConfigurationInput) SetId(v string) *PutBucketAnalyticsConfigurationInput { - s.Id = &v - return s -} - -func (s *PutBucketAnalyticsConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketAnalyticsConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketAnalyticsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketAnalyticsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAnalyticsConfigurationOutput) GoString() string { - return s.String() -} - -type PutBucketCorsInput struct { - _ struct{} `locationName:"PutBucketCorsRequest" type:"structure" payload:"CORSConfiguration"` - - // Specifies the bucket impacted by the corsconfiguration. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Describes the cross-origin access configuration for objects in an Amazon - // S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon - // Simple Storage Service Developer Guide. - // - // CORSConfiguration is a required field - CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketCorsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketCorsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketCorsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketCorsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.CORSConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("CORSConfiguration")) - } - if s.CORSConfiguration != nil { - if err := s.CORSConfiguration.Validate(); err != nil { - invalidParams.AddNested("CORSConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketCorsInput) SetBucket(v string) *PutBucketCorsInput { - s.Bucket = &v - return s -} - -func (s *PutBucketCorsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCORSConfiguration sets the CORSConfiguration field's value. -func (s *PutBucketCorsInput) SetCORSConfiguration(v *CORSConfiguration) *PutBucketCorsInput { - s.CORSConfiguration = v - return s -} - -func (s *PutBucketCorsInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketCorsInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketCorsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketCorsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketCorsOutput) GoString() string { - return s.String() -} - -type PutBucketEncryptionInput struct { - _ struct{} `locationName:"PutBucketEncryptionRequest" type:"structure" payload:"ServerSideEncryptionConfiguration"` - - // Specifies default encryption for a bucket using server-side encryption with - // Amazon S3-managed keys (SSE-S3) or customer master keys stored in AWS KMS - // (SSE-KMS). For information about the Amazon S3 default encryption feature, - // see Amazon S3 Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies the default server-side-encryption configuration. - // - // ServerSideEncryptionConfiguration is a required field - ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketEncryptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketEncryptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketEncryptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketEncryptionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.ServerSideEncryptionConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("ServerSideEncryptionConfiguration")) - } - if s.ServerSideEncryptionConfiguration != nil { - if err := s.ServerSideEncryptionConfiguration.Validate(); err != nil { - invalidParams.AddNested("ServerSideEncryptionConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketEncryptionInput) SetBucket(v string) *PutBucketEncryptionInput { - s.Bucket = &v - return s -} - -func (s *PutBucketEncryptionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetServerSideEncryptionConfiguration sets the ServerSideEncryptionConfiguration field's value. -func (s *PutBucketEncryptionInput) SetServerSideEncryptionConfiguration(v *ServerSideEncryptionConfiguration) *PutBucketEncryptionInput { - s.ServerSideEncryptionConfiguration = v - return s -} - -func (s *PutBucketEncryptionInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketEncryptionInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketEncryptionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketEncryptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketEncryptionOutput) GoString() string { - return s.String() -} - -type PutBucketInventoryConfigurationInput struct { - _ struct{} `locationName:"PutBucketInventoryConfigurationRequest" type:"structure" payload:"InventoryConfiguration"` - - // The name of the bucket where the inventory configuration will be stored. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` - - // Specifies the inventory configuration. - // - // InventoryConfiguration is a required field - InventoryConfiguration *InventoryConfiguration `locationName:"InventoryConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketInventoryConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketInventoryConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketInventoryConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketInventoryConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.InventoryConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("InventoryConfiguration")) - } - if s.InventoryConfiguration != nil { - if err := s.InventoryConfiguration.Validate(); err != nil { - invalidParams.AddNested("InventoryConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketInventoryConfigurationInput) SetBucket(v string) *PutBucketInventoryConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketInventoryConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *PutBucketInventoryConfigurationInput) SetId(v string) *PutBucketInventoryConfigurationInput { - s.Id = &v - return s -} - -// SetInventoryConfiguration sets the InventoryConfiguration field's value. -func (s *PutBucketInventoryConfigurationInput) SetInventoryConfiguration(v *InventoryConfiguration) *PutBucketInventoryConfigurationInput { - s.InventoryConfiguration = v - return s -} - -func (s *PutBucketInventoryConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketInventoryConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketInventoryConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketInventoryConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketInventoryConfigurationOutput) GoString() string { - return s.String() -} - -type PutBucketLifecycleConfigurationInput struct { - _ struct{} `locationName:"PutBucketLifecycleConfigurationRequest" type:"structure" payload:"LifecycleConfiguration"` - - // The name of the bucket for which to set the configuration. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for lifecycle rules. You can add as many as 1,000 rules. - LifecycleConfiguration *BucketLifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketLifecycleConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketLifecycleConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketLifecycleConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.LifecycleConfiguration != nil { - if err := s.LifecycleConfiguration.Validate(); err != nil { - invalidParams.AddNested("LifecycleConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketLifecycleConfigurationInput) SetBucket(v string) *PutBucketLifecycleConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketLifecycleConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetLifecycleConfiguration sets the LifecycleConfiguration field's value. -func (s *PutBucketLifecycleConfigurationInput) SetLifecycleConfiguration(v *BucketLifecycleConfiguration) *PutBucketLifecycleConfigurationInput { - s.LifecycleConfiguration = v - return s -} - -func (s *PutBucketLifecycleConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketLifecycleConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketLifecycleConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketLifecycleConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleConfigurationOutput) GoString() string { - return s.String() -} - -type PutBucketLifecycleInput struct { - _ struct{} `locationName:"PutBucketLifecycleRequest" type:"structure" payload:"LifecycleConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for lifecycle rules. You can add as many as 1000 rules. - LifecycleConfiguration *LifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketLifecycleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketLifecycleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketLifecycleInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.LifecycleConfiguration != nil { - if err := s.LifecycleConfiguration.Validate(); err != nil { - invalidParams.AddNested("LifecycleConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketLifecycleInput) SetBucket(v string) *PutBucketLifecycleInput { - s.Bucket = &v - return s -} - -func (s *PutBucketLifecycleInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetLifecycleConfiguration sets the LifecycleConfiguration field's value. -func (s *PutBucketLifecycleInput) SetLifecycleConfiguration(v *LifecycleConfiguration) *PutBucketLifecycleInput { - s.LifecycleConfiguration = v - return s -} - -func (s *PutBucketLifecycleInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketLifecycleInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketLifecycleOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketLifecycleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleOutput) GoString() string { - return s.String() -} - -type PutBucketLoggingInput struct { - _ struct{} `locationName:"PutBucketLoggingRequest" type:"structure" payload:"BucketLoggingStatus"` - - // The name of the bucket for which to set the logging parameters. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for logging status information. - // - // BucketLoggingStatus is a required field - BucketLoggingStatus *BucketLoggingStatus `locationName:"BucketLoggingStatus" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketLoggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLoggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketLoggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketLoggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.BucketLoggingStatus == nil { - invalidParams.Add(request.NewErrParamRequired("BucketLoggingStatus")) - } - if s.BucketLoggingStatus != nil { - if err := s.BucketLoggingStatus.Validate(); err != nil { - invalidParams.AddNested("BucketLoggingStatus", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketLoggingInput) SetBucket(v string) *PutBucketLoggingInput { - s.Bucket = &v - return s -} - -func (s *PutBucketLoggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBucketLoggingStatus sets the BucketLoggingStatus field's value. -func (s *PutBucketLoggingInput) SetBucketLoggingStatus(v *BucketLoggingStatus) *PutBucketLoggingInput { - s.BucketLoggingStatus = v - return s -} - -func (s *PutBucketLoggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketLoggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketLoggingOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketLoggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLoggingOutput) GoString() string { - return s.String() -} - -type PutBucketMetricsConfigurationInput struct { - _ struct{} `locationName:"PutBucketMetricsConfigurationRequest" type:"structure" payload:"MetricsConfiguration"` - - // The name of the bucket for which the metrics configuration is set. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` - - // Specifies the metrics configuration. - // - // MetricsConfiguration is a required field - MetricsConfiguration *MetricsConfiguration `locationName:"MetricsConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketMetricsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketMetricsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketMetricsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketMetricsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.MetricsConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("MetricsConfiguration")) - } - if s.MetricsConfiguration != nil { - if err := s.MetricsConfiguration.Validate(); err != nil { - invalidParams.AddNested("MetricsConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketMetricsConfigurationInput) SetBucket(v string) *PutBucketMetricsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketMetricsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *PutBucketMetricsConfigurationInput) SetId(v string) *PutBucketMetricsConfigurationInput { - s.Id = &v - return s -} - -// SetMetricsConfiguration sets the MetricsConfiguration field's value. -func (s *PutBucketMetricsConfigurationInput) SetMetricsConfiguration(v *MetricsConfiguration) *PutBucketMetricsConfigurationInput { - s.MetricsConfiguration = v - return s -} - -func (s *PutBucketMetricsConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketMetricsConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketMetricsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketMetricsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketMetricsConfigurationOutput) GoString() string { - return s.String() -} - -type PutBucketNotificationConfigurationInput struct { - _ struct{} `locationName:"PutBucketNotificationConfigurationRequest" type:"structure" payload:"NotificationConfiguration"` - - // The name of the bucket. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A container for specifying the notification configuration of the bucket. - // If this element is empty, notifications are turned off for the bucket. - // - // NotificationConfiguration is a required field - NotificationConfiguration *NotificationConfiguration `locationName:"NotificationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketNotificationConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketNotificationConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketNotificationConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.NotificationConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("NotificationConfiguration")) - } - if s.NotificationConfiguration != nil { - if err := s.NotificationConfiguration.Validate(); err != nil { - invalidParams.AddNested("NotificationConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketNotificationConfigurationInput) SetBucket(v string) *PutBucketNotificationConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketNotificationConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetNotificationConfiguration sets the NotificationConfiguration field's value. -func (s *PutBucketNotificationConfigurationInput) SetNotificationConfiguration(v *NotificationConfiguration) *PutBucketNotificationConfigurationInput { - s.NotificationConfiguration = v - return s -} - -func (s *PutBucketNotificationConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketNotificationConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketNotificationConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketNotificationConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationConfigurationOutput) GoString() string { - return s.String() -} - -type PutBucketNotificationInput struct { - _ struct{} `locationName:"PutBucketNotificationRequest" type:"structure" payload:"NotificationConfiguration"` - - // The name of the bucket. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The container for the configuration. - // - // NotificationConfiguration is a required field - NotificationConfiguration *NotificationConfigurationDeprecated `locationName:"NotificationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketNotificationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketNotificationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketNotificationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.NotificationConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("NotificationConfiguration")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketNotificationInput) SetBucket(v string) *PutBucketNotificationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketNotificationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetNotificationConfiguration sets the NotificationConfiguration field's value. -func (s *PutBucketNotificationInput) SetNotificationConfiguration(v *NotificationConfigurationDeprecated) *PutBucketNotificationInput { - s.NotificationConfiguration = v - return s -} - -func (s *PutBucketNotificationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketNotificationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketNotificationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketNotificationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationOutput) GoString() string { - return s.String() -} - -type PutBucketPolicyInput struct { - _ struct{} `locationName:"PutBucketPolicyRequest" type:"structure" payload:"Policy"` - - // The name of the bucket. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Set this parameter to true to confirm that you want to remove your permissions - // to change this bucket policy in the future. - ConfirmRemoveSelfBucketAccess *bool `location:"header" locationName:"x-amz-confirm-remove-self-bucket-access" type:"boolean"` - - // The bucket policy as a JSON document. - // - // Policy is a required field - Policy *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s PutBucketPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketPolicyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Policy == nil { - invalidParams.Add(request.NewErrParamRequired("Policy")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketPolicyInput) SetBucket(v string) *PutBucketPolicyInput { - s.Bucket = &v - return s -} - -func (s *PutBucketPolicyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetConfirmRemoveSelfBucketAccess sets the ConfirmRemoveSelfBucketAccess field's value. -func (s *PutBucketPolicyInput) SetConfirmRemoveSelfBucketAccess(v bool) *PutBucketPolicyInput { - s.ConfirmRemoveSelfBucketAccess = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *PutBucketPolicyInput) SetPolicy(v string) *PutBucketPolicyInput { - s.Policy = &v - return s -} - -func (s *PutBucketPolicyInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketPolicyInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketPolicyOutput) GoString() string { - return s.String() -} - -type PutBucketReplicationInput struct { - _ struct{} `locationName:"PutBucketReplicationRequest" type:"structure" payload:"ReplicationConfiguration"` - - // The name of the bucket - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A container for replication rules. You can add up to 1,000 rules. The maximum - // size of a replication configuration is 2 MB. - // - // ReplicationConfiguration is a required field - ReplicationConfiguration *ReplicationConfiguration `locationName:"ReplicationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - Token *string `location:"header" locationName:"x-amz-bucket-object-lock-token" type:"string"` -} - -// String returns the string representation -func (s PutBucketReplicationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketReplicationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketReplicationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketReplicationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.ReplicationConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("ReplicationConfiguration")) - } - if s.ReplicationConfiguration != nil { - if err := s.ReplicationConfiguration.Validate(); err != nil { - invalidParams.AddNested("ReplicationConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketReplicationInput) SetBucket(v string) *PutBucketReplicationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketReplicationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetReplicationConfiguration sets the ReplicationConfiguration field's value. -func (s *PutBucketReplicationInput) SetReplicationConfiguration(v *ReplicationConfiguration) *PutBucketReplicationInput { - s.ReplicationConfiguration = v - return s -} - -// SetToken sets the Token field's value. -func (s *PutBucketReplicationInput) SetToken(v string) *PutBucketReplicationInput { - s.Token = &v - return s -} - -func (s *PutBucketReplicationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketReplicationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketReplicationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketReplicationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketReplicationOutput) GoString() string { - return s.String() -} - -type PutBucketRequestPaymentInput struct { - _ struct{} `locationName:"PutBucketRequestPaymentRequest" type:"structure" payload:"RequestPaymentConfiguration"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for Payer. - // - // RequestPaymentConfiguration is a required field - RequestPaymentConfiguration *RequestPaymentConfiguration `locationName:"RequestPaymentConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketRequestPaymentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketRequestPaymentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketRequestPaymentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketRequestPaymentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.RequestPaymentConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("RequestPaymentConfiguration")) - } - if s.RequestPaymentConfiguration != nil { - if err := s.RequestPaymentConfiguration.Validate(); err != nil { - invalidParams.AddNested("RequestPaymentConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketRequestPaymentInput) SetBucket(v string) *PutBucketRequestPaymentInput { - s.Bucket = &v - return s -} - -func (s *PutBucketRequestPaymentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetRequestPaymentConfiguration sets the RequestPaymentConfiguration field's value. -func (s *PutBucketRequestPaymentInput) SetRequestPaymentConfiguration(v *RequestPaymentConfiguration) *PutBucketRequestPaymentInput { - s.RequestPaymentConfiguration = v - return s -} - -func (s *PutBucketRequestPaymentInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketRequestPaymentInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketRequestPaymentOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketRequestPaymentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketRequestPaymentOutput) GoString() string { - return s.String() -} - -type PutBucketTaggingInput struct { - _ struct{} `locationName:"PutBucketTaggingRequest" type:"structure" payload:"Tagging"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for the TagSet and Tag elements. - // - // Tagging is a required field - Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Tagging == nil { - invalidParams.Add(request.NewErrParamRequired("Tagging")) - } - if s.Tagging != nil { - if err := s.Tagging.Validate(); err != nil { - invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketTaggingInput) SetBucket(v string) *PutBucketTaggingInput { - s.Bucket = &v - return s -} - -func (s *PutBucketTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetTagging sets the Tagging field's value. -func (s *PutBucketTaggingInput) SetTagging(v *Tagging) *PutBucketTaggingInput { - s.Tagging = v - return s -} - -func (s *PutBucketTaggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketTaggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketTaggingOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketTaggingOutput) GoString() string { - return s.String() -} - -type PutBucketVersioningInput struct { - _ struct{} `locationName:"PutBucketVersioningRequest" type:"structure" payload:"VersioningConfiguration"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Container for setting the versioning state. - // - // VersioningConfiguration is a required field - VersioningConfiguration *VersioningConfiguration `locationName:"VersioningConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketVersioningInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketVersioningInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketVersioningInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketVersioningInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.VersioningConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("VersioningConfiguration")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketVersioningInput) SetBucket(v string) *PutBucketVersioningInput { - s.Bucket = &v - return s -} - -func (s *PutBucketVersioningInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetMFA sets the MFA field's value. -func (s *PutBucketVersioningInput) SetMFA(v string) *PutBucketVersioningInput { - s.MFA = &v - return s -} - -// SetVersioningConfiguration sets the VersioningConfiguration field's value. -func (s *PutBucketVersioningInput) SetVersioningConfiguration(v *VersioningConfiguration) *PutBucketVersioningInput { - s.VersioningConfiguration = v - return s -} - -func (s *PutBucketVersioningInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketVersioningInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketVersioningOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketVersioningOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketVersioningOutput) GoString() string { - return s.String() -} - -type PutBucketWebsiteInput struct { - _ struct{} `locationName:"PutBucketWebsiteRequest" type:"structure" payload:"WebsiteConfiguration"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for the request. - // - // WebsiteConfiguration is a required field - WebsiteConfiguration *WebsiteConfiguration `locationName:"WebsiteConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketWebsiteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketWebsiteInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketWebsiteInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketWebsiteInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.WebsiteConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("WebsiteConfiguration")) - } - if s.WebsiteConfiguration != nil { - if err := s.WebsiteConfiguration.Validate(); err != nil { - invalidParams.AddNested("WebsiteConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketWebsiteInput) SetBucket(v string) *PutBucketWebsiteInput { - s.Bucket = &v - return s -} - -func (s *PutBucketWebsiteInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetWebsiteConfiguration sets the WebsiteConfiguration field's value. -func (s *PutBucketWebsiteInput) SetWebsiteConfiguration(v *WebsiteConfiguration) *PutBucketWebsiteInput { - s.WebsiteConfiguration = v - return s -} - -func (s *PutBucketWebsiteInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutBucketWebsiteInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutBucketWebsiteOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketWebsiteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketWebsiteOutput) GoString() string { - return s.String() -} - -type PutObjectAclInput struct { - _ struct{} `locationName:"PutObjectAclRequest" type:"structure" payload:"AccessControlPolicy"` - - // The canned ACL to apply to the object. For more information, see Canned ACL - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // Contains the elements that set the ACL permissions for an object per grantee. - AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The bucket name that contains the object to which you want to attach the - // ACL. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Key for which the PUT operation was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s PutObjectAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.AccessControlPolicy != nil { - if err := s.AccessControlPolicy.Validate(); err != nil { - invalidParams.AddNested("AccessControlPolicy", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *PutObjectAclInput) SetACL(v string) *PutObjectAclInput { - s.ACL = &v - return s -} - -// SetAccessControlPolicy sets the AccessControlPolicy field's value. -func (s *PutObjectAclInput) SetAccessControlPolicy(v *AccessControlPolicy) *PutObjectAclInput { - s.AccessControlPolicy = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectAclInput) SetBucket(v string) *PutObjectAclInput { - s.Bucket = &v - return s -} - -func (s *PutObjectAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *PutObjectAclInput) SetGrantFullControl(v string) *PutObjectAclInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *PutObjectAclInput) SetGrantRead(v string) *PutObjectAclInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *PutObjectAclInput) SetGrantReadACP(v string) *PutObjectAclInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWrite sets the GrantWrite field's value. -func (s *PutObjectAclInput) SetGrantWrite(v string) *PutObjectAclInput { - s.GrantWrite = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *PutObjectAclInput) SetGrantWriteACP(v string) *PutObjectAclInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *PutObjectAclInput) SetKey(v string) *PutObjectAclInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectAclInput) SetRequestPayer(v string) *PutObjectAclInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectAclInput) SetVersionId(v string) *PutObjectAclInput { - s.VersionId = &v - return s -} - -func (s *PutObjectAclInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutObjectAclInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutObjectAclOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s PutObjectAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectAclOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectAclOutput) SetRequestCharged(v string) *PutObjectAclOutput { - s.RequestCharged = &v - return s -} - -type PutObjectInput struct { - _ struct{} `locationName:"PutObjectRequest" type:"structure" payload:"Body"` - - // The canned ACL to apply to the object. For more information, see Canned ACL - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL). - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // Object data. - Body io.ReadSeeker `type:"blob"` - - // Bucket name to which the PUT operation was initiated. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Can be used to specify caching behavior along the request/reply chain. For - // more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 - // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9). - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. For more information, - // see http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1). - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 - // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11). - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 - // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13). - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // The base64-encoded 128-bit MD5 digest of the message (without the headers) - // according to RFC 1864. This header can be used as a message integrity check - // to verify that the data is the same data that was originally sent. Although - // it is optional, we recommend using the Content-MD5 mechanism as an end-to-end - // integrity check. For more information about REST request authentication, - // see REST Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html). - ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` - - // A standard MIME type describing the format of the contents. For more information, - // see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17). - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The date and time at which the object is no longer cacheable. For more information, - // see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21). - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Object key for which the PUT operation was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Specifies whether a legal hold will be applied to this object. For more information - // about S3 Object Lock, see Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). - ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - - // The Object Lock mode that you want to apply to this object. - ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - - // The date and time when you want this object's Object Lock to expire. - ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS Encryption Context to use for object encryption. The - // value of this header is a base64-encoded UTF-8 string holding JSON with the - // encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - - // If x-amz-server-side-encryption is present and has the value of aws:kms, - // this header specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetrical customer managed customer master key (CMK) that was used for - // the object. - // - // If the value of x-amz-server-side-encryption is aws:kms, this header specifies - // the ID of the symmetric customer managed AWS KMS CMK that will be used for - // the object. If you specify x-amz-server-side-encryption:aws:kms, but do not - // providex-amz-server-side-encryption-aws-kms-key-id, Amazon S3 uses the AWS - // managed CMK in AWS to protect the data. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // If you don't specify, S3 Standard is the default storage class. Amazon S3 - // supports other storage classes. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The tag-set for the object. The tag-set must be encoded as URL Query parameters. - // (For example, "Key1=Value1") - Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. For information about object - // metadata, see Object Key and Metadata (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html). - // - // In the following example, the request header sets the redirect to an object - // (anotherPage.html) in the same bucket: - // - // x-amz-website-redirect-location: /anotherPage.html - // - // In the following example, the request header sets the object redirect to - // another website: - // - // x-amz-website-redirect-location: http://www.example.com/ - // - // For more information about website hosting in Amazon S3, see Hosting Websites - // on Amazon S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html) - // and How to Configure Website Page Redirects (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html). - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s PutObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *PutObjectInput) SetACL(v string) *PutObjectInput { - s.ACL = &v - return s -} - -// SetBody sets the Body field's value. -func (s *PutObjectInput) SetBody(v io.ReadSeeker) *PutObjectInput { - s.Body = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectInput) SetBucket(v string) *PutObjectInput { - s.Bucket = &v - return s -} - -func (s *PutObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCacheControl sets the CacheControl field's value. -func (s *PutObjectInput) SetCacheControl(v string) *PutObjectInput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *PutObjectInput) SetContentDisposition(v string) *PutObjectInput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *PutObjectInput) SetContentEncoding(v string) *PutObjectInput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *PutObjectInput) SetContentLanguage(v string) *PutObjectInput { - s.ContentLanguage = &v - return s -} - -// SetContentLength sets the ContentLength field's value. -func (s *PutObjectInput) SetContentLength(v int64) *PutObjectInput { - s.ContentLength = &v - return s -} - -// SetContentMD5 sets the ContentMD5 field's value. -func (s *PutObjectInput) SetContentMD5(v string) *PutObjectInput { - s.ContentMD5 = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *PutObjectInput) SetContentType(v string) *PutObjectInput { - s.ContentType = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *PutObjectInput) SetExpires(v time.Time) *PutObjectInput { - s.Expires = &v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *PutObjectInput) SetGrantFullControl(v string) *PutObjectInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *PutObjectInput) SetGrantRead(v string) *PutObjectInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *PutObjectInput) SetGrantReadACP(v string) *PutObjectInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *PutObjectInput) SetGrantWriteACP(v string) *PutObjectInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *PutObjectInput) SetKey(v string) *PutObjectInput { - s.Key = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *PutObjectInput) SetMetadata(v map[string]*string) *PutObjectInput { - s.Metadata = v - return s -} - -// SetObjectLockLegalHoldStatus sets the ObjectLockLegalHoldStatus field's value. -func (s *PutObjectInput) SetObjectLockLegalHoldStatus(v string) *PutObjectInput { - s.ObjectLockLegalHoldStatus = &v - return s -} - -// SetObjectLockMode sets the ObjectLockMode field's value. -func (s *PutObjectInput) SetObjectLockMode(v string) *PutObjectInput { - s.ObjectLockMode = &v - return s -} - -// SetObjectLockRetainUntilDate sets the ObjectLockRetainUntilDate field's value. -func (s *PutObjectInput) SetObjectLockRetainUntilDate(v time.Time) *PutObjectInput { - s.ObjectLockRetainUntilDate = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectInput) SetRequestPayer(v string) *PutObjectInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *PutObjectInput) SetSSECustomerAlgorithm(v string) *PutObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *PutObjectInput) SetSSECustomerKey(v string) *PutObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *PutObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *PutObjectInput) SetSSECustomerKeyMD5(v string) *PutObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *PutObjectInput) SetSSEKMSEncryptionContext(v string) *PutObjectInput { - s.SSEKMSEncryptionContext = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *PutObjectInput) SetSSEKMSKeyId(v string) *PutObjectInput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *PutObjectInput) SetServerSideEncryption(v string) *PutObjectInput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *PutObjectInput) SetStorageClass(v string) *PutObjectInput { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *PutObjectInput) SetTagging(v string) *PutObjectInput { - s.Tagging = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *PutObjectInput) SetWebsiteRedirectLocation(v string) *PutObjectInput { - s.WebsiteRedirectLocation = &v - return s -} - -func (s *PutObjectInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutObjectInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutObjectLegalHoldInput struct { - _ struct{} `locationName:"PutObjectLegalHoldRequest" type:"structure" payload:"LegalHold"` - - // The bucket name containing the object that you want to place a Legal Hold - // on. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The key name for the object that you want to place a Legal Hold on. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Container element for the Legal Hold configuration you want to apply to the - // specified object. - LegalHold *ObjectLockLegalHold `locationName:"LegalHold" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // The version ID of the object that you want to place a Legal Hold on. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s PutObjectLegalHoldInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectLegalHoldInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectLegalHoldInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectLegalHoldInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectLegalHoldInput) SetBucket(v string) *PutObjectLegalHoldInput { - s.Bucket = &v - return s -} - -func (s *PutObjectLegalHoldInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *PutObjectLegalHoldInput) SetKey(v string) *PutObjectLegalHoldInput { - s.Key = &v - return s -} - -// SetLegalHold sets the LegalHold field's value. -func (s *PutObjectLegalHoldInput) SetLegalHold(v *ObjectLockLegalHold) *PutObjectLegalHoldInput { - s.LegalHold = v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectLegalHoldInput) SetRequestPayer(v string) *PutObjectLegalHoldInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectLegalHoldInput) SetVersionId(v string) *PutObjectLegalHoldInput { - s.VersionId = &v - return s -} - -func (s *PutObjectLegalHoldInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutObjectLegalHoldInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutObjectLegalHoldOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s PutObjectLegalHoldOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectLegalHoldOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectLegalHoldOutput) SetRequestCharged(v string) *PutObjectLegalHoldOutput { - s.RequestCharged = &v - return s -} - -type PutObjectLockConfigurationInput struct { - _ struct{} `locationName:"PutObjectLockConfigurationRequest" type:"structure" payload:"ObjectLockConfiguration"` - - // The bucket whose Object Lock configuration you want to create or replace. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The Object Lock configuration that you want to apply to the specified bucket. - ObjectLockConfiguration *ObjectLockConfiguration `locationName:"ObjectLockConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // A token to allow Object Lock to be enabled for an existing bucket. - Token *string `location:"header" locationName:"x-amz-bucket-object-lock-token" type:"string"` -} - -// String returns the string representation -func (s PutObjectLockConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectLockConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectLockConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectLockConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectLockConfigurationInput) SetBucket(v string) *PutObjectLockConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutObjectLockConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetObjectLockConfiguration sets the ObjectLockConfiguration field's value. -func (s *PutObjectLockConfigurationInput) SetObjectLockConfiguration(v *ObjectLockConfiguration) *PutObjectLockConfigurationInput { - s.ObjectLockConfiguration = v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectLockConfigurationInput) SetRequestPayer(v string) *PutObjectLockConfigurationInput { - s.RequestPayer = &v - return s -} - -// SetToken sets the Token field's value. -func (s *PutObjectLockConfigurationInput) SetToken(v string) *PutObjectLockConfigurationInput { - s.Token = &v - return s -} - -func (s *PutObjectLockConfigurationInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutObjectLockConfigurationInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutObjectLockConfigurationOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s PutObjectLockConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectLockConfigurationOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectLockConfigurationOutput) SetRequestCharged(v string) *PutObjectLockConfigurationOutput { - s.RequestCharged = &v - return s -} - -type PutObjectOutput struct { - _ struct{} `type:"structure"` - - // Entity tag for the uploaded object. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the expiration is configured for the object (see PutBucketLifecycleConfiguration), - // the response includes this header. It includes the expiry-date and rule-id - // key-value pairs that provide information about object expiration. The value - // of the rule-id is URL encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the AWS KMS Encryption Context to use for object encryption. - // The value of this header is a base64-encoded UTF-8 string holding JSON with - // the encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - - // If x-amz-server-side-encryption is present and has the value of aws:kms, - // this header specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // If you specified server-side encryption either with an AWS KMS customer master - // key (CMK) or Amazon S3-managed encryption key in your PUT request, the response - // includes this header. It confirms the encryption algorithm that Amazon S3 - // used to encrypt the object. - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s PutObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectOutput) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *PutObjectOutput) SetETag(v string) *PutObjectOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *PutObjectOutput) SetExpiration(v string) *PutObjectOutput { - s.Expiration = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectOutput) SetRequestCharged(v string) *PutObjectOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *PutObjectOutput) SetSSECustomerAlgorithm(v string) *PutObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *PutObjectOutput) SetSSECustomerKeyMD5(v string) *PutObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *PutObjectOutput) SetSSEKMSEncryptionContext(v string) *PutObjectOutput { - s.SSEKMSEncryptionContext = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *PutObjectOutput) SetSSEKMSKeyId(v string) *PutObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *PutObjectOutput) SetServerSideEncryption(v string) *PutObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectOutput) SetVersionId(v string) *PutObjectOutput { - s.VersionId = &v - return s -} - -type PutObjectRetentionInput struct { - _ struct{} `locationName:"PutObjectRetentionRequest" type:"structure" payload:"Retention"` - - // The bucket name that contains the object you want to apply this Object Retention - // configuration to. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Indicates whether this operation should bypass Governance-mode restrictions. - BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` - - // The key name for the object that you want to apply this Object Retention - // configuration to. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // The container element for the Object Retention configuration. - Retention *ObjectLockRetention `locationName:"Retention" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The version ID for the object that you want to apply this Object Retention - // configuration to. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s PutObjectRetentionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectRetentionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectRetentionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectRetentionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectRetentionInput) SetBucket(v string) *PutObjectRetentionInput { - s.Bucket = &v - return s -} - -func (s *PutObjectRetentionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBypassGovernanceRetention sets the BypassGovernanceRetention field's value. -func (s *PutObjectRetentionInput) SetBypassGovernanceRetention(v bool) *PutObjectRetentionInput { - s.BypassGovernanceRetention = &v - return s -} - -// SetKey sets the Key field's value. -func (s *PutObjectRetentionInput) SetKey(v string) *PutObjectRetentionInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectRetentionInput) SetRequestPayer(v string) *PutObjectRetentionInput { - s.RequestPayer = &v - return s -} - -// SetRetention sets the Retention field's value. -func (s *PutObjectRetentionInput) SetRetention(v *ObjectLockRetention) *PutObjectRetentionInput { - s.Retention = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectRetentionInput) SetVersionId(v string) *PutObjectRetentionInput { - s.VersionId = &v - return s -} - -func (s *PutObjectRetentionInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutObjectRetentionInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutObjectRetentionOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s PutObjectRetentionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectRetentionOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectRetentionOutput) SetRequestCharged(v string) *PutObjectRetentionOutput { - s.RequestCharged = &v - return s -} - -type PutObjectTaggingInput struct { - _ struct{} `locationName:"PutObjectTaggingRequest" type:"structure" payload:"Tagging"` - - // The bucket name containing the object. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Name of the tag. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Container for the TagSet and Tag elements - // - // Tagging is a required field - Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The versionId of the object that the tag-set will be added to. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s PutObjectTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.Tagging == nil { - invalidParams.Add(request.NewErrParamRequired("Tagging")) - } - if s.Tagging != nil { - if err := s.Tagging.Validate(); err != nil { - invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectTaggingInput) SetBucket(v string) *PutObjectTaggingInput { - s.Bucket = &v - return s -} - -func (s *PutObjectTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *PutObjectTaggingInput) SetKey(v string) *PutObjectTaggingInput { - s.Key = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *PutObjectTaggingInput) SetTagging(v *Tagging) *PutObjectTaggingInput { - s.Tagging = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectTaggingInput) SetVersionId(v string) *PutObjectTaggingInput { - s.VersionId = &v - return s -} - -func (s *PutObjectTaggingInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutObjectTaggingInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutObjectTaggingOutput struct { - _ struct{} `type:"structure"` - - // The versionId of the object the tag-set was added to. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s PutObjectTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectTaggingOutput) GoString() string { - return s.String() -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectTaggingOutput) SetVersionId(v string) *PutObjectTaggingOutput { - s.VersionId = &v - return s -} - -type PutPublicAccessBlockInput struct { - _ struct{} `locationName:"PutPublicAccessBlockRequest" type:"structure" payload:"PublicAccessBlockConfiguration"` - - // The name of the Amazon S3 bucket whose PublicAccessBlock configuration you - // want to set. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The PublicAccessBlock configuration that you want to apply to this Amazon - // S3 bucket. You can enable the configuration options in any combination. For - // more information about when Amazon S3 considers a bucket or object public, - // see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) - // in the Amazon Simple Storage Service Developer Guide. - // - // PublicAccessBlockConfiguration is a required field - PublicAccessBlockConfiguration *PublicAccessBlockConfiguration `locationName:"PublicAccessBlockConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutPublicAccessBlockInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutPublicAccessBlockInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutPublicAccessBlockInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutPublicAccessBlockInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.PublicAccessBlockConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("PublicAccessBlockConfiguration")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutPublicAccessBlockInput) SetBucket(v string) *PutPublicAccessBlockInput { - s.Bucket = &v - return s -} - -func (s *PutPublicAccessBlockInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetPublicAccessBlockConfiguration sets the PublicAccessBlockConfiguration field's value. -func (s *PutPublicAccessBlockInput) SetPublicAccessBlockConfiguration(v *PublicAccessBlockConfiguration) *PutPublicAccessBlockInput { - s.PublicAccessBlockConfiguration = v - return s -} - -func (s *PutPublicAccessBlockInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *PutPublicAccessBlockInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type PutPublicAccessBlockOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutPublicAccessBlockOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutPublicAccessBlockOutput) GoString() string { - return s.String() -} - -// Specifies the configuration for publishing messages to an Amazon Simple Queue -// Service (Amazon SQS) queue when Amazon S3 detects specified events. -type QueueConfiguration struct { - _ struct{} `type:"structure"` - - // A collection of bucket events for which to send notifications - // - // Events is a required field - Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - - // Specifies object key name filtering rules. For information about key name - // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - Filter *NotificationConfigurationFilter `type:"structure"` - - // An optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 - // publishes a message when it detects events of the specified type. - // - // QueueArn is a required field - QueueArn *string `locationName:"Queue" type:"string" required:"true"` -} - -// String returns the string representation -func (s QueueConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s QueueConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *QueueConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "QueueConfiguration"} - if s.Events == nil { - invalidParams.Add(request.NewErrParamRequired("Events")) - } - if s.QueueArn == nil { - invalidParams.Add(request.NewErrParamRequired("QueueArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEvents sets the Events field's value. -func (s *QueueConfiguration) SetEvents(v []*string) *QueueConfiguration { - s.Events = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *QueueConfiguration) SetFilter(v *NotificationConfigurationFilter) *QueueConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *QueueConfiguration) SetId(v string) *QueueConfiguration { - s.Id = &v - return s -} - -// SetQueueArn sets the QueueArn field's value. -func (s *QueueConfiguration) SetQueueArn(v string) *QueueConfiguration { - s.QueueArn = &v - return s -} - -// This data type is deprecated. Use QueueConfiguration for the same purposes. -// This data type specifies the configuration for publishing messages to an -// Amazon Simple Queue Service (Amazon SQS) queue when Amazon S3 detects specified -// events. -type QueueConfigurationDeprecated struct { - _ struct{} `type:"structure"` - - // The bucket event for which to send notifications. - // - // Deprecated: Event has been deprecated - Event *string `deprecated:"true" type:"string" enum:"Event"` - - // A collection of bucket events for which to send notifications - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - // An optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 - // publishes a message when it detects events of the specified type. - Queue *string `type:"string"` -} - -// String returns the string representation -func (s QueueConfigurationDeprecated) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s QueueConfigurationDeprecated) GoString() string { - return s.String() -} - -// SetEvent sets the Event field's value. -func (s *QueueConfigurationDeprecated) SetEvent(v string) *QueueConfigurationDeprecated { - s.Event = &v - return s -} - -// SetEvents sets the Events field's value. -func (s *QueueConfigurationDeprecated) SetEvents(v []*string) *QueueConfigurationDeprecated { - s.Events = v - return s -} - -// SetId sets the Id field's value. -func (s *QueueConfigurationDeprecated) SetId(v string) *QueueConfigurationDeprecated { - s.Id = &v - return s -} - -// SetQueue sets the Queue field's value. -func (s *QueueConfigurationDeprecated) SetQueue(v string) *QueueConfigurationDeprecated { - s.Queue = &v - return s -} - -// The container for the records event. -type RecordsEvent struct { - _ struct{} `locationName:"RecordsEvent" type:"structure" payload:"Payload"` - - // The byte array of partial, one or more result records. - // - // Payload is automatically base64 encoded/decoded by the SDK. - Payload []byte `type:"blob"` -} - -// String returns the string representation -func (s RecordsEvent) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RecordsEvent) GoString() string { - return s.String() -} - -// SetPayload sets the Payload field's value. -func (s *RecordsEvent) SetPayload(v []byte) *RecordsEvent { - s.Payload = v - return s -} - -// The RecordsEvent is and event in the SelectObjectContentEventStream group of events. -func (s *RecordsEvent) eventSelectObjectContentEventStream() {} - -// UnmarshalEvent unmarshals the EventStream Message into the RecordsEvent value. -// This method is only used internally within the SDK's EventStream handling. -func (s *RecordsEvent) UnmarshalEvent( - payloadUnmarshaler protocol.PayloadUnmarshaler, - msg eventstream.Message, -) error { - s.Payload = make([]byte, len(msg.Payload)) - copy(s.Payload, msg.Payload) - return nil -} - -func (s *RecordsEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { - msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) - msg.Headers.Set(":content-type", eventstream.StringValue("application/octet-stream")) - msg.Payload = s.Payload - return msg, err -} - -// Specifies how requests are redirected. In the event of an error, you can -// specify a different error code to return. -type Redirect struct { - _ struct{} `type:"structure"` - - // The host name to use in the redirect request. - HostName *string `type:"string"` - - // The HTTP redirect code to use on the response. Not required if one of the - // siblings is present. - HttpRedirectCode *string `type:"string"` - - // Protocol to use when redirecting requests. The default is the protocol that - // is used in the original request. - Protocol *string `type:"string" enum:"Protocol"` - - // The object key prefix to use in the redirect request. For example, to redirect - // requests for all pages with prefix docs/ (objects in the docs/ folder) to - // documents/, you can set a condition block with KeyPrefixEquals set to docs/ - // and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required - // if one of the siblings is present. Can be present only if ReplaceKeyWith - // is not provided. - ReplaceKeyPrefixWith *string `type:"string"` - - // The specific object key to use in the redirect request. For example, redirect - // request to error.html. Not required if one of the siblings is present. Can - // be present only if ReplaceKeyPrefixWith is not provided. - ReplaceKeyWith *string `type:"string"` -} - -// String returns the string representation -func (s Redirect) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Redirect) GoString() string { - return s.String() -} - -// SetHostName sets the HostName field's value. -func (s *Redirect) SetHostName(v string) *Redirect { - s.HostName = &v - return s -} - -// SetHttpRedirectCode sets the HttpRedirectCode field's value. -func (s *Redirect) SetHttpRedirectCode(v string) *Redirect { - s.HttpRedirectCode = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *Redirect) SetProtocol(v string) *Redirect { - s.Protocol = &v - return s -} - -// SetReplaceKeyPrefixWith sets the ReplaceKeyPrefixWith field's value. -func (s *Redirect) SetReplaceKeyPrefixWith(v string) *Redirect { - s.ReplaceKeyPrefixWith = &v - return s -} - -// SetReplaceKeyWith sets the ReplaceKeyWith field's value. -func (s *Redirect) SetReplaceKeyWith(v string) *Redirect { - s.ReplaceKeyWith = &v - return s -} - -// Specifies the redirect behavior of all requests to a website endpoint of -// an Amazon S3 bucket. -type RedirectAllRequestsTo struct { - _ struct{} `type:"structure"` - - // Name of the host where requests are redirected. - // - // HostName is a required field - HostName *string `type:"string" required:"true"` - - // Protocol to use when redirecting requests. The default is the protocol that - // is used in the original request. - Protocol *string `type:"string" enum:"Protocol"` -} - -// String returns the string representation -func (s RedirectAllRequestsTo) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RedirectAllRequestsTo) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RedirectAllRequestsTo) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RedirectAllRequestsTo"} - if s.HostName == nil { - invalidParams.Add(request.NewErrParamRequired("HostName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHostName sets the HostName field's value. -func (s *RedirectAllRequestsTo) SetHostName(v string) *RedirectAllRequestsTo { - s.HostName = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *RedirectAllRequestsTo) SetProtocol(v string) *RedirectAllRequestsTo { - s.Protocol = &v - return s -} - -// A container for replication rules. You can add up to 1,000 rules. The maximum -// size of a replication configuration is 2 MB. -type ReplicationConfiguration struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the AWS Identity and Access Management - // (IAM) role that Amazon S3 assumes when replicating objects. For more information, - // see How to Set Up Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-how-setup.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Role is a required field - Role *string `type:"string" required:"true"` - - // A container for one or more replication rules. A replication configuration - // must have at least one rule and can contain a maximum of 1,000 rules. - // - // Rules is a required field - Rules []*ReplicationRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s ReplicationConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationConfiguration"} - if s.Role == nil { - invalidParams.Add(request.NewErrParamRequired("Role")) - } - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRole sets the Role field's value. -func (s *ReplicationConfiguration) SetRole(v string) *ReplicationConfiguration { - s.Role = &v - return s -} - -// SetRules sets the Rules field's value. -func (s *ReplicationConfiguration) SetRules(v []*ReplicationRule) *ReplicationConfiguration { - s.Rules = v - return s -} - -// Specifies which Amazon S3 objects to replicate and where to store the replicas. -type ReplicationRule struct { - _ struct{} `type:"structure"` - - // Specifies whether Amazon S3 replicates the delete markers. If you specify - // a Filter, you must specify this element. However, in the latest version of - // replication configuration (when Filter is specified), Amazon S3 doesn't replicate - // delete markers. Therefore, the DeleteMarkerReplication element can contain - // only Disabled. For an example configuration, see Basic Rule - // Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-config-min-rule-config). - // - // If you don't specify the Filter element, Amazon S3 assumes that the replication - // configuration is the earlier version, V1. In the earlier version, Amazon - // S3 handled replication of delete markers differently. For more information, - // see Backward Compatibility (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations). - DeleteMarkerReplication *DeleteMarkerReplication `type:"structure"` - - // A container for information about the replication destination and its configurations - // including enabling the S3 Replication Time Control (S3 RTC). - // - // Destination is a required field - Destination *Destination `type:"structure" required:"true"` - - // Optional configuration to replicate existing source bucket objects. For more - // information, see Replicating Existing Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-what-is-isnot-replicated.html#existing-object-replication) - // in the Amazon S3 Developer Guide. - ExistingObjectReplication *ExistingObjectReplication `type:"structure"` - - // A filter that identifies the subset of objects to which the replication rule - // applies. A Filter must specify exactly one Prefix, Tag, or an And child element. - Filter *ReplicationRuleFilter `type:"structure"` - - // A unique identifier for the rule. The maximum value is 255 characters. - ID *string `type:"string"` - - // An object key name prefix that identifies the object or objects to which - // the rule applies. The maximum prefix length is 1,024 characters. To include - // all objects in a bucket, specify an empty string. - // - // Deprecated: Prefix has been deprecated - Prefix *string `deprecated:"true" type:"string"` - - // The priority associated with the rule. If you specify multiple rules in a - // replication configuration, Amazon S3 prioritizes the rules to prevent conflicts - // when filtering. If two or more rules identify the same object based on a - // specified filter, the rule with higher priority takes precedence. For example: - // - // * Same object quality prefix-based filter criteria if prefixes you specified - // in multiple rules overlap - // - // * Same object qualify tag-based filter criteria specified in multiple - // rules - // - // For more information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) - // in the Amazon Simple Storage Service Developer Guide. - Priority *int64 `type:"integer"` - - // A container that describes additional filters for identifying the source - // objects that you want to replicate. You can choose to enable or disable the - // replication of these objects. Currently, Amazon S3 supports only the filter - // that you can specify for objects created with server-side encryption using - // a customer master key (CMK) stored in AWS Key Management Service (SSE-KMS). - SourceSelectionCriteria *SourceSelectionCriteria `type:"structure"` - - // Specifies whether the rule is enabled. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ReplicationRuleStatus"` -} - -// String returns the string representation -func (s ReplicationRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationRule"} - if s.Destination == nil { - invalidParams.Add(request.NewErrParamRequired("Destination")) - } - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - if s.Destination != nil { - if err := s.Destination.Validate(); err != nil { - invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) - } - } - if s.ExistingObjectReplication != nil { - if err := s.ExistingObjectReplication.Validate(); err != nil { - invalidParams.AddNested("ExistingObjectReplication", err.(request.ErrInvalidParams)) - } - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - if s.SourceSelectionCriteria != nil { - if err := s.SourceSelectionCriteria.Validate(); err != nil { - invalidParams.AddNested("SourceSelectionCriteria", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDeleteMarkerReplication sets the DeleteMarkerReplication field's value. -func (s *ReplicationRule) SetDeleteMarkerReplication(v *DeleteMarkerReplication) *ReplicationRule { - s.DeleteMarkerReplication = v - return s -} - -// SetDestination sets the Destination field's value. -func (s *ReplicationRule) SetDestination(v *Destination) *ReplicationRule { - s.Destination = v - return s -} - -// SetExistingObjectReplication sets the ExistingObjectReplication field's value. -func (s *ReplicationRule) SetExistingObjectReplication(v *ExistingObjectReplication) *ReplicationRule { - s.ExistingObjectReplication = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *ReplicationRule) SetFilter(v *ReplicationRuleFilter) *ReplicationRule { - s.Filter = v - return s -} - -// SetID sets the ID field's value. -func (s *ReplicationRule) SetID(v string) *ReplicationRule { - s.ID = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ReplicationRule) SetPrefix(v string) *ReplicationRule { - s.Prefix = &v - return s -} - -// SetPriority sets the Priority field's value. -func (s *ReplicationRule) SetPriority(v int64) *ReplicationRule { - s.Priority = &v - return s -} - -// SetSourceSelectionCriteria sets the SourceSelectionCriteria field's value. -func (s *ReplicationRule) SetSourceSelectionCriteria(v *SourceSelectionCriteria) *ReplicationRule { - s.SourceSelectionCriteria = v - return s -} - -// SetStatus sets the Status field's value. -func (s *ReplicationRule) SetStatus(v string) *ReplicationRule { - s.Status = &v - return s -} - -// A container for specifying rule filters. The filters determine the subset -// of objects to which the rule applies. This element is required only if you -// specify more than one filter. -// -// For example: -// -// * If you specify both a Prefix and a Tag filter, wrap these filters in -// an And tag. -// -// * If you specify a filter based on multiple tags, wrap the Tag elements -// in an And tag -type ReplicationRuleAndOperator struct { - _ struct{} `type:"structure"` - - // An object key name prefix that identifies the subset of objects to which - // the rule applies. - Prefix *string `type:"string"` - - // An array of tags containing key and value pairs. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s ReplicationRuleAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationRuleAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationRuleAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationRuleAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *ReplicationRuleAndOperator) SetPrefix(v string) *ReplicationRuleAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *ReplicationRuleAndOperator) SetTags(v []*Tag) *ReplicationRuleAndOperator { - s.Tags = v - return s -} - -// A filter that identifies the subset of objects to which the replication rule -// applies. A Filter must specify exactly one Prefix, Tag, or an And child element. -type ReplicationRuleFilter struct { - _ struct{} `type:"structure"` - - // A container for specifying rule filters. The filters determine the subset - // of objects to which the rule applies. This element is required only if you - // specify more than one filter. For example: - // - // * If you specify both a Prefix and a Tag filter, wrap these filters in - // an And tag. - // - // * If you specify a filter based on multiple tags, wrap the Tag elements - // in an And tag. - And *ReplicationRuleAndOperator `type:"structure"` - - // An object key name prefix that identifies the subset of objects to which - // the rule applies. - Prefix *string `type:"string"` - - // A container for specifying a tag key and value. - // - // The rule applies only to objects that have the tag in their tag set. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s ReplicationRuleFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationRuleFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationRuleFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationRuleFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *ReplicationRuleFilter) SetAnd(v *ReplicationRuleAndOperator) *ReplicationRuleFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ReplicationRuleFilter) SetPrefix(v string) *ReplicationRuleFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *ReplicationRuleFilter) SetTag(v *Tag) *ReplicationRuleFilter { - s.Tag = v - return s -} - -// A container specifying S3 Replication Time Control (S3 RTC) related information, -// including whether S3 RTC is enabled and the time when all objects and operations -// on objects must be replicated. Must be specified together with a Metrics -// block. -type ReplicationTime struct { - _ struct{} `type:"structure"` - - // Specifies whether the replication time is enabled. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ReplicationTimeStatus"` - - // A container specifying the time by which replication should be complete for - // all objects and operations on objects. - // - // Time is a required field - Time *ReplicationTimeValue `type:"structure" required:"true"` -} - -// String returns the string representation -func (s ReplicationTime) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationTime) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationTime) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationTime"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - if s.Time == nil { - invalidParams.Add(request.NewErrParamRequired("Time")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetStatus sets the Status field's value. -func (s *ReplicationTime) SetStatus(v string) *ReplicationTime { - s.Status = &v - return s -} - -// SetTime sets the Time field's value. -func (s *ReplicationTime) SetTime(v *ReplicationTimeValue) *ReplicationTime { - s.Time = v - return s -} - -// A container specifying the time value for S3 Replication Time Control (S3 -// RTC) and replication metrics EventThreshold. -type ReplicationTimeValue struct { - _ struct{} `type:"structure"` - - // Contains an integer specifying time in minutes. - // - // Valid values: 15 minutes. - Minutes *int64 `type:"integer"` -} - -// String returns the string representation -func (s ReplicationTimeValue) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationTimeValue) GoString() string { - return s.String() -} - -// SetMinutes sets the Minutes field's value. -func (s *ReplicationTimeValue) SetMinutes(v int64) *ReplicationTimeValue { - s.Minutes = &v - return s -} - -// Container for Payer. -type RequestPaymentConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies who pays for the download and request fees. - // - // Payer is a required field - Payer *string `type:"string" required:"true" enum:"Payer"` -} - -// String returns the string representation -func (s RequestPaymentConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RequestPaymentConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RequestPaymentConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RequestPaymentConfiguration"} - if s.Payer == nil { - invalidParams.Add(request.NewErrParamRequired("Payer")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPayer sets the Payer field's value. -func (s *RequestPaymentConfiguration) SetPayer(v string) *RequestPaymentConfiguration { - s.Payer = &v - return s -} - -// Container for specifying if periodic QueryProgress messages should be sent. -type RequestProgress struct { - _ struct{} `type:"structure"` - - // Specifies whether periodic QueryProgress frames should be sent. Valid values: - // TRUE, FALSE. Default value: FALSE. - Enabled *bool `type:"boolean"` -} - -// String returns the string representation -func (s RequestProgress) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RequestProgress) GoString() string { - return s.String() -} - -// SetEnabled sets the Enabled field's value. -func (s *RequestProgress) SetEnabled(v bool) *RequestProgress { - s.Enabled = &v - return s -} - -type RestoreObjectInput struct { - _ struct{} `locationName:"RestoreObjectRequest" type:"structure" payload:"RestoreRequest"` - - // The bucket name or containing the object to restore. - // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation using an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Object key for which the operation was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Container for restore job parameters. - RestoreRequest *RestoreRequest `locationName:"RestoreRequest" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s RestoreObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RestoreObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RestoreObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RestoreObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.RestoreRequest != nil { - if err := s.RestoreRequest.Validate(); err != nil { - invalidParams.AddNested("RestoreRequest", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *RestoreObjectInput) SetBucket(v string) *RestoreObjectInput { - s.Bucket = &v - return s -} - -func (s *RestoreObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *RestoreObjectInput) SetKey(v string) *RestoreObjectInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *RestoreObjectInput) SetRequestPayer(v string) *RestoreObjectInput { - s.RequestPayer = &v - return s -} - -// SetRestoreRequest sets the RestoreRequest field's value. -func (s *RestoreObjectInput) SetRestoreRequest(v *RestoreRequest) *RestoreObjectInput { - s.RestoreRequest = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *RestoreObjectInput) SetVersionId(v string) *RestoreObjectInput { - s.VersionId = &v - return s -} - -func (s *RestoreObjectInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *RestoreObjectInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type RestoreObjectOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Indicates the path in the provided S3 output location where Select results - // will be restored to. - RestoreOutputPath *string `location:"header" locationName:"x-amz-restore-output-path" type:"string"` -} - -// String returns the string representation -func (s RestoreObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RestoreObjectOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *RestoreObjectOutput) SetRequestCharged(v string) *RestoreObjectOutput { - s.RequestCharged = &v - return s -} - -// SetRestoreOutputPath sets the RestoreOutputPath field's value. -func (s *RestoreObjectOutput) SetRestoreOutputPath(v string) *RestoreObjectOutput { - s.RestoreOutputPath = &v - return s -} - -// Container for restore job parameters. -type RestoreRequest struct { - _ struct{} `type:"structure"` - - // Lifetime of the active copy in days. Do not use with restores that specify - // OutputLocation. - Days *int64 `type:"integer"` - - // The optional description for the job. - Description *string `type:"string"` - - // S3 Glacier related parameters pertaining to this job. Do not use with restores - // that specify OutputLocation. - GlacierJobParameters *GlacierJobParameters `type:"structure"` - - // Describes the location where the restore job's output is stored. - OutputLocation *OutputLocation `type:"structure"` - - // Describes the parameters for Select job types. - SelectParameters *SelectParameters `type:"structure"` - - // S3 Glacier retrieval tier at which the restore will be processed. - Tier *string `type:"string" enum:"Tier"` - - // Type of restore request. - Type *string `type:"string" enum:"RestoreRequestType"` -} - -// String returns the string representation -func (s RestoreRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RestoreRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RestoreRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RestoreRequest"} - if s.GlacierJobParameters != nil { - if err := s.GlacierJobParameters.Validate(); err != nil { - invalidParams.AddNested("GlacierJobParameters", err.(request.ErrInvalidParams)) - } - } - if s.OutputLocation != nil { - if err := s.OutputLocation.Validate(); err != nil { - invalidParams.AddNested("OutputLocation", err.(request.ErrInvalidParams)) - } - } - if s.SelectParameters != nil { - if err := s.SelectParameters.Validate(); err != nil { - invalidParams.AddNested("SelectParameters", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDays sets the Days field's value. -func (s *RestoreRequest) SetDays(v int64) *RestoreRequest { - s.Days = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *RestoreRequest) SetDescription(v string) *RestoreRequest { - s.Description = &v - return s -} - -// SetGlacierJobParameters sets the GlacierJobParameters field's value. -func (s *RestoreRequest) SetGlacierJobParameters(v *GlacierJobParameters) *RestoreRequest { - s.GlacierJobParameters = v - return s -} - -// SetOutputLocation sets the OutputLocation field's value. -func (s *RestoreRequest) SetOutputLocation(v *OutputLocation) *RestoreRequest { - s.OutputLocation = v - return s -} - -// SetSelectParameters sets the SelectParameters field's value. -func (s *RestoreRequest) SetSelectParameters(v *SelectParameters) *RestoreRequest { - s.SelectParameters = v - return s -} - -// SetTier sets the Tier field's value. -func (s *RestoreRequest) SetTier(v string) *RestoreRequest { - s.Tier = &v - return s -} - -// SetType sets the Type field's value. -func (s *RestoreRequest) SetType(v string) *RestoreRequest { - s.Type = &v - return s -} - -// Specifies the redirect behavior and when a redirect is applied. -type RoutingRule struct { - _ struct{} `type:"structure"` - - // A container for describing a condition that must be met for the specified - // redirect to apply. For example, 1. If request is for pages in the /docs folder, - // redirect to the /documents folder. 2. If request results in HTTP error 4xx, - // redirect request to another host where you might process the error. - Condition *Condition `type:"structure"` - - // Container for redirect information. You can redirect requests to another - // host, to another page, or with another protocol. In the event of an error, - // you can specify a different error code to return. - // - // Redirect is a required field - Redirect *Redirect `type:"structure" required:"true"` -} - -// String returns the string representation -func (s RoutingRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RoutingRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RoutingRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RoutingRule"} - if s.Redirect == nil { - invalidParams.Add(request.NewErrParamRequired("Redirect")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCondition sets the Condition field's value. -func (s *RoutingRule) SetCondition(v *Condition) *RoutingRule { - s.Condition = v - return s -} - -// SetRedirect sets the Redirect field's value. -func (s *RoutingRule) SetRedirect(v *Redirect) *RoutingRule { - s.Redirect = v - return s -} - -// Specifies lifecycle rules for an Amazon S3 bucket. For more information, -// see Put Bucket Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html) -// in the Amazon Simple Storage Service API Reference. For examples, see Put -// Bucket Lifecycle Configuration Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html#API_PutBucketLifecycleConfiguration_Examples) -type Rule struct { - _ struct{} `type:"structure"` - - // Specifies the days since the initiation of an incomplete multipart upload - // that Amazon S3 will wait before permanently removing all parts of the upload. - // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket - // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) - // in the Amazon Simple Storage Service Developer Guide. - AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` - - // Specifies the expiration for the lifecycle of the object. - Expiration *LifecycleExpiration `type:"structure"` - - // Unique identifier for the rule. The value can't be longer than 255 characters. - ID *string `type:"string"` - - // Specifies when noncurrent object versions expire. Upon expiration, Amazon - // S3 permanently deletes the noncurrent object versions. You set this lifecycle - // configuration action on a bucket that has versioning enabled (or suspended) - // to request that Amazon S3 delete noncurrent object versions at a specific - // period in the object's lifetime. - NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` - - // Container for the transition rule that describes when noncurrent objects - // transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, - // or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning - // is suspended), you can set this action to request that Amazon S3 transition - // noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, - // GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's - // lifetime. - NoncurrentVersionTransition *NoncurrentVersionTransition `type:"structure"` - - // Object key prefix that identifies one or more objects to which this rule - // applies. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` - - // If Enabled, the rule is currently being applied. If Disabled, the rule is - // not currently being applied. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ExpirationStatus"` - - // Specifies when an object transitions to a specified storage class. For more - // information about Amazon S3 lifecycle configuration rules, see Transitioning - // Objects Using Amazon S3 Lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html) - // in the Amazon Simple Storage Service Developer Guide. - Transition *Transition `type:"structure"` -} - -// String returns the string representation -func (s Rule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Rule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Rule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Rule"} - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAbortIncompleteMultipartUpload sets the AbortIncompleteMultipartUpload field's value. -func (s *Rule) SetAbortIncompleteMultipartUpload(v *AbortIncompleteMultipartUpload) *Rule { - s.AbortIncompleteMultipartUpload = v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *Rule) SetExpiration(v *LifecycleExpiration) *Rule { - s.Expiration = v - return s -} - -// SetID sets the ID field's value. -func (s *Rule) SetID(v string) *Rule { - s.ID = &v - return s -} - -// SetNoncurrentVersionExpiration sets the NoncurrentVersionExpiration field's value. -func (s *Rule) SetNoncurrentVersionExpiration(v *NoncurrentVersionExpiration) *Rule { - s.NoncurrentVersionExpiration = v - return s -} - -// SetNoncurrentVersionTransition sets the NoncurrentVersionTransition field's value. -func (s *Rule) SetNoncurrentVersionTransition(v *NoncurrentVersionTransition) *Rule { - s.NoncurrentVersionTransition = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *Rule) SetPrefix(v string) *Rule { - s.Prefix = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *Rule) SetStatus(v string) *Rule { - s.Status = &v - return s -} - -// SetTransition sets the Transition field's value. -func (s *Rule) SetTransition(v *Transition) *Rule { - s.Transition = v - return s -} - -// Specifies the use of SSE-KMS to encrypt delivered inventory reports. -type SSEKMS struct { - _ struct{} `locationName:"SSE-KMS" type:"structure"` - - // Specifies the ID of the AWS Key Management Service (AWS KMS) symmetric customer - // managed customer master key (CMK) to use for encrypting inventory reports. - // - // KeyId is a required field - KeyId *string `type:"string" required:"true" sensitive:"true"` -} - -// String returns the string representation -func (s SSEKMS) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SSEKMS) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SSEKMS) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SSEKMS"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *SSEKMS) SetKeyId(v string) *SSEKMS { - s.KeyId = &v - return s -} - -// Specifies the use of SSE-S3 to encrypt delivered inventory reports. -type SSES3 struct { - _ struct{} `locationName:"SSE-S3" type:"structure"` -} - -// String returns the string representation -func (s SSES3) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SSES3) GoString() string { - return s.String() -} - -// Specifies the byte range of the object to get the records from. A record -// is processed when its first byte is contained by the range. This parameter -// is optional, but when specified, it must not be empty. See RFC 2616, Section -// 14.35.1 about how to specify the start and end of the range. -type ScanRange struct { - _ struct{} `type:"structure"` - - // Specifies the end of the byte range. This parameter is optional. Valid values: - // non-negative integers. The default value is one less than the size of the - // object being queried. If only the End parameter is supplied, it is interpreted - // to mean scan the last N bytes of the file. For example, 50 - // means scan the last 50 bytes. - End *int64 `type:"long"` - - // Specifies the start of the byte range. This parameter is optional. Valid - // values: non-negative integers. The default value is 0. If only start is supplied, - // it means scan from that point to the end of the file.For example; 50 - // means scan from byte 50 until the end of the file. - Start *int64 `type:"long"` -} - -// String returns the string representation -func (s ScanRange) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ScanRange) GoString() string { - return s.String() -} - -// SetEnd sets the End field's value. -func (s *ScanRange) SetEnd(v int64) *ScanRange { - s.End = &v - return s -} - -// SetStart sets the Start field's value. -func (s *ScanRange) SetStart(v int64) *ScanRange { - s.Start = &v - return s -} - -// SelectObjectContentEventStreamEvent groups together all EventStream -// events writes for SelectObjectContentEventStream. -// -// These events are: -// -// * ContinuationEvent -// * EndEvent -// * ProgressEvent -// * RecordsEvent -// * StatsEvent -type SelectObjectContentEventStreamEvent interface { - eventSelectObjectContentEventStream() - eventstreamapi.Marshaler - eventstreamapi.Unmarshaler -} - -// SelectObjectContentEventStreamReader provides the interface for reading to the stream. The -// default implementation for this interface will be SelectObjectContentEventStreamData. -// -// The reader's Close method must allow multiple concurrent calls. -// -// These events are: -// -// * ContinuationEvent -// * EndEvent -// * ProgressEvent -// * RecordsEvent -// * StatsEvent -type SelectObjectContentEventStreamReader interface { - // Returns a channel of events as they are read from the event stream. - Events() <-chan SelectObjectContentEventStreamEvent - - // Close will stop the reader reading events from the stream. - Close() error - - // Returns any error that has occurred while reading from the event stream. - Err() error -} - -type readSelectObjectContentEventStream struct { - eventReader *eventstreamapi.EventReader - stream chan SelectObjectContentEventStreamEvent - err *eventstreamapi.OnceError - - done chan struct{} - closeOnce sync.Once -} - -func newReadSelectObjectContentEventStream(eventReader *eventstreamapi.EventReader) *readSelectObjectContentEventStream { - r := &readSelectObjectContentEventStream{ - eventReader: eventReader, - stream: make(chan SelectObjectContentEventStreamEvent), - done: make(chan struct{}), - err: eventstreamapi.NewOnceError(), - } - go r.readEventStream() - - return r -} - -// Close will close the underlying event stream reader. -func (r *readSelectObjectContentEventStream) Close() error { - r.closeOnce.Do(r.safeClose) - return r.Err() -} - -func (r *readSelectObjectContentEventStream) ErrorSet() <-chan struct{} { - return r.err.ErrorSet() -} - -func (r *readSelectObjectContentEventStream) Closed() <-chan struct{} { - return r.done -} - -func (r *readSelectObjectContentEventStream) safeClose() { - close(r.done) -} - -func (r *readSelectObjectContentEventStream) Err() error { - return r.err.Err() -} - -func (r *readSelectObjectContentEventStream) Events() <-chan SelectObjectContentEventStreamEvent { - return r.stream -} - -func (r *readSelectObjectContentEventStream) readEventStream() { - defer r.Close() - defer close(r.stream) - - for { - event, err := r.eventReader.ReadEvent() - if err != nil { - if err == io.EOF { - return - } - select { - case <-r.done: - // If closed already ignore the error - return - default: - } - r.err.SetError(err) - return - } - - select { - case r.stream <- event.(SelectObjectContentEventStreamEvent): - case <-r.done: - return - } - } -} - -type unmarshalerForSelectObjectContentEventStreamEvent struct { - metadata protocol.ResponseMetadata -} - -func (u unmarshalerForSelectObjectContentEventStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) { - switch eventType { - case "Cont": - return &ContinuationEvent{}, nil - case "End": - return &EndEvent{}, nil - case "Progress": - return &ProgressEvent{}, nil - case "Records": - return &RecordsEvent{}, nil - case "Stats": - return &StatsEvent{}, nil - default: - return nil, awserr.New( - request.ErrCodeSerialization, - fmt.Sprintf("unknown event type name, %s, for SelectObjectContentEventStream", eventType), - nil, - ) - } -} - -// Request to filter the contents of an Amazon S3 object based on a simple Structured -// Query Language (SQL) statement. In the request, along with the SQL expression, -// you must specify a data serialization format (JSON or CSV) of the object. -// Amazon S3 uses this to parse object data into records. It returns only records -// that match the specified SQL expression. You must also specify the data serialization -// format for the response. For more information, see S3Select API Documentation -// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html). -type SelectObjectContentInput struct { - _ struct{} `locationName:"SelectObjectContentRequest" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The S3 bucket. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The expression that is used to query the object. - // - // Expression is a required field - Expression *string `type:"string" required:"true"` - - // The type of the provided expression (for example, SQL). - // - // ExpressionType is a required field - ExpressionType *string `type:"string" required:"true" enum:"ExpressionType"` - - // Describes the format of the data in the object that is being queried. - // - // InputSerialization is a required field - InputSerialization *InputSerialization `type:"structure" required:"true"` - - // The object key. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Describes the format of the data that you want Amazon S3 to return in response. - // - // OutputSerialization is a required field - OutputSerialization *OutputSerialization `type:"structure" required:"true"` - - // Specifies if periodic request progress information should be enabled. - RequestProgress *RequestProgress `type:"structure"` - - // The SSE Algorithm used to encrypt the object. For more information, see Server-Side - // Encryption (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // The SSE Customer Key. For more information, see Server-Side Encryption (Using - // Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // The SSE Customer Key MD5. For more information, see Server-Side Encryption - // (Using Customer-Provided Encryption Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the byte range of the object to get the records from. A record - // is processed when its first byte is contained by the range. This parameter - // is optional, but when specified, it must not be empty. See RFC 2616, Section - // 14.35.1 about how to specify the start and end of the range. - // - // ScanRangemay be used in the following ways: - // - // * 50100 - process only - // the records starting between the bytes 50 and 100 (inclusive, counting - // from zero) - // - // * 50 - process only the records - // starting after the byte 50 - // - // * 50 - process only the records within - // the last 50 bytes of the file. - ScanRange *ScanRange `type:"structure"` -} - -// String returns the string representation -func (s SelectObjectContentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SelectObjectContentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SelectObjectContentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SelectObjectContentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Expression == nil { - invalidParams.Add(request.NewErrParamRequired("Expression")) - } - if s.ExpressionType == nil { - invalidParams.Add(request.NewErrParamRequired("ExpressionType")) - } - if s.InputSerialization == nil { - invalidParams.Add(request.NewErrParamRequired("InputSerialization")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.OutputSerialization == nil { - invalidParams.Add(request.NewErrParamRequired("OutputSerialization")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *SelectObjectContentInput) SetBucket(v string) *SelectObjectContentInput { - s.Bucket = &v - return s -} - -func (s *SelectObjectContentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetExpression sets the Expression field's value. -func (s *SelectObjectContentInput) SetExpression(v string) *SelectObjectContentInput { - s.Expression = &v - return s -} - -// SetExpressionType sets the ExpressionType field's value. -func (s *SelectObjectContentInput) SetExpressionType(v string) *SelectObjectContentInput { - s.ExpressionType = &v - return s -} - -// SetInputSerialization sets the InputSerialization field's value. -func (s *SelectObjectContentInput) SetInputSerialization(v *InputSerialization) *SelectObjectContentInput { - s.InputSerialization = v - return s -} - -// SetKey sets the Key field's value. -func (s *SelectObjectContentInput) SetKey(v string) *SelectObjectContentInput { - s.Key = &v - return s -} - -// SetOutputSerialization sets the OutputSerialization field's value. -func (s *SelectObjectContentInput) SetOutputSerialization(v *OutputSerialization) *SelectObjectContentInput { - s.OutputSerialization = v - return s -} - -// SetRequestProgress sets the RequestProgress field's value. -func (s *SelectObjectContentInput) SetRequestProgress(v *RequestProgress) *SelectObjectContentInput { - s.RequestProgress = v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *SelectObjectContentInput) SetSSECustomerAlgorithm(v string) *SelectObjectContentInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *SelectObjectContentInput) SetSSECustomerKey(v string) *SelectObjectContentInput { - s.SSECustomerKey = &v - return s -} - -func (s *SelectObjectContentInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *SelectObjectContentInput) SetSSECustomerKeyMD5(v string) *SelectObjectContentInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetScanRange sets the ScanRange field's value. -func (s *SelectObjectContentInput) SetScanRange(v *ScanRange) *SelectObjectContentInput { - s.ScanRange = v - return s -} - -func (s *SelectObjectContentInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *SelectObjectContentInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type SelectObjectContentOutput struct { - _ struct{} `type:"structure" payload:"Payload"` - - EventStream *SelectObjectContentEventStream -} - -// String returns the string representation -func (s SelectObjectContentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SelectObjectContentOutput) GoString() string { - return s.String() -} - -func (s *SelectObjectContentOutput) SetEventStream(v *SelectObjectContentEventStream) *SelectObjectContentOutput { - s.EventStream = v - return s -} -func (s *SelectObjectContentOutput) GetEventStream() *SelectObjectContentEventStream { - return s.EventStream -} - -// GetStream returns the type to interact with the event stream. -func (s *SelectObjectContentOutput) GetStream() *SelectObjectContentEventStream { - return s.EventStream -} - -// Describes the parameters for Select job types. -type SelectParameters struct { - _ struct{} `type:"structure"` - - // The expression that is used to query the object. - // - // Expression is a required field - Expression *string `type:"string" required:"true"` - - // The type of the provided expression (for example, SQL). - // - // ExpressionType is a required field - ExpressionType *string `type:"string" required:"true" enum:"ExpressionType"` - - // Describes the serialization format of the object. - // - // InputSerialization is a required field - InputSerialization *InputSerialization `type:"structure" required:"true"` - - // Describes how the results of the Select job are serialized. - // - // OutputSerialization is a required field - OutputSerialization *OutputSerialization `type:"structure" required:"true"` -} - -// String returns the string representation -func (s SelectParameters) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SelectParameters) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SelectParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SelectParameters"} - if s.Expression == nil { - invalidParams.Add(request.NewErrParamRequired("Expression")) - } - if s.ExpressionType == nil { - invalidParams.Add(request.NewErrParamRequired("ExpressionType")) - } - if s.InputSerialization == nil { - invalidParams.Add(request.NewErrParamRequired("InputSerialization")) - } - if s.OutputSerialization == nil { - invalidParams.Add(request.NewErrParamRequired("OutputSerialization")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetExpression sets the Expression field's value. -func (s *SelectParameters) SetExpression(v string) *SelectParameters { - s.Expression = &v - return s -} - -// SetExpressionType sets the ExpressionType field's value. -func (s *SelectParameters) SetExpressionType(v string) *SelectParameters { - s.ExpressionType = &v - return s -} - -// SetInputSerialization sets the InputSerialization field's value. -func (s *SelectParameters) SetInputSerialization(v *InputSerialization) *SelectParameters { - s.InputSerialization = v - return s -} - -// SetOutputSerialization sets the OutputSerialization field's value. -func (s *SelectParameters) SetOutputSerialization(v *OutputSerialization) *SelectParameters { - s.OutputSerialization = v - return s -} - -// Describes the default server-side encryption to apply to new objects in the -// bucket. If a PUT Object request doesn't specify any server-side encryption, -// this default encryption will be applied. For more information, see PUT Bucket -// encryption (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTencryption.html) -// in the Amazon Simple Storage Service API Reference. -type ServerSideEncryptionByDefault struct { - _ struct{} `type:"structure"` - - // AWS Key Management Service (KMS) customer master key ID to use for the default - // encryption. This parameter is allowed if and only if SSEAlgorithm is set - // to aws:kms. - // - // You can specify the key ID or the Amazon Resource Name (ARN) of the CMK. - // However, if you are using encryption with cross-account operations, you must - // use a fully qualified CMK ARN. For more information, see Using encryption - // for cross-account operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html#bucket-encryption-update-bucket-policy). - // - // For example: - // - // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab - // - // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab - // - // Amazon S3 only supports symmetric CMKs and not asymmetric CMKs. For more - // information, see Using Symmetric and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) - // in the AWS Key Management Service Developer Guide. - KMSMasterKeyID *string `type:"string" sensitive:"true"` - - // Server-side encryption algorithm to use for the default encryption. - // - // SSEAlgorithm is a required field - SSEAlgorithm *string `type:"string" required:"true" enum:"ServerSideEncryption"` -} - -// String returns the string representation -func (s ServerSideEncryptionByDefault) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ServerSideEncryptionByDefault) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ServerSideEncryptionByDefault) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ServerSideEncryptionByDefault"} - if s.SSEAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("SSEAlgorithm")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKMSMasterKeyID sets the KMSMasterKeyID field's value. -func (s *ServerSideEncryptionByDefault) SetKMSMasterKeyID(v string) *ServerSideEncryptionByDefault { - s.KMSMasterKeyID = &v - return s -} - -// SetSSEAlgorithm sets the SSEAlgorithm field's value. -func (s *ServerSideEncryptionByDefault) SetSSEAlgorithm(v string) *ServerSideEncryptionByDefault { - s.SSEAlgorithm = &v - return s -} - -// Specifies the default server-side-encryption configuration. -type ServerSideEncryptionConfiguration struct { - _ struct{} `type:"structure"` - - // Container for information about a particular server-side encryption configuration - // rule. - // - // Rules is a required field - Rules []*ServerSideEncryptionRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s ServerSideEncryptionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ServerSideEncryptionConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ServerSideEncryptionConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ServerSideEncryptionConfiguration"} - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRules sets the Rules field's value. -func (s *ServerSideEncryptionConfiguration) SetRules(v []*ServerSideEncryptionRule) *ServerSideEncryptionConfiguration { - s.Rules = v - return s -} - -// Specifies the default server-side encryption configuration. -type ServerSideEncryptionRule struct { - _ struct{} `type:"structure"` - - // Specifies the default server-side encryption to apply to new objects in the - // bucket. If a PUT Object request doesn't specify any server-side encryption, - // this default encryption will be applied. - ApplyServerSideEncryptionByDefault *ServerSideEncryptionByDefault `type:"structure"` -} - -// String returns the string representation -func (s ServerSideEncryptionRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ServerSideEncryptionRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ServerSideEncryptionRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ServerSideEncryptionRule"} - if s.ApplyServerSideEncryptionByDefault != nil { - if err := s.ApplyServerSideEncryptionByDefault.Validate(); err != nil { - invalidParams.AddNested("ApplyServerSideEncryptionByDefault", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetApplyServerSideEncryptionByDefault sets the ApplyServerSideEncryptionByDefault field's value. -func (s *ServerSideEncryptionRule) SetApplyServerSideEncryptionByDefault(v *ServerSideEncryptionByDefault) *ServerSideEncryptionRule { - s.ApplyServerSideEncryptionByDefault = v - return s -} - -// A container that describes additional filters for identifying the source -// objects that you want to replicate. You can choose to enable or disable the -// replication of these objects. Currently, Amazon S3 supports only the filter -// that you can specify for objects created with server-side encryption using -// a customer master key (CMK) stored in AWS Key Management Service (SSE-KMS). -type SourceSelectionCriteria struct { - _ struct{} `type:"structure"` - - // A container for filter information for the selection of Amazon S3 objects - // encrypted with AWS KMS. If you include SourceSelectionCriteria in the replication - // configuration, this element is required. - SseKmsEncryptedObjects *SseKmsEncryptedObjects `type:"structure"` -} - -// String returns the string representation -func (s SourceSelectionCriteria) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SourceSelectionCriteria) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SourceSelectionCriteria) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SourceSelectionCriteria"} - if s.SseKmsEncryptedObjects != nil { - if err := s.SseKmsEncryptedObjects.Validate(); err != nil { - invalidParams.AddNested("SseKmsEncryptedObjects", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetSseKmsEncryptedObjects sets the SseKmsEncryptedObjects field's value. -func (s *SourceSelectionCriteria) SetSseKmsEncryptedObjects(v *SseKmsEncryptedObjects) *SourceSelectionCriteria { - s.SseKmsEncryptedObjects = v - return s -} - -// A container for filter information for the selection of S3 objects encrypted -// with AWS KMS. -type SseKmsEncryptedObjects struct { - _ struct{} `type:"structure"` - - // Specifies whether Amazon S3 replicates objects created with server-side encryption - // using a customer master key (CMK) stored in AWS Key Management Service. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"SseKmsEncryptedObjectsStatus"` -} - -// String returns the string representation -func (s SseKmsEncryptedObjects) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SseKmsEncryptedObjects) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SseKmsEncryptedObjects) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SseKmsEncryptedObjects"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetStatus sets the Status field's value. -func (s *SseKmsEncryptedObjects) SetStatus(v string) *SseKmsEncryptedObjects { - s.Status = &v - return s -} - -// Container for the stats details. -type Stats struct { - _ struct{} `type:"structure"` - - // The total number of uncompressed object bytes processed. - BytesProcessed *int64 `type:"long"` - - // The total number of bytes of records payload data returned. - BytesReturned *int64 `type:"long"` - - // The total number of object bytes scanned. - BytesScanned *int64 `type:"long"` -} - -// String returns the string representation -func (s Stats) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Stats) GoString() string { - return s.String() -} - -// SetBytesProcessed sets the BytesProcessed field's value. -func (s *Stats) SetBytesProcessed(v int64) *Stats { - s.BytesProcessed = &v - return s -} - -// SetBytesReturned sets the BytesReturned field's value. -func (s *Stats) SetBytesReturned(v int64) *Stats { - s.BytesReturned = &v - return s -} - -// SetBytesScanned sets the BytesScanned field's value. -func (s *Stats) SetBytesScanned(v int64) *Stats { - s.BytesScanned = &v - return s -} - -// Container for the Stats Event. -type StatsEvent struct { - _ struct{} `locationName:"StatsEvent" type:"structure" payload:"Details"` - - // The Stats event details. - Details *Stats `locationName:"Details" type:"structure"` -} - -// String returns the string representation -func (s StatsEvent) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s StatsEvent) GoString() string { - return s.String() -} - -// SetDetails sets the Details field's value. -func (s *StatsEvent) SetDetails(v *Stats) *StatsEvent { - s.Details = v - return s -} - -// The StatsEvent is and event in the SelectObjectContentEventStream group of events. -func (s *StatsEvent) eventSelectObjectContentEventStream() {} - -// UnmarshalEvent unmarshals the EventStream Message into the StatsEvent value. -// This method is only used internally within the SDK's EventStream handling. -func (s *StatsEvent) UnmarshalEvent( - payloadUnmarshaler protocol.PayloadUnmarshaler, - msg eventstream.Message, -) error { - if err := payloadUnmarshaler.UnmarshalPayload( - bytes.NewReader(msg.Payload), s, - ); err != nil { - return err - } - return nil -} - -func (s *StatsEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { - msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) - var buf bytes.Buffer - if err = pm.MarshalPayload(&buf, s); err != nil { - return eventstream.Message{}, err - } - msg.Payload = buf.Bytes() - return msg, err -} - -// Specifies data related to access patterns to be collected and made available -// to analyze the tradeoffs between different storage classes for an Amazon -// S3 bucket. -type StorageClassAnalysis struct { - _ struct{} `type:"structure"` - - // Specifies how data related to the storage class analysis for an Amazon S3 - // bucket should be exported. - DataExport *StorageClassAnalysisDataExport `type:"structure"` -} - -// String returns the string representation -func (s StorageClassAnalysis) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s StorageClassAnalysis) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *StorageClassAnalysis) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StorageClassAnalysis"} - if s.DataExport != nil { - if err := s.DataExport.Validate(); err != nil { - invalidParams.AddNested("DataExport", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDataExport sets the DataExport field's value. -func (s *StorageClassAnalysis) SetDataExport(v *StorageClassAnalysisDataExport) *StorageClassAnalysis { - s.DataExport = v - return s -} - -// Container for data related to the storage class analysis for an Amazon S3 -// bucket for export. -type StorageClassAnalysisDataExport struct { - _ struct{} `type:"structure"` - - // The place to store the data for an analysis. - // - // Destination is a required field - Destination *AnalyticsExportDestination `type:"structure" required:"true"` - - // The version of the output schema to use when exporting data. Must be V_1. - // - // OutputSchemaVersion is a required field - OutputSchemaVersion *string `type:"string" required:"true" enum:"StorageClassAnalysisSchemaVersion"` -} - -// String returns the string representation -func (s StorageClassAnalysisDataExport) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s StorageClassAnalysisDataExport) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *StorageClassAnalysisDataExport) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StorageClassAnalysisDataExport"} - if s.Destination == nil { - invalidParams.Add(request.NewErrParamRequired("Destination")) - } - if s.OutputSchemaVersion == nil { - invalidParams.Add(request.NewErrParamRequired("OutputSchemaVersion")) - } - if s.Destination != nil { - if err := s.Destination.Validate(); err != nil { - invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDestination sets the Destination field's value. -func (s *StorageClassAnalysisDataExport) SetDestination(v *AnalyticsExportDestination) *StorageClassAnalysisDataExport { - s.Destination = v - return s -} - -// SetOutputSchemaVersion sets the OutputSchemaVersion field's value. -func (s *StorageClassAnalysisDataExport) SetOutputSchemaVersion(v string) *StorageClassAnalysisDataExport { - s.OutputSchemaVersion = &v - return s -} - -// A container of a key value name pair. -type Tag struct { - _ struct{} `type:"structure"` - - // Name of the tag. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // Value of the tag. - // - // Value is a required field - Value *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Tag) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Tag) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Tag"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.Value == nil { - invalidParams.Add(request.NewErrParamRequired("Value")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *Tag) SetKey(v string) *Tag { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *Tag) SetValue(v string) *Tag { - s.Value = &v - return s -} - -// Container for TagSet elements. -type Tagging struct { - _ struct{} `type:"structure"` - - // A collection for a set of tags - // - // TagSet is a required field - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` -} - -// String returns the string representation -func (s Tagging) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Tagging) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Tagging) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Tagging"} - if s.TagSet == nil { - invalidParams.Add(request.NewErrParamRequired("TagSet")) - } - if s.TagSet != nil { - for i, v := range s.TagSet { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TagSet", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTagSet sets the TagSet field's value. -func (s *Tagging) SetTagSet(v []*Tag) *Tagging { - s.TagSet = v - return s -} - -// Container for granting information. -type TargetGrant struct { - _ struct{} `type:"structure"` - - // Container for the person being granted permissions. - Grantee *Grantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - // Logging permissions assigned to the Grantee for the bucket. - Permission *string `type:"string" enum:"BucketLogsPermission"` -} - -// String returns the string representation -func (s TargetGrant) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TargetGrant) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TargetGrant) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TargetGrant"} - if s.Grantee != nil { - if err := s.Grantee.Validate(); err != nil { - invalidParams.AddNested("Grantee", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantee sets the Grantee field's value. -func (s *TargetGrant) SetGrantee(v *Grantee) *TargetGrant { - s.Grantee = v - return s -} - -// SetPermission sets the Permission field's value. -func (s *TargetGrant) SetPermission(v string) *TargetGrant { - s.Permission = &v - return s -} - -// A container for specifying the configuration for publication of messages -// to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 -// detects specified events. -type TopicConfiguration struct { - _ struct{} `type:"structure"` - - // The Amazon S3 bucket event about which to send notifications. For more information, - // see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - // - // Events is a required field - Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - - // Specifies object key name filtering rules. For information about key name - // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - Filter *NotificationConfigurationFilter `type:"structure"` - - // An optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 - // publishes a message when it detects events of the specified type. - // - // TopicArn is a required field - TopicArn *string `locationName:"Topic" type:"string" required:"true"` -} - -// String returns the string representation -func (s TopicConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TopicConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TopicConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TopicConfiguration"} - if s.Events == nil { - invalidParams.Add(request.NewErrParamRequired("Events")) - } - if s.TopicArn == nil { - invalidParams.Add(request.NewErrParamRequired("TopicArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEvents sets the Events field's value. -func (s *TopicConfiguration) SetEvents(v []*string) *TopicConfiguration { - s.Events = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *TopicConfiguration) SetFilter(v *NotificationConfigurationFilter) *TopicConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *TopicConfiguration) SetId(v string) *TopicConfiguration { - s.Id = &v - return s -} - -// SetTopicArn sets the TopicArn field's value. -func (s *TopicConfiguration) SetTopicArn(v string) *TopicConfiguration { - s.TopicArn = &v - return s -} - -// A container for specifying the configuration for publication of messages -// to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 -// detects specified events. This data type is deprecated. Use TopicConfiguration -// instead. -type TopicConfigurationDeprecated struct { - _ struct{} `type:"structure"` - - // Bucket event for which to send notifications. - // - // Deprecated: Event has been deprecated - Event *string `deprecated:"true" type:"string" enum:"Event"` - - // A collection of events related to objects - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - // An optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // Amazon SNS topic to which Amazon S3 will publish a message to report the - // specified events for the bucket. - Topic *string `type:"string"` -} - -// String returns the string representation -func (s TopicConfigurationDeprecated) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TopicConfigurationDeprecated) GoString() string { - return s.String() -} - -// SetEvent sets the Event field's value. -func (s *TopicConfigurationDeprecated) SetEvent(v string) *TopicConfigurationDeprecated { - s.Event = &v - return s -} - -// SetEvents sets the Events field's value. -func (s *TopicConfigurationDeprecated) SetEvents(v []*string) *TopicConfigurationDeprecated { - s.Events = v - return s -} - -// SetId sets the Id field's value. -func (s *TopicConfigurationDeprecated) SetId(v string) *TopicConfigurationDeprecated { - s.Id = &v - return s -} - -// SetTopic sets the Topic field's value. -func (s *TopicConfigurationDeprecated) SetTopic(v string) *TopicConfigurationDeprecated { - s.Topic = &v - return s -} - -// Specifies when an object transitions to a specified storage class. For more -// information about Amazon S3 lifecycle configuration rules, see Transitioning -// Objects Using Amazon S3 Lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html) -// in the Amazon Simple Storage Service Developer Guide. -type Transition struct { - _ struct{} `type:"structure"` - - // Indicates when objects are transitioned to the specified storage class. The - // date value must be in ISO 8601 format. The time is always midnight UTC. - Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Indicates the number of days after creation when objects are transitioned - // to the specified storage class. The value must be a positive integer. - Days *int64 `type:"integer"` - - // The storage class to which you want the object to transition. - StorageClass *string `type:"string" enum:"TransitionStorageClass"` -} - -// String returns the string representation -func (s Transition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Transition) GoString() string { - return s.String() -} - -// SetDate sets the Date field's value. -func (s *Transition) SetDate(v time.Time) *Transition { - s.Date = &v - return s -} - -// SetDays sets the Days field's value. -func (s *Transition) SetDays(v int64) *Transition { - s.Days = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Transition) SetStorageClass(v string) *Transition { - s.StorageClass = &v - return s -} - -type UploadPartCopyInput struct { - _ struct{} `locationName:"UploadPartCopyRequest" type:"structure"` - - // The bucket name. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The name of the source bucket and key name of the source object, separated - // by a slash (/). Must be URL-encoded. - // - // CopySource is a required field - CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` - - // Copies the object if its entity tag (ETag) matches the specified tag. - CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` - - // Copies the object if it has been modified since the specified time. - CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp"` - - // Copies the object if its entity tag (ETag) is different than the specified - // ETag. - CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` - - // Copies the object if it hasn't been modified since the specified time. - CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp"` - - // The range of bytes to copy from the source object. The range value must use - // the form bytes=first-last, where the first and last are the zero-based byte - // offsets to copy. For example, bytes=0-9 indicates that you want to copy the - // first 10 bytes of the source. You can copy a range only if the source object - // is greater than 5 MB. - CopySourceRange *string `location:"header" locationName:"x-amz-copy-source-range" type:"string"` - - // Specifies the algorithm to use when decrypting the source object (for example, - // AES256). - CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt - // the source object. The encryption key provided in this header must be one - // that was used when the source object was created. - CopySourceSSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - - // Object key for which the multipart upload was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of part being copied. This is a positive integer between 1 and - // 10,000. - // - // PartNumber is a required field - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. This must be the same encryption key specified in the initiate multipart - // upload request. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Upload ID identifying the multipart upload whose part is being copied. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s UploadPartCopyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartCopyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UploadPartCopyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UploadPartCopyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.CopySource == nil { - invalidParams.Add(request.NewErrParamRequired("CopySource")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.PartNumber == nil { - invalidParams.Add(request.NewErrParamRequired("PartNumber")) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *UploadPartCopyInput) SetBucket(v string) *UploadPartCopyInput { - s.Bucket = &v - return s -} - -func (s *UploadPartCopyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCopySource sets the CopySource field's value. -func (s *UploadPartCopyInput) SetCopySource(v string) *UploadPartCopyInput { - s.CopySource = &v - return s -} - -// SetCopySourceIfMatch sets the CopySourceIfMatch field's value. -func (s *UploadPartCopyInput) SetCopySourceIfMatch(v string) *UploadPartCopyInput { - s.CopySourceIfMatch = &v - return s -} - -// SetCopySourceIfModifiedSince sets the CopySourceIfModifiedSince field's value. -func (s *UploadPartCopyInput) SetCopySourceIfModifiedSince(v time.Time) *UploadPartCopyInput { - s.CopySourceIfModifiedSince = &v - return s -} - -// SetCopySourceIfNoneMatch sets the CopySourceIfNoneMatch field's value. -func (s *UploadPartCopyInput) SetCopySourceIfNoneMatch(v string) *UploadPartCopyInput { - s.CopySourceIfNoneMatch = &v - return s -} - -// SetCopySourceIfUnmodifiedSince sets the CopySourceIfUnmodifiedSince field's value. -func (s *UploadPartCopyInput) SetCopySourceIfUnmodifiedSince(v time.Time) *UploadPartCopyInput { - s.CopySourceIfUnmodifiedSince = &v - return s -} - -// SetCopySourceRange sets the CopySourceRange field's value. -func (s *UploadPartCopyInput) SetCopySourceRange(v string) *UploadPartCopyInput { - s.CopySourceRange = &v - return s -} - -// SetCopySourceSSECustomerAlgorithm sets the CopySourceSSECustomerAlgorithm field's value. -func (s *UploadPartCopyInput) SetCopySourceSSECustomerAlgorithm(v string) *UploadPartCopyInput { - s.CopySourceSSECustomerAlgorithm = &v - return s -} - -// SetCopySourceSSECustomerKey sets the CopySourceSSECustomerKey field's value. -func (s *UploadPartCopyInput) SetCopySourceSSECustomerKey(v string) *UploadPartCopyInput { - s.CopySourceSSECustomerKey = &v - return s -} - -func (s *UploadPartCopyInput) getCopySourceSSECustomerKey() (v string) { - if s.CopySourceSSECustomerKey == nil { - return v - } - return *s.CopySourceSSECustomerKey -} - -// SetCopySourceSSECustomerKeyMD5 sets the CopySourceSSECustomerKeyMD5 field's value. -func (s *UploadPartCopyInput) SetCopySourceSSECustomerKeyMD5(v string) *UploadPartCopyInput { - s.CopySourceSSECustomerKeyMD5 = &v - return s -} - -// SetKey sets the Key field's value. -func (s *UploadPartCopyInput) SetKey(v string) *UploadPartCopyInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *UploadPartCopyInput) SetPartNumber(v int64) *UploadPartCopyInput { - s.PartNumber = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *UploadPartCopyInput) SetRequestPayer(v string) *UploadPartCopyInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartCopyInput) SetSSECustomerAlgorithm(v string) *UploadPartCopyInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *UploadPartCopyInput) SetSSECustomerKey(v string) *UploadPartCopyInput { - s.SSECustomerKey = &v - return s -} - -func (s *UploadPartCopyInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartCopyInput) SetSSECustomerKeyMD5(v string) *UploadPartCopyInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *UploadPartCopyInput) SetUploadId(v string) *UploadPartCopyInput { - s.UploadId = &v - return s -} - -func (s *UploadPartCopyInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *UploadPartCopyInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type UploadPartCopyOutput struct { - _ struct{} `type:"structure" payload:"CopyPartResult"` - - // Container for all response elements. - CopyPartResult *CopyPartResult `type:"structure"` - - // The version of the source object that was copied, if you have enabled versioning - // on the source bucket. - CopySourceVersionId *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) that was used for the - // object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` -} - -// String returns the string representation -func (s UploadPartCopyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartCopyOutput) GoString() string { - return s.String() -} - -// SetCopyPartResult sets the CopyPartResult field's value. -func (s *UploadPartCopyOutput) SetCopyPartResult(v *CopyPartResult) *UploadPartCopyOutput { - s.CopyPartResult = v - return s -} - -// SetCopySourceVersionId sets the CopySourceVersionId field's value. -func (s *UploadPartCopyOutput) SetCopySourceVersionId(v string) *UploadPartCopyOutput { - s.CopySourceVersionId = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *UploadPartCopyOutput) SetRequestCharged(v string) *UploadPartCopyOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartCopyOutput) SetSSECustomerAlgorithm(v string) *UploadPartCopyOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartCopyOutput) SetSSECustomerKeyMD5(v string) *UploadPartCopyOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *UploadPartCopyOutput) SetSSEKMSKeyId(v string) *UploadPartCopyOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *UploadPartCopyOutput) SetServerSideEncryption(v string) *UploadPartCopyOutput { - s.ServerSideEncryption = &v - return s -} - -type UploadPartInput struct { - _ struct{} `locationName:"UploadPartRequest" type:"structure" payload:"Body"` - - // Object data. - Body io.ReadSeeker `type:"blob"` - - // Name of the bucket to which the multipart upload was initiated. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // The base64-encoded 128-bit MD5 digest of the part data. This parameter is - // auto-populated when using the command from the CLI. This parameter is required - // if object lock parameters are specified. - ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` - - // Object key for which the multipart upload was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of part being uploaded. This is a positive integer between 1 - // and 10,000. - // - // PartNumber is a required field - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` - - // Confirms that the requester knows that they will be charged for the request. - // Bucket owners need not specify this parameter in their requests. For information - // about downloading objects from requester pays buckets, see Downloading Objects - // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) - // in the Amazon S3 Developer Guide. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (for example, - // AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. This must be the same encryption key specified in the initiate multipart - // upload request. - SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure that the - // encryption key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Upload ID identifying the multipart upload whose part is being uploaded. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s UploadPartInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UploadPartInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UploadPartInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Bucket != nil && len(*s.Bucket) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Bucket", 1)) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.PartNumber == nil { - invalidParams.Add(request.NewErrParamRequired("PartNumber")) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBody sets the Body field's value. -func (s *UploadPartInput) SetBody(v io.ReadSeeker) *UploadPartInput { - s.Body = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *UploadPartInput) SetBucket(v string) *UploadPartInput { - s.Bucket = &v - return s -} - -func (s *UploadPartInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContentLength sets the ContentLength field's value. -func (s *UploadPartInput) SetContentLength(v int64) *UploadPartInput { - s.ContentLength = &v - return s -} - -// SetContentMD5 sets the ContentMD5 field's value. -func (s *UploadPartInput) SetContentMD5(v string) *UploadPartInput { - s.ContentMD5 = &v - return s -} - -// SetKey sets the Key field's value. -func (s *UploadPartInput) SetKey(v string) *UploadPartInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *UploadPartInput) SetPartNumber(v int64) *UploadPartInput { - s.PartNumber = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *UploadPartInput) SetRequestPayer(v string) *UploadPartInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartInput) SetSSECustomerAlgorithm(v string) *UploadPartInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *UploadPartInput) SetSSECustomerKey(v string) *UploadPartInput { - s.SSECustomerKey = &v - return s -} - -func (s *UploadPartInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartInput) SetSSECustomerKeyMD5(v string) *UploadPartInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *UploadPartInput) SetUploadId(v string) *UploadPartInput { - s.UploadId = &v - return s -} - -func (s *UploadPartInput) getEndpointARN() (arn.Resource, error) { - if s.Bucket == nil { - return nil, fmt.Errorf("member Bucket is nil") - } - return parseEndpointARN(*s.Bucket) -} - -func (s *UploadPartInput) hasEndpointARN() bool { - if s.Bucket == nil { - return false - } - return arn.IsARN(*s.Bucket) -} - -type UploadPartOutput struct { - _ struct{} `type:"structure"` - - // Entity tag for the uploaded object. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round-trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (AWS KMS) - // symmetric customer managed customer master key (CMK) was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` - - // The server-side encryption algorithm used when storing this object in Amazon - // S3 (for example, AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` -} - -// String returns the string representation -func (s UploadPartOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartOutput) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *UploadPartOutput) SetETag(v string) *UploadPartOutput { - s.ETag = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *UploadPartOutput) SetRequestCharged(v string) *UploadPartOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartOutput) SetSSECustomerAlgorithm(v string) *UploadPartOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartOutput) SetSSECustomerKeyMD5(v string) *UploadPartOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *UploadPartOutput) SetSSEKMSKeyId(v string) *UploadPartOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *UploadPartOutput) SetServerSideEncryption(v string) *UploadPartOutput { - s.ServerSideEncryption = &v - return s -} - -// Describes the versioning state of an Amazon S3 bucket. For more information, -// see PUT Bucket versioning (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html) -// in the Amazon Simple Storage Service API Reference. -type VersioningConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies whether MFA delete is enabled in the bucket versioning configuration. - // This element is only returned if the bucket has been configured with MFA - // delete. If the bucket has never been so configured, this element is not returned. - MFADelete *string `locationName:"MfaDelete" type:"string" enum:"MFADelete"` - - // The versioning state of the bucket. - Status *string `type:"string" enum:"BucketVersioningStatus"` -} - -// String returns the string representation -func (s VersioningConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VersioningConfiguration) GoString() string { - return s.String() -} - -// SetMFADelete sets the MFADelete field's value. -func (s *VersioningConfiguration) SetMFADelete(v string) *VersioningConfiguration { - s.MFADelete = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *VersioningConfiguration) SetStatus(v string) *VersioningConfiguration { - s.Status = &v - return s -} - -// Specifies website configuration parameters for an Amazon S3 bucket. -type WebsiteConfiguration struct { - _ struct{} `type:"structure"` - - // The name of the error document for the website. - ErrorDocument *ErrorDocument `type:"structure"` - - // The name of the index document for the website. - IndexDocument *IndexDocument `type:"structure"` - - // The redirect behavior for every request to this bucket's website endpoint. - // - // If you specify this property, you can't specify any other property. - RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - - // Rules that define when a redirect is applied and the redirect behavior. - RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` -} - -// String returns the string representation -func (s WebsiteConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s WebsiteConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *WebsiteConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "WebsiteConfiguration"} - if s.ErrorDocument != nil { - if err := s.ErrorDocument.Validate(); err != nil { - invalidParams.AddNested("ErrorDocument", err.(request.ErrInvalidParams)) - } - } - if s.IndexDocument != nil { - if err := s.IndexDocument.Validate(); err != nil { - invalidParams.AddNested("IndexDocument", err.(request.ErrInvalidParams)) - } - } - if s.RedirectAllRequestsTo != nil { - if err := s.RedirectAllRequestsTo.Validate(); err != nil { - invalidParams.AddNested("RedirectAllRequestsTo", err.(request.ErrInvalidParams)) - } - } - if s.RoutingRules != nil { - for i, v := range s.RoutingRules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RoutingRules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetErrorDocument sets the ErrorDocument field's value. -func (s *WebsiteConfiguration) SetErrorDocument(v *ErrorDocument) *WebsiteConfiguration { - s.ErrorDocument = v - return s -} - -// SetIndexDocument sets the IndexDocument field's value. -func (s *WebsiteConfiguration) SetIndexDocument(v *IndexDocument) *WebsiteConfiguration { - s.IndexDocument = v - return s -} - -// SetRedirectAllRequestsTo sets the RedirectAllRequestsTo field's value. -func (s *WebsiteConfiguration) SetRedirectAllRequestsTo(v *RedirectAllRequestsTo) *WebsiteConfiguration { - s.RedirectAllRequestsTo = v - return s -} - -// SetRoutingRules sets the RoutingRules field's value. -func (s *WebsiteConfiguration) SetRoutingRules(v []*RoutingRule) *WebsiteConfiguration { - s.RoutingRules = v - return s -} - -const ( - // AnalyticsS3ExportFileFormatCsv is a AnalyticsS3ExportFileFormat enum value - AnalyticsS3ExportFileFormatCsv = "CSV" -) - -const ( - // BucketAccelerateStatusEnabled is a BucketAccelerateStatus enum value - BucketAccelerateStatusEnabled = "Enabled" - - // BucketAccelerateStatusSuspended is a BucketAccelerateStatus enum value - BucketAccelerateStatusSuspended = "Suspended" -) - -const ( - // BucketCannedACLPrivate is a BucketCannedACL enum value - BucketCannedACLPrivate = "private" - - // BucketCannedACLPublicRead is a BucketCannedACL enum value - BucketCannedACLPublicRead = "public-read" - - // BucketCannedACLPublicReadWrite is a BucketCannedACL enum value - BucketCannedACLPublicReadWrite = "public-read-write" - - // BucketCannedACLAuthenticatedRead is a BucketCannedACL enum value - BucketCannedACLAuthenticatedRead = "authenticated-read" -) - -const ( - // BucketLocationConstraintEu is a BucketLocationConstraint enum value - BucketLocationConstraintEu = "EU" - - // BucketLocationConstraintEuWest1 is a BucketLocationConstraint enum value - BucketLocationConstraintEuWest1 = "eu-west-1" - - // BucketLocationConstraintUsWest1 is a BucketLocationConstraint enum value - BucketLocationConstraintUsWest1 = "us-west-1" - - // BucketLocationConstraintUsWest2 is a BucketLocationConstraint enum value - BucketLocationConstraintUsWest2 = "us-west-2" - - // BucketLocationConstraintApSouth1 is a BucketLocationConstraint enum value - BucketLocationConstraintApSouth1 = "ap-south-1" - - // BucketLocationConstraintApSoutheast1 is a BucketLocationConstraint enum value - BucketLocationConstraintApSoutheast1 = "ap-southeast-1" - - // BucketLocationConstraintApSoutheast2 is a BucketLocationConstraint enum value - BucketLocationConstraintApSoutheast2 = "ap-southeast-2" - - // BucketLocationConstraintApNortheast1 is a BucketLocationConstraint enum value - BucketLocationConstraintApNortheast1 = "ap-northeast-1" - - // BucketLocationConstraintSaEast1 is a BucketLocationConstraint enum value - BucketLocationConstraintSaEast1 = "sa-east-1" - - // BucketLocationConstraintCnNorth1 is a BucketLocationConstraint enum value - BucketLocationConstraintCnNorth1 = "cn-north-1" - - // BucketLocationConstraintEuCentral1 is a BucketLocationConstraint enum value - BucketLocationConstraintEuCentral1 = "eu-central-1" -) - -const ( - // BucketLogsPermissionFullControl is a BucketLogsPermission enum value - BucketLogsPermissionFullControl = "FULL_CONTROL" - - // BucketLogsPermissionRead is a BucketLogsPermission enum value - BucketLogsPermissionRead = "READ" - - // BucketLogsPermissionWrite is a BucketLogsPermission enum value - BucketLogsPermissionWrite = "WRITE" -) - -const ( - // BucketVersioningStatusEnabled is a BucketVersioningStatus enum value - BucketVersioningStatusEnabled = "Enabled" - - // BucketVersioningStatusSuspended is a BucketVersioningStatus enum value - BucketVersioningStatusSuspended = "Suspended" -) - -const ( - // CompressionTypeNone is a CompressionType enum value - CompressionTypeNone = "NONE" - - // CompressionTypeGzip is a CompressionType enum value - CompressionTypeGzip = "GZIP" - - // CompressionTypeBzip2 is a CompressionType enum value - CompressionTypeBzip2 = "BZIP2" -) - -const ( - // DeleteMarkerReplicationStatusEnabled is a DeleteMarkerReplicationStatus enum value - DeleteMarkerReplicationStatusEnabled = "Enabled" - - // DeleteMarkerReplicationStatusDisabled is a DeleteMarkerReplicationStatus enum value - DeleteMarkerReplicationStatusDisabled = "Disabled" -) - -// Requests Amazon S3 to encode the object keys in the response and specifies -// the encoding method to use. An object key may contain any Unicode character; -// however, XML 1.0 parser cannot parse some characters, such as characters -// with an ASCII value from 0 to 10. For characters that are not supported in -// XML 1.0, you can add this parameter to request that Amazon S3 encode the -// keys in the response. -const ( - // EncodingTypeUrl is a EncodingType enum value - EncodingTypeUrl = "url" -) - -// The bucket event for which to send notifications. -const ( - // EventS3ReducedRedundancyLostObject is a Event enum value - EventS3ReducedRedundancyLostObject = "s3:ReducedRedundancyLostObject" - - // EventS3ObjectCreated is a Event enum value - EventS3ObjectCreated = "s3:ObjectCreated:*" - - // EventS3ObjectCreatedPut is a Event enum value - EventS3ObjectCreatedPut = "s3:ObjectCreated:Put" - - // EventS3ObjectCreatedPost is a Event enum value - EventS3ObjectCreatedPost = "s3:ObjectCreated:Post" - - // EventS3ObjectCreatedCopy is a Event enum value - EventS3ObjectCreatedCopy = "s3:ObjectCreated:Copy" - - // EventS3ObjectCreatedCompleteMultipartUpload is a Event enum value - EventS3ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload" - - // EventS3ObjectRemoved is a Event enum value - EventS3ObjectRemoved = "s3:ObjectRemoved:*" - - // EventS3ObjectRemovedDelete is a Event enum value - EventS3ObjectRemovedDelete = "s3:ObjectRemoved:Delete" - - // EventS3ObjectRemovedDeleteMarkerCreated is a Event enum value - EventS3ObjectRemovedDeleteMarkerCreated = "s3:ObjectRemoved:DeleteMarkerCreated" - - // EventS3ObjectRestore is a Event enum value - EventS3ObjectRestore = "s3:ObjectRestore:*" - - // EventS3ObjectRestorePost is a Event enum value - EventS3ObjectRestorePost = "s3:ObjectRestore:Post" - - // EventS3ObjectRestoreCompleted is a Event enum value - EventS3ObjectRestoreCompleted = "s3:ObjectRestore:Completed" - - // EventS3Replication is a Event enum value - EventS3Replication = "s3:Replication:*" - - // EventS3ReplicationOperationFailedReplication is a Event enum value - EventS3ReplicationOperationFailedReplication = "s3:Replication:OperationFailedReplication" - - // EventS3ReplicationOperationNotTracked is a Event enum value - EventS3ReplicationOperationNotTracked = "s3:Replication:OperationNotTracked" - - // EventS3ReplicationOperationMissedThreshold is a Event enum value - EventS3ReplicationOperationMissedThreshold = "s3:Replication:OperationMissedThreshold" - - // EventS3ReplicationOperationReplicatedAfterThreshold is a Event enum value - EventS3ReplicationOperationReplicatedAfterThreshold = "s3:Replication:OperationReplicatedAfterThreshold" -) - -const ( - // ExistingObjectReplicationStatusEnabled is a ExistingObjectReplicationStatus enum value - ExistingObjectReplicationStatusEnabled = "Enabled" - - // ExistingObjectReplicationStatusDisabled is a ExistingObjectReplicationStatus enum value - ExistingObjectReplicationStatusDisabled = "Disabled" -) - -const ( - // ExpirationStatusEnabled is a ExpirationStatus enum value - ExpirationStatusEnabled = "Enabled" - - // ExpirationStatusDisabled is a ExpirationStatus enum value - ExpirationStatusDisabled = "Disabled" -) - -const ( - // ExpressionTypeSql is a ExpressionType enum value - ExpressionTypeSql = "SQL" -) - -const ( - // FileHeaderInfoUse is a FileHeaderInfo enum value - FileHeaderInfoUse = "USE" - - // FileHeaderInfoIgnore is a FileHeaderInfo enum value - FileHeaderInfoIgnore = "IGNORE" - - // FileHeaderInfoNone is a FileHeaderInfo enum value - FileHeaderInfoNone = "NONE" -) - -const ( - // FilterRuleNamePrefix is a FilterRuleName enum value - FilterRuleNamePrefix = "prefix" - - // FilterRuleNameSuffix is a FilterRuleName enum value - FilterRuleNameSuffix = "suffix" -) - -const ( - // InventoryFormatCsv is a InventoryFormat enum value - InventoryFormatCsv = "CSV" - - // InventoryFormatOrc is a InventoryFormat enum value - InventoryFormatOrc = "ORC" - - // InventoryFormatParquet is a InventoryFormat enum value - InventoryFormatParquet = "Parquet" -) - -const ( - // InventoryFrequencyDaily is a InventoryFrequency enum value - InventoryFrequencyDaily = "Daily" - - // InventoryFrequencyWeekly is a InventoryFrequency enum value - InventoryFrequencyWeekly = "Weekly" -) - -const ( - // InventoryIncludedObjectVersionsAll is a InventoryIncludedObjectVersions enum value - InventoryIncludedObjectVersionsAll = "All" - - // InventoryIncludedObjectVersionsCurrent is a InventoryIncludedObjectVersions enum value - InventoryIncludedObjectVersionsCurrent = "Current" -) - -const ( - // InventoryOptionalFieldSize is a InventoryOptionalField enum value - InventoryOptionalFieldSize = "Size" - - // InventoryOptionalFieldLastModifiedDate is a InventoryOptionalField enum value - InventoryOptionalFieldLastModifiedDate = "LastModifiedDate" - - // InventoryOptionalFieldStorageClass is a InventoryOptionalField enum value - InventoryOptionalFieldStorageClass = "StorageClass" - - // InventoryOptionalFieldEtag is a InventoryOptionalField enum value - InventoryOptionalFieldEtag = "ETag" - - // InventoryOptionalFieldIsMultipartUploaded is a InventoryOptionalField enum value - InventoryOptionalFieldIsMultipartUploaded = "IsMultipartUploaded" - - // InventoryOptionalFieldReplicationStatus is a InventoryOptionalField enum value - InventoryOptionalFieldReplicationStatus = "ReplicationStatus" - - // InventoryOptionalFieldEncryptionStatus is a InventoryOptionalField enum value - InventoryOptionalFieldEncryptionStatus = "EncryptionStatus" - - // InventoryOptionalFieldObjectLockRetainUntilDate is a InventoryOptionalField enum value - InventoryOptionalFieldObjectLockRetainUntilDate = "ObjectLockRetainUntilDate" - - // InventoryOptionalFieldObjectLockMode is a InventoryOptionalField enum value - InventoryOptionalFieldObjectLockMode = "ObjectLockMode" - - // InventoryOptionalFieldObjectLockLegalHoldStatus is a InventoryOptionalField enum value - InventoryOptionalFieldObjectLockLegalHoldStatus = "ObjectLockLegalHoldStatus" - - // InventoryOptionalFieldIntelligentTieringAccessTier is a InventoryOptionalField enum value - InventoryOptionalFieldIntelligentTieringAccessTier = "IntelligentTieringAccessTier" -) - -const ( - // JSONTypeDocument is a JSONType enum value - JSONTypeDocument = "DOCUMENT" - - // JSONTypeLines is a JSONType enum value - JSONTypeLines = "LINES" -) - -const ( - // MFADeleteEnabled is a MFADelete enum value - MFADeleteEnabled = "Enabled" - - // MFADeleteDisabled is a MFADelete enum value - MFADeleteDisabled = "Disabled" -) - -const ( - // MFADeleteStatusEnabled is a MFADeleteStatus enum value - MFADeleteStatusEnabled = "Enabled" - - // MFADeleteStatusDisabled is a MFADeleteStatus enum value - MFADeleteStatusDisabled = "Disabled" -) - -const ( - // MetadataDirectiveCopy is a MetadataDirective enum value - MetadataDirectiveCopy = "COPY" - - // MetadataDirectiveReplace is a MetadataDirective enum value - MetadataDirectiveReplace = "REPLACE" -) - -const ( - // MetricsStatusEnabled is a MetricsStatus enum value - MetricsStatusEnabled = "Enabled" - - // MetricsStatusDisabled is a MetricsStatus enum value - MetricsStatusDisabled = "Disabled" -) - -const ( - // ObjectCannedACLPrivate is a ObjectCannedACL enum value - ObjectCannedACLPrivate = "private" - - // ObjectCannedACLPublicRead is a ObjectCannedACL enum value - ObjectCannedACLPublicRead = "public-read" - - // ObjectCannedACLPublicReadWrite is a ObjectCannedACL enum value - ObjectCannedACLPublicReadWrite = "public-read-write" - - // ObjectCannedACLAuthenticatedRead is a ObjectCannedACL enum value - ObjectCannedACLAuthenticatedRead = "authenticated-read" - - // ObjectCannedACLAwsExecRead is a ObjectCannedACL enum value - ObjectCannedACLAwsExecRead = "aws-exec-read" - - // ObjectCannedACLBucketOwnerRead is a ObjectCannedACL enum value - ObjectCannedACLBucketOwnerRead = "bucket-owner-read" - - // ObjectCannedACLBucketOwnerFullControl is a ObjectCannedACL enum value - ObjectCannedACLBucketOwnerFullControl = "bucket-owner-full-control" -) - -const ( - // ObjectLockEnabledEnabled is a ObjectLockEnabled enum value - ObjectLockEnabledEnabled = "Enabled" -) - -const ( - // ObjectLockLegalHoldStatusOn is a ObjectLockLegalHoldStatus enum value - ObjectLockLegalHoldStatusOn = "ON" - - // ObjectLockLegalHoldStatusOff is a ObjectLockLegalHoldStatus enum value - ObjectLockLegalHoldStatusOff = "OFF" -) - -const ( - // ObjectLockModeGovernance is a ObjectLockMode enum value - ObjectLockModeGovernance = "GOVERNANCE" - - // ObjectLockModeCompliance is a ObjectLockMode enum value - ObjectLockModeCompliance = "COMPLIANCE" -) - -const ( - // ObjectLockRetentionModeGovernance is a ObjectLockRetentionMode enum value - ObjectLockRetentionModeGovernance = "GOVERNANCE" - - // ObjectLockRetentionModeCompliance is a ObjectLockRetentionMode enum value - ObjectLockRetentionModeCompliance = "COMPLIANCE" -) - -const ( - // ObjectStorageClassStandard is a ObjectStorageClass enum value - ObjectStorageClassStandard = "STANDARD" - - // ObjectStorageClassReducedRedundancy is a ObjectStorageClass enum value - ObjectStorageClassReducedRedundancy = "REDUCED_REDUNDANCY" - - // ObjectStorageClassGlacier is a ObjectStorageClass enum value - ObjectStorageClassGlacier = "GLACIER" - - // ObjectStorageClassStandardIa is a ObjectStorageClass enum value - ObjectStorageClassStandardIa = "STANDARD_IA" - - // ObjectStorageClassOnezoneIa is a ObjectStorageClass enum value - ObjectStorageClassOnezoneIa = "ONEZONE_IA" - - // ObjectStorageClassIntelligentTiering is a ObjectStorageClass enum value - ObjectStorageClassIntelligentTiering = "INTELLIGENT_TIERING" - - // ObjectStorageClassDeepArchive is a ObjectStorageClass enum value - ObjectStorageClassDeepArchive = "DEEP_ARCHIVE" -) - -const ( - // ObjectVersionStorageClassStandard is a ObjectVersionStorageClass enum value - ObjectVersionStorageClassStandard = "STANDARD" -) - -const ( - // OwnerOverrideDestination is a OwnerOverride enum value - OwnerOverrideDestination = "Destination" -) - -const ( - // PayerRequester is a Payer enum value - PayerRequester = "Requester" - - // PayerBucketOwner is a Payer enum value - PayerBucketOwner = "BucketOwner" -) - -const ( - // PermissionFullControl is a Permission enum value - PermissionFullControl = "FULL_CONTROL" - - // PermissionWrite is a Permission enum value - PermissionWrite = "WRITE" - - // PermissionWriteAcp is a Permission enum value - PermissionWriteAcp = "WRITE_ACP" - - // PermissionRead is a Permission enum value - PermissionRead = "READ" - - // PermissionReadAcp is a Permission enum value - PermissionReadAcp = "READ_ACP" -) - -const ( - // ProtocolHttp is a Protocol enum value - ProtocolHttp = "http" - - // ProtocolHttps is a Protocol enum value - ProtocolHttps = "https" -) - -const ( - // QuoteFieldsAlways is a QuoteFields enum value - QuoteFieldsAlways = "ALWAYS" - - // QuoteFieldsAsneeded is a QuoteFields enum value - QuoteFieldsAsneeded = "ASNEEDED" -) - -const ( - // ReplicationRuleStatusEnabled is a ReplicationRuleStatus enum value - ReplicationRuleStatusEnabled = "Enabled" - - // ReplicationRuleStatusDisabled is a ReplicationRuleStatus enum value - ReplicationRuleStatusDisabled = "Disabled" -) - -const ( - // ReplicationStatusComplete is a ReplicationStatus enum value - ReplicationStatusComplete = "COMPLETE" - - // ReplicationStatusPending is a ReplicationStatus enum value - ReplicationStatusPending = "PENDING" - - // ReplicationStatusFailed is a ReplicationStatus enum value - ReplicationStatusFailed = "FAILED" - - // ReplicationStatusReplica is a ReplicationStatus enum value - ReplicationStatusReplica = "REPLICA" -) - -const ( - // ReplicationTimeStatusEnabled is a ReplicationTimeStatus enum value - ReplicationTimeStatusEnabled = "Enabled" - - // ReplicationTimeStatusDisabled is a ReplicationTimeStatus enum value - ReplicationTimeStatusDisabled = "Disabled" -) - -// If present, indicates that the requester was successfully charged for the -// request. -const ( - // RequestChargedRequester is a RequestCharged enum value - RequestChargedRequester = "requester" -) - -// Confirms that the requester knows that they will be charged for the request. -// Bucket owners need not specify this parameter in their requests. For information -// about downloading objects from requester pays buckets, see Downloading Objects -// in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) -// in the Amazon S3 Developer Guide. -const ( - // RequestPayerRequester is a RequestPayer enum value - RequestPayerRequester = "requester" -) - -const ( - // RestoreRequestTypeSelect is a RestoreRequestType enum value - RestoreRequestTypeSelect = "SELECT" -) - -const ( - // ServerSideEncryptionAes256 is a ServerSideEncryption enum value - ServerSideEncryptionAes256 = "AES256" - - // ServerSideEncryptionAwsKms is a ServerSideEncryption enum value - ServerSideEncryptionAwsKms = "aws:kms" -) - -const ( - // SseKmsEncryptedObjectsStatusEnabled is a SseKmsEncryptedObjectsStatus enum value - SseKmsEncryptedObjectsStatusEnabled = "Enabled" - - // SseKmsEncryptedObjectsStatusDisabled is a SseKmsEncryptedObjectsStatus enum value - SseKmsEncryptedObjectsStatusDisabled = "Disabled" -) - -const ( - // StorageClassStandard is a StorageClass enum value - StorageClassStandard = "STANDARD" - - // StorageClassReducedRedundancy is a StorageClass enum value - StorageClassReducedRedundancy = "REDUCED_REDUNDANCY" - - // StorageClassStandardIa is a StorageClass enum value - StorageClassStandardIa = "STANDARD_IA" - - // StorageClassOnezoneIa is a StorageClass enum value - StorageClassOnezoneIa = "ONEZONE_IA" - - // StorageClassIntelligentTiering is a StorageClass enum value - StorageClassIntelligentTiering = "INTELLIGENT_TIERING" - - // StorageClassGlacier is a StorageClass enum value - StorageClassGlacier = "GLACIER" - - // StorageClassDeepArchive is a StorageClass enum value - StorageClassDeepArchive = "DEEP_ARCHIVE" -) - -const ( - // StorageClassAnalysisSchemaVersionV1 is a StorageClassAnalysisSchemaVersion enum value - StorageClassAnalysisSchemaVersionV1 = "V_1" -) - -const ( - // TaggingDirectiveCopy is a TaggingDirective enum value - TaggingDirectiveCopy = "COPY" - - // TaggingDirectiveReplace is a TaggingDirective enum value - TaggingDirectiveReplace = "REPLACE" -) - -const ( - // TierStandard is a Tier enum value - TierStandard = "Standard" - - // TierBulk is a Tier enum value - TierBulk = "Bulk" - - // TierExpedited is a Tier enum value - TierExpedited = "Expedited" -) - -const ( - // TransitionStorageClassGlacier is a TransitionStorageClass enum value - TransitionStorageClassGlacier = "GLACIER" - - // TransitionStorageClassStandardIa is a TransitionStorageClass enum value - TransitionStorageClassStandardIa = "STANDARD_IA" - - // TransitionStorageClassOnezoneIa is a TransitionStorageClass enum value - TransitionStorageClassOnezoneIa = "ONEZONE_IA" - - // TransitionStorageClassIntelligentTiering is a TransitionStorageClass enum value - TransitionStorageClassIntelligentTiering = "INTELLIGENT_TIERING" - - // TransitionStorageClassDeepArchive is a TransitionStorageClass enum value - TransitionStorageClassDeepArchive = "DEEP_ARCHIVE" -) - -const ( - // TypeCanonicalUser is a Type enum value - TypeCanonicalUser = "CanonicalUser" - - // TypeAmazonCustomerByEmail is a Type enum value - TypeAmazonCustomerByEmail = "AmazonCustomerByEmail" - - // TypeGroup is a Type enum value - TypeGroup = "Group" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/body_hash.go b/vendor/github.com/aws/aws-sdk-go/service/s3/body_hash.go deleted file mode 100644 index 407f06b6e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/body_hash.go +++ /dev/null @@ -1,202 +0,0 @@ -package s3 - -import ( - "bytes" - "crypto/md5" - "crypto/sha256" - "encoding/base64" - "encoding/hex" - "fmt" - "hash" - "io" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -const ( - contentMD5Header = "Content-Md5" - contentSha256Header = "X-Amz-Content-Sha256" - amzTeHeader = "X-Amz-Te" - amzTxEncodingHeader = "X-Amz-Transfer-Encoding" - - appendMD5TxEncoding = "append-md5" -) - -// computeBodyHashes will add Content MD5 and Content Sha256 hashes to the -// request. If the body is not seekable or S3DisableContentMD5Validation set -// this handler will be ignored. -func computeBodyHashes(r *request.Request) { - if aws.BoolValue(r.Config.S3DisableContentMD5Validation) { - return - } - if r.IsPresigned() { - return - } - if r.Error != nil || !aws.IsReaderSeekable(r.Body) { - return - } - - var md5Hash, sha256Hash hash.Hash - hashers := make([]io.Writer, 0, 2) - - // Determine upfront which hashes can be set without overriding user - // provide header data. - if v := r.HTTPRequest.Header.Get(contentMD5Header); len(v) == 0 { - md5Hash = md5.New() - hashers = append(hashers, md5Hash) - } - - if v := r.HTTPRequest.Header.Get(contentSha256Header); len(v) == 0 { - sha256Hash = sha256.New() - hashers = append(hashers, sha256Hash) - } - - // Create the destination writer based on the hashes that are not already - // provided by the user. - var dst io.Writer - switch len(hashers) { - case 0: - return - case 1: - dst = hashers[0] - default: - dst = io.MultiWriter(hashers...) - } - - if _, err := aws.CopySeekableBody(dst, r.Body); err != nil { - r.Error = awserr.New("BodyHashError", "failed to compute body hashes", err) - return - } - - // For the hashes created, set the associated headers that the user did not - // already provide. - if md5Hash != nil { - sum := make([]byte, md5.Size) - encoded := make([]byte, md5Base64EncLen) - - base64.StdEncoding.Encode(encoded, md5Hash.Sum(sum[0:0])) - r.HTTPRequest.Header[contentMD5Header] = []string{string(encoded)} - } - - if sha256Hash != nil { - encoded := make([]byte, sha256HexEncLen) - sum := make([]byte, sha256.Size) - - hex.Encode(encoded, sha256Hash.Sum(sum[0:0])) - r.HTTPRequest.Header[contentSha256Header] = []string{string(encoded)} - } -} - -const ( - md5Base64EncLen = (md5.Size + 2) / 3 * 4 // base64.StdEncoding.EncodedLen - sha256HexEncLen = sha256.Size * 2 // hex.EncodedLen -) - -// Adds the x-amz-te: append_md5 header to the request. This requests the service -// responds with a trailing MD5 checksum. -// -// Will not ask for append MD5 if disabled, the request is presigned or, -// or the API operation does not support content MD5 validation. -func askForTxEncodingAppendMD5(r *request.Request) { - if aws.BoolValue(r.Config.S3DisableContentMD5Validation) { - return - } - if r.IsPresigned() { - return - } - r.HTTPRequest.Header.Set(amzTeHeader, appendMD5TxEncoding) -} - -func useMD5ValidationReader(r *request.Request) { - if r.Error != nil { - return - } - - if v := r.HTTPResponse.Header.Get(amzTxEncodingHeader); v != appendMD5TxEncoding { - return - } - - var bodyReader *io.ReadCloser - var contentLen int64 - switch tv := r.Data.(type) { - case *GetObjectOutput: - bodyReader = &tv.Body - contentLen = aws.Int64Value(tv.ContentLength) - // Update ContentLength hiden the trailing MD5 checksum. - tv.ContentLength = aws.Int64(contentLen - md5.Size) - tv.ContentRange = aws.String(r.HTTPResponse.Header.Get("X-Amz-Content-Range")) - default: - r.Error = awserr.New("ChecksumValidationError", - fmt.Sprintf("%s: %s header received on unsupported API, %s", - amzTxEncodingHeader, appendMD5TxEncoding, r.Operation.Name, - ), nil) - return - } - - if contentLen < md5.Size { - r.Error = awserr.New("ChecksumValidationError", - fmt.Sprintf("invalid Content-Length %d for %s %s", - contentLen, appendMD5TxEncoding, amzTxEncodingHeader, - ), nil) - return - } - - // Wrap and swap the response body reader with the validation reader. - *bodyReader = newMD5ValidationReader(*bodyReader, contentLen-md5.Size) -} - -type md5ValidationReader struct { - rawReader io.ReadCloser - payload io.Reader - hash hash.Hash - - payloadLen int64 - read int64 -} - -func newMD5ValidationReader(reader io.ReadCloser, payloadLen int64) *md5ValidationReader { - h := md5.New() - return &md5ValidationReader{ - rawReader: reader, - payload: io.TeeReader(&io.LimitedReader{R: reader, N: payloadLen}, h), - hash: h, - payloadLen: payloadLen, - } -} - -func (v *md5ValidationReader) Read(p []byte) (n int, err error) { - n, err = v.payload.Read(p) - if err != nil && err != io.EOF { - return n, err - } - - v.read += int64(n) - - if err == io.EOF { - if v.read != v.payloadLen { - return n, io.ErrUnexpectedEOF - } - expectSum := make([]byte, md5.Size) - actualSum := make([]byte, md5.Size) - if _, sumReadErr := io.ReadFull(v.rawReader, expectSum); sumReadErr != nil { - return n, sumReadErr - } - actualSum = v.hash.Sum(actualSum[0:0]) - if !bytes.Equal(expectSum, actualSum) { - return n, awserr.New("InvalidChecksum", - fmt.Sprintf("expected MD5 checksum %s, got %s", - hex.EncodeToString(expectSum), - hex.EncodeToString(actualSum), - ), - nil) - } - } - - return n, err -} - -func (v *md5ValidationReader) Close() error { - return v.rawReader.Close() -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go deleted file mode 100644 index 9ba8a7887..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go +++ /dev/null @@ -1,107 +0,0 @@ -package s3 - -import ( - "io/ioutil" - "regexp" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" -) - -var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) - -// NormalizeBucketLocation is a utility function which will update the -// passed in value to always be a region ID. Generally this would be used -// with GetBucketLocation API operation. -// -// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html -// for more information on the values that can be returned. -func NormalizeBucketLocation(loc string) string { - switch loc { - case "": - loc = "us-east-1" - case "EU": - loc = "eu-west-1" - } - - return loc -} - -// NormalizeBucketLocationHandler is a request handler which will update the -// GetBucketLocation's result LocationConstraint value to always be a region ID. -// -// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html -// for more information on the values that can be returned. -// -// req, result := svc.GetBucketLocationRequest(&s3.GetBucketLocationInput{ -// Bucket: aws.String(bucket), -// }) -// req.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler) -// err := req.Send() -var NormalizeBucketLocationHandler = request.NamedHandler{ - Name: "awssdk.s3.NormalizeBucketLocation", - Fn: func(req *request.Request) { - if req.Error != nil { - return - } - - out := req.Data.(*GetBucketLocationOutput) - loc := NormalizeBucketLocation(aws.StringValue(out.LocationConstraint)) - out.LocationConstraint = aws.String(loc) - }, -} - -// WithNormalizeBucketLocation is a request option which will update the -// GetBucketLocation's result LocationConstraint value to always be a region ID. -// -// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html -// for more information on the values that can be returned. -// -// result, err := svc.GetBucketLocationWithContext(ctx, -// &s3.GetBucketLocationInput{ -// Bucket: aws.String(bucket), -// }, -// s3.WithNormalizeBucketLocation, -// ) -func WithNormalizeBucketLocation(r *request.Request) { - r.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler) -} - -func buildGetBucketLocation(r *request.Request) { - if r.DataFilled() { - out := r.Data.(*GetBucketLocationOutput) - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New(request.ErrCodeSerialization, - "failed reading response body", err) - return - } - - match := reBucketLocation.FindSubmatch(b) - if len(match) > 1 { - loc := string(match[1]) - out.LocationConstraint = aws.String(loc) - } - } -} - -func populateLocationConstraint(r *request.Request) { - if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" { - in := r.Params.(*CreateBucketInput) - if in.CreateBucketConfiguration == nil { - r.Params = awsutil.CopyOf(r.Params) - in = r.Params.(*CreateBucketInput) - in.CreateBucketConfiguration = &CreateBucketConfiguration{ - LocationConstraint: r.Config.Region, - } - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go deleted file mode 100644 index a7698d5eb..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go +++ /dev/null @@ -1,75 +0,0 @@ -package s3 - -import ( - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/s3err" - "github.com/aws/aws-sdk-go/service/s3/internal/arn" -) - -func init() { - initClient = defaultInitClientFn - initRequest = defaultInitRequestFn -} - -func defaultInitClientFn(c *client.Client) { - // Support building custom endpoints based on config - c.Handlers.Build.PushFront(endpointHandler) - - // Require SSL when using SSE keys - c.Handlers.Validate.PushBack(validateSSERequiresSSL) - c.Handlers.Build.PushBack(computeSSEKeyMD5) - c.Handlers.Build.PushBack(computeCopySourceSSEKeyMD5) - - // S3 uses custom error unmarshaling logic - c.Handlers.UnmarshalError.Clear() - c.Handlers.UnmarshalError.PushBack(unmarshalError) - c.Handlers.UnmarshalError.PushBackNamed(s3err.RequestFailureWrapperHandler()) -} - -func defaultInitRequestFn(r *request.Request) { - // Add request handlers for specific platforms. - // e.g. 100-continue support for PUT requests using Go 1.6 - platformRequestHandlers(r) - - switch r.Operation.Name { - case opGetBucketLocation: - // GetBucketLocation has custom parsing logic - r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) - case opCreateBucket: - // Auto-populate LocationConstraint with current region - r.Handlers.Validate.PushFront(populateLocationConstraint) - case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: - r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) - r.Handlers.Unmarshal.PushBackNamed(s3err.RequestFailureWrapperHandler()) - case opPutObject, opUploadPart: - r.Handlers.Build.PushBack(computeBodyHashes) - // Disabled until #1837 root issue is resolved. - // case opGetObject: - // r.Handlers.Build.PushBack(askForTxEncodingAppendMD5) - // r.Handlers.Unmarshal.PushBack(useMD5ValidationReader) - } -} - -// bucketGetter is an accessor interface to grab the "Bucket" field from -// an S3 type. -type bucketGetter interface { - getBucket() string -} - -// sseCustomerKeyGetter is an accessor interface to grab the "SSECustomerKey" -// field from an S3 type. -type sseCustomerKeyGetter interface { - getSSECustomerKey() string -} - -// copySourceSSECustomerKeyGetter is an accessor interface to grab the -// "CopySourceSSECustomerKey" field from an S3 type. -type copySourceSSECustomerKeyGetter interface { - getCopySourceSSECustomerKey() string -} - -type endpointARNGetter interface { - getEndpointARN() (arn.Resource, error) - hasEndpointARN() bool -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/doc.go b/vendor/github.com/aws/aws-sdk-go/service/s3/doc.go deleted file mode 100644 index 0def02255..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package s3 provides the client and types for making API -// requests to Amazon Simple Storage Service. -// -// See https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01 for more information on this service. -// -// See s3 package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/ -// -// Using the Client -// -// To contact Amazon Simple Storage Service with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the Amazon Simple Storage Service client S3 for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#New -package s3 diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go b/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go deleted file mode 100644 index 4b65f7153..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go +++ /dev/null @@ -1,123 +0,0 @@ -// Upload Managers -// -// The s3manager package's Uploader provides concurrent upload of content to S3 -// by taking advantage of S3's Multipart APIs. The Uploader also supports both -// io.Reader for streaming uploads, and will also take advantage of io.ReadSeeker -// for optimizations if the Body satisfies that type. Once the Uploader instance -// is created you can call Upload concurrently from multiple goroutines safely. -// -// // The session the S3 Uploader will use -// sess := session.Must(session.NewSession()) -// -// // Create an uploader with the session and default options -// uploader := s3manager.NewUploader(sess) -// -// f, err := os.Open(filename) -// if err != nil { -// return fmt.Errorf("failed to open file %q, %v", filename, err) -// } -// -// // Upload the file to S3. -// result, err := uploader.Upload(&s3manager.UploadInput{ -// Bucket: aws.String(myBucket), -// Key: aws.String(myString), -// Body: f, -// }) -// if err != nil { -// return fmt.Errorf("failed to upload file, %v", err) -// } -// fmt.Printf("file uploaded to, %s\n", aws.StringValue(result.Location)) -// -// See the s3manager package's Uploader type documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Uploader -// -// Download Manager -// -// The s3manager package's Downloader provides concurrently downloading of Objects -// from S3. The Downloader will write S3 Object content with an io.WriterAt. -// Once the Downloader instance is created you can call Download concurrently from -// multiple goroutines safely. -// -// // The session the S3 Downloader will use -// sess := session.Must(session.NewSession()) -// -// // Create a downloader with the session and default options -// downloader := s3manager.NewDownloader(sess) -// -// // Create a file to write the S3 Object contents to. -// f, err := os.Create(filename) -// if err != nil { -// return fmt.Errorf("failed to create file %q, %v", filename, err) -// } -// -// // Write the contents of S3 Object to the file -// n, err := downloader.Download(f, &s3.GetObjectInput{ -// Bucket: aws.String(myBucket), -// Key: aws.String(myString), -// }) -// if err != nil { -// return fmt.Errorf("failed to download file, %v", err) -// } -// fmt.Printf("file downloaded, %d bytes\n", n) -// -// See the s3manager package's Downloader type documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader -// -// Automatic URI cleaning -// -// Interacting with objects whose keys contain adjacent slashes (e.g. bucketname/foo//bar/objectname) -// requires setting DisableRestProtocolURICleaning to true in the aws.Config struct -// used by the service client. -// -// svc := s3.New(sess, &aws.Config{ -// DisableRestProtocolURICleaning: aws.Bool(true), -// }) -// out, err := svc.GetObject(&s3.GetObjectInput { -// Bucket: aws.String("bucketname"), -// Key: aws.String("//foo//bar//moo"), -// }) -// -// Get Bucket Region -// -// GetBucketRegion will attempt to get the region for a bucket using a region -// hint to determine which AWS partition to perform the query on. Use this utility -// to determine the region a bucket is in. -// -// sess := session.Must(session.NewSession()) -// -// bucket := "my-bucket" -// region, err := s3manager.GetBucketRegion(ctx, sess, bucket, "us-west-2") -// if err != nil { -// if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "NotFound" { -// fmt.Fprintf(os.Stderr, "unable to find bucket %s's region not found\n", bucket) -// } -// return err -// } -// fmt.Printf("Bucket %s is in %s region\n", bucket, region) -// -// See the s3manager package's GetBucketRegion function documentation for more information -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#GetBucketRegion -// -// S3 Crypto Client -// -// The s3crypto package provides the tools to upload and download encrypted -// content from S3. The Encryption and Decryption clients can be used concurrently -// once the client is created. -// -// sess := session.Must(session.NewSession()) -// -// // Create the decryption client. -// svc := s3crypto.NewDecryptionClient(sess) -// -// // The object will be downloaded from S3 and decrypted locally. By metadata -// // about the object's encryption will instruct the decryption client how -// // decrypt the content of the object. By default KMS is used for keys. -// result, err := svc.GetObject(&s3.GetObjectInput { -// Bucket: aws.String(myBucket), -// Key: aws.String(myKey), -// }) -// -// See the s3crypto package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3crypto/ -// -package s3 diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go b/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go deleted file mode 100644 index c4048fbfb..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go +++ /dev/null @@ -1,233 +0,0 @@ -package s3 - -import ( - "net/url" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awsarn "github.com/aws/aws-sdk-go/aws/arn" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/service/s3/internal/arn" -) - -// Used by shapes with members decorated as endpoint ARN. -func parseEndpointARN(v string) (arn.Resource, error) { - return arn.ParseResource(v, accessPointResourceParser) -} - -func accessPointResourceParser(a awsarn.ARN) (arn.Resource, error) { - resParts := arn.SplitResource(a.Resource) - switch resParts[0] { - case "accesspoint": - return arn.ParseAccessPointResource(a, resParts[1:]) - default: - return nil, arn.InvalidARNError{ARN: a, Reason: "unknown resource type"} - } -} - -func endpointHandler(req *request.Request) { - endpoint, ok := req.Params.(endpointARNGetter) - if !ok || !endpoint.hasEndpointARN() { - updateBucketEndpointFromParams(req) - return - } - - resource, err := endpoint.getEndpointARN() - if err != nil { - req.Error = newInvalidARNError(nil, err) - return - } - - resReq := resourceRequest{ - Resource: resource, - Request: req, - } - - if resReq.IsCrossPartition() { - req.Error = newClientPartitionMismatchError(resource, - req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil) - return - } - - if !resReq.AllowCrossRegion() && resReq.IsCrossRegion() { - req.Error = newClientRegionMismatchError(resource, - req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil) - return - } - - if resReq.HasCustomEndpoint() { - req.Error = newInvalidARNWithCustomEndpointError(resource, nil) - return - } - - switch tv := resource.(type) { - case arn.AccessPointARN: - err = updateRequestAccessPointEndpoint(req, tv) - if err != nil { - req.Error = err - } - default: - req.Error = newInvalidARNError(resource, nil) - } -} - -type resourceRequest struct { - Resource arn.Resource - Request *request.Request -} - -func (r resourceRequest) ARN() awsarn.ARN { - return r.Resource.GetARN() -} - -func (r resourceRequest) AllowCrossRegion() bool { - return aws.BoolValue(r.Request.Config.S3UseARNRegion) -} - -func (r resourceRequest) UseFIPS() bool { - return isFIPS(aws.StringValue(r.Request.Config.Region)) -} - -func (r resourceRequest) IsCrossPartition() bool { - return r.Request.ClientInfo.PartitionID != r.Resource.GetARN().Partition -} - -func (r resourceRequest) IsCrossRegion() bool { - return isCrossRegion(r.Request, r.Resource.GetARN().Region) -} - -func (r resourceRequest) HasCustomEndpoint() bool { - return len(aws.StringValue(r.Request.Config.Endpoint)) > 0 -} - -func isFIPS(clientRegion string) bool { - return strings.HasPrefix(clientRegion, "fips-") || strings.HasSuffix(clientRegion, "-fips") -} -func isCrossRegion(req *request.Request, otherRegion string) bool { - return req.ClientInfo.SigningRegion != otherRegion -} - -func updateBucketEndpointFromParams(r *request.Request) { - bucket, ok := bucketNameFromReqParams(r.Params) - if !ok { - // Ignore operation requests if the bucket name was not provided - // if this is an input validation error the validation handler - // will report it. - return - } - updateEndpointForS3Config(r, bucket) -} - -func updateRequestAccessPointEndpoint(req *request.Request, accessPoint arn.AccessPointARN) error { - // Accelerate not supported - if aws.BoolValue(req.Config.S3UseAccelerate) { - return newClientConfiguredForAccelerateError(accessPoint, - req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil) - } - - // Ignore the disable host prefix for access points since custom endpoints - // are not supported. - req.Config.DisableEndpointHostPrefix = aws.Bool(false) - - if err := accessPointEndpointBuilder(accessPoint).Build(req); err != nil { - return err - } - - removeBucketFromPath(req.HTTPRequest.URL) - - return nil -} - -func removeBucketFromPath(u *url.URL) { - u.Path = strings.Replace(u.Path, "/{Bucket}", "", -1) - if u.Path == "" { - u.Path = "/" - } -} - -type accessPointEndpointBuilder arn.AccessPointARN - -const ( - accessPointPrefixLabel = "accesspoint" - accountIDPrefixLabel = "accountID" - accesPointPrefixTemplate = "{" + accessPointPrefixLabel + "}-{" + accountIDPrefixLabel + "}." -) - -func (a accessPointEndpointBuilder) Build(req *request.Request) error { - resolveRegion := arn.AccessPointARN(a).Region - cfgRegion := aws.StringValue(req.Config.Region) - - if isFIPS(cfgRegion) { - if aws.BoolValue(req.Config.S3UseARNRegion) && isCrossRegion(req, resolveRegion) { - // FIPS with cross region is not supported, the SDK must fail - // because there is no well defined method for SDK to construct a - // correct FIPS endpoint. - return newClientConfiguredForCrossRegionFIPSError(arn.AccessPointARN(a), - req.ClientInfo.PartitionID, cfgRegion, nil) - } - resolveRegion = cfgRegion - } - - endpoint, err := resolveRegionalEndpoint(req, resolveRegion) - if err != nil { - return newFailedToResolveEndpointError(arn.AccessPointARN(a), - req.ClientInfo.PartitionID, cfgRegion, err) - } - - if err = updateRequestEndpoint(req, endpoint.URL); err != nil { - return err - } - - const serviceEndpointLabel = "s3-accesspoint" - - // dualstack provided by endpoint resolver - cfgHost := req.HTTPRequest.URL.Host - if strings.HasPrefix(cfgHost, "s3") { - req.HTTPRequest.URL.Host = serviceEndpointLabel + cfgHost[2:] - } - - protocol.HostPrefixBuilder{ - Prefix: accesPointPrefixTemplate, - LabelsFn: a.hostPrefixLabelValues, - }.Build(req) - - req.ClientInfo.SigningName = endpoint.SigningName - req.ClientInfo.SigningRegion = endpoint.SigningRegion - - err = protocol.ValidateEndpointHost(req.Operation.Name, req.HTTPRequest.URL.Host) - if err != nil { - return newInvalidARNError(arn.AccessPointARN(a), err) - } - - return nil -} - -func (a accessPointEndpointBuilder) hostPrefixLabelValues() map[string]string { - return map[string]string{ - accessPointPrefixLabel: arn.AccessPointARN(a).AccessPointName, - accountIDPrefixLabel: arn.AccessPointARN(a).AccountID, - } -} - -func resolveRegionalEndpoint(r *request.Request, region string) (endpoints.ResolvedEndpoint, error) { - return r.Config.EndpointResolver.EndpointFor(EndpointsID, region, func(opts *endpoints.Options) { - opts.DisableSSL = aws.BoolValue(r.Config.DisableSSL) - opts.UseDualStack = aws.BoolValue(r.Config.UseDualStack) - opts.S3UsEast1RegionalEndpoint = endpoints.RegionalS3UsEast1Endpoint - }) -} - -func updateRequestEndpoint(r *request.Request, endpoint string) (err error) { - endpoint = endpoints.AddScheme(endpoint, aws.BoolValue(r.Config.DisableSSL)) - - r.HTTPRequest.URL, err = url.Parse(endpoint + r.Operation.HTTPPath) - if err != nil { - return awserr.New(request.ErrCodeSerialization, - "failed to parse endpoint URL", err) - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_errors.go b/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_errors.go deleted file mode 100644 index 9df03e78d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_errors.go +++ /dev/null @@ -1,151 +0,0 @@ -package s3 - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/s3/internal/arn" -) - -const ( - invalidARNErrorErrCode = "InvalidARNError" - configurationErrorErrCode = "ConfigurationError" -) - -type invalidARNError struct { - message string - resource arn.Resource - origErr error -} - -func (e invalidARNError) Error() string { - var extra string - if e.resource != nil { - extra = "ARN: " + e.resource.String() - } - return awserr.SprintError(e.Code(), e.Message(), extra, e.origErr) -} - -func (e invalidARNError) Code() string { - return invalidARNErrorErrCode -} - -func (e invalidARNError) Message() string { - return e.message -} - -func (e invalidARNError) OrigErr() error { - return e.origErr -} - -func newInvalidARNError(resource arn.Resource, err error) invalidARNError { - return invalidARNError{ - message: "invalid ARN", - origErr: err, - resource: resource, - } -} - -func newInvalidARNWithCustomEndpointError(resource arn.Resource, err error) invalidARNError { - return invalidARNError{ - message: "resource ARN not supported with custom client endpoints", - origErr: err, - resource: resource, - } -} - -// ARN not supported for the target partition -func newInvalidARNWithUnsupportedPartitionError(resource arn.Resource, err error) invalidARNError { - return invalidARNError{ - message: "resource ARN not supported for the target ARN partition", - origErr: err, - resource: resource, - } -} - -type configurationError struct { - message string - resource arn.Resource - clientPartitionID string - clientRegion string - origErr error -} - -func (e configurationError) Error() string { - extra := fmt.Sprintf("ARN: %s, client partition: %s, client region: %s", - e.resource, e.clientPartitionID, e.clientRegion) - - return awserr.SprintError(e.Code(), e.Message(), extra, e.origErr) -} - -func (e configurationError) Code() string { - return configurationErrorErrCode -} - -func (e configurationError) Message() string { - return e.message -} - -func (e configurationError) OrigErr() error { - return e.origErr -} - -func newClientPartitionMismatchError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError { - return configurationError{ - message: "client partition does not match provided ARN partition", - origErr: err, - resource: resource, - clientPartitionID: clientPartitionID, - clientRegion: clientRegion, - } -} - -func newClientRegionMismatchError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError { - return configurationError{ - message: "client region does not match provided ARN region", - origErr: err, - resource: resource, - clientPartitionID: clientPartitionID, - clientRegion: clientRegion, - } -} - -func newFailedToResolveEndpointError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError { - return configurationError{ - message: "endpoint resolver failed to find an endpoint for the provided ARN region", - origErr: err, - resource: resource, - clientPartitionID: clientPartitionID, - clientRegion: clientRegion, - } -} - -func newClientConfiguredForFIPSError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError { - return configurationError{ - message: "client configured for fips but cross-region resource ARN provided", - origErr: err, - resource: resource, - clientPartitionID: clientPartitionID, - clientRegion: clientRegion, - } -} - -func newClientConfiguredForAccelerateError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError { - return configurationError{ - message: "client configured for S3 Accelerate but is supported with resource ARN", - origErr: err, - resource: resource, - clientPartitionID: clientPartitionID, - clientRegion: clientRegion, - } -} - -func newClientConfiguredForCrossRegionFIPSError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError { - return configurationError{ - message: "client configured for FIPS with cross-region enabled but is supported with cross-region resource ARN", - origErr: err, - resource: resource, - clientPartitionID: clientPartitionID, - clientRegion: clientRegion, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go b/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go deleted file mode 100644 index 49aeff16f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -const ( - - // ErrCodeBucketAlreadyExists for service response error code - // "BucketAlreadyExists". - // - // The requested bucket name is not available. The bucket namespace is shared - // by all users of the system. Please select a different name and try again. - ErrCodeBucketAlreadyExists = "BucketAlreadyExists" - - // ErrCodeBucketAlreadyOwnedByYou for service response error code - // "BucketAlreadyOwnedByYou". - // - // The bucket you tried to create already exists, and you own it. Amazon S3 - // returns this error in all AWS Regions except in the North Virginia Region. - // For legacy compatibility, if you re-create an existing bucket that you already - // own in the North Virginia Region, Amazon S3 returns 200 OK and resets the - // bucket access control lists (ACLs). - ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou" - - // ErrCodeNoSuchBucket for service response error code - // "NoSuchBucket". - // - // The specified bucket does not exist. - ErrCodeNoSuchBucket = "NoSuchBucket" - - // ErrCodeNoSuchKey for service response error code - // "NoSuchKey". - // - // The specified key does not exist. - ErrCodeNoSuchKey = "NoSuchKey" - - // ErrCodeNoSuchUpload for service response error code - // "NoSuchUpload". - // - // The specified multipart upload does not exist. - ErrCodeNoSuchUpload = "NoSuchUpload" - - // ErrCodeObjectAlreadyInActiveTierError for service response error code - // "ObjectAlreadyInActiveTierError". - // - // This operation is not allowed against this storage tier. - ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError" - - // ErrCodeObjectNotInActiveTierError for service response error code - // "ObjectNotInActiveTierError". - // - // The source object of the COPY operation is not in the active tier and is - // only stored in Amazon S3 Glacier. - ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go b/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go deleted file mode 100644 index 81cdec1ae..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go +++ /dev/null @@ -1,136 +0,0 @@ -package s3 - -import ( - "fmt" - "net/url" - "regexp" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// an operationBlacklist is a list of operation names that should a -// request handler should not be executed with. -type operationBlacklist []string - -// Continue will return true of the Request's operation name is not -// in the blacklist. False otherwise. -func (b operationBlacklist) Continue(r *request.Request) bool { - for i := 0; i < len(b); i++ { - if b[i] == r.Operation.Name { - return false - } - } - return true -} - -var accelerateOpBlacklist = operationBlacklist{ - opListBuckets, opCreateBucket, opDeleteBucket, -} - -// Automatically add the bucket name to the endpoint domain -// if possible. This style of bucket is valid for all bucket names which are -// DNS compatible and do not contain "." -func updateEndpointForS3Config(r *request.Request, bucketName string) { - forceHostStyle := aws.BoolValue(r.Config.S3ForcePathStyle) - accelerate := aws.BoolValue(r.Config.S3UseAccelerate) - - if accelerate && accelerateOpBlacklist.Continue(r) { - if forceHostStyle { - if r.Config.Logger != nil { - r.Config.Logger.Log("ERROR: aws.Config.S3UseAccelerate is not compatible with aws.Config.S3ForcePathStyle, ignoring S3ForcePathStyle.") - } - } - updateEndpointForAccelerate(r, bucketName) - } else if !forceHostStyle && r.Operation.Name != opGetBucketLocation { - updateEndpointForHostStyle(r, bucketName) - } -} - -func updateEndpointForHostStyle(r *request.Request, bucketName string) { - if !hostCompatibleBucketName(r.HTTPRequest.URL, bucketName) { - // bucket name must be valid to put into the host - return - } - - moveBucketToHost(r.HTTPRequest.URL, bucketName) -} - -var ( - accelElem = []byte("s3-accelerate.dualstack.") -) - -func updateEndpointForAccelerate(r *request.Request, bucketName string) { - if !hostCompatibleBucketName(r.HTTPRequest.URL, bucketName) { - r.Error = awserr.New("InvalidParameterException", - fmt.Sprintf("bucket name %s is not compatible with S3 Accelerate", bucketName), - nil) - return - } - - parts := strings.Split(r.HTTPRequest.URL.Host, ".") - if len(parts) < 3 { - r.Error = awserr.New("InvalidParameterExecption", - fmt.Sprintf("unable to update endpoint host for S3 accelerate, hostname invalid, %s", - r.HTTPRequest.URL.Host), nil) - return - } - - if parts[0] == "s3" || strings.HasPrefix(parts[0], "s3-") { - parts[0] = "s3-accelerate" - } - for i := 1; i+1 < len(parts); i++ { - if parts[i] == aws.StringValue(r.Config.Region) { - parts = append(parts[:i], parts[i+1:]...) - break - } - } - - r.HTTPRequest.URL.Host = strings.Join(parts, ".") - - moveBucketToHost(r.HTTPRequest.URL, bucketName) -} - -// Attempts to retrieve the bucket name from the request input parameters. -// If no bucket is found, or the field is empty "", false will be returned. -func bucketNameFromReqParams(params interface{}) (string, bool) { - if iface, ok := params.(bucketGetter); ok { - b := iface.getBucket() - return b, len(b) > 0 - } - - return "", false -} - -// hostCompatibleBucketName returns true if the request should -// put the bucket in the host. This is false if S3ForcePathStyle is -// explicitly set or if the bucket is not DNS compatible. -func hostCompatibleBucketName(u *url.URL, bucket string) bool { - // Bucket might be DNS compatible but dots in the hostname will fail - // certificate validation, so do not use host-style. - if u.Scheme == "https" && strings.Contains(bucket, ".") { - return false - } - - // if the bucket is DNS compatible - return dnsCompatibleBucketName(bucket) -} - -var reDomain = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`) -var reIPAddress = regexp.MustCompile(`^(\d+\.){3}\d+$`) - -// dnsCompatibleBucketName returns true if the bucket name is DNS compatible. -// Buckets created outside of the classic region MUST be DNS compatible. -func dnsCompatibleBucketName(bucket string) bool { - return reDomain.MatchString(bucket) && - !reIPAddress.MatchString(bucket) && - !strings.Contains(bucket, "..") -} - -// moveBucketToHost moves the bucket name from the URI path to URL host. -func moveBucketToHost(u *url.URL, bucket string) { - u.Host = bucket + "." + u.Host - removeBucketFromPath(u) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/accesspoint_arn.go b/vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/accesspoint_arn.go deleted file mode 100644 index 2f93f96fd..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/accesspoint_arn.go +++ /dev/null @@ -1,45 +0,0 @@ -package arn - -import ( - "strings" - - "github.com/aws/aws-sdk-go/aws/arn" -) - -// AccessPointARN provides representation -type AccessPointARN struct { - arn.ARN - AccessPointName string -} - -// GetARN returns the base ARN for the Access Point resource -func (a AccessPointARN) GetARN() arn.ARN { - return a.ARN -} - -// ParseAccessPointResource attempts to parse the ARN's resource as an -// AccessPoint resource. -func ParseAccessPointResource(a arn.ARN, resParts []string) (AccessPointARN, error) { - if len(a.Region) == 0 { - return AccessPointARN{}, InvalidARNError{a, "region not set"} - } - if len(a.AccountID) == 0 { - return AccessPointARN{}, InvalidARNError{a, "account-id not set"} - } - if len(resParts) == 0 { - return AccessPointARN{}, InvalidARNError{a, "resource-id not set"} - } - if len(resParts) > 1 { - return AccessPointARN{}, InvalidARNError{a, "sub resource not supported"} - } - - resID := resParts[0] - if len(strings.TrimSpace(resID)) == 0 { - return AccessPointARN{}, InvalidARNError{a, "resource-id not set"} - } - - return AccessPointARN{ - ARN: a, - AccessPointName: resID, - }, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/arn.go b/vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/arn.go deleted file mode 100644 index a942d887f..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn/arn.go +++ /dev/null @@ -1,71 +0,0 @@ -package arn - -import ( - "strings" - - "github.com/aws/aws-sdk-go/aws/arn" -) - -// Resource provides the interfaces abstracting ARNs of specific resource -// types. -type Resource interface { - GetARN() arn.ARN - String() string -} - -// ResourceParser provides the function for parsing an ARN's resource -// component into a typed resource. -type ResourceParser func(arn.ARN) (Resource, error) - -// ParseResource parses an AWS ARN into a typed resource for the S3 API. -func ParseResource(s string, resParser ResourceParser) (resARN Resource, err error) { - a, err := arn.Parse(s) - if err != nil { - return nil, err - } - - if len(a.Partition) == 0 { - return nil, InvalidARNError{a, "partition not set"} - } - if a.Service != "s3" { - return nil, InvalidARNError{a, "service is not S3"} - } - if len(a.Resource) == 0 { - return nil, InvalidARNError{a, "resource not set"} - } - - return resParser(a) -} - -// SplitResource splits the resource components by the ARN resource delimiters. -func SplitResource(v string) []string { - var parts []string - var offset int - - for offset <= len(v) { - idx := strings.IndexAny(v[offset:], "/:") - if idx < 0 { - parts = append(parts, v[offset:]) - break - } - parts = append(parts, v[offset:idx+offset]) - offset += idx + 1 - } - - return parts -} - -// IsARN returns whether the given string is an ARN -func IsARN(s string) bool { - return arn.IsARN(s) -} - -// InvalidARNError provides the error for an invalid ARN error. -type InvalidARNError struct { - ARN arn.ARN - Reason string -} - -func (e InvalidARNError) Error() string { - return "invalid Amazon S3 ARN, " + e.Reason + ", " + e.ARN.String() -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go deleted file mode 100644 index 8e6f3307d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go +++ /dev/null @@ -1,8 +0,0 @@ -// +build !go1.6 - -package s3 - -import "github.com/aws/aws-sdk-go/aws/request" - -func platformRequestHandlers(r *request.Request) { -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go deleted file mode 100644 index 14d05f7b7..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build go1.6 - -package s3 - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -func platformRequestHandlers(r *request.Request) { - if r.Operation.HTTPMethod == "PUT" { - // 100-Continue should only be used on put requests. - r.Handlers.Sign.PushBack(add100Continue) - } -} - -func add100Continue(r *request.Request) { - if aws.BoolValue(r.Config.S3Disable100Continue) { - return - } - if r.HTTPRequest.ContentLength < 1024*1024*2 { - // Ignore requests smaller than 2MB. This helps prevent delaying - // requests unnecessarily. - return - } - - r.HTTPRequest.Header.Set("Expect", "100-Continue") -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go b/vendor/github.com/aws/aws-sdk-go/service/s3/service.go deleted file mode 100644 index b4c07b4d4..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/private/protocol/restxml" -) - -// S3 provides the API operation methods for making requests to -// Amazon Simple Storage Service. See this package's package overview docs -// for details on the service. -// -// S3 methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type S3 struct { - *client.Client -} - -// Used for custom client initialization logic -var initClient func(*client.Client) - -// Used for custom request initialization logic -var initRequest func(*request.Request) - -// Service information constants -const ( - ServiceName = "s3" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "S3" // ServiceID is a unique identifier of a specific service. -) - -// New creates a new instance of the S3 client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// mySession := session.Must(session.NewSession()) -// -// // Create a S3 client from just a session. -// svc := s3.New(mySession) -// -// // Create a S3 client with additional configuration -// svc := s3.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *S3 { - c := p.ClientConfig(EndpointsID, cfgs...) - return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *S3 { - svc := &S3{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceID, - SigningName: signingName, - SigningRegion: signingRegion, - PartitionID: partitionID, - Endpoint: endpoint, - APIVersion: "2006-03-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.BuildNamedHandler(v4.SignRequestHandler.Name, func(s *v4.Signer) { - s.DisableURIPathEscaping = true - })) - svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) - - svc.Handlers.BuildStream.PushBackNamed(restxml.BuildHandler) - svc.Handlers.UnmarshalStream.PushBackNamed(restxml.UnmarshalHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a S3 operation and runs any -// custom request initialization. -func (c *S3) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - // Run custom request initialization if present - if initRequest != nil { - initRequest(req) - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go b/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go deleted file mode 100644 index b71c835de..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go +++ /dev/null @@ -1,84 +0,0 @@ -package s3 - -import ( - "crypto/md5" - "encoding/base64" - "net/http" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) - -func validateSSERequiresSSL(r *request.Request) { - if r.HTTPRequest.URL.Scheme == "https" { - return - } - - if iface, ok := r.Params.(sseCustomerKeyGetter); ok { - if len(iface.getSSECustomerKey()) > 0 { - r.Error = errSSERequiresSSL - return - } - } - - if iface, ok := r.Params.(copySourceSSECustomerKeyGetter); ok { - if len(iface.getCopySourceSSECustomerKey()) > 0 { - r.Error = errSSERequiresSSL - return - } - } -} - -const ( - sseKeyHeader = "x-amz-server-side-encryption-customer-key" - sseKeyMD5Header = sseKeyHeader + "-md5" -) - -func computeSSEKeyMD5(r *request.Request) { - var key string - if g, ok := r.Params.(sseCustomerKeyGetter); ok { - key = g.getSSECustomerKey() - } - - computeKeyMD5(sseKeyHeader, sseKeyMD5Header, key, r.HTTPRequest) -} - -const ( - copySrcSSEKeyHeader = "x-amz-copy-source-server-side-encryption-customer-key" - copySrcSSEKeyMD5Header = copySrcSSEKeyHeader + "-md5" -) - -func computeCopySourceSSEKeyMD5(r *request.Request) { - var key string - if g, ok := r.Params.(copySourceSSECustomerKeyGetter); ok { - key = g.getCopySourceSSECustomerKey() - } - - computeKeyMD5(copySrcSSEKeyHeader, copySrcSSEKeyMD5Header, key, r.HTTPRequest) -} - -func computeKeyMD5(keyHeader, keyMD5Header, key string, r *http.Request) { - if len(key) == 0 { - // Backwards compatiablity where user just set the header value instead - // of using the API parameter, or setting the header value for an - // operation without the parameters modeled. - key = r.Header.Get(keyHeader) - if len(key) == 0 { - return - } - - // In backwards compatiable, the header's value is not base64 encoded, - // and needs to be encoded and updated by the SDK's customizations. - b64Key := base64.StdEncoding.EncodeToString([]byte(key)) - r.Header.Set(keyHeader, b64Key) - } - - // Only update Key's MD5 if not already set. - if len(r.Header.Get(keyMD5Header)) == 0 { - sum := md5.Sum([]byte(key)) - keyMD5 := base64.StdEncoding.EncodeToString(sum[:]) - r.Header.Set(keyMD5Header, keyMD5) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go deleted file mode 100644 index 247770e4c..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go +++ /dev/null @@ -1,42 +0,0 @@ -package s3 - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/sdkio" -) - -func copyMultipartStatusOKUnmarhsalError(r *request.Request) { - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, "unable to read response body", err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - body := bytes.NewReader(b) - r.HTTPResponse.Body = ioutil.NopCloser(body) - defer body.Seek(0, sdkio.SeekStart) - - unmarshalError(r) - if err, ok := r.Error.(awserr.Error); ok && err != nil { - if err.Code() == request.ErrCodeSerialization && - err.OrigErr() != io.EOF { - r.Error = nil - return - } - // if empty payload - if err.OrigErr() == io.EOF { - r.HTTPResponse.StatusCode = http.StatusInternalServerError - } else { - r.HTTPResponse.StatusCode = http.StatusServiceUnavailable - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go deleted file mode 100644 index 6eecf6691..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go +++ /dev/null @@ -1,114 +0,0 @@ -package s3 - -import ( - "bytes" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" -) - -type xmlErrorResponse struct { - XMLName xml.Name `xml:"Error"` - Code string `xml:"Code"` - Message string `xml:"Message"` -} - -func unmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) - - // Bucket exists in a different region, and request needs - // to be made to the correct region. - if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { - msg := fmt.Sprintf( - "incorrect region, the bucket is not in '%s' region at endpoint '%s'", - aws.StringValue(r.Config.Region), - aws.StringValue(r.Config.Endpoint), - ) - if v := r.HTTPResponse.Header.Get("x-amz-bucket-region"); len(v) != 0 { - msg += fmt.Sprintf(", bucket is in '%s' region", v) - } - r.Error = awserr.NewRequestFailure( - awserr.New("BucketRegionError", msg, nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - - // Attempt to parse error from body if it is known - var errResp xmlErrorResponse - var err error - if r.HTTPResponse.StatusCode >= 200 && r.HTTPResponse.StatusCode < 300 { - err = s3unmarshalXMLError(&errResp, r.HTTPResponse.Body) - } else { - err = xmlutil.UnmarshalXMLError(&errResp, r.HTTPResponse.Body) - } - - if err != nil { - var errorMsg string - if err == io.EOF { - errorMsg = "empty response payload" - } else { - errorMsg = "failed to unmarshal error message" - } - - r.Error = awserr.NewRequestFailure( - awserr.New(request.ErrCodeSerialization, - errorMsg, err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) - return - } - - // Fallback to status code converted to message if still no error code - if len(errResp.Code) == 0 { - statusText := http.StatusText(r.HTTPResponse.StatusCode) - errResp.Code = strings.Replace(statusText, " ", "", -1) - errResp.Message = statusText - } - - r.Error = awserr.NewRequestFailure( - awserr.New(errResp.Code, errResp.Message, err), - r.HTTPResponse.StatusCode, - r.RequestID, - ) -} - -// A RequestFailure provides access to the S3 Request ID and Host ID values -// returned from API operation errors. Getting the error as a string will -// return the formated error with the same information as awserr.RequestFailure, -// while also adding the HostID value from the response. -type RequestFailure interface { - awserr.RequestFailure - - // Host ID is the S3 Host ID needed for debug, and contacting support - HostID() string -} - -// s3unmarshalXMLError is s3 specific xml error unmarshaler -// for 200 OK errors and response payloads. -// This function differs from the xmlUtil.UnmarshalXMLError -// func. It does not ignore the EOF error and passes it up. -// Related to bug fix for `s3 200 OK response with empty payload` -func s3unmarshalXMLError(v interface{}, stream io.Reader) error { - var errBuf bytes.Buffer - body := io.TeeReader(stream, &errBuf) - - err := xml.NewDecoder(body).Decode(v) - if err != nil && err != io.EOF { - return awserr.NewUnmarshalError(err, - "failed to unmarshal error message", errBuf.Bytes()) - } - - return err -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go deleted file mode 100644 index 2596c694b..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// WaitUntilBucketExists uses the Amazon S3 API operation -// HeadBucket to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *S3) WaitUntilBucketExists(input *HeadBucketInput) error { - return c.WaitUntilBucketExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilBucketExistsWithContext is an extended version of WaitUntilBucketExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) WaitUntilBucketExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilBucketExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 301, - }, - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 403, - }, - { - State: request.RetryWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadBucketInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadBucketRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilBucketNotExists uses the Amazon S3 API operation -// HeadBucket to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *S3) WaitUntilBucketNotExists(input *HeadBucketInput) error { - return c.WaitUntilBucketNotExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilBucketNotExistsWithContext is an extended version of WaitUntilBucketNotExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) WaitUntilBucketNotExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilBucketNotExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadBucketInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadBucketRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilObjectExists uses the Amazon S3 API operation -// HeadObject to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *S3) WaitUntilObjectExists(input *HeadObjectInput) error { - return c.WaitUntilObjectExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilObjectExistsWithContext is an extended version of WaitUntilObjectExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) WaitUntilObjectExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilObjectExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - { - State: request.RetryWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadObjectInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadObjectRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilObjectNotExists uses the Amazon S3 API operation -// HeadObject to wait for a condition to be met before returning. -// If the condition is not met within the max attempt window, an error will -// be returned. -func (c *S3) WaitUntilObjectNotExists(input *HeadObjectInput) error { - return c.WaitUntilObjectNotExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilObjectNotExistsWithContext is an extended version of WaitUntilObjectNotExists. -// With the support for passing in a context and options to configure the -// Waiter and the underlying request options. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *S3) WaitUntilObjectNotExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilObjectNotExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadObjectInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadObjectRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go deleted file mode 100644 index 550b5f687..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ /dev/null @@ -1,3115 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts - -import ( - "fmt" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" -) - -const opAssumeRole = "AssumeRole" - -// AssumeRoleRequest generates a "aws/request.Request" representing the -// client's request for the AssumeRole operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AssumeRole for more information on using the AssumeRole -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AssumeRoleRequest method. -// req, resp := client.AssumeRoleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole -func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, output *AssumeRoleOutput) { - op := &request.Operation{ - Name: opAssumeRole, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AssumeRoleInput{} - } - - output = &AssumeRoleOutput{} - req = c.newRequest(op, input, output) - return -} - -// AssumeRole API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials that you can use to access -// AWS resources that you might not normally have access to. These temporary -// credentials consist of an access key ID, a secret access key, and a security -// token. Typically, you use AssumeRole within your account or for cross-account -// access. For a comparison of AssumeRole with other API operations that produce -// temporary credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// You cannot use AWS account root user credentials to call AssumeRole. You -// must use credentials for an IAM user or an IAM role to call AssumeRole. -// -// For cross-account access, imagine that you own multiple accounts and need -// to access resources in each account. You could create long-term credentials -// in each account to access those resources. However, managing all those credentials -// and remembering which one can access which account can be time consuming. -// Instead, you can create one set of long-term credentials in one account. -// Then use temporary security credentials to access all the other accounts -// by assuming roles in those accounts. For more information about roles, see -// IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) -// in the IAM User Guide. -// -// Session Duration -// -// By default, the temporary security credentials created by AssumeRole last -// for one hour. However, you can use the optional DurationSeconds parameter -// to specify the duration of your session. You can provide a value from 900 -// seconds (15 minutes) up to the maximum session duration setting for the role. -// This setting can have a value from 1 hour to 12 hours. To learn how to view -// the maximum value for your role, see View the Maximum Session Duration Setting -// for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) -// in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI commands. However -// the limit does not apply when you use those operations to create a console -// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) -// in the IAM User Guide. -// -// Permissions -// -// The temporary security credentials created by AssumeRole can be used to make -// API calls to any AWS service with the following exception: You cannot call -// the AWS STS GetFederationToken or GetSessionToken API operations. -// -// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policies to -// use as managed session policies. The plain text that you use for both inline -// and managed session policies can't exceed 2,048 characters. Passing policies -// to this operation returns new temporary credentials. The resulting session's -// permissions are the intersection of the role's identity-based policy and -// the session policies. You can use the role's temporary credentials in subsequent -// AWS API calls to access resources in the account that owns the role. You -// cannot use session policies to grant more permissions than those allowed -// by the identity-based policy of the role that is being assumed. For more -// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. -// -// To assume a role from a different account, your AWS account must be trusted -// by the role. The trust relationship is defined in the role's trust policy -// when the role is created. That trust policy states which accounts are allowed -// to delegate that access to users in the account. -// -// A user who wants to access a role in a different account must also have permissions -// that are delegated from the user account administrator. The administrator -// must attach a policy that allows the user to call AssumeRole for the ARN -// of the role in the other account. If the user is in the same account as the -// role, then you can do either of the following: -// -// * Attach a policy to the user (identical to the previous user in a different -// account). -// -// * Add the user as a principal directly in the role's trust policy. -// -// In this case, the trust policy acts as an IAM resource-based policy. Users -// in the same account as the role do not need explicit permission to assume -// the role. For more information about trust policies and resource-based policies, -// see IAM Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) -// in the IAM User Guide. -// -// Tags -// -// (Optional) You can pass tag key-value pairs to your session. These tags are -// called session tags. For more information about session tags, see Passing -// Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// An administrator must grant you the permissions necessary to pass session -// tags. The administrator can also create granular permissions to allow you -// to pass only specific session tags. For more information, see Tutorial: Using -// Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. -// -// You can set the session tags as transitive. Transitive tags persist during -// role chaining. For more information, see Chaining Roles with Session Tags -// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) -// in the IAM User Guide. -// -// Using MFA with AssumeRole -// -// (Optional) You can include multi-factor authentication (MFA) information -// when you call AssumeRole. This is useful for cross-account scenarios to ensure -// that the user that assumes the role has been authenticated with an AWS MFA -// device. In that scenario, the trust policy of the role being assumed includes -// a condition that tests for MFA authentication. If the caller does not include -// valid MFA information, the request to assume the role is denied. The condition -// in a trust policy that tests for MFA authentication might look like the following -// example. -// -// "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}} -// -// For more information, see Configuring MFA-Protected API Access (https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) -// in the IAM User Guide guide. -// -// To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode -// parameters. The SerialNumber value identifies the user's hardware or virtual -// MFA device. The TokenCode is the time-based one-time password (TOTP) that -// the MFA device produces. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation AssumeRole for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the total packed size of the session policies -// and session tags combined was too large. An AWS conversion compresses the -// session policy document, session policy ARNs, and session tags into a packed -// binary format that has a separate limit. The error message indicates by percentage -// how close the policies and tags are to the upper size limit. For more information, -// see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// You could receive this error even though you meet other defined session policy -// and session tag limits. For more information, see IAM and STS Entity Character -// Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole -func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) { - req, out := c.AssumeRoleRequest(input) - return out, req.Send() -} - -// AssumeRoleWithContext is the same as AssumeRole with the addition of -// the ability to pass a context and additional request options. -// -// See AssumeRole for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) AssumeRoleWithContext(ctx aws.Context, input *AssumeRoleInput, opts ...request.Option) (*AssumeRoleOutput, error) { - req, out := c.AssumeRoleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAssumeRoleWithSAML = "AssumeRoleWithSAML" - -// AssumeRoleWithSAMLRequest generates a "aws/request.Request" representing the -// client's request for the AssumeRoleWithSAML operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AssumeRoleWithSAML for more information on using the AssumeRoleWithSAML -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AssumeRoleWithSAMLRequest method. -// req, resp := client.AssumeRoleWithSAMLRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML -func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *request.Request, output *AssumeRoleWithSAMLOutput) { - op := &request.Operation{ - Name: opAssumeRoleWithSAML, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AssumeRoleWithSAMLInput{} - } - - output = &AssumeRoleWithSAMLOutput{} - req = c.newRequest(op, input, output) - req.Config.Credentials = credentials.AnonymousCredentials - return -} - -// AssumeRoleWithSAML API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials for users who have been authenticated -// via a SAML authentication response. This operation provides a mechanism for -// tying an enterprise identity store or directory to role-based AWS access -// without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML -// with the other API operations that produce temporary credentials, see Requesting -// Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// The temporary security credentials returned by this operation consist of -// an access key ID, a secret access key, and a security token. Applications -// can use these temporary security credentials to sign calls to AWS services. -// -// Session Duration -// -// By default, the temporary security credentials created by AssumeRoleWithSAML -// last for one hour. However, you can use the optional DurationSeconds parameter -// to specify the duration of your session. Your role session lasts for the -// duration that you specify, or until the time specified in the SAML authentication -// response's SessionNotOnOrAfter value, whichever is shorter. You can provide -// a DurationSeconds value from 900 seconds (15 minutes) up to the maximum session -// duration setting for the role. This setting can have a value from 1 hour -// to 12 hours. To learn how to view the maximum value for your role, see View -// the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) -// in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI commands. However -// the limit does not apply when you use those operations to create a console -// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) -// in the IAM User Guide. -// -// Permissions -// -// The temporary security credentials created by AssumeRoleWithSAML can be used -// to make API calls to any AWS service with the following exception: you cannot -// call the STS GetFederationToken or GetSessionToken API operations. -// -// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policies to -// use as managed session policies. The plain text that you use for both inline -// and managed session policies can't exceed 2,048 characters. Passing policies -// to this operation returns new temporary credentials. The resulting session's -// permissions are the intersection of the role's identity-based policy and -// the session policies. You can use the role's temporary credentials in subsequent -// AWS API calls to access resources in the account that owns the role. You -// cannot use session policies to grant more permissions than those allowed -// by the identity-based policy of the role that is being assumed. For more -// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. -// -// Calling AssumeRoleWithSAML does not require the use of AWS security credentials. -// The identity of the caller is validated by using keys in the metadata document -// that is uploaded for the SAML provider entity for your identity provider. -// -// Calling AssumeRoleWithSAML can result in an entry in your AWS CloudTrail -// logs. The entry includes the value in the NameID element of the SAML assertion. -// We recommend that you use a NameIDType that is not associated with any personally -// identifiable information (PII). For example, you could instead use the persistent -// identifier (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent). -// -// Tags -// -// (Optional) You can configure your IdP to pass attributes into your SAML assertion -// as session tags. Each session tag consists of a key name and an associated -// value. For more information about session tags, see Passing Session Tags -// in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// You can pass up to 50 session tags. The plain text session tag keys can’t -// exceed 128 characters and the values can’t exceed 256 characters. For these -// and additional limits, see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) -// in the IAM User Guide. -// -// An AWS conversion compresses the passed session policies and session tags -// into a packed binary format that has a separate limit. Your request can fail -// for this limit even if your plain text meets the other requirements. The -// PackedPolicySize response element indicates by percentage how close the policies -// and tags for your request are to the upper size limit. -// -// You can pass a session tag with the same key as a tag that is attached to -// the role. When you do, session tags override the role's tags with the same -// key. -// -// An administrator must grant you the permissions necessary to pass session -// tags. The administrator can also create granular permissions to allow you -// to pass only specific session tags. For more information, see Tutorial: Using -// Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. -// -// You can set the session tags as transitive. Transitive tags persist during -// role chaining. For more information, see Chaining Roles with Session Tags -// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) -// in the IAM User Guide. -// -// SAML Configuration -// -// Before your application can call AssumeRoleWithSAML, you must configure your -// SAML identity provider (IdP) to issue the claims required by AWS. Additionally, -// you must use AWS Identity and Access Management (IAM) to create a SAML provider -// entity in your AWS account that represents your identity provider. You must -// also create an IAM role that specifies this SAML provider in its trust policy. -// -// For more information, see the following resources: -// -// * About SAML 2.0-based Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) -// in the IAM User Guide. -// -// * Creating SAML Identity Providers (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) -// in the IAM User Guide. -// -// * Configuring a Relying Party and Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) -// in the IAM User Guide. -// -// * Creating a Role for SAML 2.0 Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) -// in the IAM User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation AssumeRoleWithSAML for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the total packed size of the session policies -// and session tags combined was too large. An AWS conversion compresses the -// session policy document, session policy ARNs, and session tags into a packed -// binary format that has a separate limit. The error message indicates by percentage -// how close the policies and tags are to the upper size limit. For more information, -// see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// You could receive this error even though you meet other defined session policy -// and session tag limits. For more information, see IAM and STS Entity Character -// Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// * ErrCodeIDPRejectedClaimException "IDPRejectedClaim" -// The identity provider (IdP) reported that authentication failed. This might -// be because the claim is invalid. -// -// If this error is returned for the AssumeRoleWithWebIdentity operation, it -// can also mean that the claim has expired or has been explicitly revoked. -// -// * ErrCodeInvalidIdentityTokenException "InvalidIdentityToken" -// The web identity token that was passed could not be validated by AWS. Get -// a new identity token from the identity provider and then retry the request. -// -// * ErrCodeExpiredTokenException "ExpiredTokenException" -// The web identity token that was passed is expired or is not valid. Get a -// new identity token from the identity provider and then retry the request. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML -func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) { - req, out := c.AssumeRoleWithSAMLRequest(input) - return out, req.Send() -} - -// AssumeRoleWithSAMLWithContext is the same as AssumeRoleWithSAML with the addition of -// the ability to pass a context and additional request options. -// -// See AssumeRoleWithSAML for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) AssumeRoleWithSAMLWithContext(ctx aws.Context, input *AssumeRoleWithSAMLInput, opts ...request.Option) (*AssumeRoleWithSAMLOutput, error) { - req, out := c.AssumeRoleWithSAMLRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity" - -// AssumeRoleWithWebIdentityRequest generates a "aws/request.Request" representing the -// client's request for the AssumeRoleWithWebIdentity operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See AssumeRoleWithWebIdentity for more information on using the AssumeRoleWithWebIdentity -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the AssumeRoleWithWebIdentityRequest method. -// req, resp := client.AssumeRoleWithWebIdentityRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity -func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) (req *request.Request, output *AssumeRoleWithWebIdentityOutput) { - op := &request.Operation{ - Name: opAssumeRoleWithWebIdentity, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AssumeRoleWithWebIdentityInput{} - } - - output = &AssumeRoleWithWebIdentityOutput{} - req = c.newRequest(op, input, output) - req.Config.Credentials = credentials.AnonymousCredentials - return -} - -// AssumeRoleWithWebIdentity API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials for users who have been authenticated -// in a mobile or web application with a web identity provider. Example providers -// include Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID -// Connect-compatible identity provider. -// -// For mobile applications, we recommend that you use Amazon Cognito. You can -// use Amazon Cognito with the AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) -// and the AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/) -// to uniquely identify a user. You can also supply the user with a consistent -// identity throughout the lifetime of an application. -// -// To learn more about Amazon Cognito, see Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840) -// in AWS SDK for Android Developer Guide and Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664) -// in the AWS SDK for iOS Developer Guide. -// -// Calling AssumeRoleWithWebIdentity does not require the use of AWS security -// credentials. Therefore, you can distribute an application (for example, on -// mobile devices) that requests temporary security credentials without including -// long-term AWS credentials in the application. You also don't need to deploy -// server-based proxy services that use long-term AWS credentials. Instead, -// the identity of the caller is validated by using a token from the web identity -// provider. For a comparison of AssumeRoleWithWebIdentity with the other API -// operations that produce temporary credentials, see Requesting Temporary Security -// Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// The temporary security credentials returned by this API consist of an access -// key ID, a secret access key, and a security token. Applications can use these -// temporary security credentials to sign calls to AWS service API operations. -// -// Session Duration -// -// By default, the temporary security credentials created by AssumeRoleWithWebIdentity -// last for one hour. However, you can use the optional DurationSeconds parameter -// to specify the duration of your session. You can provide a value from 900 -// seconds (15 minutes) up to the maximum session duration setting for the role. -// This setting can have a value from 1 hour to 12 hours. To learn how to view -// the maximum value for your role, see View the Maximum Session Duration Setting -// for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) -// in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI commands. However -// the limit does not apply when you use those operations to create a console -// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) -// in the IAM User Guide. -// -// Permissions -// -// The temporary security credentials created by AssumeRoleWithWebIdentity can -// be used to make API calls to any AWS service with the following exception: -// you cannot call the STS GetFederationToken or GetSessionToken API operations. -// -// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policies to -// use as managed session policies. The plain text that you use for both inline -// and managed session policies can't exceed 2,048 characters. Passing policies -// to this operation returns new temporary credentials. The resulting session's -// permissions are the intersection of the role's identity-based policy and -// the session policies. You can use the role's temporary credentials in subsequent -// AWS API calls to access resources in the account that owns the role. You -// cannot use session policies to grant more permissions than those allowed -// by the identity-based policy of the role that is being assumed. For more -// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. -// -// Tags -// -// (Optional) You can configure your IdP to pass attributes into your web identity -// token as session tags. Each session tag consists of a key name and an associated -// value. For more information about session tags, see Passing Session Tags -// in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// You can pass up to 50 session tags. The plain text session tag keys can’t -// exceed 128 characters and the values can’t exceed 256 characters. For these -// and additional limits, see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) -// in the IAM User Guide. -// -// An AWS conversion compresses the passed session policies and session tags -// into a packed binary format that has a separate limit. Your request can fail -// for this limit even if your plain text meets the other requirements. The -// PackedPolicySize response element indicates by percentage how close the policies -// and tags for your request are to the upper size limit. -// -// You can pass a session tag with the same key as a tag that is attached to -// the role. When you do, the session tag overrides the role tag with the same -// key. -// -// An administrator must grant you the permissions necessary to pass session -// tags. The administrator can also create granular permissions to allow you -// to pass only specific session tags. For more information, see Tutorial: Using -// Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. -// -// You can set the session tags as transitive. Transitive tags persist during -// role chaining. For more information, see Chaining Roles with Session Tags -// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) -// in the IAM User Guide. -// -// Identities -// -// Before your application can call AssumeRoleWithWebIdentity, you must have -// an identity token from a supported identity provider and create a role that -// the application can assume. The role that your application assumes must trust -// the identity provider that is associated with the identity token. In other -// words, the identity provider must be specified in the role's trust policy. -// -// Calling AssumeRoleWithWebIdentity can result in an entry in your AWS CloudTrail -// logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims) -// of the provided Web Identity Token. We recommend that you avoid using any -// personally identifiable information (PII) in this field. For example, you -// could instead use a GUID or a pairwise identifier, as suggested in the OIDC -// specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes). -// -// For more information about how to use web identity federation and the AssumeRoleWithWebIdentity -// API, see the following resources: -// -// * Using Web Identity Federation API Operations for Mobile Apps (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) -// and Federation Through a Web-based Identity Provider (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). -// -// * Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). -// Walk through the process of authenticating through Login with Amazon, -// Facebook, or Google, getting temporary security credentials, and then -// using those credentials to make a request to AWS. -// -// * AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) and -// AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/). -// These toolkits contain sample apps that show how to invoke the identity -// providers. The toolkits then show how to use the information from these -// providers to get and use temporary security credentials. -// -// * Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications). -// This article discusses web identity federation and shows an example of -// how to use web identity federation to get access to content in Amazon -// S3. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation AssumeRoleWithWebIdentity for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the total packed size of the session policies -// and session tags combined was too large. An AWS conversion compresses the -// session policy document, session policy ARNs, and session tags into a packed -// binary format that has a separate limit. The error message indicates by percentage -// how close the policies and tags are to the upper size limit. For more information, -// see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// You could receive this error even though you meet other defined session policy -// and session tag limits. For more information, see IAM and STS Entity Character -// Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// * ErrCodeIDPRejectedClaimException "IDPRejectedClaim" -// The identity provider (IdP) reported that authentication failed. This might -// be because the claim is invalid. -// -// If this error is returned for the AssumeRoleWithWebIdentity operation, it -// can also mean that the claim has expired or has been explicitly revoked. -// -// * ErrCodeIDPCommunicationErrorException "IDPCommunicationError" -// The request could not be fulfilled because the identity provider (IDP) that -// was asked to verify the incoming identity token could not be reached. This -// is often a transient error caused by network conditions. Retry the request -// a limited number of times so that you don't exceed the request rate. If the -// error persists, the identity provider might be down or not responding. -// -// * ErrCodeInvalidIdentityTokenException "InvalidIdentityToken" -// The web identity token that was passed could not be validated by AWS. Get -// a new identity token from the identity provider and then retry the request. -// -// * ErrCodeExpiredTokenException "ExpiredTokenException" -// The web identity token that was passed is expired or is not valid. Get a -// new identity token from the identity provider and then retry the request. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity -func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) { - req, out := c.AssumeRoleWithWebIdentityRequest(input) - return out, req.Send() -} - -// AssumeRoleWithWebIdentityWithContext is the same as AssumeRoleWithWebIdentity with the addition of -// the ability to pass a context and additional request options. -// -// See AssumeRoleWithWebIdentity for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) AssumeRoleWithWebIdentityWithContext(ctx aws.Context, input *AssumeRoleWithWebIdentityInput, opts ...request.Option) (*AssumeRoleWithWebIdentityOutput, error) { - req, out := c.AssumeRoleWithWebIdentityRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage" - -// DecodeAuthorizationMessageRequest generates a "aws/request.Request" representing the -// client's request for the DecodeAuthorizationMessage operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See DecodeAuthorizationMessage for more information on using the DecodeAuthorizationMessage -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the DecodeAuthorizationMessageRequest method. -// req, resp := client.DecodeAuthorizationMessageRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage -func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) (req *request.Request, output *DecodeAuthorizationMessageOutput) { - op := &request.Operation{ - Name: opDecodeAuthorizationMessage, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DecodeAuthorizationMessageInput{} - } - - output = &DecodeAuthorizationMessageOutput{} - req = c.newRequest(op, input, output) - return -} - -// DecodeAuthorizationMessage API operation for AWS Security Token Service. -// -// Decodes additional information about the authorization status of a request -// from an encoded message returned in response to an AWS request. -// -// For example, if a user is not authorized to perform an operation that he -// or she has requested, the request returns a Client.UnauthorizedOperation -// response (an HTTP 403 response). Some AWS operations additionally return -// an encoded message that can provide details about this authorization failure. -// -// Only certain AWS operations return an encoded authorization message. The -// documentation for an individual operation indicates whether that operation -// returns an encoded message in addition to returning an HTTP code. -// -// The message is encoded because the details of the authorization status can -// constitute privileged information that the user who requested the operation -// should not see. To decode an authorization status message, a user must be -// granted permissions via an IAM policy to request the DecodeAuthorizationMessage -// (sts:DecodeAuthorizationMessage) action. -// -// The decoded message includes the following type of information: -// -// * Whether the request was denied due to an explicit deny or due to the -// absence of an explicit allow. For more information, see Determining Whether -// a Request is Allowed or Denied (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) -// in the IAM User Guide. -// -// * The principal who made the request. -// -// * The requested action. -// -// * The requested resource. -// -// * The values of condition keys in the context of the user's request. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation DecodeAuthorizationMessage for usage and error information. -// -// Returned Error Codes: -// * ErrCodeInvalidAuthorizationMessageException "InvalidAuthorizationMessageException" -// The error returned if the message passed to DecodeAuthorizationMessage was -// invalid. This can happen if the token contains invalid characters, such as -// linebreaks. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage -func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) { - req, out := c.DecodeAuthorizationMessageRequest(input) - return out, req.Send() -} - -// DecodeAuthorizationMessageWithContext is the same as DecodeAuthorizationMessage with the addition of -// the ability to pass a context and additional request options. -// -// See DecodeAuthorizationMessage for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) DecodeAuthorizationMessageWithContext(ctx aws.Context, input *DecodeAuthorizationMessageInput, opts ...request.Option) (*DecodeAuthorizationMessageOutput, error) { - req, out := c.DecodeAuthorizationMessageRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetAccessKeyInfo = "GetAccessKeyInfo" - -// GetAccessKeyInfoRequest generates a "aws/request.Request" representing the -// client's request for the GetAccessKeyInfo operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetAccessKeyInfo for more information on using the GetAccessKeyInfo -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetAccessKeyInfoRequest method. -// req, resp := client.GetAccessKeyInfoRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo -func (c *STS) GetAccessKeyInfoRequest(input *GetAccessKeyInfoInput) (req *request.Request, output *GetAccessKeyInfoOutput) { - op := &request.Operation{ - Name: opGetAccessKeyInfo, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetAccessKeyInfoInput{} - } - - output = &GetAccessKeyInfoOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetAccessKeyInfo API operation for AWS Security Token Service. -// -// Returns the account identifier for the specified access key ID. -// -// Access keys consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE) -// and a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY). -// For more information about access keys, see Managing Access Keys for IAM -// Users (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) -// in the IAM User Guide. -// -// When you pass an access key ID to this operation, it returns the ID of the -// AWS account to which the keys belong. Access key IDs beginning with AKIA -// are long-term credentials for an IAM user or the AWS account root user. Access -// key IDs beginning with ASIA are temporary credentials that are created using -// STS operations. If the account in the response belongs to you, you can sign -// in as the root user and review your root user access keys. Then, you can -// pull a credentials report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html) -// to learn which IAM user owns the keys. To learn who requested the temporary -// credentials for an ASIA access key, view the STS events in your CloudTrail -// logs (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html) -// in the IAM User Guide. -// -// This operation does not indicate the state of the access key. The key might -// be active, inactive, or deleted. Active keys might not have permissions to -// perform an operation. Providing a deleted access key might return an error -// that the key doesn't exist. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetAccessKeyInfo for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo -func (c *STS) GetAccessKeyInfo(input *GetAccessKeyInfoInput) (*GetAccessKeyInfoOutput, error) { - req, out := c.GetAccessKeyInfoRequest(input) - return out, req.Send() -} - -// GetAccessKeyInfoWithContext is the same as GetAccessKeyInfo with the addition of -// the ability to pass a context and additional request options. -// -// See GetAccessKeyInfo for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetAccessKeyInfoWithContext(ctx aws.Context, input *GetAccessKeyInfoInput, opts ...request.Option) (*GetAccessKeyInfoOutput, error) { - req, out := c.GetAccessKeyInfoRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetCallerIdentity = "GetCallerIdentity" - -// GetCallerIdentityRequest generates a "aws/request.Request" representing the -// client's request for the GetCallerIdentity operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetCallerIdentity for more information on using the GetCallerIdentity -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetCallerIdentityRequest method. -// req, resp := client.GetCallerIdentityRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity -func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *request.Request, output *GetCallerIdentityOutput) { - op := &request.Operation{ - Name: opGetCallerIdentity, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetCallerIdentityInput{} - } - - output = &GetCallerIdentityOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetCallerIdentity API operation for AWS Security Token Service. -// -// Returns details about the IAM user or role whose credentials are used to -// call the operation. -// -// No permissions are required to perform this operation. If an administrator -// adds a policy to your IAM user or role that explicitly denies access to the -// sts:GetCallerIdentity action, you can still perform this operation. Permissions -// are not required because the same information is returned when an IAM user -// or role is denied access. To view an example response, see I Am Not Authorized -// to Perform: iam:DeleteVirtualMFADevice (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa) -// in the IAM User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetCallerIdentity for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity -func (c *STS) GetCallerIdentity(input *GetCallerIdentityInput) (*GetCallerIdentityOutput, error) { - req, out := c.GetCallerIdentityRequest(input) - return out, req.Send() -} - -// GetCallerIdentityWithContext is the same as GetCallerIdentity with the addition of -// the ability to pass a context and additional request options. -// -// See GetCallerIdentity for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetCallerIdentityWithContext(ctx aws.Context, input *GetCallerIdentityInput, opts ...request.Option) (*GetCallerIdentityOutput, error) { - req, out := c.GetCallerIdentityRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetFederationToken = "GetFederationToken" - -// GetFederationTokenRequest generates a "aws/request.Request" representing the -// client's request for the GetFederationToken operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetFederationToken for more information on using the GetFederationToken -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetFederationTokenRequest method. -// req, resp := client.GetFederationTokenRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken -func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *request.Request, output *GetFederationTokenOutput) { - op := &request.Operation{ - Name: opGetFederationToken, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetFederationTokenInput{} - } - - output = &GetFederationTokenOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetFederationToken API operation for AWS Security Token Service. -// -// Returns a set of temporary security credentials (consisting of an access -// key ID, a secret access key, and a security token) for a federated user. -// A typical use is in a proxy application that gets temporary security credentials -// on behalf of distributed applications inside a corporate network. You must -// call the GetFederationToken operation using the long-term security credentials -// of an IAM user. As a result, this call is appropriate in contexts where those -// credentials can be safely stored, usually in a server-based application. -// For a comparison of GetFederationToken with the other API operations that -// produce temporary credentials, see Requesting Temporary Security Credentials -// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// You can create a mobile-based or browser-based app that can authenticate -// users using a web identity provider like Login with Amazon, Facebook, Google, -// or an OpenID Connect-compatible identity provider. In this case, we recommend -// that you use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity. -// For more information, see Federation Through a Web-based Identity Provider -// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity) -// in the IAM User Guide. -// -// You can also call GetFederationToken using the security credentials of an -// AWS account root user, but we do not recommend it. Instead, we recommend -// that you create an IAM user for the purpose of the proxy application. Then -// attach a policy to the IAM user that limits federated users to only the actions -// and resources that they need to access. For more information, see IAM Best -// Practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) -// in the IAM User Guide. -// -// Session duration -// -// The temporary credentials are valid for the specified duration, from 900 -// seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default -// session duration is 43,200 seconds (12 hours). Temporary credentials that -// are obtained by using AWS account root user credentials have a maximum duration -// of 3,600 seconds (1 hour). -// -// Permissions -// -// You can use the temporary credentials created by GetFederationToken in any -// AWS service except the following: -// -// * You cannot call any IAM operations using the AWS CLI or the AWS API. -// -// * You cannot call any STS operations except GetCallerIdentity. -// -// You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// to this operation. You can pass a single JSON policy document to use as an -// inline session policy. You can also specify up to 10 managed policies to -// use as managed session policies. The plain text that you use for both inline -// and managed session policies can't exceed 2,048 characters. -// -// Though the session policy parameters are optional, if you do not pass a policy, -// then the resulting federated user session has no permissions. When you pass -// session policies, the session permissions are the intersection of the IAM -// user policies and the session policies that you pass. This gives you a way -// to further restrict the permissions for a federated user. You cannot use -// session policies to grant more permissions than those that are defined in -// the permissions policy of the IAM user. For more information, see Session -// Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) -// in the IAM User Guide. For information about using GetFederationToken to -// create temporary security credentials, see GetFederationToken—Federation -// Through a Custom Identity Broker (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken). -// -// You can use the credentials to access a resource that has a resource-based -// policy. If that policy specifically references the federated user session -// in the Principal element of the policy, the session has the permissions allowed -// by the policy. These permissions are granted in addition to the permissions -// granted by the session policies. -// -// Tags -// -// (Optional) You can pass tag key-value pairs to your session. These are called -// session tags. For more information about session tags, see Passing Session -// Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// An administrator must grant you the permissions necessary to pass session -// tags. The administrator can also create granular permissions to allow you -// to pass only specific session tags. For more information, see Tutorial: Using -// Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) -// in the IAM User Guide. -// -// Tag key–value pairs are not case sensitive, but case is preserved. This -// means that you cannot have separate Department and department tag keys. Assume -// that the user that you are federating has the Department=Marketing tag and -// you pass the department=engineering session tag. Department and department -// are not saved as separate tags, and the session tag passed in the request -// takes precedence over the user tag. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetFederationToken for usage and error information. -// -// Returned Error Codes: -// * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument" -// The request was rejected because the policy document was malformed. The error -// message describes the specific error. -// -// * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge" -// The request was rejected because the total packed size of the session policies -// and session tags combined was too large. An AWS conversion compresses the -// session policy document, session policy ARNs, and session tags into a packed -// binary format that has a separate limit. The error message indicates by percentage -// how close the policies and tags are to the upper size limit. For more information, -// see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -// -// You could receive this error even though you meet other defined session policy -// and session tag limits. For more information, see IAM and STS Entity Character -// Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken -func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederationTokenOutput, error) { - req, out := c.GetFederationTokenRequest(input) - return out, req.Send() -} - -// GetFederationTokenWithContext is the same as GetFederationToken with the addition of -// the ability to pass a context and additional request options. -// -// See GetFederationToken for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetFederationTokenWithContext(ctx aws.Context, input *GetFederationTokenInput, opts ...request.Option) (*GetFederationTokenOutput, error) { - req, out := c.GetFederationTokenRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetSessionToken = "GetSessionToken" - -// GetSessionTokenRequest generates a "aws/request.Request" representing the -// client's request for the GetSessionToken operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetSessionToken for more information on using the GetSessionToken -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetSessionTokenRequest method. -// req, resp := client.GetSessionTokenRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken -func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.Request, output *GetSessionTokenOutput) { - op := &request.Operation{ - Name: opGetSessionToken, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetSessionTokenInput{} - } - - output = &GetSessionTokenOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetSessionToken API operation for AWS Security Token Service. -// -// Returns a set of temporary credentials for an AWS account or IAM user. The -// credentials consist of an access key ID, a secret access key, and a security -// token. Typically, you use GetSessionToken if you want to use MFA to protect -// programmatic calls to specific AWS API operations like Amazon EC2 StopInstances. -// MFA-enabled IAM users would need to call GetSessionToken and submit an MFA -// code that is associated with their MFA device. Using the temporary security -// credentials that are returned from the call, IAM users can then make programmatic -// calls to API operations that require MFA authentication. If you do not supply -// a correct MFA code, then the API returns an access denied error. For a comparison -// of GetSessionToken with the other API operations that produce temporary credentials, -// see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) -// and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) -// in the IAM User Guide. -// -// Session Duration -// -// The GetSessionToken operation must be called by using the long-term AWS security -// credentials of the AWS account root user or an IAM user. Credentials that -// are created by IAM users are valid for the duration that you specify. This -// duration can range from 900 seconds (15 minutes) up to a maximum of 129,600 -// seconds (36 hours), with a default of 43,200 seconds (12 hours). Credentials -// based on account credentials can range from 900 seconds (15 minutes) up to -// 3,600 seconds (1 hour), with a default of 1 hour. -// -// Permissions -// -// The temporary security credentials created by GetSessionToken can be used -// to make API calls to any AWS service with the following exceptions: -// -// * You cannot call any IAM API operations unless MFA authentication information -// is included in the request. -// -// * You cannot call any STS API except AssumeRole or GetCallerIdentity. -// -// We recommend that you do not call GetSessionToken with AWS account root user -// credentials. Instead, follow our best practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) -// by creating one or more IAM users, giving them the necessary permissions, -// and using IAM users for everyday interaction with AWS. -// -// The credentials that are returned by GetSessionToken are based on permissions -// associated with the user whose credentials were used to call the operation. -// If GetSessionToken is called using AWS account root user credentials, the -// temporary credentials have root user permissions. Similarly, if GetSessionToken -// is called using the credentials of an IAM user, the temporary credentials -// have the same permissions as the IAM user. -// -// For more information about using GetSessionToken to create temporary credentials, -// go to Temporary Credentials for Users in Untrusted Environments (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) -// in the IAM User Guide. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetSessionToken for usage and error information. -// -// Returned Error Codes: -// * ErrCodeRegionDisabledException "RegionDisabledException" -// STS is not activated in the requested region for the account that is being -// asked to generate credentials. The account administrator must use the IAM -// console to activate STS in that region. For more information, see Activating -// and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken -func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) { - req, out := c.GetSessionTokenRequest(input) - return out, req.Send() -} - -// GetSessionTokenWithContext is the same as GetSessionToken with the addition of -// the ability to pass a context and additional request options. -// -// See GetSessionToken for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetSessionTokenWithContext(ctx aws.Context, input *GetSessionTokenInput, opts ...request.Option) (*GetSessionTokenOutput, error) { - req, out := c.GetSessionTokenRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type AssumeRoleInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, of the role session. The value can range from 900 - // seconds (15 minutes) up to the maximum session duration setting for the role. - // This setting can have a value from 1 hour to 12 hours. If you specify a value - // higher than this setting, the operation fails. For example, if you specify - // a session duration of 12 hours, but your administrator set the maximum session - // duration to 6 hours, your operation fails. To learn how to view the maximum - // value for your role, see View the Maximum Session Duration Setting for a - // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) - // in the IAM User Guide. - // - // By default, the value is set to 3600 seconds. - // - // The DurationSeconds parameter is separate from the duration of a console - // session that you might request using the returned credentials. The request - // to the federation endpoint for a console sign-in token takes a SessionDuration - // parameter that specifies the maximum length of the console session. For more - // information, see Creating a URL that Enables Federated Users to Access the - // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. - DurationSeconds *int64 `min:"900" type:"integer"` - - // A unique identifier that might be required when you assume a role in another - // account. If the administrator of the account to which the role belongs provided - // you with an external ID, then provide that value in the ExternalId parameter. - // This value can be any string, such as a passphrase or account number. A cross-account - // role is usually set up to trust everyone in an account. Therefore, the administrator - // of the trusting account might send an external ID to the administrator of - // the trusted account. That way, only someone with the ID can assume the role, - // rather than everyone in the account. For more information about the external - // ID, see How to Use an External ID When Granting Access to Your AWS Resources - // to a Third Party (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) - // in the IAM User Guide. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@:/- - ExternalId *string `min:"2" type:"string"` - - // An IAM policy in JSON format that you want to use as an inline session policy. - // - // This parameter is optional. Passing policies to this operation returns new - // temporary credentials. The resulting session's permissions are the intersection - // of the role's identity-based policy and the session policies. You can use - // the role's temporary credentials in subsequent AWS API calls to access resources - // in the account that owns the role. You cannot use session policies to grant - // more permissions than those allowed by the identity-based policy of the role - // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - // - // The plain text that you use for both inline and managed session policies - // can't exceed 2,048 characters. The JSON policy characters can be any ASCII - // character from the space character to the end of the valid character list - // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - Policy *string `min:"1" type:"string"` - - // The Amazon Resource Names (ARNs) of the IAM managed policies that you want - // to use as managed session policies. The policies must exist in the same account - // as the role. - // - // This parameter is optional. You can provide up to 10 managed policy ARNs. - // However, the plain text that you use for both inline and managed session - // policies can't exceed 2,048 characters. For more information about ARNs, - // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the AWS General Reference. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - // - // Passing policies to this operation returns new temporary credentials. The - // resulting session's permissions are the intersection of the role's identity-based - // policy and the session policies. You can use the role's temporary credentials - // in subsequent AWS API calls to access resources in the account that owns - // the role. You cannot use session policies to grant more permissions than - // those allowed by the identity-based policy of the role that is being assumed. - // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - PolicyArns []*PolicyDescriptorType `type:"list"` - - // The Amazon Resource Name (ARN) of the role to assume. - // - // RoleArn is a required field - RoleArn *string `min:"20" type:"string" required:"true"` - - // An identifier for the assumed role session. - // - // Use the role session name to uniquely identify a session when the same role - // is assumed by different principals or for different reasons. In cross-account - // scenarios, the role session name is visible to, and can be logged by the - // account that owns the role. The role session name is also used in the ARN - // of the assumed role principal. This means that subsequent cross-account API - // requests that use the temporary security credentials will expose the role - // session name to the external account in their AWS CloudTrail logs. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - // - // RoleSessionName is a required field - RoleSessionName *string `min:"2" type:"string" required:"true"` - - // The identification number of the MFA device that is associated with the user - // who is making the AssumeRole call. Specify this value if the trust policy - // of the role being assumed includes a condition that requires MFA authentication. - // The value is either the serial number for a hardware device (such as GAHT12345678) - // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - SerialNumber *string `min:"9" type:"string"` - - // A list of session tags that you want to pass. Each session tag consists of - // a key name and an associated value. For more information about session tags, - // see Tagging AWS STS Sessions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) - // in the IAM User Guide. - // - // This parameter is optional. You can pass up to 50 session tags. The plain - // text session tag keys can’t exceed 128 characters, and the values can’t - // exceed 256 characters. For these and additional limits, see IAM and STS Character - // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - // - // You can pass a session tag with the same key as a tag that is already attached - // to the role. When you do, session tags override a role tag with the same - // key. - // - // Tag key–value pairs are not case sensitive, but case is preserved. This - // means that you cannot have separate Department and department tag keys. Assume - // that the role has the Department=Marketing tag and you pass the department=engineering - // session tag. Department and department are not saved as separate tags, and - // the session tag passed in the request takes precedence over the role tag. - // - // Additionally, if you used temporary credentials to perform this operation, - // the new session inherits any transitive session tags from the calling session. - // If you pass a session tag with the same key as an inherited tag, the operation - // fails. To view the inherited tags for a session, see the AWS CloudTrail logs. - // For more information, see Viewing Session Tags in CloudTrail (https://docs.aws.amazon.com/IAM/latest/UserGuide/session-tags.html#id_session-tags_ctlogs) - // in the IAM User Guide. - Tags []*Tag `type:"list"` - - // The value provided by the MFA device, if the trust policy of the role being - // assumed requires MFA (that is, if the policy includes a condition that tests - // for MFA). If the role being assumed requires MFA and if the TokenCode value - // is missing or expired, the AssumeRole call returns an "access denied" error. - // - // The format for this parameter, as described by its regex pattern, is a sequence - // of six numeric digits. - TokenCode *string `min:"6" type:"string"` - - // A list of keys for session tags that you want to set as transitive. If you - // set a tag key as transitive, the corresponding key and value passes to subsequent - // sessions in a role chain. For more information, see Chaining Roles with Session - // Tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining) - // in the IAM User Guide. - // - // This parameter is optional. When you set session tags as transitive, the - // session policy and session tags packed binary limit is not affected. - // - // If you choose not to specify a transitive tag key, then no tags are passed - // from this session to any subsequent sessions. - TransitiveTagKeys []*string `type:"list"` -} - -// String returns the string representation -func (s AssumeRoleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AssumeRoleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AssumeRoleInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.ExternalId != nil && len(*s.ExternalId) < 2 { - invalidParams.Add(request.NewErrParamMinLen("ExternalId", 2)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.RoleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RoleArn")) - } - if s.RoleArn != nil && len(*s.RoleArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) - } - if s.RoleSessionName == nil { - invalidParams.Add(request.NewErrParamRequired("RoleSessionName")) - } - if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { - invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2)) - } - if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { - invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9)) - } - if s.TokenCode != nil && len(*s.TokenCode) < 6 { - invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) - } - if s.PolicyArns != nil { - for i, v := range s.PolicyArns { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *AssumeRoleInput) SetDurationSeconds(v int64) *AssumeRoleInput { - s.DurationSeconds = &v - return s -} - -// SetExternalId sets the ExternalId field's value. -func (s *AssumeRoleInput) SetExternalId(v string) *AssumeRoleInput { - s.ExternalId = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *AssumeRoleInput) SetPolicy(v string) *AssumeRoleInput { - s.Policy = &v - return s -} - -// SetPolicyArns sets the PolicyArns field's value. -func (s *AssumeRoleInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleInput { - s.PolicyArns = v - return s -} - -// SetRoleArn sets the RoleArn field's value. -func (s *AssumeRoleInput) SetRoleArn(v string) *AssumeRoleInput { - s.RoleArn = &v - return s -} - -// SetRoleSessionName sets the RoleSessionName field's value. -func (s *AssumeRoleInput) SetRoleSessionName(v string) *AssumeRoleInput { - s.RoleSessionName = &v - return s -} - -// SetSerialNumber sets the SerialNumber field's value. -func (s *AssumeRoleInput) SetSerialNumber(v string) *AssumeRoleInput { - s.SerialNumber = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *AssumeRoleInput) SetTags(v []*Tag) *AssumeRoleInput { - s.Tags = v - return s -} - -// SetTokenCode sets the TokenCode field's value. -func (s *AssumeRoleInput) SetTokenCode(v string) *AssumeRoleInput { - s.TokenCode = &v - return s -} - -// SetTransitiveTagKeys sets the TransitiveTagKeys field's value. -func (s *AssumeRoleInput) SetTransitiveTagKeys(v []*string) *AssumeRoleInput { - s.TransitiveTagKeys = v - return s -} - -// Contains the response to a successful AssumeRole request, including temporary -// AWS credentials that can be used to make AWS requests. -type AssumeRoleOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers - // that you can use to refer to the resulting temporary security credentials. - // For example, you can reference these credentials as a principal in a resource-based - // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName - // that you specified when you called AssumeRole. - AssumedRoleUser *AssumedRoleUser `type:"structure"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // The size of the security token that STS API operations return is not fixed. - // We strongly recommend that you make no assumptions about the maximum size. - Credentials *Credentials `type:"structure"` - - // A percentage value that indicates the packed size of the session policies - // and session tags combined passed in the request. The request fails if the - // packed size is greater than 100 percent, which means the policies and tags - // exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` -} - -// String returns the string representation -func (s AssumeRoleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleOutput) GoString() string { - return s.String() -} - -// SetAssumedRoleUser sets the AssumedRoleUser field's value. -func (s *AssumeRoleOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleOutput { - s.AssumedRoleUser = v - return s -} - -// SetCredentials sets the Credentials field's value. -func (s *AssumeRoleOutput) SetCredentials(v *Credentials) *AssumeRoleOutput { - s.Credentials = v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *AssumeRoleOutput) SetPackedPolicySize(v int64) *AssumeRoleOutput { - s.PackedPolicySize = &v - return s -} - -type AssumeRoleWithSAMLInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, of the role session. Your role session lasts for - // the duration that you specify for the DurationSeconds parameter, or until - // the time specified in the SAML authentication response's SessionNotOnOrAfter - // value, whichever is shorter. You can provide a DurationSeconds value from - // 900 seconds (15 minutes) up to the maximum session duration setting for the - // role. This setting can have a value from 1 hour to 12 hours. If you specify - // a value higher than this setting, the operation fails. For example, if you - // specify a session duration of 12 hours, but your administrator set the maximum - // session duration to 6 hours, your operation fails. To learn how to view the - // maximum value for your role, see View the Maximum Session Duration Setting - // for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) - // in the IAM User Guide. - // - // By default, the value is set to 3600 seconds. - // - // The DurationSeconds parameter is separate from the duration of a console - // session that you might request using the returned credentials. The request - // to the federation endpoint for a console sign-in token takes a SessionDuration - // parameter that specifies the maximum length of the console session. For more - // information, see Creating a URL that Enables Federated Users to Access the - // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. - DurationSeconds *int64 `min:"900" type:"integer"` - - // An IAM policy in JSON format that you want to use as an inline session policy. - // - // This parameter is optional. Passing policies to this operation returns new - // temporary credentials. The resulting session's permissions are the intersection - // of the role's identity-based policy and the session policies. You can use - // the role's temporary credentials in subsequent AWS API calls to access resources - // in the account that owns the role. You cannot use session policies to grant - // more permissions than those allowed by the identity-based policy of the role - // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - // - // The plain text that you use for both inline and managed session policies - // can't exceed 2,048 characters. The JSON policy characters can be any ASCII - // character from the space character to the end of the valid character list - // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - Policy *string `min:"1" type:"string"` - - // The Amazon Resource Names (ARNs) of the IAM managed policies that you want - // to use as managed session policies. The policies must exist in the same account - // as the role. - // - // This parameter is optional. You can provide up to 10 managed policy ARNs. - // However, the plain text that you use for both inline and managed session - // policies can't exceed 2,048 characters. For more information about ARNs, - // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the AWS General Reference. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - // - // Passing policies to this operation returns new temporary credentials. The - // resulting session's permissions are the intersection of the role's identity-based - // policy and the session policies. You can use the role's temporary credentials - // in subsequent AWS API calls to access resources in the account that owns - // the role. You cannot use session policies to grant more permissions than - // those allowed by the identity-based policy of the role that is being assumed. - // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - PolicyArns []*PolicyDescriptorType `type:"list"` - - // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes - // the IdP. - // - // PrincipalArn is a required field - PrincipalArn *string `min:"20" type:"string" required:"true"` - - // The Amazon Resource Name (ARN) of the role that the caller is assuming. - // - // RoleArn is a required field - RoleArn *string `min:"20" type:"string" required:"true"` - - // The base-64 encoded SAML authentication response provided by the IdP. - // - // For more information, see Configuring a Relying Party and Adding Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) - // in the IAM User Guide. - // - // SAMLAssertion is a required field - SAMLAssertion *string `min:"4" type:"string" required:"true" sensitive:"true"` -} - -// String returns the string representation -func (s AssumeRoleWithSAMLInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithSAMLInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AssumeRoleWithSAMLInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithSAMLInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.PrincipalArn == nil { - invalidParams.Add(request.NewErrParamRequired("PrincipalArn")) - } - if s.PrincipalArn != nil && len(*s.PrincipalArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("PrincipalArn", 20)) - } - if s.RoleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RoleArn")) - } - if s.RoleArn != nil && len(*s.RoleArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) - } - if s.SAMLAssertion == nil { - invalidParams.Add(request.NewErrParamRequired("SAMLAssertion")) - } - if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 { - invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4)) - } - if s.PolicyArns != nil { - for i, v := range s.PolicyArns { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *AssumeRoleWithSAMLInput) SetDurationSeconds(v int64) *AssumeRoleWithSAMLInput { - s.DurationSeconds = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *AssumeRoleWithSAMLInput) SetPolicy(v string) *AssumeRoleWithSAMLInput { - s.Policy = &v - return s -} - -// SetPolicyArns sets the PolicyArns field's value. -func (s *AssumeRoleWithSAMLInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithSAMLInput { - s.PolicyArns = v - return s -} - -// SetPrincipalArn sets the PrincipalArn field's value. -func (s *AssumeRoleWithSAMLInput) SetPrincipalArn(v string) *AssumeRoleWithSAMLInput { - s.PrincipalArn = &v - return s -} - -// SetRoleArn sets the RoleArn field's value. -func (s *AssumeRoleWithSAMLInput) SetRoleArn(v string) *AssumeRoleWithSAMLInput { - s.RoleArn = &v - return s -} - -// SetSAMLAssertion sets the SAMLAssertion field's value. -func (s *AssumeRoleWithSAMLInput) SetSAMLAssertion(v string) *AssumeRoleWithSAMLInput { - s.SAMLAssertion = &v - return s -} - -// Contains the response to a successful AssumeRoleWithSAML request, including -// temporary AWS credentials that can be used to make AWS requests. -type AssumeRoleWithSAMLOutput struct { - _ struct{} `type:"structure"` - - // The identifiers for the temporary security credentials that the operation - // returns. - AssumedRoleUser *AssumedRoleUser `type:"structure"` - - // The value of the Recipient attribute of the SubjectConfirmationData element - // of the SAML assertion. - Audience *string `type:"string"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // The size of the security token that STS API operations return is not fixed. - // We strongly recommend that you make no assumptions about the maximum size. - Credentials *Credentials `type:"structure"` - - // The value of the Issuer element of the SAML assertion. - Issuer *string `type:"string"` - - // A hash value based on the concatenation of the Issuer response value, the - // AWS account ID, and the friendly name (the last part of the ARN) of the SAML - // provider in IAM. The combination of NameQualifier and Subject can be used - // to uniquely identify a federated user. - // - // The following pseudocode shows how the hash value is calculated: - // - // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP" - // ) ) - NameQualifier *string `type:"string"` - - // A percentage value that indicates the packed size of the session policies - // and session tags combined passed in the request. The request fails if the - // packed size is greater than 100 percent, which means the policies and tags - // exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` - - // The value of the NameID element in the Subject element of the SAML assertion. - Subject *string `type:"string"` - - // The format of the name ID, as defined by the Format attribute in the NameID - // element of the SAML assertion. Typical examples of the format are transient - // or persistent. - // - // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format, - // that prefix is removed. For example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient - // is returned as transient. If the format includes any other prefix, the format - // is returned with no modifications. - SubjectType *string `type:"string"` -} - -// String returns the string representation -func (s AssumeRoleWithSAMLOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithSAMLOutput) GoString() string { - return s.String() -} - -// SetAssumedRoleUser sets the AssumedRoleUser field's value. -func (s *AssumeRoleWithSAMLOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleWithSAMLOutput { - s.AssumedRoleUser = v - return s -} - -// SetAudience sets the Audience field's value. -func (s *AssumeRoleWithSAMLOutput) SetAudience(v string) *AssumeRoleWithSAMLOutput { - s.Audience = &v - return s -} - -// SetCredentials sets the Credentials field's value. -func (s *AssumeRoleWithSAMLOutput) SetCredentials(v *Credentials) *AssumeRoleWithSAMLOutput { - s.Credentials = v - return s -} - -// SetIssuer sets the Issuer field's value. -func (s *AssumeRoleWithSAMLOutput) SetIssuer(v string) *AssumeRoleWithSAMLOutput { - s.Issuer = &v - return s -} - -// SetNameQualifier sets the NameQualifier field's value. -func (s *AssumeRoleWithSAMLOutput) SetNameQualifier(v string) *AssumeRoleWithSAMLOutput { - s.NameQualifier = &v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *AssumeRoleWithSAMLOutput) SetPackedPolicySize(v int64) *AssumeRoleWithSAMLOutput { - s.PackedPolicySize = &v - return s -} - -// SetSubject sets the Subject field's value. -func (s *AssumeRoleWithSAMLOutput) SetSubject(v string) *AssumeRoleWithSAMLOutput { - s.Subject = &v - return s -} - -// SetSubjectType sets the SubjectType field's value. -func (s *AssumeRoleWithSAMLOutput) SetSubjectType(v string) *AssumeRoleWithSAMLOutput { - s.SubjectType = &v - return s -} - -type AssumeRoleWithWebIdentityInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, of the role session. The value can range from 900 - // seconds (15 minutes) up to the maximum session duration setting for the role. - // This setting can have a value from 1 hour to 12 hours. If you specify a value - // higher than this setting, the operation fails. For example, if you specify - // a session duration of 12 hours, but your administrator set the maximum session - // duration to 6 hours, your operation fails. To learn how to view the maximum - // value for your role, see View the Maximum Session Duration Setting for a - // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) - // in the IAM User Guide. - // - // By default, the value is set to 3600 seconds. - // - // The DurationSeconds parameter is separate from the duration of a console - // session that you might request using the returned credentials. The request - // to the federation endpoint for a console sign-in token takes a SessionDuration - // parameter that specifies the maximum length of the console session. For more - // information, see Creating a URL that Enables Federated Users to Access the - // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) - // in the IAM User Guide. - DurationSeconds *int64 `min:"900" type:"integer"` - - // An IAM policy in JSON format that you want to use as an inline session policy. - // - // This parameter is optional. Passing policies to this operation returns new - // temporary credentials. The resulting session's permissions are the intersection - // of the role's identity-based policy and the session policies. You can use - // the role's temporary credentials in subsequent AWS API calls to access resources - // in the account that owns the role. You cannot use session policies to grant - // more permissions than those allowed by the identity-based policy of the role - // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - // - // The plain text that you use for both inline and managed session policies - // can't exceed 2,048 characters. The JSON policy characters can be any ASCII - // character from the space character to the end of the valid character list - // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - Policy *string `min:"1" type:"string"` - - // The Amazon Resource Names (ARNs) of the IAM managed policies that you want - // to use as managed session policies. The policies must exist in the same account - // as the role. - // - // This parameter is optional. You can provide up to 10 managed policy ARNs. - // However, the plain text that you use for both inline and managed session - // policies can't exceed 2,048 characters. For more information about ARNs, - // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the AWS General Reference. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - // - // Passing policies to this operation returns new temporary credentials. The - // resulting session's permissions are the intersection of the role's identity-based - // policy and the session policies. You can use the role's temporary credentials - // in subsequent AWS API calls to access resources in the account that owns - // the role. You cannot use session policies to grant more permissions than - // those allowed by the identity-based policy of the role that is being assumed. - // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - PolicyArns []*PolicyDescriptorType `type:"list"` - - // The fully qualified host component of the domain name of the identity provider. - // - // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com - // and graph.facebook.com are the only supported identity providers for OAuth - // 2.0 access tokens. Do not include URL schemes and port numbers. - // - // Do not specify this value for OpenID Connect ID tokens. - ProviderId *string `min:"4" type:"string"` - - // The Amazon Resource Name (ARN) of the role that the caller is assuming. - // - // RoleArn is a required field - RoleArn *string `min:"20" type:"string" required:"true"` - - // An identifier for the assumed role session. Typically, you pass the name - // or identifier that is associated with the user who is using your application. - // That way, the temporary security credentials that your application will use - // are associated with that user. This session name is included as part of the - // ARN and assumed role ID in the AssumedRoleUser response element. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - // - // RoleSessionName is a required field - RoleSessionName *string `min:"2" type:"string" required:"true"` - - // The OAuth 2.0 access token or OpenID Connect ID token that is provided by - // the identity provider. Your application must get this token by authenticating - // the user who is using your application with a web identity provider before - // the application makes an AssumeRoleWithWebIdentity call. - // - // WebIdentityToken is a required field - WebIdentityToken *string `min:"4" type:"string" required:"true" sensitive:"true"` -} - -// String returns the string representation -func (s AssumeRoleWithWebIdentityInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithWebIdentityInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AssumeRoleWithWebIdentityInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithWebIdentityInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.ProviderId != nil && len(*s.ProviderId) < 4 { - invalidParams.Add(request.NewErrParamMinLen("ProviderId", 4)) - } - if s.RoleArn == nil { - invalidParams.Add(request.NewErrParamRequired("RoleArn")) - } - if s.RoleArn != nil && len(*s.RoleArn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20)) - } - if s.RoleSessionName == nil { - invalidParams.Add(request.NewErrParamRequired("RoleSessionName")) - } - if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { - invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2)) - } - if s.WebIdentityToken == nil { - invalidParams.Add(request.NewErrParamRequired("WebIdentityToken")) - } - if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 { - invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4)) - } - if s.PolicyArns != nil { - for i, v := range s.PolicyArns { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *AssumeRoleWithWebIdentityInput) SetDurationSeconds(v int64) *AssumeRoleWithWebIdentityInput { - s.DurationSeconds = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *AssumeRoleWithWebIdentityInput) SetPolicy(v string) *AssumeRoleWithWebIdentityInput { - s.Policy = &v - return s -} - -// SetPolicyArns sets the PolicyArns field's value. -func (s *AssumeRoleWithWebIdentityInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithWebIdentityInput { - s.PolicyArns = v - return s -} - -// SetProviderId sets the ProviderId field's value. -func (s *AssumeRoleWithWebIdentityInput) SetProviderId(v string) *AssumeRoleWithWebIdentityInput { - s.ProviderId = &v - return s -} - -// SetRoleArn sets the RoleArn field's value. -func (s *AssumeRoleWithWebIdentityInput) SetRoleArn(v string) *AssumeRoleWithWebIdentityInput { - s.RoleArn = &v - return s -} - -// SetRoleSessionName sets the RoleSessionName field's value. -func (s *AssumeRoleWithWebIdentityInput) SetRoleSessionName(v string) *AssumeRoleWithWebIdentityInput { - s.RoleSessionName = &v - return s -} - -// SetWebIdentityToken sets the WebIdentityToken field's value. -func (s *AssumeRoleWithWebIdentityInput) SetWebIdentityToken(v string) *AssumeRoleWithWebIdentityInput { - s.WebIdentityToken = &v - return s -} - -// Contains the response to a successful AssumeRoleWithWebIdentity request, -// including temporary AWS credentials that can be used to make AWS requests. -type AssumeRoleWithWebIdentityOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers - // that you can use to refer to the resulting temporary security credentials. - // For example, you can reference these credentials as a principal in a resource-based - // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName - // that you specified when you called AssumeRole. - AssumedRoleUser *AssumedRoleUser `type:"structure"` - - // The intended audience (also known as client ID) of the web identity token. - // This is traditionally the client identifier issued to the application that - // requested the web identity token. - Audience *string `type:"string"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security token. - // - // The size of the security token that STS API operations return is not fixed. - // We strongly recommend that you make no assumptions about the maximum size. - Credentials *Credentials `type:"structure"` - - // A percentage value that indicates the packed size of the session policies - // and session tags combined passed in the request. The request fails if the - // packed size is greater than 100 percent, which means the policies and tags - // exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` - - // The issuing authority of the web identity token presented. For OpenID Connect - // ID tokens, this contains the value of the iss field. For OAuth 2.0 access - // tokens, this contains the value of the ProviderId parameter that was passed - // in the AssumeRoleWithWebIdentity request. - Provider *string `type:"string"` - - // The unique user identifier that is returned by the identity provider. This - // identifier is associated with the WebIdentityToken that was submitted with - // the AssumeRoleWithWebIdentity call. The identifier is typically unique to - // the user and the application that acquired the WebIdentityToken (pairwise - // identifier). For OpenID Connect ID tokens, this field contains the value - // returned by the identity provider as the token's sub (Subject) claim. - SubjectFromWebIdentityToken *string `min:"6" type:"string"` -} - -// String returns the string representation -func (s AssumeRoleWithWebIdentityOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumeRoleWithWebIdentityOutput) GoString() string { - return s.String() -} - -// SetAssumedRoleUser sets the AssumedRoleUser field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleWithWebIdentityOutput { - s.AssumedRoleUser = v - return s -} - -// SetAudience sets the Audience field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetAudience(v string) *AssumeRoleWithWebIdentityOutput { - s.Audience = &v - return s -} - -// SetCredentials sets the Credentials field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetCredentials(v *Credentials) *AssumeRoleWithWebIdentityOutput { - s.Credentials = v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetPackedPolicySize(v int64) *AssumeRoleWithWebIdentityOutput { - s.PackedPolicySize = &v - return s -} - -// SetProvider sets the Provider field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetProvider(v string) *AssumeRoleWithWebIdentityOutput { - s.Provider = &v - return s -} - -// SetSubjectFromWebIdentityToken sets the SubjectFromWebIdentityToken field's value. -func (s *AssumeRoleWithWebIdentityOutput) SetSubjectFromWebIdentityToken(v string) *AssumeRoleWithWebIdentityOutput { - s.SubjectFromWebIdentityToken = &v - return s -} - -// The identifiers for the temporary security credentials that the operation -// returns. -type AssumedRoleUser struct { - _ struct{} `type:"structure"` - - // The ARN of the temporary security credentials that are returned from the - // AssumeRole action. For more information about ARNs and how to use them in - // policies, see IAM Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) - // in the IAM User Guide. - // - // Arn is a required field - Arn *string `min:"20" type:"string" required:"true"` - - // A unique identifier that contains the role ID and the role session name of - // the role that is being assumed. The role ID is generated by AWS when the - // role is created. - // - // AssumedRoleId is a required field - AssumedRoleId *string `min:"2" type:"string" required:"true"` -} - -// String returns the string representation -func (s AssumedRoleUser) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AssumedRoleUser) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *AssumedRoleUser) SetArn(v string) *AssumedRoleUser { - s.Arn = &v - return s -} - -// SetAssumedRoleId sets the AssumedRoleId field's value. -func (s *AssumedRoleUser) SetAssumedRoleId(v string) *AssumedRoleUser { - s.AssumedRoleId = &v - return s -} - -// AWS credentials for API authentication. -type Credentials struct { - _ struct{} `type:"structure"` - - // The access key ID that identifies the temporary security credentials. - // - // AccessKeyId is a required field - AccessKeyId *string `min:"16" type:"string" required:"true"` - - // The date on which the current credentials expire. - // - // Expiration is a required field - Expiration *time.Time `type:"timestamp" required:"true"` - - // The secret access key that can be used to sign requests. - // - // SecretAccessKey is a required field - SecretAccessKey *string `type:"string" required:"true"` - - // The token that users must pass to the service API to use the temporary credentials. - // - // SessionToken is a required field - SessionToken *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s Credentials) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Credentials) GoString() string { - return s.String() -} - -// SetAccessKeyId sets the AccessKeyId field's value. -func (s *Credentials) SetAccessKeyId(v string) *Credentials { - s.AccessKeyId = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *Credentials) SetExpiration(v time.Time) *Credentials { - s.Expiration = &v - return s -} - -// SetSecretAccessKey sets the SecretAccessKey field's value. -func (s *Credentials) SetSecretAccessKey(v string) *Credentials { - s.SecretAccessKey = &v - return s -} - -// SetSessionToken sets the SessionToken field's value. -func (s *Credentials) SetSessionToken(v string) *Credentials { - s.SessionToken = &v - return s -} - -type DecodeAuthorizationMessageInput struct { - _ struct{} `type:"structure"` - - // The encoded message that was returned with the response. - // - // EncodedMessage is a required field - EncodedMessage *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation -func (s DecodeAuthorizationMessageInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DecodeAuthorizationMessageInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DecodeAuthorizationMessageInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DecodeAuthorizationMessageInput"} - if s.EncodedMessage == nil { - invalidParams.Add(request.NewErrParamRequired("EncodedMessage")) - } - if s.EncodedMessage != nil && len(*s.EncodedMessage) < 1 { - invalidParams.Add(request.NewErrParamMinLen("EncodedMessage", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncodedMessage sets the EncodedMessage field's value. -func (s *DecodeAuthorizationMessageInput) SetEncodedMessage(v string) *DecodeAuthorizationMessageInput { - s.EncodedMessage = &v - return s -} - -// A document that contains additional information about the authorization status -// of a request from an encoded message that is returned in response to an AWS -// request. -type DecodeAuthorizationMessageOutput struct { - _ struct{} `type:"structure"` - - // An XML document that contains the decoded message. - DecodedMessage *string `type:"string"` -} - -// String returns the string representation -func (s DecodeAuthorizationMessageOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DecodeAuthorizationMessageOutput) GoString() string { - return s.String() -} - -// SetDecodedMessage sets the DecodedMessage field's value. -func (s *DecodeAuthorizationMessageOutput) SetDecodedMessage(v string) *DecodeAuthorizationMessageOutput { - s.DecodedMessage = &v - return s -} - -// Identifiers for the federated user that is associated with the credentials. -type FederatedUser struct { - _ struct{} `type:"structure"` - - // The ARN that specifies the federated user that is associated with the credentials. - // For more information about ARNs and how to use them in policies, see IAM - // Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) - // in the IAM User Guide. - // - // Arn is a required field - Arn *string `min:"20" type:"string" required:"true"` - - // The string that identifies the federated user associated with the credentials, - // similar to the unique ID of an IAM user. - // - // FederatedUserId is a required field - FederatedUserId *string `min:"2" type:"string" required:"true"` -} - -// String returns the string representation -func (s FederatedUser) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s FederatedUser) GoString() string { - return s.String() -} - -// SetArn sets the Arn field's value. -func (s *FederatedUser) SetArn(v string) *FederatedUser { - s.Arn = &v - return s -} - -// SetFederatedUserId sets the FederatedUserId field's value. -func (s *FederatedUser) SetFederatedUserId(v string) *FederatedUser { - s.FederatedUserId = &v - return s -} - -type GetAccessKeyInfoInput struct { - _ struct{} `type:"structure"` - - // The identifier of an access key. - // - // This parameter allows (through its regex pattern) a string of characters - // that can consist of any upper- or lowercase letter or digit. - // - // AccessKeyId is a required field - AccessKeyId *string `min:"16" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetAccessKeyInfoInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetAccessKeyInfoInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetAccessKeyInfoInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetAccessKeyInfoInput"} - if s.AccessKeyId == nil { - invalidParams.Add(request.NewErrParamRequired("AccessKeyId")) - } - if s.AccessKeyId != nil && len(*s.AccessKeyId) < 16 { - invalidParams.Add(request.NewErrParamMinLen("AccessKeyId", 16)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessKeyId sets the AccessKeyId field's value. -func (s *GetAccessKeyInfoInput) SetAccessKeyId(v string) *GetAccessKeyInfoInput { - s.AccessKeyId = &v - return s -} - -type GetAccessKeyInfoOutput struct { - _ struct{} `type:"structure"` - - // The number used to identify the AWS account. - Account *string `type:"string"` -} - -// String returns the string representation -func (s GetAccessKeyInfoOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetAccessKeyInfoOutput) GoString() string { - return s.String() -} - -// SetAccount sets the Account field's value. -func (s *GetAccessKeyInfoOutput) SetAccount(v string) *GetAccessKeyInfoOutput { - s.Account = &v - return s -} - -type GetCallerIdentityInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s GetCallerIdentityInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetCallerIdentityInput) GoString() string { - return s.String() -} - -// Contains the response to a successful GetCallerIdentity request, including -// information about the entity making the request. -type GetCallerIdentityOutput struct { - _ struct{} `type:"structure"` - - // The AWS account ID number of the account that owns or contains the calling - // entity. - Account *string `type:"string"` - - // The AWS ARN associated with the calling entity. - Arn *string `min:"20" type:"string"` - - // The unique identifier of the calling entity. The exact value depends on the - // type of entity that is making the call. The values returned are those listed - // in the aws:userid column in the Principal table (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) - // found on the Policy Variables reference page in the IAM User Guide. - UserId *string `type:"string"` -} - -// String returns the string representation -func (s GetCallerIdentityOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetCallerIdentityOutput) GoString() string { - return s.String() -} - -// SetAccount sets the Account field's value. -func (s *GetCallerIdentityOutput) SetAccount(v string) *GetCallerIdentityOutput { - s.Account = &v - return s -} - -// SetArn sets the Arn field's value. -func (s *GetCallerIdentityOutput) SetArn(v string) *GetCallerIdentityOutput { - s.Arn = &v - return s -} - -// SetUserId sets the UserId field's value. -func (s *GetCallerIdentityOutput) SetUserId(v string) *GetCallerIdentityOutput { - s.UserId = &v - return s -} - -type GetFederationTokenInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, that the session should last. Acceptable durations - // for federation sessions range from 900 seconds (15 minutes) to 129,600 seconds - // (36 hours), with 43,200 seconds (12 hours) as the default. Sessions obtained - // using AWS account root user credentials are restricted to a maximum of 3,600 - // seconds (one hour). If the specified duration is longer than one hour, the - // session obtained by using root user credentials defaults to one hour. - DurationSeconds *int64 `min:"900" type:"integer"` - - // The name of the federated user. The name is used as an identifier for the - // temporary security credentials (such as Bob). For example, you can reference - // the federated user name in a resource-based policy, such as in an Amazon - // S3 bucket policy. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@- - // - // Name is a required field - Name *string `min:"2" type:"string" required:"true"` - - // An IAM policy in JSON format that you want to use as an inline session policy. - // - // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // to this operation. You can pass a single JSON policy document to use as an - // inline session policy. You can also specify up to 10 managed policies to - // use as managed session policies. - // - // This parameter is optional. However, if you do not pass any session policies, - // then the resulting federated user session has no permissions. - // - // When you pass session policies, the session permissions are the intersection - // of the IAM user policies and the session policies that you pass. This gives - // you a way to further restrict the permissions for a federated user. You cannot - // use session policies to grant more permissions than those that are defined - // in the permissions policy of the IAM user. For more information, see Session - // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - // - // The resulting credentials can be used to access a resource that has a resource-based - // policy. If that policy specifically references the federated user session - // in the Principal element of the policy, the session has the permissions allowed - // by the policy. These permissions are granted in addition to the permissions - // that are granted by the session policies. - // - // The plain text that you use for both inline and managed session policies - // can't exceed 2,048 characters. The JSON policy characters can be any ASCII - // character from the space character to the end of the valid character list - // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A), - // and carriage return (\u000D) characters. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - Policy *string `min:"1" type:"string"` - - // The Amazon Resource Names (ARNs) of the IAM managed policies that you want - // to use as a managed session policy. The policies must exist in the same account - // as the IAM user that is requesting federated access. - // - // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // to this operation. You can pass a single JSON policy document to use as an - // inline session policy. You can also specify up to 10 managed policies to - // use as managed session policies. The plain text that you use for both inline - // and managed session policies can't exceed 2,048 characters. You can provide - // up to 10 managed policy ARNs. For more information about ARNs, see Amazon - // Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the AWS General Reference. - // - // This parameter is optional. However, if you do not pass any session policies, - // then the resulting federated user session has no permissions. - // - // When you pass session policies, the session permissions are the intersection - // of the IAM user policies and the session policies that you pass. This gives - // you a way to further restrict the permissions for a federated user. You cannot - // use session policies to grant more permissions than those that are defined - // in the permissions policy of the IAM user. For more information, see Session - // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) - // in the IAM User Guide. - // - // The resulting credentials can be used to access a resource that has a resource-based - // policy. If that policy specifically references the federated user session - // in the Principal element of the policy, the session has the permissions allowed - // by the policy. These permissions are granted in addition to the permissions - // that are granted by the session policies. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - PolicyArns []*PolicyDescriptorType `type:"list"` - - // A list of session tags. Each session tag consists of a key name and an associated - // value. For more information about session tags, see Passing Session Tags - // in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) - // in the IAM User Guide. - // - // This parameter is optional. You can pass up to 50 session tags. The plain - // text session tag keys can’t exceed 128 characters and the values can’t - // exceed 256 characters. For these and additional limits, see IAM and STS Character - // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. - // - // An AWS conversion compresses the passed session policies and session tags - // into a packed binary format that has a separate limit. Your request can fail - // for this limit even if your plain text meets the other requirements. The - // PackedPolicySize response element indicates by percentage how close the policies - // and tags for your request are to the upper size limit. - // - // You can pass a session tag with the same key as a tag that is already attached - // to the user you are federating. When you do, session tags override a user - // tag with the same key. - // - // Tag key–value pairs are not case sensitive, but case is preserved. This - // means that you cannot have separate Department and department tag keys. Assume - // that the role has the Department=Marketing tag and you pass the department=engineering - // session tag. Department and department are not saved as separate tags, and - // the session tag passed in the request takes precedence over the role tag. - Tags []*Tag `type:"list"` -} - -// String returns the string representation -func (s GetFederationTokenInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetFederationTokenInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetFederationTokenInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetFederationTokenInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) - } - if s.Name != nil && len(*s.Name) < 2 { - invalidParams.Add(request.NewErrParamMinLen("Name", 2)) - } - if s.Policy != nil && len(*s.Policy) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) - } - if s.PolicyArns != nil { - for i, v := range s.PolicyArns { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *GetFederationTokenInput) SetDurationSeconds(v int64) *GetFederationTokenInput { - s.DurationSeconds = &v - return s -} - -// SetName sets the Name field's value. -func (s *GetFederationTokenInput) SetName(v string) *GetFederationTokenInput { - s.Name = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *GetFederationTokenInput) SetPolicy(v string) *GetFederationTokenInput { - s.Policy = &v - return s -} - -// SetPolicyArns sets the PolicyArns field's value. -func (s *GetFederationTokenInput) SetPolicyArns(v []*PolicyDescriptorType) *GetFederationTokenInput { - s.PolicyArns = v - return s -} - -// SetTags sets the Tags field's value. -func (s *GetFederationTokenInput) SetTags(v []*Tag) *GetFederationTokenInput { - s.Tags = v - return s -} - -// Contains the response to a successful GetFederationToken request, including -// temporary AWS credentials that can be used to make AWS requests. -type GetFederationTokenOutput struct { - _ struct{} `type:"structure"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // The size of the security token that STS API operations return is not fixed. - // We strongly recommend that you make no assumptions about the maximum size. - Credentials *Credentials `type:"structure"` - - // Identifiers for the federated user associated with the credentials (such - // as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob). You - // can use the federated user's ARN in your resource-based policies, such as - // an Amazon S3 bucket policy. - FederatedUser *FederatedUser `type:"structure"` - - // A percentage value that indicates the packed size of the session policies - // and session tags combined passed in the request. The request fails if the - // packed size is greater than 100 percent, which means the policies and tags - // exceeded the allowed space. - PackedPolicySize *int64 `type:"integer"` -} - -// String returns the string representation -func (s GetFederationTokenOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetFederationTokenOutput) GoString() string { - return s.String() -} - -// SetCredentials sets the Credentials field's value. -func (s *GetFederationTokenOutput) SetCredentials(v *Credentials) *GetFederationTokenOutput { - s.Credentials = v - return s -} - -// SetFederatedUser sets the FederatedUser field's value. -func (s *GetFederationTokenOutput) SetFederatedUser(v *FederatedUser) *GetFederationTokenOutput { - s.FederatedUser = v - return s -} - -// SetPackedPolicySize sets the PackedPolicySize field's value. -func (s *GetFederationTokenOutput) SetPackedPolicySize(v int64) *GetFederationTokenOutput { - s.PackedPolicySize = &v - return s -} - -type GetSessionTokenInput struct { - _ struct{} `type:"structure"` - - // The duration, in seconds, that the credentials should remain valid. Acceptable - // durations for IAM user sessions range from 900 seconds (15 minutes) to 129,600 - // seconds (36 hours), with 43,200 seconds (12 hours) as the default. Sessions - // for AWS account owners are restricted to a maximum of 3,600 seconds (one - // hour). If the duration is longer than one hour, the session for AWS account - // owners defaults to one hour. - DurationSeconds *int64 `min:"900" type:"integer"` - - // The identification number of the MFA device that is associated with the IAM - // user who is making the GetSessionToken call. Specify this value if the IAM - // user has a policy that requires MFA authentication. The value is either the - // serial number for a hardware device (such as GAHT12345678) or an Amazon Resource - // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). - // You can find the device for an IAM user by going to the AWS Management Console - // and viewing the user's security credentials. - // - // The regex used to validate this parameter is a string of characters consisting - // of upper- and lower-case alphanumeric characters with no spaces. You can - // also include underscores or any of the following characters: =,.@:/- - SerialNumber *string `min:"9" type:"string"` - - // The value provided by the MFA device, if MFA is required. If any policy requires - // the IAM user to submit an MFA code, specify this value. If MFA authentication - // is required, the user must provide a code when requesting a set of temporary - // security credentials. A user who fails to provide the code receives an "access - // denied" response when requesting resources that require MFA authentication. - // - // The format for this parameter, as described by its regex pattern, is a sequence - // of six numeric digits. - TokenCode *string `min:"6" type:"string"` -} - -// String returns the string representation -func (s GetSessionTokenInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetSessionTokenInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetSessionTokenInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetSessionTokenInput"} - if s.DurationSeconds != nil && *s.DurationSeconds < 900 { - invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900)) - } - if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { - invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9)) - } - if s.TokenCode != nil && len(*s.TokenCode) < 6 { - invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDurationSeconds sets the DurationSeconds field's value. -func (s *GetSessionTokenInput) SetDurationSeconds(v int64) *GetSessionTokenInput { - s.DurationSeconds = &v - return s -} - -// SetSerialNumber sets the SerialNumber field's value. -func (s *GetSessionTokenInput) SetSerialNumber(v string) *GetSessionTokenInput { - s.SerialNumber = &v - return s -} - -// SetTokenCode sets the TokenCode field's value. -func (s *GetSessionTokenInput) SetTokenCode(v string) *GetSessionTokenInput { - s.TokenCode = &v - return s -} - -// Contains the response to a successful GetSessionToken request, including -// temporary AWS credentials that can be used to make AWS requests. -type GetSessionTokenOutput struct { - _ struct{} `type:"structure"` - - // The temporary security credentials, which include an access key ID, a secret - // access key, and a security (or session) token. - // - // The size of the security token that STS API operations return is not fixed. - // We strongly recommend that you make no assumptions about the maximum size. - Credentials *Credentials `type:"structure"` -} - -// String returns the string representation -func (s GetSessionTokenOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetSessionTokenOutput) GoString() string { - return s.String() -} - -// SetCredentials sets the Credentials field's value. -func (s *GetSessionTokenOutput) SetCredentials(v *Credentials) *GetSessionTokenOutput { - s.Credentials = v - return s -} - -// A reference to the IAM managed policy that is passed as a session policy -// for a role session or a federated user session. -type PolicyDescriptorType struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the IAM managed policy to use as a session - // policy for the role. For more information about ARNs, see Amazon Resource - // Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // in the AWS General Reference. - Arn *string `locationName:"arn" min:"20" type:"string"` -} - -// String returns the string representation -func (s PolicyDescriptorType) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PolicyDescriptorType) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PolicyDescriptorType) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PolicyDescriptorType"} - if s.Arn != nil && len(*s.Arn) < 20 { - invalidParams.Add(request.NewErrParamMinLen("Arn", 20)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetArn sets the Arn field's value. -func (s *PolicyDescriptorType) SetArn(v string) *PolicyDescriptorType { - s.Arn = &v - return s -} - -// You can pass custom key-value pair attributes when you assume a role or federate -// a user. These are called session tags. You can then use the session tags -// to control access to resources. For more information, see Tagging AWS STS -// Sessions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) -// in the IAM User Guide. -type Tag struct { - _ struct{} `type:"structure"` - - // The key for a session tag. - // - // You can pass up to 50 session tags. The plain text session tag keys can’t - // exceed 128 characters. For these and additional limits, see IAM and STS Character - // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // The value for a session tag. - // - // You can pass up to 50 session tags. The plain text session tag values can’t - // exceed 256 characters. For these and additional limits, see IAM and STS Character - // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length) - // in the IAM User Guide. - // - // Value is a required field - Value *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Tag) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Tag) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Tag"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.Value == nil { - invalidParams.Add(request.NewErrParamRequired("Value")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *Tag) SetKey(v string) *Tag { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *Tag) SetValue(v string) *Tag { - s.Value = &v - return s -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go deleted file mode 100644 index d5307fcaa..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go +++ /dev/null @@ -1,11 +0,0 @@ -package sts - -import "github.com/aws/aws-sdk-go/aws/request" - -func init() { - initRequest = customizeRequest -} - -func customizeRequest(r *request.Request) { - r.RetryErrorCodes = append(r.RetryErrorCodes, ErrCodeIDPCommunicationErrorException) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go b/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go deleted file mode 100644 index fcb720dca..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package sts provides the client and types for making API -// requests to AWS Security Token Service. -// -// The AWS Security Token Service (STS) is a web service that enables you to -// request temporary, limited-privilege credentials for AWS Identity and Access -// Management (IAM) users or for users that you authenticate (federated users). -// This guide provides descriptions of the STS API. For more detailed information -// about using this service, go to Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). -// -// For information about setting up signatures and authorization through the -// API, go to Signing AWS API Requests (https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) -// in the AWS General Reference. For general information about the Query API, -// go to Making Query Requests (https://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) -// in Using IAM. For information about using security tokens with other AWS -// products, go to AWS Services That Work with IAM (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) -// in the IAM User Guide. -// -// If you're new to AWS and need additional technical information about a specific -// AWS product, you can find the product's technical documentation at http://aws.amazon.com/documentation/ -// (http://aws.amazon.com/documentation/). -// -// Endpoints -// -// By default, AWS Security Token Service (STS) is available as a global service, -// and all AWS STS requests go to a single endpoint at https://sts.amazonaws.com. -// Global requests map to the US East (N. Virginia) region. AWS recommends using -// Regional AWS STS endpoints instead of the global endpoint to reduce latency, -// build in redundancy, and increase session token validity. For more information, -// see Managing AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) -// in the IAM User Guide. -// -// Most AWS Regions are enabled for operations in all AWS services by default. -// Those Regions are automatically activated for use with AWS STS. Some Regions, -// such as Asia Pacific (Hong Kong), must be manually enabled. To learn more -// about enabling and disabling AWS Regions, see Managing AWS Regions (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html) -// in the AWS General Reference. When you enable these AWS Regions, they are -// automatically activated for use with AWS STS. You cannot activate the STS -// endpoint for a Region that is disabled. Tokens that are valid in all AWS -// Regions are longer than tokens that are valid in Regions that are enabled -// by default. Changing this setting might affect existing systems where you -// temporarily store tokens. For more information, see Managing Global Endpoint -// Session Tokens (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#sts-regions-manage-tokens) -// in the IAM User Guide. -// -// After you activate a Region for use with AWS STS, you can direct AWS STS -// API calls to that Region. AWS STS recommends that you provide both the Region -// and endpoint when you make calls to a Regional endpoint. You can provide -// the Region alone for manually enabled Regions, such as Asia Pacific (Hong -// Kong). In this case, the calls are directed to the STS Regional endpoint. -// However, if you provide the Region alone for Regions enabled by default, -// the calls are directed to the global endpoint of https://sts.amazonaws.com. -// -// To view the list of AWS STS endpoints and whether they are active by default, -// see Writing Code to Use AWS STS Regions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#id_credentials_temp_enable-regions_writing_code) -// in the IAM User Guide. -// -// Recording API requests -// -// STS supports AWS CloudTrail, which is a service that records AWS calls for -// your AWS account and delivers log files to an Amazon S3 bucket. By using -// information collected by CloudTrail, you can determine what requests were -// successfully made to STS, who made the request, when it was made, and so -// on. -// -// If you activate AWS STS endpoints in Regions other than the default global -// endpoint, then you must also turn on CloudTrail logging in those Regions. -// This is necessary to record any AWS STS API calls that are made in those -// Regions. For more information, see Turning On CloudTrail in Additional Regions -// (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/aggregating_logs_regions_turn_on_ct.html) -// in the AWS CloudTrail User Guide. -// -// AWS Security Token Service (STS) is a global service with a single endpoint -// at https://sts.amazonaws.com. Calls to this endpoint are logged as calls -// to a global service. However, because this endpoint is physically located -// in the US East (N. Virginia) Region, your logs list us-east-1 as the event -// Region. CloudTrail does not write these logs to the US East (Ohio) Region -// unless you choose to include global service logs in that Region. CloudTrail -// writes calls to all Regional endpoints to their respective Regions. For example, -// calls to sts.us-east-2.amazonaws.com are published to the US East (Ohio) -// Region and calls to sts.eu-central-1.amazonaws.com are published to the EU -// (Frankfurt) Region. -// -// To learn more about CloudTrail, including how to turn it on and find your -// log files, see the AWS CloudTrail User Guide (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html). -// -// See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service. -// -// See sts package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/ -// -// Using the Client -// -// To contact AWS Security Token Service with the SDK use the New function to create -// a new service client. With that client you can make API requests to the service. -// These clients are safe to use concurrently. -// -// See the SDK's documentation for more information on how to use the SDK. -// https://docs.aws.amazon.com/sdk-for-go/api/ -// -// See aws.Config documentation for more information on configuring SDK clients. -// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config -// -// See the AWS Security Token Service client STS for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/#New -package sts diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go b/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go deleted file mode 100644 index a233f542e..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts - -const ( - - // ErrCodeExpiredTokenException for service response error code - // "ExpiredTokenException". - // - // The web identity token that was passed is expired or is not valid. Get a - // new identity token from the identity provider and then retry the request. - ErrCodeExpiredTokenException = "ExpiredTokenException" - - // ErrCodeIDPCommunicationErrorException for service response error code - // "IDPCommunicationError". - // - // The request could not be fulfilled because the identity provider (IDP) that - // was asked to verify the incoming identity token could not be reached. This - // is often a transient error caused by network conditions. Retry the request - // a limited number of times so that you don't exceed the request rate. If the - // error persists, the identity provider might be down or not responding. - ErrCodeIDPCommunicationErrorException = "IDPCommunicationError" - - // ErrCodeIDPRejectedClaimException for service response error code - // "IDPRejectedClaim". - // - // The identity provider (IdP) reported that authentication failed. This might - // be because the claim is invalid. - // - // If this error is returned for the AssumeRoleWithWebIdentity operation, it - // can also mean that the claim has expired or has been explicitly revoked. - ErrCodeIDPRejectedClaimException = "IDPRejectedClaim" - - // ErrCodeInvalidAuthorizationMessageException for service response error code - // "InvalidAuthorizationMessageException". - // - // The error returned if the message passed to DecodeAuthorizationMessage was - // invalid. This can happen if the token contains invalid characters, such as - // linebreaks. - ErrCodeInvalidAuthorizationMessageException = "InvalidAuthorizationMessageException" - - // ErrCodeInvalidIdentityTokenException for service response error code - // "InvalidIdentityToken". - // - // The web identity token that was passed could not be validated by AWS. Get - // a new identity token from the identity provider and then retry the request. - ErrCodeInvalidIdentityTokenException = "InvalidIdentityToken" - - // ErrCodeMalformedPolicyDocumentException for service response error code - // "MalformedPolicyDocument". - // - // The request was rejected because the policy document was malformed. The error - // message describes the specific error. - ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocument" - - // ErrCodePackedPolicyTooLargeException for service response error code - // "PackedPolicyTooLarge". - // - // The request was rejected because the total packed size of the session policies - // and session tags combined was too large. An AWS conversion compresses the - // session policy document, session policy ARNs, and session tags into a packed - // binary format that has a separate limit. The error message indicates by percentage - // how close the policies and tags are to the upper size limit. For more information, - // see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) - // in the IAM User Guide. - // - // You could receive this error even though you meet other defined session policy - // and session tag limits. For more information, see IAM and STS Entity Character - // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) - // in the IAM User Guide. - ErrCodePackedPolicyTooLargeException = "PackedPolicyTooLarge" - - // ErrCodeRegionDisabledException for service response error code - // "RegionDisabledException". - // - // STS is not activated in the requested region for the account that is being - // asked to generate credentials. The account administrator must use the IAM - // console to activate STS in that region. For more information, see Activating - // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) - // in the IAM User Guide. - ErrCodeRegionDisabledException = "RegionDisabledException" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/service.go b/vendor/github.com/aws/aws-sdk-go/service/sts/service.go deleted file mode 100644 index d34a68553..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/service.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package sts - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/client/metadata" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/signer/v4" - "github.com/aws/aws-sdk-go/private/protocol/query" -) - -// STS provides the API operation methods for making requests to -// AWS Security Token Service. See this package's package overview docs -// for details on the service. -// -// STS methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type STS struct { - *client.Client -} - -// Used for custom client initialization logic -var initClient func(*client.Client) - -// Used for custom request initialization logic -var initRequest func(*request.Request) - -// Service information constants -const ( - ServiceName = "sts" // Name of service. - EndpointsID = ServiceName // ID to lookup a service endpoint with. - ServiceID = "STS" // ServiceID is a unique identifier of a specific service. -) - -// New creates a new instance of the STS client with a session. -// If additional configuration is needed for the client instance use the optional -// aws.Config parameter to add your extra config. -// -// Example: -// mySession := session.Must(session.NewSession()) -// -// // Create a STS client from just a session. -// svc := sts.New(mySession) -// -// // Create a STS client with additional configuration -// svc := sts.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *STS { - c := p.ClientConfig(EndpointsID, cfgs...) - return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *STS { - svc := &STS{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - ServiceID: ServiceID, - SigningName: signingName, - SigningRegion: signingRegion, - PartitionID: partitionID, - Endpoint: endpoint, - APIVersion: "2011-06-15", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(query.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a STS operation and runs any -// custom request initialization. -func (c *STS) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - // Run custom request initialization if present - if initRequest != nil { - initRequest(req) - } - - return req -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go deleted file mode 100644 index e2e1d6efe..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go +++ /dev/null @@ -1,96 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package stsiface provides an interface to enable mocking the AWS Security Token Service service client -// for testing your code. -// -// It is important to note that this interface will have breaking changes -// when the service model is updated and adds new API operations, paginators, -// and waiters. -package stsiface - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/sts" -) - -// STSAPI provides an interface to enable mocking the -// sts.STS service client's API operation, -// paginators, and waiters. This make unit testing your code that calls out -// to the SDK's service client's calls easier. -// -// The best way to use this interface is so the SDK's service client's calls -// can be stubbed out for unit testing your code with the SDK without needing -// to inject custom request handlers into the SDK's request pipeline. -// -// // myFunc uses an SDK service client to make a request to -// // AWS Security Token Service. -// func myFunc(svc stsiface.STSAPI) bool { -// // Make svc.AssumeRole request -// } -// -// func main() { -// sess := session.New() -// svc := sts.New(sess) -// -// myFunc(svc) -// } -// -// In your _test.go file: -// -// // Define a mock struct to be used in your unit tests of myFunc. -// type mockSTSClient struct { -// stsiface.STSAPI -// } -// func (m *mockSTSClient) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) { -// // mock response/functionality -// } -// -// func TestMyFunc(t *testing.T) { -// // Setup Test -// mockSvc := &mockSTSClient{} -// -// myfunc(mockSvc) -// -// // Verify myFunc's functionality -// } -// -// It is important to note that this interface will have breaking changes -// when the service model is updated and adds new API operations, paginators, -// and waiters. Its suggested to use the pattern above for testing, or using -// tooling to generate mocks to satisfy the interfaces. -type STSAPI interface { - AssumeRole(*sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) - AssumeRoleWithContext(aws.Context, *sts.AssumeRoleInput, ...request.Option) (*sts.AssumeRoleOutput, error) - AssumeRoleRequest(*sts.AssumeRoleInput) (*request.Request, *sts.AssumeRoleOutput) - - AssumeRoleWithSAML(*sts.AssumeRoleWithSAMLInput) (*sts.AssumeRoleWithSAMLOutput, error) - AssumeRoleWithSAMLWithContext(aws.Context, *sts.AssumeRoleWithSAMLInput, ...request.Option) (*sts.AssumeRoleWithSAMLOutput, error) - AssumeRoleWithSAMLRequest(*sts.AssumeRoleWithSAMLInput) (*request.Request, *sts.AssumeRoleWithSAMLOutput) - - AssumeRoleWithWebIdentity(*sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) - AssumeRoleWithWebIdentityWithContext(aws.Context, *sts.AssumeRoleWithWebIdentityInput, ...request.Option) (*sts.AssumeRoleWithWebIdentityOutput, error) - AssumeRoleWithWebIdentityRequest(*sts.AssumeRoleWithWebIdentityInput) (*request.Request, *sts.AssumeRoleWithWebIdentityOutput) - - DecodeAuthorizationMessage(*sts.DecodeAuthorizationMessageInput) (*sts.DecodeAuthorizationMessageOutput, error) - DecodeAuthorizationMessageWithContext(aws.Context, *sts.DecodeAuthorizationMessageInput, ...request.Option) (*sts.DecodeAuthorizationMessageOutput, error) - DecodeAuthorizationMessageRequest(*sts.DecodeAuthorizationMessageInput) (*request.Request, *sts.DecodeAuthorizationMessageOutput) - - GetAccessKeyInfo(*sts.GetAccessKeyInfoInput) (*sts.GetAccessKeyInfoOutput, error) - GetAccessKeyInfoWithContext(aws.Context, *sts.GetAccessKeyInfoInput, ...request.Option) (*sts.GetAccessKeyInfoOutput, error) - GetAccessKeyInfoRequest(*sts.GetAccessKeyInfoInput) (*request.Request, *sts.GetAccessKeyInfoOutput) - - GetCallerIdentity(*sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) - GetCallerIdentityWithContext(aws.Context, *sts.GetCallerIdentityInput, ...request.Option) (*sts.GetCallerIdentityOutput, error) - GetCallerIdentityRequest(*sts.GetCallerIdentityInput) (*request.Request, *sts.GetCallerIdentityOutput) - - GetFederationToken(*sts.GetFederationTokenInput) (*sts.GetFederationTokenOutput, error) - GetFederationTokenWithContext(aws.Context, *sts.GetFederationTokenInput, ...request.Option) (*sts.GetFederationTokenOutput, error) - GetFederationTokenRequest(*sts.GetFederationTokenInput) (*request.Request, *sts.GetFederationTokenOutput) - - GetSessionToken(*sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) - GetSessionTokenWithContext(aws.Context, *sts.GetSessionTokenInput, ...request.Option) (*sts.GetSessionTokenOutput, error) - GetSessionTokenRequest(*sts.GetSessionTokenInput) (*request.Request, *sts.GetSessionTokenOutput) -} - -var _ STSAPI = (*sts.STS)(nil) diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE deleted file mode 100644 index 339177be6..000000000 --- a/vendor/github.com/beorn7/perks/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013 Blake Mizerany - -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/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt deleted file mode 100644 index 1602287d7..000000000 --- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt +++ /dev/null @@ -1,2388 +0,0 @@ -8 -5 -26 -12 -5 -235 -13 -6 -28 -30 -3 -3 -3 -3 -5 -2 -33 -7 -2 -4 -7 -12 -14 -5 -8 -3 -10 -4 -5 -3 -6 -6 -209 -20 -3 -10 -14 -3 -4 -6 -8 -5 -11 -7 -3 -2 -3 -3 -212 -5 -222 -4 -10 -10 -5 -6 -3 -8 -3 -10 -254 -220 -2 -3 -5 -24 -5 -4 -222 -7 -3 -3 -223 -8 -15 -12 -14 -14 -3 -2 -2 -3 -13 -3 -11 -4 -4 -6 -5 -7 -13 -5 -3 -5 -2 -5 -3 -5 -2 -7 -15 -17 -14 -3 -6 -6 -3 -17 -5 -4 -7 -6 -4 -4 -8 -6 -8 -3 -9 -3 -6 -3 -4 -5 -3 -3 -660 -4 -6 -10 -3 -6 -3 -2 -5 -13 -2 -4 -4 -10 -4 -8 -4 -3 -7 -9 -9 -3 -10 -37 -3 -13 -4 -12 -3 -6 -10 -8 -5 -21 -2 -3 -8 -3 -2 -3 -3 -4 -12 -2 -4 -8 -8 -4 -3 -2 -20 -1 -6 -32 -2 -11 -6 -18 -3 -8 -11 -3 -212 -3 -4 -2 -6 -7 -12 -11 -3 -2 -16 -10 -6 -4 -6 -3 -2 -7 -3 -2 -2 -2 -2 -5 -6 -4 -3 -10 -3 -4 -6 -5 -3 -4 -4 -5 -6 -4 -3 -4 -4 -5 -7 -5 -5 -3 -2 -7 -2 -4 -12 -4 -5 -6 -2 -4 -4 -8 -4 -15 -13 -7 -16 -5 -3 -23 -5 -5 -7 -3 -2 -9 -8 -7 -5 -8 -11 -4 -10 -76 -4 -47 -4 -3 -2 -7 -4 -2 -3 -37 -10 -4 -2 -20 -5 -4 -4 -10 -10 -4 -3 -7 -23 -240 -7 -13 -5 -5 -3 -3 -2 -5 -4 -2 -8 -7 -19 -2 -23 -8 -7 -2 -5 -3 -8 -3 -8 -13 -5 -5 -5 -2 -3 -23 -4 -9 -8 -4 -3 -3 -5 -220 -2 -3 -4 -6 -14 -3 -53 -6 -2 -5 -18 -6 -3 -219 -6 -5 -2 -5 -3 -6 -5 -15 -4 -3 -17 -3 -2 -4 -7 -2 -3 -3 -4 -4 -3 -2 -664 -6 -3 -23 -5 -5 -16 -5 -8 -2 -4 -2 -24 -12 -3 -2 -3 -5 -8 -3 -5 -4 -3 -14 -3 -5 -8 -2 -3 -7 -9 -4 -2 -3 -6 -8 -4 -3 -4 -6 -5 -3 -3 -6 -3 -19 -4 -4 -6 -3 -6 -3 -5 -22 -5 -4 -4 -3 -8 -11 -4 -9 -7 -6 -13 -4 -4 -4 -6 -17 -9 -3 -3 -3 -4 -3 -221 -5 -11 -3 -4 -2 -12 -6 -3 -5 -7 -5 -7 -4 -9 -7 -14 -37 -19 -217 -16 -3 -5 -2 -2 -7 -19 -7 -6 -7 -4 -24 -5 -11 -4 -7 -7 -9 -13 -3 -4 -3 -6 -28 -4 -4 -5 -5 -2 -5 -6 -4 -4 -6 -10 -5 -4 -3 -2 -3 -3 -6 -5 -5 -4 -3 -2 -3 -7 -4 -6 -18 -16 -8 -16 -4 -5 -8 -6 -9 -13 -1545 -6 -215 -6 -5 -6 -3 -45 -31 -5 -2 -2 -4 -3 -3 -2 -5 -4 -3 -5 -7 -7 -4 -5 -8 -5 -4 -749 -2 -31 -9 -11 -2 -11 -5 -4 -4 -7 -9 -11 -4 -5 -4 -7 -3 -4 -6 -2 -15 -3 -4 -3 -4 -3 -5 -2 -13 -5 -5 -3 -3 -23 -4 -4 -5 -7 -4 -13 -2 -4 -3 -4 -2 -6 -2 -7 -3 -5 -5 -3 -29 -5 -4 -4 -3 -10 -2 -3 -79 -16 -6 -6 -7 -7 -3 -5 -5 -7 -4 -3 -7 -9 -5 -6 -5 -9 -6 -3 -6 -4 -17 -2 -10 -9 -3 -6 -2 -3 -21 -22 -5 -11 -4 -2 -17 -2 -224 -2 -14 -3 -4 -4 -2 -4 -4 -4 -4 -5 -3 -4 -4 -10 -2 -6 -3 -3 -5 -7 -2 -7 -5 -6 -3 -218 -2 -2 -5 -2 -6 -3 -5 -222 -14 -6 -33 -3 -2 -5 -3 -3 -3 -9 -5 -3 -3 -2 -7 -4 -3 -4 -3 -5 -6 -5 -26 -4 -13 -9 -7 -3 -221 -3 -3 -4 -4 -4 -4 -2 -18 -5 -3 -7 -9 -6 -8 -3 -10 -3 -11 -9 -5 -4 -17 -5 -5 -6 -6 -3 -2 -4 -12 -17 -6 -7 -218 -4 -2 -4 -10 -3 -5 -15 -3 -9 -4 -3 -3 -6 -29 -3 -3 -4 -5 -5 -3 -8 -5 -6 -6 -7 -5 -3 -5 -3 -29 -2 -31 -5 -15 -24 -16 -5 -207 -4 -3 -3 -2 -15 -4 -4 -13 -5 -5 -4 -6 -10 -2 -7 -8 -4 -6 -20 -5 -3 -4 -3 -12 -12 -5 -17 -7 -3 -3 -3 -6 -10 -3 -5 -25 -80 -4 -9 -3 -2 -11 -3 -3 -2 -3 -8 -7 -5 -5 -19 -5 -3 -3 -12 -11 -2 -6 -5 -5 -5 -3 -3 -3 -4 -209 -14 -3 -2 -5 -19 -4 -4 -3 -4 -14 -5 -6 -4 -13 -9 -7 -4 -7 -10 -2 -9 -5 -7 -2 -8 -4 -6 -5 -5 -222 -8 -7 -12 -5 -216 -3 -4 -4 -6 -3 -14 -8 -7 -13 -4 -3 -3 -3 -3 -17 -5 -4 -3 -33 -6 -6 -33 -7 -5 -3 -8 -7 -5 -2 -9 -4 -2 -233 -24 -7 -4 -8 -10 -3 -4 -15 -2 -16 -3 -3 -13 -12 -7 -5 -4 -207 -4 -2 -4 -27 -15 -2 -5 -2 -25 -6 -5 -5 -6 -13 -6 -18 -6 -4 -12 -225 -10 -7 -5 -2 -2 -11 -4 -14 -21 -8 -10 -3 -5 -4 -232 -2 -5 -5 -3 -7 -17 -11 -6 -6 -23 -4 -6 -3 -5 -4 -2 -17 -3 -6 -5 -8 -3 -2 -2 -14 -9 -4 -4 -2 -5 -5 -3 -7 -6 -12 -6 -10 -3 -6 -2 -2 -19 -5 -4 -4 -9 -2 -4 -13 -3 -5 -6 -3 -6 -5 -4 -9 -6 -3 -5 -7 -3 -6 -6 -4 -3 -10 -6 -3 -221 -3 -5 -3 -6 -4 -8 -5 -3 -6 -4 -4 -2 -54 -5 -6 -11 -3 -3 -4 -4 -4 -3 -7 -3 -11 -11 -7 -10 -6 -13 -223 -213 -15 -231 -7 -3 -7 -228 -2 -3 -4 -4 -5 -6 -7 -4 -13 -3 -4 -5 -3 -6 -4 -6 -7 -2 -4 -3 -4 -3 -3 -6 -3 -7 -3 -5 -18 -5 -6 -8 -10 -3 -3 -3 -2 -4 -2 -4 -4 -5 -6 -6 -4 -10 -13 -3 -12 -5 -12 -16 -8 -4 -19 -11 -2 -4 -5 -6 -8 -5 -6 -4 -18 -10 -4 -2 -216 -6 -6 -6 -2 -4 -12 -8 -3 -11 -5 -6 -14 -5 -3 -13 -4 -5 -4 -5 -3 -28 -6 -3 -7 -219 -3 -9 -7 -3 -10 -6 -3 -4 -19 -5 -7 -11 -6 -15 -19 -4 -13 -11 -3 -7 -5 -10 -2 -8 -11 -2 -6 -4 -6 -24 -6 -3 -3 -3 -3 -6 -18 -4 -11 -4 -2 -5 -10 -8 -3 -9 -5 -3 -4 -5 -6 -2 -5 -7 -4 -4 -14 -6 -4 -4 -5 -5 -7 -2 -4 -3 -7 -3 -3 -6 -4 -5 -4 -4 -4 -3 -3 -3 -3 -8 -14 -2 -3 -5 -3 -2 -4 -5 -3 -7 -3 -3 -18 -3 -4 -4 -5 -7 -3 -3 -3 -13 -5 -4 -8 -211 -5 -5 -3 -5 -2 -5 -4 -2 -655 -6 -3 -5 -11 -2 -5 -3 -12 -9 -15 -11 -5 -12 -217 -2 -6 -17 -3 -3 -207 -5 -5 -4 -5 -9 -3 -2 -8 -5 -4 -3 -2 -5 -12 -4 -14 -5 -4 -2 -13 -5 -8 -4 -225 -4 -3 -4 -5 -4 -3 -3 -6 -23 -9 -2 -6 -7 -233 -4 -4 -6 -18 -3 -4 -6 -3 -4 -4 -2 -3 -7 -4 -13 -227 -4 -3 -5 -4 -2 -12 -9 -17 -3 -7 -14 -6 -4 -5 -21 -4 -8 -9 -2 -9 -25 -16 -3 -6 -4 -7 -8 -5 -2 -3 -5 -4 -3 -3 -5 -3 -3 -3 -2 -3 -19 -2 -4 -3 -4 -2 -3 -4 -4 -2 -4 -3 -3 -3 -2 -6 -3 -17 -5 -6 -4 -3 -13 -5 -3 -3 -3 -4 -9 -4 -2 -14 -12 -4 -5 -24 -4 -3 -37 -12 -11 -21 -3 -4 -3 -13 -4 -2 -3 -15 -4 -11 -4 -4 -3 -8 -3 -4 -4 -12 -8 -5 -3 -3 -4 -2 -220 -3 -5 -223 -3 -3 -3 -10 -3 -15 -4 -241 -9 -7 -3 -6 -6 -23 -4 -13 -7 -3 -4 -7 -4 -9 -3 -3 -4 -10 -5 -5 -1 -5 -24 -2 -4 -5 -5 -6 -14 -3 -8 -2 -3 -5 -13 -13 -3 -5 -2 -3 -15 -3 -4 -2 -10 -4 -4 -4 -5 -5 -3 -5 -3 -4 -7 -4 -27 -3 -6 -4 -15 -3 -5 -6 -6 -5 -4 -8 -3 -9 -2 -6 -3 -4 -3 -7 -4 -18 -3 -11 -3 -3 -8 -9 -7 -24 -3 -219 -7 -10 -4 -5 -9 -12 -2 -5 -4 -4 -4 -3 -3 -19 -5 -8 -16 -8 -6 -22 -3 -23 -3 -242 -9 -4 -3 -3 -5 -7 -3 -3 -5 -8 -3 -7 -5 -14 -8 -10 -3 -4 -3 -7 -4 -6 -7 -4 -10 -4 -3 -11 -3 -7 -10 -3 -13 -6 -8 -12 -10 -5 -7 -9 -3 -4 -7 -7 -10 -8 -30 -9 -19 -4 -3 -19 -15 -4 -13 -3 -215 -223 -4 -7 -4 -8 -17 -16 -3 -7 -6 -5 -5 -4 -12 -3 -7 -4 -4 -13 -4 -5 -2 -5 -6 -5 -6 -6 -7 -10 -18 -23 -9 -3 -3 -6 -5 -2 -4 -2 -7 -3 -3 -2 -5 -5 -14 -10 -224 -6 -3 -4 -3 -7 -5 -9 -3 -6 -4 -2 -5 -11 -4 -3 -3 -2 -8 -4 -7 -4 -10 -7 -3 -3 -18 -18 -17 -3 -3 -3 -4 -5 -3 -3 -4 -12 -7 -3 -11 -13 -5 -4 -7 -13 -5 -4 -11 -3 -12 -3 -6 -4 -4 -21 -4 -6 -9 -5 -3 -10 -8 -4 -6 -4 -4 -6 -5 -4 -8 -6 -4 -6 -4 -4 -5 -9 -6 -3 -4 -2 -9 -3 -18 -2 -4 -3 -13 -3 -6 -6 -8 -7 -9 -3 -2 -16 -3 -4 -6 -3 -2 -33 -22 -14 -4 -9 -12 -4 -5 -6 -3 -23 -9 -4 -3 -5 -5 -3 -4 -5 -3 -5 -3 -10 -4 -5 -5 -8 -4 -4 -6 -8 -5 -4 -3 -4 -6 -3 -3 -3 -5 -9 -12 -6 -5 -9 -3 -5 -3 -2 -2 -2 -18 -3 -2 -21 -2 -5 -4 -6 -4 -5 -10 -3 -9 -3 -2 -10 -7 -3 -6 -6 -4 -4 -8 -12 -7 -3 -7 -3 -3 -9 -3 -4 -5 -4 -4 -5 -5 -10 -15 -4 -4 -14 -6 -227 -3 -14 -5 -216 -22 -5 -4 -2 -2 -6 -3 -4 -2 -9 -9 -4 -3 -28 -13 -11 -4 -5 -3 -3 -2 -3 -3 -5 -3 -4 -3 -5 -23 -26 -3 -4 -5 -6 -4 -6 -3 -5 -5 -3 -4 -3 -2 -2 -2 -7 -14 -3 -6 -7 -17 -2 -2 -15 -14 -16 -4 -6 -7 -13 -6 -4 -5 -6 -16 -3 -3 -28 -3 -6 -15 -3 -9 -2 -4 -6 -3 -3 -22 -4 -12 -6 -7 -2 -5 -4 -10 -3 -16 -6 -9 -2 -5 -12 -7 -5 -5 -5 -5 -2 -11 -9 -17 -4 -3 -11 -7 -3 -5 -15 -4 -3 -4 -211 -8 -7 -5 -4 -7 -6 -7 -6 -3 -6 -5 -6 -5 -3 -4 -4 -26 -4 -6 -10 -4 -4 -3 -2 -3 -3 -4 -5 -9 -3 -9 -4 -4 -5 -5 -8 -2 -4 -2 -3 -8 -4 -11 -19 -5 -8 -6 -3 -5 -6 -12 -3 -2 -4 -16 -12 -3 -4 -4 -8 -6 -5 -6 -6 -219 -8 -222 -6 -16 -3 -13 -19 -5 -4 -3 -11 -6 -10 -4 -7 -7 -12 -5 -3 -3 -5 -6 -10 -3 -8 -2 -5 -4 -7 -2 -4 -4 -2 -12 -9 -6 -4 -2 -40 -2 -4 -10 -4 -223 -4 -2 -20 -6 -7 -24 -5 -4 -5 -2 -20 -16 -6 -5 -13 -2 -3 -3 -19 -3 -2 -4 -5 -6 -7 -11 -12 -5 -6 -7 -7 -3 -5 -3 -5 -3 -14 -3 -4 -4 -2 -11 -1 -7 -3 -9 -6 -11 -12 -5 -8 -6 -221 -4 -2 -12 -4 -3 -15 -4 -5 -226 -7 -218 -7 -5 -4 -5 -18 -4 -5 -9 -4 -4 -2 -9 -18 -18 -9 -5 -6 -6 -3 -3 -7 -3 -5 -4 -4 -4 -12 -3 -6 -31 -5 -4 -7 -3 -6 -5 -6 -5 -11 -2 -2 -11 -11 -6 -7 -5 -8 -7 -10 -5 -23 -7 -4 -3 -5 -34 -2 -5 -23 -7 -3 -6 -8 -4 -4 -4 -2 -5 -3 -8 -5 -4 -8 -25 -2 -3 -17 -8 -3 -4 -8 -7 -3 -15 -6 -5 -7 -21 -9 -5 -6 -6 -5 -3 -2 -3 -10 -3 -6 -3 -14 -7 -4 -4 -8 -7 -8 -2 -6 -12 -4 -213 -6 -5 -21 -8 -2 -5 -23 -3 -11 -2 -3 -6 -25 -2 -3 -6 -7 -6 -6 -4 -4 -6 -3 -17 -9 -7 -6 -4 -3 -10 -7 -2 -3 -3 -3 -11 -8 -3 -7 -6 -4 -14 -36 -3 -4 -3 -3 -22 -13 -21 -4 -2 -7 -4 -4 -17 -15 -3 -7 -11 -2 -4 -7 -6 -209 -6 -3 -2 -2 -24 -4 -9 -4 -3 -3 -3 -29 -2 -2 -4 -3 -3 -5 -4 -6 -3 -3 -2 -4 diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go deleted file mode 100644 index d7d14f8eb..000000000 --- a/vendor/github.com/beorn7/perks/quantile/stream.go +++ /dev/null @@ -1,316 +0,0 @@ -// Package quantile computes approximate quantiles over an unbounded data -// stream within low memory and CPU bounds. -// -// A small amount of accuracy is traded to achieve the above properties. -// -// Multiple streams can be merged before calling Query to generate a single set -// of results. This is meaningful when the streams represent the same type of -// data. See Merge and Samples. -// -// For more detailed information about the algorithm used, see: -// -// Effective Computation of Biased Quantiles over Data Streams -// -// http://www.cs.rutgers.edu/~muthu/bquant.pdf -package quantile - -import ( - "math" - "sort" -) - -// Sample holds an observed value and meta information for compression. JSON -// tags have been added for convenience. -type Sample struct { - Value float64 `json:",string"` - Width float64 `json:",string"` - Delta float64 `json:",string"` -} - -// Samples represents a slice of samples. It implements sort.Interface. -type Samples []Sample - -func (a Samples) Len() int { return len(a) } -func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value } -func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] } - -type invariant func(s *stream, r float64) float64 - -// NewLowBiased returns an initialized Stream for low-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the lower ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within (1±Epsilon)*Quantile. -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewLowBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * r - } - return newStream(ƒ) -} - -// NewHighBiased returns an initialized Stream for high-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the higher ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewHighBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * (s.n - r) - } - return newStream(ƒ) -} - -// NewTargeted returns an initialized Stream concerned with a particular set of -// quantile values that are supplied a priori. Knowing these a priori reduces -// space and computation time. The targets map maps the desired quantiles to -// their absolute errors, i.e. the true quantile of a value returned by a query -// is guaranteed to be within (Quantile±Epsilon). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. -func NewTargeted(targetMap map[float64]float64) *Stream { - // Convert map to slice to avoid slow iterations on a map. - // ƒ is called on the hot path, so converting the map to a slice - // beforehand results in significant CPU savings. - targets := targetMapToSlice(targetMap) - - ƒ := func(s *stream, r float64) float64 { - var m = math.MaxFloat64 - var f float64 - for _, t := range targets { - if t.quantile*s.n <= r { - f = (2 * t.epsilon * r) / t.quantile - } else { - f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile) - } - if f < m { - m = f - } - } - return m - } - return newStream(ƒ) -} - -type target struct { - quantile float64 - epsilon float64 -} - -func targetMapToSlice(targetMap map[float64]float64) []target { - targets := make([]target, 0, len(targetMap)) - - for quantile, epsilon := range targetMap { - t := target{ - quantile: quantile, - epsilon: epsilon, - } - targets = append(targets, t) - } - - return targets -} - -// Stream computes quantiles for a stream of float64s. It is not thread-safe by -// design. Take care when using across multiple goroutines. -type Stream struct { - *stream - b Samples - sorted bool -} - -func newStream(ƒ invariant) *Stream { - x := &stream{ƒ: ƒ} - return &Stream{x, make(Samples, 0, 500), true} -} - -// Insert inserts v into the stream. -func (s *Stream) Insert(v float64) { - s.insert(Sample{Value: v, Width: 1}) -} - -func (s *Stream) insert(sample Sample) { - s.b = append(s.b, sample) - s.sorted = false - if len(s.b) == cap(s.b) { - s.flush() - } -} - -// Query returns the computed qth percentiles value. If s was created with -// NewTargeted, and q is not in the set of quantiles provided a priori, Query -// will return an unspecified result. -func (s *Stream) Query(q float64) float64 { - if !s.flushed() { - // Fast path when there hasn't been enough data for a flush; - // this also yields better accuracy for small sets of data. - l := len(s.b) - if l == 0 { - return 0 - } - i := int(math.Ceil(float64(l) * q)) - if i > 0 { - i -= 1 - } - s.maybeSort() - return s.b[i].Value - } - s.flush() - return s.stream.query(q) -} - -// Merge merges samples into the underlying streams samples. This is handy when -// merging multiple streams from separate threads, database shards, etc. -// -// ATTENTION: This method is broken and does not yield correct results. The -// underlying algorithm is not capable of merging streams correctly. -func (s *Stream) Merge(samples Samples) { - sort.Sort(samples) - s.stream.merge(samples) -} - -// Reset reinitializes and clears the list reusing the samples buffer memory. -func (s *Stream) Reset() { - s.stream.reset() - s.b = s.b[:0] -} - -// Samples returns stream samples held by s. -func (s *Stream) Samples() Samples { - if !s.flushed() { - return s.b - } - s.flush() - return s.stream.samples() -} - -// Count returns the total number of samples observed in the stream -// since initialization. -func (s *Stream) Count() int { - return len(s.b) + s.stream.count() -} - -func (s *Stream) flush() { - s.maybeSort() - s.stream.merge(s.b) - s.b = s.b[:0] -} - -func (s *Stream) maybeSort() { - if !s.sorted { - s.sorted = true - sort.Sort(s.b) - } -} - -func (s *Stream) flushed() bool { - return len(s.stream.l) > 0 -} - -type stream struct { - n float64 - l []Sample - ƒ invariant -} - -func (s *stream) reset() { - s.l = s.l[:0] - s.n = 0 -} - -func (s *stream) insert(v float64) { - s.merge(Samples{{v, 1, 0}}) -} - -func (s *stream) merge(samples Samples) { - // TODO(beorn7): This tries to merge not only individual samples, but - // whole summaries. The paper doesn't mention merging summaries at - // all. Unittests show that the merging is inaccurate. Find out how to - // do merges properly. - var r float64 - i := 0 - for _, sample := range samples { - for ; i < len(s.l); i++ { - c := s.l[i] - if c.Value > sample.Value { - // Insert at position i. - s.l = append(s.l, Sample{}) - copy(s.l[i+1:], s.l[i:]) - s.l[i] = Sample{ - sample.Value, - sample.Width, - math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1), - // TODO(beorn7): How to calculate delta correctly? - } - i++ - goto inserted - } - r += c.Width - } - s.l = append(s.l, Sample{sample.Value, sample.Width, 0}) - i++ - inserted: - s.n += sample.Width - r += sample.Width - } - s.compress() -} - -func (s *stream) count() int { - return int(s.n) -} - -func (s *stream) query(q float64) float64 { - t := math.Ceil(q * s.n) - t += math.Ceil(s.ƒ(s, t) / 2) - p := s.l[0] - var r float64 - for _, c := range s.l[1:] { - r += p.Width - if r+c.Width+c.Delta > t { - return p.Value - } - p = c - } - return p.Value -} - -func (s *stream) compress() { - if len(s.l) < 2 { - return - } - x := s.l[len(s.l)-1] - xi := len(s.l) - 1 - r := s.n - 1 - x.Width - - for i := len(s.l) - 2; i >= 0; i-- { - c := s.l[i] - if c.Width+x.Width+x.Delta <= s.ƒ(s, r) { - x.Width += c.Width - s.l[xi] = x - // Remove element at i. - copy(s.l[i:], s.l[i+1:]) - s.l = s.l[:len(s.l)-1] - xi -= 1 - } else { - x = c - xi = i - } - r -= c.Width - } -} - -func (s *stream) samples() Samples { - samples := make(Samples, len(s.l)) - copy(samples, s.l) - return samples -} diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/errstr.go b/vendor/github.com/billziss-gh/cgofuse/fuse/errstr.go deleted file mode 100644 index ee1705858..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/errstr.go +++ /dev/null @@ -1,98 +0,0 @@ -/* - * errstr.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -package fuse - -var errorStrings = []struct { - errc int - errs string -}{ - {E2BIG, "E2BIG"}, - {EACCES, "EACCES"}, - {EADDRINUSE, "EADDRINUSE"}, - {EADDRNOTAVAIL, "EADDRNOTAVAIL"}, - {EAFNOSUPPORT, "EAFNOSUPPORT"}, - {EAGAIN, "EAGAIN"}, - {EALREADY, "EALREADY"}, - {EBADF, "EBADF"}, - {EBADMSG, "EBADMSG"}, - {EBUSY, "EBUSY"}, - {ECANCELED, "ECANCELED"}, - {ECHILD, "ECHILD"}, - {ECONNABORTED, "ECONNABORTED"}, - {ECONNREFUSED, "ECONNREFUSED"}, - {ECONNRESET, "ECONNRESET"}, - {EDEADLK, "EDEADLK"}, - {EDESTADDRREQ, "EDESTADDRREQ"}, - {EDOM, "EDOM"}, - {EEXIST, "EEXIST"}, - {EFAULT, "EFAULT"}, - {EFBIG, "EFBIG"}, - {EHOSTUNREACH, "EHOSTUNREACH"}, - {EIDRM, "EIDRM"}, - {EILSEQ, "EILSEQ"}, - {EINPROGRESS, "EINPROGRESS"}, - {EINTR, "EINTR"}, - {EINVAL, "EINVAL"}, - {EIO, "EIO"}, - {EISCONN, "EISCONN"}, - {EISDIR, "EISDIR"}, - {ELOOP, "ELOOP"}, - {EMFILE, "EMFILE"}, - {EMLINK, "EMLINK"}, - {EMSGSIZE, "EMSGSIZE"}, - {ENAMETOOLONG, "ENAMETOOLONG"}, - {ENETDOWN, "ENETDOWN"}, - {ENETRESET, "ENETRESET"}, - {ENETUNREACH, "ENETUNREACH"}, - {ENFILE, "ENFILE"}, - {ENOATTR, "ENOATTR"}, - {ENOBUFS, "ENOBUFS"}, - {ENODATA, "ENODATA"}, - {ENODEV, "ENODEV"}, - {ENOENT, "ENOENT"}, - {ENOEXEC, "ENOEXEC"}, - {ENOLCK, "ENOLCK"}, - {ENOLINK, "ENOLINK"}, - {ENOMEM, "ENOMEM"}, - {ENOMSG, "ENOMSG"}, - {ENOPROTOOPT, "ENOPROTOOPT"}, - {ENOSPC, "ENOSPC"}, - {ENOSR, "ENOSR"}, - {ENOSTR, "ENOSTR"}, - {ENOSYS, "ENOSYS"}, - {ENOTCONN, "ENOTCONN"}, - {ENOTDIR, "ENOTDIR"}, - {ENOTEMPTY, "ENOTEMPTY"}, - {ENOTRECOVERABLE, "ENOTRECOVERABLE"}, - {ENOTSOCK, "ENOTSOCK"}, - {ENOTSUP, "ENOTSUP"}, - {ENOTTY, "ENOTTY"}, - {ENXIO, "ENXIO"}, - {EOPNOTSUPP, "EOPNOTSUPP"}, - {EOVERFLOW, "EOVERFLOW"}, - {EOWNERDEAD, "EOWNERDEAD"}, - {EPERM, "EPERM"}, - {EPIPE, "EPIPE"}, - {EPROTO, "EPROTO"}, - {EPROTONOSUPPORT, "EPROTONOSUPPORT"}, - {EPROTOTYPE, "EPROTOTYPE"}, - {ERANGE, "ERANGE"}, - {EROFS, "EROFS"}, - {ESPIPE, "ESPIPE"}, - {ESRCH, "ESRCH"}, - {ETIME, "ETIME"}, - {ETIMEDOUT, "ETIMEDOUT"}, - {ETXTBSY, "ETXTBSY"}, - {EWOULDBLOCK, "EWOULDBLOCK"}, - {EXDEV, "EXDEV"}, -} diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/fsop.go b/vendor/github.com/billziss-gh/cgofuse/fuse/fsop.go deleted file mode 100644 index 3a1df2ebc..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/fsop.go +++ /dev/null @@ -1,589 +0,0 @@ -/* - * fsop.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -// Package fuse allows the creation of user mode file systems in Go. -// -// A user mode file system is a user mode process that receives file system operations -// from the OS FUSE layer and satisfies them in user mode. A user mode file system -// implements the interface FileSystemInterface either directly or by embedding a -// FileSystemBase struct which provides a default (empty) implementation of all methods -// in FileSystemInterface. -// -// In order to expose the user mode file system to the OS, the file system must be hosted -// (mounted) by a FileSystemHost. The FileSystemHost Mount() method is used for this -// purpose. -// -// A note on thread-safety: In general FUSE file systems are expected to protect their -// own data structures. Many FUSE implementations provide a -s command line option that -// when used, it instructs the FUSE implementation to serialize requests. This option -// can be passed to the FileSystemHost Mount() method, when the file system is mounted. -package fuse - -import ( - "strconv" - "sync" - "time" -) - -// Timespec contains a time as the UNIX time in seconds and nanoseconds. -// This structure is analogous to the POSIX struct timespec. -type Timespec struct { - Sec int64 - Nsec int64 -} - -// NewTimespec creates a Timespec from a time.Time. -func NewTimespec(t time.Time) Timespec { - return Timespec{t.Unix(), int64(t.Nanosecond())} -} - -// Now creates a Timespec that contains the current time. -func Now() Timespec { - return NewTimespec(time.Now()) -} - -// Time returns the Timespec as a time.Time. -func (ts *Timespec) Time() time.Time { - return time.Unix(ts.Sec, ts.Nsec) -} - -// Statfs_t contains file system information. -// This structure is analogous to the POSIX struct statvfs (NOT struct statfs). -// Not all fields are honored by all FUSE implementations. -type Statfs_t struct { - // File system block size. - Bsize uint64 - - // Fundamental file system block size. - Frsize uint64 - - // Total number of blocks on file system in units of Frsize. - Blocks uint64 - - // Total number of free blocks. - Bfree uint64 - - // Number of free blocks available to non-privileged process. - Bavail uint64 - - // Total number of file serial numbers. - Files uint64 - - // Total number of free file serial numbers. - Ffree uint64 - - // Number of file serial numbers available to non-privileged process. - Favail uint64 - - // File system ID. [IGNORED] - Fsid uint64 - - // Bit mask of Flag values. [IGNORED] - Flag uint64 - - // Maximum filename length. - Namemax uint64 -} - -// Stat_t contains file metadata information. -// This structure is analogous to the POSIX struct stat. -// Not all fields are honored by all FUSE implementations. -type Stat_t struct { - // Device ID of device containing file. [IGNORED] - Dev uint64 - - // File serial number. [IGNORED unless the use_ino mount option is given.] - Ino uint64 - - // Mode of file. - Mode uint32 - - // Number of hard links to the file. - Nlink uint32 - - // User ID of file. - Uid uint32 - - // Group ID of file. - Gid uint32 - - // Device ID (if file is character or block special). - Rdev uint64 - - // For regular files, the file size in bytes. - // For symbolic links, the length in bytes of the - // pathname contained in the symbolic link. - Size int64 - - // Last data access timestamp. - Atim Timespec - - // Last data modification timestamp. - Mtim Timespec - - // Last file status change timestamp. - Ctim Timespec - - // A file system-specific preferred I/O block size for this object. - Blksize int64 - - // Number of blocks allocated for this object. - Blocks int64 - - // File creation (birth) timestamp. [OSX and Windows only] - Birthtim Timespec - - // BSD flags (UF_*). [OSX and Windows only] - Flags uint32 -} - -// FileInfo_t contains open file information. -// This structure is analogous to the FUSE struct fuse_file_info. -type FileInfo_t struct { - // Open flags: a combination of the fuse.O_* constants. - Flags int - - // Use direct I/O on this file. [IGNORED on Windows] - DirectIo bool - - // Do not invalidate file cache. [IGNORED on Windows] - KeepCache bool - - // File is not seekable. [IGNORED on Windows] - NonSeekable bool - - // File handle. - Fh uint64 -} - -/* -// Lock_t contains file locking information. -// This structure is analogous to the POSIX struct flock. -type Lock_t struct { - // Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. - Type int16 - - // Flag for starting offset. - Whence int16 - - // Relative offset in bytes. - Start int64 - - // Size; if 0 then until EOF. - Len int64 - - // Process ID of the process holding the lock - Pid int -} -*/ - -// FileSystemInterface is the interface that a user mode file system must implement. -// -// The file system will receive an Init() call when the file system is created; -// the Init() call will happen prior to receiving any other file system calls. -// Note that there are no guarantees on the exact timing of when Init() is called. -// For example, it cannot be assumed that the file system is mounted at the time -// the Init() call is received. -// -// The file system will receive a Destroy() call when the file system is destroyed; -// the Destroy() call will always be the last call to be received by the file system. -// Note that depending on how the file system is terminated the file system may not -// receive the Destroy() call. For example, it will not receive the Destroy() call -// if the file system process is forcibly killed. -// -// Except for Init() and Destroy() all file system operations must return 0 on success -// or a FUSE error on failure. To return an error return the NEGATIVE value of a -// particular error. For example, to report "file not found" return -fuse.ENOENT. -type FileSystemInterface interface { - // Init is called when the file system is created. - Init() - - // Destroy is called when the file system is destroyed. - Destroy() - - // Statfs gets file system statistics. - Statfs(path string, stat *Statfs_t) int - - // Mknod creates a file node. - Mknod(path string, mode uint32, dev uint64) int - - // Mkdir creates a directory. - Mkdir(path string, mode uint32) int - - // Unlink removes a file. - Unlink(path string) int - - // Rmdir removes a directory. - Rmdir(path string) int - - // Link creates a hard link to a file. - Link(oldpath string, newpath string) int - - // Symlink creates a symbolic link. - Symlink(target string, newpath string) int - - // Readlink reads the target of a symbolic link. - Readlink(path string) (int, string) - - // Rename renames a file. - Rename(oldpath string, newpath string) int - - // Chmod changes the permission bits of a file. - Chmod(path string, mode uint32) int - - // Chown changes the owner and group of a file. - Chown(path string, uid uint32, gid uint32) int - - // Utimens changes the access and modification times of a file. - Utimens(path string, tmsp []Timespec) int - - // Access checks file access permissions. - Access(path string, mask uint32) int - - // Create creates and opens a file. - // The flags are a combination of the fuse.O_* constants. - Create(path string, flags int, mode uint32) (int, uint64) - - // Open opens a file. - // The flags are a combination of the fuse.O_* constants. - Open(path string, flags int) (int, uint64) - - // Getattr gets file attributes. - Getattr(path string, stat *Stat_t, fh uint64) int - - // Truncate changes the size of a file. - Truncate(path string, size int64, fh uint64) int - - // Read reads data from a file. - Read(path string, buff []byte, ofst int64, fh uint64) int - - // Write writes data to a file. - Write(path string, buff []byte, ofst int64, fh uint64) int - - // Flush flushes cached file data. - Flush(path string, fh uint64) int - - // Release closes an open file. - Release(path string, fh uint64) int - - // Fsync synchronizes file contents. - Fsync(path string, datasync bool, fh uint64) int - - // Lock performs a file locking operation. - //Lock(path string, cmd int, lock *Lock_t, fh uint64) int - - // Opendir opens a directory. - Opendir(path string) (int, uint64) - - // Readdir reads a directory. - Readdir(path string, - fill func(name string, stat *Stat_t, ofst int64) bool, - ofst int64, - fh uint64) int - - // Releasedir closes an open directory. - Releasedir(path string, fh uint64) int - - // Fsyncdir synchronizes directory contents. - Fsyncdir(path string, datasync bool, fh uint64) int - - // Setxattr sets extended attributes. - Setxattr(path string, name string, value []byte, flags int) int - - // Getxattr gets extended attributes. - Getxattr(path string, name string) (int, []byte) - - // Removexattr removes extended attributes. - Removexattr(path string, name string) int - - // Listxattr lists extended attributes. - Listxattr(path string, fill func(name string) bool) int -} - -// FileSystemOpenEx is the interface that wraps the OpenEx and CreateEx methods. -// -// OpenEx and CreateEx are similar to Open and Create except that they allow -// direct manipulation of the FileInfo_t struct (which is analogous to the -// FUSE struct fuse_file_info). -type FileSystemOpenEx interface { - CreateEx(path string, mode uint32, fi *FileInfo_t) int - OpenEx(path string, fi *FileInfo_t) int -} - -// FileSystemChflags is the interface that wraps the Chflags method. -// -// Chflags changes the BSD file flags (Windows file attributes). [OSX and Windows only] -type FileSystemChflags interface { - Chflags(path string, flags uint32) int -} - -// FileSystemSetcrtime is the interface that wraps the Setcrtime method. -// -// Setcrtime changes the file creation (birth) time. [OSX and Windows only] -type FileSystemSetcrtime interface { - Setcrtime(path string, tmsp Timespec) int -} - -// FileSystemSetchgtime is the interface that wraps the Setchgtime method. -// -// Setchgtime changes the file change (ctime) time. [OSX and Windows only] -type FileSystemSetchgtime interface { - Setchgtime(path string, tmsp Timespec) int -} - -// Error encapsulates a FUSE error code. In some rare circumstances it is useful -// to signal an error to the FUSE layer by boxing the error code using Error and -// calling panic(). The FUSE layer will recover and report the boxed error code -// to the OS. -type Error int - -var errorStringMap map[Error]string -var errorStringOnce sync.Once - -func (self Error) Error() string { - errorStringOnce.Do(func() { - errorStringMap = make(map[Error]string) - for _, i := range errorStrings { - errorStringMap[Error(-i.errc)] = i.errs - } - }) - - if 0 <= self { - return strconv.Itoa(int(self)) - } else { - if errs, ok := errorStringMap[self]; ok { - return "-fuse." + errs - } - return "fuse.Error(" + strconv.Itoa(int(self)) + ")" - } -} - -func (self Error) String() string { - return self.Error() -} - -func (self Error) GoString() string { - return self.Error() -} - -var _ error = (*Error)(nil) - -// FileSystemBase provides default implementations of the methods in FileSystemInterface. -// The default implementations are either empty or return -ENOSYS to signal that the -// file system does not implement a particular operation to the FUSE layer. -type FileSystemBase struct { -} - -// Init is called when the file system is created. -// The FileSystemBase implementation does nothing. -func (*FileSystemBase) Init() { -} - -// Destroy is called when the file system is destroyed. -// The FileSystemBase implementation does nothing. -func (*FileSystemBase) Destroy() { -} - -// Statfs gets file system statistics. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Statfs(path string, stat *Statfs_t) int { - return -ENOSYS -} - -// Mknod creates a file node. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Mknod(path string, mode uint32, dev uint64) int { - return -ENOSYS -} - -// Mkdir creates a directory. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Mkdir(path string, mode uint32) int { - return -ENOSYS -} - -// Unlink removes a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Unlink(path string) int { - return -ENOSYS -} - -// Rmdir removes a directory. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Rmdir(path string) int { - return -ENOSYS -} - -// Link creates a hard link to a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Link(oldpath string, newpath string) int { - return -ENOSYS -} - -// Symlink creates a symbolic link. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Symlink(target string, newpath string) int { - return -ENOSYS -} - -// Readlink reads the target of a symbolic link. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Readlink(path string) (int, string) { - return -ENOSYS, "" -} - -// Rename renames a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Rename(oldpath string, newpath string) int { - return -ENOSYS -} - -// Chmod changes the permission bits of a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Chmod(path string, mode uint32) int { - return -ENOSYS -} - -// Chown changes the owner and group of a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Chown(path string, uid uint32, gid uint32) int { - return -ENOSYS -} - -// Utimens changes the access and modification times of a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Utimens(path string, tmsp []Timespec) int { - return -ENOSYS -} - -// Access checks file access permissions. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Access(path string, mask uint32) int { - return -ENOSYS -} - -// Create creates and opens a file. -// The flags are a combination of the fuse.O_* constants. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Create(path string, flags int, mode uint32) (int, uint64) { - return -ENOSYS, ^uint64(0) -} - -// Open opens a file. -// The flags are a combination of the fuse.O_* constants. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Open(path string, flags int) (int, uint64) { - return -ENOSYS, ^uint64(0) -} - -// Getattr gets file attributes. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Getattr(path string, stat *Stat_t, fh uint64) int { - return -ENOSYS -} - -// Truncate changes the size of a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Truncate(path string, size int64, fh uint64) int { - return -ENOSYS -} - -// Read reads data from a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Read(path string, buff []byte, ofst int64, fh uint64) int { - return -ENOSYS -} - -// Write writes data to a file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Write(path string, buff []byte, ofst int64, fh uint64) int { - return -ENOSYS -} - -// Flush flushes cached file data. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Flush(path string, fh uint64) int { - return -ENOSYS -} - -// Release closes an open file. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Release(path string, fh uint64) int { - return -ENOSYS -} - -// Fsync synchronizes file contents. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Fsync(path string, datasync bool, fh uint64) int { - return -ENOSYS -} - -/* -// Lock performs a file locking operation. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Lock(path string, cmd int, lock *Lock_t, fh uint64) int { - return -ENOSYS -} -*/ - -// Opendir opens a directory. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Opendir(path string) (int, uint64) { - return -ENOSYS, ^uint64(0) -} - -// Readdir reads a directory. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Readdir(path string, - fill func(name string, stat *Stat_t, ofst int64) bool, - ofst int64, - fh uint64) int { - return -ENOSYS -} - -// Releasedir closes an open directory. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Releasedir(path string, fh uint64) int { - return -ENOSYS -} - -// Fsyncdir synchronizes directory contents. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Fsyncdir(path string, datasync bool, fh uint64) int { - return -ENOSYS -} - -// Setxattr sets extended attributes. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Setxattr(path string, name string, value []byte, flags int) int { - return -ENOSYS -} - -// Getxattr gets extended attributes. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Getxattr(path string, name string) (int, []byte) { - return -ENOSYS, nil -} - -// Removexattr removes extended attributes. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Removexattr(path string, name string) int { - return -ENOSYS -} - -// Listxattr lists extended attributes. -// The FileSystemBase implementation returns -ENOSYS. -func (*FileSystemBase) Listxattr(path string, fill func(name string) bool) int { - return -ENOSYS -} - -var _ FileSystemInterface = (*FileSystemBase)(nil) diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/fsop_cgo.go b/vendor/github.com/billziss-gh/cgofuse/fuse/fsop_cgo.go deleted file mode 100644 index 7754fb5b5..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/fsop_cgo.go +++ /dev/null @@ -1,294 +0,0 @@ -// +build cgo - -/* - * fsop_cgo.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -package fuse - -/* -#if !(defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(_WIN32)) -#error platform not supported -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) - -#include -#include - -#elif defined(_WIN32) - -#define EPERM 1 -#define ENOENT 2 -#define ESRCH 3 -#define EINTR 4 -#define EIO 5 -#define ENXIO 6 -#define E2BIG 7 -#define ENOEXEC 8 -#define EBADF 9 -#define ECHILD 10 -#define EAGAIN 11 -#define ENOMEM 12 -#define EACCES 13 -#define EFAULT 14 -#define EBUSY 16 -#define EEXIST 17 -#define EXDEV 18 -#define ENODEV 19 -#define ENOTDIR 20 -#define EISDIR 21 -#define ENFILE 23 -#define EMFILE 24 -#define ENOTTY 25 -#define EFBIG 27 -#define ENOSPC 28 -#define ESPIPE 29 -#define EROFS 30 -#define EMLINK 31 -#define EPIPE 32 -#define EDOM 33 -#define EDEADLK 36 -#define ENAMETOOLONG 38 -#define ENOLCK 39 -#define ENOSYS 40 -#define ENOTEMPTY 41 -#define EINVAL 22 -#define ERANGE 34 -#define EILSEQ 42 -#define EADDRINUSE 100 -#define EADDRNOTAVAIL 101 -#define EAFNOSUPPORT 102 -#define EALREADY 103 -#define EBADMSG 104 -#define ECANCELED 105 -#define ECONNABORTED 106 -#define ECONNREFUSED 107 -#define ECONNRESET 108 -#define EDESTADDRREQ 109 -#define EHOSTUNREACH 110 -#define EIDRM 111 -#define EINPROGRESS 112 -#define EISCONN 113 -#define ELOOP 114 -#define EMSGSIZE 115 -#define ENETDOWN 116 -#define ENETRESET 117 -#define ENETUNREACH 118 -#define ENOBUFS 119 -#define ENODATA 120 -#define ENOLINK 121 -#define ENOMSG 122 -#define ENOPROTOOPT 123 -#define ENOSR 124 -#define ENOSTR 125 -#define ENOTCONN 126 -#define ENOTRECOVERABLE 127 -#define ENOTSOCK 128 -#define ENOTSUP 129 -#define EOPNOTSUPP 130 -#define EOTHER 131 -#define EOVERFLOW 132 -#define EOWNERDEAD 133 -#define EPROTO 134 -#define EPROTONOSUPPORT 135 -#define EPROTOTYPE 136 -#define ETIME 137 -#define ETIMEDOUT 138 -#define ETXTBSY 139 -#define EWOULDBLOCK 140 - -#include -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_EXCL _O_EXCL -#define O_TRUNC _O_TRUNC -#if !defined(O_ACCMODE) -#define O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) -#endif - -#endif - -#if defined(__linux__) || defined(_WIN32) -// incantation needed for cgo to figure out "kind of name" for ENOATTR -#define ENOATTR ((int)ENODATA) - -#elif defined(__FreeBSD__) || defined(__OpenBSD__) - -// ETIME: see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225324 -// ENODATA: the following is not strictly correct but a lot of project -// assume that ENODATA == ENOATTR, just because Linux does so. -// ENOSTR, ENOSR: these are not defined anywhere; convert to EINVAL -#define ETIME ETIMEDOUT -#define ENODATA ENOATTR -#define ENOSTR EINVAL -#define ENOSR EINVAL - -#if !defined(ENOLINK) -#define ENOLINK ENOENT -#endif - -#elif defined(__NetBSD__) - -// these are not defined anywhere; convert to EINVAL -#define ENOTRECOVERABLE EINVAL -#define EOWNERDEAD EINVAL - -#endif - -#if defined(__APPLE__) || defined(__linux__) -#include -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(_WIN32) -#define XATTR_CREATE 1 -#define XATTR_REPLACE 2 -#endif -*/ -import "C" - -// Error codes reported by FUSE file systems. -const ( - E2BIG = int(C.E2BIG) - EACCES = int(C.EACCES) - EADDRINUSE = int(C.EADDRINUSE) - EADDRNOTAVAIL = int(C.EADDRNOTAVAIL) - EAFNOSUPPORT = int(C.EAFNOSUPPORT) - EAGAIN = int(C.EAGAIN) - EALREADY = int(C.EALREADY) - EBADF = int(C.EBADF) - EBADMSG = int(C.EBADMSG) - EBUSY = int(C.EBUSY) - ECANCELED = int(C.ECANCELED) - ECHILD = int(C.ECHILD) - ECONNABORTED = int(C.ECONNABORTED) - ECONNREFUSED = int(C.ECONNREFUSED) - ECONNRESET = int(C.ECONNRESET) - EDEADLK = int(C.EDEADLK) - EDESTADDRREQ = int(C.EDESTADDRREQ) - EDOM = int(C.EDOM) - EEXIST = int(C.EEXIST) - EFAULT = int(C.EFAULT) - EFBIG = int(C.EFBIG) - EHOSTUNREACH = int(C.EHOSTUNREACH) - EIDRM = int(C.EIDRM) - EILSEQ = int(C.EILSEQ) - EINPROGRESS = int(C.EINPROGRESS) - EINTR = int(C.EINTR) - EINVAL = int(C.EINVAL) - EIO = int(C.EIO) - EISCONN = int(C.EISCONN) - EISDIR = int(C.EISDIR) - ELOOP = int(C.ELOOP) - EMFILE = int(C.EMFILE) - EMLINK = int(C.EMLINK) - EMSGSIZE = int(C.EMSGSIZE) - ENAMETOOLONG = int(C.ENAMETOOLONG) - ENETDOWN = int(C.ENETDOWN) - ENETRESET = int(C.ENETRESET) - ENETUNREACH = int(C.ENETUNREACH) - ENFILE = int(C.ENFILE) - ENOATTR = int(C.ENOATTR) - ENOBUFS = int(C.ENOBUFS) - ENODATA = int(C.ENODATA) - ENODEV = int(C.ENODEV) - ENOENT = int(C.ENOENT) - ENOEXEC = int(C.ENOEXEC) - ENOLCK = int(C.ENOLCK) - ENOLINK = int(C.ENOLINK) - ENOMEM = int(C.ENOMEM) - ENOMSG = int(C.ENOMSG) - ENOPROTOOPT = int(C.ENOPROTOOPT) - ENOSPC = int(C.ENOSPC) - ENOSR = int(C.ENOSR) - ENOSTR = int(C.ENOSTR) - ENOSYS = int(C.ENOSYS) - ENOTCONN = int(C.ENOTCONN) - ENOTDIR = int(C.ENOTDIR) - ENOTEMPTY = int(C.ENOTEMPTY) - ENOTRECOVERABLE = int(C.ENOTRECOVERABLE) - ENOTSOCK = int(C.ENOTSOCK) - ENOTSUP = int(C.ENOTSUP) - ENOTTY = int(C.ENOTTY) - ENXIO = int(C.ENXIO) - EOPNOTSUPP = int(C.EOPNOTSUPP) - EOVERFLOW = int(C.EOVERFLOW) - EOWNERDEAD = int(C.EOWNERDEAD) - EPERM = int(C.EPERM) - EPIPE = int(C.EPIPE) - EPROTO = int(C.EPROTO) - EPROTONOSUPPORT = int(C.EPROTONOSUPPORT) - EPROTOTYPE = int(C.EPROTOTYPE) - ERANGE = int(C.ERANGE) - EROFS = int(C.EROFS) - ESPIPE = int(C.ESPIPE) - ESRCH = int(C.ESRCH) - ETIME = int(C.ETIME) - ETIMEDOUT = int(C.ETIMEDOUT) - ETXTBSY = int(C.ETXTBSY) - EWOULDBLOCK = int(C.EWOULDBLOCK) - EXDEV = int(C.EXDEV) -) - -// Flags used in FileSystemInterface.Create and FileSystemInterface.Open. -const ( - O_RDONLY = int(C.O_RDONLY) - O_WRONLY = int(C.O_WRONLY) - O_RDWR = int(C.O_RDWR) - O_APPEND = int(C.O_APPEND) - O_CREAT = int(C.O_CREAT) - O_EXCL = int(C.O_EXCL) - O_TRUNC = int(C.O_TRUNC) - O_ACCMODE = int(C.O_ACCMODE) -) - -// File type and permission bits. -const ( - S_IFMT = 0170000 - S_IFBLK = 0060000 - S_IFCHR = 0020000 - S_IFIFO = 0010000 - S_IFREG = 0100000 - S_IFDIR = 0040000 - S_IFLNK = 0120000 - S_IFSOCK = 0140000 - - S_IRWXU = 00700 - S_IRUSR = 00400 - S_IWUSR = 00200 - S_IXUSR = 00100 - S_IRWXG = 00070 - S_IRGRP = 00040 - S_IWGRP = 00020 - S_IXGRP = 00010 - S_IRWXO = 00007 - S_IROTH = 00004 - S_IWOTH = 00002 - S_IXOTH = 00001 - S_ISUID = 04000 - S_ISGID = 02000 - S_ISVTX = 01000 -) - -// BSD file flags (Windows file attributes). -const ( - UF_HIDDEN = 0x00008000 - UF_READONLY = 0x00001000 - UF_SYSTEM = 0x00000080 - UF_ARCHIVE = 0x00000800 -) - -// Options that control Setxattr operation. -const ( - XATTR_CREATE = int(C.XATTR_CREATE) - XATTR_REPLACE = int(C.XATTR_REPLACE) -) diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/fsop_nocgo_windows.go b/vendor/github.com/billziss-gh/cgofuse/fuse/fsop_nocgo_windows.go deleted file mode 100644 index 452bc7493..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/fsop_nocgo_windows.go +++ /dev/null @@ -1,152 +0,0 @@ -// +build !cgo,windows - -/* - * fsop_nocgo_windows.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -package fuse - -// Error codes reported by FUSE file systems. -const ( - E2BIG = 7 - EACCES = 13 - EADDRINUSE = 100 - EADDRNOTAVAIL = 101 - EAFNOSUPPORT = 102 - EAGAIN = 11 - EALREADY = 103 - EBADF = 9 - EBADMSG = 104 - EBUSY = 16 - ECANCELED = 105 - ECHILD = 10 - ECONNABORTED = 106 - ECONNREFUSED = 107 - ECONNRESET = 108 - EDEADLK = 36 - EDESTADDRREQ = 109 - EDOM = 33 - EEXIST = 17 - EFAULT = 14 - EFBIG = 27 - EHOSTUNREACH = 110 - EIDRM = 111 - EILSEQ = 42 - EINPROGRESS = 112 - EINTR = 4 - EINVAL = 22 - EIO = 5 - EISCONN = 113 - EISDIR = 21 - ELOOP = 114 - EMFILE = 24 - EMLINK = 31 - EMSGSIZE = 115 - ENAMETOOLONG = 38 - ENETDOWN = 116 - ENETRESET = 117 - ENETUNREACH = 118 - ENFILE = 23 - ENOATTR = ENODATA - ENOBUFS = 119 - ENODATA = 120 - ENODEV = 19 - ENOENT = 2 - ENOEXEC = 8 - ENOLCK = 39 - ENOLINK = 121 - ENOMEM = 12 - ENOMSG = 122 - ENOPROTOOPT = 123 - ENOSPC = 28 - ENOSR = 124 - ENOSTR = 125 - ENOSYS = 40 - ENOTCONN = 126 - ENOTDIR = 20 - ENOTEMPTY = 41 - ENOTRECOVERABLE = 127 - ENOTSOCK = 128 - ENOTSUP = 129 - ENOTTY = 25 - ENXIO = 6 - EOPNOTSUPP = 130 - EOVERFLOW = 132 - EOWNERDEAD = 133 - EPERM = 1 - EPIPE = 32 - EPROTO = 134 - EPROTONOSUPPORT = 135 - EPROTOTYPE = 136 - ERANGE = 34 - EROFS = 30 - ESPIPE = 29 - ESRCH = 3 - ETIME = 137 - ETIMEDOUT = 138 - ETXTBSY = 139 - EWOULDBLOCK = 140 - EXDEV = 18 -) - -// Flags used in FileSystemInterface.Create and FileSystemInterface.Open. -const ( - O_RDONLY = 0x0000 - O_WRONLY = 0x0001 - O_RDWR = 0x0002 - O_APPEND = 0x0008 - O_CREAT = 0x0100 - O_EXCL = 0x0200 - O_TRUNC = 0x0400 - O_ACCMODE = O_RDONLY | O_WRONLY | O_RDWR -) - -// File type and permission bits. -const ( - S_IFMT = 0170000 - S_IFBLK = 0060000 - S_IFCHR = 0020000 - S_IFIFO = 0010000 - S_IFREG = 0100000 - S_IFDIR = 0040000 - S_IFLNK = 0120000 - S_IFSOCK = 0140000 - - S_IRWXU = 00700 - S_IRUSR = 00400 - S_IWUSR = 00200 - S_IXUSR = 00100 - S_IRWXG = 00070 - S_IRGRP = 00040 - S_IWGRP = 00020 - S_IXGRP = 00010 - S_IRWXO = 00007 - S_IROTH = 00004 - S_IWOTH = 00002 - S_IXOTH = 00001 - S_ISUID = 04000 - S_ISGID = 02000 - S_ISVTX = 01000 -) - -// BSD file flags (Windows file attributes). -const ( - UF_HIDDEN = 0x00008000 - UF_READONLY = 0x00001000 - UF_SYSTEM = 0x00000080 - UF_ARCHIVE = 0x00000800 -) - -// Options that control Setxattr operation. -const ( - XATTR_CREATE = 1 - XATTR_REPLACE = 2 -) diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/host.go b/vendor/github.com/billziss-gh/cgofuse/fuse/host.go deleted file mode 100644 index 601a06083..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/host.go +++ /dev/null @@ -1,965 +0,0 @@ -/* - * host.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -package fuse - -import ( - "errors" - "os" - "os/signal" - "path/filepath" - "runtime" - "strings" - "sync" - "syscall" - "unsafe" -) - -// FileSystemHost is used to host a file system. -type FileSystemHost struct { - fsop FileSystemInterface - fuse *c_struct_fuse - mntp string - sigc chan os.Signal - - capCaseInsensitive, capReaddirPlus bool -} - -var ( - hostGuard = sync.Mutex{} - hostTable = map[unsafe.Pointer]*FileSystemHost{} -) - -func hostHandleNew(host *FileSystemHost) unsafe.Pointer { - p := c_malloc(1) - hostGuard.Lock() - hostTable[p] = host - hostGuard.Unlock() - return p -} - -func hostHandleDel(p unsafe.Pointer) { - hostGuard.Lock() - delete(hostTable, p) - hostGuard.Unlock() - c_free(p) -} - -func hostHandleGet(p unsafe.Pointer) *FileSystemHost { - hostGuard.Lock() - host, _ := hostTable[p] - hostGuard.Unlock() - return host -} - -func copyCstatvfsFromFusestatfs(dst *c_fuse_statvfs_t, src *Statfs_t) { - c_hostCstatvfsFromFusestatfs(dst, - c_uint64_t(src.Bsize), - c_uint64_t(src.Frsize), - c_uint64_t(src.Blocks), - c_uint64_t(src.Bfree), - c_uint64_t(src.Bavail), - c_uint64_t(src.Files), - c_uint64_t(src.Ffree), - c_uint64_t(src.Favail), - c_uint64_t(src.Fsid), - c_uint64_t(src.Flag), - c_uint64_t(src.Namemax)) -} - -func copyCstatFromFusestat(dst *c_fuse_stat_t, src *Stat_t) { - c_hostCstatFromFusestat(dst, - c_uint64_t(src.Dev), - c_uint64_t(src.Ino), - c_uint32_t(src.Mode), - c_uint32_t(src.Nlink), - c_uint32_t(src.Uid), - c_uint32_t(src.Gid), - c_uint64_t(src.Rdev), - c_int64_t(src.Size), - c_int64_t(src.Atim.Sec), c_int64_t(src.Atim.Nsec), - c_int64_t(src.Mtim.Sec), c_int64_t(src.Mtim.Nsec), - c_int64_t(src.Ctim.Sec), c_int64_t(src.Ctim.Nsec), - c_int64_t(src.Blksize), - c_int64_t(src.Blocks), - c_int64_t(src.Birthtim.Sec), c_int64_t(src.Birthtim.Nsec), - c_uint32_t(src.Flags)) -} - -func copyFusetimespecFromCtimespec(dst *Timespec, src *c_fuse_timespec_t) { - dst.Sec = int64(src.tv_sec) - dst.Nsec = int64(src.tv_nsec) -} - -func recoverAsErrno(errc0 *c_int) { - if r := recover(); nil != r { - switch e := r.(type) { - case Error: - *errc0 = c_int(e) - default: - *errc0 = -c_int(EIO) - } - } -} - -func hostGetattr(path0 *c_char, stat0 *c_fuse_stat_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - stat := &Stat_t{} - errc := fsop.Getattr(path, stat, ^uint64(0)) - copyCstatFromFusestat(stat0, stat) - return c_int(errc) -} - -func hostReadlink(path0 *c_char, buff0 *c_char, size0 c_size_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc, rslt := fsop.Readlink(path) - buff := (*[1 << 30]byte)(unsafe.Pointer(buff0)) - copy(buff[:size0-1], rslt) - rlen := len(rslt) - if c_size_t(rlen) < size0 { - buff[rlen] = 0 - } - return c_int(errc) -} - -func hostMknod(path0 *c_char, mode0 c_fuse_mode_t, dev0 c_fuse_dev_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Mknod(path, uint32(mode0), uint64(dev0)) - return c_int(errc) -} - -func hostMkdir(path0 *c_char, mode0 c_fuse_mode_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Mkdir(path, uint32(mode0)) - return c_int(errc) -} - -func hostUnlink(path0 *c_char) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Unlink(path) - return c_int(errc) -} - -func hostRmdir(path0 *c_char) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Rmdir(path) - return c_int(errc) -} - -func hostSymlink(target0 *c_char, newpath0 *c_char) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - target, newpath := c_GoString(target0), c_GoString(newpath0) - errc := fsop.Symlink(target, newpath) - return c_int(errc) -} - -func hostRename(oldpath0 *c_char, newpath0 *c_char) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - oldpath, newpath := c_GoString(oldpath0), c_GoString(newpath0) - errc := fsop.Rename(oldpath, newpath) - return c_int(errc) -} - -func hostLink(oldpath0 *c_char, newpath0 *c_char) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - oldpath, newpath := c_GoString(oldpath0), c_GoString(newpath0) - errc := fsop.Link(oldpath, newpath) - return c_int(errc) -} - -func hostChmod(path0 *c_char, mode0 c_fuse_mode_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Chmod(path, uint32(mode0)) - return c_int(errc) -} - -func hostChown(path0 *c_char, uid0 c_fuse_uid_t, gid0 c_fuse_gid_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Chown(path, uint32(uid0), uint32(gid0)) - return c_int(errc) -} - -func hostTruncate(path0 *c_char, size0 c_fuse_off_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Truncate(path, int64(size0), ^uint64(0)) - return c_int(errc) -} - -func hostOpen(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - intf, ok := fsop.(FileSystemOpenEx) - if ok { - fi := FileInfo_t{Flags: int(fi0.flags)} - errc := intf.OpenEx(path, &fi) - c_hostAsgnCfileinfo(fi0, - c_bool(fi.DirectIo), - c_bool(fi.KeepCache), - c_bool(fi.NonSeekable), - c_uint64_t(fi.Fh)) - return c_int(errc) - } else { - errc, rslt := fsop.Open(path, int(fi0.flags)) - fi0.fh = c_uint64_t(rslt) - return c_int(errc) - } -} - -func hostRead(path0 *c_char, buff0 *c_char, size0 c_size_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (nbyt0 c_int) { - defer recoverAsErrno(&nbyt0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - buff := (*[1 << 30]byte)(unsafe.Pointer(buff0)) - nbyt := fsop.Read(path, buff[:size0], int64(ofst0), uint64(fi0.fh)) - return c_int(nbyt) -} - -func hostWrite(path0 *c_char, buff0 *c_char, size0 c_size_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (nbyt0 c_int) { - defer recoverAsErrno(&nbyt0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - buff := (*[1 << 30]byte)(unsafe.Pointer(buff0)) - nbyt := fsop.Write(path, buff[:size0], int64(ofst0), uint64(fi0.fh)) - return c_int(nbyt) -} - -func hostStatfs(path0 *c_char, stat0 *c_fuse_statvfs_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - stat := &Statfs_t{} - errc := fsop.Statfs(path, stat) - if -ENOSYS == errc { - stat = &Statfs_t{} - errc = 0 - } - copyCstatvfsFromFusestatfs(stat0, stat) - return c_int(errc) -} - -func hostFlush(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Flush(path, uint64(fi0.fh)) - return c_int(errc) -} - -func hostRelease(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Release(path, uint64(fi0.fh)) - return c_int(errc) -} - -func hostFsync(path0 *c_char, datasync c_int, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Fsync(path, 0 != datasync, uint64(fi0.fh)) - if -ENOSYS == errc { - errc = 0 - } - return c_int(errc) -} - -func hostSetxattr(path0 *c_char, name0 *c_char, buff0 *c_char, size0 c_size_t, - flags c_int) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - name := c_GoString(name0) - buff := (*[1 << 30]byte)(unsafe.Pointer(buff0)) - errc := fsop.Setxattr(path, name, buff[:size0], int(flags)) - return c_int(errc) -} - -func hostGetxattr(path0 *c_char, name0 *c_char, buff0 *c_char, size0 c_size_t) (nbyt0 c_int) { - defer recoverAsErrno(&nbyt0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - name := c_GoString(name0) - errc, rslt := fsop.Getxattr(path, name) - if 0 != errc { - return c_int(errc) - } - if 0 != size0 { - if len(rslt) > int(size0) { - return -c_int(ERANGE) - } - buff := (*[1 << 30]byte)(unsafe.Pointer(buff0)) - copy(buff[:size0], rslt) - } - return c_int(len(rslt)) -} - -func hostListxattr(path0 *c_char, buff0 *c_char, size0 c_size_t) (nbyt0 c_int) { - defer recoverAsErrno(&nbyt0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - buff := (*[1 << 30]byte)(unsafe.Pointer(buff0)) - size := int(size0) - nbyt := 0 - fill := func(name1 string) bool { - nlen := len(name1) - if 0 != size { - if nbyt+nlen+1 > size { - return false - } - copy(buff[nbyt:nbyt+nlen], name1) - buff[nbyt+nlen] = 0 - } - nbyt += nlen + 1 - return true - } - errc := fsop.Listxattr(path, fill) - if 0 != errc { - return c_int(errc) - } - return c_int(nbyt) -} - -func hostRemovexattr(path0 *c_char, name0 *c_char) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - name := c_GoString(name0) - errc := fsop.Removexattr(path, name) - return c_int(errc) -} - -func hostOpendir(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc, rslt := fsop.Opendir(path) - if -ENOSYS == errc { - errc = 0 - } - fi0.fh = c_uint64_t(rslt) - return c_int(errc) -} - -func hostReaddir(path0 *c_char, buff0 unsafe.Pointer, fill0 c_fuse_fill_dir_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - fill := func(name1 string, stat1 *Stat_t, off1 int64) bool { - name := c_CString(name1) - defer c_free(unsafe.Pointer(name)) - if nil == stat1 { - return 0 == c_hostFilldir(fill0, buff0, name, nil, c_fuse_off_t(off1)) - } else { - stat_ex := c_fuse_stat_ex_t{} // support WinFsp fuse_stat_ex - stat := (*c_fuse_stat_t)(unsafe.Pointer(&stat_ex)) - copyCstatFromFusestat(stat, stat1) - return 0 == c_hostFilldir(fill0, buff0, name, stat, c_fuse_off_t(off1)) - } - } - errc := fsop.Readdir(path, fill, int64(ofst0), uint64(fi0.fh)) - return c_int(errc) -} - -func hostReleasedir(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Releasedir(path, uint64(fi0.fh)) - return c_int(errc) -} - -func hostFsyncdir(path0 *c_char, datasync c_int, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Fsyncdir(path, 0 != datasync, uint64(fi0.fh)) - if -ENOSYS == errc { - errc = 0 - } - return c_int(errc) -} - -func hostInit(conn0 *c_struct_fuse_conn_info) (user_data unsafe.Pointer) { - defer func() { - recover() - }() - fctx := c_fuse_get_context() - user_data = fctx.private_data - host := hostHandleGet(user_data) - host.fuse = fctx.fuse - c_hostAsgnCconninfo(conn0, - c_bool(host.capCaseInsensitive), - c_bool(host.capReaddirPlus)) - if nil != host.sigc { - signal.Notify(host.sigc, syscall.SIGINT, syscall.SIGTERM) - } - host.fsop.Init() - return -} - -func hostDestroy(user_data unsafe.Pointer) { - defer func() { - recover() - }() - if "netbsd" == runtime.GOOS { - user_data = c_fuse_get_context().private_data - } - host := hostHandleGet(user_data) - host.fsop.Destroy() - if nil != host.sigc { - signal.Stop(host.sigc) - } - host.fuse = nil -} - -func hostAccess(path0 *c_char, mask0 c_int) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Access(path, uint32(mask0)) - return c_int(errc) -} - -func hostCreate(path0 *c_char, mode0 c_fuse_mode_t, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - intf, ok := fsop.(FileSystemOpenEx) - if ok { - fi := FileInfo_t{Flags: int(fi0.flags)} - errc := intf.CreateEx(path, uint32(mode0), &fi) - if -ENOSYS == errc { - errc = fsop.Mknod(path, S_IFREG|uint32(mode0), 0) - if 0 == errc { - errc = intf.OpenEx(path, &fi) - } - } - c_hostAsgnCfileinfo(fi0, - c_bool(fi.DirectIo), - c_bool(fi.KeepCache), - c_bool(fi.NonSeekable), - c_uint64_t(fi.Fh)) - return c_int(errc) - } else { - errc, rslt := fsop.Create(path, int(fi0.flags), uint32(mode0)) - if -ENOSYS == errc { - errc = fsop.Mknod(path, S_IFREG|uint32(mode0), 0) - if 0 == errc { - errc, rslt = fsop.Open(path, int(fi0.flags)) - } - } - fi0.fh = c_uint64_t(rslt) - return c_int(errc) - } -} - -func hostFtruncate(path0 *c_char, size0 c_fuse_off_t, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - errc := fsop.Truncate(path, int64(size0), uint64(fi0.fh)) - return c_int(errc) -} - -func hostFgetattr(path0 *c_char, stat0 *c_fuse_stat_t, - fi0 *c_struct_fuse_file_info) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - stat := &Stat_t{} - errc := fsop.Getattr(path, stat, uint64(fi0.fh)) - copyCstatFromFusestat(stat0, stat) - return c_int(errc) -} - -func hostUtimens(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - path := c_GoString(path0) - if nil == tmsp0 { - errc := fsop.Utimens(path, nil) - return c_int(errc) - } else { - tmsp := [2]Timespec{} - tmsa := (*[2]c_fuse_timespec_t)(unsafe.Pointer(tmsp0)) - copyFusetimespecFromCtimespec(&tmsp[0], &tmsa[0]) - copyFusetimespecFromCtimespec(&tmsp[1], &tmsa[1]) - errc := fsop.Utimens(path, tmsp[:]) - return c_int(errc) - } -} - -func hostSetchgtime(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - intf, ok := fsop.(FileSystemSetchgtime) - if !ok { - // say we did it! - return 0 - } - path := c_GoString(path0) - tmsp := Timespec{} - copyFusetimespecFromCtimespec(&tmsp, tmsp0) - errc := intf.Setchgtime(path, tmsp) - return c_int(errc) -} - -func hostSetcrtime(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - intf, ok := fsop.(FileSystemSetcrtime) - if !ok { - // say we did it! - return 0 - } - path := c_GoString(path0) - tmsp := Timespec{} - copyFusetimespecFromCtimespec(&tmsp, tmsp0) - errc := intf.Setcrtime(path, tmsp) - return c_int(errc) -} - -func hostChflags(path0 *c_char, flags c_uint32_t) (errc0 c_int) { - defer recoverAsErrno(&errc0) - fsop := hostHandleGet(c_fuse_get_context().private_data).fsop - intf, ok := fsop.(FileSystemChflags) - if !ok { - // say we did it! - return 0 - } - path := c_GoString(path0) - errc := intf.Chflags(path, uint32(flags)) - return c_int(errc) -} - -// NewFileSystemHost creates a file system host. -func NewFileSystemHost(fsop FileSystemInterface) *FileSystemHost { - host := &FileSystemHost{} - host.fsop = fsop - return host -} - -// SetCapCaseInsensitive informs the host that the hosted file system is case insensitive -// [OSX and Windows only]. -func (host *FileSystemHost) SetCapCaseInsensitive(value bool) { - host.capCaseInsensitive = value -} - -// SetCapReaddirPlus informs the host that the hosted file system has the readdir-plus -// capability [Windows only]. A file system that has the readdir-plus capability can send -// full stat information during Readdir, thus avoiding extraneous Getattr calls. -func (host *FileSystemHost) SetCapReaddirPlus(value bool) { - host.capReaddirPlus = value -} - -// Mount mounts a file system on the given mountpoint with the mount options in opts. -// -// Many of the mount options in opts are specific to the underlying FUSE implementation. -// Some of the common options include: -// -// -h --help print help -// -V --version print FUSE version -// -d -o debug enable FUSE debug output -// -s disable multi-threaded operation -// -// Please refer to the individual FUSE implementation documentation for additional options. -// -// It is allowed for the mountpoint to be the empty string ("") in which case opts is assumed -// to contain the mountpoint. It is also allowed for opts to be nil, although in this case the -// mountpoint must be non-empty. -func (host *FileSystemHost) Mount(mountpoint string, opts []string) bool { - if 0 == c_hostFuseInit() { - panic("cgofuse: cannot find winfsp") - } - - /* - * Command line handling - * - * We must prepare a command line to send to FUSE. This command line will look like this: - * - * execname [mountpoint] "-f" [opts...] NULL - * - * We add the "-f" option because Go cannot handle daemonization (at least on OSX). - */ - exec := "" - if 0 < len(os.Args) { - exec = os.Args[0] - } - argc := len(opts) + 2 - if "" != mountpoint { - argc++ - } - argv := make([]*c_char, argc+1) - argv[0] = c_CString(exec) - defer c_free(unsafe.Pointer(argv[0])) - opti := 1 - if "" != mountpoint { - argv[1] = c_CString(mountpoint) - defer c_free(unsafe.Pointer(argv[1])) - opti++ - } - argv[opti] = c_CString("-f") - defer c_free(unsafe.Pointer(argv[opti])) - opti++ - for i := 0; len(opts) > i; i++ { - argv[i+opti] = c_CString(opts[i]) - defer c_free(unsafe.Pointer(argv[i+opti])) - } - - /* - * Mountpoint extraction - * - * We need to determine the mountpoint that FUSE is going (to try) to use, so that we - * can unmount later. - */ - if "" != mountpoint { - host.mntp = mountpoint - } else { - outargs, _ := OptParse(opts, "") - if 1 <= len(outargs) { - host.mntp = outargs[0] - } - } - if "" != host.mntp { - if "windows" != runtime.GOOS || 2 != len(host.mntp) || ':' != host.mntp[1] { - abs, err := filepath.Abs(host.mntp) - if nil == err { - host.mntp = abs - } - } - } - defer func() { - host.mntp = "" - }() - - /* - * Handle zombie mounts - * - * FUSE on UNIX does not automatically unmount the file system, leaving behind "zombie" - * mounts. So set things up to always unmount the file system (unless forcibly terminated). - * This has the added benefit that the file system Destroy() always gets called. - * - * On Windows (WinFsp) this is handled by the FUSE layer and we do not have to do anything. - */ - if "windows" != runtime.GOOS { - done := make(chan bool) - defer func() { - <-done - }() - host.sigc = make(chan os.Signal, 1) - defer close(host.sigc) - go func() { - _, ok := <-host.sigc - if ok { - host.Unmount() - } - close(done) - }() - } - - /* - * Tell FUSE to do its job! - */ - hndl := hostHandleNew(host) - defer hostHandleDel(hndl) - return 0 != c_hostMount(c_int(argc), &argv[0], hndl) -} - -// Unmount unmounts a mounted file system. -// Unmount may be called at any time after the Init() method has been called -// and before the Destroy() method has been called. -func (host *FileSystemHost) Unmount() bool { - if nil == host.fuse { - return false - } - var mntp *c_char - if "" != host.mntp { - mntp = c_CString(host.mntp) - } - return 0 != c_hostUnmount(host.fuse, mntp) -} - -// Getcontext gets information related to a file system operation. -func Getcontext() (uid uint32, gid uint32, pid int) { - context := c_fuse_get_context() - uid = uint32(context.uid) - gid = uint32(context.gid) - pid = int(context.pid) - return -} - -func optNormBool(opt string) string { - if i := strings.Index(opt, "=%"); -1 != i { - switch opt[i+2:] { - case "d", "o", "x", "X": - return opt - case "v": - return opt[:i+1] - default: - panic("unknown format " + opt[i+1:]) - } - } else { - return opt - } -} - -func optNormInt(opt string, modf string) string { - if i := strings.Index(opt, "=%"); -1 != i { - switch opt[i+2:] { - case "d", "o", "x", "X": - return opt[:i+2] + modf + opt[i+2:] - case "v": - return opt[:i+2] + modf + "i" - default: - panic("unknown format " + opt[i+1:]) - } - } else if strings.HasSuffix(opt, "=") { - return opt + "%" + modf + "i" - } else { - return opt + "=%" + modf + "i" - } -} - -func optNormStr(opt string) string { - if i := strings.Index(opt, "=%"); -1 != i { - switch opt[i+2:] { - case "s", "v": - return opt[:i+2] + "s" - default: - panic("unknown format " + opt[i+1:]) - } - } else if strings.HasSuffix(opt, "=") { - return opt + "%s" - } else { - return opt + "=%s" - } -} - -// OptParse parses the FUSE command line arguments in args as determined by format -// and stores the resulting values in vals, which must be pointers. It returns a -// list of unparsed arguments or nil if an error happens. -// -// The format may be empty or non-empty. An empty format is taken as a special -// instruction to OptParse to only return all non-option arguments in outargs. -// -// A non-empty format is a space separated list of acceptable FUSE options. Each -// option is matched with a corresponding pointer value in vals. The combination -// of the option and the type of the corresponding pointer value, determines how -// the option is used. The allowed pointer types are pointer to bool, pointer to -// an integer type and pointer to string. -// -// For pointer to bool types: -// -// -x Match -x without parameter. -// -foo --foo As above for -foo or --foo. -// foo Match "-o foo". -// -x= -foo= --foo= foo= Match option with parameter. -// -x=%VERB ... foo=%VERB Match option with parameter of syntax. -// Allowed verbs: d,o,x,X,v -// - d,o,x,X: set to true if parameter non-0. -// - v: set to true if parameter present. -// -// The formats -x=, and -x=%v are equivalent. -// -// For pointer to other types: -// -// -x Match -x with parameter (-x=PARAM). -// -foo --foo As above for -foo or --foo. -// foo Match "-o foo=PARAM". -// -x= -foo= --foo= foo= Match option with parameter. -// -x=%VERB ... foo=%VERB Match option with parameter of syntax. -// Allowed verbs for pointer to int types: d,o,x,X,v -// Allowed verbs for pointer to string types: s,v -// -// The formats -x, -x=, and -x=%v are equivalent. -// -// For example: -// -// var f bool -// var set_attr_timeout bool -// var attr_timeout int -// var umask uint32 -// outargs, err := OptParse(args, "-f attr_timeout= attr_timeout umask=%o", -// &f, &set_attr_timeout, &attr_timeout, &umask) -// -// Will accept a command line of: -// -// $ program -f -o attr_timeout=42,umask=077 -// -// And will set variables as follows: -// -// f == true -// set_attr_timeout == true -// attr_timeout == 42 -// umask == 077 -// -func OptParse(args []string, format string, vals ...interface{}) (outargs []string, err error) { - if 0 == c_hostFuseInit() { - panic("cgofuse: cannot find winfsp") - } - - defer func() { - if r := recover(); nil != r { - if s, ok := r.(string); ok { - outargs = nil - err = errors.New("OptParse: " + s) - } else { - panic(r) - } - } - }() - - var opts []string - var nonopts bool - if "" == format { - opts = make([]string, 0) - nonopts = true - } else { - opts = strings.Split(format, " ") - } - - align := int(2 * unsafe.Sizeof(c_size_t(0))) // match malloc alignment (usually 8 or 16) - - fuse_opts := make([]c_struct_fuse_opt, len(opts)+1) - for i := 0; len(opts) > i; i++ { - var templ *c_char - switch vals[i].(type) { - case *bool: - templ = c_CString(optNormBool(opts[i])) - case *int: - templ = c_CString(optNormInt(opts[i], "")) - case *int8: - templ = c_CString(optNormInt(opts[i], "hh")) - case *int16: - templ = c_CString(optNormInt(opts[i], "h")) - case *int32: - templ = c_CString(optNormInt(opts[i], "")) - case *int64: - templ = c_CString(optNormInt(opts[i], "ll")) - case *uint: - templ = c_CString(optNormInt(opts[i], "")) - case *uint8: - templ = c_CString(optNormInt(opts[i], "hh")) - case *uint16: - templ = c_CString(optNormInt(opts[i], "h")) - case *uint32: - templ = c_CString(optNormInt(opts[i], "")) - case *uint64: - templ = c_CString(optNormInt(opts[i], "ll")) - case *uintptr: - templ = c_CString(optNormInt(opts[i], "ll")) - case *string: - templ = c_CString(optNormStr(opts[i])) - } - defer c_free(unsafe.Pointer(templ)) - - c_hostOptSet(&fuse_opts[i], templ, c_fuse_opt_offset_t(i*align), 1) - } - - fuse_args := c_struct_fuse_args{} - defer c_fuse_opt_free_args(&fuse_args) - argc := 1 + len(args) - argp := c_calloc(c_size_t(argc+1), c_size_t(unsafe.Sizeof((*c_char)(nil)))) - argv := (*[1 << 16]*c_char)(argp) - argv[0] = c_CString("") - for i := 0; len(args) > i; i++ { - argv[1+i] = c_CString(args[i]) - } - fuse_args.allocated = 1 - fuse_args.argc = c_int(argc) - fuse_args.argv = (**c_char)(&argv[0]) - - data := c_calloc(c_size_t(len(opts)), c_size_t(align)) - defer c_free(data) - - if -1 == c_hostOptParse(&fuse_args, data, &fuse_opts[0], c_bool(nonopts)) { - panic("failed") - } - - for i := 0; len(opts) > i; i++ { - switch v := vals[i].(type) { - case *bool: - *v = 0 != int(*(*c_int)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *int: - *v = int(*(*c_int)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *int8: - *v = int8(*(*c_int8_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *int16: - *v = int16(*(*c_int16_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *int32: - *v = int32(*(*c_int32_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *int64: - *v = int64(*(*c_int64_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *uint: - *v = uint(*(*c_unsigned)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *uint8: - *v = uint8(*(*c_uint8_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *uint16: - *v = uint16(*(*c_uint16_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *uint32: - *v = uint32(*(*c_uint32_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *uint64: - *v = uint64(*(*c_uint64_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *uintptr: - *v = uintptr(*(*c_uintptr_t)(unsafe.Pointer(uintptr(data) + uintptr(i*align)))) - case *string: - s := *(**c_char)(unsafe.Pointer(uintptr(data) + uintptr(i*align))) - *v = c_GoString(s) - c_free(unsafe.Pointer(s)) - } - } - - if 1 >= fuse_args.argc { - outargs = make([]string, 0) - } else { - outargs = make([]string, fuse_args.argc-1) - for i := 1; int(fuse_args.argc) > i; i++ { - outargs[i-1] = c_GoString((*[1 << 16]*c_char)(unsafe.Pointer(fuse_args.argv))[i]) - } - } - - if nonopts && 1 <= len(outargs) && "--" == outargs[0] { - outargs = outargs[1:] - } - - return -} - -func init() { - c_hostStaticInit() -} diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/host_cgo.go b/vendor/github.com/billziss-gh/cgofuse/fuse/host_cgo.go deleted file mode 100644 index 60cd51928..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/host_cgo.go +++ /dev/null @@ -1,928 +0,0 @@ -// +build cgo - -/* - * host_cgo.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -package fuse - -/* -#cgo darwin CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/osxfuse/fuse -#cgo darwin LDFLAGS: -L/usr/local/lib -losxfuse - -#cgo freebsd CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/fuse -#cgo freebsd LDFLAGS: -L/usr/local/lib -lfuse - -#cgo netbsd CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -D_KERNTYPES -#cgo netbsd LDFLAGS: -lrefuse - -#cgo openbsd CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -#cgo openbsd LDFLAGS: -lfuse - -#cgo linux CFLAGS: -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -#cgo linux LDFLAGS: -lfuse - -// Use `set CPATH=C:\Program Files (x86)\WinFsp\inc\fuse` on Windows. -// The flag `I/usr/local/include/winfsp` only works on xgo and docker. -#cgo windows CFLAGS: -DFUSE_USE_VERSION=28 -I/usr/local/include/winfsp - -#if !(defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(_WIN32)) -#error platform not supported -#endif - -#include -#include -#include -#include - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) - -#include -#include -#include -#include - -#elif defined(_WIN32) - -#include - -static PVOID cgofuse_init_slow(int hardfail); -static VOID cgofuse_init_fail(VOID); -static PVOID cgofuse_init_winfsp(VOID); - -static CRITICAL_SECTION cgofuse_lock; -static PVOID cgofuse_module = 0; -static BOOLEAN cgofuse_stat_ex = FALSE; - -static inline PVOID cgofuse_init_fast(int hardfail) -{ - PVOID Module = cgofuse_module; - MemoryBarrier(); - if (0 == Module) - Module = cgofuse_init_slow(hardfail); - return Module; -} - -static PVOID cgofuse_init_slow(int hardfail) -{ - PVOID Module; - EnterCriticalSection(&cgofuse_lock); - Module = cgofuse_module; - if (0 == Module) - { - Module = cgofuse_init_winfsp(); - MemoryBarrier(); - cgofuse_module = Module; - } - LeaveCriticalSection(&cgofuse_lock); - if (0 == Module && hardfail) - cgofuse_init_fail(); - return Module; -} - -static VOID cgofuse_init_fail(VOID) -{ - static const char *message = "cgofuse: cannot find winfsp\n"; - DWORD BytesTransferred; - WriteFile(GetStdHandle(STD_ERROR_HANDLE), message, lstrlenA(message), &BytesTransferred, 0); - ExitProcess(ERROR_DLL_NOT_FOUND); -} - -#define FSP_FUSE_API static -#define FSP_FUSE_API_NAME(api) (* pfn_ ## api) -#define FSP_FUSE_API_CALL(api) (cgofuse_init_fast(1), pfn_ ## api) -#define FSP_FUSE_SYM(proto, ...) static inline proto { __VA_ARGS__ } -#include -#include -#include - -static NTSTATUS FspLoad(PVOID *PModule) -{ -#if defined(_WIN64) -#define FSP_DLLNAME "winfsp-x64.dll" -#else -#define FSP_DLLNAME "winfsp-x86.dll" -#endif -#define FSP_DLLPATH "bin\\" FSP_DLLNAME - - WCHAR PathBuf[MAX_PATH]; - DWORD Size; - DWORD RegType; - HKEY RegKey; - LONG Result; - HMODULE Module; - - if (0 != PModule) - *PModule = 0; - - Module = LoadLibraryW(L"" FSP_DLLNAME); - if (0 == Module) - { - Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\WinFsp", - 0, KEY_READ | KEY_WOW64_32KEY, &RegKey); - if (ERROR_SUCCESS == Result) - { - Size = sizeof PathBuf - sizeof L"" FSP_DLLPATH + sizeof(WCHAR); - Result = RegQueryValueExW(RegKey, L"InstallDir", 0, - &RegType, (LPBYTE)PathBuf, &Size); - RegCloseKey(RegKey); - if (ERROR_SUCCESS == Result && REG_SZ != RegType) - Result = ERROR_FILE_NOT_FOUND; - } - if (ERROR_SUCCESS != Result) - return 0xC0000034;//STATUS_OBJECT_NAME_NOT_FOUND - - if (0 < Size && L'\0' == PathBuf[Size / sizeof(WCHAR) - 1]) - Size -= sizeof(WCHAR); - - RtlCopyMemory(PathBuf + Size / sizeof(WCHAR), - L"" FSP_DLLPATH, sizeof L"" FSP_DLLPATH); - Module = LoadLibraryW(PathBuf); - if (0 == Module) - return 0xC0000135;//STATUS_DLL_NOT_FOUND - } - - if (0 != PModule) - *PModule = Module; - - return 0;//STATUS_SUCCESS - -#undef FSP_DLLNAME -#undef FSP_DLLPATH -} - -#define CGOFUSE_GET_API(h, n) \ - if (0 == (*(void **)&(pfn_ ## n) = GetProcAddress(Module, #n)))\ - return 0; - -static PVOID cgofuse_init_winfsp(VOID) -{ - PVOID Module; - NTSTATUS Result; - - Result = FspLoad(&Module); - if (0 > Result) - return 0; - - // fuse_common.h - CGOFUSE_GET_API(h, fsp_fuse_version); - CGOFUSE_GET_API(h, fsp_fuse_mount); - CGOFUSE_GET_API(h, fsp_fuse_unmount); - CGOFUSE_GET_API(h, fsp_fuse_parse_cmdline); - CGOFUSE_GET_API(h, fsp_fuse_ntstatus_from_errno); - - // fuse.h - CGOFUSE_GET_API(h, fsp_fuse_main_real); - CGOFUSE_GET_API(h, fsp_fuse_is_lib_option); - CGOFUSE_GET_API(h, fsp_fuse_new); - CGOFUSE_GET_API(h, fsp_fuse_destroy); - CGOFUSE_GET_API(h, fsp_fuse_loop); - CGOFUSE_GET_API(h, fsp_fuse_loop_mt); - CGOFUSE_GET_API(h, fsp_fuse_exit); - CGOFUSE_GET_API(h, fsp_fuse_get_context); - - // fuse_opt.h - CGOFUSE_GET_API(h, fsp_fuse_opt_parse); - CGOFUSE_GET_API(h, fsp_fuse_opt_add_arg); - CGOFUSE_GET_API(h, fsp_fuse_opt_insert_arg); - CGOFUSE_GET_API(h, fsp_fuse_opt_free_args); - CGOFUSE_GET_API(h, fsp_fuse_opt_add_opt); - CGOFUSE_GET_API(h, fsp_fuse_opt_add_opt_escaped); - CGOFUSE_GET_API(h, fsp_fuse_opt_match); - - return Module; -} - -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) -typedef struct stat fuse_stat_t; -typedef struct stat fuse_stat_ex_t; -typedef struct statvfs fuse_statvfs_t; -typedef struct timespec fuse_timespec_t; -typedef mode_t fuse_mode_t; -typedef dev_t fuse_dev_t; -typedef uid_t fuse_uid_t; -typedef gid_t fuse_gid_t; -typedef off_t fuse_off_t; -typedef unsigned long fuse_opt_offset_t; -#elif defined(_WIN32) -typedef struct fuse_stat fuse_stat_t; -typedef struct fuse_stat_ex fuse_stat_ex_t; -typedef struct fuse_statvfs fuse_statvfs_t; -typedef struct fuse_timespec fuse_timespec_t; -typedef unsigned int fuse_opt_offset_t; -#endif - -extern int go_hostGetattr(char *path, fuse_stat_t *stbuf); -extern int go_hostReadlink(char *path, char *buf, size_t size); -extern int go_hostMknod(char *path, fuse_mode_t mode, fuse_dev_t dev); -extern int go_hostMkdir(char *path, fuse_mode_t mode); -extern int go_hostUnlink(char *path); -extern int go_hostRmdir(char *path); -extern int go_hostSymlink(char *target, char *newpath); -extern int go_hostRename(char *oldpath, char *newpath); -extern int go_hostLink(char *oldpath, char *newpath); -extern int go_hostChmod(char *path, fuse_mode_t mode); -extern int go_hostChown(char *path, fuse_uid_t uid, fuse_gid_t gid); -extern int go_hostTruncate(char *path, fuse_off_t size); -extern int go_hostOpen(char *path, struct fuse_file_info *fi); -extern int go_hostRead(char *path, char *buf, size_t size, fuse_off_t off, - struct fuse_file_info *fi); -extern int go_hostWrite(char *path, char *buf, size_t size, fuse_off_t off, - struct fuse_file_info *fi); -extern int go_hostStatfs(char *path, fuse_statvfs_t *stbuf); -extern int go_hostFlush(char *path, struct fuse_file_info *fi); -extern int go_hostRelease(char *path, struct fuse_file_info *fi); -extern int go_hostFsync(char *path, int datasync, struct fuse_file_info *fi); -extern int go_hostSetxattr(char *path, char *name, char *value, size_t size, int flags); -extern int go_hostGetxattr(char *path, char *name, char *value, size_t size); -extern int go_hostListxattr(char *path, char *namebuf, size_t size); -extern int go_hostRemovexattr(char *path, char *name); -extern int go_hostOpendir(char *path, struct fuse_file_info *fi); -extern int go_hostReaddir(char *path, void *buf, fuse_fill_dir_t filler, fuse_off_t off, - struct fuse_file_info *fi); -extern int go_hostReleasedir(char *path, struct fuse_file_info *fi); -extern int go_hostFsyncdir(char *path, int datasync, struct fuse_file_info *fi); -extern void *go_hostInit(struct fuse_conn_info *conn); -extern void go_hostDestroy(void *data); -extern int go_hostAccess(char *path, int mask); -extern int go_hostCreate(char *path, fuse_mode_t mode, struct fuse_file_info *fi); -extern int go_hostFtruncate(char *path, fuse_off_t off, struct fuse_file_info *fi); -extern int go_hostFgetattr(char *path, fuse_stat_t *stbuf, struct fuse_file_info *fi); -//extern int go_hostLock(char *path, struct fuse_file_info *fi, int cmd, struct fuse_flock *lock); -extern int go_hostUtimens(char *path, fuse_timespec_t tv[2]); -extern int go_hostSetchgtime(char *path, fuse_timespec_t *tv); -extern int go_hostSetcrtime(char *path, fuse_timespec_t *tv); -extern int go_hostChflags(char *path, uint32_t flags); - -static inline void hostAsgnCconninfo(struct fuse_conn_info *conn, - bool capCaseInsensitive, - bool capReaddirPlus) -{ -#if defined(__APPLE__) - if (capCaseInsensitive) - FUSE_ENABLE_CASE_INSENSITIVE(conn); -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) -#elif defined(_WIN32) -#if defined(FSP_FUSE_CAP_STAT_EX) - conn->want |= conn->capable & FSP_FUSE_CAP_STAT_EX; - cgofuse_stat_ex = 0 != (conn->want & FSP_FUSE_CAP_STAT_EX); // hack! -#endif - if (capCaseInsensitive) - conn->want |= conn->capable & FSP_FUSE_CAP_CASE_INSENSITIVE; - if (capReaddirPlus) - conn->want |= conn->capable & FSP_FUSE_CAP_READDIR_PLUS; -#endif -} - -static inline void hostCstatvfsFromFusestatfs(fuse_statvfs_t *stbuf, - uint64_t bsize, - uint64_t frsize, - uint64_t blocks, - uint64_t bfree, - uint64_t bavail, - uint64_t files, - uint64_t ffree, - uint64_t favail, - uint64_t fsid, - uint64_t flag, - uint64_t namemax) -{ - memset(stbuf, 0, sizeof *stbuf); - stbuf->f_bsize = bsize; - stbuf->f_frsize = frsize; - stbuf->f_blocks = blocks; - stbuf->f_bfree = bfree; - stbuf->f_bavail = bavail; - stbuf->f_files = files; - stbuf->f_ffree = ffree; - stbuf->f_favail = favail; - stbuf->f_fsid = fsid; - stbuf->f_flag = flag; - stbuf->f_namemax = namemax; -} - -static inline void hostCstatFromFusestat(fuse_stat_t *stbuf, - uint64_t dev, - uint64_t ino, - uint32_t mode, - uint32_t nlink, - uint32_t uid, - uint32_t gid, - uint64_t rdev, - int64_t size, - int64_t atimSec, int64_t atimNsec, - int64_t mtimSec, int64_t mtimNsec, - int64_t ctimSec, int64_t ctimNsec, - int64_t blksize, - int64_t blocks, - int64_t birthtimSec, int64_t birthtimNsec, - uint32_t flags) -{ - memset(stbuf, 0, sizeof *stbuf); - stbuf->st_dev = dev; - stbuf->st_ino = ino; - stbuf->st_mode = mode; - stbuf->st_nlink = nlink; - stbuf->st_uid = uid; - stbuf->st_gid = gid; - stbuf->st_rdev = rdev; - stbuf->st_size = size; - stbuf->st_blksize = blksize; - stbuf->st_blocks = blocks; -#if defined(__APPLE__) - stbuf->st_atimespec.tv_sec = atimSec; stbuf->st_atimespec.tv_nsec = atimNsec; - stbuf->st_mtimespec.tv_sec = mtimSec; stbuf->st_mtimespec.tv_nsec = mtimNsec; - stbuf->st_ctimespec.tv_sec = ctimSec; stbuf->st_ctimespec.tv_nsec = ctimNsec; - if (0 != birthtimSec) - { - stbuf->st_birthtimespec.tv_sec = birthtimSec; - stbuf->st_birthtimespec.tv_nsec = birthtimNsec; - } - else - { - stbuf->st_birthtimespec.tv_sec = ctimSec; - stbuf->st_birthtimespec.tv_nsec = ctimNsec; - } - stbuf->st_flags = flags; -#elif defined(_WIN32) - stbuf->st_atim.tv_sec = atimSec; stbuf->st_atim.tv_nsec = atimNsec; - stbuf->st_mtim.tv_sec = mtimSec; stbuf->st_mtim.tv_nsec = mtimNsec; - stbuf->st_ctim.tv_sec = ctimSec; stbuf->st_ctim.tv_nsec = ctimNsec; - if (0 != birthtimSec) - { - stbuf->st_birthtim.tv_sec = birthtimSec; - stbuf->st_birthtim.tv_nsec = birthtimNsec; - } - else - { - stbuf->st_birthtim.tv_sec = ctimSec; - stbuf->st_birthtim.tv_nsec = ctimNsec; - } -#if defined(FSP_FUSE_CAP_STAT_EX) - if (cgofuse_stat_ex) - ((struct fuse_stat_ex *)stbuf)->st_flags = flags; -#endif -#else - stbuf->st_atim.tv_sec = atimSec; stbuf->st_atim.tv_nsec = atimNsec; - stbuf->st_mtim.tv_sec = mtimSec; stbuf->st_mtim.tv_nsec = mtimNsec; - stbuf->st_ctim.tv_sec = ctimSec; stbuf->st_ctim.tv_nsec = ctimNsec; -#endif -} - -static inline void hostAsgnCfileinfo(struct fuse_file_info *fi, - bool direct_io, - bool keep_cache, - bool nonseekable, - uint64_t fh) -{ - fi->direct_io = direct_io; - fi->keep_cache = keep_cache; - fi->nonseekable = nonseekable; - fi->fh = fh; -} - -static inline int hostFilldir(fuse_fill_dir_t filler, void *buf, - char *name, fuse_stat_t *stbuf, fuse_off_t off) -{ - return filler(buf, name, stbuf, off); -} - -#if defined(__APPLE__) -static int _hostSetxattr(char *path, char *name, char *value, size_t size, int flags, - uint32_t position) -{ - // OSX uses position only for the resource fork; we do not support it! - return go_hostSetxattr(path, name, value, size, flags); -} -static int _hostGetxattr(char *path, char *name, char *value, size_t size, - uint32_t position) -{ - // OSX uses position only for the resource fork; we do not support it! - return go_hostGetxattr(path, name, value, size); -} -#else -#define _hostSetxattr go_hostSetxattr -#define _hostGetxattr go_hostGetxattr -#endif - -// hostStaticInit, hostFuseInit and hostInit serve different purposes. -// -// hostStaticInit and hostFuseInit are needed to provide static and dynamic initialization -// of the FUSE layer. This is currently useful on Windows only. -// -// hostInit is simply the .init implementation of struct fuse_operations. - -static void hostStaticInit(void) -{ -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) -#elif defined(_WIN32) - InitializeCriticalSection(&cgofuse_lock); -#endif -} - -static int hostFuseInit(void) -{ -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__linux__) - return 1; -#elif defined(_WIN32) - return 0 != cgofuse_init_fast(0); -#endif -} - -static int hostMount(int argc, char *argv[], void *data) -{ - static struct fuse_operations fsop = - { - .getattr = (int (*)(const char *, fuse_stat_t *))go_hostGetattr, - .readlink = (int (*)(const char *, char *, size_t))go_hostReadlink, - .mknod = (int (*)(const char *, fuse_mode_t, fuse_dev_t))go_hostMknod, - .mkdir = (int (*)(const char *, fuse_mode_t))go_hostMkdir, - .unlink = (int (*)(const char *))go_hostUnlink, - .rmdir = (int (*)(const char *))go_hostRmdir, - .symlink = (int (*)(const char *, const char *))go_hostSymlink, - .rename = (int (*)(const char *, const char *))go_hostRename, - .link = (int (*)(const char *, const char *))go_hostLink, - .chmod = (int (*)(const char *, fuse_mode_t))go_hostChmod, - .chown = (int (*)(const char *, fuse_uid_t, fuse_gid_t))go_hostChown, - .truncate = (int (*)(const char *, fuse_off_t))go_hostTruncate, - .open = (int (*)(const char *, struct fuse_file_info *))go_hostOpen, - .read = (int (*)(const char *, char *, size_t, fuse_off_t, struct fuse_file_info *)) - go_hostRead, - .write = (int (*)(const char *, const char *, size_t, fuse_off_t, struct fuse_file_info *)) - go_hostWrite, - .statfs = (int (*)(const char *, fuse_statvfs_t *))go_hostStatfs, - .flush = (int (*)(const char *, struct fuse_file_info *))go_hostFlush, - .release = (int (*)(const char *, struct fuse_file_info *))go_hostRelease, - .fsync = (int (*)(const char *, int, struct fuse_file_info *))go_hostFsync, -#if defined(__APPLE__) - .setxattr = (int (*)(const char *, const char *, const char *, size_t, int, uint32_t)) - _hostSetxattr, - .getxattr = (int (*)(const char *, const char *, char *, size_t, uint32_t)) - _hostGetxattr, -#else - .setxattr = (int (*)(const char *, const char *, const char *, size_t, int))_hostSetxattr, - .getxattr = (int (*)(const char *, const char *, char *, size_t))_hostGetxattr, -#endif - .listxattr = (int (*)(const char *, char *, size_t))go_hostListxattr, - .removexattr = (int (*)(const char *, const char *))go_hostRemovexattr, - .opendir = (int (*)(const char *, struct fuse_file_info *))go_hostOpendir, - .readdir = (int (*)(const char *, void *, fuse_fill_dir_t, fuse_off_t, - struct fuse_file_info *))go_hostReaddir, - .releasedir = (int (*)(const char *, struct fuse_file_info *))go_hostReleasedir, - .fsyncdir = (int (*)(const char *, int, struct fuse_file_info *))go_hostFsyncdir, - .init = (void *(*)(struct fuse_conn_info *))go_hostInit, - .destroy = (void (*)(void *))go_hostDestroy, - .access = (int (*)(const char *, int))go_hostAccess, - .create = (int (*)(const char *, fuse_mode_t, struct fuse_file_info *))go_hostCreate, - .ftruncate = (int (*)(const char *, fuse_off_t, struct fuse_file_info *))go_hostFtruncate, - .fgetattr = (int (*)(const char *, fuse_stat_t *, struct fuse_file_info *))go_hostFgetattr, - //.lock = (int (*)(const char *, struct fuse_file_info *, int, struct fuse_flock *)) - // go_hostFlock, - .utimens = (int (*)(const char *, const fuse_timespec_t [2]))go_hostUtimens, -#if defined(__APPLE__) || (defined(_WIN32) && defined(FSP_FUSE_CAP_STAT_EX)) - .setchgtime = (int (*)(const char *, const fuse_timespec_t *))go_hostSetchgtime, - .setcrtime = (int (*)(const char *, const fuse_timespec_t *))go_hostSetcrtime, - .chflags = (int (*)(const char *, uint32_t))go_hostChflags, -#endif - }; -#if defined(__OpenBSD__) - return 0 == fuse_main(argc, argv, &fsop, data); -#else - return 0 == fuse_main_real(argc, argv, &fsop, sizeof fsop, data); -#endif -} - -static int hostUnmount(struct fuse *fuse, char *mountpoint) -{ -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - if (0 == mountpoint) - return 0; - // darwin,freebsd,netbsd: unmount is available to non-root - // openbsd: kern.usermount has been removed and mount/unmount is available to root only - return 0 == unmount(mountpoint, MNT_FORCE); -#elif defined(__linux__) - if (0 == mountpoint) - return 0; - // linux: try umount2 first in case we are root - if (0 == umount2(mountpoint, MNT_DETACH)) - return 1; - // linux: umount2 failed; try fusermount - char *argv[] = - { - "/bin/fusermount", - "-z", - "-u", - mountpoint, - 0, - }; - pid_t pid = 0; - int status = 0; - return - 0 == posix_spawn(&pid, argv[0], 0, 0, argv, 0) && - pid == waitpid(pid, &status, 0) && - WIFEXITED(status) && 0 == WEXITSTATUS(status); -#elif defined(_WIN32) - // windows/winfsp: fuse_exit just works from anywhere - fuse_exit(fuse); - return 1; -#endif -} - -static void hostOptSet(struct fuse_opt *opt, - const char *templ, fuse_opt_offset_t offset, int value) -{ - memset(opt, 0, sizeof *opt); -#if defined(__OpenBSD__) - opt->templ = templ; - opt->off = offset; - opt->val = value; -#else - opt->templ = templ; - opt->offset = offset; - opt->value = value; -#endif -} - -static int hostOptParseOptProc(void *opt_data, const char *arg, int key, - struct fuse_args *outargs) -{ - switch (key) - { - default: - return 0; - case FUSE_OPT_KEY_NONOPT: - return 1; - } -} - -static int hostOptParse(struct fuse_args *args, void *data, const struct fuse_opt opts[], - bool nonopts) -{ - return fuse_opt_parse(args, data, opts, nonopts ? hostOptParseOptProc : 0); -} -*/ -import "C" -import "unsafe" - -type ( - c_bool = C.bool - c_char = C.char - c_fuse_dev_t = C.fuse_dev_t - c_fuse_fill_dir_t = C.fuse_fill_dir_t - c_fuse_gid_t = C.fuse_gid_t - c_fuse_mode_t = C.fuse_mode_t - c_fuse_off_t = C.fuse_off_t - c_fuse_opt_offset_t = C.fuse_opt_offset_t - c_fuse_stat_t = C.fuse_stat_t - c_fuse_stat_ex_t = C.fuse_stat_ex_t - c_fuse_statvfs_t = C.fuse_statvfs_t - c_fuse_timespec_t = C.fuse_timespec_t - c_fuse_uid_t = C.fuse_uid_t - c_int = C.int - c_int16_t = C.int16_t - c_int32_t = C.int32_t - c_int64_t = C.int64_t - c_int8_t = C.int8_t - c_size_t = C.size_t - c_struct_fuse = C.struct_fuse - c_struct_fuse_args = C.struct_fuse_args - c_struct_fuse_conn_info = C.struct_fuse_conn_info - c_struct_fuse_context = C.struct_fuse_context - c_struct_fuse_file_info = C.struct_fuse_file_info - c_struct_fuse_opt = C.struct_fuse_opt - c_uint16_t = C.uint16_t - c_uint32_t = C.uint32_t - c_uint64_t = C.uint64_t - c_uint8_t = C.uint8_t - c_uintptr_t = C.uintptr_t - c_unsigned = C.unsigned -) - -func c_GoString(s *c_char) string { - return C.GoString(s) -} -func c_CString(s string) *c_char { - return C.CString(s) -} - -func c_malloc(size c_size_t) unsafe.Pointer { - return C.malloc(size) -} -func c_calloc(count c_size_t, size c_size_t) unsafe.Pointer { - return C.calloc(count, size) -} -func c_free(p unsafe.Pointer) { - C.free(p) -} - -func c_fuse_get_context() *c_struct_fuse_context { - return C.fuse_get_context() -} -func c_fuse_opt_free_args(args *c_struct_fuse_args) { - C.fuse_opt_free_args(args) -} - -func c_hostAsgnCconninfo(conn *c_struct_fuse_conn_info, - capCaseInsensitive c_bool, - capReaddirPlus c_bool) { - C.hostAsgnCconninfo(conn, capCaseInsensitive, capReaddirPlus) -} -func c_hostCstatvfsFromFusestatfs(stbuf *c_fuse_statvfs_t, - bsize c_uint64_t, - frsize c_uint64_t, - blocks c_uint64_t, - bfree c_uint64_t, - bavail c_uint64_t, - files c_uint64_t, - ffree c_uint64_t, - favail c_uint64_t, - fsid c_uint64_t, - flag c_uint64_t, - namemax c_uint64_t) { - C.hostCstatvfsFromFusestatfs(stbuf, - bsize, - frsize, - blocks, - bfree, - bavail, - files, - ffree, - favail, - fsid, - flag, - namemax) -} -func c_hostCstatFromFusestat(stbuf *c_fuse_stat_t, - dev c_uint64_t, - ino c_uint64_t, - mode c_uint32_t, - nlink c_uint32_t, - uid c_uint32_t, - gid c_uint32_t, - rdev c_uint64_t, - size c_int64_t, - atimSec c_int64_t, atimNsec c_int64_t, - mtimSec c_int64_t, mtimNsec c_int64_t, - ctimSec c_int64_t, ctimNsec c_int64_t, - blksize c_int64_t, - blocks c_int64_t, - birthtimSec c_int64_t, birthtimNsec c_int64_t, - flags c_uint32_t) { - C.hostCstatFromFusestat(stbuf, - dev, - ino, - mode, - nlink, - uid, - gid, - rdev, - size, - atimSec, - atimNsec, - mtimSec, - mtimNsec, - ctimSec, - ctimNsec, - blksize, - blocks, - birthtimSec, - birthtimNsec, - flags) -} -func c_hostAsgnCfileinfo(fi *c_struct_fuse_file_info, - direct_io c_bool, - keep_cache c_bool, - nonseekable c_bool, - fh c_uint64_t) { - C.hostAsgnCfileinfo(fi, - direct_io, - keep_cache, - nonseekable, - fh) -} -func c_hostFilldir(filler c_fuse_fill_dir_t, - buf unsafe.Pointer, name *c_char, stbuf *c_fuse_stat_t, off c_fuse_off_t) c_int { - return C.hostFilldir(filler, buf, name, stbuf, off) -} -func c_hostStaticInit() { - C.hostStaticInit() -} -func c_hostFuseInit() c_int { - return C.hostFuseInit() -} -func c_hostMount(argc c_int, argv **c_char, data unsafe.Pointer) c_int { - return C.hostMount(argc, argv, data) -} -func c_hostUnmount(fuse *c_struct_fuse, mountpoint *c_char) c_int { - return C.hostUnmount(fuse, mountpoint) -} -func c_hostOptSet(opt *c_struct_fuse_opt, - templ *c_char, offset c_fuse_opt_offset_t, value c_int) { - C.hostOptSet(opt, templ, offset, value) -} -func c_hostOptParse(args *c_struct_fuse_args, data unsafe.Pointer, opts *c_struct_fuse_opt, - nonopts c_bool) c_int { - return C.hostOptParse(args, data, opts, nonopts) -} - -//export go_hostGetattr -func go_hostGetattr(path0 *c_char, stat0 *c_fuse_stat_t) (errc0 c_int) { - return hostGetattr(path0, stat0) -} - -//export go_hostReadlink -func go_hostReadlink(path0 *c_char, buff0 *c_char, size0 c_size_t) (errc0 c_int) { - return hostReadlink(path0, buff0, size0) -} - -//export go_hostMknod -func go_hostMknod(path0 *c_char, mode0 c_fuse_mode_t, dev0 c_fuse_dev_t) (errc0 c_int) { - return hostMknod(path0, mode0, dev0) -} - -//export go_hostMkdir -func go_hostMkdir(path0 *c_char, mode0 c_fuse_mode_t) (errc0 c_int) { - return hostMkdir(path0, mode0) -} - -//export go_hostUnlink -func go_hostUnlink(path0 *c_char) (errc0 c_int) { - return hostUnlink(path0) -} - -//export go_hostRmdir -func go_hostRmdir(path0 *c_char) (errc0 c_int) { - return hostRmdir(path0) -} - -//export go_hostSymlink -func go_hostSymlink(target0 *c_char, newpath0 *c_char) (errc0 c_int) { - return hostSymlink(target0, newpath0) -} - -//export go_hostRename -func go_hostRename(oldpath0 *c_char, newpath0 *c_char) (errc0 c_int) { - return hostRename(oldpath0, newpath0) -} - -//export go_hostLink -func go_hostLink(oldpath0 *c_char, newpath0 *c_char) (errc0 c_int) { - return hostLink(oldpath0, newpath0) -} - -//export go_hostChmod -func go_hostChmod(path0 *c_char, mode0 c_fuse_mode_t) (errc0 c_int) { - return hostChmod(path0, mode0) -} - -//export go_hostChown -func go_hostChown(path0 *c_char, uid0 c_fuse_uid_t, gid0 c_fuse_gid_t) (errc0 c_int) { - return hostChown(path0, uid0, gid0) -} - -//export go_hostTruncate -func go_hostTruncate(path0 *c_char, size0 c_fuse_off_t) (errc0 c_int) { - return hostTruncate(path0, size0) -} - -//export go_hostOpen -func go_hostOpen(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostOpen(path0, fi0) -} - -//export go_hostRead -func go_hostRead(path0 *c_char, buff0 *c_char, size0 c_size_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (nbyt0 c_int) { - return hostRead(path0, buff0, size0, ofst0, fi0) -} - -//export go_hostWrite -func go_hostWrite(path0 *c_char, buff0 *c_char, size0 c_size_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (nbyt0 c_int) { - return hostWrite(path0, buff0, size0, ofst0, fi0) -} - -//export go_hostStatfs -func go_hostStatfs(path0 *c_char, stat0 *c_fuse_statvfs_t) (errc0 c_int) { - return hostStatfs(path0, stat0) -} - -//export go_hostFlush -func go_hostFlush(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostFlush(path0, fi0) -} - -//export go_hostRelease -func go_hostRelease(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostRelease(path0, fi0) -} - -//export go_hostFsync -func go_hostFsync(path0 *c_char, datasync c_int, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostFsync(path0, datasync, fi0) -} - -//export go_hostSetxattr -func go_hostSetxattr(path0 *c_char, name0 *c_char, buff0 *c_char, size0 c_size_t, - flags c_int) (errc0 c_int) { - return hostSetxattr(path0, name0, buff0, size0, flags) -} - -//export go_hostGetxattr -func go_hostGetxattr(path0 *c_char, name0 *c_char, buff0 *c_char, size0 c_size_t) (nbyt0 c_int) { - return hostGetxattr(path0, name0, buff0, size0) -} - -//export go_hostListxattr -func go_hostListxattr(path0 *c_char, buff0 *c_char, size0 c_size_t) (nbyt0 c_int) { - return hostListxattr(path0, buff0, size0) -} - -//export go_hostRemovexattr -func go_hostRemovexattr(path0 *c_char, name0 *c_char) (errc0 c_int) { - return hostRemovexattr(path0, name0) -} - -//export go_hostOpendir -func go_hostOpendir(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostOpendir(path0, fi0) -} - -//export go_hostReaddir -func go_hostReaddir(path0 *c_char, - buff0 unsafe.Pointer, fill0 c_fuse_fill_dir_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostReaddir(path0, buff0, fill0, ofst0, fi0) -} - -//export go_hostReleasedir -func go_hostReleasedir(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostReleasedir(path0, fi0) -} - -//export go_hostFsyncdir -func go_hostFsyncdir(path0 *c_char, datasync c_int, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostFsyncdir(path0, datasync, fi0) -} - -//export go_hostInit -func go_hostInit(conn0 *c_struct_fuse_conn_info) (user_data unsafe.Pointer) { - return hostInit(conn0) -} - -//export go_hostDestroy -func go_hostDestroy(user_data unsafe.Pointer) { - hostDestroy(user_data) -} - -//export go_hostAccess -func go_hostAccess(path0 *c_char, mask0 c_int) (errc0 c_int) { - return hostAccess(path0, mask0) -} - -//export go_hostCreate -func go_hostCreate(path0 *c_char, mode0 c_fuse_mode_t, fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostCreate(path0, mode0, fi0) -} - -//export go_hostFtruncate -func go_hostFtruncate(path0 *c_char, size0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostFtruncate(path0, size0, fi0) -} - -//export go_hostFgetattr -func go_hostFgetattr(path0 *c_char, stat0 *c_fuse_stat_t, - fi0 *c_struct_fuse_file_info) (errc0 c_int) { - return hostFgetattr(path0, stat0, fi0) -} - -//export go_hostUtimens -func go_hostUtimens(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 c_int) { - return hostUtimens(path0, tmsp0) -} - -//export go_hostSetchgtime -func go_hostSetchgtime(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 c_int) { - return hostSetchgtime(path0, tmsp0) -} - -//export go_hostSetcrtime -func go_hostSetcrtime(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 c_int) { - return hostSetcrtime(path0, tmsp0) -} - -//export go_hostChflags -func go_hostChflags(path0 *c_char, flags c_uint32_t) (errc0 c_int) { - return hostChflags(path0, flags) -} diff --git a/vendor/github.com/billziss-gh/cgofuse/fuse/host_nocgo_windows.go b/vendor/github.com/billziss-gh/cgofuse/fuse/host_nocgo_windows.go deleted file mode 100644 index df3d14dd1..000000000 --- a/vendor/github.com/billziss-gh/cgofuse/fuse/host_nocgo_windows.go +++ /dev/null @@ -1,1000 +0,0 @@ -// +build !cgo,windows - -/* - * host_nocgo_windows.go - * - * Copyright 2017-2018 Bill Zissimopoulos - */ -/* - * This file is part of Cgofuse. - * - * It is licensed under the MIT license. The full license text can be found - * in the License.txt file at the root of this project. - */ - -package fuse - -import ( - "path/filepath" - "sync" - "syscall" - "unsafe" -) - -type align64 uint32 // align to 64-bits (necessary when compiling for 32bit; see golang/go#599) - -type fuse_operations struct { - getattr uintptr - getdir uintptr - readlink uintptr - mknod uintptr - mkdir uintptr - unlink uintptr - rmdir uintptr - symlink uintptr - rename uintptr - link uintptr - chmod uintptr - chown uintptr - truncate uintptr - utime uintptr - open uintptr - read uintptr - write uintptr - statfs uintptr - flush uintptr - release uintptr - fsync uintptr - setxattr uintptr - getxattr uintptr - listxattr uintptr - removexattr uintptr - opendir uintptr - readdir uintptr - releasedir uintptr - fsyncdir uintptr - init uintptr - destroy uintptr - access uintptr - create uintptr - ftruncate uintptr - fgetattr uintptr - lock uintptr - utimens uintptr - bmap uintptr - flags uint32 - ioctl uintptr - poll uintptr - write_buf uintptr - read_buf uintptr - flock uintptr - fallocate uintptr - reserved00 uintptr - reserved01 uintptr - reserved02 uintptr - statfs_x uintptr - setvolname uintptr - exchange uintptr - getxtimes uintptr - setbkuptime uintptr - setchgtime uintptr - setcrtime uintptr - chflags uintptr - setattr_x uintptr - fsetattr_x uintptr -} - -type fuse_stat_t struct { - st_dev c_fuse_dev_t - _ align64 - st_ino c_fuse_ino_t - st_mode c_fuse_mode_t - st_nlink c_fuse_nlink_t - st_uid c_fuse_uid_t - st_gid c_fuse_gid_t - st_rdev c_fuse_dev_t - _ align64 - st_size c_fuse_off_t - st_atim c_fuse_timespec_t - st_mtim c_fuse_timespec_t - st_ctim c_fuse_timespec_t - st_blksize c_fuse_blksize_t - _ align64 - st_blocks c_fuse_blkcnt_t - st_birthtim c_fuse_timespec_t -} - -type fuse_stat_ex_t struct { - fuse_stat_t - st_flags c_uint32_t - st_reserved32 [3]c_uint32_t - st_reserved64 [2]c_uint64_t -} - -type fuse_statvfs_t struct { - f_bsize uintptr - f_frsize uintptr - f_blocks c_fuse_fsblkcnt_t - f_bfree c_fuse_fsblkcnt_t - f_bavail c_fuse_fsblkcnt_t - f_files c_fuse_fsfilcnt_t - f_ffree c_fuse_fsfilcnt_t - f_favail c_fuse_fsfilcnt_t - f_fsid uintptr - f_flag uintptr - f_namemax uintptr -} - -type fuse_timespec_t struct { - tv_sec uintptr - tv_nsec uintptr -} - -type struct_fuse struct { - _ struct{} -} - -type struct_fuse_args struct { - argc c_int - argv **c_char - allocated c_int -} - -type struct_fuse_conn_info struct { - proto_major c_unsigned - proto_minor c_unsigned - async_read c_unsigned - max_write c_unsigned - max_readahead c_unsigned - capable c_unsigned - want c_unsigned - reserved [25]c_unsigned -} - -type struct_fuse_context struct { - fuse *c_struct_fuse - uid c_fuse_uid_t - gid c_fuse_gid_t - pid c_fuse_pid_t - private_data unsafe.Pointer - umask c_fuse_mode_t -} - -type struct_fuse_file_info struct { - flags c_int - fh_old c_unsigned - writepage c_int - bits c_uint32_t - fh c_uint64_t - lock_owner c_uint64_t -} - -type struct_fuse_opt struct { - templ *c_char - offset c_fuse_opt_offset_t - value c_int -} - -type ( - c_bool = bool - c_char = byte - c_fuse_blkcnt_t = int64 - c_fuse_blksize_t = int32 - c_fuse_dev_t = uint32 - c_fuse_fill_dir_t = uintptr - c_fuse_fsblkcnt_t = uintptr - c_fuse_fsfilcnt_t = uintptr - c_fuse_gid_t = uint32 - c_fuse_ino_t = uint64 - c_fuse_mode_t = uint32 - c_fuse_nlink_t = uint16 - c_fuse_off_t = int64 - c_fuse_opt_offset_t = uint32 - c_fuse_pid_t = int32 - c_fuse_stat_t = fuse_stat_t - c_fuse_stat_ex_t = fuse_stat_ex_t - c_fuse_statvfs_t = fuse_statvfs_t - c_fuse_timespec_t = fuse_timespec_t - c_fuse_uid_t = uint32 - c_int = int32 - c_int16_t = int16 - c_int32_t = int32 - c_int64_t = int64 - c_int8_t = int8 - c_size_t = uintptr - c_struct_fuse = struct_fuse - c_struct_fuse_args = struct_fuse_args - c_struct_fuse_conn_info = struct_fuse_conn_info - c_struct_fuse_context = struct_fuse_context - c_struct_fuse_file_info = struct_fuse_file_info - c_struct_fuse_opt = struct_fuse_opt - c_uint16_t = uint16 - c_uint32_t = uint32 - c_uint64_t = uint64 - c_uint8_t = uint8 - c_uintptr_t = uintptr - c_unsigned = uint32 -) - -var ( - kernel32 = syscall.MustLoadDLL("kernel32.dll") - getProcessHeap = kernel32.MustFindProc("GetProcessHeap") - heapAlloc = kernel32.MustFindProc("HeapAlloc") - heapFree = kernel32.MustFindProc("HeapFree") - processHeap uintptr - - /* - * It appears safe to call cdecl functions from Go. Is it really? - * https://codereview.appspot.com/4961045/ - */ - fuseOnce sync.Once - fuseDll *syscall.DLL - fuse_version *syscall.Proc - fuse_mount *syscall.Proc - fuse_unmount *syscall.Proc - fuse_parse_cmdline *syscall.Proc - fuse_main_real *syscall.Proc - fuse_is_lib_option *syscall.Proc - fuse_new *syscall.Proc - fuse_destroy *syscall.Proc - fuse_loop *syscall.Proc - fuse_loop_mt *syscall.Proc - fuse_exit *syscall.Proc - fuse_get_context *syscall.Proc - fuse_opt_parse *syscall.Proc - fuse_opt_add_arg *syscall.Proc - fuse_opt_insert_arg *syscall.Proc - fuse_opt_free_args *syscall.Proc - fuse_opt_add_opt *syscall.Proc - fuse_opt_add_opt_escaped *syscall.Proc - fuse_opt_match *syscall.Proc - - hostOptParseOptProc = syscall.NewCallbackCDecl(c_hostOptParseOptProc) - - cgofuse_stat_ex bool -) - -const ( - FSP_FUSE_CAP_CASE_INSENSITIVE = 1 << 29 - FSP_FUSE_CAP_READDIR_PLUS = 1 << 21 - FSP_FUSE_CAP_STAT_EX = 1 << 23 - - FUSE_OPT_KEY_NONOPT = -2 -) - -func init() { - processHeap, _, _ = getProcessHeap.Call() -} - -func c_GoString(s *c_char) string { - if nil == s { - return "" - } - q := (*[1 << 30]c_char)(unsafe.Pointer(s)) - l := 0 - for 0 != q[l] { - l++ - } - return string(q[:l]) -} -func c_CString(s string) *c_char { - p := c_malloc(c_size_t(len(s) + 1)) - q := (*[1 << 30]c_char)(p) - copy(q[:], s) - q[len(s)] = 0 - return (*c_char)(p) -} - -func c_malloc(size c_size_t) unsafe.Pointer { - p, _, _ := heapAlloc.Call(processHeap, 0, size) - if 0 == p { - panic("runtime: C malloc failed") - } - return unsafe.Pointer(p) -} -func c_calloc(count c_size_t, size c_size_t) unsafe.Pointer { - p, _, _ := heapAlloc.Call(processHeap, 8 /*HEAP_ZERO_MEMORY*/, count*size) - return unsafe.Pointer(p) -} -func c_free(p unsafe.Pointer) { - if nil != p { - heapFree.Call(processHeap, 0, uintptr(p)) - } -} - -func c_fuse_get_context() *c_struct_fuse_context { - p, _, _ := fuse_get_context.Call() - return (*c_struct_fuse_context)(unsafe.Pointer(p)) -} -func c_fuse_opt_free_args(args *c_struct_fuse_args) { - fuse_opt_free_args.Call(uintptr(unsafe.Pointer(args))) -} - -func c_hostAsgnCconninfo(conn *c_struct_fuse_conn_info, - capCaseInsensitive c_bool, - capReaddirPlus c_bool) { - conn.want |= conn.capable & FSP_FUSE_CAP_STAT_EX - cgofuse_stat_ex = 0 != conn.want&FSP_FUSE_CAP_STAT_EX // hack! - if capCaseInsensitive { - conn.want |= conn.capable & FSP_FUSE_CAP_CASE_INSENSITIVE - } - if capReaddirPlus { - conn.want |= conn.capable & FSP_FUSE_CAP_READDIR_PLUS - } -} -func c_hostCstatvfsFromFusestatfs(stbuf *c_fuse_statvfs_t, - bsize c_uint64_t, - frsize c_uint64_t, - blocks c_uint64_t, - bfree c_uint64_t, - bavail c_uint64_t, - files c_uint64_t, - ffree c_uint64_t, - favail c_uint64_t, - fsid c_uint64_t, - flag c_uint64_t, - namemax c_uint64_t) { - *stbuf = c_fuse_statvfs_t{ - f_bsize: uintptr(bsize), - f_frsize: uintptr(frsize), - f_blocks: c_fuse_fsblkcnt_t(blocks), - f_bfree: c_fuse_fsblkcnt_t(bfree), - f_bavail: c_fuse_fsblkcnt_t(bavail), - f_files: c_fuse_fsfilcnt_t(files), - f_ffree: c_fuse_fsfilcnt_t(ffree), - f_favail: c_fuse_fsfilcnt_t(favail), - f_fsid: uintptr(fsid), - f_flag: uintptr(flag), - f_namemax: uintptr(namemax), - } -} -func c_hostCstatFromFusestat(stbuf *c_fuse_stat_t, - dev c_uint64_t, - ino c_uint64_t, - mode c_uint32_t, - nlink c_uint32_t, - uid c_uint32_t, - gid c_uint32_t, - rdev c_uint64_t, - size c_int64_t, - atimSec c_int64_t, atimNsec c_int64_t, - mtimSec c_int64_t, mtimNsec c_int64_t, - ctimSec c_int64_t, ctimNsec c_int64_t, - blksize c_int64_t, - blocks c_int64_t, - birthtimSec c_int64_t, birthtimNsec c_int64_t, - flags c_uint32_t) { - if !cgofuse_stat_ex { - *stbuf = c_fuse_stat_t{ - st_dev: c_fuse_dev_t(dev), - st_ino: c_fuse_ino_t(ino), - st_mode: c_fuse_mode_t(mode), - st_nlink: c_fuse_nlink_t(nlink), - st_uid: c_fuse_uid_t(uid), - st_gid: c_fuse_gid_t(gid), - st_rdev: c_fuse_dev_t(rdev), - st_size: c_fuse_off_t(size), - st_blksize: c_fuse_blksize_t(blksize), - st_blocks: c_fuse_blkcnt_t(blocks), - st_atim: c_fuse_timespec_t{ - tv_sec: uintptr(atimSec), - tv_nsec: uintptr(atimNsec), - }, - st_mtim: c_fuse_timespec_t{ - tv_sec: uintptr(mtimSec), - tv_nsec: uintptr(mtimNsec), - }, - st_ctim: c_fuse_timespec_t{ - tv_sec: uintptr(ctimSec), - tv_nsec: uintptr(ctimNsec), - }, - } - } else { - *(*fuse_stat_ex_t)(unsafe.Pointer(stbuf)) = fuse_stat_ex_t{ - fuse_stat_t: c_fuse_stat_t{ - st_dev: c_fuse_dev_t(dev), - st_ino: c_fuse_ino_t(ino), - st_mode: c_fuse_mode_t(mode), - st_nlink: c_fuse_nlink_t(nlink), - st_uid: c_fuse_uid_t(uid), - st_gid: c_fuse_gid_t(gid), - st_rdev: c_fuse_dev_t(rdev), - st_size: c_fuse_off_t(size), - st_blksize: c_fuse_blksize_t(blksize), - st_blocks: c_fuse_blkcnt_t(blocks), - st_atim: c_fuse_timespec_t{ - tv_sec: uintptr(atimSec), - tv_nsec: uintptr(atimNsec), - }, - st_mtim: c_fuse_timespec_t{ - tv_sec: uintptr(mtimSec), - tv_nsec: uintptr(mtimNsec), - }, - st_ctim: c_fuse_timespec_t{ - tv_sec: uintptr(ctimSec), - tv_nsec: uintptr(ctimNsec), - }, - }, - st_flags: flags, - } - } - if 0 != birthtimSec { - stbuf.st_birthtim.tv_sec = uintptr(birthtimSec) - stbuf.st_birthtim.tv_nsec = uintptr(birthtimNsec) - } else { - stbuf.st_birthtim.tv_sec = uintptr(ctimSec) - stbuf.st_birthtim.tv_nsec = uintptr(ctimNsec) - } -} -func c_hostAsgnCfileinfo(fi *c_struct_fuse_file_info, - direct_io c_bool, - keep_cache c_bool, - nonseekable c_bool, - fh c_uint64_t) { - if direct_io { - fi.bits |= 1 - } - if keep_cache { - fi.bits |= 2 - } - if nonseekable { - fi.bits |= 8 - } - fi.fh = fh -} -func c_hostFilldir(filler c_fuse_fill_dir_t, - buf unsafe.Pointer, name *c_char, stbuf *c_fuse_stat_t, off c_fuse_off_t) c_int { - var r uintptr - if uint64(0xffffffff) < uint64(^uintptr(0)) { - r, _, _ = syscall.Syscall6(filler, 4, - uintptr(buf), - uintptr(unsafe.Pointer(name)), - uintptr(unsafe.Pointer(stbuf)), - uintptr(off), - 0, - 0) - } else { - r, _, _ = syscall.Syscall6(filler, 5, - uintptr(buf), - uintptr(unsafe.Pointer(name)), - uintptr(unsafe.Pointer(stbuf)), - uintptr(off), - uintptr(off>>32), - 0) - } - return c_int(r) -} -func c_hostStaticInit() { -} -func c_hostFuseInit() c_int { - fuseOnce.Do(func() { - fuseDll, _ = fspload() - if nil != fuseDll { - fuse_version = fuseDll.MustFindProc("fuse_version") - fuse_mount = fuseDll.MustFindProc("fuse_mount") - fuse_unmount = fuseDll.MustFindProc("fuse_unmount") - fuse_parse_cmdline = fuseDll.MustFindProc("fuse_parse_cmdline") - fuse_main_real = fuseDll.MustFindProc("fuse_main_real") - fuse_is_lib_option = fuseDll.MustFindProc("fuse_is_lib_option") - fuse_new = fuseDll.MustFindProc("fuse_new") - fuse_destroy = fuseDll.MustFindProc("fuse_destroy") - fuse_loop = fuseDll.MustFindProc("fuse_loop") - fuse_loop_mt = fuseDll.MustFindProc("fuse_loop_mt") - fuse_exit = fuseDll.MustFindProc("fuse_exit") - fuse_get_context = fuseDll.MustFindProc("fuse_get_context") - fuse_opt_parse = fuseDll.MustFindProc("fuse_opt_parse") - fuse_opt_add_arg = fuseDll.MustFindProc("fuse_opt_add_arg") - fuse_opt_insert_arg = fuseDll.MustFindProc("fuse_opt_insert_arg") - fuse_opt_free_args = fuseDll.MustFindProc("fuse_opt_free_args") - fuse_opt_add_opt = fuseDll.MustFindProc("fuse_opt_add_opt") - fuse_opt_add_opt_escaped = fuseDll.MustFindProc("fuse_opt_add_opt_escaped") - fuse_opt_match = fuseDll.MustFindProc("fuse_opt_match") - } - }) - if nil == fuseDll { - return 0 - } - return 1 -} -func c_hostMount(argc c_int, argv **c_char, data unsafe.Pointer) c_int { - r, _, _ := fuse_main_real.Call( - uintptr(argc), - uintptr(unsafe.Pointer(argv)), - uintptr(unsafe.Pointer(&fsop)), - unsafe.Sizeof(fsop), - uintptr(data)) - if 0 == r { - return 1 - } - return 0 -} -func c_hostUnmount(fuse *c_struct_fuse, mountpoint *c_char) c_int { - fuse_exit.Call(uintptr(unsafe.Pointer(fuse))) - return 1 -} -func c_hostOptSet(opt *c_struct_fuse_opt, - templ *c_char, offset c_fuse_opt_offset_t, value c_int) { - *opt = c_struct_fuse_opt{ - templ: templ, - offset: offset, - value: value, - } -} -func c_hostOptParseOptProc(opt_data uintptr, arg uintptr, key uintptr, outargs uintptr) uintptr { - switch c_int(key) { - default: - return 0 - case FUSE_OPT_KEY_NONOPT: - return 1 - } -} -func c_hostOptParse(args *c_struct_fuse_args, data unsafe.Pointer, opts *c_struct_fuse_opt, - nonopts c_bool) c_int { - var callback uintptr - if nonopts { - callback = hostOptParseOptProc - } - r, _, _ := fuse_opt_parse.Call( - uintptr(unsafe.Pointer(args)), - uintptr(data), - uintptr(unsafe.Pointer(opts)), - callback) - return c_int(r) -} - -func fspload() (dll *syscall.DLL, err error) { - dllname := "" - if uint64(0xffffffff) < uint64(^uintptr(0)) { - dllname = "winfsp-x64.dll" - } else { - dllname = "winfsp-x86.dll" - } - - dll, err = syscall.LoadDLL(dllname) - if nil == dll { - var pathbuf [syscall.MAX_PATH]uint16 - var regkey syscall.Handle - var regtype, size uint32 - - kname, _ := syscall.UTF16PtrFromString("Software\\WinFsp") - err = syscall.RegOpenKeyEx(syscall.HKEY_LOCAL_MACHINE, kname, - 0, syscall.KEY_READ|syscall.KEY_WOW64_32KEY, ®key) - if nil != err { - err = syscall.ERROR_MOD_NOT_FOUND - return - } - - vname, _ := syscall.UTF16PtrFromString("InstallDir") - size = uint32(len(pathbuf) * 2) - err = syscall.RegQueryValueEx(regkey, vname, - nil, ®type, (*byte)(unsafe.Pointer(&pathbuf)), &size) - syscall.RegCloseKey(regkey) - if nil != err || syscall.REG_SZ != regtype { - err = syscall.ERROR_MOD_NOT_FOUND - return - } - - if 0 < size && 0 == pathbuf[size/2-1] { - size -= 2 - } - - path := syscall.UTF16ToString(pathbuf[:size/2]) - dllpath := filepath.Join(path, "bin", dllname) - - dll, err = syscall.LoadDLL(dllpath) - if nil != err { - err = syscall.ERROR_MOD_NOT_FOUND - return - } - } - - return -} - -var fsop fuse_operations - -func init() { - const intSize = 32 + int(^uintptr(0)>>63<<5) - if uint64(0xffffffff) < uint64(^uintptr(0)) { - fsop = fuse_operations{ - getattr: syscall.NewCallbackCDecl(go_hostGetattr64), - readlink: syscall.NewCallbackCDecl(go_hostReadlink64), - mknod: syscall.NewCallbackCDecl(go_hostMknod64), - mkdir: syscall.NewCallbackCDecl(go_hostMkdir64), - unlink: syscall.NewCallbackCDecl(go_hostUnlink64), - rmdir: syscall.NewCallbackCDecl(go_hostRmdir64), - symlink: syscall.NewCallbackCDecl(go_hostSymlink64), - rename: syscall.NewCallbackCDecl(go_hostRename64), - link: syscall.NewCallbackCDecl(go_hostLink64), - chmod: syscall.NewCallbackCDecl(go_hostChmod64), - chown: syscall.NewCallbackCDecl(go_hostChown64), - truncate: syscall.NewCallbackCDecl(go_hostTruncate64), - open: syscall.NewCallbackCDecl(go_hostOpen64), - read: syscall.NewCallbackCDecl(go_hostRead64), - write: syscall.NewCallbackCDecl(go_hostWrite64), - statfs: syscall.NewCallbackCDecl(go_hostStatfs64), - flush: syscall.NewCallbackCDecl(go_hostFlush64), - release: syscall.NewCallbackCDecl(go_hostRelease64), - fsync: syscall.NewCallbackCDecl(go_hostFsync64), - setxattr: syscall.NewCallbackCDecl(go_hostSetxattr64), - getxattr: syscall.NewCallbackCDecl(go_hostGetxattr64), - listxattr: syscall.NewCallbackCDecl(go_hostListxattr64), - removexattr: syscall.NewCallbackCDecl(go_hostRemovexattr64), - opendir: syscall.NewCallbackCDecl(go_hostOpendir64), - readdir: syscall.NewCallbackCDecl(go_hostReaddir64), - releasedir: syscall.NewCallbackCDecl(go_hostReleasedir64), - fsyncdir: syscall.NewCallbackCDecl(go_hostFsyncdir64), - init: syscall.NewCallbackCDecl(go_hostInit64), - destroy: syscall.NewCallbackCDecl(go_hostDestroy64), - access: syscall.NewCallbackCDecl(go_hostAccess64), - create: syscall.NewCallbackCDecl(go_hostCreate64), - ftruncate: syscall.NewCallbackCDecl(go_hostFtruncate64), - fgetattr: syscall.NewCallbackCDecl(go_hostFgetattr64), - utimens: syscall.NewCallbackCDecl(go_hostUtimens64), - setchgtime: syscall.NewCallbackCDecl(go_hostSetchgtime64), - setcrtime: syscall.NewCallbackCDecl(go_hostSetcrtime64), - chflags: syscall.NewCallbackCDecl(go_hostChflags64), - } - } else { - fsop = fuse_operations{ - getattr: syscall.NewCallbackCDecl(go_hostGetattr32), - readlink: syscall.NewCallbackCDecl(go_hostReadlink32), - mknod: syscall.NewCallbackCDecl(go_hostMknod32), - mkdir: syscall.NewCallbackCDecl(go_hostMkdir32), - unlink: syscall.NewCallbackCDecl(go_hostUnlink32), - rmdir: syscall.NewCallbackCDecl(go_hostRmdir32), - symlink: syscall.NewCallbackCDecl(go_hostSymlink32), - rename: syscall.NewCallbackCDecl(go_hostRename32), - link: syscall.NewCallbackCDecl(go_hostLink32), - chmod: syscall.NewCallbackCDecl(go_hostChmod32), - chown: syscall.NewCallbackCDecl(go_hostChown32), - truncate: syscall.NewCallbackCDecl(go_hostTruncate32), - open: syscall.NewCallbackCDecl(go_hostOpen32), - read: syscall.NewCallbackCDecl(go_hostRead32), - write: syscall.NewCallbackCDecl(go_hostWrite32), - statfs: syscall.NewCallbackCDecl(go_hostStatfs32), - flush: syscall.NewCallbackCDecl(go_hostFlush32), - release: syscall.NewCallbackCDecl(go_hostRelease32), - fsync: syscall.NewCallbackCDecl(go_hostFsync32), - setxattr: syscall.NewCallbackCDecl(go_hostSetxattr32), - getxattr: syscall.NewCallbackCDecl(go_hostGetxattr32), - listxattr: syscall.NewCallbackCDecl(go_hostListxattr32), - removexattr: syscall.NewCallbackCDecl(go_hostRemovexattr32), - opendir: syscall.NewCallbackCDecl(go_hostOpendir32), - readdir: syscall.NewCallbackCDecl(go_hostReaddir32), - releasedir: syscall.NewCallbackCDecl(go_hostReleasedir32), - fsyncdir: syscall.NewCallbackCDecl(go_hostFsyncdir32), - init: syscall.NewCallbackCDecl(go_hostInit32), - destroy: syscall.NewCallbackCDecl(go_hostDestroy32), - access: syscall.NewCallbackCDecl(go_hostAccess32), - create: syscall.NewCallbackCDecl(go_hostCreate32), - ftruncate: syscall.NewCallbackCDecl(go_hostFtruncate32), - fgetattr: syscall.NewCallbackCDecl(go_hostFgetattr32), - utimens: syscall.NewCallbackCDecl(go_hostUtimens32), - setchgtime: syscall.NewCallbackCDecl(go_hostSetchgtime32), - setcrtime: syscall.NewCallbackCDecl(go_hostSetcrtime32), - chflags: syscall.NewCallbackCDecl(go_hostChflags32), - } - } -} - -// 64-bit - -func go_hostGetattr64(path0 *c_char, stat0 *c_fuse_stat_t) (errc0 uintptr) { - return uintptr(int(hostGetattr(path0, stat0))) -} - -func go_hostReadlink64(path0 *c_char, buff0 *c_char, size0 uintptr) (errc0 uintptr) { - return uintptr(int(hostReadlink(path0, buff0, c_size_t(size0)))) -} - -func go_hostMknod64(path0 *c_char, mode0 uintptr, dev0 uintptr) (errc0 uintptr) { - return uintptr(int(hostMknod(path0, c_fuse_mode_t(mode0), c_fuse_dev_t(dev0)))) -} - -func go_hostMkdir64(path0 *c_char, mode0 uintptr) (errc0 uintptr) { - return uintptr(int(hostMkdir(path0, c_fuse_mode_t(mode0)))) -} - -func go_hostUnlink64(path0 *c_char) (errc0 uintptr) { - return uintptr(int(hostUnlink(path0))) -} - -func go_hostRmdir64(path0 *c_char) (errc0 uintptr) { - return uintptr(int(hostRmdir(path0))) -} - -func go_hostSymlink64(target0 *c_char, newpath0 *c_char) (errc0 uintptr) { - return uintptr(int(hostSymlink(target0, newpath0))) -} - -func go_hostRename64(oldpath0 *c_char, newpath0 *c_char) (errc0 uintptr) { - return uintptr(int(hostRename(oldpath0, newpath0))) -} - -func go_hostLink64(oldpath0 *c_char, newpath0 *c_char) (errc0 uintptr) { - return uintptr(int(hostLink(oldpath0, newpath0))) -} - -func go_hostChmod64(path0 *c_char, mode0 uintptr) (errc0 uintptr) { - return uintptr(int(hostChmod(path0, c_fuse_mode_t(mode0)))) -} - -func go_hostChown64(path0 *c_char, uid0 uintptr, gid0 uintptr) (errc0 uintptr) { - return uintptr(int(hostChown(path0, c_fuse_uid_t(uid0), c_fuse_gid_t(gid0)))) -} - -func go_hostTruncate64(path0 *c_char, size0 uintptr) (errc0 uintptr) { - return uintptr(int(hostTruncate(path0, c_fuse_off_t(size0)))) -} - -func go_hostOpen64(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostOpen(path0, fi0))) -} - -func go_hostRead64(path0 *c_char, buff0 *c_char, size0 uintptr, ofst0 uintptr, - fi0 *c_struct_fuse_file_info) (nbyt0 uintptr) { - return uintptr(int(hostRead(path0, buff0, c_size_t(size0), c_fuse_off_t(ofst0), fi0))) -} - -func go_hostWrite64(path0 *c_char, buff0 *c_char, size0 c_size_t, ofst0 c_fuse_off_t, - fi0 *c_struct_fuse_file_info) (nbyt0 uintptr) { - return uintptr(int(hostWrite(path0, buff0, c_size_t(size0), c_fuse_off_t(ofst0), fi0))) -} - -func go_hostStatfs64(path0 *c_char, stat0 *c_fuse_statvfs_t) (errc0 uintptr) { - return uintptr(int(hostStatfs(path0, stat0))) -} - -func go_hostFlush64(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFlush(path0, fi0))) -} - -func go_hostRelease64(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostRelease(path0, fi0))) -} - -func go_hostFsync64(path0 *c_char, datasync c_int, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFsync(path0, c_int(datasync), fi0))) -} - -func go_hostSetxattr64(path0 *c_char, name0 *c_char, buff0 *c_char, size0 uintptr, - flags uintptr) (errc0 uintptr) { - return uintptr(int(hostSetxattr(path0, name0, buff0, c_size_t(size0), c_int(flags)))) -} - -func go_hostGetxattr64(path0 *c_char, name0 *c_char, buff0 *c_char, size0 uintptr) (nbyt0 uintptr) { - return uintptr(int(hostGetxattr(path0, name0, buff0, c_size_t(size0)))) -} - -func go_hostListxattr64(path0 *c_char, buff0 *c_char, size0 uintptr) (nbyt0 uintptr) { - return uintptr(int(hostListxattr(path0, buff0, c_size_t(size0)))) -} - -func go_hostRemovexattr64(path0 *c_char, name0 *c_char) (errc0 uintptr) { - return uintptr(int(hostRemovexattr(path0, name0))) -} - -func go_hostOpendir64(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostOpendir(path0, fi0))) -} - -func go_hostReaddir64(path0 *c_char, - buff0 unsafe.Pointer, fill0 c_fuse_fill_dir_t, ofst0 uintptr, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostReaddir(path0, buff0, fill0, c_fuse_off_t(ofst0), fi0))) -} - -func go_hostReleasedir64(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostReleasedir(path0, fi0))) -} - -func go_hostFsyncdir64(path0 *c_char, datasync uintptr, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFsyncdir(path0, c_int(datasync), fi0))) -} - -func go_hostInit64(conn0 *c_struct_fuse_conn_info) (user_data unsafe.Pointer) { - return hostInit(conn0) -} - -func go_hostDestroy64(user_data unsafe.Pointer) uintptr { - hostDestroy(user_data) - return 0 -} - -func go_hostAccess64(path0 *c_char, mask0 uintptr) (errc0 uintptr) { - return uintptr(int(hostAccess(path0, c_int(mask0)))) -} - -func go_hostCreate64(path0 *c_char, mode0 uintptr, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostCreate(path0, c_fuse_mode_t(mode0), fi0))) -} - -func go_hostFtruncate64(path0 *c_char, size0 uintptr, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFtruncate(path0, c_fuse_off_t(size0), fi0))) -} - -func go_hostFgetattr64(path0 *c_char, stat0 *c_fuse_stat_t, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFgetattr(path0, stat0, fi0))) -} - -func go_hostUtimens64(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 uintptr) { - return uintptr(int(hostUtimens(path0, tmsp0))) -} - -func go_hostSetchgtime64(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 uintptr) { - return uintptr(int(hostSetchgtime(path0, tmsp0))) -} - -func go_hostSetcrtime64(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 uintptr) { - return uintptr(int(hostSetcrtime(path0, tmsp0))) -} - -func go_hostChflags64(path0 *c_char, flags c_uint32_t) (errc0 uintptr) { - return uintptr(int(hostChflags(path0, flags))) -} - -// 32-bit - -func go_hostGetattr32(path0 *c_char, stat0 *c_fuse_stat_t) (errc0 uintptr) { - return uintptr(int(hostGetattr(path0, stat0))) -} - -func go_hostReadlink32(path0 *c_char, buff0 *c_char, size0 uintptr) (errc0 uintptr) { - return uintptr(int(hostReadlink(path0, buff0, c_size_t(size0)))) -} - -func go_hostMknod32(path0 *c_char, mode0 uintptr, dev0 uintptr) (errc0 uintptr) { - return uintptr(int(hostMknod(path0, c_fuse_mode_t(mode0), c_fuse_dev_t(dev0)))) -} - -func go_hostMkdir32(path0 *c_char, mode0 uintptr) (errc0 uintptr) { - return uintptr(int(hostMkdir(path0, c_fuse_mode_t(mode0)))) -} - -func go_hostUnlink32(path0 *c_char) (errc0 uintptr) { - return uintptr(int(hostUnlink(path0))) -} - -func go_hostRmdir32(path0 *c_char) (errc0 uintptr) { - return uintptr(int(hostRmdir(path0))) -} - -func go_hostSymlink32(target0 *c_char, newpath0 *c_char) (errc0 uintptr) { - return uintptr(int(hostSymlink(target0, newpath0))) -} - -func go_hostRename32(oldpath0 *c_char, newpath0 *c_char) (errc0 uintptr) { - return uintptr(int(hostRename(oldpath0, newpath0))) -} - -func go_hostLink32(oldpath0 *c_char, newpath0 *c_char) (errc0 uintptr) { - return uintptr(int(hostLink(oldpath0, newpath0))) -} - -func go_hostChmod32(path0 *c_char, mode0 uintptr) (errc0 uintptr) { - return uintptr(int(hostChmod(path0, c_fuse_mode_t(mode0)))) -} - -func go_hostChown32(path0 *c_char, uid0 uintptr, gid0 uintptr) (errc0 uintptr) { - return uintptr(int(hostChown(path0, c_fuse_uid_t(uid0), c_fuse_gid_t(gid0)))) -} - -func go_hostTruncate32(path0 *c_char, lsize0, hsize0 uintptr) (errc0 uintptr) { - return uintptr(int(hostTruncate(path0, (c_fuse_off_t(hsize0)<<32)|c_fuse_off_t(lsize0)))) -} - -func go_hostOpen32(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostOpen(path0, fi0))) -} - -func go_hostRead32(path0 *c_char, buff0 *c_char, size0 uintptr, lofst0, hofst0 uintptr, - fi0 *c_struct_fuse_file_info) (nbyt0 uintptr) { - return uintptr(int(hostRead(path0, - buff0, c_size_t(size0), (c_fuse_off_t(hofst0)<<32)|c_fuse_off_t(lofst0), fi0))) -} - -func go_hostWrite32(path0 *c_char, buff0 *c_char, size0 c_size_t, lofst0, hofst0 uintptr, - fi0 *c_struct_fuse_file_info) (nbyt0 uintptr) { - return uintptr(int(hostWrite(path0, - buff0, c_size_t(size0), (c_fuse_off_t(hofst0)<<32)|c_fuse_off_t(lofst0), fi0))) -} - -func go_hostStatfs32(path0 *c_char, stat0 *c_fuse_statvfs_t) (errc0 uintptr) { - return uintptr(int(hostStatfs(path0, stat0))) -} - -func go_hostFlush32(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFlush(path0, fi0))) -} - -func go_hostRelease32(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostRelease(path0, fi0))) -} - -func go_hostFsync32(path0 *c_char, datasync c_int, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFsync(path0, c_int(datasync), fi0))) -} - -func go_hostSetxattr32(path0 *c_char, name0 *c_char, buff0 *c_char, size0 uintptr, - flags uintptr) (errc0 uintptr) { - return uintptr(int(hostSetxattr(path0, name0, buff0, c_size_t(size0), c_int(flags)))) -} - -func go_hostGetxattr32(path0 *c_char, name0 *c_char, buff0 *c_char, size0 uintptr) (nbyt0 uintptr) { - return uintptr(int(hostGetxattr(path0, name0, buff0, c_size_t(size0)))) -} - -func go_hostListxattr32(path0 *c_char, buff0 *c_char, size0 uintptr) (nbyt0 uintptr) { - return uintptr(int(hostListxattr(path0, buff0, c_size_t(size0)))) -} - -func go_hostRemovexattr32(path0 *c_char, name0 *c_char) (errc0 uintptr) { - return uintptr(int(hostRemovexattr(path0, name0))) -} - -func go_hostOpendir32(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostOpendir(path0, fi0))) -} - -func go_hostReaddir32(path0 *c_char, - buff0 unsafe.Pointer, fill0 c_fuse_fill_dir_t, lofst0, hofst0 uintptr, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostReaddir(path0, - buff0, fill0, (c_fuse_off_t(hofst0)<<32)|c_fuse_off_t(lofst0), fi0))) -} - -func go_hostReleasedir32(path0 *c_char, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostReleasedir(path0, fi0))) -} - -func go_hostFsyncdir32(path0 *c_char, datasync uintptr, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFsyncdir(path0, c_int(datasync), fi0))) -} - -func go_hostInit32(conn0 *c_struct_fuse_conn_info) (user_data unsafe.Pointer) { - return hostInit(conn0) -} - -func go_hostDestroy32(user_data unsafe.Pointer) uintptr { - hostDestroy(user_data) - return 0 -} - -func go_hostAccess32(path0 *c_char, mask0 uintptr) (errc0 uintptr) { - return uintptr(int(hostAccess(path0, c_int(mask0)))) -} - -func go_hostCreate32(path0 *c_char, mode0 uintptr, fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostCreate(path0, c_fuse_mode_t(mode0), fi0))) -} - -func go_hostFtruncate32(path0 *c_char, lsize0, hsize0 uintptr, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFtruncate(path0, (c_fuse_off_t(hsize0)<<32)|c_fuse_off_t(lsize0), fi0))) -} - -func go_hostFgetattr32(path0 *c_char, stat0 *c_fuse_stat_t, - fi0 *c_struct_fuse_file_info) (errc0 uintptr) { - return uintptr(int(hostFgetattr(path0, stat0, fi0))) -} - -func go_hostUtimens32(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 uintptr) { - return uintptr(int(hostUtimens(path0, tmsp0))) -} - -func go_hostSetchgtime32(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 uintptr) { - return uintptr(int(hostSetchgtime(path0, tmsp0))) -} - -func go_hostSetcrtime32(path0 *c_char, tmsp0 *c_fuse_timespec_t) (errc0 uintptr) { - return uintptr(int(hostSetcrtime(path0, tmsp0))) -} - -func go_hostChflags32(path0 *c_char, flags c_uint32_t) (errc0 uintptr) { - return uintptr(int(hostChflags(path0, flags))) -} diff --git a/vendor/github.com/btcsuite/btcutil/LICENSE b/vendor/github.com/btcsuite/btcutil/LICENSE deleted file mode 100644 index 3e7b16791..000000000 --- a/vendor/github.com/btcsuite/btcutil/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -ISC License - -Copyright (c) 2013-2017 The btcsuite developers -Copyright (c) 2016-2017 The Lightning Network Developers - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/btcsuite/btcutil/base58/README.md b/vendor/github.com/btcsuite/btcutil/base58/README.md deleted file mode 100644 index 98dfb1db8..000000000 --- a/vendor/github.com/btcsuite/btcutil/base58/README.md +++ /dev/null @@ -1,34 +0,0 @@ -base58 -========== - -[![Build Status](http://img.shields.io/travis/btcsuite/btcutil.svg)](https://travis-ci.org/btcsuite/btcutil) -[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) -[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcutil/base58) - -Package base58 provides an API for encoding and decoding to and from the -modified base58 encoding. It also provides an API to do Base58Check encoding, -as described [here](https://en.bitcoin.it/wiki/Base58Check_encoding). - -A comprehensive suite of tests is provided to ensure proper functionality. - -## Installation and Updating - -```bash -$ go get -u github.com/btcsuite/btcutil/base58 -``` - -## Examples - -* [Decode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-Decode) - Demonstrates how to decode modified base58 encoded data. -* [Encode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-Encode) - Demonstrates how to encode data using the modified base58 encoding scheme. -* [CheckDecode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-CheckDecode) - Demonstrates how to decode Base58Check encoded data. -* [CheckEncode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-CheckEncode) - Demonstrates how to encode data using the Base58Check encoding scheme. - -## License - -Package base58 is licensed under the [copyfree](http://copyfree.org) ISC -License. diff --git a/vendor/github.com/btcsuite/btcutil/base58/alphabet.go b/vendor/github.com/btcsuite/btcutil/base58/alphabet.go deleted file mode 100644 index 6bb39fef1..000000000 --- a/vendor/github.com/btcsuite/btcutil/base58/alphabet.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2015 The btcsuite developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -// AUTOGENERATED by genalphabet.go; do not edit. - -package base58 - -const ( - // alphabet is the modified base58 alphabet used by Bitcoin. - alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" - - alphabetIdx0 = '1' -) - -var b58 = [256]byte{ - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 255, 255, 255, 255, 255, 255, - 255, 9, 10, 11, 12, 13, 14, 15, - 16, 255, 17, 18, 19, 20, 21, 255, - 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 255, 255, 255, 255, 255, - 255, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 255, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, -} diff --git a/vendor/github.com/btcsuite/btcutil/base58/base58.go b/vendor/github.com/btcsuite/btcutil/base58/base58.go deleted file mode 100644 index 19a72de2c..000000000 --- a/vendor/github.com/btcsuite/btcutil/base58/base58.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2013-2015 The btcsuite developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -package base58 - -import ( - "math/big" -) - -//go:generate go run genalphabet.go - -var bigRadix = big.NewInt(58) -var bigZero = big.NewInt(0) - -// Decode decodes a modified base58 string to a byte slice. -func Decode(b string) []byte { - answer := big.NewInt(0) - j := big.NewInt(1) - - scratch := new(big.Int) - for i := len(b) - 1; i >= 0; i-- { - tmp := b58[b[i]] - if tmp == 255 { - return []byte("") - } - scratch.SetInt64(int64(tmp)) - scratch.Mul(j, scratch) - answer.Add(answer, scratch) - j.Mul(j, bigRadix) - } - - tmpval := answer.Bytes() - - var numZeros int - for numZeros = 0; numZeros < len(b); numZeros++ { - if b[numZeros] != alphabetIdx0 { - break - } - } - flen := numZeros + len(tmpval) - val := make([]byte, flen) - copy(val[numZeros:], tmpval) - - return val -} - -// Encode encodes a byte slice to a modified base58 string. -func Encode(b []byte) string { - x := new(big.Int) - x.SetBytes(b) - - answer := make([]byte, 0, len(b)*136/100) - for x.Cmp(bigZero) > 0 { - mod := new(big.Int) - x.DivMod(x, bigRadix, mod) - answer = append(answer, alphabet[mod.Int64()]) - } - - // leading zero bytes - for _, i := range b { - if i != 0 { - break - } - answer = append(answer, alphabetIdx0) - } - - // reverse - alen := len(answer) - for i := 0; i < alen/2; i++ { - answer[i], answer[alen-1-i] = answer[alen-1-i], answer[i] - } - - return string(answer) -} diff --git a/vendor/github.com/btcsuite/btcutil/base58/base58check.go b/vendor/github.com/btcsuite/btcutil/base58/base58check.go deleted file mode 100644 index 7cdafeeec..000000000 --- a/vendor/github.com/btcsuite/btcutil/base58/base58check.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2013-2014 The btcsuite developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -package base58 - -import ( - "crypto/sha256" - "errors" -) - -// ErrChecksum indicates that the checksum of a check-encoded string does not verify against -// the checksum. -var ErrChecksum = errors.New("checksum error") - -// ErrInvalidFormat indicates that the check-encoded string has an invalid format. -var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") - -// checksum: first four bytes of sha256^2 -func checksum(input []byte) (cksum [4]byte) { - h := sha256.Sum256(input) - h2 := sha256.Sum256(h[:]) - copy(cksum[:], h2[:4]) - return -} - -// CheckEncode prepends a version byte and appends a four byte checksum. -func CheckEncode(input []byte, version byte) string { - b := make([]byte, 0, 1+len(input)+4) - b = append(b, version) - b = append(b, input[:]...) - cksum := checksum(b) - b = append(b, cksum[:]...) - return Encode(b) -} - -// CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum. -func CheckDecode(input string) (result []byte, version byte, err error) { - decoded := Decode(input) - if len(decoded) < 5 { - return nil, 0, ErrInvalidFormat - } - version = decoded[0] - var cksum [4]byte - copy(cksum[:], decoded[len(decoded)-4:]) - if checksum(decoded[:len(decoded)-4]) != cksum { - return nil, 0, ErrChecksum - } - payload := decoded[1 : len(decoded)-4] - result = append(result, payload...) - return -} diff --git a/vendor/github.com/btcsuite/btcutil/base58/cov_report.sh b/vendor/github.com/btcsuite/btcutil/base58/cov_report.sh deleted file mode 100644 index 307f05b76..000000000 --- a/vendor/github.com/btcsuite/btcutil/base58/cov_report.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This script uses gocov to generate a test coverage report. -# The gocov tool my be obtained with the following command: -# go get github.com/axw/gocov/gocov -# -# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. - -# Check for gocov. -type gocov >/dev/null 2>&1 -if [ $? -ne 0 ]; then - echo >&2 "This script requires the gocov tool." - echo >&2 "You may obtain it with the following command:" - echo >&2 "go get github.com/axw/gocov/gocov" - exit 1 -fi -gocov test | gocov report diff --git a/vendor/github.com/btcsuite/btcutil/base58/doc.go b/vendor/github.com/btcsuite/btcutil/base58/doc.go deleted file mode 100644 index 9a2c0e6e3..000000000 --- a/vendor/github.com/btcsuite/btcutil/base58/doc.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2014 The btcsuite developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -/* -Package base58 provides an API for working with modified base58 and Base58Check -encodings. - -Modified Base58 Encoding - -Standard base58 encoding is similar to standard base64 encoding except, as the -name implies, it uses a 58 character alphabet which results in an alphanumeric -string and allows some characters which are problematic for humans to be -excluded. Due to this, there can be various base58 alphabets. - -The modified base58 alphabet used by Bitcoin, and hence this package, omits the -0, O, I, and l characters that look the same in many fonts and are therefore -hard to humans to distinguish. - -Base58Check Encoding Scheme - -The Base58Check encoding scheme is primarily used for Bitcoin addresses at the -time of this writing, however it can be used to generically encode arbitrary -byte arrays into human-readable strings along with a version byte that can be -used to differentiate the same payload. For Bitcoin addresses, the extra -version is used to differentiate the network of otherwise identical public keys -which helps prevent using an address intended for one network on another. -*/ -package base58 diff --git a/vendor/github.com/calebcase/tmpfile/.golangci.yml b/vendor/github.com/calebcase/tmpfile/.golangci.yml deleted file mode 100644 index 79bb0fabc..000000000 --- a/vendor/github.com/calebcase/tmpfile/.golangci.yml +++ /dev/null @@ -1,45 +0,0 @@ -run: - deadline: 10m - issues-exit-code: 1 - tests: true - - skip-files: - - "^doc.*\\.go$" - -linters: - disable-all: true - enable: - - bodyclose - - deadcode - - dogsled - - errcheck - - gocritic - - gofmt - - golint - - govet - - ineffassign - - misspell - - nakedret - - scopelint - - staticcheck - - structcheck - - unconvert - - varcheck - fast: false - -output: - format: colored-line-number - print-issued-lines: true - print-linter-name: true - -linters-settings: - gocyclo: - min-complexity: 10 - maligned: - suggest-new: true - -issues: - max-issues-per-linter: 0 - max-same-issues: 0 - new: false - exclude-use-default: false diff --git a/vendor/github.com/calebcase/tmpfile/LICENSE b/vendor/github.com/calebcase/tmpfile/LICENSE deleted file mode 100644 index 63a29ded6..000000000 --- a/vendor/github.com/calebcase/tmpfile/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2019 Caleb Case - -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/calebcase/tmpfile/LICENSE.golang b/vendor/github.com/calebcase/tmpfile/LICENSE.golang deleted file mode 100644 index 6a66aea5e..000000000 --- a/vendor/github.com/calebcase/tmpfile/LICENSE.golang +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/calebcase/tmpfile/README.md b/vendor/github.com/calebcase/tmpfile/README.md deleted file mode 100644 index b74ed8710..000000000 --- a/vendor/github.com/calebcase/tmpfile/README.md +++ /dev/null @@ -1,30 +0,0 @@ -[![Documentation][godoc.badge]][godoc] -[![Test Status][workflow.tests.badge]][workflow.tests] - -# Cross Platform Temporary Files - -This library attempts to bridge the gap between the what is provided in -[ioutil.TempFile][ioutil.tempfile] and the best practice of ensuring temporary -files are ***always*** deleted when the application exits. - -The normal way to do this on a POSIX system is to use the behavior of -[unlink][posix.unlink] to immediately remove the directory entry for the -temporary file. The OS then ensures that when all open file handles on the file -are close that the file resources are removed. Unfortunately, despite Go having -[os.Remove][os.remove] this does not work on Windows because on Windows it is -necessary to open the files with special flags -([FILE_SHARE_DELETE][windows.flags.share], -[FILE_FLAG_DELETE_ON_CLOSE][windows.flags.on_close]) to enable removing a file -that is open (and ioutil does not do this). - ---- - -[godoc.badge]: https://godoc.org/github.com/calebcase/tmpfile?status.svg -[godoc]: https://godoc.org/github.com/calebcase/tmpfile -[ioutil.tempfile]: https://golang.org/pkg/io/ioutil/#TempFile -[os.remove]: https://golang.org/pkg/os/#Remove -[posix.unlink]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html -[windows.flags.on_close]: https://github.com/golang/sys/blob/master/windows/types_windows.go#L108 -[windows.flags.share]: https://github.com/golang/sys/blob/master/windows/types_windows.go#L71 -[workflow.tests.badge]: https://github.com/calebcase/tmpfile/workflows/tests/badge.svg -[workflow.tests]: https://github.com/calebcase/tmpfile/actions?query=workflow%3Atests diff --git a/vendor/github.com/calebcase/tmpfile/doc.go b/vendor/github.com/calebcase/tmpfile/doc.go deleted file mode 100644 index 31eef9b00..000000000 --- a/vendor/github.com/calebcase/tmpfile/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019 Caleb Case - -// Package tmpfile provides a cross platform facility for creating temporary -// files that are automatically cleaned up (even in the event of an unexpected -// process exit). -// -// tmpfile provides support for at least Linux, OSX, and Windows. Generally any -// POSIX system that adheres to the semantics of unlink -// (https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html) -// should work. Special handling is provided for other platforms. -package tmpfile diff --git a/vendor/github.com/calebcase/tmpfile/go.mod b/vendor/github.com/calebcase/tmpfile/go.mod deleted file mode 100644 index 7decac532..000000000 --- a/vendor/github.com/calebcase/tmpfile/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/calebcase/tmpfile - -go 1.13 - -require golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 diff --git a/vendor/github.com/calebcase/tmpfile/go.sum b/vendor/github.com/calebcase/tmpfile/go.sum deleted file mode 100644 index b518499e2..000000000 --- a/vendor/github.com/calebcase/tmpfile/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 h1:gSbV7h1NRL2G1xTg/owz62CST1oJBmxy4QpMMregXVQ= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/calebcase/tmpfile/tmpfile.go b/vendor/github.com/calebcase/tmpfile/tmpfile.go deleted file mode 100644 index cd9de9f7e..000000000 --- a/vendor/github.com/calebcase/tmpfile/tmpfile.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2019 Caleb Case -// +build !windows - -package tmpfile - -import ( - "io/ioutil" - "os" -) - -// New creates a new temporary file in the directory dir using ioutil.TempFile -// and then unlinks the file with os.Remove to ensure the file is deleted when -// the calling process exists. -// -// If dir is the empty string it will default to using os.TempDir() as the -// directory for storing the temporary files. -// -// The target directory dir must already exist or an error will result. New -// does not create or remove the directory dir. -func New(dir, pattern string) (f *os.File, err error) { - f, err = ioutil.TempFile(dir, pattern) - if err != nil { - return - } - - err = os.Remove(f.Name()) - if err != nil { - return - } - - return -} diff --git a/vendor/github.com/calebcase/tmpfile/tmpfile_windows.go b/vendor/github.com/calebcase/tmpfile/tmpfile_windows.go deleted file mode 100644 index 3820b5698..000000000 --- a/vendor/github.com/calebcase/tmpfile/tmpfile_windows.go +++ /dev/null @@ -1,94 +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.golang -// file. -// -// This is a copied and modified version of the code provided in: -// https://golang.org/src/io/ioutil/tempfile.go - -package tmpfile - -import ( - "os" - "path/filepath" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/sys/windows" -) - -// Random number state. -// We generate random temporary file names so that there's a good -// chance the file doesn't exist yet - keeps the number of tries in -// TempFile to a minimum. -var rand uint32 -var randmu sync.Mutex - -func reseed() uint32 { - return uint32(time.Now().UnixNano() + int64(os.Getpid())) -} - -func nextRandom() string { - randmu.Lock() - r := rand - if r == 0 { - r = reseed() - } - r = r*1664525 + 1013904223 // constants from Numerical Recipes - rand = r - randmu.Unlock() - return strconv.Itoa(int(1e9 + r%1e9))[1:] -} - -// New creates a new temporary file in the directory dir using the same method -// as ioutil.TempFile and then unlinks the file with os.Remove to ensure the -// file is deleted when the calling process exists. -func New(dir, pattern string) (f *os.File, err error) { - if dir == "" { - dir = os.TempDir() - } - - var prefix, suffix string - if pos := strings.LastIndex(pattern, "*"); pos != -1 { - prefix, suffix = pattern[:pos], pattern[pos+1:] - } else { - prefix = pattern - } - - nconflict := 0 - for i := 0; i < 10000; i++ { - name := filepath.Join(dir, prefix+nextRandom()+suffix) - - // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea - handle, err := windows.CreateFile( - windows.StringToUTF16Ptr(name), // File Name - windows.GENERIC_READ|windows.GENERIC_WRITE|windows.DELETE, // Desired Access - windows.FILE_SHARE_DELETE, // Share Mode - nil, // Security Attributes - windows.CREATE_NEW, // Create Disposition - windows.FILE_ATTRIBUTE_TEMPORARY|windows.FILE_FLAG_DELETE_ON_CLOSE, // Flags & Attributes - 0, // Template File - ) - if os.IsExist(err) { - if nconflict++; nconflict > 10 { - randmu.Lock() - rand = reseed() - randmu.Unlock() - } - - continue - } - - f = os.NewFile(uintptr(handle), name) - - break - } - - err = os.Remove(f.Name()) - if err != nil { - return - } - - return f, nil -} diff --git a/vendor/github.com/cespare/xxhash/v2/.travis.yml b/vendor/github.com/cespare/xxhash/v2/.travis.yml deleted file mode 100644 index c516ea88d..000000000 --- a/vendor/github.com/cespare/xxhash/v2/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go -go: - - "1.x" - - master -env: - - TAGS="" - - TAGS="-tags purego" -script: go test $TAGS -v ./... diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt deleted file mode 100644 index 24b53065f..000000000 --- a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2016 Caleb Spare - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md deleted file mode 100644 index 2fd8693c2..000000000 --- a/vendor/github.com/cespare/xxhash/v2/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# xxhash - -[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) -[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) - -xxhash is a Go implementation of the 64-bit -[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a -high-quality hashing algorithm that is much faster than anything in the Go -standard library. - -This package provides a straightforward API: - -``` -func Sum64(b []byte) uint64 -func Sum64String(s string) uint64 -type Digest struct{ ... } - func New() *Digest -``` - -The `Digest` type implements hash.Hash64. Its key methods are: - -``` -func (*Digest) Write([]byte) (int, error) -func (*Digest) WriteString(string) (int, error) -func (*Digest) Sum64() uint64 -``` - -This implementation provides a fast pure-Go implementation and an even faster -assembly implementation for amd64. - -## Compatibility - -This package is in a module and the latest code is in version 2 of the module. -You need a version of Go with at least "minimal module compatibility" to use -github.com/cespare/xxhash/v2: - -* 1.9.7+ for Go 1.9 -* 1.10.3+ for Go 1.10 -* Go 1.11 or later - -I recommend using the latest release of Go. - -## Benchmarks - -Here are some quick benchmarks comparing the pure-Go and assembly -implementations of Sum64. - -| input size | purego | asm | -| --- | --- | --- | -| 5 B | 979.66 MB/s | 1291.17 MB/s | -| 100 B | 7475.26 MB/s | 7973.40 MB/s | -| 4 KB | 17573.46 MB/s | 17602.65 MB/s | -| 10 MB | 17131.46 MB/s | 17142.16 MB/s | - -These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using -the following commands under Go 1.11.2: - -``` -$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' -$ go test -benchtime 10s -bench '/xxhash,direct,bytes' -``` - -## Projects using this package - -- [InfluxDB](https://github.com/influxdata/influxdb) -- [Prometheus](https://github.com/prometheus/prometheus) -- [FreeCache](https://github.com/coocood/freecache) diff --git a/vendor/github.com/cespare/xxhash/v2/go.mod b/vendor/github.com/cespare/xxhash/v2/go.mod deleted file mode 100644 index 49f67608b..000000000 --- a/vendor/github.com/cespare/xxhash/v2/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/cespare/xxhash/v2 - -go 1.11 diff --git a/vendor/github.com/cespare/xxhash/v2/go.sum b/vendor/github.com/cespare/xxhash/v2/go.sum deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go deleted file mode 100644 index db0b35fbe..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash.go +++ /dev/null @@ -1,236 +0,0 @@ -// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described -// at http://cyan4973.github.io/xxHash/. -package xxhash - -import ( - "encoding/binary" - "errors" - "math/bits" -) - -const ( - prime1 uint64 = 11400714785074694791 - prime2 uint64 = 14029467366897019727 - prime3 uint64 = 1609587929392839161 - prime4 uint64 = 9650029242287828579 - prime5 uint64 = 2870177450012600261 -) - -// NOTE(caleb): I'm using both consts and vars of the primes. Using consts where -// possible in the Go code is worth a small (but measurable) performance boost -// by avoiding some MOVQs. Vars are needed for the asm and also are useful for -// convenience in the Go code in a few places where we need to intentionally -// avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the -// result overflows a uint64). -var ( - prime1v = prime1 - prime2v = prime2 - prime3v = prime3 - prime4v = prime4 - prime5v = prime5 -) - -// Digest implements hash.Hash64. -type Digest struct { - v1 uint64 - v2 uint64 - v3 uint64 - v4 uint64 - total uint64 - mem [32]byte - n int // how much of mem is used -} - -// New creates a new Digest that computes the 64-bit xxHash algorithm. -func New() *Digest { - var d Digest - d.Reset() - return &d -} - -// Reset clears the Digest's state so that it can be reused. -func (d *Digest) Reset() { - d.v1 = prime1v + prime2 - d.v2 = prime2 - d.v3 = 0 - d.v4 = -prime1v - d.total = 0 - d.n = 0 -} - -// Size always returns 8 bytes. -func (d *Digest) Size() int { return 8 } - -// BlockSize always returns 32 bytes. -func (d *Digest) BlockSize() int { return 32 } - -// Write adds more data to d. It always returns len(b), nil. -func (d *Digest) Write(b []byte) (n int, err error) { - n = len(b) - d.total += uint64(n) - - if d.n+n < 32 { - // This new data doesn't even fill the current block. - copy(d.mem[d.n:], b) - d.n += n - return - } - - if d.n > 0 { - // Finish off the partial block. - copy(d.mem[d.n:], b) - d.v1 = round(d.v1, u64(d.mem[0:8])) - d.v2 = round(d.v2, u64(d.mem[8:16])) - d.v3 = round(d.v3, u64(d.mem[16:24])) - d.v4 = round(d.v4, u64(d.mem[24:32])) - b = b[32-d.n:] - d.n = 0 - } - - if len(b) >= 32 { - // One or more full blocks left. - nw := writeBlocks(d, b) - b = b[nw:] - } - - // Store any remaining partial block. - copy(d.mem[:], b) - d.n = len(b) - - return -} - -// Sum appends the current hash to b and returns the resulting slice. -func (d *Digest) Sum(b []byte) []byte { - s := d.Sum64() - return append( - b, - byte(s>>56), - byte(s>>48), - byte(s>>40), - byte(s>>32), - byte(s>>24), - byte(s>>16), - byte(s>>8), - byte(s), - ) -} - -// Sum64 returns the current hash. -func (d *Digest) Sum64() uint64 { - var h uint64 - - if d.total >= 32 { - v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 - h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) - h = mergeRound(h, v1) - h = mergeRound(h, v2) - h = mergeRound(h, v3) - h = mergeRound(h, v4) - } else { - h = d.v3 + prime5 - } - - h += d.total - - i, end := 0, d.n - for ; i+8 <= end; i += 8 { - k1 := round(0, u64(d.mem[i:i+8])) - h ^= k1 - h = rol27(h)*prime1 + prime4 - } - if i+4 <= end { - h ^= uint64(u32(d.mem[i:i+4])) * prime1 - h = rol23(h)*prime2 + prime3 - i += 4 - } - for i < end { - h ^= uint64(d.mem[i]) * prime5 - h = rol11(h) * prime1 - i++ - } - - h ^= h >> 33 - h *= prime2 - h ^= h >> 29 - h *= prime3 - h ^= h >> 32 - - return h -} - -const ( - magic = "xxh\x06" - marshaledSize = len(magic) + 8*5 + 32 -) - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (d *Digest) MarshalBinary() ([]byte, error) { - b := make([]byte, 0, marshaledSize) - b = append(b, magic...) - b = appendUint64(b, d.v1) - b = appendUint64(b, d.v2) - b = appendUint64(b, d.v3) - b = appendUint64(b, d.v4) - b = appendUint64(b, d.total) - b = append(b, d.mem[:d.n]...) - b = b[:len(b)+len(d.mem)-d.n] - return b, nil -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -func (d *Digest) UnmarshalBinary(b []byte) error { - if len(b) < len(magic) || string(b[:len(magic)]) != magic { - return errors.New("xxhash: invalid hash state identifier") - } - if len(b) != marshaledSize { - return errors.New("xxhash: invalid hash state size") - } - b = b[len(magic):] - b, d.v1 = consumeUint64(b) - b, d.v2 = consumeUint64(b) - b, d.v3 = consumeUint64(b) - b, d.v4 = consumeUint64(b) - b, d.total = consumeUint64(b) - copy(d.mem[:], b) - b = b[len(d.mem):] - d.n = int(d.total % uint64(len(d.mem))) - return nil -} - -func appendUint64(b []byte, x uint64) []byte { - var a [8]byte - binary.LittleEndian.PutUint64(a[:], x) - return append(b, a[:]...) -} - -func consumeUint64(b []byte) ([]byte, uint64) { - x := u64(b) - return b[8:], x -} - -func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } -func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } - -func round(acc, input uint64) uint64 { - acc += input * prime2 - acc = rol31(acc) - acc *= prime1 - return acc -} - -func mergeRound(acc, val uint64) uint64 { - val = round(0, val) - acc ^= val - acc = acc*prime1 + prime4 - return acc -} - -func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } -func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } -func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } -func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } -func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } -func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } -func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } -func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go deleted file mode 100644 index ad14b807f..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !appengine -// +build gc -// +build !purego - -package xxhash - -// Sum64 computes the 64-bit xxHash digest of b. -// -//go:noescape -func Sum64(b []byte) uint64 - -//go:noescape -func writeBlocks(d *Digest, b []byte) int diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s deleted file mode 100644 index d580e32ae..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s +++ /dev/null @@ -1,215 +0,0 @@ -// +build !appengine -// +build gc -// +build !purego - -#include "textflag.h" - -// Register allocation: -// AX h -// CX pointer to advance through b -// DX n -// BX loop end -// R8 v1, k1 -// R9 v2 -// R10 v3 -// R11 v4 -// R12 tmp -// R13 prime1v -// R14 prime2v -// R15 prime4v - -// round reads from and advances the buffer pointer in CX. -// It assumes that R13 has prime1v and R14 has prime2v. -#define round(r) \ - MOVQ (CX), R12 \ - ADDQ $8, CX \ - IMULQ R14, R12 \ - ADDQ R12, r \ - ROLQ $31, r \ - IMULQ R13, r - -// mergeRound applies a merge round on the two registers acc and val. -// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v. -#define mergeRound(acc, val) \ - IMULQ R14, val \ - ROLQ $31, val \ - IMULQ R13, val \ - XORQ val, acc \ - IMULQ R13, acc \ - ADDQ R15, acc - -// func Sum64(b []byte) uint64 -TEXT ·Sum64(SB), NOSPLIT, $0-32 - // Load fixed primes. - MOVQ ·prime1v(SB), R13 - MOVQ ·prime2v(SB), R14 - MOVQ ·prime4v(SB), R15 - - // Load slice. - MOVQ b_base+0(FP), CX - MOVQ b_len+8(FP), DX - LEAQ (CX)(DX*1), BX - - // The first loop limit will be len(b)-32. - SUBQ $32, BX - - // Check whether we have at least one block. - CMPQ DX, $32 - JLT noBlocks - - // Set up initial state (v1, v2, v3, v4). - MOVQ R13, R8 - ADDQ R14, R8 - MOVQ R14, R9 - XORQ R10, R10 - XORQ R11, R11 - SUBQ R13, R11 - - // Loop until CX > BX. -blockLoop: - round(R8) - round(R9) - round(R10) - round(R11) - - CMPQ CX, BX - JLE blockLoop - - MOVQ R8, AX - ROLQ $1, AX - MOVQ R9, R12 - ROLQ $7, R12 - ADDQ R12, AX - MOVQ R10, R12 - ROLQ $12, R12 - ADDQ R12, AX - MOVQ R11, R12 - ROLQ $18, R12 - ADDQ R12, AX - - mergeRound(AX, R8) - mergeRound(AX, R9) - mergeRound(AX, R10) - mergeRound(AX, R11) - - JMP afterBlocks - -noBlocks: - MOVQ ·prime5v(SB), AX - -afterBlocks: - ADDQ DX, AX - - // Right now BX has len(b)-32, and we want to loop until CX > len(b)-8. - ADDQ $24, BX - - CMPQ CX, BX - JG fourByte - -wordLoop: - // Calculate k1. - MOVQ (CX), R8 - ADDQ $8, CX - IMULQ R14, R8 - ROLQ $31, R8 - IMULQ R13, R8 - - XORQ R8, AX - ROLQ $27, AX - IMULQ R13, AX - ADDQ R15, AX - - CMPQ CX, BX - JLE wordLoop - -fourByte: - ADDQ $4, BX - CMPQ CX, BX - JG singles - - MOVL (CX), R8 - ADDQ $4, CX - IMULQ R13, R8 - XORQ R8, AX - - ROLQ $23, AX - IMULQ R14, AX - ADDQ ·prime3v(SB), AX - -singles: - ADDQ $4, BX - CMPQ CX, BX - JGE finalize - -singlesLoop: - MOVBQZX (CX), R12 - ADDQ $1, CX - IMULQ ·prime5v(SB), R12 - XORQ R12, AX - - ROLQ $11, AX - IMULQ R13, AX - - CMPQ CX, BX - JL singlesLoop - -finalize: - MOVQ AX, R12 - SHRQ $33, R12 - XORQ R12, AX - IMULQ R14, AX - MOVQ AX, R12 - SHRQ $29, R12 - XORQ R12, AX - IMULQ ·prime3v(SB), AX - MOVQ AX, R12 - SHRQ $32, R12 - XORQ R12, AX - - MOVQ AX, ret+24(FP) - RET - -// writeBlocks uses the same registers as above except that it uses AX to store -// the d pointer. - -// func writeBlocks(d *Digest, b []byte) int -TEXT ·writeBlocks(SB), NOSPLIT, $0-40 - // Load fixed primes needed for round. - MOVQ ·prime1v(SB), R13 - MOVQ ·prime2v(SB), R14 - - // Load slice. - MOVQ b_base+8(FP), CX - MOVQ b_len+16(FP), DX - LEAQ (CX)(DX*1), BX - SUBQ $32, BX - - // Load vN from d. - MOVQ d+0(FP), AX - MOVQ 0(AX), R8 // v1 - MOVQ 8(AX), R9 // v2 - MOVQ 16(AX), R10 // v3 - MOVQ 24(AX), R11 // v4 - - // We don't need to check the loop condition here; this function is - // always called with at least one block of data to process. -blockLoop: - round(R8) - round(R9) - round(R10) - round(R11) - - CMPQ CX, BX - JLE blockLoop - - // Copy vN back to d. - MOVQ R8, 0(AX) - MOVQ R9, 8(AX) - MOVQ R10, 16(AX) - MOVQ R11, 24(AX) - - // The number of bytes written is CX minus the old base pointer. - SUBQ b_base+8(FP), CX - MOVQ CX, ret+32(FP) - - RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go deleted file mode 100644 index 4a5a82160..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go +++ /dev/null @@ -1,76 +0,0 @@ -// +build !amd64 appengine !gc purego - -package xxhash - -// Sum64 computes the 64-bit xxHash digest of b. -func Sum64(b []byte) uint64 { - // A simpler version would be - // d := New() - // d.Write(b) - // return d.Sum64() - // but this is faster, particularly for small inputs. - - n := len(b) - var h uint64 - - if n >= 32 { - v1 := prime1v + prime2 - v2 := prime2 - v3 := uint64(0) - v4 := -prime1v - for len(b) >= 32 { - v1 = round(v1, u64(b[0:8:len(b)])) - v2 = round(v2, u64(b[8:16:len(b)])) - v3 = round(v3, u64(b[16:24:len(b)])) - v4 = round(v4, u64(b[24:32:len(b)])) - b = b[32:len(b):len(b)] - } - h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) - h = mergeRound(h, v1) - h = mergeRound(h, v2) - h = mergeRound(h, v3) - h = mergeRound(h, v4) - } else { - h = prime5 - } - - h += uint64(n) - - i, end := 0, len(b) - for ; i+8 <= end; i += 8 { - k1 := round(0, u64(b[i:i+8:len(b)])) - h ^= k1 - h = rol27(h)*prime1 + prime4 - } - if i+4 <= end { - h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 - h = rol23(h)*prime2 + prime3 - i += 4 - } - for ; i < end; i++ { - h ^= uint64(b[i]) * prime5 - h = rol11(h) * prime1 - } - - h ^= h >> 33 - h *= prime2 - h ^= h >> 29 - h *= prime3 - h ^= h >> 32 - - return h -} - -func writeBlocks(d *Digest, b []byte) int { - v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 - n := len(b) - for len(b) >= 32 { - v1 = round(v1, u64(b[0:8:len(b)])) - v2 = round(v2, u64(b[8:16:len(b)])) - v3 = round(v3, u64(b[16:24:len(b)])) - v4 = round(v4, u64(b[24:32:len(b)])) - b = b[32:len(b):len(b)] - } - d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 - return n - len(b) -} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go deleted file mode 100644 index fc9bea7a3..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build appengine - -// This file contains the safe implementations of otherwise unsafe-using code. - -package xxhash - -// Sum64String computes the 64-bit xxHash digest of s. -func Sum64String(s string) uint64 { - return Sum64([]byte(s)) -} - -// WriteString adds more data to d. It always returns len(s), nil. -func (d *Digest) WriteString(s string) (n int, err error) { - return d.Write([]byte(s)) -} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go deleted file mode 100644 index 53bf76efb..000000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build !appengine - -// This file encapsulates usage of unsafe. -// xxhash_safe.go contains the safe implementations. - -package xxhash - -import ( - "reflect" - "unsafe" -) - -// Notes: -// -// See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ -// for some discussion about these unsafe conversions. -// -// In the future it's possible that compiler optimizations will make these -// unsafe operations unnecessary: https://golang.org/issue/2205. -// -// Both of these wrapper functions still incur function call overhead since they -// will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write -// for strings to squeeze out a bit more speed. Mid-stack inlining should -// eventually fix this. - -// Sum64String computes the 64-bit xxHash digest of s. -// It may be faster than Sum64([]byte(s)) by avoiding a copy. -func Sum64String(s string) uint64 { - var b []byte - bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data - bh.Len = len(s) - bh.Cap = len(s) - return Sum64(b) -} - -// WriteString adds more data to d. It always returns len(s), nil. -// It may be faster than Write([]byte(s)) by avoiding a copy. -func (d *Digest) WriteString(s string) (n int, err error) { - var b []byte - bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data - bh.Len = len(s) - bh.Cap = len(s) - return d.Write(b) -} diff --git a/vendor/github.com/coreos/go-semver/LICENSE b/vendor/github.com/coreos/go-semver/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/coreos/go-semver/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/coreos/go-semver/NOTICE b/vendor/github.com/coreos/go-semver/NOTICE deleted file mode 100644 index 23a0ada2f..000000000 --- a/vendor/github.com/coreos/go-semver/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -CoreOS Project -Copyright 2018 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-semver/semver/semver.go b/vendor/github.com/coreos/go-semver/semver/semver.go deleted file mode 100644 index 76cf4852c..000000000 --- a/vendor/github.com/coreos/go-semver/semver/semver.go +++ /dev/null @@ -1,296 +0,0 @@ -// 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-semver/semver/sort.go b/vendor/github.com/coreos/go-semver/semver/sort.go deleted file mode 100644 index e256b41a5..000000000 --- a/vendor/github.com/coreos/go-semver/semver/sort.go +++ /dev/null @@ -1,38 +0,0 @@ -// 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. - -package semver - -import ( - "sort" -) - -type Versions []*Version - -func (s Versions) Len() int { - return len(s) -} - -func (s Versions) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s Versions) Less(i, j int) bool { - return s[i].LessThan(*s[j]) -} - -// Sort sorts the given slice of Version -func Sort(versions []*Version) { - sort.Sort(Versions(versions)) -} diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md b/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md deleted file mode 100644 index 1cade6cef..000000000 --- a/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Brian Goff - -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/cpuguy83/go-md2man/v2/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go deleted file mode 100644 index b48005673..000000000 --- a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go +++ /dev/null @@ -1,14 +0,0 @@ -package md2man - -import ( - "github.com/russross/blackfriday/v2" -) - -// Render converts a markdown document into a roff formatted document. -func Render(doc []byte) []byte { - renderer := NewRoffRenderer() - - return blackfriday.Run(doc, - []blackfriday.Option{blackfriday.WithRenderer(renderer), - blackfriday.WithExtensions(renderer.GetExtensions())}...) -} diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go deleted file mode 100644 index 0668a66cf..000000000 --- a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go +++ /dev/null @@ -1,345 +0,0 @@ -package md2man - -import ( - "fmt" - "io" - "os" - "strings" - - "github.com/russross/blackfriday/v2" -) - -// roffRenderer implements the blackfriday.Renderer interface for creating -// roff format (manpages) from markdown text -type roffRenderer struct { - extensions blackfriday.Extensions - listCounters []int - firstHeader bool - defineTerm bool - listDepth int -} - -const ( - titleHeader = ".TH " - topLevelHeader = "\n\n.SH " - secondLevelHdr = "\n.SH " - otherHeader = "\n.SS " - crTag = "\n" - emphTag = "\\fI" - emphCloseTag = "\\fP" - strongTag = "\\fB" - strongCloseTag = "\\fP" - breakTag = "\n.br\n" - paraTag = "\n.PP\n" - hruleTag = "\n.ti 0\n\\l'\\n(.lu'\n" - linkTag = "\n\\[la]" - linkCloseTag = "\\[ra]" - codespanTag = "\\fB\\fC" - codespanCloseTag = "\\fR" - codeTag = "\n.PP\n.RS\n\n.nf\n" - codeCloseTag = "\n.fi\n.RE\n" - quoteTag = "\n.PP\n.RS\n" - quoteCloseTag = "\n.RE\n" - listTag = "\n.RS\n" - listCloseTag = "\n.RE\n" - arglistTag = "\n.TP\n" - tableStart = "\n.TS\nallbox;\n" - tableEnd = ".TE\n" - tableCellStart = "T{\n" - tableCellEnd = "\nT}\n" -) - -// NewRoffRenderer creates a new blackfriday Renderer for generating roff documents -// from markdown -func NewRoffRenderer() *roffRenderer { // nolint: golint - var extensions blackfriday.Extensions - - extensions |= blackfriday.NoIntraEmphasis - extensions |= blackfriday.Tables - extensions |= blackfriday.FencedCode - extensions |= blackfriday.SpaceHeadings - extensions |= blackfriday.Footnotes - extensions |= blackfriday.Titleblock - extensions |= blackfriday.DefinitionLists - return &roffRenderer{ - extensions: extensions, - } -} - -// GetExtensions returns the list of extensions used by this renderer implementation -func (r *roffRenderer) GetExtensions() blackfriday.Extensions { - return r.extensions -} - -// RenderHeader handles outputting the header at document start -func (r *roffRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) { - // disable hyphenation - out(w, ".nh\n") -} - -// RenderFooter handles outputting the footer at the document end; the roff -// renderer has no footer information -func (r *roffRenderer) RenderFooter(w io.Writer, ast *blackfriday.Node) { -} - -// RenderNode is called for each node in a markdown document; based on the node -// type the equivalent roff output is sent to the writer -func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus { - - var walkAction = blackfriday.GoToNext - - switch node.Type { - case blackfriday.Text: - r.handleText(w, node, entering) - case blackfriday.Softbreak: - out(w, crTag) - case blackfriday.Hardbreak: - out(w, breakTag) - case blackfriday.Emph: - if entering { - out(w, emphTag) - } else { - out(w, emphCloseTag) - } - case blackfriday.Strong: - if entering { - out(w, strongTag) - } else { - out(w, strongCloseTag) - } - case blackfriday.Link: - if !entering { - out(w, linkTag+string(node.LinkData.Destination)+linkCloseTag) - } - case blackfriday.Image: - // ignore images - walkAction = blackfriday.SkipChildren - case blackfriday.Code: - out(w, codespanTag) - escapeSpecialChars(w, node.Literal) - out(w, codespanCloseTag) - case blackfriday.Document: - break - case blackfriday.Paragraph: - // roff .PP markers break lists - if r.listDepth > 0 { - return blackfriday.GoToNext - } - if entering { - out(w, paraTag) - } else { - out(w, crTag) - } - case blackfriday.BlockQuote: - if entering { - out(w, quoteTag) - } else { - out(w, quoteCloseTag) - } - case blackfriday.Heading: - r.handleHeading(w, node, entering) - case blackfriday.HorizontalRule: - out(w, hruleTag) - case blackfriday.List: - r.handleList(w, node, entering) - case blackfriday.Item: - r.handleItem(w, node, entering) - case blackfriday.CodeBlock: - out(w, codeTag) - escapeSpecialChars(w, node.Literal) - out(w, codeCloseTag) - case blackfriday.Table: - r.handleTable(w, node, entering) - case blackfriday.TableCell: - r.handleTableCell(w, node, entering) - case blackfriday.TableHead: - case blackfriday.TableBody: - case blackfriday.TableRow: - // no action as cell entries do all the nroff formatting - return blackfriday.GoToNext - default: - fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String()) - } - return walkAction -} - -func (r *roffRenderer) handleText(w io.Writer, node *blackfriday.Node, entering bool) { - var ( - start, end string - ) - // handle special roff table cell text encapsulation - if node.Parent.Type == blackfriday.TableCell { - if len(node.Literal) > 30 { - start = tableCellStart - end = tableCellEnd - } else { - // end rows that aren't terminated by "tableCellEnd" with a cr if end of row - if node.Parent.Next == nil && !node.Parent.IsHeader { - end = crTag - } - } - } - out(w, start) - escapeSpecialChars(w, node.Literal) - out(w, end) -} - -func (r *roffRenderer) handleHeading(w io.Writer, node *blackfriday.Node, entering bool) { - if entering { - switch node.Level { - case 1: - if !r.firstHeader { - out(w, titleHeader) - r.firstHeader = true - break - } - out(w, topLevelHeader) - case 2: - out(w, secondLevelHdr) - default: - out(w, otherHeader) - } - } -} - -func (r *roffRenderer) handleList(w io.Writer, node *blackfriday.Node, entering bool) { - openTag := listTag - closeTag := listCloseTag - if node.ListFlags&blackfriday.ListTypeDefinition != 0 { - // tags for definition lists handled within Item node - openTag = "" - closeTag = "" - } - if entering { - r.listDepth++ - if node.ListFlags&blackfriday.ListTypeOrdered != 0 { - r.listCounters = append(r.listCounters, 1) - } - out(w, openTag) - } else { - if node.ListFlags&blackfriday.ListTypeOrdered != 0 { - r.listCounters = r.listCounters[:len(r.listCounters)-1] - } - out(w, closeTag) - r.listDepth-- - } -} - -func (r *roffRenderer) handleItem(w io.Writer, node *blackfriday.Node, entering bool) { - if entering { - if node.ListFlags&blackfriday.ListTypeOrdered != 0 { - out(w, fmt.Sprintf(".IP \"%3d.\" 5\n", r.listCounters[len(r.listCounters)-1])) - r.listCounters[len(r.listCounters)-1]++ - } else if node.ListFlags&blackfriday.ListTypeDefinition != 0 { - // state machine for handling terms and following definitions - // since blackfriday does not distinguish them properly, nor - // does it seperate them into separate lists as it should - if !r.defineTerm { - out(w, arglistTag) - r.defineTerm = true - } else { - r.defineTerm = false - } - } else { - out(w, ".IP \\(bu 2\n") - } - } else { - out(w, "\n") - } -} - -func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering bool) { - if entering { - out(w, tableStart) - //call walker to count cells (and rows?) so format section can be produced - columns := countColumns(node) - out(w, strings.Repeat("l ", columns)+"\n") - out(w, strings.Repeat("l ", columns)+".\n") - } else { - out(w, tableEnd) - } -} - -func (r *roffRenderer) handleTableCell(w io.Writer, node *blackfriday.Node, entering bool) { - var ( - start, end string - ) - if node.IsHeader { - start = codespanTag - end = codespanCloseTag - } - if entering { - if node.Prev != nil && node.Prev.Type == blackfriday.TableCell { - out(w, "\t"+start) - } else { - out(w, start) - } - } else { - // need to carriage return if we are at the end of the header row - if node.IsHeader && node.Next == nil { - end = end + crTag - } - out(w, end) - } -} - -// because roff format requires knowing the column count before outputting any table -// data we need to walk a table tree and count the columns -func countColumns(node *blackfriday.Node) int { - var columns int - - node.Walk(func(node *blackfriday.Node, entering bool) blackfriday.WalkStatus { - switch node.Type { - case blackfriday.TableRow: - if !entering { - return blackfriday.Terminate - } - case blackfriday.TableCell: - if entering { - columns++ - } - default: - } - return blackfriday.GoToNext - }) - return columns -} - -func out(w io.Writer, output string) { - io.WriteString(w, output) // nolint: errcheck -} - -func needsBackslash(c byte) bool { - for _, r := range []byte("-_&\\~") { - if c == r { - return true - } - } - return false -} - -func escapeSpecialChars(w io.Writer, text []byte) { - for i := 0; i < len(text); i++ { - // escape initial apostrophe or period - if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') { - out(w, "\\&") - } - - // directly copy normal characters - org := i - - for i < len(text) && !needsBackslash(text[i]) { - i++ - } - if i > org { - w.Write(text[org:i]) // nolint: errcheck - } - - // escape a character - if i >= len(text) { - break - } - - w.Write([]byte{'\\', text[i]}) // nolint: errcheck - } -} diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE deleted file mode 100644 index bc52e96f2..000000000 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go deleted file mode 100644 index 792994785..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine, compiled by GopherJS, and -// "-tags safe" is not added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// Go versions prior to 1.4 are disabled because they use a different layout -// for interfaces which make the implementation of unsafeReflectValue more complex. -// +build !js,!appengine,!safe,!disableunsafe,go1.4 - -package spew - -import ( - "reflect" - "unsafe" -) - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = false - - // ptrSize is the size of a pointer on the current arch. - ptrSize = unsafe.Sizeof((*byte)(nil)) -) - -type flag uintptr - -var ( - // flagRO indicates whether the value field of a reflect.Value - // is read-only. - flagRO flag - - // flagAddr indicates whether the address of the reflect.Value's - // value may be taken. - flagAddr flag -) - -// flagKindMask holds the bits that make up the kind -// part of the flags field. In all the supported versions, -// it is in the lower 5 bits. -const flagKindMask = flag(0x1f) - -// Different versions of Go have used different -// bit layouts for the flags type. This table -// records the known combinations. -var okFlags = []struct { - ro, addr flag -}{{ - // From Go 1.4 to 1.5 - ro: 1 << 5, - addr: 1 << 7, -}, { - // Up to Go tip. - ro: 1<<5 | 1<<6, - addr: 1 << 8, -}} - -var flagValOffset = func() uintptr { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - return field.Offset -}() - -// flagField returns a pointer to the flag field of a reflect.Value. -func flagField(v *reflect.Value) *flag { - return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) -} - -// unsafeReflectValue converts the passed reflect.Value into a one that bypasses -// the typical safety restrictions preventing access to unaddressable and -// unexported data. It works by digging the raw pointer to the underlying -// value out of the protected value and generating a new unprotected (unsafe) -// reflect.Value to it. -// -// This allows us to check for implementations of the Stringer and error -// interfaces to be used for pretty printing ordinarily unaddressable and -// inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) reflect.Value { - if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { - return v - } - flagFieldPtr := flagField(&v) - *flagFieldPtr &^= flagRO - *flagFieldPtr |= flagAddr - return v -} - -// Sanity checks against future reflect package changes -// to the type or semantics of the Value.flag field. -func init() { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { - panic("reflect.Value flag field has changed kind") - } - type t0 int - var t struct { - A t0 - // t0 will have flagEmbedRO set. - t0 - // a will have flagStickyRO set - a t0 - } - vA := reflect.ValueOf(t).FieldByName("A") - va := reflect.ValueOf(t).FieldByName("a") - vt0 := reflect.ValueOf(t).FieldByName("t0") - - // Infer flagRO from the difference between the flags - // for the (otherwise identical) fields in t. - flagPublic := *flagField(&vA) - flagWithRO := *flagField(&va) | *flagField(&vt0) - flagRO = flagPublic ^ flagWithRO - - // Infer flagAddr from the difference between a value - // taken from a pointer and not. - vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") - flagNoPtr := *flagField(&vA) - flagPtr := *flagField(&vPtrA) - flagAddr = flagNoPtr ^ flagPtr - - // Check that the inferred flags tally with one of the known versions. - for _, f := range okFlags { - if flagRO == f.ro && flagAddr == f.addr { - return - } - } - panic("reflect.Value read-only flag has changed semantics") -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go deleted file mode 100644 index 205c28d68..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is running on Google App Engine, compiled by GopherJS, or -// "-tags safe" is added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe !go1.4 - -package spew - -import "reflect" - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = true -) - -// unsafeReflectValue typically converts the passed reflect.Value into a one -// that bypasses the typical safety restrictions preventing access to -// unaddressable and unexported data. However, doing this relies on access to -// the unsafe package. This is a stub version which simply returns the passed -// reflect.Value when the unsafe package is not available. -func unsafeReflectValue(v reflect.Value) reflect.Value { - return v -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go deleted file mode 100644 index 1be8ce945..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "reflect" - "sort" - "strconv" -) - -// Some constants in the form of bytes to avoid string overhead. This mirrors -// the technique used in the fmt package. -var ( - panicBytes = []byte("(PANIC=") - plusBytes = []byte("+") - iBytes = []byte("i") - trueBytes = []byte("true") - falseBytes = []byte("false") - interfaceBytes = []byte("(interface {})") - commaNewlineBytes = []byte(",\n") - newlineBytes = []byte("\n") - openBraceBytes = []byte("{") - openBraceNewlineBytes = []byte("{\n") - closeBraceBytes = []byte("}") - asteriskBytes = []byte("*") - colonBytes = []byte(":") - colonSpaceBytes = []byte(": ") - openParenBytes = []byte("(") - closeParenBytes = []byte(")") - spaceBytes = []byte(" ") - pointerChainBytes = []byte("->") - nilAngleBytes = []byte("") - maxNewlineBytes = []byte("\n") - maxShortBytes = []byte("") - circularBytes = []byte("") - circularShortBytes = []byte("") - invalidAngleBytes = []byte("") - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - percentBytes = []byte("%") - precisionBytes = []byte(".") - openAngleBytes = []byte("<") - closeAngleBytes = []byte(">") - openMapBytes = []byte("map[") - closeMapBytes = []byte("]") - lenEqualsBytes = []byte("len=") - capEqualsBytes = []byte("cap=") -) - -// hexDigits is used to map a decimal value to a hex digit. -var hexDigits = "0123456789abcdef" - -// catchPanic handles any panics that might occur during the handleMethods -// calls. -func catchPanic(w io.Writer, v reflect.Value) { - if err := recover(); err != nil { - w.Write(panicBytes) - fmt.Fprintf(w, "%v", err) - w.Write(closeParenBytes) - } -} - -// handleMethods attempts to call the Error and String methods on the underlying -// type the passed reflect.Value represents and outputes the result to Writer w. -// -// It handles panics in any called methods by catching and displaying the error -// as the formatted value. -func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { - // We need an interface to check if the type implements the error or - // Stringer interface. However, the reflect package won't give us an - // interface on certain things like unexported struct fields in order - // to enforce visibility rules. We use unsafe, when it's available, - // to bypass these restrictions since this package does not mutate the - // values. - if !v.CanInterface() { - if UnsafeDisabled { - return false - } - - v = unsafeReflectValue(v) - } - - // Choose whether or not to do error and Stringer interface lookups against - // the base type or a pointer to the base type depending on settings. - // Technically calling one of these methods with a pointer receiver can - // mutate the value, however, types which choose to satisify an error or - // Stringer interface with a pointer receiver should not be mutating their - // state inside these interface methods. - if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { - v = unsafeReflectValue(v) - } - if v.CanAddr() { - v = v.Addr() - } - - // Is it an error or Stringer? - switch iface := v.Interface().(type) { - case error: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.Error())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - - w.Write([]byte(iface.Error())) - return true - - case fmt.Stringer: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.String())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - w.Write([]byte(iface.String())) - return true - } - return false -} - -// printBool outputs a boolean value as true or false to Writer w. -func printBool(w io.Writer, val bool) { - if val { - w.Write(trueBytes) - } else { - w.Write(falseBytes) - } -} - -// printInt outputs a signed integer value to Writer w. -func printInt(w io.Writer, val int64, base int) { - w.Write([]byte(strconv.FormatInt(val, base))) -} - -// printUint outputs an unsigned integer value to Writer w. -func printUint(w io.Writer, val uint64, base int) { - w.Write([]byte(strconv.FormatUint(val, base))) -} - -// printFloat outputs a floating point value using the specified precision, -// which is expected to be 32 or 64bit, to Writer w. -func printFloat(w io.Writer, val float64, precision int) { - w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) -} - -// printComplex outputs a complex value using the specified float precision -// for the real and imaginary parts to Writer w. -func printComplex(w io.Writer, c complex128, floatPrecision int) { - r := real(c) - w.Write(openParenBytes) - w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) - i := imag(c) - if i >= 0 { - w.Write(plusBytes) - } - w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) - w.Write(iBytes) - w.Write(closeParenBytes) -} - -// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' -// prefix to Writer w. -func printHexPtr(w io.Writer, p uintptr) { - // Null pointer. - num := uint64(p) - if num == 0 { - w.Write(nilAngleBytes) - return - } - - // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix - buf := make([]byte, 18) - - // It's simpler to construct the hex string right to left. - base := uint64(16) - i := len(buf) - 1 - for num >= base { - buf[i] = hexDigits[num%base] - num /= base - i-- - } - buf[i] = hexDigits[num] - - // Add '0x' prefix. - i-- - buf[i] = 'x' - i-- - buf[i] = '0' - - // Strip unused leading bytes. - buf = buf[i:] - w.Write(buf) -} - -// valuesSorter implements sort.Interface to allow a slice of reflect.Value -// elements to be sorted. -type valuesSorter struct { - values []reflect.Value - strings []string // either nil or same len and values - cs *ConfigState -} - -// newValuesSorter initializes a valuesSorter instance, which holds a set of -// surrogate keys on which the data should be sorted. It uses flags in -// ConfigState to decide if and how to populate those surrogate keys. -func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { - vs := &valuesSorter{values: values, cs: cs} - if canSortSimply(vs.values[0].Kind()) { - return vs - } - if !cs.DisableMethods { - vs.strings = make([]string, len(values)) - for i := range vs.values { - b := bytes.Buffer{} - if !handleMethods(cs, &b, vs.values[i]) { - vs.strings = nil - break - } - vs.strings[i] = b.String() - } - } - if vs.strings == nil && cs.SpewKeys { - vs.strings = make([]string, len(values)) - for i := range vs.values { - vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) - } - } - return vs -} - -// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted -// directly, or whether it should be considered for sorting by surrogate keys -// (if the ConfigState allows it). -func canSortSimply(kind reflect.Kind) bool { - // This switch parallels valueSortLess, except for the default case. - switch kind { - case reflect.Bool: - return true - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return true - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return true - case reflect.Float32, reflect.Float64: - return true - case reflect.String: - return true - case reflect.Uintptr: - return true - case reflect.Array: - return true - } - return false -} - -// Len returns the number of values in the slice. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Len() int { - return len(s.values) -} - -// Swap swaps the values at the passed indices. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Swap(i, j int) { - s.values[i], s.values[j] = s.values[j], s.values[i] - if s.strings != nil { - s.strings[i], s.strings[j] = s.strings[j], s.strings[i] - } -} - -// valueSortLess returns whether the first value should sort before the second -// value. It is used by valueSorter.Less as part of the sort.Interface -// implementation. -func valueSortLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Bool: - return !a.Bool() && b.Bool() - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return a.Int() < b.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return a.Uint() < b.Uint() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.String: - return a.String() < b.String() - case reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Array: - // Compare the contents of both arrays. - l := a.Len() - for i := 0; i < l; i++ { - av := a.Index(i) - bv := b.Index(i) - if av.Interface() == bv.Interface() { - continue - } - return valueSortLess(av, bv) - } - } - return a.String() < b.String() -} - -// Less returns whether the value at index i should sort before the -// value at index j. It is part of the sort.Interface implementation. -func (s *valuesSorter) Less(i, j int) bool { - if s.strings == nil { - return valueSortLess(s.values[i], s.values[j]) - } - return s.strings[i] < s.strings[j] -} - -// sortValues is a sort function that handles both native types and any type that -// can be converted to error or Stringer. Other inputs are sorted according to -// their Value.String() value to ensure display stability. -func sortValues(values []reflect.Value, cs *ConfigState) { - if len(values) == 0 { - return - } - sort.Sort(newValuesSorter(values, cs)) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go deleted file mode 100644 index 2e3d22f31..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/config.go +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "os" -) - -// ConfigState houses the configuration options used by spew to format and -// display values. There is a global instance, Config, that is used to control -// all top-level Formatter and Dump functionality. Each ConfigState instance -// provides methods equivalent to the top-level functions. -// -// The zero value for ConfigState provides no indentation. You would typically -// want to set it to a space or a tab. -// -// Alternatively, you can use NewDefaultConfig to get a ConfigState instance -// with default settings. See the documentation of NewDefaultConfig for default -// values. -type ConfigState struct { - // Indent specifies the string to use for each indentation level. The - // global config instance that all top-level functions use set this to a - // single space by default. If you would like more indentation, you might - // set this to a tab with "\t" or perhaps two spaces with " ". - Indent string - - // MaxDepth controls the maximum number of levels to descend into nested - // data structures. The default, 0, means there is no limit. - // - // NOTE: Circular data structures are properly detected, so it is not - // necessary to set this value unless you specifically want to limit deeply - // nested data structures. - MaxDepth int - - // DisableMethods specifies whether or not error and Stringer interfaces are - // invoked for types that implement them. - DisableMethods bool - - // DisablePointerMethods specifies whether or not to check for and invoke - // error and Stringer interfaces on types which only accept a pointer - // receiver when the current type is not a pointer. - // - // NOTE: This might be an unsafe action since calling one of these methods - // with a pointer receiver could technically mutate the value, however, - // in practice, types which choose to satisify an error or Stringer - // interface with a pointer receiver should not be mutating their state - // inside these interface methods. As a result, this option relies on - // access to the unsafe package, so it will not have any effect when - // running in environments without access to the unsafe package such as - // Google App Engine or with the "safe" build tag specified. - DisablePointerMethods bool - - // DisablePointerAddresses specifies whether to disable the printing of - // pointer addresses. This is useful when diffing data structures in tests. - DisablePointerAddresses bool - - // DisableCapacities specifies whether to disable the printing of capacities - // for arrays, slices, maps and channels. This is useful when diffing - // data structures in tests. - DisableCapacities bool - - // ContinueOnMethod specifies whether or not recursion should continue once - // a custom error or Stringer interface is invoked. The default, false, - // means it will print the results of invoking the custom error or Stringer - // interface and return immediately instead of continuing to recurse into - // the internals of the data type. - // - // NOTE: This flag does not have any effect if method invocation is disabled - // via the DisableMethods or DisablePointerMethods options. - ContinueOnMethod bool - - // SortKeys specifies map keys should be sorted before being printed. Use - // this to have a more deterministic, diffable output. Note that only - // native types (bool, int, uint, floats, uintptr and string) and types - // that support the error or Stringer interfaces (if methods are - // enabled) are supported, with other types sorted according to the - // reflect.Value.String() output which guarantees display stability. - SortKeys bool - - // SpewKeys specifies that, as a last resort attempt, map keys should - // be spewed to strings and sorted by those strings. This is only - // considered if SortKeys is true. - SpewKeys bool -} - -// Config is the active configuration of the top-level functions. -// The configuration can be changed by modifying the contents of spew.Config. -var Config = ConfigState{Indent: " "} - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the formatted string as a value that satisfies error. See NewFormatter -// for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, c.convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, c.convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, c.convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a Formatter interface returned by c.NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, c.convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Print(a ...interface{}) (n int, err error) { - return fmt.Print(c.convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, c.convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Println(a ...interface{}) (n int, err error) { - return fmt.Println(c.convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprint(a ...interface{}) string { - return fmt.Sprint(c.convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, c.convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a Formatter interface returned by c.NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintln(a ...interface{}) string { - return fmt.Sprintln(c.convertArgs(a)...) -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -c.Printf, c.Println, or c.Printf. -*/ -func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(c, v) -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { - fdump(c, w, a...) -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by modifying the public members -of c. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func (c *ConfigState) Dump(a ...interface{}) { - fdump(c, os.Stdout, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func (c *ConfigState) Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(c, &buf, a...) - return buf.String() -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a spew Formatter interface using -// the ConfigState associated with s. -func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = newFormatter(c, arg) - } - return formatters -} - -// NewDefaultConfig returns a ConfigState with the following default settings. -// -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false -func NewDefaultConfig() *ConfigState { - return &ConfigState{Indent: " "} -} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go deleted file mode 100644 index aacaac6f1..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/doc.go +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* -Package spew implements a deep pretty printer for Go data structures to aid in -debugging. - -A quick overview of the additional features spew provides over the built-in -printing facilities for Go data types are as follows: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) - -There are two different approaches spew allows for dumping Go data structures: - - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt - -Quick Start - -This section demonstrates how to quickly get started with spew. See the -sections below for further details on formatting and configuration options. - -To dump a variable with full newlines, indentation, type, and pointer -information use Dump, Fdump, or Sdump: - spew.Dump(myVar1, myVar2, ...) - spew.Fdump(someWriter, myVar1, myVar2, ...) - str := spew.Sdump(myVar1, myVar2, ...) - -Alternatively, if you would prefer to use format strings with a compacted inline -printing style, use the convenience wrappers Printf, Fprintf, etc with -%v (most compact), %+v (adds pointer addresses), %#v (adds types), or -%#+v (adds types and pointer addresses): - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -Configuration Options - -Configuration of spew is handled by fields in the ConfigState type. For -convenience, all of the top-level functions use a global state available -via the spew.Config global. - -It is also possible to create a ConfigState instance that provides methods -equivalent to the top-level functions. This allows concurrent configuration -options. See the ConfigState documentation for more details. - -The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. - - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. - - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. - - * DisablePointerAddresses - DisablePointerAddresses specifies whether to disable the printing of - pointer addresses. This is useful when diffing data structures in tests. - - * DisableCapacities - DisableCapacities specifies whether to disable the printing of - capacities for arrays, slices, maps and channels. This is useful when - diffing data structures in tests. - - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. - - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. - - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. - -Dump Usage - -Simply call spew.Dump with a list of variables you want to dump: - - spew.Dump(myVar1, myVar2, ...) - -You may also call spew.Fdump if you would prefer to output to an arbitrary -io.Writer. For example, to dump to standard error: - - spew.Fdump(os.Stderr, myVar1, myVar2, ...) - -A third option is to call spew.Sdump to get the formatted output as a string: - - str := spew.Sdump(myVar1, myVar2, ...) - -Sample Dump Output - -See the Dump example for details on the setup of the types and variables being -shown here. - - (main.Foo) { - unexportedField: (*main.Bar)(0xf84002e210)({ - flag: (main.Flag) flagTwo, - data: (uintptr) - }), - ExportedField: (map[interface {}]interface {}) (len=1) { - (string) (len=3) "one": (bool) true - } - } - -Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C -command as shown. - ([]uint8) (len=32 cap=32) { - 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | - 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| - 00000020 31 32 |12| - } - -Custom Formatter - -Spew provides a custom formatter that implements the fmt.Formatter interface -so that it integrates cleanly with standard fmt package printing functions. The -formatter is useful for inline printing of smaller data types similar to the -standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Custom Formatter Usage - -The simplest way to make use of the spew custom formatter is to call one of the -convenience functions such as spew.Printf, spew.Println, or spew.Printf. The -functions have syntax you are most likely already familiar with: - - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Println(myVar, myVar2) - spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -See the Index for the full list convenience functions. - -Sample Formatter Output - -Double pointer to a uint8: - %v: <**>5 - %+v: <**>(0xf8400420d0->0xf8400420c8)5 - %#v: (**uint8)5 - %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 - -Pointer to circular struct with a uint8 field and a pointer to itself: - %v: <*>{1 <*>} - %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} - %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} - %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} - -See the Printf example for details on the setup of variables being shown -here. - -Errors - -Since it is possible for custom Stringer/error interfaces to panic, spew -detects them and handles them internally by printing the panic information -inline with the output. Since spew is intended to provide deep pretty printing -capabilities on structures, it intentionally does not return any errors. -*/ -package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go deleted file mode 100644 index f78d89fc1..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "encoding/hex" - "fmt" - "io" - "os" - "reflect" - "regexp" - "strconv" - "strings" -) - -var ( - // uint8Type is a reflect.Type representing a uint8. It is used to - // convert cgo types to uint8 slices for hexdumping. - uint8Type = reflect.TypeOf(uint8(0)) - - // cCharRE is a regular expression that matches a cgo char. - // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) - - // cUnsignedCharRE is a regular expression that matches a cgo unsigned - // char. It is used to detect unsigned character arrays to hexdump - // them. - cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) - - // cUint8tCharRE is a regular expression that matches a cgo uint8_t. - // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) -) - -// dumpState contains information about the state of a dump operation. -type dumpState struct { - w io.Writer - depth int - pointers map[uintptr]int - ignoreNextType bool - ignoreNextIndent bool - cs *ConfigState -} - -// indent performs indentation according to the depth level and cs.Indent -// option. -func (d *dumpState) indent() { - if d.ignoreNextIndent { - d.ignoreNextIndent = false - return - } - d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) -} - -// unpackValue returns values inside of non-nil interfaces when possible. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface && !v.IsNil() { - v = v.Elem() - } - return v -} - -// dumpPtr handles formatting of pointers by indirecting them as necessary. -func (d *dumpState) dumpPtr(v reflect.Value) { - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range d.pointers { - if depth >= d.depth { - delete(d.pointers, k) - } - } - - // Keep list of all dereferenced pointers to show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by dereferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := d.pointers[addr]; ok && pd < d.depth { - cycleFound = true - indirects-- - break - } - d.pointers[addr] = d.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type information. - d.w.Write(openParenBytes) - d.w.Write(bytes.Repeat(asteriskBytes, indirects)) - d.w.Write([]byte(ve.Type().String())) - d.w.Write(closeParenBytes) - - // Display pointer information. - if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { - d.w.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - d.w.Write(pointerChainBytes) - } - printHexPtr(d.w, addr) - } - d.w.Write(closeParenBytes) - } - - // Display dereferenced value. - d.w.Write(openParenBytes) - switch { - case nilFound: - d.w.Write(nilAngleBytes) - - case cycleFound: - d.w.Write(circularBytes) - - default: - d.ignoreNextType = true - d.dump(ve) - } - d.w.Write(closeParenBytes) -} - -// dumpSlice handles formatting of arrays and slices. Byte (uint8 under -// reflection) arrays and slices are dumped in hexdump -C fashion. -func (d *dumpState) dumpSlice(v reflect.Value) { - // Determine whether this type should be hex dumped or not. Also, - // for types which should be hexdumped, try to use the underlying data - // first, then fall back to trying to convert them to a uint8 slice. - var buf []uint8 - doConvert := false - doHexDump := false - numEntries := v.Len() - if numEntries > 0 { - vt := v.Index(0).Type() - vts := vt.String() - switch { - // C types that need to be converted. - case cCharRE.MatchString(vts): - fallthrough - case cUnsignedCharRE.MatchString(vts): - fallthrough - case cUint8tCharRE.MatchString(vts): - doConvert = true - - // Try to use existing uint8 slices and fall back to converting - // and copying if that fails. - case vt.Kind() == reflect.Uint8: - // We need an addressable interface to convert the type - // to a byte slice. However, the reflect package won't - // give us an interface on certain things like - // unexported struct fields in order to enforce - // visibility rules. We use unsafe, when available, to - // bypass these restrictions since this package does not - // mutate the values. - vs := v - if !vs.CanInterface() || !vs.CanAddr() { - vs = unsafeReflectValue(vs) - } - if !UnsafeDisabled { - vs = vs.Slice(0, numEntries) - - // Use the existing uint8 slice if it can be - // type asserted. - iface := vs.Interface() - if slice, ok := iface.([]uint8); ok { - buf = slice - doHexDump = true - break - } - } - - // The underlying data needs to be converted if it can't - // be type asserted to a uint8 slice. - doConvert = true - } - - // Copy and convert the underlying type if needed. - if doConvert && vt.ConvertibleTo(uint8Type) { - // Convert and copy each element into a uint8 byte - // slice. - buf = make([]uint8, numEntries) - for i := 0; i < numEntries; i++ { - vv := v.Index(i) - buf[i] = uint8(vv.Convert(uint8Type).Uint()) - } - doHexDump = true - } - } - - // Hexdump the entire slice as needed. - if doHexDump { - indent := strings.Repeat(d.cs.Indent, d.depth) - str := indent + hex.Dump(buf) - str = strings.Replace(str, "\n", "\n"+indent, -1) - str = strings.TrimRight(str, d.cs.Indent) - d.w.Write([]byte(str)) - return - } - - // Recursively call dump for each item. - for i := 0; i < numEntries; i++ { - d.dump(d.unpackValue(v.Index(i))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } -} - -// dump is the main workhorse for dumping a value. It uses the passed reflect -// value to figure out what kind of object we are dealing with and formats it -// appropriately. It is a recursive function, however circular data structures -// are detected and handled properly. -func (d *dumpState) dump(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - d.w.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - d.indent() - d.dumpPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !d.ignoreNextType { - d.indent() - d.w.Write(openParenBytes) - d.w.Write([]byte(v.Type().String())) - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - d.ignoreNextType = false - - // Display length and capacity if the built-in len and cap functions - // work with the value's kind and the len/cap itself is non-zero. - valueLen, valueCap := 0, 0 - switch v.Kind() { - case reflect.Array, reflect.Slice, reflect.Chan: - valueLen, valueCap = v.Len(), v.Cap() - case reflect.Map, reflect.String: - valueLen = v.Len() - } - if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { - d.w.Write(openParenBytes) - if valueLen != 0 { - d.w.Write(lenEqualsBytes) - printInt(d.w, int64(valueLen), 10) - } - if !d.cs.DisableCapacities && valueCap != 0 { - if valueLen != 0 { - d.w.Write(spaceBytes) - } - d.w.Write(capEqualsBytes) - printInt(d.w, int64(valueCap), 10) - } - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - - // Call Stringer/error interfaces if they exist and the handle methods flag - // is enabled - if !d.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(d.cs, d.w, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(d.w, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(d.w, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(d.w, v.Uint(), 10) - - case reflect.Float32: - printFloat(d.w, v.Float(), 32) - - case reflect.Float64: - printFloat(d.w, v.Float(), 64) - - case reflect.Complex64: - printComplex(d.w, v.Complex(), 32) - - case reflect.Complex128: - printComplex(d.w, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - d.dumpSlice(v) - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.String: - d.w.Write([]byte(strconv.Quote(v.String()))) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - d.w.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - numEntries := v.Len() - keys := v.MapKeys() - if d.cs.SortKeys { - sortValues(keys, d.cs) - } - for i, key := range keys { - d.dump(d.unpackValue(key)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.MapIndex(key))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Struct: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - vt := v.Type() - numFields := v.NumField() - for i := 0; i < numFields; i++ { - d.indent() - vtf := vt.Field(i) - d.w.Write([]byte(vtf.Name)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.Field(i))) - if i < (numFields - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(d.w, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(d.w, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it in case any new - // types are added. - default: - if v.CanInterface() { - fmt.Fprintf(d.w, "%v", v.Interface()) - } else { - fmt.Fprintf(d.w, "%v", v.String()) - } - } -} - -// fdump is a helper function to consolidate the logic from the various public -// methods which take varying writers and config states. -func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { - for _, arg := range a { - if arg == nil { - w.Write(interfaceBytes) - w.Write(spaceBytes) - w.Write(nilAngleBytes) - w.Write(newlineBytes) - continue - } - - d := dumpState{w: w, cs: cs} - d.pointers = make(map[uintptr]int) - d.dump(reflect.ValueOf(arg)) - d.w.Write(newlineBytes) - } -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func Fdump(w io.Writer, a ...interface{}) { - fdump(&Config, w, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(&Config, &buf, a...) - return buf.String() -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by an exported package global, -spew.Config. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func Dump(a ...interface{}) { - fdump(&Config, os.Stdout, a...) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go deleted file mode 100644 index b04edb7d7..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// supportedFlags is a list of all the character flags supported by fmt package. -const supportedFlags = "0-+# " - -// formatState implements the fmt.Formatter interface and contains information -// about the state of a formatting operation. The NewFormatter function can -// be used to get a new Formatter which can be used directly as arguments -// in standard fmt package printing calls. -type formatState struct { - value interface{} - fs fmt.State - depth int - pointers map[uintptr]int - ignoreNextType bool - cs *ConfigState -} - -// buildDefaultFormat recreates the original format string without precision -// and width information to pass in to fmt.Sprintf in the case of an -// unrecognized type. Unless new types are added to the language, this -// function won't ever be called. -func (f *formatState) buildDefaultFormat() (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - buf.WriteRune('v') - - format = buf.String() - return format -} - -// constructOrigFormat recreates the original format string including precision -// and width information to pass along to the standard fmt package. This allows -// automatic deferral of all format strings this package doesn't support. -func (f *formatState) constructOrigFormat(verb rune) (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - if width, ok := f.fs.Width(); ok { - buf.WriteString(strconv.Itoa(width)) - } - - if precision, ok := f.fs.Precision(); ok { - buf.Write(precisionBytes) - buf.WriteString(strconv.Itoa(precision)) - } - - buf.WriteRune(verb) - - format = buf.String() - return format -} - -// unpackValue returns values inside of non-nil interfaces when possible and -// ensures that types for values which have been unpacked from an interface -// are displayed when the show types flag is also set. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (f *formatState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface { - f.ignoreNextType = false - if !v.IsNil() { - v = v.Elem() - } - } - return v -} - -// formatPtr handles formatting of pointers by indirecting them as necessary. -func (f *formatState) formatPtr(v reflect.Value) { - // Display nil if top level pointer is nil. - showTypes := f.fs.Flag('#') - if v.IsNil() && (!showTypes || f.ignoreNextType) { - f.fs.Write(nilAngleBytes) - return - } - - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range f.pointers { - if depth >= f.depth { - delete(f.pointers, k) - } - } - - // Keep list of all dereferenced pointers to possibly show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by derferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := f.pointers[addr]; ok && pd < f.depth { - cycleFound = true - indirects-- - break - } - f.pointers[addr] = f.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type or indirection level depending on flags. - if showTypes && !f.ignoreNextType { - f.fs.Write(openParenBytes) - f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) - f.fs.Write([]byte(ve.Type().String())) - f.fs.Write(closeParenBytes) - } else { - if nilFound || cycleFound { - indirects += strings.Count(ve.Type().String(), "*") - } - f.fs.Write(openAngleBytes) - f.fs.Write([]byte(strings.Repeat("*", indirects))) - f.fs.Write(closeAngleBytes) - } - - // Display pointer information depending on flags. - if f.fs.Flag('+') && (len(pointerChain) > 0) { - f.fs.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - f.fs.Write(pointerChainBytes) - } - printHexPtr(f.fs, addr) - } - f.fs.Write(closeParenBytes) - } - - // Display dereferenced value. - switch { - case nilFound: - f.fs.Write(nilAngleBytes) - - case cycleFound: - f.fs.Write(circularShortBytes) - - default: - f.ignoreNextType = true - f.format(ve) - } -} - -// format is the main workhorse for providing the Formatter interface. It -// uses the passed reflect value to figure out what kind of object we are -// dealing with and formats it appropriately. It is a recursive function, -// however circular data structures are detected and handled properly. -func (f *formatState) format(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - f.fs.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - f.formatPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !f.ignoreNextType && f.fs.Flag('#') { - f.fs.Write(openParenBytes) - f.fs.Write([]byte(v.Type().String())) - f.fs.Write(closeParenBytes) - } - f.ignoreNextType = false - - // Call Stringer/error interfaces if they exist and the handle methods - // flag is enabled. - if !f.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(f.cs, f.fs, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(f.fs, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(f.fs, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(f.fs, v.Uint(), 10) - - case reflect.Float32: - printFloat(f.fs, v.Float(), 32) - - case reflect.Float64: - printFloat(f.fs, v.Float(), 64) - - case reflect.Complex64: - printComplex(f.fs, v.Complex(), 32) - - case reflect.Complex128: - printComplex(f.fs, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - f.fs.Write(openBracketBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - numEntries := v.Len() - for i := 0; i < numEntries; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(v.Index(i))) - } - } - f.depth-- - f.fs.Write(closeBracketBytes) - - case reflect.String: - f.fs.Write([]byte(v.String())) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - f.fs.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - - f.fs.Write(openMapBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - keys := v.MapKeys() - if f.cs.SortKeys { - sortValues(keys, f.cs) - } - for i, key := range keys { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(key)) - f.fs.Write(colonBytes) - f.ignoreNextType = true - f.format(f.unpackValue(v.MapIndex(key))) - } - } - f.depth-- - f.fs.Write(closeMapBytes) - - case reflect.Struct: - numFields := v.NumField() - f.fs.Write(openBraceBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - vt := v.Type() - for i := 0; i < numFields; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - vtf := vt.Field(i) - if f.fs.Flag('+') || f.fs.Flag('#') { - f.fs.Write([]byte(vtf.Name)) - f.fs.Write(colonBytes) - } - f.format(f.unpackValue(v.Field(i))) - } - } - f.depth-- - f.fs.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(f.fs, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(f.fs, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it if any get added. - default: - format := f.buildDefaultFormat() - if v.CanInterface() { - fmt.Fprintf(f.fs, format, v.Interface()) - } else { - fmt.Fprintf(f.fs, format, v.String()) - } - } -} - -// Format satisfies the fmt.Formatter interface. See NewFormatter for usage -// details. -func (f *formatState) Format(fs fmt.State, verb rune) { - f.fs = fs - - // Use standard formatting for verbs that are not v. - if verb != 'v' { - format := f.constructOrigFormat(verb) - fmt.Fprintf(fs, format, f.value) - return - } - - if f.value == nil { - if fs.Flag('#') { - fs.Write(interfaceBytes) - } - fs.Write(nilAngleBytes) - return - } - - f.format(reflect.ValueOf(f.value)) -} - -// newFormatter is a helper function to consolidate the logic from the various -// public methods which take varying config states. -func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { - fs := &formatState{value: v, cs: cs} - fs.pointers = make(map[uintptr]int) - return fs -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -Printf, Println, or Fprintf. -*/ -func NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(&Config, v) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go deleted file mode 100644 index 32c0e3388..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/spew.go +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "fmt" - "io" -) - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the formatted string as a value that satisfies error. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a default Formatter interface returned by NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) -func Print(a ...interface{}) (n int, err error) { - return fmt.Print(convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) -func Println(a ...interface{}) (n int, err error) { - return fmt.Println(convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprint(a ...interface{}) string { - return fmt.Sprint(convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintln(a ...interface{}) string { - return fmt.Sprintln(convertArgs(a)...) -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a default spew Formatter interface. -func convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = NewFormatter(arg) - } - return formatters -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE deleted file mode 100644 index 93900695a..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009-2016 Dropbox Inc., http://www.dropbox.com/ - -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/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go deleted file mode 100644 index 9c549b60e..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package async : has no documentation (yet) -package async - -import ( - "encoding/json" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// LaunchResultBase : Result returned by methods that launch an asynchronous -// job. A method who may either launch an asynchronous job, or complete the -// request synchronously, can use this union by extending it, and adding a -// 'complete' field with the type of the synchronous response. See -// `LaunchEmptyResult` for an example. -type LaunchResultBase struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` -} - -// Valid tag values for LaunchResultBase -const ( - LaunchResultBaseAsyncJobId = "async_job_id" -) - -// UnmarshalJSON deserializes into a LaunchResultBase instance -func (u *LaunchResultBase) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - } - return nil -} - -// LaunchEmptyResult : Result returned by methods that may either launch an -// asynchronous job or complete synchronously. Upon synchronous completion of -// the job, no additional information is returned. -type LaunchEmptyResult struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` -} - -// Valid tag values for LaunchEmptyResult -const ( - LaunchEmptyResultAsyncJobId = "async_job_id" - LaunchEmptyResultComplete = "complete" -) - -// UnmarshalJSON deserializes into a LaunchEmptyResult instance -func (u *LaunchEmptyResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - } - return nil -} - -// PollArg : Arguments for methods that poll the status of an asynchronous job. -type PollArg struct { - // AsyncJobId : Id of the asynchronous job. This is the value of a response - // returned from the method that launched the job. - AsyncJobId string `json:"async_job_id"` -} - -// NewPollArg returns a new PollArg instance -func NewPollArg(AsyncJobId string) *PollArg { - s := new(PollArg) - s.AsyncJobId = AsyncJobId - return s -} - -// PollResultBase : Result returned by methods that poll for the status of an -// asynchronous job. Unions that extend this union should add a 'complete' field -// with a type of the information returned upon job completion. See -// `PollEmptyResult` for an example. -type PollResultBase struct { - dropbox.Tagged -} - -// Valid tag values for PollResultBase -const ( - PollResultBaseInProgress = "in_progress" -) - -// PollEmptyResult : Result returned by methods that poll for the status of an -// asynchronous job. Upon completion of the job, no additional information is -// returned. -type PollEmptyResult struct { - dropbox.Tagged -} - -// Valid tag values for PollEmptyResult -const ( - PollEmptyResultInProgress = "in_progress" - PollEmptyResultComplete = "complete" -) - -// PollError : Error returned by methods for polling the status of asynchronous -// job. -type PollError struct { - dropbox.Tagged -} - -// Valid tag values for PollError -const ( - PollErrorInvalidAsyncJobId = "invalid_async_job_id" - PollErrorInternalError = "internal_error" - PollErrorOther = "other" -) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go deleted file mode 100644 index ed59c3912..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package auth - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net/http" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// Client interface describes all routes in this namespace -type Client interface { - // TokenFromOauth1 : Creates an OAuth 2.0 access token from the supplied - // OAuth 1.0 access token. - TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error) - // TokenRevoke : Disables the access token used to authenticate the call. - TokenRevoke() (err error) -} - -type apiImpl dropbox.Context - -//TokenFromOauth1APIError is an error-wrapper for the token/from_oauth1 route -type TokenFromOauth1APIError struct { - dropbox.APIError - EndpointError *TokenFromOAuth1Error `json:"error"` -} - -func (dbx *apiImpl) TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "auth", "token/from_oauth1", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TokenFromOauth1APIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TokenRevokeAPIError is an error-wrapper for the token/revoke route -type TokenRevokeAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) TokenRevoke() (err error) { - cli := dbx.Client - - headers := map[string]string{} - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "auth", "token/revoke", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TokenRevokeAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -// New returns a Client implementation for this namespace -func New(c dropbox.Config) Client { - ctx := apiImpl(dropbox.NewContext(c)) - return &ctx -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go deleted file mode 100644 index 88564d9ae..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go +++ /dev/null @@ -1,67 +0,0 @@ -package auth - -import ( - "encoding/json" - "mime" - "net/http" - "strconv" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// AuthAPIError wraps AuthError -type AuthAPIError struct { - dropbox.APIError - AuthError *AuthError `json:"error"` -} - -// AccessAPIError wraps AccessError -type AccessAPIError struct { - dropbox.APIError - AccessError *AccessError `json:"error"` -} - -// RateLimitAPIError wraps RateLimitError -type RateLimitAPIError struct { - dropbox.APIError - RateLimitError *RateLimitError `json:"error"` -} - -// HandleCommonAuthErrors handles common authentication errors -func HandleCommonAuthErrors(c dropbox.Config, resp *http.Response, body []byte) error { - switch resp.StatusCode { - case http.StatusUnauthorized: - var apiError AuthAPIError - if err := json.Unmarshal(body, &apiError); err != nil { - c.LogDebug("Error unmarshaling '%s' into JSON", body) - return err - } - return apiError - case http.StatusForbidden: - var apiError AccessAPIError - if err := json.Unmarshal(body, &apiError); err != nil { - c.LogDebug("Error unmarshaling '%s' into JSON", body) - return err - } - return apiError - case http.StatusTooManyRequests: - var apiError RateLimitAPIError - // Check content-type - contentType, _, _ := mime.ParseMediaType(resp.Header.Get("content-type")) - if contentType == "application/json" { - if err := json.Unmarshal(body, &apiError); err != nil { - c.LogDebug("Error unmarshaling '%s' into JSON", body) - return err - } - } else { // assume plain text - apiError.ErrorSummary = string(body) - reason := RateLimitReason{dropbox.Tagged{Tag: RateLimitReasonTooManyRequests}} - apiError.RateLimitError = NewRateLimitError(&reason) - timeout, _ := strconv.ParseInt(resp.Header.Get("retry-after"), 10, 64) - apiError.RateLimitError.RetryAfter = uint64(timeout) - } - return apiError - default: - return nil - } -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go deleted file mode 100644 index 65806a23c..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package auth : has no documentation (yet) -package auth - -import ( - "encoding/json" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// AccessError : Error occurred because the account doesn't have permission to -// access the resource. -type AccessError struct { - dropbox.Tagged - // InvalidAccountType : Current account type cannot access the resource. - InvalidAccountType *InvalidAccountTypeError `json:"invalid_account_type,omitempty"` - // PaperAccessDenied : Current account cannot access Paper. - PaperAccessDenied *PaperAccessError `json:"paper_access_denied,omitempty"` -} - -// Valid tag values for AccessError -const ( - AccessErrorInvalidAccountType = "invalid_account_type" - AccessErrorPaperAccessDenied = "paper_access_denied" - AccessErrorOther = "other" -) - -// UnmarshalJSON deserializes into a AccessError instance -func (u *AccessError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // InvalidAccountType : Current account type cannot access the resource. - InvalidAccountType *InvalidAccountTypeError `json:"invalid_account_type,omitempty"` - // PaperAccessDenied : Current account cannot access Paper. - PaperAccessDenied *PaperAccessError `json:"paper_access_denied,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "invalid_account_type": - u.InvalidAccountType = w.InvalidAccountType - - if err != nil { - return err - } - case "paper_access_denied": - u.PaperAccessDenied = w.PaperAccessDenied - - if err != nil { - return err - } - } - return nil -} - -// AuthError : Errors occurred during authentication. -type AuthError struct { - dropbox.Tagged - // MissingScope : The access token does not have the required scope to - // access the route. - MissingScope *TokenScopeError `json:"missing_scope,omitempty"` -} - -// Valid tag values for AuthError -const ( - AuthErrorInvalidAccessToken = "invalid_access_token" - AuthErrorInvalidSelectUser = "invalid_select_user" - AuthErrorInvalidSelectAdmin = "invalid_select_admin" - AuthErrorUserSuspended = "user_suspended" - AuthErrorExpiredAccessToken = "expired_access_token" - AuthErrorMissingScope = "missing_scope" - AuthErrorOther = "other" -) - -// UnmarshalJSON deserializes into a AuthError instance -func (u *AuthError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "missing_scope": - err = json.Unmarshal(body, &u.MissingScope) - - if err != nil { - return err - } - } - return nil -} - -// InvalidAccountTypeError : has no documentation (yet) -type InvalidAccountTypeError struct { - dropbox.Tagged -} - -// Valid tag values for InvalidAccountTypeError -const ( - InvalidAccountTypeErrorEndpoint = "endpoint" - InvalidAccountTypeErrorFeature = "feature" - InvalidAccountTypeErrorOther = "other" -) - -// PaperAccessError : has no documentation (yet) -type PaperAccessError struct { - dropbox.Tagged -} - -// Valid tag values for PaperAccessError -const ( - PaperAccessErrorPaperDisabled = "paper_disabled" - PaperAccessErrorNotPaperUser = "not_paper_user" - PaperAccessErrorOther = "other" -) - -// RateLimitError : Error occurred because the app is being rate limited. -type RateLimitError struct { - // Reason : The reason why the app is being rate limited. - Reason *RateLimitReason `json:"reason"` - // RetryAfter : The number of seconds that the app should wait before making - // another request. - RetryAfter uint64 `json:"retry_after"` -} - -// NewRateLimitError returns a new RateLimitError instance -func NewRateLimitError(Reason *RateLimitReason) *RateLimitError { - s := new(RateLimitError) - s.Reason = Reason - s.RetryAfter = 1 - return s -} - -// RateLimitReason : has no documentation (yet) -type RateLimitReason struct { - dropbox.Tagged -} - -// Valid tag values for RateLimitReason -const ( - RateLimitReasonTooManyRequests = "too_many_requests" - RateLimitReasonTooManyWriteOperations = "too_many_write_operations" - RateLimitReasonOther = "other" -) - -// TokenFromOAuth1Arg : has no documentation (yet) -type TokenFromOAuth1Arg struct { - // Oauth1Token : The supplied OAuth 1.0 access token. - Oauth1Token string `json:"oauth1_token"` - // Oauth1TokenSecret : The token secret associated with the supplied access - // token. - Oauth1TokenSecret string `json:"oauth1_token_secret"` -} - -// NewTokenFromOAuth1Arg returns a new TokenFromOAuth1Arg instance -func NewTokenFromOAuth1Arg(Oauth1Token string, Oauth1TokenSecret string) *TokenFromOAuth1Arg { - s := new(TokenFromOAuth1Arg) - s.Oauth1Token = Oauth1Token - s.Oauth1TokenSecret = Oauth1TokenSecret - return s -} - -// TokenFromOAuth1Error : has no documentation (yet) -type TokenFromOAuth1Error struct { - dropbox.Tagged -} - -// Valid tag values for TokenFromOAuth1Error -const ( - TokenFromOAuth1ErrorInvalidOauth1TokenInfo = "invalid_oauth1_token_info" - TokenFromOAuth1ErrorAppIdMismatch = "app_id_mismatch" - TokenFromOAuth1ErrorOther = "other" -) - -// TokenFromOAuth1Result : has no documentation (yet) -type TokenFromOAuth1Result struct { - // Oauth2Token : The OAuth 2.0 token generated from the supplied OAuth 1.0 - // token. - Oauth2Token string `json:"oauth2_token"` -} - -// NewTokenFromOAuth1Result returns a new TokenFromOAuth1Result instance -func NewTokenFromOAuth1Result(Oauth2Token string) *TokenFromOAuth1Result { - s := new(TokenFromOAuth1Result) - s.Oauth2Token = Oauth2Token - return s -} - -// TokenScopeError : has no documentation (yet) -type TokenScopeError struct { - // RequiredScope : The required scope to access the route. - RequiredScope string `json:"required_scope"` -} - -// NewTokenScopeError returns a new TokenScopeError instance -func NewTokenScopeError(RequiredScope string) *TokenScopeError { - s := new(TokenScopeError) - s.RequiredScope = RequiredScope - return s -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go deleted file mode 100644 index 2b2313ae9..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package common : has no documentation (yet) -package common - -import ( - "encoding/json" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// PathRoot : has no documentation (yet) -type PathRoot struct { - dropbox.Tagged - // Root : Paths are relative to the authenticating user's root namespace - // (This results in `PathRootError.invalid_root` if the user's root - // namespace has changed.). - Root string `json:"root,omitempty"` - // NamespaceId : Paths are relative to given namespace id (This results in - // `PathRootError.no_permission` if you don't have access to this - // namespace.). - NamespaceId string `json:"namespace_id,omitempty"` -} - -// Valid tag values for PathRoot -const ( - PathRootHome = "home" - PathRootRoot = "root" - PathRootNamespaceId = "namespace_id" - PathRootOther = "other" -) - -// UnmarshalJSON deserializes into a PathRoot instance -func (u *PathRoot) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Root : Paths are relative to the authenticating user's root namespace - // (This results in `PathRootError.invalid_root` if the user's root - // namespace has changed.). - Root string `json:"root,omitempty"` - // NamespaceId : Paths are relative to given namespace id (This results - // in `PathRootError.no_permission` if you don't have access to this - // namespace.). - NamespaceId string `json:"namespace_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "root": - u.Root = w.Root - - if err != nil { - return err - } - case "namespace_id": - u.NamespaceId = w.NamespaceId - - if err != nil { - return err - } - } - return nil -} - -// PathRootError : has no documentation (yet) -type PathRootError struct { - dropbox.Tagged - // InvalidRoot : The root namespace id in Dropbox-API-Path-Root header is - // not valid. The value of this error is use's latest root info. - InvalidRoot IsRootInfo `json:"invalid_root,omitempty"` -} - -// Valid tag values for PathRootError -const ( - PathRootErrorInvalidRoot = "invalid_root" - PathRootErrorNoPermission = "no_permission" - PathRootErrorOther = "other" -) - -// UnmarshalJSON deserializes into a PathRootError instance -func (u *PathRootError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // InvalidRoot : The root namespace id in Dropbox-API-Path-Root header - // is not valid. The value of this error is use's latest root info. - InvalidRoot json.RawMessage `json:"invalid_root,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "invalid_root": - u.InvalidRoot, err = IsRootInfoFromJSON(w.InvalidRoot) - - if err != nil { - return err - } - } - return nil -} - -// RootInfo : Information about current user's root. -type RootInfo struct { - // RootNamespaceId : The namespace ID for user's root namespace. It will be - // the namespace ID of the shared team root if the user is member of a team - // with a separate team root. Otherwise it will be same as - // `RootInfo.home_namespace_id`. - RootNamespaceId string `json:"root_namespace_id"` - // HomeNamespaceId : The namespace ID for user's home namespace. - HomeNamespaceId string `json:"home_namespace_id"` -} - -// NewRootInfo returns a new RootInfo instance -func NewRootInfo(RootNamespaceId string, HomeNamespaceId string) *RootInfo { - s := new(RootInfo) - s.RootNamespaceId = RootNamespaceId - s.HomeNamespaceId = HomeNamespaceId - return s -} - -// IsRootInfo is the interface type for RootInfo and its subtypes -type IsRootInfo interface { - IsRootInfo() -} - -// IsRootInfo implements the IsRootInfo interface -func (u *RootInfo) IsRootInfo() {} - -type rootInfoUnion struct { - dropbox.Tagged - // Team : has no documentation (yet) - Team *TeamRootInfo `json:"team,omitempty"` - // User : has no documentation (yet) - User *UserRootInfo `json:"user,omitempty"` -} - -// Valid tag values for RootInfo -const ( - RootInfoTeam = "team" - RootInfoUser = "user" -) - -// UnmarshalJSON deserializes into a rootInfoUnion instance -func (u *rootInfoUnion) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "team": - err = json.Unmarshal(body, &u.Team) - - if err != nil { - return err - } - case "user": - err = json.Unmarshal(body, &u.User) - - if err != nil { - return err - } - } - return nil -} - -// IsRootInfoFromJSON converts JSON to a concrete IsRootInfo instance -func IsRootInfoFromJSON(data []byte) (IsRootInfo, error) { - var t rootInfoUnion - if err := json.Unmarshal(data, &t); err != nil { - return nil, err - } - switch t.Tag { - case "team": - return t.Team, nil - - case "user": - return t.User, nil - - } - return nil, nil -} - -// TeamRootInfo : Root info when user is member of a team with a separate root -// namespace ID. -type TeamRootInfo struct { - RootInfo - // HomePath : The path for user's home directory under the shared team root. - HomePath string `json:"home_path"` -} - -// NewTeamRootInfo returns a new TeamRootInfo instance -func NewTeamRootInfo(RootNamespaceId string, HomeNamespaceId string, HomePath string) *TeamRootInfo { - s := new(TeamRootInfo) - s.RootNamespaceId = RootNamespaceId - s.HomeNamespaceId = HomeNamespaceId - s.HomePath = HomePath - return s -} - -// UserRootInfo : Root info when user is not member of a team or the user is a -// member of a team and the team does not have a separate root namespace. -type UserRootInfo struct { - RootInfo -} - -// NewUserRootInfo returns a new UserRootInfo instance -func NewUserRootInfo(RootNamespaceId string, HomeNamespaceId string) *UserRootInfo { - s := new(UserRootInfo) - s.RootNamespaceId = RootNamespaceId - s.HomeNamespaceId = HomeNamespaceId - return s -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go deleted file mode 100644 index 3679002c4..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go +++ /dev/null @@ -1,1105 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package file_properties - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net/http" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth" -) - -// Client interface describes all routes in this namespace -type Client interface { - // PropertiesAdd : Add property groups to a Dropbox file. See - // `templatesAddForUser` or `templatesAddForTeam` to create new templates. - PropertiesAdd(arg *AddPropertiesArg) (err error) - // PropertiesOverwrite : Overwrite property groups associated with a file. - // This endpoint should be used instead of `propertiesUpdate` when property - // groups are being updated via a "snapshot" instead of via a "delta". In - // other words, this endpoint will delete all omitted fields from a property - // group, whereas `propertiesUpdate` will only delete fields that are - // explicitly marked for deletion. - PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err error) - // PropertiesRemove : Permanently removes the specified property group from - // the file. To remove specific property field key value pairs, see - // `propertiesUpdate`. To update a template, see `templatesUpdateForUser` or - // `templatesUpdateForTeam`. To remove a template, see - // `templatesRemoveForUser` or `templatesRemoveForTeam`. - PropertiesRemove(arg *RemovePropertiesArg) (err error) - // PropertiesSearch : Search across property templates for particular - // property field values. - PropertiesSearch(arg *PropertiesSearchArg) (res *PropertiesSearchResult, err error) - // PropertiesSearchContinue : Once a cursor has been retrieved from - // `propertiesSearch`, use this to paginate through all search results. - PropertiesSearchContinue(arg *PropertiesSearchContinueArg) (res *PropertiesSearchResult, err error) - // PropertiesUpdate : Add, update or remove properties associated with the - // supplied file and templates. This endpoint should be used instead of - // `propertiesOverwrite` when property groups are being updated via a - // "delta" instead of via a "snapshot" . In other words, this endpoint will - // not delete any omitted fields from a property group, whereas - // `propertiesOverwrite` will delete any fields that are omitted from a - // property group. - PropertiesUpdate(arg *UpdatePropertiesArg) (err error) - // TemplatesAddForTeam : Add a template associated with a team. See - // `propertiesAdd` to add properties to a file or folder. Note: this - // endpoint will create team-owned templates. - TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateResult, err error) - // TemplatesAddForUser : Add a template associated with a user. See - // `propertiesAdd` to add properties to a file. This endpoint can't be - // called on a team member or admin's behalf. - TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateResult, err error) - // TemplatesGetForTeam : Get the schema for a specified template. - TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateResult, err error) - // TemplatesGetForUser : Get the schema for a specified template. This - // endpoint can't be called on a team member or admin's behalf. - TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateResult, err error) - // TemplatesListForTeam : Get the template identifiers for a team. To get - // the schema of each template use `templatesGetForTeam`. - TemplatesListForTeam() (res *ListTemplateResult, err error) - // TemplatesListForUser : Get the template identifiers for a team. To get - // the schema of each template use `templatesGetForUser`. This endpoint - // can't be called on a team member or admin's behalf. - TemplatesListForUser() (res *ListTemplateResult, err error) - // TemplatesRemoveForTeam : Permanently removes the specified template - // created from `templatesAddForUser`. All properties associated with the - // template will also be removed. This action cannot be undone. - TemplatesRemoveForTeam(arg *RemoveTemplateArg) (err error) - // TemplatesRemoveForUser : Permanently removes the specified template - // created from `templatesAddForUser`. All properties associated with the - // template will also be removed. This action cannot be undone. - TemplatesRemoveForUser(arg *RemoveTemplateArg) (err error) - // TemplatesUpdateForTeam : Update a template associated with a team. This - // route can update the template name, the template description and add - // optional properties to templates. - TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error) - // TemplatesUpdateForUser : Update a template associated with a user. This - // route can update the template name, the template description and add - // optional properties to templates. This endpoint can't be called on a team - // member or admin's behalf. - TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error) -} - -type apiImpl dropbox.Context - -//PropertiesAddAPIError is an error-wrapper for the properties/add route -type PropertiesAddAPIError struct { - dropbox.APIError - EndpointError *AddPropertiesError `json:"error"` -} - -func (dbx *apiImpl) PropertiesAdd(arg *AddPropertiesArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "properties/add", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesAddAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesOverwriteAPIError is an error-wrapper for the properties/overwrite route -type PropertiesOverwriteAPIError struct { - dropbox.APIError - EndpointError *InvalidPropertyGroupError `json:"error"` -} - -func (dbx *apiImpl) PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "properties/overwrite", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesOverwriteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesRemoveAPIError is an error-wrapper for the properties/remove route -type PropertiesRemoveAPIError struct { - dropbox.APIError - EndpointError *RemovePropertiesError `json:"error"` -} - -func (dbx *apiImpl) PropertiesRemove(arg *RemovePropertiesArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "properties/remove", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesRemoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesSearchAPIError is an error-wrapper for the properties/search route -type PropertiesSearchAPIError struct { - dropbox.APIError - EndpointError *PropertiesSearchError `json:"error"` -} - -func (dbx *apiImpl) PropertiesSearch(arg *PropertiesSearchArg) (res *PropertiesSearchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "properties/search", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesSearchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesSearchContinueAPIError is an error-wrapper for the properties/search/continue route -type PropertiesSearchContinueAPIError struct { - dropbox.APIError - EndpointError *PropertiesSearchContinueError `json:"error"` -} - -func (dbx *apiImpl) PropertiesSearchContinue(arg *PropertiesSearchContinueArg) (res *PropertiesSearchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "properties/search/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesSearchContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesUpdateAPIError is an error-wrapper for the properties/update route -type PropertiesUpdateAPIError struct { - dropbox.APIError - EndpointError *UpdatePropertiesError `json:"error"` -} - -func (dbx *apiImpl) PropertiesUpdate(arg *UpdatePropertiesArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "properties/update", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesUpdateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesAddForTeamAPIError is an error-wrapper for the templates/add_for_team route -type TemplatesAddForTeamAPIError struct { - dropbox.APIError - EndpointError *ModifyTemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/add_for_team", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesAddForTeamAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesAddForUserAPIError is an error-wrapper for the templates/add_for_user route -type TemplatesAddForUserAPIError struct { - dropbox.APIError - EndpointError *ModifyTemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/add_for_user", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesAddForUserAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesGetForTeamAPIError is an error-wrapper for the templates/get_for_team route -type TemplatesGetForTeamAPIError struct { - dropbox.APIError - EndpointError *TemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/get_for_team", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesGetForTeamAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesGetForUserAPIError is an error-wrapper for the templates/get_for_user route -type TemplatesGetForUserAPIError struct { - dropbox.APIError - EndpointError *TemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/get_for_user", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesGetForUserAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesListForTeamAPIError is an error-wrapper for the templates/list_for_team route -type TemplatesListForTeamAPIError struct { - dropbox.APIError - EndpointError *TemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesListForTeam() (res *ListTemplateResult, err error) { - cli := dbx.Client - - headers := map[string]string{} - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/list_for_team", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesListForTeamAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesListForUserAPIError is an error-wrapper for the templates/list_for_user route -type TemplatesListForUserAPIError struct { - dropbox.APIError - EndpointError *TemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesListForUser() (res *ListTemplateResult, err error) { - cli := dbx.Client - - headers := map[string]string{} - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/list_for_user", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesListForUserAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesRemoveForTeamAPIError is an error-wrapper for the templates/remove_for_team route -type TemplatesRemoveForTeamAPIError struct { - dropbox.APIError - EndpointError *TemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesRemoveForTeam(arg *RemoveTemplateArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/remove_for_team", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesRemoveForTeamAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesRemoveForUserAPIError is an error-wrapper for the templates/remove_for_user route -type TemplatesRemoveForUserAPIError struct { - dropbox.APIError - EndpointError *TemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesRemoveForUser(arg *RemoveTemplateArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/remove_for_user", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesRemoveForUserAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesUpdateForTeamAPIError is an error-wrapper for the templates/update_for_team route -type TemplatesUpdateForTeamAPIError struct { - dropbox.APIError - EndpointError *ModifyTemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/update_for_team", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesUpdateForTeamAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TemplatesUpdateForUserAPIError is an error-wrapper for the templates/update_for_user route -type TemplatesUpdateForUserAPIError struct { - dropbox.APIError - EndpointError *ModifyTemplateError `json:"error"` -} - -func (dbx *apiImpl) TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "file_properties", "templates/update_for_user", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TemplatesUpdateForUserAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -// New returns a Client implementation for this namespace -func New(c dropbox.Config) Client { - ctx := apiImpl(dropbox.NewContext(c)) - return &ctx -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/types.go deleted file mode 100644 index 58b896717..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/types.go +++ /dev/null @@ -1,1040 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package file_properties : This namespace contains helpers for property and -// template metadata endpoints. These endpoints enable you to tag arbitrary -// key/value data to Dropbox files. The most basic unit in this namespace is -// the `PropertyField`. These fields encapsulate the actual key/value data. -// Fields are added to a Dropbox file using a `PropertyGroup`. Property groups -// contain a reference to a Dropbox file and a `PropertyGroupTemplate`. Property -// groups are uniquely identified by the combination of their associated Dropbox -// file and template. The `PropertyGroupTemplate` is a way of restricting the -// possible key names and value types of the data within a property group. The -// possible key names and value types are explicitly enumerated using -// `PropertyFieldTemplate` objects. You can think of a property group template -// as a class definition for a particular key/value metadata object, and the -// property groups themselves as the instantiations of these objects. Templates -// are owned either by a user/app pair or team/app pair. Templates and their -// associated properties can't be accessed by any app other than the app that -// created them, and even then, only when the app is linked with the owner of -// the template (either a user or team). User-owned templates are accessed via -// the user-auth file_properties/templates/*_for_user endpoints, while -// team-owned templates are accessed via the team-auth -// file_properties/templates/*_for_team endpoints. Properties associated with -// either type of template can be accessed via the user-auth properties/* -// endpoints. Finally, properties can be accessed from a number of endpoints -// that return metadata, including `files/get_metadata`, and -// `files/list_folder`. Properties can also be added during upload, using -// `files/upload`. -package file_properties - -import ( - "encoding/json" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// AddPropertiesArg : has no documentation (yet) -type AddPropertiesArg struct { - // Path : A unique identifier for the file or folder. - Path string `json:"path"` - // PropertyGroups : The property groups which are to be added to a Dropbox - // file. - PropertyGroups []*PropertyGroup `json:"property_groups"` -} - -// NewAddPropertiesArg returns a new AddPropertiesArg instance -func NewAddPropertiesArg(Path string, PropertyGroups []*PropertyGroup) *AddPropertiesArg { - s := new(AddPropertiesArg) - s.Path = Path - s.PropertyGroups = PropertyGroups - return s -} - -// TemplateError : has no documentation (yet) -type TemplateError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` -} - -// Valid tag values for TemplateError -const ( - TemplateErrorTemplateNotFound = "template_not_found" - TemplateErrorRestrictedContent = "restricted_content" - TemplateErrorOther = "other" -) - -// UnmarshalJSON deserializes into a TemplateError instance -func (u *TemplateError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - } - return nil -} - -// PropertiesError : has no documentation (yet) -type PropertiesError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for PropertiesError -const ( - PropertiesErrorTemplateNotFound = "template_not_found" - PropertiesErrorRestrictedContent = "restricted_content" - PropertiesErrorOther = "other" - PropertiesErrorPath = "path" - PropertiesErrorUnsupportedFolder = "unsupported_folder" -) - -// UnmarshalJSON deserializes into a PropertiesError instance -func (u *PropertiesError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// InvalidPropertyGroupError : has no documentation (yet) -type InvalidPropertyGroupError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for InvalidPropertyGroupError -const ( - InvalidPropertyGroupErrorTemplateNotFound = "template_not_found" - InvalidPropertyGroupErrorRestrictedContent = "restricted_content" - InvalidPropertyGroupErrorOther = "other" - InvalidPropertyGroupErrorPath = "path" - InvalidPropertyGroupErrorUnsupportedFolder = "unsupported_folder" - InvalidPropertyGroupErrorPropertyFieldTooLarge = "property_field_too_large" - InvalidPropertyGroupErrorDoesNotFitTemplate = "does_not_fit_template" -) - -// UnmarshalJSON deserializes into a InvalidPropertyGroupError instance -func (u *InvalidPropertyGroupError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// AddPropertiesError : has no documentation (yet) -type AddPropertiesError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for AddPropertiesError -const ( - AddPropertiesErrorTemplateNotFound = "template_not_found" - AddPropertiesErrorRestrictedContent = "restricted_content" - AddPropertiesErrorOther = "other" - AddPropertiesErrorPath = "path" - AddPropertiesErrorUnsupportedFolder = "unsupported_folder" - AddPropertiesErrorPropertyFieldTooLarge = "property_field_too_large" - AddPropertiesErrorDoesNotFitTemplate = "does_not_fit_template" - AddPropertiesErrorPropertyGroupAlreadyExists = "property_group_already_exists" -) - -// UnmarshalJSON deserializes into a AddPropertiesError instance -func (u *AddPropertiesError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// PropertyGroupTemplate : Defines how a property group may be structured. -type PropertyGroupTemplate struct { - // Name : Display name for the template. Template names can be up to 256 - // bytes. - Name string `json:"name"` - // Description : Description for the template. Template descriptions can be - // up to 1024 bytes. - Description string `json:"description"` - // Fields : Definitions of the property fields associated with this - // template. There can be up to 32 properties in a single template. - Fields []*PropertyFieldTemplate `json:"fields"` -} - -// NewPropertyGroupTemplate returns a new PropertyGroupTemplate instance -func NewPropertyGroupTemplate(Name string, Description string, Fields []*PropertyFieldTemplate) *PropertyGroupTemplate { - s := new(PropertyGroupTemplate) - s.Name = Name - s.Description = Description - s.Fields = Fields - return s -} - -// AddTemplateArg : has no documentation (yet) -type AddTemplateArg struct { - PropertyGroupTemplate -} - -// NewAddTemplateArg returns a new AddTemplateArg instance -func NewAddTemplateArg(Name string, Description string, Fields []*PropertyFieldTemplate) *AddTemplateArg { - s := new(AddTemplateArg) - s.Name = Name - s.Description = Description - s.Fields = Fields - return s -} - -// AddTemplateResult : has no documentation (yet) -type AddTemplateResult struct { - // TemplateId : An identifier for template added by See - // `templatesAddForUser` or `templatesAddForTeam`. - TemplateId string `json:"template_id"` -} - -// NewAddTemplateResult returns a new AddTemplateResult instance -func NewAddTemplateResult(TemplateId string) *AddTemplateResult { - s := new(AddTemplateResult) - s.TemplateId = TemplateId - return s -} - -// GetTemplateArg : has no documentation (yet) -type GetTemplateArg struct { - // TemplateId : An identifier for template added by route See - // `templatesAddForUser` or `templatesAddForTeam`. - TemplateId string `json:"template_id"` -} - -// NewGetTemplateArg returns a new GetTemplateArg instance -func NewGetTemplateArg(TemplateId string) *GetTemplateArg { - s := new(GetTemplateArg) - s.TemplateId = TemplateId - return s -} - -// GetTemplateResult : has no documentation (yet) -type GetTemplateResult struct { - PropertyGroupTemplate -} - -// NewGetTemplateResult returns a new GetTemplateResult instance -func NewGetTemplateResult(Name string, Description string, Fields []*PropertyFieldTemplate) *GetTemplateResult { - s := new(GetTemplateResult) - s.Name = Name - s.Description = Description - s.Fields = Fields - return s -} - -// ListTemplateResult : has no documentation (yet) -type ListTemplateResult struct { - // TemplateIds : List of identifiers for templates added by See - // `templatesAddForUser` or `templatesAddForTeam`. - TemplateIds []string `json:"template_ids"` -} - -// NewListTemplateResult returns a new ListTemplateResult instance -func NewListTemplateResult(TemplateIds []string) *ListTemplateResult { - s := new(ListTemplateResult) - s.TemplateIds = TemplateIds - return s -} - -// LogicalOperator : Logical operator to join search queries together. -type LogicalOperator struct { - dropbox.Tagged -} - -// Valid tag values for LogicalOperator -const ( - LogicalOperatorOrOperator = "or_operator" - LogicalOperatorOther = "other" -) - -// LookUpPropertiesError : has no documentation (yet) -type LookUpPropertiesError struct { - dropbox.Tagged -} - -// Valid tag values for LookUpPropertiesError -const ( - LookUpPropertiesErrorPropertyGroupNotFound = "property_group_not_found" - LookUpPropertiesErrorOther = "other" -) - -// LookupError : has no documentation (yet) -type LookupError struct { - dropbox.Tagged - // MalformedPath : has no documentation (yet) - MalformedPath string `json:"malformed_path,omitempty"` -} - -// Valid tag values for LookupError -const ( - LookupErrorMalformedPath = "malformed_path" - LookupErrorNotFound = "not_found" - LookupErrorNotFile = "not_file" - LookupErrorNotFolder = "not_folder" - LookupErrorRestrictedContent = "restricted_content" - LookupErrorOther = "other" -) - -// UnmarshalJSON deserializes into a LookupError instance -func (u *LookupError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // MalformedPath : has no documentation (yet) - MalformedPath string `json:"malformed_path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "malformed_path": - u.MalformedPath = w.MalformedPath - - if err != nil { - return err - } - } - return nil -} - -// ModifyTemplateError : has no documentation (yet) -type ModifyTemplateError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` -} - -// Valid tag values for ModifyTemplateError -const ( - ModifyTemplateErrorTemplateNotFound = "template_not_found" - ModifyTemplateErrorRestrictedContent = "restricted_content" - ModifyTemplateErrorOther = "other" - ModifyTemplateErrorConflictingPropertyNames = "conflicting_property_names" - ModifyTemplateErrorTooManyProperties = "too_many_properties" - ModifyTemplateErrorTooManyTemplates = "too_many_templates" - ModifyTemplateErrorTemplateAttributeTooLarge = "template_attribute_too_large" -) - -// UnmarshalJSON deserializes into a ModifyTemplateError instance -func (u *ModifyTemplateError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - } - return nil -} - -// OverwritePropertyGroupArg : has no documentation (yet) -type OverwritePropertyGroupArg struct { - // Path : A unique identifier for the file or folder. - Path string `json:"path"` - // PropertyGroups : The property groups "snapshot" updates to force apply. - PropertyGroups []*PropertyGroup `json:"property_groups"` -} - -// NewOverwritePropertyGroupArg returns a new OverwritePropertyGroupArg instance -func NewOverwritePropertyGroupArg(Path string, PropertyGroups []*PropertyGroup) *OverwritePropertyGroupArg { - s := new(OverwritePropertyGroupArg) - s.Path = Path - s.PropertyGroups = PropertyGroups - return s -} - -// PropertiesSearchArg : has no documentation (yet) -type PropertiesSearchArg struct { - // Queries : Queries to search. - Queries []*PropertiesSearchQuery `json:"queries"` - // TemplateFilter : Filter results to contain only properties associated - // with these template IDs. - TemplateFilter *TemplateFilter `json:"template_filter"` -} - -// NewPropertiesSearchArg returns a new PropertiesSearchArg instance -func NewPropertiesSearchArg(Queries []*PropertiesSearchQuery) *PropertiesSearchArg { - s := new(PropertiesSearchArg) - s.Queries = Queries - s.TemplateFilter = &TemplateFilter{Tagged: dropbox.Tagged{"filter_none"}} - return s -} - -// PropertiesSearchContinueArg : has no documentation (yet) -type PropertiesSearchContinueArg struct { - // Cursor : The cursor returned by your last call to `propertiesSearch` or - // `propertiesSearchContinue`. - Cursor string `json:"cursor"` -} - -// NewPropertiesSearchContinueArg returns a new PropertiesSearchContinueArg instance -func NewPropertiesSearchContinueArg(Cursor string) *PropertiesSearchContinueArg { - s := new(PropertiesSearchContinueArg) - s.Cursor = Cursor - return s -} - -// PropertiesSearchContinueError : has no documentation (yet) -type PropertiesSearchContinueError struct { - dropbox.Tagged -} - -// Valid tag values for PropertiesSearchContinueError -const ( - PropertiesSearchContinueErrorReset = "reset" - PropertiesSearchContinueErrorOther = "other" -) - -// PropertiesSearchError : has no documentation (yet) -type PropertiesSearchError struct { - dropbox.Tagged - // PropertyGroupLookup : has no documentation (yet) - PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` -} - -// Valid tag values for PropertiesSearchError -const ( - PropertiesSearchErrorPropertyGroupLookup = "property_group_lookup" - PropertiesSearchErrorOther = "other" -) - -// UnmarshalJSON deserializes into a PropertiesSearchError instance -func (u *PropertiesSearchError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // PropertyGroupLookup : has no documentation (yet) - PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "property_group_lookup": - u.PropertyGroupLookup = w.PropertyGroupLookup - - if err != nil { - return err - } - } - return nil -} - -// PropertiesSearchMatch : has no documentation (yet) -type PropertiesSearchMatch struct { - // Id : The ID for the matched file or folder. - Id string `json:"id"` - // Path : The path for the matched file or folder. - Path string `json:"path"` - // IsDeleted : Whether the file or folder is deleted. - IsDeleted bool `json:"is_deleted"` - // PropertyGroups : List of custom property groups associated with the file. - PropertyGroups []*PropertyGroup `json:"property_groups"` -} - -// NewPropertiesSearchMatch returns a new PropertiesSearchMatch instance -func NewPropertiesSearchMatch(Id string, Path string, IsDeleted bool, PropertyGroups []*PropertyGroup) *PropertiesSearchMatch { - s := new(PropertiesSearchMatch) - s.Id = Id - s.Path = Path - s.IsDeleted = IsDeleted - s.PropertyGroups = PropertyGroups - return s -} - -// PropertiesSearchMode : has no documentation (yet) -type PropertiesSearchMode struct { - dropbox.Tagged - // FieldName : Search for a value associated with this field name. - FieldName string `json:"field_name,omitempty"` -} - -// Valid tag values for PropertiesSearchMode -const ( - PropertiesSearchModeFieldName = "field_name" - PropertiesSearchModeOther = "other" -) - -// UnmarshalJSON deserializes into a PropertiesSearchMode instance -func (u *PropertiesSearchMode) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // FieldName : Search for a value associated with this field name. - FieldName string `json:"field_name,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "field_name": - u.FieldName = w.FieldName - - if err != nil { - return err - } - } - return nil -} - -// PropertiesSearchQuery : has no documentation (yet) -type PropertiesSearchQuery struct { - // Query : The property field value for which to search across templates. - Query string `json:"query"` - // Mode : The mode with which to perform the search. - Mode *PropertiesSearchMode `json:"mode"` - // LogicalOperator : The logical operator with which to append the query. - LogicalOperator *LogicalOperator `json:"logical_operator"` -} - -// NewPropertiesSearchQuery returns a new PropertiesSearchQuery instance -func NewPropertiesSearchQuery(Query string, Mode *PropertiesSearchMode) *PropertiesSearchQuery { - s := new(PropertiesSearchQuery) - s.Query = Query - s.Mode = Mode - s.LogicalOperator = &LogicalOperator{Tagged: dropbox.Tagged{"or_operator"}} - return s -} - -// PropertiesSearchResult : has no documentation (yet) -type PropertiesSearchResult struct { - // Matches : A list (possibly empty) of matches for the query. - Matches []*PropertiesSearchMatch `json:"matches"` - // Cursor : Pass the cursor into `propertiesSearchContinue` to continue to - // receive search results. Cursor will be null when there are no more - // results. - Cursor string `json:"cursor,omitempty"` -} - -// NewPropertiesSearchResult returns a new PropertiesSearchResult instance -func NewPropertiesSearchResult(Matches []*PropertiesSearchMatch) *PropertiesSearchResult { - s := new(PropertiesSearchResult) - s.Matches = Matches - return s -} - -// PropertyField : Raw key/value data to be associated with a Dropbox file. -// Property fields are added to Dropbox files as a `PropertyGroup`. -type PropertyField struct { - // Name : Key of the property field associated with a file and template. - // Keys can be up to 256 bytes. - Name string `json:"name"` - // Value : Value of the property field associated with a file and template. - // Values can be up to 1024 bytes. - Value string `json:"value"` -} - -// NewPropertyField returns a new PropertyField instance -func NewPropertyField(Name string, Value string) *PropertyField { - s := new(PropertyField) - s.Name = Name - s.Value = Value - return s -} - -// PropertyFieldTemplate : Defines how a single property field may be -// structured. Used exclusively by `PropertyGroupTemplate`. -type PropertyFieldTemplate struct { - // Name : Key of the property field being described. Property field keys can - // be up to 256 bytes. - Name string `json:"name"` - // Description : Description of the property field. Property field - // descriptions can be up to 1024 bytes. - Description string `json:"description"` - // Type : Data type of the value of this property field. This type will be - // enforced upon property creation and modifications. - Type *PropertyType `json:"type"` -} - -// NewPropertyFieldTemplate returns a new PropertyFieldTemplate instance -func NewPropertyFieldTemplate(Name string, Description string, Type *PropertyType) *PropertyFieldTemplate { - s := new(PropertyFieldTemplate) - s.Name = Name - s.Description = Description - s.Type = Type - return s -} - -// PropertyGroup : A subset of the property fields described by the -// corresponding `PropertyGroupTemplate`. Properties are always added to a -// Dropbox file as a `PropertyGroup`. The possible key names and value types in -// this group are defined by the corresponding `PropertyGroupTemplate`. -type PropertyGroup struct { - // TemplateId : A unique identifier for the associated template. - TemplateId string `json:"template_id"` - // Fields : The actual properties associated with the template. There can be - // up to 32 property types per template. - Fields []*PropertyField `json:"fields"` -} - -// NewPropertyGroup returns a new PropertyGroup instance -func NewPropertyGroup(TemplateId string, Fields []*PropertyField) *PropertyGroup { - s := new(PropertyGroup) - s.TemplateId = TemplateId - s.Fields = Fields - return s -} - -// PropertyGroupUpdate : has no documentation (yet) -type PropertyGroupUpdate struct { - // TemplateId : A unique identifier for a property template. - TemplateId string `json:"template_id"` - // AddOrUpdateFields : Property fields to update. If the property field - // already exists, it is updated. If the property field doesn't exist, the - // property group is added. - AddOrUpdateFields []*PropertyField `json:"add_or_update_fields,omitempty"` - // RemoveFields : Property fields to remove (by name), provided they exist. - RemoveFields []string `json:"remove_fields,omitempty"` -} - -// NewPropertyGroupUpdate returns a new PropertyGroupUpdate instance -func NewPropertyGroupUpdate(TemplateId string) *PropertyGroupUpdate { - s := new(PropertyGroupUpdate) - s.TemplateId = TemplateId - return s -} - -// PropertyType : Data type of the given property field added. -type PropertyType struct { - dropbox.Tagged -} - -// Valid tag values for PropertyType -const ( - PropertyTypeString = "string" - PropertyTypeOther = "other" -) - -// RemovePropertiesArg : has no documentation (yet) -type RemovePropertiesArg struct { - // Path : A unique identifier for the file or folder. - Path string `json:"path"` - // PropertyTemplateIds : A list of identifiers for a template created by - // `templatesAddForUser` or `templatesAddForTeam`. - PropertyTemplateIds []string `json:"property_template_ids"` -} - -// NewRemovePropertiesArg returns a new RemovePropertiesArg instance -func NewRemovePropertiesArg(Path string, PropertyTemplateIds []string) *RemovePropertiesArg { - s := new(RemovePropertiesArg) - s.Path = Path - s.PropertyTemplateIds = PropertyTemplateIds - return s -} - -// RemovePropertiesError : has no documentation (yet) -type RemovePropertiesError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - // PropertyGroupLookup : has no documentation (yet) - PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` -} - -// Valid tag values for RemovePropertiesError -const ( - RemovePropertiesErrorTemplateNotFound = "template_not_found" - RemovePropertiesErrorRestrictedContent = "restricted_content" - RemovePropertiesErrorOther = "other" - RemovePropertiesErrorPath = "path" - RemovePropertiesErrorUnsupportedFolder = "unsupported_folder" - RemovePropertiesErrorPropertyGroupLookup = "property_group_lookup" -) - -// UnmarshalJSON deserializes into a RemovePropertiesError instance -func (u *RemovePropertiesError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - // PropertyGroupLookup : has no documentation (yet) - PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - case "path": - u.Path = w.Path - - if err != nil { - return err - } - case "property_group_lookup": - u.PropertyGroupLookup = w.PropertyGroupLookup - - if err != nil { - return err - } - } - return nil -} - -// RemoveTemplateArg : has no documentation (yet) -type RemoveTemplateArg struct { - // TemplateId : An identifier for a template created by - // `templatesAddForUser` or `templatesAddForTeam`. - TemplateId string `json:"template_id"` -} - -// NewRemoveTemplateArg returns a new RemoveTemplateArg instance -func NewRemoveTemplateArg(TemplateId string) *RemoveTemplateArg { - s := new(RemoveTemplateArg) - s.TemplateId = TemplateId - return s -} - -// TemplateFilterBase : has no documentation (yet) -type TemplateFilterBase struct { - dropbox.Tagged - // FilterSome : Only templates with an ID in the supplied list will be - // returned (a subset of templates will be returned). - FilterSome []string `json:"filter_some,omitempty"` -} - -// Valid tag values for TemplateFilterBase -const ( - TemplateFilterBaseFilterSome = "filter_some" - TemplateFilterBaseOther = "other" -) - -// UnmarshalJSON deserializes into a TemplateFilterBase instance -func (u *TemplateFilterBase) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // FilterSome : Only templates with an ID in the supplied list will be - // returned (a subset of templates will be returned). - FilterSome []string `json:"filter_some,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "filter_some": - u.FilterSome = w.FilterSome - - if err != nil { - return err - } - } - return nil -} - -// TemplateFilter : has no documentation (yet) -type TemplateFilter struct { - dropbox.Tagged - // FilterSome : Only templates with an ID in the supplied list will be - // returned (a subset of templates will be returned). - FilterSome []string `json:"filter_some,omitempty"` -} - -// Valid tag values for TemplateFilter -const ( - TemplateFilterFilterSome = "filter_some" - TemplateFilterOther = "other" - TemplateFilterFilterNone = "filter_none" -) - -// UnmarshalJSON deserializes into a TemplateFilter instance -func (u *TemplateFilter) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // FilterSome : Only templates with an ID in the supplied list will be - // returned (a subset of templates will be returned). - FilterSome []string `json:"filter_some,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "filter_some": - u.FilterSome = w.FilterSome - - if err != nil { - return err - } - } - return nil -} - -// TemplateOwnerType : has no documentation (yet) -type TemplateOwnerType struct { - dropbox.Tagged -} - -// Valid tag values for TemplateOwnerType -const ( - TemplateOwnerTypeUser = "user" - TemplateOwnerTypeTeam = "team" - TemplateOwnerTypeOther = "other" -) - -// UpdatePropertiesArg : has no documentation (yet) -type UpdatePropertiesArg struct { - // Path : A unique identifier for the file or folder. - Path string `json:"path"` - // UpdatePropertyGroups : The property groups "delta" updates to apply. - UpdatePropertyGroups []*PropertyGroupUpdate `json:"update_property_groups"` -} - -// NewUpdatePropertiesArg returns a new UpdatePropertiesArg instance -func NewUpdatePropertiesArg(Path string, UpdatePropertyGroups []*PropertyGroupUpdate) *UpdatePropertiesArg { - s := new(UpdatePropertiesArg) - s.Path = Path - s.UpdatePropertyGroups = UpdatePropertyGroups - return s -} - -// UpdatePropertiesError : has no documentation (yet) -type UpdatePropertiesError struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - // PropertyGroupLookup : has no documentation (yet) - PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` -} - -// Valid tag values for UpdatePropertiesError -const ( - UpdatePropertiesErrorTemplateNotFound = "template_not_found" - UpdatePropertiesErrorRestrictedContent = "restricted_content" - UpdatePropertiesErrorOther = "other" - UpdatePropertiesErrorPath = "path" - UpdatePropertiesErrorUnsupportedFolder = "unsupported_folder" - UpdatePropertiesErrorPropertyFieldTooLarge = "property_field_too_large" - UpdatePropertiesErrorDoesNotFitTemplate = "does_not_fit_template" - UpdatePropertiesErrorPropertyGroupLookup = "property_group_lookup" -) - -// UnmarshalJSON deserializes into a UpdatePropertiesError instance -func (u *UpdatePropertiesError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TemplateNotFound : Template does not exist for the given identifier. - TemplateNotFound string `json:"template_not_found,omitempty"` - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - // PropertyGroupLookup : has no documentation (yet) - PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "template_not_found": - u.TemplateNotFound = w.TemplateNotFound - - if err != nil { - return err - } - case "path": - u.Path = w.Path - - if err != nil { - return err - } - case "property_group_lookup": - u.PropertyGroupLookup = w.PropertyGroupLookup - - if err != nil { - return err - } - } - return nil -} - -// UpdateTemplateArg : has no documentation (yet) -type UpdateTemplateArg struct { - // TemplateId : An identifier for template added by See - // `templatesAddForUser` or `templatesAddForTeam`. - TemplateId string `json:"template_id"` - // Name : A display name for the template. template names can be up to 256 - // bytes. - Name string `json:"name,omitempty"` - // Description : Description for the new template. Template descriptions can - // be up to 1024 bytes. - Description string `json:"description,omitempty"` - // AddFields : Property field templates to be added to the group template. - // There can be up to 32 properties in a single template. - AddFields []*PropertyFieldTemplate `json:"add_fields,omitempty"` -} - -// NewUpdateTemplateArg returns a new UpdateTemplateArg instance -func NewUpdateTemplateArg(TemplateId string) *UpdateTemplateArg { - s := new(UpdateTemplateArg) - s.TemplateId = TemplateId - return s -} - -// UpdateTemplateResult : has no documentation (yet) -type UpdateTemplateResult struct { - // TemplateId : An identifier for template added by route See - // `templatesAddForUser` or `templatesAddForTeam`. - TemplateId string `json:"template_id"` -} - -// NewUpdateTemplateResult returns a new UpdateTemplateResult instance -func NewUpdateTemplateResult(TemplateId string) *UpdateTemplateResult { - s := new(UpdateTemplateResult) - s.TemplateId = TemplateId - return s -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go deleted file mode 100644 index c211a3832..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go +++ /dev/null @@ -1,4146 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package files - -import ( - "bytes" - "encoding/json" - "io" - "io/ioutil" - "log" - "net/http" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties" -) - -// Client interface describes all routes in this namespace -type Client interface { - // AlphaGetMetadata : Returns the metadata for a file or folder. This is an - // alpha endpoint compatible with the properties API. Note: Metadata for the - // root folder is unsupported. - // Deprecated: Use `GetMetadata` instead - AlphaGetMetadata(arg *AlphaGetMetadataArg) (res IsMetadata, err error) - // AlphaUpload : Create a new file with the contents provided in the - // request. Note that this endpoint is part of the properties API alpha and - // is slightly different from `upload`. Do not use this to upload a file - // larger than 150 MB. Instead, create an upload session with - // `uploadSessionStart`. - // Deprecated: Use `AlphaUpload` instead - AlphaUpload(arg *CommitInfoWithProperties, content io.Reader) (res *FileMetadata, err error) - // Copy : Copy a file or folder to a different location in the user's - // Dropbox. If the source path is a folder all its contents will be copied. - CopyV2(arg *RelocationArg) (res *RelocationResult, err error) - // Copy : Copy a file or folder to a different location in the user's - // Dropbox. If the source path is a folder all its contents will be copied. - // Deprecated: Use `CopyV2` instead - Copy(arg *RelocationArg) (res IsMetadata, err error) - // CopyBatch : Copy multiple files or folders to different locations at once - // in the user's Dropbox. This route will replace `copyBatch`. The main - // difference is this route will return status for each entry, while - // `copyBatch` raises failure if any entry fails. This route will either - // finish synchronously, or return a job ID and do the async copy job in - // background. Please use `copyBatchCheck` to check the job status. - CopyBatchV2(arg *RelocationBatchArgBase) (res *RelocationBatchV2Launch, err error) - // CopyBatch : Copy multiple files or folders to different locations at once - // in the user's Dropbox. If `RelocationBatchArg.allow_shared_folder` is - // false, this route is atomic. If one entry fails, the whole transaction - // will abort. If `RelocationBatchArg.allow_shared_folder` is true, - // atomicity is not guaranteed, but it allows you to copy the contents of - // shared folders to new locations. This route will return job ID - // immediately and do the async copy job in background. Please use - // `copyBatchCheck` to check the job status. - // Deprecated: Use `CopyBatchV2` instead - CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) - // CopyBatchCheck : Returns the status of an asynchronous job for - // `copyBatch`. It returns list of results for each entry. - CopyBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error) - // CopyBatchCheck : Returns the status of an asynchronous job for - // `copyBatch`. If success, it returns list of results for each entry. - // Deprecated: Use `CopyBatchCheckV2` instead - CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) - // CopyReferenceGet : Get a copy reference to a file or folder. This - // reference string can be used to save that file or folder to another - // user's Dropbox by passing it to `copyReferenceSave`. - CopyReferenceGet(arg *GetCopyReferenceArg) (res *GetCopyReferenceResult, err error) - // CopyReferenceSave : Save a copy reference returned by `copyReferenceGet` - // to the user's Dropbox. - CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyReferenceResult, err error) - // CreateFolder : Create a folder at a given path. - CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error) - // CreateFolder : Create a folder at a given path. - // Deprecated: Use `CreateFolderV2` instead - CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err error) - // CreateFolderBatch : Create multiple folders at once. This route is - // asynchronous for large batches, which returns a job ID immediately and - // runs the create folder batch asynchronously. Otherwise, creates the - // folders and returns the result synchronously for smaller inputs. You can - // force asynchronous behaviour by using the - // `CreateFolderBatchArg.force_async` flag. Use `createFolderBatchCheck` to - // check the job status. - CreateFolderBatch(arg *CreateFolderBatchArg) (res *CreateFolderBatchLaunch, err error) - // CreateFolderBatchCheck : Returns the status of an asynchronous job for - // `createFolderBatch`. If success, it returns list of result for each - // entry. - CreateFolderBatchCheck(arg *async.PollArg) (res *CreateFolderBatchJobStatus, err error) - // Delete : Delete the file or folder at a given path. If the path is a - // folder, all its contents will be deleted too. A successful response - // indicates that the file or folder was deleted. The returned metadata will - // be the corresponding `FileMetadata` or `FolderMetadata` for the item at - // time of deletion, and not a `DeletedMetadata` object. - DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) - // Delete : Delete the file or folder at a given path. If the path is a - // folder, all its contents will be deleted too. A successful response - // indicates that the file or folder was deleted. The returned metadata will - // be the corresponding `FileMetadata` or `FolderMetadata` for the item at - // time of deletion, and not a `DeletedMetadata` object. - // Deprecated: Use `DeleteV2` instead - Delete(arg *DeleteArg) (res IsMetadata, err error) - // DeleteBatch : Delete multiple files/folders at once. This route is - // asynchronous, which returns a job ID immediately and runs the delete - // batch asynchronously. Use `deleteBatchCheck` to check the job status. - DeleteBatch(arg *DeleteBatchArg) (res *DeleteBatchLaunch, err error) - // DeleteBatchCheck : Returns the status of an asynchronous job for - // `deleteBatch`. If success, it returns list of result for each entry. - DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobStatus, err error) - // Download : Download a file from a user's Dropbox. - Download(arg *DownloadArg) (res *FileMetadata, content io.ReadCloser, err error) - // DownloadZip : Download a folder from the user's Dropbox, as a zip file. - // The folder must be less than 20 GB in size and have fewer than 10,000 - // total files. The input cannot be a single file. Any single file must be - // less than 4GB in size. - DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, content io.ReadCloser, err error) - // Export : Export a file from a user's Dropbox. This route only supports - // exporting files that cannot be downloaded directly and whose - // `ExportResult.file_metadata` has `ExportInfo.export_as` populated. - Export(arg *ExportArg) (res *ExportResult, content io.ReadCloser, err error) - // GetMetadata : Returns the metadata for a file or folder. Note: Metadata - // for the root folder is unsupported. - GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error) - // GetPreview : Get a preview for a file. Currently, PDF previews are - // generated for files with the following extensions: .ai, .doc, .docm, - // .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, - // .pptm, .pptx, .rtf. HTML previews are generated for files with the - // following extensions: .csv, .ods, .xls, .xlsm, .gsheet, .xlsx. Other - // formats will return an unsupported extension error. - GetPreview(arg *PreviewArg) (res *FileMetadata, content io.ReadCloser, err error) - // GetTemporaryLink : Get a temporary link to stream content of a file. This - // link will expire in four hours and afterwards you will get 410 Gone. This - // URL should not be used to display content directly in the browser. The - // Content-Type of the link is determined automatically by the file's mime - // type. - GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error) - // GetTemporaryUploadLink : Get a one-time use temporary upload link to - // upload a file to a Dropbox location. This endpoint acts as a delayed - // `upload`. The returned temporary upload link may be used to make a POST - // request with the data to be uploaded. The upload will then be perfomed - // with the `CommitInfo` previously provided to `getTemporaryUploadLink` but - // evaluated only upon consumption. Hence, errors stemming from invalid - // `CommitInfo` with respect to the state of the user's Dropbox will only be - // communicated at consumption time. Additionally, these errors are surfaced - // as generic HTTP 409 Conflict responses, potentially hiding issue details. - // The maximum temporary upload link duration is 4 hours. Upon consumption - // or expiration, a new link will have to be generated. Multiple links may - // exist for a specific upload path at any given time. The POST request on - // the temporary upload link must have its Content-Type set to - // "application/octet-stream". Example temporary upload link consumption - // request: curl -X POST - // https://dl.dropboxusercontent.com/apitul/1/bNi2uIYF51cVBND --header - // "Content-Type: application/octet-stream" --data-binary @local_file.txt A - // successful temporary upload link consumption request returns the content - // hash of the uploaded data in JSON format. Example succesful temporary - // upload link consumption response: {"content-hash": - // "599d71033d700ac892a0e48fa61b125d2f5994"} An unsuccessful temporary - // upload link consumption request returns any of the following status - // codes: HTTP 400 Bad Request: Content-Type is not one of - // application/octet-stream and text/plain or request is invalid. HTTP 409 - // Conflict: The temporary upload link does not exist or is currently - // unavailable, the upload failed, or another error happened. HTTP 410 Gone: - // The temporary upload link is expired or consumed. Example unsuccessful - // temporary upload link consumption response: Temporary upload link has - // been recently consumed. - GetTemporaryUploadLink(arg *GetTemporaryUploadLinkArg) (res *GetTemporaryUploadLinkResult, err error) - // GetThumbnail : Get a thumbnail for an image. This method currently - // supports files with the following file extensions: jpg, jpeg, png, tiff, - // tif, gif and bmp. Photos that are larger than 20MB in size won't be - // converted to a thumbnail. - GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content io.ReadCloser, err error) - // GetThumbnailBatch : Get thumbnails for a list of images. We allow up to - // 25 thumbnails in a single batch. This method currently supports files - // with the following file extensions: jpg, jpeg, png, tiff, tif, gif and - // bmp. Photos that are larger than 20MB in size won't be converted to a - // thumbnail. - GetThumbnailBatch(arg *GetThumbnailBatchArg) (res *GetThumbnailBatchResult, err error) - // ListFolder : Starts returning the contents of a folder. If the result's - // `ListFolderResult.has_more` field is true, call `listFolderContinue` with - // the returned `ListFolderResult.cursor` to retrieve more entries. If - // you're using `ListFolderArg.recursive` set to true to keep a local cache - // of the contents of a Dropbox account, iterate through each entry in order - // and process them as follows to keep your local state in sync: For each - // `FileMetadata`, store the new entry at the given path in your local - // state. If the required parent folders don't exist yet, create them. If - // there's already something else at the given path, replace it and remove - // all its children. For each `FolderMetadata`, store the new entry at the - // given path in your local state. If the required parent folders don't - // exist yet, create them. If there's already something else at the given - // path, replace it but leave the children as they are. Check the new - // entry's `FolderSharingInfo.read_only` and set all its children's - // read-only statuses to match. For each `DeletedMetadata`, if your local - // state has something at the given path, remove it and all its children. If - // there's nothing at the given path, ignore this entry. Note: - // `auth.RateLimitError` may be returned if multiple `listFolder` or - // `listFolderContinue` calls with same parameters are made simultaneously - // by same API app for same user. If your app implements retry logic, please - // hold off the retry until the previous request finishes. - ListFolder(arg *ListFolderArg) (res *ListFolderResult, err error) - // ListFolderContinue : Once a cursor has been retrieved from `listFolder`, - // use this to paginate through all files and retrieve updates to the - // folder, following the same rules as documented for `listFolder`. - ListFolderContinue(arg *ListFolderContinueArg) (res *ListFolderResult, err error) - // ListFolderGetLatestCursor : A way to quickly get a cursor for the - // folder's state. Unlike `listFolder`, `listFolderGetLatestCursor` doesn't - // return any entries. This endpoint is for app which only needs to know - // about new files and modifications and doesn't need to know about files - // that already exist in Dropbox. - ListFolderGetLatestCursor(arg *ListFolderArg) (res *ListFolderGetLatestCursorResult, err error) - // ListFolderLongpoll : A longpoll endpoint to wait for changes on an - // account. In conjunction with `listFolderContinue`, this call gives you a - // low-latency way to monitor an account for file changes. The connection - // will block until there are changes available or a timeout occurs. This - // endpoint is useful mostly for client-side apps. If you're looking for - // server-side notifications, check out our `webhooks documentation` - // . - ListFolderLongpoll(arg *ListFolderLongpollArg) (res *ListFolderLongpollResult, err error) - // ListRevisions : Returns revisions for files based on a file path or a - // file id. The file path or file id is identified from the latest file - // entry at the given file path or id. This end point allows your app to - // query either by file path or file id by setting the mode parameter - // appropriately. In the `ListRevisionsMode.path` (default) mode, all - // revisions at the same file path as the latest file entry are returned. If - // revisions with the same file id are desired, then mode must be set to - // `ListRevisionsMode.id`. The `ListRevisionsMode.id` mode is useful to - // retrieve revisions for a given file across moves or renames. - ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResult, err error) - // Move : Move a file or folder to a different location in the user's - // Dropbox. If the source path is a folder all its contents will be moved. - MoveV2(arg *RelocationArg) (res *RelocationResult, err error) - // Move : Move a file or folder to a different location in the user's - // Dropbox. If the source path is a folder all its contents will be moved. - // Deprecated: Use `MoveV2` instead - Move(arg *RelocationArg) (res IsMetadata, err error) - // MoveBatch : Move multiple files or folders to different locations at once - // in the user's Dropbox. This route will replace `moveBatch`. The main - // difference is this route will return status for each entry, while - // `moveBatch` raises failure if any entry fails. This route will either - // finish synchronously, or return a job ID and do the async move job in - // background. Please use `moveBatchCheck` to check the job status. - MoveBatchV2(arg *MoveBatchArg) (res *RelocationBatchV2Launch, err error) - // MoveBatch : Move multiple files or folders to different locations at once - // in the user's Dropbox. This route is 'all or nothing', which means if one - // entry fails, the whole transaction will abort. This route will return job - // ID immediately and do the async moving job in background. Please use - // `moveBatchCheck` to check the job status. - MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) - // MoveBatchCheck : Returns the status of an asynchronous job for - // `moveBatch`. It returns list of results for each entry. - MoveBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error) - // MoveBatchCheck : Returns the status of an asynchronous job for - // `moveBatch`. If success, it returns list of results for each entry. - MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) - // PermanentlyDelete : Permanently delete the file or folder at a given path - // (see https://www.dropbox.com/en/help/40). Note: This endpoint is only - // available for Dropbox Business apps. - PermanentlyDelete(arg *DeleteArg) (err error) - // PropertiesAdd : has no documentation (yet) - // Deprecated: - PropertiesAdd(arg *file_properties.AddPropertiesArg) (err error) - // PropertiesOverwrite : has no documentation (yet) - // Deprecated: - PropertiesOverwrite(arg *file_properties.OverwritePropertyGroupArg) (err error) - // PropertiesRemove : has no documentation (yet) - // Deprecated: - PropertiesRemove(arg *file_properties.RemovePropertiesArg) (err error) - // PropertiesTemplateGet : has no documentation (yet) - // Deprecated: - PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (res *file_properties.GetTemplateResult, err error) - // PropertiesTemplateList : has no documentation (yet) - // Deprecated: - PropertiesTemplateList() (res *file_properties.ListTemplateResult, err error) - // PropertiesUpdate : has no documentation (yet) - // Deprecated: - PropertiesUpdate(arg *file_properties.UpdatePropertiesArg) (err error) - // Restore : Restore a specific revision of a file to the given path. - Restore(arg *RestoreArg) (res *FileMetadata, err error) - // SaveUrl : Save the data from a specified URL into a file in user's - // Dropbox. Note that the transfer from the URL must complete within 5 - // minutes, or the operation will time out and the job will fail. If the - // given path already exists, the file will be renamed to avoid the conflict - // (e.g. myfile (1).txt). - SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error) - // SaveUrlCheckJobStatus : Check the status of a `saveUrl` job. - SaveUrlCheckJobStatus(arg *async.PollArg) (res *SaveUrlJobStatus, err error) - // Search : Searches for files and folders. Note: Recent changes may not - // immediately be reflected in search results due to a short delay in - // indexing. - Search(arg *SearchArg) (res *SearchResult, err error) - // Upload : Create a new file with the contents provided in the request. Do - // not use this to upload a file larger than 150 MB. Instead, create an - // upload session with `uploadSessionStart`. Calls to this endpoint will - // count as data transport calls for any Dropbox Business teams with a limit - // on the number of data transport calls allowed per month. For more - // information, see the `Data transport limit page` - // . - Upload(arg *CommitInfo, content io.Reader) (res *FileMetadata, err error) - // UploadSessionAppend : Append more data to an upload session. When the - // parameter close is set, this call will close the session. A single - // request should not upload more than 150 MB. The maximum size of a file - // one can upload to an upload session is 350 GB. Calls to this endpoint - // will count as data transport calls for any Dropbox Business teams with a - // limit on the number of data transport calls allowed per month. For more - // information, see the `Data transport limit page` - // . - UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error) - // UploadSessionAppend : Append more data to an upload session. A single - // request should not upload more than 150 MB. The maximum size of a file - // one can upload to an upload session is 350 GB. Calls to this endpoint - // will count as data transport calls for any Dropbox Business teams with a - // limit on the number of data transport calls allowed per month. For more - // information, see the `Data transport limit page` - // . - // Deprecated: Use `UploadSessionAppendV2` instead - UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error) - // UploadSessionFinish : Finish an upload session and save the uploaded data - // to the given file path. A single request should not upload more than 150 - // MB. The maximum size of a file one can upload to an upload session is 350 - // GB. Calls to this endpoint will count as data transport calls for any - // Dropbox Business teams with a limit on the number of data transport calls - // allowed per month. For more information, see the `Data transport limit - // page` - // . - UploadSessionFinish(arg *UploadSessionFinishArg, content io.Reader) (res *FileMetadata, err error) - // UploadSessionFinishBatch : This route helps you commit many files at once - // into a user's Dropbox. Use `uploadSessionStart` and `uploadSessionAppend` - // to upload file contents. We recommend uploading many files in parallel to - // increase throughput. Once the file contents have been uploaded, rather - // than calling `uploadSessionFinish`, use this route to finish all your - // upload sessions in a single request. `UploadSessionStartArg.close` or - // `UploadSessionAppendArg.close` needs to be true for the last - // `uploadSessionStart` or `uploadSessionAppend` call. The maximum size of a - // file one can upload to an upload session is 350 GB. This route will - // return a job_id immediately and do the async commit job in background. - // Use `uploadSessionFinishBatchCheck` to check the job status. For the same - // account, this route should be executed serially. That means you should - // not start the next job before current job finishes. We allow up to 1000 - // entries in a single request. Calls to this endpoint will count as data - // transport calls for any Dropbox Business teams with a limit on the number - // of data transport calls allowed per month. For more information, see the - // `Data transport limit page` - // . - UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchLaunch, err error) - // UploadSessionFinishBatchCheck : Returns the status of an asynchronous job - // for `uploadSessionFinishBatch`. If success, it returns list of result for - // each entry. - UploadSessionFinishBatchCheck(arg *async.PollArg) (res *UploadSessionFinishBatchJobStatus, err error) - // UploadSessionStart : Upload sessions allow you to upload a single file in - // one or more requests, for example where the size of the file is greater - // than 150 MB. This call starts a new upload session with the given data. - // You can then use `uploadSessionAppend` to add more data and - // `uploadSessionFinish` to save all the data to a file in Dropbox. A single - // request should not upload more than 150 MB. The maximum size of a file - // one can upload to an upload session is 350 GB. An upload session can be - // used for a maximum of 48 hours. Attempting to use an - // `UploadSessionStartResult.session_id` with `uploadSessionAppend` or - // `uploadSessionFinish` more than 48 hours after its creation will return a - // `UploadSessionLookupError.not_found`. Calls to this endpoint will count - // as data transport calls for any Dropbox Business teams with a limit on - // the number of data transport calls allowed per month. For more - // information, see the `Data transport limit page` - // . - UploadSessionStart(arg *UploadSessionStartArg, content io.Reader) (res *UploadSessionStartResult, err error) -} - -type apiImpl dropbox.Context - -//AlphaGetMetadataAPIError is an error-wrapper for the alpha/get_metadata route -type AlphaGetMetadataAPIError struct { - dropbox.APIError - EndpointError *AlphaGetMetadataError `json:"error"` -} - -func (dbx *apiImpl) AlphaGetMetadata(arg *AlphaGetMetadataArg) (res IsMetadata, err error) { - log.Printf("WARNING: API `AlphaGetMetadata` is deprecated") - log.Printf("Use API `GetMetadata` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "alpha/get_metadata", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp metadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - case "deleted": - res = tmp.Deleted - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError AlphaGetMetadataAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//AlphaUploadAPIError is an error-wrapper for the alpha/upload route -type AlphaUploadAPIError struct { - dropbox.APIError - EndpointError *UploadErrorWithProperties `json:"error"` -} - -func (dbx *apiImpl) AlphaUpload(arg *CommitInfoWithProperties, content io.Reader) (res *FileMetadata, err error) { - log.Printf("WARNING: API `AlphaUpload` is deprecated") - log.Printf("Use API `AlphaUpload` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/octet-stream", - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "alpha/upload", headers, content) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError AlphaUploadAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyV2APIError is an error-wrapper for the copy route -type CopyV2APIError struct { - dropbox.APIError - EndpointError *RelocationError `json:"error"` -} - -func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyAPIError is an error-wrapper for the copy route -type CopyAPIError struct { - dropbox.APIError - EndpointError *RelocationError `json:"error"` -} - -func (dbx *apiImpl) Copy(arg *RelocationArg) (res IsMetadata, err error) { - log.Printf("WARNING: API `Copy` is deprecated") - log.Printf("Use API `Copy` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp metadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - case "deleted": - res = tmp.Deleted - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyBatchV2APIError is an error-wrapper for the copy_batch route -type CopyBatchV2APIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) CopyBatchV2(arg *RelocationBatchArgBase) (res *RelocationBatchV2Launch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyBatchAPIError is an error-wrapper for the copy_batch route -type CopyBatchAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) { - log.Printf("WARNING: API `CopyBatch` is deprecated") - log.Printf("Use API `CopyBatch` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyBatchCheckV2APIError is an error-wrapper for the copy_batch/check route -type CopyBatchCheckV2APIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) CopyBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch/check_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyBatchCheckAPIError is an error-wrapper for the copy_batch/check route -type CopyBatchCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) { - log.Printf("WARNING: API `CopyBatchCheck` is deprecated") - log.Printf("Use API `CopyBatchCheck` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyReferenceGetAPIError is an error-wrapper for the copy_reference/get route -type CopyReferenceGetAPIError struct { - dropbox.APIError - EndpointError *GetCopyReferenceError `json:"error"` -} - -func (dbx *apiImpl) CopyReferenceGet(arg *GetCopyReferenceArg) (res *GetCopyReferenceResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_reference/get", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyReferenceGetAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CopyReferenceSaveAPIError is an error-wrapper for the copy_reference/save route -type CopyReferenceSaveAPIError struct { - dropbox.APIError - EndpointError *SaveCopyReferenceError `json:"error"` -} - -func (dbx *apiImpl) CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyReferenceResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_reference/save", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CopyReferenceSaveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CreateFolderV2APIError is an error-wrapper for the create_folder route -type CreateFolderV2APIError struct { - dropbox.APIError - EndpointError *CreateFolderError `json:"error"` -} - -func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CreateFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CreateFolderAPIError is an error-wrapper for the create_folder route -type CreateFolderAPIError struct { - dropbox.APIError - EndpointError *CreateFolderError `json:"error"` -} - -func (dbx *apiImpl) CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err error) { - log.Printf("WARNING: API `CreateFolder` is deprecated") - log.Printf("Use API `CreateFolder` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CreateFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CreateFolderBatchAPIError is an error-wrapper for the create_folder_batch route -type CreateFolderBatchAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) CreateFolderBatch(arg *CreateFolderBatchArg) (res *CreateFolderBatchLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CreateFolderBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CreateFolderBatchCheckAPIError is an error-wrapper for the create_folder_batch/check route -type CreateFolderBatchCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) CreateFolderBatchCheck(arg *async.PollArg) (res *CreateFolderBatchJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder_batch/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CreateFolderBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DeleteV2APIError is an error-wrapper for the delete route -type DeleteV2APIError struct { - dropbox.APIError - EndpointError *DeleteError `json:"error"` -} - -func (dbx *apiImpl) DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DeleteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DeleteAPIError is an error-wrapper for the delete route -type DeleteAPIError struct { - dropbox.APIError - EndpointError *DeleteError `json:"error"` -} - -func (dbx *apiImpl) Delete(arg *DeleteArg) (res IsMetadata, err error) { - log.Printf("WARNING: API `Delete` is deprecated") - log.Printf("Use API `Delete` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp metadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - case "deleted": - res = tmp.Deleted - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DeleteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DeleteBatchAPIError is an error-wrapper for the delete_batch route -type DeleteBatchAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) DeleteBatch(arg *DeleteBatchArg) (res *DeleteBatchLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DeleteBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DeleteBatchCheckAPIError is an error-wrapper for the delete_batch/check route -type DeleteBatchCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_batch/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DeleteBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DownloadAPIError is an error-wrapper for the download route -type DownloadAPIError struct { - dropbox.APIError - EndpointError *DownloadError `json:"error"` -} - -func (dbx *apiImpl) Download(arg *DownloadArg) (res *FileMetadata, content io.ReadCloser, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - for k, v := range arg.ExtraHeaders { - headers[k] = v - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "download", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - body := []byte(resp.Header.Get("Dropbox-API-Result")) - content = resp.Body - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusPartialContent { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) - if err != nil { - return - } - var apiError DownloadAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DownloadZipAPIError is an error-wrapper for the download_zip route -type DownloadZipAPIError struct { - dropbox.APIError - EndpointError *DownloadZipError `json:"error"` -} - -func (dbx *apiImpl) DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, content io.ReadCloser, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "download_zip", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - body := []byte(resp.Header.Get("Dropbox-API-Result")) - content = resp.Body - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) - if err != nil { - return - } - var apiError DownloadZipAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ExportAPIError is an error-wrapper for the export route -type ExportAPIError struct { - dropbox.APIError - EndpointError *ExportError `json:"error"` -} - -func (dbx *apiImpl) Export(arg *ExportArg) (res *ExportResult, content io.ReadCloser, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "export", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - body := []byte(resp.Header.Get("Dropbox-API-Result")) - content = resp.Body - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) - if err != nil { - return - } - var apiError ExportAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetMetadataAPIError is an error-wrapper for the get_metadata route -type GetMetadataAPIError struct { - dropbox.APIError - EndpointError *GetMetadataError `json:"error"` -} - -func (dbx *apiImpl) GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_metadata", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp metadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - case "deleted": - res = tmp.Deleted - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetMetadataAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetPreviewAPIError is an error-wrapper for the get_preview route -type GetPreviewAPIError struct { - dropbox.APIError - EndpointError *PreviewError `json:"error"` -} - -func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.ReadCloser, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "get_preview", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - body := []byte(resp.Header.Get("Dropbox-API-Result")) - content = resp.Body - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) - if err != nil { - return - } - var apiError GetPreviewAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetTemporaryLinkAPIError is an error-wrapper for the get_temporary_link route -type GetTemporaryLinkAPIError struct { - dropbox.APIError - EndpointError *GetTemporaryLinkError `json:"error"` -} - -func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_temporary_link", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetTemporaryLinkAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetTemporaryUploadLinkAPIError is an error-wrapper for the get_temporary_upload_link route -type GetTemporaryUploadLinkAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) GetTemporaryUploadLink(arg *GetTemporaryUploadLinkArg) (res *GetTemporaryUploadLinkResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_temporary_upload_link", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetTemporaryUploadLinkAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetThumbnailAPIError is an error-wrapper for the get_thumbnail route -type GetThumbnailAPIError struct { - dropbox.APIError - EndpointError *ThumbnailError `json:"error"` -} - -func (dbx *apiImpl) GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content io.ReadCloser, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "get_thumbnail", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - body := []byte(resp.Header.Get("Dropbox-API-Result")) - content = resp.Body - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) - if err != nil { - return - } - var apiError GetThumbnailAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetThumbnailBatchAPIError is an error-wrapper for the get_thumbnail_batch route -type GetThumbnailBatchAPIError struct { - dropbox.APIError - EndpointError *GetThumbnailBatchError `json:"error"` -} - -func (dbx *apiImpl) GetThumbnailBatch(arg *GetThumbnailBatchArg) (res *GetThumbnailBatchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "rpc", true, "files", "get_thumbnail_batch", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetThumbnailBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFolderAPIError is an error-wrapper for the list_folder route -type ListFolderAPIError struct { - dropbox.APIError - EndpointError *ListFolderError `json:"error"` -} - -func (dbx *apiImpl) ListFolder(arg *ListFolderArg) (res *ListFolderResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFolderContinueAPIError is an error-wrapper for the list_folder/continue route -type ListFolderContinueAPIError struct { - dropbox.APIError - EndpointError *ListFolderContinueError `json:"error"` -} - -func (dbx *apiImpl) ListFolderContinue(arg *ListFolderContinueArg) (res *ListFolderResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_folder/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFolderContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFolderGetLatestCursorAPIError is an error-wrapper for the list_folder/get_latest_cursor route -type ListFolderGetLatestCursorAPIError struct { - dropbox.APIError - EndpointError *ListFolderError `json:"error"` -} - -func (dbx *apiImpl) ListFolderGetLatestCursor(arg *ListFolderArg) (res *ListFolderGetLatestCursorResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_folder/get_latest_cursor", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFolderGetLatestCursorAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFolderLongpollAPIError is an error-wrapper for the list_folder/longpoll route -type ListFolderLongpollAPIError struct { - dropbox.APIError - EndpointError *ListFolderLongpollError `json:"error"` -} - -func (dbx *apiImpl) ListFolderLongpoll(arg *ListFolderLongpollArg) (res *ListFolderLongpollResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("notify", "rpc", false, "files", "list_folder/longpoll", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFolderLongpollAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListRevisionsAPIError is an error-wrapper for the list_revisions route -type ListRevisionsAPIError struct { - dropbox.APIError - EndpointError *ListRevisionsError `json:"error"` -} - -func (dbx *apiImpl) ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_revisions", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListRevisionsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MoveV2APIError is an error-wrapper for the move route -type MoveV2APIError struct { - dropbox.APIError - EndpointError *RelocationError `json:"error"` -} - -func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MoveAPIError is an error-wrapper for the move route -type MoveAPIError struct { - dropbox.APIError - EndpointError *RelocationError `json:"error"` -} - -func (dbx *apiImpl) Move(arg *RelocationArg) (res IsMetadata, err error) { - log.Printf("WARNING: API `Move` is deprecated") - log.Printf("Use API `Move` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp metadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - case "deleted": - res = tmp.Deleted - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MoveBatchV2APIError is an error-wrapper for the move_batch route -type MoveBatchV2APIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) MoveBatchV2(arg *MoveBatchArg) (res *RelocationBatchV2Launch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MoveBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MoveBatchAPIError is an error-wrapper for the move_batch route -type MoveBatchAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MoveBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MoveBatchCheckV2APIError is an error-wrapper for the move_batch/check route -type MoveBatchCheckV2APIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) MoveBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch/check_v2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MoveBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MoveBatchCheckAPIError is an error-wrapper for the move_batch/check route -type MoveBatchCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MoveBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PermanentlyDeleteAPIError is an error-wrapper for the permanently_delete route -type PermanentlyDeleteAPIError struct { - dropbox.APIError - EndpointError *DeleteError `json:"error"` -} - -func (dbx *apiImpl) PermanentlyDelete(arg *DeleteArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "permanently_delete", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PermanentlyDeleteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesAddAPIError is an error-wrapper for the properties/add route -type PropertiesAddAPIError struct { - dropbox.APIError - EndpointError *file_properties.AddPropertiesError `json:"error"` -} - -func (dbx *apiImpl) PropertiesAdd(arg *file_properties.AddPropertiesArg) (err error) { - log.Printf("WARNING: API `PropertiesAdd` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/add", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesAddAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesOverwriteAPIError is an error-wrapper for the properties/overwrite route -type PropertiesOverwriteAPIError struct { - dropbox.APIError - EndpointError *file_properties.InvalidPropertyGroupError `json:"error"` -} - -func (dbx *apiImpl) PropertiesOverwrite(arg *file_properties.OverwritePropertyGroupArg) (err error) { - log.Printf("WARNING: API `PropertiesOverwrite` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/overwrite", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesOverwriteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesRemoveAPIError is an error-wrapper for the properties/remove route -type PropertiesRemoveAPIError struct { - dropbox.APIError - EndpointError *file_properties.RemovePropertiesError `json:"error"` -} - -func (dbx *apiImpl) PropertiesRemove(arg *file_properties.RemovePropertiesArg) (err error) { - log.Printf("WARNING: API `PropertiesRemove` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/remove", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesRemoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesTemplateGetAPIError is an error-wrapper for the properties/template/get route -type PropertiesTemplateGetAPIError struct { - dropbox.APIError - EndpointError *file_properties.TemplateError `json:"error"` -} - -func (dbx *apiImpl) PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (res *file_properties.GetTemplateResult, err error) { - log.Printf("WARNING: API `PropertiesTemplateGet` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/template/get", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesTemplateGetAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesTemplateListAPIError is an error-wrapper for the properties/template/list route -type PropertiesTemplateListAPIError struct { - dropbox.APIError - EndpointError *file_properties.TemplateError `json:"error"` -} - -func (dbx *apiImpl) PropertiesTemplateList() (res *file_properties.ListTemplateResult, err error) { - log.Printf("WARNING: API `PropertiesTemplateList` is deprecated") - - cli := dbx.Client - - headers := map[string]string{} - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/template/list", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesTemplateListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesUpdateAPIError is an error-wrapper for the properties/update route -type PropertiesUpdateAPIError struct { - dropbox.APIError - EndpointError *file_properties.UpdatePropertiesError `json:"error"` -} - -func (dbx *apiImpl) PropertiesUpdate(arg *file_properties.UpdatePropertiesArg) (err error) { - log.Printf("WARNING: API `PropertiesUpdate` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/update", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesUpdateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RestoreAPIError is an error-wrapper for the restore route -type RestoreAPIError struct { - dropbox.APIError - EndpointError *RestoreError `json:"error"` -} - -func (dbx *apiImpl) Restore(arg *RestoreArg) (res *FileMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "restore", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RestoreAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//SaveUrlAPIError is an error-wrapper for the save_url route -type SaveUrlAPIError struct { - dropbox.APIError - EndpointError *SaveUrlError `json:"error"` -} - -func (dbx *apiImpl) SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "save_url", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError SaveUrlAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//SaveUrlCheckJobStatusAPIError is an error-wrapper for the save_url/check_job_status route -type SaveUrlCheckJobStatusAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) SaveUrlCheckJobStatus(arg *async.PollArg) (res *SaveUrlJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "save_url/check_job_status", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError SaveUrlCheckJobStatusAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//SearchAPIError is an error-wrapper for the search route -type SearchAPIError struct { - dropbox.APIError - EndpointError *SearchError `json:"error"` -} - -func (dbx *apiImpl) Search(arg *SearchArg) (res *SearchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "search", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError SearchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadAPIError is an error-wrapper for the upload route -type UploadAPIError struct { - dropbox.APIError - EndpointError *UploadError `json:"error"` -} - -func (dbx *apiImpl) Upload(arg *CommitInfo, content io.Reader) (res *FileMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/octet-stream", - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload", headers, content) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadSessionAppendV2APIError is an error-wrapper for the upload_session/append route -type UploadSessionAppendV2APIError struct { - dropbox.APIError - EndpointError *UploadSessionLookupError `json:"error"` -} - -func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/octet-stream", - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append_v2", headers, content) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadSessionAppendAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadSessionAppendAPIError is an error-wrapper for the upload_session/append route -type UploadSessionAppendAPIError struct { - dropbox.APIError - EndpointError *UploadSessionLookupError `json:"error"` -} - -func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error) { - log.Printf("WARNING: API `UploadSessionAppend` is deprecated") - log.Printf("Use API `UploadSessionAppend` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/octet-stream", - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append", headers, content) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadSessionAppendAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadSessionFinishAPIError is an error-wrapper for the upload_session/finish route -type UploadSessionFinishAPIError struct { - dropbox.APIError - EndpointError *UploadSessionFinishError `json:"error"` -} - -func (dbx *apiImpl) UploadSessionFinish(arg *UploadSessionFinishArg, content io.Reader) (res *FileMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/octet-stream", - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/finish", headers, content) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadSessionFinishAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadSessionFinishBatchAPIError is an error-wrapper for the upload_session/finish_batch route -type UploadSessionFinishBatchAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "upload_session/finish_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadSessionFinishBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadSessionFinishBatchCheckAPIError is an error-wrapper for the upload_session/finish_batch/check route -type UploadSessionFinishBatchCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) UploadSessionFinishBatchCheck(arg *async.PollArg) (res *UploadSessionFinishBatchJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "upload_session/finish_batch/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadSessionFinishBatchCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UploadSessionStartAPIError is an error-wrapper for the upload_session/start route -type UploadSessionStartAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) UploadSessionStart(arg *UploadSessionStartArg, content io.Reader) (res *UploadSessionStartResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/octet-stream", - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/start", headers, content) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UploadSessionStartAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -// New returns a Client implementation for this namespace -func New(c dropbox.Config) Client { - ctx := apiImpl(dropbox.NewContext(c)) - return &ctx -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go deleted file mode 100644 index 7103ffe04..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go +++ /dev/null @@ -1,4149 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package files : This namespace contains endpoints and data types for basic -// file operations. -package files - -import ( - "encoding/json" - "time" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties" -) - -// GetMetadataArg : has no documentation (yet) -type GetMetadataArg struct { - // Path : The path of a file or folder on Dropbox. - Path string `json:"path"` - // IncludeMediaInfo : If true, `FileMetadata.media_info` is set for photo - // and video. - IncludeMediaInfo bool `json:"include_media_info"` - // IncludeDeleted : If true, `DeletedMetadata` will be returned for deleted - // file or folder, otherwise `LookupError.not_found` will be returned. - IncludeDeleted bool `json:"include_deleted"` - // IncludeHasExplicitSharedMembers : If true, the results will include a - // flag for each file indicating whether or not that file has any explicit - // members. - IncludeHasExplicitSharedMembers bool `json:"include_has_explicit_shared_members"` - // IncludePropertyGroups : If set to a valid list of template IDs, - // `FileMetadata.property_groups` is set if there exists property data - // associated with the file and each of the listed templates. - IncludePropertyGroups *file_properties.TemplateFilterBase `json:"include_property_groups,omitempty"` -} - -// NewGetMetadataArg returns a new GetMetadataArg instance -func NewGetMetadataArg(Path string) *GetMetadataArg { - s := new(GetMetadataArg) - s.Path = Path - s.IncludeMediaInfo = false - s.IncludeDeleted = false - s.IncludeHasExplicitSharedMembers = false - return s -} - -// AlphaGetMetadataArg : has no documentation (yet) -type AlphaGetMetadataArg struct { - GetMetadataArg - // IncludePropertyTemplates : If set to a valid list of template IDs, - // `FileMetadata.property_groups` is set for files with custom properties. - IncludePropertyTemplates []string `json:"include_property_templates,omitempty"` -} - -// NewAlphaGetMetadataArg returns a new AlphaGetMetadataArg instance -func NewAlphaGetMetadataArg(Path string) *AlphaGetMetadataArg { - s := new(AlphaGetMetadataArg) - s.Path = Path - s.IncludeMediaInfo = false - s.IncludeDeleted = false - s.IncludeHasExplicitSharedMembers = false - return s -} - -// GetMetadataError : has no documentation (yet) -type GetMetadataError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for GetMetadataError -const ( - GetMetadataErrorPath = "path" -) - -// UnmarshalJSON deserializes into a GetMetadataError instance -func (u *GetMetadataError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// AlphaGetMetadataError : has no documentation (yet) -type AlphaGetMetadataError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - // PropertiesError : has no documentation (yet) - PropertiesError *file_properties.LookUpPropertiesError `json:"properties_error,omitempty"` -} - -// Valid tag values for AlphaGetMetadataError -const ( - AlphaGetMetadataErrorPath = "path" - AlphaGetMetadataErrorPropertiesError = "properties_error" -) - -// UnmarshalJSON deserializes into a AlphaGetMetadataError instance -func (u *AlphaGetMetadataError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - // PropertiesError : has no documentation (yet) - PropertiesError *file_properties.LookUpPropertiesError `json:"properties_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - case "properties_error": - u.PropertiesError = w.PropertiesError - - if err != nil { - return err - } - } - return nil -} - -// CommitInfo : has no documentation (yet) -type CommitInfo struct { - // Path : Path in the user's Dropbox to save the file. - Path string `json:"path"` - // Mode : Selects what to do if the file already exists. - Mode *WriteMode `json:"mode"` - // Autorename : If there's a conflict, as determined by `mode`, have the - // Dropbox server try to autorename the file to avoid conflict. - Autorename bool `json:"autorename"` - // ClientModified : The value to store as the `client_modified` timestamp. - // Dropbox automatically records the time at which the file was written to - // the Dropbox servers. It can also record an additional timestamp, provided - // by Dropbox desktop clients, mobile clients, and API apps of when the file - // was actually created or modified. - ClientModified time.Time `json:"client_modified,omitempty"` - // Mute : Normally, users are made aware of any file modifications in their - // Dropbox account via notifications in the client software. If true, this - // tells the clients that this modification shouldn't result in a user - // notification. - Mute bool `json:"mute"` - // PropertyGroups : List of custom properties to add to file. - PropertyGroups []*file_properties.PropertyGroup `json:"property_groups,omitempty"` - // StrictConflict : Be more strict about how each `WriteMode` detects - // conflict. For example, always return a conflict error when `mode` = - // `WriteMode.update` and the given "rev" doesn't match the existing file's - // "rev", even if the existing file has been deleted. - StrictConflict bool `json:"strict_conflict"` -} - -// NewCommitInfo returns a new CommitInfo instance -func NewCommitInfo(Path string) *CommitInfo { - s := new(CommitInfo) - s.Path = Path - s.Mode = &WriteMode{Tagged: dropbox.Tagged{"add"}} - s.Autorename = false - s.Mute = false - s.StrictConflict = false - return s -} - -// CommitInfoWithProperties : has no documentation (yet) -type CommitInfoWithProperties struct { - CommitInfo -} - -// NewCommitInfoWithProperties returns a new CommitInfoWithProperties instance -func NewCommitInfoWithProperties(Path string) *CommitInfoWithProperties { - s := new(CommitInfoWithProperties) - s.Path = Path - s.Mode = &WriteMode{Tagged: dropbox.Tagged{"add"}} - s.Autorename = false - s.Mute = false - s.StrictConflict = false - return s -} - -// ContentSyncSetting : has no documentation (yet) -type ContentSyncSetting struct { - // Id : Id of the item this setting is applied to. - Id string `json:"id"` - // SyncSetting : Setting for this item. - SyncSetting *SyncSetting `json:"sync_setting"` -} - -// NewContentSyncSetting returns a new ContentSyncSetting instance -func NewContentSyncSetting(Id string, SyncSetting *SyncSetting) *ContentSyncSetting { - s := new(ContentSyncSetting) - s.Id = Id - s.SyncSetting = SyncSetting - return s -} - -// ContentSyncSettingArg : has no documentation (yet) -type ContentSyncSettingArg struct { - // Id : Id of the item this setting is applied to. - Id string `json:"id"` - // SyncSetting : Setting for this item. - SyncSetting *SyncSettingArg `json:"sync_setting"` -} - -// NewContentSyncSettingArg returns a new ContentSyncSettingArg instance -func NewContentSyncSettingArg(Id string, SyncSetting *SyncSettingArg) *ContentSyncSettingArg { - s := new(ContentSyncSettingArg) - s.Id = Id - s.SyncSetting = SyncSetting - return s -} - -// CreateFolderArg : has no documentation (yet) -type CreateFolderArg struct { - // Path : Path in the user's Dropbox to create. - Path string `json:"path"` - // Autorename : If there's a conflict, have the Dropbox server try to - // autorename the folder to avoid the conflict. - Autorename bool `json:"autorename"` -} - -// NewCreateFolderArg returns a new CreateFolderArg instance -func NewCreateFolderArg(Path string) *CreateFolderArg { - s := new(CreateFolderArg) - s.Path = Path - s.Autorename = false - return s -} - -// CreateFolderBatchArg : has no documentation (yet) -type CreateFolderBatchArg struct { - // Paths : List of paths to be created in the user's Dropbox. Duplicate path - // arguments in the batch are considered only once. - Paths []string `json:"paths"` - // Autorename : If there's a conflict, have the Dropbox server try to - // autorename the folder to avoid the conflict. - Autorename bool `json:"autorename"` - // ForceAsync : Whether to force the create to happen asynchronously. - ForceAsync bool `json:"force_async"` -} - -// NewCreateFolderBatchArg returns a new CreateFolderBatchArg instance -func NewCreateFolderBatchArg(Paths []string) *CreateFolderBatchArg { - s := new(CreateFolderBatchArg) - s.Paths = Paths - s.Autorename = false - s.ForceAsync = false - return s -} - -// CreateFolderBatchError : has no documentation (yet) -type CreateFolderBatchError struct { - dropbox.Tagged -} - -// Valid tag values for CreateFolderBatchError -const ( - CreateFolderBatchErrorTooManyFiles = "too_many_files" - CreateFolderBatchErrorOther = "other" -) - -// CreateFolderBatchJobStatus : has no documentation (yet) -type CreateFolderBatchJobStatus struct { - dropbox.Tagged - // Complete : The batch create folder has finished. - Complete *CreateFolderBatchResult `json:"complete,omitempty"` - // Failed : The batch create folder has failed. - Failed *CreateFolderBatchError `json:"failed,omitempty"` -} - -// Valid tag values for CreateFolderBatchJobStatus -const ( - CreateFolderBatchJobStatusInProgress = "in_progress" - CreateFolderBatchJobStatusComplete = "complete" - CreateFolderBatchJobStatusFailed = "failed" - CreateFolderBatchJobStatusOther = "other" -) - -// UnmarshalJSON deserializes into a CreateFolderBatchJobStatus instance -func (u *CreateFolderBatchJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : The batch create folder has failed. - Failed *CreateFolderBatchError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// CreateFolderBatchLaunch : Result returned by `createFolderBatch` that may -// either launch an asynchronous job or complete synchronously. -type CreateFolderBatchLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *CreateFolderBatchResult `json:"complete,omitempty"` -} - -// Valid tag values for CreateFolderBatchLaunch -const ( - CreateFolderBatchLaunchAsyncJobId = "async_job_id" - CreateFolderBatchLaunchComplete = "complete" - CreateFolderBatchLaunchOther = "other" -) - -// UnmarshalJSON deserializes into a CreateFolderBatchLaunch instance -func (u *CreateFolderBatchLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// FileOpsResult : has no documentation (yet) -type FileOpsResult struct { -} - -// NewFileOpsResult returns a new FileOpsResult instance -func NewFileOpsResult() *FileOpsResult { - s := new(FileOpsResult) - return s -} - -// CreateFolderBatchResult : has no documentation (yet) -type CreateFolderBatchResult struct { - FileOpsResult - // Entries : Each entry in `CreateFolderBatchArg.paths` will appear at the - // same position inside `CreateFolderBatchResult.entries`. - Entries []*CreateFolderBatchResultEntry `json:"entries"` -} - -// NewCreateFolderBatchResult returns a new CreateFolderBatchResult instance -func NewCreateFolderBatchResult(Entries []*CreateFolderBatchResultEntry) *CreateFolderBatchResult { - s := new(CreateFolderBatchResult) - s.Entries = Entries - return s -} - -// CreateFolderBatchResultEntry : has no documentation (yet) -type CreateFolderBatchResultEntry struct { - dropbox.Tagged - // Success : has no documentation (yet) - Success *CreateFolderEntryResult `json:"success,omitempty"` - // Failure : has no documentation (yet) - Failure *CreateFolderEntryError `json:"failure,omitempty"` -} - -// Valid tag values for CreateFolderBatchResultEntry -const ( - CreateFolderBatchResultEntrySuccess = "success" - CreateFolderBatchResultEntryFailure = "failure" -) - -// UnmarshalJSON deserializes into a CreateFolderBatchResultEntry instance -func (u *CreateFolderBatchResultEntry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failure : has no documentation (yet) - Failure *CreateFolderEntryError `json:"failure,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "failure": - u.Failure = w.Failure - - if err != nil { - return err - } - } - return nil -} - -// CreateFolderEntryError : has no documentation (yet) -type CreateFolderEntryError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` -} - -// Valid tag values for CreateFolderEntryError -const ( - CreateFolderEntryErrorPath = "path" - CreateFolderEntryErrorOther = "other" -) - -// UnmarshalJSON deserializes into a CreateFolderEntryError instance -func (u *CreateFolderEntryError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// CreateFolderEntryResult : has no documentation (yet) -type CreateFolderEntryResult struct { - // Metadata : Metadata of the created folder. - Metadata *FolderMetadata `json:"metadata"` -} - -// NewCreateFolderEntryResult returns a new CreateFolderEntryResult instance -func NewCreateFolderEntryResult(Metadata *FolderMetadata) *CreateFolderEntryResult { - s := new(CreateFolderEntryResult) - s.Metadata = Metadata - return s -} - -// CreateFolderError : has no documentation (yet) -type CreateFolderError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` -} - -// Valid tag values for CreateFolderError -const ( - CreateFolderErrorPath = "path" -) - -// UnmarshalJSON deserializes into a CreateFolderError instance -func (u *CreateFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// CreateFolderResult : has no documentation (yet) -type CreateFolderResult struct { - FileOpsResult - // Metadata : Metadata of the created folder. - Metadata *FolderMetadata `json:"metadata"` -} - -// NewCreateFolderResult returns a new CreateFolderResult instance -func NewCreateFolderResult(Metadata *FolderMetadata) *CreateFolderResult { - s := new(CreateFolderResult) - s.Metadata = Metadata - return s -} - -// DeleteArg : has no documentation (yet) -type DeleteArg struct { - // Path : Path in the user's Dropbox to delete. - Path string `json:"path"` - // ParentRev : Perform delete if given "rev" matches the existing file's - // latest "rev". This field does not support deleting a folder. - ParentRev string `json:"parent_rev,omitempty"` -} - -// NewDeleteArg returns a new DeleteArg instance -func NewDeleteArg(Path string) *DeleteArg { - s := new(DeleteArg) - s.Path = Path - return s -} - -// DeleteBatchArg : has no documentation (yet) -type DeleteBatchArg struct { - // Entries : has no documentation (yet) - Entries []*DeleteArg `json:"entries"` -} - -// NewDeleteBatchArg returns a new DeleteBatchArg instance -func NewDeleteBatchArg(Entries []*DeleteArg) *DeleteBatchArg { - s := new(DeleteBatchArg) - s.Entries = Entries - return s -} - -// DeleteBatchError : has no documentation (yet) -type DeleteBatchError struct { - dropbox.Tagged -} - -// Valid tag values for DeleteBatchError -const ( - DeleteBatchErrorTooManyWriteOperations = "too_many_write_operations" - DeleteBatchErrorOther = "other" -) - -// DeleteBatchJobStatus : has no documentation (yet) -type DeleteBatchJobStatus struct { - dropbox.Tagged - // Complete : The batch delete has finished. - Complete *DeleteBatchResult `json:"complete,omitempty"` - // Failed : The batch delete has failed. - Failed *DeleteBatchError `json:"failed,omitempty"` -} - -// Valid tag values for DeleteBatchJobStatus -const ( - DeleteBatchJobStatusInProgress = "in_progress" - DeleteBatchJobStatusComplete = "complete" - DeleteBatchJobStatusFailed = "failed" - DeleteBatchJobStatusOther = "other" -) - -// UnmarshalJSON deserializes into a DeleteBatchJobStatus instance -func (u *DeleteBatchJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : The batch delete has failed. - Failed *DeleteBatchError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// DeleteBatchLaunch : Result returned by `deleteBatch` that may either launch -// an asynchronous job or complete synchronously. -type DeleteBatchLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *DeleteBatchResult `json:"complete,omitempty"` -} - -// Valid tag values for DeleteBatchLaunch -const ( - DeleteBatchLaunchAsyncJobId = "async_job_id" - DeleteBatchLaunchComplete = "complete" - DeleteBatchLaunchOther = "other" -) - -// UnmarshalJSON deserializes into a DeleteBatchLaunch instance -func (u *DeleteBatchLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// DeleteBatchResult : has no documentation (yet) -type DeleteBatchResult struct { - FileOpsResult - // Entries : Each entry in `DeleteBatchArg.entries` will appear at the same - // position inside `DeleteBatchResult.entries`. - Entries []*DeleteBatchResultEntry `json:"entries"` -} - -// NewDeleteBatchResult returns a new DeleteBatchResult instance -func NewDeleteBatchResult(Entries []*DeleteBatchResultEntry) *DeleteBatchResult { - s := new(DeleteBatchResult) - s.Entries = Entries - return s -} - -// DeleteBatchResultData : has no documentation (yet) -type DeleteBatchResultData struct { - // Metadata : Metadata of the deleted object. - Metadata IsMetadata `json:"metadata"` -} - -// NewDeleteBatchResultData returns a new DeleteBatchResultData instance -func NewDeleteBatchResultData(Metadata IsMetadata) *DeleteBatchResultData { - s := new(DeleteBatchResultData) - s.Metadata = Metadata - return s -} - -// UnmarshalJSON deserializes into a DeleteBatchResultData instance -func (u *DeleteBatchResultData) UnmarshalJSON(b []byte) error { - type wrap struct { - // Metadata : Metadata of the deleted object. - Metadata json.RawMessage `json:"metadata"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - return nil -} - -// DeleteBatchResultEntry : has no documentation (yet) -type DeleteBatchResultEntry struct { - dropbox.Tagged - // Success : has no documentation (yet) - Success *DeleteBatchResultData `json:"success,omitempty"` - // Failure : has no documentation (yet) - Failure *DeleteError `json:"failure,omitempty"` -} - -// Valid tag values for DeleteBatchResultEntry -const ( - DeleteBatchResultEntrySuccess = "success" - DeleteBatchResultEntryFailure = "failure" -) - -// UnmarshalJSON deserializes into a DeleteBatchResultEntry instance -func (u *DeleteBatchResultEntry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failure : has no documentation (yet) - Failure *DeleteError `json:"failure,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "failure": - u.Failure = w.Failure - - if err != nil { - return err - } - } - return nil -} - -// DeleteError : has no documentation (yet) -type DeleteError struct { - dropbox.Tagged - // PathLookup : has no documentation (yet) - PathLookup *LookupError `json:"path_lookup,omitempty"` - // PathWrite : has no documentation (yet) - PathWrite *WriteError `json:"path_write,omitempty"` -} - -// Valid tag values for DeleteError -const ( - DeleteErrorPathLookup = "path_lookup" - DeleteErrorPathWrite = "path_write" - DeleteErrorTooManyWriteOperations = "too_many_write_operations" - DeleteErrorTooManyFiles = "too_many_files" - DeleteErrorOther = "other" -) - -// UnmarshalJSON deserializes into a DeleteError instance -func (u *DeleteError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // PathLookup : has no documentation (yet) - PathLookup *LookupError `json:"path_lookup,omitempty"` - // PathWrite : has no documentation (yet) - PathWrite *WriteError `json:"path_write,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path_lookup": - u.PathLookup = w.PathLookup - - if err != nil { - return err - } - case "path_write": - u.PathWrite = w.PathWrite - - if err != nil { - return err - } - } - return nil -} - -// DeleteResult : has no documentation (yet) -type DeleteResult struct { - FileOpsResult - // Metadata : Metadata of the deleted object. - Metadata IsMetadata `json:"metadata"` -} - -// NewDeleteResult returns a new DeleteResult instance -func NewDeleteResult(Metadata IsMetadata) *DeleteResult { - s := new(DeleteResult) - s.Metadata = Metadata - return s -} - -// UnmarshalJSON deserializes into a DeleteResult instance -func (u *DeleteResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Metadata : Metadata of the deleted object. - Metadata json.RawMessage `json:"metadata"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - return nil -} - -// Metadata : Metadata for a file or folder. -type Metadata struct { - // Name : The last component of the path (including extension). This never - // contains a slash. - Name string `json:"name"` - // PathLower : The lowercased full path in the user's Dropbox. This always - // starts with a slash. This field will be null if the file or folder is not - // mounted. - PathLower string `json:"path_lower,omitempty"` - // PathDisplay : The cased path to be used for display purposes only. In - // rare instances the casing will not correctly match the user's filesystem, - // but this behavior will match the path provided in the Core API v1, and at - // least the last path component will have the correct casing. Changes to - // only the casing of paths won't be returned by `listFolderContinue`. This - // field will be null if the file or folder is not mounted. - PathDisplay string `json:"path_display,omitempty"` - // ParentSharedFolderId : Please use - // `FileSharingInfo.parent_shared_folder_id` or - // `FolderSharingInfo.parent_shared_folder_id` instead. - ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` -} - -// NewMetadata returns a new Metadata instance -func NewMetadata(Name string) *Metadata { - s := new(Metadata) - s.Name = Name - return s -} - -// IsMetadata is the interface type for Metadata and its subtypes -type IsMetadata interface { - IsMetadata() -} - -// IsMetadata implements the IsMetadata interface -func (u *Metadata) IsMetadata() {} - -type metadataUnion struct { - dropbox.Tagged - // File : has no documentation (yet) - File *FileMetadata `json:"file,omitempty"` - // Folder : has no documentation (yet) - Folder *FolderMetadata `json:"folder,omitempty"` - // Deleted : has no documentation (yet) - Deleted *DeletedMetadata `json:"deleted,omitempty"` -} - -// Valid tag values for Metadata -const ( - MetadataFile = "file" - MetadataFolder = "folder" - MetadataDeleted = "deleted" -) - -// UnmarshalJSON deserializes into a metadataUnion instance -func (u *metadataUnion) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "file": - err = json.Unmarshal(body, &u.File) - - if err != nil { - return err - } - case "folder": - err = json.Unmarshal(body, &u.Folder) - - if err != nil { - return err - } - case "deleted": - err = json.Unmarshal(body, &u.Deleted) - - if err != nil { - return err - } - } - return nil -} - -// IsMetadataFromJSON converts JSON to a concrete IsMetadata instance -func IsMetadataFromJSON(data []byte) (IsMetadata, error) { - var t metadataUnion - if err := json.Unmarshal(data, &t); err != nil { - return nil, err - } - switch t.Tag { - case "file": - return t.File, nil - - case "folder": - return t.Folder, nil - - case "deleted": - return t.Deleted, nil - - } - return nil, nil -} - -// DeletedMetadata : Indicates that there used to be a file or folder at this -// path, but it no longer exists. -type DeletedMetadata struct { - Metadata -} - -// NewDeletedMetadata returns a new DeletedMetadata instance -func NewDeletedMetadata(Name string) *DeletedMetadata { - s := new(DeletedMetadata) - s.Name = Name - return s -} - -// Dimensions : Dimensions for a photo or video. -type Dimensions struct { - // Height : Height of the photo/video. - Height uint64 `json:"height"` - // Width : Width of the photo/video. - Width uint64 `json:"width"` -} - -// NewDimensions returns a new Dimensions instance -func NewDimensions(Height uint64, Width uint64) *Dimensions { - s := new(Dimensions) - s.Height = Height - s.Width = Width - return s -} - -// DownloadArg : has no documentation (yet) -type DownloadArg struct { - // Path : The path of the file to download. - Path string `json:"path"` - // Rev : Please specify revision in `path` instead. - Rev string `json:"rev,omitempty"` - // ExtraHeaders can be used to pass Range, If-None-Match headers - ExtraHeaders map[string]string `json:"-"` -} - -// NewDownloadArg returns a new DownloadArg instance -func NewDownloadArg(Path string) *DownloadArg { - s := new(DownloadArg) - s.Path = Path - return s -} - -// DownloadError : has no documentation (yet) -type DownloadError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for DownloadError -const ( - DownloadErrorPath = "path" - DownloadErrorUnsupportedFile = "unsupported_file" - DownloadErrorOther = "other" -) - -// UnmarshalJSON deserializes into a DownloadError instance -func (u *DownloadError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// DownloadZipArg : has no documentation (yet) -type DownloadZipArg struct { - // Path : The path of the folder to download. - Path string `json:"path"` -} - -// NewDownloadZipArg returns a new DownloadZipArg instance -func NewDownloadZipArg(Path string) *DownloadZipArg { - s := new(DownloadZipArg) - s.Path = Path - return s -} - -// DownloadZipError : has no documentation (yet) -type DownloadZipError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for DownloadZipError -const ( - DownloadZipErrorPath = "path" - DownloadZipErrorTooLarge = "too_large" - DownloadZipErrorTooManyFiles = "too_many_files" - DownloadZipErrorOther = "other" -) - -// UnmarshalJSON deserializes into a DownloadZipError instance -func (u *DownloadZipError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// DownloadZipResult : has no documentation (yet) -type DownloadZipResult struct { - // Metadata : has no documentation (yet) - Metadata *FolderMetadata `json:"metadata"` -} - -// NewDownloadZipResult returns a new DownloadZipResult instance -func NewDownloadZipResult(Metadata *FolderMetadata) *DownloadZipResult { - s := new(DownloadZipResult) - s.Metadata = Metadata - return s -} - -// ExportArg : has no documentation (yet) -type ExportArg struct { - // Path : The path of the file to be exported. - Path string `json:"path"` -} - -// NewExportArg returns a new ExportArg instance -func NewExportArg(Path string) *ExportArg { - s := new(ExportArg) - s.Path = Path - return s -} - -// ExportError : has no documentation (yet) -type ExportError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for ExportError -const ( - ExportErrorPath = "path" - ExportErrorNonExportable = "non_exportable" - ExportErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ExportError instance -func (u *ExportError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ExportInfo : Export information for a file. -type ExportInfo struct { - // ExportAs : Format to which the file can be exported to. - ExportAs string `json:"export_as,omitempty"` -} - -// NewExportInfo returns a new ExportInfo instance -func NewExportInfo() *ExportInfo { - s := new(ExportInfo) - return s -} - -// ExportMetadata : has no documentation (yet) -type ExportMetadata struct { - // Name : The last component of the path (including extension). This never - // contains a slash. - Name string `json:"name"` - // Size : The file size in bytes. - Size uint64 `json:"size"` - // ExportHash : A hash based on the exported file content. This field can be - // used to verify data integrity. Similar to content hash. For more - // information see our `Content hash` - // page. - ExportHash string `json:"export_hash,omitempty"` -} - -// NewExportMetadata returns a new ExportMetadata instance -func NewExportMetadata(Name string, Size uint64) *ExportMetadata { - s := new(ExportMetadata) - s.Name = Name - s.Size = Size - return s -} - -// ExportResult : has no documentation (yet) -type ExportResult struct { - // ExportMetadata : Metadata for the exported version of the file. - ExportMetadata *ExportMetadata `json:"export_metadata"` - // FileMetadata : Metadata for the original file. - FileMetadata *FileMetadata `json:"file_metadata"` -} - -// NewExportResult returns a new ExportResult instance -func NewExportResult(ExportMetadata *ExportMetadata, FileMetadata *FileMetadata) *ExportResult { - s := new(ExportResult) - s.ExportMetadata = ExportMetadata - s.FileMetadata = FileMetadata - return s -} - -// FileMetadata : has no documentation (yet) -type FileMetadata struct { - Metadata - // Id : A unique identifier for the file. - Id string `json:"id"` - // ClientModified : For files, this is the modification time set by the - // desktop client when the file was added to Dropbox. Since this time is not - // verified (the Dropbox server stores whatever the desktop client sends - // up), this should only be used for display purposes (such as sorting) and - // not, for example, to determine if a file has changed or not. - ClientModified time.Time `json:"client_modified"` - // ServerModified : The last time the file was modified on Dropbox. - ServerModified time.Time `json:"server_modified"` - // Rev : A unique identifier for the current revision of a file. This field - // is the same rev as elsewhere in the API and can be used to detect changes - // and avoid conflicts. - Rev string `json:"rev"` - // Size : The file size in bytes. - Size uint64 `json:"size"` - // MediaInfo : Additional information if the file is a photo or video. This - // field will not be set on entries returned by `listFolder`, - // `listFolderContinue`, or `getThumbnailBatch`, starting December 2, 2019. - MediaInfo *MediaInfo `json:"media_info,omitempty"` - // SymlinkInfo : Set if this file is a symlink. - SymlinkInfo *SymlinkInfo `json:"symlink_info,omitempty"` - // SharingInfo : Set if this file is contained in a shared folder. - SharingInfo *FileSharingInfo `json:"sharing_info,omitempty"` - // IsDownloadable : If true, file can be downloaded directly; else the file - // must be exported. - IsDownloadable bool `json:"is_downloadable"` - // ExportInfo : Information about format this file can be exported to. This - // filed must be set if `is_downloadable` is set to false. - ExportInfo *ExportInfo `json:"export_info,omitempty"` - // PropertyGroups : Additional information if the file has custom properties - // with the property template specified. - PropertyGroups []*file_properties.PropertyGroup `json:"property_groups,omitempty"` - // HasExplicitSharedMembers : This flag will only be present if - // include_has_explicit_shared_members is true in `listFolder` or - // `getMetadata`. If this flag is present, it will be true if this file has - // any explicit shared members. This is different from sharing_info in that - // this could be true in the case where a file has explicit members but is - // not contained within a shared folder. - HasExplicitSharedMembers bool `json:"has_explicit_shared_members,omitempty"` - // ContentHash : A hash of the file content. This field can be used to - // verify data integrity. For more information see our `Content hash` - // page. - ContentHash string `json:"content_hash,omitempty"` -} - -// NewFileMetadata returns a new FileMetadata instance -func NewFileMetadata(Name string, Id string, ClientModified time.Time, ServerModified time.Time, Rev string, Size uint64) *FileMetadata { - s := new(FileMetadata) - s.Name = Name - s.Id = Id - s.ClientModified = ClientModified - s.ServerModified = ServerModified - s.Rev = Rev - s.Size = Size - s.IsDownloadable = true - return s -} - -// SharingInfo : Sharing info for a file or folder. -type SharingInfo struct { - // ReadOnly : True if the file or folder is inside a read-only shared - // folder. - ReadOnly bool `json:"read_only"` -} - -// NewSharingInfo returns a new SharingInfo instance -func NewSharingInfo(ReadOnly bool) *SharingInfo { - s := new(SharingInfo) - s.ReadOnly = ReadOnly - return s -} - -// FileSharingInfo : Sharing info for a file which is contained by a shared -// folder. -type FileSharingInfo struct { - SharingInfo - // ParentSharedFolderId : ID of shared folder that holds this file. - ParentSharedFolderId string `json:"parent_shared_folder_id"` - // ModifiedBy : The last user who modified the file. This field will be null - // if the user's account has been deleted. - ModifiedBy string `json:"modified_by,omitempty"` -} - -// NewFileSharingInfo returns a new FileSharingInfo instance -func NewFileSharingInfo(ReadOnly bool, ParentSharedFolderId string) *FileSharingInfo { - s := new(FileSharingInfo) - s.ReadOnly = ReadOnly - s.ParentSharedFolderId = ParentSharedFolderId - return s -} - -// FolderMetadata : has no documentation (yet) -type FolderMetadata struct { - Metadata - // Id : A unique identifier for the folder. - Id string `json:"id"` - // SharedFolderId : Please use `sharing_info` instead. - SharedFolderId string `json:"shared_folder_id,omitempty"` - // SharingInfo : Set if the folder is contained in a shared folder or is a - // shared folder mount point. - SharingInfo *FolderSharingInfo `json:"sharing_info,omitempty"` - // PropertyGroups : Additional information if the file has custom properties - // with the property template specified. Note that only properties - // associated with user-owned templates, not team-owned templates, can be - // attached to folders. - PropertyGroups []*file_properties.PropertyGroup `json:"property_groups,omitempty"` -} - -// NewFolderMetadata returns a new FolderMetadata instance -func NewFolderMetadata(Name string, Id string) *FolderMetadata { - s := new(FolderMetadata) - s.Name = Name - s.Id = Id - return s -} - -// FolderSharingInfo : Sharing info for a folder which is contained in a shared -// folder or is a shared folder mount point. -type FolderSharingInfo struct { - SharingInfo - // ParentSharedFolderId : Set if the folder is contained by a shared folder. - ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` - // SharedFolderId : If this folder is a shared folder mount point, the ID of - // the shared folder mounted at this location. - SharedFolderId string `json:"shared_folder_id,omitempty"` - // TraverseOnly : Specifies that the folder can only be traversed and the - // user can only see a limited subset of the contents of this folder because - // they don't have read access to this folder. They do, however, have access - // to some sub folder. - TraverseOnly bool `json:"traverse_only"` - // NoAccess : Specifies that the folder cannot be accessed by the user. - NoAccess bool `json:"no_access"` -} - -// NewFolderSharingInfo returns a new FolderSharingInfo instance -func NewFolderSharingInfo(ReadOnly bool) *FolderSharingInfo { - s := new(FolderSharingInfo) - s.ReadOnly = ReadOnly - s.TraverseOnly = false - s.NoAccess = false - return s -} - -// GetCopyReferenceArg : has no documentation (yet) -type GetCopyReferenceArg struct { - // Path : The path to the file or folder you want to get a copy reference - // to. - Path string `json:"path"` -} - -// NewGetCopyReferenceArg returns a new GetCopyReferenceArg instance -func NewGetCopyReferenceArg(Path string) *GetCopyReferenceArg { - s := new(GetCopyReferenceArg) - s.Path = Path - return s -} - -// GetCopyReferenceError : has no documentation (yet) -type GetCopyReferenceError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for GetCopyReferenceError -const ( - GetCopyReferenceErrorPath = "path" - GetCopyReferenceErrorOther = "other" -) - -// UnmarshalJSON deserializes into a GetCopyReferenceError instance -func (u *GetCopyReferenceError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// GetCopyReferenceResult : has no documentation (yet) -type GetCopyReferenceResult struct { - // Metadata : Metadata of the file or folder. - Metadata IsMetadata `json:"metadata"` - // CopyReference : A copy reference to the file or folder. - CopyReference string `json:"copy_reference"` - // Expires : The expiration date of the copy reference. This value is - // currently set to be far enough in the future so that expiration is - // effectively not an issue. - Expires time.Time `json:"expires"` -} - -// NewGetCopyReferenceResult returns a new GetCopyReferenceResult instance -func NewGetCopyReferenceResult(Metadata IsMetadata, CopyReference string, Expires time.Time) *GetCopyReferenceResult { - s := new(GetCopyReferenceResult) - s.Metadata = Metadata - s.CopyReference = CopyReference - s.Expires = Expires - return s -} - -// UnmarshalJSON deserializes into a GetCopyReferenceResult instance -func (u *GetCopyReferenceResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Metadata : Metadata of the file or folder. - Metadata json.RawMessage `json:"metadata"` - // CopyReference : A copy reference to the file or folder. - CopyReference string `json:"copy_reference"` - // Expires : The expiration date of the copy reference. This value is - // currently set to be far enough in the future so that expiration is - // effectively not an issue. - Expires time.Time `json:"expires"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - u.CopyReference = w.CopyReference - u.Expires = w.Expires - return nil -} - -// GetTemporaryLinkArg : has no documentation (yet) -type GetTemporaryLinkArg struct { - // Path : The path to the file you want a temporary link to. - Path string `json:"path"` -} - -// NewGetTemporaryLinkArg returns a new GetTemporaryLinkArg instance -func NewGetTemporaryLinkArg(Path string) *GetTemporaryLinkArg { - s := new(GetTemporaryLinkArg) - s.Path = Path - return s -} - -// GetTemporaryLinkError : has no documentation (yet) -type GetTemporaryLinkError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for GetTemporaryLinkError -const ( - GetTemporaryLinkErrorPath = "path" - GetTemporaryLinkErrorEmailNotVerified = "email_not_verified" - GetTemporaryLinkErrorUnsupportedFile = "unsupported_file" - GetTemporaryLinkErrorOther = "other" -) - -// UnmarshalJSON deserializes into a GetTemporaryLinkError instance -func (u *GetTemporaryLinkError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// GetTemporaryLinkResult : has no documentation (yet) -type GetTemporaryLinkResult struct { - // Metadata : Metadata of the file. - Metadata *FileMetadata `json:"metadata"` - // Link : The temporary link which can be used to stream content the file. - Link string `json:"link"` -} - -// NewGetTemporaryLinkResult returns a new GetTemporaryLinkResult instance -func NewGetTemporaryLinkResult(Metadata *FileMetadata, Link string) *GetTemporaryLinkResult { - s := new(GetTemporaryLinkResult) - s.Metadata = Metadata - s.Link = Link - return s -} - -// GetTemporaryUploadLinkArg : has no documentation (yet) -type GetTemporaryUploadLinkArg struct { - // CommitInfo : Contains the path and other optional modifiers for the - // future upload commit. Equivalent to the parameters provided to `upload`. - CommitInfo *CommitInfo `json:"commit_info"` - // Duration : How long before this link expires, in seconds. Attempting to - // start an upload with this link longer than this period of time after - // link creation will result in an error. - Duration float64 `json:"duration"` -} - -// NewGetTemporaryUploadLinkArg returns a new GetTemporaryUploadLinkArg instance -func NewGetTemporaryUploadLinkArg(CommitInfo *CommitInfo) *GetTemporaryUploadLinkArg { - s := new(GetTemporaryUploadLinkArg) - s.CommitInfo = CommitInfo - s.Duration = 14400.0 - return s -} - -// GetTemporaryUploadLinkResult : has no documentation (yet) -type GetTemporaryUploadLinkResult struct { - // Link : The temporary link which can be used to stream a file to a Dropbox - // location. - Link string `json:"link"` -} - -// NewGetTemporaryUploadLinkResult returns a new GetTemporaryUploadLinkResult instance -func NewGetTemporaryUploadLinkResult(Link string) *GetTemporaryUploadLinkResult { - s := new(GetTemporaryUploadLinkResult) - s.Link = Link - return s -} - -// GetThumbnailBatchArg : Arguments for `getThumbnailBatch`. -type GetThumbnailBatchArg struct { - // Entries : List of files to get thumbnails. - Entries []*ThumbnailArg `json:"entries"` -} - -// NewGetThumbnailBatchArg returns a new GetThumbnailBatchArg instance -func NewGetThumbnailBatchArg(Entries []*ThumbnailArg) *GetThumbnailBatchArg { - s := new(GetThumbnailBatchArg) - s.Entries = Entries - return s -} - -// GetThumbnailBatchError : has no documentation (yet) -type GetThumbnailBatchError struct { - dropbox.Tagged -} - -// Valid tag values for GetThumbnailBatchError -const ( - GetThumbnailBatchErrorTooManyFiles = "too_many_files" - GetThumbnailBatchErrorOther = "other" -) - -// GetThumbnailBatchResult : has no documentation (yet) -type GetThumbnailBatchResult struct { - // Entries : List of files and their thumbnails. - Entries []*GetThumbnailBatchResultEntry `json:"entries"` -} - -// NewGetThumbnailBatchResult returns a new GetThumbnailBatchResult instance -func NewGetThumbnailBatchResult(Entries []*GetThumbnailBatchResultEntry) *GetThumbnailBatchResult { - s := new(GetThumbnailBatchResult) - s.Entries = Entries - return s -} - -// GetThumbnailBatchResultData : has no documentation (yet) -type GetThumbnailBatchResultData struct { - // Metadata : has no documentation (yet) - Metadata *FileMetadata `json:"metadata"` - // Thumbnail : A string containing the base64-encoded thumbnail data for - // this file. - Thumbnail string `json:"thumbnail"` -} - -// NewGetThumbnailBatchResultData returns a new GetThumbnailBatchResultData instance -func NewGetThumbnailBatchResultData(Metadata *FileMetadata, Thumbnail string) *GetThumbnailBatchResultData { - s := new(GetThumbnailBatchResultData) - s.Metadata = Metadata - s.Thumbnail = Thumbnail - return s -} - -// GetThumbnailBatchResultEntry : has no documentation (yet) -type GetThumbnailBatchResultEntry struct { - dropbox.Tagged - // Success : has no documentation (yet) - Success *GetThumbnailBatchResultData `json:"success,omitempty"` - // Failure : The result for this file if it was an error. - Failure *ThumbnailError `json:"failure,omitempty"` -} - -// Valid tag values for GetThumbnailBatchResultEntry -const ( - GetThumbnailBatchResultEntrySuccess = "success" - GetThumbnailBatchResultEntryFailure = "failure" - GetThumbnailBatchResultEntryOther = "other" -) - -// UnmarshalJSON deserializes into a GetThumbnailBatchResultEntry instance -func (u *GetThumbnailBatchResultEntry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failure : The result for this file if it was an error. - Failure *ThumbnailError `json:"failure,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "failure": - u.Failure = w.Failure - - if err != nil { - return err - } - } - return nil -} - -// GpsCoordinates : GPS coordinates for a photo or video. -type GpsCoordinates struct { - // Latitude : Latitude of the GPS coordinates. - Latitude float64 `json:"latitude"` - // Longitude : Longitude of the GPS coordinates. - Longitude float64 `json:"longitude"` -} - -// NewGpsCoordinates returns a new GpsCoordinates instance -func NewGpsCoordinates(Latitude float64, Longitude float64) *GpsCoordinates { - s := new(GpsCoordinates) - s.Latitude = Latitude - s.Longitude = Longitude - return s -} - -// ListFolderArg : has no documentation (yet) -type ListFolderArg struct { - // Path : A unique identifier for the file. - Path string `json:"path"` - // Recursive : If true, the list folder operation will be applied - // recursively to all subfolders and the response will contain contents of - // all subfolders. - Recursive bool `json:"recursive"` - // IncludeMediaInfo : If true, `FileMetadata.media_info` is set for photo - // and video. This parameter will no longer have an effect starting December - // 2, 2019. - IncludeMediaInfo bool `json:"include_media_info"` - // IncludeDeleted : If true, the results will include entries for files and - // folders that used to exist but were deleted. - IncludeDeleted bool `json:"include_deleted"` - // IncludeHasExplicitSharedMembers : If true, the results will include a - // flag for each file indicating whether or not that file has any explicit - // members. - IncludeHasExplicitSharedMembers bool `json:"include_has_explicit_shared_members"` - // IncludeMountedFolders : If true, the results will include entries under - // mounted folders which includes app folder, shared folder and team folder. - IncludeMountedFolders bool `json:"include_mounted_folders"` - // Limit : The maximum number of results to return per request. Note: This - // is an approximate number and there can be slightly more entries returned - // in some cases. - Limit uint32 `json:"limit,omitempty"` - // SharedLink : A shared link to list the contents of. If the link is - // password-protected, the password must be provided. If this field is - // present, `ListFolderArg.path` will be relative to root of the shared - // link. Only non-recursive mode is supported for shared link. - SharedLink *SharedLink `json:"shared_link,omitempty"` - // IncludePropertyGroups : If set to a valid list of template IDs, - // `FileMetadata.property_groups` is set if there exists property data - // associated with the file and each of the listed templates. - IncludePropertyGroups *file_properties.TemplateFilterBase `json:"include_property_groups,omitempty"` - // IncludeNonDownloadableFiles : If true, include files that are not - // downloadable, i.e. Google Docs. - IncludeNonDownloadableFiles bool `json:"include_non_downloadable_files"` -} - -// NewListFolderArg returns a new ListFolderArg instance -func NewListFolderArg(Path string) *ListFolderArg { - s := new(ListFolderArg) - s.Path = Path - s.Recursive = false - s.IncludeMediaInfo = false - s.IncludeDeleted = false - s.IncludeHasExplicitSharedMembers = false - s.IncludeMountedFolders = true - s.IncludeNonDownloadableFiles = true - return s -} - -// ListFolderContinueArg : has no documentation (yet) -type ListFolderContinueArg struct { - // Cursor : The cursor returned by your last call to `listFolder` or - // `listFolderContinue`. - Cursor string `json:"cursor"` -} - -// NewListFolderContinueArg returns a new ListFolderContinueArg instance -func NewListFolderContinueArg(Cursor string) *ListFolderContinueArg { - s := new(ListFolderContinueArg) - s.Cursor = Cursor - return s -} - -// ListFolderContinueError : has no documentation (yet) -type ListFolderContinueError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for ListFolderContinueError -const ( - ListFolderContinueErrorPath = "path" - ListFolderContinueErrorReset = "reset" - ListFolderContinueErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListFolderContinueError instance -func (u *ListFolderContinueError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ListFolderError : has no documentation (yet) -type ListFolderError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for ListFolderError -const ( - ListFolderErrorPath = "path" - ListFolderErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListFolderError instance -func (u *ListFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ListFolderGetLatestCursorResult : has no documentation (yet) -type ListFolderGetLatestCursorResult struct { - // Cursor : Pass the cursor into `listFolderContinue` to see what's changed - // in the folder since your previous query. - Cursor string `json:"cursor"` -} - -// NewListFolderGetLatestCursorResult returns a new ListFolderGetLatestCursorResult instance -func NewListFolderGetLatestCursorResult(Cursor string) *ListFolderGetLatestCursorResult { - s := new(ListFolderGetLatestCursorResult) - s.Cursor = Cursor - return s -} - -// ListFolderLongpollArg : has no documentation (yet) -type ListFolderLongpollArg struct { - // Cursor : A cursor as returned by `listFolder` or `listFolderContinue`. - // Cursors retrieved by setting `ListFolderArg.include_media_info` to true - // are not supported. - Cursor string `json:"cursor"` - // Timeout : A timeout in seconds. The request will block for at most this - // length of time, plus up to 90 seconds of random jitter added to avoid the - // thundering herd problem. Care should be taken when using this parameter, - // as some network infrastructure does not support long timeouts. - Timeout uint64 `json:"timeout"` -} - -// NewListFolderLongpollArg returns a new ListFolderLongpollArg instance -func NewListFolderLongpollArg(Cursor string) *ListFolderLongpollArg { - s := new(ListFolderLongpollArg) - s.Cursor = Cursor - s.Timeout = 30 - return s -} - -// ListFolderLongpollError : has no documentation (yet) -type ListFolderLongpollError struct { - dropbox.Tagged -} - -// Valid tag values for ListFolderLongpollError -const ( - ListFolderLongpollErrorReset = "reset" - ListFolderLongpollErrorOther = "other" -) - -// ListFolderLongpollResult : has no documentation (yet) -type ListFolderLongpollResult struct { - // Changes : Indicates whether new changes are available. If true, call - // `listFolderContinue` to retrieve the changes. - Changes bool `json:"changes"` - // Backoff : If present, backoff for at least this many seconds before - // calling `listFolderLongpoll` again. - Backoff uint64 `json:"backoff,omitempty"` -} - -// NewListFolderLongpollResult returns a new ListFolderLongpollResult instance -func NewListFolderLongpollResult(Changes bool) *ListFolderLongpollResult { - s := new(ListFolderLongpollResult) - s.Changes = Changes - return s -} - -// ListFolderResult : has no documentation (yet) -type ListFolderResult struct { - // Entries : The files and (direct) subfolders in the folder. - Entries []IsMetadata `json:"entries"` - // Cursor : Pass the cursor into `listFolderContinue` to see what's changed - // in the folder since your previous query. - Cursor string `json:"cursor"` - // HasMore : If true, then there are more entries available. Pass the cursor - // to `listFolderContinue` to retrieve the rest. - HasMore bool `json:"has_more"` -} - -// NewListFolderResult returns a new ListFolderResult instance -func NewListFolderResult(Entries []IsMetadata, Cursor string, HasMore bool) *ListFolderResult { - s := new(ListFolderResult) - s.Entries = Entries - s.Cursor = Cursor - s.HasMore = HasMore - return s -} - -// UnmarshalJSON deserializes into a ListFolderResult instance -func (u *ListFolderResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Entries : The files and (direct) subfolders in the folder. - Entries []json.RawMessage `json:"entries"` - // Cursor : Pass the cursor into `listFolderContinue` to see what's - // changed in the folder since your previous query. - Cursor string `json:"cursor"` - // HasMore : If true, then there are more entries available. Pass the - // cursor to `listFolderContinue` to retrieve the rest. - HasMore bool `json:"has_more"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - u.Entries = make([]IsMetadata, len(w.Entries)) - for i, e := range w.Entries { - v, err := IsMetadataFromJSON(e) - if err != nil { - return err - } - u.Entries[i] = v - } - u.Cursor = w.Cursor - u.HasMore = w.HasMore - return nil -} - -// ListRevisionsArg : has no documentation (yet) -type ListRevisionsArg struct { - // Path : The path to the file you want to see the revisions of. - Path string `json:"path"` - // Mode : Determines the behavior of the API in listing the revisions for a - // given file path or id. - Mode *ListRevisionsMode `json:"mode"` - // Limit : The maximum number of revision entries returned. - Limit uint64 `json:"limit"` -} - -// NewListRevisionsArg returns a new ListRevisionsArg instance -func NewListRevisionsArg(Path string) *ListRevisionsArg { - s := new(ListRevisionsArg) - s.Path = Path - s.Mode = &ListRevisionsMode{Tagged: dropbox.Tagged{"path"}} - s.Limit = 10 - return s -} - -// ListRevisionsError : has no documentation (yet) -type ListRevisionsError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for ListRevisionsError -const ( - ListRevisionsErrorPath = "path" - ListRevisionsErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListRevisionsError instance -func (u *ListRevisionsError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ListRevisionsMode : has no documentation (yet) -type ListRevisionsMode struct { - dropbox.Tagged -} - -// Valid tag values for ListRevisionsMode -const ( - ListRevisionsModePath = "path" - ListRevisionsModeId = "id" - ListRevisionsModeOther = "other" -) - -// ListRevisionsResult : has no documentation (yet) -type ListRevisionsResult struct { - // IsDeleted : If the file identified by the latest revision in the response - // is either deleted or moved. - IsDeleted bool `json:"is_deleted"` - // ServerDeleted : The time of deletion if the file was deleted. - ServerDeleted time.Time `json:"server_deleted,omitempty"` - // Entries : The revisions for the file. Only revisions that are not deleted - // will show up here. - Entries []*FileMetadata `json:"entries"` -} - -// NewListRevisionsResult returns a new ListRevisionsResult instance -func NewListRevisionsResult(IsDeleted bool, Entries []*FileMetadata) *ListRevisionsResult { - s := new(ListRevisionsResult) - s.IsDeleted = IsDeleted - s.Entries = Entries - return s -} - -// LookupError : has no documentation (yet) -type LookupError struct { - dropbox.Tagged - // MalformedPath : The given path does not satisfy the required path format. - // Please refer to the `Path formats documentation` - // - // for more information. - MalformedPath string `json:"malformed_path,omitempty"` -} - -// Valid tag values for LookupError -const ( - LookupErrorMalformedPath = "malformed_path" - LookupErrorNotFound = "not_found" - LookupErrorNotFile = "not_file" - LookupErrorNotFolder = "not_folder" - LookupErrorRestrictedContent = "restricted_content" - LookupErrorUnsupportedContentType = "unsupported_content_type" - LookupErrorOther = "other" -) - -// UnmarshalJSON deserializes into a LookupError instance -func (u *LookupError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // MalformedPath : The given path does not satisfy the required path - // format. Please refer to the `Path formats documentation` - // - // for more information. - MalformedPath string `json:"malformed_path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "malformed_path": - u.MalformedPath = w.MalformedPath - - if err != nil { - return err - } - } - return nil -} - -// MediaInfo : has no documentation (yet) -type MediaInfo struct { - dropbox.Tagged - // Metadata : The metadata for the photo/video. - Metadata IsMediaMetadata `json:"metadata,omitempty"` -} - -// Valid tag values for MediaInfo -const ( - MediaInfoPending = "pending" - MediaInfoMetadata = "metadata" -) - -// UnmarshalJSON deserializes into a MediaInfo instance -func (u *MediaInfo) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Metadata : The metadata for the photo/video. - Metadata json.RawMessage `json:"metadata,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "metadata": - u.Metadata, err = IsMediaMetadataFromJSON(w.Metadata) - - if err != nil { - return err - } - } - return nil -} - -// MediaMetadata : Metadata for a photo or video. -type MediaMetadata struct { - // Dimensions : Dimension of the photo/video. - Dimensions *Dimensions `json:"dimensions,omitempty"` - // Location : The GPS coordinate of the photo/video. - Location *GpsCoordinates `json:"location,omitempty"` - // TimeTaken : The timestamp when the photo/video is taken. - TimeTaken time.Time `json:"time_taken,omitempty"` -} - -// NewMediaMetadata returns a new MediaMetadata instance -func NewMediaMetadata() *MediaMetadata { - s := new(MediaMetadata) - return s -} - -// IsMediaMetadata is the interface type for MediaMetadata and its subtypes -type IsMediaMetadata interface { - IsMediaMetadata() -} - -// IsMediaMetadata implements the IsMediaMetadata interface -func (u *MediaMetadata) IsMediaMetadata() {} - -type mediaMetadataUnion struct { - dropbox.Tagged - // Photo : has no documentation (yet) - Photo *PhotoMetadata `json:"photo,omitempty"` - // Video : has no documentation (yet) - Video *VideoMetadata `json:"video,omitempty"` -} - -// Valid tag values for MediaMetadata -const ( - MediaMetadataPhoto = "photo" - MediaMetadataVideo = "video" -) - -// UnmarshalJSON deserializes into a mediaMetadataUnion instance -func (u *mediaMetadataUnion) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "photo": - err = json.Unmarshal(body, &u.Photo) - - if err != nil { - return err - } - case "video": - err = json.Unmarshal(body, &u.Video) - - if err != nil { - return err - } - } - return nil -} - -// IsMediaMetadataFromJSON converts JSON to a concrete IsMediaMetadata instance -func IsMediaMetadataFromJSON(data []byte) (IsMediaMetadata, error) { - var t mediaMetadataUnion - if err := json.Unmarshal(data, &t); err != nil { - return nil, err - } - switch t.Tag { - case "photo": - return t.Photo, nil - - case "video": - return t.Video, nil - - } - return nil, nil -} - -// RelocationBatchArgBase : has no documentation (yet) -type RelocationBatchArgBase struct { - // Entries : List of entries to be moved or copied. Each entry is - // `RelocationPath`. - Entries []*RelocationPath `json:"entries"` - // Autorename : If there's a conflict with any file, have the Dropbox server - // try to autorename that file to avoid the conflict. - Autorename bool `json:"autorename"` -} - -// NewRelocationBatchArgBase returns a new RelocationBatchArgBase instance -func NewRelocationBatchArgBase(Entries []*RelocationPath) *RelocationBatchArgBase { - s := new(RelocationBatchArgBase) - s.Entries = Entries - s.Autorename = false - return s -} - -// MoveBatchArg : has no documentation (yet) -type MoveBatchArg struct { - RelocationBatchArgBase - // AllowOwnershipTransfer : Allow moves by owner even if it would result in - // an ownership transfer for the content being moved. This does not apply to - // copies. - AllowOwnershipTransfer bool `json:"allow_ownership_transfer"` -} - -// NewMoveBatchArg returns a new MoveBatchArg instance -func NewMoveBatchArg(Entries []*RelocationPath) *MoveBatchArg { - s := new(MoveBatchArg) - s.Entries = Entries - s.Autorename = false - s.AllowOwnershipTransfer = false - return s -} - -// PhotoMetadata : Metadata for a photo. -type PhotoMetadata struct { - MediaMetadata -} - -// NewPhotoMetadata returns a new PhotoMetadata instance -func NewPhotoMetadata() *PhotoMetadata { - s := new(PhotoMetadata) - return s -} - -// PreviewArg : has no documentation (yet) -type PreviewArg struct { - // Path : The path of the file to preview. - Path string `json:"path"` - // Rev : Please specify revision in `path` instead. - Rev string `json:"rev,omitempty"` -} - -// NewPreviewArg returns a new PreviewArg instance -func NewPreviewArg(Path string) *PreviewArg { - s := new(PreviewArg) - s.Path = Path - return s -} - -// PreviewError : has no documentation (yet) -type PreviewError struct { - dropbox.Tagged - // Path : An error occurs when downloading metadata for the file. - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for PreviewError -const ( - PreviewErrorPath = "path" - PreviewErrorInProgress = "in_progress" - PreviewErrorUnsupportedExtension = "unsupported_extension" - PreviewErrorUnsupportedContent = "unsupported_content" -) - -// UnmarshalJSON deserializes into a PreviewError instance -func (u *PreviewError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : An error occurs when downloading metadata for the file. - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// RelocationPath : has no documentation (yet) -type RelocationPath struct { - // FromPath : Path in the user's Dropbox to be copied or moved. - FromPath string `json:"from_path"` - // ToPath : Path in the user's Dropbox that is the destination. - ToPath string `json:"to_path"` -} - -// NewRelocationPath returns a new RelocationPath instance -func NewRelocationPath(FromPath string, ToPath string) *RelocationPath { - s := new(RelocationPath) - s.FromPath = FromPath - s.ToPath = ToPath - return s -} - -// RelocationArg : has no documentation (yet) -type RelocationArg struct { - RelocationPath - // AllowSharedFolder : If true, `copy` will copy contents in shared folder, - // otherwise `RelocationError.cant_copy_shared_folder` will be returned if - // `from_path` contains shared folder. This field is always true for `move`. - AllowSharedFolder bool `json:"allow_shared_folder"` - // Autorename : If there's a conflict, have the Dropbox server try to - // autorename the file to avoid the conflict. - Autorename bool `json:"autorename"` - // AllowOwnershipTransfer : Allow moves by owner even if it would result in - // an ownership transfer for the content being moved. This does not apply to - // copies. - AllowOwnershipTransfer bool `json:"allow_ownership_transfer"` -} - -// NewRelocationArg returns a new RelocationArg instance -func NewRelocationArg(FromPath string, ToPath string) *RelocationArg { - s := new(RelocationArg) - s.FromPath = FromPath - s.ToPath = ToPath - s.AllowSharedFolder = false - s.Autorename = false - s.AllowOwnershipTransfer = false - return s -} - -// RelocationBatchArg : has no documentation (yet) -type RelocationBatchArg struct { - RelocationBatchArgBase - // AllowSharedFolder : If true, `copyBatch` will copy contents in shared - // folder, otherwise `RelocationError.cant_copy_shared_folder` will be - // returned if `RelocationPath.from_path` contains shared folder. This field - // is always true for `moveBatch`. - AllowSharedFolder bool `json:"allow_shared_folder"` - // AllowOwnershipTransfer : Allow moves by owner even if it would result in - // an ownership transfer for the content being moved. This does not apply to - // copies. - AllowOwnershipTransfer bool `json:"allow_ownership_transfer"` -} - -// NewRelocationBatchArg returns a new RelocationBatchArg instance -func NewRelocationBatchArg(Entries []*RelocationPath) *RelocationBatchArg { - s := new(RelocationBatchArg) - s.Entries = Entries - s.Autorename = false - s.AllowSharedFolder = false - s.AllowOwnershipTransfer = false - return s -} - -// RelocationError : has no documentation (yet) -type RelocationError struct { - dropbox.Tagged - // FromLookup : has no documentation (yet) - FromLookup *LookupError `json:"from_lookup,omitempty"` - // FromWrite : has no documentation (yet) - FromWrite *WriteError `json:"from_write,omitempty"` - // To : has no documentation (yet) - To *WriteError `json:"to,omitempty"` -} - -// Valid tag values for RelocationError -const ( - RelocationErrorFromLookup = "from_lookup" - RelocationErrorFromWrite = "from_write" - RelocationErrorTo = "to" - RelocationErrorCantCopySharedFolder = "cant_copy_shared_folder" - RelocationErrorCantNestSharedFolder = "cant_nest_shared_folder" - RelocationErrorCantMoveFolderIntoItself = "cant_move_folder_into_itself" - RelocationErrorTooManyFiles = "too_many_files" - RelocationErrorDuplicatedOrNestedPaths = "duplicated_or_nested_paths" - RelocationErrorCantTransferOwnership = "cant_transfer_ownership" - RelocationErrorInsufficientQuota = "insufficient_quota" - RelocationErrorInternalError = "internal_error" - RelocationErrorCantMoveSharedFolder = "cant_move_shared_folder" - RelocationErrorOther = "other" -) - -// UnmarshalJSON deserializes into a RelocationError instance -func (u *RelocationError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // FromLookup : has no documentation (yet) - FromLookup *LookupError `json:"from_lookup,omitempty"` - // FromWrite : has no documentation (yet) - FromWrite *WriteError `json:"from_write,omitempty"` - // To : has no documentation (yet) - To *WriteError `json:"to,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "from_lookup": - u.FromLookup = w.FromLookup - - if err != nil { - return err - } - case "from_write": - u.FromWrite = w.FromWrite - - if err != nil { - return err - } - case "to": - u.To = w.To - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchError : has no documentation (yet) -type RelocationBatchError struct { - dropbox.Tagged - // FromLookup : has no documentation (yet) - FromLookup *LookupError `json:"from_lookup,omitempty"` - // FromWrite : has no documentation (yet) - FromWrite *WriteError `json:"from_write,omitempty"` - // To : has no documentation (yet) - To *WriteError `json:"to,omitempty"` -} - -// Valid tag values for RelocationBatchError -const ( - RelocationBatchErrorFromLookup = "from_lookup" - RelocationBatchErrorFromWrite = "from_write" - RelocationBatchErrorTo = "to" - RelocationBatchErrorCantCopySharedFolder = "cant_copy_shared_folder" - RelocationBatchErrorCantNestSharedFolder = "cant_nest_shared_folder" - RelocationBatchErrorCantMoveFolderIntoItself = "cant_move_folder_into_itself" - RelocationBatchErrorTooManyFiles = "too_many_files" - RelocationBatchErrorDuplicatedOrNestedPaths = "duplicated_or_nested_paths" - RelocationBatchErrorCantTransferOwnership = "cant_transfer_ownership" - RelocationBatchErrorInsufficientQuota = "insufficient_quota" - RelocationBatchErrorInternalError = "internal_error" - RelocationBatchErrorCantMoveSharedFolder = "cant_move_shared_folder" - RelocationBatchErrorOther = "other" - RelocationBatchErrorTooManyWriteOperations = "too_many_write_operations" -) - -// UnmarshalJSON deserializes into a RelocationBatchError instance -func (u *RelocationBatchError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // FromLookup : has no documentation (yet) - FromLookup *LookupError `json:"from_lookup,omitempty"` - // FromWrite : has no documentation (yet) - FromWrite *WriteError `json:"from_write,omitempty"` - // To : has no documentation (yet) - To *WriteError `json:"to,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "from_lookup": - u.FromLookup = w.FromLookup - - if err != nil { - return err - } - case "from_write": - u.FromWrite = w.FromWrite - - if err != nil { - return err - } - case "to": - u.To = w.To - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchErrorEntry : has no documentation (yet) -type RelocationBatchErrorEntry struct { - dropbox.Tagged - // RelocationError : User errors that retry won't help. - RelocationError *RelocationError `json:"relocation_error,omitempty"` -} - -// Valid tag values for RelocationBatchErrorEntry -const ( - RelocationBatchErrorEntryRelocationError = "relocation_error" - RelocationBatchErrorEntryInternalError = "internal_error" - RelocationBatchErrorEntryTooManyWriteOperations = "too_many_write_operations" - RelocationBatchErrorEntryOther = "other" -) - -// UnmarshalJSON deserializes into a RelocationBatchErrorEntry instance -func (u *RelocationBatchErrorEntry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // RelocationError : User errors that retry won't help. - RelocationError *RelocationError `json:"relocation_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "relocation_error": - u.RelocationError = w.RelocationError - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchJobStatus : has no documentation (yet) -type RelocationBatchJobStatus struct { - dropbox.Tagged - // Complete : The copy or move batch job has finished. - Complete *RelocationBatchResult `json:"complete,omitempty"` - // Failed : The copy or move batch job has failed with exception. - Failed *RelocationBatchError `json:"failed,omitempty"` -} - -// Valid tag values for RelocationBatchJobStatus -const ( - RelocationBatchJobStatusInProgress = "in_progress" - RelocationBatchJobStatusComplete = "complete" - RelocationBatchJobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a RelocationBatchJobStatus instance -func (u *RelocationBatchJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : The copy or move batch job has failed with exception. - Failed *RelocationBatchError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchLaunch : Result returned by `copyBatch` or `moveBatch` that -// may either launch an asynchronous job or complete synchronously. -type RelocationBatchLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *RelocationBatchResult `json:"complete,omitempty"` -} - -// Valid tag values for RelocationBatchLaunch -const ( - RelocationBatchLaunchAsyncJobId = "async_job_id" - RelocationBatchLaunchComplete = "complete" - RelocationBatchLaunchOther = "other" -) - -// UnmarshalJSON deserializes into a RelocationBatchLaunch instance -func (u *RelocationBatchLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchResult : has no documentation (yet) -type RelocationBatchResult struct { - FileOpsResult - // Entries : has no documentation (yet) - Entries []*RelocationBatchResultData `json:"entries"` -} - -// NewRelocationBatchResult returns a new RelocationBatchResult instance -func NewRelocationBatchResult(Entries []*RelocationBatchResultData) *RelocationBatchResult { - s := new(RelocationBatchResult) - s.Entries = Entries - return s -} - -// RelocationBatchResultData : has no documentation (yet) -type RelocationBatchResultData struct { - // Metadata : Metadata of the relocated object. - Metadata IsMetadata `json:"metadata"` -} - -// NewRelocationBatchResultData returns a new RelocationBatchResultData instance -func NewRelocationBatchResultData(Metadata IsMetadata) *RelocationBatchResultData { - s := new(RelocationBatchResultData) - s.Metadata = Metadata - return s -} - -// UnmarshalJSON deserializes into a RelocationBatchResultData instance -func (u *RelocationBatchResultData) UnmarshalJSON(b []byte) error { - type wrap struct { - // Metadata : Metadata of the relocated object. - Metadata json.RawMessage `json:"metadata"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - return nil -} - -// RelocationBatchResultEntry : has no documentation (yet) -type RelocationBatchResultEntry struct { - dropbox.Tagged - // Success : has no documentation (yet) - Success IsMetadata `json:"success,omitempty"` - // Failure : has no documentation (yet) - Failure *RelocationBatchErrorEntry `json:"failure,omitempty"` -} - -// Valid tag values for RelocationBatchResultEntry -const ( - RelocationBatchResultEntrySuccess = "success" - RelocationBatchResultEntryFailure = "failure" - RelocationBatchResultEntryOther = "other" -) - -// UnmarshalJSON deserializes into a RelocationBatchResultEntry instance -func (u *RelocationBatchResultEntry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Success : has no documentation (yet) - Success json.RawMessage `json:"success,omitempty"` - // Failure : has no documentation (yet) - Failure *RelocationBatchErrorEntry `json:"failure,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - u.Success, err = IsMetadataFromJSON(w.Success) - - if err != nil { - return err - } - case "failure": - u.Failure = w.Failure - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchV2JobStatus : Result returned by `copyBatchCheck` or -// `moveBatchCheck` that may either be in progress or completed with result for -// each entry. -type RelocationBatchV2JobStatus struct { - dropbox.Tagged - // Complete : The copy or move batch job has finished. - Complete *RelocationBatchV2Result `json:"complete,omitempty"` -} - -// Valid tag values for RelocationBatchV2JobStatus -const ( - RelocationBatchV2JobStatusInProgress = "in_progress" - RelocationBatchV2JobStatusComplete = "complete" -) - -// UnmarshalJSON deserializes into a RelocationBatchV2JobStatus instance -func (u *RelocationBatchV2JobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchV2Launch : Result returned by `copyBatch` or `moveBatch` that -// may either launch an asynchronous job or complete synchronously. -type RelocationBatchV2Launch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *RelocationBatchV2Result `json:"complete,omitempty"` -} - -// Valid tag values for RelocationBatchV2Launch -const ( - RelocationBatchV2LaunchAsyncJobId = "async_job_id" - RelocationBatchV2LaunchComplete = "complete" -) - -// UnmarshalJSON deserializes into a RelocationBatchV2Launch instance -func (u *RelocationBatchV2Launch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// RelocationBatchV2Result : has no documentation (yet) -type RelocationBatchV2Result struct { - FileOpsResult - // Entries : Each entry in CopyBatchArg.entries or `MoveBatchArg.entries` - // will appear at the same position inside - // `RelocationBatchV2Result.entries`. - Entries []*RelocationBatchResultEntry `json:"entries"` -} - -// NewRelocationBatchV2Result returns a new RelocationBatchV2Result instance -func NewRelocationBatchV2Result(Entries []*RelocationBatchResultEntry) *RelocationBatchV2Result { - s := new(RelocationBatchV2Result) - s.Entries = Entries - return s -} - -// RelocationResult : has no documentation (yet) -type RelocationResult struct { - FileOpsResult - // Metadata : Metadata of the relocated object. - Metadata IsMetadata `json:"metadata"` -} - -// NewRelocationResult returns a new RelocationResult instance -func NewRelocationResult(Metadata IsMetadata) *RelocationResult { - s := new(RelocationResult) - s.Metadata = Metadata - return s -} - -// UnmarshalJSON deserializes into a RelocationResult instance -func (u *RelocationResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Metadata : Metadata of the relocated object. - Metadata json.RawMessage `json:"metadata"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - return nil -} - -// RestoreArg : has no documentation (yet) -type RestoreArg struct { - // Path : The path to save the restored file. - Path string `json:"path"` - // Rev : The revision to restore. - Rev string `json:"rev"` -} - -// NewRestoreArg returns a new RestoreArg instance -func NewRestoreArg(Path string, Rev string) *RestoreArg { - s := new(RestoreArg) - s.Path = Path - s.Rev = Rev - return s -} - -// RestoreError : has no documentation (yet) -type RestoreError struct { - dropbox.Tagged - // PathLookup : An error occurs when downloading metadata for the file. - PathLookup *LookupError `json:"path_lookup,omitempty"` - // PathWrite : An error occurs when trying to restore the file to that path. - PathWrite *WriteError `json:"path_write,omitempty"` -} - -// Valid tag values for RestoreError -const ( - RestoreErrorPathLookup = "path_lookup" - RestoreErrorPathWrite = "path_write" - RestoreErrorInvalidRevision = "invalid_revision" - RestoreErrorOther = "other" -) - -// UnmarshalJSON deserializes into a RestoreError instance -func (u *RestoreError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // PathLookup : An error occurs when downloading metadata for the file. - PathLookup *LookupError `json:"path_lookup,omitempty"` - // PathWrite : An error occurs when trying to restore the file to that - // path. - PathWrite *WriteError `json:"path_write,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path_lookup": - u.PathLookup = w.PathLookup - - if err != nil { - return err - } - case "path_write": - u.PathWrite = w.PathWrite - - if err != nil { - return err - } - } - return nil -} - -// SaveCopyReferenceArg : has no documentation (yet) -type SaveCopyReferenceArg struct { - // CopyReference : A copy reference returned by `copyReferenceGet`. - CopyReference string `json:"copy_reference"` - // Path : Path in the user's Dropbox that is the destination. - Path string `json:"path"` -} - -// NewSaveCopyReferenceArg returns a new SaveCopyReferenceArg instance -func NewSaveCopyReferenceArg(CopyReference string, Path string) *SaveCopyReferenceArg { - s := new(SaveCopyReferenceArg) - s.CopyReference = CopyReference - s.Path = Path - return s -} - -// SaveCopyReferenceError : has no documentation (yet) -type SaveCopyReferenceError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` -} - -// Valid tag values for SaveCopyReferenceError -const ( - SaveCopyReferenceErrorPath = "path" - SaveCopyReferenceErrorInvalidCopyReference = "invalid_copy_reference" - SaveCopyReferenceErrorNoPermission = "no_permission" - SaveCopyReferenceErrorNotFound = "not_found" - SaveCopyReferenceErrorTooManyFiles = "too_many_files" - SaveCopyReferenceErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SaveCopyReferenceError instance -func (u *SaveCopyReferenceError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// SaveCopyReferenceResult : has no documentation (yet) -type SaveCopyReferenceResult struct { - // Metadata : The metadata of the saved file or folder in the user's - // Dropbox. - Metadata IsMetadata `json:"metadata"` -} - -// NewSaveCopyReferenceResult returns a new SaveCopyReferenceResult instance -func NewSaveCopyReferenceResult(Metadata IsMetadata) *SaveCopyReferenceResult { - s := new(SaveCopyReferenceResult) - s.Metadata = Metadata - return s -} - -// UnmarshalJSON deserializes into a SaveCopyReferenceResult instance -func (u *SaveCopyReferenceResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Metadata : The metadata of the saved file or folder in the user's - // Dropbox. - Metadata json.RawMessage `json:"metadata"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - return nil -} - -// SaveUrlArg : has no documentation (yet) -type SaveUrlArg struct { - // Path : The path in Dropbox where the URL will be saved to. - Path string `json:"path"` - // Url : The URL to be saved. - Url string `json:"url"` -} - -// NewSaveUrlArg returns a new SaveUrlArg instance -func NewSaveUrlArg(Path string, Url string) *SaveUrlArg { - s := new(SaveUrlArg) - s.Path = Path - s.Url = Url - return s -} - -// SaveUrlError : has no documentation (yet) -type SaveUrlError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` -} - -// Valid tag values for SaveUrlError -const ( - SaveUrlErrorPath = "path" - SaveUrlErrorDownloadFailed = "download_failed" - SaveUrlErrorInvalidUrl = "invalid_url" - SaveUrlErrorNotFound = "not_found" - SaveUrlErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SaveUrlError instance -func (u *SaveUrlError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *WriteError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// SaveUrlJobStatus : has no documentation (yet) -type SaveUrlJobStatus struct { - dropbox.Tagged - // Complete : Metadata of the file where the URL is saved to. - Complete *FileMetadata `json:"complete,omitempty"` - // Failed : has no documentation (yet) - Failed *SaveUrlError `json:"failed,omitempty"` -} - -// Valid tag values for SaveUrlJobStatus -const ( - SaveUrlJobStatusInProgress = "in_progress" - SaveUrlJobStatusComplete = "complete" - SaveUrlJobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a SaveUrlJobStatus instance -func (u *SaveUrlJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : has no documentation (yet) - Failed *SaveUrlError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// SaveUrlResult : has no documentation (yet) -type SaveUrlResult struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : Metadata of the file where the URL is saved to. - Complete *FileMetadata `json:"complete,omitempty"` -} - -// Valid tag values for SaveUrlResult -const ( - SaveUrlResultAsyncJobId = "async_job_id" - SaveUrlResultComplete = "complete" -) - -// UnmarshalJSON deserializes into a SaveUrlResult instance -func (u *SaveUrlResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// SearchArg : has no documentation (yet) -type SearchArg struct { - // Path : The path in the user's Dropbox to search. Should probably be a - // folder. - Path string `json:"path"` - // Query : The string to search for. The search string is split on spaces - // into multiple tokens. For file name searching, the last token is used for - // prefix matching (i.e. "bat c" matches "bat cave" but not "batman car"). - Query string `json:"query"` - // Start : The starting index within the search results (used for paging). - Start uint64 `json:"start"` - // MaxResults : The maximum number of search results to return. - MaxResults uint64 `json:"max_results"` - // Mode : The search mode (filename, filename_and_content, or - // deleted_filename). Note that searching file content is only available for - // Dropbox Business accounts. - Mode *SearchMode `json:"mode"` -} - -// NewSearchArg returns a new SearchArg instance -func NewSearchArg(Path string, Query string) *SearchArg { - s := new(SearchArg) - s.Path = Path - s.Query = Query - s.Start = 0 - s.MaxResults = 100 - s.Mode = &SearchMode{Tagged: dropbox.Tagged{"filename"}} - return s -} - -// SearchError : has no documentation (yet) -type SearchError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for SearchError -const ( - SearchErrorPath = "path" - SearchErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SearchError instance -func (u *SearchError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// SearchMatch : has no documentation (yet) -type SearchMatch struct { - // MatchType : The type of the match. - MatchType *SearchMatchType `json:"match_type"` - // Metadata : The metadata for the matched file or folder. - Metadata IsMetadata `json:"metadata"` -} - -// NewSearchMatch returns a new SearchMatch instance -func NewSearchMatch(MatchType *SearchMatchType, Metadata IsMetadata) *SearchMatch { - s := new(SearchMatch) - s.MatchType = MatchType - s.Metadata = Metadata - return s -} - -// UnmarshalJSON deserializes into a SearchMatch instance -func (u *SearchMatch) UnmarshalJSON(b []byte) error { - type wrap struct { - // MatchType : The type of the match. - MatchType *SearchMatchType `json:"match_type"` - // Metadata : The metadata for the matched file or folder. - Metadata json.RawMessage `json:"metadata"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - u.MatchType = w.MatchType - Metadata, err := IsMetadataFromJSON(w.Metadata) - if err != nil { - return err - } - u.Metadata = Metadata - return nil -} - -// SearchMatchType : Indicates what type of match was found for a given item. -type SearchMatchType struct { - dropbox.Tagged -} - -// Valid tag values for SearchMatchType -const ( - SearchMatchTypeFilename = "filename" - SearchMatchTypeContent = "content" - SearchMatchTypeBoth = "both" -) - -// SearchMode : has no documentation (yet) -type SearchMode struct { - dropbox.Tagged -} - -// Valid tag values for SearchMode -const ( - SearchModeFilename = "filename" - SearchModeFilenameAndContent = "filename_and_content" - SearchModeDeletedFilename = "deleted_filename" -) - -// SearchResult : has no documentation (yet) -type SearchResult struct { - // Matches : A list (possibly empty) of matches for the query. - Matches []*SearchMatch `json:"matches"` - // More : Used for paging. If true, indicates there is another page of - // results available that can be fetched by calling `search` again. - More bool `json:"more"` - // Start : Used for paging. Value to set the start argument to when calling - // `search` to fetch the next page of results. - Start uint64 `json:"start"` -} - -// NewSearchResult returns a new SearchResult instance -func NewSearchResult(Matches []*SearchMatch, More bool, Start uint64) *SearchResult { - s := new(SearchResult) - s.Matches = Matches - s.More = More - s.Start = Start - return s -} - -// SharedLink : has no documentation (yet) -type SharedLink struct { - // Url : Shared link url. - Url string `json:"url"` - // Password : Password for the shared link. - Password string `json:"password,omitempty"` -} - -// NewSharedLink returns a new SharedLink instance -func NewSharedLink(Url string) *SharedLink { - s := new(SharedLink) - s.Url = Url - return s -} - -// SymlinkInfo : has no documentation (yet) -type SymlinkInfo struct { - // Target : The target this symlink points to. - Target string `json:"target"` -} - -// NewSymlinkInfo returns a new SymlinkInfo instance -func NewSymlinkInfo(Target string) *SymlinkInfo { - s := new(SymlinkInfo) - s.Target = Target - return s -} - -// SyncSetting : has no documentation (yet) -type SyncSetting struct { - dropbox.Tagged -} - -// Valid tag values for SyncSetting -const ( - SyncSettingDefault = "default" - SyncSettingNotSynced = "not_synced" - SyncSettingNotSyncedInactive = "not_synced_inactive" - SyncSettingOther = "other" -) - -// SyncSettingArg : has no documentation (yet) -type SyncSettingArg struct { - dropbox.Tagged -} - -// Valid tag values for SyncSettingArg -const ( - SyncSettingArgDefault = "default" - SyncSettingArgNotSynced = "not_synced" - SyncSettingArgOther = "other" -) - -// SyncSettingsError : has no documentation (yet) -type SyncSettingsError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for SyncSettingsError -const ( - SyncSettingsErrorPath = "path" - SyncSettingsErrorUnsupportedCombination = "unsupported_combination" - SyncSettingsErrorUnsupportedConfiguration = "unsupported_configuration" - SyncSettingsErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SyncSettingsError instance -func (u *SyncSettingsError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ThumbnailArg : has no documentation (yet) -type ThumbnailArg struct { - // Path : The path to the image file you want to thumbnail. - Path string `json:"path"` - // Format : The format for the thumbnail image, jpeg (default) or png. For - // images that are photos, jpeg should be preferred, while png is better - // for screenshots and digital arts. - Format *ThumbnailFormat `json:"format"` - // Size : The size for the thumbnail image. - Size *ThumbnailSize `json:"size"` - // Mode : How to resize and crop the image to achieve the desired size. - Mode *ThumbnailMode `json:"mode"` -} - -// NewThumbnailArg returns a new ThumbnailArg instance -func NewThumbnailArg(Path string) *ThumbnailArg { - s := new(ThumbnailArg) - s.Path = Path - s.Format = &ThumbnailFormat{Tagged: dropbox.Tagged{"jpeg"}} - s.Size = &ThumbnailSize{Tagged: dropbox.Tagged{"w64h64"}} - s.Mode = &ThumbnailMode{Tagged: dropbox.Tagged{"strict"}} - return s -} - -// ThumbnailError : has no documentation (yet) -type ThumbnailError struct { - dropbox.Tagged - // Path : An error occurs when downloading metadata for the image. - Path *LookupError `json:"path,omitempty"` -} - -// Valid tag values for ThumbnailError -const ( - ThumbnailErrorPath = "path" - ThumbnailErrorUnsupportedExtension = "unsupported_extension" - ThumbnailErrorUnsupportedImage = "unsupported_image" - ThumbnailErrorConversionError = "conversion_error" -) - -// UnmarshalJSON deserializes into a ThumbnailError instance -func (u *ThumbnailError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : An error occurs when downloading metadata for the image. - Path *LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ThumbnailFormat : has no documentation (yet) -type ThumbnailFormat struct { - dropbox.Tagged -} - -// Valid tag values for ThumbnailFormat -const ( - ThumbnailFormatJpeg = "jpeg" - ThumbnailFormatPng = "png" -) - -// ThumbnailMode : has no documentation (yet) -type ThumbnailMode struct { - dropbox.Tagged -} - -// Valid tag values for ThumbnailMode -const ( - ThumbnailModeStrict = "strict" - ThumbnailModeBestfit = "bestfit" - ThumbnailModeFitoneBestfit = "fitone_bestfit" -) - -// ThumbnailSize : has no documentation (yet) -type ThumbnailSize struct { - dropbox.Tagged -} - -// Valid tag values for ThumbnailSize -const ( - ThumbnailSizeW32h32 = "w32h32" - ThumbnailSizeW64h64 = "w64h64" - ThumbnailSizeW128h128 = "w128h128" - ThumbnailSizeW256h256 = "w256h256" - ThumbnailSizeW480h320 = "w480h320" - ThumbnailSizeW640h480 = "w640h480" - ThumbnailSizeW960h640 = "w960h640" - ThumbnailSizeW1024h768 = "w1024h768" - ThumbnailSizeW2048h1536 = "w2048h1536" -) - -// UploadError : has no documentation (yet) -type UploadError struct { - dropbox.Tagged - // Path : Unable to save the uploaded contents to a file. - Path *UploadWriteFailed `json:"path,omitempty"` - // PropertiesError : The supplied property group is invalid. The file has - // uploaded without property groups. - PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"` -} - -// Valid tag values for UploadError -const ( - UploadErrorPath = "path" - UploadErrorPropertiesError = "properties_error" - UploadErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UploadError instance -func (u *UploadError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // PropertiesError : The supplied property group is invalid. The file - // has uploaded without property groups. - PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - err = json.Unmarshal(body, &u.Path) - - if err != nil { - return err - } - case "properties_error": - u.PropertiesError = w.PropertiesError - - if err != nil { - return err - } - } - return nil -} - -// UploadErrorWithProperties : has no documentation (yet) -type UploadErrorWithProperties struct { - dropbox.Tagged - // Path : Unable to save the uploaded contents to a file. - Path *UploadWriteFailed `json:"path,omitempty"` - // PropertiesError : The supplied property group is invalid. The file has - // uploaded without property groups. - PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"` -} - -// Valid tag values for UploadErrorWithProperties -const ( - UploadErrorWithPropertiesPath = "path" - UploadErrorWithPropertiesPropertiesError = "properties_error" - UploadErrorWithPropertiesOther = "other" -) - -// UnmarshalJSON deserializes into a UploadErrorWithProperties instance -func (u *UploadErrorWithProperties) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // PropertiesError : The supplied property group is invalid. The file - // has uploaded without property groups. - PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - err = json.Unmarshal(body, &u.Path) - - if err != nil { - return err - } - case "properties_error": - u.PropertiesError = w.PropertiesError - - if err != nil { - return err - } - } - return nil -} - -// UploadSessionAppendArg : has no documentation (yet) -type UploadSessionAppendArg struct { - // Cursor : Contains the upload session ID and the offset. - Cursor *UploadSessionCursor `json:"cursor"` - // Close : If true, the current session will be closed, at which point you - // won't be able to call `uploadSessionAppend` anymore with the current - // session. - Close bool `json:"close"` -} - -// NewUploadSessionAppendArg returns a new UploadSessionAppendArg instance -func NewUploadSessionAppendArg(Cursor *UploadSessionCursor) *UploadSessionAppendArg { - s := new(UploadSessionAppendArg) - s.Cursor = Cursor - s.Close = false - return s -} - -// UploadSessionCursor : has no documentation (yet) -type UploadSessionCursor struct { - // SessionId : The upload session ID (returned by `uploadSessionStart`). - SessionId string `json:"session_id"` - // Offset : The amount of data that has been uploaded so far. We use this to - // make sure upload data isn't lost or duplicated in the event of a network - // error. - Offset uint64 `json:"offset"` -} - -// NewUploadSessionCursor returns a new UploadSessionCursor instance -func NewUploadSessionCursor(SessionId string, Offset uint64) *UploadSessionCursor { - s := new(UploadSessionCursor) - s.SessionId = SessionId - s.Offset = Offset - return s -} - -// UploadSessionFinishArg : has no documentation (yet) -type UploadSessionFinishArg struct { - // Cursor : Contains the upload session ID and the offset. - Cursor *UploadSessionCursor `json:"cursor"` - // Commit : Contains the path and other optional modifiers for the commit. - Commit *CommitInfo `json:"commit"` -} - -// NewUploadSessionFinishArg returns a new UploadSessionFinishArg instance -func NewUploadSessionFinishArg(Cursor *UploadSessionCursor, Commit *CommitInfo) *UploadSessionFinishArg { - s := new(UploadSessionFinishArg) - s.Cursor = Cursor - s.Commit = Commit - return s -} - -// UploadSessionFinishBatchArg : has no documentation (yet) -type UploadSessionFinishBatchArg struct { - // Entries : Commit information for each file in the batch. - Entries []*UploadSessionFinishArg `json:"entries"` -} - -// NewUploadSessionFinishBatchArg returns a new UploadSessionFinishBatchArg instance -func NewUploadSessionFinishBatchArg(Entries []*UploadSessionFinishArg) *UploadSessionFinishBatchArg { - s := new(UploadSessionFinishBatchArg) - s.Entries = Entries - return s -} - -// UploadSessionFinishBatchJobStatus : has no documentation (yet) -type UploadSessionFinishBatchJobStatus struct { - dropbox.Tagged - // Complete : The `uploadSessionFinishBatch` has finished. - Complete *UploadSessionFinishBatchResult `json:"complete,omitempty"` -} - -// Valid tag values for UploadSessionFinishBatchJobStatus -const ( - UploadSessionFinishBatchJobStatusInProgress = "in_progress" - UploadSessionFinishBatchJobStatusComplete = "complete" -) - -// UnmarshalJSON deserializes into a UploadSessionFinishBatchJobStatus instance -func (u *UploadSessionFinishBatchJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// UploadSessionFinishBatchLaunch : Result returned by -// `uploadSessionFinishBatch` that may either launch an asynchronous job or -// complete synchronously. -type UploadSessionFinishBatchLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *UploadSessionFinishBatchResult `json:"complete,omitempty"` -} - -// Valid tag values for UploadSessionFinishBatchLaunch -const ( - UploadSessionFinishBatchLaunchAsyncJobId = "async_job_id" - UploadSessionFinishBatchLaunchComplete = "complete" - UploadSessionFinishBatchLaunchOther = "other" -) - -// UnmarshalJSON deserializes into a UploadSessionFinishBatchLaunch instance -func (u *UploadSessionFinishBatchLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// UploadSessionFinishBatchResult : has no documentation (yet) -type UploadSessionFinishBatchResult struct { - // Entries : Each entry in `UploadSessionFinishBatchArg.entries` will appear - // at the same position inside `UploadSessionFinishBatchResult.entries`. - Entries []*UploadSessionFinishBatchResultEntry `json:"entries"` -} - -// NewUploadSessionFinishBatchResult returns a new UploadSessionFinishBatchResult instance -func NewUploadSessionFinishBatchResult(Entries []*UploadSessionFinishBatchResultEntry) *UploadSessionFinishBatchResult { - s := new(UploadSessionFinishBatchResult) - s.Entries = Entries - return s -} - -// UploadSessionFinishBatchResultEntry : has no documentation (yet) -type UploadSessionFinishBatchResultEntry struct { - dropbox.Tagged - // Success : has no documentation (yet) - Success *FileMetadata `json:"success,omitempty"` - // Failure : has no documentation (yet) - Failure *UploadSessionFinishError `json:"failure,omitempty"` -} - -// Valid tag values for UploadSessionFinishBatchResultEntry -const ( - UploadSessionFinishBatchResultEntrySuccess = "success" - UploadSessionFinishBatchResultEntryFailure = "failure" -) - -// UnmarshalJSON deserializes into a UploadSessionFinishBatchResultEntry instance -func (u *UploadSessionFinishBatchResultEntry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failure : has no documentation (yet) - Failure *UploadSessionFinishError `json:"failure,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "failure": - u.Failure = w.Failure - - if err != nil { - return err - } - } - return nil -} - -// UploadSessionFinishError : has no documentation (yet) -type UploadSessionFinishError struct { - dropbox.Tagged - // LookupFailed : The session arguments are incorrect; the value explains - // the reason. - LookupFailed *UploadSessionLookupError `json:"lookup_failed,omitempty"` - // Path : Unable to save the uploaded contents to a file. Data has already - // been appended to the upload session. Please retry with empty data body - // and updated offset. - Path *WriteError `json:"path,omitempty"` - // PropertiesError : The supplied property group is invalid. The file has - // uploaded without property groups. - PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"` -} - -// Valid tag values for UploadSessionFinishError -const ( - UploadSessionFinishErrorLookupFailed = "lookup_failed" - UploadSessionFinishErrorPath = "path" - UploadSessionFinishErrorPropertiesError = "properties_error" - UploadSessionFinishErrorTooManySharedFolderTargets = "too_many_shared_folder_targets" - UploadSessionFinishErrorTooManyWriteOperations = "too_many_write_operations" - UploadSessionFinishErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UploadSessionFinishError instance -func (u *UploadSessionFinishError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // LookupFailed : The session arguments are incorrect; the value - // explains the reason. - LookupFailed *UploadSessionLookupError `json:"lookup_failed,omitempty"` - // Path : Unable to save the uploaded contents to a file. Data has - // already been appended to the upload session. Please retry with empty - // data body and updated offset. - Path *WriteError `json:"path,omitempty"` - // PropertiesError : The supplied property group is invalid. The file - // has uploaded without property groups. - PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "lookup_failed": - u.LookupFailed = w.LookupFailed - - if err != nil { - return err - } - case "path": - u.Path = w.Path - - if err != nil { - return err - } - case "properties_error": - u.PropertiesError = w.PropertiesError - - if err != nil { - return err - } - } - return nil -} - -// UploadSessionLookupError : has no documentation (yet) -type UploadSessionLookupError struct { - dropbox.Tagged - // IncorrectOffset : The specified offset was incorrect. See the value for - // the correct offset. This error may occur when a previous request was - // received and processed successfully but the client did not receive the - // response, e.g. due to a network error. - IncorrectOffset *UploadSessionOffsetError `json:"incorrect_offset,omitempty"` -} - -// Valid tag values for UploadSessionLookupError -const ( - UploadSessionLookupErrorNotFound = "not_found" - UploadSessionLookupErrorIncorrectOffset = "incorrect_offset" - UploadSessionLookupErrorClosed = "closed" - UploadSessionLookupErrorNotClosed = "not_closed" - UploadSessionLookupErrorTooLarge = "too_large" - UploadSessionLookupErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UploadSessionLookupError instance -func (u *UploadSessionLookupError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "incorrect_offset": - err = json.Unmarshal(body, &u.IncorrectOffset) - - if err != nil { - return err - } - } - return nil -} - -// UploadSessionOffsetError : has no documentation (yet) -type UploadSessionOffsetError struct { - // CorrectOffset : The offset up to which data has been collected. - CorrectOffset uint64 `json:"correct_offset"` -} - -// NewUploadSessionOffsetError returns a new UploadSessionOffsetError instance -func NewUploadSessionOffsetError(CorrectOffset uint64) *UploadSessionOffsetError { - s := new(UploadSessionOffsetError) - s.CorrectOffset = CorrectOffset - return s -} - -// UploadSessionStartArg : has no documentation (yet) -type UploadSessionStartArg struct { - // Close : If true, the current session will be closed, at which point you - // won't be able to call `uploadSessionAppend` anymore with the current - // session. - Close bool `json:"close"` -} - -// NewUploadSessionStartArg returns a new UploadSessionStartArg instance -func NewUploadSessionStartArg() *UploadSessionStartArg { - s := new(UploadSessionStartArg) - s.Close = false - return s -} - -// UploadSessionStartResult : has no documentation (yet) -type UploadSessionStartResult struct { - // SessionId : A unique identifier for the upload session. Pass this to - // `uploadSessionAppend` and `uploadSessionFinish`. - SessionId string `json:"session_id"` -} - -// NewUploadSessionStartResult returns a new UploadSessionStartResult instance -func NewUploadSessionStartResult(SessionId string) *UploadSessionStartResult { - s := new(UploadSessionStartResult) - s.SessionId = SessionId - return s -} - -// UploadWriteFailed : has no documentation (yet) -type UploadWriteFailed struct { - // Reason : The reason why the file couldn't be saved. - Reason *WriteError `json:"reason"` - // UploadSessionId : The upload session ID; data has already been uploaded - // to the corresponding upload session and this ID may be used to retry the - // commit with `uploadSessionFinish`. - UploadSessionId string `json:"upload_session_id"` -} - -// NewUploadWriteFailed returns a new UploadWriteFailed instance -func NewUploadWriteFailed(Reason *WriteError, UploadSessionId string) *UploadWriteFailed { - s := new(UploadWriteFailed) - s.Reason = Reason - s.UploadSessionId = UploadSessionId - return s -} - -// VideoMetadata : Metadata for a video. -type VideoMetadata struct { - MediaMetadata - // Duration : The duration of the video in milliseconds. - Duration uint64 `json:"duration,omitempty"` -} - -// NewVideoMetadata returns a new VideoMetadata instance -func NewVideoMetadata() *VideoMetadata { - s := new(VideoMetadata) - return s -} - -// WriteConflictError : has no documentation (yet) -type WriteConflictError struct { - dropbox.Tagged -} - -// Valid tag values for WriteConflictError -const ( - WriteConflictErrorFile = "file" - WriteConflictErrorFolder = "folder" - WriteConflictErrorFileAncestor = "file_ancestor" - WriteConflictErrorOther = "other" -) - -// WriteError : has no documentation (yet) -type WriteError struct { - dropbox.Tagged - // MalformedPath : The given path does not satisfy the required path format. - // Please refer to the `Path formats documentation` - // - // for more information. - MalformedPath string `json:"malformed_path,omitempty"` - // Conflict : Couldn't write to the target path because there was something - // in the way. - Conflict *WriteConflictError `json:"conflict,omitempty"` -} - -// Valid tag values for WriteError -const ( - WriteErrorMalformedPath = "malformed_path" - WriteErrorConflict = "conflict" - WriteErrorNoWritePermission = "no_write_permission" - WriteErrorInsufficientSpace = "insufficient_space" - WriteErrorDisallowedName = "disallowed_name" - WriteErrorTeamFolder = "team_folder" - WriteErrorTooManyWriteOperations = "too_many_write_operations" - WriteErrorOther = "other" -) - -// UnmarshalJSON deserializes into a WriteError instance -func (u *WriteError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // MalformedPath : The given path does not satisfy the required path - // format. Please refer to the `Path formats documentation` - // - // for more information. - MalformedPath string `json:"malformed_path,omitempty"` - // Conflict : Couldn't write to the target path because there was - // something in the way. - Conflict *WriteConflictError `json:"conflict,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "malformed_path": - u.MalformedPath = w.MalformedPath - - if err != nil { - return err - } - case "conflict": - u.Conflict = w.Conflict - - if err != nil { - return err - } - } - return nil -} - -// WriteMode : Your intent when writing a file to some path. This is used to -// determine what constitutes a conflict and what the autorename strategy is. In -// some situations, the conflict behavior is identical: (a) If the target path -// doesn't refer to anything, the file is always written; no conflict. (b) If -// the target path refers to a folder, it's always a conflict. (c) If the target -// path refers to a file with identical contents, nothing gets written; no -// conflict. The conflict checking differs in the case where there's a file at -// the target path with contents different from the contents you're trying to -// write. -type WriteMode struct { - dropbox.Tagged - // Update : Overwrite if the given "rev" matches the existing file's "rev". - // The autorename strategy is to append the string "conflicted copy" to the - // file name. For example, "document.txt" might become "document (conflicted - // copy).txt" or "document (Panda's conflicted copy).txt". - Update string `json:"update,omitempty"` -} - -// Valid tag values for WriteMode -const ( - WriteModeAdd = "add" - WriteModeOverwrite = "overwrite" - WriteModeUpdate = "update" -) - -// UnmarshalJSON deserializes into a WriteMode instance -func (u *WriteMode) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Update : Overwrite if the given "rev" matches the existing file's - // "rev". The autorename strategy is to append the string "conflicted - // copy" to the file name. For example, "document.txt" might become - // "document (conflicted copy).txt" or "document (Panda's conflicted - // copy).txt". - Update string `json:"update,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "update": - u.Update = w.Update - - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go deleted file mode 100644 index 46c49665b..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package dropbox - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "log" - "net/http" - - "golang.org/x/net/context" - "golang.org/x/oauth2" -) - -const ( - apiVersion = 2 - defaultDomain = ".dropboxapi.com" - hostAPI = "api" - hostContent = "content" - hostNotify = "notify" - sdkVersion = "5.6.0" - specVersion = "0e697d7" -) - -// Version returns the current SDK version and API Spec version -func Version() (string, string) { - return sdkVersion, specVersion -} - -// Config contains parameters for configuring the SDK. -type Config struct { - // OAuth2 access token - Token string - // Logging level for SDK generated logs - LogLevel LogLevel - // Logging target for verbose SDK logging - Logger *log.Logger - // Used with APIs that support operations as another user - AsMemberID string - // No need to set -- for testing only - Domain string - // No need to set -- for testing only - Client *http.Client - // No need to set -- for testing only - HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string - // No need to set -- for testing only - URLGenerator func(hostType string, style string, namespace string, route string) string -} - -// LogLevel defines a type that can set the desired level of logging the SDK will generate. -type LogLevel uint - -const ( - // LogOff will disable all SDK logging. This is the default log level - LogOff LogLevel = iota * (1 << 8) - // LogDebug will enable detailed SDK debug logs. It will log requests (including arguments), - // response and body contents. - LogDebug - // LogInfo will log SDK request (not including arguments) and responses. - LogInfo -) - -func (l LogLevel) shouldLog(v LogLevel) bool { - return l > v || l&v == v -} - -func (c *Config) doLog(l LogLevel, format string, v ...interface{}) { - if !c.LogLevel.shouldLog(l) { - return - } - - if c.Logger != nil { - c.Logger.Printf(format, v...) - } else { - log.Printf(format, v...) - } -} - -// LogDebug emits a debug level SDK log if config's log level is at least LogDebug -func (c *Config) LogDebug(format string, v ...interface{}) { - c.doLog(LogDebug, format, v...) -} - -// LogInfo emits an info level SDK log if config's log level is at least LogInfo -func (c *Config) LogInfo(format string, v ...interface{}) { - c.doLog(LogInfo, format, v...) -} - -// Context is the base client context used to implement per-namespace clients. -type Context struct { - Config Config - Client *http.Client - HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string - URLGenerator func(hostType string, style string, namespace string, route string) string -} - -// NewRequest returns an appropriate Request object for the given namespace/route. -func (c *Context) NewRequest( - hostType string, - style string, - authed bool, - namespace string, - route string, - headers map[string]string, - body io.Reader, -) (*http.Request, error) { - url := c.URLGenerator(hostType, style, namespace, route) - req, err := http.NewRequest("POST", url, body) - if err != nil { - return nil, err - } - for k, v := range headers { - req.Header.Add(k, v) - } - for k, v := range c.HeaderGenerator(hostType, style, namespace, route) { - req.Header.Add(k, v) - } - if req.Header.Get("Host") != "" { - req.Host = req.Header.Get("Host") - } - if !authed { - req.Header.Del("Authorization") - } - return req, nil -} - -// NewContext returns a new Context with the given Config. -func NewContext(c Config) Context { - domain := c.Domain - if domain == "" { - domain = defaultDomain - } - - client := c.Client - if client == nil { - var conf = &oauth2.Config{Endpoint: OAuthEndpoint(domain)} - tok := &oauth2.Token{AccessToken: c.Token} - client = conf.Client(context.Background(), tok) - } - - headerGenerator := c.HeaderGenerator - if headerGenerator == nil { - headerGenerator = func(hostType string, style string, namespace string, route string) map[string]string { - return map[string]string{} - } - } - - urlGenerator := c.URLGenerator - if urlGenerator == nil { - hostMap := map[string]string{ - hostAPI: hostAPI + domain, - hostContent: hostContent + domain, - hostNotify: hostNotify + domain, - } - urlGenerator = func(hostType string, style string, namespace string, route string) string { - fqHost := hostMap[hostType] - return fmt.Sprintf("https://%s/%d/%s/%s", fqHost, apiVersion, namespace, route) - } - } - - return Context{c, client, headerGenerator, urlGenerator} -} - -// OAuthEndpoint constructs an `oauth2.Endpoint` for the given domain -func OAuthEndpoint(domain string) oauth2.Endpoint { - if domain == "" { - domain = defaultDomain - } - authURL := fmt.Sprintf("https://meta%s/1/oauth2/authorize", domain) - tokenURL := fmt.Sprintf("https://api%s/1/oauth2/token", domain) - if domain == defaultDomain { - authURL = "https://www.dropbox.com/1/oauth2/authorize" - } - return oauth2.Endpoint{AuthURL: authURL, TokenURL: tokenURL} -} - -// Tagged is used for tagged unions. -type Tagged struct { - Tag string `json:".tag"` -} - -// APIError is the base type for endpoint-specific errors. -type APIError struct { - ErrorSummary string `json:"error_summary"` -} - -func (e APIError) Error() string { - return e.ErrorSummary -} - -// HandleCommonAPIErrors handles common API errors -func HandleCommonAPIErrors(c Config, resp *http.Response, body []byte) error { - var apiError APIError - if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError { - apiError.ErrorSummary = string(body) - return apiError - } - e := json.Unmarshal(body, &apiError) - if e != nil { - c.LogDebug("%v", e) - return e - } - return apiError -} - -// HTTPHeaderSafeJSON encode the JSON passed in b []byte passed in in -// a way that is suitable for HTTP headers. -// -// See: https://www.dropbox.com/developers/reference/json-encoding -func HTTPHeaderSafeJSON(b []byte) string { - var s bytes.Buffer - s.Grow(len(b)) - for _, r := range string(b) { - if r >= 0x007f { - fmt.Fprintf(&s, "\\u%04x", r) - } else { - s.WriteRune(r) - } - } - return s.String() -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state/types.go deleted file mode 100644 index be6120a33..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state/types.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package seen_state : has no documentation (yet) -package seen_state - -import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - -// PlatformType : Possible platforms on which a user may view content. -type PlatformType struct { - dropbox.Tagged -} - -// Valid tag values for PlatformType -const ( - PlatformTypeWeb = "web" - PlatformTypeDesktop = "desktop" - PlatformTypeMobileIos = "mobile_ios" - PlatformTypeMobileAndroid = "mobile_android" - PlatformTypeApi = "api" - PlatformTypeUnknown = "unknown" - PlatformTypeMobile = "mobile" - PlatformTypeOther = "other" -) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go deleted file mode 100644 index 41f6f284c..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go +++ /dev/null @@ -1,3075 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package sharing - -import ( - "bytes" - "encoding/json" - "io" - "io/ioutil" - "log" - "net/http" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth" -) - -// Client interface describes all routes in this namespace -type Client interface { - // AddFileMember : Adds specified members to a file. - AddFileMember(arg *AddFileMemberArgs) (res []*FileMemberActionResult, err error) - // AddFolderMember : Allows an owner or editor (if the ACL update policy - // allows) of a shared folder to add another member. For the new member to - // get access to all the functionality for this folder, you will need to - // call `mountFolder` on their behalf. - AddFolderMember(arg *AddFolderMemberArg) (err error) - // ChangeFileMemberAccess : Identical to update_file_member but with less - // information returned. - // Deprecated: Use `UpdateFileMember` instead - ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res *FileMemberActionResult, err error) - // CheckJobStatus : Returns the status of an asynchronous job. - CheckJobStatus(arg *async.PollArg) (res *JobStatus, err error) - // CheckRemoveMemberJobStatus : Returns the status of an asynchronous job - // for sharing a folder. - CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveMemberJobStatus, err error) - // CheckShareJobStatus : Returns the status of an asynchronous job for - // sharing a folder. - CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJobStatus, err error) - // CreateSharedLink : Create a shared link. If a shared link already exists - // for the given path, that link is returned. Note that in the returned - // `PathLinkMetadata`, the `PathLinkMetadata.url` field is the shortened URL - // if `CreateSharedLinkArg.short_url` argument is set to true. Previously, - // it was technically possible to break a shared link by moving or renaming - // the corresponding file or folder. In the future, this will no longer be - // the case, so your app shouldn't rely on this behavior. Instead, if your - // app needs to revoke a shared link, use `revokeSharedLink`. - // Deprecated: Use `CreateSharedLinkWithSettings` instead - CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMetadata, err error) - // CreateSharedLinkWithSettings : Create a shared link with custom settings. - // If no settings are given then the default visibility is - // `RequestedVisibility.public` (The resolved visibility, though, may depend - // on other aspects such as team and shared folder settings). - CreateSharedLinkWithSettings(arg *CreateSharedLinkWithSettingsArg) (res IsSharedLinkMetadata, err error) - // GetFileMetadata : Returns shared file metadata. - GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMetadata, err error) - // GetFileMetadataBatch : Returns shared file metadata. - GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*GetFileMetadataBatchResult, err error) - // GetFolderMetadata : Returns shared folder metadata by its folder ID. - GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMetadata, err error) - // GetSharedLinkFile : Download the shared link's file from a user's - // Dropbox. - GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, content io.ReadCloser, err error) - // GetSharedLinkMetadata : Get the shared link's metadata. - GetSharedLinkMetadata(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, err error) - // GetSharedLinks : Returns a list of `LinkMetadata` objects for this user, - // including collection links. If no path is given, returns a list of all - // shared links for the current user, including collection links, up to a - // maximum of 1000 links. If a non-empty path is given, returns a list of - // all shared links that allow access to the given path. Collection links - // are never returned in this case. Note that the url field in the response - // is never the shortened URL. - // Deprecated: Use `ListSharedLinks` instead - GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksResult, err error) - // ListFileMembers : Use to obtain the members who have been invited to a - // file, both inherited and uninherited members. - ListFileMembers(arg *ListFileMembersArg) (res *SharedFileMembers, err error) - // ListFileMembersBatch : Get members of multiple files at once. The - // arguments to this route are more limited, and the limit on query result - // size per file is more strict. To customize the results more, use the - // individual file endpoint. Inherited users and groups are not included in - // the result, and permissions are not returned for this endpoint. - ListFileMembersBatch(arg *ListFileMembersBatchArg) (res []*ListFileMembersBatchResult, err error) - // ListFileMembersContinue : Once a cursor has been retrieved from - // `listFileMembers` or `listFileMembersBatch`, use this to paginate through - // all shared file members. - ListFileMembersContinue(arg *ListFileMembersContinueArg) (res *SharedFileMembers, err error) - // ListFolderMembers : Returns shared folder membership by its folder ID. - ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFolderMembers, err error) - // ListFolderMembersContinue : Once a cursor has been retrieved from - // `listFolderMembers`, use this to paginate through all shared folder - // members. - ListFolderMembersContinue(arg *ListFolderMembersContinueArg) (res *SharedFolderMembers, err error) - // ListFolders : Return the list of all shared folders the current user has - // access to. - ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) - // ListFoldersContinue : Once a cursor has been retrieved from - // `listFolders`, use this to paginate through all shared folders. The - // cursor must come from a previous call to `listFolders` or - // `listFoldersContinue`. - ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) - // ListMountableFolders : Return the list of all shared folders the current - // user can mount or unmount. - ListMountableFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) - // ListMountableFoldersContinue : Once a cursor has been retrieved from - // `listMountableFolders`, use this to paginate through all mountable shared - // folders. The cursor must come from a previous call to - // `listMountableFolders` or `listMountableFoldersContinue`. - ListMountableFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) - // ListReceivedFiles : Returns a list of all files shared with current user. - // Does not include files the user has received via shared folders, and does - // not include unclaimed invitations. - ListReceivedFiles(arg *ListFilesArg) (res *ListFilesResult, err error) - // ListReceivedFilesContinue : Get more results with a cursor from - // `listReceivedFiles`. - ListReceivedFilesContinue(arg *ListFilesContinueArg) (res *ListFilesResult, err error) - // ListSharedLinks : List shared links of this user. If no path is given, - // returns a list of all shared links for the current user. If a non-empty - // path is given, returns a list of all shared links that allow access to - // the given path - direct links to the given path and links to parent - // folders of the given path. Links to parent folders can be suppressed by - // setting direct_only to true. - ListSharedLinks(arg *ListSharedLinksArg) (res *ListSharedLinksResult, err error) - // ModifySharedLinkSettings : Modify the shared link's settings. If the - // requested visibility conflict with the shared links policy of the team or - // the shared folder (in case the linked file is part of a shared folder) - // then the `LinkPermissions.resolved_visibility` of the returned - // `SharedLinkMetadata` will reflect the actual visibility of the shared - // link and the `LinkPermissions.requested_visibility` will reflect the - // requested visibility. - ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs) (res IsSharedLinkMetadata, err error) - // MountFolder : The current user mounts the designated folder. Mount a - // shared folder for a user after they have been added as a member. Once - // mounted, the shared folder will appear in their Dropbox. - MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata, err error) - // RelinquishFileMembership : The current user relinquishes their membership - // in the designated file. Note that the current user may still have - // inherited access to this file through the parent folder. - RelinquishFileMembership(arg *RelinquishFileMembershipArg) (err error) - // RelinquishFolderMembership : The current user relinquishes their - // membership in the designated shared folder and will no longer have access - // to the folder. A folder owner cannot relinquish membership in their own - // folder. This will run synchronously if leave_a_copy is false, and - // asynchronously if leave_a_copy is true. - RelinquishFolderMembership(arg *RelinquishFolderMembershipArg) (res *async.LaunchEmptyResult, err error) - // RemoveFileMember : Identical to remove_file_member_2 but with less - // information returned. - // Deprecated: Use `RemoveFileMember2` instead - RemoveFileMember(arg *RemoveFileMemberArg) (res *FileMemberActionIndividualResult, err error) - // RemoveFileMember2 : Removes a specified member from the file. - RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMemberRemoveActionResult, err error) - // RemoveFolderMember : Allows an owner or editor (if the ACL update policy - // allows) of a shared folder to remove another member. - RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.LaunchResultBase, err error) - // RevokeSharedLink : Revoke a shared link. Note that even after revoking a - // shared link to a file, the file may be accessible if there are shared - // links leading to any of the file parent folders. To list all shared links - // that enable access to a specific file, you can use the `listSharedLinks` - // with the file as the `ListSharedLinksArg.path` argument. - RevokeSharedLink(arg *RevokeSharedLinkArg) (err error) - // SetAccessInheritance : Change the inheritance policy of an existing - // Shared Folder. Only permitted for shared folders in a shared team root. - // If a `ShareFolderLaunch.async_job_id` is returned, you'll need to call - // `checkShareJobStatus` until the action completes to get the metadata for - // the folder. - SetAccessInheritance(arg *SetAccessInheritanceArg) (res *ShareFolderLaunch, err error) - // ShareFolder : Share a folder with collaborators. Most sharing will be - // completed synchronously. Large folders will be completed asynchronously. - // To make testing the async case repeatable, set - // `ShareFolderArg.force_async`. If a `ShareFolderLaunch.async_job_id` is - // returned, you'll need to call `checkShareJobStatus` until the action - // completes to get the metadata for the folder. - ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, err error) - // TransferFolder : Transfer ownership of a shared folder to a member of the - // shared folder. User must have `AccessLevel.owner` access to the shared - // folder to perform a transfer. - TransferFolder(arg *TransferFolderArg) (err error) - // UnmountFolder : The current user unmounts the designated folder. They can - // re-mount the folder at a later time using `mountFolder`. - UnmountFolder(arg *UnmountFolderArg) (err error) - // UnshareFile : Remove all members from this file. Does not remove - // inherited members. - UnshareFile(arg *UnshareFileArg) (err error) - // UnshareFolder : Allows a shared folder owner to unshare the folder. - // You'll need to call `checkJobStatus` to determine if the action has - // completed successfully. - UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmptyResult, err error) - // UpdateFileMember : Changes a member's access on a shared file. - UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAccessLevelResult, err error) - // UpdateFolderMember : Allows an owner or editor of a shared folder to - // update another member's permissions. - UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberAccessLevelResult, err error) - // UpdateFolderPolicy : Update the sharing policies for a shared folder. - // User must have `AccessLevel.owner` access to the shared folder to update - // its policies. - UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedFolderMetadata, err error) -} - -type apiImpl dropbox.Context - -//AddFileMemberAPIError is an error-wrapper for the add_file_member route -type AddFileMemberAPIError struct { - dropbox.APIError - EndpointError *AddFileMemberError `json:"error"` -} - -func (dbx *apiImpl) AddFileMember(arg *AddFileMemberArgs) (res []*FileMemberActionResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "add_file_member", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError AddFileMemberAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//AddFolderMemberAPIError is an error-wrapper for the add_folder_member route -type AddFolderMemberAPIError struct { - dropbox.APIError - EndpointError *AddFolderMemberError `json:"error"` -} - -func (dbx *apiImpl) AddFolderMember(arg *AddFolderMemberArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "add_folder_member", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError AddFolderMemberAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ChangeFileMemberAccessAPIError is an error-wrapper for the change_file_member_access route -type ChangeFileMemberAccessAPIError struct { - dropbox.APIError - EndpointError *FileMemberActionError `json:"error"` -} - -func (dbx *apiImpl) ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res *FileMemberActionResult, err error) { - log.Printf("WARNING: API `ChangeFileMemberAccess` is deprecated") - log.Printf("Use API `UpdateFileMember` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "change_file_member_access", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ChangeFileMemberAccessAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CheckJobStatusAPIError is an error-wrapper for the check_job_status route -type CheckJobStatusAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) CheckJobStatus(arg *async.PollArg) (res *JobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "check_job_status", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CheckJobStatusAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CheckRemoveMemberJobStatusAPIError is an error-wrapper for the check_remove_member_job_status route -type CheckRemoveMemberJobStatusAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveMemberJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "check_remove_member_job_status", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CheckRemoveMemberJobStatusAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CheckShareJobStatusAPIError is an error-wrapper for the check_share_job_status route -type CheckShareJobStatusAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "check_share_job_status", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CheckShareJobStatusAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CreateSharedLinkAPIError is an error-wrapper for the create_shared_link route -type CreateSharedLinkAPIError struct { - dropbox.APIError - EndpointError *CreateSharedLinkError `json:"error"` -} - -func (dbx *apiImpl) CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMetadata, err error) { - log.Printf("WARNING: API `CreateSharedLink` is deprecated") - log.Printf("Use API `CreateSharedLinkWithSettings` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "create_shared_link", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CreateSharedLinkAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//CreateSharedLinkWithSettingsAPIError is an error-wrapper for the create_shared_link_with_settings route -type CreateSharedLinkWithSettingsAPIError struct { - dropbox.APIError - EndpointError *CreateSharedLinkWithSettingsError `json:"error"` -} - -func (dbx *apiImpl) CreateSharedLinkWithSettings(arg *CreateSharedLinkWithSettingsArg) (res IsSharedLinkMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "create_shared_link_with_settings", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp sharedLinkMetadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError CreateSharedLinkWithSettingsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetFileMetadataAPIError is an error-wrapper for the get_file_metadata route -type GetFileMetadataAPIError struct { - dropbox.APIError - EndpointError *GetFileMetadataError `json:"error"` -} - -func (dbx *apiImpl) GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_file_metadata", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetFileMetadataAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetFileMetadataBatchAPIError is an error-wrapper for the get_file_metadata/batch route -type GetFileMetadataBatchAPIError struct { - dropbox.APIError - EndpointError *SharingUserError `json:"error"` -} - -func (dbx *apiImpl) GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*GetFileMetadataBatchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_file_metadata/batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetFileMetadataBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetFolderMetadataAPIError is an error-wrapper for the get_folder_metadata route -type GetFolderMetadataAPIError struct { - dropbox.APIError - EndpointError *SharedFolderAccessError `json:"error"` -} - -func (dbx *apiImpl) GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_folder_metadata", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetFolderMetadataAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetSharedLinkFileAPIError is an error-wrapper for the get_shared_link_file route -type GetSharedLinkFileAPIError struct { - dropbox.APIError - EndpointError *GetSharedLinkFileError `json:"error"` -} - -func (dbx *apiImpl) GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, content io.ReadCloser, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b), - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "sharing", "get_shared_link_file", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - body := []byte(resp.Header.Get("Dropbox-API-Result")) - content = resp.Body - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp sharedLinkMetadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - } - return - } - if resp.StatusCode == http.StatusConflict { - defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) - if err != nil { - return - } - var apiError GetSharedLinkFileAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetSharedLinkMetadataAPIError is an error-wrapper for the get_shared_link_metadata route -type GetSharedLinkMetadataAPIError struct { - dropbox.APIError - EndpointError *SharedLinkError `json:"error"` -} - -func (dbx *apiImpl) GetSharedLinkMetadata(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_shared_link_metadata", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp sharedLinkMetadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetSharedLinkMetadataAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetSharedLinksAPIError is an error-wrapper for the get_shared_links route -type GetSharedLinksAPIError struct { - dropbox.APIError - EndpointError *GetSharedLinksError `json:"error"` -} - -func (dbx *apiImpl) GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksResult, err error) { - log.Printf("WARNING: API `GetSharedLinks` is deprecated") - log.Printf("Use API `ListSharedLinks` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_shared_links", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetSharedLinksAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFileMembersAPIError is an error-wrapper for the list_file_members route -type ListFileMembersAPIError struct { - dropbox.APIError - EndpointError *ListFileMembersError `json:"error"` -} - -func (dbx *apiImpl) ListFileMembers(arg *ListFileMembersArg) (res *SharedFileMembers, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_file_members", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFileMembersAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFileMembersBatchAPIError is an error-wrapper for the list_file_members/batch route -type ListFileMembersBatchAPIError struct { - dropbox.APIError - EndpointError *SharingUserError `json:"error"` -} - -func (dbx *apiImpl) ListFileMembersBatch(arg *ListFileMembersBatchArg) (res []*ListFileMembersBatchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_file_members/batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFileMembersBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFileMembersContinueAPIError is an error-wrapper for the list_file_members/continue route -type ListFileMembersContinueAPIError struct { - dropbox.APIError - EndpointError *ListFileMembersContinueError `json:"error"` -} - -func (dbx *apiImpl) ListFileMembersContinue(arg *ListFileMembersContinueArg) (res *SharedFileMembers, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_file_members/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFileMembersContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFolderMembersAPIError is an error-wrapper for the list_folder_members route -type ListFolderMembersAPIError struct { - dropbox.APIError - EndpointError *SharedFolderAccessError `json:"error"` -} - -func (dbx *apiImpl) ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFolderMembers, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folder_members", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFolderMembersAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFolderMembersContinueAPIError is an error-wrapper for the list_folder_members/continue route -type ListFolderMembersContinueAPIError struct { - dropbox.APIError - EndpointError *ListFolderMembersContinueError `json:"error"` -} - -func (dbx *apiImpl) ListFolderMembersContinue(arg *ListFolderMembersContinueArg) (res *SharedFolderMembers, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folder_members/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFolderMembersContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFoldersAPIError is an error-wrapper for the list_folders route -type ListFoldersAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folders", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFoldersAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListFoldersContinueAPIError is an error-wrapper for the list_folders/continue route -type ListFoldersContinueAPIError struct { - dropbox.APIError - EndpointError *ListFoldersContinueError `json:"error"` -} - -func (dbx *apiImpl) ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folders/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListFoldersContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListMountableFoldersAPIError is an error-wrapper for the list_mountable_folders route -type ListMountableFoldersAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) ListMountableFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_mountable_folders", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListMountableFoldersAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListMountableFoldersContinueAPIError is an error-wrapper for the list_mountable_folders/continue route -type ListMountableFoldersContinueAPIError struct { - dropbox.APIError - EndpointError *ListFoldersContinueError `json:"error"` -} - -func (dbx *apiImpl) ListMountableFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_mountable_folders/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListMountableFoldersContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListReceivedFilesAPIError is an error-wrapper for the list_received_files route -type ListReceivedFilesAPIError struct { - dropbox.APIError - EndpointError *SharingUserError `json:"error"` -} - -func (dbx *apiImpl) ListReceivedFiles(arg *ListFilesArg) (res *ListFilesResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_received_files", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListReceivedFilesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListReceivedFilesContinueAPIError is an error-wrapper for the list_received_files/continue route -type ListReceivedFilesContinueAPIError struct { - dropbox.APIError - EndpointError *ListFilesContinueError `json:"error"` -} - -func (dbx *apiImpl) ListReceivedFilesContinue(arg *ListFilesContinueArg) (res *ListFilesResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_received_files/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListReceivedFilesContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ListSharedLinksAPIError is an error-wrapper for the list_shared_links route -type ListSharedLinksAPIError struct { - dropbox.APIError - EndpointError *ListSharedLinksError `json:"error"` -} - -func (dbx *apiImpl) ListSharedLinks(arg *ListSharedLinksArg) (res *ListSharedLinksResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_shared_links", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ListSharedLinksAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ModifySharedLinkSettingsAPIError is an error-wrapper for the modify_shared_link_settings route -type ModifySharedLinkSettingsAPIError struct { - dropbox.APIError - EndpointError *ModifySharedLinkSettingsError `json:"error"` -} - -func (dbx *apiImpl) ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs) (res IsSharedLinkMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "modify_shared_link_settings", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - var tmp sharedLinkMetadataUnion - err = json.Unmarshal(body, &tmp) - if err != nil { - return - } - switch tmp.Tag { - case "file": - res = tmp.File - - case "folder": - res = tmp.Folder - - } - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ModifySharedLinkSettingsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MountFolderAPIError is an error-wrapper for the mount_folder route -type MountFolderAPIError struct { - dropbox.APIError - EndpointError *MountFolderError `json:"error"` -} - -func (dbx *apiImpl) MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "mount_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MountFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RelinquishFileMembershipAPIError is an error-wrapper for the relinquish_file_membership route -type RelinquishFileMembershipAPIError struct { - dropbox.APIError - EndpointError *RelinquishFileMembershipError `json:"error"` -} - -func (dbx *apiImpl) RelinquishFileMembership(arg *RelinquishFileMembershipArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "relinquish_file_membership", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RelinquishFileMembershipAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RelinquishFolderMembershipAPIError is an error-wrapper for the relinquish_folder_membership route -type RelinquishFolderMembershipAPIError struct { - dropbox.APIError - EndpointError *RelinquishFolderMembershipError `json:"error"` -} - -func (dbx *apiImpl) RelinquishFolderMembership(arg *RelinquishFolderMembershipArg) (res *async.LaunchEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "relinquish_folder_membership", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RelinquishFolderMembershipAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RemoveFileMemberAPIError is an error-wrapper for the remove_file_member route -type RemoveFileMemberAPIError struct { - dropbox.APIError - EndpointError *RemoveFileMemberError `json:"error"` -} - -func (dbx *apiImpl) RemoveFileMember(arg *RemoveFileMemberArg) (res *FileMemberActionIndividualResult, err error) { - log.Printf("WARNING: API `RemoveFileMember` is deprecated") - log.Printf("Use API `RemoveFileMember2` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "remove_file_member", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RemoveFileMemberAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RemoveFileMember2APIError is an error-wrapper for the remove_file_member_2 route -type RemoveFileMember2APIError struct { - dropbox.APIError - EndpointError *RemoveFileMemberError `json:"error"` -} - -func (dbx *apiImpl) RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMemberRemoveActionResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "remove_file_member_2", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RemoveFileMember2APIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RemoveFolderMemberAPIError is an error-wrapper for the remove_folder_member route -type RemoveFolderMemberAPIError struct { - dropbox.APIError - EndpointError *RemoveFolderMemberError `json:"error"` -} - -func (dbx *apiImpl) RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.LaunchResultBase, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "remove_folder_member", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RemoveFolderMemberAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//RevokeSharedLinkAPIError is an error-wrapper for the revoke_shared_link route -type RevokeSharedLinkAPIError struct { - dropbox.APIError - EndpointError *RevokeSharedLinkError `json:"error"` -} - -func (dbx *apiImpl) RevokeSharedLink(arg *RevokeSharedLinkArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "revoke_shared_link", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError RevokeSharedLinkAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//SetAccessInheritanceAPIError is an error-wrapper for the set_access_inheritance route -type SetAccessInheritanceAPIError struct { - dropbox.APIError - EndpointError *SetAccessInheritanceError `json:"error"` -} - -func (dbx *apiImpl) SetAccessInheritance(arg *SetAccessInheritanceArg) (res *ShareFolderLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "set_access_inheritance", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError SetAccessInheritanceAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ShareFolderAPIError is an error-wrapper for the share_folder route -type ShareFolderAPIError struct { - dropbox.APIError - EndpointError *ShareFolderError `json:"error"` -} - -func (dbx *apiImpl) ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "share_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ShareFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TransferFolderAPIError is an error-wrapper for the transfer_folder route -type TransferFolderAPIError struct { - dropbox.APIError - EndpointError *TransferFolderError `json:"error"` -} - -func (dbx *apiImpl) TransferFolder(arg *TransferFolderArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "transfer_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TransferFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UnmountFolderAPIError is an error-wrapper for the unmount_folder route -type UnmountFolderAPIError struct { - dropbox.APIError - EndpointError *UnmountFolderError `json:"error"` -} - -func (dbx *apiImpl) UnmountFolder(arg *UnmountFolderArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "unmount_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UnmountFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UnshareFileAPIError is an error-wrapper for the unshare_file route -type UnshareFileAPIError struct { - dropbox.APIError - EndpointError *UnshareFileError `json:"error"` -} - -func (dbx *apiImpl) UnshareFile(arg *UnshareFileArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "unshare_file", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UnshareFileAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UnshareFolderAPIError is an error-wrapper for the unshare_folder route -type UnshareFolderAPIError struct { - dropbox.APIError - EndpointError *UnshareFolderError `json:"error"` -} - -func (dbx *apiImpl) UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "unshare_folder", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UnshareFolderAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UpdateFileMemberAPIError is an error-wrapper for the update_file_member route -type UpdateFileMemberAPIError struct { - dropbox.APIError - EndpointError *FileMemberActionError `json:"error"` -} - -func (dbx *apiImpl) UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAccessLevelResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "update_file_member", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UpdateFileMemberAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UpdateFolderMemberAPIError is an error-wrapper for the update_folder_member route -type UpdateFolderMemberAPIError struct { - dropbox.APIError - EndpointError *UpdateFolderMemberError `json:"error"` -} - -func (dbx *apiImpl) UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberAccessLevelResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "update_folder_member", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UpdateFolderMemberAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//UpdateFolderPolicyAPIError is an error-wrapper for the update_folder_policy route -type UpdateFolderPolicyAPIError struct { - dropbox.APIError - EndpointError *UpdateFolderPolicyError `json:"error"` -} - -func (dbx *apiImpl) UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "update_folder_policy", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError UpdateFolderPolicyAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -// New returns a Client implementation for this namespace -func New(c dropbox.Config) Client { - ctx := apiImpl(dropbox.NewContext(c)) - return &ctx -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go deleted file mode 100644 index 4e84fb522..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go +++ /dev/null @@ -1,4490 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package sharing : This namespace contains endpoints and data types for -// creating and managing shared links and shared folders. -package sharing - -import ( - "encoding/json" - "time" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users" -) - -// AccessInheritance : Information about the inheritance policy of a shared -// folder. -type AccessInheritance struct { - dropbox.Tagged -} - -// Valid tag values for AccessInheritance -const ( - AccessInheritanceInherit = "inherit" - AccessInheritanceNoInherit = "no_inherit" - AccessInheritanceOther = "other" -) - -// AccessLevel : Defines the access levels for collaborators. -type AccessLevel struct { - dropbox.Tagged -} - -// Valid tag values for AccessLevel -const ( - AccessLevelOwner = "owner" - AccessLevelEditor = "editor" - AccessLevelViewer = "viewer" - AccessLevelViewerNoComment = "viewer_no_comment" - AccessLevelOther = "other" -) - -// AclUpdatePolicy : Who can change a shared folder's access control list (ACL). -// In other words, who can add, remove, or change the privileges of members. -type AclUpdatePolicy struct { - dropbox.Tagged -} - -// Valid tag values for AclUpdatePolicy -const ( - AclUpdatePolicyOwner = "owner" - AclUpdatePolicyEditors = "editors" - AclUpdatePolicyOther = "other" -) - -// AddFileMemberArgs : Arguments for `addFileMember`. -type AddFileMemberArgs struct { - // File : File to which to add members. - File string `json:"file"` - // Members : Members to add. Note that even an email address is given, this - // may result in a user being directy added to the membership if that email - // is the user's main account email. - Members []*MemberSelector `json:"members"` - // CustomMessage : Message to send to added members in their invitation. - CustomMessage string `json:"custom_message,omitempty"` - // Quiet : Whether added members should be notified via device notifications - // of their invitation. - Quiet bool `json:"quiet"` - // AccessLevel : AccessLevel union object, describing what access level we - // want to give new members. - AccessLevel *AccessLevel `json:"access_level"` - // AddMessageAsComment : If the custom message should be added as a comment - // on the file. - AddMessageAsComment bool `json:"add_message_as_comment"` -} - -// NewAddFileMemberArgs returns a new AddFileMemberArgs instance -func NewAddFileMemberArgs(File string, Members []*MemberSelector) *AddFileMemberArgs { - s := new(AddFileMemberArgs) - s.File = File - s.Members = Members - s.Quiet = false - s.AccessLevel = &AccessLevel{Tagged: dropbox.Tagged{"viewer"}} - s.AddMessageAsComment = false - return s -} - -// AddFileMemberError : Errors for `addFileMember`. -type AddFileMemberError struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for AddFileMemberError -const ( - AddFileMemberErrorUserError = "user_error" - AddFileMemberErrorAccessError = "access_error" - AddFileMemberErrorRateLimit = "rate_limit" - AddFileMemberErrorInvalidComment = "invalid_comment" - AddFileMemberErrorOther = "other" -) - -// UnmarshalJSON deserializes into a AddFileMemberError instance -func (u *AddFileMemberError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// AddFolderMemberArg : has no documentation (yet) -type AddFolderMemberArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // Members : The intended list of members to add. Added members will - // receive invites to join the shared folder. - Members []*AddMember `json:"members"` - // Quiet : Whether added members should be notified via email and device - // notifications of their invite. - Quiet bool `json:"quiet"` - // CustomMessage : Optional message to display to added members in their - // invitation. - CustomMessage string `json:"custom_message,omitempty"` -} - -// NewAddFolderMemberArg returns a new AddFolderMemberArg instance -func NewAddFolderMemberArg(SharedFolderId string, Members []*AddMember) *AddFolderMemberArg { - s := new(AddFolderMemberArg) - s.SharedFolderId = SharedFolderId - s.Members = Members - s.Quiet = false - return s -} - -// AddFolderMemberError : has no documentation (yet) -type AddFolderMemberError struct { - dropbox.Tagged - // AccessError : Unable to access shared folder. - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // BadMember : `AddFolderMemberArg.members` contains a bad invitation - // recipient. - BadMember *AddMemberSelectorError `json:"bad_member,omitempty"` - // TooManyMembers : The value is the member limit that was reached. - TooManyMembers uint64 `json:"too_many_members,omitempty"` - // TooManyPendingInvites : The value is the pending invite limit that was - // reached. - TooManyPendingInvites uint64 `json:"too_many_pending_invites,omitempty"` -} - -// Valid tag values for AddFolderMemberError -const ( - AddFolderMemberErrorAccessError = "access_error" - AddFolderMemberErrorEmailUnverified = "email_unverified" - AddFolderMemberErrorBannedMember = "banned_member" - AddFolderMemberErrorBadMember = "bad_member" - AddFolderMemberErrorCantShareOutsideTeam = "cant_share_outside_team" - AddFolderMemberErrorTooManyMembers = "too_many_members" - AddFolderMemberErrorTooManyPendingInvites = "too_many_pending_invites" - AddFolderMemberErrorRateLimit = "rate_limit" - AddFolderMemberErrorTooManyInvitees = "too_many_invitees" - AddFolderMemberErrorInsufficientPlan = "insufficient_plan" - AddFolderMemberErrorTeamFolder = "team_folder" - AddFolderMemberErrorNoPermission = "no_permission" - AddFolderMemberErrorOther = "other" -) - -// UnmarshalJSON deserializes into a AddFolderMemberError instance -func (u *AddFolderMemberError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : Unable to access shared folder. - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // BadMember : `AddFolderMemberArg.members` contains a bad invitation - // recipient. - BadMember *AddMemberSelectorError `json:"bad_member,omitempty"` - // TooManyMembers : The value is the member limit that was reached. - TooManyMembers uint64 `json:"too_many_members,omitempty"` - // TooManyPendingInvites : The value is the pending invite limit that - // was reached. - TooManyPendingInvites uint64 `json:"too_many_pending_invites,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "bad_member": - u.BadMember = w.BadMember - - if err != nil { - return err - } - case "too_many_members": - u.TooManyMembers = w.TooManyMembers - - if err != nil { - return err - } - case "too_many_pending_invites": - u.TooManyPendingInvites = w.TooManyPendingInvites - - if err != nil { - return err - } - } - return nil -} - -// AddMember : The member and type of access the member should have when added -// to a shared folder. -type AddMember struct { - // Member : The member to add to the shared folder. - Member *MemberSelector `json:"member"` - // AccessLevel : The access level to grant `member` to the shared folder. - // `AccessLevel.owner` is disallowed. - AccessLevel *AccessLevel `json:"access_level"` -} - -// NewAddMember returns a new AddMember instance -func NewAddMember(Member *MemberSelector) *AddMember { - s := new(AddMember) - s.Member = Member - s.AccessLevel = &AccessLevel{Tagged: dropbox.Tagged{"viewer"}} - return s -} - -// AddMemberSelectorError : has no documentation (yet) -type AddMemberSelectorError struct { - dropbox.Tagged - // InvalidDropboxId : The value is the ID that could not be identified. - InvalidDropboxId string `json:"invalid_dropbox_id,omitempty"` - // InvalidEmail : The value is the e-email address that is malformed. - InvalidEmail string `json:"invalid_email,omitempty"` - // UnverifiedDropboxId : The value is the ID of the Dropbox user with an - // unverified e-mail address. Invite unverified users by e-mail address - // instead of by their Dropbox ID. - UnverifiedDropboxId string `json:"unverified_dropbox_id,omitempty"` -} - -// Valid tag values for AddMemberSelectorError -const ( - AddMemberSelectorErrorAutomaticGroup = "automatic_group" - AddMemberSelectorErrorInvalidDropboxId = "invalid_dropbox_id" - AddMemberSelectorErrorInvalidEmail = "invalid_email" - AddMemberSelectorErrorUnverifiedDropboxId = "unverified_dropbox_id" - AddMemberSelectorErrorGroupDeleted = "group_deleted" - AddMemberSelectorErrorGroupNotOnTeam = "group_not_on_team" - AddMemberSelectorErrorOther = "other" -) - -// UnmarshalJSON deserializes into a AddMemberSelectorError instance -func (u *AddMemberSelectorError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // InvalidDropboxId : The value is the ID that could not be identified. - InvalidDropboxId string `json:"invalid_dropbox_id,omitempty"` - // InvalidEmail : The value is the e-email address that is malformed. - InvalidEmail string `json:"invalid_email,omitempty"` - // UnverifiedDropboxId : The value is the ID of the Dropbox user with an - // unverified e-mail address. Invite unverified users by e-mail address - // instead of by their Dropbox ID. - UnverifiedDropboxId string `json:"unverified_dropbox_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "invalid_dropbox_id": - u.InvalidDropboxId = w.InvalidDropboxId - - if err != nil { - return err - } - case "invalid_email": - u.InvalidEmail = w.InvalidEmail - - if err != nil { - return err - } - case "unverified_dropbox_id": - u.UnverifiedDropboxId = w.UnverifiedDropboxId - - if err != nil { - return err - } - } - return nil -} - -// AudienceExceptionContentInfo : Information about the content that has a link -// audience different than that of this folder. -type AudienceExceptionContentInfo struct { - // Name : The name of the content, which is either a file or a folder. - Name string `json:"name"` -} - -// NewAudienceExceptionContentInfo returns a new AudienceExceptionContentInfo instance -func NewAudienceExceptionContentInfo(Name string) *AudienceExceptionContentInfo { - s := new(AudienceExceptionContentInfo) - s.Name = Name - return s -} - -// AudienceExceptions : The total count and truncated list of information of -// content inside this folder that has a different audience than the link on -// this folder. This is only returned for folders. -type AudienceExceptions struct { - // Count : has no documentation (yet) - Count uint32 `json:"count"` - // Exceptions : A truncated list of some of the content that is an - // exception. The length of this list could be smaller than the count since - // it is only a sample but will not be empty as long as count is not 0. - Exceptions []*AudienceExceptionContentInfo `json:"exceptions"` -} - -// NewAudienceExceptions returns a new AudienceExceptions instance -func NewAudienceExceptions(Count uint32, Exceptions []*AudienceExceptionContentInfo) *AudienceExceptions { - s := new(AudienceExceptions) - s.Count = Count - s.Exceptions = Exceptions - return s -} - -// AudienceRestrictingSharedFolder : Information about the shared folder that -// prevents the link audience for this link from being more restrictive. -type AudienceRestrictingSharedFolder struct { - // SharedFolderId : The ID of the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // Name : The name of the shared folder. - Name string `json:"name"` - // Audience : The link audience of the shared folder. - Audience *LinkAudience `json:"audience"` -} - -// NewAudienceRestrictingSharedFolder returns a new AudienceRestrictingSharedFolder instance -func NewAudienceRestrictingSharedFolder(SharedFolderId string, Name string, Audience *LinkAudience) *AudienceRestrictingSharedFolder { - s := new(AudienceRestrictingSharedFolder) - s.SharedFolderId = SharedFolderId - s.Name = Name - s.Audience = Audience - return s -} - -// ChangeFileMemberAccessArgs : Arguments for `changeFileMemberAccess`. -type ChangeFileMemberAccessArgs struct { - // File : File for which we are changing a member's access. - File string `json:"file"` - // Member : The member whose access we are changing. - Member *MemberSelector `json:"member"` - // AccessLevel : The new access level for the member. - AccessLevel *AccessLevel `json:"access_level"` -} - -// NewChangeFileMemberAccessArgs returns a new ChangeFileMemberAccessArgs instance -func NewChangeFileMemberAccessArgs(File string, Member *MemberSelector, AccessLevel *AccessLevel) *ChangeFileMemberAccessArgs { - s := new(ChangeFileMemberAccessArgs) - s.File = File - s.Member = Member - s.AccessLevel = AccessLevel - return s -} - -// LinkMetadata : Metadata for a shared link. This can be either a -// `PathLinkMetadata` or `CollectionLinkMetadata`. -type LinkMetadata struct { - // Url : URL of the shared link. - Url string `json:"url"` - // Visibility : Who can access the link. - Visibility *Visibility `json:"visibility"` - // Expires : Expiration time, if set. By default the link won't expire. - Expires time.Time `json:"expires,omitempty"` -} - -// NewLinkMetadata returns a new LinkMetadata instance -func NewLinkMetadata(Url string, Visibility *Visibility) *LinkMetadata { - s := new(LinkMetadata) - s.Url = Url - s.Visibility = Visibility - return s -} - -// IsLinkMetadata is the interface type for LinkMetadata and its subtypes -type IsLinkMetadata interface { - IsLinkMetadata() -} - -// IsLinkMetadata implements the IsLinkMetadata interface -func (u *LinkMetadata) IsLinkMetadata() {} - -type linkMetadataUnion struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *PathLinkMetadata `json:"path,omitempty"` - // Collection : has no documentation (yet) - Collection *CollectionLinkMetadata `json:"collection,omitempty"` -} - -// Valid tag values for LinkMetadata -const ( - LinkMetadataPath = "path" - LinkMetadataCollection = "collection" -) - -// UnmarshalJSON deserializes into a linkMetadataUnion instance -func (u *linkMetadataUnion) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - err = json.Unmarshal(body, &u.Path) - - if err != nil { - return err - } - case "collection": - err = json.Unmarshal(body, &u.Collection) - - if err != nil { - return err - } - } - return nil -} - -// IsLinkMetadataFromJSON converts JSON to a concrete IsLinkMetadata instance -func IsLinkMetadataFromJSON(data []byte) (IsLinkMetadata, error) { - var t linkMetadataUnion - if err := json.Unmarshal(data, &t); err != nil { - return nil, err - } - switch t.Tag { - case "path": - return t.Path, nil - - case "collection": - return t.Collection, nil - - } - return nil, nil -} - -// CollectionLinkMetadata : Metadata for a collection-based shared link. -type CollectionLinkMetadata struct { - LinkMetadata -} - -// NewCollectionLinkMetadata returns a new CollectionLinkMetadata instance -func NewCollectionLinkMetadata(Url string, Visibility *Visibility) *CollectionLinkMetadata { - s := new(CollectionLinkMetadata) - s.Url = Url - s.Visibility = Visibility - return s -} - -// CreateSharedLinkArg : has no documentation (yet) -type CreateSharedLinkArg struct { - // Path : The path to share. - Path string `json:"path"` - // ShortUrl : Whether to return a shortened URL. - ShortUrl bool `json:"short_url"` - // PendingUpload : If it's okay to share a path that does not yet exist, set - // this to either `PendingUploadMode.file` or `PendingUploadMode.folder` to - // indicate whether to assume it's a file or folder. - PendingUpload *PendingUploadMode `json:"pending_upload,omitempty"` -} - -// NewCreateSharedLinkArg returns a new CreateSharedLinkArg instance -func NewCreateSharedLinkArg(Path string) *CreateSharedLinkArg { - s := new(CreateSharedLinkArg) - s.Path = Path - s.ShortUrl = false - return s -} - -// CreateSharedLinkError : has no documentation (yet) -type CreateSharedLinkError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *files.LookupError `json:"path,omitempty"` -} - -// Valid tag values for CreateSharedLinkError -const ( - CreateSharedLinkErrorPath = "path" - CreateSharedLinkErrorOther = "other" -) - -// UnmarshalJSON deserializes into a CreateSharedLinkError instance -func (u *CreateSharedLinkError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *files.LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// CreateSharedLinkWithSettingsArg : has no documentation (yet) -type CreateSharedLinkWithSettingsArg struct { - // Path : The path to be shared by the shared link. - Path string `json:"path"` - // Settings : The requested settings for the newly created shared link. - Settings *SharedLinkSettings `json:"settings,omitempty"` -} - -// NewCreateSharedLinkWithSettingsArg returns a new CreateSharedLinkWithSettingsArg instance -func NewCreateSharedLinkWithSettingsArg(Path string) *CreateSharedLinkWithSettingsArg { - s := new(CreateSharedLinkWithSettingsArg) - s.Path = Path - return s -} - -// CreateSharedLinkWithSettingsError : has no documentation (yet) -type CreateSharedLinkWithSettingsError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *files.LookupError `json:"path,omitempty"` - // SharedLinkAlreadyExists : The shared link already exists. You can call - // `listSharedLinks` to get the existing link, or use the provided metadata - // if it is returned. - SharedLinkAlreadyExists *SharedLinkAlreadyExistsMetadata `json:"shared_link_already_exists,omitempty"` - // SettingsError : There is an error with the given settings. - SettingsError *SharedLinkSettingsError `json:"settings_error,omitempty"` -} - -// Valid tag values for CreateSharedLinkWithSettingsError -const ( - CreateSharedLinkWithSettingsErrorPath = "path" - CreateSharedLinkWithSettingsErrorEmailNotVerified = "email_not_verified" - CreateSharedLinkWithSettingsErrorSharedLinkAlreadyExists = "shared_link_already_exists" - CreateSharedLinkWithSettingsErrorSettingsError = "settings_error" - CreateSharedLinkWithSettingsErrorAccessDenied = "access_denied" -) - -// UnmarshalJSON deserializes into a CreateSharedLinkWithSettingsError instance -func (u *CreateSharedLinkWithSettingsError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *files.LookupError `json:"path,omitempty"` - // SharedLinkAlreadyExists : The shared link already exists. You can - // call `listSharedLinks` to get the existing link, or use the provided - // metadata if it is returned. - SharedLinkAlreadyExists *SharedLinkAlreadyExistsMetadata `json:"shared_link_already_exists,omitempty"` - // SettingsError : There is an error with the given settings. - SettingsError *SharedLinkSettingsError `json:"settings_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - case "shared_link_already_exists": - u.SharedLinkAlreadyExists = w.SharedLinkAlreadyExists - - if err != nil { - return err - } - case "settings_error": - u.SettingsError = w.SettingsError - - if err != nil { - return err - } - } - return nil -} - -// SharedContentLinkMetadataBase : has no documentation (yet) -type SharedContentLinkMetadataBase struct { - // AccessLevel : The access level on the link for this file. - AccessLevel *AccessLevel `json:"access_level,omitempty"` - // AudienceOptions : The audience options that are available for the - // content. Some audience options may be unavailable. For example, team_only - // may be unavailable if the content is not owned by a user on a team. The - // 'default' audience option is always available if the user can modify link - // settings. - AudienceOptions []*LinkAudience `json:"audience_options"` - // AudienceRestrictingSharedFolder : The shared folder that prevents the - // link audience for this link from being more restrictive. - AudienceRestrictingSharedFolder *AudienceRestrictingSharedFolder `json:"audience_restricting_shared_folder,omitempty"` - // CurrentAudience : The current audience of the link. - CurrentAudience *LinkAudience `json:"current_audience"` - // Expiry : Whether the link has an expiry set on it. A link with an expiry - // will have its audience changed to members when the expiry is reached. - Expiry time.Time `json:"expiry,omitempty"` - // LinkPermissions : A list of permissions for actions you can perform on - // the link. - LinkPermissions []*LinkPermission `json:"link_permissions"` - // PasswordProtected : Whether the link is protected by a password. - PasswordProtected bool `json:"password_protected"` -} - -// NewSharedContentLinkMetadataBase returns a new SharedContentLinkMetadataBase instance -func NewSharedContentLinkMetadataBase(AudienceOptions []*LinkAudience, CurrentAudience *LinkAudience, LinkPermissions []*LinkPermission, PasswordProtected bool) *SharedContentLinkMetadataBase { - s := new(SharedContentLinkMetadataBase) - s.AudienceOptions = AudienceOptions - s.CurrentAudience = CurrentAudience - s.LinkPermissions = LinkPermissions - s.PasswordProtected = PasswordProtected - return s -} - -// ExpectedSharedContentLinkMetadata : The expected metadata of a shared link -// for a file or folder when a link is first created for the content. Absent if -// the link already exists. -type ExpectedSharedContentLinkMetadata struct { - SharedContentLinkMetadataBase -} - -// NewExpectedSharedContentLinkMetadata returns a new ExpectedSharedContentLinkMetadata instance -func NewExpectedSharedContentLinkMetadata(AudienceOptions []*LinkAudience, CurrentAudience *LinkAudience, LinkPermissions []*LinkPermission, PasswordProtected bool) *ExpectedSharedContentLinkMetadata { - s := new(ExpectedSharedContentLinkMetadata) - s.AudienceOptions = AudienceOptions - s.CurrentAudience = CurrentAudience - s.LinkPermissions = LinkPermissions - s.PasswordProtected = PasswordProtected - return s -} - -// FileAction : Sharing actions that may be taken on files. -type FileAction struct { - dropbox.Tagged -} - -// Valid tag values for FileAction -const ( - FileActionDisableViewerInfo = "disable_viewer_info" - FileActionEditContents = "edit_contents" - FileActionEnableViewerInfo = "enable_viewer_info" - FileActionInviteViewer = "invite_viewer" - FileActionInviteViewerNoComment = "invite_viewer_no_comment" - FileActionInviteEditor = "invite_editor" - FileActionUnshare = "unshare" - FileActionRelinquishMembership = "relinquish_membership" - FileActionShareLink = "share_link" - FileActionCreateLink = "create_link" - FileActionCreateViewLink = "create_view_link" - FileActionCreateEditLink = "create_edit_link" - FileActionOther = "other" -) - -// FileErrorResult : has no documentation (yet) -type FileErrorResult struct { - dropbox.Tagged - // FileNotFoundError : File specified by id was not found. - FileNotFoundError string `json:"file_not_found_error,omitempty"` - // InvalidFileActionError : User does not have permission to take the - // specified action on the file. - InvalidFileActionError string `json:"invalid_file_action_error,omitempty"` - // PermissionDeniedError : User does not have permission to access file - // specified by file.Id. - PermissionDeniedError string `json:"permission_denied_error,omitempty"` -} - -// Valid tag values for FileErrorResult -const ( - FileErrorResultFileNotFoundError = "file_not_found_error" - FileErrorResultInvalidFileActionError = "invalid_file_action_error" - FileErrorResultPermissionDeniedError = "permission_denied_error" - FileErrorResultOther = "other" -) - -// UnmarshalJSON deserializes into a FileErrorResult instance -func (u *FileErrorResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // FileNotFoundError : File specified by id was not found. - FileNotFoundError string `json:"file_not_found_error,omitempty"` - // InvalidFileActionError : User does not have permission to take the - // specified action on the file. - InvalidFileActionError string `json:"invalid_file_action_error,omitempty"` - // PermissionDeniedError : User does not have permission to access file - // specified by file.Id. - PermissionDeniedError string `json:"permission_denied_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "file_not_found_error": - u.FileNotFoundError = w.FileNotFoundError - - if err != nil { - return err - } - case "invalid_file_action_error": - u.InvalidFileActionError = w.InvalidFileActionError - - if err != nil { - return err - } - case "permission_denied_error": - u.PermissionDeniedError = w.PermissionDeniedError - - if err != nil { - return err - } - } - return nil -} - -// SharedLinkMetadata : The metadata of a shared link. -type SharedLinkMetadata struct { - // Url : URL of the shared link. - Url string `json:"url"` - // Id : A unique identifier for the linked file. - Id string `json:"id,omitempty"` - // Name : The linked file name (including extension). This never contains a - // slash. - Name string `json:"name"` - // Expires : Expiration time, if set. By default the link won't expire. - Expires time.Time `json:"expires,omitempty"` - // PathLower : The lowercased full path in the user's Dropbox. This always - // starts with a slash. This field will only be present only if the linked - // file is in the authenticated user's dropbox. - PathLower string `json:"path_lower,omitempty"` - // LinkPermissions : The link's access permissions. - LinkPermissions *LinkPermissions `json:"link_permissions"` - // TeamMemberInfo : The team membership information of the link's owner. - // This field will only be present if the link's owner is a team member. - TeamMemberInfo *TeamMemberInfo `json:"team_member_info,omitempty"` - // ContentOwnerTeamInfo : The team information of the content's owner. This - // field will only be present if the content's owner is a team member and - // the content's owner team is different from the link's owner team. - ContentOwnerTeamInfo *users.Team `json:"content_owner_team_info,omitempty"` -} - -// NewSharedLinkMetadata returns a new SharedLinkMetadata instance -func NewSharedLinkMetadata(Url string, Name string, LinkPermissions *LinkPermissions) *SharedLinkMetadata { - s := new(SharedLinkMetadata) - s.Url = Url - s.Name = Name - s.LinkPermissions = LinkPermissions - return s -} - -// IsSharedLinkMetadata is the interface type for SharedLinkMetadata and its subtypes -type IsSharedLinkMetadata interface { - IsSharedLinkMetadata() -} - -// IsSharedLinkMetadata implements the IsSharedLinkMetadata interface -func (u *SharedLinkMetadata) IsSharedLinkMetadata() {} - -type sharedLinkMetadataUnion struct { - dropbox.Tagged - // File : has no documentation (yet) - File *FileLinkMetadata `json:"file,omitempty"` - // Folder : has no documentation (yet) - Folder *FolderLinkMetadata `json:"folder,omitempty"` -} - -// Valid tag values for SharedLinkMetadata -const ( - SharedLinkMetadataFile = "file" - SharedLinkMetadataFolder = "folder" -) - -// UnmarshalJSON deserializes into a sharedLinkMetadataUnion instance -func (u *sharedLinkMetadataUnion) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "file": - err = json.Unmarshal(body, &u.File) - - if err != nil { - return err - } - case "folder": - err = json.Unmarshal(body, &u.Folder) - - if err != nil { - return err - } - } - return nil -} - -// IsSharedLinkMetadataFromJSON converts JSON to a concrete IsSharedLinkMetadata instance -func IsSharedLinkMetadataFromJSON(data []byte) (IsSharedLinkMetadata, error) { - var t sharedLinkMetadataUnion - if err := json.Unmarshal(data, &t); err != nil { - return nil, err - } - switch t.Tag { - case "file": - return t.File, nil - - case "folder": - return t.Folder, nil - - } - return nil, nil -} - -// FileLinkMetadata : The metadata of a file shared link. -type FileLinkMetadata struct { - SharedLinkMetadata - // ClientModified : The modification time set by the desktop client when the - // file was added to Dropbox. Since this time is not verified (the Dropbox - // server stores whatever the desktop client sends up), this should only be - // used for display purposes (such as sorting) and not, for example, to - // determine if a file has changed or not. - ClientModified time.Time `json:"client_modified"` - // ServerModified : The last time the file was modified on Dropbox. - ServerModified time.Time `json:"server_modified"` - // Rev : A unique identifier for the current revision of a file. This field - // is the same rev as elsewhere in the API and can be used to detect changes - // and avoid conflicts. - Rev string `json:"rev"` - // Size : The file size in bytes. - Size uint64 `json:"size"` -} - -// NewFileLinkMetadata returns a new FileLinkMetadata instance -func NewFileLinkMetadata(Url string, Name string, LinkPermissions *LinkPermissions, ClientModified time.Time, ServerModified time.Time, Rev string, Size uint64) *FileLinkMetadata { - s := new(FileLinkMetadata) - s.Url = Url - s.Name = Name - s.LinkPermissions = LinkPermissions - s.ClientModified = ClientModified - s.ServerModified = ServerModified - s.Rev = Rev - s.Size = Size - return s -} - -// FileMemberActionError : has no documentation (yet) -type FileMemberActionError struct { - dropbox.Tagged - // AccessError : Specified file was invalid or user does not have access. - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - // NoExplicitAccess : The action cannot be completed because the target - // member does not have explicit access to the file. The return value is the - // access that the member has to the file from a parent folder. - NoExplicitAccess *MemberAccessLevelResult `json:"no_explicit_access,omitempty"` -} - -// Valid tag values for FileMemberActionError -const ( - FileMemberActionErrorInvalidMember = "invalid_member" - FileMemberActionErrorNoPermission = "no_permission" - FileMemberActionErrorAccessError = "access_error" - FileMemberActionErrorNoExplicitAccess = "no_explicit_access" - FileMemberActionErrorOther = "other" -) - -// UnmarshalJSON deserializes into a FileMemberActionError instance -func (u *FileMemberActionError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : Specified file was invalid or user does not have - // access. - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "no_explicit_access": - err = json.Unmarshal(body, &u.NoExplicitAccess) - - if err != nil { - return err - } - } - return nil -} - -// FileMemberActionIndividualResult : has no documentation (yet) -type FileMemberActionIndividualResult struct { - dropbox.Tagged - // Success : Member was successfully removed from this file. If AccessLevel - // is given, the member still has access via a parent shared folder. - Success *AccessLevel `json:"success,omitempty"` - // MemberError : User was not able to perform this action. - MemberError *FileMemberActionError `json:"member_error,omitempty"` -} - -// Valid tag values for FileMemberActionIndividualResult -const ( - FileMemberActionIndividualResultSuccess = "success" - FileMemberActionIndividualResultMemberError = "member_error" -) - -// UnmarshalJSON deserializes into a FileMemberActionIndividualResult instance -func (u *FileMemberActionIndividualResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Success : Member was successfully removed from this file. If - // AccessLevel is given, the member still has access via a parent shared - // folder. - Success *AccessLevel `json:"success,omitempty"` - // MemberError : User was not able to perform this action. - MemberError *FileMemberActionError `json:"member_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - u.Success = w.Success - - if err != nil { - return err - } - case "member_error": - u.MemberError = w.MemberError - - if err != nil { - return err - } - } - return nil -} - -// FileMemberActionResult : Per-member result for `addFileMember` or -// `changeFileMemberAccess`. -type FileMemberActionResult struct { - // Member : One of specified input members. - Member *MemberSelector `json:"member"` - // Result : The outcome of the action on this member. - Result *FileMemberActionIndividualResult `json:"result"` -} - -// NewFileMemberActionResult returns a new FileMemberActionResult instance -func NewFileMemberActionResult(Member *MemberSelector, Result *FileMemberActionIndividualResult) *FileMemberActionResult { - s := new(FileMemberActionResult) - s.Member = Member - s.Result = Result - return s -} - -// FileMemberRemoveActionResult : has no documentation (yet) -type FileMemberRemoveActionResult struct { - dropbox.Tagged - // Success : Member was successfully removed from this file. - Success *MemberAccessLevelResult `json:"success,omitempty"` - // MemberError : User was not able to remove this member. - MemberError *FileMemberActionError `json:"member_error,omitempty"` -} - -// Valid tag values for FileMemberRemoveActionResult -const ( - FileMemberRemoveActionResultSuccess = "success" - FileMemberRemoveActionResultMemberError = "member_error" - FileMemberRemoveActionResultOther = "other" -) - -// UnmarshalJSON deserializes into a FileMemberRemoveActionResult instance -func (u *FileMemberRemoveActionResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // MemberError : User was not able to remove this member. - MemberError *FileMemberActionError `json:"member_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "member_error": - u.MemberError = w.MemberError - - if err != nil { - return err - } - } - return nil -} - -// FilePermission : Whether the user is allowed to take the sharing action on -// the file. -type FilePermission struct { - // Action : The action that the user may wish to take on the file. - Action *FileAction `json:"action"` - // Allow : True if the user is allowed to take the action. - Allow bool `json:"allow"` - // Reason : The reason why the user is denied the permission. Not present if - // the action is allowed. - Reason *PermissionDeniedReason `json:"reason,omitempty"` -} - -// NewFilePermission returns a new FilePermission instance -func NewFilePermission(Action *FileAction, Allow bool) *FilePermission { - s := new(FilePermission) - s.Action = Action - s.Allow = Allow - return s -} - -// FolderAction : Actions that may be taken on shared folders. -type FolderAction struct { - dropbox.Tagged -} - -// Valid tag values for FolderAction -const ( - FolderActionChangeOptions = "change_options" - FolderActionDisableViewerInfo = "disable_viewer_info" - FolderActionEditContents = "edit_contents" - FolderActionEnableViewerInfo = "enable_viewer_info" - FolderActionInviteEditor = "invite_editor" - FolderActionInviteViewer = "invite_viewer" - FolderActionInviteViewerNoComment = "invite_viewer_no_comment" - FolderActionRelinquishMembership = "relinquish_membership" - FolderActionUnmount = "unmount" - FolderActionUnshare = "unshare" - FolderActionLeaveACopy = "leave_a_copy" - FolderActionShareLink = "share_link" - FolderActionCreateLink = "create_link" - FolderActionSetAccessInheritance = "set_access_inheritance" - FolderActionOther = "other" -) - -// FolderLinkMetadata : The metadata of a folder shared link. -type FolderLinkMetadata struct { - SharedLinkMetadata -} - -// NewFolderLinkMetadata returns a new FolderLinkMetadata instance -func NewFolderLinkMetadata(Url string, Name string, LinkPermissions *LinkPermissions) *FolderLinkMetadata { - s := new(FolderLinkMetadata) - s.Url = Url - s.Name = Name - s.LinkPermissions = LinkPermissions - return s -} - -// FolderPermission : Whether the user is allowed to take the action on the -// shared folder. -type FolderPermission struct { - // Action : The action that the user may wish to take on the folder. - Action *FolderAction `json:"action"` - // Allow : True if the user is allowed to take the action. - Allow bool `json:"allow"` - // Reason : The reason why the user is denied the permission. Not present if - // the action is allowed, or if no reason is available. - Reason *PermissionDeniedReason `json:"reason,omitempty"` -} - -// NewFolderPermission returns a new FolderPermission instance -func NewFolderPermission(Action *FolderAction, Allow bool) *FolderPermission { - s := new(FolderPermission) - s.Action = Action - s.Allow = Allow - return s -} - -// FolderPolicy : A set of policies governing membership and privileges for a -// shared folder. -type FolderPolicy struct { - // MemberPolicy : Who can be a member of this shared folder, as set on the - // folder itself. The effective policy may differ from this value if the - // team-wide policy is more restrictive. Present only if the folder is owned - // by a team. - MemberPolicy *MemberPolicy `json:"member_policy,omitempty"` - // ResolvedMemberPolicy : Who can be a member of this shared folder, taking - // into account both the folder and the team-wide policy. This value may - // differ from that of member_policy if the team-wide policy is more - // restrictive than the folder policy. Present only if the folder is owned - // by a team. - ResolvedMemberPolicy *MemberPolicy `json:"resolved_member_policy,omitempty"` - // AclUpdatePolicy : Who can add and remove members from this shared folder. - AclUpdatePolicy *AclUpdatePolicy `json:"acl_update_policy"` - // SharedLinkPolicy : Who links can be shared with. - SharedLinkPolicy *SharedLinkPolicy `json:"shared_link_policy"` - // ViewerInfoPolicy : Who can enable/disable viewer info for this shared - // folder. - ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"` -} - -// NewFolderPolicy returns a new FolderPolicy instance -func NewFolderPolicy(AclUpdatePolicy *AclUpdatePolicy, SharedLinkPolicy *SharedLinkPolicy) *FolderPolicy { - s := new(FolderPolicy) - s.AclUpdatePolicy = AclUpdatePolicy - s.SharedLinkPolicy = SharedLinkPolicy - return s -} - -// GetFileMetadataArg : Arguments of `getFileMetadata`. -type GetFileMetadataArg struct { - // File : The file to query. - File string `json:"file"` - // Actions : A list of `FileAction`s corresponding to `FilePermission`s that - // should appear in the response's `SharedFileMetadata.permissions` field - // describing the actions the authenticated user can perform on the file. - Actions []*FileAction `json:"actions,omitempty"` -} - -// NewGetFileMetadataArg returns a new GetFileMetadataArg instance -func NewGetFileMetadataArg(File string) *GetFileMetadataArg { - s := new(GetFileMetadataArg) - s.File = File - return s -} - -// GetFileMetadataBatchArg : Arguments of `getFileMetadataBatch`. -type GetFileMetadataBatchArg struct { - // Files : The files to query. - Files []string `json:"files"` - // Actions : A list of `FileAction`s corresponding to `FilePermission`s that - // should appear in the response's `SharedFileMetadata.permissions` field - // describing the actions the authenticated user can perform on the file. - Actions []*FileAction `json:"actions,omitempty"` -} - -// NewGetFileMetadataBatchArg returns a new GetFileMetadataBatchArg instance -func NewGetFileMetadataBatchArg(Files []string) *GetFileMetadataBatchArg { - s := new(GetFileMetadataBatchArg) - s.Files = Files - return s -} - -// GetFileMetadataBatchResult : Per file results of `getFileMetadataBatch`. -type GetFileMetadataBatchResult struct { - // File : This is the input file identifier corresponding to one of - // `GetFileMetadataBatchArg.files`. - File string `json:"file"` - // Result : The result for this particular file. - Result *GetFileMetadataIndividualResult `json:"result"` -} - -// NewGetFileMetadataBatchResult returns a new GetFileMetadataBatchResult instance -func NewGetFileMetadataBatchResult(File string, Result *GetFileMetadataIndividualResult) *GetFileMetadataBatchResult { - s := new(GetFileMetadataBatchResult) - s.File = File - s.Result = Result - return s -} - -// GetFileMetadataError : Error result for `getFileMetadata`. -type GetFileMetadataError struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for GetFileMetadataError -const ( - GetFileMetadataErrorUserError = "user_error" - GetFileMetadataErrorAccessError = "access_error" - GetFileMetadataErrorOther = "other" -) - -// UnmarshalJSON deserializes into a GetFileMetadataError instance -func (u *GetFileMetadataError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// GetFileMetadataIndividualResult : has no documentation (yet) -type GetFileMetadataIndividualResult struct { - dropbox.Tagged - // Metadata : The result for this file if it was successful. - Metadata *SharedFileMetadata `json:"metadata,omitempty"` - // AccessError : The result for this file if it was an error. - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for GetFileMetadataIndividualResult -const ( - GetFileMetadataIndividualResultMetadata = "metadata" - GetFileMetadataIndividualResultAccessError = "access_error" - GetFileMetadataIndividualResultOther = "other" -) - -// UnmarshalJSON deserializes into a GetFileMetadataIndividualResult instance -func (u *GetFileMetadataIndividualResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : The result for this file if it was an error. - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "metadata": - err = json.Unmarshal(body, &u.Metadata) - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// GetMetadataArgs : has no documentation (yet) -type GetMetadataArgs struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s - // that should appear in the response's `SharedFolderMetadata.permissions` - // field describing the actions the authenticated user can perform on the - // folder. - Actions []*FolderAction `json:"actions,omitempty"` -} - -// NewGetMetadataArgs returns a new GetMetadataArgs instance -func NewGetMetadataArgs(SharedFolderId string) *GetMetadataArgs { - s := new(GetMetadataArgs) - s.SharedFolderId = SharedFolderId - return s -} - -// SharedLinkError : has no documentation (yet) -type SharedLinkError struct { - dropbox.Tagged -} - -// Valid tag values for SharedLinkError -const ( - SharedLinkErrorSharedLinkNotFound = "shared_link_not_found" - SharedLinkErrorSharedLinkAccessDenied = "shared_link_access_denied" - SharedLinkErrorUnsupportedLinkType = "unsupported_link_type" - SharedLinkErrorOther = "other" -) - -// GetSharedLinkFileError : has no documentation (yet) -type GetSharedLinkFileError struct { - dropbox.Tagged -} - -// Valid tag values for GetSharedLinkFileError -const ( - GetSharedLinkFileErrorSharedLinkNotFound = "shared_link_not_found" - GetSharedLinkFileErrorSharedLinkAccessDenied = "shared_link_access_denied" - GetSharedLinkFileErrorUnsupportedLinkType = "unsupported_link_type" - GetSharedLinkFileErrorOther = "other" - GetSharedLinkFileErrorSharedLinkIsDirectory = "shared_link_is_directory" -) - -// GetSharedLinkMetadataArg : has no documentation (yet) -type GetSharedLinkMetadataArg struct { - // Url : URL of the shared link. - Url string `json:"url"` - // Path : If the shared link is to a folder, this parameter can be used to - // retrieve the metadata for a specific file or sub-folder in this folder. A - // relative path should be used. - Path string `json:"path,omitempty"` - // LinkPassword : If the shared link has a password, this parameter can be - // used. - LinkPassword string `json:"link_password,omitempty"` -} - -// NewGetSharedLinkMetadataArg returns a new GetSharedLinkMetadataArg instance -func NewGetSharedLinkMetadataArg(Url string) *GetSharedLinkMetadataArg { - s := new(GetSharedLinkMetadataArg) - s.Url = Url - return s -} - -// GetSharedLinksArg : has no documentation (yet) -type GetSharedLinksArg struct { - // Path : See `getSharedLinks` description. - Path string `json:"path,omitempty"` -} - -// NewGetSharedLinksArg returns a new GetSharedLinksArg instance -func NewGetSharedLinksArg() *GetSharedLinksArg { - s := new(GetSharedLinksArg) - return s -} - -// GetSharedLinksError : has no documentation (yet) -type GetSharedLinksError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path string `json:"path,omitempty"` -} - -// Valid tag values for GetSharedLinksError -const ( - GetSharedLinksErrorPath = "path" - GetSharedLinksErrorOther = "other" -) - -// UnmarshalJSON deserializes into a GetSharedLinksError instance -func (u *GetSharedLinksError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path string `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// GetSharedLinksResult : has no documentation (yet) -type GetSharedLinksResult struct { - // Links : Shared links applicable to the path argument. - Links []IsLinkMetadata `json:"links"` -} - -// NewGetSharedLinksResult returns a new GetSharedLinksResult instance -func NewGetSharedLinksResult(Links []IsLinkMetadata) *GetSharedLinksResult { - s := new(GetSharedLinksResult) - s.Links = Links - return s -} - -// UnmarshalJSON deserializes into a GetSharedLinksResult instance -func (u *GetSharedLinksResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Links : Shared links applicable to the path argument. - Links []json.RawMessage `json:"links"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - u.Links = make([]IsLinkMetadata, len(w.Links)) - for i, e := range w.Links { - v, err := IsLinkMetadataFromJSON(e) - if err != nil { - return err - } - u.Links[i] = v - } - return nil -} - -// GroupInfo : The information about a group. Groups is a way to manage a list -// of users who need same access permission to the shared folder. -type GroupInfo struct { - team_common.GroupSummary - // GroupType : The type of group. - GroupType *team_common.GroupType `json:"group_type"` - // IsMember : If the current user is a member of the group. - IsMember bool `json:"is_member"` - // IsOwner : If the current user is an owner of the group. - IsOwner bool `json:"is_owner"` - // SameTeam : If the group is owned by the current user's team. - SameTeam bool `json:"same_team"` -} - -// NewGroupInfo returns a new GroupInfo instance -func NewGroupInfo(GroupName string, GroupId string, GroupManagementType *team_common.GroupManagementType, GroupType *team_common.GroupType, IsMember bool, IsOwner bool, SameTeam bool) *GroupInfo { - s := new(GroupInfo) - s.GroupName = GroupName - s.GroupId = GroupId - s.GroupManagementType = GroupManagementType - s.GroupType = GroupType - s.IsMember = IsMember - s.IsOwner = IsOwner - s.SameTeam = SameTeam - return s -} - -// MembershipInfo : The information about a member of the shared content. -type MembershipInfo struct { - // AccessType : The access type for this member. It contains inherited - // access type from parent folder, and acquired access type from this - // folder. - AccessType *AccessLevel `json:"access_type"` - // Permissions : The permissions that requesting user has on this member. - // The set of permissions corresponds to the MemberActions in the request. - Permissions []*MemberPermission `json:"permissions,omitempty"` - // Initials : Never set. - Initials string `json:"initials,omitempty"` - // IsInherited : True if the member has access from a parent folder. - IsInherited bool `json:"is_inherited"` -} - -// NewMembershipInfo returns a new MembershipInfo instance -func NewMembershipInfo(AccessType *AccessLevel) *MembershipInfo { - s := new(MembershipInfo) - s.AccessType = AccessType - s.IsInherited = false - return s -} - -// GroupMembershipInfo : The information about a group member of the shared -// content. -type GroupMembershipInfo struct { - MembershipInfo - // Group : The information about the membership group. - Group *GroupInfo `json:"group"` -} - -// NewGroupMembershipInfo returns a new GroupMembershipInfo instance -func NewGroupMembershipInfo(AccessType *AccessLevel, Group *GroupInfo) *GroupMembershipInfo { - s := new(GroupMembershipInfo) - s.AccessType = AccessType - s.Group = Group - s.IsInherited = false - return s -} - -// InsufficientPlan : has no documentation (yet) -type InsufficientPlan struct { - // Message : A message to tell the user to upgrade in order to support - // expected action. - Message string `json:"message"` - // UpsellUrl : A URL to send the user to in order to obtain the account type - // they need, e.g. upgrading. Absent if there is no action the user can take - // to upgrade. - UpsellUrl string `json:"upsell_url,omitempty"` -} - -// NewInsufficientPlan returns a new InsufficientPlan instance -func NewInsufficientPlan(Message string) *InsufficientPlan { - s := new(InsufficientPlan) - s.Message = Message - return s -} - -// InsufficientQuotaAmounts : has no documentation (yet) -type InsufficientQuotaAmounts struct { - // SpaceNeeded : The amount of space needed to add the item (the size of the - // item). - SpaceNeeded uint64 `json:"space_needed"` - // SpaceShortage : The amount of extra space needed to add the item. - SpaceShortage uint64 `json:"space_shortage"` - // SpaceLeft : The amount of space left in the user's Dropbox, less than - // space_needed. - SpaceLeft uint64 `json:"space_left"` -} - -// NewInsufficientQuotaAmounts returns a new InsufficientQuotaAmounts instance -func NewInsufficientQuotaAmounts(SpaceNeeded uint64, SpaceShortage uint64, SpaceLeft uint64) *InsufficientQuotaAmounts { - s := new(InsufficientQuotaAmounts) - s.SpaceNeeded = SpaceNeeded - s.SpaceShortage = SpaceShortage - s.SpaceLeft = SpaceLeft - return s -} - -// InviteeInfo : Information about the recipient of a shared content invitation. -type InviteeInfo struct { - dropbox.Tagged - // Email : E-mail address of invited user. - Email string `json:"email,omitempty"` -} - -// Valid tag values for InviteeInfo -const ( - InviteeInfoEmail = "email" - InviteeInfoOther = "other" -) - -// UnmarshalJSON deserializes into a InviteeInfo instance -func (u *InviteeInfo) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Email : E-mail address of invited user. - Email string `json:"email,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "email": - u.Email = w.Email - - if err != nil { - return err - } - } - return nil -} - -// InviteeMembershipInfo : Information about an invited member of a shared -// content. -type InviteeMembershipInfo struct { - MembershipInfo - // Invitee : Recipient of the invitation. - Invitee *InviteeInfo `json:"invitee"` - // User : The user this invitation is tied to, if available. - User *UserInfo `json:"user,omitempty"` -} - -// NewInviteeMembershipInfo returns a new InviteeMembershipInfo instance -func NewInviteeMembershipInfo(AccessType *AccessLevel, Invitee *InviteeInfo) *InviteeMembershipInfo { - s := new(InviteeMembershipInfo) - s.AccessType = AccessType - s.Invitee = Invitee - s.IsInherited = false - return s -} - -// JobError : Error occurred while performing an asynchronous job from -// `unshareFolder` or `removeFolderMember`. -type JobError struct { - dropbox.Tagged - // UnshareFolderError : Error occurred while performing `unshareFolder` - // action. - UnshareFolderError *UnshareFolderError `json:"unshare_folder_error,omitempty"` - // RemoveFolderMemberError : Error occurred while performing - // `removeFolderMember` action. - RemoveFolderMemberError *RemoveFolderMemberError `json:"remove_folder_member_error,omitempty"` - // RelinquishFolderMembershipError : Error occurred while performing - // `relinquishFolderMembership` action. - RelinquishFolderMembershipError *RelinquishFolderMembershipError `json:"relinquish_folder_membership_error,omitempty"` -} - -// Valid tag values for JobError -const ( - JobErrorUnshareFolderError = "unshare_folder_error" - JobErrorRemoveFolderMemberError = "remove_folder_member_error" - JobErrorRelinquishFolderMembershipError = "relinquish_folder_membership_error" - JobErrorOther = "other" -) - -// UnmarshalJSON deserializes into a JobError instance -func (u *JobError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UnshareFolderError : Error occurred while performing `unshareFolder` - // action. - UnshareFolderError *UnshareFolderError `json:"unshare_folder_error,omitempty"` - // RemoveFolderMemberError : Error occurred while performing - // `removeFolderMember` action. - RemoveFolderMemberError *RemoveFolderMemberError `json:"remove_folder_member_error,omitempty"` - // RelinquishFolderMembershipError : Error occurred while performing - // `relinquishFolderMembership` action. - RelinquishFolderMembershipError *RelinquishFolderMembershipError `json:"relinquish_folder_membership_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "unshare_folder_error": - u.UnshareFolderError = w.UnshareFolderError - - if err != nil { - return err - } - case "remove_folder_member_error": - u.RemoveFolderMemberError = w.RemoveFolderMemberError - - if err != nil { - return err - } - case "relinquish_folder_membership_error": - u.RelinquishFolderMembershipError = w.RelinquishFolderMembershipError - - if err != nil { - return err - } - } - return nil -} - -// JobStatus : has no documentation (yet) -type JobStatus struct { - dropbox.Tagged - // Failed : The asynchronous job returned an error. - Failed *JobError `json:"failed,omitempty"` -} - -// Valid tag values for JobStatus -const ( - JobStatusInProgress = "in_progress" - JobStatusComplete = "complete" - JobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a JobStatus instance -func (u *JobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : The asynchronous job returned an error. - Failed *JobError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// LinkAccessLevel : has no documentation (yet) -type LinkAccessLevel struct { - dropbox.Tagged -} - -// Valid tag values for LinkAccessLevel -const ( - LinkAccessLevelViewer = "viewer" - LinkAccessLevelEditor = "editor" - LinkAccessLevelOther = "other" -) - -// LinkAction : Actions that can be performed on a link. -type LinkAction struct { - dropbox.Tagged -} - -// Valid tag values for LinkAction -const ( - LinkActionChangeAccessLevel = "change_access_level" - LinkActionChangeAudience = "change_audience" - LinkActionRemoveExpiry = "remove_expiry" - LinkActionRemovePassword = "remove_password" - LinkActionSetExpiry = "set_expiry" - LinkActionSetPassword = "set_password" - LinkActionOther = "other" -) - -// LinkAudience : has no documentation (yet) -type LinkAudience struct { - dropbox.Tagged -} - -// Valid tag values for LinkAudience -const ( - LinkAudiencePublic = "public" - LinkAudienceTeam = "team" - LinkAudienceNoOne = "no_one" - LinkAudiencePassword = "password" - LinkAudienceMembers = "members" - LinkAudienceOther = "other" -) - -// LinkExpiry : has no documentation (yet) -type LinkExpiry struct { - dropbox.Tagged - // SetExpiry : Set a new expiry or change an existing expiry. - SetExpiry time.Time `json:"set_expiry,omitempty"` -} - -// Valid tag values for LinkExpiry -const ( - LinkExpiryRemoveExpiry = "remove_expiry" - LinkExpirySetExpiry = "set_expiry" - LinkExpiryOther = "other" -) - -// UnmarshalJSON deserializes into a LinkExpiry instance -func (u *LinkExpiry) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // SetExpiry : Set a new expiry or change an existing expiry. - SetExpiry time.Time `json:"set_expiry,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "set_expiry": - u.SetExpiry = w.SetExpiry - - if err != nil { - return err - } - } - return nil -} - -// LinkPassword : has no documentation (yet) -type LinkPassword struct { - dropbox.Tagged - // SetPassword : Set a new password or change an existing password. - SetPassword string `json:"set_password,omitempty"` -} - -// Valid tag values for LinkPassword -const ( - LinkPasswordRemovePassword = "remove_password" - LinkPasswordSetPassword = "set_password" - LinkPasswordOther = "other" -) - -// UnmarshalJSON deserializes into a LinkPassword instance -func (u *LinkPassword) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // SetPassword : Set a new password or change an existing password. - SetPassword string `json:"set_password,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "set_password": - u.SetPassword = w.SetPassword - - if err != nil { - return err - } - } - return nil -} - -// LinkPermission : Permissions for actions that can be performed on a link. -type LinkPermission struct { - // Action : has no documentation (yet) - Action *LinkAction `json:"action"` - // Allow : has no documentation (yet) - Allow bool `json:"allow"` - // Reason : has no documentation (yet) - Reason *PermissionDeniedReason `json:"reason,omitempty"` -} - -// NewLinkPermission returns a new LinkPermission instance -func NewLinkPermission(Action *LinkAction, Allow bool) *LinkPermission { - s := new(LinkPermission) - s.Action = Action - s.Allow = Allow - return s -} - -// LinkPermissions : has no documentation (yet) -type LinkPermissions struct { - // ResolvedVisibility : The current visibility of the link after considering - // the shared links policies of the the team (in case the link's owner is - // part of a team) and the shared folder (in case the linked file is part of - // a shared folder). This field is shown only if the caller has access to - // this info (the link's owner always has access to this data). For some - // links, an effective_audience value is returned instead. - ResolvedVisibility *ResolvedVisibility `json:"resolved_visibility,omitempty"` - // RequestedVisibility : The shared link's requested visibility. This can be - // overridden by the team and shared folder policies. The final visibility, - // after considering these policies, can be found in `resolved_visibility`. - // This is shown only if the caller is the link's owner and - // resolved_visibility is returned instead of effective_audience. - RequestedVisibility *RequestedVisibility `json:"requested_visibility,omitempty"` - // CanRevoke : Whether the caller can revoke the shared link. - CanRevoke bool `json:"can_revoke"` - // RevokeFailureReason : The failure reason for revoking the link. This - // field will only be present if the `can_revoke` is false. - RevokeFailureReason *SharedLinkAccessFailureReason `json:"revoke_failure_reason,omitempty"` - // EffectiveAudience : The type of audience who can benefit from the access - // level specified by the `link_access_level` field. - EffectiveAudience *LinkAudience `json:"effective_audience,omitempty"` - // LinkAccessLevel : The access level that the link will grant to its users. - // A link can grant additional rights to a user beyond their current access - // level. For example, if a user was invited as a viewer to a file, and then - // opens a link with `link_access_level` set to `editor`, then they will - // gain editor privileges. The `link_access_level` is a property of the - // link, and does not depend on who is calling this API. In particular, - // `link_access_level` does not take into account the API caller's current - // permissions to the content. - LinkAccessLevel *LinkAccessLevel `json:"link_access_level,omitempty"` -} - -// NewLinkPermissions returns a new LinkPermissions instance -func NewLinkPermissions(CanRevoke bool) *LinkPermissions { - s := new(LinkPermissions) - s.CanRevoke = CanRevoke - return s -} - -// LinkSettings : Settings that apply to a link. -type LinkSettings struct { - // AccessLevel : The access level on the link for this file. Currently, it - // only accepts 'viewer' and 'viewer_no_comment'. - AccessLevel *AccessLevel `json:"access_level,omitempty"` - // Audience : The type of audience on the link for this file. - Audience *LinkAudience `json:"audience,omitempty"` - // Expiry : An expiry timestamp to set on a link. - Expiry *LinkExpiry `json:"expiry,omitempty"` - // Password : The password for the link. - Password *LinkPassword `json:"password,omitempty"` -} - -// NewLinkSettings returns a new LinkSettings instance -func NewLinkSettings() *LinkSettings { - s := new(LinkSettings) - return s -} - -// ListFileMembersArg : Arguments for `listFileMembers`. -type ListFileMembersArg struct { - // File : The file for which you want to see members. - File string `json:"file"` - // Actions : The actions for which to return permissions on a member. - Actions []*MemberAction `json:"actions,omitempty"` - // IncludeInherited : Whether to include members who only have access from a - // parent shared folder. - IncludeInherited bool `json:"include_inherited"` - // Limit : Number of members to return max per query. Defaults to 100 if no - // limit is specified. - Limit uint32 `json:"limit"` -} - -// NewListFileMembersArg returns a new ListFileMembersArg instance -func NewListFileMembersArg(File string) *ListFileMembersArg { - s := new(ListFileMembersArg) - s.File = File - s.IncludeInherited = true - s.Limit = 100 - return s -} - -// ListFileMembersBatchArg : Arguments for `listFileMembersBatch`. -type ListFileMembersBatchArg struct { - // Files : Files for which to return members. - Files []string `json:"files"` - // Limit : Number of members to return max per query. Defaults to 10 if no - // limit is specified. - Limit uint32 `json:"limit"` -} - -// NewListFileMembersBatchArg returns a new ListFileMembersBatchArg instance -func NewListFileMembersBatchArg(Files []string) *ListFileMembersBatchArg { - s := new(ListFileMembersBatchArg) - s.Files = Files - s.Limit = 10 - return s -} - -// ListFileMembersBatchResult : Per-file result for `listFileMembersBatch`. -type ListFileMembersBatchResult struct { - // File : This is the input file identifier, whether an ID or a path. - File string `json:"file"` - // Result : The result for this particular file. - Result *ListFileMembersIndividualResult `json:"result"` -} - -// NewListFileMembersBatchResult returns a new ListFileMembersBatchResult instance -func NewListFileMembersBatchResult(File string, Result *ListFileMembersIndividualResult) *ListFileMembersBatchResult { - s := new(ListFileMembersBatchResult) - s.File = File - s.Result = Result - return s -} - -// ListFileMembersContinueArg : Arguments for `listFileMembersContinue`. -type ListFileMembersContinueArg struct { - // Cursor : The cursor returned by your last call to `listFileMembers`, - // `listFileMembersContinue`, or `listFileMembersBatch`. - Cursor string `json:"cursor"` -} - -// NewListFileMembersContinueArg returns a new ListFileMembersContinueArg instance -func NewListFileMembersContinueArg(Cursor string) *ListFileMembersContinueArg { - s := new(ListFileMembersContinueArg) - s.Cursor = Cursor - return s -} - -// ListFileMembersContinueError : Error for `listFileMembersContinue`. -type ListFileMembersContinueError struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for ListFileMembersContinueError -const ( - ListFileMembersContinueErrorUserError = "user_error" - ListFileMembersContinueErrorAccessError = "access_error" - ListFileMembersContinueErrorInvalidCursor = "invalid_cursor" - ListFileMembersContinueErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListFileMembersContinueError instance -func (u *ListFileMembersContinueError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// ListFileMembersCountResult : has no documentation (yet) -type ListFileMembersCountResult struct { - // Members : A list of members on this file. - Members *SharedFileMembers `json:"members"` - // MemberCount : The number of members on this file. This does not include - // inherited members. - MemberCount uint32 `json:"member_count"` -} - -// NewListFileMembersCountResult returns a new ListFileMembersCountResult instance -func NewListFileMembersCountResult(Members *SharedFileMembers, MemberCount uint32) *ListFileMembersCountResult { - s := new(ListFileMembersCountResult) - s.Members = Members - s.MemberCount = MemberCount - return s -} - -// ListFileMembersError : Error for `listFileMembers`. -type ListFileMembersError struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for ListFileMembersError -const ( - ListFileMembersErrorUserError = "user_error" - ListFileMembersErrorAccessError = "access_error" - ListFileMembersErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListFileMembersError instance -func (u *ListFileMembersError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// ListFileMembersIndividualResult : has no documentation (yet) -type ListFileMembersIndividualResult struct { - dropbox.Tagged - // Result : The results of the query for this file if it was successful. - Result *ListFileMembersCountResult `json:"result,omitempty"` - // AccessError : The result of the query for this file if it was an error. - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for ListFileMembersIndividualResult -const ( - ListFileMembersIndividualResultResult = "result" - ListFileMembersIndividualResultAccessError = "access_error" - ListFileMembersIndividualResultOther = "other" -) - -// UnmarshalJSON deserializes into a ListFileMembersIndividualResult instance -func (u *ListFileMembersIndividualResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : The result of the query for this file if it was an - // error. - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "result": - err = json.Unmarshal(body, &u.Result) - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// ListFilesArg : Arguments for `listReceivedFiles`. -type ListFilesArg struct { - // Limit : Number of files to return max per query. Defaults to 100 if no - // limit is specified. - Limit uint32 `json:"limit"` - // Actions : A list of `FileAction`s corresponding to `FilePermission`s that - // should appear in the response's `SharedFileMetadata.permissions` field - // describing the actions the authenticated user can perform on the file. - Actions []*FileAction `json:"actions,omitempty"` -} - -// NewListFilesArg returns a new ListFilesArg instance -func NewListFilesArg() *ListFilesArg { - s := new(ListFilesArg) - s.Limit = 100 - return s -} - -// ListFilesContinueArg : Arguments for `listReceivedFilesContinue`. -type ListFilesContinueArg struct { - // Cursor : Cursor in `ListFilesResult.cursor`. - Cursor string `json:"cursor"` -} - -// NewListFilesContinueArg returns a new ListFilesContinueArg instance -func NewListFilesContinueArg(Cursor string) *ListFilesContinueArg { - s := new(ListFilesContinueArg) - s.Cursor = Cursor - return s -} - -// ListFilesContinueError : Error results for `listReceivedFilesContinue`. -type ListFilesContinueError struct { - dropbox.Tagged - // UserError : User account had a problem. - UserError *SharingUserError `json:"user_error,omitempty"` -} - -// Valid tag values for ListFilesContinueError -const ( - ListFilesContinueErrorUserError = "user_error" - ListFilesContinueErrorInvalidCursor = "invalid_cursor" - ListFilesContinueErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListFilesContinueError instance -func (u *ListFilesContinueError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : User account had a problem. - UserError *SharingUserError `json:"user_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - } - return nil -} - -// ListFilesResult : Success results for `listReceivedFiles`. -type ListFilesResult struct { - // Entries : Information about the files shared with current user. - Entries []*SharedFileMetadata `json:"entries"` - // Cursor : Cursor used to obtain additional shared files. - Cursor string `json:"cursor,omitempty"` -} - -// NewListFilesResult returns a new ListFilesResult instance -func NewListFilesResult(Entries []*SharedFileMetadata) *ListFilesResult { - s := new(ListFilesResult) - s.Entries = Entries - return s -} - -// ListFolderMembersCursorArg : has no documentation (yet) -type ListFolderMembersCursorArg struct { - // Actions : This is a list indicating whether each returned member will - // include a boolean value `MemberPermission.allow` that describes whether - // the current user can perform the MemberAction on the member. - Actions []*MemberAction `json:"actions,omitempty"` - // Limit : The maximum number of results that include members, groups and - // invitees to return per request. - Limit uint32 `json:"limit"` -} - -// NewListFolderMembersCursorArg returns a new ListFolderMembersCursorArg instance -func NewListFolderMembersCursorArg() *ListFolderMembersCursorArg { - s := new(ListFolderMembersCursorArg) - s.Limit = 1000 - return s -} - -// ListFolderMembersArgs : has no documentation (yet) -type ListFolderMembersArgs struct { - ListFolderMembersCursorArg - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` -} - -// NewListFolderMembersArgs returns a new ListFolderMembersArgs instance -func NewListFolderMembersArgs(SharedFolderId string) *ListFolderMembersArgs { - s := new(ListFolderMembersArgs) - s.SharedFolderId = SharedFolderId - s.Limit = 1000 - return s -} - -// ListFolderMembersContinueArg : has no documentation (yet) -type ListFolderMembersContinueArg struct { - // Cursor : The cursor returned by your last call to `listFolderMembers` or - // `listFolderMembersContinue`. - Cursor string `json:"cursor"` -} - -// NewListFolderMembersContinueArg returns a new ListFolderMembersContinueArg instance -func NewListFolderMembersContinueArg(Cursor string) *ListFolderMembersContinueArg { - s := new(ListFolderMembersContinueArg) - s.Cursor = Cursor - return s -} - -// ListFolderMembersContinueError : has no documentation (yet) -type ListFolderMembersContinueError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for ListFolderMembersContinueError -const ( - ListFolderMembersContinueErrorAccessError = "access_error" - ListFolderMembersContinueErrorInvalidCursor = "invalid_cursor" - ListFolderMembersContinueErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListFolderMembersContinueError instance -func (u *ListFolderMembersContinueError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// ListFoldersArgs : has no documentation (yet) -type ListFoldersArgs struct { - // Limit : The maximum number of results to return per request. - Limit uint32 `json:"limit"` - // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s - // that should appear in the response's `SharedFolderMetadata.permissions` - // field describing the actions the authenticated user can perform on the - // folder. - Actions []*FolderAction `json:"actions,omitempty"` -} - -// NewListFoldersArgs returns a new ListFoldersArgs instance -func NewListFoldersArgs() *ListFoldersArgs { - s := new(ListFoldersArgs) - s.Limit = 1000 - return s -} - -// ListFoldersContinueArg : has no documentation (yet) -type ListFoldersContinueArg struct { - // Cursor : The cursor returned by the previous API call specified in the - // endpoint description. - Cursor string `json:"cursor"` -} - -// NewListFoldersContinueArg returns a new ListFoldersContinueArg instance -func NewListFoldersContinueArg(Cursor string) *ListFoldersContinueArg { - s := new(ListFoldersContinueArg) - s.Cursor = Cursor - return s -} - -// ListFoldersContinueError : has no documentation (yet) -type ListFoldersContinueError struct { - dropbox.Tagged -} - -// Valid tag values for ListFoldersContinueError -const ( - ListFoldersContinueErrorInvalidCursor = "invalid_cursor" - ListFoldersContinueErrorOther = "other" -) - -// ListFoldersResult : Result for `listFolders` or `listMountableFolders`, -// depending on which endpoint was requested. Unmounted shared folders can be -// identified by the absence of `SharedFolderMetadata.path_lower`. -type ListFoldersResult struct { - // Entries : List of all shared folders the authenticated user has access - // to. - Entries []*SharedFolderMetadata `json:"entries"` - // Cursor : Present if there are additional shared folders that have not - // been returned yet. Pass the cursor into the corresponding continue - // endpoint (either `listFoldersContinue` or `listMountableFoldersContinue`) - // to list additional folders. - Cursor string `json:"cursor,omitempty"` -} - -// NewListFoldersResult returns a new ListFoldersResult instance -func NewListFoldersResult(Entries []*SharedFolderMetadata) *ListFoldersResult { - s := new(ListFoldersResult) - s.Entries = Entries - return s -} - -// ListSharedLinksArg : has no documentation (yet) -type ListSharedLinksArg struct { - // Path : See `listSharedLinks` description. - Path string `json:"path,omitempty"` - // Cursor : The cursor returned by your last call to `listSharedLinks`. - Cursor string `json:"cursor,omitempty"` - // DirectOnly : See `listSharedLinks` description. - DirectOnly bool `json:"direct_only,omitempty"` -} - -// NewListSharedLinksArg returns a new ListSharedLinksArg instance -func NewListSharedLinksArg() *ListSharedLinksArg { - s := new(ListSharedLinksArg) - return s -} - -// ListSharedLinksError : has no documentation (yet) -type ListSharedLinksError struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *files.LookupError `json:"path,omitempty"` -} - -// Valid tag values for ListSharedLinksError -const ( - ListSharedLinksErrorPath = "path" - ListSharedLinksErrorReset = "reset" - ListSharedLinksErrorOther = "other" -) - -// UnmarshalJSON deserializes into a ListSharedLinksError instance -func (u *ListSharedLinksError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Path : has no documentation (yet) - Path *files.LookupError `json:"path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "path": - u.Path = w.Path - - if err != nil { - return err - } - } - return nil -} - -// ListSharedLinksResult : has no documentation (yet) -type ListSharedLinksResult struct { - // Links : Shared links applicable to the path argument. - Links []IsSharedLinkMetadata `json:"links"` - // HasMore : Is true if there are additional shared links that have not been - // returned yet. Pass the cursor into `listSharedLinks` to retrieve them. - HasMore bool `json:"has_more"` - // Cursor : Pass the cursor into `listSharedLinks` to obtain the additional - // links. Cursor is returned only if no path is given. - Cursor string `json:"cursor,omitempty"` -} - -// NewListSharedLinksResult returns a new ListSharedLinksResult instance -func NewListSharedLinksResult(Links []IsSharedLinkMetadata, HasMore bool) *ListSharedLinksResult { - s := new(ListSharedLinksResult) - s.Links = Links - s.HasMore = HasMore - return s -} - -// UnmarshalJSON deserializes into a ListSharedLinksResult instance -func (u *ListSharedLinksResult) UnmarshalJSON(b []byte) error { - type wrap struct { - // Links : Shared links applicable to the path argument. - Links []json.RawMessage `json:"links"` - // HasMore : Is true if there are additional shared links that have not - // been returned yet. Pass the cursor into `listSharedLinks` to retrieve - // them. - HasMore bool `json:"has_more"` - // Cursor : Pass the cursor into `listSharedLinks` to obtain the - // additional links. Cursor is returned only if no path is given. - Cursor string `json:"cursor,omitempty"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - u.Links = make([]IsSharedLinkMetadata, len(w.Links)) - for i, e := range w.Links { - v, err := IsSharedLinkMetadataFromJSON(e) - if err != nil { - return err - } - u.Links[i] = v - } - u.HasMore = w.HasMore - u.Cursor = w.Cursor - return nil -} - -// MemberAccessLevelResult : Contains information about a member's access level -// to content after an operation. -type MemberAccessLevelResult struct { - // AccessLevel : The member still has this level of access to the content - // through a parent folder. - AccessLevel *AccessLevel `json:"access_level,omitempty"` - // Warning : A localized string with additional information about why the - // user has this access level to the content. - Warning string `json:"warning,omitempty"` - // AccessDetails : The parent folders that a member has access to. The field - // is present if the user has access to the first parent folder where the - // member gains access. - AccessDetails []*ParentFolderAccessInfo `json:"access_details,omitempty"` -} - -// NewMemberAccessLevelResult returns a new MemberAccessLevelResult instance -func NewMemberAccessLevelResult() *MemberAccessLevelResult { - s := new(MemberAccessLevelResult) - return s -} - -// MemberAction : Actions that may be taken on members of a shared folder. -type MemberAction struct { - dropbox.Tagged -} - -// Valid tag values for MemberAction -const ( - MemberActionLeaveACopy = "leave_a_copy" - MemberActionMakeEditor = "make_editor" - MemberActionMakeOwner = "make_owner" - MemberActionMakeViewer = "make_viewer" - MemberActionMakeViewerNoComment = "make_viewer_no_comment" - MemberActionRemove = "remove" - MemberActionOther = "other" -) - -// MemberPermission : Whether the user is allowed to take the action on the -// associated member. -type MemberPermission struct { - // Action : The action that the user may wish to take on the member. - Action *MemberAction `json:"action"` - // Allow : True if the user is allowed to take the action. - Allow bool `json:"allow"` - // Reason : The reason why the user is denied the permission. Not present if - // the action is allowed. - Reason *PermissionDeniedReason `json:"reason,omitempty"` -} - -// NewMemberPermission returns a new MemberPermission instance -func NewMemberPermission(Action *MemberAction, Allow bool) *MemberPermission { - s := new(MemberPermission) - s.Action = Action - s.Allow = Allow - return s -} - -// MemberPolicy : Policy governing who can be a member of a shared folder. Only -// applicable to folders owned by a user on a team. -type MemberPolicy struct { - dropbox.Tagged -} - -// Valid tag values for MemberPolicy -const ( - MemberPolicyTeam = "team" - MemberPolicyAnyone = "anyone" - MemberPolicyOther = "other" -) - -// MemberSelector : Includes different ways to identify a member of a shared -// folder. -type MemberSelector struct { - dropbox.Tagged - // DropboxId : Dropbox account, team member, or group ID of member. - DropboxId string `json:"dropbox_id,omitempty"` - // Email : E-mail address of member. - Email string `json:"email,omitempty"` -} - -// Valid tag values for MemberSelector -const ( - MemberSelectorDropboxId = "dropbox_id" - MemberSelectorEmail = "email" - MemberSelectorOther = "other" -) - -// UnmarshalJSON deserializes into a MemberSelector instance -func (u *MemberSelector) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // DropboxId : Dropbox account, team member, or group ID of member. - DropboxId string `json:"dropbox_id,omitempty"` - // Email : E-mail address of member. - Email string `json:"email,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "dropbox_id": - u.DropboxId = w.DropboxId - - if err != nil { - return err - } - case "email": - u.Email = w.Email - - if err != nil { - return err - } - } - return nil -} - -// ModifySharedLinkSettingsArgs : has no documentation (yet) -type ModifySharedLinkSettingsArgs struct { - // Url : URL of the shared link to change its settings. - Url string `json:"url"` - // Settings : Set of settings for the shared link. - Settings *SharedLinkSettings `json:"settings"` - // RemoveExpiration : If set to true, removes the expiration of the shared - // link. - RemoveExpiration bool `json:"remove_expiration"` -} - -// NewModifySharedLinkSettingsArgs returns a new ModifySharedLinkSettingsArgs instance -func NewModifySharedLinkSettingsArgs(Url string, Settings *SharedLinkSettings) *ModifySharedLinkSettingsArgs { - s := new(ModifySharedLinkSettingsArgs) - s.Url = Url - s.Settings = Settings - s.RemoveExpiration = false - return s -} - -// ModifySharedLinkSettingsError : has no documentation (yet) -type ModifySharedLinkSettingsError struct { - dropbox.Tagged - // SettingsError : There is an error with the given settings. - SettingsError *SharedLinkSettingsError `json:"settings_error,omitempty"` -} - -// Valid tag values for ModifySharedLinkSettingsError -const ( - ModifySharedLinkSettingsErrorSharedLinkNotFound = "shared_link_not_found" - ModifySharedLinkSettingsErrorSharedLinkAccessDenied = "shared_link_access_denied" - ModifySharedLinkSettingsErrorUnsupportedLinkType = "unsupported_link_type" - ModifySharedLinkSettingsErrorOther = "other" - ModifySharedLinkSettingsErrorSettingsError = "settings_error" - ModifySharedLinkSettingsErrorEmailNotVerified = "email_not_verified" -) - -// UnmarshalJSON deserializes into a ModifySharedLinkSettingsError instance -func (u *ModifySharedLinkSettingsError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // SettingsError : There is an error with the given settings. - SettingsError *SharedLinkSettingsError `json:"settings_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "settings_error": - u.SettingsError = w.SettingsError - - if err != nil { - return err - } - } - return nil -} - -// MountFolderArg : has no documentation (yet) -type MountFolderArg struct { - // SharedFolderId : The ID of the shared folder to mount. - SharedFolderId string `json:"shared_folder_id"` -} - -// NewMountFolderArg returns a new MountFolderArg instance -func NewMountFolderArg(SharedFolderId string) *MountFolderArg { - s := new(MountFolderArg) - s.SharedFolderId = SharedFolderId - return s -} - -// MountFolderError : has no documentation (yet) -type MountFolderError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // InsufficientQuota : The current user does not have enough space to mount - // the shared folder. - InsufficientQuota *InsufficientQuotaAmounts `json:"insufficient_quota,omitempty"` -} - -// Valid tag values for MountFolderError -const ( - MountFolderErrorAccessError = "access_error" - MountFolderErrorInsideSharedFolder = "inside_shared_folder" - MountFolderErrorInsufficientQuota = "insufficient_quota" - MountFolderErrorAlreadyMounted = "already_mounted" - MountFolderErrorNoPermission = "no_permission" - MountFolderErrorNotMountable = "not_mountable" - MountFolderErrorOther = "other" -) - -// UnmarshalJSON deserializes into a MountFolderError instance -func (u *MountFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "insufficient_quota": - err = json.Unmarshal(body, &u.InsufficientQuota) - - if err != nil { - return err - } - } - return nil -} - -// ParentFolderAccessInfo : Contains information about a parent folder that a -// member has access to. -type ParentFolderAccessInfo struct { - // FolderName : Display name for the folder. - FolderName string `json:"folder_name"` - // SharedFolderId : The identifier of the parent shared folder. - SharedFolderId string `json:"shared_folder_id"` - // Permissions : The user's permissions for the parent shared folder. - Permissions []*MemberPermission `json:"permissions"` - // Path : The full path to the parent shared folder relative to the acting - // user's root. - Path string `json:"path"` -} - -// NewParentFolderAccessInfo returns a new ParentFolderAccessInfo instance -func NewParentFolderAccessInfo(FolderName string, SharedFolderId string, Permissions []*MemberPermission, Path string) *ParentFolderAccessInfo { - s := new(ParentFolderAccessInfo) - s.FolderName = FolderName - s.SharedFolderId = SharedFolderId - s.Permissions = Permissions - s.Path = Path - return s -} - -// PathLinkMetadata : Metadata for a path-based shared link. -type PathLinkMetadata struct { - LinkMetadata - // Path : Path in user's Dropbox. - Path string `json:"path"` -} - -// NewPathLinkMetadata returns a new PathLinkMetadata instance -func NewPathLinkMetadata(Url string, Visibility *Visibility, Path string) *PathLinkMetadata { - s := new(PathLinkMetadata) - s.Url = Url - s.Visibility = Visibility - s.Path = Path - return s -} - -// PendingUploadMode : Flag to indicate pending upload default (for linking to -// not-yet-existing paths). -type PendingUploadMode struct { - dropbox.Tagged -} - -// Valid tag values for PendingUploadMode -const ( - PendingUploadModeFile = "file" - PendingUploadModeFolder = "folder" -) - -// PermissionDeniedReason : Possible reasons the user is denied a permission. -type PermissionDeniedReason struct { - dropbox.Tagged - // InsufficientPlan : has no documentation (yet) - InsufficientPlan *InsufficientPlan `json:"insufficient_plan,omitempty"` -} - -// Valid tag values for PermissionDeniedReason -const ( - PermissionDeniedReasonUserNotSameTeamAsOwner = "user_not_same_team_as_owner" - PermissionDeniedReasonUserNotAllowedByOwner = "user_not_allowed_by_owner" - PermissionDeniedReasonTargetIsIndirectMember = "target_is_indirect_member" - PermissionDeniedReasonTargetIsOwner = "target_is_owner" - PermissionDeniedReasonTargetIsSelf = "target_is_self" - PermissionDeniedReasonTargetNotActive = "target_not_active" - PermissionDeniedReasonFolderIsLimitedTeamFolder = "folder_is_limited_team_folder" - PermissionDeniedReasonOwnerNotOnTeam = "owner_not_on_team" - PermissionDeniedReasonPermissionDenied = "permission_denied" - PermissionDeniedReasonRestrictedByTeam = "restricted_by_team" - PermissionDeniedReasonUserAccountType = "user_account_type" - PermissionDeniedReasonUserNotOnTeam = "user_not_on_team" - PermissionDeniedReasonFolderIsInsideSharedFolder = "folder_is_inside_shared_folder" - PermissionDeniedReasonRestrictedByParentFolder = "restricted_by_parent_folder" - PermissionDeniedReasonInsufficientPlan = "insufficient_plan" - PermissionDeniedReasonOther = "other" -) - -// UnmarshalJSON deserializes into a PermissionDeniedReason instance -func (u *PermissionDeniedReason) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "insufficient_plan": - err = json.Unmarshal(body, &u.InsufficientPlan) - - if err != nil { - return err - } - } - return nil -} - -// RelinquishFileMembershipArg : has no documentation (yet) -type RelinquishFileMembershipArg struct { - // File : The path or id for the file. - File string `json:"file"` -} - -// NewRelinquishFileMembershipArg returns a new RelinquishFileMembershipArg instance -func NewRelinquishFileMembershipArg(File string) *RelinquishFileMembershipArg { - s := new(RelinquishFileMembershipArg) - s.File = File - return s -} - -// RelinquishFileMembershipError : has no documentation (yet) -type RelinquishFileMembershipError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for RelinquishFileMembershipError -const ( - RelinquishFileMembershipErrorAccessError = "access_error" - RelinquishFileMembershipErrorGroupAccess = "group_access" - RelinquishFileMembershipErrorNoPermission = "no_permission" - RelinquishFileMembershipErrorOther = "other" -) - -// UnmarshalJSON deserializes into a RelinquishFileMembershipError instance -func (u *RelinquishFileMembershipError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// RelinquishFolderMembershipArg : has no documentation (yet) -type RelinquishFolderMembershipArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // LeaveACopy : Keep a copy of the folder's contents upon relinquishing - // membership. - LeaveACopy bool `json:"leave_a_copy"` -} - -// NewRelinquishFolderMembershipArg returns a new RelinquishFolderMembershipArg instance -func NewRelinquishFolderMembershipArg(SharedFolderId string) *RelinquishFolderMembershipArg { - s := new(RelinquishFolderMembershipArg) - s.SharedFolderId = SharedFolderId - s.LeaveACopy = false - return s -} - -// RelinquishFolderMembershipError : has no documentation (yet) -type RelinquishFolderMembershipError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for RelinquishFolderMembershipError -const ( - RelinquishFolderMembershipErrorAccessError = "access_error" - RelinquishFolderMembershipErrorFolderOwner = "folder_owner" - RelinquishFolderMembershipErrorMounted = "mounted" - RelinquishFolderMembershipErrorGroupAccess = "group_access" - RelinquishFolderMembershipErrorTeamFolder = "team_folder" - RelinquishFolderMembershipErrorNoPermission = "no_permission" - RelinquishFolderMembershipErrorNoExplicitAccess = "no_explicit_access" - RelinquishFolderMembershipErrorOther = "other" -) - -// UnmarshalJSON deserializes into a RelinquishFolderMembershipError instance -func (u *RelinquishFolderMembershipError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// RemoveFileMemberArg : Arguments for `removeFileMember2`. -type RemoveFileMemberArg struct { - // File : File from which to remove members. - File string `json:"file"` - // Member : Member to remove from this file. Note that even if an email is - // specified, it may result in the removal of a user (not an invitee) if the - // user's main account corresponds to that email address. - Member *MemberSelector `json:"member"` -} - -// NewRemoveFileMemberArg returns a new RemoveFileMemberArg instance -func NewRemoveFileMemberArg(File string, Member *MemberSelector) *RemoveFileMemberArg { - s := new(RemoveFileMemberArg) - s.File = File - s.Member = Member - return s -} - -// RemoveFileMemberError : Errors for `removeFileMember2`. -type RemoveFileMemberError struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - // NoExplicitAccess : This member does not have explicit access to the file - // and therefore cannot be removed. The return value is the access that a - // user might have to the file from a parent folder. - NoExplicitAccess *MemberAccessLevelResult `json:"no_explicit_access,omitempty"` -} - -// Valid tag values for RemoveFileMemberError -const ( - RemoveFileMemberErrorUserError = "user_error" - RemoveFileMemberErrorAccessError = "access_error" - RemoveFileMemberErrorNoExplicitAccess = "no_explicit_access" - RemoveFileMemberErrorOther = "other" -) - -// UnmarshalJSON deserializes into a RemoveFileMemberError instance -func (u *RemoveFileMemberError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "no_explicit_access": - err = json.Unmarshal(body, &u.NoExplicitAccess) - - if err != nil { - return err - } - } - return nil -} - -// RemoveFolderMemberArg : has no documentation (yet) -type RemoveFolderMemberArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // Member : The member to remove from the folder. - Member *MemberSelector `json:"member"` - // LeaveACopy : If true, the removed user will keep their copy of the folder - // after it's unshared, assuming it was mounted. Otherwise, it will be - // removed from their Dropbox. Also, this must be set to false when kicking - // a group. - LeaveACopy bool `json:"leave_a_copy"` -} - -// NewRemoveFolderMemberArg returns a new RemoveFolderMemberArg instance -func NewRemoveFolderMemberArg(SharedFolderId string, Member *MemberSelector, LeaveACopy bool) *RemoveFolderMemberArg { - s := new(RemoveFolderMemberArg) - s.SharedFolderId = SharedFolderId - s.Member = Member - s.LeaveACopy = LeaveACopy - return s -} - -// RemoveFolderMemberError : has no documentation (yet) -type RemoveFolderMemberError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // MemberError : has no documentation (yet) - MemberError *SharedFolderMemberError `json:"member_error,omitempty"` -} - -// Valid tag values for RemoveFolderMemberError -const ( - RemoveFolderMemberErrorAccessError = "access_error" - RemoveFolderMemberErrorMemberError = "member_error" - RemoveFolderMemberErrorFolderOwner = "folder_owner" - RemoveFolderMemberErrorGroupAccess = "group_access" - RemoveFolderMemberErrorTeamFolder = "team_folder" - RemoveFolderMemberErrorNoPermission = "no_permission" - RemoveFolderMemberErrorTooManyFiles = "too_many_files" - RemoveFolderMemberErrorOther = "other" -) - -// UnmarshalJSON deserializes into a RemoveFolderMemberError instance -func (u *RemoveFolderMemberError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // MemberError : has no documentation (yet) - MemberError *SharedFolderMemberError `json:"member_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "member_error": - u.MemberError = w.MemberError - - if err != nil { - return err - } - } - return nil -} - -// RemoveMemberJobStatus : has no documentation (yet) -type RemoveMemberJobStatus struct { - dropbox.Tagged - // Complete : Removing the folder member has finished. The value is - // information about whether the member has another form of access. - Complete *MemberAccessLevelResult `json:"complete,omitempty"` - // Failed : has no documentation (yet) - Failed *RemoveFolderMemberError `json:"failed,omitempty"` -} - -// Valid tag values for RemoveMemberJobStatus -const ( - RemoveMemberJobStatusInProgress = "in_progress" - RemoveMemberJobStatusComplete = "complete" - RemoveMemberJobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a RemoveMemberJobStatus instance -func (u *RemoveMemberJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : has no documentation (yet) - Failed *RemoveFolderMemberError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// RequestedLinkAccessLevel : has no documentation (yet) -type RequestedLinkAccessLevel struct { - dropbox.Tagged -} - -// Valid tag values for RequestedLinkAccessLevel -const ( - RequestedLinkAccessLevelViewer = "viewer" - RequestedLinkAccessLevelEditor = "editor" - RequestedLinkAccessLevelMax = "max" - RequestedLinkAccessLevelOther = "other" -) - -// RequestedVisibility : The access permission that can be requested by the -// caller for the shared link. Note that the final resolved visibility of the -// shared link takes into account other aspects, such as team and shared folder -// settings. Check the `ResolvedVisibility` for more info on the possible -// resolved visibility values of shared links. -type RequestedVisibility struct { - dropbox.Tagged -} - -// Valid tag values for RequestedVisibility -const ( - RequestedVisibilityPublic = "public" - RequestedVisibilityTeamOnly = "team_only" - RequestedVisibilityPassword = "password" -) - -// ResolvedVisibility : The actual access permissions values of shared links -// after taking into account user preferences and the team and shared folder -// settings. Check the `RequestedVisibility` for more info on the possible -// visibility values that can be set by the shared link's owner. -type ResolvedVisibility struct { - dropbox.Tagged -} - -// Valid tag values for ResolvedVisibility -const ( - ResolvedVisibilityPublic = "public" - ResolvedVisibilityTeamOnly = "team_only" - ResolvedVisibilityPassword = "password" - ResolvedVisibilityTeamAndPassword = "team_and_password" - ResolvedVisibilitySharedFolderOnly = "shared_folder_only" - ResolvedVisibilityOther = "other" -) - -// RevokeSharedLinkArg : has no documentation (yet) -type RevokeSharedLinkArg struct { - // Url : URL of the shared link. - Url string `json:"url"` -} - -// NewRevokeSharedLinkArg returns a new RevokeSharedLinkArg instance -func NewRevokeSharedLinkArg(Url string) *RevokeSharedLinkArg { - s := new(RevokeSharedLinkArg) - s.Url = Url - return s -} - -// RevokeSharedLinkError : has no documentation (yet) -type RevokeSharedLinkError struct { - dropbox.Tagged -} - -// Valid tag values for RevokeSharedLinkError -const ( - RevokeSharedLinkErrorSharedLinkNotFound = "shared_link_not_found" - RevokeSharedLinkErrorSharedLinkAccessDenied = "shared_link_access_denied" - RevokeSharedLinkErrorUnsupportedLinkType = "unsupported_link_type" - RevokeSharedLinkErrorOther = "other" - RevokeSharedLinkErrorSharedLinkMalformed = "shared_link_malformed" -) - -// SetAccessInheritanceArg : has no documentation (yet) -type SetAccessInheritanceArg struct { - // AccessInheritance : The access inheritance settings for the folder. - AccessInheritance *AccessInheritance `json:"access_inheritance"` - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` -} - -// NewSetAccessInheritanceArg returns a new SetAccessInheritanceArg instance -func NewSetAccessInheritanceArg(SharedFolderId string) *SetAccessInheritanceArg { - s := new(SetAccessInheritanceArg) - s.SharedFolderId = SharedFolderId - s.AccessInheritance = &AccessInheritance{Tagged: dropbox.Tagged{"inherit"}} - return s -} - -// SetAccessInheritanceError : has no documentation (yet) -type SetAccessInheritanceError struct { - dropbox.Tagged - // AccessError : Unable to access shared folder. - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for SetAccessInheritanceError -const ( - SetAccessInheritanceErrorAccessError = "access_error" - SetAccessInheritanceErrorNoPermission = "no_permission" - SetAccessInheritanceErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SetAccessInheritanceError instance -func (u *SetAccessInheritanceError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : Unable to access shared folder. - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// ShareFolderArgBase : has no documentation (yet) -type ShareFolderArgBase struct { - // AclUpdatePolicy : Who can add and remove members of this shared folder. - AclUpdatePolicy *AclUpdatePolicy `json:"acl_update_policy,omitempty"` - // ForceAsync : Whether to force the share to happen asynchronously. - ForceAsync bool `json:"force_async"` - // MemberPolicy : Who can be a member of this shared folder. Only applicable - // if the current user is on a team. - MemberPolicy *MemberPolicy `json:"member_policy,omitempty"` - // Path : The path to the folder to share. If it does not exist, then a new - // one is created. - Path string `json:"path"` - // SharedLinkPolicy : The policy to apply to shared links created for - // content inside this shared folder. The current user must be on a team to - // set this policy to `SharedLinkPolicy.members`. - SharedLinkPolicy *SharedLinkPolicy `json:"shared_link_policy,omitempty"` - // ViewerInfoPolicy : Who can enable/disable viewer info for this shared - // folder. - ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"` - // AccessInheritance : The access inheritance settings for the folder. - AccessInheritance *AccessInheritance `json:"access_inheritance"` -} - -// NewShareFolderArgBase returns a new ShareFolderArgBase instance -func NewShareFolderArgBase(Path string) *ShareFolderArgBase { - s := new(ShareFolderArgBase) - s.Path = Path - s.ForceAsync = false - s.AccessInheritance = &AccessInheritance{Tagged: dropbox.Tagged{"inherit"}} - return s -} - -// ShareFolderArg : has no documentation (yet) -type ShareFolderArg struct { - ShareFolderArgBase - // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s - // that should appear in the response's `SharedFolderMetadata.permissions` - // field describing the actions the authenticated user can perform on the - // folder. - Actions []*FolderAction `json:"actions,omitempty"` - // LinkSettings : Settings on the link for this folder. - LinkSettings *LinkSettings `json:"link_settings,omitempty"` -} - -// NewShareFolderArg returns a new ShareFolderArg instance -func NewShareFolderArg(Path string) *ShareFolderArg { - s := new(ShareFolderArg) - s.Path = Path - s.ForceAsync = false - s.AccessInheritance = &AccessInheritance{Tagged: dropbox.Tagged{"inherit"}} - return s -} - -// ShareFolderErrorBase : has no documentation (yet) -type ShareFolderErrorBase struct { - dropbox.Tagged - // BadPath : `ShareFolderArg.path` is invalid. - BadPath *SharePathError `json:"bad_path,omitempty"` -} - -// Valid tag values for ShareFolderErrorBase -const ( - ShareFolderErrorBaseEmailUnverified = "email_unverified" - ShareFolderErrorBaseBadPath = "bad_path" - ShareFolderErrorBaseTeamPolicyDisallowsMemberPolicy = "team_policy_disallows_member_policy" - ShareFolderErrorBaseDisallowedSharedLinkPolicy = "disallowed_shared_link_policy" - ShareFolderErrorBaseOther = "other" -) - -// UnmarshalJSON deserializes into a ShareFolderErrorBase instance -func (u *ShareFolderErrorBase) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // BadPath : `ShareFolderArg.path` is invalid. - BadPath *SharePathError `json:"bad_path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "bad_path": - u.BadPath = w.BadPath - - if err != nil { - return err - } - } - return nil -} - -// ShareFolderError : has no documentation (yet) -type ShareFolderError struct { - dropbox.Tagged - // BadPath : `ShareFolderArg.path` is invalid. - BadPath *SharePathError `json:"bad_path,omitempty"` -} - -// Valid tag values for ShareFolderError -const ( - ShareFolderErrorEmailUnverified = "email_unverified" - ShareFolderErrorBadPath = "bad_path" - ShareFolderErrorTeamPolicyDisallowsMemberPolicy = "team_policy_disallows_member_policy" - ShareFolderErrorDisallowedSharedLinkPolicy = "disallowed_shared_link_policy" - ShareFolderErrorOther = "other" - ShareFolderErrorNoPermission = "no_permission" -) - -// UnmarshalJSON deserializes into a ShareFolderError instance -func (u *ShareFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // BadPath : `ShareFolderArg.path` is invalid. - BadPath *SharePathError `json:"bad_path,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "bad_path": - u.BadPath = w.BadPath - - if err != nil { - return err - } - } - return nil -} - -// ShareFolderJobStatus : has no documentation (yet) -type ShareFolderJobStatus struct { - dropbox.Tagged - // Complete : The share job has finished. The value is the metadata for the - // folder. - Complete *SharedFolderMetadata `json:"complete,omitempty"` - // Failed : has no documentation (yet) - Failed *ShareFolderError `json:"failed,omitempty"` -} - -// Valid tag values for ShareFolderJobStatus -const ( - ShareFolderJobStatusInProgress = "in_progress" - ShareFolderJobStatusComplete = "complete" - ShareFolderJobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a ShareFolderJobStatus instance -func (u *ShareFolderJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : has no documentation (yet) - Failed *ShareFolderError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// ShareFolderLaunch : has no documentation (yet) -type ShareFolderLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *SharedFolderMetadata `json:"complete,omitempty"` -} - -// Valid tag values for ShareFolderLaunch -const ( - ShareFolderLaunchAsyncJobId = "async_job_id" - ShareFolderLaunchComplete = "complete" -) - -// UnmarshalJSON deserializes into a ShareFolderLaunch instance -func (u *ShareFolderLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// SharePathError : has no documentation (yet) -type SharePathError struct { - dropbox.Tagged - // AlreadyShared : Folder is already shared. Contains metadata about the - // existing shared folder. - AlreadyShared *SharedFolderMetadata `json:"already_shared,omitempty"` -} - -// Valid tag values for SharePathError -const ( - SharePathErrorIsFile = "is_file" - SharePathErrorInsideSharedFolder = "inside_shared_folder" - SharePathErrorContainsSharedFolder = "contains_shared_folder" - SharePathErrorContainsAppFolder = "contains_app_folder" - SharePathErrorContainsTeamFolder = "contains_team_folder" - SharePathErrorIsAppFolder = "is_app_folder" - SharePathErrorInsideAppFolder = "inside_app_folder" - SharePathErrorIsPublicFolder = "is_public_folder" - SharePathErrorInsidePublicFolder = "inside_public_folder" - SharePathErrorAlreadyShared = "already_shared" - SharePathErrorInvalidPath = "invalid_path" - SharePathErrorIsOsxPackage = "is_osx_package" - SharePathErrorInsideOsxPackage = "inside_osx_package" - SharePathErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SharePathError instance -func (u *SharePathError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "already_shared": - err = json.Unmarshal(body, &u.AlreadyShared) - - if err != nil { - return err - } - } - return nil -} - -// SharedContentLinkMetadata : Metadata of a shared link for a file or folder. -type SharedContentLinkMetadata struct { - SharedContentLinkMetadataBase - // AudienceExceptions : The content inside this folder with link audience - // different than this folder's. This is only returned when an endpoint that - // returns metadata for a single shared folder is called, e.g. - // /get_folder_metadata. - AudienceExceptions *AudienceExceptions `json:"audience_exceptions,omitempty"` - // Url : The URL of the link. - Url string `json:"url"` -} - -// NewSharedContentLinkMetadata returns a new SharedContentLinkMetadata instance -func NewSharedContentLinkMetadata(AudienceOptions []*LinkAudience, CurrentAudience *LinkAudience, LinkPermissions []*LinkPermission, PasswordProtected bool, Url string) *SharedContentLinkMetadata { - s := new(SharedContentLinkMetadata) - s.AudienceOptions = AudienceOptions - s.CurrentAudience = CurrentAudience - s.LinkPermissions = LinkPermissions - s.PasswordProtected = PasswordProtected - s.Url = Url - return s -} - -// SharedFileMembers : Shared file user, group, and invitee membership. Used for -// the results of `listFileMembers` and `listFileMembersContinue`, and used as -// part of the results for `listFileMembersBatch`. -type SharedFileMembers struct { - // Users : The list of user members of the shared file. - Users []*UserFileMembershipInfo `json:"users"` - // Groups : The list of group members of the shared file. - Groups []*GroupMembershipInfo `json:"groups"` - // Invitees : The list of invited members of a file, but have not logged in - // and claimed this. - Invitees []*InviteeMembershipInfo `json:"invitees"` - // Cursor : Present if there are additional shared file members that have - // not been returned yet. Pass the cursor into `listFileMembersContinue` to - // list additional members. - Cursor string `json:"cursor,omitempty"` -} - -// NewSharedFileMembers returns a new SharedFileMembers instance -func NewSharedFileMembers(Users []*UserFileMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFileMembers { - s := new(SharedFileMembers) - s.Users = Users - s.Groups = Groups - s.Invitees = Invitees - return s -} - -// SharedFileMetadata : Properties of the shared file. -type SharedFileMetadata struct { - // AccessType : The current user's access level for this shared file. - AccessType *AccessLevel `json:"access_type,omitempty"` - // Id : The ID of the file. - Id string `json:"id"` - // ExpectedLinkMetadata : The expected metadata of the link associated for - // the file when it is first shared. Absent if the link already exists. This - // is for an unreleased feature so it may not be returned yet. - ExpectedLinkMetadata *ExpectedSharedContentLinkMetadata `json:"expected_link_metadata,omitempty"` - // LinkMetadata : The metadata of the link associated for the file. This is - // for an unreleased feature so it may not be returned yet. - LinkMetadata *SharedContentLinkMetadata `json:"link_metadata,omitempty"` - // Name : The name of this file. - Name string `json:"name"` - // OwnerDisplayNames : The display names of the users that own the file. If - // the file is part of a team folder, the display names of the team admins - // are also included. Absent if the owner display names cannot be fetched. - OwnerDisplayNames []string `json:"owner_display_names,omitempty"` - // OwnerTeam : The team that owns the file. This field is not present if the - // file is not owned by a team. - OwnerTeam *users.Team `json:"owner_team,omitempty"` - // ParentSharedFolderId : The ID of the parent shared folder. This field is - // present only if the file is contained within a shared folder. - ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` - // PathDisplay : The cased path to be used for display purposes only. In - // rare instances the casing will not correctly match the user's filesystem, - // but this behavior will match the path provided in the Core API v1. Absent - // for unmounted files. - PathDisplay string `json:"path_display,omitempty"` - // PathLower : The lower-case full path of this file. Absent for unmounted - // files. - PathLower string `json:"path_lower,omitempty"` - // Permissions : The sharing permissions that requesting user has on this - // file. This corresponds to the entries given in - // `GetFileMetadataBatchArg.actions` or `GetFileMetadataArg.actions`. - Permissions []*FilePermission `json:"permissions,omitempty"` - // Policy : Policies governing this shared file. - Policy *FolderPolicy `json:"policy"` - // PreviewUrl : URL for displaying a web preview of the shared file. - PreviewUrl string `json:"preview_url"` - // TimeInvited : Timestamp indicating when the current user was invited to - // this shared file. If the user was not invited to the shared file, the - // timestamp will indicate when the user was invited to the parent shared - // folder. This value may be absent. - TimeInvited time.Time `json:"time_invited,omitempty"` -} - -// NewSharedFileMetadata returns a new SharedFileMetadata instance -func NewSharedFileMetadata(Id string, Name string, Policy *FolderPolicy, PreviewUrl string) *SharedFileMetadata { - s := new(SharedFileMetadata) - s.Id = Id - s.Name = Name - s.Policy = Policy - s.PreviewUrl = PreviewUrl - return s -} - -// SharedFolderAccessError : There is an error accessing the shared folder. -type SharedFolderAccessError struct { - dropbox.Tagged -} - -// Valid tag values for SharedFolderAccessError -const ( - SharedFolderAccessErrorInvalidId = "invalid_id" - SharedFolderAccessErrorNotAMember = "not_a_member" - SharedFolderAccessErrorEmailUnverified = "email_unverified" - SharedFolderAccessErrorUnmounted = "unmounted" - SharedFolderAccessErrorOther = "other" -) - -// SharedFolderMemberError : has no documentation (yet) -type SharedFolderMemberError struct { - dropbox.Tagged - // NoExplicitAccess : The target member only has inherited access to the - // shared folder. - NoExplicitAccess *MemberAccessLevelResult `json:"no_explicit_access,omitempty"` -} - -// Valid tag values for SharedFolderMemberError -const ( - SharedFolderMemberErrorInvalidDropboxId = "invalid_dropbox_id" - SharedFolderMemberErrorNotAMember = "not_a_member" - SharedFolderMemberErrorNoExplicitAccess = "no_explicit_access" - SharedFolderMemberErrorOther = "other" -) - -// UnmarshalJSON deserializes into a SharedFolderMemberError instance -func (u *SharedFolderMemberError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "no_explicit_access": - err = json.Unmarshal(body, &u.NoExplicitAccess) - - if err != nil { - return err - } - } - return nil -} - -// SharedFolderMembers : Shared folder user and group membership. -type SharedFolderMembers struct { - // Users : The list of user members of the shared folder. - Users []*UserMembershipInfo `json:"users"` - // Groups : The list of group members of the shared folder. - Groups []*GroupMembershipInfo `json:"groups"` - // Invitees : The list of invitees to the shared folder. - Invitees []*InviteeMembershipInfo `json:"invitees"` - // Cursor : Present if there are additional shared folder members that have - // not been returned yet. Pass the cursor into `listFolderMembersContinue` - // to list additional members. - Cursor string `json:"cursor,omitempty"` -} - -// NewSharedFolderMembers returns a new SharedFolderMembers instance -func NewSharedFolderMembers(Users []*UserMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFolderMembers { - s := new(SharedFolderMembers) - s.Users = Users - s.Groups = Groups - s.Invitees = Invitees - return s -} - -// SharedFolderMetadataBase : Properties of the shared folder. -type SharedFolderMetadataBase struct { - // AccessType : The current user's access level for this shared folder. - AccessType *AccessLevel `json:"access_type"` - // IsInsideTeamFolder : Whether this folder is inside of a team folder. - IsInsideTeamFolder bool `json:"is_inside_team_folder"` - // IsTeamFolder : Whether this folder is a `team folder` - // . - IsTeamFolder bool `json:"is_team_folder"` - // OwnerDisplayNames : The display names of the users that own the folder. - // If the folder is part of a team folder, the display names of the team - // admins are also included. Absent if the owner display names cannot be - // fetched. - OwnerDisplayNames []string `json:"owner_display_names,omitempty"` - // OwnerTeam : The team that owns the folder. This field is not present if - // the folder is not owned by a team. - OwnerTeam *users.Team `json:"owner_team,omitempty"` - // ParentSharedFolderId : The ID of the parent shared folder. This field is - // present only if the folder is contained within another shared folder. - ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` - // PathLower : The lower-cased full path of this shared folder. Absent for - // unmounted folders. - PathLower string `json:"path_lower,omitempty"` -} - -// NewSharedFolderMetadataBase returns a new SharedFolderMetadataBase instance -func NewSharedFolderMetadataBase(AccessType *AccessLevel, IsInsideTeamFolder bool, IsTeamFolder bool) *SharedFolderMetadataBase { - s := new(SharedFolderMetadataBase) - s.AccessType = AccessType - s.IsInsideTeamFolder = IsInsideTeamFolder - s.IsTeamFolder = IsTeamFolder - return s -} - -// SharedFolderMetadata : The metadata which includes basic information about -// the shared folder. -type SharedFolderMetadata struct { - SharedFolderMetadataBase - // LinkMetadata : The metadata of the shared content link to this shared - // folder. Absent if there is no link on the folder. This is for an - // unreleased feature so it may not be returned yet. - LinkMetadata *SharedContentLinkMetadata `json:"link_metadata,omitempty"` - // Name : The name of the this shared folder. - Name string `json:"name"` - // Permissions : Actions the current user may perform on the folder and its - // contents. The set of permissions corresponds to the FolderActions in the - // request. - Permissions []*FolderPermission `json:"permissions,omitempty"` - // Policy : Policies governing this shared folder. - Policy *FolderPolicy `json:"policy"` - // PreviewUrl : URL for displaying a web preview of the shared folder. - PreviewUrl string `json:"preview_url"` - // SharedFolderId : The ID of the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // TimeInvited : Timestamp indicating when the current user was invited to - // this shared folder. - TimeInvited time.Time `json:"time_invited"` - // AccessInheritance : Whether the folder inherits its members from its - // parent. - AccessInheritance *AccessInheritance `json:"access_inheritance"` -} - -// NewSharedFolderMetadata returns a new SharedFolderMetadata instance -func NewSharedFolderMetadata(AccessType *AccessLevel, IsInsideTeamFolder bool, IsTeamFolder bool, Name string, Policy *FolderPolicy, PreviewUrl string, SharedFolderId string, TimeInvited time.Time) *SharedFolderMetadata { - s := new(SharedFolderMetadata) - s.AccessType = AccessType - s.IsInsideTeamFolder = IsInsideTeamFolder - s.IsTeamFolder = IsTeamFolder - s.Name = Name - s.Policy = Policy - s.PreviewUrl = PreviewUrl - s.SharedFolderId = SharedFolderId - s.TimeInvited = TimeInvited - s.AccessInheritance = &AccessInheritance{Tagged: dropbox.Tagged{"inherit"}} - return s -} - -// SharedLinkAccessFailureReason : has no documentation (yet) -type SharedLinkAccessFailureReason struct { - dropbox.Tagged -} - -// Valid tag values for SharedLinkAccessFailureReason -const ( - SharedLinkAccessFailureReasonLoginRequired = "login_required" - SharedLinkAccessFailureReasonEmailVerifyRequired = "email_verify_required" - SharedLinkAccessFailureReasonPasswordRequired = "password_required" - SharedLinkAccessFailureReasonTeamOnly = "team_only" - SharedLinkAccessFailureReasonOwnerOnly = "owner_only" - SharedLinkAccessFailureReasonOther = "other" -) - -// SharedLinkAlreadyExistsMetadata : has no documentation (yet) -type SharedLinkAlreadyExistsMetadata struct { - dropbox.Tagged - // Metadata : Metadata of the shared link that already exists. - Metadata IsSharedLinkMetadata `json:"metadata,omitempty"` -} - -// Valid tag values for SharedLinkAlreadyExistsMetadata -const ( - SharedLinkAlreadyExistsMetadataMetadata = "metadata" - SharedLinkAlreadyExistsMetadataOther = "other" -) - -// UnmarshalJSON deserializes into a SharedLinkAlreadyExistsMetadata instance -func (u *SharedLinkAlreadyExistsMetadata) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Metadata : Metadata of the shared link that already exists. - Metadata json.RawMessage `json:"metadata,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "metadata": - u.Metadata, err = IsSharedLinkMetadataFromJSON(w.Metadata) - - if err != nil { - return err - } - } - return nil -} - -// SharedLinkPolicy : Who can view shared links in this folder. -type SharedLinkPolicy struct { - dropbox.Tagged -} - -// Valid tag values for SharedLinkPolicy -const ( - SharedLinkPolicyAnyone = "anyone" - SharedLinkPolicyTeam = "team" - SharedLinkPolicyMembers = "members" - SharedLinkPolicyOther = "other" -) - -// SharedLinkSettings : has no documentation (yet) -type SharedLinkSettings struct { - // RequestedVisibility : The requested access for this shared link. - RequestedVisibility *RequestedVisibility `json:"requested_visibility,omitempty"` - // LinkPassword : If `requested_visibility` is - // `RequestedVisibility.password` this is needed to specify the password to - // access the link. - LinkPassword string `json:"link_password,omitempty"` - // Expires : Expiration time of the shared link. By default the link won't - // expire. - Expires time.Time `json:"expires,omitempty"` - // Audience : The new audience who can benefit from the access level - // specified by the link's access level specified in the `link_access_level` - // field of `LinkPermissions`. This is used in conjunction with team - // policies and shared folder policies to determine the final effective - // audience type in the `effective_audience` field of `LinkPermissions. - Audience *LinkAudience `json:"audience,omitempty"` - // Access : Requested access level you want the audience to gain from this - // link. - Access *RequestedLinkAccessLevel `json:"access,omitempty"` -} - -// NewSharedLinkSettings returns a new SharedLinkSettings instance -func NewSharedLinkSettings() *SharedLinkSettings { - s := new(SharedLinkSettings) - return s -} - -// SharedLinkSettingsError : has no documentation (yet) -type SharedLinkSettingsError struct { - dropbox.Tagged -} - -// Valid tag values for SharedLinkSettingsError -const ( - SharedLinkSettingsErrorInvalidSettings = "invalid_settings" - SharedLinkSettingsErrorNotAuthorized = "not_authorized" -) - -// SharingFileAccessError : User could not access this file. -type SharingFileAccessError struct { - dropbox.Tagged -} - -// Valid tag values for SharingFileAccessError -const ( - SharingFileAccessErrorNoPermission = "no_permission" - SharingFileAccessErrorInvalidFile = "invalid_file" - SharingFileAccessErrorIsFolder = "is_folder" - SharingFileAccessErrorInsidePublicFolder = "inside_public_folder" - SharingFileAccessErrorInsideOsxPackage = "inside_osx_package" - SharingFileAccessErrorOther = "other" -) - -// SharingUserError : User account had a problem preventing this action. -type SharingUserError struct { - dropbox.Tagged -} - -// Valid tag values for SharingUserError -const ( - SharingUserErrorEmailUnverified = "email_unverified" - SharingUserErrorOther = "other" -) - -// TeamMemberInfo : Information about a team member. -type TeamMemberInfo struct { - // TeamInfo : Information about the member's team. - TeamInfo *users.Team `json:"team_info"` - // DisplayName : The display name of the user. - DisplayName string `json:"display_name"` - // MemberId : ID of user as a member of a team. This field will only be - // present if the member is in the same team as current user. - MemberId string `json:"member_id,omitempty"` -} - -// NewTeamMemberInfo returns a new TeamMemberInfo instance -func NewTeamMemberInfo(TeamInfo *users.Team, DisplayName string) *TeamMemberInfo { - s := new(TeamMemberInfo) - s.TeamInfo = TeamInfo - s.DisplayName = DisplayName - return s -} - -// TransferFolderArg : has no documentation (yet) -type TransferFolderArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // ToDropboxId : A account or team member ID to transfer ownership to. - ToDropboxId string `json:"to_dropbox_id"` -} - -// NewTransferFolderArg returns a new TransferFolderArg instance -func NewTransferFolderArg(SharedFolderId string, ToDropboxId string) *TransferFolderArg { - s := new(TransferFolderArg) - s.SharedFolderId = SharedFolderId - s.ToDropboxId = ToDropboxId - return s -} - -// TransferFolderError : has no documentation (yet) -type TransferFolderError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for TransferFolderError -const ( - TransferFolderErrorAccessError = "access_error" - TransferFolderErrorInvalidDropboxId = "invalid_dropbox_id" - TransferFolderErrorNewOwnerNotAMember = "new_owner_not_a_member" - TransferFolderErrorNewOwnerUnmounted = "new_owner_unmounted" - TransferFolderErrorNewOwnerEmailUnverified = "new_owner_email_unverified" - TransferFolderErrorTeamFolder = "team_folder" - TransferFolderErrorNoPermission = "no_permission" - TransferFolderErrorOther = "other" -) - -// UnmarshalJSON deserializes into a TransferFolderError instance -func (u *TransferFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// UnmountFolderArg : has no documentation (yet) -type UnmountFolderArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` -} - -// NewUnmountFolderArg returns a new UnmountFolderArg instance -func NewUnmountFolderArg(SharedFolderId string) *UnmountFolderArg { - s := new(UnmountFolderArg) - s.SharedFolderId = SharedFolderId - return s -} - -// UnmountFolderError : has no documentation (yet) -type UnmountFolderError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for UnmountFolderError -const ( - UnmountFolderErrorAccessError = "access_error" - UnmountFolderErrorNoPermission = "no_permission" - UnmountFolderErrorNotUnmountable = "not_unmountable" - UnmountFolderErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UnmountFolderError instance -func (u *UnmountFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// UnshareFileArg : Arguments for `unshareFile`. -type UnshareFileArg struct { - // File : The file to unshare. - File string `json:"file"` -} - -// NewUnshareFileArg returns a new UnshareFileArg instance -func NewUnshareFileArg(File string) *UnshareFileArg { - s := new(UnshareFileArg) - s.File = File - return s -} - -// UnshareFileError : Error result for `unshareFile`. -type UnshareFileError struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for UnshareFileError -const ( - UnshareFileErrorUserError = "user_error" - UnshareFileErrorAccessError = "access_error" - UnshareFileErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UnshareFileError instance -func (u *UnshareFileError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UserError : has no documentation (yet) - UserError *SharingUserError `json:"user_error,omitempty"` - // AccessError : has no documentation (yet) - AccessError *SharingFileAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "user_error": - u.UserError = w.UserError - - if err != nil { - return err - } - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// UnshareFolderArg : has no documentation (yet) -type UnshareFolderArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // LeaveACopy : If true, members of this shared folder will get a copy of - // this folder after it's unshared. Otherwise, it will be removed from their - // Dropbox. The current user, who is an owner, will always retain their - // copy. - LeaveACopy bool `json:"leave_a_copy"` -} - -// NewUnshareFolderArg returns a new UnshareFolderArg instance -func NewUnshareFolderArg(SharedFolderId string) *UnshareFolderArg { - s := new(UnshareFolderArg) - s.SharedFolderId = SharedFolderId - s.LeaveACopy = false - return s -} - -// UnshareFolderError : has no documentation (yet) -type UnshareFolderError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for UnshareFolderError -const ( - UnshareFolderErrorAccessError = "access_error" - UnshareFolderErrorTeamFolder = "team_folder" - UnshareFolderErrorNoPermission = "no_permission" - UnshareFolderErrorTooManyFiles = "too_many_files" - UnshareFolderErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UnshareFolderError instance -func (u *UnshareFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// UpdateFileMemberArgs : Arguments for `updateFileMember`. -type UpdateFileMemberArgs struct { - ChangeFileMemberAccessArgs -} - -// NewUpdateFileMemberArgs returns a new UpdateFileMemberArgs instance -func NewUpdateFileMemberArgs(File string, Member *MemberSelector, AccessLevel *AccessLevel) *UpdateFileMemberArgs { - s := new(UpdateFileMemberArgs) - s.File = File - s.Member = Member - s.AccessLevel = AccessLevel - return s -} - -// UpdateFolderMemberArg : has no documentation (yet) -type UpdateFolderMemberArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // Member : The member of the shared folder to update. Only the - // `MemberSelector.dropbox_id` may be set at this time. - Member *MemberSelector `json:"member"` - // AccessLevel : The new access level for `member`. `AccessLevel.owner` is - // disallowed. - AccessLevel *AccessLevel `json:"access_level"` -} - -// NewUpdateFolderMemberArg returns a new UpdateFolderMemberArg instance -func NewUpdateFolderMemberArg(SharedFolderId string, Member *MemberSelector, AccessLevel *AccessLevel) *UpdateFolderMemberArg { - s := new(UpdateFolderMemberArg) - s.SharedFolderId = SharedFolderId - s.Member = Member - s.AccessLevel = AccessLevel - return s -} - -// UpdateFolderMemberError : has no documentation (yet) -type UpdateFolderMemberError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // MemberError : has no documentation (yet) - MemberError *SharedFolderMemberError `json:"member_error,omitempty"` - // NoExplicitAccess : If updating the access type required the member to be - // added to the shared folder and there was an error when adding the member. - NoExplicitAccess *AddFolderMemberError `json:"no_explicit_access,omitempty"` -} - -// Valid tag values for UpdateFolderMemberError -const ( - UpdateFolderMemberErrorAccessError = "access_error" - UpdateFolderMemberErrorMemberError = "member_error" - UpdateFolderMemberErrorNoExplicitAccess = "no_explicit_access" - UpdateFolderMemberErrorInsufficientPlan = "insufficient_plan" - UpdateFolderMemberErrorNoPermission = "no_permission" - UpdateFolderMemberErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UpdateFolderMemberError instance -func (u *UpdateFolderMemberError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - // MemberError : has no documentation (yet) - MemberError *SharedFolderMemberError `json:"member_error,omitempty"` - // NoExplicitAccess : If updating the access type required the member to - // be added to the shared folder and there was an error when adding the - // member. - NoExplicitAccess *AddFolderMemberError `json:"no_explicit_access,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "member_error": - u.MemberError = w.MemberError - - if err != nil { - return err - } - case "no_explicit_access": - u.NoExplicitAccess = w.NoExplicitAccess - - if err != nil { - return err - } - } - return nil -} - -// UpdateFolderPolicyArg : If any of the policies are unset, then they retain -// their current setting. -type UpdateFolderPolicyArg struct { - // SharedFolderId : The ID for the shared folder. - SharedFolderId string `json:"shared_folder_id"` - // MemberPolicy : Who can be a member of this shared folder. Only applicable - // if the current user is on a team. - MemberPolicy *MemberPolicy `json:"member_policy,omitempty"` - // AclUpdatePolicy : Who can add and remove members of this shared folder. - AclUpdatePolicy *AclUpdatePolicy `json:"acl_update_policy,omitempty"` - // ViewerInfoPolicy : Who can enable/disable viewer info for this shared - // folder. - ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"` - // SharedLinkPolicy : The policy to apply to shared links created for - // content inside this shared folder. The current user must be on a team to - // set this policy to `SharedLinkPolicy.members`. - SharedLinkPolicy *SharedLinkPolicy `json:"shared_link_policy,omitempty"` - // LinkSettings : Settings on the link for this folder. - LinkSettings *LinkSettings `json:"link_settings,omitempty"` - // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s - // that should appear in the response's `SharedFolderMetadata.permissions` - // field describing the actions the authenticated user can perform on the - // folder. - Actions []*FolderAction `json:"actions,omitempty"` -} - -// NewUpdateFolderPolicyArg returns a new UpdateFolderPolicyArg instance -func NewUpdateFolderPolicyArg(SharedFolderId string) *UpdateFolderPolicyArg { - s := new(UpdateFolderPolicyArg) - s.SharedFolderId = SharedFolderId - return s -} - -// UpdateFolderPolicyError : has no documentation (yet) -type UpdateFolderPolicyError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` -} - -// Valid tag values for UpdateFolderPolicyError -const ( - UpdateFolderPolicyErrorAccessError = "access_error" - UpdateFolderPolicyErrorNotOnTeam = "not_on_team" - UpdateFolderPolicyErrorTeamPolicyDisallowsMemberPolicy = "team_policy_disallows_member_policy" - UpdateFolderPolicyErrorDisallowedSharedLinkPolicy = "disallowed_shared_link_policy" - UpdateFolderPolicyErrorNoPermission = "no_permission" - UpdateFolderPolicyErrorTeamFolder = "team_folder" - UpdateFolderPolicyErrorOther = "other" -) - -// UnmarshalJSON deserializes into a UpdateFolderPolicyError instance -func (u *UpdateFolderPolicyError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *SharedFolderAccessError `json:"access_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - } - return nil -} - -// UserMembershipInfo : The information about a user member of the shared -// content. -type UserMembershipInfo struct { - MembershipInfo - // User : The account information for the membership user. - User *UserInfo `json:"user"` -} - -// NewUserMembershipInfo returns a new UserMembershipInfo instance -func NewUserMembershipInfo(AccessType *AccessLevel, User *UserInfo) *UserMembershipInfo { - s := new(UserMembershipInfo) - s.AccessType = AccessType - s.User = User - s.IsInherited = false - return s -} - -// UserFileMembershipInfo : The information about a user member of the shared -// content with an appended last seen timestamp. -type UserFileMembershipInfo struct { - UserMembershipInfo - // TimeLastSeen : The UTC timestamp of when the user has last seen the - // content, if they have. - TimeLastSeen time.Time `json:"time_last_seen,omitempty"` - // PlatformType : The platform on which the user has last seen the content, - // or unknown. - PlatformType *seen_state.PlatformType `json:"platform_type,omitempty"` -} - -// NewUserFileMembershipInfo returns a new UserFileMembershipInfo instance -func NewUserFileMembershipInfo(AccessType *AccessLevel, User *UserInfo) *UserFileMembershipInfo { - s := new(UserFileMembershipInfo) - s.AccessType = AccessType - s.User = User - s.IsInherited = false - return s -} - -// UserInfo : Basic information about a user. Use `usersAccount` and -// `usersAccountBatch` to obtain more detailed information. -type UserInfo struct { - // AccountId : The account ID of the user. - AccountId string `json:"account_id"` - // Email : Email address of user. - Email string `json:"email"` - // DisplayName : The display name of the user. - DisplayName string `json:"display_name"` - // SameTeam : If the user is in the same team as current user. - SameTeam bool `json:"same_team"` - // TeamMemberId : The team member ID of the shared folder member. Only - // present if `same_team` is true. - TeamMemberId string `json:"team_member_id,omitempty"` -} - -// NewUserInfo returns a new UserInfo instance -func NewUserInfo(AccountId string, Email string, DisplayName string, SameTeam bool) *UserInfo { - s := new(UserInfo) - s.AccountId = AccountId - s.Email = Email - s.DisplayName = DisplayName - s.SameTeam = SameTeam - return s -} - -// ViewerInfoPolicy : has no documentation (yet) -type ViewerInfoPolicy struct { - dropbox.Tagged -} - -// Valid tag values for ViewerInfoPolicy -const ( - ViewerInfoPolicyEnabled = "enabled" - ViewerInfoPolicyDisabled = "disabled" - ViewerInfoPolicyOther = "other" -) - -// Visibility : Who can access a shared link. The most open visibility is -// `public`. The default depends on many aspects, such as team and user -// preferences and shared folder settings. -type Visibility struct { - dropbox.Tagged -} - -// Valid tag values for Visibility -const ( - VisibilityPublic = "public" - VisibilityTeamOnly = "team_only" - VisibilityPassword = "password" - VisibilityTeamAndPassword = "team_and_password" - VisibilitySharedFolderOnly = "shared_folder_only" - VisibilityOther = "other" -) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go deleted file mode 100644 index 3ff353e4e..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go +++ /dev/null @@ -1,4479 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package team - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "log" - "net/http" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties" -) - -// Client interface describes all routes in this namespace -type Client interface { - // DevicesListMemberDevices : List all device sessions of a team's member. - DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *ListMemberDevicesResult, err error) - // DevicesListMembersDevices : List all device sessions of a team. - // Permission : Team member file access. - DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *ListMembersDevicesResult, err error) - // DevicesListTeamDevices : List all device sessions of a team. Permission : - // Team member file access. - // Deprecated: Use `DevicesListMembersDevices` instead - DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTeamDevicesResult, err error) - // DevicesRevokeDeviceSession : Revoke a device session of a team's member. - DevicesRevokeDeviceSession(arg *RevokeDeviceSessionArg) (err error) - // DevicesRevokeDeviceSessionBatch : Revoke a list of device sessions of - // team members. - DevicesRevokeDeviceSessionBatch(arg *RevokeDeviceSessionBatchArg) (res *RevokeDeviceSessionBatchResult, err error) - // FeaturesGetValues : Get the values for one or more featues. This route - // allows you to check your account's capability for what feature you can - // access or what value you have for certain features. Permission : Team - // information. - FeaturesGetValues(arg *FeaturesGetValuesBatchArg) (res *FeaturesGetValuesBatchResult, err error) - // GetInfo : Retrieves information about a team. - GetInfo() (res *TeamGetInfoResult, err error) - // GroupsCreate : Creates a new, empty group, with a requested name. - // Permission : Team member management. - GroupsCreate(arg *GroupCreateArg) (res *GroupFullInfo, err error) - // GroupsDelete : Deletes a group. The group is deleted immediately. However - // the revoking of group-owned resources may take additional time. Use the - // `groupsJobStatusGet` to determine whether this process has completed. - // Permission : Team member management. - GroupsDelete(arg *GroupSelector) (res *async.LaunchEmptyResult, err error) - // GroupsGetInfo : Retrieves information about one or more groups. Note that - // the optional field `GroupFullInfo.members` is not returned for - // system-managed groups. Permission : Team Information. - GroupsGetInfo(arg *GroupsSelector) (res []*GroupsGetInfoItem, err error) - // GroupsJobStatusGet : Once an async_job_id is returned from - // `groupsDelete`, `groupsMembersAdd` , or `groupsMembersRemove` use this - // method to poll the status of granting/revoking group members' access to - // group-owned resources. Permission : Team member management. - GroupsJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) - // GroupsList : Lists groups on a team. Permission : Team Information. - GroupsList(arg *GroupsListArg) (res *GroupsListResult, err error) - // GroupsListContinue : Once a cursor has been retrieved from `groupsList`, - // use this to paginate through all groups. Permission : Team Information. - GroupsListContinue(arg *GroupsListContinueArg) (res *GroupsListResult, err error) - // GroupsMembersAdd : Adds members to a group. The members are added - // immediately. However the granting of group-owned resources may take - // additional time. Use the `groupsJobStatusGet` to determine whether this - // process has completed. Permission : Team member management. - GroupsMembersAdd(arg *GroupMembersAddArg) (res *GroupMembersChangeResult, err error) - // GroupsMembersList : Lists members of a group. Permission : Team - // Information. - GroupsMembersList(arg *GroupsMembersListArg) (res *GroupsMembersListResult, err error) - // GroupsMembersListContinue : Once a cursor has been retrieved from - // `groupsMembersList`, use this to paginate through all members of the - // group. Permission : Team information. - GroupsMembersListContinue(arg *GroupsMembersListContinueArg) (res *GroupsMembersListResult, err error) - // GroupsMembersRemove : Removes members from a group. The members are - // removed immediately. However the revoking of group-owned resources may - // take additional time. Use the `groupsJobStatusGet` to determine whether - // this process has completed. This method permits removing the only owner - // of a group, even in cases where this is not possible via the web client. - // Permission : Team member management. - GroupsMembersRemove(arg *GroupMembersRemoveArg) (res *GroupMembersChangeResult, err error) - // GroupsMembersSetAccessType : Sets a member's access type in a group. - // Permission : Team member management. - GroupsMembersSetAccessType(arg *GroupMembersSetAccessTypeArg) (res []*GroupsGetInfoItem, err error) - // GroupsUpdate : Updates a group's name and/or external ID. Permission : - // Team member management. - GroupsUpdate(arg *GroupUpdateArgs) (res *GroupFullInfo, err error) - // LinkedAppsListMemberLinkedApps : List all linked applications of the team - // member. Note, this endpoint does not list any team-linked applications. - LinkedAppsListMemberLinkedApps(arg *ListMemberAppsArg) (res *ListMemberAppsResult, err error) - // LinkedAppsListMembersLinkedApps : List all applications linked to the - // team members' accounts. Note, this endpoint does not list any team-linked - // applications. - LinkedAppsListMembersLinkedApps(arg *ListMembersAppsArg) (res *ListMembersAppsResult, err error) - // LinkedAppsListTeamLinkedApps : List all applications linked to the team - // members' accounts. Note, this endpoint doesn't list any team-linked - // applications. - // Deprecated: Use `LinkedAppsListMembersLinkedApps` instead - LinkedAppsListTeamLinkedApps(arg *ListTeamAppsArg) (res *ListTeamAppsResult, err error) - // LinkedAppsRevokeLinkedApp : Revoke a linked application of the team - // member. - LinkedAppsRevokeLinkedApp(arg *RevokeLinkedApiAppArg) (err error) - // LinkedAppsRevokeLinkedAppBatch : Revoke a list of linked applications of - // the team members. - LinkedAppsRevokeLinkedAppBatch(arg *RevokeLinkedApiAppBatchArg) (res *RevokeLinkedAppBatchResult, err error) - // MemberSpaceLimitsExcludedUsersAdd : Add users to member space limits - // excluded users list. - MemberSpaceLimitsExcludedUsersAdd(arg *ExcludedUsersUpdateArg) (res *ExcludedUsersUpdateResult, err error) - // MemberSpaceLimitsExcludedUsersList : List member space limits excluded - // users. - MemberSpaceLimitsExcludedUsersList(arg *ExcludedUsersListArg) (res *ExcludedUsersListResult, err error) - // MemberSpaceLimitsExcludedUsersListContinue : Continue listing member - // space limits excluded users. - MemberSpaceLimitsExcludedUsersListContinue(arg *ExcludedUsersListContinueArg) (res *ExcludedUsersListResult, err error) - // MemberSpaceLimitsExcludedUsersRemove : Remove users from member space - // limits excluded users list. - MemberSpaceLimitsExcludedUsersRemove(arg *ExcludedUsersUpdateArg) (res *ExcludedUsersUpdateResult, err error) - // MemberSpaceLimitsGetCustomQuota : Get users custom quota. Returns none as - // the custom quota if none was set. A maximum of 1000 members can be - // specified in a single call. - MemberSpaceLimitsGetCustomQuota(arg *CustomQuotaUsersArg) (res []*CustomQuotaResult, err error) - // MemberSpaceLimitsRemoveCustomQuota : Remove users custom quota. A maximum - // of 1000 members can be specified in a single call. - MemberSpaceLimitsRemoveCustomQuota(arg *CustomQuotaUsersArg) (res []*RemoveCustomQuotaResult, err error) - // MemberSpaceLimitsSetCustomQuota : Set users custom quota. Custom quota - // has to be at least 15GB. A maximum of 1000 members can be specified in a - // single call. - MemberSpaceLimitsSetCustomQuota(arg *SetCustomQuotaArg) (res []*CustomQuotaResult, err error) - // MembersAdd : Adds members to a team. Permission : Team member management - // A maximum of 20 members can be specified in a single call. If no Dropbox - // account exists with the email address specified, a new Dropbox account - // will be created with the given email address, and that account will be - // invited to the team. If a personal Dropbox account exists with the email - // address specified in the call, this call will create a placeholder - // Dropbox account for the user on the team and send an email inviting the - // user to migrate their existing personal account onto the team. Team - // member management apps are required to set an initial given_name and - // surname for a user to use in the team invitation and for 'Perform as team - // member' actions taken on the user before they become 'active'. - MembersAdd(arg *MembersAddArg) (res *MembersAddLaunch, err error) - // MembersAddJobStatusGet : Once an async_job_id is returned from - // `membersAdd` , use this to poll the status of the asynchronous request. - // Permission : Team member management. - MembersAddJobStatusGet(arg *async.PollArg) (res *MembersAddJobStatus, err error) - // MembersGetInfo : Returns information about multiple team members. - // Permission : Team information This endpoint will return - // `MembersGetInfoItem.id_not_found`, for IDs (or emails) that cannot be - // matched to a valid team member. - MembersGetInfo(arg *MembersGetInfoArgs) (res []*MembersGetInfoItem, err error) - // MembersList : Lists members of a team. Permission : Team information. - MembersList(arg *MembersListArg) (res *MembersListResult, err error) - // MembersListContinue : Once a cursor has been retrieved from - // `membersList`, use this to paginate through all team members. Permission - // : Team information. - MembersListContinue(arg *MembersListContinueArg) (res *MembersListResult, err error) - // MembersMoveFormerMemberFiles : Moves removed member's files to a - // different member. This endpoint initiates an asynchronous job. To obtain - // the final result of the job, the client should periodically poll - // `membersMoveFormerMemberFilesJobStatusCheck`. Permission : Team member - // management. - MembersMoveFormerMemberFiles(arg *MembersDataTransferArg) (res *async.LaunchEmptyResult, err error) - // MembersMoveFormerMemberFilesJobStatusCheck : Once an async_job_id is - // returned from `membersMoveFormerMemberFiles` , use this to poll the - // status of the asynchronous request. Permission : Team member management. - MembersMoveFormerMemberFilesJobStatusCheck(arg *async.PollArg) (res *async.PollEmptyResult, err error) - // MembersRecover : Recover a deleted member. Permission : Team member - // management Exactly one of team_member_id, email, or external_id must be - // provided to identify the user account. - MembersRecover(arg *MembersRecoverArg) (err error) - // MembersRemove : Removes a member from a team. Permission : Team member - // management Exactly one of team_member_id, email, or external_id must be - // provided to identify the user account. Accounts can be recovered via - // `membersRecover` for a 7 day period or until the account has been - // permanently deleted or transferred to another account (whichever comes - // first). Calling `membersAdd` while a user is still recoverable on your - // team will return with `MemberAddResult.user_already_on_team`. Accounts - // can have their files transferred via the admin console for a limited - // time, based on the version history length associated with the team (120 - // days for most teams). This endpoint may initiate an asynchronous job. To - // obtain the final result of the job, the client should periodically poll - // `membersRemoveJobStatusGet`. - MembersRemove(arg *MembersRemoveArg) (res *async.LaunchEmptyResult, err error) - // MembersRemoveJobStatusGet : Once an async_job_id is returned from - // `membersRemove` , use this to poll the status of the asynchronous - // request. Permission : Team member management. - MembersRemoveJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) - // MembersSendWelcomeEmail : Sends welcome email to pending team member. - // Permission : Team member management Exactly one of team_member_id, email, - // or external_id must be provided to identify the user account. No-op if - // team member is not pending. - MembersSendWelcomeEmail(arg *UserSelectorArg) (err error) - // MembersSetAdminPermissions : Updates a team member's permissions. - // Permission : Team member management. - MembersSetAdminPermissions(arg *MembersSetPermissionsArg) (res *MembersSetPermissionsResult, err error) - // MembersSetProfile : Updates a team member's profile. Permission : Team - // member management. - MembersSetProfile(arg *MembersSetProfileArg) (res *TeamMemberInfo, err error) - // MembersSuspend : Suspend a member from a team. Permission : Team member - // management Exactly one of team_member_id, email, or external_id must be - // provided to identify the user account. - MembersSuspend(arg *MembersDeactivateArg) (err error) - // MembersUnsuspend : Unsuspend a member from a team. Permission : Team - // member management Exactly one of team_member_id, email, or external_id - // must be provided to identify the user account. - MembersUnsuspend(arg *MembersUnsuspendArg) (err error) - // NamespacesList : Returns a list of all team-accessible namespaces. This - // list includes team folders, shared folders containing team members, team - // members' home namespaces, and team members' app folders. Home namespaces - // and app folders are always owned by this team or members of the team, but - // shared folders may be owned by other users or other teams. Duplicates may - // occur in the list. - NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespacesListResult, err error) - // NamespacesListContinue : Once a cursor has been retrieved from - // `namespacesList`, use this to paginate through all team-accessible - // namespaces. Duplicates may occur in the list. - NamespacesListContinue(arg *TeamNamespacesListContinueArg) (res *TeamNamespacesListResult, err error) - // PropertiesTemplateAdd : Permission : Team member file access. - // Deprecated: - PropertiesTemplateAdd(arg *file_properties.AddTemplateArg) (res *file_properties.AddTemplateResult, err error) - // PropertiesTemplateGet : Permission : Team member file access. - // Deprecated: - PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (res *file_properties.GetTemplateResult, err error) - // PropertiesTemplateList : Permission : Team member file access. - // Deprecated: - PropertiesTemplateList() (res *file_properties.ListTemplateResult, err error) - // PropertiesTemplateUpdate : Permission : Team member file access. - // Deprecated: - PropertiesTemplateUpdate(arg *file_properties.UpdateTemplateArg) (res *file_properties.UpdateTemplateResult, err error) - // ReportsGetActivity : Retrieves reporting data about a team's user - // activity. - ReportsGetActivity(arg *DateRange) (res *GetActivityReport, err error) - // ReportsGetDevices : Retrieves reporting data about a team's linked - // devices. - ReportsGetDevices(arg *DateRange) (res *GetDevicesReport, err error) - // ReportsGetMembership : Retrieves reporting data about a team's - // membership. - ReportsGetMembership(arg *DateRange) (res *GetMembershipReport, err error) - // ReportsGetStorage : Retrieves reporting data about a team's storage - // usage. - ReportsGetStorage(arg *DateRange) (res *GetStorageReport, err error) - // TeamFolderActivate : Sets an archived team folder's status to active. - // Permission : Team member file access. - TeamFolderActivate(arg *TeamFolderIdArg) (res *TeamFolderMetadata, err error) - // TeamFolderArchive : Sets an active team folder's status to archived and - // removes all folder and file members. Permission : Team member file - // access. - TeamFolderArchive(arg *TeamFolderArchiveArg) (res *TeamFolderArchiveLaunch, err error) - // TeamFolderArchiveCheck : Returns the status of an asynchronous job for - // archiving a team folder. Permission : Team member file access. - TeamFolderArchiveCheck(arg *async.PollArg) (res *TeamFolderArchiveJobStatus, err error) - // TeamFolderCreate : Creates a new, active, team folder with no members. - // Permission : Team member file access. - TeamFolderCreate(arg *TeamFolderCreateArg) (res *TeamFolderMetadata, err error) - // TeamFolderGetInfo : Retrieves metadata for team folders. Permission : - // Team member file access. - TeamFolderGetInfo(arg *TeamFolderIdListArg) (res []*TeamFolderGetInfoItem, err error) - // TeamFolderList : Lists all team folders. Permission : Team member file - // access. - TeamFolderList(arg *TeamFolderListArg) (res *TeamFolderListResult, err error) - // TeamFolderListContinue : Once a cursor has been retrieved from - // `teamFolderList`, use this to paginate through all team folders. - // Permission : Team member file access. - TeamFolderListContinue(arg *TeamFolderListContinueArg) (res *TeamFolderListResult, err error) - // TeamFolderPermanentlyDelete : Permanently deletes an archived team - // folder. Permission : Team member file access. - TeamFolderPermanentlyDelete(arg *TeamFolderIdArg) (err error) - // TeamFolderRename : Changes an active team folder's name. Permission : - // Team member file access. - TeamFolderRename(arg *TeamFolderRenameArg) (res *TeamFolderMetadata, err error) - // TeamFolderUpdateSyncSettings : Updates the sync settings on a team folder - // or its contents. Use of this endpoint requires that the team has team - // selective sync enabled. - TeamFolderUpdateSyncSettings(arg *TeamFolderUpdateSyncSettingsArg) (res *TeamFolderMetadata, err error) - // TokenGetAuthenticatedAdmin : Returns the member profile of the admin who - // generated the team access token used to make the call. - TokenGetAuthenticatedAdmin() (res *TokenGetAuthenticatedAdminResult, err error) -} - -type apiImpl dropbox.Context - -//DevicesListMemberDevicesAPIError is an error-wrapper for the devices/list_member_devices route -type DevicesListMemberDevicesAPIError struct { - dropbox.APIError - EndpointError *ListMemberDevicesError `json:"error"` -} - -func (dbx *apiImpl) DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *ListMemberDevicesResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/list_member_devices", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DevicesListMemberDevicesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DevicesListMembersDevicesAPIError is an error-wrapper for the devices/list_members_devices route -type DevicesListMembersDevicesAPIError struct { - dropbox.APIError - EndpointError *ListMembersDevicesError `json:"error"` -} - -func (dbx *apiImpl) DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *ListMembersDevicesResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/list_members_devices", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DevicesListMembersDevicesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DevicesListTeamDevicesAPIError is an error-wrapper for the devices/list_team_devices route -type DevicesListTeamDevicesAPIError struct { - dropbox.APIError - EndpointError *ListTeamDevicesError `json:"error"` -} - -func (dbx *apiImpl) DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTeamDevicesResult, err error) { - log.Printf("WARNING: API `DevicesListTeamDevices` is deprecated") - log.Printf("Use API `DevicesListMembersDevices` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/list_team_devices", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DevicesListTeamDevicesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DevicesRevokeDeviceSessionAPIError is an error-wrapper for the devices/revoke_device_session route -type DevicesRevokeDeviceSessionAPIError struct { - dropbox.APIError - EndpointError *RevokeDeviceSessionError `json:"error"` -} - -func (dbx *apiImpl) DevicesRevokeDeviceSession(arg *RevokeDeviceSessionArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/revoke_device_session", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DevicesRevokeDeviceSessionAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//DevicesRevokeDeviceSessionBatchAPIError is an error-wrapper for the devices/revoke_device_session_batch route -type DevicesRevokeDeviceSessionBatchAPIError struct { - dropbox.APIError - EndpointError *RevokeDeviceSessionBatchError `json:"error"` -} - -func (dbx *apiImpl) DevicesRevokeDeviceSessionBatch(arg *RevokeDeviceSessionBatchArg) (res *RevokeDeviceSessionBatchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/revoke_device_session_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError DevicesRevokeDeviceSessionBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//FeaturesGetValuesAPIError is an error-wrapper for the features/get_values route -type FeaturesGetValuesAPIError struct { - dropbox.APIError - EndpointError *FeaturesGetValuesBatchError `json:"error"` -} - -func (dbx *apiImpl) FeaturesGetValues(arg *FeaturesGetValuesBatchArg) (res *FeaturesGetValuesBatchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "features/get_values", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError FeaturesGetValuesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetInfoAPIError is an error-wrapper for the get_info route -type GetInfoAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) GetInfo() (res *TeamGetInfoResult, err error) { - cli := dbx.Client - - headers := map[string]string{} - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "get_info", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetInfoAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsCreateAPIError is an error-wrapper for the groups/create route -type GroupsCreateAPIError struct { - dropbox.APIError - EndpointError *GroupCreateError `json:"error"` -} - -func (dbx *apiImpl) GroupsCreate(arg *GroupCreateArg) (res *GroupFullInfo, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/create", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsCreateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsDeleteAPIError is an error-wrapper for the groups/delete route -type GroupsDeleteAPIError struct { - dropbox.APIError - EndpointError *GroupDeleteError `json:"error"` -} - -func (dbx *apiImpl) GroupsDelete(arg *GroupSelector) (res *async.LaunchEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/delete", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsDeleteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsGetInfoAPIError is an error-wrapper for the groups/get_info route -type GroupsGetInfoAPIError struct { - dropbox.APIError - EndpointError *GroupsGetInfoError `json:"error"` -} - -func (dbx *apiImpl) GroupsGetInfo(arg *GroupsSelector) (res []*GroupsGetInfoItem, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/get_info", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsGetInfoAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsJobStatusGetAPIError is an error-wrapper for the groups/job_status/get route -type GroupsJobStatusGetAPIError struct { - dropbox.APIError - EndpointError *GroupsPollError `json:"error"` -} - -func (dbx *apiImpl) GroupsJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/job_status/get", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsJobStatusGetAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsListAPIError is an error-wrapper for the groups/list route -type GroupsListAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) GroupsList(arg *GroupsListArg) (res *GroupsListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/list", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsListContinueAPIError is an error-wrapper for the groups/list/continue route -type GroupsListContinueAPIError struct { - dropbox.APIError - EndpointError *GroupsListContinueError `json:"error"` -} - -func (dbx *apiImpl) GroupsListContinue(arg *GroupsListContinueArg) (res *GroupsListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/list/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsListContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsMembersAddAPIError is an error-wrapper for the groups/members/add route -type GroupsMembersAddAPIError struct { - dropbox.APIError - EndpointError *GroupMembersAddError `json:"error"` -} - -func (dbx *apiImpl) GroupsMembersAdd(arg *GroupMembersAddArg) (res *GroupMembersChangeResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/add", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsMembersAddAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsMembersListAPIError is an error-wrapper for the groups/members/list route -type GroupsMembersListAPIError struct { - dropbox.APIError - EndpointError *GroupSelectorError `json:"error"` -} - -func (dbx *apiImpl) GroupsMembersList(arg *GroupsMembersListArg) (res *GroupsMembersListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/list", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsMembersListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsMembersListContinueAPIError is an error-wrapper for the groups/members/list/continue route -type GroupsMembersListContinueAPIError struct { - dropbox.APIError - EndpointError *GroupsMembersListContinueError `json:"error"` -} - -func (dbx *apiImpl) GroupsMembersListContinue(arg *GroupsMembersListContinueArg) (res *GroupsMembersListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/list/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsMembersListContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsMembersRemoveAPIError is an error-wrapper for the groups/members/remove route -type GroupsMembersRemoveAPIError struct { - dropbox.APIError - EndpointError *GroupMembersRemoveError `json:"error"` -} - -func (dbx *apiImpl) GroupsMembersRemove(arg *GroupMembersRemoveArg) (res *GroupMembersChangeResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/remove", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsMembersRemoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsMembersSetAccessTypeAPIError is an error-wrapper for the groups/members/set_access_type route -type GroupsMembersSetAccessTypeAPIError struct { - dropbox.APIError - EndpointError *GroupMemberSetAccessTypeError `json:"error"` -} - -func (dbx *apiImpl) GroupsMembersSetAccessType(arg *GroupMembersSetAccessTypeArg) (res []*GroupsGetInfoItem, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/set_access_type", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsMembersSetAccessTypeAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GroupsUpdateAPIError is an error-wrapper for the groups/update route -type GroupsUpdateAPIError struct { - dropbox.APIError - EndpointError *GroupUpdateError `json:"error"` -} - -func (dbx *apiImpl) GroupsUpdate(arg *GroupUpdateArgs) (res *GroupFullInfo, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/update", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GroupsUpdateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//LinkedAppsListMemberLinkedAppsAPIError is an error-wrapper for the linked_apps/list_member_linked_apps route -type LinkedAppsListMemberLinkedAppsAPIError struct { - dropbox.APIError - EndpointError *ListMemberAppsError `json:"error"` -} - -func (dbx *apiImpl) LinkedAppsListMemberLinkedApps(arg *ListMemberAppsArg) (res *ListMemberAppsResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/list_member_linked_apps", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError LinkedAppsListMemberLinkedAppsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//LinkedAppsListMembersLinkedAppsAPIError is an error-wrapper for the linked_apps/list_members_linked_apps route -type LinkedAppsListMembersLinkedAppsAPIError struct { - dropbox.APIError - EndpointError *ListMembersAppsError `json:"error"` -} - -func (dbx *apiImpl) LinkedAppsListMembersLinkedApps(arg *ListMembersAppsArg) (res *ListMembersAppsResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/list_members_linked_apps", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError LinkedAppsListMembersLinkedAppsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//LinkedAppsListTeamLinkedAppsAPIError is an error-wrapper for the linked_apps/list_team_linked_apps route -type LinkedAppsListTeamLinkedAppsAPIError struct { - dropbox.APIError - EndpointError *ListTeamAppsError `json:"error"` -} - -func (dbx *apiImpl) LinkedAppsListTeamLinkedApps(arg *ListTeamAppsArg) (res *ListTeamAppsResult, err error) { - log.Printf("WARNING: API `LinkedAppsListTeamLinkedApps` is deprecated") - log.Printf("Use API `LinkedAppsListMembersLinkedApps` instead") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/list_team_linked_apps", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError LinkedAppsListTeamLinkedAppsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//LinkedAppsRevokeLinkedAppAPIError is an error-wrapper for the linked_apps/revoke_linked_app route -type LinkedAppsRevokeLinkedAppAPIError struct { - dropbox.APIError - EndpointError *RevokeLinkedAppError `json:"error"` -} - -func (dbx *apiImpl) LinkedAppsRevokeLinkedApp(arg *RevokeLinkedApiAppArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/revoke_linked_app", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError LinkedAppsRevokeLinkedAppAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//LinkedAppsRevokeLinkedAppBatchAPIError is an error-wrapper for the linked_apps/revoke_linked_app_batch route -type LinkedAppsRevokeLinkedAppBatchAPIError struct { - dropbox.APIError - EndpointError *RevokeLinkedAppBatchError `json:"error"` -} - -func (dbx *apiImpl) LinkedAppsRevokeLinkedAppBatch(arg *RevokeLinkedApiAppBatchArg) (res *RevokeLinkedAppBatchResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/revoke_linked_app_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError LinkedAppsRevokeLinkedAppBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsExcludedUsersAddAPIError is an error-wrapper for the member_space_limits/excluded_users/add route -type MemberSpaceLimitsExcludedUsersAddAPIError struct { - dropbox.APIError - EndpointError *ExcludedUsersUpdateError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersAdd(arg *ExcludedUsersUpdateArg) (res *ExcludedUsersUpdateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/excluded_users/add", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsExcludedUsersAddAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsExcludedUsersListAPIError is an error-wrapper for the member_space_limits/excluded_users/list route -type MemberSpaceLimitsExcludedUsersListAPIError struct { - dropbox.APIError - EndpointError *ExcludedUsersListError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersList(arg *ExcludedUsersListArg) (res *ExcludedUsersListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/excluded_users/list", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsExcludedUsersListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsExcludedUsersListContinueAPIError is an error-wrapper for the member_space_limits/excluded_users/list/continue route -type MemberSpaceLimitsExcludedUsersListContinueAPIError struct { - dropbox.APIError - EndpointError *ExcludedUsersListContinueError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersListContinue(arg *ExcludedUsersListContinueArg) (res *ExcludedUsersListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/excluded_users/list/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsExcludedUsersListContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsExcludedUsersRemoveAPIError is an error-wrapper for the member_space_limits/excluded_users/remove route -type MemberSpaceLimitsExcludedUsersRemoveAPIError struct { - dropbox.APIError - EndpointError *ExcludedUsersUpdateError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersRemove(arg *ExcludedUsersUpdateArg) (res *ExcludedUsersUpdateResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/excluded_users/remove", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsExcludedUsersRemoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsGetCustomQuotaAPIError is an error-wrapper for the member_space_limits/get_custom_quota route -type MemberSpaceLimitsGetCustomQuotaAPIError struct { - dropbox.APIError - EndpointError *CustomQuotaError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsGetCustomQuota(arg *CustomQuotaUsersArg) (res []*CustomQuotaResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/get_custom_quota", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsGetCustomQuotaAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsRemoveCustomQuotaAPIError is an error-wrapper for the member_space_limits/remove_custom_quota route -type MemberSpaceLimitsRemoveCustomQuotaAPIError struct { - dropbox.APIError - EndpointError *CustomQuotaError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsRemoveCustomQuota(arg *CustomQuotaUsersArg) (res []*RemoveCustomQuotaResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/remove_custom_quota", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsRemoveCustomQuotaAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MemberSpaceLimitsSetCustomQuotaAPIError is an error-wrapper for the member_space_limits/set_custom_quota route -type MemberSpaceLimitsSetCustomQuotaAPIError struct { - dropbox.APIError - EndpointError *SetCustomQuotaError `json:"error"` -} - -func (dbx *apiImpl) MemberSpaceLimitsSetCustomQuota(arg *SetCustomQuotaArg) (res []*CustomQuotaResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "member_space_limits/set_custom_quota", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MemberSpaceLimitsSetCustomQuotaAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersAddAPIError is an error-wrapper for the members/add route -type MembersAddAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) MembersAdd(arg *MembersAddArg) (res *MembersAddLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/add", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersAddAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersAddJobStatusGetAPIError is an error-wrapper for the members/add/job_status/get route -type MembersAddJobStatusGetAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) MembersAddJobStatusGet(arg *async.PollArg) (res *MembersAddJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/add/job_status/get", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersAddJobStatusGetAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersGetInfoAPIError is an error-wrapper for the members/get_info route -type MembersGetInfoAPIError struct { - dropbox.APIError - EndpointError *MembersGetInfoError `json:"error"` -} - -func (dbx *apiImpl) MembersGetInfo(arg *MembersGetInfoArgs) (res []*MembersGetInfoItem, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/get_info", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersGetInfoAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersListAPIError is an error-wrapper for the members/list route -type MembersListAPIError struct { - dropbox.APIError - EndpointError *MembersListError `json:"error"` -} - -func (dbx *apiImpl) MembersList(arg *MembersListArg) (res *MembersListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/list", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersListContinueAPIError is an error-wrapper for the members/list/continue route -type MembersListContinueAPIError struct { - dropbox.APIError - EndpointError *MembersListContinueError `json:"error"` -} - -func (dbx *apiImpl) MembersListContinue(arg *MembersListContinueArg) (res *MembersListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/list/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersListContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersMoveFormerMemberFilesAPIError is an error-wrapper for the members/move_former_member_files route -type MembersMoveFormerMemberFilesAPIError struct { - dropbox.APIError - EndpointError *MembersTransferFormerMembersFilesError `json:"error"` -} - -func (dbx *apiImpl) MembersMoveFormerMemberFiles(arg *MembersDataTransferArg) (res *async.LaunchEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/move_former_member_files", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersMoveFormerMemberFilesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersMoveFormerMemberFilesJobStatusCheckAPIError is an error-wrapper for the members/move_former_member_files/job_status/check route -type MembersMoveFormerMemberFilesJobStatusCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) MembersMoveFormerMemberFilesJobStatusCheck(arg *async.PollArg) (res *async.PollEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/move_former_member_files/job_status/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersMoveFormerMemberFilesJobStatusCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersRecoverAPIError is an error-wrapper for the members/recover route -type MembersRecoverAPIError struct { - dropbox.APIError - EndpointError *MembersRecoverError `json:"error"` -} - -func (dbx *apiImpl) MembersRecover(arg *MembersRecoverArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/recover", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersRecoverAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersRemoveAPIError is an error-wrapper for the members/remove route -type MembersRemoveAPIError struct { - dropbox.APIError - EndpointError *MembersRemoveError `json:"error"` -} - -func (dbx *apiImpl) MembersRemove(arg *MembersRemoveArg) (res *async.LaunchEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/remove", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersRemoveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersRemoveJobStatusGetAPIError is an error-wrapper for the members/remove/job_status/get route -type MembersRemoveJobStatusGetAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) MembersRemoveJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/remove/job_status/get", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersRemoveJobStatusGetAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersSendWelcomeEmailAPIError is an error-wrapper for the members/send_welcome_email route -type MembersSendWelcomeEmailAPIError struct { - dropbox.APIError - EndpointError *MembersSendWelcomeError `json:"error"` -} - -func (dbx *apiImpl) MembersSendWelcomeEmail(arg *UserSelectorArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/send_welcome_email", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersSendWelcomeEmailAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersSetAdminPermissionsAPIError is an error-wrapper for the members/set_admin_permissions route -type MembersSetAdminPermissionsAPIError struct { - dropbox.APIError - EndpointError *MembersSetPermissionsError `json:"error"` -} - -func (dbx *apiImpl) MembersSetAdminPermissions(arg *MembersSetPermissionsArg) (res *MembersSetPermissionsResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/set_admin_permissions", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersSetAdminPermissionsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersSetProfileAPIError is an error-wrapper for the members/set_profile route -type MembersSetProfileAPIError struct { - dropbox.APIError - EndpointError *MembersSetProfileError `json:"error"` -} - -func (dbx *apiImpl) MembersSetProfile(arg *MembersSetProfileArg) (res *TeamMemberInfo, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/set_profile", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersSetProfileAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersSuspendAPIError is an error-wrapper for the members/suspend route -type MembersSuspendAPIError struct { - dropbox.APIError - EndpointError *MembersSuspendError `json:"error"` -} - -func (dbx *apiImpl) MembersSuspend(arg *MembersDeactivateArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/suspend", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersSuspendAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//MembersUnsuspendAPIError is an error-wrapper for the members/unsuspend route -type MembersUnsuspendAPIError struct { - dropbox.APIError - EndpointError *MembersUnsuspendError `json:"error"` -} - -func (dbx *apiImpl) MembersUnsuspend(arg *MembersUnsuspendArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/unsuspend", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError MembersUnsuspendAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//NamespacesListAPIError is an error-wrapper for the namespaces/list route -type NamespacesListAPIError struct { - dropbox.APIError - EndpointError *TeamNamespacesListError `json:"error"` -} - -func (dbx *apiImpl) NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespacesListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "namespaces/list", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError NamespacesListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//NamespacesListContinueAPIError is an error-wrapper for the namespaces/list/continue route -type NamespacesListContinueAPIError struct { - dropbox.APIError - EndpointError *TeamNamespacesListContinueError `json:"error"` -} - -func (dbx *apiImpl) NamespacesListContinue(arg *TeamNamespacesListContinueArg) (res *TeamNamespacesListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "namespaces/list/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError NamespacesListContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesTemplateAddAPIError is an error-wrapper for the properties/template/add route -type PropertiesTemplateAddAPIError struct { - dropbox.APIError - EndpointError *file_properties.ModifyTemplateError `json:"error"` -} - -func (dbx *apiImpl) PropertiesTemplateAdd(arg *file_properties.AddTemplateArg) (res *file_properties.AddTemplateResult, err error) { - log.Printf("WARNING: API `PropertiesTemplateAdd` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/add", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesTemplateAddAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesTemplateGetAPIError is an error-wrapper for the properties/template/get route -type PropertiesTemplateGetAPIError struct { - dropbox.APIError - EndpointError *file_properties.TemplateError `json:"error"` -} - -func (dbx *apiImpl) PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (res *file_properties.GetTemplateResult, err error) { - log.Printf("WARNING: API `PropertiesTemplateGet` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/get", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesTemplateGetAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesTemplateListAPIError is an error-wrapper for the properties/template/list route -type PropertiesTemplateListAPIError struct { - dropbox.APIError - EndpointError *file_properties.TemplateError `json:"error"` -} - -func (dbx *apiImpl) PropertiesTemplateList() (res *file_properties.ListTemplateResult, err error) { - log.Printf("WARNING: API `PropertiesTemplateList` is deprecated") - - cli := dbx.Client - - headers := map[string]string{} - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/list", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesTemplateListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//PropertiesTemplateUpdateAPIError is an error-wrapper for the properties/template/update route -type PropertiesTemplateUpdateAPIError struct { - dropbox.APIError - EndpointError *file_properties.ModifyTemplateError `json:"error"` -} - -func (dbx *apiImpl) PropertiesTemplateUpdate(arg *file_properties.UpdateTemplateArg) (res *file_properties.UpdateTemplateResult, err error) { - log.Printf("WARNING: API `PropertiesTemplateUpdate` is deprecated") - - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/update", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError PropertiesTemplateUpdateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ReportsGetActivityAPIError is an error-wrapper for the reports/get_activity route -type ReportsGetActivityAPIError struct { - dropbox.APIError - EndpointError *DateRangeError `json:"error"` -} - -func (dbx *apiImpl) ReportsGetActivity(arg *DateRange) (res *GetActivityReport, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_activity", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ReportsGetActivityAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ReportsGetDevicesAPIError is an error-wrapper for the reports/get_devices route -type ReportsGetDevicesAPIError struct { - dropbox.APIError - EndpointError *DateRangeError `json:"error"` -} - -func (dbx *apiImpl) ReportsGetDevices(arg *DateRange) (res *GetDevicesReport, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_devices", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ReportsGetDevicesAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ReportsGetMembershipAPIError is an error-wrapper for the reports/get_membership route -type ReportsGetMembershipAPIError struct { - dropbox.APIError - EndpointError *DateRangeError `json:"error"` -} - -func (dbx *apiImpl) ReportsGetMembership(arg *DateRange) (res *GetMembershipReport, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_membership", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ReportsGetMembershipAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//ReportsGetStorageAPIError is an error-wrapper for the reports/get_storage route -type ReportsGetStorageAPIError struct { - dropbox.APIError - EndpointError *DateRangeError `json:"error"` -} - -func (dbx *apiImpl) ReportsGetStorage(arg *DateRange) (res *GetStorageReport, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_storage", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError ReportsGetStorageAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderActivateAPIError is an error-wrapper for the team_folder/activate route -type TeamFolderActivateAPIError struct { - dropbox.APIError - EndpointError *TeamFolderActivateError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderActivate(arg *TeamFolderIdArg) (res *TeamFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/activate", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderActivateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderArchiveAPIError is an error-wrapper for the team_folder/archive route -type TeamFolderArchiveAPIError struct { - dropbox.APIError - EndpointError *TeamFolderArchiveError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderArchive(arg *TeamFolderArchiveArg) (res *TeamFolderArchiveLaunch, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/archive", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderArchiveAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderArchiveCheckAPIError is an error-wrapper for the team_folder/archive/check route -type TeamFolderArchiveCheckAPIError struct { - dropbox.APIError - EndpointError *async.PollError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderArchiveCheck(arg *async.PollArg) (res *TeamFolderArchiveJobStatus, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/archive/check", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderArchiveCheckAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderCreateAPIError is an error-wrapper for the team_folder/create route -type TeamFolderCreateAPIError struct { - dropbox.APIError - EndpointError *TeamFolderCreateError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderCreate(arg *TeamFolderCreateArg) (res *TeamFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/create", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderCreateAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderGetInfoAPIError is an error-wrapper for the team_folder/get_info route -type TeamFolderGetInfoAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) TeamFolderGetInfo(arg *TeamFolderIdListArg) (res []*TeamFolderGetInfoItem, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/get_info", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderGetInfoAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderListAPIError is an error-wrapper for the team_folder/list route -type TeamFolderListAPIError struct { - dropbox.APIError - EndpointError *TeamFolderListError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderList(arg *TeamFolderListArg) (res *TeamFolderListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/list", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderListAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderListContinueAPIError is an error-wrapper for the team_folder/list/continue route -type TeamFolderListContinueAPIError struct { - dropbox.APIError - EndpointError *TeamFolderListContinueError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderListContinue(arg *TeamFolderListContinueArg) (res *TeamFolderListResult, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/list/continue", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderListContinueAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderPermanentlyDeleteAPIError is an error-wrapper for the team_folder/permanently_delete route -type TeamFolderPermanentlyDeleteAPIError struct { - dropbox.APIError - EndpointError *TeamFolderPermanentlyDeleteError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderPermanentlyDelete(arg *TeamFolderIdArg) (err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/permanently_delete", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderPermanentlyDeleteAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderRenameAPIError is an error-wrapper for the team_folder/rename route -type TeamFolderRenameAPIError struct { - dropbox.APIError - EndpointError *TeamFolderRenameError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderRename(arg *TeamFolderRenameArg) (res *TeamFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/rename", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderRenameAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TeamFolderUpdateSyncSettingsAPIError is an error-wrapper for the team_folder/update_sync_settings route -type TeamFolderUpdateSyncSettingsAPIError struct { - dropbox.APIError - EndpointError *TeamFolderUpdateSyncSettingsError `json:"error"` -} - -func (dbx *apiImpl) TeamFolderUpdateSyncSettings(arg *TeamFolderUpdateSyncSettingsArg) (res *TeamFolderMetadata, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/update_sync_settings", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TeamFolderUpdateSyncSettingsAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//TokenGetAuthenticatedAdminAPIError is an error-wrapper for the token/get_authenticated_admin route -type TokenGetAuthenticatedAdminAPIError struct { - dropbox.APIError - EndpointError *TokenGetAuthenticatedAdminError `json:"error"` -} - -func (dbx *apiImpl) TokenGetAuthenticatedAdmin() (res *TokenGetAuthenticatedAdminResult, err error) { - cli := dbx.Client - - headers := map[string]string{} - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "token/get_authenticated_admin", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError TokenGetAuthenticatedAdminAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -// New returns a Client implementation for this namespace -func New(c dropbox.Config) Client { - ctx := apiImpl(dropbox.NewContext(c)) - return &ctx -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go deleted file mode 100644 index 469999ddd..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go +++ /dev/null @@ -1,4405 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package team : has no documentation (yet) -package team - -import ( - "encoding/json" - "time" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users" -) - -// DeviceSession : has no documentation (yet) -type DeviceSession struct { - // SessionId : The session id. - SessionId string `json:"session_id"` - // IpAddress : The IP address of the last activity from this session. - IpAddress string `json:"ip_address,omitempty"` - // Country : The country from which the last activity from this session was - // made. - Country string `json:"country,omitempty"` - // Created : The time this session was created. - Created time.Time `json:"created,omitempty"` - // Updated : The time of the last activity from this session. - Updated time.Time `json:"updated,omitempty"` -} - -// NewDeviceSession returns a new DeviceSession instance -func NewDeviceSession(SessionId string) *DeviceSession { - s := new(DeviceSession) - s.SessionId = SessionId - return s -} - -// ActiveWebSession : Information on active web sessions. -type ActiveWebSession struct { - DeviceSession - // UserAgent : Information on the hosting device. - UserAgent string `json:"user_agent"` - // Os : Information on the hosting operating system. - Os string `json:"os"` - // Browser : Information on the browser used for this web session. - Browser string `json:"browser"` - // Expires : The time this session expires. - Expires time.Time `json:"expires,omitempty"` -} - -// NewActiveWebSession returns a new ActiveWebSession instance -func NewActiveWebSession(SessionId string, UserAgent string, Os string, Browser string) *ActiveWebSession { - s := new(ActiveWebSession) - s.SessionId = SessionId - s.UserAgent = UserAgent - s.Os = Os - s.Browser = Browser - return s -} - -// AdminTier : Describes which team-related admin permissions a user has. -type AdminTier struct { - dropbox.Tagged -} - -// Valid tag values for AdminTier -const ( - AdminTierTeamAdmin = "team_admin" - AdminTierUserManagementAdmin = "user_management_admin" - AdminTierSupportAdmin = "support_admin" - AdminTierMemberOnly = "member_only" -) - -// ApiApp : Information on linked third party applications. -type ApiApp struct { - // AppId : The application unique id. - AppId string `json:"app_id"` - // AppName : The application name. - AppName string `json:"app_name"` - // Publisher : The application publisher name. - Publisher string `json:"publisher,omitempty"` - // PublisherUrl : The publisher's URL. - PublisherUrl string `json:"publisher_url,omitempty"` - // Linked : The time this application was linked. - Linked time.Time `json:"linked,omitempty"` - // IsAppFolder : Whether the linked application uses a dedicated folder. - IsAppFolder bool `json:"is_app_folder"` -} - -// NewApiApp returns a new ApiApp instance -func NewApiApp(AppId string, AppName string, IsAppFolder bool) *ApiApp { - s := new(ApiApp) - s.AppId = AppId - s.AppName = AppName - s.IsAppFolder = IsAppFolder - return s -} - -// BaseDfbReport : Base report structure. -type BaseDfbReport struct { - // StartDate : First date present in the results as 'YYYY-MM-DD' or None. - StartDate string `json:"start_date"` -} - -// NewBaseDfbReport returns a new BaseDfbReport instance -func NewBaseDfbReport(StartDate string) *BaseDfbReport { - s := new(BaseDfbReport) - s.StartDate = StartDate - return s -} - -// BaseTeamFolderError : Base error that all errors for existing team folders -// should extend. -type BaseTeamFolderError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` -} - -// Valid tag values for BaseTeamFolderError -const ( - BaseTeamFolderErrorAccessError = "access_error" - BaseTeamFolderErrorStatusError = "status_error" - BaseTeamFolderErrorTeamSharedDropboxError = "team_shared_dropbox_error" - BaseTeamFolderErrorOther = "other" -) - -// UnmarshalJSON deserializes into a BaseTeamFolderError instance -func (u *BaseTeamFolderError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "status_error": - u.StatusError = w.StatusError - - if err != nil { - return err - } - case "team_shared_dropbox_error": - u.TeamSharedDropboxError = w.TeamSharedDropboxError - - if err != nil { - return err - } - } - return nil -} - -// CustomQuotaError : Error returned when getting member custom quota. -type CustomQuotaError struct { - dropbox.Tagged -} - -// Valid tag values for CustomQuotaError -const ( - CustomQuotaErrorTooManyUsers = "too_many_users" - CustomQuotaErrorOther = "other" -) - -// CustomQuotaResult : User custom quota. -type CustomQuotaResult struct { - dropbox.Tagged - // Success : User's custom quota. - Success *UserCustomQuotaResult `json:"success,omitempty"` - // InvalidUser : Invalid user (not in team). - InvalidUser *UserSelectorArg `json:"invalid_user,omitempty"` -} - -// Valid tag values for CustomQuotaResult -const ( - CustomQuotaResultSuccess = "success" - CustomQuotaResultInvalidUser = "invalid_user" - CustomQuotaResultOther = "other" -) - -// UnmarshalJSON deserializes into a CustomQuotaResult instance -func (u *CustomQuotaResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // InvalidUser : Invalid user (not in team). - InvalidUser *UserSelectorArg `json:"invalid_user,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "invalid_user": - u.InvalidUser = w.InvalidUser - - if err != nil { - return err - } - } - return nil -} - -// CustomQuotaUsersArg : has no documentation (yet) -type CustomQuotaUsersArg struct { - // Users : List of users. - Users []*UserSelectorArg `json:"users"` -} - -// NewCustomQuotaUsersArg returns a new CustomQuotaUsersArg instance -func NewCustomQuotaUsersArg(Users []*UserSelectorArg) *CustomQuotaUsersArg { - s := new(CustomQuotaUsersArg) - s.Users = Users - return s -} - -// DateRange : Input arguments that can be provided for most reports. -type DateRange struct { - // StartDate : Optional starting date (inclusive). - StartDate time.Time `json:"start_date,omitempty"` - // EndDate : Optional ending date (exclusive). - EndDate time.Time `json:"end_date,omitempty"` -} - -// NewDateRange returns a new DateRange instance -func NewDateRange() *DateRange { - s := new(DateRange) - return s -} - -// DateRangeError : Errors that can originate from problems in input arguments -// to reports. -type DateRangeError struct { - dropbox.Tagged -} - -// Valid tag values for DateRangeError -const ( - DateRangeErrorOther = "other" -) - -// DesktopClientSession : Information about linked Dropbox desktop client -// sessions. -type DesktopClientSession struct { - DeviceSession - // HostName : Name of the hosting desktop. - HostName string `json:"host_name"` - // ClientType : The Dropbox desktop client type. - ClientType *DesktopPlatform `json:"client_type"` - // ClientVersion : The Dropbox client version. - ClientVersion string `json:"client_version"` - // Platform : Information on the hosting platform. - Platform string `json:"platform"` - // IsDeleteOnUnlinkSupported : Whether it's possible to delete all of the - // account files upon unlinking. - IsDeleteOnUnlinkSupported bool `json:"is_delete_on_unlink_supported"` -} - -// NewDesktopClientSession returns a new DesktopClientSession instance -func NewDesktopClientSession(SessionId string, HostName string, ClientType *DesktopPlatform, ClientVersion string, Platform string, IsDeleteOnUnlinkSupported bool) *DesktopClientSession { - s := new(DesktopClientSession) - s.SessionId = SessionId - s.HostName = HostName - s.ClientType = ClientType - s.ClientVersion = ClientVersion - s.Platform = Platform - s.IsDeleteOnUnlinkSupported = IsDeleteOnUnlinkSupported - return s -} - -// DesktopPlatform : has no documentation (yet) -type DesktopPlatform struct { - dropbox.Tagged -} - -// Valid tag values for DesktopPlatform -const ( - DesktopPlatformWindows = "windows" - DesktopPlatformMac = "mac" - DesktopPlatformLinux = "linux" - DesktopPlatformOther = "other" -) - -// DeviceSessionArg : has no documentation (yet) -type DeviceSessionArg struct { - // SessionId : The session id. - SessionId string `json:"session_id"` - // TeamMemberId : The unique id of the member owning the device. - TeamMemberId string `json:"team_member_id"` -} - -// NewDeviceSessionArg returns a new DeviceSessionArg instance -func NewDeviceSessionArg(SessionId string, TeamMemberId string) *DeviceSessionArg { - s := new(DeviceSessionArg) - s.SessionId = SessionId - s.TeamMemberId = TeamMemberId - return s -} - -// DevicesActive : Each of the items is an array of values, one value per day. -// The value is the number of devices active within a time window, ending with -// that day. If there is no data for a day, then the value will be None. -type DevicesActive struct { - // Windows : Array of number of linked windows (desktop) clients with - // activity. - Windows []uint64 `json:"windows"` - // Macos : Array of number of linked mac (desktop) clients with activity. - Macos []uint64 `json:"macos"` - // Linux : Array of number of linked linus (desktop) clients with activity. - Linux []uint64 `json:"linux"` - // Ios : Array of number of linked ios devices with activity. - Ios []uint64 `json:"ios"` - // Android : Array of number of linked android devices with activity. - Android []uint64 `json:"android"` - // Other : Array of number of other linked devices (blackberry, windows - // phone, etc) with activity. - Other []uint64 `json:"other"` - // Total : Array of total number of linked clients with activity. - Total []uint64 `json:"total"` -} - -// NewDevicesActive returns a new DevicesActive instance -func NewDevicesActive(Windows []uint64, Macos []uint64, Linux []uint64, Ios []uint64, Android []uint64, Other []uint64, Total []uint64) *DevicesActive { - s := new(DevicesActive) - s.Windows = Windows - s.Macos = Macos - s.Linux = Linux - s.Ios = Ios - s.Android = Android - s.Other = Other - s.Total = Total - return s -} - -// ExcludedUsersListArg : Excluded users list argument. -type ExcludedUsersListArg struct { - // Limit : Number of results to return per call. - Limit uint32 `json:"limit"` -} - -// NewExcludedUsersListArg returns a new ExcludedUsersListArg instance -func NewExcludedUsersListArg() *ExcludedUsersListArg { - s := new(ExcludedUsersListArg) - s.Limit = 1000 - return s -} - -// ExcludedUsersListContinueArg : Excluded users list continue argument. -type ExcludedUsersListContinueArg struct { - // Cursor : Indicates from what point to get the next set of users. - Cursor string `json:"cursor"` -} - -// NewExcludedUsersListContinueArg returns a new ExcludedUsersListContinueArg instance -func NewExcludedUsersListContinueArg(Cursor string) *ExcludedUsersListContinueArg { - s := new(ExcludedUsersListContinueArg) - s.Cursor = Cursor - return s -} - -// ExcludedUsersListContinueError : Excluded users list continue error. -type ExcludedUsersListContinueError struct { - dropbox.Tagged -} - -// Valid tag values for ExcludedUsersListContinueError -const ( - ExcludedUsersListContinueErrorInvalidCursor = "invalid_cursor" - ExcludedUsersListContinueErrorOther = "other" -) - -// ExcludedUsersListError : Excluded users list error. -type ExcludedUsersListError struct { - dropbox.Tagged -} - -// Valid tag values for ExcludedUsersListError -const ( - ExcludedUsersListErrorListError = "list_error" - ExcludedUsersListErrorOther = "other" -) - -// ExcludedUsersListResult : Excluded users list result. -type ExcludedUsersListResult struct { - // Users : has no documentation (yet) - Users []*MemberProfile `json:"users"` - // Cursor : Pass the cursor into - // `memberSpaceLimitsExcludedUsersListContinue` to obtain additional - // excluded users. - Cursor string `json:"cursor,omitempty"` - // HasMore : Is true if there are additional excluded users that have not - // been returned yet. An additional call to - // `memberSpaceLimitsExcludedUsersListContinue` can retrieve them. - HasMore bool `json:"has_more"` -} - -// NewExcludedUsersListResult returns a new ExcludedUsersListResult instance -func NewExcludedUsersListResult(Users []*MemberProfile, HasMore bool) *ExcludedUsersListResult { - s := new(ExcludedUsersListResult) - s.Users = Users - s.HasMore = HasMore - return s -} - -// ExcludedUsersUpdateArg : Argument of excluded users update operation. Should -// include a list of users to add/remove (according to endpoint), Maximum size -// of the list is 1000 users. -type ExcludedUsersUpdateArg struct { - // Users : List of users to be added/removed. - Users []*UserSelectorArg `json:"users,omitempty"` -} - -// NewExcludedUsersUpdateArg returns a new ExcludedUsersUpdateArg instance -func NewExcludedUsersUpdateArg() *ExcludedUsersUpdateArg { - s := new(ExcludedUsersUpdateArg) - return s -} - -// ExcludedUsersUpdateError : Excluded users update error. -type ExcludedUsersUpdateError struct { - dropbox.Tagged -} - -// Valid tag values for ExcludedUsersUpdateError -const ( - ExcludedUsersUpdateErrorUsersNotInTeam = "users_not_in_team" - ExcludedUsersUpdateErrorTooManyUsers = "too_many_users" - ExcludedUsersUpdateErrorOther = "other" -) - -// ExcludedUsersUpdateResult : Excluded users update result. -type ExcludedUsersUpdateResult struct { - // Status : Update status. - Status *ExcludedUsersUpdateStatus `json:"status"` -} - -// NewExcludedUsersUpdateResult returns a new ExcludedUsersUpdateResult instance -func NewExcludedUsersUpdateResult(Status *ExcludedUsersUpdateStatus) *ExcludedUsersUpdateResult { - s := new(ExcludedUsersUpdateResult) - s.Status = Status - return s -} - -// ExcludedUsersUpdateStatus : Excluded users update operation status. -type ExcludedUsersUpdateStatus struct { - dropbox.Tagged -} - -// Valid tag values for ExcludedUsersUpdateStatus -const ( - ExcludedUsersUpdateStatusSuccess = "success" - ExcludedUsersUpdateStatusOther = "other" -) - -// Feature : A set of features that a Dropbox Business account may support. -type Feature struct { - dropbox.Tagged -} - -// Valid tag values for Feature -const ( - FeatureUploadApiRateLimit = "upload_api_rate_limit" - FeatureHasTeamSharedDropbox = "has_team_shared_dropbox" - FeatureHasTeamFileEvents = "has_team_file_events" - FeatureHasTeamSelectiveSync = "has_team_selective_sync" - FeatureOther = "other" -) - -// FeatureValue : The values correspond to entries in `Feature`. You may get -// different value according to your Dropbox Business plan. -type FeatureValue struct { - dropbox.Tagged - // UploadApiRateLimit : has no documentation (yet) - UploadApiRateLimit *UploadApiRateLimitValue `json:"upload_api_rate_limit,omitempty"` - // HasTeamSharedDropbox : has no documentation (yet) - HasTeamSharedDropbox *HasTeamSharedDropboxValue `json:"has_team_shared_dropbox,omitempty"` - // HasTeamFileEvents : has no documentation (yet) - HasTeamFileEvents *HasTeamFileEventsValue `json:"has_team_file_events,omitempty"` - // HasTeamSelectiveSync : has no documentation (yet) - HasTeamSelectiveSync *HasTeamSelectiveSyncValue `json:"has_team_selective_sync,omitempty"` -} - -// Valid tag values for FeatureValue -const ( - FeatureValueUploadApiRateLimit = "upload_api_rate_limit" - FeatureValueHasTeamSharedDropbox = "has_team_shared_dropbox" - FeatureValueHasTeamFileEvents = "has_team_file_events" - FeatureValueHasTeamSelectiveSync = "has_team_selective_sync" - FeatureValueOther = "other" -) - -// UnmarshalJSON deserializes into a FeatureValue instance -func (u *FeatureValue) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // UploadApiRateLimit : has no documentation (yet) - UploadApiRateLimit *UploadApiRateLimitValue `json:"upload_api_rate_limit,omitempty"` - // HasTeamSharedDropbox : has no documentation (yet) - HasTeamSharedDropbox *HasTeamSharedDropboxValue `json:"has_team_shared_dropbox,omitempty"` - // HasTeamFileEvents : has no documentation (yet) - HasTeamFileEvents *HasTeamFileEventsValue `json:"has_team_file_events,omitempty"` - // HasTeamSelectiveSync : has no documentation (yet) - HasTeamSelectiveSync *HasTeamSelectiveSyncValue `json:"has_team_selective_sync,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "upload_api_rate_limit": - u.UploadApiRateLimit = w.UploadApiRateLimit - - if err != nil { - return err - } - case "has_team_shared_dropbox": - u.HasTeamSharedDropbox = w.HasTeamSharedDropbox - - if err != nil { - return err - } - case "has_team_file_events": - u.HasTeamFileEvents = w.HasTeamFileEvents - - if err != nil { - return err - } - case "has_team_selective_sync": - u.HasTeamSelectiveSync = w.HasTeamSelectiveSync - - if err != nil { - return err - } - } - return nil -} - -// FeaturesGetValuesBatchArg : has no documentation (yet) -type FeaturesGetValuesBatchArg struct { - // Features : A list of features in `Feature`. If the list is empty, this - // route will return `FeaturesGetValuesBatchError`. - Features []*Feature `json:"features"` -} - -// NewFeaturesGetValuesBatchArg returns a new FeaturesGetValuesBatchArg instance -func NewFeaturesGetValuesBatchArg(Features []*Feature) *FeaturesGetValuesBatchArg { - s := new(FeaturesGetValuesBatchArg) - s.Features = Features - return s -} - -// FeaturesGetValuesBatchError : has no documentation (yet) -type FeaturesGetValuesBatchError struct { - dropbox.Tagged -} - -// Valid tag values for FeaturesGetValuesBatchError -const ( - FeaturesGetValuesBatchErrorEmptyFeaturesList = "empty_features_list" - FeaturesGetValuesBatchErrorOther = "other" -) - -// FeaturesGetValuesBatchResult : has no documentation (yet) -type FeaturesGetValuesBatchResult struct { - // Values : has no documentation (yet) - Values []*FeatureValue `json:"values"` -} - -// NewFeaturesGetValuesBatchResult returns a new FeaturesGetValuesBatchResult instance -func NewFeaturesGetValuesBatchResult(Values []*FeatureValue) *FeaturesGetValuesBatchResult { - s := new(FeaturesGetValuesBatchResult) - s.Values = Values - return s -} - -// GetActivityReport : Activity Report Result. Each of the items in the storage -// report is an array of values, one value per day. If there is no data for a -// day, then the value will be None. -type GetActivityReport struct { - BaseDfbReport - // Adds : Array of total number of adds by team members. - Adds []uint64 `json:"adds"` - // Edits : Array of number of edits by team members. If the same user edits - // the same file multiple times this is counted as a single edit. - Edits []uint64 `json:"edits"` - // Deletes : Array of total number of deletes by team members. - Deletes []uint64 `json:"deletes"` - // ActiveUsers28Day : Array of the number of users who have been active in - // the last 28 days. - ActiveUsers28Day []uint64 `json:"active_users_28_day"` - // ActiveUsers7Day : Array of the number of users who have been active in - // the last week. - ActiveUsers7Day []uint64 `json:"active_users_7_day"` - // ActiveUsers1Day : Array of the number of users who have been active in - // the last day. - ActiveUsers1Day []uint64 `json:"active_users_1_day"` - // ActiveSharedFolders28Day : Array of the number of shared folders with - // some activity in the last 28 days. - ActiveSharedFolders28Day []uint64 `json:"active_shared_folders_28_day"` - // ActiveSharedFolders7Day : Array of the number of shared folders with some - // activity in the last week. - ActiveSharedFolders7Day []uint64 `json:"active_shared_folders_7_day"` - // ActiveSharedFolders1Day : Array of the number of shared folders with some - // activity in the last day. - ActiveSharedFolders1Day []uint64 `json:"active_shared_folders_1_day"` - // SharedLinksCreated : Array of the number of shared links created. - SharedLinksCreated []uint64 `json:"shared_links_created"` - // SharedLinksViewedByTeam : Array of the number of views by team users to - // shared links created by the team. - SharedLinksViewedByTeam []uint64 `json:"shared_links_viewed_by_team"` - // SharedLinksViewedByOutsideUser : Array of the number of views by users - // outside of the team to shared links created by the team. - SharedLinksViewedByOutsideUser []uint64 `json:"shared_links_viewed_by_outside_user"` - // SharedLinksViewedByNotLoggedIn : Array of the number of views by - // non-logged-in users to shared links created by the team. - SharedLinksViewedByNotLoggedIn []uint64 `json:"shared_links_viewed_by_not_logged_in"` - // SharedLinksViewedTotal : Array of the total number of views to shared - // links created by the team. - SharedLinksViewedTotal []uint64 `json:"shared_links_viewed_total"` -} - -// NewGetActivityReport returns a new GetActivityReport instance -func NewGetActivityReport(StartDate string, Adds []uint64, Edits []uint64, Deletes []uint64, ActiveUsers28Day []uint64, ActiveUsers7Day []uint64, ActiveUsers1Day []uint64, ActiveSharedFolders28Day []uint64, ActiveSharedFolders7Day []uint64, ActiveSharedFolders1Day []uint64, SharedLinksCreated []uint64, SharedLinksViewedByTeam []uint64, SharedLinksViewedByOutsideUser []uint64, SharedLinksViewedByNotLoggedIn []uint64, SharedLinksViewedTotal []uint64) *GetActivityReport { - s := new(GetActivityReport) - s.StartDate = StartDate - s.Adds = Adds - s.Edits = Edits - s.Deletes = Deletes - s.ActiveUsers28Day = ActiveUsers28Day - s.ActiveUsers7Day = ActiveUsers7Day - s.ActiveUsers1Day = ActiveUsers1Day - s.ActiveSharedFolders28Day = ActiveSharedFolders28Day - s.ActiveSharedFolders7Day = ActiveSharedFolders7Day - s.ActiveSharedFolders1Day = ActiveSharedFolders1Day - s.SharedLinksCreated = SharedLinksCreated - s.SharedLinksViewedByTeam = SharedLinksViewedByTeam - s.SharedLinksViewedByOutsideUser = SharedLinksViewedByOutsideUser - s.SharedLinksViewedByNotLoggedIn = SharedLinksViewedByNotLoggedIn - s.SharedLinksViewedTotal = SharedLinksViewedTotal - return s -} - -// GetDevicesReport : Devices Report Result. Contains subsections for different -// time ranges of activity. Each of the items in each subsection of the storage -// report is an array of values, one value per day. If there is no data for a -// day, then the value will be None. -type GetDevicesReport struct { - BaseDfbReport - // Active1Day : Report of the number of devices active in the last day. - Active1Day *DevicesActive `json:"active_1_day"` - // Active7Day : Report of the number of devices active in the last 7 days. - Active7Day *DevicesActive `json:"active_7_day"` - // Active28Day : Report of the number of devices active in the last 28 days. - Active28Day *DevicesActive `json:"active_28_day"` -} - -// NewGetDevicesReport returns a new GetDevicesReport instance -func NewGetDevicesReport(StartDate string, Active1Day *DevicesActive, Active7Day *DevicesActive, Active28Day *DevicesActive) *GetDevicesReport { - s := new(GetDevicesReport) - s.StartDate = StartDate - s.Active1Day = Active1Day - s.Active7Day = Active7Day - s.Active28Day = Active28Day - return s -} - -// GetMembershipReport : Membership Report Result. Each of the items in the -// storage report is an array of values, one value per day. If there is no data -// for a day, then the value will be None. -type GetMembershipReport struct { - BaseDfbReport - // TeamSize : Team size, for each day. - TeamSize []uint64 `json:"team_size"` - // PendingInvites : The number of pending invites to the team, for each day. - PendingInvites []uint64 `json:"pending_invites"` - // MembersJoined : The number of members that joined the team, for each day. - MembersJoined []uint64 `json:"members_joined"` - // SuspendedMembers : The number of suspended team members, for each day. - SuspendedMembers []uint64 `json:"suspended_members"` - // Licenses : The total number of licenses the team has, for each day. - Licenses []uint64 `json:"licenses"` -} - -// NewGetMembershipReport returns a new GetMembershipReport instance -func NewGetMembershipReport(StartDate string, TeamSize []uint64, PendingInvites []uint64, MembersJoined []uint64, SuspendedMembers []uint64, Licenses []uint64) *GetMembershipReport { - s := new(GetMembershipReport) - s.StartDate = StartDate - s.TeamSize = TeamSize - s.PendingInvites = PendingInvites - s.MembersJoined = MembersJoined - s.SuspendedMembers = SuspendedMembers - s.Licenses = Licenses - return s -} - -// GetStorageReport : Storage Report Result. Each of the items in the storage -// report is an array of values, one value per day. If there is no data for a -// day, then the value will be None. -type GetStorageReport struct { - BaseDfbReport - // TotalUsage : Sum of the shared, unshared, and datastore usages, for each - // day. - TotalUsage []uint64 `json:"total_usage"` - // SharedUsage : Array of the combined size (bytes) of team members' shared - // folders, for each day. - SharedUsage []uint64 `json:"shared_usage"` - // UnsharedUsage : Array of the combined size (bytes) of team members' root - // namespaces, for each day. - UnsharedUsage []uint64 `json:"unshared_usage"` - // SharedFolders : Array of the number of shared folders owned by team - // members, for each day. - SharedFolders []uint64 `json:"shared_folders"` - // MemberStorageMap : Array of storage summaries of team members' account - // sizes. Each storage summary is an array of key, value pairs, where each - // pair describes a storage bucket. The key indicates the upper bound of the - // bucket and the value is the number of users in that bucket. There is one - // such summary per day. If there is no data for a day, the storage summary - // will be empty. - MemberStorageMap [][]*StorageBucket `json:"member_storage_map"` -} - -// NewGetStorageReport returns a new GetStorageReport instance -func NewGetStorageReport(StartDate string, TotalUsage []uint64, SharedUsage []uint64, UnsharedUsage []uint64, SharedFolders []uint64, MemberStorageMap [][]*StorageBucket) *GetStorageReport { - s := new(GetStorageReport) - s.StartDate = StartDate - s.TotalUsage = TotalUsage - s.SharedUsage = SharedUsage - s.UnsharedUsage = UnsharedUsage - s.SharedFolders = SharedFolders - s.MemberStorageMap = MemberStorageMap - return s -} - -// GroupAccessType : Role of a user in group. -type GroupAccessType struct { - dropbox.Tagged -} - -// Valid tag values for GroupAccessType -const ( - GroupAccessTypeMember = "member" - GroupAccessTypeOwner = "owner" -) - -// GroupCreateArg : has no documentation (yet) -type GroupCreateArg struct { - // GroupName : Group name. - GroupName string `json:"group_name"` - // GroupExternalId : The creator of a team can associate an arbitrary - // external ID to the group. - GroupExternalId string `json:"group_external_id,omitempty"` - // GroupManagementType : Whether the team can be managed by selected users, - // or only by team admins. - GroupManagementType *team_common.GroupManagementType `json:"group_management_type,omitempty"` -} - -// NewGroupCreateArg returns a new GroupCreateArg instance -func NewGroupCreateArg(GroupName string) *GroupCreateArg { - s := new(GroupCreateArg) - s.GroupName = GroupName - return s -} - -// GroupCreateError : has no documentation (yet) -type GroupCreateError struct { - dropbox.Tagged -} - -// Valid tag values for GroupCreateError -const ( - GroupCreateErrorGroupNameAlreadyUsed = "group_name_already_used" - GroupCreateErrorGroupNameInvalid = "group_name_invalid" - GroupCreateErrorExternalIdAlreadyInUse = "external_id_already_in_use" - GroupCreateErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupCreateErrorOther = "other" -) - -// GroupSelectorError : Error that can be raised when `GroupSelector` is used. -type GroupSelectorError struct { - dropbox.Tagged -} - -// Valid tag values for GroupSelectorError -const ( - GroupSelectorErrorGroupNotFound = "group_not_found" - GroupSelectorErrorOther = "other" -) - -// GroupSelectorWithTeamGroupError : Error that can be raised when -// `GroupSelector` is used and team groups are disallowed from being used. -type GroupSelectorWithTeamGroupError struct { - dropbox.Tagged -} - -// Valid tag values for GroupSelectorWithTeamGroupError -const ( - GroupSelectorWithTeamGroupErrorGroupNotFound = "group_not_found" - GroupSelectorWithTeamGroupErrorOther = "other" - GroupSelectorWithTeamGroupErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" -) - -// GroupDeleteError : has no documentation (yet) -type GroupDeleteError struct { - dropbox.Tagged -} - -// Valid tag values for GroupDeleteError -const ( - GroupDeleteErrorGroupNotFound = "group_not_found" - GroupDeleteErrorOther = "other" - GroupDeleteErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupDeleteErrorGroupAlreadyDeleted = "group_already_deleted" -) - -// GroupFullInfo : Full description of a group. -type GroupFullInfo struct { - team_common.GroupSummary - // Members : List of group members. - Members []*GroupMemberInfo `json:"members,omitempty"` - // Created : The group creation time as a UTC timestamp in milliseconds - // since the Unix epoch. - Created uint64 `json:"created"` -} - -// NewGroupFullInfo returns a new GroupFullInfo instance -func NewGroupFullInfo(GroupName string, GroupId string, GroupManagementType *team_common.GroupManagementType, Created uint64) *GroupFullInfo { - s := new(GroupFullInfo) - s.GroupName = GroupName - s.GroupId = GroupId - s.GroupManagementType = GroupManagementType - s.Created = Created - return s -} - -// GroupMemberInfo : Profile of group member, and role in group. -type GroupMemberInfo struct { - // Profile : Profile of group member. - Profile *MemberProfile `json:"profile"` - // AccessType : The role that the user has in the group. - AccessType *GroupAccessType `json:"access_type"` -} - -// NewGroupMemberInfo returns a new GroupMemberInfo instance -func NewGroupMemberInfo(Profile *MemberProfile, AccessType *GroupAccessType) *GroupMemberInfo { - s := new(GroupMemberInfo) - s.Profile = Profile - s.AccessType = AccessType - return s -} - -// GroupMemberSelector : Argument for selecting a group and a single user. -type GroupMemberSelector struct { - // Group : Specify a group. - Group *GroupSelector `json:"group"` - // User : Identity of a user that is a member of `group`. - User *UserSelectorArg `json:"user"` -} - -// NewGroupMemberSelector returns a new GroupMemberSelector instance -func NewGroupMemberSelector(Group *GroupSelector, User *UserSelectorArg) *GroupMemberSelector { - s := new(GroupMemberSelector) - s.Group = Group - s.User = User - return s -} - -// GroupMemberSelectorError : Error that can be raised when -// `GroupMemberSelector` is used, and the user is required to be a member of the -// specified group. -type GroupMemberSelectorError struct { - dropbox.Tagged -} - -// Valid tag values for GroupMemberSelectorError -const ( - GroupMemberSelectorErrorGroupNotFound = "group_not_found" - GroupMemberSelectorErrorOther = "other" - GroupMemberSelectorErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupMemberSelectorErrorMemberNotInGroup = "member_not_in_group" -) - -// GroupMemberSetAccessTypeError : has no documentation (yet) -type GroupMemberSetAccessTypeError struct { - dropbox.Tagged -} - -// Valid tag values for GroupMemberSetAccessTypeError -const ( - GroupMemberSetAccessTypeErrorGroupNotFound = "group_not_found" - GroupMemberSetAccessTypeErrorOther = "other" - GroupMemberSetAccessTypeErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupMemberSetAccessTypeErrorMemberNotInGroup = "member_not_in_group" - GroupMemberSetAccessTypeErrorUserCannotBeManagerOfCompanyManagedGroup = "user_cannot_be_manager_of_company_managed_group" -) - -// IncludeMembersArg : has no documentation (yet) -type IncludeMembersArg struct { - // ReturnMembers : Whether to return the list of members in the group. Note - // that the default value will cause all the group members to be returned - // in the response. This may take a long time for large groups. - ReturnMembers bool `json:"return_members"` -} - -// NewIncludeMembersArg returns a new IncludeMembersArg instance -func NewIncludeMembersArg() *IncludeMembersArg { - s := new(IncludeMembersArg) - s.ReturnMembers = true - return s -} - -// GroupMembersAddArg : has no documentation (yet) -type GroupMembersAddArg struct { - IncludeMembersArg - // Group : Group to which users will be added. - Group *GroupSelector `json:"group"` - // Members : List of users to be added to the group. - Members []*MemberAccess `json:"members"` -} - -// NewGroupMembersAddArg returns a new GroupMembersAddArg instance -func NewGroupMembersAddArg(Group *GroupSelector, Members []*MemberAccess) *GroupMembersAddArg { - s := new(GroupMembersAddArg) - s.Group = Group - s.Members = Members - s.ReturnMembers = true - return s -} - -// GroupMembersAddError : has no documentation (yet) -type GroupMembersAddError struct { - dropbox.Tagged - // MembersNotInTeam : These members are not part of your team. Currently, - // you cannot add members to a group if they are not part of your team, - // though this may change in a subsequent version. To add new members to - // your Dropbox Business team, use the `membersAdd` endpoint. - MembersNotInTeam []string `json:"members_not_in_team,omitempty"` - // UsersNotFound : These users were not found in Dropbox. - UsersNotFound []string `json:"users_not_found,omitempty"` - // UserCannotBeManagerOfCompanyManagedGroup : A company-managed group cannot - // be managed by a user. - UserCannotBeManagerOfCompanyManagedGroup []string `json:"user_cannot_be_manager_of_company_managed_group,omitempty"` -} - -// Valid tag values for GroupMembersAddError -const ( - GroupMembersAddErrorGroupNotFound = "group_not_found" - GroupMembersAddErrorOther = "other" - GroupMembersAddErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupMembersAddErrorDuplicateUser = "duplicate_user" - GroupMembersAddErrorGroupNotInTeam = "group_not_in_team" - GroupMembersAddErrorMembersNotInTeam = "members_not_in_team" - GroupMembersAddErrorUsersNotFound = "users_not_found" - GroupMembersAddErrorUserMustBeActiveToBeOwner = "user_must_be_active_to_be_owner" - GroupMembersAddErrorUserCannotBeManagerOfCompanyManagedGroup = "user_cannot_be_manager_of_company_managed_group" -) - -// UnmarshalJSON deserializes into a GroupMembersAddError instance -func (u *GroupMembersAddError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // MembersNotInTeam : These members are not part of your team. - // Currently, you cannot add members to a group if they are not part of - // your team, though this may change in a subsequent version. To add new - // members to your Dropbox Business team, use the `membersAdd` endpoint. - MembersNotInTeam []string `json:"members_not_in_team,omitempty"` - // UsersNotFound : These users were not found in Dropbox. - UsersNotFound []string `json:"users_not_found,omitempty"` - // UserCannotBeManagerOfCompanyManagedGroup : A company-managed group - // cannot be managed by a user. - UserCannotBeManagerOfCompanyManagedGroup []string `json:"user_cannot_be_manager_of_company_managed_group,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "members_not_in_team": - u.MembersNotInTeam = w.MembersNotInTeam - - if err != nil { - return err - } - case "users_not_found": - u.UsersNotFound = w.UsersNotFound - - if err != nil { - return err - } - case "user_cannot_be_manager_of_company_managed_group": - u.UserCannotBeManagerOfCompanyManagedGroup = w.UserCannotBeManagerOfCompanyManagedGroup - - if err != nil { - return err - } - } - return nil -} - -// GroupMembersChangeResult : Result returned by `groupsMembersAdd` and -// `groupsMembersRemove`. -type GroupMembersChangeResult struct { - // GroupInfo : The group info after member change operation has been - // performed. - GroupInfo *GroupFullInfo `json:"group_info"` - // AsyncJobId : An ID that can be used to obtain the status of - // granting/revoking group-owned resources. - AsyncJobId string `json:"async_job_id"` -} - -// NewGroupMembersChangeResult returns a new GroupMembersChangeResult instance -func NewGroupMembersChangeResult(GroupInfo *GroupFullInfo, AsyncJobId string) *GroupMembersChangeResult { - s := new(GroupMembersChangeResult) - s.GroupInfo = GroupInfo - s.AsyncJobId = AsyncJobId - return s -} - -// GroupMembersRemoveArg : has no documentation (yet) -type GroupMembersRemoveArg struct { - IncludeMembersArg - // Group : Group from which users will be removed. - Group *GroupSelector `json:"group"` - // Users : List of users to be removed from the group. - Users []*UserSelectorArg `json:"users"` -} - -// NewGroupMembersRemoveArg returns a new GroupMembersRemoveArg instance -func NewGroupMembersRemoveArg(Group *GroupSelector, Users []*UserSelectorArg) *GroupMembersRemoveArg { - s := new(GroupMembersRemoveArg) - s.Group = Group - s.Users = Users - s.ReturnMembers = true - return s -} - -// GroupMembersSelectorError : Error that can be raised when -// `GroupMembersSelector` is used, and the users are required to be members of -// the specified group. -type GroupMembersSelectorError struct { - dropbox.Tagged -} - -// Valid tag values for GroupMembersSelectorError -const ( - GroupMembersSelectorErrorGroupNotFound = "group_not_found" - GroupMembersSelectorErrorOther = "other" - GroupMembersSelectorErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupMembersSelectorErrorMemberNotInGroup = "member_not_in_group" -) - -// GroupMembersRemoveError : has no documentation (yet) -type GroupMembersRemoveError struct { - dropbox.Tagged - // MembersNotInTeam : These members are not part of your team. - MembersNotInTeam []string `json:"members_not_in_team,omitempty"` - // UsersNotFound : These users were not found in Dropbox. - UsersNotFound []string `json:"users_not_found,omitempty"` -} - -// Valid tag values for GroupMembersRemoveError -const ( - GroupMembersRemoveErrorGroupNotFound = "group_not_found" - GroupMembersRemoveErrorOther = "other" - GroupMembersRemoveErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupMembersRemoveErrorMemberNotInGroup = "member_not_in_group" - GroupMembersRemoveErrorGroupNotInTeam = "group_not_in_team" - GroupMembersRemoveErrorMembersNotInTeam = "members_not_in_team" - GroupMembersRemoveErrorUsersNotFound = "users_not_found" -) - -// UnmarshalJSON deserializes into a GroupMembersRemoveError instance -func (u *GroupMembersRemoveError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // MembersNotInTeam : These members are not part of your team. - MembersNotInTeam []string `json:"members_not_in_team,omitempty"` - // UsersNotFound : These users were not found in Dropbox. - UsersNotFound []string `json:"users_not_found,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "members_not_in_team": - u.MembersNotInTeam = w.MembersNotInTeam - - if err != nil { - return err - } - case "users_not_found": - u.UsersNotFound = w.UsersNotFound - - if err != nil { - return err - } - } - return nil -} - -// GroupMembersSelector : Argument for selecting a group and a list of users. -type GroupMembersSelector struct { - // Group : Specify a group. - Group *GroupSelector `json:"group"` - // Users : A list of users that are members of `group`. - Users *UsersSelectorArg `json:"users"` -} - -// NewGroupMembersSelector returns a new GroupMembersSelector instance -func NewGroupMembersSelector(Group *GroupSelector, Users *UsersSelectorArg) *GroupMembersSelector { - s := new(GroupMembersSelector) - s.Group = Group - s.Users = Users - return s -} - -// GroupMembersSetAccessTypeArg : has no documentation (yet) -type GroupMembersSetAccessTypeArg struct { - GroupMemberSelector - // AccessType : New group access type the user will have. - AccessType *GroupAccessType `json:"access_type"` - // ReturnMembers : Whether to return the list of members in the group. Note - // that the default value will cause all the group members to be returned - // in the response. This may take a long time for large groups. - ReturnMembers bool `json:"return_members"` -} - -// NewGroupMembersSetAccessTypeArg returns a new GroupMembersSetAccessTypeArg instance -func NewGroupMembersSetAccessTypeArg(Group *GroupSelector, User *UserSelectorArg, AccessType *GroupAccessType) *GroupMembersSetAccessTypeArg { - s := new(GroupMembersSetAccessTypeArg) - s.Group = Group - s.User = User - s.AccessType = AccessType - s.ReturnMembers = true - return s -} - -// GroupSelector : Argument for selecting a single group, either by group_id or -// by external group ID. -type GroupSelector struct { - dropbox.Tagged - // GroupId : Group ID. - GroupId string `json:"group_id,omitempty"` - // GroupExternalId : External ID of the group. - GroupExternalId string `json:"group_external_id,omitempty"` -} - -// Valid tag values for GroupSelector -const ( - GroupSelectorGroupId = "group_id" - GroupSelectorGroupExternalId = "group_external_id" -) - -// UnmarshalJSON deserializes into a GroupSelector instance -func (u *GroupSelector) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // GroupId : Group ID. - GroupId string `json:"group_id,omitempty"` - // GroupExternalId : External ID of the group. - GroupExternalId string `json:"group_external_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "group_id": - u.GroupId = w.GroupId - - if err != nil { - return err - } - case "group_external_id": - u.GroupExternalId = w.GroupExternalId - - if err != nil { - return err - } - } - return nil -} - -// GroupUpdateArgs : has no documentation (yet) -type GroupUpdateArgs struct { - IncludeMembersArg - // Group : Specify a group. - Group *GroupSelector `json:"group"` - // NewGroupName : Optional argument. Set group name to this if provided. - NewGroupName string `json:"new_group_name,omitempty"` - // NewGroupExternalId : Optional argument. New group external ID. If the - // argument is None, the group's external_id won't be updated. If the - // argument is empty string, the group's external id will be cleared. - NewGroupExternalId string `json:"new_group_external_id,omitempty"` - // NewGroupManagementType : Set new group management type, if provided. - NewGroupManagementType *team_common.GroupManagementType `json:"new_group_management_type,omitempty"` -} - -// NewGroupUpdateArgs returns a new GroupUpdateArgs instance -func NewGroupUpdateArgs(Group *GroupSelector) *GroupUpdateArgs { - s := new(GroupUpdateArgs) - s.Group = Group - s.ReturnMembers = true - return s -} - -// GroupUpdateError : has no documentation (yet) -type GroupUpdateError struct { - dropbox.Tagged -} - -// Valid tag values for GroupUpdateError -const ( - GroupUpdateErrorGroupNotFound = "group_not_found" - GroupUpdateErrorOther = "other" - GroupUpdateErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" - GroupUpdateErrorGroupNameAlreadyUsed = "group_name_already_used" - GroupUpdateErrorGroupNameInvalid = "group_name_invalid" - GroupUpdateErrorExternalIdAlreadyInUse = "external_id_already_in_use" -) - -// GroupsGetInfoError : has no documentation (yet) -type GroupsGetInfoError struct { - dropbox.Tagged -} - -// Valid tag values for GroupsGetInfoError -const ( - GroupsGetInfoErrorGroupNotOnTeam = "group_not_on_team" - GroupsGetInfoErrorOther = "other" -) - -// GroupsGetInfoItem : has no documentation (yet) -type GroupsGetInfoItem struct { - dropbox.Tagged - // IdNotFound : An ID that was provided as a parameter to `groupsGetInfo`, - // and did not match a corresponding group. The ID can be a group ID, or an - // external ID, depending on how the method was called. - IdNotFound string `json:"id_not_found,omitempty"` - // GroupInfo : Info about a group. - GroupInfo *GroupFullInfo `json:"group_info,omitempty"` -} - -// Valid tag values for GroupsGetInfoItem -const ( - GroupsGetInfoItemIdNotFound = "id_not_found" - GroupsGetInfoItemGroupInfo = "group_info" -) - -// UnmarshalJSON deserializes into a GroupsGetInfoItem instance -func (u *GroupsGetInfoItem) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // IdNotFound : An ID that was provided as a parameter to - // `groupsGetInfo`, and did not match a corresponding group. The ID can - // be a group ID, or an external ID, depending on how the method was - // called. - IdNotFound string `json:"id_not_found,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "id_not_found": - u.IdNotFound = w.IdNotFound - - if err != nil { - return err - } - case "group_info": - err = json.Unmarshal(body, &u.GroupInfo) - - if err != nil { - return err - } - } - return nil -} - -// GroupsListArg : has no documentation (yet) -type GroupsListArg struct { - // Limit : Number of results to return per call. - Limit uint32 `json:"limit"` -} - -// NewGroupsListArg returns a new GroupsListArg instance -func NewGroupsListArg() *GroupsListArg { - s := new(GroupsListArg) - s.Limit = 1000 - return s -} - -// GroupsListContinueArg : has no documentation (yet) -type GroupsListContinueArg struct { - // Cursor : Indicates from what point to get the next set of groups. - Cursor string `json:"cursor"` -} - -// NewGroupsListContinueArg returns a new GroupsListContinueArg instance -func NewGroupsListContinueArg(Cursor string) *GroupsListContinueArg { - s := new(GroupsListContinueArg) - s.Cursor = Cursor - return s -} - -// GroupsListContinueError : has no documentation (yet) -type GroupsListContinueError struct { - dropbox.Tagged -} - -// Valid tag values for GroupsListContinueError -const ( - GroupsListContinueErrorInvalidCursor = "invalid_cursor" - GroupsListContinueErrorOther = "other" -) - -// GroupsListResult : has no documentation (yet) -type GroupsListResult struct { - // Groups : has no documentation (yet) - Groups []*team_common.GroupSummary `json:"groups"` - // Cursor : Pass the cursor into `groupsListContinue` to obtain the - // additional groups. - Cursor string `json:"cursor"` - // HasMore : Is true if there are additional groups that have not been - // returned yet. An additional call to `groupsListContinue` can retrieve - // them. - HasMore bool `json:"has_more"` -} - -// NewGroupsListResult returns a new GroupsListResult instance -func NewGroupsListResult(Groups []*team_common.GroupSummary, Cursor string, HasMore bool) *GroupsListResult { - s := new(GroupsListResult) - s.Groups = Groups - s.Cursor = Cursor - s.HasMore = HasMore - return s -} - -// GroupsMembersListArg : has no documentation (yet) -type GroupsMembersListArg struct { - // Group : The group whose members are to be listed. - Group *GroupSelector `json:"group"` - // Limit : Number of results to return per call. - Limit uint32 `json:"limit"` -} - -// NewGroupsMembersListArg returns a new GroupsMembersListArg instance -func NewGroupsMembersListArg(Group *GroupSelector) *GroupsMembersListArg { - s := new(GroupsMembersListArg) - s.Group = Group - s.Limit = 1000 - return s -} - -// GroupsMembersListContinueArg : has no documentation (yet) -type GroupsMembersListContinueArg struct { - // Cursor : Indicates from what point to get the next set of groups. - Cursor string `json:"cursor"` -} - -// NewGroupsMembersListContinueArg returns a new GroupsMembersListContinueArg instance -func NewGroupsMembersListContinueArg(Cursor string) *GroupsMembersListContinueArg { - s := new(GroupsMembersListContinueArg) - s.Cursor = Cursor - return s -} - -// GroupsMembersListContinueError : has no documentation (yet) -type GroupsMembersListContinueError struct { - dropbox.Tagged -} - -// Valid tag values for GroupsMembersListContinueError -const ( - GroupsMembersListContinueErrorInvalidCursor = "invalid_cursor" - GroupsMembersListContinueErrorOther = "other" -) - -// GroupsMembersListResult : has no documentation (yet) -type GroupsMembersListResult struct { - // Members : has no documentation (yet) - Members []*GroupMemberInfo `json:"members"` - // Cursor : Pass the cursor into `groupsMembersListContinue` to obtain - // additional group members. - Cursor string `json:"cursor"` - // HasMore : Is true if there are additional group members that have not - // been returned yet. An additional call to `groupsMembersListContinue` can - // retrieve them. - HasMore bool `json:"has_more"` -} - -// NewGroupsMembersListResult returns a new GroupsMembersListResult instance -func NewGroupsMembersListResult(Members []*GroupMemberInfo, Cursor string, HasMore bool) *GroupsMembersListResult { - s := new(GroupsMembersListResult) - s.Members = Members - s.Cursor = Cursor - s.HasMore = HasMore - return s -} - -// GroupsPollError : has no documentation (yet) -type GroupsPollError struct { - dropbox.Tagged -} - -// Valid tag values for GroupsPollError -const ( - GroupsPollErrorInvalidAsyncJobId = "invalid_async_job_id" - GroupsPollErrorInternalError = "internal_error" - GroupsPollErrorOther = "other" - GroupsPollErrorAccessDenied = "access_denied" -) - -// GroupsSelector : Argument for selecting a list of groups, either by -// group_ids, or external group IDs. -type GroupsSelector struct { - dropbox.Tagged - // GroupIds : List of group IDs. - GroupIds []string `json:"group_ids,omitempty"` - // GroupExternalIds : List of external IDs of groups. - GroupExternalIds []string `json:"group_external_ids,omitempty"` -} - -// Valid tag values for GroupsSelector -const ( - GroupsSelectorGroupIds = "group_ids" - GroupsSelectorGroupExternalIds = "group_external_ids" -) - -// UnmarshalJSON deserializes into a GroupsSelector instance -func (u *GroupsSelector) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // GroupIds : List of group IDs. - GroupIds []string `json:"group_ids,omitempty"` - // GroupExternalIds : List of external IDs of groups. - GroupExternalIds []string `json:"group_external_ids,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "group_ids": - u.GroupIds = w.GroupIds - - if err != nil { - return err - } - case "group_external_ids": - u.GroupExternalIds = w.GroupExternalIds - - if err != nil { - return err - } - } - return nil -} - -// HasTeamFileEventsValue : The value for `Feature.has_team_file_events`. -type HasTeamFileEventsValue struct { - dropbox.Tagged - // Enabled : Does this team have file events. - Enabled bool `json:"enabled,omitempty"` -} - -// Valid tag values for HasTeamFileEventsValue -const ( - HasTeamFileEventsValueEnabled = "enabled" - HasTeamFileEventsValueOther = "other" -) - -// UnmarshalJSON deserializes into a HasTeamFileEventsValue instance -func (u *HasTeamFileEventsValue) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Enabled : Does this team have file events. - Enabled bool `json:"enabled,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "enabled": - u.Enabled = w.Enabled - - if err != nil { - return err - } - } - return nil -} - -// HasTeamSelectiveSyncValue : The value for `Feature.has_team_selective_sync`. -type HasTeamSelectiveSyncValue struct { - dropbox.Tagged - // HasTeamSelectiveSync : Does this team have team selective sync enabled. - HasTeamSelectiveSync bool `json:"has_team_selective_sync,omitempty"` -} - -// Valid tag values for HasTeamSelectiveSyncValue -const ( - HasTeamSelectiveSyncValueHasTeamSelectiveSync = "has_team_selective_sync" - HasTeamSelectiveSyncValueOther = "other" -) - -// UnmarshalJSON deserializes into a HasTeamSelectiveSyncValue instance -func (u *HasTeamSelectiveSyncValue) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // HasTeamSelectiveSync : Does this team have team selective sync - // enabled. - HasTeamSelectiveSync bool `json:"has_team_selective_sync,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "has_team_selective_sync": - u.HasTeamSelectiveSync = w.HasTeamSelectiveSync - - if err != nil { - return err - } - } - return nil -} - -// HasTeamSharedDropboxValue : The value for `Feature.has_team_shared_dropbox`. -type HasTeamSharedDropboxValue struct { - dropbox.Tagged - // HasTeamSharedDropbox : Does this team have a shared team root. - HasTeamSharedDropbox bool `json:"has_team_shared_dropbox,omitempty"` -} - -// Valid tag values for HasTeamSharedDropboxValue -const ( - HasTeamSharedDropboxValueHasTeamSharedDropbox = "has_team_shared_dropbox" - HasTeamSharedDropboxValueOther = "other" -) - -// UnmarshalJSON deserializes into a HasTeamSharedDropboxValue instance -func (u *HasTeamSharedDropboxValue) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // HasTeamSharedDropbox : Does this team have a shared team root. - HasTeamSharedDropbox bool `json:"has_team_shared_dropbox,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "has_team_shared_dropbox": - u.HasTeamSharedDropbox = w.HasTeamSharedDropbox - - if err != nil { - return err - } - } - return nil -} - -// ListMemberAppsArg : has no documentation (yet) -type ListMemberAppsArg struct { - // TeamMemberId : The team member id. - TeamMemberId string `json:"team_member_id"` -} - -// NewListMemberAppsArg returns a new ListMemberAppsArg instance -func NewListMemberAppsArg(TeamMemberId string) *ListMemberAppsArg { - s := new(ListMemberAppsArg) - s.TeamMemberId = TeamMemberId - return s -} - -// ListMemberAppsError : Error returned by `linkedAppsListMemberLinkedApps`. -type ListMemberAppsError struct { - dropbox.Tagged -} - -// Valid tag values for ListMemberAppsError -const ( - ListMemberAppsErrorMemberNotFound = "member_not_found" - ListMemberAppsErrorOther = "other" -) - -// ListMemberAppsResult : has no documentation (yet) -type ListMemberAppsResult struct { - // LinkedApiApps : List of third party applications linked by this team - // member. - LinkedApiApps []*ApiApp `json:"linked_api_apps"` -} - -// NewListMemberAppsResult returns a new ListMemberAppsResult instance -func NewListMemberAppsResult(LinkedApiApps []*ApiApp) *ListMemberAppsResult { - s := new(ListMemberAppsResult) - s.LinkedApiApps = LinkedApiApps - return s -} - -// ListMemberDevicesArg : has no documentation (yet) -type ListMemberDevicesArg struct { - // TeamMemberId : The team's member id. - TeamMemberId string `json:"team_member_id"` - // IncludeWebSessions : Whether to list web sessions of the team's member. - IncludeWebSessions bool `json:"include_web_sessions"` - // IncludeDesktopClients : Whether to list linked desktop devices of the - // team's member. - IncludeDesktopClients bool `json:"include_desktop_clients"` - // IncludeMobileClients : Whether to list linked mobile devices of the - // team's member. - IncludeMobileClients bool `json:"include_mobile_clients"` -} - -// NewListMemberDevicesArg returns a new ListMemberDevicesArg instance -func NewListMemberDevicesArg(TeamMemberId string) *ListMemberDevicesArg { - s := new(ListMemberDevicesArg) - s.TeamMemberId = TeamMemberId - s.IncludeWebSessions = true - s.IncludeDesktopClients = true - s.IncludeMobileClients = true - return s -} - -// ListMemberDevicesError : has no documentation (yet) -type ListMemberDevicesError struct { - dropbox.Tagged -} - -// Valid tag values for ListMemberDevicesError -const ( - ListMemberDevicesErrorMemberNotFound = "member_not_found" - ListMemberDevicesErrorOther = "other" -) - -// ListMemberDevicesResult : has no documentation (yet) -type ListMemberDevicesResult struct { - // ActiveWebSessions : List of web sessions made by this team member. - ActiveWebSessions []*ActiveWebSession `json:"active_web_sessions,omitempty"` - // DesktopClientSessions : List of desktop clients used by this team member. - DesktopClientSessions []*DesktopClientSession `json:"desktop_client_sessions,omitempty"` - // MobileClientSessions : List of mobile client used by this team member. - MobileClientSessions []*MobileClientSession `json:"mobile_client_sessions,omitempty"` -} - -// NewListMemberDevicesResult returns a new ListMemberDevicesResult instance -func NewListMemberDevicesResult() *ListMemberDevicesResult { - s := new(ListMemberDevicesResult) - return s -} - -// ListMembersAppsArg : Arguments for `linkedAppsListMembersLinkedApps`. -type ListMembersAppsArg struct { - // Cursor : At the first call to the `linkedAppsListMembersLinkedApps` the - // cursor shouldn't be passed. Then, if the result of the call includes a - // cursor, the following requests should include the received cursors in - // order to receive the next sub list of the team applications. - Cursor string `json:"cursor,omitempty"` -} - -// NewListMembersAppsArg returns a new ListMembersAppsArg instance -func NewListMembersAppsArg() *ListMembersAppsArg { - s := new(ListMembersAppsArg) - return s -} - -// ListMembersAppsError : Error returned by `linkedAppsListMembersLinkedApps`. -type ListMembersAppsError struct { - dropbox.Tagged -} - -// Valid tag values for ListMembersAppsError -const ( - ListMembersAppsErrorReset = "reset" - ListMembersAppsErrorOther = "other" -) - -// ListMembersAppsResult : Information returned by -// `linkedAppsListMembersLinkedApps`. -type ListMembersAppsResult struct { - // Apps : The linked applications of each member of the team. - Apps []*MemberLinkedApps `json:"apps"` - // HasMore : If true, then there are more apps available. Pass the cursor to - // `linkedAppsListMembersLinkedApps` to retrieve the rest. - HasMore bool `json:"has_more"` - // Cursor : Pass the cursor into `linkedAppsListMembersLinkedApps` to - // receive the next sub list of team's applications. - Cursor string `json:"cursor,omitempty"` -} - -// NewListMembersAppsResult returns a new ListMembersAppsResult instance -func NewListMembersAppsResult(Apps []*MemberLinkedApps, HasMore bool) *ListMembersAppsResult { - s := new(ListMembersAppsResult) - s.Apps = Apps - s.HasMore = HasMore - return s -} - -// ListMembersDevicesArg : has no documentation (yet) -type ListMembersDevicesArg struct { - // Cursor : At the first call to the `devicesListMembersDevices` the cursor - // shouldn't be passed. Then, if the result of the call includes a cursor, - // the following requests should include the received cursors in order to - // receive the next sub list of team devices. - Cursor string `json:"cursor,omitempty"` - // IncludeWebSessions : Whether to list web sessions of the team members. - IncludeWebSessions bool `json:"include_web_sessions"` - // IncludeDesktopClients : Whether to list desktop clients of the team - // members. - IncludeDesktopClients bool `json:"include_desktop_clients"` - // IncludeMobileClients : Whether to list mobile clients of the team - // members. - IncludeMobileClients bool `json:"include_mobile_clients"` -} - -// NewListMembersDevicesArg returns a new ListMembersDevicesArg instance -func NewListMembersDevicesArg() *ListMembersDevicesArg { - s := new(ListMembersDevicesArg) - s.IncludeWebSessions = true - s.IncludeDesktopClients = true - s.IncludeMobileClients = true - return s -} - -// ListMembersDevicesError : has no documentation (yet) -type ListMembersDevicesError struct { - dropbox.Tagged -} - -// Valid tag values for ListMembersDevicesError -const ( - ListMembersDevicesErrorReset = "reset" - ListMembersDevicesErrorOther = "other" -) - -// ListMembersDevicesResult : has no documentation (yet) -type ListMembersDevicesResult struct { - // Devices : The devices of each member of the team. - Devices []*MemberDevices `json:"devices"` - // HasMore : If true, then there are more devices available. Pass the cursor - // to `devicesListMembersDevices` to retrieve the rest. - HasMore bool `json:"has_more"` - // Cursor : Pass the cursor into `devicesListMembersDevices` to receive the - // next sub list of team's devices. - Cursor string `json:"cursor,omitempty"` -} - -// NewListMembersDevicesResult returns a new ListMembersDevicesResult instance -func NewListMembersDevicesResult(Devices []*MemberDevices, HasMore bool) *ListMembersDevicesResult { - s := new(ListMembersDevicesResult) - s.Devices = Devices - s.HasMore = HasMore - return s -} - -// ListTeamAppsArg : Arguments for `linkedAppsListTeamLinkedApps`. -type ListTeamAppsArg struct { - // Cursor : At the first call to the `linkedAppsListTeamLinkedApps` the - // cursor shouldn't be passed. Then, if the result of the call includes a - // cursor, the following requests should include the received cursors in - // order to receive the next sub list of the team applications. - Cursor string `json:"cursor,omitempty"` -} - -// NewListTeamAppsArg returns a new ListTeamAppsArg instance -func NewListTeamAppsArg() *ListTeamAppsArg { - s := new(ListTeamAppsArg) - return s -} - -// ListTeamAppsError : Error returned by `linkedAppsListTeamLinkedApps`. -type ListTeamAppsError struct { - dropbox.Tagged -} - -// Valid tag values for ListTeamAppsError -const ( - ListTeamAppsErrorReset = "reset" - ListTeamAppsErrorOther = "other" -) - -// ListTeamAppsResult : Information returned by `linkedAppsListTeamLinkedApps`. -type ListTeamAppsResult struct { - // Apps : The linked applications of each member of the team. - Apps []*MemberLinkedApps `json:"apps"` - // HasMore : If true, then there are more apps available. Pass the cursor to - // `linkedAppsListTeamLinkedApps` to retrieve the rest. - HasMore bool `json:"has_more"` - // Cursor : Pass the cursor into `linkedAppsListTeamLinkedApps` to receive - // the next sub list of team's applications. - Cursor string `json:"cursor,omitempty"` -} - -// NewListTeamAppsResult returns a new ListTeamAppsResult instance -func NewListTeamAppsResult(Apps []*MemberLinkedApps, HasMore bool) *ListTeamAppsResult { - s := new(ListTeamAppsResult) - s.Apps = Apps - s.HasMore = HasMore - return s -} - -// ListTeamDevicesArg : has no documentation (yet) -type ListTeamDevicesArg struct { - // Cursor : At the first call to the `devicesListTeamDevices` the cursor - // shouldn't be passed. Then, if the result of the call includes a cursor, - // the following requests should include the received cursors in order to - // receive the next sub list of team devices. - Cursor string `json:"cursor,omitempty"` - // IncludeWebSessions : Whether to list web sessions of the team members. - IncludeWebSessions bool `json:"include_web_sessions"` - // IncludeDesktopClients : Whether to list desktop clients of the team - // members. - IncludeDesktopClients bool `json:"include_desktop_clients"` - // IncludeMobileClients : Whether to list mobile clients of the team - // members. - IncludeMobileClients bool `json:"include_mobile_clients"` -} - -// NewListTeamDevicesArg returns a new ListTeamDevicesArg instance -func NewListTeamDevicesArg() *ListTeamDevicesArg { - s := new(ListTeamDevicesArg) - s.IncludeWebSessions = true - s.IncludeDesktopClients = true - s.IncludeMobileClients = true - return s -} - -// ListTeamDevicesError : has no documentation (yet) -type ListTeamDevicesError struct { - dropbox.Tagged -} - -// Valid tag values for ListTeamDevicesError -const ( - ListTeamDevicesErrorReset = "reset" - ListTeamDevicesErrorOther = "other" -) - -// ListTeamDevicesResult : has no documentation (yet) -type ListTeamDevicesResult struct { - // Devices : The devices of each member of the team. - Devices []*MemberDevices `json:"devices"` - // HasMore : If true, then there are more devices available. Pass the cursor - // to `devicesListTeamDevices` to retrieve the rest. - HasMore bool `json:"has_more"` - // Cursor : Pass the cursor into `devicesListTeamDevices` to receive the - // next sub list of team's devices. - Cursor string `json:"cursor,omitempty"` -} - -// NewListTeamDevicesResult returns a new ListTeamDevicesResult instance -func NewListTeamDevicesResult(Devices []*MemberDevices, HasMore bool) *ListTeamDevicesResult { - s := new(ListTeamDevicesResult) - s.Devices = Devices - s.HasMore = HasMore - return s -} - -// MemberAccess : Specify access type a member should have when joined to a -// group. -type MemberAccess struct { - // User : Identity of a user. - User *UserSelectorArg `json:"user"` - // AccessType : Access type. - AccessType *GroupAccessType `json:"access_type"` -} - -// NewMemberAccess returns a new MemberAccess instance -func NewMemberAccess(User *UserSelectorArg, AccessType *GroupAccessType) *MemberAccess { - s := new(MemberAccess) - s.User = User - s.AccessType = AccessType - return s -} - -// MemberAddArg : has no documentation (yet) -type MemberAddArg struct { - // MemberEmail : has no documentation (yet) - MemberEmail string `json:"member_email"` - // MemberGivenName : Member's first name. - MemberGivenName string `json:"member_given_name,omitempty"` - // MemberSurname : Member's last name. - MemberSurname string `json:"member_surname,omitempty"` - // MemberExternalId : External ID for member. - MemberExternalId string `json:"member_external_id,omitempty"` - // MemberPersistentId : Persistent ID for member. This field is only - // available to teams using persistent ID SAML configuration. - MemberPersistentId string `json:"member_persistent_id,omitempty"` - // SendWelcomeEmail : Whether to send a welcome email to the member. If - // send_welcome_email is false, no email invitation will be sent to the - // user. This may be useful for apps using single sign-on (SSO) flows for - // onboarding that want to handle announcements themselves. - SendWelcomeEmail bool `json:"send_welcome_email"` - // Role : has no documentation (yet) - Role *AdminTier `json:"role"` - // IsDirectoryRestricted : Whether a user is directory restricted. - IsDirectoryRestricted bool `json:"is_directory_restricted,omitempty"` -} - -// NewMemberAddArg returns a new MemberAddArg instance -func NewMemberAddArg(MemberEmail string) *MemberAddArg { - s := new(MemberAddArg) - s.MemberEmail = MemberEmail - s.SendWelcomeEmail = true - s.Role = &AdminTier{Tagged: dropbox.Tagged{"member_only"}} - return s -} - -// MemberAddResult : Describes the result of attempting to add a single user to -// the team. 'success' is the only value indicating that a user was indeed added -// to the team - the other values explain the type of failure that occurred, and -// include the email of the user for which the operation has failed. -type MemberAddResult struct { - dropbox.Tagged - // Success : Describes a user that was successfully added to the team. - Success *TeamMemberInfo `json:"success,omitempty"` - // TeamLicenseLimit : Team is already full. The organization has no - // available licenses. - TeamLicenseLimit string `json:"team_license_limit,omitempty"` - // FreeTeamMemberLimitReached : Team is already full. The free team member - // limit has been reached. - FreeTeamMemberLimitReached string `json:"free_team_member_limit_reached,omitempty"` - // UserAlreadyOnTeam : User is already on this team. The provided email - // address is associated with a user who is already a member of (including - // in recoverable state) or invited to the team. - UserAlreadyOnTeam string `json:"user_already_on_team,omitempty"` - // UserOnAnotherTeam : User is already on another team. The provided email - // address is associated with a user that is already a member or invited to - // another team. - UserOnAnotherTeam string `json:"user_on_another_team,omitempty"` - // UserAlreadyPaired : User is already paired. - UserAlreadyPaired string `json:"user_already_paired,omitempty"` - // UserMigrationFailed : User migration has failed. - UserMigrationFailed string `json:"user_migration_failed,omitempty"` - // DuplicateExternalMemberId : A user with the given external member ID - // already exists on the team (including in recoverable state). - DuplicateExternalMemberId string `json:"duplicate_external_member_id,omitempty"` - // DuplicateMemberPersistentId : A user with the given persistent ID already - // exists on the team (including in recoverable state). - DuplicateMemberPersistentId string `json:"duplicate_member_persistent_id,omitempty"` - // PersistentIdDisabled : Persistent ID is only available to teams with - // persistent ID SAML configuration. Please contact Dropbox for more - // information. - PersistentIdDisabled string `json:"persistent_id_disabled,omitempty"` - // UserCreationFailed : User creation has failed. - UserCreationFailed string `json:"user_creation_failed,omitempty"` -} - -// Valid tag values for MemberAddResult -const ( - MemberAddResultSuccess = "success" - MemberAddResultTeamLicenseLimit = "team_license_limit" - MemberAddResultFreeTeamMemberLimitReached = "free_team_member_limit_reached" - MemberAddResultUserAlreadyOnTeam = "user_already_on_team" - MemberAddResultUserOnAnotherTeam = "user_on_another_team" - MemberAddResultUserAlreadyPaired = "user_already_paired" - MemberAddResultUserMigrationFailed = "user_migration_failed" - MemberAddResultDuplicateExternalMemberId = "duplicate_external_member_id" - MemberAddResultDuplicateMemberPersistentId = "duplicate_member_persistent_id" - MemberAddResultPersistentIdDisabled = "persistent_id_disabled" - MemberAddResultUserCreationFailed = "user_creation_failed" -) - -// UnmarshalJSON deserializes into a MemberAddResult instance -func (u *MemberAddResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TeamLicenseLimit : Team is already full. The organization has no - // available licenses. - TeamLicenseLimit string `json:"team_license_limit,omitempty"` - // FreeTeamMemberLimitReached : Team is already full. The free team - // member limit has been reached. - FreeTeamMemberLimitReached string `json:"free_team_member_limit_reached,omitempty"` - // UserAlreadyOnTeam : User is already on this team. The provided email - // address is associated with a user who is already a member of - // (including in recoverable state) or invited to the team. - UserAlreadyOnTeam string `json:"user_already_on_team,omitempty"` - // UserOnAnotherTeam : User is already on another team. The provided - // email address is associated with a user that is already a member or - // invited to another team. - UserOnAnotherTeam string `json:"user_on_another_team,omitempty"` - // UserAlreadyPaired : User is already paired. - UserAlreadyPaired string `json:"user_already_paired,omitempty"` - // UserMigrationFailed : User migration has failed. - UserMigrationFailed string `json:"user_migration_failed,omitempty"` - // DuplicateExternalMemberId : A user with the given external member ID - // already exists on the team (including in recoverable state). - DuplicateExternalMemberId string `json:"duplicate_external_member_id,omitempty"` - // DuplicateMemberPersistentId : A user with the given persistent ID - // already exists on the team (including in recoverable state). - DuplicateMemberPersistentId string `json:"duplicate_member_persistent_id,omitempty"` - // PersistentIdDisabled : Persistent ID is only available to teams with - // persistent ID SAML configuration. Please contact Dropbox for more - // information. - PersistentIdDisabled string `json:"persistent_id_disabled,omitempty"` - // UserCreationFailed : User creation has failed. - UserCreationFailed string `json:"user_creation_failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - err = json.Unmarshal(body, &u.Success) - - if err != nil { - return err - } - case "team_license_limit": - u.TeamLicenseLimit = w.TeamLicenseLimit - - if err != nil { - return err - } - case "free_team_member_limit_reached": - u.FreeTeamMemberLimitReached = w.FreeTeamMemberLimitReached - - if err != nil { - return err - } - case "user_already_on_team": - u.UserAlreadyOnTeam = w.UserAlreadyOnTeam - - if err != nil { - return err - } - case "user_on_another_team": - u.UserOnAnotherTeam = w.UserOnAnotherTeam - - if err != nil { - return err - } - case "user_already_paired": - u.UserAlreadyPaired = w.UserAlreadyPaired - - if err != nil { - return err - } - case "user_migration_failed": - u.UserMigrationFailed = w.UserMigrationFailed - - if err != nil { - return err - } - case "duplicate_external_member_id": - u.DuplicateExternalMemberId = w.DuplicateExternalMemberId - - if err != nil { - return err - } - case "duplicate_member_persistent_id": - u.DuplicateMemberPersistentId = w.DuplicateMemberPersistentId - - if err != nil { - return err - } - case "persistent_id_disabled": - u.PersistentIdDisabled = w.PersistentIdDisabled - - if err != nil { - return err - } - case "user_creation_failed": - u.UserCreationFailed = w.UserCreationFailed - - if err != nil { - return err - } - } - return nil -} - -// MemberDevices : Information on devices of a team's member. -type MemberDevices struct { - // TeamMemberId : The member unique Id. - TeamMemberId string `json:"team_member_id"` - // WebSessions : List of web sessions made by this team member. - WebSessions []*ActiveWebSession `json:"web_sessions,omitempty"` - // DesktopClients : List of desktop clients by this team member. - DesktopClients []*DesktopClientSession `json:"desktop_clients,omitempty"` - // MobileClients : List of mobile clients by this team member. - MobileClients []*MobileClientSession `json:"mobile_clients,omitempty"` -} - -// NewMemberDevices returns a new MemberDevices instance -func NewMemberDevices(TeamMemberId string) *MemberDevices { - s := new(MemberDevices) - s.TeamMemberId = TeamMemberId - return s -} - -// MemberLinkedApps : Information on linked applications of a team member. -type MemberLinkedApps struct { - // TeamMemberId : The member unique Id. - TeamMemberId string `json:"team_member_id"` - // LinkedApiApps : List of third party applications linked by this team - // member. - LinkedApiApps []*ApiApp `json:"linked_api_apps"` -} - -// NewMemberLinkedApps returns a new MemberLinkedApps instance -func NewMemberLinkedApps(TeamMemberId string, LinkedApiApps []*ApiApp) *MemberLinkedApps { - s := new(MemberLinkedApps) - s.TeamMemberId = TeamMemberId - s.LinkedApiApps = LinkedApiApps - return s -} - -// MemberProfile : Basic member profile. -type MemberProfile struct { - // TeamMemberId : ID of user as a member of a team. - TeamMemberId string `json:"team_member_id"` - // ExternalId : External ID that a team can attach to the user. An - // application using the API may find it easier to use their own IDs instead - // of Dropbox IDs like account_id or team_member_id. - ExternalId string `json:"external_id,omitempty"` - // AccountId : A user's account identifier. - AccountId string `json:"account_id,omitempty"` - // Email : Email address of user. - Email string `json:"email"` - // EmailVerified : Is true if the user's email is verified to be owned by - // the user. - EmailVerified bool `json:"email_verified"` - // Status : The user's status as a member of a specific team. - Status *TeamMemberStatus `json:"status"` - // Name : Representations for a person's name. - Name *users.Name `json:"name"` - // MembershipType : The user's membership type: full (normal team member) vs - // limited (does not use a license; no access to the team's shared quota). - MembershipType *TeamMembershipType `json:"membership_type"` - // JoinedOn : The date and time the user joined as a member of a specific - // team. - JoinedOn time.Time `json:"joined_on,omitempty"` - // SuspendedOn : The date and time the user was suspended from the team - // (contains value only when the member's status matches - // `TeamMemberStatus.suspended`. - SuspendedOn time.Time `json:"suspended_on,omitempty"` - // PersistentId : Persistent ID that a team can attach to the user. The - // persistent ID is unique ID to be used for SAML authentication. - PersistentId string `json:"persistent_id,omitempty"` - // IsDirectoryRestricted : Whether the user is a directory restricted user. - IsDirectoryRestricted bool `json:"is_directory_restricted,omitempty"` - // ProfilePhotoUrl : URL for the photo representing the user, if one is set. - ProfilePhotoUrl string `json:"profile_photo_url,omitempty"` -} - -// NewMemberProfile returns a new MemberProfile instance -func NewMemberProfile(TeamMemberId string, Email string, EmailVerified bool, Status *TeamMemberStatus, Name *users.Name, MembershipType *TeamMembershipType) *MemberProfile { - s := new(MemberProfile) - s.TeamMemberId = TeamMemberId - s.Email = Email - s.EmailVerified = EmailVerified - s.Status = Status - s.Name = Name - s.MembershipType = MembershipType - return s -} - -// UserSelectorError : Error that can be returned whenever a struct derived from -// `UserSelectorArg` is used. -type UserSelectorError struct { - dropbox.Tagged -} - -// Valid tag values for UserSelectorError -const ( - UserSelectorErrorUserNotFound = "user_not_found" -) - -// MemberSelectorError : has no documentation (yet) -type MemberSelectorError struct { - dropbox.Tagged -} - -// Valid tag values for MemberSelectorError -const ( - MemberSelectorErrorUserNotFound = "user_not_found" - MemberSelectorErrorUserNotInTeam = "user_not_in_team" -) - -// MembersAddArg : has no documentation (yet) -type MembersAddArg struct { - // NewMembers : Details of new members to be added to the team. - NewMembers []*MemberAddArg `json:"new_members"` - // ForceAsync : Whether to force the add to happen asynchronously. - ForceAsync bool `json:"force_async"` -} - -// NewMembersAddArg returns a new MembersAddArg instance -func NewMembersAddArg(NewMembers []*MemberAddArg) *MembersAddArg { - s := new(MembersAddArg) - s.NewMembers = NewMembers - s.ForceAsync = false - return s -} - -// MembersAddJobStatus : has no documentation (yet) -type MembersAddJobStatus struct { - dropbox.Tagged - // Complete : The asynchronous job has finished. For each member that was - // specified in the parameter `MembersAddArg` that was provided to - // `membersAdd`, a corresponding item is returned in this list. - Complete []*MemberAddResult `json:"complete,omitempty"` - // Failed : The asynchronous job returned an error. The string contains an - // error message. - Failed string `json:"failed,omitempty"` -} - -// Valid tag values for MembersAddJobStatus -const ( - MembersAddJobStatusInProgress = "in_progress" - MembersAddJobStatusComplete = "complete" - MembersAddJobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a MembersAddJobStatus instance -func (u *MembersAddJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Complete : The asynchronous job has finished. For each member that - // was specified in the parameter `MembersAddArg` that was provided to - // `membersAdd`, a corresponding item is returned in this list. - Complete []*MemberAddResult `json:"complete,omitempty"` - // Failed : The asynchronous job returned an error. The string contains - // an error message. - Failed string `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - u.Complete = w.Complete - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// MembersAddLaunch : has no documentation (yet) -type MembersAddLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete []*MemberAddResult `json:"complete,omitempty"` -} - -// Valid tag values for MembersAddLaunch -const ( - MembersAddLaunchAsyncJobId = "async_job_id" - MembersAddLaunchComplete = "complete" -) - -// UnmarshalJSON deserializes into a MembersAddLaunch instance -func (u *MembersAddLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete []*MemberAddResult `json:"complete,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - u.Complete = w.Complete - - if err != nil { - return err - } - } - return nil -} - -// MembersDeactivateBaseArg : Exactly one of team_member_id, email, or -// external_id must be provided to identify the user account. -type MembersDeactivateBaseArg struct { - // User : Identity of user to remove/suspend/have their files moved. - User *UserSelectorArg `json:"user"` -} - -// NewMembersDeactivateBaseArg returns a new MembersDeactivateBaseArg instance -func NewMembersDeactivateBaseArg(User *UserSelectorArg) *MembersDeactivateBaseArg { - s := new(MembersDeactivateBaseArg) - s.User = User - return s -} - -// MembersDataTransferArg : has no documentation (yet) -type MembersDataTransferArg struct { - MembersDeactivateBaseArg - // TransferDestId : Files from the deleted member account will be - // transferred to this user. - TransferDestId *UserSelectorArg `json:"transfer_dest_id"` - // TransferAdminId : Errors during the transfer process will be sent via - // email to this user. - TransferAdminId *UserSelectorArg `json:"transfer_admin_id"` -} - -// NewMembersDataTransferArg returns a new MembersDataTransferArg instance -func NewMembersDataTransferArg(User *UserSelectorArg, TransferDestId *UserSelectorArg, TransferAdminId *UserSelectorArg) *MembersDataTransferArg { - s := new(MembersDataTransferArg) - s.User = User - s.TransferDestId = TransferDestId - s.TransferAdminId = TransferAdminId - return s -} - -// MembersDeactivateArg : has no documentation (yet) -type MembersDeactivateArg struct { - MembersDeactivateBaseArg - // WipeData : If provided, controls if the user's data will be deleted on - // their linked devices. - WipeData bool `json:"wipe_data"` -} - -// NewMembersDeactivateArg returns a new MembersDeactivateArg instance -func NewMembersDeactivateArg(User *UserSelectorArg) *MembersDeactivateArg { - s := new(MembersDeactivateArg) - s.User = User - s.WipeData = true - return s -} - -// MembersDeactivateError : has no documentation (yet) -type MembersDeactivateError struct { - dropbox.Tagged -} - -// Valid tag values for MembersDeactivateError -const ( - MembersDeactivateErrorUserNotFound = "user_not_found" - MembersDeactivateErrorUserNotInTeam = "user_not_in_team" - MembersDeactivateErrorOther = "other" -) - -// MembersGetInfoArgs : has no documentation (yet) -type MembersGetInfoArgs struct { - // Members : List of team members. - Members []*UserSelectorArg `json:"members"` -} - -// NewMembersGetInfoArgs returns a new MembersGetInfoArgs instance -func NewMembersGetInfoArgs(Members []*UserSelectorArg) *MembersGetInfoArgs { - s := new(MembersGetInfoArgs) - s.Members = Members - return s -} - -// MembersGetInfoError : -type MembersGetInfoError struct { - dropbox.Tagged -} - -// Valid tag values for MembersGetInfoError -const ( - MembersGetInfoErrorOther = "other" -) - -// MembersGetInfoItem : Describes a result obtained for a single user whose id -// was specified in the parameter of `membersGetInfo`. -type MembersGetInfoItem struct { - dropbox.Tagged - // IdNotFound : An ID that was provided as a parameter to `membersGetInfo`, - // and did not match a corresponding user. This might be a team_member_id, - // an email, or an external ID, depending on how the method was called. - IdNotFound string `json:"id_not_found,omitempty"` - // MemberInfo : Info about a team member. - MemberInfo *TeamMemberInfo `json:"member_info,omitempty"` -} - -// Valid tag values for MembersGetInfoItem -const ( - MembersGetInfoItemIdNotFound = "id_not_found" - MembersGetInfoItemMemberInfo = "member_info" -) - -// UnmarshalJSON deserializes into a MembersGetInfoItem instance -func (u *MembersGetInfoItem) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // IdNotFound : An ID that was provided as a parameter to - // `membersGetInfo`, and did not match a corresponding user. This might - // be a team_member_id, an email, or an external ID, depending on how - // the method was called. - IdNotFound string `json:"id_not_found,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "id_not_found": - u.IdNotFound = w.IdNotFound - - if err != nil { - return err - } - case "member_info": - err = json.Unmarshal(body, &u.MemberInfo) - - if err != nil { - return err - } - } - return nil -} - -// MembersListArg : has no documentation (yet) -type MembersListArg struct { - // Limit : Number of results to return per call. - Limit uint32 `json:"limit"` - // IncludeRemoved : Whether to return removed members. - IncludeRemoved bool `json:"include_removed"` -} - -// NewMembersListArg returns a new MembersListArg instance -func NewMembersListArg() *MembersListArg { - s := new(MembersListArg) - s.Limit = 1000 - s.IncludeRemoved = false - return s -} - -// MembersListContinueArg : has no documentation (yet) -type MembersListContinueArg struct { - // Cursor : Indicates from what point to get the next set of members. - Cursor string `json:"cursor"` -} - -// NewMembersListContinueArg returns a new MembersListContinueArg instance -func NewMembersListContinueArg(Cursor string) *MembersListContinueArg { - s := new(MembersListContinueArg) - s.Cursor = Cursor - return s -} - -// MembersListContinueError : has no documentation (yet) -type MembersListContinueError struct { - dropbox.Tagged -} - -// Valid tag values for MembersListContinueError -const ( - MembersListContinueErrorInvalidCursor = "invalid_cursor" - MembersListContinueErrorOther = "other" -) - -// MembersListError : -type MembersListError struct { - dropbox.Tagged -} - -// Valid tag values for MembersListError -const ( - MembersListErrorOther = "other" -) - -// MembersListResult : has no documentation (yet) -type MembersListResult struct { - // Members : List of team members. - Members []*TeamMemberInfo `json:"members"` - // Cursor : Pass the cursor into `membersListContinue` to obtain the - // additional members. - Cursor string `json:"cursor"` - // HasMore : Is true if there are additional team members that have not been - // returned yet. An additional call to `membersListContinue` can retrieve - // them. - HasMore bool `json:"has_more"` -} - -// NewMembersListResult returns a new MembersListResult instance -func NewMembersListResult(Members []*TeamMemberInfo, Cursor string, HasMore bool) *MembersListResult { - s := new(MembersListResult) - s.Members = Members - s.Cursor = Cursor - s.HasMore = HasMore - return s -} - -// MembersRecoverArg : Exactly one of team_member_id, email, or external_id must -// be provided to identify the user account. -type MembersRecoverArg struct { - // User : Identity of user to recover. - User *UserSelectorArg `json:"user"` -} - -// NewMembersRecoverArg returns a new MembersRecoverArg instance -func NewMembersRecoverArg(User *UserSelectorArg) *MembersRecoverArg { - s := new(MembersRecoverArg) - s.User = User - return s -} - -// MembersRecoverError : has no documentation (yet) -type MembersRecoverError struct { - dropbox.Tagged -} - -// Valid tag values for MembersRecoverError -const ( - MembersRecoverErrorUserNotFound = "user_not_found" - MembersRecoverErrorUserUnrecoverable = "user_unrecoverable" - MembersRecoverErrorUserNotInTeam = "user_not_in_team" - MembersRecoverErrorTeamLicenseLimit = "team_license_limit" - MembersRecoverErrorOther = "other" -) - -// MembersRemoveArg : has no documentation (yet) -type MembersRemoveArg struct { - MembersDeactivateArg - // TransferDestId : If provided, files from the deleted member account will - // be transferred to this user. - TransferDestId *UserSelectorArg `json:"transfer_dest_id,omitempty"` - // TransferAdminId : If provided, errors during the transfer process will be - // sent via email to this user. If the transfer_dest_id argument was - // provided, then this argument must be provided as well. - TransferAdminId *UserSelectorArg `json:"transfer_admin_id,omitempty"` - // KeepAccount : Downgrade the member to a Basic account. The user will - // retain the email address associated with their Dropbox account and data - // in their account that is not restricted to team members. In order to keep - // the account the argument wipe_data should be set to False. - KeepAccount bool `json:"keep_account"` -} - -// NewMembersRemoveArg returns a new MembersRemoveArg instance -func NewMembersRemoveArg(User *UserSelectorArg) *MembersRemoveArg { - s := new(MembersRemoveArg) - s.User = User - s.WipeData = true - s.KeepAccount = false - return s -} - -// MembersTransferFilesError : has no documentation (yet) -type MembersTransferFilesError struct { - dropbox.Tagged -} - -// Valid tag values for MembersTransferFilesError -const ( - MembersTransferFilesErrorUserNotFound = "user_not_found" - MembersTransferFilesErrorUserNotInTeam = "user_not_in_team" - MembersTransferFilesErrorOther = "other" - MembersTransferFilesErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ" - MembersTransferFilesErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ" - MembersTransferFilesErrorTransferDestUserNotFound = "transfer_dest_user_not_found" - MembersTransferFilesErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team" - MembersTransferFilesErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team" - MembersTransferFilesErrorTransferAdminUserNotFound = "transfer_admin_user_not_found" - MembersTransferFilesErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id" - MembersTransferFilesErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin" - MembersTransferFilesErrorRecipientNotVerified = "recipient_not_verified" -) - -// MembersRemoveError : has no documentation (yet) -type MembersRemoveError struct { - dropbox.Tagged -} - -// Valid tag values for MembersRemoveError -const ( - MembersRemoveErrorUserNotFound = "user_not_found" - MembersRemoveErrorUserNotInTeam = "user_not_in_team" - MembersRemoveErrorOther = "other" - MembersRemoveErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ" - MembersRemoveErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ" - MembersRemoveErrorTransferDestUserNotFound = "transfer_dest_user_not_found" - MembersRemoveErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team" - MembersRemoveErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team" - MembersRemoveErrorTransferAdminUserNotFound = "transfer_admin_user_not_found" - MembersRemoveErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id" - MembersRemoveErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin" - MembersRemoveErrorRecipientNotVerified = "recipient_not_verified" - MembersRemoveErrorRemoveLastAdmin = "remove_last_admin" - MembersRemoveErrorCannotKeepAccountAndTransfer = "cannot_keep_account_and_transfer" - MembersRemoveErrorCannotKeepAccountAndDeleteData = "cannot_keep_account_and_delete_data" - MembersRemoveErrorEmailAddressTooLongToBeDisabled = "email_address_too_long_to_be_disabled" - MembersRemoveErrorCannotKeepInvitedUserAccount = "cannot_keep_invited_user_account" -) - -// MembersSendWelcomeError : -type MembersSendWelcomeError struct { - dropbox.Tagged -} - -// Valid tag values for MembersSendWelcomeError -const ( - MembersSendWelcomeErrorUserNotFound = "user_not_found" - MembersSendWelcomeErrorUserNotInTeam = "user_not_in_team" - MembersSendWelcomeErrorOther = "other" -) - -// MembersSetPermissionsArg : Exactly one of team_member_id, email, or -// external_id must be provided to identify the user account. -type MembersSetPermissionsArg struct { - // User : Identity of user whose role will be set. - User *UserSelectorArg `json:"user"` - // NewRole : The new role of the member. - NewRole *AdminTier `json:"new_role"` -} - -// NewMembersSetPermissionsArg returns a new MembersSetPermissionsArg instance -func NewMembersSetPermissionsArg(User *UserSelectorArg, NewRole *AdminTier) *MembersSetPermissionsArg { - s := new(MembersSetPermissionsArg) - s.User = User - s.NewRole = NewRole - return s -} - -// MembersSetPermissionsError : has no documentation (yet) -type MembersSetPermissionsError struct { - dropbox.Tagged -} - -// Valid tag values for MembersSetPermissionsError -const ( - MembersSetPermissionsErrorUserNotFound = "user_not_found" - MembersSetPermissionsErrorLastAdmin = "last_admin" - MembersSetPermissionsErrorUserNotInTeam = "user_not_in_team" - MembersSetPermissionsErrorCannotSetPermissions = "cannot_set_permissions" - MembersSetPermissionsErrorTeamLicenseLimit = "team_license_limit" - MembersSetPermissionsErrorOther = "other" -) - -// MembersSetPermissionsResult : has no documentation (yet) -type MembersSetPermissionsResult struct { - // TeamMemberId : The member ID of the user to which the change was applied. - TeamMemberId string `json:"team_member_id"` - // Role : The role after the change. - Role *AdminTier `json:"role"` -} - -// NewMembersSetPermissionsResult returns a new MembersSetPermissionsResult instance -func NewMembersSetPermissionsResult(TeamMemberId string, Role *AdminTier) *MembersSetPermissionsResult { - s := new(MembersSetPermissionsResult) - s.TeamMemberId = TeamMemberId - s.Role = Role - return s -} - -// MembersSetProfileArg : Exactly one of team_member_id, email, or external_id -// must be provided to identify the user account. At least one of new_email, -// new_external_id, new_given_name, and/or new_surname must be provided. -type MembersSetProfileArg struct { - // User : Identity of user whose profile will be set. - User *UserSelectorArg `json:"user"` - // NewEmail : New email for member. - NewEmail string `json:"new_email,omitempty"` - // NewExternalId : New external ID for member. - NewExternalId string `json:"new_external_id,omitempty"` - // NewGivenName : New given name for member. - NewGivenName string `json:"new_given_name,omitempty"` - // NewSurname : New surname for member. - NewSurname string `json:"new_surname,omitempty"` - // NewPersistentId : New persistent ID. This field only available to teams - // using persistent ID SAML configuration. - NewPersistentId string `json:"new_persistent_id,omitempty"` - // NewIsDirectoryRestricted : New value for whether the user is a directory - // restricted user. - NewIsDirectoryRestricted bool `json:"new_is_directory_restricted,omitempty"` -} - -// NewMembersSetProfileArg returns a new MembersSetProfileArg instance -func NewMembersSetProfileArg(User *UserSelectorArg) *MembersSetProfileArg { - s := new(MembersSetProfileArg) - s.User = User - return s -} - -// MembersSetProfileError : has no documentation (yet) -type MembersSetProfileError struct { - dropbox.Tagged -} - -// Valid tag values for MembersSetProfileError -const ( - MembersSetProfileErrorUserNotFound = "user_not_found" - MembersSetProfileErrorUserNotInTeam = "user_not_in_team" - MembersSetProfileErrorExternalIdAndNewExternalIdUnsafe = "external_id_and_new_external_id_unsafe" - MembersSetProfileErrorNoNewDataSpecified = "no_new_data_specified" - MembersSetProfileErrorEmailReservedForOtherUser = "email_reserved_for_other_user" - MembersSetProfileErrorExternalIdUsedByOtherUser = "external_id_used_by_other_user" - MembersSetProfileErrorSetProfileDisallowed = "set_profile_disallowed" - MembersSetProfileErrorParamCannotBeEmpty = "param_cannot_be_empty" - MembersSetProfileErrorPersistentIdDisabled = "persistent_id_disabled" - MembersSetProfileErrorPersistentIdUsedByOtherUser = "persistent_id_used_by_other_user" - MembersSetProfileErrorDirectoryRestrictedOff = "directory_restricted_off" - MembersSetProfileErrorOther = "other" -) - -// MembersSuspendError : has no documentation (yet) -type MembersSuspendError struct { - dropbox.Tagged -} - -// Valid tag values for MembersSuspendError -const ( - MembersSuspendErrorUserNotFound = "user_not_found" - MembersSuspendErrorUserNotInTeam = "user_not_in_team" - MembersSuspendErrorOther = "other" - MembersSuspendErrorSuspendInactiveUser = "suspend_inactive_user" - MembersSuspendErrorSuspendLastAdmin = "suspend_last_admin" - MembersSuspendErrorTeamLicenseLimit = "team_license_limit" -) - -// MembersTransferFormerMembersFilesError : has no documentation (yet) -type MembersTransferFormerMembersFilesError struct { - dropbox.Tagged -} - -// Valid tag values for MembersTransferFormerMembersFilesError -const ( - MembersTransferFormerMembersFilesErrorUserNotFound = "user_not_found" - MembersTransferFormerMembersFilesErrorUserNotInTeam = "user_not_in_team" - MembersTransferFormerMembersFilesErrorOther = "other" - MembersTransferFormerMembersFilesErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ" - MembersTransferFormerMembersFilesErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ" - MembersTransferFormerMembersFilesErrorTransferDestUserNotFound = "transfer_dest_user_not_found" - MembersTransferFormerMembersFilesErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team" - MembersTransferFormerMembersFilesErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team" - MembersTransferFormerMembersFilesErrorTransferAdminUserNotFound = "transfer_admin_user_not_found" - MembersTransferFormerMembersFilesErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id" - MembersTransferFormerMembersFilesErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin" - MembersTransferFormerMembersFilesErrorRecipientNotVerified = "recipient_not_verified" - MembersTransferFormerMembersFilesErrorUserDataIsBeingTransferred = "user_data_is_being_transferred" - MembersTransferFormerMembersFilesErrorUserNotRemoved = "user_not_removed" - MembersTransferFormerMembersFilesErrorUserDataCannotBeTransferred = "user_data_cannot_be_transferred" - MembersTransferFormerMembersFilesErrorUserDataAlreadyTransferred = "user_data_already_transferred" -) - -// MembersUnsuspendArg : Exactly one of team_member_id, email, or external_id -// must be provided to identify the user account. -type MembersUnsuspendArg struct { - // User : Identity of user to unsuspend. - User *UserSelectorArg `json:"user"` -} - -// NewMembersUnsuspendArg returns a new MembersUnsuspendArg instance -func NewMembersUnsuspendArg(User *UserSelectorArg) *MembersUnsuspendArg { - s := new(MembersUnsuspendArg) - s.User = User - return s -} - -// MembersUnsuspendError : has no documentation (yet) -type MembersUnsuspendError struct { - dropbox.Tagged -} - -// Valid tag values for MembersUnsuspendError -const ( - MembersUnsuspendErrorUserNotFound = "user_not_found" - MembersUnsuspendErrorUserNotInTeam = "user_not_in_team" - MembersUnsuspendErrorOther = "other" - MembersUnsuspendErrorUnsuspendNonSuspendedMember = "unsuspend_non_suspended_member" - MembersUnsuspendErrorTeamLicenseLimit = "team_license_limit" -) - -// MobileClientPlatform : has no documentation (yet) -type MobileClientPlatform struct { - dropbox.Tagged -} - -// Valid tag values for MobileClientPlatform -const ( - MobileClientPlatformIphone = "iphone" - MobileClientPlatformIpad = "ipad" - MobileClientPlatformAndroid = "android" - MobileClientPlatformWindowsPhone = "windows_phone" - MobileClientPlatformBlackberry = "blackberry" - MobileClientPlatformOther = "other" -) - -// MobileClientSession : Information about linked Dropbox mobile client -// sessions. -type MobileClientSession struct { - DeviceSession - // DeviceName : The device name. - DeviceName string `json:"device_name"` - // ClientType : The mobile application type. - ClientType *MobileClientPlatform `json:"client_type"` - // ClientVersion : The dropbox client version. - ClientVersion string `json:"client_version,omitempty"` - // OsVersion : The hosting OS version. - OsVersion string `json:"os_version,omitempty"` - // LastCarrier : last carrier used by the device. - LastCarrier string `json:"last_carrier,omitempty"` -} - -// NewMobileClientSession returns a new MobileClientSession instance -func NewMobileClientSession(SessionId string, DeviceName string, ClientType *MobileClientPlatform) *MobileClientSession { - s := new(MobileClientSession) - s.SessionId = SessionId - s.DeviceName = DeviceName - s.ClientType = ClientType - return s -} - -// NamespaceMetadata : Properties of a namespace. -type NamespaceMetadata struct { - // Name : The name of this namespace. - Name string `json:"name"` - // NamespaceId : The ID of this namespace. - NamespaceId string `json:"namespace_id"` - // NamespaceType : The type of this namespace. - NamespaceType *NamespaceType `json:"namespace_type"` - // TeamMemberId : If this is a team member or app folder, the ID of the - // owning team member. Otherwise, this field is not present. - TeamMemberId string `json:"team_member_id,omitempty"` -} - -// NewNamespaceMetadata returns a new NamespaceMetadata instance -func NewNamespaceMetadata(Name string, NamespaceId string, NamespaceType *NamespaceType) *NamespaceMetadata { - s := new(NamespaceMetadata) - s.Name = Name - s.NamespaceId = NamespaceId - s.NamespaceType = NamespaceType - return s -} - -// NamespaceType : has no documentation (yet) -type NamespaceType struct { - dropbox.Tagged -} - -// Valid tag values for NamespaceType -const ( - NamespaceTypeAppFolder = "app_folder" - NamespaceTypeSharedFolder = "shared_folder" - NamespaceTypeTeamFolder = "team_folder" - NamespaceTypeTeamMemberFolder = "team_member_folder" - NamespaceTypeOther = "other" -) - -// RemoveCustomQuotaResult : User result for setting member custom quota. -type RemoveCustomQuotaResult struct { - dropbox.Tagged - // Success : Successfully removed user. - Success *UserSelectorArg `json:"success,omitempty"` - // InvalidUser : Invalid user (not in team). - InvalidUser *UserSelectorArg `json:"invalid_user,omitempty"` -} - -// Valid tag values for RemoveCustomQuotaResult -const ( - RemoveCustomQuotaResultSuccess = "success" - RemoveCustomQuotaResultInvalidUser = "invalid_user" - RemoveCustomQuotaResultOther = "other" -) - -// UnmarshalJSON deserializes into a RemoveCustomQuotaResult instance -func (u *RemoveCustomQuotaResult) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Success : Successfully removed user. - Success *UserSelectorArg `json:"success,omitempty"` - // InvalidUser : Invalid user (not in team). - InvalidUser *UserSelectorArg `json:"invalid_user,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "success": - u.Success = w.Success - - if err != nil { - return err - } - case "invalid_user": - u.InvalidUser = w.InvalidUser - - if err != nil { - return err - } - } - return nil -} - -// RemovedStatus : has no documentation (yet) -type RemovedStatus struct { - // IsRecoverable : True if the removed team member is recoverable. - IsRecoverable bool `json:"is_recoverable"` - // IsDisconnected : True if the team member's account was converted to - // individual account. - IsDisconnected bool `json:"is_disconnected"` -} - -// NewRemovedStatus returns a new RemovedStatus instance -func NewRemovedStatus(IsRecoverable bool, IsDisconnected bool) *RemovedStatus { - s := new(RemovedStatus) - s.IsRecoverable = IsRecoverable - s.IsDisconnected = IsDisconnected - return s -} - -// RevokeDesktopClientArg : has no documentation (yet) -type RevokeDesktopClientArg struct { - DeviceSessionArg - // DeleteOnUnlink : Whether to delete all files of the account (this is - // possible only if supported by the desktop client and will be made the - // next time the client access the account). - DeleteOnUnlink bool `json:"delete_on_unlink"` -} - -// NewRevokeDesktopClientArg returns a new RevokeDesktopClientArg instance -func NewRevokeDesktopClientArg(SessionId string, TeamMemberId string) *RevokeDesktopClientArg { - s := new(RevokeDesktopClientArg) - s.SessionId = SessionId - s.TeamMemberId = TeamMemberId - s.DeleteOnUnlink = false - return s -} - -// RevokeDeviceSessionArg : has no documentation (yet) -type RevokeDeviceSessionArg struct { - dropbox.Tagged - // WebSession : End an active session. - WebSession *DeviceSessionArg `json:"web_session,omitempty"` - // DesktopClient : Unlink a linked desktop device. - DesktopClient *RevokeDesktopClientArg `json:"desktop_client,omitempty"` - // MobileClient : Unlink a linked mobile device. - MobileClient *DeviceSessionArg `json:"mobile_client,omitempty"` -} - -// Valid tag values for RevokeDeviceSessionArg -const ( - RevokeDeviceSessionArgWebSession = "web_session" - RevokeDeviceSessionArgDesktopClient = "desktop_client" - RevokeDeviceSessionArgMobileClient = "mobile_client" -) - -// UnmarshalJSON deserializes into a RevokeDeviceSessionArg instance -func (u *RevokeDeviceSessionArg) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "web_session": - err = json.Unmarshal(body, &u.WebSession) - - if err != nil { - return err - } - case "desktop_client": - err = json.Unmarshal(body, &u.DesktopClient) - - if err != nil { - return err - } - case "mobile_client": - err = json.Unmarshal(body, &u.MobileClient) - - if err != nil { - return err - } - } - return nil -} - -// RevokeDeviceSessionBatchArg : has no documentation (yet) -type RevokeDeviceSessionBatchArg struct { - // RevokeDevices : has no documentation (yet) - RevokeDevices []*RevokeDeviceSessionArg `json:"revoke_devices"` -} - -// NewRevokeDeviceSessionBatchArg returns a new RevokeDeviceSessionBatchArg instance -func NewRevokeDeviceSessionBatchArg(RevokeDevices []*RevokeDeviceSessionArg) *RevokeDeviceSessionBatchArg { - s := new(RevokeDeviceSessionBatchArg) - s.RevokeDevices = RevokeDevices - return s -} - -// RevokeDeviceSessionBatchError : -type RevokeDeviceSessionBatchError struct { - dropbox.Tagged -} - -// Valid tag values for RevokeDeviceSessionBatchError -const ( - RevokeDeviceSessionBatchErrorOther = "other" -) - -// RevokeDeviceSessionBatchResult : has no documentation (yet) -type RevokeDeviceSessionBatchResult struct { - // RevokeDevicesStatus : has no documentation (yet) - RevokeDevicesStatus []*RevokeDeviceSessionStatus `json:"revoke_devices_status"` -} - -// NewRevokeDeviceSessionBatchResult returns a new RevokeDeviceSessionBatchResult instance -func NewRevokeDeviceSessionBatchResult(RevokeDevicesStatus []*RevokeDeviceSessionStatus) *RevokeDeviceSessionBatchResult { - s := new(RevokeDeviceSessionBatchResult) - s.RevokeDevicesStatus = RevokeDevicesStatus - return s -} - -// RevokeDeviceSessionError : has no documentation (yet) -type RevokeDeviceSessionError struct { - dropbox.Tagged -} - -// Valid tag values for RevokeDeviceSessionError -const ( - RevokeDeviceSessionErrorDeviceSessionNotFound = "device_session_not_found" - RevokeDeviceSessionErrorMemberNotFound = "member_not_found" - RevokeDeviceSessionErrorOther = "other" -) - -// RevokeDeviceSessionStatus : has no documentation (yet) -type RevokeDeviceSessionStatus struct { - // Success : Result of the revoking request. - Success bool `json:"success"` - // ErrorType : The error cause in case of a failure. - ErrorType *RevokeDeviceSessionError `json:"error_type,omitempty"` -} - -// NewRevokeDeviceSessionStatus returns a new RevokeDeviceSessionStatus instance -func NewRevokeDeviceSessionStatus(Success bool) *RevokeDeviceSessionStatus { - s := new(RevokeDeviceSessionStatus) - s.Success = Success - return s -} - -// RevokeLinkedApiAppArg : has no documentation (yet) -type RevokeLinkedApiAppArg struct { - // AppId : The application's unique id. - AppId string `json:"app_id"` - // TeamMemberId : The unique id of the member owning the device. - TeamMemberId string `json:"team_member_id"` - // KeepAppFolder : Whether to keep the application dedicated folder (in case - // the application uses one). - KeepAppFolder bool `json:"keep_app_folder"` -} - -// NewRevokeLinkedApiAppArg returns a new RevokeLinkedApiAppArg instance -func NewRevokeLinkedApiAppArg(AppId string, TeamMemberId string) *RevokeLinkedApiAppArg { - s := new(RevokeLinkedApiAppArg) - s.AppId = AppId - s.TeamMemberId = TeamMemberId - s.KeepAppFolder = true - return s -} - -// RevokeLinkedApiAppBatchArg : has no documentation (yet) -type RevokeLinkedApiAppBatchArg struct { - // RevokeLinkedApp : has no documentation (yet) - RevokeLinkedApp []*RevokeLinkedApiAppArg `json:"revoke_linked_app"` -} - -// NewRevokeLinkedApiAppBatchArg returns a new RevokeLinkedApiAppBatchArg instance -func NewRevokeLinkedApiAppBatchArg(RevokeLinkedApp []*RevokeLinkedApiAppArg) *RevokeLinkedApiAppBatchArg { - s := new(RevokeLinkedApiAppBatchArg) - s.RevokeLinkedApp = RevokeLinkedApp - return s -} - -// RevokeLinkedAppBatchError : Error returned by -// `linkedAppsRevokeLinkedAppBatch`. -type RevokeLinkedAppBatchError struct { - dropbox.Tagged -} - -// Valid tag values for RevokeLinkedAppBatchError -const ( - RevokeLinkedAppBatchErrorOther = "other" -) - -// RevokeLinkedAppBatchResult : has no documentation (yet) -type RevokeLinkedAppBatchResult struct { - // RevokeLinkedAppStatus : has no documentation (yet) - RevokeLinkedAppStatus []*RevokeLinkedAppStatus `json:"revoke_linked_app_status"` -} - -// NewRevokeLinkedAppBatchResult returns a new RevokeLinkedAppBatchResult instance -func NewRevokeLinkedAppBatchResult(RevokeLinkedAppStatus []*RevokeLinkedAppStatus) *RevokeLinkedAppBatchResult { - s := new(RevokeLinkedAppBatchResult) - s.RevokeLinkedAppStatus = RevokeLinkedAppStatus - return s -} - -// RevokeLinkedAppError : Error returned by `linkedAppsRevokeLinkedApp`. -type RevokeLinkedAppError struct { - dropbox.Tagged -} - -// Valid tag values for RevokeLinkedAppError -const ( - RevokeLinkedAppErrorAppNotFound = "app_not_found" - RevokeLinkedAppErrorMemberNotFound = "member_not_found" - RevokeLinkedAppErrorOther = "other" -) - -// RevokeLinkedAppStatus : has no documentation (yet) -type RevokeLinkedAppStatus struct { - // Success : Result of the revoking request. - Success bool `json:"success"` - // ErrorType : The error cause in case of a failure. - ErrorType *RevokeLinkedAppError `json:"error_type,omitempty"` -} - -// NewRevokeLinkedAppStatus returns a new RevokeLinkedAppStatus instance -func NewRevokeLinkedAppStatus(Success bool) *RevokeLinkedAppStatus { - s := new(RevokeLinkedAppStatus) - s.Success = Success - return s -} - -// SetCustomQuotaArg : has no documentation (yet) -type SetCustomQuotaArg struct { - // UsersAndQuotas : List of users and their custom quotas. - UsersAndQuotas []*UserCustomQuotaArg `json:"users_and_quotas"` -} - -// NewSetCustomQuotaArg returns a new SetCustomQuotaArg instance -func NewSetCustomQuotaArg(UsersAndQuotas []*UserCustomQuotaArg) *SetCustomQuotaArg { - s := new(SetCustomQuotaArg) - s.UsersAndQuotas = UsersAndQuotas - return s -} - -// SetCustomQuotaError : Error returned when setting member custom quota. -type SetCustomQuotaError struct { - dropbox.Tagged -} - -// Valid tag values for SetCustomQuotaError -const ( - SetCustomQuotaErrorTooManyUsers = "too_many_users" - SetCustomQuotaErrorOther = "other" - SetCustomQuotaErrorSomeUsersAreExcluded = "some_users_are_excluded" -) - -// StorageBucket : Describes the number of users in a specific storage bucket. -type StorageBucket struct { - // Bucket : The name of the storage bucket. For example, '1G' is a bucket of - // users with storage size up to 1 Giga. - Bucket string `json:"bucket"` - // Users : The number of people whose storage is in the range of this - // storage bucket. - Users uint64 `json:"users"` -} - -// NewStorageBucket returns a new StorageBucket instance -func NewStorageBucket(Bucket string, Users uint64) *StorageBucket { - s := new(StorageBucket) - s.Bucket = Bucket - s.Users = Users - return s -} - -// TeamFolderAccessError : has no documentation (yet) -type TeamFolderAccessError struct { - dropbox.Tagged -} - -// Valid tag values for TeamFolderAccessError -const ( - TeamFolderAccessErrorInvalidTeamFolderId = "invalid_team_folder_id" - TeamFolderAccessErrorNoAccess = "no_access" - TeamFolderAccessErrorOther = "other" -) - -// TeamFolderActivateError : -type TeamFolderActivateError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` -} - -// Valid tag values for TeamFolderActivateError -const ( - TeamFolderActivateErrorAccessError = "access_error" - TeamFolderActivateErrorStatusError = "status_error" - TeamFolderActivateErrorTeamSharedDropboxError = "team_shared_dropbox_error" - TeamFolderActivateErrorOther = "other" -) - -// UnmarshalJSON deserializes into a TeamFolderActivateError instance -func (u *TeamFolderActivateError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "status_error": - u.StatusError = w.StatusError - - if err != nil { - return err - } - case "team_shared_dropbox_error": - u.TeamSharedDropboxError = w.TeamSharedDropboxError - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderIdArg : has no documentation (yet) -type TeamFolderIdArg struct { - // TeamFolderId : The ID of the team folder. - TeamFolderId string `json:"team_folder_id"` -} - -// NewTeamFolderIdArg returns a new TeamFolderIdArg instance -func NewTeamFolderIdArg(TeamFolderId string) *TeamFolderIdArg { - s := new(TeamFolderIdArg) - s.TeamFolderId = TeamFolderId - return s -} - -// TeamFolderArchiveArg : has no documentation (yet) -type TeamFolderArchiveArg struct { - TeamFolderIdArg - // ForceAsyncOff : Whether to force the archive to happen synchronously. - ForceAsyncOff bool `json:"force_async_off"` -} - -// NewTeamFolderArchiveArg returns a new TeamFolderArchiveArg instance -func NewTeamFolderArchiveArg(TeamFolderId string) *TeamFolderArchiveArg { - s := new(TeamFolderArchiveArg) - s.TeamFolderId = TeamFolderId - s.ForceAsyncOff = false - return s -} - -// TeamFolderArchiveError : -type TeamFolderArchiveError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` -} - -// Valid tag values for TeamFolderArchiveError -const ( - TeamFolderArchiveErrorAccessError = "access_error" - TeamFolderArchiveErrorStatusError = "status_error" - TeamFolderArchiveErrorTeamSharedDropboxError = "team_shared_dropbox_error" - TeamFolderArchiveErrorOther = "other" -) - -// UnmarshalJSON deserializes into a TeamFolderArchiveError instance -func (u *TeamFolderArchiveError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "status_error": - u.StatusError = w.StatusError - - if err != nil { - return err - } - case "team_shared_dropbox_error": - u.TeamSharedDropboxError = w.TeamSharedDropboxError - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderArchiveJobStatus : has no documentation (yet) -type TeamFolderArchiveJobStatus struct { - dropbox.Tagged - // Complete : The archive job has finished. The value is the metadata for - // the resulting team folder. - Complete *TeamFolderMetadata `json:"complete,omitempty"` - // Failed : Error occurred while performing an asynchronous job from - // `teamFolderArchive`. - Failed *TeamFolderArchiveError `json:"failed,omitempty"` -} - -// Valid tag values for TeamFolderArchiveJobStatus -const ( - TeamFolderArchiveJobStatusInProgress = "in_progress" - TeamFolderArchiveJobStatusComplete = "complete" - TeamFolderArchiveJobStatusFailed = "failed" -) - -// UnmarshalJSON deserializes into a TeamFolderArchiveJobStatus instance -func (u *TeamFolderArchiveJobStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Failed : Error occurred while performing an asynchronous job from - // `teamFolderArchive`. - Failed *TeamFolderArchiveError `json:"failed,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - case "failed": - u.Failed = w.Failed - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderArchiveLaunch : has no documentation (yet) -type TeamFolderArchiveLaunch struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is asynchronous. - // The string is an id that can be used to obtain the status of the - // asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - // Complete : has no documentation (yet) - Complete *TeamFolderMetadata `json:"complete,omitempty"` -} - -// Valid tag values for TeamFolderArchiveLaunch -const ( - TeamFolderArchiveLaunchAsyncJobId = "async_job_id" - TeamFolderArchiveLaunchComplete = "complete" -) - -// UnmarshalJSON deserializes into a TeamFolderArchiveLaunch instance -func (u *TeamFolderArchiveLaunch) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AsyncJobId : This response indicates that the processing is - // asynchronous. The string is an id that can be used to obtain the - // status of the asynchronous job. - AsyncJobId string `json:"async_job_id,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "async_job_id": - u.AsyncJobId = w.AsyncJobId - - if err != nil { - return err - } - case "complete": - err = json.Unmarshal(body, &u.Complete) - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderCreateArg : has no documentation (yet) -type TeamFolderCreateArg struct { - // Name : Name for the new team folder. - Name string `json:"name"` - // SyncSetting : The sync setting to apply to this team folder. Only - // permitted if the team has team selective sync enabled. - SyncSetting *files.SyncSettingArg `json:"sync_setting,omitempty"` -} - -// NewTeamFolderCreateArg returns a new TeamFolderCreateArg instance -func NewTeamFolderCreateArg(Name string) *TeamFolderCreateArg { - s := new(TeamFolderCreateArg) - s.Name = Name - return s -} - -// TeamFolderCreateError : has no documentation (yet) -type TeamFolderCreateError struct { - dropbox.Tagged - // SyncSettingsError : An error occurred setting the sync settings. - SyncSettingsError *files.SyncSettingsError `json:"sync_settings_error,omitempty"` -} - -// Valid tag values for TeamFolderCreateError -const ( - TeamFolderCreateErrorInvalidFolderName = "invalid_folder_name" - TeamFolderCreateErrorFolderNameAlreadyUsed = "folder_name_already_used" - TeamFolderCreateErrorFolderNameReserved = "folder_name_reserved" - TeamFolderCreateErrorSyncSettingsError = "sync_settings_error" - TeamFolderCreateErrorOther = "other" -) - -// UnmarshalJSON deserializes into a TeamFolderCreateError instance -func (u *TeamFolderCreateError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // SyncSettingsError : An error occurred setting the sync settings. - SyncSettingsError *files.SyncSettingsError `json:"sync_settings_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "sync_settings_error": - u.SyncSettingsError = w.SyncSettingsError - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderGetInfoItem : has no documentation (yet) -type TeamFolderGetInfoItem struct { - dropbox.Tagged - // IdNotFound : An ID that was provided as a parameter to - // `teamFolderGetInfo` did not match any of the team's team folders. - IdNotFound string `json:"id_not_found,omitempty"` - // TeamFolderMetadata : Properties of a team folder. - TeamFolderMetadata *TeamFolderMetadata `json:"team_folder_metadata,omitempty"` -} - -// Valid tag values for TeamFolderGetInfoItem -const ( - TeamFolderGetInfoItemIdNotFound = "id_not_found" - TeamFolderGetInfoItemTeamFolderMetadata = "team_folder_metadata" -) - -// UnmarshalJSON deserializes into a TeamFolderGetInfoItem instance -func (u *TeamFolderGetInfoItem) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // IdNotFound : An ID that was provided as a parameter to - // `teamFolderGetInfo` did not match any of the team's team folders. - IdNotFound string `json:"id_not_found,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "id_not_found": - u.IdNotFound = w.IdNotFound - - if err != nil { - return err - } - case "team_folder_metadata": - err = json.Unmarshal(body, &u.TeamFolderMetadata) - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderIdListArg : has no documentation (yet) -type TeamFolderIdListArg struct { - // TeamFolderIds : The list of team folder IDs. - TeamFolderIds []string `json:"team_folder_ids"` -} - -// NewTeamFolderIdListArg returns a new TeamFolderIdListArg instance -func NewTeamFolderIdListArg(TeamFolderIds []string) *TeamFolderIdListArg { - s := new(TeamFolderIdListArg) - s.TeamFolderIds = TeamFolderIds - return s -} - -// TeamFolderInvalidStatusError : has no documentation (yet) -type TeamFolderInvalidStatusError struct { - dropbox.Tagged -} - -// Valid tag values for TeamFolderInvalidStatusError -const ( - TeamFolderInvalidStatusErrorActive = "active" - TeamFolderInvalidStatusErrorArchived = "archived" - TeamFolderInvalidStatusErrorArchiveInProgress = "archive_in_progress" - TeamFolderInvalidStatusErrorOther = "other" -) - -// TeamFolderListArg : has no documentation (yet) -type TeamFolderListArg struct { - // Limit : The maximum number of results to return per request. - Limit uint32 `json:"limit"` -} - -// NewTeamFolderListArg returns a new TeamFolderListArg instance -func NewTeamFolderListArg() *TeamFolderListArg { - s := new(TeamFolderListArg) - s.Limit = 1000 - return s -} - -// TeamFolderListContinueArg : has no documentation (yet) -type TeamFolderListContinueArg struct { - // Cursor : Indicates from what point to get the next set of team folders. - Cursor string `json:"cursor"` -} - -// NewTeamFolderListContinueArg returns a new TeamFolderListContinueArg instance -func NewTeamFolderListContinueArg(Cursor string) *TeamFolderListContinueArg { - s := new(TeamFolderListContinueArg) - s.Cursor = Cursor - return s -} - -// TeamFolderListContinueError : has no documentation (yet) -type TeamFolderListContinueError struct { - dropbox.Tagged -} - -// Valid tag values for TeamFolderListContinueError -const ( - TeamFolderListContinueErrorInvalidCursor = "invalid_cursor" - TeamFolderListContinueErrorOther = "other" -) - -// TeamFolderListError : has no documentation (yet) -type TeamFolderListError struct { - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error"` -} - -// NewTeamFolderListError returns a new TeamFolderListError instance -func NewTeamFolderListError(AccessError *TeamFolderAccessError) *TeamFolderListError { - s := new(TeamFolderListError) - s.AccessError = AccessError - return s -} - -// TeamFolderListResult : Result for `teamFolderList` and -// `teamFolderListContinue`. -type TeamFolderListResult struct { - // TeamFolders : List of all team folders in the authenticated team. - TeamFolders []*TeamFolderMetadata `json:"team_folders"` - // Cursor : Pass the cursor into `teamFolderListContinue` to obtain - // additional team folders. - Cursor string `json:"cursor"` - // HasMore : Is true if there are additional team folders that have not been - // returned yet. An additional call to `teamFolderListContinue` can retrieve - // them. - HasMore bool `json:"has_more"` -} - -// NewTeamFolderListResult returns a new TeamFolderListResult instance -func NewTeamFolderListResult(TeamFolders []*TeamFolderMetadata, Cursor string, HasMore bool) *TeamFolderListResult { - s := new(TeamFolderListResult) - s.TeamFolders = TeamFolders - s.Cursor = Cursor - s.HasMore = HasMore - return s -} - -// TeamFolderMetadata : Properties of a team folder. -type TeamFolderMetadata struct { - // TeamFolderId : The ID of the team folder. - TeamFolderId string `json:"team_folder_id"` - // Name : The name of the team folder. - Name string `json:"name"` - // Status : The status of the team folder. - Status *TeamFolderStatus `json:"status"` - // IsTeamSharedDropbox : True if this team folder is a shared team root. - IsTeamSharedDropbox bool `json:"is_team_shared_dropbox"` - // SyncSetting : The sync setting applied to this team folder. - SyncSetting *files.SyncSetting `json:"sync_setting"` - // ContentSyncSettings : Sync settings applied to contents of this team - // folder. - ContentSyncSettings []*files.ContentSyncSetting `json:"content_sync_settings"` -} - -// NewTeamFolderMetadata returns a new TeamFolderMetadata instance -func NewTeamFolderMetadata(TeamFolderId string, Name string, Status *TeamFolderStatus, IsTeamSharedDropbox bool, SyncSetting *files.SyncSetting, ContentSyncSettings []*files.ContentSyncSetting) *TeamFolderMetadata { - s := new(TeamFolderMetadata) - s.TeamFolderId = TeamFolderId - s.Name = Name - s.Status = Status - s.IsTeamSharedDropbox = IsTeamSharedDropbox - s.SyncSetting = SyncSetting - s.ContentSyncSettings = ContentSyncSettings - return s -} - -// TeamFolderPermanentlyDeleteError : -type TeamFolderPermanentlyDeleteError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` -} - -// Valid tag values for TeamFolderPermanentlyDeleteError -const ( - TeamFolderPermanentlyDeleteErrorAccessError = "access_error" - TeamFolderPermanentlyDeleteErrorStatusError = "status_error" - TeamFolderPermanentlyDeleteErrorTeamSharedDropboxError = "team_shared_dropbox_error" - TeamFolderPermanentlyDeleteErrorOther = "other" -) - -// UnmarshalJSON deserializes into a TeamFolderPermanentlyDeleteError instance -func (u *TeamFolderPermanentlyDeleteError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "status_error": - u.StatusError = w.StatusError - - if err != nil { - return err - } - case "team_shared_dropbox_error": - u.TeamSharedDropboxError = w.TeamSharedDropboxError - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderRenameArg : has no documentation (yet) -type TeamFolderRenameArg struct { - TeamFolderIdArg - // Name : New team folder name. - Name string `json:"name"` -} - -// NewTeamFolderRenameArg returns a new TeamFolderRenameArg instance -func NewTeamFolderRenameArg(TeamFolderId string, Name string) *TeamFolderRenameArg { - s := new(TeamFolderRenameArg) - s.TeamFolderId = TeamFolderId - s.Name = Name - return s -} - -// TeamFolderRenameError : has no documentation (yet) -type TeamFolderRenameError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` -} - -// Valid tag values for TeamFolderRenameError -const ( - TeamFolderRenameErrorAccessError = "access_error" - TeamFolderRenameErrorStatusError = "status_error" - TeamFolderRenameErrorTeamSharedDropboxError = "team_shared_dropbox_error" - TeamFolderRenameErrorOther = "other" - TeamFolderRenameErrorInvalidFolderName = "invalid_folder_name" - TeamFolderRenameErrorFolderNameAlreadyUsed = "folder_name_already_used" - TeamFolderRenameErrorFolderNameReserved = "folder_name_reserved" -) - -// UnmarshalJSON deserializes into a TeamFolderRenameError instance -func (u *TeamFolderRenameError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "status_error": - u.StatusError = w.StatusError - - if err != nil { - return err - } - case "team_shared_dropbox_error": - u.TeamSharedDropboxError = w.TeamSharedDropboxError - - if err != nil { - return err - } - } - return nil -} - -// TeamFolderStatus : has no documentation (yet) -type TeamFolderStatus struct { - dropbox.Tagged -} - -// Valid tag values for TeamFolderStatus -const ( - TeamFolderStatusActive = "active" - TeamFolderStatusArchived = "archived" - TeamFolderStatusArchiveInProgress = "archive_in_progress" - TeamFolderStatusOther = "other" -) - -// TeamFolderTeamSharedDropboxError : has no documentation (yet) -type TeamFolderTeamSharedDropboxError struct { - dropbox.Tagged -} - -// Valid tag values for TeamFolderTeamSharedDropboxError -const ( - TeamFolderTeamSharedDropboxErrorDisallowed = "disallowed" - TeamFolderTeamSharedDropboxErrorOther = "other" -) - -// TeamFolderUpdateSyncSettingsArg : has no documentation (yet) -type TeamFolderUpdateSyncSettingsArg struct { - TeamFolderIdArg - // SyncSetting : Sync setting to apply to the team folder itself. Only - // meaningful if the team folder is not a shared team root. - SyncSetting *files.SyncSettingArg `json:"sync_setting,omitempty"` - // ContentSyncSettings : Sync settings to apply to contents of this team - // folder. - ContentSyncSettings []*files.ContentSyncSettingArg `json:"content_sync_settings,omitempty"` -} - -// NewTeamFolderUpdateSyncSettingsArg returns a new TeamFolderUpdateSyncSettingsArg instance -func NewTeamFolderUpdateSyncSettingsArg(TeamFolderId string) *TeamFolderUpdateSyncSettingsArg { - s := new(TeamFolderUpdateSyncSettingsArg) - s.TeamFolderId = TeamFolderId - return s -} - -// TeamFolderUpdateSyncSettingsError : has no documentation (yet) -type TeamFolderUpdateSyncSettingsError struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - // SyncSettingsError : An error occurred setting the sync settings. - SyncSettingsError *files.SyncSettingsError `json:"sync_settings_error,omitempty"` -} - -// Valid tag values for TeamFolderUpdateSyncSettingsError -const ( - TeamFolderUpdateSyncSettingsErrorAccessError = "access_error" - TeamFolderUpdateSyncSettingsErrorStatusError = "status_error" - TeamFolderUpdateSyncSettingsErrorTeamSharedDropboxError = "team_shared_dropbox_error" - TeamFolderUpdateSyncSettingsErrorOther = "other" - TeamFolderUpdateSyncSettingsErrorSyncSettingsError = "sync_settings_error" -) - -// UnmarshalJSON deserializes into a TeamFolderUpdateSyncSettingsError instance -func (u *TeamFolderUpdateSyncSettingsError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // AccessError : has no documentation (yet) - AccessError *TeamFolderAccessError `json:"access_error,omitempty"` - // StatusError : has no documentation (yet) - StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"` - // TeamSharedDropboxError : has no documentation (yet) - TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"` - // SyncSettingsError : An error occurred setting the sync settings. - SyncSettingsError *files.SyncSettingsError `json:"sync_settings_error,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "access_error": - u.AccessError = w.AccessError - - if err != nil { - return err - } - case "status_error": - u.StatusError = w.StatusError - - if err != nil { - return err - } - case "team_shared_dropbox_error": - u.TeamSharedDropboxError = w.TeamSharedDropboxError - - if err != nil { - return err - } - case "sync_settings_error": - u.SyncSettingsError = w.SyncSettingsError - - if err != nil { - return err - } - } - return nil -} - -// TeamGetInfoResult : has no documentation (yet) -type TeamGetInfoResult struct { - // Name : The name of the team. - Name string `json:"name"` - // TeamId : The ID of the team. - TeamId string `json:"team_id"` - // NumLicensedUsers : The number of licenses available to the team. - NumLicensedUsers uint32 `json:"num_licensed_users"` - // NumProvisionedUsers : The number of accounts that have been invited or - // are already active members of the team. - NumProvisionedUsers uint32 `json:"num_provisioned_users"` - // Policies : has no documentation (yet) - Policies *team_policies.TeamMemberPolicies `json:"policies"` -} - -// NewTeamGetInfoResult returns a new TeamGetInfoResult instance -func NewTeamGetInfoResult(Name string, TeamId string, NumLicensedUsers uint32, NumProvisionedUsers uint32, Policies *team_policies.TeamMemberPolicies) *TeamGetInfoResult { - s := new(TeamGetInfoResult) - s.Name = Name - s.TeamId = TeamId - s.NumLicensedUsers = NumLicensedUsers - s.NumProvisionedUsers = NumProvisionedUsers - s.Policies = Policies - return s -} - -// TeamMemberInfo : Information about a team member. -type TeamMemberInfo struct { - // Profile : Profile of a user as a member of a team. - Profile *TeamMemberProfile `json:"profile"` - // Role : The user's role in the team. - Role *AdminTier `json:"role"` -} - -// NewTeamMemberInfo returns a new TeamMemberInfo instance -func NewTeamMemberInfo(Profile *TeamMemberProfile, Role *AdminTier) *TeamMemberInfo { - s := new(TeamMemberInfo) - s.Profile = Profile - s.Role = Role - return s -} - -// TeamMemberProfile : Profile of a user as a member of a team. -type TeamMemberProfile struct { - MemberProfile - // Groups : List of group IDs of groups that the user belongs to. - Groups []string `json:"groups"` - // MemberFolderId : The namespace id of the user's root folder. - MemberFolderId string `json:"member_folder_id"` -} - -// NewTeamMemberProfile returns a new TeamMemberProfile instance -func NewTeamMemberProfile(TeamMemberId string, Email string, EmailVerified bool, Status *TeamMemberStatus, Name *users.Name, MembershipType *TeamMembershipType, Groups []string, MemberFolderId string) *TeamMemberProfile { - s := new(TeamMemberProfile) - s.TeamMemberId = TeamMemberId - s.Email = Email - s.EmailVerified = EmailVerified - s.Status = Status - s.Name = Name - s.MembershipType = MembershipType - s.Groups = Groups - s.MemberFolderId = MemberFolderId - return s -} - -// TeamMemberStatus : The user's status as a member of a specific team. -type TeamMemberStatus struct { - dropbox.Tagged - // Removed : User is no longer a member of the team. Removed users are only - // listed when include_removed is true in members/list. - Removed *RemovedStatus `json:"removed,omitempty"` -} - -// Valid tag values for TeamMemberStatus -const ( - TeamMemberStatusActive = "active" - TeamMemberStatusInvited = "invited" - TeamMemberStatusSuspended = "suspended" - TeamMemberStatusRemoved = "removed" -) - -// UnmarshalJSON deserializes into a TeamMemberStatus instance -func (u *TeamMemberStatus) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "removed": - err = json.Unmarshal(body, &u.Removed) - - if err != nil { - return err - } - } - return nil -} - -// TeamMembershipType : has no documentation (yet) -type TeamMembershipType struct { - dropbox.Tagged -} - -// Valid tag values for TeamMembershipType -const ( - TeamMembershipTypeFull = "full" - TeamMembershipTypeLimited = "limited" -) - -// TeamNamespacesListArg : has no documentation (yet) -type TeamNamespacesListArg struct { - // Limit : Specifying a value here has no effect. - Limit uint32 `json:"limit"` -} - -// NewTeamNamespacesListArg returns a new TeamNamespacesListArg instance -func NewTeamNamespacesListArg() *TeamNamespacesListArg { - s := new(TeamNamespacesListArg) - s.Limit = 1000 - return s -} - -// TeamNamespacesListContinueArg : has no documentation (yet) -type TeamNamespacesListContinueArg struct { - // Cursor : Indicates from what point to get the next set of team-accessible - // namespaces. - Cursor string `json:"cursor"` -} - -// NewTeamNamespacesListContinueArg returns a new TeamNamespacesListContinueArg instance -func NewTeamNamespacesListContinueArg(Cursor string) *TeamNamespacesListContinueArg { - s := new(TeamNamespacesListContinueArg) - s.Cursor = Cursor - return s -} - -// TeamNamespacesListError : has no documentation (yet) -type TeamNamespacesListError struct { - dropbox.Tagged -} - -// Valid tag values for TeamNamespacesListError -const ( - TeamNamespacesListErrorInvalidArg = "invalid_arg" - TeamNamespacesListErrorOther = "other" -) - -// TeamNamespacesListContinueError : has no documentation (yet) -type TeamNamespacesListContinueError struct { - dropbox.Tagged -} - -// Valid tag values for TeamNamespacesListContinueError -const ( - TeamNamespacesListContinueErrorInvalidArg = "invalid_arg" - TeamNamespacesListContinueErrorOther = "other" - TeamNamespacesListContinueErrorInvalidCursor = "invalid_cursor" -) - -// TeamNamespacesListResult : Result for `namespacesList`. -type TeamNamespacesListResult struct { - // Namespaces : List of all namespaces the team can access. - Namespaces []*NamespaceMetadata `json:"namespaces"` - // Cursor : Pass the cursor into `namespacesListContinue` to obtain - // additional namespaces. Note that duplicate namespaces may be returned. - Cursor string `json:"cursor"` - // HasMore : Is true if there are additional namespaces that have not been - // returned yet. - HasMore bool `json:"has_more"` -} - -// NewTeamNamespacesListResult returns a new TeamNamespacesListResult instance -func NewTeamNamespacesListResult(Namespaces []*NamespaceMetadata, Cursor string, HasMore bool) *TeamNamespacesListResult { - s := new(TeamNamespacesListResult) - s.Namespaces = Namespaces - s.Cursor = Cursor - s.HasMore = HasMore - return s -} - -// TeamReportFailureReason : has no documentation (yet) -type TeamReportFailureReason struct { - dropbox.Tagged -} - -// Valid tag values for TeamReportFailureReason -const ( - TeamReportFailureReasonTemporaryError = "temporary_error" - TeamReportFailureReasonManyReportsAtOnce = "many_reports_at_once" - TeamReportFailureReasonTooMuchData = "too_much_data" - TeamReportFailureReasonOther = "other" -) - -// TokenGetAuthenticatedAdminError : Error returned by -// `tokenGetAuthenticatedAdmin`. -type TokenGetAuthenticatedAdminError struct { - dropbox.Tagged -} - -// Valid tag values for TokenGetAuthenticatedAdminError -const ( - TokenGetAuthenticatedAdminErrorMappingNotFound = "mapping_not_found" - TokenGetAuthenticatedAdminErrorAdminNotActive = "admin_not_active" - TokenGetAuthenticatedAdminErrorOther = "other" -) - -// TokenGetAuthenticatedAdminResult : Results for `tokenGetAuthenticatedAdmin`. -type TokenGetAuthenticatedAdminResult struct { - // AdminProfile : The admin who authorized the token. - AdminProfile *TeamMemberProfile `json:"admin_profile"` -} - -// NewTokenGetAuthenticatedAdminResult returns a new TokenGetAuthenticatedAdminResult instance -func NewTokenGetAuthenticatedAdminResult(AdminProfile *TeamMemberProfile) *TokenGetAuthenticatedAdminResult { - s := new(TokenGetAuthenticatedAdminResult) - s.AdminProfile = AdminProfile - return s -} - -// UploadApiRateLimitValue : The value for `Feature.upload_api_rate_limit`. -type UploadApiRateLimitValue struct { - dropbox.Tagged - // Limit : The number of upload API calls allowed per month. - Limit uint32 `json:"limit,omitempty"` -} - -// Valid tag values for UploadApiRateLimitValue -const ( - UploadApiRateLimitValueUnlimited = "unlimited" - UploadApiRateLimitValueLimit = "limit" - UploadApiRateLimitValueOther = "other" -) - -// UnmarshalJSON deserializes into a UploadApiRateLimitValue instance -func (u *UploadApiRateLimitValue) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // Limit : The number of upload API calls allowed per month. - Limit uint32 `json:"limit,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "limit": - u.Limit = w.Limit - - if err != nil { - return err - } - } - return nil -} - -// UserCustomQuotaArg : User and their required custom quota in GB (1 TB = 1024 -// GB). -type UserCustomQuotaArg struct { - // User : has no documentation (yet) - User *UserSelectorArg `json:"user"` - // QuotaGb : has no documentation (yet) - QuotaGb uint32 `json:"quota_gb"` -} - -// NewUserCustomQuotaArg returns a new UserCustomQuotaArg instance -func NewUserCustomQuotaArg(User *UserSelectorArg, QuotaGb uint32) *UserCustomQuotaArg { - s := new(UserCustomQuotaArg) - s.User = User - s.QuotaGb = QuotaGb - return s -} - -// UserCustomQuotaResult : User and their custom quota in GB (1 TB = 1024 GB). -// No quota returns if the user has no custom quota set. -type UserCustomQuotaResult struct { - // User : has no documentation (yet) - User *UserSelectorArg `json:"user"` - // QuotaGb : has no documentation (yet) - QuotaGb uint32 `json:"quota_gb,omitempty"` -} - -// NewUserCustomQuotaResult returns a new UserCustomQuotaResult instance -func NewUserCustomQuotaResult(User *UserSelectorArg) *UserCustomQuotaResult { - s := new(UserCustomQuotaResult) - s.User = User - return s -} - -// UserSelectorArg : Argument for selecting a single user, either by -// team_member_id, external_id or email. -type UserSelectorArg struct { - dropbox.Tagged - // TeamMemberId : has no documentation (yet) - TeamMemberId string `json:"team_member_id,omitempty"` - // ExternalId : has no documentation (yet) - ExternalId string `json:"external_id,omitempty"` - // Email : has no documentation (yet) - Email string `json:"email,omitempty"` -} - -// Valid tag values for UserSelectorArg -const ( - UserSelectorArgTeamMemberId = "team_member_id" - UserSelectorArgExternalId = "external_id" - UserSelectorArgEmail = "email" -) - -// UnmarshalJSON deserializes into a UserSelectorArg instance -func (u *UserSelectorArg) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TeamMemberId : has no documentation (yet) - TeamMemberId string `json:"team_member_id,omitempty"` - // ExternalId : has no documentation (yet) - ExternalId string `json:"external_id,omitempty"` - // Email : has no documentation (yet) - Email string `json:"email,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "team_member_id": - u.TeamMemberId = w.TeamMemberId - - if err != nil { - return err - } - case "external_id": - u.ExternalId = w.ExternalId - - if err != nil { - return err - } - case "email": - u.Email = w.Email - - if err != nil { - return err - } - } - return nil -} - -// UsersSelectorArg : Argument for selecting a list of users, either by -// team_member_ids, external_ids or emails. -type UsersSelectorArg struct { - dropbox.Tagged - // TeamMemberIds : List of member IDs. - TeamMemberIds []string `json:"team_member_ids,omitempty"` - // ExternalIds : List of external user IDs. - ExternalIds []string `json:"external_ids,omitempty"` - // Emails : List of email addresses. - Emails []string `json:"emails,omitempty"` -} - -// Valid tag values for UsersSelectorArg -const ( - UsersSelectorArgTeamMemberIds = "team_member_ids" - UsersSelectorArgExternalIds = "external_ids" - UsersSelectorArgEmails = "emails" -) - -// UnmarshalJSON deserializes into a UsersSelectorArg instance -func (u *UsersSelectorArg) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // TeamMemberIds : List of member IDs. - TeamMemberIds []string `json:"team_member_ids,omitempty"` - // ExternalIds : List of external user IDs. - ExternalIds []string `json:"external_ids,omitempty"` - // Emails : List of email addresses. - Emails []string `json:"emails,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "team_member_ids": - u.TeamMemberIds = w.TeamMemberIds - - if err != nil { - return err - } - case "external_ids": - u.ExternalIds = w.ExternalIds - - if err != nil { - return err - } - case "emails": - u.Emails = w.Emails - - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go deleted file mode 100644 index 96e9511d2..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package team_common : has no documentation (yet) -package team_common - -import ( - "time" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" -) - -// GroupManagementType : The group type determines how a group is managed. -type GroupManagementType struct { - dropbox.Tagged -} - -// Valid tag values for GroupManagementType -const ( - GroupManagementTypeUserManaged = "user_managed" - GroupManagementTypeCompanyManaged = "company_managed" - GroupManagementTypeSystemManaged = "system_managed" - GroupManagementTypeOther = "other" -) - -// GroupSummary : Information about a group. -type GroupSummary struct { - // GroupName : has no documentation (yet) - GroupName string `json:"group_name"` - // GroupId : has no documentation (yet) - GroupId string `json:"group_id"` - // GroupExternalId : External ID of group. This is an arbitrary ID that an - // admin can attach to a group. - GroupExternalId string `json:"group_external_id,omitempty"` - // MemberCount : The number of members in the group. - MemberCount uint32 `json:"member_count,omitempty"` - // GroupManagementType : Who is allowed to manage the group. - GroupManagementType *GroupManagementType `json:"group_management_type"` -} - -// NewGroupSummary returns a new GroupSummary instance -func NewGroupSummary(GroupName string, GroupId string, GroupManagementType *GroupManagementType) *GroupSummary { - s := new(GroupSummary) - s.GroupName = GroupName - s.GroupId = GroupId - s.GroupManagementType = GroupManagementType - return s -} - -// GroupType : The group type determines how a group is created and managed. -type GroupType struct { - dropbox.Tagged -} - -// Valid tag values for GroupType -const ( - GroupTypeTeam = "team" - GroupTypeUserManaged = "user_managed" - GroupTypeOther = "other" -) - -// MemberSpaceLimitType : The type of the space limit imposed on a team member. -type MemberSpaceLimitType struct { - dropbox.Tagged -} - -// Valid tag values for MemberSpaceLimitType -const ( - MemberSpaceLimitTypeOff = "off" - MemberSpaceLimitTypeAlertOnly = "alert_only" - MemberSpaceLimitTypeStopSync = "stop_sync" - MemberSpaceLimitTypeOther = "other" -) - -// TimeRange : Time range. -type TimeRange struct { - // StartTime : Optional starting time (inclusive). - StartTime time.Time `json:"start_time,omitempty"` - // EndTime : Optional ending time (exclusive). - EndTime time.Time `json:"end_time,omitempty"` -} - -// NewTimeRange returns a new TimeRange instance -func NewTimeRange() *TimeRange { - s := new(TimeRange) - return s -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go deleted file mode 100644 index 2facb0c45..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package team_policies : has no documentation (yet) -package team_policies - -import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - -// CameraUploadsPolicyState : has no documentation (yet) -type CameraUploadsPolicyState struct { - dropbox.Tagged -} - -// Valid tag values for CameraUploadsPolicyState -const ( - CameraUploadsPolicyStateDisabled = "disabled" - CameraUploadsPolicyStateEnabled = "enabled" - CameraUploadsPolicyStateOther = "other" -) - -// EmmState : has no documentation (yet) -type EmmState struct { - dropbox.Tagged -} - -// Valid tag values for EmmState -const ( - EmmStateDisabled = "disabled" - EmmStateOptional = "optional" - EmmStateRequired = "required" - EmmStateOther = "other" -) - -// GroupCreation : has no documentation (yet) -type GroupCreation struct { - dropbox.Tagged -} - -// Valid tag values for GroupCreation -const ( - GroupCreationAdminsAndMembers = "admins_and_members" - GroupCreationAdminsOnly = "admins_only" -) - -// OfficeAddInPolicy : has no documentation (yet) -type OfficeAddInPolicy struct { - dropbox.Tagged -} - -// Valid tag values for OfficeAddInPolicy -const ( - OfficeAddInPolicyDisabled = "disabled" - OfficeAddInPolicyEnabled = "enabled" - OfficeAddInPolicyOther = "other" -) - -// PaperDefaultFolderPolicy : has no documentation (yet) -type PaperDefaultFolderPolicy struct { - dropbox.Tagged -} - -// Valid tag values for PaperDefaultFolderPolicy -const ( - PaperDefaultFolderPolicyEveryoneInTeam = "everyone_in_team" - PaperDefaultFolderPolicyInviteOnly = "invite_only" - PaperDefaultFolderPolicyOther = "other" -) - -// PaperDeploymentPolicy : has no documentation (yet) -type PaperDeploymentPolicy struct { - dropbox.Tagged -} - -// Valid tag values for PaperDeploymentPolicy -const ( - PaperDeploymentPolicyFull = "full" - PaperDeploymentPolicyPartial = "partial" - PaperDeploymentPolicyOther = "other" -) - -// PaperDesktopPolicy : has no documentation (yet) -type PaperDesktopPolicy struct { - dropbox.Tagged -} - -// Valid tag values for PaperDesktopPolicy -const ( - PaperDesktopPolicyDisabled = "disabled" - PaperDesktopPolicyEnabled = "enabled" - PaperDesktopPolicyOther = "other" -) - -// PaperEnabledPolicy : has no documentation (yet) -type PaperEnabledPolicy struct { - dropbox.Tagged -} - -// Valid tag values for PaperEnabledPolicy -const ( - PaperEnabledPolicyDisabled = "disabled" - PaperEnabledPolicyEnabled = "enabled" - PaperEnabledPolicyUnspecified = "unspecified" - PaperEnabledPolicyOther = "other" -) - -// PasswordStrengthPolicy : has no documentation (yet) -type PasswordStrengthPolicy struct { - dropbox.Tagged -} - -// Valid tag values for PasswordStrengthPolicy -const ( - PasswordStrengthPolicyMinimalRequirements = "minimal_requirements" - PasswordStrengthPolicyModeratePassword = "moderate_password" - PasswordStrengthPolicyStrongPassword = "strong_password" - PasswordStrengthPolicyOther = "other" -) - -// RolloutMethod : has no documentation (yet) -type RolloutMethod struct { - dropbox.Tagged -} - -// Valid tag values for RolloutMethod -const ( - RolloutMethodUnlinkAll = "unlink_all" - RolloutMethodUnlinkMostInactive = "unlink_most_inactive" - RolloutMethodAddMemberToExceptions = "add_member_to_exceptions" -) - -// SharedFolderJoinPolicy : Policy governing which shared folders a team member -// can join. -type SharedFolderJoinPolicy struct { - dropbox.Tagged -} - -// Valid tag values for SharedFolderJoinPolicy -const ( - SharedFolderJoinPolicyFromTeamOnly = "from_team_only" - SharedFolderJoinPolicyFromAnyone = "from_anyone" - SharedFolderJoinPolicyOther = "other" -) - -// SharedFolderMemberPolicy : Policy governing who can be a member of a folder -// shared by a team member. -type SharedFolderMemberPolicy struct { - dropbox.Tagged -} - -// Valid tag values for SharedFolderMemberPolicy -const ( - SharedFolderMemberPolicyTeam = "team" - SharedFolderMemberPolicyAnyone = "anyone" - SharedFolderMemberPolicyOther = "other" -) - -// SharedLinkCreatePolicy : Policy governing the visibility of shared links. -// This policy can apply to newly created shared links, or all shared links. -type SharedLinkCreatePolicy struct { - dropbox.Tagged -} - -// Valid tag values for SharedLinkCreatePolicy -const ( - SharedLinkCreatePolicyDefaultPublic = "default_public" - SharedLinkCreatePolicyDefaultTeamOnly = "default_team_only" - SharedLinkCreatePolicyTeamOnly = "team_only" - SharedLinkCreatePolicyOther = "other" -) - -// ShowcaseDownloadPolicy : has no documentation (yet) -type ShowcaseDownloadPolicy struct { - dropbox.Tagged -} - -// Valid tag values for ShowcaseDownloadPolicy -const ( - ShowcaseDownloadPolicyDisabled = "disabled" - ShowcaseDownloadPolicyEnabled = "enabled" - ShowcaseDownloadPolicyOther = "other" -) - -// ShowcaseEnabledPolicy : has no documentation (yet) -type ShowcaseEnabledPolicy struct { - dropbox.Tagged -} - -// Valid tag values for ShowcaseEnabledPolicy -const ( - ShowcaseEnabledPolicyDisabled = "disabled" - ShowcaseEnabledPolicyEnabled = "enabled" - ShowcaseEnabledPolicyOther = "other" -) - -// ShowcaseExternalSharingPolicy : has no documentation (yet) -type ShowcaseExternalSharingPolicy struct { - dropbox.Tagged -} - -// Valid tag values for ShowcaseExternalSharingPolicy -const ( - ShowcaseExternalSharingPolicyDisabled = "disabled" - ShowcaseExternalSharingPolicyEnabled = "enabled" - ShowcaseExternalSharingPolicyOther = "other" -) - -// SmartSyncPolicy : has no documentation (yet) -type SmartSyncPolicy struct { - dropbox.Tagged -} - -// Valid tag values for SmartSyncPolicy -const ( - SmartSyncPolicyLocal = "local" - SmartSyncPolicyOnDemand = "on_demand" - SmartSyncPolicyOther = "other" -) - -// SsoPolicy : has no documentation (yet) -type SsoPolicy struct { - dropbox.Tagged -} - -// Valid tag values for SsoPolicy -const ( - SsoPolicyDisabled = "disabled" - SsoPolicyOptional = "optional" - SsoPolicyRequired = "required" - SsoPolicyOther = "other" -) - -// TeamMemberPolicies : Policies governing team members. -type TeamMemberPolicies struct { - // Sharing : Policies governing sharing. - Sharing *TeamSharingPolicies `json:"sharing"` - // EmmState : This describes the Enterprise Mobility Management (EMM) state - // for this team. This information can be used to understand if an - // organization is integrating with a third-party EMM vendor to further - // manage and apply restrictions upon the team's Dropbox usage on mobile - // devices. This is a new feature and in the future we'll be adding more new - // fields and additional documentation. - EmmState *EmmState `json:"emm_state"` - // OfficeAddin : The admin policy around the Dropbox Office Add-In for this - // team. - OfficeAddin *OfficeAddInPolicy `json:"office_addin"` -} - -// NewTeamMemberPolicies returns a new TeamMemberPolicies instance -func NewTeamMemberPolicies(Sharing *TeamSharingPolicies, EmmState *EmmState, OfficeAddin *OfficeAddInPolicy) *TeamMemberPolicies { - s := new(TeamMemberPolicies) - s.Sharing = Sharing - s.EmmState = EmmState - s.OfficeAddin = OfficeAddin - return s -} - -// TeamSharingPolicies : Policies governing sharing within and outside of the -// team. -type TeamSharingPolicies struct { - // SharedFolderMemberPolicy : Who can join folders shared by team members. - SharedFolderMemberPolicy *SharedFolderMemberPolicy `json:"shared_folder_member_policy"` - // SharedFolderJoinPolicy : Which shared folders team members can join. - SharedFolderJoinPolicy *SharedFolderJoinPolicy `json:"shared_folder_join_policy"` - // SharedLinkCreatePolicy : Who can view shared links owned by team members. - SharedLinkCreatePolicy *SharedLinkCreatePolicy `json:"shared_link_create_policy"` -} - -// NewTeamSharingPolicies returns a new TeamSharingPolicies instance -func NewTeamSharingPolicies(SharedFolderMemberPolicy *SharedFolderMemberPolicy, SharedFolderJoinPolicy *SharedFolderJoinPolicy, SharedLinkCreatePolicy *SharedLinkCreatePolicy) *TeamSharingPolicies { - s := new(TeamSharingPolicies) - s.SharedFolderMemberPolicy = SharedFolderMemberPolicy - s.SharedFolderJoinPolicy = SharedFolderJoinPolicy - s.SharedLinkCreatePolicy = SharedLinkCreatePolicy - return s -} - -// TwoStepVerificationPolicy : has no documentation (yet) -type TwoStepVerificationPolicy struct { - dropbox.Tagged -} - -// Valid tag values for TwoStepVerificationPolicy -const ( - TwoStepVerificationPolicyRequireTfaEnable = "require_tfa_enable" - TwoStepVerificationPolicyRequireTfaDisable = "require_tfa_disable" - TwoStepVerificationPolicyOther = "other" -) - -// TwoStepVerificationState : has no documentation (yet) -type TwoStepVerificationState struct { - dropbox.Tagged -} - -// Valid tag values for TwoStepVerificationState -const ( - TwoStepVerificationStateRequired = "required" - TwoStepVerificationStateOptional = "optional" - TwoStepVerificationStateOther = "other" -) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go deleted file mode 100644 index c67ed7710..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package users - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net/http" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth" -) - -// Client interface describes all routes in this namespace -type Client interface { - // GetAccount : Get information about a user's account. - GetAccount(arg *GetAccountArg) (res *BasicAccount, err error) - // GetAccountBatch : Get information about multiple user accounts. At most - // 300 accounts may be queried per request. - GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccount, err error) - // GetCurrentAccount : Get information about the current user's account. - GetCurrentAccount() (res *FullAccount, err error) - // GetSpaceUsage : Get the space usage information for the current user's - // account. - GetSpaceUsage() (res *SpaceUsage, err error) -} - -type apiImpl dropbox.Context - -//GetAccountAPIError is an error-wrapper for the get_account route -type GetAccountAPIError struct { - dropbox.APIError - EndpointError *GetAccountError `json:"error"` -} - -func (dbx *apiImpl) GetAccount(arg *GetAccountArg) (res *BasicAccount, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_account", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetAccountAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetAccountBatchAPIError is an error-wrapper for the get_account_batch route -type GetAccountBatchAPIError struct { - dropbox.APIError - EndpointError *GetAccountBatchError `json:"error"` -} - -func (dbx *apiImpl) GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccount, err error) { - cli := dbx.Client - - dbx.Config.LogDebug("arg: %v", arg) - b, err := json.Marshal(arg) - if err != nil { - return - } - - headers := map[string]string{ - "Content-Type": "application/json", - } - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_account_batch", headers, bytes.NewReader(b)) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetAccountBatchAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetCurrentAccountAPIError is an error-wrapper for the get_current_account route -type GetCurrentAccountAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) GetCurrentAccount() (res *FullAccount, err error) { - cli := dbx.Client - - headers := map[string]string{} - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_current_account", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetCurrentAccountAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -//GetSpaceUsageAPIError is an error-wrapper for the get_space_usage route -type GetSpaceUsageAPIError struct { - dropbox.APIError - EndpointError struct{} `json:"error"` -} - -func (dbx *apiImpl) GetSpaceUsage() (res *SpaceUsage, err error) { - cli := dbx.Client - - headers := map[string]string{} - if dbx.Config.AsMemberID != "" { - headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID - } - - req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_space_usage", headers, nil) - if err != nil { - return - } - dbx.Config.LogInfo("req: %v", req) - - resp, err := cli.Do(req) - if err != nil { - return - } - - dbx.Config.LogInfo("resp: %v", resp) - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return - } - - dbx.Config.LogDebug("body: %s", body) - if resp.StatusCode == http.StatusOK { - err = json.Unmarshal(body, &res) - if err != nil { - return - } - - return - } - if resp.StatusCode == http.StatusConflict { - var apiError GetSpaceUsageAPIError - err = json.Unmarshal(body, &apiError) - if err != nil { - return - } - err = apiError - return - } - err = auth.HandleCommonAuthErrors(dbx.Config, resp, body) - if err != nil { - return - } - err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body) - return -} - -// New returns a Client implementation for this namespace -func New(c dropbox.Config) Client { - ctx := apiImpl(dropbox.NewContext(c)) - return &ctx -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go deleted file mode 100644 index fd707e423..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go +++ /dev/null @@ -1,441 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package users : This namespace contains endpoints and data types for user -// management. -package users - -import ( - "encoding/json" - - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies" - "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common" -) - -// Account : The amount of detail revealed about an account depends on the user -// being queried and the user making the query. -type Account struct { - // AccountId : The user's unique Dropbox ID. - AccountId string `json:"account_id"` - // Name : Details of a user's name. - Name *Name `json:"name"` - // Email : The user's e-mail address. Do not rely on this without checking - // the `email_verified` field. Even then, it's possible that the user has - // since lost access to their e-mail. - Email string `json:"email"` - // EmailVerified : Whether the user has verified their e-mail address. - EmailVerified bool `json:"email_verified"` - // ProfilePhotoUrl : URL for the photo representing the user, if one is set. - ProfilePhotoUrl string `json:"profile_photo_url,omitempty"` - // Disabled : Whether the user has been disabled. - Disabled bool `json:"disabled"` -} - -// NewAccount returns a new Account instance -func NewAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool) *Account { - s := new(Account) - s.AccountId = AccountId - s.Name = Name - s.Email = Email - s.EmailVerified = EmailVerified - s.Disabled = Disabled - return s -} - -// BasicAccount : Basic information about any account. -type BasicAccount struct { - Account - // IsTeammate : Whether this user is a teammate of the current user. If this - // account is the current user's account, then this will be true. - IsTeammate bool `json:"is_teammate"` - // TeamMemberId : The user's unique team member id. This field will only be - // present if the user is part of a team and `is_teammate` is true. - TeamMemberId string `json:"team_member_id,omitempty"` -} - -// NewBasicAccount returns a new BasicAccount instance -func NewBasicAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, IsTeammate bool) *BasicAccount { - s := new(BasicAccount) - s.AccountId = AccountId - s.Name = Name - s.Email = Email - s.EmailVerified = EmailVerified - s.Disabled = Disabled - s.IsTeammate = IsTeammate - return s -} - -// FullAccount : Detailed information about the current user's account. -type FullAccount struct { - Account - // Country : The user's two-letter country code, if available. Country codes - // are based on `ISO 3166-1` . - Country string `json:"country,omitempty"` - // Locale : The language that the user specified. Locale tags will be `IETF - // language tags` . - Locale string `json:"locale"` - // ReferralLink : The user's `referral link` - // . - ReferralLink string `json:"referral_link"` - // Team : If this account is a member of a team, information about that - // team. - Team *FullTeam `json:"team,omitempty"` - // TeamMemberId : This account's unique team member id. This field will only - // be present if `team` is present. - TeamMemberId string `json:"team_member_id,omitempty"` - // IsPaired : Whether the user has a personal and work account. If the - // current account is personal, then `team` will always be nil, but - // `is_paired` will indicate if a work account is linked. - IsPaired bool `json:"is_paired"` - // AccountType : What type of account this user has. - AccountType *users_common.AccountType `json:"account_type"` - // RootInfo : The root info for this account. - RootInfo common.IsRootInfo `json:"root_info"` -} - -// NewFullAccount returns a new FullAccount instance -func NewFullAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, Locale string, ReferralLink string, IsPaired bool, AccountType *users_common.AccountType, RootInfo common.IsRootInfo) *FullAccount { - s := new(FullAccount) - s.AccountId = AccountId - s.Name = Name - s.Email = Email - s.EmailVerified = EmailVerified - s.Disabled = Disabled - s.Locale = Locale - s.ReferralLink = ReferralLink - s.IsPaired = IsPaired - s.AccountType = AccountType - s.RootInfo = RootInfo - return s -} - -// UnmarshalJSON deserializes into a FullAccount instance -func (u *FullAccount) UnmarshalJSON(b []byte) error { - type wrap struct { - // AccountId : The user's unique Dropbox ID. - AccountId string `json:"account_id"` - // Name : Details of a user's name. - Name *Name `json:"name"` - // Email : The user's e-mail address. Do not rely on this without - // checking the `email_verified` field. Even then, it's possible that - // the user has since lost access to their e-mail. - Email string `json:"email"` - // EmailVerified : Whether the user has verified their e-mail address. - EmailVerified bool `json:"email_verified"` - // Disabled : Whether the user has been disabled. - Disabled bool `json:"disabled"` - // Locale : The language that the user specified. Locale tags will be - // `IETF language tags` - // . - Locale string `json:"locale"` - // ReferralLink : The user's `referral link` - // . - ReferralLink string `json:"referral_link"` - // IsPaired : Whether the user has a personal and work account. If the - // current account is personal, then `team` will always be nil, but - // `is_paired` will indicate if a work account is linked. - IsPaired bool `json:"is_paired"` - // AccountType : What type of account this user has. - AccountType *users_common.AccountType `json:"account_type"` - // RootInfo : The root info for this account. - RootInfo json.RawMessage `json:"root_info"` - // ProfilePhotoUrl : URL for the photo representing the user, if one is - // set. - ProfilePhotoUrl string `json:"profile_photo_url,omitempty"` - // Country : The user's two-letter country code, if available. Country - // codes are based on `ISO 3166-1` - // . - Country string `json:"country,omitempty"` - // Team : If this account is a member of a team, information about that - // team. - Team *FullTeam `json:"team,omitempty"` - // TeamMemberId : This account's unique team member id. This field will - // only be present if `team` is present. - TeamMemberId string `json:"team_member_id,omitempty"` - } - var w wrap - if err := json.Unmarshal(b, &w); err != nil { - return err - } - u.AccountId = w.AccountId - u.Name = w.Name - u.Email = w.Email - u.EmailVerified = w.EmailVerified - u.Disabled = w.Disabled - u.Locale = w.Locale - u.ReferralLink = w.ReferralLink - u.IsPaired = w.IsPaired - u.AccountType = w.AccountType - RootInfo, err := common.IsRootInfoFromJSON(w.RootInfo) - if err != nil { - return err - } - u.RootInfo = RootInfo - u.ProfilePhotoUrl = w.ProfilePhotoUrl - u.Country = w.Country - u.Team = w.Team - u.TeamMemberId = w.TeamMemberId - return nil -} - -// Team : Information about a team. -type Team struct { - // Id : The team's unique ID. - Id string `json:"id"` - // Name : The name of the team. - Name string `json:"name"` -} - -// NewTeam returns a new Team instance -func NewTeam(Id string, Name string) *Team { - s := new(Team) - s.Id = Id - s.Name = Name - return s -} - -// FullTeam : Detailed information about a team. -type FullTeam struct { - Team - // SharingPolicies : Team policies governing sharing. - SharingPolicies *team_policies.TeamSharingPolicies `json:"sharing_policies"` - // OfficeAddinPolicy : Team policy governing the use of the Office Add-In. - OfficeAddinPolicy *team_policies.OfficeAddInPolicy `json:"office_addin_policy"` -} - -// NewFullTeam returns a new FullTeam instance -func NewFullTeam(Id string, Name string, SharingPolicies *team_policies.TeamSharingPolicies, OfficeAddinPolicy *team_policies.OfficeAddInPolicy) *FullTeam { - s := new(FullTeam) - s.Id = Id - s.Name = Name - s.SharingPolicies = SharingPolicies - s.OfficeAddinPolicy = OfficeAddinPolicy - return s -} - -// GetAccountArg : has no documentation (yet) -type GetAccountArg struct { - // AccountId : A user's account identifier. - AccountId string `json:"account_id"` -} - -// NewGetAccountArg returns a new GetAccountArg instance -func NewGetAccountArg(AccountId string) *GetAccountArg { - s := new(GetAccountArg) - s.AccountId = AccountId - return s -} - -// GetAccountBatchArg : has no documentation (yet) -type GetAccountBatchArg struct { - // AccountIds : List of user account identifiers. Should not contain any - // duplicate account IDs. - AccountIds []string `json:"account_ids"` -} - -// NewGetAccountBatchArg returns a new GetAccountBatchArg instance -func NewGetAccountBatchArg(AccountIds []string) *GetAccountBatchArg { - s := new(GetAccountBatchArg) - s.AccountIds = AccountIds - return s -} - -// GetAccountBatchError : has no documentation (yet) -type GetAccountBatchError struct { - dropbox.Tagged - // NoAccount : The value is an account ID specified in - // `GetAccountBatchArg.account_ids` that does not exist. - NoAccount string `json:"no_account,omitempty"` -} - -// Valid tag values for GetAccountBatchError -const ( - GetAccountBatchErrorNoAccount = "no_account" - GetAccountBatchErrorOther = "other" -) - -// UnmarshalJSON deserializes into a GetAccountBatchError instance -func (u *GetAccountBatchError) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - // NoAccount : The value is an account ID specified in - // `GetAccountBatchArg.account_ids` that does not exist. - NoAccount string `json:"no_account,omitempty"` - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "no_account": - u.NoAccount = w.NoAccount - - if err != nil { - return err - } - } - return nil -} - -// GetAccountError : has no documentation (yet) -type GetAccountError struct { - dropbox.Tagged -} - -// Valid tag values for GetAccountError -const ( - GetAccountErrorNoAccount = "no_account" - GetAccountErrorOther = "other" -) - -// IndividualSpaceAllocation : has no documentation (yet) -type IndividualSpaceAllocation struct { - // Allocated : The total space allocated to the user's account (bytes). - Allocated uint64 `json:"allocated"` -} - -// NewIndividualSpaceAllocation returns a new IndividualSpaceAllocation instance -func NewIndividualSpaceAllocation(Allocated uint64) *IndividualSpaceAllocation { - s := new(IndividualSpaceAllocation) - s.Allocated = Allocated - return s -} - -// Name : Representations for a person's name to assist with -// internationalization. -type Name struct { - // GivenName : Also known as a first name. - GivenName string `json:"given_name"` - // Surname : Also known as a last name or family name. - Surname string `json:"surname"` - // FamiliarName : Locale-dependent name. In the US, a person's familiar name - // is their `given_name`, but elsewhere, it could be any combination of a - // person's `given_name` and `surname`. - FamiliarName string `json:"familiar_name"` - // DisplayName : A name that can be used directly to represent the name of a - // user's Dropbox account. - DisplayName string `json:"display_name"` - // AbbreviatedName : An abbreviated form of the person's name. Their - // initials in most locales. - AbbreviatedName string `json:"abbreviated_name"` -} - -// NewName returns a new Name instance -func NewName(GivenName string, Surname string, FamiliarName string, DisplayName string, AbbreviatedName string) *Name { - s := new(Name) - s.GivenName = GivenName - s.Surname = Surname - s.FamiliarName = FamiliarName - s.DisplayName = DisplayName - s.AbbreviatedName = AbbreviatedName - return s -} - -// SpaceAllocation : Space is allocated differently based on the type of -// account. -type SpaceAllocation struct { - dropbox.Tagged - // Individual : The user's space allocation applies only to their individual - // account. - Individual *IndividualSpaceAllocation `json:"individual,omitempty"` - // Team : The user shares space with other members of their team. - Team *TeamSpaceAllocation `json:"team,omitempty"` -} - -// Valid tag values for SpaceAllocation -const ( - SpaceAllocationIndividual = "individual" - SpaceAllocationTeam = "team" - SpaceAllocationOther = "other" -) - -// UnmarshalJSON deserializes into a SpaceAllocation instance -func (u *SpaceAllocation) UnmarshalJSON(body []byte) error { - type wrap struct { - dropbox.Tagged - } - var w wrap - var err error - if err = json.Unmarshal(body, &w); err != nil { - return err - } - u.Tag = w.Tag - switch u.Tag { - case "individual": - err = json.Unmarshal(body, &u.Individual) - - if err != nil { - return err - } - case "team": - err = json.Unmarshal(body, &u.Team) - - if err != nil { - return err - } - } - return nil -} - -// SpaceUsage : Information about a user's space usage and quota. -type SpaceUsage struct { - // Used : The user's total space usage (bytes). - Used uint64 `json:"used"` - // Allocation : The user's space allocation. - Allocation *SpaceAllocation `json:"allocation"` -} - -// NewSpaceUsage returns a new SpaceUsage instance -func NewSpaceUsage(Used uint64, Allocation *SpaceAllocation) *SpaceUsage { - s := new(SpaceUsage) - s.Used = Used - s.Allocation = Allocation - return s -} - -// TeamSpaceAllocation : has no documentation (yet) -type TeamSpaceAllocation struct { - // Used : The total space currently used by the user's team (bytes). - Used uint64 `json:"used"` - // Allocated : The total space allocated to the user's team (bytes). - Allocated uint64 `json:"allocated"` - // UserWithinTeamSpaceAllocated : The total space allocated to the user - // within its team allocated space (0 means that no restriction is imposed - // on the user's quota within its team). - UserWithinTeamSpaceAllocated uint64 `json:"user_within_team_space_allocated"` - // UserWithinTeamSpaceLimitType : The type of the space limit imposed on the - // team member (off, alert_only, stop_sync). - UserWithinTeamSpaceLimitType *team_common.MemberSpaceLimitType `json:"user_within_team_space_limit_type"` -} - -// NewTeamSpaceAllocation returns a new TeamSpaceAllocation instance -func NewTeamSpaceAllocation(Used uint64, Allocated uint64, UserWithinTeamSpaceAllocated uint64, UserWithinTeamSpaceLimitType *team_common.MemberSpaceLimitType) *TeamSpaceAllocation { - s := new(TeamSpaceAllocation) - s.Used = Used - s.Allocated = Allocated - s.UserWithinTeamSpaceAllocated = UserWithinTeamSpaceAllocated - s.UserWithinTeamSpaceLimitType = UserWithinTeamSpaceLimitType - return s -} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go deleted file mode 100644 index 74abd0990..000000000 --- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Dropbox, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// Package users_common : This namespace contains common data types used within -// the users namespace. -package users_common - -import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" - -// AccountType : What type of account this user has. -type AccountType struct { - dropbox.Tagged -} - -// Valid tag values for AccountType -const ( - AccountTypeBasic = "basic" - AccountTypePro = "pro" - AccountTypeBusiness = "business" -) diff --git a/vendor/github.com/gogo/protobuf/AUTHORS b/vendor/github.com/gogo/protobuf/AUTHORS deleted file mode 100644 index 3d97fc7a2..000000000 --- a/vendor/github.com/gogo/protobuf/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -# This is the official list of GoGo authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS file, which -# lists people. For example, employees are listed in CONTRIBUTORS, -# but not in AUTHORS, because the employer holds the copyright. - -# Names should be added to this file as one of -# Organization's name -# Individual's name -# Individual's name - -# Please keep the list sorted. - -Sendgrid, Inc -Vastech SA (PTY) LTD -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/vendor/github.com/gogo/protobuf/CONTRIBUTORS deleted file mode 100644 index 1b4f6c208..000000000 --- a/vendor/github.com/gogo/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,23 +0,0 @@ -Anton Povarov -Brian Goff -Clayton Coleman -Denis Smirnov -DongYun Kang -Dwayne Schultz -Georg Apitz -Gustav Paul -Johan Brandhorst -John Shahid -John Tuley -Laurent -Patrick Lee -Peter Edge -Roger Johansson -Sam Nguyen -Sergio Arbeo -Stephen J Day -Tamir Duberstein -Todd Eisenberger -Tormod Erevik Lea -Vyacheslav Kim -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/LICENSE b/vendor/github.com/gogo/protobuf/LICENSE deleted file mode 100644 index f57de90da..000000000 --- a/vendor/github.com/gogo/protobuf/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -Copyright (c) 2013, The GoGo Authors. All rights reserved. - -Protocol Buffers for Go with Gadgets - -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf - -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/gogo/protobuf/proto/Makefile b/vendor/github.com/gogo/protobuf/proto/Makefile deleted file mode 100644 index 00d65f327..000000000 --- a/vendor/github.com/gogo/protobuf/proto/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# 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. - -install: - go install - -test: install generate-test-pbs - go test - - -generate-test-pbs: - make install - make -C test_proto - make -C proto3_proto - make diff --git a/vendor/github.com/gogo/protobuf/proto/clone.go b/vendor/github.com/gogo/protobuf/proto/clone.go deleted file mode 100644 index a26b046d9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/clone.go +++ /dev/null @@ -1,258 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "fmt" - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(src Message) Message { - in := reflect.ValueOf(src) - if in.IsNil() { - return src - } - out := reflect.New(in.Type().Elem()) - dst := out.Interface().(Message) - Merge(dst, src) - return dst -} - -// Merger is the interface representing objects that can merge messages of the same type. -type Merger interface { - // Merge merges src into this message. - // Required and optional fields that are set in src will be set to that value in dst. - // Elements of repeated fields will be appended. - // - // Merge may panic if called with a different argument type than the receiver. - Merge(src Message) -} - -// generatedMerger is the custom merge method that generated protos will have. -// We must add this method since a generate Merge method will conflict with -// many existing protos that have a Merge data field already defined. -type generatedMerger interface { - XXX_Merge(src Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - if m, ok := dst.(Merger); ok { - m.Merge(src) - return - } - - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) - } - if in.IsNil() { - return // Merge from nil src is a noop - } - if m, ok := dst.(generatedMerger); ok { - m.XXX_Merge(src) - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { - emOut := out.Addr().Interface().(extensionsBytes) - bIn := emIn.GetExtensions() - bOut := emOut.GetExtensions() - *bOut = append(*bOut, *bIn...) - } else if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go deleted file mode 100644 index 24552483c..000000000 --- a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go +++ /dev/null @@ -1,39 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import "reflect" - -type custom interface { - Marshal() ([]byte, error) - Unmarshal(data []byte) error - Size() int -} - -var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/decode.go b/vendor/github.com/gogo/protobuf/proto/decode.go deleted file mode 100644 index 63b0f08be..000000000 --- a/vendor/github.com/gogo/protobuf/proto/decode.go +++ /dev/null @@ -1,427 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -// Unmarshal implementations should not clear the receiver. -// Any unmarshaled data should be merged into the receiver. -// Callers of Unmarshal that do not want to retain existing data -// should Reset the receiver before calling Unmarshal. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// newUnmarshaler is the interface representing objects that can -// unmarshal themselves. The semantics are identical to Unmarshaler. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newUnmarshaler interface { - XXX_Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -// StartGroup tag is already consumed. This function consumes -// EndGroup tag. -func (p *Buffer) DecodeGroup(pb Message) error { - b := p.buf[p.index:] - x, y := findEndGroup(b) - if x < 0 { - return io.ErrUnexpectedEOF - } - err := Unmarshal(b[:x], pb) - p.index += y - return err -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(newUnmarshaler); ok { - err := u.XXX_Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - // Slow workaround for messages that aren't Unmarshalers. - // This includes some hand-coded .pb.go files and - // bootstrap protos. - // TODO: fix all of those and then add Unmarshal to - // the Message interface. Then: - // The cast above and code below can be deleted. - // The old unmarshaler can be deleted. - // Clients can call Unmarshal directly (can already do that, actually). - var info InternalMessageInfo - err := info.Unmarshal(pb, p.buf[p.index:]) - p.index = len(p.buf) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/deprecated.go b/vendor/github.com/gogo/protobuf/proto/deprecated.go deleted file mode 100644 index 35b882c09..000000000 --- a/vendor/github.com/gogo/protobuf/proto/deprecated.go +++ /dev/null @@ -1,63 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2018 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -import "errors" - -// Deprecated: do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func RegisterMessageSetType(Message, int32, string) {} diff --git a/vendor/github.com/gogo/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go deleted file mode 100644 index fe1bd7d90..000000000 --- a/vendor/github.com/gogo/protobuf/proto/discard.go +++ /dev/null @@ -1,350 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2017 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -type generatedDiscarder interface { - XXX_DiscardUnknown() -} - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -// -// For proto2 messages, the unknown fields of message extensions are only -// discarded from messages that have been accessed via GetExtension. -func DiscardUnknown(m Message) { - if m, ok := m.(generatedDiscarder); ok { - m.XXX_DiscardUnknown() - return - } - // TODO: Dynamically populate a InternalMessageInfo for legacy messages, - // but the master branch has no implementation for InternalMessageInfo, - // so it would be more work to replicate that approach. - discardLegacy(m) -} - -// DiscardUnknown recursively discards all unknown fields. -func (a *InternalMessageInfo) DiscardUnknown(m Message) { - di := atomicLoadDiscardInfo(&a.discard) - if di == nil { - di = getDiscardInfo(reflect.TypeOf(m).Elem()) - atomicStoreDiscardInfo(&a.discard, di) - } - di.discard(toPointer(&m)) -} - -type discardInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []discardFieldInfo - unrecognized field -} - -type discardFieldInfo struct { - field field // Offset of field, guaranteed to be valid - discard func(src pointer) -} - -var ( - discardInfoMap = map[reflect.Type]*discardInfo{} - discardInfoLock sync.Mutex -) - -func getDiscardInfo(t reflect.Type) *discardInfo { - discardInfoLock.Lock() - defer discardInfoLock.Unlock() - di := discardInfoMap[t] - if di == nil { - di = &discardInfo{typ: t} - discardInfoMap[t] = di - } - return di -} - -func (di *discardInfo) discard(src pointer) { - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&di.initialized) == 0 { - di.computeDiscardInfo() - } - - for _, fi := range di.fields { - sfp := src.offset(fi.field) - fi.discard(sfp) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { - // Ignore lock since DiscardUnknown is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - DiscardUnknown(m) - } - } - } - - if di.unrecognized.IsValid() { - *src.offset(di.unrecognized).toBytes() = nil - } -} - -func (di *discardInfo) computeDiscardInfo() { - di.lock.Lock() - defer di.lock.Unlock() - if di.initialized != 0 { - return - } - t := di.typ - n := t.NumField() - - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - dfi := discardFieldInfo{field: toField(&f)} - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) - case isSlice: // E.g., []*pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sps := src.getPointerSlice() - for _, sp := range sps { - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - default: // E.g., *pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sp := src.getPointer() - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) - default: // E.g., map[K]V - if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) - dfi.discard = func(src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - DiscardUnknown(val.Interface().(Message)) - } - } - } else { - dfi.discard = func(pointer) {} // Noop - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) - default: // E.g., interface{} - // TODO: Make this faster? - dfi.discard = func(src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - DiscardUnknown(sv.Interface().(Message)) - } - } - } - } - default: - continue - } - di.fields = append(di.fields, dfi) - } - - di.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - di.unrecognized = toField(&f) - } - - atomic.StoreInt32(&di.initialized, 1) -} - -func discardLegacy(m Message) { - v := reflect.ValueOf(m) - if v.Kind() != reflect.Ptr || v.IsNil() { - return - } - v = v.Elem() - if v.Kind() != reflect.Struct { - return - } - t := v.Type() - - for i := 0; i < v.NumField(); i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - vf := v.Field(i) - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) - case isSlice: // E.g., []*pb.T - for j := 0; j < vf.Len(); j++ { - discardLegacy(vf.Index(j).Interface().(Message)) - } - default: // E.g., *pb.T - discardLegacy(vf.Interface().(Message)) - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) - default: // E.g., map[K]V - tv := vf.Type().Elem() - if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) - for _, key := range vf.MapKeys() { - val := vf.MapIndex(key) - discardLegacy(val.Interface().(Message)) - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) - default: // E.g., test_proto.isCommunique_Union interface - if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { - vf = vf.Elem() // E.g., *test_proto.Communique_Msg - if !vf.IsNil() { - vf = vf.Elem() // E.g., test_proto.Communique_Msg - vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value - if vf.Kind() == reflect.Ptr { - discardLegacy(vf.Interface().(Message)) - } - } - } - } - } - } - - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { - if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - vf.Set(reflect.ValueOf([]byte(nil))) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(m); err == nil { - // Ignore lock since discardLegacy is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - discardLegacy(m) - } - } - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration.go b/vendor/github.com/gogo/protobuf/proto/duration.go deleted file mode 100644 index 93464c91c..000000000 --- a/vendor/github.com/gogo/protobuf/proto/duration.go +++ /dev/null @@ -1,100 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Range of a Duration in seconds, as specified in - // google/protobuf/duration.proto. This is about 10,000 years in seconds. - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// validateDuration determines whether the Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid Duration -// may still be too large to fit into a time.Duration (the range of Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *duration) error { - if d == nil { - return errors.New("duration: nil Duration") - } - if d.Seconds < minSeconds || d.Seconds > maxSeconds { - return fmt.Errorf("duration: %#v: seconds out of range", d) - } - if d.Nanos <= -1e9 || d.Nanos >= 1e9 { - return fmt.Errorf("duration: %#v: nanos out of range", d) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { - return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) - } - return nil -} - -// DurationFromProto converts a Duration to a time.Duration. DurationFromProto -// returns an error if the Duration is invalid or is too large to be -// represented in a time.Duration. -func durationFromProto(p *duration) (time.Duration, error) { - if err := validateDuration(p); err != nil { - return 0, err - } - d := time.Duration(p.Seconds) * time.Second - if int64(d/time.Second) != p.Seconds { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - if p.Nanos != 0 { - d += time.Duration(p.Nanos) - if (d < 0) != (p.Nanos < 0) { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a Duration. -func durationProto(d time.Duration) *duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &duration{ - Seconds: secs, - Nanos: int32(nanos), - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go deleted file mode 100644 index e748e1730..000000000 --- a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "reflect" - "time" -) - -var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() - -type duration struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *duration) Reset() { *m = duration{} } -func (*duration) ProtoMessage() {} -func (*duration) String() string { return "duration" } - -func init() { - RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode.go b/vendor/github.com/gogo/protobuf/proto/encode.go deleted file mode 100644 index 9581ccd30..000000000 --- a/vendor/github.com/gogo/protobuf/proto/encode.go +++ /dev/null @@ -1,205 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "reflect" -) - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - switch { - case x < 1<<7: - return 1 - case x < 1<<14: - return 2 - case x < 1<<21: - return 3 - case x < 1<<28: - return 4 - case x < 1<<35: - return 5 - case x < 1<<42: - return 6 - case x < 1<<49: - return 7 - case x < 1<<56: - return 8 - case x < 1<<63: - return 9 - } - return 10 -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - siz := Size(pb) - sizVar := SizeVarint(uint64(siz)) - p.grow(siz + sizVar) - p.EncodeVarint(uint64(siz)) - return p.Marshal(pb) -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go deleted file mode 100644 index 0f5fb173e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -func NewRequiredNotSetError(field string) *RequiredNotSetError { - return &RequiredNotSetError{field} -} diff --git a/vendor/github.com/gogo/protobuf/proto/equal.go b/vendor/github.com/gogo/protobuf/proto/equal.go deleted file mode 100644 index d4db5a1c1..000000000 --- a/vendor/github.com/gogo/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - return bytes.Equal(u1, u2) -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 == nil && m2 == nil { - // Both have only encoded form. - if bytes.Equal(e1.enc, e2.enc) { - continue - } - // The bytes are different, but the extensions might still be - // equal. We need to decode them to compare. - } - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - // If both have only encoded form and the bytes are the same, - // it is handled above. We get here when the bytes are different. - // We don't know how to decode it, so just compare them as byte - // slices. - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - return false - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions.go b/vendor/github.com/gogo/protobuf/proto/extensions.go deleted file mode 100644 index 341c6f57f..000000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions.go +++ /dev/null @@ -1,605 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "io" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, error) { - switch p := p.(type) { - case extendableProto: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return p, nil - case extendableProtoV1: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return extensionAdapter{p}, nil - case extensionsBytes: - return slowExtensionAdapter{p}, nil - } - // Don't allocate a specific error containing %T: - // this is the hot path for Clone and MarshalText. - return nil, errNotExtendable -} - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -func isNilPtr(x interface{}) bool { - v := reflect.ValueOf(x) - return v.Kind() == reflect.Ptr && v.IsNil() -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - if ebase, ok := base.(extensionsBytes); ok { - clearExtension(base, id) - ext := ebase.GetExtensions() - *ext = append(*ext, b...) - return - } - epb, err := extendable(base) - if err != nil { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extendableProto, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if ea, ok := pbi.(slowExtensionAdapter); ok { - pbi = ea.extensionsBytes - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - buf := *ext - o := 0 - for o < len(buf) { - tag, n := DecodeVarint(buf[o:]) - fieldNum := int32(tag >> 3) - if int32(fieldNum) == extension.Field { - return true - } - wireType := int(tag & 0x7) - o += n - l, err := size(buf[o:], wireType) - if err != nil { - return false - } - o += l - } - return false - } - // TODO: Check types, field numbers, etc.? - epb, err := extendable(pb) - if err != nil { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok := extmap[extension.Field] - mu.Unlock() - return ok -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - clearExtension(pb, extension.Field) -} - -func clearExtension(pb Message, fieldNum int32) { - if epb, ok := pb.(extensionsBytes); ok { - offset := 0 - for offset != -1 { - offset = deleteExtension(epb, fieldNum, offset) - } - return - } - epb, err := extendable(pb) - if err != nil { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, fieldNum) -} - -// GetExtension retrieves a proto2 extended field from pb. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes of the field extension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - return decodeExtensionFromBytes(extension, *ext) - } - - epb, err := extendable(pb) - if err != nil { - return nil, err - } - - if extension.ExtendedType != nil { - // can only check type if this is a complete descriptor - if cerr := checkExtensionTypes(epb, extension); cerr != nil { - return nil, cerr - } - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - if extension.ExtensionType == nil { - // incomplete descriptor - return e.enc, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - if extension.ExtensionType == nil { - // incomplete descriptor, so no default - return nil, ErrMissingExtension - } - - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - unmarshal := typeUnmarshaler(t, extension.Tag) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate space to store the pointer/slice. - value := reflect.New(t).Elem() - - var err error - for { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - wire := int(x) & 7 - - b, err = unmarshal(b, valToPointer(value.Addr()), wire) - if err != nil { - return nil, err - } - - if len(b) == 0 { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(epb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - if epb, ok := pb.(extensionsBytes); ok { - ClearExtension(pb, extension) - newb, err := encodeExtension(extension, value) - if err != nil { - return err - } - bb := epb.GetExtensions() - *bb = append(*bb, newb...) - return nil - } - epb, err := extendable(pb) - if err != nil { - return err - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - *ext = []byte{} - return - } - epb, err := extendable(pb) - if err != nil { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go deleted file mode 100644 index 6f1ae120e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go +++ /dev/null @@ -1,389 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "bytes" - "errors" - "fmt" - "io" - "reflect" - "sort" - "strings" - "sync" -) - -type extensionsBytes interface { - Message - ExtensionRangeArray() []ExtensionRange - GetExtensions() *[]byte -} - -type slowExtensionAdapter struct { - extensionsBytes -} - -func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { - panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") -} - -func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - b := s.GetExtensions() - m, err := BytesToExtensionsMap(*b) - if err != nil { - panic(err) - } - return m, notLocker{} -} - -func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { - if reflect.ValueOf(pb).IsNil() { - return ifnotset - } - value, err := GetExtension(pb, extension) - if err != nil { - return ifnotset - } - if value == nil { - return ifnotset - } - if value.(*bool) == nil { - return ifnotset - } - return *(value.(*bool)) -} - -func (this *Extension) Equal(that *Extension) bool { - if err := this.Encode(); err != nil { - return false - } - if err := that.Encode(); err != nil { - return false - } - return bytes.Equal(this.enc, that.enc) -} - -func (this *Extension) Compare(that *Extension) int { - if err := this.Encode(); err != nil { - return 1 - } - if err := that.Encode(); err != nil { - return -1 - } - return bytes.Compare(this.enc, that.enc) -} - -func SizeOfInternalExtension(m extendableProto) (n int) { - info := getMarshalInfo(reflect.TypeOf(m)) - return info.sizeV1Extensions(m.extensionsWrite()) -} - -type sortableMapElem struct { - field int32 - ext Extension -} - -func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { - s := make(sortableExtensions, 0, len(m)) - for k, v := range m { - s = append(s, &sortableMapElem{field: k, ext: v}) - } - return s -} - -type sortableExtensions []*sortableMapElem - -func (this sortableExtensions) Len() int { return len(this) } - -func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } - -func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } - -func (this sortableExtensions) String() string { - sort.Sort(this) - ss := make([]string, len(this)) - for i := range this { - ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) - } - return "map[" + strings.Join(ss, ",") + "]" -} - -func StringFromInternalExtension(m extendableProto) string { - return StringFromExtensionsMap(m.extensionsWrite()) -} - -func StringFromExtensionsMap(m map[int32]Extension) string { - return newSortableExtensionsFromMap(m).String() -} - -func StringFromExtensionsBytes(ext []byte) string { - m, err := BytesToExtensionsMap(ext) - if err != nil { - panic(err) - } - return StringFromExtensionsMap(m) -} - -func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMap(m.extensionsWrite(), data) -} - -func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMapBackwards(m.extensionsWrite(), data) -} - -func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[o:], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - o += n - } - return o, nil -} - -func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - end := len(data) - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[end-len(e.enc):], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - end -= n - o += n - } - return o, nil -} - -func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { - e := m[id] - if err := e.Encode(); err != nil { - return nil, err - } - return e.enc, nil -} - -func size(buf []byte, wire int) (int, error) { - switch wire { - case WireVarint: - _, n := DecodeVarint(buf) - return n, nil - case WireFixed64: - return 8, nil - case WireBytes: - v, n := DecodeVarint(buf) - return int(v) + n, nil - case WireFixed32: - return 4, nil - case WireStartGroup: - offset := 0 - for { - u, n := DecodeVarint(buf[offset:]) - fwire := int(u & 0x7) - offset += n - if fwire == WireEndGroup { - return offset, nil - } - s, err := size(buf[offset:], wire) - if err != nil { - return 0, err - } - offset += s - } - } - return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) -} - -func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { - m := make(map[int32]Extension) - i := 0 - for i < len(buf) { - tag, n := DecodeVarint(buf[i:]) - if n <= 0 { - return nil, fmt.Errorf("unable to decode varint") - } - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size(buf[i+n:], wireType) - if err != nil { - return nil, err - } - end := i + int(l) + n - m[int32(fieldNum)] = Extension{enc: buf[i:end]} - i = end - } - return m, nil -} - -func NewExtension(e []byte) Extension { - ee := Extension{enc: make([]byte, len(e))} - copy(ee.enc, e) - return ee -} - -func AppendExtension(e Message, tag int32, buf []byte) { - if ee, eok := e.(extensionsBytes); eok { - ext := ee.GetExtensions() - *ext = append(*ext, buf...) - return - } - if ee, eok := e.(extendableProto); eok { - m := ee.extensionsWrite() - ext := m[int32(tag)] // may be missing - ext.enc = append(ext.enc, buf...) - m[int32(tag)] = ext - } -} - -func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { - u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) - ei := u.getExtElemInfo(extension) - v := value - p := toAddrPointer(&v, ei.isptr) - siz := ei.sizer(p, SizeVarint(ei.wiretag)) - buf := make([]byte, 0, siz) - return ei.marshaler(buf, p, ei.wiretag, false) -} - -func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { - o := 0 - for o < len(buf) { - tag, n := DecodeVarint((buf)[o:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - if o+n > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - l, err := size((buf)[o+n:], wireType) - if err != nil { - return nil, err - } - if int32(fieldNum) == extension.Field { - if o+n+l > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - v, err := decodeExtension((buf)[o:o+n+l], extension) - if err != nil { - return nil, err - } - return v, nil - } - o += n + l - } - return defaultExtensionValue(extension) -} - -func (this *Extension) Encode() error { - if this.enc == nil { - var err error - this.enc, err = encodeExtension(this.desc, this.value) - if err != nil { - return err - } - } - return nil -} - -func (this Extension) GoString() string { - if err := this.Encode(); err != nil { - return fmt.Sprintf("error encoding extension: %v", err) - } - return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) -} - -func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return errors.New("proto: bad extension number; not in declared ranges") - } - return SetExtension(pb, desc, value) -} - -func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return nil, fmt.Errorf("unregistered field number %d", fieldNum) - } - return GetExtension(pb, desc) -} - -func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { - x := &XXX_InternalExtensions{ - p: new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }), - } - x.p.extensionMap = m - return *x -} - -func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { - pb := extendable.(extendableProto) - return pb.extensionsWrite() -} - -func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { - ext := pb.GetExtensions() - for offset < len(*ext) { - tag, n1 := DecodeVarint((*ext)[offset:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - n2, err := size((*ext)[offset+n1:], wireType) - if err != nil { - panic(err) - } - newOffset := offset + n1 + n2 - if fieldNum == theFieldNum { - *ext = append((*ext)[:offset], (*ext)[newOffset:]...) - return offset - } - offset = newOffset - } - return -1 -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib.go b/vendor/github.com/gogo/protobuf/proto/lib.go deleted file mode 100644 index 80db1c155..000000000 --- a/vendor/github.com/gogo/protobuf/proto/lib.go +++ /dev/null @@ -1,973 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/gogo/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/gogo/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the wire data. -type RequiredNotSetError struct{ field string } - -func (e *RequiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -type invalidUTF8Error struct{ field string } - -func (e *invalidUTF8Error) Error() string { - if e.field == "" { - return "proto: invalid UTF-8 detected" - } - return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) -} -func (e *invalidUTF8Error) InvalidUTF8() bool { - return true -} - -// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. -// This error should not be exposed to the external API as such errors should -// be recreated with the field information. -var errInvalidUTF8 = &invalidUTF8Error{} - -// isNonFatal reports whether the error is either a RequiredNotSet error -// or a InvalidUTF8 error. -func isNonFatal(err error) bool { - if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { - return true - } - if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { - return true - } - return false -} - -type nonFatal struct{ E error } - -// Merge merges err into nf and reports whether it was successful. -// Otherwise it returns false for any fatal non-nil errors. -func (nf *nonFatal) Merge(err error) (ok bool) { - if err == nil { - return true // not an error - } - if !isNonFatal(err) { - return false // fatal error - } - if nf.E == nil { - nf.E = err // store first instance of non-fatal error - } - return true -} - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - deterministic bool -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -// SetDeterministic sets whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (p *Buffer) SetDeterministic(deterministic bool) { - p.deterministic = deterministic -} - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - sindex := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = sindex -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or T or []*T or []T - switch f.Kind() { - case reflect.Struct: - setDefaults(f, recur, zeros) - - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.Kind() == reflect.Ptr && e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Struct: - nestedMessage = true // non-nullable - - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr, reflect.Struct: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// mapKeys returns a sort.Interface to be used for sorting the map keys. -// Map fields may have key types of non-float scalars, strings and enums. -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{vs: vs} - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - case reflect.Bool: - s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true - case reflect.String: - s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } - default: - panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -const ( - // ProtoPackageIsVersion3 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion3 = true - - // ProtoPackageIsVersion2 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion2 = true - - // ProtoPackageIsVersion1 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion1 = true -) - -// InternalMessageInfo is a type used internally by generated .pb.go files. -// This type is not intended to be used by non-generated code. -// This type is not subject to any compatibility guarantee. -type InternalMessageInfo struct { - marshal *marshalInfo - unmarshal *unmarshalInfo - merge *mergeInfo - discard *discardInfo -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go deleted file mode 100644 index b3aa39190..000000000 --- a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go +++ /dev/null @@ -1,50 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "encoding/json" - "strconv" -) - -type Sizer interface { - Size() int -} - -type ProtoSizer interface { - ProtoSize() int -} - -func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { - s, ok := m[value] - if !ok { - s = strconv.Itoa(int(value)) - } - return json.Marshal(s) -} diff --git a/vendor/github.com/gogo/protobuf/proto/message_set.go b/vendor/github.com/gogo/protobuf/proto/message_set.go deleted file mode 100644 index f48a75676..000000000 --- a/vendor/github.com/gogo/protobuf/proto/message_set.go +++ /dev/null @@ -1,181 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Support for message sets. - */ - -import ( - "errors" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - return ms.find(pb) != nil -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func unmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go deleted file mode 100644 index b6cad9083..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,357 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" - "sync" -) - -const unsafeAllowed = false - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// zeroField is a noop when calling pointer.offset. -var zeroField = field([]int{}) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// The pointer type is for the table-driven decoder. -// The implementation here uses a reflect.Value of pointer type to -// create a generic pointer. In pointer_unsafe.go we use unsafe -// instead of reflect to implement the same (but faster) interface. -type pointer struct { - v reflect.Value -} - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - return pointer{v: reflect.ValueOf(*i)} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - v := reflect.ValueOf(*i) - u := reflect.New(v.Type()) - u.Elem().Set(v) - return pointer{v: u} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{v: v} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} -} - -func (p pointer) isNil() bool { - return p.v.IsNil() -} - -// grow updates the slice s in place to make it one element longer. -// s must be addressable. -// Returns the (addressable) new element. -func grow(s reflect.Value) reflect.Value { - n, m := s.Len(), s.Cap() - if n < m { - s.SetLen(n + 1) - } else { - s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) - } - return s.Index(n) -} - -func (p pointer) toInt64() *int64 { - return p.v.Interface().(*int64) -} -func (p pointer) toInt64Ptr() **int64 { - return p.v.Interface().(**int64) -} -func (p pointer) toInt64Slice() *[]int64 { - return p.v.Interface().(*[]int64) -} - -var int32ptr = reflect.TypeOf((*int32)(nil)) - -func (p pointer) toInt32() *int32 { - return p.v.Convert(int32ptr).Interface().(*int32) -} - -// The toInt32Ptr/Slice methods don't work because of enums. -// Instead, we must use set/get methods for the int32ptr/slice case. -/* - func (p pointer) toInt32Ptr() **int32 { - return p.v.Interface().(**int32) -} - func (p pointer) toInt32Slice() *[]int32 { - return p.v.Interface().(*[]int32) -} -*/ -func (p pointer) getInt32Ptr() *int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().(*int32) - } - // an enum - return p.v.Elem().Convert(int32PtrType).Interface().(*int32) -} -func (p pointer) setInt32Ptr(v int32) { - // Allocate value in a *int32. Possibly convert that to a *enum. - // Then assign it to a **int32 or **enum. - // Note: we can convert *int32 to *enum, but we can't convert - // **int32 to **enum! - p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) -} - -// getInt32Slice copies []int32 from p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getInt32Slice() []int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().([]int32) - } - // an enum - // Allocate a []int32, then assign []enum's values into it. - // Note: we can't convert []enum to []int32. - slice := p.v.Elem() - s := make([]int32, slice.Len()) - for i := 0; i < slice.Len(); i++ { - s[i] = int32(slice.Index(i).Int()) - } - return s -} - -// setInt32Slice copies []int32 into p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setInt32Slice(v []int32) { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - p.v.Elem().Set(reflect.ValueOf(v)) - return - } - // an enum - // Allocate a []enum, then assign []int32's values into it. - // Note: we can't convert []enum to []int32. - slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) - for i, x := range v { - slice.Index(i).SetInt(int64(x)) - } - p.v.Elem().Set(slice) -} -func (p pointer) appendInt32Slice(v int32) { - grow(p.v.Elem()).SetInt(int64(v)) -} - -func (p pointer) toUint64() *uint64 { - return p.v.Interface().(*uint64) -} -func (p pointer) toUint64Ptr() **uint64 { - return p.v.Interface().(**uint64) -} -func (p pointer) toUint64Slice() *[]uint64 { - return p.v.Interface().(*[]uint64) -} -func (p pointer) toUint32() *uint32 { - return p.v.Interface().(*uint32) -} -func (p pointer) toUint32Ptr() **uint32 { - return p.v.Interface().(**uint32) -} -func (p pointer) toUint32Slice() *[]uint32 { - return p.v.Interface().(*[]uint32) -} -func (p pointer) toBool() *bool { - return p.v.Interface().(*bool) -} -func (p pointer) toBoolPtr() **bool { - return p.v.Interface().(**bool) -} -func (p pointer) toBoolSlice() *[]bool { - return p.v.Interface().(*[]bool) -} -func (p pointer) toFloat64() *float64 { - return p.v.Interface().(*float64) -} -func (p pointer) toFloat64Ptr() **float64 { - return p.v.Interface().(**float64) -} -func (p pointer) toFloat64Slice() *[]float64 { - return p.v.Interface().(*[]float64) -} -func (p pointer) toFloat32() *float32 { - return p.v.Interface().(*float32) -} -func (p pointer) toFloat32Ptr() **float32 { - return p.v.Interface().(**float32) -} -func (p pointer) toFloat32Slice() *[]float32 { - return p.v.Interface().(*[]float32) -} -func (p pointer) toString() *string { - return p.v.Interface().(*string) -} -func (p pointer) toStringPtr() **string { - return p.v.Interface().(**string) -} -func (p pointer) toStringSlice() *[]string { - return p.v.Interface().(*[]string) -} -func (p pointer) toBytes() *[]byte { - return p.v.Interface().(*[]byte) -} -func (p pointer) toBytesSlice() *[][]byte { - return p.v.Interface().(*[][]byte) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return p.v.Interface().(*XXX_InternalExtensions) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return p.v.Interface().(*map[int32]Extension) -} -func (p pointer) getPointer() pointer { - return pointer{v: p.v.Elem()} -} -func (p pointer) setPointer(q pointer) { - p.v.Elem().Set(q.v) -} -func (p pointer) appendPointer(q pointer) { - grow(p.v.Elem()).Set(q.v) -} - -// getPointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getPointerSlice() []pointer { - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// setPointerSlice copies []pointer into p as a new []*T. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setPointerSlice(v []pointer) { - if v == nil { - p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) - return - } - s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) - for _, p := range v { - s = reflect.Append(s, p.v) - } - p.v.Elem().Set(s) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - if p.v.Elem().IsNil() { - return pointer{v: p.v.Elem()} - } - return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct -} - -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - // TODO: check that p.v.Type().Elem() == t? - return p.v -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} - -var atomicLock sync.Mutex diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go deleted file mode 100644 index 7ffd3c29d..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ /dev/null @@ -1,59 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" -) - -// TODO: untested, so probably incorrect. - -func (p pointer) getRef() pointer { - return pointer{v: p.v.Addr()} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index d55a335d9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,308 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "sync/atomic" - "unsafe" -) - -const unsafeAllowed = true - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// zeroField is a noop when calling pointer.offset. -const zeroField = field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != invalidField -} - -// The pointer type below is for the new table-driven encoder/decoder. -// The implementation here uses unsafe.Pointer to create a generic pointer. -// In pointer_reflect.go we use reflect instead of unsafe to implement -// the same (but slower) interface. -type pointer struct { - p unsafe.Pointer -} - -// size of pointer -var ptrSize = unsafe.Sizeof(uintptr(0)) - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - // Super-tricky - read pointer out of data word of interface value. - // Saves ~25ns over the equivalent: - // return valToPointer(reflect.ValueOf(*i)) - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - // Super-tricky - read or get the address of data word of interface value. - if isptr { - // The interface is of pointer type, thus it is a direct interface. - // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} - } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - // For safety, we should panic if !f.IsValid, however calling panic causes - // this to no longer be inlineable, which is a serious performance cost. - /* - if !f.IsValid() { - panic("invalid field") - } - */ - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -func (p pointer) isNil() bool { - return p.p == nil -} - -func (p pointer) toInt64() *int64 { - return (*int64)(p.p) -} -func (p pointer) toInt64Ptr() **int64 { - return (**int64)(p.p) -} -func (p pointer) toInt64Slice() *[]int64 { - return (*[]int64)(p.p) -} -func (p pointer) toInt32() *int32 { - return (*int32)(p.p) -} - -// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. -/* - func (p pointer) toInt32Ptr() **int32 { - return (**int32)(p.p) - } - func (p pointer) toInt32Slice() *[]int32 { - return (*[]int32)(p.p) - } -*/ -func (p pointer) getInt32Ptr() *int32 { - return *(**int32)(p.p) -} -func (p pointer) setInt32Ptr(v int32) { - *(**int32)(p.p) = &v -} - -// getInt32Slice loads a []int32 from p. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getInt32Slice() []int32 { - return *(*[]int32)(p.p) -} - -// setInt32Slice stores a []int32 to p. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setInt32Slice(v []int32) { - *(*[]int32)(p.p) = v -} - -// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? -func (p pointer) appendInt32Slice(v int32) { - s := (*[]int32)(p.p) - *s = append(*s, v) -} - -func (p pointer) toUint64() *uint64 { - return (*uint64)(p.p) -} -func (p pointer) toUint64Ptr() **uint64 { - return (**uint64)(p.p) -} -func (p pointer) toUint64Slice() *[]uint64 { - return (*[]uint64)(p.p) -} -func (p pointer) toUint32() *uint32 { - return (*uint32)(p.p) -} -func (p pointer) toUint32Ptr() **uint32 { - return (**uint32)(p.p) -} -func (p pointer) toUint32Slice() *[]uint32 { - return (*[]uint32)(p.p) -} -func (p pointer) toBool() *bool { - return (*bool)(p.p) -} -func (p pointer) toBoolPtr() **bool { - return (**bool)(p.p) -} -func (p pointer) toBoolSlice() *[]bool { - return (*[]bool)(p.p) -} -func (p pointer) toFloat64() *float64 { - return (*float64)(p.p) -} -func (p pointer) toFloat64Ptr() **float64 { - return (**float64)(p.p) -} -func (p pointer) toFloat64Slice() *[]float64 { - return (*[]float64)(p.p) -} -func (p pointer) toFloat32() *float32 { - return (*float32)(p.p) -} -func (p pointer) toFloat32Ptr() **float32 { - return (**float32)(p.p) -} -func (p pointer) toFloat32Slice() *[]float32 { - return (*[]float32)(p.p) -} -func (p pointer) toString() *string { - return (*string)(p.p) -} -func (p pointer) toStringPtr() **string { - return (**string)(p.p) -} -func (p pointer) toStringSlice() *[]string { - return (*[]string)(p.p) -} -func (p pointer) toBytes() *[]byte { - return (*[]byte)(p.p) -} -func (p pointer) toBytesSlice() *[][]byte { - return (*[][]byte)(p.p) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(p.p) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return (*map[int32]Extension)(p.p) -} - -// getPointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getPointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// setPointerSlice stores []pointer into p as a []*T. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setPointerSlice(v []pointer) { - // Super-tricky - p should point to a []*T where T is a - // message type. We store it as []pointer. - *(*[]pointer)(p.p) = v -} - -// getPointer loads the pointer at p and returns it. -func (p pointer) getPointer() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// setPointer stores the pointer q at p. -func (p pointer) setPointer(q pointer) { - *(*unsafe.Pointer)(p.p) = q.p -} - -// append q to the slice pointed to by p. -func (p pointer) appendPointer(q pointer) { - s := (*[]unsafe.Pointer)(p.p) - *s = append(*s, q.p) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - // Super-tricky - read pointer out of data word of interface value. - return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} -} - -// asPointerTo returns a reflect.Value that is a pointer to an -// object of type t stored at p. -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go deleted file mode 100644 index aca8eed02..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ /dev/null @@ -1,56 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -func (p pointer) getRef() pointer { - return pointer{p: (unsafe.Pointer)(&p.p)} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/properties.go b/vendor/github.com/gogo/protobuf/proto/properties.go deleted file mode 100644 index 28da1475f..000000000 --- a/vendor/github.com/gogo/protobuf/proto/properties.go +++ /dev/null @@ -1,610 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - CustomType string - CastType string - StdTime bool - StdDuration bool - WktPointer bool - - stype reflect.Type // set for struct types only - ctype reflect.Type // set for custom types only - sprop *StructProperties // set for struct types only - - mtype reflect.Type // set for map types only - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - log.Printf("proto: tag has too few fields: %q", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - case "fixed32": - p.WireType = WireFixed32 - case "fixed64": - p.WireType = WireFixed64 - case "zigzag32": - p.WireType = WireVarint - case "zigzag64": - p.WireType = WireVarint - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - log.Printf("proto: tag has unknown wire type: %q", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - -outer: - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break outer - } - case strings.HasPrefix(f, "embedded="): - p.OrigName = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "customtype="): - p.CustomType = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "casttype="): - p.CastType = strings.Split(f, "=")[1] - case f == "stdtime": - p.StdTime = true - case f == "stdduration": - p.StdDuration = true - case f == "wktptr": - p.WktPointer = true - } - } -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// setFieldProps initializes the field properties for submessages and maps. -func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - isMap := typ.Kind() == reflect.Map - if len(p.CustomType) > 0 && !isMap { - p.ctype = typ - p.setTag(lockGetProp) - return - } - if p.StdTime && !isMap { - p.setTag(lockGetProp) - return - } - if p.StdDuration && !isMap { - p.setTag(lockGetProp) - return - } - if p.WktPointer && !isMap { - p.setTag(lockGetProp) - return - } - switch t1 := typ; t1.Kind() { - case reflect.Struct: - p.stype = typ - case reflect.Ptr: - if t1.Elem().Kind() == reflect.Struct { - p.stype = t1.Elem() - } - case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - case reflect.Struct: - p.stype = t3 - } - case reflect.Struct: - p.stype = t2 - } - - case reflect.Map: - - p.mtype = t1 - p.MapKeyProp = &Properties{} - p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.MapValProp = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - - p.MapValProp.CustomType = p.CustomType - p.MapValProp.StdDuration = p.StdDuration - p.MapValProp.StdTime = p.StdTime - p.MapValProp.WktPointer = p.WktPointer - p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - p.setTag(lockGetProp) -} - -func (p *Properties) setTag(lockGetProp bool) { - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() -) - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - p.setFieldProps(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -type ( - oneofFuncsIface interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - oneofWrappersIface interface { - XXX_OneofWrappers() []interface{} - } -) - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - return prop - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - isOneofMessage := false - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - isOneofMessage = true - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - if isOneofMessage { - var oots []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oots = m.XXX_OneofFuncs() - case oneofWrappersIface: - oots = m.XXX_OneofWrappers() - } - if len(oots) > 0 { - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) -var enumStringMaps = make(map[string]map[int32]string) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap - if _, ok := enumStringMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumStringMaps[typeName] = unusedNameMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go deleted file mode 100644 index 40ea3dd93..000000000 --- a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go +++ /dev/null @@ -1,36 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "reflect" -) - -var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() -var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/vendor/github.com/gogo/protobuf/proto/skip_gogo.go deleted file mode 100644 index 5a5fd93f7..000000000 --- a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go +++ /dev/null @@ -1,119 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "fmt" - "io" -) - -func Skip(data []byte) (n int, err error) { - l := len(data) - index := 0 - for index < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - 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 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - index++ - if data[index-1] < 0x80 { - break - } - } - return index, nil - case 1: - index += 8 - return index, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - index += length - return index, nil - case 3: - for { - var innerWire uint64 - var start int = index - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := Skip(data[start:]) - if err != nil { - return 0, err - } - index = start + next - } - return index, nil - case 4: - return index, nil - case 5: - index += 4 - return index, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal.go b/vendor/github.com/gogo/protobuf/proto/table_marshal.go deleted file mode 100644 index f8babdefa..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal.go +++ /dev/null @@ -1,3009 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -import ( - "errors" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// a sizer takes a pointer to a field and the size of its tag, computes the size of -// the encoded data. -type sizer func(pointer, int) int - -// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), -// marshals the field to the end of the slice, returns the slice and error (if any). -type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) - -// marshalInfo is the information used for marshaling a message. -type marshalInfo struct { - typ reflect.Type - fields []*marshalFieldInfo - unrecognized field // offset of XXX_unrecognized - extensions field // offset of XXX_InternalExtensions - v1extensions field // offset of XXX_extensions - sizecache field // offset of XXX_sizecache - initialized int32 // 0 -- only typ is set, 1 -- fully initialized - messageset bool // uses message set wire format - hasmarshaler bool // has custom marshaler - sync.RWMutex // protect extElems map, also for initialization - extElems map[int32]*marshalElemInfo // info of extension elements - - hassizer bool // has custom sizer - hasprotosizer bool // has custom protosizer - - bytesExtensions field // offset of XXX_extensions where the field type is []byte -} - -// marshalFieldInfo is the information used for marshaling a field of a message. -type marshalFieldInfo struct { - field field - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isPointer bool - required bool // field is required - name string // name of the field, for error reporting - oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements -} - -// marshalElemInfo is the information used for marshaling an extension or oneof element. -type marshalElemInfo struct { - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) -} - -var ( - marshalInfoMap = map[reflect.Type]*marshalInfo{} - marshalInfoLock sync.Mutex - - uint8SliceType = reflect.TypeOf(([]uint8)(nil)).Kind() -) - -// getMarshalInfo returns the information to marshal a given type of message. -// The info it returns may not necessarily initialized. -// t is the type of the message (NOT the pointer to it). -func getMarshalInfo(t reflect.Type) *marshalInfo { - marshalInfoLock.Lock() - u, ok := marshalInfoMap[t] - if !ok { - u = &marshalInfo{typ: t} - marshalInfoMap[t] = u - } - marshalInfoLock.Unlock() - return u -} - -// Size is the entry point from generated code, -// and should be ONLY called by generated code. -// It computes the size of encoded data of msg. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Size(msg Message) int { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return 0 - } - return u.size(ptr) -} - -// Marshal is the entry point from generated code, -// and should be ONLY called by generated code. -// It marshals msg to the end of b. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return b, ErrNil - } - return u.marshal(b, ptr, deterministic) -} - -func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { - // u := a.marshal, but atomically. - // We use an atomic here to ensure memory consistency. - u := atomicLoadMarshalInfo(&a.marshal) - if u == nil { - // Get marshal information from type of message. - t := reflect.ValueOf(msg).Type() - if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) - } - u = getMarshalInfo(t.Elem()) - // Store it in the cache for later users. - // a.marshal = u, but atomically. - atomicStoreMarshalInfo(&a.marshal, u) - } - return u -} - -// size is the main function to compute the size of the encoded data of a message. -// ptr is the pointer to the message. -func (u *marshalInfo) size(ptr pointer) int { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - // Uses the message's Size method if available - if u.hassizer { - s := ptr.asPointerTo(u.typ).Interface().(Sizer) - return s.Size() - } - // Uses the message's ProtoSize method if available - if u.hasprotosizer { - s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) - return s.ProtoSize() - } - - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b, _ := m.Marshal() - return len(b) - } - - n := 0 - for _, f := range u.fields { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - n += f.sizer(ptr.offset(f.field), f.tagsize) - } - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - n += u.sizeMessageSet(e) - } else { - n += u.sizeExtensions(e) - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - n += u.sizeV1Extensions(m) - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - n += len(s) - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - n += len(s) - } - - // cache the result for use in marshal - if u.sizecache.IsValid() { - atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) - } - return n -} - -// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), -// fall back to compute the size. -func (u *marshalInfo) cachedsize(ptr pointer) int { - if u.sizecache.IsValid() { - return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) - } - return u.size(ptr) -} - -// marshal is the main function to marshal a message. It takes a byte slice and appends -// the encoded data to the end of the slice, returns the slice and error (if any). -// ptr is the pointer to the message. -// If deterministic is true, map is marshaled in deterministic order. -func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b1, err := m.Marshal() - b = append(b, b1...) - return b, err - } - - var err, errLater error - // The old marshaler encodes extensions at beginning. - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - b, err = u.appendMessageSet(b, e, deterministic) - } else { - b, err = u.appendExtensions(b, e, deterministic) - } - if err != nil { - return b, err - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - b, err = u.appendV1Extensions(b, m, deterministic) - if err != nil { - return b, err - } - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - b = append(b, s...) - } - for _, f := range u.fields { - if f.required { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // Required field is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name} - } - continue - } - } - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) - if err != nil { - if err1, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name + "." + err1.field} - } - continue - } - if err == errRepeatedHasNil { - err = errors.New("proto: repeated field " + f.name + " has nil element") - } - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return b, err - } - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - b = append(b, s...) - } - return b, errLater -} - -// computeMarshalInfo initializes the marshal info. -func (u *marshalInfo) computeMarshalInfo() { - u.Lock() - defer u.Unlock() - if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock - return - } - - t := u.typ - u.unrecognized = invalidField - u.extensions = invalidField - u.v1extensions = invalidField - u.bytesExtensions = invalidField - u.sizecache = invalidField - isOneofMessage := false - - if reflect.PtrTo(t).Implements(sizerType) { - u.hassizer = true - } - if reflect.PtrTo(t).Implements(protosizerType) { - u.hasprotosizer = true - } - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if reflect.PtrTo(t).Implements(marshalerType) { - u.hasmarshaler = true - atomic.StoreInt32(&u.initialized, 1) - return - } - - n := t.NumField() - - // deal with XXX fields first - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Tag.Get("protobuf_oneof") != "" { - isOneofMessage = true - } - if !strings.HasPrefix(f.Name, "XXX_") { - continue - } - switch f.Name { - case "XXX_sizecache": - u.sizecache = toField(&f) - case "XXX_unrecognized": - u.unrecognized = toField(&f) - case "XXX_InternalExtensions": - u.extensions = toField(&f) - u.messageset = f.Tag.Get("protobuf_messageset") == "1" - case "XXX_extensions": - if f.Type.Kind() == reflect.Map { - u.v1extensions = toField(&f) - } else { - u.bytesExtensions = toField(&f) - } - case "XXX_NoUnkeyedLiteral": - // nothing to do - default: - panic("unknown XXX field: " + f.Name) - } - n-- - } - - // get oneof implementers - var oneofImplementers []interface{} - // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler - if isOneofMessage { - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - } - - // normal fields - fields := make([]marshalFieldInfo, n) // batch allocation - u.fields = make([]*marshalFieldInfo, 0, n) - for i, j := 0, 0; i < t.NumField(); i++ { - f := t.Field(i) - - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - field := &fields[j] - j++ - field.name = f.Name - u.fields = append(u.fields, field) - if f.Tag.Get("protobuf_oneof") != "" { - field.computeOneofFieldInfo(&f, oneofImplementers) - continue - } - if f.Tag.Get("protobuf") == "" { - // field has no tag (not in generated message), ignore it - u.fields = u.fields[:len(u.fields)-1] - j-- - continue - } - field.computeMarshalFieldInfo(&f) - } - - // fields are marshaled in tag order on the wire. - sort.Sort(byTag(u.fields)) - - atomic.StoreInt32(&u.initialized, 1) -} - -// helper for sorting fields by tag -type byTag []*marshalFieldInfo - -func (a byTag) Len() int { return len(a) } -func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } - -// getExtElemInfo returns the information to marshal an extension element. -// The info it returns is initialized. -func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { - // get from cache first - u.RLock() - e, ok := u.extElems[desc.Field] - u.RUnlock() - if ok { - return e - } - - t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct - tags := strings.Split(desc.Tag, ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(t, tags, false, false) - e = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - isptr: t.Kind() == reflect.Ptr, - } - - // update cache - u.Lock() - if u.extElems == nil { - u.extElems = make(map[int32]*marshalElemInfo) - } - u.extElems[desc.Field] = e - u.Unlock() - return e -} - -// computeMarshalFieldInfo fills up the information to marshal a field. -func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { - // parse protobuf tag of the field. - // tag has format of "bytes,49,opt,name=foo,def=hello!" - tags := strings.Split(f.Tag.Get("protobuf"), ",") - if tags[0] == "" { - return - } - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if tags[2] == "req" { - fi.required = true - } - fi.setTag(f, tag, wt) - fi.setMarshaler(f, tags) -} - -func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f) - fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. - fi.isPointer = true - fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) - fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) - - ityp := f.Type // interface type - for _, o := range oneofImplementers { - t := reflect.TypeOf(o) - if !t.Implements(ityp) { - continue - } - sf := t.Elem().Field(0) // oneof implementer is a struct with a single field - tags := strings.Split(sf.Tag.Get("protobuf"), ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value - fi.oneofElems[t.Elem()] = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - } - } -} - -// wiretype returns the wire encoding of the type. -func wiretype(encoding string) uint64 { - switch encoding { - case "fixed32": - return WireFixed32 - case "fixed64": - return WireFixed64 - case "varint", "zigzag32", "zigzag64": - return WireVarint - case "bytes": - return WireBytes - case "group": - return WireStartGroup - } - panic("unknown wire type " + encoding) -} - -// setTag fills up the tag (in wire format) and its size in the info of a field. -func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f) - fi.wiretag = uint64(tag)<<3 | wt - fi.tagsize = SizeVarint(uint64(tag) << 3) -} - -// setMarshaler fills up the sizer and marshaler in the info of a field. -func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { - switch f.Type.Kind() { - case reflect.Map: - // map field - fi.isPointer = true - fi.sizer, fi.marshaler = makeMapMarshaler(f) - return - case reflect.Ptr, reflect.Slice: - fi.isPointer = true - } - fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) -} - -// typeMarshaler returns the sizer and marshaler of a given field. -// t is the type of the field. -// tags is the generated "protobuf" tag of the field. -// If nozero is true, zero value is not marshaled to the wire. -// If oneof is true, it is a oneof field. -func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { - encoding := tags[0] - - pointer := false - slice := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - packed := false - proto3 := false - ctype := false - isTime := false - isDuration := false - isWktPointer := false - validateUTF8 := true - for i := 2; i < len(tags); i++ { - if tags[i] == "packed" { - packed = true - } - if tags[i] == "proto3" { - proto3 = true - } - if strings.HasPrefix(tags[i], "customtype=") { - ctype = true - } - if tags[i] == "stdtime" { - isTime = true - } - if tags[i] == "stdduration" { - isDuration = true - } - if tags[i] == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - if !proto3 && !pointer && !slice { - nozero = false - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - if pointer { - return makeCustomPtrMarshaler(getMarshalInfo(t)) - } - return makeCustomMarshaler(getMarshalInfo(t)) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeTimePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeTimePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeTimeSliceMarshaler(getMarshalInfo(t)) - } - return makeTimeMarshaler(getMarshalInfo(t)) - } - - if isDuration { - if pointer { - if slice { - return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationPtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeDurationSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationMarshaler(getMarshalInfo(t)) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdDoubleValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValueMarshaler(getMarshalInfo(t)) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdFloatValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValueMarshaler(getMarshalInfo(t)) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBoolValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValueMarshaler(getMarshalInfo(t)) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdStringValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValueMarshaler(getMarshalInfo(t)) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBytesValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValueMarshaler(getMarshalInfo(t)) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return sizeBoolPtr, appendBoolPtr - } - if slice { - if packed { - return sizeBoolPackedSlice, appendBoolPackedSlice - } - return sizeBoolSlice, appendBoolSlice - } - if nozero { - return sizeBoolValueNoZero, appendBoolValueNoZero - } - return sizeBoolValue, appendBoolValue - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixed32Ptr, appendFixed32Ptr - } - if slice { - if packed { - return sizeFixed32PackedSlice, appendFixed32PackedSlice - } - return sizeFixed32Slice, appendFixed32Slice - } - if nozero { - return sizeFixed32ValueNoZero, appendFixed32ValueNoZero - } - return sizeFixed32Value, appendFixed32Value - case "varint": - if pointer { - return sizeVarint32Ptr, appendVarint32Ptr - } - if slice { - if packed { - return sizeVarint32PackedSlice, appendVarint32PackedSlice - } - return sizeVarint32Slice, appendVarint32Slice - } - if nozero { - return sizeVarint32ValueNoZero, appendVarint32ValueNoZero - } - return sizeVarint32Value, appendVarint32Value - } - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixedS32Ptr, appendFixedS32Ptr - } - if slice { - if packed { - return sizeFixedS32PackedSlice, appendFixedS32PackedSlice - } - return sizeFixedS32Slice, appendFixedS32Slice - } - if nozero { - return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero - } - return sizeFixedS32Value, appendFixedS32Value - case "varint": - if pointer { - return sizeVarintS32Ptr, appendVarintS32Ptr - } - if slice { - if packed { - return sizeVarintS32PackedSlice, appendVarintS32PackedSlice - } - return sizeVarintS32Slice, appendVarintS32Slice - } - if nozero { - return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero - } - return sizeVarintS32Value, appendVarintS32Value - case "zigzag32": - if pointer { - return sizeZigzag32Ptr, appendZigzag32Ptr - } - if slice { - if packed { - return sizeZigzag32PackedSlice, appendZigzag32PackedSlice - } - return sizeZigzag32Slice, appendZigzag32Slice - } - if nozero { - return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero - } - return sizeZigzag32Value, appendZigzag32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixed64Ptr, appendFixed64Ptr - } - if slice { - if packed { - return sizeFixed64PackedSlice, appendFixed64PackedSlice - } - return sizeFixed64Slice, appendFixed64Slice - } - if nozero { - return sizeFixed64ValueNoZero, appendFixed64ValueNoZero - } - return sizeFixed64Value, appendFixed64Value - case "varint": - if pointer { - return sizeVarint64Ptr, appendVarint64Ptr - } - if slice { - if packed { - return sizeVarint64PackedSlice, appendVarint64PackedSlice - } - return sizeVarint64Slice, appendVarint64Slice - } - if nozero { - return sizeVarint64ValueNoZero, appendVarint64ValueNoZero - } - return sizeVarint64Value, appendVarint64Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixedS64Ptr, appendFixedS64Ptr - } - if slice { - if packed { - return sizeFixedS64PackedSlice, appendFixedS64PackedSlice - } - return sizeFixedS64Slice, appendFixedS64Slice - } - if nozero { - return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero - } - return sizeFixedS64Value, appendFixedS64Value - case "varint": - if pointer { - return sizeVarintS64Ptr, appendVarintS64Ptr - } - if slice { - if packed { - return sizeVarintS64PackedSlice, appendVarintS64PackedSlice - } - return sizeVarintS64Slice, appendVarintS64Slice - } - if nozero { - return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero - } - return sizeVarintS64Value, appendVarintS64Value - case "zigzag64": - if pointer { - return sizeZigzag64Ptr, appendZigzag64Ptr - } - if slice { - if packed { - return sizeZigzag64PackedSlice, appendZigzag64PackedSlice - } - return sizeZigzag64Slice, appendZigzag64Slice - } - if nozero { - return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero - } - return sizeZigzag64Value, appendZigzag64Value - } - case reflect.Float32: - if pointer { - return sizeFloat32Ptr, appendFloat32Ptr - } - if slice { - if packed { - return sizeFloat32PackedSlice, appendFloat32PackedSlice - } - return sizeFloat32Slice, appendFloat32Slice - } - if nozero { - return sizeFloat32ValueNoZero, appendFloat32ValueNoZero - } - return sizeFloat32Value, appendFloat32Value - case reflect.Float64: - if pointer { - return sizeFloat64Ptr, appendFloat64Ptr - } - if slice { - if packed { - return sizeFloat64PackedSlice, appendFloat64PackedSlice - } - return sizeFloat64Slice, appendFloat64Slice - } - if nozero { - return sizeFloat64ValueNoZero, appendFloat64ValueNoZero - } - return sizeFloat64Value, appendFloat64Value - case reflect.String: - if validateUTF8 { - if pointer { - return sizeStringPtr, appendUTF8StringPtr - } - if slice { - return sizeStringSlice, appendUTF8StringSlice - } - if nozero { - return sizeStringValueNoZero, appendUTF8StringValueNoZero - } - return sizeStringValue, appendUTF8StringValue - } - if pointer { - return sizeStringPtr, appendStringPtr - } - if slice { - return sizeStringSlice, appendStringSlice - } - if nozero { - return sizeStringValueNoZero, appendStringValueNoZero - } - return sizeStringValue, appendStringValue - case reflect.Slice: - if slice { - return sizeBytesSlice, appendBytesSlice - } - if oneof { - // Oneof bytes field may also have "proto3" tag. - // We want to marshal it as a oneof field. Do this - // check before the proto3 check. - return sizeBytesOneof, appendBytesOneof - } - if proto3 { - return sizeBytes3, appendBytes3 - } - return sizeBytes, appendBytes - case reflect.Struct: - switch encoding { - case "group": - if slice { - return makeGroupSliceMarshaler(getMarshalInfo(t)) - } - return makeGroupMarshaler(getMarshalInfo(t)) - case "bytes": - if pointer { - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageMarshaler(getMarshalInfo(t)) - } else { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageRefMarshaler(getMarshalInfo(t)) - } - } - } - panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) -} - -// Below are functions to size/marshal a specific type of a field. -// They are stored in the field's info, and called by function pointers. -// They have type sizer or marshaler. - -func sizeFixed32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixedS32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFloat32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - return (4 + tagsize) * len(s) -} -func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixed64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFixedS64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFloat64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - return (8 + tagsize) * len(s) -} -func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeVarint32Value(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarint32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarint64Value(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - return SizeVarint(v) + tagsize -} -func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return SizeVarint(v) + tagsize -} -func sizeVarint64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return SizeVarint(*p) + tagsize -} -func sizeVarint64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(v) + tagsize - } - return n -} -func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize - } - return n -} -func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize - } - return n -} -func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeBoolValue(_ pointer, tagsize int) int { - return 1 + tagsize -} -func sizeBoolValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toBool() - if !v { - return 0 - } - return 1 + tagsize -} -func sizeBoolPtr(ptr pointer, tagsize int) int { - p := *ptr.toBoolPtr() - if p == nil { - return 0 - } - return 1 + tagsize -} -func sizeBoolSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - return (1 + tagsize) * len(s) -} -func sizeBoolPackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return 0 - } - return len(s) + SizeVarint(uint64(len(s))) + tagsize -} -func sizeStringValue(ptr pointer, tagsize int) int { - v := *ptr.toString() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toString() - if v == "" { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringPtr(ptr pointer, tagsize int) int { - p := *ptr.toStringPtr() - if p == nil { - return 0 - } - v := *p - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringSlice(ptr pointer, tagsize int) int { - s := *ptr.toStringSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} -func sizeBytes(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if v == nil { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytes3(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if len(v) == 0 { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesOneof(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesSlice(ptr pointer, tagsize int) int { - s := *ptr.toBytesSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} - -// appendFixed32 appends an encoded fixed32 to b. -func appendFixed32(b []byte, v uint32) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24)) - return b -} - -// appendFixed64 appends an encoded fixed64 to b. -func appendFixed64(b []byte, v uint64) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) - return b -} - -// appendVarint appends an encoded varint to b. -func appendVarint(b []byte, v uint64) []byte { - // TODO: make 1-byte (maybe 2-byte) case inline-able, once we - // have non-leaf inliner. - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte(v&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, *p) - return b, nil -} -func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(*p)) - return b, nil -} -func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(*p)) - return b, nil -} -func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, *p) - return b, nil -} -func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(*p)) - return b, nil -} -func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(*p)) - return b, nil -} -func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, *p) - return b, nil -} -func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - } - return b, nil -} -func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, v) - } - return b, nil -} -func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - if !v { - return b, nil - } - b = appendVarint(b, wiretag) - b = append(b, 1) - return b, nil -} - -func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toBoolPtr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - if *p { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(len(s))) - for _, v := range s { - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - if v == "" { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toStringSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} -func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if v == "" { - return b, nil - } - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - s := *ptr.toStringSlice() - for _, v := range s { - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if v == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if len(v) == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBytesSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} - -// makeGroupMarshaler returns the sizer and marshaler for a group. -// u is the marshal info of the underlying message. -func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - return u.size(p) + 2*tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - var err error - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, p, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - return b, err - } -} - -// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. -// u is the marshal info of the underlying message. -func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - n += u.size(v) + 2*tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, v, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMessageMarshaler returns the sizer and marshaler for a message field. -// u is the marshal info of the message. -func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.size(p) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(p) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, p, deterministic) - } -} - -// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. -// u is the marshal info of the message. -func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMapMarshaler returns the sizer and marshaler for a map field. -// f is the pointer to the reflect data structure of the field. -func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { - // figure out key and value type - t := f.Type - keyType := t.Key() - valType := t.Elem() - tags := strings.Split(f.Tag.Get("protobuf"), ",") - keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - stdOptions := false - for _, t := range tags { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "stdduration" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map - valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map - keyWireTag := 1<<3 | wiretype(keyTags[0]) - valWireTag := 2<<3 | wiretype(valTags[0]) - - // We create an interface to get the addresses of the map key and value. - // If value is pointer-typed, the interface is a direct interface, the - // idata itself is the value. Otherwise, the idata is the pointer to the - // value. - // Key cannot be pointer-typed. - valIsPtr := valType.Kind() == reflect.Ptr - - // If value is a message with nested maps, calling - // valSizer in marshal may be quadratic. We should use - // cached version in marshal (but not in size). - // If value is not message type, we don't have size cache, - // but it cannot be nested either. Just use valSizer. - valCachedSizer := valSizer - if valIsPtr && !stdOptions && valType.Elem().Kind() == reflect.Struct { - u := getMarshalInfo(valType.Elem()) - valCachedSizer = func(ptr pointer, tagsize int) int { - // Same as message sizer, but use cache. - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.cachedsize(p) - return siz + SizeVarint(uint64(siz)) + tagsize - } - } - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(t).Elem() // the map - n := 0 - for _, k := range m.MapKeys() { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(t).Elem() // the map - var err error - keys := m.MapKeys() - if len(keys) > 1 && deterministic { - sort.Sort(mapKeys(keys)) - } - - var nerr nonFatal - for _, k := range keys { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - b = appendVarint(b, tag) - siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - b = appendVarint(b, uint64(siz)) - b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) - if !nerr.Merge(err) { - return b, err - } - b, err = valMarshaler(b, vaddr, valWireTag, deterministic) - if err != ErrNil && !nerr.Merge(err) { // allow nil value in map - return b, err - } - } - return b, nerr.E - } -} - -// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. -// fi is the marshal info of the field. -// f is the pointer to the reflect data structure of the field. -func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { - // Oneof field is an interface. We need to get the actual data type on the fly. - t := f.Type - return func(ptr pointer, _ int) int { - p := ptr.getInterfacePointer() - if p.isNil() { - return 0 - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - e := fi.oneofElems[telem] - return e.sizer(p, e.tagsize) - }, - func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { - p := ptr.getInterfacePointer() - if p.isNil() { - return b, nil - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { - return b, errOneofHasNil - } - e := fi.oneofElems[telem] - return e.marshaler(b, p, e.wiretag, deterministic) - } -} - -// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. -func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - mu.Unlock() - return n -} - -// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. -func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// message set format is: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } - -// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field -// in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for id, e := range m { - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += siz + 1 // message, tag = 3 (size=1) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, 1) // message, tag = 3 (size=1) - } - mu.Unlock() - return n -} - -// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) -// to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for id, e := range m { - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - if !nerr.Merge(err) { - return b, err - } - b = append(b, 1<<3|WireEndGroup) - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, id := range keys { - e := m[int32(id)] - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - b = append(b, 1<<3|WireEndGroup) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// sizeV1Extensions computes the size of encoded data for a V1-API extension field. -func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { - if m == nil { - return 0 - } - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - return n -} - -// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. -func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { - if m == nil { - return b, nil - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - var err error - var nerr nonFatal - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// newMarshaler is the interface representing objects that can marshal themselves. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newMarshaler interface { - XXX_Size() int - XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -} - -// Size returns the encoded size of a protocol buffer message. -// This is the main entry point. -func Size(pb Message) int { - if m, ok := pb.(newMarshaler); ok { - return m.XXX_Size() - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, _ := m.Marshal() - return len(b) - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return 0 - } - var info InternalMessageInfo - return info.Size(pb) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, returning the data. -// This is the main entry point. -func Marshal(pb Message) ([]byte, error) { - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - b := make([]byte, 0, siz) - return m.XXX_Marshal(b, false) - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - return m.Marshal() - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return nil, ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - b := make([]byte, 0, siz) - return info.Marshal(b, pb, false) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, writing the result to the -// Buffer. -// This is an alternative entry point. It is not necessary to use -// a Buffer for most applications. -func (p *Buffer) Marshal(pb Message) error { - var err error - if p.deterministic { - if _, ok := pb.(Marshaler); ok { - return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) - } - } - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - p.grow(siz) // make sure buf has enough capacity - pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz] - pp, err = m.XXX_Marshal(pp, p.deterministic) - p.buf = append(p.buf, pp...) - return err - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - var b []byte - b, err = m.Marshal() - p.buf = append(p.buf, b...) - return err - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - p.grow(siz) // make sure buf has enough capacity - p.buf, err = info.Marshal(p.buf, pb, p.deterministic) - return err -} - -// grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to the -// buffer without another allocation. -func (p *Buffer) grow(n int) { - need := len(p.buf) + n - if need <= cap(p.buf) { - return - } - newCap := len(p.buf) * 2 - if newCap < need { - newCap = need - } - p.buf = append(make([]byte, 0, newCap), p.buf...) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go deleted file mode 100644 index 997f57c1e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go +++ /dev/null @@ -1,388 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "reflect" - "time" -) - -// makeMessageRefMarshaler differs a bit from makeMessageMarshaler -// It marshal a message T instead of a *T -func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - siz := u.size(ptr) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - b = appendVarint(b, wiretag) - siz := u.cachedsize(ptr) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, ptr, deterministic) - } -} - -// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler -// It marshals a slice of messages []T instead of []*T -func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - var err, errreq error - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - b = appendVarint(b, wiretag) - siz := u.size(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if err != nil { - if _, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errreq == nil { - errreq = err - } - continue - } - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - - return b, errreq - } -} - -func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_merge.go b/vendor/github.com/gogo/protobuf/proto/table_merge.go deleted file mode 100644 index 60dcf70d1..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_merge.go +++ /dev/null @@ -1,676 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -// Merge merges the src message into dst. -// This assumes that dst and src of the same type and are non-nil. -func (a *InternalMessageInfo) Merge(dst, src Message) { - mi := atomicLoadMergeInfo(&a.merge) - if mi == nil { - mi = getMergeInfo(reflect.TypeOf(dst).Elem()) - atomicStoreMergeInfo(&a.merge, mi) - } - mi.merge(toPointer(&dst), toPointer(&src)) -} - -type mergeInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []mergeFieldInfo - unrecognized field // Offset of XXX_unrecognized -} - -type mergeFieldInfo struct { - field field // Offset of field, guaranteed to be valid - - // isPointer reports whether the value in the field is a pointer. - // This is true for the following situations: - // * Pointer to struct - // * Pointer to basic type (proto2 only) - // * Slice (first value in slice header is a pointer) - // * String (first value in string header is a pointer) - isPointer bool - - // basicWidth reports the width of the field assuming that it is directly - // embedded in the struct (as is the case for basic types in proto3). - // The possible values are: - // 0: invalid - // 1: bool - // 4: int32, uint32, float32 - // 8: int64, uint64, float64 - basicWidth int - - // Where dst and src are pointers to the types being merged. - merge func(dst, src pointer) -} - -var ( - mergeInfoMap = map[reflect.Type]*mergeInfo{} - mergeInfoLock sync.Mutex -) - -func getMergeInfo(t reflect.Type) *mergeInfo { - mergeInfoLock.Lock() - defer mergeInfoLock.Unlock() - mi := mergeInfoMap[t] - if mi == nil { - mi = &mergeInfo{typ: t} - mergeInfoMap[t] = mi - } - return mi -} - -// merge merges src into dst assuming they are both of type *mi.typ. -func (mi *mergeInfo) merge(dst, src pointer) { - if dst.isNil() { - panic("proto: nil destination") - } - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&mi.initialized) == 0 { - mi.computeMergeInfo() - } - - for _, fi := range mi.fields { - sfp := src.offset(fi.field) - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string - continue - } - if fi.basicWidth > 0 { - switch { - case fi.basicWidth == 1 && !*sfp.toBool(): - continue - case fi.basicWidth == 4 && *sfp.toUint32() == 0: - continue - case fi.basicWidth == 8 && *sfp.toUint64() == 0: - continue - } - } - } - - dfp := dst.offset(fi.field) - fi.merge(dfp, sfp) - } - - // TODO: Make this faster? - out := dst.asPointerTo(mi.typ).Elem() - in := src.asPointerTo(mi.typ).Elem() - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - if mi.unrecognized.IsValid() { - if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { - *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) - } - } -} - -func (mi *mergeInfo) computeMergeInfo() { - mi.lock.Lock() - defer mi.lock.Unlock() - if mi.initialized != 0 { - return - } - t := mi.typ - n := t.NumField() - - props := GetProperties(t) - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - mfi := mergeFieldInfo{field: toField(&f)} - tf := f.Type - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - switch tf.Kind() { - case reflect.Ptr, reflect.Slice, reflect.String: - // As a special case, we assume slices and strings are pointers - // since we know that the first field in the SliceSlice or - // StringHeader is a data pointer. - mfi.isPointer = true - case reflect.Bool: - mfi.basicWidth = 1 - case reflect.Int32, reflect.Uint32, reflect.Float32: - mfi.basicWidth = 4 - case reflect.Int64, reflect.Uint64, reflect.Float64: - mfi.basicWidth = 8 - } - } - - // Unwrap tf to get at its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + tf.Name()) - } - - switch tf.Kind() { - case reflect.Int32: - switch { - case isSlice: // E.g., []int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Slice is not defined (see pointer_reflect.go). - /* - sfsp := src.toInt32Slice() - if *sfsp != nil { - dfsp := dst.toInt32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - */ - sfs := src.getInt32Slice() - if sfs != nil { - dfs := dst.getInt32Slice() - dfs = append(dfs, sfs...) - if dfs == nil { - dfs = []int32{} - } - dst.setInt32Slice(dfs) - } - } - case isPointer: // E.g., *int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). - /* - sfpp := src.toInt32Ptr() - if *sfpp != nil { - dfpp := dst.toInt32Ptr() - if *dfpp == nil { - *dfpp = Int32(**sfpp) - } else { - **dfpp = **sfpp - } - } - */ - sfp := src.getInt32Ptr() - if sfp != nil { - dfp := dst.getInt32Ptr() - if dfp == nil { - dst.setInt32Ptr(*sfp) - } else { - *dfp = *sfp - } - } - } - default: // E.g., int32 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt32(); v != 0 { - *dst.toInt32() = v - } - } - } - case reflect.Int64: - switch { - case isSlice: // E.g., []int64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toInt64Slice() - if *sfsp != nil { - dfsp := dst.toInt64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - } - case isPointer: // E.g., *int64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toInt64Ptr() - if *sfpp != nil { - dfpp := dst.toInt64Ptr() - if *dfpp == nil { - *dfpp = Int64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., int64 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt64(); v != 0 { - *dst.toInt64() = v - } - } - } - case reflect.Uint32: - switch { - case isSlice: // E.g., []uint32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint32Slice() - if *sfsp != nil { - dfsp := dst.toUint32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint32{} - } - } - } - case isPointer: // E.g., *uint32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint32Ptr() - if *sfpp != nil { - dfpp := dst.toUint32Ptr() - if *dfpp == nil { - *dfpp = Uint32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint32 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint32(); v != 0 { - *dst.toUint32() = v - } - } - } - case reflect.Uint64: - switch { - case isSlice: // E.g., []uint64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint64Slice() - if *sfsp != nil { - dfsp := dst.toUint64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint64{} - } - } - } - case isPointer: // E.g., *uint64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint64Ptr() - if *sfpp != nil { - dfpp := dst.toUint64Ptr() - if *dfpp == nil { - *dfpp = Uint64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint64 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint64(); v != 0 { - *dst.toUint64() = v - } - } - } - case reflect.Float32: - switch { - case isSlice: // E.g., []float32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat32Slice() - if *sfsp != nil { - dfsp := dst.toFloat32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float32{} - } - } - } - case isPointer: // E.g., *float32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat32Ptr() - if *sfpp != nil { - dfpp := dst.toFloat32Ptr() - if *dfpp == nil { - *dfpp = Float32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float32 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat32(); v != 0 { - *dst.toFloat32() = v - } - } - } - case reflect.Float64: - switch { - case isSlice: // E.g., []float64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat64Slice() - if *sfsp != nil { - dfsp := dst.toFloat64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float64{} - } - } - } - case isPointer: // E.g., *float64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat64Ptr() - if *sfpp != nil { - dfpp := dst.toFloat64Ptr() - if *dfpp == nil { - *dfpp = Float64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float64 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat64(); v != 0 { - *dst.toFloat64() = v - } - } - } - case reflect.Bool: - switch { - case isSlice: // E.g., []bool - mfi.merge = func(dst, src pointer) { - sfsp := src.toBoolSlice() - if *sfsp != nil { - dfsp := dst.toBoolSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []bool{} - } - } - } - case isPointer: // E.g., *bool - mfi.merge = func(dst, src pointer) { - sfpp := src.toBoolPtr() - if *sfpp != nil { - dfpp := dst.toBoolPtr() - if *dfpp == nil { - *dfpp = Bool(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., bool - mfi.merge = func(dst, src pointer) { - if v := *src.toBool(); v { - *dst.toBool() = v - } - } - } - case reflect.String: - switch { - case isSlice: // E.g., []string - mfi.merge = func(dst, src pointer) { - sfsp := src.toStringSlice() - if *sfsp != nil { - dfsp := dst.toStringSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []string{} - } - } - } - case isPointer: // E.g., *string - mfi.merge = func(dst, src pointer) { - sfpp := src.toStringPtr() - if *sfpp != nil { - dfpp := dst.toStringPtr() - if *dfpp == nil { - *dfpp = String(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., string - mfi.merge = func(dst, src pointer) { - if v := *src.toString(); v != "" { - *dst.toString() = v - } - } - } - case reflect.Slice: - isProto3 := props.Prop[i].proto3 - switch { - case isPointer: - panic("bad pointer in byte slice case in " + tf.Name()) - case tf.Elem().Kind() != reflect.Uint8: - panic("bad element kind in byte slice case in " + tf.Name()) - case isSlice: // E.g., [][]byte - mfi.merge = func(dst, src pointer) { - sbsp := src.toBytesSlice() - if *sbsp != nil { - dbsp := dst.toBytesSlice() - for _, sb := range *sbsp { - if sb == nil { - *dbsp = append(*dbsp, nil) - } else { - *dbsp = append(*dbsp, append([]byte{}, sb...)) - } - } - if *dbsp == nil { - *dbsp = [][]byte{} - } - } - } - default: // E.g., []byte - mfi.merge = func(dst, src pointer) { - sbp := src.toBytes() - if *sbp != nil { - dbp := dst.toBytes() - if !isProto3 || len(*sbp) > 0 { - *dbp = append([]byte{}, *sbp...) - } - } - } - } - case reflect.Struct: - switch { - case isSlice && !isPointer: // E.g. []pb.T - mergeInfo := getMergeInfo(tf) - zero := reflect.Zero(tf) - mfi.merge = func(dst, src pointer) { - // TODO: Make this faster? - dstsp := dst.asPointerTo(f.Type) - dsts := dstsp.Elem() - srcs := src.asPointerTo(f.Type).Elem() - for i := 0; i < srcs.Len(); i++ { - dsts = reflect.Append(dsts, zero) - srcElement := srcs.Index(i).Addr() - dstElement := dsts.Index(dsts.Len() - 1).Addr() - mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement)) - } - if dsts.IsNil() { - dsts = reflect.MakeSlice(f.Type, 0, 0) - } - dstsp.Elem().Set(dsts) - } - case !isPointer: - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - mergeInfo.merge(dst, src) - } - case isSlice: // E.g., []*pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sps := src.getPointerSlice() - if sps != nil { - dps := dst.getPointerSlice() - for _, sp := range sps { - var dp pointer - if !sp.isNil() { - dp = valToPointer(reflect.New(tf)) - mergeInfo.merge(dp, sp) - } - dps = append(dps, dp) - } - if dps == nil { - dps = []pointer{} - } - dst.setPointerSlice(dps) - } - } - default: // E.g., *pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sp := src.getPointer() - if !sp.isNil() { - dp := dst.getPointer() - if dp.isNil() { - dp = valToPointer(reflect.New(tf)) - dst.setPointer(dp) - } - mergeInfo.merge(dp, sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic("bad pointer or slice in map case in " + tf.Name()) - default: // E.g., map[K]V - mfi.merge = func(dst, src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - dm := dst.asPointerTo(tf).Elem() - if dm.IsNil() { - dm.Set(reflect.MakeMap(tf)) - } - - switch tf.Elem().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(Clone(val.Interface().(Message))) - dm.SetMapIndex(key, val) - } - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - dm.SetMapIndex(key, val) - } - default: // Basic type (e.g., string) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - dm.SetMapIndex(key, val) - } - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic("bad pointer or slice in interface case in " + tf.Name()) - default: // E.g., interface{} - // TODO: Make this faster? - mfi.merge = func(dst, src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - du := dst.asPointerTo(tf).Elem() - typ := su.Elem().Type() - if du.IsNil() || du.Elem().Type() != typ { - du.Set(reflect.New(typ.Elem())) // Initialize interface if empty - } - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - dv := du.Elem().Elem().Field(0) - if dv.Kind() == reflect.Ptr && dv.IsNil() { - dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - Merge(dv.Interface().(Message), sv.Interface().(Message)) - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) - default: // Basic type (e.g., string) - dv.Set(sv) - } - } - } - } - default: - panic(fmt.Sprintf("merger not found for type:%s", tf)) - } - mi.fields = append(mi.fields, mfi) - } - - mi.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - mi.unrecognized = toField(&f) - } - - atomic.StoreInt32(&mi.initialized, 1) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go deleted file mode 100644 index 937229386..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go +++ /dev/null @@ -1,2249 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -import ( - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// Unmarshal is the entry point from the generated .pb.go files. -// This function is not intended to be used by non-generated code. -// This function is not subject to any compatibility guarantee. -// msg contains a pointer to a protocol buffer struct. -// b is the data to be unmarshaled into the protocol buffer. -// a is a pointer to a place to store cached unmarshal information. -func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { - // Load the unmarshal information for this message type. - // The atomic load ensures memory consistency. - u := atomicLoadUnmarshalInfo(&a.unmarshal) - if u == nil { - // Slow path: find unmarshal info for msg, update a with it. - u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) - atomicStoreUnmarshalInfo(&a.unmarshal, u) - } - // Then do the unmarshaling. - err := u.unmarshal(toPointer(&msg), b) - return err -} - -type unmarshalInfo struct { - typ reflect.Type // type of the protobuf struct - - // 0 = only typ field is initialized - // 1 = completely initialized - initialized int32 - lock sync.Mutex // prevents double initialization - dense []unmarshalFieldInfo // fields indexed by tag # - sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # - reqFields []string // names of required fields - reqMask uint64 // 1< 0 { - // Read tag and wire type. - // Special case 1 and 2 byte varints. - var x uint64 - if b[0] < 128 { - x = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - x = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - x, n = decodeVarint(b) - if n == 0 { - return io.ErrUnexpectedEOF - } - b = b[n:] - } - tag := x >> 3 - wire := int(x) & 7 - - // Dispatch on the tag to one of the unmarshal* functions below. - var f unmarshalFieldInfo - if tag < uint64(len(u.dense)) { - f = u.dense[tag] - } else { - f = u.sparse[tag] - } - if fn := f.unmarshal; fn != nil { - var err error - b, err = fn(b, m.offset(f.field), wire) - if err == nil { - reqMask |= f.reqMask - continue - } - if r, ok := err.(*RequiredNotSetError); ok { - // Remember this error, but keep parsing. We need to produce - // a full parse even if a required field is missing. - if errLater == nil { - errLater = r - } - reqMask |= f.reqMask - continue - } - if err != errInternalBadWireType { - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return err - } - // Fragments with bad wire type are treated as unknown fields. - } - - // Unknown tag. - if !u.unrecognized.IsValid() { - // Don't keep unrecognized data; just skip it. - var err error - b, err = skipField(b, wire) - if err != nil { - return err - } - continue - } - // Keep unrecognized data around. - // maybe in extensions, maybe in the unrecognized field. - z := m.offset(u.unrecognized).toBytes() - var emap map[int32]Extension - var e Extension - for _, r := range u.extensionRanges { - if uint64(r.Start) <= tag && tag <= uint64(r.End) { - if u.extensions.IsValid() { - mp := m.offset(u.extensions).toExtensions() - emap = mp.extensionsWrite() - e = emap[int32(tag)] - z = &e.enc - break - } - if u.oldExtensions.IsValid() { - p := m.offset(u.oldExtensions).toOldExtensions() - emap = *p - if emap == nil { - emap = map[int32]Extension{} - *p = emap - } - e = emap[int32(tag)] - z = &e.enc - break - } - if u.bytesExtensions.IsValid() { - z = m.offset(u.bytesExtensions).toBytes() - break - } - panic("no extensions field available") - } - } - // Use wire type to skip data. - var err error - b0 := b - b, err = skipField(b, wire) - if err != nil { - return err - } - *z = encodeVarint(*z, tag<<3|uint64(wire)) - *z = append(*z, b0[:len(b0)-len(b)]...) - - if emap != nil { - emap[int32(tag)] = e - } - } - if reqMask != u.reqMask && errLater == nil { - // A required field of this message is missing. - for _, n := range u.reqFields { - if reqMask&1 == 0 { - errLater = &RequiredNotSetError{n} - } - reqMask >>= 1 - } - } - return errLater -} - -// computeUnmarshalInfo fills in u with information for use -// in unmarshaling protocol buffers of type u.typ. -func (u *unmarshalInfo) computeUnmarshalInfo() { - u.lock.Lock() - defer u.lock.Unlock() - if u.initialized != 0 { - return - } - t := u.typ - n := t.NumField() - - // Set up the "not found" value for the unrecognized byte buffer. - // This is the default for proto3. - u.unrecognized = invalidField - u.extensions = invalidField - u.oldExtensions = invalidField - u.bytesExtensions = invalidField - - // List of the generated type and offset for each oneof field. - type oneofField struct { - ityp reflect.Type // interface type of oneof field - field field // offset in containing message - } - var oneofFields []oneofField - - for i := 0; i < n; i++ { - f := t.Field(i) - if f.Name == "XXX_unrecognized" { - // The byte slice used to hold unrecognized input is special. - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for XXX_unrecognized field: " + f.Type.Name()) - } - u.unrecognized = toField(&f) - continue - } - if f.Name == "XXX_InternalExtensions" { - // Ditto here. - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) - } - u.extensions = toField(&f) - if f.Tag.Get("protobuf_messageset") == "1" { - u.isMessageSet = true - } - continue - } - if f.Name == "XXX_extensions" { - // An older form of the extensions field. - if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { - u.oldExtensions = toField(&f) - continue - } else if f.Type == reflect.TypeOf(([]byte)(nil)) { - u.bytesExtensions = toField(&f) - continue - } - panic("bad type for XXX_extensions field: " + f.Type.Name()) - } - if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { - continue - } - - oneof := f.Tag.Get("protobuf_oneof") - if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) - // The rest of oneof processing happens below. - continue - } - - tags := f.Tag.Get("protobuf") - tagArray := strings.Split(tags, ",") - if len(tagArray) < 2 { - panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) - } - tag, err := strconv.Atoi(tagArray[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tagArray[1]) - } - - name := "" - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - } - - // Extract unmarshaling function from the field (its type and tags). - unmarshal := fieldUnmarshaler(&f) - - // Required field? - var reqMask uint64 - if tagArray[2] == "req" { - bit := len(u.reqFields) - u.reqFields = append(u.reqFields, name) - reqMask = uint64(1) << uint(bit) - // TODO: if we have more than 64 required fields, we end up - // not verifying that all required fields are present. - // Fix this, perhaps using a count of required fields? - } - - // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask, name) - } - - // Find any types associated with oneof fields. - // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler - if len(oneofFields) > 0 { - var oneofImplementers []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - for _, v := range oneofImplementers { - tptr := reflect.TypeOf(v) // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } - } - - } - } - - // Get extension ranges, if any. - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") - if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { - panic("a message with extensions, but no extensions field in " + t.Name()) - } - u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) - } - - // Explicitly disallow tag 0. This will ensure we flag an error - // when decoding a buffer of all zeros. Without this code, we - // would decode and skip an all-zero buffer of even length. - // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. - u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { - return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0, "") - - // Set mask for required field check. - u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? - for len(u.dense) <= tag { - u.dense = append(u.dense, unmarshalFieldInfo{}) - } - u.dense[tag] = i - return - } - if u.sparse == nil { - u.sparse = map[uint64]unmarshalFieldInfo{} - } - u.sparse[uint64(tag)] = i -} - -// fieldUnmarshaler returns an unmarshaler for the given field. -func fieldUnmarshaler(f *reflect.StructField) unmarshaler { - if f.Type.Kind() == reflect.Map { - return makeUnmarshalMap(f) - } - return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) -} - -// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. -func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { - tagArray := strings.Split(tags, ",") - encoding := tagArray[0] - name := "unknown" - ctype := false - isTime := false - isDuration := false - isWktPointer := false - proto3 := false - validateUTF8 := true - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - if tag == "proto3" { - proto3 = true - } - if strings.HasPrefix(tag, "customtype=") { - ctype = true - } - if tag == "stdtime" { - isTime = true - } - if tag == "stdduration" { - isDuration = true - } - if tag == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - - // Figure out packaging (pointer, slice, or both) - slice := false - pointer := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) - } - if pointer { - return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalCustom(getUnmarshalInfo(t), name) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTime(getUnmarshalInfo(t), name) - } - - if isDuration { - if pointer { - if slice { - return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDuration(getUnmarshalInfo(t), name) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdDoubleValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdFloatValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBoolValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdStringValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValueUnmarshaler(getUnmarshalInfo(t), name) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBytesValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValueUnmarshaler(getUnmarshalInfo(t), name) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - // We'll never have both pointer and slice for basic types. - if pointer && slice && t.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + t.Name()) - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return unmarshalBoolPtr - } - if slice { - return unmarshalBoolSlice - } - return unmarshalBoolValue - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixedS32Ptr - } - if slice { - return unmarshalFixedS32Slice - } - return unmarshalFixedS32Value - case "varint": - // this could be int32 or enum - if pointer { - return unmarshalInt32Ptr - } - if slice { - return unmarshalInt32Slice - } - return unmarshalInt32Value - case "zigzag32": - if pointer { - return unmarshalSint32Ptr - } - if slice { - return unmarshalSint32Slice - } - return unmarshalSint32Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixedS64Ptr - } - if slice { - return unmarshalFixedS64Slice - } - return unmarshalFixedS64Value - case "varint": - if pointer { - return unmarshalInt64Ptr - } - if slice { - return unmarshalInt64Slice - } - return unmarshalInt64Value - case "zigzag64": - if pointer { - return unmarshalSint64Ptr - } - if slice { - return unmarshalSint64Slice - } - return unmarshalSint64Value - } - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixed32Ptr - } - if slice { - return unmarshalFixed32Slice - } - return unmarshalFixed32Value - case "varint": - if pointer { - return unmarshalUint32Ptr - } - if slice { - return unmarshalUint32Slice - } - return unmarshalUint32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixed64Ptr - } - if slice { - return unmarshalFixed64Slice - } - return unmarshalFixed64Value - case "varint": - if pointer { - return unmarshalUint64Ptr - } - if slice { - return unmarshalUint64Slice - } - return unmarshalUint64Value - } - case reflect.Float32: - if pointer { - return unmarshalFloat32Ptr - } - if slice { - return unmarshalFloat32Slice - } - return unmarshalFloat32Value - case reflect.Float64: - if pointer { - return unmarshalFloat64Ptr - } - if slice { - return unmarshalFloat64Slice - } - return unmarshalFloat64Value - case reflect.Map: - panic("map type in typeUnmarshaler in " + t.Name()) - case reflect.Slice: - if pointer { - panic("bad pointer in slice case in " + t.Name()) - } - if slice { - return unmarshalBytesSlice - } - return unmarshalBytesValue - case reflect.String: - if validateUTF8 { - if pointer { - return unmarshalUTF8StringPtr - } - if slice { - return unmarshalUTF8StringSlice - } - return unmarshalUTF8StringValue - } - if pointer { - return unmarshalStringPtr - } - if slice { - return unmarshalStringSlice - } - return unmarshalStringValue - case reflect.Struct: - // message or group field - if !pointer { - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessage(getUnmarshalInfo(t), name) - } - } - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) - case "group": - if slice { - return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) - } - } - panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) -} - -// Below are all the unmarshalers for individual fields of various types. - -func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64() = v - return b, nil -} - -func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64() = v - return b, nil -} - -func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64() = v - return b, nil -} - -func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64Ptr() = &v - return b, nil -} - -func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - *f.toInt32() = v - return b, nil -} - -func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - *f.toInt32() = v - return b, nil -} - -func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32() = v - return b, nil -} - -func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32Ptr() = &v - return b, nil -} - -func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64() = v - return b[8:], nil -} - -func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64() = v - return b[8:], nil -} - -func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32() = v - return b[4:], nil -} - -func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32Ptr() = &v - return b[4:], nil -} - -func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - *f.toInt32() = v - return b[4:], nil -} - -func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.setInt32Ptr(v) - return b[4:], nil -} - -func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - return b[4:], nil -} - -func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - // Note: any length varint is allowed, even though any sane - // encoder will use one byte. - // See https://github.com/golang/protobuf/issues/76 - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - // TODO: check if x>1? Tests seem to indicate no. - v := x != 0 - *f.toBool() = v - return b[n:], nil -} - -func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - *f.toBoolPtr() = &v - return b[n:], nil -} - -func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - b = b[n:] - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - return b[n:], nil -} - -func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64() = v - return b[8:], nil -} - -func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64Ptr() = &v - return b[8:], nil -} - -func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32() = v - return b[4:], nil -} - -func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32Ptr() = &v - return b[4:], nil -} - -func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - return b[x:], nil -} - -func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - return b[x:], nil -} - -func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - return b[x:], nil -} - -func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -var emptyBuf [0]byte - -func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // The use of append here is a trick which avoids the zeroing - // that would be required if we used a make/copy pair. - // We append to emptyBuf instead of nil because we want - // a non-nil result even when the length is 0. - v := append(emptyBuf[:], b[:x]...) - *f.toBytes() = v - return b[x:], nil -} - -func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := append(emptyBuf[:], b[:x]...) - s := f.toBytesSlice() - *s = append(*s, v) - return b[x:], nil -} - -func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[y:], err - } -} - -func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[y:], err - } -} - -func makeUnmarshalMap(f *reflect.StructField) unmarshaler { - t := f.Type - kt := t.Key() - vt := t.Elem() - tagArray := strings.Split(f.Tag.Get("protobuf"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - for _, t := range tagArray { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - } - if t == "stdduration" { - valTags = append(valTags, t) - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) - return func(b []byte, f pointer, w int) ([]byte, error) { - // The map entry is a submessage. Figure out how big it is. - if w != WireBytes { - return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - r := b[x:] // unused data to return - b = b[:x] // data for map entry - - // Note: we could use #keys * #values ~= 200 functions - // to do map decoding without reflection. Probably not worth it. - // Maps will be somewhat slow. Oh well. - - // Read key and value from data. - var nerr nonFatal - k := reflect.New(kt) - v := reflect.New(vt) - for len(b) > 0 { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - wire := int(x) & 7 - b = b[n:] - - var err error - switch x >> 3 { - case 1: - b, err = unmarshalKey(b, valToPointer(k), wire) - case 2: - b, err = unmarshalVal(b, valToPointer(v), wire) - default: - err = errInternalBadWireType // skip unknown tag - } - - if nerr.Merge(err) { - continue - } - if err != errInternalBadWireType { - return nil, err - } - - // Skip past unknown fields. - b, err = skipField(b, wire) - if err != nil { - return nil, err - } - } - - // Get map, allocate if needed. - m := f.asPointerTo(t).Elem() // an addressable map[K]T - if m.IsNil() { - m.Set(reflect.MakeMap(t)) - } - - // Insert into map. - m.SetMapIndex(k.Elem(), v.Elem()) - - return r, nerr.E - } -} - -// makeUnmarshalOneof makes an unmarshaler for oneof fields. -// for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } -// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). -// ityp is the interface type of the oneof field (e.g. isMsg_F). -// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). -// Note that this function will be called once for each case in the oneof. -func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { - sf := typ.Field(0) - field0 := toField(&sf) - return func(b []byte, f pointer, w int) ([]byte, error) { - // Allocate holder for value. - v := reflect.New(typ) - - // Unmarshal data into holder. - // We unmarshal into the first field of the holder object. - var err error - var nerr nonFatal - b, err = unmarshal(b, valToPointer(v).offset(field0), w) - if !nerr.Merge(err) { - return nil, err - } - - // Write pointer to holder into target field. - f.asPointerTo(ityp).Elem().Set(v) - - return b, nerr.E - } -} - -// Error used by decode internally. -var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") - -// skipField skips past a field of type wire and returns the remaining bytes. -func skipField(b []byte, wire int) ([]byte, error) { - switch wire { - case WireVarint: - _, k := decodeVarint(b) - if k == 0 { - return b, io.ErrUnexpectedEOF - } - b = b[k:] - case WireFixed32: - if len(b) < 4 { - return b, io.ErrUnexpectedEOF - } - b = b[4:] - case WireFixed64: - if len(b) < 8 { - return b, io.ErrUnexpectedEOF - } - b = b[8:] - case WireBytes: - m, k := decodeVarint(b) - if k == 0 || uint64(len(b)-k) < m { - return b, io.ErrUnexpectedEOF - } - b = b[uint64(k)+m:] - case WireStartGroup: - _, i := findEndGroup(b) - if i == -1 { - return b, io.ErrUnexpectedEOF - } - b = b[i:] - default: - return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) - } - return b, nil -} - -// findEndGroup finds the index of the next EndGroup tag. -// Groups may be nested, so the "next" EndGroup tag is the first -// unpaired EndGroup. -// findEndGroup returns the indexes of the start and end of the EndGroup tag. -// Returns (-1,-1) if it can't find one. -func findEndGroup(b []byte) (int, int) { - depth := 1 - i := 0 - for { - x, n := decodeVarint(b[i:]) - if n == 0 { - return -1, -1 - } - j := i - i += n - switch x & 7 { - case WireVarint: - _, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - case WireFixed32: - if len(b)-4 < i { - return -1, -1 - } - i += 4 - case WireFixed64: - if len(b)-8 < i { - return -1, -1 - } - i += 8 - case WireBytes: - m, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - if uint64(len(b)-i) < m { - return -1, -1 - } - i += int(m) - case WireStartGroup: - depth++ - case WireEndGroup: - depth-- - if depth == 0 { - return j, i - } - default: - return -1, -1 - } - } -} - -// encodeVarint appends a varint-encoded integer to b and returns the result. -func encodeVarint(b []byte, x uint64) []byte { - for x >= 1<<7 { - b = append(b, byte(x&0x7f|0x80)) - x >>= 7 - } - return append(b, byte(x)) -} - -// decodeVarint reads a varint-encoded integer from b. -// Returns the decoded integer and the number of bytes read. -// If there is an error, it returns 0,0. -func decodeVarint(b []byte) (uint64, int) { - var x, y uint64 - if len(b) == 0 { - goto bad - } - x = uint64(b[0]) - if x < 0x80 { - return x, 1 - } - x -= 0x80 - - if len(b) <= 1 { - goto bad - } - y = uint64(b[1]) - x += y << 7 - if y < 0x80 { - return x, 2 - } - x -= 0x80 << 7 - - if len(b) <= 2 { - goto bad - } - y = uint64(b[2]) - x += y << 14 - if y < 0x80 { - return x, 3 - } - x -= 0x80 << 14 - - if len(b) <= 3 { - goto bad - } - y = uint64(b[3]) - x += y << 21 - if y < 0x80 { - return x, 4 - } - x -= 0x80 << 21 - - if len(b) <= 4 { - goto bad - } - y = uint64(b[4]) - x += y << 28 - if y < 0x80 { - return x, 5 - } - x -= 0x80 << 28 - - if len(b) <= 5 { - goto bad - } - y = uint64(b[5]) - x += y << 35 - if y < 0x80 { - return x, 6 - } - x -= 0x80 << 35 - - if len(b) <= 6 { - goto bad - } - y = uint64(b[6]) - x += y << 42 - if y < 0x80 { - return x, 7 - } - x -= 0x80 << 42 - - if len(b) <= 7 { - goto bad - } - y = uint64(b[7]) - x += y << 49 - if y < 0x80 { - return x, 8 - } - x -= 0x80 << 49 - - if len(b) <= 8 { - goto bad - } - y = uint64(b[8]) - x += y << 56 - if y < 0x80 { - return x, 9 - } - x -= 0x80 << 56 - - if len(b) <= 9 { - goto bad - } - y = uint64(b[9]) - x += y << 63 - if y < 2 { - return x, 10 - } - -bad: - return 0, 0 -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go deleted file mode 100644 index 00d6c7ad9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go +++ /dev/null @@ -1,385 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "io" - "reflect" -) - -func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f // gogo: changed from v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.New(sub.typ)) - m := s.Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := reflect.New(sub.typ) - c := m.Interface().(custom) - if err := c.Unmarshal(b[:x]); err != nil { - return nil, err - } - v := valToPointer(m) - f.appendRef(v, sub.typ) - return b[x:], nil - } -} - -func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - m := f.asPointerTo(sub.typ).Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&d)) - return b[x:], nil - } -} - -func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(d)) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&d)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(d)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go deleted file mode 100644 index 87416afe9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text.go +++ /dev/null @@ -1,930 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" - "sync" - "time" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if name == "XXX_NoUnkeyedLiteral" { - continue - } - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, v, props); err != nil { - return err - } - } else if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.MapValProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, fv, props); err != nil { - return err - } - } else if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv - if pv.CanAddr() { - pv = sv.Addr() - } else { - pv = reflect.New(sv.Type()) - pv.Elem().Set(sv) - } - if _, err := extendable(pv.Interface()); err == nil { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - if props != nil { - if len(props.CustomType) > 0 { - custom, ok := v.Interface().(Marshaler) - if ok { - data, err := custom.Marshal() - if err != nil { - return err - } - if err := writeString(w, string(data)); err != nil { - return err - } - return nil - } - } else if len(props.CastType) > 0 { - if _, ok := v.Interface().(interface { - String() string - }); ok { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - _, err := fmt.Fprintf(w, "%d", v.Interface()) - return err - } - } - } else if props.StdTime { - t, ok := v.Interface().(time.Time) - if !ok { - return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) - } - tproto, err := timestampProto(t) - if err != nil { - return err - } - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdTime = false - err = tm.writeAny(w, reflect.ValueOf(tproto), &propsCopy) - return err - } else if props.StdDuration { - d, ok := v.Interface().(time.Duration) - if !ok { - return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) - } - dproto := durationProto(d) - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdDuration = false - err := tm.writeAny(w, reflect.ValueOf(dproto), &propsCopy) - return err - } - } - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if v.CanAddr() { - // Calling v.Interface on a struct causes the reflect package to - // copy the entire struct. This is racy with the new Marshaler - // since we atomically update the XXX_sizecache. - // - // Thus, we retrieve a pointer to the struct if possible to avoid - // a race since v.Interface on the pointer doesn't copy the struct. - // - // If v is not addressable, then we are not worried about a race - // since it implies that the binary Marshaler cannot possibly be - // mutating this value. - v = v.Addr() - } - if v.Type().Implements(textMarshalerType) { - text, err := v.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if err := tm.writeStruct(w, v); err != nil { - return err - } - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, ferr := fmt.Fprintf(w, "/* %v */\n", err) - return ferr - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, werr := w.Write(endBraceNewline); werr != nil { - return werr - } - continue - } - if _, ferr := fmt.Fprint(w, tag); ferr != nil { - return ferr - } - if wire != WireStartGroup { - if err = w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err = w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - e := pv.Interface().(Message) - - var m map[int32]Extension - var mu sync.Locker - if em, ok := e.(extensionsBytes); ok { - eb := em.GetExtensions() - var err error - m, err = BytesToExtensionsMap(*eb) - if err != nil { - return err - } - mu = notLocker{} - } else if _, ok := e.(extendableProto); ok { - ep, _ := extendable(e) - m, mu = ep.extensionsRead() - if m == nil { - return nil - } - } - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(e, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/vendor/github.com/gogo/protobuf/proto/text_gogo.go deleted file mode 100644 index 1d6c6aa0e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text_gogo.go +++ /dev/null @@ -1,57 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "fmt" - "reflect" -) - -func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { - m, ok := enumStringMaps[props.Enum] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - key := int32(0) - if v.Kind() == reflect.Ptr { - key = int32(v.Elem().Int()) - } else { - key = int32(v.Int()) - } - s, ok := m[key] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - _, err := fmt.Fprint(w, s) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser.go b/vendor/github.com/gogo/protobuf/proto/text_parser.go deleted file mode 100644 index 1ce0be2fa..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text_parser.go +++ /dev/null @@ -1,1018 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(i), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.MapKeyProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.MapValProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - if len(props.CustomType) > 0 { - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - tc := reflect.TypeOf(new(Marshaler)) - ok := t.Elem().Implements(tc.Elem()) - if ok { - fv := v - flen := fv.Len() - if flen == fv.Cap() { - nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) - reflect.Copy(nav, fv) - fv.Set(nav) - } - fv.SetLen(flen + 1) - - // Read one. - p.back() - return p.readAny(fv.Index(flen), props) - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.ValueOf(custom)) - } else { - custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.Indirect(reflect.ValueOf(custom))) - } - return nil - } - if props.StdTime { - fv := v - p.back() - props.StdTime = false - tproto := ×tamp{} - err := p.readAny(reflect.ValueOf(tproto).Elem(), props) - props.StdTime = true - if err != nil { - return err - } - tim, err := timestampFromProto(tproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ts := fv.Interface().([]*time.Time) - ts = append(ts, &tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } else { - ts := fv.Interface().([]time.Time) - ts = append(ts, tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&tim)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&tim))) - } - return nil - } - if props.StdDuration { - fv := v - p.back() - props.StdDuration = false - dproto := &duration{} - err := p.readAny(reflect.ValueOf(dproto).Elem(), props) - props.StdDuration = true - if err != nil { - return err - } - dur, err := durationFromProto(dproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ds := fv.Interface().([]*time.Duration) - ds = append(ds, &dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } else { - ds := fv.Interface().([]time.Duration) - ds = append(ds, dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&dur)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&dur))) - } - return nil - } - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - ntok := p.next() - if ntok.err != nil { - return ntok.err - } - if ntok.value == "]" { - break - } - if ntok.value != "," { - return p.errorf("Expected ']' or ',' found %q", ntok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int8: - if x, err := strconv.ParseInt(tok.value, 0, 8); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int16: - if x, err := strconv.ParseInt(tok.value, 0, 16); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint8: - if x, err := strconv.ParseUint(tok.value, 0, 8); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint16: - if x, err := strconv.ParseUint(tok.value, 0, 16); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - pb.Reset() - v := reflect.ValueOf(pb) - return newTextParser(s).readStruct(v.Elem(), "") -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp.go b/vendor/github.com/gogo/protobuf/proto/timestamp.go deleted file mode 100644 index 9324f6542..000000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp.go +++ /dev/null @@ -1,113 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// This file implements operations on google.protobuf.Timestamp. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range -// [0001-01-01, 10000-01-01) and has a Nanos field -// in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes -// the problem. -// -// Every valid Timestamp can be represented by a time.Time, but the converse is not true. -func validateTimestamp(ts *timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) - } - return nil -} - -// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return value -// is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -func timestampFromProto(ts *timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -func timestampProto(t time.Time) (*timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) - ts := ×tamp{ - Seconds: seconds, - Nanos: nanos, - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go deleted file mode 100644 index 38439fa99..000000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "reflect" - "time" -) - -var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() - -type timestamp struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *timestamp) Reset() { *m = timestamp{} } -func (*timestamp) ProtoMessage() {} -func (*timestamp) String() string { return "timestamp" } - -func init() { - RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers.go b/vendor/github.com/gogo/protobuf/proto/wrappers.go deleted file mode 100644 index b175d1b64..000000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers.go +++ /dev/null @@ -1,1888 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -import ( - "io" - "reflect" -) - -func makeStdDoubleValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdDoubleValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go b/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go deleted file mode 100644 index c1cf7bf85..000000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go +++ /dev/null @@ -1,113 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -package proto - -type float64Value struct { - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float64Value) Reset() { *m = float64Value{} } -func (*float64Value) ProtoMessage() {} -func (*float64Value) String() string { return "float64" } - -type float32Value struct { - Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float32Value) Reset() { *m = float32Value{} } -func (*float32Value) ProtoMessage() {} -func (*float32Value) String() string { return "float32" } - -type int64Value struct { - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int64Value) Reset() { *m = int64Value{} } -func (*int64Value) ProtoMessage() {} -func (*int64Value) String() string { return "int64" } - -type uint64Value struct { - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint64Value) Reset() { *m = uint64Value{} } -func (*uint64Value) ProtoMessage() {} -func (*uint64Value) String() string { return "uint64" } - -type int32Value struct { - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int32Value) Reset() { *m = int32Value{} } -func (*int32Value) ProtoMessage() {} -func (*int32Value) String() string { return "int32" } - -type uint32Value struct { - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint32Value) Reset() { *m = uint32Value{} } -func (*uint32Value) ProtoMessage() {} -func (*uint32Value) String() string { return "uint32" } - -type boolValue struct { - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *boolValue) Reset() { *m = boolValue{} } -func (*boolValue) ProtoMessage() {} -func (*boolValue) String() string { return "bool" } - -type stringValue struct { - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *stringValue) Reset() { *m = stringValue{} } -func (*stringValue) ProtoMessage() {} -func (*stringValue) String() string { return "string" } - -type bytesValue struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *bytesValue) Reset() { *m = bytesValue{} } -func (*bytesValue) ProtoMessage() {} -func (*bytesValue) String() string { return "[]byte" } - -func init() { - RegisterType((*float64Value)(nil), "gogo.protobuf.proto.DoubleValue") - RegisterType((*float32Value)(nil), "gogo.protobuf.proto.FloatValue") - RegisterType((*int64Value)(nil), "gogo.protobuf.proto.Int64Value") - RegisterType((*uint64Value)(nil), "gogo.protobuf.proto.UInt64Value") - RegisterType((*int32Value)(nil), "gogo.protobuf.proto.Int32Value") - RegisterType((*uint32Value)(nil), "gogo.protobuf.proto.UInt32Value") - RegisterType((*boolValue)(nil), "gogo.protobuf.proto.BoolValue") - RegisterType((*stringValue)(nil), "gogo.protobuf.proto.StringValue") - RegisterType((*bytesValue)(nil), "gogo.protobuf.proto.BytesValue") -} diff --git a/vendor/github.com/golang/groupcache/LICENSE b/vendor/github.com/golang/groupcache/LICENSE deleted file mode 100644 index 37ec93a14..000000000 --- a/vendor/github.com/golang/groupcache/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/golang/groupcache/lru/lru.go b/vendor/github.com/golang/groupcache/lru/lru.go deleted file mode 100644 index eac1c7664..000000000 --- a/vendor/github.com/golang/groupcache/lru/lru.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2013 Google 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 lru implements an LRU cache. -package lru - -import "container/list" - -// Cache is an LRU cache. It is not safe for concurrent access. -type Cache struct { - // MaxEntries is the maximum number of cache entries before - // an item is evicted. Zero means no limit. - MaxEntries int - - // OnEvicted optionally specifies a callback function to be - // executed when an entry is purged from the cache. - OnEvicted func(key Key, value interface{}) - - ll *list.List - cache map[interface{}]*list.Element -} - -// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators -type Key interface{} - -type entry struct { - key Key - value interface{} -} - -// New creates a new Cache. -// If maxEntries is zero, the cache has no limit and it's assumed -// that eviction is done by the caller. -func New(maxEntries int) *Cache { - return &Cache{ - MaxEntries: maxEntries, - ll: list.New(), - cache: make(map[interface{}]*list.Element), - } -} - -// Add adds a value to the cache. -func (c *Cache) Add(key Key, value interface{}) { - if c.cache == nil { - c.cache = make(map[interface{}]*list.Element) - c.ll = list.New() - } - if ee, ok := c.cache[key]; ok { - c.ll.MoveToFront(ee) - ee.Value.(*entry).value = value - return - } - ele := c.ll.PushFront(&entry{key, value}) - c.cache[key] = ele - if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { - c.RemoveOldest() - } -} - -// Get looks up a key's value from the cache. -func (c *Cache) Get(key Key) (value interface{}, ok bool) { - if c.cache == nil { - return - } - if ele, hit := c.cache[key]; hit { - c.ll.MoveToFront(ele) - return ele.Value.(*entry).value, true - } - return -} - -// Remove removes the provided key from the cache. -func (c *Cache) Remove(key Key) { - if c.cache == nil { - return - } - if ele, hit := c.cache[key]; hit { - c.removeElement(ele) - } -} - -// RemoveOldest removes the oldest item from the cache. -func (c *Cache) RemoveOldest() { - if c.cache == nil { - return - } - ele := c.ll.Back() - if ele != nil { - c.removeElement(ele) - } -} - -func (c *Cache) removeElement(e *list.Element) { - c.ll.Remove(e) - kv := e.Value.(*entry) - delete(c.cache, kv.key) - if c.OnEvicted != nil { - c.OnEvicted(kv.key, kv.value) - } -} - -// Len returns the number of items in the cache. -func (c *Cache) Len() int { - if c.cache == nil { - return 0 - } - return c.ll.Len() -} - -// Clear purges all stored items from the cache. -func (c *Cache) Clear() { - if c.OnEvicted != nil { - for _, e := range c.cache { - kv := e.Value.(*entry) - c.OnEvicted(kv.key, kv.value) - } - } - c.ll = nil - c.cache = nil -} diff --git a/vendor/github.com/golang/protobuf/AUTHORS b/vendor/github.com/golang/protobuf/AUTHORS deleted file mode 100644 index 15167cd74..000000000 --- a/vendor/github.com/golang/protobuf/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/github.com/golang/protobuf/CONTRIBUTORS b/vendor/github.com/golang/protobuf/CONTRIBUTORS deleted file mode 100644 index 1c4577e96..000000000 --- a/vendor/github.com/golang/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE deleted file mode 100644 index 0f646931a..000000000 --- a/vendor/github.com/golang/protobuf/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2010 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/golang/protobuf/proto/buffer.go b/vendor/github.com/golang/protobuf/proto/buffer.go deleted file mode 100644 index e810e6fea..000000000 --- a/vendor/github.com/golang/protobuf/proto/buffer.go +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "errors" - "fmt" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - WireVarint = 0 - WireFixed32 = 5 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 -) - -// EncodeVarint returns the varint encoded bytes of v. -func EncodeVarint(v uint64) []byte { - return protowire.AppendVarint(nil, v) -} - -// SizeVarint returns the length of the varint encoded bytes of v. -// This is equal to len(EncodeVarint(v)). -func SizeVarint(v uint64) int { - return protowire.SizeVarint(v) -} - -// DecodeVarint parses a varint encoded integer from b, -// returning the integer value and the length of the varint. -// It returns (0, 0) if there is a parse error. -func DecodeVarint(b []byte) (uint64, int) { - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, 0 - } - return v, n -} - -// Buffer is a buffer for encoding and decoding the protobuf wire format. -// It may be reused between invocations to reduce memory usage. -type Buffer struct { - buf []byte - idx int - deterministic bool -} - -// NewBuffer allocates a new Buffer initialized with buf, -// where the contents of buf are considered the unread portion of the buffer. -func NewBuffer(buf []byte) *Buffer { - return &Buffer{buf: buf} -} - -// SetDeterministic specifies whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (b *Buffer) SetDeterministic(deterministic bool) { - b.deterministic = deterministic -} - -// SetBuf sets buf as the internal buffer, -// where the contents of buf are considered the unread portion of the buffer. -func (b *Buffer) SetBuf(buf []byte) { - b.buf = buf - b.idx = 0 -} - -// Reset clears the internal buffer of all written and unread data. -func (b *Buffer) Reset() { - b.buf = b.buf[:0] - b.idx = 0 -} - -// Bytes returns the internal buffer. -func (b *Buffer) Bytes() []byte { - return b.buf -} - -// Unread returns the unread portion of the buffer. -func (b *Buffer) Unread() []byte { - return b.buf[b.idx:] -} - -// Marshal appends the wire-format encoding of m to the buffer. -func (b *Buffer) Marshal(m Message) error { - var err error - b.buf, err = marshalAppend(b.buf, m, b.deterministic) - return err -} - -// Unmarshal parses the wire-format message in the buffer and -// places the decoded results in m. -// It does not reset m before unmarshaling. -func (b *Buffer) Unmarshal(m Message) error { - err := UnmarshalMerge(b.Unread(), m) - b.idx = len(b.buf) - return err -} - -type unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields } - -func (m *unknownFields) String() string { panic("not implemented") } -func (m *unknownFields) Reset() { panic("not implemented") } -func (m *unknownFields) ProtoMessage() { panic("not implemented") } - -// DebugPrint dumps the encoded bytes of b with a header and footer including s -// to stdout. This is only intended for debugging. -func (*Buffer) DebugPrint(s string, b []byte) { - m := MessageReflect(new(unknownFields)) - m.SetUnknown(b) - b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface()) - fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s) -} - -// EncodeVarint appends an unsigned varint encoding to the buffer. -func (b *Buffer) EncodeVarint(v uint64) error { - b.buf = protowire.AppendVarint(b.buf, v) - return nil -} - -// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer. -func (b *Buffer) EncodeZigzag32(v uint64) error { - return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) -} - -// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer. -func (b *Buffer) EncodeZigzag64(v uint64) error { - return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63)))) -} - -// EncodeFixed32 appends a 32-bit little-endian integer to the buffer. -func (b *Buffer) EncodeFixed32(v uint64) error { - b.buf = protowire.AppendFixed32(b.buf, uint32(v)) - return nil -} - -// EncodeFixed64 appends a 64-bit little-endian integer to the buffer. -func (b *Buffer) EncodeFixed64(v uint64) error { - b.buf = protowire.AppendFixed64(b.buf, uint64(v)) - return nil -} - -// EncodeRawBytes appends a length-prefixed raw bytes to the buffer. -func (b *Buffer) EncodeRawBytes(v []byte) error { - b.buf = protowire.AppendBytes(b.buf, v) - return nil -} - -// EncodeStringBytes appends a length-prefixed raw bytes to the buffer. -// It does not validate whether v contains valid UTF-8. -func (b *Buffer) EncodeStringBytes(v string) error { - b.buf = protowire.AppendString(b.buf, v) - return nil -} - -// EncodeMessage appends a length-prefixed encoded message to the buffer. -func (b *Buffer) EncodeMessage(m Message) error { - var err error - b.buf = protowire.AppendVarint(b.buf, uint64(Size(m))) - b.buf, err = marshalAppend(b.buf, m, b.deterministic) - return err -} - -// DecodeVarint consumes an encoded unsigned varint from the buffer. -func (b *Buffer) DecodeVarint() (uint64, error) { - v, n := protowire.ConsumeVarint(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer. -func (b *Buffer) DecodeZigzag32() (uint64, error) { - v, err := b.DecodeVarint() - if err != nil { - return 0, err - } - return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil -} - -// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer. -func (b *Buffer) DecodeZigzag64() (uint64, error) { - v, err := b.DecodeVarint() - if err != nil { - return 0, err - } - return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil -} - -// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer. -func (b *Buffer) DecodeFixed32() (uint64, error) { - v, n := protowire.ConsumeFixed32(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer. -func (b *Buffer) DecodeFixed64() (uint64, error) { - v, n := protowire.ConsumeFixed64(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer. -// If alloc is specified, it returns a copy the raw bytes -// rather than a sub-slice of the buffer. -func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) { - v, n := protowire.ConsumeBytes(b.buf[b.idx:]) - if n < 0 { - return nil, protowire.ParseError(n) - } - b.idx += n - if alloc { - v = append([]byte(nil), v...) - } - return v, nil -} - -// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer. -// It does not validate whether the raw bytes contain valid UTF-8. -func (b *Buffer) DecodeStringBytes() (string, error) { - v, n := protowire.ConsumeString(b.buf[b.idx:]) - if n < 0 { - return "", protowire.ParseError(n) - } - b.idx += n - return v, nil -} - -// DecodeMessage consumes a length-prefixed message from the buffer. -// It does not reset m before unmarshaling. -func (b *Buffer) DecodeMessage(m Message) error { - v, err := b.DecodeRawBytes(false) - if err != nil { - return err - } - return UnmarshalMerge(v, m) -} - -// DecodeGroup consumes a message group from the buffer. -// It assumes that the start group marker has already been consumed and -// consumes all bytes until (and including the end group marker). -// It does not reset m before unmarshaling. -func (b *Buffer) DecodeGroup(m Message) error { - v, n, err := consumeGroup(b.buf[b.idx:]) - if err != nil { - return err - } - b.idx += n - return UnmarshalMerge(v, m) -} - -// consumeGroup parses b until it finds an end group marker, returning -// the raw bytes of the message (excluding the end group marker) and the -// the total length of the message (including the end group marker). -func consumeGroup(b []byte) ([]byte, int, error) { - b0 := b - depth := 1 // assume this follows a start group marker - for { - _, wtyp, tagLen := protowire.ConsumeTag(b) - if tagLen < 0 { - return nil, 0, protowire.ParseError(tagLen) - } - b = b[tagLen:] - - var valLen int - switch wtyp { - case protowire.VarintType: - _, valLen = protowire.ConsumeVarint(b) - case protowire.Fixed32Type: - _, valLen = protowire.ConsumeFixed32(b) - case protowire.Fixed64Type: - _, valLen = protowire.ConsumeFixed64(b) - case protowire.BytesType: - _, valLen = protowire.ConsumeBytes(b) - case protowire.StartGroupType: - depth++ - case protowire.EndGroupType: - depth-- - default: - return nil, 0, errors.New("proto: cannot parse reserved wire type") - } - if valLen < 0 { - return nil, 0, protowire.ParseError(valLen) - } - b = b[valLen:] - - if depth == 0 { - return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil - } - } -} diff --git a/vendor/github.com/golang/protobuf/proto/defaults.go b/vendor/github.com/golang/protobuf/proto/defaults.go deleted file mode 100644 index d399bf069..000000000 --- a/vendor/github.com/golang/protobuf/proto/defaults.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// SetDefaults sets unpopulated scalar fields to their default values. -// Fields within a oneof are not set even if they have a default value. -// SetDefaults is recursively called upon any populated message fields. -func SetDefaults(m Message) { - if m != nil { - setDefaults(MessageReflect(m)) - } -} - -func setDefaults(m protoreflect.Message) { - fds := m.Descriptor().Fields() - for i := 0; i < fds.Len(); i++ { - fd := fds.Get(i) - if !m.Has(fd) { - if fd.HasDefault() && fd.ContainingOneof() == nil { - v := fd.Default() - if fd.Kind() == protoreflect.BytesKind { - v = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes - } - m.Set(fd, v) - } - continue - } - } - - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != protoreflect.Repeated: - if fd.Message() != nil { - setDefaults(m.Get(fd).Message()) - } - // Handle list of messages. - case fd.IsList(): - if fd.Message() != nil { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - setDefaults(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { - setDefaults(v.Message()) - return true - }) - } - } - return true - }) -} diff --git a/vendor/github.com/golang/protobuf/proto/deprecated.go b/vendor/github.com/golang/protobuf/proto/deprecated.go deleted file mode 100644 index e8db57e09..000000000 --- a/vendor/github.com/golang/protobuf/proto/deprecated.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "encoding/json" - "errors" - "fmt" - "strconv" - - protoV2 "google.golang.org/protobuf/proto" -) - -var ( - // Deprecated: No longer returned. - ErrNil = errors.New("proto: Marshal called with nil") - - // Deprecated: No longer returned. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") - - // Deprecated: No longer returned. - ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") -) - -// Deprecated: Do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: Do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: Do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func RegisterMessageSetType(Message, int32, string) {} - -// Deprecated: Do not use. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// Deprecated: Do not use. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// Deprecated: Do not use; this type existed for intenal-use only. -type InternalMessageInfo struct{} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) DiscardUnknown(m Message) { - DiscardUnknown(m) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) { - return protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Merge(dst, src Message) { - protoV2.Merge(MessageV2(dst), MessageV2(src)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Size(m Message) int { - return protoV2.Size(MessageV2(m)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Unmarshal(m Message, b []byte) error { - return protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m)) -} diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go deleted file mode 100644 index 2187e877f..000000000 --- a/vendor/github.com/golang/protobuf/proto/discard.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -func DiscardUnknown(m Message) { - if m != nil { - discardUnknown(MessageReflect(m)) - } -} - -func discardUnknown(m protoreflect.Message) { - m.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != protoreflect.Repeated: - if fd.Message() != nil { - discardUnknown(m.Get(fd).Message()) - } - // Handle list of messages. - case fd.IsList(): - if fd.Message() != nil { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - discardUnknown(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { - discardUnknown(v.Message()) - return true - }) - } - } - return true - }) - - // Discard unknown fields. - if len(m.GetUnknown()) > 0 { - m.SetUnknown(nil) - } -} diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go deleted file mode 100644 index 42fc120c9..000000000 --- a/vendor/github.com/golang/protobuf/proto/extensions.go +++ /dev/null @@ -1,356 +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. - -package proto - -import ( - "errors" - "fmt" - "reflect" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -type ( - // ExtensionDesc represents an extension descriptor and - // is used to interact with an extension field in a message. - // - // Variables of this type are generated in code by protoc-gen-go. - ExtensionDesc = protoimpl.ExtensionInfo - - // ExtensionRange represents a range of message extensions. - // Used in code generated by protoc-gen-go. - ExtensionRange = protoiface.ExtensionRangeV1 - - // Deprecated: Do not use; this is an internal type. - Extension = protoimpl.ExtensionFieldV1 - - // Deprecated: Do not use; this is an internal type. - XXX_InternalExtensions = protoimpl.ExtensionFields -) - -// ErrMissingExtension reports whether the extension was not present. -var ErrMissingExtension = errors.New("proto: missing extension") - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -// HasExtension reports whether the extension field is present in m -// either as an explicitly populated field or as an unknown field. -func HasExtension(m Message, xt *ExtensionDesc) (has bool) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return false - } - - // Check whether any populated known field matches the field number. - xtd := xt.TypeDescriptor() - if isValidExtension(mr.Descriptor(), xtd) { - has = mr.Has(xtd) - } else { - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - has = int32(fd.Number()) == xt.Field - return !has - }) - } - - // Check whether any unknown field matches the field number. - for b := mr.GetUnknown(); !has && len(b) > 0; { - num, _, n := protowire.ConsumeField(b) - has = int32(num) == xt.Field - b = b[n:] - } - return has -} - -// ClearExtension removes the extension field from m -// either as an explicitly populated field or as an unknown field. -func ClearExtension(m Message, xt *ExtensionDesc) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - xtd := xt.TypeDescriptor() - if isValidExtension(mr.Descriptor(), xtd) { - mr.Clear(xtd) - } else { - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - if int32(fd.Number()) == xt.Field { - mr.Clear(fd) - return false - } - return true - }) - } - clearUnknown(mr, fieldNum(xt.Field)) -} - -// ClearAllExtensions clears all extensions from m. -// This includes populated fields and unknown fields in the extension range. -func ClearAllExtensions(m Message) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - if fd.IsExtension() { - mr.Clear(fd) - } - return true - }) - clearUnknown(mr, mr.Descriptor().ExtensionRanges()) -} - -// GetExtension retrieves a proto2 extended field from m. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes for the extension field. -func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return nil, errNotExtendable - } - - // Retrieve the unknown fields for this extension field. - var bo protoreflect.RawFields - for bi := mr.GetUnknown(); len(bi) > 0; { - num, _, n := protowire.ConsumeField(bi) - if int32(num) == xt.Field { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - - // For type incomplete descriptors, only retrieve the unknown fields. - if xt.ExtensionType == nil { - return []byte(bo), nil - } - - // If the extension field only exists as unknown fields, unmarshal it. - // This is rarely done since proto.Unmarshal eagerly unmarshals extensions. - xtd := xt.TypeDescriptor() - if !isValidExtension(mr.Descriptor(), xtd) { - return nil, fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) - } - if !mr.Has(xtd) && len(bo) > 0 { - m2 := mr.New() - if err := (proto.UnmarshalOptions{ - Resolver: extensionResolver{xt}, - }.Unmarshal(bo, m2.Interface())); err != nil { - return nil, err - } - if m2.Has(xtd) { - mr.Set(xtd, m2.Get(xtd)) - clearUnknown(mr, fieldNum(xt.Field)) - } - } - - // Check whether the message has the extension field set or a default. - var pv protoreflect.Value - switch { - case mr.Has(xtd): - pv = mr.Get(xtd) - case xtd.HasDefault(): - pv = xtd.Default() - default: - return nil, ErrMissingExtension - } - - v := xt.InterfaceOf(pv) - rv := reflect.ValueOf(v) - if isScalarKind(rv.Kind()) { - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - v = rv2.Interface() - } - return v, nil -} - -// extensionResolver is a custom extension resolver that stores a single -// extension type that takes precedence over the global registry. -type extensionResolver struct{ xt protoreflect.ExtensionType } - -func (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { - if xtd := r.xt.TypeDescriptor(); xtd.FullName() == field { - return r.xt, nil - } - return protoregistry.GlobalTypes.FindExtensionByName(field) -} - -func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { - if xtd := r.xt.TypeDescriptor(); xtd.ContainingMessage().FullName() == message && xtd.Number() == field { - return r.xt, nil - } - return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) -} - -// GetExtensions returns a list of the extensions values present in m, -// corresponding with the provided list of extension descriptors, xts. -// If an extension is missing in m, the corresponding value is nil. -func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return nil, errNotExtendable - } - - vs := make([]interface{}, len(xts)) - for i, xt := range xts { - v, err := GetExtension(m, xt) - if err != nil { - if err == ErrMissingExtension { - continue - } - return vs, err - } - vs[i] = v - } - return vs, nil -} - -// SetExtension sets an extension field in m to the provided value. -func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return errNotExtendable - } - - rv := reflect.ValueOf(v) - if reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", v, xt.ExtensionType) - } - if rv.Kind() == reflect.Ptr { - if rv.IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", v) - } - if isScalarKind(rv.Elem().Kind()) { - v = rv.Elem().Interface() - } - } - - xtd := xt.TypeDescriptor() - if !isValidExtension(mr.Descriptor(), xtd) { - return fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) - } - mr.Set(xtd, xt.ValueOf(v)) - clearUnknown(mr, fieldNum(xt.Field)) - return nil -} - -// SetRawExtension inserts b into the unknown fields of m. -// -// Deprecated: Use Message.ProtoReflect.SetUnknown instead. -func SetRawExtension(m Message, fnum int32, b []byte) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - // Verify that the raw field is valid. - for b0 := b; len(b0) > 0; { - num, _, n := protowire.ConsumeField(b0) - if int32(num) != fnum { - panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) - } - b0 = b0[n:] - } - - ClearExtension(m, &ExtensionDesc{Field: fnum}) - mr.SetUnknown(append(mr.GetUnknown(), b...)) -} - -// ExtensionDescs returns a list of extension descriptors found in m, -// containing descriptors for both populated extension fields in m and -// also unknown fields of m that are in the extension range. -// For the later case, an type incomplete descriptor is provided where only -// the ExtensionDesc.Field field is populated. -// The order of the extension descriptors is undefined. -func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return nil, errNotExtendable - } - - // Collect a set of known extension descriptors. - extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc) - mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - xt := fd.(protoreflect.ExtensionTypeDescriptor) - if xd, ok := xt.Type().(*ExtensionDesc); ok { - extDescs[fd.Number()] = xd - } - } - return true - }) - - // Collect a set of unknown extension descriptors. - extRanges := mr.Descriptor().ExtensionRanges() - for b := mr.GetUnknown(); len(b) > 0; { - num, _, n := protowire.ConsumeField(b) - if extRanges.Has(num) && extDescs[num] == nil { - extDescs[num] = nil - } - b = b[n:] - } - - // Transpose the set of descriptors into a list. - var xts []*ExtensionDesc - for num, xt := range extDescs { - if xt == nil { - xt = &ExtensionDesc{Field: int32(num)} - } - xts = append(xts, xt) - } - return xts, nil -} - -// isValidExtension reports whether xtd is a valid extension descriptor for md. -func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool { - return xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number()) -} - -// isScalarKind reports whether k is a protobuf scalar kind (except bytes). -// This function exists for historical reasons since the representation of -// scalars differs between v1 and v2, where v1 uses *T and v2 uses T. -func isScalarKind(k reflect.Kind) bool { - switch k { - case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - return true - default: - return false - } -} - -// clearUnknown removes unknown fields from m where remover.Has reports true. -func clearUnknown(m protoreflect.Message, remover interface { - Has(protoreflect.FieldNumber) bool -}) { - var bo protoreflect.RawFields - for bi := m.GetUnknown(); len(bi) > 0; { - num, _, n := protowire.ConsumeField(bi) - if !remover.Has(num) { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - if bi := m.GetUnknown(); len(bi) != len(bo) { - m.SetUnknown(bo) - } -} - -type fieldNum protoreflect.FieldNumber - -func (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool { - return protoreflect.FieldNumber(n1) == n2 -} diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go deleted file mode 100644 index dcdc2202f..000000000 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ /dev/null @@ -1,306 +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. - -package proto - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "sync" - - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// StructProperties represents protocol buffer type information for a -// generated protobuf message in the open-struct API. -// -// Deprecated: Do not use. -type StructProperties struct { - // Prop are the properties for each field. - // - // Fields belonging to a oneof are stored in OneofTypes instead, with a - // single Properties representing the parent oneof held here. - // - // The order of Prop matches the order of fields in the Go struct. - // Struct fields that are not related to protobufs have a "XXX_" prefix - // in the Properties.Name and must be ignored by the user. - Prop []*Properties - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the protobuf field name. - OneofTypes map[string]*OneofProperties -} - -// Properties represents the type information for a protobuf message field. -// -// Deprecated: Do not use. -type Properties struct { - // Name is a placeholder name with little meaningful semantic value. - // If the name has an "XXX_" prefix, the entire Properties must be ignored. - Name string - // OrigName is the protobuf field name or oneof name. - OrigName string - // JSONName is the JSON name for the protobuf field. - JSONName string - // Enum is a placeholder name for enums. - // For historical reasons, this is neither the Go name for the enum, - // nor the protobuf name for the enum. - Enum string // Deprecated: Do not use. - // Weak contains the full name of the weakly referenced message. - Weak string - // Wire is a string representation of the wire type. - Wire string - // WireType is the protobuf wire type for the field. - WireType int - // Tag is the protobuf field number. - Tag int - // Required reports whether this is a required field. - Required bool - // Optional reports whether this is a optional field. - Optional bool - // Repeated reports whether this is a repeated field. - Repeated bool - // Packed reports whether this is a packed repeated field of scalars. - Packed bool - // Proto3 reports whether this field operates under the proto3 syntax. - Proto3 bool - // Oneof reports whether this field belongs within a oneof. - Oneof bool - - // Default is the default value in string form. - Default string - // HasDefault reports whether the field has a default value. - HasDefault bool - - // MapKeyProp is the properties for the key field for a map field. - MapKeyProp *Properties - // MapValProp is the properties for the value field for a map field. - MapValProp *Properties -} - -// OneofProperties represents the type information for a protobuf oneof. -// -// Deprecated: Do not use. -type OneofProperties struct { - // Type is a pointer to the generated wrapper type for the field value. - // This is nil for messages that are not in the open-struct API. - Type reflect.Type - // Field is the index into StructProperties.Prop for the containing oneof. - Field int - // Prop is the properties for the field. - Prop *Properties -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," + strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != "" { - s += ",json=" + p.JSONName - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if len(p.Weak) > 0 { - s += ",weak=" + p.Weak - } - if p.Proto3 { - s += ",proto3" - } - if p.Oneof { - s += ",oneof" - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(tag string) { - // For example: "bytes,49,opt,name=foo,def=hello!" - for len(tag) > 0 { - i := strings.IndexByte(tag, ',') - if i < 0 { - i = len(tag) - } - switch s := tag[:i]; { - case strings.HasPrefix(s, "name="): - p.OrigName = s[len("name="):] - case strings.HasPrefix(s, "json="): - p.JSONName = s[len("json="):] - case strings.HasPrefix(s, "enum="): - p.Enum = s[len("enum="):] - case strings.HasPrefix(s, "weak="): - p.Weak = s[len("weak="):] - case strings.Trim(s, "0123456789") == "": - n, _ := strconv.ParseUint(s, 10, 32) - p.Tag = int(n) - case s == "opt": - p.Optional = true - case s == "req": - p.Required = true - case s == "rep": - p.Repeated = true - case s == "varint" || s == "zigzag32" || s == "zigzag64": - p.Wire = s - p.WireType = WireVarint - case s == "fixed32": - p.Wire = s - p.WireType = WireFixed32 - case s == "fixed64": - p.Wire = s - p.WireType = WireFixed64 - case s == "bytes": - p.Wire = s - p.WireType = WireBytes - case s == "group": - p.Wire = s - p.WireType = WireStartGroup - case s == "packed": - p.Packed = true - case s == "proto3": - p.Proto3 = true - case s == "oneof": - p.Oneof = true - case strings.HasPrefix(s, "def="): - // The default tag is special in that everything afterwards is the - // default regardless of the presence of commas. - p.HasDefault = true - p.Default, i = tag[len("def="):], len(tag) - } - tag = strings.TrimPrefix(tag[i:], ",") - } -} - -// Init populates the properties from a protocol buffer struct tag. -// -// Deprecated: Do not use. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - - if typ != nil && typ.Kind() == reflect.Map { - p.MapKeyProp = new(Properties) - p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil) - p.MapValProp = new(Properties) - p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil) - } -} - -var propertiesCache sync.Map // map[reflect.Type]*StructProperties - -// GetProperties returns the list of properties for the type represented by t, -// which must be a generated protocol buffer message in the open-struct API, -// where protobuf message fields are represented by exported Go struct fields. -// -// Deprecated: Use protobuf reflection instead. -func GetProperties(t reflect.Type) *StructProperties { - if p, ok := propertiesCache.Load(t); ok { - return p.(*StructProperties) - } - p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) - return p.(*StructProperties) -} - -func newProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - - var hasOneof bool - prop := new(StructProperties) - - // Construct a list of properties for each field in the struct. - for i := 0; i < t.NumField(); i++ { - p := new(Properties) - f := t.Field(i) - tagField := f.Tag.Get("protobuf") - p.Init(f.Type, f.Name, tagField, &f) - - tagOneof := f.Tag.Get("protobuf_oneof") - if tagOneof != "" { - hasOneof = true - p.OrigName = tagOneof - } - - // Rename unrelated struct fields with the "XXX_" prefix since so much - // user code simply checks for this to exclude special fields. - if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { - p.Name = "XXX_" + p.Name - p.OrigName = "XXX_" + p.OrigName - } else if p.Weak != "" { - p.Name = p.OrigName // avoid possible "XXX_" prefix on weak field - } - - prop.Prop = append(prop.Prop, p) - } - - // Construct a mapping of oneof field names to properties. - if hasOneof { - var oneofWrappers []interface{} - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) - } - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) - } - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoreflect.ProtoMessage); ok { - if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { - oneofWrappers = m.ProtoMessageInfo().OneofWrappers - } - } - - prop.OneofTypes = make(map[string]*OneofProperties) - for _, wrapper := range oneofWrappers { - p := &OneofProperties{ - Type: reflect.ValueOf(wrapper).Type(), // *T - Prop: new(Properties), - } - f := p.Type.Elem().Field(0) - p.Prop.Name = f.Name - p.Prop.Parse(f.Tag.Get("protobuf")) - - // Determine the struct field that contains this oneof. - // Each wrapper is assignable to exactly one parent field. - var foundOneof bool - for i := 0; i < t.NumField() && !foundOneof; i++ { - if p.Type.AssignableTo(t.Field(i).Type) { - p.Field = i - foundOneof = true - } - } - if !foundOneof { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - prop.OneofTypes[p.Prop.OrigName] = p - } - } - - return prop -} - -func (sp *StructProperties) Len() int { return len(sp.Prop) } -func (sp *StructProperties) Less(i, j int) bool { return false } -func (sp *StructProperties) Swap(i, j int) { return } diff --git a/vendor/github.com/golang/protobuf/proto/proto.go b/vendor/github.com/golang/protobuf/proto/proto.go deleted file mode 100644 index 5aee89c32..000000000 --- a/vendor/github.com/golang/protobuf/proto/proto.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package proto provides functionality for handling protocol buffer messages. -// In particular, it provides marshaling and unmarshaling between a protobuf -// message and the binary wire format. -// -// See https://developers.google.com/protocol-buffers/docs/gotutorial for -// more information. -// -// Deprecated: Use the "google.golang.org/protobuf/proto" package instead. -package proto - -import ( - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - ProtoPackageIsVersion1 = true - ProtoPackageIsVersion2 = true - ProtoPackageIsVersion3 = true - ProtoPackageIsVersion4 = true -) - -// GeneratedEnum is any enum type generated by protoc-gen-go -// which is a named int32 kind. -// This type exists for documentation purposes. -type GeneratedEnum interface{} - -// GeneratedMessage is any message type generated by protoc-gen-go -// which is a pointer to a named struct kind. -// This type exists for documentation purposes. -type GeneratedMessage interface{} - -// Message is a protocol buffer message. -// -// This is the v1 version of the message interface and is marginally better -// than an empty interface as it lacks any method to programatically interact -// with the contents of the message. -// -// A v2 message is declared in "google.golang.org/protobuf/proto".Message and -// exposes protobuf reflection as a first-class feature of the interface. -// -// To convert a v1 message to a v2 message, use the MessageV2 function. -// To convert a v2 message to a v1 message, use the MessageV1 function. -type Message = protoiface.MessageV1 - -// MessageV1 converts either a v1 or v2 message to a v1 message. -// It returns nil if m is nil. -func MessageV1(m GeneratedMessage) protoiface.MessageV1 { - return protoimpl.X.ProtoMessageV1Of(m) -} - -// MessageV2 converts either a v1 or v2 message to a v2 message. -// It returns nil if m is nil. -func MessageV2(m GeneratedMessage) protoV2.Message { - return protoimpl.X.ProtoMessageV2Of(m) -} - -// MessageReflect returns a reflective view for a message. -// It returns nil if m is nil. -func MessageReflect(m Message) protoreflect.Message { - return protoimpl.X.MessageOf(m) -} - -// Marshaler is implemented by messages that can marshal themselves. -// This interface is used by the following functions: Size, Marshal, -// Buffer.Marshal, and Buffer.EncodeMessage. -// -// Deprecated: Do not implement. -type Marshaler interface { - // Marshal formats the encoded bytes of the message. - // It should be deterministic and emit valid protobuf wire data. - // The caller takes ownership of the returned buffer. - Marshal() ([]byte, error) -} - -// Unmarshaler is implemented by messages that can unmarshal themselves. -// This interface is used by the following functions: Unmarshal, UnmarshalMerge, -// Buffer.Unmarshal, Buffer.DecodeMessage, and Buffer.DecodeGroup. -// -// Deprecated: Do not implement. -type Unmarshaler interface { - // Unmarshal parses the encoded bytes of the protobuf wire input. - // The provided buffer is only valid for during method call. - // It should not reset the receiver message. - Unmarshal([]byte) error -} - -// Merger is implemented by messages that can merge themselves. -// This interface is used by the following functions: Clone and Merge. -// -// Deprecated: Do not implement. -type Merger interface { - // Merge merges the contents of src into the receiver message. - // It clones all data structures in src such that it aliases no mutable - // memory referenced by src. - Merge(src Message) -} - -// RequiredNotSetError is an error type returned when -// marshaling or unmarshaling a message with missing required fields. -type RequiredNotSetError struct { - err error -} - -func (e *RequiredNotSetError) Error() string { - if e.err != nil { - return e.err.Error() - } - return "proto: required field not set" -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -func checkRequiredNotSet(m protoV2.Message) error { - if err := protoV2.CheckInitialized(m); err != nil { - return &RequiredNotSetError{err: err} - } - return nil -} - -// Clone returns a deep copy of src. -func Clone(src Message) Message { - return MessageV1(protoV2.Clone(MessageV2(src))) -} - -// Merge merges src into dst, which must be messages of the same type. -// -// Populated scalar fields in src are copied to dst, while populated -// singular messages in src are merged into dst by recursively calling Merge. -// The elements of every list field in src is appended to the corresponded -// list fields in dst. The entries of every map field in src is copied into -// the corresponding map field in dst, possibly replacing existing entries. -// The unknown fields of src are appended to the unknown fields of dst. -func Merge(dst, src Message) { - protoV2.Merge(MessageV2(dst), MessageV2(src)) -} - -// Equal reports whether two messages are equal. -// If two messages marshal to the same bytes under deterministic serialization, -// then Equal is guaranteed to report true. -// -// Two messages are equal if they are the same protobuf message type, -// have the same set of populated known and extension field values, -// and the same set of unknown fields values. -// -// Scalar values are compared with the equivalent of the == operator in Go, -// except bytes values which are compared using bytes.Equal and -// floating point values which specially treat NaNs as equal. -// Message values are compared by recursively calling Equal. -// Lists are equal if each element value is also equal. -// Maps are equal if they have the same set of keys, where the pair of values -// for each key is also equal. -func Equal(x, y Message) bool { - return protoV2.Equal(MessageV2(x), MessageV2(y)) -} - -func isMessageSet(md protoreflect.MessageDescriptor) bool { - ms, ok := md.(interface{ IsMessageSet() bool }) - return ok && ms.IsMessageSet() -} diff --git a/vendor/github.com/golang/protobuf/proto/registry.go b/vendor/github.com/golang/protobuf/proto/registry.go deleted file mode 100644 index 1e7ff6420..000000000 --- a/vendor/github.com/golang/protobuf/proto/registry.go +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - "reflect" - "strings" - "sync" - - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// filePath is the path to the proto source file. -type filePath = string // e.g., "google/protobuf/descriptor.proto" - -// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. -type fileDescGZIP = []byte - -var fileCache sync.Map // map[filePath]fileDescGZIP - -// RegisterFile is called from generated code to register the compressed -// FileDescriptorProto with the file path for a proto source file. -// -// Deprecated: Use protoregistry.GlobalFiles.RegisterFile instead. -func RegisterFile(s filePath, d fileDescGZIP) { - // Decompress the descriptor. - zr, err := gzip.NewReader(bytes.NewReader(d)) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - b, err := ioutil.ReadAll(zr) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - - // Construct a protoreflect.FileDescriptor from the raw descriptor. - // Note that DescBuilder.Build automatically registers the constructed - // file descriptor with the v2 registry. - protoimpl.DescBuilder{RawDescriptor: b}.Build() - - // Locally cache the raw descriptor form for the file. - fileCache.Store(s, d) -} - -// FileDescriptor returns the compressed FileDescriptorProto given the file path -// for a proto source file. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalFiles.FindFileByPath instead. -func FileDescriptor(s filePath) fileDescGZIP { - if v, ok := fileCache.Load(s); ok { - return v.(fileDescGZIP) - } - - // Find the descriptor in the v2 registry. - var b []byte - if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { - if fd, ok := fd.(interface{ ProtoLegacyRawDesc() []byte }); ok { - b = fd.ProtoLegacyRawDesc() - } else { - // TODO: Use protodesc.ToFileDescriptorProto to construct - // a descriptorpb.FileDescriptorProto and marshal it. - // However, doing so causes the proto package to have a dependency - // on descriptorpb, leading to cyclic dependency issues. - } - } - - // Locally cache the raw descriptor form for the file. - if len(b) > 0 { - v, _ := fileCache.LoadOrStore(s, protoimpl.X.CompressGZIP(b)) - return v.(fileDescGZIP) - } - return nil -} - -// enumName is the name of an enum. For historical reasons, the enum name is -// neither the full Go name nor the full protobuf name of the enum. -// The name is the dot-separated combination of just the proto package that the -// enum is declared within followed by the Go type name of the generated enum. -type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" - -// enumsByName maps enum values by name to their numeric counterpart. -type enumsByName = map[string]int32 - -// enumsByNumber maps enum values by number to their name counterpart. -type enumsByNumber = map[int32]string - -var enumCache sync.Map // map[enumName]enumsByName -var numFilesCache sync.Map // map[protoreflect.FullName]int - -// RegisterEnum is called from the generated code to register the mapping of -// enum value names to enum numbers for the enum identified by s. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterEnum instead. -func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { - if _, ok := enumCache.Load(s); ok { - panic("proto: duplicate enum registered: " + s) - } - enumCache.Store(s, m) - - // This does not forward registration to the v2 registry since this API - // lacks sufficient information to construct a complete v2 enum descriptor. -} - -// EnumValueMap returns the mapping from enum value names to enum numbers for -// the enum of the given name. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. -func EnumValueMap(s enumName) enumsByName { - if v, ok := enumCache.Load(s); ok { - return v.(enumsByName) - } - - // Check whether the cache is stale. If the number of files in the current - // package differs, then it means that some enums may have been recently - // registered upstream that we do not know about. - var protoPkg protoreflect.FullName - if i := strings.LastIndexByte(s, '.'); i >= 0 { - protoPkg = protoreflect.FullName(s[:i]) - } - v, _ := numFilesCache.Load(protoPkg) - numFiles, _ := v.(int) - if protoregistry.GlobalFiles.NumFilesByPackage(protoPkg) == numFiles { - return nil // cache is up-to-date; was not found earlier - } - - // Update the enum cache for all enums declared in the given proto package. - numFiles = 0 - protoregistry.GlobalFiles.RangeFilesByPackage(protoPkg, func(fd protoreflect.FileDescriptor) bool { - walkEnums(fd, func(ed protoreflect.EnumDescriptor) { - name := protoimpl.X.LegacyEnumName(ed) - if _, ok := enumCache.Load(name); !ok { - m := make(enumsByName) - evs := ed.Values() - for i := evs.Len() - 1; i >= 0; i-- { - ev := evs.Get(i) - m[string(ev.Name())] = int32(ev.Number()) - } - enumCache.LoadOrStore(name, m) - } - }) - numFiles++ - return true - }) - numFilesCache.Store(protoPkg, numFiles) - - // Check cache again for enum map. - if v, ok := enumCache.Load(s); ok { - return v.(enumsByName) - } - return nil -} - -// walkEnums recursively walks all enums declared in d. -func walkEnums(d interface { - Enums() protoreflect.EnumDescriptors - Messages() protoreflect.MessageDescriptors -}, f func(protoreflect.EnumDescriptor)) { - eds := d.Enums() - for i := eds.Len() - 1; i >= 0; i-- { - f(eds.Get(i)) - } - mds := d.Messages() - for i := mds.Len() - 1; i >= 0; i-- { - walkEnums(mds.Get(i), f) - } -} - -// messageName is the full name of protobuf message. -type messageName = string - -var messageTypeCache sync.Map // map[messageName]reflect.Type - -// RegisterType is called from generated code to register the message Go type -// for a message of the given name. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterMessage instead. -func RegisterType(m Message, s messageName) { - mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s)) - if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { - panic(err) - } - messageTypeCache.Store(s, reflect.TypeOf(m)) -} - -// RegisterMapType is called from generated code to register the Go map type -// for a protobuf message representing a map entry. -// -// Deprecated: Do not use. -func RegisterMapType(m interface{}, s messageName) { - t := reflect.TypeOf(m) - if t.Kind() != reflect.Map { - panic(fmt.Sprintf("invalid map kind: %v", t)) - } - if _, ok := messageTypeCache.Load(s); ok { - panic(fmt.Errorf("proto: duplicate proto message registered: %s", s)) - } - messageTypeCache.Store(s, t) -} - -// MessageType returns the message type for a named message. -// It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. -func MessageType(s messageName) reflect.Type { - if v, ok := messageTypeCache.Load(s); ok { - return v.(reflect.Type) - } - - // Derive the message type from the v2 registry. - var t reflect.Type - if mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)); mt != nil { - t = messageGoType(mt) - } - - // If we could not get a concrete type, it is possible that it is a - // pseudo-message for a map entry. - if t == nil { - d, _ := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(s)) - if md, _ := d.(protoreflect.MessageDescriptor); md != nil && md.IsMapEntry() { - kt := goTypeForField(md.Fields().ByNumber(1)) - vt := goTypeForField(md.Fields().ByNumber(2)) - t = reflect.MapOf(kt, vt) - } - } - - // Locally cache the message type for the given name. - if t != nil { - v, _ := messageTypeCache.LoadOrStore(s, t) - return v.(reflect.Type) - } - return nil -} - -func goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type { - switch k := fd.Kind(); k { - case protoreflect.EnumKind: - if et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil { - return enumGoType(et) - } - return reflect.TypeOf(protoreflect.EnumNumber(0)) - case protoreflect.MessageKind, protoreflect.GroupKind: - if mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil { - return messageGoType(mt) - } - return reflect.TypeOf((*protoreflect.Message)(nil)).Elem() - default: - return reflect.TypeOf(fd.Default().Interface()) - } -} - -func enumGoType(et protoreflect.EnumType) reflect.Type { - return reflect.TypeOf(et.New(0)) -} - -func messageGoType(mt protoreflect.MessageType) reflect.Type { - return reflect.TypeOf(MessageV1(mt.Zero().Interface())) -} - -// MessageName returns the full protobuf name for the given message type. -// -// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. -func MessageName(m Message) messageName { - if m == nil { - return "" - } - if m, ok := m.(interface{ XXX_MessageName() messageName }); ok { - return m.XXX_MessageName() - } - return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) -} - -// RegisterExtension is called from the generated code to register -// the extension descriptor. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterExtension instead. -func RegisterExtension(d *ExtensionDesc) { - if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { - panic(err) - } -} - -type extensionsByNumber = map[int32]*ExtensionDesc - -var extensionCache sync.Map // map[messageName]extensionsByNumber - -// RegisteredExtensions returns a map of the registered extensions for the -// provided protobuf message, indexed by the extension field number. -// -// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. -func RegisteredExtensions(m Message) extensionsByNumber { - // Check whether the cache is stale. If the number of extensions for - // the given message differs, then it means that some extensions were - // recently registered upstream that we do not know about. - s := MessageName(m) - v, _ := extensionCache.Load(s) - xs, _ := v.(extensionsByNumber) - if protoregistry.GlobalTypes.NumExtensionsByMessage(protoreflect.FullName(s)) == len(xs) { - return xs // cache is up-to-date - } - - // Cache is stale, re-compute the extensions map. - xs = make(extensionsByNumber) - protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { - if xd, ok := xt.(*ExtensionDesc); ok { - xs[int32(xt.TypeDescriptor().Number())] = xd - } else { - // TODO: This implies that the protoreflect.ExtensionType is a - // custom type not generated by protoc-gen-go. We could try and - // convert the type to an ExtensionDesc. - } - return true - }) - extensionCache.Store(s, xs) - return xs -} diff --git a/vendor/github.com/golang/protobuf/proto/text_decode.go b/vendor/github.com/golang/protobuf/proto/text_decode.go deleted file mode 100644 index 4a5931009..000000000 --- a/vendor/github.com/golang/protobuf/proto/text_decode.go +++ /dev/null @@ -1,801 +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. - -package proto - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/prototext" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapTextUnmarshalV2 = false - -// ParseError is returned by UnmarshalText. -type ParseError struct { - Message string - - // Deprecated: Do not use. - Line, Offset int -} - -func (e *ParseError) Error() string { - if wrapTextUnmarshalV2 { - return e.Message - } - if e.Line == 1 { - return fmt.Sprintf("line 1.%d: %v", e.Offset, e.Message) - } - return fmt.Sprintf("line %d: %v", e.Line, e.Message) -} - -// UnmarshalText parses a proto text formatted string into m. -func UnmarshalText(s string, m Message) error { - if u, ok := m.(encoding.TextUnmarshaler); ok { - return u.UnmarshalText([]byte(s)) - } - - m.Reset() - mi := MessageV2(m) - - if wrapTextUnmarshalV2 { - err := prototext.UnmarshalOptions{ - AllowPartial: true, - }.Unmarshal([]byte(s), mi) - if err != nil { - return &ParseError{Message: err.Error()} - } - return checkRequiredNotSet(mi) - } else { - if err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), ""); err != nil { - return err - } - return checkRequiredNotSet(mi) - } -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) unmarshalMessage(m protoreflect.Message, terminator string) (err error) { - md := m.Descriptor() - fds := md.Fields() - - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - seen := make(map[protoreflect.FieldNumber]bool) - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - if err := p.unmarshalExtensionOrAny(m, seen); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := protoreflect.Name(tok.value) - fd := fds.ByName(name) - switch { - case fd == nil: - gd := fds.ByName(protoreflect.Name(strings.ToLower(string(name)))) - if gd != nil && gd.Kind() == protoreflect.GroupKind && gd.Message().Name() == name { - fd = gd - } - case fd.Kind() == protoreflect.GroupKind && fd.Message().Name() != name: - fd = nil - case fd.IsWeak() && fd.Message().IsPlaceholder(): - fd = nil - } - if fd == nil { - typeName := string(md.FullName()) - if m, ok := m.Interface().(Message); ok { - t := reflect.TypeOf(m) - if t.Kind() == reflect.Ptr { - typeName = t.Elem().String() - } - } - return p.errorf("unknown field name %q in %v", name, typeName) - } - if od := fd.ContainingOneof(); od != nil && m.WhichOneof(od) != nil { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, od.Name()) - } - if fd.Cardinality() != protoreflect.Repeated && seen[fd.Number()] { - return p.errorf("non-repeated field %q was repeated", fd.Name()) - } - seen[fd.Number()] = true - - // Consume any colon. - if err := p.checkForColon(fd); err != nil { - return err - } - - // Parse into the field. - v := m.Get(fd) - if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { - v = m.Mutable(fd) - } - if v, err = p.unmarshalValue(v, fd); err != nil { - return err - } - m.Set(fd, v) - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - } - return nil -} - -func (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[protoreflect.FieldNumber]bool) error { - name, err := p.consumeExtensionOrAnyName() - if err != nil { - return err - } - - // If it contains a slash, it's an Any type URL. - if slashIdx := strings.LastIndex(name, "/"); slashIdx >= 0 { - tok := p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - - mt, err := protoregistry.GlobalTypes.FindMessageByURL(name) - if err != nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", name[slashIdx+len("/"):]) - } - m2 := mt.New() - if err := p.unmarshalMessage(m2, terminator); err != nil { - return err - } - b, err := protoV2.Marshal(m2.Interface()) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", name[slashIdx+len("/"):], err) - } - - urlFD := m.Descriptor().Fields().ByName("type_url") - valFD := m.Descriptor().Fields().ByName("value") - if seen[urlFD.Number()] { - return p.errorf("Any message unpacked multiple times, or %q already set", urlFD.Name()) - } - if seen[valFD.Number()] { - return p.errorf("Any message unpacked multiple times, or %q already set", valFD.Name()) - } - m.Set(urlFD, protoreflect.ValueOfString(name)) - m.Set(valFD, protoreflect.ValueOfBytes(b)) - seen[urlFD.Number()] = true - seen[valFD.Number()] = true - return nil - } - - xname := protoreflect.FullName(name) - xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) - if xt == nil && isMessageSet(m.Descriptor()) { - xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) - } - if xt == nil { - return p.errorf("unrecognized extension %q", name) - } - fd := xt.TypeDescriptor() - if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { - return p.errorf("extension field %q does not extend message %q", name, m.Descriptor().FullName()) - } - - if err := p.checkForColon(fd); err != nil { - return err - } - - v := m.Get(fd) - if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { - v = m.Mutable(fd) - } - v, err = p.unmarshalValue(v, fd) - if err != nil { - return err - } - m.Set(fd, v) - return p.consumeOptionalSeparator() -} - -func (p *textParser) unmarshalValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "" { - return v, p.errorf("unexpected EOF") - } - - switch { - case fd.IsList(): - lv := v.List() - var err error - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - vv := lv.NewElement() - vv, err = p.unmarshalSingularValue(vv, fd) - if err != nil { - return v, err - } - lv.Append(vv) - - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "]" { - break - } - if tok.value != "," { - return v, p.errorf("Expected ']' or ',' found %q", tok.value) - } - } - return v, nil - } - - // One value of the repeated field. - p.back() - vv := lv.NewElement() - vv, err = p.unmarshalSingularValue(vv, fd) - if err != nil { - return v, err - } - lv.Append(vv) - return v, nil - case fd.IsMap(): - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return v, p.errorf("expected '{' or '<', found %q", tok.value) - } - - keyFD := fd.MapKey() - valFD := fd.MapValue() - - mv := v.Map() - kv := keyFD.Default() - vv := mv.NewValue() - for { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == terminator { - break - } - var err error - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return v, err - } - if kv, err = p.unmarshalSingularValue(kv, keyFD); err != nil { - return v, err - } - if err := p.consumeOptionalSeparator(); err != nil { - return v, err - } - case "value": - if err := p.checkForColon(valFD); err != nil { - return v, err - } - if vv, err = p.unmarshalSingularValue(vv, valFD); err != nil { - return v, err - } - if err := p.consumeOptionalSeparator(); err != nil { - return v, err - } - default: - p.back() - return v, p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - mv.Set(kv.MapKey(), vv) - return v, nil - default: - p.back() - return p.unmarshalSingularValue(v, fd) - } -} - -func (p *textParser) unmarshalSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "" { - return v, p.errorf("unexpected EOF") - } - - switch fd.Kind() { - case protoreflect.BoolKind: - switch tok.value { - case "true", "1", "t", "True": - return protoreflect.ValueOfBool(true), nil - case "false", "0", "f", "False": - return protoreflect.ValueOfBool(false), nil - } - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfInt32(int32(x)), nil - } - - // The C++ parser accepts large positive hex numbers that uses - // two's complement arithmetic to represent negative numbers. - // This feature is here for backwards compatibility with C++. - if strings.HasPrefix(tok.value, "0x") { - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfInt32(int32(-(int64(^x) + 1))), nil - } - } - case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfInt64(int64(x)), nil - } - - // The C++ parser accepts large positive hex numbers that uses - // two's complement arithmetic to represent negative numbers. - // This feature is here for backwards compatibility with C++. - if strings.HasPrefix(tok.value, "0x") { - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfInt64(int64(-(int64(^x) + 1))), nil - } - } - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfUint32(uint32(x)), nil - } - case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfUint64(uint64(x)), nil - } - case protoreflect.FloatKind: - // Ignore 'f' for compatibility with output generated by C++, - // but don't remove 'f' when the value is "-inf" or "inf". - v := tok.value - if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { - v = v[:len(v)-len("f")] - } - if x, err := strconv.ParseFloat(v, 32); err == nil { - return protoreflect.ValueOfFloat32(float32(x)), nil - } - case protoreflect.DoubleKind: - // Ignore 'f' for compatibility with output generated by C++, - // but don't remove 'f' when the value is "-inf" or "inf". - v := tok.value - if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { - v = v[:len(v)-len("f")] - } - if x, err := strconv.ParseFloat(v, 64); err == nil { - return protoreflect.ValueOfFloat64(float64(x)), nil - } - case protoreflect.StringKind: - if isQuote(tok.value[0]) { - return protoreflect.ValueOfString(tok.unquoted), nil - } - case protoreflect.BytesKind: - if isQuote(tok.value[0]) { - return protoreflect.ValueOfBytes([]byte(tok.unquoted)), nil - } - case protoreflect.EnumKind: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfEnum(protoreflect.EnumNumber(x)), nil - } - vd := fd.Enum().Values().ByName(protoreflect.Name(tok.value)) - if vd != nil { - return protoreflect.ValueOfEnum(vd.Number()), nil - } - case protoreflect.MessageKind, protoreflect.GroupKind: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return v, p.errorf("expected '{' or '<', found %q", tok.value) - } - err := p.unmarshalMessage(v.Message(), terminator) - return v, err - default: - panic(fmt.Sprintf("invalid kind %v", fd.Kind())) - } - return v, p.errorf("invalid %v: %v", fd.Kind(), tok.value) -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - if fd.Message() == nil { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -// consumeExtensionOrAnyName consumes an extension name or an Any type URL and -// the following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtensionOrAnyName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in unmarshalMessage to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -var errBadUTF8 = errors.New("proto: bad UTF-8") - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(i), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} diff --git a/vendor/github.com/golang/protobuf/proto/text_encode.go b/vendor/github.com/golang/protobuf/proto/text_encode.go deleted file mode 100644 index a31134eeb..000000000 --- a/vendor/github.com/golang/protobuf/proto/text_encode.go +++ /dev/null @@ -1,560 +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. - -package proto - -import ( - "bytes" - "encoding" - "fmt" - "io" - "math" - "sort" - "strings" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapTextMarshalV2 = false - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line) - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes the proto text format of m to w. -func (tm *TextMarshaler) Marshal(w io.Writer, m Message) error { - b, err := tm.marshal(m) - if len(b) > 0 { - if _, err := w.Write(b); err != nil { - return err - } - } - return err -} - -// Text returns a proto text formatted string of m. -func (tm *TextMarshaler) Text(m Message) string { - b, _ := tm.marshal(m) - return string(b) -} - -func (tm *TextMarshaler) marshal(m Message) ([]byte, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return []byte(""), nil - } - - if wrapTextMarshalV2 { - if m, ok := m.(encoding.TextMarshaler); ok { - return m.MarshalText() - } - - opts := prototext.MarshalOptions{ - AllowPartial: true, - EmitUnknown: true, - } - if !tm.Compact { - opts.Indent = " " - } - if !tm.ExpandAny { - opts.Resolver = (*protoregistry.Types)(nil) - } - return opts.Marshal(mr.Interface()) - } else { - w := &textWriter{ - compact: tm.Compact, - expandAny: tm.ExpandAny, - complete: true, - } - - if m, ok := m.(encoding.TextMarshaler); ok { - b, err := m.MarshalText() - if err != nil { - return nil, err - } - w.Write(b) - return w.buf, nil - } - - err := w.writeMessage(mr) - return w.buf, err - } -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// MarshalText writes the proto text format of m to w. -func MarshalText(w io.Writer, m Message) error { return defaultTextMarshaler.Marshal(w, m) } - -// MarshalTextString returns a proto text formatted string of m. -func MarshalTextString(m Message) string { return defaultTextMarshaler.Text(m) } - -// CompactText writes the compact proto text format of m to w. -func CompactText(w io.Writer, m Message) error { return compactTextMarshaler.Marshal(w, m) } - -// CompactTextString returns a compact proto text formatted string of m. -func CompactTextString(m Message) string { return compactTextMarshaler.Text(m) } - -var ( - newline = []byte("\n") - endBraceNewline = []byte("}\n") - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - compact bool // same as TextMarshaler.Compact - expandAny bool // same as TextMarshaler.ExpandAny - complete bool // whether the current position is a complete line - indent int // indentation level; never negative - buf []byte -} - -func (w *textWriter) Write(p []byte) (n int, _ error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - w.buf = append(w.buf, p...) - w.complete = false - return len(p), nil - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - w.buf = append(w.buf, ' ') - n++ - } - w.buf = append(w.buf, frag...) - n += len(frag) - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - w.buf = append(w.buf, frag...) - n += len(frag) - if i+1 < len(frags) { - w.buf = append(w.buf, '\n') - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - w.buf = append(w.buf, c) - w.complete = c == '\n' - return nil -} - -func (w *textWriter) writeName(fd protoreflect.FieldDescriptor) { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - - if fd.Kind() != protoreflect.GroupKind { - w.buf = append(w.buf, fd.Name()...) - w.WriteByte(':') - } else { - // Use message type name for group field name. - w.buf = append(w.buf, fd.Message().Name()...) - } - - if !w.compact { - w.WriteByte(' ') - } -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (w *textWriter) writeProto3Any(m protoreflect.Message) (bool, error) { - md := m.Descriptor() - fdURL := md.Fields().ByName("type_url") - fdVal := md.Fields().ByName("value") - - url := m.Get(fdURL).String() - mt, err := protoregistry.GlobalTypes.FindMessageByURL(url) - if err != nil { - return false, nil - } - - b := m.Get(fdVal).Bytes() - m2 := mt.New() - if err := proto.Unmarshal(b, m2.Interface()); err != nil { - return false, nil - } - w.Write([]byte("[")) - if requiresQuotes(url) { - w.writeQuotedString(url) - } else { - w.Write([]byte(url)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.indent++ - } - if err := w.writeMessage(m2); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.indent-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (w *textWriter) writeMessage(m protoreflect.Message) error { - md := m.Descriptor() - if w.expandAny && md.FullName() == "google.protobuf.Any" { - if canExpand, err := w.writeProto3Any(m); canExpand { - return err - } - } - - fds := md.Fields() - for i := 0; i < fds.Len(); { - fd := fds.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - } else { - i++ - } - if fd == nil || !m.Has(fd) { - continue - } - - switch { - case fd.IsList(): - lv := m.Get(fd).List() - for j := 0; j < lv.Len(); j++ { - w.writeName(fd) - v := lv.Get(j) - if err := w.writeSingularValue(v, fd); err != nil { - return err - } - w.WriteByte('\n') - } - case fd.IsMap(): - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := m.Get(fd).Map() - - type entry struct{ key, val protoreflect.Value } - var entries []entry - mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { - entries = append(entries, entry{k.Value(), v}) - return true - }) - sort.Slice(entries, func(i, j int) bool { - switch kfd.Kind() { - case protoreflect.BoolKind: - return !entries[i].key.Bool() && entries[j].key.Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return entries[i].key.Int() < entries[j].key.Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return entries[i].key.Uint() < entries[j].key.Uint() - case protoreflect.StringKind: - return entries[i].key.String() < entries[j].key.String() - default: - panic("invalid kind") - } - }) - for _, entry := range entries { - w.writeName(fd) - w.WriteByte('<') - if !w.compact { - w.WriteByte('\n') - } - w.indent++ - w.writeName(kfd) - if err := w.writeSingularValue(entry.key, kfd); err != nil { - return err - } - w.WriteByte('\n') - w.writeName(vfd) - if err := w.writeSingularValue(entry.val, vfd); err != nil { - return err - } - w.WriteByte('\n') - w.indent-- - w.WriteByte('>') - w.WriteByte('\n') - } - default: - w.writeName(fd) - if err := w.writeSingularValue(m.Get(fd), fd); err != nil { - return err - } - w.WriteByte('\n') - } - } - - if b := m.GetUnknown(); len(b) > 0 { - w.writeUnknownFields(b) - } - return w.writeExtensions(m) -} - -func (w *textWriter) writeSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) error { - switch fd.Kind() { - case protoreflect.FloatKind, protoreflect.DoubleKind: - switch vf := v.Float(); { - case math.IsInf(vf, +1): - w.Write(posInf) - case math.IsInf(vf, -1): - w.Write(negInf) - case math.IsNaN(vf): - w.Write(nan) - default: - fmt.Fprint(w, v.Interface()) - } - case protoreflect.StringKind: - // NOTE: This does not validate UTF-8 for historical reasons. - w.writeQuotedString(string(v.String())) - case protoreflect.BytesKind: - w.writeQuotedString(string(v.Bytes())) - case protoreflect.MessageKind, protoreflect.GroupKind: - var bra, ket byte = '<', '>' - if fd.Kind() == protoreflect.GroupKind { - bra, ket = '{', '}' - } - w.WriteByte(bra) - if !w.compact { - w.WriteByte('\n') - } - w.indent++ - m := v.Message() - if m2, ok := m.Interface().(encoding.TextMarshaler); ok { - b, err := m2.MarshalText() - if err != nil { - return err - } - w.Write(b) - } else { - w.writeMessage(m) - } - w.indent-- - w.WriteByte(ket) - case protoreflect.EnumKind: - if ev := fd.Enum().Values().ByNumber(v.Enum()); ev != nil { - fmt.Fprint(w, ev.Name()) - } else { - fmt.Fprint(w, v.Enum()) - } - default: - fmt.Fprint(w, v.Interface()) - } - return nil -} - -// writeQuotedString writes a quoted string in the protocol buffer text format. -func (w *textWriter) writeQuotedString(s string) { - w.WriteByte('"') - for i := 0; i < len(s); i++ { - switch c := s[i]; c { - case '\n': - w.buf = append(w.buf, `\n`...) - case '\r': - w.buf = append(w.buf, `\r`...) - case '\t': - w.buf = append(w.buf, `\t`...) - case '"': - w.buf = append(w.buf, `\"`...) - case '\\': - w.buf = append(w.buf, `\\`...) - default: - if isPrint := c >= 0x20 && c < 0x7f; isPrint { - w.buf = append(w.buf, c) - } else { - w.buf = append(w.buf, fmt.Sprintf(`\%03o`, c)...) - } - } - } - w.WriteByte('"') -} - -func (w *textWriter) writeUnknownFields(b []byte) { - if !w.compact { - fmt.Fprintf(w, "/* %d unknown bytes */\n", len(b)) - } - - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return - } - b = b[n:] - - if wtyp == protowire.EndGroupType { - w.indent-- - w.Write(endBraceNewline) - continue - } - fmt.Fprint(w, num) - if wtyp != protowire.StartGroupType { - w.WriteByte(':') - } - if !w.compact || wtyp == protowire.StartGroupType { - w.WriteByte(' ') - } - switch wtyp { - case protowire.VarintType: - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.Fixed32Type: - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.Fixed64Type: - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.BytesType: - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprintf(w, "%q", v) - case protowire.StartGroupType: - w.WriteByte('{') - w.indent++ - default: - fmt.Fprintf(w, "/* unknown wire type %d */", wtyp) - } - w.WriteByte('\n') - } -} - -// writeExtensions writes all the extensions in m. -func (w *textWriter) writeExtensions(m protoreflect.Message) error { - md := m.Descriptor() - if md.ExtensionRanges().Len() == 0 { - return nil - } - - type ext struct { - desc protoreflect.FieldDescriptor - val protoreflect.Value - } - var exts []ext - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - exts = append(exts, ext{fd, v}) - } - return true - }) - sort.Slice(exts, func(i, j int) bool { - return exts[i].desc.Number() < exts[j].desc.Number() - }) - - for _, ext := range exts { - // For message set, use the name of the message as the extension name. - name := string(ext.desc.FullName()) - if isMessageSet(ext.desc.ContainingMessage()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - - if !ext.desc.IsList() { - if err := w.writeSingularExtension(name, ext.val, ext.desc); err != nil { - return err - } - } else { - lv := ext.val.List() - for i := 0; i < lv.Len(); i++ { - if err := w.writeSingularExtension(name, lv.Get(i), ext.desc); err != nil { - return err - } - } - } - } - return nil -} - -func (w *textWriter) writeSingularExtension(name string, v protoreflect.Value, fd protoreflect.FieldDescriptor) error { - fmt.Fprintf(w, "[%s]:", name) - if !w.compact { - w.WriteByte(' ') - } - if err := w.writeSingularValue(v, fd); err != nil { - return err - } - w.WriteByte('\n') - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - for i := 0; i < w.indent*2; i++ { - w.buf = append(w.buf, ' ') - } - w.complete = false -} diff --git a/vendor/github.com/golang/protobuf/proto/wire.go b/vendor/github.com/golang/protobuf/proto/wire.go deleted file mode 100644 index d7c28da5a..000000000 --- a/vendor/github.com/golang/protobuf/proto/wire.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/runtime/protoiface" -) - -// Size returns the size in bytes of the wire-format encoding of m. -func Size(m Message) int { - if m == nil { - return 0 - } - mi := MessageV2(m) - return protoV2.Size(mi) -} - -// Marshal returns the wire-format encoding of m. -func Marshal(m Message) ([]byte, error) { - b, err := marshalAppend(nil, m, false) - if b == nil { - b = zeroBytes - } - return b, err -} - -var zeroBytes = make([]byte, 0, 0) - -func marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) { - if m == nil { - return nil, ErrNil - } - mi := MessageV2(m) - nbuf, err := protoV2.MarshalOptions{ - Deterministic: deterministic, - AllowPartial: true, - }.MarshalAppend(buf, mi) - if err != nil { - return buf, err - } - if len(buf) == len(nbuf) { - if !mi.ProtoReflect().IsValid() { - return buf, ErrNil - } - } - return nbuf, checkRequiredNotSet(mi) -} - -// Unmarshal parses a wire-format message in b and places the decoded results in m. -// -// Unmarshal resets m before starting to unmarshal, so any existing data in m is always -// removed. Use UnmarshalMerge to preserve and append to existing data. -func Unmarshal(b []byte, m Message) error { - m.Reset() - return UnmarshalMerge(b, m) -} - -// UnmarshalMerge parses a wire-format message in b and places the decoded results in m. -func UnmarshalMerge(b []byte, m Message) error { - mi := MessageV2(m) - out, err := protoV2.UnmarshalOptions{ - AllowPartial: true, - Merge: true, - }.UnmarshalState(protoiface.UnmarshalInput{ - Buf: b, - Message: mi.ProtoReflect(), - }) - if err != nil { - return err - } - if out.Flags&protoiface.UnmarshalInitialized > 0 { - return nil - } - return checkRequiredNotSet(mi) -} diff --git a/vendor/github.com/golang/protobuf/proto/wrappers.go b/vendor/github.com/golang/protobuf/proto/wrappers.go deleted file mode 100644 index 398e34859..000000000 --- a/vendor/github.com/golang/protobuf/proto/wrappers.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -// Bool stores v in a new bool value and returns a pointer to it. -func Bool(v bool) *bool { return &v } - -// Int stores v in a new int32 value and returns a pointer to it. -// -// Deprecated: Use Int32 instead. -func Int(v int) *int32 { return Int32(int32(v)) } - -// Int32 stores v in a new int32 value and returns a pointer to it. -func Int32(v int32) *int32 { return &v } - -// Int64 stores v in a new int64 value and returns a pointer to it. -func Int64(v int64) *int64 { return &v } - -// Uint32 stores v in a new uint32 value and returns a pointer to it. -func Uint32(v uint32) *uint32 { return &v } - -// Uint64 stores v in a new uint64 value and returns a pointer to it. -func Uint64(v uint64) *uint64 { return &v } - -// Float32 stores v in a new float32 value and returns a pointer to it. -func Float32(v float32) *float32 { return &v } - -// Float64 stores v in a new float64 value and returns a pointer to it. -func Float64(v float64) *float64 { return &v } - -// String stores v in a new string value and returns a pointer to it. -func String(v string) *string { return &v } diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go deleted file mode 100644 index e729dcff1..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "fmt" - "strings" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - - anypb "github.com/golang/protobuf/ptypes/any" -) - -const urlPrefix = "type.googleapis.com/" - -// AnyMessageName returns the message name contained in an anypb.Any message. -// Most type assertions should use the Is function instead. -func AnyMessageName(any *anypb.Any) (string, error) { - name, err := anyMessageName(any) - return string(name), err -} -func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { - if any == nil { - return "", fmt.Errorf("message is nil") - } - name := protoreflect.FullName(any.TypeUrl) - if i := strings.LastIndex(any.TypeUrl, "/"); i >= 0 { - name = name[i+len("/"):] - } - if !name.IsValid() { - return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) - } - return name, nil -} - -// MarshalAny marshals the given message m into an anypb.Any message. -func MarshalAny(m proto.Message) (*anypb.Any, error) { - switch dm := m.(type) { - case DynamicAny: - m = dm.Message - case *DynamicAny: - if dm == nil { - return nil, proto.ErrNil - } - m = dm.Message - } - b, err := proto.Marshal(m) - if err != nil { - return nil, err - } - return &anypb.Any{TypeUrl: urlPrefix + proto.MessageName(m), Value: b}, nil -} - -// Empty returns a new message of the type specified in an anypb.Any message. -// It returns protoregistry.NotFound if the corresponding message type could not -// be resolved in the global registry. -func Empty(any *anypb.Any) (proto.Message, error) { - name, err := anyMessageName(any) - if err != nil { - return nil, err - } - mt, err := protoregistry.GlobalTypes.FindMessageByName(name) - if err != nil { - return nil, err - } - return proto.MessageV1(mt.New().Interface()), nil -} - -// UnmarshalAny unmarshals the encoded value contained in the anypb.Any message -// into the provided message m. It returns an error if the target message -// does not match the type in the Any message or if an unmarshal error occurs. -// -// The target message m may be a *DynamicAny message. If the underlying message -// type could not be resolved, then this returns protoregistry.NotFound. -func UnmarshalAny(any *anypb.Any, m proto.Message) error { - if dm, ok := m.(*DynamicAny); ok { - if dm.Message == nil { - var err error - dm.Message, err = Empty(any) - if err != nil { - return err - } - } - m = dm.Message - } - - anyName, err := AnyMessageName(any) - if err != nil { - return err - } - msgName := proto.MessageName(m) - if anyName != msgName { - return fmt.Errorf("mismatched message type: got %q want %q", anyName, msgName) - } - return proto.Unmarshal(any.Value, m) -} - -// Is reports whether the Any message contains a message of the specified type. -func Is(any *anypb.Any, m proto.Message) bool { - if any == nil || m == nil { - return false - } - name := proto.MessageName(m) - if !strings.HasSuffix(any.TypeUrl, name) { - return false - } - return len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/' -} - -// DynamicAny is a value that can be passed to UnmarshalAny to automatically -// allocate a proto.Message for the type specified in an anypb.Any message. -// The allocated message is stored in the embedded proto.Message. -// -// Example: -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) -type DynamicAny struct{ proto.Message } - -func (m DynamicAny) String() string { - if m.Message == nil { - return "" - } - return m.Message.String() -} -func (m DynamicAny) Reset() { - if m.Message == nil { - return - } - m.Message.Reset() -} -func (m DynamicAny) ProtoMessage() { - return -} -func (m DynamicAny) ProtoReflect() protoreflect.Message { - if m.Message == nil { - return nil - } - return dynamicAny{proto.MessageReflect(m.Message)} -} - -type dynamicAny struct{ protoreflect.Message } - -func (m dynamicAny) Type() protoreflect.MessageType { - return dynamicAnyType{m.Message.Type()} -} -func (m dynamicAny) New() protoreflect.Message { - return dynamicAnyType{m.Message.Type()}.New() -} -func (m dynamicAny) Interface() protoreflect.ProtoMessage { - return DynamicAny{proto.MessageV1(m.Message.Interface())} -} - -type dynamicAnyType struct{ protoreflect.MessageType } - -func (t dynamicAnyType) New() protoreflect.Message { - return dynamicAny{t.MessageType.New()} -} -func (t dynamicAnyType) Zero() protoreflect.Message { - return dynamicAny{t.MessageType.Zero()} -} diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go deleted file mode 100644 index 0ef27d33d..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/any/any.proto - -package any - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/any.proto. - -type Any = anypb.Any - -var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, - 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } -func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { - if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_any_any_proto = out.File - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/doc.go b/vendor/github.com/golang/protobuf/ptypes/doc.go deleted file mode 100644 index fb9edd5c6..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ptypes provides functionality for interacting with well-known types. -package ptypes diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go deleted file mode 100644 index 6110ae8a4..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/duration.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "errors" - "fmt" - "time" - - durationpb "github.com/golang/protobuf/ptypes/duration" -) - -// Range of google.protobuf.Duration as specified in duration.proto. -// This is about 10,000 years in seconds. -const ( - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// Duration converts a durationpb.Duration to a time.Duration. -// Duration returns an error if dur is invalid or overflows a time.Duration. -func Duration(dur *durationpb.Duration) (time.Duration, error) { - if err := validateDuration(dur); err != nil { - return 0, err - } - d := time.Duration(dur.Seconds) * time.Second - if int64(d/time.Second) != dur.Seconds { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) - } - if dur.Nanos != 0 { - d += time.Duration(dur.Nanos) * time.Nanosecond - if (d < 0) != (dur.Nanos < 0) { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a durationpb.Duration. -func DurationProto(d time.Duration) *durationpb.Duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &durationpb.Duration{ - Seconds: int64(secs), - Nanos: int32(nanos), - } -} - -// validateDuration determines whether the durationpb.Duration is valid -// according to the definition in google/protobuf/duration.proto. -// A valid durpb.Duration may still be too large to fit into a time.Duration -// Note that the range of durationpb.Duration is about 10,000 years, -// while the range of time.Duration is about 290 years. -func validateDuration(dur *durationpb.Duration) error { - if dur == nil { - return errors.New("duration: nil Duration") - } - if dur.Seconds < minSeconds || dur.Seconds > maxSeconds { - return fmt.Errorf("duration: %v: seconds out of range", dur) - } - if dur.Nanos <= -1e9 || dur.Nanos >= 1e9 { - return fmt.Errorf("duration: %v: nanos out of range", dur) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) { - return fmt.Errorf("duration: %v: seconds and nanos have different signs", dur) - } - return nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go deleted file mode 100644 index d0079ee3e..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/duration/duration.proto - -package duration - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/duration.proto. - -type Duration = durationpb.Duration - -var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ - 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } -func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { - if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_duration_duration_proto = out.File - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go deleted file mode 100644 index 026d0d491..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "errors" - "fmt" - "time" - - timestamppb "github.com/golang/protobuf/ptypes/timestamp" -) - -// Range of google.protobuf.Duration as specified in timestamp.proto. -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// Timestamp converts a timestamppb.Timestamp to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return -// value is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampNow returns a google.protobuf.Timestamp for the current time. -func TimestampNow() *timestamppb.Timestamp { - ts, err := TimestampProto(time.Now()) - if err != nil { - panic("ptypes: time.Now() out of Timestamp range") - } - return ts -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { - ts := ×tamppb.Timestamp{ - Seconds: t.Unix(), - Nanos: int32(t.Nanosecond()), - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} - -// TimestampString returns the RFC 3339 string for valid Timestamps. -// For invalid Timestamps, it returns an error message in parentheses. -func TimestampString(ts *timestamppb.Timestamp) string { - t, err := Timestamp(ts) - if err != nil { - return fmt.Sprintf("(%v)", err) - } - return t.Format(time.RFC3339Nano) -} - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range [0001-01-01, 10000-01-01) -// and has a Nanos field in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes the problem. -// -// Every valid Timestamp can be represented by a time.Time, -// but the converse is not true. -func validateTimestamp(ts *timestamppb.Timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts) - } - return nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go deleted file mode 100644 index a76f80760..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto - -package timestamp - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/timestamp.proto. - -type Timestamp = timestamppb.Timestamp - -var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ - 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x37, - 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } -func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { - if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = out.File - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/go-querystring/LICENSE b/vendor/github.com/google/go-querystring/LICENSE deleted file mode 100644 index ae121a1e4..000000000 --- a/vendor/github.com/google/go-querystring/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 Google. 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/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go deleted file mode 100644 index 37080b19b..000000000 --- a/vendor/github.com/google/go-querystring/query/encode.go +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package query implements encoding of structs into URL query parameters. -// -// As a simple example: -// -// type Options struct { -// Query string `url:"q"` -// ShowAll bool `url:"all"` -// Page int `url:"page"` -// } -// -// opt := Options{ "foo", true, 2 } -// v, _ := query.Values(opt) -// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" -// -// The exact mapping between Go values and url.Values is described in the -// documentation for the Values() function. -package query - -import ( - "bytes" - "fmt" - "net/url" - "reflect" - "strconv" - "strings" - "time" -) - -var timeType = reflect.TypeOf(time.Time{}) - -var encoderType = reflect.TypeOf(new(Encoder)).Elem() - -// Encoder is an interface implemented by any type that wishes to encode -// itself into URL values in a non-standard way. -type Encoder interface { - EncodeValues(key string, v *url.Values) error -} - -// Values returns the url.Values encoding of v. -// -// Values expects to be passed a struct, and traverses it recursively using the -// following encoding rules. -// -// Each exported struct field is encoded as a URL parameter unless -// -// - the field's tag is "-", or -// - the field is empty and its tag specifies the "omitempty" option -// -// The empty values are false, 0, any nil pointer or interface value, any array -// slice, map, or string of length zero, and any time.Time that returns true -// for IsZero(). -// -// The URL parameter name defaults to the struct field name but can be -// specified in the struct field's tag value. The "url" key in the struct -// field's tag value is the key name, followed by an optional comma and -// options. For example: -// -// // Field is ignored by this package. -// Field int `url:"-"` -// -// // Field appears as URL parameter "myName". -// Field int `url:"myName"` -// -// // Field appears as URL parameter "myName" and the field is omitted if -// // its value is empty -// Field int `url:"myName,omitempty"` -// -// // Field appears as URL parameter "Field" (the default), but the field -// // is skipped if empty. Note the leading comma. -// Field int `url:",omitempty"` -// -// For encoding individual field values, the following type-dependent rules -// apply: -// -// Boolean values default to encoding as the strings "true" or "false". -// Including the "int" option signals that the field should be encoded as the -// strings "1" or "0". -// -// time.Time values default to encoding as RFC3339 timestamps. Including the -// "unix" option signals that the field should be encoded as a Unix time (see -// time.Unix()) -// -// Slice and Array values default to encoding as multiple URL values of the -// same name. Including the "comma" option signals that the field should be -// encoded as a single comma-delimited value. Including the "space" option -// similarly encodes the value as a single space-delimited string. Including -// the "semicolon" option will encode the value as a semicolon-delimited string. -// Including the "brackets" option signals that the multiple URL values should -// have "[]" appended to the value name. "numbered" will append a number to -// the end of each incidence of the value name, example: -// name0=value0&name1=value1, etc. -// -// Anonymous struct fields are usually encoded as if their inner exported -// fields were fields in the outer struct, subject to the standard Go -// visibility rules. An anonymous struct field with a name given in its URL -// tag is treated as having that name, rather than being anonymous. -// -// Non-nil pointer values are encoded as the value pointed to. -// -// Nested structs are encoded including parent fields in value names for -// scoping. e.g: -// -// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO" -// -// All other values are encoded using their default string representation. -// -// Multiple fields that encode to the same URL parameter name will be included -// as multiple URL values of the same name. -func Values(v interface{}) (url.Values, error) { - values := make(url.Values) - val := reflect.ValueOf(v) - for val.Kind() == reflect.Ptr { - if val.IsNil() { - return values, nil - } - val = val.Elem() - } - - if v == nil { - return values, nil - } - - if val.Kind() != reflect.Struct { - return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind()) - } - - err := reflectValue(values, val, "") - return values, err -} - -// reflectValue populates the values parameter from the struct fields in val. -// Embedded structs are followed recursively (using the rules defined in the -// Values function documentation) breadth-first. -func reflectValue(values url.Values, val reflect.Value, scope string) error { - var embedded []reflect.Value - - typ := val.Type() - for i := 0; i < typ.NumField(); i++ { - sf := typ.Field(i) - if sf.PkgPath != "" && !sf.Anonymous { // unexported - continue - } - - sv := val.Field(i) - tag := sf.Tag.Get("url") - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if name == "" { - if sf.Anonymous && sv.Kind() == reflect.Struct { - // save embedded struct for later processing - embedded = append(embedded, sv) - continue - } - - name = sf.Name - } - - if scope != "" { - name = scope + "[" + name + "]" - } - - if opts.Contains("omitempty") && isEmptyValue(sv) { - continue - } - - if sv.Type().Implements(encoderType) { - if !reflect.Indirect(sv).IsValid() { - sv = reflect.New(sv.Type().Elem()) - } - - m := sv.Interface().(Encoder) - if err := m.EncodeValues(name, &values); err != nil { - return err - } - continue - } - - if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { - var del byte - if opts.Contains("comma") { - del = ',' - } else if opts.Contains("space") { - del = ' ' - } else if opts.Contains("semicolon") { - del = ';' - } else if opts.Contains("brackets") { - name = name + "[]" - } - - if del != 0 { - s := new(bytes.Buffer) - first := true - for i := 0; i < sv.Len(); i++ { - if first { - first = false - } else { - s.WriteByte(del) - } - s.WriteString(valueString(sv.Index(i), opts)) - } - values.Add(name, s.String()) - } else { - for i := 0; i < sv.Len(); i++ { - k := name - if opts.Contains("numbered") { - k = fmt.Sprintf("%s%d", name, i) - } - values.Add(k, valueString(sv.Index(i), opts)) - } - } - continue - } - - for sv.Kind() == reflect.Ptr { - if sv.IsNil() { - break - } - sv = sv.Elem() - } - - if sv.Type() == timeType { - values.Add(name, valueString(sv, opts)) - continue - } - - if sv.Kind() == reflect.Struct { - reflectValue(values, sv, name) - continue - } - - values.Add(name, valueString(sv, opts)) - } - - for _, f := range embedded { - if err := reflectValue(values, f, scope); err != nil { - return err - } - } - - return nil -} - -// valueString returns the string representation of a value. -func valueString(v reflect.Value, opts tagOptions) string { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - return "" - } - v = v.Elem() - } - - if v.Kind() == reflect.Bool && opts.Contains("int") { - if v.Bool() { - return "1" - } - return "0" - } - - if v.Type() == timeType { - t := v.Interface().(time.Time) - if opts.Contains("unix") { - return strconv.FormatInt(t.Unix(), 10) - } - return t.Format(time.RFC3339) - } - - return fmt.Sprint(v.Interface()) -} - -// isEmptyValue checks if a value should be considered empty for the purposes -// of omitting fields with the "omitempty" option. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - - if v.Type() == timeType { - return v.Interface().(time.Time).IsZero() - } - - return false -} - -// tagOptions is the string following a comma in a struct field's "url" tag, or -// the empty string. It does not include the leading comma. -type tagOptions []string - -// parseTag splits a struct field's url tag into its name and comma-separated -// options. -func parseTag(tag string) (string, tagOptions) { - s := strings.Split(tag, ",") - return s[0], s[1:] -} - -// Contains checks whether the tagOptions contains the specified option. -func (o tagOptions) Contains(option string) bool { - for _, s := range o { - if s == option { - return true - } - } - return false -} diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml deleted file mode 100644 index d8156a60b..000000000 --- a/vendor/github.com/google/uuid/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.4.3 - - 1.5.3 - - tip - -script: - - go test -v ./... diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md deleted file mode 100644 index 04fdf09f1..000000000 --- a/vendor/github.com/google/uuid/CONTRIBUTING.md +++ /dev/null @@ -1,10 +0,0 @@ -# How to contribute - -We definitely welcome patches and contribution to this project! - -### Legal requirements - -In order to protect both you and ourselves, you will need to sign the -[Contributor License Agreement](https://cla.developers.google.com/clas). - -You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS deleted file mode 100644 index b4bb97f6b..000000000 --- a/vendor/github.com/google/uuid/CONTRIBUTORS +++ /dev/null @@ -1,9 +0,0 @@ -Paul Borman -bmatsuo -shawnps -theory -jboverfelt -dsymonds -cd1 -wallclockbuilder -dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE deleted file mode 100644 index 5dc68268d..000000000 --- a/vendor/github.com/google/uuid/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009,2014 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * 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/google/uuid/README.md b/vendor/github.com/google/uuid/README.md deleted file mode 100644 index 9d92c11f1..000000000 --- a/vendor/github.com/google/uuid/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) -The uuid package generates and inspects UUIDs based on -[RFC 4122](http://tools.ietf.org/html/rfc4122) -and DCE 1.1: Authentication and Security Services. - -This package is based on the github.com/pborman/uuid package (previously named -code.google.com/p/go-uuid). It differs from these earlier packages in that -a UUID is a 16 byte array rather than a byte slice. One loss due to this -change is the ability to represent an invalid UUID (vs a NIL UUID). - -###### Install -`go get github.com/google/uuid` - -###### Documentation -[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) - -Full `go doc` style documentation for the package can be viewed online without -installing this package by using the GoDoc site here: -http://godoc.org/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go deleted file mode 100644 index fa820b9d3..000000000 --- a/vendor/github.com/google/uuid/dce.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" - "fmt" - "os" -) - -// A Domain represents a Version 2 domain -type Domain byte - -// Domain constants for DCE Security (Version 2) UUIDs. -const ( - Person = Domain(0) - Group = Domain(1) - Org = Domain(2) -) - -// NewDCESecurity returns a DCE Security (Version 2) UUID. -// -// The domain should be one of Person, Group or Org. -// On a POSIX system the id should be the users UID for the Person -// domain and the users GID for the Group. The meaning of id for -// the domain Org or on non-POSIX systems is site defined. -// -// For a given domain/id pair the same token may be returned for up to -// 7 minutes and 10 seconds. -func NewDCESecurity(domain Domain, id uint32) (UUID, error) { - uuid, err := NewUUID() - if err == nil { - uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 - uuid[9] = byte(domain) - binary.BigEndian.PutUint32(uuid[0:], id) - } - return uuid, err -} - -// NewDCEPerson returns a DCE Security (Version 2) UUID in the person -// domain with the id returned by os.Getuid. -// -// NewDCESecurity(Person, uint32(os.Getuid())) -func NewDCEPerson() (UUID, error) { - return NewDCESecurity(Person, uint32(os.Getuid())) -} - -// NewDCEGroup returns a DCE Security (Version 2) UUID in the group -// domain with the id returned by os.Getgid. -// -// NewDCESecurity(Group, uint32(os.Getgid())) -func NewDCEGroup() (UUID, error) { - return NewDCESecurity(Group, uint32(os.Getgid())) -} - -// Domain returns the domain for a Version 2 UUID. Domains are only defined -// for Version 2 UUIDs. -func (uuid UUID) Domain() Domain { - return Domain(uuid[9]) -} - -// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 -// UUIDs. -func (uuid UUID) ID() uint32 { - return binary.BigEndian.Uint32(uuid[0:4]) -} - -func (d Domain) String() string { - switch d { - case Person: - return "Person" - case Group: - return "Group" - case Org: - return "Org" - } - return fmt.Sprintf("Domain%d", int(d)) -} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go deleted file mode 100644 index 5b8a4b9af..000000000 --- a/vendor/github.com/google/uuid/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package uuid generates and inspects UUIDs. -// -// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security -// Services. -// -// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to -// maps or compared directly. -package uuid diff --git a/vendor/github.com/google/uuid/go.mod b/vendor/github.com/google/uuid/go.mod deleted file mode 100644 index fc84cd79d..000000000 --- a/vendor/github.com/google/uuid/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/google/uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go deleted file mode 100644 index b17461631..000000000 --- a/vendor/github.com/google/uuid/hash.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "crypto/md5" - "crypto/sha1" - "hash" -) - -// Well known namespace IDs and UUIDs -var ( - NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) - Nil UUID // empty UUID, all zeros -) - -// NewHash returns a new UUID derived from the hash of space concatenated with -// data generated by h. The hash should be at least 16 byte in length. The -// first 16 bytes of the hash are used to form the UUID. The version of the -// UUID will be the lower 4 bits of version. NewHash is used to implement -// NewMD5 and NewSHA1. -func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { - h.Reset() - h.Write(space[:]) - h.Write(data) - s := h.Sum(nil) - var uuid UUID - copy(uuid[:], s) - uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) - uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant - return uuid -} - -// NewMD5 returns a new MD5 (Version 3) UUID based on the -// supplied name space and data. It is the same as calling: -// -// NewHash(md5.New(), space, data, 3) -func NewMD5(space UUID, data []byte) UUID { - return NewHash(md5.New(), space, data, 3) -} - -// NewSHA1 returns a new SHA1 (Version 5) UUID based on the -// supplied name space and data. It is the same as calling: -// -// NewHash(sha1.New(), space, data, 5) -func NewSHA1(space UUID, data []byte) UUID { - return NewHash(sha1.New(), space, data, 5) -} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go deleted file mode 100644 index 7f9e0c6c0..000000000 --- a/vendor/github.com/google/uuid/marshal.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "fmt" - -// MarshalText implements encoding.TextMarshaler. -func (uuid UUID) MarshalText() ([]byte, error) { - var js [36]byte - encodeHex(js[:], uuid) - return js[:], nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (uuid *UUID) UnmarshalText(data []byte) error { - id, err := ParseBytes(data) - if err == nil { - *uuid = id - } - return err -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (uuid UUID) MarshalBinary() ([]byte, error) { - return uuid[:], nil -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (uuid *UUID) UnmarshalBinary(data []byte) error { - if len(data) != 16 { - return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) - } - copy(uuid[:], data) - return nil -} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go deleted file mode 100644 index d651a2b06..000000000 --- a/vendor/github.com/google/uuid/node.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "sync" -) - -var ( - nodeMu sync.Mutex - ifname string // name of interface being used - nodeID [6]byte // hardware for version 1 UUIDs - zeroID [6]byte // nodeID with only 0's -) - -// NodeInterface returns the name of the interface from which the NodeID was -// derived. The interface "user" is returned if the NodeID was set by -// SetNodeID. -func NodeInterface() string { - defer nodeMu.Unlock() - nodeMu.Lock() - return ifname -} - -// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. -// If name is "" then the first usable interface found will be used or a random -// Node ID will be generated. If a named interface cannot be found then false -// is returned. -// -// SetNodeInterface never fails when name is "". -func SetNodeInterface(name string) bool { - defer nodeMu.Unlock() - nodeMu.Lock() - return setNodeInterface(name) -} - -func setNodeInterface(name string) bool { - iname, addr := getHardwareInterface(name) // null implementation for js - if iname != "" && addr != nil { - ifname = iname - copy(nodeID[:], addr) - return true - } - - // We found no interfaces with a valid hardware address. If name - // does not specify a specific interface generate a random Node ID - // (section 4.1.6) - if name == "" { - ifname = "random" - randomBits(nodeID[:]) - return true - } - return false -} - -// NodeID returns a slice of a copy of the current Node ID, setting the Node ID -// if not already set. -func NodeID() []byte { - defer nodeMu.Unlock() - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - nid := nodeID - return nid[:] -} - -// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes -// of id are used. If id is less than 6 bytes then false is returned and the -// Node ID is not set. -func SetNodeID(id []byte) bool { - if len(id) < 6 { - return false - } - defer nodeMu.Unlock() - nodeMu.Lock() - copy(nodeID[:], id) - ifname = "user" - return true -} - -// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is -// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) NodeID() []byte { - var node [6]byte - copy(node[:], uuid[10:]) - return node[:] -} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go deleted file mode 100644 index 24b78edc9..000000000 --- a/vendor/github.com/google/uuid/node_js.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build js - -package uuid - -// getHardwareInterface returns nil values for the JS version of the code. -// This remvoves the "net" dependency, because it is not used in the browser. -// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. -func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go deleted file mode 100644 index 0cbbcddbd..000000000 --- a/vendor/github.com/google/uuid/node_net.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !js - -package uuid - -import "net" - -var interfaces []net.Interface // cached list of interfaces - -// getHardwareInterface returns the name and hardware address of interface name. -// If name is "" then the name and hardware address of one of the system's -// interfaces is returned. If no interfaces are found (name does not exist or -// there are no interfaces) then "", nil is returned. -// -// Only addresses of at least 6 bytes are returned. -func getHardwareInterface(name string) (string, []byte) { - if interfaces == nil { - var err error - interfaces, err = net.Interfaces() - if err != nil { - return "", nil - } - } - for _, ifs := range interfaces { - if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { - return ifs.Name, ifs.HardwareAddr - } - } - return "", nil -} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go deleted file mode 100644 index f326b54db..000000000 --- a/vendor/github.com/google/uuid/sql.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "database/sql/driver" - "fmt" -) - -// Scan implements sql.Scanner so UUIDs can be read from databases transparently -// Currently, database types that map to string and []byte are supported. Please -// consult database-specific driver documentation for matching types. -func (uuid *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case nil: - return nil - - case string: - // if an empty UUID comes from a table, we return a null UUID - if src == "" { - return nil - } - - // see Parse for required string format - u, err := Parse(src) - if err != nil { - return fmt.Errorf("Scan: %v", err) - } - - *uuid = u - - case []byte: - // if an empty UUID comes from a table, we return a null UUID - if len(src) == 0 { - return nil - } - - // assumes a simple slice of bytes if 16 bytes - // otherwise attempts to parse - if len(src) != 16 { - return uuid.Scan(string(src)) - } - copy((*uuid)[:], src) - - default: - return fmt.Errorf("Scan: unable to scan type %T into UUID", src) - } - - return nil -} - -// Value implements sql.Valuer so that UUIDs can be written to databases -// transparently. Currently, UUIDs map to strings. Please consult -// database-specific driver documentation for matching types. -func (uuid UUID) Value() (driver.Value, error) { - return uuid.String(), nil -} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go deleted file mode 100644 index e6ef06cdc..000000000 --- a/vendor/github.com/google/uuid/time.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" - "sync" - "time" -) - -// A Time represents a time as the number of 100's of nanoseconds since 15 Oct -// 1582. -type Time int64 - -const ( - lillian = 2299160 // Julian day of 15 Oct 1582 - unix = 2440587 // Julian day of 1 Jan 1970 - epoch = unix - lillian // Days between epochs - g1582 = epoch * 86400 // seconds between epochs - g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs -) - -var ( - timeMu sync.Mutex - lasttime uint64 // last time we returned - clockSeq uint16 // clock sequence for this run - - timeNow = time.Now // for testing -) - -// UnixTime converts t the number of seconds and nanoseconds using the Unix -// epoch of 1 Jan 1970. -func (t Time) UnixTime() (sec, nsec int64) { - sec = int64(t - g1582ns100) - nsec = (sec % 10000000) * 100 - sec /= 10000000 - return sec, nsec -} - -// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and -// clock sequence as well as adjusting the clock sequence as needed. An error -// is returned if the current time cannot be determined. -func GetTime() (Time, uint16, error) { - defer timeMu.Unlock() - timeMu.Lock() - return getTime() -} - -func getTime() (Time, uint16, error) { - t := timeNow() - - // If we don't have a clock sequence already, set one. - if clockSeq == 0 { - setClockSequence(-1) - } - now := uint64(t.UnixNano()/100) + g1582ns100 - - // If time has gone backwards with this clock sequence then we - // increment the clock sequence - if now <= lasttime { - clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 - } - lasttime = now - return Time(now), clockSeq, nil -} - -// ClockSequence returns the current clock sequence, generating one if not -// already set. The clock sequence is only used for Version 1 UUIDs. -// -// The uuid package does not use global static storage for the clock sequence or -// the last time a UUID was generated. Unless SetClockSequence is used, a new -// random clock sequence is generated the first time a clock sequence is -// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) -func ClockSequence() int { - defer timeMu.Unlock() - timeMu.Lock() - return clockSequence() -} - -func clockSequence() int { - if clockSeq == 0 { - setClockSequence(-1) - } - return int(clockSeq & 0x3fff) -} - -// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to -// -1 causes a new sequence to be generated. -func SetClockSequence(seq int) { - defer timeMu.Unlock() - timeMu.Lock() - setClockSequence(seq) -} - -func setClockSequence(seq int) { - if seq == -1 { - var b [2]byte - randomBits(b[:]) // clock sequence - seq = int(b[0])<<8 | int(b[1]) - } - oldSeq := clockSeq - clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant - if oldSeq != clockSeq { - lasttime = 0 - } -} - -// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in -// uuid. The time is only defined for version 1 and 2 UUIDs. -func (uuid UUID) Time() Time { - time := int64(binary.BigEndian.Uint32(uuid[0:4])) - time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 - time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 - return Time(time) -} - -// ClockSequence returns the clock sequence encoded in uuid. -// The clock sequence is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) ClockSequence() int { - return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff -} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go deleted file mode 100644 index 5ea6c7378..000000000 --- a/vendor/github.com/google/uuid/util.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "io" -) - -// randomBits completely fills slice b with random data. -func randomBits(b []byte) { - if _, err := io.ReadFull(rander, b); err != nil { - panic(err.Error()) // rand should never fail - } -} - -// xvalues returns the value of a byte as a hexadecimal digit or 255. -var xvalues = [256]byte{ - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -} - -// xtob converts hex characters x1 and x2 into a byte. -func xtob(x1, x2 byte) (byte, bool) { - b1 := xvalues[x1] - b2 := xvalues[x2] - return (b1 << 4) | b2, b1 != 255 && b2 != 255 -} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go deleted file mode 100644 index 524404cc5..000000000 --- a/vendor/github.com/google/uuid/uuid.go +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright 2018 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "bytes" - "crypto/rand" - "encoding/hex" - "errors" - "fmt" - "io" - "strings" -) - -// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC -// 4122. -type UUID [16]byte - -// A Version represents a UUID's version. -type Version byte - -// A Variant represents a UUID's variant. -type Variant byte - -// Constants returned by Variant. -const ( - Invalid = Variant(iota) // Invalid UUID - RFC4122 // The variant specified in RFC4122 - Reserved // Reserved, NCS backward compatibility. - Microsoft // Reserved, Microsoft Corporation backward compatibility. - Future // Reserved for future definition. -) - -var rander = rand.Reader // random function - -// Parse decodes s into a UUID or returns an error. Both the standard UUID -// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the -// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex -// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. -func Parse(s string) (UUID, error) { - var uuid UUID - switch len(s) { - // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36: - - // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: - if strings.ToLower(s[:9]) != "urn:uuid:" { - return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) - } - s = s[9:] - - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - case 36 + 2: - s = s[1:] - - // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - case 32: - var ok bool - for i := range uuid { - uuid[i], ok = xtob(s[i*2], s[i*2+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) - } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return uuid, errors.New("invalid UUID format") - } - for i, x := range [16]int{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34} { - v, ok := xtob(s[x], s[x+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - uuid[i] = v - } - return uuid, nil -} - -// ParseBytes is like Parse, except it parses a byte slice instead of a string. -func ParseBytes(b []byte) (UUID, error) { - var uuid UUID - switch len(b) { - case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { - return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) - } - b = b[9:] - case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - b = b[1:] - case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - var ok bool - for i := 0; i < 32; i += 2 { - uuid[i/2], ok = xtob(b[i], b[i+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) - } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { - return uuid, errors.New("invalid UUID format") - } - for i, x := range [16]int{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34} { - v, ok := xtob(b[x], b[x+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - uuid[i] = v - } - return uuid, nil -} - -// MustParse is like Parse but panics if the string cannot be parsed. -// It simplifies safe initialization of global variables holding compiled UUIDs. -func MustParse(s string) UUID { - uuid, err := Parse(s) - if err != nil { - panic(`uuid: Parse(` + s + `): ` + err.Error()) - } - return uuid -} - -// FromBytes creates a new UUID from a byte slice. Returns an error if the slice -// does not have a length of 16. The bytes are copied from the slice. -func FromBytes(b []byte) (uuid UUID, err error) { - err = uuid.UnmarshalBinary(b) - return uuid, err -} - -// Must returns uuid if err is nil and panics otherwise. -func Must(uuid UUID, err error) UUID { - if err != nil { - panic(err) - } - return uuid -} - -// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -// , or "" if uuid is invalid. -func (uuid UUID) String() string { - var buf [36]byte - encodeHex(buf[:], uuid) - return string(buf[:]) -} - -// URN returns the RFC 2141 URN form of uuid, -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. -func (uuid UUID) URN() string { - var buf [36 + 9]byte - copy(buf[:], "urn:uuid:") - encodeHex(buf[9:], uuid) - return string(buf[:]) -} - -func encodeHex(dst []byte, uuid UUID) { - hex.Encode(dst, uuid[:4]) - dst[8] = '-' - hex.Encode(dst[9:13], uuid[4:6]) - dst[13] = '-' - hex.Encode(dst[14:18], uuid[6:8]) - dst[18] = '-' - hex.Encode(dst[19:23], uuid[8:10]) - dst[23] = '-' - hex.Encode(dst[24:], uuid[10:]) -} - -// Variant returns the variant encoded in uuid. -func (uuid UUID) Variant() Variant { - switch { - case (uuid[8] & 0xc0) == 0x80: - return RFC4122 - case (uuid[8] & 0xe0) == 0xc0: - return Microsoft - case (uuid[8] & 0xe0) == 0xe0: - return Future - default: - return Reserved - } -} - -// Version returns the version of uuid. -func (uuid UUID) Version() Version { - return Version(uuid[6] >> 4) -} - -func (v Version) String() string { - if v > 15 { - return fmt.Sprintf("BAD_VERSION_%d", v) - } - return fmt.Sprintf("VERSION_%d", v) -} - -func (v Variant) String() string { - switch v { - case RFC4122: - return "RFC4122" - case Reserved: - return "Reserved" - case Microsoft: - return "Microsoft" - case Future: - return "Future" - case Invalid: - return "Invalid" - } - return fmt.Sprintf("BadVariant%d", int(v)) -} - -// SetRand sets the random number generator to r, which implements io.Reader. -// If r.Read returns an error when the package requests random data then -// a panic will be issued. -// -// Calling SetRand with nil sets the random number generator to the default -// generator. -func SetRand(r io.Reader) { - if r == nil { - rander = rand.Reader - return - } - rander = r -} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go deleted file mode 100644 index 199a1ac65..000000000 --- a/vendor/github.com/google/uuid/version1.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" -) - -// NewUUID returns a Version 1 UUID based on the current NodeID and clock -// sequence, and the current time. If the NodeID has not been set by SetNodeID -// or SetNodeInterface then it will be set automatically. If the NodeID cannot -// be set NewUUID returns nil. If clock sequence has not been set by -// SetClockSequence then it will be set automatically. If GetTime fails to -// return the current NewUUID returns nil and an error. -// -// In most cases, New should be used. -func NewUUID() (UUID, error) { - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - nodeMu.Unlock() - - var uuid UUID - now, seq, err := GetTime() - if err != nil { - return uuid, err - } - - timeLow := uint32(now & 0xffffffff) - timeMid := uint16((now >> 32) & 0xffff) - timeHi := uint16((now >> 48) & 0x0fff) - timeHi |= 0x1000 // Version 1 - - binary.BigEndian.PutUint32(uuid[0:], timeLow) - binary.BigEndian.PutUint16(uuid[4:], timeMid) - binary.BigEndian.PutUint16(uuid[6:], timeHi) - binary.BigEndian.PutUint16(uuid[8:], seq) - copy(uuid[10:], nodeID[:]) - - return uuid, nil -} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go deleted file mode 100644 index 84af91c9f..000000000 --- a/vendor/github.com/google/uuid/version4.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "io" - -// New creates a new random UUID or panics. New is equivalent to -// the expression -// -// uuid.Must(uuid.NewRandom()) -func New() UUID { - return Must(NewRandom()) -} - -// NewRandom returns a Random (Version 4) UUID. -// -// The strength of the UUIDs is based on the strength of the crypto/rand -// package. -// -// A note about uniqueness derived from the UUID Wikipedia entry: -// -// Randomly generated UUIDs have 122 random bits. One's annual risk of being -// hit by a meteorite is estimated to be one chance in 17 billion, that -// means the probability is about 0.00000000006 (6 × 10−11), -// equivalent to the odds of creating a few tens of trillions of UUIDs in a -// year and having one duplicate. -func NewRandom() (UUID, error) { - var uuid UUID - _, err := io.ReadFull(rander, uuid[:]) - if err != nil { - return Nil, err - } - uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 - uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 - return uuid, nil -} diff --git a/vendor/github.com/googleapis/gax-go/v2/LICENSE b/vendor/github.com/googleapis/gax-go/v2/LICENSE deleted file mode 100644 index 6d16b6578..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2016, Google Inc. -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * 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/googleapis/gax-go/v2/call_option.go b/vendor/github.com/googleapis/gax-go/v2/call_option.go deleted file mode 100644 index b1d53dd19..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/call_option.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * 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. - -package gax - -import ( - "math/rand" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// CallOption is an option used by Invoke to control behaviors of RPC calls. -// CallOption works by modifying relevant fields of CallSettings. -type CallOption interface { - // Resolve applies the option by modifying cs. - Resolve(cs *CallSettings) -} - -// Retryer is used by Invoke to determine retry behavior. -type Retryer interface { - // Retry reports whether a request should be retriedand how long to pause before retrying - // if the previous attempt returned with err. Invoke never calls Retry with nil error. - Retry(err error) (pause time.Duration, shouldRetry bool) -} - -type retryerOption func() Retryer - -func (o retryerOption) Resolve(s *CallSettings) { - s.Retry = o -} - -// WithRetry sets CallSettings.Retry to fn. -func WithRetry(fn func() Retryer) CallOption { - return retryerOption(fn) -} - -// OnCodes returns a Retryer that retries if and only if -// the previous attempt returns a GRPC error whose error code is stored in cc. -// Pause times between retries are specified by bo. -// -// bo is only used for its parameters; each Retryer has its own copy. -func OnCodes(cc []codes.Code, bo Backoff) Retryer { - return &boRetryer{ - backoff: bo, - codes: append([]codes.Code(nil), cc...), - } -} - -type boRetryer struct { - backoff Backoff - codes []codes.Code -} - -func (r *boRetryer) Retry(err error) (time.Duration, bool) { - st, ok := status.FromError(err) - if !ok { - return 0, false - } - c := st.Code() - for _, rc := range r.codes { - if c == rc { - return r.backoff.Pause(), true - } - } - return 0, false -} - -// Backoff implements exponential backoff. -// The wait time between retries is a random value between 0 and the "retry envelope". -// The envelope starts at Initial and increases by the factor of Multiplier every retry, -// but is capped at Max. -type Backoff struct { - // Initial is the initial value of the retry envelope, defaults to 1 second. - Initial time.Duration - - // Max is the maximum value of the retry envelope, defaults to 30 seconds. - Max time.Duration - - // Multiplier is the factor by which the retry envelope increases. - // It should be greater than 1 and defaults to 2. - Multiplier float64 - - // cur is the current retry envelope - cur time.Duration -} - -// Pause returns the next time.Duration that the caller should use to backoff. -func (bo *Backoff) Pause() time.Duration { - if bo.Initial == 0 { - bo.Initial = time.Second - } - if bo.cur == 0 { - bo.cur = bo.Initial - } - if bo.Max == 0 { - bo.Max = 30 * time.Second - } - if bo.Multiplier < 1 { - bo.Multiplier = 2 - } - // Select a duration between 1ns and the current max. It might seem - // counterintuitive to have so much jitter, but - // https://www.awsarchitectureblog.com/2015/03/backoff.html argues that - // that is the best strategy. - d := time.Duration(1 + rand.Int63n(int64(bo.cur))) - bo.cur = time.Duration(float64(bo.cur) * bo.Multiplier) - if bo.cur > bo.Max { - bo.cur = bo.Max - } - return d -} - -type grpcOpt []grpc.CallOption - -func (o grpcOpt) Resolve(s *CallSettings) { - s.GRPC = o -} - -// WithGRPCOptions allows passing gRPC call options during client creation. -func WithGRPCOptions(opt ...grpc.CallOption) CallOption { - return grpcOpt(append([]grpc.CallOption(nil), opt...)) -} - -// CallSettings allow fine-grained control over how calls are made. -type CallSettings struct { - // Retry returns a Retryer to be used to control retry logic of a method call. - // If Retry is nil or the returned Retryer is nil, the call will not be retried. - Retry func() Retryer - - // CallOptions to be forwarded to GRPC. - GRPC []grpc.CallOption -} diff --git a/vendor/github.com/googleapis/gax-go/v2/gax.go b/vendor/github.com/googleapis/gax-go/v2/gax.go deleted file mode 100644 index 3fd1b0b84..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/gax.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * 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. - -// Package gax contains a set of modules which aid the development of APIs -// for clients and servers based on gRPC and Google API conventions. -// -// Application code will rarely need to use this library directly. -// However, code generated automatically from API definition files can use it -// to simplify code generation and to provide more convenient and idiomatic API surfaces. -package gax - -// Version specifies the gax-go version being used. -const Version = "2.0.4" diff --git a/vendor/github.com/googleapis/gax-go/v2/go.mod b/vendor/github.com/googleapis/gax-go/v2/go.mod deleted file mode 100644 index 9cdfaf447..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/googleapis/gax-go/v2 - -require google.golang.org/grpc v1.19.0 diff --git a/vendor/github.com/googleapis/gax-go/v2/go.sum b/vendor/github.com/googleapis/gax-go/v2/go.sum deleted file mode 100644 index 7fa23ecf9..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/go.sum +++ /dev/null @@ -1,25 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/googleapis/gax-go/v2/header.go b/vendor/github.com/googleapis/gax-go/v2/header.go deleted file mode 100644 index 139371a0b..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/header.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2018, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * 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. - -package gax - -import "bytes" - -// XGoogHeader is for use by the Google Cloud Libraries only. -// -// XGoogHeader formats key-value pairs. -// The resulting string is suitable for x-goog-api-client header. -func XGoogHeader(keyval ...string) string { - if len(keyval) == 0 { - return "" - } - if len(keyval)%2 != 0 { - panic("gax.Header: odd argument count") - } - var buf bytes.Buffer - for i := 0; i < len(keyval); i += 2 { - buf.WriteByte(' ') - buf.WriteString(keyval[i]) - buf.WriteByte('/') - buf.WriteString(keyval[i+1]) - } - return buf.String()[1:] -} diff --git a/vendor/github.com/googleapis/gax-go/v2/invoke.go b/vendor/github.com/googleapis/gax-go/v2/invoke.go deleted file mode 100644 index fe31dd004..000000000 --- a/vendor/github.com/googleapis/gax-go/v2/invoke.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * 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. - -package gax - -import ( - "context" - "strings" - "time" -) - -// APICall is a user defined call stub. -type APICall func(context.Context, CallSettings) error - -// Invoke calls the given APICall, -// performing retries as specified by opts, if any. -func Invoke(ctx context.Context, call APICall, opts ...CallOption) error { - var settings CallSettings - for _, opt := range opts { - opt.Resolve(&settings) - } - return invoke(ctx, call, settings, Sleep) -} - -// Sleep is similar to time.Sleep, but it can be interrupted by ctx.Done() closing. -// If interrupted, Sleep returns ctx.Err(). -func Sleep(ctx context.Context, d time.Duration) error { - t := time.NewTimer(d) - select { - case <-ctx.Done(): - t.Stop() - return ctx.Err() - case <-t.C: - return nil - } -} - -type sleeper func(ctx context.Context, d time.Duration) error - -// invoke implements Invoke, taking an additional sleeper argument for testing. -func invoke(ctx context.Context, call APICall, settings CallSettings, sp sleeper) error { - var retryer Retryer - for { - err := call(ctx, settings) - if err == nil { - return nil - } - if settings.Retry == nil { - return err - } - // Never retry permanent certificate errors. (e.x. if ca-certificates - // are not installed). We should only make very few, targeted - // exceptions: many (other) status=Unavailable should be retried, such - // as if there's a network hiccup, or the internet goes out for a - // minute. This is also why here we are doing string parsing instead of - // simply making Unavailable a non-retried code elsewhere. - if strings.Contains(err.Error(), "x509: certificate signed by unknown authority") { - return err - } - if retryer == nil { - if r := settings.Retry(); r != nil { - retryer = r - } else { - return err - } - } - if d, ok := retryer.Retry(err); !ok { - return err - } else if err = sp(ctx, d); err != nil { - return err - } - } -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/AUTHORS b/vendor/github.com/hanwen/go-fuse/v2/AUTHORS deleted file mode 100644 index 052128d30..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/AUTHORS +++ /dev/null @@ -1,20 +0,0 @@ -Adam H. Leventhal -Daniel Martí -Fazlul Shahriar -Frederick Akalin -Google Inc. -Haitao Li -Jakob Unterwurzacher -James D. Nurmi -Jeff -Kaoet Ibe -Kirill Smelkov -Logan Hanks -Maria Shaldibina -Nick Cooper -Patrick Crosby -Paul Jolly -Paul Warren -Shayan Pooya -Valient Gough -Yongwoo Park diff --git a/vendor/github.com/hanwen/go-fuse/v2/LICENSE b/vendor/github.com/hanwen/go-fuse/v2/LICENSE deleted file mode 100644 index 962771ccf..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -// New BSD License -// -// Copyright (c) 2010 the Go-FUSE 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 Ivan Krasin 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/hanwen/go-fuse/v2/fs/README.md b/vendor/github.com/hanwen/go-fuse/v2/fs/README.md deleted file mode 100644 index 62936acfd..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/README.md +++ /dev/null @@ -1,60 +0,0 @@ - -Objective -========= - -A high-performance FUSE API that minimizes pitfalls with writing -correct filesystems. - -Decisions -========= - - * Nodes contain references to their children. This is useful - because most filesystems will need to construct tree-like - structures. - - * Nodes contain references to their parents. As a result, we can - derive the path for each Inode, and there is no need for a - separate PathFS. - - * Nodes can be "persistent", meaning their lifetime is not under - control of the kernel. This is useful for constructing FS trees - in advance, rather than driven by LOOKUP. - - * The NodeID for FS tree node must be defined on creation and are - immutable. By contrast, reusing NodeIds (eg. rsc/bazil FUSE, as - well as old go-fuse/fuse/nodefs) needs extra synchronization to - avoid races with notify and FORGET, and makes handling the inode - Generation more complicated. - - * The mode of an Inode is defined on creation. Files cannot change - type during their lifetime. This also prevents the common error - of forgetting to return the filetype in Lookup/GetAttr. - - * The NodeID (used for communicating with kernel) is equal to - Attr.Ino (value shown in Stat and Lstat return values.). - - * No global treelock, to ensure scalability. - - * Support for hard links. libfuse doesn't support this in the - high-level API. Extra care for race conditions is needed when - looking up the same file through different paths. - - * do not issue Notify{Entry,Delete} as part of - AddChild/RmChild/MvChild: because NodeIDs are unique and - immutable, there is no confusion about which nodes are - invalidated, and the notification doesn't have to happen under - lock. - - * Directory reading uses the DirStream. Semantics for rewinding - directory reads, and adding files after opening (but before - reading) are handled automatically. No support for directory - seeks. - - * Method names are based on syscall names. Where there is no - syscall (eg. "open directory"), we bias towards writing - everything together (Opendir) - -To do/To decide -========= - - * Symlink []byte vs string. diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/api.go b/vendor/github.com/hanwen/go-fuse/v2/fs/api.go deleted file mode 100644 index 4f4fe92dd..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/api.go +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fs provides infrastructure to build tree-organized filesystems. -// -// Structure of a file system implementation -// -// To create a file system, you should first define types for the -// nodes of the file system tree. -// -// struct myNode { -// fs.Inode -// } -// -// // Node types must be InodeEmbedders -// var _ = (fs.InodeEmbedder)((*myNode)(nil)) -// -// // Node types should implement some file system operations, eg. Lookup -// var _ = (fs.NodeLookuper)((*myNode)(nil)) -// -// func (n *myNode) Lookup(ctx context.Context, name string, ... ) (*Inode, syscall.Errno) { -// ops := myNode{} -// return n.NewInode(ctx, &ops, fs.StableAttr{Mode: syscall.S_IFDIR}), 0 -// } -// -// The method names are inspired on the system call names, so we have -// Listxattr rather than ListXAttr. -// -// the file system is mounted by calling mount on the root of the tree, -// -// server, err := fs.Mount("/tmp/mnt", &myNode{}, &fs.Options{}) -// .. -// // start serving the file system -// server.Wait() -// -// Error handling -// -// All error reporting must use the syscall.Errno type. This is an -// integer with predefined error codes, where the value 0 (`OK`) -// should be used to indicate success. -// -// File system concepts -// -// The FUSE API is very similar to Linux' internal VFS API for -// defining file systems in the kernel. It is therefore useful to -// understand some terminology. -// -// File content: the raw bytes that we store inside regular files. -// -// Path: a /-separated string path that describes location of a node -// in the file system tree. For example -// -// dir1/file -// -// describes path root → dir1 → file. -// -// There can be several paths leading from tree root to a particular node, -// known as hard-linking, for example -// -// root -// / \ -// dir1 dir2 -// \ / -// file -// -// Inode: ("index node") points to the file content, and stores -// metadata (size, timestamps) about a file or directory. Each -// inode has a type (directory, symlink, regular file, etc.) and -// an identity (a 64-bit number, unique to the file -// system). Directories can have children. -// -// The inode in the kernel is represented in Go-FUSE as the Inode -// type. -// -// While common OS APIs are phrased in terms of paths (strings), the -// precise semantics of a file system are better described in terms of -// Inodes. This allows us to specify what happens in corner cases, -// such as writing data to deleted files. -// -// File descriptor: a handle returned to opening a file. File -// descriptors always refer to a single inode. -// -// Dirent: a dirent maps (parent inode number, name string) tuple to -// child inode, thus representing a parent/child relation (or the -// absense thereof). Dirents do not have an equivalent type inside -// Go-FUSE, but the result of Lookup operation essentially is a -// dirent, which the kernel puts in a cache. -// -// -// Kernel caching -// -// The kernel caches several pieces of information from the FUSE process: -// -// 1. File contents: enabled with the fuse.FOPEN_KEEP_CACHE return flag -// in Open, manipulated with ReadCache and WriteCache, and invalidated -// with Inode.NotifyContent -// -// 2. File Attributes (size, mtime, etc.): controlled with the -// attribute timeout fields in fuse.AttrOut and fuse.EntryOut, which -// get be populated from Getattr and Lookup -// -// 3. Directory entries (parent/child relations in the FS tree): -// controlled with the timeout fields in fuse.EntryOut, and -// invalidated with Inode.NotifyEntry and Inode.NotifyDelete. -// -// Without Directory Entry timeouts, every operation on file "a/b/c" -// must first do lookups for "a", "a/b" and "a/b/c", which is -// expensive because of context switches between the kernel and the -// FUSE process. -// -// Unsuccessful entry lookups can also be cached by setting an entry -// timeout when Lookup returns ENOENT. -// -// The libfuse C library specifies 1 second timeouts for both -// attribute and directory entries, but no timeout for negative -// entries. by default. This can be achieve in go-fuse by setting -// options on mount, eg. -// -// sec := time.Second -// opts := fs.Options{ -// EntryTimeout: &sec, -// AttrTimeout: &sec, -// } -// -// Locking -// -// Locks for networked filesystems are supported through the suite of -// Getlk, Setlk and Setlkw methods. They alllow locks on regions of -// regular files. -// -// Parallelism -// -// The VFS layer in the kernel is optimized to be highly parallel, and -// this parallelism also affects FUSE file systems: many FUSE -// operations can run in parallel, and this invites race -// conditions. It is strongly recommended to test your FUSE file -// system issuing file operations in parallel, and using the race -// detector to weed out data races. -// -// Dynamically discovered file systems -// -// File system data usually cannot fit all in RAM, so the kernel must -// discover the file system dynamically: as you are entering and list -// directory contents, the kernel asks the FUSE server about the files -// and directories you are busy reading/writing, and forgets parts of -// your file system when it is low on memory. -// -// The two important operations for dynamic file systems are: -// 1. Lookup, part of the NodeLookuper interface for discovering -// individual children of directories, and 2. Readdir, part of the -// NodeReaddirer interface for listing the contents of a directory. -// -// Static in-memory file systems -// -// For small, read-only file systems, getting the locking mechanics of -// Lookup correct is tedious, so Go-FUSE provides a feature to -// simplify building such file systems. -// -// Instead of discovering the FS tree on the fly, you can construct -// the entire tree from an OnAdd method. Then, that in-memory tree -// structure becomes the source of truth. This means you Go-FUSE must -// remember Inodes even if the kernel is no longer interested in -// them. This is done by instantiating "persistent" inodes from the -// OnAdd method of the root node. See the ZipFS example for a -// runnable example of how to do this. -package fs - -import ( - "context" - "log" - "syscall" - "time" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -// InodeEmbedder is an interface for structs that embed Inode. -// -// InodeEmbedder objects usually should implement some of the NodeXxxx -// interfaces, to provide user-defined file system behaviors. -// -// In general, if an InodeEmbedder does not implement specific -// filesystem methods, the filesystem will react as if it is a -// read-only filesystem with a predefined tree structure. -type InodeEmbedder interface { - // populateInode and inode are used internally to link Inode - // to a Node. - // - // See Inode() for the public API to retrieve an inode from Node. - embed() *Inode - - // EmbeddedInode returns a pointer to the embedded inode. - EmbeddedInode() *Inode -} - -// Statfs implements statistics for the filesystem that holds this -// Inode. If not defined, the `out` argument will zeroed with an OK -// result. This is because OSX filesystems must Statfs, or the mount -// will not work. -type NodeStatfser interface { - Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno -} - -// Access should return if the caller can access the file with the -// given mode. This is used for two purposes: to determine if a user -// may enter a directory, and to answer to implement the access system -// call. In the latter case, the context has data about the real -// UID. For example, a root-SUID binary called by user susan gets the -// UID and GID for susan here. -// -// If not defined, a default implementation will check traditional -// unix permissions of the Getattr result agains the caller. If so, it -// is necessary to either return permissions from GetAttr/Lookup or -// set Options.DefaultPermissions in order to allow chdir into the -// FUSE mount. -type NodeAccesser interface { - Access(ctx context.Context, mask uint32) syscall.Errno -} - -// GetAttr reads attributes for an Inode. The library will ensure that -// Mode and Ino are set correctly. For files that are not opened with -// FOPEN_DIRECTIO, Size should be set so it can be read correctly. If -// returning zeroed permissions, the default behavior is to change the -// mode of 0755 (directory) or 0644 (files). This can be switched off -// with the Options.NullPermissions setting. If blksize is unset, 4096 -// is assumed, and the 'blocks' field is set accordingly. -type NodeGetattrer interface { - Getattr(ctx context.Context, f FileHandle, out *fuse.AttrOut) syscall.Errno -} - -// SetAttr sets attributes for an Inode. -type NodeSetattrer interface { - Setattr(ctx context.Context, f FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno -} - -// OnAdd is called when this InodeEmbedder is initialized. -type NodeOnAdder interface { - OnAdd(ctx context.Context) -} - -// Getxattr should read data for the given attribute into -// `dest` and return the number of bytes. If `dest` is too -// small, it should return ERANGE and the size of the attribute. -// If not defined, Getxattr will return ENOATTR. -type NodeGetxattrer interface { - Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno) -} - -// Setxattr should store data for the given attribute. See -// setxattr(2) for information about flags. -// If not defined, Setxattr will return ENOATTR. -type NodeSetxattrer interface { - Setxattr(ctx context.Context, attr string, data []byte, flags uint32) syscall.Errno -} - -// Removexattr should delete the given attribute. -// If not defined, Removexattr will return ENOATTR. -type NodeRemovexattrer interface { - Removexattr(ctx context.Context, attr string) syscall.Errno -} - -// Listxattr should read all attributes (null terminated) into -// `dest`. If the `dest` buffer is too small, it should return ERANGE -// and the correct size. If not defined, return an empty list and -// success. -type NodeListxattrer interface { - Listxattr(ctx context.Context, dest []byte) (uint32, syscall.Errno) -} - -// Readlink reads the content of a symlink. -type NodeReadlinker interface { - Readlink(ctx context.Context) ([]byte, syscall.Errno) -} - -// Open opens an Inode (of regular file type) for reading. It -// is optional but recommended to return a FileHandle. -type NodeOpener interface { - Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) -} - -// Reads data from a file. The data should be returned as -// ReadResult, which may be constructed from the incoming -// `dest` buffer. If the file was opened without FileHandle, -// the FileHandle argument here is nil. The default -// implementation forwards to the FileHandle. -type NodeReader interface { - Read(ctx context.Context, f FileHandle, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) -} - -// Writes the data into the file handle at given offset. After -// returning, the data will be reused and may not referenced. -// The default implementation forwards to the FileHandle. -type NodeWriter interface { - Write(ctx context.Context, f FileHandle, data []byte, off int64) (written uint32, errno syscall.Errno) -} - -// Fsync is a signal to ensure writes to the Inode are flushed -// to stable storage. -type NodeFsyncer interface { - Fsync(ctx context.Context, f FileHandle, flags uint32) syscall.Errno -} - -// Flush is called for the close(2) call on a file descriptor. In case -// of a descriptor that was duplicated using dup(2), it may be called -// more than once for the same FileHandle. The default implementation -// forwards to the FileHandle, or if the handle does not support -// FileFlusher, returns OK. -type NodeFlusher interface { - Flush(ctx context.Context, f FileHandle) syscall.Errno -} - -// This is called to before a FileHandle is forgotten. The -// kernel ignores the return value of this method, -// so any cleanup that requires specific synchronization or -// could fail with I/O errors should happen in Flush instead. -// The default implementation forwards to the FileHandle. -type NodeReleaser interface { - Release(ctx context.Context, f FileHandle) syscall.Errno -} - -// Allocate preallocates space for future writes, so they will -// never encounter ESPACE. -type NodeAllocater interface { - Allocate(ctx context.Context, f FileHandle, off uint64, size uint64, mode uint32) syscall.Errno -} - -// CopyFileRange copies data between sections of two files, -// without the data having to pass through the calling process. -type NodeCopyFileRanger interface { - CopyFileRange(ctx context.Context, fhIn FileHandle, - offIn uint64, out *Inode, fhOut FileHandle, offOut uint64, - len uint64, flags uint64) (uint32, syscall.Errno) -} - -// Lseek is used to implement holes: it should return the -// first offset beyond `off` where there is data (SEEK_DATA) -// or where there is a hole (SEEK_HOLE). -type NodeLseeker interface { - Lseek(ctx context.Context, f FileHandle, Off uint64, whence uint32) (uint64, syscall.Errno) -} - -// Getlk returns locks that would conflict with the given input -// lock. If no locks conflict, the output has type L_UNLCK. See -// fcntl(2) for more information. -// If not defined, returns ENOTSUP -type NodeGetlker interface { - Getlk(ctx context.Context, f FileHandle, owner uint64, lk *fuse.FileLock, flags uint32, out *fuse.FileLock) syscall.Errno -} - -// Setlk obtains a lock on a file, or fail if the lock could not -// obtained. See fcntl(2) for more information. If not defined, -// returns ENOTSUP -type NodeSetlker interface { - Setlk(ctx context.Context, f FileHandle, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno -} - -// Setlkw obtains a lock on a file, waiting if necessary. See fcntl(2) -// for more information. If not defined, returns ENOTSUP -type NodeSetlkwer interface { - Setlkw(ctx context.Context, f FileHandle, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno -} - -// DirStream lists directory entries. -type DirStream interface { - // HasNext indicates if there are further entries. HasNext - // might be called on already closed streams. - HasNext() bool - - // Next retrieves the next entry. It is only called if HasNext - // has previously returned true. The Errno return may be used to - // indicate I/O errors - Next() (fuse.DirEntry, syscall.Errno) - - // Close releases resources related to this directory - // stream. - Close() -} - -// Lookup should find a direct child of a directory by the child's name. If -// the entry does not exist, it should return ENOENT and optionally -// set a NegativeTimeout in `out`. If it does exist, it should return -// attribute data in `out` and return the Inode for the child. A new -// inode can be created using `Inode.NewInode`. The new Inode will be -// added to the FS tree automatically if the return status is OK. -// -// If a directory does not implement NodeLookuper, the library looks -// for an existing child with the given name. -// -// The input to a Lookup is {parent directory, name string}. -// -// Lookup, if successful, must return an *Inode. Once the Inode is -// returned to the kernel, the kernel can issue further operations, -// such as Open or Getxattr on that node. -// -// A successful Lookup also returns an EntryOut. Among others, this -// contains file attributes (mode, size, mtime, etc.). -// -// FUSE supports other operations that modify the namespace. For -// example, the Symlink, Create, Mknod, Link methods all create new -// children in directories. Hence, they also return *Inode and must -// populate their fuse.EntryOut arguments. - -// -type NodeLookuper interface { - Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) -} - -// OpenDir opens a directory Inode for reading its -// contents. The actual reading is driven from ReadDir, so -// this method is just for performing sanity/permission -// checks. The default is to return success. -type NodeOpendirer interface { - Opendir(ctx context.Context) syscall.Errno -} - -// ReadDir opens a stream of directory entries. -// -// Readdir essentiallly returns a list of strings, and it is allowed -// for Readdir to return different results from Lookup. For example, -// you can return nothing for Readdir ("ls my-fuse-mount" is empty), -// while still implementing Lookup ("ls my-fuse-mount/a-specific-file" -// shows a single file). -// -// If a directory does not implement NodeReaddirer, a list of -// currently known children from the tree is returned. This means that -// static in-memory file systems need not implement NodeReaddirer. -type NodeReaddirer interface { - Readdir(ctx context.Context) (DirStream, syscall.Errno) -} - -// Mkdir is similar to Lookup, but must create a directory entry and Inode. -// Default is to return EROFS. -type NodeMkdirer interface { - Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*Inode, syscall.Errno) -} - -// Mknod is similar to Lookup, but must create a device entry and Inode. -// Default is to return EROFS. -type NodeMknoder interface { - Mknod(ctx context.Context, name string, mode uint32, dev uint32, out *fuse.EntryOut) (*Inode, syscall.Errno) -} - -// Link is similar to Lookup, but must create a new link to an existing Inode. -// Default is to return EROFS. -type NodeLinker interface { - Link(ctx context.Context, target InodeEmbedder, name string, out *fuse.EntryOut) (node *Inode, errno syscall.Errno) -} - -// Symlink is similar to Lookup, but must create a new symbolic link. -// Default is to return EROFS. -type NodeSymlinker interface { - Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (node *Inode, errno syscall.Errno) -} - -// Create is similar to Lookup, but should create a new -// child. It typically also returns a FileHandle as a -// reference for future reads/writes. -// Default is to return EROFS. -type NodeCreater interface { - Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (node *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno) -} - -// Unlink should remove a child from this directory. If the -// return status is OK, the Inode is removed as child in the -// FS tree automatically. Default is to return EROFS. -type NodeUnlinker interface { - Unlink(ctx context.Context, name string) syscall.Errno -} - -// Rmdir is like Unlink but for directories. -// Default is to return EROFS. -type NodeRmdirer interface { - Rmdir(ctx context.Context, name string) syscall.Errno -} - -// Rename should move a child from one directory to a different -// one. The change is effected in the FS tree if the return status is -// OK. Default is to return EROFS. -type NodeRenamer interface { - Rename(ctx context.Context, name string, newParent InodeEmbedder, newName string, flags uint32) syscall.Errno -} - -// FileHandle is a resource identifier for opened files. Usually, a -// FileHandle should implement some of the FileXxxx interfaces. -// -// All of the FileXxxx operations can also be implemented at the -// InodeEmbedder level, for example, one can implement NodeReader -// instead of FileReader. -// -// FileHandles are useful in two cases: First, if the underlying -// storage systems needs a handle for reading/writing. This is the -// case with Unix system calls, which need a file descriptor (See also -// the function `NewLoopbackFile`). Second, it is useful for -// implementing files whose contents are not tied to an inode. For -// example, a file like `/proc/interrupts` has no fixed content, but -// changes on each open call. This means that each file handle must -// have its own view of the content; this view can be tied to a -// FileHandle. Files that have such dynamic content should return the -// FOPEN_DIRECT_IO flag from their `Open` method. See directio_test.go -// for an example. -type FileHandle interface { -} - -// See NodeReleaser. -type FileReleaser interface { - Release(ctx context.Context) syscall.Errno -} - -// See NodeGetattrer. -type FileGetattrer interface { - Getattr(ctx context.Context, out *fuse.AttrOut) syscall.Errno -} - -// See NodeReader. -type FileReader interface { - Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) -} - -// See NodeWriter. -type FileWriter interface { - Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno) -} - -// See NodeGetlker. -type FileGetlker interface { - Getlk(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32, out *fuse.FileLock) syscall.Errno -} - -// See NodeSetlker. -type FileSetlker interface { - Setlk(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno -} - -// See NodeSetlkwer. -type FileSetlkwer interface { - Setlkw(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32) syscall.Errno -} - -// See NodeLseeker. -type FileLseeker interface { - Lseek(ctx context.Context, off uint64, whence uint32) (uint64, syscall.Errno) -} - -// See NodeFlusher. -type FileFlusher interface { - Flush(ctx context.Context) syscall.Errno -} - -// See NodeFsync. -type FileFsyncer interface { - Fsync(ctx context.Context, flags uint32) syscall.Errno -} - -// See NodeFsync. -type FileSetattrer interface { - Setattr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno -} - -// See NodeAllocater. -type FileAllocater interface { - Allocate(ctx context.Context, off uint64, size uint64, mode uint32) syscall.Errno -} - -// Options sets options for the entire filesystem -type Options struct { - // MountOptions contain the options for mounting the fuse server - fuse.MountOptions - - // If set to nonnil, this defines the overall entry timeout - // for the file system. See fuse.EntryOut for more information. - EntryTimeout *time.Duration - - // If set to nonnil, this defines the overall attribute - // timeout for the file system. See fuse.EntryOut for more - // information. - AttrTimeout *time.Duration - - // If set to nonnil, this defines the overall entry timeout - // for failed lookups (fuse.ENOENT). See fuse.EntryOut for - // more information. - NegativeTimeout *time.Duration - - // Automatic inode numbers are handed out sequentially - // starting from this number. If unset, use 2^63. - FirstAutomaticIno uint64 - - // OnAdd is an alternative way to specify the OnAdd - // functionality of the root node. - OnAdd func(ctx context.Context) - - // NullPermissions if set, leaves null file permissions - // alone. Otherwise, they are set to 755 (dirs) or 644 (other - // files.), which is necessary for doing a chdir into the FUSE - // directories. - NullPermissions bool - - // If nonzero, replace default (zero) UID with the given UID - UID uint32 - - // If nonzero, replace default (zero) GID with the given GID - GID uint32 - - // ServerCallbacks can be provided to stub out notification - // functions for testing a filesystem without mounting it. - ServerCallbacks ServerCallbacks - - // Logger is a sink for diagnostic messages. Diagnostic - // messages are printed under conditions where we cannot - // return error, but want to signal something seems off - // anyway. If unset, no messages are printed. - Logger *log.Logger -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/bridge.go b/vendor/github.com/hanwen/go-fuse/v2/fs/bridge.go deleted file mode 100644 index 3e81a8b53..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/bridge.go +++ /dev/null @@ -1,1029 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "log" - "math/rand" - "sync" - "syscall" - "time" - - "github.com/hanwen/go-fuse/v2/fuse" - "github.com/hanwen/go-fuse/v2/internal" -) - -func errnoToStatus(errno syscall.Errno) fuse.Status { - return fuse.Status(errno) -} - -type fileEntry struct { - file FileHandle - - // index into Inode.openFiles - nodeIndex int - - // Protects directory fields. Must be acquired before bridge.mu - mu sync.Mutex - - // Directory - dirStream DirStream - hasOverflow bool - overflow fuse.DirEntry - - wg sync.WaitGroup -} - -// ServerCallbacks are calls into the kernel to manipulate the inode, -// entry and page cache. They are stubbed so filesystems can be -// unittested without mounting them. -type ServerCallbacks interface { - DeleteNotify(parent uint64, child uint64, name string) fuse.Status - EntryNotify(parent uint64, name string) fuse.Status - InodeNotify(node uint64, off int64, length int64) fuse.Status - InodeRetrieveCache(node uint64, offset int64, dest []byte) (n int, st fuse.Status) - InodeNotifyStoreCache(node uint64, offset int64, data []byte) fuse.Status -} - -type rawBridge struct { - options Options - root *Inode - server ServerCallbacks - - // mu protects the following data. Locks for inodes must be - // taken before rawBridge.mu - mu sync.Mutex - nodes map[uint64]*Inode - automaticIno uint64 - - files []*fileEntry - freeFiles []uint32 -} - -// newInode creates creates new inode pointing to ops. -func (b *rawBridge) newInodeUnlocked(ops InodeEmbedder, id StableAttr, persistent bool) *Inode { - b.mu.Lock() - defer b.mu.Unlock() - - if id.Reserved() { - log.Panicf("using reserved ID %d for inode number", id.Ino) - } - - // This ops already was populated. Just return it. - if ops.embed().bridge != nil { - return ops.embed() - } - - if id.Ino == 0 { - for { - id.Ino = b.automaticIno - b.automaticIno++ - _, ok := b.nodes[id.Ino] - if !ok { - break - } - } - } - - // Only the file type bits matter - id.Mode = id.Mode & syscall.S_IFMT - if id.Mode == 0 { - id.Mode = fuse.S_IFREG - } - - // the same node can be looked up through 2 paths in parallel, eg. - // - // root - // / \ - // dir1 dir2 - // \ / - // file - // - // dir1.Lookup("file") and dir2.Lookup("file") are executed - // simultaneously. The matching StableAttrs ensure that we return the - // same node. - var t time.Duration - t0 := time.Now() - for i := 1; true; i++ { - old := b.nodes[id.Ino] - if old == nil { - break - } - if old.stableAttr == id { - return old - } - b.mu.Unlock() - - t = expSleep(t) - if i%5000 == 0 { - b.logf("blocked for %.0f seconds waiting for FORGET on i%d", time.Since(t0).Seconds(), id.Ino) - } - b.mu.Lock() - } - - b.nodes[id.Ino] = ops.embed() - initInode(ops.embed(), ops, id, b, persistent) - return ops.embed() -} - -func (b *rawBridge) logf(format string, args ...interface{}) { - if b.options.Logger != nil { - b.options.Logger.Printf(format, args...) - } -} - -// expSleep sleeps for time `t` and returns an exponentially increasing value -// for the next sleep time, capped at 1 ms. -func expSleep(t time.Duration) time.Duration { - if t == 0 { - return time.Microsecond - } - time.Sleep(t) - // Next sleep is between t and 2*t - t += time.Duration(rand.Int63n(int64(t))) - if t >= time.Millisecond { - return time.Millisecond - } - return t -} - -func (b *rawBridge) newInode(ctx context.Context, ops InodeEmbedder, id StableAttr, persistent bool) *Inode { - ch := b.newInodeUnlocked(ops, id, persistent) - if ch != ops.embed() { - return ch - } - - if oa, ok := ops.(NodeOnAdder); ok { - oa.OnAdd(ctx) - } - return ch -} - -// addNewChild inserts the child into the tree. Returns file handle if file != nil. -func (b *rawBridge) addNewChild(parent *Inode, name string, child *Inode, file FileHandle, fileFlags uint32, out *fuse.EntryOut) uint32 { - if name == "." || name == ".." { - log.Panicf("BUG: tried to add virtual entry %q to the actual tree", name) - } - lockNodes(parent, child) - parent.setEntry(name, child) - b.mu.Lock() - - // Due to concurrent FORGETs, lookupCount may have dropped to zero. - // This means it MAY have been deleted from nodes[] already. Add it back. - if child.lookupCount == 0 { - b.nodes[child.stableAttr.Ino] = child - } - child.lookupCount++ - child.changeCounter++ - - var fh uint32 - if file != nil { - fh = b.registerFile(child, file, fileFlags) - } - - out.NodeId = child.stableAttr.Ino - out.Generation = child.stableAttr.Gen - out.Attr.Ino = child.stableAttr.Ino - - b.mu.Unlock() - unlockNodes(parent, child) - return fh -} - -func (b *rawBridge) setEntryOutTimeout(out *fuse.EntryOut) { - b.setAttr(&out.Attr) - if b.options.AttrTimeout != nil && out.AttrTimeout() == 0 { - out.SetAttrTimeout(*b.options.AttrTimeout) - } - if b.options.EntryTimeout != nil && out.EntryTimeout() == 0 { - out.SetEntryTimeout(*b.options.EntryTimeout) - } -} - -func (b *rawBridge) setAttr(out *fuse.Attr) { - if !b.options.NullPermissions && out.Mode&07777 == 0 { - out.Mode |= 0644 - if out.Mode&syscall.S_IFDIR != 0 { - out.Mode |= 0111 - } - } - if b.options.UID != 0 && out.Uid == 0 { - out.Uid = b.options.UID - } - if b.options.GID != 0 && out.Gid == 0 { - out.Gid = b.options.GID - } - setBlocks(out) -} - -func (b *rawBridge) setAttrTimeout(out *fuse.AttrOut) { - if b.options.AttrTimeout != nil && out.Timeout() == 0 { - out.SetTimeout(*b.options.AttrTimeout) - } -} - -// NewNodeFS creates a node based filesystem based on the -// InodeEmbedder instance for the root of the tree. -func NewNodeFS(root InodeEmbedder, opts *Options) fuse.RawFileSystem { - bridge := &rawBridge{ - automaticIno: opts.FirstAutomaticIno, - server: opts.ServerCallbacks, - } - if bridge.automaticIno == 1 { - bridge.automaticIno++ - } - - if bridge.automaticIno == 0 { - bridge.automaticIno = 1 << 63 - } - - if opts != nil { - bridge.options = *opts - } else { - oneSec := time.Second - bridge.options.EntryTimeout = &oneSec - bridge.options.AttrTimeout = &oneSec - } - - initInode(root.embed(), root, - StableAttr{ - Ino: 1, - Mode: fuse.S_IFDIR, - }, - bridge, - false, - ) - bridge.root = root.embed() - bridge.root.lookupCount = 1 - bridge.nodes = map[uint64]*Inode{ - 1: bridge.root, - } - - // Fh 0 means no file handle. - bridge.files = []*fileEntry{{}} - - if opts.OnAdd != nil { - opts.OnAdd(context.Background()) - } else if oa, ok := root.(NodeOnAdder); ok { - oa.OnAdd(context.Background()) - } - - return bridge -} - -func (b *rawBridge) String() string { - return "rawBridge" -} - -func (b *rawBridge) inode(id uint64, fh uint64) (*Inode, *fileEntry) { - b.mu.Lock() - defer b.mu.Unlock() - n, f := b.nodes[id], b.files[fh] - if n == nil { - log.Panicf("unknown node %d", id) - } - return n, f -} - -func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name string, out *fuse.EntryOut) fuse.Status { - parent, _ := b.inode(header.NodeId, 0) - ctx := &fuse.Context{Caller: header.Caller, Cancel: cancel} - child, errno := b.lookup(ctx, parent, name, out) - - if errno != 0 { - if b.options.NegativeTimeout != nil && out.EntryTimeout() == 0 { - out.SetEntryTimeout(*b.options.NegativeTimeout) - } - return errnoToStatus(errno) - } - - child.setEntryOut(out) - b.addNewChild(parent, name, child, nil, 0, out) - b.setEntryOutTimeout(out) - return fuse.OK -} - -func (b *rawBridge) lookup(ctx *fuse.Context, parent *Inode, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) { - if lu, ok := parent.ops.(NodeLookuper); ok { - return lu.Lookup(ctx, name, out) - } - - child := parent.GetChild(name) - if child == nil { - return nil, syscall.ENOENT - } - - if ga, ok := child.ops.(NodeGetattrer); ok { - var a fuse.AttrOut - errno := ga.Getattr(ctx, nil, &a) - if errno == 0 { - out.Attr = a.Attr - } - } - - return child, OK -} - -func (b *rawBridge) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name string) fuse.Status { - parent, _ := b.inode(header.NodeId, 0) - var errno syscall.Errno - if mops, ok := parent.ops.(NodeRmdirer); ok { - errno = mops.Rmdir(&fuse.Context{Caller: header.Caller, Cancel: cancel}, name) - } - - if errno == 0 { - parent.RmChild(name) - } - return errnoToStatus(errno) -} - -func (b *rawBridge) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name string) fuse.Status { - parent, _ := b.inode(header.NodeId, 0) - var errno syscall.Errno - if mops, ok := parent.ops.(NodeUnlinker); ok { - errno = mops.Unlink(&fuse.Context{Caller: header.Caller, Cancel: cancel}, name) - } - - if errno == 0 { - parent.RmChild(name) - } - return errnoToStatus(errno) -} - -func (b *rawBridge) Mkdir(cancel <-chan struct{}, input *fuse.MkdirIn, name string, out *fuse.EntryOut) fuse.Status { - parent, _ := b.inode(input.NodeId, 0) - - var child *Inode - var errno syscall.Errno - if mops, ok := parent.ops.(NodeMkdirer); ok { - child, errno = mops.Mkdir(&fuse.Context{Caller: input.Caller, Cancel: cancel}, name, input.Mode, out) - } else { - return fuse.ENOTSUP - } - - if errno != 0 { - return errnoToStatus(errno) - } - - if out.Attr.Mode&^07777 == 0 { - out.Attr.Mode |= fuse.S_IFDIR - } - - if out.Attr.Mode&^07777 != fuse.S_IFDIR { - log.Panicf("Mkdir: mode must be S_IFDIR (%o), got %o", fuse.S_IFDIR, out.Attr.Mode) - } - - child.setEntryOut(out) - b.addNewChild(parent, name, child, nil, 0, out) - b.setEntryOutTimeout(out) - return fuse.OK -} - -func (b *rawBridge) Mknod(cancel <-chan struct{}, input *fuse.MknodIn, name string, out *fuse.EntryOut) fuse.Status { - parent, _ := b.inode(input.NodeId, 0) - - var child *Inode - var errno syscall.Errno - if mops, ok := parent.ops.(NodeMknoder); ok { - child, errno = mops.Mknod(&fuse.Context{Caller: input.Caller, Cancel: cancel}, name, input.Mode, input.Rdev, out) - } - - if errno != 0 { - return errnoToStatus(errno) - } - - child.setEntryOut(out) - b.addNewChild(parent, name, child, nil, 0, out) - b.setEntryOutTimeout(out) - return fuse.OK -} - -func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name string, out *fuse.CreateOut) fuse.Status { - ctx := &fuse.Context{Caller: input.Caller, Cancel: cancel} - parent, _ := b.inode(input.NodeId, 0) - - var child *Inode - var errno syscall.Errno - var f FileHandle - var flags uint32 - if mops, ok := parent.ops.(NodeCreater); ok { - child, f, flags, errno = mops.Create(ctx, name, input.Flags, input.Mode, &out.EntryOut) - } else { - return fuse.EROFS - } - - if errno != 0 { - if b.options.NegativeTimeout != nil { - out.SetEntryTimeout(*b.options.NegativeTimeout) - } - return errnoToStatus(errno) - } - - out.Fh = uint64(b.addNewChild(parent, name, child, f, input.Flags|syscall.O_CREAT, &out.EntryOut)) - - out.OpenFlags = flags - - child.setEntryOut(&out.EntryOut) - b.setEntryOutTimeout(&out.EntryOut) - return fuse.OK -} - -func (b *rawBridge) Forget(nodeid, nlookup uint64) { - n, _ := b.inode(nodeid, 0) - n.removeRef(nlookup, false) -} - -func (b *rawBridge) SetDebug(debug bool) {} - -func (b *rawBridge) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *fuse.AttrOut) fuse.Status { - n, fEntry := b.inode(input.NodeId, input.Fh()) - f := fEntry.file - if f == nil { - // The linux kernel doesnt pass along the file - // descriptor, so we have to fake it here. - // See https://github.com/libfuse/libfuse/issues/62 - b.mu.Lock() - for _, fh := range n.openFiles { - f = b.files[fh].file - b.files[fh].wg.Add(1) - defer b.files[fh].wg.Done() - break - } - b.mu.Unlock() - } - ctx := &fuse.Context{Caller: input.Caller, Cancel: cancel} - return errnoToStatus(b.getattr(ctx, n, f, out)) -} - -func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fuse.AttrOut) syscall.Errno { - var errno syscall.Errno - - var fg FileGetattrer - if f != nil { - fg, _ = f.(FileGetattrer) - } - - if fops, ok := n.ops.(NodeGetattrer); ok { - errno = fops.Getattr(ctx, f, out) - } else if fg != nil { - errno = fg.Getattr(ctx, out) - } else { - // We set Mode below, which is the minimum for success - } - - if errno == 0 { - if out.Ino != 0 && n.stableAttr.Ino > 1 && out.Ino != n.stableAttr.Ino { - b.logf("warning: rawBridge.getattr: overriding ino %d with %d", out.Ino, n.stableAttr.Ino) - } - out.Ino = n.stableAttr.Ino - out.Mode = (out.Attr.Mode & 07777) | n.stableAttr.Mode - b.setAttr(&out.Attr) - b.setAttrTimeout(out) - } - return errno -} - -func (b *rawBridge) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status { - ctx := &fuse.Context{Caller: in.Caller, Cancel: cancel} - - fh, _ := in.GetFh() - - n, fEntry := b.inode(in.NodeId, fh) - f := fEntry.file - - var errno = syscall.ENOTSUP - if fops, ok := n.ops.(NodeSetattrer); ok { - errno = fops.Setattr(ctx, f, in, out) - } else if fops, ok := f.(FileSetattrer); ok { - errno = fops.Setattr(ctx, in, out) - } - - out.Mode = n.stableAttr.Mode | (out.Mode & 07777) - return errnoToStatus(errno) -} - -func (b *rawBridge) Rename(cancel <-chan struct{}, input *fuse.RenameIn, oldName string, newName string) fuse.Status { - p1, _ := b.inode(input.NodeId, 0) - p2, _ := b.inode(input.Newdir, 0) - - if mops, ok := p1.ops.(NodeRenamer); ok { - errno := mops.Rename(&fuse.Context{Caller: input.Caller, Cancel: cancel}, oldName, p2.ops, newName, input.Flags) - if errno == 0 { - if input.Flags&RENAME_EXCHANGE != 0 { - p1.ExchangeChild(oldName, p2, newName) - } else { - // MvChild cannot fail with overwrite=true. - _ = p1.MvChild(oldName, p2, newName, true) - } - } - return errnoToStatus(errno) - } - return fuse.ENOTSUP -} - -func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string, out *fuse.EntryOut) fuse.Status { - parent, _ := b.inode(input.NodeId, 0) - target, _ := b.inode(input.Oldnodeid, 0) - - if mops, ok := parent.ops.(NodeLinker); ok { - child, errno := mops.Link(&fuse.Context{Caller: input.Caller, Cancel: cancel}, target.ops, name, out) - if errno != 0 { - return errnoToStatus(errno) - } - - child.setEntryOut(out) - b.addNewChild(parent, name, child, nil, 0, out) - b.setEntryOutTimeout(out) - return fuse.OK - } - return fuse.ENOTSUP -} - -func (b *rawBridge) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, out *fuse.EntryOut) fuse.Status { - parent, _ := b.inode(header.NodeId, 0) - - if mops, ok := parent.ops.(NodeSymlinker); ok { - child, status := mops.Symlink(&fuse.Context{Caller: header.Caller, Cancel: cancel}, target, name, out) - if status != 0 { - return errnoToStatus(status) - } - - b.addNewChild(parent, name, child, nil, 0, out) - child.setEntryOut(out) - b.setEntryOutTimeout(out) - return fuse.OK - } - return fuse.ENOTSUP -} - -func (b *rawBridge) Readlink(cancel <-chan struct{}, header *fuse.InHeader) (out []byte, status fuse.Status) { - n, _ := b.inode(header.NodeId, 0) - - if linker, ok := n.ops.(NodeReadlinker); ok { - result, errno := linker.Readlink(&fuse.Context{Caller: header.Caller, Cancel: cancel}) - if errno != 0 { - return nil, errnoToStatus(errno) - } - - return result, fuse.OK - - } - - return nil, fuse.ENOTSUP -} - -func (b *rawBridge) Access(cancel <-chan struct{}, input *fuse.AccessIn) fuse.Status { - n, _ := b.inode(input.NodeId, 0) - - ctx := &fuse.Context{Caller: input.Caller, Cancel: cancel} - if a, ok := n.ops.(NodeAccesser); ok { - return errnoToStatus(a.Access(ctx, input.Mask)) - } - - // default: check attributes. - caller := input.Caller - - var out fuse.AttrOut - if s := b.getattr(ctx, n, nil, &out); s != 0 { - return errnoToStatus(s) - } - - if !internal.HasAccess(caller.Uid, caller.Gid, out.Uid, out.Gid, out.Mode, input.Mask) { - return fuse.EACCES - } - return fuse.OK -} - -// Extended attributes. - -func (b *rawBridge) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, data []byte) (uint32, fuse.Status) { - n, _ := b.inode(header.NodeId, 0) - - if xops, ok := n.ops.(NodeGetxattrer); ok { - nb, errno := xops.Getxattr(&fuse.Context{Caller: header.Caller, Cancel: cancel}, attr, data) - return nb, errnoToStatus(errno) - } - - return 0, fuse.ENOATTR -} - -func (b *rawBridge) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []byte) (sz uint32, status fuse.Status) { - n, _ := b.inode(header.NodeId, 0) - if xops, ok := n.ops.(NodeListxattrer); ok { - sz, errno := xops.Listxattr(&fuse.Context{Caller: header.Caller, Cancel: cancel}, dest) - return sz, errnoToStatus(errno) - } - return 0, fuse.OK -} - -func (b *rawBridge) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr string, data []byte) fuse.Status { - n, _ := b.inode(input.NodeId, 0) - if xops, ok := n.ops.(NodeSetxattrer); ok { - return errnoToStatus(xops.Setxattr(&fuse.Context{Caller: input.Caller, Cancel: cancel}, attr, data, input.Flags)) - } - return fuse.ENOATTR -} - -func (b *rawBridge) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string) fuse.Status { - n, _ := b.inode(header.NodeId, 0) - if xops, ok := n.ops.(NodeRemovexattrer); ok { - return errnoToStatus(xops.Removexattr(&fuse.Context{Caller: header.Caller, Cancel: cancel}, attr)) - } - return fuse.ENOATTR -} - -func (b *rawBridge) Open(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.OpenOut) fuse.Status { - n, _ := b.inode(input.NodeId, 0) - - if op, ok := n.ops.(NodeOpener); ok { - f, flags, errno := op.Open(&fuse.Context{Caller: input.Caller, Cancel: cancel}, input.Flags) - if errno != 0 { - return errnoToStatus(errno) - } - - if f != nil { - b.mu.Lock() - defer b.mu.Unlock() - out.Fh = uint64(b.registerFile(n, f, input.Flags)) - } - out.OpenFlags = flags - return fuse.OK - } - - return fuse.ENOTSUP -} - -// registerFile hands out a file handle. Must have bridge.mu -func (b *rawBridge) registerFile(n *Inode, f FileHandle, flags uint32) uint32 { - var fh uint32 - if len(b.freeFiles) > 0 { - last := len(b.freeFiles) - 1 - fh = b.freeFiles[last] - b.freeFiles = b.freeFiles[:last] - } else { - fh = uint32(len(b.files)) - b.files = append(b.files, &fileEntry{}) - } - - fileEntry := b.files[fh] - fileEntry.nodeIndex = len(n.openFiles) - fileEntry.file = f - - n.openFiles = append(n.openFiles, fh) - return fh -} - -func (b *rawBridge) Read(cancel <-chan struct{}, input *fuse.ReadIn, buf []byte) (fuse.ReadResult, fuse.Status) { - n, f := b.inode(input.NodeId, input.Fh) - - if fops, ok := n.ops.(NodeReader); ok { - res, errno := fops.Read(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, buf, int64(input.Offset)) - return res, errnoToStatus(errno) - } - if fr, ok := f.file.(FileReader); ok { - res, errno := fr.Read(&fuse.Context{Caller: input.Caller, Cancel: cancel}, buf, int64(input.Offset)) - return res, errnoToStatus(errno) - } - - return nil, fuse.ENOTSUP -} - -func (b *rawBridge) GetLk(cancel <-chan struct{}, input *fuse.LkIn, out *fuse.LkOut) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - - if lops, ok := n.ops.(NodeGetlker); ok { - return errnoToStatus(lops.Getlk(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, input.Owner, &input.Lk, input.LkFlags, &out.Lk)) - } - if gl, ok := f.file.(FileGetlker); ok { - return errnoToStatus(gl.Getlk(&fuse.Context{Caller: input.Caller, Cancel: cancel}, input.Owner, &input.Lk, input.LkFlags, &out.Lk)) - } - return fuse.ENOTSUP -} - -func (b *rawBridge) SetLk(cancel <-chan struct{}, input *fuse.LkIn) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - if lops, ok := n.ops.(NodeSetlker); ok { - return errnoToStatus(lops.Setlk(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, input.Owner, &input.Lk, input.LkFlags)) - } - if sl, ok := n.ops.(FileSetlker); ok { - return errnoToStatus(sl.Setlk(&fuse.Context{Caller: input.Caller, Cancel: cancel}, input.Owner, &input.Lk, input.LkFlags)) - } - return fuse.ENOTSUP -} -func (b *rawBridge) SetLkw(cancel <-chan struct{}, input *fuse.LkIn) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - if lops, ok := n.ops.(NodeSetlkwer); ok { - return errnoToStatus(lops.Setlkw(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, input.Owner, &input.Lk, input.LkFlags)) - } - if sl, ok := n.ops.(FileSetlkwer); ok { - return errnoToStatus(sl.Setlkw(&fuse.Context{Caller: input.Caller, Cancel: cancel}, input.Owner, &input.Lk, input.LkFlags)) - } - return fuse.ENOTSUP -} - -func (b *rawBridge) Release(cancel <-chan struct{}, input *fuse.ReleaseIn) { - n, f := b.releaseFileEntry(input.NodeId, input.Fh) - if f == nil { - return - } - - f.wg.Wait() - - if r, ok := n.ops.(NodeReleaser); ok { - r.Release(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file) - } else if r, ok := f.file.(FileReleaser); ok { - r.Release(&fuse.Context{Caller: input.Caller, Cancel: cancel}) - } - - b.mu.Lock() - defer b.mu.Unlock() - b.freeFiles = append(b.freeFiles, uint32(input.Fh)) -} - -func (b *rawBridge) ReleaseDir(input *fuse.ReleaseIn) { - _, f := b.releaseFileEntry(input.NodeId, input.Fh) - f.wg.Wait() - - f.mu.Lock() - if f.dirStream != nil { - f.dirStream.Close() - f.dirStream = nil - } - f.mu.Unlock() - - b.mu.Lock() - defer b.mu.Unlock() - b.freeFiles = append(b.freeFiles, uint32(input.Fh)) -} - -func (b *rawBridge) releaseFileEntry(nid uint64, fh uint64) (*Inode, *fileEntry) { - b.mu.Lock() - defer b.mu.Unlock() - - n := b.nodes[nid] - var entry *fileEntry - if fh > 0 { - last := len(n.openFiles) - 1 - entry = b.files[fh] - if last != entry.nodeIndex { - n.openFiles[entry.nodeIndex] = n.openFiles[last] - - b.files[n.openFiles[entry.nodeIndex]].nodeIndex = entry.nodeIndex - } - n.openFiles = n.openFiles[:last] - } - return n, entry -} - -func (b *rawBridge) Write(cancel <-chan struct{}, input *fuse.WriteIn, data []byte) (written uint32, status fuse.Status) { - n, f := b.inode(input.NodeId, input.Fh) - - if wr, ok := n.ops.(NodeWriter); ok { - w, errno := wr.Write(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, data, int64(input.Offset)) - return w, errnoToStatus(errno) - } - if fr, ok := f.file.(FileWriter); ok { - w, errno := fr.Write(&fuse.Context{Caller: input.Caller, Cancel: cancel}, data, int64(input.Offset)) - return w, errnoToStatus(errno) - } - - return 0, fuse.ENOTSUP -} - -func (b *rawBridge) Flush(cancel <-chan struct{}, input *fuse.FlushIn) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - if fl, ok := n.ops.(NodeFlusher); ok { - return errnoToStatus(fl.Flush(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file)) - } - if fl, ok := f.file.(FileFlusher); ok { - return errnoToStatus(fl.Flush(&fuse.Context{Caller: input.Caller, Cancel: cancel})) - } - return 0 -} - -func (b *rawBridge) Fsync(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - if fs, ok := n.ops.(NodeFsyncer); ok { - return errnoToStatus(fs.Fsync(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, input.FsyncFlags)) - } - if fs, ok := f.file.(FileFsyncer); ok { - return errnoToStatus(fs.Fsync(&fuse.Context{Caller: input.Caller, Cancel: cancel}, input.FsyncFlags)) - } - return fuse.ENOTSUP -} - -func (b *rawBridge) Fallocate(cancel <-chan struct{}, input *fuse.FallocateIn) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - if a, ok := n.ops.(NodeAllocater); ok { - return errnoToStatus(a.Allocate(&fuse.Context{Caller: input.Caller, Cancel: cancel}, f.file, input.Offset, input.Length, input.Mode)) - } - if a, ok := f.file.(FileAllocater); ok { - return errnoToStatus(a.Allocate(&fuse.Context{Caller: input.Caller, Cancel: cancel}, input.Offset, input.Length, input.Mode)) - } - return fuse.ENOTSUP -} - -func (b *rawBridge) OpenDir(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.OpenOut) fuse.Status { - n, _ := b.inode(input.NodeId, 0) - - if od, ok := n.ops.(NodeOpendirer); ok { - errno := od.Opendir(&fuse.Context{Caller: input.Caller, Cancel: cancel}) - if errno != 0 { - return errnoToStatus(errno) - } - } - - b.mu.Lock() - defer b.mu.Unlock() - out.Fh = uint64(b.registerFile(n, nil, 0)) - return fuse.OK -} - -// setStream sets the directory part of f. Must hold f.mu -func (b *rawBridge) setStream(cancel <-chan struct{}, input *fuse.ReadIn, inode *Inode, f *fileEntry) syscall.Errno { - if f.dirStream == nil || input.Offset == 0 { - if f.dirStream != nil { - f.dirStream.Close() - f.dirStream = nil - } - str, errno := b.getStream(&fuse.Context{Caller: input.Caller, Cancel: cancel}, inode) - if errno != 0 { - return errno - } - - f.hasOverflow = false - f.dirStream = str - } - - return 0 -} - -func (b *rawBridge) getStream(ctx context.Context, inode *Inode) (DirStream, syscall.Errno) { - if rd, ok := inode.ops.(NodeReaddirer); ok { - return rd.Readdir(ctx) - } - - r := []fuse.DirEntry{} - for k, ch := range inode.Children() { - r = append(r, fuse.DirEntry{Mode: ch.Mode(), - Name: k, - Ino: ch.StableAttr().Ino}) - } - return NewListDirStream(r), 0 -} - -func (b *rawBridge) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - - f.mu.Lock() - defer f.mu.Unlock() - if errno := b.setStream(cancel, input, n, f); errno != 0 { - return errnoToStatus(errno) - } - - if f.hasOverflow { - // always succeeds. - out.AddDirEntry(f.overflow) - f.hasOverflow = false - } - - for f.dirStream.HasNext() { - e, errno := f.dirStream.Next() - - if errno != 0 { - return errnoToStatus(errno) - } - if !out.AddDirEntry(e) { - f.overflow = e - f.hasOverflow = true - return errnoToStatus(errno) - } - } - - return fuse.OK -} - -func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) fuse.Status { - n, f := b.inode(input.NodeId, input.Fh) - - f.mu.Lock() - defer f.mu.Unlock() - if errno := b.setStream(cancel, input, n, f); errno != 0 { - return errnoToStatus(errno) - } - - ctx := &fuse.Context{Caller: input.Caller, Cancel: cancel} - for f.dirStream.HasNext() || f.hasOverflow { - var e fuse.DirEntry - var errno syscall.Errno - - if f.hasOverflow { - e = f.overflow - f.hasOverflow = false - } else { - e, errno = f.dirStream.Next() - } - - if errno != 0 { - return errnoToStatus(errno) - } - - entryOut := out.AddDirLookupEntry(e) - if entryOut == nil { - f.overflow = e - f.hasOverflow = true - return fuse.OK - } - - // Virtual entries "." and ".." should be part of the - // directory listing, but not part of the filesystem tree. - // The values in EntryOut are ignored by Linux - // (see fuse_direntplus_link() in linux/fs/fuse/readdir.c), so leave - // them at zero-value. - if e.Name == "." || e.Name == ".." { - continue - } - - child, errno := b.lookup(ctx, n, e.Name, entryOut) - if errno != 0 { - if b.options.NegativeTimeout != nil { - entryOut.SetEntryTimeout(*b.options.NegativeTimeout) - } - } else { - b.addNewChild(n, e.Name, child, nil, 0, entryOut) - child.setEntryOut(entryOut) - b.setEntryOutTimeout(entryOut) - if e.Mode&syscall.S_IFMT != child.stableAttr.Mode&syscall.S_IFMT { - // The file type has changed behind our back. Use the new value. - out.FixMode(child.stableAttr.Mode) - } - entryOut.Mode = child.stableAttr.Mode | (entryOut.Mode & 07777) - } - } - - return fuse.OK -} - -func (b *rawBridge) FsyncDir(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.Status { - n, _ := b.inode(input.NodeId, input.Fh) - if fs, ok := n.ops.(NodeFsyncer); ok { - return errnoToStatus(fs.Fsync(&fuse.Context{Caller: input.Caller, Cancel: cancel}, nil, input.FsyncFlags)) - } - - return fuse.ENOTSUP -} - -func (b *rawBridge) StatFs(cancel <-chan struct{}, input *fuse.InHeader, out *fuse.StatfsOut) fuse.Status { - n, _ := b.inode(input.NodeId, 0) - if sf, ok := n.ops.(NodeStatfser); ok { - return errnoToStatus(sf.Statfs(&fuse.Context{Caller: input.Caller, Cancel: cancel}, out)) - } - - // leave zeroed out - return fuse.OK -} - -func (b *rawBridge) Init(s *fuse.Server) { - b.server = s -} - -func (b *rawBridge) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn) (size uint32, status fuse.Status) { - n1, f1 := b.inode(in.NodeId, in.FhIn) - cfr, ok := n1.ops.(NodeCopyFileRanger) - if !ok { - return 0, fuse.ENOTSUP - } - - n2, f2 := b.inode(in.NodeIdOut, in.FhOut) - - sz, errno := cfr.CopyFileRange(&fuse.Context{Caller: in.Caller, Cancel: cancel}, - f1.file, in.OffIn, n2, f2.file, in.OffOut, in.Len, in.Flags) - return sz, errnoToStatus(errno) -} - -func (b *rawBridge) Lseek(cancel <-chan struct{}, in *fuse.LseekIn, out *fuse.LseekOut) fuse.Status { - n, f := b.inode(in.NodeId, in.Fh) - - ls, ok := n.ops.(NodeLseeker) - if ok { - off, errno := ls.Lseek(&fuse.Context{Caller: in.Caller, Cancel: cancel}, - f.file, in.Offset, in.Whence) - out.Offset = off - return errnoToStatus(errno) - } - if fs, ok := f.file.(FileLseeker); ok { - off, errno := fs.Lseek(&fuse.Context{Caller: in.Caller, Cancel: cancel}, in.Offset, in.Whence) - out.Offset = off - return errnoToStatus(errno) - } - - if in.Whence == _SEEK_DATA || in.Whence == _SEEK_HOLE { - out.Offset = in.Offset - return fuse.OK - } - - return fuse.ENOTSUP -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/constants.go b/vendor/github.com/hanwen/go-fuse/v2/fs/constants.go deleted file mode 100644 index a382f2134..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/constants.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "syscall" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -// OK is the Errno return value to indicate absense of errors. -var OK = syscall.Errno(0) - -// ToErrno exhumes the syscall.Errno error from wrapped error values. -func ToErrno(err error) syscall.Errno { - s := fuse.ToStatus(err) - return syscall.Errno(s) -} - -// RENAME_EXCHANGE is a flag argument for renameat2() -const RENAME_EXCHANGE = 0x2 - -// seek to the next data -const _SEEK_DATA = 3 - -// seek to the next hole -const _SEEK_HOLE = 4 diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/constants_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fs/constants_darwin.go deleted file mode 100644 index ece0eeb0d..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/constants_darwin.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import "syscall" - -// ENOATTR indicates that an extended attribute was not present. -var ENOATTR = syscall.ENOATTR diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/constants_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fs/constants_linux.go deleted file mode 100644 index 15fecc4a2..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/constants_linux.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import "syscall" - -// ENOATTR indicates that an extended attribute was not present. -var ENOATTR = syscall.ENODATA diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/default.go b/vendor/github.com/hanwen/go-fuse/v2/fs/default.go deleted file mode 100644 index e2f7a67c2..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/default.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream.go b/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream.go deleted file mode 100644 index 363aef6ab..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "syscall" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -type dirArray struct { - entries []fuse.DirEntry -} - -func (a *dirArray) HasNext() bool { - return len(a.entries) > 0 -} - -func (a *dirArray) Next() (fuse.DirEntry, syscall.Errno) { - e := a.entries[0] - a.entries = a.entries[1:] - return e, 0 -} - -func (a *dirArray) Close() { - -} - -// NewListDirStream wraps a slice of DirEntry as a DirStream. -func NewListDirStream(list []fuse.DirEntry) DirStream { - return &dirArray{list} -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_darwin.go deleted file mode 100644 index c71029474..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_darwin.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "io" - "os" - "syscall" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -func NewLoopbackDirStream(nm string) (DirStream, syscall.Errno) { - f, err := os.Open(nm) - if err != nil { - return nil, ToErrno(err) - } - defer f.Close() - - var entries []fuse.DirEntry - for { - want := 100 - infos, err := f.Readdir(want) - for _, info := range infos { - s := fuse.ToStatT(info) - if s == nil { - continue - } - - entries = append(entries, fuse.DirEntry{ - Name: info.Name(), - Mode: uint32(s.Mode), - Ino: s.Ino, - }) - } - if len(infos) < want || err == io.EOF { - break - } - - if err != nil { - return nil, ToErrno(err) - } - } - - return &dirArray{entries}, OK -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_linux.go deleted file mode 100644 index 236a780ad..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/dirstream_linux.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "sync" - "syscall" - "unsafe" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -type loopbackDirStream struct { - buf []byte - todo []byte - - // Protects fd so we can guard against double close - mu sync.Mutex - fd int -} - -// NewLoopbackDirStream open a directory for reading as a DirStream -func NewLoopbackDirStream(name string) (DirStream, syscall.Errno) { - fd, err := syscall.Open(name, syscall.O_DIRECTORY, 0755) - if err != nil { - return nil, ToErrno(err) - } - - ds := &loopbackDirStream{ - buf: make([]byte, 4096), - fd: fd, - } - - if err := ds.load(); err != 0 { - ds.Close() - return nil, err - } - return ds, OK -} - -func (ds *loopbackDirStream) Close() { - ds.mu.Lock() - defer ds.mu.Unlock() - if ds.fd != -1 { - syscall.Close(ds.fd) - ds.fd = -1 - } -} - -func (ds *loopbackDirStream) HasNext() bool { - ds.mu.Lock() - defer ds.mu.Unlock() - return len(ds.todo) > 0 -} - -func (ds *loopbackDirStream) Next() (fuse.DirEntry, syscall.Errno) { - ds.mu.Lock() - defer ds.mu.Unlock() - de := (*syscall.Dirent)(unsafe.Pointer(&ds.todo[0])) - - nameBytes := ds.todo[unsafe.Offsetof(syscall.Dirent{}.Name):de.Reclen] - ds.todo = ds.todo[de.Reclen:] - - // After the loop, l contains the index of the first '\0'. - l := 0 - for l = range nameBytes { - if nameBytes[l] == 0 { - break - } - } - nameBytes = nameBytes[:l] - result := fuse.DirEntry{ - Ino: de.Ino, - Mode: (uint32(de.Type) << 12), - Name: string(nameBytes), - } - return result, ds.load() -} - -func (ds *loopbackDirStream) load() syscall.Errno { - if len(ds.todo) > 0 { - return OK - } - - n, err := syscall.Getdents(ds.fd, ds.buf) - if err != nil { - return ToErrno(err) - } - ds.todo = ds.buf[:n] - return OK -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/files.go b/vendor/github.com/hanwen/go-fuse/v2/fs/files.go deleted file mode 100644 index 67304a9e2..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/files.go +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "sync" - - // "time" - - "syscall" - - "github.com/hanwen/go-fuse/v2/fuse" - "golang.org/x/sys/unix" -) - -// NewLoopbackFile creates a FileHandle out of a file descriptor. All -// operations are implemented. -func NewLoopbackFile(fd int) FileHandle { - return &loopbackFile{fd: fd} -} - -type loopbackFile struct { - mu sync.Mutex - fd int -} - -var _ = (FileHandle)((*loopbackFile)(nil)) -var _ = (FileReleaser)((*loopbackFile)(nil)) -var _ = (FileGetattrer)((*loopbackFile)(nil)) -var _ = (FileReader)((*loopbackFile)(nil)) -var _ = (FileWriter)((*loopbackFile)(nil)) -var _ = (FileGetlker)((*loopbackFile)(nil)) -var _ = (FileSetlker)((*loopbackFile)(nil)) -var _ = (FileSetlkwer)((*loopbackFile)(nil)) -var _ = (FileLseeker)((*loopbackFile)(nil)) -var _ = (FileFlusher)((*loopbackFile)(nil)) -var _ = (FileFsyncer)((*loopbackFile)(nil)) -var _ = (FileSetattrer)((*loopbackFile)(nil)) -var _ = (FileAllocater)((*loopbackFile)(nil)) - -func (f *loopbackFile) Read(ctx context.Context, buf []byte, off int64) (res fuse.ReadResult, errno syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - r := fuse.ReadResultFd(uintptr(f.fd), off, len(buf)) - return r, OK -} - -func (f *loopbackFile) Write(ctx context.Context, data []byte, off int64) (uint32, syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - n, err := syscall.Pwrite(f.fd, data, off) - return uint32(n), ToErrno(err) -} - -func (f *loopbackFile) Release(ctx context.Context) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - if f.fd != -1 { - err := syscall.Close(f.fd) - f.fd = -1 - return ToErrno(err) - } - return syscall.EBADF -} - -func (f *loopbackFile) Flush(ctx context.Context) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - // Since Flush() may be called for each dup'd fd, we don't - // want to really close the file, we just want to flush. This - // is achieved by closing a dup'd fd. - newFd, err := syscall.Dup(f.fd) - - if err != nil { - return ToErrno(err) - } - err = syscall.Close(newFd) - return ToErrno(err) -} - -func (f *loopbackFile) Fsync(ctx context.Context, flags uint32) (errno syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - r := ToErrno(syscall.Fsync(f.fd)) - - return r -} - -const ( - _OFD_GETLK = 36 - _OFD_SETLK = 37 - _OFD_SETLKW = 38 -) - -func (f *loopbackFile) Getlk(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32, out *fuse.FileLock) (errno syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - flk := syscall.Flock_t{} - lk.ToFlockT(&flk) - errno = ToErrno(syscall.FcntlFlock(uintptr(f.fd), _OFD_GETLK, &flk)) - out.FromFlockT(&flk) - return -} - -func (f *loopbackFile) Setlk(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32) (errno syscall.Errno) { - return f.setLock(ctx, owner, lk, flags, false) -} - -func (f *loopbackFile) Setlkw(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32) (errno syscall.Errno) { - return f.setLock(ctx, owner, lk, flags, true) -} - -func (f *loopbackFile) setLock(ctx context.Context, owner uint64, lk *fuse.FileLock, flags uint32, blocking bool) (errno syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - if (flags & fuse.FUSE_LK_FLOCK) != 0 { - var op int - switch lk.Typ { - case syscall.F_RDLCK: - op = syscall.LOCK_SH - case syscall.F_WRLCK: - op = syscall.LOCK_EX - case syscall.F_UNLCK: - op = syscall.LOCK_UN - default: - return syscall.EINVAL - } - if !blocking { - op |= syscall.LOCK_NB - } - return ToErrno(syscall.Flock(f.fd, op)) - } else { - flk := syscall.Flock_t{} - lk.ToFlockT(&flk) - var op int - if blocking { - op = _OFD_SETLKW - } else { - op = _OFD_SETLK - } - return ToErrno(syscall.FcntlFlock(uintptr(f.fd), op, &flk)) - } -} - -func (f *loopbackFile) Setattr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno { - if errno := f.setAttr(ctx, in); errno != 0 { - return errno - } - - return f.Getattr(ctx, out) -} - -func (f *loopbackFile) setAttr(ctx context.Context, in *fuse.SetAttrIn) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - var errno syscall.Errno - if mode, ok := in.GetMode(); ok { - errno = ToErrno(syscall.Fchmod(f.fd, mode)) - if errno != 0 { - return errno - } - } - - uid32, uOk := in.GetUID() - gid32, gOk := in.GetGID() - if uOk || gOk { - uid := -1 - gid := -1 - - if uOk { - uid = int(uid32) - } - if gOk { - gid = int(gid32) - } - errno = ToErrno(syscall.Fchown(f.fd, uid, gid)) - if errno != 0 { - return errno - } - } - - mtime, mok := in.GetMTime() - atime, aok := in.GetATime() - - if mok || aok { - ap := &atime - mp := &mtime - if !aok { - ap = nil - } - if !mok { - mp = nil - } - errno = f.utimens(ap, mp) - if errno != 0 { - return errno - } - } - - if sz, ok := in.GetSize(); ok { - errno = ToErrno(syscall.Ftruncate(f.fd, int64(sz))) - if errno != 0 { - return errno - } - } - return OK -} - -func (f *loopbackFile) Getattr(ctx context.Context, a *fuse.AttrOut) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - st := syscall.Stat_t{} - err := syscall.Fstat(f.fd, &st) - if err != nil { - return ToErrno(err) - } - a.FromStat(&st) - - return OK -} - -func (f *loopbackFile) Lseek(ctx context.Context, off uint64, whence uint32) (uint64, syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - n, err := unix.Seek(f.fd, int64(off), int(whence)) - return uint64(n), ToErrno(err) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/files_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fs/files_darwin.go deleted file mode 100644 index bc232efc8..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/files_darwin.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import "github.com/hanwen/go-fuse/v2/fuse" - -func setBlocks(out *fuse.Attr) { -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/files_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fs/files_linux.go deleted file mode 100644 index a52379f9d..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/files_linux.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "syscall" - "time" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -func (f *loopbackFile) Allocate(ctx context.Context, off uint64, sz uint64, mode uint32) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - err := syscall.Fallocate(f.fd, mode, int64(off), int64(sz)) - if err != nil { - return ToErrno(err) - } - return OK -} - -// Utimens - file handle based version of loopbackFileSystem.Utimens() -func (f *loopbackFile) utimens(a *time.Time, m *time.Time) syscall.Errno { - var ts [2]syscall.Timespec - ts[0] = fuse.UtimeToTimespec(a) - ts[1] = fuse.UtimeToTimespec(m) - err := futimens(int(f.fd), &ts) - return ToErrno(err) -} - -func setBlocks(out *fuse.Attr) { - if out.Blksize > 0 { - return - } - - out.Blksize = 4096 - pages := (out.Size + 4095) / 4096 - out.Blocks = pages * 8 -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/inode.go b/vendor/github.com/hanwen/go-fuse/v2/fs/inode.go deleted file mode 100644 index 2a6b3f329..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/inode.go +++ /dev/null @@ -1,744 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "fmt" - "log" - "math/rand" - "sort" - "strings" - "sync" - "syscall" - "unsafe" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -type parentData struct { - name string - parent *Inode -} - -// StableAttr holds immutable attributes of a object in the filesystem. -type StableAttr struct { - // Each Inode has a type, which does not change over the - // lifetime of the inode, for example fuse.S_IFDIR. The default (0) - // is interpreted as S_IFREG (regular file). - Mode uint32 - - // The inode number must be unique among the currently live - // objects in the file system. It is used to communicate to - // the kernel about this file object. The values uint64(-1), - // and 1 are reserved. When using Ino==0, a unique, sequential - // number is assigned (starting at 2^63 by default) on Inode creation. - Ino uint64 - - // When reusing a previously used inode number for a new - // object, the new object must have a different Gen - // number. This is irrelevant if the FS is not exported over - // NFS - Gen uint64 -} - -// Reserved returns if the StableAttr is using reserved Inode numbers. -func (i *StableAttr) Reserved() bool { - return i.Ino == 1 || i.Ino == ^uint64(0) -} - -// Inode is a node in VFS tree. Inodes are one-to-one mapped to -// Operations instances, which is the extension interface for file -// systems. One can create fully-formed trees of Inodes ahead of time -// by creating "persistent" Inodes. -// -// The Inode struct contains a lock, so it should not be -// copied. Inodes should be obtained by calling Inode.NewInode() or -// Inode.NewPersistentInode(). -type Inode struct { - stableAttr StableAttr - - ops InodeEmbedder - bridge *rawBridge - - // Following data is mutable. - - // file handles. - // protected by bridge.mu - openFiles []uint32 - - // mu protects the following mutable fields. When locking - // multiple Inodes, locks must be acquired using - // lockNodes/unlockNodes - mu sync.Mutex - - // persistent indicates that this node should not be removed - // from the tree, even if there are no live references. This - // must be set on creation, and can only be changed to false - // by calling removeRef. - // When you change this, you MUST increment changeCounter. - persistent bool - - // changeCounter increments every time the mutable state - // (lookupCount, persistent, children, parents) protected by - // mu is modified. - // - // This is used in places where we have to relock inode into inode - // group lock, and after locking the group we have to check if inode - // did not changed, and if it changed - retry the operation. - changeCounter uint32 - - // Number of kernel refs to this node. - // When you change this, you MUST increment changeCounter. - lookupCount uint64 - - // Children of this Inode. - // When you change this, you MUST increment changeCounter. - children map[string]*Inode - - // Parents of this Inode. Can be more than one due to hard links. - // When you change this, you MUST increment changeCounter. - parents map[parentData]struct{} -} - -func (n *Inode) IsDir() bool { - return n.stableAttr.Mode&syscall.S_IFDIR != 0 -} - -func (n *Inode) embed() *Inode { - return n -} - -func (n *Inode) EmbeddedInode() *Inode { - return n -} - -func initInode(n *Inode, ops InodeEmbedder, attr StableAttr, bridge *rawBridge, persistent bool) { - n.ops = ops - n.stableAttr = attr - n.bridge = bridge - n.persistent = persistent - n.parents = make(map[parentData]struct{}) - if attr.Mode == fuse.S_IFDIR { - n.children = make(map[string]*Inode) - } -} - -// Set node ID and mode in EntryOut -func (n *Inode) setEntryOut(out *fuse.EntryOut) { - out.NodeId = n.stableAttr.Ino - out.Ino = n.stableAttr.Ino - out.Mode = (out.Attr.Mode & 07777) | n.stableAttr.Mode -} - -// StableAttr returns the (Ino, Gen) tuple for this node. -func (n *Inode) StableAttr() StableAttr { - return n.stableAttr -} - -// Mode returns the filetype -func (n *Inode) Mode() uint32 { - return n.stableAttr.Mode -} - -// Returns the root of the tree -func (n *Inode) Root() *Inode { - return n.bridge.root -} - -// Returns whether this is the root of the tree -func (n *Inode) IsRoot() bool { - return n.bridge.root == n -} - -func modeStr(m uint32) string { - return map[uint32]string{ - syscall.S_IFREG: "reg", - syscall.S_IFLNK: "lnk", - syscall.S_IFDIR: "dir", - syscall.S_IFSOCK: "soc", - syscall.S_IFIFO: "pip", - syscall.S_IFCHR: "chr", - syscall.S_IFBLK: "blk", - }[m] -} - -// debugString is used for debugging. Racy. -func (n *Inode) String() string { - n.mu.Lock() - defer n.mu.Unlock() - var ss []string - for nm, ch := range n.children { - ss = append(ss, fmt.Sprintf("%q=i%d[%s]", nm, ch.stableAttr.Ino, modeStr(ch.stableAttr.Mode))) - } - - return fmt.Sprintf("i%d (%s): %s", n.stableAttr.Ino, modeStr(n.stableAttr.Mode), strings.Join(ss, ",")) -} - -// sortNodes rearranges inode group in consistent order. -// -// The nodes are ordered by their in-RAM address, which gives consistency -// property: for any A and B inodes, sortNodes will either always order A < B, -// or always order A > B. -// -// See lockNodes where this property is used to avoid deadlock when taking -// locks on inode group. -func sortNodes(ns []*Inode) { - sort.Slice(ns, func(i, j int) bool { - return nodeLess(ns[i], ns[j]) - }) -} - -func nodeLess(a, b *Inode) bool { - return uintptr(unsafe.Pointer(a)) < uintptr(unsafe.Pointer(b)) -} - -// lockNodes locks group of inodes. -// -// It always lock the inodes in the same order - to avoid deadlocks. -// It also avoids locking an inode more than once, if it was specified multiple times. -// An example when an inode might be given multiple times is if dir/a and dir/b -// are hardlinked to the same inode and the caller needs to take locks on dir children. -func lockNodes(ns ...*Inode) { - sortNodes(ns) - - // The default value nil prevents trying to lock nil nodes. - var nprev *Inode - for _, n := range ns { - if n != nprev { - n.mu.Lock() - nprev = n - } - } -} - -// lockNode2 locks a and b in order consistent with lockNodes. -func lockNode2(a, b *Inode) { - if a == b { - a.mu.Lock() - } else if nodeLess(a, b) { - a.mu.Lock() - b.mu.Lock() - } else { - b.mu.Lock() - a.mu.Lock() - } -} - -// unlockNode2 unlocks a and b -func unlockNode2(a, b *Inode) { - if a == b { - a.mu.Unlock() - } else { - a.mu.Unlock() - b.mu.Unlock() - } -} - -// unlockNodes releases locks taken by lockNodes. -func unlockNodes(ns ...*Inode) { - // we don't need to unlock in the same order that was used in lockNodes. - // however it still helps to have nodes sorted to avoid duplicates. - sortNodes(ns) - - var nprev *Inode - for _, n := range ns { - if n != nprev { - n.mu.Unlock() - nprev = n - } - } -} - -// Forgotten returns true if the kernel holds no references to this -// inode. This can be used for background cleanup tasks, since the -// kernel has no way of reviving forgotten nodes by its own -// initiative. -func (n *Inode) Forgotten() bool { - n.mu.Lock() - defer n.mu.Unlock() - return n.lookupCount == 0 && len(n.parents) == 0 && !n.persistent -} - -// Operations returns the object implementing the file system -// operations. -func (n *Inode) Operations() InodeEmbedder { - return n.ops -} - -// Path returns a path string to the inode relative to `root`. -// Pass nil to walk the hierarchy as far up as possible. -// -// If you set `root`, Path() warns if it finds an orphaned Inode, i.e. -// if it does not end up at `root` after walking the hierarchy. -func (n *Inode) Path(root *Inode) string { - var segments []string - p := n - for p != nil && p != root { - var pd parentData - - // We don't try to take all locks at the same time, because - // the caller won't use the "path" string under lock anyway. - found := false - p.mu.Lock() - // Select an arbitrary parent - for pd = range p.parents { - found = true - break - } - p.mu.Unlock() - if found == false { - p = nil - break - } - if pd.parent == nil { - break - } - - segments = append(segments, pd.name) - p = pd.parent - } - - if root != nil && root != p { - deletedPlaceholder := fmt.Sprintf(".go-fuse.%d/deleted", rand.Uint64()) - n.bridge.logf("warning: Inode.Path: inode i%d is orphaned, replacing segment with %q", - n.stableAttr.Ino, deletedPlaceholder) - // NOSUBMIT - should replace rather than append? - segments = append(segments, deletedPlaceholder) - } - - i := 0 - j := len(segments) - 1 - - for i < j { - segments[i], segments[j] = segments[j], segments[i] - i++ - j-- - } - - path := strings.Join(segments, "/") - return path -} - -// setEntry does `iparent[name] = ichild` linking. -// -// setEntry must not be called simultaneously for any of iparent or ichild. -// This, for example could be satisfied if both iparent and ichild are locked, -// but it could be also valid if only iparent is locked and ichild was just -// created and only one goroutine keeps referencing it. -func (iparent *Inode) setEntry(name string, ichild *Inode) { - ichild.parents[parentData{name, iparent}] = struct{}{} - iparent.children[name] = ichild - ichild.changeCounter++ - iparent.changeCounter++ -} - -// NewPersistentInode returns an Inode whose lifetime is not in -// control of the kernel. -// -// When the kernel is short on memory, it will forget cached file -// system information (directory entries and inode metadata). This is -// announced with FORGET messages. There are no guarantees if or when -// this happens. When it happens, these are handled transparently by -// go-fuse: all Inodes created with NewInode are released -// automatically. NewPersistentInode creates inodes that go-fuse keeps -// in memory, even if the kernel is not interested in them. This is -// convenient for building static trees up-front. -func (n *Inode) NewPersistentInode(ctx context.Context, node InodeEmbedder, id StableAttr) *Inode { - return n.newInode(ctx, node, id, true) -} - -// ForgetPersistent manually marks the node as no longer important. If -// it has no children, and if the kernel as no references, the nodes -// gets removed from the tree. -func (n *Inode) ForgetPersistent() { - n.removeRef(0, true) -} - -// NewInode returns an inode for the given InodeEmbedder. The mode -// should be standard mode argument (eg. S_IFDIR). The inode number in -// id.Ino argument is used to implement hard-links. If it is given, -// and another node with the same ID is known, that will node will be -// returned, and the passed-in `node` is ignored. -func (n *Inode) NewInode(ctx context.Context, node InodeEmbedder, id StableAttr) *Inode { - return n.newInode(ctx, node, id, false) -} - -func (n *Inode) newInode(ctx context.Context, ops InodeEmbedder, id StableAttr, persistent bool) *Inode { - return n.bridge.newInode(ctx, ops, id, persistent) -} - -// removeRef decreases references. Returns if this operation caused -// the node to be forgotten (for kernel references), and whether it is -// live (ie. was not dropped from the tree) -func (n *Inode) removeRef(nlookup uint64, dropPersistence bool) (forgotten bool, live bool) { - var lockme []*Inode - var parents []parentData - - n.mu.Lock() - if nlookup > 0 && dropPersistence { - log.Panic("only one allowed") - } else if nlookup > 0 { - - n.lookupCount -= nlookup - n.changeCounter++ - } else if dropPersistence && n.persistent { - n.persistent = false - n.changeCounter++ - } - -retry: - for { - lockme = append(lockme[:0], n) - parents = parents[:0] - nChange := n.changeCounter - live = n.lookupCount > 0 || len(n.children) > 0 || n.persistent - forgotten = n.lookupCount == 0 - for p := range n.parents { - parents = append(parents, p) - lockme = append(lockme, p.parent) - } - n.mu.Unlock() - - if live { - return forgotten, live - } - - lockNodes(lockme...) - if n.changeCounter != nChange { - unlockNodes(lockme...) - // could avoid unlocking and relocking n here. - n.mu.Lock() - continue retry - } - - for _, p := range parents { - delete(p.parent.children, p.name) - p.parent.changeCounter++ - } - n.parents = map[parentData]struct{}{} - n.changeCounter++ - - if n.lookupCount != 0 { - panic("lookupCount changed") - } - - n.bridge.mu.Lock() - delete(n.bridge.nodes, n.stableAttr.Ino) - n.bridge.mu.Unlock() - - unlockNodes(lockme...) - break - } - - for _, p := range lockme { - if p != n { - p.removeRef(0, false) - } - } - return forgotten, false -} - -// GetChild returns a child node with the given name, or nil if the -// directory has no child by that name. -func (n *Inode) GetChild(name string) *Inode { - n.mu.Lock() - defer n.mu.Unlock() - return n.children[name] -} - -// AddChild adds a child to this node. If overwrite is false, fail if -// the destination already exists. -func (n *Inode) AddChild(name string, ch *Inode, overwrite bool) (success bool) { - if len(name) == 0 { - log.Panic("empty name for inode") - } - -retry: - for { - lockNode2(n, ch) - prev, ok := n.children[name] - parentCounter := n.changeCounter - if !ok { - n.children[name] = ch - ch.parents[parentData{name, n}] = struct{}{} - n.changeCounter++ - ch.changeCounter++ - unlockNode2(n, ch) - return true - } - unlockNode2(n, ch) - if !overwrite { - return false - } - lockme := [3]*Inode{n, ch, prev} - - lockNodes(lockme[:]...) - if parentCounter != n.changeCounter { - unlockNodes(lockme[:]...) - continue retry - } - - delete(prev.parents, parentData{name, n}) - n.children[name] = ch - ch.parents[parentData{name, n}] = struct{}{} - n.changeCounter++ - ch.changeCounter++ - prev.changeCounter++ - unlockNodes(lockme[:]...) - - return true - } -} - -// Children returns the list of children of this directory Inode. -func (n *Inode) Children() map[string]*Inode { - n.mu.Lock() - defer n.mu.Unlock() - r := make(map[string]*Inode, len(n.children)) - for k, v := range n.children { - r[k] = v - } - return r -} - -// Parents returns a parent of this Inode, or nil if this Inode is -// deleted or is the root -func (n *Inode) Parent() (string, *Inode) { - n.mu.Lock() - defer n.mu.Unlock() - for k := range n.parents { - return k.name, k.parent - } - return "", nil -} - -// RmAllChildren recursively drops a tree, forgetting all persistent -// nodes. -func (n *Inode) RmAllChildren() { - for { - chs := n.Children() - if len(chs) == 0 { - break - } - for nm, ch := range chs { - ch.RmAllChildren() - n.RmChild(nm) - } - } - n.removeRef(0, true) -} - -// RmChild removes multiple children. Returns whether the removal -// succeeded and whether the node is still live afterward. The removal -// is transactional: it only succeeds if all names are children, and -// if they all were removed successfully. If the removal was -// successful, and there are no children left, the node may be removed -// from the FS tree. In that case, RmChild returns live==false. -func (n *Inode) RmChild(names ...string) (success, live bool) { - var lockme []*Inode - -retry: - for { - n.mu.Lock() - lockme = append(lockme[:0], n) - nChange := n.changeCounter - for _, nm := range names { - ch := n.children[nm] - if ch == nil { - n.mu.Unlock() - return false, true - } - lockme = append(lockme, ch) - } - n.mu.Unlock() - - lockNodes(lockme...) - if n.changeCounter != nChange { - unlockNodes(lockme...) - // could avoid unlocking and relocking n here. - n.mu.Lock() - continue retry - } - - for _, nm := range names { - ch := n.children[nm] - delete(n.children, nm) - delete(ch.parents, parentData{nm, n}) - - ch.changeCounter++ - } - n.changeCounter++ - - live = n.lookupCount > 0 || len(n.children) > 0 || n.persistent - unlockNodes(lockme...) - - // removal successful - break - } - - if !live { - _, live := n.removeRef(0, false) - return true, live - } - - return true, true -} - -// MvChild executes a rename. If overwrite is set, a child at the -// destination will be overwritten, should it exist. It returns false -// if 'overwrite' is false, and the destination exists. -func (n *Inode) MvChild(old string, newParent *Inode, newName string, overwrite bool) bool { - if len(newName) == 0 { - log.Panicf("empty newName for MvChild") - } - -retry: - for { - lockNode2(n, newParent) - counter1 := n.changeCounter - counter2 := newParent.changeCounter - - oldChild := n.children[old] - destChild := newParent.children[newName] - unlockNode2(n, newParent) - - if destChild != nil && !overwrite { - return false - } - - lockNodes(n, newParent, oldChild, destChild) - if counter2 != newParent.changeCounter || counter1 != n.changeCounter { - unlockNodes(n, newParent, oldChild, destChild) - continue retry - } - - if oldChild != nil { - delete(n.children, old) - delete(oldChild.parents, parentData{old, n}) - n.changeCounter++ - oldChild.changeCounter++ - } - - if destChild != nil { - // This can cause the child to be slated for - // removal; see below - delete(newParent.children, newName) - delete(destChild.parents, parentData{newName, newParent}) - destChild.changeCounter++ - newParent.changeCounter++ - } - - if oldChild != nil { - newParent.children[newName] = oldChild - newParent.changeCounter++ - - oldChild.parents[parentData{newName, newParent}] = struct{}{} - oldChild.changeCounter++ - } - - unlockNodes(n, newParent, oldChild, destChild) - - if destChild != nil { - destChild.removeRef(0, false) - } - return true - } -} - -// ExchangeChild swaps the entries at (n, oldName) and (newParent, -// newName). -func (n *Inode) ExchangeChild(oldName string, newParent *Inode, newName string) { - oldParent := n -retry: - for { - lockNode2(oldParent, newParent) - counter1 := oldParent.changeCounter - counter2 := newParent.changeCounter - - oldChild := oldParent.children[oldName] - destChild := newParent.children[newName] - unlockNode2(oldParent, newParent) - - if destChild == oldChild { - return - } - - lockNodes(oldParent, newParent, oldChild, destChild) - if counter2 != newParent.changeCounter || counter1 != oldParent.changeCounter { - unlockNodes(oldParent, newParent, oldChild, destChild) - continue retry - } - - // Detach - if oldChild != nil { - delete(oldParent.children, oldName) - delete(oldChild.parents, parentData{oldName, oldParent}) - oldParent.changeCounter++ - oldChild.changeCounter++ - } - - if destChild != nil { - delete(newParent.children, newName) - delete(destChild.parents, parentData{newName, newParent}) - destChild.changeCounter++ - newParent.changeCounter++ - } - - // Attach - if oldChild != nil { - newParent.children[newName] = oldChild - newParent.changeCounter++ - - oldChild.parents[parentData{newName, newParent}] = struct{}{} - oldChild.changeCounter++ - } - - if destChild != nil { - oldParent.children[oldName] = oldChild - oldParent.changeCounter++ - - destChild.parents[parentData{oldName, oldParent}] = struct{}{} - destChild.changeCounter++ - } - unlockNodes(oldParent, newParent, oldChild, destChild) - return - } -} - -// NotifyEntry notifies the kernel that data for a (directory, name) -// tuple should be invalidated. On next access, a LOOKUP operation -// will be started. -func (n *Inode) NotifyEntry(name string) syscall.Errno { - status := n.bridge.server.EntryNotify(n.stableAttr.Ino, name) - return syscall.Errno(status) -} - -// NotifyDelete notifies the kernel that the given inode was removed -// from this directory as entry under the given name. It is equivalent -// to NotifyEntry, but also sends an event to inotify watchers. -func (n *Inode) NotifyDelete(name string, child *Inode) syscall.Errno { - // XXX arg ordering? - return syscall.Errno(n.bridge.server.DeleteNotify(n.stableAttr.Ino, child.stableAttr.Ino, name)) - -} - -// NotifyContent notifies the kernel that content under the given -// inode should be flushed from buffers. -func (n *Inode) NotifyContent(off, sz int64) syscall.Errno { - // XXX how does this work for directories? - return syscall.Errno(n.bridge.server.InodeNotify(n.stableAttr.Ino, off, sz)) -} - -// WriteCache stores data in the kernel cache. -func (n *Inode) WriteCache(offset int64, data []byte) syscall.Errno { - return syscall.Errno(n.bridge.server.InodeNotifyStoreCache(n.stableAttr.Ino, offset, data)) -} - -// ReadCache reads data from the kernel cache. -func (n *Inode) ReadCache(offset int64, dest []byte) (count int, errno syscall.Errno) { - c, s := n.bridge.server.InodeRetrieveCache(n.stableAttr.Ino, offset, dest) - return c, syscall.Errno(s) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/loopback.go b/vendor/github.com/hanwen/go-fuse/v2/fs/loopback.go deleted file mode 100644 index 2cf607cbc..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/loopback.go +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "os" - "path/filepath" - "syscall" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -type loopbackRoot struct { - loopbackNode - - rootPath string - rootDev uint64 -} - -type loopbackNode struct { - Inode -} - -var _ = (NodeStatfser)((*loopbackNode)(nil)) -var _ = (NodeStatfser)((*loopbackNode)(nil)) -var _ = (NodeGetattrer)((*loopbackNode)(nil)) -var _ = (NodeGetxattrer)((*loopbackNode)(nil)) -var _ = (NodeSetxattrer)((*loopbackNode)(nil)) -var _ = (NodeRemovexattrer)((*loopbackNode)(nil)) -var _ = (NodeListxattrer)((*loopbackNode)(nil)) -var _ = (NodeReadlinker)((*loopbackNode)(nil)) -var _ = (NodeOpener)((*loopbackNode)(nil)) -var _ = (NodeCopyFileRanger)((*loopbackNode)(nil)) -var _ = (NodeLookuper)((*loopbackNode)(nil)) -var _ = (NodeOpendirer)((*loopbackNode)(nil)) -var _ = (NodeReaddirer)((*loopbackNode)(nil)) -var _ = (NodeMkdirer)((*loopbackNode)(nil)) -var _ = (NodeMknoder)((*loopbackNode)(nil)) -var _ = (NodeLinker)((*loopbackNode)(nil)) -var _ = (NodeSymlinker)((*loopbackNode)(nil)) -var _ = (NodeUnlinker)((*loopbackNode)(nil)) -var _ = (NodeRmdirer)((*loopbackNode)(nil)) -var _ = (NodeRenamer)((*loopbackNode)(nil)) - -func (n *loopbackNode) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno { - s := syscall.Statfs_t{} - err := syscall.Statfs(n.path(), &s) - if err != nil { - return ToErrno(err) - } - out.FromStatfsT(&s) - return OK -} - -func (r *loopbackRoot) Getattr(ctx context.Context, f FileHandle, out *fuse.AttrOut) syscall.Errno { - st := syscall.Stat_t{} - err := syscall.Stat(r.rootPath, &st) - if err != nil { - return ToErrno(err) - } - out.FromStat(&st) - return OK -} - -func (n *loopbackNode) root() *loopbackRoot { - return n.Root().Operations().(*loopbackRoot) -} - -func (n *loopbackNode) path() string { - path := n.Path(n.Root()) - return filepath.Join(n.root().rootPath, path) -} - -func (n *loopbackNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) { - p := filepath.Join(n.path(), name) - - st := syscall.Stat_t{} - err := syscall.Lstat(p, &st) - if err != nil { - return nil, ToErrno(err) - } - - out.Attr.FromStat(&st) - node := &loopbackNode{} - ch := n.NewInode(ctx, node, n.root().idFromStat(&st)) - return ch, 0 -} - -// preserveOwner sets uid and gid of `path` according to the caller information -// in `ctx`. -func (n *loopbackNode) preserveOwner(ctx context.Context, path string) error { - if os.Getuid() != 0 { - return nil - } - caller, ok := fuse.FromContext(ctx) - if !ok { - return nil - } - return syscall.Lchown(path, int(caller.Uid), int(caller.Gid)) -} - -func (n *loopbackNode) Mknod(ctx context.Context, name string, mode, rdev uint32, out *fuse.EntryOut) (*Inode, syscall.Errno) { - p := filepath.Join(n.path(), name) - err := syscall.Mknod(p, mode, int(rdev)) - if err != nil { - return nil, ToErrno(err) - } - n.preserveOwner(ctx, p) - st := syscall.Stat_t{} - if err := syscall.Lstat(p, &st); err != nil { - syscall.Rmdir(p) - return nil, ToErrno(err) - } - - out.Attr.FromStat(&st) - - node := &loopbackNode{} - ch := n.NewInode(ctx, node, n.root().idFromStat(&st)) - - return ch, 0 -} - -func (n *loopbackNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*Inode, syscall.Errno) { - p := filepath.Join(n.path(), name) - err := os.Mkdir(p, os.FileMode(mode)) - if err != nil { - return nil, ToErrno(err) - } - n.preserveOwner(ctx, p) - st := syscall.Stat_t{} - if err := syscall.Lstat(p, &st); err != nil { - syscall.Rmdir(p) - return nil, ToErrno(err) - } - - out.Attr.FromStat(&st) - - node := &loopbackNode{} - ch := n.NewInode(ctx, node, n.root().idFromStat(&st)) - - return ch, 0 -} - -func (n *loopbackNode) Rmdir(ctx context.Context, name string) syscall.Errno { - p := filepath.Join(n.path(), name) - err := syscall.Rmdir(p) - return ToErrno(err) -} - -func (n *loopbackNode) Unlink(ctx context.Context, name string) syscall.Errno { - p := filepath.Join(n.path(), name) - err := syscall.Unlink(p) - return ToErrno(err) -} - -func toLoopbackNode(op InodeEmbedder) *loopbackNode { - if r, ok := op.(*loopbackRoot); ok { - return &r.loopbackNode - } - return op.(*loopbackNode) -} - -func (n *loopbackNode) Rename(ctx context.Context, name string, newParent InodeEmbedder, newName string, flags uint32) syscall.Errno { - newParentLoopback := toLoopbackNode(newParent) - if flags&RENAME_EXCHANGE != 0 { - return n.renameExchange(name, newParentLoopback, newName) - } - - p1 := filepath.Join(n.path(), name) - p2 := filepath.Join(newParentLoopback.path(), newName) - - err := syscall.Rename(p1, p2) - return ToErrno(err) -} - -func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) StableAttr { - // We compose an inode number by the underlying inode, and - // mixing in the device number. In traditional filesystems, - // the inode numbers are small. The device numbers are also - // small (typically 16 bit). Finally, we mask out the root - // device number of the root, so a loopback FS that does not - // encompass multiple mounts will reflect the inode numbers of - // the underlying filesystem - swapped := (uint64(st.Dev) << 32) | (uint64(st.Dev) >> 32) - swappedRootDev := (r.rootDev << 32) | (r.rootDev >> 32) - return StableAttr{ - Mode: uint32(st.Mode), - Gen: 1, - // This should work well for traditional backing FSes, - // not so much for other go-fuse FS-es - Ino: (swapped ^ swappedRootDev) ^ st.Ino, - } -} - -var _ = (NodeCreater)((*loopbackNode)(nil)) - -func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (inode *Inode, fh FileHandle, fuseFlags uint32, errno syscall.Errno) { - p := filepath.Join(n.path(), name) - flags = flags &^ syscall.O_APPEND - fd, err := syscall.Open(p, int(flags)|os.O_CREATE, mode) - if err != nil { - return nil, nil, 0, ToErrno(err) - } - n.preserveOwner(ctx, p) - st := syscall.Stat_t{} - if err := syscall.Fstat(fd, &st); err != nil { - syscall.Close(fd) - return nil, nil, 0, ToErrno(err) - } - - node := &loopbackNode{} - ch := n.NewInode(ctx, node, n.root().idFromStat(&st)) - lf := NewLoopbackFile(fd) - - out.FromStat(&st) - return ch, lf, 0, 0 -} - -func (n *loopbackNode) Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) { - p := filepath.Join(n.path(), name) - err := syscall.Symlink(target, p) - if err != nil { - return nil, ToErrno(err) - } - n.preserveOwner(ctx, p) - st := syscall.Stat_t{} - if err := syscall.Lstat(p, &st); err != nil { - syscall.Unlink(p) - return nil, ToErrno(err) - } - node := &loopbackNode{} - ch := n.NewInode(ctx, node, n.root().idFromStat(&st)) - - out.Attr.FromStat(&st) - return ch, 0 -} - -func (n *loopbackNode) Link(ctx context.Context, target InodeEmbedder, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) { - - p := filepath.Join(n.path(), name) - targetNode := toLoopbackNode(target) - err := syscall.Link(targetNode.path(), p) - if err != nil { - return nil, ToErrno(err) - } - st := syscall.Stat_t{} - if err := syscall.Lstat(p, &st); err != nil { - syscall.Unlink(p) - return nil, ToErrno(err) - } - node := &loopbackNode{} - ch := n.NewInode(ctx, node, n.root().idFromStat(&st)) - - out.Attr.FromStat(&st) - return ch, 0 -} - -func (n *loopbackNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) { - p := n.path() - - for l := 256; ; l *= 2 { - buf := make([]byte, l) - sz, err := syscall.Readlink(p, buf) - if err != nil { - return nil, ToErrno(err) - } - - if sz < len(buf) { - return buf[:sz], 0 - } - } -} - -func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) { - flags = flags &^ syscall.O_APPEND - p := n.path() - f, err := syscall.Open(p, int(flags), 0) - if err != nil { - return nil, 0, ToErrno(err) - } - lf := NewLoopbackFile(f) - return lf, 0, 0 -} - -func (n *loopbackNode) Opendir(ctx context.Context) syscall.Errno { - fd, err := syscall.Open(n.path(), syscall.O_DIRECTORY, 0755) - if err != nil { - return ToErrno(err) - } - syscall.Close(fd) - return OK -} - -func (n *loopbackNode) Readdir(ctx context.Context) (DirStream, syscall.Errno) { - return NewLoopbackDirStream(n.path()) -} - -func (n *loopbackNode) Getattr(ctx context.Context, f FileHandle, out *fuse.AttrOut) syscall.Errno { - if f != nil { - return f.(FileGetattrer).Getattr(ctx, out) - } - p := n.path() - - var err error - st := syscall.Stat_t{} - err = syscall.Lstat(p, &st) - if err != nil { - return ToErrno(err) - } - out.FromStat(&st) - return OK -} - -var _ = (NodeSetattrer)((*loopbackNode)(nil)) - -func (n *loopbackNode) Setattr(ctx context.Context, f FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno { - p := n.path() - fsa, ok := f.(FileSetattrer) - if ok && fsa != nil { - fsa.Setattr(ctx, in, out) - } else { - if m, ok := in.GetMode(); ok { - if err := syscall.Chmod(p, m); err != nil { - return ToErrno(err) - } - } - - uid, uok := in.GetUID() - gid, gok := in.GetGID() - if uok || gok { - suid := -1 - sgid := -1 - if uok { - suid = int(uid) - } - if gok { - sgid = int(gid) - } - if err := syscall.Chown(p, suid, sgid); err != nil { - return ToErrno(err) - } - } - - mtime, mok := in.GetMTime() - atime, aok := in.GetATime() - - if mok || aok { - - ap := &atime - mp := &mtime - if !aok { - ap = nil - } - if !mok { - mp = nil - } - var ts [2]syscall.Timespec - ts[0] = fuse.UtimeToTimespec(ap) - ts[1] = fuse.UtimeToTimespec(mp) - - if err := syscall.UtimesNano(p, ts[:]); err != nil { - return ToErrno(err) - } - } - - if sz, ok := in.GetSize(); ok { - if err := syscall.Truncate(p, int64(sz)); err != nil { - return ToErrno(err) - } - } - } - - fga, ok := f.(FileGetattrer) - if ok && fga != nil { - fga.Getattr(ctx, out) - } else { - st := syscall.Stat_t{} - err := syscall.Lstat(p, &st) - if err != nil { - return ToErrno(err) - } - out.FromStat(&st) - } - return OK -} - -// NewLoopbackRoot returns a root node for a loopback file system whose -// root is at the given root. This node implements all NodeXxxxer -// operations available. -func NewLoopbackRoot(root string) (InodeEmbedder, error) { - var st syscall.Stat_t - err := syscall.Stat(root, &st) - if err != nil { - return nil, err - } - - n := &loopbackRoot{ - rootPath: root, - rootDev: uint64(st.Dev), - } - return n, nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/loopback_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fs/loopback_darwin.go deleted file mode 100644 index 40eabee09..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/loopback_darwin.go +++ /dev/null @@ -1,118 +0,0 @@ -// +build darwin - -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "syscall" - "time" - "unsafe" - - "github.com/hanwen/go-fuse/v2/fuse" - "github.com/hanwen/go-fuse/v2/internal/utimens" -) - -func (n *loopbackNode) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno) { - return 0, syscall.ENOSYS -} - -func (n *loopbackNode) Setxattr(ctx context.Context, attr string, data []byte, flags uint32) syscall.Errno { - return syscall.ENOSYS -} - -func (n *loopbackNode) Removexattr(ctx context.Context, attr string) syscall.Errno { - return syscall.ENOSYS -} - -func (n *loopbackNode) Listxattr(ctx context.Context, dest []byte) (uint32, syscall.Errno) { - return 0, syscall.ENOSYS -} - -func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newName string) syscall.Errno { - return syscall.ENOSYS -} - -func (f *loopbackFile) Allocate(ctx context.Context, off uint64, sz uint64, mode uint32) syscall.Errno { - // TODO: Handle `mode` parameter. - - // From `man fcntl` on OSX: - // The F_PREALLOCATE command operates on the following structure: - // - // typedef struct fstore { - // u_int32_t fst_flags; /* IN: flags word */ - // int fst_posmode; /* IN: indicates offset field */ - // off_t fst_offset; /* IN: start of the region */ - // off_t fst_length; /* IN: size of the region */ - // off_t fst_bytesalloc; /* OUT: number of bytes allocated */ - // } fstore_t; - // - // The flags (fst_flags) for the F_PREALLOCATE command are as follows: - // - // F_ALLOCATECONTIG Allocate contiguous space. - // - // F_ALLOCATEALL Allocate all requested space or no space at all. - // - // The position modes (fst_posmode) for the F_PREALLOCATE command indicate how to use the offset field. The modes are as fol- - // lows: - // - // F_PEOFPOSMODE Allocate from the physical end of file. - // - // F_VOLPOSMODE Allocate from the volume offset. - - k := struct { - Flags uint32 // u_int32_t - Posmode int64 // int - Offset int64 // off_t - Length int64 // off_t - Bytesalloc int64 // off_t - }{ - 0, - 0, - int64(off), - int64(sz), - 0, - } - - // Linux version for reference: - // err := syscall.Fallocate(int(f.File.Fd()), mode, int64(off), int64(sz)) - _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, uintptr(f.fd), uintptr(syscall.F_PREALLOCATE), uintptr(unsafe.Pointer(&k))) - - return errno -} - -// timeToTimeval - Convert time.Time to syscall.Timeval -// -// Note: This does not use syscall.NsecToTimespec because -// that does not work properly for times before 1970, -// see https://github.com/golang/go/issues/12777 -func timeToTimeval(t *time.Time) syscall.Timeval { - var tv syscall.Timeval - tv.Usec = int32(t.Nanosecond() / 1000) - tv.Sec = t.Unix() - return tv -} - -// MacOS before High Sierra lacks utimensat() and UTIME_OMIT. -// We emulate using utimes() and extra Getattr() calls. -func (f *loopbackFile) utimens(a *time.Time, m *time.Time) syscall.Errno { - var attr fuse.AttrOut - if a == nil || m == nil { - errno := f.Getattr(context.Background(), &attr) - if errno != 0 { - return errno - } - } - tv := utimens.Fill(a, m, &attr.Attr) - err := syscall.Futimes(int(f.fd), tv) - return ToErrno(err) -} - -func (n *loopbackNode) CopyFileRange(ctx context.Context, fhIn FileHandle, - offIn uint64, out *Inode, fhOut FileHandle, offOut uint64, - len uint64, flags uint64) (uint32, syscall.Errno) { - return 0, syscall.ENOSYS -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/loopback_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fs/loopback_linux.go deleted file mode 100644 index 590596a32..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/loopback_linux.go +++ /dev/null @@ -1,86 +0,0 @@ -// +build linux - -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "syscall" - - "golang.org/x/sys/unix" -) - -func (n *loopbackNode) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno) { - sz, err := unix.Lgetxattr(n.path(), attr, dest) - return uint32(sz), ToErrno(err) -} - -func (n *loopbackNode) Setxattr(ctx context.Context, attr string, data []byte, flags uint32) syscall.Errno { - err := unix.Lsetxattr(n.path(), attr, data, int(flags)) - return ToErrno(err) -} - -func (n *loopbackNode) Removexattr(ctx context.Context, attr string) syscall.Errno { - err := unix.Lremovexattr(n.path(), attr) - return ToErrno(err) -} - -func (n *loopbackNode) Listxattr(ctx context.Context, dest []byte) (uint32, syscall.Errno) { - sz, err := unix.Llistxattr(n.path(), dest) - return uint32(sz), ToErrno(err) -} - -func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newName string) syscall.Errno { - fd1, err := syscall.Open(n.path(), syscall.O_DIRECTORY, 0) - if err != nil { - return ToErrno(err) - } - defer syscall.Close(fd1) - fd2, err := syscall.Open(newparent.path(), syscall.O_DIRECTORY, 0) - defer syscall.Close(fd2) - if err != nil { - return ToErrno(err) - } - - var st syscall.Stat_t - if err := syscall.Fstat(fd1, &st); err != nil { - return ToErrno(err) - } - - // Double check that nodes didn't change from under us. - inode := &n.Inode - if inode.Root() != inode && inode.StableAttr().Ino != n.root().idFromStat(&st).Ino { - return syscall.EBUSY - } - if err := syscall.Fstat(fd2, &st); err != nil { - return ToErrno(err) - } - - newinode := &newparent.Inode - if newinode.Root() != newinode && newinode.StableAttr().Ino != n.root().idFromStat(&st).Ino { - return syscall.EBUSY - } - - return ToErrno(unix.Renameat2(fd1, name, fd2, newName, unix.RENAME_EXCHANGE)) -} - -func (n *loopbackNode) CopyFileRange(ctx context.Context, fhIn FileHandle, - offIn uint64, out *Inode, fhOut FileHandle, offOut uint64, - len uint64, flags uint64) (uint32, syscall.Errno) { - lfIn, ok := fhIn.(*loopbackFile) - if !ok { - return 0, syscall.ENOTSUP - } - lfOut, ok := fhOut.(*loopbackFile) - if !ok { - return 0, syscall.ENOTSUP - } - - signedOffIn := int64(offIn) - signedOffOut := int64(offOut) - count, err := unix.CopyFileRange(lfIn.fd, &signedOffIn, lfOut.fd, &signedOffOut, int(len), int(flags)) - return uint32(count), ToErrno(err) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/mem.go b/vendor/github.com/hanwen/go-fuse/v2/fs/mem.go deleted file mode 100644 index dd1e46978..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/mem.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "context" - "sync" - "syscall" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -// MemRegularFile is a filesystem node that holds a read-only data -// slice in memory. -type MemRegularFile struct { - Inode - - mu sync.Mutex - Data []byte - Attr fuse.Attr -} - -var _ = (NodeOpener)((*MemRegularFile)(nil)) -var _ = (NodeReader)((*MemRegularFile)(nil)) -var _ = (NodeWriter)((*MemRegularFile)(nil)) -var _ = (NodeSetattrer)((*MemRegularFile)(nil)) -var _ = (NodeFlusher)((*MemRegularFile)(nil)) - -func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle, fuseFlags uint32, errno syscall.Errno) { - return nil, fuse.FOPEN_KEEP_CACHE, OK -} - -func (f *MemRegularFile) Write(ctx context.Context, fh FileHandle, data []byte, off int64) (uint32, syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - end := int64(len(data)) + off - if int64(len(f.Data)) < end { - n := make([]byte, end) - copy(n, f.Data) - f.Data = n - } - - copy(f.Data[off:off+int64(len(data))], data) - - return uint32(len(data)), 0 -} - -var _ = (NodeGetattrer)((*MemRegularFile)(nil)) - -func (f *MemRegularFile) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - out.Attr = f.Attr - out.Attr.Size = uint64(len(f.Data)) - return OK -} - -func (f *MemRegularFile) Setattr(ctx context.Context, fh FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno { - f.mu.Lock() - defer f.mu.Unlock() - if sz, ok := in.GetSize(); ok { - f.Data = f.Data[:sz] - } - out.Attr = f.Attr - out.Size = uint64(len(f.Data)) - return OK -} - -func (f *MemRegularFile) Flush(ctx context.Context, fh FileHandle) syscall.Errno { - return 0 -} - -func (f *MemRegularFile) Read(ctx context.Context, fh FileHandle, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) { - f.mu.Lock() - defer f.mu.Unlock() - end := int(off) + len(dest) - if end > len(f.Data) { - end = len(f.Data) - } - return fuse.ReadResultData(f.Data[off:end]), OK -} - -// MemSymlink is an inode holding a symlink in memory. -type MemSymlink struct { - Inode - Attr fuse.Attr - Data []byte -} - -var _ = (NodeReadlinker)((*MemSymlink)(nil)) - -func (l *MemSymlink) Readlink(ctx context.Context) ([]byte, syscall.Errno) { - return l.Data, OK -} - -var _ = (NodeGetattrer)((*MemSymlink)(nil)) - -func (l *MemSymlink) Getattr(ctx context.Context, fh FileHandle, out *fuse.AttrOut) syscall.Errno { - out.Attr = l.Attr - return OK -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/mount.go b/vendor/github.com/hanwen/go-fuse/v2/fs/mount.go deleted file mode 100644 index 187d6e28a..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/mount.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "time" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -// Mount mounts the given NodeFS on the directory, and starts serving -// requests. This is a convenience wrapper around NewNodeFS and -// fuse.NewServer. If nil is given as options, default settings are -// applied, which are 1 second entry and attribute timeout. -func Mount(dir string, root InodeEmbedder, options *Options) (*fuse.Server, error) { - if options == nil { - oneSec := time.Second - options = &Options{ - EntryTimeout: &oneSec, - AttrTimeout: &oneSec, - } - } - - rawFS := NewNodeFS(root, options) - server, err := fuse.NewServer(rawFS, dir, &options.MountOptions) - if err != nil { - return nil, err - } - - go server.Serve() - if err := server.WaitMount(); err != nil { - // we don't shutdown the serve loop. If the mount does - // not succeed, the loop won't work and exit. - return nil, err - } - - return server, nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fs/syscall_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fs/syscall_linux.go deleted file mode 100644 index 3fed2630e..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fs/syscall_linux.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fs - -import ( - "syscall" - "unsafe" -) - -// futimens - futimens(3) calls utimensat(2) with "pathname" set to null and -// "flags" set to zero -func futimens(fd int, times *[2]syscall.Timespec) (err error) { - _, _, e1 := syscall.Syscall6(syscall.SYS_UTIMENSAT, uintptr(fd), 0, uintptr(unsafe.Pointer(times)), uintptr(0), 0, 0) - if e1 != 0 { - err = syscall.Errno(e1) - } - return -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/.gitignore b/vendor/github.com/hanwen/go-fuse/v2/fuse/.gitignore deleted file mode 100644 index 13df91618..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/.gitignore +++ /dev/null @@ -1 +0,0 @@ -version.gen.go diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/api.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/api.go deleted file mode 100644 index 36d75ae76..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/api.go +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fuse provides APIs to implement filesystems in -// userspace in terms of raw FUSE protocol. -// -// A filesystem is implemented by implementing its server that provides a -// RawFileSystem interface. Typically the server embeds -// NewDefaultRawFileSystem() and implements only subset of filesystem methods: -// -// type MyFS struct { -// fuse.RawFileSystem -// ... -// } -// -// func NewMyFS() *MyFS { -// return &MyFS{ -// RawFileSystem: fuse.NewDefaultRawFileSystem(), -// ... -// } -// } -// -// // Mkdir implements "mkdir" request handler. -// // -// // For other requests - not explicitly implemented by MyFS - ENOSYS -// // will be typically returned to client. -// func (fs *MyFS) Mkdir(...) { -// ... -// } -// -// Then the filesystem can be mounted and served to a client (typically OS -// kernel) by creating Server: -// -// fs := NewMyFS() // implements RawFileSystem -// fssrv, err := fuse.NewServer(fs, mountpoint, &fuse.MountOptions{...}) -// if err != nil { -// ... -// } -// -// and letting the server do its work: -// -// // either synchronously - .Serve() blocks until the filesystem is unmounted. -// fssrv.Serve() -// -// // or in the background - .Serve() is spawned in another goroutine, but -// // before interacting with fssrv from current context we have to wait -// // until the filesystem mounting is complete. -// go fssrv.Serve() -// err = fssrv.WaitMount() -// if err != nil { -// ... -// } -// -// The server will serve clients by dispatching their requests to the -// filesystem implementation and conveying responses back. For example "mkdir" -// FUSE request dispatches to call -// -// fs.Mkdir(*MkdirIn, ..., *EntryOut) -// -// "stat" to call -// -// fs.GetAttr(*GetAttrIn, *AttrOut) -// -// etc. Please refer to RawFileSystem documentation for details. -// -// Typically, each call of the API happens in its own -// goroutine, so take care to make the file system thread-safe. -// -// -// Higher level interfaces -// -// As said above this packages provides way to implement filesystems in terms of -// raw FUSE protocol. Additionally packages nodefs and pathfs provide ways to -// implement filesystem at higher levels: -// -// Package github.com/hanwen/go-fuse/fuse/nodefs provides way to implement -// filesystems in terms of inodes. This resembles kernel's idea of what a -// filesystem looks like. -// -// Package github.com/hanwen/go-fuse/fuse/pathfs provides way to implement -// filesystems in terms of path names. Working with path names is somewhat -// easier compared to inodes, however renames can be racy. Do not use pathfs if -// you care about correctness. -package fuse - -// Types for users to implement. - -// The result of Read is an array of bytes, but for performance -// reasons, we can also return data as a file-descriptor/offset/size -// tuple. If the backing store for a file is another filesystem, this -// reduces the amount of copying between the kernel and the FUSE -// server. The ReadResult interface captures both cases. -type ReadResult interface { - // Returns the raw bytes for the read, possibly using the - // passed buffer. The buffer should be larger than the return - // value from Size. - Bytes(buf []byte) ([]byte, Status) - - // Size returns how many bytes this return value takes at most. - Size() int - - // Done() is called after sending the data to the kernel. - Done() -} - -type MountOptions struct { - AllowOther bool - - // Options are passed as -o string to fusermount. - Options []string - - // Default is _DEFAULT_BACKGROUND_TASKS, 12. This numbers - // controls the allowed number of requests that relate to - // async I/O. Concurrency for synchronous I/O is not limited. - MaxBackground int - - // Write size to use. If 0, use default. This number is - // capped at the kernel maximum. - MaxWrite int - - // Max read ahead to use. If 0, use default. This number is - // capped at the kernel maximum. - MaxReadAhead int - - // If IgnoreSecurityLabels is set, all security related xattr - // requests will return NO_DATA without passing through the - // user defined filesystem. You should only set this if you - // file system implements extended attributes, and you are not - // interested in security labels. - IgnoreSecurityLabels bool // ignoring labels should be provided as a fusermount mount option. - - // If RememberInodes is set, we will never forget inodes. - // This may be useful for NFS. - RememberInodes bool - - // Values shown in "df -T" and friends - // First column, "Filesystem" - FsName string - - // Second column, "Type", will be shown as "fuse." + Name - Name string - - // If set, wrap the file system in a single-threaded locking wrapper. - SingleThreaded bool - - // If set, return ENOSYS for Getxattr calls, so the kernel does not issue any - // Xattr operations at all. - DisableXAttrs bool - - // If set, print debugging information. - Debug bool - - // If set, ask kernel to forward file locks to FUSE. If using, - // you must implement the GetLk/SetLk/SetLkw methods. - EnableLocks bool - - // If set, ask kernel not to do automatic data cache invalidation. - // The filesystem is fully responsible for invalidating data cache. - ExplicitDataCacheControl bool - - // If set, fuse will first attempt to use syscall.Mount instead of - // fusermount to mount the filesystem. This will not update /etc/mtab - // but might be needed if fusermount is not available. - DirectMount bool - - // Options passed to syscall.Mount, the default value used by fusermount - // is syscall.MS_NOSUID|syscall.MS_NODEV - DirectMountFlags uintptr -} - -// RawFileSystem is an interface close to the FUSE wire protocol. -// -// Unless you really know what you are doing, you should not implement -// this, but rather the nodefs.Node or pathfs.FileSystem interfaces; the -// details of getting interactions with open files, renames, and threading -// right etc. are somewhat tricky and not very interesting. -// -// Each FUSE request results in a corresponding method called by Server. -// Several calls may be made simultaneously, because the server typically calls -// each method in separate goroutine. -// -// A null implementation is provided by NewDefaultRawFileSystem. -// -// After a successful FUSE API call returns, you may not read input or -// write output data: for performance reasons, memory is reused for -// following requests, and reading/writing the request data will lead -// to race conditions. If you spawn a background routine from a FUSE -// API call, any incoming request data it wants to reference should be -// copied over. -// -// If a FUSE API call is canceled (which is signaled by closing the -// `cancel` channel), the API call should return EINTR. In this case, -// the outstanding request data is not reused, so the API call may -// return EINTR without ensuring that child contexts have successfully -// completed. -type RawFileSystem interface { - String() string - - // If called, provide debug output through the log package. - SetDebug(debug bool) - - // Lookup is called by the kernel when the VFS wants to know - // about a file inside a directory. Many lookup calls can - // occur in parallel, but only one call happens for each (dir, - // name) pair. - Lookup(cancel <-chan struct{}, header *InHeader, name string, out *EntryOut) (status Status) - - // Forget is called when the kernel discards entries from its - // dentry cache. This happens on unmount, and when the kernel - // is short on memory. Since it is not guaranteed to occur at - // any moment, and since there is no return value, Forget - // should not do I/O, as there is no channel to report back - // I/O errors. - Forget(nodeid, nlookup uint64) - - // Attributes. - GetAttr(cancel <-chan struct{}, input *GetAttrIn, out *AttrOut) (code Status) - SetAttr(cancel <-chan struct{}, input *SetAttrIn, out *AttrOut) (code Status) - - // Modifying structure. - Mknod(cancel <-chan struct{}, input *MknodIn, name string, out *EntryOut) (code Status) - Mkdir(cancel <-chan struct{}, input *MkdirIn, name string, out *EntryOut) (code Status) - Unlink(cancel <-chan struct{}, header *InHeader, name string) (code Status) - Rmdir(cancel <-chan struct{}, header *InHeader, name string) (code Status) - Rename(cancel <-chan struct{}, input *RenameIn, oldName string, newName string) (code Status) - Link(cancel <-chan struct{}, input *LinkIn, filename string, out *EntryOut) (code Status) - - Symlink(cancel <-chan struct{}, header *InHeader, pointedTo string, linkName string, out *EntryOut) (code Status) - Readlink(cancel <-chan struct{}, header *InHeader) (out []byte, code Status) - Access(cancel <-chan struct{}, input *AccessIn) (code Status) - - // Extended attributes. - - // GetXAttr reads an extended attribute, and should return the - // number of bytes. If the buffer is too small, return ERANGE, - // with the required buffer size. - GetXAttr(cancel <-chan struct{}, header *InHeader, attr string, dest []byte) (sz uint32, code Status) - - // ListXAttr lists extended attributes as '\0' delimited byte - // slice, and return the number of bytes. If the buffer is too - // small, return ERANGE, with the required buffer size. - ListXAttr(cancel <-chan struct{}, header *InHeader, dest []byte) (uint32, Status) - - // SetAttr writes an extended attribute. - SetXAttr(cancel <-chan struct{}, input *SetXAttrIn, attr string, data []byte) Status - - // RemoveXAttr removes an extended attribute. - RemoveXAttr(cancel <-chan struct{}, header *InHeader, attr string) (code Status) - - // File handling. - Create(cancel <-chan struct{}, input *CreateIn, name string, out *CreateOut) (code Status) - Open(cancel <-chan struct{}, input *OpenIn, out *OpenOut) (status Status) - Read(cancel <-chan struct{}, input *ReadIn, buf []byte) (ReadResult, Status) - Lseek(cancel <-chan struct{}, in *LseekIn, out *LseekOut) Status - - // File locking - GetLk(cancel <-chan struct{}, input *LkIn, out *LkOut) (code Status) - SetLk(cancel <-chan struct{}, input *LkIn) (code Status) - SetLkw(cancel <-chan struct{}, input *LkIn) (code Status) - - Release(cancel <-chan struct{}, input *ReleaseIn) - Write(cancel <-chan struct{}, input *WriteIn, data []byte) (written uint32, code Status) - CopyFileRange(cancel <-chan struct{}, input *CopyFileRangeIn) (written uint32, code Status) - - Flush(cancel <-chan struct{}, input *FlushIn) Status - Fsync(cancel <-chan struct{}, input *FsyncIn) (code Status) - Fallocate(cancel <-chan struct{}, input *FallocateIn) (code Status) - - // Directory handling - OpenDir(cancel <-chan struct{}, input *OpenIn, out *OpenOut) (status Status) - ReadDir(cancel <-chan struct{}, input *ReadIn, out *DirEntryList) Status - ReadDirPlus(cancel <-chan struct{}, input *ReadIn, out *DirEntryList) Status - ReleaseDir(input *ReleaseIn) - FsyncDir(cancel <-chan struct{}, input *FsyncIn) (code Status) - - StatFs(cancel <-chan struct{}, input *InHeader, out *StatfsOut) (code Status) - - // This is called on processing the first request. The - // filesystem implementation can use the server argument to - // talk back to the kernel (through notify methods). - Init(*Server) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/attr.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/attr.go deleted file mode 100644 index 99d171593..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/attr.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "os" - "syscall" - "time" -) - -func (a *Attr) IsFifo() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFIFO } - -// IsChar reports whether the FileInfo describes a character special file. -func (a *Attr) IsChar() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFCHR } - -// IsDir reports whether the FileInfo describes a directory. -func (a *Attr) IsDir() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFDIR } - -// IsBlock reports whether the FileInfo describes a block special file. -func (a *Attr) IsBlock() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFBLK } - -// IsRegular reports whether the FileInfo describes a regular file. -func (a *Attr) IsRegular() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFREG } - -// IsSymlink reports whether the FileInfo describes a symbolic link. -func (a *Attr) IsSymlink() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFLNK } - -// IsSocket reports whether the FileInfo describes a socket. -func (a *Attr) IsSocket() bool { return (uint32(a.Mode) & syscall.S_IFMT) == syscall.S_IFSOCK } - -func (a *Attr) SetTimes(access *time.Time, mod *time.Time, chstatus *time.Time) { - if access != nil { - a.Atime = uint64(access.Unix()) - a.Atimensec = uint32(access.Nanosecond()) - } - if mod != nil { - a.Mtime = uint64(mod.Unix()) - a.Mtimensec = uint32(mod.Nanosecond()) - } - if chstatus != nil { - a.Ctime = uint64(chstatus.Unix()) - a.Ctimensec = uint32(chstatus.Nanosecond()) - } -} - -func (a *Attr) ChangeTime() time.Time { - return time.Unix(int64(a.Ctime), int64(a.Ctimensec)) -} - -func (a *Attr) AccessTime() time.Time { - return time.Unix(int64(a.Atime), int64(a.Atimensec)) -} - -func (a *Attr) ModTime() time.Time { - return time.Unix(int64(a.Mtime), int64(a.Mtimensec)) -} - -func ToStatT(f os.FileInfo) *syscall.Stat_t { - s, _ := f.Sys().(*syscall.Stat_t) - if s != nil { - return s - } - return nil -} - -func ToAttr(f os.FileInfo) *Attr { - if f == nil { - return nil - } - s := ToStatT(f) - if s != nil { - a := &Attr{} - a.FromStat(s) - return a - } - return nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/attr_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/attr_darwin.go deleted file mode 100644 index 40cb0720f..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/attr_darwin.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "syscall" -) - -func (a *Attr) FromStat(s *syscall.Stat_t) { - a.Ino = uint64(s.Ino) - a.Size = uint64(s.Size) - a.Blocks = uint64(s.Blocks) - a.Atime = uint64(s.Atimespec.Sec) - a.Atimensec = uint32(s.Atimespec.Nsec) - a.Mtime = uint64(s.Mtimespec.Sec) - a.Mtimensec = uint32(s.Mtimespec.Nsec) - a.Ctime = uint64(s.Ctimespec.Sec) - a.Ctimensec = uint32(s.Ctimespec.Nsec) - a.Mode = uint32(s.Mode) - a.Nlink = uint32(s.Nlink) - a.Uid = uint32(s.Uid) - a.Gid = uint32(s.Gid) - a.Rdev = uint32(s.Rdev) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/attr_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/attr_linux.go deleted file mode 100644 index 223676a95..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/attr_linux.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "syscall" -) - -func (a *Attr) FromStat(s *syscall.Stat_t) { - a.Ino = uint64(s.Ino) - a.Size = uint64(s.Size) - a.Blocks = uint64(s.Blocks) - a.Atime = uint64(s.Atim.Sec) - a.Atimensec = uint32(s.Atim.Nsec) - a.Mtime = uint64(s.Mtim.Sec) - a.Mtimensec = uint32(s.Mtim.Nsec) - a.Ctime = uint64(s.Ctim.Sec) - a.Ctimensec = uint32(s.Ctim.Nsec) - a.Mode = s.Mode - a.Nlink = uint32(s.Nlink) - a.Uid = uint32(s.Uid) - a.Gid = uint32(s.Gid) - a.Rdev = uint32(s.Rdev) - a.Blksize = uint32(s.Blksize) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/bufferpool.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/bufferpool.go deleted file mode 100644 index a0882c858..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/bufferpool.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "os" - "sync" -) - -// bufferPool implements explicit memory management. It is used for -// minimizing the GC overhead of communicating with the kernel. -type bufferPool struct { - lock sync.Mutex - - // For each page size multiple a list of slice pointers. - buffersBySize []*sync.Pool -} - -var pageSize = os.Getpagesize() - -func (p *bufferPool) getPool(pageCount int) *sync.Pool { - p.lock.Lock() - for len(p.buffersBySize) < pageCount+1 { - p.buffersBySize = append(p.buffersBySize, nil) - } - if p.buffersBySize[pageCount] == nil { - p.buffersBySize[pageCount] = &sync.Pool{ - New: func() interface{} { return make([]byte, pageSize*pageCount) }, - } - } - pool := p.buffersBySize[pageCount] - p.lock.Unlock() - return pool -} - -// AllocBuffer creates a buffer of at least the given size. After use, -// it should be deallocated with FreeBuffer(). -func (p *bufferPool) AllocBuffer(size uint32) []byte { - sz := int(size) - if sz < pageSize { - sz = pageSize - } - - if sz%pageSize != 0 { - sz += pageSize - } - pages := sz / pageSize - - b := p.getPool(pages).Get().([]byte) - return b[:size] -} - -// FreeBuffer takes back a buffer if it was allocated through -// AllocBuffer. It is not an error to call FreeBuffer() on a slice -// obtained elsewhere. -func (p *bufferPool) FreeBuffer(slice []byte) { - if slice == nil { - return - } - if cap(slice)%pageSize != 0 || cap(slice) == 0 { - return - } - pages := cap(slice) / pageSize - slice = slice[:cap(slice)] - - p.getPool(pages).Put(slice) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/constants.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/constants.go deleted file mode 100644 index d8416858f..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/constants.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "os" - "syscall" -) - -const ( - FUSE_ROOT_ID = 1 - - FUSE_UNKNOWN_INO = 0xffffffff - - CUSE_UNRESTRICTED_IOCTL = (1 << 0) - - FUSE_LK_FLOCK = (1 << 0) - - FUSE_IOCTL_MAX_IOV = 256 - - FUSE_POLL_SCHEDULE_NOTIFY = (1 << 0) - - CUSE_INIT_INFO_MAX = 4096 - - S_IFDIR = syscall.S_IFDIR - S_IFREG = syscall.S_IFREG - S_IFLNK = syscall.S_IFLNK - S_IFIFO = syscall.S_IFIFO - - CUSE_INIT = 4096 - - O_ANYWRITE = uint32(os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_CREATE | os.O_TRUNC) - - logicalBlockSize = 512 -) diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/constants_freebsd.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/constants_freebsd.go deleted file mode 100644 index 5fb606919..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/constants_freebsd.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -// arbitrary values -const syscall_O_LARGEFILE = 1 << 29 -const syscall_O_NOATIME = 1 << 30 diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/constants_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/constants_linux.go deleted file mode 100644 index 29455e4f6..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/constants_linux.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "syscall" -) - -const syscall_O_LARGEFILE = syscall.O_LARGEFILE -const syscall_O_NOATIME = syscall.O_NOATIME diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/context.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/context.go deleted file mode 100644 index fbc6a0ae7..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/context.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "context" - "time" -) - -// Context passes along cancelation signal and request data (PID, GID, -// UID). The name of this class predates the standard "context" -// package from Go, but it does implement the context.Context -// interface. -// -// When a FUSE request is canceled, the API routine should respond by -// returning the EINTR status code. -type Context struct { - Caller - Cancel <-chan struct{} -} - -func (c *Context) Deadline() (time.Time, bool) { - return time.Time{}, false -} - -func (c *Context) Done() <-chan struct{} { - return c.Cancel -} - -func (c *Context) Err() error { - select { - case <-c.Cancel: - return context.Canceled - default: - return nil - } -} - -type callerKeyType struct{} - -var callerKey callerKeyType - -func FromContext(ctx context.Context) (*Caller, bool) { - v, ok := ctx.Value(callerKey).(*Caller) - return v, ok -} - -func NewContext(ctx context.Context, caller *Caller) context.Context { - return context.WithValue(ctx, callerKey, caller) -} - -func (c *Context) Value(key interface{}) interface{} { - if key == callerKey { - return &c.Caller - } - return nil -} - -var _ = context.Context((*Context)(nil)) diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/defaultraw.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/defaultraw.go deleted file mode 100644 index df109bdcf..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/defaultraw.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "os" -) - -// NewDefaultRawFileSystem returns ENOSYS (not implemented) for all -// operations. -func NewDefaultRawFileSystem() RawFileSystem { - return (*defaultRawFileSystem)(nil) -} - -type defaultRawFileSystem struct{} - -func (fs *defaultRawFileSystem) Init(*Server) { -} - -func (fs *defaultRawFileSystem) String() string { - return os.Args[0] -} - -func (fs *defaultRawFileSystem) SetDebug(dbg bool) { -} - -func (fs *defaultRawFileSystem) StatFs(cancel <-chan struct{}, header *InHeader, out *StatfsOut) Status { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Lookup(cancel <-chan struct{}, header *InHeader, name string, out *EntryOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Forget(nodeID, nlookup uint64) { -} - -func (fs *defaultRawFileSystem) GetAttr(cancel <-chan struct{}, input *GetAttrIn, out *AttrOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Open(cancel <-chan struct{}, input *OpenIn, out *OpenOut) (status Status) { - return OK -} - -func (fs *defaultRawFileSystem) SetAttr(cancel <-chan struct{}, input *SetAttrIn, out *AttrOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Readlink(cancel <-chan struct{}, header *InHeader) (out []byte, code Status) { - return nil, ENOSYS -} - -func (fs *defaultRawFileSystem) Mknod(cancel <-chan struct{}, input *MknodIn, name string, out *EntryOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Mkdir(cancel <-chan struct{}, input *MkdirIn, name string, out *EntryOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Unlink(cancel <-chan struct{}, header *InHeader, name string) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Rmdir(cancel <-chan struct{}, header *InHeader, name string) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Symlink(cancel <-chan struct{}, header *InHeader, pointedTo string, linkName string, out *EntryOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Rename(cancel <-chan struct{}, input *RenameIn, oldName string, newName string) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Link(cancel <-chan struct{}, input *LinkIn, name string, out *EntryOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) GetXAttr(cancel <-chan struct{}, header *InHeader, attr string, dest []byte) (size uint32, code Status) { - return 0, ENOSYS -} - -func (fs *defaultRawFileSystem) SetXAttr(cancel <-chan struct{}, input *SetXAttrIn, attr string, data []byte) Status { - return ENOSYS -} - -func (fs *defaultRawFileSystem) ListXAttr(cancel <-chan struct{}, header *InHeader, dest []byte) (n uint32, code Status) { - return 0, ENOSYS -} - -func (fs *defaultRawFileSystem) RemoveXAttr(cancel <-chan struct{}, header *InHeader, attr string) Status { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Access(cancel <-chan struct{}, input *AccessIn) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Create(cancel <-chan struct{}, input *CreateIn, name string, out *CreateOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) OpenDir(cancel <-chan struct{}, input *OpenIn, out *OpenOut) (status Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Read(cancel <-chan struct{}, input *ReadIn, buf []byte) (ReadResult, Status) { - return nil, ENOSYS -} - -func (fs *defaultRawFileSystem) GetLk(cancel <-chan struct{}, in *LkIn, out *LkOut) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) SetLk(cancel <-chan struct{}, in *LkIn) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) SetLkw(cancel <-chan struct{}, in *LkIn) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Release(cancel <-chan struct{}, input *ReleaseIn) { -} - -func (fs *defaultRawFileSystem) Write(cancel <-chan struct{}, input *WriteIn, data []byte) (written uint32, code Status) { - return 0, ENOSYS -} - -func (fs *defaultRawFileSystem) Flush(cancel <-chan struct{}, input *FlushIn) Status { - return OK -} - -func (fs *defaultRawFileSystem) Fsync(cancel <-chan struct{}, input *FsyncIn) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) ReadDir(cancel <-chan struct{}, input *ReadIn, l *DirEntryList) Status { - return ENOSYS -} - -func (fs *defaultRawFileSystem) ReadDirPlus(cancel <-chan struct{}, input *ReadIn, l *DirEntryList) Status { - return ENOSYS -} - -func (fs *defaultRawFileSystem) ReleaseDir(input *ReleaseIn) { -} - -func (fs *defaultRawFileSystem) FsyncDir(cancel <-chan struct{}, input *FsyncIn) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) Fallocate(cancel <-chan struct{}, in *FallocateIn) (code Status) { - return ENOSYS -} - -func (fs *defaultRawFileSystem) CopyFileRange(cancel <-chan struct{}, input *CopyFileRangeIn) (written uint32, code Status) { - return 0, ENOSYS -} - -func (fs *defaultRawFileSystem) Lseek(cancel <-chan struct{}, in *LseekIn, out *LseekOut) Status { - return ENOSYS -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/direntry.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/direntry.go deleted file mode 100644 index 52cc893f6..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/direntry.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -// all of the code for DirEntryList. - -import ( - "fmt" - "unsafe" -) - -var eightPadding [8]byte - -const direntSize = int(unsafe.Sizeof(_Dirent{})) - -// DirEntry is a type for PathFileSystem and NodeFileSystem to return -// directory contents in. -type DirEntry struct { - // Mode is the file's mode. Only the high bits (eg. S_IFDIR) - // are considered. - Mode uint32 - - // Name is the basename of the file in the directory. - Name string - - // Ino is the inode number. - Ino uint64 -} - -func (d DirEntry) String() string { - return fmt.Sprintf("%o: %q ino=%d", d.Mode, d.Name, d.Ino) -} - -// DirEntryList holds the return value for READDIR and READDIRPLUS -// opcodes. -type DirEntryList struct { - buf []byte - size int // capacity of the underlying buffer - offset uint64 // entry count (NOT a byte offset) - lastDirent *_Dirent // pointer to the last serialized _Dirent. Used by FixMode(). -} - -// NewDirEntryList creates a DirEntryList with the given data buffer -// and offset. -func NewDirEntryList(data []byte, off uint64) *DirEntryList { - return &DirEntryList{ - buf: data[:0], - size: len(data), - offset: off, - } -} - -// AddDirEntry tries to add an entry, and reports whether it -// succeeded. -func (l *DirEntryList) AddDirEntry(e DirEntry) bool { - return l.Add(0, e.Name, e.Ino, e.Mode) -} - -// Add adds a direntry to the DirEntryList, returning whether it -// succeeded. -func (l *DirEntryList) Add(prefix int, name string, inode uint64, mode uint32) bool { - if inode == 0 { - inode = FUSE_UNKNOWN_INO - } - padding := (8 - len(name)&7) & 7 - delta := padding + direntSize + len(name) + prefix - oldLen := len(l.buf) - newLen := delta + oldLen - - if newLen > l.size { - return false - } - l.buf = l.buf[:newLen] - oldLen += prefix - dirent := (*_Dirent)(unsafe.Pointer(&l.buf[oldLen])) - dirent.Off = l.offset + 1 - dirent.Ino = inode - dirent.NameLen = uint32(len(name)) - dirent.Typ = modeToType(mode) - oldLen += direntSize - copy(l.buf[oldLen:], name) - oldLen += len(name) - - if padding > 0 { - copy(l.buf[oldLen:], eightPadding[:padding]) - } - - l.offset = dirent.Off - return true -} - -// AddDirLookupEntry is used for ReadDirPlus. If reserves and zeroizes space -// for an EntryOut struct and serializes a DirEntry. -// On success, it returns pointers to both structs. -// If not enough space was left, it returns two nil pointers. -// -// The resulting READDIRPLUS output buffer looks like this in memory: -// 1) EntryOut{} -// 2) _Dirent{} -// 3) Name (null-terminated) -// 4) Padding to align to 8 bytes -// [repeat] -func (l *DirEntryList) AddDirLookupEntry(e DirEntry) *EntryOut { - const entryOutSize = int(unsafe.Sizeof(EntryOut{})) - oldLen := len(l.buf) - ok := l.Add(entryOutSize, e.Name, e.Ino, e.Mode) - if !ok { - return nil - } - l.lastDirent = (*_Dirent)(unsafe.Pointer(&l.buf[oldLen+entryOutSize])) - entryOut := (*EntryOut)(unsafe.Pointer(&l.buf[oldLen])) - *entryOut = EntryOut{} // zeroize - return entryOut -} - -// modeToType converts a file *mode* (as used in syscall.Stat_t.Mode) -// to a file *type* (as used in _Dirent.Typ). -// Equivalent to IFTODT() in libc (see man 5 dirent). -func modeToType(mode uint32) uint32 { - return (mode & 0170000) >> 12 -} - -// FixMode overrides the file mode of the last direntry that was added. This can -// be needed when a directory changes while READDIRPLUS is running. -// Only the file type bits of mode are considered, the rest is masked out. -func (l *DirEntryList) FixMode(mode uint32) { - l.lastDirent.Typ = modeToType(mode) -} - -func (l *DirEntryList) bytes() []byte { - return l.buf -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/misc.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/misc.go deleted file mode 100644 index 5e93972bb..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/misc.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Random odds and ends. - -package fuse - -import ( - "fmt" - "log" - "os" - "reflect" - "syscall" - "time" - "unsafe" -) - -func (code Status) String() string { - if code <= 0 { - return []string{ - "OK", - "NOTIFY_POLL", - "NOTIFY_INVAL_INODE", - "NOTIFY_INVAL_ENTRY", - "NOTIFY_STORE_CACHE", - "NOTIFY_RETRIEVE_CACHE", - "NOTIFY_DELETE", - }[-code] - } - return fmt.Sprintf("%d=%v", int(code), syscall.Errno(code)) -} - -func (code Status) Ok() bool { - return code == OK -} - -// ToStatus extracts an errno number from Go error objects. If it -// fails, it logs an error and returns ENOSYS. -func ToStatus(err error) Status { - switch err { - case nil: - return OK - case os.ErrPermission: - return EPERM - case os.ErrExist: - return Status(syscall.EEXIST) - case os.ErrNotExist: - return ENOENT - case os.ErrInvalid: - return EINVAL - } - - switch t := err.(type) { - case syscall.Errno: - return Status(t) - case *os.SyscallError: - return Status(t.Err.(syscall.Errno)) - case *os.PathError: - return ToStatus(t.Err) - case *os.LinkError: - return ToStatus(t.Err) - } - log.Println("can't convert error type:", err) - return ENOSYS -} - -func toSlice(dest *[]byte, ptr unsafe.Pointer, byteCount uintptr) { - h := (*reflect.SliceHeader)(unsafe.Pointer(dest)) - *h = reflect.SliceHeader{ - Data: uintptr(ptr), - Len: int(byteCount), - Cap: int(byteCount), - } -} - -func CurrentOwner() *Owner { - return &Owner{ - Uid: uint32(os.Getuid()), - Gid: uint32(os.Getgid()), - } -} - -const _UTIME_OMIT = ((1 << 30) - 2) - -// UtimeToTimespec converts a "Time" pointer as passed to Utimens to a -// "Timespec" that can be passed to the utimensat syscall. -// A nil pointer is converted to the special UTIME_OMIT value. -func UtimeToTimespec(t *time.Time) (ts syscall.Timespec) { - if t == nil { - ts.Nsec = _UTIME_OMIT - } else { - ts = syscall.NsecToTimespec(t.UnixNano()) - // Go bug https://github.com/golang/go/issues/12777 - if ts.Nsec < 0 { - ts.Nsec = 0 - } - } - return ts -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/mount_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/mount_darwin.go deleted file mode 100644 index 685bb4026..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/mount_darwin.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "bytes" - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - "syscall" -) - -func openFUSEDevice() (*os.File, error) { - fs, err := filepath.Glob("/dev/osxfuse*") - if err != nil { - return nil, err - } - if len(fs) == 0 { - bin := oldLoadBin - if _, err := os.Stat(newLoadBin); err == nil { - bin = newLoadBin - } - - cmd := exec.Command(bin) - if err := cmd.Run(); err != nil { - return nil, err - } - fs, err = filepath.Glob("/dev/osxfuse*") - if err != nil { - return nil, err - } - } - - for _, fn := range fs { - f, err := os.OpenFile(fn, os.O_RDWR, 0) - if err != nil { - continue - } - return f, nil - } - - return nil, fmt.Errorf("all FUSE devices busy") -} - -const oldLoadBin = "/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs" -const newLoadBin = "/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse" - -const oldMountBin = "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs" -const newMountBin = "/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse" - -func mount(mountPoint string, opts *MountOptions, ready chan<- error) (fd int, err error) { - f, err := openFUSEDevice() - if err != nil { - return 0, err - } - - bin := oldMountBin - if _, err := os.Stat(newMountBin); err == nil { - bin = newMountBin - } - - cmd := exec.Command(bin, "-o", strings.Join(opts.optionsStrings(), ","), "-o", fmt.Sprintf("iosize=%d", opts.MaxWrite), "3", mountPoint) - cmd.ExtraFiles = []*os.File{f} - cmd.Env = append(os.Environ(), "MOUNT_FUSEFS_CALL_BY_LIB=", "MOUNT_OSXFUSE_CALL_BY_LIB=", - "MOUNT_OSXFUSE_DAEMON_PATH="+os.Args[0], - "MOUNT_FUSEFS_DAEMON_PATH="+os.Args[0]) - - var out, errOut bytes.Buffer - cmd.Stdout = &out - cmd.Stderr = &errOut - - if err := cmd.Start(); err != nil { - f.Close() - return 0, err - } - go func() { - err := cmd.Wait() - if err != nil { - err = fmt.Errorf("mount_osxfusefs failed: %v. Stderr: %s, Stdout: %s", err, errOut.String(), out.String()) - } - - ready <- err - close(ready) - }() - - // The finalizer for f will close its fd so we return a dup. - defer f.Close() - return syscall.Dup(int(f.Fd())) -} - -func unmount(dir string, opts *MountOptions) error { - return syscall.Unmount(dir, 0) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/mount_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/mount_linux.go deleted file mode 100644 index df51f69c8..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/mount_linux.go +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "bytes" - "fmt" - "log" - "os" - "os/exec" - "path" - "strings" - "syscall" - "unsafe" -) - -func unixgramSocketpair() (l, r *os.File, err error) { - fd, err := syscall.Socketpair(syscall.AF_UNIX, syscall.SOCK_SEQPACKET, 0) - if err != nil { - return nil, nil, os.NewSyscallError("socketpair", - err.(syscall.Errno)) - } - l = os.NewFile(uintptr(fd[0]), "socketpair-half1") - r = os.NewFile(uintptr(fd[1]), "socketpair-half2") - return -} - -// Create a FUSE FS on the specified mount point without using -// fusermount. -func mountDirect(mountPoint string, opts *MountOptions, ready chan<- error) (fd int, err error) { - fd, err = syscall.Open("/dev/fuse", os.O_RDWR, 0) // use syscall.Open since we want an int fd - if err != nil { - return - } - - // managed to open dev/fuse, attempt to mount - source := opts.FsName - if source == "" { - source = opts.Name - } - - var flags uintptr - flags |= syscall.MS_NOSUID | syscall.MS_NODEV - - // some values we need to pass to mount, but override possible since opts.Options comes after - var r = []string{ - fmt.Sprintf("fd=%d", fd), - "rootmode=40000", - "user_id=0", - "group_id=0", - } - r = append(r, opts.Options...) - - if opts.AllowOther { - r = append(r, "allow_other") - } - - err = syscall.Mount(opts.FsName, mountPoint, "fuse."+opts.Name, opts.DirectMountFlags, strings.Join(r, ",")) - if err != nil { - syscall.Close(fd) - return - } - - // success - close(ready) - return -} - -// Create a FUSE FS on the specified mount point. The returned -// mount point is always absolute. -func mount(mountPoint string, opts *MountOptions, ready chan<- error) (fd int, err error) { - if opts.DirectMount { - fd, err := mountDirect(mountPoint, opts, ready) - if err == nil { - return fd, nil - } else if opts.Debug { - log.Printf("mount: failed to do direct mount: %s", err) - } - } - - local, remote, err := unixgramSocketpair() - if err != nil { - return - } - - defer local.Close() - defer remote.Close() - - bin, err := fusermountBinary() - if err != nil { - return 0, err - } - - cmd := []string{bin, mountPoint} - if s := opts.optionsStrings(); len(s) > 0 { - cmd = append(cmd, "-o", strings.Join(s, ",")) - } - proc, err := os.StartProcess(bin, - cmd, - &os.ProcAttr{ - Env: []string{"_FUSE_COMMFD=3"}, - Files: []*os.File{os.Stdin, os.Stdout, os.Stderr, remote}}) - - if err != nil { - return - } - - w, err := proc.Wait() - if err != nil { - return - } - if !w.Success() { - err = fmt.Errorf("fusermount exited with code %v\n", w.Sys()) - return - } - - fd, err = getConnection(local) - if err != nil { - return -1, err - } - - // golang sets CLOEXEC on file descriptors when they are - // acquired through normal operations (e.g. open). - // Buf for fd, we have to set CLOEXEC manually - syscall.CloseOnExec(fd) - - close(ready) - return fd, err -} - -func unmount(mountPoint string, opts *MountOptions) (err error) { - if opts.DirectMount { - // Attempt to directly unmount, if fails fallback to fusermount method - err := syscall.Unmount(mountPoint, 0) - if err == nil { - return nil - } - } - - bin, err := fusermountBinary() - if err != nil { - return err - } - errBuf := bytes.Buffer{} - cmd := exec.Command(bin, "-u", mountPoint) - cmd.Stderr = &errBuf - err = cmd.Run() - if errBuf.Len() > 0 { - return fmt.Errorf("%s (code %v)\n", - errBuf.String(), err) - } - return err -} - -func getConnection(local *os.File) (int, error) { - var data [4]byte - control := make([]byte, 4*256) - - // n, oobn, recvflags, from, errno - todo: error checking. - _, oobn, _, _, - err := syscall.Recvmsg( - int(local.Fd()), data[:], control[:], 0) - if err != nil { - return 0, err - } - - message := *(*syscall.Cmsghdr)(unsafe.Pointer(&control[0])) - fd := *(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&control[0])) + syscall.SizeofCmsghdr)) - - if message.Type != 1 { - return 0, fmt.Errorf("getConnection: recvmsg returned wrong control type: %d", message.Type) - } - if oobn <= syscall.SizeofCmsghdr { - return 0, fmt.Errorf("getConnection: too short control message. Length: %d", oobn) - } - if fd < 0 { - return 0, fmt.Errorf("getConnection: fd < 0: %d", fd) - } - return int(fd), nil -} - -// lookPathFallback - search binary in PATH and, if that fails, -// in fallbackDir. This is useful if PATH is possible empty. -func lookPathFallback(file string, fallbackDir string) (string, error) { - binPath, err := exec.LookPath(file) - if err == nil { - return binPath, nil - } - - abs := path.Join(fallbackDir, file) - return exec.LookPath(abs) -} - -func fusermountBinary() (string, error) { - return lookPathFallback("fusermount", "/bin") -} - -func umountBinary() (string, error) { - return lookPathFallback("umount", "/bin") -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/opcode.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/opcode.go deleted file mode 100644 index dfb4aff8c..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/opcode.go +++ /dev/null @@ -1,808 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "bytes" - "fmt" - "log" - "reflect" - "runtime" - "time" - "unsafe" -) - -const ( - _OP_LOOKUP = uint32(1) - _OP_FORGET = uint32(2) - _OP_GETATTR = uint32(3) - _OP_SETATTR = uint32(4) - _OP_READLINK = uint32(5) - _OP_SYMLINK = uint32(6) - _OP_MKNOD = uint32(8) - _OP_MKDIR = uint32(9) - _OP_UNLINK = uint32(10) - _OP_RMDIR = uint32(11) - _OP_RENAME = uint32(12) - _OP_LINK = uint32(13) - _OP_OPEN = uint32(14) - _OP_READ = uint32(15) - _OP_WRITE = uint32(16) - _OP_STATFS = uint32(17) - _OP_RELEASE = uint32(18) - _OP_FSYNC = uint32(20) - _OP_SETXATTR = uint32(21) - _OP_GETXATTR = uint32(22) - _OP_LISTXATTR = uint32(23) - _OP_REMOVEXATTR = uint32(24) - _OP_FLUSH = uint32(25) - _OP_INIT = uint32(26) - _OP_OPENDIR = uint32(27) - _OP_READDIR = uint32(28) - _OP_RELEASEDIR = uint32(29) - _OP_FSYNCDIR = uint32(30) - _OP_GETLK = uint32(31) - _OP_SETLK = uint32(32) - _OP_SETLKW = uint32(33) - _OP_ACCESS = uint32(34) - _OP_CREATE = uint32(35) - _OP_INTERRUPT = uint32(36) - _OP_BMAP = uint32(37) - _OP_DESTROY = uint32(38) - _OP_IOCTL = uint32(39) - _OP_POLL = uint32(40) - _OP_NOTIFY_REPLY = uint32(41) - _OP_BATCH_FORGET = uint32(42) - _OP_FALLOCATE = uint32(43) // protocol version 19. - _OP_READDIRPLUS = uint32(44) // protocol version 21. - _OP_RENAME2 = uint32(45) // protocol version 23. - _OP_LSEEK = uint32(46) // protocol version 24 - _OP_COPY_FILE_RANGE = uint32(47) // protocol version 28. - - // The following entries don't have to be compatible across Go-FUSE versions. - _OP_NOTIFY_INVAL_ENTRY = uint32(100) - _OP_NOTIFY_INVAL_INODE = uint32(101) - _OP_NOTIFY_STORE_CACHE = uint32(102) - _OP_NOTIFY_RETRIEVE_CACHE = uint32(103) - _OP_NOTIFY_DELETE = uint32(104) // protocol version 18 - - _OPCODE_COUNT = uint32(105) -) - -//////////////////////////////////////////////////////////////// - -func doInit(server *Server, req *request) { - input := (*InitIn)(req.inData) - if input.Major != _FUSE_KERNEL_VERSION { - log.Printf("Major versions does not match. Given %d, want %d\n", input.Major, _FUSE_KERNEL_VERSION) - req.status = EIO - return - } - if input.Minor < _MINIMUM_MINOR_VERSION { - log.Printf("Minor version is less than we support. Given %d, want at least %d\n", input.Minor, _MINIMUM_MINOR_VERSION) - req.status = EIO - return - } - - server.reqMu.Lock() - server.kernelSettings = *input - server.kernelSettings.Flags = input.Flags & (CAP_ASYNC_READ | CAP_BIG_WRITES | CAP_FILE_OPS | - CAP_READDIRPLUS | CAP_NO_OPEN_SUPPORT | CAP_PARALLEL_DIROPS) - - if server.opts.EnableLocks { - server.kernelSettings.Flags |= CAP_FLOCK_LOCKS | CAP_POSIX_LOCKS - } - - dataCacheMode := input.Flags & CAP_AUTO_INVAL_DATA - if server.opts.ExplicitDataCacheControl { - // we don't want CAP_AUTO_INVAL_DATA even if we cannot go into fully explicit mode - dataCacheMode = 0 - - explicit := input.Flags & CAP_EXPLICIT_INVAL_DATA - if explicit != 0 { - dataCacheMode = explicit - } - } - server.kernelSettings.Flags |= dataCacheMode - - if input.Minor >= 13 { - server.setSplice() - } - server.reqMu.Unlock() - - out := (*InitOut)(req.outData()) - *out = InitOut{ - Major: _FUSE_KERNEL_VERSION, - Minor: _OUR_MINOR_VERSION, - MaxReadAhead: input.MaxReadAhead, - Flags: server.kernelSettings.Flags, - MaxWrite: uint32(server.opts.MaxWrite), - CongestionThreshold: uint16(server.opts.MaxBackground * 3 / 4), - MaxBackground: uint16(server.opts.MaxBackground), - } - - if server.opts.MaxReadAhead != 0 && uint32(server.opts.MaxReadAhead) < out.MaxReadAhead { - out.MaxReadAhead = uint32(server.opts.MaxReadAhead) - } - if out.Minor > input.Minor { - out.Minor = input.Minor - } - - if out.Minor <= 22 { - tweaked := *req.handler - - // v8-v22 don't have TimeGran and further fields. - tweaked.OutputSize = 24 - req.handler = &tweaked - } - - req.status = OK -} - -func doOpen(server *Server, req *request) { - out := (*OpenOut)(req.outData()) - status := server.fileSystem.Open(req.cancel, (*OpenIn)(req.inData), out) - req.status = status - if status != OK { - return - } -} - -func doCreate(server *Server, req *request) { - out := (*CreateOut)(req.outData()) - status := server.fileSystem.Create(req.cancel, (*CreateIn)(req.inData), req.filenames[0], out) - req.status = status -} - -func doReadDir(server *Server, req *request) { - in := (*ReadIn)(req.inData) - buf := server.allocOut(req, in.Size) - out := NewDirEntryList(buf, uint64(in.Offset)) - - code := server.fileSystem.ReadDir(req.cancel, in, out) - req.flatData = out.bytes() - req.status = code -} - -func doReadDirPlus(server *Server, req *request) { - in := (*ReadIn)(req.inData) - buf := server.allocOut(req, in.Size) - out := NewDirEntryList(buf, uint64(in.Offset)) - - code := server.fileSystem.ReadDirPlus(req.cancel, in, out) - req.flatData = out.bytes() - req.status = code -} - -func doOpenDir(server *Server, req *request) { - out := (*OpenOut)(req.outData()) - status := server.fileSystem.OpenDir(req.cancel, (*OpenIn)(req.inData), out) - req.status = status -} - -func doSetattr(server *Server, req *request) { - out := (*AttrOut)(req.outData()) - req.status = server.fileSystem.SetAttr(req.cancel, (*SetAttrIn)(req.inData), out) -} - -func doWrite(server *Server, req *request) { - n, status := server.fileSystem.Write(req.cancel, (*WriteIn)(req.inData), req.arg) - o := (*WriteOut)(req.outData()) - o.Size = n - req.status = status -} - -func doNotifyReply(server *Server, req *request) { - reply := (*NotifyRetrieveIn)(req.inData) - server.retrieveMu.Lock() - reading := server.retrieveTab[reply.Unique] - delete(server.retrieveTab, reply.Unique) - server.retrieveMu.Unlock() - - badf := func(format string, argv ...interface{}) { - log.Printf("notify reply: "+format, argv...) - } - - if reading == nil { - badf("unexpected unique - ignoring") - return - } - - reading.n = 0 - reading.st = EIO - defer close(reading.ready) - - if reading.nodeid != reply.NodeId { - badf("inode mismatch: expected %s, got %s", reading.nodeid, reply.NodeId) - return - } - - if reading.offset != reply.Offset { - badf("offset mismatch: expected @%d, got @%d", reading.offset, reply.Offset) - return - } - - if len(reading.dest) < len(req.arg) { - badf("too much data: requested %db, got %db (will use only %db)", len(reading.dest), len(req.arg), len(reading.dest)) - } - - reading.n = copy(reading.dest, req.arg) - reading.st = OK -} - -const _SECURITY_CAPABILITY = "security.capability" -const _SECURITY_ACL = "system.posix_acl_access" -const _SECURITY_ACL_DEFAULT = "system.posix_acl_default" - -func doGetXAttr(server *Server, req *request) { - if server.opts.DisableXAttrs { - req.status = ENOSYS - return - } - - if server.opts.IgnoreSecurityLabels && req.inHeader.Opcode == _OP_GETXATTR { - fn := req.filenames[0] - if fn == _SECURITY_CAPABILITY || fn == _SECURITY_ACL_DEFAULT || - fn == _SECURITY_ACL { - req.status = ENOATTR - return - } - } - - input := (*GetXAttrIn)(req.inData) - - req.flatData = server.allocOut(req, input.Size) - out := (*GetXAttrOut)(req.outData()) - - var n uint32 - switch req.inHeader.Opcode { - case _OP_GETXATTR: - n, req.status = server.fileSystem.GetXAttr(req.cancel, req.inHeader, req.filenames[0], req.flatData) - case _OP_LISTXATTR: - n, req.status = server.fileSystem.ListXAttr(req.cancel, req.inHeader, req.flatData) - default: - req.status = ENOSYS - } - - if input.Size == 0 && req.status == ERANGE { - // For input.size==0, returning ERANGE is an error. - req.status = OK - out.Size = n - } else if req.status.Ok() { - // ListXAttr called with an empty buffer returns the current size of - // the list but does not touch the buffer (see man 2 listxattr). - if len(req.flatData) > 0 { - req.flatData = req.flatData[:n] - } - out.Size = n - } else { - req.flatData = req.flatData[:0] - } -} - -func doGetAttr(server *Server, req *request) { - out := (*AttrOut)(req.outData()) - s := server.fileSystem.GetAttr(req.cancel, (*GetAttrIn)(req.inData), out) - req.status = s -} - -// doForget - forget one NodeId -func doForget(server *Server, req *request) { - if !server.opts.RememberInodes { - server.fileSystem.Forget(req.inHeader.NodeId, (*ForgetIn)(req.inData).Nlookup) - } -} - -// doBatchForget - forget a list of NodeIds -func doBatchForget(server *Server, req *request) { - in := (*_BatchForgetIn)(req.inData) - wantBytes := uintptr(in.Count) * unsafe.Sizeof(_ForgetOne{}) - if uintptr(len(req.arg)) < wantBytes { - // We have no return value to complain, so log an error. - log.Printf("Too few bytes for batch forget. Got %d bytes, want %d (%d entries)", - len(req.arg), wantBytes, in.Count) - } - - h := &reflect.SliceHeader{ - Data: uintptr(unsafe.Pointer(&req.arg[0])), - Len: int(in.Count), - Cap: int(in.Count), - } - - forgets := *(*[]_ForgetOne)(unsafe.Pointer(h)) - for i, f := range forgets { - if server.opts.Debug { - log.Printf("doBatchForget: rx %d %d/%d: FORGET i%d {Nlookup=%d}", - req.inHeader.Unique, i+1, len(forgets), f.NodeId, f.Nlookup) - } - if f.NodeId == pollHackInode { - continue - } - server.fileSystem.Forget(f.NodeId, f.Nlookup) - } -} - -func doReadlink(server *Server, req *request) { - req.flatData, req.status = server.fileSystem.Readlink(req.cancel, req.inHeader) -} - -func doLookup(server *Server, req *request) { - out := (*EntryOut)(req.outData()) - s := server.fileSystem.Lookup(req.cancel, req.inHeader, req.filenames[0], out) - req.status = s -} - -func doMknod(server *Server, req *request) { - out := (*EntryOut)(req.outData()) - - req.status = server.fileSystem.Mknod(req.cancel, (*MknodIn)(req.inData), req.filenames[0], out) -} - -func doMkdir(server *Server, req *request) { - out := (*EntryOut)(req.outData()) - req.status = server.fileSystem.Mkdir(req.cancel, (*MkdirIn)(req.inData), req.filenames[0], out) -} - -func doUnlink(server *Server, req *request) { - req.status = server.fileSystem.Unlink(req.cancel, req.inHeader, req.filenames[0]) -} - -func doRmdir(server *Server, req *request) { - req.status = server.fileSystem.Rmdir(req.cancel, req.inHeader, req.filenames[0]) -} - -func doLink(server *Server, req *request) { - out := (*EntryOut)(req.outData()) - req.status = server.fileSystem.Link(req.cancel, (*LinkIn)(req.inData), req.filenames[0], out) -} - -func doRead(server *Server, req *request) { - in := (*ReadIn)(req.inData) - buf := server.allocOut(req, in.Size) - - req.readResult, req.status = server.fileSystem.Read(req.cancel, in, buf) - if fd, ok := req.readResult.(*readResultFd); ok { - req.fdData = fd - req.flatData = nil - } else if req.readResult != nil && req.status.Ok() { - req.flatData, req.status = req.readResult.Bytes(buf) - } -} - -func doFlush(server *Server, req *request) { - req.status = server.fileSystem.Flush(req.cancel, (*FlushIn)(req.inData)) -} - -func doRelease(server *Server, req *request) { - server.fileSystem.Release(req.cancel, (*ReleaseIn)(req.inData)) -} - -func doFsync(server *Server, req *request) { - req.status = server.fileSystem.Fsync(req.cancel, (*FsyncIn)(req.inData)) -} - -func doReleaseDir(server *Server, req *request) { - server.fileSystem.ReleaseDir((*ReleaseIn)(req.inData)) -} - -func doFsyncDir(server *Server, req *request) { - req.status = server.fileSystem.FsyncDir(req.cancel, (*FsyncIn)(req.inData)) -} - -func doSetXAttr(server *Server, req *request) { - splits := bytes.SplitN(req.arg, []byte{0}, 2) - req.status = server.fileSystem.SetXAttr(req.cancel, (*SetXAttrIn)(req.inData), string(splits[0]), splits[1]) -} - -func doRemoveXAttr(server *Server, req *request) { - req.status = server.fileSystem.RemoveXAttr(req.cancel, req.inHeader, req.filenames[0]) -} - -func doAccess(server *Server, req *request) { - req.status = server.fileSystem.Access(req.cancel, (*AccessIn)(req.inData)) -} - -func doSymlink(server *Server, req *request) { - out := (*EntryOut)(req.outData()) - req.status = server.fileSystem.Symlink(req.cancel, req.inHeader, req.filenames[1], req.filenames[0], out) -} - -func doRename(server *Server, req *request) { - in1 := (*Rename1In)(req.inData) - in := RenameIn{ - InHeader: in1.InHeader, - Newdir: in1.Newdir, - } - req.status = server.fileSystem.Rename(req.cancel, &in, req.filenames[0], req.filenames[1]) -} - -func doRename2(server *Server, req *request) { - req.status = server.fileSystem.Rename(req.cancel, (*RenameIn)(req.inData), req.filenames[0], req.filenames[1]) -} - -func doStatFs(server *Server, req *request) { - out := (*StatfsOut)(req.outData()) - req.status = server.fileSystem.StatFs(req.cancel, req.inHeader, out) - if req.status == ENOSYS && runtime.GOOS == "darwin" { - // OSX FUSE requires Statfs to be implemented for the - // mount to succeed. - *out = StatfsOut{} - req.status = OK - } -} - -func doIoctl(server *Server, req *request) { - req.status = ENOSYS -} - -func doDestroy(server *Server, req *request) { - req.status = OK -} - -func doFallocate(server *Server, req *request) { - req.status = server.fileSystem.Fallocate(req.cancel, (*FallocateIn)(req.inData)) -} - -func doGetLk(server *Server, req *request) { - req.status = server.fileSystem.GetLk(req.cancel, (*LkIn)(req.inData), (*LkOut)(req.outData())) -} - -func doSetLk(server *Server, req *request) { - req.status = server.fileSystem.SetLk(req.cancel, (*LkIn)(req.inData)) -} - -func doSetLkw(server *Server, req *request) { - req.status = server.fileSystem.SetLkw(req.cancel, (*LkIn)(req.inData)) -} - -func doLseek(server *Server, req *request) { - in := (*LseekIn)(req.inData) - out := (*LseekOut)(req.outData()) - req.status = server.fileSystem.Lseek(req.cancel, in, out) -} - -func doCopyFileRange(server *Server, req *request) { - in := (*CopyFileRangeIn)(req.inData) - out := (*WriteOut)(req.outData()) - - out.Size, req.status = server.fileSystem.CopyFileRange(req.cancel, in) -} - -func doInterrupt(server *Server, req *request) { - input := (*InterruptIn)(req.inData) - server.reqMu.Lock() - defer server.reqMu.Unlock() - - // This is slow, but this operation is rare. - for _, inflight := range server.reqInflight { - if input.Unique == inflight.inHeader.Unique && !inflight.interrupted { - close(inflight.cancel) - inflight.interrupted = true - req.status = OK - return - } - } - - // not found; wait for a bit - time.Sleep(10 * time.Microsecond) - req.status = EAGAIN -} - -//////////////////////////////////////////////////////////////// - -type operationFunc func(*Server, *request) -type castPointerFunc func(unsafe.Pointer) interface{} - -type operationHandler struct { - Name string - Func operationFunc - InputSize uintptr - OutputSize uintptr - DecodeIn castPointerFunc - DecodeOut castPointerFunc - FileNames int - FileNameOut bool -} - -var operationHandlers []*operationHandler - -func operationName(op uint32) string { - h := getHandler(op) - if h == nil { - return "unknown" - } - return h.Name -} - -func getHandler(o uint32) *operationHandler { - if o >= _OPCODE_COUNT { - return nil - } - return operationHandlers[o] -} - -var maxInputSize uintptr - -func init() { - operationHandlers = make([]*operationHandler, _OPCODE_COUNT) - for i := range operationHandlers { - operationHandlers[i] = &operationHandler{Name: fmt.Sprintf("OPCODE-%d", i)} - } - - fileOps := []uint32{_OP_READLINK, _OP_NOTIFY_INVAL_ENTRY, _OP_NOTIFY_DELETE} - for _, op := range fileOps { - operationHandlers[op].FileNameOut = true - } - - maxInputSize = 0 - for op, sz := range map[uint32]uintptr{ - _OP_FORGET: unsafe.Sizeof(ForgetIn{}), - _OP_BATCH_FORGET: unsafe.Sizeof(_BatchForgetIn{}), - _OP_GETATTR: unsafe.Sizeof(GetAttrIn{}), - _OP_SETATTR: unsafe.Sizeof(SetAttrIn{}), - _OP_MKNOD: unsafe.Sizeof(MknodIn{}), - _OP_MKDIR: unsafe.Sizeof(MkdirIn{}), - _OP_RENAME: unsafe.Sizeof(Rename1In{}), - _OP_LINK: unsafe.Sizeof(LinkIn{}), - _OP_OPEN: unsafe.Sizeof(OpenIn{}), - _OP_READ: unsafe.Sizeof(ReadIn{}), - _OP_WRITE: unsafe.Sizeof(WriteIn{}), - _OP_RELEASE: unsafe.Sizeof(ReleaseIn{}), - _OP_FSYNC: unsafe.Sizeof(FsyncIn{}), - _OP_SETXATTR: unsafe.Sizeof(SetXAttrIn{}), - _OP_GETXATTR: unsafe.Sizeof(GetXAttrIn{}), - _OP_LISTXATTR: unsafe.Sizeof(GetXAttrIn{}), - _OP_FLUSH: unsafe.Sizeof(FlushIn{}), - _OP_INIT: unsafe.Sizeof(InitIn{}), - _OP_OPENDIR: unsafe.Sizeof(OpenIn{}), - _OP_READDIR: unsafe.Sizeof(ReadIn{}), - _OP_RELEASEDIR: unsafe.Sizeof(ReleaseIn{}), - _OP_FSYNCDIR: unsafe.Sizeof(FsyncIn{}), - _OP_GETLK: unsafe.Sizeof(LkIn{}), - _OP_SETLK: unsafe.Sizeof(LkIn{}), - _OP_SETLKW: unsafe.Sizeof(LkIn{}), - _OP_ACCESS: unsafe.Sizeof(AccessIn{}), - _OP_CREATE: unsafe.Sizeof(CreateIn{}), - _OP_INTERRUPT: unsafe.Sizeof(InterruptIn{}), - _OP_BMAP: unsafe.Sizeof(_BmapIn{}), - _OP_IOCTL: unsafe.Sizeof(_IoctlIn{}), - _OP_POLL: unsafe.Sizeof(_PollIn{}), - _OP_NOTIFY_REPLY: unsafe.Sizeof(NotifyRetrieveIn{}), - _OP_FALLOCATE: unsafe.Sizeof(FallocateIn{}), - _OP_READDIRPLUS: unsafe.Sizeof(ReadIn{}), - _OP_RENAME2: unsafe.Sizeof(RenameIn{}), - _OP_LSEEK: unsafe.Sizeof(LseekIn{}), - _OP_COPY_FILE_RANGE: unsafe.Sizeof(CopyFileRangeIn{}), - } { - operationHandlers[op].InputSize = sz - if sz > maxInputSize { - maxInputSize = sz - } - } - - for op, sz := range map[uint32]uintptr{ - _OP_LOOKUP: unsafe.Sizeof(EntryOut{}), - _OP_GETATTR: unsafe.Sizeof(AttrOut{}), - _OP_SETATTR: unsafe.Sizeof(AttrOut{}), - _OP_SYMLINK: unsafe.Sizeof(EntryOut{}), - _OP_MKNOD: unsafe.Sizeof(EntryOut{}), - _OP_MKDIR: unsafe.Sizeof(EntryOut{}), - _OP_LINK: unsafe.Sizeof(EntryOut{}), - _OP_OPEN: unsafe.Sizeof(OpenOut{}), - _OP_WRITE: unsafe.Sizeof(WriteOut{}), - _OP_STATFS: unsafe.Sizeof(StatfsOut{}), - _OP_GETXATTR: unsafe.Sizeof(GetXAttrOut{}), - _OP_LISTXATTR: unsafe.Sizeof(GetXAttrOut{}), - _OP_INIT: unsafe.Sizeof(InitOut{}), - _OP_OPENDIR: unsafe.Sizeof(OpenOut{}), - _OP_GETLK: unsafe.Sizeof(LkOut{}), - _OP_CREATE: unsafe.Sizeof(CreateOut{}), - _OP_BMAP: unsafe.Sizeof(_BmapOut{}), - _OP_IOCTL: unsafe.Sizeof(_IoctlOut{}), - _OP_POLL: unsafe.Sizeof(_PollOut{}), - _OP_NOTIFY_INVAL_ENTRY: unsafe.Sizeof(NotifyInvalEntryOut{}), - _OP_NOTIFY_INVAL_INODE: unsafe.Sizeof(NotifyInvalInodeOut{}), - _OP_NOTIFY_STORE_CACHE: unsafe.Sizeof(NotifyStoreOut{}), - _OP_NOTIFY_RETRIEVE_CACHE: unsafe.Sizeof(NotifyRetrieveOut{}), - _OP_NOTIFY_DELETE: unsafe.Sizeof(NotifyInvalDeleteOut{}), - _OP_LSEEK: unsafe.Sizeof(LseekOut{}), - _OP_COPY_FILE_RANGE: unsafe.Sizeof(WriteOut{}), - } { - operationHandlers[op].OutputSize = sz - } - - for op, v := range map[uint32]string{ - _OP_LOOKUP: "LOOKUP", - _OP_FORGET: "FORGET", - _OP_BATCH_FORGET: "BATCH_FORGET", - _OP_GETATTR: "GETATTR", - _OP_SETATTR: "SETATTR", - _OP_READLINK: "READLINK", - _OP_SYMLINK: "SYMLINK", - _OP_MKNOD: "MKNOD", - _OP_MKDIR: "MKDIR", - _OP_UNLINK: "UNLINK", - _OP_RMDIR: "RMDIR", - _OP_RENAME: "RENAME", - _OP_LINK: "LINK", - _OP_OPEN: "OPEN", - _OP_READ: "READ", - _OP_WRITE: "WRITE", - _OP_STATFS: "STATFS", - _OP_RELEASE: "RELEASE", - _OP_FSYNC: "FSYNC", - _OP_SETXATTR: "SETXATTR", - _OP_GETXATTR: "GETXATTR", - _OP_LISTXATTR: "LISTXATTR", - _OP_REMOVEXATTR: "REMOVEXATTR", - _OP_FLUSH: "FLUSH", - _OP_INIT: "INIT", - _OP_OPENDIR: "OPENDIR", - _OP_READDIR: "READDIR", - _OP_RELEASEDIR: "RELEASEDIR", - _OP_FSYNCDIR: "FSYNCDIR", - _OP_GETLK: "GETLK", - _OP_SETLK: "SETLK", - _OP_SETLKW: "SETLKW", - _OP_ACCESS: "ACCESS", - _OP_CREATE: "CREATE", - _OP_INTERRUPT: "INTERRUPT", - _OP_BMAP: "BMAP", - _OP_DESTROY: "DESTROY", - _OP_IOCTL: "IOCTL", - _OP_POLL: "POLL", - _OP_NOTIFY_REPLY: "NOTIFY_REPLY", - _OP_NOTIFY_INVAL_ENTRY: "NOTIFY_INVAL_ENTRY", - _OP_NOTIFY_INVAL_INODE: "NOTIFY_INVAL_INODE", - _OP_NOTIFY_STORE_CACHE: "NOTIFY_STORE", - _OP_NOTIFY_RETRIEVE_CACHE: "NOTIFY_RETRIEVE", - _OP_NOTIFY_DELETE: "NOTIFY_DELETE", - _OP_FALLOCATE: "FALLOCATE", - _OP_READDIRPLUS: "READDIRPLUS", - _OP_RENAME2: "RENAME2", - _OP_LSEEK: "LSEEK", - _OP_COPY_FILE_RANGE: "COPY_FILE_RANGE", - } { - operationHandlers[op].Name = v - } - - for op, v := range map[uint32]operationFunc{ - _OP_OPEN: doOpen, - _OP_READDIR: doReadDir, - _OP_WRITE: doWrite, - _OP_OPENDIR: doOpenDir, - _OP_CREATE: doCreate, - _OP_SETATTR: doSetattr, - _OP_GETXATTR: doGetXAttr, - _OP_LISTXATTR: doGetXAttr, - _OP_GETATTR: doGetAttr, - _OP_FORGET: doForget, - _OP_BATCH_FORGET: doBatchForget, - _OP_READLINK: doReadlink, - _OP_INIT: doInit, - _OP_LOOKUP: doLookup, - _OP_MKNOD: doMknod, - _OP_MKDIR: doMkdir, - _OP_UNLINK: doUnlink, - _OP_RMDIR: doRmdir, - _OP_LINK: doLink, - _OP_READ: doRead, - _OP_FLUSH: doFlush, - _OP_RELEASE: doRelease, - _OP_FSYNC: doFsync, - _OP_RELEASEDIR: doReleaseDir, - _OP_FSYNCDIR: doFsyncDir, - _OP_SETXATTR: doSetXAttr, - _OP_REMOVEXATTR: doRemoveXAttr, - _OP_GETLK: doGetLk, - _OP_SETLK: doSetLk, - _OP_SETLKW: doSetLkw, - _OP_ACCESS: doAccess, - _OP_SYMLINK: doSymlink, - _OP_RENAME: doRename, - _OP_STATFS: doStatFs, - _OP_IOCTL: doIoctl, - _OP_DESTROY: doDestroy, - _OP_NOTIFY_REPLY: doNotifyReply, - _OP_FALLOCATE: doFallocate, - _OP_READDIRPLUS: doReadDirPlus, - _OP_RENAME2: doRename2, - _OP_INTERRUPT: doInterrupt, - _OP_COPY_FILE_RANGE: doCopyFileRange, - _OP_LSEEK: doLseek, - } { - operationHandlers[op].Func = v - } - - // Outputs. - for op, f := range map[uint32]castPointerFunc{ - _OP_LOOKUP: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) }, - _OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*OpenOut)(ptr) }, - _OP_OPENDIR: func(ptr unsafe.Pointer) interface{} { return (*OpenOut)(ptr) }, - _OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*AttrOut)(ptr) }, - _OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateOut)(ptr) }, - _OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) }, - _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*AttrOut)(ptr) }, - _OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*InitOut)(ptr) }, - _OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) }, - _OP_NOTIFY_INVAL_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalEntryOut)(ptr) }, - _OP_NOTIFY_INVAL_INODE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalInodeOut)(ptr) }, - _OP_NOTIFY_STORE_CACHE: func(ptr unsafe.Pointer) interface{} { return (*NotifyStoreOut)(ptr) }, - _OP_NOTIFY_RETRIEVE_CACHE: func(ptr unsafe.Pointer) interface{} { return (*NotifyRetrieveOut)(ptr) }, - _OP_NOTIFY_DELETE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalDeleteOut)(ptr) }, - _OP_STATFS: func(ptr unsafe.Pointer) interface{} { return (*StatfsOut)(ptr) }, - _OP_SYMLINK: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) }, - _OP_GETLK: func(ptr unsafe.Pointer) interface{} { return (*LkOut)(ptr) }, - _OP_LSEEK: func(ptr unsafe.Pointer) interface{} { return (*LseekOut)(ptr) }, - _OP_COPY_FILE_RANGE: func(ptr unsafe.Pointer) interface{} { return (*WriteOut)(ptr) }, - } { - operationHandlers[op].DecodeOut = f - } - - // Inputs. - for op, f := range map[uint32]castPointerFunc{ - _OP_FLUSH: func(ptr unsafe.Pointer) interface{} { return (*FlushIn)(ptr) }, - _OP_GETATTR: func(ptr unsafe.Pointer) interface{} { return (*GetAttrIn)(ptr) }, - _OP_SETXATTR: func(ptr unsafe.Pointer) interface{} { return (*SetXAttrIn)(ptr) }, - _OP_GETXATTR: func(ptr unsafe.Pointer) interface{} { return (*GetXAttrIn)(ptr) }, - _OP_LISTXATTR: func(ptr unsafe.Pointer) interface{} { return (*GetXAttrIn)(ptr) }, - _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*SetAttrIn)(ptr) }, - _OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*InitIn)(ptr) }, - _OP_IOCTL: func(ptr unsafe.Pointer) interface{} { return (*_IoctlIn)(ptr) }, - _OP_OPEN: func(ptr unsafe.Pointer) interface{} { return (*OpenIn)(ptr) }, - _OP_MKNOD: func(ptr unsafe.Pointer) interface{} { return (*MknodIn)(ptr) }, - _OP_CREATE: func(ptr unsafe.Pointer) interface{} { return (*CreateIn)(ptr) }, - _OP_READ: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, - _OP_WRITE: func(ptr unsafe.Pointer) interface{} { return (*WriteIn)(ptr) }, - _OP_READDIR: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, - _OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*AccessIn)(ptr) }, - _OP_FORGET: func(ptr unsafe.Pointer) interface{} { return (*ForgetIn)(ptr) }, - _OP_BATCH_FORGET: func(ptr unsafe.Pointer) interface{} { return (*_BatchForgetIn)(ptr) }, - _OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*LinkIn)(ptr) }, - _OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*MkdirIn)(ptr) }, - _OP_RELEASE: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) }, - _OP_RELEASEDIR: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) }, - _OP_FALLOCATE: func(ptr unsafe.Pointer) interface{} { return (*FallocateIn)(ptr) }, - _OP_NOTIFY_REPLY: func(ptr unsafe.Pointer) interface{} { return (*NotifyRetrieveIn)(ptr) }, - _OP_READDIRPLUS: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) }, - _OP_RENAME: func(ptr unsafe.Pointer) interface{} { return (*Rename1In)(ptr) }, - _OP_GETLK: func(ptr unsafe.Pointer) interface{} { return (*LkIn)(ptr) }, - _OP_SETLK: func(ptr unsafe.Pointer) interface{} { return (*LkIn)(ptr) }, - _OP_SETLKW: func(ptr unsafe.Pointer) interface{} { return (*LkIn)(ptr) }, - _OP_RENAME2: func(ptr unsafe.Pointer) interface{} { return (*RenameIn)(ptr) }, - _OP_INTERRUPT: func(ptr unsafe.Pointer) interface{} { return (*InterruptIn)(ptr) }, - _OP_LSEEK: func(ptr unsafe.Pointer) interface{} { return (*LseekIn)(ptr) }, - _OP_COPY_FILE_RANGE: func(ptr unsafe.Pointer) interface{} { return (*CopyFileRangeIn)(ptr) }, - } { - operationHandlers[op].DecodeIn = f - } - - // File name args. - for op, count := range map[uint32]int{ - _OP_CREATE: 1, - _OP_SETXATTR: 1, - _OP_GETXATTR: 1, - _OP_LINK: 1, - _OP_LOOKUP: 1, - _OP_MKDIR: 1, - _OP_MKNOD: 1, - _OP_REMOVEXATTR: 1, - _OP_RENAME: 2, - _OP_RENAME2: 2, - _OP_RMDIR: 1, - _OP_SYMLINK: 2, - _OP_UNLINK: 1, - } { - operationHandlers[op].FileNames = count - } - - var r request - sizeOfOutHeader := unsafe.Sizeof(OutHeader{}) - for code, h := range operationHandlers { - if h.OutputSize+sizeOfOutHeader > unsafe.Sizeof(r.outBuf) { - log.Panicf("request output buffer too small: code %v, sz %d + %d %v", code, h.OutputSize, sizeOfOutHeader, h) - } - } -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/poll.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/poll.go deleted file mode 100644 index 5aaefb5ae..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/poll.go +++ /dev/null @@ -1,43 +0,0 @@ -package fuse - -// Go 1.9 introduces polling for file I/O. The implementation causes -// the runtime's epoll to take up the last GOMAXPROCS slot, and if -// that happens, we won't have any threads left to service FUSE's -// _OP_POLL request. Prevent this by forcing _OP_POLL to happen, so we -// can say ENOSYS and prevent further _OP_POLL requests. -const pollHackName = ".go-fuse-epoll-hack" -const pollHackInode = ^uint64(0) - -func doPollHackLookup(ms *Server, req *request) { - attr := Attr{ - Ino: pollHackInode, - Mode: S_IFREG | 0644, - Nlink: 1, - } - switch req.inHeader.Opcode { - case _OP_CREATE: - out := (*CreateOut)(req.outData()) - out.EntryOut = EntryOut{ - NodeId: pollHackInode, - Attr: attr, - } - out.OpenOut = OpenOut{ - Fh: pollHackInode, - } - req.status = OK - case _OP_LOOKUP: - out := (*EntryOut)(req.outData()) - *out = EntryOut{} - req.status = ENOENT - case _OP_GETATTR: - out := (*AttrOut)(req.outData()) - out.Attr = attr - req.status = OK - case _OP_POLL: - req.status = ENOSYS - default: - // We want to avoid switching off features through our - // poll hack, so don't use ENOSYS - req.status = ERANGE - } -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/poll_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/poll_darwin.go deleted file mode 100644 index 84cc980b0..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/poll_darwin.go +++ /dev/null @@ -1,49 +0,0 @@ -package fuse - -import ( - "path/filepath" - "syscall" - "unsafe" -) - -type pollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -func sysPoll(fds []pollFd, timeout int) (n int, err error) { - r0, _, e1 := syscall.Syscall(syscall.SYS_POLL, uintptr(unsafe.Pointer(&fds[0])), - uintptr(len(fds)), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = syscall.Errno(e1) - } - return n, err -} - -func pollHack(mountPoint string) error { - const ( - POLLIN = 0x1 - POLLPRI = 0x2 - POLLOUT = 0x4 - POLLRDHUP = 0x2000 - POLLERR = 0x8 - POLLHUP = 0x10 - ) - - fd, err := syscall.Open(filepath.Join(mountPoint, pollHackName), syscall.O_CREAT|syscall.O_TRUNC|syscall.O_RDWR, 0644) - if err != nil { - return err - } - pollData := []pollFd{{ - Fd: int32(fd), - Events: POLLIN | POLLPRI | POLLOUT, - }} - - // Trigger _OP_POLL, so we can say ENOSYS. We don't care about - // the return value. - sysPoll(pollData, 0) - syscall.Close(fd) - return nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/poll_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/poll_linux.go deleted file mode 100644 index 6b8924a29..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/poll_linux.go +++ /dev/null @@ -1,25 +0,0 @@ -package fuse - -import ( - "path/filepath" - "syscall" - - "golang.org/x/sys/unix" -) - -func pollHack(mountPoint string) error { - fd, err := syscall.Creat(filepath.Join(mountPoint, pollHackName), syscall.O_CREAT) - if err != nil { - return err - } - pollData := []unix.PollFd{{ - Fd: int32(fd), - Events: unix.POLLIN | unix.POLLPRI | unix.POLLOUT, - }} - - // Trigger _OP_POLL, so we can say ENOSYS. We don't care about - // the return value. - unix.Poll(pollData, 0) - syscall.Close(fd) - return nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/print.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/print.go deleted file mode 100644 index d0a0223d6..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/print.go +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "fmt" - "os" - "strings" - "syscall" -) - -var ( - writeFlagNames = map[int64]string{ - WRITE_CACHE: "CACHE", - WRITE_LOCKOWNER: "LOCKOWNER", - } - readFlagNames = map[int64]string{ - READ_LOCKOWNER: "LOCKOWNER", - } - initFlagNames = map[int64]string{ - CAP_ASYNC_READ: "ASYNC_READ", - CAP_POSIX_LOCKS: "POSIX_LOCKS", - CAP_FILE_OPS: "FILE_OPS", - CAP_ATOMIC_O_TRUNC: "ATOMIC_O_TRUNC", - CAP_EXPORT_SUPPORT: "EXPORT_SUPPORT", - CAP_BIG_WRITES: "BIG_WRITES", - CAP_DONT_MASK: "DONT_MASK", - CAP_SPLICE_WRITE: "SPLICE_WRITE", - CAP_SPLICE_MOVE: "SPLICE_MOVE", - CAP_SPLICE_READ: "SPLICE_READ", - CAP_FLOCK_LOCKS: "FLOCK_LOCKS", - CAP_IOCTL_DIR: "IOCTL_DIR", - CAP_AUTO_INVAL_DATA: "AUTO_INVAL_DATA", - CAP_READDIRPLUS: "READDIRPLUS", - CAP_READDIRPLUS_AUTO: "READDIRPLUS_AUTO", - CAP_ASYNC_DIO: "ASYNC_DIO", - CAP_WRITEBACK_CACHE: "WRITEBACK_CACHE", - CAP_NO_OPEN_SUPPORT: "NO_OPEN_SUPPORT", - CAP_PARALLEL_DIROPS: "PARALLEL_DIROPS", - CAP_POSIX_ACL: "POSIX_ACL", - CAP_HANDLE_KILLPRIV: "HANDLE_KILLPRIV", - CAP_ABORT_ERROR: "ABORT_ERROR", - CAP_MAX_PAGES: "MAX_PAGES", - CAP_CACHE_SYMLINKS: "CACHE_SYMLINKS", - CAP_NO_OPENDIR_SUPPORT: "NO_OPENDIR_SUPPORT", - CAP_EXPLICIT_INVAL_DATA: "EXPLICIT_INVAL_DATA", - } - releaseFlagNames = map[int64]string{ - RELEASE_FLUSH: "FLUSH", - } - openFlagNames = map[int64]string{ - int64(os.O_WRONLY): "WRONLY", - int64(os.O_RDWR): "RDWR", - int64(os.O_APPEND): "APPEND", - int64(syscall.O_ASYNC): "ASYNC", - int64(os.O_CREATE): "CREAT", - int64(os.O_EXCL): "EXCL", - int64(syscall.O_NOCTTY): "NOCTTY", - int64(syscall.O_NONBLOCK): "NONBLOCK", - int64(os.O_SYNC): "SYNC", - int64(os.O_TRUNC): "TRUNC", - - int64(syscall.O_CLOEXEC): "CLOEXEC", - int64(syscall.O_DIRECTORY): "DIRECTORY", - } - fuseOpenFlagNames = map[int64]string{ - FOPEN_DIRECT_IO: "DIRECT", - FOPEN_KEEP_CACHE: "CACHE", - FOPEN_NONSEEKABLE: "NONSEEK", - FOPEN_CACHE_DIR: "CACHE_DIR", - FOPEN_STREAM: "STREAM", - } - accessFlagName = map[int64]string{ - X_OK: "x", - W_OK: "w", - R_OK: "r", - } -) - -func flagString(names map[int64]string, fl int64, def string) string { - s := []string{} - for k, v := range names { - if fl&k != 0 { - s = append(s, v) - fl ^= k - } - } - if len(s) == 0 && def != "" { - s = []string{def} - } - if fl != 0 { - s = append(s, fmt.Sprintf("0x%x", fl)) - } - - return strings.Join(s, ",") -} - -func (in *ForgetIn) string() string { - return fmt.Sprintf("{Nlookup=%d}", in.Nlookup) -} - -func (in *_BatchForgetIn) string() string { - return fmt.Sprintf("{Count=%d}", in.Count) -} - -func (in *MkdirIn) string() string { - return fmt.Sprintf("{0%o (0%o)}", in.Mode, in.Umask) -} - -func (in *Rename1In) string() string { - return fmt.Sprintf("{i%d}", in.Newdir) -} - -func (in *RenameIn) string() string { - return fmt.Sprintf("{i%d %x}", in.Newdir, in.Flags) -} - -func (in *SetAttrIn) string() string { - s := []string{} - if in.Valid&FATTR_MODE != 0 { - s = append(s, fmt.Sprintf("mode 0%o", in.Mode)) - } - if in.Valid&FATTR_UID != 0 { - s = append(s, fmt.Sprintf("uid %d", in.Uid)) - } - if in.Valid&FATTR_GID != 0 { - s = append(s, fmt.Sprintf("gid %d", in.Gid)) - } - if in.Valid&FATTR_SIZE != 0 { - s = append(s, fmt.Sprintf("size %d", in.Size)) - } - if in.Valid&FATTR_ATIME != 0 { - s = append(s, fmt.Sprintf("atime %d.%09d", in.Atime, in.Atimensec)) - } - if in.Valid&FATTR_MTIME != 0 { - s = append(s, fmt.Sprintf("mtime %d.%09d", in.Mtime, in.Mtimensec)) - } - if in.Valid&FATTR_FH != 0 { - s = append(s, fmt.Sprintf("fh %d", in.Fh)) - } - // TODO - FATTR_ATIME_NOW = (1 << 7), FATTR_MTIME_NOW = (1 << 8), FATTR_LOCKOWNER = (1 << 9) - return fmt.Sprintf("{%s}", strings.Join(s, ", ")) -} - -func (in *ReleaseIn) string() string { - return fmt.Sprintf("{Fh %d %s %s L%d}", - in.Fh, flagString(openFlagNames, int64(in.Flags), ""), - flagString(releaseFlagNames, int64(in.ReleaseFlags), ""), - in.LockOwner) -} - -func (in *OpenIn) string() string { - return fmt.Sprintf("{%s}", flagString(openFlagNames, int64(in.Flags), "O_RDONLY")) -} - -func (in *OpenOut) string() string { - return fmt.Sprintf("{Fh %d %s}", in.Fh, - flagString(fuseOpenFlagNames, int64(in.OpenFlags), "")) -} - -func (in *InitIn) string() string { - return fmt.Sprintf("{%d.%d Ra 0x%x %s}", - in.Major, in.Minor, in.MaxReadAhead, - flagString(initFlagNames, int64(in.Flags), "")) -} - -func (o *InitOut) string() string { - return fmt.Sprintf("{%d.%d Ra 0x%x %s %d/%d Wr 0x%x Tg 0x%x}", - o.Major, o.Minor, o.MaxReadAhead, - flagString(initFlagNames, int64(o.Flags), ""), - o.CongestionThreshold, o.MaxBackground, o.MaxWrite, - o.TimeGran) -} - -func (s *FsyncIn) string() string { - return fmt.Sprintf("{Fh %d Flags %x}", s.Fh, s.FsyncFlags) -} - -func (in *SetXAttrIn) string() string { - return fmt.Sprintf("{sz %d f%o}", in.Size, in.Flags) -} - -func (in *GetXAttrIn) string() string { - return fmt.Sprintf("{sz %d}", in.Size) -} - -func (o *GetXAttrOut) string() string { - return fmt.Sprintf("{sz %d}", o.Size) -} - -func (in *AccessIn) string() string { - return fmt.Sprintf("{u=%d g=%d %s}", - in.Uid, - in.Gid, - flagString(accessFlagName, int64(in.Mask), "")) -} - -func (in *FlushIn) string() string { - return fmt.Sprintf("{Fh %d}", in.Fh) -} - -func (o *AttrOut) string() string { - return fmt.Sprintf( - "{tA=%gs %v}", - ft(o.AttrValid, o.AttrValidNsec), &o.Attr) -} - -// ft converts (seconds , nanoseconds) -> float(seconds) -func ft(tsec uint64, tnsec uint32) float64 { - return float64(tsec) + float64(tnsec)*1E-9 -} - -// Returned by LOOKUP -func (o *EntryOut) string() string { - return fmt.Sprintf("{i%d g%d tE=%gs tA=%gs %v}", - o.NodeId, o.Generation, ft(o.EntryValid, o.EntryValidNsec), - ft(o.AttrValid, o.AttrValidNsec), &o.Attr) -} - -func (o *CreateOut) string() string { - return fmt.Sprintf("{i%d g%d %v %v}", o.NodeId, o.Generation, &o.EntryOut, &o.OpenOut) -} - -func (o *StatfsOut) string() string { - return fmt.Sprintf( - "{blocks (%d,%d)/%d files %d/%d bs%d nl%d frs%d}", - o.Bfree, o.Bavail, o.Blocks, o.Ffree, o.Files, - o.Bsize, o.NameLen, o.Frsize) -} - -func (o *NotifyInvalEntryOut) string() string { - return fmt.Sprintf("{parent i%d sz %d}", o.Parent, o.NameLen) -} - -func (o *NotifyInvalInodeOut) string() string { - return fmt.Sprintf("{i%d [%d +%d)}", o.Ino, o.Off, o.Length) -} - -func (o *NotifyInvalDeleteOut) string() string { - return fmt.Sprintf("{parent i%d ch i%d sz %d}", o.Parent, o.Child, o.NameLen) -} - -func (o *NotifyStoreOut) string() string { - return fmt.Sprintf("{i%d [%d +%d)}", o.Nodeid, o.Offset, o.Size) -} - -func (o *NotifyRetrieveOut) string() string { - return fmt.Sprintf("{> %d: i%d [%d +%d)}", o.NotifyUnique, o.Nodeid, o.Offset, o.Size) -} - -func (i *NotifyRetrieveIn) string() string { - return fmt.Sprintf("{[%d +%d)}", i.Offset, i.Size) -} - -func (f *FallocateIn) string() string { - return fmt.Sprintf("{Fh %d [%d +%d) mod 0%o}", - f.Fh, f.Offset, f.Length, f.Mode) -} - -func (f *LinkIn) string() string { - return fmt.Sprintf("{Oldnodeid: %d}", f.Oldnodeid) -} - -func (o *WriteOut) string() string { - return fmt.Sprintf("{%db }", o.Size) - -} -func (i *CopyFileRangeIn) string() string { - return fmt.Sprintf("{Fh %d [%d +%d) => i%d Fh %d [%d, %d)}", - i.FhIn, i.OffIn, i.Len, i.NodeIdOut, i.FhOut, i.OffOut, i.Len) -} - -func (in *InterruptIn) string() string { - return fmt.Sprintf("{ix %d}", in.Unique) -} - -var seekNames = map[uint32]string{ - 0: "SET", - 1: "CUR", - 2: "END", - 3: "DATA", - 4: "HOLE", -} - -func (in *LseekIn) string() string { - return fmt.Sprintf("{Fh %d [%s +%d)}", in.Fh, - seekNames[in.Whence], in.Offset) -} - -func (o *LseekOut) string() string { - return fmt.Sprintf("{%d}", o.Offset) -} - -// Print pretty prints FUSE data types for kernel communication -func Print(obj interface{}) string { - t, ok := obj.(interface { - string() string - }) - if ok { - return t.string() - } - return fmt.Sprintf("%T: %v", obj, obj) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/print_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/print_darwin.go deleted file mode 100644 index 38fbe5dbc..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/print_darwin.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "fmt" -) - -func init() { - initFlagNames[CAP_XTIMES] = "XTIMES" - initFlagNames[CAP_VOL_RENAME] = "VOL_RENAME" - initFlagNames[CAP_CASE_INSENSITIVE] = "CASE_INSENSITIVE" -} - -func (a *Attr) string() string { - return fmt.Sprintf( - "{M0%o SZ=%d L=%d "+ - "%d:%d "+ - "%d %d:%d "+ - "A %f "+ - "M %f "+ - "C %f}", - a.Mode, a.Size, a.Nlink, - a.Uid, a.Gid, - a.Blocks, - a.Rdev, a.Ino, ft(a.Atime, a.Atimensec), ft(a.Mtime, a.Mtimensec), - ft(a.Ctime, a.Ctimensec)) -} - -func (me *CreateIn) string() string { - return fmt.Sprintf( - "{0%o [%s]}", me.Mode, - flagString(openFlagNames, int64(me.Flags), "O_RDONLY")) -} - -func (me *GetAttrIn) string() string { return "" } - -func (me *MknodIn) string() string { - return fmt.Sprintf("{0%o, %d}", me.Mode, me.Rdev) -} - -func (me *ReadIn) string() string { - return fmt.Sprintf("{Fh %d [%d +%d) %s}", - me.Fh, me.Offset, me.Size, - flagString(readFlagNames, int64(me.ReadFlags), "")) -} - -func (me *WriteIn) string() string { - return fmt.Sprintf("{Fh %d [%d +%d) %s}", - me.Fh, me.Offset, me.Size, - flagString(writeFlagNames, int64(me.WriteFlags), "")) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/print_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/print_linux.go deleted file mode 100644 index 4eb637e03..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/print_linux.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "fmt" - "syscall" -) - -func init() { - openFlagNames[syscall.O_DIRECT] = "DIRECT" - openFlagNames[syscall.O_LARGEFILE] = "LARGEFILE" - openFlagNames[syscall_O_NOATIME] = "NOATIME" -} - -func (a *Attr) string() string { - return fmt.Sprintf( - "{M0%o SZ=%d L=%d "+ - "%d:%d "+ - "B%d*%d i%d:%d "+ - "A %f "+ - "M %f "+ - "C %f}", - a.Mode, a.Size, a.Nlink, - a.Uid, a.Gid, - a.Blocks, a.Blksize, - a.Rdev, a.Ino, ft(a.Atime, a.Atimensec), ft(a.Mtime, a.Mtimensec), - ft(a.Ctime, a.Ctimensec)) -} - -func (in *CreateIn) string() string { - return fmt.Sprintf( - "{0%o [%s] (0%o)}", in.Mode, - flagString(openFlagNames, int64(in.Flags), "O_RDONLY"), in.Umask) -} - -func (in *GetAttrIn) string() string { - return fmt.Sprintf("{Fh %d}", in.Fh_) -} - -func (in *MknodIn) string() string { - return fmt.Sprintf("{0%o (0%o), %d}", in.Mode, in.Umask, in.Rdev) -} - -func (in *ReadIn) string() string { - return fmt.Sprintf("{Fh %d [%d +%d) %s L %d %s}", - in.Fh, in.Offset, in.Size, - flagString(readFlagNames, int64(in.ReadFlags), ""), - in.LockOwner, - flagString(openFlagNames, int64(in.Flags), "RDONLY")) -} - -func (in *WriteIn) string() string { - return fmt.Sprintf("{Fh %d [%d +%d) %s L %d %s}", - in.Fh, in.Offset, in.Size, - flagString(writeFlagNames, int64(in.WriteFlags), ""), - in.LockOwner, - flagString(openFlagNames, int64(in.Flags), "RDONLY")) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/read.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/read.go deleted file mode 100644 index 1612679b9..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/read.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "io" - "syscall" -) - -// ReadResultData is the read return for returning bytes directly. -type readResultData struct { - // Raw bytes for the read. - Data []byte -} - -func (r *readResultData) Size() int { - return len(r.Data) -} - -func (r *readResultData) Done() { -} - -func (r *readResultData) Bytes(buf []byte) ([]byte, Status) { - return r.Data, OK -} - -func ReadResultData(b []byte) ReadResult { - return &readResultData{b} -} - -func ReadResultFd(fd uintptr, off int64, sz int) ReadResult { - return &readResultFd{fd, off, sz} -} - -// ReadResultFd is the read return for zero-copy file data. -type readResultFd struct { - // Splice from the following file. - Fd uintptr - - // Offset within Fd, or -1 to use current offset. - Off int64 - - // Size of data to be loaded. Actual data available may be - // less at the EOF. - Sz int -} - -// Reads raw bytes from file descriptor if necessary, using the passed -// buffer as storage. -func (r *readResultFd) Bytes(buf []byte) ([]byte, Status) { - sz := r.Sz - if len(buf) < sz { - sz = len(buf) - } - - n, err := syscall.Pread(int(r.Fd), buf[:sz], r.Off) - if err == io.EOF { - err = nil - } - - if n < 0 { - n = 0 - } - - return buf[:n], ToStatus(err) -} - -func (r *readResultFd) Size() int { - return r.Sz -} - -func (r *readResultFd) Done() { -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/request.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/request.go deleted file mode 100644 index 1fab11231..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/request.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "bytes" - "fmt" - "log" - "strings" - "time" - "unsafe" -) - -var sizeOfOutHeader = unsafe.Sizeof(OutHeader{}) -var zeroOutBuf [outputHeaderSize]byte - -type request struct { - inflightIndex int - - cancel chan struct{} - - // written under Server.reqMu - interrupted bool - - inputBuf []byte - - // These split up inputBuf. - inHeader *InHeader // generic header - inData unsafe.Pointer // per op data - arg []byte // flat data. - - filenames []string // filename arguments - - // Output data. - status Status - flatData []byte - fdData *readResultFd - - // In case of read, keep read result here so we can call - // Done() on it. - readResult ReadResult - - // Start timestamp for timing info. - startTime time.Time - - // All information pertaining to opcode of this request. - handler *operationHandler - - // Request storage. For large inputs and outputs, use data - // obtained through bufferpool. - bufferPoolInputBuf []byte - bufferPoolOutputBuf []byte - - // For small pieces of data, we use the following inlines - // arrays: - // - // Output header and structured data. - outBuf [outputHeaderSize]byte - - // Input, if small enough to fit here. - smallInputBuf [128]byte -} - -func (r *request) clear() { - r.inputBuf = nil - r.inHeader = nil - r.inData = nil - r.arg = nil - r.filenames = nil - r.status = OK - r.flatData = nil - r.fdData = nil - r.startTime = time.Time{} - r.handler = nil - r.readResult = nil -} - -func (r *request) InputDebug() string { - val := "" - if r.handler != nil && r.handler.DecodeIn != nil { - val = fmt.Sprintf("%v ", Print(r.handler.DecodeIn(r.inData))) - } - - names := "" - if r.filenames != nil { - names = fmt.Sprintf("%q", r.filenames) - } - - if len(r.arg) > 0 { - names += fmt.Sprintf(" %db", len(r.arg)) - } - - return fmt.Sprintf("rx %d: %s i%d %s%s", - r.inHeader.Unique, operationName(r.inHeader.Opcode), r.inHeader.NodeId, - val, names) -} - -func (r *request) OutputDebug() string { - var dataStr string - if r.handler != nil && r.handler.DecodeOut != nil && r.handler.OutputSize > 0 { - dataStr = Print(r.handler.DecodeOut(r.outData())) - } - - max := 1024 - if len(dataStr) > max { - dataStr = dataStr[:max] + fmt.Sprintf(" ...trimmed") - } - - flatStr := "" - if r.flatDataSize() > 0 { - if r.handler != nil && r.handler.FileNameOut { - s := strings.TrimRight(string(r.flatData), "\x00") - flatStr = fmt.Sprintf(" %q", s) - } else { - spl := "" - if r.fdData != nil { - spl = " (fd data)" - } else { - l := len(r.flatData) - s := "" - if l > 8 { - l = 8 - s = "..." - } - spl = fmt.Sprintf(" %q%s", r.flatData[:l], s) - } - flatStr = fmt.Sprintf(" %db data%s", r.flatDataSize(), spl) - } - } - - extraStr := dataStr + flatStr - if extraStr != "" { - extraStr = ", " + extraStr - } - return fmt.Sprintf("tx %d: %v%s", - r.inHeader.Unique, r.status, extraStr) -} - -// setInput returns true if it takes ownership of the argument, false if not. -func (r *request) setInput(input []byte) bool { - if len(input) < len(r.smallInputBuf) { - copy(r.smallInputBuf[:], input) - r.inputBuf = r.smallInputBuf[:len(input)] - return false - } - r.inputBuf = input - r.bufferPoolInputBuf = input[:cap(input)] - - return true -} - -func (r *request) parseHeader() Status { - if len(r.inputBuf) < int(unsafe.Sizeof(InHeader{})) { - log.Printf("Short read for input header: %v", r.inputBuf) - return EINVAL - } - - r.inHeader = (*InHeader)(unsafe.Pointer(&r.inputBuf[0])) - return OK -} - -func (r *request) parse() { - r.arg = r.inputBuf[:] - r.handler = getHandler(r.inHeader.Opcode) - if r.handler == nil { - log.Printf("Unknown opcode %d", r.inHeader.Opcode) - r.status = ENOSYS - return - } - - if len(r.arg) < int(r.handler.InputSize) { - log.Printf("Short read for %v: %v", operationName(r.inHeader.Opcode), r.arg) - r.status = EIO - return - } - - if r.handler.InputSize > 0 { - r.inData = unsafe.Pointer(&r.arg[0]) - r.arg = r.arg[r.handler.InputSize:] - } else { - r.arg = r.arg[unsafe.Sizeof(InHeader{}):] - } - - count := r.handler.FileNames - if count > 0 { - if count == 1 && r.inHeader.Opcode == _OP_SETXATTR { - // SETXATTR is special: the only opcode with a file name AND a - // binary argument. - splits := bytes.SplitN(r.arg, []byte{0}, 2) - r.filenames = []string{string(splits[0])} - } else if count == 1 { - r.filenames = []string{string(r.arg[:len(r.arg)-1])} - } else { - names := bytes.SplitN(r.arg[:len(r.arg)-1], []byte{0}, count) - r.filenames = make([]string, len(names)) - for i, n := range names { - r.filenames[i] = string(n) - } - if len(names) != count { - log.Println("filename argument mismatch", names, count) - r.status = EIO - } - } - } - - copy(r.outBuf[:r.handler.OutputSize+sizeOfOutHeader], - zeroOutBuf[:r.handler.OutputSize+sizeOfOutHeader]) - -} - -func (r *request) outData() unsafe.Pointer { - return unsafe.Pointer(&r.outBuf[sizeOfOutHeader]) -} - -// serializeHeader serializes the response header. The header points -// to an internal buffer of the receiver. -func (r *request) serializeHeader(flatDataSize int) (header []byte) { - var dataLength uintptr - - if r.handler != nil { - dataLength = r.handler.OutputSize - } - if r.status > OK { - // only do this for positive status; negative status - // is used for notification. - dataLength = 0 - } - - // [GET|LIST]XATTR is two opcodes in one: get/list xattr size (return - // structured GetXAttrOut, no flat data) and get/list xattr data - // (return no structured data, but only flat data) - if r.inHeader.Opcode == _OP_GETXATTR || r.inHeader.Opcode == _OP_LISTXATTR { - if (*GetXAttrIn)(r.inData).Size != 0 { - dataLength = 0 - } - } - - header = r.outBuf[:sizeOfOutHeader+dataLength] - o := (*OutHeader)(unsafe.Pointer(&header[0])) - o.Unique = r.inHeader.Unique - o.Status = int32(-r.status) - o.Length = uint32( - int(sizeOfOutHeader) + int(dataLength) + flatDataSize) - return header -} - -func (r *request) flatDataSize() int { - if r.fdData != nil { - return r.fdData.Size() - } - return len(r.flatData) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/request_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/request_darwin.go deleted file mode 100644 index 634462481..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/request_darwin.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -const outputHeaderSize = 200 - -const ( - _FUSE_KERNEL_VERSION = 7 - _MINIMUM_MINOR_VERSION = 8 - _OUR_MINOR_VERSION = 8 -) diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/request_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/request_linux.go deleted file mode 100644 index b93eef44e..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/request_linux.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -const outputHeaderSize = 160 - -const ( - _FUSE_KERNEL_VERSION = 7 - _MINIMUM_MINOR_VERSION = 12 - _OUR_MINOR_VERSION = 28 -) diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/server.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/server.go deleted file mode 100644 index 94d6a90ef..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/server.go +++ /dev/null @@ -1,856 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "fmt" - "log" - "math" - "os" - "path/filepath" - "runtime" - "strings" - "sync" - "syscall" - "time" - "unsafe" -) - -const ( - // The kernel caps writes at 128k. - MAX_KERNEL_WRITE = 128 * 1024 -) - -// Server contains the logic for reading from the FUSE device and -// translating it to RawFileSystem interface calls. -type Server struct { - // Empty if unmounted. - mountPoint string - fileSystem RawFileSystem - - // writeMu serializes close and notify writes - writeMu sync.Mutex - - // I/O with kernel and daemon. - mountFd int - - latencies LatencyMap - - opts *MountOptions - - // Pools for []byte - buffers bufferPool - - // Pool for request structs. - reqPool sync.Pool - - // Pool for raw requests data - readPool sync.Pool - reqMu sync.Mutex - reqReaders int - reqInflight []*request - kernelSettings InitIn - - // in-flight notify-retrieve queries - retrieveMu sync.Mutex - retrieveNext uint64 - retrieveTab map[uint64]*retrieveCacheRequest // notifyUnique -> retrieve request - - singleReader bool - canSplice bool - loops sync.WaitGroup - - ready chan error - - // for implementing single threaded processing. - requestProcessingMu sync.Mutex -} - -// SetDebug is deprecated. Use MountOptions.Debug instead. -func (ms *Server) SetDebug(dbg bool) { - // This will typically trigger the race detector. - ms.opts.Debug = dbg -} - -// KernelSettings returns the Init message from the kernel, so -// filesystems can adapt to availability of features of the kernel -// driver. The message should not be altered. -func (ms *Server) KernelSettings() *InitIn { - ms.reqMu.Lock() - s := ms.kernelSettings - ms.reqMu.Unlock() - - return &s -} - -const _MAX_NAME_LEN = 20 - -// This type may be provided for recording latencies of each FUSE -// operation. -type LatencyMap interface { - Add(name string, dt time.Duration) -} - -// RecordLatencies switches on collection of timing for each request -// coming from the kernel.P assing a nil argument switches off the -func (ms *Server) RecordLatencies(l LatencyMap) { - ms.latencies = l -} - -// Unmount calls fusermount -u on the mount. This has the effect of -// shutting down the filesystem. After the Server is unmounted, it -// should be discarded. -func (ms *Server) Unmount() (err error) { - if ms.mountPoint == "" { - return nil - } - delay := time.Duration(0) - for try := 0; try < 5; try++ { - err = unmount(ms.mountPoint, ms.opts) - if err == nil { - break - } - - // Sleep for a bit. This is not pretty, but there is - // no way we can be certain that the kernel thinks all - // open files have already been closed. - delay = 2*delay + 5*time.Millisecond - time.Sleep(delay) - } - if err != nil { - return - } - // Wait for event loops to exit. - ms.loops.Wait() - ms.mountPoint = "" - return err -} - -// NewServer creates a server and attaches it to the given directory. -func NewServer(fs RawFileSystem, mountPoint string, opts *MountOptions) (*Server, error) { - if opts == nil { - opts = &MountOptions{ - MaxBackground: _DEFAULT_BACKGROUND_TASKS, - } - } - o := *opts - - if o.MaxWrite < 0 { - o.MaxWrite = 0 - } - if o.MaxWrite == 0 { - o.MaxWrite = 1 << 16 - } - if o.MaxWrite > MAX_KERNEL_WRITE { - o.MaxWrite = MAX_KERNEL_WRITE - } - if o.Name == "" { - name := fs.String() - l := len(name) - if l > _MAX_NAME_LEN { - l = _MAX_NAME_LEN - } - o.Name = strings.Replace(name[:l], ",", ";", -1) - } - - for _, s := range o.optionsStrings() { - if strings.Contains(s, ",") { - return nil, fmt.Errorf("found ',' in option string %q", s) - } - } - - ms := &Server{ - fileSystem: fs, - opts: &o, - retrieveTab: make(map[uint64]*retrieveCacheRequest), - // OSX has races when multiple routines read from the - // FUSE device: on unmount, sometime some reads do not - // error-out, meaning that unmount will hang. - singleReader: runtime.GOOS == "darwin", - ready: make(chan error, 1), - } - ms.reqPool.New = func() interface{} { - return &request{ - cancel: make(chan struct{}), - } - } - ms.readPool.New = func() interface{} { - buf := make([]byte, o.MaxWrite+int(maxInputSize)+logicalBlockSize) - buf = alignSlice(buf, unsafe.Sizeof(WriteIn{}), logicalBlockSize, uintptr(o.MaxWrite)+maxInputSize) - return buf - } - mountPoint = filepath.Clean(mountPoint) - if !filepath.IsAbs(mountPoint) { - cwd, err := os.Getwd() - if err != nil { - return nil, err - } - mountPoint = filepath.Clean(filepath.Join(cwd, mountPoint)) - } - fd, err := mount(mountPoint, &o, ms.ready) - if err != nil { - return nil, err - } - - ms.mountPoint = mountPoint - ms.mountFd = fd - - if code := ms.handleInit(); !code.Ok() { - syscall.Close(fd) - // TODO - unmount as well? - return nil, fmt.Errorf("init: %s", code) - } - - // This prepares for Serve being called somewhere, either - // synchronously or asynchronously. - ms.loops.Add(1) - return ms, nil -} - -func (o *MountOptions) optionsStrings() []string { - var r []string - r = append(r, o.Options...) - - if o.AllowOther { - r = append(r, "allow_other") - } - - if o.FsName != "" { - r = append(r, "fsname="+o.FsName) - } - if o.Name != "" { - r = append(r, "subtype="+o.Name) - } - - return r -} - -// DebugData returns internal status information for debugging -// purposes. -func (ms *Server) DebugData() string { - var r int - ms.reqMu.Lock() - r = ms.reqReaders - ms.reqMu.Unlock() - - return fmt.Sprintf("readers: %d", r) -} - -// What is a good number? Maybe the number of CPUs? -const _MAX_READERS = 2 - -// handleEINTR retries the given function until it doesn't return syscall.EINTR. -// This is similar to the HANDLE_EINTR() macro from Chromium ( see -// https://code.google.com/p/chromium/codesearch#chromium/src/base/posix/eintr_wrapper.h -// ) and the TEMP_FAILURE_RETRY() from glibc (see -// https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html -// ). -// -// Don't use handleEINTR() with syscall.Close(); see -// https://code.google.com/p/chromium/issues/detail?id=269623 . -func handleEINTR(fn func() error) (err error) { - for { - err = fn() - if err != syscall.EINTR { - break - } - } - return -} - -// Returns a new request, or error. In case exitIdle is given, returns -// nil, OK if we have too many readers already. -func (ms *Server) readRequest(exitIdle bool) (req *request, code Status) { - req = ms.reqPool.Get().(*request) - dest := ms.readPool.Get().([]byte) - - ms.reqMu.Lock() - if ms.reqReaders > _MAX_READERS { - ms.reqMu.Unlock() - return nil, OK - } - ms.reqReaders++ - ms.reqMu.Unlock() - - var n int - err := handleEINTR(func() error { - var err error - n, err = syscall.Read(ms.mountFd, dest) - return err - }) - if err != nil { - code = ToStatus(err) - ms.reqPool.Put(req) - ms.reqMu.Lock() - ms.reqReaders-- - ms.reqMu.Unlock() - return nil, code - } - - if ms.latencies != nil { - req.startTime = time.Now() - } - gobbled := req.setInput(dest[:n]) - - ms.reqMu.Lock() - defer ms.reqMu.Unlock() - // Must parse request.Unique under lock - if status := req.parseHeader(); !status.Ok() { - return nil, status - } - req.inflightIndex = len(ms.reqInflight) - ms.reqInflight = append(ms.reqInflight, req) - if !gobbled { - ms.readPool.Put(dest) - dest = nil - } - ms.reqReaders-- - if !ms.singleReader && ms.reqReaders <= 0 { - ms.loops.Add(1) - go ms.loop(true) - } - - return req, OK -} - -// returnRequest returns a request to the pool of unused requests. -func (ms *Server) returnRequest(req *request) { - ms.reqMu.Lock() - this := req.inflightIndex - last := len(ms.reqInflight) - 1 - - if last != this { - ms.reqInflight[this] = ms.reqInflight[last] - ms.reqInflight[this].inflightIndex = this - } - ms.reqInflight = ms.reqInflight[:last] - interrupted := req.interrupted - ms.reqMu.Unlock() - - ms.recordStats(req) - if interrupted { - // Don't reposses data, because someone might still - // be looking at it - return - } - - if req.bufferPoolOutputBuf != nil { - ms.buffers.FreeBuffer(req.bufferPoolOutputBuf) - req.bufferPoolOutputBuf = nil - } - - req.clear() - - if p := req.bufferPoolInputBuf; p != nil { - req.bufferPoolInputBuf = nil - ms.readPool.Put(p) - } - ms.reqPool.Put(req) -} - -func (ms *Server) recordStats(req *request) { - if ms.latencies != nil { - dt := time.Now().Sub(req.startTime) - opname := operationName(req.inHeader.Opcode) - ms.latencies.Add(opname, dt) - } -} - -// Serve initiates the FUSE loop. Normally, callers should run Serve() -// and wait for it to exit, but tests will want to run this in a -// goroutine. -// -// Each filesystem operation executes in a separate goroutine. -func (ms *Server) Serve() { - ms.loop(false) - ms.loops.Wait() - - ms.writeMu.Lock() - syscall.Close(ms.mountFd) - ms.writeMu.Unlock() - - // shutdown in-flight cache retrieves. - // - // It is possible that umount comes in the middle - after retrieve - // request was sent to kernel, but corresponding kernel reply has not - // yet been read. We unblock all such readers and wake them up with ENODEV. - ms.retrieveMu.Lock() - rtab := ms.retrieveTab - // retrieve attempts might be erroneously tried even after close - // we have to keep retrieveTab !nil not to panic. - ms.retrieveTab = make(map[uint64]*retrieveCacheRequest) - ms.retrieveMu.Unlock() - for _, reading := range rtab { - reading.n = 0 - reading.st = ENODEV - close(reading.ready) - } -} - -// Wait waits for the serve loop to exit. This should only be called -// after Serve has been called, or it will hang indefinitely. -func (ms *Server) Wait() { - ms.loops.Wait() -} - -func (ms *Server) handleInit() Status { - // The first request should be INIT; read it synchronously, - // and don't spawn new readers. - orig := ms.singleReader - ms.singleReader = true - req, errNo := ms.readRequest(false) - ms.singleReader = orig - - if errNo != OK || req == nil { - return errNo - } - if code := ms.handleRequest(req); !code.Ok() { - return code - } - - // INIT is handled. Init the file system, but don't accept - // incoming requests, so the file system can setup itself. - ms.fileSystem.Init(ms) - return OK -} - -func (ms *Server) loop(exitIdle bool) { - defer ms.loops.Done() -exit: - for { - req, errNo := ms.readRequest(exitIdle) - switch errNo { - case OK: - if req == nil { - break exit - } - case ENOENT: - continue - case ENODEV: - // unmount - if ms.opts.Debug { - log.Printf("received ENODEV (unmount request), thread exiting") - } - break exit - default: // some other error? - log.Printf("Failed to read from fuse conn: %v", errNo) - break exit - } - - if ms.singleReader { - go ms.handleRequest(req) - } else { - ms.handleRequest(req) - } - } -} - -func (ms *Server) handleRequest(req *request) Status { - if ms.opts.SingleThreaded { - ms.requestProcessingMu.Lock() - defer ms.requestProcessingMu.Unlock() - } - - req.parse() - if req.handler == nil { - req.status = ENOSYS - } - - if req.status.Ok() && ms.opts.Debug { - log.Println(req.InputDebug()) - } - - if req.inHeader.NodeId == pollHackInode || - req.inHeader.NodeId == FUSE_ROOT_ID && len(req.filenames) > 0 && req.filenames[0] == pollHackName { - doPollHackLookup(ms, req) - } else if req.status.Ok() && req.handler.Func == nil { - log.Printf("Unimplemented opcode %v", operationName(req.inHeader.Opcode)) - req.status = ENOSYS - } else if req.status.Ok() { - req.handler.Func(ms, req) - } - - errNo := ms.write(req) - if errNo != 0 { - log.Printf("writer: Write/Writev failed, err: %v. opcode: %v", - errNo, operationName(req.inHeader.Opcode)) - } - ms.returnRequest(req) - return Status(errNo) -} - -// alignSlice ensures that the byte at alignedByte is aligned with the -// given logical block size. The input slice should be at least (size -// + blockSize) -func alignSlice(buf []byte, alignedByte, blockSize, size uintptr) []byte { - misaligned := uintptr(unsafe.Pointer(&buf[alignedByte])) & (blockSize - 1) - buf = buf[blockSize-misaligned:] - return buf[:size] -} - -func (ms *Server) allocOut(req *request, size uint32) []byte { - if cap(req.bufferPoolOutputBuf) >= int(size) { - req.bufferPoolOutputBuf = req.bufferPoolOutputBuf[:size] - return req.bufferPoolOutputBuf - } - if req.bufferPoolOutputBuf != nil { - ms.buffers.FreeBuffer(req.bufferPoolOutputBuf) - req.bufferPoolOutputBuf = nil - } - // As this allocated a multiple of the page size, very likely - // this is aligned to logicalBlockSize too, which is smaller. - req.bufferPoolOutputBuf = ms.buffers.AllocBuffer(size) - return req.bufferPoolOutputBuf -} - -func (ms *Server) write(req *request) Status { - // Forget/NotifyReply do not wait for reply from filesystem server. - switch req.inHeader.Opcode { - case _OP_FORGET, _OP_BATCH_FORGET, _OP_NOTIFY_REPLY: - return OK - case _OP_INTERRUPT: - if req.status.Ok() { - return OK - } - } - - header := req.serializeHeader(req.flatDataSize()) - if ms.opts.Debug { - log.Println(req.OutputDebug()) - } - - if header == nil { - return OK - } - - s := ms.systemWrite(req, header) - return s -} - -// InodeNotify invalidates the information associated with the inode -// (ie. data cache, attributes, etc.) -func (ms *Server) InodeNotify(node uint64, off int64, length int64) Status { - if !ms.kernelSettings.SupportsNotify(NOTIFY_INVAL_INODE) { - return ENOSYS - } - - req := request{ - inHeader: &InHeader{ - Opcode: _OP_NOTIFY_INVAL_INODE, - }, - handler: operationHandlers[_OP_NOTIFY_INVAL_INODE], - status: NOTIFY_INVAL_INODE, - } - - entry := (*NotifyInvalInodeOut)(req.outData()) - entry.Ino = node - entry.Off = off - entry.Length = length - - // Protect against concurrent close. - ms.writeMu.Lock() - result := ms.write(&req) - ms.writeMu.Unlock() - - if ms.opts.Debug { - log.Println("Response: INODE_NOTIFY", result) - } - return result -} - -// InodeNotifyStoreCache tells kernel to store data into inode's cache. -// -// This call is similar to InodeNotify, but instead of only invalidating a data -// region, it gives updated data directly to the kernel. -func (ms *Server) InodeNotifyStoreCache(node uint64, offset int64, data []byte) Status { - if !ms.kernelSettings.SupportsNotify(NOTIFY_STORE_CACHE) { - return ENOSYS - } - - for len(data) > 0 { - size := len(data) - if size > math.MaxInt32 { - // NotifyStoreOut has only uint32 for size. - // we check for max(int32), not max(uint32), because on 32-bit - // platforms int has only 31-bit for positive range. - size = math.MaxInt32 - } - - st := ms.inodeNotifyStoreCache32(node, offset, data[:size]) - if st != OK { - return st - } - - data = data[size:] - offset += int64(size) - } - - return OK -} - -// inodeNotifyStoreCache32 is internal worker for InodeNotifyStoreCache which -// handles data chunks not larger than 2GB. -func (ms *Server) inodeNotifyStoreCache32(node uint64, offset int64, data []byte) Status { - req := request{ - inHeader: &InHeader{ - Opcode: _OP_NOTIFY_STORE_CACHE, - }, - handler: operationHandlers[_OP_NOTIFY_STORE_CACHE], - status: NOTIFY_STORE_CACHE, - } - - store := (*NotifyStoreOut)(req.outData()) - store.Nodeid = node - store.Offset = uint64(offset) // NOTE not int64, as it is e.g. in NotifyInvalInodeOut - store.Size = uint32(len(data)) - - req.flatData = data - - // Protect against concurrent close. - ms.writeMu.Lock() - result := ms.write(&req) - ms.writeMu.Unlock() - - if ms.opts.Debug { - log.Printf("Response: INODE_NOTIFY_STORE_CACHE: %v", result) - } - return result -} - -// InodeRetrieveCache retrieves data from kernel's inode cache. -// -// InodeRetrieveCache asks kernel to return data from its cache for inode at -// [offset:offset+len(dest)) and waits for corresponding reply. If kernel cache -// has fewer consecutive data starting at offset, that fewer amount is returned. -// In particular if inode data at offset is not cached (0, OK) is returned. -// -// The kernel returns ENOENT if it does not currently have entry for this inode -// in its dentry cache. -func (ms *Server) InodeRetrieveCache(node uint64, offset int64, dest []byte) (n int, st Status) { - // the kernel won't send us in one go more then what we negotiated as MaxWrite. - // retrieve the data in chunks. - // TODO spawn some number of readahead retrievers in parallel. - ntotal := 0 - for { - chunkSize := len(dest) - if chunkSize > ms.opts.MaxWrite { - chunkSize = ms.opts.MaxWrite - } - n, st = ms.inodeRetrieveCache1(node, offset, dest[:chunkSize]) - if st != OK || n == 0 { - break - } - - ntotal += n - offset += int64(n) - dest = dest[n:] - } - - // if we could retrieve at least something - it is ok. - // if ntotal=0 - st will be st returned from first inodeRetrieveCache1. - if ntotal > 0 { - st = OK - } - return ntotal, st -} - -// inodeRetrieveCache1 is internal worker for InodeRetrieveCache which -// actually talks to kernel and retrieves chunks not larger than ms.opts.MaxWrite. -func (ms *Server) inodeRetrieveCache1(node uint64, offset int64, dest []byte) (n int, st Status) { - if !ms.kernelSettings.SupportsNotify(NOTIFY_RETRIEVE_CACHE) { - return 0, ENOSYS - } - - req := request{ - inHeader: &InHeader{ - Opcode: _OP_NOTIFY_RETRIEVE_CACHE, - }, - handler: operationHandlers[_OP_NOTIFY_RETRIEVE_CACHE], - status: NOTIFY_RETRIEVE_CACHE, - } - - // retrieve up to 2GB not to overflow uint32 size in NotifyRetrieveOut. - // see InodeNotifyStoreCache in similar place for why it is only 2GB, not 4GB. - // - // ( InodeRetrieveCache calls us with chunks not larger than - // ms.opts.MaxWrite, but MaxWrite is int, so let's be extra cautious ) - size := len(dest) - if size > math.MaxInt32 { - size = math.MaxInt32 - } - dest = dest[:size] - - q := (*NotifyRetrieveOut)(req.outData()) - q.Nodeid = node - q.Offset = uint64(offset) // not int64, as it is e.g. in NotifyInvalInodeOut - q.Size = uint32(len(dest)) - - reading := &retrieveCacheRequest{ - nodeid: q.Nodeid, - offset: q.Offset, - dest: dest, - ready: make(chan struct{}), - } - - ms.retrieveMu.Lock() - q.NotifyUnique = ms.retrieveNext - ms.retrieveNext++ - ms.retrieveTab[q.NotifyUnique] = reading - ms.retrieveMu.Unlock() - - // Protect against concurrent close. - ms.writeMu.Lock() - result := ms.write(&req) - ms.writeMu.Unlock() - - if ms.opts.Debug { - log.Printf("Response: NOTIFY_RETRIEVE_CACHE: %v", result) - } - if result != OK { - ms.retrieveMu.Lock() - r := ms.retrieveTab[q.NotifyUnique] - if r == reading { - delete(ms.retrieveTab, q.NotifyUnique) - } else if r == nil { - // ok - might be dequeued by umount - } else { - // although very unlikely, it is possible that kernel sends - // unexpected NotifyReply with our notifyUnique, then - // retrieveNext wraps, makes full cycle, and another - // retrieve request is made with the same notifyUnique. - log.Printf("W: INODE_RETRIEVE_CACHE: request with notifyUnique=%d mutated", q.NotifyUnique) - } - ms.retrieveMu.Unlock() - return 0, result - } - - // NotifyRetrieveOut sent to the kernel successfully. Now the kernel - // have to return data in a separate write-style NotifyReply request. - // Wait for the result. - <-reading.ready - return reading.n, reading.st -} - -// retrieveCacheRequest represents in-flight cache retrieve request. -type retrieveCacheRequest struct { - nodeid uint64 - offset uint64 - dest []byte - - // reply status - n int - st Status - ready chan struct{} -} - -// DeleteNotify notifies the kernel that an entry is removed from a -// directory. In many cases, this is equivalent to EntryNotify, -// except when the directory is in use, eg. as working directory of -// some process. You should not hold any FUSE filesystem locks, as that -// can lead to deadlock. -func (ms *Server) DeleteNotify(parent uint64, child uint64, name string) Status { - if ms.kernelSettings.Minor < 18 { - return ms.EntryNotify(parent, name) - } - - req := request{ - inHeader: &InHeader{ - Opcode: _OP_NOTIFY_DELETE, - }, - handler: operationHandlers[_OP_NOTIFY_DELETE], - status: NOTIFY_DELETE, - } - - entry := (*NotifyInvalDeleteOut)(req.outData()) - entry.Parent = parent - entry.Child = child - entry.NameLen = uint32(len(name)) - - // Many versions of FUSE generate stacktraces if the - // terminating null byte is missing. - nameBytes := make([]byte, len(name)+1) - copy(nameBytes, name) - nameBytes[len(nameBytes)-1] = '\000' - req.flatData = nameBytes - - // Protect against concurrent close. - ms.writeMu.Lock() - result := ms.write(&req) - ms.writeMu.Unlock() - - if ms.opts.Debug { - log.Printf("Response: DELETE_NOTIFY: %v", result) - } - return result -} - -// EntryNotify should be used if the existence status of an entry -// within a directory changes. You should not hold any FUSE filesystem -// locks, as that can lead to deadlock. -func (ms *Server) EntryNotify(parent uint64, name string) Status { - if !ms.kernelSettings.SupportsNotify(NOTIFY_INVAL_ENTRY) { - return ENOSYS - } - req := request{ - inHeader: &InHeader{ - Opcode: _OP_NOTIFY_INVAL_ENTRY, - }, - handler: operationHandlers[_OP_NOTIFY_INVAL_ENTRY], - status: NOTIFY_INVAL_ENTRY, - } - entry := (*NotifyInvalEntryOut)(req.outData()) - entry.Parent = parent - entry.NameLen = uint32(len(name)) - - // Many versions of FUSE generate stacktraces if the - // terminating null byte is missing. - nameBytes := make([]byte, len(name)+1) - copy(nameBytes, name) - nameBytes[len(nameBytes)-1] = '\000' - req.flatData = nameBytes - - // Protect against concurrent close. - ms.writeMu.Lock() - result := ms.write(&req) - ms.writeMu.Unlock() - - if ms.opts.Debug { - log.Printf("Response: ENTRY_NOTIFY: %v", result) - } - return result -} - -// SupportsVersion returns true if the kernel supports the given -// protocol version or newer. -func (in *InitIn) SupportsVersion(maj, min uint32) bool { - return in.Major > maj || (in.Major == maj && in.Minor >= min) -} - -// SupportsNotify returns whether a certain notification type is -// supported. Pass any of the NOTIFY_* types as argument. -func (in *InitIn) SupportsNotify(notifyType int) bool { - switch notifyType { - case NOTIFY_INVAL_ENTRY: - return in.SupportsVersion(7, 12) - case NOTIFY_INVAL_INODE: - return in.SupportsVersion(7, 12) - case NOTIFY_STORE_CACHE, NOTIFY_RETRIEVE_CACHE: - return in.SupportsVersion(7, 15) - case NOTIFY_DELETE: - return in.SupportsVersion(7, 18) - } - return false -} - -// WaitMount waits for the first request to be served. Use this to -// avoid racing between accessing the (empty or not yet mounted) -// mountpoint, and the OS trying to setup the user-space mount. -func (ms *Server) WaitMount() error { - err := <-ms.ready - if err != nil { - return err - } - return pollHack(ms.mountPoint) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/server_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/server_darwin.go deleted file mode 100644 index b4df8daef..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/server_darwin.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "syscall" -) - -func (ms *Server) systemWrite(req *request, header []byte) Status { - if req.flatDataSize() == 0 { - err := handleEINTR(func() error { - _, err := syscall.Write(ms.mountFd, header) - return err - }) - return ToStatus(err) - } - - if req.fdData != nil { - sz := req.flatDataSize() - buf := ms.allocOut(req, uint32(sz)) - req.flatData, req.status = req.fdData.Bytes(buf) - header = req.serializeHeader(len(req.flatData)) - } - - _, err := writev(int(ms.mountFd), [][]byte{header, req.flatData}) - if req.readResult != nil { - req.readResult.Done() - } - return ToStatus(err) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/server_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/server_linux.go deleted file mode 100644 index f5058f68b..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/server_linux.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "log" - "syscall" -) - -func (ms *Server) systemWrite(req *request, header []byte) Status { - if req.flatDataSize() == 0 { - err := handleEINTR(func() error { - _, err := syscall.Write(ms.mountFd, header) - return err - }) - return ToStatus(err) - } - - if req.fdData != nil { - if ms.canSplice { - err := ms.trySplice(header, req, req.fdData) - if err == nil { - req.readResult.Done() - return OK - } - log.Println("trySplice:", err) - } - - sz := req.flatDataSize() - buf := ms.allocOut(req, uint32(sz)) - req.flatData, req.status = req.fdData.Bytes(buf) - header = req.serializeHeader(len(req.flatData)) - } - - _, err := writev(ms.mountFd, [][]byte{header, req.flatData}) - if req.readResult != nil { - req.readResult.Done() - } - return ToStatus(err) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/splice_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/splice_darwin.go deleted file mode 100644 index dc4774af3..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/splice_darwin.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "fmt" -) - -func (s *Server) setSplice() { - s.canSplice = false -} - -func (ms *Server) trySplice(header []byte, req *request, fdData *readResultFd) error { - return fmt.Errorf("unimplemented") -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/splice_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/splice_linux.go deleted file mode 100644 index 70f836a24..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/splice_linux.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "fmt" - "os" - - "github.com/hanwen/go-fuse/v2/splice" -) - -func (s *Server) setSplice() { - s.canSplice = splice.Resizable() -} - -// trySplice: Zero-copy read from fdData.Fd into /dev/fuse -// -// This is a four-step process: -// -// 1) Splice data form fdData.Fd into the "pair1" pipe buffer --> pair1: [payload] -// Now we know the actual payload length and can -// construct the reply header -// 2) Write header into the "pair2" pipe buffer --> pair2: [header] -// 4) Splice data from "pair1" into "pair2" --> pair2: [header][payload] -// 3) Splice the data from "pair2" into /dev/fuse -// -// This dance is neccessary because header and payload cannot be split across -// two splices and we cannot seek in a pipe buffer. -func (ms *Server) trySplice(header []byte, req *request, fdData *readResultFd) error { - var err error - - // Get a pair of connected pipes - pair1, err := splice.Get() - if err != nil { - return err - } - defer splice.Done(pair1) - - // Grow buffer pipe to requested size + one extra page - // Without the extra page the kernel will block once the pipe is almost full - pair1Sz := fdData.Size() + os.Getpagesize() - if err := pair1.Grow(pair1Sz); err != nil { - return err - } - - // Read data from file - payloadLen, err := pair1.LoadFromAt(fdData.Fd, fdData.Size(), fdData.Off) - - if err != nil { - // TODO - extract the data from splice. - return err - } - - // Get another pair of connected pipes - pair2, err := splice.Get() - if err != nil { - return err - } - defer splice.Done(pair2) - - // Grow pipe to header + actually read size + one extra page - // Without the extra page the kernel will block once the pipe is almost full - header = req.serializeHeader(payloadLen) - total := len(header) + payloadLen - pair2Sz := total + os.Getpagesize() - if err := pair2.Grow(pair2Sz); err != nil { - return err - } - - // Write header into pair2 - n, err := pair2.Write(header) - if err != nil { - return err - } - if n != len(header) { - return fmt.Errorf("Short write into splice: wrote %d, want %d", n, len(header)) - } - - // Write data into pair2 - n, err = pair2.LoadFrom(pair1.ReadFd(), payloadLen) - if err != nil { - return err - } - if n != payloadLen { - return fmt.Errorf("Short splice: wrote %d, want %d", n, payloadLen) - } - - // Write header + data to /dev/fuse - _, err = pair2.WriteTo(uintptr(ms.mountFd), total) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_darwin.go deleted file mode 100644 index 71ede66f5..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_darwin.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "bytes" - "os" - "syscall" - "unsafe" -) - -// TODO - move these into Go's syscall package. - -func sys_writev(fd int, iovecs *syscall.Iovec, cnt int) (n int, err error) { - n1, _, e1 := syscall.Syscall( - syscall.SYS_WRITEV, - uintptr(fd), uintptr(unsafe.Pointer(iovecs)), uintptr(cnt)) - n = int(n1) - if e1 != 0 { - err = syscall.Errno(e1) - } - return -} - -func writev(fd int, packet [][]byte) (n int, err error) { - iovecs := make([]syscall.Iovec, 0, len(packet)) - - for _, v := range packet { - if len(v) == 0 { - continue - } - vec := syscall.Iovec{ - Base: &v[0], - } - vec.SetLen(len(v)) - iovecs = append(iovecs, vec) - } - - sysErr := handleEINTR(func() error { - var err error - n, err = sys_writev(fd, &iovecs[0], len(iovecs)) - return err - }) - if sysErr != nil { - err = os.NewSyscallError("writev", sysErr) - } - return n, err -} - -func getxattr(path string, attr string, dest []byte) (sz int, errno int) { - pathBs := syscall.StringBytePtr(path) - attrBs := syscall.StringBytePtr(attr) - size, _, errNo := syscall.Syscall6( - syscall.SYS_GETXATTR, - uintptr(unsafe.Pointer(pathBs)), - uintptr(unsafe.Pointer(attrBs)), - uintptr(unsafe.Pointer(&dest[0])), - uintptr(len(dest)), - 0, 0) - return int(size), int(errNo) -} - -func GetXAttr(path string, attr string, dest []byte) (value []byte, errno int) { - sz, errno := getxattr(path, attr, dest) - - for sz > cap(dest) && errno == 0 { - dest = make([]byte, sz) - sz, errno = getxattr(path, attr, dest) - } - - if errno != 0 { - return nil, errno - } - - return dest[:sz], errno -} - -func listxattr(path string, dest []byte) (sz int, errno int) { - pathbs := syscall.StringBytePtr(path) - var destPointer unsafe.Pointer - if len(dest) > 0 { - destPointer = unsafe.Pointer(&dest[0]) - } - size, _, errNo := syscall.Syscall( - syscall.SYS_LISTXATTR, - uintptr(unsafe.Pointer(pathbs)), - uintptr(destPointer), - uintptr(len(dest))) - - return int(size), int(errNo) -} - -func ListXAttr(path string) (attributes []string, errno int) { - dest := make([]byte, 0) - sz, errno := listxattr(path, dest) - if errno != 0 { - return nil, errno - } - - for sz > cap(dest) && errno == 0 { - dest = make([]byte, sz) - sz, errno = listxattr(path, dest) - } - - // -1 to drop the final empty slice. - dest = dest[:sz-1] - attributesBytes := bytes.Split(dest, []byte{0}) - attributes = make([]string, len(attributesBytes)) - for i, v := range attributesBytes { - attributes[i] = string(v) - } - return attributes, errno -} - -func Setxattr(path string, attr string, data []byte, flags int) (errno int) { - pathbs := syscall.StringBytePtr(path) - attrbs := syscall.StringBytePtr(attr) - _, _, errNo := syscall.Syscall6( - syscall.SYS_SETXATTR, - uintptr(unsafe.Pointer(pathbs)), - uintptr(unsafe.Pointer(attrbs)), - uintptr(unsafe.Pointer(&data[0])), - uintptr(len(data)), - uintptr(flags), 0) - - return int(errNo) -} - -func Removexattr(path string, attr string) (errno int) { - pathbs := syscall.StringBytePtr(path) - attrbs := syscall.StringBytePtr(attr) - _, _, errNo := syscall.Syscall( - syscall.SYS_REMOVEXATTR, - uintptr(unsafe.Pointer(pathbs)), - uintptr(unsafe.Pointer(attrbs)), 0) - return int(errNo) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_linux.go deleted file mode 100644 index f1a8cac4d..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/syscall_linux.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "os" - "syscall" - "unsafe" -) - -// TODO - move these into Go's syscall package. - -func sys_writev(fd int, iovecs *syscall.Iovec, cnt int) (n int, err error) { - n1, _, e1 := syscall.Syscall( - syscall.SYS_WRITEV, - uintptr(fd), uintptr(unsafe.Pointer(iovecs)), uintptr(cnt)) - n = int(n1) - if e1 != 0 { - err = syscall.Errno(e1) - } - return n, err -} - -func writev(fd int, packet [][]byte) (n int, err error) { - iovecs := make([]syscall.Iovec, 0, len(packet)) - - for _, v := range packet { - if len(v) == 0 { - continue - } - vec := syscall.Iovec{ - Base: &v[0], - } - vec.SetLen(len(v)) - iovecs = append(iovecs, vec) - } - - sysErr := handleEINTR(func() error { - var err error - n, err = sys_writev(fd, &iovecs[0], len(iovecs)) - return err - }) - if sysErr != nil { - err = os.NewSyscallError("writev", sysErr) - } - return n, err -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/typeprint.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/typeprint.go deleted file mode 100644 index dda4a9ff2..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/typeprint.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -func (a *Attr) String() string { - return Print(a) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/types.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/types.go deleted file mode 100644 index 69e124975..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/types.go +++ /dev/null @@ -1,676 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "io" - "syscall" - "time" -) - -const ( - _DEFAULT_BACKGROUND_TASKS = 12 -) - -// Status is the errno number that a FUSE call returns to the kernel. -type Status int32 - -const ( - OK = Status(0) - - // EACCESS Permission denied - EACCES = Status(syscall.EACCES) - - // EBUSY Device or resource busy - EBUSY = Status(syscall.EBUSY) - - // EAGAIN Resource temporarily unavailable - EAGAIN = Status(syscall.EAGAIN) - - // EINTR Call was interrupted - EINTR = Status(syscall.EINTR) - - // EINVAL Invalid argument - EINVAL = Status(syscall.EINVAL) - - // EIO I/O error - EIO = Status(syscall.EIO) - - // ENOENT No such file or directory - ENOENT = Status(syscall.ENOENT) - - // ENOSYS Function not implemented - ENOSYS = Status(syscall.ENOSYS) - - // ENODATA No data available - ENODATA = Status(syscall.ENODATA) - - // ENOTDIR Not a directory - ENOTDIR = Status(syscall.ENOTDIR) - - // ENOTSUP Not supported - ENOTSUP = Status(syscall.ENOTSUP) - - // EISDIR Is a directory - EISDIR = Status(syscall.EISDIR) - - // EPERM Operation not permitted - EPERM = Status(syscall.EPERM) - - // ERANGE Math result not representable - ERANGE = Status(syscall.ERANGE) - - // EXDEV Cross-device link - EXDEV = Status(syscall.EXDEV) - - // EBADF Bad file number - EBADF = Status(syscall.EBADF) - - // ENODEV No such device - ENODEV = Status(syscall.ENODEV) - - // EROFS Read-only file system - EROFS = Status(syscall.EROFS) -) - -type ForgetIn struct { - InHeader - - Nlookup uint64 -} - -// batch forget is handled internally. -type _ForgetOne struct { - NodeId uint64 - Nlookup uint64 -} - -// batch forget is handled internally. -type _BatchForgetIn struct { - InHeader - Count uint32 - Dummy uint32 -} - -type MkdirIn struct { - InHeader - - // The mode for the new directory. The calling process' umask - // is already factored into the mode. - Mode uint32 - Umask uint32 -} - -type Rename1In struct { - InHeader - Newdir uint64 -} - -type RenameIn struct { - InHeader - Newdir uint64 - Flags uint32 - Padding uint32 -} - -type LinkIn struct { - InHeader - Oldnodeid uint64 -} - -type Owner struct { - Uid uint32 - Gid uint32 -} - -const ( // SetAttrIn.Valid - FATTR_MODE = (1 << 0) - FATTR_UID = (1 << 1) - FATTR_GID = (1 << 2) - FATTR_SIZE = (1 << 3) - FATTR_ATIME = (1 << 4) - FATTR_MTIME = (1 << 5) - FATTR_FH = (1 << 6) - FATTR_ATIME_NOW = (1 << 7) - FATTR_MTIME_NOW = (1 << 8) - FATTR_LOCKOWNER = (1 << 9) - FATTR_CTIME = (1 << 10) -) - -type SetAttrInCommon struct { - InHeader - - Valid uint32 - Padding uint32 - Fh uint64 - Size uint64 - LockOwner uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - Atimensec uint32 - Mtimensec uint32 - Ctimensec uint32 - Mode uint32 - Unused4 uint32 - Owner - Unused5 uint32 -} - -// GetFh returns the file handle if available, or 0 if undefined. -func (s *SetAttrInCommon) GetFh() (uint64, bool) { - if s.Valid&FATTR_FH != 0 { - return s.Fh, true - } - return 0, false -} - -func (s *SetAttrInCommon) GetMode() (uint32, bool) { - if s.Valid&FATTR_MODE != 0 { - return s.Mode & 07777, true - } - return 0, false -} - -func (s *SetAttrInCommon) GetUID() (uint32, bool) { - if s.Valid&FATTR_UID != 0 { - return s.Uid, true - } - return ^uint32(0), false -} - -func (s *SetAttrInCommon) GetGID() (uint32, bool) { - if s.Valid&FATTR_GID != 0 { - return s.Gid, true - } - return ^uint32(0), false -} - -func (s *SetAttrInCommon) GetSize() (uint64, bool) { - if s.Valid&FATTR_SIZE != 0 { - return s.Size, true - } - return 0, false -} - -func (s *SetAttrInCommon) GetMTime() (time.Time, bool) { - var t time.Time - if s.Valid&FATTR_MTIME != 0 { - if s.Valid&FATTR_MTIME_NOW != 0 { - t = time.Now() - } else { - t = time.Unix(int64(s.Mtime), int64(s.Mtimensec)) - } - return t, true - } - - return t, false -} - -func (s *SetAttrInCommon) GetATime() (time.Time, bool) { - var t time.Time - if s.Valid&FATTR_ATIME != 0 { - if s.Valid&FATTR_ATIME_NOW != 0 { - t = time.Now() - } else { - t = time.Unix(int64(s.Atime), int64(s.Atimensec)) - } - return t, true - } - - return t, false -} - -func (s *SetAttrInCommon) GetCTime() (time.Time, bool) { - var t time.Time - if s.Valid&FATTR_CTIME != 0 { - t = time.Unix(int64(s.Ctime), int64(s.Ctimensec)) - return t, true - } - - return t, false -} - -const RELEASE_FLUSH = (1 << 0) - -type ReleaseIn struct { - InHeader - Fh uint64 - Flags uint32 - ReleaseFlags uint32 - LockOwner uint64 -} - -type OpenIn struct { - InHeader - Flags uint32 - Mode uint32 -} - -const ( - // OpenOut.Flags - FOPEN_DIRECT_IO = (1 << 0) - FOPEN_KEEP_CACHE = (1 << 1) - FOPEN_NONSEEKABLE = (1 << 2) - FOPEN_CACHE_DIR = (1 << 3) - FOPEN_STREAM = (1 << 4) -) - -type OpenOut struct { - Fh uint64 - OpenFlags uint32 - Padding uint32 -} - -// To be set in InitIn/InitOut.Flags. -const ( - CAP_ASYNC_READ = (1 << 0) - CAP_POSIX_LOCKS = (1 << 1) - CAP_FILE_OPS = (1 << 2) - CAP_ATOMIC_O_TRUNC = (1 << 3) - CAP_EXPORT_SUPPORT = (1 << 4) - CAP_BIG_WRITES = (1 << 5) - CAP_DONT_MASK = (1 << 6) - CAP_SPLICE_WRITE = (1 << 7) - CAP_SPLICE_MOVE = (1 << 8) - CAP_SPLICE_READ = (1 << 9) - CAP_FLOCK_LOCKS = (1 << 10) - CAP_IOCTL_DIR = (1 << 11) - CAP_AUTO_INVAL_DATA = (1 << 12) - CAP_READDIRPLUS = (1 << 13) - CAP_READDIRPLUS_AUTO = (1 << 14) - CAP_ASYNC_DIO = (1 << 15) - CAP_WRITEBACK_CACHE = (1 << 16) - CAP_NO_OPEN_SUPPORT = (1 << 17) - CAP_PARALLEL_DIROPS = (1 << 18) - CAP_HANDLE_KILLPRIV = (1 << 19) - CAP_POSIX_ACL = (1 << 20) - CAP_ABORT_ERROR = (1 << 21) - CAP_MAX_PAGES = (1 << 22) - CAP_CACHE_SYMLINKS = (1 << 23) - CAP_NO_OPENDIR_SUPPORT = (1 << 24) - CAP_EXPLICIT_INVAL_DATA = (1 << 25) -) - -type InitIn struct { - InHeader - - Major uint32 - Minor uint32 - MaxReadAhead uint32 - Flags uint32 -} - -type InitOut struct { - Major uint32 - Minor uint32 - MaxReadAhead uint32 - Flags uint32 - MaxBackground uint16 - CongestionThreshold uint16 - MaxWrite uint32 - TimeGran uint32 - MaxPages uint16 - Padding uint16 - Unused [8]uint32 -} - -type _CuseInitIn struct { - InHeader - Major uint32 - Minor uint32 - Unused uint32 - Flags uint32 -} - -type _CuseInitOut struct { - Major uint32 - Minor uint32 - Unused uint32 - Flags uint32 - MaxRead uint32 - MaxWrite uint32 - DevMajor uint32 - DevMinor uint32 - Spare [10]uint32 -} - -type InterruptIn struct { - InHeader - Unique uint64 -} - -type _BmapIn struct { - InHeader - Block uint64 - Blocksize uint32 - Padding uint32 -} - -type _BmapOut struct { - Block uint64 -} - -const ( - FUSE_IOCTL_COMPAT = (1 << 0) - FUSE_IOCTL_UNRESTRICTED = (1 << 1) - FUSE_IOCTL_RETRY = (1 << 2) -) - -type _IoctlIn struct { - InHeader - Fh uint64 - Flags uint32 - Cmd uint32 - Arg uint64 - InSize uint32 - OutSize uint32 -} - -type _IoctlOut struct { - Result int32 - Flags uint32 - InIovs uint32 - OutIovs uint32 -} - -type _PollIn struct { - InHeader - Fh uint64 - Kh uint64 - Flags uint32 - Padding uint32 -} - -type _PollOut struct { - Revents uint32 - Padding uint32 -} - -type _NotifyPollWakeupOut struct { - Kh uint64 -} - -type WriteOut struct { - Size uint32 - Padding uint32 -} - -type GetXAttrOut struct { - Size uint32 - Padding uint32 -} - -type FileLock struct { - Start uint64 - End uint64 - Typ uint32 - Pid uint32 -} - -type LkIn struct { - InHeader - Fh uint64 - Owner uint64 - Lk FileLock - LkFlags uint32 - Padding uint32 -} - -type LkOut struct { - Lk FileLock -} - -// For AccessIn.Mask. -const ( - X_OK = 1 - W_OK = 2 - R_OK = 4 - F_OK = 0 -) - -type AccessIn struct { - InHeader - Mask uint32 - Padding uint32 -} - -type FsyncIn struct { - InHeader - Fh uint64 - FsyncFlags uint32 - Padding uint32 -} - -type OutHeader struct { - Length uint32 - Status int32 - Unique uint64 -} - -type NotifyInvalInodeOut struct { - Ino uint64 - Off int64 - Length int64 -} - -type NotifyInvalEntryOut struct { - Parent uint64 - NameLen uint32 - Padding uint32 -} - -type NotifyInvalDeleteOut struct { - Parent uint64 - Child uint64 - NameLen uint32 - Padding uint32 -} - -type NotifyStoreOut struct { - Nodeid uint64 - Offset uint64 - Size uint32 - Padding uint32 -} - -type NotifyRetrieveOut struct { - NotifyUnique uint64 - Nodeid uint64 - Offset uint64 - Size uint32 - Padding uint32 -} - -type NotifyRetrieveIn struct { - InHeader - Dummy1 uint64 - Offset uint64 - Size uint32 - Dummy2 uint32 - Dummy3 uint64 - Dummy4 uint64 -} - -const ( - // NOTIFY_POLL = -1 // notify kernel that a poll waiting for IO on a file handle should wake up - NOTIFY_INVAL_INODE = -2 // notify kernel that an inode should be invalidated - NOTIFY_INVAL_ENTRY = -3 // notify kernel that a directory entry should be invalidated - NOTIFY_STORE_CACHE = -4 // store data into kernel cache of an inode - NOTIFY_RETRIEVE_CACHE = -5 // retrieve data from kernel cache of an inode - NOTIFY_DELETE = -6 // notify kernel that a directory entry has been deleted - -// NOTIFY_CODE_MAX = -6 -) - -type FlushIn struct { - InHeader - Fh uint64 - Unused uint32 - Padding uint32 - LockOwner uint64 -} - -type LseekIn struct { - InHeader - Fh uint64 - Offset uint64 - Whence uint32 - Padding uint32 -} - -type LseekOut struct { - Offset uint64 -} - -type CopyFileRangeIn struct { - InHeader - FhIn uint64 - OffIn uint64 - NodeIdOut uint64 - FhOut uint64 - OffOut uint64 - Len uint64 - Flags uint64 -} - -// EntryOut holds the result of a (directory,name) lookup. It has two -// TTLs, one for the (directory, name) lookup itself, and one for the -// attributes (eg. size, mode). The entry TTL also applies if the -// lookup result is ENOENT ("negative entry lookup") -type EntryOut struct { - NodeId uint64 - Generation uint64 - EntryValid uint64 - AttrValid uint64 - EntryValidNsec uint32 - AttrValidNsec uint32 - Attr -} - -// EntryTimeout returns entry timeout currently -func (o *EntryOut) EntryTimeout() time.Duration { - return time.Duration(uint64(o.EntryValidNsec) + o.EntryValid*1e9) -} - -func (o *EntryOut) AttrTimeout() time.Duration { - return time.Duration(uint64(o.AttrValidNsec) + o.AttrValid*1e9) -} - -func (o *EntryOut) SetEntryTimeout(dt time.Duration) { - ns := int64(dt) - o.EntryValidNsec = uint32(ns % 1e9) - o.EntryValid = uint64(ns / 1e9) -} - -func (o *EntryOut) SetAttrTimeout(dt time.Duration) { - ns := int64(dt) - o.AttrValidNsec = uint32(ns % 1e9) - o.AttrValid = uint64(ns / 1e9) -} - -type AttrOut struct { - AttrValid uint64 - AttrValidNsec uint32 - Dummy uint32 - Attr -} - -func (o *AttrOut) Timeout() time.Duration { - return time.Duration(uint64(o.AttrValidNsec) + o.AttrValid*1e9) -} - -func (o *AttrOut) SetTimeout(dt time.Duration) { - ns := int64(dt) - o.AttrValidNsec = uint32(ns % 1e9) - o.AttrValid = uint64(ns / 1e9) -} - -type CreateOut struct { - EntryOut - OpenOut -} - -// Caller has data on the process making the FS call. -// -// The UID and GID are effective UID/GID, except for the ACCESS -// opcode, where UID and GID are the real UIDs -type Caller struct { - Owner - Pid uint32 -} - -type InHeader struct { - Length uint32 - Opcode uint32 - Unique uint64 - NodeId uint64 - Caller - Padding uint32 -} - -type StatfsOut struct { - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Bsize uint32 - NameLen uint32 - Frsize uint32 - Padding uint32 - Spare [6]uint32 -} - -// _Dirent is what we send to the kernel, but we offer DirEntry and -// DirEntryList to the user. -type _Dirent struct { - Ino uint64 - Off uint64 - NameLen uint32 - Typ uint32 -} - -const ( - READ_LOCKOWNER = (1 << 1) -) - -const ( - WRITE_CACHE = (1 << 0) - WRITE_LOCKOWNER = (1 << 1) -) - -type FallocateIn struct { - InHeader - Fh uint64 - Offset uint64 - Length uint64 - Mode uint32 - Padding uint32 -} - -func (lk *FileLock) ToFlockT(flockT *syscall.Flock_t) { - flockT.Start = int64(lk.Start) - if lk.End == (1<<63)-1 { - flockT.Len = 0 - } else { - flockT.Len = int64(lk.End - lk.Start + 1) - } - flockT.Whence = int16(io.SeekStart) - flockT.Type = int16(lk.Typ) -} - -func (lk *FileLock) FromFlockT(flockT *syscall.Flock_t) { - lk.Typ = uint32(flockT.Type) - if flockT.Type != syscall.F_UNLCK { - lk.Start = uint64(flockT.Start) - if flockT.Len == 0 { - lk.End = (1 << 63) - 1 - } else { - lk.End = uint64(flockT.Start + flockT.Len - 1) - } - } - lk.Pid = uint32(flockT.Pid) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/types_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/types_darwin.go deleted file mode 100644 index 693fa69fe..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/types_darwin.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "syscall" -) - -const ( - ENOATTR = Status(syscall.ENOATTR) // ENOATTR is not defined for all GOOS. - - // EREMOTEIO is not supported on Darwin. - EREMOTEIO = Status(syscall.EIO) -) - -type Attr struct { - Ino uint64 - Size uint64 - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - Crtime_ uint64 // OS X - Atimensec uint32 - Mtimensec uint32 - Ctimensec uint32 - Crtimensec_ uint32 // OS X - Mode uint32 - Nlink uint32 - Owner - Rdev uint32 - Flags_ uint32 // OS X -} - -const ( - FATTR_CRTIME = (1 << 28) - FATTR_CHGTIME = (1 << 29) - FATTR_BKUPTIME = (1 << 30) - FATTR_FLAGS = (1 << 31) -) - -type SetAttrIn struct { - SetAttrInCommon - - // OS X only - Bkuptime_ uint64 - Chgtime_ uint64 - Crtime uint64 - BkuptimeNsec uint32 - ChgtimeNsec uint32 - CrtimeNsec uint32 - Flags_ uint32 // see chflags(2) -} - -const ( - FOPEN_PURGE_ATTR = (1 << 30) - FOPEN_PURGE_UBC = (1 << 31) -) - -// compat with linux. -const ( - // Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set. - FUSE_GETATTR_FH = (1 << 0) -) - -type GetAttrIn struct { - InHeader -} - -func (g *GetAttrIn) Flags() uint32 { - return 0 -} - -func (g *GetAttrIn) Fh() uint64 { - return 0 -} - -// Uses OpenIn struct for create. -type CreateIn struct { - InHeader - - Flags uint32 - Mode uint32 -} - -type MknodIn struct { - InHeader - - Mode uint32 - Rdev uint32 -} - -type ReadIn struct { - InHeader - - Fh uint64 - Offset uint64 - Size uint32 - ReadFlags uint32 -} - -type WriteIn struct { - InHeader - Fh uint64 - Offset uint64 - Size uint32 - WriteFlags uint32 -} - -type SetXAttrIn struct { - InHeader - Size uint32 - Flags uint32 - Position uint32 - Padding uint32 -} - -type GetXAttrIn struct { - InHeader - Size uint32 - Padding uint32 - Position uint32 - Padding2 uint32 -} - -const ( - CAP_CASE_INSENSITIVE = (1 << 29) - CAP_VOL_RENAME = (1 << 30) - CAP_XTIMES = (1 << 31) -) - -type GetxtimesOut struct { - Bkuptime uint64 - Crtime uint64 - Bkuptimensec uint32 - Crtimensec uint32 -} - -type ExchangeIn struct { - InHeader - Olddir uint64 - Newdir uint64 - Options uint64 -} - -func (s *StatfsOut) FromStatfsT(statfs *syscall.Statfs_t) { - s.Blocks = statfs.Blocks - s.Bfree = statfs.Bfree - s.Bavail = statfs.Bavail - s.Files = statfs.Files - s.Ffree = statfs.Ffree - s.Bsize = uint32(statfs.Iosize) // Iosize translates to Bsize: the optimal transfer size. - s.Frsize = s.Bsize // Bsize translates to Frsize: the minimum transfer size. - - // The block counts are in units of statfs.Bsize. - // If s.Bsize != statfs.Bsize, we have to recalculate the block counts - // accordingly (s.Bsize is usually 256*statfs.Bsize). - if s.Bsize > statfs.Bsize { - adj := uint64(s.Bsize / statfs.Bsize) - s.Blocks /= adj - s.Bfree /= adj - s.Bavail /= adj - } -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/fuse/types_linux.go b/vendor/github.com/hanwen/go-fuse/v2/fuse/types_linux.go deleted file mode 100644 index b1e088f52..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/fuse/types_linux.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuse - -import ( - "syscall" -) - -const ( - ENOATTR = Status(syscall.ENODATA) // On Linux, ENOATTR is an alias for ENODATA. - - // EREMOTEIO Remote I/O error - EREMOTEIO = Status(syscall.EREMOTEIO) -) - -type Attr struct { - Ino uint64 - Size uint64 - - // Blocks is the number of 512-byte blocks that the file occupies on disk. - Blocks uint64 - Atime uint64 - Mtime uint64 - Ctime uint64 - Atimensec uint32 - Mtimensec uint32 - Ctimensec uint32 - Mode uint32 - Nlink uint32 - Owner - Rdev uint32 - - // Blksize is the preferred size for file system operations. - Blksize uint32 - Padding uint32 -} - -type SetAttrIn struct { - SetAttrInCommon -} - -const ( - // Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set. - FUSE_GETATTR_FH = (1 << 0) -) - -type GetAttrIn struct { - InHeader - - Flags_ uint32 - Dummy uint32 - Fh_ uint64 -} - -// Flags accesses the flags. This is a method, because OSXFuse does not -// have GetAttrIn flags. -func (g *GetAttrIn) Flags() uint32 { - return g.Flags_ -} - -// Fh accesses the file handle. This is a method, because OSXFuse does not -// have GetAttrIn flags. -func (g *GetAttrIn) Fh() uint64 { - return g.Fh_ -} - -type CreateIn struct { - InHeader - Flags uint32 - - // Mode for the new file; already takes Umask into account. - Mode uint32 - - // Umask used for this create call. - Umask uint32 - Padding uint32 -} - -type MknodIn struct { - InHeader - - // Mode to use, including the Umask value - Mode uint32 - Rdev uint32 - Umask uint32 - Padding uint32 -} - -type ReadIn struct { - InHeader - Fh uint64 - Offset uint64 - Size uint32 - ReadFlags uint32 - LockOwner uint64 - Flags uint32 - Padding uint32 -} - -type WriteIn struct { - InHeader - Fh uint64 - Offset uint64 - Size uint32 - WriteFlags uint32 - LockOwner uint64 - Flags uint32 - Padding uint32 -} - -type SetXAttrIn struct { - InHeader - Size uint32 - Flags uint32 -} - -type GetXAttrIn struct { - InHeader - Size uint32 - Padding uint32 -} - -func (s *StatfsOut) FromStatfsT(statfs *syscall.Statfs_t) { - s.Blocks = statfs.Blocks - s.Bsize = uint32(statfs.Bsize) - s.Bfree = statfs.Bfree - s.Bavail = statfs.Bavail - s.Files = statfs.Files - s.Ffree = statfs.Ffree - s.Frsize = uint32(statfs.Frsize) - s.NameLen = uint32(statfs.Namelen) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/internal/access.go b/vendor/github.com/hanwen/go-fuse/v2/internal/access.go deleted file mode 100644 index 1d865070e..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/internal/access.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2019 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -import ( - "os/user" - "strconv" -) - -// HasAccess tests if a caller can access a file with permissions -// `perm` in mode `mask` -func HasAccess(callerUid, callerGid, fileUid, fileGid uint32, perm uint32, mask uint32) bool { - if callerUid == 0 { - // root can do anything. - return true - } - mask = mask & 7 - if mask == 0 { - return true - } - - if callerUid == fileUid { - if perm&(mask<<6) != 0 { - return true - } - } - if callerGid == fileGid { - if perm&(mask<<3) != 0 { - return true - } - } - if perm&mask != 0 { - return true - } - - // Check other groups. - if perm&(mask<<3) == 0 { - // avoid expensive lookup if it's not allowed anyway - return false - } - - u, err := user.LookupId(strconv.Itoa(int(callerUid))) - if err != nil { - return false - } - gs, err := u.GroupIds() - if err != nil { - return false - } - - fileGidStr := strconv.Itoa(int(fileGid)) - for _, gidStr := range gs { - if gidStr == fileGidStr { - return true - } - } - return false -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_darwin.go deleted file mode 100644 index c7a216e98..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_darwin.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package utimens - -import ( - "syscall" - "time" - - "github.com/hanwen/go-fuse/v2/fuse" -) - -// timeToTimeval converts time.Time to syscall.Timeval -func timeToTimeval(t *time.Time) syscall.Timeval { - // Note: This does not use syscall.NsecToTimespec because - // that does not work properly for times before 1970, - // see https://github.com/golang/go/issues/12777 - var tv syscall.Timeval - tv.Usec = int32(t.Nanosecond() / 1000) - tv.Sec = t.Unix() - return tv -} - -// Fill converts a and m to a syscall.Timeval slice that can be passed -// to syscall.Utimes. Missing values (if any) are taken from attr -func Fill(a *time.Time, m *time.Time, attr *fuse.Attr) []syscall.Timeval { - if a == nil { - a2 := time.Unix(int64(attr.Atime), int64(attr.Atimensec)) - a = &a2 - } - if m == nil { - m2 := time.Unix(int64(attr.Mtime), int64(attr.Mtimensec)) - m = &m2 - } - tv := make([]syscall.Timeval, 2) - tv[0] = timeToTimeval(a) - tv[1] = timeToTimeval(m) - return tv -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_linux.go b/vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_linux.go deleted file mode 100644 index 7132090a5..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/internal/utimens/utimens_linux.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2018 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package utimens - -// placeholder file so this package exists on all platforms. diff --git a/vendor/github.com/hanwen/go-fuse/v2/splice/copy.go b/vendor/github.com/hanwen/go-fuse/v2/splice/copy.go deleted file mode 100644 index e50ca0d12..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/splice/copy.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package splice - -import ( - "io" - "os" -) - -func SpliceCopy(dst *os.File, src *os.File, p *Pair) (int64, error) { - total := int64(0) - - for { - n, err := p.LoadFrom(src.Fd(), p.size) - if err != nil { - return total, err - } - if n == 0 { - break - } - m, err := p.WriteTo(dst.Fd(), n) - total += int64(m) - if err != nil { - return total, err - } - if m < n { - return total, err - } - if int(n) < p.size { - break - } - } - - return total, nil -} - -// Argument ordering follows io.Copy. -func CopyFile(dstName string, srcName string, mode int) error { - src, err := os.Open(srcName) - if err != nil { - return err - } - defer src.Close() - - dst, err := os.OpenFile(dstName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(mode)) - if err != nil { - return err - } - defer dst.Close() - - return CopyFds(dst, src) -} - -func CopyFds(dst *os.File, src *os.File) (err error) { - p, err := splicePool.get() - if p != nil { - p.Grow(256 * 1024) - _, err := SpliceCopy(dst, src, p) - splicePool.done(p) - return err - } else { - _, err = io.Copy(dst, src) - } - if err == io.EOF { - err = nil - } - return err -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/splice/pair.go b/vendor/github.com/hanwen/go-fuse/v2/splice/pair.go deleted file mode 100644 index d7d7a42a0..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/splice/pair.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package splice - -import ( - "fmt" - "syscall" -) - -type Pair struct { - r, w int - size int -} - -func (p *Pair) MaxGrow() { - for p.Grow(2*p.size) == nil { - } -} - -func (p *Pair) Grow(n int) error { - if n <= p.size { - return nil - } - if !resizable { - return fmt.Errorf("splice: want %d bytes, but not resizable", n) - } - if n > maxPipeSize { - return fmt.Errorf("splice: want %d bytes, max pipe size %d", n, maxPipeSize) - } - - newsize, errNo := fcntl(uintptr(p.r), F_SETPIPE_SZ, n) - if errNo != 0 { - return fmt.Errorf("splice: fcntl returned %v", errNo) - } - p.size = newsize - return nil -} - -func (p *Pair) Cap() int { - return p.size -} - -func (p *Pair) Close() error { - err1 := syscall.Close(p.r) - err2 := syscall.Close(p.w) - if err1 != nil { - return err1 - } - return err2 -} - -func (p *Pair) Read(d []byte) (n int, err error) { - return syscall.Read(p.r, d) -} - -func (p *Pair) Write(d []byte) (n int, err error) { - return syscall.Write(p.w, d) -} - -func (p *Pair) ReadFd() uintptr { - return uintptr(p.r) -} - -func (p *Pair) WriteFd() uintptr { - return uintptr(p.w) -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/splice/pair_darwin.go b/vendor/github.com/hanwen/go-fuse/v2/splice/pair_darwin.go deleted file mode 100644 index 8780bb1a2..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/splice/pair_darwin.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package splice - -import () - -func (p *Pair) LoadFromAt(fd uintptr, sz int, off int64) (int, error) { - panic("not implemented") - return 0, nil -} - -func (p *Pair) LoadFrom(fd uintptr, sz int) (int, error) { - panic("not implemented") - return 0, nil -} - -func (p *Pair) WriteTo(fd uintptr, n int) (int, error) { - panic("not implemented") - return 0, nil -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/splice/pair_linux.go b/vendor/github.com/hanwen/go-fuse/v2/splice/pair_linux.go deleted file mode 100644 index f8923e307..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/splice/pair_linux.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package splice - -import ( - "fmt" - "log" - "os" - "syscall" -) - -func (p *Pair) LoadFromAt(fd uintptr, sz int, off int64) (int, error) { - n, err := syscall.Splice(int(fd), &off, p.w, nil, sz, 0) - return int(n), err -} - -func (p *Pair) LoadFrom(fd uintptr, sz int) (int, error) { - if sz > p.size { - return 0, fmt.Errorf("LoadFrom: not enough space %d, %d", - sz, p.size) - } - - n, err := syscall.Splice(int(fd), nil, p.w, nil, sz, 0) - if err != nil { - err = os.NewSyscallError("Splice load from", err) - } - return int(n), err -} - -func (p *Pair) WriteTo(fd uintptr, n int) (int, error) { - m, err := syscall.Splice(p.r, nil, int(fd), nil, int(n), 0) - if err != nil { - err = os.NewSyscallError("Splice write", err) - } - return int(m), err -} - -const _SPLICE_F_NONBLOCK = 0x2 - -func (p *Pair) discard() { - _, err := syscall.Splice(p.r, nil, int(devNullFD), nil, int(p.size), _SPLICE_F_NONBLOCK) - if err == syscall.EAGAIN { - // all good. - } else if err != nil { - errR := syscall.Close(p.r) - errW := syscall.Close(p.w) - - // This can happen if something closed our fd - // inadvertently (eg. double close) - log.Panicf("splicing into /dev/null: %v (close R %d '%v', close W %d '%v')", err, p.r, errR, p.w, errW) - } -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/splice/pool.go b/vendor/github.com/hanwen/go-fuse/v2/splice/pool.go deleted file mode 100644 index 93598959e..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/splice/pool.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package splice - -import ( - "sync" -) - -var splicePool *pairPool - -type pairPool struct { - sync.Mutex - unused []*Pair - usedCount int -} - -func ClearSplicePool() { - splicePool.clear() -} - -func Get() (*Pair, error) { - return splicePool.get() -} - -func Total() int { - return splicePool.total() -} - -func Used() int { - return splicePool.used() -} - -// Done returns the pipe pair to pool. -func Done(p *Pair) { - splicePool.done(p) -} - -// Closes and discards pipe pair. -func Drop(p *Pair) { - splicePool.drop(p) -} - -func newSplicePairPool() *pairPool { - return &pairPool{} -} - -func (pp *pairPool) clear() { - pp.Lock() - for _, p := range pp.unused { - p.Close() - } - pp.unused = pp.unused[:0] - pp.Unlock() -} - -func (pp *pairPool) used() (n int) { - pp.Lock() - n = pp.usedCount - pp.Unlock() - - return n -} - -func (pp *pairPool) total() int { - pp.Lock() - n := pp.usedCount + len(pp.unused) - pp.Unlock() - return n -} - -func (pp *pairPool) drop(p *Pair) { - p.Close() - pp.Lock() - pp.usedCount-- - pp.Unlock() -} - -func (pp *pairPool) get() (p *Pair, err error) { - pp.Lock() - defer pp.Unlock() - - pp.usedCount++ - l := len(pp.unused) - if l > 0 { - p := pp.unused[l-1] - pp.unused = pp.unused[:l-1] - return p, nil - } - - return newSplicePair() -} - -func (pp *pairPool) done(p *Pair) { - p.discard() - pp.Lock() - pp.usedCount-- - pp.unused = append(pp.unused, p) - pp.Unlock() -} - -func init() { - splicePool = newSplicePairPool() -} diff --git a/vendor/github.com/hanwen/go-fuse/v2/splice/splice.go b/vendor/github.com/hanwen/go-fuse/v2/splice/splice.go deleted file mode 100644 index cbb20b4e0..000000000 --- a/vendor/github.com/hanwen/go-fuse/v2/splice/splice.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 the Go-FUSE Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package splice - -// Routines for efficient file to file copying. - -import ( - "fmt" - "io/ioutil" - "log" - "os" - "syscall" -) - -var maxPipeSize int -var resizable bool - -func Resizable() bool { - return resizable -} - -func MaxPipeSize() int { - return maxPipeSize -} - -// From manpage on ubuntu Lucid: -// -// Since Linux 2.6.11, the pipe capacity is 65536 bytes. -const DefaultPipeSize = 16 * 4096 - -// We empty pipes by splicing to /dev/null. -var devNullFD uintptr - -func init() { - content, err := ioutil.ReadFile("/proc/sys/fs/pipe-max-size") - if err != nil { - maxPipeSize = DefaultPipeSize - } else { - fmt.Sscan(string(content), &maxPipeSize) - } - - r, w, err := os.Pipe() - if err != nil { - log.Panicf("cannot create pipe: %v", err) - } - sz, errNo := fcntl(r.Fd(), F_GETPIPE_SZ, 0) - resizable = (errNo == 0) - _, errNo = fcntl(r.Fd(), F_SETPIPE_SZ, 2*sz) - resizable = resizable && (errNo == 0) - r.Close() - w.Close() - - fd, err := syscall.Open("/dev/null", os.O_WRONLY, 0) - if err != nil { - log.Panicf("splice: %v", err) - } - - devNullFD = uintptr(fd) -} - -// copy & paste from syscall. -func fcntl(fd uintptr, cmd int, arg int) (val int, errno syscall.Errno) { - r0, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, fd, uintptr(cmd), uintptr(arg)) - val = int(r0) - errno = syscall.Errno(e1) - return -} - -const F_SETPIPE_SZ = 1031 -const F_GETPIPE_SZ = 1032 - -func osPipe() (int, int, error) { - var fds [2]int - err := syscall.Pipe2(fds[:], syscall.O_NONBLOCK) - return fds[0], fds[1], err -} - -func newSplicePair() (p *Pair, err error) { - p = &Pair{} - p.r, p.w, err = osPipe() - if err != nil { - return nil, err - } - var errNo syscall.Errno - p.size, errNo = fcntl(uintptr(p.r), F_GETPIPE_SZ, 0) - if err == syscall.EINVAL { - p.size = DefaultPipeSize - return p, nil - } - if errNo != 0 { - p.Close() - return nil, fmt.Errorf("fcntl getsize: %v", errNo) - } - return p, nil -} diff --git a/vendor/github.com/inconshreveable/mousetrap/LICENSE b/vendor/github.com/inconshreveable/mousetrap/LICENSE deleted file mode 100644 index 5f0d1fb6a..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2014 Alan Shreve - -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/inconshreveable/mousetrap/README.md b/vendor/github.com/inconshreveable/mousetrap/README.md deleted file mode 100644 index 7a950d177..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# mousetrap - -mousetrap is a tiny library that answers a single question. - -On a Windows machine, was the process invoked by someone double clicking on -the executable file while browsing in explorer? - -### Motivation - -Windows developers unfamiliar with command line tools will often "double-click" -the executable for a tool. Because most CLI tools print the help and then exit -when invoked without arguments, this is often very frustrating for those users. - -mousetrap provides a way to detect these invocations so that you can provide -more helpful behavior and instructions on how to run the CLI tool. To see what -this looks like, both from an organizational and a technical perspective, see -https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ - -### The interface - -The library exposes a single interface: - - func StartedByExplorer() (bool) diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/vendor/github.com/inconshreveable/mousetrap/trap_others.go deleted file mode 100644 index 9d2d8a4ba..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_others.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build !windows - -package mousetrap - -// StartedByExplorer returns true if the program was invoked by the user -// double-clicking on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -// -// On non-Windows platforms, it always returns false. -func StartedByExplorer() bool { - return false -} diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go deleted file mode 100644 index 336142a5e..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go +++ /dev/null @@ -1,98 +0,0 @@ -// +build windows -// +build !go1.4 - -package mousetrap - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const ( - // defined by the Win32 API - th32cs_snapprocess uintptr = 0x2 -) - -var ( - kernel = syscall.MustLoadDLL("kernel32.dll") - CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") - Process32First = kernel.MustFindProc("Process32FirstW") - Process32Next = kernel.MustFindProc("Process32NextW") -) - -// ProcessEntry32 structure defined by the Win32 API -type processEntry32 struct { - dwSize uint32 - cntUsage uint32 - th32ProcessID uint32 - th32DefaultHeapID int - th32ModuleID uint32 - cntThreads uint32 - th32ParentProcessID uint32 - pcPriClassBase int32 - dwFlags uint32 - szExeFile [syscall.MAX_PATH]uint16 -} - -func getProcessEntry(pid int) (pe *processEntry32, err error) { - snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) - if snapshot == uintptr(syscall.InvalidHandle) { - err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) - return - } - defer syscall.CloseHandle(syscall.Handle(snapshot)) - - var processEntry processEntry32 - processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) - ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32First: %v", e1) - return - } - - for { - if processEntry.th32ProcessID == uint32(pid) { - pe = &processEntry - return - } - - ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32Next: %v", e1) - return - } - } -} - -func getppid() (pid int, err error) { - pe, err := getProcessEntry(os.Getpid()) - if err != nil { - return - } - - pid = int(pe.th32ParentProcessID) - return -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - ppid, err := getppid() - if err != nil { - return false - } - - pe, err := getProcessEntry(ppid) - if err != nil { - return false - } - - name := syscall.UTF16ToString(pe.szExeFile[:]) - return name == "explorer.exe" -} diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go deleted file mode 100644 index 9a28e57c3..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build windows -// +build go1.4 - -package mousetrap - -import ( - "os" - "syscall" - "unsafe" -) - -func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { - snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) - if err != nil { - return nil, err - } - defer syscall.CloseHandle(snapshot) - var procEntry syscall.ProcessEntry32 - procEntry.Size = uint32(unsafe.Sizeof(procEntry)) - if err = syscall.Process32First(snapshot, &procEntry); err != nil { - return nil, err - } - for { - if procEntry.ProcessID == uint32(pid) { - return &procEntry, nil - } - err = syscall.Process32Next(snapshot, &procEntry) - if err != nil { - return nil, err - } - } -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - pe, err := getProcessEntry(os.Getppid()) - if err != nil { - return false - } - return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) -} diff --git a/vendor/github.com/jlaffaye/ftp/.travis.yml b/vendor/github.com/jlaffaye/ftp/.travis.yml deleted file mode 100644 index 72038ec25..000000000 --- a/vendor/github.com/jlaffaye/ftp/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go -sudo: required -dist: xenial -go: - - 1.11.x - - 1.12.x - - 1.13.x -before_install: -- sudo sysctl net.ipv6.conf.lo.disable_ipv6=0 -- go get github.com/mattn/goveralls -- go get golang.org/x/lint/golint -script: -- goveralls -v -- golint -set_exit_status $(go list ./...) diff --git a/vendor/github.com/jlaffaye/ftp/LICENSE b/vendor/github.com/jlaffaye/ftp/LICENSE deleted file mode 100644 index 9ab085c51..000000000 --- a/vendor/github.com/jlaffaye/ftp/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2011-2013, Julien Laffaye - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/jlaffaye/ftp/README.md b/vendor/github.com/jlaffaye/ftp/README.md deleted file mode 100644 index 8488deb9c..000000000 --- a/vendor/github.com/jlaffaye/ftp/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# goftp # - -[![Build Status](https://travis-ci.org/jlaffaye/ftp.svg?branch=master)](https://travis-ci.org/jlaffaye/ftp) -[![Coverage Status](https://coveralls.io/repos/jlaffaye/ftp/badge.svg?branch=master&service=github)](https://coveralls.io/github/jlaffaye/ftp?branch=master) -[![Go ReportCard](http://goreportcard.com/badge/jlaffaye/ftp)](http://goreportcard.com/report/jlaffaye/ftp) -[![godoc.org](https://godoc.org/github.com/jlaffaye/ftp?status.svg)](http://godoc.org/github.com/jlaffaye/ftp) - -A FTP client package for Go - -## Install ## - -``` -go get -u github.com/jlaffaye/ftp -``` - -## Example ## - -```go -c, err := ftp.Dial("ftp.example.org:21", ftp.DialWithTimeout(5*time.Second)) -if err != nil { - log.Fatal(err) -} - -err = c.Login("anonymous", "anonymous") -if err != nil { - log.Fatal(err) -} - -// Do something with the FTP conn - -if err := c.Quit(); err != nil { - log.Fatal(err) -} -``` - -## Store a file example ## - -```go -data := bytes.NewBufferString("Hello World") -err = c.Stor("test-file.txt", data) -if err != nil { - panic(err) -} -``` - -## Read a file example ## - -```go -r, err := c.Retr("test-file.txt") -if err != nil { - panic(err) -} -defer r.Close() - -buf, err := ioutil.ReadAll(r) -println(string(buf)) -``` diff --git a/vendor/github.com/jlaffaye/ftp/debug.go b/vendor/github.com/jlaffaye/ftp/debug.go deleted file mode 100644 index 864566cc7..000000000 --- a/vendor/github.com/jlaffaye/ftp/debug.go +++ /dev/null @@ -1,21 +0,0 @@ -package ftp - -import "io" - -type debugWrapper struct { - conn io.ReadWriteCloser - io.Reader - io.Writer -} - -func newDebugWrapper(conn io.ReadWriteCloser, w io.Writer) io.ReadWriteCloser { - return &debugWrapper{ - Reader: io.TeeReader(conn, w), - Writer: io.MultiWriter(w, conn), - conn: conn, - } -} - -func (w *debugWrapper) Close() error { - return w.conn.Close() -} diff --git a/vendor/github.com/jlaffaye/ftp/ftp.go b/vendor/github.com/jlaffaye/ftp/ftp.go deleted file mode 100644 index faf1c9cc6..000000000 --- a/vendor/github.com/jlaffaye/ftp/ftp.go +++ /dev/null @@ -1,812 +0,0 @@ -// Package ftp implements a FTP client as described in RFC 959. -// -// A textproto.Error is returned for errors at the protocol level. -package ftp - -import ( - "bufio" - "context" - "crypto/tls" - "errors" - "io" - "net" - "net/textproto" - "strconv" - "strings" - "time" -) - -// EntryType describes the different types of an Entry. -type EntryType int - -// The differents types of an Entry -const ( - EntryTypeFile EntryType = iota - EntryTypeFolder - EntryTypeLink -) - -// ServerConn represents the connection to a remote FTP server. -// A single connection only supports one in-flight data connection. -// It is not safe to be called concurrently. -type ServerConn struct { - options *dialOptions - conn *textproto.Conn - host string - - // Server capabilities discovered at runtime - features map[string]string - skipEPSV bool - mlstSupported bool -} - -// DialOption represents an option to start a new connection with Dial -type DialOption struct { - setup func(do *dialOptions) -} - -// dialOptions contains all the options set by DialOption.setup -type dialOptions struct { - context context.Context - dialer net.Dialer - tlsConfig *tls.Config - explicitTLS bool - conn net.Conn - disableEPSV bool - location *time.Location - debugOutput io.Writer - dialFunc func(network, address string) (net.Conn, error) -} - -// Entry describes a file and is returned by List(). -type Entry struct { - Name string - Target string // target of symbolic link - Type EntryType - Size uint64 - Time time.Time -} - -// Response represents a data-connection -type Response struct { - conn net.Conn - c *ServerConn - closed bool -} - -// Dial connects to the specified address with optional options -func Dial(addr string, options ...DialOption) (*ServerConn, error) { - do := &dialOptions{} - for _, option := range options { - option.setup(do) - } - - if do.location == nil { - do.location = time.UTC - } - - tconn := do.conn - if tconn == nil { - var err error - - if do.dialFunc != nil { - tconn, err = do.dialFunc("tcp", addr) - } else if do.tlsConfig != nil && !do.explicitTLS { - tconn, err = tls.DialWithDialer(&do.dialer, "tcp", addr, do.tlsConfig) - } else { - ctx := do.context - - if ctx == nil { - ctx = context.Background() - } - - tconn, err = do.dialer.DialContext(ctx, "tcp", addr) - } - - if err != nil { - return nil, err - } - } - - // Use the resolved IP address in case addr contains a domain name - // If we use the domain name, we might not resolve to the same IP. - remoteAddr := tconn.RemoteAddr().(*net.TCPAddr) - - c := &ServerConn{ - options: do, - features: make(map[string]string), - conn: textproto.NewConn(do.wrapConn(tconn)), - host: remoteAddr.IP.String(), - } - - _, _, err := c.conn.ReadResponse(StatusReady) - if err != nil { - c.Quit() - return nil, err - } - - if do.explicitTLS { - if err := c.authTLS(); err != nil { - _ = c.Quit() - return nil, err - } - tconn = tls.Client(tconn, do.tlsConfig) - c.conn = textproto.NewConn(do.wrapConn(tconn)) - } - - err = c.feat() - if err != nil { - c.Quit() - return nil, err - } - - if _, mlstSupported := c.features["MLST"]; mlstSupported { - c.mlstSupported = true - } - - return c, nil -} - -// DialWithTimeout returns a DialOption that configures the ServerConn with specified timeout -func DialWithTimeout(timeout time.Duration) DialOption { - return DialOption{func(do *dialOptions) { - do.dialer.Timeout = timeout - }} -} - -// DialWithDialer returns a DialOption that configures the ServerConn with specified net.Dialer -func DialWithDialer(dialer net.Dialer) DialOption { - return DialOption{func(do *dialOptions) { - do.dialer = dialer - }} -} - -// DialWithNetConn returns a DialOption that configures the ServerConn with the underlying net.Conn -func DialWithNetConn(conn net.Conn) DialOption { - return DialOption{func(do *dialOptions) { - do.conn = conn - }} -} - -// DialWithDisabledEPSV returns a DialOption that configures the ServerConn with EPSV disabled -// Note that EPSV is only used when advertised in the server features. -func DialWithDisabledEPSV(disabled bool) DialOption { - return DialOption{func(do *dialOptions) { - do.disableEPSV = disabled - }} -} - -// DialWithLocation returns a DialOption that configures the ServerConn with specified time.Location -// The location is used to parse the dates sent by the server which are in server's timezone -func DialWithLocation(location *time.Location) DialOption { - return DialOption{func(do *dialOptions) { - do.location = location - }} -} - -// DialWithContext returns a DialOption that configures the ServerConn with specified context -// The context will be used for the initial connection setup -func DialWithContext(ctx context.Context) DialOption { - return DialOption{func(do *dialOptions) { - do.context = ctx - }} -} - -// DialWithTLS returns a DialOption that configures the ServerConn with specified TLS config -// -// If called together with the DialWithDialFunc option, the DialWithDialFunc function -// will be used when dialing new connections but regardless of the function, -// the connection will be treated as a TLS connection. -func DialWithTLS(tlsConfig *tls.Config) DialOption { - return DialOption{func(do *dialOptions) { - do.tlsConfig = tlsConfig - }} -} - -// DialWithExplicitTLS returns a DialOption that configures the ServerConn to be upgraded to TLS -// See DialWithTLS for general TLS documentation -func DialWithExplicitTLS(tlsConfig *tls.Config) DialOption { - return DialOption{func(do *dialOptions) { - do.explicitTLS = true - do.tlsConfig = tlsConfig - }} -} - -// DialWithDebugOutput returns a DialOption that configures the ServerConn to write to the Writer -// everything it reads from the server -func DialWithDebugOutput(w io.Writer) DialOption { - return DialOption{func(do *dialOptions) { - do.debugOutput = w - }} -} - -// DialWithDialFunc returns a DialOption that configures the ServerConn to use the -// specified function to establish both control and data connections -// -// If used together with the DialWithNetConn option, the DialWithNetConn -// takes precedence for the control connection, while data connections will -// be established using function specified with the DialWithDialFunc option -func DialWithDialFunc(f func(network, address string) (net.Conn, error)) DialOption { - return DialOption{func(do *dialOptions) { - do.dialFunc = f - }} -} - -func (o *dialOptions) wrapConn(netConn net.Conn) io.ReadWriteCloser { - if o.debugOutput == nil { - return netConn - } - - return newDebugWrapper(netConn, o.debugOutput) -} - -// Connect is an alias to Dial, for backward compatibility -func Connect(addr string) (*ServerConn, error) { - return Dial(addr) -} - -// DialTimeout initializes the connection to the specified ftp server address. -// -// It is generally followed by a call to Login() as most FTP commands require -// an authenticated user. -func DialTimeout(addr string, timeout time.Duration) (*ServerConn, error) { - return Dial(addr, DialWithTimeout(timeout)) -} - -// Login authenticates the client with specified user and password. -// -// "anonymous"/"anonymous" is a common user/password scheme for FTP servers -// that allows anonymous read-only accounts. -func (c *ServerConn) Login(user, password string) error { - code, message, err := c.cmd(-1, "USER %s", user) - if err != nil { - return err - } - - switch code { - case StatusLoggedIn: - case StatusUserOK: - _, _, err = c.cmd(StatusLoggedIn, "PASS %s", password) - if err != nil { - return err - } - default: - return errors.New(message) - } - - // Switch to binary mode - if _, _, err = c.cmd(StatusCommandOK, "TYPE I"); err != nil { - return err - } - - // Switch to UTF-8 - err = c.setUTF8() - - // If using implicit TLS, make data connections also use TLS - if c.options.tlsConfig != nil { - c.cmd(StatusCommandOK, "PBSZ 0") - c.cmd(StatusCommandOK, "PROT P") - } - - return err -} - -// authTLS upgrades the connection to use TLS -func (c *ServerConn) authTLS() error { - _, _, err := c.cmd(StatusAuthOK, "AUTH TLS") - return err -} - -// feat issues a FEAT FTP command to list the additional commands supported by -// the remote FTP server. -// FEAT is described in RFC 2389 -func (c *ServerConn) feat() error { - code, message, err := c.cmd(-1, "FEAT") - if err != nil { - return err - } - - if code != StatusSystem { - // The server does not support the FEAT command. This is not an - // error: we consider that there is no additional feature. - return nil - } - - lines := strings.Split(message, "\n") - for _, line := range lines { - if !strings.HasPrefix(line, " ") { - continue - } - - line = strings.TrimSpace(line) - featureElements := strings.SplitN(line, " ", 2) - - command := featureElements[0] - - var commandDesc string - if len(featureElements) == 2 { - commandDesc = featureElements[1] - } - - c.features[command] = commandDesc - } - - return nil -} - -// setUTF8 issues an "OPTS UTF8 ON" command. -func (c *ServerConn) setUTF8() error { - if _, ok := c.features["UTF8"]; !ok { - return nil - } - - code, message, err := c.cmd(-1, "OPTS UTF8 ON") - if err != nil { - return err - } - - // Workaround for FTP servers, that does not support this option. - if code == StatusBadArguments { - return nil - } - - // The ftpd "filezilla-server" has FEAT support for UTF8, but always returns - // "202 UTF8 mode is always enabled. No need to send this command." when - // trying to use it. That's OK - if code == StatusCommandNotImplemented { - return nil - } - - if code != StatusCommandOK { - return errors.New(message) - } - - return nil -} - -// epsv issues an "EPSV" command to get a port number for a data connection. -func (c *ServerConn) epsv() (port int, err error) { - _, line, err := c.cmd(StatusExtendedPassiveMode, "EPSV") - if err != nil { - return - } - - start := strings.Index(line, "|||") - end := strings.LastIndex(line, "|") - if start == -1 || end == -1 { - err = errors.New("invalid EPSV response format") - return - } - port, err = strconv.Atoi(line[start+3 : end]) - return -} - -// pasv issues a "PASV" command to get a port number for a data connection. -func (c *ServerConn) pasv() (host string, port int, err error) { - _, line, err := c.cmd(StatusPassiveMode, "PASV") - if err != nil { - return - } - - // PASV response format : 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2). - start := strings.Index(line, "(") - end := strings.LastIndex(line, ")") - if start == -1 || end == -1 { - err = errors.New("invalid PASV response format") - return - } - - // We have to split the response string - pasvData := strings.Split(line[start+1:end], ",") - - if len(pasvData) < 6 { - err = errors.New("invalid PASV response format") - return - } - - // Let's compute the port number - portPart1, err1 := strconv.Atoi(pasvData[4]) - if err1 != nil { - err = err1 - return - } - - portPart2, err2 := strconv.Atoi(pasvData[5]) - if err2 != nil { - err = err2 - return - } - - // Recompose port - port = portPart1*256 + portPart2 - - // Make the IP address to connect to - host = strings.Join(pasvData[0:4], ".") - return -} - -// getDataConnPort returns a host, port for a new data connection -// it uses the best available method to do so -func (c *ServerConn) getDataConnPort() (string, int, error) { - if !c.options.disableEPSV && !c.skipEPSV { - if port, err := c.epsv(); err == nil { - return c.host, port, nil - } - - // if there is an error, skip EPSV for the next attempts - c.skipEPSV = true - } - - return c.pasv() -} - -// openDataConn creates a new FTP data connection. -func (c *ServerConn) openDataConn() (net.Conn, error) { - host, port, err := c.getDataConnPort() - if err != nil { - return nil, err - } - - addr := net.JoinHostPort(host, strconv.Itoa(port)) - if c.options.dialFunc != nil { - return c.options.dialFunc("tcp", addr) - } - - if c.options.tlsConfig != nil { - conn, err := c.options.dialer.Dial("tcp", addr) - if err != nil { - return nil, err - } - return tls.Client(conn, c.options.tlsConfig), err - } - - return c.options.dialer.Dial("tcp", addr) -} - -// cmd is a helper function to execute a command and check for the expected FTP -// return code -func (c *ServerConn) cmd(expected int, format string, args ...interface{}) (int, string, error) { - _, err := c.conn.Cmd(format, args...) - if err != nil { - return 0, "", err - } - - return c.conn.ReadResponse(expected) -} - -// cmdDataConnFrom executes a command which require a FTP data connection. -// Issues a REST FTP command to specify the number of bytes to skip for the transfer. -func (c *ServerConn) cmdDataConnFrom(offset uint64, format string, args ...interface{}) (net.Conn, error) { - conn, err := c.openDataConn() - if err != nil { - return nil, err - } - - if offset != 0 { - _, _, err := c.cmd(StatusRequestFilePending, "REST %d", offset) - if err != nil { - conn.Close() - return nil, err - } - } - - _, err = c.conn.Cmd(format, args...) - if err != nil { - conn.Close() - return nil, err - } - - code, msg, err := c.conn.ReadResponse(-1) - if err != nil { - conn.Close() - return nil, err - } - if code != StatusAlreadyOpen && code != StatusAboutToSend { - conn.Close() - return nil, &textproto.Error{Code: code, Msg: msg} - } - - return conn, nil -} - -// NameList issues an NLST FTP command. -func (c *ServerConn) NameList(path string) (entries []string, err error) { - conn, err := c.cmdDataConnFrom(0, "NLST %s", path) - if err != nil { - return - } - - r := &Response{conn: conn, c: c} - defer r.Close() - - scanner := bufio.NewScanner(r) - for scanner.Scan() { - entries = append(entries, scanner.Text()) - } - if err = scanner.Err(); err != nil { - return entries, err - } - return -} - -// List issues a LIST FTP command. -func (c *ServerConn) List(path string) (entries []*Entry, err error) { - var cmd string - var parser parseFunc - - if c.mlstSupported { - cmd = "MLSD" - parser = parseRFC3659ListLine - } else { - cmd = "LIST" - parser = parseListLine - } - - conn, err := c.cmdDataConnFrom(0, "%s %s", cmd, path) - if err != nil { - return - } - - r := &Response{conn: conn, c: c} - defer r.Close() - - scanner := bufio.NewScanner(r) - now := time.Now() - for scanner.Scan() { - entry, err := parser(scanner.Text(), now, c.options.location) - if err == nil { - entries = append(entries, entry) - } - } - if err := scanner.Err(); err != nil { - return nil, err - } - return -} - -// ChangeDir issues a CWD FTP command, which changes the current directory to -// the specified path. -func (c *ServerConn) ChangeDir(path string) error { - _, _, err := c.cmd(StatusRequestedFileActionOK, "CWD %s", path) - return err -} - -// ChangeDirToParent issues a CDUP FTP command, which changes the current -// directory to the parent directory. This is similar to a call to ChangeDir -// with a path set to "..". -func (c *ServerConn) ChangeDirToParent() error { - _, _, err := c.cmd(StatusRequestedFileActionOK, "CDUP") - return err -} - -// CurrentDir issues a PWD FTP command, which Returns the path of the current -// directory. -func (c *ServerConn) CurrentDir() (string, error) { - _, msg, err := c.cmd(StatusPathCreated, "PWD") - if err != nil { - return "", err - } - - start := strings.Index(msg, "\"") - end := strings.LastIndex(msg, "\"") - - if start == -1 || end == -1 { - return "", errors.New("unsuported PWD response format") - } - - return msg[start+1 : end], nil -} - -// FileSize issues a SIZE FTP command, which Returns the size of the file -func (c *ServerConn) FileSize(path string) (int64, error) { - _, msg, err := c.cmd(StatusFile, "SIZE %s", path) - if err != nil { - return 0, err - } - - return strconv.ParseInt(msg, 10, 64) -} - -// Retr issues a RETR FTP command to fetch the specified file from the remote -// FTP server. -// -// The returned ReadCloser must be closed to cleanup the FTP data connection. -func (c *ServerConn) Retr(path string) (*Response, error) { - return c.RetrFrom(path, 0) -} - -// RetrFrom issues a RETR FTP command to fetch the specified file from the remote -// FTP server, the server will not send the offset first bytes of the file. -// -// The returned ReadCloser must be closed to cleanup the FTP data connection. -func (c *ServerConn) RetrFrom(path string, offset uint64) (*Response, error) { - conn, err := c.cmdDataConnFrom(offset, "RETR %s", path) - if err != nil { - return nil, err - } - - return &Response{conn: conn, c: c}, nil -} - -// Stor issues a STOR FTP command to store a file to the remote FTP server. -// Stor creates the specified file with the content of the io.Reader. -// -// Hint: io.Pipe() can be used if an io.Writer is required. -func (c *ServerConn) Stor(path string, r io.Reader) error { - return c.StorFrom(path, r, 0) -} - -// StorFrom issues a STOR FTP command to store a file to the remote FTP server. -// Stor creates the specified file with the content of the io.Reader, writing -// on the server will start at the given file offset. -// -// Hint: io.Pipe() can be used if an io.Writer is required. -func (c *ServerConn) StorFrom(path string, r io.Reader, offset uint64) error { - conn, err := c.cmdDataConnFrom(offset, "STOR %s", path) - if err != nil { - return err - } - - _, err = io.Copy(conn, r) - conn.Close() - if err != nil { - return err - } - - _, _, err = c.conn.ReadResponse(StatusClosingDataConnection) - return err -} - -// Append issues a APPE FTP command to store a file to the remote FTP server. -// If a file already exists with the given path, then the content of the -// io.Reader is appended. Otherwise, a new file is created with that content. -// -// Hint: io.Pipe() can be used if an io.Writer is required. -func (c *ServerConn) Append(path string, r io.Reader) error { - conn, err := c.cmdDataConnFrom(0, "APPE %s", path) - if err != nil { - return err - } - - _, err = io.Copy(conn, r) - conn.Close() - if err != nil { - return err - } - - _, _, err = c.conn.ReadResponse(StatusClosingDataConnection) - return err -} - -// Rename renames a file on the remote FTP server. -func (c *ServerConn) Rename(from, to string) error { - _, _, err := c.cmd(StatusRequestFilePending, "RNFR %s", from) - if err != nil { - return err - } - - _, _, err = c.cmd(StatusRequestedFileActionOK, "RNTO %s", to) - return err -} - -// Delete issues a DELE FTP command to delete the specified file from the -// remote FTP server. -func (c *ServerConn) Delete(path string) error { - _, _, err := c.cmd(StatusRequestedFileActionOK, "DELE %s", path) - return err -} - -// RemoveDirRecur deletes a non-empty folder recursively using -// RemoveDir and Delete -func (c *ServerConn) RemoveDirRecur(path string) error { - err := c.ChangeDir(path) - if err != nil { - return err - } - currentDir, err := c.CurrentDir() - if err != nil { - return err - } - - entries, err := c.List(currentDir) - if err != nil { - return err - } - - for _, entry := range entries { - if entry.Name != ".." && entry.Name != "." { - if entry.Type == EntryTypeFolder { - err = c.RemoveDirRecur(currentDir + "/" + entry.Name) - if err != nil { - return err - } - } else { - err = c.Delete(entry.Name) - if err != nil { - return err - } - } - } - } - err = c.ChangeDirToParent() - if err != nil { - return err - } - err = c.RemoveDir(currentDir) - return err -} - -// MakeDir issues a MKD FTP command to create the specified directory on the -// remote FTP server. -func (c *ServerConn) MakeDir(path string) error { - _, _, err := c.cmd(StatusPathCreated, "MKD %s", path) - return err -} - -// RemoveDir issues a RMD FTP command to remove the specified directory from -// the remote FTP server. -func (c *ServerConn) RemoveDir(path string) error { - _, _, err := c.cmd(StatusRequestedFileActionOK, "RMD %s", path) - return err -} - -//Walk prepares the internal walk function so that the caller can begin traversing the directory -func (c *ServerConn) Walk(root string) *Walker { - w := new(Walker) - w.serverConn = c - - if !strings.HasSuffix(root, "/") { - root += "/" - } - - w.root = root - w.descend = true - - return w -} - -// NoOp issues a NOOP FTP command. -// NOOP has no effects and is usually used to prevent the remote FTP server to -// close the otherwise idle connection. -func (c *ServerConn) NoOp() error { - _, _, err := c.cmd(StatusCommandOK, "NOOP") - return err -} - -// Logout issues a REIN FTP command to logout the current user. -func (c *ServerConn) Logout() error { - _, _, err := c.cmd(StatusReady, "REIN") - return err -} - -// Quit issues a QUIT FTP command to properly close the connection from the -// remote FTP server. -func (c *ServerConn) Quit() error { - c.conn.Cmd("QUIT") - return c.conn.Close() -} - -// Read implements the io.Reader interface on a FTP data connection. -func (r *Response) Read(buf []byte) (int, error) { - return r.conn.Read(buf) -} - -// Close implements the io.Closer interface on a FTP data connection. -// After the first call, Close will do nothing and return nil. -func (r *Response) Close() error { - if r.closed { - return nil - } - err := r.conn.Close() - _, _, err2 := r.c.conn.ReadResponse(StatusClosingDataConnection) - if err2 != nil { - err = err2 - } - r.closed = true - return err -} - -// SetDeadline sets the deadlines associated with the connection. -func (r *Response) SetDeadline(t time.Time) error { - return r.conn.SetDeadline(t) -} diff --git a/vendor/github.com/jlaffaye/ftp/go.mod b/vendor/github.com/jlaffaye/ftp/go.mod deleted file mode 100644 index d66a3086a..000000000 --- a/vendor/github.com/jlaffaye/ftp/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/jlaffaye/ftp - -go 1.13 - -require github.com/stretchr/testify v1.4.0 diff --git a/vendor/github.com/jlaffaye/ftp/go.sum b/vendor/github.com/jlaffaye/ftp/go.sum deleted file mode 100644 index 8fdee5854..000000000 --- a/vendor/github.com/jlaffaye/ftp/go.sum +++ /dev/null @@ -1,11 +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/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= -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/jlaffaye/ftp/parse.go b/vendor/github.com/jlaffaye/ftp/parse.go deleted file mode 100644 index 620401e89..000000000 --- a/vendor/github.com/jlaffaye/ftp/parse.go +++ /dev/null @@ -1,265 +0,0 @@ -package ftp - -import ( - "errors" - "fmt" - "strconv" - "strings" - "time" -) - -var errUnsupportedListLine = errors.New("unsupported LIST line") -var errUnsupportedListDate = errors.New("unsupported LIST date") -var errUnknownListEntryType = errors.New("unknown entry type") - -type parseFunc func(string, time.Time, *time.Location) (*Entry, error) - -var listLineParsers = []parseFunc{ - parseRFC3659ListLine, - parseLsListLine, - parseDirListLine, - parseHostedFTPLine, -} - -var dirTimeFormats = []string{ - "01-02-06 03:04PM", - "2006-01-02 15:04", -} - -// parseRFC3659ListLine parses the style of directory line defined in RFC 3659. -func parseRFC3659ListLine(line string, now time.Time, loc *time.Location) (*Entry, error) { - iSemicolon := strings.Index(line, ";") - iWhitespace := strings.Index(line, " ") - - if iSemicolon < 0 || iSemicolon > iWhitespace { - return nil, errUnsupportedListLine - } - - e := &Entry{ - Name: line[iWhitespace+1:], - } - - for _, field := range strings.Split(line[:iWhitespace-1], ";") { - i := strings.Index(field, "=") - if i < 1 { - return nil, errUnsupportedListLine - } - - key := strings.ToLower(field[:i]) - value := field[i+1:] - - switch key { - case "modify": - var err error - e.Time, err = time.ParseInLocation("20060102150405", value, loc) - if err != nil { - return nil, err - } - case "type": - switch value { - case "dir", "cdir", "pdir": - e.Type = EntryTypeFolder - case "file": - e.Type = EntryTypeFile - } - case "size": - e.setSize(value) - } - } - return e, nil -} - -// parseLsListLine parses a directory line in a format based on the output of -// the UNIX ls command. -func parseLsListLine(line string, now time.Time, loc *time.Location) (*Entry, error) { - - // Has the first field a length of exactly 10 bytes - // - or 10 bytes with an additional '+' character for indicating ACLs? - // If not, return. - if i := strings.IndexByte(line, ' '); !(i == 10 || (i == 11 && line[10] == '+')) { - return nil, errUnsupportedListLine - } - - scanner := newScanner(line) - fields := scanner.NextFields(6) - - if len(fields) < 6 { - return nil, errUnsupportedListLine - } - - if fields[1] == "folder" && fields[2] == "0" { - e := &Entry{ - Type: EntryTypeFolder, - Name: scanner.Remaining(), - } - if err := e.setTime(fields[3:6], now, loc); err != nil { - return nil, err - } - - return e, nil - } - - if fields[1] == "0" { - fields = append(fields, scanner.Next()) - e := &Entry{ - Type: EntryTypeFile, - Name: scanner.Remaining(), - } - - if err := e.setSize(fields[2]); err != nil { - return nil, errUnsupportedListLine - } - if err := e.setTime(fields[4:7], now, loc); err != nil { - return nil, err - } - - return e, nil - } - - // Read two more fields - fields = append(fields, scanner.NextFields(2)...) - if len(fields) < 8 { - return nil, errUnsupportedListLine - } - - e := &Entry{ - Name: scanner.Remaining(), - } - switch fields[0][0] { - case '-': - e.Type = EntryTypeFile - if err := e.setSize(fields[4]); err != nil { - return nil, err - } - case 'd': - e.Type = EntryTypeFolder - case 'l': - e.Type = EntryTypeLink - - // Split link name and target - if i := strings.Index(e.Name, " -> "); i > 0 { - e.Target = e.Name[i+4:] - e.Name = e.Name[:i] - } - default: - return nil, errUnknownListEntryType - } - - if err := e.setTime(fields[5:8], now, loc); err != nil { - return nil, err - } - - return e, nil -} - -// parseDirListLine parses a directory line in a format based on the output of -// the MS-DOS DIR command. -func parseDirListLine(line string, now time.Time, loc *time.Location) (*Entry, error) { - e := &Entry{} - var err error - - // Try various time formats that DIR might use, and stop when one works. - for _, format := range dirTimeFormats { - if len(line) > len(format) { - e.Time, err = time.ParseInLocation(format, line[:len(format)], loc) - if err == nil { - line = line[len(format):] - break - } - } - } - if err != nil { - // None of the time formats worked. - return nil, errUnsupportedListLine - } - - line = strings.TrimLeft(line, " ") - if strings.HasPrefix(line, "") { - e.Type = EntryTypeFolder - line = strings.TrimPrefix(line, "") - } else { - space := strings.Index(line, " ") - if space == -1 { - return nil, errUnsupportedListLine - } - e.Size, err = strconv.ParseUint(line[:space], 10, 64) - if err != nil { - return nil, errUnsupportedListLine - } - e.Type = EntryTypeFile - line = line[space:] - } - - e.Name = strings.TrimLeft(line, " ") - return e, nil -} - -// parseHostedFTPLine parses a directory line in the non-standard format used -// by hostedftp.com -// -r-------- 0 user group 65222236 Feb 24 00:39 UABlacklistingWeek8.csv -// (The link count is inexplicably 0) -func parseHostedFTPLine(line string, now time.Time, loc *time.Location) (*Entry, error) { - // Has the first field a length of 10 bytes? - if strings.IndexByte(line, ' ') != 10 { - return nil, errUnsupportedListLine - } - - scanner := newScanner(line) - fields := scanner.NextFields(2) - - if len(fields) < 2 || fields[1] != "0" { - return nil, errUnsupportedListLine - } - - // Set link count to 1 and attempt to parse as Unix. - return parseLsListLine(fields[0]+" 1 "+scanner.Remaining(), now, loc) -} - -// parseListLine parses the various non-standard format returned by the LIST -// FTP command. -func parseListLine(line string, now time.Time, loc *time.Location) (*Entry, error) { - for _, f := range listLineParsers { - e, err := f(line, now, loc) - if err != errUnsupportedListLine { - return e, err - } - } - return nil, errUnsupportedListLine -} - -func (e *Entry) setSize(str string) (err error) { - e.Size, err = strconv.ParseUint(str, 0, 64) - return -} - -func (e *Entry) setTime(fields []string, now time.Time, loc *time.Location) (err error) { - if strings.Contains(fields[2], ":") { // contains time - thisYear, _, _ := now.Date() - timeStr := fmt.Sprintf("%s %s %d %s", fields[1], fields[0], thisYear, fields[2]) - e.Time, err = time.ParseInLocation("_2 Jan 2006 15:04", timeStr, loc) - - /* - On unix, `info ls` shows: - - 10.1.6 Formatting file timestamps - --------------------------------- - - A timestamp is considered to be “recent” if it is less than six - months old, and is not dated in the future. If a timestamp dated today - is not listed in recent form, the timestamp is in the future, which - means you probably have clock skew problems which may break programs - like ‘make’ that rely on file timestamps. - */ - if !e.Time.Before(now.AddDate(0, 6, 0)) { - e.Time = e.Time.AddDate(-1, 0, 0) - } - - } else { // only the date - if len(fields[2]) != 4 { - return errUnsupportedListDate - } - timeStr := fmt.Sprintf("%s %s %s 00:00", fields[1], fields[0], fields[2]) - e.Time, err = time.ParseInLocation("_2 Jan 2006 15:04", timeStr, loc) - } - return -} diff --git a/vendor/github.com/jlaffaye/ftp/scanner.go b/vendor/github.com/jlaffaye/ftp/scanner.go deleted file mode 100644 index 0dcc8ae64..000000000 --- a/vendor/github.com/jlaffaye/ftp/scanner.go +++ /dev/null @@ -1,58 +0,0 @@ -package ftp - -// A scanner for fields delimited by one or more whitespace characters -type scanner struct { - bytes []byte - position int -} - -// newScanner creates a new scanner -func newScanner(str string) *scanner { - return &scanner{ - bytes: []byte(str), - } -} - -// NextFields returns the next `count` fields -func (s *scanner) NextFields(count int) []string { - fields := make([]string, 0, count) - for i := 0; i < count; i++ { - if field := s.Next(); field != "" { - fields = append(fields, field) - } else { - break - } - } - return fields -} - -// Next returns the next field -func (s *scanner) Next() string { - sLen := len(s.bytes) - - // skip trailing whitespace - for s.position < sLen { - if s.bytes[s.position] != ' ' { - break - } - s.position++ - } - - start := s.position - - // skip non-whitespace - for s.position < sLen { - if s.bytes[s.position] == ' ' { - s.position++ - return string(s.bytes[start : s.position-1]) - } - s.position++ - } - - return string(s.bytes[start:s.position]) -} - -// Remaining returns the remaining string -func (s *scanner) Remaining() string { - return string(s.bytes[s.position:len(s.bytes)]) -} diff --git a/vendor/github.com/jlaffaye/ftp/status.go b/vendor/github.com/jlaffaye/ftp/status.go deleted file mode 100644 index c8ea026c9..000000000 --- a/vendor/github.com/jlaffaye/ftp/status.go +++ /dev/null @@ -1,113 +0,0 @@ -package ftp - -// FTP status codes, defined in RFC 959 -const ( - StatusInitiating = 100 - StatusRestartMarker = 110 - StatusReadyMinute = 120 - StatusAlreadyOpen = 125 - StatusAboutToSend = 150 - - StatusCommandOK = 200 - StatusCommandNotImplemented = 202 - StatusSystem = 211 - StatusDirectory = 212 - StatusFile = 213 - StatusHelp = 214 - StatusName = 215 - StatusReady = 220 - StatusClosing = 221 - StatusDataConnectionOpen = 225 - StatusClosingDataConnection = 226 - StatusPassiveMode = 227 - StatusLongPassiveMode = 228 - StatusExtendedPassiveMode = 229 - StatusLoggedIn = 230 - StatusLoggedOut = 231 - StatusLogoutAck = 232 - StatusAuthOK = 234 - StatusRequestedFileActionOK = 250 - StatusPathCreated = 257 - - StatusUserOK = 331 - StatusLoginNeedAccount = 332 - StatusRequestFilePending = 350 - - StatusNotAvailable = 421 - StatusCanNotOpenDataConnection = 425 - StatusTransfertAborted = 426 - StatusInvalidCredentials = 430 - StatusHostUnavailable = 434 - StatusFileActionIgnored = 450 - StatusActionAborted = 451 - Status452 = 452 - - StatusBadCommand = 500 - StatusBadArguments = 501 - StatusNotImplemented = 502 - StatusBadSequence = 503 - StatusNotImplementedParameter = 504 - StatusNotLoggedIn = 530 - StatusStorNeedAccount = 532 - StatusFileUnavailable = 550 - StatusPageTypeUnknown = 551 - StatusExceededStorage = 552 - StatusBadFileName = 553 -) - -var statusText = map[int]string{ - // 200 - StatusCommandOK: "Command okay.", - StatusCommandNotImplemented: "Command not implemented, superfluous at this site.", - StatusSystem: "System status, or system help reply.", - StatusDirectory: "Directory status.", - StatusFile: "File status.", - StatusHelp: "Help message.", - StatusName: "", - StatusReady: "Service ready for new user.", - StatusClosing: "Service closing control connection.", - StatusDataConnectionOpen: "Data connection open; no transfer in progress.", - StatusClosingDataConnection: "Closing data connection. Requested file action successful.", - StatusPassiveMode: "Entering Passive Mode.", - StatusLongPassiveMode: "Entering Long Passive Mode.", - StatusExtendedPassiveMode: "Entering Extended Passive Mode.", - StatusLoggedIn: "User logged in, proceed.", - StatusLoggedOut: "User logged out; service terminated.", - StatusLogoutAck: "Logout command noted, will complete when transfer done.", - StatusAuthOK: "AUTH command OK", - StatusRequestedFileActionOK: "Requested file action okay, completed.", - StatusPathCreated: "Path created.", - - // 300 - StatusUserOK: "User name okay, need password.", - StatusLoginNeedAccount: "Need account for login.", - StatusRequestFilePending: "Requested file action pending further information.", - - // 400 - StatusNotAvailable: "Service not available, closing control connection.", - StatusCanNotOpenDataConnection: "Can't open data connection.", - StatusTransfertAborted: "Connection closed; transfer aborted.", - StatusInvalidCredentials: "Invalid username or password.", - StatusHostUnavailable: "Requested host unavailable.", - StatusFileActionIgnored: "Requested file action not taken.", - StatusActionAborted: "Requested action aborted. Local error in processing.", - Status452: "Insufficient storage space in system.", - - // 500 - StatusBadCommand: "Command unrecognized.", - StatusBadArguments: "Syntax error in parameters or arguments.", - StatusNotImplemented: "Command not implemented.", - StatusBadSequence: "Bad sequence of commands.", - StatusNotImplementedParameter: "Command not implemented for that parameter.", - StatusNotLoggedIn: "Not logged in.", - StatusStorNeedAccount: "Need account for storing files.", - StatusFileUnavailable: "File unavailable.", - StatusPageTypeUnknown: "Page type unknown.", - StatusExceededStorage: "Exceeded storage allocation.", - StatusBadFileName: "File name not allowed.", -} - -// StatusText returns a text for the FTP status code. It returns the empty string if the code is unknown. -func StatusText(code int) string { - return statusText[code] -} diff --git a/vendor/github.com/jlaffaye/ftp/walker.go b/vendor/github.com/jlaffaye/ftp/walker.go deleted file mode 100644 index 5f165191a..000000000 --- a/vendor/github.com/jlaffaye/ftp/walker.go +++ /dev/null @@ -1,109 +0,0 @@ -package ftp - -import ( - "fmt" - "os" - "path" - "strings" -) - -//Walker traverses the directory tree of a remote FTP server -type Walker struct { - serverConn *ServerConn - root string - cur *item - stack []*item - descend bool -} - -type item struct { - path string - entry *Entry - err error -} - -// Next advances the Walker to the next file or directory, -// which will then be available through the Path, Stat, and Err methods. -// It returns false when the walk stops at the end of the tree. -func (w *Walker) Next() bool { - var isRoot bool - if w.cur == nil { - w.cur = &item{ - path: strings.Trim(w.root, string(os.PathSeparator)), - } - - isRoot = true - } - - entries, err := w.serverConn.List(w.cur.path) - w.cur.err = err - if err == nil { - if len(entries) == 0 { - w.cur.err = fmt.Errorf("no such file or directory: %s", w.cur.path) - - return false - } - - if isRoot && len(entries) == 1 && entries[0].Type == EntryTypeFile { - w.cur.err = fmt.Errorf("root is not a directory: %s", w.cur.path) - - return false - } - - for i, entry := range entries { - if entry.Name == "." || (i == 0 && entry.Type == EntryTypeFile) { - entry.Name = path.Base(w.cur.path) - w.cur.entry = entry - continue - } - - if entry.Name == ".." || !w.descend { - continue - } - - item := &item{ - path: path.Join(w.cur.path, entry.Name), - entry: entry, - } - - w.stack = append(w.stack, item) - } - } - - if len(w.stack) == 0 { - return false - } - - i := len(w.stack) - 1 - w.cur = w.stack[i] - w.stack = w.stack[:i] - w.descend = true - - return true -} - -//SkipDir tells the Next function to skip the currently processed directory -func (w *Walker) SkipDir() { - w.descend = false -} - -//Err returns the error, if any, for the most recent attempt by Next to -//visit a file or a directory. If a directory has an error, the walker -//will not descend in that directory -func (w *Walker) Err() error { - return w.cur.err -} - -// Stat returns info for the most recent file or directory -// visited by a call to Step. -func (w *Walker) Stat() *Entry { - return w.cur.entry -} - -// Path returns the path to the most recent file or directory -// visited by a call to Next. It contains the argument to Walk -// as a prefix; that is, if Walk is called with "dir", which is -// a directory containing the file "a", Path will return "dir/a". -func (w *Walker) Path() string { - return w.cur.path -} diff --git a/vendor/github.com/jmespath/go-jmespath/.gitignore b/vendor/github.com/jmespath/go-jmespath/.gitignore deleted file mode 100644 index 5091fb073..000000000 --- a/vendor/github.com/jmespath/go-jmespath/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/jpgo -jmespath-fuzz.zip -cpu.out -go-jmespath.test diff --git a/vendor/github.com/jmespath/go-jmespath/.travis.yml b/vendor/github.com/jmespath/go-jmespath/.travis.yml deleted file mode 100644 index 730c7fa51..000000000 --- a/vendor/github.com/jmespath/go-jmespath/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -sudo: false - -go: - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - 1.11.x - - 1.12.x - - 1.13.x - -install: go get -v -t ./... -script: make test diff --git a/vendor/github.com/jmespath/go-jmespath/LICENSE b/vendor/github.com/jmespath/go-jmespath/LICENSE deleted file mode 100644 index b03310a91..000000000 --- a/vendor/github.com/jmespath/go-jmespath/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2015 James Saryerwinnie - -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/jmespath/go-jmespath/Makefile b/vendor/github.com/jmespath/go-jmespath/Makefile deleted file mode 100644 index a828d2848..000000000 --- a/vendor/github.com/jmespath/go-jmespath/Makefile +++ /dev/null @@ -1,44 +0,0 @@ - -CMD = jpgo - -help: - @echo "Please use \`make ' where is one of" - @echo " test to run all the tests" - @echo " build to build the library and jp executable" - @echo " generate to run codegen" - - -generate: - go generate ./... - -build: - rm -f $(CMD) - go build ./... - rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... - mv cmd/$(CMD)/$(CMD) . - -test: - go test -v ./... - -check: - go vet ./... - @echo "golint ./..." - @lint=`golint ./...`; \ - lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ - echo "$$lint"; \ - if [ "$$lint" != "" ]; then exit 1; fi - -htmlc: - go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov - -buildfuzz: - go-fuzz-build github.com/jmespath/go-jmespath/fuzz - -fuzz: buildfuzz - go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/testdata - -bench: - go test -bench . -cpuprofile cpu.out - -pprof-cpu: - go tool pprof ./go-jmespath.test ./cpu.out diff --git a/vendor/github.com/jmespath/go-jmespath/README.md b/vendor/github.com/jmespath/go-jmespath/README.md deleted file mode 100644 index 110ad7999..000000000 --- a/vendor/github.com/jmespath/go-jmespath/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# go-jmespath - A JMESPath implementation in Go - -[![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) - - - -go-jmespath is a GO implementation of JMESPath, -which is a query language for JSON. It will take a JSON -document and transform it into another JSON document -through a JMESPath expression. - -Using go-jmespath is really easy. There's a single function -you use, `jmespath.search`: - - -```go -> import "github.com/jmespath/go-jmespath" -> -> var jsondata = []byte(`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}`) // your data -> var data interface{} -> err := json.Unmarshal(jsondata, &data) -> result, err := jmespath.Search("foo.bar.baz[2]", data) -result = 2 -``` - -In the example we gave the ``search`` function input data of -`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}` as well as the JMESPath -expression `foo.bar.baz[2]`, and the `search` function evaluated -the expression against the input data to produce the result ``2``. - -The JMESPath language can do a lot more than select an element -from a list. Here are a few more examples: - -```go -> var jsondata = []byte(`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}`) // your data -> var data interface{} -> err := json.Unmarshal(jsondata, &data) -> result, err := jmespath.search("foo.bar", data) -result = { "baz": [ 0, 1, 2, 3, 4 ] } - - -> var jsondata = []byte(`{"foo": [{"first": "a", "last": "b"}, - {"first": "c", "last": "d"}]}`) // your data -> var data interface{} -> err := json.Unmarshal(jsondata, &data) -> result, err := jmespath.search({"foo[*].first", data) -result [ 'a', 'c' ] - - -> var jsondata = []byte(`{"foo": [{"age": 20}, {"age": 25}, - {"age": 30}, {"age": 35}, - {"age": 40}]}`) // your data -> var data interface{} -> err := json.Unmarshal(jsondata, &data) -> result, err := jmespath.search("foo[?age > `30`]") -result = [ { age: 35 }, { age: 40 } ] -``` - -You can also pre-compile your query. This is usefull if -you are going to run multiple searches with it: - -```go - > var jsondata = []byte(`{"foo": "bar"}`) - > var data interface{} - > err := json.Unmarshal(jsondata, &data) - > precompiled, err := Compile("foo") - > if err != nil{ - > // ... handle the error - > } - > result, err := precompiled.Search(data) - result = "bar" -``` - -## More Resources - -The example above only show a small amount of what -a JMESPath expression can do. If you want to take a -tour of the language, the *best* place to go is the -[JMESPath Tutorial](http://jmespath.org/tutorial.html). - -One of the best things about JMESPath is that it is -implemented in many different programming languages including -python, ruby, php, lua, etc. To see a complete list of libraries, -check out the [JMESPath libraries page](http://jmespath.org/libraries.html). - -And finally, the full JMESPath specification can be found -on the [JMESPath site](http://jmespath.org/specification.html). diff --git a/vendor/github.com/jmespath/go-jmespath/api.go b/vendor/github.com/jmespath/go-jmespath/api.go deleted file mode 100644 index 010efe9bf..000000000 --- a/vendor/github.com/jmespath/go-jmespath/api.go +++ /dev/null @@ -1,49 +0,0 @@ -package jmespath - -import "strconv" - -// JMESPath is the representation of a compiled JMES path query. A JMESPath is -// safe for concurrent use by multiple goroutines. -type JMESPath struct { - ast ASTNode - intr *treeInterpreter -} - -// Compile parses a JMESPath expression and returns, if successful, a JMESPath -// object that can be used to match against data. -func Compile(expression string) (*JMESPath, error) { - parser := NewParser() - ast, err := parser.Parse(expression) - if err != nil { - return nil, err - } - jmespath := &JMESPath{ast: ast, intr: newInterpreter()} - return jmespath, nil -} - -// MustCompile is like Compile but panics if the expression cannot be parsed. -// It simplifies safe initialization of global variables holding compiled -// JMESPaths. -func MustCompile(expression string) *JMESPath { - jmespath, err := Compile(expression) - if err != nil { - panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error()) - } - return jmespath -} - -// Search evaluates a JMESPath expression against input data and returns the result. -func (jp *JMESPath) Search(data interface{}) (interface{}, error) { - return jp.intr.Execute(jp.ast, data) -} - -// Search evaluates a JMESPath expression against input data and returns the result. -func Search(expression string, data interface{}) (interface{}, error) { - intr := newInterpreter() - parser := NewParser() - ast, err := parser.Parse(expression) - if err != nil { - return nil, err - } - return intr.Execute(ast, data) -} diff --git a/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go b/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go deleted file mode 100644 index 1cd2d239c..000000000 --- a/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// generated by stringer -type astNodeType; DO NOT EDIT - -package jmespath - -import "fmt" - -const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" - -var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} - -func (i astNodeType) String() string { - if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { - return fmt.Sprintf("astNodeType(%d)", i) - } - return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] -} diff --git a/vendor/github.com/jmespath/go-jmespath/functions.go b/vendor/github.com/jmespath/go-jmespath/functions.go deleted file mode 100644 index 9b7cd89b4..000000000 --- a/vendor/github.com/jmespath/go-jmespath/functions.go +++ /dev/null @@ -1,842 +0,0 @@ -package jmespath - -import ( - "encoding/json" - "errors" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "strings" - "unicode/utf8" -) - -type jpFunction func(arguments []interface{}) (interface{}, error) - -type jpType string - -const ( - jpUnknown jpType = "unknown" - jpNumber jpType = "number" - jpString jpType = "string" - jpArray jpType = "array" - jpObject jpType = "object" - jpArrayNumber jpType = "array[number]" - jpArrayString jpType = "array[string]" - jpExpref jpType = "expref" - jpAny jpType = "any" -) - -type functionEntry struct { - name string - arguments []argSpec - handler jpFunction - hasExpRef bool -} - -type argSpec struct { - types []jpType - variadic bool -} - -type byExprString struct { - intr *treeInterpreter - node ASTNode - items []interface{} - hasError bool -} - -func (a *byExprString) Len() int { - return len(a.items) -} -func (a *byExprString) Swap(i, j int) { - a.items[i], a.items[j] = a.items[j], a.items[i] -} -func (a *byExprString) Less(i, j int) bool { - first, err := a.intr.Execute(a.node, a.items[i]) - if err != nil { - a.hasError = true - // Return a dummy value. - return true - } - ith, ok := first.(string) - if !ok { - a.hasError = true - return true - } - second, err := a.intr.Execute(a.node, a.items[j]) - if err != nil { - a.hasError = true - // Return a dummy value. - return true - } - jth, ok := second.(string) - if !ok { - a.hasError = true - return true - } - return ith < jth -} - -type byExprFloat struct { - intr *treeInterpreter - node ASTNode - items []interface{} - hasError bool -} - -func (a *byExprFloat) Len() int { - return len(a.items) -} -func (a *byExprFloat) Swap(i, j int) { - a.items[i], a.items[j] = a.items[j], a.items[i] -} -func (a *byExprFloat) Less(i, j int) bool { - first, err := a.intr.Execute(a.node, a.items[i]) - if err != nil { - a.hasError = true - // Return a dummy value. - return true - } - ith, ok := first.(float64) - if !ok { - a.hasError = true - return true - } - second, err := a.intr.Execute(a.node, a.items[j]) - if err != nil { - a.hasError = true - // Return a dummy value. - return true - } - jth, ok := second.(float64) - if !ok { - a.hasError = true - return true - } - return ith < jth -} - -type functionCaller struct { - functionTable map[string]functionEntry -} - -func newFunctionCaller() *functionCaller { - caller := &functionCaller{} - caller.functionTable = map[string]functionEntry{ - "length": { - name: "length", - arguments: []argSpec{ - {types: []jpType{jpString, jpArray, jpObject}}, - }, - handler: jpfLength, - }, - "starts_with": { - name: "starts_with", - arguments: []argSpec{ - {types: []jpType{jpString}}, - {types: []jpType{jpString}}, - }, - handler: jpfStartsWith, - }, - "abs": { - name: "abs", - arguments: []argSpec{ - {types: []jpType{jpNumber}}, - }, - handler: jpfAbs, - }, - "avg": { - name: "avg", - arguments: []argSpec{ - {types: []jpType{jpArrayNumber}}, - }, - handler: jpfAvg, - }, - "ceil": { - name: "ceil", - arguments: []argSpec{ - {types: []jpType{jpNumber}}, - }, - handler: jpfCeil, - }, - "contains": { - name: "contains", - arguments: []argSpec{ - {types: []jpType{jpArray, jpString}}, - {types: []jpType{jpAny}}, - }, - handler: jpfContains, - }, - "ends_with": { - name: "ends_with", - arguments: []argSpec{ - {types: []jpType{jpString}}, - {types: []jpType{jpString}}, - }, - handler: jpfEndsWith, - }, - "floor": { - name: "floor", - arguments: []argSpec{ - {types: []jpType{jpNumber}}, - }, - handler: jpfFloor, - }, - "map": { - name: "amp", - arguments: []argSpec{ - {types: []jpType{jpExpref}}, - {types: []jpType{jpArray}}, - }, - handler: jpfMap, - hasExpRef: true, - }, - "max": { - name: "max", - arguments: []argSpec{ - {types: []jpType{jpArrayNumber, jpArrayString}}, - }, - handler: jpfMax, - }, - "merge": { - name: "merge", - arguments: []argSpec{ - {types: []jpType{jpObject}, variadic: true}, - }, - handler: jpfMerge, - }, - "max_by": { - name: "max_by", - arguments: []argSpec{ - {types: []jpType{jpArray}}, - {types: []jpType{jpExpref}}, - }, - handler: jpfMaxBy, - hasExpRef: true, - }, - "sum": { - name: "sum", - arguments: []argSpec{ - {types: []jpType{jpArrayNumber}}, - }, - handler: jpfSum, - }, - "min": { - name: "min", - arguments: []argSpec{ - {types: []jpType{jpArrayNumber, jpArrayString}}, - }, - handler: jpfMin, - }, - "min_by": { - name: "min_by", - arguments: []argSpec{ - {types: []jpType{jpArray}}, - {types: []jpType{jpExpref}}, - }, - handler: jpfMinBy, - hasExpRef: true, - }, - "type": { - name: "type", - arguments: []argSpec{ - {types: []jpType{jpAny}}, - }, - handler: jpfType, - }, - "keys": { - name: "keys", - arguments: []argSpec{ - {types: []jpType{jpObject}}, - }, - handler: jpfKeys, - }, - "values": { - name: "values", - arguments: []argSpec{ - {types: []jpType{jpObject}}, - }, - handler: jpfValues, - }, - "sort": { - name: "sort", - arguments: []argSpec{ - {types: []jpType{jpArrayString, jpArrayNumber}}, - }, - handler: jpfSort, - }, - "sort_by": { - name: "sort_by", - arguments: []argSpec{ - {types: []jpType{jpArray}}, - {types: []jpType{jpExpref}}, - }, - handler: jpfSortBy, - hasExpRef: true, - }, - "join": { - name: "join", - arguments: []argSpec{ - {types: []jpType{jpString}}, - {types: []jpType{jpArrayString}}, - }, - handler: jpfJoin, - }, - "reverse": { - name: "reverse", - arguments: []argSpec{ - {types: []jpType{jpArray, jpString}}, - }, - handler: jpfReverse, - }, - "to_array": { - name: "to_array", - arguments: []argSpec{ - {types: []jpType{jpAny}}, - }, - handler: jpfToArray, - }, - "to_string": { - name: "to_string", - arguments: []argSpec{ - {types: []jpType{jpAny}}, - }, - handler: jpfToString, - }, - "to_number": { - name: "to_number", - arguments: []argSpec{ - {types: []jpType{jpAny}}, - }, - handler: jpfToNumber, - }, - "not_null": { - name: "not_null", - arguments: []argSpec{ - {types: []jpType{jpAny}, variadic: true}, - }, - handler: jpfNotNull, - }, - } - return caller -} - -func (e *functionEntry) resolveArgs(arguments []interface{}) ([]interface{}, error) { - if len(e.arguments) == 0 { - return arguments, nil - } - if !e.arguments[len(e.arguments)-1].variadic { - if len(e.arguments) != len(arguments) { - return nil, errors.New("incorrect number of args") - } - for i, spec := range e.arguments { - userArg := arguments[i] - err := spec.typeCheck(userArg) - if err != nil { - return nil, err - } - } - return arguments, nil - } - if len(arguments) < len(e.arguments) { - return nil, errors.New("Invalid arity.") - } - return arguments, nil -} - -func (a *argSpec) typeCheck(arg interface{}) error { - for _, t := range a.types { - switch t { - case jpNumber: - if _, ok := arg.(float64); ok { - return nil - } - case jpString: - if _, ok := arg.(string); ok { - return nil - } - case jpArray: - if isSliceType(arg) { - return nil - } - case jpObject: - if _, ok := arg.(map[string]interface{}); ok { - return nil - } - case jpArrayNumber: - if _, ok := toArrayNum(arg); ok { - return nil - } - case jpArrayString: - if _, ok := toArrayStr(arg); ok { - return nil - } - case jpAny: - return nil - case jpExpref: - if _, ok := arg.(expRef); ok { - return nil - } - } - } - return fmt.Errorf("Invalid type for: %v, expected: %#v", arg, a.types) -} - -func (f *functionCaller) CallFunction(name string, arguments []interface{}, intr *treeInterpreter) (interface{}, error) { - entry, ok := f.functionTable[name] - if !ok { - return nil, errors.New("unknown function: " + name) - } - resolvedArgs, err := entry.resolveArgs(arguments) - if err != nil { - return nil, err - } - if entry.hasExpRef { - var extra []interface{} - extra = append(extra, intr) - resolvedArgs = append(extra, resolvedArgs...) - } - return entry.handler(resolvedArgs) -} - -func jpfAbs(arguments []interface{}) (interface{}, error) { - num := arguments[0].(float64) - return math.Abs(num), nil -} - -func jpfLength(arguments []interface{}) (interface{}, error) { - arg := arguments[0] - if c, ok := arg.(string); ok { - return float64(utf8.RuneCountInString(c)), nil - } else if isSliceType(arg) { - v := reflect.ValueOf(arg) - return float64(v.Len()), nil - } else if c, ok := arg.(map[string]interface{}); ok { - return float64(len(c)), nil - } - return nil, errors.New("could not compute length()") -} - -func jpfStartsWith(arguments []interface{}) (interface{}, error) { - search := arguments[0].(string) - prefix := arguments[1].(string) - return strings.HasPrefix(search, prefix), nil -} - -func jpfAvg(arguments []interface{}) (interface{}, error) { - // We've already type checked the value so we can safely use - // type assertions. - args := arguments[0].([]interface{}) - length := float64(len(args)) - numerator := 0.0 - for _, n := range args { - numerator += n.(float64) - } - return numerator / length, nil -} -func jpfCeil(arguments []interface{}) (interface{}, error) { - val := arguments[0].(float64) - return math.Ceil(val), nil -} -func jpfContains(arguments []interface{}) (interface{}, error) { - search := arguments[0] - el := arguments[1] - if searchStr, ok := search.(string); ok { - if elStr, ok := el.(string); ok { - return strings.Index(searchStr, elStr) != -1, nil - } - return false, nil - } - // Otherwise this is a generic contains for []interface{} - general := search.([]interface{}) - for _, item := range general { - if item == el { - return true, nil - } - } - return false, nil -} -func jpfEndsWith(arguments []interface{}) (interface{}, error) { - search := arguments[0].(string) - suffix := arguments[1].(string) - return strings.HasSuffix(search, suffix), nil -} -func jpfFloor(arguments []interface{}) (interface{}, error) { - val := arguments[0].(float64) - return math.Floor(val), nil -} -func jpfMap(arguments []interface{}) (interface{}, error) { - intr := arguments[0].(*treeInterpreter) - exp := arguments[1].(expRef) - node := exp.ref - arr := arguments[2].([]interface{}) - mapped := make([]interface{}, 0, len(arr)) - for _, value := range arr { - current, err := intr.Execute(node, value) - if err != nil { - return nil, err - } - mapped = append(mapped, current) - } - return mapped, nil -} -func jpfMax(arguments []interface{}) (interface{}, error) { - if items, ok := toArrayNum(arguments[0]); ok { - if len(items) == 0 { - return nil, nil - } - if len(items) == 1 { - return items[0], nil - } - best := items[0] - for _, item := range items[1:] { - if item > best { - best = item - } - } - return best, nil - } - // Otherwise we're dealing with a max() of strings. - items, _ := toArrayStr(arguments[0]) - if len(items) == 0 { - return nil, nil - } - if len(items) == 1 { - return items[0], nil - } - best := items[0] - for _, item := range items[1:] { - if item > best { - best = item - } - } - return best, nil -} -func jpfMerge(arguments []interface{}) (interface{}, error) { - final := make(map[string]interface{}) - for _, m := range arguments { - mapped := m.(map[string]interface{}) - for key, value := range mapped { - final[key] = value - } - } - return final, nil -} -func jpfMaxBy(arguments []interface{}) (interface{}, error) { - intr := arguments[0].(*treeInterpreter) - arr := arguments[1].([]interface{}) - exp := arguments[2].(expRef) - node := exp.ref - if len(arr) == 0 { - return nil, nil - } else if len(arr) == 1 { - return arr[0], nil - } - start, err := intr.Execute(node, arr[0]) - if err != nil { - return nil, err - } - switch t := start.(type) { - case float64: - bestVal := t - bestItem := arr[0] - for _, item := range arr[1:] { - result, err := intr.Execute(node, item) - if err != nil { - return nil, err - } - current, ok := result.(float64) - if !ok { - return nil, errors.New("invalid type, must be number") - } - if current > bestVal { - bestVal = current - bestItem = item - } - } - return bestItem, nil - case string: - bestVal := t - bestItem := arr[0] - for _, item := range arr[1:] { - result, err := intr.Execute(node, item) - if err != nil { - return nil, err - } - current, ok := result.(string) - if !ok { - return nil, errors.New("invalid type, must be string") - } - if current > bestVal { - bestVal = current - bestItem = item - } - } - return bestItem, nil - default: - return nil, errors.New("invalid type, must be number of string") - } -} -func jpfSum(arguments []interface{}) (interface{}, error) { - items, _ := toArrayNum(arguments[0]) - sum := 0.0 - for _, item := range items { - sum += item - } - return sum, nil -} - -func jpfMin(arguments []interface{}) (interface{}, error) { - if items, ok := toArrayNum(arguments[0]); ok { - if len(items) == 0 { - return nil, nil - } - if len(items) == 1 { - return items[0], nil - } - best := items[0] - for _, item := range items[1:] { - if item < best { - best = item - } - } - return best, nil - } - items, _ := toArrayStr(arguments[0]) - if len(items) == 0 { - return nil, nil - } - if len(items) == 1 { - return items[0], nil - } - best := items[0] - for _, item := range items[1:] { - if item < best { - best = item - } - } - return best, nil -} - -func jpfMinBy(arguments []interface{}) (interface{}, error) { - intr := arguments[0].(*treeInterpreter) - arr := arguments[1].([]interface{}) - exp := arguments[2].(expRef) - node := exp.ref - if len(arr) == 0 { - return nil, nil - } else if len(arr) == 1 { - return arr[0], nil - } - start, err := intr.Execute(node, arr[0]) - if err != nil { - return nil, err - } - if t, ok := start.(float64); ok { - bestVal := t - bestItem := arr[0] - for _, item := range arr[1:] { - result, err := intr.Execute(node, item) - if err != nil { - return nil, err - } - current, ok := result.(float64) - if !ok { - return nil, errors.New("invalid type, must be number") - } - if current < bestVal { - bestVal = current - bestItem = item - } - } - return bestItem, nil - } else if t, ok := start.(string); ok { - bestVal := t - bestItem := arr[0] - for _, item := range arr[1:] { - result, err := intr.Execute(node, item) - if err != nil { - return nil, err - } - current, ok := result.(string) - if !ok { - return nil, errors.New("invalid type, must be string") - } - if current < bestVal { - bestVal = current - bestItem = item - } - } - return bestItem, nil - } else { - return nil, errors.New("invalid type, must be number of string") - } -} -func jpfType(arguments []interface{}) (interface{}, error) { - arg := arguments[0] - if _, ok := arg.(float64); ok { - return "number", nil - } - if _, ok := arg.(string); ok { - return "string", nil - } - if _, ok := arg.([]interface{}); ok { - return "array", nil - } - if _, ok := arg.(map[string]interface{}); ok { - return "object", nil - } - if arg == nil { - return "null", nil - } - if arg == true || arg == false { - return "boolean", nil - } - return nil, errors.New("unknown type") -} -func jpfKeys(arguments []interface{}) (interface{}, error) { - arg := arguments[0].(map[string]interface{}) - collected := make([]interface{}, 0, len(arg)) - for key := range arg { - collected = append(collected, key) - } - return collected, nil -} -func jpfValues(arguments []interface{}) (interface{}, error) { - arg := arguments[0].(map[string]interface{}) - collected := make([]interface{}, 0, len(arg)) - for _, value := range arg { - collected = append(collected, value) - } - return collected, nil -} -func jpfSort(arguments []interface{}) (interface{}, error) { - if items, ok := toArrayNum(arguments[0]); ok { - d := sort.Float64Slice(items) - sort.Stable(d) - final := make([]interface{}, len(d)) - for i, val := range d { - final[i] = val - } - return final, nil - } - // Otherwise we're dealing with sort()'ing strings. - items, _ := toArrayStr(arguments[0]) - d := sort.StringSlice(items) - sort.Stable(d) - final := make([]interface{}, len(d)) - for i, val := range d { - final[i] = val - } - return final, nil -} -func jpfSortBy(arguments []interface{}) (interface{}, error) { - intr := arguments[0].(*treeInterpreter) - arr := arguments[1].([]interface{}) - exp := arguments[2].(expRef) - node := exp.ref - if len(arr) == 0 { - return arr, nil - } else if len(arr) == 1 { - return arr, nil - } - start, err := intr.Execute(node, arr[0]) - if err != nil { - return nil, err - } - if _, ok := start.(float64); ok { - sortable := &byExprFloat{intr, node, arr, false} - sort.Stable(sortable) - if sortable.hasError { - return nil, errors.New("error in sort_by comparison") - } - return arr, nil - } else if _, ok := start.(string); ok { - sortable := &byExprString{intr, node, arr, false} - sort.Stable(sortable) - if sortable.hasError { - return nil, errors.New("error in sort_by comparison") - } - return arr, nil - } else { - return nil, errors.New("invalid type, must be number of string") - } -} -func jpfJoin(arguments []interface{}) (interface{}, error) { - sep := arguments[0].(string) - // We can't just do arguments[1].([]string), we have to - // manually convert each item to a string. - arrayStr := []string{} - for _, item := range arguments[1].([]interface{}) { - arrayStr = append(arrayStr, item.(string)) - } - return strings.Join(arrayStr, sep), nil -} -func jpfReverse(arguments []interface{}) (interface{}, error) { - if s, ok := arguments[0].(string); ok { - r := []rune(s) - for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 { - r[i], r[j] = r[j], r[i] - } - return string(r), nil - } - items := arguments[0].([]interface{}) - length := len(items) - reversed := make([]interface{}, length) - for i, item := range items { - reversed[length-(i+1)] = item - } - return reversed, nil -} -func jpfToArray(arguments []interface{}) (interface{}, error) { - if _, ok := arguments[0].([]interface{}); ok { - return arguments[0], nil - } - return arguments[:1:1], nil -} -func jpfToString(arguments []interface{}) (interface{}, error) { - if v, ok := arguments[0].(string); ok { - return v, nil - } - result, err := json.Marshal(arguments[0]) - if err != nil { - return nil, err - } - return string(result), nil -} -func jpfToNumber(arguments []interface{}) (interface{}, error) { - arg := arguments[0] - if v, ok := arg.(float64); ok { - return v, nil - } - if v, ok := arg.(string); ok { - conv, err := strconv.ParseFloat(v, 64) - if err != nil { - return nil, nil - } - return conv, nil - } - if _, ok := arg.([]interface{}); ok { - return nil, nil - } - if _, ok := arg.(map[string]interface{}); ok { - return nil, nil - } - if arg == nil { - return nil, nil - } - if arg == true || arg == false { - return nil, nil - } - return nil, errors.New("unknown type") -} -func jpfNotNull(arguments []interface{}) (interface{}, error) { - for _, arg := range arguments { - if arg != nil { - return arg, nil - } - } - return nil, nil -} diff --git a/vendor/github.com/jmespath/go-jmespath/go.mod b/vendor/github.com/jmespath/go-jmespath/go.mod deleted file mode 100644 index aa1e3f1c9..000000000 --- a/vendor/github.com/jmespath/go-jmespath/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/jmespath/go-jmespath - -go 1.14 - -require github.com/stretchr/testify v1.5.1 diff --git a/vendor/github.com/jmespath/go-jmespath/go.sum b/vendor/github.com/jmespath/go-jmespath/go.sum deleted file mode 100644 index 331fa6982..000000000 --- a/vendor/github.com/jmespath/go-jmespath/go.sum +++ /dev/null @@ -1,11 +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/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.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -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/jmespath/go-jmespath/interpreter.go b/vendor/github.com/jmespath/go-jmespath/interpreter.go deleted file mode 100644 index 13c74604c..000000000 --- a/vendor/github.com/jmespath/go-jmespath/interpreter.go +++ /dev/null @@ -1,418 +0,0 @@ -package jmespath - -import ( - "errors" - "reflect" - "unicode" - "unicode/utf8" -) - -/* This is a tree based interpreter. It walks the AST and directly - interprets the AST to search through a JSON document. -*/ - -type treeInterpreter struct { - fCall *functionCaller -} - -func newInterpreter() *treeInterpreter { - interpreter := treeInterpreter{} - interpreter.fCall = newFunctionCaller() - return &interpreter -} - -type expRef struct { - ref ASTNode -} - -// Execute takes an ASTNode and input data and interprets the AST directly. -// It will produce the result of applying the JMESPath expression associated -// with the ASTNode to the input data "value". -func (intr *treeInterpreter) Execute(node ASTNode, value interface{}) (interface{}, error) { - switch node.nodeType { - case ASTComparator: - left, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, err - } - right, err := intr.Execute(node.children[1], value) - if err != nil { - return nil, err - } - switch node.value { - case tEQ: - return objsEqual(left, right), nil - case tNE: - return !objsEqual(left, right), nil - } - leftNum, ok := left.(float64) - if !ok { - return nil, nil - } - rightNum, ok := right.(float64) - if !ok { - return nil, nil - } - switch node.value { - case tGT: - return leftNum > rightNum, nil - case tGTE: - return leftNum >= rightNum, nil - case tLT: - return leftNum < rightNum, nil - case tLTE: - return leftNum <= rightNum, nil - } - case ASTExpRef: - return expRef{ref: node.children[0]}, nil - case ASTFunctionExpression: - resolvedArgs := []interface{}{} - for _, arg := range node.children { - current, err := intr.Execute(arg, value) - if err != nil { - return nil, err - } - resolvedArgs = append(resolvedArgs, current) - } - return intr.fCall.CallFunction(node.value.(string), resolvedArgs, intr) - case ASTField: - if m, ok := value.(map[string]interface{}); ok { - key := node.value.(string) - return m[key], nil - } - return intr.fieldFromStruct(node.value.(string), value) - case ASTFilterProjection: - left, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, nil - } - sliceType, ok := left.([]interface{}) - if !ok { - if isSliceType(left) { - return intr.filterProjectionWithReflection(node, left) - } - return nil, nil - } - compareNode := node.children[2] - collected := []interface{}{} - for _, element := range sliceType { - result, err := intr.Execute(compareNode, element) - if err != nil { - return nil, err - } - if !isFalse(result) { - current, err := intr.Execute(node.children[1], element) - if err != nil { - return nil, err - } - if current != nil { - collected = append(collected, current) - } - } - } - return collected, nil - case ASTFlatten: - left, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, nil - } - sliceType, ok := left.([]interface{}) - if !ok { - // If we can't type convert to []interface{}, there's - // a chance this could still work via reflection if we're - // dealing with user provided types. - if isSliceType(left) { - return intr.flattenWithReflection(left) - } - return nil, nil - } - flattened := []interface{}{} - for _, element := range sliceType { - if elementSlice, ok := element.([]interface{}); ok { - flattened = append(flattened, elementSlice...) - } else if isSliceType(element) { - reflectFlat := []interface{}{} - v := reflect.ValueOf(element) - for i := 0; i < v.Len(); i++ { - reflectFlat = append(reflectFlat, v.Index(i).Interface()) - } - flattened = append(flattened, reflectFlat...) - } else { - flattened = append(flattened, element) - } - } - return flattened, nil - case ASTIdentity, ASTCurrentNode: - return value, nil - case ASTIndex: - if sliceType, ok := value.([]interface{}); ok { - index := node.value.(int) - if index < 0 { - index += len(sliceType) - } - if index < len(sliceType) && index >= 0 { - return sliceType[index], nil - } - return nil, nil - } - // Otherwise try via reflection. - rv := reflect.ValueOf(value) - if rv.Kind() == reflect.Slice { - index := node.value.(int) - if index < 0 { - index += rv.Len() - } - if index < rv.Len() && index >= 0 { - v := rv.Index(index) - return v.Interface(), nil - } - } - return nil, nil - case ASTKeyValPair: - return intr.Execute(node.children[0], value) - case ASTLiteral: - return node.value, nil - case ASTMultiSelectHash: - if value == nil { - return nil, nil - } - collected := make(map[string]interface{}) - for _, child := range node.children { - current, err := intr.Execute(child, value) - if err != nil { - return nil, err - } - key := child.value.(string) - collected[key] = current - } - return collected, nil - case ASTMultiSelectList: - if value == nil { - return nil, nil - } - collected := []interface{}{} - for _, child := range node.children { - current, err := intr.Execute(child, value) - if err != nil { - return nil, err - } - collected = append(collected, current) - } - return collected, nil - case ASTOrExpression: - matched, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, err - } - if isFalse(matched) { - matched, err = intr.Execute(node.children[1], value) - if err != nil { - return nil, err - } - } - return matched, nil - case ASTAndExpression: - matched, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, err - } - if isFalse(matched) { - return matched, nil - } - return intr.Execute(node.children[1], value) - case ASTNotExpression: - matched, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, err - } - if isFalse(matched) { - return true, nil - } - return false, nil - case ASTPipe: - result := value - var err error - for _, child := range node.children { - result, err = intr.Execute(child, result) - if err != nil { - return nil, err - } - } - return result, nil - case ASTProjection: - left, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, err - } - sliceType, ok := left.([]interface{}) - if !ok { - if isSliceType(left) { - return intr.projectWithReflection(node, left) - } - return nil, nil - } - collected := []interface{}{} - var current interface{} - for _, element := range sliceType { - current, err = intr.Execute(node.children[1], element) - if err != nil { - return nil, err - } - if current != nil { - collected = append(collected, current) - } - } - return collected, nil - case ASTSubexpression, ASTIndexExpression: - left, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, err - } - return intr.Execute(node.children[1], left) - case ASTSlice: - sliceType, ok := value.([]interface{}) - if !ok { - if isSliceType(value) { - return intr.sliceWithReflection(node, value) - } - return nil, nil - } - parts := node.value.([]*int) - sliceParams := make([]sliceParam, 3) - for i, part := range parts { - if part != nil { - sliceParams[i].Specified = true - sliceParams[i].N = *part - } - } - return slice(sliceType, sliceParams) - case ASTValueProjection: - left, err := intr.Execute(node.children[0], value) - if err != nil { - return nil, nil - } - mapType, ok := left.(map[string]interface{}) - if !ok { - return nil, nil - } - values := make([]interface{}, len(mapType)) - for _, value := range mapType { - values = append(values, value) - } - collected := []interface{}{} - for _, element := range values { - current, err := intr.Execute(node.children[1], element) - if err != nil { - return nil, err - } - if current != nil { - collected = append(collected, current) - } - } - return collected, nil - } - return nil, errors.New("Unknown AST node: " + node.nodeType.String()) -} - -func (intr *treeInterpreter) fieldFromStruct(key string, value interface{}) (interface{}, error) { - rv := reflect.ValueOf(value) - first, n := utf8.DecodeRuneInString(key) - fieldName := string(unicode.ToUpper(first)) + key[n:] - if rv.Kind() == reflect.Struct { - v := rv.FieldByName(fieldName) - if !v.IsValid() { - return nil, nil - } - return v.Interface(), nil - } else if rv.Kind() == reflect.Ptr { - // Handle multiple levels of indirection? - if rv.IsNil() { - return nil, nil - } - rv = rv.Elem() - v := rv.FieldByName(fieldName) - if !v.IsValid() { - return nil, nil - } - return v.Interface(), nil - } - return nil, nil -} - -func (intr *treeInterpreter) flattenWithReflection(value interface{}) (interface{}, error) { - v := reflect.ValueOf(value) - flattened := []interface{}{} - for i := 0; i < v.Len(); i++ { - element := v.Index(i).Interface() - if reflect.TypeOf(element).Kind() == reflect.Slice { - // Then insert the contents of the element - // slice into the flattened slice, - // i.e flattened = append(flattened, mySlice...) - elementV := reflect.ValueOf(element) - for j := 0; j < elementV.Len(); j++ { - flattened = append( - flattened, elementV.Index(j).Interface()) - } - } else { - flattened = append(flattened, element) - } - } - return flattened, nil -} - -func (intr *treeInterpreter) sliceWithReflection(node ASTNode, value interface{}) (interface{}, error) { - v := reflect.ValueOf(value) - parts := node.value.([]*int) - sliceParams := make([]sliceParam, 3) - for i, part := range parts { - if part != nil { - sliceParams[i].Specified = true - sliceParams[i].N = *part - } - } - final := []interface{}{} - for i := 0; i < v.Len(); i++ { - element := v.Index(i).Interface() - final = append(final, element) - } - return slice(final, sliceParams) -} - -func (intr *treeInterpreter) filterProjectionWithReflection(node ASTNode, value interface{}) (interface{}, error) { - compareNode := node.children[2] - collected := []interface{}{} - v := reflect.ValueOf(value) - for i := 0; i < v.Len(); i++ { - element := v.Index(i).Interface() - result, err := intr.Execute(compareNode, element) - if err != nil { - return nil, err - } - if !isFalse(result) { - current, err := intr.Execute(node.children[1], element) - if err != nil { - return nil, err - } - if current != nil { - collected = append(collected, current) - } - } - } - return collected, nil -} - -func (intr *treeInterpreter) projectWithReflection(node ASTNode, value interface{}) (interface{}, error) { - collected := []interface{}{} - v := reflect.ValueOf(value) - for i := 0; i < v.Len(); i++ { - element := v.Index(i).Interface() - result, err := intr.Execute(node.children[1], element) - if err != nil { - return nil, err - } - if result != nil { - collected = append(collected, result) - } - } - return collected, nil -} diff --git a/vendor/github.com/jmespath/go-jmespath/lexer.go b/vendor/github.com/jmespath/go-jmespath/lexer.go deleted file mode 100644 index 817900c8f..000000000 --- a/vendor/github.com/jmespath/go-jmespath/lexer.go +++ /dev/null @@ -1,420 +0,0 @@ -package jmespath - -import ( - "bytes" - "encoding/json" - "fmt" - "strconv" - "strings" - "unicode/utf8" -) - -type token struct { - tokenType tokType - value string - position int - length int -} - -type tokType int - -const eof = -1 - -// Lexer contains information about the expression being tokenized. -type Lexer struct { - expression string // The expression provided by the user. - currentPos int // The current position in the string. - lastWidth int // The width of the current rune. This - buf bytes.Buffer // Internal buffer used for building up values. -} - -// SyntaxError is the main error used whenever a lexing or parsing error occurs. -type SyntaxError struct { - msg string // Error message displayed to user - Expression string // Expression that generated a SyntaxError - Offset int // The location in the string where the error occurred -} - -func (e SyntaxError) Error() string { - // In the future, it would be good to underline the specific - // location where the error occurred. - return "SyntaxError: " + e.msg -} - -// HighlightLocation will show where the syntax error occurred. -// It will place a "^" character on a line below the expression -// at the point where the syntax error occurred. -func (e SyntaxError) HighlightLocation() string { - return e.Expression + "\n" + strings.Repeat(" ", e.Offset) + "^" -} - -//go:generate stringer -type=tokType -const ( - tUnknown tokType = iota - tStar - tDot - tFilter - tFlatten - tLparen - tRparen - tLbracket - tRbracket - tLbrace - tRbrace - tOr - tPipe - tNumber - tUnquotedIdentifier - tQuotedIdentifier - tComma - tColon - tLT - tLTE - tGT - tGTE - tEQ - tNE - tJSONLiteral - tStringLiteral - tCurrent - tExpref - tAnd - tNot - tEOF -) - -var basicTokens = map[rune]tokType{ - '.': tDot, - '*': tStar, - ',': tComma, - ':': tColon, - '{': tLbrace, - '}': tRbrace, - ']': tRbracket, // tLbracket not included because it could be "[]" - '(': tLparen, - ')': tRparen, - '@': tCurrent, -} - -// Bit mask for [a-zA-Z_] shifted down 64 bits to fit in a single uint64. -// When using this bitmask just be sure to shift the rune down 64 bits -// before checking against identifierStartBits. -const identifierStartBits uint64 = 576460745995190270 - -// Bit mask for [a-zA-Z0-9], 128 bits -> 2 uint64s. -var identifierTrailingBits = [2]uint64{287948901175001088, 576460745995190270} - -var whiteSpace = map[rune]bool{ - ' ': true, '\t': true, '\n': true, '\r': true, -} - -func (t token) String() string { - return fmt.Sprintf("Token{%+v, %s, %d, %d}", - t.tokenType, t.value, t.position, t.length) -} - -// NewLexer creates a new JMESPath lexer. -func NewLexer() *Lexer { - lexer := Lexer{} - return &lexer -} - -func (lexer *Lexer) next() rune { - if lexer.currentPos >= len(lexer.expression) { - lexer.lastWidth = 0 - return eof - } - r, w := utf8.DecodeRuneInString(lexer.expression[lexer.currentPos:]) - lexer.lastWidth = w - lexer.currentPos += w - return r -} - -func (lexer *Lexer) back() { - lexer.currentPos -= lexer.lastWidth -} - -func (lexer *Lexer) peek() rune { - t := lexer.next() - lexer.back() - return t -} - -// tokenize takes an expression and returns corresponding tokens. -func (lexer *Lexer) tokenize(expression string) ([]token, error) { - var tokens []token - lexer.expression = expression - lexer.currentPos = 0 - lexer.lastWidth = 0 -loop: - for { - r := lexer.next() - if identifierStartBits&(1<<(uint64(r)-64)) > 0 { - t := lexer.consumeUnquotedIdentifier() - tokens = append(tokens, t) - } else if val, ok := basicTokens[r]; ok { - // Basic single char token. - t := token{ - tokenType: val, - value: string(r), - position: lexer.currentPos - lexer.lastWidth, - length: 1, - } - tokens = append(tokens, t) - } else if r == '-' || (r >= '0' && r <= '9') { - t := lexer.consumeNumber() - tokens = append(tokens, t) - } else if r == '[' { - t := lexer.consumeLBracket() - tokens = append(tokens, t) - } else if r == '"' { - t, err := lexer.consumeQuotedIdentifier() - if err != nil { - return tokens, err - } - tokens = append(tokens, t) - } else if r == '\'' { - t, err := lexer.consumeRawStringLiteral() - if err != nil { - return tokens, err - } - tokens = append(tokens, t) - } else if r == '`' { - t, err := lexer.consumeLiteral() - if err != nil { - return tokens, err - } - tokens = append(tokens, t) - } else if r == '|' { - t := lexer.matchOrElse(r, '|', tOr, tPipe) - tokens = append(tokens, t) - } else if r == '<' { - t := lexer.matchOrElse(r, '=', tLTE, tLT) - tokens = append(tokens, t) - } else if r == '>' { - t := lexer.matchOrElse(r, '=', tGTE, tGT) - tokens = append(tokens, t) - } else if r == '!' { - t := lexer.matchOrElse(r, '=', tNE, tNot) - tokens = append(tokens, t) - } else if r == '=' { - t := lexer.matchOrElse(r, '=', tEQ, tUnknown) - tokens = append(tokens, t) - } else if r == '&' { - t := lexer.matchOrElse(r, '&', tAnd, tExpref) - tokens = append(tokens, t) - } else if r == eof { - break loop - } else if _, ok := whiteSpace[r]; ok { - // Ignore whitespace - } else { - return tokens, lexer.syntaxError(fmt.Sprintf("Unknown char: %s", strconv.QuoteRuneToASCII(r))) - } - } - tokens = append(tokens, token{tEOF, "", len(lexer.expression), 0}) - return tokens, nil -} - -// Consume characters until the ending rune "r" is reached. -// If the end of the expression is reached before seeing the -// terminating rune "r", then an error is returned. -// If no error occurs then the matching substring is returned. -// The returned string will not include the ending rune. -func (lexer *Lexer) consumeUntil(end rune) (string, error) { - start := lexer.currentPos - current := lexer.next() - for current != end && current != eof { - if current == '\\' && lexer.peek() != eof { - lexer.next() - } - current = lexer.next() - } - if lexer.lastWidth == 0 { - // Then we hit an EOF so we never reached the closing - // delimiter. - return "", SyntaxError{ - msg: "Unclosed delimiter: " + string(end), - Expression: lexer.expression, - Offset: len(lexer.expression), - } - } - return lexer.expression[start : lexer.currentPos-lexer.lastWidth], nil -} - -func (lexer *Lexer) consumeLiteral() (token, error) { - start := lexer.currentPos - value, err := lexer.consumeUntil('`') - if err != nil { - return token{}, err - } - value = strings.Replace(value, "\\`", "`", -1) - return token{ - tokenType: tJSONLiteral, - value: value, - position: start, - length: len(value), - }, nil -} - -func (lexer *Lexer) consumeRawStringLiteral() (token, error) { - start := lexer.currentPos - currentIndex := start - current := lexer.next() - for current != '\'' && lexer.peek() != eof { - if current == '\\' && lexer.peek() == '\'' { - chunk := lexer.expression[currentIndex : lexer.currentPos-1] - lexer.buf.WriteString(chunk) - lexer.buf.WriteString("'") - lexer.next() - currentIndex = lexer.currentPos - } - current = lexer.next() - } - if lexer.lastWidth == 0 { - // Then we hit an EOF so we never reached the closing - // delimiter. - return token{}, SyntaxError{ - msg: "Unclosed delimiter: '", - Expression: lexer.expression, - Offset: len(lexer.expression), - } - } - if currentIndex < lexer.currentPos { - lexer.buf.WriteString(lexer.expression[currentIndex : lexer.currentPos-1]) - } - value := lexer.buf.String() - // Reset the buffer so it can reused again. - lexer.buf.Reset() - return token{ - tokenType: tStringLiteral, - value: value, - position: start, - length: len(value), - }, nil -} - -func (lexer *Lexer) syntaxError(msg string) SyntaxError { - return SyntaxError{ - msg: msg, - Expression: lexer.expression, - Offset: lexer.currentPos - 1, - } -} - -// Checks for a two char token, otherwise matches a single character -// token. This is used whenever a two char token overlaps a single -// char token, e.g. "||" -> tPipe, "|" -> tOr. -func (lexer *Lexer) matchOrElse(first rune, second rune, matchedType tokType, singleCharType tokType) token { - start := lexer.currentPos - lexer.lastWidth - nextRune := lexer.next() - var t token - if nextRune == second { - t = token{ - tokenType: matchedType, - value: string(first) + string(second), - position: start, - length: 2, - } - } else { - lexer.back() - t = token{ - tokenType: singleCharType, - value: string(first), - position: start, - length: 1, - } - } - return t -} - -func (lexer *Lexer) consumeLBracket() token { - // There's three options here: - // 1. A filter expression "[?" - // 2. A flatten operator "[]" - // 3. A bare rbracket "[" - start := lexer.currentPos - lexer.lastWidth - nextRune := lexer.next() - var t token - if nextRune == '?' { - t = token{ - tokenType: tFilter, - value: "[?", - position: start, - length: 2, - } - } else if nextRune == ']' { - t = token{ - tokenType: tFlatten, - value: "[]", - position: start, - length: 2, - } - } else { - t = token{ - tokenType: tLbracket, - value: "[", - position: start, - length: 1, - } - lexer.back() - } - return t -} - -func (lexer *Lexer) consumeQuotedIdentifier() (token, error) { - start := lexer.currentPos - value, err := lexer.consumeUntil('"') - if err != nil { - return token{}, err - } - var decoded string - asJSON := []byte("\"" + value + "\"") - if err := json.Unmarshal([]byte(asJSON), &decoded); err != nil { - return token{}, err - } - return token{ - tokenType: tQuotedIdentifier, - value: decoded, - position: start - 1, - length: len(decoded), - }, nil -} - -func (lexer *Lexer) consumeUnquotedIdentifier() token { - // Consume runes until we reach the end of an unquoted - // identifier. - start := lexer.currentPos - lexer.lastWidth - for { - r := lexer.next() - if r < 0 || r > 128 || identifierTrailingBits[uint64(r)/64]&(1<<(uint64(r)%64)) == 0 { - lexer.back() - break - } - } - value := lexer.expression[start:lexer.currentPos] - return token{ - tokenType: tUnquotedIdentifier, - value: value, - position: start, - length: lexer.currentPos - start, - } -} - -func (lexer *Lexer) consumeNumber() token { - // Consume runes until we reach something that's not a number. - start := lexer.currentPos - lexer.lastWidth - for { - r := lexer.next() - if r < '0' || r > '9' { - lexer.back() - break - } - } - value := lexer.expression[start:lexer.currentPos] - return token{ - tokenType: tNumber, - value: value, - position: start, - length: lexer.currentPos - start, - } -} diff --git a/vendor/github.com/jmespath/go-jmespath/parser.go b/vendor/github.com/jmespath/go-jmespath/parser.go deleted file mode 100644 index 4abc303ab..000000000 --- a/vendor/github.com/jmespath/go-jmespath/parser.go +++ /dev/null @@ -1,603 +0,0 @@ -package jmespath - -import ( - "encoding/json" - "fmt" - "strconv" - "strings" -) - -type astNodeType int - -//go:generate stringer -type astNodeType -const ( - ASTEmpty astNodeType = iota - ASTComparator - ASTCurrentNode - ASTExpRef - ASTFunctionExpression - ASTField - ASTFilterProjection - ASTFlatten - ASTIdentity - ASTIndex - ASTIndexExpression - ASTKeyValPair - ASTLiteral - ASTMultiSelectHash - ASTMultiSelectList - ASTOrExpression - ASTAndExpression - ASTNotExpression - ASTPipe - ASTProjection - ASTSubexpression - ASTSlice - ASTValueProjection -) - -// ASTNode represents the abstract syntax tree of a JMESPath expression. -type ASTNode struct { - nodeType astNodeType - value interface{} - children []ASTNode -} - -func (node ASTNode) String() string { - return node.PrettyPrint(0) -} - -// PrettyPrint will pretty print the parsed AST. -// The AST is an implementation detail and this pretty print -// function is provided as a convenience method to help with -// debugging. You should not rely on its output as the internal -// structure of the AST may change at any time. -func (node ASTNode) PrettyPrint(indent int) string { - spaces := strings.Repeat(" ", indent) - output := fmt.Sprintf("%s%s {\n", spaces, node.nodeType) - nextIndent := indent + 2 - if node.value != nil { - if converted, ok := node.value.(fmt.Stringer); ok { - // Account for things like comparator nodes - // that are enums with a String() method. - output += fmt.Sprintf("%svalue: %s\n", strings.Repeat(" ", nextIndent), converted.String()) - } else { - output += fmt.Sprintf("%svalue: %#v\n", strings.Repeat(" ", nextIndent), node.value) - } - } - lastIndex := len(node.children) - if lastIndex > 0 { - output += fmt.Sprintf("%schildren: {\n", strings.Repeat(" ", nextIndent)) - childIndent := nextIndent + 2 - for _, elem := range node.children { - output += elem.PrettyPrint(childIndent) - } - } - output += fmt.Sprintf("%s}\n", spaces) - return output -} - -var bindingPowers = map[tokType]int{ - tEOF: 0, - tUnquotedIdentifier: 0, - tQuotedIdentifier: 0, - tRbracket: 0, - tRparen: 0, - tComma: 0, - tRbrace: 0, - tNumber: 0, - tCurrent: 0, - tExpref: 0, - tColon: 0, - tPipe: 1, - tOr: 2, - tAnd: 3, - tEQ: 5, - tLT: 5, - tLTE: 5, - tGT: 5, - tGTE: 5, - tNE: 5, - tFlatten: 9, - tStar: 20, - tFilter: 21, - tDot: 40, - tNot: 45, - tLbrace: 50, - tLbracket: 55, - tLparen: 60, -} - -// Parser holds state about the current expression being parsed. -type Parser struct { - expression string - tokens []token - index int -} - -// NewParser creates a new JMESPath parser. -func NewParser() *Parser { - p := Parser{} - return &p -} - -// Parse will compile a JMESPath expression. -func (p *Parser) Parse(expression string) (ASTNode, error) { - lexer := NewLexer() - p.expression = expression - p.index = 0 - tokens, err := lexer.tokenize(expression) - if err != nil { - return ASTNode{}, err - } - p.tokens = tokens - parsed, err := p.parseExpression(0) - if err != nil { - return ASTNode{}, err - } - if p.current() != tEOF { - return ASTNode{}, p.syntaxError(fmt.Sprintf( - "Unexpected token at the end of the expression: %s", p.current())) - } - return parsed, nil -} - -func (p *Parser) parseExpression(bindingPower int) (ASTNode, error) { - var err error - leftToken := p.lookaheadToken(0) - p.advance() - leftNode, err := p.nud(leftToken) - if err != nil { - return ASTNode{}, err - } - currentToken := p.current() - for bindingPower < bindingPowers[currentToken] { - p.advance() - leftNode, err = p.led(currentToken, leftNode) - if err != nil { - return ASTNode{}, err - } - currentToken = p.current() - } - return leftNode, nil -} - -func (p *Parser) parseIndexExpression() (ASTNode, error) { - if p.lookahead(0) == tColon || p.lookahead(1) == tColon { - return p.parseSliceExpression() - } - indexStr := p.lookaheadToken(0).value - parsedInt, err := strconv.Atoi(indexStr) - if err != nil { - return ASTNode{}, err - } - indexNode := ASTNode{nodeType: ASTIndex, value: parsedInt} - p.advance() - if err := p.match(tRbracket); err != nil { - return ASTNode{}, err - } - return indexNode, nil -} - -func (p *Parser) parseSliceExpression() (ASTNode, error) { - parts := []*int{nil, nil, nil} - index := 0 - current := p.current() - for current != tRbracket && index < 3 { - if current == tColon { - index++ - p.advance() - } else if current == tNumber { - parsedInt, err := strconv.Atoi(p.lookaheadToken(0).value) - if err != nil { - return ASTNode{}, err - } - parts[index] = &parsedInt - p.advance() - } else { - return ASTNode{}, p.syntaxError( - "Expected tColon or tNumber" + ", received: " + p.current().String()) - } - current = p.current() - } - if err := p.match(tRbracket); err != nil { - return ASTNode{}, err - } - return ASTNode{ - nodeType: ASTSlice, - value: parts, - }, nil -} - -func (p *Parser) match(tokenType tokType) error { - if p.current() == tokenType { - p.advance() - return nil - } - return p.syntaxError("Expected " + tokenType.String() + ", received: " + p.current().String()) -} - -func (p *Parser) led(tokenType tokType, node ASTNode) (ASTNode, error) { - switch tokenType { - case tDot: - if p.current() != tStar { - right, err := p.parseDotRHS(bindingPowers[tDot]) - return ASTNode{ - nodeType: ASTSubexpression, - children: []ASTNode{node, right}, - }, err - } - p.advance() - right, err := p.parseProjectionRHS(bindingPowers[tDot]) - return ASTNode{ - nodeType: ASTValueProjection, - children: []ASTNode{node, right}, - }, err - case tPipe: - right, err := p.parseExpression(bindingPowers[tPipe]) - return ASTNode{nodeType: ASTPipe, children: []ASTNode{node, right}}, err - case tOr: - right, err := p.parseExpression(bindingPowers[tOr]) - return ASTNode{nodeType: ASTOrExpression, children: []ASTNode{node, right}}, err - case tAnd: - right, err := p.parseExpression(bindingPowers[tAnd]) - return ASTNode{nodeType: ASTAndExpression, children: []ASTNode{node, right}}, err - case tLparen: - name := node.value - var args []ASTNode - for p.current() != tRparen { - expression, err := p.parseExpression(0) - if err != nil { - return ASTNode{}, err - } - if p.current() == tComma { - if err := p.match(tComma); err != nil { - return ASTNode{}, err - } - } - args = append(args, expression) - } - if err := p.match(tRparen); err != nil { - return ASTNode{}, err - } - return ASTNode{ - nodeType: ASTFunctionExpression, - value: name, - children: args, - }, nil - case tFilter: - return p.parseFilter(node) - case tFlatten: - left := ASTNode{nodeType: ASTFlatten, children: []ASTNode{node}} - right, err := p.parseProjectionRHS(bindingPowers[tFlatten]) - return ASTNode{ - nodeType: ASTProjection, - children: []ASTNode{left, right}, - }, err - case tEQ, tNE, tGT, tGTE, tLT, tLTE: - right, err := p.parseExpression(bindingPowers[tokenType]) - if err != nil { - return ASTNode{}, err - } - return ASTNode{ - nodeType: ASTComparator, - value: tokenType, - children: []ASTNode{node, right}, - }, nil - case tLbracket: - tokenType := p.current() - var right ASTNode - var err error - if tokenType == tNumber || tokenType == tColon { - right, err = p.parseIndexExpression() - if err != nil { - return ASTNode{}, err - } - return p.projectIfSlice(node, right) - } - // Otherwise this is a projection. - if err := p.match(tStar); err != nil { - return ASTNode{}, err - } - if err := p.match(tRbracket); err != nil { - return ASTNode{}, err - } - right, err = p.parseProjectionRHS(bindingPowers[tStar]) - if err != nil { - return ASTNode{}, err - } - return ASTNode{ - nodeType: ASTProjection, - children: []ASTNode{node, right}, - }, nil - } - return ASTNode{}, p.syntaxError("Unexpected token: " + tokenType.String()) -} - -func (p *Parser) nud(token token) (ASTNode, error) { - switch token.tokenType { - case tJSONLiteral: - var parsed interface{} - err := json.Unmarshal([]byte(token.value), &parsed) - if err != nil { - return ASTNode{}, err - } - return ASTNode{nodeType: ASTLiteral, value: parsed}, nil - case tStringLiteral: - return ASTNode{nodeType: ASTLiteral, value: token.value}, nil - case tUnquotedIdentifier: - return ASTNode{ - nodeType: ASTField, - value: token.value, - }, nil - case tQuotedIdentifier: - node := ASTNode{nodeType: ASTField, value: token.value} - if p.current() == tLparen { - return ASTNode{}, p.syntaxErrorToken("Can't have quoted identifier as function name.", token) - } - return node, nil - case tStar: - left := ASTNode{nodeType: ASTIdentity} - var right ASTNode - var err error - if p.current() == tRbracket { - right = ASTNode{nodeType: ASTIdentity} - } else { - right, err = p.parseProjectionRHS(bindingPowers[tStar]) - } - return ASTNode{nodeType: ASTValueProjection, children: []ASTNode{left, right}}, err - case tFilter: - return p.parseFilter(ASTNode{nodeType: ASTIdentity}) - case tLbrace: - return p.parseMultiSelectHash() - case tFlatten: - left := ASTNode{ - nodeType: ASTFlatten, - children: []ASTNode{{nodeType: ASTIdentity}}, - } - right, err := p.parseProjectionRHS(bindingPowers[tFlatten]) - if err != nil { - return ASTNode{}, err - } - return ASTNode{nodeType: ASTProjection, children: []ASTNode{left, right}}, nil - case tLbracket: - tokenType := p.current() - //var right ASTNode - if tokenType == tNumber || tokenType == tColon { - right, err := p.parseIndexExpression() - if err != nil { - return ASTNode{}, nil - } - return p.projectIfSlice(ASTNode{nodeType: ASTIdentity}, right) - } else if tokenType == tStar && p.lookahead(1) == tRbracket { - p.advance() - p.advance() - right, err := p.parseProjectionRHS(bindingPowers[tStar]) - if err != nil { - return ASTNode{}, err - } - return ASTNode{ - nodeType: ASTProjection, - children: []ASTNode{{nodeType: ASTIdentity}, right}, - }, nil - } else { - return p.parseMultiSelectList() - } - case tCurrent: - return ASTNode{nodeType: ASTCurrentNode}, nil - case tExpref: - expression, err := p.parseExpression(bindingPowers[tExpref]) - if err != nil { - return ASTNode{}, err - } - return ASTNode{nodeType: ASTExpRef, children: []ASTNode{expression}}, nil - case tNot: - expression, err := p.parseExpression(bindingPowers[tNot]) - if err != nil { - return ASTNode{}, err - } - return ASTNode{nodeType: ASTNotExpression, children: []ASTNode{expression}}, nil - case tLparen: - expression, err := p.parseExpression(0) - if err != nil { - return ASTNode{}, err - } - if err := p.match(tRparen); err != nil { - return ASTNode{}, err - } - return expression, nil - case tEOF: - return ASTNode{}, p.syntaxErrorToken("Incomplete expression", token) - } - - return ASTNode{}, p.syntaxErrorToken("Invalid token: "+token.tokenType.String(), token) -} - -func (p *Parser) parseMultiSelectList() (ASTNode, error) { - var expressions []ASTNode - for { - expression, err := p.parseExpression(0) - if err != nil { - return ASTNode{}, err - } - expressions = append(expressions, expression) - if p.current() == tRbracket { - break - } - err = p.match(tComma) - if err != nil { - return ASTNode{}, err - } - } - err := p.match(tRbracket) - if err != nil { - return ASTNode{}, err - } - return ASTNode{ - nodeType: ASTMultiSelectList, - children: expressions, - }, nil -} - -func (p *Parser) parseMultiSelectHash() (ASTNode, error) { - var children []ASTNode - for { - keyToken := p.lookaheadToken(0) - if err := p.match(tUnquotedIdentifier); err != nil { - if err := p.match(tQuotedIdentifier); err != nil { - return ASTNode{}, p.syntaxError("Expected tQuotedIdentifier or tUnquotedIdentifier") - } - } - keyName := keyToken.value - err := p.match(tColon) - if err != nil { - return ASTNode{}, err - } - value, err := p.parseExpression(0) - if err != nil { - return ASTNode{}, err - } - node := ASTNode{ - nodeType: ASTKeyValPair, - value: keyName, - children: []ASTNode{value}, - } - children = append(children, node) - if p.current() == tComma { - err := p.match(tComma) - if err != nil { - return ASTNode{}, nil - } - } else if p.current() == tRbrace { - err := p.match(tRbrace) - if err != nil { - return ASTNode{}, nil - } - break - } - } - return ASTNode{ - nodeType: ASTMultiSelectHash, - children: children, - }, nil -} - -func (p *Parser) projectIfSlice(left ASTNode, right ASTNode) (ASTNode, error) { - indexExpr := ASTNode{ - nodeType: ASTIndexExpression, - children: []ASTNode{left, right}, - } - if right.nodeType == ASTSlice { - right, err := p.parseProjectionRHS(bindingPowers[tStar]) - return ASTNode{ - nodeType: ASTProjection, - children: []ASTNode{indexExpr, right}, - }, err - } - return indexExpr, nil -} -func (p *Parser) parseFilter(node ASTNode) (ASTNode, error) { - var right, condition ASTNode - var err error - condition, err = p.parseExpression(0) - if err != nil { - return ASTNode{}, err - } - if err := p.match(tRbracket); err != nil { - return ASTNode{}, err - } - if p.current() == tFlatten { - right = ASTNode{nodeType: ASTIdentity} - } else { - right, err = p.parseProjectionRHS(bindingPowers[tFilter]) - if err != nil { - return ASTNode{}, err - } - } - - return ASTNode{ - nodeType: ASTFilterProjection, - children: []ASTNode{node, right, condition}, - }, nil -} - -func (p *Parser) parseDotRHS(bindingPower int) (ASTNode, error) { - lookahead := p.current() - if tokensOneOf([]tokType{tQuotedIdentifier, tUnquotedIdentifier, tStar}, lookahead) { - return p.parseExpression(bindingPower) - } else if lookahead == tLbracket { - if err := p.match(tLbracket); err != nil { - return ASTNode{}, err - } - return p.parseMultiSelectList() - } else if lookahead == tLbrace { - if err := p.match(tLbrace); err != nil { - return ASTNode{}, err - } - return p.parseMultiSelectHash() - } - return ASTNode{}, p.syntaxError("Expected identifier, lbracket, or lbrace") -} - -func (p *Parser) parseProjectionRHS(bindingPower int) (ASTNode, error) { - current := p.current() - if bindingPowers[current] < 10 { - return ASTNode{nodeType: ASTIdentity}, nil - } else if current == tLbracket { - return p.parseExpression(bindingPower) - } else if current == tFilter { - return p.parseExpression(bindingPower) - } else if current == tDot { - err := p.match(tDot) - if err != nil { - return ASTNode{}, err - } - return p.parseDotRHS(bindingPower) - } else { - return ASTNode{}, p.syntaxError("Error") - } -} - -func (p *Parser) lookahead(number int) tokType { - return p.lookaheadToken(number).tokenType -} - -func (p *Parser) current() tokType { - return p.lookahead(0) -} - -func (p *Parser) lookaheadToken(number int) token { - return p.tokens[p.index+number] -} - -func (p *Parser) advance() { - p.index++ -} - -func tokensOneOf(elements []tokType, token tokType) bool { - for _, elem := range elements { - if elem == token { - return true - } - } - return false -} - -func (p *Parser) syntaxError(msg string) SyntaxError { - return SyntaxError{ - msg: msg, - Expression: p.expression, - Offset: p.lookaheadToken(0).position, - } -} - -// Create a SyntaxError based on the provided token. -// This differs from syntaxError() which creates a SyntaxError -// based on the current lookahead token. -func (p *Parser) syntaxErrorToken(msg string, t token) SyntaxError { - return SyntaxError{ - msg: msg, - Expression: p.expression, - Offset: t.position, - } -} diff --git a/vendor/github.com/jmespath/go-jmespath/toktype_string.go b/vendor/github.com/jmespath/go-jmespath/toktype_string.go deleted file mode 100644 index dae79cbdf..000000000 --- a/vendor/github.com/jmespath/go-jmespath/toktype_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// generated by stringer -type=tokType; DO NOT EDIT - -package jmespath - -import "fmt" - -const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" - -var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} - -func (i tokType) String() string { - if i < 0 || i >= tokType(len(_tokType_index)-1) { - return fmt.Sprintf("tokType(%d)", i) - } - return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] -} diff --git a/vendor/github.com/jmespath/go-jmespath/util.go b/vendor/github.com/jmespath/go-jmespath/util.go deleted file mode 100644 index ddc1b7d7d..000000000 --- a/vendor/github.com/jmespath/go-jmespath/util.go +++ /dev/null @@ -1,185 +0,0 @@ -package jmespath - -import ( - "errors" - "reflect" -) - -// IsFalse determines if an object is false based on the JMESPath spec. -// JMESPath defines false values to be any of: -// - An empty string array, or hash. -// - The boolean value false. -// - nil -func isFalse(value interface{}) bool { - switch v := value.(type) { - case bool: - return !v - case []interface{}: - return len(v) == 0 - case map[string]interface{}: - return len(v) == 0 - case string: - return len(v) == 0 - case nil: - return true - } - // Try the reflection cases before returning false. - rv := reflect.ValueOf(value) - switch rv.Kind() { - case reflect.Struct: - // A struct type will never be false, even if - // all of its values are the zero type. - return false - case reflect.Slice, reflect.Map: - return rv.Len() == 0 - case reflect.Ptr: - if rv.IsNil() { - return true - } - // If it's a pointer type, we'll try to deref the pointer - // and evaluate the pointer value for isFalse. - element := rv.Elem() - return isFalse(element.Interface()) - } - return false -} - -// ObjsEqual is a generic object equality check. -// It will take two arbitrary objects and recursively determine -// if they are equal. -func objsEqual(left interface{}, right interface{}) bool { - return reflect.DeepEqual(left, right) -} - -// SliceParam refers to a single part of a slice. -// A slice consists of a start, a stop, and a step, similar to -// python slices. -type sliceParam struct { - N int - Specified bool -} - -// Slice supports [start:stop:step] style slicing that's supported in JMESPath. -func slice(slice []interface{}, parts []sliceParam) ([]interface{}, error) { - computed, err := computeSliceParams(len(slice), parts) - if err != nil { - return nil, err - } - start, stop, step := computed[0], computed[1], computed[2] - result := []interface{}{} - if step > 0 { - for i := start; i < stop; i += step { - result = append(result, slice[i]) - } - } else { - for i := start; i > stop; i += step { - result = append(result, slice[i]) - } - } - return result, nil -} - -func computeSliceParams(length int, parts []sliceParam) ([]int, error) { - var start, stop, step int - if !parts[2].Specified { - step = 1 - } else if parts[2].N == 0 { - return nil, errors.New("Invalid slice, step cannot be 0") - } else { - step = parts[2].N - } - var stepValueNegative bool - if step < 0 { - stepValueNegative = true - } else { - stepValueNegative = false - } - - if !parts[0].Specified { - if stepValueNegative { - start = length - 1 - } else { - start = 0 - } - } else { - start = capSlice(length, parts[0].N, step) - } - - if !parts[1].Specified { - if stepValueNegative { - stop = -1 - } else { - stop = length - } - } else { - stop = capSlice(length, parts[1].N, step) - } - return []int{start, stop, step}, nil -} - -func capSlice(length int, actual int, step int) int { - if actual < 0 { - actual += length - if actual < 0 { - if step < 0 { - actual = -1 - } else { - actual = 0 - } - } - } else if actual >= length { - if step < 0 { - actual = length - 1 - } else { - actual = length - } - } - return actual -} - -// ToArrayNum converts an empty interface type to a slice of float64. -// If any element in the array cannot be converted, then nil is returned -// along with a second value of false. -func toArrayNum(data interface{}) ([]float64, bool) { - // Is there a better way to do this with reflect? - if d, ok := data.([]interface{}); ok { - result := make([]float64, len(d)) - for i, el := range d { - item, ok := el.(float64) - if !ok { - return nil, false - } - result[i] = item - } - return result, true - } - return nil, false -} - -// ToArrayStr converts an empty interface type to a slice of strings. -// If any element in the array cannot be converted, then nil is returned -// along with a second value of false. If the input data could be entirely -// converted, then the converted data, along with a second value of true, -// will be returned. -func toArrayStr(data interface{}) ([]string, bool) { - // Is there a better way to do this with reflect? - if d, ok := data.([]interface{}); ok { - result := make([]string, len(d)) - for i, el := range d { - item, ok := el.(string) - if !ok { - return nil, false - } - result[i] = item - } - return result, true - } - return nil, false -} - -func isSliceType(v interface{}) bool { - if v == nil { - return false - } - return reflect.TypeOf(v).Kind() == reflect.Slice -} diff --git a/vendor/github.com/json-iterator/go/.codecov.yml b/vendor/github.com/json-iterator/go/.codecov.yml deleted file mode 100644 index 955dc0be5..000000000 --- a/vendor/github.com/json-iterator/go/.codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -ignore: - - "output_tests/.*" - diff --git a/vendor/github.com/json-iterator/go/.gitignore b/vendor/github.com/json-iterator/go/.gitignore deleted file mode 100644 index 15556530a..000000000 --- a/vendor/github.com/json-iterator/go/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/vendor -/bug_test.go -/coverage.txt -/.idea diff --git a/vendor/github.com/json-iterator/go/.travis.yml b/vendor/github.com/json-iterator/go/.travis.yml deleted file mode 100644 index 449e67cd0..000000000 --- a/vendor/github.com/json-iterator/go/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go - -go: - - 1.8.x - - 1.x - -before_install: - - go get -t -v ./... - -script: - - ./test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock deleted file mode 100644 index c8a9fbb38..000000000 --- a/vendor/github.com/json-iterator/go/Gopkg.lock +++ /dev/null @@ -1,21 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/modern-go/concurrent" - packages = ["."] - revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a" - version = "1.0.0" - -[[projects]] - name = "github.com/modern-go/reflect2" - packages = ["."] - revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" - version = "1.0.1" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "ea54a775e5a354cb015502d2e7aa4b74230fc77e894f34a838b268c25ec8eeb8" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/json-iterator/go/Gopkg.toml b/vendor/github.com/json-iterator/go/Gopkg.toml deleted file mode 100644 index 313a0f887..000000000 --- a/vendor/github.com/json-iterator/go/Gopkg.toml +++ /dev/null @@ -1,26 +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/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"] - -[[constraint]] - name = "github.com/modern-go/reflect2" - version = "1.0.1" diff --git a/vendor/github.com/json-iterator/go/LICENSE b/vendor/github.com/json-iterator/go/LICENSE deleted file mode 100644 index 2cf4f5ab2..000000000 --- a/vendor/github.com/json-iterator/go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 json-iterator - -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/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md deleted file mode 100644 index 52b111d5f..000000000 --- a/vendor/github.com/json-iterator/go/README.md +++ /dev/null @@ -1,87 +0,0 @@ -[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge) -[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go) -[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go) -[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go) -[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go) -[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE) -[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) - -A high-performance 100% compatible drop-in replacement of "encoding/json" - -You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go) - -# Benchmark - -![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png) - -Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go - -Raw Result (easyjson requires static code generation) - -| | ns/op | allocation bytes | allocation times | -| --------------- | ----------- | ---------------- | ---------------- | -| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op | -| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op | -| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op | -| std encode | 2213 ns/op | 712 B/op | 5 allocs/op | -| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op | -| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op | - -Always benchmark with your own workload. -The result depends heavily on the data input. - -# Usage - -100% compatibility with standard lib - -Replace - -```go -import "encoding/json" -json.Marshal(&data) -``` - -with - -```go -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary -json.Marshal(&data) -``` - -Replace - -```go -import "encoding/json" -json.Unmarshal(input, &data) -``` - -with - -```go -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary -json.Unmarshal(input, &data) -``` - -[More documentation](http://jsoniter.com/migrate-from-go-std.html) - -# How to get - -``` -go get github.com/json-iterator/go -``` - -# Contribution Welcomed ! - -Contributors - -- [thockin](https://github.com/thockin) -- [mattn](https://github.com/mattn) -- [cch123](https://github.com/cch123) -- [Oleg Shaldybin](https://github.com/olegshaldybin) -- [Jason Toffaletti](https://github.com/toffaletti) - -Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) diff --git a/vendor/github.com/json-iterator/go/adapter.go b/vendor/github.com/json-iterator/go/adapter.go deleted file mode 100644 index 92d2cc4a3..000000000 --- a/vendor/github.com/json-iterator/go/adapter.go +++ /dev/null @@ -1,150 +0,0 @@ -package jsoniter - -import ( - "bytes" - "io" -) - -// RawMessage to make replace json with jsoniter -type RawMessage []byte - -// Unmarshal adapts to json/encoding Unmarshal API -// -// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. -// Refer to https://godoc.org/encoding/json#Unmarshal for more information -func Unmarshal(data []byte, v interface{}) error { - return ConfigDefault.Unmarshal(data, v) -} - -// UnmarshalFromString is a convenient method to read from string instead of []byte -func UnmarshalFromString(str string, v interface{}) error { - return ConfigDefault.UnmarshalFromString(str, v) -} - -// Get quick method to get value from deeply nested JSON structure -func Get(data []byte, path ...interface{}) Any { - return ConfigDefault.Get(data, path...) -} - -// Marshal adapts to json/encoding Marshal API -// -// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API -// Refer to https://godoc.org/encoding/json#Marshal for more information -func Marshal(v interface{}) ([]byte, error) { - return ConfigDefault.Marshal(v) -} - -// MarshalIndent same as json.MarshalIndent. Prefix is not supported. -func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - return ConfigDefault.MarshalIndent(v, prefix, indent) -} - -// MarshalToString convenient method to write as string instead of []byte -func MarshalToString(v interface{}) (string, error) { - return ConfigDefault.MarshalToString(v) -} - -// NewDecoder adapts to json/stream NewDecoder API. -// -// NewDecoder returns a new decoder that reads from r. -// -// Instead of a json/encoding Decoder, an Decoder is returned -// Refer to https://godoc.org/encoding/json#NewDecoder for more information -func NewDecoder(reader io.Reader) *Decoder { - return ConfigDefault.NewDecoder(reader) -} - -// Decoder reads and decodes JSON values from an input stream. -// Decoder provides identical APIs with json/stream Decoder (Token() and UseNumber() are in progress) -type Decoder struct { - iter *Iterator -} - -// Decode decode JSON into interface{} -func (adapter *Decoder) Decode(obj interface{}) error { - if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil { - if !adapter.iter.loadMore() { - return io.EOF - } - } - adapter.iter.ReadVal(obj) - err := adapter.iter.Error - if err == io.EOF { - return nil - } - return adapter.iter.Error -} - -// More is there more? -func (adapter *Decoder) More() bool { - iter := adapter.iter - if iter.Error != nil { - return false - } - c := iter.nextToken() - if c == 0 { - return false - } - iter.unreadByte() - return c != ']' && c != '}' -} - -// Buffered remaining buffer -func (adapter *Decoder) Buffered() io.Reader { - remaining := adapter.iter.buf[adapter.iter.head:adapter.iter.tail] - return bytes.NewReader(remaining) -} - -// UseNumber causes the Decoder to unmarshal a number into an interface{} as a -// Number instead of as a float64. -func (adapter *Decoder) UseNumber() { - cfg := adapter.iter.cfg.configBeforeFrozen - cfg.UseNumber = true - adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) -} - -// DisallowUnknownFields causes the Decoder to return an error when the destination -// is a struct and the input contains object keys which do not match any -// non-ignored, exported fields in the destination. -func (adapter *Decoder) DisallowUnknownFields() { - cfg := adapter.iter.cfg.configBeforeFrozen - cfg.DisallowUnknownFields = true - adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) -} - -// NewEncoder same as json.NewEncoder -func NewEncoder(writer io.Writer) *Encoder { - return ConfigDefault.NewEncoder(writer) -} - -// Encoder same as json.Encoder -type Encoder struct { - stream *Stream -} - -// Encode encode interface{} as JSON to io.Writer -func (adapter *Encoder) Encode(val interface{}) error { - adapter.stream.WriteVal(val) - adapter.stream.WriteRaw("\n") - adapter.stream.Flush() - return adapter.stream.Error -} - -// SetIndent set the indention. Prefix is not supported -func (adapter *Encoder) SetIndent(prefix, indent string) { - config := adapter.stream.cfg.configBeforeFrozen - config.IndentionStep = len(indent) - adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) -} - -// SetEscapeHTML escape html by default, set to false to disable -func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) { - config := adapter.stream.cfg.configBeforeFrozen - config.EscapeHTML = escapeHTML - adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) -} - -// Valid reports whether data is a valid JSON encoding. -func Valid(data []byte) bool { - return ConfigDefault.Valid(data) -} diff --git a/vendor/github.com/json-iterator/go/any.go b/vendor/github.com/json-iterator/go/any.go deleted file mode 100644 index f6b8aeab0..000000000 --- a/vendor/github.com/json-iterator/go/any.go +++ /dev/null @@ -1,325 +0,0 @@ -package jsoniter - -import ( - "errors" - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "strconv" - "unsafe" -) - -// Any generic object representation. -// The lazy json implementation holds []byte and parse lazily. -type Any interface { - LastError() error - ValueType() ValueType - MustBeValid() Any - ToBool() bool - ToInt() int - ToInt32() int32 - ToInt64() int64 - ToUint() uint - ToUint32() uint32 - ToUint64() uint64 - ToFloat32() float32 - ToFloat64() float64 - ToString() string - ToVal(val interface{}) - Get(path ...interface{}) Any - Size() int - Keys() []string - GetInterface() interface{} - WriteTo(stream *Stream) -} - -type baseAny struct{} - -func (any *baseAny) Get(path ...interface{}) Any { - return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} -} - -func (any *baseAny) Size() int { - return 0 -} - -func (any *baseAny) Keys() []string { - return []string{} -} - -func (any *baseAny) ToVal(obj interface{}) { - panic("not implemented") -} - -// WrapInt32 turn int32 into Any interface -func WrapInt32(val int32) Any { - return &int32Any{baseAny{}, val} -} - -// WrapInt64 turn int64 into Any interface -func WrapInt64(val int64) Any { - return &int64Any{baseAny{}, val} -} - -// WrapUint32 turn uint32 into Any interface -func WrapUint32(val uint32) Any { - return &uint32Any{baseAny{}, val} -} - -// WrapUint64 turn uint64 into Any interface -func WrapUint64(val uint64) Any { - return &uint64Any{baseAny{}, val} -} - -// WrapFloat64 turn float64 into Any interface -func WrapFloat64(val float64) Any { - return &floatAny{baseAny{}, val} -} - -// WrapString turn string into Any interface -func WrapString(val string) Any { - return &stringAny{baseAny{}, val} -} - -// Wrap turn a go object into Any interface -func Wrap(val interface{}) Any { - if val == nil { - return &nilAny{} - } - asAny, isAny := val.(Any) - if isAny { - return asAny - } - typ := reflect2.TypeOf(val) - switch typ.Kind() { - case reflect.Slice: - return wrapArray(val) - case reflect.Struct: - return wrapStruct(val) - case reflect.Map: - return wrapMap(val) - case reflect.String: - return WrapString(val.(string)) - case reflect.Int: - if strconv.IntSize == 32 { - return WrapInt32(int32(val.(int))) - } - return WrapInt64(int64(val.(int))) - case reflect.Int8: - return WrapInt32(int32(val.(int8))) - case reflect.Int16: - return WrapInt32(int32(val.(int16))) - case reflect.Int32: - return WrapInt32(val.(int32)) - case reflect.Int64: - return WrapInt64(val.(int64)) - case reflect.Uint: - if strconv.IntSize == 32 { - return WrapUint32(uint32(val.(uint))) - } - return WrapUint64(uint64(val.(uint))) - case reflect.Uintptr: - if ptrSize == 32 { - return WrapUint32(uint32(val.(uintptr))) - } - return WrapUint64(uint64(val.(uintptr))) - case reflect.Uint8: - return WrapUint32(uint32(val.(uint8))) - case reflect.Uint16: - return WrapUint32(uint32(val.(uint16))) - case reflect.Uint32: - return WrapUint32(uint32(val.(uint32))) - case reflect.Uint64: - return WrapUint64(val.(uint64)) - case reflect.Float32: - return WrapFloat64(float64(val.(float32))) - case reflect.Float64: - return WrapFloat64(val.(float64)) - case reflect.Bool: - if val.(bool) == true { - return &trueAny{} - } - return &falseAny{} - } - return &invalidAny{baseAny{}, fmt.Errorf("unsupported type: %v", typ)} -} - -// ReadAny read next JSON element as an Any object. It is a better json.RawMessage. -func (iter *Iterator) ReadAny() Any { - return iter.readAny() -} - -func (iter *Iterator) readAny() Any { - c := iter.nextToken() - switch c { - case '"': - iter.unreadByte() - return &stringAny{baseAny{}, iter.ReadString()} - case 'n': - iter.skipThreeBytes('u', 'l', 'l') // null - return &nilAny{} - case 't': - iter.skipThreeBytes('r', 'u', 'e') // true - return &trueAny{} - case 'f': - iter.skipFourBytes('a', 'l', 's', 'e') // false - return &falseAny{} - case '{': - return iter.readObjectAny() - case '[': - return iter.readArrayAny() - case '-': - return iter.readNumberAny(false) - case 0: - return &invalidAny{baseAny{}, errors.New("input is empty")} - default: - return iter.readNumberAny(true) - } -} - -func (iter *Iterator) readNumberAny(positive bool) Any { - iter.startCapture(iter.head - 1) - iter.skipNumber() - lazyBuf := iter.stopCapture() - return &numberLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func (iter *Iterator) readObjectAny() Any { - iter.startCapture(iter.head - 1) - iter.skipObject() - lazyBuf := iter.stopCapture() - return &objectLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func (iter *Iterator) readArrayAny() Any { - iter.startCapture(iter.head - 1) - iter.skipArray() - lazyBuf := iter.stopCapture() - return &arrayLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func locateObjectField(iter *Iterator, target string) []byte { - var found []byte - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - if field == target { - found = iter.SkipAndReturnBytes() - return false - } - iter.Skip() - return true - }) - return found -} - -func locateArrayElement(iter *Iterator, target int) []byte { - var found []byte - n := 0 - iter.ReadArrayCB(func(iter *Iterator) bool { - if n == target { - found = iter.SkipAndReturnBytes() - return false - } - iter.Skip() - n++ - return true - }) - return found -} - -func locatePath(iter *Iterator, path []interface{}) Any { - for i, pathKeyObj := range path { - switch pathKey := pathKeyObj.(type) { - case string: - valueBytes := locateObjectField(iter, pathKey) - if valueBytes == nil { - return newInvalidAny(path[i:]) - } - iter.ResetBytes(valueBytes) - case int: - valueBytes := locateArrayElement(iter, pathKey) - if valueBytes == nil { - return newInvalidAny(path[i:]) - } - iter.ResetBytes(valueBytes) - case int32: - if '*' == pathKey { - return iter.readAny().Get(path[i:]...) - } - return newInvalidAny(path[i:]) - default: - return newInvalidAny(path[i:]) - } - } - if iter.Error != nil && iter.Error != io.EOF { - return &invalidAny{baseAny{}, iter.Error} - } - return iter.readAny() -} - -var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem() - -func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ == anyType { - return &directAnyCodec{} - } - if typ.Implements(anyType) { - return &anyCodec{ - valType: typ, - } - } - return nil -} - -func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == anyType { - return &directAnyCodec{} - } - if typ.Implements(anyType) { - return &anyCodec{ - valType: typ, - } - } - return nil -} - -type anyCodec struct { - valType reflect2.Type -} - -func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - panic("not implemented") -} - -func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := codec.valType.UnsafeIndirect(ptr) - any := obj.(Any) - any.WriteTo(stream) -} - -func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { - obj := codec.valType.UnsafeIndirect(ptr) - any := obj.(Any) - return any.Size() == 0 -} - -type directAnyCodec struct { -} - -func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *(*Any)(ptr) = iter.readAny() -} - -func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - any := *(*Any)(ptr) - if any == nil { - stream.WriteNil() - return - } - any.WriteTo(stream) -} - -func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool { - any := *(*Any)(ptr) - return any.Size() == 0 -} diff --git a/vendor/github.com/json-iterator/go/any_array.go b/vendor/github.com/json-iterator/go/any_array.go deleted file mode 100644 index 0449e9aa4..000000000 --- a/vendor/github.com/json-iterator/go/any_array.go +++ /dev/null @@ -1,278 +0,0 @@ -package jsoniter - -import ( - "reflect" - "unsafe" -) - -type arrayLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *arrayLazyAny) ValueType() ValueType { - return ArrayValue -} - -func (any *arrayLazyAny) MustBeValid() Any { - return any -} - -func (any *arrayLazyAny) LastError() error { - return any.err -} - -func (any *arrayLazyAny) ToBool() bool { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.ReadArray() -} - -func (any *arrayLazyAny) ToInt() int { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToInt32() int32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToInt64() int64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint() uint { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint32() uint32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint64() uint64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToFloat32() float32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToFloat64() float64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *arrayLazyAny) ToVal(val interface{}) { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadVal(val) -} - -func (any *arrayLazyAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int: - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - valueBytes := locateArrayElement(iter, firstPath) - if valueBytes == nil { - return newInvalidAny(path) - } - iter.ResetBytes(valueBytes) - return locatePath(iter, path[1:]) - case int32: - if '*' == firstPath { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - arr := make([]Any, 0) - iter.ReadArrayCB(func(iter *Iterator) bool { - found := iter.readAny().Get(path[1:]...) - if found.ValueType() != InvalidValue { - arr = append(arr, found) - } - return true - }) - return wrapArray(arr) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *arrayLazyAny) Size() int { - size := 0 - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadArrayCB(func(iter *Iterator) bool { - size++ - iter.Skip() - return true - }) - return size -} - -func (any *arrayLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *arrayLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} - -type arrayAny struct { - baseAny - val reflect.Value -} - -func wrapArray(val interface{}) *arrayAny { - return &arrayAny{baseAny{}, reflect.ValueOf(val)} -} - -func (any *arrayAny) ValueType() ValueType { - return ArrayValue -} - -func (any *arrayAny) MustBeValid() Any { - return any -} - -func (any *arrayAny) LastError() error { - return nil -} - -func (any *arrayAny) ToBool() bool { - return any.val.Len() != 0 -} - -func (any *arrayAny) ToInt() int { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToInt32() int32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToInt64() int64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint() uint { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint32() uint32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint64() uint64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToFloat32() float32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToFloat64() float64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToString() string { - str, _ := MarshalToString(any.val.Interface()) - return str -} - -func (any *arrayAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int: - if firstPath < 0 || firstPath >= any.val.Len() { - return newInvalidAny(path) - } - return Wrap(any.val.Index(firstPath).Interface()) - case int32: - if '*' == firstPath { - mappedAll := make([]Any, 0) - for i := 0; i < any.val.Len(); i++ { - mapped := Wrap(any.val.Index(i).Interface()).Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll = append(mappedAll, mapped) - } - } - return wrapArray(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *arrayAny) Size() int { - return any.val.Len() -} - -func (any *arrayAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *arrayAny) GetInterface() interface{} { - return any.val.Interface() -} diff --git a/vendor/github.com/json-iterator/go/any_bool.go b/vendor/github.com/json-iterator/go/any_bool.go deleted file mode 100644 index 9452324af..000000000 --- a/vendor/github.com/json-iterator/go/any_bool.go +++ /dev/null @@ -1,137 +0,0 @@ -package jsoniter - -type trueAny struct { - baseAny -} - -func (any *trueAny) LastError() error { - return nil -} - -func (any *trueAny) ToBool() bool { - return true -} - -func (any *trueAny) ToInt() int { - return 1 -} - -func (any *trueAny) ToInt32() int32 { - return 1 -} - -func (any *trueAny) ToInt64() int64 { - return 1 -} - -func (any *trueAny) ToUint() uint { - return 1 -} - -func (any *trueAny) ToUint32() uint32 { - return 1 -} - -func (any *trueAny) ToUint64() uint64 { - return 1 -} - -func (any *trueAny) ToFloat32() float32 { - return 1 -} - -func (any *trueAny) ToFloat64() float64 { - return 1 -} - -func (any *trueAny) ToString() string { - return "true" -} - -func (any *trueAny) WriteTo(stream *Stream) { - stream.WriteTrue() -} - -func (any *trueAny) Parse() *Iterator { - return nil -} - -func (any *trueAny) GetInterface() interface{} { - return true -} - -func (any *trueAny) ValueType() ValueType { - return BoolValue -} - -func (any *trueAny) MustBeValid() Any { - return any -} - -type falseAny struct { - baseAny -} - -func (any *falseAny) LastError() error { - return nil -} - -func (any *falseAny) ToBool() bool { - return false -} - -func (any *falseAny) ToInt() int { - return 0 -} - -func (any *falseAny) ToInt32() int32 { - return 0 -} - -func (any *falseAny) ToInt64() int64 { - return 0 -} - -func (any *falseAny) ToUint() uint { - return 0 -} - -func (any *falseAny) ToUint32() uint32 { - return 0 -} - -func (any *falseAny) ToUint64() uint64 { - return 0 -} - -func (any *falseAny) ToFloat32() float32 { - return 0 -} - -func (any *falseAny) ToFloat64() float64 { - return 0 -} - -func (any *falseAny) ToString() string { - return "false" -} - -func (any *falseAny) WriteTo(stream *Stream) { - stream.WriteFalse() -} - -func (any *falseAny) Parse() *Iterator { - return nil -} - -func (any *falseAny) GetInterface() interface{} { - return false -} - -func (any *falseAny) ValueType() ValueType { - return BoolValue -} - -func (any *falseAny) MustBeValid() Any { - return any -} diff --git a/vendor/github.com/json-iterator/go/any_float.go b/vendor/github.com/json-iterator/go/any_float.go deleted file mode 100644 index 35fdb0949..000000000 --- a/vendor/github.com/json-iterator/go/any_float.go +++ /dev/null @@ -1,83 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type floatAny struct { - baseAny - val float64 -} - -func (any *floatAny) Parse() *Iterator { - return nil -} - -func (any *floatAny) ValueType() ValueType { - return NumberValue -} - -func (any *floatAny) MustBeValid() Any { - return any -} - -func (any *floatAny) LastError() error { - return nil -} - -func (any *floatAny) ToBool() bool { - return any.ToFloat64() != 0 -} - -func (any *floatAny) ToInt() int { - return int(any.val) -} - -func (any *floatAny) ToInt32() int32 { - return int32(any.val) -} - -func (any *floatAny) ToInt64() int64 { - return int64(any.val) -} - -func (any *floatAny) ToUint() uint { - if any.val > 0 { - return uint(any.val) - } - return 0 -} - -func (any *floatAny) ToUint32() uint32 { - if any.val > 0 { - return uint32(any.val) - } - return 0 -} - -func (any *floatAny) ToUint64() uint64 { - if any.val > 0 { - return uint64(any.val) - } - return 0 -} - -func (any *floatAny) ToFloat32() float32 { - return float32(any.val) -} - -func (any *floatAny) ToFloat64() float64 { - return any.val -} - -func (any *floatAny) ToString() string { - return strconv.FormatFloat(any.val, 'E', -1, 64) -} - -func (any *floatAny) WriteTo(stream *Stream) { - stream.WriteFloat64(any.val) -} - -func (any *floatAny) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_int32.go b/vendor/github.com/json-iterator/go/any_int32.go deleted file mode 100644 index 1b56f3991..000000000 --- a/vendor/github.com/json-iterator/go/any_int32.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type int32Any struct { - baseAny - val int32 -} - -func (any *int32Any) LastError() error { - return nil -} - -func (any *int32Any) ValueType() ValueType { - return NumberValue -} - -func (any *int32Any) MustBeValid() Any { - return any -} - -func (any *int32Any) ToBool() bool { - return any.val != 0 -} - -func (any *int32Any) ToInt() int { - return int(any.val) -} - -func (any *int32Any) ToInt32() int32 { - return any.val -} - -func (any *int32Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *int32Any) ToUint() uint { - return uint(any.val) -} - -func (any *int32Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *int32Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *int32Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *int32Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *int32Any) ToString() string { - return strconv.FormatInt(int64(any.val), 10) -} - -func (any *int32Any) WriteTo(stream *Stream) { - stream.WriteInt32(any.val) -} - -func (any *int32Any) Parse() *Iterator { - return nil -} - -func (any *int32Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_int64.go b/vendor/github.com/json-iterator/go/any_int64.go deleted file mode 100644 index c440d72b6..000000000 --- a/vendor/github.com/json-iterator/go/any_int64.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type int64Any struct { - baseAny - val int64 -} - -func (any *int64Any) LastError() error { - return nil -} - -func (any *int64Any) ValueType() ValueType { - return NumberValue -} - -func (any *int64Any) MustBeValid() Any { - return any -} - -func (any *int64Any) ToBool() bool { - return any.val != 0 -} - -func (any *int64Any) ToInt() int { - return int(any.val) -} - -func (any *int64Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *int64Any) ToInt64() int64 { - return any.val -} - -func (any *int64Any) ToUint() uint { - return uint(any.val) -} - -func (any *int64Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *int64Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *int64Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *int64Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *int64Any) ToString() string { - return strconv.FormatInt(any.val, 10) -} - -func (any *int64Any) WriteTo(stream *Stream) { - stream.WriteInt64(any.val) -} - -func (any *int64Any) Parse() *Iterator { - return nil -} - -func (any *int64Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_invalid.go b/vendor/github.com/json-iterator/go/any_invalid.go deleted file mode 100644 index 1d859eac3..000000000 --- a/vendor/github.com/json-iterator/go/any_invalid.go +++ /dev/null @@ -1,82 +0,0 @@ -package jsoniter - -import "fmt" - -type invalidAny struct { - baseAny - err error -} - -func newInvalidAny(path []interface{}) *invalidAny { - return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)} -} - -func (any *invalidAny) LastError() error { - return any.err -} - -func (any *invalidAny) ValueType() ValueType { - return InvalidValue -} - -func (any *invalidAny) MustBeValid() Any { - panic(any.err) -} - -func (any *invalidAny) ToBool() bool { - return false -} - -func (any *invalidAny) ToInt() int { - return 0 -} - -func (any *invalidAny) ToInt32() int32 { - return 0 -} - -func (any *invalidAny) ToInt64() int64 { - return 0 -} - -func (any *invalidAny) ToUint() uint { - return 0 -} - -func (any *invalidAny) ToUint32() uint32 { - return 0 -} - -func (any *invalidAny) ToUint64() uint64 { - return 0 -} - -func (any *invalidAny) ToFloat32() float32 { - return 0 -} - -func (any *invalidAny) ToFloat64() float64 { - return 0 -} - -func (any *invalidAny) ToString() string { - return "" -} - -func (any *invalidAny) WriteTo(stream *Stream) { -} - -func (any *invalidAny) Get(path ...interface{}) Any { - if any.err == nil { - return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)} - } - return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)} -} - -func (any *invalidAny) Parse() *Iterator { - return nil -} - -func (any *invalidAny) GetInterface() interface{} { - return nil -} diff --git a/vendor/github.com/json-iterator/go/any_nil.go b/vendor/github.com/json-iterator/go/any_nil.go deleted file mode 100644 index d04cb54c1..000000000 --- a/vendor/github.com/json-iterator/go/any_nil.go +++ /dev/null @@ -1,69 +0,0 @@ -package jsoniter - -type nilAny struct { - baseAny -} - -func (any *nilAny) LastError() error { - return nil -} - -func (any *nilAny) ValueType() ValueType { - return NilValue -} - -func (any *nilAny) MustBeValid() Any { - return any -} - -func (any *nilAny) ToBool() bool { - return false -} - -func (any *nilAny) ToInt() int { - return 0 -} - -func (any *nilAny) ToInt32() int32 { - return 0 -} - -func (any *nilAny) ToInt64() int64 { - return 0 -} - -func (any *nilAny) ToUint() uint { - return 0 -} - -func (any *nilAny) ToUint32() uint32 { - return 0 -} - -func (any *nilAny) ToUint64() uint64 { - return 0 -} - -func (any *nilAny) ToFloat32() float32 { - return 0 -} - -func (any *nilAny) ToFloat64() float64 { - return 0 -} - -func (any *nilAny) ToString() string { - return "" -} - -func (any *nilAny) WriteTo(stream *Stream) { - stream.WriteNil() -} - -func (any *nilAny) Parse() *Iterator { - return nil -} - -func (any *nilAny) GetInterface() interface{} { - return nil -} diff --git a/vendor/github.com/json-iterator/go/any_number.go b/vendor/github.com/json-iterator/go/any_number.go deleted file mode 100644 index 9d1e901a6..000000000 --- a/vendor/github.com/json-iterator/go/any_number.go +++ /dev/null @@ -1,123 +0,0 @@ -package jsoniter - -import ( - "io" - "unsafe" -) - -type numberLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *numberLazyAny) ValueType() ValueType { - return NumberValue -} - -func (any *numberLazyAny) MustBeValid() Any { - return any -} - -func (any *numberLazyAny) LastError() error { - return any.err -} - -func (any *numberLazyAny) ToBool() bool { - return any.ToFloat64() != 0 -} - -func (any *numberLazyAny) ToInt() int { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToInt32() int32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToInt64() int64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint() uint { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint32() uint32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint64() uint64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToFloat32() float32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadFloat32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToFloat64() float64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadFloat64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *numberLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *numberLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} diff --git a/vendor/github.com/json-iterator/go/any_object.go b/vendor/github.com/json-iterator/go/any_object.go deleted file mode 100644 index c44ef5c98..000000000 --- a/vendor/github.com/json-iterator/go/any_object.go +++ /dev/null @@ -1,374 +0,0 @@ -package jsoniter - -import ( - "reflect" - "unsafe" -) - -type objectLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *objectLazyAny) ValueType() ValueType { - return ObjectValue -} - -func (any *objectLazyAny) MustBeValid() Any { - return any -} - -func (any *objectLazyAny) LastError() error { - return any.err -} - -func (any *objectLazyAny) ToBool() bool { - return true -} - -func (any *objectLazyAny) ToInt() int { - return 0 -} - -func (any *objectLazyAny) ToInt32() int32 { - return 0 -} - -func (any *objectLazyAny) ToInt64() int64 { - return 0 -} - -func (any *objectLazyAny) ToUint() uint { - return 0 -} - -func (any *objectLazyAny) ToUint32() uint32 { - return 0 -} - -func (any *objectLazyAny) ToUint64() uint64 { - return 0 -} - -func (any *objectLazyAny) ToFloat32() float32 { - return 0 -} - -func (any *objectLazyAny) ToFloat64() float64 { - return 0 -} - -func (any *objectLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *objectLazyAny) ToVal(obj interface{}) { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadVal(obj) -} - -func (any *objectLazyAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case string: - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - valueBytes := locateObjectField(iter, firstPath) - if valueBytes == nil { - return newInvalidAny(path) - } - iter.ResetBytes(valueBytes) - return locatePath(iter, path[1:]) - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadMapCB(func(iter *Iterator, field string) bool { - mapped := locatePath(iter, path[1:]) - if mapped.ValueType() != InvalidValue { - mappedAll[field] = mapped - } - return true - }) - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *objectLazyAny) Keys() []string { - keys := []string{} - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadMapCB(func(iter *Iterator, field string) bool { - iter.Skip() - keys = append(keys, field) - return true - }) - return keys -} - -func (any *objectLazyAny) Size() int { - size := 0 - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - iter.Skip() - size++ - return true - }) - return size -} - -func (any *objectLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *objectLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} - -type objectAny struct { - baseAny - err error - val reflect.Value -} - -func wrapStruct(val interface{}) *objectAny { - return &objectAny{baseAny{}, nil, reflect.ValueOf(val)} -} - -func (any *objectAny) ValueType() ValueType { - return ObjectValue -} - -func (any *objectAny) MustBeValid() Any { - return any -} - -func (any *objectAny) Parse() *Iterator { - return nil -} - -func (any *objectAny) LastError() error { - return any.err -} - -func (any *objectAny) ToBool() bool { - return any.val.NumField() != 0 -} - -func (any *objectAny) ToInt() int { - return 0 -} - -func (any *objectAny) ToInt32() int32 { - return 0 -} - -func (any *objectAny) ToInt64() int64 { - return 0 -} - -func (any *objectAny) ToUint() uint { - return 0 -} - -func (any *objectAny) ToUint32() uint32 { - return 0 -} - -func (any *objectAny) ToUint64() uint64 { - return 0 -} - -func (any *objectAny) ToFloat32() float32 { - return 0 -} - -func (any *objectAny) ToFloat64() float64 { - return 0 -} - -func (any *objectAny) ToString() string { - str, err := MarshalToString(any.val.Interface()) - any.err = err - return str -} - -func (any *objectAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case string: - field := any.val.FieldByName(firstPath) - if !field.IsValid() { - return newInvalidAny(path) - } - return Wrap(field.Interface()) - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - for i := 0; i < any.val.NumField(); i++ { - field := any.val.Field(i) - if field.CanInterface() { - mapped := Wrap(field.Interface()).Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll[any.val.Type().Field(i).Name] = mapped - } - } - } - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *objectAny) Keys() []string { - keys := make([]string, 0, any.val.NumField()) - for i := 0; i < any.val.NumField(); i++ { - keys = append(keys, any.val.Type().Field(i).Name) - } - return keys -} - -func (any *objectAny) Size() int { - return any.val.NumField() -} - -func (any *objectAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *objectAny) GetInterface() interface{} { - return any.val.Interface() -} - -type mapAny struct { - baseAny - err error - val reflect.Value -} - -func wrapMap(val interface{}) *mapAny { - return &mapAny{baseAny{}, nil, reflect.ValueOf(val)} -} - -func (any *mapAny) ValueType() ValueType { - return ObjectValue -} - -func (any *mapAny) MustBeValid() Any { - return any -} - -func (any *mapAny) Parse() *Iterator { - return nil -} - -func (any *mapAny) LastError() error { - return any.err -} - -func (any *mapAny) ToBool() bool { - return true -} - -func (any *mapAny) ToInt() int { - return 0 -} - -func (any *mapAny) ToInt32() int32 { - return 0 -} - -func (any *mapAny) ToInt64() int64 { - return 0 -} - -func (any *mapAny) ToUint() uint { - return 0 -} - -func (any *mapAny) ToUint32() uint32 { - return 0 -} - -func (any *mapAny) ToUint64() uint64 { - return 0 -} - -func (any *mapAny) ToFloat32() float32 { - return 0 -} - -func (any *mapAny) ToFloat64() float64 { - return 0 -} - -func (any *mapAny) ToString() string { - str, err := MarshalToString(any.val.Interface()) - any.err = err - return str -} - -func (any *mapAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - for _, key := range any.val.MapKeys() { - keyAsStr := key.String() - element := Wrap(any.val.MapIndex(key).Interface()) - mapped := element.Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll[keyAsStr] = mapped - } - } - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - value := any.val.MapIndex(reflect.ValueOf(firstPath)) - if !value.IsValid() { - return newInvalidAny(path) - } - return Wrap(value.Interface()) - } -} - -func (any *mapAny) Keys() []string { - keys := make([]string, 0, any.val.Len()) - for _, key := range any.val.MapKeys() { - keys = append(keys, key.String()) - } - return keys -} - -func (any *mapAny) Size() int { - return any.val.Len() -} - -func (any *mapAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *mapAny) GetInterface() interface{} { - return any.val.Interface() -} diff --git a/vendor/github.com/json-iterator/go/any_str.go b/vendor/github.com/json-iterator/go/any_str.go deleted file mode 100644 index 1f12f6612..000000000 --- a/vendor/github.com/json-iterator/go/any_str.go +++ /dev/null @@ -1,166 +0,0 @@ -package jsoniter - -import ( - "fmt" - "strconv" -) - -type stringAny struct { - baseAny - val string -} - -func (any *stringAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} -} - -func (any *stringAny) Parse() *Iterator { - return nil -} - -func (any *stringAny) ValueType() ValueType { - return StringValue -} - -func (any *stringAny) MustBeValid() Any { - return any -} - -func (any *stringAny) LastError() error { - return nil -} - -func (any *stringAny) ToBool() bool { - str := any.ToString() - if str == "0" { - return false - } - for _, c := range str { - switch c { - case ' ', '\n', '\r', '\t': - default: - return true - } - } - return false -} - -func (any *stringAny) ToInt() int { - return int(any.ToInt64()) - -} - -func (any *stringAny) ToInt32() int32 { - return int32(any.ToInt64()) -} - -func (any *stringAny) ToInt64() int64 { - if any.val == "" { - return 0 - } - - flag := 1 - startPos := 0 - if any.val[0] == '+' || any.val[0] == '-' { - startPos = 1 - } - - if any.val[0] == '-' { - flag = -1 - } - - endPos := startPos - for i := startPos; i < len(any.val); i++ { - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - break - } - } - parsed, _ := strconv.ParseInt(any.val[startPos:endPos], 10, 64) - return int64(flag) * parsed -} - -func (any *stringAny) ToUint() uint { - return uint(any.ToUint64()) -} - -func (any *stringAny) ToUint32() uint32 { - return uint32(any.ToUint64()) -} - -func (any *stringAny) ToUint64() uint64 { - if any.val == "" { - return 0 - } - - startPos := 0 - - if any.val[0] == '-' { - return 0 - } - if any.val[0] == '+' { - startPos = 1 - } - - endPos := startPos - for i := startPos; i < len(any.val); i++ { - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - break - } - } - parsed, _ := strconv.ParseUint(any.val[startPos:endPos], 10, 64) - return parsed -} - -func (any *stringAny) ToFloat32() float32 { - return float32(any.ToFloat64()) -} - -func (any *stringAny) ToFloat64() float64 { - if len(any.val) == 0 { - return 0 - } - - // first char invalid - if any.val[0] != '+' && any.val[0] != '-' && (any.val[0] > '9' || any.val[0] < '0') { - return 0 - } - - // extract valid num expression from string - // eg 123true => 123, -12.12xxa => -12.12 - endPos := 1 - for i := 1; i < len(any.val); i++ { - if any.val[i] == '.' || any.val[i] == 'e' || any.val[i] == 'E' || any.val[i] == '+' || any.val[i] == '-' { - endPos = i + 1 - continue - } - - // end position is the first char which is not digit - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - endPos = i - break - } - } - parsed, _ := strconv.ParseFloat(any.val[:endPos], 64) - return parsed -} - -func (any *stringAny) ToString() string { - return any.val -} - -func (any *stringAny) WriteTo(stream *Stream) { - stream.WriteString(any.val) -} - -func (any *stringAny) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_uint32.go b/vendor/github.com/json-iterator/go/any_uint32.go deleted file mode 100644 index 656bbd33d..000000000 --- a/vendor/github.com/json-iterator/go/any_uint32.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type uint32Any struct { - baseAny - val uint32 -} - -func (any *uint32Any) LastError() error { - return nil -} - -func (any *uint32Any) ValueType() ValueType { - return NumberValue -} - -func (any *uint32Any) MustBeValid() Any { - return any -} - -func (any *uint32Any) ToBool() bool { - return any.val != 0 -} - -func (any *uint32Any) ToInt() int { - return int(any.val) -} - -func (any *uint32Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *uint32Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *uint32Any) ToUint() uint { - return uint(any.val) -} - -func (any *uint32Any) ToUint32() uint32 { - return any.val -} - -func (any *uint32Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *uint32Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *uint32Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *uint32Any) ToString() string { - return strconv.FormatInt(int64(any.val), 10) -} - -func (any *uint32Any) WriteTo(stream *Stream) { - stream.WriteUint32(any.val) -} - -func (any *uint32Any) Parse() *Iterator { - return nil -} - -func (any *uint32Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_uint64.go b/vendor/github.com/json-iterator/go/any_uint64.go deleted file mode 100644 index 7df2fce33..000000000 --- a/vendor/github.com/json-iterator/go/any_uint64.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type uint64Any struct { - baseAny - val uint64 -} - -func (any *uint64Any) LastError() error { - return nil -} - -func (any *uint64Any) ValueType() ValueType { - return NumberValue -} - -func (any *uint64Any) MustBeValid() Any { - return any -} - -func (any *uint64Any) ToBool() bool { - return any.val != 0 -} - -func (any *uint64Any) ToInt() int { - return int(any.val) -} - -func (any *uint64Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *uint64Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *uint64Any) ToUint() uint { - return uint(any.val) -} - -func (any *uint64Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *uint64Any) ToUint64() uint64 { - return any.val -} - -func (any *uint64Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *uint64Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *uint64Any) ToString() string { - return strconv.FormatUint(any.val, 10) -} - -func (any *uint64Any) WriteTo(stream *Stream) { - stream.WriteUint64(any.val) -} - -func (any *uint64Any) Parse() *Iterator { - return nil -} - -func (any *uint64Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/build.sh b/vendor/github.com/json-iterator/go/build.sh deleted file mode 100644 index b45ef6883..000000000 --- a/vendor/github.com/json-iterator/go/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e -set -x - -if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then - mkdir -p /tmp/build-golang/src/github.com/json-iterator - ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go -fi -export GOPATH=/tmp/build-golang -go get -u github.com/golang/dep/cmd/dep -cd /tmp/build-golang/src/github.com/json-iterator/go -exec $GOPATH/bin/dep ensure -update diff --git a/vendor/github.com/json-iterator/go/config.go b/vendor/github.com/json-iterator/go/config.go deleted file mode 100644 index 2adcdc3b7..000000000 --- a/vendor/github.com/json-iterator/go/config.go +++ /dev/null @@ -1,375 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io" - "reflect" - "sync" - "unsafe" - - "github.com/modern-go/concurrent" - "github.com/modern-go/reflect2" -) - -// Config customize how the API should behave. -// The API is created from Config by Froze. -type Config struct { - IndentionStep int - MarshalFloatWith6Digits bool - EscapeHTML bool - SortMapKeys bool - UseNumber bool - DisallowUnknownFields bool - TagKey string - OnlyTaggedField bool - ValidateJsonRawMessage bool - ObjectFieldMustBeSimpleString bool - CaseSensitive bool -} - -// API the public interface of this package. -// Primary Marshal and Unmarshal. -type API interface { - IteratorPool - StreamPool - MarshalToString(v interface{}) (string, error) - Marshal(v interface{}) ([]byte, error) - MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) - UnmarshalFromString(str string, v interface{}) error - Unmarshal(data []byte, v interface{}) error - Get(data []byte, path ...interface{}) Any - NewEncoder(writer io.Writer) *Encoder - NewDecoder(reader io.Reader) *Decoder - Valid(data []byte) bool - RegisterExtension(extension Extension) - DecoderOf(typ reflect2.Type) ValDecoder - EncoderOf(typ reflect2.Type) ValEncoder -} - -// ConfigDefault the default API -var ConfigDefault = Config{ - EscapeHTML: true, -}.Froze() - -// ConfigCompatibleWithStandardLibrary tries to be 100% compatible with standard library behavior -var ConfigCompatibleWithStandardLibrary = Config{ - EscapeHTML: true, - SortMapKeys: true, - ValidateJsonRawMessage: true, -}.Froze() - -// ConfigFastest marshals float with only 6 digits precision -var ConfigFastest = Config{ - EscapeHTML: false, - MarshalFloatWith6Digits: true, // will lose precession - ObjectFieldMustBeSimpleString: true, // do not unescape object field -}.Froze() - -type frozenConfig struct { - configBeforeFrozen Config - sortMapKeys bool - indentionStep int - objectFieldMustBeSimpleString bool - onlyTaggedField bool - disallowUnknownFields bool - decoderCache *concurrent.Map - encoderCache *concurrent.Map - encoderExtension Extension - decoderExtension Extension - extraExtensions []Extension - streamPool *sync.Pool - iteratorPool *sync.Pool - caseSensitive bool -} - -func (cfg *frozenConfig) initCache() { - cfg.decoderCache = concurrent.NewMap() - cfg.encoderCache = concurrent.NewMap() -} - -func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { - cfg.decoderCache.Store(cacheKey, decoder) -} - -func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { - cfg.encoderCache.Store(cacheKey, encoder) -} - -func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { - decoder, found := cfg.decoderCache.Load(cacheKey) - if found { - return decoder.(ValDecoder) - } - return nil -} - -func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { - encoder, found := cfg.encoderCache.Load(cacheKey) - if found { - return encoder.(ValEncoder) - } - return nil -} - -var cfgCache = concurrent.NewMap() - -func getFrozenConfigFromCache(cfg Config) *frozenConfig { - obj, found := cfgCache.Load(cfg) - if found { - return obj.(*frozenConfig) - } - return nil -} - -func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { - cfgCache.Store(cfg, frozenConfig) -} - -// Froze forge API from config -func (cfg Config) Froze() API { - api := &frozenConfig{ - sortMapKeys: cfg.SortMapKeys, - indentionStep: cfg.IndentionStep, - objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, - onlyTaggedField: cfg.OnlyTaggedField, - disallowUnknownFields: cfg.DisallowUnknownFields, - caseSensitive: cfg.CaseSensitive, - } - api.streamPool = &sync.Pool{ - New: func() interface{} { - return NewStream(api, nil, 512) - }, - } - api.iteratorPool = &sync.Pool{ - New: func() interface{} { - return NewIterator(api) - }, - } - api.initCache() - encoderExtension := EncoderExtension{} - decoderExtension := DecoderExtension{} - if cfg.MarshalFloatWith6Digits { - api.marshalFloatWith6Digits(encoderExtension) - } - if cfg.EscapeHTML { - api.escapeHTML(encoderExtension) - } - if cfg.UseNumber { - api.useNumber(decoderExtension) - } - if cfg.ValidateJsonRawMessage { - api.validateJsonRawMessage(encoderExtension) - } - api.encoderExtension = encoderExtension - api.decoderExtension = decoderExtension - api.configBeforeFrozen = cfg - return api -} - -func (cfg Config) frozeWithCacheReuse(extraExtensions []Extension) *frozenConfig { - api := getFrozenConfigFromCache(cfg) - if api != nil { - return api - } - api = cfg.Froze().(*frozenConfig) - for _, extension := range extraExtensions { - api.RegisterExtension(extension) - } - addFrozenConfigToCache(cfg, api) - return api -} - -func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { - encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { - rawMessage := *(*json.RawMessage)(ptr) - iter := cfg.BorrowIterator([]byte(rawMessage)) - defer cfg.ReturnIterator(iter) - iter.Read() - if iter.Error != nil && iter.Error != io.EOF { - stream.WriteRaw("null") - } else { - stream.WriteRaw(string(rawMessage)) - } - }, func(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 - }} - extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder - extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder -} - -func (cfg *frozenConfig) useNumber(extension DecoderExtension) { - extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { - exitingValue := *((*interface{})(ptr)) - if exitingValue != nil && reflect.TypeOf(exitingValue).Kind() == reflect.Ptr { - iter.ReadVal(exitingValue) - return - } - if iter.WhatIsNext() == NumberValue { - *((*interface{})(ptr)) = json.Number(iter.readNumberAsString()) - } else { - *((*interface{})(ptr)) = iter.Read() - } - }} -} -func (cfg *frozenConfig) getTagKey() string { - tagKey := cfg.configBeforeFrozen.TagKey - if tagKey == "" { - return "json" - } - return tagKey -} - -func (cfg *frozenConfig) RegisterExtension(extension Extension) { - cfg.extraExtensions = append(cfg.extraExtensions, extension) - copied := cfg.configBeforeFrozen - cfg.configBeforeFrozen = copied -} - -type lossyFloat32Encoder struct { -} - -func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32Lossy(*((*float32)(ptr))) -} - -func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type lossyFloat64Encoder struct { -} - -func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64Lossy(*((*float64)(ptr))) -} - -func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -// EnableLossyFloatMarshalling keeps 10**(-6) precision -// for float variables for better performance. -func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) { - // for better performance - extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{} - extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{} -} - -type htmlEscapedStringEncoder struct { -} - -func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteStringWithHTMLEscaped(str) -} - -func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) { - encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{} -} - -func (cfg *frozenConfig) cleanDecoders() { - typeDecoders = map[string]ValDecoder{} - fieldDecoders = map[string]ValDecoder{} - *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) -} - -func (cfg *frozenConfig) cleanEncoders() { - typeEncoders = map[string]ValEncoder{} - fieldEncoders = map[string]ValEncoder{} - *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) -} - -func (cfg *frozenConfig) MarshalToString(v interface{}) (string, error) { - stream := cfg.BorrowStream(nil) - defer cfg.ReturnStream(stream) - stream.WriteVal(v) - if stream.Error != nil { - return "", stream.Error - } - return string(stream.Buffer()), nil -} - -func (cfg *frozenConfig) Marshal(v interface{}) ([]byte, error) { - stream := cfg.BorrowStream(nil) - defer cfg.ReturnStream(stream) - stream.WriteVal(v) - if stream.Error != nil { - return nil, stream.Error - } - result := stream.Buffer() - copied := make([]byte, len(result)) - copy(copied, result) - return copied, nil -} - -func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - if prefix != "" { - panic("prefix is not supported") - } - for _, r := range indent { - if r != ' ' { - panic("indent can only be space") - } - } - newCfg := cfg.configBeforeFrozen - newCfg.IndentionStep = len(indent) - return newCfg.frozeWithCacheReuse(cfg.extraExtensions).Marshal(v) -} - -func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error { - data := []byte(str) - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.ReadVal(v) - c := iter.nextToken() - if c == 0 { - if iter.Error == io.EOF { - return nil - } - return iter.Error - } - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") - return iter.Error -} - -func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - return locatePath(iter, path) -} - -func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.ReadVal(v) - c := iter.nextToken() - if c == 0 { - if iter.Error == io.EOF { - return nil - } - return iter.Error - } - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") - return iter.Error -} - -func (cfg *frozenConfig) NewEncoder(writer io.Writer) *Encoder { - stream := NewStream(cfg, writer, 512) - return &Encoder{stream} -} - -func (cfg *frozenConfig) NewDecoder(reader io.Reader) *Decoder { - iter := Parse(cfg, reader, 512) - return &Decoder{iter} -} - -func (cfg *frozenConfig) Valid(data []byte) bool { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.Skip() - return iter.Error == nil -} diff --git a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md b/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md deleted file mode 100644 index 3095662b0..000000000 --- a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md +++ /dev/null @@ -1,7 +0,0 @@ -| json type \ dest type | bool | int | uint | float |string| -| --- | --- | --- | --- |--|--| -| number | positive => true
negative => true
zero => false| 23.2 => 23
-32.1 => -32| 12.1 => 12
-12.1 => 0|as normal|same as origin| -| string | empty string => false
string "0" => false
other strings => true | "123.32" => 123
"-123.4" => -123
"123.23xxxw" => 123
"abcde12" => 0
"-32.1" => -32| 13.2 => 13
-1.1 => 0 |12.1 => 12.1
-12.3 => -12.3
12.4xxa => 12.4
+1.1e2 =>110 |same as origin| -| bool | true => true
false => false| true => 1
false => 0 | true => 1
false => 0 |true => 1
false => 0|true => "true"
false => "false"| -| object | true | 0 | 0 |0|originnal json| -| array | empty array => false
nonempty array => true| [] => 0
[1,2] => 1 | [] => 0
[1,2] => 1 |[] => 0
[1,2] => 1|original json| \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/go.mod b/vendor/github.com/json-iterator/go/go.mod deleted file mode 100644 index e05c42ff5..000000000 --- a/vendor/github.com/json-iterator/go/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/json-iterator/go - -go 1.12 - -require ( - github.com/davecgh/go-spew v1.1.1 - github.com/google/gofuzz v1.0.0 - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 - github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 - github.com/stretchr/testify v1.3.0 -) diff --git a/vendor/github.com/json-iterator/go/go.sum b/vendor/github.com/json-iterator/go/go.sum deleted file mode 100644 index d778b5a14..000000000 --- a/vendor/github.com/json-iterator/go/go.sum +++ /dev/null @@ -1,14 +0,0 @@ -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/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -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.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/json-iterator/go/iter.go b/vendor/github.com/json-iterator/go/iter.go deleted file mode 100644 index 29b31cf78..000000000 --- a/vendor/github.com/json-iterator/go/iter.go +++ /dev/null @@ -1,349 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "fmt" - "io" -) - -// ValueType the type for JSON element -type ValueType int - -const ( - // InvalidValue invalid JSON element - InvalidValue ValueType = iota - // StringValue JSON element "string" - StringValue - // NumberValue JSON element 100 or 0.10 - NumberValue - // NilValue JSON element null - NilValue - // BoolValue JSON element true or false - BoolValue - // ArrayValue JSON element [] - ArrayValue - // ObjectValue JSON element {} - ObjectValue -) - -var hexDigits []byte -var valueTypes []ValueType - -func init() { - hexDigits = make([]byte, 256) - for i := 0; i < len(hexDigits); i++ { - hexDigits[i] = 255 - } - for i := '0'; i <= '9'; i++ { - hexDigits[i] = byte(i - '0') - } - for i := 'a'; i <= 'f'; i++ { - hexDigits[i] = byte((i - 'a') + 10) - } - for i := 'A'; i <= 'F'; i++ { - hexDigits[i] = byte((i - 'A') + 10) - } - valueTypes = make([]ValueType, 256) - for i := 0; i < len(valueTypes); i++ { - valueTypes[i] = InvalidValue - } - valueTypes['"'] = StringValue - valueTypes['-'] = NumberValue - valueTypes['0'] = NumberValue - valueTypes['1'] = NumberValue - valueTypes['2'] = NumberValue - valueTypes['3'] = NumberValue - valueTypes['4'] = NumberValue - valueTypes['5'] = NumberValue - valueTypes['6'] = NumberValue - valueTypes['7'] = NumberValue - valueTypes['8'] = NumberValue - valueTypes['9'] = NumberValue - valueTypes['t'] = BoolValue - valueTypes['f'] = BoolValue - valueTypes['n'] = NilValue - valueTypes['['] = ArrayValue - valueTypes['{'] = ObjectValue -} - -// Iterator is a io.Reader like object, with JSON specific read functions. -// Error is not returned as return value, but stored as Error member on this iterator instance. -type Iterator struct { - cfg *frozenConfig - reader io.Reader - buf []byte - head int - tail int - depth int - captureStartedAt int - captured []byte - Error error - Attachment interface{} // open for customized decoder -} - -// NewIterator creates an empty Iterator instance -func NewIterator(cfg API) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: nil, - buf: nil, - head: 0, - tail: 0, - depth: 0, - } -} - -// Parse creates an Iterator instance from io.Reader -func Parse(cfg API, reader io.Reader, bufSize int) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: reader, - buf: make([]byte, bufSize), - head: 0, - tail: 0, - depth: 0, - } -} - -// ParseBytes creates an Iterator instance from byte array -func ParseBytes(cfg API, input []byte) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: nil, - buf: input, - head: 0, - tail: len(input), - depth: 0, - } -} - -// ParseString creates an Iterator instance from string -func ParseString(cfg API, input string) *Iterator { - return ParseBytes(cfg, []byte(input)) -} - -// Pool returns a pool can provide more iterator with same configuration -func (iter *Iterator) Pool() IteratorPool { - return iter.cfg -} - -// Reset reuse iterator instance by specifying another reader -func (iter *Iterator) Reset(reader io.Reader) *Iterator { - iter.reader = reader - iter.head = 0 - iter.tail = 0 - iter.depth = 0 - return iter -} - -// ResetBytes reuse iterator instance by specifying another byte array as input -func (iter *Iterator) ResetBytes(input []byte) *Iterator { - iter.reader = nil - iter.buf = input - iter.head = 0 - iter.tail = len(input) - iter.depth = 0 - return iter -} - -// WhatIsNext gets ValueType of relatively next json element -func (iter *Iterator) WhatIsNext() ValueType { - valueType := valueTypes[iter.nextToken()] - iter.unreadByte() - return valueType -} - -func (iter *Iterator) skipWhitespacesWithoutLoadMore() bool { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\t', '\r': - continue - } - iter.head = i - return false - } - return true -} - -func (iter *Iterator) isObjectEnd() bool { - c := iter.nextToken() - if c == ',' { - return false - } - if c == '}' { - return true - } - iter.ReportError("isObjectEnd", "object ended prematurely, unexpected char "+string([]byte{c})) - return true -} - -func (iter *Iterator) nextToken() byte { - // a variation of skip whitespaces, returning the next non-whitespace token - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\t', '\r': - continue - } - iter.head = i + 1 - return c - } - if !iter.loadMore() { - return 0 - } - } -} - -// ReportError record a error in iterator instance with current position. -func (iter *Iterator) ReportError(operation string, msg string) { - if iter.Error != nil { - if iter.Error != io.EOF { - return - } - } - peekStart := iter.head - 10 - if peekStart < 0 { - peekStart = 0 - } - peekEnd := iter.head + 10 - if peekEnd > iter.tail { - peekEnd = iter.tail - } - parsing := string(iter.buf[peekStart:peekEnd]) - contextStart := iter.head - 50 - if contextStart < 0 { - contextStart = 0 - } - contextEnd := iter.head + 50 - if contextEnd > iter.tail { - contextEnd = iter.tail - } - context := string(iter.buf[contextStart:contextEnd]) - iter.Error = fmt.Errorf("%s: %s, error found in #%v byte of ...|%s|..., bigger context ...|%s|...", - operation, msg, iter.head-peekStart, parsing, context) -} - -// CurrentBuffer gets current buffer as string for debugging purpose -func (iter *Iterator) CurrentBuffer() string { - peekStart := iter.head - 10 - if peekStart < 0 { - peekStart = 0 - } - return fmt.Sprintf("parsing #%v byte, around ...|%s|..., whole buffer ...|%s|...", iter.head, - string(iter.buf[peekStart:iter.head]), string(iter.buf[0:iter.tail])) -} - -func (iter *Iterator) readByte() (ret byte) { - if iter.head == iter.tail { - if iter.loadMore() { - ret = iter.buf[iter.head] - iter.head++ - return ret - } - return 0 - } - ret = iter.buf[iter.head] - iter.head++ - return ret -} - -func (iter *Iterator) loadMore() bool { - if iter.reader == nil { - if iter.Error == nil { - iter.head = iter.tail - iter.Error = io.EOF - } - return false - } - if iter.captured != nil { - iter.captured = append(iter.captured, - iter.buf[iter.captureStartedAt:iter.tail]...) - iter.captureStartedAt = 0 - } - for { - n, err := iter.reader.Read(iter.buf) - if n == 0 { - if err != nil { - if iter.Error == nil { - iter.Error = err - } - return false - } - } else { - iter.head = 0 - iter.tail = n - return true - } - } -} - -func (iter *Iterator) unreadByte() { - if iter.Error != nil { - return - } - iter.head-- - return -} - -// Read read the next JSON element as generic interface{}. -func (iter *Iterator) Read() interface{} { - valueType := iter.WhatIsNext() - switch valueType { - case StringValue: - return iter.ReadString() - case NumberValue: - if iter.cfg.configBeforeFrozen.UseNumber { - return json.Number(iter.readNumberAsString()) - } - return iter.ReadFloat64() - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - return nil - case BoolValue: - return iter.ReadBool() - case ArrayValue: - arr := []interface{}{} - iter.ReadArrayCB(func(iter *Iterator) bool { - var elem interface{} - iter.ReadVal(&elem) - arr = append(arr, elem) - return true - }) - return arr - case ObjectValue: - obj := map[string]interface{}{} - iter.ReadMapCB(func(Iter *Iterator, field string) bool { - var elem interface{} - iter.ReadVal(&elem) - obj[field] = elem - return true - }) - return obj - default: - iter.ReportError("Read", fmt.Sprintf("unexpected value type: %v", valueType)) - return nil - } -} - -// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9 -const maxDepth = 10000 - -func (iter *Iterator) incrementDepth() (success bool) { - iter.depth++ - if iter.depth <= maxDepth { - return true - } - iter.ReportError("incrementDepth", "exceeded max depth") - return false -} - -func (iter *Iterator) decrementDepth() (success bool) { - iter.depth-- - if iter.depth >= 0 { - return true - } - iter.ReportError("decrementDepth", "unexpected negative nesting") - return false -} diff --git a/vendor/github.com/json-iterator/go/iter_array.go b/vendor/github.com/json-iterator/go/iter_array.go deleted file mode 100644 index 204fe0e09..000000000 --- a/vendor/github.com/json-iterator/go/iter_array.go +++ /dev/null @@ -1,64 +0,0 @@ -package jsoniter - -// ReadArray read array element, tells if the array has more element to read. -func (iter *Iterator) ReadArray() (ret bool) { - c := iter.nextToken() - switch c { - case 'n': - iter.skipThreeBytes('u', 'l', 'l') - return false // null - case '[': - c = iter.nextToken() - if c != ']' { - iter.unreadByte() - return true - } - return false - case ']': - return false - case ',': - return true - default: - iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c})) - return - } -} - -// ReadArrayCB read array with callback -func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) { - c := iter.nextToken() - if c == '[' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c != ']' { - iter.unreadByte() - if !callback(iter) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - if !callback(iter) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != ']' { - iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - return iter.decrementDepth() - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c})) - return false -} diff --git a/vendor/github.com/json-iterator/go/iter_float.go b/vendor/github.com/json-iterator/go/iter_float.go deleted file mode 100644 index b9754638e..000000000 --- a/vendor/github.com/json-iterator/go/iter_float.go +++ /dev/null @@ -1,339 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io" - "math/big" - "strconv" - "strings" - "unsafe" -) - -var floatDigits []int8 - -const invalidCharForNumber = int8(-1) -const endOfNumber = int8(-2) -const dotInNumber = int8(-3) - -func init() { - floatDigits = make([]int8, 256) - for i := 0; i < len(floatDigits); i++ { - floatDigits[i] = invalidCharForNumber - } - for i := int8('0'); i <= int8('9'); i++ { - floatDigits[i] = i - int8('0') - } - floatDigits[','] = endOfNumber - floatDigits[']'] = endOfNumber - floatDigits['}'] = endOfNumber - floatDigits[' '] = endOfNumber - floatDigits['\t'] = endOfNumber - floatDigits['\n'] = endOfNumber - floatDigits['.'] = dotInNumber -} - -// ReadBigFloat read big.Float -func (iter *Iterator) ReadBigFloat() (ret *big.Float) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return nil - } - prec := 64 - if len(str) > prec { - prec = len(str) - } - val, _, err := big.ParseFloat(str, 10, uint(prec), big.ToZero) - if err != nil { - iter.Error = err - return nil - } - return val -} - -// ReadBigInt read big.Int -func (iter *Iterator) ReadBigInt() (ret *big.Int) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return nil - } - ret = big.NewInt(0) - var success bool - ret, success = ret.SetString(str, 10) - if !success { - iter.ReportError("ReadBigInt", "invalid big int") - return nil - } - return ret -} - -//ReadFloat32 read float32 -func (iter *Iterator) ReadFloat32() (ret float32) { - c := iter.nextToken() - if c == '-' { - return -iter.readPositiveFloat32() - } - iter.unreadByte() - return iter.readPositiveFloat32() -} - -func (iter *Iterator) readPositiveFloat32() (ret float32) { - i := iter.head - // first char - if i == iter.tail { - return iter.readFloat32SlowPath() - } - c := iter.buf[i] - i++ - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat32SlowPath() - case endOfNumber: - iter.ReportError("readFloat32", "empty number") - return - case dotInNumber: - iter.ReportError("readFloat32", "leading dot is invalid") - return - case 0: - if i == iter.tail { - return iter.readFloat32SlowPath() - } - c = iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.ReportError("readFloat32", "leading zero is invalid") - return - } - } - value := uint64(ind) - // chars before dot -non_decimal_loop: - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat32SlowPath() - case endOfNumber: - iter.head = i - return float32(value) - case dotInNumber: - break non_decimal_loop - } - if value > uint64SafeToMultiple10 { - return iter.readFloat32SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; - } - // chars after dot - if c == '.' { - i++ - decimalPlaces := 0 - if i == iter.tail { - return iter.readFloat32SlowPath() - } - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case endOfNumber: - if decimalPlaces > 0 && decimalPlaces < len(pow10) { - iter.head = i - return float32(float64(value) / float64(pow10[decimalPlaces])) - } - // too many decimal places - return iter.readFloat32SlowPath() - case invalidCharForNumber, dotInNumber: - return iter.readFloat32SlowPath() - } - decimalPlaces++ - if value > uint64SafeToMultiple10 { - return iter.readFloat32SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) - } - } - return iter.readFloat32SlowPath() -} - -func (iter *Iterator) readNumberAsString() (ret string) { - strBuf := [16]byte{} - str := strBuf[0:0] -load_loop: - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case '+', '-', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - str = append(str, c) - continue - default: - iter.head = i - break load_loop - } - } - if !iter.loadMore() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF { - return - } - if len(str) == 0 { - iter.ReportError("readNumberAsString", "invalid number") - } - return *(*string)(unsafe.Pointer(&str)) -} - -func (iter *Iterator) readFloat32SlowPath() (ret float32) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return - } - errMsg := validateFloat(str) - if errMsg != "" { - iter.ReportError("readFloat32SlowPath", errMsg) - return - } - val, err := strconv.ParseFloat(str, 32) - if err != nil { - iter.Error = err - return - } - return float32(val) -} - -// ReadFloat64 read float64 -func (iter *Iterator) ReadFloat64() (ret float64) { - c := iter.nextToken() - if c == '-' { - return -iter.readPositiveFloat64() - } - iter.unreadByte() - return iter.readPositiveFloat64() -} - -func (iter *Iterator) readPositiveFloat64() (ret float64) { - i := iter.head - // first char - if i == iter.tail { - return iter.readFloat64SlowPath() - } - c := iter.buf[i] - i++ - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat64SlowPath() - case endOfNumber: - iter.ReportError("readFloat64", "empty number") - return - case dotInNumber: - iter.ReportError("readFloat64", "leading dot is invalid") - return - case 0: - if i == iter.tail { - return iter.readFloat64SlowPath() - } - c = iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.ReportError("readFloat64", "leading zero is invalid") - return - } - } - value := uint64(ind) - // chars before dot -non_decimal_loop: - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat64SlowPath() - case endOfNumber: - iter.head = i - return float64(value) - case dotInNumber: - break non_decimal_loop - } - if value > uint64SafeToMultiple10 { - return iter.readFloat64SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; - } - // chars after dot - if c == '.' { - i++ - decimalPlaces := 0 - if i == iter.tail { - return iter.readFloat64SlowPath() - } - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case endOfNumber: - if decimalPlaces > 0 && decimalPlaces < len(pow10) { - iter.head = i - return float64(value) / float64(pow10[decimalPlaces]) - } - // too many decimal places - return iter.readFloat64SlowPath() - case invalidCharForNumber, dotInNumber: - return iter.readFloat64SlowPath() - } - decimalPlaces++ - if value > uint64SafeToMultiple10 { - return iter.readFloat64SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) - } - } - return iter.readFloat64SlowPath() -} - -func (iter *Iterator) readFloat64SlowPath() (ret float64) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return - } - errMsg := validateFloat(str) - if errMsg != "" { - iter.ReportError("readFloat64SlowPath", errMsg) - return - } - val, err := strconv.ParseFloat(str, 64) - if err != nil { - iter.Error = err - return - } - return val -} - -func validateFloat(str string) string { - // strconv.ParseFloat is not validating `1.` or `1.e1` - if len(str) == 0 { - return "empty number" - } - if str[0] == '-' { - return "-- is not valid" - } - dotPos := strings.IndexByte(str, '.') - if dotPos != -1 { - if dotPos == len(str)-1 { - return "dot can not be last character" - } - switch str[dotPos+1] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - return "missing digit after dot" - } - } - return "" -} - -// ReadNumber read json.Number -func (iter *Iterator) ReadNumber() (ret json.Number) { - return json.Number(iter.readNumberAsString()) -} diff --git a/vendor/github.com/json-iterator/go/iter_int.go b/vendor/github.com/json-iterator/go/iter_int.go deleted file mode 100644 index 214232035..000000000 --- a/vendor/github.com/json-iterator/go/iter_int.go +++ /dev/null @@ -1,345 +0,0 @@ -package jsoniter - -import ( - "math" - "strconv" -) - -var intDigits []int8 - -const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1 -const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1 - -func init() { - intDigits = make([]int8, 256) - for i := 0; i < len(intDigits); i++ { - intDigits[i] = invalidCharForNumber - } - for i := int8('0'); i <= int8('9'); i++ { - intDigits[i] = i - int8('0') - } -} - -// ReadUint read uint -func (iter *Iterator) ReadUint() uint { - if strconv.IntSize == 32 { - return uint(iter.ReadUint32()) - } - return uint(iter.ReadUint64()) -} - -// ReadInt read int -func (iter *Iterator) ReadInt() int { - if strconv.IntSize == 32 { - return int(iter.ReadInt32()) - } - return int(iter.ReadInt64()) -} - -// ReadInt8 read int8 -func (iter *Iterator) ReadInt8() (ret int8) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt8+1 { - iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int8(val) - } - val := iter.readUint32(c) - if val > math.MaxInt8 { - iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int8(val) -} - -// ReadUint8 read uint8 -func (iter *Iterator) ReadUint8() (ret uint8) { - val := iter.readUint32(iter.nextToken()) - if val > math.MaxUint8 { - iter.ReportError("ReadUint8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return uint8(val) -} - -// ReadInt16 read int16 -func (iter *Iterator) ReadInt16() (ret int16) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt16+1 { - iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int16(val) - } - val := iter.readUint32(c) - if val > math.MaxInt16 { - iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int16(val) -} - -// ReadUint16 read uint16 -func (iter *Iterator) ReadUint16() (ret uint16) { - val := iter.readUint32(iter.nextToken()) - if val > math.MaxUint16 { - iter.ReportError("ReadUint16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return uint16(val) -} - -// ReadInt32 read int32 -func (iter *Iterator) ReadInt32() (ret int32) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt32+1 { - iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int32(val) - } - val := iter.readUint32(c) - if val > math.MaxInt32 { - iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int32(val) -} - -// ReadUint32 read uint32 -func (iter *Iterator) ReadUint32() (ret uint32) { - return iter.readUint32(iter.nextToken()) -} - -func (iter *Iterator) readUint32(c byte) (ret uint32) { - ind := intDigits[c] - if ind == 0 { - iter.assertInteger() - return 0 // single zero - } - if ind == invalidCharForNumber { - iter.ReportError("readUint32", "unexpected character: "+string([]byte{byte(ind)})) - return - } - value := uint32(ind) - if iter.tail-iter.head > 10 { - i := iter.head - ind2 := intDigits[iter.buf[i]] - if ind2 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - i++ - ind3 := intDigits[iter.buf[i]] - if ind3 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10 + uint32(ind2) - } - //iter.head = i + 1 - //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) - i++ - ind4 := intDigits[iter.buf[i]] - if ind4 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100 + uint32(ind2)*10 + uint32(ind3) - } - i++ - ind5 := intDigits[iter.buf[i]] - if ind5 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4) - } - i++ - ind6 := intDigits[iter.buf[i]] - if ind6 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5) - } - i++ - ind7 := intDigits[iter.buf[i]] - if ind7 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6) - } - i++ - ind8 := intDigits[iter.buf[i]] - if ind8 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7) - } - i++ - ind9 := intDigits[iter.buf[i]] - value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8) - iter.head = i - if ind9 == invalidCharForNumber { - iter.assertInteger() - return value - } - } - for { - for i := iter.head; i < iter.tail; i++ { - ind = intDigits[iter.buf[i]] - if ind == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - if value > uint32SafeToMultiply10 { - value2 := (value << 3) + (value << 1) + uint32(ind) - if value2 < value { - iter.ReportError("readUint32", "overflow") - return - } - value = value2 - continue - } - value = (value << 3) + (value << 1) + uint32(ind) - } - if !iter.loadMore() { - iter.assertInteger() - return value - } - } -} - -// ReadInt64 read int64 -func (iter *Iterator) ReadInt64() (ret int64) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint64(iter.readByte()) - if val > math.MaxInt64+1 { - iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) - return - } - return -int64(val) - } - val := iter.readUint64(c) - if val > math.MaxInt64 { - iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) - return - } - return int64(val) -} - -// ReadUint64 read uint64 -func (iter *Iterator) ReadUint64() uint64 { - return iter.readUint64(iter.nextToken()) -} - -func (iter *Iterator) readUint64(c byte) (ret uint64) { - ind := intDigits[c] - if ind == 0 { - iter.assertInteger() - return 0 // single zero - } - if ind == invalidCharForNumber { - iter.ReportError("readUint64", "unexpected character: "+string([]byte{byte(ind)})) - return - } - value := uint64(ind) - if iter.tail-iter.head > 10 { - i := iter.head - ind2 := intDigits[iter.buf[i]] - if ind2 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - i++ - ind3 := intDigits[iter.buf[i]] - if ind3 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10 + uint64(ind2) - } - //iter.head = i + 1 - //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) - i++ - ind4 := intDigits[iter.buf[i]] - if ind4 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100 + uint64(ind2)*10 + uint64(ind3) - } - i++ - ind5 := intDigits[iter.buf[i]] - if ind5 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4) - } - i++ - ind6 := intDigits[iter.buf[i]] - if ind6 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5) - } - i++ - ind7 := intDigits[iter.buf[i]] - if ind7 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6) - } - i++ - ind8 := intDigits[iter.buf[i]] - if ind8 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7) - } - i++ - ind9 := intDigits[iter.buf[i]] - value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8) - iter.head = i - if ind9 == invalidCharForNumber { - iter.assertInteger() - return value - } - } - for { - for i := iter.head; i < iter.tail; i++ { - ind = intDigits[iter.buf[i]] - if ind == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - if value > uint64SafeToMultiple10 { - value2 := (value << 3) + (value << 1) + uint64(ind) - if value2 < value { - iter.ReportError("readUint64", "overflow") - return - } - value = value2 - continue - } - value = (value << 3) + (value << 1) + uint64(ind) - } - if !iter.loadMore() { - iter.assertInteger() - return value - } - } -} - -func (iter *Iterator) assertInteger() { - if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' { - iter.ReportError("assertInteger", "can not decode float as int") - } -} diff --git a/vendor/github.com/json-iterator/go/iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go deleted file mode 100644 index 58ee89c84..000000000 --- a/vendor/github.com/json-iterator/go/iter_object.go +++ /dev/null @@ -1,267 +0,0 @@ -package jsoniter - -import ( - "fmt" - "strings" -) - -// ReadObject read one field from object. -// If object ended, returns empty string. -// Otherwise, returns the field name. -func (iter *Iterator) ReadObject() (ret string) { - c := iter.nextToken() - switch c { - case 'n': - iter.skipThreeBytes('u', 'l', 'l') - return "" // null - case '{': - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - } - if c == '}' { - return "" // end of object - } - iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) - return - case ',': - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - case '}': - return "" // end of object - default: - iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %s`, string([]byte{c}))) - return - } -} - -// CaseInsensitive -func (iter *Iterator) readFieldHash() int64 { - hash := int64(0x811c9dc5) - c := iter.nextToken() - if c != '"' { - iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) - return 0 - } - for { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - b := iter.buf[i] - if b == '\\' { - iter.head = i - for _, b := range iter.readStringSlowPath() { - if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return hash - } - if b == '"' { - iter.head = i + 1 - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return hash - } - if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - if !iter.loadMore() { - iter.ReportError("readFieldHash", `incomplete field name`) - return 0 - } - } -} - -func calcHash(str string, caseSensitive bool) int64 { - if !caseSensitive { - str = strings.ToLower(str) - } - hash := int64(0x811c9dc5) - for _, b := range []byte(str) { - hash ^= int64(b) - hash *= 0x1000193 - } - return int64(hash) -} - -// ReadObjectCB read object with callback, the key is ascii only and field name not copied -func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { - c := iter.nextToken() - var field string - if c == '{' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != '}' { - iter.ReportError("ReadObjectCB", `object not ended with }`) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - if c == '}' { - return iter.decrementDepth() - } - iter.ReportError("ReadObjectCB", `expect " after {, but found `+string([]byte{c})) - iter.decrementDepth() - return false - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadObjectCB", `expect { or n, but found `+string([]byte{c})) - return false -} - -// ReadMapCB read map with callback, the key can be any string -func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool { - c := iter.nextToken() - if c == '{' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field := iter.ReadString() - if iter.nextToken() != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - field = iter.ReadString() - if iter.nextToken() != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != '}' { - iter.ReportError("ReadMapCB", `object not ended with }`) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - if c == '}' { - return iter.decrementDepth() - } - iter.ReportError("ReadMapCB", `expect " after {, but found `+string([]byte{c})) - iter.decrementDepth() - return false - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) - return false -} - -func (iter *Iterator) readObjectStart() bool { - c := iter.nextToken() - if c == '{' { - c = iter.nextToken() - if c == '}' { - return false - } - iter.unreadByte() - return true - } else if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return false - } - iter.ReportError("readObjectStart", "expect { or n, but found "+string([]byte{c})) - return false -} - -func (iter *Iterator) readObjectFieldAsBytes() (ret []byte) { - str := iter.ReadStringAsSlice() - if iter.skipWhitespacesWithoutLoadMore() { - if ret == nil { - ret = make([]byte, len(str)) - copy(ret, str) - } - if !iter.loadMore() { - return - } - } - if iter.buf[iter.head] != ':' { - iter.ReportError("readObjectFieldAsBytes", "expect : after object field, but found "+string([]byte{iter.buf[iter.head]})) - return - } - iter.head++ - if iter.skipWhitespacesWithoutLoadMore() { - if ret == nil { - ret = make([]byte, len(str)) - copy(ret, str) - } - if !iter.loadMore() { - return - } - } - if ret == nil { - return str - } - return ret -} diff --git a/vendor/github.com/json-iterator/go/iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go deleted file mode 100644 index e91eefb15..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip.go +++ /dev/null @@ -1,130 +0,0 @@ -package jsoniter - -import "fmt" - -// ReadNil reads a json object as nil and -// returns whether it's a nil or not -func (iter *Iterator) ReadNil() (ret bool) { - c := iter.nextToken() - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') // null - return true - } - iter.unreadByte() - return false -} - -// ReadBool reads a json object as BoolValue -func (iter *Iterator) ReadBool() (ret bool) { - c := iter.nextToken() - if c == 't' { - iter.skipThreeBytes('r', 'u', 'e') - return true - } - if c == 'f' { - iter.skipFourBytes('a', 'l', 's', 'e') - return false - } - iter.ReportError("ReadBool", "expect t or f, but found "+string([]byte{c})) - return -} - -// SkipAndReturnBytes skip next JSON element, and return its content as []byte. -// The []byte can be kept, it is a copy of data. -func (iter *Iterator) SkipAndReturnBytes() []byte { - iter.startCapture(iter.head) - iter.Skip() - return iter.stopCapture() -} - -// SkipAndAppendBytes skips next JSON element and appends its content to -// buffer, returning the result. -func (iter *Iterator) SkipAndAppendBytes(buf []byte) []byte { - iter.startCaptureTo(buf, iter.head) - iter.Skip() - return iter.stopCapture() -} - -func (iter *Iterator) startCaptureTo(buf []byte, captureStartedAt int) { - if iter.captured != nil { - panic("already in capture mode") - } - iter.captureStartedAt = captureStartedAt - iter.captured = buf -} - -func (iter *Iterator) startCapture(captureStartedAt int) { - iter.startCaptureTo(make([]byte, 0, 32), captureStartedAt) -} - -func (iter *Iterator) stopCapture() []byte { - if iter.captured == nil { - panic("not in capture mode") - } - captured := iter.captured - remaining := iter.buf[iter.captureStartedAt:iter.head] - iter.captureStartedAt = -1 - iter.captured = nil - return append(captured, remaining...) -} - -// Skip skips a json object and positions to relatively the next json object -func (iter *Iterator) Skip() { - c := iter.nextToken() - switch c { - case '"': - iter.skipString() - case 'n': - iter.skipThreeBytes('u', 'l', 'l') // null - case 't': - iter.skipThreeBytes('r', 'u', 'e') // true - case 'f': - iter.skipFourBytes('a', 'l', 's', 'e') // false - case '0': - iter.unreadByte() - iter.ReadFloat32() - case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.skipNumber() - case '[': - iter.skipArray() - case '{': - iter.skipObject() - default: - iter.ReportError("Skip", fmt.Sprintf("do not know how to skip: %v", c)) - return - } -} - -func (iter *Iterator) skipFourBytes(b1, b2, b3, b4 byte) { - if iter.readByte() != b1 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b2 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b3 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b4 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } -} - -func (iter *Iterator) skipThreeBytes(b1, b2, b3 byte) { - if iter.readByte() != b1 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } - if iter.readByte() != b2 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } - if iter.readByte() != b3 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } -} diff --git a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy.go deleted file mode 100644 index 9303de41e..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go +++ /dev/null @@ -1,163 +0,0 @@ -//+build jsoniter_sloppy - -package jsoniter - -// sloppy but faster implementation, do not validate the input json - -func (iter *Iterator) skipNumber() { - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\r', '\t', ',', '}', ']': - iter.head = i - return - } - } - if !iter.loadMore() { - return - } - } -} - -func (iter *Iterator) skipArray() { - level := 1 - if !iter.incrementDepth() { - return - } - for { - for i := iter.head; i < iter.tail; i++ { - switch iter.buf[i] { - case '"': // If inside string, skip it - iter.head = i + 1 - iter.skipString() - i = iter.head - 1 // it will be i++ soon - case '[': // If open symbol, increase level - level++ - if !iter.incrementDepth() { - return - } - case ']': // If close symbol, increase level - level-- - if !iter.decrementDepth() { - return - } - - // If we have returned to the original level, we're done - if level == 0 { - iter.head = i + 1 - return - } - } - } - if !iter.loadMore() { - iter.ReportError("skipObject", "incomplete array") - return - } - } -} - -func (iter *Iterator) skipObject() { - level := 1 - if !iter.incrementDepth() { - return - } - - for { - for i := iter.head; i < iter.tail; i++ { - switch iter.buf[i] { - case '"': // If inside string, skip it - iter.head = i + 1 - iter.skipString() - i = iter.head - 1 // it will be i++ soon - case '{': // If open symbol, increase level - level++ - if !iter.incrementDepth() { - return - } - case '}': // If close symbol, increase level - level-- - if !iter.decrementDepth() { - return - } - - // If we have returned to the original level, we're done - if level == 0 { - iter.head = i + 1 - return - } - } - } - if !iter.loadMore() { - iter.ReportError("skipObject", "incomplete object") - return - } - } -} - -func (iter *Iterator) skipString() { - for { - end, escaped := iter.findStringEnd() - if end == -1 { - if !iter.loadMore() { - iter.ReportError("skipString", "incomplete string") - return - } - if escaped { - iter.head = 1 // skip the first char as last char read is \ - } - } else { - iter.head = end - return - } - } -} - -// adapted from: https://github.com/buger/jsonparser/blob/master/parser.go -// Tries to find the end of string -// Support if string contains escaped quote symbols. -func (iter *Iterator) findStringEnd() (int, bool) { - escaped := false - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - if !escaped { - return i + 1, false - } - j := i - 1 - for { - if j < iter.head || iter.buf[j] != '\\' { - // even number of backslashes - // either end of buffer, or " found - return i + 1, true - } - j-- - if j < iter.head || iter.buf[j] != '\\' { - // odd number of backslashes - // it is \" or \\\" - break - } - j-- - } - } else if c == '\\' { - escaped = true - } - } - j := iter.tail - 1 - for { - if j < iter.head || iter.buf[j] != '\\' { - // even number of backslashes - // either end of buffer, or " found - return -1, false // do not end with \ - } - j-- - if j < iter.head || iter.buf[j] != '\\' { - // odd number of backslashes - // it is \" or \\\" - break - } - j-- - - } - return -1, true // end with \ -} diff --git a/vendor/github.com/json-iterator/go/iter_skip_strict.go b/vendor/github.com/json-iterator/go/iter_skip_strict.go deleted file mode 100644 index 6cf66d043..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip_strict.go +++ /dev/null @@ -1,99 +0,0 @@ -//+build !jsoniter_sloppy - -package jsoniter - -import ( - "fmt" - "io" -) - -func (iter *Iterator) skipNumber() { - if !iter.trySkipNumber() { - iter.unreadByte() - if iter.Error != nil && iter.Error != io.EOF { - return - } - iter.ReadFloat64() - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = nil - iter.ReadBigFloat() - } - } -} - -func (iter *Iterator) trySkipNumber() bool { - dotFound := false - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - case '.': - if dotFound { - iter.ReportError("validateNumber", `more than one dot found in number`) - return true // already failed - } - if i+1 == iter.tail { - return false - } - c = iter.buf[i+1] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - iter.ReportError("validateNumber", `missing digit after dot`) - return true // already failed - } - dotFound = true - default: - switch c { - case ',', ']', '}', ' ', '\t', '\n', '\r': - if iter.head == i { - return false // if - without following digits - } - iter.head = i - return true // must be valid - } - return false // may be invalid - } - } - return false -} - -func (iter *Iterator) skipString() { - if !iter.trySkipString() { - iter.unreadByte() - iter.ReadString() - } -} - -func (iter *Iterator) trySkipString() bool { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - iter.head = i + 1 - return true // valid - } else if c == '\\' { - return false - } else if c < ' ' { - iter.ReportError("trySkipString", - fmt.Sprintf(`invalid control character found: %d`, c)) - return true // already failed - } - } - return false -} - -func (iter *Iterator) skipObject() { - iter.unreadByte() - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - iter.Skip() - return true - }) -} - -func (iter *Iterator) skipArray() { - iter.unreadByte() - iter.ReadArrayCB(func(iter *Iterator) bool { - iter.Skip() - return true - }) -} diff --git a/vendor/github.com/json-iterator/go/iter_str.go b/vendor/github.com/json-iterator/go/iter_str.go deleted file mode 100644 index adc487ea8..000000000 --- a/vendor/github.com/json-iterator/go/iter_str.go +++ /dev/null @@ -1,215 +0,0 @@ -package jsoniter - -import ( - "fmt" - "unicode/utf16" -) - -// ReadString read string from iterator -func (iter *Iterator) ReadString() (ret string) { - c := iter.nextToken() - if c == '"' { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - ret = string(iter.buf[iter.head:i]) - iter.head = i + 1 - return ret - } else if c == '\\' { - break - } else if c < ' ' { - iter.ReportError("ReadString", - fmt.Sprintf(`invalid control character found: %d`, c)) - return - } - } - return iter.readStringSlowPath() - } else if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return "" - } - iter.ReportError("ReadString", `expects " or n, but found `+string([]byte{c})) - return -} - -func (iter *Iterator) readStringSlowPath() (ret string) { - var str []byte - var c byte - for iter.Error == nil { - c = iter.readByte() - if c == '"' { - return string(str) - } - if c == '\\' { - c = iter.readByte() - str = iter.readEscapedChar(c, str) - } else { - str = append(str, c) - } - } - iter.ReportError("readStringSlowPath", "unexpected end of input") - return -} - -func (iter *Iterator) readEscapedChar(c byte, str []byte) []byte { - switch c { - case 'u': - r := iter.readU4() - if utf16.IsSurrogate(r) { - c = iter.readByte() - if iter.Error != nil { - return nil - } - if c != '\\' { - iter.unreadByte() - str = appendRune(str, r) - return str - } - c = iter.readByte() - if iter.Error != nil { - return nil - } - if c != 'u' { - str = appendRune(str, r) - return iter.readEscapedChar(c, str) - } - r2 := iter.readU4() - if iter.Error != nil { - return nil - } - combined := utf16.DecodeRune(r, r2) - if combined == '\uFFFD' { - str = appendRune(str, r) - str = appendRune(str, r2) - } else { - str = appendRune(str, combined) - } - } else { - str = appendRune(str, r) - } - case '"': - str = append(str, '"') - case '\\': - str = append(str, '\\') - case '/': - str = append(str, '/') - case 'b': - str = append(str, '\b') - case 'f': - str = append(str, '\f') - case 'n': - str = append(str, '\n') - case 'r': - str = append(str, '\r') - case 't': - str = append(str, '\t') - default: - iter.ReportError("readEscapedChar", - `invalid escape char after \`) - return nil - } - return str -} - -// ReadStringAsSlice read string from iterator without copying into string form. -// The []byte can not be kept, as it will change after next iterator call. -func (iter *Iterator) ReadStringAsSlice() (ret []byte) { - c := iter.nextToken() - if c == '"' { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - // for: field name, base64, number - if iter.buf[i] == '"' { - // fast path: reuse the underlying buffer - ret = iter.buf[iter.head:i] - iter.head = i + 1 - return ret - } - } - readLen := iter.tail - iter.head - copied := make([]byte, readLen, readLen*2) - copy(copied, iter.buf[iter.head:iter.tail]) - iter.head = iter.tail - for iter.Error == nil { - c := iter.readByte() - if c == '"' { - return copied - } - copied = append(copied, c) - } - return copied - } - iter.ReportError("ReadStringAsSlice", `expects " or n, but found `+string([]byte{c})) - return -} - -func (iter *Iterator) readU4() (ret rune) { - for i := 0; i < 4; i++ { - c := iter.readByte() - if iter.Error != nil { - return - } - if c >= '0' && c <= '9' { - ret = ret*16 + rune(c-'0') - } else if c >= 'a' && c <= 'f' { - ret = ret*16 + rune(c-'a'+10) - } else if c >= 'A' && c <= 'F' { - ret = ret*16 + rune(c-'A'+10) - } else { - iter.ReportError("readU4", "expects 0~9 or a~f, but found "+string([]byte{c})) - return - } - } - return ret -} - -const ( - t1 = 0x00 // 0000 0000 - tx = 0x80 // 1000 0000 - t2 = 0xC0 // 1100 0000 - t3 = 0xE0 // 1110 0000 - t4 = 0xF0 // 1111 0000 - t5 = 0xF8 // 1111 1000 - - maskx = 0x3F // 0011 1111 - mask2 = 0x1F // 0001 1111 - mask3 = 0x0F // 0000 1111 - mask4 = 0x07 // 0000 0111 - - rune1Max = 1<<7 - 1 - rune2Max = 1<<11 - 1 - rune3Max = 1<<16 - 1 - - surrogateMin = 0xD800 - surrogateMax = 0xDFFF - - maxRune = '\U0010FFFF' // Maximum valid Unicode code point. - runeError = '\uFFFD' // the "error" Rune or "Unicode replacement character" -) - -func appendRune(p []byte, r rune) []byte { - // Negative values are erroneous. Making it unsigned addresses the problem. - switch i := uint32(r); { - case i <= rune1Max: - p = append(p, byte(r)) - return p - case i <= rune2Max: - p = append(p, t2|byte(r>>6)) - p = append(p, tx|byte(r)&maskx) - return p - case i > maxRune, surrogateMin <= i && i <= surrogateMax: - r = runeError - fallthrough - case i <= rune3Max: - p = append(p, t3|byte(r>>12)) - p = append(p, tx|byte(r>>6)&maskx) - p = append(p, tx|byte(r)&maskx) - return p - default: - p = append(p, t4|byte(r>>18)) - p = append(p, tx|byte(r>>12)&maskx) - p = append(p, tx|byte(r>>6)&maskx) - p = append(p, tx|byte(r)&maskx) - return p - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter.go b/vendor/github.com/json-iterator/go/jsoniter.go deleted file mode 100644 index c2934f916..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter.go +++ /dev/null @@ -1,18 +0,0 @@ -// Package jsoniter implements encoding and decoding of JSON as defined in -// RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json. -// Converting from encoding/json to jsoniter is no more than replacing the package with jsoniter -// and variable type declarations (if any). -// jsoniter interfaces gives 100% compatibility with code using standard lib. -// -// "JSON and Go" -// (https://golang.org/doc/articles/json_and_go.html) -// gives a description of how Marshal/Unmarshal operate -// between arbitrary or predefined json objects and bytes, -// and it applies to jsoniter.Marshal/Unmarshal as well. -// -// Besides, jsoniter.Iterator provides a different set of interfaces -// iterating given bytes/string/reader -// and yielding parsed elements one by one. -// This set of interfaces reads input as required and gives -// better performance. -package jsoniter diff --git a/vendor/github.com/json-iterator/go/pool.go b/vendor/github.com/json-iterator/go/pool.go deleted file mode 100644 index e2389b56c..000000000 --- a/vendor/github.com/json-iterator/go/pool.go +++ /dev/null @@ -1,42 +0,0 @@ -package jsoniter - -import ( - "io" -) - -// IteratorPool a thread safe pool of iterators with same configuration -type IteratorPool interface { - BorrowIterator(data []byte) *Iterator - ReturnIterator(iter *Iterator) -} - -// StreamPool a thread safe pool of streams with same configuration -type StreamPool interface { - BorrowStream(writer io.Writer) *Stream - ReturnStream(stream *Stream) -} - -func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream { - stream := cfg.streamPool.Get().(*Stream) - stream.Reset(writer) - return stream -} - -func (cfg *frozenConfig) ReturnStream(stream *Stream) { - stream.out = nil - stream.Error = nil - stream.Attachment = nil - cfg.streamPool.Put(stream) -} - -func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator { - iter := cfg.iteratorPool.Get().(*Iterator) - iter.ResetBytes(data) - return iter -} - -func (cfg *frozenConfig) ReturnIterator(iter *Iterator) { - iter.Error = nil - iter.Attachment = nil - cfg.iteratorPool.Put(iter) -} diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go deleted file mode 100644 index 74974ba74..000000000 --- a/vendor/github.com/json-iterator/go/reflect.go +++ /dev/null @@ -1,337 +0,0 @@ -package jsoniter - -import ( - "fmt" - "reflect" - "unsafe" - - "github.com/modern-go/reflect2" -) - -// ValDecoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValDecoder with json.Decoder. -// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). -// -// Reflection on type to create decoders, which is then cached -// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions -// 1. create instance of new value, for example *int will need a int to be allocated -// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New -// 3. assignment to map, both key and value will be reflect.Value -// For a simple struct binding, it will be reflect.Value free and allocation free -type ValDecoder interface { - Decode(ptr unsafe.Pointer, iter *Iterator) -} - -// ValEncoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValEncoder with json.Encoder. -// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). -type ValEncoder interface { - IsEmpty(ptr unsafe.Pointer) bool - Encode(ptr unsafe.Pointer, stream *Stream) -} - -type checkIsEmpty interface { - IsEmpty(ptr unsafe.Pointer) bool -} - -type ctx struct { - *frozenConfig - prefix string - encoders map[reflect2.Type]ValEncoder - decoders map[reflect2.Type]ValDecoder -} - -func (b *ctx) caseSensitive() bool { - if b.frozenConfig == nil { - // default is case-insensitive - return false - } - return b.frozenConfig.caseSensitive -} - -func (b *ctx) append(prefix string) *ctx { - return &ctx{ - frozenConfig: b.frozenConfig, - prefix: b.prefix + " " + prefix, - encoders: b.encoders, - decoders: b.decoders, - } -} - -// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal -func (iter *Iterator) ReadVal(obj interface{}) { - depth := iter.depth - cacheKey := reflect2.RTypeOf(obj) - decoder := iter.cfg.getDecoderFromCache(cacheKey) - if decoder == nil { - typ := reflect2.TypeOf(obj) - if typ.Kind() != reflect.Ptr { - iter.ReportError("ReadVal", "can only unmarshal into pointer") - return - } - decoder = iter.cfg.DecoderOf(typ) - } - ptr := reflect2.PtrOf(obj) - if ptr == nil { - iter.ReportError("ReadVal", "can not read into nil pointer") - return - } - decoder.Decode(ptr, iter) - if iter.depth != depth { - iter.ReportError("ReadVal", "unexpected mismatched nesting") - return - } -} - -// WriteVal copy the go interface into underlying JSON, same as json.Marshal -func (stream *Stream) WriteVal(val interface{}) { - if nil == val { - stream.WriteNil() - return - } - cacheKey := reflect2.RTypeOf(val) - encoder := stream.cfg.getEncoderFromCache(cacheKey) - if encoder == nil { - typ := reflect2.TypeOf(val) - encoder = stream.cfg.EncoderOf(typ) - } - encoder.Encode(reflect2.PtrOf(val), stream) -} - -func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder { - cacheKey := typ.RType() - decoder := cfg.getDecoderFromCache(cacheKey) - if decoder != nil { - return decoder - } - ctx := &ctx{ - frozenConfig: cfg, - prefix: "", - decoders: map[reflect2.Type]ValDecoder{}, - encoders: map[reflect2.Type]ValEncoder{}, - } - ptrType := typ.(*reflect2.UnsafePtrType) - decoder = decoderOfType(ctx, ptrType.Elem()) - cfg.addDecoderToCache(cacheKey, decoder) - return decoder -} - -func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := getTypeDecoderFromExtension(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfType(ctx, typ) - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) - for _, extension := range ctx.extraExtensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - return decoder -} - -func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := ctx.decoders[typ] - if decoder != nil { - return decoder - } - placeholder := &placeholderDecoder{} - ctx.decoders[typ] = placeholder - decoder = _createDecoderOfType(ctx, typ) - placeholder.decoder = decoder - return decoder -} - -func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := createDecoderOfJsonRawMessage(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfJsonNumber(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfMarshaler(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfAny(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfNative(ctx, typ) - if decoder != nil { - return decoder - } - switch typ.Kind() { - case reflect.Interface: - ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType) - if isIFace { - return &ifaceDecoder{valType: ifaceType} - } - return &efaceDecoder{} - case reflect.Struct: - return decoderOfStruct(ctx, typ) - case reflect.Array: - return decoderOfArray(ctx, typ) - case reflect.Slice: - return decoderOfSlice(ctx, typ) - case reflect.Map: - return decoderOfMap(ctx, typ) - case reflect.Ptr: - return decoderOfOptional(ctx, typ) - default: - return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} - } -} - -func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder { - cacheKey := typ.RType() - encoder := cfg.getEncoderFromCache(cacheKey) - if encoder != nil { - return encoder - } - ctx := &ctx{ - frozenConfig: cfg, - prefix: "", - decoders: map[reflect2.Type]ValDecoder{}, - encoders: map[reflect2.Type]ValEncoder{}, - } - encoder = encoderOfType(ctx, typ) - if typ.LikePtr() { - encoder = &onePtrEncoder{encoder} - } - cfg.addEncoderToCache(cacheKey, encoder) - return encoder -} - -type onePtrEncoder struct { - encoder ValEncoder -} - -func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) -} - -func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) -} - -func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := getTypeEncoderFromExtension(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfType(ctx, typ) - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) - for _, extension := range ctx.extraExtensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - return encoder -} - -func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := ctx.encoders[typ] - if encoder != nil { - return encoder - } - placeholder := &placeholderEncoder{} - ctx.encoders[typ] = placeholder - encoder = _createEncoderOfType(ctx, typ) - placeholder.encoder = encoder - return encoder -} -func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := createEncoderOfJsonRawMessage(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfJsonNumber(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfMarshaler(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfAny(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfNative(ctx, typ) - if encoder != nil { - return encoder - } - kind := typ.Kind() - switch kind { - case reflect.Interface: - return &dynamicEncoder{typ} - case reflect.Struct: - return encoderOfStruct(ctx, typ) - case reflect.Array: - return encoderOfArray(ctx, typ) - case reflect.Slice: - return encoderOfSlice(ctx, typ) - case reflect.Map: - return encoderOfMap(ctx, typ) - case reflect.Ptr: - return encoderOfOptional(ctx, typ) - default: - return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} - } -} - -type lazyErrorDecoder struct { - err error -} - -func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() != NilValue { - if iter.Error == nil { - iter.Error = decoder.err - } - } else { - iter.Skip() - } -} - -type lazyErrorEncoder struct { - err error -} - -func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if ptr == nil { - stream.WriteNil() - } else if stream.Error == nil { - stream.Error = encoder.err - } -} - -func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type placeholderDecoder struct { - decoder ValDecoder -} - -func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.decoder.Decode(ptr, iter) -} - -type placeholderEncoder struct { - encoder ValEncoder -} - -func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(ptr, stream) -} - -func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(ptr) -} diff --git a/vendor/github.com/json-iterator/go/reflect_array.go b/vendor/github.com/json-iterator/go/reflect_array.go deleted file mode 100644 index 13a0b7b08..000000000 --- a/vendor/github.com/json-iterator/go/reflect_array.go +++ /dev/null @@ -1,104 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "unsafe" -) - -func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { - arrayType := typ.(*reflect2.UnsafeArrayType) - decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) - return &arrayDecoder{arrayType, decoder} -} - -func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder { - arrayType := typ.(*reflect2.UnsafeArrayType) - if arrayType.Len() == 0 { - return emptyArrayEncoder{} - } - encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) - return &arrayEncoder{arrayType, encoder} -} - -type emptyArrayEncoder struct{} - -func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyArray() -} - -func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return true -} - -type arrayEncoder struct { - arrayType *reflect2.UnsafeArrayType - elemEncoder ValEncoder -} - -func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(ptr) - encoder.elemEncoder.Encode(elemPtr, stream) - for i := 1; i < encoder.arrayType.Len(); i++ { - stream.WriteMore() - elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i) - encoder.elemEncoder.Encode(elemPtr, stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) - } -} - -func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type arrayDecoder struct { - arrayType *reflect2.UnsafeArrayType - elemDecoder ValDecoder -} - -func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) - } -} - -func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - arrayType := decoder.arrayType - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return - } - if c != '[' { - iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c})) - return - } - c = iter.nextToken() - if c == ']' { - return - } - iter.unreadByte() - elemPtr := arrayType.UnsafeGetIndex(ptr, 0) - decoder.elemDecoder.Decode(elemPtr, iter) - length := 1 - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - if length >= arrayType.Len() { - iter.Skip() - continue - } - idx := length - length += 1 - elemPtr = arrayType.UnsafeGetIndex(ptr, idx) - decoder.elemDecoder.Decode(elemPtr, iter) - } - if c != ']' { - iter.ReportError("decode array", "expect ], but found "+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_dynamic.go b/vendor/github.com/json-iterator/go/reflect_dynamic.go deleted file mode 100644 index 8b6bc8b43..000000000 --- a/vendor/github.com/json-iterator/go/reflect_dynamic.go +++ /dev/null @@ -1,70 +0,0 @@ -package jsoniter - -import ( - "github.com/modern-go/reflect2" - "reflect" - "unsafe" -) - -type dynamicEncoder struct { - valType reflect2.Type -} - -func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - stream.WriteVal(obj) -} - -func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.valType.UnsafeIndirect(ptr) == nil -} - -type efaceDecoder struct { -} - -func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - pObj := (*interface{})(ptr) - obj := *pObj - if obj == nil { - *pObj = iter.Read() - return - } - typ := reflect2.TypeOf(obj) - if typ.Kind() != reflect.Ptr { - *pObj = iter.Read() - return - } - ptrType := typ.(*reflect2.UnsafePtrType) - ptrElemType := ptrType.Elem() - if iter.WhatIsNext() == NilValue { - if ptrElemType.Kind() != reflect.Ptr { - iter.skipFourBytes('n', 'u', 'l', 'l') - *pObj = nil - return - } - } - if reflect2.IsNil(obj) { - obj := ptrElemType.New() - iter.ReadVal(obj) - *pObj = obj - return - } - iter.ReadVal(obj) -} - -type ifaceDecoder struct { - valType *reflect2.UnsafeIFaceType -} - -func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew()) - return - } - obj := decoder.valType.UnsafeIndirect(ptr) - if reflect2.IsNil(obj) { - iter.ReportError("decode non empty interface", "can not unmarshal into nil") - return - } - iter.ReadVal(obj) -} diff --git a/vendor/github.com/json-iterator/go/reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go deleted file mode 100644 index 74a97bfe5..000000000 --- a/vendor/github.com/json-iterator/go/reflect_extension.go +++ /dev/null @@ -1,483 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "reflect" - "sort" - "strings" - "unicode" - "unsafe" -) - -var typeDecoders = map[string]ValDecoder{} -var fieldDecoders = map[string]ValDecoder{} -var typeEncoders = map[string]ValEncoder{} -var fieldEncoders = map[string]ValEncoder{} -var extensions = []Extension{} - -// StructDescriptor describe how should we encode/decode the struct -type StructDescriptor struct { - Type reflect2.Type - Fields []*Binding -} - -// GetField get one field from the descriptor by its name. -// Can not use map here to keep field orders. -func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { - for _, binding := range structDescriptor.Fields { - if binding.Field.Name() == fieldName { - return binding - } - } - return nil -} - -// Binding describe how should we encode/decode the struct field -type Binding struct { - levels []int - Field reflect2.StructField - FromNames []string - ToNames []string - Encoder ValEncoder - Decoder ValDecoder -} - -// Extension the one for all SPI. Customize encoding/decoding by specifying alternate encoder/decoder. -// Can also rename fields by UpdateStructDescriptor. -type Extension interface { - UpdateStructDescriptor(structDescriptor *StructDescriptor) - CreateMapKeyDecoder(typ reflect2.Type) ValDecoder - CreateMapKeyEncoder(typ reflect2.Type) ValEncoder - CreateDecoder(typ reflect2.Type) ValDecoder - CreateEncoder(typ reflect2.Type) ValEncoder - DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder - DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder -} - -// DummyExtension embed this type get dummy implementation for all methods of Extension -type DummyExtension struct { -} - -// UpdateStructDescriptor No-op -func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateMapKeyDecoder No-op -func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension *DummyExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// CreateDecoder No-op -func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateEncoder No-op -func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type EncoderExtension map[reflect2.Type]ValEncoder - -// UpdateStructDescriptor No-op -func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateDecoder No-op -func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateEncoder get encoder from map -func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return extension[typ] -} - -// CreateMapKeyDecoder No-op -func (extension EncoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension EncoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type DecoderExtension map[reflect2.Type]ValDecoder - -// UpdateStructDescriptor No-op -func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateMapKeyDecoder No-op -func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension DecoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// CreateDecoder get decoder from map -func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return extension[typ] -} - -// CreateEncoder No-op -func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type funcDecoder struct { - fun DecoderFunc -} - -func (decoder *funcDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.fun(ptr, iter) -} - -type funcEncoder struct { - fun EncoderFunc - isEmptyFunc func(ptr unsafe.Pointer) bool -} - -func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.fun(ptr, stream) -} - -func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { - if encoder.isEmptyFunc == nil { - return false - } - return encoder.isEmptyFunc(ptr) -} - -// DecoderFunc the function form of TypeDecoder -type DecoderFunc func(ptr unsafe.Pointer, iter *Iterator) - -// EncoderFunc the function form of TypeEncoder -type EncoderFunc func(ptr unsafe.Pointer, stream *Stream) - -// RegisterTypeDecoderFunc register TypeDecoder for a type with function -func RegisterTypeDecoderFunc(typ string, fun DecoderFunc) { - typeDecoders[typ] = &funcDecoder{fun} -} - -// RegisterTypeDecoder register TypeDecoder for a typ -func RegisterTypeDecoder(typ string, decoder ValDecoder) { - typeDecoders[typ] = decoder -} - -// RegisterFieldDecoderFunc register TypeDecoder for a struct field with function -func RegisterFieldDecoderFunc(typ string, field string, fun DecoderFunc) { - RegisterFieldDecoder(typ, field, &funcDecoder{fun}) -} - -// RegisterFieldDecoder register TypeDecoder for a struct field -func RegisterFieldDecoder(typ string, field string, decoder ValDecoder) { - fieldDecoders[fmt.Sprintf("%s/%s", typ, field)] = decoder -} - -// RegisterTypeEncoderFunc register TypeEncoder for a type with encode/isEmpty function -func RegisterTypeEncoderFunc(typ string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { - typeEncoders[typ] = &funcEncoder{fun, isEmptyFunc} -} - -// RegisterTypeEncoder register TypeEncoder for a type -func RegisterTypeEncoder(typ string, encoder ValEncoder) { - typeEncoders[typ] = encoder -} - -// RegisterFieldEncoderFunc register TypeEncoder for a struct field with encode/isEmpty function -func RegisterFieldEncoderFunc(typ string, field string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { - RegisterFieldEncoder(typ, field, &funcEncoder{fun, isEmptyFunc}) -} - -// RegisterFieldEncoder register TypeEncoder for a struct field -func RegisterFieldEncoder(typ string, field string, encoder ValEncoder) { - fieldEncoders[fmt.Sprintf("%s/%s", typ, field)] = encoder -} - -// RegisterExtension register extension -func RegisterExtension(extension Extension) { - extensions = append(extensions, extension) -} - -func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := _getTypeDecoderFromExtension(ctx, typ) - if decoder != nil { - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) - for _, extension := range ctx.extraExtensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - } - return decoder -} -func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { - for _, extension := range extensions { - decoder := extension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - } - decoder := ctx.decoderExtension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - for _, extension := range ctx.extraExtensions { - decoder := extension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - } - typeName := typ.String() - decoder = typeDecoders[typeName] - if decoder != nil { - return decoder - } - if typ.Kind() == reflect.Ptr { - ptrType := typ.(*reflect2.UnsafePtrType) - decoder := typeDecoders[ptrType.Elem().String()] - if decoder != nil { - return &OptionalDecoder{ptrType.Elem(), decoder} - } - } - return nil -} - -func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := _getTypeEncoderFromExtension(ctx, typ) - if encoder != nil { - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) - for _, extension := range ctx.extraExtensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - } - return encoder -} - -func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { - for _, extension := range extensions { - encoder := extension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - } - encoder := ctx.encoderExtension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - for _, extension := range ctx.extraExtensions { - encoder := extension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - } - typeName := typ.String() - encoder = typeEncoders[typeName] - if encoder != nil { - return encoder - } - if typ.Kind() == reflect.Ptr { - typePtr := typ.(*reflect2.UnsafePtrType) - encoder := typeEncoders[typePtr.Elem().String()] - if encoder != nil { - return &OptionalEncoder{encoder} - } - } - return nil -} - -func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { - structType := typ.(*reflect2.UnsafeStructType) - embeddedBindings := []*Binding{} - bindings := []*Binding{} - for i := 0; i < structType.NumField(); i++ { - field := structType.Field(i) - tag, hastag := field.Tag().Lookup(ctx.getTagKey()) - if ctx.onlyTaggedField && !hastag && !field.Anonymous() { - continue - } - if tag == "-" || field.Name() == "_" { - continue - } - tagParts := strings.Split(tag, ",") - if field.Anonymous() && (tag == "" || tagParts[0] == "") { - if field.Type().Kind() == reflect.Struct { - structDescriptor := describeStruct(ctx, field.Type()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} - binding.Decoder = &structFieldDecoder{field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue - } else if field.Type().Kind() == reflect.Ptr { - ptrType := field.Type().(*reflect2.UnsafePtrType) - if ptrType.Elem().Kind() == reflect.Struct { - structDescriptor := describeStruct(ctx, ptrType.Elem()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &dereferenceEncoder{binding.Encoder} - binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} - binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder} - binding.Decoder = &structFieldDecoder{field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue - } - } - } - fieldNames := calcFieldNames(field.Name(), tagParts[0], tag) - fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name()) - decoder := fieldDecoders[fieldCacheKey] - if decoder == nil { - decoder = decoderOfType(ctx.append(field.Name()), field.Type()) - } - encoder := fieldEncoders[fieldCacheKey] - if encoder == nil { - encoder = encoderOfType(ctx.append(field.Name()), field.Type()) - } - binding := &Binding{ - Field: field, - FromNames: fieldNames, - ToNames: fieldNames, - Decoder: decoder, - Encoder: encoder, - } - binding.levels = []int{i} - bindings = append(bindings, binding) - } - return createStructDescriptor(ctx, typ, bindings, embeddedBindings) -} -func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { - structDescriptor := &StructDescriptor{ - Type: typ, - Fields: bindings, - } - for _, extension := range extensions { - extension.UpdateStructDescriptor(structDescriptor) - } - ctx.encoderExtension.UpdateStructDescriptor(structDescriptor) - ctx.decoderExtension.UpdateStructDescriptor(structDescriptor) - for _, extension := range ctx.extraExtensions { - extension.UpdateStructDescriptor(structDescriptor) - } - processTags(structDescriptor, ctx.frozenConfig) - // merge normal & embedded bindings & sort with original order - allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...)) - sort.Sort(allBindings) - structDescriptor.Fields = allBindings - return structDescriptor -} - -type sortableBindings []*Binding - -func (bindings sortableBindings) Len() int { - return len(bindings) -} - -func (bindings sortableBindings) Less(i, j int) bool { - left := bindings[i].levels - right := bindings[j].levels - k := 0 - for { - if left[k] < right[k] { - return true - } else if left[k] > right[k] { - return false - } - k++ - } -} - -func (bindings sortableBindings) Swap(i, j int) { - bindings[i], bindings[j] = bindings[j], bindings[i] -} - -func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) { - for _, binding := range structDescriptor.Fields { - shouldOmitEmpty := false - tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",") - for _, tagPart := range tagParts[1:] { - if tagPart == "omitempty" { - shouldOmitEmpty = true - } else if tagPart == "string" { - if binding.Field.Type().Kind() == reflect.String { - binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg} - binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg} - } else { - binding.Decoder = &stringModeNumberDecoder{binding.Decoder} - binding.Encoder = &stringModeNumberEncoder{binding.Encoder} - } - } - } - binding.Decoder = &structFieldDecoder{binding.Field, binding.Decoder} - binding.Encoder = &structFieldEncoder{binding.Field, binding.Encoder, shouldOmitEmpty} - } -} - -func calcFieldNames(originalFieldName string, tagProvidedFieldName string, wholeTag string) []string { - // ignore? - if wholeTag == "-" { - return []string{} - } - // rename? - var fieldNames []string - if tagProvidedFieldName == "" { - fieldNames = []string{originalFieldName} - } else { - fieldNames = []string{tagProvidedFieldName} - } - // private? - isNotExported := unicode.IsLower(rune(originalFieldName[0])) || originalFieldName[0] == '_' - if isNotExported { - fieldNames = []string{} - } - return fieldNames -} diff --git a/vendor/github.com/json-iterator/go/reflect_json_number.go b/vendor/github.com/json-iterator/go/reflect_json_number.go deleted file mode 100644 index 98d45c1ec..000000000 --- a/vendor/github.com/json-iterator/go/reflect_json_number.go +++ /dev/null @@ -1,112 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/modern-go/reflect2" - "strconv" - "unsafe" -) - -type Number string - -// String returns the literal text of the number. -func (n Number) String() string { return string(n) } - -// Float64 returns the number as a float64. -func (n Number) Float64() (float64, error) { - return strconv.ParseFloat(string(n), 64) -} - -// Int64 returns the number as an int64. -func (n Number) Int64() (int64, error) { - return strconv.ParseInt(string(n), 10, 64) -} - -func CastJsonNumber(val interface{}) (string, bool) { - switch typedVal := val.(type) { - case json.Number: - return string(typedVal), true - case Number: - return string(typedVal), true - } - return "", false -} - -var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem() -var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem() - -func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - return nil -} - -func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - return nil -} - -type jsonNumberCodec struct { -} - -func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*json.Number)(ptr)) = json.Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*json.Number)(ptr)) = "" - default: - *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*json.Number)(ptr)) - if len(number) == 0 { - stream.writeByte('0') - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.Number)(ptr))) == 0 -} - -type jsoniterNumberCodec struct { -} - -func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*Number)(ptr)) = Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*Number)(ptr)) = "" - default: - *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*Number)(ptr)) - if len(number) == 0 { - stream.writeByte('0') - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*Number)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go deleted file mode 100644 index f2619936c..000000000 --- a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go +++ /dev/null @@ -1,60 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/modern-go/reflect2" - "unsafe" -) - -var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() -var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem() - -func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - return nil -} - -func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - return nil -} - -type jsonRawMessageCodec struct { -} - -func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes()) -} - -func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) -} - -func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 -} - -type jsoniterRawMessageCodec struct { -} - -func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes()) -} - -func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*RawMessage)(ptr)))) -} - -func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*RawMessage)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go deleted file mode 100644 index 582967130..000000000 --- a/vendor/github.com/json-iterator/go/reflect_map.go +++ /dev/null @@ -1,346 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "sort" - "unsafe" -) - -func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { - mapType := typ.(*reflect2.UnsafeMapType) - keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()) - elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem()) - return &mapDecoder{ - mapType: mapType, - keyType: mapType.Key(), - elemType: mapType.Elem(), - keyDecoder: keyDecoder, - elemDecoder: elemDecoder, - } -} - -func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder { - mapType := typ.(*reflect2.UnsafeMapType) - if ctx.sortMapKeys { - return &sortKeysMapEncoder{ - mapType: mapType, - keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), - elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), - } - } - return &mapEncoder{ - mapType: mapType, - keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), - elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), - } -} - -func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := ctx.decoderExtension.CreateMapKeyDecoder(typ) - if decoder != nil { - return decoder - } - for _, extension := range ctx.extraExtensions { - decoder := extension.CreateMapKeyDecoder(typ) - if decoder != nil { - return decoder - } - } - - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(unmarshalerType) { - return &unmarshalerDecoder{ - valType: typ, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(textUnmarshalerType) { - return &textUnmarshalerDecoder{ - valType: typ, - } - } - - switch typ.Kind() { - case reflect.String: - return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) - case reflect.Bool, - reflect.Uint8, reflect.Int8, - reflect.Uint16, reflect.Int16, - reflect.Uint32, reflect.Int32, - reflect.Uint64, reflect.Int64, - reflect.Uint, reflect.Int, - reflect.Float32, reflect.Float64, - reflect.Uintptr: - typ = reflect2.DefaultTypeOfKind(typ.Kind()) - return &numericMapKeyDecoder{decoderOfType(ctx, typ)} - default: - return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} - } -} - -func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := ctx.encoderExtension.CreateMapKeyEncoder(typ) - if encoder != nil { - return encoder - } - for _, extension := range ctx.extraExtensions { - encoder := extension.CreateMapKeyEncoder(typ) - if encoder != nil { - return encoder - } - } - - if typ == textMarshalerType { - return &directTextMarshalerEncoder{ - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - if typ.Implements(textMarshalerType) { - return &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - - switch typ.Kind() { - case reflect.String: - return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) - case reflect.Bool, - reflect.Uint8, reflect.Int8, - reflect.Uint16, reflect.Int16, - reflect.Uint32, reflect.Int32, - reflect.Uint64, reflect.Int64, - reflect.Uint, reflect.Int, - reflect.Float32, reflect.Float64, - reflect.Uintptr: - typ = reflect2.DefaultTypeOfKind(typ.Kind()) - return &numericMapKeyEncoder{encoderOfType(ctx, typ)} - default: - if typ.Kind() == reflect.Interface { - return &dynamicMapKeyEncoder{ctx, typ} - } - return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)} - } -} - -type mapDecoder struct { - mapType *reflect2.UnsafeMapType - keyType reflect2.Type - elemType reflect2.Type - keyDecoder ValDecoder - elemDecoder ValDecoder -} - -func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - mapType := decoder.mapType - c := iter.nextToken() - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - *(*unsafe.Pointer)(ptr) = nil - mapType.UnsafeSet(ptr, mapType.UnsafeNew()) - return - } - if mapType.UnsafeIsNil(ptr) { - mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0)) - } - if c != '{' { - iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) - return - } - c = iter.nextToken() - if c == '}' { - return - } - iter.unreadByte() - key := decoder.keyType.UnsafeNew() - decoder.keyDecoder.Decode(key, iter) - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - return - } - elem := decoder.elemType.UnsafeNew() - decoder.elemDecoder.Decode(elem, iter) - decoder.mapType.UnsafeSetIndex(ptr, key, elem) - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - key := decoder.keyType.UnsafeNew() - decoder.keyDecoder.Decode(key, iter) - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - return - } - elem := decoder.elemType.UnsafeNew() - decoder.elemDecoder.Decode(elem, iter) - decoder.mapType.UnsafeSetIndex(ptr, key, elem) - } - if c != '}' { - iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c})) - } -} - -type numericMapKeyDecoder struct { - decoder ValDecoder -} - -func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - if c != '"' { - iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) - return - } - decoder.decoder.Decode(ptr, iter) - c = iter.nextToken() - if c != '"' { - iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) - return - } -} - -type numericMapKeyEncoder struct { - encoder ValEncoder -} - -func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.encoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type dynamicMapKeyEncoder struct { - ctx *ctx - valType reflect2.Type -} - -func (encoder *dynamicMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).Encode(reflect2.PtrOf(obj), stream) -} - -func (encoder *dynamicMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { - obj := encoder.valType.UnsafeIndirect(ptr) - return encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).IsEmpty(reflect2.PtrOf(obj)) -} - -type mapEncoder struct { - mapType *reflect2.UnsafeMapType - keyEncoder ValEncoder - elemEncoder ValEncoder -} - -func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *(*unsafe.Pointer)(ptr) == nil { - stream.WriteNil() - return - } - stream.WriteObjectStart() - iter := encoder.mapType.UnsafeIterate(ptr) - for i := 0; iter.HasNext(); i++ { - if i != 0 { - stream.WriteMore() - } - key, elem := iter.UnsafeNext() - encoder.keyEncoder.Encode(key, stream) - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - encoder.elemEncoder.Encode(elem, stream) - } - stream.WriteObjectEnd() -} - -func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - iter := encoder.mapType.UnsafeIterate(ptr) - return !iter.HasNext() -} - -type sortKeysMapEncoder struct { - mapType *reflect2.UnsafeMapType - keyEncoder ValEncoder - elemEncoder ValEncoder -} - -func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *(*unsafe.Pointer)(ptr) == nil { - stream.WriteNil() - return - } - stream.WriteObjectStart() - mapIter := encoder.mapType.UnsafeIterate(ptr) - subStream := stream.cfg.BorrowStream(nil) - subStream.Attachment = stream.Attachment - subIter := stream.cfg.BorrowIterator(nil) - keyValues := encodedKeyValues{} - for mapIter.HasNext() { - key, elem := mapIter.UnsafeNext() - subStreamIndex := subStream.Buffered() - encoder.keyEncoder.Encode(key, subStream) - if subStream.Error != nil && subStream.Error != io.EOF && stream.Error == nil { - stream.Error = subStream.Error - } - encodedKey := subStream.Buffer()[subStreamIndex:] - subIter.ResetBytes(encodedKey) - decodedKey := subIter.ReadString() - if stream.indention > 0 { - subStream.writeTwoBytes(byte(':'), byte(' ')) - } else { - subStream.writeByte(':') - } - encoder.elemEncoder.Encode(elem, subStream) - keyValues = append(keyValues, encodedKV{ - key: decodedKey, - keyValue: subStream.Buffer()[subStreamIndex:], - }) - } - sort.Sort(keyValues) - for i, keyValue := range keyValues { - if i != 0 { - stream.WriteMore() - } - stream.Write(keyValue.keyValue) - } - if subStream.Error != nil && stream.Error == nil { - stream.Error = subStream.Error - } - stream.WriteObjectEnd() - stream.cfg.ReturnStream(subStream) - stream.cfg.ReturnIterator(subIter) -} - -func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - iter := encoder.mapType.UnsafeIterate(ptr) - return !iter.HasNext() -} - -type encodedKeyValues []encodedKV - -type encodedKV struct { - key string - keyValue []byte -} - -func (sv encodedKeyValues) Len() int { return len(sv) } -func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key } diff --git a/vendor/github.com/json-iterator/go/reflect_marshaler.go b/vendor/github.com/json-iterator/go/reflect_marshaler.go deleted file mode 100644 index 3e21f3756..000000000 --- a/vendor/github.com/json-iterator/go/reflect_marshaler.go +++ /dev/null @@ -1,225 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "unsafe" - - "github.com/modern-go/reflect2" -) - -var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem() -var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem() -var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem() -var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem() - -func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder { - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ptrType}, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ptrType}, - } - } - return nil -} - -func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == marshalerType { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &directMarshalerEncoder{ - checkIsEmpty: checkIsEmpty, - } - return encoder - } - if typ.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &marshalerEncoder{ - valType: typ, - checkIsEmpty: checkIsEmpty, - } - return encoder - } - ptrType := reflect2.PtrTo(typ) - if ctx.prefix != "" && ptrType.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, ptrType) - var encoder ValEncoder = &marshalerEncoder{ - valType: ptrType, - checkIsEmpty: checkIsEmpty, - } - return &referenceEncoder{encoder} - } - if typ == textMarshalerType { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &directTextMarshalerEncoder{ - checkIsEmpty: checkIsEmpty, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - return encoder - } - if typ.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - checkIsEmpty: checkIsEmpty, - } - return encoder - } - // if prefix is empty, the type is the root type - if ctx.prefix != "" && ptrType.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, ptrType) - var encoder ValEncoder = &textMarshalerEncoder{ - valType: ptrType, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - checkIsEmpty: checkIsEmpty, - } - return &referenceEncoder{encoder} - } - return nil -} - -type marshalerEncoder struct { - checkIsEmpty checkIsEmpty - valType reflect2.Type -} - -func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - if encoder.valType.IsNullable() && reflect2.IsNil(obj) { - stream.WriteNil() - return - } - marshaler := obj.(json.Marshaler) - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - // html escape was already done by jsoniter - // but the extra '\n' should be trimed - l := len(bytes) - if l > 0 && bytes[l-1] == '\n' { - bytes = bytes[:l-1] - } - stream.Write(bytes) - } -} - -func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type directMarshalerEncoder struct { - checkIsEmpty checkIsEmpty -} - -func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - marshaler := *(*json.Marshaler)(ptr) - if marshaler == nil { - stream.WriteNil() - return - } - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - stream.Write(bytes) - } -} - -func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type textMarshalerEncoder struct { - valType reflect2.Type - stringEncoder ValEncoder - checkIsEmpty checkIsEmpty -} - -func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - if encoder.valType.IsNullable() && reflect2.IsNil(obj) { - stream.WriteNil() - return - } - marshaler := (obj).(encoding.TextMarshaler) - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - str := string(bytes) - encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) - } -} - -func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type directTextMarshalerEncoder struct { - stringEncoder ValEncoder - checkIsEmpty checkIsEmpty -} - -func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - marshaler := *(*encoding.TextMarshaler)(ptr) - if marshaler == nil { - stream.WriteNil() - return - } - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - str := string(bytes) - encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) - } -} - -func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type unmarshalerDecoder struct { - valType reflect2.Type -} - -func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valType := decoder.valType - obj := valType.UnsafeIndirect(ptr) - unmarshaler := obj.(json.Unmarshaler) - iter.nextToken() - iter.unreadByte() // skip spaces - bytes := iter.SkipAndReturnBytes() - err := unmarshaler.UnmarshalJSON(bytes) - if err != nil { - iter.ReportError("unmarshalerDecoder", err.Error()) - } -} - -type textUnmarshalerDecoder struct { - valType reflect2.Type -} - -func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valType := decoder.valType - obj := valType.UnsafeIndirect(ptr) - if reflect2.IsNil(obj) { - ptrType := valType.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - elem := elemType.UnsafeNew() - ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem)) - obj = valType.UnsafeIndirect(ptr) - } - unmarshaler := (obj).(encoding.TextUnmarshaler) - str := iter.ReadString() - err := unmarshaler.UnmarshalText([]byte(str)) - if err != nil { - iter.ReportError("textUnmarshalerDecoder", err.Error()) - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go deleted file mode 100644 index f88722d14..000000000 --- a/vendor/github.com/json-iterator/go/reflect_native.go +++ /dev/null @@ -1,453 +0,0 @@ -package jsoniter - -import ( - "encoding/base64" - "reflect" - "strconv" - "unsafe" - - "github.com/modern-go/reflect2" -) - -const ptrSize = 32 << uintptr(^uintptr(0)>>63) - -func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(ctx, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - typeName := typ.String() - kind := typ.Kind() - switch kind { - case reflect.String: - if typeName != "string" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &int32Codec{} - } - return &int64Codec{} - case reflect.Int8: - if typeName != "int8" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint8: - if typeName != "uint8" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) - } - if ptrSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint64: - if typeName != "uint64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) - } - return &boolCodec{} - } - return nil -} - -func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(ctx, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - typeName := typ.String() - switch typ.Kind() { - case reflect.String: - if typeName != "string" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &int32Codec{} - } - return &int64Codec{} - case reflect.Int8: - if typeName != "int8" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint8: - if typeName != "uint8" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) - } - if ptrSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint64: - if typeName != "uint64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) - } - return &boolCodec{} - } - return nil -} - -type stringCodec struct { -} - -func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = iter.ReadString() -} - -func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteString(str) -} - -func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -type int8Codec struct { -} - -func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int8)(ptr)) = iter.ReadInt8() - } -} - -func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt8(*((*int8)(ptr))) -} - -func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int8)(ptr)) == 0 -} - -type int16Codec struct { -} - -func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int16)(ptr)) = iter.ReadInt16() - } -} - -func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt16(*((*int16)(ptr))) -} - -func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int16)(ptr)) == 0 -} - -type int32Codec struct { -} - -func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int32)(ptr)) = iter.ReadInt32() - } -} - -func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt32(*((*int32)(ptr))) -} - -func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int32)(ptr)) == 0 -} - -type int64Codec struct { -} - -func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int64)(ptr)) = iter.ReadInt64() - } -} - -func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt64(*((*int64)(ptr))) -} - -func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int64)(ptr)) == 0 -} - -type uint8Codec struct { -} - -func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint8)(ptr)) = iter.ReadUint8() - } -} - -func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint8(*((*uint8)(ptr))) -} - -func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint8)(ptr)) == 0 -} - -type uint16Codec struct { -} - -func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint16)(ptr)) = iter.ReadUint16() - } -} - -func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint16(*((*uint16)(ptr))) -} - -func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint16)(ptr)) == 0 -} - -type uint32Codec struct { -} - -func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint32)(ptr)) = iter.ReadUint32() - } -} - -func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint32(*((*uint32)(ptr))) -} - -func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint32)(ptr)) == 0 -} - -type uint64Codec struct { -} - -func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint64)(ptr)) = iter.ReadUint64() - } -} - -func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(*((*uint64)(ptr))) -} - -func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint64)(ptr)) == 0 -} - -type float32Codec struct { -} - -func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float32)(ptr)) = iter.ReadFloat32() - } -} - -func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32(*((*float32)(ptr))) -} - -func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type float64Codec struct { -} - -func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float64)(ptr)) = iter.ReadFloat64() - } -} - -func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64(*((*float64)(ptr))) -} - -func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -type boolCodec struct { -} - -func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*bool)(ptr)) = iter.ReadBool() - } -} - -func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteBool(*((*bool)(ptr))) -} - -func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { - return !(*((*bool)(ptr))) -} - -type base64Codec struct { - sliceType *reflect2.UnsafeSliceType - sliceDecoder ValDecoder -} - -func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - codec.sliceType.UnsafeSetNil(ptr) - return - } - switch iter.WhatIsNext() { - case StringValue: - src := iter.ReadString() - dst, err := base64.StdEncoding.DecodeString(src) - if err != nil { - iter.ReportError("decode base64", err.Error()) - } else { - codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) - } - case ArrayValue: - codec.sliceDecoder.Decode(ptr, iter) - default: - iter.ReportError("base64Codec", "invalid input") - } -} - -func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - if codec.sliceType.UnsafeIsNil(ptr) { - stream.WriteNil() - return - } - src := *((*[]byte)(ptr)) - encoding := base64.StdEncoding - stream.writeByte('"') - if len(src) != 0 { - size := encoding.EncodedLen(len(src)) - buf := make([]byte, size) - encoding.Encode(buf, src) - stream.buf = append(stream.buf, buf...) - } - stream.writeByte('"') -} - -func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*[]byte)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go deleted file mode 100644 index fa71f4748..000000000 --- a/vendor/github.com/json-iterator/go/reflect_optional.go +++ /dev/null @@ -1,129 +0,0 @@ -package jsoniter - -import ( - "github.com/modern-go/reflect2" - "unsafe" -) - -func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { - ptrType := typ.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - decoder := decoderOfType(ctx, elemType) - return &OptionalDecoder{elemType, decoder} -} - -func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder { - ptrType := typ.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - elemEncoder := encoderOfType(ctx, elemType) - encoder := &OptionalEncoder{elemEncoder} - return encoder -} - -type OptionalDecoder struct { - ValueType reflect2.Type - ValueDecoder ValDecoder -} - -func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*unsafe.Pointer)(ptr)) = nil - } else { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - newPtr := decoder.ValueType.UnsafeNew() - decoder.ValueDecoder.Decode(newPtr, iter) - *((*unsafe.Pointer)(ptr)) = newPtr - } else { - //reuse existing instance - decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } - } -} - -type dereferenceDecoder struct { - // only to deference a pointer - valueType reflect2.Type - valueDecoder ValDecoder -} - -func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - newPtr := decoder.valueType.UnsafeNew() - decoder.valueDecoder.Decode(newPtr, iter) - *((*unsafe.Pointer)(ptr)) = newPtr - } else { - //reuse existing instance - decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } -} - -type OptionalEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*unsafe.Pointer)(ptr)) == nil -} - -type dereferenceEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - dePtr := *((*unsafe.Pointer)(ptr)) - if dePtr == nil { - return true - } - return encoder.ValueEncoder.IsEmpty(dePtr) -} - -func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { - deReferenced := *((*unsafe.Pointer)(ptr)) - if deReferenced == nil { - return true - } - isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil) - if !converted { - return false - } - fieldPtr := unsafe.Pointer(deReferenced) - return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) -} - -type referenceEncoder struct { - encoder ValEncoder -} - -func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) -} - -func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) -} - -type referenceDecoder struct { - decoder ValDecoder -} - -func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.decoder.Decode(unsafe.Pointer(&ptr), iter) -} diff --git a/vendor/github.com/json-iterator/go/reflect_slice.go b/vendor/github.com/json-iterator/go/reflect_slice.go deleted file mode 100644 index 9441d79df..000000000 --- a/vendor/github.com/json-iterator/go/reflect_slice.go +++ /dev/null @@ -1,99 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "unsafe" -) - -func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { - sliceType := typ.(*reflect2.UnsafeSliceType) - decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) - return &sliceDecoder{sliceType, decoder} -} - -func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder { - sliceType := typ.(*reflect2.UnsafeSliceType) - encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) - return &sliceEncoder{sliceType, encoder} -} - -type sliceEncoder struct { - sliceType *reflect2.UnsafeSliceType - elemEncoder ValEncoder -} - -func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if encoder.sliceType.UnsafeIsNil(ptr) { - stream.WriteNil() - return - } - length := encoder.sliceType.UnsafeLengthOf(ptr) - if length == 0 { - stream.WriteEmptyArray() - return - } - stream.WriteArrayStart() - encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream) - for i := 1; i < length; i++ { - stream.WriteMore() - elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i) - encoder.elemEncoder.Encode(elemPtr, stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) - } -} - -func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.sliceType.UnsafeLengthOf(ptr) == 0 -} - -type sliceDecoder struct { - sliceType *reflect2.UnsafeSliceType - elemDecoder ValDecoder -} - -func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) - } -} - -func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - sliceType := decoder.sliceType - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - sliceType.UnsafeSetNil(ptr) - return - } - if c != '[' { - iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c})) - return - } - c = iter.nextToken() - if c == ']' { - sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0)) - return - } - iter.unreadByte() - sliceType.UnsafeGrow(ptr, 1) - elemPtr := sliceType.UnsafeGetIndex(ptr, 0) - decoder.elemDecoder.Decode(elemPtr, iter) - length := 1 - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - idx := length - length += 1 - sliceType.UnsafeGrow(ptr, length) - elemPtr = sliceType.UnsafeGetIndex(ptr, idx) - decoder.elemDecoder.Decode(elemPtr, iter) - } - if c != ']' { - iter.ReportError("decode slice", "expect ], but found "+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go deleted file mode 100644 index d7eb0eb5c..000000000 --- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go +++ /dev/null @@ -1,1092 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "strings" - "unsafe" - - "github.com/modern-go/reflect2" -) - -func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { - bindings := map[string]*Binding{} - structDescriptor := describeStruct(ctx, typ) - for _, binding := range structDescriptor.Fields { - for _, fromName := range binding.FromNames { - old := bindings[fromName] - if old == nil { - bindings[fromName] = binding - continue - } - ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding) - if ignoreOld { - delete(bindings, fromName) - } - if !ignoreNew { - bindings[fromName] = binding - } - } - } - fields := map[string]*structFieldDecoder{} - for k, binding := range bindings { - fields[k] = binding.Decoder.(*structFieldDecoder) - } - - if !ctx.caseSensitive() { - for k, binding := range bindings { - if _, found := fields[strings.ToLower(k)]; !found { - fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) - } - } - } - - return createStructDecoder(ctx, typ, fields) -} - -func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder { - if ctx.disallowUnknownFields { - return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true} - } - knownHash := map[int64]struct{}{ - 0: {}, - } - - switch len(fields) { - case 0: - return &skipObjectDecoder{typ} - case 1: - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder} - } - case 2: - var fieldHash1 int64 - var fieldHash2 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldHash1 == 0 { - fieldHash1 = fieldHash - fieldDecoder1 = fieldDecoder - } else { - fieldHash2 = fieldHash - fieldDecoder2 = fieldDecoder - } - } - return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2} - case 3: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } - } - return &threeFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3} - case 4: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } - } - return &fourFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4} - case 5: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } - } - return &fiveFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5} - case 6: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } - } - return &sixFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6} - case 7: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } - } - return &sevenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7} - case 8: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } - } - return &eightFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8} - case 9: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldName9 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - var fieldDecoder9 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else if fieldName8 == 0 { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } else { - fieldName9 = fieldHash - fieldDecoder9 = fieldDecoder - } - } - return &nineFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8, - fieldName9, fieldDecoder9} - case 10: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldName9 int64 - var fieldName10 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - var fieldDecoder9 *structFieldDecoder - var fieldDecoder10 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else if fieldName8 == 0 { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } else if fieldName9 == 0 { - fieldName9 = fieldHash - fieldDecoder9 = fieldDecoder - } else { - fieldName10 = fieldHash - fieldDecoder10 = fieldDecoder - } - } - return &tenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8, - fieldName9, fieldDecoder9, - fieldName10, fieldDecoder10} - } - return &generalStructDecoder{typ, fields, false} -} - -type generalStructDecoder struct { - typ reflect2.Type - fields map[string]*structFieldDecoder - disallowUnknownFields bool -} - -func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - var c byte - for c = ','; c == ','; c = iter.nextToken() { - decoder.decodeOneField(ptr, iter) - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - if c != '}' { - iter.ReportError("struct Decode", `expect }, but found `+string([]byte{c})) - } - iter.decrementDepth() -} - -func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) { - var field string - var fieldDecoder *structFieldDecoder - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes := iter.ReadStringAsSlice() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - fieldDecoder = decoder.fields[field] - if fieldDecoder == nil && !iter.cfg.caseSensitive { - fieldDecoder = decoder.fields[strings.ToLower(field)] - } - } else { - field = iter.ReadString() - fieldDecoder = decoder.fields[field] - if fieldDecoder == nil && !iter.cfg.caseSensitive { - fieldDecoder = decoder.fields[strings.ToLower(field)] - } - } - if fieldDecoder == nil { - if decoder.disallowUnknownFields { - msg := "found unknown field: " + field - iter.ReportError("ReadObject", msg) - } - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - iter.Skip() - return - } - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - fieldDecoder.Decode(ptr, iter) -} - -type skipObjectDecoder struct { - typ reflect2.Type -} - -func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valueType := iter.WhatIsNext() - if valueType != ObjectValue && valueType != NilValue { - iter.ReportError("skipObjectDecoder", "expect object or null") - return - } - iter.Skip() -} - -type oneFieldStructDecoder struct { - typ reflect2.Type - fieldHash int64 - fieldDecoder *structFieldDecoder -} - -func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - if iter.readFieldHash() == decoder.fieldHash { - decoder.fieldDecoder.Decode(ptr, iter) - } else { - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type twoFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder -} - -func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type threeFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder -} - -func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type fourFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder -} - -func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type fiveFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder -} - -func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type sixFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder -} - -func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type sevenFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder -} - -func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type eightFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder -} - -func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type nineFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder - fieldHash9 int64 - fieldDecoder9 *structFieldDecoder -} - -func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - case decoder.fieldHash9: - decoder.fieldDecoder9.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type tenFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder - fieldHash9 int64 - fieldDecoder9 *structFieldDecoder - fieldHash10 int64 - fieldDecoder10 *structFieldDecoder -} - -func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - case decoder.fieldHash9: - decoder.fieldDecoder9.Decode(ptr, iter) - case decoder.fieldHash10: - decoder.fieldDecoder10.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type structFieldDecoder struct { - field reflect2.StructField - fieldDecoder ValDecoder -} - -func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - fieldPtr := decoder.field.UnsafeGet(ptr) - decoder.fieldDecoder.Decode(fieldPtr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error()) - } -} - -type stringModeStringDecoder struct { - elemDecoder ValDecoder - cfg *frozenConfig -} - -func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.elemDecoder.Decode(ptr, iter) - str := *((*string)(ptr)) - tempIter := decoder.cfg.BorrowIterator([]byte(str)) - defer decoder.cfg.ReturnIterator(tempIter) - *((*string)(ptr)) = tempIter.ReadString() -} - -type stringModeNumberDecoder struct { - elemDecoder ValDecoder -} - -func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } - decoder.elemDecoder.Decode(ptr, iter) - if iter.Error != nil { - return - } - c = iter.readByte() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go deleted file mode 100644 index 152e3ef5a..000000000 --- a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go +++ /dev/null @@ -1,211 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "unsafe" -) - -func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { - type bindingTo struct { - binding *Binding - toName string - ignored bool - } - orderedBindings := []*bindingTo{} - structDescriptor := describeStruct(ctx, typ) - for _, binding := range structDescriptor.Fields { - for _, toName := range binding.ToNames { - new := &bindingTo{ - binding: binding, - toName: toName, - } - for _, old := range orderedBindings { - if old.toName != toName { - continue - } - old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding) - } - orderedBindings = append(orderedBindings, new) - } - } - if len(orderedBindings) == 0 { - return &emptyStructEncoder{} - } - finalOrderedFields := []structFieldTo{} - for _, bindingTo := range orderedBindings { - if !bindingTo.ignored { - finalOrderedFields = append(finalOrderedFields, structFieldTo{ - encoder: bindingTo.binding.Encoder.(*structFieldEncoder), - toName: bindingTo.toName, - }) - } - } - return &structEncoder{typ, finalOrderedFields} -} - -func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty { - encoder := createEncoderOfNative(ctx, typ) - if encoder != nil { - return encoder - } - kind := typ.Kind() - switch kind { - case reflect.Interface: - return &dynamicEncoder{typ} - case reflect.Struct: - return &structEncoder{typ: typ} - case reflect.Array: - return &arrayEncoder{} - case reflect.Slice: - return &sliceEncoder{} - case reflect.Map: - return encoderOfMap(ctx, typ) - case reflect.Ptr: - return &OptionalEncoder{} - default: - return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} - } -} - -func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) { - newTagged := new.Field.Tag().Get(cfg.getTagKey()) != "" - oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != "" - if newTagged { - if oldTagged { - if len(old.levels) > len(new.levels) { - return true, false - } else if len(new.levels) > len(old.levels) { - return false, true - } else { - return true, true - } - } else { - return true, false - } - } else { - if oldTagged { - return true, false - } - if len(old.levels) > len(new.levels) { - return true, false - } else if len(new.levels) > len(old.levels) { - return false, true - } else { - return true, true - } - } -} - -type structFieldEncoder struct { - field reflect2.StructField - fieldEncoder ValEncoder - omitempty bool -} - -func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - fieldPtr := encoder.field.UnsafeGet(ptr) - encoder.fieldEncoder.Encode(fieldPtr, stream) - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error()) - } -} - -func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool { - fieldPtr := encoder.field.UnsafeGet(ptr) - return encoder.fieldEncoder.IsEmpty(fieldPtr) -} - -func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { - isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil) - if !converted { - return false - } - fieldPtr := encoder.field.UnsafeGet(ptr) - return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) -} - -type IsEmbeddedPtrNil interface { - IsEmbeddedPtrNil(ptr unsafe.Pointer) bool -} - -type structEncoder struct { - typ reflect2.Type - fields []structFieldTo -} - -type structFieldTo struct { - encoder *structFieldEncoder - toName string -} - -func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteObjectStart() - isNotFirst := false - for _, field := range encoder.fields { - if field.encoder.omitempty && field.encoder.IsEmpty(ptr) { - continue - } - if field.encoder.IsEmbeddedPtrNil(ptr) { - continue - } - if isNotFirst { - stream.WriteMore() - } - stream.WriteObjectField(field.toName) - field.encoder.Encode(ptr, stream) - isNotFirst = true - } - stream.WriteObjectEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v.%s", encoder.typ, stream.Error.Error()) - } -} - -func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type emptyStructEncoder struct { -} - -func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyObject() -} - -func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type stringModeNumberEncoder struct { - elemEncoder ValEncoder -} - -func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.elemEncoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type stringModeStringEncoder struct { - elemEncoder ValEncoder - cfg *frozenConfig -} - -func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - tempStream := encoder.cfg.BorrowStream(nil) - tempStream.Attachment = stream.Attachment - defer encoder.cfg.ReturnStream(tempStream) - encoder.elemEncoder.Encode(ptr, tempStream) - stream.WriteString(string(tempStream.Buffer())) -} - -func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} diff --git a/vendor/github.com/json-iterator/go/stream.go b/vendor/github.com/json-iterator/go/stream.go deleted file mode 100644 index 23d8a3ad6..000000000 --- a/vendor/github.com/json-iterator/go/stream.go +++ /dev/null @@ -1,210 +0,0 @@ -package jsoniter - -import ( - "io" -) - -// stream is a io.Writer like object, with JSON specific write functions. -// Error is not returned as return value, but stored as Error member on this stream instance. -type Stream struct { - cfg *frozenConfig - out io.Writer - buf []byte - Error error - indention int - Attachment interface{} // open for customized encoder -} - -// NewStream create new stream instance. -// cfg can be jsoniter.ConfigDefault. -// out can be nil if write to internal buffer. -// bufSize is the initial size for the internal buffer in bytes. -func NewStream(cfg API, out io.Writer, bufSize int) *Stream { - return &Stream{ - cfg: cfg.(*frozenConfig), - out: out, - buf: make([]byte, 0, bufSize), - Error: nil, - indention: 0, - } -} - -// Pool returns a pool can provide more stream with same configuration -func (stream *Stream) Pool() StreamPool { - return stream.cfg -} - -// Reset reuse this stream instance by assign a new writer -func (stream *Stream) Reset(out io.Writer) { - stream.out = out - stream.buf = stream.buf[:0] -} - -// Available returns how many bytes are unused in the buffer. -func (stream *Stream) Available() int { - return cap(stream.buf) - len(stream.buf) -} - -// Buffered returns the number of bytes that have been written into the current buffer. -func (stream *Stream) Buffered() int { - return len(stream.buf) -} - -// Buffer if writer is nil, use this method to take the result -func (stream *Stream) Buffer() []byte { - return stream.buf -} - -// SetBuffer allows to append to the internal buffer directly -func (stream *Stream) SetBuffer(buf []byte) { - stream.buf = buf -} - -// Write writes the contents of p into the buffer. -// It returns the number of bytes written. -// If nn < len(p), it also returns an error explaining -// why the write is short. -func (stream *Stream) Write(p []byte) (nn int, err error) { - stream.buf = append(stream.buf, p...) - if stream.out != nil { - nn, err = stream.out.Write(stream.buf) - stream.buf = stream.buf[nn:] - return - } - return len(p), nil -} - -// WriteByte writes a single byte. -func (stream *Stream) writeByte(c byte) { - stream.buf = append(stream.buf, c) -} - -func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) { - stream.buf = append(stream.buf, c1, c2) -} - -func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) { - stream.buf = append(stream.buf, c1, c2, c3) -} - -func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) { - stream.buf = append(stream.buf, c1, c2, c3, c4) -} - -func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) { - stream.buf = append(stream.buf, c1, c2, c3, c4, c5) -} - -// Flush writes any buffered data to the underlying io.Writer. -func (stream *Stream) Flush() error { - if stream.out == nil { - return nil - } - if stream.Error != nil { - return stream.Error - } - _, err := stream.out.Write(stream.buf) - if err != nil { - if stream.Error == nil { - stream.Error = err - } - return err - } - stream.buf = stream.buf[:0] - return nil -} - -// WriteRaw write string out without quotes, just like []byte -func (stream *Stream) WriteRaw(s string) { - stream.buf = append(stream.buf, s...) -} - -// WriteNil write null to stream -func (stream *Stream) WriteNil() { - stream.writeFourBytes('n', 'u', 'l', 'l') -} - -// WriteTrue write true to stream -func (stream *Stream) WriteTrue() { - stream.writeFourBytes('t', 'r', 'u', 'e') -} - -// WriteFalse write false to stream -func (stream *Stream) WriteFalse() { - stream.writeFiveBytes('f', 'a', 'l', 's', 'e') -} - -// WriteBool write true or false into stream -func (stream *Stream) WriteBool(val bool) { - if val { - stream.WriteTrue() - } else { - stream.WriteFalse() - } -} - -// WriteObjectStart write { with possible indention -func (stream *Stream) WriteObjectStart() { - stream.indention += stream.cfg.indentionStep - stream.writeByte('{') - stream.writeIndention(0) -} - -// WriteObjectField write "field": with possible indention -func (stream *Stream) WriteObjectField(field string) { - stream.WriteString(field) - if stream.indention > 0 { - stream.writeTwoBytes(':', ' ') - } else { - stream.writeByte(':') - } -} - -// WriteObjectEnd write } with possible indention -func (stream *Stream) WriteObjectEnd() { - stream.writeIndention(stream.cfg.indentionStep) - stream.indention -= stream.cfg.indentionStep - stream.writeByte('}') -} - -// WriteEmptyObject write {} -func (stream *Stream) WriteEmptyObject() { - stream.writeByte('{') - stream.writeByte('}') -} - -// WriteMore write , with possible indention -func (stream *Stream) WriteMore() { - stream.writeByte(',') - stream.writeIndention(0) -} - -// WriteArrayStart write [ with possible indention -func (stream *Stream) WriteArrayStart() { - stream.indention += stream.cfg.indentionStep - stream.writeByte('[') - stream.writeIndention(0) -} - -// WriteEmptyArray write [] -func (stream *Stream) WriteEmptyArray() { - stream.writeTwoBytes('[', ']') -} - -// WriteArrayEnd write ] with possible indention -func (stream *Stream) WriteArrayEnd() { - stream.writeIndention(stream.cfg.indentionStep) - stream.indention -= stream.cfg.indentionStep - stream.writeByte(']') -} - -func (stream *Stream) writeIndention(delta int) { - if stream.indention == 0 { - return - } - stream.writeByte('\n') - toWrite := stream.indention - delta - for i := 0; i < toWrite; i++ { - stream.buf = append(stream.buf, ' ') - } -} diff --git a/vendor/github.com/json-iterator/go/stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go deleted file mode 100644 index 826aa594a..000000000 --- a/vendor/github.com/json-iterator/go/stream_float.go +++ /dev/null @@ -1,111 +0,0 @@ -package jsoniter - -import ( - "fmt" - "math" - "strconv" -) - -var pow10 []uint64 - -func init() { - pow10 = []uint64{1, 10, 100, 1000, 10000, 100000, 1000000} -} - -// WriteFloat32 write float32 to stream -func (stream *Stream) WriteFloat32(val float32) { - if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - abs := math.Abs(float64(val)) - fmt := byte('f') - // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. - if abs != 0 { - if float32(abs) < 1e-6 || float32(abs) >= 1e21 { - fmt = 'e' - } - } - stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32) -} - -// WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster -func (stream *Stream) WriteFloat32Lossy(val float32) { - if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - if val < 0 { - stream.writeByte('-') - val = -val - } - if val > 0x4ffffff { - stream.WriteFloat32(val) - return - } - precision := 6 - exp := uint64(1000000) // 6 - lval := uint64(float64(val)*float64(exp) + 0.5) - stream.WriteUint64(lval / exp) - fval := lval % exp - if fval == 0 { - return - } - stream.writeByte('.') - for p := precision - 1; p > 0 && fval < pow10[p]; p-- { - stream.writeByte('0') - } - stream.WriteUint64(fval) - for stream.buf[len(stream.buf)-1] == '0' { - stream.buf = stream.buf[:len(stream.buf)-1] - } -} - -// WriteFloat64 write float64 to stream -func (stream *Stream) WriteFloat64(val float64) { - if math.IsInf(val, 0) || math.IsNaN(val) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - abs := math.Abs(val) - fmt := byte('f') - // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. - if abs != 0 { - if abs < 1e-6 || abs >= 1e21 { - fmt = 'e' - } - } - stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64) -} - -// WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster -func (stream *Stream) WriteFloat64Lossy(val float64) { - if math.IsInf(val, 0) || math.IsNaN(val) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - if val < 0 { - stream.writeByte('-') - val = -val - } - if val > 0x4ffffff { - stream.WriteFloat64(val) - return - } - precision := 6 - exp := uint64(1000000) // 6 - lval := uint64(val*float64(exp) + 0.5) - stream.WriteUint64(lval / exp) - fval := lval % exp - if fval == 0 { - return - } - stream.writeByte('.') - for p := precision - 1; p > 0 && fval < pow10[p]; p-- { - stream.writeByte('0') - } - stream.WriteUint64(fval) - for stream.buf[len(stream.buf)-1] == '0' { - stream.buf = stream.buf[:len(stream.buf)-1] - } -} diff --git a/vendor/github.com/json-iterator/go/stream_int.go b/vendor/github.com/json-iterator/go/stream_int.go deleted file mode 100644 index d1059ee4c..000000000 --- a/vendor/github.com/json-iterator/go/stream_int.go +++ /dev/null @@ -1,190 +0,0 @@ -package jsoniter - -var digits []uint32 - -func init() { - digits = make([]uint32, 1000) - for i := uint32(0); i < 1000; i++ { - digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' - if i < 10 { - digits[i] += 2 << 24 - } else if i < 100 { - digits[i] += 1 << 24 - } - } -} - -func writeFirstBuf(space []byte, v uint32) []byte { - start := v >> 24 - if start == 0 { - space = append(space, byte(v>>16), byte(v>>8)) - } else if start == 1 { - space = append(space, byte(v>>8)) - } - space = append(space, byte(v)) - return space -} - -func writeBuf(buf []byte, v uint32) []byte { - return append(buf, byte(v>>16), byte(v>>8), byte(v)) -} - -// WriteUint8 write uint8 to stream -func (stream *Stream) WriteUint8(val uint8) { - stream.buf = writeFirstBuf(stream.buf, digits[val]) -} - -// WriteInt8 write int8 to stream -func (stream *Stream) WriteInt8(nval int8) { - var val uint8 - if nval < 0 { - val = uint8(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint8(nval) - } - stream.buf = writeFirstBuf(stream.buf, digits[val]) -} - -// WriteUint16 write uint16 to stream -func (stream *Stream) WriteUint16(val uint16) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return -} - -// WriteInt16 write int16 to stream -func (stream *Stream) WriteInt16(nval int16) { - var val uint16 - if nval < 0 { - val = uint16(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint16(nval) - } - stream.WriteUint16(val) -} - -// WriteUint32 write uint32 to stream -func (stream *Stream) WriteUint32(val uint32) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q2]) - } else { - r3 := q2 - q3*1000 - stream.buf = append(stream.buf, byte(q3+'0')) - stream.buf = writeBuf(stream.buf, digits[r3]) - } - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) -} - -// WriteInt32 write int32 to stream -func (stream *Stream) WriteInt32(nval int32) { - var val uint32 - if nval < 0 { - val = uint32(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint32(nval) - } - stream.WriteUint32(val) -} - -// WriteUint64 write uint64 to stream -func (stream *Stream) WriteUint64(val uint64) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q2]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q3]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q4]) - stream.buf = writeBuf(stream.buf, digits[r4]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q5]) - } else { - stream.buf = writeFirstBuf(stream.buf, digits[q6]) - r6 := q5 - q6*1000 - stream.buf = writeBuf(stream.buf, digits[r6]) - } - stream.buf = writeBuf(stream.buf, digits[r5]) - stream.buf = writeBuf(stream.buf, digits[r4]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) -} - -// WriteInt64 write int64 to stream -func (stream *Stream) WriteInt64(nval int64) { - var val uint64 - if nval < 0 { - val = uint64(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint64(nval) - } - stream.WriteUint64(val) -} - -// WriteInt write int to stream -func (stream *Stream) WriteInt(val int) { - stream.WriteInt64(int64(val)) -} - -// WriteUint write uint to stream -func (stream *Stream) WriteUint(val uint) { - stream.WriteUint64(uint64(val)) -} diff --git a/vendor/github.com/json-iterator/go/stream_str.go b/vendor/github.com/json-iterator/go/stream_str.go deleted file mode 100644 index 54c2ba0b3..000000000 --- a/vendor/github.com/json-iterator/go/stream_str.go +++ /dev/null @@ -1,372 +0,0 @@ -package jsoniter - -import ( - "unicode/utf8" -) - -// htmlSafeSet holds the value true if the ASCII character with the given -// array position can be safely represented inside a JSON string, embedded -// inside of HTML " that closes the next token. If - // non-empty, the subsequent call to Next will return a raw or RCDATA text - // token: one that treats "

" as text instead of an element. - // rawTag's contents are lower-cased. - rawTag string - // textIsRaw is whether the current text token's data is not escaped. - textIsRaw bool - // convertNUL is whether NUL bytes in the current token's data should - // be converted into \ufffd replacement characters. - convertNUL bool - // allowCDATA is whether CDATA sections are allowed in the current context. - allowCDATA bool -} - -// AllowCDATA sets whether or not the tokenizer recognizes as -// the text "foo". The default value is false, which means to recognize it as -// a bogus comment "" instead. -// -// Strictly speaking, an HTML5 compliant tokenizer should allow CDATA if and -// only if tokenizing foreign content, such as MathML and SVG. However, -// tracking foreign-contentness is difficult to do purely in the tokenizer, -// as opposed to the parser, due to HTML integration points: an element -// can contain a that is foreign-to-SVG but not foreign-to- -// HTML. For strict compliance with the HTML5 tokenization algorithm, it is the -// responsibility of the user of a tokenizer to call AllowCDATA as appropriate. -// In practice, if using the tokenizer without caring whether MathML or SVG -// CDATA is text or comments, such as tokenizing HTML to find all the anchor -// text, it is acceptable to ignore this responsibility. -func (z *Tokenizer) AllowCDATA(allowCDATA bool) { - z.allowCDATA = allowCDATA -} - -// NextIsNotRawText instructs the tokenizer that the next token should not be -// considered as 'raw text'. Some elements, such as script and title elements, -// normally require the next token after the opening tag to be 'raw text' that -// has no child elements. For example, tokenizing "a<b>c</b>d" -// yields a start tag token for "", a text token for "a<b>c</b>d", and -// an end tag token for "". There are no distinct start tag or end tag -// tokens for the "" and "". -// -// This tokenizer implementation will generally look for raw text at the right -// times. Strictly speaking, an HTML5 compliant tokenizer should not look for -// raw text if in foreign content: generally needs raw text, but a -// <title> inside an <svg> does not. Another example is that a <textarea> -// generally needs raw text, but a <textarea> is not allowed as an immediate -// child of a <select>; in normal parsing, a <textarea> implies </select>, but -// one cannot close the implicit element when parsing a <select>'s InnerHTML. -// Similarly to AllowCDATA, tracking the correct moment to override raw-text- -// ness is difficult to do purely in the tokenizer, as opposed to the parser. -// For strict compliance with the HTML5 tokenization algorithm, it is the -// responsibility of the user of a tokenizer to call NextIsNotRawText as -// appropriate. In practice, like AllowCDATA, it is acceptable to ignore this -// responsibility for basic usage. -// -// Note that this 'raw text' concept is different from the one offered by the -// Tokenizer.Raw method. -func (z *Tokenizer) NextIsNotRawText() { - z.rawTag = "" -} - -// Err returns the error associated with the most recent ErrorToken token. -// This is typically io.EOF, meaning the end of tokenization. -func (z *Tokenizer) Err() error { - if z.tt != ErrorToken { - return nil - } - return z.err -} - -// readByte returns the next byte from the input stream, doing a buffered read -// from z.r into z.buf if necessary. z.buf[z.raw.start:z.raw.end] remains a contiguous byte -// slice that holds all the bytes read so far for the current token. -// It sets z.err if the underlying reader returns an error. -// Pre-condition: z.err == nil. -func (z *Tokenizer) readByte() byte { - if z.raw.end >= len(z.buf) { - // Our buffer is exhausted and we have to read from z.r. Check if the - // previous read resulted in an error. - if z.readErr != nil { - z.err = z.readErr - return 0 - } - // We copy z.buf[z.raw.start:z.raw.end] to the beginning of z.buf. If the length - // z.raw.end - z.raw.start is more than half the capacity of z.buf, then we - // allocate a new buffer before the copy. - c := cap(z.buf) - d := z.raw.end - z.raw.start - var buf1 []byte - if 2*d > c { - buf1 = make([]byte, d, 2*c) - } else { - buf1 = z.buf[:d] - } - copy(buf1, z.buf[z.raw.start:z.raw.end]) - if x := z.raw.start; x != 0 { - // Adjust the data/attr spans to refer to the same contents after the copy. - z.data.start -= x - z.data.end -= x - z.pendingAttr[0].start -= x - z.pendingAttr[0].end -= x - z.pendingAttr[1].start -= x - z.pendingAttr[1].end -= x - for i := range z.attr { - z.attr[i][0].start -= x - z.attr[i][0].end -= x - z.attr[i][1].start -= x - z.attr[i][1].end -= x - } - } - z.raw.start, z.raw.end, z.buf = 0, d, buf1[:d] - // Now that we have copied the live bytes to the start of the buffer, - // we read from z.r into the remainder. - var n int - n, z.readErr = readAtLeastOneByte(z.r, buf1[d:cap(buf1)]) - if n == 0 { - z.err = z.readErr - return 0 - } - z.buf = buf1[:d+n] - } - x := z.buf[z.raw.end] - z.raw.end++ - if z.maxBuf > 0 && z.raw.end-z.raw.start >= z.maxBuf { - z.err = ErrBufferExceeded - return 0 - } - return x -} - -// Buffered returns a slice containing data buffered but not yet tokenized. -func (z *Tokenizer) Buffered() []byte { - return z.buf[z.raw.end:] -} - -// readAtLeastOneByte wraps an io.Reader so that reading cannot return (0, nil). -// It returns io.ErrNoProgress if the underlying r.Read method returns (0, nil) -// too many times in succession. -func readAtLeastOneByte(r io.Reader, b []byte) (int, error) { - for i := 0; i < 100; i++ { - if n, err := r.Read(b); n != 0 || err != nil { - return n, err - } - } - return 0, io.ErrNoProgress -} - -// skipWhiteSpace skips past any white space. -func (z *Tokenizer) skipWhiteSpace() { - if z.err != nil { - return - } - for { - c := z.readByte() - if z.err != nil { - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f': - // No-op. - default: - z.raw.end-- - return - } - } -} - -// readRawOrRCDATA reads until the next "</foo>", where "foo" is z.rawTag and -// is typically something like "script" or "textarea". -func (z *Tokenizer) readRawOrRCDATA() { - if z.rawTag == "script" { - z.readScript() - z.textIsRaw = true - z.rawTag = "" - return - } -loop: - for { - c := z.readByte() - if z.err != nil { - break loop - } - if c != '<' { - continue loop - } - c = z.readByte() - if z.err != nil { - break loop - } - if c != '/' { - z.raw.end-- - continue loop - } - if z.readRawEndTag() || z.err != nil { - break loop - } - } - z.data.end = z.raw.end - // A textarea's or title's RCDATA can contain escaped entities. - z.textIsRaw = z.rawTag != "textarea" && z.rawTag != "title" - z.rawTag = "" -} - -// readRawEndTag attempts to read a tag like "</foo>", where "foo" is z.rawTag. -// If it succeeds, it backs up the input position to reconsume the tag and -// returns true. Otherwise it returns false. The opening "</" has already been -// consumed. -func (z *Tokenizer) readRawEndTag() bool { - for i := 0; i < len(z.rawTag); i++ { - c := z.readByte() - if z.err != nil { - return false - } - if c != z.rawTag[i] && c != z.rawTag[i]-('a'-'A') { - z.raw.end-- - return false - } - } - c := z.readByte() - if z.err != nil { - return false - } - switch c { - case ' ', '\n', '\r', '\t', '\f', '/', '>': - // The 3 is 2 for the leading "</" plus 1 for the trailing character c. - z.raw.end -= 3 + len(z.rawTag) - return true - } - z.raw.end-- - return false -} - -// readScript reads until the next </script> tag, following the byzantine -// rules for escaping/hiding the closing tag. -func (z *Tokenizer) readScript() { - defer func() { - z.data.end = z.raw.end - }() - var c byte - -scriptData: - c = z.readByte() - if z.err != nil { - return - } - if c == '<' { - goto scriptDataLessThanSign - } - goto scriptData - -scriptDataLessThanSign: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '/': - goto scriptDataEndTagOpen - case '!': - goto scriptDataEscapeStart - } - z.raw.end-- - goto scriptData - -scriptDataEndTagOpen: - if z.readRawEndTag() || z.err != nil { - return - } - goto scriptData - -scriptDataEscapeStart: - c = z.readByte() - if z.err != nil { - return - } - if c == '-' { - goto scriptDataEscapeStartDash - } - z.raw.end-- - goto scriptData - -scriptDataEscapeStartDash: - c = z.readByte() - if z.err != nil { - return - } - if c == '-' { - goto scriptDataEscapedDashDash - } - z.raw.end-- - goto scriptData - -scriptDataEscaped: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataEscapedDash - case '<': - goto scriptDataEscapedLessThanSign - } - goto scriptDataEscaped - -scriptDataEscapedDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataEscapedDashDash - case '<': - goto scriptDataEscapedLessThanSign - } - goto scriptDataEscaped - -scriptDataEscapedDashDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataEscapedDashDash - case '<': - goto scriptDataEscapedLessThanSign - case '>': - goto scriptData - } - goto scriptDataEscaped - -scriptDataEscapedLessThanSign: - c = z.readByte() - if z.err != nil { - return - } - if c == '/' { - goto scriptDataEscapedEndTagOpen - } - if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' { - goto scriptDataDoubleEscapeStart - } - z.raw.end-- - goto scriptData - -scriptDataEscapedEndTagOpen: - if z.readRawEndTag() || z.err != nil { - return - } - goto scriptDataEscaped - -scriptDataDoubleEscapeStart: - z.raw.end-- - for i := 0; i < len("script"); i++ { - c = z.readByte() - if z.err != nil { - return - } - if c != "script"[i] && c != "SCRIPT"[i] { - z.raw.end-- - goto scriptDataEscaped - } - } - c = z.readByte() - if z.err != nil { - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f', '/', '>': - goto scriptDataDoubleEscaped - } - z.raw.end-- - goto scriptDataEscaped - -scriptDataDoubleEscaped: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataDoubleEscapedDash - case '<': - goto scriptDataDoubleEscapedLessThanSign - } - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapedDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataDoubleEscapedDashDash - case '<': - goto scriptDataDoubleEscapedLessThanSign - } - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapedDashDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataDoubleEscapedDashDash - case '<': - goto scriptDataDoubleEscapedLessThanSign - case '>': - goto scriptData - } - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapedLessThanSign: - c = z.readByte() - if z.err != nil { - return - } - if c == '/' { - goto scriptDataDoubleEscapeEnd - } - z.raw.end-- - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapeEnd: - if z.readRawEndTag() { - z.raw.end += len("</script>") - goto scriptDataEscaped - } - if z.err != nil { - return - } - goto scriptDataDoubleEscaped -} - -// readComment reads the next comment token starting with "<!--". The opening -// "<!--" has already been consumed. -func (z *Tokenizer) readComment() { - z.data.start = z.raw.end - defer func() { - if z.data.end < z.data.start { - // It's a comment with no data, like <!-->. - z.data.end = z.data.start - } - }() - for dashCount := 2; ; { - c := z.readByte() - if z.err != nil { - // Ignore up to two dashes at EOF. - if dashCount > 2 { - dashCount = 2 - } - z.data.end = z.raw.end - dashCount - return - } - switch c { - case '-': - dashCount++ - continue - case '>': - if dashCount >= 2 { - z.data.end = z.raw.end - len("-->") - return - } - case '!': - if dashCount >= 2 { - c = z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return - } - if c == '>' { - z.data.end = z.raw.end - len("--!>") - return - } - } - } - dashCount = 0 - } -} - -// readUntilCloseAngle reads until the next ">". -func (z *Tokenizer) readUntilCloseAngle() { - z.data.start = z.raw.end - for { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return - } - if c == '>' { - z.data.end = z.raw.end - len(">") - return - } - } -} - -// readMarkupDeclaration reads the next token starting with "<!". It might be -// a "<!--comment-->", a "<!DOCTYPE foo>", a "<![CDATA[section]]>" or -// "<!a bogus comment". The opening "<!" has already been consumed. -func (z *Tokenizer) readMarkupDeclaration() TokenType { - z.data.start = z.raw.end - var c [2]byte - for i := 0; i < 2; i++ { - c[i] = z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return CommentToken - } - } - if c[0] == '-' && c[1] == '-' { - z.readComment() - return CommentToken - } - z.raw.end -= 2 - if z.readDoctype() { - return DoctypeToken - } - if z.allowCDATA && z.readCDATA() { - z.convertNUL = true - return TextToken - } - // It's a bogus comment. - z.readUntilCloseAngle() - return CommentToken -} - -// readDoctype attempts to read a doctype declaration and returns true if -// successful. The opening "<!" has already been consumed. -func (z *Tokenizer) readDoctype() bool { - const s = "DOCTYPE" - for i := 0; i < len(s); i++ { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return false - } - if c != s[i] && c != s[i]+('a'-'A') { - // Back up to read the fragment of "DOCTYPE" again. - z.raw.end = z.data.start - return false - } - } - if z.skipWhiteSpace(); z.err != nil { - z.data.start = z.raw.end - z.data.end = z.raw.end - return true - } - z.readUntilCloseAngle() - return true -} - -// readCDATA attempts to read a CDATA section and returns true if -// successful. The opening "<!" has already been consumed. -func (z *Tokenizer) readCDATA() bool { - const s = "[CDATA[" - for i := 0; i < len(s); i++ { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return false - } - if c != s[i] { - // Back up to read the fragment of "[CDATA[" again. - z.raw.end = z.data.start - return false - } - } - z.data.start = z.raw.end - brackets := 0 - for { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return true - } - switch c { - case ']': - brackets++ - case '>': - if brackets >= 2 { - z.data.end = z.raw.end - len("]]>") - return true - } - brackets = 0 - default: - brackets = 0 - } - } -} - -// startTagIn returns whether the start tag in z.buf[z.data.start:z.data.end] -// case-insensitively matches any element of ss. -func (z *Tokenizer) startTagIn(ss ...string) bool { -loop: - for _, s := range ss { - if z.data.end-z.data.start != len(s) { - continue loop - } - for i := 0; i < len(s); i++ { - c := z.buf[z.data.start+i] - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } - if c != s[i] { - continue loop - } - } - return true - } - return false -} - -// readStartTag reads the next start tag token. The opening "<a" has already -// been consumed, where 'a' means anything in [A-Za-z]. -func (z *Tokenizer) readStartTag() TokenType { - z.readTag(true) - if z.err != nil { - return ErrorToken - } - // Several tags flag the tokenizer's next token as raw. - c, raw := z.buf[z.data.start], false - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } - switch c { - case 'i': - raw = z.startTagIn("iframe") - case 'n': - raw = z.startTagIn("noembed", "noframes", "noscript") - case 'p': - raw = z.startTagIn("plaintext") - case 's': - raw = z.startTagIn("script", "style") - case 't': - raw = z.startTagIn("textarea", "title") - case 'x': - raw = z.startTagIn("xmp") - } - if raw { - z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end])) - } - // Look for a self-closing token like "<br/>". - if z.err == nil && z.buf[z.raw.end-2] == '/' { - return SelfClosingTagToken - } - return StartTagToken -} - -// readTag reads the next tag token and its attributes. If saveAttr, those -// attributes are saved in z.attr, otherwise z.attr is set to an empty slice. -// The opening "<a" or "</a" has already been consumed, where 'a' means anything -// in [A-Za-z]. -func (z *Tokenizer) readTag(saveAttr bool) { - z.attr = z.attr[:0] - z.nAttrReturned = 0 - // Read the tag name and attribute key/value pairs. - z.readTagName() - if z.skipWhiteSpace(); z.err != nil { - return - } - for { - c := z.readByte() - if z.err != nil || c == '>' { - break - } - z.raw.end-- - z.readTagAttrKey() - z.readTagAttrVal() - // Save pendingAttr if saveAttr and that attribute has a non-empty key. - if saveAttr && z.pendingAttr[0].start != z.pendingAttr[0].end { - z.attr = append(z.attr, z.pendingAttr) - } - if z.skipWhiteSpace(); z.err != nil { - break - } - } -} - -// readTagName sets z.data to the "div" in "<div k=v>". The reader (z.raw.end) -// is positioned such that the first byte of the tag name (the "d" in "<div") -// has already been consumed. -func (z *Tokenizer) readTagName() { - z.data.start = z.raw.end - 1 - for { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f': - z.data.end = z.raw.end - 1 - return - case '/', '>': - z.raw.end-- - z.data.end = z.raw.end - return - } - } -} - -// readTagAttrKey sets z.pendingAttr[0] to the "k" in "<div k=v>". -// Precondition: z.err == nil. -func (z *Tokenizer) readTagAttrKey() { - z.pendingAttr[0].start = z.raw.end - for { - c := z.readByte() - if z.err != nil { - z.pendingAttr[0].end = z.raw.end - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f', '/': - z.pendingAttr[0].end = z.raw.end - 1 - return - case '=', '>': - z.raw.end-- - z.pendingAttr[0].end = z.raw.end - return - } - } -} - -// readTagAttrVal sets z.pendingAttr[1] to the "v" in "<div k=v>". -func (z *Tokenizer) readTagAttrVal() { - z.pendingAttr[1].start = z.raw.end - z.pendingAttr[1].end = z.raw.end - if z.skipWhiteSpace(); z.err != nil { - return - } - c := z.readByte() - if z.err != nil { - return - } - if c != '=' { - z.raw.end-- - return - } - if z.skipWhiteSpace(); z.err != nil { - return - } - quote := z.readByte() - if z.err != nil { - return - } - switch quote { - case '>': - z.raw.end-- - return - - case '\'', '"': - z.pendingAttr[1].start = z.raw.end - for { - c := z.readByte() - if z.err != nil { - z.pendingAttr[1].end = z.raw.end - return - } - if c == quote { - z.pendingAttr[1].end = z.raw.end - 1 - return - } - } - - default: - z.pendingAttr[1].start = z.raw.end - 1 - for { - c := z.readByte() - if z.err != nil { - z.pendingAttr[1].end = z.raw.end - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f': - z.pendingAttr[1].end = z.raw.end - 1 - return - case '>': - z.raw.end-- - z.pendingAttr[1].end = z.raw.end - return - } - } - } -} - -// Next scans the next token and returns its type. -func (z *Tokenizer) Next() TokenType { - z.raw.start = z.raw.end - z.data.start = z.raw.end - z.data.end = z.raw.end - if z.err != nil { - z.tt = ErrorToken - return z.tt - } - if z.rawTag != "" { - if z.rawTag == "plaintext" { - // Read everything up to EOF. - for z.err == nil { - z.readByte() - } - z.data.end = z.raw.end - z.textIsRaw = true - } else { - z.readRawOrRCDATA() - } - if z.data.end > z.data.start { - z.tt = TextToken - z.convertNUL = true - return z.tt - } - } - z.textIsRaw = false - z.convertNUL = false - -loop: - for { - c := z.readByte() - if z.err != nil { - break loop - } - if c != '<' { - continue loop - } - - // Check if the '<' we have just read is part of a tag, comment - // or doctype. If not, it's part of the accumulated text token. - c = z.readByte() - if z.err != nil { - break loop - } - var tokenType TokenType - switch { - case 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z': - tokenType = StartTagToken - case c == '/': - tokenType = EndTagToken - case c == '!' || c == '?': - // We use CommentToken to mean any of "<!--actual comments-->", - // "<!DOCTYPE declarations>" and "<?xml processing instructions?>". - tokenType = CommentToken - default: - // Reconsume the current character. - z.raw.end-- - continue - } - - // We have a non-text token, but we might have accumulated some text - // before that. If so, we return the text first, and return the non- - // text token on the subsequent call to Next. - if x := z.raw.end - len("<a"); z.raw.start < x { - z.raw.end = x - z.data.end = x - z.tt = TextToken - return z.tt - } - switch tokenType { - case StartTagToken: - z.tt = z.readStartTag() - return z.tt - case EndTagToken: - c = z.readByte() - if z.err != nil { - break loop - } - if c == '>' { - // "</>" does not generate a token at all. Generate an empty comment - // to allow passthrough clients to pick up the data using Raw. - // Reset the tokenizer state and start again. - z.tt = CommentToken - return z.tt - } - if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' { - z.readTag(false) - if z.err != nil { - z.tt = ErrorToken - } else { - z.tt = EndTagToken - } - return z.tt - } - z.raw.end-- - z.readUntilCloseAngle() - z.tt = CommentToken - return z.tt - case CommentToken: - if c == '!' { - z.tt = z.readMarkupDeclaration() - return z.tt - } - z.raw.end-- - z.readUntilCloseAngle() - z.tt = CommentToken - return z.tt - } - } - if z.raw.start < z.raw.end { - z.data.end = z.raw.end - z.tt = TextToken - return z.tt - } - z.tt = ErrorToken - return z.tt -} - -// Raw returns the unmodified text of the current token. Calling Next, Token, -// Text, TagName or TagAttr may change the contents of the returned slice. -// -// The token stream's raw bytes partition the byte stream (up until an -// ErrorToken). There are no overlaps or gaps between two consecutive token's -// raw bytes. One implication is that the byte offset of the current token is -// the sum of the lengths of all previous tokens' raw bytes. -func (z *Tokenizer) Raw() []byte { - return z.buf[z.raw.start:z.raw.end] -} - -// convertNewlines converts "\r" and "\r\n" in s to "\n". -// The conversion happens in place, but the resulting slice may be shorter. -func convertNewlines(s []byte) []byte { - for i, c := range s { - if c != '\r' { - continue - } - - src := i + 1 - if src >= len(s) || s[src] != '\n' { - s[i] = '\n' - continue - } - - dst := i - for src < len(s) { - if s[src] == '\r' { - if src+1 < len(s) && s[src+1] == '\n' { - src++ - } - s[dst] = '\n' - } else { - s[dst] = s[src] - } - src++ - dst++ - } - return s[:dst] - } - return s -} - -var ( - nul = []byte("\x00") - replacement = []byte("\ufffd") -) - -// Text returns the unescaped text of a text, comment or doctype token. The -// contents of the returned slice may change on the next call to Next. -func (z *Tokenizer) Text() []byte { - switch z.tt { - case TextToken, CommentToken, DoctypeToken: - s := z.buf[z.data.start:z.data.end] - z.data.start = z.raw.end - z.data.end = z.raw.end - s = convertNewlines(s) - if (z.convertNUL || z.tt == CommentToken) && bytes.Contains(s, nul) { - s = bytes.Replace(s, nul, replacement, -1) - } - if !z.textIsRaw { - s = unescape(s, false) - } - return s - } - return nil -} - -// TagName returns the lower-cased name of a tag token (the `img` out of -// `<IMG SRC="foo">`) and whether the tag has attributes. -// The contents of the returned slice may change on the next call to Next. -func (z *Tokenizer) TagName() (name []byte, hasAttr bool) { - if z.data.start < z.data.end { - switch z.tt { - case StartTagToken, EndTagToken, SelfClosingTagToken: - s := z.buf[z.data.start:z.data.end] - z.data.start = z.raw.end - z.data.end = z.raw.end - return lower(s), z.nAttrReturned < len(z.attr) - } - } - return nil, false -} - -// TagAttr returns the lower-cased key and unescaped value of the next unparsed -// attribute for the current tag token and whether there are more attributes. -// The contents of the returned slices may change on the next call to Next. -func (z *Tokenizer) TagAttr() (key, val []byte, moreAttr bool) { - if z.nAttrReturned < len(z.attr) { - switch z.tt { - case StartTagToken, SelfClosingTagToken: - x := z.attr[z.nAttrReturned] - z.nAttrReturned++ - key = z.buf[x[0].start:x[0].end] - val = z.buf[x[1].start:x[1].end] - return lower(key), unescape(convertNewlines(val), true), z.nAttrReturned < len(z.attr) - } - } - return nil, nil, false -} - -// Token returns the current Token. The result's Data and Attr values remain -// valid after subsequent Next calls. -func (z *Tokenizer) Token() Token { - t := Token{Type: z.tt} - switch z.tt { - case TextToken, CommentToken, DoctypeToken: - t.Data = string(z.Text()) - case StartTagToken, SelfClosingTagToken, EndTagToken: - name, moreAttr := z.TagName() - for moreAttr { - var key, val []byte - key, val, moreAttr = z.TagAttr() - t.Attr = append(t.Attr, Attribute{"", atom.String(key), string(val)}) - } - if a := atom.Lookup(name); a != 0 { - t.DataAtom, t.Data = a, a.String() - } else { - t.DataAtom, t.Data = 0, string(name) - } - } - return t -} - -// SetMaxBuf sets a limit on the amount of data buffered during tokenization. -// A value of 0 means unlimited. -func (z *Tokenizer) SetMaxBuf(n int) { - z.maxBuf = n -} - -// NewTokenizer returns a new HTML Tokenizer for the given Reader. -// The input is assumed to be UTF-8 encoded. -func NewTokenizer(r io.Reader) *Tokenizer { - return NewTokenizerFragment(r, "") -} - -// NewTokenizerFragment returns a new HTML Tokenizer for the given Reader, for -// tokenizing an existing element's InnerHTML fragment. contextTag is that -// element's tag, such as "div" or "iframe". -// -// For example, how the InnerHTML "a<b" is tokenized depends on whether it is -// for a <p> tag or a <script> tag. -// -// The input is assumed to be UTF-8 encoded. -func NewTokenizerFragment(r io.Reader, contextTag string) *Tokenizer { - z := &Tokenizer{ - r: r, - buf: make([]byte, 0, 4096), - } - if contextTag != "" { - switch s := strings.ToLower(contextTag); s { - case "iframe", "noembed", "noframes", "noscript", "plaintext", "script", "style", "title", "textarea", "xmp": - z.rawTag = s - } - } - return z -} diff --git a/vendor/golang.org/x/net/http/httpguts/guts.go b/vendor/golang.org/x/net/http/httpguts/guts.go deleted file mode 100644 index e6cd0ced3..000000000 --- a/vendor/golang.org/x/net/http/httpguts/guts.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package httpguts provides functions implementing various details -// of the HTTP specification. -// -// This package is shared by the standard library (which vendors it) -// and x/net/http2. It comes with no API stability promise. -package httpguts - -import ( - "net/textproto" - "strings" -) - -// ValidTrailerHeader reports whether name is a valid header field name to appear -// in trailers. -// See RFC 7230, Section 4.1.2 -func ValidTrailerHeader(name string) bool { - name = textproto.CanonicalMIMEHeaderKey(name) - if strings.HasPrefix(name, "If-") || badTrailer[name] { - return false - } - return true -} - -var badTrailer = map[string]bool{ - "Authorization": true, - "Cache-Control": true, - "Connection": true, - "Content-Encoding": true, - "Content-Length": true, - "Content-Range": true, - "Content-Type": true, - "Expect": true, - "Host": true, - "Keep-Alive": true, - "Max-Forwards": true, - "Pragma": true, - "Proxy-Authenticate": true, - "Proxy-Authorization": true, - "Proxy-Connection": true, - "Range": true, - "Realm": true, - "Te": true, - "Trailer": true, - "Transfer-Encoding": true, - "Www-Authenticate": true, -} diff --git a/vendor/golang.org/x/net/http/httpguts/httplex.go b/vendor/golang.org/x/net/http/httpguts/httplex.go deleted file mode 100644 index e7de24ee6..000000000 --- a/vendor/golang.org/x/net/http/httpguts/httplex.go +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package httpguts - -import ( - "net" - "strings" - "unicode/utf8" - - "golang.org/x/net/idna" -) - -var isTokenTable = [127]bool{ - '!': true, - '#': true, - '$': true, - '%': true, - '&': true, - '\'': true, - '*': true, - '+': true, - '-': true, - '.': true, - '0': true, - '1': true, - '2': true, - '3': true, - '4': true, - '5': true, - '6': true, - '7': true, - '8': true, - '9': true, - 'A': true, - 'B': true, - 'C': true, - 'D': true, - 'E': true, - 'F': true, - 'G': true, - 'H': true, - 'I': true, - 'J': true, - 'K': true, - 'L': true, - 'M': true, - 'N': true, - 'O': true, - 'P': true, - 'Q': true, - 'R': true, - 'S': true, - 'T': true, - 'U': true, - 'W': true, - 'V': true, - 'X': true, - 'Y': true, - 'Z': true, - '^': true, - '_': true, - '`': true, - 'a': true, - 'b': true, - 'c': true, - 'd': true, - 'e': true, - 'f': true, - 'g': true, - 'h': true, - 'i': true, - 'j': true, - 'k': true, - 'l': true, - 'm': true, - 'n': true, - 'o': true, - 'p': true, - 'q': true, - 'r': true, - 's': true, - 't': true, - 'u': true, - 'v': true, - 'w': true, - 'x': true, - 'y': true, - 'z': true, - '|': true, - '~': true, -} - -func IsTokenRune(r rune) bool { - i := int(r) - return i < len(isTokenTable) && isTokenTable[i] -} - -func isNotToken(r rune) bool { - return !IsTokenRune(r) -} - -// HeaderValuesContainsToken reports whether any string in values -// contains the provided token, ASCII case-insensitively. -func HeaderValuesContainsToken(values []string, token string) bool { - for _, v := range values { - if headerValueContainsToken(v, token) { - return true - } - } - return false -} - -// isOWS reports whether b is an optional whitespace byte, as defined -// by RFC 7230 section 3.2.3. -func isOWS(b byte) bool { return b == ' ' || b == '\t' } - -// trimOWS returns x with all optional whitespace removes from the -// beginning and end. -func trimOWS(x string) string { - // TODO: consider using strings.Trim(x, " \t") instead, - // if and when it's fast enough. See issue 10292. - // But this ASCII-only code will probably always beat UTF-8 - // aware code. - for len(x) > 0 && isOWS(x[0]) { - x = x[1:] - } - for len(x) > 0 && isOWS(x[len(x)-1]) { - x = x[:len(x)-1] - } - return x -} - -// headerValueContainsToken reports whether v (assumed to be a -// 0#element, in the ABNF extension described in RFC 7230 section 7) -// contains token amongst its comma-separated tokens, ASCII -// case-insensitively. -func headerValueContainsToken(v string, token string) bool { - v = trimOWS(v) - if comma := strings.IndexByte(v, ','); comma != -1 { - return tokenEqual(trimOWS(v[:comma]), token) || headerValueContainsToken(v[comma+1:], token) - } - return tokenEqual(v, token) -} - -// lowerASCII returns the ASCII lowercase version of b. -func lowerASCII(b byte) byte { - if 'A' <= b && b <= 'Z' { - return b + ('a' - 'A') - } - return b -} - -// tokenEqual reports whether t1 and t2 are equal, ASCII case-insensitively. -func tokenEqual(t1, t2 string) bool { - if len(t1) != len(t2) { - return false - } - for i, b := range t1 { - if b >= utf8.RuneSelf { - // No UTF-8 or non-ASCII allowed in tokens. - return false - } - if lowerASCII(byte(b)) != lowerASCII(t2[i]) { - return false - } - } - return true -} - -// isLWS reports whether b is linear white space, according -// to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 -// LWS = [CRLF] 1*( SP | HT ) -func isLWS(b byte) bool { return b == ' ' || b == '\t' } - -// isCTL reports whether b is a control byte, according -// to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 -// CTL = <any US-ASCII control character -// (octets 0 - 31) and DEL (127)> -func isCTL(b byte) bool { - const del = 0x7f // a CTL - return b < ' ' || b == del -} - -// ValidHeaderFieldName reports whether v is a valid HTTP/1.x header name. -// HTTP/2 imposes the additional restriction that uppercase ASCII -// letters are not allowed. -// -// RFC 7230 says: -// header-field = field-name ":" OWS field-value OWS -// field-name = token -// token = 1*tchar -// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / -// "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA -func ValidHeaderFieldName(v string) bool { - if len(v) == 0 { - return false - } - for _, r := range v { - if !IsTokenRune(r) { - return false - } - } - return true -} - -// ValidHostHeader reports whether h is a valid host header. -func ValidHostHeader(h string) bool { - // The latest spec is actually this: - // - // http://tools.ietf.org/html/rfc7230#section-5.4 - // Host = uri-host [ ":" port ] - // - // Where uri-host is: - // http://tools.ietf.org/html/rfc3986#section-3.2.2 - // - // But we're going to be much more lenient for now and just - // search for any byte that's not a valid byte in any of those - // expressions. - for i := 0; i < len(h); i++ { - if !validHostByte[h[i]] { - return false - } - } - return true -} - -// See the validHostHeader comment. -var validHostByte = [256]bool{ - '0': true, '1': true, '2': true, '3': true, '4': true, '5': true, '6': true, '7': true, - '8': true, '9': true, - - 'a': true, 'b': true, 'c': true, 'd': true, 'e': true, 'f': true, 'g': true, 'h': true, - 'i': true, 'j': true, 'k': true, 'l': true, 'm': true, 'n': true, 'o': true, 'p': true, - 'q': true, 'r': true, 's': true, 't': true, 'u': true, 'v': true, 'w': true, 'x': true, - 'y': true, 'z': true, - - 'A': true, 'B': true, 'C': true, 'D': true, 'E': true, 'F': true, 'G': true, 'H': true, - 'I': true, 'J': true, 'K': true, 'L': true, 'M': true, 'N': true, 'O': true, 'P': true, - 'Q': true, 'R': true, 'S': true, 'T': true, 'U': true, 'V': true, 'W': true, 'X': true, - 'Y': true, 'Z': true, - - '!': true, // sub-delims - '$': true, // sub-delims - '%': true, // pct-encoded (and used in IPv6 zones) - '&': true, // sub-delims - '(': true, // sub-delims - ')': true, // sub-delims - '*': true, // sub-delims - '+': true, // sub-delims - ',': true, // sub-delims - '-': true, // unreserved - '.': true, // unreserved - ':': true, // IPv6address + Host expression's optional port - ';': true, // sub-delims - '=': true, // sub-delims - '[': true, - '\'': true, // sub-delims - ']': true, - '_': true, // unreserved - '~': true, // unreserved -} - -// ValidHeaderFieldValue reports whether v is a valid "field-value" according to -// http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 : -// -// message-header = field-name ":" [ field-value ] -// field-value = *( field-content | LWS ) -// field-content = <the OCTETs making up the field-value -// and consisting of either *TEXT or combinations -// of token, separators, and quoted-string> -// -// http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 : -// -// TEXT = <any OCTET except CTLs, -// but including LWS> -// LWS = [CRLF] 1*( SP | HT ) -// CTL = <any US-ASCII control character -// (octets 0 - 31) and DEL (127)> -// -// RFC 7230 says: -// field-value = *( field-content / obs-fold ) -// obj-fold = N/A to http2, and deprecated -// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] -// field-vchar = VCHAR / obs-text -// obs-text = %x80-FF -// VCHAR = "any visible [USASCII] character" -// -// http2 further says: "Similarly, HTTP/2 allows header field values -// that are not valid. While most of the values that can be encoded -// will not alter header field parsing, carriage return (CR, ASCII -// 0xd), line feed (LF, ASCII 0xa), and the zero character (NUL, ASCII -// 0x0) might be exploited by an attacker if they are translated -// verbatim. Any request or response that contains a character not -// permitted in a header field value MUST be treated as malformed -// (Section 8.1.2.6). Valid characters are defined by the -// field-content ABNF rule in Section 3.2 of [RFC7230]." -// -// This function does not (yet?) properly handle the rejection of -// strings that begin or end with SP or HTAB. -func ValidHeaderFieldValue(v string) bool { - for i := 0; i < len(v); i++ { - b := v[i] - if isCTL(b) && !isLWS(b) { - return false - } - } - return true -} - -func isASCII(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] >= utf8.RuneSelf { - return false - } - } - return true -} - -// PunycodeHostPort returns the IDNA Punycode version -// of the provided "host" or "host:port" string. -func PunycodeHostPort(v string) (string, error) { - if isASCII(v) { - return v, nil - } - - host, port, err := net.SplitHostPort(v) - if err != nil { - // The input 'v' argument was just a "host" argument, - // without a port. This error should not be returned - // to the caller. - host = v - port = "" - } - host, err = idna.ToASCII(host) - if err != nil { - // Non-UTF-8? Not representable in Punycode, in any - // case. - return "", err - } - if port == "" { - return host, nil - } - return net.JoinHostPort(host, port), nil -} diff --git a/vendor/golang.org/x/net/http/httpproxy/proxy.go b/vendor/golang.org/x/net/http/httpproxy/proxy.go deleted file mode 100644 index 163645b86..000000000 --- a/vendor/golang.org/x/net/http/httpproxy/proxy.go +++ /dev/null @@ -1,370 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package httpproxy provides support for HTTP proxy determination -// based on environment variables, as provided by net/http's -// ProxyFromEnvironment function. -// -// The API is not subject to the Go 1 compatibility promise and may change at -// any time. -package httpproxy - -import ( - "errors" - "fmt" - "net" - "net/url" - "os" - "strings" - "unicode/utf8" - - "golang.org/x/net/idna" -) - -// Config holds configuration for HTTP proxy settings. See -// FromEnvironment for details. -type Config struct { - // HTTPProxy represents the value of the HTTP_PROXY or - // http_proxy environment variable. It will be used as the proxy - // URL for HTTP requests and HTTPS requests unless overridden by - // HTTPSProxy or NoProxy. - HTTPProxy string - - // HTTPSProxy represents the HTTPS_PROXY or https_proxy - // environment variable. It will be used as the proxy URL for - // HTTPS requests unless overridden by NoProxy. - HTTPSProxy string - - // NoProxy represents the NO_PROXY or no_proxy environment - // variable. It specifies a string that contains comma-separated values - // specifying hosts that should be excluded from proxying. Each value is - // represented by an IP address prefix (1.2.3.4), an IP address prefix in - // CIDR notation (1.2.3.4/8), a domain name, or a special DNS label (*). - // An IP address prefix and domain name can also include a literal port - // number (1.2.3.4:80). - // A domain name matches that name and all subdomains. A domain name with - // a leading "." matches subdomains only. For example "foo.com" matches - // "foo.com" and "bar.foo.com"; ".y.com" matches "x.y.com" but not "y.com". - // A single asterisk (*) indicates that no proxying should be done. - // A best effort is made to parse the string and errors are - // ignored. - NoProxy string - - // CGI holds whether the current process is running - // as a CGI handler (FromEnvironment infers this from the - // presence of a REQUEST_METHOD environment variable). - // When this is set, ProxyForURL will return an error - // when HTTPProxy applies, because a client could be - // setting HTTP_PROXY maliciously. See https://golang.org/s/cgihttpproxy. - CGI bool -} - -// config holds the parsed configuration for HTTP proxy settings. -type config struct { - // Config represents the original configuration as defined above. - Config - - // httpsProxy is the parsed URL of the HTTPSProxy if defined. - httpsProxy *url.URL - - // httpProxy is the parsed URL of the HTTPProxy if defined. - httpProxy *url.URL - - // ipMatchers represent all values in the NoProxy that are IP address - // prefixes or an IP address in CIDR notation. - ipMatchers []matcher - - // domainMatchers represent all values in the NoProxy that are a domain - // name or hostname & domain name - domainMatchers []matcher -} - -// FromEnvironment returns a Config instance populated from the -// environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the -// lowercase versions thereof). HTTPS_PROXY takes precedence over -// HTTP_PROXY for https requests. -// -// The environment values may be either a complete URL or a -// "host[:port]", in which case the "http" scheme is assumed. An error -// is returned if the value is a different form. -func FromEnvironment() *Config { - return &Config{ - HTTPProxy: getEnvAny("HTTP_PROXY", "http_proxy"), - HTTPSProxy: getEnvAny("HTTPS_PROXY", "https_proxy"), - NoProxy: getEnvAny("NO_PROXY", "no_proxy"), - CGI: os.Getenv("REQUEST_METHOD") != "", - } -} - -func getEnvAny(names ...string) string { - for _, n := range names { - if val := os.Getenv(n); val != "" { - return val - } - } - return "" -} - -// ProxyFunc returns a function that determines the proxy URL to use for -// a given request URL. Changing the contents of cfg will not affect -// proxy functions created earlier. -// -// A nil URL and nil error are returned if no proxy is defined in the -// environment, or a proxy should not be used for the given request, as -// defined by NO_PROXY. -// -// As a special case, if req.URL.Host is "localhost" (with or without a -// port number), then a nil URL and nil error will be returned. -func (cfg *Config) ProxyFunc() func(reqURL *url.URL) (*url.URL, error) { - // Preprocess the Config settings for more efficient evaluation. - cfg1 := &config{ - Config: *cfg, - } - cfg1.init() - return cfg1.proxyForURL -} - -func (cfg *config) proxyForURL(reqURL *url.URL) (*url.URL, error) { - var proxy *url.URL - if reqURL.Scheme == "https" { - proxy = cfg.httpsProxy - } - if proxy == nil { - proxy = cfg.httpProxy - if proxy != nil && cfg.CGI { - return nil, errors.New("refusing to use HTTP_PROXY value in CGI environment; see golang.org/s/cgihttpproxy") - } - } - if proxy == nil { - return nil, nil - } - if !cfg.useProxy(canonicalAddr(reqURL)) { - return nil, nil - } - - return proxy, nil -} - -func parseProxy(proxy string) (*url.URL, error) { - if proxy == "" { - return nil, nil - } - - proxyURL, err := url.Parse(proxy) - if err != nil || - (proxyURL.Scheme != "http" && - proxyURL.Scheme != "https" && - proxyURL.Scheme != "socks5") { - // proxy was bogus. Try prepending "http://" to it and - // see if that parses correctly. If not, we fall - // through and complain about the original one. - if proxyURL, err := url.Parse("http://" + proxy); err == nil { - return proxyURL, nil - } - } - if err != nil { - return nil, fmt.Errorf("invalid proxy address %q: %v", proxy, err) - } - return proxyURL, nil -} - -// useProxy reports whether requests to addr should use a proxy, -// according to the NO_PROXY or no_proxy environment variable. -// addr is always a canonicalAddr with a host and port. -func (cfg *config) useProxy(addr string) bool { - if len(addr) == 0 { - return true - } - host, port, err := net.SplitHostPort(addr) - if err != nil { - return false - } - if host == "localhost" { - return false - } - ip := net.ParseIP(host) - if ip != nil { - if ip.IsLoopback() { - return false - } - } - - addr = strings.ToLower(strings.TrimSpace(host)) - - if ip != nil { - for _, m := range cfg.ipMatchers { - if m.match(addr, port, ip) { - return false - } - } - } - for _, m := range cfg.domainMatchers { - if m.match(addr, port, ip) { - return false - } - } - return true -} - -func (c *config) init() { - if parsed, err := parseProxy(c.HTTPProxy); err == nil { - c.httpProxy = parsed - } - if parsed, err := parseProxy(c.HTTPSProxy); err == nil { - c.httpsProxy = parsed - } - - for _, p := range strings.Split(c.NoProxy, ",") { - p = strings.ToLower(strings.TrimSpace(p)) - if len(p) == 0 { - continue - } - - if p == "*" { - c.ipMatchers = []matcher{allMatch{}} - c.domainMatchers = []matcher{allMatch{}} - return - } - - // IPv4/CIDR, IPv6/CIDR - if _, pnet, err := net.ParseCIDR(p); err == nil { - c.ipMatchers = append(c.ipMatchers, cidrMatch{cidr: pnet}) - continue - } - - // IPv4:port, [IPv6]:port - phost, pport, err := net.SplitHostPort(p) - if err == nil { - if len(phost) == 0 { - // There is no host part, likely the entry is malformed; ignore. - continue - } - if phost[0] == '[' && phost[len(phost)-1] == ']' { - phost = phost[1 : len(phost)-1] - } - } else { - phost = p - } - // IPv4, IPv6 - if pip := net.ParseIP(phost); pip != nil { - c.ipMatchers = append(c.ipMatchers, ipMatch{ip: pip, port: pport}) - continue - } - - if len(phost) == 0 { - // There is no host part, likely the entry is malformed; ignore. - continue - } - - // domain.com or domain.com:80 - // foo.com matches bar.foo.com - // .domain.com or .domain.com:port - // *.domain.com or *.domain.com:port - if strings.HasPrefix(phost, "*.") { - phost = phost[1:] - } - matchHost := false - if phost[0] != '.' { - matchHost = true - phost = "." + phost - } - c.domainMatchers = append(c.domainMatchers, domainMatch{host: phost, port: pport, matchHost: matchHost}) - } -} - -var portMap = map[string]string{ - "http": "80", - "https": "443", - "socks5": "1080", -} - -// canonicalAddr returns url.Host but always with a ":port" suffix -func canonicalAddr(url *url.URL) string { - addr := url.Hostname() - if v, err := idnaASCII(addr); err == nil { - addr = v - } - port := url.Port() - if port == "" { - port = portMap[url.Scheme] - } - return net.JoinHostPort(addr, port) -} - -// Given a string of the form "host", "host:port", or "[ipv6::address]:port", -// return true if the string includes a port. -func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") } - -func idnaASCII(v string) (string, error) { - // TODO: Consider removing this check after verifying performance is okay. - // Right now punycode verification, length checks, context checks, and the - // permissible character tests are all omitted. It also prevents the ToASCII - // call from salvaging an invalid IDN, when possible. As a result it may be - // possible to have two IDNs that appear identical to the user where the - // ASCII-only version causes an error downstream whereas the non-ASCII - // version does not. - // Note that for correct ASCII IDNs ToASCII will only do considerably more - // work, but it will not cause an allocation. - if isASCII(v) { - return v, nil - } - return idna.Lookup.ToASCII(v) -} - -func isASCII(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] >= utf8.RuneSelf { - return false - } - } - return true -} - -// matcher represents the matching rule for a given value in the NO_PROXY list -type matcher interface { - // match returns true if the host and optional port or ip and optional port - // are allowed - match(host, port string, ip net.IP) bool -} - -// allMatch matches on all possible inputs -type allMatch struct{} - -func (a allMatch) match(host, port string, ip net.IP) bool { - return true -} - -type cidrMatch struct { - cidr *net.IPNet -} - -func (m cidrMatch) match(host, port string, ip net.IP) bool { - return m.cidr.Contains(ip) -} - -type ipMatch struct { - ip net.IP - port string -} - -func (m ipMatch) match(host, port string, ip net.IP) bool { - if m.ip.Equal(ip) { - return m.port == "" || m.port == port - } - return false -} - -type domainMatch struct { - host string - port string - - matchHost bool -} - -func (m domainMatch) match(host, port string, ip net.IP) bool { - if strings.HasSuffix(host, m.host) || (m.matchHost && host == m.host[1:]) { - return m.port == "" || m.port == port - } - return false -} diff --git a/vendor/golang.org/x/net/http2/.gitignore b/vendor/golang.org/x/net/http2/.gitignore deleted file mode 100644 index 190f12234..000000000 --- a/vendor/golang.org/x/net/http2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -h2i/h2i diff --git a/vendor/golang.org/x/net/http2/Dockerfile b/vendor/golang.org/x/net/http2/Dockerfile deleted file mode 100644 index 53fc52579..000000000 --- a/vendor/golang.org/x/net/http2/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -# -# This Dockerfile builds a recent curl with HTTP/2 client support, using -# a recent nghttp2 build. -# -# See the Makefile for how to tag it. If Docker and that image is found, the -# Go tests use this curl binary for integration tests. -# - -FROM ubuntu:trusty - -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y git-core build-essential wget - -RUN apt-get install -y --no-install-recommends \ - autotools-dev libtool pkg-config zlib1g-dev \ - libcunit1-dev libssl-dev libxml2-dev libevent-dev \ - automake autoconf - -# The list of packages nghttp2 recommends for h2load: -RUN apt-get install -y --no-install-recommends make binutils \ - autoconf automake autotools-dev \ - libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev \ - libev-dev libevent-dev libjansson-dev libjemalloc-dev \ - cython python3.4-dev python-setuptools - -# Note: setting NGHTTP2_VER before the git clone, so an old git clone isn't cached: -ENV NGHTTP2_VER 895da9a -RUN cd /root && git clone https://github.com/tatsuhiro-t/nghttp2.git - -WORKDIR /root/nghttp2 -RUN git reset --hard $NGHTTP2_VER -RUN autoreconf -i -RUN automake -RUN autoconf -RUN ./configure -RUN make -RUN make install - -WORKDIR /root -RUN wget http://curl.haxx.se/download/curl-7.45.0.tar.gz -RUN tar -zxvf curl-7.45.0.tar.gz -WORKDIR /root/curl-7.45.0 -RUN ./configure --with-ssl --with-nghttp2=/usr/local -RUN make -RUN make install -RUN ldconfig - -CMD ["-h"] -ENTRYPOINT ["/usr/local/bin/curl"] - diff --git a/vendor/golang.org/x/net/http2/Makefile b/vendor/golang.org/x/net/http2/Makefile deleted file mode 100644 index 55fd826f7..000000000 --- a/vendor/golang.org/x/net/http2/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -curlimage: - docker build -t gohttp2/curl . - diff --git a/vendor/golang.org/x/net/http2/README b/vendor/golang.org/x/net/http2/README deleted file mode 100644 index 360d5aa37..000000000 --- a/vendor/golang.org/x/net/http2/README +++ /dev/null @@ -1,20 +0,0 @@ -This is a work-in-progress HTTP/2 implementation for Go. - -It will eventually live in the Go standard library and won't require -any changes to your code to use. It will just be automatic. - -Status: - -* The server support is pretty good. A few things are missing - but are being worked on. -* The client work has just started but shares a lot of code - is coming along much quicker. - -Docs are at https://godoc.org/golang.org/x/net/http2 - -Demo test server at https://http2.golang.org/ - -Help & bug reports welcome! - -Contributing: https://golang.org/doc/contribute.html -Bugs: https://golang.org/issue/new?title=x/net/http2:+ diff --git a/vendor/golang.org/x/net/http2/ciphers.go b/vendor/golang.org/x/net/http2/ciphers.go deleted file mode 100644 index c9a0cf3b4..000000000 --- a/vendor/golang.org/x/net/http2/ciphers.go +++ /dev/null @@ -1,641 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -// A list of the possible cipher suite ids. Taken from -// https://www.iana.org/assignments/tls-parameters/tls-parameters.txt - -const ( - cipher_TLS_NULL_WITH_NULL_NULL uint16 = 0x0000 - cipher_TLS_RSA_WITH_NULL_MD5 uint16 = 0x0001 - cipher_TLS_RSA_WITH_NULL_SHA uint16 = 0x0002 - cipher_TLS_RSA_EXPORT_WITH_RC4_40_MD5 uint16 = 0x0003 - cipher_TLS_RSA_WITH_RC4_128_MD5 uint16 = 0x0004 - cipher_TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 - cipher_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 uint16 = 0x0006 - cipher_TLS_RSA_WITH_IDEA_CBC_SHA uint16 = 0x0007 - cipher_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0008 - cipher_TLS_RSA_WITH_DES_CBC_SHA uint16 = 0x0009 - cipher_TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000A - cipher_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x000B - cipher_TLS_DH_DSS_WITH_DES_CBC_SHA uint16 = 0x000C - cipher_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA uint16 = 0x000D - cipher_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x000E - cipher_TLS_DH_RSA_WITH_DES_CBC_SHA uint16 = 0x000F - cipher_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x0010 - cipher_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0011 - cipher_TLS_DHE_DSS_WITH_DES_CBC_SHA uint16 = 0x0012 - cipher_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA uint16 = 0x0013 - cipher_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0014 - cipher_TLS_DHE_RSA_WITH_DES_CBC_SHA uint16 = 0x0015 - cipher_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x0016 - cipher_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 uint16 = 0x0017 - cipher_TLS_DH_anon_WITH_RC4_128_MD5 uint16 = 0x0018 - cipher_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA uint16 = 0x0019 - cipher_TLS_DH_anon_WITH_DES_CBC_SHA uint16 = 0x001A - cipher_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA uint16 = 0x001B - // Reserved uint16 = 0x001C-1D - cipher_TLS_KRB5_WITH_DES_CBC_SHA uint16 = 0x001E - cipher_TLS_KRB5_WITH_3DES_EDE_CBC_SHA uint16 = 0x001F - cipher_TLS_KRB5_WITH_RC4_128_SHA uint16 = 0x0020 - cipher_TLS_KRB5_WITH_IDEA_CBC_SHA uint16 = 0x0021 - cipher_TLS_KRB5_WITH_DES_CBC_MD5 uint16 = 0x0022 - cipher_TLS_KRB5_WITH_3DES_EDE_CBC_MD5 uint16 = 0x0023 - cipher_TLS_KRB5_WITH_RC4_128_MD5 uint16 = 0x0024 - cipher_TLS_KRB5_WITH_IDEA_CBC_MD5 uint16 = 0x0025 - cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA uint16 = 0x0026 - cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA uint16 = 0x0027 - cipher_TLS_KRB5_EXPORT_WITH_RC4_40_SHA uint16 = 0x0028 - cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 uint16 = 0x0029 - cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 uint16 = 0x002A - cipher_TLS_KRB5_EXPORT_WITH_RC4_40_MD5 uint16 = 0x002B - cipher_TLS_PSK_WITH_NULL_SHA uint16 = 0x002C - cipher_TLS_DHE_PSK_WITH_NULL_SHA uint16 = 0x002D - cipher_TLS_RSA_PSK_WITH_NULL_SHA uint16 = 0x002E - cipher_TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002F - cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA uint16 = 0x0030 - cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA uint16 = 0x0031 - cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA uint16 = 0x0032 - cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0x0033 - cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA uint16 = 0x0034 - cipher_TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 - cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA uint16 = 0x0036 - cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0037 - cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA uint16 = 0x0038 - cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0039 - cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA uint16 = 0x003A - cipher_TLS_RSA_WITH_NULL_SHA256 uint16 = 0x003B - cipher_TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003C - cipher_TLS_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x003D - cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA256 uint16 = 0x003E - cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003F - cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 uint16 = 0x0040 - cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0041 - cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0042 - cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0043 - cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0044 - cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0045 - cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA uint16 = 0x0046 - // Reserved uint16 = 0x0047-4F - // Reserved uint16 = 0x0050-58 - // Reserved uint16 = 0x0059-5C - // Unassigned uint16 = 0x005D-5F - // Reserved uint16 = 0x0060-66 - cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x0067 - cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA256 uint16 = 0x0068 - cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x0069 - cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 uint16 = 0x006A - cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 uint16 = 0x006B - cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA256 uint16 = 0x006C - cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA256 uint16 = 0x006D - // Unassigned uint16 = 0x006E-83 - cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0084 - cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0085 - cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0086 - cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0087 - cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0088 - cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA uint16 = 0x0089 - cipher_TLS_PSK_WITH_RC4_128_SHA uint16 = 0x008A - cipher_TLS_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0x008B - cipher_TLS_PSK_WITH_AES_128_CBC_SHA uint16 = 0x008C - cipher_TLS_PSK_WITH_AES_256_CBC_SHA uint16 = 0x008D - cipher_TLS_DHE_PSK_WITH_RC4_128_SHA uint16 = 0x008E - cipher_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0x008F - cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA uint16 = 0x0090 - cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA uint16 = 0x0091 - cipher_TLS_RSA_PSK_WITH_RC4_128_SHA uint16 = 0x0092 - cipher_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0x0093 - cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA uint16 = 0x0094 - cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA uint16 = 0x0095 - cipher_TLS_RSA_WITH_SEED_CBC_SHA uint16 = 0x0096 - cipher_TLS_DH_DSS_WITH_SEED_CBC_SHA uint16 = 0x0097 - cipher_TLS_DH_RSA_WITH_SEED_CBC_SHA uint16 = 0x0098 - cipher_TLS_DHE_DSS_WITH_SEED_CBC_SHA uint16 = 0x0099 - cipher_TLS_DHE_RSA_WITH_SEED_CBC_SHA uint16 = 0x009A - cipher_TLS_DH_anon_WITH_SEED_CBC_SHA uint16 = 0x009B - cipher_TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009C - cipher_TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009D - cipher_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009E - cipher_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009F - cipher_TLS_DH_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x00A0 - cipher_TLS_DH_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x00A1 - cipher_TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 uint16 = 0x00A2 - cipher_TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 uint16 = 0x00A3 - cipher_TLS_DH_DSS_WITH_AES_128_GCM_SHA256 uint16 = 0x00A4 - cipher_TLS_DH_DSS_WITH_AES_256_GCM_SHA384 uint16 = 0x00A5 - cipher_TLS_DH_anon_WITH_AES_128_GCM_SHA256 uint16 = 0x00A6 - cipher_TLS_DH_anon_WITH_AES_256_GCM_SHA384 uint16 = 0x00A7 - cipher_TLS_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00A8 - cipher_TLS_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00A9 - cipher_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00AA - cipher_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00AB - cipher_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00AC - cipher_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00AD - cipher_TLS_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00AE - cipher_TLS_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00AF - cipher_TLS_PSK_WITH_NULL_SHA256 uint16 = 0x00B0 - cipher_TLS_PSK_WITH_NULL_SHA384 uint16 = 0x00B1 - cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00B2 - cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00B3 - cipher_TLS_DHE_PSK_WITH_NULL_SHA256 uint16 = 0x00B4 - cipher_TLS_DHE_PSK_WITH_NULL_SHA384 uint16 = 0x00B5 - cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00B6 - cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00B7 - cipher_TLS_RSA_PSK_WITH_NULL_SHA256 uint16 = 0x00B8 - cipher_TLS_RSA_PSK_WITH_NULL_SHA384 uint16 = 0x00B9 - cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BA - cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BB - cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BC - cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BD - cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BE - cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0x00BF - cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C0 - cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C1 - cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C2 - cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C3 - cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C4 - cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256 uint16 = 0x00C5 - // Unassigned uint16 = 0x00C6-FE - cipher_TLS_EMPTY_RENEGOTIATION_INFO_SCSV uint16 = 0x00FF - // Unassigned uint16 = 0x01-55,* - cipher_TLS_FALLBACK_SCSV uint16 = 0x5600 - // Unassigned uint16 = 0x5601 - 0xC000 - cipher_TLS_ECDH_ECDSA_WITH_NULL_SHA uint16 = 0xC001 - cipher_TLS_ECDH_ECDSA_WITH_RC4_128_SHA uint16 = 0xC002 - cipher_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC003 - cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xC004 - cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xC005 - cipher_TLS_ECDHE_ECDSA_WITH_NULL_SHA uint16 = 0xC006 - cipher_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xC007 - cipher_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC008 - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xC009 - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xC00A - cipher_TLS_ECDH_RSA_WITH_NULL_SHA uint16 = 0xC00B - cipher_TLS_ECDH_RSA_WITH_RC4_128_SHA uint16 = 0xC00C - cipher_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC00D - cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA uint16 = 0xC00E - cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA uint16 = 0xC00F - cipher_TLS_ECDHE_RSA_WITH_NULL_SHA uint16 = 0xC010 - cipher_TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xC011 - cipher_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC012 - cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xC013 - cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xC014 - cipher_TLS_ECDH_anon_WITH_NULL_SHA uint16 = 0xC015 - cipher_TLS_ECDH_anon_WITH_RC4_128_SHA uint16 = 0xC016 - cipher_TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA uint16 = 0xC017 - cipher_TLS_ECDH_anon_WITH_AES_128_CBC_SHA uint16 = 0xC018 - cipher_TLS_ECDH_anon_WITH_AES_256_CBC_SHA uint16 = 0xC019 - cipher_TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC01A - cipher_TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xC01B - cipher_TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA uint16 = 0xC01C - cipher_TLS_SRP_SHA_WITH_AES_128_CBC_SHA uint16 = 0xC01D - cipher_TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA uint16 = 0xC01E - cipher_TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA uint16 = 0xC01F - cipher_TLS_SRP_SHA_WITH_AES_256_CBC_SHA uint16 = 0xC020 - cipher_TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA uint16 = 0xC021 - cipher_TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA uint16 = 0xC022 - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC023 - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC024 - cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC025 - cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC026 - cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC027 - cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC028 - cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xC029 - cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 uint16 = 0xC02A - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC02B - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC02C - cipher_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC02D - cipher_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC02E - cipher_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC02F - cipher_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC030 - cipher_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xC031 - cipher_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xC032 - cipher_TLS_ECDHE_PSK_WITH_RC4_128_SHA uint16 = 0xC033 - cipher_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA uint16 = 0xC034 - cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA uint16 = 0xC035 - cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA uint16 = 0xC036 - cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0xC037 - cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0xC038 - cipher_TLS_ECDHE_PSK_WITH_NULL_SHA uint16 = 0xC039 - cipher_TLS_ECDHE_PSK_WITH_NULL_SHA256 uint16 = 0xC03A - cipher_TLS_ECDHE_PSK_WITH_NULL_SHA384 uint16 = 0xC03B - cipher_TLS_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC03C - cipher_TLS_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC03D - cipher_TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC03E - cipher_TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC03F - cipher_TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC040 - cipher_TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC041 - cipher_TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC042 - cipher_TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC043 - cipher_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC044 - cipher_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC045 - cipher_TLS_DH_anon_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC046 - cipher_TLS_DH_anon_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC047 - cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC048 - cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC049 - cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC04A - cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC04B - cipher_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC04C - cipher_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC04D - cipher_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC04E - cipher_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC04F - cipher_TLS_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC050 - cipher_TLS_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC051 - cipher_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC052 - cipher_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC053 - cipher_TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC054 - cipher_TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC055 - cipher_TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC056 - cipher_TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC057 - cipher_TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC058 - cipher_TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC059 - cipher_TLS_DH_anon_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC05A - cipher_TLS_DH_anon_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC05B - cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC05C - cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC05D - cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC05E - cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC05F - cipher_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC060 - cipher_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC061 - cipher_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC062 - cipher_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC063 - cipher_TLS_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC064 - cipher_TLS_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC065 - cipher_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC066 - cipher_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC067 - cipher_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC068 - cipher_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC069 - cipher_TLS_PSK_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC06A - cipher_TLS_PSK_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC06B - cipher_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC06C - cipher_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC06D - cipher_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 uint16 = 0xC06E - cipher_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 uint16 = 0xC06F - cipher_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 uint16 = 0xC070 - cipher_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 uint16 = 0xC071 - cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC072 - cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC073 - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC074 - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC075 - cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC076 - cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC077 - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC078 - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC079 - cipher_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC07A - cipher_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC07B - cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC07C - cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC07D - cipher_TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC07E - cipher_TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC07F - cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC080 - cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC081 - cipher_TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC082 - cipher_TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC083 - cipher_TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC084 - cipher_TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC085 - cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC086 - cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC087 - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC088 - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC089 - cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC08A - cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC08B - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC08C - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC08D - cipher_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC08E - cipher_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC08F - cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC090 - cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC091 - cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 uint16 = 0xC092 - cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 uint16 = 0xC093 - cipher_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC094 - cipher_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC095 - cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC096 - cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC097 - cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC098 - cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC099 - cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 uint16 = 0xC09A - cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 uint16 = 0xC09B - cipher_TLS_RSA_WITH_AES_128_CCM uint16 = 0xC09C - cipher_TLS_RSA_WITH_AES_256_CCM uint16 = 0xC09D - cipher_TLS_DHE_RSA_WITH_AES_128_CCM uint16 = 0xC09E - cipher_TLS_DHE_RSA_WITH_AES_256_CCM uint16 = 0xC09F - cipher_TLS_RSA_WITH_AES_128_CCM_8 uint16 = 0xC0A0 - cipher_TLS_RSA_WITH_AES_256_CCM_8 uint16 = 0xC0A1 - cipher_TLS_DHE_RSA_WITH_AES_128_CCM_8 uint16 = 0xC0A2 - cipher_TLS_DHE_RSA_WITH_AES_256_CCM_8 uint16 = 0xC0A3 - cipher_TLS_PSK_WITH_AES_128_CCM uint16 = 0xC0A4 - cipher_TLS_PSK_WITH_AES_256_CCM uint16 = 0xC0A5 - cipher_TLS_DHE_PSK_WITH_AES_128_CCM uint16 = 0xC0A6 - cipher_TLS_DHE_PSK_WITH_AES_256_CCM uint16 = 0xC0A7 - cipher_TLS_PSK_WITH_AES_128_CCM_8 uint16 = 0xC0A8 - cipher_TLS_PSK_WITH_AES_256_CCM_8 uint16 = 0xC0A9 - cipher_TLS_PSK_DHE_WITH_AES_128_CCM_8 uint16 = 0xC0AA - cipher_TLS_PSK_DHE_WITH_AES_256_CCM_8 uint16 = 0xC0AB - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM uint16 = 0xC0AC - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CCM uint16 = 0xC0AD - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 uint16 = 0xC0AE - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 uint16 = 0xC0AF - // Unassigned uint16 = 0xC0B0-FF - // Unassigned uint16 = 0xC1-CB,* - // Unassigned uint16 = 0xCC00-A7 - cipher_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCA8 - cipher_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCA9 - cipher_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAA - cipher_TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAB - cipher_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAC - cipher_TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAD - cipher_TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xCCAE -) - -// isBadCipher reports whether the cipher is blacklisted by the HTTP/2 spec. -// References: -// https://tools.ietf.org/html/rfc7540#appendix-A -// Reject cipher suites from Appendix A. -// "This list includes those cipher suites that do not -// offer an ephemeral key exchange and those that are -// based on the TLS null, stream or block cipher type" -func isBadCipher(cipher uint16) bool { - switch cipher { - case cipher_TLS_NULL_WITH_NULL_NULL, - cipher_TLS_RSA_WITH_NULL_MD5, - cipher_TLS_RSA_WITH_NULL_SHA, - cipher_TLS_RSA_EXPORT_WITH_RC4_40_MD5, - cipher_TLS_RSA_WITH_RC4_128_MD5, - cipher_TLS_RSA_WITH_RC4_128_SHA, - cipher_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5, - cipher_TLS_RSA_WITH_IDEA_CBC_SHA, - cipher_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA, - cipher_TLS_RSA_WITH_DES_CBC_SHA, - cipher_TLS_RSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA, - cipher_TLS_DH_DSS_WITH_DES_CBC_SHA, - cipher_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA, - cipher_TLS_DH_RSA_WITH_DES_CBC_SHA, - cipher_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_DES_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_DES_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5, - cipher_TLS_DH_anon_WITH_RC4_128_MD5, - cipher_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA, - cipher_TLS_DH_anon_WITH_DES_CBC_SHA, - cipher_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_KRB5_WITH_DES_CBC_SHA, - cipher_TLS_KRB5_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_KRB5_WITH_RC4_128_SHA, - cipher_TLS_KRB5_WITH_IDEA_CBC_SHA, - cipher_TLS_KRB5_WITH_DES_CBC_MD5, - cipher_TLS_KRB5_WITH_3DES_EDE_CBC_MD5, - cipher_TLS_KRB5_WITH_RC4_128_MD5, - cipher_TLS_KRB5_WITH_IDEA_CBC_MD5, - cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA, - cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA, - cipher_TLS_KRB5_EXPORT_WITH_RC4_40_SHA, - cipher_TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5, - cipher_TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5, - cipher_TLS_KRB5_EXPORT_WITH_RC4_40_MD5, - cipher_TLS_PSK_WITH_NULL_SHA, - cipher_TLS_DHE_PSK_WITH_NULL_SHA, - cipher_TLS_RSA_PSK_WITH_NULL_SHA, - cipher_TLS_RSA_WITH_AES_128_CBC_SHA, - cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA, - cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA, - cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA, - cipher_TLS_RSA_WITH_AES_256_CBC_SHA, - cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA, - cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA, - cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA, - cipher_TLS_RSA_WITH_NULL_SHA256, - cipher_TLS_RSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_RSA_WITH_AES_256_CBC_SHA256, - cipher_TLS_DH_DSS_WITH_AES_128_CBC_SHA256, - cipher_TLS_DH_RSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, - cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA, - cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA, - cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA, - cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_DH_DSS_WITH_AES_256_CBC_SHA256, - cipher_TLS_DH_RSA_WITH_AES_256_CBC_SHA256, - cipher_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, - cipher_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, - cipher_TLS_DH_anon_WITH_AES_128_CBC_SHA256, - cipher_TLS_DH_anon_WITH_AES_256_CBC_SHA256, - cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA, - cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA, - cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA, - cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA, - cipher_TLS_PSK_WITH_RC4_128_SHA, - cipher_TLS_PSK_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_PSK_WITH_AES_128_CBC_SHA, - cipher_TLS_PSK_WITH_AES_256_CBC_SHA, - cipher_TLS_DHE_PSK_WITH_RC4_128_SHA, - cipher_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA, - cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA, - cipher_TLS_RSA_PSK_WITH_RC4_128_SHA, - cipher_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA, - cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA, - cipher_TLS_RSA_WITH_SEED_CBC_SHA, - cipher_TLS_DH_DSS_WITH_SEED_CBC_SHA, - cipher_TLS_DH_RSA_WITH_SEED_CBC_SHA, - cipher_TLS_DHE_DSS_WITH_SEED_CBC_SHA, - cipher_TLS_DHE_RSA_WITH_SEED_CBC_SHA, - cipher_TLS_DH_anon_WITH_SEED_CBC_SHA, - cipher_TLS_RSA_WITH_AES_128_GCM_SHA256, - cipher_TLS_RSA_WITH_AES_256_GCM_SHA384, - cipher_TLS_DH_RSA_WITH_AES_128_GCM_SHA256, - cipher_TLS_DH_RSA_WITH_AES_256_GCM_SHA384, - cipher_TLS_DH_DSS_WITH_AES_128_GCM_SHA256, - cipher_TLS_DH_DSS_WITH_AES_256_GCM_SHA384, - cipher_TLS_DH_anon_WITH_AES_128_GCM_SHA256, - cipher_TLS_DH_anon_WITH_AES_256_GCM_SHA384, - cipher_TLS_PSK_WITH_AES_128_GCM_SHA256, - cipher_TLS_PSK_WITH_AES_256_GCM_SHA384, - cipher_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256, - cipher_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384, - cipher_TLS_PSK_WITH_AES_128_CBC_SHA256, - cipher_TLS_PSK_WITH_AES_256_CBC_SHA384, - cipher_TLS_PSK_WITH_NULL_SHA256, - cipher_TLS_PSK_WITH_NULL_SHA384, - cipher_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256, - cipher_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384, - cipher_TLS_DHE_PSK_WITH_NULL_SHA256, - cipher_TLS_DHE_PSK_WITH_NULL_SHA384, - cipher_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256, - cipher_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384, - cipher_TLS_RSA_PSK_WITH_NULL_SHA256, - cipher_TLS_RSA_PSK_WITH_NULL_SHA384, - cipher_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256, - cipher_TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256, - cipher_TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256, - cipher_TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256, - cipher_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256, - cipher_TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256, - cipher_TLS_EMPTY_RENEGOTIATION_INFO_SCSV, - cipher_TLS_ECDH_ECDSA_WITH_NULL_SHA, - cipher_TLS_ECDH_ECDSA_WITH_RC4_128_SHA, - cipher_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, - cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, - cipher_TLS_ECDHE_ECDSA_WITH_NULL_SHA, - cipher_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, - cipher_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, - cipher_TLS_ECDH_RSA_WITH_NULL_SHA, - cipher_TLS_ECDH_RSA_WITH_RC4_128_SHA, - cipher_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, - cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, - cipher_TLS_ECDHE_RSA_WITH_NULL_SHA, - cipher_TLS_ECDHE_RSA_WITH_RC4_128_SHA, - cipher_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, - cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, - cipher_TLS_ECDH_anon_WITH_NULL_SHA, - cipher_TLS_ECDH_anon_WITH_RC4_128_SHA, - cipher_TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_ECDH_anon_WITH_AES_128_CBC_SHA, - cipher_TLS_ECDH_anon_WITH_AES_256_CBC_SHA, - cipher_TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_SRP_SHA_WITH_AES_128_CBC_SHA, - cipher_TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA, - cipher_TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA, - cipher_TLS_SRP_SHA_WITH_AES_256_CBC_SHA, - cipher_TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA, - cipher_TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA, - cipher_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, - cipher_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, - cipher_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, - cipher_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, - cipher_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, - cipher_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, - cipher_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, - cipher_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, - cipher_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, - cipher_TLS_ECDHE_PSK_WITH_RC4_128_SHA, - cipher_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA, - cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA, - cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA, - cipher_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256, - cipher_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384, - cipher_TLS_ECDHE_PSK_WITH_NULL_SHA, - cipher_TLS_ECDHE_PSK_WITH_NULL_SHA256, - cipher_TLS_ECDHE_PSK_WITH_NULL_SHA384, - cipher_TLS_RSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_RSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_DH_anon_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_DH_anon_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_RSA_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_RSA_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_DH_anon_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_DH_anon_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_PSK_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_PSK_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_PSK_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_PSK_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256, - cipher_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384, - cipher_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256, - cipher_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384, - cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256, - cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384, - cipher_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256, - cipher_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384, - cipher_TLS_RSA_WITH_AES_128_CCM, - cipher_TLS_RSA_WITH_AES_256_CCM, - cipher_TLS_RSA_WITH_AES_128_CCM_8, - cipher_TLS_RSA_WITH_AES_256_CCM_8, - cipher_TLS_PSK_WITH_AES_128_CCM, - cipher_TLS_PSK_WITH_AES_256_CCM, - cipher_TLS_PSK_WITH_AES_128_CCM_8, - cipher_TLS_PSK_WITH_AES_256_CCM_8: - return true - default: - return false - } -} diff --git a/vendor/golang.org/x/net/http2/client_conn_pool.go b/vendor/golang.org/x/net/http2/client_conn_pool.go deleted file mode 100644 index 3a67636fe..000000000 --- a/vendor/golang.org/x/net/http2/client_conn_pool.go +++ /dev/null @@ -1,278 +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. - -// Transport code's client connection pooling. - -package http2 - -import ( - "crypto/tls" - "net/http" - "sync" -) - -// ClientConnPool manages a pool of HTTP/2 client connections. -type ClientConnPool interface { - GetClientConn(req *http.Request, addr string) (*ClientConn, error) - MarkDead(*ClientConn) -} - -// clientConnPoolIdleCloser is the interface implemented by ClientConnPool -// implementations which can close their idle connections. -type clientConnPoolIdleCloser interface { - ClientConnPool - closeIdleConnections() -} - -var ( - _ clientConnPoolIdleCloser = (*clientConnPool)(nil) - _ clientConnPoolIdleCloser = noDialClientConnPool{} -) - -// TODO: use singleflight for dialing and addConnCalls? -type clientConnPool struct { - t *Transport - - mu sync.Mutex // TODO: maybe switch to RWMutex - // TODO: add support for sharing conns based on cert names - // (e.g. share conn for googleapis.com and appspot.com) - conns map[string][]*ClientConn // key is host:port - dialing map[string]*dialCall // currently in-flight dials - keys map[*ClientConn][]string - addConnCalls map[string]*addConnCall // in-flight addConnIfNeede calls -} - -func (p *clientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { - return p.getClientConn(req, addr, dialOnMiss) -} - -const ( - dialOnMiss = true - noDialOnMiss = false -) - -// shouldTraceGetConn reports whether getClientConn should call any -// ClientTrace.GetConn hook associated with the http.Request. -// -// This complexity is needed to avoid double calls of the GetConn hook -// during the back-and-forth between net/http and x/net/http2 (when the -// net/http.Transport is upgraded to also speak http2), as well as support -// the case where x/net/http2 is being used directly. -func (p *clientConnPool) shouldTraceGetConn(st clientConnIdleState) bool { - // If our Transport wasn't made via ConfigureTransport, always - // trace the GetConn hook if provided, because that means the - // http2 package is being used directly and it's the one - // dialing, as opposed to net/http. - if _, ok := p.t.ConnPool.(noDialClientConnPool); !ok { - return true - } - // Otherwise, only use the GetConn hook if this connection has - // been used previously for other requests. For fresh - // connections, the net/http package does the dialing. - return !st.freshConn -} - -func (p *clientConnPool) getClientConn(req *http.Request, addr string, dialOnMiss bool) (*ClientConn, error) { - if isConnectionCloseRequest(req) && dialOnMiss { - // It gets its own connection. - traceGetConn(req, addr) - const singleUse = true - cc, err := p.t.dialClientConn(addr, singleUse) - if err != nil { - return nil, err - } - return cc, nil - } - p.mu.Lock() - for _, cc := range p.conns[addr] { - if st := cc.idleState(); st.canTakeNewRequest { - if p.shouldTraceGetConn(st) { - traceGetConn(req, addr) - } - p.mu.Unlock() - return cc, nil - } - } - if !dialOnMiss { - p.mu.Unlock() - return nil, ErrNoCachedConn - } - traceGetConn(req, addr) - call := p.getStartDialLocked(addr) - p.mu.Unlock() - <-call.done - return call.res, call.err -} - -// dialCall is an in-flight Transport dial call to a host. -type dialCall struct { - _ incomparable - p *clientConnPool - done chan struct{} // closed when done - res *ClientConn // valid after done is closed - err error // valid after done is closed -} - -// requires p.mu is held. -func (p *clientConnPool) getStartDialLocked(addr string) *dialCall { - if call, ok := p.dialing[addr]; ok { - // A dial is already in-flight. Don't start another. - return call - } - call := &dialCall{p: p, done: make(chan struct{})} - if p.dialing == nil { - p.dialing = make(map[string]*dialCall) - } - p.dialing[addr] = call - go call.dial(addr) - return call -} - -// run in its own goroutine. -func (c *dialCall) dial(addr string) { - const singleUse = false // shared conn - c.res, c.err = c.p.t.dialClientConn(addr, singleUse) - close(c.done) - - c.p.mu.Lock() - delete(c.p.dialing, addr) - if c.err == nil { - c.p.addConnLocked(addr, c.res) - } - c.p.mu.Unlock() -} - -// addConnIfNeeded makes a NewClientConn out of c if a connection for key doesn't -// already exist. It coalesces concurrent calls with the same key. -// This is used by the http1 Transport code when it creates a new connection. Because -// the http1 Transport doesn't de-dup TCP dials to outbound hosts (because it doesn't know -// the protocol), it can get into a situation where it has multiple TLS connections. -// This code decides which ones live or die. -// The return value used is whether c was used. -// c is never closed. -func (p *clientConnPool) addConnIfNeeded(key string, t *Transport, c *tls.Conn) (used bool, err error) { - p.mu.Lock() - for _, cc := range p.conns[key] { - if cc.CanTakeNewRequest() { - p.mu.Unlock() - return false, nil - } - } - call, dup := p.addConnCalls[key] - if !dup { - if p.addConnCalls == nil { - p.addConnCalls = make(map[string]*addConnCall) - } - call = &addConnCall{ - p: p, - done: make(chan struct{}), - } - p.addConnCalls[key] = call - go call.run(t, key, c) - } - p.mu.Unlock() - - <-call.done - if call.err != nil { - return false, call.err - } - return !dup, nil -} - -type addConnCall struct { - _ incomparable - p *clientConnPool - done chan struct{} // closed when done - err error -} - -func (c *addConnCall) run(t *Transport, key string, tc *tls.Conn) { - cc, err := t.NewClientConn(tc) - - p := c.p - p.mu.Lock() - if err != nil { - c.err = err - } else { - p.addConnLocked(key, cc) - } - delete(p.addConnCalls, key) - p.mu.Unlock() - close(c.done) -} - -// p.mu must be held -func (p *clientConnPool) addConnLocked(key string, cc *ClientConn) { - for _, v := range p.conns[key] { - if v == cc { - return - } - } - if p.conns == nil { - p.conns = make(map[string][]*ClientConn) - } - if p.keys == nil { - p.keys = make(map[*ClientConn][]string) - } - p.conns[key] = append(p.conns[key], cc) - p.keys[cc] = append(p.keys[cc], key) -} - -func (p *clientConnPool) MarkDead(cc *ClientConn) { - p.mu.Lock() - defer p.mu.Unlock() - for _, key := range p.keys[cc] { - vv, ok := p.conns[key] - if !ok { - continue - } - newList := filterOutClientConn(vv, cc) - if len(newList) > 0 { - p.conns[key] = newList - } else { - delete(p.conns, key) - } - } - delete(p.keys, cc) -} - -func (p *clientConnPool) closeIdleConnections() { - p.mu.Lock() - defer p.mu.Unlock() - // TODO: don't close a cc if it was just added to the pool - // milliseconds ago and has never been used. There's currently - // a small race window with the HTTP/1 Transport's integration - // where it can add an idle conn just before using it, and - // somebody else can concurrently call CloseIdleConns and - // break some caller's RoundTrip. - for _, vv := range p.conns { - for _, cc := range vv { - cc.closeIfIdle() - } - } -} - -func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn { - out := in[:0] - for _, v := range in { - if v != exclude { - out = append(out, v) - } - } - // If we filtered it out, zero out the last item to prevent - // the GC from seeing it. - if len(in) != len(out) { - in[len(in)-1] = nil - } - return out -} - -// noDialClientConnPool is an implementation of http2.ClientConnPool -// which never dials. We let the HTTP/1.1 client dial and use its TLS -// connection instead. -type noDialClientConnPool struct{ *clientConnPool } - -func (p noDialClientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { - return p.getClientConn(req, addr, noDialOnMiss) -} diff --git a/vendor/golang.org/x/net/http2/databuffer.go b/vendor/golang.org/x/net/http2/databuffer.go deleted file mode 100644 index a3067f8de..000000000 --- a/vendor/golang.org/x/net/http2/databuffer.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "errors" - "fmt" - "sync" -) - -// Buffer chunks are allocated from a pool to reduce pressure on GC. -// The maximum wasted space per dataBuffer is 2x the largest size class, -// which happens when the dataBuffer has multiple chunks and there is -// one unread byte in both the first and last chunks. We use a few size -// classes to minimize overheads for servers that typically receive very -// small request bodies. -// -// TODO: Benchmark to determine if the pools are necessary. The GC may have -// improved enough that we can instead allocate chunks like this: -// make([]byte, max(16<<10, expectedBytesRemaining)) -var ( - dataChunkSizeClasses = []int{ - 1 << 10, - 2 << 10, - 4 << 10, - 8 << 10, - 16 << 10, - } - dataChunkPools = [...]sync.Pool{ - {New: func() interface{} { return make([]byte, 1<<10) }}, - {New: func() interface{} { return make([]byte, 2<<10) }}, - {New: func() interface{} { return make([]byte, 4<<10) }}, - {New: func() interface{} { return make([]byte, 8<<10) }}, - {New: func() interface{} { return make([]byte, 16<<10) }}, - } -) - -func getDataBufferChunk(size int64) []byte { - i := 0 - for ; i < len(dataChunkSizeClasses)-1; i++ { - if size <= int64(dataChunkSizeClasses[i]) { - break - } - } - return dataChunkPools[i].Get().([]byte) -} - -func putDataBufferChunk(p []byte) { - for i, n := range dataChunkSizeClasses { - if len(p) == n { - dataChunkPools[i].Put(p) - return - } - } - panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) -} - -// dataBuffer is an io.ReadWriter backed by a list of data chunks. -// Each dataBuffer is used to read DATA frames on a single stream. -// The buffer is divided into chunks so the server can limit the -// total memory used by a single connection without limiting the -// request body size on any single stream. -type dataBuffer struct { - chunks [][]byte - r int // next byte to read is chunks[0][r] - w int // next byte to write is chunks[len(chunks)-1][w] - size int // total buffered bytes - expected int64 // we expect at least this many bytes in future Write calls (ignored if <= 0) -} - -var errReadEmpty = errors.New("read from empty dataBuffer") - -// Read copies bytes from the buffer into p. -// It is an error to read when no data is available. -func (b *dataBuffer) Read(p []byte) (int, error) { - if b.size == 0 { - return 0, errReadEmpty - } - var ntotal int - for len(p) > 0 && b.size > 0 { - readFrom := b.bytesFromFirstChunk() - n := copy(p, readFrom) - p = p[n:] - ntotal += n - b.r += n - b.size -= n - // If the first chunk has been consumed, advance to the next chunk. - if b.r == len(b.chunks[0]) { - putDataBufferChunk(b.chunks[0]) - end := len(b.chunks) - 1 - copy(b.chunks[:end], b.chunks[1:]) - b.chunks[end] = nil - b.chunks = b.chunks[:end] - b.r = 0 - } - } - return ntotal, nil -} - -func (b *dataBuffer) bytesFromFirstChunk() []byte { - if len(b.chunks) == 1 { - return b.chunks[0][b.r:b.w] - } - return b.chunks[0][b.r:] -} - -// Len returns the number of bytes of the unread portion of the buffer. -func (b *dataBuffer) Len() int { - return b.size -} - -// Write appends p to the buffer. -func (b *dataBuffer) Write(p []byte) (int, error) { - ntotal := len(p) - for len(p) > 0 { - // If the last chunk is empty, allocate a new chunk. Try to allocate - // enough to fully copy p plus any additional bytes we expect to - // receive. However, this may allocate less than len(p). - want := int64(len(p)) - if b.expected > want { - want = b.expected - } - chunk := b.lastChunkOrAlloc(want) - n := copy(chunk[b.w:], p) - p = p[n:] - b.w += n - b.size += n - b.expected -= int64(n) - } - return ntotal, nil -} - -func (b *dataBuffer) lastChunkOrAlloc(want int64) []byte { - if len(b.chunks) != 0 { - last := b.chunks[len(b.chunks)-1] - if b.w < len(last) { - return last - } - } - chunk := getDataBufferChunk(want) - b.chunks = append(b.chunks, chunk) - b.w = 0 - return chunk -} diff --git a/vendor/golang.org/x/net/http2/errors.go b/vendor/golang.org/x/net/http2/errors.go deleted file mode 100644 index 71f2c4631..000000000 --- a/vendor/golang.org/x/net/http2/errors.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "errors" - "fmt" -) - -// An ErrCode is an unsigned 32-bit error code as defined in the HTTP/2 spec. -type ErrCode uint32 - -const ( - ErrCodeNo ErrCode = 0x0 - ErrCodeProtocol ErrCode = 0x1 - ErrCodeInternal ErrCode = 0x2 - ErrCodeFlowControl ErrCode = 0x3 - ErrCodeSettingsTimeout ErrCode = 0x4 - ErrCodeStreamClosed ErrCode = 0x5 - ErrCodeFrameSize ErrCode = 0x6 - ErrCodeRefusedStream ErrCode = 0x7 - ErrCodeCancel ErrCode = 0x8 - ErrCodeCompression ErrCode = 0x9 - ErrCodeConnect ErrCode = 0xa - ErrCodeEnhanceYourCalm ErrCode = 0xb - ErrCodeInadequateSecurity ErrCode = 0xc - ErrCodeHTTP11Required ErrCode = 0xd -) - -var errCodeName = map[ErrCode]string{ - ErrCodeNo: "NO_ERROR", - ErrCodeProtocol: "PROTOCOL_ERROR", - ErrCodeInternal: "INTERNAL_ERROR", - ErrCodeFlowControl: "FLOW_CONTROL_ERROR", - ErrCodeSettingsTimeout: "SETTINGS_TIMEOUT", - ErrCodeStreamClosed: "STREAM_CLOSED", - ErrCodeFrameSize: "FRAME_SIZE_ERROR", - ErrCodeRefusedStream: "REFUSED_STREAM", - ErrCodeCancel: "CANCEL", - ErrCodeCompression: "COMPRESSION_ERROR", - ErrCodeConnect: "CONNECT_ERROR", - ErrCodeEnhanceYourCalm: "ENHANCE_YOUR_CALM", - ErrCodeInadequateSecurity: "INADEQUATE_SECURITY", - ErrCodeHTTP11Required: "HTTP_1_1_REQUIRED", -} - -func (e ErrCode) String() string { - if s, ok := errCodeName[e]; ok { - return s - } - return fmt.Sprintf("unknown error code 0x%x", uint32(e)) -} - -// ConnectionError is an error that results in the termination of the -// entire connection. -type ConnectionError ErrCode - -func (e ConnectionError) Error() string { return fmt.Sprintf("connection error: %s", ErrCode(e)) } - -// StreamError is an error that only affects one stream within an -// HTTP/2 connection. -type StreamError struct { - StreamID uint32 - Code ErrCode - Cause error // optional additional detail -} - -func streamError(id uint32, code ErrCode) StreamError { - return StreamError{StreamID: id, Code: code} -} - -func (e StreamError) Error() string { - if e.Cause != nil { - return fmt.Sprintf("stream error: stream ID %d; %v; %v", e.StreamID, e.Code, e.Cause) - } - return fmt.Sprintf("stream error: stream ID %d; %v", e.StreamID, e.Code) -} - -// 6.9.1 The Flow Control Window -// "If a sender receives a WINDOW_UPDATE that causes a flow control -// window to exceed this maximum it MUST terminate either the stream -// or the connection, as appropriate. For streams, [...]; for the -// connection, a GOAWAY frame with a FLOW_CONTROL_ERROR code." -type goAwayFlowError struct{} - -func (goAwayFlowError) Error() string { return "connection exceeded flow control window size" } - -// connError represents an HTTP/2 ConnectionError error code, along -// with a string (for debugging) explaining why. -// -// Errors of this type are only returned by the frame parser functions -// and converted into ConnectionError(Code), after stashing away -// the Reason into the Framer's errDetail field, accessible via -// the (*Framer).ErrorDetail method. -type connError struct { - Code ErrCode // the ConnectionError error code - Reason string // additional reason -} - -func (e connError) Error() string { - return fmt.Sprintf("http2: connection error: %v: %v", e.Code, e.Reason) -} - -type pseudoHeaderError string - -func (e pseudoHeaderError) Error() string { - return fmt.Sprintf("invalid pseudo-header %q", string(e)) -} - -type duplicatePseudoHeaderError string - -func (e duplicatePseudoHeaderError) Error() string { - return fmt.Sprintf("duplicate pseudo-header %q", string(e)) -} - -type headerFieldNameError string - -func (e headerFieldNameError) Error() string { - return fmt.Sprintf("invalid header field name %q", string(e)) -} - -type headerFieldValueError string - -func (e headerFieldValueError) Error() string { - return fmt.Sprintf("invalid header field value %q", string(e)) -} - -var ( - errMixPseudoHeaderTypes = errors.New("mix of request and response pseudo headers") - errPseudoAfterRegular = errors.New("pseudo header field after regular") -) diff --git a/vendor/golang.org/x/net/http2/flow.go b/vendor/golang.org/x/net/http2/flow.go deleted file mode 100644 index b51f0e0cf..000000000 --- a/vendor/golang.org/x/net/http2/flow.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Flow control - -package http2 - -// flow is the flow control window's size. -type flow struct { - _ incomparable - - // n is the number of DATA bytes we're allowed to send. - // A flow is kept both on a conn and a per-stream. - n int32 - - // conn points to the shared connection-level flow that is - // shared by all streams on that conn. It is nil for the flow - // that's on the conn directly. - conn *flow -} - -func (f *flow) setConnFlow(cf *flow) { f.conn = cf } - -func (f *flow) available() int32 { - n := f.n - if f.conn != nil && f.conn.n < n { - n = f.conn.n - } - return n -} - -func (f *flow) take(n int32) { - if n > f.available() { - panic("internal error: took too much") - } - f.n -= n - if f.conn != nil { - f.conn.n -= n - } -} - -// add adds n bytes (positive or negative) to the flow control window. -// It returns false if the sum would exceed 2^31-1. -func (f *flow) add(n int32) bool { - sum := f.n + n - if (sum > n) == (f.n > 0) { - f.n = sum - return true - } - return false -} diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go deleted file mode 100644 index 514c126c5..000000000 --- a/vendor/golang.org/x/net/http2/frame.go +++ /dev/null @@ -1,1614 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "log" - "strings" - "sync" - - "golang.org/x/net/http/httpguts" - "golang.org/x/net/http2/hpack" -) - -const frameHeaderLen = 9 - -var padZeros = make([]byte, 255) // zeros for padding - -// A FrameType is a registered frame type as defined in -// http://http2.github.io/http2-spec/#rfc.section.11.2 -type FrameType uint8 - -const ( - FrameData FrameType = 0x0 - FrameHeaders FrameType = 0x1 - FramePriority FrameType = 0x2 - FrameRSTStream FrameType = 0x3 - FrameSettings FrameType = 0x4 - FramePushPromise FrameType = 0x5 - FramePing FrameType = 0x6 - FrameGoAway FrameType = 0x7 - FrameWindowUpdate FrameType = 0x8 - FrameContinuation FrameType = 0x9 -) - -var frameName = map[FrameType]string{ - FrameData: "DATA", - FrameHeaders: "HEADERS", - FramePriority: "PRIORITY", - FrameRSTStream: "RST_STREAM", - FrameSettings: "SETTINGS", - FramePushPromise: "PUSH_PROMISE", - FramePing: "PING", - FrameGoAway: "GOAWAY", - FrameWindowUpdate: "WINDOW_UPDATE", - FrameContinuation: "CONTINUATION", -} - -func (t FrameType) String() string { - if s, ok := frameName[t]; ok { - return s - } - return fmt.Sprintf("UNKNOWN_FRAME_TYPE_%d", uint8(t)) -} - -// Flags is a bitmask of HTTP/2 flags. -// The meaning of flags varies depending on the frame type. -type Flags uint8 - -// Has reports whether f contains all (0 or more) flags in v. -func (f Flags) Has(v Flags) bool { - return (f & v) == v -} - -// Frame-specific FrameHeader flag bits. -const ( - // Data Frame - FlagDataEndStream Flags = 0x1 - FlagDataPadded Flags = 0x8 - - // Headers Frame - FlagHeadersEndStream Flags = 0x1 - FlagHeadersEndHeaders Flags = 0x4 - FlagHeadersPadded Flags = 0x8 - FlagHeadersPriority Flags = 0x20 - - // Settings Frame - FlagSettingsAck Flags = 0x1 - - // Ping Frame - FlagPingAck Flags = 0x1 - - // Continuation Frame - FlagContinuationEndHeaders Flags = 0x4 - - FlagPushPromiseEndHeaders Flags = 0x4 - FlagPushPromisePadded Flags = 0x8 -) - -var flagName = map[FrameType]map[Flags]string{ - FrameData: { - FlagDataEndStream: "END_STREAM", - FlagDataPadded: "PADDED", - }, - FrameHeaders: { - FlagHeadersEndStream: "END_STREAM", - FlagHeadersEndHeaders: "END_HEADERS", - FlagHeadersPadded: "PADDED", - FlagHeadersPriority: "PRIORITY", - }, - FrameSettings: { - FlagSettingsAck: "ACK", - }, - FramePing: { - FlagPingAck: "ACK", - }, - FrameContinuation: { - FlagContinuationEndHeaders: "END_HEADERS", - }, - FramePushPromise: { - FlagPushPromiseEndHeaders: "END_HEADERS", - FlagPushPromisePadded: "PADDED", - }, -} - -// a frameParser parses a frame given its FrameHeader and payload -// bytes. The length of payload will always equal fh.Length (which -// might be 0). -type frameParser func(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error) - -var frameParsers = map[FrameType]frameParser{ - FrameData: parseDataFrame, - FrameHeaders: parseHeadersFrame, - FramePriority: parsePriorityFrame, - FrameRSTStream: parseRSTStreamFrame, - FrameSettings: parseSettingsFrame, - FramePushPromise: parsePushPromise, - FramePing: parsePingFrame, - FrameGoAway: parseGoAwayFrame, - FrameWindowUpdate: parseWindowUpdateFrame, - FrameContinuation: parseContinuationFrame, -} - -func typeFrameParser(t FrameType) frameParser { - if f := frameParsers[t]; f != nil { - return f - } - return parseUnknownFrame -} - -// A FrameHeader is the 9 byte header of all HTTP/2 frames. -// -// See http://http2.github.io/http2-spec/#FrameHeader -type FrameHeader struct { - valid bool // caller can access []byte fields in the Frame - - // Type is the 1 byte frame type. There are ten standard frame - // types, but extension frame types may be written by WriteRawFrame - // and will be returned by ReadFrame (as UnknownFrame). - Type FrameType - - // Flags are the 1 byte of 8 potential bit flags per frame. - // They are specific to the frame type. - Flags Flags - - // Length is the length of the frame, not including the 9 byte header. - // The maximum size is one byte less than 16MB (uint24), but only - // frames up to 16KB are allowed without peer agreement. - Length uint32 - - // StreamID is which stream this frame is for. Certain frames - // are not stream-specific, in which case this field is 0. - StreamID uint32 -} - -// Header returns h. It exists so FrameHeaders can be embedded in other -// specific frame types and implement the Frame interface. -func (h FrameHeader) Header() FrameHeader { return h } - -func (h FrameHeader) String() string { - var buf bytes.Buffer - buf.WriteString("[FrameHeader ") - h.writeDebug(&buf) - buf.WriteByte(']') - return buf.String() -} - -func (h FrameHeader) writeDebug(buf *bytes.Buffer) { - buf.WriteString(h.Type.String()) - if h.Flags != 0 { - buf.WriteString(" flags=") - set := 0 - for i := uint8(0); i < 8; i++ { - if h.Flags&(1<<i) == 0 { - continue - } - set++ - if set > 1 { - buf.WriteByte('|') - } - name := flagName[h.Type][Flags(1<<i)] - if name != "" { - buf.WriteString(name) - } else { - fmt.Fprintf(buf, "0x%x", 1<<i) - } - } - } - if h.StreamID != 0 { - fmt.Fprintf(buf, " stream=%d", h.StreamID) - } - fmt.Fprintf(buf, " len=%d", h.Length) -} - -func (h *FrameHeader) checkValid() { - if !h.valid { - panic("Frame accessor called on non-owned Frame") - } -} - -func (h *FrameHeader) invalidate() { h.valid = false } - -// frame header bytes. -// Used only by ReadFrameHeader. -var fhBytes = sync.Pool{ - New: func() interface{} { - buf := make([]byte, frameHeaderLen) - return &buf - }, -} - -// ReadFrameHeader reads 9 bytes from r and returns a FrameHeader. -// Most users should use Framer.ReadFrame instead. -func ReadFrameHeader(r io.Reader) (FrameHeader, error) { - bufp := fhBytes.Get().(*[]byte) - defer fhBytes.Put(bufp) - return readFrameHeader(*bufp, r) -} - -func readFrameHeader(buf []byte, r io.Reader) (FrameHeader, error) { - _, err := io.ReadFull(r, buf[:frameHeaderLen]) - if err != nil { - return FrameHeader{}, err - } - return FrameHeader{ - Length: (uint32(buf[0])<<16 | uint32(buf[1])<<8 | uint32(buf[2])), - Type: FrameType(buf[3]), - Flags: Flags(buf[4]), - StreamID: binary.BigEndian.Uint32(buf[5:]) & (1<<31 - 1), - valid: true, - }, nil -} - -// A Frame is the base interface implemented by all frame types. -// Callers will generally type-assert the specific frame type: -// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc. -// -// Frames are only valid until the next call to Framer.ReadFrame. -type Frame interface { - Header() FrameHeader - - // invalidate is called by Framer.ReadFrame to make this - // frame's buffers as being invalid, since the subsequent - // frame will reuse them. - invalidate() -} - -// A Framer reads and writes Frames. -type Framer struct { - r io.Reader - lastFrame Frame - errDetail error - - // lastHeaderStream is non-zero if the last frame was an - // unfinished HEADERS/CONTINUATION. - lastHeaderStream uint32 - - maxReadSize uint32 - headerBuf [frameHeaderLen]byte - - // TODO: let getReadBuf be configurable, and use a less memory-pinning - // allocator in server.go to minimize memory pinned for many idle conns. - // Will probably also need to make frame invalidation have a hook too. - getReadBuf func(size uint32) []byte - readBuf []byte // cache for default getReadBuf - - maxWriteSize uint32 // zero means unlimited; TODO: implement - - w io.Writer - wbuf []byte - - // AllowIllegalWrites permits the Framer's Write methods to - // write frames that do not conform to the HTTP/2 spec. This - // permits using the Framer to test other HTTP/2 - // implementations' conformance to the spec. - // If false, the Write methods will prefer to return an error - // rather than comply. - AllowIllegalWrites bool - - // AllowIllegalReads permits the Framer's ReadFrame method - // to return non-compliant frames or frame orders. - // This is for testing and permits using the Framer to test - // other HTTP/2 implementations' conformance to the spec. - // It is not compatible with ReadMetaHeaders. - AllowIllegalReads bool - - // ReadMetaHeaders if non-nil causes ReadFrame to merge - // HEADERS and CONTINUATION frames together and return - // MetaHeadersFrame instead. - ReadMetaHeaders *hpack.Decoder - - // MaxHeaderListSize is the http2 MAX_HEADER_LIST_SIZE. - // It's used only if ReadMetaHeaders is set; 0 means a sane default - // (currently 16MB) - // If the limit is hit, MetaHeadersFrame.Truncated is set true. - MaxHeaderListSize uint32 - - // TODO: track which type of frame & with which flags was sent - // last. Then return an error (unless AllowIllegalWrites) if - // we're in the middle of a header block and a - // non-Continuation or Continuation on a different stream is - // attempted to be written. - - logReads, logWrites bool - - debugFramer *Framer // only use for logging written writes - debugFramerBuf *bytes.Buffer - debugReadLoggerf func(string, ...interface{}) - debugWriteLoggerf func(string, ...interface{}) - - frameCache *frameCache // nil if frames aren't reused (default) -} - -func (fr *Framer) maxHeaderListSize() uint32 { - if fr.MaxHeaderListSize == 0 { - return 16 << 20 // sane default, per docs - } - return fr.MaxHeaderListSize -} - -func (f *Framer) startWrite(ftype FrameType, flags Flags, streamID uint32) { - // Write the FrameHeader. - f.wbuf = append(f.wbuf[:0], - 0, // 3 bytes of length, filled in in endWrite - 0, - 0, - byte(ftype), - byte(flags), - byte(streamID>>24), - byte(streamID>>16), - byte(streamID>>8), - byte(streamID)) -} - -func (f *Framer) endWrite() error { - // Now that we know the final size, fill in the FrameHeader in - // the space previously reserved for it. Abuse append. - length := len(f.wbuf) - frameHeaderLen - if length >= (1 << 24) { - return ErrFrameTooLarge - } - _ = append(f.wbuf[:0], - byte(length>>16), - byte(length>>8), - byte(length)) - if f.logWrites { - f.logWrite() - } - - n, err := f.w.Write(f.wbuf) - if err == nil && n != len(f.wbuf) { - err = io.ErrShortWrite - } - return err -} - -func (f *Framer) logWrite() { - if f.debugFramer == nil { - f.debugFramerBuf = new(bytes.Buffer) - f.debugFramer = NewFramer(nil, f.debugFramerBuf) - f.debugFramer.logReads = false // we log it ourselves, saying "wrote" below - // Let us read anything, even if we accidentally wrote it - // in the wrong order: - f.debugFramer.AllowIllegalReads = true - } - f.debugFramerBuf.Write(f.wbuf) - fr, err := f.debugFramer.ReadFrame() - if err != nil { - f.debugWriteLoggerf("http2: Framer %p: failed to decode just-written frame", f) - return - } - f.debugWriteLoggerf("http2: Framer %p: wrote %v", f, summarizeFrame(fr)) -} - -func (f *Framer) writeByte(v byte) { f.wbuf = append(f.wbuf, v) } -func (f *Framer) writeBytes(v []byte) { f.wbuf = append(f.wbuf, v...) } -func (f *Framer) writeUint16(v uint16) { f.wbuf = append(f.wbuf, byte(v>>8), byte(v)) } -func (f *Framer) writeUint32(v uint32) { - f.wbuf = append(f.wbuf, byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) -} - -const ( - minMaxFrameSize = 1 << 14 - maxFrameSize = 1<<24 - 1 -) - -// SetReuseFrames allows the Framer to reuse Frames. -// If called on a Framer, Frames returned by calls to ReadFrame are only -// valid until the next call to ReadFrame. -func (fr *Framer) SetReuseFrames() { - if fr.frameCache != nil { - return - } - fr.frameCache = &frameCache{} -} - -type frameCache struct { - dataFrame DataFrame -} - -func (fc *frameCache) getDataFrame() *DataFrame { - if fc == nil { - return &DataFrame{} - } - return &fc.dataFrame -} - -// NewFramer returns a Framer that writes frames to w and reads them from r. -func NewFramer(w io.Writer, r io.Reader) *Framer { - fr := &Framer{ - w: w, - r: r, - logReads: logFrameReads, - logWrites: logFrameWrites, - debugReadLoggerf: log.Printf, - debugWriteLoggerf: log.Printf, - } - fr.getReadBuf = func(size uint32) []byte { - if cap(fr.readBuf) >= int(size) { - return fr.readBuf[:size] - } - fr.readBuf = make([]byte, size) - return fr.readBuf - } - fr.SetMaxReadFrameSize(maxFrameSize) - return fr -} - -// SetMaxReadFrameSize sets the maximum size of a frame -// that will be read by a subsequent call to ReadFrame. -// It is the caller's responsibility to advertise this -// limit with a SETTINGS frame. -func (fr *Framer) SetMaxReadFrameSize(v uint32) { - if v > maxFrameSize { - v = maxFrameSize - } - fr.maxReadSize = v -} - -// ErrorDetail returns a more detailed error of the last error -// returned by Framer.ReadFrame. For instance, if ReadFrame -// returns a StreamError with code PROTOCOL_ERROR, ErrorDetail -// will say exactly what was invalid. ErrorDetail is not guaranteed -// to return a non-nil value and like the rest of the http2 package, -// its return value is not protected by an API compatibility promise. -// ErrorDetail is reset after the next call to ReadFrame. -func (fr *Framer) ErrorDetail() error { - return fr.errDetail -} - -// ErrFrameTooLarge is returned from Framer.ReadFrame when the peer -// sends a frame that is larger than declared with SetMaxReadFrameSize. -var ErrFrameTooLarge = errors.New("http2: frame too large") - -// terminalReadFrameError reports whether err is an unrecoverable -// error from ReadFrame and no other frames should be read. -func terminalReadFrameError(err error) bool { - if _, ok := err.(StreamError); ok { - return false - } - return err != nil -} - -// ReadFrame reads a single frame. The returned Frame is only valid -// until the next call to ReadFrame. -// -// If the frame is larger than previously set with SetMaxReadFrameSize, the -// returned error is ErrFrameTooLarge. Other errors may be of type -// ConnectionError, StreamError, or anything else from the underlying -// reader. -func (fr *Framer) ReadFrame() (Frame, error) { - fr.errDetail = nil - if fr.lastFrame != nil { - fr.lastFrame.invalidate() - } - fh, err := readFrameHeader(fr.headerBuf[:], fr.r) - if err != nil { - return nil, err - } - if fh.Length > fr.maxReadSize { - return nil, ErrFrameTooLarge - } - payload := fr.getReadBuf(fh.Length) - if _, err := io.ReadFull(fr.r, payload); err != nil { - return nil, err - } - f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, payload) - if err != nil { - if ce, ok := err.(connError); ok { - return nil, fr.connError(ce.Code, ce.Reason) - } - return nil, err - } - if err := fr.checkFrameOrder(f); err != nil { - return nil, err - } - if fr.logReads { - fr.debugReadLoggerf("http2: Framer %p: read %v", fr, summarizeFrame(f)) - } - if fh.Type == FrameHeaders && fr.ReadMetaHeaders != nil { - return fr.readMetaFrame(f.(*HeadersFrame)) - } - return f, nil -} - -// connError returns ConnectionError(code) but first -// stashes away a public reason to the caller can optionally relay it -// to the peer before hanging up on them. This might help others debug -// their implementations. -func (fr *Framer) connError(code ErrCode, reason string) error { - fr.errDetail = errors.New(reason) - return ConnectionError(code) -} - -// checkFrameOrder reports an error if f is an invalid frame to return -// next from ReadFrame. Mostly it checks whether HEADERS and -// CONTINUATION frames are contiguous. -func (fr *Framer) checkFrameOrder(f Frame) error { - last := fr.lastFrame - fr.lastFrame = f - if fr.AllowIllegalReads { - return nil - } - - fh := f.Header() - if fr.lastHeaderStream != 0 { - if fh.Type != FrameContinuation { - return fr.connError(ErrCodeProtocol, - fmt.Sprintf("got %s for stream %d; expected CONTINUATION following %s for stream %d", - fh.Type, fh.StreamID, - last.Header().Type, fr.lastHeaderStream)) - } - if fh.StreamID != fr.lastHeaderStream { - return fr.connError(ErrCodeProtocol, - fmt.Sprintf("got CONTINUATION for stream %d; expected stream %d", - fh.StreamID, fr.lastHeaderStream)) - } - } else if fh.Type == FrameContinuation { - return fr.connError(ErrCodeProtocol, fmt.Sprintf("unexpected CONTINUATION for stream %d", fh.StreamID)) - } - - switch fh.Type { - case FrameHeaders, FrameContinuation: - if fh.Flags.Has(FlagHeadersEndHeaders) { - fr.lastHeaderStream = 0 - } else { - fr.lastHeaderStream = fh.StreamID - } - } - - return nil -} - -// A DataFrame conveys arbitrary, variable-length sequences of octets -// associated with a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.1 -type DataFrame struct { - FrameHeader - data []byte -} - -func (f *DataFrame) StreamEnded() bool { - return f.FrameHeader.Flags.Has(FlagDataEndStream) -} - -// Data returns the frame's data octets, not including any padding -// size byte or padding suffix bytes. -// The caller must not retain the returned memory past the next -// call to ReadFrame. -func (f *DataFrame) Data() []byte { - f.checkValid() - return f.data -} - -func parseDataFrame(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error) { - if fh.StreamID == 0 { - // DATA frames MUST be associated with a stream. If a - // DATA frame is received whose stream identifier - // field is 0x0, the recipient MUST respond with a - // connection error (Section 5.4.1) of type - // PROTOCOL_ERROR. - return nil, connError{ErrCodeProtocol, "DATA frame with stream ID 0"} - } - f := fc.getDataFrame() - f.FrameHeader = fh - - var padSize byte - if fh.Flags.Has(FlagDataPadded) { - var err error - payload, padSize, err = readByte(payload) - if err != nil { - return nil, err - } - } - if int(padSize) > len(payload) { - // If the length of the padding is greater than the - // length of the frame payload, the recipient MUST - // treat this as a connection error. - // Filed: https://github.com/http2/http2-spec/issues/610 - return nil, connError{ErrCodeProtocol, "pad size larger than data payload"} - } - f.data = payload[:len(payload)-int(padSize)] - return f, nil -} - -var ( - errStreamID = errors.New("invalid stream ID") - errDepStreamID = errors.New("invalid dependent stream ID") - errPadLength = errors.New("pad length too large") - errPadBytes = errors.New("padding bytes must all be zeros unless AllowIllegalWrites is enabled") -) - -func validStreamIDOrZero(streamID uint32) bool { - return streamID&(1<<31) == 0 -} - -func validStreamID(streamID uint32) bool { - return streamID != 0 && streamID&(1<<31) == 0 -} - -// WriteData writes a DATA frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility not to violate the maximum frame size -// and to not call other Write methods concurrently. -func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error { - return f.WriteDataPadded(streamID, endStream, data, nil) -} - -// WriteDataPadded writes a DATA frame with optional padding. -// -// If pad is nil, the padding bit is not sent. -// The length of pad must not exceed 255 bytes. -// The bytes of pad must all be zero, unless f.AllowIllegalWrites is set. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility not to violate the maximum frame size -// and to not call other Write methods concurrently. -func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - if len(pad) > 0 { - if len(pad) > 255 { - return errPadLength - } - if !f.AllowIllegalWrites { - for _, b := range pad { - if b != 0 { - // "Padding octets MUST be set to zero when sending." - return errPadBytes - } - } - } - } - var flags Flags - if endStream { - flags |= FlagDataEndStream - } - if pad != nil { - flags |= FlagDataPadded - } - f.startWrite(FrameData, flags, streamID) - if pad != nil { - f.wbuf = append(f.wbuf, byte(len(pad))) - } - f.wbuf = append(f.wbuf, data...) - f.wbuf = append(f.wbuf, pad...) - return f.endWrite() -} - -// A SettingsFrame conveys configuration parameters that affect how -// endpoints communicate, such as preferences and constraints on peer -// behavior. -// -// See http://http2.github.io/http2-spec/#SETTINGS -type SettingsFrame struct { - FrameHeader - p []byte -} - -func parseSettingsFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { - if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 { - // When this (ACK 0x1) bit is set, the payload of the - // SETTINGS frame MUST be empty. Receipt of a - // SETTINGS frame with the ACK flag set and a length - // field value other than 0 MUST be treated as a - // connection error (Section 5.4.1) of type - // FRAME_SIZE_ERROR. - return nil, ConnectionError(ErrCodeFrameSize) - } - if fh.StreamID != 0 { - // SETTINGS frames always apply to a connection, - // never a single stream. The stream identifier for a - // SETTINGS frame MUST be zero (0x0). If an endpoint - // receives a SETTINGS frame whose stream identifier - // field is anything other than 0x0, the endpoint MUST - // respond with a connection error (Section 5.4.1) of - // type PROTOCOL_ERROR. - return nil, ConnectionError(ErrCodeProtocol) - } - if len(p)%6 != 0 { - // Expecting even number of 6 byte settings. - return nil, ConnectionError(ErrCodeFrameSize) - } - f := &SettingsFrame{FrameHeader: fh, p: p} - if v, ok := f.Value(SettingInitialWindowSize); ok && v > (1<<31)-1 { - // Values above the maximum flow control window size of 2^31 - 1 MUST - // be treated as a connection error (Section 5.4.1) of type - // FLOW_CONTROL_ERROR. - return nil, ConnectionError(ErrCodeFlowControl) - } - return f, nil -} - -func (f *SettingsFrame) IsAck() bool { - return f.FrameHeader.Flags.Has(FlagSettingsAck) -} - -func (f *SettingsFrame) Value(id SettingID) (v uint32, ok bool) { - f.checkValid() - for i := 0; i < f.NumSettings(); i++ { - if s := f.Setting(i); s.ID == id { - return s.Val, true - } - } - return 0, false -} - -// Setting returns the setting from the frame at the given 0-based index. -// The index must be >= 0 and less than f.NumSettings(). -func (f *SettingsFrame) Setting(i int) Setting { - buf := f.p - return Setting{ - ID: SettingID(binary.BigEndian.Uint16(buf[i*6 : i*6+2])), - Val: binary.BigEndian.Uint32(buf[i*6+2 : i*6+6]), - } -} - -func (f *SettingsFrame) NumSettings() int { return len(f.p) / 6 } - -// HasDuplicates reports whether f contains any duplicate setting IDs. -func (f *SettingsFrame) HasDuplicates() bool { - num := f.NumSettings() - if num == 0 { - return false - } - // If it's small enough (the common case), just do the n^2 - // thing and avoid a map allocation. - if num < 10 { - for i := 0; i < num; i++ { - idi := f.Setting(i).ID - for j := i + 1; j < num; j++ { - idj := f.Setting(j).ID - if idi == idj { - return true - } - } - } - return false - } - seen := map[SettingID]bool{} - for i := 0; i < num; i++ { - id := f.Setting(i).ID - if seen[id] { - return true - } - seen[id] = true - } - return false -} - -// ForeachSetting runs fn for each setting. -// It stops and returns the first error. -func (f *SettingsFrame) ForeachSetting(fn func(Setting) error) error { - f.checkValid() - for i := 0; i < f.NumSettings(); i++ { - if err := fn(f.Setting(i)); err != nil { - return err - } - } - return nil -} - -// WriteSettings writes a SETTINGS frame with zero or more settings -// specified and the ACK bit not set. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteSettings(settings ...Setting) error { - f.startWrite(FrameSettings, 0, 0) - for _, s := range settings { - f.writeUint16(uint16(s.ID)) - f.writeUint32(s.Val) - } - return f.endWrite() -} - -// WriteSettingsAck writes an empty SETTINGS frame with the ACK bit set. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteSettingsAck() error { - f.startWrite(FrameSettings, FlagSettingsAck, 0) - return f.endWrite() -} - -// A PingFrame is a mechanism for measuring a minimal round trip time -// from the sender, as well as determining whether an idle connection -// is still functional. -// See http://http2.github.io/http2-spec/#rfc.section.6.7 -type PingFrame struct { - FrameHeader - Data [8]byte -} - -func (f *PingFrame) IsAck() bool { return f.Flags.Has(FlagPingAck) } - -func parsePingFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) { - if len(payload) != 8 { - return nil, ConnectionError(ErrCodeFrameSize) - } - if fh.StreamID != 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - f := &PingFrame{FrameHeader: fh} - copy(f.Data[:], payload) - return f, nil -} - -func (f *Framer) WritePing(ack bool, data [8]byte) error { - var flags Flags - if ack { - flags = FlagPingAck - } - f.startWrite(FramePing, flags, 0) - f.writeBytes(data[:]) - return f.endWrite() -} - -// A GoAwayFrame informs the remote peer to stop creating streams on this connection. -// See http://http2.github.io/http2-spec/#rfc.section.6.8 -type GoAwayFrame struct { - FrameHeader - LastStreamID uint32 - ErrCode ErrCode - debugData []byte -} - -// DebugData returns any debug data in the GOAWAY frame. Its contents -// are not defined. -// The caller must not retain the returned memory past the next -// call to ReadFrame. -func (f *GoAwayFrame) DebugData() []byte { - f.checkValid() - return f.debugData -} - -func parseGoAwayFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { - if fh.StreamID != 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - if len(p) < 8 { - return nil, ConnectionError(ErrCodeFrameSize) - } - return &GoAwayFrame{ - FrameHeader: fh, - LastStreamID: binary.BigEndian.Uint32(p[:4]) & (1<<31 - 1), - ErrCode: ErrCode(binary.BigEndian.Uint32(p[4:8])), - debugData: p[8:], - }, nil -} - -func (f *Framer) WriteGoAway(maxStreamID uint32, code ErrCode, debugData []byte) error { - f.startWrite(FrameGoAway, 0, 0) - f.writeUint32(maxStreamID & (1<<31 - 1)) - f.writeUint32(uint32(code)) - f.writeBytes(debugData) - return f.endWrite() -} - -// An UnknownFrame is the frame type returned when the frame type is unknown -// or no specific frame type parser exists. -type UnknownFrame struct { - FrameHeader - p []byte -} - -// Payload returns the frame's payload (after the header). It is not -// valid to call this method after a subsequent call to -// Framer.ReadFrame, nor is it valid to retain the returned slice. -// The memory is owned by the Framer and is invalidated when the next -// frame is read. -func (f *UnknownFrame) Payload() []byte { - f.checkValid() - return f.p -} - -func parseUnknownFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { - return &UnknownFrame{fh, p}, nil -} - -// A WindowUpdateFrame is used to implement flow control. -// See http://http2.github.io/http2-spec/#rfc.section.6.9 -type WindowUpdateFrame struct { - FrameHeader - Increment uint32 // never read with high bit set -} - -func parseWindowUpdateFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { - if len(p) != 4 { - return nil, ConnectionError(ErrCodeFrameSize) - } - inc := binary.BigEndian.Uint32(p[:4]) & 0x7fffffff // mask off high reserved bit - if inc == 0 { - // A receiver MUST treat the receipt of a - // WINDOW_UPDATE frame with an flow control window - // increment of 0 as a stream error (Section 5.4.2) of - // type PROTOCOL_ERROR; errors on the connection flow - // control window MUST be treated as a connection - // error (Section 5.4.1). - if fh.StreamID == 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - return nil, streamError(fh.StreamID, ErrCodeProtocol) - } - return &WindowUpdateFrame{ - FrameHeader: fh, - Increment: inc, - }, nil -} - -// WriteWindowUpdate writes a WINDOW_UPDATE frame. -// The increment value must be between 1 and 2,147,483,647, inclusive. -// If the Stream ID is zero, the window update applies to the -// connection as a whole. -func (f *Framer) WriteWindowUpdate(streamID, incr uint32) error { - // "The legal range for the increment to the flow control window is 1 to 2^31-1 (2,147,483,647) octets." - if (incr < 1 || incr > 2147483647) && !f.AllowIllegalWrites { - return errors.New("illegal window increment value") - } - f.startWrite(FrameWindowUpdate, 0, streamID) - f.writeUint32(incr) - return f.endWrite() -} - -// A HeadersFrame is used to open a stream and additionally carries a -// header block fragment. -type HeadersFrame struct { - FrameHeader - - // Priority is set if FlagHeadersPriority is set in the FrameHeader. - Priority PriorityParam - - headerFragBuf []byte // not owned -} - -func (f *HeadersFrame) HeaderBlockFragment() []byte { - f.checkValid() - return f.headerFragBuf -} - -func (f *HeadersFrame) HeadersEnded() bool { - return f.FrameHeader.Flags.Has(FlagHeadersEndHeaders) -} - -func (f *HeadersFrame) StreamEnded() bool { - return f.FrameHeader.Flags.Has(FlagHeadersEndStream) -} - -func (f *HeadersFrame) HasPriority() bool { - return f.FrameHeader.Flags.Has(FlagHeadersPriority) -} - -func parseHeadersFrame(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) { - hf := &HeadersFrame{ - FrameHeader: fh, - } - if fh.StreamID == 0 { - // HEADERS frames MUST be associated with a stream. If a HEADERS frame - // is received whose stream identifier field is 0x0, the recipient MUST - // respond with a connection error (Section 5.4.1) of type - // PROTOCOL_ERROR. - return nil, connError{ErrCodeProtocol, "HEADERS frame with stream ID 0"} - } - var padLength uint8 - if fh.Flags.Has(FlagHeadersPadded) { - if p, padLength, err = readByte(p); err != nil { - return - } - } - if fh.Flags.Has(FlagHeadersPriority) { - var v uint32 - p, v, err = readUint32(p) - if err != nil { - return nil, err - } - hf.Priority.StreamDep = v & 0x7fffffff - hf.Priority.Exclusive = (v != hf.Priority.StreamDep) // high bit was set - p, hf.Priority.Weight, err = readByte(p) - if err != nil { - return nil, err - } - } - if len(p)-int(padLength) <= 0 { - return nil, streamError(fh.StreamID, ErrCodeProtocol) - } - hf.headerFragBuf = p[:len(p)-int(padLength)] - return hf, nil -} - -// HeadersFrameParam are the parameters for writing a HEADERS frame. -type HeadersFrameParam struct { - // StreamID is the required Stream ID to initiate. - StreamID uint32 - // BlockFragment is part (or all) of a Header Block. - BlockFragment []byte - - // EndStream indicates that the header block is the last that - // the endpoint will send for the identified stream. Setting - // this flag causes the stream to enter one of "half closed" - // states. - EndStream bool - - // EndHeaders indicates that this frame contains an entire - // header block and is not followed by any - // CONTINUATION frames. - EndHeaders bool - - // PadLength is the optional number of bytes of zeros to add - // to this frame. - PadLength uint8 - - // Priority, if non-zero, includes stream priority information - // in the HEADER frame. - Priority PriorityParam -} - -// WriteHeaders writes a single HEADERS frame. -// -// This is a low-level header writing method. Encoding headers and -// splitting them into any necessary CONTINUATION frames is handled -// elsewhere. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteHeaders(p HeadersFrameParam) error { - if !validStreamID(p.StreamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if p.PadLength != 0 { - flags |= FlagHeadersPadded - } - if p.EndStream { - flags |= FlagHeadersEndStream - } - if p.EndHeaders { - flags |= FlagHeadersEndHeaders - } - if !p.Priority.IsZero() { - flags |= FlagHeadersPriority - } - f.startWrite(FrameHeaders, flags, p.StreamID) - if p.PadLength != 0 { - f.writeByte(p.PadLength) - } - if !p.Priority.IsZero() { - v := p.Priority.StreamDep - if !validStreamIDOrZero(v) && !f.AllowIllegalWrites { - return errDepStreamID - } - if p.Priority.Exclusive { - v |= 1 << 31 - } - f.writeUint32(v) - f.writeByte(p.Priority.Weight) - } - f.wbuf = append(f.wbuf, p.BlockFragment...) - f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...) - return f.endWrite() -} - -// A PriorityFrame specifies the sender-advised priority of a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.3 -type PriorityFrame struct { - FrameHeader - PriorityParam -} - -// PriorityParam are the stream prioritzation parameters. -type PriorityParam struct { - // StreamDep is a 31-bit stream identifier for the - // stream that this stream depends on. Zero means no - // dependency. - StreamDep uint32 - - // Exclusive is whether the dependency is exclusive. - Exclusive bool - - // Weight is the stream's zero-indexed weight. It should be - // set together with StreamDep, or neither should be set. Per - // the spec, "Add one to the value to obtain a weight between - // 1 and 256." - Weight uint8 -} - -func (p PriorityParam) IsZero() bool { - return p == PriorityParam{} -} - -func parsePriorityFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) { - if fh.StreamID == 0 { - return nil, connError{ErrCodeProtocol, "PRIORITY frame with stream ID 0"} - } - if len(payload) != 5 { - return nil, connError{ErrCodeFrameSize, fmt.Sprintf("PRIORITY frame payload size was %d; want 5", len(payload))} - } - v := binary.BigEndian.Uint32(payload[:4]) - streamID := v & 0x7fffffff // mask off high bit - return &PriorityFrame{ - FrameHeader: fh, - PriorityParam: PriorityParam{ - Weight: payload[4], - StreamDep: streamID, - Exclusive: streamID != v, // was high bit set? - }, - }, nil -} - -// WritePriority writes a PRIORITY frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WritePriority(streamID uint32, p PriorityParam) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - if !validStreamIDOrZero(p.StreamDep) { - return errDepStreamID - } - f.startWrite(FramePriority, 0, streamID) - v := p.StreamDep - if p.Exclusive { - v |= 1 << 31 - } - f.writeUint32(v) - f.writeByte(p.Weight) - return f.endWrite() -} - -// A RSTStreamFrame allows for abnormal termination of a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.4 -type RSTStreamFrame struct { - FrameHeader - ErrCode ErrCode -} - -func parseRSTStreamFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { - if len(p) != 4 { - return nil, ConnectionError(ErrCodeFrameSize) - } - if fh.StreamID == 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - return &RSTStreamFrame{fh, ErrCode(binary.BigEndian.Uint32(p[:4]))}, nil -} - -// WriteRSTStream writes a RST_STREAM frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteRSTStream(streamID uint32, code ErrCode) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - f.startWrite(FrameRSTStream, 0, streamID) - f.writeUint32(uint32(code)) - return f.endWrite() -} - -// A ContinuationFrame is used to continue a sequence of header block fragments. -// See http://http2.github.io/http2-spec/#rfc.section.6.10 -type ContinuationFrame struct { - FrameHeader - headerFragBuf []byte -} - -func parseContinuationFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) { - if fh.StreamID == 0 { - return nil, connError{ErrCodeProtocol, "CONTINUATION frame with stream ID 0"} - } - return &ContinuationFrame{fh, p}, nil -} - -func (f *ContinuationFrame) HeaderBlockFragment() []byte { - f.checkValid() - return f.headerFragBuf -} - -func (f *ContinuationFrame) HeadersEnded() bool { - return f.FrameHeader.Flags.Has(FlagContinuationEndHeaders) -} - -// WriteContinuation writes a CONTINUATION frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteContinuation(streamID uint32, endHeaders bool, headerBlockFragment []byte) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if endHeaders { - flags |= FlagContinuationEndHeaders - } - f.startWrite(FrameContinuation, flags, streamID) - f.wbuf = append(f.wbuf, headerBlockFragment...) - return f.endWrite() -} - -// A PushPromiseFrame is used to initiate a server stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.6 -type PushPromiseFrame struct { - FrameHeader - PromiseID uint32 - headerFragBuf []byte // not owned -} - -func (f *PushPromiseFrame) HeaderBlockFragment() []byte { - f.checkValid() - return f.headerFragBuf -} - -func (f *PushPromiseFrame) HeadersEnded() bool { - return f.FrameHeader.Flags.Has(FlagPushPromiseEndHeaders) -} - -func parsePushPromise(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) { - pp := &PushPromiseFrame{ - FrameHeader: fh, - } - if pp.StreamID == 0 { - // PUSH_PROMISE frames MUST be associated with an existing, - // peer-initiated stream. The stream identifier of a - // PUSH_PROMISE frame indicates the stream it is associated - // with. If the stream identifier field specifies the value - // 0x0, a recipient MUST respond with a connection error - // (Section 5.4.1) of type PROTOCOL_ERROR. - return nil, ConnectionError(ErrCodeProtocol) - } - // The PUSH_PROMISE frame includes optional padding. - // Padding fields and flags are identical to those defined for DATA frames - var padLength uint8 - if fh.Flags.Has(FlagPushPromisePadded) { - if p, padLength, err = readByte(p); err != nil { - return - } - } - - p, pp.PromiseID, err = readUint32(p) - if err != nil { - return - } - pp.PromiseID = pp.PromiseID & (1<<31 - 1) - - if int(padLength) > len(p) { - // like the DATA frame, error out if padding is longer than the body. - return nil, ConnectionError(ErrCodeProtocol) - } - pp.headerFragBuf = p[:len(p)-int(padLength)] - return pp, nil -} - -// PushPromiseParam are the parameters for writing a PUSH_PROMISE frame. -type PushPromiseParam struct { - // StreamID is the required Stream ID to initiate. - StreamID uint32 - - // PromiseID is the required Stream ID which this - // Push Promises - PromiseID uint32 - - // BlockFragment is part (or all) of a Header Block. - BlockFragment []byte - - // EndHeaders indicates that this frame contains an entire - // header block and is not followed by any - // CONTINUATION frames. - EndHeaders bool - - // PadLength is the optional number of bytes of zeros to add - // to this frame. - PadLength uint8 -} - -// WritePushPromise writes a single PushPromise Frame. -// -// As with Header Frames, This is the low level call for writing -// individual frames. Continuation frames are handled elsewhere. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WritePushPromise(p PushPromiseParam) error { - if !validStreamID(p.StreamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if p.PadLength != 0 { - flags |= FlagPushPromisePadded - } - if p.EndHeaders { - flags |= FlagPushPromiseEndHeaders - } - f.startWrite(FramePushPromise, flags, p.StreamID) - if p.PadLength != 0 { - f.writeByte(p.PadLength) - } - if !validStreamID(p.PromiseID) && !f.AllowIllegalWrites { - return errStreamID - } - f.writeUint32(p.PromiseID) - f.wbuf = append(f.wbuf, p.BlockFragment...) - f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...) - return f.endWrite() -} - -// WriteRawFrame writes a raw frame. This can be used to write -// extension frames unknown to this package. -func (f *Framer) WriteRawFrame(t FrameType, flags Flags, streamID uint32, payload []byte) error { - f.startWrite(t, flags, streamID) - f.writeBytes(payload) - return f.endWrite() -} - -func readByte(p []byte) (remain []byte, b byte, err error) { - if len(p) == 0 { - return nil, 0, io.ErrUnexpectedEOF - } - return p[1:], p[0], nil -} - -func readUint32(p []byte) (remain []byte, v uint32, err error) { - if len(p) < 4 { - return nil, 0, io.ErrUnexpectedEOF - } - return p[4:], binary.BigEndian.Uint32(p[:4]), nil -} - -type streamEnder interface { - StreamEnded() bool -} - -type headersEnder interface { - HeadersEnded() bool -} - -type headersOrContinuation interface { - headersEnder - HeaderBlockFragment() []byte -} - -// A MetaHeadersFrame is the representation of one HEADERS frame and -// zero or more contiguous CONTINUATION frames and the decoding of -// their HPACK-encoded contents. -// -// This type of frame does not appear on the wire and is only returned -// by the Framer when Framer.ReadMetaHeaders is set. -type MetaHeadersFrame struct { - *HeadersFrame - - // Fields are the fields contained in the HEADERS and - // CONTINUATION frames. The underlying slice is owned by the - // Framer and must not be retained after the next call to - // ReadFrame. - // - // Fields are guaranteed to be in the correct http2 order and - // not have unknown pseudo header fields or invalid header - // field names or values. Required pseudo header fields may be - // missing, however. Use the MetaHeadersFrame.Pseudo accessor - // method access pseudo headers. - Fields []hpack.HeaderField - - // Truncated is whether the max header list size limit was hit - // and Fields is incomplete. The hpack decoder state is still - // valid, however. - Truncated bool -} - -// PseudoValue returns the given pseudo header field's value. -// The provided pseudo field should not contain the leading colon. -func (mh *MetaHeadersFrame) PseudoValue(pseudo string) string { - for _, hf := range mh.Fields { - if !hf.IsPseudo() { - return "" - } - if hf.Name[1:] == pseudo { - return hf.Value - } - } - return "" -} - -// RegularFields returns the regular (non-pseudo) header fields of mh. -// The caller does not own the returned slice. -func (mh *MetaHeadersFrame) RegularFields() []hpack.HeaderField { - for i, hf := range mh.Fields { - if !hf.IsPseudo() { - return mh.Fields[i:] - } - } - return nil -} - -// PseudoFields returns the pseudo header fields of mh. -// The caller does not own the returned slice. -func (mh *MetaHeadersFrame) PseudoFields() []hpack.HeaderField { - for i, hf := range mh.Fields { - if !hf.IsPseudo() { - return mh.Fields[:i] - } - } - return mh.Fields -} - -func (mh *MetaHeadersFrame) checkPseudos() error { - var isRequest, isResponse bool - pf := mh.PseudoFields() - for i, hf := range pf { - switch hf.Name { - case ":method", ":path", ":scheme", ":authority": - isRequest = true - case ":status": - isResponse = true - default: - return pseudoHeaderError(hf.Name) - } - // Check for duplicates. - // This would be a bad algorithm, but N is 4. - // And this doesn't allocate. - for _, hf2 := range pf[:i] { - if hf.Name == hf2.Name { - return duplicatePseudoHeaderError(hf.Name) - } - } - } - if isRequest && isResponse { - return errMixPseudoHeaderTypes - } - return nil -} - -func (fr *Framer) maxHeaderStringLen() int { - v := fr.maxHeaderListSize() - if uint32(int(v)) == v { - return int(v) - } - // They had a crazy big number for MaxHeaderBytes anyway, - // so give them unlimited header lengths: - return 0 -} - -// readMetaFrame returns 0 or more CONTINUATION frames from fr and -// merge them into the provided hf and returns a MetaHeadersFrame -// with the decoded hpack values. -func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) { - if fr.AllowIllegalReads { - return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders") - } - mh := &MetaHeadersFrame{ - HeadersFrame: hf, - } - var remainSize = fr.maxHeaderListSize() - var sawRegular bool - - var invalid error // pseudo header field errors - hdec := fr.ReadMetaHeaders - hdec.SetEmitEnabled(true) - hdec.SetMaxStringLength(fr.maxHeaderStringLen()) - hdec.SetEmitFunc(func(hf hpack.HeaderField) { - if VerboseLogs && fr.logReads { - fr.debugReadLoggerf("http2: decoded hpack field %+v", hf) - } - if !httpguts.ValidHeaderFieldValue(hf.Value) { - invalid = headerFieldValueError(hf.Value) - } - isPseudo := strings.HasPrefix(hf.Name, ":") - if isPseudo { - if sawRegular { - invalid = errPseudoAfterRegular - } - } else { - sawRegular = true - if !validWireHeaderFieldName(hf.Name) { - invalid = headerFieldNameError(hf.Name) - } - } - - if invalid != nil { - hdec.SetEmitEnabled(false) - return - } - - size := hf.Size() - if size > remainSize { - hdec.SetEmitEnabled(false) - mh.Truncated = true - return - } - remainSize -= size - - mh.Fields = append(mh.Fields, hf) - }) - // Lose reference to MetaHeadersFrame: - defer hdec.SetEmitFunc(func(hf hpack.HeaderField) {}) - - var hc headersOrContinuation = hf - for { - frag := hc.HeaderBlockFragment() - if _, err := hdec.Write(frag); err != nil { - return nil, ConnectionError(ErrCodeCompression) - } - - if hc.HeadersEnded() { - break - } - if f, err := fr.ReadFrame(); err != nil { - return nil, err - } else { - hc = f.(*ContinuationFrame) // guaranteed by checkFrameOrder - } - } - - mh.HeadersFrame.headerFragBuf = nil - mh.HeadersFrame.invalidate() - - if err := hdec.Close(); err != nil { - return nil, ConnectionError(ErrCodeCompression) - } - if invalid != nil { - fr.errDetail = invalid - if VerboseLogs { - log.Printf("http2: invalid header: %v", invalid) - } - return nil, StreamError{mh.StreamID, ErrCodeProtocol, invalid} - } - if err := mh.checkPseudos(); err != nil { - fr.errDetail = err - if VerboseLogs { - log.Printf("http2: invalid pseudo headers: %v", err) - } - return nil, StreamError{mh.StreamID, ErrCodeProtocol, err} - } - return mh, nil -} - -func summarizeFrame(f Frame) string { - var buf bytes.Buffer - f.Header().writeDebug(&buf) - switch f := f.(type) { - case *SettingsFrame: - n := 0 - f.ForeachSetting(func(s Setting) error { - n++ - if n == 1 { - buf.WriteString(", settings:") - } - fmt.Fprintf(&buf, " %v=%v,", s.ID, s.Val) - return nil - }) - if n > 0 { - buf.Truncate(buf.Len() - 1) // remove trailing comma - } - case *DataFrame: - data := f.Data() - const max = 256 - if len(data) > max { - data = data[:max] - } - fmt.Fprintf(&buf, " data=%q", data) - if len(f.Data()) > max { - fmt.Fprintf(&buf, " (%d bytes omitted)", len(f.Data())-max) - } - case *WindowUpdateFrame: - if f.StreamID == 0 { - buf.WriteString(" (conn)") - } - fmt.Fprintf(&buf, " incr=%v", f.Increment) - case *PingFrame: - fmt.Fprintf(&buf, " ping=%q", f.Data[:]) - case *GoAwayFrame: - fmt.Fprintf(&buf, " LastStreamID=%v ErrCode=%v Debug=%q", - f.LastStreamID, f.ErrCode, f.debugData) - case *RSTStreamFrame: - fmt.Fprintf(&buf, " ErrCode=%v", f.ErrCode) - } - return buf.String() -} diff --git a/vendor/golang.org/x/net/http2/go111.go b/vendor/golang.org/x/net/http2/go111.go deleted file mode 100644 index 3a131016b..000000000 --- a/vendor/golang.org/x/net/http2/go111.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.11 - -package http2 - -import ( - "net/http/httptrace" - "net/textproto" -) - -func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { - return trace != nil && trace.WroteHeaderField != nil -} - -func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) { - if trace != nil && trace.WroteHeaderField != nil { - trace.WroteHeaderField(k, []string{v}) - } -} - -func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { - if trace != nil { - return trace.Got1xxResponse - } - return nil -} diff --git a/vendor/golang.org/x/net/http2/gotrack.go b/vendor/golang.org/x/net/http2/gotrack.go deleted file mode 100644 index 9933c9f8c..000000000 --- a/vendor/golang.org/x/net/http2/gotrack.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Defensive debug-only utility to track that functions run on the -// goroutine that they're supposed to. - -package http2 - -import ( - "bytes" - "errors" - "fmt" - "os" - "runtime" - "strconv" - "sync" -) - -var DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1" - -type goroutineLock uint64 - -func newGoroutineLock() goroutineLock { - if !DebugGoroutines { - return 0 - } - return goroutineLock(curGoroutineID()) -} - -func (g goroutineLock) check() { - if !DebugGoroutines { - return - } - if curGoroutineID() != uint64(g) { - panic("running on the wrong goroutine") - } -} - -func (g goroutineLock) checkNotOn() { - if !DebugGoroutines { - return - } - if curGoroutineID() == uint64(g) { - panic("running on the wrong goroutine") - } -} - -var goroutineSpace = []byte("goroutine ") - -func curGoroutineID() uint64 { - bp := littleBuf.Get().(*[]byte) - defer littleBuf.Put(bp) - b := *bp - b = b[:runtime.Stack(b, false)] - // Parse the 4707 out of "goroutine 4707 [" - b = bytes.TrimPrefix(b, goroutineSpace) - i := bytes.IndexByte(b, ' ') - if i < 0 { - panic(fmt.Sprintf("No space found in %q", b)) - } - b = b[:i] - n, err := parseUintBytes(b, 10, 64) - if err != nil { - panic(fmt.Sprintf("Failed to parse goroutine ID out of %q: %v", b, err)) - } - return n -} - -var littleBuf = sync.Pool{ - New: func() interface{} { - buf := make([]byte, 64) - return &buf - }, -} - -// parseUintBytes is like strconv.ParseUint, but using a []byte. -func parseUintBytes(s []byte, base int, bitSize int) (n uint64, err error) { - var cutoff, maxVal uint64 - - if bitSize == 0 { - bitSize = int(strconv.IntSize) - } - - s0 := s - switch { - case len(s) < 1: - err = strconv.ErrSyntax - goto Error - - case 2 <= base && base <= 36: - // valid base; nothing to do - - case base == 0: - // Look for octal, hex prefix. - switch { - case s[0] == '0' && len(s) > 1 && (s[1] == 'x' || s[1] == 'X'): - base = 16 - s = s[2:] - if len(s) < 1 { - err = strconv.ErrSyntax - goto Error - } - case s[0] == '0': - base = 8 - default: - base = 10 - } - - default: - err = errors.New("invalid base " + strconv.Itoa(base)) - goto Error - } - - n = 0 - cutoff = cutoff64(base) - maxVal = 1<<uint(bitSize) - 1 - - for i := 0; i < len(s); i++ { - var v byte - d := s[i] - switch { - case '0' <= d && d <= '9': - v = d - '0' - case 'a' <= d && d <= 'z': - v = d - 'a' + 10 - case 'A' <= d && d <= 'Z': - v = d - 'A' + 10 - default: - n = 0 - err = strconv.ErrSyntax - goto Error - } - if int(v) >= base { - n = 0 - err = strconv.ErrSyntax - goto Error - } - - if n >= cutoff { - // n*base overflows - n = 1<<64 - 1 - err = strconv.ErrRange - goto Error - } - n *= uint64(base) - - n1 := n + uint64(v) - if n1 < n || n1 > maxVal { - // n+v overflows - n = 1<<64 - 1 - err = strconv.ErrRange - goto Error - } - n = n1 - } - - return n, nil - -Error: - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} -} - -// Return the first number n such that n*base >= 1<<64. -func cutoff64(base int) uint64 { - if base < 2 { - return 0 - } - return (1<<64-1)/uint64(base) + 1 -} diff --git a/vendor/golang.org/x/net/http2/headermap.go b/vendor/golang.org/x/net/http2/headermap.go deleted file mode 100644 index c3ff3fa1c..000000000 --- a/vendor/golang.org/x/net/http2/headermap.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "net/http" - "strings" - "sync" -) - -var ( - commonBuildOnce sync.Once - commonLowerHeader map[string]string // Go-Canonical-Case -> lower-case - commonCanonHeader map[string]string // lower-case -> Go-Canonical-Case -) - -func buildCommonHeaderMapsOnce() { - commonBuildOnce.Do(buildCommonHeaderMaps) -} - -func buildCommonHeaderMaps() { - common := []string{ - "accept", - "accept-charset", - "accept-encoding", - "accept-language", - "accept-ranges", - "age", - "access-control-allow-origin", - "allow", - "authorization", - "cache-control", - "content-disposition", - "content-encoding", - "content-language", - "content-length", - "content-location", - "content-range", - "content-type", - "cookie", - "date", - "etag", - "expect", - "expires", - "from", - "host", - "if-match", - "if-modified-since", - "if-none-match", - "if-unmodified-since", - "last-modified", - "link", - "location", - "max-forwards", - "proxy-authenticate", - "proxy-authorization", - "range", - "referer", - "refresh", - "retry-after", - "server", - "set-cookie", - "strict-transport-security", - "trailer", - "transfer-encoding", - "user-agent", - "vary", - "via", - "www-authenticate", - } - commonLowerHeader = make(map[string]string, len(common)) - commonCanonHeader = make(map[string]string, len(common)) - for _, v := range common { - chk := http.CanonicalHeaderKey(v) - commonLowerHeader[chk] = v - commonCanonHeader[v] = chk - } -} - -func lowerHeader(v string) string { - buildCommonHeaderMapsOnce() - if s, ok := commonLowerHeader[v]; ok { - return s - } - return strings.ToLower(v) -} diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go deleted file mode 100644 index 97f17831f..000000000 --- a/vendor/golang.org/x/net/http2/hpack/encode.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package hpack - -import ( - "io" -) - -const ( - uint32Max = ^uint32(0) - initialHeaderTableSize = 4096 -) - -type Encoder struct { - dynTab dynamicTable - // minSize is the minimum table size set by - // SetMaxDynamicTableSize after the previous Header Table Size - // Update. - minSize uint32 - // maxSizeLimit is the maximum table size this encoder - // supports. This will protect the encoder from too large - // size. - maxSizeLimit uint32 - // tableSizeUpdate indicates whether "Header Table Size - // Update" is required. - tableSizeUpdate bool - w io.Writer - buf []byte -} - -// NewEncoder returns a new Encoder which performs HPACK encoding. An -// encoded data is written to w. -func NewEncoder(w io.Writer) *Encoder { - e := &Encoder{ - minSize: uint32Max, - maxSizeLimit: initialHeaderTableSize, - tableSizeUpdate: false, - w: w, - } - e.dynTab.table.init() - e.dynTab.setMaxSize(initialHeaderTableSize) - return e -} - -// WriteField encodes f into a single Write to e's underlying Writer. -// This function may also produce bytes for "Header Table Size Update" -// if necessary. If produced, it is done before encoding f. -func (e *Encoder) WriteField(f HeaderField) error { - e.buf = e.buf[:0] - - if e.tableSizeUpdate { - e.tableSizeUpdate = false - if e.minSize < e.dynTab.maxSize { - e.buf = appendTableSize(e.buf, e.minSize) - } - e.minSize = uint32Max - e.buf = appendTableSize(e.buf, e.dynTab.maxSize) - } - - idx, nameValueMatch := e.searchTable(f) - if nameValueMatch { - e.buf = appendIndexed(e.buf, idx) - } else { - indexing := e.shouldIndex(f) - if indexing { - e.dynTab.add(f) - } - - if idx == 0 { - e.buf = appendNewName(e.buf, f, indexing) - } else { - e.buf = appendIndexedName(e.buf, f, idx, indexing) - } - } - n, err := e.w.Write(e.buf) - if err == nil && n != len(e.buf) { - err = io.ErrShortWrite - } - return err -} - -// searchTable searches f in both stable and dynamic header tables. -// The static header table is searched first. Only when there is no -// exact match for both name and value, the dynamic header table is -// then searched. If there is no match, i is 0. If both name and value -// match, i is the matched index and nameValueMatch becomes true. If -// only name matches, i points to that index and nameValueMatch -// becomes false. -func (e *Encoder) searchTable(f HeaderField) (i uint64, nameValueMatch bool) { - i, nameValueMatch = staticTable.search(f) - if nameValueMatch { - return i, true - } - - j, nameValueMatch := e.dynTab.table.search(f) - if nameValueMatch || (i == 0 && j != 0) { - return j + uint64(staticTable.len()), nameValueMatch - } - - return i, false -} - -// SetMaxDynamicTableSize changes the dynamic header table size to v. -// The actual size is bounded by the value passed to -// SetMaxDynamicTableSizeLimit. -func (e *Encoder) SetMaxDynamicTableSize(v uint32) { - if v > e.maxSizeLimit { - v = e.maxSizeLimit - } - if v < e.minSize { - e.minSize = v - } - e.tableSizeUpdate = true - e.dynTab.setMaxSize(v) -} - -// SetMaxDynamicTableSizeLimit changes the maximum value that can be -// specified in SetMaxDynamicTableSize to v. By default, it is set to -// 4096, which is the same size of the default dynamic header table -// size described in HPACK specification. If the current maximum -// dynamic header table size is strictly greater than v, "Header Table -// Size Update" will be done in the next WriteField call and the -// maximum dynamic header table size is truncated to v. -func (e *Encoder) SetMaxDynamicTableSizeLimit(v uint32) { - e.maxSizeLimit = v - if e.dynTab.maxSize > v { - e.tableSizeUpdate = true - e.dynTab.setMaxSize(v) - } -} - -// shouldIndex reports whether f should be indexed. -func (e *Encoder) shouldIndex(f HeaderField) bool { - return !f.Sensitive && f.Size() <= e.dynTab.maxSize -} - -// appendIndexed appends index i, as encoded in "Indexed Header Field" -// representation, to dst and returns the extended buffer. -func appendIndexed(dst []byte, i uint64) []byte { - first := len(dst) - dst = appendVarInt(dst, 7, i) - dst[first] |= 0x80 - return dst -} - -// appendNewName appends f, as encoded in one of "Literal Header field -// - New Name" representation variants, to dst and returns the -// extended buffer. -// -// If f.Sensitive is true, "Never Indexed" representation is used. If -// f.Sensitive is false and indexing is true, "Incremental Indexing" -// representation is used. -func appendNewName(dst []byte, f HeaderField, indexing bool) []byte { - dst = append(dst, encodeTypeByte(indexing, f.Sensitive)) - dst = appendHpackString(dst, f.Name) - return appendHpackString(dst, f.Value) -} - -// appendIndexedName appends f and index i referring indexed name -// entry, as encoded in one of "Literal Header field - Indexed Name" -// representation variants, to dst and returns the extended buffer. -// -// If f.Sensitive is true, "Never Indexed" representation is used. If -// f.Sensitive is false and indexing is true, "Incremental Indexing" -// representation is used. -func appendIndexedName(dst []byte, f HeaderField, i uint64, indexing bool) []byte { - first := len(dst) - var n byte - if indexing { - n = 6 - } else { - n = 4 - } - dst = appendVarInt(dst, n, i) - dst[first] |= encodeTypeByte(indexing, f.Sensitive) - return appendHpackString(dst, f.Value) -} - -// appendTableSize appends v, as encoded in "Header Table Size Update" -// representation, to dst and returns the extended buffer. -func appendTableSize(dst []byte, v uint32) []byte { - first := len(dst) - dst = appendVarInt(dst, 5, uint64(v)) - dst[first] |= 0x20 - return dst -} - -// appendVarInt appends i, as encoded in variable integer form using n -// bit prefix, to dst and returns the extended buffer. -// -// See -// http://http2.github.io/http2-spec/compression.html#integer.representation -func appendVarInt(dst []byte, n byte, i uint64) []byte { - k := uint64((1 << n) - 1) - if i < k { - return append(dst, byte(i)) - } - dst = append(dst, byte(k)) - i -= k - for ; i >= 128; i >>= 7 { - dst = append(dst, byte(0x80|(i&0x7f))) - } - return append(dst, byte(i)) -} - -// appendHpackString appends s, as encoded in "String Literal" -// representation, to dst and returns the extended buffer. -// -// s will be encoded in Huffman codes only when it produces strictly -// shorter byte string. -func appendHpackString(dst []byte, s string) []byte { - huffmanLength := HuffmanEncodeLength(s) - if huffmanLength < uint64(len(s)) { - first := len(dst) - dst = appendVarInt(dst, 7, huffmanLength) - dst = AppendHuffmanString(dst, s) - dst[first] |= 0x80 - } else { - dst = appendVarInt(dst, 7, uint64(len(s))) - dst = append(dst, s...) - } - return dst -} - -// encodeTypeByte returns type byte. If sensitive is true, type byte -// for "Never Indexed" representation is returned. If sensitive is -// false and indexing is true, type byte for "Incremental Indexing" -// representation is returned. Otherwise, type byte for "Without -// Indexing" is returned. -func encodeTypeByte(indexing, sensitive bool) byte { - if sensitive { - return 0x10 - } - if indexing { - return 0x40 - } - return 0 -} diff --git a/vendor/golang.org/x/net/http2/hpack/hpack.go b/vendor/golang.org/x/net/http2/hpack/hpack.go deleted file mode 100644 index 85f18a2b0..000000000 --- a/vendor/golang.org/x/net/http2/hpack/hpack.go +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package hpack implements HPACK, a compression format for -// efficiently representing HTTP header fields in the context of HTTP/2. -// -// See http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09 -package hpack - -import ( - "bytes" - "errors" - "fmt" -) - -// A DecodingError is something the spec defines as a decoding error. -type DecodingError struct { - Err error -} - -func (de DecodingError) Error() string { - return fmt.Sprintf("decoding error: %v", de.Err) -} - -// An InvalidIndexError is returned when an encoder references a table -// entry before the static table or after the end of the dynamic table. -type InvalidIndexError int - -func (e InvalidIndexError) Error() string { - return fmt.Sprintf("invalid indexed representation index %d", int(e)) -} - -// A HeaderField is a name-value pair. Both the name and value are -// treated as opaque sequences of octets. -type HeaderField struct { - Name, Value string - - // Sensitive means that this header field should never be - // indexed. - Sensitive bool -} - -// IsPseudo reports whether the header field is an http2 pseudo header. -// That is, it reports whether it starts with a colon. -// It is not otherwise guaranteed to be a valid pseudo header field, -// though. -func (hf HeaderField) IsPseudo() bool { - return len(hf.Name) != 0 && hf.Name[0] == ':' -} - -func (hf HeaderField) String() string { - var suffix string - if hf.Sensitive { - suffix = " (sensitive)" - } - return fmt.Sprintf("header field %q = %q%s", hf.Name, hf.Value, suffix) -} - -// Size returns the size of an entry per RFC 7541 section 4.1. -func (hf HeaderField) Size() uint32 { - // http://http2.github.io/http2-spec/compression.html#rfc.section.4.1 - // "The size of the dynamic table is the sum of the size of - // its entries. The size of an entry is the sum of its name's - // length in octets (as defined in Section 5.2), its value's - // length in octets (see Section 5.2), plus 32. The size of - // an entry is calculated using the length of the name and - // value without any Huffman encoding applied." - - // This can overflow if somebody makes a large HeaderField - // Name and/or Value by hand, but we don't care, because that - // won't happen on the wire because the encoding doesn't allow - // it. - return uint32(len(hf.Name) + len(hf.Value) + 32) -} - -// A Decoder is the decoding context for incremental processing of -// header blocks. -type Decoder struct { - dynTab dynamicTable - emit func(f HeaderField) - - emitEnabled bool // whether calls to emit are enabled - maxStrLen int // 0 means unlimited - - // buf is the unparsed buffer. It's only written to - // saveBuf if it was truncated in the middle of a header - // block. Because it's usually not owned, we can only - // process it under Write. - buf []byte // not owned; only valid during Write - - // saveBuf is previous data passed to Write which we weren't able - // to fully parse before. Unlike buf, we own this data. - saveBuf bytes.Buffer - - firstField bool // processing the first field of the header block -} - -// NewDecoder returns a new decoder with the provided maximum dynamic -// table size. The emitFunc will be called for each valid field -// parsed, in the same goroutine as calls to Write, before Write returns. -func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder { - d := &Decoder{ - emit: emitFunc, - emitEnabled: true, - firstField: true, - } - d.dynTab.table.init() - d.dynTab.allowedMaxSize = maxDynamicTableSize - d.dynTab.setMaxSize(maxDynamicTableSize) - return d -} - -// ErrStringLength is returned by Decoder.Write when the max string length -// (as configured by Decoder.SetMaxStringLength) would be violated. -var ErrStringLength = errors.New("hpack: string too long") - -// SetMaxStringLength sets the maximum size of a HeaderField name or -// value string. If a string exceeds this length (even after any -// decompression), Write will return ErrStringLength. -// A value of 0 means unlimited and is the default from NewDecoder. -func (d *Decoder) SetMaxStringLength(n int) { - d.maxStrLen = n -} - -// SetEmitFunc changes the callback used when new header fields -// are decoded. -// It must be non-nil. It does not affect EmitEnabled. -func (d *Decoder) SetEmitFunc(emitFunc func(f HeaderField)) { - d.emit = emitFunc -} - -// SetEmitEnabled controls whether the emitFunc provided to NewDecoder -// should be called. The default is true. -// -// This facility exists to let servers enforce MAX_HEADER_LIST_SIZE -// while still decoding and keeping in-sync with decoder state, but -// without doing unnecessary decompression or generating unnecessary -// garbage for header fields past the limit. -func (d *Decoder) SetEmitEnabled(v bool) { d.emitEnabled = v } - -// EmitEnabled reports whether calls to the emitFunc provided to NewDecoder -// are currently enabled. The default is true. -func (d *Decoder) EmitEnabled() bool { return d.emitEnabled } - -// TODO: add method *Decoder.Reset(maxSize, emitFunc) to let callers re-use Decoders and their -// underlying buffers for garbage reasons. - -func (d *Decoder) SetMaxDynamicTableSize(v uint32) { - d.dynTab.setMaxSize(v) -} - -// SetAllowedMaxDynamicTableSize sets the upper bound that the encoded -// stream (via dynamic table size updates) may set the maximum size -// to. -func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) { - d.dynTab.allowedMaxSize = v -} - -type dynamicTable struct { - // http://http2.github.io/http2-spec/compression.html#rfc.section.2.3.2 - table headerFieldTable - size uint32 // in bytes - maxSize uint32 // current maxSize - allowedMaxSize uint32 // maxSize may go up to this, inclusive -} - -func (dt *dynamicTable) setMaxSize(v uint32) { - dt.maxSize = v - dt.evict() -} - -func (dt *dynamicTable) add(f HeaderField) { - dt.table.addEntry(f) - dt.size += f.Size() - dt.evict() -} - -// If we're too big, evict old stuff. -func (dt *dynamicTable) evict() { - var n int - for dt.size > dt.maxSize && n < dt.table.len() { - dt.size -= dt.table.ents[n].Size() - n++ - } - dt.table.evictOldest(n) -} - -func (d *Decoder) maxTableIndex() int { - // This should never overflow. RFC 7540 Section 6.5.2 limits the size of - // the dynamic table to 2^32 bytes, where each entry will occupy more than - // one byte. Further, the staticTable has a fixed, small length. - return d.dynTab.table.len() + staticTable.len() -} - -func (d *Decoder) at(i uint64) (hf HeaderField, ok bool) { - // See Section 2.3.3. - if i == 0 { - return - } - if i <= uint64(staticTable.len()) { - return staticTable.ents[i-1], true - } - if i > uint64(d.maxTableIndex()) { - return - } - // In the dynamic table, newer entries have lower indices. - // However, dt.ents[0] is the oldest entry. Hence, dt.ents is - // the reversed dynamic table. - dt := d.dynTab.table - return dt.ents[dt.len()-(int(i)-staticTable.len())], true -} - -// Decode decodes an entire block. -// -// TODO: remove this method and make it incremental later? This is -// easier for debugging now. -func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) { - var hf []HeaderField - saveFunc := d.emit - defer func() { d.emit = saveFunc }() - d.emit = func(f HeaderField) { hf = append(hf, f) } - if _, err := d.Write(p); err != nil { - return nil, err - } - if err := d.Close(); err != nil { - return nil, err - } - return hf, nil -} - -// Close declares that the decoding is complete and resets the Decoder -// to be reused again for a new header block. If there is any remaining -// data in the decoder's buffer, Close returns an error. -func (d *Decoder) Close() error { - if d.saveBuf.Len() > 0 { - d.saveBuf.Reset() - return DecodingError{errors.New("truncated headers")} - } - d.firstField = true - return nil -} - -func (d *Decoder) Write(p []byte) (n int, err error) { - if len(p) == 0 { - // Prevent state machine CPU attacks (making us redo - // work up to the point of finding out we don't have - // enough data) - return - } - // Only copy the data if we have to. Optimistically assume - // that p will contain a complete header block. - if d.saveBuf.Len() == 0 { - d.buf = p - } else { - d.saveBuf.Write(p) - d.buf = d.saveBuf.Bytes() - d.saveBuf.Reset() - } - - for len(d.buf) > 0 { - err = d.parseHeaderFieldRepr() - if err == errNeedMore { - // Extra paranoia, making sure saveBuf won't - // get too large. All the varint and string - // reading code earlier should already catch - // overlong things and return ErrStringLength, - // but keep this as a last resort. - const varIntOverhead = 8 // conservative - if d.maxStrLen != 0 && int64(len(d.buf)) > 2*(int64(d.maxStrLen)+varIntOverhead) { - return 0, ErrStringLength - } - d.saveBuf.Write(d.buf) - return len(p), nil - } - d.firstField = false - if err != nil { - break - } - } - return len(p), err -} - -// errNeedMore is an internal sentinel error value that means the -// buffer is truncated and we need to read more data before we can -// continue parsing. -var errNeedMore = errors.New("need more data") - -type indexType int - -const ( - indexedTrue indexType = iota - indexedFalse - indexedNever -) - -func (v indexType) indexed() bool { return v == indexedTrue } -func (v indexType) sensitive() bool { return v == indexedNever } - -// returns errNeedMore if there isn't enough data available. -// any other error is fatal. -// consumes d.buf iff it returns nil. -// precondition: must be called with len(d.buf) > 0 -func (d *Decoder) parseHeaderFieldRepr() error { - b := d.buf[0] - switch { - case b&128 != 0: - // Indexed representation. - // High bit set? - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.1 - return d.parseFieldIndexed() - case b&192 == 64: - // 6.2.1 Literal Header Field with Incremental Indexing - // 0b10xxxxxx: top two bits are 10 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.1 - return d.parseFieldLiteral(6, indexedTrue) - case b&240 == 0: - // 6.2.2 Literal Header Field without Indexing - // 0b0000xxxx: top four bits are 0000 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.2 - return d.parseFieldLiteral(4, indexedFalse) - case b&240 == 16: - // 6.2.3 Literal Header Field never Indexed - // 0b0001xxxx: top four bits are 0001 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.3 - return d.parseFieldLiteral(4, indexedNever) - case b&224 == 32: - // 6.3 Dynamic Table Size Update - // Top three bits are '001'. - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.3 - return d.parseDynamicTableSizeUpdate() - } - - return DecodingError{errors.New("invalid encoding")} -} - -// (same invariants and behavior as parseHeaderFieldRepr) -func (d *Decoder) parseFieldIndexed() error { - buf := d.buf - idx, buf, err := readVarInt(7, buf) - if err != nil { - return err - } - hf, ok := d.at(idx) - if !ok { - return DecodingError{InvalidIndexError(idx)} - } - d.buf = buf - return d.callEmit(HeaderField{Name: hf.Name, Value: hf.Value}) -} - -// (same invariants and behavior as parseHeaderFieldRepr) -func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { - buf := d.buf - nameIdx, buf, err := readVarInt(n, buf) - if err != nil { - return err - } - - var hf HeaderField - wantStr := d.emitEnabled || it.indexed() - if nameIdx > 0 { - ihf, ok := d.at(nameIdx) - if !ok { - return DecodingError{InvalidIndexError(nameIdx)} - } - hf.Name = ihf.Name - } else { - hf.Name, buf, err = d.readString(buf, wantStr) - if err != nil { - return err - } - } - hf.Value, buf, err = d.readString(buf, wantStr) - if err != nil { - return err - } - d.buf = buf - if it.indexed() { - d.dynTab.add(hf) - } - hf.Sensitive = it.sensitive() - return d.callEmit(hf) -} - -func (d *Decoder) callEmit(hf HeaderField) error { - if d.maxStrLen != 0 { - if len(hf.Name) > d.maxStrLen || len(hf.Value) > d.maxStrLen { - return ErrStringLength - } - } - if d.emitEnabled { - d.emit(hf) - } - return nil -} - -// (same invariants and behavior as parseHeaderFieldRepr) -func (d *Decoder) parseDynamicTableSizeUpdate() error { - // RFC 7541, sec 4.2: This dynamic table size update MUST occur at the - // beginning of the first header block following the change to the dynamic table size. - if !d.firstField && d.dynTab.size > 0 { - return DecodingError{errors.New("dynamic table size update MUST occur at the beginning of a header block")} - } - - buf := d.buf - size, buf, err := readVarInt(5, buf) - if err != nil { - return err - } - if size > uint64(d.dynTab.allowedMaxSize) { - return DecodingError{errors.New("dynamic table size update too large")} - } - d.dynTab.setMaxSize(uint32(size)) - d.buf = buf - return nil -} - -var errVarintOverflow = DecodingError{errors.New("varint integer overflow")} - -// readVarInt reads an unsigned variable length integer off the -// beginning of p. n is the parameter as described in -// http://http2.github.io/http2-spec/compression.html#rfc.section.5.1. -// -// n must always be between 1 and 8. -// -// The returned remain buffer is either a smaller suffix of p, or err != nil. -// The error is errNeedMore if p doesn't contain a complete integer. -func readVarInt(n byte, p []byte) (i uint64, remain []byte, err error) { - if n < 1 || n > 8 { - panic("bad n") - } - if len(p) == 0 { - return 0, p, errNeedMore - } - i = uint64(p[0]) - if n < 8 { - i &= (1 << uint64(n)) - 1 - } - if i < (1<<uint64(n))-1 { - return i, p[1:], nil - } - - origP := p - p = p[1:] - var m uint64 - for len(p) > 0 { - b := p[0] - p = p[1:] - i += uint64(b&127) << m - if b&128 == 0 { - return i, p, nil - } - m += 7 - if m >= 63 { // TODO: proper overflow check. making this up. - return 0, origP, errVarintOverflow - } - } - return 0, origP, errNeedMore -} - -// readString decodes an hpack string from p. -// -// wantStr is whether s will be used. If false, decompression and -// []byte->string garbage are skipped if s will be ignored -// anyway. This does mean that huffman decoding errors for non-indexed -// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server -// is returning an error anyway, and because they're not indexed, the error -// won't affect the decoding state. -func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain []byte, err error) { - if len(p) == 0 { - return "", p, errNeedMore - } - isHuff := p[0]&128 != 0 - strLen, p, err := readVarInt(7, p) - if err != nil { - return "", p, err - } - if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) { - return "", nil, ErrStringLength - } - if uint64(len(p)) < strLen { - return "", p, errNeedMore - } - if !isHuff { - if wantStr { - s = string(p[:strLen]) - } - return s, p[strLen:], nil - } - - if wantStr { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() // don't trust others - defer bufPool.Put(buf) - if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err != nil { - buf.Reset() - return "", nil, err - } - s = buf.String() - buf.Reset() // be nice to GC - } - return s, p[strLen:], nil -} diff --git a/vendor/golang.org/x/net/http2/hpack/huffman.go b/vendor/golang.org/x/net/http2/hpack/huffman.go deleted file mode 100644 index a1ab2f056..000000000 --- a/vendor/golang.org/x/net/http2/hpack/huffman.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package hpack - -import ( - "bytes" - "errors" - "io" - "sync" -) - -var bufPool = sync.Pool{ - New: func() interface{} { return new(bytes.Buffer) }, -} - -// HuffmanDecode decodes the string in v and writes the expanded -// result to w, returning the number of bytes written to w and the -// Write call's return value. At most one Write call is made. -func HuffmanDecode(w io.Writer, v []byte) (int, error) { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() - defer bufPool.Put(buf) - if err := huffmanDecode(buf, 0, v); err != nil { - return 0, err - } - return w.Write(buf.Bytes()) -} - -// HuffmanDecodeToString decodes the string in v. -func HuffmanDecodeToString(v []byte) (string, error) { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() - defer bufPool.Put(buf) - if err := huffmanDecode(buf, 0, v); err != nil { - return "", err - } - return buf.String(), nil -} - -// ErrInvalidHuffman is returned for errors found decoding -// Huffman-encoded strings. -var ErrInvalidHuffman = errors.New("hpack: invalid Huffman-encoded data") - -// huffmanDecode decodes v to buf. -// If maxLen is greater than 0, attempts to write more to buf than -// maxLen bytes will return ErrStringLength. -func huffmanDecode(buf *bytes.Buffer, maxLen int, v []byte) error { - rootHuffmanNode := getRootHuffmanNode() - n := rootHuffmanNode - // cur is the bit buffer that has not been fed into n. - // cbits is the number of low order bits in cur that are valid. - // sbits is the number of bits of the symbol prefix being decoded. - cur, cbits, sbits := uint(0), uint8(0), uint8(0) - for _, b := range v { - cur = cur<<8 | uint(b) - cbits += 8 - sbits += 8 - for cbits >= 8 { - idx := byte(cur >> (cbits - 8)) - n = n.children[idx] - if n == nil { - return ErrInvalidHuffman - } - if n.children == nil { - if maxLen != 0 && buf.Len() == maxLen { - return ErrStringLength - } - buf.WriteByte(n.sym) - cbits -= n.codeLen - n = rootHuffmanNode - sbits = cbits - } else { - cbits -= 8 - } - } - } - for cbits > 0 { - n = n.children[byte(cur<<(8-cbits))] - if n == nil { - return ErrInvalidHuffman - } - if n.children != nil || n.codeLen > cbits { - break - } - if maxLen != 0 && buf.Len() == maxLen { - return ErrStringLength - } - buf.WriteByte(n.sym) - cbits -= n.codeLen - n = rootHuffmanNode - sbits = cbits - } - if sbits > 7 { - // Either there was an incomplete symbol, or overlong padding. - // Both are decoding errors per RFC 7541 section 5.2. - return ErrInvalidHuffman - } - if mask := uint(1<<cbits - 1); cur&mask != mask { - // Trailing bits must be a prefix of EOS per RFC 7541 section 5.2. - return ErrInvalidHuffman - } - - return nil -} - -// incomparable is a zero-width, non-comparable type. Adding it to a struct -// makes that struct also non-comparable, and generally doesn't add -// any size (as long as it's first). -type incomparable [0]func() - -type node struct { - _ incomparable - - // children is non-nil for internal nodes - children *[256]*node - - // The following are only valid if children is nil: - codeLen uint8 // number of bits that led to the output of sym - sym byte // output symbol -} - -func newInternalNode() *node { - return &node{children: new([256]*node)} -} - -var ( - buildRootOnce sync.Once - lazyRootHuffmanNode *node -) - -func getRootHuffmanNode() *node { - buildRootOnce.Do(buildRootHuffmanNode) - return lazyRootHuffmanNode -} - -func buildRootHuffmanNode() { - if len(huffmanCodes) != 256 { - panic("unexpected size") - } - lazyRootHuffmanNode = newInternalNode() - for i, code := range huffmanCodes { - addDecoderNode(byte(i), code, huffmanCodeLen[i]) - } -} - -func addDecoderNode(sym byte, code uint32, codeLen uint8) { - cur := lazyRootHuffmanNode - for codeLen > 8 { - codeLen -= 8 - i := uint8(code >> codeLen) - if cur.children[i] == nil { - cur.children[i] = newInternalNode() - } - cur = cur.children[i] - } - shift := 8 - codeLen - start, end := int(uint8(code<<shift)), int(1<<shift) - for i := start; i < start+end; i++ { - cur.children[i] = &node{sym: sym, codeLen: codeLen} - } -} - -// AppendHuffmanString appends s, as encoded in Huffman codes, to dst -// and returns the extended buffer. -func AppendHuffmanString(dst []byte, s string) []byte { - rembits := uint8(8) - - for i := 0; i < len(s); i++ { - if rembits == 8 { - dst = append(dst, 0) - } - dst, rembits = appendByteToHuffmanCode(dst, rembits, s[i]) - } - - if rembits < 8 { - // special EOS symbol - code := uint32(0x3fffffff) - nbits := uint8(30) - - t := uint8(code >> (nbits - rembits)) - dst[len(dst)-1] |= t - } - - return dst -} - -// HuffmanEncodeLength returns the number of bytes required to encode -// s in Huffman codes. The result is round up to byte boundary. -func HuffmanEncodeLength(s string) uint64 { - n := uint64(0) - for i := 0; i < len(s); i++ { - n += uint64(huffmanCodeLen[s[i]]) - } - return (n + 7) / 8 -} - -// appendByteToHuffmanCode appends Huffman code for c to dst and -// returns the extended buffer and the remaining bits in the last -// element. The appending is not byte aligned and the remaining bits -// in the last element of dst is given in rembits. -func appendByteToHuffmanCode(dst []byte, rembits uint8, c byte) ([]byte, uint8) { - code := huffmanCodes[c] - nbits := huffmanCodeLen[c] - - for { - if rembits > nbits { - t := uint8(code << (rembits - nbits)) - dst[len(dst)-1] |= t - rembits -= nbits - break - } - - t := uint8(code >> (nbits - rembits)) - dst[len(dst)-1] |= t - - nbits -= rembits - rembits = 8 - - if nbits == 0 { - break - } - - dst = append(dst, 0) - } - - return dst, rembits -} diff --git a/vendor/golang.org/x/net/http2/hpack/tables.go b/vendor/golang.org/x/net/http2/hpack/tables.go deleted file mode 100644 index a66cfbea6..000000000 --- a/vendor/golang.org/x/net/http2/hpack/tables.go +++ /dev/null @@ -1,479 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package hpack - -import ( - "fmt" -) - -// headerFieldTable implements a list of HeaderFields. -// This is used to implement the static and dynamic tables. -type headerFieldTable struct { - // For static tables, entries are never evicted. - // - // For dynamic tables, entries are evicted from ents[0] and added to the end. - // Each entry has a unique id that starts at one and increments for each - // entry that is added. This unique id is stable across evictions, meaning - // it can be used as a pointer to a specific entry. As in hpack, unique ids - // are 1-based. The unique id for ents[k] is k + evictCount + 1. - // - // Zero is not a valid unique id. - // - // evictCount should not overflow in any remotely practical situation. In - // practice, we will have one dynamic table per HTTP/2 connection. If we - // assume a very powerful server that handles 1M QPS per connection and each - // request adds (then evicts) 100 entries from the table, it would still take - // 2M years for evictCount to overflow. - ents []HeaderField - evictCount uint64 - - // byName maps a HeaderField name to the unique id of the newest entry with - // the same name. See above for a definition of "unique id". - byName map[string]uint64 - - // byNameValue maps a HeaderField name/value pair to the unique id of the newest - // entry with the same name and value. See above for a definition of "unique id". - byNameValue map[pairNameValue]uint64 -} - -type pairNameValue struct { - name, value string -} - -func (t *headerFieldTable) init() { - t.byName = make(map[string]uint64) - t.byNameValue = make(map[pairNameValue]uint64) -} - -// len reports the number of entries in the table. -func (t *headerFieldTable) len() int { - return len(t.ents) -} - -// addEntry adds a new entry. -func (t *headerFieldTable) addEntry(f HeaderField) { - id := uint64(t.len()) + t.evictCount + 1 - t.byName[f.Name] = id - t.byNameValue[pairNameValue{f.Name, f.Value}] = id - t.ents = append(t.ents, f) -} - -// evictOldest evicts the n oldest entries in the table. -func (t *headerFieldTable) evictOldest(n int) { - if n > t.len() { - panic(fmt.Sprintf("evictOldest(%v) on table with %v entries", n, t.len())) - } - for k := 0; k < n; k++ { - f := t.ents[k] - id := t.evictCount + uint64(k) + 1 - if t.byName[f.Name] == id { - delete(t.byName, f.Name) - } - if p := (pairNameValue{f.Name, f.Value}); t.byNameValue[p] == id { - delete(t.byNameValue, p) - } - } - copy(t.ents, t.ents[n:]) - for k := t.len() - n; k < t.len(); k++ { - t.ents[k] = HeaderField{} // so strings can be garbage collected - } - t.ents = t.ents[:t.len()-n] - if t.evictCount+uint64(n) < t.evictCount { - panic("evictCount overflow") - } - t.evictCount += uint64(n) -} - -// search finds f in the table. If there is no match, i is 0. -// If both name and value match, i is the matched index and nameValueMatch -// becomes true. If only name matches, i points to that index and -// nameValueMatch becomes false. -// -// The returned index is a 1-based HPACK index. For dynamic tables, HPACK says -// that index 1 should be the newest entry, but t.ents[0] is the oldest entry, -// meaning t.ents is reversed for dynamic tables. Hence, when t is a dynamic -// table, the return value i actually refers to the entry t.ents[t.len()-i]. -// -// All tables are assumed to be a dynamic tables except for the global -// staticTable pointer. -// -// See Section 2.3.3. -func (t *headerFieldTable) search(f HeaderField) (i uint64, nameValueMatch bool) { - if !f.Sensitive { - if id := t.byNameValue[pairNameValue{f.Name, f.Value}]; id != 0 { - return t.idToIndex(id), true - } - } - if id := t.byName[f.Name]; id != 0 { - return t.idToIndex(id), false - } - return 0, false -} - -// idToIndex converts a unique id to an HPACK index. -// See Section 2.3.3. -func (t *headerFieldTable) idToIndex(id uint64) uint64 { - if id <= t.evictCount { - panic(fmt.Sprintf("id (%v) <= evictCount (%v)", id, t.evictCount)) - } - k := id - t.evictCount - 1 // convert id to an index t.ents[k] - if t != staticTable { - return uint64(t.len()) - k // dynamic table - } - return k + 1 -} - -// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B -var staticTable = newStaticTable() -var staticTableEntries = [...]HeaderField{ - {Name: ":authority"}, - {Name: ":method", Value: "GET"}, - {Name: ":method", Value: "POST"}, - {Name: ":path", Value: "/"}, - {Name: ":path", Value: "/index.html"}, - {Name: ":scheme", Value: "http"}, - {Name: ":scheme", Value: "https"}, - {Name: ":status", Value: "200"}, - {Name: ":status", Value: "204"}, - {Name: ":status", Value: "206"}, - {Name: ":status", Value: "304"}, - {Name: ":status", Value: "400"}, - {Name: ":status", Value: "404"}, - {Name: ":status", Value: "500"}, - {Name: "accept-charset"}, - {Name: "accept-encoding", Value: "gzip, deflate"}, - {Name: "accept-language"}, - {Name: "accept-ranges"}, - {Name: "accept"}, - {Name: "access-control-allow-origin"}, - {Name: "age"}, - {Name: "allow"}, - {Name: "authorization"}, - {Name: "cache-control"}, - {Name: "content-disposition"}, - {Name: "content-encoding"}, - {Name: "content-language"}, - {Name: "content-length"}, - {Name: "content-location"}, - {Name: "content-range"}, - {Name: "content-type"}, - {Name: "cookie"}, - {Name: "date"}, - {Name: "etag"}, - {Name: "expect"}, - {Name: "expires"}, - {Name: "from"}, - {Name: "host"}, - {Name: "if-match"}, - {Name: "if-modified-since"}, - {Name: "if-none-match"}, - {Name: "if-range"}, - {Name: "if-unmodified-since"}, - {Name: "last-modified"}, - {Name: "link"}, - {Name: "location"}, - {Name: "max-forwards"}, - {Name: "proxy-authenticate"}, - {Name: "proxy-authorization"}, - {Name: "range"}, - {Name: "referer"}, - {Name: "refresh"}, - {Name: "retry-after"}, - {Name: "server"}, - {Name: "set-cookie"}, - {Name: "strict-transport-security"}, - {Name: "transfer-encoding"}, - {Name: "user-agent"}, - {Name: "vary"}, - {Name: "via"}, - {Name: "www-authenticate"}, -} - -func newStaticTable() *headerFieldTable { - t := &headerFieldTable{} - t.init() - for _, e := range staticTableEntries[:] { - t.addEntry(e) - } - return t -} - -var huffmanCodes = [256]uint32{ - 0x1ff8, - 0x7fffd8, - 0xfffffe2, - 0xfffffe3, - 0xfffffe4, - 0xfffffe5, - 0xfffffe6, - 0xfffffe7, - 0xfffffe8, - 0xffffea, - 0x3ffffffc, - 0xfffffe9, - 0xfffffea, - 0x3ffffffd, - 0xfffffeb, - 0xfffffec, - 0xfffffed, - 0xfffffee, - 0xfffffef, - 0xffffff0, - 0xffffff1, - 0xffffff2, - 0x3ffffffe, - 0xffffff3, - 0xffffff4, - 0xffffff5, - 0xffffff6, - 0xffffff7, - 0xffffff8, - 0xffffff9, - 0xffffffa, - 0xffffffb, - 0x14, - 0x3f8, - 0x3f9, - 0xffa, - 0x1ff9, - 0x15, - 0xf8, - 0x7fa, - 0x3fa, - 0x3fb, - 0xf9, - 0x7fb, - 0xfa, - 0x16, - 0x17, - 0x18, - 0x0, - 0x1, - 0x2, - 0x19, - 0x1a, - 0x1b, - 0x1c, - 0x1d, - 0x1e, - 0x1f, - 0x5c, - 0xfb, - 0x7ffc, - 0x20, - 0xffb, - 0x3fc, - 0x1ffa, - 0x21, - 0x5d, - 0x5e, - 0x5f, - 0x60, - 0x61, - 0x62, - 0x63, - 0x64, - 0x65, - 0x66, - 0x67, - 0x68, - 0x69, - 0x6a, - 0x6b, - 0x6c, - 0x6d, - 0x6e, - 0x6f, - 0x70, - 0x71, - 0x72, - 0xfc, - 0x73, - 0xfd, - 0x1ffb, - 0x7fff0, - 0x1ffc, - 0x3ffc, - 0x22, - 0x7ffd, - 0x3, - 0x23, - 0x4, - 0x24, - 0x5, - 0x25, - 0x26, - 0x27, - 0x6, - 0x74, - 0x75, - 0x28, - 0x29, - 0x2a, - 0x7, - 0x2b, - 0x76, - 0x2c, - 0x8, - 0x9, - 0x2d, - 0x77, - 0x78, - 0x79, - 0x7a, - 0x7b, - 0x7ffe, - 0x7fc, - 0x3ffd, - 0x1ffd, - 0xffffffc, - 0xfffe6, - 0x3fffd2, - 0xfffe7, - 0xfffe8, - 0x3fffd3, - 0x3fffd4, - 0x3fffd5, - 0x7fffd9, - 0x3fffd6, - 0x7fffda, - 0x7fffdb, - 0x7fffdc, - 0x7fffdd, - 0x7fffde, - 0xffffeb, - 0x7fffdf, - 0xffffec, - 0xffffed, - 0x3fffd7, - 0x7fffe0, - 0xffffee, - 0x7fffe1, - 0x7fffe2, - 0x7fffe3, - 0x7fffe4, - 0x1fffdc, - 0x3fffd8, - 0x7fffe5, - 0x3fffd9, - 0x7fffe6, - 0x7fffe7, - 0xffffef, - 0x3fffda, - 0x1fffdd, - 0xfffe9, - 0x3fffdb, - 0x3fffdc, - 0x7fffe8, - 0x7fffe9, - 0x1fffde, - 0x7fffea, - 0x3fffdd, - 0x3fffde, - 0xfffff0, - 0x1fffdf, - 0x3fffdf, - 0x7fffeb, - 0x7fffec, - 0x1fffe0, - 0x1fffe1, - 0x3fffe0, - 0x1fffe2, - 0x7fffed, - 0x3fffe1, - 0x7fffee, - 0x7fffef, - 0xfffea, - 0x3fffe2, - 0x3fffe3, - 0x3fffe4, - 0x7ffff0, - 0x3fffe5, - 0x3fffe6, - 0x7ffff1, - 0x3ffffe0, - 0x3ffffe1, - 0xfffeb, - 0x7fff1, - 0x3fffe7, - 0x7ffff2, - 0x3fffe8, - 0x1ffffec, - 0x3ffffe2, - 0x3ffffe3, - 0x3ffffe4, - 0x7ffffde, - 0x7ffffdf, - 0x3ffffe5, - 0xfffff1, - 0x1ffffed, - 0x7fff2, - 0x1fffe3, - 0x3ffffe6, - 0x7ffffe0, - 0x7ffffe1, - 0x3ffffe7, - 0x7ffffe2, - 0xfffff2, - 0x1fffe4, - 0x1fffe5, - 0x3ffffe8, - 0x3ffffe9, - 0xffffffd, - 0x7ffffe3, - 0x7ffffe4, - 0x7ffffe5, - 0xfffec, - 0xfffff3, - 0xfffed, - 0x1fffe6, - 0x3fffe9, - 0x1fffe7, - 0x1fffe8, - 0x7ffff3, - 0x3fffea, - 0x3fffeb, - 0x1ffffee, - 0x1ffffef, - 0xfffff4, - 0xfffff5, - 0x3ffffea, - 0x7ffff4, - 0x3ffffeb, - 0x7ffffe6, - 0x3ffffec, - 0x3ffffed, - 0x7ffffe7, - 0x7ffffe8, - 0x7ffffe9, - 0x7ffffea, - 0x7ffffeb, - 0xffffffe, - 0x7ffffec, - 0x7ffffed, - 0x7ffffee, - 0x7ffffef, - 0x7fffff0, - 0x3ffffee, -} - -var huffmanCodeLen = [256]uint8{ - 13, 23, 28, 28, 28, 28, 28, 28, 28, 24, 30, 28, 28, 30, 28, 28, - 28, 28, 28, 28, 28, 28, 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 6, 10, 10, 12, 13, 6, 8, 11, 10, 10, 8, 11, 8, 6, 6, 6, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, 15, 6, 12, 10, - 13, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 13, 19, 13, 14, 6, - 15, 5, 6, 5, 6, 5, 6, 6, 6, 5, 7, 7, 6, 6, 6, 5, - 6, 7, 6, 5, 5, 6, 7, 7, 7, 7, 7, 15, 11, 14, 13, 28, - 20, 22, 20, 20, 22, 22, 22, 23, 22, 23, 23, 23, 23, 23, 24, 23, - 24, 24, 22, 23, 24, 23, 23, 23, 23, 21, 22, 23, 22, 23, 23, 24, - 22, 21, 20, 22, 22, 23, 23, 21, 23, 22, 22, 24, 21, 22, 23, 23, - 21, 21, 22, 21, 23, 22, 23, 23, 20, 22, 22, 22, 23, 22, 22, 23, - 26, 26, 20, 19, 22, 23, 22, 25, 26, 26, 26, 27, 27, 26, 24, 25, - 19, 21, 26, 27, 27, 26, 27, 24, 21, 21, 26, 26, 28, 27, 27, 27, - 20, 24, 20, 21, 22, 21, 21, 23, 22, 22, 25, 25, 24, 24, 26, 23, - 26, 27, 26, 26, 27, 27, 27, 27, 27, 28, 27, 27, 27, 27, 27, 26, -} diff --git a/vendor/golang.org/x/net/http2/http2.go b/vendor/golang.org/x/net/http2/http2.go deleted file mode 100644 index 5571ccfd2..000000000 --- a/vendor/golang.org/x/net/http2/http2.go +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package http2 implements the HTTP/2 protocol. -// -// This package is low-level and intended to be used directly by very -// few people. Most users will use it indirectly through the automatic -// use by the net/http package (from Go 1.6 and later). -// For use in earlier Go versions see ConfigureServer. (Transport support -// requires Go 1.6 or later) -// -// See https://http2.github.io/ for more information on HTTP/2. -// -// See https://http2.golang.org/ for a test server running this code. -// -package http2 // import "golang.org/x/net/http2" - -import ( - "bufio" - "crypto/tls" - "fmt" - "io" - "net/http" - "os" - "sort" - "strconv" - "strings" - "sync" - - "golang.org/x/net/http/httpguts" -) - -var ( - VerboseLogs bool - logFrameWrites bool - logFrameReads bool - inTests bool -) - -func init() { - e := os.Getenv("GODEBUG") - if strings.Contains(e, "http2debug=1") { - VerboseLogs = true - } - if strings.Contains(e, "http2debug=2") { - VerboseLogs = true - logFrameWrites = true - logFrameReads = true - } -} - -const ( - // ClientPreface is the string that must be sent by new - // connections from clients. - ClientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" - - // SETTINGS_MAX_FRAME_SIZE default - // http://http2.github.io/http2-spec/#rfc.section.6.5.2 - initialMaxFrameSize = 16384 - - // NextProtoTLS is the NPN/ALPN protocol negotiated during - // HTTP/2's TLS setup. - NextProtoTLS = "h2" - - // http://http2.github.io/http2-spec/#SettingValues - initialHeaderTableSize = 4096 - - initialWindowSize = 65535 // 6.9.2 Initial Flow Control Window Size - - defaultMaxReadFrameSize = 1 << 20 -) - -var ( - clientPreface = []byte(ClientPreface) -) - -type streamState int - -// HTTP/2 stream states. -// -// See http://tools.ietf.org/html/rfc7540#section-5.1. -// -// For simplicity, the server code merges "reserved (local)" into -// "half-closed (remote)". This is one less state transition to track. -// The only downside is that we send PUSH_PROMISEs slightly less -// liberally than allowable. More discussion here: -// https://lists.w3.org/Archives/Public/ietf-http-wg/2016JulSep/0599.html -// -// "reserved (remote)" is omitted since the client code does not -// support server push. -const ( - stateIdle streamState = iota - stateOpen - stateHalfClosedLocal - stateHalfClosedRemote - stateClosed -) - -var stateName = [...]string{ - stateIdle: "Idle", - stateOpen: "Open", - stateHalfClosedLocal: "HalfClosedLocal", - stateHalfClosedRemote: "HalfClosedRemote", - stateClosed: "Closed", -} - -func (st streamState) String() string { - return stateName[st] -} - -// Setting is a setting parameter: which setting it is, and its value. -type Setting struct { - // ID is which setting is being set. - // See http://http2.github.io/http2-spec/#SettingValues - ID SettingID - - // Val is the value. - Val uint32 -} - -func (s Setting) String() string { - return fmt.Sprintf("[%v = %d]", s.ID, s.Val) -} - -// Valid reports whether the setting is valid. -func (s Setting) Valid() error { - // Limits and error codes from 6.5.2 Defined SETTINGS Parameters - switch s.ID { - case SettingEnablePush: - if s.Val != 1 && s.Val != 0 { - return ConnectionError(ErrCodeProtocol) - } - case SettingInitialWindowSize: - if s.Val > 1<<31-1 { - return ConnectionError(ErrCodeFlowControl) - } - case SettingMaxFrameSize: - if s.Val < 16384 || s.Val > 1<<24-1 { - return ConnectionError(ErrCodeProtocol) - } - } - return nil -} - -// A SettingID is an HTTP/2 setting as defined in -// http://http2.github.io/http2-spec/#iana-settings -type SettingID uint16 - -const ( - SettingHeaderTableSize SettingID = 0x1 - SettingEnablePush SettingID = 0x2 - SettingMaxConcurrentStreams SettingID = 0x3 - SettingInitialWindowSize SettingID = 0x4 - SettingMaxFrameSize SettingID = 0x5 - SettingMaxHeaderListSize SettingID = 0x6 -) - -var settingName = map[SettingID]string{ - SettingHeaderTableSize: "HEADER_TABLE_SIZE", - SettingEnablePush: "ENABLE_PUSH", - SettingMaxConcurrentStreams: "MAX_CONCURRENT_STREAMS", - SettingInitialWindowSize: "INITIAL_WINDOW_SIZE", - SettingMaxFrameSize: "MAX_FRAME_SIZE", - SettingMaxHeaderListSize: "MAX_HEADER_LIST_SIZE", -} - -func (s SettingID) String() string { - if v, ok := settingName[s]; ok { - return v - } - return fmt.Sprintf("UNKNOWN_SETTING_%d", uint16(s)) -} - -// validWireHeaderFieldName reports whether v is a valid header field -// name (key). See httpguts.ValidHeaderName for the base rules. -// -// Further, http2 says: -// "Just as in HTTP/1.x, header field names are strings of ASCII -// characters that are compared in a case-insensitive -// fashion. However, header field names MUST be converted to -// lowercase prior to their encoding in HTTP/2. " -func validWireHeaderFieldName(v string) bool { - if len(v) == 0 { - return false - } - for _, r := range v { - if !httpguts.IsTokenRune(r) { - return false - } - if 'A' <= r && r <= 'Z' { - return false - } - } - return true -} - -func httpCodeString(code int) string { - switch code { - case 200: - return "200" - case 404: - return "404" - } - return strconv.Itoa(code) -} - -// from pkg io -type stringWriter interface { - WriteString(s string) (n int, err error) -} - -// A gate lets two goroutines coordinate their activities. -type gate chan struct{} - -func (g gate) Done() { g <- struct{}{} } -func (g gate) Wait() { <-g } - -// A closeWaiter is like a sync.WaitGroup but only goes 1 to 0 (open to closed). -type closeWaiter chan struct{} - -// Init makes a closeWaiter usable. -// It exists because so a closeWaiter value can be placed inside a -// larger struct and have the Mutex and Cond's memory in the same -// allocation. -func (cw *closeWaiter) Init() { - *cw = make(chan struct{}) -} - -// Close marks the closeWaiter as closed and unblocks any waiters. -func (cw closeWaiter) Close() { - close(cw) -} - -// Wait waits for the closeWaiter to become closed. -func (cw closeWaiter) Wait() { - <-cw -} - -// bufferedWriter is a buffered writer that writes to w. -// Its buffered writer is lazily allocated as needed, to minimize -// idle memory usage with many connections. -type bufferedWriter struct { - _ incomparable - w io.Writer // immutable - bw *bufio.Writer // non-nil when data is buffered -} - -func newBufferedWriter(w io.Writer) *bufferedWriter { - return &bufferedWriter{w: w} -} - -// bufWriterPoolBufferSize is the size of bufio.Writer's -// buffers created using bufWriterPool. -// -// TODO: pick a less arbitrary value? this is a bit under -// (3 x typical 1500 byte MTU) at least. Other than that, -// not much thought went into it. -const bufWriterPoolBufferSize = 4 << 10 - -var bufWriterPool = sync.Pool{ - New: func() interface{} { - return bufio.NewWriterSize(nil, bufWriterPoolBufferSize) - }, -} - -func (w *bufferedWriter) Available() int { - if w.bw == nil { - return bufWriterPoolBufferSize - } - return w.bw.Available() -} - -func (w *bufferedWriter) Write(p []byte) (n int, err error) { - if w.bw == nil { - bw := bufWriterPool.Get().(*bufio.Writer) - bw.Reset(w.w) - w.bw = bw - } - return w.bw.Write(p) -} - -func (w *bufferedWriter) Flush() error { - bw := w.bw - if bw == nil { - return nil - } - err := bw.Flush() - bw.Reset(nil) - bufWriterPool.Put(bw) - w.bw = nil - return err -} - -func mustUint31(v int32) uint32 { - if v < 0 || v > 2147483647 { - panic("out of range") - } - return uint32(v) -} - -// bodyAllowedForStatus reports whether a given response status code -// permits a body. See RFC 7230, section 3.3. -func bodyAllowedForStatus(status int) bool { - switch { - case status >= 100 && status <= 199: - return false - case status == 204: - return false - case status == 304: - return false - } - return true -} - -type httpError struct { - _ incomparable - msg string - timeout bool -} - -func (e *httpError) Error() string { return e.msg } -func (e *httpError) Timeout() bool { return e.timeout } -func (e *httpError) Temporary() bool { return true } - -var errTimeout error = &httpError{msg: "http2: timeout awaiting response headers", timeout: true} - -type connectionStater interface { - ConnectionState() tls.ConnectionState -} - -var sorterPool = sync.Pool{New: func() interface{} { return new(sorter) }} - -type sorter struct { - v []string // owned by sorter -} - -func (s *sorter) Len() int { return len(s.v) } -func (s *sorter) Swap(i, j int) { s.v[i], s.v[j] = s.v[j], s.v[i] } -func (s *sorter) Less(i, j int) bool { return s.v[i] < s.v[j] } - -// Keys returns the sorted keys of h. -// -// The returned slice is only valid until s used again or returned to -// its pool. -func (s *sorter) Keys(h http.Header) []string { - keys := s.v[:0] - for k := range h { - keys = append(keys, k) - } - s.v = keys - sort.Sort(s) - return keys -} - -func (s *sorter) SortStrings(ss []string) { - // Our sorter works on s.v, which sorter owns, so - // stash it away while we sort the user's buffer. - save := s.v - s.v = ss - sort.Sort(s) - s.v = save -} - -// validPseudoPath reports whether v is a valid :path pseudo-header -// value. It must be either: -// -// *) a non-empty string starting with '/' -// *) the string '*', for OPTIONS requests. -// -// For now this is only used a quick check for deciding when to clean -// up Opaque URLs before sending requests from the Transport. -// See golang.org/issue/16847 -// -// We used to enforce that the path also didn't start with "//", but -// Google's GFE accepts such paths and Chrome sends them, so ignore -// that part of the spec. See golang.org/issue/19103. -func validPseudoPath(v string) bool { - return (len(v) > 0 && v[0] == '/') || v == "*" -} - -// incomparable is a zero-width, non-comparable type. Adding it to a struct -// makes that struct also non-comparable, and generally doesn't add -// any size (as long as it's first). -type incomparable [0]func() diff --git a/vendor/golang.org/x/net/http2/not_go111.go b/vendor/golang.org/x/net/http2/not_go111.go deleted file mode 100644 index 161bca7ce..000000000 --- a/vendor/golang.org/x/net/http2/not_go111.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.11 - -package http2 - -import ( - "net/http/httptrace" - "net/textproto" -) - -func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false } - -func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {} - -func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { - return nil -} diff --git a/vendor/golang.org/x/net/http2/pipe.go b/vendor/golang.org/x/net/http2/pipe.go deleted file mode 100644 index 2a5399ec4..000000000 --- a/vendor/golang.org/x/net/http2/pipe.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "errors" - "io" - "sync" -) - -// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like -// io.Pipe except there are no PipeReader/PipeWriter halves, and the -// underlying buffer is an interface. (io.Pipe is always unbuffered) -type pipe struct { - mu sync.Mutex - c sync.Cond // c.L lazily initialized to &p.mu - b pipeBuffer // nil when done reading - unread int // bytes unread when done - err error // read error once empty. non-nil means closed. - breakErr error // immediate read error (caller doesn't see rest of b) - donec chan struct{} // closed on error - readFn func() // optional code to run in Read before error -} - -type pipeBuffer interface { - Len() int - io.Writer - io.Reader -} - -func (p *pipe) Len() int { - p.mu.Lock() - defer p.mu.Unlock() - if p.b == nil { - return p.unread - } - return p.b.Len() -} - -// Read waits until data is available and copies bytes -// from the buffer into p. -func (p *pipe) Read(d []byte) (n int, err error) { - p.mu.Lock() - defer p.mu.Unlock() - if p.c.L == nil { - p.c.L = &p.mu - } - for { - if p.breakErr != nil { - return 0, p.breakErr - } - if p.b != nil && p.b.Len() > 0 { - return p.b.Read(d) - } - if p.err != nil { - if p.readFn != nil { - p.readFn() // e.g. copy trailers - p.readFn = nil // not sticky like p.err - } - p.b = nil - return 0, p.err - } - p.c.Wait() - } -} - -var errClosedPipeWrite = errors.New("write on closed buffer") - -// Write copies bytes from p into the buffer and wakes a reader. -// It is an error to write more data than the buffer can hold. -func (p *pipe) Write(d []byte) (n int, err error) { - p.mu.Lock() - defer p.mu.Unlock() - if p.c.L == nil { - p.c.L = &p.mu - } - defer p.c.Signal() - if p.err != nil { - return 0, errClosedPipeWrite - } - if p.breakErr != nil { - p.unread += len(d) - return len(d), nil // discard when there is no reader - } - return p.b.Write(d) -} - -// CloseWithError causes the next Read (waking up a current blocked -// Read if needed) to return the provided err after all data has been -// read. -// -// The error must be non-nil. -func (p *pipe) CloseWithError(err error) { p.closeWithError(&p.err, err, nil) } - -// BreakWithError causes the next Read (waking up a current blocked -// Read if needed) to return the provided err immediately, without -// waiting for unread data. -func (p *pipe) BreakWithError(err error) { p.closeWithError(&p.breakErr, err, nil) } - -// closeWithErrorAndCode is like CloseWithError but also sets some code to run -// in the caller's goroutine before returning the error. -func (p *pipe) closeWithErrorAndCode(err error, fn func()) { p.closeWithError(&p.err, err, fn) } - -func (p *pipe) closeWithError(dst *error, err error, fn func()) { - if err == nil { - panic("err must be non-nil") - } - p.mu.Lock() - defer p.mu.Unlock() - if p.c.L == nil { - p.c.L = &p.mu - } - defer p.c.Signal() - if *dst != nil { - // Already been done. - return - } - p.readFn = fn - if dst == &p.breakErr { - if p.b != nil { - p.unread += p.b.Len() - } - p.b = nil - } - *dst = err - p.closeDoneLocked() -} - -// requires p.mu be held. -func (p *pipe) closeDoneLocked() { - if p.donec == nil { - return - } - // Close if unclosed. This isn't racy since we always - // hold p.mu while closing. - select { - case <-p.donec: - default: - close(p.donec) - } -} - -// Err returns the error (if any) first set by BreakWithError or CloseWithError. -func (p *pipe) Err() error { - p.mu.Lock() - defer p.mu.Unlock() - if p.breakErr != nil { - return p.breakErr - } - return p.err -} - -// Done returns a channel which is closed if and when this pipe is closed -// with CloseWithError. -func (p *pipe) Done() <-chan struct{} { - p.mu.Lock() - defer p.mu.Unlock() - if p.donec == nil { - p.donec = make(chan struct{}) - if p.err != nil || p.breakErr != nil { - // Already hit an error. - p.closeDoneLocked() - } - } - return p.donec -} diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go deleted file mode 100644 index 345b7cd85..000000000 --- a/vendor/golang.org/x/net/http2/server.go +++ /dev/null @@ -1,2964 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// TODO: turn off the serve goroutine when idle, so -// an idle conn only has the readFrames goroutine active. (which could -// also be optimized probably to pin less memory in crypto/tls). This -// would involve tracking when the serve goroutine is active (atomic -// int32 read/CAS probably?) and starting it up when frames arrive, -// and shutting it down when all handlers exit. the occasional PING -// packets could use time.AfterFunc to call sc.wakeStartServeLoop() -// (which is a no-op if already running) and then queue the PING write -// as normal. The serve loop would then exit in most cases (if no -// Handlers running) and not be woken up again until the PING packet -// returns. - -// TODO (maybe): add a mechanism for Handlers to going into -// half-closed-local mode (rw.(io.Closer) test?) but not exit their -// handler, and continue to be able to read from the -// Request.Body. This would be a somewhat semantic change from HTTP/1 -// (or at least what we expose in net/http), so I'd probably want to -// add it there too. For now, this package says that returning from -// the Handler ServeHTTP function means you're both done reading and -// done writing, without a way to stop just one or the other. - -package http2 - -import ( - "bufio" - "bytes" - "context" - "crypto/tls" - "errors" - "fmt" - "io" - "log" - "math" - "net" - "net/http" - "net/textproto" - "net/url" - "os" - "reflect" - "runtime" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/net/http/httpguts" - "golang.org/x/net/http2/hpack" -) - -const ( - prefaceTimeout = 10 * time.Second - firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway - handlerChunkWriteSize = 4 << 10 - defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to? - maxQueuedControlFrames = 10000 -) - -var ( - errClientDisconnected = errors.New("client disconnected") - errClosedBody = errors.New("body closed by handler") - errHandlerComplete = errors.New("http2: request body closed due to handler exiting") - errStreamClosed = errors.New("http2: stream closed") -) - -var responseWriterStatePool = sync.Pool{ - New: func() interface{} { - rws := &responseWriterState{} - rws.bw = bufio.NewWriterSize(chunkWriter{rws}, handlerChunkWriteSize) - return rws - }, -} - -// Test hooks. -var ( - testHookOnConn func() - testHookGetServerConn func(*serverConn) - testHookOnPanicMu *sync.Mutex // nil except in tests - testHookOnPanic func(sc *serverConn, panicVal interface{}) (rePanic bool) -) - -// Server is an HTTP/2 server. -type Server struct { - // MaxHandlers limits the number of http.Handler ServeHTTP goroutines - // which may run at a time over all connections. - // Negative or zero no limit. - // TODO: implement - MaxHandlers int - - // MaxConcurrentStreams optionally specifies the number of - // concurrent streams that each client may have open at a - // time. This is unrelated to the number of http.Handler goroutines - // which may be active globally, which is MaxHandlers. - // If zero, MaxConcurrentStreams defaults to at least 100, per - // the HTTP/2 spec's recommendations. - MaxConcurrentStreams uint32 - - // MaxReadFrameSize optionally specifies the largest frame - // this server is willing to read. A valid value is between - // 16k and 16M, inclusive. If zero or otherwise invalid, a - // default value is used. - MaxReadFrameSize uint32 - - // PermitProhibitedCipherSuites, if true, permits the use of - // cipher suites prohibited by the HTTP/2 spec. - PermitProhibitedCipherSuites bool - - // IdleTimeout specifies how long until idle clients should be - // closed with a GOAWAY frame. PING frames are not considered - // activity for the purposes of IdleTimeout. - IdleTimeout time.Duration - - // MaxUploadBufferPerConnection is the size of the initial flow - // control window for each connections. The HTTP/2 spec does not - // allow this to be smaller than 65535 or larger than 2^32-1. - // If the value is outside this range, a default value will be - // used instead. - MaxUploadBufferPerConnection int32 - - // MaxUploadBufferPerStream is the size of the initial flow control - // window for each stream. The HTTP/2 spec does not allow this to - // be larger than 2^32-1. If the value is zero or larger than the - // maximum, a default value will be used instead. - MaxUploadBufferPerStream int32 - - // NewWriteScheduler constructs a write scheduler for a connection. - // If nil, a default scheduler is chosen. - NewWriteScheduler func() WriteScheduler - - // Internal state. This is a pointer (rather than embedded directly) - // so that we don't embed a Mutex in this struct, which will make the - // struct non-copyable, which might break some callers. - state *serverInternalState -} - -func (s *Server) initialConnRecvWindowSize() int32 { - if s.MaxUploadBufferPerConnection > initialWindowSize { - return s.MaxUploadBufferPerConnection - } - return 1 << 20 -} - -func (s *Server) initialStreamRecvWindowSize() int32 { - if s.MaxUploadBufferPerStream > 0 { - return s.MaxUploadBufferPerStream - } - return 1 << 20 -} - -func (s *Server) maxReadFrameSize() uint32 { - if v := s.MaxReadFrameSize; v >= minMaxFrameSize && v <= maxFrameSize { - return v - } - return defaultMaxReadFrameSize -} - -func (s *Server) maxConcurrentStreams() uint32 { - if v := s.MaxConcurrentStreams; v > 0 { - return v - } - return defaultMaxStreams -} - -// maxQueuedControlFrames is the maximum number of control frames like -// SETTINGS, PING and RST_STREAM that will be queued for writing before -// the connection is closed to prevent memory exhaustion attacks. -func (s *Server) maxQueuedControlFrames() int { - // TODO: if anybody asks, add a Server field, and remember to define the - // behavior of negative values. - return maxQueuedControlFrames -} - -type serverInternalState struct { - mu sync.Mutex - activeConns map[*serverConn]struct{} -} - -func (s *serverInternalState) registerConn(sc *serverConn) { - if s == nil { - return // if the Server was used without calling ConfigureServer - } - s.mu.Lock() - s.activeConns[sc] = struct{}{} - s.mu.Unlock() -} - -func (s *serverInternalState) unregisterConn(sc *serverConn) { - if s == nil { - return // if the Server was used without calling ConfigureServer - } - s.mu.Lock() - delete(s.activeConns, sc) - s.mu.Unlock() -} - -func (s *serverInternalState) startGracefulShutdown() { - if s == nil { - return // if the Server was used without calling ConfigureServer - } - s.mu.Lock() - for sc := range s.activeConns { - sc.startGracefulShutdown() - } - s.mu.Unlock() -} - -// ConfigureServer adds HTTP/2 support to a net/http Server. -// -// The configuration conf may be nil. -// -// ConfigureServer must be called before s begins serving. -func ConfigureServer(s *http.Server, conf *Server) error { - if s == nil { - panic("nil *http.Server") - } - if conf == nil { - conf = new(Server) - } - conf.state = &serverInternalState{activeConns: make(map[*serverConn]struct{})} - if h1, h2 := s, conf; h2.IdleTimeout == 0 { - if h1.IdleTimeout != 0 { - h2.IdleTimeout = h1.IdleTimeout - } else { - h2.IdleTimeout = h1.ReadTimeout - } - } - s.RegisterOnShutdown(conf.state.startGracefulShutdown) - - if s.TLSConfig == nil { - s.TLSConfig = new(tls.Config) - } else if s.TLSConfig.CipherSuites != nil { - // If they already provided a CipherSuite list, return - // an error if it has a bad order or is missing - // ECDHE_RSA_WITH_AES_128_GCM_SHA256 or ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. - haveRequired := false - sawBad := false - for i, cs := range s.TLSConfig.CipherSuites { - switch cs { - case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - // Alternative MTI cipher to not discourage ECDSA-only servers. - // See http://golang.org/cl/30721 for further information. - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: - haveRequired = true - } - if isBadCipher(cs) { - sawBad = true - } else if sawBad { - return fmt.Errorf("http2: TLSConfig.CipherSuites index %d contains an HTTP/2-approved cipher suite (%#04x), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.", i, cs) - } - } - if !haveRequired { - return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 or TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).") - } - } - - // Note: not setting MinVersion to tls.VersionTLS12, - // as we don't want to interfere with HTTP/1.1 traffic - // on the user's server. We enforce TLS 1.2 later once - // we accept a connection. Ideally this should be done - // during next-proto selection, but using TLS <1.2 with - // HTTP/2 is still the client's bug. - - s.TLSConfig.PreferServerCipherSuites = true - - haveNPN := false - for _, p := range s.TLSConfig.NextProtos { - if p == NextProtoTLS { - haveNPN = true - break - } - } - if !haveNPN { - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) - } - - if s.TLSNextProto == nil { - s.TLSNextProto = map[string]func(*http.Server, *tls.Conn, http.Handler){} - } - protoHandler := func(hs *http.Server, c *tls.Conn, h http.Handler) { - if testHookOnConn != nil { - testHookOnConn() - } - // The TLSNextProto interface predates contexts, so - // the net/http package passes down its per-connection - // base context via an exported but unadvertised - // method on the Handler. This is for internal - // net/http<=>http2 use only. - var ctx context.Context - type baseContexter interface { - BaseContext() context.Context - } - if bc, ok := h.(baseContexter); ok { - ctx = bc.BaseContext() - } - conf.ServeConn(c, &ServeConnOpts{ - Context: ctx, - Handler: h, - BaseConfig: hs, - }) - } - s.TLSNextProto[NextProtoTLS] = protoHandler - return nil -} - -// ServeConnOpts are options for the Server.ServeConn method. -type ServeConnOpts struct { - // Context is the base context to use. - // If nil, context.Background is used. - Context context.Context - - // BaseConfig optionally sets the base configuration - // for values. If nil, defaults are used. - BaseConfig *http.Server - - // Handler specifies which handler to use for processing - // requests. If nil, BaseConfig.Handler is used. If BaseConfig - // or BaseConfig.Handler is nil, http.DefaultServeMux is used. - Handler http.Handler -} - -func (o *ServeConnOpts) context() context.Context { - if o != nil && o.Context != nil { - return o.Context - } - return context.Background() -} - -func (o *ServeConnOpts) baseConfig() *http.Server { - if o != nil && o.BaseConfig != nil { - return o.BaseConfig - } - return new(http.Server) -} - -func (o *ServeConnOpts) handler() http.Handler { - if o != nil { - if o.Handler != nil { - return o.Handler - } - if o.BaseConfig != nil && o.BaseConfig.Handler != nil { - return o.BaseConfig.Handler - } - } - return http.DefaultServeMux -} - -// ServeConn serves HTTP/2 requests on the provided connection and -// blocks until the connection is no longer readable. -// -// ServeConn starts speaking HTTP/2 assuming that c has not had any -// reads or writes. It writes its initial settings frame and expects -// to be able to read the preface and settings frame from the -// client. If c has a ConnectionState method like a *tls.Conn, the -// ConnectionState is used to verify the TLS ciphersuite and to set -// the Request.TLS field in Handlers. -// -// ServeConn does not support h2c by itself. Any h2c support must be -// implemented in terms of providing a suitably-behaving net.Conn. -// -// The opts parameter is optional. If nil, default values are used. -func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { - baseCtx, cancel := serverConnBaseContext(c, opts) - defer cancel() - - sc := &serverConn{ - srv: s, - hs: opts.baseConfig(), - conn: c, - baseCtx: baseCtx, - remoteAddrStr: c.RemoteAddr().String(), - bw: newBufferedWriter(c), - handler: opts.handler(), - streams: make(map[uint32]*stream), - readFrameCh: make(chan readFrameResult), - wantWriteFrameCh: make(chan FrameWriteRequest, 8), - serveMsgCh: make(chan interface{}, 8), - wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync - bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way - doneServing: make(chan struct{}), - clientMaxStreams: math.MaxUint32, // Section 6.5.2: "Initially, there is no limit to this value" - advMaxStreams: s.maxConcurrentStreams(), - initialStreamSendWindowSize: initialWindowSize, - maxFrameSize: initialMaxFrameSize, - headerTableSize: initialHeaderTableSize, - serveG: newGoroutineLock(), - pushEnabled: true, - } - - s.state.registerConn(sc) - defer s.state.unregisterConn(sc) - - // The net/http package sets the write deadline from the - // http.Server.WriteTimeout during the TLS handshake, but then - // passes the connection off to us with the deadline already set. - // Write deadlines are set per stream in serverConn.newStream. - // Disarm the net.Conn write deadline here. - if sc.hs.WriteTimeout != 0 { - sc.conn.SetWriteDeadline(time.Time{}) - } - - if s.NewWriteScheduler != nil { - sc.writeSched = s.NewWriteScheduler() - } else { - sc.writeSched = NewRandomWriteScheduler() - } - - // These start at the RFC-specified defaults. If there is a higher - // configured value for inflow, that will be updated when we send a - // WINDOW_UPDATE shortly after sending SETTINGS. - sc.flow.add(initialWindowSize) - sc.inflow.add(initialWindowSize) - sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf) - - fr := NewFramer(sc.bw, c) - fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) - fr.MaxHeaderListSize = sc.maxHeaderListSize() - fr.SetMaxReadFrameSize(s.maxReadFrameSize()) - sc.framer = fr - - if tc, ok := c.(connectionStater); ok { - sc.tlsState = new(tls.ConnectionState) - *sc.tlsState = tc.ConnectionState() - // 9.2 Use of TLS Features - // An implementation of HTTP/2 over TLS MUST use TLS - // 1.2 or higher with the restrictions on feature set - // and cipher suite described in this section. Due to - // implementation limitations, it might not be - // possible to fail TLS negotiation. An endpoint MUST - // immediately terminate an HTTP/2 connection that - // does not meet the TLS requirements described in - // this section with a connection error (Section - // 5.4.1) of type INADEQUATE_SECURITY. - if sc.tlsState.Version < tls.VersionTLS12 { - sc.rejectConn(ErrCodeInadequateSecurity, "TLS version too low") - return - } - - if sc.tlsState.ServerName == "" { - // Client must use SNI, but we don't enforce that anymore, - // since it was causing problems when connecting to bare IP - // addresses during development. - // - // TODO: optionally enforce? Or enforce at the time we receive - // a new request, and verify the ServerName matches the :authority? - // But that precludes proxy situations, perhaps. - // - // So for now, do nothing here again. - } - - if !s.PermitProhibitedCipherSuites && isBadCipher(sc.tlsState.CipherSuite) { - // "Endpoints MAY choose to generate a connection error - // (Section 5.4.1) of type INADEQUATE_SECURITY if one of - // the prohibited cipher suites are negotiated." - // - // We choose that. In my opinion, the spec is weak - // here. It also says both parties must support at least - // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 so there's no - // excuses here. If we really must, we could allow an - // "AllowInsecureWeakCiphers" option on the server later. - // Let's see how it plays out first. - sc.rejectConn(ErrCodeInadequateSecurity, fmt.Sprintf("Prohibited TLS 1.2 Cipher Suite: %x", sc.tlsState.CipherSuite)) - return - } - } - - if hook := testHookGetServerConn; hook != nil { - hook(sc) - } - sc.serve() -} - -func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx context.Context, cancel func()) { - ctx, cancel = context.WithCancel(opts.context()) - ctx = context.WithValue(ctx, http.LocalAddrContextKey, c.LocalAddr()) - if hs := opts.baseConfig(); hs != nil { - ctx = context.WithValue(ctx, http.ServerContextKey, hs) - } - return -} - -func (sc *serverConn) rejectConn(err ErrCode, debug string) { - sc.vlogf("http2: server rejecting conn: %v, %s", err, debug) - // ignoring errors. hanging up anyway. - sc.framer.WriteGoAway(0, err, []byte(debug)) - sc.bw.Flush() - sc.conn.Close() -} - -type serverConn struct { - // Immutable: - srv *Server - hs *http.Server - conn net.Conn - bw *bufferedWriter // writing to conn - handler http.Handler - baseCtx context.Context - framer *Framer - doneServing chan struct{} // closed when serverConn.serve ends - readFrameCh chan readFrameResult // written by serverConn.readFrames - wantWriteFrameCh chan FrameWriteRequest // from handlers -> serve - wroteFrameCh chan frameWriteResult // from writeFrameAsync -> serve, tickles more frame writes - bodyReadCh chan bodyReadMsg // from handlers -> serve - serveMsgCh chan interface{} // misc messages & code to send to / run on the serve loop - flow flow // conn-wide (not stream-specific) outbound flow control - inflow flow // conn-wide inbound flow control - tlsState *tls.ConnectionState // shared by all handlers, like net/http - remoteAddrStr string - writeSched WriteScheduler - - // Everything following is owned by the serve loop; use serveG.check(): - serveG goroutineLock // used to verify funcs are on serve() - pushEnabled bool - sawFirstSettings bool // got the initial SETTINGS frame after the preface - needToSendSettingsAck bool - unackedSettings int // how many SETTINGS have we sent without ACKs? - queuedControlFrames int // control frames in the writeSched queue - clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit) - advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client - curClientStreams uint32 // number of open streams initiated by the client - curPushedStreams uint32 // number of open streams initiated by server push - maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests - maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes - streams map[uint32]*stream - initialStreamSendWindowSize int32 - maxFrameSize int32 - headerTableSize uint32 - peerMaxHeaderListSize uint32 // zero means unknown (default) - canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case - writingFrame bool // started writing a frame (on serve goroutine or separate) - writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh - needsFrameFlush bool // last frame write wasn't a flush - inGoAway bool // we've started to or sent GOAWAY - inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop - needToSendGoAway bool // we need to schedule a GOAWAY frame write - goAwayCode ErrCode - shutdownTimer *time.Timer // nil until used - idleTimer *time.Timer // nil if unused - - // Owned by the writeFrameAsync goroutine: - headerWriteBuf bytes.Buffer - hpackEncoder *hpack.Encoder - - // Used by startGracefulShutdown. - shutdownOnce sync.Once -} - -func (sc *serverConn) maxHeaderListSize() uint32 { - n := sc.hs.MaxHeaderBytes - if n <= 0 { - n = http.DefaultMaxHeaderBytes - } - // http2's count is in a slightly different unit and includes 32 bytes per pair. - // So, take the net/http.Server value and pad it up a bit, assuming 10 headers. - const perFieldOverhead = 32 // per http2 spec - const typicalHeaders = 10 // conservative - return uint32(n + typicalHeaders*perFieldOverhead) -} - -func (sc *serverConn) curOpenStreams() uint32 { - sc.serveG.check() - return sc.curClientStreams + sc.curPushedStreams -} - -// stream represents a stream. This is the minimal metadata needed by -// the serve goroutine. Most of the actual stream state is owned by -// the http.Handler's goroutine in the responseWriter. Because the -// responseWriter's responseWriterState is recycled at the end of a -// handler, this struct intentionally has no pointer to the -// *responseWriter{,State} itself, as the Handler ending nils out the -// responseWriter's state field. -type stream struct { - // immutable: - sc *serverConn - id uint32 - body *pipe // non-nil if expecting DATA frames - cw closeWaiter // closed wait stream transitions to closed state - ctx context.Context - cancelCtx func() - - // owned by serverConn's serve loop: - bodyBytes int64 // body bytes seen so far - declBodyBytes int64 // or -1 if undeclared - flow flow // limits writing from Handler to client - inflow flow // what the client is allowed to POST/etc to us - state streamState - resetQueued bool // RST_STREAM queued for write; set by sc.resetStream - gotTrailerHeader bool // HEADER frame for trailers was seen - wroteHeaders bool // whether we wrote headers (not status 100) - writeDeadline *time.Timer // nil if unused - - trailer http.Header // accumulated trailers - reqTrailer http.Header // handler's Request.Trailer -} - -func (sc *serverConn) Framer() *Framer { return sc.framer } -func (sc *serverConn) CloseConn() error { return sc.conn.Close() } -func (sc *serverConn) Flush() error { return sc.bw.Flush() } -func (sc *serverConn) HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) { - return sc.hpackEncoder, &sc.headerWriteBuf -} - -func (sc *serverConn) state(streamID uint32) (streamState, *stream) { - sc.serveG.check() - // http://tools.ietf.org/html/rfc7540#section-5.1 - if st, ok := sc.streams[streamID]; ok { - return st.state, st - } - // "The first use of a new stream identifier implicitly closes all - // streams in the "idle" state that might have been initiated by - // that peer with a lower-valued stream identifier. For example, if - // a client sends a HEADERS frame on stream 7 without ever sending a - // frame on stream 5, then stream 5 transitions to the "closed" - // state when the first frame for stream 7 is sent or received." - if streamID%2 == 1 { - if streamID <= sc.maxClientStreamID { - return stateClosed, nil - } - } else { - if streamID <= sc.maxPushPromiseID { - return stateClosed, nil - } - } - return stateIdle, nil -} - -// setConnState calls the net/http ConnState hook for this connection, if configured. -// Note that the net/http package does StateNew and StateClosed for us. -// There is currently no plan for StateHijacked or hijacking HTTP/2 connections. -func (sc *serverConn) setConnState(state http.ConnState) { - if sc.hs.ConnState != nil { - sc.hs.ConnState(sc.conn, state) - } -} - -func (sc *serverConn) vlogf(format string, args ...interface{}) { - if VerboseLogs { - sc.logf(format, args...) - } -} - -func (sc *serverConn) logf(format string, args ...interface{}) { - if lg := sc.hs.ErrorLog; lg != nil { - lg.Printf(format, args...) - } else { - log.Printf(format, args...) - } -} - -// errno returns v's underlying uintptr, else 0. -// -// TODO: remove this helper function once http2 can use build -// tags. See comment in isClosedConnError. -func errno(v error) uintptr { - if rv := reflect.ValueOf(v); rv.Kind() == reflect.Uintptr { - return uintptr(rv.Uint()) - } - return 0 -} - -// isClosedConnError reports whether err is an error from use of a closed -// network connection. -func isClosedConnError(err error) bool { - if err == nil { - return false - } - - // TODO: remove this string search and be more like the Windows - // case below. That might involve modifying the standard library - // to return better error types. - str := err.Error() - if strings.Contains(str, "use of closed network connection") { - return true - } - - // TODO(bradfitz): x/tools/cmd/bundle doesn't really support - // build tags, so I can't make an http2_windows.go file with - // Windows-specific stuff. Fix that and move this, once we - // have a way to bundle this into std's net/http somehow. - if runtime.GOOS == "windows" { - if oe, ok := err.(*net.OpError); ok && oe.Op == "read" { - if se, ok := oe.Err.(*os.SyscallError); ok && se.Syscall == "wsarecv" { - const WSAECONNABORTED = 10053 - const WSAECONNRESET = 10054 - if n := errno(se.Err); n == WSAECONNRESET || n == WSAECONNABORTED { - return true - } - } - } - } - return false -} - -func (sc *serverConn) condlogf(err error, format string, args ...interface{}) { - if err == nil { - return - } - if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) || err == errPrefaceTimeout { - // Boring, expected errors. - sc.vlogf(format, args...) - } else { - sc.logf(format, args...) - } -} - -func (sc *serverConn) canonicalHeader(v string) string { - sc.serveG.check() - buildCommonHeaderMapsOnce() - cv, ok := commonCanonHeader[v] - if ok { - return cv - } - cv, ok = sc.canonHeader[v] - if ok { - return cv - } - if sc.canonHeader == nil { - sc.canonHeader = make(map[string]string) - } - cv = http.CanonicalHeaderKey(v) - sc.canonHeader[v] = cv - return cv -} - -type readFrameResult struct { - f Frame // valid until readMore is called - err error - - // readMore should be called once the consumer no longer needs or - // retains f. After readMore, f is invalid and more frames can be - // read. - readMore func() -} - -// readFrames is the loop that reads incoming frames. -// It takes care to only read one frame at a time, blocking until the -// consumer is done with the frame. -// It's run on its own goroutine. -func (sc *serverConn) readFrames() { - gate := make(gate) - gateDone := gate.Done - for { - f, err := sc.framer.ReadFrame() - select { - case sc.readFrameCh <- readFrameResult{f, err, gateDone}: - case <-sc.doneServing: - return - } - select { - case <-gate: - case <-sc.doneServing: - return - } - if terminalReadFrameError(err) { - return - } - } -} - -// frameWriteResult is the message passed from writeFrameAsync to the serve goroutine. -type frameWriteResult struct { - _ incomparable - wr FrameWriteRequest // what was written (or attempted) - err error // result of the writeFrame call -} - -// writeFrameAsync runs in its own goroutine and writes a single frame -// and then reports when it's done. -// At most one goroutine can be running writeFrameAsync at a time per -// serverConn. -func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest) { - err := wr.write.writeFrame(sc) - sc.wroteFrameCh <- frameWriteResult{wr: wr, err: err} -} - -func (sc *serverConn) closeAllStreamsOnConnClose() { - sc.serveG.check() - for _, st := range sc.streams { - sc.closeStream(st, errClientDisconnected) - } -} - -func (sc *serverConn) stopShutdownTimer() { - sc.serveG.check() - if t := sc.shutdownTimer; t != nil { - t.Stop() - } -} - -func (sc *serverConn) notePanic() { - // Note: this is for serverConn.serve panicking, not http.Handler code. - if testHookOnPanicMu != nil { - testHookOnPanicMu.Lock() - defer testHookOnPanicMu.Unlock() - } - if testHookOnPanic != nil { - if e := recover(); e != nil { - if testHookOnPanic(sc, e) { - panic(e) - } - } - } -} - -func (sc *serverConn) serve() { - sc.serveG.check() - defer sc.notePanic() - defer sc.conn.Close() - defer sc.closeAllStreamsOnConnClose() - defer sc.stopShutdownTimer() - defer close(sc.doneServing) // unblocks handlers trying to send - - if VerboseLogs { - sc.vlogf("http2: server connection from %v on %p", sc.conn.RemoteAddr(), sc.hs) - } - - sc.writeFrame(FrameWriteRequest{ - write: writeSettings{ - {SettingMaxFrameSize, sc.srv.maxReadFrameSize()}, - {SettingMaxConcurrentStreams, sc.advMaxStreams}, - {SettingMaxHeaderListSize, sc.maxHeaderListSize()}, - {SettingInitialWindowSize, uint32(sc.srv.initialStreamRecvWindowSize())}, - }, - }) - sc.unackedSettings++ - - // Each connection starts with intialWindowSize inflow tokens. - // If a higher value is configured, we add more tokens. - if diff := sc.srv.initialConnRecvWindowSize() - initialWindowSize; diff > 0 { - sc.sendWindowUpdate(nil, int(diff)) - } - - if err := sc.readPreface(); err != nil { - sc.condlogf(err, "http2: server: error reading preface from client %v: %v", sc.conn.RemoteAddr(), err) - return - } - // Now that we've got the preface, get us out of the - // "StateNew" state. We can't go directly to idle, though. - // Active means we read some data and anticipate a request. We'll - // do another Active when we get a HEADERS frame. - sc.setConnState(http.StateActive) - sc.setConnState(http.StateIdle) - - if sc.srv.IdleTimeout != 0 { - sc.idleTimer = time.AfterFunc(sc.srv.IdleTimeout, sc.onIdleTimer) - defer sc.idleTimer.Stop() - } - - go sc.readFrames() // closed by defer sc.conn.Close above - - settingsTimer := time.AfterFunc(firstSettingsTimeout, sc.onSettingsTimer) - defer settingsTimer.Stop() - - loopNum := 0 - for { - loopNum++ - select { - case wr := <-sc.wantWriteFrameCh: - if se, ok := wr.write.(StreamError); ok { - sc.resetStream(se) - break - } - sc.writeFrame(wr) - case res := <-sc.wroteFrameCh: - sc.wroteFrame(res) - case res := <-sc.readFrameCh: - if !sc.processFrameFromReader(res) { - return - } - res.readMore() - if settingsTimer != nil { - settingsTimer.Stop() - settingsTimer = nil - } - case m := <-sc.bodyReadCh: - sc.noteBodyRead(m.st, m.n) - case msg := <-sc.serveMsgCh: - switch v := msg.(type) { - case func(int): - v(loopNum) // for testing - case *serverMessage: - switch v { - case settingsTimerMsg: - sc.logf("timeout waiting for SETTINGS frames from %v", sc.conn.RemoteAddr()) - return - case idleTimerMsg: - sc.vlogf("connection is idle") - sc.goAway(ErrCodeNo) - case shutdownTimerMsg: - sc.vlogf("GOAWAY close timer fired; closing conn from %v", sc.conn.RemoteAddr()) - return - case gracefulShutdownMsg: - sc.startGracefulShutdownInternal() - default: - panic("unknown timer") - } - case *startPushRequest: - sc.startPush(v) - default: - panic(fmt.Sprintf("unexpected type %T", v)) - } - } - - // If the peer is causing us to generate a lot of control frames, - // but not reading them from us, assume they are trying to make us - // run out of memory. - if sc.queuedControlFrames > sc.srv.maxQueuedControlFrames() { - sc.vlogf("http2: too many control frames in send queue, closing connection") - return - } - - // Start the shutdown timer after sending a GOAWAY. When sending GOAWAY - // with no error code (graceful shutdown), don't start the timer until - // all open streams have been completed. - sentGoAway := sc.inGoAway && !sc.needToSendGoAway && !sc.writingFrame - gracefulShutdownComplete := sc.goAwayCode == ErrCodeNo && sc.curOpenStreams() == 0 - if sentGoAway && sc.shutdownTimer == nil && (sc.goAwayCode != ErrCodeNo || gracefulShutdownComplete) { - sc.shutDownIn(goAwayTimeout) - } - } -} - -func (sc *serverConn) awaitGracefulShutdown(sharedCh <-chan struct{}, privateCh chan struct{}) { - select { - case <-sc.doneServing: - case <-sharedCh: - close(privateCh) - } -} - -type serverMessage int - -// Message values sent to serveMsgCh. -var ( - settingsTimerMsg = new(serverMessage) - idleTimerMsg = new(serverMessage) - shutdownTimerMsg = new(serverMessage) - gracefulShutdownMsg = new(serverMessage) -) - -func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) } -func (sc *serverConn) onIdleTimer() { sc.sendServeMsg(idleTimerMsg) } -func (sc *serverConn) onShutdownTimer() { sc.sendServeMsg(shutdownTimerMsg) } - -func (sc *serverConn) sendServeMsg(msg interface{}) { - sc.serveG.checkNotOn() // NOT - select { - case sc.serveMsgCh <- msg: - case <-sc.doneServing: - } -} - -var errPrefaceTimeout = errors.New("timeout waiting for client preface") - -// readPreface reads the ClientPreface greeting from the peer or -// returns errPrefaceTimeout on timeout, or an error if the greeting -// is invalid. -func (sc *serverConn) readPreface() error { - errc := make(chan error, 1) - go func() { - // Read the client preface - buf := make([]byte, len(ClientPreface)) - if _, err := io.ReadFull(sc.conn, buf); err != nil { - errc <- err - } else if !bytes.Equal(buf, clientPreface) { - errc <- fmt.Errorf("bogus greeting %q", buf) - } else { - errc <- nil - } - }() - timer := time.NewTimer(prefaceTimeout) // TODO: configurable on *Server? - defer timer.Stop() - select { - case <-timer.C: - return errPrefaceTimeout - case err := <-errc: - if err == nil { - if VerboseLogs { - sc.vlogf("http2: server: client %v said hello", sc.conn.RemoteAddr()) - } - } - return err - } -} - -var errChanPool = sync.Pool{ - New: func() interface{} { return make(chan error, 1) }, -} - -var writeDataPool = sync.Pool{ - New: func() interface{} { return new(writeData) }, -} - -// writeDataFromHandler writes DATA response frames from a handler on -// the given stream. -func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStream bool) error { - ch := errChanPool.Get().(chan error) - writeArg := writeDataPool.Get().(*writeData) - *writeArg = writeData{stream.id, data, endStream} - err := sc.writeFrameFromHandler(FrameWriteRequest{ - write: writeArg, - stream: stream, - done: ch, - }) - if err != nil { - return err - } - var frameWriteDone bool // the frame write is done (successfully or not) - select { - case err = <-ch: - frameWriteDone = true - case <-sc.doneServing: - return errClientDisconnected - case <-stream.cw: - // If both ch and stream.cw were ready (as might - // happen on the final Write after an http.Handler - // ends), prefer the write result. Otherwise this - // might just be us successfully closing the stream. - // The writeFrameAsync and serve goroutines guarantee - // that the ch send will happen before the stream.cw - // close. - select { - case err = <-ch: - frameWriteDone = true - default: - return errStreamClosed - } - } - errChanPool.Put(ch) - if frameWriteDone { - writeDataPool.Put(writeArg) - } - return err -} - -// writeFrameFromHandler sends wr to sc.wantWriteFrameCh, but aborts -// if the connection has gone away. -// -// This must not be run from the serve goroutine itself, else it might -// deadlock writing to sc.wantWriteFrameCh (which is only mildly -// buffered and is read by serve itself). If you're on the serve -// goroutine, call writeFrame instead. -func (sc *serverConn) writeFrameFromHandler(wr FrameWriteRequest) error { - sc.serveG.checkNotOn() // NOT - select { - case sc.wantWriteFrameCh <- wr: - return nil - case <-sc.doneServing: - // Serve loop is gone. - // Client has closed their connection to the server. - return errClientDisconnected - } -} - -// writeFrame schedules a frame to write and sends it if there's nothing -// already being written. -// -// There is no pushback here (the serve goroutine never blocks). It's -// the http.Handlers that block, waiting for their previous frames to -// make it onto the wire -// -// If you're not on the serve goroutine, use writeFrameFromHandler instead. -func (sc *serverConn) writeFrame(wr FrameWriteRequest) { - sc.serveG.check() - - // If true, wr will not be written and wr.done will not be signaled. - var ignoreWrite bool - - // We are not allowed to write frames on closed streams. RFC 7540 Section - // 5.1.1 says: "An endpoint MUST NOT send frames other than PRIORITY on - // a closed stream." Our server never sends PRIORITY, so that exception - // does not apply. - // - // The serverConn might close an open stream while the stream's handler - // is still running. For example, the server might close a stream when it - // receives bad data from the client. If this happens, the handler might - // attempt to write a frame after the stream has been closed (since the - // handler hasn't yet been notified of the close). In this case, we simply - // ignore the frame. The handler will notice that the stream is closed when - // it waits for the frame to be written. - // - // As an exception to this rule, we allow sending RST_STREAM after close. - // This allows us to immediately reject new streams without tracking any - // state for those streams (except for the queued RST_STREAM frame). This - // may result in duplicate RST_STREAMs in some cases, but the client should - // ignore those. - if wr.StreamID() != 0 { - _, isReset := wr.write.(StreamError) - if state, _ := sc.state(wr.StreamID()); state == stateClosed && !isReset { - ignoreWrite = true - } - } - - // Don't send a 100-continue response if we've already sent headers. - // See golang.org/issue/14030. - switch wr.write.(type) { - case *writeResHeaders: - wr.stream.wroteHeaders = true - case write100ContinueHeadersFrame: - if wr.stream.wroteHeaders { - // We do not need to notify wr.done because this frame is - // never written with wr.done != nil. - if wr.done != nil { - panic("wr.done != nil for write100ContinueHeadersFrame") - } - ignoreWrite = true - } - } - - if !ignoreWrite { - if wr.isControl() { - sc.queuedControlFrames++ - // For extra safety, detect wraparounds, which should not happen, - // and pull the plug. - if sc.queuedControlFrames < 0 { - sc.conn.Close() - } - } - sc.writeSched.Push(wr) - } - sc.scheduleFrameWrite() -} - -// startFrameWrite starts a goroutine to write wr (in a separate -// goroutine since that might block on the network), and updates the -// serve goroutine's state about the world, updated from info in wr. -func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) { - sc.serveG.check() - if sc.writingFrame { - panic("internal error: can only be writing one frame at a time") - } - - st := wr.stream - if st != nil { - switch st.state { - case stateHalfClosedLocal: - switch wr.write.(type) { - case StreamError, handlerPanicRST, writeWindowUpdate: - // RFC 7540 Section 5.1 allows sending RST_STREAM, PRIORITY, and WINDOW_UPDATE - // in this state. (We never send PRIORITY from the server, so that is not checked.) - default: - panic(fmt.Sprintf("internal error: attempt to send frame on a half-closed-local stream: %v", wr)) - } - case stateClosed: - panic(fmt.Sprintf("internal error: attempt to send frame on a closed stream: %v", wr)) - } - } - if wpp, ok := wr.write.(*writePushPromise); ok { - var err error - wpp.promisedID, err = wpp.allocatePromisedID() - if err != nil { - sc.writingFrameAsync = false - wr.replyToWriter(err) - return - } - } - - sc.writingFrame = true - sc.needsFrameFlush = true - if wr.write.staysWithinBuffer(sc.bw.Available()) { - sc.writingFrameAsync = false - err := wr.write.writeFrame(sc) - sc.wroteFrame(frameWriteResult{wr: wr, err: err}) - } else { - sc.writingFrameAsync = true - go sc.writeFrameAsync(wr) - } -} - -// errHandlerPanicked is the error given to any callers blocked in a read from -// Request.Body when the main goroutine panics. Since most handlers read in the -// main ServeHTTP goroutine, this will show up rarely. -var errHandlerPanicked = errors.New("http2: handler panicked") - -// wroteFrame is called on the serve goroutine with the result of -// whatever happened on writeFrameAsync. -func (sc *serverConn) wroteFrame(res frameWriteResult) { - sc.serveG.check() - if !sc.writingFrame { - panic("internal error: expected to be already writing a frame") - } - sc.writingFrame = false - sc.writingFrameAsync = false - - wr := res.wr - - if writeEndsStream(wr.write) { - st := wr.stream - if st == nil { - panic("internal error: expecting non-nil stream") - } - switch st.state { - case stateOpen: - // Here we would go to stateHalfClosedLocal in - // theory, but since our handler is done and - // the net/http package provides no mechanism - // for closing a ResponseWriter while still - // reading data (see possible TODO at top of - // this file), we go into closed state here - // anyway, after telling the peer we're - // hanging up on them. We'll transition to - // stateClosed after the RST_STREAM frame is - // written. - st.state = stateHalfClosedLocal - // Section 8.1: a server MAY request that the client abort - // transmission of a request without error by sending a - // RST_STREAM with an error code of NO_ERROR after sending - // a complete response. - sc.resetStream(streamError(st.id, ErrCodeNo)) - case stateHalfClosedRemote: - sc.closeStream(st, errHandlerComplete) - } - } else { - switch v := wr.write.(type) { - case StreamError: - // st may be unknown if the RST_STREAM was generated to reject bad input. - if st, ok := sc.streams[v.StreamID]; ok { - sc.closeStream(st, v) - } - case handlerPanicRST: - sc.closeStream(wr.stream, errHandlerPanicked) - } - } - - // Reply (if requested) to unblock the ServeHTTP goroutine. - wr.replyToWriter(res.err) - - sc.scheduleFrameWrite() -} - -// scheduleFrameWrite tickles the frame writing scheduler. -// -// If a frame is already being written, nothing happens. This will be called again -// when the frame is done being written. -// -// If a frame isn't being written and we need to send one, the best frame -// to send is selected by writeSched. -// -// If a frame isn't being written and there's nothing else to send, we -// flush the write buffer. -func (sc *serverConn) scheduleFrameWrite() { - sc.serveG.check() - if sc.writingFrame || sc.inFrameScheduleLoop { - return - } - sc.inFrameScheduleLoop = true - for !sc.writingFrameAsync { - if sc.needToSendGoAway { - sc.needToSendGoAway = false - sc.startFrameWrite(FrameWriteRequest{ - write: &writeGoAway{ - maxStreamID: sc.maxClientStreamID, - code: sc.goAwayCode, - }, - }) - continue - } - if sc.needToSendSettingsAck { - sc.needToSendSettingsAck = false - sc.startFrameWrite(FrameWriteRequest{write: writeSettingsAck{}}) - continue - } - if !sc.inGoAway || sc.goAwayCode == ErrCodeNo { - if wr, ok := sc.writeSched.Pop(); ok { - if wr.isControl() { - sc.queuedControlFrames-- - } - sc.startFrameWrite(wr) - continue - } - } - if sc.needsFrameFlush { - sc.startFrameWrite(FrameWriteRequest{write: flushFrameWriter{}}) - sc.needsFrameFlush = false // after startFrameWrite, since it sets this true - continue - } - break - } - sc.inFrameScheduleLoop = false -} - -// startGracefulShutdown gracefully shuts down a connection. This -// sends GOAWAY with ErrCodeNo to tell the client we're gracefully -// shutting down. The connection isn't closed until all current -// streams are done. -// -// startGracefulShutdown returns immediately; it does not wait until -// the connection has shut down. -func (sc *serverConn) startGracefulShutdown() { - sc.serveG.checkNotOn() // NOT - sc.shutdownOnce.Do(func() { sc.sendServeMsg(gracefulShutdownMsg) }) -} - -// After sending GOAWAY, the connection will close after goAwayTimeout. -// If we close the connection immediately after sending GOAWAY, there may -// be unsent data in our kernel receive buffer, which will cause the kernel -// to send a TCP RST on close() instead of a FIN. This RST will abort the -// connection immediately, whether or not the client had received the GOAWAY. -// -// Ideally we should delay for at least 1 RTT + epsilon so the client has -// a chance to read the GOAWAY and stop sending messages. Measuring RTT -// is hard, so we approximate with 1 second. See golang.org/issue/18701. -// -// This is a var so it can be shorter in tests, where all requests uses the -// loopback interface making the expected RTT very small. -// -// TODO: configurable? -var goAwayTimeout = 1 * time.Second - -func (sc *serverConn) startGracefulShutdownInternal() { - sc.goAway(ErrCodeNo) -} - -func (sc *serverConn) goAway(code ErrCode) { - sc.serveG.check() - if sc.inGoAway { - return - } - sc.inGoAway = true - sc.needToSendGoAway = true - sc.goAwayCode = code - sc.scheduleFrameWrite() -} - -func (sc *serverConn) shutDownIn(d time.Duration) { - sc.serveG.check() - sc.shutdownTimer = time.AfterFunc(d, sc.onShutdownTimer) -} - -func (sc *serverConn) resetStream(se StreamError) { - sc.serveG.check() - sc.writeFrame(FrameWriteRequest{write: se}) - if st, ok := sc.streams[se.StreamID]; ok { - st.resetQueued = true - } -} - -// processFrameFromReader processes the serve loop's read from readFrameCh from the -// frame-reading goroutine. -// processFrameFromReader returns whether the connection should be kept open. -func (sc *serverConn) processFrameFromReader(res readFrameResult) bool { - sc.serveG.check() - err := res.err - if err != nil { - if err == ErrFrameTooLarge { - sc.goAway(ErrCodeFrameSize) - return true // goAway will close the loop - } - clientGone := err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) - if clientGone { - // TODO: could we also get into this state if - // the peer does a half close - // (e.g. CloseWrite) because they're done - // sending frames but they're still wanting - // our open replies? Investigate. - // TODO: add CloseWrite to crypto/tls.Conn first - // so we have a way to test this? I suppose - // just for testing we could have a non-TLS mode. - return false - } - } else { - f := res.f - if VerboseLogs { - sc.vlogf("http2: server read frame %v", summarizeFrame(f)) - } - err = sc.processFrame(f) - if err == nil { - return true - } - } - - switch ev := err.(type) { - case StreamError: - sc.resetStream(ev) - return true - case goAwayFlowError: - sc.goAway(ErrCodeFlowControl) - return true - case ConnectionError: - sc.logf("http2: server connection error from %v: %v", sc.conn.RemoteAddr(), ev) - sc.goAway(ErrCode(ev)) - return true // goAway will handle shutdown - default: - if res.err != nil { - sc.vlogf("http2: server closing client connection; error reading frame from client %s: %v", sc.conn.RemoteAddr(), err) - } else { - sc.logf("http2: server closing client connection: %v", err) - } - return false - } -} - -func (sc *serverConn) processFrame(f Frame) error { - sc.serveG.check() - - // First frame received must be SETTINGS. - if !sc.sawFirstSettings { - if _, ok := f.(*SettingsFrame); !ok { - return ConnectionError(ErrCodeProtocol) - } - sc.sawFirstSettings = true - } - - switch f := f.(type) { - case *SettingsFrame: - return sc.processSettings(f) - case *MetaHeadersFrame: - return sc.processHeaders(f) - case *WindowUpdateFrame: - return sc.processWindowUpdate(f) - case *PingFrame: - return sc.processPing(f) - case *DataFrame: - return sc.processData(f) - case *RSTStreamFrame: - return sc.processResetStream(f) - case *PriorityFrame: - return sc.processPriority(f) - case *GoAwayFrame: - return sc.processGoAway(f) - case *PushPromiseFrame: - // A client cannot push. Thus, servers MUST treat the receipt of a PUSH_PROMISE - // frame as a connection error (Section 5.4.1) of type PROTOCOL_ERROR. - return ConnectionError(ErrCodeProtocol) - default: - sc.vlogf("http2: server ignoring frame: %v", f.Header()) - return nil - } -} - -func (sc *serverConn) processPing(f *PingFrame) error { - sc.serveG.check() - if f.IsAck() { - // 6.7 PING: " An endpoint MUST NOT respond to PING frames - // containing this flag." - return nil - } - if f.StreamID != 0 { - // "PING frames are not associated with any individual - // stream. If a PING frame is received with a stream - // identifier field value other than 0x0, the recipient MUST - // respond with a connection error (Section 5.4.1) of type - // PROTOCOL_ERROR." - return ConnectionError(ErrCodeProtocol) - } - if sc.inGoAway && sc.goAwayCode != ErrCodeNo { - return nil - } - sc.writeFrame(FrameWriteRequest{write: writePingAck{f}}) - return nil -} - -func (sc *serverConn) processWindowUpdate(f *WindowUpdateFrame) error { - sc.serveG.check() - switch { - case f.StreamID != 0: // stream-level flow control - state, st := sc.state(f.StreamID) - if state == stateIdle { - // Section 5.1: "Receiving any frame other than HEADERS - // or PRIORITY on a stream in this state MUST be - // treated as a connection error (Section 5.4.1) of - // type PROTOCOL_ERROR." - return ConnectionError(ErrCodeProtocol) - } - if st == nil { - // "WINDOW_UPDATE can be sent by a peer that has sent a - // frame bearing the END_STREAM flag. This means that a - // receiver could receive a WINDOW_UPDATE frame on a "half - // closed (remote)" or "closed" stream. A receiver MUST - // NOT treat this as an error, see Section 5.1." - return nil - } - if !st.flow.add(int32(f.Increment)) { - return streamError(f.StreamID, ErrCodeFlowControl) - } - default: // connection-level flow control - if !sc.flow.add(int32(f.Increment)) { - return goAwayFlowError{} - } - } - sc.scheduleFrameWrite() - return nil -} - -func (sc *serverConn) processResetStream(f *RSTStreamFrame) error { - sc.serveG.check() - - state, st := sc.state(f.StreamID) - if state == stateIdle { - // 6.4 "RST_STREAM frames MUST NOT be sent for a - // stream in the "idle" state. If a RST_STREAM frame - // identifying an idle stream is received, the - // recipient MUST treat this as a connection error - // (Section 5.4.1) of type PROTOCOL_ERROR. - return ConnectionError(ErrCodeProtocol) - } - if st != nil { - st.cancelCtx() - sc.closeStream(st, streamError(f.StreamID, f.ErrCode)) - } - return nil -} - -func (sc *serverConn) closeStream(st *stream, err error) { - sc.serveG.check() - if st.state == stateIdle || st.state == stateClosed { - panic(fmt.Sprintf("invariant; can't close stream in state %v", st.state)) - } - st.state = stateClosed - if st.writeDeadline != nil { - st.writeDeadline.Stop() - } - if st.isPushed() { - sc.curPushedStreams-- - } else { - sc.curClientStreams-- - } - delete(sc.streams, st.id) - if len(sc.streams) == 0 { - sc.setConnState(http.StateIdle) - if sc.srv.IdleTimeout != 0 { - sc.idleTimer.Reset(sc.srv.IdleTimeout) - } - if h1ServerKeepAlivesDisabled(sc.hs) { - sc.startGracefulShutdownInternal() - } - } - if p := st.body; p != nil { - // Return any buffered unread bytes worth of conn-level flow control. - // See golang.org/issue/16481 - sc.sendWindowUpdate(nil, p.Len()) - - p.CloseWithError(err) - } - st.cw.Close() // signals Handler's CloseNotifier, unblocks writes, etc - sc.writeSched.CloseStream(st.id) -} - -func (sc *serverConn) processSettings(f *SettingsFrame) error { - sc.serveG.check() - if f.IsAck() { - sc.unackedSettings-- - if sc.unackedSettings < 0 { - // Why is the peer ACKing settings we never sent? - // The spec doesn't mention this case, but - // hang up on them anyway. - return ConnectionError(ErrCodeProtocol) - } - return nil - } - if f.NumSettings() > 100 || f.HasDuplicates() { - // This isn't actually in the spec, but hang up on - // suspiciously large settings frames or those with - // duplicate entries. - return ConnectionError(ErrCodeProtocol) - } - if err := f.ForeachSetting(sc.processSetting); err != nil { - return err - } - // TODO: judging by RFC 7540, Section 6.5.3 each SETTINGS frame should be - // acknowledged individually, even if multiple are received before the ACK. - sc.needToSendSettingsAck = true - sc.scheduleFrameWrite() - return nil -} - -func (sc *serverConn) processSetting(s Setting) error { - sc.serveG.check() - if err := s.Valid(); err != nil { - return err - } - if VerboseLogs { - sc.vlogf("http2: server processing setting %v", s) - } - switch s.ID { - case SettingHeaderTableSize: - sc.headerTableSize = s.Val - sc.hpackEncoder.SetMaxDynamicTableSize(s.Val) - case SettingEnablePush: - sc.pushEnabled = s.Val != 0 - case SettingMaxConcurrentStreams: - sc.clientMaxStreams = s.Val - case SettingInitialWindowSize: - return sc.processSettingInitialWindowSize(s.Val) - case SettingMaxFrameSize: - sc.maxFrameSize = int32(s.Val) // the maximum valid s.Val is < 2^31 - case SettingMaxHeaderListSize: - sc.peerMaxHeaderListSize = s.Val - default: - // Unknown setting: "An endpoint that receives a SETTINGS - // frame with any unknown or unsupported identifier MUST - // ignore that setting." - if VerboseLogs { - sc.vlogf("http2: server ignoring unknown setting %v", s) - } - } - return nil -} - -func (sc *serverConn) processSettingInitialWindowSize(val uint32) error { - sc.serveG.check() - // Note: val already validated to be within range by - // processSetting's Valid call. - - // "A SETTINGS frame can alter the initial flow control window - // size for all current streams. When the value of - // SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST - // adjust the size of all stream flow control windows that it - // maintains by the difference between the new value and the - // old value." - old := sc.initialStreamSendWindowSize - sc.initialStreamSendWindowSize = int32(val) - growth := int32(val) - old // may be negative - for _, st := range sc.streams { - if !st.flow.add(growth) { - // 6.9.2 Initial Flow Control Window Size - // "An endpoint MUST treat a change to - // SETTINGS_INITIAL_WINDOW_SIZE that causes any flow - // control window to exceed the maximum size as a - // connection error (Section 5.4.1) of type - // FLOW_CONTROL_ERROR." - return ConnectionError(ErrCodeFlowControl) - } - } - return nil -} - -func (sc *serverConn) processData(f *DataFrame) error { - sc.serveG.check() - if sc.inGoAway && sc.goAwayCode != ErrCodeNo { - return nil - } - data := f.Data() - - // "If a DATA frame is received whose stream is not in "open" - // or "half closed (local)" state, the recipient MUST respond - // with a stream error (Section 5.4.2) of type STREAM_CLOSED." - id := f.Header().StreamID - state, st := sc.state(id) - if id == 0 || state == stateIdle { - // Section 5.1: "Receiving any frame other than HEADERS - // or PRIORITY on a stream in this state MUST be - // treated as a connection error (Section 5.4.1) of - // type PROTOCOL_ERROR." - return ConnectionError(ErrCodeProtocol) - } - if st == nil || state != stateOpen || st.gotTrailerHeader || st.resetQueued { - // This includes sending a RST_STREAM if the stream is - // in stateHalfClosedLocal (which currently means that - // the http.Handler returned, so it's done reading & - // done writing). Try to stop the client from sending - // more DATA. - - // But still enforce their connection-level flow control, - // and return any flow control bytes since we're not going - // to consume them. - if sc.inflow.available() < int32(f.Length) { - return streamError(id, ErrCodeFlowControl) - } - // Deduct the flow control from inflow, since we're - // going to immediately add it back in - // sendWindowUpdate, which also schedules sending the - // frames. - sc.inflow.take(int32(f.Length)) - sc.sendWindowUpdate(nil, int(f.Length)) // conn-level - - if st != nil && st.resetQueued { - // Already have a stream error in flight. Don't send another. - return nil - } - return streamError(id, ErrCodeStreamClosed) - } - if st.body == nil { - panic("internal error: should have a body in this state") - } - - // Sender sending more than they'd declared? - if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes { - st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes)) - // RFC 7540, sec 8.1.2.6: A request or response is also malformed if the - // value of a content-length header field does not equal the sum of the - // DATA frame payload lengths that form the body. - return streamError(id, ErrCodeProtocol) - } - if f.Length > 0 { - // Check whether the client has flow control quota. - if st.inflow.available() < int32(f.Length) { - return streamError(id, ErrCodeFlowControl) - } - st.inflow.take(int32(f.Length)) - - if len(data) > 0 { - wrote, err := st.body.Write(data) - if err != nil { - return streamError(id, ErrCodeStreamClosed) - } - if wrote != len(data) { - panic("internal error: bad Writer") - } - st.bodyBytes += int64(len(data)) - } - - // Return any padded flow control now, since we won't - // refund it later on body reads. - if pad := int32(f.Length) - int32(len(data)); pad > 0 { - sc.sendWindowUpdate32(nil, pad) - sc.sendWindowUpdate32(st, pad) - } - } - if f.StreamEnded() { - st.endStream() - } - return nil -} - -func (sc *serverConn) processGoAway(f *GoAwayFrame) error { - sc.serveG.check() - if f.ErrCode != ErrCodeNo { - sc.logf("http2: received GOAWAY %+v, starting graceful shutdown", f) - } else { - sc.vlogf("http2: received GOAWAY %+v, starting graceful shutdown", f) - } - sc.startGracefulShutdownInternal() - // http://tools.ietf.org/html/rfc7540#section-6.8 - // We should not create any new streams, which means we should disable push. - sc.pushEnabled = false - return nil -} - -// isPushed reports whether the stream is server-initiated. -func (st *stream) isPushed() bool { - return st.id%2 == 0 -} - -// endStream closes a Request.Body's pipe. It is called when a DATA -// frame says a request body is over (or after trailers). -func (st *stream) endStream() { - sc := st.sc - sc.serveG.check() - - if st.declBodyBytes != -1 && st.declBodyBytes != st.bodyBytes { - st.body.CloseWithError(fmt.Errorf("request declared a Content-Length of %d but only wrote %d bytes", - st.declBodyBytes, st.bodyBytes)) - } else { - st.body.closeWithErrorAndCode(io.EOF, st.copyTrailersToHandlerRequest) - st.body.CloseWithError(io.EOF) - } - st.state = stateHalfClosedRemote -} - -// copyTrailersToHandlerRequest is run in the Handler's goroutine in -// its Request.Body.Read just before it gets io.EOF. -func (st *stream) copyTrailersToHandlerRequest() { - for k, vv := range st.trailer { - if _, ok := st.reqTrailer[k]; ok { - // Only copy it over it was pre-declared. - st.reqTrailer[k] = vv - } - } -} - -// onWriteTimeout is run on its own goroutine (from time.AfterFunc) -// when the stream's WriteTimeout has fired. -func (st *stream) onWriteTimeout() { - st.sc.writeFrameFromHandler(FrameWriteRequest{write: streamError(st.id, ErrCodeInternal)}) -} - -func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { - sc.serveG.check() - id := f.StreamID - if sc.inGoAway { - // Ignore. - return nil - } - // http://tools.ietf.org/html/rfc7540#section-5.1.1 - // Streams initiated by a client MUST use odd-numbered stream - // identifiers. [...] An endpoint that receives an unexpected - // stream identifier MUST respond with a connection error - // (Section 5.4.1) of type PROTOCOL_ERROR. - if id%2 != 1 { - return ConnectionError(ErrCodeProtocol) - } - // A HEADERS frame can be used to create a new stream or - // send a trailer for an open one. If we already have a stream - // open, let it process its own HEADERS frame (trailers at this - // point, if it's valid). - if st := sc.streams[f.StreamID]; st != nil { - if st.resetQueued { - // We're sending RST_STREAM to close the stream, so don't bother - // processing this frame. - return nil - } - // RFC 7540, sec 5.1: If an endpoint receives additional frames, other than - // WINDOW_UPDATE, PRIORITY, or RST_STREAM, for a stream that is in - // this state, it MUST respond with a stream error (Section 5.4.2) of - // type STREAM_CLOSED. - if st.state == stateHalfClosedRemote { - return streamError(id, ErrCodeStreamClosed) - } - return st.processTrailerHeaders(f) - } - - // [...] The identifier of a newly established stream MUST be - // numerically greater than all streams that the initiating - // endpoint has opened or reserved. [...] An endpoint that - // receives an unexpected stream identifier MUST respond with - // a connection error (Section 5.4.1) of type PROTOCOL_ERROR. - if id <= sc.maxClientStreamID { - return ConnectionError(ErrCodeProtocol) - } - sc.maxClientStreamID = id - - if sc.idleTimer != nil { - sc.idleTimer.Stop() - } - - // http://tools.ietf.org/html/rfc7540#section-5.1.2 - // [...] Endpoints MUST NOT exceed the limit set by their peer. An - // endpoint that receives a HEADERS frame that causes their - // advertised concurrent stream limit to be exceeded MUST treat - // this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR - // or REFUSED_STREAM. - if sc.curClientStreams+1 > sc.advMaxStreams { - if sc.unackedSettings == 0 { - // They should know better. - return streamError(id, ErrCodeProtocol) - } - // Assume it's a network race, where they just haven't - // received our last SETTINGS update. But actually - // this can't happen yet, because we don't yet provide - // a way for users to adjust server parameters at - // runtime. - return streamError(id, ErrCodeRefusedStream) - } - - initialState := stateOpen - if f.StreamEnded() { - initialState = stateHalfClosedRemote - } - st := sc.newStream(id, 0, initialState) - - if f.HasPriority() { - if err := checkPriority(f.StreamID, f.Priority); err != nil { - return err - } - sc.writeSched.AdjustStream(st.id, f.Priority) - } - - rw, req, err := sc.newWriterAndRequest(st, f) - if err != nil { - return err - } - st.reqTrailer = req.Trailer - if st.reqTrailer != nil { - st.trailer = make(http.Header) - } - st.body = req.Body.(*requestBody).pipe // may be nil - st.declBodyBytes = req.ContentLength - - handler := sc.handler.ServeHTTP - if f.Truncated { - // Their header list was too long. Send a 431 error. - handler = handleHeaderListTooLong - } else if err := checkValidHTTP2RequestHeaders(req.Header); err != nil { - handler = new400Handler(err) - } - - // The net/http package sets the read deadline from the - // http.Server.ReadTimeout during the TLS handshake, but then - // passes the connection off to us with the deadline already - // set. Disarm it here after the request headers are read, - // similar to how the http1 server works. Here it's - // technically more like the http1 Server's ReadHeaderTimeout - // (in Go 1.8), though. That's a more sane option anyway. - if sc.hs.ReadTimeout != 0 { - sc.conn.SetReadDeadline(time.Time{}) - } - - go sc.runHandler(rw, req, handler) - return nil -} - -func (st *stream) processTrailerHeaders(f *MetaHeadersFrame) error { - sc := st.sc - sc.serveG.check() - if st.gotTrailerHeader { - return ConnectionError(ErrCodeProtocol) - } - st.gotTrailerHeader = true - if !f.StreamEnded() { - return streamError(st.id, ErrCodeProtocol) - } - - if len(f.PseudoFields()) > 0 { - return streamError(st.id, ErrCodeProtocol) - } - if st.trailer != nil { - for _, hf := range f.RegularFields() { - key := sc.canonicalHeader(hf.Name) - if !httpguts.ValidTrailerHeader(key) { - // TODO: send more details to the peer somehow. But http2 has - // no way to send debug data at a stream level. Discuss with - // HTTP folk. - return streamError(st.id, ErrCodeProtocol) - } - st.trailer[key] = append(st.trailer[key], hf.Value) - } - } - st.endStream() - return nil -} - -func checkPriority(streamID uint32, p PriorityParam) error { - if streamID == p.StreamDep { - // Section 5.3.1: "A stream cannot depend on itself. An endpoint MUST treat - // this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR." - // Section 5.3.3 says that a stream can depend on one of its dependencies, - // so it's only self-dependencies that are forbidden. - return streamError(streamID, ErrCodeProtocol) - } - return nil -} - -func (sc *serverConn) processPriority(f *PriorityFrame) error { - if sc.inGoAway { - return nil - } - if err := checkPriority(f.StreamID, f.PriorityParam); err != nil { - return err - } - sc.writeSched.AdjustStream(f.StreamID, f.PriorityParam) - return nil -} - -func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream { - sc.serveG.check() - if id == 0 { - panic("internal error: cannot create stream with id 0") - } - - ctx, cancelCtx := context.WithCancel(sc.baseCtx) - st := &stream{ - sc: sc, - id: id, - state: state, - ctx: ctx, - cancelCtx: cancelCtx, - } - st.cw.Init() - st.flow.conn = &sc.flow // link to conn-level counter - st.flow.add(sc.initialStreamSendWindowSize) - st.inflow.conn = &sc.inflow // link to conn-level counter - st.inflow.add(sc.srv.initialStreamRecvWindowSize()) - if sc.hs.WriteTimeout != 0 { - st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout) - } - - sc.streams[id] = st - sc.writeSched.OpenStream(st.id, OpenStreamOptions{PusherID: pusherID}) - if st.isPushed() { - sc.curPushedStreams++ - } else { - sc.curClientStreams++ - } - if sc.curOpenStreams() == 1 { - sc.setConnState(http.StateActive) - } - - return st -} - -func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*responseWriter, *http.Request, error) { - sc.serveG.check() - - rp := requestParam{ - method: f.PseudoValue("method"), - scheme: f.PseudoValue("scheme"), - authority: f.PseudoValue("authority"), - path: f.PseudoValue("path"), - } - - isConnect := rp.method == "CONNECT" - if isConnect { - if rp.path != "" || rp.scheme != "" || rp.authority == "" { - return nil, nil, streamError(f.StreamID, ErrCodeProtocol) - } - } else if rp.method == "" || rp.path == "" || (rp.scheme != "https" && rp.scheme != "http") { - // See 8.1.2.6 Malformed Requests and Responses: - // - // Malformed requests or responses that are detected - // MUST be treated as a stream error (Section 5.4.2) - // of type PROTOCOL_ERROR." - // - // 8.1.2.3 Request Pseudo-Header Fields - // "All HTTP/2 requests MUST include exactly one valid - // value for the :method, :scheme, and :path - // pseudo-header fields" - return nil, nil, streamError(f.StreamID, ErrCodeProtocol) - } - - bodyOpen := !f.StreamEnded() - if rp.method == "HEAD" && bodyOpen { - // HEAD requests can't have bodies - return nil, nil, streamError(f.StreamID, ErrCodeProtocol) - } - - rp.header = make(http.Header) - for _, hf := range f.RegularFields() { - rp.header.Add(sc.canonicalHeader(hf.Name), hf.Value) - } - if rp.authority == "" { - rp.authority = rp.header.Get("Host") - } - - rw, req, err := sc.newWriterAndRequestNoBody(st, rp) - if err != nil { - return nil, nil, err - } - if bodyOpen { - if vv, ok := rp.header["Content-Length"]; ok { - req.ContentLength, _ = strconv.ParseInt(vv[0], 10, 64) - } else { - req.ContentLength = -1 - } - req.Body.(*requestBody).pipe = &pipe{ - b: &dataBuffer{expected: req.ContentLength}, - } - } - return rw, req, nil -} - -type requestParam struct { - method string - scheme, authority, path string - header http.Header -} - -func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*responseWriter, *http.Request, error) { - sc.serveG.check() - - var tlsState *tls.ConnectionState // nil if not scheme https - if rp.scheme == "https" { - tlsState = sc.tlsState - } - - needsContinue := rp.header.Get("Expect") == "100-continue" - if needsContinue { - rp.header.Del("Expect") - } - // Merge Cookie headers into one "; "-delimited value. - if cookies := rp.header["Cookie"]; len(cookies) > 1 { - rp.header.Set("Cookie", strings.Join(cookies, "; ")) - } - - // Setup Trailers - var trailer http.Header - for _, v := range rp.header["Trailer"] { - for _, key := range strings.Split(v, ",") { - key = http.CanonicalHeaderKey(textproto.TrimString(key)) - switch key { - case "Transfer-Encoding", "Trailer", "Content-Length": - // Bogus. (copy of http1 rules) - // Ignore. - default: - if trailer == nil { - trailer = make(http.Header) - } - trailer[key] = nil - } - } - } - delete(rp.header, "Trailer") - - var url_ *url.URL - var requestURI string - if rp.method == "CONNECT" { - url_ = &url.URL{Host: rp.authority} - requestURI = rp.authority // mimic HTTP/1 server behavior - } else { - var err error - url_, err = url.ParseRequestURI(rp.path) - if err != nil { - return nil, nil, streamError(st.id, ErrCodeProtocol) - } - requestURI = rp.path - } - - body := &requestBody{ - conn: sc, - stream: st, - needsContinue: needsContinue, - } - req := &http.Request{ - Method: rp.method, - URL: url_, - RemoteAddr: sc.remoteAddrStr, - Header: rp.header, - RequestURI: requestURI, - Proto: "HTTP/2.0", - ProtoMajor: 2, - ProtoMinor: 0, - TLS: tlsState, - Host: rp.authority, - Body: body, - Trailer: trailer, - } - req = req.WithContext(st.ctx) - - rws := responseWriterStatePool.Get().(*responseWriterState) - bwSave := rws.bw - *rws = responseWriterState{} // zero all the fields - rws.conn = sc - rws.bw = bwSave - rws.bw.Reset(chunkWriter{rws}) - rws.stream = st - rws.req = req - rws.body = body - - rw := &responseWriter{rws: rws} - return rw, req, nil -} - -// Run on its own goroutine. -func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { - didPanic := true - defer func() { - rw.rws.stream.cancelCtx() - if didPanic { - e := recover() - sc.writeFrameFromHandler(FrameWriteRequest{ - write: handlerPanicRST{rw.rws.stream.id}, - stream: rw.rws.stream, - }) - // Same as net/http: - if e != nil && e != http.ErrAbortHandler { - const size = 64 << 10 - buf := make([]byte, size) - buf = buf[:runtime.Stack(buf, false)] - sc.logf("http2: panic serving %v: %v\n%s", sc.conn.RemoteAddr(), e, buf) - } - return - } - rw.handlerDone() - }() - handler(rw, req) - didPanic = false -} - -func handleHeaderListTooLong(w http.ResponseWriter, r *http.Request) { - // 10.5.1 Limits on Header Block Size: - // .. "A server that receives a larger header block than it is - // willing to handle can send an HTTP 431 (Request Header Fields Too - // Large) status code" - const statusRequestHeaderFieldsTooLarge = 431 // only in Go 1.6+ - w.WriteHeader(statusRequestHeaderFieldsTooLarge) - io.WriteString(w, "<h1>HTTP Error 431</h1><p>Request Header Field(s) Too Large</p>") -} - -// called from handler goroutines. -// h may be nil. -func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) error { - sc.serveG.checkNotOn() // NOT on - var errc chan error - if headerData.h != nil { - // If there's a header map (which we don't own), so we have to block on - // waiting for this frame to be written, so an http.Flush mid-handler - // writes out the correct value of keys, before a handler later potentially - // mutates it. - errc = errChanPool.Get().(chan error) - } - if err := sc.writeFrameFromHandler(FrameWriteRequest{ - write: headerData, - stream: st, - done: errc, - }); err != nil { - return err - } - if errc != nil { - select { - case err := <-errc: - errChanPool.Put(errc) - return err - case <-sc.doneServing: - return errClientDisconnected - case <-st.cw: - return errStreamClosed - } - } - return nil -} - -// called from handler goroutines. -func (sc *serverConn) write100ContinueHeaders(st *stream) { - sc.writeFrameFromHandler(FrameWriteRequest{ - write: write100ContinueHeadersFrame{st.id}, - stream: st, - }) -} - -// A bodyReadMsg tells the server loop that the http.Handler read n -// bytes of the DATA from the client on the given stream. -type bodyReadMsg struct { - st *stream - n int -} - -// called from handler goroutines. -// Notes that the handler for the given stream ID read n bytes of its body -// and schedules flow control tokens to be sent. -func (sc *serverConn) noteBodyReadFromHandler(st *stream, n int, err error) { - sc.serveG.checkNotOn() // NOT on - if n > 0 { - select { - case sc.bodyReadCh <- bodyReadMsg{st, n}: - case <-sc.doneServing: - } - } -} - -func (sc *serverConn) noteBodyRead(st *stream, n int) { - sc.serveG.check() - sc.sendWindowUpdate(nil, n) // conn-level - if st.state != stateHalfClosedRemote && st.state != stateClosed { - // Don't send this WINDOW_UPDATE if the stream is closed - // remotely. - sc.sendWindowUpdate(st, n) - } -} - -// st may be nil for conn-level -func (sc *serverConn) sendWindowUpdate(st *stream, n int) { - sc.serveG.check() - // "The legal range for the increment to the flow control - // window is 1 to 2^31-1 (2,147,483,647) octets." - // A Go Read call on 64-bit machines could in theory read - // a larger Read than this. Very unlikely, but we handle it here - // rather than elsewhere for now. - const maxUint31 = 1<<31 - 1 - for n >= maxUint31 { - sc.sendWindowUpdate32(st, maxUint31) - n -= maxUint31 - } - sc.sendWindowUpdate32(st, int32(n)) -} - -// st may be nil for conn-level -func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) { - sc.serveG.check() - if n == 0 { - return - } - if n < 0 { - panic("negative update") - } - var streamID uint32 - if st != nil { - streamID = st.id - } - sc.writeFrame(FrameWriteRequest{ - write: writeWindowUpdate{streamID: streamID, n: uint32(n)}, - stream: st, - }) - var ok bool - if st == nil { - ok = sc.inflow.add(n) - } else { - ok = st.inflow.add(n) - } - if !ok { - panic("internal error; sent too many window updates without decrements?") - } -} - -// requestBody is the Handler's Request.Body type. -// Read and Close may be called concurrently. -type requestBody struct { - _ incomparable - stream *stream - conn *serverConn - closed bool // for use by Close only - sawEOF bool // for use by Read only - pipe *pipe // non-nil if we have a HTTP entity message body - needsContinue bool // need to send a 100-continue -} - -func (b *requestBody) Close() error { - if b.pipe != nil && !b.closed { - b.pipe.BreakWithError(errClosedBody) - } - b.closed = true - return nil -} - -func (b *requestBody) Read(p []byte) (n int, err error) { - if b.needsContinue { - b.needsContinue = false - b.conn.write100ContinueHeaders(b.stream) - } - if b.pipe == nil || b.sawEOF { - return 0, io.EOF - } - n, err = b.pipe.Read(p) - if err == io.EOF { - b.sawEOF = true - } - if b.conn == nil && inTests { - return - } - b.conn.noteBodyReadFromHandler(b.stream, n, err) - return -} - -// responseWriter is the http.ResponseWriter implementation. It's -// intentionally small (1 pointer wide) to minimize garbage. The -// responseWriterState pointer inside is zeroed at the end of a -// request (in handlerDone) and calls on the responseWriter thereafter -// simply crash (caller's mistake), but the much larger responseWriterState -// and buffers are reused between multiple requests. -type responseWriter struct { - rws *responseWriterState -} - -// Optional http.ResponseWriter interfaces implemented. -var ( - _ http.CloseNotifier = (*responseWriter)(nil) - _ http.Flusher = (*responseWriter)(nil) - _ stringWriter = (*responseWriter)(nil) -) - -type responseWriterState struct { - // immutable within a request: - stream *stream - req *http.Request - body *requestBody // to close at end of request, if DATA frames didn't - conn *serverConn - - // TODO: adjust buffer writing sizes based on server config, frame size updates from peer, etc - bw *bufio.Writer // writing to a chunkWriter{this *responseWriterState} - - // mutated by http.Handler goroutine: - handlerHeader http.Header // nil until called - snapHeader http.Header // snapshot of handlerHeader at WriteHeader time - trailers []string // set in writeChunk - status int // status code passed to WriteHeader - wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet. - sentHeader bool // have we sent the header frame? - handlerDone bool // handler has finished - dirty bool // a Write failed; don't reuse this responseWriterState - - sentContentLen int64 // non-zero if handler set a Content-Length header - wroteBytes int64 - - closeNotifierMu sync.Mutex // guards closeNotifierCh - closeNotifierCh chan bool // nil until first used -} - -type chunkWriter struct{ rws *responseWriterState } - -func (cw chunkWriter) Write(p []byte) (n int, err error) { return cw.rws.writeChunk(p) } - -func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) > 0 } - -func (rws *responseWriterState) hasNonemptyTrailers() bool { - for _, trailer := range rws.trailers { - if _, ok := rws.handlerHeader[trailer]; ok { - return true - } - } - return false -} - -// declareTrailer is called for each Trailer header when the -// response header is written. It notes that a header will need to be -// written in the trailers at the end of the response. -func (rws *responseWriterState) declareTrailer(k string) { - k = http.CanonicalHeaderKey(k) - if !httpguts.ValidTrailerHeader(k) { - // Forbidden by RFC 7230, section 4.1.2. - rws.conn.logf("ignoring invalid trailer %q", k) - return - } - if !strSliceContains(rws.trailers, k) { - rws.trailers = append(rws.trailers, k) - } -} - -// writeChunk writes chunks from the bufio.Writer. But because -// bufio.Writer may bypass its chunking, sometimes p may be -// arbitrarily large. -// -// writeChunk is also responsible (on the first chunk) for sending the -// HEADER response. -func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { - if !rws.wroteHeader { - rws.writeHeader(200) - } - - isHeadResp := rws.req.Method == "HEAD" - if !rws.sentHeader { - rws.sentHeader = true - var ctype, clen string - if clen = rws.snapHeader.Get("Content-Length"); clen != "" { - rws.snapHeader.Del("Content-Length") - clen64, err := strconv.ParseInt(clen, 10, 64) - if err == nil && clen64 >= 0 { - rws.sentContentLen = clen64 - } else { - clen = "" - } - } - if clen == "" && rws.handlerDone && bodyAllowedForStatus(rws.status) && (len(p) > 0 || !isHeadResp) { - clen = strconv.Itoa(len(p)) - } - _, hasContentType := rws.snapHeader["Content-Type"] - // If the Content-Encoding is non-blank, we shouldn't - // sniff the body. See Issue golang.org/issue/31753. - ce := rws.snapHeader.Get("Content-Encoding") - hasCE := len(ce) > 0 - if !hasCE && !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 { - ctype = http.DetectContentType(p) - } - var date string - if _, ok := rws.snapHeader["Date"]; !ok { - // TODO(bradfitz): be faster here, like net/http? measure. - date = time.Now().UTC().Format(http.TimeFormat) - } - - for _, v := range rws.snapHeader["Trailer"] { - foreachHeaderElement(v, rws.declareTrailer) - } - - // "Connection" headers aren't allowed in HTTP/2 (RFC 7540, 8.1.2.2), - // but respect "Connection" == "close" to mean sending a GOAWAY and tearing - // down the TCP connection when idle, like we do for HTTP/1. - // TODO: remove more Connection-specific header fields here, in addition - // to "Connection". - if _, ok := rws.snapHeader["Connection"]; ok { - v := rws.snapHeader.Get("Connection") - delete(rws.snapHeader, "Connection") - if v == "close" { - rws.conn.startGracefulShutdown() - } - } - - endStream := (rws.handlerDone && !rws.hasTrailers() && len(p) == 0) || isHeadResp - err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{ - streamID: rws.stream.id, - httpResCode: rws.status, - h: rws.snapHeader, - endStream: endStream, - contentType: ctype, - contentLength: clen, - date: date, - }) - if err != nil { - rws.dirty = true - return 0, err - } - if endStream { - return 0, nil - } - } - if isHeadResp { - return len(p), nil - } - if len(p) == 0 && !rws.handlerDone { - return 0, nil - } - - if rws.handlerDone { - rws.promoteUndeclaredTrailers() - } - - // only send trailers if they have actually been defined by the - // server handler. - hasNonemptyTrailers := rws.hasNonemptyTrailers() - endStream := rws.handlerDone && !hasNonemptyTrailers - if len(p) > 0 || endStream { - // only send a 0 byte DATA frame if we're ending the stream. - if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil { - rws.dirty = true - return 0, err - } - } - - if rws.handlerDone && hasNonemptyTrailers { - err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{ - streamID: rws.stream.id, - h: rws.handlerHeader, - trailers: rws.trailers, - endStream: true, - }) - if err != nil { - rws.dirty = true - } - return len(p), err - } - return len(p), nil -} - -// TrailerPrefix is a magic prefix for ResponseWriter.Header map keys -// that, if present, signals that the map entry is actually for -// the response trailers, and not the response headers. The prefix -// is stripped after the ServeHTTP call finishes and the values are -// sent in the trailers. -// -// This mechanism is intended only for trailers that are not known -// prior to the headers being written. If the set of trailers is fixed -// or known before the header is written, the normal Go trailers mechanism -// is preferred: -// https://golang.org/pkg/net/http/#ResponseWriter -// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers -const TrailerPrefix = "Trailer:" - -// promoteUndeclaredTrailers permits http.Handlers to set trailers -// after the header has already been flushed. Because the Go -// ResponseWriter interface has no way to set Trailers (only the -// Header), and because we didn't want to expand the ResponseWriter -// interface, and because nobody used trailers, and because RFC 7230 -// says you SHOULD (but not must) predeclare any trailers in the -// header, the official ResponseWriter rules said trailers in Go must -// be predeclared, and then we reuse the same ResponseWriter.Header() -// map to mean both Headers and Trailers. When it's time to write the -// Trailers, we pick out the fields of Headers that were declared as -// trailers. That worked for a while, until we found the first major -// user of Trailers in the wild: gRPC (using them only over http2), -// and gRPC libraries permit setting trailers mid-stream without -// predeclaring them. So: change of plans. We still permit the old -// way, but we also permit this hack: if a Header() key begins with -// "Trailer:", the suffix of that key is a Trailer. Because ':' is an -// invalid token byte anyway, there is no ambiguity. (And it's already -// filtered out) It's mildly hacky, but not terrible. -// -// This method runs after the Handler is done and promotes any Header -// fields to be trailers. -func (rws *responseWriterState) promoteUndeclaredTrailers() { - for k, vv := range rws.handlerHeader { - if !strings.HasPrefix(k, TrailerPrefix) { - continue - } - trailerKey := strings.TrimPrefix(k, TrailerPrefix) - rws.declareTrailer(trailerKey) - rws.handlerHeader[http.CanonicalHeaderKey(trailerKey)] = vv - } - - if len(rws.trailers) > 1 { - sorter := sorterPool.Get().(*sorter) - sorter.SortStrings(rws.trailers) - sorterPool.Put(sorter) - } -} - -func (w *responseWriter) Flush() { - rws := w.rws - if rws == nil { - panic("Header called after Handler finished") - } - if rws.bw.Buffered() > 0 { - if err := rws.bw.Flush(); err != nil { - // Ignore the error. The frame writer already knows. - return - } - } else { - // The bufio.Writer won't call chunkWriter.Write - // (writeChunk with zero bytes, so we have to do it - // ourselves to force the HTTP response header and/or - // final DATA frame (with END_STREAM) to be sent. - rws.writeChunk(nil) - } -} - -func (w *responseWriter) CloseNotify() <-chan bool { - rws := w.rws - if rws == nil { - panic("CloseNotify called after Handler finished") - } - rws.closeNotifierMu.Lock() - ch := rws.closeNotifierCh - if ch == nil { - ch = make(chan bool, 1) - rws.closeNotifierCh = ch - cw := rws.stream.cw - go func() { - cw.Wait() // wait for close - ch <- true - }() - } - rws.closeNotifierMu.Unlock() - return ch -} - -func (w *responseWriter) Header() http.Header { - rws := w.rws - if rws == nil { - panic("Header called after Handler finished") - } - if rws.handlerHeader == nil { - rws.handlerHeader = make(http.Header) - } - return rws.handlerHeader -} - -// checkWriteHeaderCode is a copy of net/http's checkWriteHeaderCode. -func checkWriteHeaderCode(code int) { - // Issue 22880: require valid WriteHeader status codes. - // For now we only enforce that it's three digits. - // In the future we might block things over 599 (600 and above aren't defined - // at http://httpwg.org/specs/rfc7231.html#status.codes) - // and we might block under 200 (once we have more mature 1xx support). - // But for now any three digits. - // - // We used to send "HTTP/1.1 000 0" on the wire in responses but there's - // no equivalent bogus thing we can realistically send in HTTP/2, - // so we'll consistently panic instead and help people find their bugs - // early. (We can't return an error from WriteHeader even if we wanted to.) - if code < 100 || code > 999 { - panic(fmt.Sprintf("invalid WriteHeader code %v", code)) - } -} - -func (w *responseWriter) WriteHeader(code int) { - rws := w.rws - if rws == nil { - panic("WriteHeader called after Handler finished") - } - rws.writeHeader(code) -} - -func (rws *responseWriterState) writeHeader(code int) { - if !rws.wroteHeader { - checkWriteHeaderCode(code) - rws.wroteHeader = true - rws.status = code - if len(rws.handlerHeader) > 0 { - rws.snapHeader = cloneHeader(rws.handlerHeader) - } - } -} - -func cloneHeader(h http.Header) http.Header { - h2 := make(http.Header, len(h)) - for k, vv := range h { - vv2 := make([]string, len(vv)) - copy(vv2, vv) - h2[k] = vv2 - } - return h2 -} - -// The Life Of A Write is like this: -// -// * Handler calls w.Write or w.WriteString -> -// * -> rws.bw (*bufio.Writer) -> -// * (Handler might call Flush) -// * -> chunkWriter{rws} -// * -> responseWriterState.writeChunk(p []byte) -// * -> responseWriterState.writeChunk (most of the magic; see comment there) -func (w *responseWriter) Write(p []byte) (n int, err error) { - return w.write(len(p), p, "") -} - -func (w *responseWriter) WriteString(s string) (n int, err error) { - return w.write(len(s), nil, s) -} - -// either dataB or dataS is non-zero. -func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int, err error) { - rws := w.rws - if rws == nil { - panic("Write called after Handler finished") - } - if !rws.wroteHeader { - w.WriteHeader(200) - } - if !bodyAllowedForStatus(rws.status) { - return 0, http.ErrBodyNotAllowed - } - rws.wroteBytes += int64(len(dataB)) + int64(len(dataS)) // only one can be set - if rws.sentContentLen != 0 && rws.wroteBytes > rws.sentContentLen { - // TODO: send a RST_STREAM - return 0, errors.New("http2: handler wrote more than declared Content-Length") - } - - if dataB != nil { - return rws.bw.Write(dataB) - } else { - return rws.bw.WriteString(dataS) - } -} - -func (w *responseWriter) handlerDone() { - rws := w.rws - dirty := rws.dirty - rws.handlerDone = true - w.Flush() - w.rws = nil - if !dirty { - // Only recycle the pool if all prior Write calls to - // the serverConn goroutine completed successfully. If - // they returned earlier due to resets from the peer - // there might still be write goroutines outstanding - // from the serverConn referencing the rws memory. See - // issue 20704. - responseWriterStatePool.Put(rws) - } -} - -// Push errors. -var ( - ErrRecursivePush = errors.New("http2: recursive push not allowed") - ErrPushLimitReached = errors.New("http2: push would exceed peer's SETTINGS_MAX_CONCURRENT_STREAMS") -) - -var _ http.Pusher = (*responseWriter)(nil) - -func (w *responseWriter) Push(target string, opts *http.PushOptions) error { - st := w.rws.stream - sc := st.sc - sc.serveG.checkNotOn() - - // No recursive pushes: "PUSH_PROMISE frames MUST only be sent on a peer-initiated stream." - // http://tools.ietf.org/html/rfc7540#section-6.6 - if st.isPushed() { - return ErrRecursivePush - } - - if opts == nil { - opts = new(http.PushOptions) - } - - // Default options. - if opts.Method == "" { - opts.Method = "GET" - } - if opts.Header == nil { - opts.Header = http.Header{} - } - wantScheme := "http" - if w.rws.req.TLS != nil { - wantScheme = "https" - } - - // Validate the request. - u, err := url.Parse(target) - if err != nil { - return err - } - if u.Scheme == "" { - if !strings.HasPrefix(target, "/") { - return fmt.Errorf("target must be an absolute URL or an absolute path: %q", target) - } - u.Scheme = wantScheme - u.Host = w.rws.req.Host - } else { - if u.Scheme != wantScheme { - return fmt.Errorf("cannot push URL with scheme %q from request with scheme %q", u.Scheme, wantScheme) - } - if u.Host == "" { - return errors.New("URL must have a host") - } - } - for k := range opts.Header { - if strings.HasPrefix(k, ":") { - return fmt.Errorf("promised request headers cannot include pseudo header %q", k) - } - // These headers are meaningful only if the request has a body, - // but PUSH_PROMISE requests cannot have a body. - // http://tools.ietf.org/html/rfc7540#section-8.2 - // Also disallow Host, since the promised URL must be absolute. - switch strings.ToLower(k) { - case "content-length", "content-encoding", "trailer", "te", "expect", "host": - return fmt.Errorf("promised request headers cannot include %q", k) - } - } - if err := checkValidHTTP2RequestHeaders(opts.Header); err != nil { - return err - } - - // The RFC effectively limits promised requests to GET and HEAD: - // "Promised requests MUST be cacheable [GET, HEAD, or POST], and MUST be safe [GET or HEAD]" - // http://tools.ietf.org/html/rfc7540#section-8.2 - if opts.Method != "GET" && opts.Method != "HEAD" { - return fmt.Errorf("method %q must be GET or HEAD", opts.Method) - } - - msg := &startPushRequest{ - parent: st, - method: opts.Method, - url: u, - header: cloneHeader(opts.Header), - done: errChanPool.Get().(chan error), - } - - select { - case <-sc.doneServing: - return errClientDisconnected - case <-st.cw: - return errStreamClosed - case sc.serveMsgCh <- msg: - } - - select { - case <-sc.doneServing: - return errClientDisconnected - case <-st.cw: - return errStreamClosed - case err := <-msg.done: - errChanPool.Put(msg.done) - return err - } -} - -type startPushRequest struct { - parent *stream - method string - url *url.URL - header http.Header - done chan error -} - -func (sc *serverConn) startPush(msg *startPushRequest) { - sc.serveG.check() - - // http://tools.ietf.org/html/rfc7540#section-6.6. - // PUSH_PROMISE frames MUST only be sent on a peer-initiated stream that - // is in either the "open" or "half-closed (remote)" state. - if msg.parent.state != stateOpen && msg.parent.state != stateHalfClosedRemote { - // responseWriter.Push checks that the stream is peer-initiated. - msg.done <- errStreamClosed - return - } - - // http://tools.ietf.org/html/rfc7540#section-6.6. - if !sc.pushEnabled { - msg.done <- http.ErrNotSupported - return - } - - // PUSH_PROMISE frames must be sent in increasing order by stream ID, so - // we allocate an ID for the promised stream lazily, when the PUSH_PROMISE - // is written. Once the ID is allocated, we start the request handler. - allocatePromisedID := func() (uint32, error) { - sc.serveG.check() - - // Check this again, just in case. Technically, we might have received - // an updated SETTINGS by the time we got around to writing this frame. - if !sc.pushEnabled { - return 0, http.ErrNotSupported - } - // http://tools.ietf.org/html/rfc7540#section-6.5.2. - if sc.curPushedStreams+1 > sc.clientMaxStreams { - return 0, ErrPushLimitReached - } - - // http://tools.ietf.org/html/rfc7540#section-5.1.1. - // Streams initiated by the server MUST use even-numbered identifiers. - // A server that is unable to establish a new stream identifier can send a GOAWAY - // frame so that the client is forced to open a new connection for new streams. - if sc.maxPushPromiseID+2 >= 1<<31 { - sc.startGracefulShutdownInternal() - return 0, ErrPushLimitReached - } - sc.maxPushPromiseID += 2 - promisedID := sc.maxPushPromiseID - - // http://tools.ietf.org/html/rfc7540#section-8.2. - // Strictly speaking, the new stream should start in "reserved (local)", then - // transition to "half closed (remote)" after sending the initial HEADERS, but - // we start in "half closed (remote)" for simplicity. - // See further comments at the definition of stateHalfClosedRemote. - promised := sc.newStream(promisedID, msg.parent.id, stateHalfClosedRemote) - rw, req, err := sc.newWriterAndRequestNoBody(promised, requestParam{ - method: msg.method, - scheme: msg.url.Scheme, - authority: msg.url.Host, - path: msg.url.RequestURI(), - header: cloneHeader(msg.header), // clone since handler runs concurrently with writing the PUSH_PROMISE - }) - if err != nil { - // Should not happen, since we've already validated msg.url. - panic(fmt.Sprintf("newWriterAndRequestNoBody(%+v): %v", msg.url, err)) - } - - go sc.runHandler(rw, req, sc.handler.ServeHTTP) - return promisedID, nil - } - - sc.writeFrame(FrameWriteRequest{ - write: &writePushPromise{ - streamID: msg.parent.id, - method: msg.method, - url: msg.url, - h: msg.header, - allocatePromisedID: allocatePromisedID, - }, - stream: msg.parent, - done: msg.done, - }) -} - -// foreachHeaderElement splits v according to the "#rule" construction -// in RFC 7230 section 7 and calls fn for each non-empty element. -func foreachHeaderElement(v string, fn func(string)) { - v = textproto.TrimString(v) - if v == "" { - return - } - if !strings.Contains(v, ",") { - fn(v) - return - } - for _, f := range strings.Split(v, ",") { - if f = textproto.TrimString(f); f != "" { - fn(f) - } - } -} - -// From http://httpwg.org/specs/rfc7540.html#rfc.section.8.1.2.2 -var connHeaders = []string{ - "Connection", - "Keep-Alive", - "Proxy-Connection", - "Transfer-Encoding", - "Upgrade", -} - -// checkValidHTTP2RequestHeaders checks whether h is a valid HTTP/2 request, -// per RFC 7540 Section 8.1.2.2. -// The returned error is reported to users. -func checkValidHTTP2RequestHeaders(h http.Header) error { - for _, k := range connHeaders { - if _, ok := h[k]; ok { - return fmt.Errorf("request header %q is not valid in HTTP/2", k) - } - } - te := h["Te"] - if len(te) > 0 && (len(te) > 1 || (te[0] != "trailers" && te[0] != "")) { - return errors.New(`request header "TE" may only be "trailers" in HTTP/2`) - } - return nil -} - -func new400Handler(err error) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - http.Error(w, err.Error(), http.StatusBadRequest) - } -} - -// h1ServerKeepAlivesDisabled reports whether hs has its keep-alives -// disabled. See comments on h1ServerShutdownChan above for why -// the code is written this way. -func h1ServerKeepAlivesDisabled(hs *http.Server) bool { - var x interface{} = hs - type I interface { - doKeepAlives() bool - } - if hs, ok := x.(I); ok { - return !hs.doKeepAlives() - } - return false -} diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go deleted file mode 100644 index 76a92e0ca..000000000 --- a/vendor/golang.org/x/net/http2/transport.go +++ /dev/null @@ -1,2732 +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. - -// Transport code. - -package http2 - -import ( - "bufio" - "bytes" - "compress/gzip" - "context" - "crypto/rand" - "crypto/tls" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "math" - mathrand "math/rand" - "net" - "net/http" - "net/http/httptrace" - "net/textproto" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/http/httpguts" - "golang.org/x/net/http2/hpack" - "golang.org/x/net/idna" -) - -const ( - // transportDefaultConnFlow is how many connection-level flow control - // tokens we give the server at start-up, past the default 64k. - transportDefaultConnFlow = 1 << 30 - - // transportDefaultStreamFlow is how many stream-level flow - // control tokens we announce to the peer, and how many bytes - // we buffer per stream. - transportDefaultStreamFlow = 4 << 20 - - // transportDefaultStreamMinRefresh is the minimum number of bytes we'll send - // a stream-level WINDOW_UPDATE for at a time. - transportDefaultStreamMinRefresh = 4 << 10 - - defaultUserAgent = "Go-http-client/2.0" -) - -// Transport is an HTTP/2 Transport. -// -// A Transport internally caches connections to servers. It is safe -// for concurrent use by multiple goroutines. -type Transport struct { - // DialTLS specifies an optional dial function for creating - // TLS connections for requests. - // - // If DialTLS is nil, tls.Dial is used. - // - // If the returned net.Conn has a ConnectionState method like tls.Conn, - // it will be used to set http.Response.TLS. - DialTLS func(network, addr string, cfg *tls.Config) (net.Conn, error) - - // TLSClientConfig specifies the TLS configuration to use with - // tls.Client. If nil, the default configuration is used. - TLSClientConfig *tls.Config - - // ConnPool optionally specifies an alternate connection pool to use. - // If nil, the default is used. - ConnPool ClientConnPool - - // DisableCompression, if true, prevents the Transport from - // requesting compression with an "Accept-Encoding: gzip" - // request header when the Request contains no existing - // Accept-Encoding value. If the Transport requests gzip on - // its own and gets a gzipped response, it's transparently - // decoded in the Response.Body. However, if the user - // explicitly requested gzip it is not automatically - // uncompressed. - DisableCompression bool - - // AllowHTTP, if true, permits HTTP/2 requests using the insecure, - // plain-text "http" scheme. Note that this does not enable h2c support. - AllowHTTP bool - - // MaxHeaderListSize is the http2 SETTINGS_MAX_HEADER_LIST_SIZE to - // send in the initial settings frame. It is how many bytes - // of response headers are allowed. Unlike the http2 spec, zero here - // means to use a default limit (currently 10MB). If you actually - // want to advertise an unlimited value to the peer, Transport - // interprets the highest possible value here (0xffffffff or 1<<32-1) - // to mean no limit. - MaxHeaderListSize uint32 - - // StrictMaxConcurrentStreams controls whether the server's - // SETTINGS_MAX_CONCURRENT_STREAMS should be respected - // globally. If false, new TCP connections are created to the - // server as needed to keep each under the per-connection - // SETTINGS_MAX_CONCURRENT_STREAMS limit. If true, the - // server's SETTINGS_MAX_CONCURRENT_STREAMS is interpreted as - // a global limit and callers of RoundTrip block when needed, - // waiting for their turn. - StrictMaxConcurrentStreams bool - - // ReadIdleTimeout is the timeout after which a health check using ping - // frame will be carried out if no frame is received on the connection. - // Note that a ping response will is considered a received frame, so if - // there is no other traffic on the connection, the health check will - // be performed every ReadIdleTimeout interval. - // If zero, no health check is performed. - ReadIdleTimeout time.Duration - - // PingTimeout is the timeout after which the connection will be closed - // if a response to Ping is not received. - // Defaults to 15s. - PingTimeout time.Duration - - // t1, if non-nil, is the standard library Transport using - // this transport. Its settings are used (but not its - // RoundTrip method, etc). - t1 *http.Transport - - connPoolOnce sync.Once - connPoolOrDef ClientConnPool // non-nil version of ConnPool -} - -func (t *Transport) maxHeaderListSize() uint32 { - if t.MaxHeaderListSize == 0 { - return 10 << 20 - } - if t.MaxHeaderListSize == 0xffffffff { - return 0 - } - return t.MaxHeaderListSize -} - -func (t *Transport) disableCompression() bool { - return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression) -} - -func (t *Transport) pingTimeout() time.Duration { - if t.PingTimeout == 0 { - return 15 * time.Second - } - return t.PingTimeout - -} - -// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2. -// It returns an error if t1 has already been HTTP/2-enabled. -func ConfigureTransport(t1 *http.Transport) error { - _, err := configureTransport(t1) - return err -} - -func configureTransport(t1 *http.Transport) (*Transport, error) { - connPool := new(clientConnPool) - t2 := &Transport{ - ConnPool: noDialClientConnPool{connPool}, - t1: t1, - } - connPool.t = t2 - if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil { - return nil, err - } - if t1.TLSClientConfig == nil { - t1.TLSClientConfig = new(tls.Config) - } - if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") { - t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...) - } - if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") { - t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1") - } - upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper { - addr := authorityAddr("https", authority) - if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil { - go c.Close() - return erringRoundTripper{err} - } else if !used { - // Turns out we don't need this c. - // For example, two goroutines made requests to the same host - // at the same time, both kicking off TCP dials. (since protocol - // was unknown) - go c.Close() - } - return t2 - } - if m := t1.TLSNextProto; len(m) == 0 { - t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{ - "h2": upgradeFn, - } - } else { - m["h2"] = upgradeFn - } - return t2, nil -} - -func (t *Transport) connPool() ClientConnPool { - t.connPoolOnce.Do(t.initConnPool) - return t.connPoolOrDef -} - -func (t *Transport) initConnPool() { - if t.ConnPool != nil { - t.connPoolOrDef = t.ConnPool - } else { - t.connPoolOrDef = &clientConnPool{t: t} - } -} - -// ClientConn is the state of a single HTTP/2 client connection to an -// HTTP/2 server. -type ClientConn struct { - t *Transport - tconn net.Conn // usually *tls.Conn, except specialized impls - tlsState *tls.ConnectionState // nil only for specialized impls - reused uint32 // whether conn is being reused; atomic - singleUse bool // whether being used for a single http.Request - - // readLoop goroutine fields: - readerDone chan struct{} // closed on error - readerErr error // set before readerDone is closed - - idleTimeout time.Duration // or 0 for never - idleTimer *time.Timer - - mu sync.Mutex // guards following - cond *sync.Cond // hold mu; broadcast on flow/closed changes - flow flow // our conn-level flow control quota (cs.flow is per stream) - inflow flow // peer's conn-level flow control - closing bool - closed bool - wantSettingsAck bool // we sent a SETTINGS frame and haven't heard back - goAway *GoAwayFrame // if non-nil, the GoAwayFrame we received - goAwayDebug string // goAway frame's debug data, retained as a string - streams map[uint32]*clientStream // client-initiated - nextStreamID uint32 - pendingRequests int // requests blocked and waiting to be sent because len(streams) == maxConcurrentStreams - pings map[[8]byte]chan struct{} // in flight ping data to notification channel - bw *bufio.Writer - br *bufio.Reader - fr *Framer - lastActive time.Time - lastIdle time.Time // time last idle - // Settings from peer: (also guarded by mu) - maxFrameSize uint32 - maxConcurrentStreams uint32 - peerMaxHeaderListSize uint64 - initialWindowSize uint32 - - hbuf bytes.Buffer // HPACK encoder writes into this - henc *hpack.Encoder - freeBuf [][]byte - - wmu sync.Mutex // held while writing; acquire AFTER mu if holding both - werr error // first write error that has occurred -} - -// clientStream is the state for a single HTTP/2 stream. One of these -// is created for each Transport.RoundTrip call. -type clientStream struct { - cc *ClientConn - req *http.Request - trace *httptrace.ClientTrace // or nil - ID uint32 - resc chan resAndError - bufPipe pipe // buffered pipe with the flow-controlled response payload - startedWrite bool // started request body write; guarded by cc.mu - requestedGzip bool - on100 func() // optional code to run if get a 100 continue response - - flow flow // guarded by cc.mu - inflow flow // guarded by cc.mu - bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read - readErr error // sticky read error; owned by transportResponseBody.Read - stopReqBody error // if non-nil, stop writing req body; guarded by cc.mu - didReset bool // whether we sent a RST_STREAM to the server; guarded by cc.mu - - peerReset chan struct{} // closed on peer reset - resetErr error // populated before peerReset is closed - - done chan struct{} // closed when stream remove from cc.streams map; close calls guarded by cc.mu - - // owned by clientConnReadLoop: - firstByte bool // got the first response byte - pastHeaders bool // got first MetaHeadersFrame (actual headers) - pastTrailers bool // got optional second MetaHeadersFrame (trailers) - num1xx uint8 // number of 1xx responses seen - - trailer http.Header // accumulated trailers - resTrailer *http.Header // client's Response.Trailer -} - -// awaitRequestCancel waits for the user to cancel a request or for the done -// channel to be signaled. A non-nil error is returned only if the request was -// canceled. -func awaitRequestCancel(req *http.Request, done <-chan struct{}) error { - ctx := req.Context() - if req.Cancel == nil && ctx.Done() == nil { - return nil - } - select { - case <-req.Cancel: - return errRequestCanceled - case <-ctx.Done(): - return ctx.Err() - case <-done: - return nil - } -} - -var got1xxFuncForTests func(int, textproto.MIMEHeader) error - -// get1xxTraceFunc returns the value of request's httptrace.ClientTrace.Got1xxResponse func, -// if any. It returns nil if not set or if the Go version is too old. -func (cs *clientStream) get1xxTraceFunc() func(int, textproto.MIMEHeader) error { - if fn := got1xxFuncForTests; fn != nil { - return fn - } - return traceGot1xxResponseFunc(cs.trace) -} - -// awaitRequestCancel waits for the user to cancel a request, its context to -// expire, or for the request to be done (any way it might be removed from the -// cc.streams map: peer reset, successful completion, TCP connection breakage, -// etc). If the request is canceled, then cs will be canceled and closed. -func (cs *clientStream) awaitRequestCancel(req *http.Request) { - if err := awaitRequestCancel(req, cs.done); err != nil { - cs.cancelStream() - cs.bufPipe.CloseWithError(err) - } -} - -func (cs *clientStream) cancelStream() { - cc := cs.cc - cc.mu.Lock() - didReset := cs.didReset - cs.didReset = true - cc.mu.Unlock() - - if !didReset { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - cc.forgetStreamID(cs.ID) - } -} - -// checkResetOrDone reports any error sent in a RST_STREAM frame by the -// server, or errStreamClosed if the stream is complete. -func (cs *clientStream) checkResetOrDone() error { - select { - case <-cs.peerReset: - return cs.resetErr - case <-cs.done: - return errStreamClosed - default: - return nil - } -} - -func (cs *clientStream) getStartedWrite() bool { - cc := cs.cc - cc.mu.Lock() - defer cc.mu.Unlock() - return cs.startedWrite -} - -func (cs *clientStream) abortRequestBodyWrite(err error) { - if err == nil { - panic("nil error") - } - cc := cs.cc - cc.mu.Lock() - cs.stopReqBody = err - cc.cond.Broadcast() - cc.mu.Unlock() -} - -type stickyErrWriter struct { - w io.Writer - err *error -} - -func (sew stickyErrWriter) Write(p []byte) (n int, err error) { - if *sew.err != nil { - return 0, *sew.err - } - n, err = sew.w.Write(p) - *sew.err = err - return -} - -// noCachedConnError is the concrete type of ErrNoCachedConn, which -// needs to be detected by net/http regardless of whether it's its -// bundled version (in h2_bundle.go with a rewritten type name) or -// from a user's x/net/http2. As such, as it has a unique method name -// (IsHTTP2NoCachedConnError) that net/http sniffs for via func -// isNoCachedConnError. -type noCachedConnError struct{} - -func (noCachedConnError) IsHTTP2NoCachedConnError() {} -func (noCachedConnError) Error() string { return "http2: no cached connection was available" } - -// isNoCachedConnError reports whether err is of type noCachedConnError -// or its equivalent renamed type in net/http2's h2_bundle.go. Both types -// may coexist in the same running program. -func isNoCachedConnError(err error) bool { - _, ok := err.(interface{ IsHTTP2NoCachedConnError() }) - return ok -} - -var ErrNoCachedConn error = noCachedConnError{} - -// RoundTripOpt are options for the Transport.RoundTripOpt method. -type RoundTripOpt struct { - // OnlyCachedConn controls whether RoundTripOpt may - // create a new TCP connection. If set true and - // no cached connection is available, RoundTripOpt - // will return ErrNoCachedConn. - OnlyCachedConn bool -} - -func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { - return t.RoundTripOpt(req, RoundTripOpt{}) -} - -// authorityAddr returns a given authority (a host/IP, or host:port / ip:port) -// and returns a host:port. The port 443 is added if needed. -func authorityAddr(scheme string, authority string) (addr string) { - host, port, err := net.SplitHostPort(authority) - if err != nil { // authority didn't have a port - port = "443" - if scheme == "http" { - port = "80" - } - host = authority - } - if a, err := idna.ToASCII(host); err == nil { - host = a - } - // IPv6 address literal, without a port: - if strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]") { - return host + ":" + port - } - return net.JoinHostPort(host, port) -} - -// RoundTripOpt is like RoundTrip, but takes options. -func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) { - if !(req.URL.Scheme == "https" || (req.URL.Scheme == "http" && t.AllowHTTP)) { - return nil, errors.New("http2: unsupported scheme") - } - - addr := authorityAddr(req.URL.Scheme, req.URL.Host) - for retry := 0; ; retry++ { - cc, err := t.connPool().GetClientConn(req, addr) - if err != nil { - t.vlogf("http2: Transport failed to get client conn for %s: %v", addr, err) - return nil, err - } - reused := !atomic.CompareAndSwapUint32(&cc.reused, 0, 1) - traceGotConn(req, cc, reused) - res, gotErrAfterReqBodyWrite, err := cc.roundTrip(req) - if err != nil && retry <= 6 { - if req, err = shouldRetryRequest(req, err, gotErrAfterReqBodyWrite); err == nil { - // After the first retry, do exponential backoff with 10% jitter. - if retry == 0 { - continue - } - backoff := float64(uint(1) << (uint(retry) - 1)) - backoff += backoff * (0.1 * mathrand.Float64()) - select { - case <-time.After(time.Second * time.Duration(backoff)): - continue - case <-req.Context().Done(): - return nil, req.Context().Err() - } - } - } - if err != nil { - t.vlogf("RoundTrip failure: %v", err) - return nil, err - } - return res, nil - } -} - -// CloseIdleConnections closes any connections which were previously -// connected from previous requests but are now sitting idle. -// It does not interrupt any connections currently in use. -func (t *Transport) CloseIdleConnections() { - if cp, ok := t.connPool().(clientConnPoolIdleCloser); ok { - cp.closeIdleConnections() - } -} - -var ( - errClientConnClosed = errors.New("http2: client conn is closed") - errClientConnUnusable = errors.New("http2: client conn not usable") - errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY") -) - -// shouldRetryRequest is called by RoundTrip when a request fails to get -// response headers. It is always called with a non-nil error. -// It returns either a request to retry (either the same request, or a -// modified clone), or an error if the request can't be replayed. -func shouldRetryRequest(req *http.Request, err error, afterBodyWrite bool) (*http.Request, error) { - if !canRetryError(err) { - return nil, err - } - // If the Body is nil (or http.NoBody), it's safe to reuse - // this request and its Body. - if req.Body == nil || req.Body == http.NoBody { - return req, nil - } - - // If the request body can be reset back to its original - // state via the optional req.GetBody, do that. - if req.GetBody != nil { - // TODO: consider a req.Body.Close here? or audit that all caller paths do? - body, err := req.GetBody() - if err != nil { - return nil, err - } - newReq := *req - newReq.Body = body - return &newReq, nil - } - - // The Request.Body can't reset back to the beginning, but we - // don't seem to have started to read from it yet, so reuse - // the request directly. The "afterBodyWrite" means the - // bodyWrite process has started, which becomes true before - // the first Read. - if !afterBodyWrite { - return req, nil - } - - return nil, fmt.Errorf("http2: Transport: cannot retry err [%v] after Request.Body was written; define Request.GetBody to avoid this error", err) -} - -func canRetryError(err error) bool { - if err == errClientConnUnusable || err == errClientConnGotGoAway { - return true - } - if se, ok := err.(StreamError); ok { - return se.Code == ErrCodeRefusedStream - } - return false -} - -func (t *Transport) dialClientConn(addr string, singleUse bool) (*ClientConn, error) { - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - tconn, err := t.dialTLS()("tcp", addr, t.newTLSConfig(host)) - if err != nil { - return nil, err - } - return t.newClientConn(tconn, singleUse) -} - -func (t *Transport) newTLSConfig(host string) *tls.Config { - cfg := new(tls.Config) - if t.TLSClientConfig != nil { - *cfg = *t.TLSClientConfig.Clone() - } - if !strSliceContains(cfg.NextProtos, NextProtoTLS) { - cfg.NextProtos = append([]string{NextProtoTLS}, cfg.NextProtos...) - } - if cfg.ServerName == "" { - cfg.ServerName = host - } - return cfg -} - -func (t *Transport) dialTLS() func(string, string, *tls.Config) (net.Conn, error) { - if t.DialTLS != nil { - return t.DialTLS - } - return t.dialTLSDefault -} - -func (t *Transport) dialTLSDefault(network, addr string, cfg *tls.Config) (net.Conn, error) { - cn, err := tls.Dial(network, addr, cfg) - if err != nil { - return nil, err - } - if err := cn.Handshake(); err != nil { - return nil, err - } - if !cfg.InsecureSkipVerify { - if err := cn.VerifyHostname(cfg.ServerName); err != nil { - return nil, err - } - } - state := cn.ConnectionState() - if p := state.NegotiatedProtocol; p != NextProtoTLS { - return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) - } - if !state.NegotiatedProtocolIsMutual { - return nil, errors.New("http2: could not negotiate protocol mutually") - } - return cn, nil -} - -// disableKeepAlives reports whether connections should be closed as -// soon as possible after handling the first request. -func (t *Transport) disableKeepAlives() bool { - return t.t1 != nil && t.t1.DisableKeepAlives -} - -func (t *Transport) expectContinueTimeout() time.Duration { - if t.t1 == nil { - return 0 - } - return t.t1.ExpectContinueTimeout -} - -func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) { - return t.newClientConn(c, t.disableKeepAlives()) -} - -func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) { - cc := &ClientConn{ - t: t, - tconn: c, - readerDone: make(chan struct{}), - nextStreamID: 1, - maxFrameSize: 16 << 10, // spec default - initialWindowSize: 65535, // spec default - maxConcurrentStreams: 1000, // "infinite", per spec. 1000 seems good enough. - peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead. - streams: make(map[uint32]*clientStream), - singleUse: singleUse, - wantSettingsAck: true, - pings: make(map[[8]byte]chan struct{}), - } - if d := t.idleConnTimeout(); d != 0 { - cc.idleTimeout = d - cc.idleTimer = time.AfterFunc(d, cc.onIdleTimeout) - } - if VerboseLogs { - t.vlogf("http2: Transport creating client conn %p to %v", cc, c.RemoteAddr()) - } - - cc.cond = sync.NewCond(&cc.mu) - cc.flow.add(int32(initialWindowSize)) - - // TODO: adjust this writer size to account for frame size + - // MTU + crypto/tls record padding. - cc.bw = bufio.NewWriter(stickyErrWriter{c, &cc.werr}) - cc.br = bufio.NewReader(c) - cc.fr = NewFramer(cc.bw, cc.br) - cc.fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) - cc.fr.MaxHeaderListSize = t.maxHeaderListSize() - - // TODO: SetMaxDynamicTableSize, SetMaxDynamicTableSizeLimit on - // henc in response to SETTINGS frames? - cc.henc = hpack.NewEncoder(&cc.hbuf) - - if t.AllowHTTP { - cc.nextStreamID = 3 - } - - if cs, ok := c.(connectionStater); ok { - state := cs.ConnectionState() - cc.tlsState = &state - } - - initialSettings := []Setting{ - {ID: SettingEnablePush, Val: 0}, - {ID: SettingInitialWindowSize, Val: transportDefaultStreamFlow}, - } - if max := t.maxHeaderListSize(); max != 0 { - initialSettings = append(initialSettings, Setting{ID: SettingMaxHeaderListSize, Val: max}) - } - - cc.bw.Write(clientPreface) - cc.fr.WriteSettings(initialSettings...) - cc.fr.WriteWindowUpdate(0, transportDefaultConnFlow) - cc.inflow.add(transportDefaultConnFlow + initialWindowSize) - cc.bw.Flush() - if cc.werr != nil { - return nil, cc.werr - } - - go cc.readLoop() - return cc, nil -} - -func (cc *ClientConn) healthCheck() { - pingTimeout := cc.t.pingTimeout() - // We don't need to periodically ping in the health check, because the readLoop of ClientConn will - // trigger the healthCheck again if there is no frame received. - ctx, cancel := context.WithTimeout(context.Background(), pingTimeout) - defer cancel() - err := cc.Ping(ctx) - if err != nil { - cc.closeForLostPing() - cc.t.connPool().MarkDead(cc) - return - } -} - -func (cc *ClientConn) setGoAway(f *GoAwayFrame) { - cc.mu.Lock() - defer cc.mu.Unlock() - - old := cc.goAway - cc.goAway = f - - // Merge the previous and current GoAway error frames. - if cc.goAwayDebug == "" { - cc.goAwayDebug = string(f.DebugData()) - } - if old != nil && old.ErrCode != ErrCodeNo { - cc.goAway.ErrCode = old.ErrCode - } - last := f.LastStreamID - for streamID, cs := range cc.streams { - if streamID > last { - select { - case cs.resc <- resAndError{err: errClientConnGotGoAway}: - default: - } - } - } -} - -// CanTakeNewRequest reports whether the connection can take a new request, -// meaning it has not been closed or received or sent a GOAWAY. -func (cc *ClientConn) CanTakeNewRequest() bool { - cc.mu.Lock() - defer cc.mu.Unlock() - return cc.canTakeNewRequestLocked() -} - -// clientConnIdleState describes the suitability of a client -// connection to initiate a new RoundTrip request. -type clientConnIdleState struct { - canTakeNewRequest bool - freshConn bool // whether it's unused by any previous request -} - -func (cc *ClientConn) idleState() clientConnIdleState { - cc.mu.Lock() - defer cc.mu.Unlock() - return cc.idleStateLocked() -} - -func (cc *ClientConn) idleStateLocked() (st clientConnIdleState) { - if cc.singleUse && cc.nextStreamID > 1 { - return - } - var maxConcurrentOkay bool - if cc.t.StrictMaxConcurrentStreams { - // We'll tell the caller we can take a new request to - // prevent the caller from dialing a new TCP - // connection, but then we'll block later before - // writing it. - maxConcurrentOkay = true - } else { - maxConcurrentOkay = int64(len(cc.streams)+1) < int64(cc.maxConcurrentStreams) - } - - st.canTakeNewRequest = cc.goAway == nil && !cc.closed && !cc.closing && maxConcurrentOkay && - int64(cc.nextStreamID)+2*int64(cc.pendingRequests) < math.MaxInt32 && - !cc.tooIdleLocked() - st.freshConn = cc.nextStreamID == 1 && st.canTakeNewRequest - return -} - -func (cc *ClientConn) canTakeNewRequestLocked() bool { - st := cc.idleStateLocked() - return st.canTakeNewRequest -} - -// tooIdleLocked reports whether this connection has been been sitting idle -// for too much wall time. -func (cc *ClientConn) tooIdleLocked() bool { - // The Round(0) strips the monontonic clock reading so the - // times are compared based on their wall time. We don't want - // to reuse a connection that's been sitting idle during - // VM/laptop suspend if monotonic time was also frozen. - return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && time.Since(cc.lastIdle.Round(0)) > cc.idleTimeout -} - -// onIdleTimeout is called from a time.AfterFunc goroutine. It will -// only be called when we're idle, but because we're coming from a new -// goroutine, there could be a new request coming in at the same time, -// so this simply calls the synchronized closeIfIdle to shut down this -// connection. The timer could just call closeIfIdle, but this is more -// clear. -func (cc *ClientConn) onIdleTimeout() { - cc.closeIfIdle() -} - -func (cc *ClientConn) closeIfIdle() { - cc.mu.Lock() - if len(cc.streams) > 0 { - cc.mu.Unlock() - return - } - cc.closed = true - nextID := cc.nextStreamID - // TODO: do clients send GOAWAY too? maybe? Just Close: - cc.mu.Unlock() - - if VerboseLogs { - cc.vlogf("http2: Transport closing idle conn %p (forSingleUse=%v, maxStream=%v)", cc, cc.singleUse, nextID-2) - } - cc.tconn.Close() -} - -var shutdownEnterWaitStateHook = func() {} - -// Shutdown gracefully close the client connection, waiting for running streams to complete. -func (cc *ClientConn) Shutdown(ctx context.Context) error { - if err := cc.sendGoAway(); err != nil { - return err - } - // Wait for all in-flight streams to complete or connection to close - done := make(chan error, 1) - cancelled := false // guarded by cc.mu - go func() { - cc.mu.Lock() - defer cc.mu.Unlock() - for { - if len(cc.streams) == 0 || cc.closed { - cc.closed = true - done <- cc.tconn.Close() - break - } - if cancelled { - break - } - cc.cond.Wait() - } - }() - shutdownEnterWaitStateHook() - select { - case err := <-done: - return err - case <-ctx.Done(): - cc.mu.Lock() - // Free the goroutine above - cancelled = true - cc.cond.Broadcast() - cc.mu.Unlock() - return ctx.Err() - } -} - -func (cc *ClientConn) sendGoAway() error { - cc.mu.Lock() - defer cc.mu.Unlock() - cc.wmu.Lock() - defer cc.wmu.Unlock() - if cc.closing { - // GOAWAY sent already - return nil - } - // Send a graceful shutdown frame to server - maxStreamID := cc.nextStreamID - if err := cc.fr.WriteGoAway(maxStreamID, ErrCodeNo, nil); err != nil { - return err - } - if err := cc.bw.Flush(); err != nil { - return err - } - // Prevent new requests - cc.closing = true - return nil -} - -// closes the client connection immediately. In-flight requests are interrupted. -// err is sent to streams. -func (cc *ClientConn) closeForError(err error) error { - cc.mu.Lock() - defer cc.cond.Broadcast() - defer cc.mu.Unlock() - for id, cs := range cc.streams { - select { - case cs.resc <- resAndError{err: err}: - default: - } - cs.bufPipe.CloseWithError(err) - delete(cc.streams, id) - } - cc.closed = true - return cc.tconn.Close() -} - -// Close closes the client connection immediately. -// -// In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead. -func (cc *ClientConn) Close() error { - err := errors.New("http2: client connection force closed via ClientConn.Close") - return cc.closeForError(err) -} - -// closes the client connection immediately. In-flight requests are interrupted. -func (cc *ClientConn) closeForLostPing() error { - err := errors.New("http2: client connection lost") - return cc.closeForError(err) -} - -const maxAllocFrameSize = 512 << 10 - -// frameBuffer returns a scratch buffer suitable for writing DATA frames. -// They're capped at the min of the peer's max frame size or 512KB -// (kinda arbitrarily), but definitely capped so we don't allocate 4GB -// bufers. -func (cc *ClientConn) frameScratchBuffer() []byte { - cc.mu.Lock() - size := cc.maxFrameSize - if size > maxAllocFrameSize { - size = maxAllocFrameSize - } - for i, buf := range cc.freeBuf { - if len(buf) >= int(size) { - cc.freeBuf[i] = nil - cc.mu.Unlock() - return buf[:size] - } - } - cc.mu.Unlock() - return make([]byte, size) -} - -func (cc *ClientConn) putFrameScratchBuffer(buf []byte) { - cc.mu.Lock() - defer cc.mu.Unlock() - const maxBufs = 4 // arbitrary; 4 concurrent requests per conn? investigate. - if len(cc.freeBuf) < maxBufs { - cc.freeBuf = append(cc.freeBuf, buf) - return - } - for i, old := range cc.freeBuf { - if old == nil { - cc.freeBuf[i] = buf - return - } - } - // forget about it. -} - -// errRequestCanceled is a copy of net/http's errRequestCanceled because it's not -// exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests. -var errRequestCanceled = errors.New("net/http: request canceled") - -func commaSeparatedTrailers(req *http.Request) (string, error) { - keys := make([]string, 0, len(req.Trailer)) - for k := range req.Trailer { - k = http.CanonicalHeaderKey(k) - switch k { - case "Transfer-Encoding", "Trailer", "Content-Length": - return "", fmt.Errorf("invalid Trailer key %q", k) - } - keys = append(keys, k) - } - if len(keys) > 0 { - sort.Strings(keys) - return strings.Join(keys, ","), nil - } - return "", nil -} - -func (cc *ClientConn) responseHeaderTimeout() time.Duration { - if cc.t.t1 != nil { - return cc.t.t1.ResponseHeaderTimeout - } - // No way to do this (yet?) with just an http2.Transport. Probably - // no need. Request.Cancel this is the new way. We only need to support - // this for compatibility with the old http.Transport fields when - // we're doing transparent http2. - return 0 -} - -// checkConnHeaders checks whether req has any invalid connection-level headers. -// per RFC 7540 section 8.1.2.2: Connection-Specific Header Fields. -// Certain headers are special-cased as okay but not transmitted later. -func checkConnHeaders(req *http.Request) error { - if v := req.Header.Get("Upgrade"); v != "" { - return fmt.Errorf("http2: invalid Upgrade request header: %q", req.Header["Upgrade"]) - } - if vv := req.Header["Transfer-Encoding"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && vv[0] != "chunked") { - return fmt.Errorf("http2: invalid Transfer-Encoding request header: %q", vv) - } - if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !strings.EqualFold(vv[0], "close") && !strings.EqualFold(vv[0], "keep-alive")) { - return fmt.Errorf("http2: invalid Connection request header: %q", vv) - } - return nil -} - -// actualContentLength returns a sanitized version of -// req.ContentLength, where 0 actually means zero (not unknown) and -1 -// means unknown. -func actualContentLength(req *http.Request) int64 { - if req.Body == nil || req.Body == http.NoBody { - return 0 - } - if req.ContentLength != 0 { - return req.ContentLength - } - return -1 -} - -func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { - resp, _, err := cc.roundTrip(req) - return resp, err -} - -func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAfterReqBodyWrite bool, err error) { - if err := checkConnHeaders(req); err != nil { - return nil, false, err - } - if cc.idleTimer != nil { - cc.idleTimer.Stop() - } - - trailers, err := commaSeparatedTrailers(req) - if err != nil { - return nil, false, err - } - hasTrailers := trailers != "" - - cc.mu.Lock() - if err := cc.awaitOpenSlotForRequest(req); err != nil { - cc.mu.Unlock() - return nil, false, err - } - - body := req.Body - contentLen := actualContentLength(req) - hasBody := contentLen != 0 - - // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere? - var requestedGzip bool - if !cc.t.disableCompression() && - req.Header.Get("Accept-Encoding") == "" && - req.Header.Get("Range") == "" && - req.Method != "HEAD" { - // Request gzip only, not deflate. Deflate is ambiguous and - // not as universally supported anyway. - // See: https://zlib.net/zlib_faq.html#faq39 - // - // Note that we don't request this for HEAD requests, - // due to a bug in nginx: - // http://trac.nginx.org/nginx/ticket/358 - // https://golang.org/issue/5522 - // - // We don't request gzip if the request is for a range, since - // auto-decoding a portion of a gzipped document will just fail - // anyway. See https://golang.org/issue/8923 - requestedGzip = true - } - - // we send: HEADERS{1}, CONTINUATION{0,} + DATA{0,} (DATA is - // sent by writeRequestBody below, along with any Trailers, - // again in form HEADERS{1}, CONTINUATION{0,}) - hdrs, err := cc.encodeHeaders(req, requestedGzip, trailers, contentLen) - if err != nil { - cc.mu.Unlock() - return nil, false, err - } - - cs := cc.newStream() - cs.req = req - cs.trace = httptrace.ContextClientTrace(req.Context()) - cs.requestedGzip = requestedGzip - bodyWriter := cc.t.getBodyWriterState(cs, body) - cs.on100 = bodyWriter.on100 - - cc.wmu.Lock() - endStream := !hasBody && !hasTrailers - werr := cc.writeHeaders(cs.ID, endStream, int(cc.maxFrameSize), hdrs) - cc.wmu.Unlock() - traceWroteHeaders(cs.trace) - cc.mu.Unlock() - - if werr != nil { - if hasBody { - req.Body.Close() // per RoundTripper contract - bodyWriter.cancel() - } - cc.forgetStreamID(cs.ID) - // Don't bother sending a RST_STREAM (our write already failed; - // no need to keep writing) - traceWroteRequest(cs.trace, werr) - return nil, false, werr - } - - var respHeaderTimer <-chan time.Time - if hasBody { - bodyWriter.scheduleBodyWrite() - } else { - traceWroteRequest(cs.trace, nil) - if d := cc.responseHeaderTimeout(); d != 0 { - timer := time.NewTimer(d) - defer timer.Stop() - respHeaderTimer = timer.C - } - } - - readLoopResCh := cs.resc - bodyWritten := false - ctx := req.Context() - - handleReadLoopResponse := func(re resAndError) (*http.Response, bool, error) { - res := re.res - if re.err != nil || res.StatusCode > 299 { - // On error or status code 3xx, 4xx, 5xx, etc abort any - // ongoing write, assuming that the server doesn't care - // about our request body. If the server replied with 1xx or - // 2xx, however, then assume the server DOES potentially - // want our body (e.g. full-duplex streaming: - // golang.org/issue/13444). If it turns out the server - // doesn't, they'll RST_STREAM us soon enough. This is a - // heuristic to avoid adding knobs to Transport. Hopefully - // we can keep it. - bodyWriter.cancel() - cs.abortRequestBodyWrite(errStopReqBodyWrite) - } - if re.err != nil { - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), re.err - } - res.Request = req - res.TLS = cc.tlsState - return res, false, nil - } - - for { - select { - case re := <-readLoopResCh: - return handleReadLoopResponse(re) - case <-respHeaderTimer: - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - bodyWriter.cancel() - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - } - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), errTimeout - case <-ctx.Done(): - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - bodyWriter.cancel() - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - } - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), ctx.Err() - case <-req.Cancel: - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - bodyWriter.cancel() - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - } - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), errRequestCanceled - case <-cs.peerReset: - // processResetStream already removed the - // stream from the streams map; no need for - // forgetStreamID. - return nil, cs.getStartedWrite(), cs.resetErr - case err := <-bodyWriter.resc: - // Prefer the read loop's response, if available. Issue 16102. - select { - case re := <-readLoopResCh: - return handleReadLoopResponse(re) - default: - } - if err != nil { - cc.forgetStreamID(cs.ID) - return nil, cs.getStartedWrite(), err - } - bodyWritten = true - if d := cc.responseHeaderTimeout(); d != 0 { - timer := time.NewTimer(d) - defer timer.Stop() - respHeaderTimer = timer.C - } - } - } -} - -// awaitOpenSlotForRequest waits until len(streams) < maxConcurrentStreams. -// Must hold cc.mu. -func (cc *ClientConn) awaitOpenSlotForRequest(req *http.Request) error { - var waitingForConn chan struct{} - var waitingForConnErr error // guarded by cc.mu - for { - cc.lastActive = time.Now() - if cc.closed || !cc.canTakeNewRequestLocked() { - if waitingForConn != nil { - close(waitingForConn) - } - return errClientConnUnusable - } - cc.lastIdle = time.Time{} - if int64(len(cc.streams))+1 <= int64(cc.maxConcurrentStreams) { - if waitingForConn != nil { - close(waitingForConn) - } - return nil - } - // Unfortunately, we cannot wait on a condition variable and channel at - // the same time, so instead, we spin up a goroutine to check if the - // request is canceled while we wait for a slot to open in the connection. - if waitingForConn == nil { - waitingForConn = make(chan struct{}) - go func() { - if err := awaitRequestCancel(req, waitingForConn); err != nil { - cc.mu.Lock() - waitingForConnErr = err - cc.cond.Broadcast() - cc.mu.Unlock() - } - }() - } - cc.pendingRequests++ - cc.cond.Wait() - cc.pendingRequests-- - if waitingForConnErr != nil { - return waitingForConnErr - } - } -} - -// requires cc.wmu be held -func (cc *ClientConn) writeHeaders(streamID uint32, endStream bool, maxFrameSize int, hdrs []byte) error { - first := true // first frame written (HEADERS is first, then CONTINUATION) - for len(hdrs) > 0 && cc.werr == nil { - chunk := hdrs - if len(chunk) > maxFrameSize { - chunk = chunk[:maxFrameSize] - } - hdrs = hdrs[len(chunk):] - endHeaders := len(hdrs) == 0 - if first { - cc.fr.WriteHeaders(HeadersFrameParam{ - StreamID: streamID, - BlockFragment: chunk, - EndStream: endStream, - EndHeaders: endHeaders, - }) - first = false - } else { - cc.fr.WriteContinuation(streamID, endHeaders, chunk) - } - } - // TODO(bradfitz): this Flush could potentially block (as - // could the WriteHeaders call(s) above), which means they - // wouldn't respond to Request.Cancel being readable. That's - // rare, but this should probably be in a goroutine. - cc.bw.Flush() - return cc.werr -} - -// internal error values; they don't escape to callers -var ( - // abort request body write; don't send cancel - errStopReqBodyWrite = errors.New("http2: aborting request body write") - - // abort request body write, but send stream reset of cancel. - errStopReqBodyWriteAndCancel = errors.New("http2: canceling request") - - errReqBodyTooLong = errors.New("http2: request body larger than specified content length") -) - -func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { - cc := cs.cc - sentEnd := false // whether we sent the final DATA frame w/ END_STREAM - buf := cc.frameScratchBuffer() - defer cc.putFrameScratchBuffer(buf) - - defer func() { - traceWroteRequest(cs.trace, err) - // TODO: write h12Compare test showing whether - // Request.Body is closed by the Transport, - // and in multiple cases: server replies <=299 and >299 - // while still writing request body - cerr := bodyCloser.Close() - if err == nil { - err = cerr - } - }() - - req := cs.req - hasTrailers := req.Trailer != nil - remainLen := actualContentLength(req) - hasContentLen := remainLen != -1 - - var sawEOF bool - for !sawEOF { - n, err := body.Read(buf[:len(buf)-1]) - if hasContentLen { - remainLen -= int64(n) - if remainLen == 0 && err == nil { - // The request body's Content-Length was predeclared and - // we just finished reading it all, but the underlying io.Reader - // returned the final chunk with a nil error (which is one of - // the two valid things a Reader can do at EOF). Because we'd prefer - // to send the END_STREAM bit early, double-check that we're actually - // at EOF. Subsequent reads should return (0, EOF) at this point. - // If either value is different, we return an error in one of two ways below. - var n1 int - n1, err = body.Read(buf[n:]) - remainLen -= int64(n1) - } - if remainLen < 0 { - err = errReqBodyTooLong - cc.writeStreamReset(cs.ID, ErrCodeCancel, err) - return err - } - } - if err == io.EOF { - sawEOF = true - err = nil - } else if err != nil { - cc.writeStreamReset(cs.ID, ErrCodeCancel, err) - return err - } - - remain := buf[:n] - for len(remain) > 0 && err == nil { - var allowed int32 - allowed, err = cs.awaitFlowControl(len(remain)) - switch { - case err == errStopReqBodyWrite: - return err - case err == errStopReqBodyWriteAndCancel: - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - return err - case err != nil: - return err - } - cc.wmu.Lock() - data := remain[:allowed] - remain = remain[allowed:] - sentEnd = sawEOF && len(remain) == 0 && !hasTrailers - err = cc.fr.WriteData(cs.ID, sentEnd, data) - if err == nil { - // TODO(bradfitz): this flush is for latency, not bandwidth. - // Most requests won't need this. Make this opt-in or - // opt-out? Use some heuristic on the body type? Nagel-like - // timers? Based on 'n'? Only last chunk of this for loop, - // unless flow control tokens are low? For now, always. - // If we change this, see comment below. - err = cc.bw.Flush() - } - cc.wmu.Unlock() - } - if err != nil { - return err - } - } - - if sentEnd { - // Already sent END_STREAM (which implies we have no - // trailers) and flushed, because currently all - // WriteData frames above get a flush. So we're done. - return nil - } - - var trls []byte - if hasTrailers { - cc.mu.Lock() - trls, err = cc.encodeTrailers(req) - cc.mu.Unlock() - if err != nil { - cc.writeStreamReset(cs.ID, ErrCodeInternal, err) - cc.forgetStreamID(cs.ID) - return err - } - } - - cc.mu.Lock() - maxFrameSize := int(cc.maxFrameSize) - cc.mu.Unlock() - - cc.wmu.Lock() - defer cc.wmu.Unlock() - - // Two ways to send END_STREAM: either with trailers, or - // with an empty DATA frame. - if len(trls) > 0 { - err = cc.writeHeaders(cs.ID, true, maxFrameSize, trls) - } else { - err = cc.fr.WriteData(cs.ID, true, nil) - } - if ferr := cc.bw.Flush(); ferr != nil && err == nil { - err = ferr - } - return err -} - -// awaitFlowControl waits for [1, min(maxBytes, cc.cs.maxFrameSize)] flow -// control tokens from the server. -// It returns either the non-zero number of tokens taken or an error -// if the stream is dead. -func (cs *clientStream) awaitFlowControl(maxBytes int) (taken int32, err error) { - cc := cs.cc - cc.mu.Lock() - defer cc.mu.Unlock() - for { - if cc.closed { - return 0, errClientConnClosed - } - if cs.stopReqBody != nil { - return 0, cs.stopReqBody - } - if err := cs.checkResetOrDone(); err != nil { - return 0, err - } - if a := cs.flow.available(); a > 0 { - take := a - if int(take) > maxBytes { - - take = int32(maxBytes) // can't truncate int; take is int32 - } - if take > int32(cc.maxFrameSize) { - take = int32(cc.maxFrameSize) - } - cs.flow.take(take) - return take, nil - } - cc.cond.Wait() - } -} - -// requires cc.mu be held. -func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trailers string, contentLength int64) ([]byte, error) { - cc.hbuf.Reset() - - host := req.Host - if host == "" { - host = req.URL.Host - } - host, err := httpguts.PunycodeHostPort(host) - if err != nil { - return nil, err - } - - var path string - if req.Method != "CONNECT" { - path = req.URL.RequestURI() - if !validPseudoPath(path) { - orig := path - path = strings.TrimPrefix(path, req.URL.Scheme+"://"+host) - if !validPseudoPath(path) { - if req.URL.Opaque != "" { - return nil, fmt.Errorf("invalid request :path %q from URL.Opaque = %q", orig, req.URL.Opaque) - } else { - return nil, fmt.Errorf("invalid request :path %q", orig) - } - } - } - } - - // Check for any invalid headers and return an error before we - // potentially pollute our hpack state. (We want to be able to - // continue to reuse the hpack encoder for future requests) - for k, vv := range req.Header { - if !httpguts.ValidHeaderFieldName(k) { - return nil, fmt.Errorf("invalid HTTP header name %q", k) - } - for _, v := range vv { - if !httpguts.ValidHeaderFieldValue(v) { - return nil, fmt.Errorf("invalid HTTP header value %q for header %q", v, k) - } - } - } - - enumerateHeaders := func(f func(name, value string)) { - // 8.1.2.3 Request Pseudo-Header Fields - // The :path pseudo-header field includes the path and query parts of the - // target URI (the path-absolute production and optionally a '?' character - // followed by the query production (see Sections 3.3 and 3.4 of - // [RFC3986]). - f(":authority", host) - m := req.Method - if m == "" { - m = http.MethodGet - } - f(":method", m) - if req.Method != "CONNECT" { - f(":path", path) - f(":scheme", req.URL.Scheme) - } - if trailers != "" { - f("trailer", trailers) - } - - var didUA bool - for k, vv := range req.Header { - if strings.EqualFold(k, "host") || strings.EqualFold(k, "content-length") { - // Host is :authority, already sent. - // Content-Length is automatic, set below. - continue - } else if strings.EqualFold(k, "connection") || strings.EqualFold(k, "proxy-connection") || - strings.EqualFold(k, "transfer-encoding") || strings.EqualFold(k, "upgrade") || - strings.EqualFold(k, "keep-alive") { - // Per 8.1.2.2 Connection-Specific Header - // Fields, don't send connection-specific - // fields. We have already checked if any - // are error-worthy so just ignore the rest. - continue - } else if strings.EqualFold(k, "user-agent") { - // Match Go's http1 behavior: at most one - // User-Agent. If set to nil or empty string, - // then omit it. Otherwise if not mentioned, - // include the default (below). - didUA = true - if len(vv) < 1 { - continue - } - vv = vv[:1] - if vv[0] == "" { - continue - } - } else if strings.EqualFold(k, "cookie") { - // Per 8.1.2.5 To allow for better compression efficiency, the - // Cookie header field MAY be split into separate header fields, - // each with one or more cookie-pairs. - for _, v := range vv { - for { - p := strings.IndexByte(v, ';') - if p < 0 { - break - } - f("cookie", v[:p]) - p++ - // strip space after semicolon if any. - for p+1 <= len(v) && v[p] == ' ' { - p++ - } - v = v[p:] - } - if len(v) > 0 { - f("cookie", v) - } - } - continue - } - - for _, v := range vv { - f(k, v) - } - } - if shouldSendReqContentLength(req.Method, contentLength) { - f("content-length", strconv.FormatInt(contentLength, 10)) - } - if addGzipHeader { - f("accept-encoding", "gzip") - } - if !didUA { - f("user-agent", defaultUserAgent) - } - } - - // Do a first pass over the headers counting bytes to ensure - // we don't exceed cc.peerMaxHeaderListSize. This is done as a - // separate pass before encoding the headers to prevent - // modifying the hpack state. - hlSize := uint64(0) - enumerateHeaders(func(name, value string) { - hf := hpack.HeaderField{Name: name, Value: value} - hlSize += uint64(hf.Size()) - }) - - if hlSize > cc.peerMaxHeaderListSize { - return nil, errRequestHeaderListSize - } - - trace := httptrace.ContextClientTrace(req.Context()) - traceHeaders := traceHasWroteHeaderField(trace) - - // Header list size is ok. Write the headers. - enumerateHeaders(func(name, value string) { - name = strings.ToLower(name) - cc.writeHeader(name, value) - if traceHeaders { - traceWroteHeaderField(trace, name, value) - } - }) - - return cc.hbuf.Bytes(), nil -} - -// shouldSendReqContentLength reports whether the http2.Transport should send -// a "content-length" request header. This logic is basically a copy of the net/http -// transferWriter.shouldSendContentLength. -// The contentLength is the corrected contentLength (so 0 means actually 0, not unknown). -// -1 means unknown. -func shouldSendReqContentLength(method string, contentLength int64) bool { - if contentLength > 0 { - return true - } - if contentLength < 0 { - return false - } - // For zero bodies, whether we send a content-length depends on the method. - // It also kinda doesn't matter for http2 either way, with END_STREAM. - switch method { - case "POST", "PUT", "PATCH": - return true - default: - return false - } -} - -// requires cc.mu be held. -func (cc *ClientConn) encodeTrailers(req *http.Request) ([]byte, error) { - cc.hbuf.Reset() - - hlSize := uint64(0) - for k, vv := range req.Trailer { - for _, v := range vv { - hf := hpack.HeaderField{Name: k, Value: v} - hlSize += uint64(hf.Size()) - } - } - if hlSize > cc.peerMaxHeaderListSize { - return nil, errRequestHeaderListSize - } - - for k, vv := range req.Trailer { - // Transfer-Encoding, etc.. have already been filtered at the - // start of RoundTrip - lowKey := strings.ToLower(k) - for _, v := range vv { - cc.writeHeader(lowKey, v) - } - } - return cc.hbuf.Bytes(), nil -} - -func (cc *ClientConn) writeHeader(name, value string) { - if VerboseLogs { - log.Printf("http2: Transport encoding header %q = %q", name, value) - } - cc.henc.WriteField(hpack.HeaderField{Name: name, Value: value}) -} - -type resAndError struct { - _ incomparable - res *http.Response - err error -} - -// requires cc.mu be held. -func (cc *ClientConn) newStream() *clientStream { - cs := &clientStream{ - cc: cc, - ID: cc.nextStreamID, - resc: make(chan resAndError, 1), - peerReset: make(chan struct{}), - done: make(chan struct{}), - } - cs.flow.add(int32(cc.initialWindowSize)) - cs.flow.setConnFlow(&cc.flow) - cs.inflow.add(transportDefaultStreamFlow) - cs.inflow.setConnFlow(&cc.inflow) - cc.nextStreamID += 2 - cc.streams[cs.ID] = cs - return cs -} - -func (cc *ClientConn) forgetStreamID(id uint32) { - cc.streamByID(id, true) -} - -func (cc *ClientConn) streamByID(id uint32, andRemove bool) *clientStream { - cc.mu.Lock() - defer cc.mu.Unlock() - cs := cc.streams[id] - if andRemove && cs != nil && !cc.closed { - cc.lastActive = time.Now() - delete(cc.streams, id) - if len(cc.streams) == 0 && cc.idleTimer != nil { - cc.idleTimer.Reset(cc.idleTimeout) - cc.lastIdle = time.Now() - } - close(cs.done) - // Wake up checkResetOrDone via clientStream.awaitFlowControl and - // wake up RoundTrip if there is a pending request. - cc.cond.Broadcast() - } - return cs -} - -// clientConnReadLoop is the state owned by the clientConn's frame-reading readLoop. -type clientConnReadLoop struct { - _ incomparable - cc *ClientConn - closeWhenIdle bool -} - -// readLoop runs in its own goroutine and reads and dispatches frames. -func (cc *ClientConn) readLoop() { - rl := &clientConnReadLoop{cc: cc} - defer rl.cleanup() - cc.readerErr = rl.run() - if ce, ok := cc.readerErr.(ConnectionError); ok { - cc.wmu.Lock() - cc.fr.WriteGoAway(0, ErrCode(ce), nil) - cc.wmu.Unlock() - } -} - -// GoAwayError is returned by the Transport when the server closes the -// TCP connection after sending a GOAWAY frame. -type GoAwayError struct { - LastStreamID uint32 - ErrCode ErrCode - DebugData string -} - -func (e GoAwayError) Error() string { - return fmt.Sprintf("http2: server sent GOAWAY and closed the connection; LastStreamID=%v, ErrCode=%v, debug=%q", - e.LastStreamID, e.ErrCode, e.DebugData) -} - -func isEOFOrNetReadError(err error) bool { - if err == io.EOF { - return true - } - ne, ok := err.(*net.OpError) - return ok && ne.Op == "read" -} - -func (rl *clientConnReadLoop) cleanup() { - cc := rl.cc - defer cc.tconn.Close() - defer cc.t.connPool().MarkDead(cc) - defer close(cc.readerDone) - - if cc.idleTimer != nil { - cc.idleTimer.Stop() - } - - // Close any response bodies if the server closes prematurely. - // TODO: also do this if we've written the headers but not - // gotten a response yet. - err := cc.readerErr - cc.mu.Lock() - if cc.goAway != nil && isEOFOrNetReadError(err) { - err = GoAwayError{ - LastStreamID: cc.goAway.LastStreamID, - ErrCode: cc.goAway.ErrCode, - DebugData: cc.goAwayDebug, - } - } else if err == io.EOF { - err = io.ErrUnexpectedEOF - } - for _, cs := range cc.streams { - cs.bufPipe.CloseWithError(err) // no-op if already closed - select { - case cs.resc <- resAndError{err: err}: - default: - } - close(cs.done) - } - cc.closed = true - cc.cond.Broadcast() - cc.mu.Unlock() -} - -func (rl *clientConnReadLoop) run() error { - cc := rl.cc - rl.closeWhenIdle = cc.t.disableKeepAlives() || cc.singleUse - gotReply := false // ever saw a HEADERS reply - gotSettings := false - readIdleTimeout := cc.t.ReadIdleTimeout - var t *time.Timer - if readIdleTimeout != 0 { - t = time.AfterFunc(readIdleTimeout, cc.healthCheck) - defer t.Stop() - } - for { - f, err := cc.fr.ReadFrame() - if t != nil { - t.Reset(readIdleTimeout) - } - if err != nil { - cc.vlogf("http2: Transport readFrame error on conn %p: (%T) %v", cc, err, err) - } - if se, ok := err.(StreamError); ok { - if cs := cc.streamByID(se.StreamID, false); cs != nil { - cs.cc.writeStreamReset(cs.ID, se.Code, err) - cs.cc.forgetStreamID(cs.ID) - if se.Cause == nil { - se.Cause = cc.fr.errDetail - } - rl.endStreamError(cs, se) - } - continue - } else if err != nil { - return err - } - if VerboseLogs { - cc.vlogf("http2: Transport received %s", summarizeFrame(f)) - } - if !gotSettings { - if _, ok := f.(*SettingsFrame); !ok { - cc.logf("protocol error: received %T before a SETTINGS frame", f) - return ConnectionError(ErrCodeProtocol) - } - gotSettings = true - } - maybeIdle := false // whether frame might transition us to idle - - switch f := f.(type) { - case *MetaHeadersFrame: - err = rl.processHeaders(f) - maybeIdle = true - gotReply = true - case *DataFrame: - err = rl.processData(f) - maybeIdle = true - case *GoAwayFrame: - err = rl.processGoAway(f) - maybeIdle = true - case *RSTStreamFrame: - err = rl.processResetStream(f) - maybeIdle = true - case *SettingsFrame: - err = rl.processSettings(f) - case *PushPromiseFrame: - err = rl.processPushPromise(f) - case *WindowUpdateFrame: - err = rl.processWindowUpdate(f) - case *PingFrame: - err = rl.processPing(f) - default: - cc.logf("Transport: unhandled response frame type %T", f) - } - if err != nil { - if VerboseLogs { - cc.vlogf("http2: Transport conn %p received error from processing frame %v: %v", cc, summarizeFrame(f), err) - } - return err - } - if rl.closeWhenIdle && gotReply && maybeIdle { - cc.closeIfIdle() - } - } -} - -func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error { - cc := rl.cc - cs := cc.streamByID(f.StreamID, false) - if cs == nil { - // We'd get here if we canceled a request while the - // server had its response still in flight. So if this - // was just something we canceled, ignore it. - return nil - } - if f.StreamEnded() { - // Issue 20521: If the stream has ended, streamByID() causes - // clientStream.done to be closed, which causes the request's bodyWriter - // to be closed with an errStreamClosed, which may be received by - // clientConn.RoundTrip before the result of processing these headers. - // Deferring stream closure allows the header processing to occur first. - // clientConn.RoundTrip may still receive the bodyWriter error first, but - // the fix for issue 16102 prioritises any response. - // - // Issue 22413: If there is no request body, we should close the - // stream before writing to cs.resc so that the stream is closed - // immediately once RoundTrip returns. - if cs.req.Body != nil { - defer cc.forgetStreamID(f.StreamID) - } else { - cc.forgetStreamID(f.StreamID) - } - } - if !cs.firstByte { - if cs.trace != nil { - // TODO(bradfitz): move first response byte earlier, - // when we first read the 9 byte header, not waiting - // until all the HEADERS+CONTINUATION frames have been - // merged. This works for now. - traceFirstResponseByte(cs.trace) - } - cs.firstByte = true - } - if !cs.pastHeaders { - cs.pastHeaders = true - } else { - return rl.processTrailers(cs, f) - } - - res, err := rl.handleResponse(cs, f) - if err != nil { - if _, ok := err.(ConnectionError); ok { - return err - } - // Any other error type is a stream error. - cs.cc.writeStreamReset(f.StreamID, ErrCodeProtocol, err) - cc.forgetStreamID(cs.ID) - cs.resc <- resAndError{err: err} - return nil // return nil from process* funcs to keep conn alive - } - if res == nil { - // (nil, nil) special case. See handleResponse docs. - return nil - } - cs.resTrailer = &res.Trailer - cs.resc <- resAndError{res: res} - return nil -} - -// may return error types nil, or ConnectionError. Any other error value -// is a StreamError of type ErrCodeProtocol. The returned error in that case -// is the detail. -// -// As a special case, handleResponse may return (nil, nil) to skip the -// frame (currently only used for 1xx responses). -func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFrame) (*http.Response, error) { - if f.Truncated { - return nil, errResponseHeaderListSize - } - - status := f.PseudoValue("status") - if status == "" { - return nil, errors.New("malformed response from server: missing status pseudo header") - } - statusCode, err := strconv.Atoi(status) - if err != nil { - return nil, errors.New("malformed response from server: malformed non-numeric status pseudo header") - } - - regularFields := f.RegularFields() - strs := make([]string, len(regularFields)) - header := make(http.Header, len(regularFields)) - res := &http.Response{ - Proto: "HTTP/2.0", - ProtoMajor: 2, - Header: header, - StatusCode: statusCode, - Status: status + " " + http.StatusText(statusCode), - } - for _, hf := range regularFields { - key := http.CanonicalHeaderKey(hf.Name) - if key == "Trailer" { - t := res.Trailer - if t == nil { - t = make(http.Header) - res.Trailer = t - } - foreachHeaderElement(hf.Value, func(v string) { - t[http.CanonicalHeaderKey(v)] = nil - }) - } else { - vv := header[key] - if vv == nil && len(strs) > 0 { - // More than likely this will be a single-element key. - // Most headers aren't multi-valued. - // Set the capacity on strs[0] to 1, so any future append - // won't extend the slice into the other strings. - vv, strs = strs[:1:1], strs[1:] - vv[0] = hf.Value - header[key] = vv - } else { - header[key] = append(vv, hf.Value) - } - } - } - - if statusCode >= 100 && statusCode <= 199 { - cs.num1xx++ - const max1xxResponses = 5 // arbitrary bound on number of informational responses, same as net/http - if cs.num1xx > max1xxResponses { - return nil, errors.New("http2: too many 1xx informational responses") - } - if fn := cs.get1xxTraceFunc(); fn != nil { - if err := fn(statusCode, textproto.MIMEHeader(header)); err != nil { - return nil, err - } - } - if statusCode == 100 { - traceGot100Continue(cs.trace) - if cs.on100 != nil { - cs.on100() // forces any write delay timer to fire - } - } - cs.pastHeaders = false // do it all again - return nil, nil - } - - streamEnded := f.StreamEnded() - isHead := cs.req.Method == "HEAD" - if !streamEnded || isHead { - res.ContentLength = -1 - if clens := res.Header["Content-Length"]; len(clens) == 1 { - if clen64, err := strconv.ParseInt(clens[0], 10, 64); err == nil { - res.ContentLength = clen64 - } else { - // TODO: care? unlike http/1, it won't mess up our framing, so it's - // more safe smuggling-wise to ignore. - } - } else if len(clens) > 1 { - // TODO: care? unlike http/1, it won't mess up our framing, so it's - // more safe smuggling-wise to ignore. - } - } - - if streamEnded || isHead { - res.Body = noBody - return res, nil - } - - cs.bufPipe = pipe{b: &dataBuffer{expected: res.ContentLength}} - cs.bytesRemain = res.ContentLength - res.Body = transportResponseBody{cs} - go cs.awaitRequestCancel(cs.req) - - if cs.requestedGzip && res.Header.Get("Content-Encoding") == "gzip" { - res.Header.Del("Content-Encoding") - res.Header.Del("Content-Length") - res.ContentLength = -1 - res.Body = &gzipReader{body: res.Body} - res.Uncompressed = true - } - return res, nil -} - -func (rl *clientConnReadLoop) processTrailers(cs *clientStream, f *MetaHeadersFrame) error { - if cs.pastTrailers { - // Too many HEADERS frames for this stream. - return ConnectionError(ErrCodeProtocol) - } - cs.pastTrailers = true - if !f.StreamEnded() { - // We expect that any headers for trailers also - // has END_STREAM. - return ConnectionError(ErrCodeProtocol) - } - if len(f.PseudoFields()) > 0 { - // No pseudo header fields are defined for trailers. - // TODO: ConnectionError might be overly harsh? Check. - return ConnectionError(ErrCodeProtocol) - } - - trailer := make(http.Header) - for _, hf := range f.RegularFields() { - key := http.CanonicalHeaderKey(hf.Name) - trailer[key] = append(trailer[key], hf.Value) - } - cs.trailer = trailer - - rl.endStream(cs) - return nil -} - -// transportResponseBody is the concrete type of Transport.RoundTrip's -// Response.Body. It is an io.ReadCloser. On Read, it reads from cs.body. -// On Close it sends RST_STREAM if EOF wasn't already seen. -type transportResponseBody struct { - cs *clientStream -} - -func (b transportResponseBody) Read(p []byte) (n int, err error) { - cs := b.cs - cc := cs.cc - - if cs.readErr != nil { - return 0, cs.readErr - } - n, err = b.cs.bufPipe.Read(p) - if cs.bytesRemain != -1 { - if int64(n) > cs.bytesRemain { - n = int(cs.bytesRemain) - if err == nil { - err = errors.New("net/http: server replied with more than declared Content-Length; truncated") - cc.writeStreamReset(cs.ID, ErrCodeProtocol, err) - } - cs.readErr = err - return int(cs.bytesRemain), err - } - cs.bytesRemain -= int64(n) - if err == io.EOF && cs.bytesRemain > 0 { - err = io.ErrUnexpectedEOF - cs.readErr = err - return n, err - } - } - if n == 0 { - // No flow control tokens to send back. - return - } - - cc.mu.Lock() - defer cc.mu.Unlock() - - var connAdd, streamAdd int32 - // Check the conn-level first, before the stream-level. - if v := cc.inflow.available(); v < transportDefaultConnFlow/2 { - connAdd = transportDefaultConnFlow - v - cc.inflow.add(connAdd) - } - if err == nil { // No need to refresh if the stream is over or failed. - // Consider any buffered body data (read from the conn but not - // consumed by the client) when computing flow control for this - // stream. - v := int(cs.inflow.available()) + cs.bufPipe.Len() - if v < transportDefaultStreamFlow-transportDefaultStreamMinRefresh { - streamAdd = int32(transportDefaultStreamFlow - v) - cs.inflow.add(streamAdd) - } - } - if connAdd != 0 || streamAdd != 0 { - cc.wmu.Lock() - defer cc.wmu.Unlock() - if connAdd != 0 { - cc.fr.WriteWindowUpdate(0, mustUint31(connAdd)) - } - if streamAdd != 0 { - cc.fr.WriteWindowUpdate(cs.ID, mustUint31(streamAdd)) - } - cc.bw.Flush() - } - return -} - -var errClosedResponseBody = errors.New("http2: response body closed") - -func (b transportResponseBody) Close() error { - cs := b.cs - cc := cs.cc - - serverSentStreamEnd := cs.bufPipe.Err() == io.EOF - unread := cs.bufPipe.Len() - - if unread > 0 || !serverSentStreamEnd { - cc.mu.Lock() - cc.wmu.Lock() - if !serverSentStreamEnd { - cc.fr.WriteRSTStream(cs.ID, ErrCodeCancel) - cs.didReset = true - } - // Return connection-level flow control. - if unread > 0 { - cc.inflow.add(int32(unread)) - cc.fr.WriteWindowUpdate(0, uint32(unread)) - } - cc.bw.Flush() - cc.wmu.Unlock() - cc.mu.Unlock() - } - - cs.bufPipe.BreakWithError(errClosedResponseBody) - cc.forgetStreamID(cs.ID) - return nil -} - -func (rl *clientConnReadLoop) processData(f *DataFrame) error { - cc := rl.cc - cs := cc.streamByID(f.StreamID, f.StreamEnded()) - data := f.Data() - if cs == nil { - cc.mu.Lock() - neverSent := cc.nextStreamID - cc.mu.Unlock() - if f.StreamID >= neverSent { - // We never asked for this. - cc.logf("http2: Transport received unsolicited DATA frame; closing connection") - return ConnectionError(ErrCodeProtocol) - } - // We probably did ask for this, but canceled. Just ignore it. - // TODO: be stricter here? only silently ignore things which - // we canceled, but not things which were closed normally - // by the peer? Tough without accumulating too much state. - - // But at least return their flow control: - if f.Length > 0 { - cc.mu.Lock() - cc.inflow.add(int32(f.Length)) - cc.mu.Unlock() - - cc.wmu.Lock() - cc.fr.WriteWindowUpdate(0, uint32(f.Length)) - cc.bw.Flush() - cc.wmu.Unlock() - } - return nil - } - if !cs.firstByte { - cc.logf("protocol error: received DATA before a HEADERS frame") - rl.endStreamError(cs, StreamError{ - StreamID: f.StreamID, - Code: ErrCodeProtocol, - }) - return nil - } - if f.Length > 0 { - if cs.req.Method == "HEAD" && len(data) > 0 { - cc.logf("protocol error: received DATA on a HEAD request") - rl.endStreamError(cs, StreamError{ - StreamID: f.StreamID, - Code: ErrCodeProtocol, - }) - return nil - } - // Check connection-level flow control. - cc.mu.Lock() - if cs.inflow.available() >= int32(f.Length) { - cs.inflow.take(int32(f.Length)) - } else { - cc.mu.Unlock() - return ConnectionError(ErrCodeFlowControl) - } - // Return any padded flow control now, since we won't - // refund it later on body reads. - var refund int - if pad := int(f.Length) - len(data); pad > 0 { - refund += pad - } - // Return len(data) now if the stream is already closed, - // since data will never be read. - didReset := cs.didReset - if didReset { - refund += len(data) - } - if refund > 0 { - cc.inflow.add(int32(refund)) - cc.wmu.Lock() - cc.fr.WriteWindowUpdate(0, uint32(refund)) - if !didReset { - cs.inflow.add(int32(refund)) - cc.fr.WriteWindowUpdate(cs.ID, uint32(refund)) - } - cc.bw.Flush() - cc.wmu.Unlock() - } - cc.mu.Unlock() - - if len(data) > 0 && !didReset { - if _, err := cs.bufPipe.Write(data); err != nil { - rl.endStreamError(cs, err) - return err - } - } - } - - if f.StreamEnded() { - rl.endStream(cs) - } - return nil -} - -func (rl *clientConnReadLoop) endStream(cs *clientStream) { - // TODO: check that any declared content-length matches, like - // server.go's (*stream).endStream method. - rl.endStreamError(cs, nil) -} - -func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) { - var code func() - if err == nil { - err = io.EOF - code = cs.copyTrailers - } - if isConnectionCloseRequest(cs.req) { - rl.closeWhenIdle = true - } - cs.bufPipe.closeWithErrorAndCode(err, code) - - select { - case cs.resc <- resAndError{err: err}: - default: - } -} - -func (cs *clientStream) copyTrailers() { - for k, vv := range cs.trailer { - t := cs.resTrailer - if *t == nil { - *t = make(http.Header) - } - (*t)[k] = vv - } -} - -func (rl *clientConnReadLoop) processGoAway(f *GoAwayFrame) error { - cc := rl.cc - cc.t.connPool().MarkDead(cc) - if f.ErrCode != 0 { - // TODO: deal with GOAWAY more. particularly the error code - cc.vlogf("transport got GOAWAY with error code = %v", f.ErrCode) - } - cc.setGoAway(f) - return nil -} - -func (rl *clientConnReadLoop) processSettings(f *SettingsFrame) error { - cc := rl.cc - cc.mu.Lock() - defer cc.mu.Unlock() - - if f.IsAck() { - if cc.wantSettingsAck { - cc.wantSettingsAck = false - return nil - } - return ConnectionError(ErrCodeProtocol) - } - - err := f.ForeachSetting(func(s Setting) error { - switch s.ID { - case SettingMaxFrameSize: - cc.maxFrameSize = s.Val - case SettingMaxConcurrentStreams: - cc.maxConcurrentStreams = s.Val - case SettingMaxHeaderListSize: - cc.peerMaxHeaderListSize = uint64(s.Val) - case SettingInitialWindowSize: - // Values above the maximum flow-control - // window size of 2^31-1 MUST be treated as a - // connection error (Section 5.4.1) of type - // FLOW_CONTROL_ERROR. - if s.Val > math.MaxInt32 { - return ConnectionError(ErrCodeFlowControl) - } - - // Adjust flow control of currently-open - // frames by the difference of the old initial - // window size and this one. - delta := int32(s.Val) - int32(cc.initialWindowSize) - for _, cs := range cc.streams { - cs.flow.add(delta) - } - cc.cond.Broadcast() - - cc.initialWindowSize = s.Val - default: - // TODO(bradfitz): handle more settings? SETTINGS_HEADER_TABLE_SIZE probably. - cc.vlogf("Unhandled Setting: %v", s) - } - return nil - }) - if err != nil { - return err - } - - cc.wmu.Lock() - defer cc.wmu.Unlock() - - cc.fr.WriteSettingsAck() - cc.bw.Flush() - return cc.werr -} - -func (rl *clientConnReadLoop) processWindowUpdate(f *WindowUpdateFrame) error { - cc := rl.cc - cs := cc.streamByID(f.StreamID, false) - if f.StreamID != 0 && cs == nil { - return nil - } - - cc.mu.Lock() - defer cc.mu.Unlock() - - fl := &cc.flow - if cs != nil { - fl = &cs.flow - } - if !fl.add(int32(f.Increment)) { - return ConnectionError(ErrCodeFlowControl) - } - cc.cond.Broadcast() - return nil -} - -func (rl *clientConnReadLoop) processResetStream(f *RSTStreamFrame) error { - cs := rl.cc.streamByID(f.StreamID, true) - if cs == nil { - // TODO: return error if server tries to RST_STEAM an idle stream - return nil - } - select { - case <-cs.peerReset: - // Already reset. - // This is the only goroutine - // which closes this, so there - // isn't a race. - default: - err := streamError(cs.ID, f.ErrCode) - cs.resetErr = err - close(cs.peerReset) - cs.bufPipe.CloseWithError(err) - cs.cc.cond.Broadcast() // wake up checkResetOrDone via clientStream.awaitFlowControl - } - return nil -} - -// Ping sends a PING frame to the server and waits for the ack. -func (cc *ClientConn) Ping(ctx context.Context) error { - c := make(chan struct{}) - // Generate a random payload - var p [8]byte - for { - if _, err := rand.Read(p[:]); err != nil { - return err - } - cc.mu.Lock() - // check for dup before insert - if _, found := cc.pings[p]; !found { - cc.pings[p] = c - cc.mu.Unlock() - break - } - cc.mu.Unlock() - } - cc.wmu.Lock() - if err := cc.fr.WritePing(false, p); err != nil { - cc.wmu.Unlock() - return err - } - if err := cc.bw.Flush(); err != nil { - cc.wmu.Unlock() - return err - } - cc.wmu.Unlock() - select { - case <-c: - return nil - case <-ctx.Done(): - return ctx.Err() - case <-cc.readerDone: - // connection closed - return cc.readerErr - } -} - -func (rl *clientConnReadLoop) processPing(f *PingFrame) error { - if f.IsAck() { - cc := rl.cc - cc.mu.Lock() - defer cc.mu.Unlock() - // If ack, notify listener if any - if c, ok := cc.pings[f.Data]; ok { - close(c) - delete(cc.pings, f.Data) - } - return nil - } - cc := rl.cc - cc.wmu.Lock() - defer cc.wmu.Unlock() - if err := cc.fr.WritePing(true, f.Data); err != nil { - return err - } - return cc.bw.Flush() -} - -func (rl *clientConnReadLoop) processPushPromise(f *PushPromiseFrame) error { - // We told the peer we don't want them. - // Spec says: - // "PUSH_PROMISE MUST NOT be sent if the SETTINGS_ENABLE_PUSH - // setting of the peer endpoint is set to 0. An endpoint that - // has set this setting and has received acknowledgement MUST - // treat the receipt of a PUSH_PROMISE frame as a connection - // error (Section 5.4.1) of type PROTOCOL_ERROR." - return ConnectionError(ErrCodeProtocol) -} - -func (cc *ClientConn) writeStreamReset(streamID uint32, code ErrCode, err error) { - // TODO: map err to more interesting error codes, once the - // HTTP community comes up with some. But currently for - // RST_STREAM there's no equivalent to GOAWAY frame's debug - // data, and the error codes are all pretty vague ("cancel"). - cc.wmu.Lock() - cc.fr.WriteRSTStream(streamID, code) - cc.bw.Flush() - cc.wmu.Unlock() -} - -var ( - errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit") - errRequestHeaderListSize = errors.New("http2: request header list larger than peer's advertised limit") -) - -func (cc *ClientConn) logf(format string, args ...interface{}) { - cc.t.logf(format, args...) -} - -func (cc *ClientConn) vlogf(format string, args ...interface{}) { - cc.t.vlogf(format, args...) -} - -func (t *Transport) vlogf(format string, args ...interface{}) { - if VerboseLogs { - t.logf(format, args...) - } -} - -func (t *Transport) logf(format string, args ...interface{}) { - log.Printf(format, args...) -} - -var noBody io.ReadCloser = ioutil.NopCloser(bytes.NewReader(nil)) - -func strSliceContains(ss []string, s string) bool { - for _, v := range ss { - if v == s { - return true - } - } - return false -} - -type erringRoundTripper struct{ err error } - -func (rt erringRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { return nil, rt.err } - -// gzipReader wraps a response body so it can lazily -// call gzip.NewReader on the first call to Read -type gzipReader struct { - _ incomparable - body io.ReadCloser // underlying Response.Body - zr *gzip.Reader // lazily-initialized gzip reader - zerr error // sticky error -} - -func (gz *gzipReader) Read(p []byte) (n int, err error) { - if gz.zerr != nil { - return 0, gz.zerr - } - if gz.zr == nil { - gz.zr, err = gzip.NewReader(gz.body) - if err != nil { - gz.zerr = err - return 0, err - } - } - return gz.zr.Read(p) -} - -func (gz *gzipReader) Close() error { - return gz.body.Close() -} - -type errorReader struct{ err error } - -func (r errorReader) Read(p []byte) (int, error) { return 0, r.err } - -// bodyWriterState encapsulates various state around the Transport's writing -// of the request body, particularly regarding doing delayed writes of the body -// when the request contains "Expect: 100-continue". -type bodyWriterState struct { - cs *clientStream - timer *time.Timer // if non-nil, we're doing a delayed write - fnonce *sync.Once // to call fn with - fn func() // the code to run in the goroutine, writing the body - resc chan error // result of fn's execution - delay time.Duration // how long we should delay a delayed write for -} - -func (t *Transport) getBodyWriterState(cs *clientStream, body io.Reader) (s bodyWriterState) { - s.cs = cs - if body == nil { - return - } - resc := make(chan error, 1) - s.resc = resc - s.fn = func() { - cs.cc.mu.Lock() - cs.startedWrite = true - cs.cc.mu.Unlock() - resc <- cs.writeRequestBody(body, cs.req.Body) - } - s.delay = t.expectContinueTimeout() - if s.delay == 0 || - !httpguts.HeaderValuesContainsToken( - cs.req.Header["Expect"], - "100-continue") { - return - } - s.fnonce = new(sync.Once) - - // Arm the timer with a very large duration, which we'll - // intentionally lower later. It has to be large now because - // we need a handle to it before writing the headers, but the - // s.delay value is defined to not start until after the - // request headers were written. - const hugeDuration = 365 * 24 * time.Hour - s.timer = time.AfterFunc(hugeDuration, func() { - s.fnonce.Do(s.fn) - }) - return -} - -func (s bodyWriterState) cancel() { - if s.timer != nil { - s.timer.Stop() - } -} - -func (s bodyWriterState) on100() { - if s.timer == nil { - // If we didn't do a delayed write, ignore the server's - // bogus 100 continue response. - return - } - s.timer.Stop() - go func() { s.fnonce.Do(s.fn) }() -} - -// scheduleBodyWrite starts writing the body, either immediately (in -// the common case) or after the delay timeout. It should not be -// called until after the headers have been written. -func (s bodyWriterState) scheduleBodyWrite() { - if s.timer == nil { - // We're not doing a delayed write (see - // getBodyWriterState), so just start the writing - // goroutine immediately. - go s.fn() - return - } - traceWait100Continue(s.cs.trace) - if s.timer.Stop() { - s.timer.Reset(s.delay) - } -} - -// isConnectionCloseRequest reports whether req should use its own -// connection for a single request and then close the connection. -func isConnectionCloseRequest(req *http.Request) bool { - return req.Close || httpguts.HeaderValuesContainsToken(req.Header["Connection"], "close") -} - -// registerHTTPSProtocol calls Transport.RegisterProtocol but -// converting panics into errors. -func registerHTTPSProtocol(t *http.Transport, rt noDialH2RoundTripper) (err error) { - defer func() { - if e := recover(); e != nil { - err = fmt.Errorf("%v", e) - } - }() - t.RegisterProtocol("https", rt) - return nil -} - -// noDialH2RoundTripper is a RoundTripper which only tries to complete the request -// if there's already has a cached connection to the host. -// (The field is exported so it can be accessed via reflect from net/http; tested -// by TestNoDialH2RoundTripperType) -type noDialH2RoundTripper struct{ *Transport } - -func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - res, err := rt.Transport.RoundTrip(req) - if isNoCachedConnError(err) { - return nil, http.ErrSkipAltProtocol - } - return res, err -} - -func (t *Transport) idleConnTimeout() time.Duration { - if t.t1 != nil { - return t.t1.IdleConnTimeout - } - return 0 -} - -func traceGetConn(req *http.Request, hostPort string) { - trace := httptrace.ContextClientTrace(req.Context()) - if trace == nil || trace.GetConn == nil { - return - } - trace.GetConn(hostPort) -} - -func traceGotConn(req *http.Request, cc *ClientConn, reused bool) { - trace := httptrace.ContextClientTrace(req.Context()) - if trace == nil || trace.GotConn == nil { - return - } - ci := httptrace.GotConnInfo{Conn: cc.tconn} - ci.Reused = reused - cc.mu.Lock() - ci.WasIdle = len(cc.streams) == 0 && reused - if ci.WasIdle && !cc.lastActive.IsZero() { - ci.IdleTime = time.Now().Sub(cc.lastActive) - } - cc.mu.Unlock() - - trace.GotConn(ci) -} - -func traceWroteHeaders(trace *httptrace.ClientTrace) { - if trace != nil && trace.WroteHeaders != nil { - trace.WroteHeaders() - } -} - -func traceGot100Continue(trace *httptrace.ClientTrace) { - if trace != nil && trace.Got100Continue != nil { - trace.Got100Continue() - } -} - -func traceWait100Continue(trace *httptrace.ClientTrace) { - if trace != nil && trace.Wait100Continue != nil { - trace.Wait100Continue() - } -} - -func traceWroteRequest(trace *httptrace.ClientTrace, err error) { - if trace != nil && trace.WroteRequest != nil { - trace.WroteRequest(httptrace.WroteRequestInfo{Err: err}) - } -} - -func traceFirstResponseByte(trace *httptrace.ClientTrace) { - if trace != nil && trace.GotFirstResponseByte != nil { - trace.GotFirstResponseByte() - } -} diff --git a/vendor/golang.org/x/net/http2/write.go b/vendor/golang.org/x/net/http2/write.go deleted file mode 100644 index 3849bc263..000000000 --- a/vendor/golang.org/x/net/http2/write.go +++ /dev/null @@ -1,365 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "bytes" - "fmt" - "log" - "net/http" - "net/url" - - "golang.org/x/net/http/httpguts" - "golang.org/x/net/http2/hpack" -) - -// writeFramer is implemented by any type that is used to write frames. -type writeFramer interface { - writeFrame(writeContext) error - - // staysWithinBuffer reports whether this writer promises that - // it will only write less than or equal to size bytes, and it - // won't Flush the write context. - staysWithinBuffer(size int) bool -} - -// writeContext is the interface needed by the various frame writer -// types below. All the writeFrame methods below are scheduled via the -// frame writing scheduler (see writeScheduler in writesched.go). -// -// This interface is implemented by *serverConn. -// -// TODO: decide whether to a) use this in the client code (which didn't -// end up using this yet, because it has a simpler design, not -// currently implementing priorities), or b) delete this and -// make the server code a bit more concrete. -type writeContext interface { - Framer() *Framer - Flush() error - CloseConn() error - // HeaderEncoder returns an HPACK encoder that writes to the - // returned buffer. - HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) -} - -// writeEndsStream reports whether w writes a frame that will transition -// the stream to a half-closed local state. This returns false for RST_STREAM, -// which closes the entire stream (not just the local half). -func writeEndsStream(w writeFramer) bool { - switch v := w.(type) { - case *writeData: - return v.endStream - case *writeResHeaders: - return v.endStream - case nil: - // This can only happen if the caller reuses w after it's - // been intentionally nil'ed out to prevent use. Keep this - // here to catch future refactoring breaking it. - panic("writeEndsStream called on nil writeFramer") - } - return false -} - -type flushFrameWriter struct{} - -func (flushFrameWriter) writeFrame(ctx writeContext) error { - return ctx.Flush() -} - -func (flushFrameWriter) staysWithinBuffer(max int) bool { return false } - -type writeSettings []Setting - -func (s writeSettings) staysWithinBuffer(max int) bool { - const settingSize = 6 // uint16 + uint32 - return frameHeaderLen+settingSize*len(s) <= max - -} - -func (s writeSettings) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteSettings([]Setting(s)...) -} - -type writeGoAway struct { - maxStreamID uint32 - code ErrCode -} - -func (p *writeGoAway) writeFrame(ctx writeContext) error { - err := ctx.Framer().WriteGoAway(p.maxStreamID, p.code, nil) - ctx.Flush() // ignore error: we're hanging up on them anyway - return err -} - -func (*writeGoAway) staysWithinBuffer(max int) bool { return false } // flushes - -type writeData struct { - streamID uint32 - p []byte - endStream bool -} - -func (w *writeData) String() string { - return fmt.Sprintf("writeData(stream=%d, p=%d, endStream=%v)", w.streamID, len(w.p), w.endStream) -} - -func (w *writeData) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteData(w.streamID, w.endStream, w.p) -} - -func (w *writeData) staysWithinBuffer(max int) bool { - return frameHeaderLen+len(w.p) <= max -} - -// handlerPanicRST is the message sent from handler goroutines when -// the handler panics. -type handlerPanicRST struct { - StreamID uint32 -} - -func (hp handlerPanicRST) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteRSTStream(hp.StreamID, ErrCodeInternal) -} - -func (hp handlerPanicRST) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max } - -func (se StreamError) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteRSTStream(se.StreamID, se.Code) -} - -func (se StreamError) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max } - -type writePingAck struct{ pf *PingFrame } - -func (w writePingAck) writeFrame(ctx writeContext) error { - return ctx.Framer().WritePing(true, w.pf.Data) -} - -func (w writePingAck) staysWithinBuffer(max int) bool { return frameHeaderLen+len(w.pf.Data) <= max } - -type writeSettingsAck struct{} - -func (writeSettingsAck) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteSettingsAck() -} - -func (writeSettingsAck) staysWithinBuffer(max int) bool { return frameHeaderLen <= max } - -// splitHeaderBlock splits headerBlock into fragments so that each fragment fits -// in a single frame, then calls fn for each fragment. firstFrag/lastFrag are true -// for the first/last fragment, respectively. -func splitHeaderBlock(ctx writeContext, headerBlock []byte, fn func(ctx writeContext, frag []byte, firstFrag, lastFrag bool) error) error { - // For now we're lazy and just pick the minimum MAX_FRAME_SIZE - // that all peers must support (16KB). Later we could care - // more and send larger frames if the peer advertised it, but - // there's little point. Most headers are small anyway (so we - // generally won't have CONTINUATION frames), and extra frames - // only waste 9 bytes anyway. - const maxFrameSize = 16384 - - first := true - for len(headerBlock) > 0 { - frag := headerBlock - if len(frag) > maxFrameSize { - frag = frag[:maxFrameSize] - } - headerBlock = headerBlock[len(frag):] - if err := fn(ctx, frag, first, len(headerBlock) == 0); err != nil { - return err - } - first = false - } - return nil -} - -// writeResHeaders is a request to write a HEADERS and 0+ CONTINUATION frames -// for HTTP response headers or trailers from a server handler. -type writeResHeaders struct { - streamID uint32 - httpResCode int // 0 means no ":status" line - h http.Header // may be nil - trailers []string // if non-nil, which keys of h to write. nil means all. - endStream bool - - date string - contentType string - contentLength string -} - -func encKV(enc *hpack.Encoder, k, v string) { - if VerboseLogs { - log.Printf("http2: server encoding header %q = %q", k, v) - } - enc.WriteField(hpack.HeaderField{Name: k, Value: v}) -} - -func (w *writeResHeaders) staysWithinBuffer(max int) bool { - // TODO: this is a common one. It'd be nice to return true - // here and get into the fast path if we could be clever and - // calculate the size fast enough, or at least a conservative - // upper bound that usually fires. (Maybe if w.h and - // w.trailers are nil, so we don't need to enumerate it.) - // Otherwise I'm afraid that just calculating the length to - // answer this question would be slower than the ~2µs benefit. - return false -} - -func (w *writeResHeaders) writeFrame(ctx writeContext) error { - enc, buf := ctx.HeaderEncoder() - buf.Reset() - - if w.httpResCode != 0 { - encKV(enc, ":status", httpCodeString(w.httpResCode)) - } - - encodeHeaders(enc, w.h, w.trailers) - - if w.contentType != "" { - encKV(enc, "content-type", w.contentType) - } - if w.contentLength != "" { - encKV(enc, "content-length", w.contentLength) - } - if w.date != "" { - encKV(enc, "date", w.date) - } - - headerBlock := buf.Bytes() - if len(headerBlock) == 0 && w.trailers == nil { - panic("unexpected empty hpack") - } - - return splitHeaderBlock(ctx, headerBlock, w.writeHeaderBlock) -} - -func (w *writeResHeaders) writeHeaderBlock(ctx writeContext, frag []byte, firstFrag, lastFrag bool) error { - if firstFrag { - return ctx.Framer().WriteHeaders(HeadersFrameParam{ - StreamID: w.streamID, - BlockFragment: frag, - EndStream: w.endStream, - EndHeaders: lastFrag, - }) - } else { - return ctx.Framer().WriteContinuation(w.streamID, lastFrag, frag) - } -} - -// writePushPromise is a request to write a PUSH_PROMISE and 0+ CONTINUATION frames. -type writePushPromise struct { - streamID uint32 // pusher stream - method string // for :method - url *url.URL // for :scheme, :authority, :path - h http.Header - - // Creates an ID for a pushed stream. This runs on serveG just before - // the frame is written. The returned ID is copied to promisedID. - allocatePromisedID func() (uint32, error) - promisedID uint32 -} - -func (w *writePushPromise) staysWithinBuffer(max int) bool { - // TODO: see writeResHeaders.staysWithinBuffer - return false -} - -func (w *writePushPromise) writeFrame(ctx writeContext) error { - enc, buf := ctx.HeaderEncoder() - buf.Reset() - - encKV(enc, ":method", w.method) - encKV(enc, ":scheme", w.url.Scheme) - encKV(enc, ":authority", w.url.Host) - encKV(enc, ":path", w.url.RequestURI()) - encodeHeaders(enc, w.h, nil) - - headerBlock := buf.Bytes() - if len(headerBlock) == 0 { - panic("unexpected empty hpack") - } - - return splitHeaderBlock(ctx, headerBlock, w.writeHeaderBlock) -} - -func (w *writePushPromise) writeHeaderBlock(ctx writeContext, frag []byte, firstFrag, lastFrag bool) error { - if firstFrag { - return ctx.Framer().WritePushPromise(PushPromiseParam{ - StreamID: w.streamID, - PromiseID: w.promisedID, - BlockFragment: frag, - EndHeaders: lastFrag, - }) - } else { - return ctx.Framer().WriteContinuation(w.streamID, lastFrag, frag) - } -} - -type write100ContinueHeadersFrame struct { - streamID uint32 -} - -func (w write100ContinueHeadersFrame) writeFrame(ctx writeContext) error { - enc, buf := ctx.HeaderEncoder() - buf.Reset() - encKV(enc, ":status", "100") - return ctx.Framer().WriteHeaders(HeadersFrameParam{ - StreamID: w.streamID, - BlockFragment: buf.Bytes(), - EndStream: false, - EndHeaders: true, - }) -} - -func (w write100ContinueHeadersFrame) staysWithinBuffer(max int) bool { - // Sloppy but conservative: - return 9+2*(len(":status")+len("100")) <= max -} - -type writeWindowUpdate struct { - streamID uint32 // or 0 for conn-level - n uint32 -} - -func (wu writeWindowUpdate) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max } - -func (wu writeWindowUpdate) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteWindowUpdate(wu.streamID, wu.n) -} - -// encodeHeaders encodes an http.Header. If keys is not nil, then (k, h[k]) -// is encoded only if k is in keys. -func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) { - if keys == nil { - sorter := sorterPool.Get().(*sorter) - // Using defer here, since the returned keys from the - // sorter.Keys method is only valid until the sorter - // is returned: - defer sorterPool.Put(sorter) - keys = sorter.Keys(h) - } - for _, k := range keys { - vv := h[k] - k = lowerHeader(k) - if !validWireHeaderFieldName(k) { - // Skip it as backup paranoia. Per - // golang.org/issue/14048, these should - // already be rejected at a higher level. - continue - } - isTE := k == "transfer-encoding" - for _, v := range vv { - if !httpguts.ValidHeaderFieldValue(v) { - // TODO: return an error? golang.org/issue/14048 - // For now just omit it. - continue - } - // TODO: more of "8.1.2.2 Connection-Specific Header Fields" - if isTE && v != "trailers" { - continue - } - encKV(enc, k, v) - } - } -} diff --git a/vendor/golang.org/x/net/http2/writesched.go b/vendor/golang.org/x/net/http2/writesched.go deleted file mode 100644 index f24d2b1e7..000000000 --- a/vendor/golang.org/x/net/http2/writesched.go +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import "fmt" - -// WriteScheduler is the interface implemented by HTTP/2 write schedulers. -// Methods are never called concurrently. -type WriteScheduler interface { - // OpenStream opens a new stream in the write scheduler. - // It is illegal to call this with streamID=0 or with a streamID that is - // already open -- the call may panic. - OpenStream(streamID uint32, options OpenStreamOptions) - - // CloseStream closes a stream in the write scheduler. Any frames queued on - // this stream should be discarded. It is illegal to call this on a stream - // that is not open -- the call may panic. - CloseStream(streamID uint32) - - // AdjustStream adjusts the priority of the given stream. This may be called - // on a stream that has not yet been opened or has been closed. Note that - // RFC 7540 allows PRIORITY frames to be sent on streams in any state. See: - // https://tools.ietf.org/html/rfc7540#section-5.1 - AdjustStream(streamID uint32, priority PriorityParam) - - // Push queues a frame in the scheduler. In most cases, this will not be - // called with wr.StreamID()!=0 unless that stream is currently open. The one - // exception is RST_STREAM frames, which may be sent on idle or closed streams. - Push(wr FrameWriteRequest) - - // Pop dequeues the next frame to write. Returns false if no frames can - // be written. Frames with a given wr.StreamID() are Pop'd in the same - // order they are Push'd. No frames should be discarded except by CloseStream. - Pop() (wr FrameWriteRequest, ok bool) -} - -// OpenStreamOptions specifies extra options for WriteScheduler.OpenStream. -type OpenStreamOptions struct { - // PusherID is zero if the stream was initiated by the client. Otherwise, - // PusherID names the stream that pushed the newly opened stream. - PusherID uint32 -} - -// FrameWriteRequest is a request to write a frame. -type FrameWriteRequest struct { - // write is the interface value that does the writing, once the - // WriteScheduler has selected this frame to write. The write - // functions are all defined in write.go. - write writeFramer - - // stream is the stream on which this frame will be written. - // nil for non-stream frames like PING and SETTINGS. - stream *stream - - // done, if non-nil, must be a buffered channel with space for - // 1 message and is sent the return value from write (or an - // earlier error) when the frame has been written. - done chan error -} - -// StreamID returns the id of the stream this frame will be written to. -// 0 is used for non-stream frames such as PING and SETTINGS. -func (wr FrameWriteRequest) StreamID() uint32 { - if wr.stream == nil { - if se, ok := wr.write.(StreamError); ok { - // (*serverConn).resetStream doesn't set - // stream because it doesn't necessarily have - // one. So special case this type of write - // message. - return se.StreamID - } - return 0 - } - return wr.stream.id -} - -// isControl reports whether wr is a control frame for MaxQueuedControlFrames -// purposes. That includes non-stream frames and RST_STREAM frames. -func (wr FrameWriteRequest) isControl() bool { - return wr.stream == nil -} - -// DataSize returns the number of flow control bytes that must be consumed -// to write this entire frame. This is 0 for non-DATA frames. -func (wr FrameWriteRequest) DataSize() int { - if wd, ok := wr.write.(*writeData); ok { - return len(wd.p) - } - return 0 -} - -// Consume consumes min(n, available) bytes from this frame, where available -// is the number of flow control bytes available on the stream. Consume returns -// 0, 1, or 2 frames, where the integer return value gives the number of frames -// returned. -// -// If flow control prevents consuming any bytes, this returns (_, _, 0). If -// the entire frame was consumed, this returns (wr, _, 1). Otherwise, this -// returns (consumed, rest, 2), where 'consumed' contains the consumed bytes and -// 'rest' contains the remaining bytes. The consumed bytes are deducted from the -// underlying stream's flow control budget. -func (wr FrameWriteRequest) Consume(n int32) (FrameWriteRequest, FrameWriteRequest, int) { - var empty FrameWriteRequest - - // Non-DATA frames are always consumed whole. - wd, ok := wr.write.(*writeData) - if !ok || len(wd.p) == 0 { - return wr, empty, 1 - } - - // Might need to split after applying limits. - allowed := wr.stream.flow.available() - if n < allowed { - allowed = n - } - if wr.stream.sc.maxFrameSize < allowed { - allowed = wr.stream.sc.maxFrameSize - } - if allowed <= 0 { - return empty, empty, 0 - } - if len(wd.p) > int(allowed) { - wr.stream.flow.take(allowed) - consumed := FrameWriteRequest{ - stream: wr.stream, - write: &writeData{ - streamID: wd.streamID, - p: wd.p[:allowed], - // Even if the original had endStream set, there - // are bytes remaining because len(wd.p) > allowed, - // so we know endStream is false. - endStream: false, - }, - // Our caller is blocking on the final DATA frame, not - // this intermediate frame, so no need to wait. - done: nil, - } - rest := FrameWriteRequest{ - stream: wr.stream, - write: &writeData{ - streamID: wd.streamID, - p: wd.p[allowed:], - endStream: wd.endStream, - }, - done: wr.done, - } - return consumed, rest, 2 - } - - // The frame is consumed whole. - // NB: This cast cannot overflow because allowed is <= math.MaxInt32. - wr.stream.flow.take(int32(len(wd.p))) - return wr, empty, 1 -} - -// String is for debugging only. -func (wr FrameWriteRequest) String() string { - var des string - if s, ok := wr.write.(fmt.Stringer); ok { - des = s.String() - } else { - des = fmt.Sprintf("%T", wr.write) - } - return fmt.Sprintf("[FrameWriteRequest stream=%d, ch=%v, writer=%v]", wr.StreamID(), wr.done != nil, des) -} - -// replyToWriter sends err to wr.done and panics if the send must block -// This does nothing if wr.done is nil. -func (wr *FrameWriteRequest) replyToWriter(err error) { - if wr.done == nil { - return - } - select { - case wr.done <- err: - default: - panic(fmt.Sprintf("unbuffered done channel passed in for type %T", wr.write)) - } - wr.write = nil // prevent use (assume it's tainted after wr.done send) -} - -// writeQueue is used by implementations of WriteScheduler. -type writeQueue struct { - s []FrameWriteRequest -} - -func (q *writeQueue) empty() bool { return len(q.s) == 0 } - -func (q *writeQueue) push(wr FrameWriteRequest) { - q.s = append(q.s, wr) -} - -func (q *writeQueue) shift() FrameWriteRequest { - if len(q.s) == 0 { - panic("invalid use of queue") - } - wr := q.s[0] - // TODO: less copy-happy queue. - copy(q.s, q.s[1:]) - q.s[len(q.s)-1] = FrameWriteRequest{} - q.s = q.s[:len(q.s)-1] - return wr -} - -// consume consumes up to n bytes from q.s[0]. If the frame is -// entirely consumed, it is removed from the queue. If the frame -// is partially consumed, the frame is kept with the consumed -// bytes removed. Returns true iff any bytes were consumed. -func (q *writeQueue) consume(n int32) (FrameWriteRequest, bool) { - if len(q.s) == 0 { - return FrameWriteRequest{}, false - } - consumed, rest, numresult := q.s[0].Consume(n) - switch numresult { - case 0: - return FrameWriteRequest{}, false - case 1: - q.shift() - case 2: - q.s[0] = rest - } - return consumed, true -} - -type writeQueuePool []*writeQueue - -// put inserts an unused writeQueue into the pool. -func (p *writeQueuePool) put(q *writeQueue) { - for i := range q.s { - q.s[i] = FrameWriteRequest{} - } - q.s = q.s[:0] - *p = append(*p, q) -} - -// get returns an empty writeQueue. -func (p *writeQueuePool) get() *writeQueue { - ln := len(*p) - if ln == 0 { - return new(writeQueue) - } - x := ln - 1 - q := (*p)[x] - (*p)[x] = nil - *p = (*p)[:x] - return q -} diff --git a/vendor/golang.org/x/net/http2/writesched_priority.go b/vendor/golang.org/x/net/http2/writesched_priority.go deleted file mode 100644 index 2618b2c11..000000000 --- a/vendor/golang.org/x/net/http2/writesched_priority.go +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import ( - "fmt" - "math" - "sort" -) - -// RFC 7540, Section 5.3.5: the default weight is 16. -const priorityDefaultWeight = 15 // 16 = 15 + 1 - -// PriorityWriteSchedulerConfig configures a priorityWriteScheduler. -type PriorityWriteSchedulerConfig struct { - // MaxClosedNodesInTree controls the maximum number of closed streams to - // retain in the priority tree. Setting this to zero saves a small amount - // of memory at the cost of performance. - // - // See RFC 7540, Section 5.3.4: - // "It is possible for a stream to become closed while prioritization - // information ... is in transit. ... This potentially creates suboptimal - // prioritization, since the stream could be given a priority that is - // different from what is intended. To avoid these problems, an endpoint - // SHOULD retain stream prioritization state for a period after streams - // become closed. The longer state is retained, the lower the chance that - // streams are assigned incorrect or default priority values." - MaxClosedNodesInTree int - - // MaxIdleNodesInTree controls the maximum number of idle streams to - // retain in the priority tree. Setting this to zero saves a small amount - // of memory at the cost of performance. - // - // See RFC 7540, Section 5.3.4: - // Similarly, streams that are in the "idle" state can be assigned - // priority or become a parent of other streams. This allows for the - // creation of a grouping node in the dependency tree, which enables - // more flexible expressions of priority. Idle streams begin with a - // default priority (Section 5.3.5). - MaxIdleNodesInTree int - - // ThrottleOutOfOrderWrites enables write throttling to help ensure that - // data is delivered in priority order. This works around a race where - // stream B depends on stream A and both streams are about to call Write - // to queue DATA frames. If B wins the race, a naive scheduler would eagerly - // write as much data from B as possible, but this is suboptimal because A - // is a higher-priority stream. With throttling enabled, we write a small - // amount of data from B to minimize the amount of bandwidth that B can - // steal from A. - ThrottleOutOfOrderWrites bool -} - -// NewPriorityWriteScheduler constructs a WriteScheduler that schedules -// frames by following HTTP/2 priorities as described in RFC 7540 Section 5.3. -// If cfg is nil, default options are used. -func NewPriorityWriteScheduler(cfg *PriorityWriteSchedulerConfig) WriteScheduler { - if cfg == nil { - // For justification of these defaults, see: - // https://docs.google.com/document/d/1oLhNg1skaWD4_DtaoCxdSRN5erEXrH-KnLrMwEpOtFY - cfg = &PriorityWriteSchedulerConfig{ - MaxClosedNodesInTree: 10, - MaxIdleNodesInTree: 10, - ThrottleOutOfOrderWrites: false, - } - } - - ws := &priorityWriteScheduler{ - nodes: make(map[uint32]*priorityNode), - maxClosedNodesInTree: cfg.MaxClosedNodesInTree, - maxIdleNodesInTree: cfg.MaxIdleNodesInTree, - enableWriteThrottle: cfg.ThrottleOutOfOrderWrites, - } - ws.nodes[0] = &ws.root - if cfg.ThrottleOutOfOrderWrites { - ws.writeThrottleLimit = 1024 - } else { - ws.writeThrottleLimit = math.MaxInt32 - } - return ws -} - -type priorityNodeState int - -const ( - priorityNodeOpen priorityNodeState = iota - priorityNodeClosed - priorityNodeIdle -) - -// priorityNode is a node in an HTTP/2 priority tree. -// Each node is associated with a single stream ID. -// See RFC 7540, Section 5.3. -type priorityNode struct { - q writeQueue // queue of pending frames to write - id uint32 // id of the stream, or 0 for the root of the tree - weight uint8 // the actual weight is weight+1, so the value is in [1,256] - state priorityNodeState // open | closed | idle - bytes int64 // number of bytes written by this node, or 0 if closed - subtreeBytes int64 // sum(node.bytes) of all nodes in this subtree - - // These links form the priority tree. - parent *priorityNode - kids *priorityNode // start of the kids list - prev, next *priorityNode // doubly-linked list of siblings -} - -func (n *priorityNode) setParent(parent *priorityNode) { - if n == parent { - panic("setParent to self") - } - if n.parent == parent { - return - } - // Unlink from current parent. - if parent := n.parent; parent != nil { - if n.prev == nil { - parent.kids = n.next - } else { - n.prev.next = n.next - } - if n.next != nil { - n.next.prev = n.prev - } - } - // Link to new parent. - // If parent=nil, remove n from the tree. - // Always insert at the head of parent.kids (this is assumed by walkReadyInOrder). - n.parent = parent - if parent == nil { - n.next = nil - n.prev = nil - } else { - n.next = parent.kids - n.prev = nil - if n.next != nil { - n.next.prev = n - } - parent.kids = n - } -} - -func (n *priorityNode) addBytes(b int64) { - n.bytes += b - for ; n != nil; n = n.parent { - n.subtreeBytes += b - } -} - -// walkReadyInOrder iterates over the tree in priority order, calling f for each node -// with a non-empty write queue. When f returns true, this function returns true and the -// walk halts. tmp is used as scratch space for sorting. -// -// f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true -// if any ancestor p of n is still open (ignoring the root node). -func (n *priorityNode) walkReadyInOrder(openParent bool, tmp *[]*priorityNode, f func(*priorityNode, bool) bool) bool { - if !n.q.empty() && f(n, openParent) { - return true - } - if n.kids == nil { - return false - } - - // Don't consider the root "open" when updating openParent since - // we can't send data frames on the root stream (only control frames). - if n.id != 0 { - openParent = openParent || (n.state == priorityNodeOpen) - } - - // Common case: only one kid or all kids have the same weight. - // Some clients don't use weights; other clients (like web browsers) - // use mostly-linear priority trees. - w := n.kids.weight - needSort := false - for k := n.kids.next; k != nil; k = k.next { - if k.weight != w { - needSort = true - break - } - } - if !needSort { - for k := n.kids; k != nil; k = k.next { - if k.walkReadyInOrder(openParent, tmp, f) { - return true - } - } - return false - } - - // Uncommon case: sort the child nodes. We remove the kids from the parent, - // then re-insert after sorting so we can reuse tmp for future sort calls. - *tmp = (*tmp)[:0] - for n.kids != nil { - *tmp = append(*tmp, n.kids) - n.kids.setParent(nil) - } - sort.Sort(sortPriorityNodeSiblings(*tmp)) - for i := len(*tmp) - 1; i >= 0; i-- { - (*tmp)[i].setParent(n) // setParent inserts at the head of n.kids - } - for k := n.kids; k != nil; k = k.next { - if k.walkReadyInOrder(openParent, tmp, f) { - return true - } - } - return false -} - -type sortPriorityNodeSiblings []*priorityNode - -func (z sortPriorityNodeSiblings) Len() int { return len(z) } -func (z sortPriorityNodeSiblings) Swap(i, k int) { z[i], z[k] = z[k], z[i] } -func (z sortPriorityNodeSiblings) Less(i, k int) bool { - // Prefer the subtree that has sent fewer bytes relative to its weight. - // See sections 5.3.2 and 5.3.4. - wi, bi := float64(z[i].weight+1), float64(z[i].subtreeBytes) - wk, bk := float64(z[k].weight+1), float64(z[k].subtreeBytes) - if bi == 0 && bk == 0 { - return wi >= wk - } - if bk == 0 { - return false - } - return bi/bk <= wi/wk -} - -type priorityWriteScheduler struct { - // root is the root of the priority tree, where root.id = 0. - // The root queues control frames that are not associated with any stream. - root priorityNode - - // nodes maps stream ids to priority tree nodes. - nodes map[uint32]*priorityNode - - // maxID is the maximum stream id in nodes. - maxID uint32 - - // lists of nodes that have been closed or are idle, but are kept in - // the tree for improved prioritization. When the lengths exceed either - // maxClosedNodesInTree or maxIdleNodesInTree, old nodes are discarded. - closedNodes, idleNodes []*priorityNode - - // From the config. - maxClosedNodesInTree int - maxIdleNodesInTree int - writeThrottleLimit int32 - enableWriteThrottle bool - - // tmp is scratch space for priorityNode.walkReadyInOrder to reduce allocations. - tmp []*priorityNode - - // pool of empty queues for reuse. - queuePool writeQueuePool -} - -func (ws *priorityWriteScheduler) OpenStream(streamID uint32, options OpenStreamOptions) { - // The stream may be currently idle but cannot be opened or closed. - if curr := ws.nodes[streamID]; curr != nil { - if curr.state != priorityNodeIdle { - panic(fmt.Sprintf("stream %d already opened", streamID)) - } - curr.state = priorityNodeOpen - return - } - - // RFC 7540, Section 5.3.5: - // "All streams are initially assigned a non-exclusive dependency on stream 0x0. - // Pushed streams initially depend on their associated stream. In both cases, - // streams are assigned a default weight of 16." - parent := ws.nodes[options.PusherID] - if parent == nil { - parent = &ws.root - } - n := &priorityNode{ - q: *ws.queuePool.get(), - id: streamID, - weight: priorityDefaultWeight, - state: priorityNodeOpen, - } - n.setParent(parent) - ws.nodes[streamID] = n - if streamID > ws.maxID { - ws.maxID = streamID - } -} - -func (ws *priorityWriteScheduler) CloseStream(streamID uint32) { - if streamID == 0 { - panic("violation of WriteScheduler interface: cannot close stream 0") - } - if ws.nodes[streamID] == nil { - panic(fmt.Sprintf("violation of WriteScheduler interface: unknown stream %d", streamID)) - } - if ws.nodes[streamID].state != priorityNodeOpen { - panic(fmt.Sprintf("violation of WriteScheduler interface: stream %d already closed", streamID)) - } - - n := ws.nodes[streamID] - n.state = priorityNodeClosed - n.addBytes(-n.bytes) - - q := n.q - ws.queuePool.put(&q) - n.q.s = nil - if ws.maxClosedNodesInTree > 0 { - ws.addClosedOrIdleNode(&ws.closedNodes, ws.maxClosedNodesInTree, n) - } else { - ws.removeNode(n) - } -} - -func (ws *priorityWriteScheduler) AdjustStream(streamID uint32, priority PriorityParam) { - if streamID == 0 { - panic("adjustPriority on root") - } - - // If streamID does not exist, there are two cases: - // - A closed stream that has been removed (this will have ID <= maxID) - // - An idle stream that is being used for "grouping" (this will have ID > maxID) - n := ws.nodes[streamID] - if n == nil { - if streamID <= ws.maxID || ws.maxIdleNodesInTree == 0 { - return - } - ws.maxID = streamID - n = &priorityNode{ - q: *ws.queuePool.get(), - id: streamID, - weight: priorityDefaultWeight, - state: priorityNodeIdle, - } - n.setParent(&ws.root) - ws.nodes[streamID] = n - ws.addClosedOrIdleNode(&ws.idleNodes, ws.maxIdleNodesInTree, n) - } - - // Section 5.3.1: A dependency on a stream that is not currently in the tree - // results in that stream being given a default priority (Section 5.3.5). - parent := ws.nodes[priority.StreamDep] - if parent == nil { - n.setParent(&ws.root) - n.weight = priorityDefaultWeight - return - } - - // Ignore if the client tries to make a node its own parent. - if n == parent { - return - } - - // Section 5.3.3: - // "If a stream is made dependent on one of its own dependencies, the - // formerly dependent stream is first moved to be dependent on the - // reprioritized stream's previous parent. The moved dependency retains - // its weight." - // - // That is: if parent depends on n, move parent to depend on n.parent. - for x := parent.parent; x != nil; x = x.parent { - if x == n { - parent.setParent(n.parent) - break - } - } - - // Section 5.3.3: The exclusive flag causes the stream to become the sole - // dependency of its parent stream, causing other dependencies to become - // dependent on the exclusive stream. - if priority.Exclusive { - k := parent.kids - for k != nil { - next := k.next - if k != n { - k.setParent(n) - } - k = next - } - } - - n.setParent(parent) - n.weight = priority.Weight -} - -func (ws *priorityWriteScheduler) Push(wr FrameWriteRequest) { - var n *priorityNode - if id := wr.StreamID(); id == 0 { - n = &ws.root - } else { - n = ws.nodes[id] - if n == nil { - // id is an idle or closed stream. wr should not be a HEADERS or - // DATA frame. However, wr can be a RST_STREAM. In this case, we - // push wr onto the root, rather than creating a new priorityNode, - // since RST_STREAM is tiny and the stream's priority is unknown - // anyway. See issue #17919. - if wr.DataSize() > 0 { - panic("add DATA on non-open stream") - } - n = &ws.root - } - } - n.q.push(wr) -} - -func (ws *priorityWriteScheduler) Pop() (wr FrameWriteRequest, ok bool) { - ws.root.walkReadyInOrder(false, &ws.tmp, func(n *priorityNode, openParent bool) bool { - limit := int32(math.MaxInt32) - if openParent { - limit = ws.writeThrottleLimit - } - wr, ok = n.q.consume(limit) - if !ok { - return false - } - n.addBytes(int64(wr.DataSize())) - // If B depends on A and B continuously has data available but A - // does not, gradually increase the throttling limit to allow B to - // steal more and more bandwidth from A. - if openParent { - ws.writeThrottleLimit += 1024 - if ws.writeThrottleLimit < 0 { - ws.writeThrottleLimit = math.MaxInt32 - } - } else if ws.enableWriteThrottle { - ws.writeThrottleLimit = 1024 - } - return true - }) - return wr, ok -} - -func (ws *priorityWriteScheduler) addClosedOrIdleNode(list *[]*priorityNode, maxSize int, n *priorityNode) { - if maxSize == 0 { - return - } - if len(*list) == maxSize { - // Remove the oldest node, then shift left. - ws.removeNode((*list)[0]) - x := (*list)[1:] - copy(*list, x) - *list = (*list)[:len(x)] - } - *list = append(*list, n) -} - -func (ws *priorityWriteScheduler) removeNode(n *priorityNode) { - for k := n.kids; k != nil; k = k.next { - k.setParent(n.parent) - } - n.setParent(nil) - delete(ws.nodes, n.id) -} diff --git a/vendor/golang.org/x/net/http2/writesched_random.go b/vendor/golang.org/x/net/http2/writesched_random.go deleted file mode 100644 index 9a7b9e581..000000000 --- a/vendor/golang.org/x/net/http2/writesched_random.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package http2 - -import "math" - -// NewRandomWriteScheduler constructs a WriteScheduler that ignores HTTP/2 -// priorities. Control frames like SETTINGS and PING are written before DATA -// frames, but if no control frames are queued and multiple streams have queued -// HEADERS or DATA frames, Pop selects a ready stream arbitrarily. -func NewRandomWriteScheduler() WriteScheduler { - return &randomWriteScheduler{sq: make(map[uint32]*writeQueue)} -} - -type randomWriteScheduler struct { - // zero are frames not associated with a specific stream. - zero writeQueue - - // sq contains the stream-specific queues, keyed by stream ID. - // When a stream is idle, closed, or emptied, it's deleted - // from the map. - sq map[uint32]*writeQueue - - // pool of empty queues for reuse. - queuePool writeQueuePool -} - -func (ws *randomWriteScheduler) OpenStream(streamID uint32, options OpenStreamOptions) { - // no-op: idle streams are not tracked -} - -func (ws *randomWriteScheduler) CloseStream(streamID uint32) { - q, ok := ws.sq[streamID] - if !ok { - return - } - delete(ws.sq, streamID) - ws.queuePool.put(q) -} - -func (ws *randomWriteScheduler) AdjustStream(streamID uint32, priority PriorityParam) { - // no-op: priorities are ignored -} - -func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) { - id := wr.StreamID() - if id == 0 { - ws.zero.push(wr) - return - } - q, ok := ws.sq[id] - if !ok { - q = ws.queuePool.get() - ws.sq[id] = q - } - q.push(wr) -} - -func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) { - // Control frames first. - if !ws.zero.empty() { - return ws.zero.shift(), true - } - // Iterate over all non-idle streams until finding one that can be consumed. - for streamID, q := range ws.sq { - if wr, ok := q.consume(math.MaxInt32); ok { - if q.empty() { - delete(ws.sq, streamID) - ws.queuePool.put(q) - } - return wr, true - } - } - return FrameWriteRequest{}, false -} diff --git a/vendor/golang.org/x/net/idna/idna10.0.0.go b/vendor/golang.org/x/net/idna/idna10.0.0.go deleted file mode 100644 index a98a31f40..000000000 --- a/vendor/golang.org/x/net/idna/idna10.0.0.go +++ /dev/null @@ -1,734 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.10 - -// Package idna implements IDNA2008 using the compatibility processing -// defined by UTS (Unicode Technical Standard) #46, which defines a standard to -// deal with the transition from IDNA2003. -// -// IDNA2008 (Internationalized Domain Names for Applications), is defined in RFC -// 5890, RFC 5891, RFC 5892, RFC 5893 and RFC 5894. -// UTS #46 is defined in https://www.unicode.org/reports/tr46. -// See https://unicode.org/cldr/utility/idna.jsp for a visualization of the -// differences between these two standards. -package idna // import "golang.org/x/net/idna" - -import ( - "fmt" - "strings" - "unicode/utf8" - - "golang.org/x/text/secure/bidirule" - "golang.org/x/text/unicode/bidi" - "golang.org/x/text/unicode/norm" -) - -// NOTE: Unlike common practice in Go APIs, the functions will return a -// sanitized domain name in case of errors. Browsers sometimes use a partially -// evaluated string as lookup. -// TODO: the current error handling is, in my opinion, the least opinionated. -// Other strategies are also viable, though: -// Option 1) Return an empty string in case of error, but allow the user to -// specify explicitly which errors to ignore. -// Option 2) Return the partially evaluated string if it is itself a valid -// string, otherwise return the empty string in case of error. -// Option 3) Option 1 and 2. -// Option 4) Always return an empty string for now and implement Option 1 as -// needed, and document that the return string may not be empty in case of -// error in the future. -// I think Option 1 is best, but it is quite opinionated. - -// ToASCII is a wrapper for Punycode.ToASCII. -func ToASCII(s string) (string, error) { - return Punycode.process(s, true) -} - -// ToUnicode is a wrapper for Punycode.ToUnicode. -func ToUnicode(s string) (string, error) { - return Punycode.process(s, false) -} - -// An Option configures a Profile at creation time. -type Option func(*options) - -// Transitional sets a Profile to use the Transitional mapping as defined in UTS -// #46. This will cause, for example, "ß" to be mapped to "ss". Using the -// transitional mapping provides a compromise between IDNA2003 and IDNA2008 -// compatibility. It is used by most browsers when resolving domain names. This -// option is only meaningful if combined with MapForLookup. -func Transitional(transitional bool) Option { - return func(o *options) { o.transitional = true } -} - -// VerifyDNSLength sets whether a Profile should fail if any of the IDN parts -// are longer than allowed by the RFC. -func VerifyDNSLength(verify bool) Option { - return func(o *options) { o.verifyDNSLength = verify } -} - -// RemoveLeadingDots removes leading label separators. Leading runes that map to -// dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. -// -// This is the behavior suggested by the UTS #46 and is adopted by some -// browsers. -func RemoveLeadingDots(remove bool) Option { - return func(o *options) { o.removeLeadingDots = remove } -} - -// ValidateLabels sets whether to check the mandatory label validation criteria -// as defined in Section 5.4 of RFC 5891. This includes testing for correct use -// of hyphens ('-'), normalization, validity of runes, and the context rules. -func ValidateLabels(enable bool) Option { - return func(o *options) { - // Don't override existing mappings, but set one that at least checks - // normalization if it is not set. - if o.mapping == nil && enable { - o.mapping = normalize - } - o.trie = trie - o.validateLabels = enable - o.fromPuny = validateFromPunycode - } -} - -// StrictDomainName limits the set of permissible ASCII characters to those -// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration. -// -// This option is useful, for instance, for browsers that allow characters -// outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details This option -// corresponds to the UseSTD3ASCIIRules option in UTS #46. -func StrictDomainName(use bool) Option { - return func(o *options) { - o.trie = trie - o.useSTD3Rules = use - o.fromPuny = validateFromPunycode - } -} - -// NOTE: the following options pull in tables. The tables should not be linked -// in as long as the options are not used. - -// BidiRule enables the Bidi rule as defined in RFC 5893. Any application -// that relies on proper validation of labels should include this rule. -func BidiRule() Option { - return func(o *options) { o.bidirule = bidirule.ValidString } -} - -// ValidateForRegistration sets validation options to verify that a given IDN is -// properly formatted for registration as defined by Section 4 of RFC 5891. -func ValidateForRegistration() Option { - return func(o *options) { - o.mapping = validateRegistration - StrictDomainName(true)(o) - ValidateLabels(true)(o) - VerifyDNSLength(true)(o) - BidiRule()(o) - } -} - -// MapForLookup sets validation and mapping options such that a given IDN is -// transformed for domain name lookup according to the requirements set out in -// Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, -// RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option -// to add this check. -// -// The mappings include normalization and mapping case, width and other -// compatibility mappings. -func MapForLookup() Option { - return func(o *options) { - o.mapping = validateAndMap - StrictDomainName(true)(o) - ValidateLabels(true)(o) - } -} - -type options struct { - transitional bool - useSTD3Rules bool - validateLabels bool - verifyDNSLength bool - removeLeadingDots bool - - trie *idnaTrie - - // fromPuny calls validation rules when converting A-labels to U-labels. - fromPuny func(p *Profile, s string) error - - // mapping implements a validation and mapping step as defined in RFC 5895 - // or UTS 46, tailored to, for example, domain registration or lookup. - mapping func(p *Profile, s string) (mapped string, isBidi bool, err error) - - // bidirule, if specified, checks whether s conforms to the Bidi Rule - // defined in RFC 5893. - bidirule func(s string) bool -} - -// A Profile defines the configuration of an IDNA mapper. -type Profile struct { - options -} - -func apply(o *options, opts []Option) { - for _, f := range opts { - f(o) - } -} - -// New creates a new Profile. -// -// With no options, the returned Profile is the most permissive and equals the -// Punycode Profile. Options can be passed to further restrict the Profile. The -// MapForLookup and ValidateForRegistration options set a collection of options, -// for lookup and registration purposes respectively, which can be tailored by -// adding more fine-grained options, where later options override earlier -// options. -func New(o ...Option) *Profile { - p := &Profile{} - apply(&p.options, o) - return p -} - -// ToASCII converts a domain or domain label to its ASCII form. For example, -// ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and -// ToASCII("golang") is "golang". If an error is encountered it will return -// an error and a (partially) processed result. -func (p *Profile) ToASCII(s string) (string, error) { - return p.process(s, true) -} - -// ToUnicode converts a domain or domain label to its Unicode form. For example, -// ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and -// ToUnicode("golang") is "golang". If an error is encountered it will return -// an error and a (partially) processed result. -func (p *Profile) ToUnicode(s string) (string, error) { - pp := *p - pp.transitional = false - return pp.process(s, false) -} - -// String reports a string with a description of the profile for debugging -// purposes. The string format may change with different versions. -func (p *Profile) String() string { - s := "" - if p.transitional { - s = "Transitional" - } else { - s = "NonTransitional" - } - if p.useSTD3Rules { - s += ":UseSTD3Rules" - } - if p.validateLabels { - s += ":ValidateLabels" - } - if p.verifyDNSLength { - s += ":VerifyDNSLength" - } - return s -} - -var ( - // Punycode is a Profile that does raw punycode processing with a minimum - // of validation. - Punycode *Profile = punycode - - // Lookup is the recommended profile for looking up domain names, according - // to Section 5 of RFC 5891. The exact configuration of this profile may - // change over time. - Lookup *Profile = lookup - - // Display is the recommended profile for displaying domain names. - // The configuration of this profile may change over time. - Display *Profile = display - - // Registration is the recommended profile for checking whether a given - // IDN is valid for registration, according to Section 4 of RFC 5891. - Registration *Profile = registration - - punycode = &Profile{} - lookup = &Profile{options{ - transitional: true, - useSTD3Rules: true, - validateLabels: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - display = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - registration = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - verifyDNSLength: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateRegistration, - bidirule: bidirule.ValidString, - }} - - // TODO: profiles - // Register: recommended for approving domain names: don't do any mappings - // but rather reject on invalid input. Bundle or block deviation characters. -) - -type labelError struct{ label, code_ string } - -func (e labelError) code() string { return e.code_ } -func (e labelError) Error() string { - return fmt.Sprintf("idna: invalid label %q", e.label) -} - -type runeError rune - -func (e runeError) code() string { return "P1" } -func (e runeError) Error() string { - return fmt.Sprintf("idna: disallowed rune %U", e) -} - -// process implements the algorithm described in section 4 of UTS #46, -// see https://www.unicode.org/reports/tr46. -func (p *Profile) process(s string, toASCII bool) (string, error) { - var err error - var isBidi bool - if p.mapping != nil { - s, isBidi, err = p.mapping(p, s) - } - // Remove leading empty labels. - if p.removeLeadingDots { - for ; len(s) > 0 && s[0] == '.'; s = s[1:] { - } - } - // TODO: allow for a quick check of the tables data. - // It seems like we should only create this error on ToASCII, but the - // UTS 46 conformance tests suggests we should always check this. - if err == nil && p.verifyDNSLength && s == "" { - err = &labelError{s, "A4"} - } - labels := labelIter{orig: s} - for ; !labels.done(); labels.next() { - label := labels.label() - if label == "" { - // Empty labels are not okay. The label iterator skips the last - // label if it is empty. - if err == nil && p.verifyDNSLength { - err = &labelError{s, "A4"} - } - continue - } - if strings.HasPrefix(label, acePrefix) { - u, err2 := decode(label[len(acePrefix):]) - if err2 != nil { - if err == nil { - err = err2 - } - // Spec says keep the old label. - continue - } - isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight - labels.set(u) - if err == nil && p.validateLabels { - err = p.fromPuny(p, u) - } - if err == nil { - // This should be called on NonTransitional, according to the - // spec, but that currently does not have any effect. Use the - // original profile to preserve options. - err = p.validateLabel(u) - } - } else if err == nil { - err = p.validateLabel(label) - } - } - if isBidi && p.bidirule != nil && err == nil { - for labels.reset(); !labels.done(); labels.next() { - if !p.bidirule(labels.label()) { - err = &labelError{s, "B"} - break - } - } - } - if toASCII { - for labels.reset(); !labels.done(); labels.next() { - label := labels.label() - if !ascii(label) { - a, err2 := encode(acePrefix, label) - if err == nil { - err = err2 - } - label = a - labels.set(a) - } - n := len(label) - if p.verifyDNSLength && err == nil && (n == 0 || n > 63) { - err = &labelError{label, "A4"} - } - } - } - s = labels.result() - if toASCII && p.verifyDNSLength && err == nil { - // Compute the length of the domain name minus the root label and its dot. - n := len(s) - if n > 0 && s[n-1] == '.' { - n-- - } - if len(s) < 1 || n > 253 { - err = &labelError{s, "A4"} - } - } - return s, err -} - -func normalize(p *Profile, s string) (mapped string, isBidi bool, err error) { - // TODO: consider first doing a quick check to see if any of these checks - // need to be done. This will make it slower in the general case, but - // faster in the common case. - mapped = norm.NFC.String(s) - isBidi = bidirule.DirectionString(mapped) == bidi.RightToLeft - return mapped, isBidi, nil -} - -func validateRegistration(p *Profile, s string) (idem string, bidi bool, err error) { - // TODO: filter need for normalization in loop below. - if !norm.NFC.IsNormalString(s) { - return s, false, &labelError{s, "V1"} - } - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - if sz == 0 { - return s, bidi, runeError(utf8.RuneError) - } - bidi = bidi || info(v).isBidi(s[i:]) - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - // TODO: handle the NV8 defined in the Unicode idna data set to allow - // for strict conformance to IDNA2008. - case valid, deviation: - case disallowed, mapped, unknown, ignored: - r, _ := utf8.DecodeRuneInString(s[i:]) - return s, bidi, runeError(r) - } - i += sz - } - return s, bidi, nil -} - -func (c info) isBidi(s string) bool { - if !c.isMapped() { - return c&attributesMask == rtl - } - // TODO: also store bidi info for mapped data. This is possible, but a bit - // cumbersome and not for the common case. - p, _ := bidi.LookupString(s) - switch p.Class() { - case bidi.R, bidi.AL, bidi.AN: - return true - } - return false -} - -func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error) { - var ( - b []byte - k int - ) - // combinedInfoBits contains the or-ed bits of all runes. We use this - // to derive the mayNeedNorm bit later. This may trigger normalization - // overeagerly, but it will not do so in the common case. The end result - // is another 10% saving on BenchmarkProfile for the common case. - var combinedInfoBits info - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - if sz == 0 { - b = append(b, s[k:i]...) - b = append(b, "\ufffd"...) - k = len(s) - if err == nil { - err = runeError(utf8.RuneError) - } - break - } - combinedInfoBits |= info(v) - bidi = bidi || info(v).isBidi(s[i:]) - start := i - i += sz - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - case valid: - continue - case disallowed: - if err == nil { - r, _ := utf8.DecodeRuneInString(s[start:]) - err = runeError(r) - } - continue - case mapped, deviation: - b = append(b, s[k:start]...) - b = info(v).appendMapping(b, s[start:i]) - case ignored: - b = append(b, s[k:start]...) - // drop the rune - case unknown: - b = append(b, s[k:start]...) - b = append(b, "\ufffd"...) - } - k = i - } - if k == 0 { - // No changes so far. - if combinedInfoBits&mayNeedNorm != 0 { - s = norm.NFC.String(s) - } - } else { - b = append(b, s[k:]...) - if norm.NFC.QuickSpan(b) != len(b) { - b = norm.NFC.Bytes(b) - } - // TODO: the punycode converters require strings as input. - s = string(b) - } - return s, bidi, err -} - -// A labelIter allows iterating over domain name labels. -type labelIter struct { - orig string - slice []string - curStart int - curEnd int - i int -} - -func (l *labelIter) reset() { - l.curStart = 0 - l.curEnd = 0 - l.i = 0 -} - -func (l *labelIter) done() bool { - return l.curStart >= len(l.orig) -} - -func (l *labelIter) result() string { - if l.slice != nil { - return strings.Join(l.slice, ".") - } - return l.orig -} - -func (l *labelIter) label() string { - if l.slice != nil { - return l.slice[l.i] - } - p := strings.IndexByte(l.orig[l.curStart:], '.') - l.curEnd = l.curStart + p - if p == -1 { - l.curEnd = len(l.orig) - } - return l.orig[l.curStart:l.curEnd] -} - -// next sets the value to the next label. It skips the last label if it is empty. -func (l *labelIter) next() { - l.i++ - if l.slice != nil { - if l.i >= len(l.slice) || l.i == len(l.slice)-1 && l.slice[l.i] == "" { - l.curStart = len(l.orig) - } - } else { - l.curStart = l.curEnd + 1 - if l.curStart == len(l.orig)-1 && l.orig[l.curStart] == '.' { - l.curStart = len(l.orig) - } - } -} - -func (l *labelIter) set(s string) { - if l.slice == nil { - l.slice = strings.Split(l.orig, ".") - } - l.slice[l.i] = s -} - -// acePrefix is the ASCII Compatible Encoding prefix. -const acePrefix = "xn--" - -func (p *Profile) simplify(cat category) category { - switch cat { - case disallowedSTD3Mapped: - if p.useSTD3Rules { - cat = disallowed - } else { - cat = mapped - } - case disallowedSTD3Valid: - if p.useSTD3Rules { - cat = disallowed - } else { - cat = valid - } - case deviation: - if !p.transitional { - cat = valid - } - case validNV8, validXV8: - // TODO: handle V2008 - cat = valid - } - return cat -} - -func validateFromPunycode(p *Profile, s string) error { - if !norm.NFC.IsNormalString(s) { - return &labelError{s, "V1"} - } - // TODO: detect whether string may have to be normalized in the following - // loop. - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - if sz == 0 { - return runeError(utf8.RuneError) - } - if c := p.simplify(info(v).category()); c != valid && c != deviation { - return &labelError{s, "V6"} - } - i += sz - } - return nil -} - -const ( - zwnj = "\u200c" - zwj = "\u200d" -) - -type joinState int8 - -const ( - stateStart joinState = iota - stateVirama - stateBefore - stateBeforeVirama - stateAfter - stateFAIL -) - -var joinStates = [][numJoinTypes]joinState{ - stateStart: { - joiningL: stateBefore, - joiningD: stateBefore, - joinZWNJ: stateFAIL, - joinZWJ: stateFAIL, - joinVirama: stateVirama, - }, - stateVirama: { - joiningL: stateBefore, - joiningD: stateBefore, - }, - stateBefore: { - joiningL: stateBefore, - joiningD: stateBefore, - joiningT: stateBefore, - joinZWNJ: stateAfter, - joinZWJ: stateFAIL, - joinVirama: stateBeforeVirama, - }, - stateBeforeVirama: { - joiningL: stateBefore, - joiningD: stateBefore, - joiningT: stateBefore, - }, - stateAfter: { - joiningL: stateFAIL, - joiningD: stateBefore, - joiningT: stateAfter, - joiningR: stateStart, - joinZWNJ: stateFAIL, - joinZWJ: stateFAIL, - joinVirama: stateAfter, // no-op as we can't accept joiners here - }, - stateFAIL: { - 0: stateFAIL, - joiningL: stateFAIL, - joiningD: stateFAIL, - joiningT: stateFAIL, - joiningR: stateFAIL, - joinZWNJ: stateFAIL, - joinZWJ: stateFAIL, - joinVirama: stateFAIL, - }, -} - -// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are -// already implicitly satisfied by the overall implementation. -func (p *Profile) validateLabel(s string) (err error) { - if s == "" { - if p.verifyDNSLength { - return &labelError{s, "A4"} - } - return nil - } - if !p.validateLabels { - return nil - } - trie := p.trie // p.validateLabels is only set if trie is set. - if len(s) > 4 && s[2] == '-' && s[3] == '-' { - return &labelError{s, "V2"} - } - if s[0] == '-' || s[len(s)-1] == '-' { - return &labelError{s, "V3"} - } - // TODO: merge the use of this in the trie. - v, sz := trie.lookupString(s) - x := info(v) - if x.isModifier() { - return &labelError{s, "V5"} - } - // Quickly return in the absence of zero-width (non) joiners. - if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 { - return nil - } - st := stateStart - for i := 0; ; { - jt := x.joinType() - if s[i:i+sz] == zwj { - jt = joinZWJ - } else if s[i:i+sz] == zwnj { - jt = joinZWNJ - } - st = joinStates[st][jt] - if x.isViramaModifier() { - st = joinStates[st][joinVirama] - } - if i += sz; i == len(s) { - break - } - v, sz = trie.lookupString(s[i:]) - x = info(v) - } - if st == stateFAIL || st == stateAfter { - return &labelError{s, "C"} - } - return nil -} - -func ascii(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] >= utf8.RuneSelf { - return false - } - } - return true -} diff --git a/vendor/golang.org/x/net/idna/idna9.0.0.go b/vendor/golang.org/x/net/idna/idna9.0.0.go deleted file mode 100644 index 8842146b5..000000000 --- a/vendor/golang.org/x/net/idna/idna9.0.0.go +++ /dev/null @@ -1,682 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.10 - -// Package idna implements IDNA2008 using the compatibility processing -// defined by UTS (Unicode Technical Standard) #46, which defines a standard to -// deal with the transition from IDNA2003. -// -// IDNA2008 (Internationalized Domain Names for Applications), is defined in RFC -// 5890, RFC 5891, RFC 5892, RFC 5893 and RFC 5894. -// UTS #46 is defined in https://www.unicode.org/reports/tr46. -// See https://unicode.org/cldr/utility/idna.jsp for a visualization of the -// differences between these two standards. -package idna // import "golang.org/x/net/idna" - -import ( - "fmt" - "strings" - "unicode/utf8" - - "golang.org/x/text/secure/bidirule" - "golang.org/x/text/unicode/norm" -) - -// NOTE: Unlike common practice in Go APIs, the functions will return a -// sanitized domain name in case of errors. Browsers sometimes use a partially -// evaluated string as lookup. -// TODO: the current error handling is, in my opinion, the least opinionated. -// Other strategies are also viable, though: -// Option 1) Return an empty string in case of error, but allow the user to -// specify explicitly which errors to ignore. -// Option 2) Return the partially evaluated string if it is itself a valid -// string, otherwise return the empty string in case of error. -// Option 3) Option 1 and 2. -// Option 4) Always return an empty string for now and implement Option 1 as -// needed, and document that the return string may not be empty in case of -// error in the future. -// I think Option 1 is best, but it is quite opinionated. - -// ToASCII is a wrapper for Punycode.ToASCII. -func ToASCII(s string) (string, error) { - return Punycode.process(s, true) -} - -// ToUnicode is a wrapper for Punycode.ToUnicode. -func ToUnicode(s string) (string, error) { - return Punycode.process(s, false) -} - -// An Option configures a Profile at creation time. -type Option func(*options) - -// Transitional sets a Profile to use the Transitional mapping as defined in UTS -// #46. This will cause, for example, "ß" to be mapped to "ss". Using the -// transitional mapping provides a compromise between IDNA2003 and IDNA2008 -// compatibility. It is used by most browsers when resolving domain names. This -// option is only meaningful if combined with MapForLookup. -func Transitional(transitional bool) Option { - return func(o *options) { o.transitional = true } -} - -// VerifyDNSLength sets whether a Profile should fail if any of the IDN parts -// are longer than allowed by the RFC. -func VerifyDNSLength(verify bool) Option { - return func(o *options) { o.verifyDNSLength = verify } -} - -// RemoveLeadingDots removes leading label separators. Leading runes that map to -// dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. -// -// This is the behavior suggested by the UTS #46 and is adopted by some -// browsers. -func RemoveLeadingDots(remove bool) Option { - return func(o *options) { o.removeLeadingDots = remove } -} - -// ValidateLabels sets whether to check the mandatory label validation criteria -// as defined in Section 5.4 of RFC 5891. This includes testing for correct use -// of hyphens ('-'), normalization, validity of runes, and the context rules. -func ValidateLabels(enable bool) Option { - return func(o *options) { - // Don't override existing mappings, but set one that at least checks - // normalization if it is not set. - if o.mapping == nil && enable { - o.mapping = normalize - } - o.trie = trie - o.validateLabels = enable - o.fromPuny = validateFromPunycode - } -} - -// StrictDomainName limits the set of permissable ASCII characters to those -// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the -// hyphen). This is set by default for MapForLookup and ValidateForRegistration. -// -// This option is useful, for instance, for browsers that allow characters -// outside this range, for example a '_' (U+005F LOW LINE). See -// http://www.rfc-editor.org/std/std3.txt for more details This option -// corresponds to the UseSTD3ASCIIRules option in UTS #46. -func StrictDomainName(use bool) Option { - return func(o *options) { - o.trie = trie - o.useSTD3Rules = use - o.fromPuny = validateFromPunycode - } -} - -// NOTE: the following options pull in tables. The tables should not be linked -// in as long as the options are not used. - -// BidiRule enables the Bidi rule as defined in RFC 5893. Any application -// that relies on proper validation of labels should include this rule. -func BidiRule() Option { - return func(o *options) { o.bidirule = bidirule.ValidString } -} - -// ValidateForRegistration sets validation options to verify that a given IDN is -// properly formatted for registration as defined by Section 4 of RFC 5891. -func ValidateForRegistration() Option { - return func(o *options) { - o.mapping = validateRegistration - StrictDomainName(true)(o) - ValidateLabels(true)(o) - VerifyDNSLength(true)(o) - BidiRule()(o) - } -} - -// MapForLookup sets validation and mapping options such that a given IDN is -// transformed for domain name lookup according to the requirements set out in -// Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, -// RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option -// to add this check. -// -// The mappings include normalization and mapping case, width and other -// compatibility mappings. -func MapForLookup() Option { - return func(o *options) { - o.mapping = validateAndMap - StrictDomainName(true)(o) - ValidateLabels(true)(o) - RemoveLeadingDots(true)(o) - } -} - -type options struct { - transitional bool - useSTD3Rules bool - validateLabels bool - verifyDNSLength bool - removeLeadingDots bool - - trie *idnaTrie - - // fromPuny calls validation rules when converting A-labels to U-labels. - fromPuny func(p *Profile, s string) error - - // mapping implements a validation and mapping step as defined in RFC 5895 - // or UTS 46, tailored to, for example, domain registration or lookup. - mapping func(p *Profile, s string) (string, error) - - // bidirule, if specified, checks whether s conforms to the Bidi Rule - // defined in RFC 5893. - bidirule func(s string) bool -} - -// A Profile defines the configuration of a IDNA mapper. -type Profile struct { - options -} - -func apply(o *options, opts []Option) { - for _, f := range opts { - f(o) - } -} - -// New creates a new Profile. -// -// With no options, the returned Profile is the most permissive and equals the -// Punycode Profile. Options can be passed to further restrict the Profile. The -// MapForLookup and ValidateForRegistration options set a collection of options, -// for lookup and registration purposes respectively, which can be tailored by -// adding more fine-grained options, where later options override earlier -// options. -func New(o ...Option) *Profile { - p := &Profile{} - apply(&p.options, o) - return p -} - -// ToASCII converts a domain or domain label to its ASCII form. For example, -// ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and -// ToASCII("golang") is "golang". If an error is encountered it will return -// an error and a (partially) processed result. -func (p *Profile) ToASCII(s string) (string, error) { - return p.process(s, true) -} - -// ToUnicode converts a domain or domain label to its Unicode form. For example, -// ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and -// ToUnicode("golang") is "golang". If an error is encountered it will return -// an error and a (partially) processed result. -func (p *Profile) ToUnicode(s string) (string, error) { - pp := *p - pp.transitional = false - return pp.process(s, false) -} - -// String reports a string with a description of the profile for debugging -// purposes. The string format may change with different versions. -func (p *Profile) String() string { - s := "" - if p.transitional { - s = "Transitional" - } else { - s = "NonTransitional" - } - if p.useSTD3Rules { - s += ":UseSTD3Rules" - } - if p.validateLabels { - s += ":ValidateLabels" - } - if p.verifyDNSLength { - s += ":VerifyDNSLength" - } - return s -} - -var ( - // Punycode is a Profile that does raw punycode processing with a minimum - // of validation. - Punycode *Profile = punycode - - // Lookup is the recommended profile for looking up domain names, according - // to Section 5 of RFC 5891. The exact configuration of this profile may - // change over time. - Lookup *Profile = lookup - - // Display is the recommended profile for displaying domain names. - // The configuration of this profile may change over time. - Display *Profile = display - - // Registration is the recommended profile for checking whether a given - // IDN is valid for registration, according to Section 4 of RFC 5891. - Registration *Profile = registration - - punycode = &Profile{} - lookup = &Profile{options{ - transitional: true, - useSTD3Rules: true, - validateLabels: true, - removeLeadingDots: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - display = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - removeLeadingDots: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateAndMap, - bidirule: bidirule.ValidString, - }} - registration = &Profile{options{ - useSTD3Rules: true, - validateLabels: true, - verifyDNSLength: true, - trie: trie, - fromPuny: validateFromPunycode, - mapping: validateRegistration, - bidirule: bidirule.ValidString, - }} - - // TODO: profiles - // Register: recommended for approving domain names: don't do any mappings - // but rather reject on invalid input. Bundle or block deviation characters. -) - -type labelError struct{ label, code_ string } - -func (e labelError) code() string { return e.code_ } -func (e labelError) Error() string { - return fmt.Sprintf("idna: invalid label %q", e.label) -} - -type runeError rune - -func (e runeError) code() string { return "P1" } -func (e runeError) Error() string { - return fmt.Sprintf("idna: disallowed rune %U", e) -} - -// process implements the algorithm described in section 4 of UTS #46, -// see https://www.unicode.org/reports/tr46. -func (p *Profile) process(s string, toASCII bool) (string, error) { - var err error - if p.mapping != nil { - s, err = p.mapping(p, s) - } - // Remove leading empty labels. - if p.removeLeadingDots { - for ; len(s) > 0 && s[0] == '.'; s = s[1:] { - } - } - // It seems like we should only create this error on ToASCII, but the - // UTS 46 conformance tests suggests we should always check this. - if err == nil && p.verifyDNSLength && s == "" { - err = &labelError{s, "A4"} - } - labels := labelIter{orig: s} - for ; !labels.done(); labels.next() { - label := labels.label() - if label == "" { - // Empty labels are not okay. The label iterator skips the last - // label if it is empty. - if err == nil && p.verifyDNSLength { - err = &labelError{s, "A4"} - } - continue - } - if strings.HasPrefix(label, acePrefix) { - u, err2 := decode(label[len(acePrefix):]) - if err2 != nil { - if err == nil { - err = err2 - } - // Spec says keep the old label. - continue - } - labels.set(u) - if err == nil && p.validateLabels { - err = p.fromPuny(p, u) - } - if err == nil { - // This should be called on NonTransitional, according to the - // spec, but that currently does not have any effect. Use the - // original profile to preserve options. - err = p.validateLabel(u) - } - } else if err == nil { - err = p.validateLabel(label) - } - } - if toASCII { - for labels.reset(); !labels.done(); labels.next() { - label := labels.label() - if !ascii(label) { - a, err2 := encode(acePrefix, label) - if err == nil { - err = err2 - } - label = a - labels.set(a) - } - n := len(label) - if p.verifyDNSLength && err == nil && (n == 0 || n > 63) { - err = &labelError{label, "A4"} - } - } - } - s = labels.result() - if toASCII && p.verifyDNSLength && err == nil { - // Compute the length of the domain name minus the root label and its dot. - n := len(s) - if n > 0 && s[n-1] == '.' { - n-- - } - if len(s) < 1 || n > 253 { - err = &labelError{s, "A4"} - } - } - return s, err -} - -func normalize(p *Profile, s string) (string, error) { - return norm.NFC.String(s), nil -} - -func validateRegistration(p *Profile, s string) (string, error) { - if !norm.NFC.IsNormalString(s) { - return s, &labelError{s, "V1"} - } - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - // TODO: handle the NV8 defined in the Unicode idna data set to allow - // for strict conformance to IDNA2008. - case valid, deviation: - case disallowed, mapped, unknown, ignored: - r, _ := utf8.DecodeRuneInString(s[i:]) - return s, runeError(r) - } - i += sz - } - return s, nil -} - -func validateAndMap(p *Profile, s string) (string, error) { - var ( - err error - b []byte - k int - ) - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - start := i - i += sz - // Copy bytes not copied so far. - switch p.simplify(info(v).category()) { - case valid: - continue - case disallowed: - if err == nil { - r, _ := utf8.DecodeRuneInString(s[start:]) - err = runeError(r) - } - continue - case mapped, deviation: - b = append(b, s[k:start]...) - b = info(v).appendMapping(b, s[start:i]) - case ignored: - b = append(b, s[k:start]...) - // drop the rune - case unknown: - b = append(b, s[k:start]...) - b = append(b, "\ufffd"...) - } - k = i - } - if k == 0 { - // No changes so far. - s = norm.NFC.String(s) - } else { - b = append(b, s[k:]...) - if norm.NFC.QuickSpan(b) != len(b) { - b = norm.NFC.Bytes(b) - } - // TODO: the punycode converters require strings as input. - s = string(b) - } - return s, err -} - -// A labelIter allows iterating over domain name labels. -type labelIter struct { - orig string - slice []string - curStart int - curEnd int - i int -} - -func (l *labelIter) reset() { - l.curStart = 0 - l.curEnd = 0 - l.i = 0 -} - -func (l *labelIter) done() bool { - return l.curStart >= len(l.orig) -} - -func (l *labelIter) result() string { - if l.slice != nil { - return strings.Join(l.slice, ".") - } - return l.orig -} - -func (l *labelIter) label() string { - if l.slice != nil { - return l.slice[l.i] - } - p := strings.IndexByte(l.orig[l.curStart:], '.') - l.curEnd = l.curStart + p - if p == -1 { - l.curEnd = len(l.orig) - } - return l.orig[l.curStart:l.curEnd] -} - -// next sets the value to the next label. It skips the last label if it is empty. -func (l *labelIter) next() { - l.i++ - if l.slice != nil { - if l.i >= len(l.slice) || l.i == len(l.slice)-1 && l.slice[l.i] == "" { - l.curStart = len(l.orig) - } - } else { - l.curStart = l.curEnd + 1 - if l.curStart == len(l.orig)-1 && l.orig[l.curStart] == '.' { - l.curStart = len(l.orig) - } - } -} - -func (l *labelIter) set(s string) { - if l.slice == nil { - l.slice = strings.Split(l.orig, ".") - } - l.slice[l.i] = s -} - -// acePrefix is the ASCII Compatible Encoding prefix. -const acePrefix = "xn--" - -func (p *Profile) simplify(cat category) category { - switch cat { - case disallowedSTD3Mapped: - if p.useSTD3Rules { - cat = disallowed - } else { - cat = mapped - } - case disallowedSTD3Valid: - if p.useSTD3Rules { - cat = disallowed - } else { - cat = valid - } - case deviation: - if !p.transitional { - cat = valid - } - case validNV8, validXV8: - // TODO: handle V2008 - cat = valid - } - return cat -} - -func validateFromPunycode(p *Profile, s string) error { - if !norm.NFC.IsNormalString(s) { - return &labelError{s, "V1"} - } - for i := 0; i < len(s); { - v, sz := trie.lookupString(s[i:]) - if c := p.simplify(info(v).category()); c != valid && c != deviation { - return &labelError{s, "V6"} - } - i += sz - } - return nil -} - -const ( - zwnj = "\u200c" - zwj = "\u200d" -) - -type joinState int8 - -const ( - stateStart joinState = iota - stateVirama - stateBefore - stateBeforeVirama - stateAfter - stateFAIL -) - -var joinStates = [][numJoinTypes]joinState{ - stateStart: { - joiningL: stateBefore, - joiningD: stateBefore, - joinZWNJ: stateFAIL, - joinZWJ: stateFAIL, - joinVirama: stateVirama, - }, - stateVirama: { - joiningL: stateBefore, - joiningD: stateBefore, - }, - stateBefore: { - joiningL: stateBefore, - joiningD: stateBefore, - joiningT: stateBefore, - joinZWNJ: stateAfter, - joinZWJ: stateFAIL, - joinVirama: stateBeforeVirama, - }, - stateBeforeVirama: { - joiningL: stateBefore, - joiningD: stateBefore, - joiningT: stateBefore, - }, - stateAfter: { - joiningL: stateFAIL, - joiningD: stateBefore, - joiningT: stateAfter, - joiningR: stateStart, - joinZWNJ: stateFAIL, - joinZWJ: stateFAIL, - joinVirama: stateAfter, // no-op as we can't accept joiners here - }, - stateFAIL: { - 0: stateFAIL, - joiningL: stateFAIL, - joiningD: stateFAIL, - joiningT: stateFAIL, - joiningR: stateFAIL, - joinZWNJ: stateFAIL, - joinZWJ: stateFAIL, - joinVirama: stateFAIL, - }, -} - -// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are -// already implicitly satisfied by the overall implementation. -func (p *Profile) validateLabel(s string) error { - if s == "" { - if p.verifyDNSLength { - return &labelError{s, "A4"} - } - return nil - } - if p.bidirule != nil && !p.bidirule(s) { - return &labelError{s, "B"} - } - if !p.validateLabels { - return nil - } - trie := p.trie // p.validateLabels is only set if trie is set. - if len(s) > 4 && s[2] == '-' && s[3] == '-' { - return &labelError{s, "V2"} - } - if s[0] == '-' || s[len(s)-1] == '-' { - return &labelError{s, "V3"} - } - // TODO: merge the use of this in the trie. - v, sz := trie.lookupString(s) - x := info(v) - if x.isModifier() { - return &labelError{s, "V5"} - } - // Quickly return in the absence of zero-width (non) joiners. - if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 { - return nil - } - st := stateStart - for i := 0; ; { - jt := x.joinType() - if s[i:i+sz] == zwj { - jt = joinZWJ - } else if s[i:i+sz] == zwnj { - jt = joinZWNJ - } - st = joinStates[st][jt] - if x.isViramaModifier() { - st = joinStates[st][joinVirama] - } - if i += sz; i == len(s) { - break - } - v, sz = trie.lookupString(s[i:]) - x = info(v) - } - if st == stateFAIL || st == stateAfter { - return &labelError{s, "C"} - } - return nil -} - -func ascii(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] >= utf8.RuneSelf { - return false - } - } - return true -} diff --git a/vendor/golang.org/x/net/idna/punycode.go b/vendor/golang.org/x/net/idna/punycode.go deleted file mode 100644 index 02c7d59af..000000000 --- a/vendor/golang.org/x/net/idna/punycode.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package idna - -// This file implements the Punycode algorithm from RFC 3492. - -import ( - "math" - "strings" - "unicode/utf8" -) - -// These parameter values are specified in section 5. -// -// All computation is done with int32s, so that overflow behavior is identical -// regardless of whether int is 32-bit or 64-bit. -const ( - base int32 = 36 - damp int32 = 700 - initialBias int32 = 72 - initialN int32 = 128 - skew int32 = 38 - tmax int32 = 26 - tmin int32 = 1 -) - -func punyError(s string) error { return &labelError{s, "A3"} } - -// decode decodes a string as specified in section 6.2. -func decode(encoded string) (string, error) { - if encoded == "" { - return "", nil - } - pos := 1 + strings.LastIndex(encoded, "-") - if pos == 1 { - return "", punyError(encoded) - } - if pos == len(encoded) { - return encoded[:len(encoded)-1], nil - } - output := make([]rune, 0, len(encoded)) - if pos != 0 { - for _, r := range encoded[:pos-1] { - output = append(output, r) - } - } - i, n, bias := int32(0), initialN, initialBias - for pos < len(encoded) { - oldI, w := i, int32(1) - for k := base; ; k += base { - if pos == len(encoded) { - return "", punyError(encoded) - } - digit, ok := decodeDigit(encoded[pos]) - if !ok { - return "", punyError(encoded) - } - pos++ - i += digit * w - if i < 0 { - return "", punyError(encoded) - } - t := k - bias - if t < tmin { - t = tmin - } else if t > tmax { - t = tmax - } - if digit < t { - break - } - w *= base - t - if w >= math.MaxInt32/base { - return "", punyError(encoded) - } - } - x := int32(len(output) + 1) - bias = adapt(i-oldI, x, oldI == 0) - n += i / x - i %= x - if n > utf8.MaxRune || len(output) >= 1024 { - return "", punyError(encoded) - } - output = append(output, 0) - copy(output[i+1:], output[i:]) - output[i] = n - i++ - } - return string(output), nil -} - -// encode encodes a string as specified in section 6.3 and prepends prefix to -// the result. -// -// The "while h < length(input)" line in the specification becomes "for -// remaining != 0" in the Go code, because len(s) in Go is in bytes, not runes. -func encode(prefix, s string) (string, error) { - output := make([]byte, len(prefix), len(prefix)+1+2*len(s)) - copy(output, prefix) - delta, n, bias := int32(0), initialN, initialBias - b, remaining := int32(0), int32(0) - for _, r := range s { - if r < 0x80 { - b++ - output = append(output, byte(r)) - } else { - remaining++ - } - } - h := b - if b > 0 { - output = append(output, '-') - } - for remaining != 0 { - m := int32(0x7fffffff) - for _, r := range s { - if m > r && r >= n { - m = r - } - } - delta += (m - n) * (h + 1) - if delta < 0 { - return "", punyError(s) - } - n = m - for _, r := range s { - if r < n { - delta++ - if delta < 0 { - return "", punyError(s) - } - continue - } - if r > n { - continue - } - q := delta - for k := base; ; k += base { - t := k - bias - if t < tmin { - t = tmin - } else if t > tmax { - t = tmax - } - if q < t { - break - } - output = append(output, encodeDigit(t+(q-t)%(base-t))) - q = (q - t) / (base - t) - } - output = append(output, encodeDigit(q)) - bias = adapt(delta, h+1, h == b) - delta = 0 - h++ - remaining-- - } - delta++ - n++ - } - return string(output), nil -} - -func decodeDigit(x byte) (digit int32, ok bool) { - switch { - case '0' <= x && x <= '9': - return int32(x - ('0' - 26)), true - case 'A' <= x && x <= 'Z': - return int32(x - 'A'), true - case 'a' <= x && x <= 'z': - return int32(x - 'a'), true - } - return 0, false -} - -func encodeDigit(digit int32) byte { - switch { - case 0 <= digit && digit < 26: - return byte(digit + 'a') - case 26 <= digit && digit < 36: - return byte(digit + ('0' - 26)) - } - panic("idna: internal error in punycode encoding") -} - -// adapt is the bias adaptation function specified in section 6.1. -func adapt(delta, numPoints int32, firstTime bool) int32 { - if firstTime { - delta /= damp - } else { - delta /= 2 - } - delta += delta / numPoints - k := int32(0) - for delta > ((base-tmin)*tmax)/2 { - delta /= base - tmin - k += base - } - return k + (base-tmin+1)*delta/(delta+skew) -} diff --git a/vendor/golang.org/x/net/idna/tables10.0.0.go b/vendor/golang.org/x/net/idna/tables10.0.0.go deleted file mode 100644 index 54fddb4b1..000000000 --- a/vendor/golang.org/x/net/idna/tables10.0.0.go +++ /dev/null @@ -1,4559 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// +build go1.10,!go1.13 - -package idna - -// UnicodeVersion is the Unicode version from which the tables in this package are derived. -const UnicodeVersion = "10.0.0" - -var mappings string = "" + // Size: 8175 bytes - "\x00\x01 \x03 ̈\x01a\x03 ̄\x012\x013\x03 ́\x03 ̧\x011\x01o\x051⁄4\x051⁄2" + - "\x053⁄4\x03i̇\x03l·\x03ʼn\x01s\x03dž\x03ⱥ\x03ⱦ\x01h\x01j\x01r\x01w\x01y" + - "\x03 ̆\x03 ̇\x03 ̊\x03 ̨\x03 ̃\x03 ̋\x01l\x01x\x04̈́\x03 ι\x01;\x05 ̈́" + - "\x04եւ\x04اٴ\x04وٴ\x04ۇٴ\x04يٴ\x06क़\x06ख़\x06ग़\x06ज़\x06ड़\x06ढ़\x06फ़" + - "\x06य़\x06ড়\x06ঢ়\x06য়\x06ਲ਼\x06ਸ਼\x06ਖ਼\x06ਗ਼\x06ਜ਼\x06ਫ਼\x06ଡ଼\x06ଢ଼" + - "\x06ํา\x06ໍາ\x06ຫນ\x06ຫມ\x06གྷ\x06ཌྷ\x06དྷ\x06བྷ\x06ཛྷ\x06ཀྵ\x06ཱི\x06ཱུ" + - "\x06ྲྀ\x09ྲཱྀ\x06ླྀ\x09ླཱྀ\x06ཱྀ\x06ྒྷ\x06ྜྷ\x06ྡྷ\x06ྦྷ\x06ྫྷ\x06ྐྵ\x02" + - "в\x02д\x02о\x02с\x02т\x02ъ\x02ѣ\x02æ\x01b\x01d\x01e\x02ǝ\x01g\x01i\x01k" + - "\x01m\x01n\x02ȣ\x01p\x01t\x01u\x02ɐ\x02ɑ\x02ə\x02ɛ\x02ɜ\x02ŋ\x02ɔ\x02ɯ" + - "\x01v\x02β\x02γ\x02δ\x02φ\x02χ\x02ρ\x02н\x02ɒ\x01c\x02ɕ\x02ð\x01f\x02ɟ" + - "\x02ɡ\x02ɥ\x02ɨ\x02ɩ\x02ɪ\x02ʝ\x02ɭ\x02ʟ\x02ɱ\x02ɰ\x02ɲ\x02ɳ\x02ɴ\x02ɵ" + - "\x02ɸ\x02ʂ\x02ʃ\x02ƫ\x02ʉ\x02ʊ\x02ʋ\x02ʌ\x01z\x02ʐ\x02ʑ\x02ʒ\x02θ\x02ss" + - "\x02ά\x02έ\x02ή\x02ί\x02ό\x02ύ\x02ώ\x05ἀι\x05ἁι\x05ἂι\x05ἃι\x05ἄι\x05ἅι" + - "\x05ἆι\x05ἇι\x05ἠι\x05ἡι\x05ἢι\x05ἣι\x05ἤι\x05ἥι\x05ἦι\x05ἧι\x05ὠι\x05ὡι" + - "\x05ὢι\x05ὣι\x05ὤι\x05ὥι\x05ὦι\x05ὧι\x05ὰι\x04αι\x04άι\x05ᾶι\x02ι\x05 ̈͂" + - "\x05ὴι\x04ηι\x04ήι\x05ῆι\x05 ̓̀\x05 ̓́\x05 ̓͂\x02ΐ\x05 ̔̀\x05 ̔́\x05 ̔͂" + - "\x02ΰ\x05 ̈̀\x01`\x05ὼι\x04ωι\x04ώι\x05ῶι\x06′′\x09′′′\x06‵‵\x09‵‵‵\x02!" + - "!\x02??\x02?!\x02!?\x0c′′′′\x010\x014\x015\x016\x017\x018\x019\x01+\x01=" + - "\x01(\x01)\x02rs\x02ħ\x02no\x01q\x02sm\x02tm\x02ω\x02å\x02א\x02ב\x02ג" + - "\x02ד\x02π\x051⁄7\x051⁄9\x061⁄10\x051⁄3\x052⁄3\x051⁄5\x052⁄5\x053⁄5\x054" + - "⁄5\x051⁄6\x055⁄6\x051⁄8\x053⁄8\x055⁄8\x057⁄8\x041⁄\x02ii\x02iv\x02vi" + - "\x04viii\x02ix\x02xi\x050⁄3\x06∫∫\x09∫∫∫\x06∮∮\x09∮∮∮\x0210\x0211\x0212" + - "\x0213\x0214\x0215\x0216\x0217\x0218\x0219\x0220\x04(10)\x04(11)\x04(12)" + - "\x04(13)\x04(14)\x04(15)\x04(16)\x04(17)\x04(18)\x04(19)\x04(20)\x0c∫∫∫∫" + - "\x02==\x05⫝̸\x02ɫ\x02ɽ\x02ȿ\x02ɀ\x01.\x04 ゙\x04 ゚\x06より\x06コト\x05(ᄀ)\x05" + - "(ᄂ)\x05(ᄃ)\x05(ᄅ)\x05(ᄆ)\x05(ᄇ)\x05(ᄉ)\x05(ᄋ)\x05(ᄌ)\x05(ᄎ)\x05(ᄏ)\x05(ᄐ" + - ")\x05(ᄑ)\x05(ᄒ)\x05(가)\x05(나)\x05(다)\x05(라)\x05(마)\x05(바)\x05(사)\x05(아)" + - "\x05(자)\x05(차)\x05(카)\x05(타)\x05(파)\x05(하)\x05(주)\x08(오전)\x08(오후)\x05(一)" + - "\x05(二)\x05(三)\x05(四)\x05(五)\x05(六)\x05(七)\x05(八)\x05(九)\x05(十)\x05(月)" + - "\x05(火)\x05(水)\x05(木)\x05(金)\x05(土)\x05(日)\x05(株)\x05(有)\x05(社)\x05(名)" + - "\x05(特)\x05(財)\x05(祝)\x05(労)\x05(代)\x05(呼)\x05(学)\x05(監)\x05(企)\x05(資)" + - "\x05(協)\x05(祭)\x05(休)\x05(自)\x05(至)\x0221\x0222\x0223\x0224\x0225\x0226" + - "\x0227\x0228\x0229\x0230\x0231\x0232\x0233\x0234\x0235\x06참고\x06주의\x0236" + - "\x0237\x0238\x0239\x0240\x0241\x0242\x0243\x0244\x0245\x0246\x0247\x0248" + - "\x0249\x0250\x041月\x042月\x043月\x044月\x045月\x046月\x047月\x048月\x049月\x0510" + - "月\x0511月\x0512月\x02hg\x02ev\x0cアパート\x0cアルファ\x0cアンペア\x09アール\x0cイニング\x09" + - "インチ\x09ウォン\x0fエスクード\x0cエーカー\x09オンス\x09オーム\x09カイリ\x0cカラット\x0cカロリー\x09ガロ" + - "ン\x09ガンマ\x06ギガ\x09ギニー\x0cキュリー\x0cギルダー\x06キロ\x0fキログラム\x12キロメートル\x0fキロワッ" + - "ト\x09グラム\x0fグラムトン\x0fクルゼイロ\x0cクローネ\x09ケース\x09コルナ\x09コーポ\x0cサイクル\x0fサンチ" + - "ーム\x0cシリング\x09センチ\x09セント\x09ダース\x06デシ\x06ドル\x06トン\x06ナノ\x09ノット\x09ハイツ" + - "\x0fパーセント\x09パーツ\x0cバーレル\x0fピアストル\x09ピクル\x06ピコ\x06ビル\x0fファラッド\x0cフィート" + - "\x0fブッシェル\x09フラン\x0fヘクタール\x06ペソ\x09ペニヒ\x09ヘルツ\x09ペンス\x09ページ\x09ベータ\x0cポイ" + - "ント\x09ボルト\x06ホン\x09ポンド\x09ホール\x09ホーン\x0cマイクロ\x09マイル\x09マッハ\x09マルク\x0fマ" + - "ンション\x0cミクロン\x06ミリ\x0fミリバール\x06メガ\x0cメガトン\x0cメートル\x09ヤード\x09ヤール\x09ユアン" + - "\x0cリットル\x06リラ\x09ルピー\x0cルーブル\x06レム\x0fレントゲン\x09ワット\x040点\x041点\x042点" + - "\x043点\x044点\x045点\x046点\x047点\x048点\x049点\x0510点\x0511点\x0512点\x0513点" + - "\x0514点\x0515点\x0516点\x0517点\x0518点\x0519点\x0520点\x0521点\x0522点\x0523点" + - "\x0524点\x02da\x02au\x02ov\x02pc\x02dm\x02iu\x06平成\x06昭和\x06大正\x06明治\x0c株" + - "式会社\x02pa\x02na\x02ma\x02ka\x02kb\x02mb\x02gb\x04kcal\x02pf\x02nf\x02m" + - "g\x02kg\x02hz\x02ml\x02dl\x02kl\x02fm\x02nm\x02mm\x02cm\x02km\x02m2\x02m" + - "3\x05m∕s\x06m∕s2\x07rad∕s\x08rad∕s2\x02ps\x02ns\x02ms\x02pv\x02nv\x02mv" + - "\x02kv\x02pw\x02nw\x02mw\x02kw\x02bq\x02cc\x02cd\x06c∕kg\x02db\x02gy\x02" + - "ha\x02hp\x02in\x02kk\x02kt\x02lm\x02ln\x02lx\x02ph\x02pr\x02sr\x02sv\x02" + - "wb\x05v∕m\x05a∕m\x041日\x042日\x043日\x044日\x045日\x046日\x047日\x048日\x049日" + - "\x0510日\x0511日\x0512日\x0513日\x0514日\x0515日\x0516日\x0517日\x0518日\x0519日" + - "\x0520日\x0521日\x0522日\x0523日\x0524日\x0525日\x0526日\x0527日\x0528日\x0529日" + - "\x0530日\x0531日\x02ь\x02ɦ\x02ɬ\x02ʞ\x02ʇ\x02œ\x04𤋮\x04𢡊\x04𢡄\x04𣏕\x04𥉉" + - "\x04𥳐\x04𧻓\x02ff\x02fi\x02fl\x02st\x04մն\x04մե\x04մի\x04վն\x04մխ\x04יִ" + - "\x04ײַ\x02ע\x02ה\x02כ\x02ל\x02ם\x02ר\x02ת\x04שׁ\x04שׂ\x06שּׁ\x06שּׂ\x04א" + - "ַ\x04אָ\x04אּ\x04בּ\x04גּ\x04דּ\x04הּ\x04וּ\x04זּ\x04טּ\x04יּ\x04ךּ\x04" + - "כּ\x04לּ\x04מּ\x04נּ\x04סּ\x04ףּ\x04פּ\x04צּ\x04קּ\x04רּ\x04שּ\x04תּ" + - "\x04וֹ\x04בֿ\x04כֿ\x04פֿ\x04אל\x02ٱ\x02ٻ\x02پ\x02ڀ\x02ٺ\x02ٿ\x02ٹ\x02ڤ" + - "\x02ڦ\x02ڄ\x02ڃ\x02چ\x02ڇ\x02ڍ\x02ڌ\x02ڎ\x02ڈ\x02ژ\x02ڑ\x02ک\x02گ\x02ڳ" + - "\x02ڱ\x02ں\x02ڻ\x02ۀ\x02ہ\x02ھ\x02ے\x02ۓ\x02ڭ\x02ۇ\x02ۆ\x02ۈ\x02ۋ\x02ۅ" + - "\x02ۉ\x02ې\x02ى\x04ئا\x04ئە\x04ئو\x04ئۇ\x04ئۆ\x04ئۈ\x04ئې\x04ئى\x02ی\x04" + - "ئج\x04ئح\x04ئم\x04ئي\x04بج\x04بح\x04بخ\x04بم\x04بى\x04بي\x04تج\x04تح" + - "\x04تخ\x04تم\x04تى\x04تي\x04ثج\x04ثم\x04ثى\x04ثي\x04جح\x04جم\x04حج\x04حم" + - "\x04خج\x04خح\x04خم\x04سج\x04سح\x04سخ\x04سم\x04صح\x04صم\x04ضج\x04ضح\x04ضخ" + - "\x04ضم\x04طح\x04طم\x04ظم\x04عج\x04عم\x04غج\x04غم\x04فج\x04فح\x04فخ\x04فم" + - "\x04فى\x04في\x04قح\x04قم\x04قى\x04قي\x04كا\x04كج\x04كح\x04كخ\x04كل\x04كم" + - "\x04كى\x04كي\x04لج\x04لح\x04لخ\x04لم\x04لى\x04لي\x04مج\x04مح\x04مخ\x04مم" + - "\x04مى\x04مي\x04نج\x04نح\x04نخ\x04نم\x04نى\x04ني\x04هج\x04هم\x04هى\x04هي" + - "\x04يج\x04يح\x04يخ\x04يم\x04يى\x04يي\x04ذٰ\x04رٰ\x04ىٰ\x05 ٌّ\x05 ٍّ\x05" + - " َّ\x05 ُّ\x05 ِّ\x05 ّٰ\x04ئر\x04ئز\x04ئن\x04بر\x04بز\x04بن\x04تر\x04تز" + - "\x04تن\x04ثر\x04ثز\x04ثن\x04ما\x04نر\x04نز\x04نن\x04ير\x04يز\x04ين\x04ئخ" + - "\x04ئه\x04به\x04ته\x04صخ\x04له\x04نه\x04هٰ\x04يه\x04ثه\x04سه\x04شم\x04شه" + - "\x06ـَّ\x06ـُّ\x06ـِّ\x04طى\x04طي\x04عى\x04عي\x04غى\x04غي\x04سى\x04سي" + - "\x04شى\x04شي\x04حى\x04حي\x04جى\x04جي\x04خى\x04خي\x04صى\x04صي\x04ضى\x04ضي" + - "\x04شج\x04شح\x04شخ\x04شر\x04سر\x04صر\x04ضر\x04اً\x06تجم\x06تحج\x06تحم" + - "\x06تخم\x06تمج\x06تمح\x06تمخ\x06جمح\x06حمي\x06حمى\x06سحج\x06سجح\x06سجى" + - "\x06سمح\x06سمج\x06سمم\x06صحح\x06صمم\x06شحم\x06شجي\x06شمخ\x06شمم\x06ضحى" + - "\x06ضخم\x06طمح\x06طمم\x06طمي\x06عجم\x06عمم\x06عمى\x06غمم\x06غمي\x06غمى" + - "\x06فخم\x06قمح\x06قمم\x06لحم\x06لحي\x06لحى\x06لجج\x06لخم\x06لمح\x06محج" + - "\x06محم\x06محي\x06مجح\x06مجم\x06مخج\x06مخم\x06مجخ\x06همج\x06همم\x06نحم" + - "\x06نحى\x06نجم\x06نجى\x06نمي\x06نمى\x06يمم\x06بخي\x06تجي\x06تجى\x06تخي" + - "\x06تخى\x06تمي\x06تمى\x06جمي\x06جحى\x06جمى\x06سخى\x06صحي\x06شحي\x06ضحي" + - "\x06لجي\x06لمي\x06يحي\x06يجي\x06يمي\x06ممي\x06قمي\x06نحي\x06عمي\x06كمي" + - "\x06نجح\x06مخي\x06لجم\x06كمم\x06جحي\x06حجي\x06مجي\x06فمي\x06بحي\x06سخي" + - "\x06نجي\x06صلے\x06قلے\x08الله\x08اكبر\x08محمد\x08صلعم\x08رسول\x08عليه" + - "\x08وسلم\x06صلى!صلى الله عليه وسلم\x0fجل جلاله\x08ریال\x01,\x01:\x01!" + - "\x01?\x01_\x01{\x01}\x01[\x01]\x01#\x01&\x01*\x01-\x01<\x01>\x01\\\x01$" + - "\x01%\x01@\x04ـً\x04ـَ\x04ـُ\x04ـِ\x04ـّ\x04ـْ\x02ء\x02آ\x02أ\x02ؤ\x02إ" + - "\x02ئ\x02ا\x02ب\x02ة\x02ت\x02ث\x02ج\x02ح\x02خ\x02د\x02ذ\x02ر\x02ز\x02س" + - "\x02ش\x02ص\x02ض\x02ط\x02ظ\x02ع\x02غ\x02ف\x02ق\x02ك\x02ل\x02م\x02ن\x02ه" + - "\x02و\x02ي\x04لآ\x04لأ\x04لإ\x04لا\x01\x22\x01'\x01/\x01^\x01|\x01~\x02¢" + - "\x02£\x02¬\x02¦\x02¥\x08𝅗𝅥\x08𝅘𝅥\x0c𝅘𝅥𝅮\x0c𝅘𝅥𝅯\x0c𝅘𝅥𝅰\x0c𝅘𝅥𝅱\x0c𝅘𝅥𝅲\x08𝆹" + - "𝅥\x08𝆺𝅥\x0c𝆹𝅥𝅮\x0c𝆺𝅥𝅮\x0c𝆹𝅥𝅯\x0c𝆺𝅥𝅯\x02ı\x02ȷ\x02α\x02ε\x02ζ\x02η\x02" + - "κ\x02λ\x02μ\x02ν\x02ξ\x02ο\x02σ\x02τ\x02υ\x02ψ\x03∇\x03∂\x02ϝ\x02ٮ\x02ڡ" + - "\x02ٯ\x020,\x021,\x022,\x023,\x024,\x025,\x026,\x027,\x028,\x029,\x03(a)" + - "\x03(b)\x03(c)\x03(d)\x03(e)\x03(f)\x03(g)\x03(h)\x03(i)\x03(j)\x03(k)" + - "\x03(l)\x03(m)\x03(n)\x03(o)\x03(p)\x03(q)\x03(r)\x03(s)\x03(t)\x03(u)" + - "\x03(v)\x03(w)\x03(x)\x03(y)\x03(z)\x07〔s〕\x02wz\x02hv\x02sd\x03ppv\x02w" + - "c\x02mc\x02md\x02dj\x06ほか\x06ココ\x03サ\x03手\x03字\x03双\x03デ\x03二\x03多\x03解" + - "\x03天\x03交\x03映\x03無\x03料\x03前\x03後\x03再\x03新\x03初\x03終\x03生\x03販\x03声" + - "\x03吹\x03演\x03投\x03捕\x03一\x03三\x03遊\x03左\x03中\x03右\x03指\x03走\x03打\x03禁" + - "\x03空\x03合\x03満\x03有\x03月\x03申\x03割\x03営\x03配\x09〔本〕\x09〔三〕\x09〔二〕\x09〔安" + - "〕\x09〔点〕\x09〔打〕\x09〔盗〕\x09〔勝〕\x09〔敗〕\x03得\x03可\x03丽\x03丸\x03乁\x03你\x03" + - "侮\x03侻\x03倂\x03偺\x03備\x03僧\x03像\x03㒞\x03免\x03兔\x03兤\x03具\x03㒹\x03內\x03" + - "冗\x03冤\x03仌\x03冬\x03况\x03凵\x03刃\x03㓟\x03刻\x03剆\x03剷\x03㔕\x03勇\x03勉\x03" + - "勤\x03勺\x03包\x03匆\x03北\x03卉\x03卑\x03博\x03即\x03卽\x03卿\x03灰\x03及\x03叟\x03" + - "叫\x03叱\x03吆\x03咞\x03吸\x03呈\x03周\x03咢\x03哶\x03唐\x03啓\x03啣\x03善\x03喙\x03" + - "喫\x03喳\x03嗂\x03圖\x03嘆\x03圗\x03噑\x03噴\x03切\x03壮\x03城\x03埴\x03堍\x03型\x03" + - "堲\x03報\x03墬\x03売\x03壷\x03夆\x03夢\x03奢\x03姬\x03娛\x03娧\x03姘\x03婦\x03㛮\x03" + - "嬈\x03嬾\x03寃\x03寘\x03寧\x03寳\x03寿\x03将\x03尢\x03㞁\x03屠\x03屮\x03峀\x03岍\x03" + - "嵃\x03嵮\x03嵫\x03嵼\x03巡\x03巢\x03㠯\x03巽\x03帨\x03帽\x03幩\x03㡢\x03㡼\x03庰\x03" + - "庳\x03庶\x03廊\x03廾\x03舁\x03弢\x03㣇\x03形\x03彫\x03㣣\x03徚\x03忍\x03志\x03忹\x03" + - "悁\x03㤺\x03㤜\x03悔\x03惇\x03慈\x03慌\x03慎\x03慺\x03憎\x03憲\x03憤\x03憯\x03懞\x03" + - "懲\x03懶\x03成\x03戛\x03扝\x03抱\x03拔\x03捐\x03挽\x03拼\x03捨\x03掃\x03揤\x03搢\x03" + - "揅\x03掩\x03㨮\x03摩\x03摾\x03撝\x03摷\x03㩬\x03敏\x03敬\x03旣\x03書\x03晉\x03㬙\x03" + - "暑\x03㬈\x03㫤\x03冒\x03冕\x03最\x03暜\x03肭\x03䏙\x03朗\x03望\x03朡\x03杞\x03杓\x03" + - "㭉\x03柺\x03枅\x03桒\x03梅\x03梎\x03栟\x03椔\x03㮝\x03楂\x03榣\x03槪\x03檨\x03櫛\x03" + - "㰘\x03次\x03歔\x03㱎\x03歲\x03殟\x03殺\x03殻\x03汎\x03沿\x03泍\x03汧\x03洖\x03派\x03" + - "海\x03流\x03浩\x03浸\x03涅\x03洴\x03港\x03湮\x03㴳\x03滋\x03滇\x03淹\x03潮\x03濆\x03" + - "瀹\x03瀞\x03瀛\x03㶖\x03灊\x03災\x03灷\x03炭\x03煅\x03熜\x03爨\x03爵\x03牐\x03犀\x03" + - "犕\x03獺\x03王\x03㺬\x03玥\x03㺸\x03瑇\x03瑜\x03瑱\x03璅\x03瓊\x03㼛\x03甤\x03甾\x03" + - "異\x03瘐\x03㿼\x03䀈\x03直\x03眞\x03真\x03睊\x03䀹\x03瞋\x03䁆\x03䂖\x03硎\x03碌\x03" + - "磌\x03䃣\x03祖\x03福\x03秫\x03䄯\x03穀\x03穊\x03穏\x03䈂\x03篆\x03築\x03䈧\x03糒\x03" + - "䊠\x03糨\x03糣\x03紀\x03絣\x03䌁\x03緇\x03縂\x03繅\x03䌴\x03䍙\x03罺\x03羕\x03翺\x03" + - "者\x03聠\x03聰\x03䏕\x03育\x03脃\x03䐋\x03脾\x03媵\x03舄\x03辞\x03䑫\x03芑\x03芋\x03" + - "芝\x03劳\x03花\x03芳\x03芽\x03苦\x03若\x03茝\x03荣\x03莭\x03茣\x03莽\x03菧\x03著\x03" + - "荓\x03菊\x03菌\x03菜\x03䔫\x03蓱\x03蓳\x03蔖\x03蕤\x03䕝\x03䕡\x03䕫\x03虐\x03虜\x03" + - "虧\x03虩\x03蚩\x03蚈\x03蜎\x03蛢\x03蝹\x03蜨\x03蝫\x03螆\x03蟡\x03蠁\x03䗹\x03衠\x03" + - "衣\x03裗\x03裞\x03䘵\x03裺\x03㒻\x03䚾\x03䛇\x03誠\x03諭\x03變\x03豕\x03貫\x03賁\x03" + - "贛\x03起\x03跋\x03趼\x03跰\x03軔\x03輸\x03邔\x03郱\x03鄑\x03鄛\x03鈸\x03鋗\x03鋘\x03" + - "鉼\x03鏹\x03鐕\x03開\x03䦕\x03閷\x03䧦\x03雃\x03嶲\x03霣\x03䩮\x03䩶\x03韠\x03䪲\x03" + - "頋\x03頩\x03飢\x03䬳\x03餩\x03馧\x03駂\x03駾\x03䯎\x03鬒\x03鱀\x03鳽\x03䳎\x03䳭\x03" + - "鵧\x03䳸\x03麻\x03䵖\x03黹\x03黾\x03鼅\x03鼏\x03鼖\x03鼻" - -var xorData string = "" + // Size: 4855 bytes - "\x02\x0c\x09\x02\xb0\xec\x02\xad\xd8\x02\xad\xd9\x02\x06\x07\x02\x0f\x12" + - "\x02\x0f\x1f\x02\x0f\x1d\x02\x01\x13\x02\x0f\x16\x02\x0f\x0b\x02\x0f3" + - "\x02\x0f7\x02\x0f?\x02\x0f/\x02\x0f*\x02\x0c&\x02\x0c*\x02\x0c;\x02\x0c9" + - "\x02\x0c%\x02\xab\xed\x02\xab\xe2\x02\xab\xe3\x02\xa9\xe0\x02\xa9\xe1" + - "\x02\xa9\xe6\x02\xa3\xcb\x02\xa3\xc8\x02\xa3\xc9\x02\x01#\x02\x01\x08" + - "\x02\x0e>\x02\x0e'\x02\x0f\x03\x02\x03\x0d\x02\x03\x09\x02\x03\x17\x02" + - "\x03\x0e\x02\x02\x03\x02\x011\x02\x01\x00\x02\x01\x10\x02\x03<\x02\x07" + - "\x0d\x02\x02\x0c\x02\x0c0\x02\x01\x03\x02\x01\x01\x02\x01 \x02\x01\x22" + - "\x02\x01)\x02\x01\x0a\x02\x01\x0c\x02\x02\x06\x02\x02\x02\x02\x03\x10" + - "\x03\x037 \x03\x0b+\x03\x02\x01\x04\x02\x01\x02\x02\x019\x02\x03\x1c\x02" + - "\x02$\x03\x80p$\x02\x03:\x02\x03\x0a\x03\xc1r.\x03\xc1r,\x03\xc1r\x02" + - "\x02\x02:\x02\x02>\x02\x02,\x02\x02\x10\x02\x02\x00\x03\xc1s<\x03\xc1s*" + - "\x03\xc2L$\x03\xc2L;\x02\x09)\x02\x0a\x19\x03\x83\xab\xe3\x03\x83\xab" + - "\xf2\x03 4\xe0\x03\x81\xab\xea\x03\x81\xab\xf3\x03 4\xef\x03\x96\xe1\xcd" + - "\x03\x84\xe5\xc3\x02\x0d\x11\x03\x8b\xec\xcb\x03\x94\xec\xcf\x03\x9a\xec" + - "\xc2\x03\x8b\xec\xdb\x03\x94\xec\xdf\x03\x9a\xec\xd2\x03\x01\x0c!\x03" + - "\x01\x0c#\x03ʠ\x9d\x03ʣ\x9c\x03ʢ\x9f\x03ʥ\x9e\x03ʤ\x91\x03ʧ\x90\x03ʦ\x93" + - "\x03ʩ\x92\x03ʨ\x95\x03\xca\xf3\xb5\x03\xca\xf0\xb4\x03\xca\xf1\xb7\x03" + - "\xca\xf6\xb6\x03\xca\xf7\x89\x03\xca\xf4\x88\x03\xca\xf5\x8b\x03\xca\xfa" + - "\x8a\x03\xca\xfb\x8d\x03\xca\xf8\x8c\x03\xca\xf9\x8f\x03\xca\xfe\x8e\x03" + - "\xca\xff\x81\x03\xca\xfc\x80\x03\xca\xfd\x83\x03\xca\xe2\x82\x03\xca\xe3" + - "\x85\x03\xca\xe0\x84\x03\xca\xe1\x87\x03\xca\xe6\x86\x03\xca\xe7\x99\x03" + - "\xca\xe4\x98\x03\xca\xe5\x9b\x03\xca\xea\x9a\x03\xca\xeb\x9d\x03\xca\xe8" + - "\x9c\x03ؓ\x89\x03ߔ\x8b\x02\x010\x03\x03\x04\x1e\x03\x04\x15\x12\x03\x0b" + - "\x05,\x03\x06\x04\x00\x03\x06\x04)\x03\x06\x044\x03\x06\x04<\x03\x06\x05" + - "\x1d\x03\x06\x06\x00\x03\x06\x06\x0a\x03\x06\x06'\x03\x06\x062\x03\x0786" + - "\x03\x079/\x03\x079 \x03\x07:\x0e\x03\x07:\x1b\x03\x07:%\x03\x07;/\x03" + - "\x07;%\x03\x074\x11\x03\x076\x09\x03\x077*\x03\x070\x01\x03\x070\x0f\x03" + - "\x070.\x03\x071\x16\x03\x071\x04\x03\x0710\x03\x072\x18\x03\x072-\x03" + - "\x073\x14\x03\x073>\x03\x07'\x09\x03\x07 \x00\x03\x07\x1f\x0b\x03\x07" + - "\x18#\x03\x07\x18(\x03\x07\x186\x03\x07\x18\x03\x03\x07\x19\x16\x03\x07" + - "\x116\x03\x07\x12'\x03\x07\x13\x10\x03\x07\x0c&\x03\x07\x0c\x08\x03\x07" + - "\x0c\x13\x03\x07\x0d\x02\x03\x07\x0d\x1c\x03\x07\x0b5\x03\x07\x0b\x0a" + - "\x03\x07\x0b\x01\x03\x07\x0b\x0f\x03\x07\x05\x00\x03\x07\x05\x09\x03\x07" + - "\x05\x0b\x03\x07\x07\x01\x03\x07\x07\x08\x03\x07\x00<\x03\x07\x00+\x03" + - "\x07\x01)\x03\x07\x01\x1b\x03\x07\x01\x08\x03\x07\x03?\x03\x0445\x03\x04" + - "4\x08\x03\x0454\x03\x04)/\x03\x04)5\x03\x04+\x05\x03\x04+\x14\x03\x04+ " + - "\x03\x04+<\x03\x04*&\x03\x04*\x22\x03\x04&8\x03\x04!\x01\x03\x04!\x22" + - "\x03\x04\x11+\x03\x04\x10.\x03\x04\x104\x03\x04\x13=\x03\x04\x12\x04\x03" + - "\x04\x12\x0a\x03\x04\x0d\x1d\x03\x04\x0d\x07\x03\x04\x0d \x03\x05<>\x03" + - "\x055<\x03\x055!\x03\x055#\x03\x055&\x03\x054\x1d\x03\x054\x02\x03\x054" + - "\x07\x03\x0571\x03\x053\x1a\x03\x053\x16\x03\x05.<\x03\x05.\x07\x03\x05)" + - ":\x03\x05)<\x03\x05)\x0c\x03\x05)\x15\x03\x05+-\x03\x05+5\x03\x05$\x1e" + - "\x03\x05$\x14\x03\x05'\x04\x03\x05'\x14\x03\x05&\x02\x03\x05\x226\x03" + - "\x05\x22\x0c\x03\x05\x22\x1c\x03\x05\x19\x0a\x03\x05\x1b\x09\x03\x05\x1b" + - "\x0c\x03\x05\x14\x07\x03\x05\x16?\x03\x05\x16\x0c\x03\x05\x0c\x05\x03" + - "\x05\x0e\x0f\x03\x05\x01\x0e\x03\x05\x00(\x03\x05\x030\x03\x05\x03\x06" + - "\x03\x0a==\x03\x0a=1\x03\x0a=,\x03\x0a=\x0c\x03\x0a??\x03\x0a<\x08\x03" + - "\x0a9!\x03\x0a9)\x03\x0a97\x03\x0a99\x03\x0a6\x0a\x03\x0a6\x1c\x03\x0a6" + - "\x17\x03\x0a7'\x03\x0a78\x03\x0a73\x03\x0a'\x01\x03\x0a'&\x03\x0a\x1f" + - "\x0e\x03\x0a\x1f\x03\x03\x0a\x1f3\x03\x0a\x1b/\x03\x0a\x18\x19\x03\x0a" + - "\x19\x01\x03\x0a\x16\x14\x03\x0a\x0e\x22\x03\x0a\x0f\x10\x03\x0a\x0f\x02" + - "\x03\x0a\x0f \x03\x0a\x0c\x04\x03\x0a\x0b>\x03\x0a\x0b+\x03\x0a\x08/\x03" + - "\x0a\x046\x03\x0a\x05\x14\x03\x0a\x00\x04\x03\x0a\x00\x10\x03\x0a\x00" + - "\x14\x03\x0b<3\x03\x0b;*\x03\x0b9\x22\x03\x0b9)\x03\x0b97\x03\x0b+\x10" + - "\x03\x0b((\x03\x0b&5\x03\x0b$\x1c\x03\x0b$\x12\x03\x0b%\x04\x03\x0b#<" + - "\x03\x0b#0\x03\x0b#\x0d\x03\x0b#\x19\x03\x0b!:\x03\x0b!\x1f\x03\x0b!\x00" + - "\x03\x0b\x1e5\x03\x0b\x1c\x1d\x03\x0b\x1d-\x03\x0b\x1d(\x03\x0b\x18.\x03" + - "\x0b\x18 \x03\x0b\x18\x16\x03\x0b\x14\x13\x03\x0b\x15$\x03\x0b\x15\x22" + - "\x03\x0b\x12\x1b\x03\x0b\x12\x10\x03\x0b\x132\x03\x0b\x13=\x03\x0b\x12" + - "\x18\x03\x0b\x0c&\x03\x0b\x061\x03\x0b\x06:\x03\x0b\x05#\x03\x0b\x05<" + - "\x03\x0b\x04\x0b\x03\x0b\x04\x04\x03\x0b\x04\x1b\x03\x0b\x042\x03\x0b" + - "\x041\x03\x0b\x03\x03\x03\x0b\x03\x1d\x03\x0b\x03/\x03\x0b\x03+\x03\x0b" + - "\x02\x1b\x03\x0b\x02\x00\x03\x0b\x01\x1e\x03\x0b\x01\x08\x03\x0b\x015" + - "\x03\x06\x0d9\x03\x06\x0d=\x03\x06\x0d?\x03\x02\x001\x03\x02\x003\x03" + - "\x02\x02\x19\x03\x02\x006\x03\x02\x02\x1b\x03\x02\x004\x03\x02\x00<\x03" + - "\x02\x02\x0a\x03\x02\x02\x0e\x03\x02\x01\x1a\x03\x02\x01\x07\x03\x02\x01" + - "\x05\x03\x02\x01\x0b\x03\x02\x01%\x03\x02\x01\x0c\x03\x02\x01\x04\x03" + - "\x02\x01\x1c\x03\x02\x00.\x03\x02\x002\x03\x02\x00>\x03\x02\x00\x12\x03" + - "\x02\x00\x16\x03\x02\x011\x03\x02\x013\x03\x02\x02 \x03\x02\x02%\x03\x02" + - "\x02$\x03\x02\x028\x03\x02\x02;\x03\x02\x024\x03\x02\x012\x03\x02\x022" + - "\x03\x02\x02/\x03\x02\x01,\x03\x02\x01\x13\x03\x02\x01\x16\x03\x02\x01" + - "\x11\x03\x02\x01\x1e\x03\x02\x01\x15\x03\x02\x01\x17\x03\x02\x01\x0f\x03" + - "\x02\x01\x08\x03\x02\x00?\x03\x02\x03\x07\x03\x02\x03\x0d\x03\x02\x03" + - "\x13\x03\x02\x03\x1d\x03\x02\x03\x1f\x03\x02\x00\x03\x03\x02\x00\x0d\x03" + - "\x02\x00\x01\x03\x02\x00\x1b\x03\x02\x00\x19\x03\x02\x00\x18\x03\x02\x00" + - "\x13\x03\x02\x00/\x03\x07>\x12\x03\x07<\x1f\x03\x07>\x1d\x03\x06\x1d\x0e" + - "\x03\x07>\x1c\x03\x07>:\x03\x07>\x13\x03\x04\x12+\x03\x07?\x03\x03\x07>" + - "\x02\x03\x06\x224\x03\x06\x1a.\x03\x07<%\x03\x06\x1c\x0b\x03\x0609\x03" + - "\x05\x1f\x01\x03\x04'\x08\x03\x93\xfd\xf5\x03\x02\x0d \x03\x02\x0d#\x03" + - "\x02\x0d!\x03\x02\x0d&\x03\x02\x0d\x22\x03\x02\x0d/\x03\x02\x0d,\x03\x02" + - "\x0d$\x03\x02\x0d'\x03\x02\x0d%\x03\x02\x0d;\x03\x02\x0d=\x03\x02\x0d?" + - "\x03\x099.\x03\x08\x0b7\x03\x08\x02\x14\x03\x08\x14\x0d\x03\x08.:\x03" + - "\x089'\x03\x0f\x0b\x18\x03\x0f\x1c1\x03\x0f\x17&\x03\x0f9\x1f\x03\x0f0" + - "\x0c\x03\x0e\x0a9\x03\x0e\x056\x03\x0e\x1c#\x03\x0f\x13\x0e\x03\x072\x00" + - "\x03\x070\x0d\x03\x072\x0b\x03\x06\x11\x18\x03\x070\x10\x03\x06\x0f(\x03" + - "\x072\x05\x03\x06\x0f,\x03\x073\x15\x03\x06\x07\x08\x03\x05\x16\x02\x03" + - "\x04\x0b \x03\x05:8\x03\x05\x16%\x03\x0a\x0d\x1f\x03\x06\x16\x10\x03\x05" + - "\x1d5\x03\x05*;\x03\x05\x16\x1b\x03\x04.-\x03\x06\x1a\x19\x03\x04\x03," + - "\x03\x0b87\x03\x04/\x0a\x03\x06\x00,\x03\x04-\x01\x03\x04\x1e-\x03\x06/(" + - "\x03\x0a\x0b5\x03\x06\x0e7\x03\x06\x07.\x03\x0597\x03\x0a*%\x03\x0760" + - "\x03\x06\x0c;\x03\x05'\x00\x03\x072.\x03\x072\x08\x03\x06=\x01\x03\x06" + - "\x05\x1b\x03\x06\x06\x12\x03\x06$=\x03\x06'\x0d\x03\x04\x11\x0f\x03\x076" + - ",\x03\x06\x07;\x03\x06.,\x03\x86\xf9\xea\x03\x8f\xff\xeb\x02\x092\x02" + - "\x095\x02\x094\x02\x09;\x02\x09>\x02\x098\x02\x09*\x02\x09/\x02\x09,\x02" + - "\x09%\x02\x09&\x02\x09#\x02\x09 \x02\x08!\x02\x08%\x02\x08$\x02\x08+\x02" + - "\x08.\x02\x08*\x02\x08&\x02\x088\x02\x08>\x02\x084\x02\x086\x02\x080\x02" + - "\x08\x10\x02\x08\x17\x02\x08\x12\x02\x08\x1d\x02\x08\x1f\x02\x08\x13\x02" + - "\x08\x15\x02\x08\x14\x02\x08\x0c\x03\x8b\xfd\xd0\x03\x81\xec\xc6\x03\x87" + - "\xe0\x8a\x03-2\xe3\x03\x80\xef\xe4\x03-2\xea\x03\x88\xe6\xeb\x03\x8e\xe6" + - "\xe8\x03\x84\xe6\xe9\x03\x97\xe6\xee\x03-2\xf9\x03-2\xf6\x03\x8e\xe3\xad" + - "\x03\x80\xe3\x92\x03\x88\xe3\x90\x03\x8e\xe3\x90\x03\x80\xe3\x97\x03\x88" + - "\xe3\x95\x03\x88\xfe\xcb\x03\x8e\xfe\xca\x03\x84\xfe\xcd\x03\x91\xef\xc9" + - "\x03-2\xc1\x03-2\xc0\x03-2\xcb\x03\x88@\x09\x03\x8e@\x08\x03\x8f\xe0\xf5" + - "\x03\x8e\xe6\xf9\x03\x8e\xe0\xfa\x03\x93\xff\xf4\x03\x84\xee\xd3\x03\x0b" + - "(\x04\x023 \x021;\x02\x01*\x03\x0b#\x10\x03\x0b 0\x03\x0b!\x10\x03\x0b!0" + - "\x03\x07\x15\x08\x03\x09?5\x03\x07\x1f\x08\x03\x07\x17\x0b\x03\x09\x1f" + - "\x15\x03\x0b\x1c7\x03\x0a+#\x03\x06\x1a\x1b\x03\x06\x1a\x14\x03\x0a\x01" + - "\x18\x03\x06#\x1b\x03\x0a2\x0c\x03\x0a\x01\x04\x03\x09#;\x03\x08='\x03" + - "\x08\x1a\x0a\x03\x07</\x03\x07:+\x03\x07\x07*\x03\x06&\x1c\x03\x09\x0c" + - "\x16\x03\x09\x10\x0e\x03\x08'\x0f\x03\x08+\x09\x03\x074%\x03\x06!3\x03" + - "\x06\x03+\x03\x0b\x1e\x19\x03\x0a))\x03\x09\x08\x19\x03\x08,\x05\x03\x07" + - "<2\x03\x06\x1c>\x03\x0a\x111\x03\x09\x1b\x09\x03\x073.\x03\x07\x01\x00" + - "\x03\x09/,\x03\x07#>\x03\x07\x048\x03\x0a\x1f\x22\x03\x098>\x03\x09\x11" + - "\x00\x03\x08/\x17\x03\x06'\x22\x03\x0b\x1a+\x03\x0a\x22\x19\x03\x0a/1" + - "\x03\x0974\x03\x09\x0f\x22\x03\x08,\x22\x03\x08?\x14\x03\x07$5\x03\x07<3" + - "\x03\x07=*\x03\x07\x13\x18\x03\x068\x0a\x03\x06\x09\x16\x03\x06\x13\x00" + - "\x03\x08\x067\x03\x08\x01\x03\x03\x08\x12\x1d\x03\x07+7\x03\x06(;\x03" + - "\x06\x1c?\x03\x07\x0e\x17\x03\x0a\x06\x1d\x03\x0a\x19\x07\x03\x08\x14$" + - "\x03\x07$;\x03\x08,$\x03\x08\x06\x0d\x03\x07\x16\x0a\x03\x06>>\x03\x0a" + - "\x06\x12\x03\x0a\x14)\x03\x09\x0d\x1f\x03\x09\x12\x17\x03\x09\x19\x01" + - "\x03\x08\x11 \x03\x08\x1d'\x03\x06<\x1a\x03\x0a.\x00\x03\x07'\x18\x03" + - "\x0a\x22\x08\x03\x08\x0d\x0a\x03\x08\x13)\x03\x07*)\x03\x06<,\x03\x07" + - "\x0b\x1a\x03\x09.\x14\x03\x09\x0d\x1e\x03\x07\x0e#\x03\x0b\x1d'\x03\x0a" + - "\x0a8\x03\x09%2\x03\x08+&\x03\x080\x12\x03\x0a)4\x03\x08\x06\x1f\x03\x0b" + - "\x1b\x1a\x03\x0a\x1b\x0f\x03\x0b\x1d*\x03\x09\x16$\x03\x090\x11\x03\x08" + - "\x11\x08\x03\x0a*(\x03\x0a\x042\x03\x089,\x03\x074'\x03\x07\x0f\x05\x03" + - "\x09\x0b\x0a\x03\x07\x1b\x01\x03\x09\x17:\x03\x09.\x0d\x03\x07.\x11\x03" + - "\x09+\x15\x03\x080\x13\x03\x0b\x1f\x19\x03\x0a \x11\x03\x0a\x220\x03\x09" + - "\x07;\x03\x08\x16\x1c\x03\x07,\x13\x03\x07\x0e/\x03\x06\x221\x03\x0a." + - "\x0a\x03\x0a7\x02\x03\x0a\x032\x03\x0a\x1d.\x03\x091\x06\x03\x09\x19:" + - "\x03\x08\x02/\x03\x060+\x03\x06\x0f-\x03\x06\x1c\x1f\x03\x06\x1d\x07\x03" + - "\x0a,\x11\x03\x09=\x0d\x03\x09\x0b;\x03\x07\x1b/\x03\x0a\x1f:\x03\x09 " + - "\x1f\x03\x09.\x10\x03\x094\x0b\x03\x09\x1a1\x03\x08#\x1a\x03\x084\x1d" + - "\x03\x08\x01\x1f\x03\x08\x11\x22\x03\x07'8\x03\x07\x1a>\x03\x0757\x03" + - "\x06&9\x03\x06+\x11\x03\x0a.\x0b\x03\x0a,>\x03\x0a4#\x03\x08%\x17\x03" + - "\x07\x05\x22\x03\x07\x0c\x0b\x03\x0a\x1d+\x03\x0a\x19\x16\x03\x09+\x1f" + - "\x03\x09\x08\x0b\x03\x08\x16\x18\x03\x08+\x12\x03\x0b\x1d\x0c\x03\x0a=" + - "\x10\x03\x0a\x09\x0d\x03\x0a\x10\x11\x03\x09&0\x03\x08(\x1f\x03\x087\x07" + - "\x03\x08\x185\x03\x07'6\x03\x06.\x05\x03\x06=\x04\x03\x06;;\x03\x06\x06," + - "\x03\x0b\x18>\x03\x08\x00\x18\x03\x06 \x03\x03\x06<\x00\x03\x09%\x18\x03" + - "\x0b\x1c<\x03\x0a%!\x03\x0a\x09\x12\x03\x0a\x16\x02\x03\x090'\x03\x09" + - "\x0e=\x03\x08 \x0e\x03\x08>\x03\x03\x074>\x03\x06&?\x03\x06\x19\x09\x03" + - "\x06?(\x03\x0a-\x0e\x03\x09:3\x03\x098:\x03\x09\x12\x0b\x03\x09\x1d\x17" + - "\x03\x087\x05\x03\x082\x14\x03\x08\x06%\x03\x08\x13\x1f\x03\x06\x06\x0e" + - "\x03\x0a\x22<\x03\x09/<\x03\x06>+\x03\x0a'?\x03\x0a\x13\x0c\x03\x09\x10<" + - "\x03\x07\x1b=\x03\x0a\x19\x13\x03\x09\x22\x1d\x03\x09\x07\x0d\x03\x08)" + - "\x1c\x03\x06=\x1a\x03\x0a/4\x03\x0a7\x11\x03\x0a\x16:\x03\x09?3\x03\x09:" + - "/\x03\x09\x05\x0a\x03\x09\x14\x06\x03\x087\x22\x03\x080\x07\x03\x08\x1a" + - "\x1f\x03\x07\x04(\x03\x07\x04\x09\x03\x06 %\x03\x06<\x08\x03\x0a+\x14" + - "\x03\x09\x1d\x16\x03\x0a70\x03\x08 >\x03\x0857\x03\x070\x0a\x03\x06=\x12" + - "\x03\x06\x16%\x03\x06\x1d,\x03\x099#\x03\x09\x10>\x03\x07 \x1e\x03\x08" + - "\x0c<\x03\x08\x0b\x18\x03\x08\x15+\x03\x08,:\x03\x08%\x22\x03\x07\x0a$" + - "\x03\x0b\x1c=\x03\x07+\x08\x03\x0a/\x05\x03\x0a \x07\x03\x0a\x12'\x03" + - "\x09#\x11\x03\x08\x1b\x15\x03\x0a\x06\x01\x03\x09\x1c\x1b\x03\x0922\x03" + - "\x07\x14<\x03\x07\x09\x04\x03\x061\x04\x03\x07\x0e\x01\x03\x0a\x13\x18" + - "\x03\x0a-\x0c\x03\x0a?\x0d\x03\x0a\x09\x0a\x03\x091&\x03\x0a/\x0b\x03" + - "\x08$<\x03\x083\x1d\x03\x08\x0c$\x03\x08\x0d\x07\x03\x08\x0d?\x03\x08" + - "\x0e\x14\x03\x065\x0a\x03\x08\x1a#\x03\x08\x16#\x03\x0702\x03\x07\x03" + - "\x1a\x03\x06(\x1d\x03\x06+\x1b\x03\x06\x0b\x05\x03\x06\x0b\x17\x03\x06" + - "\x0c\x04\x03\x06\x1e\x19\x03\x06+0\x03\x062\x18\x03\x0b\x16\x1e\x03\x0a+" + - "\x16\x03\x0a-?\x03\x0a#:\x03\x0a#\x10\x03\x0a%$\x03\x0a>+\x03\x0a01\x03" + - "\x0a1\x10\x03\x0a\x099\x03\x0a\x0a\x12\x03\x0a\x19\x1f\x03\x0a\x19\x12" + - "\x03\x09*)\x03\x09-\x16\x03\x09.1\x03\x09.2\x03\x09<\x0e\x03\x09> \x03" + - "\x093\x12\x03\x09\x0b\x01\x03\x09\x1c2\x03\x09\x11\x1c\x03\x09\x15%\x03" + - "\x08,&\x03\x08!\x22\x03\x089(\x03\x08\x0b\x1a\x03\x08\x0d2\x03\x08\x0c" + - "\x04\x03\x08\x0c\x06\x03\x08\x0c\x1f\x03\x08\x0c\x0c\x03\x08\x0f\x1f\x03" + - "\x08\x0f\x1d\x03\x08\x00\x14\x03\x08\x03\x14\x03\x08\x06\x16\x03\x08\x1e" + - "#\x03\x08\x11\x11\x03\x08\x10\x18\x03\x08\x14(\x03\x07)\x1e\x03\x07.1" + - "\x03\x07 $\x03\x07 '\x03\x078\x08\x03\x07\x0d0\x03\x07\x0f7\x03\x07\x05#" + - "\x03\x07\x05\x1a\x03\x07\x1a7\x03\x07\x1d-\x03\x07\x17\x10\x03\x06)\x1f" + - "\x03\x062\x0b\x03\x066\x16\x03\x06\x09\x11\x03\x09(\x1e\x03\x07!5\x03" + - "\x0b\x11\x16\x03\x0a/\x04\x03\x0a,\x1a\x03\x0b\x173\x03\x0a,1\x03\x0a/5" + - "\x03\x0a\x221\x03\x0a\x22\x0d\x03\x0a?%\x03\x0a<,\x03\x0a?#\x03\x0a>\x19" + - "\x03\x0a\x08&\x03\x0a\x0b\x0e\x03\x0a\x0c:\x03\x0a\x0c+\x03\x0a\x03\x22" + - "\x03\x0a\x06)\x03\x0a\x11\x10\x03\x0a\x11\x1a\x03\x0a\x17-\x03\x0a\x14(" + - "\x03\x09)\x1e\x03\x09/\x09\x03\x09.\x00\x03\x09,\x07\x03\x09/*\x03\x09-9" + - "\x03\x09\x228\x03\x09%\x09\x03\x09:\x12\x03\x09;\x1d\x03\x09?\x06\x03" + - "\x093%\x03\x096\x05\x03\x096\x08\x03\x097\x02\x03\x09\x07,\x03\x09\x04," + - "\x03\x09\x1f\x16\x03\x09\x11\x03\x03\x09\x11\x12\x03\x09\x168\x03\x08*" + - "\x05\x03\x08/2\x03\x084:\x03\x08\x22+\x03\x08 0\x03\x08&\x0a\x03\x08;" + - "\x10\x03\x08>$\x03\x08>\x18\x03\x0829\x03\x082:\x03\x081,\x03\x081<\x03" + - "\x081\x1c\x03\x087#\x03\x087*\x03\x08\x09'\x03\x08\x00\x1d\x03\x08\x05-" + - "\x03\x08\x1f4\x03\x08\x1d\x04\x03\x08\x16\x0f\x03\x07*7\x03\x07'!\x03" + - "\x07%\x1b\x03\x077\x0c\x03\x07\x0c1\x03\x07\x0c.\x03\x07\x00\x06\x03\x07" + - "\x01\x02\x03\x07\x010\x03\x07\x06=\x03\x07\x01\x03\x03\x07\x01\x13\x03" + - "\x07\x06\x06\x03\x07\x05\x0a\x03\x07\x1f\x09\x03\x07\x17:\x03\x06*1\x03" + - "\x06-\x1d\x03\x06\x223\x03\x062:\x03\x060$\x03\x066\x1e\x03\x064\x12\x03" + - "\x0645\x03\x06\x0b\x00\x03\x06\x0b7\x03\x06\x07\x1f\x03\x06\x15\x12\x03" + - "\x0c\x05\x0f\x03\x0b+\x0b\x03\x0b+-\x03\x06\x16\x1b\x03\x06\x15\x17\x03" + - "\x89\xca\xea\x03\x89\xca\xe8\x03\x0c8\x10\x03\x0c8\x01\x03\x0c8\x0f\x03" + - "\x0d8%\x03\x0d8!\x03\x0c8-\x03\x0c8/\x03\x0c8+\x03\x0c87\x03\x0c85\x03" + - "\x0c9\x09\x03\x0c9\x0d\x03\x0c9\x0f\x03\x0c9\x0b\x03\xcfu\x0c\x03\xcfu" + - "\x0f\x03\xcfu\x0e\x03\xcfu\x09\x03\x0c9\x10\x03\x0d9\x0c\x03\xcf`;\x03" + - "\xcf`>\x03\xcf`9\x03\xcf`8\x03\xcf`7\x03\xcf`*\x03\xcf`-\x03\xcf`,\x03" + - "\x0d\x1b\x1a\x03\x0d\x1b&\x03\x0c=.\x03\x0c=%\x03\x0c>\x1e\x03\x0c>\x14" + - "\x03\x0c?\x06\x03\x0c?\x0b\x03\x0c?\x0c\x03\x0c?\x0d\x03\x0c?\x02\x03" + - "\x0c>\x0f\x03\x0c>\x08\x03\x0c>\x09\x03\x0c>,\x03\x0c>\x0c\x03\x0c?\x13" + - "\x03\x0c?\x16\x03\x0c?\x15\x03\x0c?\x1c\x03\x0c?\x1f\x03\x0c?\x1d\x03" + - "\x0c?\x1a\x03\x0c?\x17\x03\x0c?\x08\x03\x0c?\x09\x03\x0c?\x0e\x03\x0c?" + - "\x04\x03\x0c?\x05\x03\x0c<?\x03\x0c=\x00\x03\x0c=\x06\x03\x0c=\x05\x03" + - "\x0c=\x0c\x03\x0c=\x0f\x03\x0c=\x0d\x03\x0c=\x0b\x03\x0c=\x07\x03\x0c=" + - "\x19\x03\x0c=\x15\x03\x0c=\x11\x03\x0c=1\x03\x0c=3\x03\x0c=0\x03\x0c=>" + - "\x03\x0c=2\x03\x0c=6\x03\x0c<\x07\x03\x0c<\x05\x03\x0e:!\x03\x0e:#\x03" + - "\x0e8\x09\x03\x0e:&\x03\x0e8\x0b\x03\x0e:$\x03\x0e:,\x03\x0e8\x1a\x03" + - "\x0e8\x1e\x03\x0e:*\x03\x0e:7\x03\x0e:5\x03\x0e:;\x03\x0e:\x15\x03\x0e:<" + - "\x03\x0e:4\x03\x0e:'\x03\x0e:-\x03\x0e:%\x03\x0e:?\x03\x0e:=\x03\x0e:)" + - "\x03\x0e:/\x03\xcfs'\x03\x0d=\x0f\x03\x0d+*\x03\x0d99\x03\x0d9;\x03\x0d9" + - "?\x03\x0d)\x0d\x03\x0d(%\x02\x01\x18\x02\x01(\x02\x01\x1e\x03\x0f$!\x03" + - "\x0f87\x03\x0f4\x0e\x03\x0f5\x1d\x03\x06'\x03\x03\x0f\x08\x18\x03\x0f" + - "\x0d\x1b\x03\x0e2=\x03\x0e;\x08\x03\x0e:\x0b\x03\x0e\x06$\x03\x0e\x0d)" + - "\x03\x0e\x16\x1f\x03\x0e\x16\x1b\x03\x0d$\x0a\x03\x05,\x1d\x03\x0d. \x03" + - "\x0d.#\x03\x0c(/\x03\x09%\x02\x03\x0d90\x03\x0d\x0e4\x03\x0d\x0d\x0f\x03" + - "\x0c#\x00\x03\x0c,\x1e\x03\x0c2\x0e\x03\x0c\x01\x17\x03\x0c\x09:\x03\x0e" + - "\x173\x03\x0c\x08\x03\x03\x0c\x11\x07\x03\x0c\x10\x18\x03\x0c\x1f\x1c" + - "\x03\x0c\x19\x0e\x03\x0c\x1a\x1f\x03\x0f0>\x03\x0b->\x03\x0b<+\x03\x0b8" + - "\x13\x03\x0b\x043\x03\x0b\x14\x03\x03\x0b\x16%\x03\x0d\x22&\x03\x0b\x1a" + - "\x1a\x03\x0b\x1a\x04\x03\x0a%9\x03\x0a&2\x03\x0a&0\x03\x0a!\x1a\x03\x0a!" + - "7\x03\x0a5\x10\x03\x0a=4\x03\x0a?\x0e\x03\x0a>\x10\x03\x0a\x00 \x03\x0a" + - "\x0f:\x03\x0a\x0f9\x03\x0a\x0b\x0a\x03\x0a\x17%\x03\x0a\x1b-\x03\x09-" + - "\x1a\x03\x09,4\x03\x09.,\x03\x09)\x09\x03\x096!\x03\x091\x1f\x03\x093" + - "\x16\x03\x0c+\x1f\x03\x098 \x03\x098=\x03\x0c(\x1a\x03\x0c(\x16\x03\x09" + - "\x0a+\x03\x09\x16\x12\x03\x09\x13\x0e\x03\x09\x153\x03\x08)!\x03\x09\x1a" + - "\x01\x03\x09\x18\x01\x03\x08%#\x03\x08>\x22\x03\x08\x05%\x03\x08\x02*" + - "\x03\x08\x15;\x03\x08\x1b7\x03\x0f\x07\x1d\x03\x0f\x04\x03\x03\x070\x0c" + - "\x03\x07;\x0b\x03\x07\x08\x17\x03\x07\x12\x06\x03\x06/-\x03\x0671\x03" + - "\x065+\x03\x06>7\x03\x06\x049\x03\x05+\x1e\x03\x05,\x17\x03\x05 \x1d\x03" + - "\x05\x22\x05\x03\x050\x1d" - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookup(s []byte) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupUnsafe(s []byte) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookupString(s string) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupStringUnsafe(s string) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// idnaTrie. Total size: 29052 bytes (28.37 KiB). Checksum: ef06e7ecc26f36dd. -type idnaTrie struct{} - -func newIdnaTrie(i int) *idnaTrie { - return &idnaTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *idnaTrie) lookupValue(n uint32, b byte) uint16 { - switch { - case n < 125: - return uint16(idnaValues[n<<6+uint32(b)]) - default: - n -= 125 - return uint16(idnaSparse.lookup(n, b)) - } -} - -// idnaValues: 127 blocks, 8128 entries, 16256 bytes -// The third block is the zero block. -var idnaValues = [8128]uint16{ - // Block 0x0, offset 0x0 - 0x00: 0x0080, 0x01: 0x0080, 0x02: 0x0080, 0x03: 0x0080, 0x04: 0x0080, 0x05: 0x0080, - 0x06: 0x0080, 0x07: 0x0080, 0x08: 0x0080, 0x09: 0x0080, 0x0a: 0x0080, 0x0b: 0x0080, - 0x0c: 0x0080, 0x0d: 0x0080, 0x0e: 0x0080, 0x0f: 0x0080, 0x10: 0x0080, 0x11: 0x0080, - 0x12: 0x0080, 0x13: 0x0080, 0x14: 0x0080, 0x15: 0x0080, 0x16: 0x0080, 0x17: 0x0080, - 0x18: 0x0080, 0x19: 0x0080, 0x1a: 0x0080, 0x1b: 0x0080, 0x1c: 0x0080, 0x1d: 0x0080, - 0x1e: 0x0080, 0x1f: 0x0080, 0x20: 0x0080, 0x21: 0x0080, 0x22: 0x0080, 0x23: 0x0080, - 0x24: 0x0080, 0x25: 0x0080, 0x26: 0x0080, 0x27: 0x0080, 0x28: 0x0080, 0x29: 0x0080, - 0x2a: 0x0080, 0x2b: 0x0080, 0x2c: 0x0080, 0x2d: 0x0008, 0x2e: 0x0008, 0x2f: 0x0080, - 0x30: 0x0008, 0x31: 0x0008, 0x32: 0x0008, 0x33: 0x0008, 0x34: 0x0008, 0x35: 0x0008, - 0x36: 0x0008, 0x37: 0x0008, 0x38: 0x0008, 0x39: 0x0008, 0x3a: 0x0080, 0x3b: 0x0080, - 0x3c: 0x0080, 0x3d: 0x0080, 0x3e: 0x0080, 0x3f: 0x0080, - // Block 0x1, offset 0x40 - 0x40: 0x0080, 0x41: 0xe105, 0x42: 0xe105, 0x43: 0xe105, 0x44: 0xe105, 0x45: 0xe105, - 0x46: 0xe105, 0x47: 0xe105, 0x48: 0xe105, 0x49: 0xe105, 0x4a: 0xe105, 0x4b: 0xe105, - 0x4c: 0xe105, 0x4d: 0xe105, 0x4e: 0xe105, 0x4f: 0xe105, 0x50: 0xe105, 0x51: 0xe105, - 0x52: 0xe105, 0x53: 0xe105, 0x54: 0xe105, 0x55: 0xe105, 0x56: 0xe105, 0x57: 0xe105, - 0x58: 0xe105, 0x59: 0xe105, 0x5a: 0xe105, 0x5b: 0x0080, 0x5c: 0x0080, 0x5d: 0x0080, - 0x5e: 0x0080, 0x5f: 0x0080, 0x60: 0x0080, 0x61: 0x0008, 0x62: 0x0008, 0x63: 0x0008, - 0x64: 0x0008, 0x65: 0x0008, 0x66: 0x0008, 0x67: 0x0008, 0x68: 0x0008, 0x69: 0x0008, - 0x6a: 0x0008, 0x6b: 0x0008, 0x6c: 0x0008, 0x6d: 0x0008, 0x6e: 0x0008, 0x6f: 0x0008, - 0x70: 0x0008, 0x71: 0x0008, 0x72: 0x0008, 0x73: 0x0008, 0x74: 0x0008, 0x75: 0x0008, - 0x76: 0x0008, 0x77: 0x0008, 0x78: 0x0008, 0x79: 0x0008, 0x7a: 0x0008, 0x7b: 0x0080, - 0x7c: 0x0080, 0x7d: 0x0080, 0x7e: 0x0080, 0x7f: 0x0080, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x0040, 0xc1: 0x0040, 0xc2: 0x0040, 0xc3: 0x0040, 0xc4: 0x0040, 0xc5: 0x0040, - 0xc6: 0x0040, 0xc7: 0x0040, 0xc8: 0x0040, 0xc9: 0x0040, 0xca: 0x0040, 0xcb: 0x0040, - 0xcc: 0x0040, 0xcd: 0x0040, 0xce: 0x0040, 0xcf: 0x0040, 0xd0: 0x0040, 0xd1: 0x0040, - 0xd2: 0x0040, 0xd3: 0x0040, 0xd4: 0x0040, 0xd5: 0x0040, 0xd6: 0x0040, 0xd7: 0x0040, - 0xd8: 0x0040, 0xd9: 0x0040, 0xda: 0x0040, 0xdb: 0x0040, 0xdc: 0x0040, 0xdd: 0x0040, - 0xde: 0x0040, 0xdf: 0x0040, 0xe0: 0x000a, 0xe1: 0x0018, 0xe2: 0x0018, 0xe3: 0x0018, - 0xe4: 0x0018, 0xe5: 0x0018, 0xe6: 0x0018, 0xe7: 0x0018, 0xe8: 0x001a, 0xe9: 0x0018, - 0xea: 0x0039, 0xeb: 0x0018, 0xec: 0x0018, 0xed: 0x03c0, 0xee: 0x0018, 0xef: 0x004a, - 0xf0: 0x0018, 0xf1: 0x0018, 0xf2: 0x0069, 0xf3: 0x0079, 0xf4: 0x008a, 0xf5: 0x0005, - 0xf6: 0x0018, 0xf7: 0x0008, 0xf8: 0x00aa, 0xf9: 0x00c9, 0xfa: 0x00d9, 0xfb: 0x0018, - 0xfc: 0x00e9, 0xfd: 0x0119, 0xfe: 0x0149, 0xff: 0x0018, - // Block 0x4, offset 0x100 - 0x100: 0xe00d, 0x101: 0x0008, 0x102: 0xe00d, 0x103: 0x0008, 0x104: 0xe00d, 0x105: 0x0008, - 0x106: 0xe00d, 0x107: 0x0008, 0x108: 0xe00d, 0x109: 0x0008, 0x10a: 0xe00d, 0x10b: 0x0008, - 0x10c: 0xe00d, 0x10d: 0x0008, 0x10e: 0xe00d, 0x10f: 0x0008, 0x110: 0xe00d, 0x111: 0x0008, - 0x112: 0xe00d, 0x113: 0x0008, 0x114: 0xe00d, 0x115: 0x0008, 0x116: 0xe00d, 0x117: 0x0008, - 0x118: 0xe00d, 0x119: 0x0008, 0x11a: 0xe00d, 0x11b: 0x0008, 0x11c: 0xe00d, 0x11d: 0x0008, - 0x11e: 0xe00d, 0x11f: 0x0008, 0x120: 0xe00d, 0x121: 0x0008, 0x122: 0xe00d, 0x123: 0x0008, - 0x124: 0xe00d, 0x125: 0x0008, 0x126: 0xe00d, 0x127: 0x0008, 0x128: 0xe00d, 0x129: 0x0008, - 0x12a: 0xe00d, 0x12b: 0x0008, 0x12c: 0xe00d, 0x12d: 0x0008, 0x12e: 0xe00d, 0x12f: 0x0008, - 0x130: 0x0179, 0x131: 0x0008, 0x132: 0x0035, 0x133: 0x004d, 0x134: 0xe00d, 0x135: 0x0008, - 0x136: 0xe00d, 0x137: 0x0008, 0x138: 0x0008, 0x139: 0xe01d, 0x13a: 0x0008, 0x13b: 0xe03d, - 0x13c: 0x0008, 0x13d: 0xe01d, 0x13e: 0x0008, 0x13f: 0x0199, - // Block 0x5, offset 0x140 - 0x140: 0x0199, 0x141: 0xe01d, 0x142: 0x0008, 0x143: 0xe03d, 0x144: 0x0008, 0x145: 0xe01d, - 0x146: 0x0008, 0x147: 0xe07d, 0x148: 0x0008, 0x149: 0x01b9, 0x14a: 0xe00d, 0x14b: 0x0008, - 0x14c: 0xe00d, 0x14d: 0x0008, 0x14e: 0xe00d, 0x14f: 0x0008, 0x150: 0xe00d, 0x151: 0x0008, - 0x152: 0xe00d, 0x153: 0x0008, 0x154: 0xe00d, 0x155: 0x0008, 0x156: 0xe00d, 0x157: 0x0008, - 0x158: 0xe00d, 0x159: 0x0008, 0x15a: 0xe00d, 0x15b: 0x0008, 0x15c: 0xe00d, 0x15d: 0x0008, - 0x15e: 0xe00d, 0x15f: 0x0008, 0x160: 0xe00d, 0x161: 0x0008, 0x162: 0xe00d, 0x163: 0x0008, - 0x164: 0xe00d, 0x165: 0x0008, 0x166: 0xe00d, 0x167: 0x0008, 0x168: 0xe00d, 0x169: 0x0008, - 0x16a: 0xe00d, 0x16b: 0x0008, 0x16c: 0xe00d, 0x16d: 0x0008, 0x16e: 0xe00d, 0x16f: 0x0008, - 0x170: 0xe00d, 0x171: 0x0008, 0x172: 0xe00d, 0x173: 0x0008, 0x174: 0xe00d, 0x175: 0x0008, - 0x176: 0xe00d, 0x177: 0x0008, 0x178: 0x0065, 0x179: 0xe01d, 0x17a: 0x0008, 0x17b: 0xe03d, - 0x17c: 0x0008, 0x17d: 0xe01d, 0x17e: 0x0008, 0x17f: 0x01d9, - // Block 0x6, offset 0x180 - 0x180: 0x0008, 0x181: 0x007d, 0x182: 0xe00d, 0x183: 0x0008, 0x184: 0xe00d, 0x185: 0x0008, - 0x186: 0x007d, 0x187: 0xe07d, 0x188: 0x0008, 0x189: 0x0095, 0x18a: 0x00ad, 0x18b: 0xe03d, - 0x18c: 0x0008, 0x18d: 0x0008, 0x18e: 0x00c5, 0x18f: 0x00dd, 0x190: 0x00f5, 0x191: 0xe01d, - 0x192: 0x0008, 0x193: 0x010d, 0x194: 0x0125, 0x195: 0x0008, 0x196: 0x013d, 0x197: 0x013d, - 0x198: 0xe00d, 0x199: 0x0008, 0x19a: 0x0008, 0x19b: 0x0008, 0x19c: 0x010d, 0x19d: 0x0155, - 0x19e: 0x0008, 0x19f: 0x016d, 0x1a0: 0xe00d, 0x1a1: 0x0008, 0x1a2: 0xe00d, 0x1a3: 0x0008, - 0x1a4: 0xe00d, 0x1a5: 0x0008, 0x1a6: 0x0185, 0x1a7: 0xe07d, 0x1a8: 0x0008, 0x1a9: 0x019d, - 0x1aa: 0x0008, 0x1ab: 0x0008, 0x1ac: 0xe00d, 0x1ad: 0x0008, 0x1ae: 0x0185, 0x1af: 0xe0fd, - 0x1b0: 0x0008, 0x1b1: 0x01b5, 0x1b2: 0x01cd, 0x1b3: 0xe03d, 0x1b4: 0x0008, 0x1b5: 0xe01d, - 0x1b6: 0x0008, 0x1b7: 0x01e5, 0x1b8: 0xe00d, 0x1b9: 0x0008, 0x1ba: 0x0008, 0x1bb: 0x0008, - 0x1bc: 0xe00d, 0x1bd: 0x0008, 0x1be: 0x0008, 0x1bf: 0x0008, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x0008, 0x1c1: 0x0008, 0x1c2: 0x0008, 0x1c3: 0x0008, 0x1c4: 0x01e9, 0x1c5: 0x01e9, - 0x1c6: 0x01e9, 0x1c7: 0x01fd, 0x1c8: 0x0215, 0x1c9: 0x022d, 0x1ca: 0x0245, 0x1cb: 0x025d, - 0x1cc: 0x0275, 0x1cd: 0xe01d, 0x1ce: 0x0008, 0x1cf: 0xe0fd, 0x1d0: 0x0008, 0x1d1: 0xe01d, - 0x1d2: 0x0008, 0x1d3: 0xe03d, 0x1d4: 0x0008, 0x1d5: 0xe01d, 0x1d6: 0x0008, 0x1d7: 0xe07d, - 0x1d8: 0x0008, 0x1d9: 0xe01d, 0x1da: 0x0008, 0x1db: 0xe03d, 0x1dc: 0x0008, 0x1dd: 0x0008, - 0x1de: 0xe00d, 0x1df: 0x0008, 0x1e0: 0xe00d, 0x1e1: 0x0008, 0x1e2: 0xe00d, 0x1e3: 0x0008, - 0x1e4: 0xe00d, 0x1e5: 0x0008, 0x1e6: 0xe00d, 0x1e7: 0x0008, 0x1e8: 0xe00d, 0x1e9: 0x0008, - 0x1ea: 0xe00d, 0x1eb: 0x0008, 0x1ec: 0xe00d, 0x1ed: 0x0008, 0x1ee: 0xe00d, 0x1ef: 0x0008, - 0x1f0: 0x0008, 0x1f1: 0x028d, 0x1f2: 0x02a5, 0x1f3: 0x02bd, 0x1f4: 0xe00d, 0x1f5: 0x0008, - 0x1f6: 0x02d5, 0x1f7: 0x02ed, 0x1f8: 0xe00d, 0x1f9: 0x0008, 0x1fa: 0xe00d, 0x1fb: 0x0008, - 0x1fc: 0xe00d, 0x1fd: 0x0008, 0x1fe: 0xe00d, 0x1ff: 0x0008, - // Block 0x8, offset 0x200 - 0x200: 0xe00d, 0x201: 0x0008, 0x202: 0xe00d, 0x203: 0x0008, 0x204: 0xe00d, 0x205: 0x0008, - 0x206: 0xe00d, 0x207: 0x0008, 0x208: 0xe00d, 0x209: 0x0008, 0x20a: 0xe00d, 0x20b: 0x0008, - 0x20c: 0xe00d, 0x20d: 0x0008, 0x20e: 0xe00d, 0x20f: 0x0008, 0x210: 0xe00d, 0x211: 0x0008, - 0x212: 0xe00d, 0x213: 0x0008, 0x214: 0xe00d, 0x215: 0x0008, 0x216: 0xe00d, 0x217: 0x0008, - 0x218: 0xe00d, 0x219: 0x0008, 0x21a: 0xe00d, 0x21b: 0x0008, 0x21c: 0xe00d, 0x21d: 0x0008, - 0x21e: 0xe00d, 0x21f: 0x0008, 0x220: 0x0305, 0x221: 0x0008, 0x222: 0xe00d, 0x223: 0x0008, - 0x224: 0xe00d, 0x225: 0x0008, 0x226: 0xe00d, 0x227: 0x0008, 0x228: 0xe00d, 0x229: 0x0008, - 0x22a: 0xe00d, 0x22b: 0x0008, 0x22c: 0xe00d, 0x22d: 0x0008, 0x22e: 0xe00d, 0x22f: 0x0008, - 0x230: 0xe00d, 0x231: 0x0008, 0x232: 0xe00d, 0x233: 0x0008, 0x234: 0x0008, 0x235: 0x0008, - 0x236: 0x0008, 0x237: 0x0008, 0x238: 0x0008, 0x239: 0x0008, 0x23a: 0x0209, 0x23b: 0xe03d, - 0x23c: 0x0008, 0x23d: 0x031d, 0x23e: 0x0229, 0x23f: 0x0008, - // Block 0x9, offset 0x240 - 0x240: 0x0008, 0x241: 0x0008, 0x242: 0x0018, 0x243: 0x0018, 0x244: 0x0018, 0x245: 0x0018, - 0x246: 0x0008, 0x247: 0x0008, 0x248: 0x0008, 0x249: 0x0008, 0x24a: 0x0008, 0x24b: 0x0008, - 0x24c: 0x0008, 0x24d: 0x0008, 0x24e: 0x0008, 0x24f: 0x0008, 0x250: 0x0008, 0x251: 0x0008, - 0x252: 0x0018, 0x253: 0x0018, 0x254: 0x0018, 0x255: 0x0018, 0x256: 0x0018, 0x257: 0x0018, - 0x258: 0x029a, 0x259: 0x02ba, 0x25a: 0x02da, 0x25b: 0x02fa, 0x25c: 0x031a, 0x25d: 0x033a, - 0x25e: 0x0018, 0x25f: 0x0018, 0x260: 0x03ad, 0x261: 0x0359, 0x262: 0x01d9, 0x263: 0x0369, - 0x264: 0x03c5, 0x265: 0x0018, 0x266: 0x0018, 0x267: 0x0018, 0x268: 0x0018, 0x269: 0x0018, - 0x26a: 0x0018, 0x26b: 0x0018, 0x26c: 0x0008, 0x26d: 0x0018, 0x26e: 0x0008, 0x26f: 0x0018, - 0x270: 0x0018, 0x271: 0x0018, 0x272: 0x0018, 0x273: 0x0018, 0x274: 0x0018, 0x275: 0x0018, - 0x276: 0x0018, 0x277: 0x0018, 0x278: 0x0018, 0x279: 0x0018, 0x27a: 0x0018, 0x27b: 0x0018, - 0x27c: 0x0018, 0x27d: 0x0018, 0x27e: 0x0018, 0x27f: 0x0018, - // Block 0xa, offset 0x280 - 0x280: 0x03dd, 0x281: 0x03dd, 0x282: 0x3308, 0x283: 0x03f5, 0x284: 0x0379, 0x285: 0x040d, - 0x286: 0x3308, 0x287: 0x3308, 0x288: 0x3308, 0x289: 0x3308, 0x28a: 0x3308, 0x28b: 0x3308, - 0x28c: 0x3308, 0x28d: 0x3308, 0x28e: 0x3308, 0x28f: 0x33c0, 0x290: 0x3308, 0x291: 0x3308, - 0x292: 0x3308, 0x293: 0x3308, 0x294: 0x3308, 0x295: 0x3308, 0x296: 0x3308, 0x297: 0x3308, - 0x298: 0x3308, 0x299: 0x3308, 0x29a: 0x3308, 0x29b: 0x3308, 0x29c: 0x3308, 0x29d: 0x3308, - 0x29e: 0x3308, 0x29f: 0x3308, 0x2a0: 0x3308, 0x2a1: 0x3308, 0x2a2: 0x3308, 0x2a3: 0x3308, - 0x2a4: 0x3308, 0x2a5: 0x3308, 0x2a6: 0x3308, 0x2a7: 0x3308, 0x2a8: 0x3308, 0x2a9: 0x3308, - 0x2aa: 0x3308, 0x2ab: 0x3308, 0x2ac: 0x3308, 0x2ad: 0x3308, 0x2ae: 0x3308, 0x2af: 0x3308, - 0x2b0: 0xe00d, 0x2b1: 0x0008, 0x2b2: 0xe00d, 0x2b3: 0x0008, 0x2b4: 0x0425, 0x2b5: 0x0008, - 0x2b6: 0xe00d, 0x2b7: 0x0008, 0x2b8: 0x0040, 0x2b9: 0x0040, 0x2ba: 0x03a2, 0x2bb: 0x0008, - 0x2bc: 0x0008, 0x2bd: 0x0008, 0x2be: 0x03c2, 0x2bf: 0x043d, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x0040, 0x2c1: 0x0040, 0x2c2: 0x0040, 0x2c3: 0x0040, 0x2c4: 0x008a, 0x2c5: 0x03d2, - 0x2c6: 0xe155, 0x2c7: 0x0455, 0x2c8: 0xe12d, 0x2c9: 0xe13d, 0x2ca: 0xe12d, 0x2cb: 0x0040, - 0x2cc: 0x03dd, 0x2cd: 0x0040, 0x2ce: 0x046d, 0x2cf: 0x0485, 0x2d0: 0x0008, 0x2d1: 0xe105, - 0x2d2: 0xe105, 0x2d3: 0xe105, 0x2d4: 0xe105, 0x2d5: 0xe105, 0x2d6: 0xe105, 0x2d7: 0xe105, - 0x2d8: 0xe105, 0x2d9: 0xe105, 0x2da: 0xe105, 0x2db: 0xe105, 0x2dc: 0xe105, 0x2dd: 0xe105, - 0x2de: 0xe105, 0x2df: 0xe105, 0x2e0: 0x049d, 0x2e1: 0x049d, 0x2e2: 0x0040, 0x2e3: 0x049d, - 0x2e4: 0x049d, 0x2e5: 0x049d, 0x2e6: 0x049d, 0x2e7: 0x049d, 0x2e8: 0x049d, 0x2e9: 0x049d, - 0x2ea: 0x049d, 0x2eb: 0x049d, 0x2ec: 0x0008, 0x2ed: 0x0008, 0x2ee: 0x0008, 0x2ef: 0x0008, - 0x2f0: 0x0008, 0x2f1: 0x0008, 0x2f2: 0x0008, 0x2f3: 0x0008, 0x2f4: 0x0008, 0x2f5: 0x0008, - 0x2f6: 0x0008, 0x2f7: 0x0008, 0x2f8: 0x0008, 0x2f9: 0x0008, 0x2fa: 0x0008, 0x2fb: 0x0008, - 0x2fc: 0x0008, 0x2fd: 0x0008, 0x2fe: 0x0008, 0x2ff: 0x0008, - // Block 0xc, offset 0x300 - 0x300: 0x0008, 0x301: 0x0008, 0x302: 0xe00f, 0x303: 0x0008, 0x304: 0x0008, 0x305: 0x0008, - 0x306: 0x0008, 0x307: 0x0008, 0x308: 0x0008, 0x309: 0x0008, 0x30a: 0x0008, 0x30b: 0x0008, - 0x30c: 0x0008, 0x30d: 0x0008, 0x30e: 0x0008, 0x30f: 0xe0c5, 0x310: 0x04b5, 0x311: 0x04cd, - 0x312: 0xe0bd, 0x313: 0xe0f5, 0x314: 0xe0fd, 0x315: 0xe09d, 0x316: 0xe0b5, 0x317: 0x0008, - 0x318: 0xe00d, 0x319: 0x0008, 0x31a: 0xe00d, 0x31b: 0x0008, 0x31c: 0xe00d, 0x31d: 0x0008, - 0x31e: 0xe00d, 0x31f: 0x0008, 0x320: 0xe00d, 0x321: 0x0008, 0x322: 0xe00d, 0x323: 0x0008, - 0x324: 0xe00d, 0x325: 0x0008, 0x326: 0xe00d, 0x327: 0x0008, 0x328: 0xe00d, 0x329: 0x0008, - 0x32a: 0xe00d, 0x32b: 0x0008, 0x32c: 0xe00d, 0x32d: 0x0008, 0x32e: 0xe00d, 0x32f: 0x0008, - 0x330: 0x04e5, 0x331: 0xe185, 0x332: 0xe18d, 0x333: 0x0008, 0x334: 0x04fd, 0x335: 0x03dd, - 0x336: 0x0018, 0x337: 0xe07d, 0x338: 0x0008, 0x339: 0xe1d5, 0x33a: 0xe00d, 0x33b: 0x0008, - 0x33c: 0x0008, 0x33d: 0x0515, 0x33e: 0x052d, 0x33f: 0x052d, - // Block 0xd, offset 0x340 - 0x340: 0x0008, 0x341: 0x0008, 0x342: 0x0008, 0x343: 0x0008, 0x344: 0x0008, 0x345: 0x0008, - 0x346: 0x0008, 0x347: 0x0008, 0x348: 0x0008, 0x349: 0x0008, 0x34a: 0x0008, 0x34b: 0x0008, - 0x34c: 0x0008, 0x34d: 0x0008, 0x34e: 0x0008, 0x34f: 0x0008, 0x350: 0x0008, 0x351: 0x0008, - 0x352: 0x0008, 0x353: 0x0008, 0x354: 0x0008, 0x355: 0x0008, 0x356: 0x0008, 0x357: 0x0008, - 0x358: 0x0008, 0x359: 0x0008, 0x35a: 0x0008, 0x35b: 0x0008, 0x35c: 0x0008, 0x35d: 0x0008, - 0x35e: 0x0008, 0x35f: 0x0008, 0x360: 0xe00d, 0x361: 0x0008, 0x362: 0xe00d, 0x363: 0x0008, - 0x364: 0xe00d, 0x365: 0x0008, 0x366: 0xe00d, 0x367: 0x0008, 0x368: 0xe00d, 0x369: 0x0008, - 0x36a: 0xe00d, 0x36b: 0x0008, 0x36c: 0xe00d, 0x36d: 0x0008, 0x36e: 0xe00d, 0x36f: 0x0008, - 0x370: 0xe00d, 0x371: 0x0008, 0x372: 0xe00d, 0x373: 0x0008, 0x374: 0xe00d, 0x375: 0x0008, - 0x376: 0xe00d, 0x377: 0x0008, 0x378: 0xe00d, 0x379: 0x0008, 0x37a: 0xe00d, 0x37b: 0x0008, - 0x37c: 0xe00d, 0x37d: 0x0008, 0x37e: 0xe00d, 0x37f: 0x0008, - // Block 0xe, offset 0x380 - 0x380: 0xe00d, 0x381: 0x0008, 0x382: 0x0018, 0x383: 0x3308, 0x384: 0x3308, 0x385: 0x3308, - 0x386: 0x3308, 0x387: 0x3308, 0x388: 0x3318, 0x389: 0x3318, 0x38a: 0xe00d, 0x38b: 0x0008, - 0x38c: 0xe00d, 0x38d: 0x0008, 0x38e: 0xe00d, 0x38f: 0x0008, 0x390: 0xe00d, 0x391: 0x0008, - 0x392: 0xe00d, 0x393: 0x0008, 0x394: 0xe00d, 0x395: 0x0008, 0x396: 0xe00d, 0x397: 0x0008, - 0x398: 0xe00d, 0x399: 0x0008, 0x39a: 0xe00d, 0x39b: 0x0008, 0x39c: 0xe00d, 0x39d: 0x0008, - 0x39e: 0xe00d, 0x39f: 0x0008, 0x3a0: 0xe00d, 0x3a1: 0x0008, 0x3a2: 0xe00d, 0x3a3: 0x0008, - 0x3a4: 0xe00d, 0x3a5: 0x0008, 0x3a6: 0xe00d, 0x3a7: 0x0008, 0x3a8: 0xe00d, 0x3a9: 0x0008, - 0x3aa: 0xe00d, 0x3ab: 0x0008, 0x3ac: 0xe00d, 0x3ad: 0x0008, 0x3ae: 0xe00d, 0x3af: 0x0008, - 0x3b0: 0xe00d, 0x3b1: 0x0008, 0x3b2: 0xe00d, 0x3b3: 0x0008, 0x3b4: 0xe00d, 0x3b5: 0x0008, - 0x3b6: 0xe00d, 0x3b7: 0x0008, 0x3b8: 0xe00d, 0x3b9: 0x0008, 0x3ba: 0xe00d, 0x3bb: 0x0008, - 0x3bc: 0xe00d, 0x3bd: 0x0008, 0x3be: 0xe00d, 0x3bf: 0x0008, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x0040, 0x3c1: 0xe01d, 0x3c2: 0x0008, 0x3c3: 0xe03d, 0x3c4: 0x0008, 0x3c5: 0xe01d, - 0x3c6: 0x0008, 0x3c7: 0xe07d, 0x3c8: 0x0008, 0x3c9: 0xe01d, 0x3ca: 0x0008, 0x3cb: 0xe03d, - 0x3cc: 0x0008, 0x3cd: 0xe01d, 0x3ce: 0x0008, 0x3cf: 0x0008, 0x3d0: 0xe00d, 0x3d1: 0x0008, - 0x3d2: 0xe00d, 0x3d3: 0x0008, 0x3d4: 0xe00d, 0x3d5: 0x0008, 0x3d6: 0xe00d, 0x3d7: 0x0008, - 0x3d8: 0xe00d, 0x3d9: 0x0008, 0x3da: 0xe00d, 0x3db: 0x0008, 0x3dc: 0xe00d, 0x3dd: 0x0008, - 0x3de: 0xe00d, 0x3df: 0x0008, 0x3e0: 0xe00d, 0x3e1: 0x0008, 0x3e2: 0xe00d, 0x3e3: 0x0008, - 0x3e4: 0xe00d, 0x3e5: 0x0008, 0x3e6: 0xe00d, 0x3e7: 0x0008, 0x3e8: 0xe00d, 0x3e9: 0x0008, - 0x3ea: 0xe00d, 0x3eb: 0x0008, 0x3ec: 0xe00d, 0x3ed: 0x0008, 0x3ee: 0xe00d, 0x3ef: 0x0008, - 0x3f0: 0xe00d, 0x3f1: 0x0008, 0x3f2: 0xe00d, 0x3f3: 0x0008, 0x3f4: 0xe00d, 0x3f5: 0x0008, - 0x3f6: 0xe00d, 0x3f7: 0x0008, 0x3f8: 0xe00d, 0x3f9: 0x0008, 0x3fa: 0xe00d, 0x3fb: 0x0008, - 0x3fc: 0xe00d, 0x3fd: 0x0008, 0x3fe: 0xe00d, 0x3ff: 0x0008, - // Block 0x10, offset 0x400 - 0x400: 0xe00d, 0x401: 0x0008, 0x402: 0xe00d, 0x403: 0x0008, 0x404: 0xe00d, 0x405: 0x0008, - 0x406: 0xe00d, 0x407: 0x0008, 0x408: 0xe00d, 0x409: 0x0008, 0x40a: 0xe00d, 0x40b: 0x0008, - 0x40c: 0xe00d, 0x40d: 0x0008, 0x40e: 0xe00d, 0x40f: 0x0008, 0x410: 0xe00d, 0x411: 0x0008, - 0x412: 0xe00d, 0x413: 0x0008, 0x414: 0xe00d, 0x415: 0x0008, 0x416: 0xe00d, 0x417: 0x0008, - 0x418: 0xe00d, 0x419: 0x0008, 0x41a: 0xe00d, 0x41b: 0x0008, 0x41c: 0xe00d, 0x41d: 0x0008, - 0x41e: 0xe00d, 0x41f: 0x0008, 0x420: 0xe00d, 0x421: 0x0008, 0x422: 0xe00d, 0x423: 0x0008, - 0x424: 0xe00d, 0x425: 0x0008, 0x426: 0xe00d, 0x427: 0x0008, 0x428: 0xe00d, 0x429: 0x0008, - 0x42a: 0xe00d, 0x42b: 0x0008, 0x42c: 0xe00d, 0x42d: 0x0008, 0x42e: 0xe00d, 0x42f: 0x0008, - 0x430: 0x0040, 0x431: 0x03f5, 0x432: 0x03f5, 0x433: 0x03f5, 0x434: 0x03f5, 0x435: 0x03f5, - 0x436: 0x03f5, 0x437: 0x03f5, 0x438: 0x03f5, 0x439: 0x03f5, 0x43a: 0x03f5, 0x43b: 0x03f5, - 0x43c: 0x03f5, 0x43d: 0x03f5, 0x43e: 0x03f5, 0x43f: 0x03f5, - // Block 0x11, offset 0x440 - 0x440: 0x0840, 0x441: 0x0840, 0x442: 0x0840, 0x443: 0x0840, 0x444: 0x0840, 0x445: 0x0840, - 0x446: 0x0018, 0x447: 0x0018, 0x448: 0x0818, 0x449: 0x0018, 0x44a: 0x0018, 0x44b: 0x0818, - 0x44c: 0x0018, 0x44d: 0x0818, 0x44e: 0x0018, 0x44f: 0x0018, 0x450: 0x3308, 0x451: 0x3308, - 0x452: 0x3308, 0x453: 0x3308, 0x454: 0x3308, 0x455: 0x3308, 0x456: 0x3308, 0x457: 0x3308, - 0x458: 0x3308, 0x459: 0x3308, 0x45a: 0x3308, 0x45b: 0x0818, 0x45c: 0x0b40, 0x45d: 0x0040, - 0x45e: 0x0818, 0x45f: 0x0818, 0x460: 0x0a08, 0x461: 0x0808, 0x462: 0x0c08, 0x463: 0x0c08, - 0x464: 0x0c08, 0x465: 0x0c08, 0x466: 0x0a08, 0x467: 0x0c08, 0x468: 0x0a08, 0x469: 0x0c08, - 0x46a: 0x0a08, 0x46b: 0x0a08, 0x46c: 0x0a08, 0x46d: 0x0a08, 0x46e: 0x0a08, 0x46f: 0x0c08, - 0x470: 0x0c08, 0x471: 0x0c08, 0x472: 0x0c08, 0x473: 0x0a08, 0x474: 0x0a08, 0x475: 0x0a08, - 0x476: 0x0a08, 0x477: 0x0a08, 0x478: 0x0a08, 0x479: 0x0a08, 0x47a: 0x0a08, 0x47b: 0x0a08, - 0x47c: 0x0a08, 0x47d: 0x0a08, 0x47e: 0x0a08, 0x47f: 0x0a08, - // Block 0x12, offset 0x480 - 0x480: 0x0818, 0x481: 0x0a08, 0x482: 0x0a08, 0x483: 0x0a08, 0x484: 0x0a08, 0x485: 0x0a08, - 0x486: 0x0a08, 0x487: 0x0a08, 0x488: 0x0c08, 0x489: 0x0a08, 0x48a: 0x0a08, 0x48b: 0x3308, - 0x48c: 0x3308, 0x48d: 0x3308, 0x48e: 0x3308, 0x48f: 0x3308, 0x490: 0x3308, 0x491: 0x3308, - 0x492: 0x3308, 0x493: 0x3308, 0x494: 0x3308, 0x495: 0x3308, 0x496: 0x3308, 0x497: 0x3308, - 0x498: 0x3308, 0x499: 0x3308, 0x49a: 0x3308, 0x49b: 0x3308, 0x49c: 0x3308, 0x49d: 0x3308, - 0x49e: 0x3308, 0x49f: 0x3308, 0x4a0: 0x0808, 0x4a1: 0x0808, 0x4a2: 0x0808, 0x4a3: 0x0808, - 0x4a4: 0x0808, 0x4a5: 0x0808, 0x4a6: 0x0808, 0x4a7: 0x0808, 0x4a8: 0x0808, 0x4a9: 0x0808, - 0x4aa: 0x0018, 0x4ab: 0x0818, 0x4ac: 0x0818, 0x4ad: 0x0818, 0x4ae: 0x0a08, 0x4af: 0x0a08, - 0x4b0: 0x3308, 0x4b1: 0x0c08, 0x4b2: 0x0c08, 0x4b3: 0x0c08, 0x4b4: 0x0808, 0x4b5: 0x0429, - 0x4b6: 0x0451, 0x4b7: 0x0479, 0x4b8: 0x04a1, 0x4b9: 0x0a08, 0x4ba: 0x0a08, 0x4bb: 0x0a08, - 0x4bc: 0x0a08, 0x4bd: 0x0a08, 0x4be: 0x0a08, 0x4bf: 0x0a08, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x0c08, 0x4c1: 0x0a08, 0x4c2: 0x0a08, 0x4c3: 0x0c08, 0x4c4: 0x0c08, 0x4c5: 0x0c08, - 0x4c6: 0x0c08, 0x4c7: 0x0c08, 0x4c8: 0x0c08, 0x4c9: 0x0c08, 0x4ca: 0x0c08, 0x4cb: 0x0c08, - 0x4cc: 0x0a08, 0x4cd: 0x0c08, 0x4ce: 0x0a08, 0x4cf: 0x0c08, 0x4d0: 0x0a08, 0x4d1: 0x0a08, - 0x4d2: 0x0c08, 0x4d3: 0x0c08, 0x4d4: 0x0818, 0x4d5: 0x0c08, 0x4d6: 0x3308, 0x4d7: 0x3308, - 0x4d8: 0x3308, 0x4d9: 0x3308, 0x4da: 0x3308, 0x4db: 0x3308, 0x4dc: 0x3308, 0x4dd: 0x0840, - 0x4de: 0x0018, 0x4df: 0x3308, 0x4e0: 0x3308, 0x4e1: 0x3308, 0x4e2: 0x3308, 0x4e3: 0x3308, - 0x4e4: 0x3308, 0x4e5: 0x0808, 0x4e6: 0x0808, 0x4e7: 0x3308, 0x4e8: 0x3308, 0x4e9: 0x0018, - 0x4ea: 0x3308, 0x4eb: 0x3308, 0x4ec: 0x3308, 0x4ed: 0x3308, 0x4ee: 0x0c08, 0x4ef: 0x0c08, - 0x4f0: 0x0008, 0x4f1: 0x0008, 0x4f2: 0x0008, 0x4f3: 0x0008, 0x4f4: 0x0008, 0x4f5: 0x0008, - 0x4f6: 0x0008, 0x4f7: 0x0008, 0x4f8: 0x0008, 0x4f9: 0x0008, 0x4fa: 0x0a08, 0x4fb: 0x0a08, - 0x4fc: 0x0a08, 0x4fd: 0x0808, 0x4fe: 0x0808, 0x4ff: 0x0a08, - // Block 0x14, offset 0x500 - 0x500: 0x0818, 0x501: 0x0818, 0x502: 0x0818, 0x503: 0x0818, 0x504: 0x0818, 0x505: 0x0818, - 0x506: 0x0818, 0x507: 0x0818, 0x508: 0x0818, 0x509: 0x0818, 0x50a: 0x0818, 0x50b: 0x0818, - 0x50c: 0x0818, 0x50d: 0x0818, 0x50e: 0x0040, 0x50f: 0x0b40, 0x510: 0x0c08, 0x511: 0x3308, - 0x512: 0x0a08, 0x513: 0x0a08, 0x514: 0x0a08, 0x515: 0x0c08, 0x516: 0x0c08, 0x517: 0x0c08, - 0x518: 0x0c08, 0x519: 0x0c08, 0x51a: 0x0a08, 0x51b: 0x0a08, 0x51c: 0x0a08, 0x51d: 0x0a08, - 0x51e: 0x0c08, 0x51f: 0x0a08, 0x520: 0x0a08, 0x521: 0x0a08, 0x522: 0x0a08, 0x523: 0x0a08, - 0x524: 0x0a08, 0x525: 0x0a08, 0x526: 0x0a08, 0x527: 0x0a08, 0x528: 0x0c08, 0x529: 0x0a08, - 0x52a: 0x0c08, 0x52b: 0x0a08, 0x52c: 0x0c08, 0x52d: 0x0a08, 0x52e: 0x0a08, 0x52f: 0x0c08, - 0x530: 0x3308, 0x531: 0x3308, 0x532: 0x3308, 0x533: 0x3308, 0x534: 0x3308, 0x535: 0x3308, - 0x536: 0x3308, 0x537: 0x3308, 0x538: 0x3308, 0x539: 0x3308, 0x53a: 0x3308, 0x53b: 0x3308, - 0x53c: 0x3308, 0x53d: 0x3308, 0x53e: 0x3308, 0x53f: 0x3308, - // Block 0x15, offset 0x540 - 0x540: 0x0c08, 0x541: 0x0a08, 0x542: 0x0a08, 0x543: 0x0a08, 0x544: 0x0a08, 0x545: 0x0a08, - 0x546: 0x0c08, 0x547: 0x0c08, 0x548: 0x0a08, 0x549: 0x0c08, 0x54a: 0x0a08, 0x54b: 0x0a08, - 0x54c: 0x0a08, 0x54d: 0x0a08, 0x54e: 0x0a08, 0x54f: 0x0a08, 0x550: 0x0a08, 0x551: 0x0a08, - 0x552: 0x0a08, 0x553: 0x0a08, 0x554: 0x0c08, 0x555: 0x0a08, 0x556: 0x0808, 0x557: 0x0808, - 0x558: 0x0808, 0x559: 0x3308, 0x55a: 0x3308, 0x55b: 0x3308, 0x55c: 0x0040, 0x55d: 0x0040, - 0x55e: 0x0818, 0x55f: 0x0040, 0x560: 0x0a08, 0x561: 0x0808, 0x562: 0x0a08, 0x563: 0x0a08, - 0x564: 0x0a08, 0x565: 0x0a08, 0x566: 0x0808, 0x567: 0x0c08, 0x568: 0x0a08, 0x569: 0x0c08, - 0x56a: 0x0c08, 0x56b: 0x0040, 0x56c: 0x0040, 0x56d: 0x0040, 0x56e: 0x0040, 0x56f: 0x0040, - 0x570: 0x0040, 0x571: 0x0040, 0x572: 0x0040, 0x573: 0x0040, 0x574: 0x0040, 0x575: 0x0040, - 0x576: 0x0040, 0x577: 0x0040, 0x578: 0x0040, 0x579: 0x0040, 0x57a: 0x0040, 0x57b: 0x0040, - 0x57c: 0x0040, 0x57d: 0x0040, 0x57e: 0x0040, 0x57f: 0x0040, - // Block 0x16, offset 0x580 - 0x580: 0x3008, 0x581: 0x3308, 0x582: 0x3308, 0x583: 0x3308, 0x584: 0x3308, 0x585: 0x3308, - 0x586: 0x3308, 0x587: 0x3308, 0x588: 0x3308, 0x589: 0x3008, 0x58a: 0x3008, 0x58b: 0x3008, - 0x58c: 0x3008, 0x58d: 0x3b08, 0x58e: 0x3008, 0x58f: 0x3008, 0x590: 0x0008, 0x591: 0x3308, - 0x592: 0x3308, 0x593: 0x3308, 0x594: 0x3308, 0x595: 0x3308, 0x596: 0x3308, 0x597: 0x3308, - 0x598: 0x04c9, 0x599: 0x0501, 0x59a: 0x0539, 0x59b: 0x0571, 0x59c: 0x05a9, 0x59d: 0x05e1, - 0x59e: 0x0619, 0x59f: 0x0651, 0x5a0: 0x0008, 0x5a1: 0x0008, 0x5a2: 0x3308, 0x5a3: 0x3308, - 0x5a4: 0x0018, 0x5a5: 0x0018, 0x5a6: 0x0008, 0x5a7: 0x0008, 0x5a8: 0x0008, 0x5a9: 0x0008, - 0x5aa: 0x0008, 0x5ab: 0x0008, 0x5ac: 0x0008, 0x5ad: 0x0008, 0x5ae: 0x0008, 0x5af: 0x0008, - 0x5b0: 0x0018, 0x5b1: 0x0008, 0x5b2: 0x0008, 0x5b3: 0x0008, 0x5b4: 0x0008, 0x5b5: 0x0008, - 0x5b6: 0x0008, 0x5b7: 0x0008, 0x5b8: 0x0008, 0x5b9: 0x0008, 0x5ba: 0x0008, 0x5bb: 0x0008, - 0x5bc: 0x0008, 0x5bd: 0x0008, 0x5be: 0x0008, 0x5bf: 0x0008, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x0008, 0x5c1: 0x3308, 0x5c2: 0x3008, 0x5c3: 0x3008, 0x5c4: 0x0040, 0x5c5: 0x0008, - 0x5c6: 0x0008, 0x5c7: 0x0008, 0x5c8: 0x0008, 0x5c9: 0x0008, 0x5ca: 0x0008, 0x5cb: 0x0008, - 0x5cc: 0x0008, 0x5cd: 0x0040, 0x5ce: 0x0040, 0x5cf: 0x0008, 0x5d0: 0x0008, 0x5d1: 0x0040, - 0x5d2: 0x0040, 0x5d3: 0x0008, 0x5d4: 0x0008, 0x5d5: 0x0008, 0x5d6: 0x0008, 0x5d7: 0x0008, - 0x5d8: 0x0008, 0x5d9: 0x0008, 0x5da: 0x0008, 0x5db: 0x0008, 0x5dc: 0x0008, 0x5dd: 0x0008, - 0x5de: 0x0008, 0x5df: 0x0008, 0x5e0: 0x0008, 0x5e1: 0x0008, 0x5e2: 0x0008, 0x5e3: 0x0008, - 0x5e4: 0x0008, 0x5e5: 0x0008, 0x5e6: 0x0008, 0x5e7: 0x0008, 0x5e8: 0x0008, 0x5e9: 0x0040, - 0x5ea: 0x0008, 0x5eb: 0x0008, 0x5ec: 0x0008, 0x5ed: 0x0008, 0x5ee: 0x0008, 0x5ef: 0x0008, - 0x5f0: 0x0008, 0x5f1: 0x0040, 0x5f2: 0x0008, 0x5f3: 0x0040, 0x5f4: 0x0040, 0x5f5: 0x0040, - 0x5f6: 0x0008, 0x5f7: 0x0008, 0x5f8: 0x0008, 0x5f9: 0x0008, 0x5fa: 0x0040, 0x5fb: 0x0040, - 0x5fc: 0x3308, 0x5fd: 0x0008, 0x5fe: 0x3008, 0x5ff: 0x3008, - // Block 0x18, offset 0x600 - 0x600: 0x3008, 0x601: 0x3308, 0x602: 0x3308, 0x603: 0x3308, 0x604: 0x3308, 0x605: 0x0040, - 0x606: 0x0040, 0x607: 0x3008, 0x608: 0x3008, 0x609: 0x0040, 0x60a: 0x0040, 0x60b: 0x3008, - 0x60c: 0x3008, 0x60d: 0x3b08, 0x60e: 0x0008, 0x60f: 0x0040, 0x610: 0x0040, 0x611: 0x0040, - 0x612: 0x0040, 0x613: 0x0040, 0x614: 0x0040, 0x615: 0x0040, 0x616: 0x0040, 0x617: 0x3008, - 0x618: 0x0040, 0x619: 0x0040, 0x61a: 0x0040, 0x61b: 0x0040, 0x61c: 0x0689, 0x61d: 0x06c1, - 0x61e: 0x0040, 0x61f: 0x06f9, 0x620: 0x0008, 0x621: 0x0008, 0x622: 0x3308, 0x623: 0x3308, - 0x624: 0x0040, 0x625: 0x0040, 0x626: 0x0008, 0x627: 0x0008, 0x628: 0x0008, 0x629: 0x0008, - 0x62a: 0x0008, 0x62b: 0x0008, 0x62c: 0x0008, 0x62d: 0x0008, 0x62e: 0x0008, 0x62f: 0x0008, - 0x630: 0x0008, 0x631: 0x0008, 0x632: 0x0018, 0x633: 0x0018, 0x634: 0x0018, 0x635: 0x0018, - 0x636: 0x0018, 0x637: 0x0018, 0x638: 0x0018, 0x639: 0x0018, 0x63a: 0x0018, 0x63b: 0x0018, - 0x63c: 0x0008, 0x63d: 0x0018, 0x63e: 0x0040, 0x63f: 0x0040, - // Block 0x19, offset 0x640 - 0x640: 0x0040, 0x641: 0x3308, 0x642: 0x3308, 0x643: 0x3008, 0x644: 0x0040, 0x645: 0x0008, - 0x646: 0x0008, 0x647: 0x0008, 0x648: 0x0008, 0x649: 0x0008, 0x64a: 0x0008, 0x64b: 0x0040, - 0x64c: 0x0040, 0x64d: 0x0040, 0x64e: 0x0040, 0x64f: 0x0008, 0x650: 0x0008, 0x651: 0x0040, - 0x652: 0x0040, 0x653: 0x0008, 0x654: 0x0008, 0x655: 0x0008, 0x656: 0x0008, 0x657: 0x0008, - 0x658: 0x0008, 0x659: 0x0008, 0x65a: 0x0008, 0x65b: 0x0008, 0x65c: 0x0008, 0x65d: 0x0008, - 0x65e: 0x0008, 0x65f: 0x0008, 0x660: 0x0008, 0x661: 0x0008, 0x662: 0x0008, 0x663: 0x0008, - 0x664: 0x0008, 0x665: 0x0008, 0x666: 0x0008, 0x667: 0x0008, 0x668: 0x0008, 0x669: 0x0040, - 0x66a: 0x0008, 0x66b: 0x0008, 0x66c: 0x0008, 0x66d: 0x0008, 0x66e: 0x0008, 0x66f: 0x0008, - 0x670: 0x0008, 0x671: 0x0040, 0x672: 0x0008, 0x673: 0x0731, 0x674: 0x0040, 0x675: 0x0008, - 0x676: 0x0769, 0x677: 0x0040, 0x678: 0x0008, 0x679: 0x0008, 0x67a: 0x0040, 0x67b: 0x0040, - 0x67c: 0x3308, 0x67d: 0x0040, 0x67e: 0x3008, 0x67f: 0x3008, - // Block 0x1a, offset 0x680 - 0x680: 0x3008, 0x681: 0x3308, 0x682: 0x3308, 0x683: 0x0040, 0x684: 0x0040, 0x685: 0x0040, - 0x686: 0x0040, 0x687: 0x3308, 0x688: 0x3308, 0x689: 0x0040, 0x68a: 0x0040, 0x68b: 0x3308, - 0x68c: 0x3308, 0x68d: 0x3b08, 0x68e: 0x0040, 0x68f: 0x0040, 0x690: 0x0040, 0x691: 0x3308, - 0x692: 0x0040, 0x693: 0x0040, 0x694: 0x0040, 0x695: 0x0040, 0x696: 0x0040, 0x697: 0x0040, - 0x698: 0x0040, 0x699: 0x07a1, 0x69a: 0x07d9, 0x69b: 0x0811, 0x69c: 0x0008, 0x69d: 0x0040, - 0x69e: 0x0849, 0x69f: 0x0040, 0x6a0: 0x0040, 0x6a1: 0x0040, 0x6a2: 0x0040, 0x6a3: 0x0040, - 0x6a4: 0x0040, 0x6a5: 0x0040, 0x6a6: 0x0008, 0x6a7: 0x0008, 0x6a8: 0x0008, 0x6a9: 0x0008, - 0x6aa: 0x0008, 0x6ab: 0x0008, 0x6ac: 0x0008, 0x6ad: 0x0008, 0x6ae: 0x0008, 0x6af: 0x0008, - 0x6b0: 0x3308, 0x6b1: 0x3308, 0x6b2: 0x0008, 0x6b3: 0x0008, 0x6b4: 0x0008, 0x6b5: 0x3308, - 0x6b6: 0x0040, 0x6b7: 0x0040, 0x6b8: 0x0040, 0x6b9: 0x0040, 0x6ba: 0x0040, 0x6bb: 0x0040, - 0x6bc: 0x0040, 0x6bd: 0x0040, 0x6be: 0x0040, 0x6bf: 0x0040, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x0040, 0x6c1: 0x3308, 0x6c2: 0x3308, 0x6c3: 0x3008, 0x6c4: 0x0040, 0x6c5: 0x0008, - 0x6c6: 0x0008, 0x6c7: 0x0008, 0x6c8: 0x0008, 0x6c9: 0x0008, 0x6ca: 0x0008, 0x6cb: 0x0008, - 0x6cc: 0x0008, 0x6cd: 0x0008, 0x6ce: 0x0040, 0x6cf: 0x0008, 0x6d0: 0x0008, 0x6d1: 0x0008, - 0x6d2: 0x0040, 0x6d3: 0x0008, 0x6d4: 0x0008, 0x6d5: 0x0008, 0x6d6: 0x0008, 0x6d7: 0x0008, - 0x6d8: 0x0008, 0x6d9: 0x0008, 0x6da: 0x0008, 0x6db: 0x0008, 0x6dc: 0x0008, 0x6dd: 0x0008, - 0x6de: 0x0008, 0x6df: 0x0008, 0x6e0: 0x0008, 0x6e1: 0x0008, 0x6e2: 0x0008, 0x6e3: 0x0008, - 0x6e4: 0x0008, 0x6e5: 0x0008, 0x6e6: 0x0008, 0x6e7: 0x0008, 0x6e8: 0x0008, 0x6e9: 0x0040, - 0x6ea: 0x0008, 0x6eb: 0x0008, 0x6ec: 0x0008, 0x6ed: 0x0008, 0x6ee: 0x0008, 0x6ef: 0x0008, - 0x6f0: 0x0008, 0x6f1: 0x0040, 0x6f2: 0x0008, 0x6f3: 0x0008, 0x6f4: 0x0040, 0x6f5: 0x0008, - 0x6f6: 0x0008, 0x6f7: 0x0008, 0x6f8: 0x0008, 0x6f9: 0x0008, 0x6fa: 0x0040, 0x6fb: 0x0040, - 0x6fc: 0x3308, 0x6fd: 0x0008, 0x6fe: 0x3008, 0x6ff: 0x3008, - // Block 0x1c, offset 0x700 - 0x700: 0x3008, 0x701: 0x3308, 0x702: 0x3308, 0x703: 0x3308, 0x704: 0x3308, 0x705: 0x3308, - 0x706: 0x0040, 0x707: 0x3308, 0x708: 0x3308, 0x709: 0x3008, 0x70a: 0x0040, 0x70b: 0x3008, - 0x70c: 0x3008, 0x70d: 0x3b08, 0x70e: 0x0040, 0x70f: 0x0040, 0x710: 0x0008, 0x711: 0x0040, - 0x712: 0x0040, 0x713: 0x0040, 0x714: 0x0040, 0x715: 0x0040, 0x716: 0x0040, 0x717: 0x0040, - 0x718: 0x0040, 0x719: 0x0040, 0x71a: 0x0040, 0x71b: 0x0040, 0x71c: 0x0040, 0x71d: 0x0040, - 0x71e: 0x0040, 0x71f: 0x0040, 0x720: 0x0008, 0x721: 0x0008, 0x722: 0x3308, 0x723: 0x3308, - 0x724: 0x0040, 0x725: 0x0040, 0x726: 0x0008, 0x727: 0x0008, 0x728: 0x0008, 0x729: 0x0008, - 0x72a: 0x0008, 0x72b: 0x0008, 0x72c: 0x0008, 0x72d: 0x0008, 0x72e: 0x0008, 0x72f: 0x0008, - 0x730: 0x0018, 0x731: 0x0018, 0x732: 0x0040, 0x733: 0x0040, 0x734: 0x0040, 0x735: 0x0040, - 0x736: 0x0040, 0x737: 0x0040, 0x738: 0x0040, 0x739: 0x0008, 0x73a: 0x3308, 0x73b: 0x3308, - 0x73c: 0x3308, 0x73d: 0x3308, 0x73e: 0x3308, 0x73f: 0x3308, - // Block 0x1d, offset 0x740 - 0x740: 0x0040, 0x741: 0x3308, 0x742: 0x3008, 0x743: 0x3008, 0x744: 0x0040, 0x745: 0x0008, - 0x746: 0x0008, 0x747: 0x0008, 0x748: 0x0008, 0x749: 0x0008, 0x74a: 0x0008, 0x74b: 0x0008, - 0x74c: 0x0008, 0x74d: 0x0040, 0x74e: 0x0040, 0x74f: 0x0008, 0x750: 0x0008, 0x751: 0x0040, - 0x752: 0x0040, 0x753: 0x0008, 0x754: 0x0008, 0x755: 0x0008, 0x756: 0x0008, 0x757: 0x0008, - 0x758: 0x0008, 0x759: 0x0008, 0x75a: 0x0008, 0x75b: 0x0008, 0x75c: 0x0008, 0x75d: 0x0008, - 0x75e: 0x0008, 0x75f: 0x0008, 0x760: 0x0008, 0x761: 0x0008, 0x762: 0x0008, 0x763: 0x0008, - 0x764: 0x0008, 0x765: 0x0008, 0x766: 0x0008, 0x767: 0x0008, 0x768: 0x0008, 0x769: 0x0040, - 0x76a: 0x0008, 0x76b: 0x0008, 0x76c: 0x0008, 0x76d: 0x0008, 0x76e: 0x0008, 0x76f: 0x0008, - 0x770: 0x0008, 0x771: 0x0040, 0x772: 0x0008, 0x773: 0x0008, 0x774: 0x0040, 0x775: 0x0008, - 0x776: 0x0008, 0x777: 0x0008, 0x778: 0x0008, 0x779: 0x0008, 0x77a: 0x0040, 0x77b: 0x0040, - 0x77c: 0x3308, 0x77d: 0x0008, 0x77e: 0x3008, 0x77f: 0x3308, - // Block 0x1e, offset 0x780 - 0x780: 0x3008, 0x781: 0x3308, 0x782: 0x3308, 0x783: 0x3308, 0x784: 0x3308, 0x785: 0x0040, - 0x786: 0x0040, 0x787: 0x3008, 0x788: 0x3008, 0x789: 0x0040, 0x78a: 0x0040, 0x78b: 0x3008, - 0x78c: 0x3008, 0x78d: 0x3b08, 0x78e: 0x0040, 0x78f: 0x0040, 0x790: 0x0040, 0x791: 0x0040, - 0x792: 0x0040, 0x793: 0x0040, 0x794: 0x0040, 0x795: 0x0040, 0x796: 0x3308, 0x797: 0x3008, - 0x798: 0x0040, 0x799: 0x0040, 0x79a: 0x0040, 0x79b: 0x0040, 0x79c: 0x0881, 0x79d: 0x08b9, - 0x79e: 0x0040, 0x79f: 0x0008, 0x7a0: 0x0008, 0x7a1: 0x0008, 0x7a2: 0x3308, 0x7a3: 0x3308, - 0x7a4: 0x0040, 0x7a5: 0x0040, 0x7a6: 0x0008, 0x7a7: 0x0008, 0x7a8: 0x0008, 0x7a9: 0x0008, - 0x7aa: 0x0008, 0x7ab: 0x0008, 0x7ac: 0x0008, 0x7ad: 0x0008, 0x7ae: 0x0008, 0x7af: 0x0008, - 0x7b0: 0x0018, 0x7b1: 0x0008, 0x7b2: 0x0018, 0x7b3: 0x0018, 0x7b4: 0x0018, 0x7b5: 0x0018, - 0x7b6: 0x0018, 0x7b7: 0x0018, 0x7b8: 0x0040, 0x7b9: 0x0040, 0x7ba: 0x0040, 0x7bb: 0x0040, - 0x7bc: 0x0040, 0x7bd: 0x0040, 0x7be: 0x0040, 0x7bf: 0x0040, - // Block 0x1f, offset 0x7c0 - 0x7c0: 0x0040, 0x7c1: 0x0040, 0x7c2: 0x3308, 0x7c3: 0x0008, 0x7c4: 0x0040, 0x7c5: 0x0008, - 0x7c6: 0x0008, 0x7c7: 0x0008, 0x7c8: 0x0008, 0x7c9: 0x0008, 0x7ca: 0x0008, 0x7cb: 0x0040, - 0x7cc: 0x0040, 0x7cd: 0x0040, 0x7ce: 0x0008, 0x7cf: 0x0008, 0x7d0: 0x0008, 0x7d1: 0x0040, - 0x7d2: 0x0008, 0x7d3: 0x0008, 0x7d4: 0x0008, 0x7d5: 0x0008, 0x7d6: 0x0040, 0x7d7: 0x0040, - 0x7d8: 0x0040, 0x7d9: 0x0008, 0x7da: 0x0008, 0x7db: 0x0040, 0x7dc: 0x0008, 0x7dd: 0x0040, - 0x7de: 0x0008, 0x7df: 0x0008, 0x7e0: 0x0040, 0x7e1: 0x0040, 0x7e2: 0x0040, 0x7e3: 0x0008, - 0x7e4: 0x0008, 0x7e5: 0x0040, 0x7e6: 0x0040, 0x7e7: 0x0040, 0x7e8: 0x0008, 0x7e9: 0x0008, - 0x7ea: 0x0008, 0x7eb: 0x0040, 0x7ec: 0x0040, 0x7ed: 0x0040, 0x7ee: 0x0008, 0x7ef: 0x0008, - 0x7f0: 0x0008, 0x7f1: 0x0008, 0x7f2: 0x0008, 0x7f3: 0x0008, 0x7f4: 0x0008, 0x7f5: 0x0008, - 0x7f6: 0x0008, 0x7f7: 0x0008, 0x7f8: 0x0008, 0x7f9: 0x0008, 0x7fa: 0x0040, 0x7fb: 0x0040, - 0x7fc: 0x0040, 0x7fd: 0x0040, 0x7fe: 0x3008, 0x7ff: 0x3008, - // Block 0x20, offset 0x800 - 0x800: 0x3308, 0x801: 0x3008, 0x802: 0x3008, 0x803: 0x3008, 0x804: 0x3008, 0x805: 0x0040, - 0x806: 0x3308, 0x807: 0x3308, 0x808: 0x3308, 0x809: 0x0040, 0x80a: 0x3308, 0x80b: 0x3308, - 0x80c: 0x3308, 0x80d: 0x3b08, 0x80e: 0x0040, 0x80f: 0x0040, 0x810: 0x0040, 0x811: 0x0040, - 0x812: 0x0040, 0x813: 0x0040, 0x814: 0x0040, 0x815: 0x3308, 0x816: 0x3308, 0x817: 0x0040, - 0x818: 0x0008, 0x819: 0x0008, 0x81a: 0x0008, 0x81b: 0x0040, 0x81c: 0x0040, 0x81d: 0x0040, - 0x81e: 0x0040, 0x81f: 0x0040, 0x820: 0x0008, 0x821: 0x0008, 0x822: 0x3308, 0x823: 0x3308, - 0x824: 0x0040, 0x825: 0x0040, 0x826: 0x0008, 0x827: 0x0008, 0x828: 0x0008, 0x829: 0x0008, - 0x82a: 0x0008, 0x82b: 0x0008, 0x82c: 0x0008, 0x82d: 0x0008, 0x82e: 0x0008, 0x82f: 0x0008, - 0x830: 0x0040, 0x831: 0x0040, 0x832: 0x0040, 0x833: 0x0040, 0x834: 0x0040, 0x835: 0x0040, - 0x836: 0x0040, 0x837: 0x0040, 0x838: 0x0018, 0x839: 0x0018, 0x83a: 0x0018, 0x83b: 0x0018, - 0x83c: 0x0018, 0x83d: 0x0018, 0x83e: 0x0018, 0x83f: 0x0018, - // Block 0x21, offset 0x840 - 0x840: 0x0008, 0x841: 0x3308, 0x842: 0x3008, 0x843: 0x3008, 0x844: 0x0040, 0x845: 0x0008, - 0x846: 0x0008, 0x847: 0x0008, 0x848: 0x0008, 0x849: 0x0008, 0x84a: 0x0008, 0x84b: 0x0008, - 0x84c: 0x0008, 0x84d: 0x0040, 0x84e: 0x0008, 0x84f: 0x0008, 0x850: 0x0008, 0x851: 0x0040, - 0x852: 0x0008, 0x853: 0x0008, 0x854: 0x0008, 0x855: 0x0008, 0x856: 0x0008, 0x857: 0x0008, - 0x858: 0x0008, 0x859: 0x0008, 0x85a: 0x0008, 0x85b: 0x0008, 0x85c: 0x0008, 0x85d: 0x0008, - 0x85e: 0x0008, 0x85f: 0x0008, 0x860: 0x0008, 0x861: 0x0008, 0x862: 0x0008, 0x863: 0x0008, - 0x864: 0x0008, 0x865: 0x0008, 0x866: 0x0008, 0x867: 0x0008, 0x868: 0x0008, 0x869: 0x0040, - 0x86a: 0x0008, 0x86b: 0x0008, 0x86c: 0x0008, 0x86d: 0x0008, 0x86e: 0x0008, 0x86f: 0x0008, - 0x870: 0x0008, 0x871: 0x0008, 0x872: 0x0008, 0x873: 0x0008, 0x874: 0x0040, 0x875: 0x0008, - 0x876: 0x0008, 0x877: 0x0008, 0x878: 0x0008, 0x879: 0x0008, 0x87a: 0x0040, 0x87b: 0x0040, - 0x87c: 0x3308, 0x87d: 0x0008, 0x87e: 0x3008, 0x87f: 0x3308, - // Block 0x22, offset 0x880 - 0x880: 0x3008, 0x881: 0x3008, 0x882: 0x3008, 0x883: 0x3008, 0x884: 0x3008, 0x885: 0x0040, - 0x886: 0x3308, 0x887: 0x3008, 0x888: 0x3008, 0x889: 0x0040, 0x88a: 0x3008, 0x88b: 0x3008, - 0x88c: 0x3308, 0x88d: 0x3b08, 0x88e: 0x0040, 0x88f: 0x0040, 0x890: 0x0040, 0x891: 0x0040, - 0x892: 0x0040, 0x893: 0x0040, 0x894: 0x0040, 0x895: 0x3008, 0x896: 0x3008, 0x897: 0x0040, - 0x898: 0x0040, 0x899: 0x0040, 0x89a: 0x0040, 0x89b: 0x0040, 0x89c: 0x0040, 0x89d: 0x0040, - 0x89e: 0x0008, 0x89f: 0x0040, 0x8a0: 0x0008, 0x8a1: 0x0008, 0x8a2: 0x3308, 0x8a3: 0x3308, - 0x8a4: 0x0040, 0x8a5: 0x0040, 0x8a6: 0x0008, 0x8a7: 0x0008, 0x8a8: 0x0008, 0x8a9: 0x0008, - 0x8aa: 0x0008, 0x8ab: 0x0008, 0x8ac: 0x0008, 0x8ad: 0x0008, 0x8ae: 0x0008, 0x8af: 0x0008, - 0x8b0: 0x0040, 0x8b1: 0x0008, 0x8b2: 0x0008, 0x8b3: 0x0040, 0x8b4: 0x0040, 0x8b5: 0x0040, - 0x8b6: 0x0040, 0x8b7: 0x0040, 0x8b8: 0x0040, 0x8b9: 0x0040, 0x8ba: 0x0040, 0x8bb: 0x0040, - 0x8bc: 0x0040, 0x8bd: 0x0040, 0x8be: 0x0040, 0x8bf: 0x0040, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x3008, 0x8c1: 0x3308, 0x8c2: 0x3308, 0x8c3: 0x3308, 0x8c4: 0x3308, 0x8c5: 0x0040, - 0x8c6: 0x3008, 0x8c7: 0x3008, 0x8c8: 0x3008, 0x8c9: 0x0040, 0x8ca: 0x3008, 0x8cb: 0x3008, - 0x8cc: 0x3008, 0x8cd: 0x3b08, 0x8ce: 0x0008, 0x8cf: 0x0018, 0x8d0: 0x0040, 0x8d1: 0x0040, - 0x8d2: 0x0040, 0x8d3: 0x0040, 0x8d4: 0x0008, 0x8d5: 0x0008, 0x8d6: 0x0008, 0x8d7: 0x3008, - 0x8d8: 0x0018, 0x8d9: 0x0018, 0x8da: 0x0018, 0x8db: 0x0018, 0x8dc: 0x0018, 0x8dd: 0x0018, - 0x8de: 0x0018, 0x8df: 0x0008, 0x8e0: 0x0008, 0x8e1: 0x0008, 0x8e2: 0x3308, 0x8e3: 0x3308, - 0x8e4: 0x0040, 0x8e5: 0x0040, 0x8e6: 0x0008, 0x8e7: 0x0008, 0x8e8: 0x0008, 0x8e9: 0x0008, - 0x8ea: 0x0008, 0x8eb: 0x0008, 0x8ec: 0x0008, 0x8ed: 0x0008, 0x8ee: 0x0008, 0x8ef: 0x0008, - 0x8f0: 0x0018, 0x8f1: 0x0018, 0x8f2: 0x0018, 0x8f3: 0x0018, 0x8f4: 0x0018, 0x8f5: 0x0018, - 0x8f6: 0x0018, 0x8f7: 0x0018, 0x8f8: 0x0018, 0x8f9: 0x0018, 0x8fa: 0x0008, 0x8fb: 0x0008, - 0x8fc: 0x0008, 0x8fd: 0x0008, 0x8fe: 0x0008, 0x8ff: 0x0008, - // Block 0x24, offset 0x900 - 0x900: 0x0040, 0x901: 0x0008, 0x902: 0x0008, 0x903: 0x0040, 0x904: 0x0008, 0x905: 0x0040, - 0x906: 0x0040, 0x907: 0x0008, 0x908: 0x0008, 0x909: 0x0040, 0x90a: 0x0008, 0x90b: 0x0040, - 0x90c: 0x0040, 0x90d: 0x0008, 0x90e: 0x0040, 0x90f: 0x0040, 0x910: 0x0040, 0x911: 0x0040, - 0x912: 0x0040, 0x913: 0x0040, 0x914: 0x0008, 0x915: 0x0008, 0x916: 0x0008, 0x917: 0x0008, - 0x918: 0x0040, 0x919: 0x0008, 0x91a: 0x0008, 0x91b: 0x0008, 0x91c: 0x0008, 0x91d: 0x0008, - 0x91e: 0x0008, 0x91f: 0x0008, 0x920: 0x0040, 0x921: 0x0008, 0x922: 0x0008, 0x923: 0x0008, - 0x924: 0x0040, 0x925: 0x0008, 0x926: 0x0040, 0x927: 0x0008, 0x928: 0x0040, 0x929: 0x0040, - 0x92a: 0x0008, 0x92b: 0x0008, 0x92c: 0x0040, 0x92d: 0x0008, 0x92e: 0x0008, 0x92f: 0x0008, - 0x930: 0x0008, 0x931: 0x3308, 0x932: 0x0008, 0x933: 0x0929, 0x934: 0x3308, 0x935: 0x3308, - 0x936: 0x3308, 0x937: 0x3308, 0x938: 0x3308, 0x939: 0x3308, 0x93a: 0x0040, 0x93b: 0x3308, - 0x93c: 0x3308, 0x93d: 0x0008, 0x93e: 0x0040, 0x93f: 0x0040, - // Block 0x25, offset 0x940 - 0x940: 0x0008, 0x941: 0x0008, 0x942: 0x0008, 0x943: 0x09d1, 0x944: 0x0008, 0x945: 0x0008, - 0x946: 0x0008, 0x947: 0x0008, 0x948: 0x0040, 0x949: 0x0008, 0x94a: 0x0008, 0x94b: 0x0008, - 0x94c: 0x0008, 0x94d: 0x0a09, 0x94e: 0x0008, 0x94f: 0x0008, 0x950: 0x0008, 0x951: 0x0008, - 0x952: 0x0a41, 0x953: 0x0008, 0x954: 0x0008, 0x955: 0x0008, 0x956: 0x0008, 0x957: 0x0a79, - 0x958: 0x0008, 0x959: 0x0008, 0x95a: 0x0008, 0x95b: 0x0008, 0x95c: 0x0ab1, 0x95d: 0x0008, - 0x95e: 0x0008, 0x95f: 0x0008, 0x960: 0x0008, 0x961: 0x0008, 0x962: 0x0008, 0x963: 0x0008, - 0x964: 0x0008, 0x965: 0x0008, 0x966: 0x0008, 0x967: 0x0008, 0x968: 0x0008, 0x969: 0x0ae9, - 0x96a: 0x0008, 0x96b: 0x0008, 0x96c: 0x0008, 0x96d: 0x0040, 0x96e: 0x0040, 0x96f: 0x0040, - 0x970: 0x0040, 0x971: 0x3308, 0x972: 0x3308, 0x973: 0x0b21, 0x974: 0x3308, 0x975: 0x0b59, - 0x976: 0x0b91, 0x977: 0x0bc9, 0x978: 0x0c19, 0x979: 0x0c51, 0x97a: 0x3308, 0x97b: 0x3308, - 0x97c: 0x3308, 0x97d: 0x3308, 0x97e: 0x3308, 0x97f: 0x3008, - // Block 0x26, offset 0x980 - 0x980: 0x3308, 0x981: 0x0ca1, 0x982: 0x3308, 0x983: 0x3308, 0x984: 0x3b08, 0x985: 0x0018, - 0x986: 0x3308, 0x987: 0x3308, 0x988: 0x0008, 0x989: 0x0008, 0x98a: 0x0008, 0x98b: 0x0008, - 0x98c: 0x0008, 0x98d: 0x3308, 0x98e: 0x3308, 0x98f: 0x3308, 0x990: 0x3308, 0x991: 0x3308, - 0x992: 0x3308, 0x993: 0x0cd9, 0x994: 0x3308, 0x995: 0x3308, 0x996: 0x3308, 0x997: 0x3308, - 0x998: 0x0040, 0x999: 0x3308, 0x99a: 0x3308, 0x99b: 0x3308, 0x99c: 0x3308, 0x99d: 0x0d11, - 0x99e: 0x3308, 0x99f: 0x3308, 0x9a0: 0x3308, 0x9a1: 0x3308, 0x9a2: 0x0d49, 0x9a3: 0x3308, - 0x9a4: 0x3308, 0x9a5: 0x3308, 0x9a6: 0x3308, 0x9a7: 0x0d81, 0x9a8: 0x3308, 0x9a9: 0x3308, - 0x9aa: 0x3308, 0x9ab: 0x3308, 0x9ac: 0x0db9, 0x9ad: 0x3308, 0x9ae: 0x3308, 0x9af: 0x3308, - 0x9b0: 0x3308, 0x9b1: 0x3308, 0x9b2: 0x3308, 0x9b3: 0x3308, 0x9b4: 0x3308, 0x9b5: 0x3308, - 0x9b6: 0x3308, 0x9b7: 0x3308, 0x9b8: 0x3308, 0x9b9: 0x0df1, 0x9ba: 0x3308, 0x9bb: 0x3308, - 0x9bc: 0x3308, 0x9bd: 0x0040, 0x9be: 0x0018, 0x9bf: 0x0018, - // Block 0x27, offset 0x9c0 - 0x9c0: 0x0008, 0x9c1: 0x0008, 0x9c2: 0x0008, 0x9c3: 0x0008, 0x9c4: 0x0008, 0x9c5: 0x0008, - 0x9c6: 0x0008, 0x9c7: 0x0008, 0x9c8: 0x0008, 0x9c9: 0x0008, 0x9ca: 0x0008, 0x9cb: 0x0008, - 0x9cc: 0x0008, 0x9cd: 0x0008, 0x9ce: 0x0008, 0x9cf: 0x0008, 0x9d0: 0x0008, 0x9d1: 0x0008, - 0x9d2: 0x0008, 0x9d3: 0x0008, 0x9d4: 0x0008, 0x9d5: 0x0008, 0x9d6: 0x0008, 0x9d7: 0x0008, - 0x9d8: 0x0008, 0x9d9: 0x0008, 0x9da: 0x0008, 0x9db: 0x0008, 0x9dc: 0x0008, 0x9dd: 0x0008, - 0x9de: 0x0008, 0x9df: 0x0008, 0x9e0: 0x0008, 0x9e1: 0x0008, 0x9e2: 0x0008, 0x9e3: 0x0008, - 0x9e4: 0x0008, 0x9e5: 0x0008, 0x9e6: 0x0008, 0x9e7: 0x0008, 0x9e8: 0x0008, 0x9e9: 0x0008, - 0x9ea: 0x0008, 0x9eb: 0x0008, 0x9ec: 0x0039, 0x9ed: 0x0ed1, 0x9ee: 0x0ee9, 0x9ef: 0x0008, - 0x9f0: 0x0ef9, 0x9f1: 0x0f09, 0x9f2: 0x0f19, 0x9f3: 0x0f31, 0x9f4: 0x0249, 0x9f5: 0x0f41, - 0x9f6: 0x0259, 0x9f7: 0x0f51, 0x9f8: 0x0359, 0x9f9: 0x0f61, 0x9fa: 0x0f71, 0x9fb: 0x0008, - 0x9fc: 0x00d9, 0x9fd: 0x0f81, 0x9fe: 0x0f99, 0x9ff: 0x0269, - // Block 0x28, offset 0xa00 - 0xa00: 0x0fa9, 0xa01: 0x0fb9, 0xa02: 0x0279, 0xa03: 0x0039, 0xa04: 0x0fc9, 0xa05: 0x0fe1, - 0xa06: 0x059d, 0xa07: 0x0ee9, 0xa08: 0x0ef9, 0xa09: 0x0f09, 0xa0a: 0x0ff9, 0xa0b: 0x1011, - 0xa0c: 0x1029, 0xa0d: 0x0f31, 0xa0e: 0x0008, 0xa0f: 0x0f51, 0xa10: 0x0f61, 0xa11: 0x1041, - 0xa12: 0x00d9, 0xa13: 0x1059, 0xa14: 0x05b5, 0xa15: 0x05b5, 0xa16: 0x0f99, 0xa17: 0x0fa9, - 0xa18: 0x0fb9, 0xa19: 0x059d, 0xa1a: 0x1071, 0xa1b: 0x1089, 0xa1c: 0x05cd, 0xa1d: 0x1099, - 0xa1e: 0x10b1, 0xa1f: 0x10c9, 0xa20: 0x10e1, 0xa21: 0x10f9, 0xa22: 0x0f41, 0xa23: 0x0269, - 0xa24: 0x0fb9, 0xa25: 0x1089, 0xa26: 0x1099, 0xa27: 0x10b1, 0xa28: 0x1111, 0xa29: 0x10e1, - 0xa2a: 0x10f9, 0xa2b: 0x0008, 0xa2c: 0x0008, 0xa2d: 0x0008, 0xa2e: 0x0008, 0xa2f: 0x0008, - 0xa30: 0x0008, 0xa31: 0x0008, 0xa32: 0x0008, 0xa33: 0x0008, 0xa34: 0x0008, 0xa35: 0x0008, - 0xa36: 0x0008, 0xa37: 0x0008, 0xa38: 0x1129, 0xa39: 0x0008, 0xa3a: 0x0008, 0xa3b: 0x0008, - 0xa3c: 0x0008, 0xa3d: 0x0008, 0xa3e: 0x0008, 0xa3f: 0x0008, - // Block 0x29, offset 0xa40 - 0xa40: 0x0008, 0xa41: 0x0008, 0xa42: 0x0008, 0xa43: 0x0008, 0xa44: 0x0008, 0xa45: 0x0008, - 0xa46: 0x0008, 0xa47: 0x0008, 0xa48: 0x0008, 0xa49: 0x0008, 0xa4a: 0x0008, 0xa4b: 0x0008, - 0xa4c: 0x0008, 0xa4d: 0x0008, 0xa4e: 0x0008, 0xa4f: 0x0008, 0xa50: 0x0008, 0xa51: 0x0008, - 0xa52: 0x0008, 0xa53: 0x0008, 0xa54: 0x0008, 0xa55: 0x0008, 0xa56: 0x0008, 0xa57: 0x0008, - 0xa58: 0x0008, 0xa59: 0x0008, 0xa5a: 0x0008, 0xa5b: 0x1141, 0xa5c: 0x1159, 0xa5d: 0x1169, - 0xa5e: 0x1181, 0xa5f: 0x1029, 0xa60: 0x1199, 0xa61: 0x11a9, 0xa62: 0x11c1, 0xa63: 0x11d9, - 0xa64: 0x11f1, 0xa65: 0x1209, 0xa66: 0x1221, 0xa67: 0x05e5, 0xa68: 0x1239, 0xa69: 0x1251, - 0xa6a: 0xe17d, 0xa6b: 0x1269, 0xa6c: 0x1281, 0xa6d: 0x1299, 0xa6e: 0x12b1, 0xa6f: 0x12c9, - 0xa70: 0x12e1, 0xa71: 0x12f9, 0xa72: 0x1311, 0xa73: 0x1329, 0xa74: 0x1341, 0xa75: 0x1359, - 0xa76: 0x1371, 0xa77: 0x1389, 0xa78: 0x05fd, 0xa79: 0x13a1, 0xa7a: 0x13b9, 0xa7b: 0x13d1, - 0xa7c: 0x13e1, 0xa7d: 0x13f9, 0xa7e: 0x1411, 0xa7f: 0x1429, - // Block 0x2a, offset 0xa80 - 0xa80: 0xe00d, 0xa81: 0x0008, 0xa82: 0xe00d, 0xa83: 0x0008, 0xa84: 0xe00d, 0xa85: 0x0008, - 0xa86: 0xe00d, 0xa87: 0x0008, 0xa88: 0xe00d, 0xa89: 0x0008, 0xa8a: 0xe00d, 0xa8b: 0x0008, - 0xa8c: 0xe00d, 0xa8d: 0x0008, 0xa8e: 0xe00d, 0xa8f: 0x0008, 0xa90: 0xe00d, 0xa91: 0x0008, - 0xa92: 0xe00d, 0xa93: 0x0008, 0xa94: 0xe00d, 0xa95: 0x0008, 0xa96: 0xe00d, 0xa97: 0x0008, - 0xa98: 0xe00d, 0xa99: 0x0008, 0xa9a: 0xe00d, 0xa9b: 0x0008, 0xa9c: 0xe00d, 0xa9d: 0x0008, - 0xa9e: 0xe00d, 0xa9f: 0x0008, 0xaa0: 0xe00d, 0xaa1: 0x0008, 0xaa2: 0xe00d, 0xaa3: 0x0008, - 0xaa4: 0xe00d, 0xaa5: 0x0008, 0xaa6: 0xe00d, 0xaa7: 0x0008, 0xaa8: 0xe00d, 0xaa9: 0x0008, - 0xaaa: 0xe00d, 0xaab: 0x0008, 0xaac: 0xe00d, 0xaad: 0x0008, 0xaae: 0xe00d, 0xaaf: 0x0008, - 0xab0: 0xe00d, 0xab1: 0x0008, 0xab2: 0xe00d, 0xab3: 0x0008, 0xab4: 0xe00d, 0xab5: 0x0008, - 0xab6: 0xe00d, 0xab7: 0x0008, 0xab8: 0xe00d, 0xab9: 0x0008, 0xaba: 0xe00d, 0xabb: 0x0008, - 0xabc: 0xe00d, 0xabd: 0x0008, 0xabe: 0xe00d, 0xabf: 0x0008, - // Block 0x2b, offset 0xac0 - 0xac0: 0xe00d, 0xac1: 0x0008, 0xac2: 0xe00d, 0xac3: 0x0008, 0xac4: 0xe00d, 0xac5: 0x0008, - 0xac6: 0xe00d, 0xac7: 0x0008, 0xac8: 0xe00d, 0xac9: 0x0008, 0xaca: 0xe00d, 0xacb: 0x0008, - 0xacc: 0xe00d, 0xacd: 0x0008, 0xace: 0xe00d, 0xacf: 0x0008, 0xad0: 0xe00d, 0xad1: 0x0008, - 0xad2: 0xe00d, 0xad3: 0x0008, 0xad4: 0xe00d, 0xad5: 0x0008, 0xad6: 0x0008, 0xad7: 0x0008, - 0xad8: 0x0008, 0xad9: 0x0008, 0xada: 0x0615, 0xadb: 0x0635, 0xadc: 0x0008, 0xadd: 0x0008, - 0xade: 0x1441, 0xadf: 0x0008, 0xae0: 0xe00d, 0xae1: 0x0008, 0xae2: 0xe00d, 0xae3: 0x0008, - 0xae4: 0xe00d, 0xae5: 0x0008, 0xae6: 0xe00d, 0xae7: 0x0008, 0xae8: 0xe00d, 0xae9: 0x0008, - 0xaea: 0xe00d, 0xaeb: 0x0008, 0xaec: 0xe00d, 0xaed: 0x0008, 0xaee: 0xe00d, 0xaef: 0x0008, - 0xaf0: 0xe00d, 0xaf1: 0x0008, 0xaf2: 0xe00d, 0xaf3: 0x0008, 0xaf4: 0xe00d, 0xaf5: 0x0008, - 0xaf6: 0xe00d, 0xaf7: 0x0008, 0xaf8: 0xe00d, 0xaf9: 0x0008, 0xafa: 0xe00d, 0xafb: 0x0008, - 0xafc: 0xe00d, 0xafd: 0x0008, 0xafe: 0xe00d, 0xaff: 0x0008, - // Block 0x2c, offset 0xb00 - 0xb00: 0x0008, 0xb01: 0x0008, 0xb02: 0x0008, 0xb03: 0x0008, 0xb04: 0x0008, 0xb05: 0x0008, - 0xb06: 0x0040, 0xb07: 0x0040, 0xb08: 0xe045, 0xb09: 0xe045, 0xb0a: 0xe045, 0xb0b: 0xe045, - 0xb0c: 0xe045, 0xb0d: 0xe045, 0xb0e: 0x0040, 0xb0f: 0x0040, 0xb10: 0x0008, 0xb11: 0x0008, - 0xb12: 0x0008, 0xb13: 0x0008, 0xb14: 0x0008, 0xb15: 0x0008, 0xb16: 0x0008, 0xb17: 0x0008, - 0xb18: 0x0040, 0xb19: 0xe045, 0xb1a: 0x0040, 0xb1b: 0xe045, 0xb1c: 0x0040, 0xb1d: 0xe045, - 0xb1e: 0x0040, 0xb1f: 0xe045, 0xb20: 0x0008, 0xb21: 0x0008, 0xb22: 0x0008, 0xb23: 0x0008, - 0xb24: 0x0008, 0xb25: 0x0008, 0xb26: 0x0008, 0xb27: 0x0008, 0xb28: 0xe045, 0xb29: 0xe045, - 0xb2a: 0xe045, 0xb2b: 0xe045, 0xb2c: 0xe045, 0xb2d: 0xe045, 0xb2e: 0xe045, 0xb2f: 0xe045, - 0xb30: 0x0008, 0xb31: 0x1459, 0xb32: 0x0008, 0xb33: 0x1471, 0xb34: 0x0008, 0xb35: 0x1489, - 0xb36: 0x0008, 0xb37: 0x14a1, 0xb38: 0x0008, 0xb39: 0x14b9, 0xb3a: 0x0008, 0xb3b: 0x14d1, - 0xb3c: 0x0008, 0xb3d: 0x14e9, 0xb3e: 0x0040, 0xb3f: 0x0040, - // Block 0x2d, offset 0xb40 - 0xb40: 0x1501, 0xb41: 0x1531, 0xb42: 0x1561, 0xb43: 0x1591, 0xb44: 0x15c1, 0xb45: 0x15f1, - 0xb46: 0x1621, 0xb47: 0x1651, 0xb48: 0x1501, 0xb49: 0x1531, 0xb4a: 0x1561, 0xb4b: 0x1591, - 0xb4c: 0x15c1, 0xb4d: 0x15f1, 0xb4e: 0x1621, 0xb4f: 0x1651, 0xb50: 0x1681, 0xb51: 0x16b1, - 0xb52: 0x16e1, 0xb53: 0x1711, 0xb54: 0x1741, 0xb55: 0x1771, 0xb56: 0x17a1, 0xb57: 0x17d1, - 0xb58: 0x1681, 0xb59: 0x16b1, 0xb5a: 0x16e1, 0xb5b: 0x1711, 0xb5c: 0x1741, 0xb5d: 0x1771, - 0xb5e: 0x17a1, 0xb5f: 0x17d1, 0xb60: 0x1801, 0xb61: 0x1831, 0xb62: 0x1861, 0xb63: 0x1891, - 0xb64: 0x18c1, 0xb65: 0x18f1, 0xb66: 0x1921, 0xb67: 0x1951, 0xb68: 0x1801, 0xb69: 0x1831, - 0xb6a: 0x1861, 0xb6b: 0x1891, 0xb6c: 0x18c1, 0xb6d: 0x18f1, 0xb6e: 0x1921, 0xb6f: 0x1951, - 0xb70: 0x0008, 0xb71: 0x0008, 0xb72: 0x1981, 0xb73: 0x19b1, 0xb74: 0x19d9, 0xb75: 0x0040, - 0xb76: 0x0008, 0xb77: 0x1a01, 0xb78: 0xe045, 0xb79: 0xe045, 0xb7a: 0x064d, 0xb7b: 0x1459, - 0xb7c: 0x19b1, 0xb7d: 0x0666, 0xb7e: 0x1a31, 0xb7f: 0x0686, - // Block 0x2e, offset 0xb80 - 0xb80: 0x06a6, 0xb81: 0x1a4a, 0xb82: 0x1a79, 0xb83: 0x1aa9, 0xb84: 0x1ad1, 0xb85: 0x0040, - 0xb86: 0x0008, 0xb87: 0x1af9, 0xb88: 0x06c5, 0xb89: 0x1471, 0xb8a: 0x06dd, 0xb8b: 0x1489, - 0xb8c: 0x1aa9, 0xb8d: 0x1b2a, 0xb8e: 0x1b5a, 0xb8f: 0x1b8a, 0xb90: 0x0008, 0xb91: 0x0008, - 0xb92: 0x0008, 0xb93: 0x1bb9, 0xb94: 0x0040, 0xb95: 0x0040, 0xb96: 0x0008, 0xb97: 0x0008, - 0xb98: 0xe045, 0xb99: 0xe045, 0xb9a: 0x06f5, 0xb9b: 0x14a1, 0xb9c: 0x0040, 0xb9d: 0x1bd2, - 0xb9e: 0x1c02, 0xb9f: 0x1c32, 0xba0: 0x0008, 0xba1: 0x0008, 0xba2: 0x0008, 0xba3: 0x1c61, - 0xba4: 0x0008, 0xba5: 0x0008, 0xba6: 0x0008, 0xba7: 0x0008, 0xba8: 0xe045, 0xba9: 0xe045, - 0xbaa: 0x070d, 0xbab: 0x14d1, 0xbac: 0xe04d, 0xbad: 0x1c7a, 0xbae: 0x03d2, 0xbaf: 0x1caa, - 0xbb0: 0x0040, 0xbb1: 0x0040, 0xbb2: 0x1cb9, 0xbb3: 0x1ce9, 0xbb4: 0x1d11, 0xbb5: 0x0040, - 0xbb6: 0x0008, 0xbb7: 0x1d39, 0xbb8: 0x0725, 0xbb9: 0x14b9, 0xbba: 0x0515, 0xbbb: 0x14e9, - 0xbbc: 0x1ce9, 0xbbd: 0x073e, 0xbbe: 0x075e, 0xbbf: 0x0040, - // Block 0x2f, offset 0xbc0 - 0xbc0: 0x000a, 0xbc1: 0x000a, 0xbc2: 0x000a, 0xbc3: 0x000a, 0xbc4: 0x000a, 0xbc5: 0x000a, - 0xbc6: 0x000a, 0xbc7: 0x000a, 0xbc8: 0x000a, 0xbc9: 0x000a, 0xbca: 0x000a, 0xbcb: 0x03c0, - 0xbcc: 0x0003, 0xbcd: 0x0003, 0xbce: 0x0340, 0xbcf: 0x0b40, 0xbd0: 0x0018, 0xbd1: 0xe00d, - 0xbd2: 0x0018, 0xbd3: 0x0018, 0xbd4: 0x0018, 0xbd5: 0x0018, 0xbd6: 0x0018, 0xbd7: 0x077e, - 0xbd8: 0x0018, 0xbd9: 0x0018, 0xbda: 0x0018, 0xbdb: 0x0018, 0xbdc: 0x0018, 0xbdd: 0x0018, - 0xbde: 0x0018, 0xbdf: 0x0018, 0xbe0: 0x0018, 0xbe1: 0x0018, 0xbe2: 0x0018, 0xbe3: 0x0018, - 0xbe4: 0x0040, 0xbe5: 0x0040, 0xbe6: 0x0040, 0xbe7: 0x0018, 0xbe8: 0x0040, 0xbe9: 0x0040, - 0xbea: 0x0340, 0xbeb: 0x0340, 0xbec: 0x0340, 0xbed: 0x0340, 0xbee: 0x0340, 0xbef: 0x000a, - 0xbf0: 0x0018, 0xbf1: 0x0018, 0xbf2: 0x0018, 0xbf3: 0x1d69, 0xbf4: 0x1da1, 0xbf5: 0x0018, - 0xbf6: 0x1df1, 0xbf7: 0x1e29, 0xbf8: 0x0018, 0xbf9: 0x0018, 0xbfa: 0x0018, 0xbfb: 0x0018, - 0xbfc: 0x1e7a, 0xbfd: 0x0018, 0xbfe: 0x079e, 0xbff: 0x0018, - // Block 0x30, offset 0xc00 - 0xc00: 0x0018, 0xc01: 0x0018, 0xc02: 0x0018, 0xc03: 0x0018, 0xc04: 0x0018, 0xc05: 0x0018, - 0xc06: 0x0018, 0xc07: 0x1e92, 0xc08: 0x1eaa, 0xc09: 0x1ec2, 0xc0a: 0x0018, 0xc0b: 0x0018, - 0xc0c: 0x0018, 0xc0d: 0x0018, 0xc0e: 0x0018, 0xc0f: 0x0018, 0xc10: 0x0018, 0xc11: 0x0018, - 0xc12: 0x0018, 0xc13: 0x0018, 0xc14: 0x0018, 0xc15: 0x0018, 0xc16: 0x0018, 0xc17: 0x1ed9, - 0xc18: 0x0018, 0xc19: 0x0018, 0xc1a: 0x0018, 0xc1b: 0x0018, 0xc1c: 0x0018, 0xc1d: 0x0018, - 0xc1e: 0x0018, 0xc1f: 0x000a, 0xc20: 0x03c0, 0xc21: 0x0340, 0xc22: 0x0340, 0xc23: 0x0340, - 0xc24: 0x03c0, 0xc25: 0x0040, 0xc26: 0x0040, 0xc27: 0x0040, 0xc28: 0x0040, 0xc29: 0x0040, - 0xc2a: 0x0340, 0xc2b: 0x0340, 0xc2c: 0x0340, 0xc2d: 0x0340, 0xc2e: 0x0340, 0xc2f: 0x0340, - 0xc30: 0x1f41, 0xc31: 0x0f41, 0xc32: 0x0040, 0xc33: 0x0040, 0xc34: 0x1f51, 0xc35: 0x1f61, - 0xc36: 0x1f71, 0xc37: 0x1f81, 0xc38: 0x1f91, 0xc39: 0x1fa1, 0xc3a: 0x1fb2, 0xc3b: 0x07bd, - 0xc3c: 0x1fc2, 0xc3d: 0x1fd2, 0xc3e: 0x1fe2, 0xc3f: 0x0f71, - // Block 0x31, offset 0xc40 - 0xc40: 0x1f41, 0xc41: 0x00c9, 0xc42: 0x0069, 0xc43: 0x0079, 0xc44: 0x1f51, 0xc45: 0x1f61, - 0xc46: 0x1f71, 0xc47: 0x1f81, 0xc48: 0x1f91, 0xc49: 0x1fa1, 0xc4a: 0x1fb2, 0xc4b: 0x07d5, - 0xc4c: 0x1fc2, 0xc4d: 0x1fd2, 0xc4e: 0x1fe2, 0xc4f: 0x0040, 0xc50: 0x0039, 0xc51: 0x0f09, - 0xc52: 0x00d9, 0xc53: 0x0369, 0xc54: 0x0ff9, 0xc55: 0x0249, 0xc56: 0x0f51, 0xc57: 0x0359, - 0xc58: 0x0f61, 0xc59: 0x0f71, 0xc5a: 0x0f99, 0xc5b: 0x01d9, 0xc5c: 0x0fa9, 0xc5d: 0x0040, - 0xc5e: 0x0040, 0xc5f: 0x0040, 0xc60: 0x0018, 0xc61: 0x0018, 0xc62: 0x0018, 0xc63: 0x0018, - 0xc64: 0x0018, 0xc65: 0x0018, 0xc66: 0x0018, 0xc67: 0x0018, 0xc68: 0x1ff1, 0xc69: 0x0018, - 0xc6a: 0x0018, 0xc6b: 0x0018, 0xc6c: 0x0018, 0xc6d: 0x0018, 0xc6e: 0x0018, 0xc6f: 0x0018, - 0xc70: 0x0018, 0xc71: 0x0018, 0xc72: 0x0018, 0xc73: 0x0018, 0xc74: 0x0018, 0xc75: 0x0018, - 0xc76: 0x0018, 0xc77: 0x0018, 0xc78: 0x0018, 0xc79: 0x0018, 0xc7a: 0x0018, 0xc7b: 0x0018, - 0xc7c: 0x0018, 0xc7d: 0x0018, 0xc7e: 0x0018, 0xc7f: 0x0018, - // Block 0x32, offset 0xc80 - 0xc80: 0x07ee, 0xc81: 0x080e, 0xc82: 0x1159, 0xc83: 0x082d, 0xc84: 0x0018, 0xc85: 0x084e, - 0xc86: 0x086e, 0xc87: 0x1011, 0xc88: 0x0018, 0xc89: 0x088d, 0xc8a: 0x0f31, 0xc8b: 0x0249, - 0xc8c: 0x0249, 0xc8d: 0x0249, 0xc8e: 0x0249, 0xc8f: 0x2009, 0xc90: 0x0f41, 0xc91: 0x0f41, - 0xc92: 0x0359, 0xc93: 0x0359, 0xc94: 0x0018, 0xc95: 0x0f71, 0xc96: 0x2021, 0xc97: 0x0018, - 0xc98: 0x0018, 0xc99: 0x0f99, 0xc9a: 0x2039, 0xc9b: 0x0269, 0xc9c: 0x0269, 0xc9d: 0x0269, - 0xc9e: 0x0018, 0xc9f: 0x0018, 0xca0: 0x2049, 0xca1: 0x08ad, 0xca2: 0x2061, 0xca3: 0x0018, - 0xca4: 0x13d1, 0xca5: 0x0018, 0xca6: 0x2079, 0xca7: 0x0018, 0xca8: 0x13d1, 0xca9: 0x0018, - 0xcaa: 0x0f51, 0xcab: 0x2091, 0xcac: 0x0ee9, 0xcad: 0x1159, 0xcae: 0x0018, 0xcaf: 0x0f09, - 0xcb0: 0x0f09, 0xcb1: 0x1199, 0xcb2: 0x0040, 0xcb3: 0x0f61, 0xcb4: 0x00d9, 0xcb5: 0x20a9, - 0xcb6: 0x20c1, 0xcb7: 0x20d9, 0xcb8: 0x20f1, 0xcb9: 0x0f41, 0xcba: 0x0018, 0xcbb: 0x08cd, - 0xcbc: 0x2109, 0xcbd: 0x10b1, 0xcbe: 0x10b1, 0xcbf: 0x2109, - // Block 0x33, offset 0xcc0 - 0xcc0: 0x08ed, 0xcc1: 0x0018, 0xcc2: 0x0018, 0xcc3: 0x0018, 0xcc4: 0x0018, 0xcc5: 0x0ef9, - 0xcc6: 0x0ef9, 0xcc7: 0x0f09, 0xcc8: 0x0f41, 0xcc9: 0x0259, 0xcca: 0x0018, 0xccb: 0x0018, - 0xccc: 0x0018, 0xccd: 0x0018, 0xcce: 0x0008, 0xccf: 0x0018, 0xcd0: 0x2121, 0xcd1: 0x2151, - 0xcd2: 0x2181, 0xcd3: 0x21b9, 0xcd4: 0x21e9, 0xcd5: 0x2219, 0xcd6: 0x2249, 0xcd7: 0x2279, - 0xcd8: 0x22a9, 0xcd9: 0x22d9, 0xcda: 0x2309, 0xcdb: 0x2339, 0xcdc: 0x2369, 0xcdd: 0x2399, - 0xcde: 0x23c9, 0xcdf: 0x23f9, 0xce0: 0x0f41, 0xce1: 0x2421, 0xce2: 0x0905, 0xce3: 0x2439, - 0xce4: 0x1089, 0xce5: 0x2451, 0xce6: 0x0925, 0xce7: 0x2469, 0xce8: 0x2491, 0xce9: 0x0369, - 0xcea: 0x24a9, 0xceb: 0x0945, 0xcec: 0x0359, 0xced: 0x1159, 0xcee: 0x0ef9, 0xcef: 0x0f61, - 0xcf0: 0x0f41, 0xcf1: 0x2421, 0xcf2: 0x0965, 0xcf3: 0x2439, 0xcf4: 0x1089, 0xcf5: 0x2451, - 0xcf6: 0x0985, 0xcf7: 0x2469, 0xcf8: 0x2491, 0xcf9: 0x0369, 0xcfa: 0x24a9, 0xcfb: 0x09a5, - 0xcfc: 0x0359, 0xcfd: 0x1159, 0xcfe: 0x0ef9, 0xcff: 0x0f61, - // Block 0x34, offset 0xd00 - 0xd00: 0x0018, 0xd01: 0x0018, 0xd02: 0x0018, 0xd03: 0x0018, 0xd04: 0x0018, 0xd05: 0x0018, - 0xd06: 0x0018, 0xd07: 0x0018, 0xd08: 0x0018, 0xd09: 0x0018, 0xd0a: 0x0018, 0xd0b: 0x0040, - 0xd0c: 0x0040, 0xd0d: 0x0040, 0xd0e: 0x0040, 0xd0f: 0x0040, 0xd10: 0x0040, 0xd11: 0x0040, - 0xd12: 0x0040, 0xd13: 0x0040, 0xd14: 0x0040, 0xd15: 0x0040, 0xd16: 0x0040, 0xd17: 0x0040, - 0xd18: 0x0040, 0xd19: 0x0040, 0xd1a: 0x0040, 0xd1b: 0x0040, 0xd1c: 0x0040, 0xd1d: 0x0040, - 0xd1e: 0x0040, 0xd1f: 0x0040, 0xd20: 0x00c9, 0xd21: 0x0069, 0xd22: 0x0079, 0xd23: 0x1f51, - 0xd24: 0x1f61, 0xd25: 0x1f71, 0xd26: 0x1f81, 0xd27: 0x1f91, 0xd28: 0x1fa1, 0xd29: 0x2601, - 0xd2a: 0x2619, 0xd2b: 0x2631, 0xd2c: 0x2649, 0xd2d: 0x2661, 0xd2e: 0x2679, 0xd2f: 0x2691, - 0xd30: 0x26a9, 0xd31: 0x26c1, 0xd32: 0x26d9, 0xd33: 0x26f1, 0xd34: 0x0a06, 0xd35: 0x0a26, - 0xd36: 0x0a46, 0xd37: 0x0a66, 0xd38: 0x0a86, 0xd39: 0x0aa6, 0xd3a: 0x0ac6, 0xd3b: 0x0ae6, - 0xd3c: 0x0b06, 0xd3d: 0x270a, 0xd3e: 0x2732, 0xd3f: 0x275a, - // Block 0x35, offset 0xd40 - 0xd40: 0x2782, 0xd41: 0x27aa, 0xd42: 0x27d2, 0xd43: 0x27fa, 0xd44: 0x2822, 0xd45: 0x284a, - 0xd46: 0x2872, 0xd47: 0x289a, 0xd48: 0x0040, 0xd49: 0x0040, 0xd4a: 0x0040, 0xd4b: 0x0040, - 0xd4c: 0x0040, 0xd4d: 0x0040, 0xd4e: 0x0040, 0xd4f: 0x0040, 0xd50: 0x0040, 0xd51: 0x0040, - 0xd52: 0x0040, 0xd53: 0x0040, 0xd54: 0x0040, 0xd55: 0x0040, 0xd56: 0x0040, 0xd57: 0x0040, - 0xd58: 0x0040, 0xd59: 0x0040, 0xd5a: 0x0040, 0xd5b: 0x0040, 0xd5c: 0x0b26, 0xd5d: 0x0b46, - 0xd5e: 0x0b66, 0xd5f: 0x0b86, 0xd60: 0x0ba6, 0xd61: 0x0bc6, 0xd62: 0x0be6, 0xd63: 0x0c06, - 0xd64: 0x0c26, 0xd65: 0x0c46, 0xd66: 0x0c66, 0xd67: 0x0c86, 0xd68: 0x0ca6, 0xd69: 0x0cc6, - 0xd6a: 0x0ce6, 0xd6b: 0x0d06, 0xd6c: 0x0d26, 0xd6d: 0x0d46, 0xd6e: 0x0d66, 0xd6f: 0x0d86, - 0xd70: 0x0da6, 0xd71: 0x0dc6, 0xd72: 0x0de6, 0xd73: 0x0e06, 0xd74: 0x0e26, 0xd75: 0x0e46, - 0xd76: 0x0039, 0xd77: 0x0ee9, 0xd78: 0x1159, 0xd79: 0x0ef9, 0xd7a: 0x0f09, 0xd7b: 0x1199, - 0xd7c: 0x0f31, 0xd7d: 0x0249, 0xd7e: 0x0f41, 0xd7f: 0x0259, - // Block 0x36, offset 0xd80 - 0xd80: 0x0f51, 0xd81: 0x0359, 0xd82: 0x0f61, 0xd83: 0x0f71, 0xd84: 0x00d9, 0xd85: 0x0f99, - 0xd86: 0x2039, 0xd87: 0x0269, 0xd88: 0x01d9, 0xd89: 0x0fa9, 0xd8a: 0x0fb9, 0xd8b: 0x1089, - 0xd8c: 0x0279, 0xd8d: 0x0369, 0xd8e: 0x0289, 0xd8f: 0x13d1, 0xd90: 0x0039, 0xd91: 0x0ee9, - 0xd92: 0x1159, 0xd93: 0x0ef9, 0xd94: 0x0f09, 0xd95: 0x1199, 0xd96: 0x0f31, 0xd97: 0x0249, - 0xd98: 0x0f41, 0xd99: 0x0259, 0xd9a: 0x0f51, 0xd9b: 0x0359, 0xd9c: 0x0f61, 0xd9d: 0x0f71, - 0xd9e: 0x00d9, 0xd9f: 0x0f99, 0xda0: 0x2039, 0xda1: 0x0269, 0xda2: 0x01d9, 0xda3: 0x0fa9, - 0xda4: 0x0fb9, 0xda5: 0x1089, 0xda6: 0x0279, 0xda7: 0x0369, 0xda8: 0x0289, 0xda9: 0x13d1, - 0xdaa: 0x1f41, 0xdab: 0x0018, 0xdac: 0x0018, 0xdad: 0x0018, 0xdae: 0x0018, 0xdaf: 0x0018, - 0xdb0: 0x0018, 0xdb1: 0x0018, 0xdb2: 0x0018, 0xdb3: 0x0018, 0xdb4: 0x0018, 0xdb5: 0x0018, - 0xdb6: 0x0018, 0xdb7: 0x0018, 0xdb8: 0x0018, 0xdb9: 0x0018, 0xdba: 0x0018, 0xdbb: 0x0018, - 0xdbc: 0x0018, 0xdbd: 0x0018, 0xdbe: 0x0018, 0xdbf: 0x0018, - // Block 0x37, offset 0xdc0 - 0xdc0: 0x0008, 0xdc1: 0x0008, 0xdc2: 0x0008, 0xdc3: 0x0008, 0xdc4: 0x0008, 0xdc5: 0x0008, - 0xdc6: 0x0008, 0xdc7: 0x0008, 0xdc8: 0x0008, 0xdc9: 0x0008, 0xdca: 0x0008, 0xdcb: 0x0008, - 0xdcc: 0x0008, 0xdcd: 0x0008, 0xdce: 0x0008, 0xdcf: 0x0008, 0xdd0: 0x0008, 0xdd1: 0x0008, - 0xdd2: 0x0008, 0xdd3: 0x0008, 0xdd4: 0x0008, 0xdd5: 0x0008, 0xdd6: 0x0008, 0xdd7: 0x0008, - 0xdd8: 0x0008, 0xdd9: 0x0008, 0xdda: 0x0008, 0xddb: 0x0008, 0xddc: 0x0008, 0xddd: 0x0008, - 0xdde: 0x0008, 0xddf: 0x0040, 0xde0: 0xe00d, 0xde1: 0x0008, 0xde2: 0x2971, 0xde3: 0x0ebd, - 0xde4: 0x2989, 0xde5: 0x0008, 0xde6: 0x0008, 0xde7: 0xe07d, 0xde8: 0x0008, 0xde9: 0xe01d, - 0xdea: 0x0008, 0xdeb: 0xe03d, 0xdec: 0x0008, 0xded: 0x0fe1, 0xdee: 0x1281, 0xdef: 0x0fc9, - 0xdf0: 0x1141, 0xdf1: 0x0008, 0xdf2: 0xe00d, 0xdf3: 0x0008, 0xdf4: 0x0008, 0xdf5: 0xe01d, - 0xdf6: 0x0008, 0xdf7: 0x0008, 0xdf8: 0x0008, 0xdf9: 0x0008, 0xdfa: 0x0008, 0xdfb: 0x0008, - 0xdfc: 0x0259, 0xdfd: 0x1089, 0xdfe: 0x29a1, 0xdff: 0x29b9, - // Block 0x38, offset 0xe00 - 0xe00: 0xe00d, 0xe01: 0x0008, 0xe02: 0xe00d, 0xe03: 0x0008, 0xe04: 0xe00d, 0xe05: 0x0008, - 0xe06: 0xe00d, 0xe07: 0x0008, 0xe08: 0xe00d, 0xe09: 0x0008, 0xe0a: 0xe00d, 0xe0b: 0x0008, - 0xe0c: 0xe00d, 0xe0d: 0x0008, 0xe0e: 0xe00d, 0xe0f: 0x0008, 0xe10: 0xe00d, 0xe11: 0x0008, - 0xe12: 0xe00d, 0xe13: 0x0008, 0xe14: 0xe00d, 0xe15: 0x0008, 0xe16: 0xe00d, 0xe17: 0x0008, - 0xe18: 0xe00d, 0xe19: 0x0008, 0xe1a: 0xe00d, 0xe1b: 0x0008, 0xe1c: 0xe00d, 0xe1d: 0x0008, - 0xe1e: 0xe00d, 0xe1f: 0x0008, 0xe20: 0xe00d, 0xe21: 0x0008, 0xe22: 0xe00d, 0xe23: 0x0008, - 0xe24: 0x0008, 0xe25: 0x0018, 0xe26: 0x0018, 0xe27: 0x0018, 0xe28: 0x0018, 0xe29: 0x0018, - 0xe2a: 0x0018, 0xe2b: 0xe03d, 0xe2c: 0x0008, 0xe2d: 0xe01d, 0xe2e: 0x0008, 0xe2f: 0x3308, - 0xe30: 0x3308, 0xe31: 0x3308, 0xe32: 0xe00d, 0xe33: 0x0008, 0xe34: 0x0040, 0xe35: 0x0040, - 0xe36: 0x0040, 0xe37: 0x0040, 0xe38: 0x0040, 0xe39: 0x0018, 0xe3a: 0x0018, 0xe3b: 0x0018, - 0xe3c: 0x0018, 0xe3d: 0x0018, 0xe3e: 0x0018, 0xe3f: 0x0018, - // Block 0x39, offset 0xe40 - 0xe40: 0x26fd, 0xe41: 0x271d, 0xe42: 0x273d, 0xe43: 0x275d, 0xe44: 0x277d, 0xe45: 0x279d, - 0xe46: 0x27bd, 0xe47: 0x27dd, 0xe48: 0x27fd, 0xe49: 0x281d, 0xe4a: 0x283d, 0xe4b: 0x285d, - 0xe4c: 0x287d, 0xe4d: 0x289d, 0xe4e: 0x28bd, 0xe4f: 0x28dd, 0xe50: 0x28fd, 0xe51: 0x291d, - 0xe52: 0x293d, 0xe53: 0x295d, 0xe54: 0x297d, 0xe55: 0x299d, 0xe56: 0x0040, 0xe57: 0x0040, - 0xe58: 0x0040, 0xe59: 0x0040, 0xe5a: 0x0040, 0xe5b: 0x0040, 0xe5c: 0x0040, 0xe5d: 0x0040, - 0xe5e: 0x0040, 0xe5f: 0x0040, 0xe60: 0x0040, 0xe61: 0x0040, 0xe62: 0x0040, 0xe63: 0x0040, - 0xe64: 0x0040, 0xe65: 0x0040, 0xe66: 0x0040, 0xe67: 0x0040, 0xe68: 0x0040, 0xe69: 0x0040, - 0xe6a: 0x0040, 0xe6b: 0x0040, 0xe6c: 0x0040, 0xe6d: 0x0040, 0xe6e: 0x0040, 0xe6f: 0x0040, - 0xe70: 0x0040, 0xe71: 0x0040, 0xe72: 0x0040, 0xe73: 0x0040, 0xe74: 0x0040, 0xe75: 0x0040, - 0xe76: 0x0040, 0xe77: 0x0040, 0xe78: 0x0040, 0xe79: 0x0040, 0xe7a: 0x0040, 0xe7b: 0x0040, - 0xe7c: 0x0040, 0xe7d: 0x0040, 0xe7e: 0x0040, 0xe7f: 0x0040, - // Block 0x3a, offset 0xe80 - 0xe80: 0x000a, 0xe81: 0x0018, 0xe82: 0x29d1, 0xe83: 0x0018, 0xe84: 0x0018, 0xe85: 0x0008, - 0xe86: 0x0008, 0xe87: 0x0008, 0xe88: 0x0018, 0xe89: 0x0018, 0xe8a: 0x0018, 0xe8b: 0x0018, - 0xe8c: 0x0018, 0xe8d: 0x0018, 0xe8e: 0x0018, 0xe8f: 0x0018, 0xe90: 0x0018, 0xe91: 0x0018, - 0xe92: 0x0018, 0xe93: 0x0018, 0xe94: 0x0018, 0xe95: 0x0018, 0xe96: 0x0018, 0xe97: 0x0018, - 0xe98: 0x0018, 0xe99: 0x0018, 0xe9a: 0x0018, 0xe9b: 0x0018, 0xe9c: 0x0018, 0xe9d: 0x0018, - 0xe9e: 0x0018, 0xe9f: 0x0018, 0xea0: 0x0018, 0xea1: 0x0018, 0xea2: 0x0018, 0xea3: 0x0018, - 0xea4: 0x0018, 0xea5: 0x0018, 0xea6: 0x0018, 0xea7: 0x0018, 0xea8: 0x0018, 0xea9: 0x0018, - 0xeaa: 0x3308, 0xeab: 0x3308, 0xeac: 0x3308, 0xead: 0x3308, 0xeae: 0x3018, 0xeaf: 0x3018, - 0xeb0: 0x0018, 0xeb1: 0x0018, 0xeb2: 0x0018, 0xeb3: 0x0018, 0xeb4: 0x0018, 0xeb5: 0x0018, - 0xeb6: 0xe125, 0xeb7: 0x0018, 0xeb8: 0x29bd, 0xeb9: 0x29dd, 0xeba: 0x29fd, 0xebb: 0x0018, - 0xebc: 0x0008, 0xebd: 0x0018, 0xebe: 0x0018, 0xebf: 0x0018, - // Block 0x3b, offset 0xec0 - 0xec0: 0x2b3d, 0xec1: 0x2b5d, 0xec2: 0x2b7d, 0xec3: 0x2b9d, 0xec4: 0x2bbd, 0xec5: 0x2bdd, - 0xec6: 0x2bdd, 0xec7: 0x2bdd, 0xec8: 0x2bfd, 0xec9: 0x2bfd, 0xeca: 0x2bfd, 0xecb: 0x2bfd, - 0xecc: 0x2c1d, 0xecd: 0x2c1d, 0xece: 0x2c1d, 0xecf: 0x2c3d, 0xed0: 0x2c5d, 0xed1: 0x2c5d, - 0xed2: 0x2a7d, 0xed3: 0x2a7d, 0xed4: 0x2c5d, 0xed5: 0x2c5d, 0xed6: 0x2c7d, 0xed7: 0x2c7d, - 0xed8: 0x2c5d, 0xed9: 0x2c5d, 0xeda: 0x2a7d, 0xedb: 0x2a7d, 0xedc: 0x2c5d, 0xedd: 0x2c5d, - 0xede: 0x2c3d, 0xedf: 0x2c3d, 0xee0: 0x2c9d, 0xee1: 0x2c9d, 0xee2: 0x2cbd, 0xee3: 0x2cbd, - 0xee4: 0x0040, 0xee5: 0x2cdd, 0xee6: 0x2cfd, 0xee7: 0x2d1d, 0xee8: 0x2d1d, 0xee9: 0x2d3d, - 0xeea: 0x2d5d, 0xeeb: 0x2d7d, 0xeec: 0x2d9d, 0xeed: 0x2dbd, 0xeee: 0x2ddd, 0xeef: 0x2dfd, - 0xef0: 0x2e1d, 0xef1: 0x2e3d, 0xef2: 0x2e3d, 0xef3: 0x2e5d, 0xef4: 0x2e7d, 0xef5: 0x2e7d, - 0xef6: 0x2e9d, 0xef7: 0x2ebd, 0xef8: 0x2e5d, 0xef9: 0x2edd, 0xefa: 0x2efd, 0xefb: 0x2edd, - 0xefc: 0x2e5d, 0xefd: 0x2f1d, 0xefe: 0x2f3d, 0xeff: 0x2f5d, - // Block 0x3c, offset 0xf00 - 0xf00: 0x2f7d, 0xf01: 0x2f9d, 0xf02: 0x2cfd, 0xf03: 0x2cdd, 0xf04: 0x2fbd, 0xf05: 0x2fdd, - 0xf06: 0x2ffd, 0xf07: 0x301d, 0xf08: 0x303d, 0xf09: 0x305d, 0xf0a: 0x307d, 0xf0b: 0x309d, - 0xf0c: 0x30bd, 0xf0d: 0x30dd, 0xf0e: 0x30fd, 0xf0f: 0x0040, 0xf10: 0x0018, 0xf11: 0x0018, - 0xf12: 0x311d, 0xf13: 0x313d, 0xf14: 0x315d, 0xf15: 0x317d, 0xf16: 0x319d, 0xf17: 0x31bd, - 0xf18: 0x31dd, 0xf19: 0x31fd, 0xf1a: 0x321d, 0xf1b: 0x323d, 0xf1c: 0x315d, 0xf1d: 0x325d, - 0xf1e: 0x327d, 0xf1f: 0x329d, 0xf20: 0x0008, 0xf21: 0x0008, 0xf22: 0x0008, 0xf23: 0x0008, - 0xf24: 0x0008, 0xf25: 0x0008, 0xf26: 0x0008, 0xf27: 0x0008, 0xf28: 0x0008, 0xf29: 0x0008, - 0xf2a: 0x0008, 0xf2b: 0x0008, 0xf2c: 0x0008, 0xf2d: 0x0008, 0xf2e: 0x0008, 0xf2f: 0x0008, - 0xf30: 0x0008, 0xf31: 0x0008, 0xf32: 0x0008, 0xf33: 0x0008, 0xf34: 0x0008, 0xf35: 0x0008, - 0xf36: 0x0008, 0xf37: 0x0008, 0xf38: 0x0008, 0xf39: 0x0008, 0xf3a: 0x0008, 0xf3b: 0x0040, - 0xf3c: 0x0040, 0xf3d: 0x0040, 0xf3e: 0x0040, 0xf3f: 0x0040, - // Block 0x3d, offset 0xf40 - 0xf40: 0x36a2, 0xf41: 0x36d2, 0xf42: 0x3702, 0xf43: 0x3732, 0xf44: 0x32bd, 0xf45: 0x32dd, - 0xf46: 0x32fd, 0xf47: 0x331d, 0xf48: 0x0018, 0xf49: 0x0018, 0xf4a: 0x0018, 0xf4b: 0x0018, - 0xf4c: 0x0018, 0xf4d: 0x0018, 0xf4e: 0x0018, 0xf4f: 0x0018, 0xf50: 0x333d, 0xf51: 0x3761, - 0xf52: 0x3779, 0xf53: 0x3791, 0xf54: 0x37a9, 0xf55: 0x37c1, 0xf56: 0x37d9, 0xf57: 0x37f1, - 0xf58: 0x3809, 0xf59: 0x3821, 0xf5a: 0x3839, 0xf5b: 0x3851, 0xf5c: 0x3869, 0xf5d: 0x3881, - 0xf5e: 0x3899, 0xf5f: 0x38b1, 0xf60: 0x335d, 0xf61: 0x337d, 0xf62: 0x339d, 0xf63: 0x33bd, - 0xf64: 0x33dd, 0xf65: 0x33dd, 0xf66: 0x33fd, 0xf67: 0x341d, 0xf68: 0x343d, 0xf69: 0x345d, - 0xf6a: 0x347d, 0xf6b: 0x349d, 0xf6c: 0x34bd, 0xf6d: 0x34dd, 0xf6e: 0x34fd, 0xf6f: 0x351d, - 0xf70: 0x353d, 0xf71: 0x355d, 0xf72: 0x357d, 0xf73: 0x359d, 0xf74: 0x35bd, 0xf75: 0x35dd, - 0xf76: 0x35fd, 0xf77: 0x361d, 0xf78: 0x363d, 0xf79: 0x365d, 0xf7a: 0x367d, 0xf7b: 0x369d, - 0xf7c: 0x38c9, 0xf7d: 0x3901, 0xf7e: 0x36bd, 0xf7f: 0x0018, - // Block 0x3e, offset 0xf80 - 0xf80: 0x36dd, 0xf81: 0x36fd, 0xf82: 0x371d, 0xf83: 0x373d, 0xf84: 0x375d, 0xf85: 0x377d, - 0xf86: 0x379d, 0xf87: 0x37bd, 0xf88: 0x37dd, 0xf89: 0x37fd, 0xf8a: 0x381d, 0xf8b: 0x383d, - 0xf8c: 0x385d, 0xf8d: 0x387d, 0xf8e: 0x389d, 0xf8f: 0x38bd, 0xf90: 0x38dd, 0xf91: 0x38fd, - 0xf92: 0x391d, 0xf93: 0x393d, 0xf94: 0x395d, 0xf95: 0x397d, 0xf96: 0x399d, 0xf97: 0x39bd, - 0xf98: 0x39dd, 0xf99: 0x39fd, 0xf9a: 0x3a1d, 0xf9b: 0x3a3d, 0xf9c: 0x3a5d, 0xf9d: 0x3a7d, - 0xf9e: 0x3a9d, 0xf9f: 0x3abd, 0xfa0: 0x3add, 0xfa1: 0x3afd, 0xfa2: 0x3b1d, 0xfa3: 0x3b3d, - 0xfa4: 0x3b5d, 0xfa5: 0x3b7d, 0xfa6: 0x127d, 0xfa7: 0x3b9d, 0xfa8: 0x3bbd, 0xfa9: 0x3bdd, - 0xfaa: 0x3bfd, 0xfab: 0x3c1d, 0xfac: 0x3c3d, 0xfad: 0x3c5d, 0xfae: 0x239d, 0xfaf: 0x3c7d, - 0xfb0: 0x3c9d, 0xfb1: 0x3939, 0xfb2: 0x3951, 0xfb3: 0x3969, 0xfb4: 0x3981, 0xfb5: 0x3999, - 0xfb6: 0x39b1, 0xfb7: 0x39c9, 0xfb8: 0x39e1, 0xfb9: 0x39f9, 0xfba: 0x3a11, 0xfbb: 0x3a29, - 0xfbc: 0x3a41, 0xfbd: 0x3a59, 0xfbe: 0x3a71, 0xfbf: 0x3a89, - // Block 0x3f, offset 0xfc0 - 0xfc0: 0x3aa1, 0xfc1: 0x3ac9, 0xfc2: 0x3af1, 0xfc3: 0x3b19, 0xfc4: 0x3b41, 0xfc5: 0x3b69, - 0xfc6: 0x3b91, 0xfc7: 0x3bb9, 0xfc8: 0x3be1, 0xfc9: 0x3c09, 0xfca: 0x3c39, 0xfcb: 0x3c69, - 0xfcc: 0x3c99, 0xfcd: 0x3cbd, 0xfce: 0x3cb1, 0xfcf: 0x3cdd, 0xfd0: 0x3cfd, 0xfd1: 0x3d15, - 0xfd2: 0x3d2d, 0xfd3: 0x3d45, 0xfd4: 0x3d5d, 0xfd5: 0x3d5d, 0xfd6: 0x3d45, 0xfd7: 0x3d75, - 0xfd8: 0x07bd, 0xfd9: 0x3d8d, 0xfda: 0x3da5, 0xfdb: 0x3dbd, 0xfdc: 0x3dd5, 0xfdd: 0x3ded, - 0xfde: 0x3e05, 0xfdf: 0x3e1d, 0xfe0: 0x3e35, 0xfe1: 0x3e4d, 0xfe2: 0x3e65, 0xfe3: 0x3e7d, - 0xfe4: 0x3e95, 0xfe5: 0x3e95, 0xfe6: 0x3ead, 0xfe7: 0x3ead, 0xfe8: 0x3ec5, 0xfe9: 0x3ec5, - 0xfea: 0x3edd, 0xfeb: 0x3ef5, 0xfec: 0x3f0d, 0xfed: 0x3f25, 0xfee: 0x3f3d, 0xfef: 0x3f3d, - 0xff0: 0x3f55, 0xff1: 0x3f55, 0xff2: 0x3f55, 0xff3: 0x3f6d, 0xff4: 0x3f85, 0xff5: 0x3f9d, - 0xff6: 0x3fb5, 0xff7: 0x3f9d, 0xff8: 0x3fcd, 0xff9: 0x3fe5, 0xffa: 0x3f6d, 0xffb: 0x3ffd, - 0xffc: 0x4015, 0xffd: 0x4015, 0xffe: 0x4015, 0xfff: 0x0040, - // Block 0x40, offset 0x1000 - 0x1000: 0x3cc9, 0x1001: 0x3d31, 0x1002: 0x3d99, 0x1003: 0x3e01, 0x1004: 0x3e51, 0x1005: 0x3eb9, - 0x1006: 0x3f09, 0x1007: 0x3f59, 0x1008: 0x3fd9, 0x1009: 0x4041, 0x100a: 0x4091, 0x100b: 0x40e1, - 0x100c: 0x4131, 0x100d: 0x4199, 0x100e: 0x4201, 0x100f: 0x4251, 0x1010: 0x42a1, 0x1011: 0x42d9, - 0x1012: 0x4329, 0x1013: 0x4391, 0x1014: 0x43f9, 0x1015: 0x4431, 0x1016: 0x44b1, 0x1017: 0x4549, - 0x1018: 0x45c9, 0x1019: 0x4619, 0x101a: 0x4699, 0x101b: 0x4719, 0x101c: 0x4781, 0x101d: 0x47d1, - 0x101e: 0x4821, 0x101f: 0x4871, 0x1020: 0x48d9, 0x1021: 0x4959, 0x1022: 0x49c1, 0x1023: 0x4a11, - 0x1024: 0x4a61, 0x1025: 0x4ab1, 0x1026: 0x4ae9, 0x1027: 0x4b21, 0x1028: 0x4b59, 0x1029: 0x4b91, - 0x102a: 0x4be1, 0x102b: 0x4c31, 0x102c: 0x4cb1, 0x102d: 0x4d01, 0x102e: 0x4d69, 0x102f: 0x4de9, - 0x1030: 0x4e39, 0x1031: 0x4e71, 0x1032: 0x4ea9, 0x1033: 0x4f29, 0x1034: 0x4f91, 0x1035: 0x5011, - 0x1036: 0x5061, 0x1037: 0x50e1, 0x1038: 0x5119, 0x1039: 0x5169, 0x103a: 0x51b9, 0x103b: 0x5209, - 0x103c: 0x5259, 0x103d: 0x52a9, 0x103e: 0x5311, 0x103f: 0x5361, - // Block 0x41, offset 0x1040 - 0x1040: 0x5399, 0x1041: 0x53e9, 0x1042: 0x5439, 0x1043: 0x5489, 0x1044: 0x54f1, 0x1045: 0x5541, - 0x1046: 0x5591, 0x1047: 0x55e1, 0x1048: 0x5661, 0x1049: 0x56c9, 0x104a: 0x5701, 0x104b: 0x5781, - 0x104c: 0x57b9, 0x104d: 0x5821, 0x104e: 0x5889, 0x104f: 0x58d9, 0x1050: 0x5929, 0x1051: 0x5979, - 0x1052: 0x59e1, 0x1053: 0x5a19, 0x1054: 0x5a69, 0x1055: 0x5ad1, 0x1056: 0x5b09, 0x1057: 0x5b89, - 0x1058: 0x5bd9, 0x1059: 0x5c01, 0x105a: 0x5c29, 0x105b: 0x5c51, 0x105c: 0x5c79, 0x105d: 0x5ca1, - 0x105e: 0x5cc9, 0x105f: 0x5cf1, 0x1060: 0x5d19, 0x1061: 0x5d41, 0x1062: 0x5d69, 0x1063: 0x5d99, - 0x1064: 0x5dc9, 0x1065: 0x5df9, 0x1066: 0x5e29, 0x1067: 0x5e59, 0x1068: 0x5e89, 0x1069: 0x5eb9, - 0x106a: 0x5ee9, 0x106b: 0x5f19, 0x106c: 0x5f49, 0x106d: 0x5f79, 0x106e: 0x5fa9, 0x106f: 0x5fd9, - 0x1070: 0x6009, 0x1071: 0x402d, 0x1072: 0x6039, 0x1073: 0x6051, 0x1074: 0x404d, 0x1075: 0x6069, - 0x1076: 0x6081, 0x1077: 0x6099, 0x1078: 0x406d, 0x1079: 0x406d, 0x107a: 0x60b1, 0x107b: 0x60c9, - 0x107c: 0x6101, 0x107d: 0x6139, 0x107e: 0x6171, 0x107f: 0x61a9, - // Block 0x42, offset 0x1080 - 0x1080: 0x6211, 0x1081: 0x6229, 0x1082: 0x408d, 0x1083: 0x6241, 0x1084: 0x6259, 0x1085: 0x6271, - 0x1086: 0x6289, 0x1087: 0x62a1, 0x1088: 0x40ad, 0x1089: 0x62b9, 0x108a: 0x62e1, 0x108b: 0x62f9, - 0x108c: 0x40cd, 0x108d: 0x40cd, 0x108e: 0x6311, 0x108f: 0x6329, 0x1090: 0x6341, 0x1091: 0x40ed, - 0x1092: 0x410d, 0x1093: 0x412d, 0x1094: 0x414d, 0x1095: 0x416d, 0x1096: 0x6359, 0x1097: 0x6371, - 0x1098: 0x6389, 0x1099: 0x63a1, 0x109a: 0x63b9, 0x109b: 0x418d, 0x109c: 0x63d1, 0x109d: 0x63e9, - 0x109e: 0x6401, 0x109f: 0x41ad, 0x10a0: 0x41cd, 0x10a1: 0x6419, 0x10a2: 0x41ed, 0x10a3: 0x420d, - 0x10a4: 0x422d, 0x10a5: 0x6431, 0x10a6: 0x424d, 0x10a7: 0x6449, 0x10a8: 0x6479, 0x10a9: 0x6211, - 0x10aa: 0x426d, 0x10ab: 0x428d, 0x10ac: 0x42ad, 0x10ad: 0x42cd, 0x10ae: 0x64b1, 0x10af: 0x64f1, - 0x10b0: 0x6539, 0x10b1: 0x6551, 0x10b2: 0x42ed, 0x10b3: 0x6569, 0x10b4: 0x6581, 0x10b5: 0x6599, - 0x10b6: 0x430d, 0x10b7: 0x65b1, 0x10b8: 0x65c9, 0x10b9: 0x65b1, 0x10ba: 0x65e1, 0x10bb: 0x65f9, - 0x10bc: 0x432d, 0x10bd: 0x6611, 0x10be: 0x6629, 0x10bf: 0x6611, - // Block 0x43, offset 0x10c0 - 0x10c0: 0x434d, 0x10c1: 0x436d, 0x10c2: 0x0040, 0x10c3: 0x6641, 0x10c4: 0x6659, 0x10c5: 0x6671, - 0x10c6: 0x6689, 0x10c7: 0x0040, 0x10c8: 0x66c1, 0x10c9: 0x66d9, 0x10ca: 0x66f1, 0x10cb: 0x6709, - 0x10cc: 0x6721, 0x10cd: 0x6739, 0x10ce: 0x6401, 0x10cf: 0x6751, 0x10d0: 0x6769, 0x10d1: 0x6781, - 0x10d2: 0x438d, 0x10d3: 0x6799, 0x10d4: 0x6289, 0x10d5: 0x43ad, 0x10d6: 0x43cd, 0x10d7: 0x67b1, - 0x10d8: 0x0040, 0x10d9: 0x43ed, 0x10da: 0x67c9, 0x10db: 0x67e1, 0x10dc: 0x67f9, 0x10dd: 0x6811, - 0x10de: 0x6829, 0x10df: 0x6859, 0x10e0: 0x6889, 0x10e1: 0x68b1, 0x10e2: 0x68d9, 0x10e3: 0x6901, - 0x10e4: 0x6929, 0x10e5: 0x6951, 0x10e6: 0x6979, 0x10e7: 0x69a1, 0x10e8: 0x69c9, 0x10e9: 0x69f1, - 0x10ea: 0x6a21, 0x10eb: 0x6a51, 0x10ec: 0x6a81, 0x10ed: 0x6ab1, 0x10ee: 0x6ae1, 0x10ef: 0x6b11, - 0x10f0: 0x6b41, 0x10f1: 0x6b71, 0x10f2: 0x6ba1, 0x10f3: 0x6bd1, 0x10f4: 0x6c01, 0x10f5: 0x6c31, - 0x10f6: 0x6c61, 0x10f7: 0x6c91, 0x10f8: 0x6cc1, 0x10f9: 0x6cf1, 0x10fa: 0x6d21, 0x10fb: 0x6d51, - 0x10fc: 0x6d81, 0x10fd: 0x6db1, 0x10fe: 0x6de1, 0x10ff: 0x440d, - // Block 0x44, offset 0x1100 - 0x1100: 0xe00d, 0x1101: 0x0008, 0x1102: 0xe00d, 0x1103: 0x0008, 0x1104: 0xe00d, 0x1105: 0x0008, - 0x1106: 0xe00d, 0x1107: 0x0008, 0x1108: 0xe00d, 0x1109: 0x0008, 0x110a: 0xe00d, 0x110b: 0x0008, - 0x110c: 0xe00d, 0x110d: 0x0008, 0x110e: 0xe00d, 0x110f: 0x0008, 0x1110: 0xe00d, 0x1111: 0x0008, - 0x1112: 0xe00d, 0x1113: 0x0008, 0x1114: 0xe00d, 0x1115: 0x0008, 0x1116: 0xe00d, 0x1117: 0x0008, - 0x1118: 0xe00d, 0x1119: 0x0008, 0x111a: 0xe00d, 0x111b: 0x0008, 0x111c: 0xe00d, 0x111d: 0x0008, - 0x111e: 0xe00d, 0x111f: 0x0008, 0x1120: 0xe00d, 0x1121: 0x0008, 0x1122: 0xe00d, 0x1123: 0x0008, - 0x1124: 0xe00d, 0x1125: 0x0008, 0x1126: 0xe00d, 0x1127: 0x0008, 0x1128: 0xe00d, 0x1129: 0x0008, - 0x112a: 0xe00d, 0x112b: 0x0008, 0x112c: 0xe00d, 0x112d: 0x0008, 0x112e: 0x0008, 0x112f: 0x3308, - 0x1130: 0x3318, 0x1131: 0x3318, 0x1132: 0x3318, 0x1133: 0x0018, 0x1134: 0x3308, 0x1135: 0x3308, - 0x1136: 0x3308, 0x1137: 0x3308, 0x1138: 0x3308, 0x1139: 0x3308, 0x113a: 0x3308, 0x113b: 0x3308, - 0x113c: 0x3308, 0x113d: 0x3308, 0x113e: 0x0018, 0x113f: 0x0008, - // Block 0x45, offset 0x1140 - 0x1140: 0xe00d, 0x1141: 0x0008, 0x1142: 0xe00d, 0x1143: 0x0008, 0x1144: 0xe00d, 0x1145: 0x0008, - 0x1146: 0xe00d, 0x1147: 0x0008, 0x1148: 0xe00d, 0x1149: 0x0008, 0x114a: 0xe00d, 0x114b: 0x0008, - 0x114c: 0xe00d, 0x114d: 0x0008, 0x114e: 0xe00d, 0x114f: 0x0008, 0x1150: 0xe00d, 0x1151: 0x0008, - 0x1152: 0xe00d, 0x1153: 0x0008, 0x1154: 0xe00d, 0x1155: 0x0008, 0x1156: 0xe00d, 0x1157: 0x0008, - 0x1158: 0xe00d, 0x1159: 0x0008, 0x115a: 0xe00d, 0x115b: 0x0008, 0x115c: 0x0ea1, 0x115d: 0x6e11, - 0x115e: 0x3308, 0x115f: 0x3308, 0x1160: 0x0008, 0x1161: 0x0008, 0x1162: 0x0008, 0x1163: 0x0008, - 0x1164: 0x0008, 0x1165: 0x0008, 0x1166: 0x0008, 0x1167: 0x0008, 0x1168: 0x0008, 0x1169: 0x0008, - 0x116a: 0x0008, 0x116b: 0x0008, 0x116c: 0x0008, 0x116d: 0x0008, 0x116e: 0x0008, 0x116f: 0x0008, - 0x1170: 0x0008, 0x1171: 0x0008, 0x1172: 0x0008, 0x1173: 0x0008, 0x1174: 0x0008, 0x1175: 0x0008, - 0x1176: 0x0008, 0x1177: 0x0008, 0x1178: 0x0008, 0x1179: 0x0008, 0x117a: 0x0008, 0x117b: 0x0008, - 0x117c: 0x0008, 0x117d: 0x0008, 0x117e: 0x0008, 0x117f: 0x0008, - // Block 0x46, offset 0x1180 - 0x1180: 0x0018, 0x1181: 0x0018, 0x1182: 0x0018, 0x1183: 0x0018, 0x1184: 0x0018, 0x1185: 0x0018, - 0x1186: 0x0018, 0x1187: 0x0018, 0x1188: 0x0018, 0x1189: 0x0018, 0x118a: 0x0018, 0x118b: 0x0018, - 0x118c: 0x0018, 0x118d: 0x0018, 0x118e: 0x0018, 0x118f: 0x0018, 0x1190: 0x0018, 0x1191: 0x0018, - 0x1192: 0x0018, 0x1193: 0x0018, 0x1194: 0x0018, 0x1195: 0x0018, 0x1196: 0x0018, 0x1197: 0x0008, - 0x1198: 0x0008, 0x1199: 0x0008, 0x119a: 0x0008, 0x119b: 0x0008, 0x119c: 0x0008, 0x119d: 0x0008, - 0x119e: 0x0008, 0x119f: 0x0008, 0x11a0: 0x0018, 0x11a1: 0x0018, 0x11a2: 0xe00d, 0x11a3: 0x0008, - 0x11a4: 0xe00d, 0x11a5: 0x0008, 0x11a6: 0xe00d, 0x11a7: 0x0008, 0x11a8: 0xe00d, 0x11a9: 0x0008, - 0x11aa: 0xe00d, 0x11ab: 0x0008, 0x11ac: 0xe00d, 0x11ad: 0x0008, 0x11ae: 0xe00d, 0x11af: 0x0008, - 0x11b0: 0x0008, 0x11b1: 0x0008, 0x11b2: 0xe00d, 0x11b3: 0x0008, 0x11b4: 0xe00d, 0x11b5: 0x0008, - 0x11b6: 0xe00d, 0x11b7: 0x0008, 0x11b8: 0xe00d, 0x11b9: 0x0008, 0x11ba: 0xe00d, 0x11bb: 0x0008, - 0x11bc: 0xe00d, 0x11bd: 0x0008, 0x11be: 0xe00d, 0x11bf: 0x0008, - // Block 0x47, offset 0x11c0 - 0x11c0: 0xe00d, 0x11c1: 0x0008, 0x11c2: 0xe00d, 0x11c3: 0x0008, 0x11c4: 0xe00d, 0x11c5: 0x0008, - 0x11c6: 0xe00d, 0x11c7: 0x0008, 0x11c8: 0xe00d, 0x11c9: 0x0008, 0x11ca: 0xe00d, 0x11cb: 0x0008, - 0x11cc: 0xe00d, 0x11cd: 0x0008, 0x11ce: 0xe00d, 0x11cf: 0x0008, 0x11d0: 0xe00d, 0x11d1: 0x0008, - 0x11d2: 0xe00d, 0x11d3: 0x0008, 0x11d4: 0xe00d, 0x11d5: 0x0008, 0x11d6: 0xe00d, 0x11d7: 0x0008, - 0x11d8: 0xe00d, 0x11d9: 0x0008, 0x11da: 0xe00d, 0x11db: 0x0008, 0x11dc: 0xe00d, 0x11dd: 0x0008, - 0x11de: 0xe00d, 0x11df: 0x0008, 0x11e0: 0xe00d, 0x11e1: 0x0008, 0x11e2: 0xe00d, 0x11e3: 0x0008, - 0x11e4: 0xe00d, 0x11e5: 0x0008, 0x11e6: 0xe00d, 0x11e7: 0x0008, 0x11e8: 0xe00d, 0x11e9: 0x0008, - 0x11ea: 0xe00d, 0x11eb: 0x0008, 0x11ec: 0xe00d, 0x11ed: 0x0008, 0x11ee: 0xe00d, 0x11ef: 0x0008, - 0x11f0: 0xe0fd, 0x11f1: 0x0008, 0x11f2: 0x0008, 0x11f3: 0x0008, 0x11f4: 0x0008, 0x11f5: 0x0008, - 0x11f6: 0x0008, 0x11f7: 0x0008, 0x11f8: 0x0008, 0x11f9: 0xe01d, 0x11fa: 0x0008, 0x11fb: 0xe03d, - 0x11fc: 0x0008, 0x11fd: 0x442d, 0x11fe: 0xe00d, 0x11ff: 0x0008, - // Block 0x48, offset 0x1200 - 0x1200: 0xe00d, 0x1201: 0x0008, 0x1202: 0xe00d, 0x1203: 0x0008, 0x1204: 0xe00d, 0x1205: 0x0008, - 0x1206: 0xe00d, 0x1207: 0x0008, 0x1208: 0x0008, 0x1209: 0x0018, 0x120a: 0x0018, 0x120b: 0xe03d, - 0x120c: 0x0008, 0x120d: 0x11d9, 0x120e: 0x0008, 0x120f: 0x0008, 0x1210: 0xe00d, 0x1211: 0x0008, - 0x1212: 0xe00d, 0x1213: 0x0008, 0x1214: 0x0008, 0x1215: 0x0008, 0x1216: 0xe00d, 0x1217: 0x0008, - 0x1218: 0xe00d, 0x1219: 0x0008, 0x121a: 0xe00d, 0x121b: 0x0008, 0x121c: 0xe00d, 0x121d: 0x0008, - 0x121e: 0xe00d, 0x121f: 0x0008, 0x1220: 0xe00d, 0x1221: 0x0008, 0x1222: 0xe00d, 0x1223: 0x0008, - 0x1224: 0xe00d, 0x1225: 0x0008, 0x1226: 0xe00d, 0x1227: 0x0008, 0x1228: 0xe00d, 0x1229: 0x0008, - 0x122a: 0x6e29, 0x122b: 0x1029, 0x122c: 0x11c1, 0x122d: 0x6e41, 0x122e: 0x1221, 0x122f: 0x0040, - 0x1230: 0x6e59, 0x1231: 0x6e71, 0x1232: 0x1239, 0x1233: 0x444d, 0x1234: 0xe00d, 0x1235: 0x0008, - 0x1236: 0xe00d, 0x1237: 0x0008, 0x1238: 0x0040, 0x1239: 0x0040, 0x123a: 0x0040, 0x123b: 0x0040, - 0x123c: 0x0040, 0x123d: 0x0040, 0x123e: 0x0040, 0x123f: 0x0040, - // Block 0x49, offset 0x1240 - 0x1240: 0x64d5, 0x1241: 0x64f5, 0x1242: 0x6515, 0x1243: 0x6535, 0x1244: 0x6555, 0x1245: 0x6575, - 0x1246: 0x6595, 0x1247: 0x65b5, 0x1248: 0x65d5, 0x1249: 0x65f5, 0x124a: 0x6615, 0x124b: 0x6635, - 0x124c: 0x6655, 0x124d: 0x6675, 0x124e: 0x0008, 0x124f: 0x0008, 0x1250: 0x6695, 0x1251: 0x0008, - 0x1252: 0x66b5, 0x1253: 0x0008, 0x1254: 0x0008, 0x1255: 0x66d5, 0x1256: 0x66f5, 0x1257: 0x6715, - 0x1258: 0x6735, 0x1259: 0x6755, 0x125a: 0x6775, 0x125b: 0x6795, 0x125c: 0x67b5, 0x125d: 0x67d5, - 0x125e: 0x67f5, 0x125f: 0x0008, 0x1260: 0x6815, 0x1261: 0x0008, 0x1262: 0x6835, 0x1263: 0x0008, - 0x1264: 0x0008, 0x1265: 0x6855, 0x1266: 0x6875, 0x1267: 0x0008, 0x1268: 0x0008, 0x1269: 0x0008, - 0x126a: 0x6895, 0x126b: 0x68b5, 0x126c: 0x68d5, 0x126d: 0x68f5, 0x126e: 0x6915, 0x126f: 0x6935, - 0x1270: 0x6955, 0x1271: 0x6975, 0x1272: 0x6995, 0x1273: 0x69b5, 0x1274: 0x69d5, 0x1275: 0x69f5, - 0x1276: 0x6a15, 0x1277: 0x6a35, 0x1278: 0x6a55, 0x1279: 0x6a75, 0x127a: 0x6a95, 0x127b: 0x6ab5, - 0x127c: 0x6ad5, 0x127d: 0x6af5, 0x127e: 0x6b15, 0x127f: 0x6b35, - // Block 0x4a, offset 0x1280 - 0x1280: 0x7a95, 0x1281: 0x7ab5, 0x1282: 0x7ad5, 0x1283: 0x7af5, 0x1284: 0x7b15, 0x1285: 0x7b35, - 0x1286: 0x7b55, 0x1287: 0x7b75, 0x1288: 0x7b95, 0x1289: 0x7bb5, 0x128a: 0x7bd5, 0x128b: 0x7bf5, - 0x128c: 0x7c15, 0x128d: 0x7c35, 0x128e: 0x7c55, 0x128f: 0x6ec9, 0x1290: 0x6ef1, 0x1291: 0x6f19, - 0x1292: 0x7c75, 0x1293: 0x7c95, 0x1294: 0x7cb5, 0x1295: 0x6f41, 0x1296: 0x6f69, 0x1297: 0x6f91, - 0x1298: 0x7cd5, 0x1299: 0x7cf5, 0x129a: 0x0040, 0x129b: 0x0040, 0x129c: 0x0040, 0x129d: 0x0040, - 0x129e: 0x0040, 0x129f: 0x0040, 0x12a0: 0x0040, 0x12a1: 0x0040, 0x12a2: 0x0040, 0x12a3: 0x0040, - 0x12a4: 0x0040, 0x12a5: 0x0040, 0x12a6: 0x0040, 0x12a7: 0x0040, 0x12a8: 0x0040, 0x12a9: 0x0040, - 0x12aa: 0x0040, 0x12ab: 0x0040, 0x12ac: 0x0040, 0x12ad: 0x0040, 0x12ae: 0x0040, 0x12af: 0x0040, - 0x12b0: 0x0040, 0x12b1: 0x0040, 0x12b2: 0x0040, 0x12b3: 0x0040, 0x12b4: 0x0040, 0x12b5: 0x0040, - 0x12b6: 0x0040, 0x12b7: 0x0040, 0x12b8: 0x0040, 0x12b9: 0x0040, 0x12ba: 0x0040, 0x12bb: 0x0040, - 0x12bc: 0x0040, 0x12bd: 0x0040, 0x12be: 0x0040, 0x12bf: 0x0040, - // Block 0x4b, offset 0x12c0 - 0x12c0: 0x6fb9, 0x12c1: 0x6fd1, 0x12c2: 0x6fe9, 0x12c3: 0x7d15, 0x12c4: 0x7d35, 0x12c5: 0x7001, - 0x12c6: 0x7001, 0x12c7: 0x0040, 0x12c8: 0x0040, 0x12c9: 0x0040, 0x12ca: 0x0040, 0x12cb: 0x0040, - 0x12cc: 0x0040, 0x12cd: 0x0040, 0x12ce: 0x0040, 0x12cf: 0x0040, 0x12d0: 0x0040, 0x12d1: 0x0040, - 0x12d2: 0x0040, 0x12d3: 0x7019, 0x12d4: 0x7041, 0x12d5: 0x7069, 0x12d6: 0x7091, 0x12d7: 0x70b9, - 0x12d8: 0x0040, 0x12d9: 0x0040, 0x12da: 0x0040, 0x12db: 0x0040, 0x12dc: 0x0040, 0x12dd: 0x70e1, - 0x12de: 0x3308, 0x12df: 0x7109, 0x12e0: 0x7131, 0x12e1: 0x20a9, 0x12e2: 0x20f1, 0x12e3: 0x7149, - 0x12e4: 0x7161, 0x12e5: 0x7179, 0x12e6: 0x7191, 0x12e7: 0x71a9, 0x12e8: 0x71c1, 0x12e9: 0x1fb2, - 0x12ea: 0x71d9, 0x12eb: 0x7201, 0x12ec: 0x7229, 0x12ed: 0x7261, 0x12ee: 0x7299, 0x12ef: 0x72c1, - 0x12f0: 0x72e9, 0x12f1: 0x7311, 0x12f2: 0x7339, 0x12f3: 0x7361, 0x12f4: 0x7389, 0x12f5: 0x73b1, - 0x12f6: 0x73d9, 0x12f7: 0x0040, 0x12f8: 0x7401, 0x12f9: 0x7429, 0x12fa: 0x7451, 0x12fb: 0x7479, - 0x12fc: 0x74a1, 0x12fd: 0x0040, 0x12fe: 0x74c9, 0x12ff: 0x0040, - // Block 0x4c, offset 0x1300 - 0x1300: 0x74f1, 0x1301: 0x7519, 0x1302: 0x0040, 0x1303: 0x7541, 0x1304: 0x7569, 0x1305: 0x0040, - 0x1306: 0x7591, 0x1307: 0x75b9, 0x1308: 0x75e1, 0x1309: 0x7609, 0x130a: 0x7631, 0x130b: 0x7659, - 0x130c: 0x7681, 0x130d: 0x76a9, 0x130e: 0x76d1, 0x130f: 0x76f9, 0x1310: 0x7721, 0x1311: 0x7721, - 0x1312: 0x7739, 0x1313: 0x7739, 0x1314: 0x7739, 0x1315: 0x7739, 0x1316: 0x7751, 0x1317: 0x7751, - 0x1318: 0x7751, 0x1319: 0x7751, 0x131a: 0x7769, 0x131b: 0x7769, 0x131c: 0x7769, 0x131d: 0x7769, - 0x131e: 0x7781, 0x131f: 0x7781, 0x1320: 0x7781, 0x1321: 0x7781, 0x1322: 0x7799, 0x1323: 0x7799, - 0x1324: 0x7799, 0x1325: 0x7799, 0x1326: 0x77b1, 0x1327: 0x77b1, 0x1328: 0x77b1, 0x1329: 0x77b1, - 0x132a: 0x77c9, 0x132b: 0x77c9, 0x132c: 0x77c9, 0x132d: 0x77c9, 0x132e: 0x77e1, 0x132f: 0x77e1, - 0x1330: 0x77e1, 0x1331: 0x77e1, 0x1332: 0x77f9, 0x1333: 0x77f9, 0x1334: 0x77f9, 0x1335: 0x77f9, - 0x1336: 0x7811, 0x1337: 0x7811, 0x1338: 0x7811, 0x1339: 0x7811, 0x133a: 0x7829, 0x133b: 0x7829, - 0x133c: 0x7829, 0x133d: 0x7829, 0x133e: 0x7841, 0x133f: 0x7841, - // Block 0x4d, offset 0x1340 - 0x1340: 0x7841, 0x1341: 0x7841, 0x1342: 0x7859, 0x1343: 0x7859, 0x1344: 0x7871, 0x1345: 0x7871, - 0x1346: 0x7889, 0x1347: 0x7889, 0x1348: 0x78a1, 0x1349: 0x78a1, 0x134a: 0x78b9, 0x134b: 0x78b9, - 0x134c: 0x78d1, 0x134d: 0x78d1, 0x134e: 0x78e9, 0x134f: 0x78e9, 0x1350: 0x78e9, 0x1351: 0x78e9, - 0x1352: 0x7901, 0x1353: 0x7901, 0x1354: 0x7901, 0x1355: 0x7901, 0x1356: 0x7919, 0x1357: 0x7919, - 0x1358: 0x7919, 0x1359: 0x7919, 0x135a: 0x7931, 0x135b: 0x7931, 0x135c: 0x7931, 0x135d: 0x7931, - 0x135e: 0x7949, 0x135f: 0x7949, 0x1360: 0x7961, 0x1361: 0x7961, 0x1362: 0x7961, 0x1363: 0x7961, - 0x1364: 0x7979, 0x1365: 0x7979, 0x1366: 0x7991, 0x1367: 0x7991, 0x1368: 0x7991, 0x1369: 0x7991, - 0x136a: 0x79a9, 0x136b: 0x79a9, 0x136c: 0x79a9, 0x136d: 0x79a9, 0x136e: 0x79c1, 0x136f: 0x79c1, - 0x1370: 0x79d9, 0x1371: 0x79d9, 0x1372: 0x0818, 0x1373: 0x0818, 0x1374: 0x0818, 0x1375: 0x0818, - 0x1376: 0x0818, 0x1377: 0x0818, 0x1378: 0x0818, 0x1379: 0x0818, 0x137a: 0x0818, 0x137b: 0x0818, - 0x137c: 0x0818, 0x137d: 0x0818, 0x137e: 0x0818, 0x137f: 0x0818, - // Block 0x4e, offset 0x1380 - 0x1380: 0x0818, 0x1381: 0x0818, 0x1382: 0x0040, 0x1383: 0x0040, 0x1384: 0x0040, 0x1385: 0x0040, - 0x1386: 0x0040, 0x1387: 0x0040, 0x1388: 0x0040, 0x1389: 0x0040, 0x138a: 0x0040, 0x138b: 0x0040, - 0x138c: 0x0040, 0x138d: 0x0040, 0x138e: 0x0040, 0x138f: 0x0040, 0x1390: 0x0040, 0x1391: 0x0040, - 0x1392: 0x0040, 0x1393: 0x79f1, 0x1394: 0x79f1, 0x1395: 0x79f1, 0x1396: 0x79f1, 0x1397: 0x7a09, - 0x1398: 0x7a09, 0x1399: 0x7a21, 0x139a: 0x7a21, 0x139b: 0x7a39, 0x139c: 0x7a39, 0x139d: 0x0479, - 0x139e: 0x7a51, 0x139f: 0x7a51, 0x13a0: 0x7a69, 0x13a1: 0x7a69, 0x13a2: 0x7a81, 0x13a3: 0x7a81, - 0x13a4: 0x7a99, 0x13a5: 0x7a99, 0x13a6: 0x7a99, 0x13a7: 0x7a99, 0x13a8: 0x7ab1, 0x13a9: 0x7ab1, - 0x13aa: 0x7ac9, 0x13ab: 0x7ac9, 0x13ac: 0x7af1, 0x13ad: 0x7af1, 0x13ae: 0x7b19, 0x13af: 0x7b19, - 0x13b0: 0x7b41, 0x13b1: 0x7b41, 0x13b2: 0x7b69, 0x13b3: 0x7b69, 0x13b4: 0x7b91, 0x13b5: 0x7b91, - 0x13b6: 0x7bb9, 0x13b7: 0x7bb9, 0x13b8: 0x7bb9, 0x13b9: 0x7be1, 0x13ba: 0x7be1, 0x13bb: 0x7be1, - 0x13bc: 0x7c09, 0x13bd: 0x7c09, 0x13be: 0x7c09, 0x13bf: 0x7c09, - // Block 0x4f, offset 0x13c0 - 0x13c0: 0x85f9, 0x13c1: 0x8621, 0x13c2: 0x8649, 0x13c3: 0x8671, 0x13c4: 0x8699, 0x13c5: 0x86c1, - 0x13c6: 0x86e9, 0x13c7: 0x8711, 0x13c8: 0x8739, 0x13c9: 0x8761, 0x13ca: 0x8789, 0x13cb: 0x87b1, - 0x13cc: 0x87d9, 0x13cd: 0x8801, 0x13ce: 0x8829, 0x13cf: 0x8851, 0x13d0: 0x8879, 0x13d1: 0x88a1, - 0x13d2: 0x88c9, 0x13d3: 0x88f1, 0x13d4: 0x8919, 0x13d5: 0x8941, 0x13d6: 0x8969, 0x13d7: 0x8991, - 0x13d8: 0x89b9, 0x13d9: 0x89e1, 0x13da: 0x8a09, 0x13db: 0x8a31, 0x13dc: 0x8a59, 0x13dd: 0x8a81, - 0x13de: 0x8aaa, 0x13df: 0x8ada, 0x13e0: 0x8b0a, 0x13e1: 0x8b3a, 0x13e2: 0x8b6a, 0x13e3: 0x8b9a, - 0x13e4: 0x8bc9, 0x13e5: 0x8bf1, 0x13e6: 0x7c71, 0x13e7: 0x8c19, 0x13e8: 0x7be1, 0x13e9: 0x7c99, - 0x13ea: 0x8c41, 0x13eb: 0x8c69, 0x13ec: 0x7d39, 0x13ed: 0x8c91, 0x13ee: 0x7d61, 0x13ef: 0x7d89, - 0x13f0: 0x8cb9, 0x13f1: 0x8ce1, 0x13f2: 0x7e29, 0x13f3: 0x8d09, 0x13f4: 0x7e51, 0x13f5: 0x7e79, - 0x13f6: 0x8d31, 0x13f7: 0x8d59, 0x13f8: 0x7ec9, 0x13f9: 0x8d81, 0x13fa: 0x7ef1, 0x13fb: 0x7f19, - 0x13fc: 0x83a1, 0x13fd: 0x83c9, 0x13fe: 0x8441, 0x13ff: 0x8469, - // Block 0x50, offset 0x1400 - 0x1400: 0x8491, 0x1401: 0x8531, 0x1402: 0x8559, 0x1403: 0x8581, 0x1404: 0x85a9, 0x1405: 0x8649, - 0x1406: 0x8671, 0x1407: 0x8699, 0x1408: 0x8da9, 0x1409: 0x8739, 0x140a: 0x8dd1, 0x140b: 0x8df9, - 0x140c: 0x8829, 0x140d: 0x8e21, 0x140e: 0x8851, 0x140f: 0x8879, 0x1410: 0x8a81, 0x1411: 0x8e49, - 0x1412: 0x8e71, 0x1413: 0x89b9, 0x1414: 0x8e99, 0x1415: 0x89e1, 0x1416: 0x8a09, 0x1417: 0x7c21, - 0x1418: 0x7c49, 0x1419: 0x8ec1, 0x141a: 0x7c71, 0x141b: 0x8ee9, 0x141c: 0x7cc1, 0x141d: 0x7ce9, - 0x141e: 0x7d11, 0x141f: 0x7d39, 0x1420: 0x8f11, 0x1421: 0x7db1, 0x1422: 0x7dd9, 0x1423: 0x7e01, - 0x1424: 0x7e29, 0x1425: 0x8f39, 0x1426: 0x7ec9, 0x1427: 0x7f41, 0x1428: 0x7f69, 0x1429: 0x7f91, - 0x142a: 0x7fb9, 0x142b: 0x7fe1, 0x142c: 0x8031, 0x142d: 0x8059, 0x142e: 0x8081, 0x142f: 0x80a9, - 0x1430: 0x80d1, 0x1431: 0x80f9, 0x1432: 0x8f61, 0x1433: 0x8121, 0x1434: 0x8149, 0x1435: 0x8171, - 0x1436: 0x8199, 0x1437: 0x81c1, 0x1438: 0x81e9, 0x1439: 0x8239, 0x143a: 0x8261, 0x143b: 0x8289, - 0x143c: 0x82b1, 0x143d: 0x82d9, 0x143e: 0x8301, 0x143f: 0x8329, - // Block 0x51, offset 0x1440 - 0x1440: 0x8351, 0x1441: 0x8379, 0x1442: 0x83f1, 0x1443: 0x8419, 0x1444: 0x84b9, 0x1445: 0x84e1, - 0x1446: 0x8509, 0x1447: 0x8531, 0x1448: 0x8559, 0x1449: 0x85d1, 0x144a: 0x85f9, 0x144b: 0x8621, - 0x144c: 0x8649, 0x144d: 0x8f89, 0x144e: 0x86c1, 0x144f: 0x86e9, 0x1450: 0x8711, 0x1451: 0x8739, - 0x1452: 0x87b1, 0x1453: 0x87d9, 0x1454: 0x8801, 0x1455: 0x8829, 0x1456: 0x8fb1, 0x1457: 0x88a1, - 0x1458: 0x88c9, 0x1459: 0x8fd9, 0x145a: 0x8941, 0x145b: 0x8969, 0x145c: 0x8991, 0x145d: 0x89b9, - 0x145e: 0x9001, 0x145f: 0x7c71, 0x1460: 0x8ee9, 0x1461: 0x7d39, 0x1462: 0x8f11, 0x1463: 0x7e29, - 0x1464: 0x8f39, 0x1465: 0x7ec9, 0x1466: 0x9029, 0x1467: 0x80d1, 0x1468: 0x9051, 0x1469: 0x9079, - 0x146a: 0x90a1, 0x146b: 0x8531, 0x146c: 0x8559, 0x146d: 0x8649, 0x146e: 0x8829, 0x146f: 0x8fb1, - 0x1470: 0x89b9, 0x1471: 0x9001, 0x1472: 0x90c9, 0x1473: 0x9101, 0x1474: 0x9139, 0x1475: 0x9171, - 0x1476: 0x9199, 0x1477: 0x91c1, 0x1478: 0x91e9, 0x1479: 0x9211, 0x147a: 0x9239, 0x147b: 0x9261, - 0x147c: 0x9289, 0x147d: 0x92b1, 0x147e: 0x92d9, 0x147f: 0x9301, - // Block 0x52, offset 0x1480 - 0x1480: 0x9329, 0x1481: 0x9351, 0x1482: 0x9379, 0x1483: 0x93a1, 0x1484: 0x93c9, 0x1485: 0x93f1, - 0x1486: 0x9419, 0x1487: 0x9441, 0x1488: 0x9469, 0x1489: 0x9491, 0x148a: 0x94b9, 0x148b: 0x94e1, - 0x148c: 0x9079, 0x148d: 0x9509, 0x148e: 0x9531, 0x148f: 0x9559, 0x1490: 0x9581, 0x1491: 0x9171, - 0x1492: 0x9199, 0x1493: 0x91c1, 0x1494: 0x91e9, 0x1495: 0x9211, 0x1496: 0x9239, 0x1497: 0x9261, - 0x1498: 0x9289, 0x1499: 0x92b1, 0x149a: 0x92d9, 0x149b: 0x9301, 0x149c: 0x9329, 0x149d: 0x9351, - 0x149e: 0x9379, 0x149f: 0x93a1, 0x14a0: 0x93c9, 0x14a1: 0x93f1, 0x14a2: 0x9419, 0x14a3: 0x9441, - 0x14a4: 0x9469, 0x14a5: 0x9491, 0x14a6: 0x94b9, 0x14a7: 0x94e1, 0x14a8: 0x9079, 0x14a9: 0x9509, - 0x14aa: 0x9531, 0x14ab: 0x9559, 0x14ac: 0x9581, 0x14ad: 0x9491, 0x14ae: 0x94b9, 0x14af: 0x94e1, - 0x14b0: 0x9079, 0x14b1: 0x9051, 0x14b2: 0x90a1, 0x14b3: 0x8211, 0x14b4: 0x8059, 0x14b5: 0x8081, - 0x14b6: 0x80a9, 0x14b7: 0x9491, 0x14b8: 0x94b9, 0x14b9: 0x94e1, 0x14ba: 0x8211, 0x14bb: 0x8239, - 0x14bc: 0x95a9, 0x14bd: 0x95a9, 0x14be: 0x0018, 0x14bf: 0x0018, - // Block 0x53, offset 0x14c0 - 0x14c0: 0x0040, 0x14c1: 0x0040, 0x14c2: 0x0040, 0x14c3: 0x0040, 0x14c4: 0x0040, 0x14c5: 0x0040, - 0x14c6: 0x0040, 0x14c7: 0x0040, 0x14c8: 0x0040, 0x14c9: 0x0040, 0x14ca: 0x0040, 0x14cb: 0x0040, - 0x14cc: 0x0040, 0x14cd: 0x0040, 0x14ce: 0x0040, 0x14cf: 0x0040, 0x14d0: 0x95d1, 0x14d1: 0x9609, - 0x14d2: 0x9609, 0x14d3: 0x9641, 0x14d4: 0x9679, 0x14d5: 0x96b1, 0x14d6: 0x96e9, 0x14d7: 0x9721, - 0x14d8: 0x9759, 0x14d9: 0x9759, 0x14da: 0x9791, 0x14db: 0x97c9, 0x14dc: 0x9801, 0x14dd: 0x9839, - 0x14de: 0x9871, 0x14df: 0x98a9, 0x14e0: 0x98a9, 0x14e1: 0x98e1, 0x14e2: 0x9919, 0x14e3: 0x9919, - 0x14e4: 0x9951, 0x14e5: 0x9951, 0x14e6: 0x9989, 0x14e7: 0x99c1, 0x14e8: 0x99c1, 0x14e9: 0x99f9, - 0x14ea: 0x9a31, 0x14eb: 0x9a31, 0x14ec: 0x9a69, 0x14ed: 0x9a69, 0x14ee: 0x9aa1, 0x14ef: 0x9ad9, - 0x14f0: 0x9ad9, 0x14f1: 0x9b11, 0x14f2: 0x9b11, 0x14f3: 0x9b49, 0x14f4: 0x9b81, 0x14f5: 0x9bb9, - 0x14f6: 0x9bf1, 0x14f7: 0x9bf1, 0x14f8: 0x9c29, 0x14f9: 0x9c61, 0x14fa: 0x9c99, 0x14fb: 0x9cd1, - 0x14fc: 0x9d09, 0x14fd: 0x9d09, 0x14fe: 0x9d41, 0x14ff: 0x9d79, - // Block 0x54, offset 0x1500 - 0x1500: 0xa949, 0x1501: 0xa981, 0x1502: 0xa9b9, 0x1503: 0xa8a1, 0x1504: 0x9bb9, 0x1505: 0x9989, - 0x1506: 0xa9f1, 0x1507: 0xaa29, 0x1508: 0x0040, 0x1509: 0x0040, 0x150a: 0x0040, 0x150b: 0x0040, - 0x150c: 0x0040, 0x150d: 0x0040, 0x150e: 0x0040, 0x150f: 0x0040, 0x1510: 0x0040, 0x1511: 0x0040, - 0x1512: 0x0040, 0x1513: 0x0040, 0x1514: 0x0040, 0x1515: 0x0040, 0x1516: 0x0040, 0x1517: 0x0040, - 0x1518: 0x0040, 0x1519: 0x0040, 0x151a: 0x0040, 0x151b: 0x0040, 0x151c: 0x0040, 0x151d: 0x0040, - 0x151e: 0x0040, 0x151f: 0x0040, 0x1520: 0x0040, 0x1521: 0x0040, 0x1522: 0x0040, 0x1523: 0x0040, - 0x1524: 0x0040, 0x1525: 0x0040, 0x1526: 0x0040, 0x1527: 0x0040, 0x1528: 0x0040, 0x1529: 0x0040, - 0x152a: 0x0040, 0x152b: 0x0040, 0x152c: 0x0040, 0x152d: 0x0040, 0x152e: 0x0040, 0x152f: 0x0040, - 0x1530: 0xaa61, 0x1531: 0xaa99, 0x1532: 0xaad1, 0x1533: 0xab19, 0x1534: 0xab61, 0x1535: 0xaba9, - 0x1536: 0xabf1, 0x1537: 0xac39, 0x1538: 0xac81, 0x1539: 0xacc9, 0x153a: 0xad02, 0x153b: 0xae12, - 0x153c: 0xae91, 0x153d: 0x0018, 0x153e: 0x0040, 0x153f: 0x0040, - // Block 0x55, offset 0x1540 - 0x1540: 0x33c0, 0x1541: 0x33c0, 0x1542: 0x33c0, 0x1543: 0x33c0, 0x1544: 0x33c0, 0x1545: 0x33c0, - 0x1546: 0x33c0, 0x1547: 0x33c0, 0x1548: 0x33c0, 0x1549: 0x33c0, 0x154a: 0x33c0, 0x154b: 0x33c0, - 0x154c: 0x33c0, 0x154d: 0x33c0, 0x154e: 0x33c0, 0x154f: 0x33c0, 0x1550: 0xaeda, 0x1551: 0x7d55, - 0x1552: 0x0040, 0x1553: 0xaeea, 0x1554: 0x03c2, 0x1555: 0xaefa, 0x1556: 0xaf0a, 0x1557: 0x7d75, - 0x1558: 0x7d95, 0x1559: 0x0040, 0x155a: 0x0040, 0x155b: 0x0040, 0x155c: 0x0040, 0x155d: 0x0040, - 0x155e: 0x0040, 0x155f: 0x0040, 0x1560: 0x3308, 0x1561: 0x3308, 0x1562: 0x3308, 0x1563: 0x3308, - 0x1564: 0x3308, 0x1565: 0x3308, 0x1566: 0x3308, 0x1567: 0x3308, 0x1568: 0x3308, 0x1569: 0x3308, - 0x156a: 0x3308, 0x156b: 0x3308, 0x156c: 0x3308, 0x156d: 0x3308, 0x156e: 0x3308, 0x156f: 0x3308, - 0x1570: 0x0040, 0x1571: 0x7db5, 0x1572: 0x7dd5, 0x1573: 0xaf1a, 0x1574: 0xaf1a, 0x1575: 0x1fd2, - 0x1576: 0x1fe2, 0x1577: 0xaf2a, 0x1578: 0xaf3a, 0x1579: 0x7df5, 0x157a: 0x7e15, 0x157b: 0x7e35, - 0x157c: 0x7df5, 0x157d: 0x7e55, 0x157e: 0x7e75, 0x157f: 0x7e55, - // Block 0x56, offset 0x1580 - 0x1580: 0x7e95, 0x1581: 0x7eb5, 0x1582: 0x7ed5, 0x1583: 0x7eb5, 0x1584: 0x7ef5, 0x1585: 0x0018, - 0x1586: 0x0018, 0x1587: 0xaf4a, 0x1588: 0xaf5a, 0x1589: 0x7f16, 0x158a: 0x7f36, 0x158b: 0x7f56, - 0x158c: 0x7f76, 0x158d: 0xaf1a, 0x158e: 0xaf1a, 0x158f: 0xaf1a, 0x1590: 0xaeda, 0x1591: 0x7f95, - 0x1592: 0x0040, 0x1593: 0x0040, 0x1594: 0x03c2, 0x1595: 0xaeea, 0x1596: 0xaf0a, 0x1597: 0xaefa, - 0x1598: 0x7fb5, 0x1599: 0x1fd2, 0x159a: 0x1fe2, 0x159b: 0xaf2a, 0x159c: 0xaf3a, 0x159d: 0x7e95, - 0x159e: 0x7ef5, 0x159f: 0xaf6a, 0x15a0: 0xaf7a, 0x15a1: 0xaf8a, 0x15a2: 0x1fb2, 0x15a3: 0xaf99, - 0x15a4: 0xafaa, 0x15a5: 0xafba, 0x15a6: 0x1fc2, 0x15a7: 0x0040, 0x15a8: 0xafca, 0x15a9: 0xafda, - 0x15aa: 0xafea, 0x15ab: 0xaffa, 0x15ac: 0x0040, 0x15ad: 0x0040, 0x15ae: 0x0040, 0x15af: 0x0040, - 0x15b0: 0x7fd6, 0x15b1: 0xb009, 0x15b2: 0x7ff6, 0x15b3: 0x0808, 0x15b4: 0x8016, 0x15b5: 0x0040, - 0x15b6: 0x8036, 0x15b7: 0xb031, 0x15b8: 0x8056, 0x15b9: 0xb059, 0x15ba: 0x8076, 0x15bb: 0xb081, - 0x15bc: 0x8096, 0x15bd: 0xb0a9, 0x15be: 0x80b6, 0x15bf: 0xb0d1, - // Block 0x57, offset 0x15c0 - 0x15c0: 0xb0f9, 0x15c1: 0xb111, 0x15c2: 0xb111, 0x15c3: 0xb129, 0x15c4: 0xb129, 0x15c5: 0xb141, - 0x15c6: 0xb141, 0x15c7: 0xb159, 0x15c8: 0xb159, 0x15c9: 0xb171, 0x15ca: 0xb171, 0x15cb: 0xb171, - 0x15cc: 0xb171, 0x15cd: 0xb189, 0x15ce: 0xb189, 0x15cf: 0xb1a1, 0x15d0: 0xb1a1, 0x15d1: 0xb1a1, - 0x15d2: 0xb1a1, 0x15d3: 0xb1b9, 0x15d4: 0xb1b9, 0x15d5: 0xb1d1, 0x15d6: 0xb1d1, 0x15d7: 0xb1d1, - 0x15d8: 0xb1d1, 0x15d9: 0xb1e9, 0x15da: 0xb1e9, 0x15db: 0xb1e9, 0x15dc: 0xb1e9, 0x15dd: 0xb201, - 0x15de: 0xb201, 0x15df: 0xb201, 0x15e0: 0xb201, 0x15e1: 0xb219, 0x15e2: 0xb219, 0x15e3: 0xb219, - 0x15e4: 0xb219, 0x15e5: 0xb231, 0x15e6: 0xb231, 0x15e7: 0xb231, 0x15e8: 0xb231, 0x15e9: 0xb249, - 0x15ea: 0xb249, 0x15eb: 0xb261, 0x15ec: 0xb261, 0x15ed: 0xb279, 0x15ee: 0xb279, 0x15ef: 0xb291, - 0x15f0: 0xb291, 0x15f1: 0xb2a9, 0x15f2: 0xb2a9, 0x15f3: 0xb2a9, 0x15f4: 0xb2a9, 0x15f5: 0xb2c1, - 0x15f6: 0xb2c1, 0x15f7: 0xb2c1, 0x15f8: 0xb2c1, 0x15f9: 0xb2d9, 0x15fa: 0xb2d9, 0x15fb: 0xb2d9, - 0x15fc: 0xb2d9, 0x15fd: 0xb2f1, 0x15fe: 0xb2f1, 0x15ff: 0xb2f1, - // Block 0x58, offset 0x1600 - 0x1600: 0xb2f1, 0x1601: 0xb309, 0x1602: 0xb309, 0x1603: 0xb309, 0x1604: 0xb309, 0x1605: 0xb321, - 0x1606: 0xb321, 0x1607: 0xb321, 0x1608: 0xb321, 0x1609: 0xb339, 0x160a: 0xb339, 0x160b: 0xb339, - 0x160c: 0xb339, 0x160d: 0xb351, 0x160e: 0xb351, 0x160f: 0xb351, 0x1610: 0xb351, 0x1611: 0xb369, - 0x1612: 0xb369, 0x1613: 0xb369, 0x1614: 0xb369, 0x1615: 0xb381, 0x1616: 0xb381, 0x1617: 0xb381, - 0x1618: 0xb381, 0x1619: 0xb399, 0x161a: 0xb399, 0x161b: 0xb399, 0x161c: 0xb399, 0x161d: 0xb3b1, - 0x161e: 0xb3b1, 0x161f: 0xb3b1, 0x1620: 0xb3b1, 0x1621: 0xb3c9, 0x1622: 0xb3c9, 0x1623: 0xb3c9, - 0x1624: 0xb3c9, 0x1625: 0xb3e1, 0x1626: 0xb3e1, 0x1627: 0xb3e1, 0x1628: 0xb3e1, 0x1629: 0xb3f9, - 0x162a: 0xb3f9, 0x162b: 0xb3f9, 0x162c: 0xb3f9, 0x162d: 0xb411, 0x162e: 0xb411, 0x162f: 0x7ab1, - 0x1630: 0x7ab1, 0x1631: 0xb429, 0x1632: 0xb429, 0x1633: 0xb429, 0x1634: 0xb429, 0x1635: 0xb441, - 0x1636: 0xb441, 0x1637: 0xb469, 0x1638: 0xb469, 0x1639: 0xb491, 0x163a: 0xb491, 0x163b: 0xb4b9, - 0x163c: 0xb4b9, 0x163d: 0x0040, 0x163e: 0x0040, 0x163f: 0x03c0, - // Block 0x59, offset 0x1640 - 0x1640: 0x0040, 0x1641: 0xaefa, 0x1642: 0xb4e2, 0x1643: 0xaf6a, 0x1644: 0xafda, 0x1645: 0xafea, - 0x1646: 0xaf7a, 0x1647: 0xb4f2, 0x1648: 0x1fd2, 0x1649: 0x1fe2, 0x164a: 0xaf8a, 0x164b: 0x1fb2, - 0x164c: 0xaeda, 0x164d: 0xaf99, 0x164e: 0x29d1, 0x164f: 0xb502, 0x1650: 0x1f41, 0x1651: 0x00c9, - 0x1652: 0x0069, 0x1653: 0x0079, 0x1654: 0x1f51, 0x1655: 0x1f61, 0x1656: 0x1f71, 0x1657: 0x1f81, - 0x1658: 0x1f91, 0x1659: 0x1fa1, 0x165a: 0xaeea, 0x165b: 0x03c2, 0x165c: 0xafaa, 0x165d: 0x1fc2, - 0x165e: 0xafba, 0x165f: 0xaf0a, 0x1660: 0xaffa, 0x1661: 0x0039, 0x1662: 0x0ee9, 0x1663: 0x1159, - 0x1664: 0x0ef9, 0x1665: 0x0f09, 0x1666: 0x1199, 0x1667: 0x0f31, 0x1668: 0x0249, 0x1669: 0x0f41, - 0x166a: 0x0259, 0x166b: 0x0f51, 0x166c: 0x0359, 0x166d: 0x0f61, 0x166e: 0x0f71, 0x166f: 0x00d9, - 0x1670: 0x0f99, 0x1671: 0x2039, 0x1672: 0x0269, 0x1673: 0x01d9, 0x1674: 0x0fa9, 0x1675: 0x0fb9, - 0x1676: 0x1089, 0x1677: 0x0279, 0x1678: 0x0369, 0x1679: 0x0289, 0x167a: 0x13d1, 0x167b: 0xaf4a, - 0x167c: 0xafca, 0x167d: 0xaf5a, 0x167e: 0xb512, 0x167f: 0xaf1a, - // Block 0x5a, offset 0x1680 - 0x1680: 0x1caa, 0x1681: 0x0039, 0x1682: 0x0ee9, 0x1683: 0x1159, 0x1684: 0x0ef9, 0x1685: 0x0f09, - 0x1686: 0x1199, 0x1687: 0x0f31, 0x1688: 0x0249, 0x1689: 0x0f41, 0x168a: 0x0259, 0x168b: 0x0f51, - 0x168c: 0x0359, 0x168d: 0x0f61, 0x168e: 0x0f71, 0x168f: 0x00d9, 0x1690: 0x0f99, 0x1691: 0x2039, - 0x1692: 0x0269, 0x1693: 0x01d9, 0x1694: 0x0fa9, 0x1695: 0x0fb9, 0x1696: 0x1089, 0x1697: 0x0279, - 0x1698: 0x0369, 0x1699: 0x0289, 0x169a: 0x13d1, 0x169b: 0xaf2a, 0x169c: 0xb522, 0x169d: 0xaf3a, - 0x169e: 0xb532, 0x169f: 0x80d5, 0x16a0: 0x80f5, 0x16a1: 0x29d1, 0x16a2: 0x8115, 0x16a3: 0x8115, - 0x16a4: 0x8135, 0x16a5: 0x8155, 0x16a6: 0x8175, 0x16a7: 0x8195, 0x16a8: 0x81b5, 0x16a9: 0x81d5, - 0x16aa: 0x81f5, 0x16ab: 0x8215, 0x16ac: 0x8235, 0x16ad: 0x8255, 0x16ae: 0x8275, 0x16af: 0x8295, - 0x16b0: 0x82b5, 0x16b1: 0x82d5, 0x16b2: 0x82f5, 0x16b3: 0x8315, 0x16b4: 0x8335, 0x16b5: 0x8355, - 0x16b6: 0x8375, 0x16b7: 0x8395, 0x16b8: 0x83b5, 0x16b9: 0x83d5, 0x16ba: 0x83f5, 0x16bb: 0x8415, - 0x16bc: 0x81b5, 0x16bd: 0x8435, 0x16be: 0x8455, 0x16bf: 0x8215, - // Block 0x5b, offset 0x16c0 - 0x16c0: 0x8475, 0x16c1: 0x8495, 0x16c2: 0x84b5, 0x16c3: 0x84d5, 0x16c4: 0x84f5, 0x16c5: 0x8515, - 0x16c6: 0x8535, 0x16c7: 0x8555, 0x16c8: 0x84d5, 0x16c9: 0x8575, 0x16ca: 0x84d5, 0x16cb: 0x8595, - 0x16cc: 0x8595, 0x16cd: 0x85b5, 0x16ce: 0x85b5, 0x16cf: 0x85d5, 0x16d0: 0x8515, 0x16d1: 0x85f5, - 0x16d2: 0x8615, 0x16d3: 0x85f5, 0x16d4: 0x8635, 0x16d5: 0x8615, 0x16d6: 0x8655, 0x16d7: 0x8655, - 0x16d8: 0x8675, 0x16d9: 0x8675, 0x16da: 0x8695, 0x16db: 0x8695, 0x16dc: 0x8615, 0x16dd: 0x8115, - 0x16de: 0x86b5, 0x16df: 0x86d5, 0x16e0: 0x0040, 0x16e1: 0x86f5, 0x16e2: 0x8715, 0x16e3: 0x8735, - 0x16e4: 0x8755, 0x16e5: 0x8735, 0x16e6: 0x8775, 0x16e7: 0x8795, 0x16e8: 0x87b5, 0x16e9: 0x87b5, - 0x16ea: 0x87d5, 0x16eb: 0x87d5, 0x16ec: 0x87f5, 0x16ed: 0x87f5, 0x16ee: 0x87d5, 0x16ef: 0x87d5, - 0x16f0: 0x8815, 0x16f1: 0x8835, 0x16f2: 0x8855, 0x16f3: 0x8875, 0x16f4: 0x8895, 0x16f5: 0x88b5, - 0x16f6: 0x88b5, 0x16f7: 0x88b5, 0x16f8: 0x88d5, 0x16f9: 0x88d5, 0x16fa: 0x88d5, 0x16fb: 0x88d5, - 0x16fc: 0x87b5, 0x16fd: 0x87b5, 0x16fe: 0x87b5, 0x16ff: 0x0040, - // Block 0x5c, offset 0x1700 - 0x1700: 0x0040, 0x1701: 0x0040, 0x1702: 0x8715, 0x1703: 0x86f5, 0x1704: 0x88f5, 0x1705: 0x86f5, - 0x1706: 0x8715, 0x1707: 0x86f5, 0x1708: 0x0040, 0x1709: 0x0040, 0x170a: 0x8915, 0x170b: 0x8715, - 0x170c: 0x8935, 0x170d: 0x88f5, 0x170e: 0x8935, 0x170f: 0x8715, 0x1710: 0x0040, 0x1711: 0x0040, - 0x1712: 0x8955, 0x1713: 0x8975, 0x1714: 0x8875, 0x1715: 0x8935, 0x1716: 0x88f5, 0x1717: 0x8935, - 0x1718: 0x0040, 0x1719: 0x0040, 0x171a: 0x8995, 0x171b: 0x89b5, 0x171c: 0x8995, 0x171d: 0x0040, - 0x171e: 0x0040, 0x171f: 0x0040, 0x1720: 0xb541, 0x1721: 0xb559, 0x1722: 0xb571, 0x1723: 0x89d6, - 0x1724: 0xb589, 0x1725: 0xb5a1, 0x1726: 0x89f5, 0x1727: 0x0040, 0x1728: 0x8a15, 0x1729: 0x8a35, - 0x172a: 0x8a55, 0x172b: 0x8a35, 0x172c: 0x8a75, 0x172d: 0x8a95, 0x172e: 0x8ab5, 0x172f: 0x0040, - 0x1730: 0x0040, 0x1731: 0x0040, 0x1732: 0x0040, 0x1733: 0x0040, 0x1734: 0x0040, 0x1735: 0x0040, - 0x1736: 0x0040, 0x1737: 0x0040, 0x1738: 0x0040, 0x1739: 0x0340, 0x173a: 0x0340, 0x173b: 0x0340, - 0x173c: 0x0040, 0x173d: 0x0040, 0x173e: 0x0040, 0x173f: 0x0040, - // Block 0x5d, offset 0x1740 - 0x1740: 0x0a08, 0x1741: 0x0a08, 0x1742: 0x0a08, 0x1743: 0x0a08, 0x1744: 0x0a08, 0x1745: 0x0c08, - 0x1746: 0x0808, 0x1747: 0x0c08, 0x1748: 0x0818, 0x1749: 0x0c08, 0x174a: 0x0c08, 0x174b: 0x0808, - 0x174c: 0x0808, 0x174d: 0x0908, 0x174e: 0x0c08, 0x174f: 0x0c08, 0x1750: 0x0c08, 0x1751: 0x0c08, - 0x1752: 0x0c08, 0x1753: 0x0a08, 0x1754: 0x0a08, 0x1755: 0x0a08, 0x1756: 0x0a08, 0x1757: 0x0908, - 0x1758: 0x0a08, 0x1759: 0x0a08, 0x175a: 0x0a08, 0x175b: 0x0a08, 0x175c: 0x0a08, 0x175d: 0x0c08, - 0x175e: 0x0a08, 0x175f: 0x0a08, 0x1760: 0x0a08, 0x1761: 0x0c08, 0x1762: 0x0808, 0x1763: 0x0808, - 0x1764: 0x0c08, 0x1765: 0x3308, 0x1766: 0x3308, 0x1767: 0x0040, 0x1768: 0x0040, 0x1769: 0x0040, - 0x176a: 0x0040, 0x176b: 0x0a18, 0x176c: 0x0a18, 0x176d: 0x0a18, 0x176e: 0x0a18, 0x176f: 0x0c18, - 0x1770: 0x0818, 0x1771: 0x0818, 0x1772: 0x0818, 0x1773: 0x0818, 0x1774: 0x0818, 0x1775: 0x0818, - 0x1776: 0x0818, 0x1777: 0x0040, 0x1778: 0x0040, 0x1779: 0x0040, 0x177a: 0x0040, 0x177b: 0x0040, - 0x177c: 0x0040, 0x177d: 0x0040, 0x177e: 0x0040, 0x177f: 0x0040, - // Block 0x5e, offset 0x1780 - 0x1780: 0x0a08, 0x1781: 0x0c08, 0x1782: 0x0a08, 0x1783: 0x0c08, 0x1784: 0x0c08, 0x1785: 0x0c08, - 0x1786: 0x0a08, 0x1787: 0x0a08, 0x1788: 0x0a08, 0x1789: 0x0c08, 0x178a: 0x0a08, 0x178b: 0x0a08, - 0x178c: 0x0c08, 0x178d: 0x0a08, 0x178e: 0x0c08, 0x178f: 0x0c08, 0x1790: 0x0a08, 0x1791: 0x0c08, - 0x1792: 0x0040, 0x1793: 0x0040, 0x1794: 0x0040, 0x1795: 0x0040, 0x1796: 0x0040, 0x1797: 0x0040, - 0x1798: 0x0040, 0x1799: 0x0818, 0x179a: 0x0818, 0x179b: 0x0818, 0x179c: 0x0818, 0x179d: 0x0040, - 0x179e: 0x0040, 0x179f: 0x0040, 0x17a0: 0x0040, 0x17a1: 0x0040, 0x17a2: 0x0040, 0x17a3: 0x0040, - 0x17a4: 0x0040, 0x17a5: 0x0040, 0x17a6: 0x0040, 0x17a7: 0x0040, 0x17a8: 0x0040, 0x17a9: 0x0c18, - 0x17aa: 0x0c18, 0x17ab: 0x0c18, 0x17ac: 0x0c18, 0x17ad: 0x0a18, 0x17ae: 0x0a18, 0x17af: 0x0818, - 0x17b0: 0x0040, 0x17b1: 0x0040, 0x17b2: 0x0040, 0x17b3: 0x0040, 0x17b4: 0x0040, 0x17b5: 0x0040, - 0x17b6: 0x0040, 0x17b7: 0x0040, 0x17b8: 0x0040, 0x17b9: 0x0040, 0x17ba: 0x0040, 0x17bb: 0x0040, - 0x17bc: 0x0040, 0x17bd: 0x0040, 0x17be: 0x0040, 0x17bf: 0x0040, - // Block 0x5f, offset 0x17c0 - 0x17c0: 0x3308, 0x17c1: 0x3308, 0x17c2: 0x3008, 0x17c3: 0x3008, 0x17c4: 0x0040, 0x17c5: 0x0008, - 0x17c6: 0x0008, 0x17c7: 0x0008, 0x17c8: 0x0008, 0x17c9: 0x0008, 0x17ca: 0x0008, 0x17cb: 0x0008, - 0x17cc: 0x0008, 0x17cd: 0x0040, 0x17ce: 0x0040, 0x17cf: 0x0008, 0x17d0: 0x0008, 0x17d1: 0x0040, - 0x17d2: 0x0040, 0x17d3: 0x0008, 0x17d4: 0x0008, 0x17d5: 0x0008, 0x17d6: 0x0008, 0x17d7: 0x0008, - 0x17d8: 0x0008, 0x17d9: 0x0008, 0x17da: 0x0008, 0x17db: 0x0008, 0x17dc: 0x0008, 0x17dd: 0x0008, - 0x17de: 0x0008, 0x17df: 0x0008, 0x17e0: 0x0008, 0x17e1: 0x0008, 0x17e2: 0x0008, 0x17e3: 0x0008, - 0x17e4: 0x0008, 0x17e5: 0x0008, 0x17e6: 0x0008, 0x17e7: 0x0008, 0x17e8: 0x0008, 0x17e9: 0x0040, - 0x17ea: 0x0008, 0x17eb: 0x0008, 0x17ec: 0x0008, 0x17ed: 0x0008, 0x17ee: 0x0008, 0x17ef: 0x0008, - 0x17f0: 0x0008, 0x17f1: 0x0040, 0x17f2: 0x0008, 0x17f3: 0x0008, 0x17f4: 0x0040, 0x17f5: 0x0008, - 0x17f6: 0x0008, 0x17f7: 0x0008, 0x17f8: 0x0008, 0x17f9: 0x0008, 0x17fa: 0x0040, 0x17fb: 0x0040, - 0x17fc: 0x3308, 0x17fd: 0x0008, 0x17fe: 0x3008, 0x17ff: 0x3008, - // Block 0x60, offset 0x1800 - 0x1800: 0x3308, 0x1801: 0x3008, 0x1802: 0x3008, 0x1803: 0x3008, 0x1804: 0x3008, 0x1805: 0x0040, - 0x1806: 0x0040, 0x1807: 0x3008, 0x1808: 0x3008, 0x1809: 0x0040, 0x180a: 0x0040, 0x180b: 0x3008, - 0x180c: 0x3008, 0x180d: 0x3808, 0x180e: 0x0040, 0x180f: 0x0040, 0x1810: 0x0008, 0x1811: 0x0040, - 0x1812: 0x0040, 0x1813: 0x0040, 0x1814: 0x0040, 0x1815: 0x0040, 0x1816: 0x0040, 0x1817: 0x3008, - 0x1818: 0x0040, 0x1819: 0x0040, 0x181a: 0x0040, 0x181b: 0x0040, 0x181c: 0x0040, 0x181d: 0x0008, - 0x181e: 0x0008, 0x181f: 0x0008, 0x1820: 0x0008, 0x1821: 0x0008, 0x1822: 0x3008, 0x1823: 0x3008, - 0x1824: 0x0040, 0x1825: 0x0040, 0x1826: 0x3308, 0x1827: 0x3308, 0x1828: 0x3308, 0x1829: 0x3308, - 0x182a: 0x3308, 0x182b: 0x3308, 0x182c: 0x3308, 0x182d: 0x0040, 0x182e: 0x0040, 0x182f: 0x0040, - 0x1830: 0x3308, 0x1831: 0x3308, 0x1832: 0x3308, 0x1833: 0x3308, 0x1834: 0x3308, 0x1835: 0x0040, - 0x1836: 0x0040, 0x1837: 0x0040, 0x1838: 0x0040, 0x1839: 0x0040, 0x183a: 0x0040, 0x183b: 0x0040, - 0x183c: 0x0040, 0x183d: 0x0040, 0x183e: 0x0040, 0x183f: 0x0040, - // Block 0x61, offset 0x1840 - 0x1840: 0x0039, 0x1841: 0x0ee9, 0x1842: 0x1159, 0x1843: 0x0ef9, 0x1844: 0x0f09, 0x1845: 0x1199, - 0x1846: 0x0f31, 0x1847: 0x0249, 0x1848: 0x0f41, 0x1849: 0x0259, 0x184a: 0x0f51, 0x184b: 0x0359, - 0x184c: 0x0f61, 0x184d: 0x0f71, 0x184e: 0x00d9, 0x184f: 0x0f99, 0x1850: 0x2039, 0x1851: 0x0269, - 0x1852: 0x01d9, 0x1853: 0x0fa9, 0x1854: 0x0fb9, 0x1855: 0x1089, 0x1856: 0x0279, 0x1857: 0x0369, - 0x1858: 0x0289, 0x1859: 0x13d1, 0x185a: 0x0039, 0x185b: 0x0ee9, 0x185c: 0x1159, 0x185d: 0x0ef9, - 0x185e: 0x0f09, 0x185f: 0x1199, 0x1860: 0x0f31, 0x1861: 0x0249, 0x1862: 0x0f41, 0x1863: 0x0259, - 0x1864: 0x0f51, 0x1865: 0x0359, 0x1866: 0x0f61, 0x1867: 0x0f71, 0x1868: 0x00d9, 0x1869: 0x0f99, - 0x186a: 0x2039, 0x186b: 0x0269, 0x186c: 0x01d9, 0x186d: 0x0fa9, 0x186e: 0x0fb9, 0x186f: 0x1089, - 0x1870: 0x0279, 0x1871: 0x0369, 0x1872: 0x0289, 0x1873: 0x13d1, 0x1874: 0x0039, 0x1875: 0x0ee9, - 0x1876: 0x1159, 0x1877: 0x0ef9, 0x1878: 0x0f09, 0x1879: 0x1199, 0x187a: 0x0f31, 0x187b: 0x0249, - 0x187c: 0x0f41, 0x187d: 0x0259, 0x187e: 0x0f51, 0x187f: 0x0359, - // Block 0x62, offset 0x1880 - 0x1880: 0x0f61, 0x1881: 0x0f71, 0x1882: 0x00d9, 0x1883: 0x0f99, 0x1884: 0x2039, 0x1885: 0x0269, - 0x1886: 0x01d9, 0x1887: 0x0fa9, 0x1888: 0x0fb9, 0x1889: 0x1089, 0x188a: 0x0279, 0x188b: 0x0369, - 0x188c: 0x0289, 0x188d: 0x13d1, 0x188e: 0x0039, 0x188f: 0x0ee9, 0x1890: 0x1159, 0x1891: 0x0ef9, - 0x1892: 0x0f09, 0x1893: 0x1199, 0x1894: 0x0f31, 0x1895: 0x0040, 0x1896: 0x0f41, 0x1897: 0x0259, - 0x1898: 0x0f51, 0x1899: 0x0359, 0x189a: 0x0f61, 0x189b: 0x0f71, 0x189c: 0x00d9, 0x189d: 0x0f99, - 0x189e: 0x2039, 0x189f: 0x0269, 0x18a0: 0x01d9, 0x18a1: 0x0fa9, 0x18a2: 0x0fb9, 0x18a3: 0x1089, - 0x18a4: 0x0279, 0x18a5: 0x0369, 0x18a6: 0x0289, 0x18a7: 0x13d1, 0x18a8: 0x0039, 0x18a9: 0x0ee9, - 0x18aa: 0x1159, 0x18ab: 0x0ef9, 0x18ac: 0x0f09, 0x18ad: 0x1199, 0x18ae: 0x0f31, 0x18af: 0x0249, - 0x18b0: 0x0f41, 0x18b1: 0x0259, 0x18b2: 0x0f51, 0x18b3: 0x0359, 0x18b4: 0x0f61, 0x18b5: 0x0f71, - 0x18b6: 0x00d9, 0x18b7: 0x0f99, 0x18b8: 0x2039, 0x18b9: 0x0269, 0x18ba: 0x01d9, 0x18bb: 0x0fa9, - 0x18bc: 0x0fb9, 0x18bd: 0x1089, 0x18be: 0x0279, 0x18bf: 0x0369, - // Block 0x63, offset 0x18c0 - 0x18c0: 0x0289, 0x18c1: 0x13d1, 0x18c2: 0x0039, 0x18c3: 0x0ee9, 0x18c4: 0x1159, 0x18c5: 0x0ef9, - 0x18c6: 0x0f09, 0x18c7: 0x1199, 0x18c8: 0x0f31, 0x18c9: 0x0249, 0x18ca: 0x0f41, 0x18cb: 0x0259, - 0x18cc: 0x0f51, 0x18cd: 0x0359, 0x18ce: 0x0f61, 0x18cf: 0x0f71, 0x18d0: 0x00d9, 0x18d1: 0x0f99, - 0x18d2: 0x2039, 0x18d3: 0x0269, 0x18d4: 0x01d9, 0x18d5: 0x0fa9, 0x18d6: 0x0fb9, 0x18d7: 0x1089, - 0x18d8: 0x0279, 0x18d9: 0x0369, 0x18da: 0x0289, 0x18db: 0x13d1, 0x18dc: 0x0039, 0x18dd: 0x0040, - 0x18de: 0x1159, 0x18df: 0x0ef9, 0x18e0: 0x0040, 0x18e1: 0x0040, 0x18e2: 0x0f31, 0x18e3: 0x0040, - 0x18e4: 0x0040, 0x18e5: 0x0259, 0x18e6: 0x0f51, 0x18e7: 0x0040, 0x18e8: 0x0040, 0x18e9: 0x0f71, - 0x18ea: 0x00d9, 0x18eb: 0x0f99, 0x18ec: 0x2039, 0x18ed: 0x0040, 0x18ee: 0x01d9, 0x18ef: 0x0fa9, - 0x18f0: 0x0fb9, 0x18f1: 0x1089, 0x18f2: 0x0279, 0x18f3: 0x0369, 0x18f4: 0x0289, 0x18f5: 0x13d1, - 0x18f6: 0x0039, 0x18f7: 0x0ee9, 0x18f8: 0x1159, 0x18f9: 0x0ef9, 0x18fa: 0x0040, 0x18fb: 0x1199, - 0x18fc: 0x0040, 0x18fd: 0x0249, 0x18fe: 0x0f41, 0x18ff: 0x0259, - // Block 0x64, offset 0x1900 - 0x1900: 0x0f51, 0x1901: 0x0359, 0x1902: 0x0f61, 0x1903: 0x0f71, 0x1904: 0x0040, 0x1905: 0x0f99, - 0x1906: 0x2039, 0x1907: 0x0269, 0x1908: 0x01d9, 0x1909: 0x0fa9, 0x190a: 0x0fb9, 0x190b: 0x1089, - 0x190c: 0x0279, 0x190d: 0x0369, 0x190e: 0x0289, 0x190f: 0x13d1, 0x1910: 0x0039, 0x1911: 0x0ee9, - 0x1912: 0x1159, 0x1913: 0x0ef9, 0x1914: 0x0f09, 0x1915: 0x1199, 0x1916: 0x0f31, 0x1917: 0x0249, - 0x1918: 0x0f41, 0x1919: 0x0259, 0x191a: 0x0f51, 0x191b: 0x0359, 0x191c: 0x0f61, 0x191d: 0x0f71, - 0x191e: 0x00d9, 0x191f: 0x0f99, 0x1920: 0x2039, 0x1921: 0x0269, 0x1922: 0x01d9, 0x1923: 0x0fa9, - 0x1924: 0x0fb9, 0x1925: 0x1089, 0x1926: 0x0279, 0x1927: 0x0369, 0x1928: 0x0289, 0x1929: 0x13d1, - 0x192a: 0x0039, 0x192b: 0x0ee9, 0x192c: 0x1159, 0x192d: 0x0ef9, 0x192e: 0x0f09, 0x192f: 0x1199, - 0x1930: 0x0f31, 0x1931: 0x0249, 0x1932: 0x0f41, 0x1933: 0x0259, 0x1934: 0x0f51, 0x1935: 0x0359, - 0x1936: 0x0f61, 0x1937: 0x0f71, 0x1938: 0x00d9, 0x1939: 0x0f99, 0x193a: 0x2039, 0x193b: 0x0269, - 0x193c: 0x01d9, 0x193d: 0x0fa9, 0x193e: 0x0fb9, 0x193f: 0x1089, - // Block 0x65, offset 0x1940 - 0x1940: 0x0279, 0x1941: 0x0369, 0x1942: 0x0289, 0x1943: 0x13d1, 0x1944: 0x0039, 0x1945: 0x0ee9, - 0x1946: 0x0040, 0x1947: 0x0ef9, 0x1948: 0x0f09, 0x1949: 0x1199, 0x194a: 0x0f31, 0x194b: 0x0040, - 0x194c: 0x0040, 0x194d: 0x0259, 0x194e: 0x0f51, 0x194f: 0x0359, 0x1950: 0x0f61, 0x1951: 0x0f71, - 0x1952: 0x00d9, 0x1953: 0x0f99, 0x1954: 0x2039, 0x1955: 0x0040, 0x1956: 0x01d9, 0x1957: 0x0fa9, - 0x1958: 0x0fb9, 0x1959: 0x1089, 0x195a: 0x0279, 0x195b: 0x0369, 0x195c: 0x0289, 0x195d: 0x0040, - 0x195e: 0x0039, 0x195f: 0x0ee9, 0x1960: 0x1159, 0x1961: 0x0ef9, 0x1962: 0x0f09, 0x1963: 0x1199, - 0x1964: 0x0f31, 0x1965: 0x0249, 0x1966: 0x0f41, 0x1967: 0x0259, 0x1968: 0x0f51, 0x1969: 0x0359, - 0x196a: 0x0f61, 0x196b: 0x0f71, 0x196c: 0x00d9, 0x196d: 0x0f99, 0x196e: 0x2039, 0x196f: 0x0269, - 0x1970: 0x01d9, 0x1971: 0x0fa9, 0x1972: 0x0fb9, 0x1973: 0x1089, 0x1974: 0x0279, 0x1975: 0x0369, - 0x1976: 0x0289, 0x1977: 0x13d1, 0x1978: 0x0039, 0x1979: 0x0ee9, 0x197a: 0x0040, 0x197b: 0x0ef9, - 0x197c: 0x0f09, 0x197d: 0x1199, 0x197e: 0x0f31, 0x197f: 0x0040, - // Block 0x66, offset 0x1980 - 0x1980: 0x0f41, 0x1981: 0x0259, 0x1982: 0x0f51, 0x1983: 0x0359, 0x1984: 0x0f61, 0x1985: 0x0040, - 0x1986: 0x00d9, 0x1987: 0x0040, 0x1988: 0x0040, 0x1989: 0x0040, 0x198a: 0x01d9, 0x198b: 0x0fa9, - 0x198c: 0x0fb9, 0x198d: 0x1089, 0x198e: 0x0279, 0x198f: 0x0369, 0x1990: 0x0289, 0x1991: 0x0040, - 0x1992: 0x0039, 0x1993: 0x0ee9, 0x1994: 0x1159, 0x1995: 0x0ef9, 0x1996: 0x0f09, 0x1997: 0x1199, - 0x1998: 0x0f31, 0x1999: 0x0249, 0x199a: 0x0f41, 0x199b: 0x0259, 0x199c: 0x0f51, 0x199d: 0x0359, - 0x199e: 0x0f61, 0x199f: 0x0f71, 0x19a0: 0x00d9, 0x19a1: 0x0f99, 0x19a2: 0x2039, 0x19a3: 0x0269, - 0x19a4: 0x01d9, 0x19a5: 0x0fa9, 0x19a6: 0x0fb9, 0x19a7: 0x1089, 0x19a8: 0x0279, 0x19a9: 0x0369, - 0x19aa: 0x0289, 0x19ab: 0x13d1, 0x19ac: 0x0039, 0x19ad: 0x0ee9, 0x19ae: 0x1159, 0x19af: 0x0ef9, - 0x19b0: 0x0f09, 0x19b1: 0x1199, 0x19b2: 0x0f31, 0x19b3: 0x0249, 0x19b4: 0x0f41, 0x19b5: 0x0259, - 0x19b6: 0x0f51, 0x19b7: 0x0359, 0x19b8: 0x0f61, 0x19b9: 0x0f71, 0x19ba: 0x00d9, 0x19bb: 0x0f99, - 0x19bc: 0x2039, 0x19bd: 0x0269, 0x19be: 0x01d9, 0x19bf: 0x0fa9, - // Block 0x67, offset 0x19c0 - 0x19c0: 0x0fb9, 0x19c1: 0x1089, 0x19c2: 0x0279, 0x19c3: 0x0369, 0x19c4: 0x0289, 0x19c5: 0x13d1, - 0x19c6: 0x0039, 0x19c7: 0x0ee9, 0x19c8: 0x1159, 0x19c9: 0x0ef9, 0x19ca: 0x0f09, 0x19cb: 0x1199, - 0x19cc: 0x0f31, 0x19cd: 0x0249, 0x19ce: 0x0f41, 0x19cf: 0x0259, 0x19d0: 0x0f51, 0x19d1: 0x0359, - 0x19d2: 0x0f61, 0x19d3: 0x0f71, 0x19d4: 0x00d9, 0x19d5: 0x0f99, 0x19d6: 0x2039, 0x19d7: 0x0269, - 0x19d8: 0x01d9, 0x19d9: 0x0fa9, 0x19da: 0x0fb9, 0x19db: 0x1089, 0x19dc: 0x0279, 0x19dd: 0x0369, - 0x19de: 0x0289, 0x19df: 0x13d1, 0x19e0: 0x0039, 0x19e1: 0x0ee9, 0x19e2: 0x1159, 0x19e3: 0x0ef9, - 0x19e4: 0x0f09, 0x19e5: 0x1199, 0x19e6: 0x0f31, 0x19e7: 0x0249, 0x19e8: 0x0f41, 0x19e9: 0x0259, - 0x19ea: 0x0f51, 0x19eb: 0x0359, 0x19ec: 0x0f61, 0x19ed: 0x0f71, 0x19ee: 0x00d9, 0x19ef: 0x0f99, - 0x19f0: 0x2039, 0x19f1: 0x0269, 0x19f2: 0x01d9, 0x19f3: 0x0fa9, 0x19f4: 0x0fb9, 0x19f5: 0x1089, - 0x19f6: 0x0279, 0x19f7: 0x0369, 0x19f8: 0x0289, 0x19f9: 0x13d1, 0x19fa: 0x0039, 0x19fb: 0x0ee9, - 0x19fc: 0x1159, 0x19fd: 0x0ef9, 0x19fe: 0x0f09, 0x19ff: 0x1199, - // Block 0x68, offset 0x1a00 - 0x1a00: 0x0f31, 0x1a01: 0x0249, 0x1a02: 0x0f41, 0x1a03: 0x0259, 0x1a04: 0x0f51, 0x1a05: 0x0359, - 0x1a06: 0x0f61, 0x1a07: 0x0f71, 0x1a08: 0x00d9, 0x1a09: 0x0f99, 0x1a0a: 0x2039, 0x1a0b: 0x0269, - 0x1a0c: 0x01d9, 0x1a0d: 0x0fa9, 0x1a0e: 0x0fb9, 0x1a0f: 0x1089, 0x1a10: 0x0279, 0x1a11: 0x0369, - 0x1a12: 0x0289, 0x1a13: 0x13d1, 0x1a14: 0x0039, 0x1a15: 0x0ee9, 0x1a16: 0x1159, 0x1a17: 0x0ef9, - 0x1a18: 0x0f09, 0x1a19: 0x1199, 0x1a1a: 0x0f31, 0x1a1b: 0x0249, 0x1a1c: 0x0f41, 0x1a1d: 0x0259, - 0x1a1e: 0x0f51, 0x1a1f: 0x0359, 0x1a20: 0x0f61, 0x1a21: 0x0f71, 0x1a22: 0x00d9, 0x1a23: 0x0f99, - 0x1a24: 0x2039, 0x1a25: 0x0269, 0x1a26: 0x01d9, 0x1a27: 0x0fa9, 0x1a28: 0x0fb9, 0x1a29: 0x1089, - 0x1a2a: 0x0279, 0x1a2b: 0x0369, 0x1a2c: 0x0289, 0x1a2d: 0x13d1, 0x1a2e: 0x0039, 0x1a2f: 0x0ee9, - 0x1a30: 0x1159, 0x1a31: 0x0ef9, 0x1a32: 0x0f09, 0x1a33: 0x1199, 0x1a34: 0x0f31, 0x1a35: 0x0249, - 0x1a36: 0x0f41, 0x1a37: 0x0259, 0x1a38: 0x0f51, 0x1a39: 0x0359, 0x1a3a: 0x0f61, 0x1a3b: 0x0f71, - 0x1a3c: 0x00d9, 0x1a3d: 0x0f99, 0x1a3e: 0x2039, 0x1a3f: 0x0269, - // Block 0x69, offset 0x1a40 - 0x1a40: 0x01d9, 0x1a41: 0x0fa9, 0x1a42: 0x0fb9, 0x1a43: 0x1089, 0x1a44: 0x0279, 0x1a45: 0x0369, - 0x1a46: 0x0289, 0x1a47: 0x13d1, 0x1a48: 0x0039, 0x1a49: 0x0ee9, 0x1a4a: 0x1159, 0x1a4b: 0x0ef9, - 0x1a4c: 0x0f09, 0x1a4d: 0x1199, 0x1a4e: 0x0f31, 0x1a4f: 0x0249, 0x1a50: 0x0f41, 0x1a51: 0x0259, - 0x1a52: 0x0f51, 0x1a53: 0x0359, 0x1a54: 0x0f61, 0x1a55: 0x0f71, 0x1a56: 0x00d9, 0x1a57: 0x0f99, - 0x1a58: 0x2039, 0x1a59: 0x0269, 0x1a5a: 0x01d9, 0x1a5b: 0x0fa9, 0x1a5c: 0x0fb9, 0x1a5d: 0x1089, - 0x1a5e: 0x0279, 0x1a5f: 0x0369, 0x1a60: 0x0289, 0x1a61: 0x13d1, 0x1a62: 0x0039, 0x1a63: 0x0ee9, - 0x1a64: 0x1159, 0x1a65: 0x0ef9, 0x1a66: 0x0f09, 0x1a67: 0x1199, 0x1a68: 0x0f31, 0x1a69: 0x0249, - 0x1a6a: 0x0f41, 0x1a6b: 0x0259, 0x1a6c: 0x0f51, 0x1a6d: 0x0359, 0x1a6e: 0x0f61, 0x1a6f: 0x0f71, - 0x1a70: 0x00d9, 0x1a71: 0x0f99, 0x1a72: 0x2039, 0x1a73: 0x0269, 0x1a74: 0x01d9, 0x1a75: 0x0fa9, - 0x1a76: 0x0fb9, 0x1a77: 0x1089, 0x1a78: 0x0279, 0x1a79: 0x0369, 0x1a7a: 0x0289, 0x1a7b: 0x13d1, - 0x1a7c: 0x0039, 0x1a7d: 0x0ee9, 0x1a7e: 0x1159, 0x1a7f: 0x0ef9, - // Block 0x6a, offset 0x1a80 - 0x1a80: 0x0f09, 0x1a81: 0x1199, 0x1a82: 0x0f31, 0x1a83: 0x0249, 0x1a84: 0x0f41, 0x1a85: 0x0259, - 0x1a86: 0x0f51, 0x1a87: 0x0359, 0x1a88: 0x0f61, 0x1a89: 0x0f71, 0x1a8a: 0x00d9, 0x1a8b: 0x0f99, - 0x1a8c: 0x2039, 0x1a8d: 0x0269, 0x1a8e: 0x01d9, 0x1a8f: 0x0fa9, 0x1a90: 0x0fb9, 0x1a91: 0x1089, - 0x1a92: 0x0279, 0x1a93: 0x0369, 0x1a94: 0x0289, 0x1a95: 0x13d1, 0x1a96: 0x0039, 0x1a97: 0x0ee9, - 0x1a98: 0x1159, 0x1a99: 0x0ef9, 0x1a9a: 0x0f09, 0x1a9b: 0x1199, 0x1a9c: 0x0f31, 0x1a9d: 0x0249, - 0x1a9e: 0x0f41, 0x1a9f: 0x0259, 0x1aa0: 0x0f51, 0x1aa1: 0x0359, 0x1aa2: 0x0f61, 0x1aa3: 0x0f71, - 0x1aa4: 0x00d9, 0x1aa5: 0x0f99, 0x1aa6: 0x2039, 0x1aa7: 0x0269, 0x1aa8: 0x01d9, 0x1aa9: 0x0fa9, - 0x1aaa: 0x0fb9, 0x1aab: 0x1089, 0x1aac: 0x0279, 0x1aad: 0x0369, 0x1aae: 0x0289, 0x1aaf: 0x13d1, - 0x1ab0: 0x0039, 0x1ab1: 0x0ee9, 0x1ab2: 0x1159, 0x1ab3: 0x0ef9, 0x1ab4: 0x0f09, 0x1ab5: 0x1199, - 0x1ab6: 0x0f31, 0x1ab7: 0x0249, 0x1ab8: 0x0f41, 0x1ab9: 0x0259, 0x1aba: 0x0f51, 0x1abb: 0x0359, - 0x1abc: 0x0f61, 0x1abd: 0x0f71, 0x1abe: 0x00d9, 0x1abf: 0x0f99, - // Block 0x6b, offset 0x1ac0 - 0x1ac0: 0x2039, 0x1ac1: 0x0269, 0x1ac2: 0x01d9, 0x1ac3: 0x0fa9, 0x1ac4: 0x0fb9, 0x1ac5: 0x1089, - 0x1ac6: 0x0279, 0x1ac7: 0x0369, 0x1ac8: 0x0289, 0x1ac9: 0x13d1, 0x1aca: 0x0039, 0x1acb: 0x0ee9, - 0x1acc: 0x1159, 0x1acd: 0x0ef9, 0x1ace: 0x0f09, 0x1acf: 0x1199, 0x1ad0: 0x0f31, 0x1ad1: 0x0249, - 0x1ad2: 0x0f41, 0x1ad3: 0x0259, 0x1ad4: 0x0f51, 0x1ad5: 0x0359, 0x1ad6: 0x0f61, 0x1ad7: 0x0f71, - 0x1ad8: 0x00d9, 0x1ad9: 0x0f99, 0x1ada: 0x2039, 0x1adb: 0x0269, 0x1adc: 0x01d9, 0x1add: 0x0fa9, - 0x1ade: 0x0fb9, 0x1adf: 0x1089, 0x1ae0: 0x0279, 0x1ae1: 0x0369, 0x1ae2: 0x0289, 0x1ae3: 0x13d1, - 0x1ae4: 0xba81, 0x1ae5: 0xba99, 0x1ae6: 0x0040, 0x1ae7: 0x0040, 0x1ae8: 0xbab1, 0x1ae9: 0x1099, - 0x1aea: 0x10b1, 0x1aeb: 0x10c9, 0x1aec: 0xbac9, 0x1aed: 0xbae1, 0x1aee: 0xbaf9, 0x1aef: 0x1429, - 0x1af0: 0x1a31, 0x1af1: 0xbb11, 0x1af2: 0xbb29, 0x1af3: 0xbb41, 0x1af4: 0xbb59, 0x1af5: 0xbb71, - 0x1af6: 0xbb89, 0x1af7: 0x2109, 0x1af8: 0x1111, 0x1af9: 0x1429, 0x1afa: 0xbba1, 0x1afb: 0xbbb9, - 0x1afc: 0xbbd1, 0x1afd: 0x10e1, 0x1afe: 0x10f9, 0x1aff: 0xbbe9, - // Block 0x6c, offset 0x1b00 - 0x1b00: 0x2079, 0x1b01: 0xbc01, 0x1b02: 0xbab1, 0x1b03: 0x1099, 0x1b04: 0x10b1, 0x1b05: 0x10c9, - 0x1b06: 0xbac9, 0x1b07: 0xbae1, 0x1b08: 0xbaf9, 0x1b09: 0x1429, 0x1b0a: 0x1a31, 0x1b0b: 0xbb11, - 0x1b0c: 0xbb29, 0x1b0d: 0xbb41, 0x1b0e: 0xbb59, 0x1b0f: 0xbb71, 0x1b10: 0xbb89, 0x1b11: 0x2109, - 0x1b12: 0x1111, 0x1b13: 0xbba1, 0x1b14: 0xbba1, 0x1b15: 0xbbb9, 0x1b16: 0xbbd1, 0x1b17: 0x10e1, - 0x1b18: 0x10f9, 0x1b19: 0xbbe9, 0x1b1a: 0x2079, 0x1b1b: 0xbc21, 0x1b1c: 0xbac9, 0x1b1d: 0x1429, - 0x1b1e: 0xbb11, 0x1b1f: 0x10e1, 0x1b20: 0x1111, 0x1b21: 0x2109, 0x1b22: 0xbab1, 0x1b23: 0x1099, - 0x1b24: 0x10b1, 0x1b25: 0x10c9, 0x1b26: 0xbac9, 0x1b27: 0xbae1, 0x1b28: 0xbaf9, 0x1b29: 0x1429, - 0x1b2a: 0x1a31, 0x1b2b: 0xbb11, 0x1b2c: 0xbb29, 0x1b2d: 0xbb41, 0x1b2e: 0xbb59, 0x1b2f: 0xbb71, - 0x1b30: 0xbb89, 0x1b31: 0x2109, 0x1b32: 0x1111, 0x1b33: 0x1429, 0x1b34: 0xbba1, 0x1b35: 0xbbb9, - 0x1b36: 0xbbd1, 0x1b37: 0x10e1, 0x1b38: 0x10f9, 0x1b39: 0xbbe9, 0x1b3a: 0x2079, 0x1b3b: 0xbc01, - 0x1b3c: 0xbab1, 0x1b3d: 0x1099, 0x1b3e: 0x10b1, 0x1b3f: 0x10c9, - // Block 0x6d, offset 0x1b40 - 0x1b40: 0xbac9, 0x1b41: 0xbae1, 0x1b42: 0xbaf9, 0x1b43: 0x1429, 0x1b44: 0x1a31, 0x1b45: 0xbb11, - 0x1b46: 0xbb29, 0x1b47: 0xbb41, 0x1b48: 0xbb59, 0x1b49: 0xbb71, 0x1b4a: 0xbb89, 0x1b4b: 0x2109, - 0x1b4c: 0x1111, 0x1b4d: 0xbba1, 0x1b4e: 0xbba1, 0x1b4f: 0xbbb9, 0x1b50: 0xbbd1, 0x1b51: 0x10e1, - 0x1b52: 0x10f9, 0x1b53: 0xbbe9, 0x1b54: 0x2079, 0x1b55: 0xbc21, 0x1b56: 0xbac9, 0x1b57: 0x1429, - 0x1b58: 0xbb11, 0x1b59: 0x10e1, 0x1b5a: 0x1111, 0x1b5b: 0x2109, 0x1b5c: 0xbab1, 0x1b5d: 0x1099, - 0x1b5e: 0x10b1, 0x1b5f: 0x10c9, 0x1b60: 0xbac9, 0x1b61: 0xbae1, 0x1b62: 0xbaf9, 0x1b63: 0x1429, - 0x1b64: 0x1a31, 0x1b65: 0xbb11, 0x1b66: 0xbb29, 0x1b67: 0xbb41, 0x1b68: 0xbb59, 0x1b69: 0xbb71, - 0x1b6a: 0xbb89, 0x1b6b: 0x2109, 0x1b6c: 0x1111, 0x1b6d: 0x1429, 0x1b6e: 0xbba1, 0x1b6f: 0xbbb9, - 0x1b70: 0xbbd1, 0x1b71: 0x10e1, 0x1b72: 0x10f9, 0x1b73: 0xbbe9, 0x1b74: 0x2079, 0x1b75: 0xbc01, - 0x1b76: 0xbab1, 0x1b77: 0x1099, 0x1b78: 0x10b1, 0x1b79: 0x10c9, 0x1b7a: 0xbac9, 0x1b7b: 0xbae1, - 0x1b7c: 0xbaf9, 0x1b7d: 0x1429, 0x1b7e: 0x1a31, 0x1b7f: 0xbb11, - // Block 0x6e, offset 0x1b80 - 0x1b80: 0xbb29, 0x1b81: 0xbb41, 0x1b82: 0xbb59, 0x1b83: 0xbb71, 0x1b84: 0xbb89, 0x1b85: 0x2109, - 0x1b86: 0x1111, 0x1b87: 0xbba1, 0x1b88: 0xbba1, 0x1b89: 0xbbb9, 0x1b8a: 0xbbd1, 0x1b8b: 0x10e1, - 0x1b8c: 0x10f9, 0x1b8d: 0xbbe9, 0x1b8e: 0x2079, 0x1b8f: 0xbc21, 0x1b90: 0xbac9, 0x1b91: 0x1429, - 0x1b92: 0xbb11, 0x1b93: 0x10e1, 0x1b94: 0x1111, 0x1b95: 0x2109, 0x1b96: 0xbab1, 0x1b97: 0x1099, - 0x1b98: 0x10b1, 0x1b99: 0x10c9, 0x1b9a: 0xbac9, 0x1b9b: 0xbae1, 0x1b9c: 0xbaf9, 0x1b9d: 0x1429, - 0x1b9e: 0x1a31, 0x1b9f: 0xbb11, 0x1ba0: 0xbb29, 0x1ba1: 0xbb41, 0x1ba2: 0xbb59, 0x1ba3: 0xbb71, - 0x1ba4: 0xbb89, 0x1ba5: 0x2109, 0x1ba6: 0x1111, 0x1ba7: 0x1429, 0x1ba8: 0xbba1, 0x1ba9: 0xbbb9, - 0x1baa: 0xbbd1, 0x1bab: 0x10e1, 0x1bac: 0x10f9, 0x1bad: 0xbbe9, 0x1bae: 0x2079, 0x1baf: 0xbc01, - 0x1bb0: 0xbab1, 0x1bb1: 0x1099, 0x1bb2: 0x10b1, 0x1bb3: 0x10c9, 0x1bb4: 0xbac9, 0x1bb5: 0xbae1, - 0x1bb6: 0xbaf9, 0x1bb7: 0x1429, 0x1bb8: 0x1a31, 0x1bb9: 0xbb11, 0x1bba: 0xbb29, 0x1bbb: 0xbb41, - 0x1bbc: 0xbb59, 0x1bbd: 0xbb71, 0x1bbe: 0xbb89, 0x1bbf: 0x2109, - // Block 0x6f, offset 0x1bc0 - 0x1bc0: 0x1111, 0x1bc1: 0xbba1, 0x1bc2: 0xbba1, 0x1bc3: 0xbbb9, 0x1bc4: 0xbbd1, 0x1bc5: 0x10e1, - 0x1bc6: 0x10f9, 0x1bc7: 0xbbe9, 0x1bc8: 0x2079, 0x1bc9: 0xbc21, 0x1bca: 0xbac9, 0x1bcb: 0x1429, - 0x1bcc: 0xbb11, 0x1bcd: 0x10e1, 0x1bce: 0x1111, 0x1bcf: 0x2109, 0x1bd0: 0xbab1, 0x1bd1: 0x1099, - 0x1bd2: 0x10b1, 0x1bd3: 0x10c9, 0x1bd4: 0xbac9, 0x1bd5: 0xbae1, 0x1bd6: 0xbaf9, 0x1bd7: 0x1429, - 0x1bd8: 0x1a31, 0x1bd9: 0xbb11, 0x1bda: 0xbb29, 0x1bdb: 0xbb41, 0x1bdc: 0xbb59, 0x1bdd: 0xbb71, - 0x1bde: 0xbb89, 0x1bdf: 0x2109, 0x1be0: 0x1111, 0x1be1: 0x1429, 0x1be2: 0xbba1, 0x1be3: 0xbbb9, - 0x1be4: 0xbbd1, 0x1be5: 0x10e1, 0x1be6: 0x10f9, 0x1be7: 0xbbe9, 0x1be8: 0x2079, 0x1be9: 0xbc01, - 0x1bea: 0xbab1, 0x1beb: 0x1099, 0x1bec: 0x10b1, 0x1bed: 0x10c9, 0x1bee: 0xbac9, 0x1bef: 0xbae1, - 0x1bf0: 0xbaf9, 0x1bf1: 0x1429, 0x1bf2: 0x1a31, 0x1bf3: 0xbb11, 0x1bf4: 0xbb29, 0x1bf5: 0xbb41, - 0x1bf6: 0xbb59, 0x1bf7: 0xbb71, 0x1bf8: 0xbb89, 0x1bf9: 0x2109, 0x1bfa: 0x1111, 0x1bfb: 0xbba1, - 0x1bfc: 0xbba1, 0x1bfd: 0xbbb9, 0x1bfe: 0xbbd1, 0x1bff: 0x10e1, - // Block 0x70, offset 0x1c00 - 0x1c00: 0x10f9, 0x1c01: 0xbbe9, 0x1c02: 0x2079, 0x1c03: 0xbc21, 0x1c04: 0xbac9, 0x1c05: 0x1429, - 0x1c06: 0xbb11, 0x1c07: 0x10e1, 0x1c08: 0x1111, 0x1c09: 0x2109, 0x1c0a: 0xbc41, 0x1c0b: 0xbc41, - 0x1c0c: 0x0040, 0x1c0d: 0x0040, 0x1c0e: 0x1f41, 0x1c0f: 0x00c9, 0x1c10: 0x0069, 0x1c11: 0x0079, - 0x1c12: 0x1f51, 0x1c13: 0x1f61, 0x1c14: 0x1f71, 0x1c15: 0x1f81, 0x1c16: 0x1f91, 0x1c17: 0x1fa1, - 0x1c18: 0x1f41, 0x1c19: 0x00c9, 0x1c1a: 0x0069, 0x1c1b: 0x0079, 0x1c1c: 0x1f51, 0x1c1d: 0x1f61, - 0x1c1e: 0x1f71, 0x1c1f: 0x1f81, 0x1c20: 0x1f91, 0x1c21: 0x1fa1, 0x1c22: 0x1f41, 0x1c23: 0x00c9, - 0x1c24: 0x0069, 0x1c25: 0x0079, 0x1c26: 0x1f51, 0x1c27: 0x1f61, 0x1c28: 0x1f71, 0x1c29: 0x1f81, - 0x1c2a: 0x1f91, 0x1c2b: 0x1fa1, 0x1c2c: 0x1f41, 0x1c2d: 0x00c9, 0x1c2e: 0x0069, 0x1c2f: 0x0079, - 0x1c30: 0x1f51, 0x1c31: 0x1f61, 0x1c32: 0x1f71, 0x1c33: 0x1f81, 0x1c34: 0x1f91, 0x1c35: 0x1fa1, - 0x1c36: 0x1f41, 0x1c37: 0x00c9, 0x1c38: 0x0069, 0x1c39: 0x0079, 0x1c3a: 0x1f51, 0x1c3b: 0x1f61, - 0x1c3c: 0x1f71, 0x1c3d: 0x1f81, 0x1c3e: 0x1f91, 0x1c3f: 0x1fa1, - // Block 0x71, offset 0x1c40 - 0x1c40: 0xe115, 0x1c41: 0xe115, 0x1c42: 0xe135, 0x1c43: 0xe135, 0x1c44: 0xe115, 0x1c45: 0xe115, - 0x1c46: 0xe175, 0x1c47: 0xe175, 0x1c48: 0xe115, 0x1c49: 0xe115, 0x1c4a: 0xe135, 0x1c4b: 0xe135, - 0x1c4c: 0xe115, 0x1c4d: 0xe115, 0x1c4e: 0xe1f5, 0x1c4f: 0xe1f5, 0x1c50: 0xe115, 0x1c51: 0xe115, - 0x1c52: 0xe135, 0x1c53: 0xe135, 0x1c54: 0xe115, 0x1c55: 0xe115, 0x1c56: 0xe175, 0x1c57: 0xe175, - 0x1c58: 0xe115, 0x1c59: 0xe115, 0x1c5a: 0xe135, 0x1c5b: 0xe135, 0x1c5c: 0xe115, 0x1c5d: 0xe115, - 0x1c5e: 0x8b05, 0x1c5f: 0x8b05, 0x1c60: 0x04b5, 0x1c61: 0x04b5, 0x1c62: 0x0a08, 0x1c63: 0x0a08, - 0x1c64: 0x0a08, 0x1c65: 0x0a08, 0x1c66: 0x0a08, 0x1c67: 0x0a08, 0x1c68: 0x0a08, 0x1c69: 0x0a08, - 0x1c6a: 0x0a08, 0x1c6b: 0x0a08, 0x1c6c: 0x0a08, 0x1c6d: 0x0a08, 0x1c6e: 0x0a08, 0x1c6f: 0x0a08, - 0x1c70: 0x0a08, 0x1c71: 0x0a08, 0x1c72: 0x0a08, 0x1c73: 0x0a08, 0x1c74: 0x0a08, 0x1c75: 0x0a08, - 0x1c76: 0x0a08, 0x1c77: 0x0a08, 0x1c78: 0x0a08, 0x1c79: 0x0a08, 0x1c7a: 0x0a08, 0x1c7b: 0x0a08, - 0x1c7c: 0x0a08, 0x1c7d: 0x0a08, 0x1c7e: 0x0a08, 0x1c7f: 0x0a08, - // Block 0x72, offset 0x1c80 - 0x1c80: 0xb189, 0x1c81: 0xb1a1, 0x1c82: 0xb201, 0x1c83: 0xb249, 0x1c84: 0x0040, 0x1c85: 0xb411, - 0x1c86: 0xb291, 0x1c87: 0xb219, 0x1c88: 0xb309, 0x1c89: 0xb429, 0x1c8a: 0xb399, 0x1c8b: 0xb3b1, - 0x1c8c: 0xb3c9, 0x1c8d: 0xb3e1, 0x1c8e: 0xb2a9, 0x1c8f: 0xb339, 0x1c90: 0xb369, 0x1c91: 0xb2d9, - 0x1c92: 0xb381, 0x1c93: 0xb279, 0x1c94: 0xb2c1, 0x1c95: 0xb1d1, 0x1c96: 0xb1e9, 0x1c97: 0xb231, - 0x1c98: 0xb261, 0x1c99: 0xb2f1, 0x1c9a: 0xb321, 0x1c9b: 0xb351, 0x1c9c: 0xbc59, 0x1c9d: 0x7949, - 0x1c9e: 0xbc71, 0x1c9f: 0xbc89, 0x1ca0: 0x0040, 0x1ca1: 0xb1a1, 0x1ca2: 0xb201, 0x1ca3: 0x0040, - 0x1ca4: 0xb3f9, 0x1ca5: 0x0040, 0x1ca6: 0x0040, 0x1ca7: 0xb219, 0x1ca8: 0x0040, 0x1ca9: 0xb429, - 0x1caa: 0xb399, 0x1cab: 0xb3b1, 0x1cac: 0xb3c9, 0x1cad: 0xb3e1, 0x1cae: 0xb2a9, 0x1caf: 0xb339, - 0x1cb0: 0xb369, 0x1cb1: 0xb2d9, 0x1cb2: 0xb381, 0x1cb3: 0x0040, 0x1cb4: 0xb2c1, 0x1cb5: 0xb1d1, - 0x1cb6: 0xb1e9, 0x1cb7: 0xb231, 0x1cb8: 0x0040, 0x1cb9: 0xb2f1, 0x1cba: 0x0040, 0x1cbb: 0xb351, - 0x1cbc: 0x0040, 0x1cbd: 0x0040, 0x1cbe: 0x0040, 0x1cbf: 0x0040, - // Block 0x73, offset 0x1cc0 - 0x1cc0: 0x0040, 0x1cc1: 0x0040, 0x1cc2: 0xb201, 0x1cc3: 0x0040, 0x1cc4: 0x0040, 0x1cc5: 0x0040, - 0x1cc6: 0x0040, 0x1cc7: 0xb219, 0x1cc8: 0x0040, 0x1cc9: 0xb429, 0x1cca: 0x0040, 0x1ccb: 0xb3b1, - 0x1ccc: 0x0040, 0x1ccd: 0xb3e1, 0x1cce: 0xb2a9, 0x1ccf: 0xb339, 0x1cd0: 0x0040, 0x1cd1: 0xb2d9, - 0x1cd2: 0xb381, 0x1cd3: 0x0040, 0x1cd4: 0xb2c1, 0x1cd5: 0x0040, 0x1cd6: 0x0040, 0x1cd7: 0xb231, - 0x1cd8: 0x0040, 0x1cd9: 0xb2f1, 0x1cda: 0x0040, 0x1cdb: 0xb351, 0x1cdc: 0x0040, 0x1cdd: 0x7949, - 0x1cde: 0x0040, 0x1cdf: 0xbc89, 0x1ce0: 0x0040, 0x1ce1: 0xb1a1, 0x1ce2: 0xb201, 0x1ce3: 0x0040, - 0x1ce4: 0xb3f9, 0x1ce5: 0x0040, 0x1ce6: 0x0040, 0x1ce7: 0xb219, 0x1ce8: 0xb309, 0x1ce9: 0xb429, - 0x1cea: 0xb399, 0x1ceb: 0x0040, 0x1cec: 0xb3c9, 0x1ced: 0xb3e1, 0x1cee: 0xb2a9, 0x1cef: 0xb339, - 0x1cf0: 0xb369, 0x1cf1: 0xb2d9, 0x1cf2: 0xb381, 0x1cf3: 0x0040, 0x1cf4: 0xb2c1, 0x1cf5: 0xb1d1, - 0x1cf6: 0xb1e9, 0x1cf7: 0xb231, 0x1cf8: 0x0040, 0x1cf9: 0xb2f1, 0x1cfa: 0xb321, 0x1cfb: 0xb351, - 0x1cfc: 0xbc59, 0x1cfd: 0x0040, 0x1cfe: 0xbc71, 0x1cff: 0x0040, - // Block 0x74, offset 0x1d00 - 0x1d00: 0xb189, 0x1d01: 0xb1a1, 0x1d02: 0xb201, 0x1d03: 0xb249, 0x1d04: 0xb3f9, 0x1d05: 0xb411, - 0x1d06: 0xb291, 0x1d07: 0xb219, 0x1d08: 0xb309, 0x1d09: 0xb429, 0x1d0a: 0x0040, 0x1d0b: 0xb3b1, - 0x1d0c: 0xb3c9, 0x1d0d: 0xb3e1, 0x1d0e: 0xb2a9, 0x1d0f: 0xb339, 0x1d10: 0xb369, 0x1d11: 0xb2d9, - 0x1d12: 0xb381, 0x1d13: 0xb279, 0x1d14: 0xb2c1, 0x1d15: 0xb1d1, 0x1d16: 0xb1e9, 0x1d17: 0xb231, - 0x1d18: 0xb261, 0x1d19: 0xb2f1, 0x1d1a: 0xb321, 0x1d1b: 0xb351, 0x1d1c: 0x0040, 0x1d1d: 0x0040, - 0x1d1e: 0x0040, 0x1d1f: 0x0040, 0x1d20: 0x0040, 0x1d21: 0xb1a1, 0x1d22: 0xb201, 0x1d23: 0xb249, - 0x1d24: 0x0040, 0x1d25: 0xb411, 0x1d26: 0xb291, 0x1d27: 0xb219, 0x1d28: 0xb309, 0x1d29: 0xb429, - 0x1d2a: 0x0040, 0x1d2b: 0xb3b1, 0x1d2c: 0xb3c9, 0x1d2d: 0xb3e1, 0x1d2e: 0xb2a9, 0x1d2f: 0xb339, - 0x1d30: 0xb369, 0x1d31: 0xb2d9, 0x1d32: 0xb381, 0x1d33: 0xb279, 0x1d34: 0xb2c1, 0x1d35: 0xb1d1, - 0x1d36: 0xb1e9, 0x1d37: 0xb231, 0x1d38: 0xb261, 0x1d39: 0xb2f1, 0x1d3a: 0xb321, 0x1d3b: 0xb351, - 0x1d3c: 0x0040, 0x1d3d: 0x0040, 0x1d3e: 0x0040, 0x1d3f: 0x0040, - // Block 0x75, offset 0x1d40 - 0x1d40: 0x0040, 0x1d41: 0xbca2, 0x1d42: 0xbcba, 0x1d43: 0xbcd2, 0x1d44: 0xbcea, 0x1d45: 0xbd02, - 0x1d46: 0xbd1a, 0x1d47: 0xbd32, 0x1d48: 0xbd4a, 0x1d49: 0xbd62, 0x1d4a: 0xbd7a, 0x1d4b: 0x0018, - 0x1d4c: 0x0018, 0x1d4d: 0x0040, 0x1d4e: 0x0040, 0x1d4f: 0x0040, 0x1d50: 0xbd92, 0x1d51: 0xbdb2, - 0x1d52: 0xbdd2, 0x1d53: 0xbdf2, 0x1d54: 0xbe12, 0x1d55: 0xbe32, 0x1d56: 0xbe52, 0x1d57: 0xbe72, - 0x1d58: 0xbe92, 0x1d59: 0xbeb2, 0x1d5a: 0xbed2, 0x1d5b: 0xbef2, 0x1d5c: 0xbf12, 0x1d5d: 0xbf32, - 0x1d5e: 0xbf52, 0x1d5f: 0xbf72, 0x1d60: 0xbf92, 0x1d61: 0xbfb2, 0x1d62: 0xbfd2, 0x1d63: 0xbff2, - 0x1d64: 0xc012, 0x1d65: 0xc032, 0x1d66: 0xc052, 0x1d67: 0xc072, 0x1d68: 0xc092, 0x1d69: 0xc0b2, - 0x1d6a: 0xc0d1, 0x1d6b: 0x1159, 0x1d6c: 0x0269, 0x1d6d: 0x6671, 0x1d6e: 0xc111, 0x1d6f: 0x0040, - 0x1d70: 0x0039, 0x1d71: 0x0ee9, 0x1d72: 0x1159, 0x1d73: 0x0ef9, 0x1d74: 0x0f09, 0x1d75: 0x1199, - 0x1d76: 0x0f31, 0x1d77: 0x0249, 0x1d78: 0x0f41, 0x1d79: 0x0259, 0x1d7a: 0x0f51, 0x1d7b: 0x0359, - 0x1d7c: 0x0f61, 0x1d7d: 0x0f71, 0x1d7e: 0x00d9, 0x1d7f: 0x0f99, - // Block 0x76, offset 0x1d80 - 0x1d80: 0x2039, 0x1d81: 0x0269, 0x1d82: 0x01d9, 0x1d83: 0x0fa9, 0x1d84: 0x0fb9, 0x1d85: 0x1089, - 0x1d86: 0x0279, 0x1d87: 0x0369, 0x1d88: 0x0289, 0x1d89: 0x13d1, 0x1d8a: 0xc129, 0x1d8b: 0x65b1, - 0x1d8c: 0xc141, 0x1d8d: 0x1441, 0x1d8e: 0xc159, 0x1d8f: 0xc179, 0x1d90: 0x0018, 0x1d91: 0x0018, - 0x1d92: 0x0018, 0x1d93: 0x0018, 0x1d94: 0x0018, 0x1d95: 0x0018, 0x1d96: 0x0018, 0x1d97: 0x0018, - 0x1d98: 0x0018, 0x1d99: 0x0018, 0x1d9a: 0x0018, 0x1d9b: 0x0018, 0x1d9c: 0x0018, 0x1d9d: 0x0018, - 0x1d9e: 0x0018, 0x1d9f: 0x0018, 0x1da0: 0x0018, 0x1da1: 0x0018, 0x1da2: 0x0018, 0x1da3: 0x0018, - 0x1da4: 0x0018, 0x1da5: 0x0018, 0x1da6: 0x0018, 0x1da7: 0x0018, 0x1da8: 0x0018, 0x1da9: 0x0018, - 0x1daa: 0xc191, 0x1dab: 0xc1a9, 0x1dac: 0x0040, 0x1dad: 0x0040, 0x1dae: 0x0040, 0x1daf: 0x0040, - 0x1db0: 0x0018, 0x1db1: 0x0018, 0x1db2: 0x0018, 0x1db3: 0x0018, 0x1db4: 0x0018, 0x1db5: 0x0018, - 0x1db6: 0x0018, 0x1db7: 0x0018, 0x1db8: 0x0018, 0x1db9: 0x0018, 0x1dba: 0x0018, 0x1dbb: 0x0018, - 0x1dbc: 0x0018, 0x1dbd: 0x0018, 0x1dbe: 0x0018, 0x1dbf: 0x0018, - // Block 0x77, offset 0x1dc0 - 0x1dc0: 0xc1d9, 0x1dc1: 0xc211, 0x1dc2: 0xc249, 0x1dc3: 0x0040, 0x1dc4: 0x0040, 0x1dc5: 0x0040, - 0x1dc6: 0x0040, 0x1dc7: 0x0040, 0x1dc8: 0x0040, 0x1dc9: 0x0040, 0x1dca: 0x0040, 0x1dcb: 0x0040, - 0x1dcc: 0x0040, 0x1dcd: 0x0040, 0x1dce: 0x0040, 0x1dcf: 0x0040, 0x1dd0: 0xc269, 0x1dd1: 0xc289, - 0x1dd2: 0xc2a9, 0x1dd3: 0xc2c9, 0x1dd4: 0xc2e9, 0x1dd5: 0xc309, 0x1dd6: 0xc329, 0x1dd7: 0xc349, - 0x1dd8: 0xc369, 0x1dd9: 0xc389, 0x1dda: 0xc3a9, 0x1ddb: 0xc3c9, 0x1ddc: 0xc3e9, 0x1ddd: 0xc409, - 0x1dde: 0xc429, 0x1ddf: 0xc449, 0x1de0: 0xc469, 0x1de1: 0xc489, 0x1de2: 0xc4a9, 0x1de3: 0xc4c9, - 0x1de4: 0xc4e9, 0x1de5: 0xc509, 0x1de6: 0xc529, 0x1de7: 0xc549, 0x1de8: 0xc569, 0x1de9: 0xc589, - 0x1dea: 0xc5a9, 0x1deb: 0xc5c9, 0x1dec: 0xc5e9, 0x1ded: 0xc609, 0x1dee: 0xc629, 0x1def: 0xc649, - 0x1df0: 0xc669, 0x1df1: 0xc689, 0x1df2: 0xc6a9, 0x1df3: 0xc6c9, 0x1df4: 0xc6e9, 0x1df5: 0xc709, - 0x1df6: 0xc729, 0x1df7: 0xc749, 0x1df8: 0xc769, 0x1df9: 0xc789, 0x1dfa: 0xc7a9, 0x1dfb: 0xc7c9, - 0x1dfc: 0x0040, 0x1dfd: 0x0040, 0x1dfe: 0x0040, 0x1dff: 0x0040, - // Block 0x78, offset 0x1e00 - 0x1e00: 0xcaf9, 0x1e01: 0xcb19, 0x1e02: 0xcb39, 0x1e03: 0x8b1d, 0x1e04: 0xcb59, 0x1e05: 0xcb79, - 0x1e06: 0xcb99, 0x1e07: 0xcbb9, 0x1e08: 0xcbd9, 0x1e09: 0xcbf9, 0x1e0a: 0xcc19, 0x1e0b: 0xcc39, - 0x1e0c: 0xcc59, 0x1e0d: 0x8b3d, 0x1e0e: 0xcc79, 0x1e0f: 0xcc99, 0x1e10: 0xccb9, 0x1e11: 0xccd9, - 0x1e12: 0x8b5d, 0x1e13: 0xccf9, 0x1e14: 0xcd19, 0x1e15: 0xc429, 0x1e16: 0x8b7d, 0x1e17: 0xcd39, - 0x1e18: 0xcd59, 0x1e19: 0xcd79, 0x1e1a: 0xcd99, 0x1e1b: 0xcdb9, 0x1e1c: 0x8b9d, 0x1e1d: 0xcdd9, - 0x1e1e: 0xcdf9, 0x1e1f: 0xce19, 0x1e20: 0xce39, 0x1e21: 0xce59, 0x1e22: 0xc789, 0x1e23: 0xce79, - 0x1e24: 0xce99, 0x1e25: 0xceb9, 0x1e26: 0xced9, 0x1e27: 0xcef9, 0x1e28: 0xcf19, 0x1e29: 0xcf39, - 0x1e2a: 0xcf59, 0x1e2b: 0xcf79, 0x1e2c: 0xcf99, 0x1e2d: 0xcfb9, 0x1e2e: 0xcfd9, 0x1e2f: 0xcff9, - 0x1e30: 0xd019, 0x1e31: 0xd039, 0x1e32: 0xd039, 0x1e33: 0xd039, 0x1e34: 0x8bbd, 0x1e35: 0xd059, - 0x1e36: 0xd079, 0x1e37: 0xd099, 0x1e38: 0x8bdd, 0x1e39: 0xd0b9, 0x1e3a: 0xd0d9, 0x1e3b: 0xd0f9, - 0x1e3c: 0xd119, 0x1e3d: 0xd139, 0x1e3e: 0xd159, 0x1e3f: 0xd179, - // Block 0x79, offset 0x1e40 - 0x1e40: 0xd199, 0x1e41: 0xd1b9, 0x1e42: 0xd1d9, 0x1e43: 0xd1f9, 0x1e44: 0xd219, 0x1e45: 0xd239, - 0x1e46: 0xd239, 0x1e47: 0xd259, 0x1e48: 0xd279, 0x1e49: 0xd299, 0x1e4a: 0xd2b9, 0x1e4b: 0xd2d9, - 0x1e4c: 0xd2f9, 0x1e4d: 0xd319, 0x1e4e: 0xd339, 0x1e4f: 0xd359, 0x1e50: 0xd379, 0x1e51: 0xd399, - 0x1e52: 0xd3b9, 0x1e53: 0xd3d9, 0x1e54: 0xd3f9, 0x1e55: 0xd419, 0x1e56: 0xd439, 0x1e57: 0xd459, - 0x1e58: 0xd479, 0x1e59: 0x8bfd, 0x1e5a: 0xd499, 0x1e5b: 0xd4b9, 0x1e5c: 0xd4d9, 0x1e5d: 0xc309, - 0x1e5e: 0xd4f9, 0x1e5f: 0xd519, 0x1e60: 0x8c1d, 0x1e61: 0x8c3d, 0x1e62: 0xd539, 0x1e63: 0xd559, - 0x1e64: 0xd579, 0x1e65: 0xd599, 0x1e66: 0xd5b9, 0x1e67: 0xd5d9, 0x1e68: 0x2040, 0x1e69: 0xd5f9, - 0x1e6a: 0xd619, 0x1e6b: 0xd619, 0x1e6c: 0x8c5d, 0x1e6d: 0xd639, 0x1e6e: 0xd659, 0x1e6f: 0xd679, - 0x1e70: 0xd699, 0x1e71: 0x8c7d, 0x1e72: 0xd6b9, 0x1e73: 0xd6d9, 0x1e74: 0x2040, 0x1e75: 0xd6f9, - 0x1e76: 0xd719, 0x1e77: 0xd739, 0x1e78: 0xd759, 0x1e79: 0xd779, 0x1e7a: 0xd799, 0x1e7b: 0x8c9d, - 0x1e7c: 0xd7b9, 0x1e7d: 0x8cbd, 0x1e7e: 0xd7d9, 0x1e7f: 0xd7f9, - // Block 0x7a, offset 0x1e80 - 0x1e80: 0xd819, 0x1e81: 0xd839, 0x1e82: 0xd859, 0x1e83: 0xd879, 0x1e84: 0xd899, 0x1e85: 0xd8b9, - 0x1e86: 0xd8d9, 0x1e87: 0xd8f9, 0x1e88: 0xd919, 0x1e89: 0x8cdd, 0x1e8a: 0xd939, 0x1e8b: 0xd959, - 0x1e8c: 0xd979, 0x1e8d: 0xd999, 0x1e8e: 0xd9b9, 0x1e8f: 0x8cfd, 0x1e90: 0xd9d9, 0x1e91: 0x8d1d, - 0x1e92: 0x8d3d, 0x1e93: 0xd9f9, 0x1e94: 0xda19, 0x1e95: 0xda19, 0x1e96: 0xda39, 0x1e97: 0x8d5d, - 0x1e98: 0x8d7d, 0x1e99: 0xda59, 0x1e9a: 0xda79, 0x1e9b: 0xda99, 0x1e9c: 0xdab9, 0x1e9d: 0xdad9, - 0x1e9e: 0xdaf9, 0x1e9f: 0xdb19, 0x1ea0: 0xdb39, 0x1ea1: 0xdb59, 0x1ea2: 0xdb79, 0x1ea3: 0xdb99, - 0x1ea4: 0x8d9d, 0x1ea5: 0xdbb9, 0x1ea6: 0xdbd9, 0x1ea7: 0xdbf9, 0x1ea8: 0xdc19, 0x1ea9: 0xdbf9, - 0x1eaa: 0xdc39, 0x1eab: 0xdc59, 0x1eac: 0xdc79, 0x1ead: 0xdc99, 0x1eae: 0xdcb9, 0x1eaf: 0xdcd9, - 0x1eb0: 0xdcf9, 0x1eb1: 0xdd19, 0x1eb2: 0xdd39, 0x1eb3: 0xdd59, 0x1eb4: 0xdd79, 0x1eb5: 0xdd99, - 0x1eb6: 0xddb9, 0x1eb7: 0xddd9, 0x1eb8: 0x8dbd, 0x1eb9: 0xddf9, 0x1eba: 0xde19, 0x1ebb: 0xde39, - 0x1ebc: 0xde59, 0x1ebd: 0xde79, 0x1ebe: 0x8ddd, 0x1ebf: 0xde99, - // Block 0x7b, offset 0x1ec0 - 0x1ec0: 0xe599, 0x1ec1: 0xe5b9, 0x1ec2: 0xe5d9, 0x1ec3: 0xe5f9, 0x1ec4: 0xe619, 0x1ec5: 0xe639, - 0x1ec6: 0x8efd, 0x1ec7: 0xe659, 0x1ec8: 0xe679, 0x1ec9: 0xe699, 0x1eca: 0xe6b9, 0x1ecb: 0xe6d9, - 0x1ecc: 0xe6f9, 0x1ecd: 0x8f1d, 0x1ece: 0xe719, 0x1ecf: 0xe739, 0x1ed0: 0x8f3d, 0x1ed1: 0x8f5d, - 0x1ed2: 0xe759, 0x1ed3: 0xe779, 0x1ed4: 0xe799, 0x1ed5: 0xe7b9, 0x1ed6: 0xe7d9, 0x1ed7: 0xe7f9, - 0x1ed8: 0xe819, 0x1ed9: 0xe839, 0x1eda: 0xe859, 0x1edb: 0x8f7d, 0x1edc: 0xe879, 0x1edd: 0x8f9d, - 0x1ede: 0xe899, 0x1edf: 0x2040, 0x1ee0: 0xe8b9, 0x1ee1: 0xe8d9, 0x1ee2: 0xe8f9, 0x1ee3: 0x8fbd, - 0x1ee4: 0xe919, 0x1ee5: 0xe939, 0x1ee6: 0x8fdd, 0x1ee7: 0x8ffd, 0x1ee8: 0xe959, 0x1ee9: 0xe979, - 0x1eea: 0xe999, 0x1eeb: 0xe9b9, 0x1eec: 0xe9d9, 0x1eed: 0xe9d9, 0x1eee: 0xe9f9, 0x1eef: 0xea19, - 0x1ef0: 0xea39, 0x1ef1: 0xea59, 0x1ef2: 0xea79, 0x1ef3: 0xea99, 0x1ef4: 0xeab9, 0x1ef5: 0x901d, - 0x1ef6: 0xead9, 0x1ef7: 0x903d, 0x1ef8: 0xeaf9, 0x1ef9: 0x905d, 0x1efa: 0xeb19, 0x1efb: 0x907d, - 0x1efc: 0x909d, 0x1efd: 0x90bd, 0x1efe: 0xeb39, 0x1eff: 0xeb59, - // Block 0x7c, offset 0x1f00 - 0x1f00: 0xeb79, 0x1f01: 0x90dd, 0x1f02: 0x90fd, 0x1f03: 0x911d, 0x1f04: 0x913d, 0x1f05: 0xeb99, - 0x1f06: 0xebb9, 0x1f07: 0xebb9, 0x1f08: 0xebd9, 0x1f09: 0xebf9, 0x1f0a: 0xec19, 0x1f0b: 0xec39, - 0x1f0c: 0xec59, 0x1f0d: 0x915d, 0x1f0e: 0xec79, 0x1f0f: 0xec99, 0x1f10: 0xecb9, 0x1f11: 0xecd9, - 0x1f12: 0x917d, 0x1f13: 0xecf9, 0x1f14: 0x919d, 0x1f15: 0x91bd, 0x1f16: 0xed19, 0x1f17: 0xed39, - 0x1f18: 0xed59, 0x1f19: 0xed79, 0x1f1a: 0xed99, 0x1f1b: 0xedb9, 0x1f1c: 0x91dd, 0x1f1d: 0x91fd, - 0x1f1e: 0x921d, 0x1f1f: 0x2040, 0x1f20: 0xedd9, 0x1f21: 0x923d, 0x1f22: 0xedf9, 0x1f23: 0xee19, - 0x1f24: 0xee39, 0x1f25: 0x925d, 0x1f26: 0xee59, 0x1f27: 0xee79, 0x1f28: 0xee99, 0x1f29: 0xeeb9, - 0x1f2a: 0xeed9, 0x1f2b: 0x927d, 0x1f2c: 0xeef9, 0x1f2d: 0xef19, 0x1f2e: 0xef39, 0x1f2f: 0xef59, - 0x1f30: 0xef79, 0x1f31: 0xef99, 0x1f32: 0x929d, 0x1f33: 0x92bd, 0x1f34: 0xefb9, 0x1f35: 0x92dd, - 0x1f36: 0xefd9, 0x1f37: 0x92fd, 0x1f38: 0xeff9, 0x1f39: 0xf019, 0x1f3a: 0xf039, 0x1f3b: 0x931d, - 0x1f3c: 0x933d, 0x1f3d: 0xf059, 0x1f3e: 0x935d, 0x1f3f: 0xf079, - // Block 0x7d, offset 0x1f40 - 0x1f40: 0xf6b9, 0x1f41: 0xf6d9, 0x1f42: 0xf6f9, 0x1f43: 0xf719, 0x1f44: 0xf739, 0x1f45: 0x951d, - 0x1f46: 0xf759, 0x1f47: 0xf779, 0x1f48: 0xf799, 0x1f49: 0xf7b9, 0x1f4a: 0xf7d9, 0x1f4b: 0x953d, - 0x1f4c: 0x955d, 0x1f4d: 0xf7f9, 0x1f4e: 0xf819, 0x1f4f: 0xf839, 0x1f50: 0xf859, 0x1f51: 0xf879, - 0x1f52: 0xf899, 0x1f53: 0x957d, 0x1f54: 0xf8b9, 0x1f55: 0xf8d9, 0x1f56: 0xf8f9, 0x1f57: 0xf919, - 0x1f58: 0x959d, 0x1f59: 0x95bd, 0x1f5a: 0xf939, 0x1f5b: 0xf959, 0x1f5c: 0xf979, 0x1f5d: 0x95dd, - 0x1f5e: 0xf999, 0x1f5f: 0xf9b9, 0x1f60: 0x6815, 0x1f61: 0x95fd, 0x1f62: 0xf9d9, 0x1f63: 0xf9f9, - 0x1f64: 0xfa19, 0x1f65: 0x961d, 0x1f66: 0xfa39, 0x1f67: 0xfa59, 0x1f68: 0xfa79, 0x1f69: 0xfa99, - 0x1f6a: 0xfab9, 0x1f6b: 0xfad9, 0x1f6c: 0xfaf9, 0x1f6d: 0x963d, 0x1f6e: 0xfb19, 0x1f6f: 0xfb39, - 0x1f70: 0xfb59, 0x1f71: 0x965d, 0x1f72: 0xfb79, 0x1f73: 0xfb99, 0x1f74: 0xfbb9, 0x1f75: 0xfbd9, - 0x1f76: 0x7b35, 0x1f77: 0x967d, 0x1f78: 0xfbf9, 0x1f79: 0xfc19, 0x1f7a: 0xfc39, 0x1f7b: 0x969d, - 0x1f7c: 0xfc59, 0x1f7d: 0x96bd, 0x1f7e: 0xfc79, 0x1f7f: 0xfc79, - // Block 0x7e, offset 0x1f80 - 0x1f80: 0xfc99, 0x1f81: 0x96dd, 0x1f82: 0xfcb9, 0x1f83: 0xfcd9, 0x1f84: 0xfcf9, 0x1f85: 0xfd19, - 0x1f86: 0xfd39, 0x1f87: 0xfd59, 0x1f88: 0xfd79, 0x1f89: 0x96fd, 0x1f8a: 0xfd99, 0x1f8b: 0xfdb9, - 0x1f8c: 0xfdd9, 0x1f8d: 0xfdf9, 0x1f8e: 0xfe19, 0x1f8f: 0xfe39, 0x1f90: 0x971d, 0x1f91: 0xfe59, - 0x1f92: 0x973d, 0x1f93: 0x975d, 0x1f94: 0x977d, 0x1f95: 0xfe79, 0x1f96: 0xfe99, 0x1f97: 0xfeb9, - 0x1f98: 0xfed9, 0x1f99: 0xfef9, 0x1f9a: 0xff19, 0x1f9b: 0xff39, 0x1f9c: 0xff59, 0x1f9d: 0x979d, - 0x1f9e: 0x0040, 0x1f9f: 0x0040, 0x1fa0: 0x0040, 0x1fa1: 0x0040, 0x1fa2: 0x0040, 0x1fa3: 0x0040, - 0x1fa4: 0x0040, 0x1fa5: 0x0040, 0x1fa6: 0x0040, 0x1fa7: 0x0040, 0x1fa8: 0x0040, 0x1fa9: 0x0040, - 0x1faa: 0x0040, 0x1fab: 0x0040, 0x1fac: 0x0040, 0x1fad: 0x0040, 0x1fae: 0x0040, 0x1faf: 0x0040, - 0x1fb0: 0x0040, 0x1fb1: 0x0040, 0x1fb2: 0x0040, 0x1fb3: 0x0040, 0x1fb4: 0x0040, 0x1fb5: 0x0040, - 0x1fb6: 0x0040, 0x1fb7: 0x0040, 0x1fb8: 0x0040, 0x1fb9: 0x0040, 0x1fba: 0x0040, 0x1fbb: 0x0040, - 0x1fbc: 0x0040, 0x1fbd: 0x0040, 0x1fbe: 0x0040, 0x1fbf: 0x0040, -} - -// idnaIndex: 36 blocks, 2304 entries, 4608 bytes -// Block 0 is the zero block. -var idnaIndex = [2304]uint16{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x01, 0xc3: 0x7d, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x04, 0xc7: 0x05, - 0xc8: 0x06, 0xc9: 0x7e, 0xca: 0x7f, 0xcb: 0x07, 0xcc: 0x80, 0xcd: 0x08, 0xce: 0x09, 0xcf: 0x0a, - 0xd0: 0x81, 0xd1: 0x0b, 0xd2: 0x0c, 0xd3: 0x0d, 0xd4: 0x0e, 0xd5: 0x82, 0xd6: 0x83, 0xd7: 0x84, - 0xd8: 0x0f, 0xd9: 0x10, 0xda: 0x85, 0xdb: 0x11, 0xdc: 0x12, 0xdd: 0x86, 0xde: 0x87, 0xdf: 0x88, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe5: 0x07, 0xe6: 0x07, 0xe7: 0x07, - 0xe8: 0x07, 0xe9: 0x08, 0xea: 0x09, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x0a, 0xee: 0x0b, 0xef: 0x0c, - 0xf0: 0x1d, 0xf1: 0x1e, 0xf2: 0x1e, 0xf3: 0x20, 0xf4: 0x21, - // Block 0x4, offset 0x100 - 0x120: 0x89, 0x121: 0x13, 0x122: 0x8a, 0x123: 0x8b, 0x124: 0x8c, 0x125: 0x14, 0x126: 0x15, 0x127: 0x16, - 0x128: 0x17, 0x129: 0x18, 0x12a: 0x19, 0x12b: 0x1a, 0x12c: 0x1b, 0x12d: 0x1c, 0x12e: 0x1d, 0x12f: 0x8d, - 0x130: 0x8e, 0x131: 0x1e, 0x132: 0x1f, 0x133: 0x20, 0x134: 0x8f, 0x135: 0x21, 0x136: 0x90, 0x137: 0x91, - 0x138: 0x92, 0x139: 0x93, 0x13a: 0x22, 0x13b: 0x94, 0x13c: 0x95, 0x13d: 0x23, 0x13e: 0x24, 0x13f: 0x96, - // Block 0x5, offset 0x140 - 0x140: 0x97, 0x141: 0x98, 0x142: 0x99, 0x143: 0x9a, 0x144: 0x9b, 0x145: 0x9c, 0x146: 0x9d, 0x147: 0x9e, - 0x148: 0x9f, 0x149: 0xa0, 0x14a: 0xa1, 0x14b: 0xa2, 0x14c: 0xa3, 0x14d: 0xa4, 0x14e: 0xa5, 0x14f: 0xa6, - 0x150: 0xa7, 0x151: 0x9f, 0x152: 0x9f, 0x153: 0x9f, 0x154: 0x9f, 0x155: 0x9f, 0x156: 0x9f, 0x157: 0x9f, - 0x158: 0x9f, 0x159: 0xa8, 0x15a: 0xa9, 0x15b: 0xaa, 0x15c: 0xab, 0x15d: 0xac, 0x15e: 0xad, 0x15f: 0xae, - 0x160: 0xaf, 0x161: 0xb0, 0x162: 0xb1, 0x163: 0xb2, 0x164: 0xb3, 0x165: 0xb4, 0x166: 0xb5, 0x167: 0xb6, - 0x168: 0xb7, 0x169: 0xb8, 0x16a: 0xb9, 0x16b: 0xba, 0x16c: 0xbb, 0x16d: 0xbc, 0x16e: 0xbd, 0x16f: 0xbe, - 0x170: 0xbf, 0x171: 0xc0, 0x172: 0xc1, 0x173: 0xc2, 0x174: 0x25, 0x175: 0x26, 0x176: 0x27, 0x177: 0xc3, - 0x178: 0x28, 0x179: 0x28, 0x17a: 0x29, 0x17b: 0x28, 0x17c: 0xc4, 0x17d: 0x2a, 0x17e: 0x2b, 0x17f: 0x2c, - // Block 0x6, offset 0x180 - 0x180: 0x2d, 0x181: 0x2e, 0x182: 0x2f, 0x183: 0xc5, 0x184: 0x30, 0x185: 0x31, 0x186: 0xc6, 0x187: 0x9b, - 0x188: 0xc7, 0x189: 0xc8, 0x18a: 0x9b, 0x18b: 0x9b, 0x18c: 0xc9, 0x18d: 0x9b, 0x18e: 0x9b, 0x18f: 0x9b, - 0x190: 0xca, 0x191: 0x32, 0x192: 0x33, 0x193: 0x34, 0x194: 0x9b, 0x195: 0x9b, 0x196: 0x9b, 0x197: 0x9b, - 0x198: 0x9b, 0x199: 0x9b, 0x19a: 0x9b, 0x19b: 0x9b, 0x19c: 0x9b, 0x19d: 0x9b, 0x19e: 0x9b, 0x19f: 0x9b, - 0x1a0: 0x9b, 0x1a1: 0x9b, 0x1a2: 0x9b, 0x1a3: 0x9b, 0x1a4: 0x9b, 0x1a5: 0x9b, 0x1a6: 0x9b, 0x1a7: 0x9b, - 0x1a8: 0xcb, 0x1a9: 0xcc, 0x1aa: 0x9b, 0x1ab: 0xcd, 0x1ac: 0x9b, 0x1ad: 0xce, 0x1ae: 0xcf, 0x1af: 0xd0, - 0x1b0: 0xd1, 0x1b1: 0x35, 0x1b2: 0x28, 0x1b3: 0x36, 0x1b4: 0xd2, 0x1b5: 0xd3, 0x1b6: 0xd4, 0x1b7: 0xd5, - 0x1b8: 0xd6, 0x1b9: 0xd7, 0x1ba: 0xd8, 0x1bb: 0xd9, 0x1bc: 0xda, 0x1bd: 0xdb, 0x1be: 0xdc, 0x1bf: 0x37, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x38, 0x1c1: 0xdd, 0x1c2: 0xde, 0x1c3: 0xdf, 0x1c4: 0xe0, 0x1c5: 0x39, 0x1c6: 0x3a, 0x1c7: 0xe1, - 0x1c8: 0xe2, 0x1c9: 0x3b, 0x1ca: 0x3c, 0x1cb: 0x3d, 0x1cc: 0x3e, 0x1cd: 0x3f, 0x1ce: 0x40, 0x1cf: 0x41, - 0x1d0: 0x9f, 0x1d1: 0x9f, 0x1d2: 0x9f, 0x1d3: 0x9f, 0x1d4: 0x9f, 0x1d5: 0x9f, 0x1d6: 0x9f, 0x1d7: 0x9f, - 0x1d8: 0x9f, 0x1d9: 0x9f, 0x1da: 0x9f, 0x1db: 0x9f, 0x1dc: 0x9f, 0x1dd: 0x9f, 0x1de: 0x9f, 0x1df: 0x9f, - 0x1e0: 0x9f, 0x1e1: 0x9f, 0x1e2: 0x9f, 0x1e3: 0x9f, 0x1e4: 0x9f, 0x1e5: 0x9f, 0x1e6: 0x9f, 0x1e7: 0x9f, - 0x1e8: 0x9f, 0x1e9: 0x9f, 0x1ea: 0x9f, 0x1eb: 0x9f, 0x1ec: 0x9f, 0x1ed: 0x9f, 0x1ee: 0x9f, 0x1ef: 0x9f, - 0x1f0: 0x9f, 0x1f1: 0x9f, 0x1f2: 0x9f, 0x1f3: 0x9f, 0x1f4: 0x9f, 0x1f5: 0x9f, 0x1f6: 0x9f, 0x1f7: 0x9f, - 0x1f8: 0x9f, 0x1f9: 0x9f, 0x1fa: 0x9f, 0x1fb: 0x9f, 0x1fc: 0x9f, 0x1fd: 0x9f, 0x1fe: 0x9f, 0x1ff: 0x9f, - // Block 0x8, offset 0x200 - 0x200: 0x9f, 0x201: 0x9f, 0x202: 0x9f, 0x203: 0x9f, 0x204: 0x9f, 0x205: 0x9f, 0x206: 0x9f, 0x207: 0x9f, - 0x208: 0x9f, 0x209: 0x9f, 0x20a: 0x9f, 0x20b: 0x9f, 0x20c: 0x9f, 0x20d: 0x9f, 0x20e: 0x9f, 0x20f: 0x9f, - 0x210: 0x9f, 0x211: 0x9f, 0x212: 0x9f, 0x213: 0x9f, 0x214: 0x9f, 0x215: 0x9f, 0x216: 0x9f, 0x217: 0x9f, - 0x218: 0x9f, 0x219: 0x9f, 0x21a: 0x9f, 0x21b: 0x9f, 0x21c: 0x9f, 0x21d: 0x9f, 0x21e: 0x9f, 0x21f: 0x9f, - 0x220: 0x9f, 0x221: 0x9f, 0x222: 0x9f, 0x223: 0x9f, 0x224: 0x9f, 0x225: 0x9f, 0x226: 0x9f, 0x227: 0x9f, - 0x228: 0x9f, 0x229: 0x9f, 0x22a: 0x9f, 0x22b: 0x9f, 0x22c: 0x9f, 0x22d: 0x9f, 0x22e: 0x9f, 0x22f: 0x9f, - 0x230: 0x9f, 0x231: 0x9f, 0x232: 0x9f, 0x233: 0x9f, 0x234: 0x9f, 0x235: 0x9f, 0x236: 0xb2, 0x237: 0x9b, - 0x238: 0x9f, 0x239: 0x9f, 0x23a: 0x9f, 0x23b: 0x9f, 0x23c: 0x9f, 0x23d: 0x9f, 0x23e: 0x9f, 0x23f: 0x9f, - // Block 0x9, offset 0x240 - 0x240: 0x9f, 0x241: 0x9f, 0x242: 0x9f, 0x243: 0x9f, 0x244: 0x9f, 0x245: 0x9f, 0x246: 0x9f, 0x247: 0x9f, - 0x248: 0x9f, 0x249: 0x9f, 0x24a: 0x9f, 0x24b: 0x9f, 0x24c: 0x9f, 0x24d: 0x9f, 0x24e: 0x9f, 0x24f: 0x9f, - 0x250: 0x9f, 0x251: 0x9f, 0x252: 0x9f, 0x253: 0x9f, 0x254: 0x9f, 0x255: 0x9f, 0x256: 0x9f, 0x257: 0x9f, - 0x258: 0x9f, 0x259: 0x9f, 0x25a: 0x9f, 0x25b: 0x9f, 0x25c: 0x9f, 0x25d: 0x9f, 0x25e: 0x9f, 0x25f: 0x9f, - 0x260: 0x9f, 0x261: 0x9f, 0x262: 0x9f, 0x263: 0x9f, 0x264: 0x9f, 0x265: 0x9f, 0x266: 0x9f, 0x267: 0x9f, - 0x268: 0x9f, 0x269: 0x9f, 0x26a: 0x9f, 0x26b: 0x9f, 0x26c: 0x9f, 0x26d: 0x9f, 0x26e: 0x9f, 0x26f: 0x9f, - 0x270: 0x9f, 0x271: 0x9f, 0x272: 0x9f, 0x273: 0x9f, 0x274: 0x9f, 0x275: 0x9f, 0x276: 0x9f, 0x277: 0x9f, - 0x278: 0x9f, 0x279: 0x9f, 0x27a: 0x9f, 0x27b: 0x9f, 0x27c: 0x9f, 0x27d: 0x9f, 0x27e: 0x9f, 0x27f: 0x9f, - // Block 0xa, offset 0x280 - 0x280: 0x9f, 0x281: 0x9f, 0x282: 0x9f, 0x283: 0x9f, 0x284: 0x9f, 0x285: 0x9f, 0x286: 0x9f, 0x287: 0x9f, - 0x288: 0x9f, 0x289: 0x9f, 0x28a: 0x9f, 0x28b: 0x9f, 0x28c: 0x9f, 0x28d: 0x9f, 0x28e: 0x9f, 0x28f: 0x9f, - 0x290: 0x9f, 0x291: 0x9f, 0x292: 0x9f, 0x293: 0x9f, 0x294: 0x9f, 0x295: 0x9f, 0x296: 0x9f, 0x297: 0x9f, - 0x298: 0x9f, 0x299: 0x9f, 0x29a: 0x9f, 0x29b: 0x9f, 0x29c: 0x9f, 0x29d: 0x9f, 0x29e: 0x9f, 0x29f: 0x9f, - 0x2a0: 0x9f, 0x2a1: 0x9f, 0x2a2: 0x9f, 0x2a3: 0x9f, 0x2a4: 0x9f, 0x2a5: 0x9f, 0x2a6: 0x9f, 0x2a7: 0x9f, - 0x2a8: 0x9f, 0x2a9: 0x9f, 0x2aa: 0x9f, 0x2ab: 0x9f, 0x2ac: 0x9f, 0x2ad: 0x9f, 0x2ae: 0x9f, 0x2af: 0x9f, - 0x2b0: 0x9f, 0x2b1: 0x9f, 0x2b2: 0x9f, 0x2b3: 0x9f, 0x2b4: 0x9f, 0x2b5: 0x9f, 0x2b6: 0x9f, 0x2b7: 0x9f, - 0x2b8: 0x9f, 0x2b9: 0x9f, 0x2ba: 0x9f, 0x2bb: 0x9f, 0x2bc: 0x9f, 0x2bd: 0x9f, 0x2be: 0x9f, 0x2bf: 0xe3, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x9f, 0x2c1: 0x9f, 0x2c2: 0x9f, 0x2c3: 0x9f, 0x2c4: 0x9f, 0x2c5: 0x9f, 0x2c6: 0x9f, 0x2c7: 0x9f, - 0x2c8: 0x9f, 0x2c9: 0x9f, 0x2ca: 0x9f, 0x2cb: 0x9f, 0x2cc: 0x9f, 0x2cd: 0x9f, 0x2ce: 0x9f, 0x2cf: 0x9f, - 0x2d0: 0x9f, 0x2d1: 0x9f, 0x2d2: 0xe4, 0x2d3: 0xe5, 0x2d4: 0x9f, 0x2d5: 0x9f, 0x2d6: 0x9f, 0x2d7: 0x9f, - 0x2d8: 0xe6, 0x2d9: 0x42, 0x2da: 0x43, 0x2db: 0xe7, 0x2dc: 0x44, 0x2dd: 0x45, 0x2de: 0x46, 0x2df: 0xe8, - 0x2e0: 0xe9, 0x2e1: 0xea, 0x2e2: 0xeb, 0x2e3: 0xec, 0x2e4: 0xed, 0x2e5: 0xee, 0x2e6: 0xef, 0x2e7: 0xf0, - 0x2e8: 0xf1, 0x2e9: 0xf2, 0x2ea: 0xf3, 0x2eb: 0xf4, 0x2ec: 0xf5, 0x2ed: 0xf6, 0x2ee: 0xf7, 0x2ef: 0xf8, - 0x2f0: 0x9f, 0x2f1: 0x9f, 0x2f2: 0x9f, 0x2f3: 0x9f, 0x2f4: 0x9f, 0x2f5: 0x9f, 0x2f6: 0x9f, 0x2f7: 0x9f, - 0x2f8: 0x9f, 0x2f9: 0x9f, 0x2fa: 0x9f, 0x2fb: 0x9f, 0x2fc: 0x9f, 0x2fd: 0x9f, 0x2fe: 0x9f, 0x2ff: 0x9f, - // Block 0xc, offset 0x300 - 0x300: 0x9f, 0x301: 0x9f, 0x302: 0x9f, 0x303: 0x9f, 0x304: 0x9f, 0x305: 0x9f, 0x306: 0x9f, 0x307: 0x9f, - 0x308: 0x9f, 0x309: 0x9f, 0x30a: 0x9f, 0x30b: 0x9f, 0x30c: 0x9f, 0x30d: 0x9f, 0x30e: 0x9f, 0x30f: 0x9f, - 0x310: 0x9f, 0x311: 0x9f, 0x312: 0x9f, 0x313: 0x9f, 0x314: 0x9f, 0x315: 0x9f, 0x316: 0x9f, 0x317: 0x9f, - 0x318: 0x9f, 0x319: 0x9f, 0x31a: 0x9f, 0x31b: 0x9f, 0x31c: 0x9f, 0x31d: 0x9f, 0x31e: 0xf9, 0x31f: 0xfa, - // Block 0xd, offset 0x340 - 0x340: 0xba, 0x341: 0xba, 0x342: 0xba, 0x343: 0xba, 0x344: 0xba, 0x345: 0xba, 0x346: 0xba, 0x347: 0xba, - 0x348: 0xba, 0x349: 0xba, 0x34a: 0xba, 0x34b: 0xba, 0x34c: 0xba, 0x34d: 0xba, 0x34e: 0xba, 0x34f: 0xba, - 0x350: 0xba, 0x351: 0xba, 0x352: 0xba, 0x353: 0xba, 0x354: 0xba, 0x355: 0xba, 0x356: 0xba, 0x357: 0xba, - 0x358: 0xba, 0x359: 0xba, 0x35a: 0xba, 0x35b: 0xba, 0x35c: 0xba, 0x35d: 0xba, 0x35e: 0xba, 0x35f: 0xba, - 0x360: 0xba, 0x361: 0xba, 0x362: 0xba, 0x363: 0xba, 0x364: 0xba, 0x365: 0xba, 0x366: 0xba, 0x367: 0xba, - 0x368: 0xba, 0x369: 0xba, 0x36a: 0xba, 0x36b: 0xba, 0x36c: 0xba, 0x36d: 0xba, 0x36e: 0xba, 0x36f: 0xba, - 0x370: 0xba, 0x371: 0xba, 0x372: 0xba, 0x373: 0xba, 0x374: 0xba, 0x375: 0xba, 0x376: 0xba, 0x377: 0xba, - 0x378: 0xba, 0x379: 0xba, 0x37a: 0xba, 0x37b: 0xba, 0x37c: 0xba, 0x37d: 0xba, 0x37e: 0xba, 0x37f: 0xba, - // Block 0xe, offset 0x380 - 0x380: 0xba, 0x381: 0xba, 0x382: 0xba, 0x383: 0xba, 0x384: 0xba, 0x385: 0xba, 0x386: 0xba, 0x387: 0xba, - 0x388: 0xba, 0x389: 0xba, 0x38a: 0xba, 0x38b: 0xba, 0x38c: 0xba, 0x38d: 0xba, 0x38e: 0xba, 0x38f: 0xba, - 0x390: 0xba, 0x391: 0xba, 0x392: 0xba, 0x393: 0xba, 0x394: 0xba, 0x395: 0xba, 0x396: 0xba, 0x397: 0xba, - 0x398: 0xba, 0x399: 0xba, 0x39a: 0xba, 0x39b: 0xba, 0x39c: 0xba, 0x39d: 0xba, 0x39e: 0xba, 0x39f: 0xba, - 0x3a0: 0xba, 0x3a1: 0xba, 0x3a2: 0xba, 0x3a3: 0xba, 0x3a4: 0xfb, 0x3a5: 0xfc, 0x3a6: 0xfd, 0x3a7: 0xfe, - 0x3a8: 0x47, 0x3a9: 0xff, 0x3aa: 0x100, 0x3ab: 0x48, 0x3ac: 0x49, 0x3ad: 0x4a, 0x3ae: 0x4b, 0x3af: 0x4c, - 0x3b0: 0x101, 0x3b1: 0x4d, 0x3b2: 0x4e, 0x3b3: 0x4f, 0x3b4: 0x50, 0x3b5: 0x51, 0x3b6: 0x102, 0x3b7: 0x52, - 0x3b8: 0x53, 0x3b9: 0x54, 0x3ba: 0x55, 0x3bb: 0x56, 0x3bc: 0x57, 0x3bd: 0x58, 0x3be: 0x59, 0x3bf: 0x5a, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x103, 0x3c1: 0x104, 0x3c2: 0x9f, 0x3c3: 0x105, 0x3c4: 0x106, 0x3c5: 0x9b, 0x3c6: 0x107, 0x3c7: 0x108, - 0x3c8: 0xba, 0x3c9: 0xba, 0x3ca: 0x109, 0x3cb: 0x10a, 0x3cc: 0x10b, 0x3cd: 0x10c, 0x3ce: 0x10d, 0x3cf: 0x10e, - 0x3d0: 0x10f, 0x3d1: 0x9f, 0x3d2: 0x110, 0x3d3: 0x111, 0x3d4: 0x112, 0x3d5: 0x113, 0x3d6: 0xba, 0x3d7: 0xba, - 0x3d8: 0x9f, 0x3d9: 0x9f, 0x3da: 0x9f, 0x3db: 0x9f, 0x3dc: 0x114, 0x3dd: 0x115, 0x3de: 0xba, 0x3df: 0xba, - 0x3e0: 0x116, 0x3e1: 0x117, 0x3e2: 0x118, 0x3e3: 0x119, 0x3e4: 0x11a, 0x3e5: 0xba, 0x3e6: 0x11b, 0x3e7: 0x11c, - 0x3e8: 0x11d, 0x3e9: 0x11e, 0x3ea: 0x11f, 0x3eb: 0x5b, 0x3ec: 0x120, 0x3ed: 0x121, 0x3ee: 0x5c, 0x3ef: 0xba, - 0x3f0: 0x122, 0x3f1: 0x123, 0x3f2: 0x124, 0x3f3: 0x125, 0x3f4: 0xba, 0x3f5: 0xba, 0x3f6: 0xba, 0x3f7: 0xba, - 0x3f8: 0xba, 0x3f9: 0x126, 0x3fa: 0xba, 0x3fb: 0xba, 0x3fc: 0xba, 0x3fd: 0xba, 0x3fe: 0xba, 0x3ff: 0xba, - // Block 0x10, offset 0x400 - 0x400: 0x127, 0x401: 0x128, 0x402: 0x129, 0x403: 0x12a, 0x404: 0x12b, 0x405: 0x12c, 0x406: 0x12d, 0x407: 0x12e, - 0x408: 0x12f, 0x409: 0xba, 0x40a: 0x130, 0x40b: 0x131, 0x40c: 0x5d, 0x40d: 0x5e, 0x40e: 0xba, 0x40f: 0xba, - 0x410: 0x132, 0x411: 0x133, 0x412: 0x134, 0x413: 0x135, 0x414: 0xba, 0x415: 0xba, 0x416: 0x136, 0x417: 0x137, - 0x418: 0x138, 0x419: 0x139, 0x41a: 0x13a, 0x41b: 0x13b, 0x41c: 0x13c, 0x41d: 0xba, 0x41e: 0xba, 0x41f: 0xba, - 0x420: 0xba, 0x421: 0xba, 0x422: 0x13d, 0x423: 0x13e, 0x424: 0xba, 0x425: 0xba, 0x426: 0xba, 0x427: 0xba, - 0x428: 0x13f, 0x429: 0x140, 0x42a: 0x141, 0x42b: 0x142, 0x42c: 0xba, 0x42d: 0xba, 0x42e: 0xba, 0x42f: 0xba, - 0x430: 0x143, 0x431: 0x144, 0x432: 0x145, 0x433: 0xba, 0x434: 0x146, 0x435: 0x147, 0x436: 0xba, 0x437: 0xba, - 0x438: 0xba, 0x439: 0xba, 0x43a: 0xba, 0x43b: 0xba, 0x43c: 0xba, 0x43d: 0xba, 0x43e: 0xba, 0x43f: 0xba, - // Block 0x11, offset 0x440 - 0x440: 0x9f, 0x441: 0x9f, 0x442: 0x9f, 0x443: 0x9f, 0x444: 0x9f, 0x445: 0x9f, 0x446: 0x9f, 0x447: 0x9f, - 0x448: 0x9f, 0x449: 0x9f, 0x44a: 0x9f, 0x44b: 0x9f, 0x44c: 0x9f, 0x44d: 0x9f, 0x44e: 0x148, 0x44f: 0xba, - 0x450: 0x9b, 0x451: 0x149, 0x452: 0x9f, 0x453: 0x9f, 0x454: 0x9f, 0x455: 0x14a, 0x456: 0xba, 0x457: 0xba, - 0x458: 0xba, 0x459: 0xba, 0x45a: 0xba, 0x45b: 0xba, 0x45c: 0xba, 0x45d: 0xba, 0x45e: 0xba, 0x45f: 0xba, - 0x460: 0xba, 0x461: 0xba, 0x462: 0xba, 0x463: 0xba, 0x464: 0xba, 0x465: 0xba, 0x466: 0xba, 0x467: 0xba, - 0x468: 0xba, 0x469: 0xba, 0x46a: 0xba, 0x46b: 0xba, 0x46c: 0xba, 0x46d: 0xba, 0x46e: 0xba, 0x46f: 0xba, - 0x470: 0xba, 0x471: 0xba, 0x472: 0xba, 0x473: 0xba, 0x474: 0xba, 0x475: 0xba, 0x476: 0xba, 0x477: 0xba, - 0x478: 0xba, 0x479: 0xba, 0x47a: 0xba, 0x47b: 0xba, 0x47c: 0xba, 0x47d: 0xba, 0x47e: 0xba, 0x47f: 0xba, - // Block 0x12, offset 0x480 - 0x480: 0x9f, 0x481: 0x9f, 0x482: 0x9f, 0x483: 0x9f, 0x484: 0x9f, 0x485: 0x9f, 0x486: 0x9f, 0x487: 0x9f, - 0x488: 0x9f, 0x489: 0x9f, 0x48a: 0x9f, 0x48b: 0x9f, 0x48c: 0x9f, 0x48d: 0x9f, 0x48e: 0x9f, 0x48f: 0x9f, - 0x490: 0x14b, 0x491: 0xba, 0x492: 0xba, 0x493: 0xba, 0x494: 0xba, 0x495: 0xba, 0x496: 0xba, 0x497: 0xba, - 0x498: 0xba, 0x499: 0xba, 0x49a: 0xba, 0x49b: 0xba, 0x49c: 0xba, 0x49d: 0xba, 0x49e: 0xba, 0x49f: 0xba, - 0x4a0: 0xba, 0x4a1: 0xba, 0x4a2: 0xba, 0x4a3: 0xba, 0x4a4: 0xba, 0x4a5: 0xba, 0x4a6: 0xba, 0x4a7: 0xba, - 0x4a8: 0xba, 0x4a9: 0xba, 0x4aa: 0xba, 0x4ab: 0xba, 0x4ac: 0xba, 0x4ad: 0xba, 0x4ae: 0xba, 0x4af: 0xba, - 0x4b0: 0xba, 0x4b1: 0xba, 0x4b2: 0xba, 0x4b3: 0xba, 0x4b4: 0xba, 0x4b5: 0xba, 0x4b6: 0xba, 0x4b7: 0xba, - 0x4b8: 0xba, 0x4b9: 0xba, 0x4ba: 0xba, 0x4bb: 0xba, 0x4bc: 0xba, 0x4bd: 0xba, 0x4be: 0xba, 0x4bf: 0xba, - // Block 0x13, offset 0x4c0 - 0x4c0: 0xba, 0x4c1: 0xba, 0x4c2: 0xba, 0x4c3: 0xba, 0x4c4: 0xba, 0x4c5: 0xba, 0x4c6: 0xba, 0x4c7: 0xba, - 0x4c8: 0xba, 0x4c9: 0xba, 0x4ca: 0xba, 0x4cb: 0xba, 0x4cc: 0xba, 0x4cd: 0xba, 0x4ce: 0xba, 0x4cf: 0xba, - 0x4d0: 0x9f, 0x4d1: 0x9f, 0x4d2: 0x9f, 0x4d3: 0x9f, 0x4d4: 0x9f, 0x4d5: 0x9f, 0x4d6: 0x9f, 0x4d7: 0x9f, - 0x4d8: 0x9f, 0x4d9: 0x14c, 0x4da: 0xba, 0x4db: 0xba, 0x4dc: 0xba, 0x4dd: 0xba, 0x4de: 0xba, 0x4df: 0xba, - 0x4e0: 0xba, 0x4e1: 0xba, 0x4e2: 0xba, 0x4e3: 0xba, 0x4e4: 0xba, 0x4e5: 0xba, 0x4e6: 0xba, 0x4e7: 0xba, - 0x4e8: 0xba, 0x4e9: 0xba, 0x4ea: 0xba, 0x4eb: 0xba, 0x4ec: 0xba, 0x4ed: 0xba, 0x4ee: 0xba, 0x4ef: 0xba, - 0x4f0: 0xba, 0x4f1: 0xba, 0x4f2: 0xba, 0x4f3: 0xba, 0x4f4: 0xba, 0x4f5: 0xba, 0x4f6: 0xba, 0x4f7: 0xba, - 0x4f8: 0xba, 0x4f9: 0xba, 0x4fa: 0xba, 0x4fb: 0xba, 0x4fc: 0xba, 0x4fd: 0xba, 0x4fe: 0xba, 0x4ff: 0xba, - // Block 0x14, offset 0x500 - 0x500: 0xba, 0x501: 0xba, 0x502: 0xba, 0x503: 0xba, 0x504: 0xba, 0x505: 0xba, 0x506: 0xba, 0x507: 0xba, - 0x508: 0xba, 0x509: 0xba, 0x50a: 0xba, 0x50b: 0xba, 0x50c: 0xba, 0x50d: 0xba, 0x50e: 0xba, 0x50f: 0xba, - 0x510: 0xba, 0x511: 0xba, 0x512: 0xba, 0x513: 0xba, 0x514: 0xba, 0x515: 0xba, 0x516: 0xba, 0x517: 0xba, - 0x518: 0xba, 0x519: 0xba, 0x51a: 0xba, 0x51b: 0xba, 0x51c: 0xba, 0x51d: 0xba, 0x51e: 0xba, 0x51f: 0xba, - 0x520: 0x9f, 0x521: 0x9f, 0x522: 0x9f, 0x523: 0x9f, 0x524: 0x9f, 0x525: 0x9f, 0x526: 0x9f, 0x527: 0x9f, - 0x528: 0x142, 0x529: 0x14d, 0x52a: 0xba, 0x52b: 0x14e, 0x52c: 0x14f, 0x52d: 0x150, 0x52e: 0x151, 0x52f: 0xba, - 0x530: 0xba, 0x531: 0xba, 0x532: 0xba, 0x533: 0xba, 0x534: 0xba, 0x535: 0xba, 0x536: 0xba, 0x537: 0xba, - 0x538: 0xba, 0x539: 0xba, 0x53a: 0xba, 0x53b: 0xba, 0x53c: 0x9f, 0x53d: 0x152, 0x53e: 0x153, 0x53f: 0x154, - // Block 0x15, offset 0x540 - 0x540: 0x9f, 0x541: 0x9f, 0x542: 0x9f, 0x543: 0x9f, 0x544: 0x9f, 0x545: 0x9f, 0x546: 0x9f, 0x547: 0x9f, - 0x548: 0x9f, 0x549: 0x9f, 0x54a: 0x9f, 0x54b: 0x9f, 0x54c: 0x9f, 0x54d: 0x9f, 0x54e: 0x9f, 0x54f: 0x9f, - 0x550: 0x9f, 0x551: 0x9f, 0x552: 0x9f, 0x553: 0x9f, 0x554: 0x9f, 0x555: 0x9f, 0x556: 0x9f, 0x557: 0x9f, - 0x558: 0x9f, 0x559: 0x9f, 0x55a: 0x9f, 0x55b: 0x9f, 0x55c: 0x9f, 0x55d: 0x9f, 0x55e: 0x9f, 0x55f: 0x155, - 0x560: 0x9f, 0x561: 0x9f, 0x562: 0x9f, 0x563: 0x9f, 0x564: 0x9f, 0x565: 0x9f, 0x566: 0x9f, 0x567: 0x9f, - 0x568: 0x9f, 0x569: 0x9f, 0x56a: 0x9f, 0x56b: 0x156, 0x56c: 0xba, 0x56d: 0xba, 0x56e: 0xba, 0x56f: 0xba, - 0x570: 0xba, 0x571: 0xba, 0x572: 0xba, 0x573: 0xba, 0x574: 0xba, 0x575: 0xba, 0x576: 0xba, 0x577: 0xba, - 0x578: 0xba, 0x579: 0xba, 0x57a: 0xba, 0x57b: 0xba, 0x57c: 0xba, 0x57d: 0xba, 0x57e: 0xba, 0x57f: 0xba, - // Block 0x16, offset 0x580 - 0x580: 0x9f, 0x581: 0x9f, 0x582: 0x9f, 0x583: 0x9f, 0x584: 0x157, 0x585: 0x158, 0x586: 0x9f, 0x587: 0x9f, - 0x588: 0x9f, 0x589: 0x9f, 0x58a: 0x9f, 0x58b: 0x159, 0x58c: 0xba, 0x58d: 0xba, 0x58e: 0xba, 0x58f: 0xba, - 0x590: 0xba, 0x591: 0xba, 0x592: 0xba, 0x593: 0xba, 0x594: 0xba, 0x595: 0xba, 0x596: 0xba, 0x597: 0xba, - 0x598: 0xba, 0x599: 0xba, 0x59a: 0xba, 0x59b: 0xba, 0x59c: 0xba, 0x59d: 0xba, 0x59e: 0xba, 0x59f: 0xba, - 0x5a0: 0xba, 0x5a1: 0xba, 0x5a2: 0xba, 0x5a3: 0xba, 0x5a4: 0xba, 0x5a5: 0xba, 0x5a6: 0xba, 0x5a7: 0xba, - 0x5a8: 0xba, 0x5a9: 0xba, 0x5aa: 0xba, 0x5ab: 0xba, 0x5ac: 0xba, 0x5ad: 0xba, 0x5ae: 0xba, 0x5af: 0xba, - 0x5b0: 0x9f, 0x5b1: 0x15a, 0x5b2: 0x15b, 0x5b3: 0xba, 0x5b4: 0xba, 0x5b5: 0xba, 0x5b6: 0xba, 0x5b7: 0xba, - 0x5b8: 0xba, 0x5b9: 0xba, 0x5ba: 0xba, 0x5bb: 0xba, 0x5bc: 0xba, 0x5bd: 0xba, 0x5be: 0xba, 0x5bf: 0xba, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x9b, 0x5c1: 0x9b, 0x5c2: 0x9b, 0x5c3: 0x15c, 0x5c4: 0x15d, 0x5c5: 0x15e, 0x5c6: 0x15f, 0x5c7: 0x160, - 0x5c8: 0x9b, 0x5c9: 0x161, 0x5ca: 0xba, 0x5cb: 0xba, 0x5cc: 0x9b, 0x5cd: 0x162, 0x5ce: 0xba, 0x5cf: 0xba, - 0x5d0: 0x5f, 0x5d1: 0x60, 0x5d2: 0x61, 0x5d3: 0x62, 0x5d4: 0x63, 0x5d5: 0x64, 0x5d6: 0x65, 0x5d7: 0x66, - 0x5d8: 0x67, 0x5d9: 0x68, 0x5da: 0x69, 0x5db: 0x6a, 0x5dc: 0x6b, 0x5dd: 0x6c, 0x5de: 0x6d, 0x5df: 0x6e, - 0x5e0: 0x9b, 0x5e1: 0x9b, 0x5e2: 0x9b, 0x5e3: 0x9b, 0x5e4: 0x9b, 0x5e5: 0x9b, 0x5e6: 0x9b, 0x5e7: 0x9b, - 0x5e8: 0x163, 0x5e9: 0x164, 0x5ea: 0x165, 0x5eb: 0xba, 0x5ec: 0xba, 0x5ed: 0xba, 0x5ee: 0xba, 0x5ef: 0xba, - 0x5f0: 0xba, 0x5f1: 0xba, 0x5f2: 0xba, 0x5f3: 0xba, 0x5f4: 0xba, 0x5f5: 0xba, 0x5f6: 0xba, 0x5f7: 0xba, - 0x5f8: 0xba, 0x5f9: 0xba, 0x5fa: 0xba, 0x5fb: 0xba, 0x5fc: 0xba, 0x5fd: 0xba, 0x5fe: 0xba, 0x5ff: 0xba, - // Block 0x18, offset 0x600 - 0x600: 0x166, 0x601: 0xba, 0x602: 0xba, 0x603: 0xba, 0x604: 0xba, 0x605: 0xba, 0x606: 0xba, 0x607: 0xba, - 0x608: 0xba, 0x609: 0xba, 0x60a: 0xba, 0x60b: 0xba, 0x60c: 0xba, 0x60d: 0xba, 0x60e: 0xba, 0x60f: 0xba, - 0x610: 0xba, 0x611: 0xba, 0x612: 0xba, 0x613: 0xba, 0x614: 0xba, 0x615: 0xba, 0x616: 0xba, 0x617: 0xba, - 0x618: 0xba, 0x619: 0xba, 0x61a: 0xba, 0x61b: 0xba, 0x61c: 0xba, 0x61d: 0xba, 0x61e: 0xba, 0x61f: 0xba, - 0x620: 0x122, 0x621: 0x122, 0x622: 0x122, 0x623: 0x167, 0x624: 0x6f, 0x625: 0x168, 0x626: 0xba, 0x627: 0xba, - 0x628: 0xba, 0x629: 0xba, 0x62a: 0xba, 0x62b: 0xba, 0x62c: 0xba, 0x62d: 0xba, 0x62e: 0xba, 0x62f: 0xba, - 0x630: 0xba, 0x631: 0xba, 0x632: 0xba, 0x633: 0xba, 0x634: 0xba, 0x635: 0xba, 0x636: 0xba, 0x637: 0xba, - 0x638: 0x70, 0x639: 0x71, 0x63a: 0x72, 0x63b: 0x169, 0x63c: 0xba, 0x63d: 0xba, 0x63e: 0xba, 0x63f: 0xba, - // Block 0x19, offset 0x640 - 0x640: 0x16a, 0x641: 0x9b, 0x642: 0x16b, 0x643: 0x16c, 0x644: 0x73, 0x645: 0x74, 0x646: 0x16d, 0x647: 0x16e, - 0x648: 0x75, 0x649: 0x16f, 0x64a: 0xba, 0x64b: 0xba, 0x64c: 0x9b, 0x64d: 0x9b, 0x64e: 0x9b, 0x64f: 0x9b, - 0x650: 0x9b, 0x651: 0x9b, 0x652: 0x9b, 0x653: 0x9b, 0x654: 0x9b, 0x655: 0x9b, 0x656: 0x9b, 0x657: 0x9b, - 0x658: 0x9b, 0x659: 0x9b, 0x65a: 0x9b, 0x65b: 0x170, 0x65c: 0x9b, 0x65d: 0x171, 0x65e: 0x9b, 0x65f: 0x172, - 0x660: 0x173, 0x661: 0x174, 0x662: 0x175, 0x663: 0xba, 0x664: 0x176, 0x665: 0x177, 0x666: 0x178, 0x667: 0x179, - 0x668: 0xba, 0x669: 0xba, 0x66a: 0xba, 0x66b: 0xba, 0x66c: 0xba, 0x66d: 0xba, 0x66e: 0xba, 0x66f: 0xba, - 0x670: 0xba, 0x671: 0xba, 0x672: 0xba, 0x673: 0xba, 0x674: 0xba, 0x675: 0xba, 0x676: 0xba, 0x677: 0xba, - 0x678: 0xba, 0x679: 0xba, 0x67a: 0xba, 0x67b: 0xba, 0x67c: 0xba, 0x67d: 0xba, 0x67e: 0xba, 0x67f: 0xba, - // Block 0x1a, offset 0x680 - 0x680: 0x9f, 0x681: 0x9f, 0x682: 0x9f, 0x683: 0x9f, 0x684: 0x9f, 0x685: 0x9f, 0x686: 0x9f, 0x687: 0x9f, - 0x688: 0x9f, 0x689: 0x9f, 0x68a: 0x9f, 0x68b: 0x9f, 0x68c: 0x9f, 0x68d: 0x9f, 0x68e: 0x9f, 0x68f: 0x9f, - 0x690: 0x9f, 0x691: 0x9f, 0x692: 0x9f, 0x693: 0x9f, 0x694: 0x9f, 0x695: 0x9f, 0x696: 0x9f, 0x697: 0x9f, - 0x698: 0x9f, 0x699: 0x9f, 0x69a: 0x9f, 0x69b: 0x17a, 0x69c: 0x9f, 0x69d: 0x9f, 0x69e: 0x9f, 0x69f: 0x9f, - 0x6a0: 0x9f, 0x6a1: 0x9f, 0x6a2: 0x9f, 0x6a3: 0x9f, 0x6a4: 0x9f, 0x6a5: 0x9f, 0x6a6: 0x9f, 0x6a7: 0x9f, - 0x6a8: 0x9f, 0x6a9: 0x9f, 0x6aa: 0x9f, 0x6ab: 0x9f, 0x6ac: 0x9f, 0x6ad: 0x9f, 0x6ae: 0x9f, 0x6af: 0x9f, - 0x6b0: 0x9f, 0x6b1: 0x9f, 0x6b2: 0x9f, 0x6b3: 0x9f, 0x6b4: 0x9f, 0x6b5: 0x9f, 0x6b6: 0x9f, 0x6b7: 0x9f, - 0x6b8: 0x9f, 0x6b9: 0x9f, 0x6ba: 0x9f, 0x6bb: 0x9f, 0x6bc: 0x9f, 0x6bd: 0x9f, 0x6be: 0x9f, 0x6bf: 0x9f, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x9f, 0x6c1: 0x9f, 0x6c2: 0x9f, 0x6c3: 0x9f, 0x6c4: 0x9f, 0x6c5: 0x9f, 0x6c6: 0x9f, 0x6c7: 0x9f, - 0x6c8: 0x9f, 0x6c9: 0x9f, 0x6ca: 0x9f, 0x6cb: 0x9f, 0x6cc: 0x9f, 0x6cd: 0x9f, 0x6ce: 0x9f, 0x6cf: 0x9f, - 0x6d0: 0x9f, 0x6d1: 0x9f, 0x6d2: 0x9f, 0x6d3: 0x9f, 0x6d4: 0x9f, 0x6d5: 0x9f, 0x6d6: 0x9f, 0x6d7: 0x9f, - 0x6d8: 0x9f, 0x6d9: 0x9f, 0x6da: 0x9f, 0x6db: 0x9f, 0x6dc: 0x17b, 0x6dd: 0x9f, 0x6de: 0x9f, 0x6df: 0x9f, - 0x6e0: 0x17c, 0x6e1: 0x9f, 0x6e2: 0x9f, 0x6e3: 0x9f, 0x6e4: 0x9f, 0x6e5: 0x9f, 0x6e6: 0x9f, 0x6e7: 0x9f, - 0x6e8: 0x9f, 0x6e9: 0x9f, 0x6ea: 0x9f, 0x6eb: 0x9f, 0x6ec: 0x9f, 0x6ed: 0x9f, 0x6ee: 0x9f, 0x6ef: 0x9f, - 0x6f0: 0x9f, 0x6f1: 0x9f, 0x6f2: 0x9f, 0x6f3: 0x9f, 0x6f4: 0x9f, 0x6f5: 0x9f, 0x6f6: 0x9f, 0x6f7: 0x9f, - 0x6f8: 0x9f, 0x6f9: 0x9f, 0x6fa: 0x9f, 0x6fb: 0x9f, 0x6fc: 0x9f, 0x6fd: 0x9f, 0x6fe: 0x9f, 0x6ff: 0x9f, - // Block 0x1c, offset 0x700 - 0x700: 0x9f, 0x701: 0x9f, 0x702: 0x9f, 0x703: 0x9f, 0x704: 0x9f, 0x705: 0x9f, 0x706: 0x9f, 0x707: 0x9f, - 0x708: 0x9f, 0x709: 0x9f, 0x70a: 0x9f, 0x70b: 0x9f, 0x70c: 0x9f, 0x70d: 0x9f, 0x70e: 0x9f, 0x70f: 0x9f, - 0x710: 0x9f, 0x711: 0x9f, 0x712: 0x9f, 0x713: 0x9f, 0x714: 0x9f, 0x715: 0x9f, 0x716: 0x9f, 0x717: 0x9f, - 0x718: 0x9f, 0x719: 0x9f, 0x71a: 0x9f, 0x71b: 0x9f, 0x71c: 0x9f, 0x71d: 0x9f, 0x71e: 0x9f, 0x71f: 0x9f, - 0x720: 0x9f, 0x721: 0x9f, 0x722: 0x9f, 0x723: 0x9f, 0x724: 0x9f, 0x725: 0x9f, 0x726: 0x9f, 0x727: 0x9f, - 0x728: 0x9f, 0x729: 0x9f, 0x72a: 0x9f, 0x72b: 0x9f, 0x72c: 0x9f, 0x72d: 0x9f, 0x72e: 0x9f, 0x72f: 0x9f, - 0x730: 0x9f, 0x731: 0x9f, 0x732: 0x9f, 0x733: 0x9f, 0x734: 0x9f, 0x735: 0x9f, 0x736: 0x9f, 0x737: 0x9f, - 0x738: 0x9f, 0x739: 0x9f, 0x73a: 0x17d, 0x73b: 0x9f, 0x73c: 0x9f, 0x73d: 0x9f, 0x73e: 0x9f, 0x73f: 0x9f, - // Block 0x1d, offset 0x740 - 0x740: 0x9f, 0x741: 0x9f, 0x742: 0x9f, 0x743: 0x9f, 0x744: 0x9f, 0x745: 0x9f, 0x746: 0x9f, 0x747: 0x9f, - 0x748: 0x9f, 0x749: 0x9f, 0x74a: 0x9f, 0x74b: 0x9f, 0x74c: 0x9f, 0x74d: 0x9f, 0x74e: 0x9f, 0x74f: 0x9f, - 0x750: 0x9f, 0x751: 0x9f, 0x752: 0x9f, 0x753: 0x9f, 0x754: 0x9f, 0x755: 0x9f, 0x756: 0x9f, 0x757: 0x9f, - 0x758: 0x9f, 0x759: 0x9f, 0x75a: 0x9f, 0x75b: 0x9f, 0x75c: 0x9f, 0x75d: 0x9f, 0x75e: 0x9f, 0x75f: 0x9f, - 0x760: 0x9f, 0x761: 0x9f, 0x762: 0x9f, 0x763: 0x9f, 0x764: 0x9f, 0x765: 0x9f, 0x766: 0x9f, 0x767: 0x9f, - 0x768: 0x9f, 0x769: 0x9f, 0x76a: 0x9f, 0x76b: 0x9f, 0x76c: 0x9f, 0x76d: 0x9f, 0x76e: 0x9f, 0x76f: 0x17e, - 0x770: 0xba, 0x771: 0xba, 0x772: 0xba, 0x773: 0xba, 0x774: 0xba, 0x775: 0xba, 0x776: 0xba, 0x777: 0xba, - 0x778: 0xba, 0x779: 0xba, 0x77a: 0xba, 0x77b: 0xba, 0x77c: 0xba, 0x77d: 0xba, 0x77e: 0xba, 0x77f: 0xba, - // Block 0x1e, offset 0x780 - 0x780: 0xba, 0x781: 0xba, 0x782: 0xba, 0x783: 0xba, 0x784: 0xba, 0x785: 0xba, 0x786: 0xba, 0x787: 0xba, - 0x788: 0xba, 0x789: 0xba, 0x78a: 0xba, 0x78b: 0xba, 0x78c: 0xba, 0x78d: 0xba, 0x78e: 0xba, 0x78f: 0xba, - 0x790: 0xba, 0x791: 0xba, 0x792: 0xba, 0x793: 0xba, 0x794: 0xba, 0x795: 0xba, 0x796: 0xba, 0x797: 0xba, - 0x798: 0xba, 0x799: 0xba, 0x79a: 0xba, 0x79b: 0xba, 0x79c: 0xba, 0x79d: 0xba, 0x79e: 0xba, 0x79f: 0xba, - 0x7a0: 0x76, 0x7a1: 0x77, 0x7a2: 0x78, 0x7a3: 0x17f, 0x7a4: 0x79, 0x7a5: 0x7a, 0x7a6: 0x180, 0x7a7: 0x7b, - 0x7a8: 0x7c, 0x7a9: 0xba, 0x7aa: 0xba, 0x7ab: 0xba, 0x7ac: 0xba, 0x7ad: 0xba, 0x7ae: 0xba, 0x7af: 0xba, - 0x7b0: 0xba, 0x7b1: 0xba, 0x7b2: 0xba, 0x7b3: 0xba, 0x7b4: 0xba, 0x7b5: 0xba, 0x7b6: 0xba, 0x7b7: 0xba, - 0x7b8: 0xba, 0x7b9: 0xba, 0x7ba: 0xba, 0x7bb: 0xba, 0x7bc: 0xba, 0x7bd: 0xba, 0x7be: 0xba, 0x7bf: 0xba, - // Block 0x1f, offset 0x7c0 - 0x7d0: 0x0d, 0x7d1: 0x0e, 0x7d2: 0x0f, 0x7d3: 0x10, 0x7d4: 0x11, 0x7d5: 0x0b, 0x7d6: 0x12, 0x7d7: 0x07, - 0x7d8: 0x13, 0x7d9: 0x0b, 0x7da: 0x0b, 0x7db: 0x14, 0x7dc: 0x0b, 0x7dd: 0x15, 0x7de: 0x16, 0x7df: 0x17, - 0x7e0: 0x07, 0x7e1: 0x07, 0x7e2: 0x07, 0x7e3: 0x07, 0x7e4: 0x07, 0x7e5: 0x07, 0x7e6: 0x07, 0x7e7: 0x07, - 0x7e8: 0x07, 0x7e9: 0x07, 0x7ea: 0x18, 0x7eb: 0x19, 0x7ec: 0x1a, 0x7ed: 0x07, 0x7ee: 0x1b, 0x7ef: 0x1c, - 0x7f0: 0x0b, 0x7f1: 0x0b, 0x7f2: 0x0b, 0x7f3: 0x0b, 0x7f4: 0x0b, 0x7f5: 0x0b, 0x7f6: 0x0b, 0x7f7: 0x0b, - 0x7f8: 0x0b, 0x7f9: 0x0b, 0x7fa: 0x0b, 0x7fb: 0x0b, 0x7fc: 0x0b, 0x7fd: 0x0b, 0x7fe: 0x0b, 0x7ff: 0x0b, - // Block 0x20, offset 0x800 - 0x800: 0x0b, 0x801: 0x0b, 0x802: 0x0b, 0x803: 0x0b, 0x804: 0x0b, 0x805: 0x0b, 0x806: 0x0b, 0x807: 0x0b, - 0x808: 0x0b, 0x809: 0x0b, 0x80a: 0x0b, 0x80b: 0x0b, 0x80c: 0x0b, 0x80d: 0x0b, 0x80e: 0x0b, 0x80f: 0x0b, - 0x810: 0x0b, 0x811: 0x0b, 0x812: 0x0b, 0x813: 0x0b, 0x814: 0x0b, 0x815: 0x0b, 0x816: 0x0b, 0x817: 0x0b, - 0x818: 0x0b, 0x819: 0x0b, 0x81a: 0x0b, 0x81b: 0x0b, 0x81c: 0x0b, 0x81d: 0x0b, 0x81e: 0x0b, 0x81f: 0x0b, - 0x820: 0x0b, 0x821: 0x0b, 0x822: 0x0b, 0x823: 0x0b, 0x824: 0x0b, 0x825: 0x0b, 0x826: 0x0b, 0x827: 0x0b, - 0x828: 0x0b, 0x829: 0x0b, 0x82a: 0x0b, 0x82b: 0x0b, 0x82c: 0x0b, 0x82d: 0x0b, 0x82e: 0x0b, 0x82f: 0x0b, - 0x830: 0x0b, 0x831: 0x0b, 0x832: 0x0b, 0x833: 0x0b, 0x834: 0x0b, 0x835: 0x0b, 0x836: 0x0b, 0x837: 0x0b, - 0x838: 0x0b, 0x839: 0x0b, 0x83a: 0x0b, 0x83b: 0x0b, 0x83c: 0x0b, 0x83d: 0x0b, 0x83e: 0x0b, 0x83f: 0x0b, - // Block 0x21, offset 0x840 - 0x840: 0x181, 0x841: 0x182, 0x842: 0xba, 0x843: 0xba, 0x844: 0x183, 0x845: 0x183, 0x846: 0x183, 0x847: 0x184, - 0x848: 0xba, 0x849: 0xba, 0x84a: 0xba, 0x84b: 0xba, 0x84c: 0xba, 0x84d: 0xba, 0x84e: 0xba, 0x84f: 0xba, - 0x850: 0xba, 0x851: 0xba, 0x852: 0xba, 0x853: 0xba, 0x854: 0xba, 0x855: 0xba, 0x856: 0xba, 0x857: 0xba, - 0x858: 0xba, 0x859: 0xba, 0x85a: 0xba, 0x85b: 0xba, 0x85c: 0xba, 0x85d: 0xba, 0x85e: 0xba, 0x85f: 0xba, - 0x860: 0xba, 0x861: 0xba, 0x862: 0xba, 0x863: 0xba, 0x864: 0xba, 0x865: 0xba, 0x866: 0xba, 0x867: 0xba, - 0x868: 0xba, 0x869: 0xba, 0x86a: 0xba, 0x86b: 0xba, 0x86c: 0xba, 0x86d: 0xba, 0x86e: 0xba, 0x86f: 0xba, - 0x870: 0xba, 0x871: 0xba, 0x872: 0xba, 0x873: 0xba, 0x874: 0xba, 0x875: 0xba, 0x876: 0xba, 0x877: 0xba, - 0x878: 0xba, 0x879: 0xba, 0x87a: 0xba, 0x87b: 0xba, 0x87c: 0xba, 0x87d: 0xba, 0x87e: 0xba, 0x87f: 0xba, - // Block 0x22, offset 0x880 - 0x880: 0x0b, 0x881: 0x0b, 0x882: 0x0b, 0x883: 0x0b, 0x884: 0x0b, 0x885: 0x0b, 0x886: 0x0b, 0x887: 0x0b, - 0x888: 0x0b, 0x889: 0x0b, 0x88a: 0x0b, 0x88b: 0x0b, 0x88c: 0x0b, 0x88d: 0x0b, 0x88e: 0x0b, 0x88f: 0x0b, - 0x890: 0x0b, 0x891: 0x0b, 0x892: 0x0b, 0x893: 0x0b, 0x894: 0x0b, 0x895: 0x0b, 0x896: 0x0b, 0x897: 0x0b, - 0x898: 0x0b, 0x899: 0x0b, 0x89a: 0x0b, 0x89b: 0x0b, 0x89c: 0x0b, 0x89d: 0x0b, 0x89e: 0x0b, 0x89f: 0x0b, - 0x8a0: 0x1f, 0x8a1: 0x0b, 0x8a2: 0x0b, 0x8a3: 0x0b, 0x8a4: 0x0b, 0x8a5: 0x0b, 0x8a6: 0x0b, 0x8a7: 0x0b, - 0x8a8: 0x0b, 0x8a9: 0x0b, 0x8aa: 0x0b, 0x8ab: 0x0b, 0x8ac: 0x0b, 0x8ad: 0x0b, 0x8ae: 0x0b, 0x8af: 0x0b, - 0x8b0: 0x0b, 0x8b1: 0x0b, 0x8b2: 0x0b, 0x8b3: 0x0b, 0x8b4: 0x0b, 0x8b5: 0x0b, 0x8b6: 0x0b, 0x8b7: 0x0b, - 0x8b8: 0x0b, 0x8b9: 0x0b, 0x8ba: 0x0b, 0x8bb: 0x0b, 0x8bc: 0x0b, 0x8bd: 0x0b, 0x8be: 0x0b, 0x8bf: 0x0b, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x0b, 0x8c1: 0x0b, 0x8c2: 0x0b, 0x8c3: 0x0b, 0x8c4: 0x0b, 0x8c5: 0x0b, 0x8c6: 0x0b, 0x8c7: 0x0b, - 0x8c8: 0x0b, 0x8c9: 0x0b, 0x8ca: 0x0b, 0x8cb: 0x0b, 0x8cc: 0x0b, 0x8cd: 0x0b, 0x8ce: 0x0b, 0x8cf: 0x0b, -} - -// idnaSparseOffset: 264 entries, 528 bytes -var idnaSparseOffset = []uint16{0x0, 0x8, 0x19, 0x25, 0x27, 0x2c, 0x34, 0x3f, 0x4b, 0x4f, 0x5e, 0x63, 0x6b, 0x77, 0x85, 0x8a, 0x93, 0xa3, 0xb1, 0xbd, 0xc9, 0xda, 0xe4, 0xeb, 0xf8, 0x109, 0x110, 0x11b, 0x12a, 0x138, 0x142, 0x144, 0x149, 0x14c, 0x14f, 0x151, 0x15d, 0x168, 0x170, 0x176, 0x17c, 0x181, 0x186, 0x189, 0x18d, 0x193, 0x198, 0x1a4, 0x1ae, 0x1b4, 0x1c5, 0x1cf, 0x1d2, 0x1da, 0x1dd, 0x1ea, 0x1f2, 0x1f6, 0x1fd, 0x205, 0x215, 0x221, 0x223, 0x22d, 0x239, 0x245, 0x251, 0x259, 0x25e, 0x268, 0x279, 0x27d, 0x288, 0x28c, 0x295, 0x29d, 0x2a3, 0x2a8, 0x2ab, 0x2af, 0x2b5, 0x2b9, 0x2bd, 0x2c3, 0x2ca, 0x2d0, 0x2d8, 0x2df, 0x2ea, 0x2f4, 0x2f8, 0x2fb, 0x301, 0x305, 0x307, 0x30a, 0x30c, 0x30f, 0x319, 0x31c, 0x32b, 0x32f, 0x334, 0x337, 0x33b, 0x340, 0x345, 0x34b, 0x351, 0x360, 0x366, 0x36a, 0x379, 0x37e, 0x386, 0x390, 0x39b, 0x3a3, 0x3b4, 0x3bd, 0x3cd, 0x3da, 0x3e4, 0x3e9, 0x3f6, 0x3fa, 0x3ff, 0x401, 0x405, 0x407, 0x40b, 0x414, 0x41a, 0x41e, 0x42e, 0x438, 0x43d, 0x440, 0x446, 0x44d, 0x452, 0x456, 0x45c, 0x461, 0x46a, 0x46f, 0x475, 0x47c, 0x483, 0x48a, 0x48e, 0x493, 0x496, 0x49b, 0x4a7, 0x4ad, 0x4b2, 0x4b9, 0x4c1, 0x4c6, 0x4ca, 0x4da, 0x4e1, 0x4e5, 0x4e9, 0x4f0, 0x4f2, 0x4f5, 0x4f8, 0x4fc, 0x500, 0x506, 0x50f, 0x51b, 0x522, 0x52b, 0x533, 0x53a, 0x548, 0x555, 0x562, 0x56b, 0x56f, 0x57d, 0x585, 0x590, 0x599, 0x59f, 0x5a7, 0x5b0, 0x5ba, 0x5bd, 0x5c9, 0x5cc, 0x5d1, 0x5de, 0x5e7, 0x5f3, 0x5f6, 0x600, 0x609, 0x615, 0x622, 0x62a, 0x62d, 0x632, 0x635, 0x638, 0x63b, 0x642, 0x649, 0x64d, 0x658, 0x65b, 0x661, 0x666, 0x66a, 0x66d, 0x670, 0x673, 0x676, 0x679, 0x67e, 0x688, 0x68b, 0x68f, 0x69e, 0x6aa, 0x6ae, 0x6b3, 0x6b8, 0x6bc, 0x6c1, 0x6ca, 0x6d5, 0x6db, 0x6e3, 0x6e7, 0x6eb, 0x6f1, 0x6f7, 0x6fc, 0x6ff, 0x70f, 0x716, 0x719, 0x71c, 0x720, 0x726, 0x72b, 0x730, 0x735, 0x738, 0x73d, 0x740, 0x743, 0x747, 0x74b, 0x74e, 0x75e, 0x76f, 0x774, 0x776, 0x778} - -// idnaSparseValues: 1915 entries, 7660 bytes -var idnaSparseValues = [1915]valueRange{ - // Block 0x0, offset 0x0 - {value: 0x0000, lo: 0x07}, - {value: 0xe105, lo: 0x80, hi: 0x96}, - {value: 0x0018, lo: 0x97, hi: 0x97}, - {value: 0xe105, lo: 0x98, hi: 0x9e}, - {value: 0x001f, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbf}, - // Block 0x1, offset 0x8 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0xe01d, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0335, lo: 0x83, hi: 0x83}, - {value: 0x034d, lo: 0x84, hi: 0x84}, - {value: 0x0365, lo: 0x85, hi: 0x85}, - {value: 0xe00d, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0xe00d, lo: 0x88, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x89}, - {value: 0xe00d, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe00d, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0x8d}, - {value: 0xe00d, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0xbf}, - // Block 0x2, offset 0x19 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x0249, lo: 0xb0, hi: 0xb0}, - {value: 0x037d, lo: 0xb1, hi: 0xb1}, - {value: 0x0259, lo: 0xb2, hi: 0xb2}, - {value: 0x0269, lo: 0xb3, hi: 0xb3}, - {value: 0x034d, lo: 0xb4, hi: 0xb4}, - {value: 0x0395, lo: 0xb5, hi: 0xb5}, - {value: 0xe1bd, lo: 0xb6, hi: 0xb6}, - {value: 0x0279, lo: 0xb7, hi: 0xb7}, - {value: 0x0289, lo: 0xb8, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbf}, - // Block 0x3, offset 0x25 - {value: 0x0000, lo: 0x01}, - {value: 0x3308, lo: 0x80, hi: 0xbf}, - // Block 0x4, offset 0x27 - {value: 0x0000, lo: 0x04}, - {value: 0x03f5, lo: 0x80, hi: 0x8f}, - {value: 0xe105, lo: 0x90, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x5, offset 0x2c - {value: 0x0000, lo: 0x07}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x0545, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x0008, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xbf}, - // Block 0x6, offset 0x34 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0401, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x88}, - {value: 0x0018, lo: 0x89, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0xbd}, - {value: 0x0818, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x7, offset 0x3f - {value: 0x0000, lo: 0x0b}, - {value: 0x0818, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x82}, - {value: 0x0818, lo: 0x83, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x85}, - {value: 0x0818, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0808, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x8, offset 0x4b - {value: 0x0000, lo: 0x03}, - {value: 0x0a08, lo: 0x80, hi: 0x87}, - {value: 0x0c08, lo: 0x88, hi: 0x99}, - {value: 0x0a08, lo: 0x9a, hi: 0xbf}, - // Block 0x9, offset 0x4f - {value: 0x0000, lo: 0x0e}, - {value: 0x3308, lo: 0x80, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0c08, lo: 0x8d, hi: 0x8d}, - {value: 0x0a08, lo: 0x8e, hi: 0x98}, - {value: 0x0c08, lo: 0x99, hi: 0x9b}, - {value: 0x0a08, lo: 0x9c, hi: 0xaa}, - {value: 0x0c08, lo: 0xab, hi: 0xac}, - {value: 0x0a08, lo: 0xad, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb1}, - {value: 0x0a08, lo: 0xb2, hi: 0xb2}, - {value: 0x0c08, lo: 0xb3, hi: 0xb4}, - {value: 0x0a08, lo: 0xb5, hi: 0xb7}, - {value: 0x0c08, lo: 0xb8, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbf}, - // Block 0xa, offset 0x5e - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xb0}, - {value: 0x0808, lo: 0xb1, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xb, offset 0x63 - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x89}, - {value: 0x0a08, lo: 0x8a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0xc, offset 0x6b - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x99}, - {value: 0x0808, lo: 0x9a, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa3}, - {value: 0x0808, lo: 0xa4, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa7}, - {value: 0x0808, lo: 0xa8, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0818, lo: 0xb0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xd, offset 0x77 - {value: 0x0000, lo: 0x0d}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0a08, lo: 0xa0, hi: 0xa9}, - {value: 0x0c08, lo: 0xaa, hi: 0xac}, - {value: 0x0808, lo: 0xad, hi: 0xad}, - {value: 0x0c08, lo: 0xae, hi: 0xae}, - {value: 0x0a08, lo: 0xaf, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb2}, - {value: 0x0a08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0a08, lo: 0xb6, hi: 0xb8}, - {value: 0x0c08, lo: 0xb9, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0xe, offset 0x85 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0xa1}, - {value: 0x0840, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xbf}, - // Block 0xf, offset 0x8a - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x10, offset 0x93 - {value: 0x0000, lo: 0x0f}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x85}, - {value: 0x3008, lo: 0x86, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x3008, lo: 0x8a, hi: 0x8c}, - {value: 0x3b08, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x11, offset 0xa3 - {value: 0x0000, lo: 0x0d}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x12, offset 0xb1 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xba}, - {value: 0x3b08, lo: 0xbb, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x13, offset 0xbd - {value: 0x0000, lo: 0x0b}, - {value: 0x0040, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x14, offset 0xc9 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x89}, - {value: 0x3b08, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x3008, lo: 0x98, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x15, offset 0xda - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb2}, - {value: 0x08f1, lo: 0xb3, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb9}, - {value: 0x3b08, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0x16, offset 0xe4 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x8e}, - {value: 0x0018, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0xbf}, - // Block 0x17, offset 0xeb - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0961, lo: 0x9c, hi: 0x9c}, - {value: 0x0999, lo: 0x9d, hi: 0x9d}, - {value: 0x0008, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x18, offset 0xf8 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe03d, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x19, offset 0x109 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0xbf}, - // Block 0x1a, offset 0x110 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x1b, offset 0x11b - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x3008, lo: 0x96, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x3308, lo: 0x9e, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xa1}, - {value: 0x3008, lo: 0xa2, hi: 0xa4}, - {value: 0x0008, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xbf}, - // Block 0x1c, offset 0x12a - {value: 0x0000, lo: 0x0d}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x8c}, - {value: 0x3308, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x3008, lo: 0x9a, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x1d, offset 0x138 - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x86}, - {value: 0x055d, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8c}, - {value: 0x055d, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbb}, - {value: 0xe105, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0x1e, offset 0x142 - {value: 0x0000, lo: 0x01}, - {value: 0x0018, lo: 0x80, hi: 0xbf}, - // Block 0x1f, offset 0x144 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa0}, - {value: 0x2018, lo: 0xa1, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x20, offset 0x149 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa7}, - {value: 0x2018, lo: 0xa8, hi: 0xbf}, - // Block 0x21, offset 0x14c - {value: 0x0000, lo: 0x02}, - {value: 0x2018, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0xbf}, - // Block 0x22, offset 0x14f - {value: 0x0000, lo: 0x01}, - {value: 0x0008, lo: 0x80, hi: 0xbf}, - // Block 0x23, offset 0x151 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x24, offset 0x15d - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x25, offset 0x168 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x26, offset 0x170 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x27, offset 0x176 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x28, offset 0x17c - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x29, offset 0x181 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x2a, offset 0x186 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x2b, offset 0x189 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xbf}, - // Block 0x2c, offset 0x18d - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x2d, offset 0x193 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0x2e, offset 0x198 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x3b08, lo: 0x94, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x2f, offset 0x1a4 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x30, offset 0x1ae - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xb3}, - {value: 0x3340, lo: 0xb4, hi: 0xb5}, - {value: 0x3008, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x31, offset 0x1b4 - {value: 0x0000, lo: 0x10}, - {value: 0x3008, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x91}, - {value: 0x3b08, lo: 0x92, hi: 0x92}, - {value: 0x3308, lo: 0x93, hi: 0x93}, - {value: 0x0018, lo: 0x94, hi: 0x96}, - {value: 0x0008, lo: 0x97, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x32, offset 0x1c5 - {value: 0x0000, lo: 0x09}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x86}, - {value: 0x0218, lo: 0x87, hi: 0x87}, - {value: 0x0018, lo: 0x88, hi: 0x8a}, - {value: 0x33c0, lo: 0x8b, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0208, lo: 0xa0, hi: 0xbf}, - // Block 0x33, offset 0x1cf - {value: 0x0000, lo: 0x02}, - {value: 0x0208, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x34, offset 0x1d2 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0208, lo: 0x87, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xa9}, - {value: 0x0208, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x35, offset 0x1da - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0x36, offset 0x1dd - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x37, offset 0x1ea - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x38, offset 0x1f2 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x39, offset 0x1f6 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0028, lo: 0x9a, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xbf}, - // Block 0x3a, offset 0x1fd - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x3308, lo: 0x97, hi: 0x98}, - {value: 0x3008, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x3b, offset 0x205 - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x94}, - {value: 0x3008, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3b08, lo: 0xa0, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xac}, - {value: 0x3008, lo: 0xad, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x3c, offset 0x215 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xbd}, - {value: 0x3318, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x3d, offset 0x221 - {value: 0x0000, lo: 0x01}, - {value: 0x0040, lo: 0x80, hi: 0xbf}, - // Block 0x3e, offset 0x223 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3008, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x3f, offset 0x22d - {value: 0x0000, lo: 0x0b}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x3808, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x40, offset 0x239 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3808, lo: 0xaa, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xbf}, - // Block 0x41, offset 0x245 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3008, lo: 0xaa, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3808, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbf}, - // Block 0x42, offset 0x251 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x3008, lo: 0xa4, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbf}, - // Block 0x43, offset 0x259 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x44, offset 0x25e - {value: 0x0000, lo: 0x09}, - {value: 0x0e29, lo: 0x80, hi: 0x80}, - {value: 0x0e41, lo: 0x81, hi: 0x81}, - {value: 0x0e59, lo: 0x82, hi: 0x82}, - {value: 0x0e71, lo: 0x83, hi: 0x83}, - {value: 0x0e89, lo: 0x84, hi: 0x85}, - {value: 0x0ea1, lo: 0x86, hi: 0x86}, - {value: 0x0eb9, lo: 0x87, hi: 0x87}, - {value: 0x057d, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0x45, offset 0x268 - {value: 0x0000, lo: 0x10}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x92}, - {value: 0x0018, lo: 0x93, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa8}, - {value: 0x0008, lo: 0xa9, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x46, offset 0x279 - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0x47, offset 0x27d - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x87}, - {value: 0xe045, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0xe045, lo: 0x98, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0xe045, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbf}, - // Block 0x48, offset 0x288 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x3318, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbf}, - // Block 0x49, offset 0x28c - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x88}, - {value: 0x24c1, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x4a, offset 0x295 - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x24f1, lo: 0xac, hi: 0xac}, - {value: 0x2529, lo: 0xad, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xae}, - {value: 0x2579, lo: 0xaf, hi: 0xaf}, - {value: 0x25b1, lo: 0xb0, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0x4b, offset 0x29d - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x9f}, - {value: 0x0080, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xad}, - {value: 0x0080, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x4c, offset 0x2a3 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xa8}, - {value: 0x09c5, lo: 0xa9, hi: 0xa9}, - {value: 0x09e5, lo: 0xaa, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xbf}, - // Block 0x4d, offset 0x2a8 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xbf}, - // Block 0x4e, offset 0x2ab - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x28c1, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0xbf}, - // Block 0x4f, offset 0x2af - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0e66, lo: 0xb4, hi: 0xb4}, - {value: 0x292a, lo: 0xb5, hi: 0xb5}, - {value: 0x0e86, lo: 0xb6, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x50, offset 0x2b5 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x9b}, - {value: 0x2941, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0xbf}, - // Block 0x51, offset 0x2b9 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x52, offset 0x2bd - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbc}, - {value: 0x0018, lo: 0xbd, hi: 0xbf}, - // Block 0x53, offset 0x2c3 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x92}, - {value: 0x0040, lo: 0x93, hi: 0xab}, - {value: 0x0018, lo: 0xac, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x54, offset 0x2ca - {value: 0x0000, lo: 0x05}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x03f5, lo: 0x90, hi: 0x9f}, - {value: 0x0ea5, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x55, offset 0x2d0 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x56, offset 0x2d8 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xae}, - {value: 0xe075, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0x57, offset 0x2df - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x58, offset 0x2ea - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xbf}, - // Block 0x59, offset 0x2f4 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x5a, offset 0x2f8 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0xbf}, - // Block 0x5b, offset 0x2fb - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9e}, - {value: 0x0edd, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0x5c, offset 0x301 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb2}, - {value: 0x0efd, lo: 0xb3, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x5d, offset 0x305 - {value: 0x0020, lo: 0x01}, - {value: 0x0f1d, lo: 0x80, hi: 0xbf}, - // Block 0x5e, offset 0x307 - {value: 0x0020, lo: 0x02}, - {value: 0x171d, lo: 0x80, hi: 0x8f}, - {value: 0x18fd, lo: 0x90, hi: 0xbf}, - // Block 0x5f, offset 0x30a - {value: 0x0020, lo: 0x01}, - {value: 0x1efd, lo: 0x80, hi: 0xbf}, - // Block 0x60, offset 0x30c - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x61, offset 0x30f - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9a}, - {value: 0x29e2, lo: 0x9b, hi: 0x9b}, - {value: 0x2a0a, lo: 0x9c, hi: 0x9c}, - {value: 0x0008, lo: 0x9d, hi: 0x9e}, - {value: 0x2a31, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xbf}, - // Block 0x62, offset 0x319 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbe}, - {value: 0x2a69, lo: 0xbf, hi: 0xbf}, - // Block 0x63, offset 0x31c - {value: 0x0000, lo: 0x0e}, - {value: 0x0040, lo: 0x80, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xb0}, - {value: 0x2a1d, lo: 0xb1, hi: 0xb1}, - {value: 0x2a3d, lo: 0xb2, hi: 0xb2}, - {value: 0x2a5d, lo: 0xb3, hi: 0xb3}, - {value: 0x2a7d, lo: 0xb4, hi: 0xb4}, - {value: 0x2a5d, lo: 0xb5, hi: 0xb5}, - {value: 0x2a9d, lo: 0xb6, hi: 0xb6}, - {value: 0x2abd, lo: 0xb7, hi: 0xb7}, - {value: 0x2add, lo: 0xb8, hi: 0xb9}, - {value: 0x2afd, lo: 0xba, hi: 0xbb}, - {value: 0x2b1d, lo: 0xbc, hi: 0xbd}, - {value: 0x2afd, lo: 0xbe, hi: 0xbf}, - // Block 0x64, offset 0x32b - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x65, offset 0x32f - {value: 0x0030, lo: 0x04}, - {value: 0x2aa2, lo: 0x80, hi: 0x9d}, - {value: 0x305a, lo: 0x9e, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x30a2, lo: 0xa0, hi: 0xbf}, - // Block 0x66, offset 0x334 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xbf}, - // Block 0x67, offset 0x337 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x68, offset 0x33b - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x69, offset 0x340 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xbf}, - // Block 0x6a, offset 0x345 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb1}, - {value: 0x0018, lo: 0xb2, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6b, offset 0x34b - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0xb6}, - {value: 0x0008, lo: 0xb7, hi: 0xb7}, - {value: 0x2009, lo: 0xb8, hi: 0xb8}, - {value: 0x6e89, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xbf}, - // Block 0x6c, offset 0x351 - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x3308, lo: 0x8b, hi: 0x8b}, - {value: 0x0008, lo: 0x8c, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x6d, offset 0x360 - {value: 0x0000, lo: 0x05}, - {value: 0x0208, lo: 0x80, hi: 0xb1}, - {value: 0x0108, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6e, offset 0x366 - {value: 0x0000, lo: 0x03}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xbf}, - // Block 0x6f, offset 0x36a - {value: 0x0000, lo: 0x0e}, - {value: 0x3008, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xba}, - {value: 0x0008, lo: 0xbb, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x70, offset 0x379 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x71, offset 0x37e - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x91}, - {value: 0x3008, lo: 0x92, hi: 0x92}, - {value: 0x3808, lo: 0x93, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x72, offset 0x386 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb9}, - {value: 0x3008, lo: 0xba, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x73, offset 0x390 - {value: 0x0000, lo: 0x0a}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x74, offset 0x39b - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x75, offset 0x3a3 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8c}, - {value: 0x3008, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbd}, - {value: 0x0008, lo: 0xbe, hi: 0xbf}, - // Block 0x76, offset 0x3b4 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x77, offset 0x3bd - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x9a}, - {value: 0x0008, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3b08, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x78, offset 0x3cd - {value: 0x0000, lo: 0x0c}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x90}, - {value: 0x0008, lo: 0x91, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x79, offset 0x3da - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x4465, lo: 0x9c, hi: 0x9c}, - {value: 0x447d, lo: 0x9d, hi: 0x9d}, - {value: 0x2971, lo: 0x9e, hi: 0x9e}, - {value: 0xe06d, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xaf}, - {value: 0x4495, lo: 0xb0, hi: 0xbf}, - // Block 0x7a, offset 0x3e4 - {value: 0x0000, lo: 0x04}, - {value: 0x44b5, lo: 0x80, hi: 0x8f}, - {value: 0x44d5, lo: 0x90, hi: 0x9f}, - {value: 0x44f5, lo: 0xa0, hi: 0xaf}, - {value: 0x44d5, lo: 0xb0, hi: 0xbf}, - // Block 0x7b, offset 0x3e9 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3b08, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x7c, offset 0x3f6 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x7d, offset 0x3fa - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x7e, offset 0x3ff - {value: 0x0020, lo: 0x01}, - {value: 0x4515, lo: 0x80, hi: 0xbf}, - // Block 0x7f, offset 0x401 - {value: 0x0020, lo: 0x03}, - {value: 0x4d15, lo: 0x80, hi: 0x94}, - {value: 0x4ad5, lo: 0x95, hi: 0x95}, - {value: 0x4fb5, lo: 0x96, hi: 0xbf}, - // Block 0x80, offset 0x405 - {value: 0x0020, lo: 0x01}, - {value: 0x54f5, lo: 0x80, hi: 0xbf}, - // Block 0x81, offset 0x407 - {value: 0x0020, lo: 0x03}, - {value: 0x5cf5, lo: 0x80, hi: 0x84}, - {value: 0x5655, lo: 0x85, hi: 0x85}, - {value: 0x5d95, lo: 0x86, hi: 0xbf}, - // Block 0x82, offset 0x40b - {value: 0x0020, lo: 0x08}, - {value: 0x6b55, lo: 0x80, hi: 0x8f}, - {value: 0x6d15, lo: 0x90, hi: 0x90}, - {value: 0x6d55, lo: 0x91, hi: 0xab}, - {value: 0x6ea1, lo: 0xac, hi: 0xac}, - {value: 0x70b5, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x70d5, lo: 0xb0, hi: 0xbf}, - // Block 0x83, offset 0x414 - {value: 0x0020, lo: 0x05}, - {value: 0x72d5, lo: 0x80, hi: 0xad}, - {value: 0x6535, lo: 0xae, hi: 0xae}, - {value: 0x7895, lo: 0xaf, hi: 0xb5}, - {value: 0x6f55, lo: 0xb6, hi: 0xb6}, - {value: 0x7975, lo: 0xb7, hi: 0xbf}, - // Block 0x84, offset 0x41a - {value: 0x0028, lo: 0x03}, - {value: 0x7c21, lo: 0x80, hi: 0x82}, - {value: 0x7be1, lo: 0x83, hi: 0x83}, - {value: 0x7c99, lo: 0x84, hi: 0xbf}, - // Block 0x85, offset 0x41e - {value: 0x0038, lo: 0x0f}, - {value: 0x9db1, lo: 0x80, hi: 0x83}, - {value: 0x9e59, lo: 0x84, hi: 0x85}, - {value: 0x9e91, lo: 0x86, hi: 0x87}, - {value: 0x9ec9, lo: 0x88, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0xa089, lo: 0x92, hi: 0x97}, - {value: 0xa1a1, lo: 0x98, hi: 0x9c}, - {value: 0xa281, lo: 0x9d, hi: 0xb3}, - {value: 0x9d41, lo: 0xb4, hi: 0xb4}, - {value: 0x9db1, lo: 0xb5, hi: 0xb5}, - {value: 0xa789, lo: 0xb6, hi: 0xbb}, - {value: 0xa869, lo: 0xbc, hi: 0xbc}, - {value: 0xa7f9, lo: 0xbd, hi: 0xbd}, - {value: 0xa8d9, lo: 0xbe, hi: 0xbf}, - // Block 0x86, offset 0x42e - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x0008, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x87, offset 0x438 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0x88, offset 0x43d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x89, offset 0x440 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x8a, offset 0x446 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x8b, offset 0x44d - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x8c, offset 0x452 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x8d, offset 0x456 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x8e, offset 0x45c - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xbf}, - // Block 0x8f, offset 0x461 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x90, offset 0x46a - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x91, offset 0x46f - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0xbf}, - // Block 0x92, offset 0x475 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x97}, - {value: 0x8ad5, lo: 0x98, hi: 0x9f}, - {value: 0x8aed, lo: 0xa0, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xbf}, - // Block 0x93, offset 0x47c - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x8aed, lo: 0xb0, hi: 0xb7}, - {value: 0x8ad5, lo: 0xb8, hi: 0xbf}, - // Block 0x94, offset 0x483 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x95, offset 0x48a - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x96, offset 0x48e - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xae}, - {value: 0x0018, lo: 0xaf, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x97, offset 0x493 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x98, offset 0x496 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xbf}, - // Block 0x99, offset 0x49b - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0808, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0808, lo: 0x8a, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb6}, - {value: 0x0808, lo: 0xb7, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbb}, - {value: 0x0808, lo: 0xbc, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x0808, lo: 0xbf, hi: 0xbf}, - // Block 0x9a, offset 0x4a7 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x96}, - {value: 0x0818, lo: 0x97, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb6}, - {value: 0x0818, lo: 0xb7, hi: 0xbf}, - // Block 0x9b, offset 0x4ad - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa6}, - {value: 0x0818, lo: 0xa7, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x9c, offset 0x4b2 - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xba}, - {value: 0x0818, lo: 0xbb, hi: 0xbf}, - // Block 0x9d, offset 0x4b9 - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0818, lo: 0x96, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbe}, - {value: 0x0818, lo: 0xbf, hi: 0xbf}, - // Block 0x9e, offset 0x4c1 - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbb}, - {value: 0x0818, lo: 0xbc, hi: 0xbd}, - {value: 0x0808, lo: 0xbe, hi: 0xbf}, - // Block 0x9f, offset 0x4c6 - {value: 0x0000, lo: 0x03}, - {value: 0x0818, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x0818, lo: 0x92, hi: 0xbf}, - // Block 0xa0, offset 0x4ca - {value: 0x0000, lo: 0x0f}, - {value: 0x0808, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x94}, - {value: 0x0808, lo: 0x95, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0x98}, - {value: 0x0808, lo: 0x99, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xa1, offset 0x4da - {value: 0x0000, lo: 0x06}, - {value: 0x0818, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0818, lo: 0x90, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xbc}, - {value: 0x0818, lo: 0xbd, hi: 0xbf}, - // Block 0xa2, offset 0x4e1 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0x9c}, - {value: 0x0818, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xa3, offset 0x4e5 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb8}, - {value: 0x0018, lo: 0xb9, hi: 0xbf}, - // Block 0xa4, offset 0x4e9 - {value: 0x0000, lo: 0x06}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0818, lo: 0x98, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb7}, - {value: 0x0818, lo: 0xb8, hi: 0xbf}, - // Block 0xa5, offset 0x4f0 - {value: 0x0000, lo: 0x01}, - {value: 0x0808, lo: 0x80, hi: 0xbf}, - // Block 0xa6, offset 0x4f2 - {value: 0x0000, lo: 0x02}, - {value: 0x0808, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0xa7, offset 0x4f5 - {value: 0x0000, lo: 0x02}, - {value: 0x03dd, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xa8, offset 0x4f8 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xbf}, - // Block 0xa9, offset 0x4fc - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0818, lo: 0xa0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xaa, offset 0x500 - {value: 0x0000, lo: 0x05}, - {value: 0x3008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xab, offset 0x506 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x91}, - {value: 0x0018, lo: 0x92, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xac, offset 0x50f - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbc}, - {value: 0x0340, lo: 0xbd, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0xad, offset 0x51b - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xae, offset 0x522 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb2}, - {value: 0x3b08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xbf}, - // Block 0xaf, offset 0x52b - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xb0, offset 0x533 - {value: 0x0000, lo: 0x06}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xbe}, - {value: 0x3008, lo: 0xbf, hi: 0xbf}, - // Block 0xb1, offset 0x53a - {value: 0x0000, lo: 0x0d}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x89}, - {value: 0x3308, lo: 0x8a, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xb2, offset 0x548 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3808, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xb3, offset 0x555 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0008, lo: 0x9f, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xb4, offset 0x562 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x3308, lo: 0x9f, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa9}, - {value: 0x3b08, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb5, offset 0x56b - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xb6, offset 0x56f - {value: 0x0000, lo: 0x0d}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x84}, - {value: 0x3008, lo: 0x85, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0xb7, offset 0x57d - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xb8, offset 0x585 - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x85}, - {value: 0x0018, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xb9, offset 0x590 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xba, offset 0x599 - {value: 0x0000, lo: 0x05}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9b}, - {value: 0x3308, lo: 0x9c, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0xbb, offset 0x59f - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbc, offset 0x5a7 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xbd, offset 0x5b0 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb5}, - {value: 0x3808, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0xbe, offset 0x5ba - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0xbf}, - // Block 0xbf, offset 0x5bd - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbf}, - // Block 0xc0, offset 0x5c9 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xbf}, - // Block 0xc1, offset 0x5cc - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0xc2, offset 0x5d1 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0xc3, offset 0x5de - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x3b08, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0xbf}, - // Block 0xc4, offset 0x5e7 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x89}, - {value: 0x3308, lo: 0x8a, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x98}, - {value: 0x3b08, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xa2}, - {value: 0x0040, lo: 0xa3, hi: 0xbf}, - // Block 0xc5, offset 0x5f3 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xc6, offset 0x5f6 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xc7, offset 0x600 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xbf}, - // Block 0xc8, offset 0x609 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xa9}, - {value: 0x3308, lo: 0xaa, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xc9, offset 0x615 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xca, offset 0x622 - {value: 0x0000, lo: 0x07}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xcb, offset 0x62a - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xcc, offset 0x62d - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xcd, offset 0x632 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0xbf}, - // Block 0xce, offset 0x635 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xbf}, - // Block 0xcf, offset 0x638 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0xbf}, - // Block 0xd0, offset 0x63b - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xd1, offset 0x642 - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xd2, offset 0x649 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0xd3, offset 0x64d - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x0008, lo: 0xa3, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0xd4, offset 0x658 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0xbf}, - // Block 0xd5, offset 0x65b - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3008, lo: 0x91, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xd6, offset 0x661 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8e}, - {value: 0x3308, lo: 0x8f, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xd7, offset 0x666 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xbf}, - // Block 0xd8, offset 0x66a - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xd9, offset 0x66d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xda, offset 0x670 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xbf}, - // Block 0xdb, offset 0x673 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xdc, offset 0x676 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0xdd, offset 0x679 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0xde, offset 0x67e - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x03c0, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xbf}, - // Block 0xdf, offset 0x688 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xe0, offset 0x68b - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xbf}, - // Block 0xe1, offset 0x68f - {value: 0x0000, lo: 0x0e}, - {value: 0x0018, lo: 0x80, hi: 0x9d}, - {value: 0xb5b9, lo: 0x9e, hi: 0x9e}, - {value: 0xb601, lo: 0x9f, hi: 0x9f}, - {value: 0xb649, lo: 0xa0, hi: 0xa0}, - {value: 0xb6b1, lo: 0xa1, hi: 0xa1}, - {value: 0xb719, lo: 0xa2, hi: 0xa2}, - {value: 0xb781, lo: 0xa3, hi: 0xa3}, - {value: 0xb7e9, lo: 0xa4, hi: 0xa4}, - {value: 0x3018, lo: 0xa5, hi: 0xa6}, - {value: 0x3318, lo: 0xa7, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xac}, - {value: 0x3018, lo: 0xad, hi: 0xb2}, - {value: 0x0340, lo: 0xb3, hi: 0xba}, - {value: 0x3318, lo: 0xbb, hi: 0xbf}, - // Block 0xe2, offset 0x69e - {value: 0x0000, lo: 0x0b}, - {value: 0x3318, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0x84}, - {value: 0x3318, lo: 0x85, hi: 0x8b}, - {value: 0x0018, lo: 0x8c, hi: 0xa9}, - {value: 0x3318, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xba}, - {value: 0xb851, lo: 0xbb, hi: 0xbb}, - {value: 0xb899, lo: 0xbc, hi: 0xbc}, - {value: 0xb8e1, lo: 0xbd, hi: 0xbd}, - {value: 0xb949, lo: 0xbe, hi: 0xbe}, - {value: 0xb9b1, lo: 0xbf, hi: 0xbf}, - // Block 0xe3, offset 0x6aa - {value: 0x0000, lo: 0x03}, - {value: 0xba19, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xbf}, - // Block 0xe4, offset 0x6ae - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x3318, lo: 0x82, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0xbf}, - // Block 0xe5, offset 0x6b3 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xe6, offset 0x6b8 - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0xe7, offset 0x6bc - {value: 0x0000, lo: 0x04}, - {value: 0x3308, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0xe8, offset 0x6c1 - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x3308, lo: 0xa1, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xe9, offset 0x6ca - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa4}, - {value: 0x0040, lo: 0xa5, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xbf}, - // Block 0xea, offset 0x6d5 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x86}, - {value: 0x0818, lo: 0x87, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0xeb, offset 0x6db - {value: 0x0000, lo: 0x07}, - {value: 0x0a08, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0818, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xec, offset 0x6e3 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xed, offset 0x6e7 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0xee, offset 0x6eb - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0xef, offset 0x6f1 - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xf0, offset 0x6f7 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8f}, - {value: 0xc1c1, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xf1, offset 0x6fc - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xbf}, - // Block 0xf2, offset 0x6ff - {value: 0x0000, lo: 0x0f}, - {value: 0xc7e9, lo: 0x80, hi: 0x80}, - {value: 0xc839, lo: 0x81, hi: 0x81}, - {value: 0xc889, lo: 0x82, hi: 0x82}, - {value: 0xc8d9, lo: 0x83, hi: 0x83}, - {value: 0xc929, lo: 0x84, hi: 0x84}, - {value: 0xc979, lo: 0x85, hi: 0x85}, - {value: 0xc9c9, lo: 0x86, hi: 0x86}, - {value: 0xca19, lo: 0x87, hi: 0x87}, - {value: 0xca69, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0xcab9, lo: 0x90, hi: 0x90}, - {value: 0xcad9, lo: 0x91, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xbf}, - // Block 0xf3, offset 0x70f - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xf4, offset 0x716 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0xf5, offset 0x719 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0xbf}, - // Block 0xf6, offset 0x71c - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0xf7, offset 0x720 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0xf8, offset 0x726 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xbf}, - // Block 0xf9, offset 0x72b - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xfa, offset 0x730 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xbf}, - // Block 0xfb, offset 0x735 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0xbf}, - // Block 0xfc, offset 0x738 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xbf}, - // Block 0xfd, offset 0x73d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0xfe, offset 0x740 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xff, offset 0x743 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x100, offset 0x747 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x101, offset 0x74b - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x102, offset 0x74e - {value: 0x0020, lo: 0x0f}, - {value: 0xdeb9, lo: 0x80, hi: 0x89}, - {value: 0x8dfd, lo: 0x8a, hi: 0x8a}, - {value: 0xdff9, lo: 0x8b, hi: 0x9c}, - {value: 0x8e1d, lo: 0x9d, hi: 0x9d}, - {value: 0xe239, lo: 0x9e, hi: 0xa2}, - {value: 0x8e3d, lo: 0xa3, hi: 0xa3}, - {value: 0xe2d9, lo: 0xa4, hi: 0xab}, - {value: 0x7ed5, lo: 0xac, hi: 0xac}, - {value: 0xe3d9, lo: 0xad, hi: 0xaf}, - {value: 0x8e5d, lo: 0xb0, hi: 0xb0}, - {value: 0xe439, lo: 0xb1, hi: 0xb6}, - {value: 0x8e7d, lo: 0xb7, hi: 0xb9}, - {value: 0xe4f9, lo: 0xba, hi: 0xba}, - {value: 0x8edd, lo: 0xbb, hi: 0xbb}, - {value: 0xe519, lo: 0xbc, hi: 0xbf}, - // Block 0x103, offset 0x75e - {value: 0x0020, lo: 0x10}, - {value: 0x937d, lo: 0x80, hi: 0x80}, - {value: 0xf099, lo: 0x81, hi: 0x86}, - {value: 0x939d, lo: 0x87, hi: 0x8a}, - {value: 0xd9f9, lo: 0x8b, hi: 0x8b}, - {value: 0xf159, lo: 0x8c, hi: 0x96}, - {value: 0x941d, lo: 0x97, hi: 0x97}, - {value: 0xf2b9, lo: 0x98, hi: 0xa3}, - {value: 0x943d, lo: 0xa4, hi: 0xa6}, - {value: 0xf439, lo: 0xa7, hi: 0xaa}, - {value: 0x949d, lo: 0xab, hi: 0xab}, - {value: 0xf4b9, lo: 0xac, hi: 0xac}, - {value: 0x94bd, lo: 0xad, hi: 0xad}, - {value: 0xf4d9, lo: 0xae, hi: 0xaf}, - {value: 0x94dd, lo: 0xb0, hi: 0xb1}, - {value: 0xf519, lo: 0xb2, hi: 0xbe}, - {value: 0x2040, lo: 0xbf, hi: 0xbf}, - // Block 0x104, offset 0x76f - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0340, lo: 0x81, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x9f}, - {value: 0x0340, lo: 0xa0, hi: 0xbf}, - // Block 0x105, offset 0x774 - {value: 0x0000, lo: 0x01}, - {value: 0x0340, lo: 0x80, hi: 0xbf}, - // Block 0x106, offset 0x776 - {value: 0x0000, lo: 0x01}, - {value: 0x33c0, lo: 0x80, hi: 0xbf}, - // Block 0x107, offset 0x778 - {value: 0x0000, lo: 0x02}, - {value: 0x33c0, lo: 0x80, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, -} - -// Total table size 42114 bytes (41KiB); checksum: 355A58A4 diff --git a/vendor/golang.org/x/net/idna/tables11.0.0.go b/vendor/golang.org/x/net/idna/tables11.0.0.go deleted file mode 100644 index 8ce0811fd..000000000 --- a/vendor/golang.org/x/net/idna/tables11.0.0.go +++ /dev/null @@ -1,4653 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// +build go1.13,!go1.14 - -package idna - -// UnicodeVersion is the Unicode version from which the tables in this package are derived. -const UnicodeVersion = "11.0.0" - -var mappings string = "" + // Size: 8175 bytes - "\x00\x01 \x03 ̈\x01a\x03 ̄\x012\x013\x03 ́\x03 ̧\x011\x01o\x051⁄4\x051⁄2" + - "\x053⁄4\x03i̇\x03l·\x03ʼn\x01s\x03dž\x03ⱥ\x03ⱦ\x01h\x01j\x01r\x01w\x01y" + - "\x03 ̆\x03 ̇\x03 ̊\x03 ̨\x03 ̃\x03 ̋\x01l\x01x\x04̈́\x03 ι\x01;\x05 ̈́" + - "\x04եւ\x04اٴ\x04وٴ\x04ۇٴ\x04يٴ\x06क़\x06ख़\x06ग़\x06ज़\x06ड़\x06ढ़\x06फ़" + - "\x06य़\x06ড়\x06ঢ়\x06য়\x06ਲ਼\x06ਸ਼\x06ਖ਼\x06ਗ਼\x06ਜ਼\x06ਫ਼\x06ଡ଼\x06ଢ଼" + - "\x06ํา\x06ໍາ\x06ຫນ\x06ຫມ\x06གྷ\x06ཌྷ\x06དྷ\x06བྷ\x06ཛྷ\x06ཀྵ\x06ཱི\x06ཱུ" + - "\x06ྲྀ\x09ྲཱྀ\x06ླྀ\x09ླཱྀ\x06ཱྀ\x06ྒྷ\x06ྜྷ\x06ྡྷ\x06ྦྷ\x06ྫྷ\x06ྐྵ\x02" + - "в\x02д\x02о\x02с\x02т\x02ъ\x02ѣ\x02æ\x01b\x01d\x01e\x02ǝ\x01g\x01i\x01k" + - "\x01m\x01n\x02ȣ\x01p\x01t\x01u\x02ɐ\x02ɑ\x02ə\x02ɛ\x02ɜ\x02ŋ\x02ɔ\x02ɯ" + - "\x01v\x02β\x02γ\x02δ\x02φ\x02χ\x02ρ\x02н\x02ɒ\x01c\x02ɕ\x02ð\x01f\x02ɟ" + - "\x02ɡ\x02ɥ\x02ɨ\x02ɩ\x02ɪ\x02ʝ\x02ɭ\x02ʟ\x02ɱ\x02ɰ\x02ɲ\x02ɳ\x02ɴ\x02ɵ" + - "\x02ɸ\x02ʂ\x02ʃ\x02ƫ\x02ʉ\x02ʊ\x02ʋ\x02ʌ\x01z\x02ʐ\x02ʑ\x02ʒ\x02θ\x02ss" + - "\x02ά\x02έ\x02ή\x02ί\x02ό\x02ύ\x02ώ\x05ἀι\x05ἁι\x05ἂι\x05ἃι\x05ἄι\x05ἅι" + - "\x05ἆι\x05ἇι\x05ἠι\x05ἡι\x05ἢι\x05ἣι\x05ἤι\x05ἥι\x05ἦι\x05ἧι\x05ὠι\x05ὡι" + - "\x05ὢι\x05ὣι\x05ὤι\x05ὥι\x05ὦι\x05ὧι\x05ὰι\x04αι\x04άι\x05ᾶι\x02ι\x05 ̈͂" + - "\x05ὴι\x04ηι\x04ήι\x05ῆι\x05 ̓̀\x05 ̓́\x05 ̓͂\x02ΐ\x05 ̔̀\x05 ̔́\x05 ̔͂" + - "\x02ΰ\x05 ̈̀\x01`\x05ὼι\x04ωι\x04ώι\x05ῶι\x06′′\x09′′′\x06‵‵\x09‵‵‵\x02!" + - "!\x02??\x02?!\x02!?\x0c′′′′\x010\x014\x015\x016\x017\x018\x019\x01+\x01=" + - "\x01(\x01)\x02rs\x02ħ\x02no\x01q\x02sm\x02tm\x02ω\x02å\x02א\x02ב\x02ג" + - "\x02ד\x02π\x051⁄7\x051⁄9\x061⁄10\x051⁄3\x052⁄3\x051⁄5\x052⁄5\x053⁄5\x054" + - "⁄5\x051⁄6\x055⁄6\x051⁄8\x053⁄8\x055⁄8\x057⁄8\x041⁄\x02ii\x02iv\x02vi" + - "\x04viii\x02ix\x02xi\x050⁄3\x06∫∫\x09∫∫∫\x06∮∮\x09∮∮∮\x0210\x0211\x0212" + - "\x0213\x0214\x0215\x0216\x0217\x0218\x0219\x0220\x04(10)\x04(11)\x04(12)" + - "\x04(13)\x04(14)\x04(15)\x04(16)\x04(17)\x04(18)\x04(19)\x04(20)\x0c∫∫∫∫" + - "\x02==\x05⫝̸\x02ɫ\x02ɽ\x02ȿ\x02ɀ\x01.\x04 ゙\x04 ゚\x06より\x06コト\x05(ᄀ)\x05" + - "(ᄂ)\x05(ᄃ)\x05(ᄅ)\x05(ᄆ)\x05(ᄇ)\x05(ᄉ)\x05(ᄋ)\x05(ᄌ)\x05(ᄎ)\x05(ᄏ)\x05(ᄐ" + - ")\x05(ᄑ)\x05(ᄒ)\x05(가)\x05(나)\x05(다)\x05(라)\x05(마)\x05(바)\x05(사)\x05(아)" + - "\x05(자)\x05(차)\x05(카)\x05(타)\x05(파)\x05(하)\x05(주)\x08(오전)\x08(오후)\x05(一)" + - "\x05(二)\x05(三)\x05(四)\x05(五)\x05(六)\x05(七)\x05(八)\x05(九)\x05(十)\x05(月)" + - "\x05(火)\x05(水)\x05(木)\x05(金)\x05(土)\x05(日)\x05(株)\x05(有)\x05(社)\x05(名)" + - "\x05(特)\x05(財)\x05(祝)\x05(労)\x05(代)\x05(呼)\x05(学)\x05(監)\x05(企)\x05(資)" + - "\x05(協)\x05(祭)\x05(休)\x05(自)\x05(至)\x0221\x0222\x0223\x0224\x0225\x0226" + - "\x0227\x0228\x0229\x0230\x0231\x0232\x0233\x0234\x0235\x06참고\x06주의\x0236" + - "\x0237\x0238\x0239\x0240\x0241\x0242\x0243\x0244\x0245\x0246\x0247\x0248" + - "\x0249\x0250\x041月\x042月\x043月\x044月\x045月\x046月\x047月\x048月\x049月\x0510" + - "月\x0511月\x0512月\x02hg\x02ev\x0cアパート\x0cアルファ\x0cアンペア\x09アール\x0cイニング\x09" + - "インチ\x09ウォン\x0fエスクード\x0cエーカー\x09オンス\x09オーム\x09カイリ\x0cカラット\x0cカロリー\x09ガロ" + - "ン\x09ガンマ\x06ギガ\x09ギニー\x0cキュリー\x0cギルダー\x06キロ\x0fキログラム\x12キロメートル\x0fキロワッ" + - "ト\x09グラム\x0fグラムトン\x0fクルゼイロ\x0cクローネ\x09ケース\x09コルナ\x09コーポ\x0cサイクル\x0fサンチ" + - "ーム\x0cシリング\x09センチ\x09セント\x09ダース\x06デシ\x06ドル\x06トン\x06ナノ\x09ノット\x09ハイツ" + - "\x0fパーセント\x09パーツ\x0cバーレル\x0fピアストル\x09ピクル\x06ピコ\x06ビル\x0fファラッド\x0cフィート" + - "\x0fブッシェル\x09フラン\x0fヘクタール\x06ペソ\x09ペニヒ\x09ヘルツ\x09ペンス\x09ページ\x09ベータ\x0cポイ" + - "ント\x09ボルト\x06ホン\x09ポンド\x09ホール\x09ホーン\x0cマイクロ\x09マイル\x09マッハ\x09マルク\x0fマ" + - "ンション\x0cミクロン\x06ミリ\x0fミリバール\x06メガ\x0cメガトン\x0cメートル\x09ヤード\x09ヤール\x09ユアン" + - "\x0cリットル\x06リラ\x09ルピー\x0cルーブル\x06レム\x0fレントゲン\x09ワット\x040点\x041点\x042点" + - "\x043点\x044点\x045点\x046点\x047点\x048点\x049点\x0510点\x0511点\x0512点\x0513点" + - "\x0514点\x0515点\x0516点\x0517点\x0518点\x0519点\x0520点\x0521点\x0522点\x0523点" + - "\x0524点\x02da\x02au\x02ov\x02pc\x02dm\x02iu\x06平成\x06昭和\x06大正\x06明治\x0c株" + - "式会社\x02pa\x02na\x02ma\x02ka\x02kb\x02mb\x02gb\x04kcal\x02pf\x02nf\x02m" + - "g\x02kg\x02hz\x02ml\x02dl\x02kl\x02fm\x02nm\x02mm\x02cm\x02km\x02m2\x02m" + - "3\x05m∕s\x06m∕s2\x07rad∕s\x08rad∕s2\x02ps\x02ns\x02ms\x02pv\x02nv\x02mv" + - "\x02kv\x02pw\x02nw\x02mw\x02kw\x02bq\x02cc\x02cd\x06c∕kg\x02db\x02gy\x02" + - "ha\x02hp\x02in\x02kk\x02kt\x02lm\x02ln\x02lx\x02ph\x02pr\x02sr\x02sv\x02" + - "wb\x05v∕m\x05a∕m\x041日\x042日\x043日\x044日\x045日\x046日\x047日\x048日\x049日" + - "\x0510日\x0511日\x0512日\x0513日\x0514日\x0515日\x0516日\x0517日\x0518日\x0519日" + - "\x0520日\x0521日\x0522日\x0523日\x0524日\x0525日\x0526日\x0527日\x0528日\x0529日" + - "\x0530日\x0531日\x02ь\x02ɦ\x02ɬ\x02ʞ\x02ʇ\x02œ\x04𤋮\x04𢡊\x04𢡄\x04𣏕\x04𥉉" + - "\x04𥳐\x04𧻓\x02ff\x02fi\x02fl\x02st\x04մն\x04մե\x04մի\x04վն\x04մխ\x04יִ" + - "\x04ײַ\x02ע\x02ה\x02כ\x02ל\x02ם\x02ר\x02ת\x04שׁ\x04שׂ\x06שּׁ\x06שּׂ\x04א" + - "ַ\x04אָ\x04אּ\x04בּ\x04גּ\x04דּ\x04הּ\x04וּ\x04זּ\x04טּ\x04יּ\x04ךּ\x04" + - "כּ\x04לּ\x04מּ\x04נּ\x04סּ\x04ףּ\x04פּ\x04צּ\x04קּ\x04רּ\x04שּ\x04תּ" + - "\x04וֹ\x04בֿ\x04כֿ\x04פֿ\x04אל\x02ٱ\x02ٻ\x02پ\x02ڀ\x02ٺ\x02ٿ\x02ٹ\x02ڤ" + - "\x02ڦ\x02ڄ\x02ڃ\x02چ\x02ڇ\x02ڍ\x02ڌ\x02ڎ\x02ڈ\x02ژ\x02ڑ\x02ک\x02گ\x02ڳ" + - "\x02ڱ\x02ں\x02ڻ\x02ۀ\x02ہ\x02ھ\x02ے\x02ۓ\x02ڭ\x02ۇ\x02ۆ\x02ۈ\x02ۋ\x02ۅ" + - "\x02ۉ\x02ې\x02ى\x04ئا\x04ئە\x04ئو\x04ئۇ\x04ئۆ\x04ئۈ\x04ئې\x04ئى\x02ی\x04" + - "ئج\x04ئح\x04ئم\x04ئي\x04بج\x04بح\x04بخ\x04بم\x04بى\x04بي\x04تج\x04تح" + - "\x04تخ\x04تم\x04تى\x04تي\x04ثج\x04ثم\x04ثى\x04ثي\x04جح\x04جم\x04حج\x04حم" + - "\x04خج\x04خح\x04خم\x04سج\x04سح\x04سخ\x04سم\x04صح\x04صم\x04ضج\x04ضح\x04ضخ" + - "\x04ضم\x04طح\x04طم\x04ظم\x04عج\x04عم\x04غج\x04غم\x04فج\x04فح\x04فخ\x04فم" + - "\x04فى\x04في\x04قح\x04قم\x04قى\x04قي\x04كا\x04كج\x04كح\x04كخ\x04كل\x04كم" + - "\x04كى\x04كي\x04لج\x04لح\x04لخ\x04لم\x04لى\x04لي\x04مج\x04مح\x04مخ\x04مم" + - "\x04مى\x04مي\x04نج\x04نح\x04نخ\x04نم\x04نى\x04ني\x04هج\x04هم\x04هى\x04هي" + - "\x04يج\x04يح\x04يخ\x04يم\x04يى\x04يي\x04ذٰ\x04رٰ\x04ىٰ\x05 ٌّ\x05 ٍّ\x05" + - " َّ\x05 ُّ\x05 ِّ\x05 ّٰ\x04ئر\x04ئز\x04ئن\x04بر\x04بز\x04بن\x04تر\x04تز" + - "\x04تن\x04ثر\x04ثز\x04ثن\x04ما\x04نر\x04نز\x04نن\x04ير\x04يز\x04ين\x04ئخ" + - "\x04ئه\x04به\x04ته\x04صخ\x04له\x04نه\x04هٰ\x04يه\x04ثه\x04سه\x04شم\x04شه" + - "\x06ـَّ\x06ـُّ\x06ـِّ\x04طى\x04طي\x04عى\x04عي\x04غى\x04غي\x04سى\x04سي" + - "\x04شى\x04شي\x04حى\x04حي\x04جى\x04جي\x04خى\x04خي\x04صى\x04صي\x04ضى\x04ضي" + - "\x04شج\x04شح\x04شخ\x04شر\x04سر\x04صر\x04ضر\x04اً\x06تجم\x06تحج\x06تحم" + - "\x06تخم\x06تمج\x06تمح\x06تمخ\x06جمح\x06حمي\x06حمى\x06سحج\x06سجح\x06سجى" + - "\x06سمح\x06سمج\x06سمم\x06صحح\x06صمم\x06شحم\x06شجي\x06شمخ\x06شمم\x06ضحى" + - "\x06ضخم\x06طمح\x06طمم\x06طمي\x06عجم\x06عمم\x06عمى\x06غمم\x06غمي\x06غمى" + - "\x06فخم\x06قمح\x06قمم\x06لحم\x06لحي\x06لحى\x06لجج\x06لخم\x06لمح\x06محج" + - "\x06محم\x06محي\x06مجح\x06مجم\x06مخج\x06مخم\x06مجخ\x06همج\x06همم\x06نحم" + - "\x06نحى\x06نجم\x06نجى\x06نمي\x06نمى\x06يمم\x06بخي\x06تجي\x06تجى\x06تخي" + - "\x06تخى\x06تمي\x06تمى\x06جمي\x06جحى\x06جمى\x06سخى\x06صحي\x06شحي\x06ضحي" + - "\x06لجي\x06لمي\x06يحي\x06يجي\x06يمي\x06ممي\x06قمي\x06نحي\x06عمي\x06كمي" + - "\x06نجح\x06مخي\x06لجم\x06كمم\x06جحي\x06حجي\x06مجي\x06فمي\x06بحي\x06سخي" + - "\x06نجي\x06صلے\x06قلے\x08الله\x08اكبر\x08محمد\x08صلعم\x08رسول\x08عليه" + - "\x08وسلم\x06صلى!صلى الله عليه وسلم\x0fجل جلاله\x08ریال\x01,\x01:\x01!" + - "\x01?\x01_\x01{\x01}\x01[\x01]\x01#\x01&\x01*\x01-\x01<\x01>\x01\\\x01$" + - "\x01%\x01@\x04ـً\x04ـَ\x04ـُ\x04ـِ\x04ـّ\x04ـْ\x02ء\x02آ\x02أ\x02ؤ\x02إ" + - "\x02ئ\x02ا\x02ب\x02ة\x02ت\x02ث\x02ج\x02ح\x02خ\x02د\x02ذ\x02ر\x02ز\x02س" + - "\x02ش\x02ص\x02ض\x02ط\x02ظ\x02ع\x02غ\x02ف\x02ق\x02ك\x02ل\x02م\x02ن\x02ه" + - "\x02و\x02ي\x04لآ\x04لأ\x04لإ\x04لا\x01\x22\x01'\x01/\x01^\x01|\x01~\x02¢" + - "\x02£\x02¬\x02¦\x02¥\x08𝅗𝅥\x08𝅘𝅥\x0c𝅘𝅥𝅮\x0c𝅘𝅥𝅯\x0c𝅘𝅥𝅰\x0c𝅘𝅥𝅱\x0c𝅘𝅥𝅲\x08𝆹" + - "𝅥\x08𝆺𝅥\x0c𝆹𝅥𝅮\x0c𝆺𝅥𝅮\x0c𝆹𝅥𝅯\x0c𝆺𝅥𝅯\x02ı\x02ȷ\x02α\x02ε\x02ζ\x02η\x02" + - "κ\x02λ\x02μ\x02ν\x02ξ\x02ο\x02σ\x02τ\x02υ\x02ψ\x03∇\x03∂\x02ϝ\x02ٮ\x02ڡ" + - "\x02ٯ\x020,\x021,\x022,\x023,\x024,\x025,\x026,\x027,\x028,\x029,\x03(a)" + - "\x03(b)\x03(c)\x03(d)\x03(e)\x03(f)\x03(g)\x03(h)\x03(i)\x03(j)\x03(k)" + - "\x03(l)\x03(m)\x03(n)\x03(o)\x03(p)\x03(q)\x03(r)\x03(s)\x03(t)\x03(u)" + - "\x03(v)\x03(w)\x03(x)\x03(y)\x03(z)\x07〔s〕\x02wz\x02hv\x02sd\x03ppv\x02w" + - "c\x02mc\x02md\x02dj\x06ほか\x06ココ\x03サ\x03手\x03字\x03双\x03デ\x03二\x03多\x03解" + - "\x03天\x03交\x03映\x03無\x03料\x03前\x03後\x03再\x03新\x03初\x03終\x03生\x03販\x03声" + - "\x03吹\x03演\x03投\x03捕\x03一\x03三\x03遊\x03左\x03中\x03右\x03指\x03走\x03打\x03禁" + - "\x03空\x03合\x03満\x03有\x03月\x03申\x03割\x03営\x03配\x09〔本〕\x09〔三〕\x09〔二〕\x09〔安" + - "〕\x09〔点〕\x09〔打〕\x09〔盗〕\x09〔勝〕\x09〔敗〕\x03得\x03可\x03丽\x03丸\x03乁\x03你\x03" + - "侮\x03侻\x03倂\x03偺\x03備\x03僧\x03像\x03㒞\x03免\x03兔\x03兤\x03具\x03㒹\x03內\x03" + - "冗\x03冤\x03仌\x03冬\x03况\x03凵\x03刃\x03㓟\x03刻\x03剆\x03剷\x03㔕\x03勇\x03勉\x03" + - "勤\x03勺\x03包\x03匆\x03北\x03卉\x03卑\x03博\x03即\x03卽\x03卿\x03灰\x03及\x03叟\x03" + - "叫\x03叱\x03吆\x03咞\x03吸\x03呈\x03周\x03咢\x03哶\x03唐\x03啓\x03啣\x03善\x03喙\x03" + - "喫\x03喳\x03嗂\x03圖\x03嘆\x03圗\x03噑\x03噴\x03切\x03壮\x03城\x03埴\x03堍\x03型\x03" + - "堲\x03報\x03墬\x03売\x03壷\x03夆\x03夢\x03奢\x03姬\x03娛\x03娧\x03姘\x03婦\x03㛮\x03" + - "嬈\x03嬾\x03寃\x03寘\x03寧\x03寳\x03寿\x03将\x03尢\x03㞁\x03屠\x03屮\x03峀\x03岍\x03" + - "嵃\x03嵮\x03嵫\x03嵼\x03巡\x03巢\x03㠯\x03巽\x03帨\x03帽\x03幩\x03㡢\x03㡼\x03庰\x03" + - "庳\x03庶\x03廊\x03廾\x03舁\x03弢\x03㣇\x03形\x03彫\x03㣣\x03徚\x03忍\x03志\x03忹\x03" + - "悁\x03㤺\x03㤜\x03悔\x03惇\x03慈\x03慌\x03慎\x03慺\x03憎\x03憲\x03憤\x03憯\x03懞\x03" + - "懲\x03懶\x03成\x03戛\x03扝\x03抱\x03拔\x03捐\x03挽\x03拼\x03捨\x03掃\x03揤\x03搢\x03" + - "揅\x03掩\x03㨮\x03摩\x03摾\x03撝\x03摷\x03㩬\x03敏\x03敬\x03旣\x03書\x03晉\x03㬙\x03" + - "暑\x03㬈\x03㫤\x03冒\x03冕\x03最\x03暜\x03肭\x03䏙\x03朗\x03望\x03朡\x03杞\x03杓\x03" + - "㭉\x03柺\x03枅\x03桒\x03梅\x03梎\x03栟\x03椔\x03㮝\x03楂\x03榣\x03槪\x03檨\x03櫛\x03" + - "㰘\x03次\x03歔\x03㱎\x03歲\x03殟\x03殺\x03殻\x03汎\x03沿\x03泍\x03汧\x03洖\x03派\x03" + - "海\x03流\x03浩\x03浸\x03涅\x03洴\x03港\x03湮\x03㴳\x03滋\x03滇\x03淹\x03潮\x03濆\x03" + - "瀹\x03瀞\x03瀛\x03㶖\x03灊\x03災\x03灷\x03炭\x03煅\x03熜\x03爨\x03爵\x03牐\x03犀\x03" + - "犕\x03獺\x03王\x03㺬\x03玥\x03㺸\x03瑇\x03瑜\x03瑱\x03璅\x03瓊\x03㼛\x03甤\x03甾\x03" + - "異\x03瘐\x03㿼\x03䀈\x03直\x03眞\x03真\x03睊\x03䀹\x03瞋\x03䁆\x03䂖\x03硎\x03碌\x03" + - "磌\x03䃣\x03祖\x03福\x03秫\x03䄯\x03穀\x03穊\x03穏\x03䈂\x03篆\x03築\x03䈧\x03糒\x03" + - "䊠\x03糨\x03糣\x03紀\x03絣\x03䌁\x03緇\x03縂\x03繅\x03䌴\x03䍙\x03罺\x03羕\x03翺\x03" + - "者\x03聠\x03聰\x03䏕\x03育\x03脃\x03䐋\x03脾\x03媵\x03舄\x03辞\x03䑫\x03芑\x03芋\x03" + - "芝\x03劳\x03花\x03芳\x03芽\x03苦\x03若\x03茝\x03荣\x03莭\x03茣\x03莽\x03菧\x03著\x03" + - "荓\x03菊\x03菌\x03菜\x03䔫\x03蓱\x03蓳\x03蔖\x03蕤\x03䕝\x03䕡\x03䕫\x03虐\x03虜\x03" + - "虧\x03虩\x03蚩\x03蚈\x03蜎\x03蛢\x03蝹\x03蜨\x03蝫\x03螆\x03蟡\x03蠁\x03䗹\x03衠\x03" + - "衣\x03裗\x03裞\x03䘵\x03裺\x03㒻\x03䚾\x03䛇\x03誠\x03諭\x03變\x03豕\x03貫\x03賁\x03" + - "贛\x03起\x03跋\x03趼\x03跰\x03軔\x03輸\x03邔\x03郱\x03鄑\x03鄛\x03鈸\x03鋗\x03鋘\x03" + - "鉼\x03鏹\x03鐕\x03開\x03䦕\x03閷\x03䧦\x03雃\x03嶲\x03霣\x03䩮\x03䩶\x03韠\x03䪲\x03" + - "頋\x03頩\x03飢\x03䬳\x03餩\x03馧\x03駂\x03駾\x03䯎\x03鬒\x03鱀\x03鳽\x03䳎\x03䳭\x03" + - "鵧\x03䳸\x03麻\x03䵖\x03黹\x03黾\x03鼅\x03鼏\x03鼖\x03鼻" - -var xorData string = "" + // Size: 4855 bytes - "\x02\x0c\x09\x02\xb0\xec\x02\xad\xd8\x02\xad\xd9\x02\x06\x07\x02\x0f\x12" + - "\x02\x0f\x1f\x02\x0f\x1d\x02\x01\x13\x02\x0f\x16\x02\x0f\x0b\x02\x0f3" + - "\x02\x0f7\x02\x0f?\x02\x0f/\x02\x0f*\x02\x0c&\x02\x0c*\x02\x0c;\x02\x0c9" + - "\x02\x0c%\x02\xab\xed\x02\xab\xe2\x02\xab\xe3\x02\xa9\xe0\x02\xa9\xe1" + - "\x02\xa9\xe6\x02\xa3\xcb\x02\xa3\xc8\x02\xa3\xc9\x02\x01#\x02\x01\x08" + - "\x02\x0e>\x02\x0e'\x02\x0f\x03\x02\x03\x0d\x02\x03\x09\x02\x03\x17\x02" + - "\x03\x0e\x02\x02\x03\x02\x011\x02\x01\x00\x02\x01\x10\x02\x03<\x02\x07" + - "\x0d\x02\x02\x0c\x02\x0c0\x02\x01\x03\x02\x01\x01\x02\x01 \x02\x01\x22" + - "\x02\x01)\x02\x01\x0a\x02\x01\x0c\x02\x02\x06\x02\x02\x02\x02\x03\x10" + - "\x03\x037 \x03\x0b+\x03\x02\x01\x04\x02\x01\x02\x02\x019\x02\x03\x1c\x02" + - "\x02$\x03\x80p$\x02\x03:\x02\x03\x0a\x03\xc1r.\x03\xc1r,\x03\xc1r\x02" + - "\x02\x02:\x02\x02>\x02\x02,\x02\x02\x10\x02\x02\x00\x03\xc1s<\x03\xc1s*" + - "\x03\xc2L$\x03\xc2L;\x02\x09)\x02\x0a\x19\x03\x83\xab\xe3\x03\x83\xab" + - "\xf2\x03 4\xe0\x03\x81\xab\xea\x03\x81\xab\xf3\x03 4\xef\x03\x96\xe1\xcd" + - "\x03\x84\xe5\xc3\x02\x0d\x11\x03\x8b\xec\xcb\x03\x94\xec\xcf\x03\x9a\xec" + - "\xc2\x03\x8b\xec\xdb\x03\x94\xec\xdf\x03\x9a\xec\xd2\x03\x01\x0c!\x03" + - "\x01\x0c#\x03ʠ\x9d\x03ʣ\x9c\x03ʢ\x9f\x03ʥ\x9e\x03ʤ\x91\x03ʧ\x90\x03ʦ\x93" + - "\x03ʩ\x92\x03ʨ\x95\x03\xca\xf3\xb5\x03\xca\xf0\xb4\x03\xca\xf1\xb7\x03" + - "\xca\xf6\xb6\x03\xca\xf7\x89\x03\xca\xf4\x88\x03\xca\xf5\x8b\x03\xca\xfa" + - "\x8a\x03\xca\xfb\x8d\x03\xca\xf8\x8c\x03\xca\xf9\x8f\x03\xca\xfe\x8e\x03" + - "\xca\xff\x81\x03\xca\xfc\x80\x03\xca\xfd\x83\x03\xca\xe2\x82\x03\xca\xe3" + - "\x85\x03\xca\xe0\x84\x03\xca\xe1\x87\x03\xca\xe6\x86\x03\xca\xe7\x99\x03" + - "\xca\xe4\x98\x03\xca\xe5\x9b\x03\xca\xea\x9a\x03\xca\xeb\x9d\x03\xca\xe8" + - "\x9c\x03ؓ\x89\x03ߔ\x8b\x02\x010\x03\x03\x04\x1e\x03\x04\x15\x12\x03\x0b" + - "\x05,\x03\x06\x04\x00\x03\x06\x04)\x03\x06\x044\x03\x06\x04<\x03\x06\x05" + - "\x1d\x03\x06\x06\x00\x03\x06\x06\x0a\x03\x06\x06'\x03\x06\x062\x03\x0786" + - "\x03\x079/\x03\x079 \x03\x07:\x0e\x03\x07:\x1b\x03\x07:%\x03\x07;/\x03" + - "\x07;%\x03\x074\x11\x03\x076\x09\x03\x077*\x03\x070\x01\x03\x070\x0f\x03" + - "\x070.\x03\x071\x16\x03\x071\x04\x03\x0710\x03\x072\x18\x03\x072-\x03" + - "\x073\x14\x03\x073>\x03\x07'\x09\x03\x07 \x00\x03\x07\x1f\x0b\x03\x07" + - "\x18#\x03\x07\x18(\x03\x07\x186\x03\x07\x18\x03\x03\x07\x19\x16\x03\x07" + - "\x116\x03\x07\x12'\x03\x07\x13\x10\x03\x07\x0c&\x03\x07\x0c\x08\x03\x07" + - "\x0c\x13\x03\x07\x0d\x02\x03\x07\x0d\x1c\x03\x07\x0b5\x03\x07\x0b\x0a" + - "\x03\x07\x0b\x01\x03\x07\x0b\x0f\x03\x07\x05\x00\x03\x07\x05\x09\x03\x07" + - "\x05\x0b\x03\x07\x07\x01\x03\x07\x07\x08\x03\x07\x00<\x03\x07\x00+\x03" + - "\x07\x01)\x03\x07\x01\x1b\x03\x07\x01\x08\x03\x07\x03?\x03\x0445\x03\x04" + - "4\x08\x03\x0454\x03\x04)/\x03\x04)5\x03\x04+\x05\x03\x04+\x14\x03\x04+ " + - "\x03\x04+<\x03\x04*&\x03\x04*\x22\x03\x04&8\x03\x04!\x01\x03\x04!\x22" + - "\x03\x04\x11+\x03\x04\x10.\x03\x04\x104\x03\x04\x13=\x03\x04\x12\x04\x03" + - "\x04\x12\x0a\x03\x04\x0d\x1d\x03\x04\x0d\x07\x03\x04\x0d \x03\x05<>\x03" + - "\x055<\x03\x055!\x03\x055#\x03\x055&\x03\x054\x1d\x03\x054\x02\x03\x054" + - "\x07\x03\x0571\x03\x053\x1a\x03\x053\x16\x03\x05.<\x03\x05.\x07\x03\x05)" + - ":\x03\x05)<\x03\x05)\x0c\x03\x05)\x15\x03\x05+-\x03\x05+5\x03\x05$\x1e" + - "\x03\x05$\x14\x03\x05'\x04\x03\x05'\x14\x03\x05&\x02\x03\x05\x226\x03" + - "\x05\x22\x0c\x03\x05\x22\x1c\x03\x05\x19\x0a\x03\x05\x1b\x09\x03\x05\x1b" + - "\x0c\x03\x05\x14\x07\x03\x05\x16?\x03\x05\x16\x0c\x03\x05\x0c\x05\x03" + - "\x05\x0e\x0f\x03\x05\x01\x0e\x03\x05\x00(\x03\x05\x030\x03\x05\x03\x06" + - "\x03\x0a==\x03\x0a=1\x03\x0a=,\x03\x0a=\x0c\x03\x0a??\x03\x0a<\x08\x03" + - "\x0a9!\x03\x0a9)\x03\x0a97\x03\x0a99\x03\x0a6\x0a\x03\x0a6\x1c\x03\x0a6" + - "\x17\x03\x0a7'\x03\x0a78\x03\x0a73\x03\x0a'\x01\x03\x0a'&\x03\x0a\x1f" + - "\x0e\x03\x0a\x1f\x03\x03\x0a\x1f3\x03\x0a\x1b/\x03\x0a\x18\x19\x03\x0a" + - "\x19\x01\x03\x0a\x16\x14\x03\x0a\x0e\x22\x03\x0a\x0f\x10\x03\x0a\x0f\x02" + - "\x03\x0a\x0f \x03\x0a\x0c\x04\x03\x0a\x0b>\x03\x0a\x0b+\x03\x0a\x08/\x03" + - "\x0a\x046\x03\x0a\x05\x14\x03\x0a\x00\x04\x03\x0a\x00\x10\x03\x0a\x00" + - "\x14\x03\x0b<3\x03\x0b;*\x03\x0b9\x22\x03\x0b9)\x03\x0b97\x03\x0b+\x10" + - "\x03\x0b((\x03\x0b&5\x03\x0b$\x1c\x03\x0b$\x12\x03\x0b%\x04\x03\x0b#<" + - "\x03\x0b#0\x03\x0b#\x0d\x03\x0b#\x19\x03\x0b!:\x03\x0b!\x1f\x03\x0b!\x00" + - "\x03\x0b\x1e5\x03\x0b\x1c\x1d\x03\x0b\x1d-\x03\x0b\x1d(\x03\x0b\x18.\x03" + - "\x0b\x18 \x03\x0b\x18\x16\x03\x0b\x14\x13\x03\x0b\x15$\x03\x0b\x15\x22" + - "\x03\x0b\x12\x1b\x03\x0b\x12\x10\x03\x0b\x132\x03\x0b\x13=\x03\x0b\x12" + - "\x18\x03\x0b\x0c&\x03\x0b\x061\x03\x0b\x06:\x03\x0b\x05#\x03\x0b\x05<" + - "\x03\x0b\x04\x0b\x03\x0b\x04\x04\x03\x0b\x04\x1b\x03\x0b\x042\x03\x0b" + - "\x041\x03\x0b\x03\x03\x03\x0b\x03\x1d\x03\x0b\x03/\x03\x0b\x03+\x03\x0b" + - "\x02\x1b\x03\x0b\x02\x00\x03\x0b\x01\x1e\x03\x0b\x01\x08\x03\x0b\x015" + - "\x03\x06\x0d9\x03\x06\x0d=\x03\x06\x0d?\x03\x02\x001\x03\x02\x003\x03" + - "\x02\x02\x19\x03\x02\x006\x03\x02\x02\x1b\x03\x02\x004\x03\x02\x00<\x03" + - "\x02\x02\x0a\x03\x02\x02\x0e\x03\x02\x01\x1a\x03\x02\x01\x07\x03\x02\x01" + - "\x05\x03\x02\x01\x0b\x03\x02\x01%\x03\x02\x01\x0c\x03\x02\x01\x04\x03" + - "\x02\x01\x1c\x03\x02\x00.\x03\x02\x002\x03\x02\x00>\x03\x02\x00\x12\x03" + - "\x02\x00\x16\x03\x02\x011\x03\x02\x013\x03\x02\x02 \x03\x02\x02%\x03\x02" + - "\x02$\x03\x02\x028\x03\x02\x02;\x03\x02\x024\x03\x02\x012\x03\x02\x022" + - "\x03\x02\x02/\x03\x02\x01,\x03\x02\x01\x13\x03\x02\x01\x16\x03\x02\x01" + - "\x11\x03\x02\x01\x1e\x03\x02\x01\x15\x03\x02\x01\x17\x03\x02\x01\x0f\x03" + - "\x02\x01\x08\x03\x02\x00?\x03\x02\x03\x07\x03\x02\x03\x0d\x03\x02\x03" + - "\x13\x03\x02\x03\x1d\x03\x02\x03\x1f\x03\x02\x00\x03\x03\x02\x00\x0d\x03" + - "\x02\x00\x01\x03\x02\x00\x1b\x03\x02\x00\x19\x03\x02\x00\x18\x03\x02\x00" + - "\x13\x03\x02\x00/\x03\x07>\x12\x03\x07<\x1f\x03\x07>\x1d\x03\x06\x1d\x0e" + - "\x03\x07>\x1c\x03\x07>:\x03\x07>\x13\x03\x04\x12+\x03\x07?\x03\x03\x07>" + - "\x02\x03\x06\x224\x03\x06\x1a.\x03\x07<%\x03\x06\x1c\x0b\x03\x0609\x03" + - "\x05\x1f\x01\x03\x04'\x08\x03\x93\xfd\xf5\x03\x02\x0d \x03\x02\x0d#\x03" + - "\x02\x0d!\x03\x02\x0d&\x03\x02\x0d\x22\x03\x02\x0d/\x03\x02\x0d,\x03\x02" + - "\x0d$\x03\x02\x0d'\x03\x02\x0d%\x03\x02\x0d;\x03\x02\x0d=\x03\x02\x0d?" + - "\x03\x099.\x03\x08\x0b7\x03\x08\x02\x14\x03\x08\x14\x0d\x03\x08.:\x03" + - "\x089'\x03\x0f\x0b\x18\x03\x0f\x1c1\x03\x0f\x17&\x03\x0f9\x1f\x03\x0f0" + - "\x0c\x03\x0e\x0a9\x03\x0e\x056\x03\x0e\x1c#\x03\x0f\x13\x0e\x03\x072\x00" + - "\x03\x070\x0d\x03\x072\x0b\x03\x06\x11\x18\x03\x070\x10\x03\x06\x0f(\x03" + - "\x072\x05\x03\x06\x0f,\x03\x073\x15\x03\x06\x07\x08\x03\x05\x16\x02\x03" + - "\x04\x0b \x03\x05:8\x03\x05\x16%\x03\x0a\x0d\x1f\x03\x06\x16\x10\x03\x05" + - "\x1d5\x03\x05*;\x03\x05\x16\x1b\x03\x04.-\x03\x06\x1a\x19\x03\x04\x03," + - "\x03\x0b87\x03\x04/\x0a\x03\x06\x00,\x03\x04-\x01\x03\x04\x1e-\x03\x06/(" + - "\x03\x0a\x0b5\x03\x06\x0e7\x03\x06\x07.\x03\x0597\x03\x0a*%\x03\x0760" + - "\x03\x06\x0c;\x03\x05'\x00\x03\x072.\x03\x072\x08\x03\x06=\x01\x03\x06" + - "\x05\x1b\x03\x06\x06\x12\x03\x06$=\x03\x06'\x0d\x03\x04\x11\x0f\x03\x076" + - ",\x03\x06\x07;\x03\x06.,\x03\x86\xf9\xea\x03\x8f\xff\xeb\x02\x092\x02" + - "\x095\x02\x094\x02\x09;\x02\x09>\x02\x098\x02\x09*\x02\x09/\x02\x09,\x02" + - "\x09%\x02\x09&\x02\x09#\x02\x09 \x02\x08!\x02\x08%\x02\x08$\x02\x08+\x02" + - "\x08.\x02\x08*\x02\x08&\x02\x088\x02\x08>\x02\x084\x02\x086\x02\x080\x02" + - "\x08\x10\x02\x08\x17\x02\x08\x12\x02\x08\x1d\x02\x08\x1f\x02\x08\x13\x02" + - "\x08\x15\x02\x08\x14\x02\x08\x0c\x03\x8b\xfd\xd0\x03\x81\xec\xc6\x03\x87" + - "\xe0\x8a\x03-2\xe3\x03\x80\xef\xe4\x03-2\xea\x03\x88\xe6\xeb\x03\x8e\xe6" + - "\xe8\x03\x84\xe6\xe9\x03\x97\xe6\xee\x03-2\xf9\x03-2\xf6\x03\x8e\xe3\xad" + - "\x03\x80\xe3\x92\x03\x88\xe3\x90\x03\x8e\xe3\x90\x03\x80\xe3\x97\x03\x88" + - "\xe3\x95\x03\x88\xfe\xcb\x03\x8e\xfe\xca\x03\x84\xfe\xcd\x03\x91\xef\xc9" + - "\x03-2\xc1\x03-2\xc0\x03-2\xcb\x03\x88@\x09\x03\x8e@\x08\x03\x8f\xe0\xf5" + - "\x03\x8e\xe6\xf9\x03\x8e\xe0\xfa\x03\x93\xff\xf4\x03\x84\xee\xd3\x03\x0b" + - "(\x04\x023 \x021;\x02\x01*\x03\x0b#\x10\x03\x0b 0\x03\x0b!\x10\x03\x0b!0" + - "\x03\x07\x15\x08\x03\x09?5\x03\x07\x1f\x08\x03\x07\x17\x0b\x03\x09\x1f" + - "\x15\x03\x0b\x1c7\x03\x0a+#\x03\x06\x1a\x1b\x03\x06\x1a\x14\x03\x0a\x01" + - "\x18\x03\x06#\x1b\x03\x0a2\x0c\x03\x0a\x01\x04\x03\x09#;\x03\x08='\x03" + - "\x08\x1a\x0a\x03\x07</\x03\x07:+\x03\x07\x07*\x03\x06&\x1c\x03\x09\x0c" + - "\x16\x03\x09\x10\x0e\x03\x08'\x0f\x03\x08+\x09\x03\x074%\x03\x06!3\x03" + - "\x06\x03+\x03\x0b\x1e\x19\x03\x0a))\x03\x09\x08\x19\x03\x08,\x05\x03\x07" + - "<2\x03\x06\x1c>\x03\x0a\x111\x03\x09\x1b\x09\x03\x073.\x03\x07\x01\x00" + - "\x03\x09/,\x03\x07#>\x03\x07\x048\x03\x0a\x1f\x22\x03\x098>\x03\x09\x11" + - "\x00\x03\x08/\x17\x03\x06'\x22\x03\x0b\x1a+\x03\x0a\x22\x19\x03\x0a/1" + - "\x03\x0974\x03\x09\x0f\x22\x03\x08,\x22\x03\x08?\x14\x03\x07$5\x03\x07<3" + - "\x03\x07=*\x03\x07\x13\x18\x03\x068\x0a\x03\x06\x09\x16\x03\x06\x13\x00" + - "\x03\x08\x067\x03\x08\x01\x03\x03\x08\x12\x1d\x03\x07+7\x03\x06(;\x03" + - "\x06\x1c?\x03\x07\x0e\x17\x03\x0a\x06\x1d\x03\x0a\x19\x07\x03\x08\x14$" + - "\x03\x07$;\x03\x08,$\x03\x08\x06\x0d\x03\x07\x16\x0a\x03\x06>>\x03\x0a" + - "\x06\x12\x03\x0a\x14)\x03\x09\x0d\x1f\x03\x09\x12\x17\x03\x09\x19\x01" + - "\x03\x08\x11 \x03\x08\x1d'\x03\x06<\x1a\x03\x0a.\x00\x03\x07'\x18\x03" + - "\x0a\x22\x08\x03\x08\x0d\x0a\x03\x08\x13)\x03\x07*)\x03\x06<,\x03\x07" + - "\x0b\x1a\x03\x09.\x14\x03\x09\x0d\x1e\x03\x07\x0e#\x03\x0b\x1d'\x03\x0a" + - "\x0a8\x03\x09%2\x03\x08+&\x03\x080\x12\x03\x0a)4\x03\x08\x06\x1f\x03\x0b" + - "\x1b\x1a\x03\x0a\x1b\x0f\x03\x0b\x1d*\x03\x09\x16$\x03\x090\x11\x03\x08" + - "\x11\x08\x03\x0a*(\x03\x0a\x042\x03\x089,\x03\x074'\x03\x07\x0f\x05\x03" + - "\x09\x0b\x0a\x03\x07\x1b\x01\x03\x09\x17:\x03\x09.\x0d\x03\x07.\x11\x03" + - "\x09+\x15\x03\x080\x13\x03\x0b\x1f\x19\x03\x0a \x11\x03\x0a\x220\x03\x09" + - "\x07;\x03\x08\x16\x1c\x03\x07,\x13\x03\x07\x0e/\x03\x06\x221\x03\x0a." + - "\x0a\x03\x0a7\x02\x03\x0a\x032\x03\x0a\x1d.\x03\x091\x06\x03\x09\x19:" + - "\x03\x08\x02/\x03\x060+\x03\x06\x0f-\x03\x06\x1c\x1f\x03\x06\x1d\x07\x03" + - "\x0a,\x11\x03\x09=\x0d\x03\x09\x0b;\x03\x07\x1b/\x03\x0a\x1f:\x03\x09 " + - "\x1f\x03\x09.\x10\x03\x094\x0b\x03\x09\x1a1\x03\x08#\x1a\x03\x084\x1d" + - "\x03\x08\x01\x1f\x03\x08\x11\x22\x03\x07'8\x03\x07\x1a>\x03\x0757\x03" + - "\x06&9\x03\x06+\x11\x03\x0a.\x0b\x03\x0a,>\x03\x0a4#\x03\x08%\x17\x03" + - "\x07\x05\x22\x03\x07\x0c\x0b\x03\x0a\x1d+\x03\x0a\x19\x16\x03\x09+\x1f" + - "\x03\x09\x08\x0b\x03\x08\x16\x18\x03\x08+\x12\x03\x0b\x1d\x0c\x03\x0a=" + - "\x10\x03\x0a\x09\x0d\x03\x0a\x10\x11\x03\x09&0\x03\x08(\x1f\x03\x087\x07" + - "\x03\x08\x185\x03\x07'6\x03\x06.\x05\x03\x06=\x04\x03\x06;;\x03\x06\x06," + - "\x03\x0b\x18>\x03\x08\x00\x18\x03\x06 \x03\x03\x06<\x00\x03\x09%\x18\x03" + - "\x0b\x1c<\x03\x0a%!\x03\x0a\x09\x12\x03\x0a\x16\x02\x03\x090'\x03\x09" + - "\x0e=\x03\x08 \x0e\x03\x08>\x03\x03\x074>\x03\x06&?\x03\x06\x19\x09\x03" + - "\x06?(\x03\x0a-\x0e\x03\x09:3\x03\x098:\x03\x09\x12\x0b\x03\x09\x1d\x17" + - "\x03\x087\x05\x03\x082\x14\x03\x08\x06%\x03\x08\x13\x1f\x03\x06\x06\x0e" + - "\x03\x0a\x22<\x03\x09/<\x03\x06>+\x03\x0a'?\x03\x0a\x13\x0c\x03\x09\x10<" + - "\x03\x07\x1b=\x03\x0a\x19\x13\x03\x09\x22\x1d\x03\x09\x07\x0d\x03\x08)" + - "\x1c\x03\x06=\x1a\x03\x0a/4\x03\x0a7\x11\x03\x0a\x16:\x03\x09?3\x03\x09:" + - "/\x03\x09\x05\x0a\x03\x09\x14\x06\x03\x087\x22\x03\x080\x07\x03\x08\x1a" + - "\x1f\x03\x07\x04(\x03\x07\x04\x09\x03\x06 %\x03\x06<\x08\x03\x0a+\x14" + - "\x03\x09\x1d\x16\x03\x0a70\x03\x08 >\x03\x0857\x03\x070\x0a\x03\x06=\x12" + - "\x03\x06\x16%\x03\x06\x1d,\x03\x099#\x03\x09\x10>\x03\x07 \x1e\x03\x08" + - "\x0c<\x03\x08\x0b\x18\x03\x08\x15+\x03\x08,:\x03\x08%\x22\x03\x07\x0a$" + - "\x03\x0b\x1c=\x03\x07+\x08\x03\x0a/\x05\x03\x0a \x07\x03\x0a\x12'\x03" + - "\x09#\x11\x03\x08\x1b\x15\x03\x0a\x06\x01\x03\x09\x1c\x1b\x03\x0922\x03" + - "\x07\x14<\x03\x07\x09\x04\x03\x061\x04\x03\x07\x0e\x01\x03\x0a\x13\x18" + - "\x03\x0a-\x0c\x03\x0a?\x0d\x03\x0a\x09\x0a\x03\x091&\x03\x0a/\x0b\x03" + - "\x08$<\x03\x083\x1d\x03\x08\x0c$\x03\x08\x0d\x07\x03\x08\x0d?\x03\x08" + - "\x0e\x14\x03\x065\x0a\x03\x08\x1a#\x03\x08\x16#\x03\x0702\x03\x07\x03" + - "\x1a\x03\x06(\x1d\x03\x06+\x1b\x03\x06\x0b\x05\x03\x06\x0b\x17\x03\x06" + - "\x0c\x04\x03\x06\x1e\x19\x03\x06+0\x03\x062\x18\x03\x0b\x16\x1e\x03\x0a+" + - "\x16\x03\x0a-?\x03\x0a#:\x03\x0a#\x10\x03\x0a%$\x03\x0a>+\x03\x0a01\x03" + - "\x0a1\x10\x03\x0a\x099\x03\x0a\x0a\x12\x03\x0a\x19\x1f\x03\x0a\x19\x12" + - "\x03\x09*)\x03\x09-\x16\x03\x09.1\x03\x09.2\x03\x09<\x0e\x03\x09> \x03" + - "\x093\x12\x03\x09\x0b\x01\x03\x09\x1c2\x03\x09\x11\x1c\x03\x09\x15%\x03" + - "\x08,&\x03\x08!\x22\x03\x089(\x03\x08\x0b\x1a\x03\x08\x0d2\x03\x08\x0c" + - "\x04\x03\x08\x0c\x06\x03\x08\x0c\x1f\x03\x08\x0c\x0c\x03\x08\x0f\x1f\x03" + - "\x08\x0f\x1d\x03\x08\x00\x14\x03\x08\x03\x14\x03\x08\x06\x16\x03\x08\x1e" + - "#\x03\x08\x11\x11\x03\x08\x10\x18\x03\x08\x14(\x03\x07)\x1e\x03\x07.1" + - "\x03\x07 $\x03\x07 '\x03\x078\x08\x03\x07\x0d0\x03\x07\x0f7\x03\x07\x05#" + - "\x03\x07\x05\x1a\x03\x07\x1a7\x03\x07\x1d-\x03\x07\x17\x10\x03\x06)\x1f" + - "\x03\x062\x0b\x03\x066\x16\x03\x06\x09\x11\x03\x09(\x1e\x03\x07!5\x03" + - "\x0b\x11\x16\x03\x0a/\x04\x03\x0a,\x1a\x03\x0b\x173\x03\x0a,1\x03\x0a/5" + - "\x03\x0a\x221\x03\x0a\x22\x0d\x03\x0a?%\x03\x0a<,\x03\x0a?#\x03\x0a>\x19" + - "\x03\x0a\x08&\x03\x0a\x0b\x0e\x03\x0a\x0c:\x03\x0a\x0c+\x03\x0a\x03\x22" + - "\x03\x0a\x06)\x03\x0a\x11\x10\x03\x0a\x11\x1a\x03\x0a\x17-\x03\x0a\x14(" + - "\x03\x09)\x1e\x03\x09/\x09\x03\x09.\x00\x03\x09,\x07\x03\x09/*\x03\x09-9" + - "\x03\x09\x228\x03\x09%\x09\x03\x09:\x12\x03\x09;\x1d\x03\x09?\x06\x03" + - "\x093%\x03\x096\x05\x03\x096\x08\x03\x097\x02\x03\x09\x07,\x03\x09\x04," + - "\x03\x09\x1f\x16\x03\x09\x11\x03\x03\x09\x11\x12\x03\x09\x168\x03\x08*" + - "\x05\x03\x08/2\x03\x084:\x03\x08\x22+\x03\x08 0\x03\x08&\x0a\x03\x08;" + - "\x10\x03\x08>$\x03\x08>\x18\x03\x0829\x03\x082:\x03\x081,\x03\x081<\x03" + - "\x081\x1c\x03\x087#\x03\x087*\x03\x08\x09'\x03\x08\x00\x1d\x03\x08\x05-" + - "\x03\x08\x1f4\x03\x08\x1d\x04\x03\x08\x16\x0f\x03\x07*7\x03\x07'!\x03" + - "\x07%\x1b\x03\x077\x0c\x03\x07\x0c1\x03\x07\x0c.\x03\x07\x00\x06\x03\x07" + - "\x01\x02\x03\x07\x010\x03\x07\x06=\x03\x07\x01\x03\x03\x07\x01\x13\x03" + - "\x07\x06\x06\x03\x07\x05\x0a\x03\x07\x1f\x09\x03\x07\x17:\x03\x06*1\x03" + - "\x06-\x1d\x03\x06\x223\x03\x062:\x03\x060$\x03\x066\x1e\x03\x064\x12\x03" + - "\x0645\x03\x06\x0b\x00\x03\x06\x0b7\x03\x06\x07\x1f\x03\x06\x15\x12\x03" + - "\x0c\x05\x0f\x03\x0b+\x0b\x03\x0b+-\x03\x06\x16\x1b\x03\x06\x15\x17\x03" + - "\x89\xca\xea\x03\x89\xca\xe8\x03\x0c8\x10\x03\x0c8\x01\x03\x0c8\x0f\x03" + - "\x0d8%\x03\x0d8!\x03\x0c8-\x03\x0c8/\x03\x0c8+\x03\x0c87\x03\x0c85\x03" + - "\x0c9\x09\x03\x0c9\x0d\x03\x0c9\x0f\x03\x0c9\x0b\x03\xcfu\x0c\x03\xcfu" + - "\x0f\x03\xcfu\x0e\x03\xcfu\x09\x03\x0c9\x10\x03\x0d9\x0c\x03\xcf`;\x03" + - "\xcf`>\x03\xcf`9\x03\xcf`8\x03\xcf`7\x03\xcf`*\x03\xcf`-\x03\xcf`,\x03" + - "\x0d\x1b\x1a\x03\x0d\x1b&\x03\x0c=.\x03\x0c=%\x03\x0c>\x1e\x03\x0c>\x14" + - "\x03\x0c?\x06\x03\x0c?\x0b\x03\x0c?\x0c\x03\x0c?\x0d\x03\x0c?\x02\x03" + - "\x0c>\x0f\x03\x0c>\x08\x03\x0c>\x09\x03\x0c>,\x03\x0c>\x0c\x03\x0c?\x13" + - "\x03\x0c?\x16\x03\x0c?\x15\x03\x0c?\x1c\x03\x0c?\x1f\x03\x0c?\x1d\x03" + - "\x0c?\x1a\x03\x0c?\x17\x03\x0c?\x08\x03\x0c?\x09\x03\x0c?\x0e\x03\x0c?" + - "\x04\x03\x0c?\x05\x03\x0c<?\x03\x0c=\x00\x03\x0c=\x06\x03\x0c=\x05\x03" + - "\x0c=\x0c\x03\x0c=\x0f\x03\x0c=\x0d\x03\x0c=\x0b\x03\x0c=\x07\x03\x0c=" + - "\x19\x03\x0c=\x15\x03\x0c=\x11\x03\x0c=1\x03\x0c=3\x03\x0c=0\x03\x0c=>" + - "\x03\x0c=2\x03\x0c=6\x03\x0c<\x07\x03\x0c<\x05\x03\x0e:!\x03\x0e:#\x03" + - "\x0e8\x09\x03\x0e:&\x03\x0e8\x0b\x03\x0e:$\x03\x0e:,\x03\x0e8\x1a\x03" + - "\x0e8\x1e\x03\x0e:*\x03\x0e:7\x03\x0e:5\x03\x0e:;\x03\x0e:\x15\x03\x0e:<" + - "\x03\x0e:4\x03\x0e:'\x03\x0e:-\x03\x0e:%\x03\x0e:?\x03\x0e:=\x03\x0e:)" + - "\x03\x0e:/\x03\xcfs'\x03\x0d=\x0f\x03\x0d+*\x03\x0d99\x03\x0d9;\x03\x0d9" + - "?\x03\x0d)\x0d\x03\x0d(%\x02\x01\x18\x02\x01(\x02\x01\x1e\x03\x0f$!\x03" + - "\x0f87\x03\x0f4\x0e\x03\x0f5\x1d\x03\x06'\x03\x03\x0f\x08\x18\x03\x0f" + - "\x0d\x1b\x03\x0e2=\x03\x0e;\x08\x03\x0e:\x0b\x03\x0e\x06$\x03\x0e\x0d)" + - "\x03\x0e\x16\x1f\x03\x0e\x16\x1b\x03\x0d$\x0a\x03\x05,\x1d\x03\x0d. \x03" + - "\x0d.#\x03\x0c(/\x03\x09%\x02\x03\x0d90\x03\x0d\x0e4\x03\x0d\x0d\x0f\x03" + - "\x0c#\x00\x03\x0c,\x1e\x03\x0c2\x0e\x03\x0c\x01\x17\x03\x0c\x09:\x03\x0e" + - "\x173\x03\x0c\x08\x03\x03\x0c\x11\x07\x03\x0c\x10\x18\x03\x0c\x1f\x1c" + - "\x03\x0c\x19\x0e\x03\x0c\x1a\x1f\x03\x0f0>\x03\x0b->\x03\x0b<+\x03\x0b8" + - "\x13\x03\x0b\x043\x03\x0b\x14\x03\x03\x0b\x16%\x03\x0d\x22&\x03\x0b\x1a" + - "\x1a\x03\x0b\x1a\x04\x03\x0a%9\x03\x0a&2\x03\x0a&0\x03\x0a!\x1a\x03\x0a!" + - "7\x03\x0a5\x10\x03\x0a=4\x03\x0a?\x0e\x03\x0a>\x10\x03\x0a\x00 \x03\x0a" + - "\x0f:\x03\x0a\x0f9\x03\x0a\x0b\x0a\x03\x0a\x17%\x03\x0a\x1b-\x03\x09-" + - "\x1a\x03\x09,4\x03\x09.,\x03\x09)\x09\x03\x096!\x03\x091\x1f\x03\x093" + - "\x16\x03\x0c+\x1f\x03\x098 \x03\x098=\x03\x0c(\x1a\x03\x0c(\x16\x03\x09" + - "\x0a+\x03\x09\x16\x12\x03\x09\x13\x0e\x03\x09\x153\x03\x08)!\x03\x09\x1a" + - "\x01\x03\x09\x18\x01\x03\x08%#\x03\x08>\x22\x03\x08\x05%\x03\x08\x02*" + - "\x03\x08\x15;\x03\x08\x1b7\x03\x0f\x07\x1d\x03\x0f\x04\x03\x03\x070\x0c" + - "\x03\x07;\x0b\x03\x07\x08\x17\x03\x07\x12\x06\x03\x06/-\x03\x0671\x03" + - "\x065+\x03\x06>7\x03\x06\x049\x03\x05+\x1e\x03\x05,\x17\x03\x05 \x1d\x03" + - "\x05\x22\x05\x03\x050\x1d" - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookup(s []byte) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupUnsafe(s []byte) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookupString(s string) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupStringUnsafe(s string) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// idnaTrie. Total size: 29404 bytes (28.71 KiB). Checksum: 848c45acb5f7991c. -type idnaTrie struct{} - -func newIdnaTrie(i int) *idnaTrie { - return &idnaTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *idnaTrie) lookupValue(n uint32, b byte) uint16 { - switch { - case n < 125: - return uint16(idnaValues[n<<6+uint32(b)]) - default: - n -= 125 - return uint16(idnaSparse.lookup(n, b)) - } -} - -// idnaValues: 127 blocks, 8128 entries, 16256 bytes -// The third block is the zero block. -var idnaValues = [8128]uint16{ - // Block 0x0, offset 0x0 - 0x00: 0x0080, 0x01: 0x0080, 0x02: 0x0080, 0x03: 0x0080, 0x04: 0x0080, 0x05: 0x0080, - 0x06: 0x0080, 0x07: 0x0080, 0x08: 0x0080, 0x09: 0x0080, 0x0a: 0x0080, 0x0b: 0x0080, - 0x0c: 0x0080, 0x0d: 0x0080, 0x0e: 0x0080, 0x0f: 0x0080, 0x10: 0x0080, 0x11: 0x0080, - 0x12: 0x0080, 0x13: 0x0080, 0x14: 0x0080, 0x15: 0x0080, 0x16: 0x0080, 0x17: 0x0080, - 0x18: 0x0080, 0x19: 0x0080, 0x1a: 0x0080, 0x1b: 0x0080, 0x1c: 0x0080, 0x1d: 0x0080, - 0x1e: 0x0080, 0x1f: 0x0080, 0x20: 0x0080, 0x21: 0x0080, 0x22: 0x0080, 0x23: 0x0080, - 0x24: 0x0080, 0x25: 0x0080, 0x26: 0x0080, 0x27: 0x0080, 0x28: 0x0080, 0x29: 0x0080, - 0x2a: 0x0080, 0x2b: 0x0080, 0x2c: 0x0080, 0x2d: 0x0008, 0x2e: 0x0008, 0x2f: 0x0080, - 0x30: 0x0008, 0x31: 0x0008, 0x32: 0x0008, 0x33: 0x0008, 0x34: 0x0008, 0x35: 0x0008, - 0x36: 0x0008, 0x37: 0x0008, 0x38: 0x0008, 0x39: 0x0008, 0x3a: 0x0080, 0x3b: 0x0080, - 0x3c: 0x0080, 0x3d: 0x0080, 0x3e: 0x0080, 0x3f: 0x0080, - // Block 0x1, offset 0x40 - 0x40: 0x0080, 0x41: 0xe105, 0x42: 0xe105, 0x43: 0xe105, 0x44: 0xe105, 0x45: 0xe105, - 0x46: 0xe105, 0x47: 0xe105, 0x48: 0xe105, 0x49: 0xe105, 0x4a: 0xe105, 0x4b: 0xe105, - 0x4c: 0xe105, 0x4d: 0xe105, 0x4e: 0xe105, 0x4f: 0xe105, 0x50: 0xe105, 0x51: 0xe105, - 0x52: 0xe105, 0x53: 0xe105, 0x54: 0xe105, 0x55: 0xe105, 0x56: 0xe105, 0x57: 0xe105, - 0x58: 0xe105, 0x59: 0xe105, 0x5a: 0xe105, 0x5b: 0x0080, 0x5c: 0x0080, 0x5d: 0x0080, - 0x5e: 0x0080, 0x5f: 0x0080, 0x60: 0x0080, 0x61: 0x0008, 0x62: 0x0008, 0x63: 0x0008, - 0x64: 0x0008, 0x65: 0x0008, 0x66: 0x0008, 0x67: 0x0008, 0x68: 0x0008, 0x69: 0x0008, - 0x6a: 0x0008, 0x6b: 0x0008, 0x6c: 0x0008, 0x6d: 0x0008, 0x6e: 0x0008, 0x6f: 0x0008, - 0x70: 0x0008, 0x71: 0x0008, 0x72: 0x0008, 0x73: 0x0008, 0x74: 0x0008, 0x75: 0x0008, - 0x76: 0x0008, 0x77: 0x0008, 0x78: 0x0008, 0x79: 0x0008, 0x7a: 0x0008, 0x7b: 0x0080, - 0x7c: 0x0080, 0x7d: 0x0080, 0x7e: 0x0080, 0x7f: 0x0080, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x0040, 0xc1: 0x0040, 0xc2: 0x0040, 0xc3: 0x0040, 0xc4: 0x0040, 0xc5: 0x0040, - 0xc6: 0x0040, 0xc7: 0x0040, 0xc8: 0x0040, 0xc9: 0x0040, 0xca: 0x0040, 0xcb: 0x0040, - 0xcc: 0x0040, 0xcd: 0x0040, 0xce: 0x0040, 0xcf: 0x0040, 0xd0: 0x0040, 0xd1: 0x0040, - 0xd2: 0x0040, 0xd3: 0x0040, 0xd4: 0x0040, 0xd5: 0x0040, 0xd6: 0x0040, 0xd7: 0x0040, - 0xd8: 0x0040, 0xd9: 0x0040, 0xda: 0x0040, 0xdb: 0x0040, 0xdc: 0x0040, 0xdd: 0x0040, - 0xde: 0x0040, 0xdf: 0x0040, 0xe0: 0x000a, 0xe1: 0x0018, 0xe2: 0x0018, 0xe3: 0x0018, - 0xe4: 0x0018, 0xe5: 0x0018, 0xe6: 0x0018, 0xe7: 0x0018, 0xe8: 0x001a, 0xe9: 0x0018, - 0xea: 0x0039, 0xeb: 0x0018, 0xec: 0x0018, 0xed: 0x03c0, 0xee: 0x0018, 0xef: 0x004a, - 0xf0: 0x0018, 0xf1: 0x0018, 0xf2: 0x0069, 0xf3: 0x0079, 0xf4: 0x008a, 0xf5: 0x0005, - 0xf6: 0x0018, 0xf7: 0x0008, 0xf8: 0x00aa, 0xf9: 0x00c9, 0xfa: 0x00d9, 0xfb: 0x0018, - 0xfc: 0x00e9, 0xfd: 0x0119, 0xfe: 0x0149, 0xff: 0x0018, - // Block 0x4, offset 0x100 - 0x100: 0xe00d, 0x101: 0x0008, 0x102: 0xe00d, 0x103: 0x0008, 0x104: 0xe00d, 0x105: 0x0008, - 0x106: 0xe00d, 0x107: 0x0008, 0x108: 0xe00d, 0x109: 0x0008, 0x10a: 0xe00d, 0x10b: 0x0008, - 0x10c: 0xe00d, 0x10d: 0x0008, 0x10e: 0xe00d, 0x10f: 0x0008, 0x110: 0xe00d, 0x111: 0x0008, - 0x112: 0xe00d, 0x113: 0x0008, 0x114: 0xe00d, 0x115: 0x0008, 0x116: 0xe00d, 0x117: 0x0008, - 0x118: 0xe00d, 0x119: 0x0008, 0x11a: 0xe00d, 0x11b: 0x0008, 0x11c: 0xe00d, 0x11d: 0x0008, - 0x11e: 0xe00d, 0x11f: 0x0008, 0x120: 0xe00d, 0x121: 0x0008, 0x122: 0xe00d, 0x123: 0x0008, - 0x124: 0xe00d, 0x125: 0x0008, 0x126: 0xe00d, 0x127: 0x0008, 0x128: 0xe00d, 0x129: 0x0008, - 0x12a: 0xe00d, 0x12b: 0x0008, 0x12c: 0xe00d, 0x12d: 0x0008, 0x12e: 0xe00d, 0x12f: 0x0008, - 0x130: 0x0179, 0x131: 0x0008, 0x132: 0x0035, 0x133: 0x004d, 0x134: 0xe00d, 0x135: 0x0008, - 0x136: 0xe00d, 0x137: 0x0008, 0x138: 0x0008, 0x139: 0xe01d, 0x13a: 0x0008, 0x13b: 0xe03d, - 0x13c: 0x0008, 0x13d: 0xe01d, 0x13e: 0x0008, 0x13f: 0x0199, - // Block 0x5, offset 0x140 - 0x140: 0x0199, 0x141: 0xe01d, 0x142: 0x0008, 0x143: 0xe03d, 0x144: 0x0008, 0x145: 0xe01d, - 0x146: 0x0008, 0x147: 0xe07d, 0x148: 0x0008, 0x149: 0x01b9, 0x14a: 0xe00d, 0x14b: 0x0008, - 0x14c: 0xe00d, 0x14d: 0x0008, 0x14e: 0xe00d, 0x14f: 0x0008, 0x150: 0xe00d, 0x151: 0x0008, - 0x152: 0xe00d, 0x153: 0x0008, 0x154: 0xe00d, 0x155: 0x0008, 0x156: 0xe00d, 0x157: 0x0008, - 0x158: 0xe00d, 0x159: 0x0008, 0x15a: 0xe00d, 0x15b: 0x0008, 0x15c: 0xe00d, 0x15d: 0x0008, - 0x15e: 0xe00d, 0x15f: 0x0008, 0x160: 0xe00d, 0x161: 0x0008, 0x162: 0xe00d, 0x163: 0x0008, - 0x164: 0xe00d, 0x165: 0x0008, 0x166: 0xe00d, 0x167: 0x0008, 0x168: 0xe00d, 0x169: 0x0008, - 0x16a: 0xe00d, 0x16b: 0x0008, 0x16c: 0xe00d, 0x16d: 0x0008, 0x16e: 0xe00d, 0x16f: 0x0008, - 0x170: 0xe00d, 0x171: 0x0008, 0x172: 0xe00d, 0x173: 0x0008, 0x174: 0xe00d, 0x175: 0x0008, - 0x176: 0xe00d, 0x177: 0x0008, 0x178: 0x0065, 0x179: 0xe01d, 0x17a: 0x0008, 0x17b: 0xe03d, - 0x17c: 0x0008, 0x17d: 0xe01d, 0x17e: 0x0008, 0x17f: 0x01d9, - // Block 0x6, offset 0x180 - 0x180: 0x0008, 0x181: 0x007d, 0x182: 0xe00d, 0x183: 0x0008, 0x184: 0xe00d, 0x185: 0x0008, - 0x186: 0x007d, 0x187: 0xe07d, 0x188: 0x0008, 0x189: 0x0095, 0x18a: 0x00ad, 0x18b: 0xe03d, - 0x18c: 0x0008, 0x18d: 0x0008, 0x18e: 0x00c5, 0x18f: 0x00dd, 0x190: 0x00f5, 0x191: 0xe01d, - 0x192: 0x0008, 0x193: 0x010d, 0x194: 0x0125, 0x195: 0x0008, 0x196: 0x013d, 0x197: 0x013d, - 0x198: 0xe00d, 0x199: 0x0008, 0x19a: 0x0008, 0x19b: 0x0008, 0x19c: 0x010d, 0x19d: 0x0155, - 0x19e: 0x0008, 0x19f: 0x016d, 0x1a0: 0xe00d, 0x1a1: 0x0008, 0x1a2: 0xe00d, 0x1a3: 0x0008, - 0x1a4: 0xe00d, 0x1a5: 0x0008, 0x1a6: 0x0185, 0x1a7: 0xe07d, 0x1a8: 0x0008, 0x1a9: 0x019d, - 0x1aa: 0x0008, 0x1ab: 0x0008, 0x1ac: 0xe00d, 0x1ad: 0x0008, 0x1ae: 0x0185, 0x1af: 0xe0fd, - 0x1b0: 0x0008, 0x1b1: 0x01b5, 0x1b2: 0x01cd, 0x1b3: 0xe03d, 0x1b4: 0x0008, 0x1b5: 0xe01d, - 0x1b6: 0x0008, 0x1b7: 0x01e5, 0x1b8: 0xe00d, 0x1b9: 0x0008, 0x1ba: 0x0008, 0x1bb: 0x0008, - 0x1bc: 0xe00d, 0x1bd: 0x0008, 0x1be: 0x0008, 0x1bf: 0x0008, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x0008, 0x1c1: 0x0008, 0x1c2: 0x0008, 0x1c3: 0x0008, 0x1c4: 0x01e9, 0x1c5: 0x01e9, - 0x1c6: 0x01e9, 0x1c7: 0x01fd, 0x1c8: 0x0215, 0x1c9: 0x022d, 0x1ca: 0x0245, 0x1cb: 0x025d, - 0x1cc: 0x0275, 0x1cd: 0xe01d, 0x1ce: 0x0008, 0x1cf: 0xe0fd, 0x1d0: 0x0008, 0x1d1: 0xe01d, - 0x1d2: 0x0008, 0x1d3: 0xe03d, 0x1d4: 0x0008, 0x1d5: 0xe01d, 0x1d6: 0x0008, 0x1d7: 0xe07d, - 0x1d8: 0x0008, 0x1d9: 0xe01d, 0x1da: 0x0008, 0x1db: 0xe03d, 0x1dc: 0x0008, 0x1dd: 0x0008, - 0x1de: 0xe00d, 0x1df: 0x0008, 0x1e0: 0xe00d, 0x1e1: 0x0008, 0x1e2: 0xe00d, 0x1e3: 0x0008, - 0x1e4: 0xe00d, 0x1e5: 0x0008, 0x1e6: 0xe00d, 0x1e7: 0x0008, 0x1e8: 0xe00d, 0x1e9: 0x0008, - 0x1ea: 0xe00d, 0x1eb: 0x0008, 0x1ec: 0xe00d, 0x1ed: 0x0008, 0x1ee: 0xe00d, 0x1ef: 0x0008, - 0x1f0: 0x0008, 0x1f1: 0x028d, 0x1f2: 0x02a5, 0x1f3: 0x02bd, 0x1f4: 0xe00d, 0x1f5: 0x0008, - 0x1f6: 0x02d5, 0x1f7: 0x02ed, 0x1f8: 0xe00d, 0x1f9: 0x0008, 0x1fa: 0xe00d, 0x1fb: 0x0008, - 0x1fc: 0xe00d, 0x1fd: 0x0008, 0x1fe: 0xe00d, 0x1ff: 0x0008, - // Block 0x8, offset 0x200 - 0x200: 0xe00d, 0x201: 0x0008, 0x202: 0xe00d, 0x203: 0x0008, 0x204: 0xe00d, 0x205: 0x0008, - 0x206: 0xe00d, 0x207: 0x0008, 0x208: 0xe00d, 0x209: 0x0008, 0x20a: 0xe00d, 0x20b: 0x0008, - 0x20c: 0xe00d, 0x20d: 0x0008, 0x20e: 0xe00d, 0x20f: 0x0008, 0x210: 0xe00d, 0x211: 0x0008, - 0x212: 0xe00d, 0x213: 0x0008, 0x214: 0xe00d, 0x215: 0x0008, 0x216: 0xe00d, 0x217: 0x0008, - 0x218: 0xe00d, 0x219: 0x0008, 0x21a: 0xe00d, 0x21b: 0x0008, 0x21c: 0xe00d, 0x21d: 0x0008, - 0x21e: 0xe00d, 0x21f: 0x0008, 0x220: 0x0305, 0x221: 0x0008, 0x222: 0xe00d, 0x223: 0x0008, - 0x224: 0xe00d, 0x225: 0x0008, 0x226: 0xe00d, 0x227: 0x0008, 0x228: 0xe00d, 0x229: 0x0008, - 0x22a: 0xe00d, 0x22b: 0x0008, 0x22c: 0xe00d, 0x22d: 0x0008, 0x22e: 0xe00d, 0x22f: 0x0008, - 0x230: 0xe00d, 0x231: 0x0008, 0x232: 0xe00d, 0x233: 0x0008, 0x234: 0x0008, 0x235: 0x0008, - 0x236: 0x0008, 0x237: 0x0008, 0x238: 0x0008, 0x239: 0x0008, 0x23a: 0x0209, 0x23b: 0xe03d, - 0x23c: 0x0008, 0x23d: 0x031d, 0x23e: 0x0229, 0x23f: 0x0008, - // Block 0x9, offset 0x240 - 0x240: 0x0008, 0x241: 0x0008, 0x242: 0x0018, 0x243: 0x0018, 0x244: 0x0018, 0x245: 0x0018, - 0x246: 0x0008, 0x247: 0x0008, 0x248: 0x0008, 0x249: 0x0008, 0x24a: 0x0008, 0x24b: 0x0008, - 0x24c: 0x0008, 0x24d: 0x0008, 0x24e: 0x0008, 0x24f: 0x0008, 0x250: 0x0008, 0x251: 0x0008, - 0x252: 0x0018, 0x253: 0x0018, 0x254: 0x0018, 0x255: 0x0018, 0x256: 0x0018, 0x257: 0x0018, - 0x258: 0x029a, 0x259: 0x02ba, 0x25a: 0x02da, 0x25b: 0x02fa, 0x25c: 0x031a, 0x25d: 0x033a, - 0x25e: 0x0018, 0x25f: 0x0018, 0x260: 0x03ad, 0x261: 0x0359, 0x262: 0x01d9, 0x263: 0x0369, - 0x264: 0x03c5, 0x265: 0x0018, 0x266: 0x0018, 0x267: 0x0018, 0x268: 0x0018, 0x269: 0x0018, - 0x26a: 0x0018, 0x26b: 0x0018, 0x26c: 0x0008, 0x26d: 0x0018, 0x26e: 0x0008, 0x26f: 0x0018, - 0x270: 0x0018, 0x271: 0x0018, 0x272: 0x0018, 0x273: 0x0018, 0x274: 0x0018, 0x275: 0x0018, - 0x276: 0x0018, 0x277: 0x0018, 0x278: 0x0018, 0x279: 0x0018, 0x27a: 0x0018, 0x27b: 0x0018, - 0x27c: 0x0018, 0x27d: 0x0018, 0x27e: 0x0018, 0x27f: 0x0018, - // Block 0xa, offset 0x280 - 0x280: 0x03dd, 0x281: 0x03dd, 0x282: 0x3308, 0x283: 0x03f5, 0x284: 0x0379, 0x285: 0x040d, - 0x286: 0x3308, 0x287: 0x3308, 0x288: 0x3308, 0x289: 0x3308, 0x28a: 0x3308, 0x28b: 0x3308, - 0x28c: 0x3308, 0x28d: 0x3308, 0x28e: 0x3308, 0x28f: 0x33c0, 0x290: 0x3308, 0x291: 0x3308, - 0x292: 0x3308, 0x293: 0x3308, 0x294: 0x3308, 0x295: 0x3308, 0x296: 0x3308, 0x297: 0x3308, - 0x298: 0x3308, 0x299: 0x3308, 0x29a: 0x3308, 0x29b: 0x3308, 0x29c: 0x3308, 0x29d: 0x3308, - 0x29e: 0x3308, 0x29f: 0x3308, 0x2a0: 0x3308, 0x2a1: 0x3308, 0x2a2: 0x3308, 0x2a3: 0x3308, - 0x2a4: 0x3308, 0x2a5: 0x3308, 0x2a6: 0x3308, 0x2a7: 0x3308, 0x2a8: 0x3308, 0x2a9: 0x3308, - 0x2aa: 0x3308, 0x2ab: 0x3308, 0x2ac: 0x3308, 0x2ad: 0x3308, 0x2ae: 0x3308, 0x2af: 0x3308, - 0x2b0: 0xe00d, 0x2b1: 0x0008, 0x2b2: 0xe00d, 0x2b3: 0x0008, 0x2b4: 0x0425, 0x2b5: 0x0008, - 0x2b6: 0xe00d, 0x2b7: 0x0008, 0x2b8: 0x0040, 0x2b9: 0x0040, 0x2ba: 0x03a2, 0x2bb: 0x0008, - 0x2bc: 0x0008, 0x2bd: 0x0008, 0x2be: 0x03c2, 0x2bf: 0x043d, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x0040, 0x2c1: 0x0040, 0x2c2: 0x0040, 0x2c3: 0x0040, 0x2c4: 0x008a, 0x2c5: 0x03d2, - 0x2c6: 0xe155, 0x2c7: 0x0455, 0x2c8: 0xe12d, 0x2c9: 0xe13d, 0x2ca: 0xe12d, 0x2cb: 0x0040, - 0x2cc: 0x03dd, 0x2cd: 0x0040, 0x2ce: 0x046d, 0x2cf: 0x0485, 0x2d0: 0x0008, 0x2d1: 0xe105, - 0x2d2: 0xe105, 0x2d3: 0xe105, 0x2d4: 0xe105, 0x2d5: 0xe105, 0x2d6: 0xe105, 0x2d7: 0xe105, - 0x2d8: 0xe105, 0x2d9: 0xe105, 0x2da: 0xe105, 0x2db: 0xe105, 0x2dc: 0xe105, 0x2dd: 0xe105, - 0x2de: 0xe105, 0x2df: 0xe105, 0x2e0: 0x049d, 0x2e1: 0x049d, 0x2e2: 0x0040, 0x2e3: 0x049d, - 0x2e4: 0x049d, 0x2e5: 0x049d, 0x2e6: 0x049d, 0x2e7: 0x049d, 0x2e8: 0x049d, 0x2e9: 0x049d, - 0x2ea: 0x049d, 0x2eb: 0x049d, 0x2ec: 0x0008, 0x2ed: 0x0008, 0x2ee: 0x0008, 0x2ef: 0x0008, - 0x2f0: 0x0008, 0x2f1: 0x0008, 0x2f2: 0x0008, 0x2f3: 0x0008, 0x2f4: 0x0008, 0x2f5: 0x0008, - 0x2f6: 0x0008, 0x2f7: 0x0008, 0x2f8: 0x0008, 0x2f9: 0x0008, 0x2fa: 0x0008, 0x2fb: 0x0008, - 0x2fc: 0x0008, 0x2fd: 0x0008, 0x2fe: 0x0008, 0x2ff: 0x0008, - // Block 0xc, offset 0x300 - 0x300: 0x0008, 0x301: 0x0008, 0x302: 0xe00f, 0x303: 0x0008, 0x304: 0x0008, 0x305: 0x0008, - 0x306: 0x0008, 0x307: 0x0008, 0x308: 0x0008, 0x309: 0x0008, 0x30a: 0x0008, 0x30b: 0x0008, - 0x30c: 0x0008, 0x30d: 0x0008, 0x30e: 0x0008, 0x30f: 0xe0c5, 0x310: 0x04b5, 0x311: 0x04cd, - 0x312: 0xe0bd, 0x313: 0xe0f5, 0x314: 0xe0fd, 0x315: 0xe09d, 0x316: 0xe0b5, 0x317: 0x0008, - 0x318: 0xe00d, 0x319: 0x0008, 0x31a: 0xe00d, 0x31b: 0x0008, 0x31c: 0xe00d, 0x31d: 0x0008, - 0x31e: 0xe00d, 0x31f: 0x0008, 0x320: 0xe00d, 0x321: 0x0008, 0x322: 0xe00d, 0x323: 0x0008, - 0x324: 0xe00d, 0x325: 0x0008, 0x326: 0xe00d, 0x327: 0x0008, 0x328: 0xe00d, 0x329: 0x0008, - 0x32a: 0xe00d, 0x32b: 0x0008, 0x32c: 0xe00d, 0x32d: 0x0008, 0x32e: 0xe00d, 0x32f: 0x0008, - 0x330: 0x04e5, 0x331: 0xe185, 0x332: 0xe18d, 0x333: 0x0008, 0x334: 0x04fd, 0x335: 0x03dd, - 0x336: 0x0018, 0x337: 0xe07d, 0x338: 0x0008, 0x339: 0xe1d5, 0x33a: 0xe00d, 0x33b: 0x0008, - 0x33c: 0x0008, 0x33d: 0x0515, 0x33e: 0x052d, 0x33f: 0x052d, - // Block 0xd, offset 0x340 - 0x340: 0x0008, 0x341: 0x0008, 0x342: 0x0008, 0x343: 0x0008, 0x344: 0x0008, 0x345: 0x0008, - 0x346: 0x0008, 0x347: 0x0008, 0x348: 0x0008, 0x349: 0x0008, 0x34a: 0x0008, 0x34b: 0x0008, - 0x34c: 0x0008, 0x34d: 0x0008, 0x34e: 0x0008, 0x34f: 0x0008, 0x350: 0x0008, 0x351: 0x0008, - 0x352: 0x0008, 0x353: 0x0008, 0x354: 0x0008, 0x355: 0x0008, 0x356: 0x0008, 0x357: 0x0008, - 0x358: 0x0008, 0x359: 0x0008, 0x35a: 0x0008, 0x35b: 0x0008, 0x35c: 0x0008, 0x35d: 0x0008, - 0x35e: 0x0008, 0x35f: 0x0008, 0x360: 0xe00d, 0x361: 0x0008, 0x362: 0xe00d, 0x363: 0x0008, - 0x364: 0xe00d, 0x365: 0x0008, 0x366: 0xe00d, 0x367: 0x0008, 0x368: 0xe00d, 0x369: 0x0008, - 0x36a: 0xe00d, 0x36b: 0x0008, 0x36c: 0xe00d, 0x36d: 0x0008, 0x36e: 0xe00d, 0x36f: 0x0008, - 0x370: 0xe00d, 0x371: 0x0008, 0x372: 0xe00d, 0x373: 0x0008, 0x374: 0xe00d, 0x375: 0x0008, - 0x376: 0xe00d, 0x377: 0x0008, 0x378: 0xe00d, 0x379: 0x0008, 0x37a: 0xe00d, 0x37b: 0x0008, - 0x37c: 0xe00d, 0x37d: 0x0008, 0x37e: 0xe00d, 0x37f: 0x0008, - // Block 0xe, offset 0x380 - 0x380: 0xe00d, 0x381: 0x0008, 0x382: 0x0018, 0x383: 0x3308, 0x384: 0x3308, 0x385: 0x3308, - 0x386: 0x3308, 0x387: 0x3308, 0x388: 0x3318, 0x389: 0x3318, 0x38a: 0xe00d, 0x38b: 0x0008, - 0x38c: 0xe00d, 0x38d: 0x0008, 0x38e: 0xe00d, 0x38f: 0x0008, 0x390: 0xe00d, 0x391: 0x0008, - 0x392: 0xe00d, 0x393: 0x0008, 0x394: 0xe00d, 0x395: 0x0008, 0x396: 0xe00d, 0x397: 0x0008, - 0x398: 0xe00d, 0x399: 0x0008, 0x39a: 0xe00d, 0x39b: 0x0008, 0x39c: 0xe00d, 0x39d: 0x0008, - 0x39e: 0xe00d, 0x39f: 0x0008, 0x3a0: 0xe00d, 0x3a1: 0x0008, 0x3a2: 0xe00d, 0x3a3: 0x0008, - 0x3a4: 0xe00d, 0x3a5: 0x0008, 0x3a6: 0xe00d, 0x3a7: 0x0008, 0x3a8: 0xe00d, 0x3a9: 0x0008, - 0x3aa: 0xe00d, 0x3ab: 0x0008, 0x3ac: 0xe00d, 0x3ad: 0x0008, 0x3ae: 0xe00d, 0x3af: 0x0008, - 0x3b0: 0xe00d, 0x3b1: 0x0008, 0x3b2: 0xe00d, 0x3b3: 0x0008, 0x3b4: 0xe00d, 0x3b5: 0x0008, - 0x3b6: 0xe00d, 0x3b7: 0x0008, 0x3b8: 0xe00d, 0x3b9: 0x0008, 0x3ba: 0xe00d, 0x3bb: 0x0008, - 0x3bc: 0xe00d, 0x3bd: 0x0008, 0x3be: 0xe00d, 0x3bf: 0x0008, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x0040, 0x3c1: 0xe01d, 0x3c2: 0x0008, 0x3c3: 0xe03d, 0x3c4: 0x0008, 0x3c5: 0xe01d, - 0x3c6: 0x0008, 0x3c7: 0xe07d, 0x3c8: 0x0008, 0x3c9: 0xe01d, 0x3ca: 0x0008, 0x3cb: 0xe03d, - 0x3cc: 0x0008, 0x3cd: 0xe01d, 0x3ce: 0x0008, 0x3cf: 0x0008, 0x3d0: 0xe00d, 0x3d1: 0x0008, - 0x3d2: 0xe00d, 0x3d3: 0x0008, 0x3d4: 0xe00d, 0x3d5: 0x0008, 0x3d6: 0xe00d, 0x3d7: 0x0008, - 0x3d8: 0xe00d, 0x3d9: 0x0008, 0x3da: 0xe00d, 0x3db: 0x0008, 0x3dc: 0xe00d, 0x3dd: 0x0008, - 0x3de: 0xe00d, 0x3df: 0x0008, 0x3e0: 0xe00d, 0x3e1: 0x0008, 0x3e2: 0xe00d, 0x3e3: 0x0008, - 0x3e4: 0xe00d, 0x3e5: 0x0008, 0x3e6: 0xe00d, 0x3e7: 0x0008, 0x3e8: 0xe00d, 0x3e9: 0x0008, - 0x3ea: 0xe00d, 0x3eb: 0x0008, 0x3ec: 0xe00d, 0x3ed: 0x0008, 0x3ee: 0xe00d, 0x3ef: 0x0008, - 0x3f0: 0xe00d, 0x3f1: 0x0008, 0x3f2: 0xe00d, 0x3f3: 0x0008, 0x3f4: 0xe00d, 0x3f5: 0x0008, - 0x3f6: 0xe00d, 0x3f7: 0x0008, 0x3f8: 0xe00d, 0x3f9: 0x0008, 0x3fa: 0xe00d, 0x3fb: 0x0008, - 0x3fc: 0xe00d, 0x3fd: 0x0008, 0x3fe: 0xe00d, 0x3ff: 0x0008, - // Block 0x10, offset 0x400 - 0x400: 0xe00d, 0x401: 0x0008, 0x402: 0xe00d, 0x403: 0x0008, 0x404: 0xe00d, 0x405: 0x0008, - 0x406: 0xe00d, 0x407: 0x0008, 0x408: 0xe00d, 0x409: 0x0008, 0x40a: 0xe00d, 0x40b: 0x0008, - 0x40c: 0xe00d, 0x40d: 0x0008, 0x40e: 0xe00d, 0x40f: 0x0008, 0x410: 0xe00d, 0x411: 0x0008, - 0x412: 0xe00d, 0x413: 0x0008, 0x414: 0xe00d, 0x415: 0x0008, 0x416: 0xe00d, 0x417: 0x0008, - 0x418: 0xe00d, 0x419: 0x0008, 0x41a: 0xe00d, 0x41b: 0x0008, 0x41c: 0xe00d, 0x41d: 0x0008, - 0x41e: 0xe00d, 0x41f: 0x0008, 0x420: 0xe00d, 0x421: 0x0008, 0x422: 0xe00d, 0x423: 0x0008, - 0x424: 0xe00d, 0x425: 0x0008, 0x426: 0xe00d, 0x427: 0x0008, 0x428: 0xe00d, 0x429: 0x0008, - 0x42a: 0xe00d, 0x42b: 0x0008, 0x42c: 0xe00d, 0x42d: 0x0008, 0x42e: 0xe00d, 0x42f: 0x0008, - 0x430: 0x0040, 0x431: 0x03f5, 0x432: 0x03f5, 0x433: 0x03f5, 0x434: 0x03f5, 0x435: 0x03f5, - 0x436: 0x03f5, 0x437: 0x03f5, 0x438: 0x03f5, 0x439: 0x03f5, 0x43a: 0x03f5, 0x43b: 0x03f5, - 0x43c: 0x03f5, 0x43d: 0x03f5, 0x43e: 0x03f5, 0x43f: 0x03f5, - // Block 0x11, offset 0x440 - 0x440: 0x0840, 0x441: 0x0840, 0x442: 0x0840, 0x443: 0x0840, 0x444: 0x0840, 0x445: 0x0840, - 0x446: 0x0018, 0x447: 0x0018, 0x448: 0x0818, 0x449: 0x0018, 0x44a: 0x0018, 0x44b: 0x0818, - 0x44c: 0x0018, 0x44d: 0x0818, 0x44e: 0x0018, 0x44f: 0x0018, 0x450: 0x3308, 0x451: 0x3308, - 0x452: 0x3308, 0x453: 0x3308, 0x454: 0x3308, 0x455: 0x3308, 0x456: 0x3308, 0x457: 0x3308, - 0x458: 0x3308, 0x459: 0x3308, 0x45a: 0x3308, 0x45b: 0x0818, 0x45c: 0x0b40, 0x45d: 0x0040, - 0x45e: 0x0818, 0x45f: 0x0818, 0x460: 0x0a08, 0x461: 0x0808, 0x462: 0x0c08, 0x463: 0x0c08, - 0x464: 0x0c08, 0x465: 0x0c08, 0x466: 0x0a08, 0x467: 0x0c08, 0x468: 0x0a08, 0x469: 0x0c08, - 0x46a: 0x0a08, 0x46b: 0x0a08, 0x46c: 0x0a08, 0x46d: 0x0a08, 0x46e: 0x0a08, 0x46f: 0x0c08, - 0x470: 0x0c08, 0x471: 0x0c08, 0x472: 0x0c08, 0x473: 0x0a08, 0x474: 0x0a08, 0x475: 0x0a08, - 0x476: 0x0a08, 0x477: 0x0a08, 0x478: 0x0a08, 0x479: 0x0a08, 0x47a: 0x0a08, 0x47b: 0x0a08, - 0x47c: 0x0a08, 0x47d: 0x0a08, 0x47e: 0x0a08, 0x47f: 0x0a08, - // Block 0x12, offset 0x480 - 0x480: 0x0818, 0x481: 0x0a08, 0x482: 0x0a08, 0x483: 0x0a08, 0x484: 0x0a08, 0x485: 0x0a08, - 0x486: 0x0a08, 0x487: 0x0a08, 0x488: 0x0c08, 0x489: 0x0a08, 0x48a: 0x0a08, 0x48b: 0x3308, - 0x48c: 0x3308, 0x48d: 0x3308, 0x48e: 0x3308, 0x48f: 0x3308, 0x490: 0x3308, 0x491: 0x3308, - 0x492: 0x3308, 0x493: 0x3308, 0x494: 0x3308, 0x495: 0x3308, 0x496: 0x3308, 0x497: 0x3308, - 0x498: 0x3308, 0x499: 0x3308, 0x49a: 0x3308, 0x49b: 0x3308, 0x49c: 0x3308, 0x49d: 0x3308, - 0x49e: 0x3308, 0x49f: 0x3308, 0x4a0: 0x0808, 0x4a1: 0x0808, 0x4a2: 0x0808, 0x4a3: 0x0808, - 0x4a4: 0x0808, 0x4a5: 0x0808, 0x4a6: 0x0808, 0x4a7: 0x0808, 0x4a8: 0x0808, 0x4a9: 0x0808, - 0x4aa: 0x0018, 0x4ab: 0x0818, 0x4ac: 0x0818, 0x4ad: 0x0818, 0x4ae: 0x0a08, 0x4af: 0x0a08, - 0x4b0: 0x3308, 0x4b1: 0x0c08, 0x4b2: 0x0c08, 0x4b3: 0x0c08, 0x4b4: 0x0808, 0x4b5: 0x0429, - 0x4b6: 0x0451, 0x4b7: 0x0479, 0x4b8: 0x04a1, 0x4b9: 0x0a08, 0x4ba: 0x0a08, 0x4bb: 0x0a08, - 0x4bc: 0x0a08, 0x4bd: 0x0a08, 0x4be: 0x0a08, 0x4bf: 0x0a08, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x0c08, 0x4c1: 0x0a08, 0x4c2: 0x0a08, 0x4c3: 0x0c08, 0x4c4: 0x0c08, 0x4c5: 0x0c08, - 0x4c6: 0x0c08, 0x4c7: 0x0c08, 0x4c8: 0x0c08, 0x4c9: 0x0c08, 0x4ca: 0x0c08, 0x4cb: 0x0c08, - 0x4cc: 0x0a08, 0x4cd: 0x0c08, 0x4ce: 0x0a08, 0x4cf: 0x0c08, 0x4d0: 0x0a08, 0x4d1: 0x0a08, - 0x4d2: 0x0c08, 0x4d3: 0x0c08, 0x4d4: 0x0818, 0x4d5: 0x0c08, 0x4d6: 0x3308, 0x4d7: 0x3308, - 0x4d8: 0x3308, 0x4d9: 0x3308, 0x4da: 0x3308, 0x4db: 0x3308, 0x4dc: 0x3308, 0x4dd: 0x0840, - 0x4de: 0x0018, 0x4df: 0x3308, 0x4e0: 0x3308, 0x4e1: 0x3308, 0x4e2: 0x3308, 0x4e3: 0x3308, - 0x4e4: 0x3308, 0x4e5: 0x0808, 0x4e6: 0x0808, 0x4e7: 0x3308, 0x4e8: 0x3308, 0x4e9: 0x0018, - 0x4ea: 0x3308, 0x4eb: 0x3308, 0x4ec: 0x3308, 0x4ed: 0x3308, 0x4ee: 0x0c08, 0x4ef: 0x0c08, - 0x4f0: 0x0008, 0x4f1: 0x0008, 0x4f2: 0x0008, 0x4f3: 0x0008, 0x4f4: 0x0008, 0x4f5: 0x0008, - 0x4f6: 0x0008, 0x4f7: 0x0008, 0x4f8: 0x0008, 0x4f9: 0x0008, 0x4fa: 0x0a08, 0x4fb: 0x0a08, - 0x4fc: 0x0a08, 0x4fd: 0x0808, 0x4fe: 0x0808, 0x4ff: 0x0a08, - // Block 0x14, offset 0x500 - 0x500: 0x0818, 0x501: 0x0818, 0x502: 0x0818, 0x503: 0x0818, 0x504: 0x0818, 0x505: 0x0818, - 0x506: 0x0818, 0x507: 0x0818, 0x508: 0x0818, 0x509: 0x0818, 0x50a: 0x0818, 0x50b: 0x0818, - 0x50c: 0x0818, 0x50d: 0x0818, 0x50e: 0x0040, 0x50f: 0x0b40, 0x510: 0x0c08, 0x511: 0x3308, - 0x512: 0x0a08, 0x513: 0x0a08, 0x514: 0x0a08, 0x515: 0x0c08, 0x516: 0x0c08, 0x517: 0x0c08, - 0x518: 0x0c08, 0x519: 0x0c08, 0x51a: 0x0a08, 0x51b: 0x0a08, 0x51c: 0x0a08, 0x51d: 0x0a08, - 0x51e: 0x0c08, 0x51f: 0x0a08, 0x520: 0x0a08, 0x521: 0x0a08, 0x522: 0x0a08, 0x523: 0x0a08, - 0x524: 0x0a08, 0x525: 0x0a08, 0x526: 0x0a08, 0x527: 0x0a08, 0x528: 0x0c08, 0x529: 0x0a08, - 0x52a: 0x0c08, 0x52b: 0x0a08, 0x52c: 0x0c08, 0x52d: 0x0a08, 0x52e: 0x0a08, 0x52f: 0x0c08, - 0x530: 0x3308, 0x531: 0x3308, 0x532: 0x3308, 0x533: 0x3308, 0x534: 0x3308, 0x535: 0x3308, - 0x536: 0x3308, 0x537: 0x3308, 0x538: 0x3308, 0x539: 0x3308, 0x53a: 0x3308, 0x53b: 0x3308, - 0x53c: 0x3308, 0x53d: 0x3308, 0x53e: 0x3308, 0x53f: 0x3308, - // Block 0x15, offset 0x540 - 0x540: 0x0c08, 0x541: 0x0a08, 0x542: 0x0a08, 0x543: 0x0a08, 0x544: 0x0a08, 0x545: 0x0a08, - 0x546: 0x0c08, 0x547: 0x0c08, 0x548: 0x0a08, 0x549: 0x0c08, 0x54a: 0x0a08, 0x54b: 0x0a08, - 0x54c: 0x0a08, 0x54d: 0x0a08, 0x54e: 0x0a08, 0x54f: 0x0a08, 0x550: 0x0a08, 0x551: 0x0a08, - 0x552: 0x0a08, 0x553: 0x0a08, 0x554: 0x0c08, 0x555: 0x0a08, 0x556: 0x0808, 0x557: 0x0808, - 0x558: 0x0808, 0x559: 0x3308, 0x55a: 0x3308, 0x55b: 0x3308, 0x55c: 0x0040, 0x55d: 0x0040, - 0x55e: 0x0818, 0x55f: 0x0040, 0x560: 0x0a08, 0x561: 0x0808, 0x562: 0x0a08, 0x563: 0x0a08, - 0x564: 0x0a08, 0x565: 0x0a08, 0x566: 0x0808, 0x567: 0x0c08, 0x568: 0x0a08, 0x569: 0x0c08, - 0x56a: 0x0c08, 0x56b: 0x0040, 0x56c: 0x0040, 0x56d: 0x0040, 0x56e: 0x0040, 0x56f: 0x0040, - 0x570: 0x0040, 0x571: 0x0040, 0x572: 0x0040, 0x573: 0x0040, 0x574: 0x0040, 0x575: 0x0040, - 0x576: 0x0040, 0x577: 0x0040, 0x578: 0x0040, 0x579: 0x0040, 0x57a: 0x0040, 0x57b: 0x0040, - 0x57c: 0x0040, 0x57d: 0x0040, 0x57e: 0x0040, 0x57f: 0x0040, - // Block 0x16, offset 0x580 - 0x580: 0x3008, 0x581: 0x3308, 0x582: 0x3308, 0x583: 0x3308, 0x584: 0x3308, 0x585: 0x3308, - 0x586: 0x3308, 0x587: 0x3308, 0x588: 0x3308, 0x589: 0x3008, 0x58a: 0x3008, 0x58b: 0x3008, - 0x58c: 0x3008, 0x58d: 0x3b08, 0x58e: 0x3008, 0x58f: 0x3008, 0x590: 0x0008, 0x591: 0x3308, - 0x592: 0x3308, 0x593: 0x3308, 0x594: 0x3308, 0x595: 0x3308, 0x596: 0x3308, 0x597: 0x3308, - 0x598: 0x04c9, 0x599: 0x0501, 0x59a: 0x0539, 0x59b: 0x0571, 0x59c: 0x05a9, 0x59d: 0x05e1, - 0x59e: 0x0619, 0x59f: 0x0651, 0x5a0: 0x0008, 0x5a1: 0x0008, 0x5a2: 0x3308, 0x5a3: 0x3308, - 0x5a4: 0x0018, 0x5a5: 0x0018, 0x5a6: 0x0008, 0x5a7: 0x0008, 0x5a8: 0x0008, 0x5a9: 0x0008, - 0x5aa: 0x0008, 0x5ab: 0x0008, 0x5ac: 0x0008, 0x5ad: 0x0008, 0x5ae: 0x0008, 0x5af: 0x0008, - 0x5b0: 0x0018, 0x5b1: 0x0008, 0x5b2: 0x0008, 0x5b3: 0x0008, 0x5b4: 0x0008, 0x5b5: 0x0008, - 0x5b6: 0x0008, 0x5b7: 0x0008, 0x5b8: 0x0008, 0x5b9: 0x0008, 0x5ba: 0x0008, 0x5bb: 0x0008, - 0x5bc: 0x0008, 0x5bd: 0x0008, 0x5be: 0x0008, 0x5bf: 0x0008, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x0008, 0x5c1: 0x3308, 0x5c2: 0x3008, 0x5c3: 0x3008, 0x5c4: 0x0040, 0x5c5: 0x0008, - 0x5c6: 0x0008, 0x5c7: 0x0008, 0x5c8: 0x0008, 0x5c9: 0x0008, 0x5ca: 0x0008, 0x5cb: 0x0008, - 0x5cc: 0x0008, 0x5cd: 0x0040, 0x5ce: 0x0040, 0x5cf: 0x0008, 0x5d0: 0x0008, 0x5d1: 0x0040, - 0x5d2: 0x0040, 0x5d3: 0x0008, 0x5d4: 0x0008, 0x5d5: 0x0008, 0x5d6: 0x0008, 0x5d7: 0x0008, - 0x5d8: 0x0008, 0x5d9: 0x0008, 0x5da: 0x0008, 0x5db: 0x0008, 0x5dc: 0x0008, 0x5dd: 0x0008, - 0x5de: 0x0008, 0x5df: 0x0008, 0x5e0: 0x0008, 0x5e1: 0x0008, 0x5e2: 0x0008, 0x5e3: 0x0008, - 0x5e4: 0x0008, 0x5e5: 0x0008, 0x5e6: 0x0008, 0x5e7: 0x0008, 0x5e8: 0x0008, 0x5e9: 0x0040, - 0x5ea: 0x0008, 0x5eb: 0x0008, 0x5ec: 0x0008, 0x5ed: 0x0008, 0x5ee: 0x0008, 0x5ef: 0x0008, - 0x5f0: 0x0008, 0x5f1: 0x0040, 0x5f2: 0x0008, 0x5f3: 0x0040, 0x5f4: 0x0040, 0x5f5: 0x0040, - 0x5f6: 0x0008, 0x5f7: 0x0008, 0x5f8: 0x0008, 0x5f9: 0x0008, 0x5fa: 0x0040, 0x5fb: 0x0040, - 0x5fc: 0x3308, 0x5fd: 0x0008, 0x5fe: 0x3008, 0x5ff: 0x3008, - // Block 0x18, offset 0x600 - 0x600: 0x3008, 0x601: 0x3308, 0x602: 0x3308, 0x603: 0x3308, 0x604: 0x3308, 0x605: 0x0040, - 0x606: 0x0040, 0x607: 0x3008, 0x608: 0x3008, 0x609: 0x0040, 0x60a: 0x0040, 0x60b: 0x3008, - 0x60c: 0x3008, 0x60d: 0x3b08, 0x60e: 0x0008, 0x60f: 0x0040, 0x610: 0x0040, 0x611: 0x0040, - 0x612: 0x0040, 0x613: 0x0040, 0x614: 0x0040, 0x615: 0x0040, 0x616: 0x0040, 0x617: 0x3008, - 0x618: 0x0040, 0x619: 0x0040, 0x61a: 0x0040, 0x61b: 0x0040, 0x61c: 0x0689, 0x61d: 0x06c1, - 0x61e: 0x0040, 0x61f: 0x06f9, 0x620: 0x0008, 0x621: 0x0008, 0x622: 0x3308, 0x623: 0x3308, - 0x624: 0x0040, 0x625: 0x0040, 0x626: 0x0008, 0x627: 0x0008, 0x628: 0x0008, 0x629: 0x0008, - 0x62a: 0x0008, 0x62b: 0x0008, 0x62c: 0x0008, 0x62d: 0x0008, 0x62e: 0x0008, 0x62f: 0x0008, - 0x630: 0x0008, 0x631: 0x0008, 0x632: 0x0018, 0x633: 0x0018, 0x634: 0x0018, 0x635: 0x0018, - 0x636: 0x0018, 0x637: 0x0018, 0x638: 0x0018, 0x639: 0x0018, 0x63a: 0x0018, 0x63b: 0x0018, - 0x63c: 0x0008, 0x63d: 0x0018, 0x63e: 0x3308, 0x63f: 0x0040, - // Block 0x19, offset 0x640 - 0x640: 0x0040, 0x641: 0x3308, 0x642: 0x3308, 0x643: 0x3008, 0x644: 0x0040, 0x645: 0x0008, - 0x646: 0x0008, 0x647: 0x0008, 0x648: 0x0008, 0x649: 0x0008, 0x64a: 0x0008, 0x64b: 0x0040, - 0x64c: 0x0040, 0x64d: 0x0040, 0x64e: 0x0040, 0x64f: 0x0008, 0x650: 0x0008, 0x651: 0x0040, - 0x652: 0x0040, 0x653: 0x0008, 0x654: 0x0008, 0x655: 0x0008, 0x656: 0x0008, 0x657: 0x0008, - 0x658: 0x0008, 0x659: 0x0008, 0x65a: 0x0008, 0x65b: 0x0008, 0x65c: 0x0008, 0x65d: 0x0008, - 0x65e: 0x0008, 0x65f: 0x0008, 0x660: 0x0008, 0x661: 0x0008, 0x662: 0x0008, 0x663: 0x0008, - 0x664: 0x0008, 0x665: 0x0008, 0x666: 0x0008, 0x667: 0x0008, 0x668: 0x0008, 0x669: 0x0040, - 0x66a: 0x0008, 0x66b: 0x0008, 0x66c: 0x0008, 0x66d: 0x0008, 0x66e: 0x0008, 0x66f: 0x0008, - 0x670: 0x0008, 0x671: 0x0040, 0x672: 0x0008, 0x673: 0x0731, 0x674: 0x0040, 0x675: 0x0008, - 0x676: 0x0769, 0x677: 0x0040, 0x678: 0x0008, 0x679: 0x0008, 0x67a: 0x0040, 0x67b: 0x0040, - 0x67c: 0x3308, 0x67d: 0x0040, 0x67e: 0x3008, 0x67f: 0x3008, - // Block 0x1a, offset 0x680 - 0x680: 0x3008, 0x681: 0x3308, 0x682: 0x3308, 0x683: 0x0040, 0x684: 0x0040, 0x685: 0x0040, - 0x686: 0x0040, 0x687: 0x3308, 0x688: 0x3308, 0x689: 0x0040, 0x68a: 0x0040, 0x68b: 0x3308, - 0x68c: 0x3308, 0x68d: 0x3b08, 0x68e: 0x0040, 0x68f: 0x0040, 0x690: 0x0040, 0x691: 0x3308, - 0x692: 0x0040, 0x693: 0x0040, 0x694: 0x0040, 0x695: 0x0040, 0x696: 0x0040, 0x697: 0x0040, - 0x698: 0x0040, 0x699: 0x07a1, 0x69a: 0x07d9, 0x69b: 0x0811, 0x69c: 0x0008, 0x69d: 0x0040, - 0x69e: 0x0849, 0x69f: 0x0040, 0x6a0: 0x0040, 0x6a1: 0x0040, 0x6a2: 0x0040, 0x6a3: 0x0040, - 0x6a4: 0x0040, 0x6a5: 0x0040, 0x6a6: 0x0008, 0x6a7: 0x0008, 0x6a8: 0x0008, 0x6a9: 0x0008, - 0x6aa: 0x0008, 0x6ab: 0x0008, 0x6ac: 0x0008, 0x6ad: 0x0008, 0x6ae: 0x0008, 0x6af: 0x0008, - 0x6b0: 0x3308, 0x6b1: 0x3308, 0x6b2: 0x0008, 0x6b3: 0x0008, 0x6b4: 0x0008, 0x6b5: 0x3308, - 0x6b6: 0x0018, 0x6b7: 0x0040, 0x6b8: 0x0040, 0x6b9: 0x0040, 0x6ba: 0x0040, 0x6bb: 0x0040, - 0x6bc: 0x0040, 0x6bd: 0x0040, 0x6be: 0x0040, 0x6bf: 0x0040, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x0040, 0x6c1: 0x3308, 0x6c2: 0x3308, 0x6c3: 0x3008, 0x6c4: 0x0040, 0x6c5: 0x0008, - 0x6c6: 0x0008, 0x6c7: 0x0008, 0x6c8: 0x0008, 0x6c9: 0x0008, 0x6ca: 0x0008, 0x6cb: 0x0008, - 0x6cc: 0x0008, 0x6cd: 0x0008, 0x6ce: 0x0040, 0x6cf: 0x0008, 0x6d0: 0x0008, 0x6d1: 0x0008, - 0x6d2: 0x0040, 0x6d3: 0x0008, 0x6d4: 0x0008, 0x6d5: 0x0008, 0x6d6: 0x0008, 0x6d7: 0x0008, - 0x6d8: 0x0008, 0x6d9: 0x0008, 0x6da: 0x0008, 0x6db: 0x0008, 0x6dc: 0x0008, 0x6dd: 0x0008, - 0x6de: 0x0008, 0x6df: 0x0008, 0x6e0: 0x0008, 0x6e1: 0x0008, 0x6e2: 0x0008, 0x6e3: 0x0008, - 0x6e4: 0x0008, 0x6e5: 0x0008, 0x6e6: 0x0008, 0x6e7: 0x0008, 0x6e8: 0x0008, 0x6e9: 0x0040, - 0x6ea: 0x0008, 0x6eb: 0x0008, 0x6ec: 0x0008, 0x6ed: 0x0008, 0x6ee: 0x0008, 0x6ef: 0x0008, - 0x6f0: 0x0008, 0x6f1: 0x0040, 0x6f2: 0x0008, 0x6f3: 0x0008, 0x6f4: 0x0040, 0x6f5: 0x0008, - 0x6f6: 0x0008, 0x6f7: 0x0008, 0x6f8: 0x0008, 0x6f9: 0x0008, 0x6fa: 0x0040, 0x6fb: 0x0040, - 0x6fc: 0x3308, 0x6fd: 0x0008, 0x6fe: 0x3008, 0x6ff: 0x3008, - // Block 0x1c, offset 0x700 - 0x700: 0x3008, 0x701: 0x3308, 0x702: 0x3308, 0x703: 0x3308, 0x704: 0x3308, 0x705: 0x3308, - 0x706: 0x0040, 0x707: 0x3308, 0x708: 0x3308, 0x709: 0x3008, 0x70a: 0x0040, 0x70b: 0x3008, - 0x70c: 0x3008, 0x70d: 0x3b08, 0x70e: 0x0040, 0x70f: 0x0040, 0x710: 0x0008, 0x711: 0x0040, - 0x712: 0x0040, 0x713: 0x0040, 0x714: 0x0040, 0x715: 0x0040, 0x716: 0x0040, 0x717: 0x0040, - 0x718: 0x0040, 0x719: 0x0040, 0x71a: 0x0040, 0x71b: 0x0040, 0x71c: 0x0040, 0x71d: 0x0040, - 0x71e: 0x0040, 0x71f: 0x0040, 0x720: 0x0008, 0x721: 0x0008, 0x722: 0x3308, 0x723: 0x3308, - 0x724: 0x0040, 0x725: 0x0040, 0x726: 0x0008, 0x727: 0x0008, 0x728: 0x0008, 0x729: 0x0008, - 0x72a: 0x0008, 0x72b: 0x0008, 0x72c: 0x0008, 0x72d: 0x0008, 0x72e: 0x0008, 0x72f: 0x0008, - 0x730: 0x0018, 0x731: 0x0018, 0x732: 0x0040, 0x733: 0x0040, 0x734: 0x0040, 0x735: 0x0040, - 0x736: 0x0040, 0x737: 0x0040, 0x738: 0x0040, 0x739: 0x0008, 0x73a: 0x3308, 0x73b: 0x3308, - 0x73c: 0x3308, 0x73d: 0x3308, 0x73e: 0x3308, 0x73f: 0x3308, - // Block 0x1d, offset 0x740 - 0x740: 0x0040, 0x741: 0x3308, 0x742: 0x3008, 0x743: 0x3008, 0x744: 0x0040, 0x745: 0x0008, - 0x746: 0x0008, 0x747: 0x0008, 0x748: 0x0008, 0x749: 0x0008, 0x74a: 0x0008, 0x74b: 0x0008, - 0x74c: 0x0008, 0x74d: 0x0040, 0x74e: 0x0040, 0x74f: 0x0008, 0x750: 0x0008, 0x751: 0x0040, - 0x752: 0x0040, 0x753: 0x0008, 0x754: 0x0008, 0x755: 0x0008, 0x756: 0x0008, 0x757: 0x0008, - 0x758: 0x0008, 0x759: 0x0008, 0x75a: 0x0008, 0x75b: 0x0008, 0x75c: 0x0008, 0x75d: 0x0008, - 0x75e: 0x0008, 0x75f: 0x0008, 0x760: 0x0008, 0x761: 0x0008, 0x762: 0x0008, 0x763: 0x0008, - 0x764: 0x0008, 0x765: 0x0008, 0x766: 0x0008, 0x767: 0x0008, 0x768: 0x0008, 0x769: 0x0040, - 0x76a: 0x0008, 0x76b: 0x0008, 0x76c: 0x0008, 0x76d: 0x0008, 0x76e: 0x0008, 0x76f: 0x0008, - 0x770: 0x0008, 0x771: 0x0040, 0x772: 0x0008, 0x773: 0x0008, 0x774: 0x0040, 0x775: 0x0008, - 0x776: 0x0008, 0x777: 0x0008, 0x778: 0x0008, 0x779: 0x0008, 0x77a: 0x0040, 0x77b: 0x0040, - 0x77c: 0x3308, 0x77d: 0x0008, 0x77e: 0x3008, 0x77f: 0x3308, - // Block 0x1e, offset 0x780 - 0x780: 0x3008, 0x781: 0x3308, 0x782: 0x3308, 0x783: 0x3308, 0x784: 0x3308, 0x785: 0x0040, - 0x786: 0x0040, 0x787: 0x3008, 0x788: 0x3008, 0x789: 0x0040, 0x78a: 0x0040, 0x78b: 0x3008, - 0x78c: 0x3008, 0x78d: 0x3b08, 0x78e: 0x0040, 0x78f: 0x0040, 0x790: 0x0040, 0x791: 0x0040, - 0x792: 0x0040, 0x793: 0x0040, 0x794: 0x0040, 0x795: 0x0040, 0x796: 0x3308, 0x797: 0x3008, - 0x798: 0x0040, 0x799: 0x0040, 0x79a: 0x0040, 0x79b: 0x0040, 0x79c: 0x0881, 0x79d: 0x08b9, - 0x79e: 0x0040, 0x79f: 0x0008, 0x7a0: 0x0008, 0x7a1: 0x0008, 0x7a2: 0x3308, 0x7a3: 0x3308, - 0x7a4: 0x0040, 0x7a5: 0x0040, 0x7a6: 0x0008, 0x7a7: 0x0008, 0x7a8: 0x0008, 0x7a9: 0x0008, - 0x7aa: 0x0008, 0x7ab: 0x0008, 0x7ac: 0x0008, 0x7ad: 0x0008, 0x7ae: 0x0008, 0x7af: 0x0008, - 0x7b0: 0x0018, 0x7b1: 0x0008, 0x7b2: 0x0018, 0x7b3: 0x0018, 0x7b4: 0x0018, 0x7b5: 0x0018, - 0x7b6: 0x0018, 0x7b7: 0x0018, 0x7b8: 0x0040, 0x7b9: 0x0040, 0x7ba: 0x0040, 0x7bb: 0x0040, - 0x7bc: 0x0040, 0x7bd: 0x0040, 0x7be: 0x0040, 0x7bf: 0x0040, - // Block 0x1f, offset 0x7c0 - 0x7c0: 0x0040, 0x7c1: 0x0040, 0x7c2: 0x3308, 0x7c3: 0x0008, 0x7c4: 0x0040, 0x7c5: 0x0008, - 0x7c6: 0x0008, 0x7c7: 0x0008, 0x7c8: 0x0008, 0x7c9: 0x0008, 0x7ca: 0x0008, 0x7cb: 0x0040, - 0x7cc: 0x0040, 0x7cd: 0x0040, 0x7ce: 0x0008, 0x7cf: 0x0008, 0x7d0: 0x0008, 0x7d1: 0x0040, - 0x7d2: 0x0008, 0x7d3: 0x0008, 0x7d4: 0x0008, 0x7d5: 0x0008, 0x7d6: 0x0040, 0x7d7: 0x0040, - 0x7d8: 0x0040, 0x7d9: 0x0008, 0x7da: 0x0008, 0x7db: 0x0040, 0x7dc: 0x0008, 0x7dd: 0x0040, - 0x7de: 0x0008, 0x7df: 0x0008, 0x7e0: 0x0040, 0x7e1: 0x0040, 0x7e2: 0x0040, 0x7e3: 0x0008, - 0x7e4: 0x0008, 0x7e5: 0x0040, 0x7e6: 0x0040, 0x7e7: 0x0040, 0x7e8: 0x0008, 0x7e9: 0x0008, - 0x7ea: 0x0008, 0x7eb: 0x0040, 0x7ec: 0x0040, 0x7ed: 0x0040, 0x7ee: 0x0008, 0x7ef: 0x0008, - 0x7f0: 0x0008, 0x7f1: 0x0008, 0x7f2: 0x0008, 0x7f3: 0x0008, 0x7f4: 0x0008, 0x7f5: 0x0008, - 0x7f6: 0x0008, 0x7f7: 0x0008, 0x7f8: 0x0008, 0x7f9: 0x0008, 0x7fa: 0x0040, 0x7fb: 0x0040, - 0x7fc: 0x0040, 0x7fd: 0x0040, 0x7fe: 0x3008, 0x7ff: 0x3008, - // Block 0x20, offset 0x800 - 0x800: 0x3308, 0x801: 0x3008, 0x802: 0x3008, 0x803: 0x3008, 0x804: 0x3008, 0x805: 0x0040, - 0x806: 0x3308, 0x807: 0x3308, 0x808: 0x3308, 0x809: 0x0040, 0x80a: 0x3308, 0x80b: 0x3308, - 0x80c: 0x3308, 0x80d: 0x3b08, 0x80e: 0x0040, 0x80f: 0x0040, 0x810: 0x0040, 0x811: 0x0040, - 0x812: 0x0040, 0x813: 0x0040, 0x814: 0x0040, 0x815: 0x3308, 0x816: 0x3308, 0x817: 0x0040, - 0x818: 0x0008, 0x819: 0x0008, 0x81a: 0x0008, 0x81b: 0x0040, 0x81c: 0x0040, 0x81d: 0x0040, - 0x81e: 0x0040, 0x81f: 0x0040, 0x820: 0x0008, 0x821: 0x0008, 0x822: 0x3308, 0x823: 0x3308, - 0x824: 0x0040, 0x825: 0x0040, 0x826: 0x0008, 0x827: 0x0008, 0x828: 0x0008, 0x829: 0x0008, - 0x82a: 0x0008, 0x82b: 0x0008, 0x82c: 0x0008, 0x82d: 0x0008, 0x82e: 0x0008, 0x82f: 0x0008, - 0x830: 0x0040, 0x831: 0x0040, 0x832: 0x0040, 0x833: 0x0040, 0x834: 0x0040, 0x835: 0x0040, - 0x836: 0x0040, 0x837: 0x0040, 0x838: 0x0018, 0x839: 0x0018, 0x83a: 0x0018, 0x83b: 0x0018, - 0x83c: 0x0018, 0x83d: 0x0018, 0x83e: 0x0018, 0x83f: 0x0018, - // Block 0x21, offset 0x840 - 0x840: 0x0008, 0x841: 0x3308, 0x842: 0x3008, 0x843: 0x3008, 0x844: 0x0018, 0x845: 0x0008, - 0x846: 0x0008, 0x847: 0x0008, 0x848: 0x0008, 0x849: 0x0008, 0x84a: 0x0008, 0x84b: 0x0008, - 0x84c: 0x0008, 0x84d: 0x0040, 0x84e: 0x0008, 0x84f: 0x0008, 0x850: 0x0008, 0x851: 0x0040, - 0x852: 0x0008, 0x853: 0x0008, 0x854: 0x0008, 0x855: 0x0008, 0x856: 0x0008, 0x857: 0x0008, - 0x858: 0x0008, 0x859: 0x0008, 0x85a: 0x0008, 0x85b: 0x0008, 0x85c: 0x0008, 0x85d: 0x0008, - 0x85e: 0x0008, 0x85f: 0x0008, 0x860: 0x0008, 0x861: 0x0008, 0x862: 0x0008, 0x863: 0x0008, - 0x864: 0x0008, 0x865: 0x0008, 0x866: 0x0008, 0x867: 0x0008, 0x868: 0x0008, 0x869: 0x0040, - 0x86a: 0x0008, 0x86b: 0x0008, 0x86c: 0x0008, 0x86d: 0x0008, 0x86e: 0x0008, 0x86f: 0x0008, - 0x870: 0x0008, 0x871: 0x0008, 0x872: 0x0008, 0x873: 0x0008, 0x874: 0x0040, 0x875: 0x0008, - 0x876: 0x0008, 0x877: 0x0008, 0x878: 0x0008, 0x879: 0x0008, 0x87a: 0x0040, 0x87b: 0x0040, - 0x87c: 0x3308, 0x87d: 0x0008, 0x87e: 0x3008, 0x87f: 0x3308, - // Block 0x22, offset 0x880 - 0x880: 0x3008, 0x881: 0x3008, 0x882: 0x3008, 0x883: 0x3008, 0x884: 0x3008, 0x885: 0x0040, - 0x886: 0x3308, 0x887: 0x3008, 0x888: 0x3008, 0x889: 0x0040, 0x88a: 0x3008, 0x88b: 0x3008, - 0x88c: 0x3308, 0x88d: 0x3b08, 0x88e: 0x0040, 0x88f: 0x0040, 0x890: 0x0040, 0x891: 0x0040, - 0x892: 0x0040, 0x893: 0x0040, 0x894: 0x0040, 0x895: 0x3008, 0x896: 0x3008, 0x897: 0x0040, - 0x898: 0x0040, 0x899: 0x0040, 0x89a: 0x0040, 0x89b: 0x0040, 0x89c: 0x0040, 0x89d: 0x0040, - 0x89e: 0x0008, 0x89f: 0x0040, 0x8a0: 0x0008, 0x8a1: 0x0008, 0x8a2: 0x3308, 0x8a3: 0x3308, - 0x8a4: 0x0040, 0x8a5: 0x0040, 0x8a6: 0x0008, 0x8a7: 0x0008, 0x8a8: 0x0008, 0x8a9: 0x0008, - 0x8aa: 0x0008, 0x8ab: 0x0008, 0x8ac: 0x0008, 0x8ad: 0x0008, 0x8ae: 0x0008, 0x8af: 0x0008, - 0x8b0: 0x0040, 0x8b1: 0x0008, 0x8b2: 0x0008, 0x8b3: 0x0040, 0x8b4: 0x0040, 0x8b5: 0x0040, - 0x8b6: 0x0040, 0x8b7: 0x0040, 0x8b8: 0x0040, 0x8b9: 0x0040, 0x8ba: 0x0040, 0x8bb: 0x0040, - 0x8bc: 0x0040, 0x8bd: 0x0040, 0x8be: 0x0040, 0x8bf: 0x0040, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x3008, 0x8c1: 0x3308, 0x8c2: 0x3308, 0x8c3: 0x3308, 0x8c4: 0x3308, 0x8c5: 0x0040, - 0x8c6: 0x3008, 0x8c7: 0x3008, 0x8c8: 0x3008, 0x8c9: 0x0040, 0x8ca: 0x3008, 0x8cb: 0x3008, - 0x8cc: 0x3008, 0x8cd: 0x3b08, 0x8ce: 0x0008, 0x8cf: 0x0018, 0x8d0: 0x0040, 0x8d1: 0x0040, - 0x8d2: 0x0040, 0x8d3: 0x0040, 0x8d4: 0x0008, 0x8d5: 0x0008, 0x8d6: 0x0008, 0x8d7: 0x3008, - 0x8d8: 0x0018, 0x8d9: 0x0018, 0x8da: 0x0018, 0x8db: 0x0018, 0x8dc: 0x0018, 0x8dd: 0x0018, - 0x8de: 0x0018, 0x8df: 0x0008, 0x8e0: 0x0008, 0x8e1: 0x0008, 0x8e2: 0x3308, 0x8e3: 0x3308, - 0x8e4: 0x0040, 0x8e5: 0x0040, 0x8e6: 0x0008, 0x8e7: 0x0008, 0x8e8: 0x0008, 0x8e9: 0x0008, - 0x8ea: 0x0008, 0x8eb: 0x0008, 0x8ec: 0x0008, 0x8ed: 0x0008, 0x8ee: 0x0008, 0x8ef: 0x0008, - 0x8f0: 0x0018, 0x8f1: 0x0018, 0x8f2: 0x0018, 0x8f3: 0x0018, 0x8f4: 0x0018, 0x8f5: 0x0018, - 0x8f6: 0x0018, 0x8f7: 0x0018, 0x8f8: 0x0018, 0x8f9: 0x0018, 0x8fa: 0x0008, 0x8fb: 0x0008, - 0x8fc: 0x0008, 0x8fd: 0x0008, 0x8fe: 0x0008, 0x8ff: 0x0008, - // Block 0x24, offset 0x900 - 0x900: 0x0040, 0x901: 0x0008, 0x902: 0x0008, 0x903: 0x0040, 0x904: 0x0008, 0x905: 0x0040, - 0x906: 0x0040, 0x907: 0x0008, 0x908: 0x0008, 0x909: 0x0040, 0x90a: 0x0008, 0x90b: 0x0040, - 0x90c: 0x0040, 0x90d: 0x0008, 0x90e: 0x0040, 0x90f: 0x0040, 0x910: 0x0040, 0x911: 0x0040, - 0x912: 0x0040, 0x913: 0x0040, 0x914: 0x0008, 0x915: 0x0008, 0x916: 0x0008, 0x917: 0x0008, - 0x918: 0x0040, 0x919: 0x0008, 0x91a: 0x0008, 0x91b: 0x0008, 0x91c: 0x0008, 0x91d: 0x0008, - 0x91e: 0x0008, 0x91f: 0x0008, 0x920: 0x0040, 0x921: 0x0008, 0x922: 0x0008, 0x923: 0x0008, - 0x924: 0x0040, 0x925: 0x0008, 0x926: 0x0040, 0x927: 0x0008, 0x928: 0x0040, 0x929: 0x0040, - 0x92a: 0x0008, 0x92b: 0x0008, 0x92c: 0x0040, 0x92d: 0x0008, 0x92e: 0x0008, 0x92f: 0x0008, - 0x930: 0x0008, 0x931: 0x3308, 0x932: 0x0008, 0x933: 0x0929, 0x934: 0x3308, 0x935: 0x3308, - 0x936: 0x3308, 0x937: 0x3308, 0x938: 0x3308, 0x939: 0x3308, 0x93a: 0x0040, 0x93b: 0x3308, - 0x93c: 0x3308, 0x93d: 0x0008, 0x93e: 0x0040, 0x93f: 0x0040, - // Block 0x25, offset 0x940 - 0x940: 0x0008, 0x941: 0x0008, 0x942: 0x0008, 0x943: 0x09d1, 0x944: 0x0008, 0x945: 0x0008, - 0x946: 0x0008, 0x947: 0x0008, 0x948: 0x0040, 0x949: 0x0008, 0x94a: 0x0008, 0x94b: 0x0008, - 0x94c: 0x0008, 0x94d: 0x0a09, 0x94e: 0x0008, 0x94f: 0x0008, 0x950: 0x0008, 0x951: 0x0008, - 0x952: 0x0a41, 0x953: 0x0008, 0x954: 0x0008, 0x955: 0x0008, 0x956: 0x0008, 0x957: 0x0a79, - 0x958: 0x0008, 0x959: 0x0008, 0x95a: 0x0008, 0x95b: 0x0008, 0x95c: 0x0ab1, 0x95d: 0x0008, - 0x95e: 0x0008, 0x95f: 0x0008, 0x960: 0x0008, 0x961: 0x0008, 0x962: 0x0008, 0x963: 0x0008, - 0x964: 0x0008, 0x965: 0x0008, 0x966: 0x0008, 0x967: 0x0008, 0x968: 0x0008, 0x969: 0x0ae9, - 0x96a: 0x0008, 0x96b: 0x0008, 0x96c: 0x0008, 0x96d: 0x0040, 0x96e: 0x0040, 0x96f: 0x0040, - 0x970: 0x0040, 0x971: 0x3308, 0x972: 0x3308, 0x973: 0x0b21, 0x974: 0x3308, 0x975: 0x0b59, - 0x976: 0x0b91, 0x977: 0x0bc9, 0x978: 0x0c19, 0x979: 0x0c51, 0x97a: 0x3308, 0x97b: 0x3308, - 0x97c: 0x3308, 0x97d: 0x3308, 0x97e: 0x3308, 0x97f: 0x3008, - // Block 0x26, offset 0x980 - 0x980: 0x3308, 0x981: 0x0ca1, 0x982: 0x3308, 0x983: 0x3308, 0x984: 0x3b08, 0x985: 0x0018, - 0x986: 0x3308, 0x987: 0x3308, 0x988: 0x0008, 0x989: 0x0008, 0x98a: 0x0008, 0x98b: 0x0008, - 0x98c: 0x0008, 0x98d: 0x3308, 0x98e: 0x3308, 0x98f: 0x3308, 0x990: 0x3308, 0x991: 0x3308, - 0x992: 0x3308, 0x993: 0x0cd9, 0x994: 0x3308, 0x995: 0x3308, 0x996: 0x3308, 0x997: 0x3308, - 0x998: 0x0040, 0x999: 0x3308, 0x99a: 0x3308, 0x99b: 0x3308, 0x99c: 0x3308, 0x99d: 0x0d11, - 0x99e: 0x3308, 0x99f: 0x3308, 0x9a0: 0x3308, 0x9a1: 0x3308, 0x9a2: 0x0d49, 0x9a3: 0x3308, - 0x9a4: 0x3308, 0x9a5: 0x3308, 0x9a6: 0x3308, 0x9a7: 0x0d81, 0x9a8: 0x3308, 0x9a9: 0x3308, - 0x9aa: 0x3308, 0x9ab: 0x3308, 0x9ac: 0x0db9, 0x9ad: 0x3308, 0x9ae: 0x3308, 0x9af: 0x3308, - 0x9b0: 0x3308, 0x9b1: 0x3308, 0x9b2: 0x3308, 0x9b3: 0x3308, 0x9b4: 0x3308, 0x9b5: 0x3308, - 0x9b6: 0x3308, 0x9b7: 0x3308, 0x9b8: 0x3308, 0x9b9: 0x0df1, 0x9ba: 0x3308, 0x9bb: 0x3308, - 0x9bc: 0x3308, 0x9bd: 0x0040, 0x9be: 0x0018, 0x9bf: 0x0018, - // Block 0x27, offset 0x9c0 - 0x9c0: 0x0008, 0x9c1: 0x0008, 0x9c2: 0x0008, 0x9c3: 0x0008, 0x9c4: 0x0008, 0x9c5: 0x0008, - 0x9c6: 0x0008, 0x9c7: 0x0008, 0x9c8: 0x0008, 0x9c9: 0x0008, 0x9ca: 0x0008, 0x9cb: 0x0008, - 0x9cc: 0x0008, 0x9cd: 0x0008, 0x9ce: 0x0008, 0x9cf: 0x0008, 0x9d0: 0x0008, 0x9d1: 0x0008, - 0x9d2: 0x0008, 0x9d3: 0x0008, 0x9d4: 0x0008, 0x9d5: 0x0008, 0x9d6: 0x0008, 0x9d7: 0x0008, - 0x9d8: 0x0008, 0x9d9: 0x0008, 0x9da: 0x0008, 0x9db: 0x0008, 0x9dc: 0x0008, 0x9dd: 0x0008, - 0x9de: 0x0008, 0x9df: 0x0008, 0x9e0: 0x0008, 0x9e1: 0x0008, 0x9e2: 0x0008, 0x9e3: 0x0008, - 0x9e4: 0x0008, 0x9e5: 0x0008, 0x9e6: 0x0008, 0x9e7: 0x0008, 0x9e8: 0x0008, 0x9e9: 0x0008, - 0x9ea: 0x0008, 0x9eb: 0x0008, 0x9ec: 0x0039, 0x9ed: 0x0ed1, 0x9ee: 0x0ee9, 0x9ef: 0x0008, - 0x9f0: 0x0ef9, 0x9f1: 0x0f09, 0x9f2: 0x0f19, 0x9f3: 0x0f31, 0x9f4: 0x0249, 0x9f5: 0x0f41, - 0x9f6: 0x0259, 0x9f7: 0x0f51, 0x9f8: 0x0359, 0x9f9: 0x0f61, 0x9fa: 0x0f71, 0x9fb: 0x0008, - 0x9fc: 0x00d9, 0x9fd: 0x0f81, 0x9fe: 0x0f99, 0x9ff: 0x0269, - // Block 0x28, offset 0xa00 - 0xa00: 0x0fa9, 0xa01: 0x0fb9, 0xa02: 0x0279, 0xa03: 0x0039, 0xa04: 0x0fc9, 0xa05: 0x0fe1, - 0xa06: 0x059d, 0xa07: 0x0ee9, 0xa08: 0x0ef9, 0xa09: 0x0f09, 0xa0a: 0x0ff9, 0xa0b: 0x1011, - 0xa0c: 0x1029, 0xa0d: 0x0f31, 0xa0e: 0x0008, 0xa0f: 0x0f51, 0xa10: 0x0f61, 0xa11: 0x1041, - 0xa12: 0x00d9, 0xa13: 0x1059, 0xa14: 0x05b5, 0xa15: 0x05b5, 0xa16: 0x0f99, 0xa17: 0x0fa9, - 0xa18: 0x0fb9, 0xa19: 0x059d, 0xa1a: 0x1071, 0xa1b: 0x1089, 0xa1c: 0x05cd, 0xa1d: 0x1099, - 0xa1e: 0x10b1, 0xa1f: 0x10c9, 0xa20: 0x10e1, 0xa21: 0x10f9, 0xa22: 0x0f41, 0xa23: 0x0269, - 0xa24: 0x0fb9, 0xa25: 0x1089, 0xa26: 0x1099, 0xa27: 0x10b1, 0xa28: 0x1111, 0xa29: 0x10e1, - 0xa2a: 0x10f9, 0xa2b: 0x0008, 0xa2c: 0x0008, 0xa2d: 0x0008, 0xa2e: 0x0008, 0xa2f: 0x0008, - 0xa30: 0x0008, 0xa31: 0x0008, 0xa32: 0x0008, 0xa33: 0x0008, 0xa34: 0x0008, 0xa35: 0x0008, - 0xa36: 0x0008, 0xa37: 0x0008, 0xa38: 0x1129, 0xa39: 0x0008, 0xa3a: 0x0008, 0xa3b: 0x0008, - 0xa3c: 0x0008, 0xa3d: 0x0008, 0xa3e: 0x0008, 0xa3f: 0x0008, - // Block 0x29, offset 0xa40 - 0xa40: 0x0008, 0xa41: 0x0008, 0xa42: 0x0008, 0xa43: 0x0008, 0xa44: 0x0008, 0xa45: 0x0008, - 0xa46: 0x0008, 0xa47: 0x0008, 0xa48: 0x0008, 0xa49: 0x0008, 0xa4a: 0x0008, 0xa4b: 0x0008, - 0xa4c: 0x0008, 0xa4d: 0x0008, 0xa4e: 0x0008, 0xa4f: 0x0008, 0xa50: 0x0008, 0xa51: 0x0008, - 0xa52: 0x0008, 0xa53: 0x0008, 0xa54: 0x0008, 0xa55: 0x0008, 0xa56: 0x0008, 0xa57: 0x0008, - 0xa58: 0x0008, 0xa59: 0x0008, 0xa5a: 0x0008, 0xa5b: 0x1141, 0xa5c: 0x1159, 0xa5d: 0x1169, - 0xa5e: 0x1181, 0xa5f: 0x1029, 0xa60: 0x1199, 0xa61: 0x11a9, 0xa62: 0x11c1, 0xa63: 0x11d9, - 0xa64: 0x11f1, 0xa65: 0x1209, 0xa66: 0x1221, 0xa67: 0x05e5, 0xa68: 0x1239, 0xa69: 0x1251, - 0xa6a: 0xe17d, 0xa6b: 0x1269, 0xa6c: 0x1281, 0xa6d: 0x1299, 0xa6e: 0x12b1, 0xa6f: 0x12c9, - 0xa70: 0x12e1, 0xa71: 0x12f9, 0xa72: 0x1311, 0xa73: 0x1329, 0xa74: 0x1341, 0xa75: 0x1359, - 0xa76: 0x1371, 0xa77: 0x1389, 0xa78: 0x05fd, 0xa79: 0x13a1, 0xa7a: 0x13b9, 0xa7b: 0x13d1, - 0xa7c: 0x13e1, 0xa7d: 0x13f9, 0xa7e: 0x1411, 0xa7f: 0x1429, - // Block 0x2a, offset 0xa80 - 0xa80: 0xe00d, 0xa81: 0x0008, 0xa82: 0xe00d, 0xa83: 0x0008, 0xa84: 0xe00d, 0xa85: 0x0008, - 0xa86: 0xe00d, 0xa87: 0x0008, 0xa88: 0xe00d, 0xa89: 0x0008, 0xa8a: 0xe00d, 0xa8b: 0x0008, - 0xa8c: 0xe00d, 0xa8d: 0x0008, 0xa8e: 0xe00d, 0xa8f: 0x0008, 0xa90: 0xe00d, 0xa91: 0x0008, - 0xa92: 0xe00d, 0xa93: 0x0008, 0xa94: 0xe00d, 0xa95: 0x0008, 0xa96: 0xe00d, 0xa97: 0x0008, - 0xa98: 0xe00d, 0xa99: 0x0008, 0xa9a: 0xe00d, 0xa9b: 0x0008, 0xa9c: 0xe00d, 0xa9d: 0x0008, - 0xa9e: 0xe00d, 0xa9f: 0x0008, 0xaa0: 0xe00d, 0xaa1: 0x0008, 0xaa2: 0xe00d, 0xaa3: 0x0008, - 0xaa4: 0xe00d, 0xaa5: 0x0008, 0xaa6: 0xe00d, 0xaa7: 0x0008, 0xaa8: 0xe00d, 0xaa9: 0x0008, - 0xaaa: 0xe00d, 0xaab: 0x0008, 0xaac: 0xe00d, 0xaad: 0x0008, 0xaae: 0xe00d, 0xaaf: 0x0008, - 0xab0: 0xe00d, 0xab1: 0x0008, 0xab2: 0xe00d, 0xab3: 0x0008, 0xab4: 0xe00d, 0xab5: 0x0008, - 0xab6: 0xe00d, 0xab7: 0x0008, 0xab8: 0xe00d, 0xab9: 0x0008, 0xaba: 0xe00d, 0xabb: 0x0008, - 0xabc: 0xe00d, 0xabd: 0x0008, 0xabe: 0xe00d, 0xabf: 0x0008, - // Block 0x2b, offset 0xac0 - 0xac0: 0xe00d, 0xac1: 0x0008, 0xac2: 0xe00d, 0xac3: 0x0008, 0xac4: 0xe00d, 0xac5: 0x0008, - 0xac6: 0xe00d, 0xac7: 0x0008, 0xac8: 0xe00d, 0xac9: 0x0008, 0xaca: 0xe00d, 0xacb: 0x0008, - 0xacc: 0xe00d, 0xacd: 0x0008, 0xace: 0xe00d, 0xacf: 0x0008, 0xad0: 0xe00d, 0xad1: 0x0008, - 0xad2: 0xe00d, 0xad3: 0x0008, 0xad4: 0xe00d, 0xad5: 0x0008, 0xad6: 0x0008, 0xad7: 0x0008, - 0xad8: 0x0008, 0xad9: 0x0008, 0xada: 0x0615, 0xadb: 0x0635, 0xadc: 0x0008, 0xadd: 0x0008, - 0xade: 0x1441, 0xadf: 0x0008, 0xae0: 0xe00d, 0xae1: 0x0008, 0xae2: 0xe00d, 0xae3: 0x0008, - 0xae4: 0xe00d, 0xae5: 0x0008, 0xae6: 0xe00d, 0xae7: 0x0008, 0xae8: 0xe00d, 0xae9: 0x0008, - 0xaea: 0xe00d, 0xaeb: 0x0008, 0xaec: 0xe00d, 0xaed: 0x0008, 0xaee: 0xe00d, 0xaef: 0x0008, - 0xaf0: 0xe00d, 0xaf1: 0x0008, 0xaf2: 0xe00d, 0xaf3: 0x0008, 0xaf4: 0xe00d, 0xaf5: 0x0008, - 0xaf6: 0xe00d, 0xaf7: 0x0008, 0xaf8: 0xe00d, 0xaf9: 0x0008, 0xafa: 0xe00d, 0xafb: 0x0008, - 0xafc: 0xe00d, 0xafd: 0x0008, 0xafe: 0xe00d, 0xaff: 0x0008, - // Block 0x2c, offset 0xb00 - 0xb00: 0x0008, 0xb01: 0x0008, 0xb02: 0x0008, 0xb03: 0x0008, 0xb04: 0x0008, 0xb05: 0x0008, - 0xb06: 0x0040, 0xb07: 0x0040, 0xb08: 0xe045, 0xb09: 0xe045, 0xb0a: 0xe045, 0xb0b: 0xe045, - 0xb0c: 0xe045, 0xb0d: 0xe045, 0xb0e: 0x0040, 0xb0f: 0x0040, 0xb10: 0x0008, 0xb11: 0x0008, - 0xb12: 0x0008, 0xb13: 0x0008, 0xb14: 0x0008, 0xb15: 0x0008, 0xb16: 0x0008, 0xb17: 0x0008, - 0xb18: 0x0040, 0xb19: 0xe045, 0xb1a: 0x0040, 0xb1b: 0xe045, 0xb1c: 0x0040, 0xb1d: 0xe045, - 0xb1e: 0x0040, 0xb1f: 0xe045, 0xb20: 0x0008, 0xb21: 0x0008, 0xb22: 0x0008, 0xb23: 0x0008, - 0xb24: 0x0008, 0xb25: 0x0008, 0xb26: 0x0008, 0xb27: 0x0008, 0xb28: 0xe045, 0xb29: 0xe045, - 0xb2a: 0xe045, 0xb2b: 0xe045, 0xb2c: 0xe045, 0xb2d: 0xe045, 0xb2e: 0xe045, 0xb2f: 0xe045, - 0xb30: 0x0008, 0xb31: 0x1459, 0xb32: 0x0008, 0xb33: 0x1471, 0xb34: 0x0008, 0xb35: 0x1489, - 0xb36: 0x0008, 0xb37: 0x14a1, 0xb38: 0x0008, 0xb39: 0x14b9, 0xb3a: 0x0008, 0xb3b: 0x14d1, - 0xb3c: 0x0008, 0xb3d: 0x14e9, 0xb3e: 0x0040, 0xb3f: 0x0040, - // Block 0x2d, offset 0xb40 - 0xb40: 0x1501, 0xb41: 0x1531, 0xb42: 0x1561, 0xb43: 0x1591, 0xb44: 0x15c1, 0xb45: 0x15f1, - 0xb46: 0x1621, 0xb47: 0x1651, 0xb48: 0x1501, 0xb49: 0x1531, 0xb4a: 0x1561, 0xb4b: 0x1591, - 0xb4c: 0x15c1, 0xb4d: 0x15f1, 0xb4e: 0x1621, 0xb4f: 0x1651, 0xb50: 0x1681, 0xb51: 0x16b1, - 0xb52: 0x16e1, 0xb53: 0x1711, 0xb54: 0x1741, 0xb55: 0x1771, 0xb56: 0x17a1, 0xb57: 0x17d1, - 0xb58: 0x1681, 0xb59: 0x16b1, 0xb5a: 0x16e1, 0xb5b: 0x1711, 0xb5c: 0x1741, 0xb5d: 0x1771, - 0xb5e: 0x17a1, 0xb5f: 0x17d1, 0xb60: 0x1801, 0xb61: 0x1831, 0xb62: 0x1861, 0xb63: 0x1891, - 0xb64: 0x18c1, 0xb65: 0x18f1, 0xb66: 0x1921, 0xb67: 0x1951, 0xb68: 0x1801, 0xb69: 0x1831, - 0xb6a: 0x1861, 0xb6b: 0x1891, 0xb6c: 0x18c1, 0xb6d: 0x18f1, 0xb6e: 0x1921, 0xb6f: 0x1951, - 0xb70: 0x0008, 0xb71: 0x0008, 0xb72: 0x1981, 0xb73: 0x19b1, 0xb74: 0x19d9, 0xb75: 0x0040, - 0xb76: 0x0008, 0xb77: 0x1a01, 0xb78: 0xe045, 0xb79: 0xe045, 0xb7a: 0x064d, 0xb7b: 0x1459, - 0xb7c: 0x19b1, 0xb7d: 0x0666, 0xb7e: 0x1a31, 0xb7f: 0x0686, - // Block 0x2e, offset 0xb80 - 0xb80: 0x06a6, 0xb81: 0x1a4a, 0xb82: 0x1a79, 0xb83: 0x1aa9, 0xb84: 0x1ad1, 0xb85: 0x0040, - 0xb86: 0x0008, 0xb87: 0x1af9, 0xb88: 0x06c5, 0xb89: 0x1471, 0xb8a: 0x06dd, 0xb8b: 0x1489, - 0xb8c: 0x1aa9, 0xb8d: 0x1b2a, 0xb8e: 0x1b5a, 0xb8f: 0x1b8a, 0xb90: 0x0008, 0xb91: 0x0008, - 0xb92: 0x0008, 0xb93: 0x1bb9, 0xb94: 0x0040, 0xb95: 0x0040, 0xb96: 0x0008, 0xb97: 0x0008, - 0xb98: 0xe045, 0xb99: 0xe045, 0xb9a: 0x06f5, 0xb9b: 0x14a1, 0xb9c: 0x0040, 0xb9d: 0x1bd2, - 0xb9e: 0x1c02, 0xb9f: 0x1c32, 0xba0: 0x0008, 0xba1: 0x0008, 0xba2: 0x0008, 0xba3: 0x1c61, - 0xba4: 0x0008, 0xba5: 0x0008, 0xba6: 0x0008, 0xba7: 0x0008, 0xba8: 0xe045, 0xba9: 0xe045, - 0xbaa: 0x070d, 0xbab: 0x14d1, 0xbac: 0xe04d, 0xbad: 0x1c7a, 0xbae: 0x03d2, 0xbaf: 0x1caa, - 0xbb0: 0x0040, 0xbb1: 0x0040, 0xbb2: 0x1cb9, 0xbb3: 0x1ce9, 0xbb4: 0x1d11, 0xbb5: 0x0040, - 0xbb6: 0x0008, 0xbb7: 0x1d39, 0xbb8: 0x0725, 0xbb9: 0x14b9, 0xbba: 0x0515, 0xbbb: 0x14e9, - 0xbbc: 0x1ce9, 0xbbd: 0x073e, 0xbbe: 0x075e, 0xbbf: 0x0040, - // Block 0x2f, offset 0xbc0 - 0xbc0: 0x000a, 0xbc1: 0x000a, 0xbc2: 0x000a, 0xbc3: 0x000a, 0xbc4: 0x000a, 0xbc5: 0x000a, - 0xbc6: 0x000a, 0xbc7: 0x000a, 0xbc8: 0x000a, 0xbc9: 0x000a, 0xbca: 0x000a, 0xbcb: 0x03c0, - 0xbcc: 0x0003, 0xbcd: 0x0003, 0xbce: 0x0340, 0xbcf: 0x0b40, 0xbd0: 0x0018, 0xbd1: 0xe00d, - 0xbd2: 0x0018, 0xbd3: 0x0018, 0xbd4: 0x0018, 0xbd5: 0x0018, 0xbd6: 0x0018, 0xbd7: 0x077e, - 0xbd8: 0x0018, 0xbd9: 0x0018, 0xbda: 0x0018, 0xbdb: 0x0018, 0xbdc: 0x0018, 0xbdd: 0x0018, - 0xbde: 0x0018, 0xbdf: 0x0018, 0xbe0: 0x0018, 0xbe1: 0x0018, 0xbe2: 0x0018, 0xbe3: 0x0018, - 0xbe4: 0x0040, 0xbe5: 0x0040, 0xbe6: 0x0040, 0xbe7: 0x0018, 0xbe8: 0x0040, 0xbe9: 0x0040, - 0xbea: 0x0340, 0xbeb: 0x0340, 0xbec: 0x0340, 0xbed: 0x0340, 0xbee: 0x0340, 0xbef: 0x000a, - 0xbf0: 0x0018, 0xbf1: 0x0018, 0xbf2: 0x0018, 0xbf3: 0x1d69, 0xbf4: 0x1da1, 0xbf5: 0x0018, - 0xbf6: 0x1df1, 0xbf7: 0x1e29, 0xbf8: 0x0018, 0xbf9: 0x0018, 0xbfa: 0x0018, 0xbfb: 0x0018, - 0xbfc: 0x1e7a, 0xbfd: 0x0018, 0xbfe: 0x079e, 0xbff: 0x0018, - // Block 0x30, offset 0xc00 - 0xc00: 0x0018, 0xc01: 0x0018, 0xc02: 0x0018, 0xc03: 0x0018, 0xc04: 0x0018, 0xc05: 0x0018, - 0xc06: 0x0018, 0xc07: 0x1e92, 0xc08: 0x1eaa, 0xc09: 0x1ec2, 0xc0a: 0x0018, 0xc0b: 0x0018, - 0xc0c: 0x0018, 0xc0d: 0x0018, 0xc0e: 0x0018, 0xc0f: 0x0018, 0xc10: 0x0018, 0xc11: 0x0018, - 0xc12: 0x0018, 0xc13: 0x0018, 0xc14: 0x0018, 0xc15: 0x0018, 0xc16: 0x0018, 0xc17: 0x1ed9, - 0xc18: 0x0018, 0xc19: 0x0018, 0xc1a: 0x0018, 0xc1b: 0x0018, 0xc1c: 0x0018, 0xc1d: 0x0018, - 0xc1e: 0x0018, 0xc1f: 0x000a, 0xc20: 0x03c0, 0xc21: 0x0340, 0xc22: 0x0340, 0xc23: 0x0340, - 0xc24: 0x03c0, 0xc25: 0x0040, 0xc26: 0x0040, 0xc27: 0x0040, 0xc28: 0x0040, 0xc29: 0x0040, - 0xc2a: 0x0340, 0xc2b: 0x0340, 0xc2c: 0x0340, 0xc2d: 0x0340, 0xc2e: 0x0340, 0xc2f: 0x0340, - 0xc30: 0x1f41, 0xc31: 0x0f41, 0xc32: 0x0040, 0xc33: 0x0040, 0xc34: 0x1f51, 0xc35: 0x1f61, - 0xc36: 0x1f71, 0xc37: 0x1f81, 0xc38: 0x1f91, 0xc39: 0x1fa1, 0xc3a: 0x1fb2, 0xc3b: 0x07bd, - 0xc3c: 0x1fc2, 0xc3d: 0x1fd2, 0xc3e: 0x1fe2, 0xc3f: 0x0f71, - // Block 0x31, offset 0xc40 - 0xc40: 0x1f41, 0xc41: 0x00c9, 0xc42: 0x0069, 0xc43: 0x0079, 0xc44: 0x1f51, 0xc45: 0x1f61, - 0xc46: 0x1f71, 0xc47: 0x1f81, 0xc48: 0x1f91, 0xc49: 0x1fa1, 0xc4a: 0x1fb2, 0xc4b: 0x07d5, - 0xc4c: 0x1fc2, 0xc4d: 0x1fd2, 0xc4e: 0x1fe2, 0xc4f: 0x0040, 0xc50: 0x0039, 0xc51: 0x0f09, - 0xc52: 0x00d9, 0xc53: 0x0369, 0xc54: 0x0ff9, 0xc55: 0x0249, 0xc56: 0x0f51, 0xc57: 0x0359, - 0xc58: 0x0f61, 0xc59: 0x0f71, 0xc5a: 0x0f99, 0xc5b: 0x01d9, 0xc5c: 0x0fa9, 0xc5d: 0x0040, - 0xc5e: 0x0040, 0xc5f: 0x0040, 0xc60: 0x0018, 0xc61: 0x0018, 0xc62: 0x0018, 0xc63: 0x0018, - 0xc64: 0x0018, 0xc65: 0x0018, 0xc66: 0x0018, 0xc67: 0x0018, 0xc68: 0x1ff1, 0xc69: 0x0018, - 0xc6a: 0x0018, 0xc6b: 0x0018, 0xc6c: 0x0018, 0xc6d: 0x0018, 0xc6e: 0x0018, 0xc6f: 0x0018, - 0xc70: 0x0018, 0xc71: 0x0018, 0xc72: 0x0018, 0xc73: 0x0018, 0xc74: 0x0018, 0xc75: 0x0018, - 0xc76: 0x0018, 0xc77: 0x0018, 0xc78: 0x0018, 0xc79: 0x0018, 0xc7a: 0x0018, 0xc7b: 0x0018, - 0xc7c: 0x0018, 0xc7d: 0x0018, 0xc7e: 0x0018, 0xc7f: 0x0018, - // Block 0x32, offset 0xc80 - 0xc80: 0x07ee, 0xc81: 0x080e, 0xc82: 0x1159, 0xc83: 0x082d, 0xc84: 0x0018, 0xc85: 0x084e, - 0xc86: 0x086e, 0xc87: 0x1011, 0xc88: 0x0018, 0xc89: 0x088d, 0xc8a: 0x0f31, 0xc8b: 0x0249, - 0xc8c: 0x0249, 0xc8d: 0x0249, 0xc8e: 0x0249, 0xc8f: 0x2009, 0xc90: 0x0f41, 0xc91: 0x0f41, - 0xc92: 0x0359, 0xc93: 0x0359, 0xc94: 0x0018, 0xc95: 0x0f71, 0xc96: 0x2021, 0xc97: 0x0018, - 0xc98: 0x0018, 0xc99: 0x0f99, 0xc9a: 0x2039, 0xc9b: 0x0269, 0xc9c: 0x0269, 0xc9d: 0x0269, - 0xc9e: 0x0018, 0xc9f: 0x0018, 0xca0: 0x2049, 0xca1: 0x08ad, 0xca2: 0x2061, 0xca3: 0x0018, - 0xca4: 0x13d1, 0xca5: 0x0018, 0xca6: 0x2079, 0xca7: 0x0018, 0xca8: 0x13d1, 0xca9: 0x0018, - 0xcaa: 0x0f51, 0xcab: 0x2091, 0xcac: 0x0ee9, 0xcad: 0x1159, 0xcae: 0x0018, 0xcaf: 0x0f09, - 0xcb0: 0x0f09, 0xcb1: 0x1199, 0xcb2: 0x0040, 0xcb3: 0x0f61, 0xcb4: 0x00d9, 0xcb5: 0x20a9, - 0xcb6: 0x20c1, 0xcb7: 0x20d9, 0xcb8: 0x20f1, 0xcb9: 0x0f41, 0xcba: 0x0018, 0xcbb: 0x08cd, - 0xcbc: 0x2109, 0xcbd: 0x10b1, 0xcbe: 0x10b1, 0xcbf: 0x2109, - // Block 0x33, offset 0xcc0 - 0xcc0: 0x08ed, 0xcc1: 0x0018, 0xcc2: 0x0018, 0xcc3: 0x0018, 0xcc4: 0x0018, 0xcc5: 0x0ef9, - 0xcc6: 0x0ef9, 0xcc7: 0x0f09, 0xcc8: 0x0f41, 0xcc9: 0x0259, 0xcca: 0x0018, 0xccb: 0x0018, - 0xccc: 0x0018, 0xccd: 0x0018, 0xcce: 0x0008, 0xccf: 0x0018, 0xcd0: 0x2121, 0xcd1: 0x2151, - 0xcd2: 0x2181, 0xcd3: 0x21b9, 0xcd4: 0x21e9, 0xcd5: 0x2219, 0xcd6: 0x2249, 0xcd7: 0x2279, - 0xcd8: 0x22a9, 0xcd9: 0x22d9, 0xcda: 0x2309, 0xcdb: 0x2339, 0xcdc: 0x2369, 0xcdd: 0x2399, - 0xcde: 0x23c9, 0xcdf: 0x23f9, 0xce0: 0x0f41, 0xce1: 0x2421, 0xce2: 0x0905, 0xce3: 0x2439, - 0xce4: 0x1089, 0xce5: 0x2451, 0xce6: 0x0925, 0xce7: 0x2469, 0xce8: 0x2491, 0xce9: 0x0369, - 0xcea: 0x24a9, 0xceb: 0x0945, 0xcec: 0x0359, 0xced: 0x1159, 0xcee: 0x0ef9, 0xcef: 0x0f61, - 0xcf0: 0x0f41, 0xcf1: 0x2421, 0xcf2: 0x0965, 0xcf3: 0x2439, 0xcf4: 0x1089, 0xcf5: 0x2451, - 0xcf6: 0x0985, 0xcf7: 0x2469, 0xcf8: 0x2491, 0xcf9: 0x0369, 0xcfa: 0x24a9, 0xcfb: 0x09a5, - 0xcfc: 0x0359, 0xcfd: 0x1159, 0xcfe: 0x0ef9, 0xcff: 0x0f61, - // Block 0x34, offset 0xd00 - 0xd00: 0x0018, 0xd01: 0x0018, 0xd02: 0x0018, 0xd03: 0x0018, 0xd04: 0x0018, 0xd05: 0x0018, - 0xd06: 0x0018, 0xd07: 0x0018, 0xd08: 0x0018, 0xd09: 0x0018, 0xd0a: 0x0018, 0xd0b: 0x0040, - 0xd0c: 0x0040, 0xd0d: 0x0040, 0xd0e: 0x0040, 0xd0f: 0x0040, 0xd10: 0x0040, 0xd11: 0x0040, - 0xd12: 0x0040, 0xd13: 0x0040, 0xd14: 0x0040, 0xd15: 0x0040, 0xd16: 0x0040, 0xd17: 0x0040, - 0xd18: 0x0040, 0xd19: 0x0040, 0xd1a: 0x0040, 0xd1b: 0x0040, 0xd1c: 0x0040, 0xd1d: 0x0040, - 0xd1e: 0x0040, 0xd1f: 0x0040, 0xd20: 0x00c9, 0xd21: 0x0069, 0xd22: 0x0079, 0xd23: 0x1f51, - 0xd24: 0x1f61, 0xd25: 0x1f71, 0xd26: 0x1f81, 0xd27: 0x1f91, 0xd28: 0x1fa1, 0xd29: 0x2601, - 0xd2a: 0x2619, 0xd2b: 0x2631, 0xd2c: 0x2649, 0xd2d: 0x2661, 0xd2e: 0x2679, 0xd2f: 0x2691, - 0xd30: 0x26a9, 0xd31: 0x26c1, 0xd32: 0x26d9, 0xd33: 0x26f1, 0xd34: 0x0a06, 0xd35: 0x0a26, - 0xd36: 0x0a46, 0xd37: 0x0a66, 0xd38: 0x0a86, 0xd39: 0x0aa6, 0xd3a: 0x0ac6, 0xd3b: 0x0ae6, - 0xd3c: 0x0b06, 0xd3d: 0x270a, 0xd3e: 0x2732, 0xd3f: 0x275a, - // Block 0x35, offset 0xd40 - 0xd40: 0x2782, 0xd41: 0x27aa, 0xd42: 0x27d2, 0xd43: 0x27fa, 0xd44: 0x2822, 0xd45: 0x284a, - 0xd46: 0x2872, 0xd47: 0x289a, 0xd48: 0x0040, 0xd49: 0x0040, 0xd4a: 0x0040, 0xd4b: 0x0040, - 0xd4c: 0x0040, 0xd4d: 0x0040, 0xd4e: 0x0040, 0xd4f: 0x0040, 0xd50: 0x0040, 0xd51: 0x0040, - 0xd52: 0x0040, 0xd53: 0x0040, 0xd54: 0x0040, 0xd55: 0x0040, 0xd56: 0x0040, 0xd57: 0x0040, - 0xd58: 0x0040, 0xd59: 0x0040, 0xd5a: 0x0040, 0xd5b: 0x0040, 0xd5c: 0x0b26, 0xd5d: 0x0b46, - 0xd5e: 0x0b66, 0xd5f: 0x0b86, 0xd60: 0x0ba6, 0xd61: 0x0bc6, 0xd62: 0x0be6, 0xd63: 0x0c06, - 0xd64: 0x0c26, 0xd65: 0x0c46, 0xd66: 0x0c66, 0xd67: 0x0c86, 0xd68: 0x0ca6, 0xd69: 0x0cc6, - 0xd6a: 0x0ce6, 0xd6b: 0x0d06, 0xd6c: 0x0d26, 0xd6d: 0x0d46, 0xd6e: 0x0d66, 0xd6f: 0x0d86, - 0xd70: 0x0da6, 0xd71: 0x0dc6, 0xd72: 0x0de6, 0xd73: 0x0e06, 0xd74: 0x0e26, 0xd75: 0x0e46, - 0xd76: 0x0039, 0xd77: 0x0ee9, 0xd78: 0x1159, 0xd79: 0x0ef9, 0xd7a: 0x0f09, 0xd7b: 0x1199, - 0xd7c: 0x0f31, 0xd7d: 0x0249, 0xd7e: 0x0f41, 0xd7f: 0x0259, - // Block 0x36, offset 0xd80 - 0xd80: 0x0f51, 0xd81: 0x0359, 0xd82: 0x0f61, 0xd83: 0x0f71, 0xd84: 0x00d9, 0xd85: 0x0f99, - 0xd86: 0x2039, 0xd87: 0x0269, 0xd88: 0x01d9, 0xd89: 0x0fa9, 0xd8a: 0x0fb9, 0xd8b: 0x1089, - 0xd8c: 0x0279, 0xd8d: 0x0369, 0xd8e: 0x0289, 0xd8f: 0x13d1, 0xd90: 0x0039, 0xd91: 0x0ee9, - 0xd92: 0x1159, 0xd93: 0x0ef9, 0xd94: 0x0f09, 0xd95: 0x1199, 0xd96: 0x0f31, 0xd97: 0x0249, - 0xd98: 0x0f41, 0xd99: 0x0259, 0xd9a: 0x0f51, 0xd9b: 0x0359, 0xd9c: 0x0f61, 0xd9d: 0x0f71, - 0xd9e: 0x00d9, 0xd9f: 0x0f99, 0xda0: 0x2039, 0xda1: 0x0269, 0xda2: 0x01d9, 0xda3: 0x0fa9, - 0xda4: 0x0fb9, 0xda5: 0x1089, 0xda6: 0x0279, 0xda7: 0x0369, 0xda8: 0x0289, 0xda9: 0x13d1, - 0xdaa: 0x1f41, 0xdab: 0x0018, 0xdac: 0x0018, 0xdad: 0x0018, 0xdae: 0x0018, 0xdaf: 0x0018, - 0xdb0: 0x0018, 0xdb1: 0x0018, 0xdb2: 0x0018, 0xdb3: 0x0018, 0xdb4: 0x0018, 0xdb5: 0x0018, - 0xdb6: 0x0018, 0xdb7: 0x0018, 0xdb8: 0x0018, 0xdb9: 0x0018, 0xdba: 0x0018, 0xdbb: 0x0018, - 0xdbc: 0x0018, 0xdbd: 0x0018, 0xdbe: 0x0018, 0xdbf: 0x0018, - // Block 0x37, offset 0xdc0 - 0xdc0: 0x0008, 0xdc1: 0x0008, 0xdc2: 0x0008, 0xdc3: 0x0008, 0xdc4: 0x0008, 0xdc5: 0x0008, - 0xdc6: 0x0008, 0xdc7: 0x0008, 0xdc8: 0x0008, 0xdc9: 0x0008, 0xdca: 0x0008, 0xdcb: 0x0008, - 0xdcc: 0x0008, 0xdcd: 0x0008, 0xdce: 0x0008, 0xdcf: 0x0008, 0xdd0: 0x0008, 0xdd1: 0x0008, - 0xdd2: 0x0008, 0xdd3: 0x0008, 0xdd4: 0x0008, 0xdd5: 0x0008, 0xdd6: 0x0008, 0xdd7: 0x0008, - 0xdd8: 0x0008, 0xdd9: 0x0008, 0xdda: 0x0008, 0xddb: 0x0008, 0xddc: 0x0008, 0xddd: 0x0008, - 0xdde: 0x0008, 0xddf: 0x0040, 0xde0: 0xe00d, 0xde1: 0x0008, 0xde2: 0x2971, 0xde3: 0x0ebd, - 0xde4: 0x2989, 0xde5: 0x0008, 0xde6: 0x0008, 0xde7: 0xe07d, 0xde8: 0x0008, 0xde9: 0xe01d, - 0xdea: 0x0008, 0xdeb: 0xe03d, 0xdec: 0x0008, 0xded: 0x0fe1, 0xdee: 0x1281, 0xdef: 0x0fc9, - 0xdf0: 0x1141, 0xdf1: 0x0008, 0xdf2: 0xe00d, 0xdf3: 0x0008, 0xdf4: 0x0008, 0xdf5: 0xe01d, - 0xdf6: 0x0008, 0xdf7: 0x0008, 0xdf8: 0x0008, 0xdf9: 0x0008, 0xdfa: 0x0008, 0xdfb: 0x0008, - 0xdfc: 0x0259, 0xdfd: 0x1089, 0xdfe: 0x29a1, 0xdff: 0x29b9, - // Block 0x38, offset 0xe00 - 0xe00: 0xe00d, 0xe01: 0x0008, 0xe02: 0xe00d, 0xe03: 0x0008, 0xe04: 0xe00d, 0xe05: 0x0008, - 0xe06: 0xe00d, 0xe07: 0x0008, 0xe08: 0xe00d, 0xe09: 0x0008, 0xe0a: 0xe00d, 0xe0b: 0x0008, - 0xe0c: 0xe00d, 0xe0d: 0x0008, 0xe0e: 0xe00d, 0xe0f: 0x0008, 0xe10: 0xe00d, 0xe11: 0x0008, - 0xe12: 0xe00d, 0xe13: 0x0008, 0xe14: 0xe00d, 0xe15: 0x0008, 0xe16: 0xe00d, 0xe17: 0x0008, - 0xe18: 0xe00d, 0xe19: 0x0008, 0xe1a: 0xe00d, 0xe1b: 0x0008, 0xe1c: 0xe00d, 0xe1d: 0x0008, - 0xe1e: 0xe00d, 0xe1f: 0x0008, 0xe20: 0xe00d, 0xe21: 0x0008, 0xe22: 0xe00d, 0xe23: 0x0008, - 0xe24: 0x0008, 0xe25: 0x0018, 0xe26: 0x0018, 0xe27: 0x0018, 0xe28: 0x0018, 0xe29: 0x0018, - 0xe2a: 0x0018, 0xe2b: 0xe03d, 0xe2c: 0x0008, 0xe2d: 0xe01d, 0xe2e: 0x0008, 0xe2f: 0x3308, - 0xe30: 0x3308, 0xe31: 0x3308, 0xe32: 0xe00d, 0xe33: 0x0008, 0xe34: 0x0040, 0xe35: 0x0040, - 0xe36: 0x0040, 0xe37: 0x0040, 0xe38: 0x0040, 0xe39: 0x0018, 0xe3a: 0x0018, 0xe3b: 0x0018, - 0xe3c: 0x0018, 0xe3d: 0x0018, 0xe3e: 0x0018, 0xe3f: 0x0018, - // Block 0x39, offset 0xe40 - 0xe40: 0x26fd, 0xe41: 0x271d, 0xe42: 0x273d, 0xe43: 0x275d, 0xe44: 0x277d, 0xe45: 0x279d, - 0xe46: 0x27bd, 0xe47: 0x27dd, 0xe48: 0x27fd, 0xe49: 0x281d, 0xe4a: 0x283d, 0xe4b: 0x285d, - 0xe4c: 0x287d, 0xe4d: 0x289d, 0xe4e: 0x28bd, 0xe4f: 0x28dd, 0xe50: 0x28fd, 0xe51: 0x291d, - 0xe52: 0x293d, 0xe53: 0x295d, 0xe54: 0x297d, 0xe55: 0x299d, 0xe56: 0x0040, 0xe57: 0x0040, - 0xe58: 0x0040, 0xe59: 0x0040, 0xe5a: 0x0040, 0xe5b: 0x0040, 0xe5c: 0x0040, 0xe5d: 0x0040, - 0xe5e: 0x0040, 0xe5f: 0x0040, 0xe60: 0x0040, 0xe61: 0x0040, 0xe62: 0x0040, 0xe63: 0x0040, - 0xe64: 0x0040, 0xe65: 0x0040, 0xe66: 0x0040, 0xe67: 0x0040, 0xe68: 0x0040, 0xe69: 0x0040, - 0xe6a: 0x0040, 0xe6b: 0x0040, 0xe6c: 0x0040, 0xe6d: 0x0040, 0xe6e: 0x0040, 0xe6f: 0x0040, - 0xe70: 0x0040, 0xe71: 0x0040, 0xe72: 0x0040, 0xe73: 0x0040, 0xe74: 0x0040, 0xe75: 0x0040, - 0xe76: 0x0040, 0xe77: 0x0040, 0xe78: 0x0040, 0xe79: 0x0040, 0xe7a: 0x0040, 0xe7b: 0x0040, - 0xe7c: 0x0040, 0xe7d: 0x0040, 0xe7e: 0x0040, 0xe7f: 0x0040, - // Block 0x3a, offset 0xe80 - 0xe80: 0x000a, 0xe81: 0x0018, 0xe82: 0x29d1, 0xe83: 0x0018, 0xe84: 0x0018, 0xe85: 0x0008, - 0xe86: 0x0008, 0xe87: 0x0008, 0xe88: 0x0018, 0xe89: 0x0018, 0xe8a: 0x0018, 0xe8b: 0x0018, - 0xe8c: 0x0018, 0xe8d: 0x0018, 0xe8e: 0x0018, 0xe8f: 0x0018, 0xe90: 0x0018, 0xe91: 0x0018, - 0xe92: 0x0018, 0xe93: 0x0018, 0xe94: 0x0018, 0xe95: 0x0018, 0xe96: 0x0018, 0xe97: 0x0018, - 0xe98: 0x0018, 0xe99: 0x0018, 0xe9a: 0x0018, 0xe9b: 0x0018, 0xe9c: 0x0018, 0xe9d: 0x0018, - 0xe9e: 0x0018, 0xe9f: 0x0018, 0xea0: 0x0018, 0xea1: 0x0018, 0xea2: 0x0018, 0xea3: 0x0018, - 0xea4: 0x0018, 0xea5: 0x0018, 0xea6: 0x0018, 0xea7: 0x0018, 0xea8: 0x0018, 0xea9: 0x0018, - 0xeaa: 0x3308, 0xeab: 0x3308, 0xeac: 0x3308, 0xead: 0x3308, 0xeae: 0x3018, 0xeaf: 0x3018, - 0xeb0: 0x0018, 0xeb1: 0x0018, 0xeb2: 0x0018, 0xeb3: 0x0018, 0xeb4: 0x0018, 0xeb5: 0x0018, - 0xeb6: 0xe125, 0xeb7: 0x0018, 0xeb8: 0x29bd, 0xeb9: 0x29dd, 0xeba: 0x29fd, 0xebb: 0x0018, - 0xebc: 0x0008, 0xebd: 0x0018, 0xebe: 0x0018, 0xebf: 0x0018, - // Block 0x3b, offset 0xec0 - 0xec0: 0x2b3d, 0xec1: 0x2b5d, 0xec2: 0x2b7d, 0xec3: 0x2b9d, 0xec4: 0x2bbd, 0xec5: 0x2bdd, - 0xec6: 0x2bdd, 0xec7: 0x2bdd, 0xec8: 0x2bfd, 0xec9: 0x2bfd, 0xeca: 0x2bfd, 0xecb: 0x2bfd, - 0xecc: 0x2c1d, 0xecd: 0x2c1d, 0xece: 0x2c1d, 0xecf: 0x2c3d, 0xed0: 0x2c5d, 0xed1: 0x2c5d, - 0xed2: 0x2a7d, 0xed3: 0x2a7d, 0xed4: 0x2c5d, 0xed5: 0x2c5d, 0xed6: 0x2c7d, 0xed7: 0x2c7d, - 0xed8: 0x2c5d, 0xed9: 0x2c5d, 0xeda: 0x2a7d, 0xedb: 0x2a7d, 0xedc: 0x2c5d, 0xedd: 0x2c5d, - 0xede: 0x2c3d, 0xedf: 0x2c3d, 0xee0: 0x2c9d, 0xee1: 0x2c9d, 0xee2: 0x2cbd, 0xee3: 0x2cbd, - 0xee4: 0x0040, 0xee5: 0x2cdd, 0xee6: 0x2cfd, 0xee7: 0x2d1d, 0xee8: 0x2d1d, 0xee9: 0x2d3d, - 0xeea: 0x2d5d, 0xeeb: 0x2d7d, 0xeec: 0x2d9d, 0xeed: 0x2dbd, 0xeee: 0x2ddd, 0xeef: 0x2dfd, - 0xef0: 0x2e1d, 0xef1: 0x2e3d, 0xef2: 0x2e3d, 0xef3: 0x2e5d, 0xef4: 0x2e7d, 0xef5: 0x2e7d, - 0xef6: 0x2e9d, 0xef7: 0x2ebd, 0xef8: 0x2e5d, 0xef9: 0x2edd, 0xefa: 0x2efd, 0xefb: 0x2edd, - 0xefc: 0x2e5d, 0xefd: 0x2f1d, 0xefe: 0x2f3d, 0xeff: 0x2f5d, - // Block 0x3c, offset 0xf00 - 0xf00: 0x2f7d, 0xf01: 0x2f9d, 0xf02: 0x2cfd, 0xf03: 0x2cdd, 0xf04: 0x2fbd, 0xf05: 0x2fdd, - 0xf06: 0x2ffd, 0xf07: 0x301d, 0xf08: 0x303d, 0xf09: 0x305d, 0xf0a: 0x307d, 0xf0b: 0x309d, - 0xf0c: 0x30bd, 0xf0d: 0x30dd, 0xf0e: 0x30fd, 0xf0f: 0x0040, 0xf10: 0x0018, 0xf11: 0x0018, - 0xf12: 0x311d, 0xf13: 0x313d, 0xf14: 0x315d, 0xf15: 0x317d, 0xf16: 0x319d, 0xf17: 0x31bd, - 0xf18: 0x31dd, 0xf19: 0x31fd, 0xf1a: 0x321d, 0xf1b: 0x323d, 0xf1c: 0x315d, 0xf1d: 0x325d, - 0xf1e: 0x327d, 0xf1f: 0x329d, 0xf20: 0x0008, 0xf21: 0x0008, 0xf22: 0x0008, 0xf23: 0x0008, - 0xf24: 0x0008, 0xf25: 0x0008, 0xf26: 0x0008, 0xf27: 0x0008, 0xf28: 0x0008, 0xf29: 0x0008, - 0xf2a: 0x0008, 0xf2b: 0x0008, 0xf2c: 0x0008, 0xf2d: 0x0008, 0xf2e: 0x0008, 0xf2f: 0x0008, - 0xf30: 0x0008, 0xf31: 0x0008, 0xf32: 0x0008, 0xf33: 0x0008, 0xf34: 0x0008, 0xf35: 0x0008, - 0xf36: 0x0008, 0xf37: 0x0008, 0xf38: 0x0008, 0xf39: 0x0008, 0xf3a: 0x0008, 0xf3b: 0x0040, - 0xf3c: 0x0040, 0xf3d: 0x0040, 0xf3e: 0x0040, 0xf3f: 0x0040, - // Block 0x3d, offset 0xf40 - 0xf40: 0x36a2, 0xf41: 0x36d2, 0xf42: 0x3702, 0xf43: 0x3732, 0xf44: 0x32bd, 0xf45: 0x32dd, - 0xf46: 0x32fd, 0xf47: 0x331d, 0xf48: 0x0018, 0xf49: 0x0018, 0xf4a: 0x0018, 0xf4b: 0x0018, - 0xf4c: 0x0018, 0xf4d: 0x0018, 0xf4e: 0x0018, 0xf4f: 0x0018, 0xf50: 0x333d, 0xf51: 0x3761, - 0xf52: 0x3779, 0xf53: 0x3791, 0xf54: 0x37a9, 0xf55: 0x37c1, 0xf56: 0x37d9, 0xf57: 0x37f1, - 0xf58: 0x3809, 0xf59: 0x3821, 0xf5a: 0x3839, 0xf5b: 0x3851, 0xf5c: 0x3869, 0xf5d: 0x3881, - 0xf5e: 0x3899, 0xf5f: 0x38b1, 0xf60: 0x335d, 0xf61: 0x337d, 0xf62: 0x339d, 0xf63: 0x33bd, - 0xf64: 0x33dd, 0xf65: 0x33dd, 0xf66: 0x33fd, 0xf67: 0x341d, 0xf68: 0x343d, 0xf69: 0x345d, - 0xf6a: 0x347d, 0xf6b: 0x349d, 0xf6c: 0x34bd, 0xf6d: 0x34dd, 0xf6e: 0x34fd, 0xf6f: 0x351d, - 0xf70: 0x353d, 0xf71: 0x355d, 0xf72: 0x357d, 0xf73: 0x359d, 0xf74: 0x35bd, 0xf75: 0x35dd, - 0xf76: 0x35fd, 0xf77: 0x361d, 0xf78: 0x363d, 0xf79: 0x365d, 0xf7a: 0x367d, 0xf7b: 0x369d, - 0xf7c: 0x38c9, 0xf7d: 0x3901, 0xf7e: 0x36bd, 0xf7f: 0x0018, - // Block 0x3e, offset 0xf80 - 0xf80: 0x36dd, 0xf81: 0x36fd, 0xf82: 0x371d, 0xf83: 0x373d, 0xf84: 0x375d, 0xf85: 0x377d, - 0xf86: 0x379d, 0xf87: 0x37bd, 0xf88: 0x37dd, 0xf89: 0x37fd, 0xf8a: 0x381d, 0xf8b: 0x383d, - 0xf8c: 0x385d, 0xf8d: 0x387d, 0xf8e: 0x389d, 0xf8f: 0x38bd, 0xf90: 0x38dd, 0xf91: 0x38fd, - 0xf92: 0x391d, 0xf93: 0x393d, 0xf94: 0x395d, 0xf95: 0x397d, 0xf96: 0x399d, 0xf97: 0x39bd, - 0xf98: 0x39dd, 0xf99: 0x39fd, 0xf9a: 0x3a1d, 0xf9b: 0x3a3d, 0xf9c: 0x3a5d, 0xf9d: 0x3a7d, - 0xf9e: 0x3a9d, 0xf9f: 0x3abd, 0xfa0: 0x3add, 0xfa1: 0x3afd, 0xfa2: 0x3b1d, 0xfa3: 0x3b3d, - 0xfa4: 0x3b5d, 0xfa5: 0x3b7d, 0xfa6: 0x127d, 0xfa7: 0x3b9d, 0xfa8: 0x3bbd, 0xfa9: 0x3bdd, - 0xfaa: 0x3bfd, 0xfab: 0x3c1d, 0xfac: 0x3c3d, 0xfad: 0x3c5d, 0xfae: 0x239d, 0xfaf: 0x3c7d, - 0xfb0: 0x3c9d, 0xfb1: 0x3939, 0xfb2: 0x3951, 0xfb3: 0x3969, 0xfb4: 0x3981, 0xfb5: 0x3999, - 0xfb6: 0x39b1, 0xfb7: 0x39c9, 0xfb8: 0x39e1, 0xfb9: 0x39f9, 0xfba: 0x3a11, 0xfbb: 0x3a29, - 0xfbc: 0x3a41, 0xfbd: 0x3a59, 0xfbe: 0x3a71, 0xfbf: 0x3a89, - // Block 0x3f, offset 0xfc0 - 0xfc0: 0x3aa1, 0xfc1: 0x3ac9, 0xfc2: 0x3af1, 0xfc3: 0x3b19, 0xfc4: 0x3b41, 0xfc5: 0x3b69, - 0xfc6: 0x3b91, 0xfc7: 0x3bb9, 0xfc8: 0x3be1, 0xfc9: 0x3c09, 0xfca: 0x3c39, 0xfcb: 0x3c69, - 0xfcc: 0x3c99, 0xfcd: 0x3cbd, 0xfce: 0x3cb1, 0xfcf: 0x3cdd, 0xfd0: 0x3cfd, 0xfd1: 0x3d15, - 0xfd2: 0x3d2d, 0xfd3: 0x3d45, 0xfd4: 0x3d5d, 0xfd5: 0x3d5d, 0xfd6: 0x3d45, 0xfd7: 0x3d75, - 0xfd8: 0x07bd, 0xfd9: 0x3d8d, 0xfda: 0x3da5, 0xfdb: 0x3dbd, 0xfdc: 0x3dd5, 0xfdd: 0x3ded, - 0xfde: 0x3e05, 0xfdf: 0x3e1d, 0xfe0: 0x3e35, 0xfe1: 0x3e4d, 0xfe2: 0x3e65, 0xfe3: 0x3e7d, - 0xfe4: 0x3e95, 0xfe5: 0x3e95, 0xfe6: 0x3ead, 0xfe7: 0x3ead, 0xfe8: 0x3ec5, 0xfe9: 0x3ec5, - 0xfea: 0x3edd, 0xfeb: 0x3ef5, 0xfec: 0x3f0d, 0xfed: 0x3f25, 0xfee: 0x3f3d, 0xfef: 0x3f3d, - 0xff0: 0x3f55, 0xff1: 0x3f55, 0xff2: 0x3f55, 0xff3: 0x3f6d, 0xff4: 0x3f85, 0xff5: 0x3f9d, - 0xff6: 0x3fb5, 0xff7: 0x3f9d, 0xff8: 0x3fcd, 0xff9: 0x3fe5, 0xffa: 0x3f6d, 0xffb: 0x3ffd, - 0xffc: 0x4015, 0xffd: 0x4015, 0xffe: 0x4015, 0xfff: 0x0040, - // Block 0x40, offset 0x1000 - 0x1000: 0x3cc9, 0x1001: 0x3d31, 0x1002: 0x3d99, 0x1003: 0x3e01, 0x1004: 0x3e51, 0x1005: 0x3eb9, - 0x1006: 0x3f09, 0x1007: 0x3f59, 0x1008: 0x3fd9, 0x1009: 0x4041, 0x100a: 0x4091, 0x100b: 0x40e1, - 0x100c: 0x4131, 0x100d: 0x4199, 0x100e: 0x4201, 0x100f: 0x4251, 0x1010: 0x42a1, 0x1011: 0x42d9, - 0x1012: 0x4329, 0x1013: 0x4391, 0x1014: 0x43f9, 0x1015: 0x4431, 0x1016: 0x44b1, 0x1017: 0x4549, - 0x1018: 0x45c9, 0x1019: 0x4619, 0x101a: 0x4699, 0x101b: 0x4719, 0x101c: 0x4781, 0x101d: 0x47d1, - 0x101e: 0x4821, 0x101f: 0x4871, 0x1020: 0x48d9, 0x1021: 0x4959, 0x1022: 0x49c1, 0x1023: 0x4a11, - 0x1024: 0x4a61, 0x1025: 0x4ab1, 0x1026: 0x4ae9, 0x1027: 0x4b21, 0x1028: 0x4b59, 0x1029: 0x4b91, - 0x102a: 0x4be1, 0x102b: 0x4c31, 0x102c: 0x4cb1, 0x102d: 0x4d01, 0x102e: 0x4d69, 0x102f: 0x4de9, - 0x1030: 0x4e39, 0x1031: 0x4e71, 0x1032: 0x4ea9, 0x1033: 0x4f29, 0x1034: 0x4f91, 0x1035: 0x5011, - 0x1036: 0x5061, 0x1037: 0x50e1, 0x1038: 0x5119, 0x1039: 0x5169, 0x103a: 0x51b9, 0x103b: 0x5209, - 0x103c: 0x5259, 0x103d: 0x52a9, 0x103e: 0x5311, 0x103f: 0x5361, - // Block 0x41, offset 0x1040 - 0x1040: 0x5399, 0x1041: 0x53e9, 0x1042: 0x5439, 0x1043: 0x5489, 0x1044: 0x54f1, 0x1045: 0x5541, - 0x1046: 0x5591, 0x1047: 0x55e1, 0x1048: 0x5661, 0x1049: 0x56c9, 0x104a: 0x5701, 0x104b: 0x5781, - 0x104c: 0x57b9, 0x104d: 0x5821, 0x104e: 0x5889, 0x104f: 0x58d9, 0x1050: 0x5929, 0x1051: 0x5979, - 0x1052: 0x59e1, 0x1053: 0x5a19, 0x1054: 0x5a69, 0x1055: 0x5ad1, 0x1056: 0x5b09, 0x1057: 0x5b89, - 0x1058: 0x5bd9, 0x1059: 0x5c01, 0x105a: 0x5c29, 0x105b: 0x5c51, 0x105c: 0x5c79, 0x105d: 0x5ca1, - 0x105e: 0x5cc9, 0x105f: 0x5cf1, 0x1060: 0x5d19, 0x1061: 0x5d41, 0x1062: 0x5d69, 0x1063: 0x5d99, - 0x1064: 0x5dc9, 0x1065: 0x5df9, 0x1066: 0x5e29, 0x1067: 0x5e59, 0x1068: 0x5e89, 0x1069: 0x5eb9, - 0x106a: 0x5ee9, 0x106b: 0x5f19, 0x106c: 0x5f49, 0x106d: 0x5f79, 0x106e: 0x5fa9, 0x106f: 0x5fd9, - 0x1070: 0x6009, 0x1071: 0x402d, 0x1072: 0x6039, 0x1073: 0x6051, 0x1074: 0x404d, 0x1075: 0x6069, - 0x1076: 0x6081, 0x1077: 0x6099, 0x1078: 0x406d, 0x1079: 0x406d, 0x107a: 0x60b1, 0x107b: 0x60c9, - 0x107c: 0x6101, 0x107d: 0x6139, 0x107e: 0x6171, 0x107f: 0x61a9, - // Block 0x42, offset 0x1080 - 0x1080: 0x6211, 0x1081: 0x6229, 0x1082: 0x408d, 0x1083: 0x6241, 0x1084: 0x6259, 0x1085: 0x6271, - 0x1086: 0x6289, 0x1087: 0x62a1, 0x1088: 0x40ad, 0x1089: 0x62b9, 0x108a: 0x62e1, 0x108b: 0x62f9, - 0x108c: 0x40cd, 0x108d: 0x40cd, 0x108e: 0x6311, 0x108f: 0x6329, 0x1090: 0x6341, 0x1091: 0x40ed, - 0x1092: 0x410d, 0x1093: 0x412d, 0x1094: 0x414d, 0x1095: 0x416d, 0x1096: 0x6359, 0x1097: 0x6371, - 0x1098: 0x6389, 0x1099: 0x63a1, 0x109a: 0x63b9, 0x109b: 0x418d, 0x109c: 0x63d1, 0x109d: 0x63e9, - 0x109e: 0x6401, 0x109f: 0x41ad, 0x10a0: 0x41cd, 0x10a1: 0x6419, 0x10a2: 0x41ed, 0x10a3: 0x420d, - 0x10a4: 0x422d, 0x10a5: 0x6431, 0x10a6: 0x424d, 0x10a7: 0x6449, 0x10a8: 0x6479, 0x10a9: 0x6211, - 0x10aa: 0x426d, 0x10ab: 0x428d, 0x10ac: 0x42ad, 0x10ad: 0x42cd, 0x10ae: 0x64b1, 0x10af: 0x64f1, - 0x10b0: 0x6539, 0x10b1: 0x6551, 0x10b2: 0x42ed, 0x10b3: 0x6569, 0x10b4: 0x6581, 0x10b5: 0x6599, - 0x10b6: 0x430d, 0x10b7: 0x65b1, 0x10b8: 0x65c9, 0x10b9: 0x65b1, 0x10ba: 0x65e1, 0x10bb: 0x65f9, - 0x10bc: 0x432d, 0x10bd: 0x6611, 0x10be: 0x6629, 0x10bf: 0x6611, - // Block 0x43, offset 0x10c0 - 0x10c0: 0x434d, 0x10c1: 0x436d, 0x10c2: 0x0040, 0x10c3: 0x6641, 0x10c4: 0x6659, 0x10c5: 0x6671, - 0x10c6: 0x6689, 0x10c7: 0x0040, 0x10c8: 0x66c1, 0x10c9: 0x66d9, 0x10ca: 0x66f1, 0x10cb: 0x6709, - 0x10cc: 0x6721, 0x10cd: 0x6739, 0x10ce: 0x6401, 0x10cf: 0x6751, 0x10d0: 0x6769, 0x10d1: 0x6781, - 0x10d2: 0x438d, 0x10d3: 0x6799, 0x10d4: 0x6289, 0x10d5: 0x43ad, 0x10d6: 0x43cd, 0x10d7: 0x67b1, - 0x10d8: 0x0040, 0x10d9: 0x43ed, 0x10da: 0x67c9, 0x10db: 0x67e1, 0x10dc: 0x67f9, 0x10dd: 0x6811, - 0x10de: 0x6829, 0x10df: 0x6859, 0x10e0: 0x6889, 0x10e1: 0x68b1, 0x10e2: 0x68d9, 0x10e3: 0x6901, - 0x10e4: 0x6929, 0x10e5: 0x6951, 0x10e6: 0x6979, 0x10e7: 0x69a1, 0x10e8: 0x69c9, 0x10e9: 0x69f1, - 0x10ea: 0x6a21, 0x10eb: 0x6a51, 0x10ec: 0x6a81, 0x10ed: 0x6ab1, 0x10ee: 0x6ae1, 0x10ef: 0x6b11, - 0x10f0: 0x6b41, 0x10f1: 0x6b71, 0x10f2: 0x6ba1, 0x10f3: 0x6bd1, 0x10f4: 0x6c01, 0x10f5: 0x6c31, - 0x10f6: 0x6c61, 0x10f7: 0x6c91, 0x10f8: 0x6cc1, 0x10f9: 0x6cf1, 0x10fa: 0x6d21, 0x10fb: 0x6d51, - 0x10fc: 0x6d81, 0x10fd: 0x6db1, 0x10fe: 0x6de1, 0x10ff: 0x440d, - // Block 0x44, offset 0x1100 - 0x1100: 0xe00d, 0x1101: 0x0008, 0x1102: 0xe00d, 0x1103: 0x0008, 0x1104: 0xe00d, 0x1105: 0x0008, - 0x1106: 0xe00d, 0x1107: 0x0008, 0x1108: 0xe00d, 0x1109: 0x0008, 0x110a: 0xe00d, 0x110b: 0x0008, - 0x110c: 0xe00d, 0x110d: 0x0008, 0x110e: 0xe00d, 0x110f: 0x0008, 0x1110: 0xe00d, 0x1111: 0x0008, - 0x1112: 0xe00d, 0x1113: 0x0008, 0x1114: 0xe00d, 0x1115: 0x0008, 0x1116: 0xe00d, 0x1117: 0x0008, - 0x1118: 0xe00d, 0x1119: 0x0008, 0x111a: 0xe00d, 0x111b: 0x0008, 0x111c: 0xe00d, 0x111d: 0x0008, - 0x111e: 0xe00d, 0x111f: 0x0008, 0x1120: 0xe00d, 0x1121: 0x0008, 0x1122: 0xe00d, 0x1123: 0x0008, - 0x1124: 0xe00d, 0x1125: 0x0008, 0x1126: 0xe00d, 0x1127: 0x0008, 0x1128: 0xe00d, 0x1129: 0x0008, - 0x112a: 0xe00d, 0x112b: 0x0008, 0x112c: 0xe00d, 0x112d: 0x0008, 0x112e: 0x0008, 0x112f: 0x3308, - 0x1130: 0x3318, 0x1131: 0x3318, 0x1132: 0x3318, 0x1133: 0x0018, 0x1134: 0x3308, 0x1135: 0x3308, - 0x1136: 0x3308, 0x1137: 0x3308, 0x1138: 0x3308, 0x1139: 0x3308, 0x113a: 0x3308, 0x113b: 0x3308, - 0x113c: 0x3308, 0x113d: 0x3308, 0x113e: 0x0018, 0x113f: 0x0008, - // Block 0x45, offset 0x1140 - 0x1140: 0xe00d, 0x1141: 0x0008, 0x1142: 0xe00d, 0x1143: 0x0008, 0x1144: 0xe00d, 0x1145: 0x0008, - 0x1146: 0xe00d, 0x1147: 0x0008, 0x1148: 0xe00d, 0x1149: 0x0008, 0x114a: 0xe00d, 0x114b: 0x0008, - 0x114c: 0xe00d, 0x114d: 0x0008, 0x114e: 0xe00d, 0x114f: 0x0008, 0x1150: 0xe00d, 0x1151: 0x0008, - 0x1152: 0xe00d, 0x1153: 0x0008, 0x1154: 0xe00d, 0x1155: 0x0008, 0x1156: 0xe00d, 0x1157: 0x0008, - 0x1158: 0xe00d, 0x1159: 0x0008, 0x115a: 0xe00d, 0x115b: 0x0008, 0x115c: 0x0ea1, 0x115d: 0x6e11, - 0x115e: 0x3308, 0x115f: 0x3308, 0x1160: 0x0008, 0x1161: 0x0008, 0x1162: 0x0008, 0x1163: 0x0008, - 0x1164: 0x0008, 0x1165: 0x0008, 0x1166: 0x0008, 0x1167: 0x0008, 0x1168: 0x0008, 0x1169: 0x0008, - 0x116a: 0x0008, 0x116b: 0x0008, 0x116c: 0x0008, 0x116d: 0x0008, 0x116e: 0x0008, 0x116f: 0x0008, - 0x1170: 0x0008, 0x1171: 0x0008, 0x1172: 0x0008, 0x1173: 0x0008, 0x1174: 0x0008, 0x1175: 0x0008, - 0x1176: 0x0008, 0x1177: 0x0008, 0x1178: 0x0008, 0x1179: 0x0008, 0x117a: 0x0008, 0x117b: 0x0008, - 0x117c: 0x0008, 0x117d: 0x0008, 0x117e: 0x0008, 0x117f: 0x0008, - // Block 0x46, offset 0x1180 - 0x1180: 0x0018, 0x1181: 0x0018, 0x1182: 0x0018, 0x1183: 0x0018, 0x1184: 0x0018, 0x1185: 0x0018, - 0x1186: 0x0018, 0x1187: 0x0018, 0x1188: 0x0018, 0x1189: 0x0018, 0x118a: 0x0018, 0x118b: 0x0018, - 0x118c: 0x0018, 0x118d: 0x0018, 0x118e: 0x0018, 0x118f: 0x0018, 0x1190: 0x0018, 0x1191: 0x0018, - 0x1192: 0x0018, 0x1193: 0x0018, 0x1194: 0x0018, 0x1195: 0x0018, 0x1196: 0x0018, 0x1197: 0x0008, - 0x1198: 0x0008, 0x1199: 0x0008, 0x119a: 0x0008, 0x119b: 0x0008, 0x119c: 0x0008, 0x119d: 0x0008, - 0x119e: 0x0008, 0x119f: 0x0008, 0x11a0: 0x0018, 0x11a1: 0x0018, 0x11a2: 0xe00d, 0x11a3: 0x0008, - 0x11a4: 0xe00d, 0x11a5: 0x0008, 0x11a6: 0xe00d, 0x11a7: 0x0008, 0x11a8: 0xe00d, 0x11a9: 0x0008, - 0x11aa: 0xe00d, 0x11ab: 0x0008, 0x11ac: 0xe00d, 0x11ad: 0x0008, 0x11ae: 0xe00d, 0x11af: 0x0008, - 0x11b0: 0x0008, 0x11b1: 0x0008, 0x11b2: 0xe00d, 0x11b3: 0x0008, 0x11b4: 0xe00d, 0x11b5: 0x0008, - 0x11b6: 0xe00d, 0x11b7: 0x0008, 0x11b8: 0xe00d, 0x11b9: 0x0008, 0x11ba: 0xe00d, 0x11bb: 0x0008, - 0x11bc: 0xe00d, 0x11bd: 0x0008, 0x11be: 0xe00d, 0x11bf: 0x0008, - // Block 0x47, offset 0x11c0 - 0x11c0: 0xe00d, 0x11c1: 0x0008, 0x11c2: 0xe00d, 0x11c3: 0x0008, 0x11c4: 0xe00d, 0x11c5: 0x0008, - 0x11c6: 0xe00d, 0x11c7: 0x0008, 0x11c8: 0xe00d, 0x11c9: 0x0008, 0x11ca: 0xe00d, 0x11cb: 0x0008, - 0x11cc: 0xe00d, 0x11cd: 0x0008, 0x11ce: 0xe00d, 0x11cf: 0x0008, 0x11d0: 0xe00d, 0x11d1: 0x0008, - 0x11d2: 0xe00d, 0x11d3: 0x0008, 0x11d4: 0xe00d, 0x11d5: 0x0008, 0x11d6: 0xe00d, 0x11d7: 0x0008, - 0x11d8: 0xe00d, 0x11d9: 0x0008, 0x11da: 0xe00d, 0x11db: 0x0008, 0x11dc: 0xe00d, 0x11dd: 0x0008, - 0x11de: 0xe00d, 0x11df: 0x0008, 0x11e0: 0xe00d, 0x11e1: 0x0008, 0x11e2: 0xe00d, 0x11e3: 0x0008, - 0x11e4: 0xe00d, 0x11e5: 0x0008, 0x11e6: 0xe00d, 0x11e7: 0x0008, 0x11e8: 0xe00d, 0x11e9: 0x0008, - 0x11ea: 0xe00d, 0x11eb: 0x0008, 0x11ec: 0xe00d, 0x11ed: 0x0008, 0x11ee: 0xe00d, 0x11ef: 0x0008, - 0x11f0: 0xe0fd, 0x11f1: 0x0008, 0x11f2: 0x0008, 0x11f3: 0x0008, 0x11f4: 0x0008, 0x11f5: 0x0008, - 0x11f6: 0x0008, 0x11f7: 0x0008, 0x11f8: 0x0008, 0x11f9: 0xe01d, 0x11fa: 0x0008, 0x11fb: 0xe03d, - 0x11fc: 0x0008, 0x11fd: 0x442d, 0x11fe: 0xe00d, 0x11ff: 0x0008, - // Block 0x48, offset 0x1200 - 0x1200: 0xe00d, 0x1201: 0x0008, 0x1202: 0xe00d, 0x1203: 0x0008, 0x1204: 0xe00d, 0x1205: 0x0008, - 0x1206: 0xe00d, 0x1207: 0x0008, 0x1208: 0x0008, 0x1209: 0x0018, 0x120a: 0x0018, 0x120b: 0xe03d, - 0x120c: 0x0008, 0x120d: 0x11d9, 0x120e: 0x0008, 0x120f: 0x0008, 0x1210: 0xe00d, 0x1211: 0x0008, - 0x1212: 0xe00d, 0x1213: 0x0008, 0x1214: 0x0008, 0x1215: 0x0008, 0x1216: 0xe00d, 0x1217: 0x0008, - 0x1218: 0xe00d, 0x1219: 0x0008, 0x121a: 0xe00d, 0x121b: 0x0008, 0x121c: 0xe00d, 0x121d: 0x0008, - 0x121e: 0xe00d, 0x121f: 0x0008, 0x1220: 0xe00d, 0x1221: 0x0008, 0x1222: 0xe00d, 0x1223: 0x0008, - 0x1224: 0xe00d, 0x1225: 0x0008, 0x1226: 0xe00d, 0x1227: 0x0008, 0x1228: 0xe00d, 0x1229: 0x0008, - 0x122a: 0x6e29, 0x122b: 0x1029, 0x122c: 0x11c1, 0x122d: 0x6e41, 0x122e: 0x1221, 0x122f: 0x0008, - 0x1230: 0x6e59, 0x1231: 0x6e71, 0x1232: 0x1239, 0x1233: 0x444d, 0x1234: 0xe00d, 0x1235: 0x0008, - 0x1236: 0xe00d, 0x1237: 0x0008, 0x1238: 0x0040, 0x1239: 0x0008, 0x123a: 0x0040, 0x123b: 0x0040, - 0x123c: 0x0040, 0x123d: 0x0040, 0x123e: 0x0040, 0x123f: 0x0040, - // Block 0x49, offset 0x1240 - 0x1240: 0x64d5, 0x1241: 0x64f5, 0x1242: 0x6515, 0x1243: 0x6535, 0x1244: 0x6555, 0x1245: 0x6575, - 0x1246: 0x6595, 0x1247: 0x65b5, 0x1248: 0x65d5, 0x1249: 0x65f5, 0x124a: 0x6615, 0x124b: 0x6635, - 0x124c: 0x6655, 0x124d: 0x6675, 0x124e: 0x0008, 0x124f: 0x0008, 0x1250: 0x6695, 0x1251: 0x0008, - 0x1252: 0x66b5, 0x1253: 0x0008, 0x1254: 0x0008, 0x1255: 0x66d5, 0x1256: 0x66f5, 0x1257: 0x6715, - 0x1258: 0x6735, 0x1259: 0x6755, 0x125a: 0x6775, 0x125b: 0x6795, 0x125c: 0x67b5, 0x125d: 0x67d5, - 0x125e: 0x67f5, 0x125f: 0x0008, 0x1260: 0x6815, 0x1261: 0x0008, 0x1262: 0x6835, 0x1263: 0x0008, - 0x1264: 0x0008, 0x1265: 0x6855, 0x1266: 0x6875, 0x1267: 0x0008, 0x1268: 0x0008, 0x1269: 0x0008, - 0x126a: 0x6895, 0x126b: 0x68b5, 0x126c: 0x68d5, 0x126d: 0x68f5, 0x126e: 0x6915, 0x126f: 0x6935, - 0x1270: 0x6955, 0x1271: 0x6975, 0x1272: 0x6995, 0x1273: 0x69b5, 0x1274: 0x69d5, 0x1275: 0x69f5, - 0x1276: 0x6a15, 0x1277: 0x6a35, 0x1278: 0x6a55, 0x1279: 0x6a75, 0x127a: 0x6a95, 0x127b: 0x6ab5, - 0x127c: 0x6ad5, 0x127d: 0x6af5, 0x127e: 0x6b15, 0x127f: 0x6b35, - // Block 0x4a, offset 0x1280 - 0x1280: 0x7a95, 0x1281: 0x7ab5, 0x1282: 0x7ad5, 0x1283: 0x7af5, 0x1284: 0x7b15, 0x1285: 0x7b35, - 0x1286: 0x7b55, 0x1287: 0x7b75, 0x1288: 0x7b95, 0x1289: 0x7bb5, 0x128a: 0x7bd5, 0x128b: 0x7bf5, - 0x128c: 0x7c15, 0x128d: 0x7c35, 0x128e: 0x7c55, 0x128f: 0x6ec9, 0x1290: 0x6ef1, 0x1291: 0x6f19, - 0x1292: 0x7c75, 0x1293: 0x7c95, 0x1294: 0x7cb5, 0x1295: 0x6f41, 0x1296: 0x6f69, 0x1297: 0x6f91, - 0x1298: 0x7cd5, 0x1299: 0x7cf5, 0x129a: 0x0040, 0x129b: 0x0040, 0x129c: 0x0040, 0x129d: 0x0040, - 0x129e: 0x0040, 0x129f: 0x0040, 0x12a0: 0x0040, 0x12a1: 0x0040, 0x12a2: 0x0040, 0x12a3: 0x0040, - 0x12a4: 0x0040, 0x12a5: 0x0040, 0x12a6: 0x0040, 0x12a7: 0x0040, 0x12a8: 0x0040, 0x12a9: 0x0040, - 0x12aa: 0x0040, 0x12ab: 0x0040, 0x12ac: 0x0040, 0x12ad: 0x0040, 0x12ae: 0x0040, 0x12af: 0x0040, - 0x12b0: 0x0040, 0x12b1: 0x0040, 0x12b2: 0x0040, 0x12b3: 0x0040, 0x12b4: 0x0040, 0x12b5: 0x0040, - 0x12b6: 0x0040, 0x12b7: 0x0040, 0x12b8: 0x0040, 0x12b9: 0x0040, 0x12ba: 0x0040, 0x12bb: 0x0040, - 0x12bc: 0x0040, 0x12bd: 0x0040, 0x12be: 0x0040, 0x12bf: 0x0040, - // Block 0x4b, offset 0x12c0 - 0x12c0: 0x6fb9, 0x12c1: 0x6fd1, 0x12c2: 0x6fe9, 0x12c3: 0x7d15, 0x12c4: 0x7d35, 0x12c5: 0x7001, - 0x12c6: 0x7001, 0x12c7: 0x0040, 0x12c8: 0x0040, 0x12c9: 0x0040, 0x12ca: 0x0040, 0x12cb: 0x0040, - 0x12cc: 0x0040, 0x12cd: 0x0040, 0x12ce: 0x0040, 0x12cf: 0x0040, 0x12d0: 0x0040, 0x12d1: 0x0040, - 0x12d2: 0x0040, 0x12d3: 0x7019, 0x12d4: 0x7041, 0x12d5: 0x7069, 0x12d6: 0x7091, 0x12d7: 0x70b9, - 0x12d8: 0x0040, 0x12d9: 0x0040, 0x12da: 0x0040, 0x12db: 0x0040, 0x12dc: 0x0040, 0x12dd: 0x70e1, - 0x12de: 0x3308, 0x12df: 0x7109, 0x12e0: 0x7131, 0x12e1: 0x20a9, 0x12e2: 0x20f1, 0x12e3: 0x7149, - 0x12e4: 0x7161, 0x12e5: 0x7179, 0x12e6: 0x7191, 0x12e7: 0x71a9, 0x12e8: 0x71c1, 0x12e9: 0x1fb2, - 0x12ea: 0x71d9, 0x12eb: 0x7201, 0x12ec: 0x7229, 0x12ed: 0x7261, 0x12ee: 0x7299, 0x12ef: 0x72c1, - 0x12f0: 0x72e9, 0x12f1: 0x7311, 0x12f2: 0x7339, 0x12f3: 0x7361, 0x12f4: 0x7389, 0x12f5: 0x73b1, - 0x12f6: 0x73d9, 0x12f7: 0x0040, 0x12f8: 0x7401, 0x12f9: 0x7429, 0x12fa: 0x7451, 0x12fb: 0x7479, - 0x12fc: 0x74a1, 0x12fd: 0x0040, 0x12fe: 0x74c9, 0x12ff: 0x0040, - // Block 0x4c, offset 0x1300 - 0x1300: 0x74f1, 0x1301: 0x7519, 0x1302: 0x0040, 0x1303: 0x7541, 0x1304: 0x7569, 0x1305: 0x0040, - 0x1306: 0x7591, 0x1307: 0x75b9, 0x1308: 0x75e1, 0x1309: 0x7609, 0x130a: 0x7631, 0x130b: 0x7659, - 0x130c: 0x7681, 0x130d: 0x76a9, 0x130e: 0x76d1, 0x130f: 0x76f9, 0x1310: 0x7721, 0x1311: 0x7721, - 0x1312: 0x7739, 0x1313: 0x7739, 0x1314: 0x7739, 0x1315: 0x7739, 0x1316: 0x7751, 0x1317: 0x7751, - 0x1318: 0x7751, 0x1319: 0x7751, 0x131a: 0x7769, 0x131b: 0x7769, 0x131c: 0x7769, 0x131d: 0x7769, - 0x131e: 0x7781, 0x131f: 0x7781, 0x1320: 0x7781, 0x1321: 0x7781, 0x1322: 0x7799, 0x1323: 0x7799, - 0x1324: 0x7799, 0x1325: 0x7799, 0x1326: 0x77b1, 0x1327: 0x77b1, 0x1328: 0x77b1, 0x1329: 0x77b1, - 0x132a: 0x77c9, 0x132b: 0x77c9, 0x132c: 0x77c9, 0x132d: 0x77c9, 0x132e: 0x77e1, 0x132f: 0x77e1, - 0x1330: 0x77e1, 0x1331: 0x77e1, 0x1332: 0x77f9, 0x1333: 0x77f9, 0x1334: 0x77f9, 0x1335: 0x77f9, - 0x1336: 0x7811, 0x1337: 0x7811, 0x1338: 0x7811, 0x1339: 0x7811, 0x133a: 0x7829, 0x133b: 0x7829, - 0x133c: 0x7829, 0x133d: 0x7829, 0x133e: 0x7841, 0x133f: 0x7841, - // Block 0x4d, offset 0x1340 - 0x1340: 0x7841, 0x1341: 0x7841, 0x1342: 0x7859, 0x1343: 0x7859, 0x1344: 0x7871, 0x1345: 0x7871, - 0x1346: 0x7889, 0x1347: 0x7889, 0x1348: 0x78a1, 0x1349: 0x78a1, 0x134a: 0x78b9, 0x134b: 0x78b9, - 0x134c: 0x78d1, 0x134d: 0x78d1, 0x134e: 0x78e9, 0x134f: 0x78e9, 0x1350: 0x78e9, 0x1351: 0x78e9, - 0x1352: 0x7901, 0x1353: 0x7901, 0x1354: 0x7901, 0x1355: 0x7901, 0x1356: 0x7919, 0x1357: 0x7919, - 0x1358: 0x7919, 0x1359: 0x7919, 0x135a: 0x7931, 0x135b: 0x7931, 0x135c: 0x7931, 0x135d: 0x7931, - 0x135e: 0x7949, 0x135f: 0x7949, 0x1360: 0x7961, 0x1361: 0x7961, 0x1362: 0x7961, 0x1363: 0x7961, - 0x1364: 0x7979, 0x1365: 0x7979, 0x1366: 0x7991, 0x1367: 0x7991, 0x1368: 0x7991, 0x1369: 0x7991, - 0x136a: 0x79a9, 0x136b: 0x79a9, 0x136c: 0x79a9, 0x136d: 0x79a9, 0x136e: 0x79c1, 0x136f: 0x79c1, - 0x1370: 0x79d9, 0x1371: 0x79d9, 0x1372: 0x0818, 0x1373: 0x0818, 0x1374: 0x0818, 0x1375: 0x0818, - 0x1376: 0x0818, 0x1377: 0x0818, 0x1378: 0x0818, 0x1379: 0x0818, 0x137a: 0x0818, 0x137b: 0x0818, - 0x137c: 0x0818, 0x137d: 0x0818, 0x137e: 0x0818, 0x137f: 0x0818, - // Block 0x4e, offset 0x1380 - 0x1380: 0x0818, 0x1381: 0x0818, 0x1382: 0x0040, 0x1383: 0x0040, 0x1384: 0x0040, 0x1385: 0x0040, - 0x1386: 0x0040, 0x1387: 0x0040, 0x1388: 0x0040, 0x1389: 0x0040, 0x138a: 0x0040, 0x138b: 0x0040, - 0x138c: 0x0040, 0x138d: 0x0040, 0x138e: 0x0040, 0x138f: 0x0040, 0x1390: 0x0040, 0x1391: 0x0040, - 0x1392: 0x0040, 0x1393: 0x79f1, 0x1394: 0x79f1, 0x1395: 0x79f1, 0x1396: 0x79f1, 0x1397: 0x7a09, - 0x1398: 0x7a09, 0x1399: 0x7a21, 0x139a: 0x7a21, 0x139b: 0x7a39, 0x139c: 0x7a39, 0x139d: 0x0479, - 0x139e: 0x7a51, 0x139f: 0x7a51, 0x13a0: 0x7a69, 0x13a1: 0x7a69, 0x13a2: 0x7a81, 0x13a3: 0x7a81, - 0x13a4: 0x7a99, 0x13a5: 0x7a99, 0x13a6: 0x7a99, 0x13a7: 0x7a99, 0x13a8: 0x7ab1, 0x13a9: 0x7ab1, - 0x13aa: 0x7ac9, 0x13ab: 0x7ac9, 0x13ac: 0x7af1, 0x13ad: 0x7af1, 0x13ae: 0x7b19, 0x13af: 0x7b19, - 0x13b0: 0x7b41, 0x13b1: 0x7b41, 0x13b2: 0x7b69, 0x13b3: 0x7b69, 0x13b4: 0x7b91, 0x13b5: 0x7b91, - 0x13b6: 0x7bb9, 0x13b7: 0x7bb9, 0x13b8: 0x7bb9, 0x13b9: 0x7be1, 0x13ba: 0x7be1, 0x13bb: 0x7be1, - 0x13bc: 0x7c09, 0x13bd: 0x7c09, 0x13be: 0x7c09, 0x13bf: 0x7c09, - // Block 0x4f, offset 0x13c0 - 0x13c0: 0x85f9, 0x13c1: 0x8621, 0x13c2: 0x8649, 0x13c3: 0x8671, 0x13c4: 0x8699, 0x13c5: 0x86c1, - 0x13c6: 0x86e9, 0x13c7: 0x8711, 0x13c8: 0x8739, 0x13c9: 0x8761, 0x13ca: 0x8789, 0x13cb: 0x87b1, - 0x13cc: 0x87d9, 0x13cd: 0x8801, 0x13ce: 0x8829, 0x13cf: 0x8851, 0x13d0: 0x8879, 0x13d1: 0x88a1, - 0x13d2: 0x88c9, 0x13d3: 0x88f1, 0x13d4: 0x8919, 0x13d5: 0x8941, 0x13d6: 0x8969, 0x13d7: 0x8991, - 0x13d8: 0x89b9, 0x13d9: 0x89e1, 0x13da: 0x8a09, 0x13db: 0x8a31, 0x13dc: 0x8a59, 0x13dd: 0x8a81, - 0x13de: 0x8aaa, 0x13df: 0x8ada, 0x13e0: 0x8b0a, 0x13e1: 0x8b3a, 0x13e2: 0x8b6a, 0x13e3: 0x8b9a, - 0x13e4: 0x8bc9, 0x13e5: 0x8bf1, 0x13e6: 0x7c71, 0x13e7: 0x8c19, 0x13e8: 0x7be1, 0x13e9: 0x7c99, - 0x13ea: 0x8c41, 0x13eb: 0x8c69, 0x13ec: 0x7d39, 0x13ed: 0x8c91, 0x13ee: 0x7d61, 0x13ef: 0x7d89, - 0x13f0: 0x8cb9, 0x13f1: 0x8ce1, 0x13f2: 0x7e29, 0x13f3: 0x8d09, 0x13f4: 0x7e51, 0x13f5: 0x7e79, - 0x13f6: 0x8d31, 0x13f7: 0x8d59, 0x13f8: 0x7ec9, 0x13f9: 0x8d81, 0x13fa: 0x7ef1, 0x13fb: 0x7f19, - 0x13fc: 0x83a1, 0x13fd: 0x83c9, 0x13fe: 0x8441, 0x13ff: 0x8469, - // Block 0x50, offset 0x1400 - 0x1400: 0x8491, 0x1401: 0x8531, 0x1402: 0x8559, 0x1403: 0x8581, 0x1404: 0x85a9, 0x1405: 0x8649, - 0x1406: 0x8671, 0x1407: 0x8699, 0x1408: 0x8da9, 0x1409: 0x8739, 0x140a: 0x8dd1, 0x140b: 0x8df9, - 0x140c: 0x8829, 0x140d: 0x8e21, 0x140e: 0x8851, 0x140f: 0x8879, 0x1410: 0x8a81, 0x1411: 0x8e49, - 0x1412: 0x8e71, 0x1413: 0x89b9, 0x1414: 0x8e99, 0x1415: 0x89e1, 0x1416: 0x8a09, 0x1417: 0x7c21, - 0x1418: 0x7c49, 0x1419: 0x8ec1, 0x141a: 0x7c71, 0x141b: 0x8ee9, 0x141c: 0x7cc1, 0x141d: 0x7ce9, - 0x141e: 0x7d11, 0x141f: 0x7d39, 0x1420: 0x8f11, 0x1421: 0x7db1, 0x1422: 0x7dd9, 0x1423: 0x7e01, - 0x1424: 0x7e29, 0x1425: 0x8f39, 0x1426: 0x7ec9, 0x1427: 0x7f41, 0x1428: 0x7f69, 0x1429: 0x7f91, - 0x142a: 0x7fb9, 0x142b: 0x7fe1, 0x142c: 0x8031, 0x142d: 0x8059, 0x142e: 0x8081, 0x142f: 0x80a9, - 0x1430: 0x80d1, 0x1431: 0x80f9, 0x1432: 0x8f61, 0x1433: 0x8121, 0x1434: 0x8149, 0x1435: 0x8171, - 0x1436: 0x8199, 0x1437: 0x81c1, 0x1438: 0x81e9, 0x1439: 0x8239, 0x143a: 0x8261, 0x143b: 0x8289, - 0x143c: 0x82b1, 0x143d: 0x82d9, 0x143e: 0x8301, 0x143f: 0x8329, - // Block 0x51, offset 0x1440 - 0x1440: 0x8351, 0x1441: 0x8379, 0x1442: 0x83f1, 0x1443: 0x8419, 0x1444: 0x84b9, 0x1445: 0x84e1, - 0x1446: 0x8509, 0x1447: 0x8531, 0x1448: 0x8559, 0x1449: 0x85d1, 0x144a: 0x85f9, 0x144b: 0x8621, - 0x144c: 0x8649, 0x144d: 0x8f89, 0x144e: 0x86c1, 0x144f: 0x86e9, 0x1450: 0x8711, 0x1451: 0x8739, - 0x1452: 0x87b1, 0x1453: 0x87d9, 0x1454: 0x8801, 0x1455: 0x8829, 0x1456: 0x8fb1, 0x1457: 0x88a1, - 0x1458: 0x88c9, 0x1459: 0x8fd9, 0x145a: 0x8941, 0x145b: 0x8969, 0x145c: 0x8991, 0x145d: 0x89b9, - 0x145e: 0x9001, 0x145f: 0x7c71, 0x1460: 0x8ee9, 0x1461: 0x7d39, 0x1462: 0x8f11, 0x1463: 0x7e29, - 0x1464: 0x8f39, 0x1465: 0x7ec9, 0x1466: 0x9029, 0x1467: 0x80d1, 0x1468: 0x9051, 0x1469: 0x9079, - 0x146a: 0x90a1, 0x146b: 0x8531, 0x146c: 0x8559, 0x146d: 0x8649, 0x146e: 0x8829, 0x146f: 0x8fb1, - 0x1470: 0x89b9, 0x1471: 0x9001, 0x1472: 0x90c9, 0x1473: 0x9101, 0x1474: 0x9139, 0x1475: 0x9171, - 0x1476: 0x9199, 0x1477: 0x91c1, 0x1478: 0x91e9, 0x1479: 0x9211, 0x147a: 0x9239, 0x147b: 0x9261, - 0x147c: 0x9289, 0x147d: 0x92b1, 0x147e: 0x92d9, 0x147f: 0x9301, - // Block 0x52, offset 0x1480 - 0x1480: 0x9329, 0x1481: 0x9351, 0x1482: 0x9379, 0x1483: 0x93a1, 0x1484: 0x93c9, 0x1485: 0x93f1, - 0x1486: 0x9419, 0x1487: 0x9441, 0x1488: 0x9469, 0x1489: 0x9491, 0x148a: 0x94b9, 0x148b: 0x94e1, - 0x148c: 0x9079, 0x148d: 0x9509, 0x148e: 0x9531, 0x148f: 0x9559, 0x1490: 0x9581, 0x1491: 0x9171, - 0x1492: 0x9199, 0x1493: 0x91c1, 0x1494: 0x91e9, 0x1495: 0x9211, 0x1496: 0x9239, 0x1497: 0x9261, - 0x1498: 0x9289, 0x1499: 0x92b1, 0x149a: 0x92d9, 0x149b: 0x9301, 0x149c: 0x9329, 0x149d: 0x9351, - 0x149e: 0x9379, 0x149f: 0x93a1, 0x14a0: 0x93c9, 0x14a1: 0x93f1, 0x14a2: 0x9419, 0x14a3: 0x9441, - 0x14a4: 0x9469, 0x14a5: 0x9491, 0x14a6: 0x94b9, 0x14a7: 0x94e1, 0x14a8: 0x9079, 0x14a9: 0x9509, - 0x14aa: 0x9531, 0x14ab: 0x9559, 0x14ac: 0x9581, 0x14ad: 0x9491, 0x14ae: 0x94b9, 0x14af: 0x94e1, - 0x14b0: 0x9079, 0x14b1: 0x9051, 0x14b2: 0x90a1, 0x14b3: 0x8211, 0x14b4: 0x8059, 0x14b5: 0x8081, - 0x14b6: 0x80a9, 0x14b7: 0x9491, 0x14b8: 0x94b9, 0x14b9: 0x94e1, 0x14ba: 0x8211, 0x14bb: 0x8239, - 0x14bc: 0x95a9, 0x14bd: 0x95a9, 0x14be: 0x0018, 0x14bf: 0x0018, - // Block 0x53, offset 0x14c0 - 0x14c0: 0x0040, 0x14c1: 0x0040, 0x14c2: 0x0040, 0x14c3: 0x0040, 0x14c4: 0x0040, 0x14c5: 0x0040, - 0x14c6: 0x0040, 0x14c7: 0x0040, 0x14c8: 0x0040, 0x14c9: 0x0040, 0x14ca: 0x0040, 0x14cb: 0x0040, - 0x14cc: 0x0040, 0x14cd: 0x0040, 0x14ce: 0x0040, 0x14cf: 0x0040, 0x14d0: 0x95d1, 0x14d1: 0x9609, - 0x14d2: 0x9609, 0x14d3: 0x9641, 0x14d4: 0x9679, 0x14d5: 0x96b1, 0x14d6: 0x96e9, 0x14d7: 0x9721, - 0x14d8: 0x9759, 0x14d9: 0x9759, 0x14da: 0x9791, 0x14db: 0x97c9, 0x14dc: 0x9801, 0x14dd: 0x9839, - 0x14de: 0x9871, 0x14df: 0x98a9, 0x14e0: 0x98a9, 0x14e1: 0x98e1, 0x14e2: 0x9919, 0x14e3: 0x9919, - 0x14e4: 0x9951, 0x14e5: 0x9951, 0x14e6: 0x9989, 0x14e7: 0x99c1, 0x14e8: 0x99c1, 0x14e9: 0x99f9, - 0x14ea: 0x9a31, 0x14eb: 0x9a31, 0x14ec: 0x9a69, 0x14ed: 0x9a69, 0x14ee: 0x9aa1, 0x14ef: 0x9ad9, - 0x14f0: 0x9ad9, 0x14f1: 0x9b11, 0x14f2: 0x9b11, 0x14f3: 0x9b49, 0x14f4: 0x9b81, 0x14f5: 0x9bb9, - 0x14f6: 0x9bf1, 0x14f7: 0x9bf1, 0x14f8: 0x9c29, 0x14f9: 0x9c61, 0x14fa: 0x9c99, 0x14fb: 0x9cd1, - 0x14fc: 0x9d09, 0x14fd: 0x9d09, 0x14fe: 0x9d41, 0x14ff: 0x9d79, - // Block 0x54, offset 0x1500 - 0x1500: 0xa949, 0x1501: 0xa981, 0x1502: 0xa9b9, 0x1503: 0xa8a1, 0x1504: 0x9bb9, 0x1505: 0x9989, - 0x1506: 0xa9f1, 0x1507: 0xaa29, 0x1508: 0x0040, 0x1509: 0x0040, 0x150a: 0x0040, 0x150b: 0x0040, - 0x150c: 0x0040, 0x150d: 0x0040, 0x150e: 0x0040, 0x150f: 0x0040, 0x1510: 0x0040, 0x1511: 0x0040, - 0x1512: 0x0040, 0x1513: 0x0040, 0x1514: 0x0040, 0x1515: 0x0040, 0x1516: 0x0040, 0x1517: 0x0040, - 0x1518: 0x0040, 0x1519: 0x0040, 0x151a: 0x0040, 0x151b: 0x0040, 0x151c: 0x0040, 0x151d: 0x0040, - 0x151e: 0x0040, 0x151f: 0x0040, 0x1520: 0x0040, 0x1521: 0x0040, 0x1522: 0x0040, 0x1523: 0x0040, - 0x1524: 0x0040, 0x1525: 0x0040, 0x1526: 0x0040, 0x1527: 0x0040, 0x1528: 0x0040, 0x1529: 0x0040, - 0x152a: 0x0040, 0x152b: 0x0040, 0x152c: 0x0040, 0x152d: 0x0040, 0x152e: 0x0040, 0x152f: 0x0040, - 0x1530: 0xaa61, 0x1531: 0xaa99, 0x1532: 0xaad1, 0x1533: 0xab19, 0x1534: 0xab61, 0x1535: 0xaba9, - 0x1536: 0xabf1, 0x1537: 0xac39, 0x1538: 0xac81, 0x1539: 0xacc9, 0x153a: 0xad02, 0x153b: 0xae12, - 0x153c: 0xae91, 0x153d: 0x0018, 0x153e: 0x0040, 0x153f: 0x0040, - // Block 0x55, offset 0x1540 - 0x1540: 0x33c0, 0x1541: 0x33c0, 0x1542: 0x33c0, 0x1543: 0x33c0, 0x1544: 0x33c0, 0x1545: 0x33c0, - 0x1546: 0x33c0, 0x1547: 0x33c0, 0x1548: 0x33c0, 0x1549: 0x33c0, 0x154a: 0x33c0, 0x154b: 0x33c0, - 0x154c: 0x33c0, 0x154d: 0x33c0, 0x154e: 0x33c0, 0x154f: 0x33c0, 0x1550: 0xaeda, 0x1551: 0x7d55, - 0x1552: 0x0040, 0x1553: 0xaeea, 0x1554: 0x03c2, 0x1555: 0xaefa, 0x1556: 0xaf0a, 0x1557: 0x7d75, - 0x1558: 0x7d95, 0x1559: 0x0040, 0x155a: 0x0040, 0x155b: 0x0040, 0x155c: 0x0040, 0x155d: 0x0040, - 0x155e: 0x0040, 0x155f: 0x0040, 0x1560: 0x3308, 0x1561: 0x3308, 0x1562: 0x3308, 0x1563: 0x3308, - 0x1564: 0x3308, 0x1565: 0x3308, 0x1566: 0x3308, 0x1567: 0x3308, 0x1568: 0x3308, 0x1569: 0x3308, - 0x156a: 0x3308, 0x156b: 0x3308, 0x156c: 0x3308, 0x156d: 0x3308, 0x156e: 0x3308, 0x156f: 0x3308, - 0x1570: 0x0040, 0x1571: 0x7db5, 0x1572: 0x7dd5, 0x1573: 0xaf1a, 0x1574: 0xaf1a, 0x1575: 0x1fd2, - 0x1576: 0x1fe2, 0x1577: 0xaf2a, 0x1578: 0xaf3a, 0x1579: 0x7df5, 0x157a: 0x7e15, 0x157b: 0x7e35, - 0x157c: 0x7df5, 0x157d: 0x7e55, 0x157e: 0x7e75, 0x157f: 0x7e55, - // Block 0x56, offset 0x1580 - 0x1580: 0x7e95, 0x1581: 0x7eb5, 0x1582: 0x7ed5, 0x1583: 0x7eb5, 0x1584: 0x7ef5, 0x1585: 0x0018, - 0x1586: 0x0018, 0x1587: 0xaf4a, 0x1588: 0xaf5a, 0x1589: 0x7f16, 0x158a: 0x7f36, 0x158b: 0x7f56, - 0x158c: 0x7f76, 0x158d: 0xaf1a, 0x158e: 0xaf1a, 0x158f: 0xaf1a, 0x1590: 0xaeda, 0x1591: 0x7f95, - 0x1592: 0x0040, 0x1593: 0x0040, 0x1594: 0x03c2, 0x1595: 0xaeea, 0x1596: 0xaf0a, 0x1597: 0xaefa, - 0x1598: 0x7fb5, 0x1599: 0x1fd2, 0x159a: 0x1fe2, 0x159b: 0xaf2a, 0x159c: 0xaf3a, 0x159d: 0x7e95, - 0x159e: 0x7ef5, 0x159f: 0xaf6a, 0x15a0: 0xaf7a, 0x15a1: 0xaf8a, 0x15a2: 0x1fb2, 0x15a3: 0xaf99, - 0x15a4: 0xafaa, 0x15a5: 0xafba, 0x15a6: 0x1fc2, 0x15a7: 0x0040, 0x15a8: 0xafca, 0x15a9: 0xafda, - 0x15aa: 0xafea, 0x15ab: 0xaffa, 0x15ac: 0x0040, 0x15ad: 0x0040, 0x15ae: 0x0040, 0x15af: 0x0040, - 0x15b0: 0x7fd6, 0x15b1: 0xb009, 0x15b2: 0x7ff6, 0x15b3: 0x0808, 0x15b4: 0x8016, 0x15b5: 0x0040, - 0x15b6: 0x8036, 0x15b7: 0xb031, 0x15b8: 0x8056, 0x15b9: 0xb059, 0x15ba: 0x8076, 0x15bb: 0xb081, - 0x15bc: 0x8096, 0x15bd: 0xb0a9, 0x15be: 0x80b6, 0x15bf: 0xb0d1, - // Block 0x57, offset 0x15c0 - 0x15c0: 0xb0f9, 0x15c1: 0xb111, 0x15c2: 0xb111, 0x15c3: 0xb129, 0x15c4: 0xb129, 0x15c5: 0xb141, - 0x15c6: 0xb141, 0x15c7: 0xb159, 0x15c8: 0xb159, 0x15c9: 0xb171, 0x15ca: 0xb171, 0x15cb: 0xb171, - 0x15cc: 0xb171, 0x15cd: 0xb189, 0x15ce: 0xb189, 0x15cf: 0xb1a1, 0x15d0: 0xb1a1, 0x15d1: 0xb1a1, - 0x15d2: 0xb1a1, 0x15d3: 0xb1b9, 0x15d4: 0xb1b9, 0x15d5: 0xb1d1, 0x15d6: 0xb1d1, 0x15d7: 0xb1d1, - 0x15d8: 0xb1d1, 0x15d9: 0xb1e9, 0x15da: 0xb1e9, 0x15db: 0xb1e9, 0x15dc: 0xb1e9, 0x15dd: 0xb201, - 0x15de: 0xb201, 0x15df: 0xb201, 0x15e0: 0xb201, 0x15e1: 0xb219, 0x15e2: 0xb219, 0x15e3: 0xb219, - 0x15e4: 0xb219, 0x15e5: 0xb231, 0x15e6: 0xb231, 0x15e7: 0xb231, 0x15e8: 0xb231, 0x15e9: 0xb249, - 0x15ea: 0xb249, 0x15eb: 0xb261, 0x15ec: 0xb261, 0x15ed: 0xb279, 0x15ee: 0xb279, 0x15ef: 0xb291, - 0x15f0: 0xb291, 0x15f1: 0xb2a9, 0x15f2: 0xb2a9, 0x15f3: 0xb2a9, 0x15f4: 0xb2a9, 0x15f5: 0xb2c1, - 0x15f6: 0xb2c1, 0x15f7: 0xb2c1, 0x15f8: 0xb2c1, 0x15f9: 0xb2d9, 0x15fa: 0xb2d9, 0x15fb: 0xb2d9, - 0x15fc: 0xb2d9, 0x15fd: 0xb2f1, 0x15fe: 0xb2f1, 0x15ff: 0xb2f1, - // Block 0x58, offset 0x1600 - 0x1600: 0xb2f1, 0x1601: 0xb309, 0x1602: 0xb309, 0x1603: 0xb309, 0x1604: 0xb309, 0x1605: 0xb321, - 0x1606: 0xb321, 0x1607: 0xb321, 0x1608: 0xb321, 0x1609: 0xb339, 0x160a: 0xb339, 0x160b: 0xb339, - 0x160c: 0xb339, 0x160d: 0xb351, 0x160e: 0xb351, 0x160f: 0xb351, 0x1610: 0xb351, 0x1611: 0xb369, - 0x1612: 0xb369, 0x1613: 0xb369, 0x1614: 0xb369, 0x1615: 0xb381, 0x1616: 0xb381, 0x1617: 0xb381, - 0x1618: 0xb381, 0x1619: 0xb399, 0x161a: 0xb399, 0x161b: 0xb399, 0x161c: 0xb399, 0x161d: 0xb3b1, - 0x161e: 0xb3b1, 0x161f: 0xb3b1, 0x1620: 0xb3b1, 0x1621: 0xb3c9, 0x1622: 0xb3c9, 0x1623: 0xb3c9, - 0x1624: 0xb3c9, 0x1625: 0xb3e1, 0x1626: 0xb3e1, 0x1627: 0xb3e1, 0x1628: 0xb3e1, 0x1629: 0xb3f9, - 0x162a: 0xb3f9, 0x162b: 0xb3f9, 0x162c: 0xb3f9, 0x162d: 0xb411, 0x162e: 0xb411, 0x162f: 0x7ab1, - 0x1630: 0x7ab1, 0x1631: 0xb429, 0x1632: 0xb429, 0x1633: 0xb429, 0x1634: 0xb429, 0x1635: 0xb441, - 0x1636: 0xb441, 0x1637: 0xb469, 0x1638: 0xb469, 0x1639: 0xb491, 0x163a: 0xb491, 0x163b: 0xb4b9, - 0x163c: 0xb4b9, 0x163d: 0x0040, 0x163e: 0x0040, 0x163f: 0x03c0, - // Block 0x59, offset 0x1640 - 0x1640: 0x0040, 0x1641: 0xaefa, 0x1642: 0xb4e2, 0x1643: 0xaf6a, 0x1644: 0xafda, 0x1645: 0xafea, - 0x1646: 0xaf7a, 0x1647: 0xb4f2, 0x1648: 0x1fd2, 0x1649: 0x1fe2, 0x164a: 0xaf8a, 0x164b: 0x1fb2, - 0x164c: 0xaeda, 0x164d: 0xaf99, 0x164e: 0x29d1, 0x164f: 0xb502, 0x1650: 0x1f41, 0x1651: 0x00c9, - 0x1652: 0x0069, 0x1653: 0x0079, 0x1654: 0x1f51, 0x1655: 0x1f61, 0x1656: 0x1f71, 0x1657: 0x1f81, - 0x1658: 0x1f91, 0x1659: 0x1fa1, 0x165a: 0xaeea, 0x165b: 0x03c2, 0x165c: 0xafaa, 0x165d: 0x1fc2, - 0x165e: 0xafba, 0x165f: 0xaf0a, 0x1660: 0xaffa, 0x1661: 0x0039, 0x1662: 0x0ee9, 0x1663: 0x1159, - 0x1664: 0x0ef9, 0x1665: 0x0f09, 0x1666: 0x1199, 0x1667: 0x0f31, 0x1668: 0x0249, 0x1669: 0x0f41, - 0x166a: 0x0259, 0x166b: 0x0f51, 0x166c: 0x0359, 0x166d: 0x0f61, 0x166e: 0x0f71, 0x166f: 0x00d9, - 0x1670: 0x0f99, 0x1671: 0x2039, 0x1672: 0x0269, 0x1673: 0x01d9, 0x1674: 0x0fa9, 0x1675: 0x0fb9, - 0x1676: 0x1089, 0x1677: 0x0279, 0x1678: 0x0369, 0x1679: 0x0289, 0x167a: 0x13d1, 0x167b: 0xaf4a, - 0x167c: 0xafca, 0x167d: 0xaf5a, 0x167e: 0xb512, 0x167f: 0xaf1a, - // Block 0x5a, offset 0x1680 - 0x1680: 0x1caa, 0x1681: 0x0039, 0x1682: 0x0ee9, 0x1683: 0x1159, 0x1684: 0x0ef9, 0x1685: 0x0f09, - 0x1686: 0x1199, 0x1687: 0x0f31, 0x1688: 0x0249, 0x1689: 0x0f41, 0x168a: 0x0259, 0x168b: 0x0f51, - 0x168c: 0x0359, 0x168d: 0x0f61, 0x168e: 0x0f71, 0x168f: 0x00d9, 0x1690: 0x0f99, 0x1691: 0x2039, - 0x1692: 0x0269, 0x1693: 0x01d9, 0x1694: 0x0fa9, 0x1695: 0x0fb9, 0x1696: 0x1089, 0x1697: 0x0279, - 0x1698: 0x0369, 0x1699: 0x0289, 0x169a: 0x13d1, 0x169b: 0xaf2a, 0x169c: 0xb522, 0x169d: 0xaf3a, - 0x169e: 0xb532, 0x169f: 0x80d5, 0x16a0: 0x80f5, 0x16a1: 0x29d1, 0x16a2: 0x8115, 0x16a3: 0x8115, - 0x16a4: 0x8135, 0x16a5: 0x8155, 0x16a6: 0x8175, 0x16a7: 0x8195, 0x16a8: 0x81b5, 0x16a9: 0x81d5, - 0x16aa: 0x81f5, 0x16ab: 0x8215, 0x16ac: 0x8235, 0x16ad: 0x8255, 0x16ae: 0x8275, 0x16af: 0x8295, - 0x16b0: 0x82b5, 0x16b1: 0x82d5, 0x16b2: 0x82f5, 0x16b3: 0x8315, 0x16b4: 0x8335, 0x16b5: 0x8355, - 0x16b6: 0x8375, 0x16b7: 0x8395, 0x16b8: 0x83b5, 0x16b9: 0x83d5, 0x16ba: 0x83f5, 0x16bb: 0x8415, - 0x16bc: 0x81b5, 0x16bd: 0x8435, 0x16be: 0x8455, 0x16bf: 0x8215, - // Block 0x5b, offset 0x16c0 - 0x16c0: 0x8475, 0x16c1: 0x8495, 0x16c2: 0x84b5, 0x16c3: 0x84d5, 0x16c4: 0x84f5, 0x16c5: 0x8515, - 0x16c6: 0x8535, 0x16c7: 0x8555, 0x16c8: 0x84d5, 0x16c9: 0x8575, 0x16ca: 0x84d5, 0x16cb: 0x8595, - 0x16cc: 0x8595, 0x16cd: 0x85b5, 0x16ce: 0x85b5, 0x16cf: 0x85d5, 0x16d0: 0x8515, 0x16d1: 0x85f5, - 0x16d2: 0x8615, 0x16d3: 0x85f5, 0x16d4: 0x8635, 0x16d5: 0x8615, 0x16d6: 0x8655, 0x16d7: 0x8655, - 0x16d8: 0x8675, 0x16d9: 0x8675, 0x16da: 0x8695, 0x16db: 0x8695, 0x16dc: 0x8615, 0x16dd: 0x8115, - 0x16de: 0x86b5, 0x16df: 0x86d5, 0x16e0: 0x0040, 0x16e1: 0x86f5, 0x16e2: 0x8715, 0x16e3: 0x8735, - 0x16e4: 0x8755, 0x16e5: 0x8735, 0x16e6: 0x8775, 0x16e7: 0x8795, 0x16e8: 0x87b5, 0x16e9: 0x87b5, - 0x16ea: 0x87d5, 0x16eb: 0x87d5, 0x16ec: 0x87f5, 0x16ed: 0x87f5, 0x16ee: 0x87d5, 0x16ef: 0x87d5, - 0x16f0: 0x8815, 0x16f1: 0x8835, 0x16f2: 0x8855, 0x16f3: 0x8875, 0x16f4: 0x8895, 0x16f5: 0x88b5, - 0x16f6: 0x88b5, 0x16f7: 0x88b5, 0x16f8: 0x88d5, 0x16f9: 0x88d5, 0x16fa: 0x88d5, 0x16fb: 0x88d5, - 0x16fc: 0x87b5, 0x16fd: 0x87b5, 0x16fe: 0x87b5, 0x16ff: 0x0040, - // Block 0x5c, offset 0x1700 - 0x1700: 0x0040, 0x1701: 0x0040, 0x1702: 0x8715, 0x1703: 0x86f5, 0x1704: 0x88f5, 0x1705: 0x86f5, - 0x1706: 0x8715, 0x1707: 0x86f5, 0x1708: 0x0040, 0x1709: 0x0040, 0x170a: 0x8915, 0x170b: 0x8715, - 0x170c: 0x8935, 0x170d: 0x88f5, 0x170e: 0x8935, 0x170f: 0x8715, 0x1710: 0x0040, 0x1711: 0x0040, - 0x1712: 0x8955, 0x1713: 0x8975, 0x1714: 0x8875, 0x1715: 0x8935, 0x1716: 0x88f5, 0x1717: 0x8935, - 0x1718: 0x0040, 0x1719: 0x0040, 0x171a: 0x8995, 0x171b: 0x89b5, 0x171c: 0x8995, 0x171d: 0x0040, - 0x171e: 0x0040, 0x171f: 0x0040, 0x1720: 0xb541, 0x1721: 0xb559, 0x1722: 0xb571, 0x1723: 0x89d6, - 0x1724: 0xb589, 0x1725: 0xb5a1, 0x1726: 0x89f5, 0x1727: 0x0040, 0x1728: 0x8a15, 0x1729: 0x8a35, - 0x172a: 0x8a55, 0x172b: 0x8a35, 0x172c: 0x8a75, 0x172d: 0x8a95, 0x172e: 0x8ab5, 0x172f: 0x0040, - 0x1730: 0x0040, 0x1731: 0x0040, 0x1732: 0x0040, 0x1733: 0x0040, 0x1734: 0x0040, 0x1735: 0x0040, - 0x1736: 0x0040, 0x1737: 0x0040, 0x1738: 0x0040, 0x1739: 0x0340, 0x173a: 0x0340, 0x173b: 0x0340, - 0x173c: 0x0040, 0x173d: 0x0040, 0x173e: 0x0040, 0x173f: 0x0040, - // Block 0x5d, offset 0x1740 - 0x1740: 0x0a08, 0x1741: 0x0a08, 0x1742: 0x0a08, 0x1743: 0x0a08, 0x1744: 0x0a08, 0x1745: 0x0c08, - 0x1746: 0x0808, 0x1747: 0x0c08, 0x1748: 0x0818, 0x1749: 0x0c08, 0x174a: 0x0c08, 0x174b: 0x0808, - 0x174c: 0x0808, 0x174d: 0x0908, 0x174e: 0x0c08, 0x174f: 0x0c08, 0x1750: 0x0c08, 0x1751: 0x0c08, - 0x1752: 0x0c08, 0x1753: 0x0a08, 0x1754: 0x0a08, 0x1755: 0x0a08, 0x1756: 0x0a08, 0x1757: 0x0908, - 0x1758: 0x0a08, 0x1759: 0x0a08, 0x175a: 0x0a08, 0x175b: 0x0a08, 0x175c: 0x0a08, 0x175d: 0x0c08, - 0x175e: 0x0a08, 0x175f: 0x0a08, 0x1760: 0x0a08, 0x1761: 0x0c08, 0x1762: 0x0808, 0x1763: 0x0808, - 0x1764: 0x0c08, 0x1765: 0x3308, 0x1766: 0x3308, 0x1767: 0x0040, 0x1768: 0x0040, 0x1769: 0x0040, - 0x176a: 0x0040, 0x176b: 0x0a18, 0x176c: 0x0a18, 0x176d: 0x0a18, 0x176e: 0x0a18, 0x176f: 0x0c18, - 0x1770: 0x0818, 0x1771: 0x0818, 0x1772: 0x0818, 0x1773: 0x0818, 0x1774: 0x0818, 0x1775: 0x0818, - 0x1776: 0x0818, 0x1777: 0x0040, 0x1778: 0x0040, 0x1779: 0x0040, 0x177a: 0x0040, 0x177b: 0x0040, - 0x177c: 0x0040, 0x177d: 0x0040, 0x177e: 0x0040, 0x177f: 0x0040, - // Block 0x5e, offset 0x1780 - 0x1780: 0x0a08, 0x1781: 0x0c08, 0x1782: 0x0a08, 0x1783: 0x0c08, 0x1784: 0x0c08, 0x1785: 0x0c08, - 0x1786: 0x0a08, 0x1787: 0x0a08, 0x1788: 0x0a08, 0x1789: 0x0c08, 0x178a: 0x0a08, 0x178b: 0x0a08, - 0x178c: 0x0c08, 0x178d: 0x0a08, 0x178e: 0x0c08, 0x178f: 0x0c08, 0x1790: 0x0a08, 0x1791: 0x0c08, - 0x1792: 0x0040, 0x1793: 0x0040, 0x1794: 0x0040, 0x1795: 0x0040, 0x1796: 0x0040, 0x1797: 0x0040, - 0x1798: 0x0040, 0x1799: 0x0818, 0x179a: 0x0818, 0x179b: 0x0818, 0x179c: 0x0818, 0x179d: 0x0040, - 0x179e: 0x0040, 0x179f: 0x0040, 0x17a0: 0x0040, 0x17a1: 0x0040, 0x17a2: 0x0040, 0x17a3: 0x0040, - 0x17a4: 0x0040, 0x17a5: 0x0040, 0x17a6: 0x0040, 0x17a7: 0x0040, 0x17a8: 0x0040, 0x17a9: 0x0c18, - 0x17aa: 0x0c18, 0x17ab: 0x0c18, 0x17ac: 0x0c18, 0x17ad: 0x0a18, 0x17ae: 0x0a18, 0x17af: 0x0818, - 0x17b0: 0x0040, 0x17b1: 0x0040, 0x17b2: 0x0040, 0x17b3: 0x0040, 0x17b4: 0x0040, 0x17b5: 0x0040, - 0x17b6: 0x0040, 0x17b7: 0x0040, 0x17b8: 0x0040, 0x17b9: 0x0040, 0x17ba: 0x0040, 0x17bb: 0x0040, - 0x17bc: 0x0040, 0x17bd: 0x0040, 0x17be: 0x0040, 0x17bf: 0x0040, - // Block 0x5f, offset 0x17c0 - 0x17c0: 0x3308, 0x17c1: 0x3308, 0x17c2: 0x3008, 0x17c3: 0x3008, 0x17c4: 0x0040, 0x17c5: 0x0008, - 0x17c6: 0x0008, 0x17c7: 0x0008, 0x17c8: 0x0008, 0x17c9: 0x0008, 0x17ca: 0x0008, 0x17cb: 0x0008, - 0x17cc: 0x0008, 0x17cd: 0x0040, 0x17ce: 0x0040, 0x17cf: 0x0008, 0x17d0: 0x0008, 0x17d1: 0x0040, - 0x17d2: 0x0040, 0x17d3: 0x0008, 0x17d4: 0x0008, 0x17d5: 0x0008, 0x17d6: 0x0008, 0x17d7: 0x0008, - 0x17d8: 0x0008, 0x17d9: 0x0008, 0x17da: 0x0008, 0x17db: 0x0008, 0x17dc: 0x0008, 0x17dd: 0x0008, - 0x17de: 0x0008, 0x17df: 0x0008, 0x17e0: 0x0008, 0x17e1: 0x0008, 0x17e2: 0x0008, 0x17e3: 0x0008, - 0x17e4: 0x0008, 0x17e5: 0x0008, 0x17e6: 0x0008, 0x17e7: 0x0008, 0x17e8: 0x0008, 0x17e9: 0x0040, - 0x17ea: 0x0008, 0x17eb: 0x0008, 0x17ec: 0x0008, 0x17ed: 0x0008, 0x17ee: 0x0008, 0x17ef: 0x0008, - 0x17f0: 0x0008, 0x17f1: 0x0040, 0x17f2: 0x0008, 0x17f3: 0x0008, 0x17f4: 0x0040, 0x17f5: 0x0008, - 0x17f6: 0x0008, 0x17f7: 0x0008, 0x17f8: 0x0008, 0x17f9: 0x0008, 0x17fa: 0x0040, 0x17fb: 0x3308, - 0x17fc: 0x3308, 0x17fd: 0x0008, 0x17fe: 0x3008, 0x17ff: 0x3008, - // Block 0x60, offset 0x1800 - 0x1800: 0x3308, 0x1801: 0x3008, 0x1802: 0x3008, 0x1803: 0x3008, 0x1804: 0x3008, 0x1805: 0x0040, - 0x1806: 0x0040, 0x1807: 0x3008, 0x1808: 0x3008, 0x1809: 0x0040, 0x180a: 0x0040, 0x180b: 0x3008, - 0x180c: 0x3008, 0x180d: 0x3808, 0x180e: 0x0040, 0x180f: 0x0040, 0x1810: 0x0008, 0x1811: 0x0040, - 0x1812: 0x0040, 0x1813: 0x0040, 0x1814: 0x0040, 0x1815: 0x0040, 0x1816: 0x0040, 0x1817: 0x3008, - 0x1818: 0x0040, 0x1819: 0x0040, 0x181a: 0x0040, 0x181b: 0x0040, 0x181c: 0x0040, 0x181d: 0x0008, - 0x181e: 0x0008, 0x181f: 0x0008, 0x1820: 0x0008, 0x1821: 0x0008, 0x1822: 0x3008, 0x1823: 0x3008, - 0x1824: 0x0040, 0x1825: 0x0040, 0x1826: 0x3308, 0x1827: 0x3308, 0x1828: 0x3308, 0x1829: 0x3308, - 0x182a: 0x3308, 0x182b: 0x3308, 0x182c: 0x3308, 0x182d: 0x0040, 0x182e: 0x0040, 0x182f: 0x0040, - 0x1830: 0x3308, 0x1831: 0x3308, 0x1832: 0x3308, 0x1833: 0x3308, 0x1834: 0x3308, 0x1835: 0x0040, - 0x1836: 0x0040, 0x1837: 0x0040, 0x1838: 0x0040, 0x1839: 0x0040, 0x183a: 0x0040, 0x183b: 0x0040, - 0x183c: 0x0040, 0x183d: 0x0040, 0x183e: 0x0040, 0x183f: 0x0040, - // Block 0x61, offset 0x1840 - 0x1840: 0x0039, 0x1841: 0x0ee9, 0x1842: 0x1159, 0x1843: 0x0ef9, 0x1844: 0x0f09, 0x1845: 0x1199, - 0x1846: 0x0f31, 0x1847: 0x0249, 0x1848: 0x0f41, 0x1849: 0x0259, 0x184a: 0x0f51, 0x184b: 0x0359, - 0x184c: 0x0f61, 0x184d: 0x0f71, 0x184e: 0x00d9, 0x184f: 0x0f99, 0x1850: 0x2039, 0x1851: 0x0269, - 0x1852: 0x01d9, 0x1853: 0x0fa9, 0x1854: 0x0fb9, 0x1855: 0x1089, 0x1856: 0x0279, 0x1857: 0x0369, - 0x1858: 0x0289, 0x1859: 0x13d1, 0x185a: 0x0039, 0x185b: 0x0ee9, 0x185c: 0x1159, 0x185d: 0x0ef9, - 0x185e: 0x0f09, 0x185f: 0x1199, 0x1860: 0x0f31, 0x1861: 0x0249, 0x1862: 0x0f41, 0x1863: 0x0259, - 0x1864: 0x0f51, 0x1865: 0x0359, 0x1866: 0x0f61, 0x1867: 0x0f71, 0x1868: 0x00d9, 0x1869: 0x0f99, - 0x186a: 0x2039, 0x186b: 0x0269, 0x186c: 0x01d9, 0x186d: 0x0fa9, 0x186e: 0x0fb9, 0x186f: 0x1089, - 0x1870: 0x0279, 0x1871: 0x0369, 0x1872: 0x0289, 0x1873: 0x13d1, 0x1874: 0x0039, 0x1875: 0x0ee9, - 0x1876: 0x1159, 0x1877: 0x0ef9, 0x1878: 0x0f09, 0x1879: 0x1199, 0x187a: 0x0f31, 0x187b: 0x0249, - 0x187c: 0x0f41, 0x187d: 0x0259, 0x187e: 0x0f51, 0x187f: 0x0359, - // Block 0x62, offset 0x1880 - 0x1880: 0x0f61, 0x1881: 0x0f71, 0x1882: 0x00d9, 0x1883: 0x0f99, 0x1884: 0x2039, 0x1885: 0x0269, - 0x1886: 0x01d9, 0x1887: 0x0fa9, 0x1888: 0x0fb9, 0x1889: 0x1089, 0x188a: 0x0279, 0x188b: 0x0369, - 0x188c: 0x0289, 0x188d: 0x13d1, 0x188e: 0x0039, 0x188f: 0x0ee9, 0x1890: 0x1159, 0x1891: 0x0ef9, - 0x1892: 0x0f09, 0x1893: 0x1199, 0x1894: 0x0f31, 0x1895: 0x0040, 0x1896: 0x0f41, 0x1897: 0x0259, - 0x1898: 0x0f51, 0x1899: 0x0359, 0x189a: 0x0f61, 0x189b: 0x0f71, 0x189c: 0x00d9, 0x189d: 0x0f99, - 0x189e: 0x2039, 0x189f: 0x0269, 0x18a0: 0x01d9, 0x18a1: 0x0fa9, 0x18a2: 0x0fb9, 0x18a3: 0x1089, - 0x18a4: 0x0279, 0x18a5: 0x0369, 0x18a6: 0x0289, 0x18a7: 0x13d1, 0x18a8: 0x0039, 0x18a9: 0x0ee9, - 0x18aa: 0x1159, 0x18ab: 0x0ef9, 0x18ac: 0x0f09, 0x18ad: 0x1199, 0x18ae: 0x0f31, 0x18af: 0x0249, - 0x18b0: 0x0f41, 0x18b1: 0x0259, 0x18b2: 0x0f51, 0x18b3: 0x0359, 0x18b4: 0x0f61, 0x18b5: 0x0f71, - 0x18b6: 0x00d9, 0x18b7: 0x0f99, 0x18b8: 0x2039, 0x18b9: 0x0269, 0x18ba: 0x01d9, 0x18bb: 0x0fa9, - 0x18bc: 0x0fb9, 0x18bd: 0x1089, 0x18be: 0x0279, 0x18bf: 0x0369, - // Block 0x63, offset 0x18c0 - 0x18c0: 0x0289, 0x18c1: 0x13d1, 0x18c2: 0x0039, 0x18c3: 0x0ee9, 0x18c4: 0x1159, 0x18c5: 0x0ef9, - 0x18c6: 0x0f09, 0x18c7: 0x1199, 0x18c8: 0x0f31, 0x18c9: 0x0249, 0x18ca: 0x0f41, 0x18cb: 0x0259, - 0x18cc: 0x0f51, 0x18cd: 0x0359, 0x18ce: 0x0f61, 0x18cf: 0x0f71, 0x18d0: 0x00d9, 0x18d1: 0x0f99, - 0x18d2: 0x2039, 0x18d3: 0x0269, 0x18d4: 0x01d9, 0x18d5: 0x0fa9, 0x18d6: 0x0fb9, 0x18d7: 0x1089, - 0x18d8: 0x0279, 0x18d9: 0x0369, 0x18da: 0x0289, 0x18db: 0x13d1, 0x18dc: 0x0039, 0x18dd: 0x0040, - 0x18de: 0x1159, 0x18df: 0x0ef9, 0x18e0: 0x0040, 0x18e1: 0x0040, 0x18e2: 0x0f31, 0x18e3: 0x0040, - 0x18e4: 0x0040, 0x18e5: 0x0259, 0x18e6: 0x0f51, 0x18e7: 0x0040, 0x18e8: 0x0040, 0x18e9: 0x0f71, - 0x18ea: 0x00d9, 0x18eb: 0x0f99, 0x18ec: 0x2039, 0x18ed: 0x0040, 0x18ee: 0x01d9, 0x18ef: 0x0fa9, - 0x18f0: 0x0fb9, 0x18f1: 0x1089, 0x18f2: 0x0279, 0x18f3: 0x0369, 0x18f4: 0x0289, 0x18f5: 0x13d1, - 0x18f6: 0x0039, 0x18f7: 0x0ee9, 0x18f8: 0x1159, 0x18f9: 0x0ef9, 0x18fa: 0x0040, 0x18fb: 0x1199, - 0x18fc: 0x0040, 0x18fd: 0x0249, 0x18fe: 0x0f41, 0x18ff: 0x0259, - // Block 0x64, offset 0x1900 - 0x1900: 0x0f51, 0x1901: 0x0359, 0x1902: 0x0f61, 0x1903: 0x0f71, 0x1904: 0x0040, 0x1905: 0x0f99, - 0x1906: 0x2039, 0x1907: 0x0269, 0x1908: 0x01d9, 0x1909: 0x0fa9, 0x190a: 0x0fb9, 0x190b: 0x1089, - 0x190c: 0x0279, 0x190d: 0x0369, 0x190e: 0x0289, 0x190f: 0x13d1, 0x1910: 0x0039, 0x1911: 0x0ee9, - 0x1912: 0x1159, 0x1913: 0x0ef9, 0x1914: 0x0f09, 0x1915: 0x1199, 0x1916: 0x0f31, 0x1917: 0x0249, - 0x1918: 0x0f41, 0x1919: 0x0259, 0x191a: 0x0f51, 0x191b: 0x0359, 0x191c: 0x0f61, 0x191d: 0x0f71, - 0x191e: 0x00d9, 0x191f: 0x0f99, 0x1920: 0x2039, 0x1921: 0x0269, 0x1922: 0x01d9, 0x1923: 0x0fa9, - 0x1924: 0x0fb9, 0x1925: 0x1089, 0x1926: 0x0279, 0x1927: 0x0369, 0x1928: 0x0289, 0x1929: 0x13d1, - 0x192a: 0x0039, 0x192b: 0x0ee9, 0x192c: 0x1159, 0x192d: 0x0ef9, 0x192e: 0x0f09, 0x192f: 0x1199, - 0x1930: 0x0f31, 0x1931: 0x0249, 0x1932: 0x0f41, 0x1933: 0x0259, 0x1934: 0x0f51, 0x1935: 0x0359, - 0x1936: 0x0f61, 0x1937: 0x0f71, 0x1938: 0x00d9, 0x1939: 0x0f99, 0x193a: 0x2039, 0x193b: 0x0269, - 0x193c: 0x01d9, 0x193d: 0x0fa9, 0x193e: 0x0fb9, 0x193f: 0x1089, - // Block 0x65, offset 0x1940 - 0x1940: 0x0279, 0x1941: 0x0369, 0x1942: 0x0289, 0x1943: 0x13d1, 0x1944: 0x0039, 0x1945: 0x0ee9, - 0x1946: 0x0040, 0x1947: 0x0ef9, 0x1948: 0x0f09, 0x1949: 0x1199, 0x194a: 0x0f31, 0x194b: 0x0040, - 0x194c: 0x0040, 0x194d: 0x0259, 0x194e: 0x0f51, 0x194f: 0x0359, 0x1950: 0x0f61, 0x1951: 0x0f71, - 0x1952: 0x00d9, 0x1953: 0x0f99, 0x1954: 0x2039, 0x1955: 0x0040, 0x1956: 0x01d9, 0x1957: 0x0fa9, - 0x1958: 0x0fb9, 0x1959: 0x1089, 0x195a: 0x0279, 0x195b: 0x0369, 0x195c: 0x0289, 0x195d: 0x0040, - 0x195e: 0x0039, 0x195f: 0x0ee9, 0x1960: 0x1159, 0x1961: 0x0ef9, 0x1962: 0x0f09, 0x1963: 0x1199, - 0x1964: 0x0f31, 0x1965: 0x0249, 0x1966: 0x0f41, 0x1967: 0x0259, 0x1968: 0x0f51, 0x1969: 0x0359, - 0x196a: 0x0f61, 0x196b: 0x0f71, 0x196c: 0x00d9, 0x196d: 0x0f99, 0x196e: 0x2039, 0x196f: 0x0269, - 0x1970: 0x01d9, 0x1971: 0x0fa9, 0x1972: 0x0fb9, 0x1973: 0x1089, 0x1974: 0x0279, 0x1975: 0x0369, - 0x1976: 0x0289, 0x1977: 0x13d1, 0x1978: 0x0039, 0x1979: 0x0ee9, 0x197a: 0x0040, 0x197b: 0x0ef9, - 0x197c: 0x0f09, 0x197d: 0x1199, 0x197e: 0x0f31, 0x197f: 0x0040, - // Block 0x66, offset 0x1980 - 0x1980: 0x0f41, 0x1981: 0x0259, 0x1982: 0x0f51, 0x1983: 0x0359, 0x1984: 0x0f61, 0x1985: 0x0040, - 0x1986: 0x00d9, 0x1987: 0x0040, 0x1988: 0x0040, 0x1989: 0x0040, 0x198a: 0x01d9, 0x198b: 0x0fa9, - 0x198c: 0x0fb9, 0x198d: 0x1089, 0x198e: 0x0279, 0x198f: 0x0369, 0x1990: 0x0289, 0x1991: 0x0040, - 0x1992: 0x0039, 0x1993: 0x0ee9, 0x1994: 0x1159, 0x1995: 0x0ef9, 0x1996: 0x0f09, 0x1997: 0x1199, - 0x1998: 0x0f31, 0x1999: 0x0249, 0x199a: 0x0f41, 0x199b: 0x0259, 0x199c: 0x0f51, 0x199d: 0x0359, - 0x199e: 0x0f61, 0x199f: 0x0f71, 0x19a0: 0x00d9, 0x19a1: 0x0f99, 0x19a2: 0x2039, 0x19a3: 0x0269, - 0x19a4: 0x01d9, 0x19a5: 0x0fa9, 0x19a6: 0x0fb9, 0x19a7: 0x1089, 0x19a8: 0x0279, 0x19a9: 0x0369, - 0x19aa: 0x0289, 0x19ab: 0x13d1, 0x19ac: 0x0039, 0x19ad: 0x0ee9, 0x19ae: 0x1159, 0x19af: 0x0ef9, - 0x19b0: 0x0f09, 0x19b1: 0x1199, 0x19b2: 0x0f31, 0x19b3: 0x0249, 0x19b4: 0x0f41, 0x19b5: 0x0259, - 0x19b6: 0x0f51, 0x19b7: 0x0359, 0x19b8: 0x0f61, 0x19b9: 0x0f71, 0x19ba: 0x00d9, 0x19bb: 0x0f99, - 0x19bc: 0x2039, 0x19bd: 0x0269, 0x19be: 0x01d9, 0x19bf: 0x0fa9, - // Block 0x67, offset 0x19c0 - 0x19c0: 0x0fb9, 0x19c1: 0x1089, 0x19c2: 0x0279, 0x19c3: 0x0369, 0x19c4: 0x0289, 0x19c5: 0x13d1, - 0x19c6: 0x0039, 0x19c7: 0x0ee9, 0x19c8: 0x1159, 0x19c9: 0x0ef9, 0x19ca: 0x0f09, 0x19cb: 0x1199, - 0x19cc: 0x0f31, 0x19cd: 0x0249, 0x19ce: 0x0f41, 0x19cf: 0x0259, 0x19d0: 0x0f51, 0x19d1: 0x0359, - 0x19d2: 0x0f61, 0x19d3: 0x0f71, 0x19d4: 0x00d9, 0x19d5: 0x0f99, 0x19d6: 0x2039, 0x19d7: 0x0269, - 0x19d8: 0x01d9, 0x19d9: 0x0fa9, 0x19da: 0x0fb9, 0x19db: 0x1089, 0x19dc: 0x0279, 0x19dd: 0x0369, - 0x19de: 0x0289, 0x19df: 0x13d1, 0x19e0: 0x0039, 0x19e1: 0x0ee9, 0x19e2: 0x1159, 0x19e3: 0x0ef9, - 0x19e4: 0x0f09, 0x19e5: 0x1199, 0x19e6: 0x0f31, 0x19e7: 0x0249, 0x19e8: 0x0f41, 0x19e9: 0x0259, - 0x19ea: 0x0f51, 0x19eb: 0x0359, 0x19ec: 0x0f61, 0x19ed: 0x0f71, 0x19ee: 0x00d9, 0x19ef: 0x0f99, - 0x19f0: 0x2039, 0x19f1: 0x0269, 0x19f2: 0x01d9, 0x19f3: 0x0fa9, 0x19f4: 0x0fb9, 0x19f5: 0x1089, - 0x19f6: 0x0279, 0x19f7: 0x0369, 0x19f8: 0x0289, 0x19f9: 0x13d1, 0x19fa: 0x0039, 0x19fb: 0x0ee9, - 0x19fc: 0x1159, 0x19fd: 0x0ef9, 0x19fe: 0x0f09, 0x19ff: 0x1199, - // Block 0x68, offset 0x1a00 - 0x1a00: 0x0f31, 0x1a01: 0x0249, 0x1a02: 0x0f41, 0x1a03: 0x0259, 0x1a04: 0x0f51, 0x1a05: 0x0359, - 0x1a06: 0x0f61, 0x1a07: 0x0f71, 0x1a08: 0x00d9, 0x1a09: 0x0f99, 0x1a0a: 0x2039, 0x1a0b: 0x0269, - 0x1a0c: 0x01d9, 0x1a0d: 0x0fa9, 0x1a0e: 0x0fb9, 0x1a0f: 0x1089, 0x1a10: 0x0279, 0x1a11: 0x0369, - 0x1a12: 0x0289, 0x1a13: 0x13d1, 0x1a14: 0x0039, 0x1a15: 0x0ee9, 0x1a16: 0x1159, 0x1a17: 0x0ef9, - 0x1a18: 0x0f09, 0x1a19: 0x1199, 0x1a1a: 0x0f31, 0x1a1b: 0x0249, 0x1a1c: 0x0f41, 0x1a1d: 0x0259, - 0x1a1e: 0x0f51, 0x1a1f: 0x0359, 0x1a20: 0x0f61, 0x1a21: 0x0f71, 0x1a22: 0x00d9, 0x1a23: 0x0f99, - 0x1a24: 0x2039, 0x1a25: 0x0269, 0x1a26: 0x01d9, 0x1a27: 0x0fa9, 0x1a28: 0x0fb9, 0x1a29: 0x1089, - 0x1a2a: 0x0279, 0x1a2b: 0x0369, 0x1a2c: 0x0289, 0x1a2d: 0x13d1, 0x1a2e: 0x0039, 0x1a2f: 0x0ee9, - 0x1a30: 0x1159, 0x1a31: 0x0ef9, 0x1a32: 0x0f09, 0x1a33: 0x1199, 0x1a34: 0x0f31, 0x1a35: 0x0249, - 0x1a36: 0x0f41, 0x1a37: 0x0259, 0x1a38: 0x0f51, 0x1a39: 0x0359, 0x1a3a: 0x0f61, 0x1a3b: 0x0f71, - 0x1a3c: 0x00d9, 0x1a3d: 0x0f99, 0x1a3e: 0x2039, 0x1a3f: 0x0269, - // Block 0x69, offset 0x1a40 - 0x1a40: 0x01d9, 0x1a41: 0x0fa9, 0x1a42: 0x0fb9, 0x1a43: 0x1089, 0x1a44: 0x0279, 0x1a45: 0x0369, - 0x1a46: 0x0289, 0x1a47: 0x13d1, 0x1a48: 0x0039, 0x1a49: 0x0ee9, 0x1a4a: 0x1159, 0x1a4b: 0x0ef9, - 0x1a4c: 0x0f09, 0x1a4d: 0x1199, 0x1a4e: 0x0f31, 0x1a4f: 0x0249, 0x1a50: 0x0f41, 0x1a51: 0x0259, - 0x1a52: 0x0f51, 0x1a53: 0x0359, 0x1a54: 0x0f61, 0x1a55: 0x0f71, 0x1a56: 0x00d9, 0x1a57: 0x0f99, - 0x1a58: 0x2039, 0x1a59: 0x0269, 0x1a5a: 0x01d9, 0x1a5b: 0x0fa9, 0x1a5c: 0x0fb9, 0x1a5d: 0x1089, - 0x1a5e: 0x0279, 0x1a5f: 0x0369, 0x1a60: 0x0289, 0x1a61: 0x13d1, 0x1a62: 0x0039, 0x1a63: 0x0ee9, - 0x1a64: 0x1159, 0x1a65: 0x0ef9, 0x1a66: 0x0f09, 0x1a67: 0x1199, 0x1a68: 0x0f31, 0x1a69: 0x0249, - 0x1a6a: 0x0f41, 0x1a6b: 0x0259, 0x1a6c: 0x0f51, 0x1a6d: 0x0359, 0x1a6e: 0x0f61, 0x1a6f: 0x0f71, - 0x1a70: 0x00d9, 0x1a71: 0x0f99, 0x1a72: 0x2039, 0x1a73: 0x0269, 0x1a74: 0x01d9, 0x1a75: 0x0fa9, - 0x1a76: 0x0fb9, 0x1a77: 0x1089, 0x1a78: 0x0279, 0x1a79: 0x0369, 0x1a7a: 0x0289, 0x1a7b: 0x13d1, - 0x1a7c: 0x0039, 0x1a7d: 0x0ee9, 0x1a7e: 0x1159, 0x1a7f: 0x0ef9, - // Block 0x6a, offset 0x1a80 - 0x1a80: 0x0f09, 0x1a81: 0x1199, 0x1a82: 0x0f31, 0x1a83: 0x0249, 0x1a84: 0x0f41, 0x1a85: 0x0259, - 0x1a86: 0x0f51, 0x1a87: 0x0359, 0x1a88: 0x0f61, 0x1a89: 0x0f71, 0x1a8a: 0x00d9, 0x1a8b: 0x0f99, - 0x1a8c: 0x2039, 0x1a8d: 0x0269, 0x1a8e: 0x01d9, 0x1a8f: 0x0fa9, 0x1a90: 0x0fb9, 0x1a91: 0x1089, - 0x1a92: 0x0279, 0x1a93: 0x0369, 0x1a94: 0x0289, 0x1a95: 0x13d1, 0x1a96: 0x0039, 0x1a97: 0x0ee9, - 0x1a98: 0x1159, 0x1a99: 0x0ef9, 0x1a9a: 0x0f09, 0x1a9b: 0x1199, 0x1a9c: 0x0f31, 0x1a9d: 0x0249, - 0x1a9e: 0x0f41, 0x1a9f: 0x0259, 0x1aa0: 0x0f51, 0x1aa1: 0x0359, 0x1aa2: 0x0f61, 0x1aa3: 0x0f71, - 0x1aa4: 0x00d9, 0x1aa5: 0x0f99, 0x1aa6: 0x2039, 0x1aa7: 0x0269, 0x1aa8: 0x01d9, 0x1aa9: 0x0fa9, - 0x1aaa: 0x0fb9, 0x1aab: 0x1089, 0x1aac: 0x0279, 0x1aad: 0x0369, 0x1aae: 0x0289, 0x1aaf: 0x13d1, - 0x1ab0: 0x0039, 0x1ab1: 0x0ee9, 0x1ab2: 0x1159, 0x1ab3: 0x0ef9, 0x1ab4: 0x0f09, 0x1ab5: 0x1199, - 0x1ab6: 0x0f31, 0x1ab7: 0x0249, 0x1ab8: 0x0f41, 0x1ab9: 0x0259, 0x1aba: 0x0f51, 0x1abb: 0x0359, - 0x1abc: 0x0f61, 0x1abd: 0x0f71, 0x1abe: 0x00d9, 0x1abf: 0x0f99, - // Block 0x6b, offset 0x1ac0 - 0x1ac0: 0x2039, 0x1ac1: 0x0269, 0x1ac2: 0x01d9, 0x1ac3: 0x0fa9, 0x1ac4: 0x0fb9, 0x1ac5: 0x1089, - 0x1ac6: 0x0279, 0x1ac7: 0x0369, 0x1ac8: 0x0289, 0x1ac9: 0x13d1, 0x1aca: 0x0039, 0x1acb: 0x0ee9, - 0x1acc: 0x1159, 0x1acd: 0x0ef9, 0x1ace: 0x0f09, 0x1acf: 0x1199, 0x1ad0: 0x0f31, 0x1ad1: 0x0249, - 0x1ad2: 0x0f41, 0x1ad3: 0x0259, 0x1ad4: 0x0f51, 0x1ad5: 0x0359, 0x1ad6: 0x0f61, 0x1ad7: 0x0f71, - 0x1ad8: 0x00d9, 0x1ad9: 0x0f99, 0x1ada: 0x2039, 0x1adb: 0x0269, 0x1adc: 0x01d9, 0x1add: 0x0fa9, - 0x1ade: 0x0fb9, 0x1adf: 0x1089, 0x1ae0: 0x0279, 0x1ae1: 0x0369, 0x1ae2: 0x0289, 0x1ae3: 0x13d1, - 0x1ae4: 0xba81, 0x1ae5: 0xba99, 0x1ae6: 0x0040, 0x1ae7: 0x0040, 0x1ae8: 0xbab1, 0x1ae9: 0x1099, - 0x1aea: 0x10b1, 0x1aeb: 0x10c9, 0x1aec: 0xbac9, 0x1aed: 0xbae1, 0x1aee: 0xbaf9, 0x1aef: 0x1429, - 0x1af0: 0x1a31, 0x1af1: 0xbb11, 0x1af2: 0xbb29, 0x1af3: 0xbb41, 0x1af4: 0xbb59, 0x1af5: 0xbb71, - 0x1af6: 0xbb89, 0x1af7: 0x2109, 0x1af8: 0x1111, 0x1af9: 0x1429, 0x1afa: 0xbba1, 0x1afb: 0xbbb9, - 0x1afc: 0xbbd1, 0x1afd: 0x10e1, 0x1afe: 0x10f9, 0x1aff: 0xbbe9, - // Block 0x6c, offset 0x1b00 - 0x1b00: 0x2079, 0x1b01: 0xbc01, 0x1b02: 0xbab1, 0x1b03: 0x1099, 0x1b04: 0x10b1, 0x1b05: 0x10c9, - 0x1b06: 0xbac9, 0x1b07: 0xbae1, 0x1b08: 0xbaf9, 0x1b09: 0x1429, 0x1b0a: 0x1a31, 0x1b0b: 0xbb11, - 0x1b0c: 0xbb29, 0x1b0d: 0xbb41, 0x1b0e: 0xbb59, 0x1b0f: 0xbb71, 0x1b10: 0xbb89, 0x1b11: 0x2109, - 0x1b12: 0x1111, 0x1b13: 0xbba1, 0x1b14: 0xbba1, 0x1b15: 0xbbb9, 0x1b16: 0xbbd1, 0x1b17: 0x10e1, - 0x1b18: 0x10f9, 0x1b19: 0xbbe9, 0x1b1a: 0x2079, 0x1b1b: 0xbc21, 0x1b1c: 0xbac9, 0x1b1d: 0x1429, - 0x1b1e: 0xbb11, 0x1b1f: 0x10e1, 0x1b20: 0x1111, 0x1b21: 0x2109, 0x1b22: 0xbab1, 0x1b23: 0x1099, - 0x1b24: 0x10b1, 0x1b25: 0x10c9, 0x1b26: 0xbac9, 0x1b27: 0xbae1, 0x1b28: 0xbaf9, 0x1b29: 0x1429, - 0x1b2a: 0x1a31, 0x1b2b: 0xbb11, 0x1b2c: 0xbb29, 0x1b2d: 0xbb41, 0x1b2e: 0xbb59, 0x1b2f: 0xbb71, - 0x1b30: 0xbb89, 0x1b31: 0x2109, 0x1b32: 0x1111, 0x1b33: 0x1429, 0x1b34: 0xbba1, 0x1b35: 0xbbb9, - 0x1b36: 0xbbd1, 0x1b37: 0x10e1, 0x1b38: 0x10f9, 0x1b39: 0xbbe9, 0x1b3a: 0x2079, 0x1b3b: 0xbc01, - 0x1b3c: 0xbab1, 0x1b3d: 0x1099, 0x1b3e: 0x10b1, 0x1b3f: 0x10c9, - // Block 0x6d, offset 0x1b40 - 0x1b40: 0xbac9, 0x1b41: 0xbae1, 0x1b42: 0xbaf9, 0x1b43: 0x1429, 0x1b44: 0x1a31, 0x1b45: 0xbb11, - 0x1b46: 0xbb29, 0x1b47: 0xbb41, 0x1b48: 0xbb59, 0x1b49: 0xbb71, 0x1b4a: 0xbb89, 0x1b4b: 0x2109, - 0x1b4c: 0x1111, 0x1b4d: 0xbba1, 0x1b4e: 0xbba1, 0x1b4f: 0xbbb9, 0x1b50: 0xbbd1, 0x1b51: 0x10e1, - 0x1b52: 0x10f9, 0x1b53: 0xbbe9, 0x1b54: 0x2079, 0x1b55: 0xbc21, 0x1b56: 0xbac9, 0x1b57: 0x1429, - 0x1b58: 0xbb11, 0x1b59: 0x10e1, 0x1b5a: 0x1111, 0x1b5b: 0x2109, 0x1b5c: 0xbab1, 0x1b5d: 0x1099, - 0x1b5e: 0x10b1, 0x1b5f: 0x10c9, 0x1b60: 0xbac9, 0x1b61: 0xbae1, 0x1b62: 0xbaf9, 0x1b63: 0x1429, - 0x1b64: 0x1a31, 0x1b65: 0xbb11, 0x1b66: 0xbb29, 0x1b67: 0xbb41, 0x1b68: 0xbb59, 0x1b69: 0xbb71, - 0x1b6a: 0xbb89, 0x1b6b: 0x2109, 0x1b6c: 0x1111, 0x1b6d: 0x1429, 0x1b6e: 0xbba1, 0x1b6f: 0xbbb9, - 0x1b70: 0xbbd1, 0x1b71: 0x10e1, 0x1b72: 0x10f9, 0x1b73: 0xbbe9, 0x1b74: 0x2079, 0x1b75: 0xbc01, - 0x1b76: 0xbab1, 0x1b77: 0x1099, 0x1b78: 0x10b1, 0x1b79: 0x10c9, 0x1b7a: 0xbac9, 0x1b7b: 0xbae1, - 0x1b7c: 0xbaf9, 0x1b7d: 0x1429, 0x1b7e: 0x1a31, 0x1b7f: 0xbb11, - // Block 0x6e, offset 0x1b80 - 0x1b80: 0xbb29, 0x1b81: 0xbb41, 0x1b82: 0xbb59, 0x1b83: 0xbb71, 0x1b84: 0xbb89, 0x1b85: 0x2109, - 0x1b86: 0x1111, 0x1b87: 0xbba1, 0x1b88: 0xbba1, 0x1b89: 0xbbb9, 0x1b8a: 0xbbd1, 0x1b8b: 0x10e1, - 0x1b8c: 0x10f9, 0x1b8d: 0xbbe9, 0x1b8e: 0x2079, 0x1b8f: 0xbc21, 0x1b90: 0xbac9, 0x1b91: 0x1429, - 0x1b92: 0xbb11, 0x1b93: 0x10e1, 0x1b94: 0x1111, 0x1b95: 0x2109, 0x1b96: 0xbab1, 0x1b97: 0x1099, - 0x1b98: 0x10b1, 0x1b99: 0x10c9, 0x1b9a: 0xbac9, 0x1b9b: 0xbae1, 0x1b9c: 0xbaf9, 0x1b9d: 0x1429, - 0x1b9e: 0x1a31, 0x1b9f: 0xbb11, 0x1ba0: 0xbb29, 0x1ba1: 0xbb41, 0x1ba2: 0xbb59, 0x1ba3: 0xbb71, - 0x1ba4: 0xbb89, 0x1ba5: 0x2109, 0x1ba6: 0x1111, 0x1ba7: 0x1429, 0x1ba8: 0xbba1, 0x1ba9: 0xbbb9, - 0x1baa: 0xbbd1, 0x1bab: 0x10e1, 0x1bac: 0x10f9, 0x1bad: 0xbbe9, 0x1bae: 0x2079, 0x1baf: 0xbc01, - 0x1bb0: 0xbab1, 0x1bb1: 0x1099, 0x1bb2: 0x10b1, 0x1bb3: 0x10c9, 0x1bb4: 0xbac9, 0x1bb5: 0xbae1, - 0x1bb6: 0xbaf9, 0x1bb7: 0x1429, 0x1bb8: 0x1a31, 0x1bb9: 0xbb11, 0x1bba: 0xbb29, 0x1bbb: 0xbb41, - 0x1bbc: 0xbb59, 0x1bbd: 0xbb71, 0x1bbe: 0xbb89, 0x1bbf: 0x2109, - // Block 0x6f, offset 0x1bc0 - 0x1bc0: 0x1111, 0x1bc1: 0xbba1, 0x1bc2: 0xbba1, 0x1bc3: 0xbbb9, 0x1bc4: 0xbbd1, 0x1bc5: 0x10e1, - 0x1bc6: 0x10f9, 0x1bc7: 0xbbe9, 0x1bc8: 0x2079, 0x1bc9: 0xbc21, 0x1bca: 0xbac9, 0x1bcb: 0x1429, - 0x1bcc: 0xbb11, 0x1bcd: 0x10e1, 0x1bce: 0x1111, 0x1bcf: 0x2109, 0x1bd0: 0xbab1, 0x1bd1: 0x1099, - 0x1bd2: 0x10b1, 0x1bd3: 0x10c9, 0x1bd4: 0xbac9, 0x1bd5: 0xbae1, 0x1bd6: 0xbaf9, 0x1bd7: 0x1429, - 0x1bd8: 0x1a31, 0x1bd9: 0xbb11, 0x1bda: 0xbb29, 0x1bdb: 0xbb41, 0x1bdc: 0xbb59, 0x1bdd: 0xbb71, - 0x1bde: 0xbb89, 0x1bdf: 0x2109, 0x1be0: 0x1111, 0x1be1: 0x1429, 0x1be2: 0xbba1, 0x1be3: 0xbbb9, - 0x1be4: 0xbbd1, 0x1be5: 0x10e1, 0x1be6: 0x10f9, 0x1be7: 0xbbe9, 0x1be8: 0x2079, 0x1be9: 0xbc01, - 0x1bea: 0xbab1, 0x1beb: 0x1099, 0x1bec: 0x10b1, 0x1bed: 0x10c9, 0x1bee: 0xbac9, 0x1bef: 0xbae1, - 0x1bf0: 0xbaf9, 0x1bf1: 0x1429, 0x1bf2: 0x1a31, 0x1bf3: 0xbb11, 0x1bf4: 0xbb29, 0x1bf5: 0xbb41, - 0x1bf6: 0xbb59, 0x1bf7: 0xbb71, 0x1bf8: 0xbb89, 0x1bf9: 0x2109, 0x1bfa: 0x1111, 0x1bfb: 0xbba1, - 0x1bfc: 0xbba1, 0x1bfd: 0xbbb9, 0x1bfe: 0xbbd1, 0x1bff: 0x10e1, - // Block 0x70, offset 0x1c00 - 0x1c00: 0x10f9, 0x1c01: 0xbbe9, 0x1c02: 0x2079, 0x1c03: 0xbc21, 0x1c04: 0xbac9, 0x1c05: 0x1429, - 0x1c06: 0xbb11, 0x1c07: 0x10e1, 0x1c08: 0x1111, 0x1c09: 0x2109, 0x1c0a: 0xbc41, 0x1c0b: 0xbc41, - 0x1c0c: 0x0040, 0x1c0d: 0x0040, 0x1c0e: 0x1f41, 0x1c0f: 0x00c9, 0x1c10: 0x0069, 0x1c11: 0x0079, - 0x1c12: 0x1f51, 0x1c13: 0x1f61, 0x1c14: 0x1f71, 0x1c15: 0x1f81, 0x1c16: 0x1f91, 0x1c17: 0x1fa1, - 0x1c18: 0x1f41, 0x1c19: 0x00c9, 0x1c1a: 0x0069, 0x1c1b: 0x0079, 0x1c1c: 0x1f51, 0x1c1d: 0x1f61, - 0x1c1e: 0x1f71, 0x1c1f: 0x1f81, 0x1c20: 0x1f91, 0x1c21: 0x1fa1, 0x1c22: 0x1f41, 0x1c23: 0x00c9, - 0x1c24: 0x0069, 0x1c25: 0x0079, 0x1c26: 0x1f51, 0x1c27: 0x1f61, 0x1c28: 0x1f71, 0x1c29: 0x1f81, - 0x1c2a: 0x1f91, 0x1c2b: 0x1fa1, 0x1c2c: 0x1f41, 0x1c2d: 0x00c9, 0x1c2e: 0x0069, 0x1c2f: 0x0079, - 0x1c30: 0x1f51, 0x1c31: 0x1f61, 0x1c32: 0x1f71, 0x1c33: 0x1f81, 0x1c34: 0x1f91, 0x1c35: 0x1fa1, - 0x1c36: 0x1f41, 0x1c37: 0x00c9, 0x1c38: 0x0069, 0x1c39: 0x0079, 0x1c3a: 0x1f51, 0x1c3b: 0x1f61, - 0x1c3c: 0x1f71, 0x1c3d: 0x1f81, 0x1c3e: 0x1f91, 0x1c3f: 0x1fa1, - // Block 0x71, offset 0x1c40 - 0x1c40: 0xe115, 0x1c41: 0xe115, 0x1c42: 0xe135, 0x1c43: 0xe135, 0x1c44: 0xe115, 0x1c45: 0xe115, - 0x1c46: 0xe175, 0x1c47: 0xe175, 0x1c48: 0xe115, 0x1c49: 0xe115, 0x1c4a: 0xe135, 0x1c4b: 0xe135, - 0x1c4c: 0xe115, 0x1c4d: 0xe115, 0x1c4e: 0xe1f5, 0x1c4f: 0xe1f5, 0x1c50: 0xe115, 0x1c51: 0xe115, - 0x1c52: 0xe135, 0x1c53: 0xe135, 0x1c54: 0xe115, 0x1c55: 0xe115, 0x1c56: 0xe175, 0x1c57: 0xe175, - 0x1c58: 0xe115, 0x1c59: 0xe115, 0x1c5a: 0xe135, 0x1c5b: 0xe135, 0x1c5c: 0xe115, 0x1c5d: 0xe115, - 0x1c5e: 0x8b05, 0x1c5f: 0x8b05, 0x1c60: 0x04b5, 0x1c61: 0x04b5, 0x1c62: 0x0a08, 0x1c63: 0x0a08, - 0x1c64: 0x0a08, 0x1c65: 0x0a08, 0x1c66: 0x0a08, 0x1c67: 0x0a08, 0x1c68: 0x0a08, 0x1c69: 0x0a08, - 0x1c6a: 0x0a08, 0x1c6b: 0x0a08, 0x1c6c: 0x0a08, 0x1c6d: 0x0a08, 0x1c6e: 0x0a08, 0x1c6f: 0x0a08, - 0x1c70: 0x0a08, 0x1c71: 0x0a08, 0x1c72: 0x0a08, 0x1c73: 0x0a08, 0x1c74: 0x0a08, 0x1c75: 0x0a08, - 0x1c76: 0x0a08, 0x1c77: 0x0a08, 0x1c78: 0x0a08, 0x1c79: 0x0a08, 0x1c7a: 0x0a08, 0x1c7b: 0x0a08, - 0x1c7c: 0x0a08, 0x1c7d: 0x0a08, 0x1c7e: 0x0a08, 0x1c7f: 0x0a08, - // Block 0x72, offset 0x1c80 - 0x1c80: 0xb189, 0x1c81: 0xb1a1, 0x1c82: 0xb201, 0x1c83: 0xb249, 0x1c84: 0x0040, 0x1c85: 0xb411, - 0x1c86: 0xb291, 0x1c87: 0xb219, 0x1c88: 0xb309, 0x1c89: 0xb429, 0x1c8a: 0xb399, 0x1c8b: 0xb3b1, - 0x1c8c: 0xb3c9, 0x1c8d: 0xb3e1, 0x1c8e: 0xb2a9, 0x1c8f: 0xb339, 0x1c90: 0xb369, 0x1c91: 0xb2d9, - 0x1c92: 0xb381, 0x1c93: 0xb279, 0x1c94: 0xb2c1, 0x1c95: 0xb1d1, 0x1c96: 0xb1e9, 0x1c97: 0xb231, - 0x1c98: 0xb261, 0x1c99: 0xb2f1, 0x1c9a: 0xb321, 0x1c9b: 0xb351, 0x1c9c: 0xbc59, 0x1c9d: 0x7949, - 0x1c9e: 0xbc71, 0x1c9f: 0xbc89, 0x1ca0: 0x0040, 0x1ca1: 0xb1a1, 0x1ca2: 0xb201, 0x1ca3: 0x0040, - 0x1ca4: 0xb3f9, 0x1ca5: 0x0040, 0x1ca6: 0x0040, 0x1ca7: 0xb219, 0x1ca8: 0x0040, 0x1ca9: 0xb429, - 0x1caa: 0xb399, 0x1cab: 0xb3b1, 0x1cac: 0xb3c9, 0x1cad: 0xb3e1, 0x1cae: 0xb2a9, 0x1caf: 0xb339, - 0x1cb0: 0xb369, 0x1cb1: 0xb2d9, 0x1cb2: 0xb381, 0x1cb3: 0x0040, 0x1cb4: 0xb2c1, 0x1cb5: 0xb1d1, - 0x1cb6: 0xb1e9, 0x1cb7: 0xb231, 0x1cb8: 0x0040, 0x1cb9: 0xb2f1, 0x1cba: 0x0040, 0x1cbb: 0xb351, - 0x1cbc: 0x0040, 0x1cbd: 0x0040, 0x1cbe: 0x0040, 0x1cbf: 0x0040, - // Block 0x73, offset 0x1cc0 - 0x1cc0: 0x0040, 0x1cc1: 0x0040, 0x1cc2: 0xb201, 0x1cc3: 0x0040, 0x1cc4: 0x0040, 0x1cc5: 0x0040, - 0x1cc6: 0x0040, 0x1cc7: 0xb219, 0x1cc8: 0x0040, 0x1cc9: 0xb429, 0x1cca: 0x0040, 0x1ccb: 0xb3b1, - 0x1ccc: 0x0040, 0x1ccd: 0xb3e1, 0x1cce: 0xb2a9, 0x1ccf: 0xb339, 0x1cd0: 0x0040, 0x1cd1: 0xb2d9, - 0x1cd2: 0xb381, 0x1cd3: 0x0040, 0x1cd4: 0xb2c1, 0x1cd5: 0x0040, 0x1cd6: 0x0040, 0x1cd7: 0xb231, - 0x1cd8: 0x0040, 0x1cd9: 0xb2f1, 0x1cda: 0x0040, 0x1cdb: 0xb351, 0x1cdc: 0x0040, 0x1cdd: 0x7949, - 0x1cde: 0x0040, 0x1cdf: 0xbc89, 0x1ce0: 0x0040, 0x1ce1: 0xb1a1, 0x1ce2: 0xb201, 0x1ce3: 0x0040, - 0x1ce4: 0xb3f9, 0x1ce5: 0x0040, 0x1ce6: 0x0040, 0x1ce7: 0xb219, 0x1ce8: 0xb309, 0x1ce9: 0xb429, - 0x1cea: 0xb399, 0x1ceb: 0x0040, 0x1cec: 0xb3c9, 0x1ced: 0xb3e1, 0x1cee: 0xb2a9, 0x1cef: 0xb339, - 0x1cf0: 0xb369, 0x1cf1: 0xb2d9, 0x1cf2: 0xb381, 0x1cf3: 0x0040, 0x1cf4: 0xb2c1, 0x1cf5: 0xb1d1, - 0x1cf6: 0xb1e9, 0x1cf7: 0xb231, 0x1cf8: 0x0040, 0x1cf9: 0xb2f1, 0x1cfa: 0xb321, 0x1cfb: 0xb351, - 0x1cfc: 0xbc59, 0x1cfd: 0x0040, 0x1cfe: 0xbc71, 0x1cff: 0x0040, - // Block 0x74, offset 0x1d00 - 0x1d00: 0xb189, 0x1d01: 0xb1a1, 0x1d02: 0xb201, 0x1d03: 0xb249, 0x1d04: 0xb3f9, 0x1d05: 0xb411, - 0x1d06: 0xb291, 0x1d07: 0xb219, 0x1d08: 0xb309, 0x1d09: 0xb429, 0x1d0a: 0x0040, 0x1d0b: 0xb3b1, - 0x1d0c: 0xb3c9, 0x1d0d: 0xb3e1, 0x1d0e: 0xb2a9, 0x1d0f: 0xb339, 0x1d10: 0xb369, 0x1d11: 0xb2d9, - 0x1d12: 0xb381, 0x1d13: 0xb279, 0x1d14: 0xb2c1, 0x1d15: 0xb1d1, 0x1d16: 0xb1e9, 0x1d17: 0xb231, - 0x1d18: 0xb261, 0x1d19: 0xb2f1, 0x1d1a: 0xb321, 0x1d1b: 0xb351, 0x1d1c: 0x0040, 0x1d1d: 0x0040, - 0x1d1e: 0x0040, 0x1d1f: 0x0040, 0x1d20: 0x0040, 0x1d21: 0xb1a1, 0x1d22: 0xb201, 0x1d23: 0xb249, - 0x1d24: 0x0040, 0x1d25: 0xb411, 0x1d26: 0xb291, 0x1d27: 0xb219, 0x1d28: 0xb309, 0x1d29: 0xb429, - 0x1d2a: 0x0040, 0x1d2b: 0xb3b1, 0x1d2c: 0xb3c9, 0x1d2d: 0xb3e1, 0x1d2e: 0xb2a9, 0x1d2f: 0xb339, - 0x1d30: 0xb369, 0x1d31: 0xb2d9, 0x1d32: 0xb381, 0x1d33: 0xb279, 0x1d34: 0xb2c1, 0x1d35: 0xb1d1, - 0x1d36: 0xb1e9, 0x1d37: 0xb231, 0x1d38: 0xb261, 0x1d39: 0xb2f1, 0x1d3a: 0xb321, 0x1d3b: 0xb351, - 0x1d3c: 0x0040, 0x1d3d: 0x0040, 0x1d3e: 0x0040, 0x1d3f: 0x0040, - // Block 0x75, offset 0x1d40 - 0x1d40: 0x0040, 0x1d41: 0xbca2, 0x1d42: 0xbcba, 0x1d43: 0xbcd2, 0x1d44: 0xbcea, 0x1d45: 0xbd02, - 0x1d46: 0xbd1a, 0x1d47: 0xbd32, 0x1d48: 0xbd4a, 0x1d49: 0xbd62, 0x1d4a: 0xbd7a, 0x1d4b: 0x0018, - 0x1d4c: 0x0018, 0x1d4d: 0x0040, 0x1d4e: 0x0040, 0x1d4f: 0x0040, 0x1d50: 0xbd92, 0x1d51: 0xbdb2, - 0x1d52: 0xbdd2, 0x1d53: 0xbdf2, 0x1d54: 0xbe12, 0x1d55: 0xbe32, 0x1d56: 0xbe52, 0x1d57: 0xbe72, - 0x1d58: 0xbe92, 0x1d59: 0xbeb2, 0x1d5a: 0xbed2, 0x1d5b: 0xbef2, 0x1d5c: 0xbf12, 0x1d5d: 0xbf32, - 0x1d5e: 0xbf52, 0x1d5f: 0xbf72, 0x1d60: 0xbf92, 0x1d61: 0xbfb2, 0x1d62: 0xbfd2, 0x1d63: 0xbff2, - 0x1d64: 0xc012, 0x1d65: 0xc032, 0x1d66: 0xc052, 0x1d67: 0xc072, 0x1d68: 0xc092, 0x1d69: 0xc0b2, - 0x1d6a: 0xc0d1, 0x1d6b: 0x1159, 0x1d6c: 0x0269, 0x1d6d: 0x6671, 0x1d6e: 0xc111, 0x1d6f: 0x0018, - 0x1d70: 0x0039, 0x1d71: 0x0ee9, 0x1d72: 0x1159, 0x1d73: 0x0ef9, 0x1d74: 0x0f09, 0x1d75: 0x1199, - 0x1d76: 0x0f31, 0x1d77: 0x0249, 0x1d78: 0x0f41, 0x1d79: 0x0259, 0x1d7a: 0x0f51, 0x1d7b: 0x0359, - 0x1d7c: 0x0f61, 0x1d7d: 0x0f71, 0x1d7e: 0x00d9, 0x1d7f: 0x0f99, - // Block 0x76, offset 0x1d80 - 0x1d80: 0x2039, 0x1d81: 0x0269, 0x1d82: 0x01d9, 0x1d83: 0x0fa9, 0x1d84: 0x0fb9, 0x1d85: 0x1089, - 0x1d86: 0x0279, 0x1d87: 0x0369, 0x1d88: 0x0289, 0x1d89: 0x13d1, 0x1d8a: 0xc129, 0x1d8b: 0x65b1, - 0x1d8c: 0xc141, 0x1d8d: 0x1441, 0x1d8e: 0xc159, 0x1d8f: 0xc179, 0x1d90: 0x0018, 0x1d91: 0x0018, - 0x1d92: 0x0018, 0x1d93: 0x0018, 0x1d94: 0x0018, 0x1d95: 0x0018, 0x1d96: 0x0018, 0x1d97: 0x0018, - 0x1d98: 0x0018, 0x1d99: 0x0018, 0x1d9a: 0x0018, 0x1d9b: 0x0018, 0x1d9c: 0x0018, 0x1d9d: 0x0018, - 0x1d9e: 0x0018, 0x1d9f: 0x0018, 0x1da0: 0x0018, 0x1da1: 0x0018, 0x1da2: 0x0018, 0x1da3: 0x0018, - 0x1da4: 0x0018, 0x1da5: 0x0018, 0x1da6: 0x0018, 0x1da7: 0x0018, 0x1da8: 0x0018, 0x1da9: 0x0018, - 0x1daa: 0xc191, 0x1dab: 0xc1a9, 0x1dac: 0x0040, 0x1dad: 0x0040, 0x1dae: 0x0040, 0x1daf: 0x0040, - 0x1db0: 0x0018, 0x1db1: 0x0018, 0x1db2: 0x0018, 0x1db3: 0x0018, 0x1db4: 0x0018, 0x1db5: 0x0018, - 0x1db6: 0x0018, 0x1db7: 0x0018, 0x1db8: 0x0018, 0x1db9: 0x0018, 0x1dba: 0x0018, 0x1dbb: 0x0018, - 0x1dbc: 0x0018, 0x1dbd: 0x0018, 0x1dbe: 0x0018, 0x1dbf: 0x0018, - // Block 0x77, offset 0x1dc0 - 0x1dc0: 0xc1d9, 0x1dc1: 0xc211, 0x1dc2: 0xc249, 0x1dc3: 0x0040, 0x1dc4: 0x0040, 0x1dc5: 0x0040, - 0x1dc6: 0x0040, 0x1dc7: 0x0040, 0x1dc8: 0x0040, 0x1dc9: 0x0040, 0x1dca: 0x0040, 0x1dcb: 0x0040, - 0x1dcc: 0x0040, 0x1dcd: 0x0040, 0x1dce: 0x0040, 0x1dcf: 0x0040, 0x1dd0: 0xc269, 0x1dd1: 0xc289, - 0x1dd2: 0xc2a9, 0x1dd3: 0xc2c9, 0x1dd4: 0xc2e9, 0x1dd5: 0xc309, 0x1dd6: 0xc329, 0x1dd7: 0xc349, - 0x1dd8: 0xc369, 0x1dd9: 0xc389, 0x1dda: 0xc3a9, 0x1ddb: 0xc3c9, 0x1ddc: 0xc3e9, 0x1ddd: 0xc409, - 0x1dde: 0xc429, 0x1ddf: 0xc449, 0x1de0: 0xc469, 0x1de1: 0xc489, 0x1de2: 0xc4a9, 0x1de3: 0xc4c9, - 0x1de4: 0xc4e9, 0x1de5: 0xc509, 0x1de6: 0xc529, 0x1de7: 0xc549, 0x1de8: 0xc569, 0x1de9: 0xc589, - 0x1dea: 0xc5a9, 0x1deb: 0xc5c9, 0x1dec: 0xc5e9, 0x1ded: 0xc609, 0x1dee: 0xc629, 0x1def: 0xc649, - 0x1df0: 0xc669, 0x1df1: 0xc689, 0x1df2: 0xc6a9, 0x1df3: 0xc6c9, 0x1df4: 0xc6e9, 0x1df5: 0xc709, - 0x1df6: 0xc729, 0x1df7: 0xc749, 0x1df8: 0xc769, 0x1df9: 0xc789, 0x1dfa: 0xc7a9, 0x1dfb: 0xc7c9, - 0x1dfc: 0x0040, 0x1dfd: 0x0040, 0x1dfe: 0x0040, 0x1dff: 0x0040, - // Block 0x78, offset 0x1e00 - 0x1e00: 0xcaf9, 0x1e01: 0xcb19, 0x1e02: 0xcb39, 0x1e03: 0x8b1d, 0x1e04: 0xcb59, 0x1e05: 0xcb79, - 0x1e06: 0xcb99, 0x1e07: 0xcbb9, 0x1e08: 0xcbd9, 0x1e09: 0xcbf9, 0x1e0a: 0xcc19, 0x1e0b: 0xcc39, - 0x1e0c: 0xcc59, 0x1e0d: 0x8b3d, 0x1e0e: 0xcc79, 0x1e0f: 0xcc99, 0x1e10: 0xccb9, 0x1e11: 0xccd9, - 0x1e12: 0x8b5d, 0x1e13: 0xccf9, 0x1e14: 0xcd19, 0x1e15: 0xc429, 0x1e16: 0x8b7d, 0x1e17: 0xcd39, - 0x1e18: 0xcd59, 0x1e19: 0xcd79, 0x1e1a: 0xcd99, 0x1e1b: 0xcdb9, 0x1e1c: 0x8b9d, 0x1e1d: 0xcdd9, - 0x1e1e: 0xcdf9, 0x1e1f: 0xce19, 0x1e20: 0xce39, 0x1e21: 0xce59, 0x1e22: 0xc789, 0x1e23: 0xce79, - 0x1e24: 0xce99, 0x1e25: 0xceb9, 0x1e26: 0xced9, 0x1e27: 0xcef9, 0x1e28: 0xcf19, 0x1e29: 0xcf39, - 0x1e2a: 0xcf59, 0x1e2b: 0xcf79, 0x1e2c: 0xcf99, 0x1e2d: 0xcfb9, 0x1e2e: 0xcfd9, 0x1e2f: 0xcff9, - 0x1e30: 0xd019, 0x1e31: 0xd039, 0x1e32: 0xd039, 0x1e33: 0xd039, 0x1e34: 0x8bbd, 0x1e35: 0xd059, - 0x1e36: 0xd079, 0x1e37: 0xd099, 0x1e38: 0x8bdd, 0x1e39: 0xd0b9, 0x1e3a: 0xd0d9, 0x1e3b: 0xd0f9, - 0x1e3c: 0xd119, 0x1e3d: 0xd139, 0x1e3e: 0xd159, 0x1e3f: 0xd179, - // Block 0x79, offset 0x1e40 - 0x1e40: 0xd199, 0x1e41: 0xd1b9, 0x1e42: 0xd1d9, 0x1e43: 0xd1f9, 0x1e44: 0xd219, 0x1e45: 0xd239, - 0x1e46: 0xd239, 0x1e47: 0xd259, 0x1e48: 0xd279, 0x1e49: 0xd299, 0x1e4a: 0xd2b9, 0x1e4b: 0xd2d9, - 0x1e4c: 0xd2f9, 0x1e4d: 0xd319, 0x1e4e: 0xd339, 0x1e4f: 0xd359, 0x1e50: 0xd379, 0x1e51: 0xd399, - 0x1e52: 0xd3b9, 0x1e53: 0xd3d9, 0x1e54: 0xd3f9, 0x1e55: 0xd419, 0x1e56: 0xd439, 0x1e57: 0xd459, - 0x1e58: 0xd479, 0x1e59: 0x8bfd, 0x1e5a: 0xd499, 0x1e5b: 0xd4b9, 0x1e5c: 0xd4d9, 0x1e5d: 0xc309, - 0x1e5e: 0xd4f9, 0x1e5f: 0xd519, 0x1e60: 0x8c1d, 0x1e61: 0x8c3d, 0x1e62: 0xd539, 0x1e63: 0xd559, - 0x1e64: 0xd579, 0x1e65: 0xd599, 0x1e66: 0xd5b9, 0x1e67: 0xd5d9, 0x1e68: 0x2040, 0x1e69: 0xd5f9, - 0x1e6a: 0xd619, 0x1e6b: 0xd619, 0x1e6c: 0x8c5d, 0x1e6d: 0xd639, 0x1e6e: 0xd659, 0x1e6f: 0xd679, - 0x1e70: 0xd699, 0x1e71: 0x8c7d, 0x1e72: 0xd6b9, 0x1e73: 0xd6d9, 0x1e74: 0x2040, 0x1e75: 0xd6f9, - 0x1e76: 0xd719, 0x1e77: 0xd739, 0x1e78: 0xd759, 0x1e79: 0xd779, 0x1e7a: 0xd799, 0x1e7b: 0x8c9d, - 0x1e7c: 0xd7b9, 0x1e7d: 0x8cbd, 0x1e7e: 0xd7d9, 0x1e7f: 0xd7f9, - // Block 0x7a, offset 0x1e80 - 0x1e80: 0xd819, 0x1e81: 0xd839, 0x1e82: 0xd859, 0x1e83: 0xd879, 0x1e84: 0xd899, 0x1e85: 0xd8b9, - 0x1e86: 0xd8d9, 0x1e87: 0xd8f9, 0x1e88: 0xd919, 0x1e89: 0x8cdd, 0x1e8a: 0xd939, 0x1e8b: 0xd959, - 0x1e8c: 0xd979, 0x1e8d: 0xd999, 0x1e8e: 0xd9b9, 0x1e8f: 0x8cfd, 0x1e90: 0xd9d9, 0x1e91: 0x8d1d, - 0x1e92: 0x8d3d, 0x1e93: 0xd9f9, 0x1e94: 0xda19, 0x1e95: 0xda19, 0x1e96: 0xda39, 0x1e97: 0x8d5d, - 0x1e98: 0x8d7d, 0x1e99: 0xda59, 0x1e9a: 0xda79, 0x1e9b: 0xda99, 0x1e9c: 0xdab9, 0x1e9d: 0xdad9, - 0x1e9e: 0xdaf9, 0x1e9f: 0xdb19, 0x1ea0: 0xdb39, 0x1ea1: 0xdb59, 0x1ea2: 0xdb79, 0x1ea3: 0xdb99, - 0x1ea4: 0x8d9d, 0x1ea5: 0xdbb9, 0x1ea6: 0xdbd9, 0x1ea7: 0xdbf9, 0x1ea8: 0xdc19, 0x1ea9: 0xdbf9, - 0x1eaa: 0xdc39, 0x1eab: 0xdc59, 0x1eac: 0xdc79, 0x1ead: 0xdc99, 0x1eae: 0xdcb9, 0x1eaf: 0xdcd9, - 0x1eb0: 0xdcf9, 0x1eb1: 0xdd19, 0x1eb2: 0xdd39, 0x1eb3: 0xdd59, 0x1eb4: 0xdd79, 0x1eb5: 0xdd99, - 0x1eb6: 0xddb9, 0x1eb7: 0xddd9, 0x1eb8: 0x8dbd, 0x1eb9: 0xddf9, 0x1eba: 0xde19, 0x1ebb: 0xde39, - 0x1ebc: 0xde59, 0x1ebd: 0xde79, 0x1ebe: 0x8ddd, 0x1ebf: 0xde99, - // Block 0x7b, offset 0x1ec0 - 0x1ec0: 0xe599, 0x1ec1: 0xe5b9, 0x1ec2: 0xe5d9, 0x1ec3: 0xe5f9, 0x1ec4: 0xe619, 0x1ec5: 0xe639, - 0x1ec6: 0x8efd, 0x1ec7: 0xe659, 0x1ec8: 0xe679, 0x1ec9: 0xe699, 0x1eca: 0xe6b9, 0x1ecb: 0xe6d9, - 0x1ecc: 0xe6f9, 0x1ecd: 0x8f1d, 0x1ece: 0xe719, 0x1ecf: 0xe739, 0x1ed0: 0x8f3d, 0x1ed1: 0x8f5d, - 0x1ed2: 0xe759, 0x1ed3: 0xe779, 0x1ed4: 0xe799, 0x1ed5: 0xe7b9, 0x1ed6: 0xe7d9, 0x1ed7: 0xe7f9, - 0x1ed8: 0xe819, 0x1ed9: 0xe839, 0x1eda: 0xe859, 0x1edb: 0x8f7d, 0x1edc: 0xe879, 0x1edd: 0x8f9d, - 0x1ede: 0xe899, 0x1edf: 0x2040, 0x1ee0: 0xe8b9, 0x1ee1: 0xe8d9, 0x1ee2: 0xe8f9, 0x1ee3: 0x8fbd, - 0x1ee4: 0xe919, 0x1ee5: 0xe939, 0x1ee6: 0x8fdd, 0x1ee7: 0x8ffd, 0x1ee8: 0xe959, 0x1ee9: 0xe979, - 0x1eea: 0xe999, 0x1eeb: 0xe9b9, 0x1eec: 0xe9d9, 0x1eed: 0xe9d9, 0x1eee: 0xe9f9, 0x1eef: 0xea19, - 0x1ef0: 0xea39, 0x1ef1: 0xea59, 0x1ef2: 0xea79, 0x1ef3: 0xea99, 0x1ef4: 0xeab9, 0x1ef5: 0x901d, - 0x1ef6: 0xead9, 0x1ef7: 0x903d, 0x1ef8: 0xeaf9, 0x1ef9: 0x905d, 0x1efa: 0xeb19, 0x1efb: 0x907d, - 0x1efc: 0x909d, 0x1efd: 0x90bd, 0x1efe: 0xeb39, 0x1eff: 0xeb59, - // Block 0x7c, offset 0x1f00 - 0x1f00: 0xeb79, 0x1f01: 0x90dd, 0x1f02: 0x90fd, 0x1f03: 0x911d, 0x1f04: 0x913d, 0x1f05: 0xeb99, - 0x1f06: 0xebb9, 0x1f07: 0xebb9, 0x1f08: 0xebd9, 0x1f09: 0xebf9, 0x1f0a: 0xec19, 0x1f0b: 0xec39, - 0x1f0c: 0xec59, 0x1f0d: 0x915d, 0x1f0e: 0xec79, 0x1f0f: 0xec99, 0x1f10: 0xecb9, 0x1f11: 0xecd9, - 0x1f12: 0x917d, 0x1f13: 0xecf9, 0x1f14: 0x919d, 0x1f15: 0x91bd, 0x1f16: 0xed19, 0x1f17: 0xed39, - 0x1f18: 0xed59, 0x1f19: 0xed79, 0x1f1a: 0xed99, 0x1f1b: 0xedb9, 0x1f1c: 0x91dd, 0x1f1d: 0x91fd, - 0x1f1e: 0x921d, 0x1f1f: 0x2040, 0x1f20: 0xedd9, 0x1f21: 0x923d, 0x1f22: 0xedf9, 0x1f23: 0xee19, - 0x1f24: 0xee39, 0x1f25: 0x925d, 0x1f26: 0xee59, 0x1f27: 0xee79, 0x1f28: 0xee99, 0x1f29: 0xeeb9, - 0x1f2a: 0xeed9, 0x1f2b: 0x927d, 0x1f2c: 0xeef9, 0x1f2d: 0xef19, 0x1f2e: 0xef39, 0x1f2f: 0xef59, - 0x1f30: 0xef79, 0x1f31: 0xef99, 0x1f32: 0x929d, 0x1f33: 0x92bd, 0x1f34: 0xefb9, 0x1f35: 0x92dd, - 0x1f36: 0xefd9, 0x1f37: 0x92fd, 0x1f38: 0xeff9, 0x1f39: 0xf019, 0x1f3a: 0xf039, 0x1f3b: 0x931d, - 0x1f3c: 0x933d, 0x1f3d: 0xf059, 0x1f3e: 0x935d, 0x1f3f: 0xf079, - // Block 0x7d, offset 0x1f40 - 0x1f40: 0xf6b9, 0x1f41: 0xf6d9, 0x1f42: 0xf6f9, 0x1f43: 0xf719, 0x1f44: 0xf739, 0x1f45: 0x951d, - 0x1f46: 0xf759, 0x1f47: 0xf779, 0x1f48: 0xf799, 0x1f49: 0xf7b9, 0x1f4a: 0xf7d9, 0x1f4b: 0x953d, - 0x1f4c: 0x955d, 0x1f4d: 0xf7f9, 0x1f4e: 0xf819, 0x1f4f: 0xf839, 0x1f50: 0xf859, 0x1f51: 0xf879, - 0x1f52: 0xf899, 0x1f53: 0x957d, 0x1f54: 0xf8b9, 0x1f55: 0xf8d9, 0x1f56: 0xf8f9, 0x1f57: 0xf919, - 0x1f58: 0x959d, 0x1f59: 0x95bd, 0x1f5a: 0xf939, 0x1f5b: 0xf959, 0x1f5c: 0xf979, 0x1f5d: 0x95dd, - 0x1f5e: 0xf999, 0x1f5f: 0xf9b9, 0x1f60: 0x6815, 0x1f61: 0x95fd, 0x1f62: 0xf9d9, 0x1f63: 0xf9f9, - 0x1f64: 0xfa19, 0x1f65: 0x961d, 0x1f66: 0xfa39, 0x1f67: 0xfa59, 0x1f68: 0xfa79, 0x1f69: 0xfa99, - 0x1f6a: 0xfab9, 0x1f6b: 0xfad9, 0x1f6c: 0xfaf9, 0x1f6d: 0x963d, 0x1f6e: 0xfb19, 0x1f6f: 0xfb39, - 0x1f70: 0xfb59, 0x1f71: 0x965d, 0x1f72: 0xfb79, 0x1f73: 0xfb99, 0x1f74: 0xfbb9, 0x1f75: 0xfbd9, - 0x1f76: 0x7b35, 0x1f77: 0x967d, 0x1f78: 0xfbf9, 0x1f79: 0xfc19, 0x1f7a: 0xfc39, 0x1f7b: 0x969d, - 0x1f7c: 0xfc59, 0x1f7d: 0x96bd, 0x1f7e: 0xfc79, 0x1f7f: 0xfc79, - // Block 0x7e, offset 0x1f80 - 0x1f80: 0xfc99, 0x1f81: 0x96dd, 0x1f82: 0xfcb9, 0x1f83: 0xfcd9, 0x1f84: 0xfcf9, 0x1f85: 0xfd19, - 0x1f86: 0xfd39, 0x1f87: 0xfd59, 0x1f88: 0xfd79, 0x1f89: 0x96fd, 0x1f8a: 0xfd99, 0x1f8b: 0xfdb9, - 0x1f8c: 0xfdd9, 0x1f8d: 0xfdf9, 0x1f8e: 0xfe19, 0x1f8f: 0xfe39, 0x1f90: 0x971d, 0x1f91: 0xfe59, - 0x1f92: 0x973d, 0x1f93: 0x975d, 0x1f94: 0x977d, 0x1f95: 0xfe79, 0x1f96: 0xfe99, 0x1f97: 0xfeb9, - 0x1f98: 0xfed9, 0x1f99: 0xfef9, 0x1f9a: 0xff19, 0x1f9b: 0xff39, 0x1f9c: 0xff59, 0x1f9d: 0x979d, - 0x1f9e: 0x0040, 0x1f9f: 0x0040, 0x1fa0: 0x0040, 0x1fa1: 0x0040, 0x1fa2: 0x0040, 0x1fa3: 0x0040, - 0x1fa4: 0x0040, 0x1fa5: 0x0040, 0x1fa6: 0x0040, 0x1fa7: 0x0040, 0x1fa8: 0x0040, 0x1fa9: 0x0040, - 0x1faa: 0x0040, 0x1fab: 0x0040, 0x1fac: 0x0040, 0x1fad: 0x0040, 0x1fae: 0x0040, 0x1faf: 0x0040, - 0x1fb0: 0x0040, 0x1fb1: 0x0040, 0x1fb2: 0x0040, 0x1fb3: 0x0040, 0x1fb4: 0x0040, 0x1fb5: 0x0040, - 0x1fb6: 0x0040, 0x1fb7: 0x0040, 0x1fb8: 0x0040, 0x1fb9: 0x0040, 0x1fba: 0x0040, 0x1fbb: 0x0040, - 0x1fbc: 0x0040, 0x1fbd: 0x0040, 0x1fbe: 0x0040, 0x1fbf: 0x0040, -} - -// idnaIndex: 36 blocks, 2304 entries, 4608 bytes -// Block 0 is the zero block. -var idnaIndex = [2304]uint16{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x01, 0xc3: 0x7d, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x04, 0xc7: 0x05, - 0xc8: 0x06, 0xc9: 0x7e, 0xca: 0x7f, 0xcb: 0x07, 0xcc: 0x80, 0xcd: 0x08, 0xce: 0x09, 0xcf: 0x0a, - 0xd0: 0x81, 0xd1: 0x0b, 0xd2: 0x0c, 0xd3: 0x0d, 0xd4: 0x0e, 0xd5: 0x82, 0xd6: 0x83, 0xd7: 0x84, - 0xd8: 0x0f, 0xd9: 0x10, 0xda: 0x85, 0xdb: 0x11, 0xdc: 0x12, 0xdd: 0x86, 0xde: 0x87, 0xdf: 0x88, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe5: 0x07, 0xe6: 0x07, 0xe7: 0x07, - 0xe8: 0x07, 0xe9: 0x08, 0xea: 0x09, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x0a, 0xee: 0x0b, 0xef: 0x0c, - 0xf0: 0x1d, 0xf1: 0x1e, 0xf2: 0x1e, 0xf3: 0x20, 0xf4: 0x21, - // Block 0x4, offset 0x100 - 0x120: 0x89, 0x121: 0x13, 0x122: 0x8a, 0x123: 0x8b, 0x124: 0x8c, 0x125: 0x14, 0x126: 0x15, 0x127: 0x16, - 0x128: 0x17, 0x129: 0x18, 0x12a: 0x19, 0x12b: 0x1a, 0x12c: 0x1b, 0x12d: 0x1c, 0x12e: 0x1d, 0x12f: 0x8d, - 0x130: 0x8e, 0x131: 0x1e, 0x132: 0x1f, 0x133: 0x20, 0x134: 0x8f, 0x135: 0x21, 0x136: 0x90, 0x137: 0x91, - 0x138: 0x92, 0x139: 0x93, 0x13a: 0x22, 0x13b: 0x94, 0x13c: 0x95, 0x13d: 0x23, 0x13e: 0x24, 0x13f: 0x96, - // Block 0x5, offset 0x140 - 0x140: 0x97, 0x141: 0x98, 0x142: 0x99, 0x143: 0x9a, 0x144: 0x9b, 0x145: 0x9c, 0x146: 0x9d, 0x147: 0x9e, - 0x148: 0x9f, 0x149: 0xa0, 0x14a: 0xa1, 0x14b: 0xa2, 0x14c: 0xa3, 0x14d: 0xa4, 0x14e: 0xa5, 0x14f: 0xa6, - 0x150: 0xa7, 0x151: 0x9f, 0x152: 0x9f, 0x153: 0x9f, 0x154: 0x9f, 0x155: 0x9f, 0x156: 0x9f, 0x157: 0x9f, - 0x158: 0x9f, 0x159: 0xa8, 0x15a: 0xa9, 0x15b: 0xaa, 0x15c: 0xab, 0x15d: 0xac, 0x15e: 0xad, 0x15f: 0xae, - 0x160: 0xaf, 0x161: 0xb0, 0x162: 0xb1, 0x163: 0xb2, 0x164: 0xb3, 0x165: 0xb4, 0x166: 0xb5, 0x167: 0xb6, - 0x168: 0xb7, 0x169: 0xb8, 0x16a: 0xb9, 0x16b: 0xba, 0x16c: 0xbb, 0x16d: 0xbc, 0x16e: 0xbd, 0x16f: 0xbe, - 0x170: 0xbf, 0x171: 0xc0, 0x172: 0xc1, 0x173: 0xc2, 0x174: 0x25, 0x175: 0x26, 0x176: 0x27, 0x177: 0xc3, - 0x178: 0x28, 0x179: 0x28, 0x17a: 0x29, 0x17b: 0x28, 0x17c: 0xc4, 0x17d: 0x2a, 0x17e: 0x2b, 0x17f: 0x2c, - // Block 0x6, offset 0x180 - 0x180: 0x2d, 0x181: 0x2e, 0x182: 0x2f, 0x183: 0xc5, 0x184: 0x30, 0x185: 0x31, 0x186: 0xc6, 0x187: 0x9b, - 0x188: 0xc7, 0x189: 0xc8, 0x18a: 0x9b, 0x18b: 0x9b, 0x18c: 0xc9, 0x18d: 0x9b, 0x18e: 0x9b, 0x18f: 0x9b, - 0x190: 0xca, 0x191: 0x32, 0x192: 0x33, 0x193: 0x34, 0x194: 0x9b, 0x195: 0x9b, 0x196: 0x9b, 0x197: 0x9b, - 0x198: 0x9b, 0x199: 0x9b, 0x19a: 0x9b, 0x19b: 0x9b, 0x19c: 0x9b, 0x19d: 0x9b, 0x19e: 0x9b, 0x19f: 0x9b, - 0x1a0: 0x9b, 0x1a1: 0x9b, 0x1a2: 0x9b, 0x1a3: 0x9b, 0x1a4: 0x9b, 0x1a5: 0x9b, 0x1a6: 0x9b, 0x1a7: 0x9b, - 0x1a8: 0xcb, 0x1a9: 0xcc, 0x1aa: 0x9b, 0x1ab: 0xcd, 0x1ac: 0x9b, 0x1ad: 0xce, 0x1ae: 0xcf, 0x1af: 0xd0, - 0x1b0: 0xd1, 0x1b1: 0x35, 0x1b2: 0x28, 0x1b3: 0x36, 0x1b4: 0xd2, 0x1b5: 0xd3, 0x1b6: 0xd4, 0x1b7: 0xd5, - 0x1b8: 0xd6, 0x1b9: 0xd7, 0x1ba: 0xd8, 0x1bb: 0xd9, 0x1bc: 0xda, 0x1bd: 0xdb, 0x1be: 0xdc, 0x1bf: 0x37, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x38, 0x1c1: 0xdd, 0x1c2: 0xde, 0x1c3: 0xdf, 0x1c4: 0xe0, 0x1c5: 0x39, 0x1c6: 0x3a, 0x1c7: 0xe1, - 0x1c8: 0xe2, 0x1c9: 0x3b, 0x1ca: 0x3c, 0x1cb: 0x3d, 0x1cc: 0x3e, 0x1cd: 0x3f, 0x1ce: 0x40, 0x1cf: 0x41, - 0x1d0: 0x9f, 0x1d1: 0x9f, 0x1d2: 0x9f, 0x1d3: 0x9f, 0x1d4: 0x9f, 0x1d5: 0x9f, 0x1d6: 0x9f, 0x1d7: 0x9f, - 0x1d8: 0x9f, 0x1d9: 0x9f, 0x1da: 0x9f, 0x1db: 0x9f, 0x1dc: 0x9f, 0x1dd: 0x9f, 0x1de: 0x9f, 0x1df: 0x9f, - 0x1e0: 0x9f, 0x1e1: 0x9f, 0x1e2: 0x9f, 0x1e3: 0x9f, 0x1e4: 0x9f, 0x1e5: 0x9f, 0x1e6: 0x9f, 0x1e7: 0x9f, - 0x1e8: 0x9f, 0x1e9: 0x9f, 0x1ea: 0x9f, 0x1eb: 0x9f, 0x1ec: 0x9f, 0x1ed: 0x9f, 0x1ee: 0x9f, 0x1ef: 0x9f, - 0x1f0: 0x9f, 0x1f1: 0x9f, 0x1f2: 0x9f, 0x1f3: 0x9f, 0x1f4: 0x9f, 0x1f5: 0x9f, 0x1f6: 0x9f, 0x1f7: 0x9f, - 0x1f8: 0x9f, 0x1f9: 0x9f, 0x1fa: 0x9f, 0x1fb: 0x9f, 0x1fc: 0x9f, 0x1fd: 0x9f, 0x1fe: 0x9f, 0x1ff: 0x9f, - // Block 0x8, offset 0x200 - 0x200: 0x9f, 0x201: 0x9f, 0x202: 0x9f, 0x203: 0x9f, 0x204: 0x9f, 0x205: 0x9f, 0x206: 0x9f, 0x207: 0x9f, - 0x208: 0x9f, 0x209: 0x9f, 0x20a: 0x9f, 0x20b: 0x9f, 0x20c: 0x9f, 0x20d: 0x9f, 0x20e: 0x9f, 0x20f: 0x9f, - 0x210: 0x9f, 0x211: 0x9f, 0x212: 0x9f, 0x213: 0x9f, 0x214: 0x9f, 0x215: 0x9f, 0x216: 0x9f, 0x217: 0x9f, - 0x218: 0x9f, 0x219: 0x9f, 0x21a: 0x9f, 0x21b: 0x9f, 0x21c: 0x9f, 0x21d: 0x9f, 0x21e: 0x9f, 0x21f: 0x9f, - 0x220: 0x9f, 0x221: 0x9f, 0x222: 0x9f, 0x223: 0x9f, 0x224: 0x9f, 0x225: 0x9f, 0x226: 0x9f, 0x227: 0x9f, - 0x228: 0x9f, 0x229: 0x9f, 0x22a: 0x9f, 0x22b: 0x9f, 0x22c: 0x9f, 0x22d: 0x9f, 0x22e: 0x9f, 0x22f: 0x9f, - 0x230: 0x9f, 0x231: 0x9f, 0x232: 0x9f, 0x233: 0x9f, 0x234: 0x9f, 0x235: 0x9f, 0x236: 0xb2, 0x237: 0x9b, - 0x238: 0x9f, 0x239: 0x9f, 0x23a: 0x9f, 0x23b: 0x9f, 0x23c: 0x9f, 0x23d: 0x9f, 0x23e: 0x9f, 0x23f: 0x9f, - // Block 0x9, offset 0x240 - 0x240: 0x9f, 0x241: 0x9f, 0x242: 0x9f, 0x243: 0x9f, 0x244: 0x9f, 0x245: 0x9f, 0x246: 0x9f, 0x247: 0x9f, - 0x248: 0x9f, 0x249: 0x9f, 0x24a: 0x9f, 0x24b: 0x9f, 0x24c: 0x9f, 0x24d: 0x9f, 0x24e: 0x9f, 0x24f: 0x9f, - 0x250: 0x9f, 0x251: 0x9f, 0x252: 0x9f, 0x253: 0x9f, 0x254: 0x9f, 0x255: 0x9f, 0x256: 0x9f, 0x257: 0x9f, - 0x258: 0x9f, 0x259: 0x9f, 0x25a: 0x9f, 0x25b: 0x9f, 0x25c: 0x9f, 0x25d: 0x9f, 0x25e: 0x9f, 0x25f: 0x9f, - 0x260: 0x9f, 0x261: 0x9f, 0x262: 0x9f, 0x263: 0x9f, 0x264: 0x9f, 0x265: 0x9f, 0x266: 0x9f, 0x267: 0x9f, - 0x268: 0x9f, 0x269: 0x9f, 0x26a: 0x9f, 0x26b: 0x9f, 0x26c: 0x9f, 0x26d: 0x9f, 0x26e: 0x9f, 0x26f: 0x9f, - 0x270: 0x9f, 0x271: 0x9f, 0x272: 0x9f, 0x273: 0x9f, 0x274: 0x9f, 0x275: 0x9f, 0x276: 0x9f, 0x277: 0x9f, - 0x278: 0x9f, 0x279: 0x9f, 0x27a: 0x9f, 0x27b: 0x9f, 0x27c: 0x9f, 0x27d: 0x9f, 0x27e: 0x9f, 0x27f: 0x9f, - // Block 0xa, offset 0x280 - 0x280: 0x9f, 0x281: 0x9f, 0x282: 0x9f, 0x283: 0x9f, 0x284: 0x9f, 0x285: 0x9f, 0x286: 0x9f, 0x287: 0x9f, - 0x288: 0x9f, 0x289: 0x9f, 0x28a: 0x9f, 0x28b: 0x9f, 0x28c: 0x9f, 0x28d: 0x9f, 0x28e: 0x9f, 0x28f: 0x9f, - 0x290: 0x9f, 0x291: 0x9f, 0x292: 0x9f, 0x293: 0x9f, 0x294: 0x9f, 0x295: 0x9f, 0x296: 0x9f, 0x297: 0x9f, - 0x298: 0x9f, 0x299: 0x9f, 0x29a: 0x9f, 0x29b: 0x9f, 0x29c: 0x9f, 0x29d: 0x9f, 0x29e: 0x9f, 0x29f: 0x9f, - 0x2a0: 0x9f, 0x2a1: 0x9f, 0x2a2: 0x9f, 0x2a3: 0x9f, 0x2a4: 0x9f, 0x2a5: 0x9f, 0x2a6: 0x9f, 0x2a7: 0x9f, - 0x2a8: 0x9f, 0x2a9: 0x9f, 0x2aa: 0x9f, 0x2ab: 0x9f, 0x2ac: 0x9f, 0x2ad: 0x9f, 0x2ae: 0x9f, 0x2af: 0x9f, - 0x2b0: 0x9f, 0x2b1: 0x9f, 0x2b2: 0x9f, 0x2b3: 0x9f, 0x2b4: 0x9f, 0x2b5: 0x9f, 0x2b6: 0x9f, 0x2b7: 0x9f, - 0x2b8: 0x9f, 0x2b9: 0x9f, 0x2ba: 0x9f, 0x2bb: 0x9f, 0x2bc: 0x9f, 0x2bd: 0x9f, 0x2be: 0x9f, 0x2bf: 0xe3, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x9f, 0x2c1: 0x9f, 0x2c2: 0x9f, 0x2c3: 0x9f, 0x2c4: 0x9f, 0x2c5: 0x9f, 0x2c6: 0x9f, 0x2c7: 0x9f, - 0x2c8: 0x9f, 0x2c9: 0x9f, 0x2ca: 0x9f, 0x2cb: 0x9f, 0x2cc: 0x9f, 0x2cd: 0x9f, 0x2ce: 0x9f, 0x2cf: 0x9f, - 0x2d0: 0x9f, 0x2d1: 0x9f, 0x2d2: 0xe4, 0x2d3: 0xe5, 0x2d4: 0x9f, 0x2d5: 0x9f, 0x2d6: 0x9f, 0x2d7: 0x9f, - 0x2d8: 0xe6, 0x2d9: 0x42, 0x2da: 0x43, 0x2db: 0xe7, 0x2dc: 0x44, 0x2dd: 0x45, 0x2de: 0x46, 0x2df: 0xe8, - 0x2e0: 0xe9, 0x2e1: 0xea, 0x2e2: 0xeb, 0x2e3: 0xec, 0x2e4: 0xed, 0x2e5: 0xee, 0x2e6: 0xef, 0x2e7: 0xf0, - 0x2e8: 0xf1, 0x2e9: 0xf2, 0x2ea: 0xf3, 0x2eb: 0xf4, 0x2ec: 0xf5, 0x2ed: 0xf6, 0x2ee: 0xf7, 0x2ef: 0xf8, - 0x2f0: 0x9f, 0x2f1: 0x9f, 0x2f2: 0x9f, 0x2f3: 0x9f, 0x2f4: 0x9f, 0x2f5: 0x9f, 0x2f6: 0x9f, 0x2f7: 0x9f, - 0x2f8: 0x9f, 0x2f9: 0x9f, 0x2fa: 0x9f, 0x2fb: 0x9f, 0x2fc: 0x9f, 0x2fd: 0x9f, 0x2fe: 0x9f, 0x2ff: 0x9f, - // Block 0xc, offset 0x300 - 0x300: 0x9f, 0x301: 0x9f, 0x302: 0x9f, 0x303: 0x9f, 0x304: 0x9f, 0x305: 0x9f, 0x306: 0x9f, 0x307: 0x9f, - 0x308: 0x9f, 0x309: 0x9f, 0x30a: 0x9f, 0x30b: 0x9f, 0x30c: 0x9f, 0x30d: 0x9f, 0x30e: 0x9f, 0x30f: 0x9f, - 0x310: 0x9f, 0x311: 0x9f, 0x312: 0x9f, 0x313: 0x9f, 0x314: 0x9f, 0x315: 0x9f, 0x316: 0x9f, 0x317: 0x9f, - 0x318: 0x9f, 0x319: 0x9f, 0x31a: 0x9f, 0x31b: 0x9f, 0x31c: 0x9f, 0x31d: 0x9f, 0x31e: 0xf9, 0x31f: 0xfa, - // Block 0xd, offset 0x340 - 0x340: 0xba, 0x341: 0xba, 0x342: 0xba, 0x343: 0xba, 0x344: 0xba, 0x345: 0xba, 0x346: 0xba, 0x347: 0xba, - 0x348: 0xba, 0x349: 0xba, 0x34a: 0xba, 0x34b: 0xba, 0x34c: 0xba, 0x34d: 0xba, 0x34e: 0xba, 0x34f: 0xba, - 0x350: 0xba, 0x351: 0xba, 0x352: 0xba, 0x353: 0xba, 0x354: 0xba, 0x355: 0xba, 0x356: 0xba, 0x357: 0xba, - 0x358: 0xba, 0x359: 0xba, 0x35a: 0xba, 0x35b: 0xba, 0x35c: 0xba, 0x35d: 0xba, 0x35e: 0xba, 0x35f: 0xba, - 0x360: 0xba, 0x361: 0xba, 0x362: 0xba, 0x363: 0xba, 0x364: 0xba, 0x365: 0xba, 0x366: 0xba, 0x367: 0xba, - 0x368: 0xba, 0x369: 0xba, 0x36a: 0xba, 0x36b: 0xba, 0x36c: 0xba, 0x36d: 0xba, 0x36e: 0xba, 0x36f: 0xba, - 0x370: 0xba, 0x371: 0xba, 0x372: 0xba, 0x373: 0xba, 0x374: 0xba, 0x375: 0xba, 0x376: 0xba, 0x377: 0xba, - 0x378: 0xba, 0x379: 0xba, 0x37a: 0xba, 0x37b: 0xba, 0x37c: 0xba, 0x37d: 0xba, 0x37e: 0xba, 0x37f: 0xba, - // Block 0xe, offset 0x380 - 0x380: 0xba, 0x381: 0xba, 0x382: 0xba, 0x383: 0xba, 0x384: 0xba, 0x385: 0xba, 0x386: 0xba, 0x387: 0xba, - 0x388: 0xba, 0x389: 0xba, 0x38a: 0xba, 0x38b: 0xba, 0x38c: 0xba, 0x38d: 0xba, 0x38e: 0xba, 0x38f: 0xba, - 0x390: 0xba, 0x391: 0xba, 0x392: 0xba, 0x393: 0xba, 0x394: 0xba, 0x395: 0xba, 0x396: 0xba, 0x397: 0xba, - 0x398: 0xba, 0x399: 0xba, 0x39a: 0xba, 0x39b: 0xba, 0x39c: 0xba, 0x39d: 0xba, 0x39e: 0xba, 0x39f: 0xba, - 0x3a0: 0xba, 0x3a1: 0xba, 0x3a2: 0xba, 0x3a3: 0xba, 0x3a4: 0xfb, 0x3a5: 0xfc, 0x3a6: 0xfd, 0x3a7: 0xfe, - 0x3a8: 0x47, 0x3a9: 0xff, 0x3aa: 0x100, 0x3ab: 0x48, 0x3ac: 0x49, 0x3ad: 0x4a, 0x3ae: 0x4b, 0x3af: 0x4c, - 0x3b0: 0x101, 0x3b1: 0x4d, 0x3b2: 0x4e, 0x3b3: 0x4f, 0x3b4: 0x50, 0x3b5: 0x51, 0x3b6: 0x102, 0x3b7: 0x52, - 0x3b8: 0x53, 0x3b9: 0x54, 0x3ba: 0x55, 0x3bb: 0x56, 0x3bc: 0x57, 0x3bd: 0x58, 0x3be: 0x59, 0x3bf: 0x5a, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x103, 0x3c1: 0x104, 0x3c2: 0x9f, 0x3c3: 0x105, 0x3c4: 0x106, 0x3c5: 0x9b, 0x3c6: 0x107, 0x3c7: 0x108, - 0x3c8: 0xba, 0x3c9: 0xba, 0x3ca: 0x109, 0x3cb: 0x10a, 0x3cc: 0x10b, 0x3cd: 0x10c, 0x3ce: 0x10d, 0x3cf: 0x10e, - 0x3d0: 0x10f, 0x3d1: 0x9f, 0x3d2: 0x110, 0x3d3: 0x111, 0x3d4: 0x112, 0x3d5: 0x113, 0x3d6: 0xba, 0x3d7: 0xba, - 0x3d8: 0x9f, 0x3d9: 0x9f, 0x3da: 0x9f, 0x3db: 0x9f, 0x3dc: 0x114, 0x3dd: 0x115, 0x3de: 0xba, 0x3df: 0xba, - 0x3e0: 0x116, 0x3e1: 0x117, 0x3e2: 0x118, 0x3e3: 0x119, 0x3e4: 0x11a, 0x3e5: 0xba, 0x3e6: 0x11b, 0x3e7: 0x11c, - 0x3e8: 0x11d, 0x3e9: 0x11e, 0x3ea: 0x11f, 0x3eb: 0x5b, 0x3ec: 0x120, 0x3ed: 0x121, 0x3ee: 0x5c, 0x3ef: 0xba, - 0x3f0: 0x122, 0x3f1: 0x123, 0x3f2: 0x124, 0x3f3: 0x125, 0x3f4: 0x126, 0x3f5: 0xba, 0x3f6: 0xba, 0x3f7: 0xba, - 0x3f8: 0xba, 0x3f9: 0x127, 0x3fa: 0xba, 0x3fb: 0xba, 0x3fc: 0x128, 0x3fd: 0x129, 0x3fe: 0xba, 0x3ff: 0xba, - // Block 0x10, offset 0x400 - 0x400: 0x12a, 0x401: 0x12b, 0x402: 0x12c, 0x403: 0x12d, 0x404: 0x12e, 0x405: 0x12f, 0x406: 0x130, 0x407: 0x131, - 0x408: 0x132, 0x409: 0xba, 0x40a: 0x133, 0x40b: 0x134, 0x40c: 0x5d, 0x40d: 0x5e, 0x40e: 0xba, 0x40f: 0xba, - 0x410: 0x135, 0x411: 0x136, 0x412: 0x137, 0x413: 0x138, 0x414: 0xba, 0x415: 0xba, 0x416: 0x139, 0x417: 0x13a, - 0x418: 0x13b, 0x419: 0x13c, 0x41a: 0x13d, 0x41b: 0x13e, 0x41c: 0x13f, 0x41d: 0xba, 0x41e: 0xba, 0x41f: 0xba, - 0x420: 0x140, 0x421: 0xba, 0x422: 0x141, 0x423: 0x142, 0x424: 0xba, 0x425: 0xba, 0x426: 0xba, 0x427: 0xba, - 0x428: 0x143, 0x429: 0x144, 0x42a: 0x145, 0x42b: 0x146, 0x42c: 0xba, 0x42d: 0xba, 0x42e: 0xba, 0x42f: 0xba, - 0x430: 0x147, 0x431: 0x148, 0x432: 0x149, 0x433: 0xba, 0x434: 0x14a, 0x435: 0x14b, 0x436: 0x14c, 0x437: 0xba, - 0x438: 0xba, 0x439: 0xba, 0x43a: 0xba, 0x43b: 0x14d, 0x43c: 0xba, 0x43d: 0xba, 0x43e: 0xba, 0x43f: 0xba, - // Block 0x11, offset 0x440 - 0x440: 0x9f, 0x441: 0x9f, 0x442: 0x9f, 0x443: 0x9f, 0x444: 0x9f, 0x445: 0x9f, 0x446: 0x9f, 0x447: 0x9f, - 0x448: 0x9f, 0x449: 0x9f, 0x44a: 0x9f, 0x44b: 0x9f, 0x44c: 0x9f, 0x44d: 0x9f, 0x44e: 0x14e, 0x44f: 0xba, - 0x450: 0x9b, 0x451: 0x14f, 0x452: 0x9f, 0x453: 0x9f, 0x454: 0x9f, 0x455: 0x150, 0x456: 0xba, 0x457: 0xba, - 0x458: 0xba, 0x459: 0xba, 0x45a: 0xba, 0x45b: 0xba, 0x45c: 0xba, 0x45d: 0xba, 0x45e: 0xba, 0x45f: 0xba, - 0x460: 0xba, 0x461: 0xba, 0x462: 0xba, 0x463: 0xba, 0x464: 0xba, 0x465: 0xba, 0x466: 0xba, 0x467: 0xba, - 0x468: 0xba, 0x469: 0xba, 0x46a: 0xba, 0x46b: 0xba, 0x46c: 0xba, 0x46d: 0xba, 0x46e: 0xba, 0x46f: 0xba, - 0x470: 0xba, 0x471: 0xba, 0x472: 0xba, 0x473: 0xba, 0x474: 0xba, 0x475: 0xba, 0x476: 0xba, 0x477: 0xba, - 0x478: 0xba, 0x479: 0xba, 0x47a: 0xba, 0x47b: 0xba, 0x47c: 0xba, 0x47d: 0xba, 0x47e: 0xba, 0x47f: 0xba, - // Block 0x12, offset 0x480 - 0x480: 0x9f, 0x481: 0x9f, 0x482: 0x9f, 0x483: 0x9f, 0x484: 0x9f, 0x485: 0x9f, 0x486: 0x9f, 0x487: 0x9f, - 0x488: 0x9f, 0x489: 0x9f, 0x48a: 0x9f, 0x48b: 0x9f, 0x48c: 0x9f, 0x48d: 0x9f, 0x48e: 0x9f, 0x48f: 0x9f, - 0x490: 0x151, 0x491: 0xba, 0x492: 0xba, 0x493: 0xba, 0x494: 0xba, 0x495: 0xba, 0x496: 0xba, 0x497: 0xba, - 0x498: 0xba, 0x499: 0xba, 0x49a: 0xba, 0x49b: 0xba, 0x49c: 0xba, 0x49d: 0xba, 0x49e: 0xba, 0x49f: 0xba, - 0x4a0: 0xba, 0x4a1: 0xba, 0x4a2: 0xba, 0x4a3: 0xba, 0x4a4: 0xba, 0x4a5: 0xba, 0x4a6: 0xba, 0x4a7: 0xba, - 0x4a8: 0xba, 0x4a9: 0xba, 0x4aa: 0xba, 0x4ab: 0xba, 0x4ac: 0xba, 0x4ad: 0xba, 0x4ae: 0xba, 0x4af: 0xba, - 0x4b0: 0xba, 0x4b1: 0xba, 0x4b2: 0xba, 0x4b3: 0xba, 0x4b4: 0xba, 0x4b5: 0xba, 0x4b6: 0xba, 0x4b7: 0xba, - 0x4b8: 0xba, 0x4b9: 0xba, 0x4ba: 0xba, 0x4bb: 0xba, 0x4bc: 0xba, 0x4bd: 0xba, 0x4be: 0xba, 0x4bf: 0xba, - // Block 0x13, offset 0x4c0 - 0x4c0: 0xba, 0x4c1: 0xba, 0x4c2: 0xba, 0x4c3: 0xba, 0x4c4: 0xba, 0x4c5: 0xba, 0x4c6: 0xba, 0x4c7: 0xba, - 0x4c8: 0xba, 0x4c9: 0xba, 0x4ca: 0xba, 0x4cb: 0xba, 0x4cc: 0xba, 0x4cd: 0xba, 0x4ce: 0xba, 0x4cf: 0xba, - 0x4d0: 0x9f, 0x4d1: 0x9f, 0x4d2: 0x9f, 0x4d3: 0x9f, 0x4d4: 0x9f, 0x4d5: 0x9f, 0x4d6: 0x9f, 0x4d7: 0x9f, - 0x4d8: 0x9f, 0x4d9: 0x152, 0x4da: 0xba, 0x4db: 0xba, 0x4dc: 0xba, 0x4dd: 0xba, 0x4de: 0xba, 0x4df: 0xba, - 0x4e0: 0xba, 0x4e1: 0xba, 0x4e2: 0xba, 0x4e3: 0xba, 0x4e4: 0xba, 0x4e5: 0xba, 0x4e6: 0xba, 0x4e7: 0xba, - 0x4e8: 0xba, 0x4e9: 0xba, 0x4ea: 0xba, 0x4eb: 0xba, 0x4ec: 0xba, 0x4ed: 0xba, 0x4ee: 0xba, 0x4ef: 0xba, - 0x4f0: 0xba, 0x4f1: 0xba, 0x4f2: 0xba, 0x4f3: 0xba, 0x4f4: 0xba, 0x4f5: 0xba, 0x4f6: 0xba, 0x4f7: 0xba, - 0x4f8: 0xba, 0x4f9: 0xba, 0x4fa: 0xba, 0x4fb: 0xba, 0x4fc: 0xba, 0x4fd: 0xba, 0x4fe: 0xba, 0x4ff: 0xba, - // Block 0x14, offset 0x500 - 0x500: 0xba, 0x501: 0xba, 0x502: 0xba, 0x503: 0xba, 0x504: 0xba, 0x505: 0xba, 0x506: 0xba, 0x507: 0xba, - 0x508: 0xba, 0x509: 0xba, 0x50a: 0xba, 0x50b: 0xba, 0x50c: 0xba, 0x50d: 0xba, 0x50e: 0xba, 0x50f: 0xba, - 0x510: 0xba, 0x511: 0xba, 0x512: 0xba, 0x513: 0xba, 0x514: 0xba, 0x515: 0xba, 0x516: 0xba, 0x517: 0xba, - 0x518: 0xba, 0x519: 0xba, 0x51a: 0xba, 0x51b: 0xba, 0x51c: 0xba, 0x51d: 0xba, 0x51e: 0xba, 0x51f: 0xba, - 0x520: 0x9f, 0x521: 0x9f, 0x522: 0x9f, 0x523: 0x9f, 0x524: 0x9f, 0x525: 0x9f, 0x526: 0x9f, 0x527: 0x9f, - 0x528: 0x146, 0x529: 0x153, 0x52a: 0xba, 0x52b: 0x154, 0x52c: 0x155, 0x52d: 0x156, 0x52e: 0x157, 0x52f: 0xba, - 0x530: 0xba, 0x531: 0xba, 0x532: 0xba, 0x533: 0xba, 0x534: 0xba, 0x535: 0xba, 0x536: 0xba, 0x537: 0xba, - 0x538: 0xba, 0x539: 0x158, 0x53a: 0x159, 0x53b: 0xba, 0x53c: 0x9f, 0x53d: 0x15a, 0x53e: 0x15b, 0x53f: 0x15c, - // Block 0x15, offset 0x540 - 0x540: 0x9f, 0x541: 0x9f, 0x542: 0x9f, 0x543: 0x9f, 0x544: 0x9f, 0x545: 0x9f, 0x546: 0x9f, 0x547: 0x9f, - 0x548: 0x9f, 0x549: 0x9f, 0x54a: 0x9f, 0x54b: 0x9f, 0x54c: 0x9f, 0x54d: 0x9f, 0x54e: 0x9f, 0x54f: 0x9f, - 0x550: 0x9f, 0x551: 0x9f, 0x552: 0x9f, 0x553: 0x9f, 0x554: 0x9f, 0x555: 0x9f, 0x556: 0x9f, 0x557: 0x9f, - 0x558: 0x9f, 0x559: 0x9f, 0x55a: 0x9f, 0x55b: 0x9f, 0x55c: 0x9f, 0x55d: 0x9f, 0x55e: 0x9f, 0x55f: 0x15d, - 0x560: 0x9f, 0x561: 0x9f, 0x562: 0x9f, 0x563: 0x9f, 0x564: 0x9f, 0x565: 0x9f, 0x566: 0x9f, 0x567: 0x9f, - 0x568: 0x9f, 0x569: 0x9f, 0x56a: 0x9f, 0x56b: 0x15e, 0x56c: 0xba, 0x56d: 0xba, 0x56e: 0xba, 0x56f: 0xba, - 0x570: 0xba, 0x571: 0xba, 0x572: 0xba, 0x573: 0xba, 0x574: 0xba, 0x575: 0xba, 0x576: 0xba, 0x577: 0xba, - 0x578: 0xba, 0x579: 0xba, 0x57a: 0xba, 0x57b: 0xba, 0x57c: 0xba, 0x57d: 0xba, 0x57e: 0xba, 0x57f: 0xba, - // Block 0x16, offset 0x580 - 0x580: 0x9f, 0x581: 0x9f, 0x582: 0x9f, 0x583: 0x9f, 0x584: 0x15f, 0x585: 0x160, 0x586: 0x9f, 0x587: 0x9f, - 0x588: 0x9f, 0x589: 0x9f, 0x58a: 0x9f, 0x58b: 0x161, 0x58c: 0xba, 0x58d: 0xba, 0x58e: 0xba, 0x58f: 0xba, - 0x590: 0xba, 0x591: 0xba, 0x592: 0xba, 0x593: 0xba, 0x594: 0xba, 0x595: 0xba, 0x596: 0xba, 0x597: 0xba, - 0x598: 0xba, 0x599: 0xba, 0x59a: 0xba, 0x59b: 0xba, 0x59c: 0xba, 0x59d: 0xba, 0x59e: 0xba, 0x59f: 0xba, - 0x5a0: 0xba, 0x5a1: 0xba, 0x5a2: 0xba, 0x5a3: 0xba, 0x5a4: 0xba, 0x5a5: 0xba, 0x5a6: 0xba, 0x5a7: 0xba, - 0x5a8: 0xba, 0x5a9: 0xba, 0x5aa: 0xba, 0x5ab: 0xba, 0x5ac: 0xba, 0x5ad: 0xba, 0x5ae: 0xba, 0x5af: 0xba, - 0x5b0: 0x9f, 0x5b1: 0x162, 0x5b2: 0x163, 0x5b3: 0xba, 0x5b4: 0xba, 0x5b5: 0xba, 0x5b6: 0xba, 0x5b7: 0xba, - 0x5b8: 0xba, 0x5b9: 0xba, 0x5ba: 0xba, 0x5bb: 0xba, 0x5bc: 0xba, 0x5bd: 0xba, 0x5be: 0xba, 0x5bf: 0xba, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x9b, 0x5c1: 0x9b, 0x5c2: 0x9b, 0x5c3: 0x164, 0x5c4: 0x165, 0x5c5: 0x166, 0x5c6: 0x167, 0x5c7: 0x168, - 0x5c8: 0x9b, 0x5c9: 0x169, 0x5ca: 0xba, 0x5cb: 0x16a, 0x5cc: 0x9b, 0x5cd: 0x16b, 0x5ce: 0xba, 0x5cf: 0xba, - 0x5d0: 0x5f, 0x5d1: 0x60, 0x5d2: 0x61, 0x5d3: 0x62, 0x5d4: 0x63, 0x5d5: 0x64, 0x5d6: 0x65, 0x5d7: 0x66, - 0x5d8: 0x67, 0x5d9: 0x68, 0x5da: 0x69, 0x5db: 0x6a, 0x5dc: 0x6b, 0x5dd: 0x6c, 0x5de: 0x6d, 0x5df: 0x6e, - 0x5e0: 0x9b, 0x5e1: 0x9b, 0x5e2: 0x9b, 0x5e3: 0x9b, 0x5e4: 0x9b, 0x5e5: 0x9b, 0x5e6: 0x9b, 0x5e7: 0x9b, - 0x5e8: 0x16c, 0x5e9: 0x16d, 0x5ea: 0x16e, 0x5eb: 0xba, 0x5ec: 0xba, 0x5ed: 0xba, 0x5ee: 0xba, 0x5ef: 0xba, - 0x5f0: 0xba, 0x5f1: 0xba, 0x5f2: 0xba, 0x5f3: 0xba, 0x5f4: 0xba, 0x5f5: 0xba, 0x5f6: 0xba, 0x5f7: 0xba, - 0x5f8: 0xba, 0x5f9: 0xba, 0x5fa: 0xba, 0x5fb: 0xba, 0x5fc: 0xba, 0x5fd: 0xba, 0x5fe: 0xba, 0x5ff: 0xba, - // Block 0x18, offset 0x600 - 0x600: 0x16f, 0x601: 0xba, 0x602: 0xba, 0x603: 0xba, 0x604: 0xba, 0x605: 0xba, 0x606: 0xba, 0x607: 0xba, - 0x608: 0xba, 0x609: 0xba, 0x60a: 0xba, 0x60b: 0xba, 0x60c: 0xba, 0x60d: 0xba, 0x60e: 0xba, 0x60f: 0xba, - 0x610: 0xba, 0x611: 0xba, 0x612: 0xba, 0x613: 0xba, 0x614: 0xba, 0x615: 0xba, 0x616: 0xba, 0x617: 0xba, - 0x618: 0xba, 0x619: 0xba, 0x61a: 0xba, 0x61b: 0xba, 0x61c: 0xba, 0x61d: 0xba, 0x61e: 0xba, 0x61f: 0xba, - 0x620: 0x122, 0x621: 0x122, 0x622: 0x122, 0x623: 0x170, 0x624: 0x6f, 0x625: 0x171, 0x626: 0xba, 0x627: 0xba, - 0x628: 0xba, 0x629: 0xba, 0x62a: 0xba, 0x62b: 0xba, 0x62c: 0xba, 0x62d: 0xba, 0x62e: 0xba, 0x62f: 0xba, - 0x630: 0xba, 0x631: 0x172, 0x632: 0x173, 0x633: 0xba, 0x634: 0xba, 0x635: 0xba, 0x636: 0xba, 0x637: 0xba, - 0x638: 0x70, 0x639: 0x71, 0x63a: 0x72, 0x63b: 0x174, 0x63c: 0xba, 0x63d: 0xba, 0x63e: 0xba, 0x63f: 0xba, - // Block 0x19, offset 0x640 - 0x640: 0x175, 0x641: 0x9b, 0x642: 0x176, 0x643: 0x177, 0x644: 0x73, 0x645: 0x74, 0x646: 0x178, 0x647: 0x179, - 0x648: 0x75, 0x649: 0x17a, 0x64a: 0xba, 0x64b: 0xba, 0x64c: 0x9b, 0x64d: 0x9b, 0x64e: 0x9b, 0x64f: 0x9b, - 0x650: 0x9b, 0x651: 0x9b, 0x652: 0x9b, 0x653: 0x9b, 0x654: 0x9b, 0x655: 0x9b, 0x656: 0x9b, 0x657: 0x9b, - 0x658: 0x9b, 0x659: 0x9b, 0x65a: 0x9b, 0x65b: 0x17b, 0x65c: 0x9b, 0x65d: 0x17c, 0x65e: 0x9b, 0x65f: 0x17d, - 0x660: 0x17e, 0x661: 0x17f, 0x662: 0x180, 0x663: 0xba, 0x664: 0x181, 0x665: 0x182, 0x666: 0x183, 0x667: 0x184, - 0x668: 0xba, 0x669: 0x185, 0x66a: 0xba, 0x66b: 0xba, 0x66c: 0xba, 0x66d: 0xba, 0x66e: 0xba, 0x66f: 0xba, - 0x670: 0xba, 0x671: 0xba, 0x672: 0xba, 0x673: 0xba, 0x674: 0xba, 0x675: 0xba, 0x676: 0xba, 0x677: 0xba, - 0x678: 0xba, 0x679: 0xba, 0x67a: 0xba, 0x67b: 0xba, 0x67c: 0xba, 0x67d: 0xba, 0x67e: 0xba, 0x67f: 0xba, - // Block 0x1a, offset 0x680 - 0x680: 0x9f, 0x681: 0x9f, 0x682: 0x9f, 0x683: 0x9f, 0x684: 0x9f, 0x685: 0x9f, 0x686: 0x9f, 0x687: 0x9f, - 0x688: 0x9f, 0x689: 0x9f, 0x68a: 0x9f, 0x68b: 0x9f, 0x68c: 0x9f, 0x68d: 0x9f, 0x68e: 0x9f, 0x68f: 0x9f, - 0x690: 0x9f, 0x691: 0x9f, 0x692: 0x9f, 0x693: 0x9f, 0x694: 0x9f, 0x695: 0x9f, 0x696: 0x9f, 0x697: 0x9f, - 0x698: 0x9f, 0x699: 0x9f, 0x69a: 0x9f, 0x69b: 0x186, 0x69c: 0x9f, 0x69d: 0x9f, 0x69e: 0x9f, 0x69f: 0x9f, - 0x6a0: 0x9f, 0x6a1: 0x9f, 0x6a2: 0x9f, 0x6a3: 0x9f, 0x6a4: 0x9f, 0x6a5: 0x9f, 0x6a6: 0x9f, 0x6a7: 0x9f, - 0x6a8: 0x9f, 0x6a9: 0x9f, 0x6aa: 0x9f, 0x6ab: 0x9f, 0x6ac: 0x9f, 0x6ad: 0x9f, 0x6ae: 0x9f, 0x6af: 0x9f, - 0x6b0: 0x9f, 0x6b1: 0x9f, 0x6b2: 0x9f, 0x6b3: 0x9f, 0x6b4: 0x9f, 0x6b5: 0x9f, 0x6b6: 0x9f, 0x6b7: 0x9f, - 0x6b8: 0x9f, 0x6b9: 0x9f, 0x6ba: 0x9f, 0x6bb: 0x9f, 0x6bc: 0x9f, 0x6bd: 0x9f, 0x6be: 0x9f, 0x6bf: 0x9f, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x9f, 0x6c1: 0x9f, 0x6c2: 0x9f, 0x6c3: 0x9f, 0x6c4: 0x9f, 0x6c5: 0x9f, 0x6c6: 0x9f, 0x6c7: 0x9f, - 0x6c8: 0x9f, 0x6c9: 0x9f, 0x6ca: 0x9f, 0x6cb: 0x9f, 0x6cc: 0x9f, 0x6cd: 0x9f, 0x6ce: 0x9f, 0x6cf: 0x9f, - 0x6d0: 0x9f, 0x6d1: 0x9f, 0x6d2: 0x9f, 0x6d3: 0x9f, 0x6d4: 0x9f, 0x6d5: 0x9f, 0x6d6: 0x9f, 0x6d7: 0x9f, - 0x6d8: 0x9f, 0x6d9: 0x9f, 0x6da: 0x9f, 0x6db: 0x9f, 0x6dc: 0x187, 0x6dd: 0x9f, 0x6de: 0x9f, 0x6df: 0x9f, - 0x6e0: 0x188, 0x6e1: 0x9f, 0x6e2: 0x9f, 0x6e3: 0x9f, 0x6e4: 0x9f, 0x6e5: 0x9f, 0x6e6: 0x9f, 0x6e7: 0x9f, - 0x6e8: 0x9f, 0x6e9: 0x9f, 0x6ea: 0x9f, 0x6eb: 0x9f, 0x6ec: 0x9f, 0x6ed: 0x9f, 0x6ee: 0x9f, 0x6ef: 0x9f, - 0x6f0: 0x9f, 0x6f1: 0x9f, 0x6f2: 0x9f, 0x6f3: 0x9f, 0x6f4: 0x9f, 0x6f5: 0x9f, 0x6f6: 0x9f, 0x6f7: 0x9f, - 0x6f8: 0x9f, 0x6f9: 0x9f, 0x6fa: 0x9f, 0x6fb: 0x9f, 0x6fc: 0x9f, 0x6fd: 0x9f, 0x6fe: 0x9f, 0x6ff: 0x9f, - // Block 0x1c, offset 0x700 - 0x700: 0x9f, 0x701: 0x9f, 0x702: 0x9f, 0x703: 0x9f, 0x704: 0x9f, 0x705: 0x9f, 0x706: 0x9f, 0x707: 0x9f, - 0x708: 0x9f, 0x709: 0x9f, 0x70a: 0x9f, 0x70b: 0x9f, 0x70c: 0x9f, 0x70d: 0x9f, 0x70e: 0x9f, 0x70f: 0x9f, - 0x710: 0x9f, 0x711: 0x9f, 0x712: 0x9f, 0x713: 0x9f, 0x714: 0x9f, 0x715: 0x9f, 0x716: 0x9f, 0x717: 0x9f, - 0x718: 0x9f, 0x719: 0x9f, 0x71a: 0x9f, 0x71b: 0x9f, 0x71c: 0x9f, 0x71d: 0x9f, 0x71e: 0x9f, 0x71f: 0x9f, - 0x720: 0x9f, 0x721: 0x9f, 0x722: 0x9f, 0x723: 0x9f, 0x724: 0x9f, 0x725: 0x9f, 0x726: 0x9f, 0x727: 0x9f, - 0x728: 0x9f, 0x729: 0x9f, 0x72a: 0x9f, 0x72b: 0x9f, 0x72c: 0x9f, 0x72d: 0x9f, 0x72e: 0x9f, 0x72f: 0x9f, - 0x730: 0x9f, 0x731: 0x9f, 0x732: 0x9f, 0x733: 0x9f, 0x734: 0x9f, 0x735: 0x9f, 0x736: 0x9f, 0x737: 0x9f, - 0x738: 0x9f, 0x739: 0x9f, 0x73a: 0x189, 0x73b: 0x9f, 0x73c: 0x9f, 0x73d: 0x9f, 0x73e: 0x9f, 0x73f: 0x9f, - // Block 0x1d, offset 0x740 - 0x740: 0x9f, 0x741: 0x9f, 0x742: 0x9f, 0x743: 0x9f, 0x744: 0x9f, 0x745: 0x9f, 0x746: 0x9f, 0x747: 0x9f, - 0x748: 0x9f, 0x749: 0x9f, 0x74a: 0x9f, 0x74b: 0x9f, 0x74c: 0x9f, 0x74d: 0x9f, 0x74e: 0x9f, 0x74f: 0x9f, - 0x750: 0x9f, 0x751: 0x9f, 0x752: 0x9f, 0x753: 0x9f, 0x754: 0x9f, 0x755: 0x9f, 0x756: 0x9f, 0x757: 0x9f, - 0x758: 0x9f, 0x759: 0x9f, 0x75a: 0x9f, 0x75b: 0x9f, 0x75c: 0x9f, 0x75d: 0x9f, 0x75e: 0x9f, 0x75f: 0x9f, - 0x760: 0x9f, 0x761: 0x9f, 0x762: 0x9f, 0x763: 0x9f, 0x764: 0x9f, 0x765: 0x9f, 0x766: 0x9f, 0x767: 0x9f, - 0x768: 0x9f, 0x769: 0x9f, 0x76a: 0x9f, 0x76b: 0x9f, 0x76c: 0x9f, 0x76d: 0x9f, 0x76e: 0x9f, 0x76f: 0x18a, - 0x770: 0xba, 0x771: 0xba, 0x772: 0xba, 0x773: 0xba, 0x774: 0xba, 0x775: 0xba, 0x776: 0xba, 0x777: 0xba, - 0x778: 0xba, 0x779: 0xba, 0x77a: 0xba, 0x77b: 0xba, 0x77c: 0xba, 0x77d: 0xba, 0x77e: 0xba, 0x77f: 0xba, - // Block 0x1e, offset 0x780 - 0x780: 0xba, 0x781: 0xba, 0x782: 0xba, 0x783: 0xba, 0x784: 0xba, 0x785: 0xba, 0x786: 0xba, 0x787: 0xba, - 0x788: 0xba, 0x789: 0xba, 0x78a: 0xba, 0x78b: 0xba, 0x78c: 0xba, 0x78d: 0xba, 0x78e: 0xba, 0x78f: 0xba, - 0x790: 0xba, 0x791: 0xba, 0x792: 0xba, 0x793: 0xba, 0x794: 0xba, 0x795: 0xba, 0x796: 0xba, 0x797: 0xba, - 0x798: 0xba, 0x799: 0xba, 0x79a: 0xba, 0x79b: 0xba, 0x79c: 0xba, 0x79d: 0xba, 0x79e: 0xba, 0x79f: 0xba, - 0x7a0: 0x76, 0x7a1: 0x77, 0x7a2: 0x78, 0x7a3: 0x18b, 0x7a4: 0x79, 0x7a5: 0x7a, 0x7a6: 0x18c, 0x7a7: 0x7b, - 0x7a8: 0x7c, 0x7a9: 0xba, 0x7aa: 0xba, 0x7ab: 0xba, 0x7ac: 0xba, 0x7ad: 0xba, 0x7ae: 0xba, 0x7af: 0xba, - 0x7b0: 0xba, 0x7b1: 0xba, 0x7b2: 0xba, 0x7b3: 0xba, 0x7b4: 0xba, 0x7b5: 0xba, 0x7b6: 0xba, 0x7b7: 0xba, - 0x7b8: 0xba, 0x7b9: 0xba, 0x7ba: 0xba, 0x7bb: 0xba, 0x7bc: 0xba, 0x7bd: 0xba, 0x7be: 0xba, 0x7bf: 0xba, - // Block 0x1f, offset 0x7c0 - 0x7d0: 0x0d, 0x7d1: 0x0e, 0x7d2: 0x0f, 0x7d3: 0x10, 0x7d4: 0x11, 0x7d5: 0x0b, 0x7d6: 0x12, 0x7d7: 0x07, - 0x7d8: 0x13, 0x7d9: 0x0b, 0x7da: 0x0b, 0x7db: 0x14, 0x7dc: 0x0b, 0x7dd: 0x15, 0x7de: 0x16, 0x7df: 0x17, - 0x7e0: 0x07, 0x7e1: 0x07, 0x7e2: 0x07, 0x7e3: 0x07, 0x7e4: 0x07, 0x7e5: 0x07, 0x7e6: 0x07, 0x7e7: 0x07, - 0x7e8: 0x07, 0x7e9: 0x07, 0x7ea: 0x18, 0x7eb: 0x19, 0x7ec: 0x1a, 0x7ed: 0x07, 0x7ee: 0x1b, 0x7ef: 0x1c, - 0x7f0: 0x0b, 0x7f1: 0x0b, 0x7f2: 0x0b, 0x7f3: 0x0b, 0x7f4: 0x0b, 0x7f5: 0x0b, 0x7f6: 0x0b, 0x7f7: 0x0b, - 0x7f8: 0x0b, 0x7f9: 0x0b, 0x7fa: 0x0b, 0x7fb: 0x0b, 0x7fc: 0x0b, 0x7fd: 0x0b, 0x7fe: 0x0b, 0x7ff: 0x0b, - // Block 0x20, offset 0x800 - 0x800: 0x0b, 0x801: 0x0b, 0x802: 0x0b, 0x803: 0x0b, 0x804: 0x0b, 0x805: 0x0b, 0x806: 0x0b, 0x807: 0x0b, - 0x808: 0x0b, 0x809: 0x0b, 0x80a: 0x0b, 0x80b: 0x0b, 0x80c: 0x0b, 0x80d: 0x0b, 0x80e: 0x0b, 0x80f: 0x0b, - 0x810: 0x0b, 0x811: 0x0b, 0x812: 0x0b, 0x813: 0x0b, 0x814: 0x0b, 0x815: 0x0b, 0x816: 0x0b, 0x817: 0x0b, - 0x818: 0x0b, 0x819: 0x0b, 0x81a: 0x0b, 0x81b: 0x0b, 0x81c: 0x0b, 0x81d: 0x0b, 0x81e: 0x0b, 0x81f: 0x0b, - 0x820: 0x0b, 0x821: 0x0b, 0x822: 0x0b, 0x823: 0x0b, 0x824: 0x0b, 0x825: 0x0b, 0x826: 0x0b, 0x827: 0x0b, - 0x828: 0x0b, 0x829: 0x0b, 0x82a: 0x0b, 0x82b: 0x0b, 0x82c: 0x0b, 0x82d: 0x0b, 0x82e: 0x0b, 0x82f: 0x0b, - 0x830: 0x0b, 0x831: 0x0b, 0x832: 0x0b, 0x833: 0x0b, 0x834: 0x0b, 0x835: 0x0b, 0x836: 0x0b, 0x837: 0x0b, - 0x838: 0x0b, 0x839: 0x0b, 0x83a: 0x0b, 0x83b: 0x0b, 0x83c: 0x0b, 0x83d: 0x0b, 0x83e: 0x0b, 0x83f: 0x0b, - // Block 0x21, offset 0x840 - 0x840: 0x18d, 0x841: 0x18e, 0x842: 0xba, 0x843: 0xba, 0x844: 0x18f, 0x845: 0x18f, 0x846: 0x18f, 0x847: 0x190, - 0x848: 0xba, 0x849: 0xba, 0x84a: 0xba, 0x84b: 0xba, 0x84c: 0xba, 0x84d: 0xba, 0x84e: 0xba, 0x84f: 0xba, - 0x850: 0xba, 0x851: 0xba, 0x852: 0xba, 0x853: 0xba, 0x854: 0xba, 0x855: 0xba, 0x856: 0xba, 0x857: 0xba, - 0x858: 0xba, 0x859: 0xba, 0x85a: 0xba, 0x85b: 0xba, 0x85c: 0xba, 0x85d: 0xba, 0x85e: 0xba, 0x85f: 0xba, - 0x860: 0xba, 0x861: 0xba, 0x862: 0xba, 0x863: 0xba, 0x864: 0xba, 0x865: 0xba, 0x866: 0xba, 0x867: 0xba, - 0x868: 0xba, 0x869: 0xba, 0x86a: 0xba, 0x86b: 0xba, 0x86c: 0xba, 0x86d: 0xba, 0x86e: 0xba, 0x86f: 0xba, - 0x870: 0xba, 0x871: 0xba, 0x872: 0xba, 0x873: 0xba, 0x874: 0xba, 0x875: 0xba, 0x876: 0xba, 0x877: 0xba, - 0x878: 0xba, 0x879: 0xba, 0x87a: 0xba, 0x87b: 0xba, 0x87c: 0xba, 0x87d: 0xba, 0x87e: 0xba, 0x87f: 0xba, - // Block 0x22, offset 0x880 - 0x880: 0x0b, 0x881: 0x0b, 0x882: 0x0b, 0x883: 0x0b, 0x884: 0x0b, 0x885: 0x0b, 0x886: 0x0b, 0x887: 0x0b, - 0x888: 0x0b, 0x889: 0x0b, 0x88a: 0x0b, 0x88b: 0x0b, 0x88c: 0x0b, 0x88d: 0x0b, 0x88e: 0x0b, 0x88f: 0x0b, - 0x890: 0x0b, 0x891: 0x0b, 0x892: 0x0b, 0x893: 0x0b, 0x894: 0x0b, 0x895: 0x0b, 0x896: 0x0b, 0x897: 0x0b, - 0x898: 0x0b, 0x899: 0x0b, 0x89a: 0x0b, 0x89b: 0x0b, 0x89c: 0x0b, 0x89d: 0x0b, 0x89e: 0x0b, 0x89f: 0x0b, - 0x8a0: 0x1f, 0x8a1: 0x0b, 0x8a2: 0x0b, 0x8a3: 0x0b, 0x8a4: 0x0b, 0x8a5: 0x0b, 0x8a6: 0x0b, 0x8a7: 0x0b, - 0x8a8: 0x0b, 0x8a9: 0x0b, 0x8aa: 0x0b, 0x8ab: 0x0b, 0x8ac: 0x0b, 0x8ad: 0x0b, 0x8ae: 0x0b, 0x8af: 0x0b, - 0x8b0: 0x0b, 0x8b1: 0x0b, 0x8b2: 0x0b, 0x8b3: 0x0b, 0x8b4: 0x0b, 0x8b5: 0x0b, 0x8b6: 0x0b, 0x8b7: 0x0b, - 0x8b8: 0x0b, 0x8b9: 0x0b, 0x8ba: 0x0b, 0x8bb: 0x0b, 0x8bc: 0x0b, 0x8bd: 0x0b, 0x8be: 0x0b, 0x8bf: 0x0b, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x0b, 0x8c1: 0x0b, 0x8c2: 0x0b, 0x8c3: 0x0b, 0x8c4: 0x0b, 0x8c5: 0x0b, 0x8c6: 0x0b, 0x8c7: 0x0b, - 0x8c8: 0x0b, 0x8c9: 0x0b, 0x8ca: 0x0b, 0x8cb: 0x0b, 0x8cc: 0x0b, 0x8cd: 0x0b, 0x8ce: 0x0b, 0x8cf: 0x0b, -} - -// idnaSparseOffset: 276 entries, 552 bytes -var idnaSparseOffset = []uint16{0x0, 0x8, 0x19, 0x25, 0x27, 0x2c, 0x33, 0x3e, 0x4a, 0x4e, 0x5d, 0x62, 0x6c, 0x78, 0x86, 0x8b, 0x94, 0xa4, 0xb2, 0xbe, 0xca, 0xdb, 0xe5, 0xec, 0xf9, 0x10a, 0x111, 0x11c, 0x12b, 0x139, 0x143, 0x145, 0x14a, 0x14d, 0x150, 0x152, 0x15e, 0x169, 0x171, 0x177, 0x17d, 0x182, 0x187, 0x18a, 0x18e, 0x194, 0x199, 0x1a5, 0x1af, 0x1b5, 0x1c6, 0x1d0, 0x1d3, 0x1db, 0x1de, 0x1eb, 0x1f3, 0x1f7, 0x1fe, 0x206, 0x216, 0x222, 0x224, 0x22e, 0x23a, 0x246, 0x252, 0x25a, 0x25f, 0x269, 0x27a, 0x27e, 0x289, 0x28d, 0x296, 0x29e, 0x2a4, 0x2a9, 0x2ac, 0x2b0, 0x2b6, 0x2ba, 0x2be, 0x2c2, 0x2c7, 0x2cd, 0x2d5, 0x2dc, 0x2e7, 0x2f1, 0x2f5, 0x2f8, 0x2fe, 0x302, 0x304, 0x307, 0x309, 0x30c, 0x316, 0x319, 0x328, 0x32c, 0x331, 0x334, 0x338, 0x33d, 0x342, 0x348, 0x34e, 0x35d, 0x363, 0x367, 0x376, 0x37b, 0x383, 0x38d, 0x398, 0x3a0, 0x3b1, 0x3ba, 0x3ca, 0x3d7, 0x3e1, 0x3e6, 0x3f3, 0x3f7, 0x3fc, 0x3fe, 0x402, 0x404, 0x408, 0x411, 0x417, 0x41b, 0x42b, 0x435, 0x43a, 0x43d, 0x443, 0x44a, 0x44f, 0x453, 0x459, 0x45e, 0x467, 0x46c, 0x472, 0x479, 0x480, 0x487, 0x48b, 0x490, 0x493, 0x498, 0x4a4, 0x4aa, 0x4af, 0x4b6, 0x4be, 0x4c3, 0x4c7, 0x4d7, 0x4de, 0x4e2, 0x4e6, 0x4ed, 0x4ef, 0x4f2, 0x4f5, 0x4f9, 0x502, 0x506, 0x50e, 0x516, 0x51c, 0x525, 0x531, 0x538, 0x541, 0x54b, 0x552, 0x560, 0x56d, 0x57a, 0x583, 0x587, 0x596, 0x59e, 0x5a9, 0x5b2, 0x5b8, 0x5c0, 0x5c9, 0x5d3, 0x5d6, 0x5e2, 0x5eb, 0x5ee, 0x5f3, 0x5fe, 0x607, 0x613, 0x616, 0x620, 0x629, 0x635, 0x642, 0x64f, 0x65d, 0x664, 0x667, 0x66c, 0x66f, 0x672, 0x675, 0x67c, 0x683, 0x687, 0x692, 0x695, 0x698, 0x69b, 0x6a1, 0x6a6, 0x6aa, 0x6ad, 0x6b0, 0x6b3, 0x6b6, 0x6b9, 0x6be, 0x6c8, 0x6cb, 0x6cf, 0x6de, 0x6ea, 0x6ee, 0x6f3, 0x6f7, 0x6fc, 0x700, 0x705, 0x70e, 0x719, 0x71f, 0x727, 0x72a, 0x72d, 0x731, 0x735, 0x73b, 0x741, 0x746, 0x749, 0x759, 0x760, 0x763, 0x766, 0x76a, 0x770, 0x775, 0x77a, 0x782, 0x787, 0x78b, 0x78f, 0x792, 0x795, 0x799, 0x79d, 0x7a0, 0x7b0, 0x7c1, 0x7c6, 0x7c8, 0x7ca} - -// idnaSparseValues: 1997 entries, 7988 bytes -var idnaSparseValues = [1997]valueRange{ - // Block 0x0, offset 0x0 - {value: 0x0000, lo: 0x07}, - {value: 0xe105, lo: 0x80, hi: 0x96}, - {value: 0x0018, lo: 0x97, hi: 0x97}, - {value: 0xe105, lo: 0x98, hi: 0x9e}, - {value: 0x001f, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbf}, - // Block 0x1, offset 0x8 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0xe01d, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0335, lo: 0x83, hi: 0x83}, - {value: 0x034d, lo: 0x84, hi: 0x84}, - {value: 0x0365, lo: 0x85, hi: 0x85}, - {value: 0xe00d, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0xe00d, lo: 0x88, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x89}, - {value: 0xe00d, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe00d, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0x8d}, - {value: 0xe00d, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0xbf}, - // Block 0x2, offset 0x19 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x0249, lo: 0xb0, hi: 0xb0}, - {value: 0x037d, lo: 0xb1, hi: 0xb1}, - {value: 0x0259, lo: 0xb2, hi: 0xb2}, - {value: 0x0269, lo: 0xb3, hi: 0xb3}, - {value: 0x034d, lo: 0xb4, hi: 0xb4}, - {value: 0x0395, lo: 0xb5, hi: 0xb5}, - {value: 0xe1bd, lo: 0xb6, hi: 0xb6}, - {value: 0x0279, lo: 0xb7, hi: 0xb7}, - {value: 0x0289, lo: 0xb8, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbf}, - // Block 0x3, offset 0x25 - {value: 0x0000, lo: 0x01}, - {value: 0x3308, lo: 0x80, hi: 0xbf}, - // Block 0x4, offset 0x27 - {value: 0x0000, lo: 0x04}, - {value: 0x03f5, lo: 0x80, hi: 0x8f}, - {value: 0xe105, lo: 0x90, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x5, offset 0x2c - {value: 0x0000, lo: 0x06}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x0545, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x0008, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x6, offset 0x33 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0401, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x88}, - {value: 0x0018, lo: 0x89, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0xbd}, - {value: 0x0818, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x7, offset 0x3e - {value: 0x0000, lo: 0x0b}, - {value: 0x0818, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x82}, - {value: 0x0818, lo: 0x83, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x85}, - {value: 0x0818, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xae}, - {value: 0x0808, lo: 0xaf, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x8, offset 0x4a - {value: 0x0000, lo: 0x03}, - {value: 0x0a08, lo: 0x80, hi: 0x87}, - {value: 0x0c08, lo: 0x88, hi: 0x99}, - {value: 0x0a08, lo: 0x9a, hi: 0xbf}, - // Block 0x9, offset 0x4e - {value: 0x0000, lo: 0x0e}, - {value: 0x3308, lo: 0x80, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0c08, lo: 0x8d, hi: 0x8d}, - {value: 0x0a08, lo: 0x8e, hi: 0x98}, - {value: 0x0c08, lo: 0x99, hi: 0x9b}, - {value: 0x0a08, lo: 0x9c, hi: 0xaa}, - {value: 0x0c08, lo: 0xab, hi: 0xac}, - {value: 0x0a08, lo: 0xad, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb1}, - {value: 0x0a08, lo: 0xb2, hi: 0xb2}, - {value: 0x0c08, lo: 0xb3, hi: 0xb4}, - {value: 0x0a08, lo: 0xb5, hi: 0xb7}, - {value: 0x0c08, lo: 0xb8, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbf}, - // Block 0xa, offset 0x5d - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xb0}, - {value: 0x0808, lo: 0xb1, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xb, offset 0x62 - {value: 0x0000, lo: 0x09}, - {value: 0x0808, lo: 0x80, hi: 0x89}, - {value: 0x0a08, lo: 0x8a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x0818, lo: 0xbe, hi: 0xbf}, - // Block 0xc, offset 0x6c - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x99}, - {value: 0x0808, lo: 0x9a, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa3}, - {value: 0x0808, lo: 0xa4, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa7}, - {value: 0x0808, lo: 0xa8, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0818, lo: 0xb0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xd, offset 0x78 - {value: 0x0000, lo: 0x0d}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0a08, lo: 0xa0, hi: 0xa9}, - {value: 0x0c08, lo: 0xaa, hi: 0xac}, - {value: 0x0808, lo: 0xad, hi: 0xad}, - {value: 0x0c08, lo: 0xae, hi: 0xae}, - {value: 0x0a08, lo: 0xaf, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb2}, - {value: 0x0a08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0a08, lo: 0xb6, hi: 0xb8}, - {value: 0x0c08, lo: 0xb9, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0xe, offset 0x86 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x92}, - {value: 0x3308, lo: 0x93, hi: 0xa1}, - {value: 0x0840, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xbf}, - // Block 0xf, offset 0x8b - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x10, offset 0x94 - {value: 0x0000, lo: 0x0f}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x85}, - {value: 0x3008, lo: 0x86, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x3008, lo: 0x8a, hi: 0x8c}, - {value: 0x3b08, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x11, offset 0xa4 - {value: 0x0000, lo: 0x0d}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x12, offset 0xb2 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xba}, - {value: 0x3b08, lo: 0xbb, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x13, offset 0xbe - {value: 0x0000, lo: 0x0b}, - {value: 0x0040, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x14, offset 0xca - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x89}, - {value: 0x3b08, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x3008, lo: 0x98, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x15, offset 0xdb - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb2}, - {value: 0x08f1, lo: 0xb3, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb9}, - {value: 0x3b08, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0x16, offset 0xe5 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x8e}, - {value: 0x0018, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0xbf}, - // Block 0x17, offset 0xec - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0961, lo: 0x9c, hi: 0x9c}, - {value: 0x0999, lo: 0x9d, hi: 0x9d}, - {value: 0x0008, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x18, offset 0xf9 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe03d, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x19, offset 0x10a - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0xbf}, - // Block 0x1a, offset 0x111 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x1b, offset 0x11c - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x3008, lo: 0x96, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x3308, lo: 0x9e, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xa1}, - {value: 0x3008, lo: 0xa2, hi: 0xa4}, - {value: 0x0008, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xbf}, - // Block 0x1c, offset 0x12b - {value: 0x0000, lo: 0x0d}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x8c}, - {value: 0x3308, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x3008, lo: 0x9a, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x1d, offset 0x139 - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x86}, - {value: 0x055d, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8c}, - {value: 0x055d, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbb}, - {value: 0xe105, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0x1e, offset 0x143 - {value: 0x0000, lo: 0x01}, - {value: 0x0018, lo: 0x80, hi: 0xbf}, - // Block 0x1f, offset 0x145 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa0}, - {value: 0x2018, lo: 0xa1, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x20, offset 0x14a - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa7}, - {value: 0x2018, lo: 0xa8, hi: 0xbf}, - // Block 0x21, offset 0x14d - {value: 0x0000, lo: 0x02}, - {value: 0x2018, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0xbf}, - // Block 0x22, offset 0x150 - {value: 0x0000, lo: 0x01}, - {value: 0x0008, lo: 0x80, hi: 0xbf}, - // Block 0x23, offset 0x152 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x24, offset 0x15e - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x25, offset 0x169 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x26, offset 0x171 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x27, offset 0x177 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x28, offset 0x17d - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x29, offset 0x182 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x2a, offset 0x187 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x2b, offset 0x18a - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xbf}, - // Block 0x2c, offset 0x18e - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x2d, offset 0x194 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0x2e, offset 0x199 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x3b08, lo: 0x94, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x2f, offset 0x1a5 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x30, offset 0x1af - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xb3}, - {value: 0x3340, lo: 0xb4, hi: 0xb5}, - {value: 0x3008, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x31, offset 0x1b5 - {value: 0x0000, lo: 0x10}, - {value: 0x3008, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x91}, - {value: 0x3b08, lo: 0x92, hi: 0x92}, - {value: 0x3308, lo: 0x93, hi: 0x93}, - {value: 0x0018, lo: 0x94, hi: 0x96}, - {value: 0x0008, lo: 0x97, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x32, offset 0x1c6 - {value: 0x0000, lo: 0x09}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x86}, - {value: 0x0218, lo: 0x87, hi: 0x87}, - {value: 0x0018, lo: 0x88, hi: 0x8a}, - {value: 0x33c0, lo: 0x8b, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0208, lo: 0xa0, hi: 0xbf}, - // Block 0x33, offset 0x1d0 - {value: 0x0000, lo: 0x02}, - {value: 0x0208, lo: 0x80, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0x34, offset 0x1d3 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0208, lo: 0x87, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xa9}, - {value: 0x0208, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x35, offset 0x1db - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0x36, offset 0x1de - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x37, offset 0x1eb - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x38, offset 0x1f3 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x39, offset 0x1f7 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0028, lo: 0x9a, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xbf}, - // Block 0x3a, offset 0x1fe - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x3308, lo: 0x97, hi: 0x98}, - {value: 0x3008, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x3b, offset 0x206 - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x94}, - {value: 0x3008, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3b08, lo: 0xa0, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xac}, - {value: 0x3008, lo: 0xad, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x3c, offset 0x216 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xbd}, - {value: 0x3318, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x3d, offset 0x222 - {value: 0x0000, lo: 0x01}, - {value: 0x0040, lo: 0x80, hi: 0xbf}, - // Block 0x3e, offset 0x224 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3008, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x3f, offset 0x22e - {value: 0x0000, lo: 0x0b}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x3808, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x40, offset 0x23a - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3808, lo: 0xaa, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xbf}, - // Block 0x41, offset 0x246 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3008, lo: 0xaa, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3808, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbf}, - // Block 0x42, offset 0x252 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x3008, lo: 0xa4, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbf}, - // Block 0x43, offset 0x25a - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x44, offset 0x25f - {value: 0x0000, lo: 0x09}, - {value: 0x0e29, lo: 0x80, hi: 0x80}, - {value: 0x0e41, lo: 0x81, hi: 0x81}, - {value: 0x0e59, lo: 0x82, hi: 0x82}, - {value: 0x0e71, lo: 0x83, hi: 0x83}, - {value: 0x0e89, lo: 0x84, hi: 0x85}, - {value: 0x0ea1, lo: 0x86, hi: 0x86}, - {value: 0x0eb9, lo: 0x87, hi: 0x87}, - {value: 0x057d, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0x45, offset 0x269 - {value: 0x0000, lo: 0x10}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x92}, - {value: 0x0018, lo: 0x93, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa8}, - {value: 0x0008, lo: 0xa9, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x46, offset 0x27a - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0x47, offset 0x27e - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x87}, - {value: 0xe045, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0xe045, lo: 0x98, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0xe045, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbf}, - // Block 0x48, offset 0x289 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x3318, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbf}, - // Block 0x49, offset 0x28d - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x88}, - {value: 0x24c1, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x4a, offset 0x296 - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x24f1, lo: 0xac, hi: 0xac}, - {value: 0x2529, lo: 0xad, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xae}, - {value: 0x2579, lo: 0xaf, hi: 0xaf}, - {value: 0x25b1, lo: 0xb0, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0x4b, offset 0x29e - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x9f}, - {value: 0x0080, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xad}, - {value: 0x0080, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x4c, offset 0x2a4 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xa8}, - {value: 0x09c5, lo: 0xa9, hi: 0xa9}, - {value: 0x09e5, lo: 0xaa, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xbf}, - // Block 0x4d, offset 0x2a9 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xbf}, - // Block 0x4e, offset 0x2ac - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x28c1, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0xbf}, - // Block 0x4f, offset 0x2b0 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0e66, lo: 0xb4, hi: 0xb4}, - {value: 0x292a, lo: 0xb5, hi: 0xb5}, - {value: 0x0e86, lo: 0xb6, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x50, offset 0x2b6 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x9b}, - {value: 0x2941, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0xbf}, - // Block 0x51, offset 0x2ba - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x52, offset 0x2be - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0xbf}, - // Block 0x53, offset 0x2c2 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x54, offset 0x2c7 - {value: 0x0000, lo: 0x05}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x03f5, lo: 0x90, hi: 0x9f}, - {value: 0x0ea5, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x55, offset 0x2cd - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x56, offset 0x2d5 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xae}, - {value: 0xe075, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0x57, offset 0x2dc - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x58, offset 0x2e7 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xbf}, - // Block 0x59, offset 0x2f1 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x5a, offset 0x2f5 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0xbf}, - // Block 0x5b, offset 0x2f8 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9e}, - {value: 0x0edd, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0x5c, offset 0x2fe - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb2}, - {value: 0x0efd, lo: 0xb3, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x5d, offset 0x302 - {value: 0x0020, lo: 0x01}, - {value: 0x0f1d, lo: 0x80, hi: 0xbf}, - // Block 0x5e, offset 0x304 - {value: 0x0020, lo: 0x02}, - {value: 0x171d, lo: 0x80, hi: 0x8f}, - {value: 0x18fd, lo: 0x90, hi: 0xbf}, - // Block 0x5f, offset 0x307 - {value: 0x0020, lo: 0x01}, - {value: 0x1efd, lo: 0x80, hi: 0xbf}, - // Block 0x60, offset 0x309 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x61, offset 0x30c - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9a}, - {value: 0x29e2, lo: 0x9b, hi: 0x9b}, - {value: 0x2a0a, lo: 0x9c, hi: 0x9c}, - {value: 0x0008, lo: 0x9d, hi: 0x9e}, - {value: 0x2a31, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xbf}, - // Block 0x62, offset 0x316 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbe}, - {value: 0x2a69, lo: 0xbf, hi: 0xbf}, - // Block 0x63, offset 0x319 - {value: 0x0000, lo: 0x0e}, - {value: 0x0040, lo: 0x80, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xb0}, - {value: 0x2a1d, lo: 0xb1, hi: 0xb1}, - {value: 0x2a3d, lo: 0xb2, hi: 0xb2}, - {value: 0x2a5d, lo: 0xb3, hi: 0xb3}, - {value: 0x2a7d, lo: 0xb4, hi: 0xb4}, - {value: 0x2a5d, lo: 0xb5, hi: 0xb5}, - {value: 0x2a9d, lo: 0xb6, hi: 0xb6}, - {value: 0x2abd, lo: 0xb7, hi: 0xb7}, - {value: 0x2add, lo: 0xb8, hi: 0xb9}, - {value: 0x2afd, lo: 0xba, hi: 0xbb}, - {value: 0x2b1d, lo: 0xbc, hi: 0xbd}, - {value: 0x2afd, lo: 0xbe, hi: 0xbf}, - // Block 0x64, offset 0x328 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x65, offset 0x32c - {value: 0x0030, lo: 0x04}, - {value: 0x2aa2, lo: 0x80, hi: 0x9d}, - {value: 0x305a, lo: 0x9e, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x30a2, lo: 0xa0, hi: 0xbf}, - // Block 0x66, offset 0x331 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x67, offset 0x334 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x68, offset 0x338 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x69, offset 0x33d - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xbf}, - // Block 0x6a, offset 0x342 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb1}, - {value: 0x0018, lo: 0xb2, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6b, offset 0x348 - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0xb6}, - {value: 0x0008, lo: 0xb7, hi: 0xb7}, - {value: 0x2009, lo: 0xb8, hi: 0xb8}, - {value: 0x6e89, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xbf}, - // Block 0x6c, offset 0x34e - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x3308, lo: 0x8b, hi: 0x8b}, - {value: 0x0008, lo: 0x8c, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x6d, offset 0x35d - {value: 0x0000, lo: 0x05}, - {value: 0x0208, lo: 0x80, hi: 0xb1}, - {value: 0x0108, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6e, offset 0x363 - {value: 0x0000, lo: 0x03}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xbf}, - // Block 0x6f, offset 0x367 - {value: 0x0000, lo: 0x0e}, - {value: 0x3008, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xba}, - {value: 0x0008, lo: 0xbb, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x70, offset 0x376 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x71, offset 0x37b - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x91}, - {value: 0x3008, lo: 0x92, hi: 0x92}, - {value: 0x3808, lo: 0x93, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x72, offset 0x383 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb9}, - {value: 0x3008, lo: 0xba, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x73, offset 0x38d - {value: 0x0000, lo: 0x0a}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x74, offset 0x398 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x75, offset 0x3a0 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8c}, - {value: 0x3008, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbd}, - {value: 0x0008, lo: 0xbe, hi: 0xbf}, - // Block 0x76, offset 0x3b1 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x77, offset 0x3ba - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x9a}, - {value: 0x0008, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3b08, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x78, offset 0x3ca - {value: 0x0000, lo: 0x0c}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x90}, - {value: 0x0008, lo: 0x91, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x79, offset 0x3d7 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x4465, lo: 0x9c, hi: 0x9c}, - {value: 0x447d, lo: 0x9d, hi: 0x9d}, - {value: 0x2971, lo: 0x9e, hi: 0x9e}, - {value: 0xe06d, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xaf}, - {value: 0x4495, lo: 0xb0, hi: 0xbf}, - // Block 0x7a, offset 0x3e1 - {value: 0x0000, lo: 0x04}, - {value: 0x44b5, lo: 0x80, hi: 0x8f}, - {value: 0x44d5, lo: 0x90, hi: 0x9f}, - {value: 0x44f5, lo: 0xa0, hi: 0xaf}, - {value: 0x44d5, lo: 0xb0, hi: 0xbf}, - // Block 0x7b, offset 0x3e6 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3b08, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x7c, offset 0x3f3 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x7d, offset 0x3f7 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x7e, offset 0x3fc - {value: 0x0020, lo: 0x01}, - {value: 0x4515, lo: 0x80, hi: 0xbf}, - // Block 0x7f, offset 0x3fe - {value: 0x0020, lo: 0x03}, - {value: 0x4d15, lo: 0x80, hi: 0x94}, - {value: 0x4ad5, lo: 0x95, hi: 0x95}, - {value: 0x4fb5, lo: 0x96, hi: 0xbf}, - // Block 0x80, offset 0x402 - {value: 0x0020, lo: 0x01}, - {value: 0x54f5, lo: 0x80, hi: 0xbf}, - // Block 0x81, offset 0x404 - {value: 0x0020, lo: 0x03}, - {value: 0x5cf5, lo: 0x80, hi: 0x84}, - {value: 0x5655, lo: 0x85, hi: 0x85}, - {value: 0x5d95, lo: 0x86, hi: 0xbf}, - // Block 0x82, offset 0x408 - {value: 0x0020, lo: 0x08}, - {value: 0x6b55, lo: 0x80, hi: 0x8f}, - {value: 0x6d15, lo: 0x90, hi: 0x90}, - {value: 0x6d55, lo: 0x91, hi: 0xab}, - {value: 0x6ea1, lo: 0xac, hi: 0xac}, - {value: 0x70b5, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x70d5, lo: 0xb0, hi: 0xbf}, - // Block 0x83, offset 0x411 - {value: 0x0020, lo: 0x05}, - {value: 0x72d5, lo: 0x80, hi: 0xad}, - {value: 0x6535, lo: 0xae, hi: 0xae}, - {value: 0x7895, lo: 0xaf, hi: 0xb5}, - {value: 0x6f55, lo: 0xb6, hi: 0xb6}, - {value: 0x7975, lo: 0xb7, hi: 0xbf}, - // Block 0x84, offset 0x417 - {value: 0x0028, lo: 0x03}, - {value: 0x7c21, lo: 0x80, hi: 0x82}, - {value: 0x7be1, lo: 0x83, hi: 0x83}, - {value: 0x7c99, lo: 0x84, hi: 0xbf}, - // Block 0x85, offset 0x41b - {value: 0x0038, lo: 0x0f}, - {value: 0x9db1, lo: 0x80, hi: 0x83}, - {value: 0x9e59, lo: 0x84, hi: 0x85}, - {value: 0x9e91, lo: 0x86, hi: 0x87}, - {value: 0x9ec9, lo: 0x88, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0xa089, lo: 0x92, hi: 0x97}, - {value: 0xa1a1, lo: 0x98, hi: 0x9c}, - {value: 0xa281, lo: 0x9d, hi: 0xb3}, - {value: 0x9d41, lo: 0xb4, hi: 0xb4}, - {value: 0x9db1, lo: 0xb5, hi: 0xb5}, - {value: 0xa789, lo: 0xb6, hi: 0xbb}, - {value: 0xa869, lo: 0xbc, hi: 0xbc}, - {value: 0xa7f9, lo: 0xbd, hi: 0xbd}, - {value: 0xa8d9, lo: 0xbe, hi: 0xbf}, - // Block 0x86, offset 0x42b - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x0008, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x87, offset 0x435 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0x88, offset 0x43a - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x89, offset 0x43d - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x8a, offset 0x443 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x8b, offset 0x44a - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x8c, offset 0x44f - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x8d, offset 0x453 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x8e, offset 0x459 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xbf}, - // Block 0x8f, offset 0x45e - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x90, offset 0x467 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x91, offset 0x46c - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0xbf}, - // Block 0x92, offset 0x472 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x97}, - {value: 0x8ad5, lo: 0x98, hi: 0x9f}, - {value: 0x8aed, lo: 0xa0, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xbf}, - // Block 0x93, offset 0x479 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x8aed, lo: 0xb0, hi: 0xb7}, - {value: 0x8ad5, lo: 0xb8, hi: 0xbf}, - // Block 0x94, offset 0x480 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x95, offset 0x487 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x96, offset 0x48b - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xae}, - {value: 0x0018, lo: 0xaf, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x97, offset 0x490 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x98, offset 0x493 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xbf}, - // Block 0x99, offset 0x498 - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0808, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0808, lo: 0x8a, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb6}, - {value: 0x0808, lo: 0xb7, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbb}, - {value: 0x0808, lo: 0xbc, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x0808, lo: 0xbf, hi: 0xbf}, - // Block 0x9a, offset 0x4a4 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x96}, - {value: 0x0818, lo: 0x97, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb6}, - {value: 0x0818, lo: 0xb7, hi: 0xbf}, - // Block 0x9b, offset 0x4aa - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa6}, - {value: 0x0818, lo: 0xa7, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x9c, offset 0x4af - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xba}, - {value: 0x0818, lo: 0xbb, hi: 0xbf}, - // Block 0x9d, offset 0x4b6 - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0818, lo: 0x96, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbe}, - {value: 0x0818, lo: 0xbf, hi: 0xbf}, - // Block 0x9e, offset 0x4be - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbb}, - {value: 0x0818, lo: 0xbc, hi: 0xbd}, - {value: 0x0808, lo: 0xbe, hi: 0xbf}, - // Block 0x9f, offset 0x4c3 - {value: 0x0000, lo: 0x03}, - {value: 0x0818, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x0818, lo: 0x92, hi: 0xbf}, - // Block 0xa0, offset 0x4c7 - {value: 0x0000, lo: 0x0f}, - {value: 0x0808, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x94}, - {value: 0x0808, lo: 0x95, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0x98}, - {value: 0x0808, lo: 0x99, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xa1, offset 0x4d7 - {value: 0x0000, lo: 0x06}, - {value: 0x0818, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x0818, lo: 0x90, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xbc}, - {value: 0x0818, lo: 0xbd, hi: 0xbf}, - // Block 0xa2, offset 0x4de - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0x9c}, - {value: 0x0818, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xa3, offset 0x4e2 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb8}, - {value: 0x0018, lo: 0xb9, hi: 0xbf}, - // Block 0xa4, offset 0x4e6 - {value: 0x0000, lo: 0x06}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0818, lo: 0x98, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb7}, - {value: 0x0818, lo: 0xb8, hi: 0xbf}, - // Block 0xa5, offset 0x4ed - {value: 0x0000, lo: 0x01}, - {value: 0x0808, lo: 0x80, hi: 0xbf}, - // Block 0xa6, offset 0x4ef - {value: 0x0000, lo: 0x02}, - {value: 0x0808, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0xa7, offset 0x4f2 - {value: 0x0000, lo: 0x02}, - {value: 0x03dd, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xa8, offset 0x4f5 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xbf}, - // Block 0xa9, offset 0x4f9 - {value: 0x0000, lo: 0x08}, - {value: 0x0908, lo: 0x80, hi: 0x80}, - {value: 0x0a08, lo: 0x81, hi: 0xa1}, - {value: 0x0c08, lo: 0xa2, hi: 0xa2}, - {value: 0x0a08, lo: 0xa3, hi: 0xa3}, - {value: 0x3308, lo: 0xa4, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0808, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xaa, offset 0x502 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0818, lo: 0xa0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xab, offset 0x506 - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x9c}, - {value: 0x0818, lo: 0x9d, hi: 0xa6}, - {value: 0x0808, lo: 0xa7, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0a08, lo: 0xb0, hi: 0xb2}, - {value: 0x0c08, lo: 0xb3, hi: 0xb3}, - {value: 0x0a08, lo: 0xb4, hi: 0xbf}, - // Block 0xac, offset 0x50e - {value: 0x0000, lo: 0x07}, - {value: 0x0a08, lo: 0x80, hi: 0x84}, - {value: 0x0808, lo: 0x85, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x90}, - {value: 0x0a18, lo: 0x91, hi: 0x93}, - {value: 0x0c18, lo: 0x94, hi: 0x94}, - {value: 0x0818, lo: 0x95, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xad, offset 0x516 - {value: 0x0000, lo: 0x05}, - {value: 0x3008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xae, offset 0x51c - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x91}, - {value: 0x0018, lo: 0x92, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xaf, offset 0x525 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0xb0, offset 0x531 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb1, offset 0x538 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb2}, - {value: 0x3b08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xbf}, - // Block 0xb2, offset 0x541 - {value: 0x0000, lo: 0x09}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x3008, lo: 0x85, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xb3, offset 0x54b - {value: 0x0000, lo: 0x06}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xbe}, - {value: 0x3008, lo: 0xbf, hi: 0xbf}, - // Block 0xb4, offset 0x552 - {value: 0x0000, lo: 0x0d}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xb5, offset 0x560 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3808, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xb6, offset 0x56d - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0008, lo: 0x9f, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xb7, offset 0x57a - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x3308, lo: 0x9f, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa9}, - {value: 0x3b08, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb8, offset 0x583 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xb9, offset 0x587 - {value: 0x0000, lo: 0x0e}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x84}, - {value: 0x3008, lo: 0x85, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9d}, - {value: 0x3308, lo: 0x9e, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xbf}, - // Block 0xba, offset 0x596 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xbb, offset 0x59e - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x85}, - {value: 0x0018, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xbc, offset 0x5a9 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbd, offset 0x5b2 - {value: 0x0000, lo: 0x05}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9b}, - {value: 0x3308, lo: 0x9c, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0xbe, offset 0x5b8 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbf, offset 0x5c0 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xc0, offset 0x5c9 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb5}, - {value: 0x3808, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0xc1, offset 0x5d3 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0xbf}, - // Block 0xc2, offset 0x5d6 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbf}, - // Block 0xc3, offset 0x5e2 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0xc4, offset 0x5eb - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xbf}, - // Block 0xc5, offset 0x5ee - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0xc6, offset 0x5f3 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0xc7, offset 0x5fe - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x3b08, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0xbf}, - // Block 0xc8, offset 0x607 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x89}, - {value: 0x3308, lo: 0x8a, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x98}, - {value: 0x3b08, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9c}, - {value: 0x0008, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xa2}, - {value: 0x0040, lo: 0xa3, hi: 0xbf}, - // Block 0xc9, offset 0x613 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xca, offset 0x616 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xcb, offset 0x620 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xbf}, - // Block 0xcc, offset 0x629 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xa9}, - {value: 0x3308, lo: 0xaa, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xcd, offset 0x635 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xce, offset 0x642 - {value: 0x0000, lo: 0x0c}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xbf}, - // Block 0xcf, offset 0x64f - {value: 0x0000, lo: 0x0d}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x3008, lo: 0x8a, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x92}, - {value: 0x3008, lo: 0x93, hi: 0x94}, - {value: 0x3308, lo: 0x95, hi: 0x95}, - {value: 0x3008, lo: 0x96, hi: 0x96}, - {value: 0x3b08, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xbf}, - // Block 0xd0, offset 0x65d - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xd1, offset 0x664 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xd2, offset 0x667 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xd3, offset 0x66c - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0xbf}, - // Block 0xd4, offset 0x66f - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xbf}, - // Block 0xd5, offset 0x672 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0xbf}, - // Block 0xd6, offset 0x675 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xd7, offset 0x67c - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xd8, offset 0x683 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0xd9, offset 0x687 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x0008, lo: 0xa3, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0xda, offset 0x692 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0xbf}, - // Block 0xdb, offset 0x695 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0xdc, offset 0x698 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0xbf}, - // Block 0xdd, offset 0x69b - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3008, lo: 0x91, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xde, offset 0x6a1 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8e}, - {value: 0x3308, lo: 0x8f, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xdf, offset 0x6a6 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xbf}, - // Block 0xe0, offset 0x6aa - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xe1, offset 0x6ad - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xe2, offset 0x6b0 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xbf}, - // Block 0xe3, offset 0x6b3 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xe4, offset 0x6b6 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0xe5, offset 0x6b9 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0xe6, offset 0x6be - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x03c0, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xbf}, - // Block 0xe7, offset 0x6c8 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xe8, offset 0x6cb - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xbf}, - // Block 0xe9, offset 0x6cf - {value: 0x0000, lo: 0x0e}, - {value: 0x0018, lo: 0x80, hi: 0x9d}, - {value: 0xb5b9, lo: 0x9e, hi: 0x9e}, - {value: 0xb601, lo: 0x9f, hi: 0x9f}, - {value: 0xb649, lo: 0xa0, hi: 0xa0}, - {value: 0xb6b1, lo: 0xa1, hi: 0xa1}, - {value: 0xb719, lo: 0xa2, hi: 0xa2}, - {value: 0xb781, lo: 0xa3, hi: 0xa3}, - {value: 0xb7e9, lo: 0xa4, hi: 0xa4}, - {value: 0x3018, lo: 0xa5, hi: 0xa6}, - {value: 0x3318, lo: 0xa7, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xac}, - {value: 0x3018, lo: 0xad, hi: 0xb2}, - {value: 0x0340, lo: 0xb3, hi: 0xba}, - {value: 0x3318, lo: 0xbb, hi: 0xbf}, - // Block 0xea, offset 0x6de - {value: 0x0000, lo: 0x0b}, - {value: 0x3318, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0x84}, - {value: 0x3318, lo: 0x85, hi: 0x8b}, - {value: 0x0018, lo: 0x8c, hi: 0xa9}, - {value: 0x3318, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xba}, - {value: 0xb851, lo: 0xbb, hi: 0xbb}, - {value: 0xb899, lo: 0xbc, hi: 0xbc}, - {value: 0xb8e1, lo: 0xbd, hi: 0xbd}, - {value: 0xb949, lo: 0xbe, hi: 0xbe}, - {value: 0xb9b1, lo: 0xbf, hi: 0xbf}, - // Block 0xeb, offset 0x6ea - {value: 0x0000, lo: 0x03}, - {value: 0xba19, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xbf}, - // Block 0xec, offset 0x6ee - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x3318, lo: 0x82, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0xbf}, - // Block 0xed, offset 0x6f3 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0xee, offset 0x6f7 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xef, offset 0x6fc - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0xf0, offset 0x700 - {value: 0x0000, lo: 0x04}, - {value: 0x3308, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0xf1, offset 0x705 - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x3308, lo: 0xa1, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xf2, offset 0x70e - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa4}, - {value: 0x0040, lo: 0xa5, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xbf}, - // Block 0xf3, offset 0x719 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x86}, - {value: 0x0818, lo: 0x87, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0xf4, offset 0x71f - {value: 0x0000, lo: 0x07}, - {value: 0x0a08, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0818, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xf5, offset 0x727 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xb0}, - {value: 0x0818, lo: 0xb1, hi: 0xbf}, - // Block 0xf6, offset 0x72a - {value: 0x0000, lo: 0x02}, - {value: 0x0818, lo: 0x80, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xf7, offset 0x72d - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xf8, offset 0x731 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0xf9, offset 0x735 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0xfa, offset 0x73b - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xfb, offset 0x741 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8f}, - {value: 0xc1c1, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xfc, offset 0x746 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xbf}, - // Block 0xfd, offset 0x749 - {value: 0x0000, lo: 0x0f}, - {value: 0xc7e9, lo: 0x80, hi: 0x80}, - {value: 0xc839, lo: 0x81, hi: 0x81}, - {value: 0xc889, lo: 0x82, hi: 0x82}, - {value: 0xc8d9, lo: 0x83, hi: 0x83}, - {value: 0xc929, lo: 0x84, hi: 0x84}, - {value: 0xc979, lo: 0x85, hi: 0x85}, - {value: 0xc9c9, lo: 0x86, hi: 0x86}, - {value: 0xca19, lo: 0x87, hi: 0x87}, - {value: 0xca69, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0xcab9, lo: 0x90, hi: 0x90}, - {value: 0xcad9, lo: 0x91, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xbf}, - // Block 0xfe, offset 0x759 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xff, offset 0x760 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x100, offset 0x763 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0xbf}, - // Block 0x101, offset 0x766 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x102, offset 0x76a - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0x103, offset 0x770 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xbf}, - // Block 0x104, offset 0x775 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x105, offset 0x77a - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb2}, - {value: 0x0018, lo: 0xb3, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbf}, - // Block 0x106, offset 0x782 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xa2}, - {value: 0x0040, lo: 0xa3, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x107, offset 0x787 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x108, offset 0x78b - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xbf}, - // Block 0x109, offset 0x78f - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0x10a, offset 0x792 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x10b, offset 0x795 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x10c, offset 0x799 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x10d, offset 0x79d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x10e, offset 0x7a0 - {value: 0x0020, lo: 0x0f}, - {value: 0xdeb9, lo: 0x80, hi: 0x89}, - {value: 0x8dfd, lo: 0x8a, hi: 0x8a}, - {value: 0xdff9, lo: 0x8b, hi: 0x9c}, - {value: 0x8e1d, lo: 0x9d, hi: 0x9d}, - {value: 0xe239, lo: 0x9e, hi: 0xa2}, - {value: 0x8e3d, lo: 0xa3, hi: 0xa3}, - {value: 0xe2d9, lo: 0xa4, hi: 0xab}, - {value: 0x7ed5, lo: 0xac, hi: 0xac}, - {value: 0xe3d9, lo: 0xad, hi: 0xaf}, - {value: 0x8e5d, lo: 0xb0, hi: 0xb0}, - {value: 0xe439, lo: 0xb1, hi: 0xb6}, - {value: 0x8e7d, lo: 0xb7, hi: 0xb9}, - {value: 0xe4f9, lo: 0xba, hi: 0xba}, - {value: 0x8edd, lo: 0xbb, hi: 0xbb}, - {value: 0xe519, lo: 0xbc, hi: 0xbf}, - // Block 0x10f, offset 0x7b0 - {value: 0x0020, lo: 0x10}, - {value: 0x937d, lo: 0x80, hi: 0x80}, - {value: 0xf099, lo: 0x81, hi: 0x86}, - {value: 0x939d, lo: 0x87, hi: 0x8a}, - {value: 0xd9f9, lo: 0x8b, hi: 0x8b}, - {value: 0xf159, lo: 0x8c, hi: 0x96}, - {value: 0x941d, lo: 0x97, hi: 0x97}, - {value: 0xf2b9, lo: 0x98, hi: 0xa3}, - {value: 0x943d, lo: 0xa4, hi: 0xa6}, - {value: 0xf439, lo: 0xa7, hi: 0xaa}, - {value: 0x949d, lo: 0xab, hi: 0xab}, - {value: 0xf4b9, lo: 0xac, hi: 0xac}, - {value: 0x94bd, lo: 0xad, hi: 0xad}, - {value: 0xf4d9, lo: 0xae, hi: 0xaf}, - {value: 0x94dd, lo: 0xb0, hi: 0xb1}, - {value: 0xf519, lo: 0xb2, hi: 0xbe}, - {value: 0x2040, lo: 0xbf, hi: 0xbf}, - // Block 0x110, offset 0x7c1 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0340, lo: 0x81, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x9f}, - {value: 0x0340, lo: 0xa0, hi: 0xbf}, - // Block 0x111, offset 0x7c6 - {value: 0x0000, lo: 0x01}, - {value: 0x0340, lo: 0x80, hi: 0xbf}, - // Block 0x112, offset 0x7c8 - {value: 0x0000, lo: 0x01}, - {value: 0x33c0, lo: 0x80, hi: 0xbf}, - // Block 0x113, offset 0x7ca - {value: 0x0000, lo: 0x02}, - {value: 0x33c0, lo: 0x80, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, -} - -// Total table size 42466 bytes (41KiB); checksum: 355A58A4 diff --git a/vendor/golang.org/x/net/idna/tables12.00.go b/vendor/golang.org/x/net/idna/tables12.00.go deleted file mode 100644 index f4b8ea363..000000000 --- a/vendor/golang.org/x/net/idna/tables12.00.go +++ /dev/null @@ -1,4733 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// +build go1.14 - -package idna - -// UnicodeVersion is the Unicode version from which the tables in this package are derived. -const UnicodeVersion = "12.0.0" - -var mappings string = "" + // Size: 8178 bytes - "\x00\x01 \x03 ̈\x01a\x03 ̄\x012\x013\x03 ́\x03 ̧\x011\x01o\x051⁄4\x051⁄2" + - "\x053⁄4\x03i̇\x03l·\x03ʼn\x01s\x03dž\x03ⱥ\x03ⱦ\x01h\x01j\x01r\x01w\x01y" + - "\x03 ̆\x03 ̇\x03 ̊\x03 ̨\x03 ̃\x03 ̋\x01l\x01x\x04̈́\x03 ι\x01;\x05 ̈́" + - "\x04եւ\x04اٴ\x04وٴ\x04ۇٴ\x04يٴ\x06क़\x06ख़\x06ग़\x06ज़\x06ड़\x06ढ़\x06फ़" + - "\x06य़\x06ড়\x06ঢ়\x06য়\x06ਲ਼\x06ਸ਼\x06ਖ਼\x06ਗ਼\x06ਜ਼\x06ਫ਼\x06ଡ଼\x06ଢ଼" + - "\x06ํา\x06ໍາ\x06ຫນ\x06ຫມ\x06གྷ\x06ཌྷ\x06དྷ\x06བྷ\x06ཛྷ\x06ཀྵ\x06ཱི\x06ཱུ" + - "\x06ྲྀ\x09ྲཱྀ\x06ླྀ\x09ླཱྀ\x06ཱྀ\x06ྒྷ\x06ྜྷ\x06ྡྷ\x06ྦྷ\x06ྫྷ\x06ྐྵ\x02" + - "в\x02д\x02о\x02с\x02т\x02ъ\x02ѣ\x02æ\x01b\x01d\x01e\x02ǝ\x01g\x01i\x01k" + - "\x01m\x01n\x02ȣ\x01p\x01t\x01u\x02ɐ\x02ɑ\x02ə\x02ɛ\x02ɜ\x02ŋ\x02ɔ\x02ɯ" + - "\x01v\x02β\x02γ\x02δ\x02φ\x02χ\x02ρ\x02н\x02ɒ\x01c\x02ɕ\x02ð\x01f\x02ɟ" + - "\x02ɡ\x02ɥ\x02ɨ\x02ɩ\x02ɪ\x02ʝ\x02ɭ\x02ʟ\x02ɱ\x02ɰ\x02ɲ\x02ɳ\x02ɴ\x02ɵ" + - "\x02ɸ\x02ʂ\x02ʃ\x02ƫ\x02ʉ\x02ʊ\x02ʋ\x02ʌ\x01z\x02ʐ\x02ʑ\x02ʒ\x02θ\x02ss" + - "\x02ά\x02έ\x02ή\x02ί\x02ό\x02ύ\x02ώ\x05ἀι\x05ἁι\x05ἂι\x05ἃι\x05ἄι\x05ἅι" + - "\x05ἆι\x05ἇι\x05ἠι\x05ἡι\x05ἢι\x05ἣι\x05ἤι\x05ἥι\x05ἦι\x05ἧι\x05ὠι\x05ὡι" + - "\x05ὢι\x05ὣι\x05ὤι\x05ὥι\x05ὦι\x05ὧι\x05ὰι\x04αι\x04άι\x05ᾶι\x02ι\x05 ̈͂" + - "\x05ὴι\x04ηι\x04ήι\x05ῆι\x05 ̓̀\x05 ̓́\x05 ̓͂\x02ΐ\x05 ̔̀\x05 ̔́\x05 ̔͂" + - "\x02ΰ\x05 ̈̀\x01`\x05ὼι\x04ωι\x04ώι\x05ῶι\x06′′\x09′′′\x06‵‵\x09‵‵‵\x02!" + - "!\x02??\x02?!\x02!?\x0c′′′′\x010\x014\x015\x016\x017\x018\x019\x01+\x01=" + - "\x01(\x01)\x02rs\x02ħ\x02no\x01q\x02sm\x02tm\x02ω\x02å\x02א\x02ב\x02ג" + - "\x02ד\x02π\x051⁄7\x051⁄9\x061⁄10\x051⁄3\x052⁄3\x051⁄5\x052⁄5\x053⁄5\x054" + - "⁄5\x051⁄6\x055⁄6\x051⁄8\x053⁄8\x055⁄8\x057⁄8\x041⁄\x02ii\x02iv\x02vi" + - "\x04viii\x02ix\x02xi\x050⁄3\x06∫∫\x09∫∫∫\x06∮∮\x09∮∮∮\x0210\x0211\x0212" + - "\x0213\x0214\x0215\x0216\x0217\x0218\x0219\x0220\x04(10)\x04(11)\x04(12)" + - "\x04(13)\x04(14)\x04(15)\x04(16)\x04(17)\x04(18)\x04(19)\x04(20)\x0c∫∫∫∫" + - "\x02==\x05⫝̸\x02ɫ\x02ɽ\x02ȿ\x02ɀ\x01.\x04 ゙\x04 ゚\x06より\x06コト\x05(ᄀ)\x05" + - "(ᄂ)\x05(ᄃ)\x05(ᄅ)\x05(ᄆ)\x05(ᄇ)\x05(ᄉ)\x05(ᄋ)\x05(ᄌ)\x05(ᄎ)\x05(ᄏ)\x05(ᄐ" + - ")\x05(ᄑ)\x05(ᄒ)\x05(가)\x05(나)\x05(다)\x05(라)\x05(마)\x05(바)\x05(사)\x05(아)" + - "\x05(자)\x05(차)\x05(카)\x05(타)\x05(파)\x05(하)\x05(주)\x08(오전)\x08(오후)\x05(一)" + - "\x05(二)\x05(三)\x05(四)\x05(五)\x05(六)\x05(七)\x05(八)\x05(九)\x05(十)\x05(月)" + - "\x05(火)\x05(水)\x05(木)\x05(金)\x05(土)\x05(日)\x05(株)\x05(有)\x05(社)\x05(名)" + - "\x05(特)\x05(財)\x05(祝)\x05(労)\x05(代)\x05(呼)\x05(学)\x05(監)\x05(企)\x05(資)" + - "\x05(協)\x05(祭)\x05(休)\x05(自)\x05(至)\x0221\x0222\x0223\x0224\x0225\x0226" + - "\x0227\x0228\x0229\x0230\x0231\x0232\x0233\x0234\x0235\x06참고\x06주의\x0236" + - "\x0237\x0238\x0239\x0240\x0241\x0242\x0243\x0244\x0245\x0246\x0247\x0248" + - "\x0249\x0250\x041月\x042月\x043月\x044月\x045月\x046月\x047月\x048月\x049月\x0510" + - "月\x0511月\x0512月\x02hg\x02ev\x0cアパート\x0cアルファ\x0cアンペア\x09アール\x0cイニング\x09" + - "インチ\x09ウォン\x0fエスクード\x0cエーカー\x09オンス\x09オーム\x09カイリ\x0cカラット\x0cカロリー\x09ガロ" + - "ン\x09ガンマ\x06ギガ\x09ギニー\x0cキュリー\x0cギルダー\x06キロ\x0fキログラム\x12キロメートル\x0fキロワッ" + - "ト\x09グラム\x0fグラムトン\x0fクルゼイロ\x0cクローネ\x09ケース\x09コルナ\x09コーポ\x0cサイクル\x0fサンチ" + - "ーム\x0cシリング\x09センチ\x09セント\x09ダース\x06デシ\x06ドル\x06トン\x06ナノ\x09ノット\x09ハイツ" + - "\x0fパーセント\x09パーツ\x0cバーレル\x0fピアストル\x09ピクル\x06ピコ\x06ビル\x0fファラッド\x0cフィート" + - "\x0fブッシェル\x09フラン\x0fヘクタール\x06ペソ\x09ペニヒ\x09ヘルツ\x09ペンス\x09ページ\x09ベータ\x0cポイ" + - "ント\x09ボルト\x06ホン\x09ポンド\x09ホール\x09ホーン\x0cマイクロ\x09マイル\x09マッハ\x09マルク\x0fマ" + - "ンション\x0cミクロン\x06ミリ\x0fミリバール\x06メガ\x0cメガトン\x0cメートル\x09ヤード\x09ヤール\x09ユアン" + - "\x0cリットル\x06リラ\x09ルピー\x0cルーブル\x06レム\x0fレントゲン\x09ワット\x040点\x041点\x042点" + - "\x043点\x044点\x045点\x046点\x047点\x048点\x049点\x0510点\x0511点\x0512点\x0513点" + - "\x0514点\x0515点\x0516点\x0517点\x0518点\x0519点\x0520点\x0521点\x0522点\x0523点" + - "\x0524点\x02da\x02au\x02ov\x02pc\x02dm\x02iu\x06平成\x06昭和\x06大正\x06明治\x0c株" + - "式会社\x02pa\x02na\x02ma\x02ka\x02kb\x02mb\x02gb\x04kcal\x02pf\x02nf\x02m" + - "g\x02kg\x02hz\x02ml\x02dl\x02kl\x02fm\x02nm\x02mm\x02cm\x02km\x02m2\x02m" + - "3\x05m∕s\x06m∕s2\x07rad∕s\x08rad∕s2\x02ps\x02ns\x02ms\x02pv\x02nv\x02mv" + - "\x02kv\x02pw\x02nw\x02mw\x02kw\x02bq\x02cc\x02cd\x06c∕kg\x02db\x02gy\x02" + - "ha\x02hp\x02in\x02kk\x02kt\x02lm\x02ln\x02lx\x02ph\x02pr\x02sr\x02sv\x02" + - "wb\x05v∕m\x05a∕m\x041日\x042日\x043日\x044日\x045日\x046日\x047日\x048日\x049日" + - "\x0510日\x0511日\x0512日\x0513日\x0514日\x0515日\x0516日\x0517日\x0518日\x0519日" + - "\x0520日\x0521日\x0522日\x0523日\x0524日\x0525日\x0526日\x0527日\x0528日\x0529日" + - "\x0530日\x0531日\x02ь\x02ɦ\x02ɬ\x02ʞ\x02ʇ\x02œ\x04𤋮\x04𢡊\x04𢡄\x04𣏕\x04𥉉" + - "\x04𥳐\x04𧻓\x02ff\x02fi\x02fl\x02st\x04մն\x04մե\x04մի\x04վն\x04մխ\x04יִ" + - "\x04ײַ\x02ע\x02ה\x02כ\x02ל\x02ם\x02ר\x02ת\x04שׁ\x04שׂ\x06שּׁ\x06שּׂ\x04א" + - "ַ\x04אָ\x04אּ\x04בּ\x04גּ\x04דּ\x04הּ\x04וּ\x04זּ\x04טּ\x04יּ\x04ךּ\x04" + - "כּ\x04לּ\x04מּ\x04נּ\x04סּ\x04ףּ\x04פּ\x04צּ\x04קּ\x04רּ\x04שּ\x04תּ" + - "\x04וֹ\x04בֿ\x04כֿ\x04פֿ\x04אל\x02ٱ\x02ٻ\x02پ\x02ڀ\x02ٺ\x02ٿ\x02ٹ\x02ڤ" + - "\x02ڦ\x02ڄ\x02ڃ\x02چ\x02ڇ\x02ڍ\x02ڌ\x02ڎ\x02ڈ\x02ژ\x02ڑ\x02ک\x02گ\x02ڳ" + - "\x02ڱ\x02ں\x02ڻ\x02ۀ\x02ہ\x02ھ\x02ے\x02ۓ\x02ڭ\x02ۇ\x02ۆ\x02ۈ\x02ۋ\x02ۅ" + - "\x02ۉ\x02ې\x02ى\x04ئا\x04ئە\x04ئو\x04ئۇ\x04ئۆ\x04ئۈ\x04ئې\x04ئى\x02ی\x04" + - "ئج\x04ئح\x04ئم\x04ئي\x04بج\x04بح\x04بخ\x04بم\x04بى\x04بي\x04تج\x04تح" + - "\x04تخ\x04تم\x04تى\x04تي\x04ثج\x04ثم\x04ثى\x04ثي\x04جح\x04جم\x04حج\x04حم" + - "\x04خج\x04خح\x04خم\x04سج\x04سح\x04سخ\x04سم\x04صح\x04صم\x04ضج\x04ضح\x04ضخ" + - "\x04ضم\x04طح\x04طم\x04ظم\x04عج\x04عم\x04غج\x04غم\x04فج\x04فح\x04فخ\x04فم" + - "\x04فى\x04في\x04قح\x04قم\x04قى\x04قي\x04كا\x04كج\x04كح\x04كخ\x04كل\x04كم" + - "\x04كى\x04كي\x04لج\x04لح\x04لخ\x04لم\x04لى\x04لي\x04مج\x04مح\x04مخ\x04مم" + - "\x04مى\x04مي\x04نج\x04نح\x04نخ\x04نم\x04نى\x04ني\x04هج\x04هم\x04هى\x04هي" + - "\x04يج\x04يح\x04يخ\x04يم\x04يى\x04يي\x04ذٰ\x04رٰ\x04ىٰ\x05 ٌّ\x05 ٍّ\x05" + - " َّ\x05 ُّ\x05 ِّ\x05 ّٰ\x04ئر\x04ئز\x04ئن\x04بر\x04بز\x04بن\x04تر\x04تز" + - "\x04تن\x04ثر\x04ثز\x04ثن\x04ما\x04نر\x04نز\x04نن\x04ير\x04يز\x04ين\x04ئخ" + - "\x04ئه\x04به\x04ته\x04صخ\x04له\x04نه\x04هٰ\x04يه\x04ثه\x04سه\x04شم\x04شه" + - "\x06ـَّ\x06ـُّ\x06ـِّ\x04طى\x04طي\x04عى\x04عي\x04غى\x04غي\x04سى\x04سي" + - "\x04شى\x04شي\x04حى\x04حي\x04جى\x04جي\x04خى\x04خي\x04صى\x04صي\x04ضى\x04ضي" + - "\x04شج\x04شح\x04شخ\x04شر\x04سر\x04صر\x04ضر\x04اً\x06تجم\x06تحج\x06تحم" + - "\x06تخم\x06تمج\x06تمح\x06تمخ\x06جمح\x06حمي\x06حمى\x06سحج\x06سجح\x06سجى" + - "\x06سمح\x06سمج\x06سمم\x06صحح\x06صمم\x06شحم\x06شجي\x06شمخ\x06شمم\x06ضحى" + - "\x06ضخم\x06طمح\x06طمم\x06طمي\x06عجم\x06عمم\x06عمى\x06غمم\x06غمي\x06غمى" + - "\x06فخم\x06قمح\x06قمم\x06لحم\x06لحي\x06لحى\x06لجج\x06لخم\x06لمح\x06محج" + - "\x06محم\x06محي\x06مجح\x06مجم\x06مخج\x06مخم\x06مجخ\x06همج\x06همم\x06نحم" + - "\x06نحى\x06نجم\x06نجى\x06نمي\x06نمى\x06يمم\x06بخي\x06تجي\x06تجى\x06تخي" + - "\x06تخى\x06تمي\x06تمى\x06جمي\x06جحى\x06جمى\x06سخى\x06صحي\x06شحي\x06ضحي" + - "\x06لجي\x06لمي\x06يحي\x06يجي\x06يمي\x06ممي\x06قمي\x06نحي\x06عمي\x06كمي" + - "\x06نجح\x06مخي\x06لجم\x06كمم\x06جحي\x06حجي\x06مجي\x06فمي\x06بحي\x06سخي" + - "\x06نجي\x06صلے\x06قلے\x08الله\x08اكبر\x08محمد\x08صلعم\x08رسول\x08عليه" + - "\x08وسلم\x06صلى!صلى الله عليه وسلم\x0fجل جلاله\x08ریال\x01,\x01:\x01!" + - "\x01?\x01_\x01{\x01}\x01[\x01]\x01#\x01&\x01*\x01-\x01<\x01>\x01\\\x01$" + - "\x01%\x01@\x04ـً\x04ـَ\x04ـُ\x04ـِ\x04ـّ\x04ـْ\x02ء\x02آ\x02أ\x02ؤ\x02إ" + - "\x02ئ\x02ا\x02ب\x02ة\x02ت\x02ث\x02ج\x02ح\x02خ\x02د\x02ذ\x02ر\x02ز\x02س" + - "\x02ش\x02ص\x02ض\x02ط\x02ظ\x02ع\x02غ\x02ف\x02ق\x02ك\x02ل\x02م\x02ن\x02ه" + - "\x02و\x02ي\x04لآ\x04لأ\x04لإ\x04لا\x01\x22\x01'\x01/\x01^\x01|\x01~\x02¢" + - "\x02£\x02¬\x02¦\x02¥\x08𝅗𝅥\x08𝅘𝅥\x0c𝅘𝅥𝅮\x0c𝅘𝅥𝅯\x0c𝅘𝅥𝅰\x0c𝅘𝅥𝅱\x0c𝅘𝅥𝅲\x08𝆹" + - "𝅥\x08𝆺𝅥\x0c𝆹𝅥𝅮\x0c𝆺𝅥𝅮\x0c𝆹𝅥𝅯\x0c𝆺𝅥𝅯\x02ı\x02ȷ\x02α\x02ε\x02ζ\x02η\x02" + - "κ\x02λ\x02μ\x02ν\x02ξ\x02ο\x02σ\x02τ\x02υ\x02ψ\x03∇\x03∂\x02ϝ\x02ٮ\x02ڡ" + - "\x02ٯ\x020,\x021,\x022,\x023,\x024,\x025,\x026,\x027,\x028,\x029,\x03(a)" + - "\x03(b)\x03(c)\x03(d)\x03(e)\x03(f)\x03(g)\x03(h)\x03(i)\x03(j)\x03(k)" + - "\x03(l)\x03(m)\x03(n)\x03(o)\x03(p)\x03(q)\x03(r)\x03(s)\x03(t)\x03(u)" + - "\x03(v)\x03(w)\x03(x)\x03(y)\x03(z)\x07〔s〕\x02wz\x02hv\x02sd\x03ppv\x02w" + - "c\x02mc\x02md\x02mr\x02dj\x06ほか\x06ココ\x03サ\x03手\x03字\x03双\x03デ\x03二\x03多" + - "\x03解\x03天\x03交\x03映\x03無\x03料\x03前\x03後\x03再\x03新\x03初\x03終\x03生\x03販" + - "\x03声\x03吹\x03演\x03投\x03捕\x03一\x03三\x03遊\x03左\x03中\x03右\x03指\x03走\x03打" + - "\x03禁\x03空\x03合\x03満\x03有\x03月\x03申\x03割\x03営\x03配\x09〔本〕\x09〔三〕\x09〔二〕" + - "\x09〔安〕\x09〔点〕\x09〔打〕\x09〔盗〕\x09〔勝〕\x09〔敗〕\x03得\x03可\x03丽\x03丸\x03乁\x03你" + - "\x03侮\x03侻\x03倂\x03偺\x03備\x03僧\x03像\x03㒞\x03免\x03兔\x03兤\x03具\x03㒹\x03內" + - "\x03冗\x03冤\x03仌\x03冬\x03况\x03凵\x03刃\x03㓟\x03刻\x03剆\x03剷\x03㔕\x03勇\x03勉" + - "\x03勤\x03勺\x03包\x03匆\x03北\x03卉\x03卑\x03博\x03即\x03卽\x03卿\x03灰\x03及\x03叟" + - "\x03叫\x03叱\x03吆\x03咞\x03吸\x03呈\x03周\x03咢\x03哶\x03唐\x03啓\x03啣\x03善\x03喙" + - "\x03喫\x03喳\x03嗂\x03圖\x03嘆\x03圗\x03噑\x03噴\x03切\x03壮\x03城\x03埴\x03堍\x03型" + - "\x03堲\x03報\x03墬\x03売\x03壷\x03夆\x03夢\x03奢\x03姬\x03娛\x03娧\x03姘\x03婦\x03㛮" + - "\x03嬈\x03嬾\x03寃\x03寘\x03寧\x03寳\x03寿\x03将\x03尢\x03㞁\x03屠\x03屮\x03峀\x03岍" + - "\x03嵃\x03嵮\x03嵫\x03嵼\x03巡\x03巢\x03㠯\x03巽\x03帨\x03帽\x03幩\x03㡢\x03㡼\x03庰" + - "\x03庳\x03庶\x03廊\x03廾\x03舁\x03弢\x03㣇\x03形\x03彫\x03㣣\x03徚\x03忍\x03志\x03忹" + - "\x03悁\x03㤺\x03㤜\x03悔\x03惇\x03慈\x03慌\x03慎\x03慺\x03憎\x03憲\x03憤\x03憯\x03懞" + - "\x03懲\x03懶\x03成\x03戛\x03扝\x03抱\x03拔\x03捐\x03挽\x03拼\x03捨\x03掃\x03揤\x03搢" + - "\x03揅\x03掩\x03㨮\x03摩\x03摾\x03撝\x03摷\x03㩬\x03敏\x03敬\x03旣\x03書\x03晉\x03㬙" + - "\x03暑\x03㬈\x03㫤\x03冒\x03冕\x03最\x03暜\x03肭\x03䏙\x03朗\x03望\x03朡\x03杞\x03杓" + - "\x03㭉\x03柺\x03枅\x03桒\x03梅\x03梎\x03栟\x03椔\x03㮝\x03楂\x03榣\x03槪\x03檨\x03櫛" + - "\x03㰘\x03次\x03歔\x03㱎\x03歲\x03殟\x03殺\x03殻\x03汎\x03沿\x03泍\x03汧\x03洖\x03派" + - "\x03海\x03流\x03浩\x03浸\x03涅\x03洴\x03港\x03湮\x03㴳\x03滋\x03滇\x03淹\x03潮\x03濆" + - "\x03瀹\x03瀞\x03瀛\x03㶖\x03灊\x03災\x03灷\x03炭\x03煅\x03熜\x03爨\x03爵\x03牐\x03犀" + - "\x03犕\x03獺\x03王\x03㺬\x03玥\x03㺸\x03瑇\x03瑜\x03瑱\x03璅\x03瓊\x03㼛\x03甤\x03甾" + - "\x03異\x03瘐\x03㿼\x03䀈\x03直\x03眞\x03真\x03睊\x03䀹\x03瞋\x03䁆\x03䂖\x03硎\x03碌" + - "\x03磌\x03䃣\x03祖\x03福\x03秫\x03䄯\x03穀\x03穊\x03穏\x03䈂\x03篆\x03築\x03䈧\x03糒" + - "\x03䊠\x03糨\x03糣\x03紀\x03絣\x03䌁\x03緇\x03縂\x03繅\x03䌴\x03䍙\x03罺\x03羕\x03翺" + - "\x03者\x03聠\x03聰\x03䏕\x03育\x03脃\x03䐋\x03脾\x03媵\x03舄\x03辞\x03䑫\x03芑\x03芋" + - "\x03芝\x03劳\x03花\x03芳\x03芽\x03苦\x03若\x03茝\x03荣\x03莭\x03茣\x03莽\x03菧\x03著" + - "\x03荓\x03菊\x03菌\x03菜\x03䔫\x03蓱\x03蓳\x03蔖\x03蕤\x03䕝\x03䕡\x03䕫\x03虐\x03虜" + - "\x03虧\x03虩\x03蚩\x03蚈\x03蜎\x03蛢\x03蝹\x03蜨\x03蝫\x03螆\x03蟡\x03蠁\x03䗹\x03衠" + - "\x03衣\x03裗\x03裞\x03䘵\x03裺\x03㒻\x03䚾\x03䛇\x03誠\x03諭\x03變\x03豕\x03貫\x03賁" + - "\x03贛\x03起\x03跋\x03趼\x03跰\x03軔\x03輸\x03邔\x03郱\x03鄑\x03鄛\x03鈸\x03鋗\x03鋘" + - "\x03鉼\x03鏹\x03鐕\x03開\x03䦕\x03閷\x03䧦\x03雃\x03嶲\x03霣\x03䩮\x03䩶\x03韠\x03䪲" + - "\x03頋\x03頩\x03飢\x03䬳\x03餩\x03馧\x03駂\x03駾\x03䯎\x03鬒\x03鱀\x03鳽\x03䳎\x03䳭" + - "\x03鵧\x03䳸\x03麻\x03䵖\x03黹\x03黾\x03鼅\x03鼏\x03鼖\x03鼻" - -var xorData string = "" + // Size: 4862 bytes - "\x02\x0c\x09\x02\xb0\xec\x02\xad\xd8\x02\xad\xd9\x02\x06\x07\x02\x0f\x12" + - "\x02\x0f\x1f\x02\x0f\x1d\x02\x01\x13\x02\x0f\x16\x02\x0f\x0b\x02\x0f3" + - "\x02\x0f7\x02\x0f?\x02\x0f/\x02\x0f*\x02\x0c&\x02\x0c*\x02\x0c;\x02\x0c9" + - "\x02\x0c%\x02\xab\xed\x02\xab\xe2\x02\xab\xe3\x02\xa9\xe0\x02\xa9\xe1" + - "\x02\xa9\xe6\x02\xa3\xcb\x02\xa3\xc8\x02\xa3\xc9\x02\x01#\x02\x01\x08" + - "\x02\x0e>\x02\x0e'\x02\x0f\x03\x02\x03\x0d\x02\x03\x09\x02\x03\x17\x02" + - "\x03\x0e\x02\x02\x03\x02\x011\x02\x01\x00\x02\x01\x10\x02\x03<\x02\x07" + - "\x0d\x02\x02\x0c\x02\x0c0\x02\x01\x03\x02\x01\x01\x02\x01 \x02\x01\x22" + - "\x02\x01)\x02\x01\x0a\x02\x01\x0c\x02\x02\x06\x02\x02\x02\x02\x03\x10" + - "\x03\x037 \x03\x0b+\x03\x021\x00\x02\x01\x04\x02\x01\x02\x02\x019\x02" + - "\x03\x1c\x02\x02$\x03\x80p$\x02\x03:\x02\x03\x0a\x03\xc1r.\x03\xc1r,\x03" + - "\xc1r\x02\x02\x02:\x02\x02>\x02\x02,\x02\x02\x10\x02\x02\x00\x03\xc1s<" + - "\x03\xc1s*\x03\xc2L$\x03\xc2L;\x02\x09)\x02\x0a\x19\x03\x83\xab\xe3\x03" + - "\x83\xab\xf2\x03 4\xe0\x03\x81\xab\xea\x03\x81\xab\xf3\x03 4\xef\x03\x96" + - "\xe1\xcd\x03\x84\xe5\xc3\x02\x0d\x11\x03\x8b\xec\xcb\x03\x94\xec\xcf\x03" + - "\x9a\xec\xc2\x03\x8b\xec\xdb\x03\x94\xec\xdf\x03\x9a\xec\xd2\x03\x01\x0c" + - "!\x03\x01\x0c#\x03ʠ\x9d\x03ʣ\x9c\x03ʢ\x9f\x03ʥ\x9e\x03ʤ\x91\x03ʧ\x90\x03" + - "ʦ\x93\x03ʩ\x92\x03ʨ\x95\x03\xca\xf3\xb5\x03\xca\xf0\xb4\x03\xca\xf1\xb7" + - "\x03\xca\xf6\xb6\x03\xca\xf7\x89\x03\xca\xf4\x88\x03\xca\xf5\x8b\x03\xca" + - "\xfa\x8a\x03\xca\xfb\x8d\x03\xca\xf8\x8c\x03\xca\xf9\x8f\x03\xca\xfe\x8e" + - "\x03\xca\xff\x81\x03\xca\xfc\x80\x03\xca\xfd\x83\x03\xca\xe2\x82\x03\xca" + - "\xe3\x85\x03\xca\xe0\x84\x03\xca\xe1\x87\x03\xca\xe6\x86\x03\xca\xe7\x99" + - "\x03\xca\xe4\x98\x03\xca\xe5\x9b\x03\xca\xea\x9a\x03\xca\xeb\x9d\x03\xca" + - "\xe8\x9c\x03ؓ\x89\x03ߔ\x8b\x02\x010\x03\x03\x04\x1e\x03\x04\x15\x12\x03" + - "\x0b\x05,\x03\x06\x04\x00\x03\x06\x04)\x03\x06\x044\x03\x06\x04<\x03\x06" + - "\x05\x1d\x03\x06\x06\x00\x03\x06\x06\x0a\x03\x06\x06'\x03\x06\x062\x03" + - "\x0786\x03\x079/\x03\x079 \x03\x07:\x0e\x03\x07:\x1b\x03\x07:%\x03\x07;/" + - "\x03\x07;%\x03\x074\x11\x03\x076\x09\x03\x077*\x03\x070\x01\x03\x070\x0f" + - "\x03\x070.\x03\x071\x16\x03\x071\x04\x03\x0710\x03\x072\x18\x03\x072-" + - "\x03\x073\x14\x03\x073>\x03\x07'\x09\x03\x07 \x00\x03\x07\x1f\x0b\x03" + - "\x07\x18#\x03\x07\x18(\x03\x07\x186\x03\x07\x18\x03\x03\x07\x19\x16\x03" + - "\x07\x116\x03\x07\x12'\x03\x07\x13\x10\x03\x07\x0c&\x03\x07\x0c\x08\x03" + - "\x07\x0c\x13\x03\x07\x0d\x02\x03\x07\x0d\x1c\x03\x07\x0b5\x03\x07\x0b" + - "\x0a\x03\x07\x0b\x01\x03\x07\x0b\x0f\x03\x07\x05\x00\x03\x07\x05\x09\x03" + - "\x07\x05\x0b\x03\x07\x07\x01\x03\x07\x07\x08\x03\x07\x00<\x03\x07\x00+" + - "\x03\x07\x01)\x03\x07\x01\x1b\x03\x07\x01\x08\x03\x07\x03?\x03\x0445\x03" + - "\x044\x08\x03\x0454\x03\x04)/\x03\x04)5\x03\x04+\x05\x03\x04+\x14\x03" + - "\x04+ \x03\x04+<\x03\x04*&\x03\x04*\x22\x03\x04&8\x03\x04!\x01\x03\x04!" + - "\x22\x03\x04\x11+\x03\x04\x10.\x03\x04\x104\x03\x04\x13=\x03\x04\x12\x04" + - "\x03\x04\x12\x0a\x03\x04\x0d\x1d\x03\x04\x0d\x07\x03\x04\x0d \x03\x05<>" + - "\x03\x055<\x03\x055!\x03\x055#\x03\x055&\x03\x054\x1d\x03\x054\x02\x03" + - "\x054\x07\x03\x0571\x03\x053\x1a\x03\x053\x16\x03\x05.<\x03\x05.\x07\x03" + - "\x05):\x03\x05)<\x03\x05)\x0c\x03\x05)\x15\x03\x05+-\x03\x05+5\x03\x05$" + - "\x1e\x03\x05$\x14\x03\x05'\x04\x03\x05'\x14\x03\x05&\x02\x03\x05\x226" + - "\x03\x05\x22\x0c\x03\x05\x22\x1c\x03\x05\x19\x0a\x03\x05\x1b\x09\x03\x05" + - "\x1b\x0c\x03\x05\x14\x07\x03\x05\x16?\x03\x05\x16\x0c\x03\x05\x0c\x05" + - "\x03\x05\x0e\x0f\x03\x05\x01\x0e\x03\x05\x00(\x03\x05\x030\x03\x05\x03" + - "\x06\x03\x0a==\x03\x0a=1\x03\x0a=,\x03\x0a=\x0c\x03\x0a??\x03\x0a<\x08" + - "\x03\x0a9!\x03\x0a9)\x03\x0a97\x03\x0a99\x03\x0a6\x0a\x03\x0a6\x1c\x03" + - "\x0a6\x17\x03\x0a7'\x03\x0a78\x03\x0a73\x03\x0a'\x01\x03\x0a'&\x03\x0a" + - "\x1f\x0e\x03\x0a\x1f\x03\x03\x0a\x1f3\x03\x0a\x1b/\x03\x0a\x18\x19\x03" + - "\x0a\x19\x01\x03\x0a\x16\x14\x03\x0a\x0e\x22\x03\x0a\x0f\x10\x03\x0a\x0f" + - "\x02\x03\x0a\x0f \x03\x0a\x0c\x04\x03\x0a\x0b>\x03\x0a\x0b+\x03\x0a\x08/" + - "\x03\x0a\x046\x03\x0a\x05\x14\x03\x0a\x00\x04\x03\x0a\x00\x10\x03\x0a" + - "\x00\x14\x03\x0b<3\x03\x0b;*\x03\x0b9\x22\x03\x0b9)\x03\x0b97\x03\x0b+" + - "\x10\x03\x0b((\x03\x0b&5\x03\x0b$\x1c\x03\x0b$\x12\x03\x0b%\x04\x03\x0b#" + - "<\x03\x0b#0\x03\x0b#\x0d\x03\x0b#\x19\x03\x0b!:\x03\x0b!\x1f\x03\x0b!" + - "\x00\x03\x0b\x1e5\x03\x0b\x1c\x1d\x03\x0b\x1d-\x03\x0b\x1d(\x03\x0b\x18." + - "\x03\x0b\x18 \x03\x0b\x18\x16\x03\x0b\x14\x13\x03\x0b\x15$\x03\x0b\x15" + - "\x22\x03\x0b\x12\x1b\x03\x0b\x12\x10\x03\x0b\x132\x03\x0b\x13=\x03\x0b" + - "\x12\x18\x03\x0b\x0c&\x03\x0b\x061\x03\x0b\x06:\x03\x0b\x05#\x03\x0b\x05" + - "<\x03\x0b\x04\x0b\x03\x0b\x04\x04\x03\x0b\x04\x1b\x03\x0b\x042\x03\x0b" + - "\x041\x03\x0b\x03\x03\x03\x0b\x03\x1d\x03\x0b\x03/\x03\x0b\x03+\x03\x0b" + - "\x02\x1b\x03\x0b\x02\x00\x03\x0b\x01\x1e\x03\x0b\x01\x08\x03\x0b\x015" + - "\x03\x06\x0d9\x03\x06\x0d=\x03\x06\x0d?\x03\x02\x001\x03\x02\x003\x03" + - "\x02\x02\x19\x03\x02\x006\x03\x02\x02\x1b\x03\x02\x004\x03\x02\x00<\x03" + - "\x02\x02\x0a\x03\x02\x02\x0e\x03\x02\x01\x1a\x03\x02\x01\x07\x03\x02\x01" + - "\x05\x03\x02\x01\x0b\x03\x02\x01%\x03\x02\x01\x0c\x03\x02\x01\x04\x03" + - "\x02\x01\x1c\x03\x02\x00.\x03\x02\x002\x03\x02\x00>\x03\x02\x00\x12\x03" + - "\x02\x00\x16\x03\x02\x011\x03\x02\x013\x03\x02\x02 \x03\x02\x02%\x03\x02" + - "\x02$\x03\x02\x028\x03\x02\x02;\x03\x02\x024\x03\x02\x012\x03\x02\x022" + - "\x03\x02\x02/\x03\x02\x01,\x03\x02\x01\x13\x03\x02\x01\x16\x03\x02\x01" + - "\x11\x03\x02\x01\x1e\x03\x02\x01\x15\x03\x02\x01\x17\x03\x02\x01\x0f\x03" + - "\x02\x01\x08\x03\x02\x00?\x03\x02\x03\x07\x03\x02\x03\x0d\x03\x02\x03" + - "\x13\x03\x02\x03\x1d\x03\x02\x03\x1f\x03\x02\x00\x03\x03\x02\x00\x0d\x03" + - "\x02\x00\x01\x03\x02\x00\x1b\x03\x02\x00\x19\x03\x02\x00\x18\x03\x02\x00" + - "\x13\x03\x02\x00/\x03\x07>\x12\x03\x07<\x1f\x03\x07>\x1d\x03\x06\x1d\x0e" + - "\x03\x07>\x1c\x03\x07>:\x03\x07>\x13\x03\x04\x12+\x03\x07?\x03\x03\x07>" + - "\x02\x03\x06\x224\x03\x06\x1a.\x03\x07<%\x03\x06\x1c\x0b\x03\x0609\x03" + - "\x05\x1f\x01\x03\x04'\x08\x03\x93\xfd\xf5\x03\x02\x0d \x03\x02\x0d#\x03" + - "\x02\x0d!\x03\x02\x0d&\x03\x02\x0d\x22\x03\x02\x0d/\x03\x02\x0d,\x03\x02" + - "\x0d$\x03\x02\x0d'\x03\x02\x0d%\x03\x02\x0d;\x03\x02\x0d=\x03\x02\x0d?" + - "\x03\x099.\x03\x08\x0b7\x03\x08\x02\x14\x03\x08\x14\x0d\x03\x08.:\x03" + - "\x089'\x03\x0f\x0b\x18\x03\x0f\x1c1\x03\x0f\x17&\x03\x0f9\x1f\x03\x0f0" + - "\x0c\x03\x0e\x0a9\x03\x0e\x056\x03\x0e\x1c#\x03\x0f\x13\x0e\x03\x072\x00" + - "\x03\x070\x0d\x03\x072\x0b\x03\x06\x11\x18\x03\x070\x10\x03\x06\x0f(\x03" + - "\x072\x05\x03\x06\x0f,\x03\x073\x15\x03\x06\x07\x08\x03\x05\x16\x02\x03" + - "\x04\x0b \x03\x05:8\x03\x05\x16%\x03\x0a\x0d\x1f\x03\x06\x16\x10\x03\x05" + - "\x1d5\x03\x05*;\x03\x05\x16\x1b\x03\x04.-\x03\x06\x1a\x19\x03\x04\x03," + - "\x03\x0b87\x03\x04/\x0a\x03\x06\x00,\x03\x04-\x01\x03\x04\x1e-\x03\x06/(" + - "\x03\x0a\x0b5\x03\x06\x0e7\x03\x06\x07.\x03\x0597\x03\x0a*%\x03\x0760" + - "\x03\x06\x0c;\x03\x05'\x00\x03\x072.\x03\x072\x08\x03\x06=\x01\x03\x06" + - "\x05\x1b\x03\x06\x06\x12\x03\x06$=\x03\x06'\x0d\x03\x04\x11\x0f\x03\x076" + - ",\x03\x06\x07;\x03\x06.,\x03\x86\xf9\xea\x03\x8f\xff\xeb\x02\x092\x02" + - "\x095\x02\x094\x02\x09;\x02\x09>\x02\x098\x02\x09*\x02\x09/\x02\x09,\x02" + - "\x09%\x02\x09&\x02\x09#\x02\x09 \x02\x08!\x02\x08%\x02\x08$\x02\x08+\x02" + - "\x08.\x02\x08*\x02\x08&\x02\x088\x02\x08>\x02\x084\x02\x086\x02\x080\x02" + - "\x08\x10\x02\x08\x17\x02\x08\x12\x02\x08\x1d\x02\x08\x1f\x02\x08\x13\x02" + - "\x08\x15\x02\x08\x14\x02\x08\x0c\x03\x8b\xfd\xd0\x03\x81\xec\xc6\x03\x87" + - "\xe0\x8a\x03-2\xe3\x03\x80\xef\xe4\x03-2\xea\x03\x88\xe6\xeb\x03\x8e\xe6" + - "\xe8\x03\x84\xe6\xe9\x03\x97\xe6\xee\x03-2\xf9\x03-2\xf6\x03\x8e\xe3\xad" + - "\x03\x80\xe3\x92\x03\x88\xe3\x90\x03\x8e\xe3\x90\x03\x80\xe3\x97\x03\x88" + - "\xe3\x95\x03\x88\xfe\xcb\x03\x8e\xfe\xca\x03\x84\xfe\xcd\x03\x91\xef\xc9" + - "\x03-2\xc1\x03-2\xc0\x03-2\xcb\x03\x88@\x09\x03\x8e@\x08\x03\x8f\xe0\xf5" + - "\x03\x8e\xe6\xf9\x03\x8e\xe0\xfa\x03\x93\xff\xf4\x03\x84\xee\xd3\x03\x0b" + - "(\x04\x023 \x03\x0b)\x08\x021;\x02\x01*\x03\x0b#\x10\x03\x0b 0\x03\x0b!" + - "\x10\x03\x0b!0\x03\x07\x15\x08\x03\x09?5\x03\x07\x1f\x08\x03\x07\x17\x0b" + - "\x03\x09\x1f\x15\x03\x0b\x1c7\x03\x0a+#\x03\x06\x1a\x1b\x03\x06\x1a\x14" + - "\x03\x0a\x01\x18\x03\x06#\x1b\x03\x0a2\x0c\x03\x0a\x01\x04\x03\x09#;\x03" + - "\x08='\x03\x08\x1a\x0a\x03\x07</\x03\x07:+\x03\x07\x07*\x03\x06&\x1c\x03" + - "\x09\x0c\x16\x03\x09\x10\x0e\x03\x08'\x0f\x03\x08+\x09\x03\x074%\x03\x06" + - "!3\x03\x06\x03+\x03\x0b\x1e\x19\x03\x0a))\x03\x09\x08\x19\x03\x08,\x05" + - "\x03\x07<2\x03\x06\x1c>\x03\x0a\x111\x03\x09\x1b\x09\x03\x073.\x03\x07" + - "\x01\x00\x03\x09/,\x03\x07#>\x03\x07\x048\x03\x0a\x1f\x22\x03\x098>\x03" + - "\x09\x11\x00\x03\x08/\x17\x03\x06'\x22\x03\x0b\x1a+\x03\x0a\x22\x19\x03" + - "\x0a/1\x03\x0974\x03\x09\x0f\x22\x03\x08,\x22\x03\x08?\x14\x03\x07$5\x03" + - "\x07<3\x03\x07=*\x03\x07\x13\x18\x03\x068\x0a\x03\x06\x09\x16\x03\x06" + - "\x13\x00\x03\x08\x067\x03\x08\x01\x03\x03\x08\x12\x1d\x03\x07+7\x03\x06(" + - ";\x03\x06\x1c?\x03\x07\x0e\x17\x03\x0a\x06\x1d\x03\x0a\x19\x07\x03\x08" + - "\x14$\x03\x07$;\x03\x08,$\x03\x08\x06\x0d\x03\x07\x16\x0a\x03\x06>>\x03" + - "\x0a\x06\x12\x03\x0a\x14)\x03\x09\x0d\x1f\x03\x09\x12\x17\x03\x09\x19" + - "\x01\x03\x08\x11 \x03\x08\x1d'\x03\x06<\x1a\x03\x0a.\x00\x03\x07'\x18" + - "\x03\x0a\x22\x08\x03\x08\x0d\x0a\x03\x08\x13)\x03\x07*)\x03\x06<,\x03" + - "\x07\x0b\x1a\x03\x09.\x14\x03\x09\x0d\x1e\x03\x07\x0e#\x03\x0b\x1d'\x03" + - "\x0a\x0a8\x03\x09%2\x03\x08+&\x03\x080\x12\x03\x0a)4\x03\x08\x06\x1f\x03" + - "\x0b\x1b\x1a\x03\x0a\x1b\x0f\x03\x0b\x1d*\x03\x09\x16$\x03\x090\x11\x03" + - "\x08\x11\x08\x03\x0a*(\x03\x0a\x042\x03\x089,\x03\x074'\x03\x07\x0f\x05" + - "\x03\x09\x0b\x0a\x03\x07\x1b\x01\x03\x09\x17:\x03\x09.\x0d\x03\x07.\x11" + - "\x03\x09+\x15\x03\x080\x13\x03\x0b\x1f\x19\x03\x0a \x11\x03\x0a\x220\x03" + - "\x09\x07;\x03\x08\x16\x1c\x03\x07,\x13\x03\x07\x0e/\x03\x06\x221\x03\x0a" + - ".\x0a\x03\x0a7\x02\x03\x0a\x032\x03\x0a\x1d.\x03\x091\x06\x03\x09\x19:" + - "\x03\x08\x02/\x03\x060+\x03\x06\x0f-\x03\x06\x1c\x1f\x03\x06\x1d\x07\x03" + - "\x0a,\x11\x03\x09=\x0d\x03\x09\x0b;\x03\x07\x1b/\x03\x0a\x1f:\x03\x09 " + - "\x1f\x03\x09.\x10\x03\x094\x0b\x03\x09\x1a1\x03\x08#\x1a\x03\x084\x1d" + - "\x03\x08\x01\x1f\x03\x08\x11\x22\x03\x07'8\x03\x07\x1a>\x03\x0757\x03" + - "\x06&9\x03\x06+\x11\x03\x0a.\x0b\x03\x0a,>\x03\x0a4#\x03\x08%\x17\x03" + - "\x07\x05\x22\x03\x07\x0c\x0b\x03\x0a\x1d+\x03\x0a\x19\x16\x03\x09+\x1f" + - "\x03\x09\x08\x0b\x03\x08\x16\x18\x03\x08+\x12\x03\x0b\x1d\x0c\x03\x0a=" + - "\x10\x03\x0a\x09\x0d\x03\x0a\x10\x11\x03\x09&0\x03\x08(\x1f\x03\x087\x07" + - "\x03\x08\x185\x03\x07'6\x03\x06.\x05\x03\x06=\x04\x03\x06;;\x03\x06\x06," + - "\x03\x0b\x18>\x03\x08\x00\x18\x03\x06 \x03\x03\x06<\x00\x03\x09%\x18\x03" + - "\x0b\x1c<\x03\x0a%!\x03\x0a\x09\x12\x03\x0a\x16\x02\x03\x090'\x03\x09" + - "\x0e=\x03\x08 \x0e\x03\x08>\x03\x03\x074>\x03\x06&?\x03\x06\x19\x09\x03" + - "\x06?(\x03\x0a-\x0e\x03\x09:3\x03\x098:\x03\x09\x12\x0b\x03\x09\x1d\x17" + - "\x03\x087\x05\x03\x082\x14\x03\x08\x06%\x03\x08\x13\x1f\x03\x06\x06\x0e" + - "\x03\x0a\x22<\x03\x09/<\x03\x06>+\x03\x0a'?\x03\x0a\x13\x0c\x03\x09\x10<" + - "\x03\x07\x1b=\x03\x0a\x19\x13\x03\x09\x22\x1d\x03\x09\x07\x0d\x03\x08)" + - "\x1c\x03\x06=\x1a\x03\x0a/4\x03\x0a7\x11\x03\x0a\x16:\x03\x09?3\x03\x09:" + - "/\x03\x09\x05\x0a\x03\x09\x14\x06\x03\x087\x22\x03\x080\x07\x03\x08\x1a" + - "\x1f\x03\x07\x04(\x03\x07\x04\x09\x03\x06 %\x03\x06<\x08\x03\x0a+\x14" + - "\x03\x09\x1d\x16\x03\x0a70\x03\x08 >\x03\x0857\x03\x070\x0a\x03\x06=\x12" + - "\x03\x06\x16%\x03\x06\x1d,\x03\x099#\x03\x09\x10>\x03\x07 \x1e\x03\x08" + - "\x0c<\x03\x08\x0b\x18\x03\x08\x15+\x03\x08,:\x03\x08%\x22\x03\x07\x0a$" + - "\x03\x0b\x1c=\x03\x07+\x08\x03\x0a/\x05\x03\x0a \x07\x03\x0a\x12'\x03" + - "\x09#\x11\x03\x08\x1b\x15\x03\x0a\x06\x01\x03\x09\x1c\x1b\x03\x0922\x03" + - "\x07\x14<\x03\x07\x09\x04\x03\x061\x04\x03\x07\x0e\x01\x03\x0a\x13\x18" + - "\x03\x0a-\x0c\x03\x0a?\x0d\x03\x0a\x09\x0a\x03\x091&\x03\x0a/\x0b\x03" + - "\x08$<\x03\x083\x1d\x03\x08\x0c$\x03\x08\x0d\x07\x03\x08\x0d?\x03\x08" + - "\x0e\x14\x03\x065\x0a\x03\x08\x1a#\x03\x08\x16#\x03\x0702\x03\x07\x03" + - "\x1a\x03\x06(\x1d\x03\x06+\x1b\x03\x06\x0b\x05\x03\x06\x0b\x17\x03\x06" + - "\x0c\x04\x03\x06\x1e\x19\x03\x06+0\x03\x062\x18\x03\x0b\x16\x1e\x03\x0a+" + - "\x16\x03\x0a-?\x03\x0a#:\x03\x0a#\x10\x03\x0a%$\x03\x0a>+\x03\x0a01\x03" + - "\x0a1\x10\x03\x0a\x099\x03\x0a\x0a\x12\x03\x0a\x19\x1f\x03\x0a\x19\x12" + - "\x03\x09*)\x03\x09-\x16\x03\x09.1\x03\x09.2\x03\x09<\x0e\x03\x09> \x03" + - "\x093\x12\x03\x09\x0b\x01\x03\x09\x1c2\x03\x09\x11\x1c\x03\x09\x15%\x03" + - "\x08,&\x03\x08!\x22\x03\x089(\x03\x08\x0b\x1a\x03\x08\x0d2\x03\x08\x0c" + - "\x04\x03\x08\x0c\x06\x03\x08\x0c\x1f\x03\x08\x0c\x0c\x03\x08\x0f\x1f\x03" + - "\x08\x0f\x1d\x03\x08\x00\x14\x03\x08\x03\x14\x03\x08\x06\x16\x03\x08\x1e" + - "#\x03\x08\x11\x11\x03\x08\x10\x18\x03\x08\x14(\x03\x07)\x1e\x03\x07.1" + - "\x03\x07 $\x03\x07 '\x03\x078\x08\x03\x07\x0d0\x03\x07\x0f7\x03\x07\x05#" + - "\x03\x07\x05\x1a\x03\x07\x1a7\x03\x07\x1d-\x03\x07\x17\x10\x03\x06)\x1f" + - "\x03\x062\x0b\x03\x066\x16\x03\x06\x09\x11\x03\x09(\x1e\x03\x07!5\x03" + - "\x0b\x11\x16\x03\x0a/\x04\x03\x0a,\x1a\x03\x0b\x173\x03\x0a,1\x03\x0a/5" + - "\x03\x0a\x221\x03\x0a\x22\x0d\x03\x0a?%\x03\x0a<,\x03\x0a?#\x03\x0a>\x19" + - "\x03\x0a\x08&\x03\x0a\x0b\x0e\x03\x0a\x0c:\x03\x0a\x0c+\x03\x0a\x03\x22" + - "\x03\x0a\x06)\x03\x0a\x11\x10\x03\x0a\x11\x1a\x03\x0a\x17-\x03\x0a\x14(" + - "\x03\x09)\x1e\x03\x09/\x09\x03\x09.\x00\x03\x09,\x07\x03\x09/*\x03\x09-9" + - "\x03\x09\x228\x03\x09%\x09\x03\x09:\x12\x03\x09;\x1d\x03\x09?\x06\x03" + - "\x093%\x03\x096\x05\x03\x096\x08\x03\x097\x02\x03\x09\x07,\x03\x09\x04," + - "\x03\x09\x1f\x16\x03\x09\x11\x03\x03\x09\x11\x12\x03\x09\x168\x03\x08*" + - "\x05\x03\x08/2\x03\x084:\x03\x08\x22+\x03\x08 0\x03\x08&\x0a\x03\x08;" + - "\x10\x03\x08>$\x03\x08>\x18\x03\x0829\x03\x082:\x03\x081,\x03\x081<\x03" + - "\x081\x1c\x03\x087#\x03\x087*\x03\x08\x09'\x03\x08\x00\x1d\x03\x08\x05-" + - "\x03\x08\x1f4\x03\x08\x1d\x04\x03\x08\x16\x0f\x03\x07*7\x03\x07'!\x03" + - "\x07%\x1b\x03\x077\x0c\x03\x07\x0c1\x03\x07\x0c.\x03\x07\x00\x06\x03\x07" + - "\x01\x02\x03\x07\x010\x03\x07\x06=\x03\x07\x01\x03\x03\x07\x01\x13\x03" + - "\x07\x06\x06\x03\x07\x05\x0a\x03\x07\x1f\x09\x03\x07\x17:\x03\x06*1\x03" + - "\x06-\x1d\x03\x06\x223\x03\x062:\x03\x060$\x03\x066\x1e\x03\x064\x12\x03" + - "\x0645\x03\x06\x0b\x00\x03\x06\x0b7\x03\x06\x07\x1f\x03\x06\x15\x12\x03" + - "\x0c\x05\x0f\x03\x0b+\x0b\x03\x0b+-\x03\x06\x16\x1b\x03\x06\x15\x17\x03" + - "\x89\xca\xea\x03\x89\xca\xe8\x03\x0c8\x10\x03\x0c8\x01\x03\x0c8\x0f\x03" + - "\x0d8%\x03\x0d8!\x03\x0c8-\x03\x0c8/\x03\x0c8+\x03\x0c87\x03\x0c85\x03" + - "\x0c9\x09\x03\x0c9\x0d\x03\x0c9\x0f\x03\x0c9\x0b\x03\xcfu\x0c\x03\xcfu" + - "\x0f\x03\xcfu\x0e\x03\xcfu\x09\x03\x0c9\x10\x03\x0d9\x0c\x03\xcf`;\x03" + - "\xcf`>\x03\xcf`9\x03\xcf`8\x03\xcf`7\x03\xcf`*\x03\xcf`-\x03\xcf`,\x03" + - "\x0d\x1b\x1a\x03\x0d\x1b&\x03\x0c=.\x03\x0c=%\x03\x0c>\x1e\x03\x0c>\x14" + - "\x03\x0c?\x06\x03\x0c?\x0b\x03\x0c?\x0c\x03\x0c?\x0d\x03\x0c?\x02\x03" + - "\x0c>\x0f\x03\x0c>\x08\x03\x0c>\x09\x03\x0c>,\x03\x0c>\x0c\x03\x0c?\x13" + - "\x03\x0c?\x16\x03\x0c?\x15\x03\x0c?\x1c\x03\x0c?\x1f\x03\x0c?\x1d\x03" + - "\x0c?\x1a\x03\x0c?\x17\x03\x0c?\x08\x03\x0c?\x09\x03\x0c?\x0e\x03\x0c?" + - "\x04\x03\x0c?\x05\x03\x0c<?\x03\x0c=\x00\x03\x0c=\x06\x03\x0c=\x05\x03" + - "\x0c=\x0c\x03\x0c=\x0f\x03\x0c=\x0d\x03\x0c=\x0b\x03\x0c=\x07\x03\x0c=" + - "\x19\x03\x0c=\x15\x03\x0c=\x11\x03\x0c=1\x03\x0c=3\x03\x0c=0\x03\x0c=>" + - "\x03\x0c=2\x03\x0c=6\x03\x0c<\x07\x03\x0c<\x05\x03\x0e:!\x03\x0e:#\x03" + - "\x0e8\x09\x03\x0e:&\x03\x0e8\x0b\x03\x0e:$\x03\x0e:,\x03\x0e8\x1a\x03" + - "\x0e8\x1e\x03\x0e:*\x03\x0e:7\x03\x0e:5\x03\x0e:;\x03\x0e:\x15\x03\x0e:<" + - "\x03\x0e:4\x03\x0e:'\x03\x0e:-\x03\x0e:%\x03\x0e:?\x03\x0e:=\x03\x0e:)" + - "\x03\x0e:/\x03\xcfs'\x03\x0d=\x0f\x03\x0d+*\x03\x0d99\x03\x0d9;\x03\x0d9" + - "?\x03\x0d)\x0d\x03\x0d(%\x02\x01\x18\x02\x01(\x02\x01\x1e\x03\x0f$!\x03" + - "\x0f87\x03\x0f4\x0e\x03\x0f5\x1d\x03\x06'\x03\x03\x0f\x08\x18\x03\x0f" + - "\x0d\x1b\x03\x0e2=\x03\x0e;\x08\x03\x0e:\x0b\x03\x0e\x06$\x03\x0e\x0d)" + - "\x03\x0e\x16\x1f\x03\x0e\x16\x1b\x03\x0d$\x0a\x03\x05,\x1d\x03\x0d. \x03" + - "\x0d.#\x03\x0c(/\x03\x09%\x02\x03\x0d90\x03\x0d\x0e4\x03\x0d\x0d\x0f\x03" + - "\x0c#\x00\x03\x0c,\x1e\x03\x0c2\x0e\x03\x0c\x01\x17\x03\x0c\x09:\x03\x0e" + - "\x173\x03\x0c\x08\x03\x03\x0c\x11\x07\x03\x0c\x10\x18\x03\x0c\x1f\x1c" + - "\x03\x0c\x19\x0e\x03\x0c\x1a\x1f\x03\x0f0>\x03\x0b->\x03\x0b<+\x03\x0b8" + - "\x13\x03\x0b\x043\x03\x0b\x14\x03\x03\x0b\x16%\x03\x0d\x22&\x03\x0b\x1a" + - "\x1a\x03\x0b\x1a\x04\x03\x0a%9\x03\x0a&2\x03\x0a&0\x03\x0a!\x1a\x03\x0a!" + - "7\x03\x0a5\x10\x03\x0a=4\x03\x0a?\x0e\x03\x0a>\x10\x03\x0a\x00 \x03\x0a" + - "\x0f:\x03\x0a\x0f9\x03\x0a\x0b\x0a\x03\x0a\x17%\x03\x0a\x1b-\x03\x09-" + - "\x1a\x03\x09,4\x03\x09.,\x03\x09)\x09\x03\x096!\x03\x091\x1f\x03\x093" + - "\x16\x03\x0c+\x1f\x03\x098 \x03\x098=\x03\x0c(\x1a\x03\x0c(\x16\x03\x09" + - "\x0a+\x03\x09\x16\x12\x03\x09\x13\x0e\x03\x09\x153\x03\x08)!\x03\x09\x1a" + - "\x01\x03\x09\x18\x01\x03\x08%#\x03\x08>\x22\x03\x08\x05%\x03\x08\x02*" + - "\x03\x08\x15;\x03\x08\x1b7\x03\x0f\x07\x1d\x03\x0f\x04\x03\x03\x070\x0c" + - "\x03\x07;\x0b\x03\x07\x08\x17\x03\x07\x12\x06\x03\x06/-\x03\x0671\x03" + - "\x065+\x03\x06>7\x03\x06\x049\x03\x05+\x1e\x03\x05,\x17\x03\x05 \x1d\x03" + - "\x05\x22\x05\x03\x050\x1d" - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookup(s []byte) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupUnsafe(s []byte) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookupString(s string) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupStringUnsafe(s string) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// idnaTrie. Total size: 29708 bytes (29.01 KiB). Checksum: c3ecc76d8fffa6e6. -type idnaTrie struct{} - -func newIdnaTrie(i int) *idnaTrie { - return &idnaTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *idnaTrie) lookupValue(n uint32, b byte) uint16 { - switch { - case n < 125: - return uint16(idnaValues[n<<6+uint32(b)]) - default: - n -= 125 - return uint16(idnaSparse.lookup(n, b)) - } -} - -// idnaValues: 127 blocks, 8128 entries, 16256 bytes -// The third block is the zero block. -var idnaValues = [8128]uint16{ - // Block 0x0, offset 0x0 - 0x00: 0x0080, 0x01: 0x0080, 0x02: 0x0080, 0x03: 0x0080, 0x04: 0x0080, 0x05: 0x0080, - 0x06: 0x0080, 0x07: 0x0080, 0x08: 0x0080, 0x09: 0x0080, 0x0a: 0x0080, 0x0b: 0x0080, - 0x0c: 0x0080, 0x0d: 0x0080, 0x0e: 0x0080, 0x0f: 0x0080, 0x10: 0x0080, 0x11: 0x0080, - 0x12: 0x0080, 0x13: 0x0080, 0x14: 0x0080, 0x15: 0x0080, 0x16: 0x0080, 0x17: 0x0080, - 0x18: 0x0080, 0x19: 0x0080, 0x1a: 0x0080, 0x1b: 0x0080, 0x1c: 0x0080, 0x1d: 0x0080, - 0x1e: 0x0080, 0x1f: 0x0080, 0x20: 0x0080, 0x21: 0x0080, 0x22: 0x0080, 0x23: 0x0080, - 0x24: 0x0080, 0x25: 0x0080, 0x26: 0x0080, 0x27: 0x0080, 0x28: 0x0080, 0x29: 0x0080, - 0x2a: 0x0080, 0x2b: 0x0080, 0x2c: 0x0080, 0x2d: 0x0008, 0x2e: 0x0008, 0x2f: 0x0080, - 0x30: 0x0008, 0x31: 0x0008, 0x32: 0x0008, 0x33: 0x0008, 0x34: 0x0008, 0x35: 0x0008, - 0x36: 0x0008, 0x37: 0x0008, 0x38: 0x0008, 0x39: 0x0008, 0x3a: 0x0080, 0x3b: 0x0080, - 0x3c: 0x0080, 0x3d: 0x0080, 0x3e: 0x0080, 0x3f: 0x0080, - // Block 0x1, offset 0x40 - 0x40: 0x0080, 0x41: 0xe105, 0x42: 0xe105, 0x43: 0xe105, 0x44: 0xe105, 0x45: 0xe105, - 0x46: 0xe105, 0x47: 0xe105, 0x48: 0xe105, 0x49: 0xe105, 0x4a: 0xe105, 0x4b: 0xe105, - 0x4c: 0xe105, 0x4d: 0xe105, 0x4e: 0xe105, 0x4f: 0xe105, 0x50: 0xe105, 0x51: 0xe105, - 0x52: 0xe105, 0x53: 0xe105, 0x54: 0xe105, 0x55: 0xe105, 0x56: 0xe105, 0x57: 0xe105, - 0x58: 0xe105, 0x59: 0xe105, 0x5a: 0xe105, 0x5b: 0x0080, 0x5c: 0x0080, 0x5d: 0x0080, - 0x5e: 0x0080, 0x5f: 0x0080, 0x60: 0x0080, 0x61: 0x0008, 0x62: 0x0008, 0x63: 0x0008, - 0x64: 0x0008, 0x65: 0x0008, 0x66: 0x0008, 0x67: 0x0008, 0x68: 0x0008, 0x69: 0x0008, - 0x6a: 0x0008, 0x6b: 0x0008, 0x6c: 0x0008, 0x6d: 0x0008, 0x6e: 0x0008, 0x6f: 0x0008, - 0x70: 0x0008, 0x71: 0x0008, 0x72: 0x0008, 0x73: 0x0008, 0x74: 0x0008, 0x75: 0x0008, - 0x76: 0x0008, 0x77: 0x0008, 0x78: 0x0008, 0x79: 0x0008, 0x7a: 0x0008, 0x7b: 0x0080, - 0x7c: 0x0080, 0x7d: 0x0080, 0x7e: 0x0080, 0x7f: 0x0080, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x0040, 0xc1: 0x0040, 0xc2: 0x0040, 0xc3: 0x0040, 0xc4: 0x0040, 0xc5: 0x0040, - 0xc6: 0x0040, 0xc7: 0x0040, 0xc8: 0x0040, 0xc9: 0x0040, 0xca: 0x0040, 0xcb: 0x0040, - 0xcc: 0x0040, 0xcd: 0x0040, 0xce: 0x0040, 0xcf: 0x0040, 0xd0: 0x0040, 0xd1: 0x0040, - 0xd2: 0x0040, 0xd3: 0x0040, 0xd4: 0x0040, 0xd5: 0x0040, 0xd6: 0x0040, 0xd7: 0x0040, - 0xd8: 0x0040, 0xd9: 0x0040, 0xda: 0x0040, 0xdb: 0x0040, 0xdc: 0x0040, 0xdd: 0x0040, - 0xde: 0x0040, 0xdf: 0x0040, 0xe0: 0x000a, 0xe1: 0x0018, 0xe2: 0x0018, 0xe3: 0x0018, - 0xe4: 0x0018, 0xe5: 0x0018, 0xe6: 0x0018, 0xe7: 0x0018, 0xe8: 0x001a, 0xe9: 0x0018, - 0xea: 0x0039, 0xeb: 0x0018, 0xec: 0x0018, 0xed: 0x03c0, 0xee: 0x0018, 0xef: 0x004a, - 0xf0: 0x0018, 0xf1: 0x0018, 0xf2: 0x0069, 0xf3: 0x0079, 0xf4: 0x008a, 0xf5: 0x0005, - 0xf6: 0x0018, 0xf7: 0x0008, 0xf8: 0x00aa, 0xf9: 0x00c9, 0xfa: 0x00d9, 0xfb: 0x0018, - 0xfc: 0x00e9, 0xfd: 0x0119, 0xfe: 0x0149, 0xff: 0x0018, - // Block 0x4, offset 0x100 - 0x100: 0xe00d, 0x101: 0x0008, 0x102: 0xe00d, 0x103: 0x0008, 0x104: 0xe00d, 0x105: 0x0008, - 0x106: 0xe00d, 0x107: 0x0008, 0x108: 0xe00d, 0x109: 0x0008, 0x10a: 0xe00d, 0x10b: 0x0008, - 0x10c: 0xe00d, 0x10d: 0x0008, 0x10e: 0xe00d, 0x10f: 0x0008, 0x110: 0xe00d, 0x111: 0x0008, - 0x112: 0xe00d, 0x113: 0x0008, 0x114: 0xe00d, 0x115: 0x0008, 0x116: 0xe00d, 0x117: 0x0008, - 0x118: 0xe00d, 0x119: 0x0008, 0x11a: 0xe00d, 0x11b: 0x0008, 0x11c: 0xe00d, 0x11d: 0x0008, - 0x11e: 0xe00d, 0x11f: 0x0008, 0x120: 0xe00d, 0x121: 0x0008, 0x122: 0xe00d, 0x123: 0x0008, - 0x124: 0xe00d, 0x125: 0x0008, 0x126: 0xe00d, 0x127: 0x0008, 0x128: 0xe00d, 0x129: 0x0008, - 0x12a: 0xe00d, 0x12b: 0x0008, 0x12c: 0xe00d, 0x12d: 0x0008, 0x12e: 0xe00d, 0x12f: 0x0008, - 0x130: 0x0179, 0x131: 0x0008, 0x132: 0x0035, 0x133: 0x004d, 0x134: 0xe00d, 0x135: 0x0008, - 0x136: 0xe00d, 0x137: 0x0008, 0x138: 0x0008, 0x139: 0xe01d, 0x13a: 0x0008, 0x13b: 0xe03d, - 0x13c: 0x0008, 0x13d: 0xe01d, 0x13e: 0x0008, 0x13f: 0x0199, - // Block 0x5, offset 0x140 - 0x140: 0x0199, 0x141: 0xe01d, 0x142: 0x0008, 0x143: 0xe03d, 0x144: 0x0008, 0x145: 0xe01d, - 0x146: 0x0008, 0x147: 0xe07d, 0x148: 0x0008, 0x149: 0x01b9, 0x14a: 0xe00d, 0x14b: 0x0008, - 0x14c: 0xe00d, 0x14d: 0x0008, 0x14e: 0xe00d, 0x14f: 0x0008, 0x150: 0xe00d, 0x151: 0x0008, - 0x152: 0xe00d, 0x153: 0x0008, 0x154: 0xe00d, 0x155: 0x0008, 0x156: 0xe00d, 0x157: 0x0008, - 0x158: 0xe00d, 0x159: 0x0008, 0x15a: 0xe00d, 0x15b: 0x0008, 0x15c: 0xe00d, 0x15d: 0x0008, - 0x15e: 0xe00d, 0x15f: 0x0008, 0x160: 0xe00d, 0x161: 0x0008, 0x162: 0xe00d, 0x163: 0x0008, - 0x164: 0xe00d, 0x165: 0x0008, 0x166: 0xe00d, 0x167: 0x0008, 0x168: 0xe00d, 0x169: 0x0008, - 0x16a: 0xe00d, 0x16b: 0x0008, 0x16c: 0xe00d, 0x16d: 0x0008, 0x16e: 0xe00d, 0x16f: 0x0008, - 0x170: 0xe00d, 0x171: 0x0008, 0x172: 0xe00d, 0x173: 0x0008, 0x174: 0xe00d, 0x175: 0x0008, - 0x176: 0xe00d, 0x177: 0x0008, 0x178: 0x0065, 0x179: 0xe01d, 0x17a: 0x0008, 0x17b: 0xe03d, - 0x17c: 0x0008, 0x17d: 0xe01d, 0x17e: 0x0008, 0x17f: 0x01d9, - // Block 0x6, offset 0x180 - 0x180: 0x0008, 0x181: 0x007d, 0x182: 0xe00d, 0x183: 0x0008, 0x184: 0xe00d, 0x185: 0x0008, - 0x186: 0x007d, 0x187: 0xe07d, 0x188: 0x0008, 0x189: 0x0095, 0x18a: 0x00ad, 0x18b: 0xe03d, - 0x18c: 0x0008, 0x18d: 0x0008, 0x18e: 0x00c5, 0x18f: 0x00dd, 0x190: 0x00f5, 0x191: 0xe01d, - 0x192: 0x0008, 0x193: 0x010d, 0x194: 0x0125, 0x195: 0x0008, 0x196: 0x013d, 0x197: 0x013d, - 0x198: 0xe00d, 0x199: 0x0008, 0x19a: 0x0008, 0x19b: 0x0008, 0x19c: 0x010d, 0x19d: 0x0155, - 0x19e: 0x0008, 0x19f: 0x016d, 0x1a0: 0xe00d, 0x1a1: 0x0008, 0x1a2: 0xe00d, 0x1a3: 0x0008, - 0x1a4: 0xe00d, 0x1a5: 0x0008, 0x1a6: 0x0185, 0x1a7: 0xe07d, 0x1a8: 0x0008, 0x1a9: 0x019d, - 0x1aa: 0x0008, 0x1ab: 0x0008, 0x1ac: 0xe00d, 0x1ad: 0x0008, 0x1ae: 0x0185, 0x1af: 0xe0fd, - 0x1b0: 0x0008, 0x1b1: 0x01b5, 0x1b2: 0x01cd, 0x1b3: 0xe03d, 0x1b4: 0x0008, 0x1b5: 0xe01d, - 0x1b6: 0x0008, 0x1b7: 0x01e5, 0x1b8: 0xe00d, 0x1b9: 0x0008, 0x1ba: 0x0008, 0x1bb: 0x0008, - 0x1bc: 0xe00d, 0x1bd: 0x0008, 0x1be: 0x0008, 0x1bf: 0x0008, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x0008, 0x1c1: 0x0008, 0x1c2: 0x0008, 0x1c3: 0x0008, 0x1c4: 0x01e9, 0x1c5: 0x01e9, - 0x1c6: 0x01e9, 0x1c7: 0x01fd, 0x1c8: 0x0215, 0x1c9: 0x022d, 0x1ca: 0x0245, 0x1cb: 0x025d, - 0x1cc: 0x0275, 0x1cd: 0xe01d, 0x1ce: 0x0008, 0x1cf: 0xe0fd, 0x1d0: 0x0008, 0x1d1: 0xe01d, - 0x1d2: 0x0008, 0x1d3: 0xe03d, 0x1d4: 0x0008, 0x1d5: 0xe01d, 0x1d6: 0x0008, 0x1d7: 0xe07d, - 0x1d8: 0x0008, 0x1d9: 0xe01d, 0x1da: 0x0008, 0x1db: 0xe03d, 0x1dc: 0x0008, 0x1dd: 0x0008, - 0x1de: 0xe00d, 0x1df: 0x0008, 0x1e0: 0xe00d, 0x1e1: 0x0008, 0x1e2: 0xe00d, 0x1e3: 0x0008, - 0x1e4: 0xe00d, 0x1e5: 0x0008, 0x1e6: 0xe00d, 0x1e7: 0x0008, 0x1e8: 0xe00d, 0x1e9: 0x0008, - 0x1ea: 0xe00d, 0x1eb: 0x0008, 0x1ec: 0xe00d, 0x1ed: 0x0008, 0x1ee: 0xe00d, 0x1ef: 0x0008, - 0x1f0: 0x0008, 0x1f1: 0x028d, 0x1f2: 0x02a5, 0x1f3: 0x02bd, 0x1f4: 0xe00d, 0x1f5: 0x0008, - 0x1f6: 0x02d5, 0x1f7: 0x02ed, 0x1f8: 0xe00d, 0x1f9: 0x0008, 0x1fa: 0xe00d, 0x1fb: 0x0008, - 0x1fc: 0xe00d, 0x1fd: 0x0008, 0x1fe: 0xe00d, 0x1ff: 0x0008, - // Block 0x8, offset 0x200 - 0x200: 0xe00d, 0x201: 0x0008, 0x202: 0xe00d, 0x203: 0x0008, 0x204: 0xe00d, 0x205: 0x0008, - 0x206: 0xe00d, 0x207: 0x0008, 0x208: 0xe00d, 0x209: 0x0008, 0x20a: 0xe00d, 0x20b: 0x0008, - 0x20c: 0xe00d, 0x20d: 0x0008, 0x20e: 0xe00d, 0x20f: 0x0008, 0x210: 0xe00d, 0x211: 0x0008, - 0x212: 0xe00d, 0x213: 0x0008, 0x214: 0xe00d, 0x215: 0x0008, 0x216: 0xe00d, 0x217: 0x0008, - 0x218: 0xe00d, 0x219: 0x0008, 0x21a: 0xe00d, 0x21b: 0x0008, 0x21c: 0xe00d, 0x21d: 0x0008, - 0x21e: 0xe00d, 0x21f: 0x0008, 0x220: 0x0305, 0x221: 0x0008, 0x222: 0xe00d, 0x223: 0x0008, - 0x224: 0xe00d, 0x225: 0x0008, 0x226: 0xe00d, 0x227: 0x0008, 0x228: 0xe00d, 0x229: 0x0008, - 0x22a: 0xe00d, 0x22b: 0x0008, 0x22c: 0xe00d, 0x22d: 0x0008, 0x22e: 0xe00d, 0x22f: 0x0008, - 0x230: 0xe00d, 0x231: 0x0008, 0x232: 0xe00d, 0x233: 0x0008, 0x234: 0x0008, 0x235: 0x0008, - 0x236: 0x0008, 0x237: 0x0008, 0x238: 0x0008, 0x239: 0x0008, 0x23a: 0x0209, 0x23b: 0xe03d, - 0x23c: 0x0008, 0x23d: 0x031d, 0x23e: 0x0229, 0x23f: 0x0008, - // Block 0x9, offset 0x240 - 0x240: 0x0008, 0x241: 0x0008, 0x242: 0x0018, 0x243: 0x0018, 0x244: 0x0018, 0x245: 0x0018, - 0x246: 0x0008, 0x247: 0x0008, 0x248: 0x0008, 0x249: 0x0008, 0x24a: 0x0008, 0x24b: 0x0008, - 0x24c: 0x0008, 0x24d: 0x0008, 0x24e: 0x0008, 0x24f: 0x0008, 0x250: 0x0008, 0x251: 0x0008, - 0x252: 0x0018, 0x253: 0x0018, 0x254: 0x0018, 0x255: 0x0018, 0x256: 0x0018, 0x257: 0x0018, - 0x258: 0x029a, 0x259: 0x02ba, 0x25a: 0x02da, 0x25b: 0x02fa, 0x25c: 0x031a, 0x25d: 0x033a, - 0x25e: 0x0018, 0x25f: 0x0018, 0x260: 0x03ad, 0x261: 0x0359, 0x262: 0x01d9, 0x263: 0x0369, - 0x264: 0x03c5, 0x265: 0x0018, 0x266: 0x0018, 0x267: 0x0018, 0x268: 0x0018, 0x269: 0x0018, - 0x26a: 0x0018, 0x26b: 0x0018, 0x26c: 0x0008, 0x26d: 0x0018, 0x26e: 0x0008, 0x26f: 0x0018, - 0x270: 0x0018, 0x271: 0x0018, 0x272: 0x0018, 0x273: 0x0018, 0x274: 0x0018, 0x275: 0x0018, - 0x276: 0x0018, 0x277: 0x0018, 0x278: 0x0018, 0x279: 0x0018, 0x27a: 0x0018, 0x27b: 0x0018, - 0x27c: 0x0018, 0x27d: 0x0018, 0x27e: 0x0018, 0x27f: 0x0018, - // Block 0xa, offset 0x280 - 0x280: 0x03dd, 0x281: 0x03dd, 0x282: 0x3308, 0x283: 0x03f5, 0x284: 0x0379, 0x285: 0x040d, - 0x286: 0x3308, 0x287: 0x3308, 0x288: 0x3308, 0x289: 0x3308, 0x28a: 0x3308, 0x28b: 0x3308, - 0x28c: 0x3308, 0x28d: 0x3308, 0x28e: 0x3308, 0x28f: 0x33c0, 0x290: 0x3308, 0x291: 0x3308, - 0x292: 0x3308, 0x293: 0x3308, 0x294: 0x3308, 0x295: 0x3308, 0x296: 0x3308, 0x297: 0x3308, - 0x298: 0x3308, 0x299: 0x3308, 0x29a: 0x3308, 0x29b: 0x3308, 0x29c: 0x3308, 0x29d: 0x3308, - 0x29e: 0x3308, 0x29f: 0x3308, 0x2a0: 0x3308, 0x2a1: 0x3308, 0x2a2: 0x3308, 0x2a3: 0x3308, - 0x2a4: 0x3308, 0x2a5: 0x3308, 0x2a6: 0x3308, 0x2a7: 0x3308, 0x2a8: 0x3308, 0x2a9: 0x3308, - 0x2aa: 0x3308, 0x2ab: 0x3308, 0x2ac: 0x3308, 0x2ad: 0x3308, 0x2ae: 0x3308, 0x2af: 0x3308, - 0x2b0: 0xe00d, 0x2b1: 0x0008, 0x2b2: 0xe00d, 0x2b3: 0x0008, 0x2b4: 0x0425, 0x2b5: 0x0008, - 0x2b6: 0xe00d, 0x2b7: 0x0008, 0x2b8: 0x0040, 0x2b9: 0x0040, 0x2ba: 0x03a2, 0x2bb: 0x0008, - 0x2bc: 0x0008, 0x2bd: 0x0008, 0x2be: 0x03c2, 0x2bf: 0x043d, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x0040, 0x2c1: 0x0040, 0x2c2: 0x0040, 0x2c3: 0x0040, 0x2c4: 0x008a, 0x2c5: 0x03d2, - 0x2c6: 0xe155, 0x2c7: 0x0455, 0x2c8: 0xe12d, 0x2c9: 0xe13d, 0x2ca: 0xe12d, 0x2cb: 0x0040, - 0x2cc: 0x03dd, 0x2cd: 0x0040, 0x2ce: 0x046d, 0x2cf: 0x0485, 0x2d0: 0x0008, 0x2d1: 0xe105, - 0x2d2: 0xe105, 0x2d3: 0xe105, 0x2d4: 0xe105, 0x2d5: 0xe105, 0x2d6: 0xe105, 0x2d7: 0xe105, - 0x2d8: 0xe105, 0x2d9: 0xe105, 0x2da: 0xe105, 0x2db: 0xe105, 0x2dc: 0xe105, 0x2dd: 0xe105, - 0x2de: 0xe105, 0x2df: 0xe105, 0x2e0: 0x049d, 0x2e1: 0x049d, 0x2e2: 0x0040, 0x2e3: 0x049d, - 0x2e4: 0x049d, 0x2e5: 0x049d, 0x2e6: 0x049d, 0x2e7: 0x049d, 0x2e8: 0x049d, 0x2e9: 0x049d, - 0x2ea: 0x049d, 0x2eb: 0x049d, 0x2ec: 0x0008, 0x2ed: 0x0008, 0x2ee: 0x0008, 0x2ef: 0x0008, - 0x2f0: 0x0008, 0x2f1: 0x0008, 0x2f2: 0x0008, 0x2f3: 0x0008, 0x2f4: 0x0008, 0x2f5: 0x0008, - 0x2f6: 0x0008, 0x2f7: 0x0008, 0x2f8: 0x0008, 0x2f9: 0x0008, 0x2fa: 0x0008, 0x2fb: 0x0008, - 0x2fc: 0x0008, 0x2fd: 0x0008, 0x2fe: 0x0008, 0x2ff: 0x0008, - // Block 0xc, offset 0x300 - 0x300: 0x0008, 0x301: 0x0008, 0x302: 0xe00f, 0x303: 0x0008, 0x304: 0x0008, 0x305: 0x0008, - 0x306: 0x0008, 0x307: 0x0008, 0x308: 0x0008, 0x309: 0x0008, 0x30a: 0x0008, 0x30b: 0x0008, - 0x30c: 0x0008, 0x30d: 0x0008, 0x30e: 0x0008, 0x30f: 0xe0c5, 0x310: 0x04b5, 0x311: 0x04cd, - 0x312: 0xe0bd, 0x313: 0xe0f5, 0x314: 0xe0fd, 0x315: 0xe09d, 0x316: 0xe0b5, 0x317: 0x0008, - 0x318: 0xe00d, 0x319: 0x0008, 0x31a: 0xe00d, 0x31b: 0x0008, 0x31c: 0xe00d, 0x31d: 0x0008, - 0x31e: 0xe00d, 0x31f: 0x0008, 0x320: 0xe00d, 0x321: 0x0008, 0x322: 0xe00d, 0x323: 0x0008, - 0x324: 0xe00d, 0x325: 0x0008, 0x326: 0xe00d, 0x327: 0x0008, 0x328: 0xe00d, 0x329: 0x0008, - 0x32a: 0xe00d, 0x32b: 0x0008, 0x32c: 0xe00d, 0x32d: 0x0008, 0x32e: 0xe00d, 0x32f: 0x0008, - 0x330: 0x04e5, 0x331: 0xe185, 0x332: 0xe18d, 0x333: 0x0008, 0x334: 0x04fd, 0x335: 0x03dd, - 0x336: 0x0018, 0x337: 0xe07d, 0x338: 0x0008, 0x339: 0xe1d5, 0x33a: 0xe00d, 0x33b: 0x0008, - 0x33c: 0x0008, 0x33d: 0x0515, 0x33e: 0x052d, 0x33f: 0x052d, - // Block 0xd, offset 0x340 - 0x340: 0x0008, 0x341: 0x0008, 0x342: 0x0008, 0x343: 0x0008, 0x344: 0x0008, 0x345: 0x0008, - 0x346: 0x0008, 0x347: 0x0008, 0x348: 0x0008, 0x349: 0x0008, 0x34a: 0x0008, 0x34b: 0x0008, - 0x34c: 0x0008, 0x34d: 0x0008, 0x34e: 0x0008, 0x34f: 0x0008, 0x350: 0x0008, 0x351: 0x0008, - 0x352: 0x0008, 0x353: 0x0008, 0x354: 0x0008, 0x355: 0x0008, 0x356: 0x0008, 0x357: 0x0008, - 0x358: 0x0008, 0x359: 0x0008, 0x35a: 0x0008, 0x35b: 0x0008, 0x35c: 0x0008, 0x35d: 0x0008, - 0x35e: 0x0008, 0x35f: 0x0008, 0x360: 0xe00d, 0x361: 0x0008, 0x362: 0xe00d, 0x363: 0x0008, - 0x364: 0xe00d, 0x365: 0x0008, 0x366: 0xe00d, 0x367: 0x0008, 0x368: 0xe00d, 0x369: 0x0008, - 0x36a: 0xe00d, 0x36b: 0x0008, 0x36c: 0xe00d, 0x36d: 0x0008, 0x36e: 0xe00d, 0x36f: 0x0008, - 0x370: 0xe00d, 0x371: 0x0008, 0x372: 0xe00d, 0x373: 0x0008, 0x374: 0xe00d, 0x375: 0x0008, - 0x376: 0xe00d, 0x377: 0x0008, 0x378: 0xe00d, 0x379: 0x0008, 0x37a: 0xe00d, 0x37b: 0x0008, - 0x37c: 0xe00d, 0x37d: 0x0008, 0x37e: 0xe00d, 0x37f: 0x0008, - // Block 0xe, offset 0x380 - 0x380: 0xe00d, 0x381: 0x0008, 0x382: 0x0018, 0x383: 0x3308, 0x384: 0x3308, 0x385: 0x3308, - 0x386: 0x3308, 0x387: 0x3308, 0x388: 0x3318, 0x389: 0x3318, 0x38a: 0xe00d, 0x38b: 0x0008, - 0x38c: 0xe00d, 0x38d: 0x0008, 0x38e: 0xe00d, 0x38f: 0x0008, 0x390: 0xe00d, 0x391: 0x0008, - 0x392: 0xe00d, 0x393: 0x0008, 0x394: 0xe00d, 0x395: 0x0008, 0x396: 0xe00d, 0x397: 0x0008, - 0x398: 0xe00d, 0x399: 0x0008, 0x39a: 0xe00d, 0x39b: 0x0008, 0x39c: 0xe00d, 0x39d: 0x0008, - 0x39e: 0xe00d, 0x39f: 0x0008, 0x3a0: 0xe00d, 0x3a1: 0x0008, 0x3a2: 0xe00d, 0x3a3: 0x0008, - 0x3a4: 0xe00d, 0x3a5: 0x0008, 0x3a6: 0xe00d, 0x3a7: 0x0008, 0x3a8: 0xe00d, 0x3a9: 0x0008, - 0x3aa: 0xe00d, 0x3ab: 0x0008, 0x3ac: 0xe00d, 0x3ad: 0x0008, 0x3ae: 0xe00d, 0x3af: 0x0008, - 0x3b0: 0xe00d, 0x3b1: 0x0008, 0x3b2: 0xe00d, 0x3b3: 0x0008, 0x3b4: 0xe00d, 0x3b5: 0x0008, - 0x3b6: 0xe00d, 0x3b7: 0x0008, 0x3b8: 0xe00d, 0x3b9: 0x0008, 0x3ba: 0xe00d, 0x3bb: 0x0008, - 0x3bc: 0xe00d, 0x3bd: 0x0008, 0x3be: 0xe00d, 0x3bf: 0x0008, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x0040, 0x3c1: 0xe01d, 0x3c2: 0x0008, 0x3c3: 0xe03d, 0x3c4: 0x0008, 0x3c5: 0xe01d, - 0x3c6: 0x0008, 0x3c7: 0xe07d, 0x3c8: 0x0008, 0x3c9: 0xe01d, 0x3ca: 0x0008, 0x3cb: 0xe03d, - 0x3cc: 0x0008, 0x3cd: 0xe01d, 0x3ce: 0x0008, 0x3cf: 0x0008, 0x3d0: 0xe00d, 0x3d1: 0x0008, - 0x3d2: 0xe00d, 0x3d3: 0x0008, 0x3d4: 0xe00d, 0x3d5: 0x0008, 0x3d6: 0xe00d, 0x3d7: 0x0008, - 0x3d8: 0xe00d, 0x3d9: 0x0008, 0x3da: 0xe00d, 0x3db: 0x0008, 0x3dc: 0xe00d, 0x3dd: 0x0008, - 0x3de: 0xe00d, 0x3df: 0x0008, 0x3e0: 0xe00d, 0x3e1: 0x0008, 0x3e2: 0xe00d, 0x3e3: 0x0008, - 0x3e4: 0xe00d, 0x3e5: 0x0008, 0x3e6: 0xe00d, 0x3e7: 0x0008, 0x3e8: 0xe00d, 0x3e9: 0x0008, - 0x3ea: 0xe00d, 0x3eb: 0x0008, 0x3ec: 0xe00d, 0x3ed: 0x0008, 0x3ee: 0xe00d, 0x3ef: 0x0008, - 0x3f0: 0xe00d, 0x3f1: 0x0008, 0x3f2: 0xe00d, 0x3f3: 0x0008, 0x3f4: 0xe00d, 0x3f5: 0x0008, - 0x3f6: 0xe00d, 0x3f7: 0x0008, 0x3f8: 0xe00d, 0x3f9: 0x0008, 0x3fa: 0xe00d, 0x3fb: 0x0008, - 0x3fc: 0xe00d, 0x3fd: 0x0008, 0x3fe: 0xe00d, 0x3ff: 0x0008, - // Block 0x10, offset 0x400 - 0x400: 0xe00d, 0x401: 0x0008, 0x402: 0xe00d, 0x403: 0x0008, 0x404: 0xe00d, 0x405: 0x0008, - 0x406: 0xe00d, 0x407: 0x0008, 0x408: 0xe00d, 0x409: 0x0008, 0x40a: 0xe00d, 0x40b: 0x0008, - 0x40c: 0xe00d, 0x40d: 0x0008, 0x40e: 0xe00d, 0x40f: 0x0008, 0x410: 0xe00d, 0x411: 0x0008, - 0x412: 0xe00d, 0x413: 0x0008, 0x414: 0xe00d, 0x415: 0x0008, 0x416: 0xe00d, 0x417: 0x0008, - 0x418: 0xe00d, 0x419: 0x0008, 0x41a: 0xe00d, 0x41b: 0x0008, 0x41c: 0xe00d, 0x41d: 0x0008, - 0x41e: 0xe00d, 0x41f: 0x0008, 0x420: 0xe00d, 0x421: 0x0008, 0x422: 0xe00d, 0x423: 0x0008, - 0x424: 0xe00d, 0x425: 0x0008, 0x426: 0xe00d, 0x427: 0x0008, 0x428: 0xe00d, 0x429: 0x0008, - 0x42a: 0xe00d, 0x42b: 0x0008, 0x42c: 0xe00d, 0x42d: 0x0008, 0x42e: 0xe00d, 0x42f: 0x0008, - 0x430: 0x0040, 0x431: 0x03f5, 0x432: 0x03f5, 0x433: 0x03f5, 0x434: 0x03f5, 0x435: 0x03f5, - 0x436: 0x03f5, 0x437: 0x03f5, 0x438: 0x03f5, 0x439: 0x03f5, 0x43a: 0x03f5, 0x43b: 0x03f5, - 0x43c: 0x03f5, 0x43d: 0x03f5, 0x43e: 0x03f5, 0x43f: 0x03f5, - // Block 0x11, offset 0x440 - 0x440: 0x0840, 0x441: 0x0840, 0x442: 0x0840, 0x443: 0x0840, 0x444: 0x0840, 0x445: 0x0840, - 0x446: 0x0018, 0x447: 0x0018, 0x448: 0x0818, 0x449: 0x0018, 0x44a: 0x0018, 0x44b: 0x0818, - 0x44c: 0x0018, 0x44d: 0x0818, 0x44e: 0x0018, 0x44f: 0x0018, 0x450: 0x3308, 0x451: 0x3308, - 0x452: 0x3308, 0x453: 0x3308, 0x454: 0x3308, 0x455: 0x3308, 0x456: 0x3308, 0x457: 0x3308, - 0x458: 0x3308, 0x459: 0x3308, 0x45a: 0x3308, 0x45b: 0x0818, 0x45c: 0x0b40, 0x45d: 0x0040, - 0x45e: 0x0818, 0x45f: 0x0818, 0x460: 0x0a08, 0x461: 0x0808, 0x462: 0x0c08, 0x463: 0x0c08, - 0x464: 0x0c08, 0x465: 0x0c08, 0x466: 0x0a08, 0x467: 0x0c08, 0x468: 0x0a08, 0x469: 0x0c08, - 0x46a: 0x0a08, 0x46b: 0x0a08, 0x46c: 0x0a08, 0x46d: 0x0a08, 0x46e: 0x0a08, 0x46f: 0x0c08, - 0x470: 0x0c08, 0x471: 0x0c08, 0x472: 0x0c08, 0x473: 0x0a08, 0x474: 0x0a08, 0x475: 0x0a08, - 0x476: 0x0a08, 0x477: 0x0a08, 0x478: 0x0a08, 0x479: 0x0a08, 0x47a: 0x0a08, 0x47b: 0x0a08, - 0x47c: 0x0a08, 0x47d: 0x0a08, 0x47e: 0x0a08, 0x47f: 0x0a08, - // Block 0x12, offset 0x480 - 0x480: 0x0818, 0x481: 0x0a08, 0x482: 0x0a08, 0x483: 0x0a08, 0x484: 0x0a08, 0x485: 0x0a08, - 0x486: 0x0a08, 0x487: 0x0a08, 0x488: 0x0c08, 0x489: 0x0a08, 0x48a: 0x0a08, 0x48b: 0x3308, - 0x48c: 0x3308, 0x48d: 0x3308, 0x48e: 0x3308, 0x48f: 0x3308, 0x490: 0x3308, 0x491: 0x3308, - 0x492: 0x3308, 0x493: 0x3308, 0x494: 0x3308, 0x495: 0x3308, 0x496: 0x3308, 0x497: 0x3308, - 0x498: 0x3308, 0x499: 0x3308, 0x49a: 0x3308, 0x49b: 0x3308, 0x49c: 0x3308, 0x49d: 0x3308, - 0x49e: 0x3308, 0x49f: 0x3308, 0x4a0: 0x0808, 0x4a1: 0x0808, 0x4a2: 0x0808, 0x4a3: 0x0808, - 0x4a4: 0x0808, 0x4a5: 0x0808, 0x4a6: 0x0808, 0x4a7: 0x0808, 0x4a8: 0x0808, 0x4a9: 0x0808, - 0x4aa: 0x0018, 0x4ab: 0x0818, 0x4ac: 0x0818, 0x4ad: 0x0818, 0x4ae: 0x0a08, 0x4af: 0x0a08, - 0x4b0: 0x3308, 0x4b1: 0x0c08, 0x4b2: 0x0c08, 0x4b3: 0x0c08, 0x4b4: 0x0808, 0x4b5: 0x0429, - 0x4b6: 0x0451, 0x4b7: 0x0479, 0x4b8: 0x04a1, 0x4b9: 0x0a08, 0x4ba: 0x0a08, 0x4bb: 0x0a08, - 0x4bc: 0x0a08, 0x4bd: 0x0a08, 0x4be: 0x0a08, 0x4bf: 0x0a08, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x0c08, 0x4c1: 0x0a08, 0x4c2: 0x0a08, 0x4c3: 0x0c08, 0x4c4: 0x0c08, 0x4c5: 0x0c08, - 0x4c6: 0x0c08, 0x4c7: 0x0c08, 0x4c8: 0x0c08, 0x4c9: 0x0c08, 0x4ca: 0x0c08, 0x4cb: 0x0c08, - 0x4cc: 0x0a08, 0x4cd: 0x0c08, 0x4ce: 0x0a08, 0x4cf: 0x0c08, 0x4d0: 0x0a08, 0x4d1: 0x0a08, - 0x4d2: 0x0c08, 0x4d3: 0x0c08, 0x4d4: 0x0818, 0x4d5: 0x0c08, 0x4d6: 0x3308, 0x4d7: 0x3308, - 0x4d8: 0x3308, 0x4d9: 0x3308, 0x4da: 0x3308, 0x4db: 0x3308, 0x4dc: 0x3308, 0x4dd: 0x0840, - 0x4de: 0x0018, 0x4df: 0x3308, 0x4e0: 0x3308, 0x4e1: 0x3308, 0x4e2: 0x3308, 0x4e3: 0x3308, - 0x4e4: 0x3308, 0x4e5: 0x0808, 0x4e6: 0x0808, 0x4e7: 0x3308, 0x4e8: 0x3308, 0x4e9: 0x0018, - 0x4ea: 0x3308, 0x4eb: 0x3308, 0x4ec: 0x3308, 0x4ed: 0x3308, 0x4ee: 0x0c08, 0x4ef: 0x0c08, - 0x4f0: 0x0008, 0x4f1: 0x0008, 0x4f2: 0x0008, 0x4f3: 0x0008, 0x4f4: 0x0008, 0x4f5: 0x0008, - 0x4f6: 0x0008, 0x4f7: 0x0008, 0x4f8: 0x0008, 0x4f9: 0x0008, 0x4fa: 0x0a08, 0x4fb: 0x0a08, - 0x4fc: 0x0a08, 0x4fd: 0x0808, 0x4fe: 0x0808, 0x4ff: 0x0a08, - // Block 0x14, offset 0x500 - 0x500: 0x0818, 0x501: 0x0818, 0x502: 0x0818, 0x503: 0x0818, 0x504: 0x0818, 0x505: 0x0818, - 0x506: 0x0818, 0x507: 0x0818, 0x508: 0x0818, 0x509: 0x0818, 0x50a: 0x0818, 0x50b: 0x0818, - 0x50c: 0x0818, 0x50d: 0x0818, 0x50e: 0x0040, 0x50f: 0x0b40, 0x510: 0x0c08, 0x511: 0x3308, - 0x512: 0x0a08, 0x513: 0x0a08, 0x514: 0x0a08, 0x515: 0x0c08, 0x516: 0x0c08, 0x517: 0x0c08, - 0x518: 0x0c08, 0x519: 0x0c08, 0x51a: 0x0a08, 0x51b: 0x0a08, 0x51c: 0x0a08, 0x51d: 0x0a08, - 0x51e: 0x0c08, 0x51f: 0x0a08, 0x520: 0x0a08, 0x521: 0x0a08, 0x522: 0x0a08, 0x523: 0x0a08, - 0x524: 0x0a08, 0x525: 0x0a08, 0x526: 0x0a08, 0x527: 0x0a08, 0x528: 0x0c08, 0x529: 0x0a08, - 0x52a: 0x0c08, 0x52b: 0x0a08, 0x52c: 0x0c08, 0x52d: 0x0a08, 0x52e: 0x0a08, 0x52f: 0x0c08, - 0x530: 0x3308, 0x531: 0x3308, 0x532: 0x3308, 0x533: 0x3308, 0x534: 0x3308, 0x535: 0x3308, - 0x536: 0x3308, 0x537: 0x3308, 0x538: 0x3308, 0x539: 0x3308, 0x53a: 0x3308, 0x53b: 0x3308, - 0x53c: 0x3308, 0x53d: 0x3308, 0x53e: 0x3308, 0x53f: 0x3308, - // Block 0x15, offset 0x540 - 0x540: 0x0c08, 0x541: 0x0a08, 0x542: 0x0a08, 0x543: 0x0a08, 0x544: 0x0a08, 0x545: 0x0a08, - 0x546: 0x0c08, 0x547: 0x0c08, 0x548: 0x0a08, 0x549: 0x0c08, 0x54a: 0x0a08, 0x54b: 0x0a08, - 0x54c: 0x0a08, 0x54d: 0x0a08, 0x54e: 0x0a08, 0x54f: 0x0a08, 0x550: 0x0a08, 0x551: 0x0a08, - 0x552: 0x0a08, 0x553: 0x0a08, 0x554: 0x0c08, 0x555: 0x0a08, 0x556: 0x0808, 0x557: 0x0808, - 0x558: 0x0808, 0x559: 0x3308, 0x55a: 0x3308, 0x55b: 0x3308, 0x55c: 0x0040, 0x55d: 0x0040, - 0x55e: 0x0818, 0x55f: 0x0040, 0x560: 0x0a08, 0x561: 0x0808, 0x562: 0x0a08, 0x563: 0x0a08, - 0x564: 0x0a08, 0x565: 0x0a08, 0x566: 0x0808, 0x567: 0x0c08, 0x568: 0x0a08, 0x569: 0x0c08, - 0x56a: 0x0c08, 0x56b: 0x0040, 0x56c: 0x0040, 0x56d: 0x0040, 0x56e: 0x0040, 0x56f: 0x0040, - 0x570: 0x0040, 0x571: 0x0040, 0x572: 0x0040, 0x573: 0x0040, 0x574: 0x0040, 0x575: 0x0040, - 0x576: 0x0040, 0x577: 0x0040, 0x578: 0x0040, 0x579: 0x0040, 0x57a: 0x0040, 0x57b: 0x0040, - 0x57c: 0x0040, 0x57d: 0x0040, 0x57e: 0x0040, 0x57f: 0x0040, - // Block 0x16, offset 0x580 - 0x580: 0x3008, 0x581: 0x3308, 0x582: 0x3308, 0x583: 0x3308, 0x584: 0x3308, 0x585: 0x3308, - 0x586: 0x3308, 0x587: 0x3308, 0x588: 0x3308, 0x589: 0x3008, 0x58a: 0x3008, 0x58b: 0x3008, - 0x58c: 0x3008, 0x58d: 0x3b08, 0x58e: 0x3008, 0x58f: 0x3008, 0x590: 0x0008, 0x591: 0x3308, - 0x592: 0x3308, 0x593: 0x3308, 0x594: 0x3308, 0x595: 0x3308, 0x596: 0x3308, 0x597: 0x3308, - 0x598: 0x04c9, 0x599: 0x0501, 0x59a: 0x0539, 0x59b: 0x0571, 0x59c: 0x05a9, 0x59d: 0x05e1, - 0x59e: 0x0619, 0x59f: 0x0651, 0x5a0: 0x0008, 0x5a1: 0x0008, 0x5a2: 0x3308, 0x5a3: 0x3308, - 0x5a4: 0x0018, 0x5a5: 0x0018, 0x5a6: 0x0008, 0x5a7: 0x0008, 0x5a8: 0x0008, 0x5a9: 0x0008, - 0x5aa: 0x0008, 0x5ab: 0x0008, 0x5ac: 0x0008, 0x5ad: 0x0008, 0x5ae: 0x0008, 0x5af: 0x0008, - 0x5b0: 0x0018, 0x5b1: 0x0008, 0x5b2: 0x0008, 0x5b3: 0x0008, 0x5b4: 0x0008, 0x5b5: 0x0008, - 0x5b6: 0x0008, 0x5b7: 0x0008, 0x5b8: 0x0008, 0x5b9: 0x0008, 0x5ba: 0x0008, 0x5bb: 0x0008, - 0x5bc: 0x0008, 0x5bd: 0x0008, 0x5be: 0x0008, 0x5bf: 0x0008, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x0008, 0x5c1: 0x3308, 0x5c2: 0x3008, 0x5c3: 0x3008, 0x5c4: 0x0040, 0x5c5: 0x0008, - 0x5c6: 0x0008, 0x5c7: 0x0008, 0x5c8: 0x0008, 0x5c9: 0x0008, 0x5ca: 0x0008, 0x5cb: 0x0008, - 0x5cc: 0x0008, 0x5cd: 0x0040, 0x5ce: 0x0040, 0x5cf: 0x0008, 0x5d0: 0x0008, 0x5d1: 0x0040, - 0x5d2: 0x0040, 0x5d3: 0x0008, 0x5d4: 0x0008, 0x5d5: 0x0008, 0x5d6: 0x0008, 0x5d7: 0x0008, - 0x5d8: 0x0008, 0x5d9: 0x0008, 0x5da: 0x0008, 0x5db: 0x0008, 0x5dc: 0x0008, 0x5dd: 0x0008, - 0x5de: 0x0008, 0x5df: 0x0008, 0x5e0: 0x0008, 0x5e1: 0x0008, 0x5e2: 0x0008, 0x5e3: 0x0008, - 0x5e4: 0x0008, 0x5e5: 0x0008, 0x5e6: 0x0008, 0x5e7: 0x0008, 0x5e8: 0x0008, 0x5e9: 0x0040, - 0x5ea: 0x0008, 0x5eb: 0x0008, 0x5ec: 0x0008, 0x5ed: 0x0008, 0x5ee: 0x0008, 0x5ef: 0x0008, - 0x5f0: 0x0008, 0x5f1: 0x0040, 0x5f2: 0x0008, 0x5f3: 0x0040, 0x5f4: 0x0040, 0x5f5: 0x0040, - 0x5f6: 0x0008, 0x5f7: 0x0008, 0x5f8: 0x0008, 0x5f9: 0x0008, 0x5fa: 0x0040, 0x5fb: 0x0040, - 0x5fc: 0x3308, 0x5fd: 0x0008, 0x5fe: 0x3008, 0x5ff: 0x3008, - // Block 0x18, offset 0x600 - 0x600: 0x3008, 0x601: 0x3308, 0x602: 0x3308, 0x603: 0x3308, 0x604: 0x3308, 0x605: 0x0040, - 0x606: 0x0040, 0x607: 0x3008, 0x608: 0x3008, 0x609: 0x0040, 0x60a: 0x0040, 0x60b: 0x3008, - 0x60c: 0x3008, 0x60d: 0x3b08, 0x60e: 0x0008, 0x60f: 0x0040, 0x610: 0x0040, 0x611: 0x0040, - 0x612: 0x0040, 0x613: 0x0040, 0x614: 0x0040, 0x615: 0x0040, 0x616: 0x0040, 0x617: 0x3008, - 0x618: 0x0040, 0x619: 0x0040, 0x61a: 0x0040, 0x61b: 0x0040, 0x61c: 0x0689, 0x61d: 0x06c1, - 0x61e: 0x0040, 0x61f: 0x06f9, 0x620: 0x0008, 0x621: 0x0008, 0x622: 0x3308, 0x623: 0x3308, - 0x624: 0x0040, 0x625: 0x0040, 0x626: 0x0008, 0x627: 0x0008, 0x628: 0x0008, 0x629: 0x0008, - 0x62a: 0x0008, 0x62b: 0x0008, 0x62c: 0x0008, 0x62d: 0x0008, 0x62e: 0x0008, 0x62f: 0x0008, - 0x630: 0x0008, 0x631: 0x0008, 0x632: 0x0018, 0x633: 0x0018, 0x634: 0x0018, 0x635: 0x0018, - 0x636: 0x0018, 0x637: 0x0018, 0x638: 0x0018, 0x639: 0x0018, 0x63a: 0x0018, 0x63b: 0x0018, - 0x63c: 0x0008, 0x63d: 0x0018, 0x63e: 0x3308, 0x63f: 0x0040, - // Block 0x19, offset 0x640 - 0x640: 0x0040, 0x641: 0x3308, 0x642: 0x3308, 0x643: 0x3008, 0x644: 0x0040, 0x645: 0x0008, - 0x646: 0x0008, 0x647: 0x0008, 0x648: 0x0008, 0x649: 0x0008, 0x64a: 0x0008, 0x64b: 0x0040, - 0x64c: 0x0040, 0x64d: 0x0040, 0x64e: 0x0040, 0x64f: 0x0008, 0x650: 0x0008, 0x651: 0x0040, - 0x652: 0x0040, 0x653: 0x0008, 0x654: 0x0008, 0x655: 0x0008, 0x656: 0x0008, 0x657: 0x0008, - 0x658: 0x0008, 0x659: 0x0008, 0x65a: 0x0008, 0x65b: 0x0008, 0x65c: 0x0008, 0x65d: 0x0008, - 0x65e: 0x0008, 0x65f: 0x0008, 0x660: 0x0008, 0x661: 0x0008, 0x662: 0x0008, 0x663: 0x0008, - 0x664: 0x0008, 0x665: 0x0008, 0x666: 0x0008, 0x667: 0x0008, 0x668: 0x0008, 0x669: 0x0040, - 0x66a: 0x0008, 0x66b: 0x0008, 0x66c: 0x0008, 0x66d: 0x0008, 0x66e: 0x0008, 0x66f: 0x0008, - 0x670: 0x0008, 0x671: 0x0040, 0x672: 0x0008, 0x673: 0x0731, 0x674: 0x0040, 0x675: 0x0008, - 0x676: 0x0769, 0x677: 0x0040, 0x678: 0x0008, 0x679: 0x0008, 0x67a: 0x0040, 0x67b: 0x0040, - 0x67c: 0x3308, 0x67d: 0x0040, 0x67e: 0x3008, 0x67f: 0x3008, - // Block 0x1a, offset 0x680 - 0x680: 0x3008, 0x681: 0x3308, 0x682: 0x3308, 0x683: 0x0040, 0x684: 0x0040, 0x685: 0x0040, - 0x686: 0x0040, 0x687: 0x3308, 0x688: 0x3308, 0x689: 0x0040, 0x68a: 0x0040, 0x68b: 0x3308, - 0x68c: 0x3308, 0x68d: 0x3b08, 0x68e: 0x0040, 0x68f: 0x0040, 0x690: 0x0040, 0x691: 0x3308, - 0x692: 0x0040, 0x693: 0x0040, 0x694: 0x0040, 0x695: 0x0040, 0x696: 0x0040, 0x697: 0x0040, - 0x698: 0x0040, 0x699: 0x07a1, 0x69a: 0x07d9, 0x69b: 0x0811, 0x69c: 0x0008, 0x69d: 0x0040, - 0x69e: 0x0849, 0x69f: 0x0040, 0x6a0: 0x0040, 0x6a1: 0x0040, 0x6a2: 0x0040, 0x6a3: 0x0040, - 0x6a4: 0x0040, 0x6a5: 0x0040, 0x6a6: 0x0008, 0x6a7: 0x0008, 0x6a8: 0x0008, 0x6a9: 0x0008, - 0x6aa: 0x0008, 0x6ab: 0x0008, 0x6ac: 0x0008, 0x6ad: 0x0008, 0x6ae: 0x0008, 0x6af: 0x0008, - 0x6b0: 0x3308, 0x6b1: 0x3308, 0x6b2: 0x0008, 0x6b3: 0x0008, 0x6b4: 0x0008, 0x6b5: 0x3308, - 0x6b6: 0x0018, 0x6b7: 0x0040, 0x6b8: 0x0040, 0x6b9: 0x0040, 0x6ba: 0x0040, 0x6bb: 0x0040, - 0x6bc: 0x0040, 0x6bd: 0x0040, 0x6be: 0x0040, 0x6bf: 0x0040, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x0040, 0x6c1: 0x3308, 0x6c2: 0x3308, 0x6c3: 0x3008, 0x6c4: 0x0040, 0x6c5: 0x0008, - 0x6c6: 0x0008, 0x6c7: 0x0008, 0x6c8: 0x0008, 0x6c9: 0x0008, 0x6ca: 0x0008, 0x6cb: 0x0008, - 0x6cc: 0x0008, 0x6cd: 0x0008, 0x6ce: 0x0040, 0x6cf: 0x0008, 0x6d0: 0x0008, 0x6d1: 0x0008, - 0x6d2: 0x0040, 0x6d3: 0x0008, 0x6d4: 0x0008, 0x6d5: 0x0008, 0x6d6: 0x0008, 0x6d7: 0x0008, - 0x6d8: 0x0008, 0x6d9: 0x0008, 0x6da: 0x0008, 0x6db: 0x0008, 0x6dc: 0x0008, 0x6dd: 0x0008, - 0x6de: 0x0008, 0x6df: 0x0008, 0x6e0: 0x0008, 0x6e1: 0x0008, 0x6e2: 0x0008, 0x6e3: 0x0008, - 0x6e4: 0x0008, 0x6e5: 0x0008, 0x6e6: 0x0008, 0x6e7: 0x0008, 0x6e8: 0x0008, 0x6e9: 0x0040, - 0x6ea: 0x0008, 0x6eb: 0x0008, 0x6ec: 0x0008, 0x6ed: 0x0008, 0x6ee: 0x0008, 0x6ef: 0x0008, - 0x6f0: 0x0008, 0x6f1: 0x0040, 0x6f2: 0x0008, 0x6f3: 0x0008, 0x6f4: 0x0040, 0x6f5: 0x0008, - 0x6f6: 0x0008, 0x6f7: 0x0008, 0x6f8: 0x0008, 0x6f9: 0x0008, 0x6fa: 0x0040, 0x6fb: 0x0040, - 0x6fc: 0x3308, 0x6fd: 0x0008, 0x6fe: 0x3008, 0x6ff: 0x3008, - // Block 0x1c, offset 0x700 - 0x700: 0x3008, 0x701: 0x3308, 0x702: 0x3308, 0x703: 0x3308, 0x704: 0x3308, 0x705: 0x3308, - 0x706: 0x0040, 0x707: 0x3308, 0x708: 0x3308, 0x709: 0x3008, 0x70a: 0x0040, 0x70b: 0x3008, - 0x70c: 0x3008, 0x70d: 0x3b08, 0x70e: 0x0040, 0x70f: 0x0040, 0x710: 0x0008, 0x711: 0x0040, - 0x712: 0x0040, 0x713: 0x0040, 0x714: 0x0040, 0x715: 0x0040, 0x716: 0x0040, 0x717: 0x0040, - 0x718: 0x0040, 0x719: 0x0040, 0x71a: 0x0040, 0x71b: 0x0040, 0x71c: 0x0040, 0x71d: 0x0040, - 0x71e: 0x0040, 0x71f: 0x0040, 0x720: 0x0008, 0x721: 0x0008, 0x722: 0x3308, 0x723: 0x3308, - 0x724: 0x0040, 0x725: 0x0040, 0x726: 0x0008, 0x727: 0x0008, 0x728: 0x0008, 0x729: 0x0008, - 0x72a: 0x0008, 0x72b: 0x0008, 0x72c: 0x0008, 0x72d: 0x0008, 0x72e: 0x0008, 0x72f: 0x0008, - 0x730: 0x0018, 0x731: 0x0018, 0x732: 0x0040, 0x733: 0x0040, 0x734: 0x0040, 0x735: 0x0040, - 0x736: 0x0040, 0x737: 0x0040, 0x738: 0x0040, 0x739: 0x0008, 0x73a: 0x3308, 0x73b: 0x3308, - 0x73c: 0x3308, 0x73d: 0x3308, 0x73e: 0x3308, 0x73f: 0x3308, - // Block 0x1d, offset 0x740 - 0x740: 0x0040, 0x741: 0x3308, 0x742: 0x3008, 0x743: 0x3008, 0x744: 0x0040, 0x745: 0x0008, - 0x746: 0x0008, 0x747: 0x0008, 0x748: 0x0008, 0x749: 0x0008, 0x74a: 0x0008, 0x74b: 0x0008, - 0x74c: 0x0008, 0x74d: 0x0040, 0x74e: 0x0040, 0x74f: 0x0008, 0x750: 0x0008, 0x751: 0x0040, - 0x752: 0x0040, 0x753: 0x0008, 0x754: 0x0008, 0x755: 0x0008, 0x756: 0x0008, 0x757: 0x0008, - 0x758: 0x0008, 0x759: 0x0008, 0x75a: 0x0008, 0x75b: 0x0008, 0x75c: 0x0008, 0x75d: 0x0008, - 0x75e: 0x0008, 0x75f: 0x0008, 0x760: 0x0008, 0x761: 0x0008, 0x762: 0x0008, 0x763: 0x0008, - 0x764: 0x0008, 0x765: 0x0008, 0x766: 0x0008, 0x767: 0x0008, 0x768: 0x0008, 0x769: 0x0040, - 0x76a: 0x0008, 0x76b: 0x0008, 0x76c: 0x0008, 0x76d: 0x0008, 0x76e: 0x0008, 0x76f: 0x0008, - 0x770: 0x0008, 0x771: 0x0040, 0x772: 0x0008, 0x773: 0x0008, 0x774: 0x0040, 0x775: 0x0008, - 0x776: 0x0008, 0x777: 0x0008, 0x778: 0x0008, 0x779: 0x0008, 0x77a: 0x0040, 0x77b: 0x0040, - 0x77c: 0x3308, 0x77d: 0x0008, 0x77e: 0x3008, 0x77f: 0x3308, - // Block 0x1e, offset 0x780 - 0x780: 0x3008, 0x781: 0x3308, 0x782: 0x3308, 0x783: 0x3308, 0x784: 0x3308, 0x785: 0x0040, - 0x786: 0x0040, 0x787: 0x3008, 0x788: 0x3008, 0x789: 0x0040, 0x78a: 0x0040, 0x78b: 0x3008, - 0x78c: 0x3008, 0x78d: 0x3b08, 0x78e: 0x0040, 0x78f: 0x0040, 0x790: 0x0040, 0x791: 0x0040, - 0x792: 0x0040, 0x793: 0x0040, 0x794: 0x0040, 0x795: 0x0040, 0x796: 0x3308, 0x797: 0x3008, - 0x798: 0x0040, 0x799: 0x0040, 0x79a: 0x0040, 0x79b: 0x0040, 0x79c: 0x0881, 0x79d: 0x08b9, - 0x79e: 0x0040, 0x79f: 0x0008, 0x7a0: 0x0008, 0x7a1: 0x0008, 0x7a2: 0x3308, 0x7a3: 0x3308, - 0x7a4: 0x0040, 0x7a5: 0x0040, 0x7a6: 0x0008, 0x7a7: 0x0008, 0x7a8: 0x0008, 0x7a9: 0x0008, - 0x7aa: 0x0008, 0x7ab: 0x0008, 0x7ac: 0x0008, 0x7ad: 0x0008, 0x7ae: 0x0008, 0x7af: 0x0008, - 0x7b0: 0x0018, 0x7b1: 0x0008, 0x7b2: 0x0018, 0x7b3: 0x0018, 0x7b4: 0x0018, 0x7b5: 0x0018, - 0x7b6: 0x0018, 0x7b7: 0x0018, 0x7b8: 0x0040, 0x7b9: 0x0040, 0x7ba: 0x0040, 0x7bb: 0x0040, - 0x7bc: 0x0040, 0x7bd: 0x0040, 0x7be: 0x0040, 0x7bf: 0x0040, - // Block 0x1f, offset 0x7c0 - 0x7c0: 0x0040, 0x7c1: 0x0040, 0x7c2: 0x3308, 0x7c3: 0x0008, 0x7c4: 0x0040, 0x7c5: 0x0008, - 0x7c6: 0x0008, 0x7c7: 0x0008, 0x7c8: 0x0008, 0x7c9: 0x0008, 0x7ca: 0x0008, 0x7cb: 0x0040, - 0x7cc: 0x0040, 0x7cd: 0x0040, 0x7ce: 0x0008, 0x7cf: 0x0008, 0x7d0: 0x0008, 0x7d1: 0x0040, - 0x7d2: 0x0008, 0x7d3: 0x0008, 0x7d4: 0x0008, 0x7d5: 0x0008, 0x7d6: 0x0040, 0x7d7: 0x0040, - 0x7d8: 0x0040, 0x7d9: 0x0008, 0x7da: 0x0008, 0x7db: 0x0040, 0x7dc: 0x0008, 0x7dd: 0x0040, - 0x7de: 0x0008, 0x7df: 0x0008, 0x7e0: 0x0040, 0x7e1: 0x0040, 0x7e2: 0x0040, 0x7e3: 0x0008, - 0x7e4: 0x0008, 0x7e5: 0x0040, 0x7e6: 0x0040, 0x7e7: 0x0040, 0x7e8: 0x0008, 0x7e9: 0x0008, - 0x7ea: 0x0008, 0x7eb: 0x0040, 0x7ec: 0x0040, 0x7ed: 0x0040, 0x7ee: 0x0008, 0x7ef: 0x0008, - 0x7f0: 0x0008, 0x7f1: 0x0008, 0x7f2: 0x0008, 0x7f3: 0x0008, 0x7f4: 0x0008, 0x7f5: 0x0008, - 0x7f6: 0x0008, 0x7f7: 0x0008, 0x7f8: 0x0008, 0x7f9: 0x0008, 0x7fa: 0x0040, 0x7fb: 0x0040, - 0x7fc: 0x0040, 0x7fd: 0x0040, 0x7fe: 0x3008, 0x7ff: 0x3008, - // Block 0x20, offset 0x800 - 0x800: 0x3308, 0x801: 0x3008, 0x802: 0x3008, 0x803: 0x3008, 0x804: 0x3008, 0x805: 0x0040, - 0x806: 0x3308, 0x807: 0x3308, 0x808: 0x3308, 0x809: 0x0040, 0x80a: 0x3308, 0x80b: 0x3308, - 0x80c: 0x3308, 0x80d: 0x3b08, 0x80e: 0x0040, 0x80f: 0x0040, 0x810: 0x0040, 0x811: 0x0040, - 0x812: 0x0040, 0x813: 0x0040, 0x814: 0x0040, 0x815: 0x3308, 0x816: 0x3308, 0x817: 0x0040, - 0x818: 0x0008, 0x819: 0x0008, 0x81a: 0x0008, 0x81b: 0x0040, 0x81c: 0x0040, 0x81d: 0x0040, - 0x81e: 0x0040, 0x81f: 0x0040, 0x820: 0x0008, 0x821: 0x0008, 0x822: 0x3308, 0x823: 0x3308, - 0x824: 0x0040, 0x825: 0x0040, 0x826: 0x0008, 0x827: 0x0008, 0x828: 0x0008, 0x829: 0x0008, - 0x82a: 0x0008, 0x82b: 0x0008, 0x82c: 0x0008, 0x82d: 0x0008, 0x82e: 0x0008, 0x82f: 0x0008, - 0x830: 0x0040, 0x831: 0x0040, 0x832: 0x0040, 0x833: 0x0040, 0x834: 0x0040, 0x835: 0x0040, - 0x836: 0x0040, 0x837: 0x0018, 0x838: 0x0018, 0x839: 0x0018, 0x83a: 0x0018, 0x83b: 0x0018, - 0x83c: 0x0018, 0x83d: 0x0018, 0x83e: 0x0018, 0x83f: 0x0018, - // Block 0x21, offset 0x840 - 0x840: 0x0008, 0x841: 0x3308, 0x842: 0x3008, 0x843: 0x3008, 0x844: 0x0018, 0x845: 0x0008, - 0x846: 0x0008, 0x847: 0x0008, 0x848: 0x0008, 0x849: 0x0008, 0x84a: 0x0008, 0x84b: 0x0008, - 0x84c: 0x0008, 0x84d: 0x0040, 0x84e: 0x0008, 0x84f: 0x0008, 0x850: 0x0008, 0x851: 0x0040, - 0x852: 0x0008, 0x853: 0x0008, 0x854: 0x0008, 0x855: 0x0008, 0x856: 0x0008, 0x857: 0x0008, - 0x858: 0x0008, 0x859: 0x0008, 0x85a: 0x0008, 0x85b: 0x0008, 0x85c: 0x0008, 0x85d: 0x0008, - 0x85e: 0x0008, 0x85f: 0x0008, 0x860: 0x0008, 0x861: 0x0008, 0x862: 0x0008, 0x863: 0x0008, - 0x864: 0x0008, 0x865: 0x0008, 0x866: 0x0008, 0x867: 0x0008, 0x868: 0x0008, 0x869: 0x0040, - 0x86a: 0x0008, 0x86b: 0x0008, 0x86c: 0x0008, 0x86d: 0x0008, 0x86e: 0x0008, 0x86f: 0x0008, - 0x870: 0x0008, 0x871: 0x0008, 0x872: 0x0008, 0x873: 0x0008, 0x874: 0x0040, 0x875: 0x0008, - 0x876: 0x0008, 0x877: 0x0008, 0x878: 0x0008, 0x879: 0x0008, 0x87a: 0x0040, 0x87b: 0x0040, - 0x87c: 0x3308, 0x87d: 0x0008, 0x87e: 0x3008, 0x87f: 0x3308, - // Block 0x22, offset 0x880 - 0x880: 0x3008, 0x881: 0x3008, 0x882: 0x3008, 0x883: 0x3008, 0x884: 0x3008, 0x885: 0x0040, - 0x886: 0x3308, 0x887: 0x3008, 0x888: 0x3008, 0x889: 0x0040, 0x88a: 0x3008, 0x88b: 0x3008, - 0x88c: 0x3308, 0x88d: 0x3b08, 0x88e: 0x0040, 0x88f: 0x0040, 0x890: 0x0040, 0x891: 0x0040, - 0x892: 0x0040, 0x893: 0x0040, 0x894: 0x0040, 0x895: 0x3008, 0x896: 0x3008, 0x897: 0x0040, - 0x898: 0x0040, 0x899: 0x0040, 0x89a: 0x0040, 0x89b: 0x0040, 0x89c: 0x0040, 0x89d: 0x0040, - 0x89e: 0x0008, 0x89f: 0x0040, 0x8a0: 0x0008, 0x8a1: 0x0008, 0x8a2: 0x3308, 0x8a3: 0x3308, - 0x8a4: 0x0040, 0x8a5: 0x0040, 0x8a6: 0x0008, 0x8a7: 0x0008, 0x8a8: 0x0008, 0x8a9: 0x0008, - 0x8aa: 0x0008, 0x8ab: 0x0008, 0x8ac: 0x0008, 0x8ad: 0x0008, 0x8ae: 0x0008, 0x8af: 0x0008, - 0x8b0: 0x0040, 0x8b1: 0x0008, 0x8b2: 0x0008, 0x8b3: 0x0040, 0x8b4: 0x0040, 0x8b5: 0x0040, - 0x8b6: 0x0040, 0x8b7: 0x0040, 0x8b8: 0x0040, 0x8b9: 0x0040, 0x8ba: 0x0040, 0x8bb: 0x0040, - 0x8bc: 0x0040, 0x8bd: 0x0040, 0x8be: 0x0040, 0x8bf: 0x0040, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x3008, 0x8c1: 0x3308, 0x8c2: 0x3308, 0x8c3: 0x3308, 0x8c4: 0x3308, 0x8c5: 0x0040, - 0x8c6: 0x3008, 0x8c7: 0x3008, 0x8c8: 0x3008, 0x8c9: 0x0040, 0x8ca: 0x3008, 0x8cb: 0x3008, - 0x8cc: 0x3008, 0x8cd: 0x3b08, 0x8ce: 0x0008, 0x8cf: 0x0018, 0x8d0: 0x0040, 0x8d1: 0x0040, - 0x8d2: 0x0040, 0x8d3: 0x0040, 0x8d4: 0x0008, 0x8d5: 0x0008, 0x8d6: 0x0008, 0x8d7: 0x3008, - 0x8d8: 0x0018, 0x8d9: 0x0018, 0x8da: 0x0018, 0x8db: 0x0018, 0x8dc: 0x0018, 0x8dd: 0x0018, - 0x8de: 0x0018, 0x8df: 0x0008, 0x8e0: 0x0008, 0x8e1: 0x0008, 0x8e2: 0x3308, 0x8e3: 0x3308, - 0x8e4: 0x0040, 0x8e5: 0x0040, 0x8e6: 0x0008, 0x8e7: 0x0008, 0x8e8: 0x0008, 0x8e9: 0x0008, - 0x8ea: 0x0008, 0x8eb: 0x0008, 0x8ec: 0x0008, 0x8ed: 0x0008, 0x8ee: 0x0008, 0x8ef: 0x0008, - 0x8f0: 0x0018, 0x8f1: 0x0018, 0x8f2: 0x0018, 0x8f3: 0x0018, 0x8f4: 0x0018, 0x8f5: 0x0018, - 0x8f6: 0x0018, 0x8f7: 0x0018, 0x8f8: 0x0018, 0x8f9: 0x0018, 0x8fa: 0x0008, 0x8fb: 0x0008, - 0x8fc: 0x0008, 0x8fd: 0x0008, 0x8fe: 0x0008, 0x8ff: 0x0008, - // Block 0x24, offset 0x900 - 0x900: 0x0040, 0x901: 0x0008, 0x902: 0x0008, 0x903: 0x0040, 0x904: 0x0008, 0x905: 0x0040, - 0x906: 0x0008, 0x907: 0x0008, 0x908: 0x0008, 0x909: 0x0008, 0x90a: 0x0008, 0x90b: 0x0040, - 0x90c: 0x0008, 0x90d: 0x0008, 0x90e: 0x0008, 0x90f: 0x0008, 0x910: 0x0008, 0x911: 0x0008, - 0x912: 0x0008, 0x913: 0x0008, 0x914: 0x0008, 0x915: 0x0008, 0x916: 0x0008, 0x917: 0x0008, - 0x918: 0x0008, 0x919: 0x0008, 0x91a: 0x0008, 0x91b: 0x0008, 0x91c: 0x0008, 0x91d: 0x0008, - 0x91e: 0x0008, 0x91f: 0x0008, 0x920: 0x0008, 0x921: 0x0008, 0x922: 0x0008, 0x923: 0x0008, - 0x924: 0x0040, 0x925: 0x0008, 0x926: 0x0040, 0x927: 0x0008, 0x928: 0x0008, 0x929: 0x0008, - 0x92a: 0x0008, 0x92b: 0x0008, 0x92c: 0x0008, 0x92d: 0x0008, 0x92e: 0x0008, 0x92f: 0x0008, - 0x930: 0x0008, 0x931: 0x3308, 0x932: 0x0008, 0x933: 0x0929, 0x934: 0x3308, 0x935: 0x3308, - 0x936: 0x3308, 0x937: 0x3308, 0x938: 0x3308, 0x939: 0x3308, 0x93a: 0x3b08, 0x93b: 0x3308, - 0x93c: 0x3308, 0x93d: 0x0008, 0x93e: 0x0040, 0x93f: 0x0040, - // Block 0x25, offset 0x940 - 0x940: 0x0008, 0x941: 0x0008, 0x942: 0x0008, 0x943: 0x09d1, 0x944: 0x0008, 0x945: 0x0008, - 0x946: 0x0008, 0x947: 0x0008, 0x948: 0x0040, 0x949: 0x0008, 0x94a: 0x0008, 0x94b: 0x0008, - 0x94c: 0x0008, 0x94d: 0x0a09, 0x94e: 0x0008, 0x94f: 0x0008, 0x950: 0x0008, 0x951: 0x0008, - 0x952: 0x0a41, 0x953: 0x0008, 0x954: 0x0008, 0x955: 0x0008, 0x956: 0x0008, 0x957: 0x0a79, - 0x958: 0x0008, 0x959: 0x0008, 0x95a: 0x0008, 0x95b: 0x0008, 0x95c: 0x0ab1, 0x95d: 0x0008, - 0x95e: 0x0008, 0x95f: 0x0008, 0x960: 0x0008, 0x961: 0x0008, 0x962: 0x0008, 0x963: 0x0008, - 0x964: 0x0008, 0x965: 0x0008, 0x966: 0x0008, 0x967: 0x0008, 0x968: 0x0008, 0x969: 0x0ae9, - 0x96a: 0x0008, 0x96b: 0x0008, 0x96c: 0x0008, 0x96d: 0x0040, 0x96e: 0x0040, 0x96f: 0x0040, - 0x970: 0x0040, 0x971: 0x3308, 0x972: 0x3308, 0x973: 0x0b21, 0x974: 0x3308, 0x975: 0x0b59, - 0x976: 0x0b91, 0x977: 0x0bc9, 0x978: 0x0c19, 0x979: 0x0c51, 0x97a: 0x3308, 0x97b: 0x3308, - 0x97c: 0x3308, 0x97d: 0x3308, 0x97e: 0x3308, 0x97f: 0x3008, - // Block 0x26, offset 0x980 - 0x980: 0x3308, 0x981: 0x0ca1, 0x982: 0x3308, 0x983: 0x3308, 0x984: 0x3b08, 0x985: 0x0018, - 0x986: 0x3308, 0x987: 0x3308, 0x988: 0x0008, 0x989: 0x0008, 0x98a: 0x0008, 0x98b: 0x0008, - 0x98c: 0x0008, 0x98d: 0x3308, 0x98e: 0x3308, 0x98f: 0x3308, 0x990: 0x3308, 0x991: 0x3308, - 0x992: 0x3308, 0x993: 0x0cd9, 0x994: 0x3308, 0x995: 0x3308, 0x996: 0x3308, 0x997: 0x3308, - 0x998: 0x0040, 0x999: 0x3308, 0x99a: 0x3308, 0x99b: 0x3308, 0x99c: 0x3308, 0x99d: 0x0d11, - 0x99e: 0x3308, 0x99f: 0x3308, 0x9a0: 0x3308, 0x9a1: 0x3308, 0x9a2: 0x0d49, 0x9a3: 0x3308, - 0x9a4: 0x3308, 0x9a5: 0x3308, 0x9a6: 0x3308, 0x9a7: 0x0d81, 0x9a8: 0x3308, 0x9a9: 0x3308, - 0x9aa: 0x3308, 0x9ab: 0x3308, 0x9ac: 0x0db9, 0x9ad: 0x3308, 0x9ae: 0x3308, 0x9af: 0x3308, - 0x9b0: 0x3308, 0x9b1: 0x3308, 0x9b2: 0x3308, 0x9b3: 0x3308, 0x9b4: 0x3308, 0x9b5: 0x3308, - 0x9b6: 0x3308, 0x9b7: 0x3308, 0x9b8: 0x3308, 0x9b9: 0x0df1, 0x9ba: 0x3308, 0x9bb: 0x3308, - 0x9bc: 0x3308, 0x9bd: 0x0040, 0x9be: 0x0018, 0x9bf: 0x0018, - // Block 0x27, offset 0x9c0 - 0x9c0: 0x0008, 0x9c1: 0x0008, 0x9c2: 0x0008, 0x9c3: 0x0008, 0x9c4: 0x0008, 0x9c5: 0x0008, - 0x9c6: 0x0008, 0x9c7: 0x0008, 0x9c8: 0x0008, 0x9c9: 0x0008, 0x9ca: 0x0008, 0x9cb: 0x0008, - 0x9cc: 0x0008, 0x9cd: 0x0008, 0x9ce: 0x0008, 0x9cf: 0x0008, 0x9d0: 0x0008, 0x9d1: 0x0008, - 0x9d2: 0x0008, 0x9d3: 0x0008, 0x9d4: 0x0008, 0x9d5: 0x0008, 0x9d6: 0x0008, 0x9d7: 0x0008, - 0x9d8: 0x0008, 0x9d9: 0x0008, 0x9da: 0x0008, 0x9db: 0x0008, 0x9dc: 0x0008, 0x9dd: 0x0008, - 0x9de: 0x0008, 0x9df: 0x0008, 0x9e0: 0x0008, 0x9e1: 0x0008, 0x9e2: 0x0008, 0x9e3: 0x0008, - 0x9e4: 0x0008, 0x9e5: 0x0008, 0x9e6: 0x0008, 0x9e7: 0x0008, 0x9e8: 0x0008, 0x9e9: 0x0008, - 0x9ea: 0x0008, 0x9eb: 0x0008, 0x9ec: 0x0039, 0x9ed: 0x0ed1, 0x9ee: 0x0ee9, 0x9ef: 0x0008, - 0x9f0: 0x0ef9, 0x9f1: 0x0f09, 0x9f2: 0x0f19, 0x9f3: 0x0f31, 0x9f4: 0x0249, 0x9f5: 0x0f41, - 0x9f6: 0x0259, 0x9f7: 0x0f51, 0x9f8: 0x0359, 0x9f9: 0x0f61, 0x9fa: 0x0f71, 0x9fb: 0x0008, - 0x9fc: 0x00d9, 0x9fd: 0x0f81, 0x9fe: 0x0f99, 0x9ff: 0x0269, - // Block 0x28, offset 0xa00 - 0xa00: 0x0fa9, 0xa01: 0x0fb9, 0xa02: 0x0279, 0xa03: 0x0039, 0xa04: 0x0fc9, 0xa05: 0x0fe1, - 0xa06: 0x05b5, 0xa07: 0x0ee9, 0xa08: 0x0ef9, 0xa09: 0x0f09, 0xa0a: 0x0ff9, 0xa0b: 0x1011, - 0xa0c: 0x1029, 0xa0d: 0x0f31, 0xa0e: 0x0008, 0xa0f: 0x0f51, 0xa10: 0x0f61, 0xa11: 0x1041, - 0xa12: 0x00d9, 0xa13: 0x1059, 0xa14: 0x05cd, 0xa15: 0x05cd, 0xa16: 0x0f99, 0xa17: 0x0fa9, - 0xa18: 0x0fb9, 0xa19: 0x05b5, 0xa1a: 0x1071, 0xa1b: 0x1089, 0xa1c: 0x05e5, 0xa1d: 0x1099, - 0xa1e: 0x10b1, 0xa1f: 0x10c9, 0xa20: 0x10e1, 0xa21: 0x10f9, 0xa22: 0x0f41, 0xa23: 0x0269, - 0xa24: 0x0fb9, 0xa25: 0x1089, 0xa26: 0x1099, 0xa27: 0x10b1, 0xa28: 0x1111, 0xa29: 0x10e1, - 0xa2a: 0x10f9, 0xa2b: 0x0008, 0xa2c: 0x0008, 0xa2d: 0x0008, 0xa2e: 0x0008, 0xa2f: 0x0008, - 0xa30: 0x0008, 0xa31: 0x0008, 0xa32: 0x0008, 0xa33: 0x0008, 0xa34: 0x0008, 0xa35: 0x0008, - 0xa36: 0x0008, 0xa37: 0x0008, 0xa38: 0x1129, 0xa39: 0x0008, 0xa3a: 0x0008, 0xa3b: 0x0008, - 0xa3c: 0x0008, 0xa3d: 0x0008, 0xa3e: 0x0008, 0xa3f: 0x0008, - // Block 0x29, offset 0xa40 - 0xa40: 0x0008, 0xa41: 0x0008, 0xa42: 0x0008, 0xa43: 0x0008, 0xa44: 0x0008, 0xa45: 0x0008, - 0xa46: 0x0008, 0xa47: 0x0008, 0xa48: 0x0008, 0xa49: 0x0008, 0xa4a: 0x0008, 0xa4b: 0x0008, - 0xa4c: 0x0008, 0xa4d: 0x0008, 0xa4e: 0x0008, 0xa4f: 0x0008, 0xa50: 0x0008, 0xa51: 0x0008, - 0xa52: 0x0008, 0xa53: 0x0008, 0xa54: 0x0008, 0xa55: 0x0008, 0xa56: 0x0008, 0xa57: 0x0008, - 0xa58: 0x0008, 0xa59: 0x0008, 0xa5a: 0x0008, 0xa5b: 0x1141, 0xa5c: 0x1159, 0xa5d: 0x1169, - 0xa5e: 0x1181, 0xa5f: 0x1029, 0xa60: 0x1199, 0xa61: 0x11a9, 0xa62: 0x11c1, 0xa63: 0x11d9, - 0xa64: 0x11f1, 0xa65: 0x1209, 0xa66: 0x1221, 0xa67: 0x05fd, 0xa68: 0x1239, 0xa69: 0x1251, - 0xa6a: 0xe17d, 0xa6b: 0x1269, 0xa6c: 0x1281, 0xa6d: 0x1299, 0xa6e: 0x12b1, 0xa6f: 0x12c9, - 0xa70: 0x12e1, 0xa71: 0x12f9, 0xa72: 0x1311, 0xa73: 0x1329, 0xa74: 0x1341, 0xa75: 0x1359, - 0xa76: 0x1371, 0xa77: 0x1389, 0xa78: 0x0615, 0xa79: 0x13a1, 0xa7a: 0x13b9, 0xa7b: 0x13d1, - 0xa7c: 0x13e1, 0xa7d: 0x13f9, 0xa7e: 0x1411, 0xa7f: 0x1429, - // Block 0x2a, offset 0xa80 - 0xa80: 0xe00d, 0xa81: 0x0008, 0xa82: 0xe00d, 0xa83: 0x0008, 0xa84: 0xe00d, 0xa85: 0x0008, - 0xa86: 0xe00d, 0xa87: 0x0008, 0xa88: 0xe00d, 0xa89: 0x0008, 0xa8a: 0xe00d, 0xa8b: 0x0008, - 0xa8c: 0xe00d, 0xa8d: 0x0008, 0xa8e: 0xe00d, 0xa8f: 0x0008, 0xa90: 0xe00d, 0xa91: 0x0008, - 0xa92: 0xe00d, 0xa93: 0x0008, 0xa94: 0xe00d, 0xa95: 0x0008, 0xa96: 0xe00d, 0xa97: 0x0008, - 0xa98: 0xe00d, 0xa99: 0x0008, 0xa9a: 0xe00d, 0xa9b: 0x0008, 0xa9c: 0xe00d, 0xa9d: 0x0008, - 0xa9e: 0xe00d, 0xa9f: 0x0008, 0xaa0: 0xe00d, 0xaa1: 0x0008, 0xaa2: 0xe00d, 0xaa3: 0x0008, - 0xaa4: 0xe00d, 0xaa5: 0x0008, 0xaa6: 0xe00d, 0xaa7: 0x0008, 0xaa8: 0xe00d, 0xaa9: 0x0008, - 0xaaa: 0xe00d, 0xaab: 0x0008, 0xaac: 0xe00d, 0xaad: 0x0008, 0xaae: 0xe00d, 0xaaf: 0x0008, - 0xab0: 0xe00d, 0xab1: 0x0008, 0xab2: 0xe00d, 0xab3: 0x0008, 0xab4: 0xe00d, 0xab5: 0x0008, - 0xab6: 0xe00d, 0xab7: 0x0008, 0xab8: 0xe00d, 0xab9: 0x0008, 0xaba: 0xe00d, 0xabb: 0x0008, - 0xabc: 0xe00d, 0xabd: 0x0008, 0xabe: 0xe00d, 0xabf: 0x0008, - // Block 0x2b, offset 0xac0 - 0xac0: 0xe00d, 0xac1: 0x0008, 0xac2: 0xe00d, 0xac3: 0x0008, 0xac4: 0xe00d, 0xac5: 0x0008, - 0xac6: 0xe00d, 0xac7: 0x0008, 0xac8: 0xe00d, 0xac9: 0x0008, 0xaca: 0xe00d, 0xacb: 0x0008, - 0xacc: 0xe00d, 0xacd: 0x0008, 0xace: 0xe00d, 0xacf: 0x0008, 0xad0: 0xe00d, 0xad1: 0x0008, - 0xad2: 0xe00d, 0xad3: 0x0008, 0xad4: 0xe00d, 0xad5: 0x0008, 0xad6: 0x0008, 0xad7: 0x0008, - 0xad8: 0x0008, 0xad9: 0x0008, 0xada: 0x062d, 0xadb: 0x064d, 0xadc: 0x0008, 0xadd: 0x0008, - 0xade: 0x1441, 0xadf: 0x0008, 0xae0: 0xe00d, 0xae1: 0x0008, 0xae2: 0xe00d, 0xae3: 0x0008, - 0xae4: 0xe00d, 0xae5: 0x0008, 0xae6: 0xe00d, 0xae7: 0x0008, 0xae8: 0xe00d, 0xae9: 0x0008, - 0xaea: 0xe00d, 0xaeb: 0x0008, 0xaec: 0xe00d, 0xaed: 0x0008, 0xaee: 0xe00d, 0xaef: 0x0008, - 0xaf0: 0xe00d, 0xaf1: 0x0008, 0xaf2: 0xe00d, 0xaf3: 0x0008, 0xaf4: 0xe00d, 0xaf5: 0x0008, - 0xaf6: 0xe00d, 0xaf7: 0x0008, 0xaf8: 0xe00d, 0xaf9: 0x0008, 0xafa: 0xe00d, 0xafb: 0x0008, - 0xafc: 0xe00d, 0xafd: 0x0008, 0xafe: 0xe00d, 0xaff: 0x0008, - // Block 0x2c, offset 0xb00 - 0xb00: 0x0008, 0xb01: 0x0008, 0xb02: 0x0008, 0xb03: 0x0008, 0xb04: 0x0008, 0xb05: 0x0008, - 0xb06: 0x0040, 0xb07: 0x0040, 0xb08: 0xe045, 0xb09: 0xe045, 0xb0a: 0xe045, 0xb0b: 0xe045, - 0xb0c: 0xe045, 0xb0d: 0xe045, 0xb0e: 0x0040, 0xb0f: 0x0040, 0xb10: 0x0008, 0xb11: 0x0008, - 0xb12: 0x0008, 0xb13: 0x0008, 0xb14: 0x0008, 0xb15: 0x0008, 0xb16: 0x0008, 0xb17: 0x0008, - 0xb18: 0x0040, 0xb19: 0xe045, 0xb1a: 0x0040, 0xb1b: 0xe045, 0xb1c: 0x0040, 0xb1d: 0xe045, - 0xb1e: 0x0040, 0xb1f: 0xe045, 0xb20: 0x0008, 0xb21: 0x0008, 0xb22: 0x0008, 0xb23: 0x0008, - 0xb24: 0x0008, 0xb25: 0x0008, 0xb26: 0x0008, 0xb27: 0x0008, 0xb28: 0xe045, 0xb29: 0xe045, - 0xb2a: 0xe045, 0xb2b: 0xe045, 0xb2c: 0xe045, 0xb2d: 0xe045, 0xb2e: 0xe045, 0xb2f: 0xe045, - 0xb30: 0x0008, 0xb31: 0x1459, 0xb32: 0x0008, 0xb33: 0x1471, 0xb34: 0x0008, 0xb35: 0x1489, - 0xb36: 0x0008, 0xb37: 0x14a1, 0xb38: 0x0008, 0xb39: 0x14b9, 0xb3a: 0x0008, 0xb3b: 0x14d1, - 0xb3c: 0x0008, 0xb3d: 0x14e9, 0xb3e: 0x0040, 0xb3f: 0x0040, - // Block 0x2d, offset 0xb40 - 0xb40: 0x1501, 0xb41: 0x1531, 0xb42: 0x1561, 0xb43: 0x1591, 0xb44: 0x15c1, 0xb45: 0x15f1, - 0xb46: 0x1621, 0xb47: 0x1651, 0xb48: 0x1501, 0xb49: 0x1531, 0xb4a: 0x1561, 0xb4b: 0x1591, - 0xb4c: 0x15c1, 0xb4d: 0x15f1, 0xb4e: 0x1621, 0xb4f: 0x1651, 0xb50: 0x1681, 0xb51: 0x16b1, - 0xb52: 0x16e1, 0xb53: 0x1711, 0xb54: 0x1741, 0xb55: 0x1771, 0xb56: 0x17a1, 0xb57: 0x17d1, - 0xb58: 0x1681, 0xb59: 0x16b1, 0xb5a: 0x16e1, 0xb5b: 0x1711, 0xb5c: 0x1741, 0xb5d: 0x1771, - 0xb5e: 0x17a1, 0xb5f: 0x17d1, 0xb60: 0x1801, 0xb61: 0x1831, 0xb62: 0x1861, 0xb63: 0x1891, - 0xb64: 0x18c1, 0xb65: 0x18f1, 0xb66: 0x1921, 0xb67: 0x1951, 0xb68: 0x1801, 0xb69: 0x1831, - 0xb6a: 0x1861, 0xb6b: 0x1891, 0xb6c: 0x18c1, 0xb6d: 0x18f1, 0xb6e: 0x1921, 0xb6f: 0x1951, - 0xb70: 0x0008, 0xb71: 0x0008, 0xb72: 0x1981, 0xb73: 0x19b1, 0xb74: 0x19d9, 0xb75: 0x0040, - 0xb76: 0x0008, 0xb77: 0x1a01, 0xb78: 0xe045, 0xb79: 0xe045, 0xb7a: 0x0665, 0xb7b: 0x1459, - 0xb7c: 0x19b1, 0xb7d: 0x067e, 0xb7e: 0x1a31, 0xb7f: 0x069e, - // Block 0x2e, offset 0xb80 - 0xb80: 0x06be, 0xb81: 0x1a4a, 0xb82: 0x1a79, 0xb83: 0x1aa9, 0xb84: 0x1ad1, 0xb85: 0x0040, - 0xb86: 0x0008, 0xb87: 0x1af9, 0xb88: 0x06dd, 0xb89: 0x1471, 0xb8a: 0x06f5, 0xb8b: 0x1489, - 0xb8c: 0x1aa9, 0xb8d: 0x1b2a, 0xb8e: 0x1b5a, 0xb8f: 0x1b8a, 0xb90: 0x0008, 0xb91: 0x0008, - 0xb92: 0x0008, 0xb93: 0x1bb9, 0xb94: 0x0040, 0xb95: 0x0040, 0xb96: 0x0008, 0xb97: 0x0008, - 0xb98: 0xe045, 0xb99: 0xe045, 0xb9a: 0x070d, 0xb9b: 0x14a1, 0xb9c: 0x0040, 0xb9d: 0x1bd2, - 0xb9e: 0x1c02, 0xb9f: 0x1c32, 0xba0: 0x0008, 0xba1: 0x0008, 0xba2: 0x0008, 0xba3: 0x1c61, - 0xba4: 0x0008, 0xba5: 0x0008, 0xba6: 0x0008, 0xba7: 0x0008, 0xba8: 0xe045, 0xba9: 0xe045, - 0xbaa: 0x0725, 0xbab: 0x14d1, 0xbac: 0xe04d, 0xbad: 0x1c7a, 0xbae: 0x03d2, 0xbaf: 0x1caa, - 0xbb0: 0x0040, 0xbb1: 0x0040, 0xbb2: 0x1cb9, 0xbb3: 0x1ce9, 0xbb4: 0x1d11, 0xbb5: 0x0040, - 0xbb6: 0x0008, 0xbb7: 0x1d39, 0xbb8: 0x073d, 0xbb9: 0x14b9, 0xbba: 0x0515, 0xbbb: 0x14e9, - 0xbbc: 0x1ce9, 0xbbd: 0x0756, 0xbbe: 0x0776, 0xbbf: 0x0040, - // Block 0x2f, offset 0xbc0 - 0xbc0: 0x000a, 0xbc1: 0x000a, 0xbc2: 0x000a, 0xbc3: 0x000a, 0xbc4: 0x000a, 0xbc5: 0x000a, - 0xbc6: 0x000a, 0xbc7: 0x000a, 0xbc8: 0x000a, 0xbc9: 0x000a, 0xbca: 0x000a, 0xbcb: 0x03c0, - 0xbcc: 0x0003, 0xbcd: 0x0003, 0xbce: 0x0340, 0xbcf: 0x0b40, 0xbd0: 0x0018, 0xbd1: 0xe00d, - 0xbd2: 0x0018, 0xbd3: 0x0018, 0xbd4: 0x0018, 0xbd5: 0x0018, 0xbd6: 0x0018, 0xbd7: 0x0796, - 0xbd8: 0x0018, 0xbd9: 0x0018, 0xbda: 0x0018, 0xbdb: 0x0018, 0xbdc: 0x0018, 0xbdd: 0x0018, - 0xbde: 0x0018, 0xbdf: 0x0018, 0xbe0: 0x0018, 0xbe1: 0x0018, 0xbe2: 0x0018, 0xbe3: 0x0018, - 0xbe4: 0x0040, 0xbe5: 0x0040, 0xbe6: 0x0040, 0xbe7: 0x0018, 0xbe8: 0x0040, 0xbe9: 0x0040, - 0xbea: 0x0340, 0xbeb: 0x0340, 0xbec: 0x0340, 0xbed: 0x0340, 0xbee: 0x0340, 0xbef: 0x000a, - 0xbf0: 0x0018, 0xbf1: 0x0018, 0xbf2: 0x0018, 0xbf3: 0x1d69, 0xbf4: 0x1da1, 0xbf5: 0x0018, - 0xbf6: 0x1df1, 0xbf7: 0x1e29, 0xbf8: 0x0018, 0xbf9: 0x0018, 0xbfa: 0x0018, 0xbfb: 0x0018, - 0xbfc: 0x1e7a, 0xbfd: 0x0018, 0xbfe: 0x07b6, 0xbff: 0x0018, - // Block 0x30, offset 0xc00 - 0xc00: 0x0018, 0xc01: 0x0018, 0xc02: 0x0018, 0xc03: 0x0018, 0xc04: 0x0018, 0xc05: 0x0018, - 0xc06: 0x0018, 0xc07: 0x1e92, 0xc08: 0x1eaa, 0xc09: 0x1ec2, 0xc0a: 0x0018, 0xc0b: 0x0018, - 0xc0c: 0x0018, 0xc0d: 0x0018, 0xc0e: 0x0018, 0xc0f: 0x0018, 0xc10: 0x0018, 0xc11: 0x0018, - 0xc12: 0x0018, 0xc13: 0x0018, 0xc14: 0x0018, 0xc15: 0x0018, 0xc16: 0x0018, 0xc17: 0x1ed9, - 0xc18: 0x0018, 0xc19: 0x0018, 0xc1a: 0x0018, 0xc1b: 0x0018, 0xc1c: 0x0018, 0xc1d: 0x0018, - 0xc1e: 0x0018, 0xc1f: 0x000a, 0xc20: 0x03c0, 0xc21: 0x0340, 0xc22: 0x0340, 0xc23: 0x0340, - 0xc24: 0x03c0, 0xc25: 0x0040, 0xc26: 0x0040, 0xc27: 0x0040, 0xc28: 0x0040, 0xc29: 0x0040, - 0xc2a: 0x0340, 0xc2b: 0x0340, 0xc2c: 0x0340, 0xc2d: 0x0340, 0xc2e: 0x0340, 0xc2f: 0x0340, - 0xc30: 0x1f41, 0xc31: 0x0f41, 0xc32: 0x0040, 0xc33: 0x0040, 0xc34: 0x1f51, 0xc35: 0x1f61, - 0xc36: 0x1f71, 0xc37: 0x1f81, 0xc38: 0x1f91, 0xc39: 0x1fa1, 0xc3a: 0x1fb2, 0xc3b: 0x07d5, - 0xc3c: 0x1fc2, 0xc3d: 0x1fd2, 0xc3e: 0x1fe2, 0xc3f: 0x0f71, - // Block 0x31, offset 0xc40 - 0xc40: 0x1f41, 0xc41: 0x00c9, 0xc42: 0x0069, 0xc43: 0x0079, 0xc44: 0x1f51, 0xc45: 0x1f61, - 0xc46: 0x1f71, 0xc47: 0x1f81, 0xc48: 0x1f91, 0xc49: 0x1fa1, 0xc4a: 0x1fb2, 0xc4b: 0x07ed, - 0xc4c: 0x1fc2, 0xc4d: 0x1fd2, 0xc4e: 0x1fe2, 0xc4f: 0x0040, 0xc50: 0x0039, 0xc51: 0x0f09, - 0xc52: 0x00d9, 0xc53: 0x0369, 0xc54: 0x0ff9, 0xc55: 0x0249, 0xc56: 0x0f51, 0xc57: 0x0359, - 0xc58: 0x0f61, 0xc59: 0x0f71, 0xc5a: 0x0f99, 0xc5b: 0x01d9, 0xc5c: 0x0fa9, 0xc5d: 0x0040, - 0xc5e: 0x0040, 0xc5f: 0x0040, 0xc60: 0x0018, 0xc61: 0x0018, 0xc62: 0x0018, 0xc63: 0x0018, - 0xc64: 0x0018, 0xc65: 0x0018, 0xc66: 0x0018, 0xc67: 0x0018, 0xc68: 0x1ff1, 0xc69: 0x0018, - 0xc6a: 0x0018, 0xc6b: 0x0018, 0xc6c: 0x0018, 0xc6d: 0x0018, 0xc6e: 0x0018, 0xc6f: 0x0018, - 0xc70: 0x0018, 0xc71: 0x0018, 0xc72: 0x0018, 0xc73: 0x0018, 0xc74: 0x0018, 0xc75: 0x0018, - 0xc76: 0x0018, 0xc77: 0x0018, 0xc78: 0x0018, 0xc79: 0x0018, 0xc7a: 0x0018, 0xc7b: 0x0018, - 0xc7c: 0x0018, 0xc7d: 0x0018, 0xc7e: 0x0018, 0xc7f: 0x0018, - // Block 0x32, offset 0xc80 - 0xc80: 0x0806, 0xc81: 0x0826, 0xc82: 0x1159, 0xc83: 0x0845, 0xc84: 0x0018, 0xc85: 0x0866, - 0xc86: 0x0886, 0xc87: 0x1011, 0xc88: 0x0018, 0xc89: 0x08a5, 0xc8a: 0x0f31, 0xc8b: 0x0249, - 0xc8c: 0x0249, 0xc8d: 0x0249, 0xc8e: 0x0249, 0xc8f: 0x2009, 0xc90: 0x0f41, 0xc91: 0x0f41, - 0xc92: 0x0359, 0xc93: 0x0359, 0xc94: 0x0018, 0xc95: 0x0f71, 0xc96: 0x2021, 0xc97: 0x0018, - 0xc98: 0x0018, 0xc99: 0x0f99, 0xc9a: 0x2039, 0xc9b: 0x0269, 0xc9c: 0x0269, 0xc9d: 0x0269, - 0xc9e: 0x0018, 0xc9f: 0x0018, 0xca0: 0x2049, 0xca1: 0x08c5, 0xca2: 0x2061, 0xca3: 0x0018, - 0xca4: 0x13d1, 0xca5: 0x0018, 0xca6: 0x2079, 0xca7: 0x0018, 0xca8: 0x13d1, 0xca9: 0x0018, - 0xcaa: 0x0f51, 0xcab: 0x2091, 0xcac: 0x0ee9, 0xcad: 0x1159, 0xcae: 0x0018, 0xcaf: 0x0f09, - 0xcb0: 0x0f09, 0xcb1: 0x1199, 0xcb2: 0x0040, 0xcb3: 0x0f61, 0xcb4: 0x00d9, 0xcb5: 0x20a9, - 0xcb6: 0x20c1, 0xcb7: 0x20d9, 0xcb8: 0x20f1, 0xcb9: 0x0f41, 0xcba: 0x0018, 0xcbb: 0x08e5, - 0xcbc: 0x2109, 0xcbd: 0x10b1, 0xcbe: 0x10b1, 0xcbf: 0x2109, - // Block 0x33, offset 0xcc0 - 0xcc0: 0x0905, 0xcc1: 0x0018, 0xcc2: 0x0018, 0xcc3: 0x0018, 0xcc4: 0x0018, 0xcc5: 0x0ef9, - 0xcc6: 0x0ef9, 0xcc7: 0x0f09, 0xcc8: 0x0f41, 0xcc9: 0x0259, 0xcca: 0x0018, 0xccb: 0x0018, - 0xccc: 0x0018, 0xccd: 0x0018, 0xcce: 0x0008, 0xccf: 0x0018, 0xcd0: 0x2121, 0xcd1: 0x2151, - 0xcd2: 0x2181, 0xcd3: 0x21b9, 0xcd4: 0x21e9, 0xcd5: 0x2219, 0xcd6: 0x2249, 0xcd7: 0x2279, - 0xcd8: 0x22a9, 0xcd9: 0x22d9, 0xcda: 0x2309, 0xcdb: 0x2339, 0xcdc: 0x2369, 0xcdd: 0x2399, - 0xcde: 0x23c9, 0xcdf: 0x23f9, 0xce0: 0x0f41, 0xce1: 0x2421, 0xce2: 0x091d, 0xce3: 0x2439, - 0xce4: 0x1089, 0xce5: 0x2451, 0xce6: 0x093d, 0xce7: 0x2469, 0xce8: 0x2491, 0xce9: 0x0369, - 0xcea: 0x24a9, 0xceb: 0x095d, 0xcec: 0x0359, 0xced: 0x1159, 0xcee: 0x0ef9, 0xcef: 0x0f61, - 0xcf0: 0x0f41, 0xcf1: 0x2421, 0xcf2: 0x097d, 0xcf3: 0x2439, 0xcf4: 0x1089, 0xcf5: 0x2451, - 0xcf6: 0x099d, 0xcf7: 0x2469, 0xcf8: 0x2491, 0xcf9: 0x0369, 0xcfa: 0x24a9, 0xcfb: 0x09bd, - 0xcfc: 0x0359, 0xcfd: 0x1159, 0xcfe: 0x0ef9, 0xcff: 0x0f61, - // Block 0x34, offset 0xd00 - 0xd00: 0x0018, 0xd01: 0x0018, 0xd02: 0x0018, 0xd03: 0x0018, 0xd04: 0x0018, 0xd05: 0x0018, - 0xd06: 0x0018, 0xd07: 0x0018, 0xd08: 0x0018, 0xd09: 0x0018, 0xd0a: 0x0018, 0xd0b: 0x0040, - 0xd0c: 0x0040, 0xd0d: 0x0040, 0xd0e: 0x0040, 0xd0f: 0x0040, 0xd10: 0x0040, 0xd11: 0x0040, - 0xd12: 0x0040, 0xd13: 0x0040, 0xd14: 0x0040, 0xd15: 0x0040, 0xd16: 0x0040, 0xd17: 0x0040, - 0xd18: 0x0040, 0xd19: 0x0040, 0xd1a: 0x0040, 0xd1b: 0x0040, 0xd1c: 0x0040, 0xd1d: 0x0040, - 0xd1e: 0x0040, 0xd1f: 0x0040, 0xd20: 0x00c9, 0xd21: 0x0069, 0xd22: 0x0079, 0xd23: 0x1f51, - 0xd24: 0x1f61, 0xd25: 0x1f71, 0xd26: 0x1f81, 0xd27: 0x1f91, 0xd28: 0x1fa1, 0xd29: 0x2601, - 0xd2a: 0x2619, 0xd2b: 0x2631, 0xd2c: 0x2649, 0xd2d: 0x2661, 0xd2e: 0x2679, 0xd2f: 0x2691, - 0xd30: 0x26a9, 0xd31: 0x26c1, 0xd32: 0x26d9, 0xd33: 0x26f1, 0xd34: 0x0a1e, 0xd35: 0x0a3e, - 0xd36: 0x0a5e, 0xd37: 0x0a7e, 0xd38: 0x0a9e, 0xd39: 0x0abe, 0xd3a: 0x0ade, 0xd3b: 0x0afe, - 0xd3c: 0x0b1e, 0xd3d: 0x270a, 0xd3e: 0x2732, 0xd3f: 0x275a, - // Block 0x35, offset 0xd40 - 0xd40: 0x2782, 0xd41: 0x27aa, 0xd42: 0x27d2, 0xd43: 0x27fa, 0xd44: 0x2822, 0xd45: 0x284a, - 0xd46: 0x2872, 0xd47: 0x289a, 0xd48: 0x0040, 0xd49: 0x0040, 0xd4a: 0x0040, 0xd4b: 0x0040, - 0xd4c: 0x0040, 0xd4d: 0x0040, 0xd4e: 0x0040, 0xd4f: 0x0040, 0xd50: 0x0040, 0xd51: 0x0040, - 0xd52: 0x0040, 0xd53: 0x0040, 0xd54: 0x0040, 0xd55: 0x0040, 0xd56: 0x0040, 0xd57: 0x0040, - 0xd58: 0x0040, 0xd59: 0x0040, 0xd5a: 0x0040, 0xd5b: 0x0040, 0xd5c: 0x0b3e, 0xd5d: 0x0b5e, - 0xd5e: 0x0b7e, 0xd5f: 0x0b9e, 0xd60: 0x0bbe, 0xd61: 0x0bde, 0xd62: 0x0bfe, 0xd63: 0x0c1e, - 0xd64: 0x0c3e, 0xd65: 0x0c5e, 0xd66: 0x0c7e, 0xd67: 0x0c9e, 0xd68: 0x0cbe, 0xd69: 0x0cde, - 0xd6a: 0x0cfe, 0xd6b: 0x0d1e, 0xd6c: 0x0d3e, 0xd6d: 0x0d5e, 0xd6e: 0x0d7e, 0xd6f: 0x0d9e, - 0xd70: 0x0dbe, 0xd71: 0x0dde, 0xd72: 0x0dfe, 0xd73: 0x0e1e, 0xd74: 0x0e3e, 0xd75: 0x0e5e, - 0xd76: 0x0039, 0xd77: 0x0ee9, 0xd78: 0x1159, 0xd79: 0x0ef9, 0xd7a: 0x0f09, 0xd7b: 0x1199, - 0xd7c: 0x0f31, 0xd7d: 0x0249, 0xd7e: 0x0f41, 0xd7f: 0x0259, - // Block 0x36, offset 0xd80 - 0xd80: 0x0f51, 0xd81: 0x0359, 0xd82: 0x0f61, 0xd83: 0x0f71, 0xd84: 0x00d9, 0xd85: 0x0f99, - 0xd86: 0x2039, 0xd87: 0x0269, 0xd88: 0x01d9, 0xd89: 0x0fa9, 0xd8a: 0x0fb9, 0xd8b: 0x1089, - 0xd8c: 0x0279, 0xd8d: 0x0369, 0xd8e: 0x0289, 0xd8f: 0x13d1, 0xd90: 0x0039, 0xd91: 0x0ee9, - 0xd92: 0x1159, 0xd93: 0x0ef9, 0xd94: 0x0f09, 0xd95: 0x1199, 0xd96: 0x0f31, 0xd97: 0x0249, - 0xd98: 0x0f41, 0xd99: 0x0259, 0xd9a: 0x0f51, 0xd9b: 0x0359, 0xd9c: 0x0f61, 0xd9d: 0x0f71, - 0xd9e: 0x00d9, 0xd9f: 0x0f99, 0xda0: 0x2039, 0xda1: 0x0269, 0xda2: 0x01d9, 0xda3: 0x0fa9, - 0xda4: 0x0fb9, 0xda5: 0x1089, 0xda6: 0x0279, 0xda7: 0x0369, 0xda8: 0x0289, 0xda9: 0x13d1, - 0xdaa: 0x1f41, 0xdab: 0x0018, 0xdac: 0x0018, 0xdad: 0x0018, 0xdae: 0x0018, 0xdaf: 0x0018, - 0xdb0: 0x0018, 0xdb1: 0x0018, 0xdb2: 0x0018, 0xdb3: 0x0018, 0xdb4: 0x0018, 0xdb5: 0x0018, - 0xdb6: 0x0018, 0xdb7: 0x0018, 0xdb8: 0x0018, 0xdb9: 0x0018, 0xdba: 0x0018, 0xdbb: 0x0018, - 0xdbc: 0x0018, 0xdbd: 0x0018, 0xdbe: 0x0018, 0xdbf: 0x0018, - // Block 0x37, offset 0xdc0 - 0xdc0: 0x0008, 0xdc1: 0x0008, 0xdc2: 0x0008, 0xdc3: 0x0008, 0xdc4: 0x0008, 0xdc5: 0x0008, - 0xdc6: 0x0008, 0xdc7: 0x0008, 0xdc8: 0x0008, 0xdc9: 0x0008, 0xdca: 0x0008, 0xdcb: 0x0008, - 0xdcc: 0x0008, 0xdcd: 0x0008, 0xdce: 0x0008, 0xdcf: 0x0008, 0xdd0: 0x0008, 0xdd1: 0x0008, - 0xdd2: 0x0008, 0xdd3: 0x0008, 0xdd4: 0x0008, 0xdd5: 0x0008, 0xdd6: 0x0008, 0xdd7: 0x0008, - 0xdd8: 0x0008, 0xdd9: 0x0008, 0xdda: 0x0008, 0xddb: 0x0008, 0xddc: 0x0008, 0xddd: 0x0008, - 0xdde: 0x0008, 0xddf: 0x0040, 0xde0: 0xe00d, 0xde1: 0x0008, 0xde2: 0x2971, 0xde3: 0x0ed5, - 0xde4: 0x2989, 0xde5: 0x0008, 0xde6: 0x0008, 0xde7: 0xe07d, 0xde8: 0x0008, 0xde9: 0xe01d, - 0xdea: 0x0008, 0xdeb: 0xe03d, 0xdec: 0x0008, 0xded: 0x0fe1, 0xdee: 0x1281, 0xdef: 0x0fc9, - 0xdf0: 0x1141, 0xdf1: 0x0008, 0xdf2: 0xe00d, 0xdf3: 0x0008, 0xdf4: 0x0008, 0xdf5: 0xe01d, - 0xdf6: 0x0008, 0xdf7: 0x0008, 0xdf8: 0x0008, 0xdf9: 0x0008, 0xdfa: 0x0008, 0xdfb: 0x0008, - 0xdfc: 0x0259, 0xdfd: 0x1089, 0xdfe: 0x29a1, 0xdff: 0x29b9, - // Block 0x38, offset 0xe00 - 0xe00: 0xe00d, 0xe01: 0x0008, 0xe02: 0xe00d, 0xe03: 0x0008, 0xe04: 0xe00d, 0xe05: 0x0008, - 0xe06: 0xe00d, 0xe07: 0x0008, 0xe08: 0xe00d, 0xe09: 0x0008, 0xe0a: 0xe00d, 0xe0b: 0x0008, - 0xe0c: 0xe00d, 0xe0d: 0x0008, 0xe0e: 0xe00d, 0xe0f: 0x0008, 0xe10: 0xe00d, 0xe11: 0x0008, - 0xe12: 0xe00d, 0xe13: 0x0008, 0xe14: 0xe00d, 0xe15: 0x0008, 0xe16: 0xe00d, 0xe17: 0x0008, - 0xe18: 0xe00d, 0xe19: 0x0008, 0xe1a: 0xe00d, 0xe1b: 0x0008, 0xe1c: 0xe00d, 0xe1d: 0x0008, - 0xe1e: 0xe00d, 0xe1f: 0x0008, 0xe20: 0xe00d, 0xe21: 0x0008, 0xe22: 0xe00d, 0xe23: 0x0008, - 0xe24: 0x0008, 0xe25: 0x0018, 0xe26: 0x0018, 0xe27: 0x0018, 0xe28: 0x0018, 0xe29: 0x0018, - 0xe2a: 0x0018, 0xe2b: 0xe03d, 0xe2c: 0x0008, 0xe2d: 0xe01d, 0xe2e: 0x0008, 0xe2f: 0x3308, - 0xe30: 0x3308, 0xe31: 0x3308, 0xe32: 0xe00d, 0xe33: 0x0008, 0xe34: 0x0040, 0xe35: 0x0040, - 0xe36: 0x0040, 0xe37: 0x0040, 0xe38: 0x0040, 0xe39: 0x0018, 0xe3a: 0x0018, 0xe3b: 0x0018, - 0xe3c: 0x0018, 0xe3d: 0x0018, 0xe3e: 0x0018, 0xe3f: 0x0018, - // Block 0x39, offset 0xe40 - 0xe40: 0x2715, 0xe41: 0x2735, 0xe42: 0x2755, 0xe43: 0x2775, 0xe44: 0x2795, 0xe45: 0x27b5, - 0xe46: 0x27d5, 0xe47: 0x27f5, 0xe48: 0x2815, 0xe49: 0x2835, 0xe4a: 0x2855, 0xe4b: 0x2875, - 0xe4c: 0x2895, 0xe4d: 0x28b5, 0xe4e: 0x28d5, 0xe4f: 0x28f5, 0xe50: 0x2915, 0xe51: 0x2935, - 0xe52: 0x2955, 0xe53: 0x2975, 0xe54: 0x2995, 0xe55: 0x29b5, 0xe56: 0x0040, 0xe57: 0x0040, - 0xe58: 0x0040, 0xe59: 0x0040, 0xe5a: 0x0040, 0xe5b: 0x0040, 0xe5c: 0x0040, 0xe5d: 0x0040, - 0xe5e: 0x0040, 0xe5f: 0x0040, 0xe60: 0x0040, 0xe61: 0x0040, 0xe62: 0x0040, 0xe63: 0x0040, - 0xe64: 0x0040, 0xe65: 0x0040, 0xe66: 0x0040, 0xe67: 0x0040, 0xe68: 0x0040, 0xe69: 0x0040, - 0xe6a: 0x0040, 0xe6b: 0x0040, 0xe6c: 0x0040, 0xe6d: 0x0040, 0xe6e: 0x0040, 0xe6f: 0x0040, - 0xe70: 0x0040, 0xe71: 0x0040, 0xe72: 0x0040, 0xe73: 0x0040, 0xe74: 0x0040, 0xe75: 0x0040, - 0xe76: 0x0040, 0xe77: 0x0040, 0xe78: 0x0040, 0xe79: 0x0040, 0xe7a: 0x0040, 0xe7b: 0x0040, - 0xe7c: 0x0040, 0xe7d: 0x0040, 0xe7e: 0x0040, 0xe7f: 0x0040, - // Block 0x3a, offset 0xe80 - 0xe80: 0x000a, 0xe81: 0x0018, 0xe82: 0x29d1, 0xe83: 0x0018, 0xe84: 0x0018, 0xe85: 0x0008, - 0xe86: 0x0008, 0xe87: 0x0008, 0xe88: 0x0018, 0xe89: 0x0018, 0xe8a: 0x0018, 0xe8b: 0x0018, - 0xe8c: 0x0018, 0xe8d: 0x0018, 0xe8e: 0x0018, 0xe8f: 0x0018, 0xe90: 0x0018, 0xe91: 0x0018, - 0xe92: 0x0018, 0xe93: 0x0018, 0xe94: 0x0018, 0xe95: 0x0018, 0xe96: 0x0018, 0xe97: 0x0018, - 0xe98: 0x0018, 0xe99: 0x0018, 0xe9a: 0x0018, 0xe9b: 0x0018, 0xe9c: 0x0018, 0xe9d: 0x0018, - 0xe9e: 0x0018, 0xe9f: 0x0018, 0xea0: 0x0018, 0xea1: 0x0018, 0xea2: 0x0018, 0xea3: 0x0018, - 0xea4: 0x0018, 0xea5: 0x0018, 0xea6: 0x0018, 0xea7: 0x0018, 0xea8: 0x0018, 0xea9: 0x0018, - 0xeaa: 0x3308, 0xeab: 0x3308, 0xeac: 0x3308, 0xead: 0x3308, 0xeae: 0x3018, 0xeaf: 0x3018, - 0xeb0: 0x0018, 0xeb1: 0x0018, 0xeb2: 0x0018, 0xeb3: 0x0018, 0xeb4: 0x0018, 0xeb5: 0x0018, - 0xeb6: 0xe125, 0xeb7: 0x0018, 0xeb8: 0x29d5, 0xeb9: 0x29f5, 0xeba: 0x2a15, 0xebb: 0x0018, - 0xebc: 0x0008, 0xebd: 0x0018, 0xebe: 0x0018, 0xebf: 0x0018, - // Block 0x3b, offset 0xec0 - 0xec0: 0x2b55, 0xec1: 0x2b75, 0xec2: 0x2b95, 0xec3: 0x2bb5, 0xec4: 0x2bd5, 0xec5: 0x2bf5, - 0xec6: 0x2bf5, 0xec7: 0x2bf5, 0xec8: 0x2c15, 0xec9: 0x2c15, 0xeca: 0x2c15, 0xecb: 0x2c15, - 0xecc: 0x2c35, 0xecd: 0x2c35, 0xece: 0x2c35, 0xecf: 0x2c55, 0xed0: 0x2c75, 0xed1: 0x2c75, - 0xed2: 0x2a95, 0xed3: 0x2a95, 0xed4: 0x2c75, 0xed5: 0x2c75, 0xed6: 0x2c95, 0xed7: 0x2c95, - 0xed8: 0x2c75, 0xed9: 0x2c75, 0xeda: 0x2a95, 0xedb: 0x2a95, 0xedc: 0x2c75, 0xedd: 0x2c75, - 0xede: 0x2c55, 0xedf: 0x2c55, 0xee0: 0x2cb5, 0xee1: 0x2cb5, 0xee2: 0x2cd5, 0xee3: 0x2cd5, - 0xee4: 0x0040, 0xee5: 0x2cf5, 0xee6: 0x2d15, 0xee7: 0x2d35, 0xee8: 0x2d35, 0xee9: 0x2d55, - 0xeea: 0x2d75, 0xeeb: 0x2d95, 0xeec: 0x2db5, 0xeed: 0x2dd5, 0xeee: 0x2df5, 0xeef: 0x2e15, - 0xef0: 0x2e35, 0xef1: 0x2e55, 0xef2: 0x2e55, 0xef3: 0x2e75, 0xef4: 0x2e95, 0xef5: 0x2e95, - 0xef6: 0x2eb5, 0xef7: 0x2ed5, 0xef8: 0x2e75, 0xef9: 0x2ef5, 0xefa: 0x2f15, 0xefb: 0x2ef5, - 0xefc: 0x2e75, 0xefd: 0x2f35, 0xefe: 0x2f55, 0xeff: 0x2f75, - // Block 0x3c, offset 0xf00 - 0xf00: 0x2f95, 0xf01: 0x2fb5, 0xf02: 0x2d15, 0xf03: 0x2cf5, 0xf04: 0x2fd5, 0xf05: 0x2ff5, - 0xf06: 0x3015, 0xf07: 0x3035, 0xf08: 0x3055, 0xf09: 0x3075, 0xf0a: 0x3095, 0xf0b: 0x30b5, - 0xf0c: 0x30d5, 0xf0d: 0x30f5, 0xf0e: 0x3115, 0xf0f: 0x0040, 0xf10: 0x0018, 0xf11: 0x0018, - 0xf12: 0x3135, 0xf13: 0x3155, 0xf14: 0x3175, 0xf15: 0x3195, 0xf16: 0x31b5, 0xf17: 0x31d5, - 0xf18: 0x31f5, 0xf19: 0x3215, 0xf1a: 0x3235, 0xf1b: 0x3255, 0xf1c: 0x3175, 0xf1d: 0x3275, - 0xf1e: 0x3295, 0xf1f: 0x32b5, 0xf20: 0x0008, 0xf21: 0x0008, 0xf22: 0x0008, 0xf23: 0x0008, - 0xf24: 0x0008, 0xf25: 0x0008, 0xf26: 0x0008, 0xf27: 0x0008, 0xf28: 0x0008, 0xf29: 0x0008, - 0xf2a: 0x0008, 0xf2b: 0x0008, 0xf2c: 0x0008, 0xf2d: 0x0008, 0xf2e: 0x0008, 0xf2f: 0x0008, - 0xf30: 0x0008, 0xf31: 0x0008, 0xf32: 0x0008, 0xf33: 0x0008, 0xf34: 0x0008, 0xf35: 0x0008, - 0xf36: 0x0008, 0xf37: 0x0008, 0xf38: 0x0008, 0xf39: 0x0008, 0xf3a: 0x0008, 0xf3b: 0x0040, - 0xf3c: 0x0040, 0xf3d: 0x0040, 0xf3e: 0x0040, 0xf3f: 0x0040, - // Block 0x3d, offset 0xf40 - 0xf40: 0x36a2, 0xf41: 0x36d2, 0xf42: 0x3702, 0xf43: 0x3732, 0xf44: 0x32d5, 0xf45: 0x32f5, - 0xf46: 0x3315, 0xf47: 0x3335, 0xf48: 0x0018, 0xf49: 0x0018, 0xf4a: 0x0018, 0xf4b: 0x0018, - 0xf4c: 0x0018, 0xf4d: 0x0018, 0xf4e: 0x0018, 0xf4f: 0x0018, 0xf50: 0x3355, 0xf51: 0x3761, - 0xf52: 0x3779, 0xf53: 0x3791, 0xf54: 0x37a9, 0xf55: 0x37c1, 0xf56: 0x37d9, 0xf57: 0x37f1, - 0xf58: 0x3809, 0xf59: 0x3821, 0xf5a: 0x3839, 0xf5b: 0x3851, 0xf5c: 0x3869, 0xf5d: 0x3881, - 0xf5e: 0x3899, 0xf5f: 0x38b1, 0xf60: 0x3375, 0xf61: 0x3395, 0xf62: 0x33b5, 0xf63: 0x33d5, - 0xf64: 0x33f5, 0xf65: 0x33f5, 0xf66: 0x3415, 0xf67: 0x3435, 0xf68: 0x3455, 0xf69: 0x3475, - 0xf6a: 0x3495, 0xf6b: 0x34b5, 0xf6c: 0x34d5, 0xf6d: 0x34f5, 0xf6e: 0x3515, 0xf6f: 0x3535, - 0xf70: 0x3555, 0xf71: 0x3575, 0xf72: 0x3595, 0xf73: 0x35b5, 0xf74: 0x35d5, 0xf75: 0x35f5, - 0xf76: 0x3615, 0xf77: 0x3635, 0xf78: 0x3655, 0xf79: 0x3675, 0xf7a: 0x3695, 0xf7b: 0x36b5, - 0xf7c: 0x38c9, 0xf7d: 0x3901, 0xf7e: 0x36d5, 0xf7f: 0x0018, - // Block 0x3e, offset 0xf80 - 0xf80: 0x36f5, 0xf81: 0x3715, 0xf82: 0x3735, 0xf83: 0x3755, 0xf84: 0x3775, 0xf85: 0x3795, - 0xf86: 0x37b5, 0xf87: 0x37d5, 0xf88: 0x37f5, 0xf89: 0x3815, 0xf8a: 0x3835, 0xf8b: 0x3855, - 0xf8c: 0x3875, 0xf8d: 0x3895, 0xf8e: 0x38b5, 0xf8f: 0x38d5, 0xf90: 0x38f5, 0xf91: 0x3915, - 0xf92: 0x3935, 0xf93: 0x3955, 0xf94: 0x3975, 0xf95: 0x3995, 0xf96: 0x39b5, 0xf97: 0x39d5, - 0xf98: 0x39f5, 0xf99: 0x3a15, 0xf9a: 0x3a35, 0xf9b: 0x3a55, 0xf9c: 0x3a75, 0xf9d: 0x3a95, - 0xf9e: 0x3ab5, 0xf9f: 0x3ad5, 0xfa0: 0x3af5, 0xfa1: 0x3b15, 0xfa2: 0x3b35, 0xfa3: 0x3b55, - 0xfa4: 0x3b75, 0xfa5: 0x3b95, 0xfa6: 0x1295, 0xfa7: 0x3bb5, 0xfa8: 0x3bd5, 0xfa9: 0x3bf5, - 0xfaa: 0x3c15, 0xfab: 0x3c35, 0xfac: 0x3c55, 0xfad: 0x3c75, 0xfae: 0x23b5, 0xfaf: 0x3c95, - 0xfb0: 0x3cb5, 0xfb1: 0x3939, 0xfb2: 0x3951, 0xfb3: 0x3969, 0xfb4: 0x3981, 0xfb5: 0x3999, - 0xfb6: 0x39b1, 0xfb7: 0x39c9, 0xfb8: 0x39e1, 0xfb9: 0x39f9, 0xfba: 0x3a11, 0xfbb: 0x3a29, - 0xfbc: 0x3a41, 0xfbd: 0x3a59, 0xfbe: 0x3a71, 0xfbf: 0x3a89, - // Block 0x3f, offset 0xfc0 - 0xfc0: 0x3aa1, 0xfc1: 0x3ac9, 0xfc2: 0x3af1, 0xfc3: 0x3b19, 0xfc4: 0x3b41, 0xfc5: 0x3b69, - 0xfc6: 0x3b91, 0xfc7: 0x3bb9, 0xfc8: 0x3be1, 0xfc9: 0x3c09, 0xfca: 0x3c39, 0xfcb: 0x3c69, - 0xfcc: 0x3c99, 0xfcd: 0x3cd5, 0xfce: 0x3cb1, 0xfcf: 0x3cf5, 0xfd0: 0x3d15, 0xfd1: 0x3d2d, - 0xfd2: 0x3d45, 0xfd3: 0x3d5d, 0xfd4: 0x3d75, 0xfd5: 0x3d75, 0xfd6: 0x3d5d, 0xfd7: 0x3d8d, - 0xfd8: 0x07d5, 0xfd9: 0x3da5, 0xfda: 0x3dbd, 0xfdb: 0x3dd5, 0xfdc: 0x3ded, 0xfdd: 0x3e05, - 0xfde: 0x3e1d, 0xfdf: 0x3e35, 0xfe0: 0x3e4d, 0xfe1: 0x3e65, 0xfe2: 0x3e7d, 0xfe3: 0x3e95, - 0xfe4: 0x3ead, 0xfe5: 0x3ead, 0xfe6: 0x3ec5, 0xfe7: 0x3ec5, 0xfe8: 0x3edd, 0xfe9: 0x3edd, - 0xfea: 0x3ef5, 0xfeb: 0x3f0d, 0xfec: 0x3f25, 0xfed: 0x3f3d, 0xfee: 0x3f55, 0xfef: 0x3f55, - 0xff0: 0x3f6d, 0xff1: 0x3f6d, 0xff2: 0x3f6d, 0xff3: 0x3f85, 0xff4: 0x3f9d, 0xff5: 0x3fb5, - 0xff6: 0x3fcd, 0xff7: 0x3fb5, 0xff8: 0x3fe5, 0xff9: 0x3ffd, 0xffa: 0x3f85, 0xffb: 0x4015, - 0xffc: 0x402d, 0xffd: 0x402d, 0xffe: 0x402d, 0xfff: 0x0040, - // Block 0x40, offset 0x1000 - 0x1000: 0x3cc9, 0x1001: 0x3d31, 0x1002: 0x3d99, 0x1003: 0x3e01, 0x1004: 0x3e51, 0x1005: 0x3eb9, - 0x1006: 0x3f09, 0x1007: 0x3f59, 0x1008: 0x3fd9, 0x1009: 0x4041, 0x100a: 0x4091, 0x100b: 0x40e1, - 0x100c: 0x4131, 0x100d: 0x4199, 0x100e: 0x4201, 0x100f: 0x4251, 0x1010: 0x42a1, 0x1011: 0x42d9, - 0x1012: 0x4329, 0x1013: 0x4391, 0x1014: 0x43f9, 0x1015: 0x4431, 0x1016: 0x44b1, 0x1017: 0x4549, - 0x1018: 0x45c9, 0x1019: 0x4619, 0x101a: 0x4699, 0x101b: 0x4719, 0x101c: 0x4781, 0x101d: 0x47d1, - 0x101e: 0x4821, 0x101f: 0x4871, 0x1020: 0x48d9, 0x1021: 0x4959, 0x1022: 0x49c1, 0x1023: 0x4a11, - 0x1024: 0x4a61, 0x1025: 0x4ab1, 0x1026: 0x4ae9, 0x1027: 0x4b21, 0x1028: 0x4b59, 0x1029: 0x4b91, - 0x102a: 0x4be1, 0x102b: 0x4c31, 0x102c: 0x4cb1, 0x102d: 0x4d01, 0x102e: 0x4d69, 0x102f: 0x4de9, - 0x1030: 0x4e39, 0x1031: 0x4e71, 0x1032: 0x4ea9, 0x1033: 0x4f29, 0x1034: 0x4f91, 0x1035: 0x5011, - 0x1036: 0x5061, 0x1037: 0x50e1, 0x1038: 0x5119, 0x1039: 0x5169, 0x103a: 0x51b9, 0x103b: 0x5209, - 0x103c: 0x5259, 0x103d: 0x52a9, 0x103e: 0x5311, 0x103f: 0x5361, - // Block 0x41, offset 0x1040 - 0x1040: 0x5399, 0x1041: 0x53e9, 0x1042: 0x5439, 0x1043: 0x5489, 0x1044: 0x54f1, 0x1045: 0x5541, - 0x1046: 0x5591, 0x1047: 0x55e1, 0x1048: 0x5661, 0x1049: 0x56c9, 0x104a: 0x5701, 0x104b: 0x5781, - 0x104c: 0x57b9, 0x104d: 0x5821, 0x104e: 0x5889, 0x104f: 0x58d9, 0x1050: 0x5929, 0x1051: 0x5979, - 0x1052: 0x59e1, 0x1053: 0x5a19, 0x1054: 0x5a69, 0x1055: 0x5ad1, 0x1056: 0x5b09, 0x1057: 0x5b89, - 0x1058: 0x5bd9, 0x1059: 0x5c01, 0x105a: 0x5c29, 0x105b: 0x5c51, 0x105c: 0x5c79, 0x105d: 0x5ca1, - 0x105e: 0x5cc9, 0x105f: 0x5cf1, 0x1060: 0x5d19, 0x1061: 0x5d41, 0x1062: 0x5d69, 0x1063: 0x5d99, - 0x1064: 0x5dc9, 0x1065: 0x5df9, 0x1066: 0x5e29, 0x1067: 0x5e59, 0x1068: 0x5e89, 0x1069: 0x5eb9, - 0x106a: 0x5ee9, 0x106b: 0x5f19, 0x106c: 0x5f49, 0x106d: 0x5f79, 0x106e: 0x5fa9, 0x106f: 0x5fd9, - 0x1070: 0x6009, 0x1071: 0x4045, 0x1072: 0x6039, 0x1073: 0x6051, 0x1074: 0x4065, 0x1075: 0x6069, - 0x1076: 0x6081, 0x1077: 0x6099, 0x1078: 0x4085, 0x1079: 0x4085, 0x107a: 0x60b1, 0x107b: 0x60c9, - 0x107c: 0x6101, 0x107d: 0x6139, 0x107e: 0x6171, 0x107f: 0x61a9, - // Block 0x42, offset 0x1080 - 0x1080: 0x6211, 0x1081: 0x6229, 0x1082: 0x40a5, 0x1083: 0x6241, 0x1084: 0x6259, 0x1085: 0x6271, - 0x1086: 0x6289, 0x1087: 0x62a1, 0x1088: 0x40c5, 0x1089: 0x62b9, 0x108a: 0x62e1, 0x108b: 0x62f9, - 0x108c: 0x40e5, 0x108d: 0x40e5, 0x108e: 0x6311, 0x108f: 0x6329, 0x1090: 0x6341, 0x1091: 0x4105, - 0x1092: 0x4125, 0x1093: 0x4145, 0x1094: 0x4165, 0x1095: 0x4185, 0x1096: 0x6359, 0x1097: 0x6371, - 0x1098: 0x6389, 0x1099: 0x63a1, 0x109a: 0x63b9, 0x109b: 0x41a5, 0x109c: 0x63d1, 0x109d: 0x63e9, - 0x109e: 0x6401, 0x109f: 0x41c5, 0x10a0: 0x41e5, 0x10a1: 0x6419, 0x10a2: 0x4205, 0x10a3: 0x4225, - 0x10a4: 0x4245, 0x10a5: 0x6431, 0x10a6: 0x4265, 0x10a7: 0x6449, 0x10a8: 0x6479, 0x10a9: 0x6211, - 0x10aa: 0x4285, 0x10ab: 0x42a5, 0x10ac: 0x42c5, 0x10ad: 0x42e5, 0x10ae: 0x64b1, 0x10af: 0x64f1, - 0x10b0: 0x6539, 0x10b1: 0x6551, 0x10b2: 0x4305, 0x10b3: 0x6569, 0x10b4: 0x6581, 0x10b5: 0x6599, - 0x10b6: 0x4325, 0x10b7: 0x65b1, 0x10b8: 0x65c9, 0x10b9: 0x65b1, 0x10ba: 0x65e1, 0x10bb: 0x65f9, - 0x10bc: 0x4345, 0x10bd: 0x6611, 0x10be: 0x6629, 0x10bf: 0x6611, - // Block 0x43, offset 0x10c0 - 0x10c0: 0x4365, 0x10c1: 0x4385, 0x10c2: 0x0040, 0x10c3: 0x6641, 0x10c4: 0x6659, 0x10c5: 0x6671, - 0x10c6: 0x6689, 0x10c7: 0x0040, 0x10c8: 0x66c1, 0x10c9: 0x66d9, 0x10ca: 0x66f1, 0x10cb: 0x6709, - 0x10cc: 0x6721, 0x10cd: 0x6739, 0x10ce: 0x6401, 0x10cf: 0x6751, 0x10d0: 0x6769, 0x10d1: 0x6781, - 0x10d2: 0x43a5, 0x10d3: 0x6799, 0x10d4: 0x6289, 0x10d5: 0x43c5, 0x10d6: 0x43e5, 0x10d7: 0x67b1, - 0x10d8: 0x0040, 0x10d9: 0x4405, 0x10da: 0x67c9, 0x10db: 0x67e1, 0x10dc: 0x67f9, 0x10dd: 0x6811, - 0x10de: 0x6829, 0x10df: 0x6859, 0x10e0: 0x6889, 0x10e1: 0x68b1, 0x10e2: 0x68d9, 0x10e3: 0x6901, - 0x10e4: 0x6929, 0x10e5: 0x6951, 0x10e6: 0x6979, 0x10e7: 0x69a1, 0x10e8: 0x69c9, 0x10e9: 0x69f1, - 0x10ea: 0x6a21, 0x10eb: 0x6a51, 0x10ec: 0x6a81, 0x10ed: 0x6ab1, 0x10ee: 0x6ae1, 0x10ef: 0x6b11, - 0x10f0: 0x6b41, 0x10f1: 0x6b71, 0x10f2: 0x6ba1, 0x10f3: 0x6bd1, 0x10f4: 0x6c01, 0x10f5: 0x6c31, - 0x10f6: 0x6c61, 0x10f7: 0x6c91, 0x10f8: 0x6cc1, 0x10f9: 0x6cf1, 0x10fa: 0x6d21, 0x10fb: 0x6d51, - 0x10fc: 0x6d81, 0x10fd: 0x6db1, 0x10fe: 0x6de1, 0x10ff: 0x4425, - // Block 0x44, offset 0x1100 - 0x1100: 0xe00d, 0x1101: 0x0008, 0x1102: 0xe00d, 0x1103: 0x0008, 0x1104: 0xe00d, 0x1105: 0x0008, - 0x1106: 0xe00d, 0x1107: 0x0008, 0x1108: 0xe00d, 0x1109: 0x0008, 0x110a: 0xe00d, 0x110b: 0x0008, - 0x110c: 0xe00d, 0x110d: 0x0008, 0x110e: 0xe00d, 0x110f: 0x0008, 0x1110: 0xe00d, 0x1111: 0x0008, - 0x1112: 0xe00d, 0x1113: 0x0008, 0x1114: 0xe00d, 0x1115: 0x0008, 0x1116: 0xe00d, 0x1117: 0x0008, - 0x1118: 0xe00d, 0x1119: 0x0008, 0x111a: 0xe00d, 0x111b: 0x0008, 0x111c: 0xe00d, 0x111d: 0x0008, - 0x111e: 0xe00d, 0x111f: 0x0008, 0x1120: 0xe00d, 0x1121: 0x0008, 0x1122: 0xe00d, 0x1123: 0x0008, - 0x1124: 0xe00d, 0x1125: 0x0008, 0x1126: 0xe00d, 0x1127: 0x0008, 0x1128: 0xe00d, 0x1129: 0x0008, - 0x112a: 0xe00d, 0x112b: 0x0008, 0x112c: 0xe00d, 0x112d: 0x0008, 0x112e: 0x0008, 0x112f: 0x3308, - 0x1130: 0x3318, 0x1131: 0x3318, 0x1132: 0x3318, 0x1133: 0x0018, 0x1134: 0x3308, 0x1135: 0x3308, - 0x1136: 0x3308, 0x1137: 0x3308, 0x1138: 0x3308, 0x1139: 0x3308, 0x113a: 0x3308, 0x113b: 0x3308, - 0x113c: 0x3308, 0x113d: 0x3308, 0x113e: 0x0018, 0x113f: 0x0008, - // Block 0x45, offset 0x1140 - 0x1140: 0xe00d, 0x1141: 0x0008, 0x1142: 0xe00d, 0x1143: 0x0008, 0x1144: 0xe00d, 0x1145: 0x0008, - 0x1146: 0xe00d, 0x1147: 0x0008, 0x1148: 0xe00d, 0x1149: 0x0008, 0x114a: 0xe00d, 0x114b: 0x0008, - 0x114c: 0xe00d, 0x114d: 0x0008, 0x114e: 0xe00d, 0x114f: 0x0008, 0x1150: 0xe00d, 0x1151: 0x0008, - 0x1152: 0xe00d, 0x1153: 0x0008, 0x1154: 0xe00d, 0x1155: 0x0008, 0x1156: 0xe00d, 0x1157: 0x0008, - 0x1158: 0xe00d, 0x1159: 0x0008, 0x115a: 0xe00d, 0x115b: 0x0008, 0x115c: 0x0ea1, 0x115d: 0x6e11, - 0x115e: 0x3308, 0x115f: 0x3308, 0x1160: 0x0008, 0x1161: 0x0008, 0x1162: 0x0008, 0x1163: 0x0008, - 0x1164: 0x0008, 0x1165: 0x0008, 0x1166: 0x0008, 0x1167: 0x0008, 0x1168: 0x0008, 0x1169: 0x0008, - 0x116a: 0x0008, 0x116b: 0x0008, 0x116c: 0x0008, 0x116d: 0x0008, 0x116e: 0x0008, 0x116f: 0x0008, - 0x1170: 0x0008, 0x1171: 0x0008, 0x1172: 0x0008, 0x1173: 0x0008, 0x1174: 0x0008, 0x1175: 0x0008, - 0x1176: 0x0008, 0x1177: 0x0008, 0x1178: 0x0008, 0x1179: 0x0008, 0x117a: 0x0008, 0x117b: 0x0008, - 0x117c: 0x0008, 0x117d: 0x0008, 0x117e: 0x0008, 0x117f: 0x0008, - // Block 0x46, offset 0x1180 - 0x1180: 0x0018, 0x1181: 0x0018, 0x1182: 0x0018, 0x1183: 0x0018, 0x1184: 0x0018, 0x1185: 0x0018, - 0x1186: 0x0018, 0x1187: 0x0018, 0x1188: 0x0018, 0x1189: 0x0018, 0x118a: 0x0018, 0x118b: 0x0018, - 0x118c: 0x0018, 0x118d: 0x0018, 0x118e: 0x0018, 0x118f: 0x0018, 0x1190: 0x0018, 0x1191: 0x0018, - 0x1192: 0x0018, 0x1193: 0x0018, 0x1194: 0x0018, 0x1195: 0x0018, 0x1196: 0x0018, 0x1197: 0x0008, - 0x1198: 0x0008, 0x1199: 0x0008, 0x119a: 0x0008, 0x119b: 0x0008, 0x119c: 0x0008, 0x119d: 0x0008, - 0x119e: 0x0008, 0x119f: 0x0008, 0x11a0: 0x0018, 0x11a1: 0x0018, 0x11a2: 0xe00d, 0x11a3: 0x0008, - 0x11a4: 0xe00d, 0x11a5: 0x0008, 0x11a6: 0xe00d, 0x11a7: 0x0008, 0x11a8: 0xe00d, 0x11a9: 0x0008, - 0x11aa: 0xe00d, 0x11ab: 0x0008, 0x11ac: 0xe00d, 0x11ad: 0x0008, 0x11ae: 0xe00d, 0x11af: 0x0008, - 0x11b0: 0x0008, 0x11b1: 0x0008, 0x11b2: 0xe00d, 0x11b3: 0x0008, 0x11b4: 0xe00d, 0x11b5: 0x0008, - 0x11b6: 0xe00d, 0x11b7: 0x0008, 0x11b8: 0xe00d, 0x11b9: 0x0008, 0x11ba: 0xe00d, 0x11bb: 0x0008, - 0x11bc: 0xe00d, 0x11bd: 0x0008, 0x11be: 0xe00d, 0x11bf: 0x0008, - // Block 0x47, offset 0x11c0 - 0x11c0: 0xe00d, 0x11c1: 0x0008, 0x11c2: 0xe00d, 0x11c3: 0x0008, 0x11c4: 0xe00d, 0x11c5: 0x0008, - 0x11c6: 0xe00d, 0x11c7: 0x0008, 0x11c8: 0xe00d, 0x11c9: 0x0008, 0x11ca: 0xe00d, 0x11cb: 0x0008, - 0x11cc: 0xe00d, 0x11cd: 0x0008, 0x11ce: 0xe00d, 0x11cf: 0x0008, 0x11d0: 0xe00d, 0x11d1: 0x0008, - 0x11d2: 0xe00d, 0x11d3: 0x0008, 0x11d4: 0xe00d, 0x11d5: 0x0008, 0x11d6: 0xe00d, 0x11d7: 0x0008, - 0x11d8: 0xe00d, 0x11d9: 0x0008, 0x11da: 0xe00d, 0x11db: 0x0008, 0x11dc: 0xe00d, 0x11dd: 0x0008, - 0x11de: 0xe00d, 0x11df: 0x0008, 0x11e0: 0xe00d, 0x11e1: 0x0008, 0x11e2: 0xe00d, 0x11e3: 0x0008, - 0x11e4: 0xe00d, 0x11e5: 0x0008, 0x11e6: 0xe00d, 0x11e7: 0x0008, 0x11e8: 0xe00d, 0x11e9: 0x0008, - 0x11ea: 0xe00d, 0x11eb: 0x0008, 0x11ec: 0xe00d, 0x11ed: 0x0008, 0x11ee: 0xe00d, 0x11ef: 0x0008, - 0x11f0: 0xe0fd, 0x11f1: 0x0008, 0x11f2: 0x0008, 0x11f3: 0x0008, 0x11f4: 0x0008, 0x11f5: 0x0008, - 0x11f6: 0x0008, 0x11f7: 0x0008, 0x11f8: 0x0008, 0x11f9: 0xe01d, 0x11fa: 0x0008, 0x11fb: 0xe03d, - 0x11fc: 0x0008, 0x11fd: 0x4445, 0x11fe: 0xe00d, 0x11ff: 0x0008, - // Block 0x48, offset 0x1200 - 0x1200: 0xe00d, 0x1201: 0x0008, 0x1202: 0xe00d, 0x1203: 0x0008, 0x1204: 0xe00d, 0x1205: 0x0008, - 0x1206: 0xe00d, 0x1207: 0x0008, 0x1208: 0x0008, 0x1209: 0x0018, 0x120a: 0x0018, 0x120b: 0xe03d, - 0x120c: 0x0008, 0x120d: 0x11d9, 0x120e: 0x0008, 0x120f: 0x0008, 0x1210: 0xe00d, 0x1211: 0x0008, - 0x1212: 0xe00d, 0x1213: 0x0008, 0x1214: 0x0008, 0x1215: 0x0008, 0x1216: 0xe00d, 0x1217: 0x0008, - 0x1218: 0xe00d, 0x1219: 0x0008, 0x121a: 0xe00d, 0x121b: 0x0008, 0x121c: 0xe00d, 0x121d: 0x0008, - 0x121e: 0xe00d, 0x121f: 0x0008, 0x1220: 0xe00d, 0x1221: 0x0008, 0x1222: 0xe00d, 0x1223: 0x0008, - 0x1224: 0xe00d, 0x1225: 0x0008, 0x1226: 0xe00d, 0x1227: 0x0008, 0x1228: 0xe00d, 0x1229: 0x0008, - 0x122a: 0x6e29, 0x122b: 0x1029, 0x122c: 0x11c1, 0x122d: 0x6e41, 0x122e: 0x1221, 0x122f: 0x0008, - 0x1230: 0x6e59, 0x1231: 0x6e71, 0x1232: 0x1239, 0x1233: 0x4465, 0x1234: 0xe00d, 0x1235: 0x0008, - 0x1236: 0xe00d, 0x1237: 0x0008, 0x1238: 0xe00d, 0x1239: 0x0008, 0x123a: 0xe00d, 0x123b: 0x0008, - 0x123c: 0xe00d, 0x123d: 0x0008, 0x123e: 0xe00d, 0x123f: 0x0008, - // Block 0x49, offset 0x1240 - 0x1240: 0x650d, 0x1241: 0x652d, 0x1242: 0x654d, 0x1243: 0x656d, 0x1244: 0x658d, 0x1245: 0x65ad, - 0x1246: 0x65cd, 0x1247: 0x65ed, 0x1248: 0x660d, 0x1249: 0x662d, 0x124a: 0x664d, 0x124b: 0x666d, - 0x124c: 0x668d, 0x124d: 0x66ad, 0x124e: 0x0008, 0x124f: 0x0008, 0x1250: 0x66cd, 0x1251: 0x0008, - 0x1252: 0x66ed, 0x1253: 0x0008, 0x1254: 0x0008, 0x1255: 0x670d, 0x1256: 0x672d, 0x1257: 0x674d, - 0x1258: 0x676d, 0x1259: 0x678d, 0x125a: 0x67ad, 0x125b: 0x67cd, 0x125c: 0x67ed, 0x125d: 0x680d, - 0x125e: 0x682d, 0x125f: 0x0008, 0x1260: 0x684d, 0x1261: 0x0008, 0x1262: 0x686d, 0x1263: 0x0008, - 0x1264: 0x0008, 0x1265: 0x688d, 0x1266: 0x68ad, 0x1267: 0x0008, 0x1268: 0x0008, 0x1269: 0x0008, - 0x126a: 0x68cd, 0x126b: 0x68ed, 0x126c: 0x690d, 0x126d: 0x692d, 0x126e: 0x694d, 0x126f: 0x696d, - 0x1270: 0x698d, 0x1271: 0x69ad, 0x1272: 0x69cd, 0x1273: 0x69ed, 0x1274: 0x6a0d, 0x1275: 0x6a2d, - 0x1276: 0x6a4d, 0x1277: 0x6a6d, 0x1278: 0x6a8d, 0x1279: 0x6aad, 0x127a: 0x6acd, 0x127b: 0x6aed, - 0x127c: 0x6b0d, 0x127d: 0x6b2d, 0x127e: 0x6b4d, 0x127f: 0x6b6d, - // Block 0x4a, offset 0x1280 - 0x1280: 0x7acd, 0x1281: 0x7aed, 0x1282: 0x7b0d, 0x1283: 0x7b2d, 0x1284: 0x7b4d, 0x1285: 0x7b6d, - 0x1286: 0x7b8d, 0x1287: 0x7bad, 0x1288: 0x7bcd, 0x1289: 0x7bed, 0x128a: 0x7c0d, 0x128b: 0x7c2d, - 0x128c: 0x7c4d, 0x128d: 0x7c6d, 0x128e: 0x7c8d, 0x128f: 0x6ec9, 0x1290: 0x6ef1, 0x1291: 0x6f19, - 0x1292: 0x7cad, 0x1293: 0x7ccd, 0x1294: 0x7ced, 0x1295: 0x6f41, 0x1296: 0x6f69, 0x1297: 0x6f91, - 0x1298: 0x7d0d, 0x1299: 0x7d2d, 0x129a: 0x0040, 0x129b: 0x0040, 0x129c: 0x0040, 0x129d: 0x0040, - 0x129e: 0x0040, 0x129f: 0x0040, 0x12a0: 0x0040, 0x12a1: 0x0040, 0x12a2: 0x0040, 0x12a3: 0x0040, - 0x12a4: 0x0040, 0x12a5: 0x0040, 0x12a6: 0x0040, 0x12a7: 0x0040, 0x12a8: 0x0040, 0x12a9: 0x0040, - 0x12aa: 0x0040, 0x12ab: 0x0040, 0x12ac: 0x0040, 0x12ad: 0x0040, 0x12ae: 0x0040, 0x12af: 0x0040, - 0x12b0: 0x0040, 0x12b1: 0x0040, 0x12b2: 0x0040, 0x12b3: 0x0040, 0x12b4: 0x0040, 0x12b5: 0x0040, - 0x12b6: 0x0040, 0x12b7: 0x0040, 0x12b8: 0x0040, 0x12b9: 0x0040, 0x12ba: 0x0040, 0x12bb: 0x0040, - 0x12bc: 0x0040, 0x12bd: 0x0040, 0x12be: 0x0040, 0x12bf: 0x0040, - // Block 0x4b, offset 0x12c0 - 0x12c0: 0x6fb9, 0x12c1: 0x6fd1, 0x12c2: 0x6fe9, 0x12c3: 0x7d4d, 0x12c4: 0x7d6d, 0x12c5: 0x7001, - 0x12c6: 0x7001, 0x12c7: 0x0040, 0x12c8: 0x0040, 0x12c9: 0x0040, 0x12ca: 0x0040, 0x12cb: 0x0040, - 0x12cc: 0x0040, 0x12cd: 0x0040, 0x12ce: 0x0040, 0x12cf: 0x0040, 0x12d0: 0x0040, 0x12d1: 0x0040, - 0x12d2: 0x0040, 0x12d3: 0x7019, 0x12d4: 0x7041, 0x12d5: 0x7069, 0x12d6: 0x7091, 0x12d7: 0x70b9, - 0x12d8: 0x0040, 0x12d9: 0x0040, 0x12da: 0x0040, 0x12db: 0x0040, 0x12dc: 0x0040, 0x12dd: 0x70e1, - 0x12de: 0x3308, 0x12df: 0x7109, 0x12e0: 0x7131, 0x12e1: 0x20a9, 0x12e2: 0x20f1, 0x12e3: 0x7149, - 0x12e4: 0x7161, 0x12e5: 0x7179, 0x12e6: 0x7191, 0x12e7: 0x71a9, 0x12e8: 0x71c1, 0x12e9: 0x1fb2, - 0x12ea: 0x71d9, 0x12eb: 0x7201, 0x12ec: 0x7229, 0x12ed: 0x7261, 0x12ee: 0x7299, 0x12ef: 0x72c1, - 0x12f0: 0x72e9, 0x12f1: 0x7311, 0x12f2: 0x7339, 0x12f3: 0x7361, 0x12f4: 0x7389, 0x12f5: 0x73b1, - 0x12f6: 0x73d9, 0x12f7: 0x0040, 0x12f8: 0x7401, 0x12f9: 0x7429, 0x12fa: 0x7451, 0x12fb: 0x7479, - 0x12fc: 0x74a1, 0x12fd: 0x0040, 0x12fe: 0x74c9, 0x12ff: 0x0040, - // Block 0x4c, offset 0x1300 - 0x1300: 0x74f1, 0x1301: 0x7519, 0x1302: 0x0040, 0x1303: 0x7541, 0x1304: 0x7569, 0x1305: 0x0040, - 0x1306: 0x7591, 0x1307: 0x75b9, 0x1308: 0x75e1, 0x1309: 0x7609, 0x130a: 0x7631, 0x130b: 0x7659, - 0x130c: 0x7681, 0x130d: 0x76a9, 0x130e: 0x76d1, 0x130f: 0x76f9, 0x1310: 0x7721, 0x1311: 0x7721, - 0x1312: 0x7739, 0x1313: 0x7739, 0x1314: 0x7739, 0x1315: 0x7739, 0x1316: 0x7751, 0x1317: 0x7751, - 0x1318: 0x7751, 0x1319: 0x7751, 0x131a: 0x7769, 0x131b: 0x7769, 0x131c: 0x7769, 0x131d: 0x7769, - 0x131e: 0x7781, 0x131f: 0x7781, 0x1320: 0x7781, 0x1321: 0x7781, 0x1322: 0x7799, 0x1323: 0x7799, - 0x1324: 0x7799, 0x1325: 0x7799, 0x1326: 0x77b1, 0x1327: 0x77b1, 0x1328: 0x77b1, 0x1329: 0x77b1, - 0x132a: 0x77c9, 0x132b: 0x77c9, 0x132c: 0x77c9, 0x132d: 0x77c9, 0x132e: 0x77e1, 0x132f: 0x77e1, - 0x1330: 0x77e1, 0x1331: 0x77e1, 0x1332: 0x77f9, 0x1333: 0x77f9, 0x1334: 0x77f9, 0x1335: 0x77f9, - 0x1336: 0x7811, 0x1337: 0x7811, 0x1338: 0x7811, 0x1339: 0x7811, 0x133a: 0x7829, 0x133b: 0x7829, - 0x133c: 0x7829, 0x133d: 0x7829, 0x133e: 0x7841, 0x133f: 0x7841, - // Block 0x4d, offset 0x1340 - 0x1340: 0x7841, 0x1341: 0x7841, 0x1342: 0x7859, 0x1343: 0x7859, 0x1344: 0x7871, 0x1345: 0x7871, - 0x1346: 0x7889, 0x1347: 0x7889, 0x1348: 0x78a1, 0x1349: 0x78a1, 0x134a: 0x78b9, 0x134b: 0x78b9, - 0x134c: 0x78d1, 0x134d: 0x78d1, 0x134e: 0x78e9, 0x134f: 0x78e9, 0x1350: 0x78e9, 0x1351: 0x78e9, - 0x1352: 0x7901, 0x1353: 0x7901, 0x1354: 0x7901, 0x1355: 0x7901, 0x1356: 0x7919, 0x1357: 0x7919, - 0x1358: 0x7919, 0x1359: 0x7919, 0x135a: 0x7931, 0x135b: 0x7931, 0x135c: 0x7931, 0x135d: 0x7931, - 0x135e: 0x7949, 0x135f: 0x7949, 0x1360: 0x7961, 0x1361: 0x7961, 0x1362: 0x7961, 0x1363: 0x7961, - 0x1364: 0x7979, 0x1365: 0x7979, 0x1366: 0x7991, 0x1367: 0x7991, 0x1368: 0x7991, 0x1369: 0x7991, - 0x136a: 0x79a9, 0x136b: 0x79a9, 0x136c: 0x79a9, 0x136d: 0x79a9, 0x136e: 0x79c1, 0x136f: 0x79c1, - 0x1370: 0x79d9, 0x1371: 0x79d9, 0x1372: 0x0818, 0x1373: 0x0818, 0x1374: 0x0818, 0x1375: 0x0818, - 0x1376: 0x0818, 0x1377: 0x0818, 0x1378: 0x0818, 0x1379: 0x0818, 0x137a: 0x0818, 0x137b: 0x0818, - 0x137c: 0x0818, 0x137d: 0x0818, 0x137e: 0x0818, 0x137f: 0x0818, - // Block 0x4e, offset 0x1380 - 0x1380: 0x0818, 0x1381: 0x0818, 0x1382: 0x0040, 0x1383: 0x0040, 0x1384: 0x0040, 0x1385: 0x0040, - 0x1386: 0x0040, 0x1387: 0x0040, 0x1388: 0x0040, 0x1389: 0x0040, 0x138a: 0x0040, 0x138b: 0x0040, - 0x138c: 0x0040, 0x138d: 0x0040, 0x138e: 0x0040, 0x138f: 0x0040, 0x1390: 0x0040, 0x1391: 0x0040, - 0x1392: 0x0040, 0x1393: 0x79f1, 0x1394: 0x79f1, 0x1395: 0x79f1, 0x1396: 0x79f1, 0x1397: 0x7a09, - 0x1398: 0x7a09, 0x1399: 0x7a21, 0x139a: 0x7a21, 0x139b: 0x7a39, 0x139c: 0x7a39, 0x139d: 0x0479, - 0x139e: 0x7a51, 0x139f: 0x7a51, 0x13a0: 0x7a69, 0x13a1: 0x7a69, 0x13a2: 0x7a81, 0x13a3: 0x7a81, - 0x13a4: 0x7a99, 0x13a5: 0x7a99, 0x13a6: 0x7a99, 0x13a7: 0x7a99, 0x13a8: 0x7ab1, 0x13a9: 0x7ab1, - 0x13aa: 0x7ac9, 0x13ab: 0x7ac9, 0x13ac: 0x7af1, 0x13ad: 0x7af1, 0x13ae: 0x7b19, 0x13af: 0x7b19, - 0x13b0: 0x7b41, 0x13b1: 0x7b41, 0x13b2: 0x7b69, 0x13b3: 0x7b69, 0x13b4: 0x7b91, 0x13b5: 0x7b91, - 0x13b6: 0x7bb9, 0x13b7: 0x7bb9, 0x13b8: 0x7bb9, 0x13b9: 0x7be1, 0x13ba: 0x7be1, 0x13bb: 0x7be1, - 0x13bc: 0x7c09, 0x13bd: 0x7c09, 0x13be: 0x7c09, 0x13bf: 0x7c09, - // Block 0x4f, offset 0x13c0 - 0x13c0: 0x85f9, 0x13c1: 0x8621, 0x13c2: 0x8649, 0x13c3: 0x8671, 0x13c4: 0x8699, 0x13c5: 0x86c1, - 0x13c6: 0x86e9, 0x13c7: 0x8711, 0x13c8: 0x8739, 0x13c9: 0x8761, 0x13ca: 0x8789, 0x13cb: 0x87b1, - 0x13cc: 0x87d9, 0x13cd: 0x8801, 0x13ce: 0x8829, 0x13cf: 0x8851, 0x13d0: 0x8879, 0x13d1: 0x88a1, - 0x13d2: 0x88c9, 0x13d3: 0x88f1, 0x13d4: 0x8919, 0x13d5: 0x8941, 0x13d6: 0x8969, 0x13d7: 0x8991, - 0x13d8: 0x89b9, 0x13d9: 0x89e1, 0x13da: 0x8a09, 0x13db: 0x8a31, 0x13dc: 0x8a59, 0x13dd: 0x8a81, - 0x13de: 0x8aaa, 0x13df: 0x8ada, 0x13e0: 0x8b0a, 0x13e1: 0x8b3a, 0x13e2: 0x8b6a, 0x13e3: 0x8b9a, - 0x13e4: 0x8bc9, 0x13e5: 0x8bf1, 0x13e6: 0x7c71, 0x13e7: 0x8c19, 0x13e8: 0x7be1, 0x13e9: 0x7c99, - 0x13ea: 0x8c41, 0x13eb: 0x8c69, 0x13ec: 0x7d39, 0x13ed: 0x8c91, 0x13ee: 0x7d61, 0x13ef: 0x7d89, - 0x13f0: 0x8cb9, 0x13f1: 0x8ce1, 0x13f2: 0x7e29, 0x13f3: 0x8d09, 0x13f4: 0x7e51, 0x13f5: 0x7e79, - 0x13f6: 0x8d31, 0x13f7: 0x8d59, 0x13f8: 0x7ec9, 0x13f9: 0x8d81, 0x13fa: 0x7ef1, 0x13fb: 0x7f19, - 0x13fc: 0x83a1, 0x13fd: 0x83c9, 0x13fe: 0x8441, 0x13ff: 0x8469, - // Block 0x50, offset 0x1400 - 0x1400: 0x8491, 0x1401: 0x8531, 0x1402: 0x8559, 0x1403: 0x8581, 0x1404: 0x85a9, 0x1405: 0x8649, - 0x1406: 0x8671, 0x1407: 0x8699, 0x1408: 0x8da9, 0x1409: 0x8739, 0x140a: 0x8dd1, 0x140b: 0x8df9, - 0x140c: 0x8829, 0x140d: 0x8e21, 0x140e: 0x8851, 0x140f: 0x8879, 0x1410: 0x8a81, 0x1411: 0x8e49, - 0x1412: 0x8e71, 0x1413: 0x89b9, 0x1414: 0x8e99, 0x1415: 0x89e1, 0x1416: 0x8a09, 0x1417: 0x7c21, - 0x1418: 0x7c49, 0x1419: 0x8ec1, 0x141a: 0x7c71, 0x141b: 0x8ee9, 0x141c: 0x7cc1, 0x141d: 0x7ce9, - 0x141e: 0x7d11, 0x141f: 0x7d39, 0x1420: 0x8f11, 0x1421: 0x7db1, 0x1422: 0x7dd9, 0x1423: 0x7e01, - 0x1424: 0x7e29, 0x1425: 0x8f39, 0x1426: 0x7ec9, 0x1427: 0x7f41, 0x1428: 0x7f69, 0x1429: 0x7f91, - 0x142a: 0x7fb9, 0x142b: 0x7fe1, 0x142c: 0x8031, 0x142d: 0x8059, 0x142e: 0x8081, 0x142f: 0x80a9, - 0x1430: 0x80d1, 0x1431: 0x80f9, 0x1432: 0x8f61, 0x1433: 0x8121, 0x1434: 0x8149, 0x1435: 0x8171, - 0x1436: 0x8199, 0x1437: 0x81c1, 0x1438: 0x81e9, 0x1439: 0x8239, 0x143a: 0x8261, 0x143b: 0x8289, - 0x143c: 0x82b1, 0x143d: 0x82d9, 0x143e: 0x8301, 0x143f: 0x8329, - // Block 0x51, offset 0x1440 - 0x1440: 0x8351, 0x1441: 0x8379, 0x1442: 0x83f1, 0x1443: 0x8419, 0x1444: 0x84b9, 0x1445: 0x84e1, - 0x1446: 0x8509, 0x1447: 0x8531, 0x1448: 0x8559, 0x1449: 0x85d1, 0x144a: 0x85f9, 0x144b: 0x8621, - 0x144c: 0x8649, 0x144d: 0x8f89, 0x144e: 0x86c1, 0x144f: 0x86e9, 0x1450: 0x8711, 0x1451: 0x8739, - 0x1452: 0x87b1, 0x1453: 0x87d9, 0x1454: 0x8801, 0x1455: 0x8829, 0x1456: 0x8fb1, 0x1457: 0x88a1, - 0x1458: 0x88c9, 0x1459: 0x8fd9, 0x145a: 0x8941, 0x145b: 0x8969, 0x145c: 0x8991, 0x145d: 0x89b9, - 0x145e: 0x9001, 0x145f: 0x7c71, 0x1460: 0x8ee9, 0x1461: 0x7d39, 0x1462: 0x8f11, 0x1463: 0x7e29, - 0x1464: 0x8f39, 0x1465: 0x7ec9, 0x1466: 0x9029, 0x1467: 0x80d1, 0x1468: 0x9051, 0x1469: 0x9079, - 0x146a: 0x90a1, 0x146b: 0x8531, 0x146c: 0x8559, 0x146d: 0x8649, 0x146e: 0x8829, 0x146f: 0x8fb1, - 0x1470: 0x89b9, 0x1471: 0x9001, 0x1472: 0x90c9, 0x1473: 0x9101, 0x1474: 0x9139, 0x1475: 0x9171, - 0x1476: 0x9199, 0x1477: 0x91c1, 0x1478: 0x91e9, 0x1479: 0x9211, 0x147a: 0x9239, 0x147b: 0x9261, - 0x147c: 0x9289, 0x147d: 0x92b1, 0x147e: 0x92d9, 0x147f: 0x9301, - // Block 0x52, offset 0x1480 - 0x1480: 0x9329, 0x1481: 0x9351, 0x1482: 0x9379, 0x1483: 0x93a1, 0x1484: 0x93c9, 0x1485: 0x93f1, - 0x1486: 0x9419, 0x1487: 0x9441, 0x1488: 0x9469, 0x1489: 0x9491, 0x148a: 0x94b9, 0x148b: 0x94e1, - 0x148c: 0x9079, 0x148d: 0x9509, 0x148e: 0x9531, 0x148f: 0x9559, 0x1490: 0x9581, 0x1491: 0x9171, - 0x1492: 0x9199, 0x1493: 0x91c1, 0x1494: 0x91e9, 0x1495: 0x9211, 0x1496: 0x9239, 0x1497: 0x9261, - 0x1498: 0x9289, 0x1499: 0x92b1, 0x149a: 0x92d9, 0x149b: 0x9301, 0x149c: 0x9329, 0x149d: 0x9351, - 0x149e: 0x9379, 0x149f: 0x93a1, 0x14a0: 0x93c9, 0x14a1: 0x93f1, 0x14a2: 0x9419, 0x14a3: 0x9441, - 0x14a4: 0x9469, 0x14a5: 0x9491, 0x14a6: 0x94b9, 0x14a7: 0x94e1, 0x14a8: 0x9079, 0x14a9: 0x9509, - 0x14aa: 0x9531, 0x14ab: 0x9559, 0x14ac: 0x9581, 0x14ad: 0x9491, 0x14ae: 0x94b9, 0x14af: 0x94e1, - 0x14b0: 0x9079, 0x14b1: 0x9051, 0x14b2: 0x90a1, 0x14b3: 0x8211, 0x14b4: 0x8059, 0x14b5: 0x8081, - 0x14b6: 0x80a9, 0x14b7: 0x9491, 0x14b8: 0x94b9, 0x14b9: 0x94e1, 0x14ba: 0x8211, 0x14bb: 0x8239, - 0x14bc: 0x95a9, 0x14bd: 0x95a9, 0x14be: 0x0018, 0x14bf: 0x0018, - // Block 0x53, offset 0x14c0 - 0x14c0: 0x0040, 0x14c1: 0x0040, 0x14c2: 0x0040, 0x14c3: 0x0040, 0x14c4: 0x0040, 0x14c5: 0x0040, - 0x14c6: 0x0040, 0x14c7: 0x0040, 0x14c8: 0x0040, 0x14c9: 0x0040, 0x14ca: 0x0040, 0x14cb: 0x0040, - 0x14cc: 0x0040, 0x14cd: 0x0040, 0x14ce: 0x0040, 0x14cf: 0x0040, 0x14d0: 0x95d1, 0x14d1: 0x9609, - 0x14d2: 0x9609, 0x14d3: 0x9641, 0x14d4: 0x9679, 0x14d5: 0x96b1, 0x14d6: 0x96e9, 0x14d7: 0x9721, - 0x14d8: 0x9759, 0x14d9: 0x9759, 0x14da: 0x9791, 0x14db: 0x97c9, 0x14dc: 0x9801, 0x14dd: 0x9839, - 0x14de: 0x9871, 0x14df: 0x98a9, 0x14e0: 0x98a9, 0x14e1: 0x98e1, 0x14e2: 0x9919, 0x14e3: 0x9919, - 0x14e4: 0x9951, 0x14e5: 0x9951, 0x14e6: 0x9989, 0x14e7: 0x99c1, 0x14e8: 0x99c1, 0x14e9: 0x99f9, - 0x14ea: 0x9a31, 0x14eb: 0x9a31, 0x14ec: 0x9a69, 0x14ed: 0x9a69, 0x14ee: 0x9aa1, 0x14ef: 0x9ad9, - 0x14f0: 0x9ad9, 0x14f1: 0x9b11, 0x14f2: 0x9b11, 0x14f3: 0x9b49, 0x14f4: 0x9b81, 0x14f5: 0x9bb9, - 0x14f6: 0x9bf1, 0x14f7: 0x9bf1, 0x14f8: 0x9c29, 0x14f9: 0x9c61, 0x14fa: 0x9c99, 0x14fb: 0x9cd1, - 0x14fc: 0x9d09, 0x14fd: 0x9d09, 0x14fe: 0x9d41, 0x14ff: 0x9d79, - // Block 0x54, offset 0x1500 - 0x1500: 0xa949, 0x1501: 0xa981, 0x1502: 0xa9b9, 0x1503: 0xa8a1, 0x1504: 0x9bb9, 0x1505: 0x9989, - 0x1506: 0xa9f1, 0x1507: 0xaa29, 0x1508: 0x0040, 0x1509: 0x0040, 0x150a: 0x0040, 0x150b: 0x0040, - 0x150c: 0x0040, 0x150d: 0x0040, 0x150e: 0x0040, 0x150f: 0x0040, 0x1510: 0x0040, 0x1511: 0x0040, - 0x1512: 0x0040, 0x1513: 0x0040, 0x1514: 0x0040, 0x1515: 0x0040, 0x1516: 0x0040, 0x1517: 0x0040, - 0x1518: 0x0040, 0x1519: 0x0040, 0x151a: 0x0040, 0x151b: 0x0040, 0x151c: 0x0040, 0x151d: 0x0040, - 0x151e: 0x0040, 0x151f: 0x0040, 0x1520: 0x0040, 0x1521: 0x0040, 0x1522: 0x0040, 0x1523: 0x0040, - 0x1524: 0x0040, 0x1525: 0x0040, 0x1526: 0x0040, 0x1527: 0x0040, 0x1528: 0x0040, 0x1529: 0x0040, - 0x152a: 0x0040, 0x152b: 0x0040, 0x152c: 0x0040, 0x152d: 0x0040, 0x152e: 0x0040, 0x152f: 0x0040, - 0x1530: 0xaa61, 0x1531: 0xaa99, 0x1532: 0xaad1, 0x1533: 0xab19, 0x1534: 0xab61, 0x1535: 0xaba9, - 0x1536: 0xabf1, 0x1537: 0xac39, 0x1538: 0xac81, 0x1539: 0xacc9, 0x153a: 0xad02, 0x153b: 0xae12, - 0x153c: 0xae91, 0x153d: 0x0018, 0x153e: 0x0040, 0x153f: 0x0040, - // Block 0x55, offset 0x1540 - 0x1540: 0x33c0, 0x1541: 0x33c0, 0x1542: 0x33c0, 0x1543: 0x33c0, 0x1544: 0x33c0, 0x1545: 0x33c0, - 0x1546: 0x33c0, 0x1547: 0x33c0, 0x1548: 0x33c0, 0x1549: 0x33c0, 0x154a: 0x33c0, 0x154b: 0x33c0, - 0x154c: 0x33c0, 0x154d: 0x33c0, 0x154e: 0x33c0, 0x154f: 0x33c0, 0x1550: 0xaeda, 0x1551: 0x7d8d, - 0x1552: 0x0040, 0x1553: 0xaeea, 0x1554: 0x03c2, 0x1555: 0xaefa, 0x1556: 0xaf0a, 0x1557: 0x7dad, - 0x1558: 0x7dcd, 0x1559: 0x0040, 0x155a: 0x0040, 0x155b: 0x0040, 0x155c: 0x0040, 0x155d: 0x0040, - 0x155e: 0x0040, 0x155f: 0x0040, 0x1560: 0x3308, 0x1561: 0x3308, 0x1562: 0x3308, 0x1563: 0x3308, - 0x1564: 0x3308, 0x1565: 0x3308, 0x1566: 0x3308, 0x1567: 0x3308, 0x1568: 0x3308, 0x1569: 0x3308, - 0x156a: 0x3308, 0x156b: 0x3308, 0x156c: 0x3308, 0x156d: 0x3308, 0x156e: 0x3308, 0x156f: 0x3308, - 0x1570: 0x0040, 0x1571: 0x7ded, 0x1572: 0x7e0d, 0x1573: 0xaf1a, 0x1574: 0xaf1a, 0x1575: 0x1fd2, - 0x1576: 0x1fe2, 0x1577: 0xaf2a, 0x1578: 0xaf3a, 0x1579: 0x7e2d, 0x157a: 0x7e4d, 0x157b: 0x7e6d, - 0x157c: 0x7e2d, 0x157d: 0x7e8d, 0x157e: 0x7ead, 0x157f: 0x7e8d, - // Block 0x56, offset 0x1580 - 0x1580: 0x7ecd, 0x1581: 0x7eed, 0x1582: 0x7f0d, 0x1583: 0x7eed, 0x1584: 0x7f2d, 0x1585: 0x0018, - 0x1586: 0x0018, 0x1587: 0xaf4a, 0x1588: 0xaf5a, 0x1589: 0x7f4e, 0x158a: 0x7f6e, 0x158b: 0x7f8e, - 0x158c: 0x7fae, 0x158d: 0xaf1a, 0x158e: 0xaf1a, 0x158f: 0xaf1a, 0x1590: 0xaeda, 0x1591: 0x7fcd, - 0x1592: 0x0040, 0x1593: 0x0040, 0x1594: 0x03c2, 0x1595: 0xaeea, 0x1596: 0xaf0a, 0x1597: 0xaefa, - 0x1598: 0x7fed, 0x1599: 0x1fd2, 0x159a: 0x1fe2, 0x159b: 0xaf2a, 0x159c: 0xaf3a, 0x159d: 0x7ecd, - 0x159e: 0x7f2d, 0x159f: 0xaf6a, 0x15a0: 0xaf7a, 0x15a1: 0xaf8a, 0x15a2: 0x1fb2, 0x15a3: 0xaf99, - 0x15a4: 0xafaa, 0x15a5: 0xafba, 0x15a6: 0x1fc2, 0x15a7: 0x0040, 0x15a8: 0xafca, 0x15a9: 0xafda, - 0x15aa: 0xafea, 0x15ab: 0xaffa, 0x15ac: 0x0040, 0x15ad: 0x0040, 0x15ae: 0x0040, 0x15af: 0x0040, - 0x15b0: 0x800e, 0x15b1: 0xb009, 0x15b2: 0x802e, 0x15b3: 0x0808, 0x15b4: 0x804e, 0x15b5: 0x0040, - 0x15b6: 0x806e, 0x15b7: 0xb031, 0x15b8: 0x808e, 0x15b9: 0xb059, 0x15ba: 0x80ae, 0x15bb: 0xb081, - 0x15bc: 0x80ce, 0x15bd: 0xb0a9, 0x15be: 0x80ee, 0x15bf: 0xb0d1, - // Block 0x57, offset 0x15c0 - 0x15c0: 0xb0f9, 0x15c1: 0xb111, 0x15c2: 0xb111, 0x15c3: 0xb129, 0x15c4: 0xb129, 0x15c5: 0xb141, - 0x15c6: 0xb141, 0x15c7: 0xb159, 0x15c8: 0xb159, 0x15c9: 0xb171, 0x15ca: 0xb171, 0x15cb: 0xb171, - 0x15cc: 0xb171, 0x15cd: 0xb189, 0x15ce: 0xb189, 0x15cf: 0xb1a1, 0x15d0: 0xb1a1, 0x15d1: 0xb1a1, - 0x15d2: 0xb1a1, 0x15d3: 0xb1b9, 0x15d4: 0xb1b9, 0x15d5: 0xb1d1, 0x15d6: 0xb1d1, 0x15d7: 0xb1d1, - 0x15d8: 0xb1d1, 0x15d9: 0xb1e9, 0x15da: 0xb1e9, 0x15db: 0xb1e9, 0x15dc: 0xb1e9, 0x15dd: 0xb201, - 0x15de: 0xb201, 0x15df: 0xb201, 0x15e0: 0xb201, 0x15e1: 0xb219, 0x15e2: 0xb219, 0x15e3: 0xb219, - 0x15e4: 0xb219, 0x15e5: 0xb231, 0x15e6: 0xb231, 0x15e7: 0xb231, 0x15e8: 0xb231, 0x15e9: 0xb249, - 0x15ea: 0xb249, 0x15eb: 0xb261, 0x15ec: 0xb261, 0x15ed: 0xb279, 0x15ee: 0xb279, 0x15ef: 0xb291, - 0x15f0: 0xb291, 0x15f1: 0xb2a9, 0x15f2: 0xb2a9, 0x15f3: 0xb2a9, 0x15f4: 0xb2a9, 0x15f5: 0xb2c1, - 0x15f6: 0xb2c1, 0x15f7: 0xb2c1, 0x15f8: 0xb2c1, 0x15f9: 0xb2d9, 0x15fa: 0xb2d9, 0x15fb: 0xb2d9, - 0x15fc: 0xb2d9, 0x15fd: 0xb2f1, 0x15fe: 0xb2f1, 0x15ff: 0xb2f1, - // Block 0x58, offset 0x1600 - 0x1600: 0xb2f1, 0x1601: 0xb309, 0x1602: 0xb309, 0x1603: 0xb309, 0x1604: 0xb309, 0x1605: 0xb321, - 0x1606: 0xb321, 0x1607: 0xb321, 0x1608: 0xb321, 0x1609: 0xb339, 0x160a: 0xb339, 0x160b: 0xb339, - 0x160c: 0xb339, 0x160d: 0xb351, 0x160e: 0xb351, 0x160f: 0xb351, 0x1610: 0xb351, 0x1611: 0xb369, - 0x1612: 0xb369, 0x1613: 0xb369, 0x1614: 0xb369, 0x1615: 0xb381, 0x1616: 0xb381, 0x1617: 0xb381, - 0x1618: 0xb381, 0x1619: 0xb399, 0x161a: 0xb399, 0x161b: 0xb399, 0x161c: 0xb399, 0x161d: 0xb3b1, - 0x161e: 0xb3b1, 0x161f: 0xb3b1, 0x1620: 0xb3b1, 0x1621: 0xb3c9, 0x1622: 0xb3c9, 0x1623: 0xb3c9, - 0x1624: 0xb3c9, 0x1625: 0xb3e1, 0x1626: 0xb3e1, 0x1627: 0xb3e1, 0x1628: 0xb3e1, 0x1629: 0xb3f9, - 0x162a: 0xb3f9, 0x162b: 0xb3f9, 0x162c: 0xb3f9, 0x162d: 0xb411, 0x162e: 0xb411, 0x162f: 0x7ab1, - 0x1630: 0x7ab1, 0x1631: 0xb429, 0x1632: 0xb429, 0x1633: 0xb429, 0x1634: 0xb429, 0x1635: 0xb441, - 0x1636: 0xb441, 0x1637: 0xb469, 0x1638: 0xb469, 0x1639: 0xb491, 0x163a: 0xb491, 0x163b: 0xb4b9, - 0x163c: 0xb4b9, 0x163d: 0x0040, 0x163e: 0x0040, 0x163f: 0x03c0, - // Block 0x59, offset 0x1640 - 0x1640: 0x0040, 0x1641: 0xaefa, 0x1642: 0xb4e2, 0x1643: 0xaf6a, 0x1644: 0xafda, 0x1645: 0xafea, - 0x1646: 0xaf7a, 0x1647: 0xb4f2, 0x1648: 0x1fd2, 0x1649: 0x1fe2, 0x164a: 0xaf8a, 0x164b: 0x1fb2, - 0x164c: 0xaeda, 0x164d: 0xaf99, 0x164e: 0x29d1, 0x164f: 0xb502, 0x1650: 0x1f41, 0x1651: 0x00c9, - 0x1652: 0x0069, 0x1653: 0x0079, 0x1654: 0x1f51, 0x1655: 0x1f61, 0x1656: 0x1f71, 0x1657: 0x1f81, - 0x1658: 0x1f91, 0x1659: 0x1fa1, 0x165a: 0xaeea, 0x165b: 0x03c2, 0x165c: 0xafaa, 0x165d: 0x1fc2, - 0x165e: 0xafba, 0x165f: 0xaf0a, 0x1660: 0xaffa, 0x1661: 0x0039, 0x1662: 0x0ee9, 0x1663: 0x1159, - 0x1664: 0x0ef9, 0x1665: 0x0f09, 0x1666: 0x1199, 0x1667: 0x0f31, 0x1668: 0x0249, 0x1669: 0x0f41, - 0x166a: 0x0259, 0x166b: 0x0f51, 0x166c: 0x0359, 0x166d: 0x0f61, 0x166e: 0x0f71, 0x166f: 0x00d9, - 0x1670: 0x0f99, 0x1671: 0x2039, 0x1672: 0x0269, 0x1673: 0x01d9, 0x1674: 0x0fa9, 0x1675: 0x0fb9, - 0x1676: 0x1089, 0x1677: 0x0279, 0x1678: 0x0369, 0x1679: 0x0289, 0x167a: 0x13d1, 0x167b: 0xaf4a, - 0x167c: 0xafca, 0x167d: 0xaf5a, 0x167e: 0xb512, 0x167f: 0xaf1a, - // Block 0x5a, offset 0x1680 - 0x1680: 0x1caa, 0x1681: 0x0039, 0x1682: 0x0ee9, 0x1683: 0x1159, 0x1684: 0x0ef9, 0x1685: 0x0f09, - 0x1686: 0x1199, 0x1687: 0x0f31, 0x1688: 0x0249, 0x1689: 0x0f41, 0x168a: 0x0259, 0x168b: 0x0f51, - 0x168c: 0x0359, 0x168d: 0x0f61, 0x168e: 0x0f71, 0x168f: 0x00d9, 0x1690: 0x0f99, 0x1691: 0x2039, - 0x1692: 0x0269, 0x1693: 0x01d9, 0x1694: 0x0fa9, 0x1695: 0x0fb9, 0x1696: 0x1089, 0x1697: 0x0279, - 0x1698: 0x0369, 0x1699: 0x0289, 0x169a: 0x13d1, 0x169b: 0xaf2a, 0x169c: 0xb522, 0x169d: 0xaf3a, - 0x169e: 0xb532, 0x169f: 0x810d, 0x16a0: 0x812d, 0x16a1: 0x29d1, 0x16a2: 0x814d, 0x16a3: 0x814d, - 0x16a4: 0x816d, 0x16a5: 0x818d, 0x16a6: 0x81ad, 0x16a7: 0x81cd, 0x16a8: 0x81ed, 0x16a9: 0x820d, - 0x16aa: 0x822d, 0x16ab: 0x824d, 0x16ac: 0x826d, 0x16ad: 0x828d, 0x16ae: 0x82ad, 0x16af: 0x82cd, - 0x16b0: 0x82ed, 0x16b1: 0x830d, 0x16b2: 0x832d, 0x16b3: 0x834d, 0x16b4: 0x836d, 0x16b5: 0x838d, - 0x16b6: 0x83ad, 0x16b7: 0x83cd, 0x16b8: 0x83ed, 0x16b9: 0x840d, 0x16ba: 0x842d, 0x16bb: 0x844d, - 0x16bc: 0x81ed, 0x16bd: 0x846d, 0x16be: 0x848d, 0x16bf: 0x824d, - // Block 0x5b, offset 0x16c0 - 0x16c0: 0x84ad, 0x16c1: 0x84cd, 0x16c2: 0x84ed, 0x16c3: 0x850d, 0x16c4: 0x852d, 0x16c5: 0x854d, - 0x16c6: 0x856d, 0x16c7: 0x858d, 0x16c8: 0x850d, 0x16c9: 0x85ad, 0x16ca: 0x850d, 0x16cb: 0x85cd, - 0x16cc: 0x85cd, 0x16cd: 0x85ed, 0x16ce: 0x85ed, 0x16cf: 0x860d, 0x16d0: 0x854d, 0x16d1: 0x862d, - 0x16d2: 0x864d, 0x16d3: 0x862d, 0x16d4: 0x866d, 0x16d5: 0x864d, 0x16d6: 0x868d, 0x16d7: 0x868d, - 0x16d8: 0x86ad, 0x16d9: 0x86ad, 0x16da: 0x86cd, 0x16db: 0x86cd, 0x16dc: 0x864d, 0x16dd: 0x814d, - 0x16de: 0x86ed, 0x16df: 0x870d, 0x16e0: 0x0040, 0x16e1: 0x872d, 0x16e2: 0x874d, 0x16e3: 0x876d, - 0x16e4: 0x878d, 0x16e5: 0x876d, 0x16e6: 0x87ad, 0x16e7: 0x87cd, 0x16e8: 0x87ed, 0x16e9: 0x87ed, - 0x16ea: 0x880d, 0x16eb: 0x880d, 0x16ec: 0x882d, 0x16ed: 0x882d, 0x16ee: 0x880d, 0x16ef: 0x880d, - 0x16f0: 0x884d, 0x16f1: 0x886d, 0x16f2: 0x888d, 0x16f3: 0x88ad, 0x16f4: 0x88cd, 0x16f5: 0x88ed, - 0x16f6: 0x88ed, 0x16f7: 0x88ed, 0x16f8: 0x890d, 0x16f9: 0x890d, 0x16fa: 0x890d, 0x16fb: 0x890d, - 0x16fc: 0x87ed, 0x16fd: 0x87ed, 0x16fe: 0x87ed, 0x16ff: 0x0040, - // Block 0x5c, offset 0x1700 - 0x1700: 0x0040, 0x1701: 0x0040, 0x1702: 0x874d, 0x1703: 0x872d, 0x1704: 0x892d, 0x1705: 0x872d, - 0x1706: 0x874d, 0x1707: 0x872d, 0x1708: 0x0040, 0x1709: 0x0040, 0x170a: 0x894d, 0x170b: 0x874d, - 0x170c: 0x896d, 0x170d: 0x892d, 0x170e: 0x896d, 0x170f: 0x874d, 0x1710: 0x0040, 0x1711: 0x0040, - 0x1712: 0x898d, 0x1713: 0x89ad, 0x1714: 0x88ad, 0x1715: 0x896d, 0x1716: 0x892d, 0x1717: 0x896d, - 0x1718: 0x0040, 0x1719: 0x0040, 0x171a: 0x89cd, 0x171b: 0x89ed, 0x171c: 0x89cd, 0x171d: 0x0040, - 0x171e: 0x0040, 0x171f: 0x0040, 0x1720: 0xb541, 0x1721: 0xb559, 0x1722: 0xb571, 0x1723: 0x8a0e, - 0x1724: 0xb589, 0x1725: 0xb5a1, 0x1726: 0x8a2d, 0x1727: 0x0040, 0x1728: 0x8a4d, 0x1729: 0x8a6d, - 0x172a: 0x8a8d, 0x172b: 0x8a6d, 0x172c: 0x8aad, 0x172d: 0x8acd, 0x172e: 0x8aed, 0x172f: 0x0040, - 0x1730: 0x0040, 0x1731: 0x0040, 0x1732: 0x0040, 0x1733: 0x0040, 0x1734: 0x0040, 0x1735: 0x0040, - 0x1736: 0x0040, 0x1737: 0x0040, 0x1738: 0x0040, 0x1739: 0x0340, 0x173a: 0x0340, 0x173b: 0x0340, - 0x173c: 0x0040, 0x173d: 0x0040, 0x173e: 0x0040, 0x173f: 0x0040, - // Block 0x5d, offset 0x1740 - 0x1740: 0x0a08, 0x1741: 0x0a08, 0x1742: 0x0a08, 0x1743: 0x0a08, 0x1744: 0x0a08, 0x1745: 0x0c08, - 0x1746: 0x0808, 0x1747: 0x0c08, 0x1748: 0x0818, 0x1749: 0x0c08, 0x174a: 0x0c08, 0x174b: 0x0808, - 0x174c: 0x0808, 0x174d: 0x0908, 0x174e: 0x0c08, 0x174f: 0x0c08, 0x1750: 0x0c08, 0x1751: 0x0c08, - 0x1752: 0x0c08, 0x1753: 0x0a08, 0x1754: 0x0a08, 0x1755: 0x0a08, 0x1756: 0x0a08, 0x1757: 0x0908, - 0x1758: 0x0a08, 0x1759: 0x0a08, 0x175a: 0x0a08, 0x175b: 0x0a08, 0x175c: 0x0a08, 0x175d: 0x0c08, - 0x175e: 0x0a08, 0x175f: 0x0a08, 0x1760: 0x0a08, 0x1761: 0x0c08, 0x1762: 0x0808, 0x1763: 0x0808, - 0x1764: 0x0c08, 0x1765: 0x3308, 0x1766: 0x3308, 0x1767: 0x0040, 0x1768: 0x0040, 0x1769: 0x0040, - 0x176a: 0x0040, 0x176b: 0x0a18, 0x176c: 0x0a18, 0x176d: 0x0a18, 0x176e: 0x0a18, 0x176f: 0x0c18, - 0x1770: 0x0818, 0x1771: 0x0818, 0x1772: 0x0818, 0x1773: 0x0818, 0x1774: 0x0818, 0x1775: 0x0818, - 0x1776: 0x0818, 0x1777: 0x0040, 0x1778: 0x0040, 0x1779: 0x0040, 0x177a: 0x0040, 0x177b: 0x0040, - 0x177c: 0x0040, 0x177d: 0x0040, 0x177e: 0x0040, 0x177f: 0x0040, - // Block 0x5e, offset 0x1780 - 0x1780: 0x0a08, 0x1781: 0x0c08, 0x1782: 0x0a08, 0x1783: 0x0c08, 0x1784: 0x0c08, 0x1785: 0x0c08, - 0x1786: 0x0a08, 0x1787: 0x0a08, 0x1788: 0x0a08, 0x1789: 0x0c08, 0x178a: 0x0a08, 0x178b: 0x0a08, - 0x178c: 0x0c08, 0x178d: 0x0a08, 0x178e: 0x0c08, 0x178f: 0x0c08, 0x1790: 0x0a08, 0x1791: 0x0c08, - 0x1792: 0x0040, 0x1793: 0x0040, 0x1794: 0x0040, 0x1795: 0x0040, 0x1796: 0x0040, 0x1797: 0x0040, - 0x1798: 0x0040, 0x1799: 0x0818, 0x179a: 0x0818, 0x179b: 0x0818, 0x179c: 0x0818, 0x179d: 0x0040, - 0x179e: 0x0040, 0x179f: 0x0040, 0x17a0: 0x0040, 0x17a1: 0x0040, 0x17a2: 0x0040, 0x17a3: 0x0040, - 0x17a4: 0x0040, 0x17a5: 0x0040, 0x17a6: 0x0040, 0x17a7: 0x0040, 0x17a8: 0x0040, 0x17a9: 0x0c18, - 0x17aa: 0x0c18, 0x17ab: 0x0c18, 0x17ac: 0x0c18, 0x17ad: 0x0a18, 0x17ae: 0x0a18, 0x17af: 0x0818, - 0x17b0: 0x0040, 0x17b1: 0x0040, 0x17b2: 0x0040, 0x17b3: 0x0040, 0x17b4: 0x0040, 0x17b5: 0x0040, - 0x17b6: 0x0040, 0x17b7: 0x0040, 0x17b8: 0x0040, 0x17b9: 0x0040, 0x17ba: 0x0040, 0x17bb: 0x0040, - 0x17bc: 0x0040, 0x17bd: 0x0040, 0x17be: 0x0040, 0x17bf: 0x0040, - // Block 0x5f, offset 0x17c0 - 0x17c0: 0x3308, 0x17c1: 0x3308, 0x17c2: 0x3008, 0x17c3: 0x3008, 0x17c4: 0x0040, 0x17c5: 0x0008, - 0x17c6: 0x0008, 0x17c7: 0x0008, 0x17c8: 0x0008, 0x17c9: 0x0008, 0x17ca: 0x0008, 0x17cb: 0x0008, - 0x17cc: 0x0008, 0x17cd: 0x0040, 0x17ce: 0x0040, 0x17cf: 0x0008, 0x17d0: 0x0008, 0x17d1: 0x0040, - 0x17d2: 0x0040, 0x17d3: 0x0008, 0x17d4: 0x0008, 0x17d5: 0x0008, 0x17d6: 0x0008, 0x17d7: 0x0008, - 0x17d8: 0x0008, 0x17d9: 0x0008, 0x17da: 0x0008, 0x17db: 0x0008, 0x17dc: 0x0008, 0x17dd: 0x0008, - 0x17de: 0x0008, 0x17df: 0x0008, 0x17e0: 0x0008, 0x17e1: 0x0008, 0x17e2: 0x0008, 0x17e3: 0x0008, - 0x17e4: 0x0008, 0x17e5: 0x0008, 0x17e6: 0x0008, 0x17e7: 0x0008, 0x17e8: 0x0008, 0x17e9: 0x0040, - 0x17ea: 0x0008, 0x17eb: 0x0008, 0x17ec: 0x0008, 0x17ed: 0x0008, 0x17ee: 0x0008, 0x17ef: 0x0008, - 0x17f0: 0x0008, 0x17f1: 0x0040, 0x17f2: 0x0008, 0x17f3: 0x0008, 0x17f4: 0x0040, 0x17f5: 0x0008, - 0x17f6: 0x0008, 0x17f7: 0x0008, 0x17f8: 0x0008, 0x17f9: 0x0008, 0x17fa: 0x0040, 0x17fb: 0x3308, - 0x17fc: 0x3308, 0x17fd: 0x0008, 0x17fe: 0x3008, 0x17ff: 0x3008, - // Block 0x60, offset 0x1800 - 0x1800: 0x3308, 0x1801: 0x3008, 0x1802: 0x3008, 0x1803: 0x3008, 0x1804: 0x3008, 0x1805: 0x0040, - 0x1806: 0x0040, 0x1807: 0x3008, 0x1808: 0x3008, 0x1809: 0x0040, 0x180a: 0x0040, 0x180b: 0x3008, - 0x180c: 0x3008, 0x180d: 0x3808, 0x180e: 0x0040, 0x180f: 0x0040, 0x1810: 0x0008, 0x1811: 0x0040, - 0x1812: 0x0040, 0x1813: 0x0040, 0x1814: 0x0040, 0x1815: 0x0040, 0x1816: 0x0040, 0x1817: 0x3008, - 0x1818: 0x0040, 0x1819: 0x0040, 0x181a: 0x0040, 0x181b: 0x0040, 0x181c: 0x0040, 0x181d: 0x0008, - 0x181e: 0x0008, 0x181f: 0x0008, 0x1820: 0x0008, 0x1821: 0x0008, 0x1822: 0x3008, 0x1823: 0x3008, - 0x1824: 0x0040, 0x1825: 0x0040, 0x1826: 0x3308, 0x1827: 0x3308, 0x1828: 0x3308, 0x1829: 0x3308, - 0x182a: 0x3308, 0x182b: 0x3308, 0x182c: 0x3308, 0x182d: 0x0040, 0x182e: 0x0040, 0x182f: 0x0040, - 0x1830: 0x3308, 0x1831: 0x3308, 0x1832: 0x3308, 0x1833: 0x3308, 0x1834: 0x3308, 0x1835: 0x0040, - 0x1836: 0x0040, 0x1837: 0x0040, 0x1838: 0x0040, 0x1839: 0x0040, 0x183a: 0x0040, 0x183b: 0x0040, - 0x183c: 0x0040, 0x183d: 0x0040, 0x183e: 0x0040, 0x183f: 0x0040, - // Block 0x61, offset 0x1840 - 0x1840: 0x0039, 0x1841: 0x0ee9, 0x1842: 0x1159, 0x1843: 0x0ef9, 0x1844: 0x0f09, 0x1845: 0x1199, - 0x1846: 0x0f31, 0x1847: 0x0249, 0x1848: 0x0f41, 0x1849: 0x0259, 0x184a: 0x0f51, 0x184b: 0x0359, - 0x184c: 0x0f61, 0x184d: 0x0f71, 0x184e: 0x00d9, 0x184f: 0x0f99, 0x1850: 0x2039, 0x1851: 0x0269, - 0x1852: 0x01d9, 0x1853: 0x0fa9, 0x1854: 0x0fb9, 0x1855: 0x1089, 0x1856: 0x0279, 0x1857: 0x0369, - 0x1858: 0x0289, 0x1859: 0x13d1, 0x185a: 0x0039, 0x185b: 0x0ee9, 0x185c: 0x1159, 0x185d: 0x0ef9, - 0x185e: 0x0f09, 0x185f: 0x1199, 0x1860: 0x0f31, 0x1861: 0x0249, 0x1862: 0x0f41, 0x1863: 0x0259, - 0x1864: 0x0f51, 0x1865: 0x0359, 0x1866: 0x0f61, 0x1867: 0x0f71, 0x1868: 0x00d9, 0x1869: 0x0f99, - 0x186a: 0x2039, 0x186b: 0x0269, 0x186c: 0x01d9, 0x186d: 0x0fa9, 0x186e: 0x0fb9, 0x186f: 0x1089, - 0x1870: 0x0279, 0x1871: 0x0369, 0x1872: 0x0289, 0x1873: 0x13d1, 0x1874: 0x0039, 0x1875: 0x0ee9, - 0x1876: 0x1159, 0x1877: 0x0ef9, 0x1878: 0x0f09, 0x1879: 0x1199, 0x187a: 0x0f31, 0x187b: 0x0249, - 0x187c: 0x0f41, 0x187d: 0x0259, 0x187e: 0x0f51, 0x187f: 0x0359, - // Block 0x62, offset 0x1880 - 0x1880: 0x0f61, 0x1881: 0x0f71, 0x1882: 0x00d9, 0x1883: 0x0f99, 0x1884: 0x2039, 0x1885: 0x0269, - 0x1886: 0x01d9, 0x1887: 0x0fa9, 0x1888: 0x0fb9, 0x1889: 0x1089, 0x188a: 0x0279, 0x188b: 0x0369, - 0x188c: 0x0289, 0x188d: 0x13d1, 0x188e: 0x0039, 0x188f: 0x0ee9, 0x1890: 0x1159, 0x1891: 0x0ef9, - 0x1892: 0x0f09, 0x1893: 0x1199, 0x1894: 0x0f31, 0x1895: 0x0040, 0x1896: 0x0f41, 0x1897: 0x0259, - 0x1898: 0x0f51, 0x1899: 0x0359, 0x189a: 0x0f61, 0x189b: 0x0f71, 0x189c: 0x00d9, 0x189d: 0x0f99, - 0x189e: 0x2039, 0x189f: 0x0269, 0x18a0: 0x01d9, 0x18a1: 0x0fa9, 0x18a2: 0x0fb9, 0x18a3: 0x1089, - 0x18a4: 0x0279, 0x18a5: 0x0369, 0x18a6: 0x0289, 0x18a7: 0x13d1, 0x18a8: 0x0039, 0x18a9: 0x0ee9, - 0x18aa: 0x1159, 0x18ab: 0x0ef9, 0x18ac: 0x0f09, 0x18ad: 0x1199, 0x18ae: 0x0f31, 0x18af: 0x0249, - 0x18b0: 0x0f41, 0x18b1: 0x0259, 0x18b2: 0x0f51, 0x18b3: 0x0359, 0x18b4: 0x0f61, 0x18b5: 0x0f71, - 0x18b6: 0x00d9, 0x18b7: 0x0f99, 0x18b8: 0x2039, 0x18b9: 0x0269, 0x18ba: 0x01d9, 0x18bb: 0x0fa9, - 0x18bc: 0x0fb9, 0x18bd: 0x1089, 0x18be: 0x0279, 0x18bf: 0x0369, - // Block 0x63, offset 0x18c0 - 0x18c0: 0x0289, 0x18c1: 0x13d1, 0x18c2: 0x0039, 0x18c3: 0x0ee9, 0x18c4: 0x1159, 0x18c5: 0x0ef9, - 0x18c6: 0x0f09, 0x18c7: 0x1199, 0x18c8: 0x0f31, 0x18c9: 0x0249, 0x18ca: 0x0f41, 0x18cb: 0x0259, - 0x18cc: 0x0f51, 0x18cd: 0x0359, 0x18ce: 0x0f61, 0x18cf: 0x0f71, 0x18d0: 0x00d9, 0x18d1: 0x0f99, - 0x18d2: 0x2039, 0x18d3: 0x0269, 0x18d4: 0x01d9, 0x18d5: 0x0fa9, 0x18d6: 0x0fb9, 0x18d7: 0x1089, - 0x18d8: 0x0279, 0x18d9: 0x0369, 0x18da: 0x0289, 0x18db: 0x13d1, 0x18dc: 0x0039, 0x18dd: 0x0040, - 0x18de: 0x1159, 0x18df: 0x0ef9, 0x18e0: 0x0040, 0x18e1: 0x0040, 0x18e2: 0x0f31, 0x18e3: 0x0040, - 0x18e4: 0x0040, 0x18e5: 0x0259, 0x18e6: 0x0f51, 0x18e7: 0x0040, 0x18e8: 0x0040, 0x18e9: 0x0f71, - 0x18ea: 0x00d9, 0x18eb: 0x0f99, 0x18ec: 0x2039, 0x18ed: 0x0040, 0x18ee: 0x01d9, 0x18ef: 0x0fa9, - 0x18f0: 0x0fb9, 0x18f1: 0x1089, 0x18f2: 0x0279, 0x18f3: 0x0369, 0x18f4: 0x0289, 0x18f5: 0x13d1, - 0x18f6: 0x0039, 0x18f7: 0x0ee9, 0x18f8: 0x1159, 0x18f9: 0x0ef9, 0x18fa: 0x0040, 0x18fb: 0x1199, - 0x18fc: 0x0040, 0x18fd: 0x0249, 0x18fe: 0x0f41, 0x18ff: 0x0259, - // Block 0x64, offset 0x1900 - 0x1900: 0x0f51, 0x1901: 0x0359, 0x1902: 0x0f61, 0x1903: 0x0f71, 0x1904: 0x0040, 0x1905: 0x0f99, - 0x1906: 0x2039, 0x1907: 0x0269, 0x1908: 0x01d9, 0x1909: 0x0fa9, 0x190a: 0x0fb9, 0x190b: 0x1089, - 0x190c: 0x0279, 0x190d: 0x0369, 0x190e: 0x0289, 0x190f: 0x13d1, 0x1910: 0x0039, 0x1911: 0x0ee9, - 0x1912: 0x1159, 0x1913: 0x0ef9, 0x1914: 0x0f09, 0x1915: 0x1199, 0x1916: 0x0f31, 0x1917: 0x0249, - 0x1918: 0x0f41, 0x1919: 0x0259, 0x191a: 0x0f51, 0x191b: 0x0359, 0x191c: 0x0f61, 0x191d: 0x0f71, - 0x191e: 0x00d9, 0x191f: 0x0f99, 0x1920: 0x2039, 0x1921: 0x0269, 0x1922: 0x01d9, 0x1923: 0x0fa9, - 0x1924: 0x0fb9, 0x1925: 0x1089, 0x1926: 0x0279, 0x1927: 0x0369, 0x1928: 0x0289, 0x1929: 0x13d1, - 0x192a: 0x0039, 0x192b: 0x0ee9, 0x192c: 0x1159, 0x192d: 0x0ef9, 0x192e: 0x0f09, 0x192f: 0x1199, - 0x1930: 0x0f31, 0x1931: 0x0249, 0x1932: 0x0f41, 0x1933: 0x0259, 0x1934: 0x0f51, 0x1935: 0x0359, - 0x1936: 0x0f61, 0x1937: 0x0f71, 0x1938: 0x00d9, 0x1939: 0x0f99, 0x193a: 0x2039, 0x193b: 0x0269, - 0x193c: 0x01d9, 0x193d: 0x0fa9, 0x193e: 0x0fb9, 0x193f: 0x1089, - // Block 0x65, offset 0x1940 - 0x1940: 0x0279, 0x1941: 0x0369, 0x1942: 0x0289, 0x1943: 0x13d1, 0x1944: 0x0039, 0x1945: 0x0ee9, - 0x1946: 0x0040, 0x1947: 0x0ef9, 0x1948: 0x0f09, 0x1949: 0x1199, 0x194a: 0x0f31, 0x194b: 0x0040, - 0x194c: 0x0040, 0x194d: 0x0259, 0x194e: 0x0f51, 0x194f: 0x0359, 0x1950: 0x0f61, 0x1951: 0x0f71, - 0x1952: 0x00d9, 0x1953: 0x0f99, 0x1954: 0x2039, 0x1955: 0x0040, 0x1956: 0x01d9, 0x1957: 0x0fa9, - 0x1958: 0x0fb9, 0x1959: 0x1089, 0x195a: 0x0279, 0x195b: 0x0369, 0x195c: 0x0289, 0x195d: 0x0040, - 0x195e: 0x0039, 0x195f: 0x0ee9, 0x1960: 0x1159, 0x1961: 0x0ef9, 0x1962: 0x0f09, 0x1963: 0x1199, - 0x1964: 0x0f31, 0x1965: 0x0249, 0x1966: 0x0f41, 0x1967: 0x0259, 0x1968: 0x0f51, 0x1969: 0x0359, - 0x196a: 0x0f61, 0x196b: 0x0f71, 0x196c: 0x00d9, 0x196d: 0x0f99, 0x196e: 0x2039, 0x196f: 0x0269, - 0x1970: 0x01d9, 0x1971: 0x0fa9, 0x1972: 0x0fb9, 0x1973: 0x1089, 0x1974: 0x0279, 0x1975: 0x0369, - 0x1976: 0x0289, 0x1977: 0x13d1, 0x1978: 0x0039, 0x1979: 0x0ee9, 0x197a: 0x0040, 0x197b: 0x0ef9, - 0x197c: 0x0f09, 0x197d: 0x1199, 0x197e: 0x0f31, 0x197f: 0x0040, - // Block 0x66, offset 0x1980 - 0x1980: 0x0f41, 0x1981: 0x0259, 0x1982: 0x0f51, 0x1983: 0x0359, 0x1984: 0x0f61, 0x1985: 0x0040, - 0x1986: 0x00d9, 0x1987: 0x0040, 0x1988: 0x0040, 0x1989: 0x0040, 0x198a: 0x01d9, 0x198b: 0x0fa9, - 0x198c: 0x0fb9, 0x198d: 0x1089, 0x198e: 0x0279, 0x198f: 0x0369, 0x1990: 0x0289, 0x1991: 0x0040, - 0x1992: 0x0039, 0x1993: 0x0ee9, 0x1994: 0x1159, 0x1995: 0x0ef9, 0x1996: 0x0f09, 0x1997: 0x1199, - 0x1998: 0x0f31, 0x1999: 0x0249, 0x199a: 0x0f41, 0x199b: 0x0259, 0x199c: 0x0f51, 0x199d: 0x0359, - 0x199e: 0x0f61, 0x199f: 0x0f71, 0x19a0: 0x00d9, 0x19a1: 0x0f99, 0x19a2: 0x2039, 0x19a3: 0x0269, - 0x19a4: 0x01d9, 0x19a5: 0x0fa9, 0x19a6: 0x0fb9, 0x19a7: 0x1089, 0x19a8: 0x0279, 0x19a9: 0x0369, - 0x19aa: 0x0289, 0x19ab: 0x13d1, 0x19ac: 0x0039, 0x19ad: 0x0ee9, 0x19ae: 0x1159, 0x19af: 0x0ef9, - 0x19b0: 0x0f09, 0x19b1: 0x1199, 0x19b2: 0x0f31, 0x19b3: 0x0249, 0x19b4: 0x0f41, 0x19b5: 0x0259, - 0x19b6: 0x0f51, 0x19b7: 0x0359, 0x19b8: 0x0f61, 0x19b9: 0x0f71, 0x19ba: 0x00d9, 0x19bb: 0x0f99, - 0x19bc: 0x2039, 0x19bd: 0x0269, 0x19be: 0x01d9, 0x19bf: 0x0fa9, - // Block 0x67, offset 0x19c0 - 0x19c0: 0x0fb9, 0x19c1: 0x1089, 0x19c2: 0x0279, 0x19c3: 0x0369, 0x19c4: 0x0289, 0x19c5: 0x13d1, - 0x19c6: 0x0039, 0x19c7: 0x0ee9, 0x19c8: 0x1159, 0x19c9: 0x0ef9, 0x19ca: 0x0f09, 0x19cb: 0x1199, - 0x19cc: 0x0f31, 0x19cd: 0x0249, 0x19ce: 0x0f41, 0x19cf: 0x0259, 0x19d0: 0x0f51, 0x19d1: 0x0359, - 0x19d2: 0x0f61, 0x19d3: 0x0f71, 0x19d4: 0x00d9, 0x19d5: 0x0f99, 0x19d6: 0x2039, 0x19d7: 0x0269, - 0x19d8: 0x01d9, 0x19d9: 0x0fa9, 0x19da: 0x0fb9, 0x19db: 0x1089, 0x19dc: 0x0279, 0x19dd: 0x0369, - 0x19de: 0x0289, 0x19df: 0x13d1, 0x19e0: 0x0039, 0x19e1: 0x0ee9, 0x19e2: 0x1159, 0x19e3: 0x0ef9, - 0x19e4: 0x0f09, 0x19e5: 0x1199, 0x19e6: 0x0f31, 0x19e7: 0x0249, 0x19e8: 0x0f41, 0x19e9: 0x0259, - 0x19ea: 0x0f51, 0x19eb: 0x0359, 0x19ec: 0x0f61, 0x19ed: 0x0f71, 0x19ee: 0x00d9, 0x19ef: 0x0f99, - 0x19f0: 0x2039, 0x19f1: 0x0269, 0x19f2: 0x01d9, 0x19f3: 0x0fa9, 0x19f4: 0x0fb9, 0x19f5: 0x1089, - 0x19f6: 0x0279, 0x19f7: 0x0369, 0x19f8: 0x0289, 0x19f9: 0x13d1, 0x19fa: 0x0039, 0x19fb: 0x0ee9, - 0x19fc: 0x1159, 0x19fd: 0x0ef9, 0x19fe: 0x0f09, 0x19ff: 0x1199, - // Block 0x68, offset 0x1a00 - 0x1a00: 0x0f31, 0x1a01: 0x0249, 0x1a02: 0x0f41, 0x1a03: 0x0259, 0x1a04: 0x0f51, 0x1a05: 0x0359, - 0x1a06: 0x0f61, 0x1a07: 0x0f71, 0x1a08: 0x00d9, 0x1a09: 0x0f99, 0x1a0a: 0x2039, 0x1a0b: 0x0269, - 0x1a0c: 0x01d9, 0x1a0d: 0x0fa9, 0x1a0e: 0x0fb9, 0x1a0f: 0x1089, 0x1a10: 0x0279, 0x1a11: 0x0369, - 0x1a12: 0x0289, 0x1a13: 0x13d1, 0x1a14: 0x0039, 0x1a15: 0x0ee9, 0x1a16: 0x1159, 0x1a17: 0x0ef9, - 0x1a18: 0x0f09, 0x1a19: 0x1199, 0x1a1a: 0x0f31, 0x1a1b: 0x0249, 0x1a1c: 0x0f41, 0x1a1d: 0x0259, - 0x1a1e: 0x0f51, 0x1a1f: 0x0359, 0x1a20: 0x0f61, 0x1a21: 0x0f71, 0x1a22: 0x00d9, 0x1a23: 0x0f99, - 0x1a24: 0x2039, 0x1a25: 0x0269, 0x1a26: 0x01d9, 0x1a27: 0x0fa9, 0x1a28: 0x0fb9, 0x1a29: 0x1089, - 0x1a2a: 0x0279, 0x1a2b: 0x0369, 0x1a2c: 0x0289, 0x1a2d: 0x13d1, 0x1a2e: 0x0039, 0x1a2f: 0x0ee9, - 0x1a30: 0x1159, 0x1a31: 0x0ef9, 0x1a32: 0x0f09, 0x1a33: 0x1199, 0x1a34: 0x0f31, 0x1a35: 0x0249, - 0x1a36: 0x0f41, 0x1a37: 0x0259, 0x1a38: 0x0f51, 0x1a39: 0x0359, 0x1a3a: 0x0f61, 0x1a3b: 0x0f71, - 0x1a3c: 0x00d9, 0x1a3d: 0x0f99, 0x1a3e: 0x2039, 0x1a3f: 0x0269, - // Block 0x69, offset 0x1a40 - 0x1a40: 0x01d9, 0x1a41: 0x0fa9, 0x1a42: 0x0fb9, 0x1a43: 0x1089, 0x1a44: 0x0279, 0x1a45: 0x0369, - 0x1a46: 0x0289, 0x1a47: 0x13d1, 0x1a48: 0x0039, 0x1a49: 0x0ee9, 0x1a4a: 0x1159, 0x1a4b: 0x0ef9, - 0x1a4c: 0x0f09, 0x1a4d: 0x1199, 0x1a4e: 0x0f31, 0x1a4f: 0x0249, 0x1a50: 0x0f41, 0x1a51: 0x0259, - 0x1a52: 0x0f51, 0x1a53: 0x0359, 0x1a54: 0x0f61, 0x1a55: 0x0f71, 0x1a56: 0x00d9, 0x1a57: 0x0f99, - 0x1a58: 0x2039, 0x1a59: 0x0269, 0x1a5a: 0x01d9, 0x1a5b: 0x0fa9, 0x1a5c: 0x0fb9, 0x1a5d: 0x1089, - 0x1a5e: 0x0279, 0x1a5f: 0x0369, 0x1a60: 0x0289, 0x1a61: 0x13d1, 0x1a62: 0x0039, 0x1a63: 0x0ee9, - 0x1a64: 0x1159, 0x1a65: 0x0ef9, 0x1a66: 0x0f09, 0x1a67: 0x1199, 0x1a68: 0x0f31, 0x1a69: 0x0249, - 0x1a6a: 0x0f41, 0x1a6b: 0x0259, 0x1a6c: 0x0f51, 0x1a6d: 0x0359, 0x1a6e: 0x0f61, 0x1a6f: 0x0f71, - 0x1a70: 0x00d9, 0x1a71: 0x0f99, 0x1a72: 0x2039, 0x1a73: 0x0269, 0x1a74: 0x01d9, 0x1a75: 0x0fa9, - 0x1a76: 0x0fb9, 0x1a77: 0x1089, 0x1a78: 0x0279, 0x1a79: 0x0369, 0x1a7a: 0x0289, 0x1a7b: 0x13d1, - 0x1a7c: 0x0039, 0x1a7d: 0x0ee9, 0x1a7e: 0x1159, 0x1a7f: 0x0ef9, - // Block 0x6a, offset 0x1a80 - 0x1a80: 0x0f09, 0x1a81: 0x1199, 0x1a82: 0x0f31, 0x1a83: 0x0249, 0x1a84: 0x0f41, 0x1a85: 0x0259, - 0x1a86: 0x0f51, 0x1a87: 0x0359, 0x1a88: 0x0f61, 0x1a89: 0x0f71, 0x1a8a: 0x00d9, 0x1a8b: 0x0f99, - 0x1a8c: 0x2039, 0x1a8d: 0x0269, 0x1a8e: 0x01d9, 0x1a8f: 0x0fa9, 0x1a90: 0x0fb9, 0x1a91: 0x1089, - 0x1a92: 0x0279, 0x1a93: 0x0369, 0x1a94: 0x0289, 0x1a95: 0x13d1, 0x1a96: 0x0039, 0x1a97: 0x0ee9, - 0x1a98: 0x1159, 0x1a99: 0x0ef9, 0x1a9a: 0x0f09, 0x1a9b: 0x1199, 0x1a9c: 0x0f31, 0x1a9d: 0x0249, - 0x1a9e: 0x0f41, 0x1a9f: 0x0259, 0x1aa0: 0x0f51, 0x1aa1: 0x0359, 0x1aa2: 0x0f61, 0x1aa3: 0x0f71, - 0x1aa4: 0x00d9, 0x1aa5: 0x0f99, 0x1aa6: 0x2039, 0x1aa7: 0x0269, 0x1aa8: 0x01d9, 0x1aa9: 0x0fa9, - 0x1aaa: 0x0fb9, 0x1aab: 0x1089, 0x1aac: 0x0279, 0x1aad: 0x0369, 0x1aae: 0x0289, 0x1aaf: 0x13d1, - 0x1ab0: 0x0039, 0x1ab1: 0x0ee9, 0x1ab2: 0x1159, 0x1ab3: 0x0ef9, 0x1ab4: 0x0f09, 0x1ab5: 0x1199, - 0x1ab6: 0x0f31, 0x1ab7: 0x0249, 0x1ab8: 0x0f41, 0x1ab9: 0x0259, 0x1aba: 0x0f51, 0x1abb: 0x0359, - 0x1abc: 0x0f61, 0x1abd: 0x0f71, 0x1abe: 0x00d9, 0x1abf: 0x0f99, - // Block 0x6b, offset 0x1ac0 - 0x1ac0: 0x2039, 0x1ac1: 0x0269, 0x1ac2: 0x01d9, 0x1ac3: 0x0fa9, 0x1ac4: 0x0fb9, 0x1ac5: 0x1089, - 0x1ac6: 0x0279, 0x1ac7: 0x0369, 0x1ac8: 0x0289, 0x1ac9: 0x13d1, 0x1aca: 0x0039, 0x1acb: 0x0ee9, - 0x1acc: 0x1159, 0x1acd: 0x0ef9, 0x1ace: 0x0f09, 0x1acf: 0x1199, 0x1ad0: 0x0f31, 0x1ad1: 0x0249, - 0x1ad2: 0x0f41, 0x1ad3: 0x0259, 0x1ad4: 0x0f51, 0x1ad5: 0x0359, 0x1ad6: 0x0f61, 0x1ad7: 0x0f71, - 0x1ad8: 0x00d9, 0x1ad9: 0x0f99, 0x1ada: 0x2039, 0x1adb: 0x0269, 0x1adc: 0x01d9, 0x1add: 0x0fa9, - 0x1ade: 0x0fb9, 0x1adf: 0x1089, 0x1ae0: 0x0279, 0x1ae1: 0x0369, 0x1ae2: 0x0289, 0x1ae3: 0x13d1, - 0x1ae4: 0xba81, 0x1ae5: 0xba99, 0x1ae6: 0x0040, 0x1ae7: 0x0040, 0x1ae8: 0xbab1, 0x1ae9: 0x1099, - 0x1aea: 0x10b1, 0x1aeb: 0x10c9, 0x1aec: 0xbac9, 0x1aed: 0xbae1, 0x1aee: 0xbaf9, 0x1aef: 0x1429, - 0x1af0: 0x1a31, 0x1af1: 0xbb11, 0x1af2: 0xbb29, 0x1af3: 0xbb41, 0x1af4: 0xbb59, 0x1af5: 0xbb71, - 0x1af6: 0xbb89, 0x1af7: 0x2109, 0x1af8: 0x1111, 0x1af9: 0x1429, 0x1afa: 0xbba1, 0x1afb: 0xbbb9, - 0x1afc: 0xbbd1, 0x1afd: 0x10e1, 0x1afe: 0x10f9, 0x1aff: 0xbbe9, - // Block 0x6c, offset 0x1b00 - 0x1b00: 0x2079, 0x1b01: 0xbc01, 0x1b02: 0xbab1, 0x1b03: 0x1099, 0x1b04: 0x10b1, 0x1b05: 0x10c9, - 0x1b06: 0xbac9, 0x1b07: 0xbae1, 0x1b08: 0xbaf9, 0x1b09: 0x1429, 0x1b0a: 0x1a31, 0x1b0b: 0xbb11, - 0x1b0c: 0xbb29, 0x1b0d: 0xbb41, 0x1b0e: 0xbb59, 0x1b0f: 0xbb71, 0x1b10: 0xbb89, 0x1b11: 0x2109, - 0x1b12: 0x1111, 0x1b13: 0xbba1, 0x1b14: 0xbba1, 0x1b15: 0xbbb9, 0x1b16: 0xbbd1, 0x1b17: 0x10e1, - 0x1b18: 0x10f9, 0x1b19: 0xbbe9, 0x1b1a: 0x2079, 0x1b1b: 0xbc21, 0x1b1c: 0xbac9, 0x1b1d: 0x1429, - 0x1b1e: 0xbb11, 0x1b1f: 0x10e1, 0x1b20: 0x1111, 0x1b21: 0x2109, 0x1b22: 0xbab1, 0x1b23: 0x1099, - 0x1b24: 0x10b1, 0x1b25: 0x10c9, 0x1b26: 0xbac9, 0x1b27: 0xbae1, 0x1b28: 0xbaf9, 0x1b29: 0x1429, - 0x1b2a: 0x1a31, 0x1b2b: 0xbb11, 0x1b2c: 0xbb29, 0x1b2d: 0xbb41, 0x1b2e: 0xbb59, 0x1b2f: 0xbb71, - 0x1b30: 0xbb89, 0x1b31: 0x2109, 0x1b32: 0x1111, 0x1b33: 0x1429, 0x1b34: 0xbba1, 0x1b35: 0xbbb9, - 0x1b36: 0xbbd1, 0x1b37: 0x10e1, 0x1b38: 0x10f9, 0x1b39: 0xbbe9, 0x1b3a: 0x2079, 0x1b3b: 0xbc01, - 0x1b3c: 0xbab1, 0x1b3d: 0x1099, 0x1b3e: 0x10b1, 0x1b3f: 0x10c9, - // Block 0x6d, offset 0x1b40 - 0x1b40: 0xbac9, 0x1b41: 0xbae1, 0x1b42: 0xbaf9, 0x1b43: 0x1429, 0x1b44: 0x1a31, 0x1b45: 0xbb11, - 0x1b46: 0xbb29, 0x1b47: 0xbb41, 0x1b48: 0xbb59, 0x1b49: 0xbb71, 0x1b4a: 0xbb89, 0x1b4b: 0x2109, - 0x1b4c: 0x1111, 0x1b4d: 0xbba1, 0x1b4e: 0xbba1, 0x1b4f: 0xbbb9, 0x1b50: 0xbbd1, 0x1b51: 0x10e1, - 0x1b52: 0x10f9, 0x1b53: 0xbbe9, 0x1b54: 0x2079, 0x1b55: 0xbc21, 0x1b56: 0xbac9, 0x1b57: 0x1429, - 0x1b58: 0xbb11, 0x1b59: 0x10e1, 0x1b5a: 0x1111, 0x1b5b: 0x2109, 0x1b5c: 0xbab1, 0x1b5d: 0x1099, - 0x1b5e: 0x10b1, 0x1b5f: 0x10c9, 0x1b60: 0xbac9, 0x1b61: 0xbae1, 0x1b62: 0xbaf9, 0x1b63: 0x1429, - 0x1b64: 0x1a31, 0x1b65: 0xbb11, 0x1b66: 0xbb29, 0x1b67: 0xbb41, 0x1b68: 0xbb59, 0x1b69: 0xbb71, - 0x1b6a: 0xbb89, 0x1b6b: 0x2109, 0x1b6c: 0x1111, 0x1b6d: 0x1429, 0x1b6e: 0xbba1, 0x1b6f: 0xbbb9, - 0x1b70: 0xbbd1, 0x1b71: 0x10e1, 0x1b72: 0x10f9, 0x1b73: 0xbbe9, 0x1b74: 0x2079, 0x1b75: 0xbc01, - 0x1b76: 0xbab1, 0x1b77: 0x1099, 0x1b78: 0x10b1, 0x1b79: 0x10c9, 0x1b7a: 0xbac9, 0x1b7b: 0xbae1, - 0x1b7c: 0xbaf9, 0x1b7d: 0x1429, 0x1b7e: 0x1a31, 0x1b7f: 0xbb11, - // Block 0x6e, offset 0x1b80 - 0x1b80: 0xbb29, 0x1b81: 0xbb41, 0x1b82: 0xbb59, 0x1b83: 0xbb71, 0x1b84: 0xbb89, 0x1b85: 0x2109, - 0x1b86: 0x1111, 0x1b87: 0xbba1, 0x1b88: 0xbba1, 0x1b89: 0xbbb9, 0x1b8a: 0xbbd1, 0x1b8b: 0x10e1, - 0x1b8c: 0x10f9, 0x1b8d: 0xbbe9, 0x1b8e: 0x2079, 0x1b8f: 0xbc21, 0x1b90: 0xbac9, 0x1b91: 0x1429, - 0x1b92: 0xbb11, 0x1b93: 0x10e1, 0x1b94: 0x1111, 0x1b95: 0x2109, 0x1b96: 0xbab1, 0x1b97: 0x1099, - 0x1b98: 0x10b1, 0x1b99: 0x10c9, 0x1b9a: 0xbac9, 0x1b9b: 0xbae1, 0x1b9c: 0xbaf9, 0x1b9d: 0x1429, - 0x1b9e: 0x1a31, 0x1b9f: 0xbb11, 0x1ba0: 0xbb29, 0x1ba1: 0xbb41, 0x1ba2: 0xbb59, 0x1ba3: 0xbb71, - 0x1ba4: 0xbb89, 0x1ba5: 0x2109, 0x1ba6: 0x1111, 0x1ba7: 0x1429, 0x1ba8: 0xbba1, 0x1ba9: 0xbbb9, - 0x1baa: 0xbbd1, 0x1bab: 0x10e1, 0x1bac: 0x10f9, 0x1bad: 0xbbe9, 0x1bae: 0x2079, 0x1baf: 0xbc01, - 0x1bb0: 0xbab1, 0x1bb1: 0x1099, 0x1bb2: 0x10b1, 0x1bb3: 0x10c9, 0x1bb4: 0xbac9, 0x1bb5: 0xbae1, - 0x1bb6: 0xbaf9, 0x1bb7: 0x1429, 0x1bb8: 0x1a31, 0x1bb9: 0xbb11, 0x1bba: 0xbb29, 0x1bbb: 0xbb41, - 0x1bbc: 0xbb59, 0x1bbd: 0xbb71, 0x1bbe: 0xbb89, 0x1bbf: 0x2109, - // Block 0x6f, offset 0x1bc0 - 0x1bc0: 0x1111, 0x1bc1: 0xbba1, 0x1bc2: 0xbba1, 0x1bc3: 0xbbb9, 0x1bc4: 0xbbd1, 0x1bc5: 0x10e1, - 0x1bc6: 0x10f9, 0x1bc7: 0xbbe9, 0x1bc8: 0x2079, 0x1bc9: 0xbc21, 0x1bca: 0xbac9, 0x1bcb: 0x1429, - 0x1bcc: 0xbb11, 0x1bcd: 0x10e1, 0x1bce: 0x1111, 0x1bcf: 0x2109, 0x1bd0: 0xbab1, 0x1bd1: 0x1099, - 0x1bd2: 0x10b1, 0x1bd3: 0x10c9, 0x1bd4: 0xbac9, 0x1bd5: 0xbae1, 0x1bd6: 0xbaf9, 0x1bd7: 0x1429, - 0x1bd8: 0x1a31, 0x1bd9: 0xbb11, 0x1bda: 0xbb29, 0x1bdb: 0xbb41, 0x1bdc: 0xbb59, 0x1bdd: 0xbb71, - 0x1bde: 0xbb89, 0x1bdf: 0x2109, 0x1be0: 0x1111, 0x1be1: 0x1429, 0x1be2: 0xbba1, 0x1be3: 0xbbb9, - 0x1be4: 0xbbd1, 0x1be5: 0x10e1, 0x1be6: 0x10f9, 0x1be7: 0xbbe9, 0x1be8: 0x2079, 0x1be9: 0xbc01, - 0x1bea: 0xbab1, 0x1beb: 0x1099, 0x1bec: 0x10b1, 0x1bed: 0x10c9, 0x1bee: 0xbac9, 0x1bef: 0xbae1, - 0x1bf0: 0xbaf9, 0x1bf1: 0x1429, 0x1bf2: 0x1a31, 0x1bf3: 0xbb11, 0x1bf4: 0xbb29, 0x1bf5: 0xbb41, - 0x1bf6: 0xbb59, 0x1bf7: 0xbb71, 0x1bf8: 0xbb89, 0x1bf9: 0x2109, 0x1bfa: 0x1111, 0x1bfb: 0xbba1, - 0x1bfc: 0xbba1, 0x1bfd: 0xbbb9, 0x1bfe: 0xbbd1, 0x1bff: 0x10e1, - // Block 0x70, offset 0x1c00 - 0x1c00: 0x10f9, 0x1c01: 0xbbe9, 0x1c02: 0x2079, 0x1c03: 0xbc21, 0x1c04: 0xbac9, 0x1c05: 0x1429, - 0x1c06: 0xbb11, 0x1c07: 0x10e1, 0x1c08: 0x1111, 0x1c09: 0x2109, 0x1c0a: 0xbc41, 0x1c0b: 0xbc41, - 0x1c0c: 0x0040, 0x1c0d: 0x0040, 0x1c0e: 0x1f41, 0x1c0f: 0x00c9, 0x1c10: 0x0069, 0x1c11: 0x0079, - 0x1c12: 0x1f51, 0x1c13: 0x1f61, 0x1c14: 0x1f71, 0x1c15: 0x1f81, 0x1c16: 0x1f91, 0x1c17: 0x1fa1, - 0x1c18: 0x1f41, 0x1c19: 0x00c9, 0x1c1a: 0x0069, 0x1c1b: 0x0079, 0x1c1c: 0x1f51, 0x1c1d: 0x1f61, - 0x1c1e: 0x1f71, 0x1c1f: 0x1f81, 0x1c20: 0x1f91, 0x1c21: 0x1fa1, 0x1c22: 0x1f41, 0x1c23: 0x00c9, - 0x1c24: 0x0069, 0x1c25: 0x0079, 0x1c26: 0x1f51, 0x1c27: 0x1f61, 0x1c28: 0x1f71, 0x1c29: 0x1f81, - 0x1c2a: 0x1f91, 0x1c2b: 0x1fa1, 0x1c2c: 0x1f41, 0x1c2d: 0x00c9, 0x1c2e: 0x0069, 0x1c2f: 0x0079, - 0x1c30: 0x1f51, 0x1c31: 0x1f61, 0x1c32: 0x1f71, 0x1c33: 0x1f81, 0x1c34: 0x1f91, 0x1c35: 0x1fa1, - 0x1c36: 0x1f41, 0x1c37: 0x00c9, 0x1c38: 0x0069, 0x1c39: 0x0079, 0x1c3a: 0x1f51, 0x1c3b: 0x1f61, - 0x1c3c: 0x1f71, 0x1c3d: 0x1f81, 0x1c3e: 0x1f91, 0x1c3f: 0x1fa1, - // Block 0x71, offset 0x1c40 - 0x1c40: 0xe115, 0x1c41: 0xe115, 0x1c42: 0xe135, 0x1c43: 0xe135, 0x1c44: 0xe115, 0x1c45: 0xe115, - 0x1c46: 0xe175, 0x1c47: 0xe175, 0x1c48: 0xe115, 0x1c49: 0xe115, 0x1c4a: 0xe135, 0x1c4b: 0xe135, - 0x1c4c: 0xe115, 0x1c4d: 0xe115, 0x1c4e: 0xe1f5, 0x1c4f: 0xe1f5, 0x1c50: 0xe115, 0x1c51: 0xe115, - 0x1c52: 0xe135, 0x1c53: 0xe135, 0x1c54: 0xe115, 0x1c55: 0xe115, 0x1c56: 0xe175, 0x1c57: 0xe175, - 0x1c58: 0xe115, 0x1c59: 0xe115, 0x1c5a: 0xe135, 0x1c5b: 0xe135, 0x1c5c: 0xe115, 0x1c5d: 0xe115, - 0x1c5e: 0x8b3d, 0x1c5f: 0x8b3d, 0x1c60: 0x04b5, 0x1c61: 0x04b5, 0x1c62: 0x0a08, 0x1c63: 0x0a08, - 0x1c64: 0x0a08, 0x1c65: 0x0a08, 0x1c66: 0x0a08, 0x1c67: 0x0a08, 0x1c68: 0x0a08, 0x1c69: 0x0a08, - 0x1c6a: 0x0a08, 0x1c6b: 0x0a08, 0x1c6c: 0x0a08, 0x1c6d: 0x0a08, 0x1c6e: 0x0a08, 0x1c6f: 0x0a08, - 0x1c70: 0x0a08, 0x1c71: 0x0a08, 0x1c72: 0x0a08, 0x1c73: 0x0a08, 0x1c74: 0x0a08, 0x1c75: 0x0a08, - 0x1c76: 0x0a08, 0x1c77: 0x0a08, 0x1c78: 0x0a08, 0x1c79: 0x0a08, 0x1c7a: 0x0a08, 0x1c7b: 0x0a08, - 0x1c7c: 0x0a08, 0x1c7d: 0x0a08, 0x1c7e: 0x0a08, 0x1c7f: 0x0a08, - // Block 0x72, offset 0x1c80 - 0x1c80: 0xb189, 0x1c81: 0xb1a1, 0x1c82: 0xb201, 0x1c83: 0xb249, 0x1c84: 0x0040, 0x1c85: 0xb411, - 0x1c86: 0xb291, 0x1c87: 0xb219, 0x1c88: 0xb309, 0x1c89: 0xb429, 0x1c8a: 0xb399, 0x1c8b: 0xb3b1, - 0x1c8c: 0xb3c9, 0x1c8d: 0xb3e1, 0x1c8e: 0xb2a9, 0x1c8f: 0xb339, 0x1c90: 0xb369, 0x1c91: 0xb2d9, - 0x1c92: 0xb381, 0x1c93: 0xb279, 0x1c94: 0xb2c1, 0x1c95: 0xb1d1, 0x1c96: 0xb1e9, 0x1c97: 0xb231, - 0x1c98: 0xb261, 0x1c99: 0xb2f1, 0x1c9a: 0xb321, 0x1c9b: 0xb351, 0x1c9c: 0xbc59, 0x1c9d: 0x7949, - 0x1c9e: 0xbc71, 0x1c9f: 0xbc89, 0x1ca0: 0x0040, 0x1ca1: 0xb1a1, 0x1ca2: 0xb201, 0x1ca3: 0x0040, - 0x1ca4: 0xb3f9, 0x1ca5: 0x0040, 0x1ca6: 0x0040, 0x1ca7: 0xb219, 0x1ca8: 0x0040, 0x1ca9: 0xb429, - 0x1caa: 0xb399, 0x1cab: 0xb3b1, 0x1cac: 0xb3c9, 0x1cad: 0xb3e1, 0x1cae: 0xb2a9, 0x1caf: 0xb339, - 0x1cb0: 0xb369, 0x1cb1: 0xb2d9, 0x1cb2: 0xb381, 0x1cb3: 0x0040, 0x1cb4: 0xb2c1, 0x1cb5: 0xb1d1, - 0x1cb6: 0xb1e9, 0x1cb7: 0xb231, 0x1cb8: 0x0040, 0x1cb9: 0xb2f1, 0x1cba: 0x0040, 0x1cbb: 0xb351, - 0x1cbc: 0x0040, 0x1cbd: 0x0040, 0x1cbe: 0x0040, 0x1cbf: 0x0040, - // Block 0x73, offset 0x1cc0 - 0x1cc0: 0x0040, 0x1cc1: 0x0040, 0x1cc2: 0xb201, 0x1cc3: 0x0040, 0x1cc4: 0x0040, 0x1cc5: 0x0040, - 0x1cc6: 0x0040, 0x1cc7: 0xb219, 0x1cc8: 0x0040, 0x1cc9: 0xb429, 0x1cca: 0x0040, 0x1ccb: 0xb3b1, - 0x1ccc: 0x0040, 0x1ccd: 0xb3e1, 0x1cce: 0xb2a9, 0x1ccf: 0xb339, 0x1cd0: 0x0040, 0x1cd1: 0xb2d9, - 0x1cd2: 0xb381, 0x1cd3: 0x0040, 0x1cd4: 0xb2c1, 0x1cd5: 0x0040, 0x1cd6: 0x0040, 0x1cd7: 0xb231, - 0x1cd8: 0x0040, 0x1cd9: 0xb2f1, 0x1cda: 0x0040, 0x1cdb: 0xb351, 0x1cdc: 0x0040, 0x1cdd: 0x7949, - 0x1cde: 0x0040, 0x1cdf: 0xbc89, 0x1ce0: 0x0040, 0x1ce1: 0xb1a1, 0x1ce2: 0xb201, 0x1ce3: 0x0040, - 0x1ce4: 0xb3f9, 0x1ce5: 0x0040, 0x1ce6: 0x0040, 0x1ce7: 0xb219, 0x1ce8: 0xb309, 0x1ce9: 0xb429, - 0x1cea: 0xb399, 0x1ceb: 0x0040, 0x1cec: 0xb3c9, 0x1ced: 0xb3e1, 0x1cee: 0xb2a9, 0x1cef: 0xb339, - 0x1cf0: 0xb369, 0x1cf1: 0xb2d9, 0x1cf2: 0xb381, 0x1cf3: 0x0040, 0x1cf4: 0xb2c1, 0x1cf5: 0xb1d1, - 0x1cf6: 0xb1e9, 0x1cf7: 0xb231, 0x1cf8: 0x0040, 0x1cf9: 0xb2f1, 0x1cfa: 0xb321, 0x1cfb: 0xb351, - 0x1cfc: 0xbc59, 0x1cfd: 0x0040, 0x1cfe: 0xbc71, 0x1cff: 0x0040, - // Block 0x74, offset 0x1d00 - 0x1d00: 0xb189, 0x1d01: 0xb1a1, 0x1d02: 0xb201, 0x1d03: 0xb249, 0x1d04: 0xb3f9, 0x1d05: 0xb411, - 0x1d06: 0xb291, 0x1d07: 0xb219, 0x1d08: 0xb309, 0x1d09: 0xb429, 0x1d0a: 0x0040, 0x1d0b: 0xb3b1, - 0x1d0c: 0xb3c9, 0x1d0d: 0xb3e1, 0x1d0e: 0xb2a9, 0x1d0f: 0xb339, 0x1d10: 0xb369, 0x1d11: 0xb2d9, - 0x1d12: 0xb381, 0x1d13: 0xb279, 0x1d14: 0xb2c1, 0x1d15: 0xb1d1, 0x1d16: 0xb1e9, 0x1d17: 0xb231, - 0x1d18: 0xb261, 0x1d19: 0xb2f1, 0x1d1a: 0xb321, 0x1d1b: 0xb351, 0x1d1c: 0x0040, 0x1d1d: 0x0040, - 0x1d1e: 0x0040, 0x1d1f: 0x0040, 0x1d20: 0x0040, 0x1d21: 0xb1a1, 0x1d22: 0xb201, 0x1d23: 0xb249, - 0x1d24: 0x0040, 0x1d25: 0xb411, 0x1d26: 0xb291, 0x1d27: 0xb219, 0x1d28: 0xb309, 0x1d29: 0xb429, - 0x1d2a: 0x0040, 0x1d2b: 0xb3b1, 0x1d2c: 0xb3c9, 0x1d2d: 0xb3e1, 0x1d2e: 0xb2a9, 0x1d2f: 0xb339, - 0x1d30: 0xb369, 0x1d31: 0xb2d9, 0x1d32: 0xb381, 0x1d33: 0xb279, 0x1d34: 0xb2c1, 0x1d35: 0xb1d1, - 0x1d36: 0xb1e9, 0x1d37: 0xb231, 0x1d38: 0xb261, 0x1d39: 0xb2f1, 0x1d3a: 0xb321, 0x1d3b: 0xb351, - 0x1d3c: 0x0040, 0x1d3d: 0x0040, 0x1d3e: 0x0040, 0x1d3f: 0x0040, - // Block 0x75, offset 0x1d40 - 0x1d40: 0x0040, 0x1d41: 0xbca2, 0x1d42: 0xbcba, 0x1d43: 0xbcd2, 0x1d44: 0xbcea, 0x1d45: 0xbd02, - 0x1d46: 0xbd1a, 0x1d47: 0xbd32, 0x1d48: 0xbd4a, 0x1d49: 0xbd62, 0x1d4a: 0xbd7a, 0x1d4b: 0x0018, - 0x1d4c: 0x0018, 0x1d4d: 0x0040, 0x1d4e: 0x0040, 0x1d4f: 0x0040, 0x1d50: 0xbd92, 0x1d51: 0xbdb2, - 0x1d52: 0xbdd2, 0x1d53: 0xbdf2, 0x1d54: 0xbe12, 0x1d55: 0xbe32, 0x1d56: 0xbe52, 0x1d57: 0xbe72, - 0x1d58: 0xbe92, 0x1d59: 0xbeb2, 0x1d5a: 0xbed2, 0x1d5b: 0xbef2, 0x1d5c: 0xbf12, 0x1d5d: 0xbf32, - 0x1d5e: 0xbf52, 0x1d5f: 0xbf72, 0x1d60: 0xbf92, 0x1d61: 0xbfb2, 0x1d62: 0xbfd2, 0x1d63: 0xbff2, - 0x1d64: 0xc012, 0x1d65: 0xc032, 0x1d66: 0xc052, 0x1d67: 0xc072, 0x1d68: 0xc092, 0x1d69: 0xc0b2, - 0x1d6a: 0xc0d1, 0x1d6b: 0x1159, 0x1d6c: 0x0269, 0x1d6d: 0x6671, 0x1d6e: 0xc111, 0x1d6f: 0x0018, - 0x1d70: 0x0039, 0x1d71: 0x0ee9, 0x1d72: 0x1159, 0x1d73: 0x0ef9, 0x1d74: 0x0f09, 0x1d75: 0x1199, - 0x1d76: 0x0f31, 0x1d77: 0x0249, 0x1d78: 0x0f41, 0x1d79: 0x0259, 0x1d7a: 0x0f51, 0x1d7b: 0x0359, - 0x1d7c: 0x0f61, 0x1d7d: 0x0f71, 0x1d7e: 0x00d9, 0x1d7f: 0x0f99, - // Block 0x76, offset 0x1d80 - 0x1d80: 0x2039, 0x1d81: 0x0269, 0x1d82: 0x01d9, 0x1d83: 0x0fa9, 0x1d84: 0x0fb9, 0x1d85: 0x1089, - 0x1d86: 0x0279, 0x1d87: 0x0369, 0x1d88: 0x0289, 0x1d89: 0x13d1, 0x1d8a: 0xc129, 0x1d8b: 0x65b1, - 0x1d8c: 0xc141, 0x1d8d: 0x1441, 0x1d8e: 0xc159, 0x1d8f: 0xc179, 0x1d90: 0x0018, 0x1d91: 0x0018, - 0x1d92: 0x0018, 0x1d93: 0x0018, 0x1d94: 0x0018, 0x1d95: 0x0018, 0x1d96: 0x0018, 0x1d97: 0x0018, - 0x1d98: 0x0018, 0x1d99: 0x0018, 0x1d9a: 0x0018, 0x1d9b: 0x0018, 0x1d9c: 0x0018, 0x1d9d: 0x0018, - 0x1d9e: 0x0018, 0x1d9f: 0x0018, 0x1da0: 0x0018, 0x1da1: 0x0018, 0x1da2: 0x0018, 0x1da3: 0x0018, - 0x1da4: 0x0018, 0x1da5: 0x0018, 0x1da6: 0x0018, 0x1da7: 0x0018, 0x1da8: 0x0018, 0x1da9: 0x0018, - 0x1daa: 0xc191, 0x1dab: 0xc1a9, 0x1dac: 0xc1c1, 0x1dad: 0x0040, 0x1dae: 0x0040, 0x1daf: 0x0040, - 0x1db0: 0x0018, 0x1db1: 0x0018, 0x1db2: 0x0018, 0x1db3: 0x0018, 0x1db4: 0x0018, 0x1db5: 0x0018, - 0x1db6: 0x0018, 0x1db7: 0x0018, 0x1db8: 0x0018, 0x1db9: 0x0018, 0x1dba: 0x0018, 0x1dbb: 0x0018, - 0x1dbc: 0x0018, 0x1dbd: 0x0018, 0x1dbe: 0x0018, 0x1dbf: 0x0018, - // Block 0x77, offset 0x1dc0 - 0x1dc0: 0xc1f1, 0x1dc1: 0xc229, 0x1dc2: 0xc261, 0x1dc3: 0x0040, 0x1dc4: 0x0040, 0x1dc5: 0x0040, - 0x1dc6: 0x0040, 0x1dc7: 0x0040, 0x1dc8: 0x0040, 0x1dc9: 0x0040, 0x1dca: 0x0040, 0x1dcb: 0x0040, - 0x1dcc: 0x0040, 0x1dcd: 0x0040, 0x1dce: 0x0040, 0x1dcf: 0x0040, 0x1dd0: 0xc281, 0x1dd1: 0xc2a1, - 0x1dd2: 0xc2c1, 0x1dd3: 0xc2e1, 0x1dd4: 0xc301, 0x1dd5: 0xc321, 0x1dd6: 0xc341, 0x1dd7: 0xc361, - 0x1dd8: 0xc381, 0x1dd9: 0xc3a1, 0x1dda: 0xc3c1, 0x1ddb: 0xc3e1, 0x1ddc: 0xc401, 0x1ddd: 0xc421, - 0x1dde: 0xc441, 0x1ddf: 0xc461, 0x1de0: 0xc481, 0x1de1: 0xc4a1, 0x1de2: 0xc4c1, 0x1de3: 0xc4e1, - 0x1de4: 0xc501, 0x1de5: 0xc521, 0x1de6: 0xc541, 0x1de7: 0xc561, 0x1de8: 0xc581, 0x1de9: 0xc5a1, - 0x1dea: 0xc5c1, 0x1deb: 0xc5e1, 0x1dec: 0xc601, 0x1ded: 0xc621, 0x1dee: 0xc641, 0x1def: 0xc661, - 0x1df0: 0xc681, 0x1df1: 0xc6a1, 0x1df2: 0xc6c1, 0x1df3: 0xc6e1, 0x1df4: 0xc701, 0x1df5: 0xc721, - 0x1df6: 0xc741, 0x1df7: 0xc761, 0x1df8: 0xc781, 0x1df9: 0xc7a1, 0x1dfa: 0xc7c1, 0x1dfb: 0xc7e1, - 0x1dfc: 0x0040, 0x1dfd: 0x0040, 0x1dfe: 0x0040, 0x1dff: 0x0040, - // Block 0x78, offset 0x1e00 - 0x1e00: 0xcb11, 0x1e01: 0xcb31, 0x1e02: 0xcb51, 0x1e03: 0x8b55, 0x1e04: 0xcb71, 0x1e05: 0xcb91, - 0x1e06: 0xcbb1, 0x1e07: 0xcbd1, 0x1e08: 0xcbf1, 0x1e09: 0xcc11, 0x1e0a: 0xcc31, 0x1e0b: 0xcc51, - 0x1e0c: 0xcc71, 0x1e0d: 0x8b75, 0x1e0e: 0xcc91, 0x1e0f: 0xccb1, 0x1e10: 0xccd1, 0x1e11: 0xccf1, - 0x1e12: 0x8b95, 0x1e13: 0xcd11, 0x1e14: 0xcd31, 0x1e15: 0xc441, 0x1e16: 0x8bb5, 0x1e17: 0xcd51, - 0x1e18: 0xcd71, 0x1e19: 0xcd91, 0x1e1a: 0xcdb1, 0x1e1b: 0xcdd1, 0x1e1c: 0x8bd5, 0x1e1d: 0xcdf1, - 0x1e1e: 0xce11, 0x1e1f: 0xce31, 0x1e20: 0xce51, 0x1e21: 0xce71, 0x1e22: 0xc7a1, 0x1e23: 0xce91, - 0x1e24: 0xceb1, 0x1e25: 0xced1, 0x1e26: 0xcef1, 0x1e27: 0xcf11, 0x1e28: 0xcf31, 0x1e29: 0xcf51, - 0x1e2a: 0xcf71, 0x1e2b: 0xcf91, 0x1e2c: 0xcfb1, 0x1e2d: 0xcfd1, 0x1e2e: 0xcff1, 0x1e2f: 0xd011, - 0x1e30: 0xd031, 0x1e31: 0xd051, 0x1e32: 0xd051, 0x1e33: 0xd051, 0x1e34: 0x8bf5, 0x1e35: 0xd071, - 0x1e36: 0xd091, 0x1e37: 0xd0b1, 0x1e38: 0x8c15, 0x1e39: 0xd0d1, 0x1e3a: 0xd0f1, 0x1e3b: 0xd111, - 0x1e3c: 0xd131, 0x1e3d: 0xd151, 0x1e3e: 0xd171, 0x1e3f: 0xd191, - // Block 0x79, offset 0x1e40 - 0x1e40: 0xd1b1, 0x1e41: 0xd1d1, 0x1e42: 0xd1f1, 0x1e43: 0xd211, 0x1e44: 0xd231, 0x1e45: 0xd251, - 0x1e46: 0xd251, 0x1e47: 0xd271, 0x1e48: 0xd291, 0x1e49: 0xd2b1, 0x1e4a: 0xd2d1, 0x1e4b: 0xd2f1, - 0x1e4c: 0xd311, 0x1e4d: 0xd331, 0x1e4e: 0xd351, 0x1e4f: 0xd371, 0x1e50: 0xd391, 0x1e51: 0xd3b1, - 0x1e52: 0xd3d1, 0x1e53: 0xd3f1, 0x1e54: 0xd411, 0x1e55: 0xd431, 0x1e56: 0xd451, 0x1e57: 0xd471, - 0x1e58: 0xd491, 0x1e59: 0x8c35, 0x1e5a: 0xd4b1, 0x1e5b: 0xd4d1, 0x1e5c: 0xd4f1, 0x1e5d: 0xc321, - 0x1e5e: 0xd511, 0x1e5f: 0xd531, 0x1e60: 0x8c55, 0x1e61: 0x8c75, 0x1e62: 0xd551, 0x1e63: 0xd571, - 0x1e64: 0xd591, 0x1e65: 0xd5b1, 0x1e66: 0xd5d1, 0x1e67: 0xd5f1, 0x1e68: 0x2040, 0x1e69: 0xd611, - 0x1e6a: 0xd631, 0x1e6b: 0xd631, 0x1e6c: 0x8c95, 0x1e6d: 0xd651, 0x1e6e: 0xd671, 0x1e6f: 0xd691, - 0x1e70: 0xd6b1, 0x1e71: 0x8cb5, 0x1e72: 0xd6d1, 0x1e73: 0xd6f1, 0x1e74: 0x2040, 0x1e75: 0xd711, - 0x1e76: 0xd731, 0x1e77: 0xd751, 0x1e78: 0xd771, 0x1e79: 0xd791, 0x1e7a: 0xd7b1, 0x1e7b: 0x8cd5, - 0x1e7c: 0xd7d1, 0x1e7d: 0x8cf5, 0x1e7e: 0xd7f1, 0x1e7f: 0xd811, - // Block 0x7a, offset 0x1e80 - 0x1e80: 0xd831, 0x1e81: 0xd851, 0x1e82: 0xd871, 0x1e83: 0xd891, 0x1e84: 0xd8b1, 0x1e85: 0xd8d1, - 0x1e86: 0xd8f1, 0x1e87: 0xd911, 0x1e88: 0xd931, 0x1e89: 0x8d15, 0x1e8a: 0xd951, 0x1e8b: 0xd971, - 0x1e8c: 0xd991, 0x1e8d: 0xd9b1, 0x1e8e: 0xd9d1, 0x1e8f: 0x8d35, 0x1e90: 0xd9f1, 0x1e91: 0x8d55, - 0x1e92: 0x8d75, 0x1e93: 0xda11, 0x1e94: 0xda31, 0x1e95: 0xda31, 0x1e96: 0xda51, 0x1e97: 0x8d95, - 0x1e98: 0x8db5, 0x1e99: 0xda71, 0x1e9a: 0xda91, 0x1e9b: 0xdab1, 0x1e9c: 0xdad1, 0x1e9d: 0xdaf1, - 0x1e9e: 0xdb11, 0x1e9f: 0xdb31, 0x1ea0: 0xdb51, 0x1ea1: 0xdb71, 0x1ea2: 0xdb91, 0x1ea3: 0xdbb1, - 0x1ea4: 0x8dd5, 0x1ea5: 0xdbd1, 0x1ea6: 0xdbf1, 0x1ea7: 0xdc11, 0x1ea8: 0xdc31, 0x1ea9: 0xdc11, - 0x1eaa: 0xdc51, 0x1eab: 0xdc71, 0x1eac: 0xdc91, 0x1ead: 0xdcb1, 0x1eae: 0xdcd1, 0x1eaf: 0xdcf1, - 0x1eb0: 0xdd11, 0x1eb1: 0xdd31, 0x1eb2: 0xdd51, 0x1eb3: 0xdd71, 0x1eb4: 0xdd91, 0x1eb5: 0xddb1, - 0x1eb6: 0xddd1, 0x1eb7: 0xddf1, 0x1eb8: 0x8df5, 0x1eb9: 0xde11, 0x1eba: 0xde31, 0x1ebb: 0xde51, - 0x1ebc: 0xde71, 0x1ebd: 0xde91, 0x1ebe: 0x8e15, 0x1ebf: 0xdeb1, - // Block 0x7b, offset 0x1ec0 - 0x1ec0: 0xe5b1, 0x1ec1: 0xe5d1, 0x1ec2: 0xe5f1, 0x1ec3: 0xe611, 0x1ec4: 0xe631, 0x1ec5: 0xe651, - 0x1ec6: 0x8f35, 0x1ec7: 0xe671, 0x1ec8: 0xe691, 0x1ec9: 0xe6b1, 0x1eca: 0xe6d1, 0x1ecb: 0xe6f1, - 0x1ecc: 0xe711, 0x1ecd: 0x8f55, 0x1ece: 0xe731, 0x1ecf: 0xe751, 0x1ed0: 0x8f75, 0x1ed1: 0x8f95, - 0x1ed2: 0xe771, 0x1ed3: 0xe791, 0x1ed4: 0xe7b1, 0x1ed5: 0xe7d1, 0x1ed6: 0xe7f1, 0x1ed7: 0xe811, - 0x1ed8: 0xe831, 0x1ed9: 0xe851, 0x1eda: 0xe871, 0x1edb: 0x8fb5, 0x1edc: 0xe891, 0x1edd: 0x8fd5, - 0x1ede: 0xe8b1, 0x1edf: 0x2040, 0x1ee0: 0xe8d1, 0x1ee1: 0xe8f1, 0x1ee2: 0xe911, 0x1ee3: 0x8ff5, - 0x1ee4: 0xe931, 0x1ee5: 0xe951, 0x1ee6: 0x9015, 0x1ee7: 0x9035, 0x1ee8: 0xe971, 0x1ee9: 0xe991, - 0x1eea: 0xe9b1, 0x1eeb: 0xe9d1, 0x1eec: 0xe9f1, 0x1eed: 0xe9f1, 0x1eee: 0xea11, 0x1eef: 0xea31, - 0x1ef0: 0xea51, 0x1ef1: 0xea71, 0x1ef2: 0xea91, 0x1ef3: 0xeab1, 0x1ef4: 0xead1, 0x1ef5: 0x9055, - 0x1ef6: 0xeaf1, 0x1ef7: 0x9075, 0x1ef8: 0xeb11, 0x1ef9: 0x9095, 0x1efa: 0xeb31, 0x1efb: 0x90b5, - 0x1efc: 0x90d5, 0x1efd: 0x90f5, 0x1efe: 0xeb51, 0x1eff: 0xeb71, - // Block 0x7c, offset 0x1f00 - 0x1f00: 0xeb91, 0x1f01: 0x9115, 0x1f02: 0x9135, 0x1f03: 0x9155, 0x1f04: 0x9175, 0x1f05: 0xebb1, - 0x1f06: 0xebd1, 0x1f07: 0xebd1, 0x1f08: 0xebf1, 0x1f09: 0xec11, 0x1f0a: 0xec31, 0x1f0b: 0xec51, - 0x1f0c: 0xec71, 0x1f0d: 0x9195, 0x1f0e: 0xec91, 0x1f0f: 0xecb1, 0x1f10: 0xecd1, 0x1f11: 0xecf1, - 0x1f12: 0x91b5, 0x1f13: 0xed11, 0x1f14: 0x91d5, 0x1f15: 0x91f5, 0x1f16: 0xed31, 0x1f17: 0xed51, - 0x1f18: 0xed71, 0x1f19: 0xed91, 0x1f1a: 0xedb1, 0x1f1b: 0xedd1, 0x1f1c: 0x9215, 0x1f1d: 0x9235, - 0x1f1e: 0x9255, 0x1f1f: 0x2040, 0x1f20: 0xedf1, 0x1f21: 0x9275, 0x1f22: 0xee11, 0x1f23: 0xee31, - 0x1f24: 0xee51, 0x1f25: 0x9295, 0x1f26: 0xee71, 0x1f27: 0xee91, 0x1f28: 0xeeb1, 0x1f29: 0xeed1, - 0x1f2a: 0xeef1, 0x1f2b: 0x92b5, 0x1f2c: 0xef11, 0x1f2d: 0xef31, 0x1f2e: 0xef51, 0x1f2f: 0xef71, - 0x1f30: 0xef91, 0x1f31: 0xefb1, 0x1f32: 0x92d5, 0x1f33: 0x92f5, 0x1f34: 0xefd1, 0x1f35: 0x9315, - 0x1f36: 0xeff1, 0x1f37: 0x9335, 0x1f38: 0xf011, 0x1f39: 0xf031, 0x1f3a: 0xf051, 0x1f3b: 0x9355, - 0x1f3c: 0x9375, 0x1f3d: 0xf071, 0x1f3e: 0x9395, 0x1f3f: 0xf091, - // Block 0x7d, offset 0x1f40 - 0x1f40: 0xf6d1, 0x1f41: 0xf6f1, 0x1f42: 0xf711, 0x1f43: 0xf731, 0x1f44: 0xf751, 0x1f45: 0x9555, - 0x1f46: 0xf771, 0x1f47: 0xf791, 0x1f48: 0xf7b1, 0x1f49: 0xf7d1, 0x1f4a: 0xf7f1, 0x1f4b: 0x9575, - 0x1f4c: 0x9595, 0x1f4d: 0xf811, 0x1f4e: 0xf831, 0x1f4f: 0xf851, 0x1f50: 0xf871, 0x1f51: 0xf891, - 0x1f52: 0xf8b1, 0x1f53: 0x95b5, 0x1f54: 0xf8d1, 0x1f55: 0xf8f1, 0x1f56: 0xf911, 0x1f57: 0xf931, - 0x1f58: 0x95d5, 0x1f59: 0x95f5, 0x1f5a: 0xf951, 0x1f5b: 0xf971, 0x1f5c: 0xf991, 0x1f5d: 0x9615, - 0x1f5e: 0xf9b1, 0x1f5f: 0xf9d1, 0x1f60: 0x684d, 0x1f61: 0x9635, 0x1f62: 0xf9f1, 0x1f63: 0xfa11, - 0x1f64: 0xfa31, 0x1f65: 0x9655, 0x1f66: 0xfa51, 0x1f67: 0xfa71, 0x1f68: 0xfa91, 0x1f69: 0xfab1, - 0x1f6a: 0xfad1, 0x1f6b: 0xfaf1, 0x1f6c: 0xfb11, 0x1f6d: 0x9675, 0x1f6e: 0xfb31, 0x1f6f: 0xfb51, - 0x1f70: 0xfb71, 0x1f71: 0x9695, 0x1f72: 0xfb91, 0x1f73: 0xfbb1, 0x1f74: 0xfbd1, 0x1f75: 0xfbf1, - 0x1f76: 0x7b6d, 0x1f77: 0x96b5, 0x1f78: 0xfc11, 0x1f79: 0xfc31, 0x1f7a: 0xfc51, 0x1f7b: 0x96d5, - 0x1f7c: 0xfc71, 0x1f7d: 0x96f5, 0x1f7e: 0xfc91, 0x1f7f: 0xfc91, - // Block 0x7e, offset 0x1f80 - 0x1f80: 0xfcb1, 0x1f81: 0x9715, 0x1f82: 0xfcd1, 0x1f83: 0xfcf1, 0x1f84: 0xfd11, 0x1f85: 0xfd31, - 0x1f86: 0xfd51, 0x1f87: 0xfd71, 0x1f88: 0xfd91, 0x1f89: 0x9735, 0x1f8a: 0xfdb1, 0x1f8b: 0xfdd1, - 0x1f8c: 0xfdf1, 0x1f8d: 0xfe11, 0x1f8e: 0xfe31, 0x1f8f: 0xfe51, 0x1f90: 0x9755, 0x1f91: 0xfe71, - 0x1f92: 0x9775, 0x1f93: 0x9795, 0x1f94: 0x97b5, 0x1f95: 0xfe91, 0x1f96: 0xfeb1, 0x1f97: 0xfed1, - 0x1f98: 0xfef1, 0x1f99: 0xff11, 0x1f9a: 0xff31, 0x1f9b: 0xff51, 0x1f9c: 0xff71, 0x1f9d: 0x97d5, - 0x1f9e: 0x0040, 0x1f9f: 0x0040, 0x1fa0: 0x0040, 0x1fa1: 0x0040, 0x1fa2: 0x0040, 0x1fa3: 0x0040, - 0x1fa4: 0x0040, 0x1fa5: 0x0040, 0x1fa6: 0x0040, 0x1fa7: 0x0040, 0x1fa8: 0x0040, 0x1fa9: 0x0040, - 0x1faa: 0x0040, 0x1fab: 0x0040, 0x1fac: 0x0040, 0x1fad: 0x0040, 0x1fae: 0x0040, 0x1faf: 0x0040, - 0x1fb0: 0x0040, 0x1fb1: 0x0040, 0x1fb2: 0x0040, 0x1fb3: 0x0040, 0x1fb4: 0x0040, 0x1fb5: 0x0040, - 0x1fb6: 0x0040, 0x1fb7: 0x0040, 0x1fb8: 0x0040, 0x1fb9: 0x0040, 0x1fba: 0x0040, 0x1fbb: 0x0040, - 0x1fbc: 0x0040, 0x1fbd: 0x0040, 0x1fbe: 0x0040, 0x1fbf: 0x0040, -} - -// idnaIndex: 36 blocks, 2304 entries, 4608 bytes -// Block 0 is the zero block. -var idnaIndex = [2304]uint16{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x01, 0xc3: 0x7d, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x04, 0xc7: 0x05, - 0xc8: 0x06, 0xc9: 0x7e, 0xca: 0x7f, 0xcb: 0x07, 0xcc: 0x80, 0xcd: 0x08, 0xce: 0x09, 0xcf: 0x0a, - 0xd0: 0x81, 0xd1: 0x0b, 0xd2: 0x0c, 0xd3: 0x0d, 0xd4: 0x0e, 0xd5: 0x82, 0xd6: 0x83, 0xd7: 0x84, - 0xd8: 0x0f, 0xd9: 0x10, 0xda: 0x85, 0xdb: 0x11, 0xdc: 0x12, 0xdd: 0x86, 0xde: 0x87, 0xdf: 0x88, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe5: 0x07, 0xe6: 0x07, 0xe7: 0x07, - 0xe8: 0x07, 0xe9: 0x08, 0xea: 0x09, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x0a, 0xee: 0x0b, 0xef: 0x0c, - 0xf0: 0x1d, 0xf1: 0x1e, 0xf2: 0x1e, 0xf3: 0x20, 0xf4: 0x21, - // Block 0x4, offset 0x100 - 0x120: 0x89, 0x121: 0x13, 0x122: 0x8a, 0x123: 0x8b, 0x124: 0x8c, 0x125: 0x14, 0x126: 0x15, 0x127: 0x16, - 0x128: 0x17, 0x129: 0x18, 0x12a: 0x19, 0x12b: 0x1a, 0x12c: 0x1b, 0x12d: 0x1c, 0x12e: 0x1d, 0x12f: 0x8d, - 0x130: 0x8e, 0x131: 0x1e, 0x132: 0x1f, 0x133: 0x20, 0x134: 0x8f, 0x135: 0x21, 0x136: 0x90, 0x137: 0x91, - 0x138: 0x92, 0x139: 0x93, 0x13a: 0x22, 0x13b: 0x94, 0x13c: 0x95, 0x13d: 0x23, 0x13e: 0x24, 0x13f: 0x96, - // Block 0x5, offset 0x140 - 0x140: 0x97, 0x141: 0x98, 0x142: 0x99, 0x143: 0x9a, 0x144: 0x9b, 0x145: 0x9c, 0x146: 0x9d, 0x147: 0x9e, - 0x148: 0x9f, 0x149: 0xa0, 0x14a: 0xa1, 0x14b: 0xa2, 0x14c: 0xa3, 0x14d: 0xa4, 0x14e: 0xa5, 0x14f: 0xa6, - 0x150: 0xa7, 0x151: 0x9f, 0x152: 0x9f, 0x153: 0x9f, 0x154: 0x9f, 0x155: 0x9f, 0x156: 0x9f, 0x157: 0x9f, - 0x158: 0x9f, 0x159: 0xa8, 0x15a: 0xa9, 0x15b: 0xaa, 0x15c: 0xab, 0x15d: 0xac, 0x15e: 0xad, 0x15f: 0xae, - 0x160: 0xaf, 0x161: 0xb0, 0x162: 0xb1, 0x163: 0xb2, 0x164: 0xb3, 0x165: 0xb4, 0x166: 0xb5, 0x167: 0xb6, - 0x168: 0xb7, 0x169: 0xb8, 0x16a: 0xb9, 0x16b: 0xba, 0x16c: 0xbb, 0x16d: 0xbc, 0x16e: 0xbd, 0x16f: 0xbe, - 0x170: 0xbf, 0x171: 0xc0, 0x172: 0xc1, 0x173: 0xc2, 0x174: 0x25, 0x175: 0x26, 0x176: 0x27, 0x177: 0xc3, - 0x178: 0x28, 0x179: 0x28, 0x17a: 0x29, 0x17b: 0x28, 0x17c: 0xc4, 0x17d: 0x2a, 0x17e: 0x2b, 0x17f: 0x2c, - // Block 0x6, offset 0x180 - 0x180: 0x2d, 0x181: 0x2e, 0x182: 0x2f, 0x183: 0xc5, 0x184: 0x30, 0x185: 0x31, 0x186: 0xc6, 0x187: 0x9b, - 0x188: 0xc7, 0x189: 0xc8, 0x18a: 0x9b, 0x18b: 0x9b, 0x18c: 0xc9, 0x18d: 0x9b, 0x18e: 0x9b, 0x18f: 0x9b, - 0x190: 0xca, 0x191: 0x32, 0x192: 0x33, 0x193: 0x34, 0x194: 0x9b, 0x195: 0x9b, 0x196: 0x9b, 0x197: 0x9b, - 0x198: 0x9b, 0x199: 0x9b, 0x19a: 0x9b, 0x19b: 0x9b, 0x19c: 0x9b, 0x19d: 0x9b, 0x19e: 0x9b, 0x19f: 0x9b, - 0x1a0: 0x9b, 0x1a1: 0x9b, 0x1a2: 0x9b, 0x1a3: 0x9b, 0x1a4: 0x9b, 0x1a5: 0x9b, 0x1a6: 0x9b, 0x1a7: 0x9b, - 0x1a8: 0xcb, 0x1a9: 0xcc, 0x1aa: 0x9b, 0x1ab: 0xcd, 0x1ac: 0x9b, 0x1ad: 0xce, 0x1ae: 0xcf, 0x1af: 0x9b, - 0x1b0: 0xd0, 0x1b1: 0x35, 0x1b2: 0x28, 0x1b3: 0x36, 0x1b4: 0xd1, 0x1b5: 0xd2, 0x1b6: 0xd3, 0x1b7: 0xd4, - 0x1b8: 0xd5, 0x1b9: 0xd6, 0x1ba: 0xd7, 0x1bb: 0xd8, 0x1bc: 0xd9, 0x1bd: 0xda, 0x1be: 0xdb, 0x1bf: 0x37, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x38, 0x1c1: 0xdc, 0x1c2: 0xdd, 0x1c3: 0xde, 0x1c4: 0xdf, 0x1c5: 0x39, 0x1c6: 0x3a, 0x1c7: 0xe0, - 0x1c8: 0xe1, 0x1c9: 0x3b, 0x1ca: 0x3c, 0x1cb: 0x3d, 0x1cc: 0x3e, 0x1cd: 0x3f, 0x1ce: 0x40, 0x1cf: 0x41, - 0x1d0: 0x9f, 0x1d1: 0x9f, 0x1d2: 0x9f, 0x1d3: 0x9f, 0x1d4: 0x9f, 0x1d5: 0x9f, 0x1d6: 0x9f, 0x1d7: 0x9f, - 0x1d8: 0x9f, 0x1d9: 0x9f, 0x1da: 0x9f, 0x1db: 0x9f, 0x1dc: 0x9f, 0x1dd: 0x9f, 0x1de: 0x9f, 0x1df: 0x9f, - 0x1e0: 0x9f, 0x1e1: 0x9f, 0x1e2: 0x9f, 0x1e3: 0x9f, 0x1e4: 0x9f, 0x1e5: 0x9f, 0x1e6: 0x9f, 0x1e7: 0x9f, - 0x1e8: 0x9f, 0x1e9: 0x9f, 0x1ea: 0x9f, 0x1eb: 0x9f, 0x1ec: 0x9f, 0x1ed: 0x9f, 0x1ee: 0x9f, 0x1ef: 0x9f, - 0x1f0: 0x9f, 0x1f1: 0x9f, 0x1f2: 0x9f, 0x1f3: 0x9f, 0x1f4: 0x9f, 0x1f5: 0x9f, 0x1f6: 0x9f, 0x1f7: 0x9f, - 0x1f8: 0x9f, 0x1f9: 0x9f, 0x1fa: 0x9f, 0x1fb: 0x9f, 0x1fc: 0x9f, 0x1fd: 0x9f, 0x1fe: 0x9f, 0x1ff: 0x9f, - // Block 0x8, offset 0x200 - 0x200: 0x9f, 0x201: 0x9f, 0x202: 0x9f, 0x203: 0x9f, 0x204: 0x9f, 0x205: 0x9f, 0x206: 0x9f, 0x207: 0x9f, - 0x208: 0x9f, 0x209: 0x9f, 0x20a: 0x9f, 0x20b: 0x9f, 0x20c: 0x9f, 0x20d: 0x9f, 0x20e: 0x9f, 0x20f: 0x9f, - 0x210: 0x9f, 0x211: 0x9f, 0x212: 0x9f, 0x213: 0x9f, 0x214: 0x9f, 0x215: 0x9f, 0x216: 0x9f, 0x217: 0x9f, - 0x218: 0x9f, 0x219: 0x9f, 0x21a: 0x9f, 0x21b: 0x9f, 0x21c: 0x9f, 0x21d: 0x9f, 0x21e: 0x9f, 0x21f: 0x9f, - 0x220: 0x9f, 0x221: 0x9f, 0x222: 0x9f, 0x223: 0x9f, 0x224: 0x9f, 0x225: 0x9f, 0x226: 0x9f, 0x227: 0x9f, - 0x228: 0x9f, 0x229: 0x9f, 0x22a: 0x9f, 0x22b: 0x9f, 0x22c: 0x9f, 0x22d: 0x9f, 0x22e: 0x9f, 0x22f: 0x9f, - 0x230: 0x9f, 0x231: 0x9f, 0x232: 0x9f, 0x233: 0x9f, 0x234: 0x9f, 0x235: 0x9f, 0x236: 0xb2, 0x237: 0x9b, - 0x238: 0x9f, 0x239: 0x9f, 0x23a: 0x9f, 0x23b: 0x9f, 0x23c: 0x9f, 0x23d: 0x9f, 0x23e: 0x9f, 0x23f: 0x9f, - // Block 0x9, offset 0x240 - 0x240: 0x9f, 0x241: 0x9f, 0x242: 0x9f, 0x243: 0x9f, 0x244: 0x9f, 0x245: 0x9f, 0x246: 0x9f, 0x247: 0x9f, - 0x248: 0x9f, 0x249: 0x9f, 0x24a: 0x9f, 0x24b: 0x9f, 0x24c: 0x9f, 0x24d: 0x9f, 0x24e: 0x9f, 0x24f: 0x9f, - 0x250: 0x9f, 0x251: 0x9f, 0x252: 0x9f, 0x253: 0x9f, 0x254: 0x9f, 0x255: 0x9f, 0x256: 0x9f, 0x257: 0x9f, - 0x258: 0x9f, 0x259: 0x9f, 0x25a: 0x9f, 0x25b: 0x9f, 0x25c: 0x9f, 0x25d: 0x9f, 0x25e: 0x9f, 0x25f: 0x9f, - 0x260: 0x9f, 0x261: 0x9f, 0x262: 0x9f, 0x263: 0x9f, 0x264: 0x9f, 0x265: 0x9f, 0x266: 0x9f, 0x267: 0x9f, - 0x268: 0x9f, 0x269: 0x9f, 0x26a: 0x9f, 0x26b: 0x9f, 0x26c: 0x9f, 0x26d: 0x9f, 0x26e: 0x9f, 0x26f: 0x9f, - 0x270: 0x9f, 0x271: 0x9f, 0x272: 0x9f, 0x273: 0x9f, 0x274: 0x9f, 0x275: 0x9f, 0x276: 0x9f, 0x277: 0x9f, - 0x278: 0x9f, 0x279: 0x9f, 0x27a: 0x9f, 0x27b: 0x9f, 0x27c: 0x9f, 0x27d: 0x9f, 0x27e: 0x9f, 0x27f: 0x9f, - // Block 0xa, offset 0x280 - 0x280: 0x9f, 0x281: 0x9f, 0x282: 0x9f, 0x283: 0x9f, 0x284: 0x9f, 0x285: 0x9f, 0x286: 0x9f, 0x287: 0x9f, - 0x288: 0x9f, 0x289: 0x9f, 0x28a: 0x9f, 0x28b: 0x9f, 0x28c: 0x9f, 0x28d: 0x9f, 0x28e: 0x9f, 0x28f: 0x9f, - 0x290: 0x9f, 0x291: 0x9f, 0x292: 0x9f, 0x293: 0x9f, 0x294: 0x9f, 0x295: 0x9f, 0x296: 0x9f, 0x297: 0x9f, - 0x298: 0x9f, 0x299: 0x9f, 0x29a: 0x9f, 0x29b: 0x9f, 0x29c: 0x9f, 0x29d: 0x9f, 0x29e: 0x9f, 0x29f: 0x9f, - 0x2a0: 0x9f, 0x2a1: 0x9f, 0x2a2: 0x9f, 0x2a3: 0x9f, 0x2a4: 0x9f, 0x2a5: 0x9f, 0x2a6: 0x9f, 0x2a7: 0x9f, - 0x2a8: 0x9f, 0x2a9: 0x9f, 0x2aa: 0x9f, 0x2ab: 0x9f, 0x2ac: 0x9f, 0x2ad: 0x9f, 0x2ae: 0x9f, 0x2af: 0x9f, - 0x2b0: 0x9f, 0x2b1: 0x9f, 0x2b2: 0x9f, 0x2b3: 0x9f, 0x2b4: 0x9f, 0x2b5: 0x9f, 0x2b6: 0x9f, 0x2b7: 0x9f, - 0x2b8: 0x9f, 0x2b9: 0x9f, 0x2ba: 0x9f, 0x2bb: 0x9f, 0x2bc: 0x9f, 0x2bd: 0x9f, 0x2be: 0x9f, 0x2bf: 0xe2, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x9f, 0x2c1: 0x9f, 0x2c2: 0x9f, 0x2c3: 0x9f, 0x2c4: 0x9f, 0x2c5: 0x9f, 0x2c6: 0x9f, 0x2c7: 0x9f, - 0x2c8: 0x9f, 0x2c9: 0x9f, 0x2ca: 0x9f, 0x2cb: 0x9f, 0x2cc: 0x9f, 0x2cd: 0x9f, 0x2ce: 0x9f, 0x2cf: 0x9f, - 0x2d0: 0x9f, 0x2d1: 0x9f, 0x2d2: 0xe3, 0x2d3: 0xe4, 0x2d4: 0x9f, 0x2d5: 0x9f, 0x2d6: 0x9f, 0x2d7: 0x9f, - 0x2d8: 0xe5, 0x2d9: 0x42, 0x2da: 0x43, 0x2db: 0xe6, 0x2dc: 0x44, 0x2dd: 0x45, 0x2de: 0x46, 0x2df: 0xe7, - 0x2e0: 0xe8, 0x2e1: 0xe9, 0x2e2: 0xea, 0x2e3: 0xeb, 0x2e4: 0xec, 0x2e5: 0xed, 0x2e6: 0xee, 0x2e7: 0xef, - 0x2e8: 0xf0, 0x2e9: 0xf1, 0x2ea: 0xf2, 0x2eb: 0xf3, 0x2ec: 0xf4, 0x2ed: 0xf5, 0x2ee: 0xf6, 0x2ef: 0xf7, - 0x2f0: 0x9f, 0x2f1: 0x9f, 0x2f2: 0x9f, 0x2f3: 0x9f, 0x2f4: 0x9f, 0x2f5: 0x9f, 0x2f6: 0x9f, 0x2f7: 0x9f, - 0x2f8: 0x9f, 0x2f9: 0x9f, 0x2fa: 0x9f, 0x2fb: 0x9f, 0x2fc: 0x9f, 0x2fd: 0x9f, 0x2fe: 0x9f, 0x2ff: 0x9f, - // Block 0xc, offset 0x300 - 0x300: 0x9f, 0x301: 0x9f, 0x302: 0x9f, 0x303: 0x9f, 0x304: 0x9f, 0x305: 0x9f, 0x306: 0x9f, 0x307: 0x9f, - 0x308: 0x9f, 0x309: 0x9f, 0x30a: 0x9f, 0x30b: 0x9f, 0x30c: 0x9f, 0x30d: 0x9f, 0x30e: 0x9f, 0x30f: 0x9f, - 0x310: 0x9f, 0x311: 0x9f, 0x312: 0x9f, 0x313: 0x9f, 0x314: 0x9f, 0x315: 0x9f, 0x316: 0x9f, 0x317: 0x9f, - 0x318: 0x9f, 0x319: 0x9f, 0x31a: 0x9f, 0x31b: 0x9f, 0x31c: 0x9f, 0x31d: 0x9f, 0x31e: 0xf8, 0x31f: 0xf9, - // Block 0xd, offset 0x340 - 0x340: 0xba, 0x341: 0xba, 0x342: 0xba, 0x343: 0xba, 0x344: 0xba, 0x345: 0xba, 0x346: 0xba, 0x347: 0xba, - 0x348: 0xba, 0x349: 0xba, 0x34a: 0xba, 0x34b: 0xba, 0x34c: 0xba, 0x34d: 0xba, 0x34e: 0xba, 0x34f: 0xba, - 0x350: 0xba, 0x351: 0xba, 0x352: 0xba, 0x353: 0xba, 0x354: 0xba, 0x355: 0xba, 0x356: 0xba, 0x357: 0xba, - 0x358: 0xba, 0x359: 0xba, 0x35a: 0xba, 0x35b: 0xba, 0x35c: 0xba, 0x35d: 0xba, 0x35e: 0xba, 0x35f: 0xba, - 0x360: 0xba, 0x361: 0xba, 0x362: 0xba, 0x363: 0xba, 0x364: 0xba, 0x365: 0xba, 0x366: 0xba, 0x367: 0xba, - 0x368: 0xba, 0x369: 0xba, 0x36a: 0xba, 0x36b: 0xba, 0x36c: 0xba, 0x36d: 0xba, 0x36e: 0xba, 0x36f: 0xba, - 0x370: 0xba, 0x371: 0xba, 0x372: 0xba, 0x373: 0xba, 0x374: 0xba, 0x375: 0xba, 0x376: 0xba, 0x377: 0xba, - 0x378: 0xba, 0x379: 0xba, 0x37a: 0xba, 0x37b: 0xba, 0x37c: 0xba, 0x37d: 0xba, 0x37e: 0xba, 0x37f: 0xba, - // Block 0xe, offset 0x380 - 0x380: 0xba, 0x381: 0xba, 0x382: 0xba, 0x383: 0xba, 0x384: 0xba, 0x385: 0xba, 0x386: 0xba, 0x387: 0xba, - 0x388: 0xba, 0x389: 0xba, 0x38a: 0xba, 0x38b: 0xba, 0x38c: 0xba, 0x38d: 0xba, 0x38e: 0xba, 0x38f: 0xba, - 0x390: 0xba, 0x391: 0xba, 0x392: 0xba, 0x393: 0xba, 0x394: 0xba, 0x395: 0xba, 0x396: 0xba, 0x397: 0xba, - 0x398: 0xba, 0x399: 0xba, 0x39a: 0xba, 0x39b: 0xba, 0x39c: 0xba, 0x39d: 0xba, 0x39e: 0xba, 0x39f: 0xba, - 0x3a0: 0xba, 0x3a1: 0xba, 0x3a2: 0xba, 0x3a3: 0xba, 0x3a4: 0xfa, 0x3a5: 0xfb, 0x3a6: 0xfc, 0x3a7: 0xfd, - 0x3a8: 0x47, 0x3a9: 0xfe, 0x3aa: 0xff, 0x3ab: 0x48, 0x3ac: 0x49, 0x3ad: 0x4a, 0x3ae: 0x4b, 0x3af: 0x4c, - 0x3b0: 0x100, 0x3b1: 0x4d, 0x3b2: 0x4e, 0x3b3: 0x4f, 0x3b4: 0x50, 0x3b5: 0x51, 0x3b6: 0x101, 0x3b7: 0x52, - 0x3b8: 0x53, 0x3b9: 0x54, 0x3ba: 0x55, 0x3bb: 0x56, 0x3bc: 0x57, 0x3bd: 0x58, 0x3be: 0x59, 0x3bf: 0x5a, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x102, 0x3c1: 0x103, 0x3c2: 0x9f, 0x3c3: 0x104, 0x3c4: 0x105, 0x3c5: 0x9b, 0x3c6: 0x106, 0x3c7: 0x107, - 0x3c8: 0xba, 0x3c9: 0xba, 0x3ca: 0x108, 0x3cb: 0x109, 0x3cc: 0x10a, 0x3cd: 0x10b, 0x3ce: 0x10c, 0x3cf: 0x10d, - 0x3d0: 0x10e, 0x3d1: 0x9f, 0x3d2: 0x10f, 0x3d3: 0x110, 0x3d4: 0x111, 0x3d5: 0x112, 0x3d6: 0xba, 0x3d7: 0xba, - 0x3d8: 0x9f, 0x3d9: 0x9f, 0x3da: 0x9f, 0x3db: 0x9f, 0x3dc: 0x113, 0x3dd: 0x114, 0x3de: 0xba, 0x3df: 0xba, - 0x3e0: 0x115, 0x3e1: 0x116, 0x3e2: 0x117, 0x3e3: 0x118, 0x3e4: 0x119, 0x3e5: 0xba, 0x3e6: 0x11a, 0x3e7: 0x11b, - 0x3e8: 0x11c, 0x3e9: 0x11d, 0x3ea: 0x11e, 0x3eb: 0x5b, 0x3ec: 0x11f, 0x3ed: 0x120, 0x3ee: 0x5c, 0x3ef: 0xba, - 0x3f0: 0x121, 0x3f1: 0x122, 0x3f2: 0x123, 0x3f3: 0x124, 0x3f4: 0x125, 0x3f5: 0xba, 0x3f6: 0xba, 0x3f7: 0xba, - 0x3f8: 0xba, 0x3f9: 0x126, 0x3fa: 0xba, 0x3fb: 0xba, 0x3fc: 0x127, 0x3fd: 0x128, 0x3fe: 0xba, 0x3ff: 0x129, - // Block 0x10, offset 0x400 - 0x400: 0x12a, 0x401: 0x12b, 0x402: 0x12c, 0x403: 0x12d, 0x404: 0x12e, 0x405: 0x12f, 0x406: 0x130, 0x407: 0x131, - 0x408: 0x132, 0x409: 0xba, 0x40a: 0x133, 0x40b: 0x134, 0x40c: 0x5d, 0x40d: 0x5e, 0x40e: 0xba, 0x40f: 0xba, - 0x410: 0x135, 0x411: 0x136, 0x412: 0x137, 0x413: 0x138, 0x414: 0xba, 0x415: 0xba, 0x416: 0x139, 0x417: 0x13a, - 0x418: 0x13b, 0x419: 0x13c, 0x41a: 0x13d, 0x41b: 0x13e, 0x41c: 0x13f, 0x41d: 0xba, 0x41e: 0xba, 0x41f: 0xba, - 0x420: 0x140, 0x421: 0xba, 0x422: 0x141, 0x423: 0x142, 0x424: 0xba, 0x425: 0xba, 0x426: 0x143, 0x427: 0x144, - 0x428: 0x145, 0x429: 0x146, 0x42a: 0x147, 0x42b: 0x148, 0x42c: 0xba, 0x42d: 0xba, 0x42e: 0xba, 0x42f: 0xba, - 0x430: 0x149, 0x431: 0x14a, 0x432: 0x14b, 0x433: 0xba, 0x434: 0x14c, 0x435: 0x14d, 0x436: 0x14e, 0x437: 0xba, - 0x438: 0xba, 0x439: 0xba, 0x43a: 0xba, 0x43b: 0x14f, 0x43c: 0xba, 0x43d: 0xba, 0x43e: 0xba, 0x43f: 0x150, - // Block 0x11, offset 0x440 - 0x440: 0x9f, 0x441: 0x9f, 0x442: 0x9f, 0x443: 0x9f, 0x444: 0x9f, 0x445: 0x9f, 0x446: 0x9f, 0x447: 0x9f, - 0x448: 0x9f, 0x449: 0x9f, 0x44a: 0x9f, 0x44b: 0x9f, 0x44c: 0x9f, 0x44d: 0x9f, 0x44e: 0x151, 0x44f: 0xba, - 0x450: 0x9b, 0x451: 0x152, 0x452: 0x9f, 0x453: 0x9f, 0x454: 0x9f, 0x455: 0x153, 0x456: 0xba, 0x457: 0xba, - 0x458: 0xba, 0x459: 0xba, 0x45a: 0xba, 0x45b: 0xba, 0x45c: 0xba, 0x45d: 0xba, 0x45e: 0xba, 0x45f: 0xba, - 0x460: 0xba, 0x461: 0xba, 0x462: 0xba, 0x463: 0xba, 0x464: 0xba, 0x465: 0xba, 0x466: 0xba, 0x467: 0xba, - 0x468: 0xba, 0x469: 0xba, 0x46a: 0xba, 0x46b: 0xba, 0x46c: 0xba, 0x46d: 0xba, 0x46e: 0xba, 0x46f: 0xba, - 0x470: 0xba, 0x471: 0xba, 0x472: 0xba, 0x473: 0xba, 0x474: 0xba, 0x475: 0xba, 0x476: 0xba, 0x477: 0xba, - 0x478: 0xba, 0x479: 0xba, 0x47a: 0xba, 0x47b: 0xba, 0x47c: 0xba, 0x47d: 0xba, 0x47e: 0xba, 0x47f: 0xba, - // Block 0x12, offset 0x480 - 0x480: 0x9f, 0x481: 0x9f, 0x482: 0x9f, 0x483: 0x9f, 0x484: 0x9f, 0x485: 0x9f, 0x486: 0x9f, 0x487: 0x9f, - 0x488: 0x9f, 0x489: 0x9f, 0x48a: 0x9f, 0x48b: 0x9f, 0x48c: 0x9f, 0x48d: 0x9f, 0x48e: 0x9f, 0x48f: 0x9f, - 0x490: 0x154, 0x491: 0xba, 0x492: 0xba, 0x493: 0xba, 0x494: 0xba, 0x495: 0xba, 0x496: 0xba, 0x497: 0xba, - 0x498: 0xba, 0x499: 0xba, 0x49a: 0xba, 0x49b: 0xba, 0x49c: 0xba, 0x49d: 0xba, 0x49e: 0xba, 0x49f: 0xba, - 0x4a0: 0xba, 0x4a1: 0xba, 0x4a2: 0xba, 0x4a3: 0xba, 0x4a4: 0xba, 0x4a5: 0xba, 0x4a6: 0xba, 0x4a7: 0xba, - 0x4a8: 0xba, 0x4a9: 0xba, 0x4aa: 0xba, 0x4ab: 0xba, 0x4ac: 0xba, 0x4ad: 0xba, 0x4ae: 0xba, 0x4af: 0xba, - 0x4b0: 0xba, 0x4b1: 0xba, 0x4b2: 0xba, 0x4b3: 0xba, 0x4b4: 0xba, 0x4b5: 0xba, 0x4b6: 0xba, 0x4b7: 0xba, - 0x4b8: 0xba, 0x4b9: 0xba, 0x4ba: 0xba, 0x4bb: 0xba, 0x4bc: 0xba, 0x4bd: 0xba, 0x4be: 0xba, 0x4bf: 0xba, - // Block 0x13, offset 0x4c0 - 0x4c0: 0xba, 0x4c1: 0xba, 0x4c2: 0xba, 0x4c3: 0xba, 0x4c4: 0xba, 0x4c5: 0xba, 0x4c6: 0xba, 0x4c7: 0xba, - 0x4c8: 0xba, 0x4c9: 0xba, 0x4ca: 0xba, 0x4cb: 0xba, 0x4cc: 0xba, 0x4cd: 0xba, 0x4ce: 0xba, 0x4cf: 0xba, - 0x4d0: 0x9f, 0x4d1: 0x9f, 0x4d2: 0x9f, 0x4d3: 0x9f, 0x4d4: 0x9f, 0x4d5: 0x9f, 0x4d6: 0x9f, 0x4d7: 0x9f, - 0x4d8: 0x9f, 0x4d9: 0x155, 0x4da: 0xba, 0x4db: 0xba, 0x4dc: 0xba, 0x4dd: 0xba, 0x4de: 0xba, 0x4df: 0xba, - 0x4e0: 0xba, 0x4e1: 0xba, 0x4e2: 0xba, 0x4e3: 0xba, 0x4e4: 0xba, 0x4e5: 0xba, 0x4e6: 0xba, 0x4e7: 0xba, - 0x4e8: 0xba, 0x4e9: 0xba, 0x4ea: 0xba, 0x4eb: 0xba, 0x4ec: 0xba, 0x4ed: 0xba, 0x4ee: 0xba, 0x4ef: 0xba, - 0x4f0: 0xba, 0x4f1: 0xba, 0x4f2: 0xba, 0x4f3: 0xba, 0x4f4: 0xba, 0x4f5: 0xba, 0x4f6: 0xba, 0x4f7: 0xba, - 0x4f8: 0xba, 0x4f9: 0xba, 0x4fa: 0xba, 0x4fb: 0xba, 0x4fc: 0xba, 0x4fd: 0xba, 0x4fe: 0xba, 0x4ff: 0xba, - // Block 0x14, offset 0x500 - 0x500: 0xba, 0x501: 0xba, 0x502: 0xba, 0x503: 0xba, 0x504: 0xba, 0x505: 0xba, 0x506: 0xba, 0x507: 0xba, - 0x508: 0xba, 0x509: 0xba, 0x50a: 0xba, 0x50b: 0xba, 0x50c: 0xba, 0x50d: 0xba, 0x50e: 0xba, 0x50f: 0xba, - 0x510: 0xba, 0x511: 0xba, 0x512: 0xba, 0x513: 0xba, 0x514: 0xba, 0x515: 0xba, 0x516: 0xba, 0x517: 0xba, - 0x518: 0xba, 0x519: 0xba, 0x51a: 0xba, 0x51b: 0xba, 0x51c: 0xba, 0x51d: 0xba, 0x51e: 0xba, 0x51f: 0xba, - 0x520: 0x9f, 0x521: 0x9f, 0x522: 0x9f, 0x523: 0x9f, 0x524: 0x9f, 0x525: 0x9f, 0x526: 0x9f, 0x527: 0x9f, - 0x528: 0x148, 0x529: 0x156, 0x52a: 0xba, 0x52b: 0x157, 0x52c: 0x158, 0x52d: 0x159, 0x52e: 0x15a, 0x52f: 0xba, - 0x530: 0xba, 0x531: 0xba, 0x532: 0xba, 0x533: 0xba, 0x534: 0xba, 0x535: 0xba, 0x536: 0xba, 0x537: 0xba, - 0x538: 0xba, 0x539: 0x15b, 0x53a: 0x15c, 0x53b: 0xba, 0x53c: 0x9f, 0x53d: 0x15d, 0x53e: 0x15e, 0x53f: 0x15f, - // Block 0x15, offset 0x540 - 0x540: 0x9f, 0x541: 0x9f, 0x542: 0x9f, 0x543: 0x9f, 0x544: 0x9f, 0x545: 0x9f, 0x546: 0x9f, 0x547: 0x9f, - 0x548: 0x9f, 0x549: 0x9f, 0x54a: 0x9f, 0x54b: 0x9f, 0x54c: 0x9f, 0x54d: 0x9f, 0x54e: 0x9f, 0x54f: 0x9f, - 0x550: 0x9f, 0x551: 0x9f, 0x552: 0x9f, 0x553: 0x9f, 0x554: 0x9f, 0x555: 0x9f, 0x556: 0x9f, 0x557: 0x9f, - 0x558: 0x9f, 0x559: 0x9f, 0x55a: 0x9f, 0x55b: 0x9f, 0x55c: 0x9f, 0x55d: 0x9f, 0x55e: 0x9f, 0x55f: 0x160, - 0x560: 0x9f, 0x561: 0x9f, 0x562: 0x9f, 0x563: 0x9f, 0x564: 0x9f, 0x565: 0x9f, 0x566: 0x9f, 0x567: 0x9f, - 0x568: 0x9f, 0x569: 0x9f, 0x56a: 0x9f, 0x56b: 0x161, 0x56c: 0xba, 0x56d: 0xba, 0x56e: 0xba, 0x56f: 0xba, - 0x570: 0xba, 0x571: 0xba, 0x572: 0xba, 0x573: 0xba, 0x574: 0xba, 0x575: 0xba, 0x576: 0xba, 0x577: 0xba, - 0x578: 0xba, 0x579: 0xba, 0x57a: 0xba, 0x57b: 0xba, 0x57c: 0xba, 0x57d: 0xba, 0x57e: 0xba, 0x57f: 0xba, - // Block 0x16, offset 0x580 - 0x580: 0x9f, 0x581: 0x9f, 0x582: 0x9f, 0x583: 0x9f, 0x584: 0x162, 0x585: 0x163, 0x586: 0x9f, 0x587: 0x9f, - 0x588: 0x9f, 0x589: 0x9f, 0x58a: 0x9f, 0x58b: 0x164, 0x58c: 0xba, 0x58d: 0xba, 0x58e: 0xba, 0x58f: 0xba, - 0x590: 0xba, 0x591: 0xba, 0x592: 0xba, 0x593: 0xba, 0x594: 0xba, 0x595: 0xba, 0x596: 0xba, 0x597: 0xba, - 0x598: 0xba, 0x599: 0xba, 0x59a: 0xba, 0x59b: 0xba, 0x59c: 0xba, 0x59d: 0xba, 0x59e: 0xba, 0x59f: 0xba, - 0x5a0: 0xba, 0x5a1: 0xba, 0x5a2: 0xba, 0x5a3: 0xba, 0x5a4: 0xba, 0x5a5: 0xba, 0x5a6: 0xba, 0x5a7: 0xba, - 0x5a8: 0xba, 0x5a9: 0xba, 0x5aa: 0xba, 0x5ab: 0xba, 0x5ac: 0xba, 0x5ad: 0xba, 0x5ae: 0xba, 0x5af: 0xba, - 0x5b0: 0x9f, 0x5b1: 0x165, 0x5b2: 0x166, 0x5b3: 0xba, 0x5b4: 0xba, 0x5b5: 0xba, 0x5b6: 0xba, 0x5b7: 0xba, - 0x5b8: 0xba, 0x5b9: 0xba, 0x5ba: 0xba, 0x5bb: 0xba, 0x5bc: 0xba, 0x5bd: 0xba, 0x5be: 0xba, 0x5bf: 0xba, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x9b, 0x5c1: 0x9b, 0x5c2: 0x9b, 0x5c3: 0x167, 0x5c4: 0x168, 0x5c5: 0x169, 0x5c6: 0x16a, 0x5c7: 0x16b, - 0x5c8: 0x9b, 0x5c9: 0x16c, 0x5ca: 0xba, 0x5cb: 0x16d, 0x5cc: 0x9b, 0x5cd: 0x16e, 0x5ce: 0xba, 0x5cf: 0xba, - 0x5d0: 0x5f, 0x5d1: 0x60, 0x5d2: 0x61, 0x5d3: 0x62, 0x5d4: 0x63, 0x5d5: 0x64, 0x5d6: 0x65, 0x5d7: 0x66, - 0x5d8: 0x67, 0x5d9: 0x68, 0x5da: 0x69, 0x5db: 0x6a, 0x5dc: 0x6b, 0x5dd: 0x6c, 0x5de: 0x6d, 0x5df: 0x6e, - 0x5e0: 0x9b, 0x5e1: 0x9b, 0x5e2: 0x9b, 0x5e3: 0x9b, 0x5e4: 0x9b, 0x5e5: 0x9b, 0x5e6: 0x9b, 0x5e7: 0x9b, - 0x5e8: 0x16f, 0x5e9: 0x170, 0x5ea: 0x171, 0x5eb: 0xba, 0x5ec: 0xba, 0x5ed: 0xba, 0x5ee: 0xba, 0x5ef: 0xba, - 0x5f0: 0xba, 0x5f1: 0xba, 0x5f2: 0xba, 0x5f3: 0xba, 0x5f4: 0xba, 0x5f5: 0xba, 0x5f6: 0xba, 0x5f7: 0xba, - 0x5f8: 0xba, 0x5f9: 0xba, 0x5fa: 0xba, 0x5fb: 0xba, 0x5fc: 0xba, 0x5fd: 0xba, 0x5fe: 0xba, 0x5ff: 0xba, - // Block 0x18, offset 0x600 - 0x600: 0x172, 0x601: 0xba, 0x602: 0xba, 0x603: 0xba, 0x604: 0x173, 0x605: 0x174, 0x606: 0xba, 0x607: 0xba, - 0x608: 0xba, 0x609: 0xba, 0x60a: 0xba, 0x60b: 0x175, 0x60c: 0xba, 0x60d: 0xba, 0x60e: 0xba, 0x60f: 0xba, - 0x610: 0xba, 0x611: 0xba, 0x612: 0xba, 0x613: 0xba, 0x614: 0xba, 0x615: 0xba, 0x616: 0xba, 0x617: 0xba, - 0x618: 0xba, 0x619: 0xba, 0x61a: 0xba, 0x61b: 0xba, 0x61c: 0xba, 0x61d: 0xba, 0x61e: 0xba, 0x61f: 0xba, - 0x620: 0x121, 0x621: 0x121, 0x622: 0x121, 0x623: 0x176, 0x624: 0x6f, 0x625: 0x177, 0x626: 0xba, 0x627: 0xba, - 0x628: 0xba, 0x629: 0xba, 0x62a: 0xba, 0x62b: 0xba, 0x62c: 0xba, 0x62d: 0xba, 0x62e: 0xba, 0x62f: 0xba, - 0x630: 0xba, 0x631: 0x178, 0x632: 0x179, 0x633: 0xba, 0x634: 0x17a, 0x635: 0xba, 0x636: 0xba, 0x637: 0xba, - 0x638: 0x70, 0x639: 0x71, 0x63a: 0x72, 0x63b: 0x17b, 0x63c: 0xba, 0x63d: 0xba, 0x63e: 0xba, 0x63f: 0xba, - // Block 0x19, offset 0x640 - 0x640: 0x17c, 0x641: 0x9b, 0x642: 0x17d, 0x643: 0x17e, 0x644: 0x73, 0x645: 0x74, 0x646: 0x17f, 0x647: 0x180, - 0x648: 0x75, 0x649: 0x181, 0x64a: 0xba, 0x64b: 0xba, 0x64c: 0x9b, 0x64d: 0x9b, 0x64e: 0x9b, 0x64f: 0x9b, - 0x650: 0x9b, 0x651: 0x9b, 0x652: 0x9b, 0x653: 0x9b, 0x654: 0x9b, 0x655: 0x9b, 0x656: 0x9b, 0x657: 0x9b, - 0x658: 0x9b, 0x659: 0x9b, 0x65a: 0x9b, 0x65b: 0x182, 0x65c: 0x9b, 0x65d: 0x183, 0x65e: 0x9b, 0x65f: 0x184, - 0x660: 0x185, 0x661: 0x186, 0x662: 0x187, 0x663: 0xba, 0x664: 0x188, 0x665: 0x189, 0x666: 0x18a, 0x667: 0x18b, - 0x668: 0x9b, 0x669: 0x18c, 0x66a: 0x18d, 0x66b: 0xba, 0x66c: 0xba, 0x66d: 0xba, 0x66e: 0xba, 0x66f: 0xba, - 0x670: 0xba, 0x671: 0xba, 0x672: 0xba, 0x673: 0xba, 0x674: 0xba, 0x675: 0xba, 0x676: 0xba, 0x677: 0xba, - 0x678: 0xba, 0x679: 0xba, 0x67a: 0xba, 0x67b: 0xba, 0x67c: 0xba, 0x67d: 0xba, 0x67e: 0xba, 0x67f: 0xba, - // Block 0x1a, offset 0x680 - 0x680: 0x9f, 0x681: 0x9f, 0x682: 0x9f, 0x683: 0x9f, 0x684: 0x9f, 0x685: 0x9f, 0x686: 0x9f, 0x687: 0x9f, - 0x688: 0x9f, 0x689: 0x9f, 0x68a: 0x9f, 0x68b: 0x9f, 0x68c: 0x9f, 0x68d: 0x9f, 0x68e: 0x9f, 0x68f: 0x9f, - 0x690: 0x9f, 0x691: 0x9f, 0x692: 0x9f, 0x693: 0x9f, 0x694: 0x9f, 0x695: 0x9f, 0x696: 0x9f, 0x697: 0x9f, - 0x698: 0x9f, 0x699: 0x9f, 0x69a: 0x9f, 0x69b: 0x18e, 0x69c: 0x9f, 0x69d: 0x9f, 0x69e: 0x9f, 0x69f: 0x9f, - 0x6a0: 0x9f, 0x6a1: 0x9f, 0x6a2: 0x9f, 0x6a3: 0x9f, 0x6a4: 0x9f, 0x6a5: 0x9f, 0x6a6: 0x9f, 0x6a7: 0x9f, - 0x6a8: 0x9f, 0x6a9: 0x9f, 0x6aa: 0x9f, 0x6ab: 0x9f, 0x6ac: 0x9f, 0x6ad: 0x9f, 0x6ae: 0x9f, 0x6af: 0x9f, - 0x6b0: 0x9f, 0x6b1: 0x9f, 0x6b2: 0x9f, 0x6b3: 0x9f, 0x6b4: 0x9f, 0x6b5: 0x9f, 0x6b6: 0x9f, 0x6b7: 0x9f, - 0x6b8: 0x9f, 0x6b9: 0x9f, 0x6ba: 0x9f, 0x6bb: 0x9f, 0x6bc: 0x9f, 0x6bd: 0x9f, 0x6be: 0x9f, 0x6bf: 0x9f, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x9f, 0x6c1: 0x9f, 0x6c2: 0x9f, 0x6c3: 0x9f, 0x6c4: 0x9f, 0x6c5: 0x9f, 0x6c6: 0x9f, 0x6c7: 0x9f, - 0x6c8: 0x9f, 0x6c9: 0x9f, 0x6ca: 0x9f, 0x6cb: 0x9f, 0x6cc: 0x9f, 0x6cd: 0x9f, 0x6ce: 0x9f, 0x6cf: 0x9f, - 0x6d0: 0x9f, 0x6d1: 0x9f, 0x6d2: 0x9f, 0x6d3: 0x9f, 0x6d4: 0x9f, 0x6d5: 0x9f, 0x6d6: 0x9f, 0x6d7: 0x9f, - 0x6d8: 0x9f, 0x6d9: 0x9f, 0x6da: 0x9f, 0x6db: 0x9f, 0x6dc: 0x18f, 0x6dd: 0x9f, 0x6de: 0x9f, 0x6df: 0x9f, - 0x6e0: 0x190, 0x6e1: 0x9f, 0x6e2: 0x9f, 0x6e3: 0x9f, 0x6e4: 0x9f, 0x6e5: 0x9f, 0x6e6: 0x9f, 0x6e7: 0x9f, - 0x6e8: 0x9f, 0x6e9: 0x9f, 0x6ea: 0x9f, 0x6eb: 0x9f, 0x6ec: 0x9f, 0x6ed: 0x9f, 0x6ee: 0x9f, 0x6ef: 0x9f, - 0x6f0: 0x9f, 0x6f1: 0x9f, 0x6f2: 0x9f, 0x6f3: 0x9f, 0x6f4: 0x9f, 0x6f5: 0x9f, 0x6f6: 0x9f, 0x6f7: 0x9f, - 0x6f8: 0x9f, 0x6f9: 0x9f, 0x6fa: 0x9f, 0x6fb: 0x9f, 0x6fc: 0x9f, 0x6fd: 0x9f, 0x6fe: 0x9f, 0x6ff: 0x9f, - // Block 0x1c, offset 0x700 - 0x700: 0x9f, 0x701: 0x9f, 0x702: 0x9f, 0x703: 0x9f, 0x704: 0x9f, 0x705: 0x9f, 0x706: 0x9f, 0x707: 0x9f, - 0x708: 0x9f, 0x709: 0x9f, 0x70a: 0x9f, 0x70b: 0x9f, 0x70c: 0x9f, 0x70d: 0x9f, 0x70e: 0x9f, 0x70f: 0x9f, - 0x710: 0x9f, 0x711: 0x9f, 0x712: 0x9f, 0x713: 0x9f, 0x714: 0x9f, 0x715: 0x9f, 0x716: 0x9f, 0x717: 0x9f, - 0x718: 0x9f, 0x719: 0x9f, 0x71a: 0x9f, 0x71b: 0x9f, 0x71c: 0x9f, 0x71d: 0x9f, 0x71e: 0x9f, 0x71f: 0x9f, - 0x720: 0x9f, 0x721: 0x9f, 0x722: 0x9f, 0x723: 0x9f, 0x724: 0x9f, 0x725: 0x9f, 0x726: 0x9f, 0x727: 0x9f, - 0x728: 0x9f, 0x729: 0x9f, 0x72a: 0x9f, 0x72b: 0x9f, 0x72c: 0x9f, 0x72d: 0x9f, 0x72e: 0x9f, 0x72f: 0x9f, - 0x730: 0x9f, 0x731: 0x9f, 0x732: 0x9f, 0x733: 0x9f, 0x734: 0x9f, 0x735: 0x9f, 0x736: 0x9f, 0x737: 0x9f, - 0x738: 0x9f, 0x739: 0x9f, 0x73a: 0x191, 0x73b: 0x9f, 0x73c: 0x9f, 0x73d: 0x9f, 0x73e: 0x9f, 0x73f: 0x9f, - // Block 0x1d, offset 0x740 - 0x740: 0x9f, 0x741: 0x9f, 0x742: 0x9f, 0x743: 0x9f, 0x744: 0x9f, 0x745: 0x9f, 0x746: 0x9f, 0x747: 0x9f, - 0x748: 0x9f, 0x749: 0x9f, 0x74a: 0x9f, 0x74b: 0x9f, 0x74c: 0x9f, 0x74d: 0x9f, 0x74e: 0x9f, 0x74f: 0x9f, - 0x750: 0x9f, 0x751: 0x9f, 0x752: 0x9f, 0x753: 0x9f, 0x754: 0x9f, 0x755: 0x9f, 0x756: 0x9f, 0x757: 0x9f, - 0x758: 0x9f, 0x759: 0x9f, 0x75a: 0x9f, 0x75b: 0x9f, 0x75c: 0x9f, 0x75d: 0x9f, 0x75e: 0x9f, 0x75f: 0x9f, - 0x760: 0x9f, 0x761: 0x9f, 0x762: 0x9f, 0x763: 0x9f, 0x764: 0x9f, 0x765: 0x9f, 0x766: 0x9f, 0x767: 0x9f, - 0x768: 0x9f, 0x769: 0x9f, 0x76a: 0x9f, 0x76b: 0x9f, 0x76c: 0x9f, 0x76d: 0x9f, 0x76e: 0x9f, 0x76f: 0x192, - 0x770: 0xba, 0x771: 0xba, 0x772: 0xba, 0x773: 0xba, 0x774: 0xba, 0x775: 0xba, 0x776: 0xba, 0x777: 0xba, - 0x778: 0xba, 0x779: 0xba, 0x77a: 0xba, 0x77b: 0xba, 0x77c: 0xba, 0x77d: 0xba, 0x77e: 0xba, 0x77f: 0xba, - // Block 0x1e, offset 0x780 - 0x780: 0xba, 0x781: 0xba, 0x782: 0xba, 0x783: 0xba, 0x784: 0xba, 0x785: 0xba, 0x786: 0xba, 0x787: 0xba, - 0x788: 0xba, 0x789: 0xba, 0x78a: 0xba, 0x78b: 0xba, 0x78c: 0xba, 0x78d: 0xba, 0x78e: 0xba, 0x78f: 0xba, - 0x790: 0xba, 0x791: 0xba, 0x792: 0xba, 0x793: 0xba, 0x794: 0xba, 0x795: 0xba, 0x796: 0xba, 0x797: 0xba, - 0x798: 0xba, 0x799: 0xba, 0x79a: 0xba, 0x79b: 0xba, 0x79c: 0xba, 0x79d: 0xba, 0x79e: 0xba, 0x79f: 0xba, - 0x7a0: 0x76, 0x7a1: 0x77, 0x7a2: 0x78, 0x7a3: 0x193, 0x7a4: 0x79, 0x7a5: 0x7a, 0x7a6: 0x194, 0x7a7: 0x7b, - 0x7a8: 0x7c, 0x7a9: 0xba, 0x7aa: 0xba, 0x7ab: 0xba, 0x7ac: 0xba, 0x7ad: 0xba, 0x7ae: 0xba, 0x7af: 0xba, - 0x7b0: 0xba, 0x7b1: 0xba, 0x7b2: 0xba, 0x7b3: 0xba, 0x7b4: 0xba, 0x7b5: 0xba, 0x7b6: 0xba, 0x7b7: 0xba, - 0x7b8: 0xba, 0x7b9: 0xba, 0x7ba: 0xba, 0x7bb: 0xba, 0x7bc: 0xba, 0x7bd: 0xba, 0x7be: 0xba, 0x7bf: 0xba, - // Block 0x1f, offset 0x7c0 - 0x7d0: 0x0d, 0x7d1: 0x0e, 0x7d2: 0x0f, 0x7d3: 0x10, 0x7d4: 0x11, 0x7d5: 0x0b, 0x7d6: 0x12, 0x7d7: 0x07, - 0x7d8: 0x13, 0x7d9: 0x0b, 0x7da: 0x0b, 0x7db: 0x14, 0x7dc: 0x0b, 0x7dd: 0x15, 0x7de: 0x16, 0x7df: 0x17, - 0x7e0: 0x07, 0x7e1: 0x07, 0x7e2: 0x07, 0x7e3: 0x07, 0x7e4: 0x07, 0x7e5: 0x07, 0x7e6: 0x07, 0x7e7: 0x07, - 0x7e8: 0x07, 0x7e9: 0x07, 0x7ea: 0x18, 0x7eb: 0x19, 0x7ec: 0x1a, 0x7ed: 0x07, 0x7ee: 0x1b, 0x7ef: 0x1c, - 0x7f0: 0x0b, 0x7f1: 0x0b, 0x7f2: 0x0b, 0x7f3: 0x0b, 0x7f4: 0x0b, 0x7f5: 0x0b, 0x7f6: 0x0b, 0x7f7: 0x0b, - 0x7f8: 0x0b, 0x7f9: 0x0b, 0x7fa: 0x0b, 0x7fb: 0x0b, 0x7fc: 0x0b, 0x7fd: 0x0b, 0x7fe: 0x0b, 0x7ff: 0x0b, - // Block 0x20, offset 0x800 - 0x800: 0x0b, 0x801: 0x0b, 0x802: 0x0b, 0x803: 0x0b, 0x804: 0x0b, 0x805: 0x0b, 0x806: 0x0b, 0x807: 0x0b, - 0x808: 0x0b, 0x809: 0x0b, 0x80a: 0x0b, 0x80b: 0x0b, 0x80c: 0x0b, 0x80d: 0x0b, 0x80e: 0x0b, 0x80f: 0x0b, - 0x810: 0x0b, 0x811: 0x0b, 0x812: 0x0b, 0x813: 0x0b, 0x814: 0x0b, 0x815: 0x0b, 0x816: 0x0b, 0x817: 0x0b, - 0x818: 0x0b, 0x819: 0x0b, 0x81a: 0x0b, 0x81b: 0x0b, 0x81c: 0x0b, 0x81d: 0x0b, 0x81e: 0x0b, 0x81f: 0x0b, - 0x820: 0x0b, 0x821: 0x0b, 0x822: 0x0b, 0x823: 0x0b, 0x824: 0x0b, 0x825: 0x0b, 0x826: 0x0b, 0x827: 0x0b, - 0x828: 0x0b, 0x829: 0x0b, 0x82a: 0x0b, 0x82b: 0x0b, 0x82c: 0x0b, 0x82d: 0x0b, 0x82e: 0x0b, 0x82f: 0x0b, - 0x830: 0x0b, 0x831: 0x0b, 0x832: 0x0b, 0x833: 0x0b, 0x834: 0x0b, 0x835: 0x0b, 0x836: 0x0b, 0x837: 0x0b, - 0x838: 0x0b, 0x839: 0x0b, 0x83a: 0x0b, 0x83b: 0x0b, 0x83c: 0x0b, 0x83d: 0x0b, 0x83e: 0x0b, 0x83f: 0x0b, - // Block 0x21, offset 0x840 - 0x840: 0x195, 0x841: 0x196, 0x842: 0xba, 0x843: 0xba, 0x844: 0x197, 0x845: 0x197, 0x846: 0x197, 0x847: 0x198, - 0x848: 0xba, 0x849: 0xba, 0x84a: 0xba, 0x84b: 0xba, 0x84c: 0xba, 0x84d: 0xba, 0x84e: 0xba, 0x84f: 0xba, - 0x850: 0xba, 0x851: 0xba, 0x852: 0xba, 0x853: 0xba, 0x854: 0xba, 0x855: 0xba, 0x856: 0xba, 0x857: 0xba, - 0x858: 0xba, 0x859: 0xba, 0x85a: 0xba, 0x85b: 0xba, 0x85c: 0xba, 0x85d: 0xba, 0x85e: 0xba, 0x85f: 0xba, - 0x860: 0xba, 0x861: 0xba, 0x862: 0xba, 0x863: 0xba, 0x864: 0xba, 0x865: 0xba, 0x866: 0xba, 0x867: 0xba, - 0x868: 0xba, 0x869: 0xba, 0x86a: 0xba, 0x86b: 0xba, 0x86c: 0xba, 0x86d: 0xba, 0x86e: 0xba, 0x86f: 0xba, - 0x870: 0xba, 0x871: 0xba, 0x872: 0xba, 0x873: 0xba, 0x874: 0xba, 0x875: 0xba, 0x876: 0xba, 0x877: 0xba, - 0x878: 0xba, 0x879: 0xba, 0x87a: 0xba, 0x87b: 0xba, 0x87c: 0xba, 0x87d: 0xba, 0x87e: 0xba, 0x87f: 0xba, - // Block 0x22, offset 0x880 - 0x880: 0x0b, 0x881: 0x0b, 0x882: 0x0b, 0x883: 0x0b, 0x884: 0x0b, 0x885: 0x0b, 0x886: 0x0b, 0x887: 0x0b, - 0x888: 0x0b, 0x889: 0x0b, 0x88a: 0x0b, 0x88b: 0x0b, 0x88c: 0x0b, 0x88d: 0x0b, 0x88e: 0x0b, 0x88f: 0x0b, - 0x890: 0x0b, 0x891: 0x0b, 0x892: 0x0b, 0x893: 0x0b, 0x894: 0x0b, 0x895: 0x0b, 0x896: 0x0b, 0x897: 0x0b, - 0x898: 0x0b, 0x899: 0x0b, 0x89a: 0x0b, 0x89b: 0x0b, 0x89c: 0x0b, 0x89d: 0x0b, 0x89e: 0x0b, 0x89f: 0x0b, - 0x8a0: 0x1f, 0x8a1: 0x0b, 0x8a2: 0x0b, 0x8a3: 0x0b, 0x8a4: 0x0b, 0x8a5: 0x0b, 0x8a6: 0x0b, 0x8a7: 0x0b, - 0x8a8: 0x0b, 0x8a9: 0x0b, 0x8aa: 0x0b, 0x8ab: 0x0b, 0x8ac: 0x0b, 0x8ad: 0x0b, 0x8ae: 0x0b, 0x8af: 0x0b, - 0x8b0: 0x0b, 0x8b1: 0x0b, 0x8b2: 0x0b, 0x8b3: 0x0b, 0x8b4: 0x0b, 0x8b5: 0x0b, 0x8b6: 0x0b, 0x8b7: 0x0b, - 0x8b8: 0x0b, 0x8b9: 0x0b, 0x8ba: 0x0b, 0x8bb: 0x0b, 0x8bc: 0x0b, 0x8bd: 0x0b, 0x8be: 0x0b, 0x8bf: 0x0b, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x0b, 0x8c1: 0x0b, 0x8c2: 0x0b, 0x8c3: 0x0b, 0x8c4: 0x0b, 0x8c5: 0x0b, 0x8c6: 0x0b, 0x8c7: 0x0b, - 0x8c8: 0x0b, 0x8c9: 0x0b, 0x8ca: 0x0b, 0x8cb: 0x0b, 0x8cc: 0x0b, 0x8cd: 0x0b, 0x8ce: 0x0b, 0x8cf: 0x0b, -} - -// idnaSparseOffset: 284 entries, 568 bytes -var idnaSparseOffset = []uint16{0x0, 0x8, 0x19, 0x25, 0x27, 0x2c, 0x33, 0x3e, 0x4a, 0x4e, 0x5d, 0x62, 0x6c, 0x78, 0x86, 0x8b, 0x94, 0xa4, 0xb2, 0xbe, 0xca, 0xdb, 0xe5, 0xec, 0xf9, 0x10a, 0x111, 0x11c, 0x12b, 0x139, 0x143, 0x145, 0x14a, 0x14d, 0x150, 0x152, 0x15e, 0x169, 0x171, 0x177, 0x17d, 0x182, 0x187, 0x18a, 0x18e, 0x194, 0x199, 0x1a5, 0x1af, 0x1b5, 0x1c6, 0x1d0, 0x1d3, 0x1db, 0x1de, 0x1eb, 0x1f3, 0x1f7, 0x1fe, 0x206, 0x216, 0x222, 0x224, 0x22e, 0x23a, 0x246, 0x252, 0x25a, 0x25f, 0x26c, 0x27d, 0x281, 0x28c, 0x290, 0x299, 0x2a1, 0x2a7, 0x2ac, 0x2af, 0x2b3, 0x2b9, 0x2bd, 0x2c1, 0x2c5, 0x2cb, 0x2d3, 0x2da, 0x2e5, 0x2ef, 0x2f3, 0x2f6, 0x2fc, 0x300, 0x302, 0x305, 0x307, 0x30a, 0x314, 0x317, 0x326, 0x32a, 0x32f, 0x332, 0x336, 0x33b, 0x340, 0x346, 0x352, 0x361, 0x367, 0x36b, 0x37a, 0x37f, 0x387, 0x391, 0x39c, 0x3a4, 0x3b5, 0x3be, 0x3ce, 0x3db, 0x3e5, 0x3ea, 0x3f7, 0x3fb, 0x400, 0x402, 0x406, 0x408, 0x40c, 0x415, 0x41b, 0x41f, 0x42f, 0x439, 0x43e, 0x441, 0x447, 0x44e, 0x453, 0x457, 0x45d, 0x462, 0x46b, 0x470, 0x476, 0x47d, 0x484, 0x48b, 0x48f, 0x494, 0x497, 0x49c, 0x4a8, 0x4ae, 0x4b3, 0x4ba, 0x4c2, 0x4c7, 0x4cb, 0x4db, 0x4e2, 0x4e6, 0x4ea, 0x4f1, 0x4f3, 0x4f6, 0x4f9, 0x4fd, 0x506, 0x50a, 0x512, 0x51a, 0x51e, 0x524, 0x52d, 0x539, 0x540, 0x549, 0x553, 0x55a, 0x568, 0x575, 0x582, 0x58b, 0x58f, 0x59f, 0x5a7, 0x5b2, 0x5bb, 0x5c1, 0x5c9, 0x5d2, 0x5dd, 0x5e0, 0x5ec, 0x5f5, 0x5f8, 0x5fd, 0x602, 0x60f, 0x61a, 0x623, 0x62d, 0x630, 0x63a, 0x643, 0x64f, 0x65c, 0x669, 0x677, 0x67e, 0x682, 0x685, 0x68a, 0x68d, 0x692, 0x695, 0x69c, 0x6a3, 0x6a7, 0x6b2, 0x6b5, 0x6b8, 0x6bb, 0x6c1, 0x6c7, 0x6cd, 0x6d0, 0x6d3, 0x6d6, 0x6dd, 0x6e0, 0x6e5, 0x6ef, 0x6f2, 0x6f6, 0x705, 0x711, 0x715, 0x71a, 0x71e, 0x723, 0x727, 0x72c, 0x735, 0x740, 0x746, 0x74c, 0x752, 0x758, 0x761, 0x764, 0x767, 0x76b, 0x76f, 0x773, 0x779, 0x77f, 0x784, 0x787, 0x797, 0x79e, 0x7a1, 0x7a6, 0x7aa, 0x7b0, 0x7b5, 0x7b9, 0x7bf, 0x7c5, 0x7c9, 0x7d2, 0x7d7, 0x7da, 0x7dd, 0x7e1, 0x7e5, 0x7e8, 0x7f8, 0x809, 0x80e, 0x810, 0x812} - -// idnaSparseValues: 2069 entries, 8276 bytes -var idnaSparseValues = [2069]valueRange{ - // Block 0x0, offset 0x0 - {value: 0x0000, lo: 0x07}, - {value: 0xe105, lo: 0x80, hi: 0x96}, - {value: 0x0018, lo: 0x97, hi: 0x97}, - {value: 0xe105, lo: 0x98, hi: 0x9e}, - {value: 0x001f, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbf}, - // Block 0x1, offset 0x8 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0xe01d, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0335, lo: 0x83, hi: 0x83}, - {value: 0x034d, lo: 0x84, hi: 0x84}, - {value: 0x0365, lo: 0x85, hi: 0x85}, - {value: 0xe00d, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0xe00d, lo: 0x88, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x89}, - {value: 0xe00d, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe00d, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0x8d}, - {value: 0xe00d, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0xbf}, - // Block 0x2, offset 0x19 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x0249, lo: 0xb0, hi: 0xb0}, - {value: 0x037d, lo: 0xb1, hi: 0xb1}, - {value: 0x0259, lo: 0xb2, hi: 0xb2}, - {value: 0x0269, lo: 0xb3, hi: 0xb3}, - {value: 0x034d, lo: 0xb4, hi: 0xb4}, - {value: 0x0395, lo: 0xb5, hi: 0xb5}, - {value: 0xe1bd, lo: 0xb6, hi: 0xb6}, - {value: 0x0279, lo: 0xb7, hi: 0xb7}, - {value: 0x0289, lo: 0xb8, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbf}, - // Block 0x3, offset 0x25 - {value: 0x0000, lo: 0x01}, - {value: 0x3308, lo: 0x80, hi: 0xbf}, - // Block 0x4, offset 0x27 - {value: 0x0000, lo: 0x04}, - {value: 0x03f5, lo: 0x80, hi: 0x8f}, - {value: 0xe105, lo: 0x90, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x5, offset 0x2c - {value: 0x0000, lo: 0x06}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x0545, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x0008, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x6, offset 0x33 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0401, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x88}, - {value: 0x0018, lo: 0x89, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0xbd}, - {value: 0x0818, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x7, offset 0x3e - {value: 0x0000, lo: 0x0b}, - {value: 0x0818, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x82}, - {value: 0x0818, lo: 0x83, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x85}, - {value: 0x0818, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xae}, - {value: 0x0808, lo: 0xaf, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x8, offset 0x4a - {value: 0x0000, lo: 0x03}, - {value: 0x0a08, lo: 0x80, hi: 0x87}, - {value: 0x0c08, lo: 0x88, hi: 0x99}, - {value: 0x0a08, lo: 0x9a, hi: 0xbf}, - // Block 0x9, offset 0x4e - {value: 0x0000, lo: 0x0e}, - {value: 0x3308, lo: 0x80, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0c08, lo: 0x8d, hi: 0x8d}, - {value: 0x0a08, lo: 0x8e, hi: 0x98}, - {value: 0x0c08, lo: 0x99, hi: 0x9b}, - {value: 0x0a08, lo: 0x9c, hi: 0xaa}, - {value: 0x0c08, lo: 0xab, hi: 0xac}, - {value: 0x0a08, lo: 0xad, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb1}, - {value: 0x0a08, lo: 0xb2, hi: 0xb2}, - {value: 0x0c08, lo: 0xb3, hi: 0xb4}, - {value: 0x0a08, lo: 0xb5, hi: 0xb7}, - {value: 0x0c08, lo: 0xb8, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbf}, - // Block 0xa, offset 0x5d - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xb0}, - {value: 0x0808, lo: 0xb1, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xb, offset 0x62 - {value: 0x0000, lo: 0x09}, - {value: 0x0808, lo: 0x80, hi: 0x89}, - {value: 0x0a08, lo: 0x8a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x0818, lo: 0xbe, hi: 0xbf}, - // Block 0xc, offset 0x6c - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x99}, - {value: 0x0808, lo: 0x9a, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa3}, - {value: 0x0808, lo: 0xa4, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa7}, - {value: 0x0808, lo: 0xa8, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0818, lo: 0xb0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xd, offset 0x78 - {value: 0x0000, lo: 0x0d}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0a08, lo: 0xa0, hi: 0xa9}, - {value: 0x0c08, lo: 0xaa, hi: 0xac}, - {value: 0x0808, lo: 0xad, hi: 0xad}, - {value: 0x0c08, lo: 0xae, hi: 0xae}, - {value: 0x0a08, lo: 0xaf, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb2}, - {value: 0x0a08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0a08, lo: 0xb6, hi: 0xb8}, - {value: 0x0c08, lo: 0xb9, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0xe, offset 0x86 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x92}, - {value: 0x3308, lo: 0x93, hi: 0xa1}, - {value: 0x0840, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xbf}, - // Block 0xf, offset 0x8b - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x10, offset 0x94 - {value: 0x0000, lo: 0x0f}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x85}, - {value: 0x3008, lo: 0x86, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x3008, lo: 0x8a, hi: 0x8c}, - {value: 0x3b08, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x11, offset 0xa4 - {value: 0x0000, lo: 0x0d}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x12, offset 0xb2 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xba}, - {value: 0x3b08, lo: 0xbb, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x13, offset 0xbe - {value: 0x0000, lo: 0x0b}, - {value: 0x0040, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x14, offset 0xca - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x89}, - {value: 0x3b08, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x3008, lo: 0x98, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x15, offset 0xdb - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb2}, - {value: 0x08f1, lo: 0xb3, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb9}, - {value: 0x3b08, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0x16, offset 0xe5 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x8e}, - {value: 0x0018, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0xbf}, - // Block 0x17, offset 0xec - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0961, lo: 0x9c, hi: 0x9c}, - {value: 0x0999, lo: 0x9d, hi: 0x9d}, - {value: 0x0008, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x18, offset 0xf9 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe03d, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x19, offset 0x10a - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0xbf}, - // Block 0x1a, offset 0x111 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x1b, offset 0x11c - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x3008, lo: 0x96, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x3308, lo: 0x9e, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xa1}, - {value: 0x3008, lo: 0xa2, hi: 0xa4}, - {value: 0x0008, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xbf}, - // Block 0x1c, offset 0x12b - {value: 0x0000, lo: 0x0d}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x8c}, - {value: 0x3308, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x3008, lo: 0x9a, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x1d, offset 0x139 - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x86}, - {value: 0x055d, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8c}, - {value: 0x055d, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbb}, - {value: 0xe105, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0x1e, offset 0x143 - {value: 0x0000, lo: 0x01}, - {value: 0x0018, lo: 0x80, hi: 0xbf}, - // Block 0x1f, offset 0x145 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa0}, - {value: 0x2018, lo: 0xa1, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x20, offset 0x14a - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa7}, - {value: 0x2018, lo: 0xa8, hi: 0xbf}, - // Block 0x21, offset 0x14d - {value: 0x0000, lo: 0x02}, - {value: 0x2018, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0xbf}, - // Block 0x22, offset 0x150 - {value: 0x0000, lo: 0x01}, - {value: 0x0008, lo: 0x80, hi: 0xbf}, - // Block 0x23, offset 0x152 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x24, offset 0x15e - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x25, offset 0x169 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x26, offset 0x171 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x27, offset 0x177 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x28, offset 0x17d - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x29, offset 0x182 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x2a, offset 0x187 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x2b, offset 0x18a - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xbf}, - // Block 0x2c, offset 0x18e - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x2d, offset 0x194 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0x2e, offset 0x199 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x3b08, lo: 0x94, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x2f, offset 0x1a5 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x30, offset 0x1af - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xb3}, - {value: 0x3340, lo: 0xb4, hi: 0xb5}, - {value: 0x3008, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x31, offset 0x1b5 - {value: 0x0000, lo: 0x10}, - {value: 0x3008, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x91}, - {value: 0x3b08, lo: 0x92, hi: 0x92}, - {value: 0x3308, lo: 0x93, hi: 0x93}, - {value: 0x0018, lo: 0x94, hi: 0x96}, - {value: 0x0008, lo: 0x97, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x32, offset 0x1c6 - {value: 0x0000, lo: 0x09}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x86}, - {value: 0x0218, lo: 0x87, hi: 0x87}, - {value: 0x0018, lo: 0x88, hi: 0x8a}, - {value: 0x33c0, lo: 0x8b, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0208, lo: 0xa0, hi: 0xbf}, - // Block 0x33, offset 0x1d0 - {value: 0x0000, lo: 0x02}, - {value: 0x0208, lo: 0x80, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0x34, offset 0x1d3 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0208, lo: 0x87, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xa9}, - {value: 0x0208, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x35, offset 0x1db - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0x36, offset 0x1de - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x37, offset 0x1eb - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x38, offset 0x1f3 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x39, offset 0x1f7 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0028, lo: 0x9a, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xbf}, - // Block 0x3a, offset 0x1fe - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x3308, lo: 0x97, hi: 0x98}, - {value: 0x3008, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x3b, offset 0x206 - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x94}, - {value: 0x3008, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3b08, lo: 0xa0, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xac}, - {value: 0x3008, lo: 0xad, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x3c, offset 0x216 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xbd}, - {value: 0x3318, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x3d, offset 0x222 - {value: 0x0000, lo: 0x01}, - {value: 0x0040, lo: 0x80, hi: 0xbf}, - // Block 0x3e, offset 0x224 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3008, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x3f, offset 0x22e - {value: 0x0000, lo: 0x0b}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x3808, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x40, offset 0x23a - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3808, lo: 0xaa, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xbf}, - // Block 0x41, offset 0x246 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3008, lo: 0xaa, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3808, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbf}, - // Block 0x42, offset 0x252 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x3008, lo: 0xa4, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbf}, - // Block 0x43, offset 0x25a - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x44, offset 0x25f - {value: 0x0000, lo: 0x0c}, - {value: 0x0e29, lo: 0x80, hi: 0x80}, - {value: 0x0e41, lo: 0x81, hi: 0x81}, - {value: 0x0e59, lo: 0x82, hi: 0x82}, - {value: 0x0e71, lo: 0x83, hi: 0x83}, - {value: 0x0e89, lo: 0x84, hi: 0x85}, - {value: 0x0ea1, lo: 0x86, hi: 0x86}, - {value: 0x0eb9, lo: 0x87, hi: 0x87}, - {value: 0x057d, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x059d, lo: 0x90, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbc}, - {value: 0x059d, lo: 0xbd, hi: 0xbf}, - // Block 0x45, offset 0x26c - {value: 0x0000, lo: 0x10}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x92}, - {value: 0x0018, lo: 0x93, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa8}, - {value: 0x0008, lo: 0xa9, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x46, offset 0x27d - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0x47, offset 0x281 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x87}, - {value: 0xe045, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0xe045, lo: 0x98, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0xe045, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbf}, - // Block 0x48, offset 0x28c - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x3318, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbf}, - // Block 0x49, offset 0x290 - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x88}, - {value: 0x24c1, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x4a, offset 0x299 - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x24f1, lo: 0xac, hi: 0xac}, - {value: 0x2529, lo: 0xad, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xae}, - {value: 0x2579, lo: 0xaf, hi: 0xaf}, - {value: 0x25b1, lo: 0xb0, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0x4b, offset 0x2a1 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x9f}, - {value: 0x0080, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xad}, - {value: 0x0080, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x4c, offset 0x2a7 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xa8}, - {value: 0x09dd, lo: 0xa9, hi: 0xa9}, - {value: 0x09fd, lo: 0xaa, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xbf}, - // Block 0x4d, offset 0x2ac - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xbf}, - // Block 0x4e, offset 0x2af - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x28c1, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0xbf}, - // Block 0x4f, offset 0x2b3 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0e7e, lo: 0xb4, hi: 0xb4}, - {value: 0x292a, lo: 0xb5, hi: 0xb5}, - {value: 0x0e9e, lo: 0xb6, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x50, offset 0x2b9 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x9b}, - {value: 0x2941, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0xbf}, - // Block 0x51, offset 0x2bd - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x52, offset 0x2c1 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0xbf}, - // Block 0x53, offset 0x2c5 - {value: 0x0000, lo: 0x05}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x03f5, lo: 0x90, hi: 0x9f}, - {value: 0x0ebd, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x54, offset 0x2cb - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x55, offset 0x2d3 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xae}, - {value: 0xe075, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0x56, offset 0x2da - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x57, offset 0x2e5 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xbf}, - // Block 0x58, offset 0x2ef - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x59, offset 0x2f3 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0xbf}, - // Block 0x5a, offset 0x2f6 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9e}, - {value: 0x0ef5, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0x5b, offset 0x2fc - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb2}, - {value: 0x0f15, lo: 0xb3, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x5c, offset 0x300 - {value: 0x0020, lo: 0x01}, - {value: 0x0f35, lo: 0x80, hi: 0xbf}, - // Block 0x5d, offset 0x302 - {value: 0x0020, lo: 0x02}, - {value: 0x1735, lo: 0x80, hi: 0x8f}, - {value: 0x1915, lo: 0x90, hi: 0xbf}, - // Block 0x5e, offset 0x305 - {value: 0x0020, lo: 0x01}, - {value: 0x1f15, lo: 0x80, hi: 0xbf}, - // Block 0x5f, offset 0x307 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x60, offset 0x30a - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9a}, - {value: 0x29e2, lo: 0x9b, hi: 0x9b}, - {value: 0x2a0a, lo: 0x9c, hi: 0x9c}, - {value: 0x0008, lo: 0x9d, hi: 0x9e}, - {value: 0x2a31, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xbf}, - // Block 0x61, offset 0x314 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbe}, - {value: 0x2a69, lo: 0xbf, hi: 0xbf}, - // Block 0x62, offset 0x317 - {value: 0x0000, lo: 0x0e}, - {value: 0x0040, lo: 0x80, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xb0}, - {value: 0x2a35, lo: 0xb1, hi: 0xb1}, - {value: 0x2a55, lo: 0xb2, hi: 0xb2}, - {value: 0x2a75, lo: 0xb3, hi: 0xb3}, - {value: 0x2a95, lo: 0xb4, hi: 0xb4}, - {value: 0x2a75, lo: 0xb5, hi: 0xb5}, - {value: 0x2ab5, lo: 0xb6, hi: 0xb6}, - {value: 0x2ad5, lo: 0xb7, hi: 0xb7}, - {value: 0x2af5, lo: 0xb8, hi: 0xb9}, - {value: 0x2b15, lo: 0xba, hi: 0xbb}, - {value: 0x2b35, lo: 0xbc, hi: 0xbd}, - {value: 0x2b15, lo: 0xbe, hi: 0xbf}, - // Block 0x63, offset 0x326 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x64, offset 0x32a - {value: 0x0030, lo: 0x04}, - {value: 0x2aa2, lo: 0x80, hi: 0x9d}, - {value: 0x305a, lo: 0x9e, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x30a2, lo: 0xa0, hi: 0xbf}, - // Block 0x65, offset 0x32f - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x66, offset 0x332 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x67, offset 0x336 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x68, offset 0x33b - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xbf}, - // Block 0x69, offset 0x340 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb1}, - {value: 0x0018, lo: 0xb2, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6a, offset 0x346 - {value: 0x0000, lo: 0x0b}, - {value: 0x0040, lo: 0x80, hi: 0x81}, - {value: 0xe00d, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0x83}, - {value: 0x03f5, lo: 0x84, hi: 0x84}, - {value: 0x1329, lo: 0x85, hi: 0x85}, - {value: 0x447d, lo: 0x86, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0xb6}, - {value: 0x0008, lo: 0xb7, hi: 0xb7}, - {value: 0x2009, lo: 0xb8, hi: 0xb8}, - {value: 0x6e89, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xbf}, - // Block 0x6b, offset 0x352 - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x3308, lo: 0x8b, hi: 0x8b}, - {value: 0x0008, lo: 0x8c, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x6c, offset 0x361 - {value: 0x0000, lo: 0x05}, - {value: 0x0208, lo: 0x80, hi: 0xb1}, - {value: 0x0108, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6d, offset 0x367 - {value: 0x0000, lo: 0x03}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xbf}, - // Block 0x6e, offset 0x36b - {value: 0x0000, lo: 0x0e}, - {value: 0x3008, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xba}, - {value: 0x0008, lo: 0xbb, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x6f, offset 0x37a - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x70, offset 0x37f - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x91}, - {value: 0x3008, lo: 0x92, hi: 0x92}, - {value: 0x3808, lo: 0x93, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x71, offset 0x387 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb9}, - {value: 0x3008, lo: 0xba, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x72, offset 0x391 - {value: 0x0000, lo: 0x0a}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x73, offset 0x39c - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x74, offset 0x3a4 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8c}, - {value: 0x3008, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbd}, - {value: 0x0008, lo: 0xbe, hi: 0xbf}, - // Block 0x75, offset 0x3b5 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x76, offset 0x3be - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x9a}, - {value: 0x0008, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3b08, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x77, offset 0x3ce - {value: 0x0000, lo: 0x0c}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x90}, - {value: 0x0008, lo: 0x91, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x78, offset 0x3db - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x449d, lo: 0x9c, hi: 0x9c}, - {value: 0x44b5, lo: 0x9d, hi: 0x9d}, - {value: 0x2971, lo: 0x9e, hi: 0x9e}, - {value: 0xe06d, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x44cd, lo: 0xb0, hi: 0xbf}, - // Block 0x79, offset 0x3e5 - {value: 0x0000, lo: 0x04}, - {value: 0x44ed, lo: 0x80, hi: 0x8f}, - {value: 0x450d, lo: 0x90, hi: 0x9f}, - {value: 0x452d, lo: 0xa0, hi: 0xaf}, - {value: 0x450d, lo: 0xb0, hi: 0xbf}, - // Block 0x7a, offset 0x3ea - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3b08, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x7b, offset 0x3f7 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x7c, offset 0x3fb - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x7d, offset 0x400 - {value: 0x0020, lo: 0x01}, - {value: 0x454d, lo: 0x80, hi: 0xbf}, - // Block 0x7e, offset 0x402 - {value: 0x0020, lo: 0x03}, - {value: 0x4d4d, lo: 0x80, hi: 0x94}, - {value: 0x4b0d, lo: 0x95, hi: 0x95}, - {value: 0x4fed, lo: 0x96, hi: 0xbf}, - // Block 0x7f, offset 0x406 - {value: 0x0020, lo: 0x01}, - {value: 0x552d, lo: 0x80, hi: 0xbf}, - // Block 0x80, offset 0x408 - {value: 0x0020, lo: 0x03}, - {value: 0x5d2d, lo: 0x80, hi: 0x84}, - {value: 0x568d, lo: 0x85, hi: 0x85}, - {value: 0x5dcd, lo: 0x86, hi: 0xbf}, - // Block 0x81, offset 0x40c - {value: 0x0020, lo: 0x08}, - {value: 0x6b8d, lo: 0x80, hi: 0x8f}, - {value: 0x6d4d, lo: 0x90, hi: 0x90}, - {value: 0x6d8d, lo: 0x91, hi: 0xab}, - {value: 0x6ea1, lo: 0xac, hi: 0xac}, - {value: 0x70ed, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x710d, lo: 0xb0, hi: 0xbf}, - // Block 0x82, offset 0x415 - {value: 0x0020, lo: 0x05}, - {value: 0x730d, lo: 0x80, hi: 0xad}, - {value: 0x656d, lo: 0xae, hi: 0xae}, - {value: 0x78cd, lo: 0xaf, hi: 0xb5}, - {value: 0x6f8d, lo: 0xb6, hi: 0xb6}, - {value: 0x79ad, lo: 0xb7, hi: 0xbf}, - // Block 0x83, offset 0x41b - {value: 0x0028, lo: 0x03}, - {value: 0x7c21, lo: 0x80, hi: 0x82}, - {value: 0x7be1, lo: 0x83, hi: 0x83}, - {value: 0x7c99, lo: 0x84, hi: 0xbf}, - // Block 0x84, offset 0x41f - {value: 0x0038, lo: 0x0f}, - {value: 0x9db1, lo: 0x80, hi: 0x83}, - {value: 0x9e59, lo: 0x84, hi: 0x85}, - {value: 0x9e91, lo: 0x86, hi: 0x87}, - {value: 0x9ec9, lo: 0x88, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0xa089, lo: 0x92, hi: 0x97}, - {value: 0xa1a1, lo: 0x98, hi: 0x9c}, - {value: 0xa281, lo: 0x9d, hi: 0xb3}, - {value: 0x9d41, lo: 0xb4, hi: 0xb4}, - {value: 0x9db1, lo: 0xb5, hi: 0xb5}, - {value: 0xa789, lo: 0xb6, hi: 0xbb}, - {value: 0xa869, lo: 0xbc, hi: 0xbc}, - {value: 0xa7f9, lo: 0xbd, hi: 0xbd}, - {value: 0xa8d9, lo: 0xbe, hi: 0xbf}, - // Block 0x85, offset 0x42f - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x0008, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x86, offset 0x439 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0x87, offset 0x43e - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x88, offset 0x441 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x89, offset 0x447 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x8a, offset 0x44e - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x8b, offset 0x453 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x8c, offset 0x457 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x8d, offset 0x45d - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xbf}, - // Block 0x8e, offset 0x462 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x8f, offset 0x46b - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x90, offset 0x470 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0xbf}, - // Block 0x91, offset 0x476 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x97}, - {value: 0x8b0d, lo: 0x98, hi: 0x9f}, - {value: 0x8b25, lo: 0xa0, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xbf}, - // Block 0x92, offset 0x47d - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x8b25, lo: 0xb0, hi: 0xb7}, - {value: 0x8b0d, lo: 0xb8, hi: 0xbf}, - // Block 0x93, offset 0x484 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x94, offset 0x48b - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x95, offset 0x48f - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xae}, - {value: 0x0018, lo: 0xaf, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x96, offset 0x494 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x97, offset 0x497 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xbf}, - // Block 0x98, offset 0x49c - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0808, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0808, lo: 0x8a, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb6}, - {value: 0x0808, lo: 0xb7, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbb}, - {value: 0x0808, lo: 0xbc, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x0808, lo: 0xbf, hi: 0xbf}, - // Block 0x99, offset 0x4a8 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x96}, - {value: 0x0818, lo: 0x97, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb6}, - {value: 0x0818, lo: 0xb7, hi: 0xbf}, - // Block 0x9a, offset 0x4ae - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa6}, - {value: 0x0818, lo: 0xa7, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x9b, offset 0x4b3 - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xba}, - {value: 0x0818, lo: 0xbb, hi: 0xbf}, - // Block 0x9c, offset 0x4ba - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0818, lo: 0x96, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbe}, - {value: 0x0818, lo: 0xbf, hi: 0xbf}, - // Block 0x9d, offset 0x4c2 - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbb}, - {value: 0x0818, lo: 0xbc, hi: 0xbd}, - {value: 0x0808, lo: 0xbe, hi: 0xbf}, - // Block 0x9e, offset 0x4c7 - {value: 0x0000, lo: 0x03}, - {value: 0x0818, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x0818, lo: 0x92, hi: 0xbf}, - // Block 0x9f, offset 0x4cb - {value: 0x0000, lo: 0x0f}, - {value: 0x0808, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x94}, - {value: 0x0808, lo: 0x95, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0x98}, - {value: 0x0808, lo: 0x99, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xa0, offset 0x4db - {value: 0x0000, lo: 0x06}, - {value: 0x0818, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x0818, lo: 0x90, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xbc}, - {value: 0x0818, lo: 0xbd, hi: 0xbf}, - // Block 0xa1, offset 0x4e2 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0x9c}, - {value: 0x0818, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xa2, offset 0x4e6 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb8}, - {value: 0x0018, lo: 0xb9, hi: 0xbf}, - // Block 0xa3, offset 0x4ea - {value: 0x0000, lo: 0x06}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0818, lo: 0x98, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb7}, - {value: 0x0818, lo: 0xb8, hi: 0xbf}, - // Block 0xa4, offset 0x4f1 - {value: 0x0000, lo: 0x01}, - {value: 0x0808, lo: 0x80, hi: 0xbf}, - // Block 0xa5, offset 0x4f3 - {value: 0x0000, lo: 0x02}, - {value: 0x0808, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0xa6, offset 0x4f6 - {value: 0x0000, lo: 0x02}, - {value: 0x03dd, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xa7, offset 0x4f9 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xbf}, - // Block 0xa8, offset 0x4fd - {value: 0x0000, lo: 0x08}, - {value: 0x0908, lo: 0x80, hi: 0x80}, - {value: 0x0a08, lo: 0x81, hi: 0xa1}, - {value: 0x0c08, lo: 0xa2, hi: 0xa2}, - {value: 0x0a08, lo: 0xa3, hi: 0xa3}, - {value: 0x3308, lo: 0xa4, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0808, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xa9, offset 0x506 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0818, lo: 0xa0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xaa, offset 0x50a - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x9c}, - {value: 0x0818, lo: 0x9d, hi: 0xa6}, - {value: 0x0808, lo: 0xa7, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0a08, lo: 0xb0, hi: 0xb2}, - {value: 0x0c08, lo: 0xb3, hi: 0xb3}, - {value: 0x0a08, lo: 0xb4, hi: 0xbf}, - // Block 0xab, offset 0x512 - {value: 0x0000, lo: 0x07}, - {value: 0x0a08, lo: 0x80, hi: 0x84}, - {value: 0x0808, lo: 0x85, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x90}, - {value: 0x0a18, lo: 0x91, hi: 0x93}, - {value: 0x0c18, lo: 0x94, hi: 0x94}, - {value: 0x0818, lo: 0x95, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xac, offset 0x51a - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xad, offset 0x51e - {value: 0x0000, lo: 0x05}, - {value: 0x3008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xae, offset 0x524 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x91}, - {value: 0x0018, lo: 0x92, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xaf, offset 0x52d - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0xb0, offset 0x539 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb1, offset 0x540 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb2}, - {value: 0x3b08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xbf}, - // Block 0xb2, offset 0x549 - {value: 0x0000, lo: 0x09}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x3008, lo: 0x85, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xb3, offset 0x553 - {value: 0x0000, lo: 0x06}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xbe}, - {value: 0x3008, lo: 0xbf, hi: 0xbf}, - // Block 0xb4, offset 0x55a - {value: 0x0000, lo: 0x0d}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xb5, offset 0x568 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3808, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xb6, offset 0x575 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0008, lo: 0x9f, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xb7, offset 0x582 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x3308, lo: 0x9f, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa9}, - {value: 0x3b08, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb8, offset 0x58b - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xb9, offset 0x58f - {value: 0x0000, lo: 0x0f}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x84}, - {value: 0x3008, lo: 0x85, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9d}, - {value: 0x3308, lo: 0x9e, hi: 0x9e}, - {value: 0x0008, lo: 0x9f, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xba, offset 0x59f - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xbb, offset 0x5a7 - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x85}, - {value: 0x0018, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xbc, offset 0x5b2 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbd, offset 0x5bb - {value: 0x0000, lo: 0x05}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9b}, - {value: 0x3308, lo: 0x9c, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0xbe, offset 0x5c1 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbf, offset 0x5c9 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xc0, offset 0x5d2 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb5}, - {value: 0x3808, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xc1, offset 0x5dd - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0xbf}, - // Block 0xc2, offset 0x5e0 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbf}, - // Block 0xc3, offset 0x5ec - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0xc4, offset 0x5f5 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xbf}, - // Block 0xc5, offset 0x5f8 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0xc6, offset 0x5fd - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xbf}, - // Block 0xc7, offset 0x602 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x3008, lo: 0x91, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0x99}, - {value: 0x3308, lo: 0x9a, hi: 0x9b}, - {value: 0x3008, lo: 0x9c, hi: 0x9f}, - {value: 0x3b08, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xa1}, - {value: 0x0018, lo: 0xa2, hi: 0xa2}, - {value: 0x0008, lo: 0xa3, hi: 0xa3}, - {value: 0x3008, lo: 0xa4, hi: 0xa4}, - {value: 0x0040, lo: 0xa5, hi: 0xbf}, - // Block 0xc8, offset 0x60f - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0xc9, offset 0x61a - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x3b08, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0xbf}, - // Block 0xca, offset 0x623 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x3308, lo: 0x8a, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x98}, - {value: 0x3b08, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9c}, - {value: 0x0008, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xa2}, - {value: 0x0040, lo: 0xa3, hi: 0xbf}, - // Block 0xcb, offset 0x62d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xcc, offset 0x630 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xcd, offset 0x63a - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xbf}, - // Block 0xce, offset 0x643 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xa9}, - {value: 0x3308, lo: 0xaa, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xcf, offset 0x64f - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xd0, offset 0x65c - {value: 0x0000, lo: 0x0c}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xbf}, - // Block 0xd1, offset 0x669 - {value: 0x0000, lo: 0x0d}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x3008, lo: 0x8a, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x92}, - {value: 0x3008, lo: 0x93, hi: 0x94}, - {value: 0x3308, lo: 0x95, hi: 0x95}, - {value: 0x3008, lo: 0x96, hi: 0x96}, - {value: 0x3b08, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xbf}, - // Block 0xd2, offset 0x677 - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xd3, offset 0x67e - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0xd4, offset 0x682 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xd5, offset 0x685 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xd6, offset 0x68a - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0xbf}, - // Block 0xd7, offset 0x68d - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0340, lo: 0xb0, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xd8, offset 0x692 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0xbf}, - // Block 0xd9, offset 0x695 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xda, offset 0x69c - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xdb, offset 0x6a3 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0xdc, offset 0x6a7 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x0008, lo: 0xa3, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0xdd, offset 0x6b2 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0xbf}, - // Block 0xde, offset 0x6b5 - {value: 0x0000, lo: 0x02}, - {value: 0xe105, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0xdf, offset 0x6b8 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0xbf}, - // Block 0xe0, offset 0x6bb - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8e}, - {value: 0x3308, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3008, lo: 0x91, hi: 0xbf}, - // Block 0xe1, offset 0x6c1 - {value: 0x0000, lo: 0x05}, - {value: 0x3008, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8e}, - {value: 0x3308, lo: 0x8f, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xe2, offset 0x6c7 - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa1}, - {value: 0x0018, lo: 0xa2, hi: 0xa2}, - {value: 0x0008, lo: 0xa3, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xbf}, - // Block 0xe3, offset 0x6cd - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0xe4, offset 0x6d0 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xe5, offset 0x6d3 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xbf}, - // Block 0xe6, offset 0x6d6 - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x92}, - {value: 0x0040, lo: 0x93, hi: 0xa3}, - {value: 0x0008, lo: 0xa4, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xe7, offset 0x6dd - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0xe8, offset 0x6e0 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0xe9, offset 0x6e5 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x03c0, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xbf}, - // Block 0xea, offset 0x6ef - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xeb, offset 0x6f2 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xbf}, - // Block 0xec, offset 0x6f6 - {value: 0x0000, lo: 0x0e}, - {value: 0x0018, lo: 0x80, hi: 0x9d}, - {value: 0xb5b9, lo: 0x9e, hi: 0x9e}, - {value: 0xb601, lo: 0x9f, hi: 0x9f}, - {value: 0xb649, lo: 0xa0, hi: 0xa0}, - {value: 0xb6b1, lo: 0xa1, hi: 0xa1}, - {value: 0xb719, lo: 0xa2, hi: 0xa2}, - {value: 0xb781, lo: 0xa3, hi: 0xa3}, - {value: 0xb7e9, lo: 0xa4, hi: 0xa4}, - {value: 0x3018, lo: 0xa5, hi: 0xa6}, - {value: 0x3318, lo: 0xa7, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xac}, - {value: 0x3018, lo: 0xad, hi: 0xb2}, - {value: 0x0340, lo: 0xb3, hi: 0xba}, - {value: 0x3318, lo: 0xbb, hi: 0xbf}, - // Block 0xed, offset 0x705 - {value: 0x0000, lo: 0x0b}, - {value: 0x3318, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0x84}, - {value: 0x3318, lo: 0x85, hi: 0x8b}, - {value: 0x0018, lo: 0x8c, hi: 0xa9}, - {value: 0x3318, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xba}, - {value: 0xb851, lo: 0xbb, hi: 0xbb}, - {value: 0xb899, lo: 0xbc, hi: 0xbc}, - {value: 0xb8e1, lo: 0xbd, hi: 0xbd}, - {value: 0xb949, lo: 0xbe, hi: 0xbe}, - {value: 0xb9b1, lo: 0xbf, hi: 0xbf}, - // Block 0xee, offset 0x711 - {value: 0x0000, lo: 0x03}, - {value: 0xba19, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xbf}, - // Block 0xef, offset 0x715 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x3318, lo: 0x82, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0xbf}, - // Block 0xf0, offset 0x71a - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0xf1, offset 0x71e - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xf2, offset 0x723 - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0xf3, offset 0x727 - {value: 0x0000, lo: 0x04}, - {value: 0x3308, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0xf4, offset 0x72c - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x3308, lo: 0xa1, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xf5, offset 0x735 - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa4}, - {value: 0x0040, lo: 0xa5, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xbf}, - // Block 0xf6, offset 0x740 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0008, lo: 0xb7, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0xf7, offset 0x746 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x8e}, - {value: 0x0018, lo: 0x8f, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0xbf}, - // Block 0xf8, offset 0x74c - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0xf9, offset 0x752 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x86}, - {value: 0x0818, lo: 0x87, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0xfa, offset 0x758 - {value: 0x0000, lo: 0x08}, - {value: 0x0a08, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x8a}, - {value: 0x0b08, lo: 0x8b, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0818, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xfb, offset 0x761 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xb0}, - {value: 0x0818, lo: 0xb1, hi: 0xbf}, - // Block 0xfc, offset 0x764 - {value: 0x0000, lo: 0x02}, - {value: 0x0818, lo: 0x80, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xfd, offset 0x767 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0818, lo: 0x81, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0xfe, offset 0x76b - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xff, offset 0x76f - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x100, offset 0x773 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0x101, offset 0x779 - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0x102, offset 0x77f - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8f}, - {value: 0xc1d9, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0x103, offset 0x784 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xbf}, - // Block 0x104, offset 0x787 - {value: 0x0000, lo: 0x0f}, - {value: 0xc801, lo: 0x80, hi: 0x80}, - {value: 0xc851, lo: 0x81, hi: 0x81}, - {value: 0xc8a1, lo: 0x82, hi: 0x82}, - {value: 0xc8f1, lo: 0x83, hi: 0x83}, - {value: 0xc941, lo: 0x84, hi: 0x84}, - {value: 0xc991, lo: 0x85, hi: 0x85}, - {value: 0xc9e1, lo: 0x86, hi: 0x86}, - {value: 0xca31, lo: 0x87, hi: 0x87}, - {value: 0xca81, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0xcad1, lo: 0x90, hi: 0x90}, - {value: 0xcaf1, lo: 0x91, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xbf}, - // Block 0x105, offset 0x797 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x106, offset 0x79e - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x107, offset 0x7a1 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xbf}, - // Block 0x108, offset 0x7a6 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x109, offset 0x7aa - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0x10a, offset 0x7b0 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xbf}, - // Block 0x10b, offset 0x7b5 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0xbf}, - // Block 0x10c, offset 0x7b9 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xb2}, - {value: 0x0018, lo: 0xb3, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbf}, - // Block 0x10d, offset 0x7bf - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0xa2}, - {value: 0x0040, lo: 0xa3, hi: 0xa4}, - {value: 0x0018, lo: 0xa5, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xbf}, - // Block 0x10e, offset 0x7c5 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0xbf}, - // Block 0x10f, offset 0x7c9 - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x110, offset 0x7d2 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0xbf}, - // Block 0x111, offset 0x7d7 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0x112, offset 0x7da - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x113, offset 0x7dd - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x114, offset 0x7e1 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x115, offset 0x7e5 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x116, offset 0x7e8 - {value: 0x0020, lo: 0x0f}, - {value: 0xded1, lo: 0x80, hi: 0x89}, - {value: 0x8e35, lo: 0x8a, hi: 0x8a}, - {value: 0xe011, lo: 0x8b, hi: 0x9c}, - {value: 0x8e55, lo: 0x9d, hi: 0x9d}, - {value: 0xe251, lo: 0x9e, hi: 0xa2}, - {value: 0x8e75, lo: 0xa3, hi: 0xa3}, - {value: 0xe2f1, lo: 0xa4, hi: 0xab}, - {value: 0x7f0d, lo: 0xac, hi: 0xac}, - {value: 0xe3f1, lo: 0xad, hi: 0xaf}, - {value: 0x8e95, lo: 0xb0, hi: 0xb0}, - {value: 0xe451, lo: 0xb1, hi: 0xb6}, - {value: 0x8eb5, lo: 0xb7, hi: 0xb9}, - {value: 0xe511, lo: 0xba, hi: 0xba}, - {value: 0x8f15, lo: 0xbb, hi: 0xbb}, - {value: 0xe531, lo: 0xbc, hi: 0xbf}, - // Block 0x117, offset 0x7f8 - {value: 0x0020, lo: 0x10}, - {value: 0x93b5, lo: 0x80, hi: 0x80}, - {value: 0xf0b1, lo: 0x81, hi: 0x86}, - {value: 0x93d5, lo: 0x87, hi: 0x8a}, - {value: 0xda11, lo: 0x8b, hi: 0x8b}, - {value: 0xf171, lo: 0x8c, hi: 0x96}, - {value: 0x9455, lo: 0x97, hi: 0x97}, - {value: 0xf2d1, lo: 0x98, hi: 0xa3}, - {value: 0x9475, lo: 0xa4, hi: 0xa6}, - {value: 0xf451, lo: 0xa7, hi: 0xaa}, - {value: 0x94d5, lo: 0xab, hi: 0xab}, - {value: 0xf4d1, lo: 0xac, hi: 0xac}, - {value: 0x94f5, lo: 0xad, hi: 0xad}, - {value: 0xf4f1, lo: 0xae, hi: 0xaf}, - {value: 0x9515, lo: 0xb0, hi: 0xb1}, - {value: 0xf531, lo: 0xb2, hi: 0xbe}, - {value: 0x2040, lo: 0xbf, hi: 0xbf}, - // Block 0x118, offset 0x809 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0340, lo: 0x81, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x9f}, - {value: 0x0340, lo: 0xa0, hi: 0xbf}, - // Block 0x119, offset 0x80e - {value: 0x0000, lo: 0x01}, - {value: 0x0340, lo: 0x80, hi: 0xbf}, - // Block 0x11a, offset 0x810 - {value: 0x0000, lo: 0x01}, - {value: 0x33c0, lo: 0x80, hi: 0xbf}, - // Block 0x11b, offset 0x812 - {value: 0x0000, lo: 0x02}, - {value: 0x33c0, lo: 0x80, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, -} - -// Total table size 42780 bytes (41KiB); checksum: 29936AB9 diff --git a/vendor/golang.org/x/net/idna/tables9.0.0.go b/vendor/golang.org/x/net/idna/tables9.0.0.go deleted file mode 100644 index 8b65fa167..000000000 --- a/vendor/golang.org/x/net/idna/tables9.0.0.go +++ /dev/null @@ -1,4486 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// +build !go1.10 - -package idna - -// UnicodeVersion is the Unicode version from which the tables in this package are derived. -const UnicodeVersion = "9.0.0" - -var mappings string = "" + // Size: 8175 bytes - "\x00\x01 \x03 ̈\x01a\x03 ̄\x012\x013\x03 ́\x03 ̧\x011\x01o\x051⁄4\x051⁄2" + - "\x053⁄4\x03i̇\x03l·\x03ʼn\x01s\x03dž\x03ⱥ\x03ⱦ\x01h\x01j\x01r\x01w\x01y" + - "\x03 ̆\x03 ̇\x03 ̊\x03 ̨\x03 ̃\x03 ̋\x01l\x01x\x04̈́\x03 ι\x01;\x05 ̈́" + - "\x04եւ\x04اٴ\x04وٴ\x04ۇٴ\x04يٴ\x06क़\x06ख़\x06ग़\x06ज़\x06ड़\x06ढ़\x06फ़" + - "\x06य़\x06ড়\x06ঢ়\x06য়\x06ਲ਼\x06ਸ਼\x06ਖ਼\x06ਗ਼\x06ਜ਼\x06ਫ਼\x06ଡ଼\x06ଢ଼" + - "\x06ํา\x06ໍາ\x06ຫນ\x06ຫມ\x06གྷ\x06ཌྷ\x06དྷ\x06བྷ\x06ཛྷ\x06ཀྵ\x06ཱི\x06ཱུ" + - "\x06ྲྀ\x09ྲཱྀ\x06ླྀ\x09ླཱྀ\x06ཱྀ\x06ྒྷ\x06ྜྷ\x06ྡྷ\x06ྦྷ\x06ྫྷ\x06ྐྵ\x02" + - "в\x02д\x02о\x02с\x02т\x02ъ\x02ѣ\x02æ\x01b\x01d\x01e\x02ǝ\x01g\x01i\x01k" + - "\x01m\x01n\x02ȣ\x01p\x01t\x01u\x02ɐ\x02ɑ\x02ə\x02ɛ\x02ɜ\x02ŋ\x02ɔ\x02ɯ" + - "\x01v\x02β\x02γ\x02δ\x02φ\x02χ\x02ρ\x02н\x02ɒ\x01c\x02ɕ\x02ð\x01f\x02ɟ" + - "\x02ɡ\x02ɥ\x02ɨ\x02ɩ\x02ɪ\x02ʝ\x02ɭ\x02ʟ\x02ɱ\x02ɰ\x02ɲ\x02ɳ\x02ɴ\x02ɵ" + - "\x02ɸ\x02ʂ\x02ʃ\x02ƫ\x02ʉ\x02ʊ\x02ʋ\x02ʌ\x01z\x02ʐ\x02ʑ\x02ʒ\x02θ\x02ss" + - "\x02ά\x02έ\x02ή\x02ί\x02ό\x02ύ\x02ώ\x05ἀι\x05ἁι\x05ἂι\x05ἃι\x05ἄι\x05ἅι" + - "\x05ἆι\x05ἇι\x05ἠι\x05ἡι\x05ἢι\x05ἣι\x05ἤι\x05ἥι\x05ἦι\x05ἧι\x05ὠι\x05ὡι" + - "\x05ὢι\x05ὣι\x05ὤι\x05ὥι\x05ὦι\x05ὧι\x05ὰι\x04αι\x04άι\x05ᾶι\x02ι\x05 ̈͂" + - "\x05ὴι\x04ηι\x04ήι\x05ῆι\x05 ̓̀\x05 ̓́\x05 ̓͂\x02ΐ\x05 ̔̀\x05 ̔́\x05 ̔͂" + - "\x02ΰ\x05 ̈̀\x01`\x05ὼι\x04ωι\x04ώι\x05ῶι\x06′′\x09′′′\x06‵‵\x09‵‵‵\x02!" + - "!\x02??\x02?!\x02!?\x0c′′′′\x010\x014\x015\x016\x017\x018\x019\x01+\x01=" + - "\x01(\x01)\x02rs\x02ħ\x02no\x01q\x02sm\x02tm\x02ω\x02å\x02א\x02ב\x02ג" + - "\x02ד\x02π\x051⁄7\x051⁄9\x061⁄10\x051⁄3\x052⁄3\x051⁄5\x052⁄5\x053⁄5\x054" + - "⁄5\x051⁄6\x055⁄6\x051⁄8\x053⁄8\x055⁄8\x057⁄8\x041⁄\x02ii\x02iv\x02vi" + - "\x04viii\x02ix\x02xi\x050⁄3\x06∫∫\x09∫∫∫\x06∮∮\x09∮∮∮\x0210\x0211\x0212" + - "\x0213\x0214\x0215\x0216\x0217\x0218\x0219\x0220\x04(10)\x04(11)\x04(12)" + - "\x04(13)\x04(14)\x04(15)\x04(16)\x04(17)\x04(18)\x04(19)\x04(20)\x0c∫∫∫∫" + - "\x02==\x05⫝̸\x02ɫ\x02ɽ\x02ȿ\x02ɀ\x01.\x04 ゙\x04 ゚\x06より\x06コト\x05(ᄀ)\x05" + - "(ᄂ)\x05(ᄃ)\x05(ᄅ)\x05(ᄆ)\x05(ᄇ)\x05(ᄉ)\x05(ᄋ)\x05(ᄌ)\x05(ᄎ)\x05(ᄏ)\x05(ᄐ" + - ")\x05(ᄑ)\x05(ᄒ)\x05(가)\x05(나)\x05(다)\x05(라)\x05(마)\x05(바)\x05(사)\x05(아)" + - "\x05(자)\x05(차)\x05(카)\x05(타)\x05(파)\x05(하)\x05(주)\x08(오전)\x08(오후)\x05(一)" + - "\x05(二)\x05(三)\x05(四)\x05(五)\x05(六)\x05(七)\x05(八)\x05(九)\x05(十)\x05(月)" + - "\x05(火)\x05(水)\x05(木)\x05(金)\x05(土)\x05(日)\x05(株)\x05(有)\x05(社)\x05(名)" + - "\x05(特)\x05(財)\x05(祝)\x05(労)\x05(代)\x05(呼)\x05(学)\x05(監)\x05(企)\x05(資)" + - "\x05(協)\x05(祭)\x05(休)\x05(自)\x05(至)\x0221\x0222\x0223\x0224\x0225\x0226" + - "\x0227\x0228\x0229\x0230\x0231\x0232\x0233\x0234\x0235\x06참고\x06주의\x0236" + - "\x0237\x0238\x0239\x0240\x0241\x0242\x0243\x0244\x0245\x0246\x0247\x0248" + - "\x0249\x0250\x041月\x042月\x043月\x044月\x045月\x046月\x047月\x048月\x049月\x0510" + - "月\x0511月\x0512月\x02hg\x02ev\x0cアパート\x0cアルファ\x0cアンペア\x09アール\x0cイニング\x09" + - "インチ\x09ウォン\x0fエスクード\x0cエーカー\x09オンス\x09オーム\x09カイリ\x0cカラット\x0cカロリー\x09ガロ" + - "ン\x09ガンマ\x06ギガ\x09ギニー\x0cキュリー\x0cギルダー\x06キロ\x0fキログラム\x12キロメートル\x0fキロワッ" + - "ト\x09グラム\x0fグラムトン\x0fクルゼイロ\x0cクローネ\x09ケース\x09コルナ\x09コーポ\x0cサイクル\x0fサンチ" + - "ーム\x0cシリング\x09センチ\x09セント\x09ダース\x06デシ\x06ドル\x06トン\x06ナノ\x09ノット\x09ハイツ" + - "\x0fパーセント\x09パーツ\x0cバーレル\x0fピアストル\x09ピクル\x06ピコ\x06ビル\x0fファラッド\x0cフィート" + - "\x0fブッシェル\x09フラン\x0fヘクタール\x06ペソ\x09ペニヒ\x09ヘルツ\x09ペンス\x09ページ\x09ベータ\x0cポイ" + - "ント\x09ボルト\x06ホン\x09ポンド\x09ホール\x09ホーン\x0cマイクロ\x09マイル\x09マッハ\x09マルク\x0fマ" + - "ンション\x0cミクロン\x06ミリ\x0fミリバール\x06メガ\x0cメガトン\x0cメートル\x09ヤード\x09ヤール\x09ユアン" + - "\x0cリットル\x06リラ\x09ルピー\x0cルーブル\x06レム\x0fレントゲン\x09ワット\x040点\x041点\x042点" + - "\x043点\x044点\x045点\x046点\x047点\x048点\x049点\x0510点\x0511点\x0512点\x0513点" + - "\x0514点\x0515点\x0516点\x0517点\x0518点\x0519点\x0520点\x0521点\x0522点\x0523点" + - "\x0524点\x02da\x02au\x02ov\x02pc\x02dm\x02iu\x06平成\x06昭和\x06大正\x06明治\x0c株" + - "式会社\x02pa\x02na\x02ma\x02ka\x02kb\x02mb\x02gb\x04kcal\x02pf\x02nf\x02m" + - "g\x02kg\x02hz\x02ml\x02dl\x02kl\x02fm\x02nm\x02mm\x02cm\x02km\x02m2\x02m" + - "3\x05m∕s\x06m∕s2\x07rad∕s\x08rad∕s2\x02ps\x02ns\x02ms\x02pv\x02nv\x02mv" + - "\x02kv\x02pw\x02nw\x02mw\x02kw\x02bq\x02cc\x02cd\x06c∕kg\x02db\x02gy\x02" + - "ha\x02hp\x02in\x02kk\x02kt\x02lm\x02ln\x02lx\x02ph\x02pr\x02sr\x02sv\x02" + - "wb\x05v∕m\x05a∕m\x041日\x042日\x043日\x044日\x045日\x046日\x047日\x048日\x049日" + - "\x0510日\x0511日\x0512日\x0513日\x0514日\x0515日\x0516日\x0517日\x0518日\x0519日" + - "\x0520日\x0521日\x0522日\x0523日\x0524日\x0525日\x0526日\x0527日\x0528日\x0529日" + - "\x0530日\x0531日\x02ь\x02ɦ\x02ɬ\x02ʞ\x02ʇ\x02œ\x04𤋮\x04𢡊\x04𢡄\x04𣏕\x04𥉉" + - "\x04𥳐\x04𧻓\x02ff\x02fi\x02fl\x02st\x04մն\x04մե\x04մի\x04վն\x04մխ\x04יִ" + - "\x04ײַ\x02ע\x02ה\x02כ\x02ל\x02ם\x02ר\x02ת\x04שׁ\x04שׂ\x06שּׁ\x06שּׂ\x04א" + - "ַ\x04אָ\x04אּ\x04בּ\x04גּ\x04דּ\x04הּ\x04וּ\x04זּ\x04טּ\x04יּ\x04ךּ\x04" + - "כּ\x04לּ\x04מּ\x04נּ\x04סּ\x04ףּ\x04פּ\x04צּ\x04קּ\x04רּ\x04שּ\x04תּ" + - "\x04וֹ\x04בֿ\x04כֿ\x04פֿ\x04אל\x02ٱ\x02ٻ\x02پ\x02ڀ\x02ٺ\x02ٿ\x02ٹ\x02ڤ" + - "\x02ڦ\x02ڄ\x02ڃ\x02چ\x02ڇ\x02ڍ\x02ڌ\x02ڎ\x02ڈ\x02ژ\x02ڑ\x02ک\x02گ\x02ڳ" + - "\x02ڱ\x02ں\x02ڻ\x02ۀ\x02ہ\x02ھ\x02ے\x02ۓ\x02ڭ\x02ۇ\x02ۆ\x02ۈ\x02ۋ\x02ۅ" + - "\x02ۉ\x02ې\x02ى\x04ئا\x04ئە\x04ئو\x04ئۇ\x04ئۆ\x04ئۈ\x04ئې\x04ئى\x02ی\x04" + - "ئج\x04ئح\x04ئم\x04ئي\x04بج\x04بح\x04بخ\x04بم\x04بى\x04بي\x04تج\x04تح" + - "\x04تخ\x04تم\x04تى\x04تي\x04ثج\x04ثم\x04ثى\x04ثي\x04جح\x04جم\x04حج\x04حم" + - "\x04خج\x04خح\x04خم\x04سج\x04سح\x04سخ\x04سم\x04صح\x04صم\x04ضج\x04ضح\x04ضخ" + - "\x04ضم\x04طح\x04طم\x04ظم\x04عج\x04عم\x04غج\x04غم\x04فج\x04فح\x04فخ\x04فم" + - "\x04فى\x04في\x04قح\x04قم\x04قى\x04قي\x04كا\x04كج\x04كح\x04كخ\x04كل\x04كم" + - "\x04كى\x04كي\x04لج\x04لح\x04لخ\x04لم\x04لى\x04لي\x04مج\x04مح\x04مخ\x04مم" + - "\x04مى\x04مي\x04نج\x04نح\x04نخ\x04نم\x04نى\x04ني\x04هج\x04هم\x04هى\x04هي" + - "\x04يج\x04يح\x04يخ\x04يم\x04يى\x04يي\x04ذٰ\x04رٰ\x04ىٰ\x05 ٌّ\x05 ٍّ\x05" + - " َّ\x05 ُّ\x05 ِّ\x05 ّٰ\x04ئر\x04ئز\x04ئن\x04بر\x04بز\x04بن\x04تر\x04تز" + - "\x04تن\x04ثر\x04ثز\x04ثن\x04ما\x04نر\x04نز\x04نن\x04ير\x04يز\x04ين\x04ئخ" + - "\x04ئه\x04به\x04ته\x04صخ\x04له\x04نه\x04هٰ\x04يه\x04ثه\x04سه\x04شم\x04شه" + - "\x06ـَّ\x06ـُّ\x06ـِّ\x04طى\x04طي\x04عى\x04عي\x04غى\x04غي\x04سى\x04سي" + - "\x04شى\x04شي\x04حى\x04حي\x04جى\x04جي\x04خى\x04خي\x04صى\x04صي\x04ضى\x04ضي" + - "\x04شج\x04شح\x04شخ\x04شر\x04سر\x04صر\x04ضر\x04اً\x06تجم\x06تحج\x06تحم" + - "\x06تخم\x06تمج\x06تمح\x06تمخ\x06جمح\x06حمي\x06حمى\x06سحج\x06سجح\x06سجى" + - "\x06سمح\x06سمج\x06سمم\x06صحح\x06صمم\x06شحم\x06شجي\x06شمخ\x06شمم\x06ضحى" + - "\x06ضخم\x06طمح\x06طمم\x06طمي\x06عجم\x06عمم\x06عمى\x06غمم\x06غمي\x06غمى" + - "\x06فخم\x06قمح\x06قمم\x06لحم\x06لحي\x06لحى\x06لجج\x06لخم\x06لمح\x06محج" + - "\x06محم\x06محي\x06مجح\x06مجم\x06مخج\x06مخم\x06مجخ\x06همج\x06همم\x06نحم" + - "\x06نحى\x06نجم\x06نجى\x06نمي\x06نمى\x06يمم\x06بخي\x06تجي\x06تجى\x06تخي" + - "\x06تخى\x06تمي\x06تمى\x06جمي\x06جحى\x06جمى\x06سخى\x06صحي\x06شحي\x06ضحي" + - "\x06لجي\x06لمي\x06يحي\x06يجي\x06يمي\x06ممي\x06قمي\x06نحي\x06عمي\x06كمي" + - "\x06نجح\x06مخي\x06لجم\x06كمم\x06جحي\x06حجي\x06مجي\x06فمي\x06بحي\x06سخي" + - "\x06نجي\x06صلے\x06قلے\x08الله\x08اكبر\x08محمد\x08صلعم\x08رسول\x08عليه" + - "\x08وسلم\x06صلى!صلى الله عليه وسلم\x0fجل جلاله\x08ریال\x01,\x01:\x01!" + - "\x01?\x01_\x01{\x01}\x01[\x01]\x01#\x01&\x01*\x01-\x01<\x01>\x01\\\x01$" + - "\x01%\x01@\x04ـً\x04ـَ\x04ـُ\x04ـِ\x04ـّ\x04ـْ\x02ء\x02آ\x02أ\x02ؤ\x02إ" + - "\x02ئ\x02ا\x02ب\x02ة\x02ت\x02ث\x02ج\x02ح\x02خ\x02د\x02ذ\x02ر\x02ز\x02س" + - "\x02ش\x02ص\x02ض\x02ط\x02ظ\x02ع\x02غ\x02ف\x02ق\x02ك\x02ل\x02م\x02ن\x02ه" + - "\x02و\x02ي\x04لآ\x04لأ\x04لإ\x04لا\x01\x22\x01'\x01/\x01^\x01|\x01~\x02¢" + - "\x02£\x02¬\x02¦\x02¥\x08𝅗𝅥\x08𝅘𝅥\x0c𝅘𝅥𝅮\x0c𝅘𝅥𝅯\x0c𝅘𝅥𝅰\x0c𝅘𝅥𝅱\x0c𝅘𝅥𝅲\x08𝆹" + - "𝅥\x08𝆺𝅥\x0c𝆹𝅥𝅮\x0c𝆺𝅥𝅮\x0c𝆹𝅥𝅯\x0c𝆺𝅥𝅯\x02ı\x02ȷ\x02α\x02ε\x02ζ\x02η\x02" + - "κ\x02λ\x02μ\x02ν\x02ξ\x02ο\x02σ\x02τ\x02υ\x02ψ\x03∇\x03∂\x02ϝ\x02ٮ\x02ڡ" + - "\x02ٯ\x020,\x021,\x022,\x023,\x024,\x025,\x026,\x027,\x028,\x029,\x03(a)" + - "\x03(b)\x03(c)\x03(d)\x03(e)\x03(f)\x03(g)\x03(h)\x03(i)\x03(j)\x03(k)" + - "\x03(l)\x03(m)\x03(n)\x03(o)\x03(p)\x03(q)\x03(r)\x03(s)\x03(t)\x03(u)" + - "\x03(v)\x03(w)\x03(x)\x03(y)\x03(z)\x07〔s〕\x02wz\x02hv\x02sd\x03ppv\x02w" + - "c\x02mc\x02md\x02dj\x06ほか\x06ココ\x03サ\x03手\x03字\x03双\x03デ\x03二\x03多\x03解" + - "\x03天\x03交\x03映\x03無\x03料\x03前\x03後\x03再\x03新\x03初\x03終\x03生\x03販\x03声" + - "\x03吹\x03演\x03投\x03捕\x03一\x03三\x03遊\x03左\x03中\x03右\x03指\x03走\x03打\x03禁" + - "\x03空\x03合\x03満\x03有\x03月\x03申\x03割\x03営\x03配\x09〔本〕\x09〔三〕\x09〔二〕\x09〔安" + - "〕\x09〔点〕\x09〔打〕\x09〔盗〕\x09〔勝〕\x09〔敗〕\x03得\x03可\x03丽\x03丸\x03乁\x03你\x03" + - "侮\x03侻\x03倂\x03偺\x03備\x03僧\x03像\x03㒞\x03免\x03兔\x03兤\x03具\x03㒹\x03內\x03" + - "冗\x03冤\x03仌\x03冬\x03况\x03凵\x03刃\x03㓟\x03刻\x03剆\x03剷\x03㔕\x03勇\x03勉\x03" + - "勤\x03勺\x03包\x03匆\x03北\x03卉\x03卑\x03博\x03即\x03卽\x03卿\x03灰\x03及\x03叟\x03" + - "叫\x03叱\x03吆\x03咞\x03吸\x03呈\x03周\x03咢\x03哶\x03唐\x03啓\x03啣\x03善\x03喙\x03" + - "喫\x03喳\x03嗂\x03圖\x03嘆\x03圗\x03噑\x03噴\x03切\x03壮\x03城\x03埴\x03堍\x03型\x03" + - "堲\x03報\x03墬\x03売\x03壷\x03夆\x03夢\x03奢\x03姬\x03娛\x03娧\x03姘\x03婦\x03㛮\x03" + - "嬈\x03嬾\x03寃\x03寘\x03寧\x03寳\x03寿\x03将\x03尢\x03㞁\x03屠\x03屮\x03峀\x03岍\x03" + - "嵃\x03嵮\x03嵫\x03嵼\x03巡\x03巢\x03㠯\x03巽\x03帨\x03帽\x03幩\x03㡢\x03㡼\x03庰\x03" + - "庳\x03庶\x03廊\x03廾\x03舁\x03弢\x03㣇\x03形\x03彫\x03㣣\x03徚\x03忍\x03志\x03忹\x03" + - "悁\x03㤺\x03㤜\x03悔\x03惇\x03慈\x03慌\x03慎\x03慺\x03憎\x03憲\x03憤\x03憯\x03懞\x03" + - "懲\x03懶\x03成\x03戛\x03扝\x03抱\x03拔\x03捐\x03挽\x03拼\x03捨\x03掃\x03揤\x03搢\x03" + - "揅\x03掩\x03㨮\x03摩\x03摾\x03撝\x03摷\x03㩬\x03敏\x03敬\x03旣\x03書\x03晉\x03㬙\x03" + - "暑\x03㬈\x03㫤\x03冒\x03冕\x03最\x03暜\x03肭\x03䏙\x03朗\x03望\x03朡\x03杞\x03杓\x03" + - "㭉\x03柺\x03枅\x03桒\x03梅\x03梎\x03栟\x03椔\x03㮝\x03楂\x03榣\x03槪\x03檨\x03櫛\x03" + - "㰘\x03次\x03歔\x03㱎\x03歲\x03殟\x03殺\x03殻\x03汎\x03沿\x03泍\x03汧\x03洖\x03派\x03" + - "海\x03流\x03浩\x03浸\x03涅\x03洴\x03港\x03湮\x03㴳\x03滋\x03滇\x03淹\x03潮\x03濆\x03" + - "瀹\x03瀞\x03瀛\x03㶖\x03灊\x03災\x03灷\x03炭\x03煅\x03熜\x03爨\x03爵\x03牐\x03犀\x03" + - "犕\x03獺\x03王\x03㺬\x03玥\x03㺸\x03瑇\x03瑜\x03瑱\x03璅\x03瓊\x03㼛\x03甤\x03甾\x03" + - "異\x03瘐\x03㿼\x03䀈\x03直\x03眞\x03真\x03睊\x03䀹\x03瞋\x03䁆\x03䂖\x03硎\x03碌\x03" + - "磌\x03䃣\x03祖\x03福\x03秫\x03䄯\x03穀\x03穊\x03穏\x03䈂\x03篆\x03築\x03䈧\x03糒\x03" + - "䊠\x03糨\x03糣\x03紀\x03絣\x03䌁\x03緇\x03縂\x03繅\x03䌴\x03䍙\x03罺\x03羕\x03翺\x03" + - "者\x03聠\x03聰\x03䏕\x03育\x03脃\x03䐋\x03脾\x03媵\x03舄\x03辞\x03䑫\x03芑\x03芋\x03" + - "芝\x03劳\x03花\x03芳\x03芽\x03苦\x03若\x03茝\x03荣\x03莭\x03茣\x03莽\x03菧\x03著\x03" + - "荓\x03菊\x03菌\x03菜\x03䔫\x03蓱\x03蓳\x03蔖\x03蕤\x03䕝\x03䕡\x03䕫\x03虐\x03虜\x03" + - "虧\x03虩\x03蚩\x03蚈\x03蜎\x03蛢\x03蝹\x03蜨\x03蝫\x03螆\x03蟡\x03蠁\x03䗹\x03衠\x03" + - "衣\x03裗\x03裞\x03䘵\x03裺\x03㒻\x03䚾\x03䛇\x03誠\x03諭\x03變\x03豕\x03貫\x03賁\x03" + - "贛\x03起\x03跋\x03趼\x03跰\x03軔\x03輸\x03邔\x03郱\x03鄑\x03鄛\x03鈸\x03鋗\x03鋘\x03" + - "鉼\x03鏹\x03鐕\x03開\x03䦕\x03閷\x03䧦\x03雃\x03嶲\x03霣\x03䩮\x03䩶\x03韠\x03䪲\x03" + - "頋\x03頩\x03飢\x03䬳\x03餩\x03馧\x03駂\x03駾\x03䯎\x03鬒\x03鱀\x03鳽\x03䳎\x03䳭\x03" + - "鵧\x03䳸\x03麻\x03䵖\x03黹\x03黾\x03鼅\x03鼏\x03鼖\x03鼻" - -var xorData string = "" + // Size: 4855 bytes - "\x02\x0c\x09\x02\xb0\xec\x02\xad\xd8\x02\xad\xd9\x02\x06\x07\x02\x0f\x12" + - "\x02\x0f\x1f\x02\x0f\x1d\x02\x01\x13\x02\x0f\x16\x02\x0f\x0b\x02\x0f3" + - "\x02\x0f7\x02\x0f?\x02\x0f/\x02\x0f*\x02\x0c&\x02\x0c*\x02\x0c;\x02\x0c9" + - "\x02\x0c%\x02\xab\xed\x02\xab\xe2\x02\xab\xe3\x02\xa9\xe0\x02\xa9\xe1" + - "\x02\xa9\xe6\x02\xa3\xcb\x02\xa3\xc8\x02\xa3\xc9\x02\x01#\x02\x01\x08" + - "\x02\x0e>\x02\x0e'\x02\x0f\x03\x02\x03\x0d\x02\x03\x09\x02\x03\x17\x02" + - "\x03\x0e\x02\x02\x03\x02\x011\x02\x01\x00\x02\x01\x10\x02\x03<\x02\x07" + - "\x0d\x02\x02\x0c\x02\x0c0\x02\x01\x03\x02\x01\x01\x02\x01 \x02\x01\x22" + - "\x02\x01)\x02\x01\x0a\x02\x01\x0c\x02\x02\x06\x02\x02\x02\x02\x03\x10" + - "\x03\x037 \x03\x0b+\x03\x02\x01\x04\x02\x01\x02\x02\x019\x02\x03\x1c\x02" + - "\x02$\x03\x80p$\x02\x03:\x02\x03\x0a\x03\xc1r.\x03\xc1r,\x03\xc1r\x02" + - "\x02\x02:\x02\x02>\x02\x02,\x02\x02\x10\x02\x02\x00\x03\xc1s<\x03\xc1s*" + - "\x03\xc2L$\x03\xc2L;\x02\x09)\x02\x0a\x19\x03\x83\xab\xe3\x03\x83\xab" + - "\xf2\x03 4\xe0\x03\x81\xab\xea\x03\x81\xab\xf3\x03 4\xef\x03\x96\xe1\xcd" + - "\x03\x84\xe5\xc3\x02\x0d\x11\x03\x8b\xec\xcb\x03\x94\xec\xcf\x03\x9a\xec" + - "\xc2\x03\x8b\xec\xdb\x03\x94\xec\xdf\x03\x9a\xec\xd2\x03\x01\x0c!\x03" + - "\x01\x0c#\x03ʠ\x9d\x03ʣ\x9c\x03ʢ\x9f\x03ʥ\x9e\x03ʤ\x91\x03ʧ\x90\x03ʦ\x93" + - "\x03ʩ\x92\x03ʨ\x95\x03\xca\xf3\xb5\x03\xca\xf0\xb4\x03\xca\xf1\xb7\x03" + - "\xca\xf6\xb6\x03\xca\xf7\x89\x03\xca\xf4\x88\x03\xca\xf5\x8b\x03\xca\xfa" + - "\x8a\x03\xca\xfb\x8d\x03\xca\xf8\x8c\x03\xca\xf9\x8f\x03\xca\xfe\x8e\x03" + - "\xca\xff\x81\x03\xca\xfc\x80\x03\xca\xfd\x83\x03\xca\xe2\x82\x03\xca\xe3" + - "\x85\x03\xca\xe0\x84\x03\xca\xe1\x87\x03\xca\xe6\x86\x03\xca\xe7\x99\x03" + - "\xca\xe4\x98\x03\xca\xe5\x9b\x03\xca\xea\x9a\x03\xca\xeb\x9d\x03\xca\xe8" + - "\x9c\x03ؓ\x89\x03ߔ\x8b\x02\x010\x03\x03\x04\x1e\x03\x04\x15\x12\x03\x0b" + - "\x05,\x03\x06\x04\x00\x03\x06\x04)\x03\x06\x044\x03\x06\x04<\x03\x06\x05" + - "\x1d\x03\x06\x06\x00\x03\x06\x06\x0a\x03\x06\x06'\x03\x06\x062\x03\x0786" + - "\x03\x079/\x03\x079 \x03\x07:\x0e\x03\x07:\x1b\x03\x07:%\x03\x07;/\x03" + - "\x07;%\x03\x074\x11\x03\x076\x09\x03\x077*\x03\x070\x01\x03\x070\x0f\x03" + - "\x070.\x03\x071\x16\x03\x071\x04\x03\x0710\x03\x072\x18\x03\x072-\x03" + - "\x073\x14\x03\x073>\x03\x07'\x09\x03\x07 \x00\x03\x07\x1f\x0b\x03\x07" + - "\x18#\x03\x07\x18(\x03\x07\x186\x03\x07\x18\x03\x03\x07\x19\x16\x03\x07" + - "\x116\x03\x07\x12'\x03\x07\x13\x10\x03\x07\x0c&\x03\x07\x0c\x08\x03\x07" + - "\x0c\x13\x03\x07\x0d\x02\x03\x07\x0d\x1c\x03\x07\x0b5\x03\x07\x0b\x0a" + - "\x03\x07\x0b\x01\x03\x07\x0b\x0f\x03\x07\x05\x00\x03\x07\x05\x09\x03\x07" + - "\x05\x0b\x03\x07\x07\x01\x03\x07\x07\x08\x03\x07\x00<\x03\x07\x00+\x03" + - "\x07\x01)\x03\x07\x01\x1b\x03\x07\x01\x08\x03\x07\x03?\x03\x0445\x03\x04" + - "4\x08\x03\x0454\x03\x04)/\x03\x04)5\x03\x04+\x05\x03\x04+\x14\x03\x04+ " + - "\x03\x04+<\x03\x04*&\x03\x04*\x22\x03\x04&8\x03\x04!\x01\x03\x04!\x22" + - "\x03\x04\x11+\x03\x04\x10.\x03\x04\x104\x03\x04\x13=\x03\x04\x12\x04\x03" + - "\x04\x12\x0a\x03\x04\x0d\x1d\x03\x04\x0d\x07\x03\x04\x0d \x03\x05<>\x03" + - "\x055<\x03\x055!\x03\x055#\x03\x055&\x03\x054\x1d\x03\x054\x02\x03\x054" + - "\x07\x03\x0571\x03\x053\x1a\x03\x053\x16\x03\x05.<\x03\x05.\x07\x03\x05)" + - ":\x03\x05)<\x03\x05)\x0c\x03\x05)\x15\x03\x05+-\x03\x05+5\x03\x05$\x1e" + - "\x03\x05$\x14\x03\x05'\x04\x03\x05'\x14\x03\x05&\x02\x03\x05\x226\x03" + - "\x05\x22\x0c\x03\x05\x22\x1c\x03\x05\x19\x0a\x03\x05\x1b\x09\x03\x05\x1b" + - "\x0c\x03\x05\x14\x07\x03\x05\x16?\x03\x05\x16\x0c\x03\x05\x0c\x05\x03" + - "\x05\x0e\x0f\x03\x05\x01\x0e\x03\x05\x00(\x03\x05\x030\x03\x05\x03\x06" + - "\x03\x0a==\x03\x0a=1\x03\x0a=,\x03\x0a=\x0c\x03\x0a??\x03\x0a<\x08\x03" + - "\x0a9!\x03\x0a9)\x03\x0a97\x03\x0a99\x03\x0a6\x0a\x03\x0a6\x1c\x03\x0a6" + - "\x17\x03\x0a7'\x03\x0a78\x03\x0a73\x03\x0a'\x01\x03\x0a'&\x03\x0a\x1f" + - "\x0e\x03\x0a\x1f\x03\x03\x0a\x1f3\x03\x0a\x1b/\x03\x0a\x18\x19\x03\x0a" + - "\x19\x01\x03\x0a\x16\x14\x03\x0a\x0e\x22\x03\x0a\x0f\x10\x03\x0a\x0f\x02" + - "\x03\x0a\x0f \x03\x0a\x0c\x04\x03\x0a\x0b>\x03\x0a\x0b+\x03\x0a\x08/\x03" + - "\x0a\x046\x03\x0a\x05\x14\x03\x0a\x00\x04\x03\x0a\x00\x10\x03\x0a\x00" + - "\x14\x03\x0b<3\x03\x0b;*\x03\x0b9\x22\x03\x0b9)\x03\x0b97\x03\x0b+\x10" + - "\x03\x0b((\x03\x0b&5\x03\x0b$\x1c\x03\x0b$\x12\x03\x0b%\x04\x03\x0b#<" + - "\x03\x0b#0\x03\x0b#\x0d\x03\x0b#\x19\x03\x0b!:\x03\x0b!\x1f\x03\x0b!\x00" + - "\x03\x0b\x1e5\x03\x0b\x1c\x1d\x03\x0b\x1d-\x03\x0b\x1d(\x03\x0b\x18.\x03" + - "\x0b\x18 \x03\x0b\x18\x16\x03\x0b\x14\x13\x03\x0b\x15$\x03\x0b\x15\x22" + - "\x03\x0b\x12\x1b\x03\x0b\x12\x10\x03\x0b\x132\x03\x0b\x13=\x03\x0b\x12" + - "\x18\x03\x0b\x0c&\x03\x0b\x061\x03\x0b\x06:\x03\x0b\x05#\x03\x0b\x05<" + - "\x03\x0b\x04\x0b\x03\x0b\x04\x04\x03\x0b\x04\x1b\x03\x0b\x042\x03\x0b" + - "\x041\x03\x0b\x03\x03\x03\x0b\x03\x1d\x03\x0b\x03/\x03\x0b\x03+\x03\x0b" + - "\x02\x1b\x03\x0b\x02\x00\x03\x0b\x01\x1e\x03\x0b\x01\x08\x03\x0b\x015" + - "\x03\x06\x0d9\x03\x06\x0d=\x03\x06\x0d?\x03\x02\x001\x03\x02\x003\x03" + - "\x02\x02\x19\x03\x02\x006\x03\x02\x02\x1b\x03\x02\x004\x03\x02\x00<\x03" + - "\x02\x02\x0a\x03\x02\x02\x0e\x03\x02\x01\x1a\x03\x02\x01\x07\x03\x02\x01" + - "\x05\x03\x02\x01\x0b\x03\x02\x01%\x03\x02\x01\x0c\x03\x02\x01\x04\x03" + - "\x02\x01\x1c\x03\x02\x00.\x03\x02\x002\x03\x02\x00>\x03\x02\x00\x12\x03" + - "\x02\x00\x16\x03\x02\x011\x03\x02\x013\x03\x02\x02 \x03\x02\x02%\x03\x02" + - "\x02$\x03\x02\x028\x03\x02\x02;\x03\x02\x024\x03\x02\x012\x03\x02\x022" + - "\x03\x02\x02/\x03\x02\x01,\x03\x02\x01\x13\x03\x02\x01\x16\x03\x02\x01" + - "\x11\x03\x02\x01\x1e\x03\x02\x01\x15\x03\x02\x01\x17\x03\x02\x01\x0f\x03" + - "\x02\x01\x08\x03\x02\x00?\x03\x02\x03\x07\x03\x02\x03\x0d\x03\x02\x03" + - "\x13\x03\x02\x03\x1d\x03\x02\x03\x1f\x03\x02\x00\x03\x03\x02\x00\x0d\x03" + - "\x02\x00\x01\x03\x02\x00\x1b\x03\x02\x00\x19\x03\x02\x00\x18\x03\x02\x00" + - "\x13\x03\x02\x00/\x03\x07>\x12\x03\x07<\x1f\x03\x07>\x1d\x03\x06\x1d\x0e" + - "\x03\x07>\x1c\x03\x07>:\x03\x07>\x13\x03\x04\x12+\x03\x07?\x03\x03\x07>" + - "\x02\x03\x06\x224\x03\x06\x1a.\x03\x07<%\x03\x06\x1c\x0b\x03\x0609\x03" + - "\x05\x1f\x01\x03\x04'\x08\x03\x93\xfd\xf5\x03\x02\x0d \x03\x02\x0d#\x03" + - "\x02\x0d!\x03\x02\x0d&\x03\x02\x0d\x22\x03\x02\x0d/\x03\x02\x0d,\x03\x02" + - "\x0d$\x03\x02\x0d'\x03\x02\x0d%\x03\x02\x0d;\x03\x02\x0d=\x03\x02\x0d?" + - "\x03\x099.\x03\x08\x0b7\x03\x08\x02\x14\x03\x08\x14\x0d\x03\x08.:\x03" + - "\x089'\x03\x0f\x0b\x18\x03\x0f\x1c1\x03\x0f\x17&\x03\x0f9\x1f\x03\x0f0" + - "\x0c\x03\x0e\x0a9\x03\x0e\x056\x03\x0e\x1c#\x03\x0f\x13\x0e\x03\x072\x00" + - "\x03\x070\x0d\x03\x072\x0b\x03\x06\x11\x18\x03\x070\x10\x03\x06\x0f(\x03" + - "\x072\x05\x03\x06\x0f,\x03\x073\x15\x03\x06\x07\x08\x03\x05\x16\x02\x03" + - "\x04\x0b \x03\x05:8\x03\x05\x16%\x03\x0a\x0d\x1f\x03\x06\x16\x10\x03\x05" + - "\x1d5\x03\x05*;\x03\x05\x16\x1b\x03\x04.-\x03\x06\x1a\x19\x03\x04\x03," + - "\x03\x0b87\x03\x04/\x0a\x03\x06\x00,\x03\x04-\x01\x03\x04\x1e-\x03\x06/(" + - "\x03\x0a\x0b5\x03\x06\x0e7\x03\x06\x07.\x03\x0597\x03\x0a*%\x03\x0760" + - "\x03\x06\x0c;\x03\x05'\x00\x03\x072.\x03\x072\x08\x03\x06=\x01\x03\x06" + - "\x05\x1b\x03\x06\x06\x12\x03\x06$=\x03\x06'\x0d\x03\x04\x11\x0f\x03\x076" + - ",\x03\x06\x07;\x03\x06.,\x03\x86\xf9\xea\x03\x8f\xff\xeb\x02\x092\x02" + - "\x095\x02\x094\x02\x09;\x02\x09>\x02\x098\x02\x09*\x02\x09/\x02\x09,\x02" + - "\x09%\x02\x09&\x02\x09#\x02\x09 \x02\x08!\x02\x08%\x02\x08$\x02\x08+\x02" + - "\x08.\x02\x08*\x02\x08&\x02\x088\x02\x08>\x02\x084\x02\x086\x02\x080\x02" + - "\x08\x10\x02\x08\x17\x02\x08\x12\x02\x08\x1d\x02\x08\x1f\x02\x08\x13\x02" + - "\x08\x15\x02\x08\x14\x02\x08\x0c\x03\x8b\xfd\xd0\x03\x81\xec\xc6\x03\x87" + - "\xe0\x8a\x03-2\xe3\x03\x80\xef\xe4\x03-2\xea\x03\x88\xe6\xeb\x03\x8e\xe6" + - "\xe8\x03\x84\xe6\xe9\x03\x97\xe6\xee\x03-2\xf9\x03-2\xf6\x03\x8e\xe3\xad" + - "\x03\x80\xe3\x92\x03\x88\xe3\x90\x03\x8e\xe3\x90\x03\x80\xe3\x97\x03\x88" + - "\xe3\x95\x03\x88\xfe\xcb\x03\x8e\xfe\xca\x03\x84\xfe\xcd\x03\x91\xef\xc9" + - "\x03-2\xc1\x03-2\xc0\x03-2\xcb\x03\x88@\x09\x03\x8e@\x08\x03\x8f\xe0\xf5" + - "\x03\x8e\xe6\xf9\x03\x8e\xe0\xfa\x03\x93\xff\xf4\x03\x84\xee\xd3\x03\x0b" + - "(\x04\x023 \x021;\x02\x01*\x03\x0b#\x10\x03\x0b 0\x03\x0b!\x10\x03\x0b!0" + - "\x03\x07\x15\x08\x03\x09?5\x03\x07\x1f\x08\x03\x07\x17\x0b\x03\x09\x1f" + - "\x15\x03\x0b\x1c7\x03\x0a+#\x03\x06\x1a\x1b\x03\x06\x1a\x14\x03\x0a\x01" + - "\x18\x03\x06#\x1b\x03\x0a2\x0c\x03\x0a\x01\x04\x03\x09#;\x03\x08='\x03" + - "\x08\x1a\x0a\x03\x07</\x03\x07:+\x03\x07\x07*\x03\x06&\x1c\x03\x09\x0c" + - "\x16\x03\x09\x10\x0e\x03\x08'\x0f\x03\x08+\x09\x03\x074%\x03\x06!3\x03" + - "\x06\x03+\x03\x0b\x1e\x19\x03\x0a))\x03\x09\x08\x19\x03\x08,\x05\x03\x07" + - "<2\x03\x06\x1c>\x03\x0a\x111\x03\x09\x1b\x09\x03\x073.\x03\x07\x01\x00" + - "\x03\x09/,\x03\x07#>\x03\x07\x048\x03\x0a\x1f\x22\x03\x098>\x03\x09\x11" + - "\x00\x03\x08/\x17\x03\x06'\x22\x03\x0b\x1a+\x03\x0a\x22\x19\x03\x0a/1" + - "\x03\x0974\x03\x09\x0f\x22\x03\x08,\x22\x03\x08?\x14\x03\x07$5\x03\x07<3" + - "\x03\x07=*\x03\x07\x13\x18\x03\x068\x0a\x03\x06\x09\x16\x03\x06\x13\x00" + - "\x03\x08\x067\x03\x08\x01\x03\x03\x08\x12\x1d\x03\x07+7\x03\x06(;\x03" + - "\x06\x1c?\x03\x07\x0e\x17\x03\x0a\x06\x1d\x03\x0a\x19\x07\x03\x08\x14$" + - "\x03\x07$;\x03\x08,$\x03\x08\x06\x0d\x03\x07\x16\x0a\x03\x06>>\x03\x0a" + - "\x06\x12\x03\x0a\x14)\x03\x09\x0d\x1f\x03\x09\x12\x17\x03\x09\x19\x01" + - "\x03\x08\x11 \x03\x08\x1d'\x03\x06<\x1a\x03\x0a.\x00\x03\x07'\x18\x03" + - "\x0a\x22\x08\x03\x08\x0d\x0a\x03\x08\x13)\x03\x07*)\x03\x06<,\x03\x07" + - "\x0b\x1a\x03\x09.\x14\x03\x09\x0d\x1e\x03\x07\x0e#\x03\x0b\x1d'\x03\x0a" + - "\x0a8\x03\x09%2\x03\x08+&\x03\x080\x12\x03\x0a)4\x03\x08\x06\x1f\x03\x0b" + - "\x1b\x1a\x03\x0a\x1b\x0f\x03\x0b\x1d*\x03\x09\x16$\x03\x090\x11\x03\x08" + - "\x11\x08\x03\x0a*(\x03\x0a\x042\x03\x089,\x03\x074'\x03\x07\x0f\x05\x03" + - "\x09\x0b\x0a\x03\x07\x1b\x01\x03\x09\x17:\x03\x09.\x0d\x03\x07.\x11\x03" + - "\x09+\x15\x03\x080\x13\x03\x0b\x1f\x19\x03\x0a \x11\x03\x0a\x220\x03\x09" + - "\x07;\x03\x08\x16\x1c\x03\x07,\x13\x03\x07\x0e/\x03\x06\x221\x03\x0a." + - "\x0a\x03\x0a7\x02\x03\x0a\x032\x03\x0a\x1d.\x03\x091\x06\x03\x09\x19:" + - "\x03\x08\x02/\x03\x060+\x03\x06\x0f-\x03\x06\x1c\x1f\x03\x06\x1d\x07\x03" + - "\x0a,\x11\x03\x09=\x0d\x03\x09\x0b;\x03\x07\x1b/\x03\x0a\x1f:\x03\x09 " + - "\x1f\x03\x09.\x10\x03\x094\x0b\x03\x09\x1a1\x03\x08#\x1a\x03\x084\x1d" + - "\x03\x08\x01\x1f\x03\x08\x11\x22\x03\x07'8\x03\x07\x1a>\x03\x0757\x03" + - "\x06&9\x03\x06+\x11\x03\x0a.\x0b\x03\x0a,>\x03\x0a4#\x03\x08%\x17\x03" + - "\x07\x05\x22\x03\x07\x0c\x0b\x03\x0a\x1d+\x03\x0a\x19\x16\x03\x09+\x1f" + - "\x03\x09\x08\x0b\x03\x08\x16\x18\x03\x08+\x12\x03\x0b\x1d\x0c\x03\x0a=" + - "\x10\x03\x0a\x09\x0d\x03\x0a\x10\x11\x03\x09&0\x03\x08(\x1f\x03\x087\x07" + - "\x03\x08\x185\x03\x07'6\x03\x06.\x05\x03\x06=\x04\x03\x06;;\x03\x06\x06," + - "\x03\x0b\x18>\x03\x08\x00\x18\x03\x06 \x03\x03\x06<\x00\x03\x09%\x18\x03" + - "\x0b\x1c<\x03\x0a%!\x03\x0a\x09\x12\x03\x0a\x16\x02\x03\x090'\x03\x09" + - "\x0e=\x03\x08 \x0e\x03\x08>\x03\x03\x074>\x03\x06&?\x03\x06\x19\x09\x03" + - "\x06?(\x03\x0a-\x0e\x03\x09:3\x03\x098:\x03\x09\x12\x0b\x03\x09\x1d\x17" + - "\x03\x087\x05\x03\x082\x14\x03\x08\x06%\x03\x08\x13\x1f\x03\x06\x06\x0e" + - "\x03\x0a\x22<\x03\x09/<\x03\x06>+\x03\x0a'?\x03\x0a\x13\x0c\x03\x09\x10<" + - "\x03\x07\x1b=\x03\x0a\x19\x13\x03\x09\x22\x1d\x03\x09\x07\x0d\x03\x08)" + - "\x1c\x03\x06=\x1a\x03\x0a/4\x03\x0a7\x11\x03\x0a\x16:\x03\x09?3\x03\x09:" + - "/\x03\x09\x05\x0a\x03\x09\x14\x06\x03\x087\x22\x03\x080\x07\x03\x08\x1a" + - "\x1f\x03\x07\x04(\x03\x07\x04\x09\x03\x06 %\x03\x06<\x08\x03\x0a+\x14" + - "\x03\x09\x1d\x16\x03\x0a70\x03\x08 >\x03\x0857\x03\x070\x0a\x03\x06=\x12" + - "\x03\x06\x16%\x03\x06\x1d,\x03\x099#\x03\x09\x10>\x03\x07 \x1e\x03\x08" + - "\x0c<\x03\x08\x0b\x18\x03\x08\x15+\x03\x08,:\x03\x08%\x22\x03\x07\x0a$" + - "\x03\x0b\x1c=\x03\x07+\x08\x03\x0a/\x05\x03\x0a \x07\x03\x0a\x12'\x03" + - "\x09#\x11\x03\x08\x1b\x15\x03\x0a\x06\x01\x03\x09\x1c\x1b\x03\x0922\x03" + - "\x07\x14<\x03\x07\x09\x04\x03\x061\x04\x03\x07\x0e\x01\x03\x0a\x13\x18" + - "\x03\x0a-\x0c\x03\x0a?\x0d\x03\x0a\x09\x0a\x03\x091&\x03\x0a/\x0b\x03" + - "\x08$<\x03\x083\x1d\x03\x08\x0c$\x03\x08\x0d\x07\x03\x08\x0d?\x03\x08" + - "\x0e\x14\x03\x065\x0a\x03\x08\x1a#\x03\x08\x16#\x03\x0702\x03\x07\x03" + - "\x1a\x03\x06(\x1d\x03\x06+\x1b\x03\x06\x0b\x05\x03\x06\x0b\x17\x03\x06" + - "\x0c\x04\x03\x06\x1e\x19\x03\x06+0\x03\x062\x18\x03\x0b\x16\x1e\x03\x0a+" + - "\x16\x03\x0a-?\x03\x0a#:\x03\x0a#\x10\x03\x0a%$\x03\x0a>+\x03\x0a01\x03" + - "\x0a1\x10\x03\x0a\x099\x03\x0a\x0a\x12\x03\x0a\x19\x1f\x03\x0a\x19\x12" + - "\x03\x09*)\x03\x09-\x16\x03\x09.1\x03\x09.2\x03\x09<\x0e\x03\x09> \x03" + - "\x093\x12\x03\x09\x0b\x01\x03\x09\x1c2\x03\x09\x11\x1c\x03\x09\x15%\x03" + - "\x08,&\x03\x08!\x22\x03\x089(\x03\x08\x0b\x1a\x03\x08\x0d2\x03\x08\x0c" + - "\x04\x03\x08\x0c\x06\x03\x08\x0c\x1f\x03\x08\x0c\x0c\x03\x08\x0f\x1f\x03" + - "\x08\x0f\x1d\x03\x08\x00\x14\x03\x08\x03\x14\x03\x08\x06\x16\x03\x08\x1e" + - "#\x03\x08\x11\x11\x03\x08\x10\x18\x03\x08\x14(\x03\x07)\x1e\x03\x07.1" + - "\x03\x07 $\x03\x07 '\x03\x078\x08\x03\x07\x0d0\x03\x07\x0f7\x03\x07\x05#" + - "\x03\x07\x05\x1a\x03\x07\x1a7\x03\x07\x1d-\x03\x07\x17\x10\x03\x06)\x1f" + - "\x03\x062\x0b\x03\x066\x16\x03\x06\x09\x11\x03\x09(\x1e\x03\x07!5\x03" + - "\x0b\x11\x16\x03\x0a/\x04\x03\x0a,\x1a\x03\x0b\x173\x03\x0a,1\x03\x0a/5" + - "\x03\x0a\x221\x03\x0a\x22\x0d\x03\x0a?%\x03\x0a<,\x03\x0a?#\x03\x0a>\x19" + - "\x03\x0a\x08&\x03\x0a\x0b\x0e\x03\x0a\x0c:\x03\x0a\x0c+\x03\x0a\x03\x22" + - "\x03\x0a\x06)\x03\x0a\x11\x10\x03\x0a\x11\x1a\x03\x0a\x17-\x03\x0a\x14(" + - "\x03\x09)\x1e\x03\x09/\x09\x03\x09.\x00\x03\x09,\x07\x03\x09/*\x03\x09-9" + - "\x03\x09\x228\x03\x09%\x09\x03\x09:\x12\x03\x09;\x1d\x03\x09?\x06\x03" + - "\x093%\x03\x096\x05\x03\x096\x08\x03\x097\x02\x03\x09\x07,\x03\x09\x04," + - "\x03\x09\x1f\x16\x03\x09\x11\x03\x03\x09\x11\x12\x03\x09\x168\x03\x08*" + - "\x05\x03\x08/2\x03\x084:\x03\x08\x22+\x03\x08 0\x03\x08&\x0a\x03\x08;" + - "\x10\x03\x08>$\x03\x08>\x18\x03\x0829\x03\x082:\x03\x081,\x03\x081<\x03" + - "\x081\x1c\x03\x087#\x03\x087*\x03\x08\x09'\x03\x08\x00\x1d\x03\x08\x05-" + - "\x03\x08\x1f4\x03\x08\x1d\x04\x03\x08\x16\x0f\x03\x07*7\x03\x07'!\x03" + - "\x07%\x1b\x03\x077\x0c\x03\x07\x0c1\x03\x07\x0c.\x03\x07\x00\x06\x03\x07" + - "\x01\x02\x03\x07\x010\x03\x07\x06=\x03\x07\x01\x03\x03\x07\x01\x13\x03" + - "\x07\x06\x06\x03\x07\x05\x0a\x03\x07\x1f\x09\x03\x07\x17:\x03\x06*1\x03" + - "\x06-\x1d\x03\x06\x223\x03\x062:\x03\x060$\x03\x066\x1e\x03\x064\x12\x03" + - "\x0645\x03\x06\x0b\x00\x03\x06\x0b7\x03\x06\x07\x1f\x03\x06\x15\x12\x03" + - "\x0c\x05\x0f\x03\x0b+\x0b\x03\x0b+-\x03\x06\x16\x1b\x03\x06\x15\x17\x03" + - "\x89\xca\xea\x03\x89\xca\xe8\x03\x0c8\x10\x03\x0c8\x01\x03\x0c8\x0f\x03" + - "\x0d8%\x03\x0d8!\x03\x0c8-\x03\x0c8/\x03\x0c8+\x03\x0c87\x03\x0c85\x03" + - "\x0c9\x09\x03\x0c9\x0d\x03\x0c9\x0f\x03\x0c9\x0b\x03\xcfu\x0c\x03\xcfu" + - "\x0f\x03\xcfu\x0e\x03\xcfu\x09\x03\x0c9\x10\x03\x0d9\x0c\x03\xcf`;\x03" + - "\xcf`>\x03\xcf`9\x03\xcf`8\x03\xcf`7\x03\xcf`*\x03\xcf`-\x03\xcf`,\x03" + - "\x0d\x1b\x1a\x03\x0d\x1b&\x03\x0c=.\x03\x0c=%\x03\x0c>\x1e\x03\x0c>\x14" + - "\x03\x0c?\x06\x03\x0c?\x0b\x03\x0c?\x0c\x03\x0c?\x0d\x03\x0c?\x02\x03" + - "\x0c>\x0f\x03\x0c>\x08\x03\x0c>\x09\x03\x0c>,\x03\x0c>\x0c\x03\x0c?\x13" + - "\x03\x0c?\x16\x03\x0c?\x15\x03\x0c?\x1c\x03\x0c?\x1f\x03\x0c?\x1d\x03" + - "\x0c?\x1a\x03\x0c?\x17\x03\x0c?\x08\x03\x0c?\x09\x03\x0c?\x0e\x03\x0c?" + - "\x04\x03\x0c?\x05\x03\x0c<?\x03\x0c=\x00\x03\x0c=\x06\x03\x0c=\x05\x03" + - "\x0c=\x0c\x03\x0c=\x0f\x03\x0c=\x0d\x03\x0c=\x0b\x03\x0c=\x07\x03\x0c=" + - "\x19\x03\x0c=\x15\x03\x0c=\x11\x03\x0c=1\x03\x0c=3\x03\x0c=0\x03\x0c=>" + - "\x03\x0c=2\x03\x0c=6\x03\x0c<\x07\x03\x0c<\x05\x03\x0e:!\x03\x0e:#\x03" + - "\x0e8\x09\x03\x0e:&\x03\x0e8\x0b\x03\x0e:$\x03\x0e:,\x03\x0e8\x1a\x03" + - "\x0e8\x1e\x03\x0e:*\x03\x0e:7\x03\x0e:5\x03\x0e:;\x03\x0e:\x15\x03\x0e:<" + - "\x03\x0e:4\x03\x0e:'\x03\x0e:-\x03\x0e:%\x03\x0e:?\x03\x0e:=\x03\x0e:)" + - "\x03\x0e:/\x03\xcfs'\x03\x0d=\x0f\x03\x0d+*\x03\x0d99\x03\x0d9;\x03\x0d9" + - "?\x03\x0d)\x0d\x03\x0d(%\x02\x01\x18\x02\x01(\x02\x01\x1e\x03\x0f$!\x03" + - "\x0f87\x03\x0f4\x0e\x03\x0f5\x1d\x03\x06'\x03\x03\x0f\x08\x18\x03\x0f" + - "\x0d\x1b\x03\x0e2=\x03\x0e;\x08\x03\x0e:\x0b\x03\x0e\x06$\x03\x0e\x0d)" + - "\x03\x0e\x16\x1f\x03\x0e\x16\x1b\x03\x0d$\x0a\x03\x05,\x1d\x03\x0d. \x03" + - "\x0d.#\x03\x0c(/\x03\x09%\x02\x03\x0d90\x03\x0d\x0e4\x03\x0d\x0d\x0f\x03" + - "\x0c#\x00\x03\x0c,\x1e\x03\x0c2\x0e\x03\x0c\x01\x17\x03\x0c\x09:\x03\x0e" + - "\x173\x03\x0c\x08\x03\x03\x0c\x11\x07\x03\x0c\x10\x18\x03\x0c\x1f\x1c" + - "\x03\x0c\x19\x0e\x03\x0c\x1a\x1f\x03\x0f0>\x03\x0b->\x03\x0b<+\x03\x0b8" + - "\x13\x03\x0b\x043\x03\x0b\x14\x03\x03\x0b\x16%\x03\x0d\x22&\x03\x0b\x1a" + - "\x1a\x03\x0b\x1a\x04\x03\x0a%9\x03\x0a&2\x03\x0a&0\x03\x0a!\x1a\x03\x0a!" + - "7\x03\x0a5\x10\x03\x0a=4\x03\x0a?\x0e\x03\x0a>\x10\x03\x0a\x00 \x03\x0a" + - "\x0f:\x03\x0a\x0f9\x03\x0a\x0b\x0a\x03\x0a\x17%\x03\x0a\x1b-\x03\x09-" + - "\x1a\x03\x09,4\x03\x09.,\x03\x09)\x09\x03\x096!\x03\x091\x1f\x03\x093" + - "\x16\x03\x0c+\x1f\x03\x098 \x03\x098=\x03\x0c(\x1a\x03\x0c(\x16\x03\x09" + - "\x0a+\x03\x09\x16\x12\x03\x09\x13\x0e\x03\x09\x153\x03\x08)!\x03\x09\x1a" + - "\x01\x03\x09\x18\x01\x03\x08%#\x03\x08>\x22\x03\x08\x05%\x03\x08\x02*" + - "\x03\x08\x15;\x03\x08\x1b7\x03\x0f\x07\x1d\x03\x0f\x04\x03\x03\x070\x0c" + - "\x03\x07;\x0b\x03\x07\x08\x17\x03\x07\x12\x06\x03\x06/-\x03\x0671\x03" + - "\x065+\x03\x06>7\x03\x06\x049\x03\x05+\x1e\x03\x05,\x17\x03\x05 \x1d\x03" + - "\x05\x22\x05\x03\x050\x1d" - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookup(s []byte) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupUnsafe(s []byte) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *idnaTrie) lookupString(s string) (v uint16, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return idnaValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := idnaIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = idnaIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = idnaIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *idnaTrie) lookupStringUnsafe(s string) uint16 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return idnaValues[c0] - } - i := idnaIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = idnaIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// idnaTrie. Total size: 28600 bytes (27.93 KiB). Checksum: 95575047b5d8fff. -type idnaTrie struct{} - -func newIdnaTrie(i int) *idnaTrie { - return &idnaTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *idnaTrie) lookupValue(n uint32, b byte) uint16 { - switch { - case n < 124: - return uint16(idnaValues[n<<6+uint32(b)]) - default: - n -= 124 - return uint16(idnaSparse.lookup(n, b)) - } -} - -// idnaValues: 126 blocks, 8064 entries, 16128 bytes -// The third block is the zero block. -var idnaValues = [8064]uint16{ - // Block 0x0, offset 0x0 - 0x00: 0x0080, 0x01: 0x0080, 0x02: 0x0080, 0x03: 0x0080, 0x04: 0x0080, 0x05: 0x0080, - 0x06: 0x0080, 0x07: 0x0080, 0x08: 0x0080, 0x09: 0x0080, 0x0a: 0x0080, 0x0b: 0x0080, - 0x0c: 0x0080, 0x0d: 0x0080, 0x0e: 0x0080, 0x0f: 0x0080, 0x10: 0x0080, 0x11: 0x0080, - 0x12: 0x0080, 0x13: 0x0080, 0x14: 0x0080, 0x15: 0x0080, 0x16: 0x0080, 0x17: 0x0080, - 0x18: 0x0080, 0x19: 0x0080, 0x1a: 0x0080, 0x1b: 0x0080, 0x1c: 0x0080, 0x1d: 0x0080, - 0x1e: 0x0080, 0x1f: 0x0080, 0x20: 0x0080, 0x21: 0x0080, 0x22: 0x0080, 0x23: 0x0080, - 0x24: 0x0080, 0x25: 0x0080, 0x26: 0x0080, 0x27: 0x0080, 0x28: 0x0080, 0x29: 0x0080, - 0x2a: 0x0080, 0x2b: 0x0080, 0x2c: 0x0080, 0x2d: 0x0008, 0x2e: 0x0008, 0x2f: 0x0080, - 0x30: 0x0008, 0x31: 0x0008, 0x32: 0x0008, 0x33: 0x0008, 0x34: 0x0008, 0x35: 0x0008, - 0x36: 0x0008, 0x37: 0x0008, 0x38: 0x0008, 0x39: 0x0008, 0x3a: 0x0080, 0x3b: 0x0080, - 0x3c: 0x0080, 0x3d: 0x0080, 0x3e: 0x0080, 0x3f: 0x0080, - // Block 0x1, offset 0x40 - 0x40: 0x0080, 0x41: 0xe105, 0x42: 0xe105, 0x43: 0xe105, 0x44: 0xe105, 0x45: 0xe105, - 0x46: 0xe105, 0x47: 0xe105, 0x48: 0xe105, 0x49: 0xe105, 0x4a: 0xe105, 0x4b: 0xe105, - 0x4c: 0xe105, 0x4d: 0xe105, 0x4e: 0xe105, 0x4f: 0xe105, 0x50: 0xe105, 0x51: 0xe105, - 0x52: 0xe105, 0x53: 0xe105, 0x54: 0xe105, 0x55: 0xe105, 0x56: 0xe105, 0x57: 0xe105, - 0x58: 0xe105, 0x59: 0xe105, 0x5a: 0xe105, 0x5b: 0x0080, 0x5c: 0x0080, 0x5d: 0x0080, - 0x5e: 0x0080, 0x5f: 0x0080, 0x60: 0x0080, 0x61: 0x0008, 0x62: 0x0008, 0x63: 0x0008, - 0x64: 0x0008, 0x65: 0x0008, 0x66: 0x0008, 0x67: 0x0008, 0x68: 0x0008, 0x69: 0x0008, - 0x6a: 0x0008, 0x6b: 0x0008, 0x6c: 0x0008, 0x6d: 0x0008, 0x6e: 0x0008, 0x6f: 0x0008, - 0x70: 0x0008, 0x71: 0x0008, 0x72: 0x0008, 0x73: 0x0008, 0x74: 0x0008, 0x75: 0x0008, - 0x76: 0x0008, 0x77: 0x0008, 0x78: 0x0008, 0x79: 0x0008, 0x7a: 0x0008, 0x7b: 0x0080, - 0x7c: 0x0080, 0x7d: 0x0080, 0x7e: 0x0080, 0x7f: 0x0080, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x0040, 0xc1: 0x0040, 0xc2: 0x0040, 0xc3: 0x0040, 0xc4: 0x0040, 0xc5: 0x0040, - 0xc6: 0x0040, 0xc7: 0x0040, 0xc8: 0x0040, 0xc9: 0x0040, 0xca: 0x0040, 0xcb: 0x0040, - 0xcc: 0x0040, 0xcd: 0x0040, 0xce: 0x0040, 0xcf: 0x0040, 0xd0: 0x0040, 0xd1: 0x0040, - 0xd2: 0x0040, 0xd3: 0x0040, 0xd4: 0x0040, 0xd5: 0x0040, 0xd6: 0x0040, 0xd7: 0x0040, - 0xd8: 0x0040, 0xd9: 0x0040, 0xda: 0x0040, 0xdb: 0x0040, 0xdc: 0x0040, 0xdd: 0x0040, - 0xde: 0x0040, 0xdf: 0x0040, 0xe0: 0x000a, 0xe1: 0x0018, 0xe2: 0x0018, 0xe3: 0x0018, - 0xe4: 0x0018, 0xe5: 0x0018, 0xe6: 0x0018, 0xe7: 0x0018, 0xe8: 0x001a, 0xe9: 0x0018, - 0xea: 0x0039, 0xeb: 0x0018, 0xec: 0x0018, 0xed: 0x03c0, 0xee: 0x0018, 0xef: 0x004a, - 0xf0: 0x0018, 0xf1: 0x0018, 0xf2: 0x0069, 0xf3: 0x0079, 0xf4: 0x008a, 0xf5: 0x0005, - 0xf6: 0x0018, 0xf7: 0x0008, 0xf8: 0x00aa, 0xf9: 0x00c9, 0xfa: 0x00d9, 0xfb: 0x0018, - 0xfc: 0x00e9, 0xfd: 0x0119, 0xfe: 0x0149, 0xff: 0x0018, - // Block 0x4, offset 0x100 - 0x100: 0xe00d, 0x101: 0x0008, 0x102: 0xe00d, 0x103: 0x0008, 0x104: 0xe00d, 0x105: 0x0008, - 0x106: 0xe00d, 0x107: 0x0008, 0x108: 0xe00d, 0x109: 0x0008, 0x10a: 0xe00d, 0x10b: 0x0008, - 0x10c: 0xe00d, 0x10d: 0x0008, 0x10e: 0xe00d, 0x10f: 0x0008, 0x110: 0xe00d, 0x111: 0x0008, - 0x112: 0xe00d, 0x113: 0x0008, 0x114: 0xe00d, 0x115: 0x0008, 0x116: 0xe00d, 0x117: 0x0008, - 0x118: 0xe00d, 0x119: 0x0008, 0x11a: 0xe00d, 0x11b: 0x0008, 0x11c: 0xe00d, 0x11d: 0x0008, - 0x11e: 0xe00d, 0x11f: 0x0008, 0x120: 0xe00d, 0x121: 0x0008, 0x122: 0xe00d, 0x123: 0x0008, - 0x124: 0xe00d, 0x125: 0x0008, 0x126: 0xe00d, 0x127: 0x0008, 0x128: 0xe00d, 0x129: 0x0008, - 0x12a: 0xe00d, 0x12b: 0x0008, 0x12c: 0xe00d, 0x12d: 0x0008, 0x12e: 0xe00d, 0x12f: 0x0008, - 0x130: 0x0179, 0x131: 0x0008, 0x132: 0x0035, 0x133: 0x004d, 0x134: 0xe00d, 0x135: 0x0008, - 0x136: 0xe00d, 0x137: 0x0008, 0x138: 0x0008, 0x139: 0xe01d, 0x13a: 0x0008, 0x13b: 0xe03d, - 0x13c: 0x0008, 0x13d: 0xe01d, 0x13e: 0x0008, 0x13f: 0x0199, - // Block 0x5, offset 0x140 - 0x140: 0x0199, 0x141: 0xe01d, 0x142: 0x0008, 0x143: 0xe03d, 0x144: 0x0008, 0x145: 0xe01d, - 0x146: 0x0008, 0x147: 0xe07d, 0x148: 0x0008, 0x149: 0x01b9, 0x14a: 0xe00d, 0x14b: 0x0008, - 0x14c: 0xe00d, 0x14d: 0x0008, 0x14e: 0xe00d, 0x14f: 0x0008, 0x150: 0xe00d, 0x151: 0x0008, - 0x152: 0xe00d, 0x153: 0x0008, 0x154: 0xe00d, 0x155: 0x0008, 0x156: 0xe00d, 0x157: 0x0008, - 0x158: 0xe00d, 0x159: 0x0008, 0x15a: 0xe00d, 0x15b: 0x0008, 0x15c: 0xe00d, 0x15d: 0x0008, - 0x15e: 0xe00d, 0x15f: 0x0008, 0x160: 0xe00d, 0x161: 0x0008, 0x162: 0xe00d, 0x163: 0x0008, - 0x164: 0xe00d, 0x165: 0x0008, 0x166: 0xe00d, 0x167: 0x0008, 0x168: 0xe00d, 0x169: 0x0008, - 0x16a: 0xe00d, 0x16b: 0x0008, 0x16c: 0xe00d, 0x16d: 0x0008, 0x16e: 0xe00d, 0x16f: 0x0008, - 0x170: 0xe00d, 0x171: 0x0008, 0x172: 0xe00d, 0x173: 0x0008, 0x174: 0xe00d, 0x175: 0x0008, - 0x176: 0xe00d, 0x177: 0x0008, 0x178: 0x0065, 0x179: 0xe01d, 0x17a: 0x0008, 0x17b: 0xe03d, - 0x17c: 0x0008, 0x17d: 0xe01d, 0x17e: 0x0008, 0x17f: 0x01d9, - // Block 0x6, offset 0x180 - 0x180: 0x0008, 0x181: 0x007d, 0x182: 0xe00d, 0x183: 0x0008, 0x184: 0xe00d, 0x185: 0x0008, - 0x186: 0x007d, 0x187: 0xe07d, 0x188: 0x0008, 0x189: 0x0095, 0x18a: 0x00ad, 0x18b: 0xe03d, - 0x18c: 0x0008, 0x18d: 0x0008, 0x18e: 0x00c5, 0x18f: 0x00dd, 0x190: 0x00f5, 0x191: 0xe01d, - 0x192: 0x0008, 0x193: 0x010d, 0x194: 0x0125, 0x195: 0x0008, 0x196: 0x013d, 0x197: 0x013d, - 0x198: 0xe00d, 0x199: 0x0008, 0x19a: 0x0008, 0x19b: 0x0008, 0x19c: 0x010d, 0x19d: 0x0155, - 0x19e: 0x0008, 0x19f: 0x016d, 0x1a0: 0xe00d, 0x1a1: 0x0008, 0x1a2: 0xe00d, 0x1a3: 0x0008, - 0x1a4: 0xe00d, 0x1a5: 0x0008, 0x1a6: 0x0185, 0x1a7: 0xe07d, 0x1a8: 0x0008, 0x1a9: 0x019d, - 0x1aa: 0x0008, 0x1ab: 0x0008, 0x1ac: 0xe00d, 0x1ad: 0x0008, 0x1ae: 0x0185, 0x1af: 0xe0fd, - 0x1b0: 0x0008, 0x1b1: 0x01b5, 0x1b2: 0x01cd, 0x1b3: 0xe03d, 0x1b4: 0x0008, 0x1b5: 0xe01d, - 0x1b6: 0x0008, 0x1b7: 0x01e5, 0x1b8: 0xe00d, 0x1b9: 0x0008, 0x1ba: 0x0008, 0x1bb: 0x0008, - 0x1bc: 0xe00d, 0x1bd: 0x0008, 0x1be: 0x0008, 0x1bf: 0x0008, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x0008, 0x1c1: 0x0008, 0x1c2: 0x0008, 0x1c3: 0x0008, 0x1c4: 0x01e9, 0x1c5: 0x01e9, - 0x1c6: 0x01e9, 0x1c7: 0x01fd, 0x1c8: 0x0215, 0x1c9: 0x022d, 0x1ca: 0x0245, 0x1cb: 0x025d, - 0x1cc: 0x0275, 0x1cd: 0xe01d, 0x1ce: 0x0008, 0x1cf: 0xe0fd, 0x1d0: 0x0008, 0x1d1: 0xe01d, - 0x1d2: 0x0008, 0x1d3: 0xe03d, 0x1d4: 0x0008, 0x1d5: 0xe01d, 0x1d6: 0x0008, 0x1d7: 0xe07d, - 0x1d8: 0x0008, 0x1d9: 0xe01d, 0x1da: 0x0008, 0x1db: 0xe03d, 0x1dc: 0x0008, 0x1dd: 0x0008, - 0x1de: 0xe00d, 0x1df: 0x0008, 0x1e0: 0xe00d, 0x1e1: 0x0008, 0x1e2: 0xe00d, 0x1e3: 0x0008, - 0x1e4: 0xe00d, 0x1e5: 0x0008, 0x1e6: 0xe00d, 0x1e7: 0x0008, 0x1e8: 0xe00d, 0x1e9: 0x0008, - 0x1ea: 0xe00d, 0x1eb: 0x0008, 0x1ec: 0xe00d, 0x1ed: 0x0008, 0x1ee: 0xe00d, 0x1ef: 0x0008, - 0x1f0: 0x0008, 0x1f1: 0x028d, 0x1f2: 0x02a5, 0x1f3: 0x02bd, 0x1f4: 0xe00d, 0x1f5: 0x0008, - 0x1f6: 0x02d5, 0x1f7: 0x02ed, 0x1f8: 0xe00d, 0x1f9: 0x0008, 0x1fa: 0xe00d, 0x1fb: 0x0008, - 0x1fc: 0xe00d, 0x1fd: 0x0008, 0x1fe: 0xe00d, 0x1ff: 0x0008, - // Block 0x8, offset 0x200 - 0x200: 0xe00d, 0x201: 0x0008, 0x202: 0xe00d, 0x203: 0x0008, 0x204: 0xe00d, 0x205: 0x0008, - 0x206: 0xe00d, 0x207: 0x0008, 0x208: 0xe00d, 0x209: 0x0008, 0x20a: 0xe00d, 0x20b: 0x0008, - 0x20c: 0xe00d, 0x20d: 0x0008, 0x20e: 0xe00d, 0x20f: 0x0008, 0x210: 0xe00d, 0x211: 0x0008, - 0x212: 0xe00d, 0x213: 0x0008, 0x214: 0xe00d, 0x215: 0x0008, 0x216: 0xe00d, 0x217: 0x0008, - 0x218: 0xe00d, 0x219: 0x0008, 0x21a: 0xe00d, 0x21b: 0x0008, 0x21c: 0xe00d, 0x21d: 0x0008, - 0x21e: 0xe00d, 0x21f: 0x0008, 0x220: 0x0305, 0x221: 0x0008, 0x222: 0xe00d, 0x223: 0x0008, - 0x224: 0xe00d, 0x225: 0x0008, 0x226: 0xe00d, 0x227: 0x0008, 0x228: 0xe00d, 0x229: 0x0008, - 0x22a: 0xe00d, 0x22b: 0x0008, 0x22c: 0xe00d, 0x22d: 0x0008, 0x22e: 0xe00d, 0x22f: 0x0008, - 0x230: 0xe00d, 0x231: 0x0008, 0x232: 0xe00d, 0x233: 0x0008, 0x234: 0x0008, 0x235: 0x0008, - 0x236: 0x0008, 0x237: 0x0008, 0x238: 0x0008, 0x239: 0x0008, 0x23a: 0x0209, 0x23b: 0xe03d, - 0x23c: 0x0008, 0x23d: 0x031d, 0x23e: 0x0229, 0x23f: 0x0008, - // Block 0x9, offset 0x240 - 0x240: 0x0008, 0x241: 0x0008, 0x242: 0x0018, 0x243: 0x0018, 0x244: 0x0018, 0x245: 0x0018, - 0x246: 0x0008, 0x247: 0x0008, 0x248: 0x0008, 0x249: 0x0008, 0x24a: 0x0008, 0x24b: 0x0008, - 0x24c: 0x0008, 0x24d: 0x0008, 0x24e: 0x0008, 0x24f: 0x0008, 0x250: 0x0008, 0x251: 0x0008, - 0x252: 0x0018, 0x253: 0x0018, 0x254: 0x0018, 0x255: 0x0018, 0x256: 0x0018, 0x257: 0x0018, - 0x258: 0x029a, 0x259: 0x02ba, 0x25a: 0x02da, 0x25b: 0x02fa, 0x25c: 0x031a, 0x25d: 0x033a, - 0x25e: 0x0018, 0x25f: 0x0018, 0x260: 0x03ad, 0x261: 0x0359, 0x262: 0x01d9, 0x263: 0x0369, - 0x264: 0x03c5, 0x265: 0x0018, 0x266: 0x0018, 0x267: 0x0018, 0x268: 0x0018, 0x269: 0x0018, - 0x26a: 0x0018, 0x26b: 0x0018, 0x26c: 0x0008, 0x26d: 0x0018, 0x26e: 0x0008, 0x26f: 0x0018, - 0x270: 0x0018, 0x271: 0x0018, 0x272: 0x0018, 0x273: 0x0018, 0x274: 0x0018, 0x275: 0x0018, - 0x276: 0x0018, 0x277: 0x0018, 0x278: 0x0018, 0x279: 0x0018, 0x27a: 0x0018, 0x27b: 0x0018, - 0x27c: 0x0018, 0x27d: 0x0018, 0x27e: 0x0018, 0x27f: 0x0018, - // Block 0xa, offset 0x280 - 0x280: 0x03dd, 0x281: 0x03dd, 0x282: 0x3308, 0x283: 0x03f5, 0x284: 0x0379, 0x285: 0x040d, - 0x286: 0x3308, 0x287: 0x3308, 0x288: 0x3308, 0x289: 0x3308, 0x28a: 0x3308, 0x28b: 0x3308, - 0x28c: 0x3308, 0x28d: 0x3308, 0x28e: 0x3308, 0x28f: 0x33c0, 0x290: 0x3308, 0x291: 0x3308, - 0x292: 0x3308, 0x293: 0x3308, 0x294: 0x3308, 0x295: 0x3308, 0x296: 0x3308, 0x297: 0x3308, - 0x298: 0x3308, 0x299: 0x3308, 0x29a: 0x3308, 0x29b: 0x3308, 0x29c: 0x3308, 0x29d: 0x3308, - 0x29e: 0x3308, 0x29f: 0x3308, 0x2a0: 0x3308, 0x2a1: 0x3308, 0x2a2: 0x3308, 0x2a3: 0x3308, - 0x2a4: 0x3308, 0x2a5: 0x3308, 0x2a6: 0x3308, 0x2a7: 0x3308, 0x2a8: 0x3308, 0x2a9: 0x3308, - 0x2aa: 0x3308, 0x2ab: 0x3308, 0x2ac: 0x3308, 0x2ad: 0x3308, 0x2ae: 0x3308, 0x2af: 0x3308, - 0x2b0: 0xe00d, 0x2b1: 0x0008, 0x2b2: 0xe00d, 0x2b3: 0x0008, 0x2b4: 0x0425, 0x2b5: 0x0008, - 0x2b6: 0xe00d, 0x2b7: 0x0008, 0x2b8: 0x0040, 0x2b9: 0x0040, 0x2ba: 0x03a2, 0x2bb: 0x0008, - 0x2bc: 0x0008, 0x2bd: 0x0008, 0x2be: 0x03c2, 0x2bf: 0x043d, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x0040, 0x2c1: 0x0040, 0x2c2: 0x0040, 0x2c3: 0x0040, 0x2c4: 0x008a, 0x2c5: 0x03d2, - 0x2c6: 0xe155, 0x2c7: 0x0455, 0x2c8: 0xe12d, 0x2c9: 0xe13d, 0x2ca: 0xe12d, 0x2cb: 0x0040, - 0x2cc: 0x03dd, 0x2cd: 0x0040, 0x2ce: 0x046d, 0x2cf: 0x0485, 0x2d0: 0x0008, 0x2d1: 0xe105, - 0x2d2: 0xe105, 0x2d3: 0xe105, 0x2d4: 0xe105, 0x2d5: 0xe105, 0x2d6: 0xe105, 0x2d7: 0xe105, - 0x2d8: 0xe105, 0x2d9: 0xe105, 0x2da: 0xe105, 0x2db: 0xe105, 0x2dc: 0xe105, 0x2dd: 0xe105, - 0x2de: 0xe105, 0x2df: 0xe105, 0x2e0: 0x049d, 0x2e1: 0x049d, 0x2e2: 0x0040, 0x2e3: 0x049d, - 0x2e4: 0x049d, 0x2e5: 0x049d, 0x2e6: 0x049d, 0x2e7: 0x049d, 0x2e8: 0x049d, 0x2e9: 0x049d, - 0x2ea: 0x049d, 0x2eb: 0x049d, 0x2ec: 0x0008, 0x2ed: 0x0008, 0x2ee: 0x0008, 0x2ef: 0x0008, - 0x2f0: 0x0008, 0x2f1: 0x0008, 0x2f2: 0x0008, 0x2f3: 0x0008, 0x2f4: 0x0008, 0x2f5: 0x0008, - 0x2f6: 0x0008, 0x2f7: 0x0008, 0x2f8: 0x0008, 0x2f9: 0x0008, 0x2fa: 0x0008, 0x2fb: 0x0008, - 0x2fc: 0x0008, 0x2fd: 0x0008, 0x2fe: 0x0008, 0x2ff: 0x0008, - // Block 0xc, offset 0x300 - 0x300: 0x0008, 0x301: 0x0008, 0x302: 0xe00f, 0x303: 0x0008, 0x304: 0x0008, 0x305: 0x0008, - 0x306: 0x0008, 0x307: 0x0008, 0x308: 0x0008, 0x309: 0x0008, 0x30a: 0x0008, 0x30b: 0x0008, - 0x30c: 0x0008, 0x30d: 0x0008, 0x30e: 0x0008, 0x30f: 0xe0c5, 0x310: 0x04b5, 0x311: 0x04cd, - 0x312: 0xe0bd, 0x313: 0xe0f5, 0x314: 0xe0fd, 0x315: 0xe09d, 0x316: 0xe0b5, 0x317: 0x0008, - 0x318: 0xe00d, 0x319: 0x0008, 0x31a: 0xe00d, 0x31b: 0x0008, 0x31c: 0xe00d, 0x31d: 0x0008, - 0x31e: 0xe00d, 0x31f: 0x0008, 0x320: 0xe00d, 0x321: 0x0008, 0x322: 0xe00d, 0x323: 0x0008, - 0x324: 0xe00d, 0x325: 0x0008, 0x326: 0xe00d, 0x327: 0x0008, 0x328: 0xe00d, 0x329: 0x0008, - 0x32a: 0xe00d, 0x32b: 0x0008, 0x32c: 0xe00d, 0x32d: 0x0008, 0x32e: 0xe00d, 0x32f: 0x0008, - 0x330: 0x04e5, 0x331: 0xe185, 0x332: 0xe18d, 0x333: 0x0008, 0x334: 0x04fd, 0x335: 0x03dd, - 0x336: 0x0018, 0x337: 0xe07d, 0x338: 0x0008, 0x339: 0xe1d5, 0x33a: 0xe00d, 0x33b: 0x0008, - 0x33c: 0x0008, 0x33d: 0x0515, 0x33e: 0x052d, 0x33f: 0x052d, - // Block 0xd, offset 0x340 - 0x340: 0x0008, 0x341: 0x0008, 0x342: 0x0008, 0x343: 0x0008, 0x344: 0x0008, 0x345: 0x0008, - 0x346: 0x0008, 0x347: 0x0008, 0x348: 0x0008, 0x349: 0x0008, 0x34a: 0x0008, 0x34b: 0x0008, - 0x34c: 0x0008, 0x34d: 0x0008, 0x34e: 0x0008, 0x34f: 0x0008, 0x350: 0x0008, 0x351: 0x0008, - 0x352: 0x0008, 0x353: 0x0008, 0x354: 0x0008, 0x355: 0x0008, 0x356: 0x0008, 0x357: 0x0008, - 0x358: 0x0008, 0x359: 0x0008, 0x35a: 0x0008, 0x35b: 0x0008, 0x35c: 0x0008, 0x35d: 0x0008, - 0x35e: 0x0008, 0x35f: 0x0008, 0x360: 0xe00d, 0x361: 0x0008, 0x362: 0xe00d, 0x363: 0x0008, - 0x364: 0xe00d, 0x365: 0x0008, 0x366: 0xe00d, 0x367: 0x0008, 0x368: 0xe00d, 0x369: 0x0008, - 0x36a: 0xe00d, 0x36b: 0x0008, 0x36c: 0xe00d, 0x36d: 0x0008, 0x36e: 0xe00d, 0x36f: 0x0008, - 0x370: 0xe00d, 0x371: 0x0008, 0x372: 0xe00d, 0x373: 0x0008, 0x374: 0xe00d, 0x375: 0x0008, - 0x376: 0xe00d, 0x377: 0x0008, 0x378: 0xe00d, 0x379: 0x0008, 0x37a: 0xe00d, 0x37b: 0x0008, - 0x37c: 0xe00d, 0x37d: 0x0008, 0x37e: 0xe00d, 0x37f: 0x0008, - // Block 0xe, offset 0x380 - 0x380: 0xe00d, 0x381: 0x0008, 0x382: 0x0018, 0x383: 0x3308, 0x384: 0x3308, 0x385: 0x3308, - 0x386: 0x3308, 0x387: 0x3308, 0x388: 0x3318, 0x389: 0x3318, 0x38a: 0xe00d, 0x38b: 0x0008, - 0x38c: 0xe00d, 0x38d: 0x0008, 0x38e: 0xe00d, 0x38f: 0x0008, 0x390: 0xe00d, 0x391: 0x0008, - 0x392: 0xe00d, 0x393: 0x0008, 0x394: 0xe00d, 0x395: 0x0008, 0x396: 0xe00d, 0x397: 0x0008, - 0x398: 0xe00d, 0x399: 0x0008, 0x39a: 0xe00d, 0x39b: 0x0008, 0x39c: 0xe00d, 0x39d: 0x0008, - 0x39e: 0xe00d, 0x39f: 0x0008, 0x3a0: 0xe00d, 0x3a1: 0x0008, 0x3a2: 0xe00d, 0x3a3: 0x0008, - 0x3a4: 0xe00d, 0x3a5: 0x0008, 0x3a6: 0xe00d, 0x3a7: 0x0008, 0x3a8: 0xe00d, 0x3a9: 0x0008, - 0x3aa: 0xe00d, 0x3ab: 0x0008, 0x3ac: 0xe00d, 0x3ad: 0x0008, 0x3ae: 0xe00d, 0x3af: 0x0008, - 0x3b0: 0xe00d, 0x3b1: 0x0008, 0x3b2: 0xe00d, 0x3b3: 0x0008, 0x3b4: 0xe00d, 0x3b5: 0x0008, - 0x3b6: 0xe00d, 0x3b7: 0x0008, 0x3b8: 0xe00d, 0x3b9: 0x0008, 0x3ba: 0xe00d, 0x3bb: 0x0008, - 0x3bc: 0xe00d, 0x3bd: 0x0008, 0x3be: 0xe00d, 0x3bf: 0x0008, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x0040, 0x3c1: 0xe01d, 0x3c2: 0x0008, 0x3c3: 0xe03d, 0x3c4: 0x0008, 0x3c5: 0xe01d, - 0x3c6: 0x0008, 0x3c7: 0xe07d, 0x3c8: 0x0008, 0x3c9: 0xe01d, 0x3ca: 0x0008, 0x3cb: 0xe03d, - 0x3cc: 0x0008, 0x3cd: 0xe01d, 0x3ce: 0x0008, 0x3cf: 0x0008, 0x3d0: 0xe00d, 0x3d1: 0x0008, - 0x3d2: 0xe00d, 0x3d3: 0x0008, 0x3d4: 0xe00d, 0x3d5: 0x0008, 0x3d6: 0xe00d, 0x3d7: 0x0008, - 0x3d8: 0xe00d, 0x3d9: 0x0008, 0x3da: 0xe00d, 0x3db: 0x0008, 0x3dc: 0xe00d, 0x3dd: 0x0008, - 0x3de: 0xe00d, 0x3df: 0x0008, 0x3e0: 0xe00d, 0x3e1: 0x0008, 0x3e2: 0xe00d, 0x3e3: 0x0008, - 0x3e4: 0xe00d, 0x3e5: 0x0008, 0x3e6: 0xe00d, 0x3e7: 0x0008, 0x3e8: 0xe00d, 0x3e9: 0x0008, - 0x3ea: 0xe00d, 0x3eb: 0x0008, 0x3ec: 0xe00d, 0x3ed: 0x0008, 0x3ee: 0xe00d, 0x3ef: 0x0008, - 0x3f0: 0xe00d, 0x3f1: 0x0008, 0x3f2: 0xe00d, 0x3f3: 0x0008, 0x3f4: 0xe00d, 0x3f5: 0x0008, - 0x3f6: 0xe00d, 0x3f7: 0x0008, 0x3f8: 0xe00d, 0x3f9: 0x0008, 0x3fa: 0xe00d, 0x3fb: 0x0008, - 0x3fc: 0xe00d, 0x3fd: 0x0008, 0x3fe: 0xe00d, 0x3ff: 0x0008, - // Block 0x10, offset 0x400 - 0x400: 0xe00d, 0x401: 0x0008, 0x402: 0xe00d, 0x403: 0x0008, 0x404: 0xe00d, 0x405: 0x0008, - 0x406: 0xe00d, 0x407: 0x0008, 0x408: 0xe00d, 0x409: 0x0008, 0x40a: 0xe00d, 0x40b: 0x0008, - 0x40c: 0xe00d, 0x40d: 0x0008, 0x40e: 0xe00d, 0x40f: 0x0008, 0x410: 0xe00d, 0x411: 0x0008, - 0x412: 0xe00d, 0x413: 0x0008, 0x414: 0xe00d, 0x415: 0x0008, 0x416: 0xe00d, 0x417: 0x0008, - 0x418: 0xe00d, 0x419: 0x0008, 0x41a: 0xe00d, 0x41b: 0x0008, 0x41c: 0xe00d, 0x41d: 0x0008, - 0x41e: 0xe00d, 0x41f: 0x0008, 0x420: 0xe00d, 0x421: 0x0008, 0x422: 0xe00d, 0x423: 0x0008, - 0x424: 0xe00d, 0x425: 0x0008, 0x426: 0xe00d, 0x427: 0x0008, 0x428: 0xe00d, 0x429: 0x0008, - 0x42a: 0xe00d, 0x42b: 0x0008, 0x42c: 0xe00d, 0x42d: 0x0008, 0x42e: 0xe00d, 0x42f: 0x0008, - 0x430: 0x0040, 0x431: 0x03f5, 0x432: 0x03f5, 0x433: 0x03f5, 0x434: 0x03f5, 0x435: 0x03f5, - 0x436: 0x03f5, 0x437: 0x03f5, 0x438: 0x03f5, 0x439: 0x03f5, 0x43a: 0x03f5, 0x43b: 0x03f5, - 0x43c: 0x03f5, 0x43d: 0x03f5, 0x43e: 0x03f5, 0x43f: 0x03f5, - // Block 0x11, offset 0x440 - 0x440: 0x0840, 0x441: 0x0840, 0x442: 0x0840, 0x443: 0x0840, 0x444: 0x0840, 0x445: 0x0840, - 0x446: 0x0018, 0x447: 0x0018, 0x448: 0x0818, 0x449: 0x0018, 0x44a: 0x0018, 0x44b: 0x0818, - 0x44c: 0x0018, 0x44d: 0x0818, 0x44e: 0x0018, 0x44f: 0x0018, 0x450: 0x3308, 0x451: 0x3308, - 0x452: 0x3308, 0x453: 0x3308, 0x454: 0x3308, 0x455: 0x3308, 0x456: 0x3308, 0x457: 0x3308, - 0x458: 0x3308, 0x459: 0x3308, 0x45a: 0x3308, 0x45b: 0x0818, 0x45c: 0x0b40, 0x45d: 0x0040, - 0x45e: 0x0818, 0x45f: 0x0818, 0x460: 0x0a08, 0x461: 0x0808, 0x462: 0x0c08, 0x463: 0x0c08, - 0x464: 0x0c08, 0x465: 0x0c08, 0x466: 0x0a08, 0x467: 0x0c08, 0x468: 0x0a08, 0x469: 0x0c08, - 0x46a: 0x0a08, 0x46b: 0x0a08, 0x46c: 0x0a08, 0x46d: 0x0a08, 0x46e: 0x0a08, 0x46f: 0x0c08, - 0x470: 0x0c08, 0x471: 0x0c08, 0x472: 0x0c08, 0x473: 0x0a08, 0x474: 0x0a08, 0x475: 0x0a08, - 0x476: 0x0a08, 0x477: 0x0a08, 0x478: 0x0a08, 0x479: 0x0a08, 0x47a: 0x0a08, 0x47b: 0x0a08, - 0x47c: 0x0a08, 0x47d: 0x0a08, 0x47e: 0x0a08, 0x47f: 0x0a08, - // Block 0x12, offset 0x480 - 0x480: 0x0818, 0x481: 0x0a08, 0x482: 0x0a08, 0x483: 0x0a08, 0x484: 0x0a08, 0x485: 0x0a08, - 0x486: 0x0a08, 0x487: 0x0a08, 0x488: 0x0c08, 0x489: 0x0a08, 0x48a: 0x0a08, 0x48b: 0x3308, - 0x48c: 0x3308, 0x48d: 0x3308, 0x48e: 0x3308, 0x48f: 0x3308, 0x490: 0x3308, 0x491: 0x3308, - 0x492: 0x3308, 0x493: 0x3308, 0x494: 0x3308, 0x495: 0x3308, 0x496: 0x3308, 0x497: 0x3308, - 0x498: 0x3308, 0x499: 0x3308, 0x49a: 0x3308, 0x49b: 0x3308, 0x49c: 0x3308, 0x49d: 0x3308, - 0x49e: 0x3308, 0x49f: 0x3308, 0x4a0: 0x0808, 0x4a1: 0x0808, 0x4a2: 0x0808, 0x4a3: 0x0808, - 0x4a4: 0x0808, 0x4a5: 0x0808, 0x4a6: 0x0808, 0x4a7: 0x0808, 0x4a8: 0x0808, 0x4a9: 0x0808, - 0x4aa: 0x0018, 0x4ab: 0x0818, 0x4ac: 0x0818, 0x4ad: 0x0818, 0x4ae: 0x0a08, 0x4af: 0x0a08, - 0x4b0: 0x3308, 0x4b1: 0x0c08, 0x4b2: 0x0c08, 0x4b3: 0x0c08, 0x4b4: 0x0808, 0x4b5: 0x0429, - 0x4b6: 0x0451, 0x4b7: 0x0479, 0x4b8: 0x04a1, 0x4b9: 0x0a08, 0x4ba: 0x0a08, 0x4bb: 0x0a08, - 0x4bc: 0x0a08, 0x4bd: 0x0a08, 0x4be: 0x0a08, 0x4bf: 0x0a08, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x0c08, 0x4c1: 0x0a08, 0x4c2: 0x0a08, 0x4c3: 0x0c08, 0x4c4: 0x0c08, 0x4c5: 0x0c08, - 0x4c6: 0x0c08, 0x4c7: 0x0c08, 0x4c8: 0x0c08, 0x4c9: 0x0c08, 0x4ca: 0x0c08, 0x4cb: 0x0c08, - 0x4cc: 0x0a08, 0x4cd: 0x0c08, 0x4ce: 0x0a08, 0x4cf: 0x0c08, 0x4d0: 0x0a08, 0x4d1: 0x0a08, - 0x4d2: 0x0c08, 0x4d3: 0x0c08, 0x4d4: 0x0818, 0x4d5: 0x0c08, 0x4d6: 0x3308, 0x4d7: 0x3308, - 0x4d8: 0x3308, 0x4d9: 0x3308, 0x4da: 0x3308, 0x4db: 0x3308, 0x4dc: 0x3308, 0x4dd: 0x0840, - 0x4de: 0x0018, 0x4df: 0x3308, 0x4e0: 0x3308, 0x4e1: 0x3308, 0x4e2: 0x3308, 0x4e3: 0x3308, - 0x4e4: 0x3308, 0x4e5: 0x0808, 0x4e6: 0x0808, 0x4e7: 0x3308, 0x4e8: 0x3308, 0x4e9: 0x0018, - 0x4ea: 0x3308, 0x4eb: 0x3308, 0x4ec: 0x3308, 0x4ed: 0x3308, 0x4ee: 0x0c08, 0x4ef: 0x0c08, - 0x4f0: 0x0008, 0x4f1: 0x0008, 0x4f2: 0x0008, 0x4f3: 0x0008, 0x4f4: 0x0008, 0x4f5: 0x0008, - 0x4f6: 0x0008, 0x4f7: 0x0008, 0x4f8: 0x0008, 0x4f9: 0x0008, 0x4fa: 0x0a08, 0x4fb: 0x0a08, - 0x4fc: 0x0a08, 0x4fd: 0x0808, 0x4fe: 0x0808, 0x4ff: 0x0a08, - // Block 0x14, offset 0x500 - 0x500: 0x0818, 0x501: 0x0818, 0x502: 0x0818, 0x503: 0x0818, 0x504: 0x0818, 0x505: 0x0818, - 0x506: 0x0818, 0x507: 0x0818, 0x508: 0x0818, 0x509: 0x0818, 0x50a: 0x0818, 0x50b: 0x0818, - 0x50c: 0x0818, 0x50d: 0x0818, 0x50e: 0x0040, 0x50f: 0x0b40, 0x510: 0x0c08, 0x511: 0x3308, - 0x512: 0x0a08, 0x513: 0x0a08, 0x514: 0x0a08, 0x515: 0x0c08, 0x516: 0x0c08, 0x517: 0x0c08, - 0x518: 0x0c08, 0x519: 0x0c08, 0x51a: 0x0a08, 0x51b: 0x0a08, 0x51c: 0x0a08, 0x51d: 0x0a08, - 0x51e: 0x0c08, 0x51f: 0x0a08, 0x520: 0x0a08, 0x521: 0x0a08, 0x522: 0x0a08, 0x523: 0x0a08, - 0x524: 0x0a08, 0x525: 0x0a08, 0x526: 0x0a08, 0x527: 0x0a08, 0x528: 0x0c08, 0x529: 0x0a08, - 0x52a: 0x0c08, 0x52b: 0x0a08, 0x52c: 0x0c08, 0x52d: 0x0a08, 0x52e: 0x0a08, 0x52f: 0x0c08, - 0x530: 0x3308, 0x531: 0x3308, 0x532: 0x3308, 0x533: 0x3308, 0x534: 0x3308, 0x535: 0x3308, - 0x536: 0x3308, 0x537: 0x3308, 0x538: 0x3308, 0x539: 0x3308, 0x53a: 0x3308, 0x53b: 0x3308, - 0x53c: 0x3308, 0x53d: 0x3308, 0x53e: 0x3308, 0x53f: 0x3308, - // Block 0x15, offset 0x540 - 0x540: 0x3008, 0x541: 0x3308, 0x542: 0x3308, 0x543: 0x3308, 0x544: 0x3308, 0x545: 0x3308, - 0x546: 0x3308, 0x547: 0x3308, 0x548: 0x3308, 0x549: 0x3008, 0x54a: 0x3008, 0x54b: 0x3008, - 0x54c: 0x3008, 0x54d: 0x3b08, 0x54e: 0x3008, 0x54f: 0x3008, 0x550: 0x0008, 0x551: 0x3308, - 0x552: 0x3308, 0x553: 0x3308, 0x554: 0x3308, 0x555: 0x3308, 0x556: 0x3308, 0x557: 0x3308, - 0x558: 0x04c9, 0x559: 0x0501, 0x55a: 0x0539, 0x55b: 0x0571, 0x55c: 0x05a9, 0x55d: 0x05e1, - 0x55e: 0x0619, 0x55f: 0x0651, 0x560: 0x0008, 0x561: 0x0008, 0x562: 0x3308, 0x563: 0x3308, - 0x564: 0x0018, 0x565: 0x0018, 0x566: 0x0008, 0x567: 0x0008, 0x568: 0x0008, 0x569: 0x0008, - 0x56a: 0x0008, 0x56b: 0x0008, 0x56c: 0x0008, 0x56d: 0x0008, 0x56e: 0x0008, 0x56f: 0x0008, - 0x570: 0x0018, 0x571: 0x0008, 0x572: 0x0008, 0x573: 0x0008, 0x574: 0x0008, 0x575: 0x0008, - 0x576: 0x0008, 0x577: 0x0008, 0x578: 0x0008, 0x579: 0x0008, 0x57a: 0x0008, 0x57b: 0x0008, - 0x57c: 0x0008, 0x57d: 0x0008, 0x57e: 0x0008, 0x57f: 0x0008, - // Block 0x16, offset 0x580 - 0x580: 0x0008, 0x581: 0x3308, 0x582: 0x3008, 0x583: 0x3008, 0x584: 0x0040, 0x585: 0x0008, - 0x586: 0x0008, 0x587: 0x0008, 0x588: 0x0008, 0x589: 0x0008, 0x58a: 0x0008, 0x58b: 0x0008, - 0x58c: 0x0008, 0x58d: 0x0040, 0x58e: 0x0040, 0x58f: 0x0008, 0x590: 0x0008, 0x591: 0x0040, - 0x592: 0x0040, 0x593: 0x0008, 0x594: 0x0008, 0x595: 0x0008, 0x596: 0x0008, 0x597: 0x0008, - 0x598: 0x0008, 0x599: 0x0008, 0x59a: 0x0008, 0x59b: 0x0008, 0x59c: 0x0008, 0x59d: 0x0008, - 0x59e: 0x0008, 0x59f: 0x0008, 0x5a0: 0x0008, 0x5a1: 0x0008, 0x5a2: 0x0008, 0x5a3: 0x0008, - 0x5a4: 0x0008, 0x5a5: 0x0008, 0x5a6: 0x0008, 0x5a7: 0x0008, 0x5a8: 0x0008, 0x5a9: 0x0040, - 0x5aa: 0x0008, 0x5ab: 0x0008, 0x5ac: 0x0008, 0x5ad: 0x0008, 0x5ae: 0x0008, 0x5af: 0x0008, - 0x5b0: 0x0008, 0x5b1: 0x0040, 0x5b2: 0x0008, 0x5b3: 0x0040, 0x5b4: 0x0040, 0x5b5: 0x0040, - 0x5b6: 0x0008, 0x5b7: 0x0008, 0x5b8: 0x0008, 0x5b9: 0x0008, 0x5ba: 0x0040, 0x5bb: 0x0040, - 0x5bc: 0x3308, 0x5bd: 0x0008, 0x5be: 0x3008, 0x5bf: 0x3008, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x3008, 0x5c1: 0x3308, 0x5c2: 0x3308, 0x5c3: 0x3308, 0x5c4: 0x3308, 0x5c5: 0x0040, - 0x5c6: 0x0040, 0x5c7: 0x3008, 0x5c8: 0x3008, 0x5c9: 0x0040, 0x5ca: 0x0040, 0x5cb: 0x3008, - 0x5cc: 0x3008, 0x5cd: 0x3b08, 0x5ce: 0x0008, 0x5cf: 0x0040, 0x5d0: 0x0040, 0x5d1: 0x0040, - 0x5d2: 0x0040, 0x5d3: 0x0040, 0x5d4: 0x0040, 0x5d5: 0x0040, 0x5d6: 0x0040, 0x5d7: 0x3008, - 0x5d8: 0x0040, 0x5d9: 0x0040, 0x5da: 0x0040, 0x5db: 0x0040, 0x5dc: 0x0689, 0x5dd: 0x06c1, - 0x5de: 0x0040, 0x5df: 0x06f9, 0x5e0: 0x0008, 0x5e1: 0x0008, 0x5e2: 0x3308, 0x5e3: 0x3308, - 0x5e4: 0x0040, 0x5e5: 0x0040, 0x5e6: 0x0008, 0x5e7: 0x0008, 0x5e8: 0x0008, 0x5e9: 0x0008, - 0x5ea: 0x0008, 0x5eb: 0x0008, 0x5ec: 0x0008, 0x5ed: 0x0008, 0x5ee: 0x0008, 0x5ef: 0x0008, - 0x5f0: 0x0008, 0x5f1: 0x0008, 0x5f2: 0x0018, 0x5f3: 0x0018, 0x5f4: 0x0018, 0x5f5: 0x0018, - 0x5f6: 0x0018, 0x5f7: 0x0018, 0x5f8: 0x0018, 0x5f9: 0x0018, 0x5fa: 0x0018, 0x5fb: 0x0018, - 0x5fc: 0x0040, 0x5fd: 0x0040, 0x5fe: 0x0040, 0x5ff: 0x0040, - // Block 0x18, offset 0x600 - 0x600: 0x0040, 0x601: 0x3308, 0x602: 0x3308, 0x603: 0x3008, 0x604: 0x0040, 0x605: 0x0008, - 0x606: 0x0008, 0x607: 0x0008, 0x608: 0x0008, 0x609: 0x0008, 0x60a: 0x0008, 0x60b: 0x0040, - 0x60c: 0x0040, 0x60d: 0x0040, 0x60e: 0x0040, 0x60f: 0x0008, 0x610: 0x0008, 0x611: 0x0040, - 0x612: 0x0040, 0x613: 0x0008, 0x614: 0x0008, 0x615: 0x0008, 0x616: 0x0008, 0x617: 0x0008, - 0x618: 0x0008, 0x619: 0x0008, 0x61a: 0x0008, 0x61b: 0x0008, 0x61c: 0x0008, 0x61d: 0x0008, - 0x61e: 0x0008, 0x61f: 0x0008, 0x620: 0x0008, 0x621: 0x0008, 0x622: 0x0008, 0x623: 0x0008, - 0x624: 0x0008, 0x625: 0x0008, 0x626: 0x0008, 0x627: 0x0008, 0x628: 0x0008, 0x629: 0x0040, - 0x62a: 0x0008, 0x62b: 0x0008, 0x62c: 0x0008, 0x62d: 0x0008, 0x62e: 0x0008, 0x62f: 0x0008, - 0x630: 0x0008, 0x631: 0x0040, 0x632: 0x0008, 0x633: 0x0731, 0x634: 0x0040, 0x635: 0x0008, - 0x636: 0x0769, 0x637: 0x0040, 0x638: 0x0008, 0x639: 0x0008, 0x63a: 0x0040, 0x63b: 0x0040, - 0x63c: 0x3308, 0x63d: 0x0040, 0x63e: 0x3008, 0x63f: 0x3008, - // Block 0x19, offset 0x640 - 0x640: 0x3008, 0x641: 0x3308, 0x642: 0x3308, 0x643: 0x0040, 0x644: 0x0040, 0x645: 0x0040, - 0x646: 0x0040, 0x647: 0x3308, 0x648: 0x3308, 0x649: 0x0040, 0x64a: 0x0040, 0x64b: 0x3308, - 0x64c: 0x3308, 0x64d: 0x3b08, 0x64e: 0x0040, 0x64f: 0x0040, 0x650: 0x0040, 0x651: 0x3308, - 0x652: 0x0040, 0x653: 0x0040, 0x654: 0x0040, 0x655: 0x0040, 0x656: 0x0040, 0x657: 0x0040, - 0x658: 0x0040, 0x659: 0x07a1, 0x65a: 0x07d9, 0x65b: 0x0811, 0x65c: 0x0008, 0x65d: 0x0040, - 0x65e: 0x0849, 0x65f: 0x0040, 0x660: 0x0040, 0x661: 0x0040, 0x662: 0x0040, 0x663: 0x0040, - 0x664: 0x0040, 0x665: 0x0040, 0x666: 0x0008, 0x667: 0x0008, 0x668: 0x0008, 0x669: 0x0008, - 0x66a: 0x0008, 0x66b: 0x0008, 0x66c: 0x0008, 0x66d: 0x0008, 0x66e: 0x0008, 0x66f: 0x0008, - 0x670: 0x3308, 0x671: 0x3308, 0x672: 0x0008, 0x673: 0x0008, 0x674: 0x0008, 0x675: 0x3308, - 0x676: 0x0040, 0x677: 0x0040, 0x678: 0x0040, 0x679: 0x0040, 0x67a: 0x0040, 0x67b: 0x0040, - 0x67c: 0x0040, 0x67d: 0x0040, 0x67e: 0x0040, 0x67f: 0x0040, - // Block 0x1a, offset 0x680 - 0x680: 0x0040, 0x681: 0x3308, 0x682: 0x3308, 0x683: 0x3008, 0x684: 0x0040, 0x685: 0x0008, - 0x686: 0x0008, 0x687: 0x0008, 0x688: 0x0008, 0x689: 0x0008, 0x68a: 0x0008, 0x68b: 0x0008, - 0x68c: 0x0008, 0x68d: 0x0008, 0x68e: 0x0040, 0x68f: 0x0008, 0x690: 0x0008, 0x691: 0x0008, - 0x692: 0x0040, 0x693: 0x0008, 0x694: 0x0008, 0x695: 0x0008, 0x696: 0x0008, 0x697: 0x0008, - 0x698: 0x0008, 0x699: 0x0008, 0x69a: 0x0008, 0x69b: 0x0008, 0x69c: 0x0008, 0x69d: 0x0008, - 0x69e: 0x0008, 0x69f: 0x0008, 0x6a0: 0x0008, 0x6a1: 0x0008, 0x6a2: 0x0008, 0x6a3: 0x0008, - 0x6a4: 0x0008, 0x6a5: 0x0008, 0x6a6: 0x0008, 0x6a7: 0x0008, 0x6a8: 0x0008, 0x6a9: 0x0040, - 0x6aa: 0x0008, 0x6ab: 0x0008, 0x6ac: 0x0008, 0x6ad: 0x0008, 0x6ae: 0x0008, 0x6af: 0x0008, - 0x6b0: 0x0008, 0x6b1: 0x0040, 0x6b2: 0x0008, 0x6b3: 0x0008, 0x6b4: 0x0040, 0x6b5: 0x0008, - 0x6b6: 0x0008, 0x6b7: 0x0008, 0x6b8: 0x0008, 0x6b9: 0x0008, 0x6ba: 0x0040, 0x6bb: 0x0040, - 0x6bc: 0x3308, 0x6bd: 0x0008, 0x6be: 0x3008, 0x6bf: 0x3008, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x3008, 0x6c1: 0x3308, 0x6c2: 0x3308, 0x6c3: 0x3308, 0x6c4: 0x3308, 0x6c5: 0x3308, - 0x6c6: 0x0040, 0x6c7: 0x3308, 0x6c8: 0x3308, 0x6c9: 0x3008, 0x6ca: 0x0040, 0x6cb: 0x3008, - 0x6cc: 0x3008, 0x6cd: 0x3b08, 0x6ce: 0x0040, 0x6cf: 0x0040, 0x6d0: 0x0008, 0x6d1: 0x0040, - 0x6d2: 0x0040, 0x6d3: 0x0040, 0x6d4: 0x0040, 0x6d5: 0x0040, 0x6d6: 0x0040, 0x6d7: 0x0040, - 0x6d8: 0x0040, 0x6d9: 0x0040, 0x6da: 0x0040, 0x6db: 0x0040, 0x6dc: 0x0040, 0x6dd: 0x0040, - 0x6de: 0x0040, 0x6df: 0x0040, 0x6e0: 0x0008, 0x6e1: 0x0008, 0x6e2: 0x3308, 0x6e3: 0x3308, - 0x6e4: 0x0040, 0x6e5: 0x0040, 0x6e6: 0x0008, 0x6e7: 0x0008, 0x6e8: 0x0008, 0x6e9: 0x0008, - 0x6ea: 0x0008, 0x6eb: 0x0008, 0x6ec: 0x0008, 0x6ed: 0x0008, 0x6ee: 0x0008, 0x6ef: 0x0008, - 0x6f0: 0x0018, 0x6f1: 0x0018, 0x6f2: 0x0040, 0x6f3: 0x0040, 0x6f4: 0x0040, 0x6f5: 0x0040, - 0x6f6: 0x0040, 0x6f7: 0x0040, 0x6f8: 0x0040, 0x6f9: 0x0008, 0x6fa: 0x0040, 0x6fb: 0x0040, - 0x6fc: 0x0040, 0x6fd: 0x0040, 0x6fe: 0x0040, 0x6ff: 0x0040, - // Block 0x1c, offset 0x700 - 0x700: 0x0040, 0x701: 0x3308, 0x702: 0x3008, 0x703: 0x3008, 0x704: 0x0040, 0x705: 0x0008, - 0x706: 0x0008, 0x707: 0x0008, 0x708: 0x0008, 0x709: 0x0008, 0x70a: 0x0008, 0x70b: 0x0008, - 0x70c: 0x0008, 0x70d: 0x0040, 0x70e: 0x0040, 0x70f: 0x0008, 0x710: 0x0008, 0x711: 0x0040, - 0x712: 0x0040, 0x713: 0x0008, 0x714: 0x0008, 0x715: 0x0008, 0x716: 0x0008, 0x717: 0x0008, - 0x718: 0x0008, 0x719: 0x0008, 0x71a: 0x0008, 0x71b: 0x0008, 0x71c: 0x0008, 0x71d: 0x0008, - 0x71e: 0x0008, 0x71f: 0x0008, 0x720: 0x0008, 0x721: 0x0008, 0x722: 0x0008, 0x723: 0x0008, - 0x724: 0x0008, 0x725: 0x0008, 0x726: 0x0008, 0x727: 0x0008, 0x728: 0x0008, 0x729: 0x0040, - 0x72a: 0x0008, 0x72b: 0x0008, 0x72c: 0x0008, 0x72d: 0x0008, 0x72e: 0x0008, 0x72f: 0x0008, - 0x730: 0x0008, 0x731: 0x0040, 0x732: 0x0008, 0x733: 0x0008, 0x734: 0x0040, 0x735: 0x0008, - 0x736: 0x0008, 0x737: 0x0008, 0x738: 0x0008, 0x739: 0x0008, 0x73a: 0x0040, 0x73b: 0x0040, - 0x73c: 0x3308, 0x73d: 0x0008, 0x73e: 0x3008, 0x73f: 0x3308, - // Block 0x1d, offset 0x740 - 0x740: 0x3008, 0x741: 0x3308, 0x742: 0x3308, 0x743: 0x3308, 0x744: 0x3308, 0x745: 0x0040, - 0x746: 0x0040, 0x747: 0x3008, 0x748: 0x3008, 0x749: 0x0040, 0x74a: 0x0040, 0x74b: 0x3008, - 0x74c: 0x3008, 0x74d: 0x3b08, 0x74e: 0x0040, 0x74f: 0x0040, 0x750: 0x0040, 0x751: 0x0040, - 0x752: 0x0040, 0x753: 0x0040, 0x754: 0x0040, 0x755: 0x0040, 0x756: 0x3308, 0x757: 0x3008, - 0x758: 0x0040, 0x759: 0x0040, 0x75a: 0x0040, 0x75b: 0x0040, 0x75c: 0x0881, 0x75d: 0x08b9, - 0x75e: 0x0040, 0x75f: 0x0008, 0x760: 0x0008, 0x761: 0x0008, 0x762: 0x3308, 0x763: 0x3308, - 0x764: 0x0040, 0x765: 0x0040, 0x766: 0x0008, 0x767: 0x0008, 0x768: 0x0008, 0x769: 0x0008, - 0x76a: 0x0008, 0x76b: 0x0008, 0x76c: 0x0008, 0x76d: 0x0008, 0x76e: 0x0008, 0x76f: 0x0008, - 0x770: 0x0018, 0x771: 0x0008, 0x772: 0x0018, 0x773: 0x0018, 0x774: 0x0018, 0x775: 0x0018, - 0x776: 0x0018, 0x777: 0x0018, 0x778: 0x0040, 0x779: 0x0040, 0x77a: 0x0040, 0x77b: 0x0040, - 0x77c: 0x0040, 0x77d: 0x0040, 0x77e: 0x0040, 0x77f: 0x0040, - // Block 0x1e, offset 0x780 - 0x780: 0x0040, 0x781: 0x0040, 0x782: 0x3308, 0x783: 0x0008, 0x784: 0x0040, 0x785: 0x0008, - 0x786: 0x0008, 0x787: 0x0008, 0x788: 0x0008, 0x789: 0x0008, 0x78a: 0x0008, 0x78b: 0x0040, - 0x78c: 0x0040, 0x78d: 0x0040, 0x78e: 0x0008, 0x78f: 0x0008, 0x790: 0x0008, 0x791: 0x0040, - 0x792: 0x0008, 0x793: 0x0008, 0x794: 0x0008, 0x795: 0x0008, 0x796: 0x0040, 0x797: 0x0040, - 0x798: 0x0040, 0x799: 0x0008, 0x79a: 0x0008, 0x79b: 0x0040, 0x79c: 0x0008, 0x79d: 0x0040, - 0x79e: 0x0008, 0x79f: 0x0008, 0x7a0: 0x0040, 0x7a1: 0x0040, 0x7a2: 0x0040, 0x7a3: 0x0008, - 0x7a4: 0x0008, 0x7a5: 0x0040, 0x7a6: 0x0040, 0x7a7: 0x0040, 0x7a8: 0x0008, 0x7a9: 0x0008, - 0x7aa: 0x0008, 0x7ab: 0x0040, 0x7ac: 0x0040, 0x7ad: 0x0040, 0x7ae: 0x0008, 0x7af: 0x0008, - 0x7b0: 0x0008, 0x7b1: 0x0008, 0x7b2: 0x0008, 0x7b3: 0x0008, 0x7b4: 0x0008, 0x7b5: 0x0008, - 0x7b6: 0x0008, 0x7b7: 0x0008, 0x7b8: 0x0008, 0x7b9: 0x0008, 0x7ba: 0x0040, 0x7bb: 0x0040, - 0x7bc: 0x0040, 0x7bd: 0x0040, 0x7be: 0x3008, 0x7bf: 0x3008, - // Block 0x1f, offset 0x7c0 - 0x7c0: 0x3308, 0x7c1: 0x3008, 0x7c2: 0x3008, 0x7c3: 0x3008, 0x7c4: 0x3008, 0x7c5: 0x0040, - 0x7c6: 0x3308, 0x7c7: 0x3308, 0x7c8: 0x3308, 0x7c9: 0x0040, 0x7ca: 0x3308, 0x7cb: 0x3308, - 0x7cc: 0x3308, 0x7cd: 0x3b08, 0x7ce: 0x0040, 0x7cf: 0x0040, 0x7d0: 0x0040, 0x7d1: 0x0040, - 0x7d2: 0x0040, 0x7d3: 0x0040, 0x7d4: 0x0040, 0x7d5: 0x3308, 0x7d6: 0x3308, 0x7d7: 0x0040, - 0x7d8: 0x0008, 0x7d9: 0x0008, 0x7da: 0x0008, 0x7db: 0x0040, 0x7dc: 0x0040, 0x7dd: 0x0040, - 0x7de: 0x0040, 0x7df: 0x0040, 0x7e0: 0x0008, 0x7e1: 0x0008, 0x7e2: 0x3308, 0x7e3: 0x3308, - 0x7e4: 0x0040, 0x7e5: 0x0040, 0x7e6: 0x0008, 0x7e7: 0x0008, 0x7e8: 0x0008, 0x7e9: 0x0008, - 0x7ea: 0x0008, 0x7eb: 0x0008, 0x7ec: 0x0008, 0x7ed: 0x0008, 0x7ee: 0x0008, 0x7ef: 0x0008, - 0x7f0: 0x0040, 0x7f1: 0x0040, 0x7f2: 0x0040, 0x7f3: 0x0040, 0x7f4: 0x0040, 0x7f5: 0x0040, - 0x7f6: 0x0040, 0x7f7: 0x0040, 0x7f8: 0x0018, 0x7f9: 0x0018, 0x7fa: 0x0018, 0x7fb: 0x0018, - 0x7fc: 0x0018, 0x7fd: 0x0018, 0x7fe: 0x0018, 0x7ff: 0x0018, - // Block 0x20, offset 0x800 - 0x800: 0x0008, 0x801: 0x3308, 0x802: 0x3008, 0x803: 0x3008, 0x804: 0x0040, 0x805: 0x0008, - 0x806: 0x0008, 0x807: 0x0008, 0x808: 0x0008, 0x809: 0x0008, 0x80a: 0x0008, 0x80b: 0x0008, - 0x80c: 0x0008, 0x80d: 0x0040, 0x80e: 0x0008, 0x80f: 0x0008, 0x810: 0x0008, 0x811: 0x0040, - 0x812: 0x0008, 0x813: 0x0008, 0x814: 0x0008, 0x815: 0x0008, 0x816: 0x0008, 0x817: 0x0008, - 0x818: 0x0008, 0x819: 0x0008, 0x81a: 0x0008, 0x81b: 0x0008, 0x81c: 0x0008, 0x81d: 0x0008, - 0x81e: 0x0008, 0x81f: 0x0008, 0x820: 0x0008, 0x821: 0x0008, 0x822: 0x0008, 0x823: 0x0008, - 0x824: 0x0008, 0x825: 0x0008, 0x826: 0x0008, 0x827: 0x0008, 0x828: 0x0008, 0x829: 0x0040, - 0x82a: 0x0008, 0x82b: 0x0008, 0x82c: 0x0008, 0x82d: 0x0008, 0x82e: 0x0008, 0x82f: 0x0008, - 0x830: 0x0008, 0x831: 0x0008, 0x832: 0x0008, 0x833: 0x0008, 0x834: 0x0040, 0x835: 0x0008, - 0x836: 0x0008, 0x837: 0x0008, 0x838: 0x0008, 0x839: 0x0008, 0x83a: 0x0040, 0x83b: 0x0040, - 0x83c: 0x3308, 0x83d: 0x0008, 0x83e: 0x3008, 0x83f: 0x3308, - // Block 0x21, offset 0x840 - 0x840: 0x3008, 0x841: 0x3008, 0x842: 0x3008, 0x843: 0x3008, 0x844: 0x3008, 0x845: 0x0040, - 0x846: 0x3308, 0x847: 0x3008, 0x848: 0x3008, 0x849: 0x0040, 0x84a: 0x3008, 0x84b: 0x3008, - 0x84c: 0x3308, 0x84d: 0x3b08, 0x84e: 0x0040, 0x84f: 0x0040, 0x850: 0x0040, 0x851: 0x0040, - 0x852: 0x0040, 0x853: 0x0040, 0x854: 0x0040, 0x855: 0x3008, 0x856: 0x3008, 0x857: 0x0040, - 0x858: 0x0040, 0x859: 0x0040, 0x85a: 0x0040, 0x85b: 0x0040, 0x85c: 0x0040, 0x85d: 0x0040, - 0x85e: 0x0008, 0x85f: 0x0040, 0x860: 0x0008, 0x861: 0x0008, 0x862: 0x3308, 0x863: 0x3308, - 0x864: 0x0040, 0x865: 0x0040, 0x866: 0x0008, 0x867: 0x0008, 0x868: 0x0008, 0x869: 0x0008, - 0x86a: 0x0008, 0x86b: 0x0008, 0x86c: 0x0008, 0x86d: 0x0008, 0x86e: 0x0008, 0x86f: 0x0008, - 0x870: 0x0040, 0x871: 0x0008, 0x872: 0x0008, 0x873: 0x0040, 0x874: 0x0040, 0x875: 0x0040, - 0x876: 0x0040, 0x877: 0x0040, 0x878: 0x0040, 0x879: 0x0040, 0x87a: 0x0040, 0x87b: 0x0040, - 0x87c: 0x0040, 0x87d: 0x0040, 0x87e: 0x0040, 0x87f: 0x0040, - // Block 0x22, offset 0x880 - 0x880: 0x3008, 0x881: 0x3308, 0x882: 0x3308, 0x883: 0x3308, 0x884: 0x3308, 0x885: 0x0040, - 0x886: 0x3008, 0x887: 0x3008, 0x888: 0x3008, 0x889: 0x0040, 0x88a: 0x3008, 0x88b: 0x3008, - 0x88c: 0x3008, 0x88d: 0x3b08, 0x88e: 0x0008, 0x88f: 0x0018, 0x890: 0x0040, 0x891: 0x0040, - 0x892: 0x0040, 0x893: 0x0040, 0x894: 0x0008, 0x895: 0x0008, 0x896: 0x0008, 0x897: 0x3008, - 0x898: 0x0018, 0x899: 0x0018, 0x89a: 0x0018, 0x89b: 0x0018, 0x89c: 0x0018, 0x89d: 0x0018, - 0x89e: 0x0018, 0x89f: 0x0008, 0x8a0: 0x0008, 0x8a1: 0x0008, 0x8a2: 0x3308, 0x8a3: 0x3308, - 0x8a4: 0x0040, 0x8a5: 0x0040, 0x8a6: 0x0008, 0x8a7: 0x0008, 0x8a8: 0x0008, 0x8a9: 0x0008, - 0x8aa: 0x0008, 0x8ab: 0x0008, 0x8ac: 0x0008, 0x8ad: 0x0008, 0x8ae: 0x0008, 0x8af: 0x0008, - 0x8b0: 0x0018, 0x8b1: 0x0018, 0x8b2: 0x0018, 0x8b3: 0x0018, 0x8b4: 0x0018, 0x8b5: 0x0018, - 0x8b6: 0x0018, 0x8b7: 0x0018, 0x8b8: 0x0018, 0x8b9: 0x0018, 0x8ba: 0x0008, 0x8bb: 0x0008, - 0x8bc: 0x0008, 0x8bd: 0x0008, 0x8be: 0x0008, 0x8bf: 0x0008, - // Block 0x23, offset 0x8c0 - 0x8c0: 0x0040, 0x8c1: 0x0008, 0x8c2: 0x0008, 0x8c3: 0x0040, 0x8c4: 0x0008, 0x8c5: 0x0040, - 0x8c6: 0x0040, 0x8c7: 0x0008, 0x8c8: 0x0008, 0x8c9: 0x0040, 0x8ca: 0x0008, 0x8cb: 0x0040, - 0x8cc: 0x0040, 0x8cd: 0x0008, 0x8ce: 0x0040, 0x8cf: 0x0040, 0x8d0: 0x0040, 0x8d1: 0x0040, - 0x8d2: 0x0040, 0x8d3: 0x0040, 0x8d4: 0x0008, 0x8d5: 0x0008, 0x8d6: 0x0008, 0x8d7: 0x0008, - 0x8d8: 0x0040, 0x8d9: 0x0008, 0x8da: 0x0008, 0x8db: 0x0008, 0x8dc: 0x0008, 0x8dd: 0x0008, - 0x8de: 0x0008, 0x8df: 0x0008, 0x8e0: 0x0040, 0x8e1: 0x0008, 0x8e2: 0x0008, 0x8e3: 0x0008, - 0x8e4: 0x0040, 0x8e5: 0x0008, 0x8e6: 0x0040, 0x8e7: 0x0008, 0x8e8: 0x0040, 0x8e9: 0x0040, - 0x8ea: 0x0008, 0x8eb: 0x0008, 0x8ec: 0x0040, 0x8ed: 0x0008, 0x8ee: 0x0008, 0x8ef: 0x0008, - 0x8f0: 0x0008, 0x8f1: 0x3308, 0x8f2: 0x0008, 0x8f3: 0x0929, 0x8f4: 0x3308, 0x8f5: 0x3308, - 0x8f6: 0x3308, 0x8f7: 0x3308, 0x8f8: 0x3308, 0x8f9: 0x3308, 0x8fa: 0x0040, 0x8fb: 0x3308, - 0x8fc: 0x3308, 0x8fd: 0x0008, 0x8fe: 0x0040, 0x8ff: 0x0040, - // Block 0x24, offset 0x900 - 0x900: 0x0008, 0x901: 0x0008, 0x902: 0x0008, 0x903: 0x09d1, 0x904: 0x0008, 0x905: 0x0008, - 0x906: 0x0008, 0x907: 0x0008, 0x908: 0x0040, 0x909: 0x0008, 0x90a: 0x0008, 0x90b: 0x0008, - 0x90c: 0x0008, 0x90d: 0x0a09, 0x90e: 0x0008, 0x90f: 0x0008, 0x910: 0x0008, 0x911: 0x0008, - 0x912: 0x0a41, 0x913: 0x0008, 0x914: 0x0008, 0x915: 0x0008, 0x916: 0x0008, 0x917: 0x0a79, - 0x918: 0x0008, 0x919: 0x0008, 0x91a: 0x0008, 0x91b: 0x0008, 0x91c: 0x0ab1, 0x91d: 0x0008, - 0x91e: 0x0008, 0x91f: 0x0008, 0x920: 0x0008, 0x921: 0x0008, 0x922: 0x0008, 0x923: 0x0008, - 0x924: 0x0008, 0x925: 0x0008, 0x926: 0x0008, 0x927: 0x0008, 0x928: 0x0008, 0x929: 0x0ae9, - 0x92a: 0x0008, 0x92b: 0x0008, 0x92c: 0x0008, 0x92d: 0x0040, 0x92e: 0x0040, 0x92f: 0x0040, - 0x930: 0x0040, 0x931: 0x3308, 0x932: 0x3308, 0x933: 0x0b21, 0x934: 0x3308, 0x935: 0x0b59, - 0x936: 0x0b91, 0x937: 0x0bc9, 0x938: 0x0c19, 0x939: 0x0c51, 0x93a: 0x3308, 0x93b: 0x3308, - 0x93c: 0x3308, 0x93d: 0x3308, 0x93e: 0x3308, 0x93f: 0x3008, - // Block 0x25, offset 0x940 - 0x940: 0x3308, 0x941: 0x0ca1, 0x942: 0x3308, 0x943: 0x3308, 0x944: 0x3b08, 0x945: 0x0018, - 0x946: 0x3308, 0x947: 0x3308, 0x948: 0x0008, 0x949: 0x0008, 0x94a: 0x0008, 0x94b: 0x0008, - 0x94c: 0x0008, 0x94d: 0x3308, 0x94e: 0x3308, 0x94f: 0x3308, 0x950: 0x3308, 0x951: 0x3308, - 0x952: 0x3308, 0x953: 0x0cd9, 0x954: 0x3308, 0x955: 0x3308, 0x956: 0x3308, 0x957: 0x3308, - 0x958: 0x0040, 0x959: 0x3308, 0x95a: 0x3308, 0x95b: 0x3308, 0x95c: 0x3308, 0x95d: 0x0d11, - 0x95e: 0x3308, 0x95f: 0x3308, 0x960: 0x3308, 0x961: 0x3308, 0x962: 0x0d49, 0x963: 0x3308, - 0x964: 0x3308, 0x965: 0x3308, 0x966: 0x3308, 0x967: 0x0d81, 0x968: 0x3308, 0x969: 0x3308, - 0x96a: 0x3308, 0x96b: 0x3308, 0x96c: 0x0db9, 0x96d: 0x3308, 0x96e: 0x3308, 0x96f: 0x3308, - 0x970: 0x3308, 0x971: 0x3308, 0x972: 0x3308, 0x973: 0x3308, 0x974: 0x3308, 0x975: 0x3308, - 0x976: 0x3308, 0x977: 0x3308, 0x978: 0x3308, 0x979: 0x0df1, 0x97a: 0x3308, 0x97b: 0x3308, - 0x97c: 0x3308, 0x97d: 0x0040, 0x97e: 0x0018, 0x97f: 0x0018, - // Block 0x26, offset 0x980 - 0x980: 0x0008, 0x981: 0x0008, 0x982: 0x0008, 0x983: 0x0008, 0x984: 0x0008, 0x985: 0x0008, - 0x986: 0x0008, 0x987: 0x0008, 0x988: 0x0008, 0x989: 0x0008, 0x98a: 0x0008, 0x98b: 0x0008, - 0x98c: 0x0008, 0x98d: 0x0008, 0x98e: 0x0008, 0x98f: 0x0008, 0x990: 0x0008, 0x991: 0x0008, - 0x992: 0x0008, 0x993: 0x0008, 0x994: 0x0008, 0x995: 0x0008, 0x996: 0x0008, 0x997: 0x0008, - 0x998: 0x0008, 0x999: 0x0008, 0x99a: 0x0008, 0x99b: 0x0008, 0x99c: 0x0008, 0x99d: 0x0008, - 0x99e: 0x0008, 0x99f: 0x0008, 0x9a0: 0x0008, 0x9a1: 0x0008, 0x9a2: 0x0008, 0x9a3: 0x0008, - 0x9a4: 0x0008, 0x9a5: 0x0008, 0x9a6: 0x0008, 0x9a7: 0x0008, 0x9a8: 0x0008, 0x9a9: 0x0008, - 0x9aa: 0x0008, 0x9ab: 0x0008, 0x9ac: 0x0039, 0x9ad: 0x0ed1, 0x9ae: 0x0ee9, 0x9af: 0x0008, - 0x9b0: 0x0ef9, 0x9b1: 0x0f09, 0x9b2: 0x0f19, 0x9b3: 0x0f31, 0x9b4: 0x0249, 0x9b5: 0x0f41, - 0x9b6: 0x0259, 0x9b7: 0x0f51, 0x9b8: 0x0359, 0x9b9: 0x0f61, 0x9ba: 0x0f71, 0x9bb: 0x0008, - 0x9bc: 0x00d9, 0x9bd: 0x0f81, 0x9be: 0x0f99, 0x9bf: 0x0269, - // Block 0x27, offset 0x9c0 - 0x9c0: 0x0fa9, 0x9c1: 0x0fb9, 0x9c2: 0x0279, 0x9c3: 0x0039, 0x9c4: 0x0fc9, 0x9c5: 0x0fe1, - 0x9c6: 0x059d, 0x9c7: 0x0ee9, 0x9c8: 0x0ef9, 0x9c9: 0x0f09, 0x9ca: 0x0ff9, 0x9cb: 0x1011, - 0x9cc: 0x1029, 0x9cd: 0x0f31, 0x9ce: 0x0008, 0x9cf: 0x0f51, 0x9d0: 0x0f61, 0x9d1: 0x1041, - 0x9d2: 0x00d9, 0x9d3: 0x1059, 0x9d4: 0x05b5, 0x9d5: 0x05b5, 0x9d6: 0x0f99, 0x9d7: 0x0fa9, - 0x9d8: 0x0fb9, 0x9d9: 0x059d, 0x9da: 0x1071, 0x9db: 0x1089, 0x9dc: 0x05cd, 0x9dd: 0x1099, - 0x9de: 0x10b1, 0x9df: 0x10c9, 0x9e0: 0x10e1, 0x9e1: 0x10f9, 0x9e2: 0x0f41, 0x9e3: 0x0269, - 0x9e4: 0x0fb9, 0x9e5: 0x1089, 0x9e6: 0x1099, 0x9e7: 0x10b1, 0x9e8: 0x1111, 0x9e9: 0x10e1, - 0x9ea: 0x10f9, 0x9eb: 0x0008, 0x9ec: 0x0008, 0x9ed: 0x0008, 0x9ee: 0x0008, 0x9ef: 0x0008, - 0x9f0: 0x0008, 0x9f1: 0x0008, 0x9f2: 0x0008, 0x9f3: 0x0008, 0x9f4: 0x0008, 0x9f5: 0x0008, - 0x9f6: 0x0008, 0x9f7: 0x0008, 0x9f8: 0x1129, 0x9f9: 0x0008, 0x9fa: 0x0008, 0x9fb: 0x0008, - 0x9fc: 0x0008, 0x9fd: 0x0008, 0x9fe: 0x0008, 0x9ff: 0x0008, - // Block 0x28, offset 0xa00 - 0xa00: 0x0008, 0xa01: 0x0008, 0xa02: 0x0008, 0xa03: 0x0008, 0xa04: 0x0008, 0xa05: 0x0008, - 0xa06: 0x0008, 0xa07: 0x0008, 0xa08: 0x0008, 0xa09: 0x0008, 0xa0a: 0x0008, 0xa0b: 0x0008, - 0xa0c: 0x0008, 0xa0d: 0x0008, 0xa0e: 0x0008, 0xa0f: 0x0008, 0xa10: 0x0008, 0xa11: 0x0008, - 0xa12: 0x0008, 0xa13: 0x0008, 0xa14: 0x0008, 0xa15: 0x0008, 0xa16: 0x0008, 0xa17: 0x0008, - 0xa18: 0x0008, 0xa19: 0x0008, 0xa1a: 0x0008, 0xa1b: 0x1141, 0xa1c: 0x1159, 0xa1d: 0x1169, - 0xa1e: 0x1181, 0xa1f: 0x1029, 0xa20: 0x1199, 0xa21: 0x11a9, 0xa22: 0x11c1, 0xa23: 0x11d9, - 0xa24: 0x11f1, 0xa25: 0x1209, 0xa26: 0x1221, 0xa27: 0x05e5, 0xa28: 0x1239, 0xa29: 0x1251, - 0xa2a: 0xe17d, 0xa2b: 0x1269, 0xa2c: 0x1281, 0xa2d: 0x1299, 0xa2e: 0x12b1, 0xa2f: 0x12c9, - 0xa30: 0x12e1, 0xa31: 0x12f9, 0xa32: 0x1311, 0xa33: 0x1329, 0xa34: 0x1341, 0xa35: 0x1359, - 0xa36: 0x1371, 0xa37: 0x1389, 0xa38: 0x05fd, 0xa39: 0x13a1, 0xa3a: 0x13b9, 0xa3b: 0x13d1, - 0xa3c: 0x13e1, 0xa3d: 0x13f9, 0xa3e: 0x1411, 0xa3f: 0x1429, - // Block 0x29, offset 0xa40 - 0xa40: 0xe00d, 0xa41: 0x0008, 0xa42: 0xe00d, 0xa43: 0x0008, 0xa44: 0xe00d, 0xa45: 0x0008, - 0xa46: 0xe00d, 0xa47: 0x0008, 0xa48: 0xe00d, 0xa49: 0x0008, 0xa4a: 0xe00d, 0xa4b: 0x0008, - 0xa4c: 0xe00d, 0xa4d: 0x0008, 0xa4e: 0xe00d, 0xa4f: 0x0008, 0xa50: 0xe00d, 0xa51: 0x0008, - 0xa52: 0xe00d, 0xa53: 0x0008, 0xa54: 0xe00d, 0xa55: 0x0008, 0xa56: 0xe00d, 0xa57: 0x0008, - 0xa58: 0xe00d, 0xa59: 0x0008, 0xa5a: 0xe00d, 0xa5b: 0x0008, 0xa5c: 0xe00d, 0xa5d: 0x0008, - 0xa5e: 0xe00d, 0xa5f: 0x0008, 0xa60: 0xe00d, 0xa61: 0x0008, 0xa62: 0xe00d, 0xa63: 0x0008, - 0xa64: 0xe00d, 0xa65: 0x0008, 0xa66: 0xe00d, 0xa67: 0x0008, 0xa68: 0xe00d, 0xa69: 0x0008, - 0xa6a: 0xe00d, 0xa6b: 0x0008, 0xa6c: 0xe00d, 0xa6d: 0x0008, 0xa6e: 0xe00d, 0xa6f: 0x0008, - 0xa70: 0xe00d, 0xa71: 0x0008, 0xa72: 0xe00d, 0xa73: 0x0008, 0xa74: 0xe00d, 0xa75: 0x0008, - 0xa76: 0xe00d, 0xa77: 0x0008, 0xa78: 0xe00d, 0xa79: 0x0008, 0xa7a: 0xe00d, 0xa7b: 0x0008, - 0xa7c: 0xe00d, 0xa7d: 0x0008, 0xa7e: 0xe00d, 0xa7f: 0x0008, - // Block 0x2a, offset 0xa80 - 0xa80: 0xe00d, 0xa81: 0x0008, 0xa82: 0xe00d, 0xa83: 0x0008, 0xa84: 0xe00d, 0xa85: 0x0008, - 0xa86: 0xe00d, 0xa87: 0x0008, 0xa88: 0xe00d, 0xa89: 0x0008, 0xa8a: 0xe00d, 0xa8b: 0x0008, - 0xa8c: 0xe00d, 0xa8d: 0x0008, 0xa8e: 0xe00d, 0xa8f: 0x0008, 0xa90: 0xe00d, 0xa91: 0x0008, - 0xa92: 0xe00d, 0xa93: 0x0008, 0xa94: 0xe00d, 0xa95: 0x0008, 0xa96: 0x0008, 0xa97: 0x0008, - 0xa98: 0x0008, 0xa99: 0x0008, 0xa9a: 0x0615, 0xa9b: 0x0635, 0xa9c: 0x0008, 0xa9d: 0x0008, - 0xa9e: 0x1441, 0xa9f: 0x0008, 0xaa0: 0xe00d, 0xaa1: 0x0008, 0xaa2: 0xe00d, 0xaa3: 0x0008, - 0xaa4: 0xe00d, 0xaa5: 0x0008, 0xaa6: 0xe00d, 0xaa7: 0x0008, 0xaa8: 0xe00d, 0xaa9: 0x0008, - 0xaaa: 0xe00d, 0xaab: 0x0008, 0xaac: 0xe00d, 0xaad: 0x0008, 0xaae: 0xe00d, 0xaaf: 0x0008, - 0xab0: 0xe00d, 0xab1: 0x0008, 0xab2: 0xe00d, 0xab3: 0x0008, 0xab4: 0xe00d, 0xab5: 0x0008, - 0xab6: 0xe00d, 0xab7: 0x0008, 0xab8: 0xe00d, 0xab9: 0x0008, 0xaba: 0xe00d, 0xabb: 0x0008, - 0xabc: 0xe00d, 0xabd: 0x0008, 0xabe: 0xe00d, 0xabf: 0x0008, - // Block 0x2b, offset 0xac0 - 0xac0: 0x0008, 0xac1: 0x0008, 0xac2: 0x0008, 0xac3: 0x0008, 0xac4: 0x0008, 0xac5: 0x0008, - 0xac6: 0x0040, 0xac7: 0x0040, 0xac8: 0xe045, 0xac9: 0xe045, 0xaca: 0xe045, 0xacb: 0xe045, - 0xacc: 0xe045, 0xacd: 0xe045, 0xace: 0x0040, 0xacf: 0x0040, 0xad0: 0x0008, 0xad1: 0x0008, - 0xad2: 0x0008, 0xad3: 0x0008, 0xad4: 0x0008, 0xad5: 0x0008, 0xad6: 0x0008, 0xad7: 0x0008, - 0xad8: 0x0040, 0xad9: 0xe045, 0xada: 0x0040, 0xadb: 0xe045, 0xadc: 0x0040, 0xadd: 0xe045, - 0xade: 0x0040, 0xadf: 0xe045, 0xae0: 0x0008, 0xae1: 0x0008, 0xae2: 0x0008, 0xae3: 0x0008, - 0xae4: 0x0008, 0xae5: 0x0008, 0xae6: 0x0008, 0xae7: 0x0008, 0xae8: 0xe045, 0xae9: 0xe045, - 0xaea: 0xe045, 0xaeb: 0xe045, 0xaec: 0xe045, 0xaed: 0xe045, 0xaee: 0xe045, 0xaef: 0xe045, - 0xaf0: 0x0008, 0xaf1: 0x1459, 0xaf2: 0x0008, 0xaf3: 0x1471, 0xaf4: 0x0008, 0xaf5: 0x1489, - 0xaf6: 0x0008, 0xaf7: 0x14a1, 0xaf8: 0x0008, 0xaf9: 0x14b9, 0xafa: 0x0008, 0xafb: 0x14d1, - 0xafc: 0x0008, 0xafd: 0x14e9, 0xafe: 0x0040, 0xaff: 0x0040, - // Block 0x2c, offset 0xb00 - 0xb00: 0x1501, 0xb01: 0x1531, 0xb02: 0x1561, 0xb03: 0x1591, 0xb04: 0x15c1, 0xb05: 0x15f1, - 0xb06: 0x1621, 0xb07: 0x1651, 0xb08: 0x1501, 0xb09: 0x1531, 0xb0a: 0x1561, 0xb0b: 0x1591, - 0xb0c: 0x15c1, 0xb0d: 0x15f1, 0xb0e: 0x1621, 0xb0f: 0x1651, 0xb10: 0x1681, 0xb11: 0x16b1, - 0xb12: 0x16e1, 0xb13: 0x1711, 0xb14: 0x1741, 0xb15: 0x1771, 0xb16: 0x17a1, 0xb17: 0x17d1, - 0xb18: 0x1681, 0xb19: 0x16b1, 0xb1a: 0x16e1, 0xb1b: 0x1711, 0xb1c: 0x1741, 0xb1d: 0x1771, - 0xb1e: 0x17a1, 0xb1f: 0x17d1, 0xb20: 0x1801, 0xb21: 0x1831, 0xb22: 0x1861, 0xb23: 0x1891, - 0xb24: 0x18c1, 0xb25: 0x18f1, 0xb26: 0x1921, 0xb27: 0x1951, 0xb28: 0x1801, 0xb29: 0x1831, - 0xb2a: 0x1861, 0xb2b: 0x1891, 0xb2c: 0x18c1, 0xb2d: 0x18f1, 0xb2e: 0x1921, 0xb2f: 0x1951, - 0xb30: 0x0008, 0xb31: 0x0008, 0xb32: 0x1981, 0xb33: 0x19b1, 0xb34: 0x19d9, 0xb35: 0x0040, - 0xb36: 0x0008, 0xb37: 0x1a01, 0xb38: 0xe045, 0xb39: 0xe045, 0xb3a: 0x064d, 0xb3b: 0x1459, - 0xb3c: 0x19b1, 0xb3d: 0x0666, 0xb3e: 0x1a31, 0xb3f: 0x0686, - // Block 0x2d, offset 0xb40 - 0xb40: 0x06a6, 0xb41: 0x1a4a, 0xb42: 0x1a79, 0xb43: 0x1aa9, 0xb44: 0x1ad1, 0xb45: 0x0040, - 0xb46: 0x0008, 0xb47: 0x1af9, 0xb48: 0x06c5, 0xb49: 0x1471, 0xb4a: 0x06dd, 0xb4b: 0x1489, - 0xb4c: 0x1aa9, 0xb4d: 0x1b2a, 0xb4e: 0x1b5a, 0xb4f: 0x1b8a, 0xb50: 0x0008, 0xb51: 0x0008, - 0xb52: 0x0008, 0xb53: 0x1bb9, 0xb54: 0x0040, 0xb55: 0x0040, 0xb56: 0x0008, 0xb57: 0x0008, - 0xb58: 0xe045, 0xb59: 0xe045, 0xb5a: 0x06f5, 0xb5b: 0x14a1, 0xb5c: 0x0040, 0xb5d: 0x1bd2, - 0xb5e: 0x1c02, 0xb5f: 0x1c32, 0xb60: 0x0008, 0xb61: 0x0008, 0xb62: 0x0008, 0xb63: 0x1c61, - 0xb64: 0x0008, 0xb65: 0x0008, 0xb66: 0x0008, 0xb67: 0x0008, 0xb68: 0xe045, 0xb69: 0xe045, - 0xb6a: 0x070d, 0xb6b: 0x14d1, 0xb6c: 0xe04d, 0xb6d: 0x1c7a, 0xb6e: 0x03d2, 0xb6f: 0x1caa, - 0xb70: 0x0040, 0xb71: 0x0040, 0xb72: 0x1cb9, 0xb73: 0x1ce9, 0xb74: 0x1d11, 0xb75: 0x0040, - 0xb76: 0x0008, 0xb77: 0x1d39, 0xb78: 0x0725, 0xb79: 0x14b9, 0xb7a: 0x0515, 0xb7b: 0x14e9, - 0xb7c: 0x1ce9, 0xb7d: 0x073e, 0xb7e: 0x075e, 0xb7f: 0x0040, - // Block 0x2e, offset 0xb80 - 0xb80: 0x000a, 0xb81: 0x000a, 0xb82: 0x000a, 0xb83: 0x000a, 0xb84: 0x000a, 0xb85: 0x000a, - 0xb86: 0x000a, 0xb87: 0x000a, 0xb88: 0x000a, 0xb89: 0x000a, 0xb8a: 0x000a, 0xb8b: 0x03c0, - 0xb8c: 0x0003, 0xb8d: 0x0003, 0xb8e: 0x0340, 0xb8f: 0x0b40, 0xb90: 0x0018, 0xb91: 0xe00d, - 0xb92: 0x0018, 0xb93: 0x0018, 0xb94: 0x0018, 0xb95: 0x0018, 0xb96: 0x0018, 0xb97: 0x077e, - 0xb98: 0x0018, 0xb99: 0x0018, 0xb9a: 0x0018, 0xb9b: 0x0018, 0xb9c: 0x0018, 0xb9d: 0x0018, - 0xb9e: 0x0018, 0xb9f: 0x0018, 0xba0: 0x0018, 0xba1: 0x0018, 0xba2: 0x0018, 0xba3: 0x0018, - 0xba4: 0x0040, 0xba5: 0x0040, 0xba6: 0x0040, 0xba7: 0x0018, 0xba8: 0x0040, 0xba9: 0x0040, - 0xbaa: 0x0340, 0xbab: 0x0340, 0xbac: 0x0340, 0xbad: 0x0340, 0xbae: 0x0340, 0xbaf: 0x000a, - 0xbb0: 0x0018, 0xbb1: 0x0018, 0xbb2: 0x0018, 0xbb3: 0x1d69, 0xbb4: 0x1da1, 0xbb5: 0x0018, - 0xbb6: 0x1df1, 0xbb7: 0x1e29, 0xbb8: 0x0018, 0xbb9: 0x0018, 0xbba: 0x0018, 0xbbb: 0x0018, - 0xbbc: 0x1e7a, 0xbbd: 0x0018, 0xbbe: 0x079e, 0xbbf: 0x0018, - // Block 0x2f, offset 0xbc0 - 0xbc0: 0x0018, 0xbc1: 0x0018, 0xbc2: 0x0018, 0xbc3: 0x0018, 0xbc4: 0x0018, 0xbc5: 0x0018, - 0xbc6: 0x0018, 0xbc7: 0x1e92, 0xbc8: 0x1eaa, 0xbc9: 0x1ec2, 0xbca: 0x0018, 0xbcb: 0x0018, - 0xbcc: 0x0018, 0xbcd: 0x0018, 0xbce: 0x0018, 0xbcf: 0x0018, 0xbd0: 0x0018, 0xbd1: 0x0018, - 0xbd2: 0x0018, 0xbd3: 0x0018, 0xbd4: 0x0018, 0xbd5: 0x0018, 0xbd6: 0x0018, 0xbd7: 0x1ed9, - 0xbd8: 0x0018, 0xbd9: 0x0018, 0xbda: 0x0018, 0xbdb: 0x0018, 0xbdc: 0x0018, 0xbdd: 0x0018, - 0xbde: 0x0018, 0xbdf: 0x000a, 0xbe0: 0x03c0, 0xbe1: 0x0340, 0xbe2: 0x0340, 0xbe3: 0x0340, - 0xbe4: 0x03c0, 0xbe5: 0x0040, 0xbe6: 0x0040, 0xbe7: 0x0040, 0xbe8: 0x0040, 0xbe9: 0x0040, - 0xbea: 0x0340, 0xbeb: 0x0340, 0xbec: 0x0340, 0xbed: 0x0340, 0xbee: 0x0340, 0xbef: 0x0340, - 0xbf0: 0x1f41, 0xbf1: 0x0f41, 0xbf2: 0x0040, 0xbf3: 0x0040, 0xbf4: 0x1f51, 0xbf5: 0x1f61, - 0xbf6: 0x1f71, 0xbf7: 0x1f81, 0xbf8: 0x1f91, 0xbf9: 0x1fa1, 0xbfa: 0x1fb2, 0xbfb: 0x07bd, - 0xbfc: 0x1fc2, 0xbfd: 0x1fd2, 0xbfe: 0x1fe2, 0xbff: 0x0f71, - // Block 0x30, offset 0xc00 - 0xc00: 0x1f41, 0xc01: 0x00c9, 0xc02: 0x0069, 0xc03: 0x0079, 0xc04: 0x1f51, 0xc05: 0x1f61, - 0xc06: 0x1f71, 0xc07: 0x1f81, 0xc08: 0x1f91, 0xc09: 0x1fa1, 0xc0a: 0x1fb2, 0xc0b: 0x07d5, - 0xc0c: 0x1fc2, 0xc0d: 0x1fd2, 0xc0e: 0x1fe2, 0xc0f: 0x0040, 0xc10: 0x0039, 0xc11: 0x0f09, - 0xc12: 0x00d9, 0xc13: 0x0369, 0xc14: 0x0ff9, 0xc15: 0x0249, 0xc16: 0x0f51, 0xc17: 0x0359, - 0xc18: 0x0f61, 0xc19: 0x0f71, 0xc1a: 0x0f99, 0xc1b: 0x01d9, 0xc1c: 0x0fa9, 0xc1d: 0x0040, - 0xc1e: 0x0040, 0xc1f: 0x0040, 0xc20: 0x0018, 0xc21: 0x0018, 0xc22: 0x0018, 0xc23: 0x0018, - 0xc24: 0x0018, 0xc25: 0x0018, 0xc26: 0x0018, 0xc27: 0x0018, 0xc28: 0x1ff1, 0xc29: 0x0018, - 0xc2a: 0x0018, 0xc2b: 0x0018, 0xc2c: 0x0018, 0xc2d: 0x0018, 0xc2e: 0x0018, 0xc2f: 0x0018, - 0xc30: 0x0018, 0xc31: 0x0018, 0xc32: 0x0018, 0xc33: 0x0018, 0xc34: 0x0018, 0xc35: 0x0018, - 0xc36: 0x0018, 0xc37: 0x0018, 0xc38: 0x0018, 0xc39: 0x0018, 0xc3a: 0x0018, 0xc3b: 0x0018, - 0xc3c: 0x0018, 0xc3d: 0x0018, 0xc3e: 0x0018, 0xc3f: 0x0040, - // Block 0x31, offset 0xc40 - 0xc40: 0x07ee, 0xc41: 0x080e, 0xc42: 0x1159, 0xc43: 0x082d, 0xc44: 0x0018, 0xc45: 0x084e, - 0xc46: 0x086e, 0xc47: 0x1011, 0xc48: 0x0018, 0xc49: 0x088d, 0xc4a: 0x0f31, 0xc4b: 0x0249, - 0xc4c: 0x0249, 0xc4d: 0x0249, 0xc4e: 0x0249, 0xc4f: 0x2009, 0xc50: 0x0f41, 0xc51: 0x0f41, - 0xc52: 0x0359, 0xc53: 0x0359, 0xc54: 0x0018, 0xc55: 0x0f71, 0xc56: 0x2021, 0xc57: 0x0018, - 0xc58: 0x0018, 0xc59: 0x0f99, 0xc5a: 0x2039, 0xc5b: 0x0269, 0xc5c: 0x0269, 0xc5d: 0x0269, - 0xc5e: 0x0018, 0xc5f: 0x0018, 0xc60: 0x2049, 0xc61: 0x08ad, 0xc62: 0x2061, 0xc63: 0x0018, - 0xc64: 0x13d1, 0xc65: 0x0018, 0xc66: 0x2079, 0xc67: 0x0018, 0xc68: 0x13d1, 0xc69: 0x0018, - 0xc6a: 0x0f51, 0xc6b: 0x2091, 0xc6c: 0x0ee9, 0xc6d: 0x1159, 0xc6e: 0x0018, 0xc6f: 0x0f09, - 0xc70: 0x0f09, 0xc71: 0x1199, 0xc72: 0x0040, 0xc73: 0x0f61, 0xc74: 0x00d9, 0xc75: 0x20a9, - 0xc76: 0x20c1, 0xc77: 0x20d9, 0xc78: 0x20f1, 0xc79: 0x0f41, 0xc7a: 0x0018, 0xc7b: 0x08cd, - 0xc7c: 0x2109, 0xc7d: 0x10b1, 0xc7e: 0x10b1, 0xc7f: 0x2109, - // Block 0x32, offset 0xc80 - 0xc80: 0x08ed, 0xc81: 0x0018, 0xc82: 0x0018, 0xc83: 0x0018, 0xc84: 0x0018, 0xc85: 0x0ef9, - 0xc86: 0x0ef9, 0xc87: 0x0f09, 0xc88: 0x0f41, 0xc89: 0x0259, 0xc8a: 0x0018, 0xc8b: 0x0018, - 0xc8c: 0x0018, 0xc8d: 0x0018, 0xc8e: 0x0008, 0xc8f: 0x0018, 0xc90: 0x2121, 0xc91: 0x2151, - 0xc92: 0x2181, 0xc93: 0x21b9, 0xc94: 0x21e9, 0xc95: 0x2219, 0xc96: 0x2249, 0xc97: 0x2279, - 0xc98: 0x22a9, 0xc99: 0x22d9, 0xc9a: 0x2309, 0xc9b: 0x2339, 0xc9c: 0x2369, 0xc9d: 0x2399, - 0xc9e: 0x23c9, 0xc9f: 0x23f9, 0xca0: 0x0f41, 0xca1: 0x2421, 0xca2: 0x0905, 0xca3: 0x2439, - 0xca4: 0x1089, 0xca5: 0x2451, 0xca6: 0x0925, 0xca7: 0x2469, 0xca8: 0x2491, 0xca9: 0x0369, - 0xcaa: 0x24a9, 0xcab: 0x0945, 0xcac: 0x0359, 0xcad: 0x1159, 0xcae: 0x0ef9, 0xcaf: 0x0f61, - 0xcb0: 0x0f41, 0xcb1: 0x2421, 0xcb2: 0x0965, 0xcb3: 0x2439, 0xcb4: 0x1089, 0xcb5: 0x2451, - 0xcb6: 0x0985, 0xcb7: 0x2469, 0xcb8: 0x2491, 0xcb9: 0x0369, 0xcba: 0x24a9, 0xcbb: 0x09a5, - 0xcbc: 0x0359, 0xcbd: 0x1159, 0xcbe: 0x0ef9, 0xcbf: 0x0f61, - // Block 0x33, offset 0xcc0 - 0xcc0: 0x0018, 0xcc1: 0x0018, 0xcc2: 0x0018, 0xcc3: 0x0018, 0xcc4: 0x0018, 0xcc5: 0x0018, - 0xcc6: 0x0018, 0xcc7: 0x0018, 0xcc8: 0x0018, 0xcc9: 0x0018, 0xcca: 0x0018, 0xccb: 0x0040, - 0xccc: 0x0040, 0xccd: 0x0040, 0xcce: 0x0040, 0xccf: 0x0040, 0xcd0: 0x0040, 0xcd1: 0x0040, - 0xcd2: 0x0040, 0xcd3: 0x0040, 0xcd4: 0x0040, 0xcd5: 0x0040, 0xcd6: 0x0040, 0xcd7: 0x0040, - 0xcd8: 0x0040, 0xcd9: 0x0040, 0xcda: 0x0040, 0xcdb: 0x0040, 0xcdc: 0x0040, 0xcdd: 0x0040, - 0xcde: 0x0040, 0xcdf: 0x0040, 0xce0: 0x00c9, 0xce1: 0x0069, 0xce2: 0x0079, 0xce3: 0x1f51, - 0xce4: 0x1f61, 0xce5: 0x1f71, 0xce6: 0x1f81, 0xce7: 0x1f91, 0xce8: 0x1fa1, 0xce9: 0x2601, - 0xcea: 0x2619, 0xceb: 0x2631, 0xcec: 0x2649, 0xced: 0x2661, 0xcee: 0x2679, 0xcef: 0x2691, - 0xcf0: 0x26a9, 0xcf1: 0x26c1, 0xcf2: 0x26d9, 0xcf3: 0x26f1, 0xcf4: 0x0a06, 0xcf5: 0x0a26, - 0xcf6: 0x0a46, 0xcf7: 0x0a66, 0xcf8: 0x0a86, 0xcf9: 0x0aa6, 0xcfa: 0x0ac6, 0xcfb: 0x0ae6, - 0xcfc: 0x0b06, 0xcfd: 0x270a, 0xcfe: 0x2732, 0xcff: 0x275a, - // Block 0x34, offset 0xd00 - 0xd00: 0x2782, 0xd01: 0x27aa, 0xd02: 0x27d2, 0xd03: 0x27fa, 0xd04: 0x2822, 0xd05: 0x284a, - 0xd06: 0x2872, 0xd07: 0x289a, 0xd08: 0x0040, 0xd09: 0x0040, 0xd0a: 0x0040, 0xd0b: 0x0040, - 0xd0c: 0x0040, 0xd0d: 0x0040, 0xd0e: 0x0040, 0xd0f: 0x0040, 0xd10: 0x0040, 0xd11: 0x0040, - 0xd12: 0x0040, 0xd13: 0x0040, 0xd14: 0x0040, 0xd15: 0x0040, 0xd16: 0x0040, 0xd17: 0x0040, - 0xd18: 0x0040, 0xd19: 0x0040, 0xd1a: 0x0040, 0xd1b: 0x0040, 0xd1c: 0x0b26, 0xd1d: 0x0b46, - 0xd1e: 0x0b66, 0xd1f: 0x0b86, 0xd20: 0x0ba6, 0xd21: 0x0bc6, 0xd22: 0x0be6, 0xd23: 0x0c06, - 0xd24: 0x0c26, 0xd25: 0x0c46, 0xd26: 0x0c66, 0xd27: 0x0c86, 0xd28: 0x0ca6, 0xd29: 0x0cc6, - 0xd2a: 0x0ce6, 0xd2b: 0x0d06, 0xd2c: 0x0d26, 0xd2d: 0x0d46, 0xd2e: 0x0d66, 0xd2f: 0x0d86, - 0xd30: 0x0da6, 0xd31: 0x0dc6, 0xd32: 0x0de6, 0xd33: 0x0e06, 0xd34: 0x0e26, 0xd35: 0x0e46, - 0xd36: 0x0039, 0xd37: 0x0ee9, 0xd38: 0x1159, 0xd39: 0x0ef9, 0xd3a: 0x0f09, 0xd3b: 0x1199, - 0xd3c: 0x0f31, 0xd3d: 0x0249, 0xd3e: 0x0f41, 0xd3f: 0x0259, - // Block 0x35, offset 0xd40 - 0xd40: 0x0f51, 0xd41: 0x0359, 0xd42: 0x0f61, 0xd43: 0x0f71, 0xd44: 0x00d9, 0xd45: 0x0f99, - 0xd46: 0x2039, 0xd47: 0x0269, 0xd48: 0x01d9, 0xd49: 0x0fa9, 0xd4a: 0x0fb9, 0xd4b: 0x1089, - 0xd4c: 0x0279, 0xd4d: 0x0369, 0xd4e: 0x0289, 0xd4f: 0x13d1, 0xd50: 0x0039, 0xd51: 0x0ee9, - 0xd52: 0x1159, 0xd53: 0x0ef9, 0xd54: 0x0f09, 0xd55: 0x1199, 0xd56: 0x0f31, 0xd57: 0x0249, - 0xd58: 0x0f41, 0xd59: 0x0259, 0xd5a: 0x0f51, 0xd5b: 0x0359, 0xd5c: 0x0f61, 0xd5d: 0x0f71, - 0xd5e: 0x00d9, 0xd5f: 0x0f99, 0xd60: 0x2039, 0xd61: 0x0269, 0xd62: 0x01d9, 0xd63: 0x0fa9, - 0xd64: 0x0fb9, 0xd65: 0x1089, 0xd66: 0x0279, 0xd67: 0x0369, 0xd68: 0x0289, 0xd69: 0x13d1, - 0xd6a: 0x1f41, 0xd6b: 0x0018, 0xd6c: 0x0018, 0xd6d: 0x0018, 0xd6e: 0x0018, 0xd6f: 0x0018, - 0xd70: 0x0018, 0xd71: 0x0018, 0xd72: 0x0018, 0xd73: 0x0018, 0xd74: 0x0018, 0xd75: 0x0018, - 0xd76: 0x0018, 0xd77: 0x0018, 0xd78: 0x0018, 0xd79: 0x0018, 0xd7a: 0x0018, 0xd7b: 0x0018, - 0xd7c: 0x0018, 0xd7d: 0x0018, 0xd7e: 0x0018, 0xd7f: 0x0018, - // Block 0x36, offset 0xd80 - 0xd80: 0x0008, 0xd81: 0x0008, 0xd82: 0x0008, 0xd83: 0x0008, 0xd84: 0x0008, 0xd85: 0x0008, - 0xd86: 0x0008, 0xd87: 0x0008, 0xd88: 0x0008, 0xd89: 0x0008, 0xd8a: 0x0008, 0xd8b: 0x0008, - 0xd8c: 0x0008, 0xd8d: 0x0008, 0xd8e: 0x0008, 0xd8f: 0x0008, 0xd90: 0x0008, 0xd91: 0x0008, - 0xd92: 0x0008, 0xd93: 0x0008, 0xd94: 0x0008, 0xd95: 0x0008, 0xd96: 0x0008, 0xd97: 0x0008, - 0xd98: 0x0008, 0xd99: 0x0008, 0xd9a: 0x0008, 0xd9b: 0x0008, 0xd9c: 0x0008, 0xd9d: 0x0008, - 0xd9e: 0x0008, 0xd9f: 0x0040, 0xda0: 0xe00d, 0xda1: 0x0008, 0xda2: 0x2971, 0xda3: 0x0ebd, - 0xda4: 0x2989, 0xda5: 0x0008, 0xda6: 0x0008, 0xda7: 0xe07d, 0xda8: 0x0008, 0xda9: 0xe01d, - 0xdaa: 0x0008, 0xdab: 0xe03d, 0xdac: 0x0008, 0xdad: 0x0fe1, 0xdae: 0x1281, 0xdaf: 0x0fc9, - 0xdb0: 0x1141, 0xdb1: 0x0008, 0xdb2: 0xe00d, 0xdb3: 0x0008, 0xdb4: 0x0008, 0xdb5: 0xe01d, - 0xdb6: 0x0008, 0xdb7: 0x0008, 0xdb8: 0x0008, 0xdb9: 0x0008, 0xdba: 0x0008, 0xdbb: 0x0008, - 0xdbc: 0x0259, 0xdbd: 0x1089, 0xdbe: 0x29a1, 0xdbf: 0x29b9, - // Block 0x37, offset 0xdc0 - 0xdc0: 0xe00d, 0xdc1: 0x0008, 0xdc2: 0xe00d, 0xdc3: 0x0008, 0xdc4: 0xe00d, 0xdc5: 0x0008, - 0xdc6: 0xe00d, 0xdc7: 0x0008, 0xdc8: 0xe00d, 0xdc9: 0x0008, 0xdca: 0xe00d, 0xdcb: 0x0008, - 0xdcc: 0xe00d, 0xdcd: 0x0008, 0xdce: 0xe00d, 0xdcf: 0x0008, 0xdd0: 0xe00d, 0xdd1: 0x0008, - 0xdd2: 0xe00d, 0xdd3: 0x0008, 0xdd4: 0xe00d, 0xdd5: 0x0008, 0xdd6: 0xe00d, 0xdd7: 0x0008, - 0xdd8: 0xe00d, 0xdd9: 0x0008, 0xdda: 0xe00d, 0xddb: 0x0008, 0xddc: 0xe00d, 0xddd: 0x0008, - 0xdde: 0xe00d, 0xddf: 0x0008, 0xde0: 0xe00d, 0xde1: 0x0008, 0xde2: 0xe00d, 0xde3: 0x0008, - 0xde4: 0x0008, 0xde5: 0x0018, 0xde6: 0x0018, 0xde7: 0x0018, 0xde8: 0x0018, 0xde9: 0x0018, - 0xdea: 0x0018, 0xdeb: 0xe03d, 0xdec: 0x0008, 0xded: 0xe01d, 0xdee: 0x0008, 0xdef: 0x3308, - 0xdf0: 0x3308, 0xdf1: 0x3308, 0xdf2: 0xe00d, 0xdf3: 0x0008, 0xdf4: 0x0040, 0xdf5: 0x0040, - 0xdf6: 0x0040, 0xdf7: 0x0040, 0xdf8: 0x0040, 0xdf9: 0x0018, 0xdfa: 0x0018, 0xdfb: 0x0018, - 0xdfc: 0x0018, 0xdfd: 0x0018, 0xdfe: 0x0018, 0xdff: 0x0018, - // Block 0x38, offset 0xe00 - 0xe00: 0x26fd, 0xe01: 0x271d, 0xe02: 0x273d, 0xe03: 0x275d, 0xe04: 0x277d, 0xe05: 0x279d, - 0xe06: 0x27bd, 0xe07: 0x27dd, 0xe08: 0x27fd, 0xe09: 0x281d, 0xe0a: 0x283d, 0xe0b: 0x285d, - 0xe0c: 0x287d, 0xe0d: 0x289d, 0xe0e: 0x28bd, 0xe0f: 0x28dd, 0xe10: 0x28fd, 0xe11: 0x291d, - 0xe12: 0x293d, 0xe13: 0x295d, 0xe14: 0x297d, 0xe15: 0x299d, 0xe16: 0x0040, 0xe17: 0x0040, - 0xe18: 0x0040, 0xe19: 0x0040, 0xe1a: 0x0040, 0xe1b: 0x0040, 0xe1c: 0x0040, 0xe1d: 0x0040, - 0xe1e: 0x0040, 0xe1f: 0x0040, 0xe20: 0x0040, 0xe21: 0x0040, 0xe22: 0x0040, 0xe23: 0x0040, - 0xe24: 0x0040, 0xe25: 0x0040, 0xe26: 0x0040, 0xe27: 0x0040, 0xe28: 0x0040, 0xe29: 0x0040, - 0xe2a: 0x0040, 0xe2b: 0x0040, 0xe2c: 0x0040, 0xe2d: 0x0040, 0xe2e: 0x0040, 0xe2f: 0x0040, - 0xe30: 0x0040, 0xe31: 0x0040, 0xe32: 0x0040, 0xe33: 0x0040, 0xe34: 0x0040, 0xe35: 0x0040, - 0xe36: 0x0040, 0xe37: 0x0040, 0xe38: 0x0040, 0xe39: 0x0040, 0xe3a: 0x0040, 0xe3b: 0x0040, - 0xe3c: 0x0040, 0xe3d: 0x0040, 0xe3e: 0x0040, 0xe3f: 0x0040, - // Block 0x39, offset 0xe40 - 0xe40: 0x000a, 0xe41: 0x0018, 0xe42: 0x29d1, 0xe43: 0x0018, 0xe44: 0x0018, 0xe45: 0x0008, - 0xe46: 0x0008, 0xe47: 0x0008, 0xe48: 0x0018, 0xe49: 0x0018, 0xe4a: 0x0018, 0xe4b: 0x0018, - 0xe4c: 0x0018, 0xe4d: 0x0018, 0xe4e: 0x0018, 0xe4f: 0x0018, 0xe50: 0x0018, 0xe51: 0x0018, - 0xe52: 0x0018, 0xe53: 0x0018, 0xe54: 0x0018, 0xe55: 0x0018, 0xe56: 0x0018, 0xe57: 0x0018, - 0xe58: 0x0018, 0xe59: 0x0018, 0xe5a: 0x0018, 0xe5b: 0x0018, 0xe5c: 0x0018, 0xe5d: 0x0018, - 0xe5e: 0x0018, 0xe5f: 0x0018, 0xe60: 0x0018, 0xe61: 0x0018, 0xe62: 0x0018, 0xe63: 0x0018, - 0xe64: 0x0018, 0xe65: 0x0018, 0xe66: 0x0018, 0xe67: 0x0018, 0xe68: 0x0018, 0xe69: 0x0018, - 0xe6a: 0x3308, 0xe6b: 0x3308, 0xe6c: 0x3308, 0xe6d: 0x3308, 0xe6e: 0x3018, 0xe6f: 0x3018, - 0xe70: 0x0018, 0xe71: 0x0018, 0xe72: 0x0018, 0xe73: 0x0018, 0xe74: 0x0018, 0xe75: 0x0018, - 0xe76: 0xe125, 0xe77: 0x0018, 0xe78: 0x29bd, 0xe79: 0x29dd, 0xe7a: 0x29fd, 0xe7b: 0x0018, - 0xe7c: 0x0008, 0xe7d: 0x0018, 0xe7e: 0x0018, 0xe7f: 0x0018, - // Block 0x3a, offset 0xe80 - 0xe80: 0x2b3d, 0xe81: 0x2b5d, 0xe82: 0x2b7d, 0xe83: 0x2b9d, 0xe84: 0x2bbd, 0xe85: 0x2bdd, - 0xe86: 0x2bdd, 0xe87: 0x2bdd, 0xe88: 0x2bfd, 0xe89: 0x2bfd, 0xe8a: 0x2bfd, 0xe8b: 0x2bfd, - 0xe8c: 0x2c1d, 0xe8d: 0x2c1d, 0xe8e: 0x2c1d, 0xe8f: 0x2c3d, 0xe90: 0x2c5d, 0xe91: 0x2c5d, - 0xe92: 0x2a7d, 0xe93: 0x2a7d, 0xe94: 0x2c5d, 0xe95: 0x2c5d, 0xe96: 0x2c7d, 0xe97: 0x2c7d, - 0xe98: 0x2c5d, 0xe99: 0x2c5d, 0xe9a: 0x2a7d, 0xe9b: 0x2a7d, 0xe9c: 0x2c5d, 0xe9d: 0x2c5d, - 0xe9e: 0x2c3d, 0xe9f: 0x2c3d, 0xea0: 0x2c9d, 0xea1: 0x2c9d, 0xea2: 0x2cbd, 0xea3: 0x2cbd, - 0xea4: 0x0040, 0xea5: 0x2cdd, 0xea6: 0x2cfd, 0xea7: 0x2d1d, 0xea8: 0x2d1d, 0xea9: 0x2d3d, - 0xeaa: 0x2d5d, 0xeab: 0x2d7d, 0xeac: 0x2d9d, 0xead: 0x2dbd, 0xeae: 0x2ddd, 0xeaf: 0x2dfd, - 0xeb0: 0x2e1d, 0xeb1: 0x2e3d, 0xeb2: 0x2e3d, 0xeb3: 0x2e5d, 0xeb4: 0x2e7d, 0xeb5: 0x2e7d, - 0xeb6: 0x2e9d, 0xeb7: 0x2ebd, 0xeb8: 0x2e5d, 0xeb9: 0x2edd, 0xeba: 0x2efd, 0xebb: 0x2edd, - 0xebc: 0x2e5d, 0xebd: 0x2f1d, 0xebe: 0x2f3d, 0xebf: 0x2f5d, - // Block 0x3b, offset 0xec0 - 0xec0: 0x2f7d, 0xec1: 0x2f9d, 0xec2: 0x2cfd, 0xec3: 0x2cdd, 0xec4: 0x2fbd, 0xec5: 0x2fdd, - 0xec6: 0x2ffd, 0xec7: 0x301d, 0xec8: 0x303d, 0xec9: 0x305d, 0xeca: 0x307d, 0xecb: 0x309d, - 0xecc: 0x30bd, 0xecd: 0x30dd, 0xece: 0x30fd, 0xecf: 0x0040, 0xed0: 0x0018, 0xed1: 0x0018, - 0xed2: 0x311d, 0xed3: 0x313d, 0xed4: 0x315d, 0xed5: 0x317d, 0xed6: 0x319d, 0xed7: 0x31bd, - 0xed8: 0x31dd, 0xed9: 0x31fd, 0xeda: 0x321d, 0xedb: 0x323d, 0xedc: 0x315d, 0xedd: 0x325d, - 0xede: 0x327d, 0xedf: 0x329d, 0xee0: 0x0008, 0xee1: 0x0008, 0xee2: 0x0008, 0xee3: 0x0008, - 0xee4: 0x0008, 0xee5: 0x0008, 0xee6: 0x0008, 0xee7: 0x0008, 0xee8: 0x0008, 0xee9: 0x0008, - 0xeea: 0x0008, 0xeeb: 0x0008, 0xeec: 0x0008, 0xeed: 0x0008, 0xeee: 0x0008, 0xeef: 0x0008, - 0xef0: 0x0008, 0xef1: 0x0008, 0xef2: 0x0008, 0xef3: 0x0008, 0xef4: 0x0008, 0xef5: 0x0008, - 0xef6: 0x0008, 0xef7: 0x0008, 0xef8: 0x0008, 0xef9: 0x0008, 0xefa: 0x0008, 0xefb: 0x0040, - 0xefc: 0x0040, 0xefd: 0x0040, 0xefe: 0x0040, 0xeff: 0x0040, - // Block 0x3c, offset 0xf00 - 0xf00: 0x36a2, 0xf01: 0x36d2, 0xf02: 0x3702, 0xf03: 0x3732, 0xf04: 0x32bd, 0xf05: 0x32dd, - 0xf06: 0x32fd, 0xf07: 0x331d, 0xf08: 0x0018, 0xf09: 0x0018, 0xf0a: 0x0018, 0xf0b: 0x0018, - 0xf0c: 0x0018, 0xf0d: 0x0018, 0xf0e: 0x0018, 0xf0f: 0x0018, 0xf10: 0x333d, 0xf11: 0x3761, - 0xf12: 0x3779, 0xf13: 0x3791, 0xf14: 0x37a9, 0xf15: 0x37c1, 0xf16: 0x37d9, 0xf17: 0x37f1, - 0xf18: 0x3809, 0xf19: 0x3821, 0xf1a: 0x3839, 0xf1b: 0x3851, 0xf1c: 0x3869, 0xf1d: 0x3881, - 0xf1e: 0x3899, 0xf1f: 0x38b1, 0xf20: 0x335d, 0xf21: 0x337d, 0xf22: 0x339d, 0xf23: 0x33bd, - 0xf24: 0x33dd, 0xf25: 0x33dd, 0xf26: 0x33fd, 0xf27: 0x341d, 0xf28: 0x343d, 0xf29: 0x345d, - 0xf2a: 0x347d, 0xf2b: 0x349d, 0xf2c: 0x34bd, 0xf2d: 0x34dd, 0xf2e: 0x34fd, 0xf2f: 0x351d, - 0xf30: 0x353d, 0xf31: 0x355d, 0xf32: 0x357d, 0xf33: 0x359d, 0xf34: 0x35bd, 0xf35: 0x35dd, - 0xf36: 0x35fd, 0xf37: 0x361d, 0xf38: 0x363d, 0xf39: 0x365d, 0xf3a: 0x367d, 0xf3b: 0x369d, - 0xf3c: 0x38c9, 0xf3d: 0x3901, 0xf3e: 0x36bd, 0xf3f: 0x0018, - // Block 0x3d, offset 0xf40 - 0xf40: 0x36dd, 0xf41: 0x36fd, 0xf42: 0x371d, 0xf43: 0x373d, 0xf44: 0x375d, 0xf45: 0x377d, - 0xf46: 0x379d, 0xf47: 0x37bd, 0xf48: 0x37dd, 0xf49: 0x37fd, 0xf4a: 0x381d, 0xf4b: 0x383d, - 0xf4c: 0x385d, 0xf4d: 0x387d, 0xf4e: 0x389d, 0xf4f: 0x38bd, 0xf50: 0x38dd, 0xf51: 0x38fd, - 0xf52: 0x391d, 0xf53: 0x393d, 0xf54: 0x395d, 0xf55: 0x397d, 0xf56: 0x399d, 0xf57: 0x39bd, - 0xf58: 0x39dd, 0xf59: 0x39fd, 0xf5a: 0x3a1d, 0xf5b: 0x3a3d, 0xf5c: 0x3a5d, 0xf5d: 0x3a7d, - 0xf5e: 0x3a9d, 0xf5f: 0x3abd, 0xf60: 0x3add, 0xf61: 0x3afd, 0xf62: 0x3b1d, 0xf63: 0x3b3d, - 0xf64: 0x3b5d, 0xf65: 0x3b7d, 0xf66: 0x127d, 0xf67: 0x3b9d, 0xf68: 0x3bbd, 0xf69: 0x3bdd, - 0xf6a: 0x3bfd, 0xf6b: 0x3c1d, 0xf6c: 0x3c3d, 0xf6d: 0x3c5d, 0xf6e: 0x239d, 0xf6f: 0x3c7d, - 0xf70: 0x3c9d, 0xf71: 0x3939, 0xf72: 0x3951, 0xf73: 0x3969, 0xf74: 0x3981, 0xf75: 0x3999, - 0xf76: 0x39b1, 0xf77: 0x39c9, 0xf78: 0x39e1, 0xf79: 0x39f9, 0xf7a: 0x3a11, 0xf7b: 0x3a29, - 0xf7c: 0x3a41, 0xf7d: 0x3a59, 0xf7e: 0x3a71, 0xf7f: 0x3a89, - // Block 0x3e, offset 0xf80 - 0xf80: 0x3aa1, 0xf81: 0x3ac9, 0xf82: 0x3af1, 0xf83: 0x3b19, 0xf84: 0x3b41, 0xf85: 0x3b69, - 0xf86: 0x3b91, 0xf87: 0x3bb9, 0xf88: 0x3be1, 0xf89: 0x3c09, 0xf8a: 0x3c39, 0xf8b: 0x3c69, - 0xf8c: 0x3c99, 0xf8d: 0x3cbd, 0xf8e: 0x3cb1, 0xf8f: 0x3cdd, 0xf90: 0x3cfd, 0xf91: 0x3d15, - 0xf92: 0x3d2d, 0xf93: 0x3d45, 0xf94: 0x3d5d, 0xf95: 0x3d5d, 0xf96: 0x3d45, 0xf97: 0x3d75, - 0xf98: 0x07bd, 0xf99: 0x3d8d, 0xf9a: 0x3da5, 0xf9b: 0x3dbd, 0xf9c: 0x3dd5, 0xf9d: 0x3ded, - 0xf9e: 0x3e05, 0xf9f: 0x3e1d, 0xfa0: 0x3e35, 0xfa1: 0x3e4d, 0xfa2: 0x3e65, 0xfa3: 0x3e7d, - 0xfa4: 0x3e95, 0xfa5: 0x3e95, 0xfa6: 0x3ead, 0xfa7: 0x3ead, 0xfa8: 0x3ec5, 0xfa9: 0x3ec5, - 0xfaa: 0x3edd, 0xfab: 0x3ef5, 0xfac: 0x3f0d, 0xfad: 0x3f25, 0xfae: 0x3f3d, 0xfaf: 0x3f3d, - 0xfb0: 0x3f55, 0xfb1: 0x3f55, 0xfb2: 0x3f55, 0xfb3: 0x3f6d, 0xfb4: 0x3f85, 0xfb5: 0x3f9d, - 0xfb6: 0x3fb5, 0xfb7: 0x3f9d, 0xfb8: 0x3fcd, 0xfb9: 0x3fe5, 0xfba: 0x3f6d, 0xfbb: 0x3ffd, - 0xfbc: 0x4015, 0xfbd: 0x4015, 0xfbe: 0x4015, 0xfbf: 0x0040, - // Block 0x3f, offset 0xfc0 - 0xfc0: 0x3cc9, 0xfc1: 0x3d31, 0xfc2: 0x3d99, 0xfc3: 0x3e01, 0xfc4: 0x3e51, 0xfc5: 0x3eb9, - 0xfc6: 0x3f09, 0xfc7: 0x3f59, 0xfc8: 0x3fd9, 0xfc9: 0x4041, 0xfca: 0x4091, 0xfcb: 0x40e1, - 0xfcc: 0x4131, 0xfcd: 0x4199, 0xfce: 0x4201, 0xfcf: 0x4251, 0xfd0: 0x42a1, 0xfd1: 0x42d9, - 0xfd2: 0x4329, 0xfd3: 0x4391, 0xfd4: 0x43f9, 0xfd5: 0x4431, 0xfd6: 0x44b1, 0xfd7: 0x4549, - 0xfd8: 0x45c9, 0xfd9: 0x4619, 0xfda: 0x4699, 0xfdb: 0x4719, 0xfdc: 0x4781, 0xfdd: 0x47d1, - 0xfde: 0x4821, 0xfdf: 0x4871, 0xfe0: 0x48d9, 0xfe1: 0x4959, 0xfe2: 0x49c1, 0xfe3: 0x4a11, - 0xfe4: 0x4a61, 0xfe5: 0x4ab1, 0xfe6: 0x4ae9, 0xfe7: 0x4b21, 0xfe8: 0x4b59, 0xfe9: 0x4b91, - 0xfea: 0x4be1, 0xfeb: 0x4c31, 0xfec: 0x4cb1, 0xfed: 0x4d01, 0xfee: 0x4d69, 0xfef: 0x4de9, - 0xff0: 0x4e39, 0xff1: 0x4e71, 0xff2: 0x4ea9, 0xff3: 0x4f29, 0xff4: 0x4f91, 0xff5: 0x5011, - 0xff6: 0x5061, 0xff7: 0x50e1, 0xff8: 0x5119, 0xff9: 0x5169, 0xffa: 0x51b9, 0xffb: 0x5209, - 0xffc: 0x5259, 0xffd: 0x52a9, 0xffe: 0x5311, 0xfff: 0x5361, - // Block 0x40, offset 0x1000 - 0x1000: 0x5399, 0x1001: 0x53e9, 0x1002: 0x5439, 0x1003: 0x5489, 0x1004: 0x54f1, 0x1005: 0x5541, - 0x1006: 0x5591, 0x1007: 0x55e1, 0x1008: 0x5661, 0x1009: 0x56c9, 0x100a: 0x5701, 0x100b: 0x5781, - 0x100c: 0x57b9, 0x100d: 0x5821, 0x100e: 0x5889, 0x100f: 0x58d9, 0x1010: 0x5929, 0x1011: 0x5979, - 0x1012: 0x59e1, 0x1013: 0x5a19, 0x1014: 0x5a69, 0x1015: 0x5ad1, 0x1016: 0x5b09, 0x1017: 0x5b89, - 0x1018: 0x5bd9, 0x1019: 0x5c01, 0x101a: 0x5c29, 0x101b: 0x5c51, 0x101c: 0x5c79, 0x101d: 0x5ca1, - 0x101e: 0x5cc9, 0x101f: 0x5cf1, 0x1020: 0x5d19, 0x1021: 0x5d41, 0x1022: 0x5d69, 0x1023: 0x5d99, - 0x1024: 0x5dc9, 0x1025: 0x5df9, 0x1026: 0x5e29, 0x1027: 0x5e59, 0x1028: 0x5e89, 0x1029: 0x5eb9, - 0x102a: 0x5ee9, 0x102b: 0x5f19, 0x102c: 0x5f49, 0x102d: 0x5f79, 0x102e: 0x5fa9, 0x102f: 0x5fd9, - 0x1030: 0x6009, 0x1031: 0x402d, 0x1032: 0x6039, 0x1033: 0x6051, 0x1034: 0x404d, 0x1035: 0x6069, - 0x1036: 0x6081, 0x1037: 0x6099, 0x1038: 0x406d, 0x1039: 0x406d, 0x103a: 0x60b1, 0x103b: 0x60c9, - 0x103c: 0x6101, 0x103d: 0x6139, 0x103e: 0x6171, 0x103f: 0x61a9, - // Block 0x41, offset 0x1040 - 0x1040: 0x6211, 0x1041: 0x6229, 0x1042: 0x408d, 0x1043: 0x6241, 0x1044: 0x6259, 0x1045: 0x6271, - 0x1046: 0x6289, 0x1047: 0x62a1, 0x1048: 0x40ad, 0x1049: 0x62b9, 0x104a: 0x62e1, 0x104b: 0x62f9, - 0x104c: 0x40cd, 0x104d: 0x40cd, 0x104e: 0x6311, 0x104f: 0x6329, 0x1050: 0x6341, 0x1051: 0x40ed, - 0x1052: 0x410d, 0x1053: 0x412d, 0x1054: 0x414d, 0x1055: 0x416d, 0x1056: 0x6359, 0x1057: 0x6371, - 0x1058: 0x6389, 0x1059: 0x63a1, 0x105a: 0x63b9, 0x105b: 0x418d, 0x105c: 0x63d1, 0x105d: 0x63e9, - 0x105e: 0x6401, 0x105f: 0x41ad, 0x1060: 0x41cd, 0x1061: 0x6419, 0x1062: 0x41ed, 0x1063: 0x420d, - 0x1064: 0x422d, 0x1065: 0x6431, 0x1066: 0x424d, 0x1067: 0x6449, 0x1068: 0x6479, 0x1069: 0x6211, - 0x106a: 0x426d, 0x106b: 0x428d, 0x106c: 0x42ad, 0x106d: 0x42cd, 0x106e: 0x64b1, 0x106f: 0x64f1, - 0x1070: 0x6539, 0x1071: 0x6551, 0x1072: 0x42ed, 0x1073: 0x6569, 0x1074: 0x6581, 0x1075: 0x6599, - 0x1076: 0x430d, 0x1077: 0x65b1, 0x1078: 0x65c9, 0x1079: 0x65b1, 0x107a: 0x65e1, 0x107b: 0x65f9, - 0x107c: 0x432d, 0x107d: 0x6611, 0x107e: 0x6629, 0x107f: 0x6611, - // Block 0x42, offset 0x1080 - 0x1080: 0x434d, 0x1081: 0x436d, 0x1082: 0x0040, 0x1083: 0x6641, 0x1084: 0x6659, 0x1085: 0x6671, - 0x1086: 0x6689, 0x1087: 0x0040, 0x1088: 0x66c1, 0x1089: 0x66d9, 0x108a: 0x66f1, 0x108b: 0x6709, - 0x108c: 0x6721, 0x108d: 0x6739, 0x108e: 0x6401, 0x108f: 0x6751, 0x1090: 0x6769, 0x1091: 0x6781, - 0x1092: 0x438d, 0x1093: 0x6799, 0x1094: 0x6289, 0x1095: 0x43ad, 0x1096: 0x43cd, 0x1097: 0x67b1, - 0x1098: 0x0040, 0x1099: 0x43ed, 0x109a: 0x67c9, 0x109b: 0x67e1, 0x109c: 0x67f9, 0x109d: 0x6811, - 0x109e: 0x6829, 0x109f: 0x6859, 0x10a0: 0x6889, 0x10a1: 0x68b1, 0x10a2: 0x68d9, 0x10a3: 0x6901, - 0x10a4: 0x6929, 0x10a5: 0x6951, 0x10a6: 0x6979, 0x10a7: 0x69a1, 0x10a8: 0x69c9, 0x10a9: 0x69f1, - 0x10aa: 0x6a21, 0x10ab: 0x6a51, 0x10ac: 0x6a81, 0x10ad: 0x6ab1, 0x10ae: 0x6ae1, 0x10af: 0x6b11, - 0x10b0: 0x6b41, 0x10b1: 0x6b71, 0x10b2: 0x6ba1, 0x10b3: 0x6bd1, 0x10b4: 0x6c01, 0x10b5: 0x6c31, - 0x10b6: 0x6c61, 0x10b7: 0x6c91, 0x10b8: 0x6cc1, 0x10b9: 0x6cf1, 0x10ba: 0x6d21, 0x10bb: 0x6d51, - 0x10bc: 0x6d81, 0x10bd: 0x6db1, 0x10be: 0x6de1, 0x10bf: 0x440d, - // Block 0x43, offset 0x10c0 - 0x10c0: 0xe00d, 0x10c1: 0x0008, 0x10c2: 0xe00d, 0x10c3: 0x0008, 0x10c4: 0xe00d, 0x10c5: 0x0008, - 0x10c6: 0xe00d, 0x10c7: 0x0008, 0x10c8: 0xe00d, 0x10c9: 0x0008, 0x10ca: 0xe00d, 0x10cb: 0x0008, - 0x10cc: 0xe00d, 0x10cd: 0x0008, 0x10ce: 0xe00d, 0x10cf: 0x0008, 0x10d0: 0xe00d, 0x10d1: 0x0008, - 0x10d2: 0xe00d, 0x10d3: 0x0008, 0x10d4: 0xe00d, 0x10d5: 0x0008, 0x10d6: 0xe00d, 0x10d7: 0x0008, - 0x10d8: 0xe00d, 0x10d9: 0x0008, 0x10da: 0xe00d, 0x10db: 0x0008, 0x10dc: 0xe00d, 0x10dd: 0x0008, - 0x10de: 0xe00d, 0x10df: 0x0008, 0x10e0: 0xe00d, 0x10e1: 0x0008, 0x10e2: 0xe00d, 0x10e3: 0x0008, - 0x10e4: 0xe00d, 0x10e5: 0x0008, 0x10e6: 0xe00d, 0x10e7: 0x0008, 0x10e8: 0xe00d, 0x10e9: 0x0008, - 0x10ea: 0xe00d, 0x10eb: 0x0008, 0x10ec: 0xe00d, 0x10ed: 0x0008, 0x10ee: 0x0008, 0x10ef: 0x3308, - 0x10f0: 0x3318, 0x10f1: 0x3318, 0x10f2: 0x3318, 0x10f3: 0x0018, 0x10f4: 0x3308, 0x10f5: 0x3308, - 0x10f6: 0x3308, 0x10f7: 0x3308, 0x10f8: 0x3308, 0x10f9: 0x3308, 0x10fa: 0x3308, 0x10fb: 0x3308, - 0x10fc: 0x3308, 0x10fd: 0x3308, 0x10fe: 0x0018, 0x10ff: 0x0008, - // Block 0x44, offset 0x1100 - 0x1100: 0xe00d, 0x1101: 0x0008, 0x1102: 0xe00d, 0x1103: 0x0008, 0x1104: 0xe00d, 0x1105: 0x0008, - 0x1106: 0xe00d, 0x1107: 0x0008, 0x1108: 0xe00d, 0x1109: 0x0008, 0x110a: 0xe00d, 0x110b: 0x0008, - 0x110c: 0xe00d, 0x110d: 0x0008, 0x110e: 0xe00d, 0x110f: 0x0008, 0x1110: 0xe00d, 0x1111: 0x0008, - 0x1112: 0xe00d, 0x1113: 0x0008, 0x1114: 0xe00d, 0x1115: 0x0008, 0x1116: 0xe00d, 0x1117: 0x0008, - 0x1118: 0xe00d, 0x1119: 0x0008, 0x111a: 0xe00d, 0x111b: 0x0008, 0x111c: 0x0ea1, 0x111d: 0x6e11, - 0x111e: 0x3308, 0x111f: 0x3308, 0x1120: 0x0008, 0x1121: 0x0008, 0x1122: 0x0008, 0x1123: 0x0008, - 0x1124: 0x0008, 0x1125: 0x0008, 0x1126: 0x0008, 0x1127: 0x0008, 0x1128: 0x0008, 0x1129: 0x0008, - 0x112a: 0x0008, 0x112b: 0x0008, 0x112c: 0x0008, 0x112d: 0x0008, 0x112e: 0x0008, 0x112f: 0x0008, - 0x1130: 0x0008, 0x1131: 0x0008, 0x1132: 0x0008, 0x1133: 0x0008, 0x1134: 0x0008, 0x1135: 0x0008, - 0x1136: 0x0008, 0x1137: 0x0008, 0x1138: 0x0008, 0x1139: 0x0008, 0x113a: 0x0008, 0x113b: 0x0008, - 0x113c: 0x0008, 0x113d: 0x0008, 0x113e: 0x0008, 0x113f: 0x0008, - // Block 0x45, offset 0x1140 - 0x1140: 0x0018, 0x1141: 0x0018, 0x1142: 0x0018, 0x1143: 0x0018, 0x1144: 0x0018, 0x1145: 0x0018, - 0x1146: 0x0018, 0x1147: 0x0018, 0x1148: 0x0018, 0x1149: 0x0018, 0x114a: 0x0018, 0x114b: 0x0018, - 0x114c: 0x0018, 0x114d: 0x0018, 0x114e: 0x0018, 0x114f: 0x0018, 0x1150: 0x0018, 0x1151: 0x0018, - 0x1152: 0x0018, 0x1153: 0x0018, 0x1154: 0x0018, 0x1155: 0x0018, 0x1156: 0x0018, 0x1157: 0x0008, - 0x1158: 0x0008, 0x1159: 0x0008, 0x115a: 0x0008, 0x115b: 0x0008, 0x115c: 0x0008, 0x115d: 0x0008, - 0x115e: 0x0008, 0x115f: 0x0008, 0x1160: 0x0018, 0x1161: 0x0018, 0x1162: 0xe00d, 0x1163: 0x0008, - 0x1164: 0xe00d, 0x1165: 0x0008, 0x1166: 0xe00d, 0x1167: 0x0008, 0x1168: 0xe00d, 0x1169: 0x0008, - 0x116a: 0xe00d, 0x116b: 0x0008, 0x116c: 0xe00d, 0x116d: 0x0008, 0x116e: 0xe00d, 0x116f: 0x0008, - 0x1170: 0x0008, 0x1171: 0x0008, 0x1172: 0xe00d, 0x1173: 0x0008, 0x1174: 0xe00d, 0x1175: 0x0008, - 0x1176: 0xe00d, 0x1177: 0x0008, 0x1178: 0xe00d, 0x1179: 0x0008, 0x117a: 0xe00d, 0x117b: 0x0008, - 0x117c: 0xe00d, 0x117d: 0x0008, 0x117e: 0xe00d, 0x117f: 0x0008, - // Block 0x46, offset 0x1180 - 0x1180: 0xe00d, 0x1181: 0x0008, 0x1182: 0xe00d, 0x1183: 0x0008, 0x1184: 0xe00d, 0x1185: 0x0008, - 0x1186: 0xe00d, 0x1187: 0x0008, 0x1188: 0xe00d, 0x1189: 0x0008, 0x118a: 0xe00d, 0x118b: 0x0008, - 0x118c: 0xe00d, 0x118d: 0x0008, 0x118e: 0xe00d, 0x118f: 0x0008, 0x1190: 0xe00d, 0x1191: 0x0008, - 0x1192: 0xe00d, 0x1193: 0x0008, 0x1194: 0xe00d, 0x1195: 0x0008, 0x1196: 0xe00d, 0x1197: 0x0008, - 0x1198: 0xe00d, 0x1199: 0x0008, 0x119a: 0xe00d, 0x119b: 0x0008, 0x119c: 0xe00d, 0x119d: 0x0008, - 0x119e: 0xe00d, 0x119f: 0x0008, 0x11a0: 0xe00d, 0x11a1: 0x0008, 0x11a2: 0xe00d, 0x11a3: 0x0008, - 0x11a4: 0xe00d, 0x11a5: 0x0008, 0x11a6: 0xe00d, 0x11a7: 0x0008, 0x11a8: 0xe00d, 0x11a9: 0x0008, - 0x11aa: 0xe00d, 0x11ab: 0x0008, 0x11ac: 0xe00d, 0x11ad: 0x0008, 0x11ae: 0xe00d, 0x11af: 0x0008, - 0x11b0: 0xe0fd, 0x11b1: 0x0008, 0x11b2: 0x0008, 0x11b3: 0x0008, 0x11b4: 0x0008, 0x11b5: 0x0008, - 0x11b6: 0x0008, 0x11b7: 0x0008, 0x11b8: 0x0008, 0x11b9: 0xe01d, 0x11ba: 0x0008, 0x11bb: 0xe03d, - 0x11bc: 0x0008, 0x11bd: 0x442d, 0x11be: 0xe00d, 0x11bf: 0x0008, - // Block 0x47, offset 0x11c0 - 0x11c0: 0xe00d, 0x11c1: 0x0008, 0x11c2: 0xe00d, 0x11c3: 0x0008, 0x11c4: 0xe00d, 0x11c5: 0x0008, - 0x11c6: 0xe00d, 0x11c7: 0x0008, 0x11c8: 0x0008, 0x11c9: 0x0018, 0x11ca: 0x0018, 0x11cb: 0xe03d, - 0x11cc: 0x0008, 0x11cd: 0x11d9, 0x11ce: 0x0008, 0x11cf: 0x0008, 0x11d0: 0xe00d, 0x11d1: 0x0008, - 0x11d2: 0xe00d, 0x11d3: 0x0008, 0x11d4: 0x0008, 0x11d5: 0x0008, 0x11d6: 0xe00d, 0x11d7: 0x0008, - 0x11d8: 0xe00d, 0x11d9: 0x0008, 0x11da: 0xe00d, 0x11db: 0x0008, 0x11dc: 0xe00d, 0x11dd: 0x0008, - 0x11de: 0xe00d, 0x11df: 0x0008, 0x11e0: 0xe00d, 0x11e1: 0x0008, 0x11e2: 0xe00d, 0x11e3: 0x0008, - 0x11e4: 0xe00d, 0x11e5: 0x0008, 0x11e6: 0xe00d, 0x11e7: 0x0008, 0x11e8: 0xe00d, 0x11e9: 0x0008, - 0x11ea: 0x6e29, 0x11eb: 0x1029, 0x11ec: 0x11c1, 0x11ed: 0x6e41, 0x11ee: 0x1221, 0x11ef: 0x0040, - 0x11f0: 0x6e59, 0x11f1: 0x6e71, 0x11f2: 0x1239, 0x11f3: 0x444d, 0x11f4: 0xe00d, 0x11f5: 0x0008, - 0x11f6: 0xe00d, 0x11f7: 0x0008, 0x11f8: 0x0040, 0x11f9: 0x0040, 0x11fa: 0x0040, 0x11fb: 0x0040, - 0x11fc: 0x0040, 0x11fd: 0x0040, 0x11fe: 0x0040, 0x11ff: 0x0040, - // Block 0x48, offset 0x1200 - 0x1200: 0x64d5, 0x1201: 0x64f5, 0x1202: 0x6515, 0x1203: 0x6535, 0x1204: 0x6555, 0x1205: 0x6575, - 0x1206: 0x6595, 0x1207: 0x65b5, 0x1208: 0x65d5, 0x1209: 0x65f5, 0x120a: 0x6615, 0x120b: 0x6635, - 0x120c: 0x6655, 0x120d: 0x6675, 0x120e: 0x0008, 0x120f: 0x0008, 0x1210: 0x6695, 0x1211: 0x0008, - 0x1212: 0x66b5, 0x1213: 0x0008, 0x1214: 0x0008, 0x1215: 0x66d5, 0x1216: 0x66f5, 0x1217: 0x6715, - 0x1218: 0x6735, 0x1219: 0x6755, 0x121a: 0x6775, 0x121b: 0x6795, 0x121c: 0x67b5, 0x121d: 0x67d5, - 0x121e: 0x67f5, 0x121f: 0x0008, 0x1220: 0x6815, 0x1221: 0x0008, 0x1222: 0x6835, 0x1223: 0x0008, - 0x1224: 0x0008, 0x1225: 0x6855, 0x1226: 0x6875, 0x1227: 0x0008, 0x1228: 0x0008, 0x1229: 0x0008, - 0x122a: 0x6895, 0x122b: 0x68b5, 0x122c: 0x68d5, 0x122d: 0x68f5, 0x122e: 0x6915, 0x122f: 0x6935, - 0x1230: 0x6955, 0x1231: 0x6975, 0x1232: 0x6995, 0x1233: 0x69b5, 0x1234: 0x69d5, 0x1235: 0x69f5, - 0x1236: 0x6a15, 0x1237: 0x6a35, 0x1238: 0x6a55, 0x1239: 0x6a75, 0x123a: 0x6a95, 0x123b: 0x6ab5, - 0x123c: 0x6ad5, 0x123d: 0x6af5, 0x123e: 0x6b15, 0x123f: 0x6b35, - // Block 0x49, offset 0x1240 - 0x1240: 0x7a95, 0x1241: 0x7ab5, 0x1242: 0x7ad5, 0x1243: 0x7af5, 0x1244: 0x7b15, 0x1245: 0x7b35, - 0x1246: 0x7b55, 0x1247: 0x7b75, 0x1248: 0x7b95, 0x1249: 0x7bb5, 0x124a: 0x7bd5, 0x124b: 0x7bf5, - 0x124c: 0x7c15, 0x124d: 0x7c35, 0x124e: 0x7c55, 0x124f: 0x6ec9, 0x1250: 0x6ef1, 0x1251: 0x6f19, - 0x1252: 0x7c75, 0x1253: 0x7c95, 0x1254: 0x7cb5, 0x1255: 0x6f41, 0x1256: 0x6f69, 0x1257: 0x6f91, - 0x1258: 0x7cd5, 0x1259: 0x7cf5, 0x125a: 0x0040, 0x125b: 0x0040, 0x125c: 0x0040, 0x125d: 0x0040, - 0x125e: 0x0040, 0x125f: 0x0040, 0x1260: 0x0040, 0x1261: 0x0040, 0x1262: 0x0040, 0x1263: 0x0040, - 0x1264: 0x0040, 0x1265: 0x0040, 0x1266: 0x0040, 0x1267: 0x0040, 0x1268: 0x0040, 0x1269: 0x0040, - 0x126a: 0x0040, 0x126b: 0x0040, 0x126c: 0x0040, 0x126d: 0x0040, 0x126e: 0x0040, 0x126f: 0x0040, - 0x1270: 0x0040, 0x1271: 0x0040, 0x1272: 0x0040, 0x1273: 0x0040, 0x1274: 0x0040, 0x1275: 0x0040, - 0x1276: 0x0040, 0x1277: 0x0040, 0x1278: 0x0040, 0x1279: 0x0040, 0x127a: 0x0040, 0x127b: 0x0040, - 0x127c: 0x0040, 0x127d: 0x0040, 0x127e: 0x0040, 0x127f: 0x0040, - // Block 0x4a, offset 0x1280 - 0x1280: 0x6fb9, 0x1281: 0x6fd1, 0x1282: 0x6fe9, 0x1283: 0x7d15, 0x1284: 0x7d35, 0x1285: 0x7001, - 0x1286: 0x7001, 0x1287: 0x0040, 0x1288: 0x0040, 0x1289: 0x0040, 0x128a: 0x0040, 0x128b: 0x0040, - 0x128c: 0x0040, 0x128d: 0x0040, 0x128e: 0x0040, 0x128f: 0x0040, 0x1290: 0x0040, 0x1291: 0x0040, - 0x1292: 0x0040, 0x1293: 0x7019, 0x1294: 0x7041, 0x1295: 0x7069, 0x1296: 0x7091, 0x1297: 0x70b9, - 0x1298: 0x0040, 0x1299: 0x0040, 0x129a: 0x0040, 0x129b: 0x0040, 0x129c: 0x0040, 0x129d: 0x70e1, - 0x129e: 0x3308, 0x129f: 0x7109, 0x12a0: 0x7131, 0x12a1: 0x20a9, 0x12a2: 0x20f1, 0x12a3: 0x7149, - 0x12a4: 0x7161, 0x12a5: 0x7179, 0x12a6: 0x7191, 0x12a7: 0x71a9, 0x12a8: 0x71c1, 0x12a9: 0x1fb2, - 0x12aa: 0x71d9, 0x12ab: 0x7201, 0x12ac: 0x7229, 0x12ad: 0x7261, 0x12ae: 0x7299, 0x12af: 0x72c1, - 0x12b0: 0x72e9, 0x12b1: 0x7311, 0x12b2: 0x7339, 0x12b3: 0x7361, 0x12b4: 0x7389, 0x12b5: 0x73b1, - 0x12b6: 0x73d9, 0x12b7: 0x0040, 0x12b8: 0x7401, 0x12b9: 0x7429, 0x12ba: 0x7451, 0x12bb: 0x7479, - 0x12bc: 0x74a1, 0x12bd: 0x0040, 0x12be: 0x74c9, 0x12bf: 0x0040, - // Block 0x4b, offset 0x12c0 - 0x12c0: 0x74f1, 0x12c1: 0x7519, 0x12c2: 0x0040, 0x12c3: 0x7541, 0x12c4: 0x7569, 0x12c5: 0x0040, - 0x12c6: 0x7591, 0x12c7: 0x75b9, 0x12c8: 0x75e1, 0x12c9: 0x7609, 0x12ca: 0x7631, 0x12cb: 0x7659, - 0x12cc: 0x7681, 0x12cd: 0x76a9, 0x12ce: 0x76d1, 0x12cf: 0x76f9, 0x12d0: 0x7721, 0x12d1: 0x7721, - 0x12d2: 0x7739, 0x12d3: 0x7739, 0x12d4: 0x7739, 0x12d5: 0x7739, 0x12d6: 0x7751, 0x12d7: 0x7751, - 0x12d8: 0x7751, 0x12d9: 0x7751, 0x12da: 0x7769, 0x12db: 0x7769, 0x12dc: 0x7769, 0x12dd: 0x7769, - 0x12de: 0x7781, 0x12df: 0x7781, 0x12e0: 0x7781, 0x12e1: 0x7781, 0x12e2: 0x7799, 0x12e3: 0x7799, - 0x12e4: 0x7799, 0x12e5: 0x7799, 0x12e6: 0x77b1, 0x12e7: 0x77b1, 0x12e8: 0x77b1, 0x12e9: 0x77b1, - 0x12ea: 0x77c9, 0x12eb: 0x77c9, 0x12ec: 0x77c9, 0x12ed: 0x77c9, 0x12ee: 0x77e1, 0x12ef: 0x77e1, - 0x12f0: 0x77e1, 0x12f1: 0x77e1, 0x12f2: 0x77f9, 0x12f3: 0x77f9, 0x12f4: 0x77f9, 0x12f5: 0x77f9, - 0x12f6: 0x7811, 0x12f7: 0x7811, 0x12f8: 0x7811, 0x12f9: 0x7811, 0x12fa: 0x7829, 0x12fb: 0x7829, - 0x12fc: 0x7829, 0x12fd: 0x7829, 0x12fe: 0x7841, 0x12ff: 0x7841, - // Block 0x4c, offset 0x1300 - 0x1300: 0x7841, 0x1301: 0x7841, 0x1302: 0x7859, 0x1303: 0x7859, 0x1304: 0x7871, 0x1305: 0x7871, - 0x1306: 0x7889, 0x1307: 0x7889, 0x1308: 0x78a1, 0x1309: 0x78a1, 0x130a: 0x78b9, 0x130b: 0x78b9, - 0x130c: 0x78d1, 0x130d: 0x78d1, 0x130e: 0x78e9, 0x130f: 0x78e9, 0x1310: 0x78e9, 0x1311: 0x78e9, - 0x1312: 0x7901, 0x1313: 0x7901, 0x1314: 0x7901, 0x1315: 0x7901, 0x1316: 0x7919, 0x1317: 0x7919, - 0x1318: 0x7919, 0x1319: 0x7919, 0x131a: 0x7931, 0x131b: 0x7931, 0x131c: 0x7931, 0x131d: 0x7931, - 0x131e: 0x7949, 0x131f: 0x7949, 0x1320: 0x7961, 0x1321: 0x7961, 0x1322: 0x7961, 0x1323: 0x7961, - 0x1324: 0x7979, 0x1325: 0x7979, 0x1326: 0x7991, 0x1327: 0x7991, 0x1328: 0x7991, 0x1329: 0x7991, - 0x132a: 0x79a9, 0x132b: 0x79a9, 0x132c: 0x79a9, 0x132d: 0x79a9, 0x132e: 0x79c1, 0x132f: 0x79c1, - 0x1330: 0x79d9, 0x1331: 0x79d9, 0x1332: 0x0818, 0x1333: 0x0818, 0x1334: 0x0818, 0x1335: 0x0818, - 0x1336: 0x0818, 0x1337: 0x0818, 0x1338: 0x0818, 0x1339: 0x0818, 0x133a: 0x0818, 0x133b: 0x0818, - 0x133c: 0x0818, 0x133d: 0x0818, 0x133e: 0x0818, 0x133f: 0x0818, - // Block 0x4d, offset 0x1340 - 0x1340: 0x0818, 0x1341: 0x0818, 0x1342: 0x0040, 0x1343: 0x0040, 0x1344: 0x0040, 0x1345: 0x0040, - 0x1346: 0x0040, 0x1347: 0x0040, 0x1348: 0x0040, 0x1349: 0x0040, 0x134a: 0x0040, 0x134b: 0x0040, - 0x134c: 0x0040, 0x134d: 0x0040, 0x134e: 0x0040, 0x134f: 0x0040, 0x1350: 0x0040, 0x1351: 0x0040, - 0x1352: 0x0040, 0x1353: 0x79f1, 0x1354: 0x79f1, 0x1355: 0x79f1, 0x1356: 0x79f1, 0x1357: 0x7a09, - 0x1358: 0x7a09, 0x1359: 0x7a21, 0x135a: 0x7a21, 0x135b: 0x7a39, 0x135c: 0x7a39, 0x135d: 0x0479, - 0x135e: 0x7a51, 0x135f: 0x7a51, 0x1360: 0x7a69, 0x1361: 0x7a69, 0x1362: 0x7a81, 0x1363: 0x7a81, - 0x1364: 0x7a99, 0x1365: 0x7a99, 0x1366: 0x7a99, 0x1367: 0x7a99, 0x1368: 0x7ab1, 0x1369: 0x7ab1, - 0x136a: 0x7ac9, 0x136b: 0x7ac9, 0x136c: 0x7af1, 0x136d: 0x7af1, 0x136e: 0x7b19, 0x136f: 0x7b19, - 0x1370: 0x7b41, 0x1371: 0x7b41, 0x1372: 0x7b69, 0x1373: 0x7b69, 0x1374: 0x7b91, 0x1375: 0x7b91, - 0x1376: 0x7bb9, 0x1377: 0x7bb9, 0x1378: 0x7bb9, 0x1379: 0x7be1, 0x137a: 0x7be1, 0x137b: 0x7be1, - 0x137c: 0x7c09, 0x137d: 0x7c09, 0x137e: 0x7c09, 0x137f: 0x7c09, - // Block 0x4e, offset 0x1380 - 0x1380: 0x85f9, 0x1381: 0x8621, 0x1382: 0x8649, 0x1383: 0x8671, 0x1384: 0x8699, 0x1385: 0x86c1, - 0x1386: 0x86e9, 0x1387: 0x8711, 0x1388: 0x8739, 0x1389: 0x8761, 0x138a: 0x8789, 0x138b: 0x87b1, - 0x138c: 0x87d9, 0x138d: 0x8801, 0x138e: 0x8829, 0x138f: 0x8851, 0x1390: 0x8879, 0x1391: 0x88a1, - 0x1392: 0x88c9, 0x1393: 0x88f1, 0x1394: 0x8919, 0x1395: 0x8941, 0x1396: 0x8969, 0x1397: 0x8991, - 0x1398: 0x89b9, 0x1399: 0x89e1, 0x139a: 0x8a09, 0x139b: 0x8a31, 0x139c: 0x8a59, 0x139d: 0x8a81, - 0x139e: 0x8aaa, 0x139f: 0x8ada, 0x13a0: 0x8b0a, 0x13a1: 0x8b3a, 0x13a2: 0x8b6a, 0x13a3: 0x8b9a, - 0x13a4: 0x8bc9, 0x13a5: 0x8bf1, 0x13a6: 0x7c71, 0x13a7: 0x8c19, 0x13a8: 0x7be1, 0x13a9: 0x7c99, - 0x13aa: 0x8c41, 0x13ab: 0x8c69, 0x13ac: 0x7d39, 0x13ad: 0x8c91, 0x13ae: 0x7d61, 0x13af: 0x7d89, - 0x13b0: 0x8cb9, 0x13b1: 0x8ce1, 0x13b2: 0x7e29, 0x13b3: 0x8d09, 0x13b4: 0x7e51, 0x13b5: 0x7e79, - 0x13b6: 0x8d31, 0x13b7: 0x8d59, 0x13b8: 0x7ec9, 0x13b9: 0x8d81, 0x13ba: 0x7ef1, 0x13bb: 0x7f19, - 0x13bc: 0x83a1, 0x13bd: 0x83c9, 0x13be: 0x8441, 0x13bf: 0x8469, - // Block 0x4f, offset 0x13c0 - 0x13c0: 0x8491, 0x13c1: 0x8531, 0x13c2: 0x8559, 0x13c3: 0x8581, 0x13c4: 0x85a9, 0x13c5: 0x8649, - 0x13c6: 0x8671, 0x13c7: 0x8699, 0x13c8: 0x8da9, 0x13c9: 0x8739, 0x13ca: 0x8dd1, 0x13cb: 0x8df9, - 0x13cc: 0x8829, 0x13cd: 0x8e21, 0x13ce: 0x8851, 0x13cf: 0x8879, 0x13d0: 0x8a81, 0x13d1: 0x8e49, - 0x13d2: 0x8e71, 0x13d3: 0x89b9, 0x13d4: 0x8e99, 0x13d5: 0x89e1, 0x13d6: 0x8a09, 0x13d7: 0x7c21, - 0x13d8: 0x7c49, 0x13d9: 0x8ec1, 0x13da: 0x7c71, 0x13db: 0x8ee9, 0x13dc: 0x7cc1, 0x13dd: 0x7ce9, - 0x13de: 0x7d11, 0x13df: 0x7d39, 0x13e0: 0x8f11, 0x13e1: 0x7db1, 0x13e2: 0x7dd9, 0x13e3: 0x7e01, - 0x13e4: 0x7e29, 0x13e5: 0x8f39, 0x13e6: 0x7ec9, 0x13e7: 0x7f41, 0x13e8: 0x7f69, 0x13e9: 0x7f91, - 0x13ea: 0x7fb9, 0x13eb: 0x7fe1, 0x13ec: 0x8031, 0x13ed: 0x8059, 0x13ee: 0x8081, 0x13ef: 0x80a9, - 0x13f0: 0x80d1, 0x13f1: 0x80f9, 0x13f2: 0x8f61, 0x13f3: 0x8121, 0x13f4: 0x8149, 0x13f5: 0x8171, - 0x13f6: 0x8199, 0x13f7: 0x81c1, 0x13f8: 0x81e9, 0x13f9: 0x8239, 0x13fa: 0x8261, 0x13fb: 0x8289, - 0x13fc: 0x82b1, 0x13fd: 0x82d9, 0x13fe: 0x8301, 0x13ff: 0x8329, - // Block 0x50, offset 0x1400 - 0x1400: 0x8351, 0x1401: 0x8379, 0x1402: 0x83f1, 0x1403: 0x8419, 0x1404: 0x84b9, 0x1405: 0x84e1, - 0x1406: 0x8509, 0x1407: 0x8531, 0x1408: 0x8559, 0x1409: 0x85d1, 0x140a: 0x85f9, 0x140b: 0x8621, - 0x140c: 0x8649, 0x140d: 0x8f89, 0x140e: 0x86c1, 0x140f: 0x86e9, 0x1410: 0x8711, 0x1411: 0x8739, - 0x1412: 0x87b1, 0x1413: 0x87d9, 0x1414: 0x8801, 0x1415: 0x8829, 0x1416: 0x8fb1, 0x1417: 0x88a1, - 0x1418: 0x88c9, 0x1419: 0x8fd9, 0x141a: 0x8941, 0x141b: 0x8969, 0x141c: 0x8991, 0x141d: 0x89b9, - 0x141e: 0x9001, 0x141f: 0x7c71, 0x1420: 0x8ee9, 0x1421: 0x7d39, 0x1422: 0x8f11, 0x1423: 0x7e29, - 0x1424: 0x8f39, 0x1425: 0x7ec9, 0x1426: 0x9029, 0x1427: 0x80d1, 0x1428: 0x9051, 0x1429: 0x9079, - 0x142a: 0x90a1, 0x142b: 0x8531, 0x142c: 0x8559, 0x142d: 0x8649, 0x142e: 0x8829, 0x142f: 0x8fb1, - 0x1430: 0x89b9, 0x1431: 0x9001, 0x1432: 0x90c9, 0x1433: 0x9101, 0x1434: 0x9139, 0x1435: 0x9171, - 0x1436: 0x9199, 0x1437: 0x91c1, 0x1438: 0x91e9, 0x1439: 0x9211, 0x143a: 0x9239, 0x143b: 0x9261, - 0x143c: 0x9289, 0x143d: 0x92b1, 0x143e: 0x92d9, 0x143f: 0x9301, - // Block 0x51, offset 0x1440 - 0x1440: 0x9329, 0x1441: 0x9351, 0x1442: 0x9379, 0x1443: 0x93a1, 0x1444: 0x93c9, 0x1445: 0x93f1, - 0x1446: 0x9419, 0x1447: 0x9441, 0x1448: 0x9469, 0x1449: 0x9491, 0x144a: 0x94b9, 0x144b: 0x94e1, - 0x144c: 0x9079, 0x144d: 0x9509, 0x144e: 0x9531, 0x144f: 0x9559, 0x1450: 0x9581, 0x1451: 0x9171, - 0x1452: 0x9199, 0x1453: 0x91c1, 0x1454: 0x91e9, 0x1455: 0x9211, 0x1456: 0x9239, 0x1457: 0x9261, - 0x1458: 0x9289, 0x1459: 0x92b1, 0x145a: 0x92d9, 0x145b: 0x9301, 0x145c: 0x9329, 0x145d: 0x9351, - 0x145e: 0x9379, 0x145f: 0x93a1, 0x1460: 0x93c9, 0x1461: 0x93f1, 0x1462: 0x9419, 0x1463: 0x9441, - 0x1464: 0x9469, 0x1465: 0x9491, 0x1466: 0x94b9, 0x1467: 0x94e1, 0x1468: 0x9079, 0x1469: 0x9509, - 0x146a: 0x9531, 0x146b: 0x9559, 0x146c: 0x9581, 0x146d: 0x9491, 0x146e: 0x94b9, 0x146f: 0x94e1, - 0x1470: 0x9079, 0x1471: 0x9051, 0x1472: 0x90a1, 0x1473: 0x8211, 0x1474: 0x8059, 0x1475: 0x8081, - 0x1476: 0x80a9, 0x1477: 0x9491, 0x1478: 0x94b9, 0x1479: 0x94e1, 0x147a: 0x8211, 0x147b: 0x8239, - 0x147c: 0x95a9, 0x147d: 0x95a9, 0x147e: 0x0018, 0x147f: 0x0018, - // Block 0x52, offset 0x1480 - 0x1480: 0x0040, 0x1481: 0x0040, 0x1482: 0x0040, 0x1483: 0x0040, 0x1484: 0x0040, 0x1485: 0x0040, - 0x1486: 0x0040, 0x1487: 0x0040, 0x1488: 0x0040, 0x1489: 0x0040, 0x148a: 0x0040, 0x148b: 0x0040, - 0x148c: 0x0040, 0x148d: 0x0040, 0x148e: 0x0040, 0x148f: 0x0040, 0x1490: 0x95d1, 0x1491: 0x9609, - 0x1492: 0x9609, 0x1493: 0x9641, 0x1494: 0x9679, 0x1495: 0x96b1, 0x1496: 0x96e9, 0x1497: 0x9721, - 0x1498: 0x9759, 0x1499: 0x9759, 0x149a: 0x9791, 0x149b: 0x97c9, 0x149c: 0x9801, 0x149d: 0x9839, - 0x149e: 0x9871, 0x149f: 0x98a9, 0x14a0: 0x98a9, 0x14a1: 0x98e1, 0x14a2: 0x9919, 0x14a3: 0x9919, - 0x14a4: 0x9951, 0x14a5: 0x9951, 0x14a6: 0x9989, 0x14a7: 0x99c1, 0x14a8: 0x99c1, 0x14a9: 0x99f9, - 0x14aa: 0x9a31, 0x14ab: 0x9a31, 0x14ac: 0x9a69, 0x14ad: 0x9a69, 0x14ae: 0x9aa1, 0x14af: 0x9ad9, - 0x14b0: 0x9ad9, 0x14b1: 0x9b11, 0x14b2: 0x9b11, 0x14b3: 0x9b49, 0x14b4: 0x9b81, 0x14b5: 0x9bb9, - 0x14b6: 0x9bf1, 0x14b7: 0x9bf1, 0x14b8: 0x9c29, 0x14b9: 0x9c61, 0x14ba: 0x9c99, 0x14bb: 0x9cd1, - 0x14bc: 0x9d09, 0x14bd: 0x9d09, 0x14be: 0x9d41, 0x14bf: 0x9d79, - // Block 0x53, offset 0x14c0 - 0x14c0: 0xa949, 0x14c1: 0xa981, 0x14c2: 0xa9b9, 0x14c3: 0xa8a1, 0x14c4: 0x9bb9, 0x14c5: 0x9989, - 0x14c6: 0xa9f1, 0x14c7: 0xaa29, 0x14c8: 0x0040, 0x14c9: 0x0040, 0x14ca: 0x0040, 0x14cb: 0x0040, - 0x14cc: 0x0040, 0x14cd: 0x0040, 0x14ce: 0x0040, 0x14cf: 0x0040, 0x14d0: 0x0040, 0x14d1: 0x0040, - 0x14d2: 0x0040, 0x14d3: 0x0040, 0x14d4: 0x0040, 0x14d5: 0x0040, 0x14d6: 0x0040, 0x14d7: 0x0040, - 0x14d8: 0x0040, 0x14d9: 0x0040, 0x14da: 0x0040, 0x14db: 0x0040, 0x14dc: 0x0040, 0x14dd: 0x0040, - 0x14de: 0x0040, 0x14df: 0x0040, 0x14e0: 0x0040, 0x14e1: 0x0040, 0x14e2: 0x0040, 0x14e3: 0x0040, - 0x14e4: 0x0040, 0x14e5: 0x0040, 0x14e6: 0x0040, 0x14e7: 0x0040, 0x14e8: 0x0040, 0x14e9: 0x0040, - 0x14ea: 0x0040, 0x14eb: 0x0040, 0x14ec: 0x0040, 0x14ed: 0x0040, 0x14ee: 0x0040, 0x14ef: 0x0040, - 0x14f0: 0xaa61, 0x14f1: 0xaa99, 0x14f2: 0xaad1, 0x14f3: 0xab19, 0x14f4: 0xab61, 0x14f5: 0xaba9, - 0x14f6: 0xabf1, 0x14f7: 0xac39, 0x14f8: 0xac81, 0x14f9: 0xacc9, 0x14fa: 0xad02, 0x14fb: 0xae12, - 0x14fc: 0xae91, 0x14fd: 0x0018, 0x14fe: 0x0040, 0x14ff: 0x0040, - // Block 0x54, offset 0x1500 - 0x1500: 0x33c0, 0x1501: 0x33c0, 0x1502: 0x33c0, 0x1503: 0x33c0, 0x1504: 0x33c0, 0x1505: 0x33c0, - 0x1506: 0x33c0, 0x1507: 0x33c0, 0x1508: 0x33c0, 0x1509: 0x33c0, 0x150a: 0x33c0, 0x150b: 0x33c0, - 0x150c: 0x33c0, 0x150d: 0x33c0, 0x150e: 0x33c0, 0x150f: 0x33c0, 0x1510: 0xaeda, 0x1511: 0x7d55, - 0x1512: 0x0040, 0x1513: 0xaeea, 0x1514: 0x03c2, 0x1515: 0xaefa, 0x1516: 0xaf0a, 0x1517: 0x7d75, - 0x1518: 0x7d95, 0x1519: 0x0040, 0x151a: 0x0040, 0x151b: 0x0040, 0x151c: 0x0040, 0x151d: 0x0040, - 0x151e: 0x0040, 0x151f: 0x0040, 0x1520: 0x3308, 0x1521: 0x3308, 0x1522: 0x3308, 0x1523: 0x3308, - 0x1524: 0x3308, 0x1525: 0x3308, 0x1526: 0x3308, 0x1527: 0x3308, 0x1528: 0x3308, 0x1529: 0x3308, - 0x152a: 0x3308, 0x152b: 0x3308, 0x152c: 0x3308, 0x152d: 0x3308, 0x152e: 0x3308, 0x152f: 0x3308, - 0x1530: 0x0040, 0x1531: 0x7db5, 0x1532: 0x7dd5, 0x1533: 0xaf1a, 0x1534: 0xaf1a, 0x1535: 0x1fd2, - 0x1536: 0x1fe2, 0x1537: 0xaf2a, 0x1538: 0xaf3a, 0x1539: 0x7df5, 0x153a: 0x7e15, 0x153b: 0x7e35, - 0x153c: 0x7df5, 0x153d: 0x7e55, 0x153e: 0x7e75, 0x153f: 0x7e55, - // Block 0x55, offset 0x1540 - 0x1540: 0x7e95, 0x1541: 0x7eb5, 0x1542: 0x7ed5, 0x1543: 0x7eb5, 0x1544: 0x7ef5, 0x1545: 0x0018, - 0x1546: 0x0018, 0x1547: 0xaf4a, 0x1548: 0xaf5a, 0x1549: 0x7f16, 0x154a: 0x7f36, 0x154b: 0x7f56, - 0x154c: 0x7f76, 0x154d: 0xaf1a, 0x154e: 0xaf1a, 0x154f: 0xaf1a, 0x1550: 0xaeda, 0x1551: 0x7f95, - 0x1552: 0x0040, 0x1553: 0x0040, 0x1554: 0x03c2, 0x1555: 0xaeea, 0x1556: 0xaf0a, 0x1557: 0xaefa, - 0x1558: 0x7fb5, 0x1559: 0x1fd2, 0x155a: 0x1fe2, 0x155b: 0xaf2a, 0x155c: 0xaf3a, 0x155d: 0x7e95, - 0x155e: 0x7ef5, 0x155f: 0xaf6a, 0x1560: 0xaf7a, 0x1561: 0xaf8a, 0x1562: 0x1fb2, 0x1563: 0xaf99, - 0x1564: 0xafaa, 0x1565: 0xafba, 0x1566: 0x1fc2, 0x1567: 0x0040, 0x1568: 0xafca, 0x1569: 0xafda, - 0x156a: 0xafea, 0x156b: 0xaffa, 0x156c: 0x0040, 0x156d: 0x0040, 0x156e: 0x0040, 0x156f: 0x0040, - 0x1570: 0x7fd6, 0x1571: 0xb009, 0x1572: 0x7ff6, 0x1573: 0x0808, 0x1574: 0x8016, 0x1575: 0x0040, - 0x1576: 0x8036, 0x1577: 0xb031, 0x1578: 0x8056, 0x1579: 0xb059, 0x157a: 0x8076, 0x157b: 0xb081, - 0x157c: 0x8096, 0x157d: 0xb0a9, 0x157e: 0x80b6, 0x157f: 0xb0d1, - // Block 0x56, offset 0x1580 - 0x1580: 0xb0f9, 0x1581: 0xb111, 0x1582: 0xb111, 0x1583: 0xb129, 0x1584: 0xb129, 0x1585: 0xb141, - 0x1586: 0xb141, 0x1587: 0xb159, 0x1588: 0xb159, 0x1589: 0xb171, 0x158a: 0xb171, 0x158b: 0xb171, - 0x158c: 0xb171, 0x158d: 0xb189, 0x158e: 0xb189, 0x158f: 0xb1a1, 0x1590: 0xb1a1, 0x1591: 0xb1a1, - 0x1592: 0xb1a1, 0x1593: 0xb1b9, 0x1594: 0xb1b9, 0x1595: 0xb1d1, 0x1596: 0xb1d1, 0x1597: 0xb1d1, - 0x1598: 0xb1d1, 0x1599: 0xb1e9, 0x159a: 0xb1e9, 0x159b: 0xb1e9, 0x159c: 0xb1e9, 0x159d: 0xb201, - 0x159e: 0xb201, 0x159f: 0xb201, 0x15a0: 0xb201, 0x15a1: 0xb219, 0x15a2: 0xb219, 0x15a3: 0xb219, - 0x15a4: 0xb219, 0x15a5: 0xb231, 0x15a6: 0xb231, 0x15a7: 0xb231, 0x15a8: 0xb231, 0x15a9: 0xb249, - 0x15aa: 0xb249, 0x15ab: 0xb261, 0x15ac: 0xb261, 0x15ad: 0xb279, 0x15ae: 0xb279, 0x15af: 0xb291, - 0x15b0: 0xb291, 0x15b1: 0xb2a9, 0x15b2: 0xb2a9, 0x15b3: 0xb2a9, 0x15b4: 0xb2a9, 0x15b5: 0xb2c1, - 0x15b6: 0xb2c1, 0x15b7: 0xb2c1, 0x15b8: 0xb2c1, 0x15b9: 0xb2d9, 0x15ba: 0xb2d9, 0x15bb: 0xb2d9, - 0x15bc: 0xb2d9, 0x15bd: 0xb2f1, 0x15be: 0xb2f1, 0x15bf: 0xb2f1, - // Block 0x57, offset 0x15c0 - 0x15c0: 0xb2f1, 0x15c1: 0xb309, 0x15c2: 0xb309, 0x15c3: 0xb309, 0x15c4: 0xb309, 0x15c5: 0xb321, - 0x15c6: 0xb321, 0x15c7: 0xb321, 0x15c8: 0xb321, 0x15c9: 0xb339, 0x15ca: 0xb339, 0x15cb: 0xb339, - 0x15cc: 0xb339, 0x15cd: 0xb351, 0x15ce: 0xb351, 0x15cf: 0xb351, 0x15d0: 0xb351, 0x15d1: 0xb369, - 0x15d2: 0xb369, 0x15d3: 0xb369, 0x15d4: 0xb369, 0x15d5: 0xb381, 0x15d6: 0xb381, 0x15d7: 0xb381, - 0x15d8: 0xb381, 0x15d9: 0xb399, 0x15da: 0xb399, 0x15db: 0xb399, 0x15dc: 0xb399, 0x15dd: 0xb3b1, - 0x15de: 0xb3b1, 0x15df: 0xb3b1, 0x15e0: 0xb3b1, 0x15e1: 0xb3c9, 0x15e2: 0xb3c9, 0x15e3: 0xb3c9, - 0x15e4: 0xb3c9, 0x15e5: 0xb3e1, 0x15e6: 0xb3e1, 0x15e7: 0xb3e1, 0x15e8: 0xb3e1, 0x15e9: 0xb3f9, - 0x15ea: 0xb3f9, 0x15eb: 0xb3f9, 0x15ec: 0xb3f9, 0x15ed: 0xb411, 0x15ee: 0xb411, 0x15ef: 0x7ab1, - 0x15f0: 0x7ab1, 0x15f1: 0xb429, 0x15f2: 0xb429, 0x15f3: 0xb429, 0x15f4: 0xb429, 0x15f5: 0xb441, - 0x15f6: 0xb441, 0x15f7: 0xb469, 0x15f8: 0xb469, 0x15f9: 0xb491, 0x15fa: 0xb491, 0x15fb: 0xb4b9, - 0x15fc: 0xb4b9, 0x15fd: 0x0040, 0x15fe: 0x0040, 0x15ff: 0x03c0, - // Block 0x58, offset 0x1600 - 0x1600: 0x0040, 0x1601: 0xaefa, 0x1602: 0xb4e2, 0x1603: 0xaf6a, 0x1604: 0xafda, 0x1605: 0xafea, - 0x1606: 0xaf7a, 0x1607: 0xb4f2, 0x1608: 0x1fd2, 0x1609: 0x1fe2, 0x160a: 0xaf8a, 0x160b: 0x1fb2, - 0x160c: 0xaeda, 0x160d: 0xaf99, 0x160e: 0x29d1, 0x160f: 0xb502, 0x1610: 0x1f41, 0x1611: 0x00c9, - 0x1612: 0x0069, 0x1613: 0x0079, 0x1614: 0x1f51, 0x1615: 0x1f61, 0x1616: 0x1f71, 0x1617: 0x1f81, - 0x1618: 0x1f91, 0x1619: 0x1fa1, 0x161a: 0xaeea, 0x161b: 0x03c2, 0x161c: 0xafaa, 0x161d: 0x1fc2, - 0x161e: 0xafba, 0x161f: 0xaf0a, 0x1620: 0xaffa, 0x1621: 0x0039, 0x1622: 0x0ee9, 0x1623: 0x1159, - 0x1624: 0x0ef9, 0x1625: 0x0f09, 0x1626: 0x1199, 0x1627: 0x0f31, 0x1628: 0x0249, 0x1629: 0x0f41, - 0x162a: 0x0259, 0x162b: 0x0f51, 0x162c: 0x0359, 0x162d: 0x0f61, 0x162e: 0x0f71, 0x162f: 0x00d9, - 0x1630: 0x0f99, 0x1631: 0x2039, 0x1632: 0x0269, 0x1633: 0x01d9, 0x1634: 0x0fa9, 0x1635: 0x0fb9, - 0x1636: 0x1089, 0x1637: 0x0279, 0x1638: 0x0369, 0x1639: 0x0289, 0x163a: 0x13d1, 0x163b: 0xaf4a, - 0x163c: 0xafca, 0x163d: 0xaf5a, 0x163e: 0xb512, 0x163f: 0xaf1a, - // Block 0x59, offset 0x1640 - 0x1640: 0x1caa, 0x1641: 0x0039, 0x1642: 0x0ee9, 0x1643: 0x1159, 0x1644: 0x0ef9, 0x1645: 0x0f09, - 0x1646: 0x1199, 0x1647: 0x0f31, 0x1648: 0x0249, 0x1649: 0x0f41, 0x164a: 0x0259, 0x164b: 0x0f51, - 0x164c: 0x0359, 0x164d: 0x0f61, 0x164e: 0x0f71, 0x164f: 0x00d9, 0x1650: 0x0f99, 0x1651: 0x2039, - 0x1652: 0x0269, 0x1653: 0x01d9, 0x1654: 0x0fa9, 0x1655: 0x0fb9, 0x1656: 0x1089, 0x1657: 0x0279, - 0x1658: 0x0369, 0x1659: 0x0289, 0x165a: 0x13d1, 0x165b: 0xaf2a, 0x165c: 0xb522, 0x165d: 0xaf3a, - 0x165e: 0xb532, 0x165f: 0x80d5, 0x1660: 0x80f5, 0x1661: 0x29d1, 0x1662: 0x8115, 0x1663: 0x8115, - 0x1664: 0x8135, 0x1665: 0x8155, 0x1666: 0x8175, 0x1667: 0x8195, 0x1668: 0x81b5, 0x1669: 0x81d5, - 0x166a: 0x81f5, 0x166b: 0x8215, 0x166c: 0x8235, 0x166d: 0x8255, 0x166e: 0x8275, 0x166f: 0x8295, - 0x1670: 0x82b5, 0x1671: 0x82d5, 0x1672: 0x82f5, 0x1673: 0x8315, 0x1674: 0x8335, 0x1675: 0x8355, - 0x1676: 0x8375, 0x1677: 0x8395, 0x1678: 0x83b5, 0x1679: 0x83d5, 0x167a: 0x83f5, 0x167b: 0x8415, - 0x167c: 0x81b5, 0x167d: 0x8435, 0x167e: 0x8455, 0x167f: 0x8215, - // Block 0x5a, offset 0x1680 - 0x1680: 0x8475, 0x1681: 0x8495, 0x1682: 0x84b5, 0x1683: 0x84d5, 0x1684: 0x84f5, 0x1685: 0x8515, - 0x1686: 0x8535, 0x1687: 0x8555, 0x1688: 0x84d5, 0x1689: 0x8575, 0x168a: 0x84d5, 0x168b: 0x8595, - 0x168c: 0x8595, 0x168d: 0x85b5, 0x168e: 0x85b5, 0x168f: 0x85d5, 0x1690: 0x8515, 0x1691: 0x85f5, - 0x1692: 0x8615, 0x1693: 0x85f5, 0x1694: 0x8635, 0x1695: 0x8615, 0x1696: 0x8655, 0x1697: 0x8655, - 0x1698: 0x8675, 0x1699: 0x8675, 0x169a: 0x8695, 0x169b: 0x8695, 0x169c: 0x8615, 0x169d: 0x8115, - 0x169e: 0x86b5, 0x169f: 0x86d5, 0x16a0: 0x0040, 0x16a1: 0x86f5, 0x16a2: 0x8715, 0x16a3: 0x8735, - 0x16a4: 0x8755, 0x16a5: 0x8735, 0x16a6: 0x8775, 0x16a7: 0x8795, 0x16a8: 0x87b5, 0x16a9: 0x87b5, - 0x16aa: 0x87d5, 0x16ab: 0x87d5, 0x16ac: 0x87f5, 0x16ad: 0x87f5, 0x16ae: 0x87d5, 0x16af: 0x87d5, - 0x16b0: 0x8815, 0x16b1: 0x8835, 0x16b2: 0x8855, 0x16b3: 0x8875, 0x16b4: 0x8895, 0x16b5: 0x88b5, - 0x16b6: 0x88b5, 0x16b7: 0x88b5, 0x16b8: 0x88d5, 0x16b9: 0x88d5, 0x16ba: 0x88d5, 0x16bb: 0x88d5, - 0x16bc: 0x87b5, 0x16bd: 0x87b5, 0x16be: 0x87b5, 0x16bf: 0x0040, - // Block 0x5b, offset 0x16c0 - 0x16c0: 0x0040, 0x16c1: 0x0040, 0x16c2: 0x8715, 0x16c3: 0x86f5, 0x16c4: 0x88f5, 0x16c5: 0x86f5, - 0x16c6: 0x8715, 0x16c7: 0x86f5, 0x16c8: 0x0040, 0x16c9: 0x0040, 0x16ca: 0x8915, 0x16cb: 0x8715, - 0x16cc: 0x8935, 0x16cd: 0x88f5, 0x16ce: 0x8935, 0x16cf: 0x8715, 0x16d0: 0x0040, 0x16d1: 0x0040, - 0x16d2: 0x8955, 0x16d3: 0x8975, 0x16d4: 0x8875, 0x16d5: 0x8935, 0x16d6: 0x88f5, 0x16d7: 0x8935, - 0x16d8: 0x0040, 0x16d9: 0x0040, 0x16da: 0x8995, 0x16db: 0x89b5, 0x16dc: 0x8995, 0x16dd: 0x0040, - 0x16de: 0x0040, 0x16df: 0x0040, 0x16e0: 0xb541, 0x16e1: 0xb559, 0x16e2: 0xb571, 0x16e3: 0x89d6, - 0x16e4: 0xb589, 0x16e5: 0xb5a1, 0x16e6: 0x89f5, 0x16e7: 0x0040, 0x16e8: 0x8a15, 0x16e9: 0x8a35, - 0x16ea: 0x8a55, 0x16eb: 0x8a35, 0x16ec: 0x8a75, 0x16ed: 0x8a95, 0x16ee: 0x8ab5, 0x16ef: 0x0040, - 0x16f0: 0x0040, 0x16f1: 0x0040, 0x16f2: 0x0040, 0x16f3: 0x0040, 0x16f4: 0x0040, 0x16f5: 0x0040, - 0x16f6: 0x0040, 0x16f7: 0x0040, 0x16f8: 0x0040, 0x16f9: 0x0340, 0x16fa: 0x0340, 0x16fb: 0x0340, - 0x16fc: 0x0040, 0x16fd: 0x0040, 0x16fe: 0x0040, 0x16ff: 0x0040, - // Block 0x5c, offset 0x1700 - 0x1700: 0x0a08, 0x1701: 0x0a08, 0x1702: 0x0a08, 0x1703: 0x0a08, 0x1704: 0x0a08, 0x1705: 0x0c08, - 0x1706: 0x0808, 0x1707: 0x0c08, 0x1708: 0x0818, 0x1709: 0x0c08, 0x170a: 0x0c08, 0x170b: 0x0808, - 0x170c: 0x0808, 0x170d: 0x0908, 0x170e: 0x0c08, 0x170f: 0x0c08, 0x1710: 0x0c08, 0x1711: 0x0c08, - 0x1712: 0x0c08, 0x1713: 0x0a08, 0x1714: 0x0a08, 0x1715: 0x0a08, 0x1716: 0x0a08, 0x1717: 0x0908, - 0x1718: 0x0a08, 0x1719: 0x0a08, 0x171a: 0x0a08, 0x171b: 0x0a08, 0x171c: 0x0a08, 0x171d: 0x0c08, - 0x171e: 0x0a08, 0x171f: 0x0a08, 0x1720: 0x0a08, 0x1721: 0x0c08, 0x1722: 0x0808, 0x1723: 0x0808, - 0x1724: 0x0c08, 0x1725: 0x3308, 0x1726: 0x3308, 0x1727: 0x0040, 0x1728: 0x0040, 0x1729: 0x0040, - 0x172a: 0x0040, 0x172b: 0x0a18, 0x172c: 0x0a18, 0x172d: 0x0a18, 0x172e: 0x0a18, 0x172f: 0x0c18, - 0x1730: 0x0818, 0x1731: 0x0818, 0x1732: 0x0818, 0x1733: 0x0818, 0x1734: 0x0818, 0x1735: 0x0818, - 0x1736: 0x0818, 0x1737: 0x0040, 0x1738: 0x0040, 0x1739: 0x0040, 0x173a: 0x0040, 0x173b: 0x0040, - 0x173c: 0x0040, 0x173d: 0x0040, 0x173e: 0x0040, 0x173f: 0x0040, - // Block 0x5d, offset 0x1740 - 0x1740: 0x0a08, 0x1741: 0x0c08, 0x1742: 0x0a08, 0x1743: 0x0c08, 0x1744: 0x0c08, 0x1745: 0x0c08, - 0x1746: 0x0a08, 0x1747: 0x0a08, 0x1748: 0x0a08, 0x1749: 0x0c08, 0x174a: 0x0a08, 0x174b: 0x0a08, - 0x174c: 0x0c08, 0x174d: 0x0a08, 0x174e: 0x0c08, 0x174f: 0x0c08, 0x1750: 0x0a08, 0x1751: 0x0c08, - 0x1752: 0x0040, 0x1753: 0x0040, 0x1754: 0x0040, 0x1755: 0x0040, 0x1756: 0x0040, 0x1757: 0x0040, - 0x1758: 0x0040, 0x1759: 0x0818, 0x175a: 0x0818, 0x175b: 0x0818, 0x175c: 0x0818, 0x175d: 0x0040, - 0x175e: 0x0040, 0x175f: 0x0040, 0x1760: 0x0040, 0x1761: 0x0040, 0x1762: 0x0040, 0x1763: 0x0040, - 0x1764: 0x0040, 0x1765: 0x0040, 0x1766: 0x0040, 0x1767: 0x0040, 0x1768: 0x0040, 0x1769: 0x0c18, - 0x176a: 0x0c18, 0x176b: 0x0c18, 0x176c: 0x0c18, 0x176d: 0x0a18, 0x176e: 0x0a18, 0x176f: 0x0818, - 0x1770: 0x0040, 0x1771: 0x0040, 0x1772: 0x0040, 0x1773: 0x0040, 0x1774: 0x0040, 0x1775: 0x0040, - 0x1776: 0x0040, 0x1777: 0x0040, 0x1778: 0x0040, 0x1779: 0x0040, 0x177a: 0x0040, 0x177b: 0x0040, - 0x177c: 0x0040, 0x177d: 0x0040, 0x177e: 0x0040, 0x177f: 0x0040, - // Block 0x5e, offset 0x1780 - 0x1780: 0x3308, 0x1781: 0x3308, 0x1782: 0x3008, 0x1783: 0x3008, 0x1784: 0x0040, 0x1785: 0x0008, - 0x1786: 0x0008, 0x1787: 0x0008, 0x1788: 0x0008, 0x1789: 0x0008, 0x178a: 0x0008, 0x178b: 0x0008, - 0x178c: 0x0008, 0x178d: 0x0040, 0x178e: 0x0040, 0x178f: 0x0008, 0x1790: 0x0008, 0x1791: 0x0040, - 0x1792: 0x0040, 0x1793: 0x0008, 0x1794: 0x0008, 0x1795: 0x0008, 0x1796: 0x0008, 0x1797: 0x0008, - 0x1798: 0x0008, 0x1799: 0x0008, 0x179a: 0x0008, 0x179b: 0x0008, 0x179c: 0x0008, 0x179d: 0x0008, - 0x179e: 0x0008, 0x179f: 0x0008, 0x17a0: 0x0008, 0x17a1: 0x0008, 0x17a2: 0x0008, 0x17a3: 0x0008, - 0x17a4: 0x0008, 0x17a5: 0x0008, 0x17a6: 0x0008, 0x17a7: 0x0008, 0x17a8: 0x0008, 0x17a9: 0x0040, - 0x17aa: 0x0008, 0x17ab: 0x0008, 0x17ac: 0x0008, 0x17ad: 0x0008, 0x17ae: 0x0008, 0x17af: 0x0008, - 0x17b0: 0x0008, 0x17b1: 0x0040, 0x17b2: 0x0008, 0x17b3: 0x0008, 0x17b4: 0x0040, 0x17b5: 0x0008, - 0x17b6: 0x0008, 0x17b7: 0x0008, 0x17b8: 0x0008, 0x17b9: 0x0008, 0x17ba: 0x0040, 0x17bb: 0x0040, - 0x17bc: 0x3308, 0x17bd: 0x0008, 0x17be: 0x3008, 0x17bf: 0x3008, - // Block 0x5f, offset 0x17c0 - 0x17c0: 0x3308, 0x17c1: 0x3008, 0x17c2: 0x3008, 0x17c3: 0x3008, 0x17c4: 0x3008, 0x17c5: 0x0040, - 0x17c6: 0x0040, 0x17c7: 0x3008, 0x17c8: 0x3008, 0x17c9: 0x0040, 0x17ca: 0x0040, 0x17cb: 0x3008, - 0x17cc: 0x3008, 0x17cd: 0x3808, 0x17ce: 0x0040, 0x17cf: 0x0040, 0x17d0: 0x0008, 0x17d1: 0x0040, - 0x17d2: 0x0040, 0x17d3: 0x0040, 0x17d4: 0x0040, 0x17d5: 0x0040, 0x17d6: 0x0040, 0x17d7: 0x3008, - 0x17d8: 0x0040, 0x17d9: 0x0040, 0x17da: 0x0040, 0x17db: 0x0040, 0x17dc: 0x0040, 0x17dd: 0x0008, - 0x17de: 0x0008, 0x17df: 0x0008, 0x17e0: 0x0008, 0x17e1: 0x0008, 0x17e2: 0x3008, 0x17e3: 0x3008, - 0x17e4: 0x0040, 0x17e5: 0x0040, 0x17e6: 0x3308, 0x17e7: 0x3308, 0x17e8: 0x3308, 0x17e9: 0x3308, - 0x17ea: 0x3308, 0x17eb: 0x3308, 0x17ec: 0x3308, 0x17ed: 0x0040, 0x17ee: 0x0040, 0x17ef: 0x0040, - 0x17f0: 0x3308, 0x17f1: 0x3308, 0x17f2: 0x3308, 0x17f3: 0x3308, 0x17f4: 0x3308, 0x17f5: 0x0040, - 0x17f6: 0x0040, 0x17f7: 0x0040, 0x17f8: 0x0040, 0x17f9: 0x0040, 0x17fa: 0x0040, 0x17fb: 0x0040, - 0x17fc: 0x0040, 0x17fd: 0x0040, 0x17fe: 0x0040, 0x17ff: 0x0040, - // Block 0x60, offset 0x1800 - 0x1800: 0x0039, 0x1801: 0x0ee9, 0x1802: 0x1159, 0x1803: 0x0ef9, 0x1804: 0x0f09, 0x1805: 0x1199, - 0x1806: 0x0f31, 0x1807: 0x0249, 0x1808: 0x0f41, 0x1809: 0x0259, 0x180a: 0x0f51, 0x180b: 0x0359, - 0x180c: 0x0f61, 0x180d: 0x0f71, 0x180e: 0x00d9, 0x180f: 0x0f99, 0x1810: 0x2039, 0x1811: 0x0269, - 0x1812: 0x01d9, 0x1813: 0x0fa9, 0x1814: 0x0fb9, 0x1815: 0x1089, 0x1816: 0x0279, 0x1817: 0x0369, - 0x1818: 0x0289, 0x1819: 0x13d1, 0x181a: 0x0039, 0x181b: 0x0ee9, 0x181c: 0x1159, 0x181d: 0x0ef9, - 0x181e: 0x0f09, 0x181f: 0x1199, 0x1820: 0x0f31, 0x1821: 0x0249, 0x1822: 0x0f41, 0x1823: 0x0259, - 0x1824: 0x0f51, 0x1825: 0x0359, 0x1826: 0x0f61, 0x1827: 0x0f71, 0x1828: 0x00d9, 0x1829: 0x0f99, - 0x182a: 0x2039, 0x182b: 0x0269, 0x182c: 0x01d9, 0x182d: 0x0fa9, 0x182e: 0x0fb9, 0x182f: 0x1089, - 0x1830: 0x0279, 0x1831: 0x0369, 0x1832: 0x0289, 0x1833: 0x13d1, 0x1834: 0x0039, 0x1835: 0x0ee9, - 0x1836: 0x1159, 0x1837: 0x0ef9, 0x1838: 0x0f09, 0x1839: 0x1199, 0x183a: 0x0f31, 0x183b: 0x0249, - 0x183c: 0x0f41, 0x183d: 0x0259, 0x183e: 0x0f51, 0x183f: 0x0359, - // Block 0x61, offset 0x1840 - 0x1840: 0x0f61, 0x1841: 0x0f71, 0x1842: 0x00d9, 0x1843: 0x0f99, 0x1844: 0x2039, 0x1845: 0x0269, - 0x1846: 0x01d9, 0x1847: 0x0fa9, 0x1848: 0x0fb9, 0x1849: 0x1089, 0x184a: 0x0279, 0x184b: 0x0369, - 0x184c: 0x0289, 0x184d: 0x13d1, 0x184e: 0x0039, 0x184f: 0x0ee9, 0x1850: 0x1159, 0x1851: 0x0ef9, - 0x1852: 0x0f09, 0x1853: 0x1199, 0x1854: 0x0f31, 0x1855: 0x0040, 0x1856: 0x0f41, 0x1857: 0x0259, - 0x1858: 0x0f51, 0x1859: 0x0359, 0x185a: 0x0f61, 0x185b: 0x0f71, 0x185c: 0x00d9, 0x185d: 0x0f99, - 0x185e: 0x2039, 0x185f: 0x0269, 0x1860: 0x01d9, 0x1861: 0x0fa9, 0x1862: 0x0fb9, 0x1863: 0x1089, - 0x1864: 0x0279, 0x1865: 0x0369, 0x1866: 0x0289, 0x1867: 0x13d1, 0x1868: 0x0039, 0x1869: 0x0ee9, - 0x186a: 0x1159, 0x186b: 0x0ef9, 0x186c: 0x0f09, 0x186d: 0x1199, 0x186e: 0x0f31, 0x186f: 0x0249, - 0x1870: 0x0f41, 0x1871: 0x0259, 0x1872: 0x0f51, 0x1873: 0x0359, 0x1874: 0x0f61, 0x1875: 0x0f71, - 0x1876: 0x00d9, 0x1877: 0x0f99, 0x1878: 0x2039, 0x1879: 0x0269, 0x187a: 0x01d9, 0x187b: 0x0fa9, - 0x187c: 0x0fb9, 0x187d: 0x1089, 0x187e: 0x0279, 0x187f: 0x0369, - // Block 0x62, offset 0x1880 - 0x1880: 0x0289, 0x1881: 0x13d1, 0x1882: 0x0039, 0x1883: 0x0ee9, 0x1884: 0x1159, 0x1885: 0x0ef9, - 0x1886: 0x0f09, 0x1887: 0x1199, 0x1888: 0x0f31, 0x1889: 0x0249, 0x188a: 0x0f41, 0x188b: 0x0259, - 0x188c: 0x0f51, 0x188d: 0x0359, 0x188e: 0x0f61, 0x188f: 0x0f71, 0x1890: 0x00d9, 0x1891: 0x0f99, - 0x1892: 0x2039, 0x1893: 0x0269, 0x1894: 0x01d9, 0x1895: 0x0fa9, 0x1896: 0x0fb9, 0x1897: 0x1089, - 0x1898: 0x0279, 0x1899: 0x0369, 0x189a: 0x0289, 0x189b: 0x13d1, 0x189c: 0x0039, 0x189d: 0x0040, - 0x189e: 0x1159, 0x189f: 0x0ef9, 0x18a0: 0x0040, 0x18a1: 0x0040, 0x18a2: 0x0f31, 0x18a3: 0x0040, - 0x18a4: 0x0040, 0x18a5: 0x0259, 0x18a6: 0x0f51, 0x18a7: 0x0040, 0x18a8: 0x0040, 0x18a9: 0x0f71, - 0x18aa: 0x00d9, 0x18ab: 0x0f99, 0x18ac: 0x2039, 0x18ad: 0x0040, 0x18ae: 0x01d9, 0x18af: 0x0fa9, - 0x18b0: 0x0fb9, 0x18b1: 0x1089, 0x18b2: 0x0279, 0x18b3: 0x0369, 0x18b4: 0x0289, 0x18b5: 0x13d1, - 0x18b6: 0x0039, 0x18b7: 0x0ee9, 0x18b8: 0x1159, 0x18b9: 0x0ef9, 0x18ba: 0x0040, 0x18bb: 0x1199, - 0x18bc: 0x0040, 0x18bd: 0x0249, 0x18be: 0x0f41, 0x18bf: 0x0259, - // Block 0x63, offset 0x18c0 - 0x18c0: 0x0f51, 0x18c1: 0x0359, 0x18c2: 0x0f61, 0x18c3: 0x0f71, 0x18c4: 0x0040, 0x18c5: 0x0f99, - 0x18c6: 0x2039, 0x18c7: 0x0269, 0x18c8: 0x01d9, 0x18c9: 0x0fa9, 0x18ca: 0x0fb9, 0x18cb: 0x1089, - 0x18cc: 0x0279, 0x18cd: 0x0369, 0x18ce: 0x0289, 0x18cf: 0x13d1, 0x18d0: 0x0039, 0x18d1: 0x0ee9, - 0x18d2: 0x1159, 0x18d3: 0x0ef9, 0x18d4: 0x0f09, 0x18d5: 0x1199, 0x18d6: 0x0f31, 0x18d7: 0x0249, - 0x18d8: 0x0f41, 0x18d9: 0x0259, 0x18da: 0x0f51, 0x18db: 0x0359, 0x18dc: 0x0f61, 0x18dd: 0x0f71, - 0x18de: 0x00d9, 0x18df: 0x0f99, 0x18e0: 0x2039, 0x18e1: 0x0269, 0x18e2: 0x01d9, 0x18e3: 0x0fa9, - 0x18e4: 0x0fb9, 0x18e5: 0x1089, 0x18e6: 0x0279, 0x18e7: 0x0369, 0x18e8: 0x0289, 0x18e9: 0x13d1, - 0x18ea: 0x0039, 0x18eb: 0x0ee9, 0x18ec: 0x1159, 0x18ed: 0x0ef9, 0x18ee: 0x0f09, 0x18ef: 0x1199, - 0x18f0: 0x0f31, 0x18f1: 0x0249, 0x18f2: 0x0f41, 0x18f3: 0x0259, 0x18f4: 0x0f51, 0x18f5: 0x0359, - 0x18f6: 0x0f61, 0x18f7: 0x0f71, 0x18f8: 0x00d9, 0x18f9: 0x0f99, 0x18fa: 0x2039, 0x18fb: 0x0269, - 0x18fc: 0x01d9, 0x18fd: 0x0fa9, 0x18fe: 0x0fb9, 0x18ff: 0x1089, - // Block 0x64, offset 0x1900 - 0x1900: 0x0279, 0x1901: 0x0369, 0x1902: 0x0289, 0x1903: 0x13d1, 0x1904: 0x0039, 0x1905: 0x0ee9, - 0x1906: 0x0040, 0x1907: 0x0ef9, 0x1908: 0x0f09, 0x1909: 0x1199, 0x190a: 0x0f31, 0x190b: 0x0040, - 0x190c: 0x0040, 0x190d: 0x0259, 0x190e: 0x0f51, 0x190f: 0x0359, 0x1910: 0x0f61, 0x1911: 0x0f71, - 0x1912: 0x00d9, 0x1913: 0x0f99, 0x1914: 0x2039, 0x1915: 0x0040, 0x1916: 0x01d9, 0x1917: 0x0fa9, - 0x1918: 0x0fb9, 0x1919: 0x1089, 0x191a: 0x0279, 0x191b: 0x0369, 0x191c: 0x0289, 0x191d: 0x0040, - 0x191e: 0x0039, 0x191f: 0x0ee9, 0x1920: 0x1159, 0x1921: 0x0ef9, 0x1922: 0x0f09, 0x1923: 0x1199, - 0x1924: 0x0f31, 0x1925: 0x0249, 0x1926: 0x0f41, 0x1927: 0x0259, 0x1928: 0x0f51, 0x1929: 0x0359, - 0x192a: 0x0f61, 0x192b: 0x0f71, 0x192c: 0x00d9, 0x192d: 0x0f99, 0x192e: 0x2039, 0x192f: 0x0269, - 0x1930: 0x01d9, 0x1931: 0x0fa9, 0x1932: 0x0fb9, 0x1933: 0x1089, 0x1934: 0x0279, 0x1935: 0x0369, - 0x1936: 0x0289, 0x1937: 0x13d1, 0x1938: 0x0039, 0x1939: 0x0ee9, 0x193a: 0x0040, 0x193b: 0x0ef9, - 0x193c: 0x0f09, 0x193d: 0x1199, 0x193e: 0x0f31, 0x193f: 0x0040, - // Block 0x65, offset 0x1940 - 0x1940: 0x0f41, 0x1941: 0x0259, 0x1942: 0x0f51, 0x1943: 0x0359, 0x1944: 0x0f61, 0x1945: 0x0040, - 0x1946: 0x00d9, 0x1947: 0x0040, 0x1948: 0x0040, 0x1949: 0x0040, 0x194a: 0x01d9, 0x194b: 0x0fa9, - 0x194c: 0x0fb9, 0x194d: 0x1089, 0x194e: 0x0279, 0x194f: 0x0369, 0x1950: 0x0289, 0x1951: 0x0040, - 0x1952: 0x0039, 0x1953: 0x0ee9, 0x1954: 0x1159, 0x1955: 0x0ef9, 0x1956: 0x0f09, 0x1957: 0x1199, - 0x1958: 0x0f31, 0x1959: 0x0249, 0x195a: 0x0f41, 0x195b: 0x0259, 0x195c: 0x0f51, 0x195d: 0x0359, - 0x195e: 0x0f61, 0x195f: 0x0f71, 0x1960: 0x00d9, 0x1961: 0x0f99, 0x1962: 0x2039, 0x1963: 0x0269, - 0x1964: 0x01d9, 0x1965: 0x0fa9, 0x1966: 0x0fb9, 0x1967: 0x1089, 0x1968: 0x0279, 0x1969: 0x0369, - 0x196a: 0x0289, 0x196b: 0x13d1, 0x196c: 0x0039, 0x196d: 0x0ee9, 0x196e: 0x1159, 0x196f: 0x0ef9, - 0x1970: 0x0f09, 0x1971: 0x1199, 0x1972: 0x0f31, 0x1973: 0x0249, 0x1974: 0x0f41, 0x1975: 0x0259, - 0x1976: 0x0f51, 0x1977: 0x0359, 0x1978: 0x0f61, 0x1979: 0x0f71, 0x197a: 0x00d9, 0x197b: 0x0f99, - 0x197c: 0x2039, 0x197d: 0x0269, 0x197e: 0x01d9, 0x197f: 0x0fa9, - // Block 0x66, offset 0x1980 - 0x1980: 0x0fb9, 0x1981: 0x1089, 0x1982: 0x0279, 0x1983: 0x0369, 0x1984: 0x0289, 0x1985: 0x13d1, - 0x1986: 0x0039, 0x1987: 0x0ee9, 0x1988: 0x1159, 0x1989: 0x0ef9, 0x198a: 0x0f09, 0x198b: 0x1199, - 0x198c: 0x0f31, 0x198d: 0x0249, 0x198e: 0x0f41, 0x198f: 0x0259, 0x1990: 0x0f51, 0x1991: 0x0359, - 0x1992: 0x0f61, 0x1993: 0x0f71, 0x1994: 0x00d9, 0x1995: 0x0f99, 0x1996: 0x2039, 0x1997: 0x0269, - 0x1998: 0x01d9, 0x1999: 0x0fa9, 0x199a: 0x0fb9, 0x199b: 0x1089, 0x199c: 0x0279, 0x199d: 0x0369, - 0x199e: 0x0289, 0x199f: 0x13d1, 0x19a0: 0x0039, 0x19a1: 0x0ee9, 0x19a2: 0x1159, 0x19a3: 0x0ef9, - 0x19a4: 0x0f09, 0x19a5: 0x1199, 0x19a6: 0x0f31, 0x19a7: 0x0249, 0x19a8: 0x0f41, 0x19a9: 0x0259, - 0x19aa: 0x0f51, 0x19ab: 0x0359, 0x19ac: 0x0f61, 0x19ad: 0x0f71, 0x19ae: 0x00d9, 0x19af: 0x0f99, - 0x19b0: 0x2039, 0x19b1: 0x0269, 0x19b2: 0x01d9, 0x19b3: 0x0fa9, 0x19b4: 0x0fb9, 0x19b5: 0x1089, - 0x19b6: 0x0279, 0x19b7: 0x0369, 0x19b8: 0x0289, 0x19b9: 0x13d1, 0x19ba: 0x0039, 0x19bb: 0x0ee9, - 0x19bc: 0x1159, 0x19bd: 0x0ef9, 0x19be: 0x0f09, 0x19bf: 0x1199, - // Block 0x67, offset 0x19c0 - 0x19c0: 0x0f31, 0x19c1: 0x0249, 0x19c2: 0x0f41, 0x19c3: 0x0259, 0x19c4: 0x0f51, 0x19c5: 0x0359, - 0x19c6: 0x0f61, 0x19c7: 0x0f71, 0x19c8: 0x00d9, 0x19c9: 0x0f99, 0x19ca: 0x2039, 0x19cb: 0x0269, - 0x19cc: 0x01d9, 0x19cd: 0x0fa9, 0x19ce: 0x0fb9, 0x19cf: 0x1089, 0x19d0: 0x0279, 0x19d1: 0x0369, - 0x19d2: 0x0289, 0x19d3: 0x13d1, 0x19d4: 0x0039, 0x19d5: 0x0ee9, 0x19d6: 0x1159, 0x19d7: 0x0ef9, - 0x19d8: 0x0f09, 0x19d9: 0x1199, 0x19da: 0x0f31, 0x19db: 0x0249, 0x19dc: 0x0f41, 0x19dd: 0x0259, - 0x19de: 0x0f51, 0x19df: 0x0359, 0x19e0: 0x0f61, 0x19e1: 0x0f71, 0x19e2: 0x00d9, 0x19e3: 0x0f99, - 0x19e4: 0x2039, 0x19e5: 0x0269, 0x19e6: 0x01d9, 0x19e7: 0x0fa9, 0x19e8: 0x0fb9, 0x19e9: 0x1089, - 0x19ea: 0x0279, 0x19eb: 0x0369, 0x19ec: 0x0289, 0x19ed: 0x13d1, 0x19ee: 0x0039, 0x19ef: 0x0ee9, - 0x19f0: 0x1159, 0x19f1: 0x0ef9, 0x19f2: 0x0f09, 0x19f3: 0x1199, 0x19f4: 0x0f31, 0x19f5: 0x0249, - 0x19f6: 0x0f41, 0x19f7: 0x0259, 0x19f8: 0x0f51, 0x19f9: 0x0359, 0x19fa: 0x0f61, 0x19fb: 0x0f71, - 0x19fc: 0x00d9, 0x19fd: 0x0f99, 0x19fe: 0x2039, 0x19ff: 0x0269, - // Block 0x68, offset 0x1a00 - 0x1a00: 0x01d9, 0x1a01: 0x0fa9, 0x1a02: 0x0fb9, 0x1a03: 0x1089, 0x1a04: 0x0279, 0x1a05: 0x0369, - 0x1a06: 0x0289, 0x1a07: 0x13d1, 0x1a08: 0x0039, 0x1a09: 0x0ee9, 0x1a0a: 0x1159, 0x1a0b: 0x0ef9, - 0x1a0c: 0x0f09, 0x1a0d: 0x1199, 0x1a0e: 0x0f31, 0x1a0f: 0x0249, 0x1a10: 0x0f41, 0x1a11: 0x0259, - 0x1a12: 0x0f51, 0x1a13: 0x0359, 0x1a14: 0x0f61, 0x1a15: 0x0f71, 0x1a16: 0x00d9, 0x1a17: 0x0f99, - 0x1a18: 0x2039, 0x1a19: 0x0269, 0x1a1a: 0x01d9, 0x1a1b: 0x0fa9, 0x1a1c: 0x0fb9, 0x1a1d: 0x1089, - 0x1a1e: 0x0279, 0x1a1f: 0x0369, 0x1a20: 0x0289, 0x1a21: 0x13d1, 0x1a22: 0x0039, 0x1a23: 0x0ee9, - 0x1a24: 0x1159, 0x1a25: 0x0ef9, 0x1a26: 0x0f09, 0x1a27: 0x1199, 0x1a28: 0x0f31, 0x1a29: 0x0249, - 0x1a2a: 0x0f41, 0x1a2b: 0x0259, 0x1a2c: 0x0f51, 0x1a2d: 0x0359, 0x1a2e: 0x0f61, 0x1a2f: 0x0f71, - 0x1a30: 0x00d9, 0x1a31: 0x0f99, 0x1a32: 0x2039, 0x1a33: 0x0269, 0x1a34: 0x01d9, 0x1a35: 0x0fa9, - 0x1a36: 0x0fb9, 0x1a37: 0x1089, 0x1a38: 0x0279, 0x1a39: 0x0369, 0x1a3a: 0x0289, 0x1a3b: 0x13d1, - 0x1a3c: 0x0039, 0x1a3d: 0x0ee9, 0x1a3e: 0x1159, 0x1a3f: 0x0ef9, - // Block 0x69, offset 0x1a40 - 0x1a40: 0x0f09, 0x1a41: 0x1199, 0x1a42: 0x0f31, 0x1a43: 0x0249, 0x1a44: 0x0f41, 0x1a45: 0x0259, - 0x1a46: 0x0f51, 0x1a47: 0x0359, 0x1a48: 0x0f61, 0x1a49: 0x0f71, 0x1a4a: 0x00d9, 0x1a4b: 0x0f99, - 0x1a4c: 0x2039, 0x1a4d: 0x0269, 0x1a4e: 0x01d9, 0x1a4f: 0x0fa9, 0x1a50: 0x0fb9, 0x1a51: 0x1089, - 0x1a52: 0x0279, 0x1a53: 0x0369, 0x1a54: 0x0289, 0x1a55: 0x13d1, 0x1a56: 0x0039, 0x1a57: 0x0ee9, - 0x1a58: 0x1159, 0x1a59: 0x0ef9, 0x1a5a: 0x0f09, 0x1a5b: 0x1199, 0x1a5c: 0x0f31, 0x1a5d: 0x0249, - 0x1a5e: 0x0f41, 0x1a5f: 0x0259, 0x1a60: 0x0f51, 0x1a61: 0x0359, 0x1a62: 0x0f61, 0x1a63: 0x0f71, - 0x1a64: 0x00d9, 0x1a65: 0x0f99, 0x1a66: 0x2039, 0x1a67: 0x0269, 0x1a68: 0x01d9, 0x1a69: 0x0fa9, - 0x1a6a: 0x0fb9, 0x1a6b: 0x1089, 0x1a6c: 0x0279, 0x1a6d: 0x0369, 0x1a6e: 0x0289, 0x1a6f: 0x13d1, - 0x1a70: 0x0039, 0x1a71: 0x0ee9, 0x1a72: 0x1159, 0x1a73: 0x0ef9, 0x1a74: 0x0f09, 0x1a75: 0x1199, - 0x1a76: 0x0f31, 0x1a77: 0x0249, 0x1a78: 0x0f41, 0x1a79: 0x0259, 0x1a7a: 0x0f51, 0x1a7b: 0x0359, - 0x1a7c: 0x0f61, 0x1a7d: 0x0f71, 0x1a7e: 0x00d9, 0x1a7f: 0x0f99, - // Block 0x6a, offset 0x1a80 - 0x1a80: 0x2039, 0x1a81: 0x0269, 0x1a82: 0x01d9, 0x1a83: 0x0fa9, 0x1a84: 0x0fb9, 0x1a85: 0x1089, - 0x1a86: 0x0279, 0x1a87: 0x0369, 0x1a88: 0x0289, 0x1a89: 0x13d1, 0x1a8a: 0x0039, 0x1a8b: 0x0ee9, - 0x1a8c: 0x1159, 0x1a8d: 0x0ef9, 0x1a8e: 0x0f09, 0x1a8f: 0x1199, 0x1a90: 0x0f31, 0x1a91: 0x0249, - 0x1a92: 0x0f41, 0x1a93: 0x0259, 0x1a94: 0x0f51, 0x1a95: 0x0359, 0x1a96: 0x0f61, 0x1a97: 0x0f71, - 0x1a98: 0x00d9, 0x1a99: 0x0f99, 0x1a9a: 0x2039, 0x1a9b: 0x0269, 0x1a9c: 0x01d9, 0x1a9d: 0x0fa9, - 0x1a9e: 0x0fb9, 0x1a9f: 0x1089, 0x1aa0: 0x0279, 0x1aa1: 0x0369, 0x1aa2: 0x0289, 0x1aa3: 0x13d1, - 0x1aa4: 0xba81, 0x1aa5: 0xba99, 0x1aa6: 0x0040, 0x1aa7: 0x0040, 0x1aa8: 0xbab1, 0x1aa9: 0x1099, - 0x1aaa: 0x10b1, 0x1aab: 0x10c9, 0x1aac: 0xbac9, 0x1aad: 0xbae1, 0x1aae: 0xbaf9, 0x1aaf: 0x1429, - 0x1ab0: 0x1a31, 0x1ab1: 0xbb11, 0x1ab2: 0xbb29, 0x1ab3: 0xbb41, 0x1ab4: 0xbb59, 0x1ab5: 0xbb71, - 0x1ab6: 0xbb89, 0x1ab7: 0x2109, 0x1ab8: 0x1111, 0x1ab9: 0x1429, 0x1aba: 0xbba1, 0x1abb: 0xbbb9, - 0x1abc: 0xbbd1, 0x1abd: 0x10e1, 0x1abe: 0x10f9, 0x1abf: 0xbbe9, - // Block 0x6b, offset 0x1ac0 - 0x1ac0: 0x2079, 0x1ac1: 0xbc01, 0x1ac2: 0xbab1, 0x1ac3: 0x1099, 0x1ac4: 0x10b1, 0x1ac5: 0x10c9, - 0x1ac6: 0xbac9, 0x1ac7: 0xbae1, 0x1ac8: 0xbaf9, 0x1ac9: 0x1429, 0x1aca: 0x1a31, 0x1acb: 0xbb11, - 0x1acc: 0xbb29, 0x1acd: 0xbb41, 0x1ace: 0xbb59, 0x1acf: 0xbb71, 0x1ad0: 0xbb89, 0x1ad1: 0x2109, - 0x1ad2: 0x1111, 0x1ad3: 0xbba1, 0x1ad4: 0xbba1, 0x1ad5: 0xbbb9, 0x1ad6: 0xbbd1, 0x1ad7: 0x10e1, - 0x1ad8: 0x10f9, 0x1ad9: 0xbbe9, 0x1ada: 0x2079, 0x1adb: 0xbc21, 0x1adc: 0xbac9, 0x1add: 0x1429, - 0x1ade: 0xbb11, 0x1adf: 0x10e1, 0x1ae0: 0x1111, 0x1ae1: 0x2109, 0x1ae2: 0xbab1, 0x1ae3: 0x1099, - 0x1ae4: 0x10b1, 0x1ae5: 0x10c9, 0x1ae6: 0xbac9, 0x1ae7: 0xbae1, 0x1ae8: 0xbaf9, 0x1ae9: 0x1429, - 0x1aea: 0x1a31, 0x1aeb: 0xbb11, 0x1aec: 0xbb29, 0x1aed: 0xbb41, 0x1aee: 0xbb59, 0x1aef: 0xbb71, - 0x1af0: 0xbb89, 0x1af1: 0x2109, 0x1af2: 0x1111, 0x1af3: 0x1429, 0x1af4: 0xbba1, 0x1af5: 0xbbb9, - 0x1af6: 0xbbd1, 0x1af7: 0x10e1, 0x1af8: 0x10f9, 0x1af9: 0xbbe9, 0x1afa: 0x2079, 0x1afb: 0xbc01, - 0x1afc: 0xbab1, 0x1afd: 0x1099, 0x1afe: 0x10b1, 0x1aff: 0x10c9, - // Block 0x6c, offset 0x1b00 - 0x1b00: 0xbac9, 0x1b01: 0xbae1, 0x1b02: 0xbaf9, 0x1b03: 0x1429, 0x1b04: 0x1a31, 0x1b05: 0xbb11, - 0x1b06: 0xbb29, 0x1b07: 0xbb41, 0x1b08: 0xbb59, 0x1b09: 0xbb71, 0x1b0a: 0xbb89, 0x1b0b: 0x2109, - 0x1b0c: 0x1111, 0x1b0d: 0xbba1, 0x1b0e: 0xbba1, 0x1b0f: 0xbbb9, 0x1b10: 0xbbd1, 0x1b11: 0x10e1, - 0x1b12: 0x10f9, 0x1b13: 0xbbe9, 0x1b14: 0x2079, 0x1b15: 0xbc21, 0x1b16: 0xbac9, 0x1b17: 0x1429, - 0x1b18: 0xbb11, 0x1b19: 0x10e1, 0x1b1a: 0x1111, 0x1b1b: 0x2109, 0x1b1c: 0xbab1, 0x1b1d: 0x1099, - 0x1b1e: 0x10b1, 0x1b1f: 0x10c9, 0x1b20: 0xbac9, 0x1b21: 0xbae1, 0x1b22: 0xbaf9, 0x1b23: 0x1429, - 0x1b24: 0x1a31, 0x1b25: 0xbb11, 0x1b26: 0xbb29, 0x1b27: 0xbb41, 0x1b28: 0xbb59, 0x1b29: 0xbb71, - 0x1b2a: 0xbb89, 0x1b2b: 0x2109, 0x1b2c: 0x1111, 0x1b2d: 0x1429, 0x1b2e: 0xbba1, 0x1b2f: 0xbbb9, - 0x1b30: 0xbbd1, 0x1b31: 0x10e1, 0x1b32: 0x10f9, 0x1b33: 0xbbe9, 0x1b34: 0x2079, 0x1b35: 0xbc01, - 0x1b36: 0xbab1, 0x1b37: 0x1099, 0x1b38: 0x10b1, 0x1b39: 0x10c9, 0x1b3a: 0xbac9, 0x1b3b: 0xbae1, - 0x1b3c: 0xbaf9, 0x1b3d: 0x1429, 0x1b3e: 0x1a31, 0x1b3f: 0xbb11, - // Block 0x6d, offset 0x1b40 - 0x1b40: 0xbb29, 0x1b41: 0xbb41, 0x1b42: 0xbb59, 0x1b43: 0xbb71, 0x1b44: 0xbb89, 0x1b45: 0x2109, - 0x1b46: 0x1111, 0x1b47: 0xbba1, 0x1b48: 0xbba1, 0x1b49: 0xbbb9, 0x1b4a: 0xbbd1, 0x1b4b: 0x10e1, - 0x1b4c: 0x10f9, 0x1b4d: 0xbbe9, 0x1b4e: 0x2079, 0x1b4f: 0xbc21, 0x1b50: 0xbac9, 0x1b51: 0x1429, - 0x1b52: 0xbb11, 0x1b53: 0x10e1, 0x1b54: 0x1111, 0x1b55: 0x2109, 0x1b56: 0xbab1, 0x1b57: 0x1099, - 0x1b58: 0x10b1, 0x1b59: 0x10c9, 0x1b5a: 0xbac9, 0x1b5b: 0xbae1, 0x1b5c: 0xbaf9, 0x1b5d: 0x1429, - 0x1b5e: 0x1a31, 0x1b5f: 0xbb11, 0x1b60: 0xbb29, 0x1b61: 0xbb41, 0x1b62: 0xbb59, 0x1b63: 0xbb71, - 0x1b64: 0xbb89, 0x1b65: 0x2109, 0x1b66: 0x1111, 0x1b67: 0x1429, 0x1b68: 0xbba1, 0x1b69: 0xbbb9, - 0x1b6a: 0xbbd1, 0x1b6b: 0x10e1, 0x1b6c: 0x10f9, 0x1b6d: 0xbbe9, 0x1b6e: 0x2079, 0x1b6f: 0xbc01, - 0x1b70: 0xbab1, 0x1b71: 0x1099, 0x1b72: 0x10b1, 0x1b73: 0x10c9, 0x1b74: 0xbac9, 0x1b75: 0xbae1, - 0x1b76: 0xbaf9, 0x1b77: 0x1429, 0x1b78: 0x1a31, 0x1b79: 0xbb11, 0x1b7a: 0xbb29, 0x1b7b: 0xbb41, - 0x1b7c: 0xbb59, 0x1b7d: 0xbb71, 0x1b7e: 0xbb89, 0x1b7f: 0x2109, - // Block 0x6e, offset 0x1b80 - 0x1b80: 0x1111, 0x1b81: 0xbba1, 0x1b82: 0xbba1, 0x1b83: 0xbbb9, 0x1b84: 0xbbd1, 0x1b85: 0x10e1, - 0x1b86: 0x10f9, 0x1b87: 0xbbe9, 0x1b88: 0x2079, 0x1b89: 0xbc21, 0x1b8a: 0xbac9, 0x1b8b: 0x1429, - 0x1b8c: 0xbb11, 0x1b8d: 0x10e1, 0x1b8e: 0x1111, 0x1b8f: 0x2109, 0x1b90: 0xbab1, 0x1b91: 0x1099, - 0x1b92: 0x10b1, 0x1b93: 0x10c9, 0x1b94: 0xbac9, 0x1b95: 0xbae1, 0x1b96: 0xbaf9, 0x1b97: 0x1429, - 0x1b98: 0x1a31, 0x1b99: 0xbb11, 0x1b9a: 0xbb29, 0x1b9b: 0xbb41, 0x1b9c: 0xbb59, 0x1b9d: 0xbb71, - 0x1b9e: 0xbb89, 0x1b9f: 0x2109, 0x1ba0: 0x1111, 0x1ba1: 0x1429, 0x1ba2: 0xbba1, 0x1ba3: 0xbbb9, - 0x1ba4: 0xbbd1, 0x1ba5: 0x10e1, 0x1ba6: 0x10f9, 0x1ba7: 0xbbe9, 0x1ba8: 0x2079, 0x1ba9: 0xbc01, - 0x1baa: 0xbab1, 0x1bab: 0x1099, 0x1bac: 0x10b1, 0x1bad: 0x10c9, 0x1bae: 0xbac9, 0x1baf: 0xbae1, - 0x1bb0: 0xbaf9, 0x1bb1: 0x1429, 0x1bb2: 0x1a31, 0x1bb3: 0xbb11, 0x1bb4: 0xbb29, 0x1bb5: 0xbb41, - 0x1bb6: 0xbb59, 0x1bb7: 0xbb71, 0x1bb8: 0xbb89, 0x1bb9: 0x2109, 0x1bba: 0x1111, 0x1bbb: 0xbba1, - 0x1bbc: 0xbba1, 0x1bbd: 0xbbb9, 0x1bbe: 0xbbd1, 0x1bbf: 0x10e1, - // Block 0x6f, offset 0x1bc0 - 0x1bc0: 0x10f9, 0x1bc1: 0xbbe9, 0x1bc2: 0x2079, 0x1bc3: 0xbc21, 0x1bc4: 0xbac9, 0x1bc5: 0x1429, - 0x1bc6: 0xbb11, 0x1bc7: 0x10e1, 0x1bc8: 0x1111, 0x1bc9: 0x2109, 0x1bca: 0xbc41, 0x1bcb: 0xbc41, - 0x1bcc: 0x0040, 0x1bcd: 0x0040, 0x1bce: 0x1f41, 0x1bcf: 0x00c9, 0x1bd0: 0x0069, 0x1bd1: 0x0079, - 0x1bd2: 0x1f51, 0x1bd3: 0x1f61, 0x1bd4: 0x1f71, 0x1bd5: 0x1f81, 0x1bd6: 0x1f91, 0x1bd7: 0x1fa1, - 0x1bd8: 0x1f41, 0x1bd9: 0x00c9, 0x1bda: 0x0069, 0x1bdb: 0x0079, 0x1bdc: 0x1f51, 0x1bdd: 0x1f61, - 0x1bde: 0x1f71, 0x1bdf: 0x1f81, 0x1be0: 0x1f91, 0x1be1: 0x1fa1, 0x1be2: 0x1f41, 0x1be3: 0x00c9, - 0x1be4: 0x0069, 0x1be5: 0x0079, 0x1be6: 0x1f51, 0x1be7: 0x1f61, 0x1be8: 0x1f71, 0x1be9: 0x1f81, - 0x1bea: 0x1f91, 0x1beb: 0x1fa1, 0x1bec: 0x1f41, 0x1bed: 0x00c9, 0x1bee: 0x0069, 0x1bef: 0x0079, - 0x1bf0: 0x1f51, 0x1bf1: 0x1f61, 0x1bf2: 0x1f71, 0x1bf3: 0x1f81, 0x1bf4: 0x1f91, 0x1bf5: 0x1fa1, - 0x1bf6: 0x1f41, 0x1bf7: 0x00c9, 0x1bf8: 0x0069, 0x1bf9: 0x0079, 0x1bfa: 0x1f51, 0x1bfb: 0x1f61, - 0x1bfc: 0x1f71, 0x1bfd: 0x1f81, 0x1bfe: 0x1f91, 0x1bff: 0x1fa1, - // Block 0x70, offset 0x1c00 - 0x1c00: 0xe115, 0x1c01: 0xe115, 0x1c02: 0xe135, 0x1c03: 0xe135, 0x1c04: 0xe115, 0x1c05: 0xe115, - 0x1c06: 0xe175, 0x1c07: 0xe175, 0x1c08: 0xe115, 0x1c09: 0xe115, 0x1c0a: 0xe135, 0x1c0b: 0xe135, - 0x1c0c: 0xe115, 0x1c0d: 0xe115, 0x1c0e: 0xe1f5, 0x1c0f: 0xe1f5, 0x1c10: 0xe115, 0x1c11: 0xe115, - 0x1c12: 0xe135, 0x1c13: 0xe135, 0x1c14: 0xe115, 0x1c15: 0xe115, 0x1c16: 0xe175, 0x1c17: 0xe175, - 0x1c18: 0xe115, 0x1c19: 0xe115, 0x1c1a: 0xe135, 0x1c1b: 0xe135, 0x1c1c: 0xe115, 0x1c1d: 0xe115, - 0x1c1e: 0x8b05, 0x1c1f: 0x8b05, 0x1c20: 0x04b5, 0x1c21: 0x04b5, 0x1c22: 0x0a08, 0x1c23: 0x0a08, - 0x1c24: 0x0a08, 0x1c25: 0x0a08, 0x1c26: 0x0a08, 0x1c27: 0x0a08, 0x1c28: 0x0a08, 0x1c29: 0x0a08, - 0x1c2a: 0x0a08, 0x1c2b: 0x0a08, 0x1c2c: 0x0a08, 0x1c2d: 0x0a08, 0x1c2e: 0x0a08, 0x1c2f: 0x0a08, - 0x1c30: 0x0a08, 0x1c31: 0x0a08, 0x1c32: 0x0a08, 0x1c33: 0x0a08, 0x1c34: 0x0a08, 0x1c35: 0x0a08, - 0x1c36: 0x0a08, 0x1c37: 0x0a08, 0x1c38: 0x0a08, 0x1c39: 0x0a08, 0x1c3a: 0x0a08, 0x1c3b: 0x0a08, - 0x1c3c: 0x0a08, 0x1c3d: 0x0a08, 0x1c3e: 0x0a08, 0x1c3f: 0x0a08, - // Block 0x71, offset 0x1c40 - 0x1c40: 0xb189, 0x1c41: 0xb1a1, 0x1c42: 0xb201, 0x1c43: 0xb249, 0x1c44: 0x0040, 0x1c45: 0xb411, - 0x1c46: 0xb291, 0x1c47: 0xb219, 0x1c48: 0xb309, 0x1c49: 0xb429, 0x1c4a: 0xb399, 0x1c4b: 0xb3b1, - 0x1c4c: 0xb3c9, 0x1c4d: 0xb3e1, 0x1c4e: 0xb2a9, 0x1c4f: 0xb339, 0x1c50: 0xb369, 0x1c51: 0xb2d9, - 0x1c52: 0xb381, 0x1c53: 0xb279, 0x1c54: 0xb2c1, 0x1c55: 0xb1d1, 0x1c56: 0xb1e9, 0x1c57: 0xb231, - 0x1c58: 0xb261, 0x1c59: 0xb2f1, 0x1c5a: 0xb321, 0x1c5b: 0xb351, 0x1c5c: 0xbc59, 0x1c5d: 0x7949, - 0x1c5e: 0xbc71, 0x1c5f: 0xbc89, 0x1c60: 0x0040, 0x1c61: 0xb1a1, 0x1c62: 0xb201, 0x1c63: 0x0040, - 0x1c64: 0xb3f9, 0x1c65: 0x0040, 0x1c66: 0x0040, 0x1c67: 0xb219, 0x1c68: 0x0040, 0x1c69: 0xb429, - 0x1c6a: 0xb399, 0x1c6b: 0xb3b1, 0x1c6c: 0xb3c9, 0x1c6d: 0xb3e1, 0x1c6e: 0xb2a9, 0x1c6f: 0xb339, - 0x1c70: 0xb369, 0x1c71: 0xb2d9, 0x1c72: 0xb381, 0x1c73: 0x0040, 0x1c74: 0xb2c1, 0x1c75: 0xb1d1, - 0x1c76: 0xb1e9, 0x1c77: 0xb231, 0x1c78: 0x0040, 0x1c79: 0xb2f1, 0x1c7a: 0x0040, 0x1c7b: 0xb351, - 0x1c7c: 0x0040, 0x1c7d: 0x0040, 0x1c7e: 0x0040, 0x1c7f: 0x0040, - // Block 0x72, offset 0x1c80 - 0x1c80: 0x0040, 0x1c81: 0x0040, 0x1c82: 0xb201, 0x1c83: 0x0040, 0x1c84: 0x0040, 0x1c85: 0x0040, - 0x1c86: 0x0040, 0x1c87: 0xb219, 0x1c88: 0x0040, 0x1c89: 0xb429, 0x1c8a: 0x0040, 0x1c8b: 0xb3b1, - 0x1c8c: 0x0040, 0x1c8d: 0xb3e1, 0x1c8e: 0xb2a9, 0x1c8f: 0xb339, 0x1c90: 0x0040, 0x1c91: 0xb2d9, - 0x1c92: 0xb381, 0x1c93: 0x0040, 0x1c94: 0xb2c1, 0x1c95: 0x0040, 0x1c96: 0x0040, 0x1c97: 0xb231, - 0x1c98: 0x0040, 0x1c99: 0xb2f1, 0x1c9a: 0x0040, 0x1c9b: 0xb351, 0x1c9c: 0x0040, 0x1c9d: 0x7949, - 0x1c9e: 0x0040, 0x1c9f: 0xbc89, 0x1ca0: 0x0040, 0x1ca1: 0xb1a1, 0x1ca2: 0xb201, 0x1ca3: 0x0040, - 0x1ca4: 0xb3f9, 0x1ca5: 0x0040, 0x1ca6: 0x0040, 0x1ca7: 0xb219, 0x1ca8: 0xb309, 0x1ca9: 0xb429, - 0x1caa: 0xb399, 0x1cab: 0x0040, 0x1cac: 0xb3c9, 0x1cad: 0xb3e1, 0x1cae: 0xb2a9, 0x1caf: 0xb339, - 0x1cb0: 0xb369, 0x1cb1: 0xb2d9, 0x1cb2: 0xb381, 0x1cb3: 0x0040, 0x1cb4: 0xb2c1, 0x1cb5: 0xb1d1, - 0x1cb6: 0xb1e9, 0x1cb7: 0xb231, 0x1cb8: 0x0040, 0x1cb9: 0xb2f1, 0x1cba: 0xb321, 0x1cbb: 0xb351, - 0x1cbc: 0xbc59, 0x1cbd: 0x0040, 0x1cbe: 0xbc71, 0x1cbf: 0x0040, - // Block 0x73, offset 0x1cc0 - 0x1cc0: 0xb189, 0x1cc1: 0xb1a1, 0x1cc2: 0xb201, 0x1cc3: 0xb249, 0x1cc4: 0xb3f9, 0x1cc5: 0xb411, - 0x1cc6: 0xb291, 0x1cc7: 0xb219, 0x1cc8: 0xb309, 0x1cc9: 0xb429, 0x1cca: 0x0040, 0x1ccb: 0xb3b1, - 0x1ccc: 0xb3c9, 0x1ccd: 0xb3e1, 0x1cce: 0xb2a9, 0x1ccf: 0xb339, 0x1cd0: 0xb369, 0x1cd1: 0xb2d9, - 0x1cd2: 0xb381, 0x1cd3: 0xb279, 0x1cd4: 0xb2c1, 0x1cd5: 0xb1d1, 0x1cd6: 0xb1e9, 0x1cd7: 0xb231, - 0x1cd8: 0xb261, 0x1cd9: 0xb2f1, 0x1cda: 0xb321, 0x1cdb: 0xb351, 0x1cdc: 0x0040, 0x1cdd: 0x0040, - 0x1cde: 0x0040, 0x1cdf: 0x0040, 0x1ce0: 0x0040, 0x1ce1: 0xb1a1, 0x1ce2: 0xb201, 0x1ce3: 0xb249, - 0x1ce4: 0x0040, 0x1ce5: 0xb411, 0x1ce6: 0xb291, 0x1ce7: 0xb219, 0x1ce8: 0xb309, 0x1ce9: 0xb429, - 0x1cea: 0x0040, 0x1ceb: 0xb3b1, 0x1cec: 0xb3c9, 0x1ced: 0xb3e1, 0x1cee: 0xb2a9, 0x1cef: 0xb339, - 0x1cf0: 0xb369, 0x1cf1: 0xb2d9, 0x1cf2: 0xb381, 0x1cf3: 0xb279, 0x1cf4: 0xb2c1, 0x1cf5: 0xb1d1, - 0x1cf6: 0xb1e9, 0x1cf7: 0xb231, 0x1cf8: 0xb261, 0x1cf9: 0xb2f1, 0x1cfa: 0xb321, 0x1cfb: 0xb351, - 0x1cfc: 0x0040, 0x1cfd: 0x0040, 0x1cfe: 0x0040, 0x1cff: 0x0040, - // Block 0x74, offset 0x1d00 - 0x1d00: 0x0040, 0x1d01: 0xbca2, 0x1d02: 0xbcba, 0x1d03: 0xbcd2, 0x1d04: 0xbcea, 0x1d05: 0xbd02, - 0x1d06: 0xbd1a, 0x1d07: 0xbd32, 0x1d08: 0xbd4a, 0x1d09: 0xbd62, 0x1d0a: 0xbd7a, 0x1d0b: 0x0018, - 0x1d0c: 0x0018, 0x1d0d: 0x0040, 0x1d0e: 0x0040, 0x1d0f: 0x0040, 0x1d10: 0xbd92, 0x1d11: 0xbdb2, - 0x1d12: 0xbdd2, 0x1d13: 0xbdf2, 0x1d14: 0xbe12, 0x1d15: 0xbe32, 0x1d16: 0xbe52, 0x1d17: 0xbe72, - 0x1d18: 0xbe92, 0x1d19: 0xbeb2, 0x1d1a: 0xbed2, 0x1d1b: 0xbef2, 0x1d1c: 0xbf12, 0x1d1d: 0xbf32, - 0x1d1e: 0xbf52, 0x1d1f: 0xbf72, 0x1d20: 0xbf92, 0x1d21: 0xbfb2, 0x1d22: 0xbfd2, 0x1d23: 0xbff2, - 0x1d24: 0xc012, 0x1d25: 0xc032, 0x1d26: 0xc052, 0x1d27: 0xc072, 0x1d28: 0xc092, 0x1d29: 0xc0b2, - 0x1d2a: 0xc0d1, 0x1d2b: 0x1159, 0x1d2c: 0x0269, 0x1d2d: 0x6671, 0x1d2e: 0xc111, 0x1d2f: 0x0040, - 0x1d30: 0x0039, 0x1d31: 0x0ee9, 0x1d32: 0x1159, 0x1d33: 0x0ef9, 0x1d34: 0x0f09, 0x1d35: 0x1199, - 0x1d36: 0x0f31, 0x1d37: 0x0249, 0x1d38: 0x0f41, 0x1d39: 0x0259, 0x1d3a: 0x0f51, 0x1d3b: 0x0359, - 0x1d3c: 0x0f61, 0x1d3d: 0x0f71, 0x1d3e: 0x00d9, 0x1d3f: 0x0f99, - // Block 0x75, offset 0x1d40 - 0x1d40: 0x2039, 0x1d41: 0x0269, 0x1d42: 0x01d9, 0x1d43: 0x0fa9, 0x1d44: 0x0fb9, 0x1d45: 0x1089, - 0x1d46: 0x0279, 0x1d47: 0x0369, 0x1d48: 0x0289, 0x1d49: 0x13d1, 0x1d4a: 0xc129, 0x1d4b: 0x65b1, - 0x1d4c: 0xc141, 0x1d4d: 0x1441, 0x1d4e: 0xc159, 0x1d4f: 0xc179, 0x1d50: 0x0018, 0x1d51: 0x0018, - 0x1d52: 0x0018, 0x1d53: 0x0018, 0x1d54: 0x0018, 0x1d55: 0x0018, 0x1d56: 0x0018, 0x1d57: 0x0018, - 0x1d58: 0x0018, 0x1d59: 0x0018, 0x1d5a: 0x0018, 0x1d5b: 0x0018, 0x1d5c: 0x0018, 0x1d5d: 0x0018, - 0x1d5e: 0x0018, 0x1d5f: 0x0018, 0x1d60: 0x0018, 0x1d61: 0x0018, 0x1d62: 0x0018, 0x1d63: 0x0018, - 0x1d64: 0x0018, 0x1d65: 0x0018, 0x1d66: 0x0018, 0x1d67: 0x0018, 0x1d68: 0x0018, 0x1d69: 0x0018, - 0x1d6a: 0xc191, 0x1d6b: 0xc1a9, 0x1d6c: 0x0040, 0x1d6d: 0x0040, 0x1d6e: 0x0040, 0x1d6f: 0x0040, - 0x1d70: 0x0018, 0x1d71: 0x0018, 0x1d72: 0x0018, 0x1d73: 0x0018, 0x1d74: 0x0018, 0x1d75: 0x0018, - 0x1d76: 0x0018, 0x1d77: 0x0018, 0x1d78: 0x0018, 0x1d79: 0x0018, 0x1d7a: 0x0018, 0x1d7b: 0x0018, - 0x1d7c: 0x0018, 0x1d7d: 0x0018, 0x1d7e: 0x0018, 0x1d7f: 0x0018, - // Block 0x76, offset 0x1d80 - 0x1d80: 0xc1d9, 0x1d81: 0xc211, 0x1d82: 0xc249, 0x1d83: 0x0040, 0x1d84: 0x0040, 0x1d85: 0x0040, - 0x1d86: 0x0040, 0x1d87: 0x0040, 0x1d88: 0x0040, 0x1d89: 0x0040, 0x1d8a: 0x0040, 0x1d8b: 0x0040, - 0x1d8c: 0x0040, 0x1d8d: 0x0040, 0x1d8e: 0x0040, 0x1d8f: 0x0040, 0x1d90: 0xc269, 0x1d91: 0xc289, - 0x1d92: 0xc2a9, 0x1d93: 0xc2c9, 0x1d94: 0xc2e9, 0x1d95: 0xc309, 0x1d96: 0xc329, 0x1d97: 0xc349, - 0x1d98: 0xc369, 0x1d99: 0xc389, 0x1d9a: 0xc3a9, 0x1d9b: 0xc3c9, 0x1d9c: 0xc3e9, 0x1d9d: 0xc409, - 0x1d9e: 0xc429, 0x1d9f: 0xc449, 0x1da0: 0xc469, 0x1da1: 0xc489, 0x1da2: 0xc4a9, 0x1da3: 0xc4c9, - 0x1da4: 0xc4e9, 0x1da5: 0xc509, 0x1da6: 0xc529, 0x1da7: 0xc549, 0x1da8: 0xc569, 0x1da9: 0xc589, - 0x1daa: 0xc5a9, 0x1dab: 0xc5c9, 0x1dac: 0xc5e9, 0x1dad: 0xc609, 0x1dae: 0xc629, 0x1daf: 0xc649, - 0x1db0: 0xc669, 0x1db1: 0xc689, 0x1db2: 0xc6a9, 0x1db3: 0xc6c9, 0x1db4: 0xc6e9, 0x1db5: 0xc709, - 0x1db6: 0xc729, 0x1db7: 0xc749, 0x1db8: 0xc769, 0x1db9: 0xc789, 0x1dba: 0xc7a9, 0x1dbb: 0xc7c9, - 0x1dbc: 0x0040, 0x1dbd: 0x0040, 0x1dbe: 0x0040, 0x1dbf: 0x0040, - // Block 0x77, offset 0x1dc0 - 0x1dc0: 0xcaf9, 0x1dc1: 0xcb19, 0x1dc2: 0xcb39, 0x1dc3: 0x8b1d, 0x1dc4: 0xcb59, 0x1dc5: 0xcb79, - 0x1dc6: 0xcb99, 0x1dc7: 0xcbb9, 0x1dc8: 0xcbd9, 0x1dc9: 0xcbf9, 0x1dca: 0xcc19, 0x1dcb: 0xcc39, - 0x1dcc: 0xcc59, 0x1dcd: 0x8b3d, 0x1dce: 0xcc79, 0x1dcf: 0xcc99, 0x1dd0: 0xccb9, 0x1dd1: 0xccd9, - 0x1dd2: 0x8b5d, 0x1dd3: 0xccf9, 0x1dd4: 0xcd19, 0x1dd5: 0xc429, 0x1dd6: 0x8b7d, 0x1dd7: 0xcd39, - 0x1dd8: 0xcd59, 0x1dd9: 0xcd79, 0x1dda: 0xcd99, 0x1ddb: 0xcdb9, 0x1ddc: 0x8b9d, 0x1ddd: 0xcdd9, - 0x1dde: 0xcdf9, 0x1ddf: 0xce19, 0x1de0: 0xce39, 0x1de1: 0xce59, 0x1de2: 0xc789, 0x1de3: 0xce79, - 0x1de4: 0xce99, 0x1de5: 0xceb9, 0x1de6: 0xced9, 0x1de7: 0xcef9, 0x1de8: 0xcf19, 0x1de9: 0xcf39, - 0x1dea: 0xcf59, 0x1deb: 0xcf79, 0x1dec: 0xcf99, 0x1ded: 0xcfb9, 0x1dee: 0xcfd9, 0x1def: 0xcff9, - 0x1df0: 0xd019, 0x1df1: 0xd039, 0x1df2: 0xd039, 0x1df3: 0xd039, 0x1df4: 0x8bbd, 0x1df5: 0xd059, - 0x1df6: 0xd079, 0x1df7: 0xd099, 0x1df8: 0x8bdd, 0x1df9: 0xd0b9, 0x1dfa: 0xd0d9, 0x1dfb: 0xd0f9, - 0x1dfc: 0xd119, 0x1dfd: 0xd139, 0x1dfe: 0xd159, 0x1dff: 0xd179, - // Block 0x78, offset 0x1e00 - 0x1e00: 0xd199, 0x1e01: 0xd1b9, 0x1e02: 0xd1d9, 0x1e03: 0xd1f9, 0x1e04: 0xd219, 0x1e05: 0xd239, - 0x1e06: 0xd239, 0x1e07: 0xd259, 0x1e08: 0xd279, 0x1e09: 0xd299, 0x1e0a: 0xd2b9, 0x1e0b: 0xd2d9, - 0x1e0c: 0xd2f9, 0x1e0d: 0xd319, 0x1e0e: 0xd339, 0x1e0f: 0xd359, 0x1e10: 0xd379, 0x1e11: 0xd399, - 0x1e12: 0xd3b9, 0x1e13: 0xd3d9, 0x1e14: 0xd3f9, 0x1e15: 0xd419, 0x1e16: 0xd439, 0x1e17: 0xd459, - 0x1e18: 0xd479, 0x1e19: 0x8bfd, 0x1e1a: 0xd499, 0x1e1b: 0xd4b9, 0x1e1c: 0xd4d9, 0x1e1d: 0xc309, - 0x1e1e: 0xd4f9, 0x1e1f: 0xd519, 0x1e20: 0x8c1d, 0x1e21: 0x8c3d, 0x1e22: 0xd539, 0x1e23: 0xd559, - 0x1e24: 0xd579, 0x1e25: 0xd599, 0x1e26: 0xd5b9, 0x1e27: 0xd5d9, 0x1e28: 0x2040, 0x1e29: 0xd5f9, - 0x1e2a: 0xd619, 0x1e2b: 0xd619, 0x1e2c: 0x8c5d, 0x1e2d: 0xd639, 0x1e2e: 0xd659, 0x1e2f: 0xd679, - 0x1e30: 0xd699, 0x1e31: 0x8c7d, 0x1e32: 0xd6b9, 0x1e33: 0xd6d9, 0x1e34: 0x2040, 0x1e35: 0xd6f9, - 0x1e36: 0xd719, 0x1e37: 0xd739, 0x1e38: 0xd759, 0x1e39: 0xd779, 0x1e3a: 0xd799, 0x1e3b: 0x8c9d, - 0x1e3c: 0xd7b9, 0x1e3d: 0x8cbd, 0x1e3e: 0xd7d9, 0x1e3f: 0xd7f9, - // Block 0x79, offset 0x1e40 - 0x1e40: 0xd819, 0x1e41: 0xd839, 0x1e42: 0xd859, 0x1e43: 0xd879, 0x1e44: 0xd899, 0x1e45: 0xd8b9, - 0x1e46: 0xd8d9, 0x1e47: 0xd8f9, 0x1e48: 0xd919, 0x1e49: 0x8cdd, 0x1e4a: 0xd939, 0x1e4b: 0xd959, - 0x1e4c: 0xd979, 0x1e4d: 0xd999, 0x1e4e: 0xd9b9, 0x1e4f: 0x8cfd, 0x1e50: 0xd9d9, 0x1e51: 0x8d1d, - 0x1e52: 0x8d3d, 0x1e53: 0xd9f9, 0x1e54: 0xda19, 0x1e55: 0xda19, 0x1e56: 0xda39, 0x1e57: 0x8d5d, - 0x1e58: 0x8d7d, 0x1e59: 0xda59, 0x1e5a: 0xda79, 0x1e5b: 0xda99, 0x1e5c: 0xdab9, 0x1e5d: 0xdad9, - 0x1e5e: 0xdaf9, 0x1e5f: 0xdb19, 0x1e60: 0xdb39, 0x1e61: 0xdb59, 0x1e62: 0xdb79, 0x1e63: 0xdb99, - 0x1e64: 0x8d9d, 0x1e65: 0xdbb9, 0x1e66: 0xdbd9, 0x1e67: 0xdbf9, 0x1e68: 0xdc19, 0x1e69: 0xdbf9, - 0x1e6a: 0xdc39, 0x1e6b: 0xdc59, 0x1e6c: 0xdc79, 0x1e6d: 0xdc99, 0x1e6e: 0xdcb9, 0x1e6f: 0xdcd9, - 0x1e70: 0xdcf9, 0x1e71: 0xdd19, 0x1e72: 0xdd39, 0x1e73: 0xdd59, 0x1e74: 0xdd79, 0x1e75: 0xdd99, - 0x1e76: 0xddb9, 0x1e77: 0xddd9, 0x1e78: 0x8dbd, 0x1e79: 0xddf9, 0x1e7a: 0xde19, 0x1e7b: 0xde39, - 0x1e7c: 0xde59, 0x1e7d: 0xde79, 0x1e7e: 0x8ddd, 0x1e7f: 0xde99, - // Block 0x7a, offset 0x1e80 - 0x1e80: 0xe599, 0x1e81: 0xe5b9, 0x1e82: 0xe5d9, 0x1e83: 0xe5f9, 0x1e84: 0xe619, 0x1e85: 0xe639, - 0x1e86: 0x8efd, 0x1e87: 0xe659, 0x1e88: 0xe679, 0x1e89: 0xe699, 0x1e8a: 0xe6b9, 0x1e8b: 0xe6d9, - 0x1e8c: 0xe6f9, 0x1e8d: 0x8f1d, 0x1e8e: 0xe719, 0x1e8f: 0xe739, 0x1e90: 0x8f3d, 0x1e91: 0x8f5d, - 0x1e92: 0xe759, 0x1e93: 0xe779, 0x1e94: 0xe799, 0x1e95: 0xe7b9, 0x1e96: 0xe7d9, 0x1e97: 0xe7f9, - 0x1e98: 0xe819, 0x1e99: 0xe839, 0x1e9a: 0xe859, 0x1e9b: 0x8f7d, 0x1e9c: 0xe879, 0x1e9d: 0x8f9d, - 0x1e9e: 0xe899, 0x1e9f: 0x2040, 0x1ea0: 0xe8b9, 0x1ea1: 0xe8d9, 0x1ea2: 0xe8f9, 0x1ea3: 0x8fbd, - 0x1ea4: 0xe919, 0x1ea5: 0xe939, 0x1ea6: 0x8fdd, 0x1ea7: 0x8ffd, 0x1ea8: 0xe959, 0x1ea9: 0xe979, - 0x1eaa: 0xe999, 0x1eab: 0xe9b9, 0x1eac: 0xe9d9, 0x1ead: 0xe9d9, 0x1eae: 0xe9f9, 0x1eaf: 0xea19, - 0x1eb0: 0xea39, 0x1eb1: 0xea59, 0x1eb2: 0xea79, 0x1eb3: 0xea99, 0x1eb4: 0xeab9, 0x1eb5: 0x901d, - 0x1eb6: 0xead9, 0x1eb7: 0x903d, 0x1eb8: 0xeaf9, 0x1eb9: 0x905d, 0x1eba: 0xeb19, 0x1ebb: 0x907d, - 0x1ebc: 0x909d, 0x1ebd: 0x90bd, 0x1ebe: 0xeb39, 0x1ebf: 0xeb59, - // Block 0x7b, offset 0x1ec0 - 0x1ec0: 0xeb79, 0x1ec1: 0x90dd, 0x1ec2: 0x90fd, 0x1ec3: 0x911d, 0x1ec4: 0x913d, 0x1ec5: 0xeb99, - 0x1ec6: 0xebb9, 0x1ec7: 0xebb9, 0x1ec8: 0xebd9, 0x1ec9: 0xebf9, 0x1eca: 0xec19, 0x1ecb: 0xec39, - 0x1ecc: 0xec59, 0x1ecd: 0x915d, 0x1ece: 0xec79, 0x1ecf: 0xec99, 0x1ed0: 0xecb9, 0x1ed1: 0xecd9, - 0x1ed2: 0x917d, 0x1ed3: 0xecf9, 0x1ed4: 0x919d, 0x1ed5: 0x91bd, 0x1ed6: 0xed19, 0x1ed7: 0xed39, - 0x1ed8: 0xed59, 0x1ed9: 0xed79, 0x1eda: 0xed99, 0x1edb: 0xedb9, 0x1edc: 0x91dd, 0x1edd: 0x91fd, - 0x1ede: 0x921d, 0x1edf: 0x2040, 0x1ee0: 0xedd9, 0x1ee1: 0x923d, 0x1ee2: 0xedf9, 0x1ee3: 0xee19, - 0x1ee4: 0xee39, 0x1ee5: 0x925d, 0x1ee6: 0xee59, 0x1ee7: 0xee79, 0x1ee8: 0xee99, 0x1ee9: 0xeeb9, - 0x1eea: 0xeed9, 0x1eeb: 0x927d, 0x1eec: 0xeef9, 0x1eed: 0xef19, 0x1eee: 0xef39, 0x1eef: 0xef59, - 0x1ef0: 0xef79, 0x1ef1: 0xef99, 0x1ef2: 0x929d, 0x1ef3: 0x92bd, 0x1ef4: 0xefb9, 0x1ef5: 0x92dd, - 0x1ef6: 0xefd9, 0x1ef7: 0x92fd, 0x1ef8: 0xeff9, 0x1ef9: 0xf019, 0x1efa: 0xf039, 0x1efb: 0x931d, - 0x1efc: 0x933d, 0x1efd: 0xf059, 0x1efe: 0x935d, 0x1eff: 0xf079, - // Block 0x7c, offset 0x1f00 - 0x1f00: 0xf6b9, 0x1f01: 0xf6d9, 0x1f02: 0xf6f9, 0x1f03: 0xf719, 0x1f04: 0xf739, 0x1f05: 0x951d, - 0x1f06: 0xf759, 0x1f07: 0xf779, 0x1f08: 0xf799, 0x1f09: 0xf7b9, 0x1f0a: 0xf7d9, 0x1f0b: 0x953d, - 0x1f0c: 0x955d, 0x1f0d: 0xf7f9, 0x1f0e: 0xf819, 0x1f0f: 0xf839, 0x1f10: 0xf859, 0x1f11: 0xf879, - 0x1f12: 0xf899, 0x1f13: 0x957d, 0x1f14: 0xf8b9, 0x1f15: 0xf8d9, 0x1f16: 0xf8f9, 0x1f17: 0xf919, - 0x1f18: 0x959d, 0x1f19: 0x95bd, 0x1f1a: 0xf939, 0x1f1b: 0xf959, 0x1f1c: 0xf979, 0x1f1d: 0x95dd, - 0x1f1e: 0xf999, 0x1f1f: 0xf9b9, 0x1f20: 0x6815, 0x1f21: 0x95fd, 0x1f22: 0xf9d9, 0x1f23: 0xf9f9, - 0x1f24: 0xfa19, 0x1f25: 0x961d, 0x1f26: 0xfa39, 0x1f27: 0xfa59, 0x1f28: 0xfa79, 0x1f29: 0xfa99, - 0x1f2a: 0xfab9, 0x1f2b: 0xfad9, 0x1f2c: 0xfaf9, 0x1f2d: 0x963d, 0x1f2e: 0xfb19, 0x1f2f: 0xfb39, - 0x1f30: 0xfb59, 0x1f31: 0x965d, 0x1f32: 0xfb79, 0x1f33: 0xfb99, 0x1f34: 0xfbb9, 0x1f35: 0xfbd9, - 0x1f36: 0x7b35, 0x1f37: 0x967d, 0x1f38: 0xfbf9, 0x1f39: 0xfc19, 0x1f3a: 0xfc39, 0x1f3b: 0x969d, - 0x1f3c: 0xfc59, 0x1f3d: 0x96bd, 0x1f3e: 0xfc79, 0x1f3f: 0xfc79, - // Block 0x7d, offset 0x1f40 - 0x1f40: 0xfc99, 0x1f41: 0x96dd, 0x1f42: 0xfcb9, 0x1f43: 0xfcd9, 0x1f44: 0xfcf9, 0x1f45: 0xfd19, - 0x1f46: 0xfd39, 0x1f47: 0xfd59, 0x1f48: 0xfd79, 0x1f49: 0x96fd, 0x1f4a: 0xfd99, 0x1f4b: 0xfdb9, - 0x1f4c: 0xfdd9, 0x1f4d: 0xfdf9, 0x1f4e: 0xfe19, 0x1f4f: 0xfe39, 0x1f50: 0x971d, 0x1f51: 0xfe59, - 0x1f52: 0x973d, 0x1f53: 0x975d, 0x1f54: 0x977d, 0x1f55: 0xfe79, 0x1f56: 0xfe99, 0x1f57: 0xfeb9, - 0x1f58: 0xfed9, 0x1f59: 0xfef9, 0x1f5a: 0xff19, 0x1f5b: 0xff39, 0x1f5c: 0xff59, 0x1f5d: 0x979d, - 0x1f5e: 0x0040, 0x1f5f: 0x0040, 0x1f60: 0x0040, 0x1f61: 0x0040, 0x1f62: 0x0040, 0x1f63: 0x0040, - 0x1f64: 0x0040, 0x1f65: 0x0040, 0x1f66: 0x0040, 0x1f67: 0x0040, 0x1f68: 0x0040, 0x1f69: 0x0040, - 0x1f6a: 0x0040, 0x1f6b: 0x0040, 0x1f6c: 0x0040, 0x1f6d: 0x0040, 0x1f6e: 0x0040, 0x1f6f: 0x0040, - 0x1f70: 0x0040, 0x1f71: 0x0040, 0x1f72: 0x0040, 0x1f73: 0x0040, 0x1f74: 0x0040, 0x1f75: 0x0040, - 0x1f76: 0x0040, 0x1f77: 0x0040, 0x1f78: 0x0040, 0x1f79: 0x0040, 0x1f7a: 0x0040, 0x1f7b: 0x0040, - 0x1f7c: 0x0040, 0x1f7d: 0x0040, 0x1f7e: 0x0040, 0x1f7f: 0x0040, -} - -// idnaIndex: 35 blocks, 2240 entries, 4480 bytes -// Block 0 is the zero block. -var idnaIndex = [2240]uint16{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x01, 0xc3: 0x7c, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x04, 0xc7: 0x05, - 0xc8: 0x06, 0xc9: 0x7d, 0xca: 0x7e, 0xcb: 0x07, 0xcc: 0x7f, 0xcd: 0x08, 0xce: 0x09, 0xcf: 0x0a, - 0xd0: 0x80, 0xd1: 0x0b, 0xd2: 0x0c, 0xd3: 0x0d, 0xd4: 0x0e, 0xd5: 0x81, 0xd6: 0x82, 0xd7: 0x83, - 0xd8: 0x0f, 0xd9: 0x10, 0xda: 0x84, 0xdb: 0x11, 0xdc: 0x12, 0xdd: 0x85, 0xde: 0x86, 0xdf: 0x87, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe5: 0x07, 0xe6: 0x07, 0xe7: 0x07, - 0xe8: 0x07, 0xe9: 0x08, 0xea: 0x09, 0xeb: 0x07, 0xec: 0x07, 0xed: 0x0a, 0xee: 0x0b, 0xef: 0x0c, - 0xf0: 0x1c, 0xf1: 0x1d, 0xf2: 0x1d, 0xf3: 0x1f, 0xf4: 0x20, - // Block 0x4, offset 0x100 - 0x120: 0x88, 0x121: 0x89, 0x122: 0x8a, 0x123: 0x8b, 0x124: 0x8c, 0x125: 0x13, 0x126: 0x14, 0x127: 0x15, - 0x128: 0x16, 0x129: 0x17, 0x12a: 0x18, 0x12b: 0x19, 0x12c: 0x1a, 0x12d: 0x1b, 0x12e: 0x1c, 0x12f: 0x8d, - 0x130: 0x8e, 0x131: 0x1d, 0x132: 0x1e, 0x133: 0x1f, 0x134: 0x8f, 0x135: 0x20, 0x136: 0x90, 0x137: 0x91, - 0x138: 0x92, 0x139: 0x93, 0x13a: 0x21, 0x13b: 0x94, 0x13c: 0x95, 0x13d: 0x22, 0x13e: 0x23, 0x13f: 0x96, - // Block 0x5, offset 0x140 - 0x140: 0x97, 0x141: 0x98, 0x142: 0x99, 0x143: 0x9a, 0x144: 0x9b, 0x145: 0x9c, 0x146: 0x9d, 0x147: 0x9e, - 0x148: 0x9f, 0x149: 0xa0, 0x14a: 0xa1, 0x14b: 0xa2, 0x14c: 0xa3, 0x14d: 0xa4, 0x14e: 0xa5, 0x14f: 0xa6, - 0x150: 0xa7, 0x151: 0x9f, 0x152: 0x9f, 0x153: 0x9f, 0x154: 0x9f, 0x155: 0x9f, 0x156: 0x9f, 0x157: 0x9f, - 0x158: 0x9f, 0x159: 0xa8, 0x15a: 0xa9, 0x15b: 0xaa, 0x15c: 0xab, 0x15d: 0xac, 0x15e: 0xad, 0x15f: 0xae, - 0x160: 0xaf, 0x161: 0xb0, 0x162: 0xb1, 0x163: 0xb2, 0x164: 0xb3, 0x165: 0xb4, 0x166: 0xb5, 0x167: 0xb6, - 0x168: 0xb7, 0x169: 0xb8, 0x16a: 0xb9, 0x16b: 0xba, 0x16c: 0xbb, 0x16d: 0xbc, 0x16e: 0xbd, 0x16f: 0xbe, - 0x170: 0xbf, 0x171: 0xc0, 0x172: 0xc1, 0x173: 0xc2, 0x174: 0x24, 0x175: 0x25, 0x176: 0x26, 0x177: 0xc3, - 0x178: 0x27, 0x179: 0x27, 0x17a: 0x28, 0x17b: 0x27, 0x17c: 0xc4, 0x17d: 0x29, 0x17e: 0x2a, 0x17f: 0x2b, - // Block 0x6, offset 0x180 - 0x180: 0x2c, 0x181: 0x2d, 0x182: 0x2e, 0x183: 0xc5, 0x184: 0x2f, 0x185: 0x30, 0x186: 0xc6, 0x187: 0x9b, - 0x188: 0xc7, 0x189: 0xc8, 0x18a: 0x9b, 0x18b: 0x9b, 0x18c: 0xc9, 0x18d: 0x9b, 0x18e: 0x9b, 0x18f: 0xca, - 0x190: 0xcb, 0x191: 0x31, 0x192: 0x32, 0x193: 0x33, 0x194: 0x9b, 0x195: 0x9b, 0x196: 0x9b, 0x197: 0x9b, - 0x198: 0x9b, 0x199: 0x9b, 0x19a: 0x9b, 0x19b: 0x9b, 0x19c: 0x9b, 0x19d: 0x9b, 0x19e: 0x9b, 0x19f: 0x9b, - 0x1a0: 0x9b, 0x1a1: 0x9b, 0x1a2: 0x9b, 0x1a3: 0x9b, 0x1a4: 0x9b, 0x1a5: 0x9b, 0x1a6: 0x9b, 0x1a7: 0x9b, - 0x1a8: 0xcc, 0x1a9: 0xcd, 0x1aa: 0x9b, 0x1ab: 0xce, 0x1ac: 0x9b, 0x1ad: 0xcf, 0x1ae: 0xd0, 0x1af: 0xd1, - 0x1b0: 0xd2, 0x1b1: 0x34, 0x1b2: 0x27, 0x1b3: 0x35, 0x1b4: 0xd3, 0x1b5: 0xd4, 0x1b6: 0xd5, 0x1b7: 0xd6, - 0x1b8: 0xd7, 0x1b9: 0xd8, 0x1ba: 0xd9, 0x1bb: 0xda, 0x1bc: 0xdb, 0x1bd: 0xdc, 0x1be: 0xdd, 0x1bf: 0x36, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x37, 0x1c1: 0xde, 0x1c2: 0xdf, 0x1c3: 0xe0, 0x1c4: 0xe1, 0x1c5: 0x38, 0x1c6: 0x39, 0x1c7: 0xe2, - 0x1c8: 0xe3, 0x1c9: 0x3a, 0x1ca: 0x3b, 0x1cb: 0x3c, 0x1cc: 0x3d, 0x1cd: 0x3e, 0x1ce: 0x3f, 0x1cf: 0x40, - 0x1d0: 0x9f, 0x1d1: 0x9f, 0x1d2: 0x9f, 0x1d3: 0x9f, 0x1d4: 0x9f, 0x1d5: 0x9f, 0x1d6: 0x9f, 0x1d7: 0x9f, - 0x1d8: 0x9f, 0x1d9: 0x9f, 0x1da: 0x9f, 0x1db: 0x9f, 0x1dc: 0x9f, 0x1dd: 0x9f, 0x1de: 0x9f, 0x1df: 0x9f, - 0x1e0: 0x9f, 0x1e1: 0x9f, 0x1e2: 0x9f, 0x1e3: 0x9f, 0x1e4: 0x9f, 0x1e5: 0x9f, 0x1e6: 0x9f, 0x1e7: 0x9f, - 0x1e8: 0x9f, 0x1e9: 0x9f, 0x1ea: 0x9f, 0x1eb: 0x9f, 0x1ec: 0x9f, 0x1ed: 0x9f, 0x1ee: 0x9f, 0x1ef: 0x9f, - 0x1f0: 0x9f, 0x1f1: 0x9f, 0x1f2: 0x9f, 0x1f3: 0x9f, 0x1f4: 0x9f, 0x1f5: 0x9f, 0x1f6: 0x9f, 0x1f7: 0x9f, - 0x1f8: 0x9f, 0x1f9: 0x9f, 0x1fa: 0x9f, 0x1fb: 0x9f, 0x1fc: 0x9f, 0x1fd: 0x9f, 0x1fe: 0x9f, 0x1ff: 0x9f, - // Block 0x8, offset 0x200 - 0x200: 0x9f, 0x201: 0x9f, 0x202: 0x9f, 0x203: 0x9f, 0x204: 0x9f, 0x205: 0x9f, 0x206: 0x9f, 0x207: 0x9f, - 0x208: 0x9f, 0x209: 0x9f, 0x20a: 0x9f, 0x20b: 0x9f, 0x20c: 0x9f, 0x20d: 0x9f, 0x20e: 0x9f, 0x20f: 0x9f, - 0x210: 0x9f, 0x211: 0x9f, 0x212: 0x9f, 0x213: 0x9f, 0x214: 0x9f, 0x215: 0x9f, 0x216: 0x9f, 0x217: 0x9f, - 0x218: 0x9f, 0x219: 0x9f, 0x21a: 0x9f, 0x21b: 0x9f, 0x21c: 0x9f, 0x21d: 0x9f, 0x21e: 0x9f, 0x21f: 0x9f, - 0x220: 0x9f, 0x221: 0x9f, 0x222: 0x9f, 0x223: 0x9f, 0x224: 0x9f, 0x225: 0x9f, 0x226: 0x9f, 0x227: 0x9f, - 0x228: 0x9f, 0x229: 0x9f, 0x22a: 0x9f, 0x22b: 0x9f, 0x22c: 0x9f, 0x22d: 0x9f, 0x22e: 0x9f, 0x22f: 0x9f, - 0x230: 0x9f, 0x231: 0x9f, 0x232: 0x9f, 0x233: 0x9f, 0x234: 0x9f, 0x235: 0x9f, 0x236: 0xb2, 0x237: 0x9b, - 0x238: 0x9f, 0x239: 0x9f, 0x23a: 0x9f, 0x23b: 0x9f, 0x23c: 0x9f, 0x23d: 0x9f, 0x23e: 0x9f, 0x23f: 0x9f, - // Block 0x9, offset 0x240 - 0x240: 0x9f, 0x241: 0x9f, 0x242: 0x9f, 0x243: 0x9f, 0x244: 0x9f, 0x245: 0x9f, 0x246: 0x9f, 0x247: 0x9f, - 0x248: 0x9f, 0x249: 0x9f, 0x24a: 0x9f, 0x24b: 0x9f, 0x24c: 0x9f, 0x24d: 0x9f, 0x24e: 0x9f, 0x24f: 0x9f, - 0x250: 0x9f, 0x251: 0x9f, 0x252: 0x9f, 0x253: 0x9f, 0x254: 0x9f, 0x255: 0x9f, 0x256: 0x9f, 0x257: 0x9f, - 0x258: 0x9f, 0x259: 0x9f, 0x25a: 0x9f, 0x25b: 0x9f, 0x25c: 0x9f, 0x25d: 0x9f, 0x25e: 0x9f, 0x25f: 0x9f, - 0x260: 0x9f, 0x261: 0x9f, 0x262: 0x9f, 0x263: 0x9f, 0x264: 0x9f, 0x265: 0x9f, 0x266: 0x9f, 0x267: 0x9f, - 0x268: 0x9f, 0x269: 0x9f, 0x26a: 0x9f, 0x26b: 0x9f, 0x26c: 0x9f, 0x26d: 0x9f, 0x26e: 0x9f, 0x26f: 0x9f, - 0x270: 0x9f, 0x271: 0x9f, 0x272: 0x9f, 0x273: 0x9f, 0x274: 0x9f, 0x275: 0x9f, 0x276: 0x9f, 0x277: 0x9f, - 0x278: 0x9f, 0x279: 0x9f, 0x27a: 0x9f, 0x27b: 0x9f, 0x27c: 0x9f, 0x27d: 0x9f, 0x27e: 0x9f, 0x27f: 0x9f, - // Block 0xa, offset 0x280 - 0x280: 0x9f, 0x281: 0x9f, 0x282: 0x9f, 0x283: 0x9f, 0x284: 0x9f, 0x285: 0x9f, 0x286: 0x9f, 0x287: 0x9f, - 0x288: 0x9f, 0x289: 0x9f, 0x28a: 0x9f, 0x28b: 0x9f, 0x28c: 0x9f, 0x28d: 0x9f, 0x28e: 0x9f, 0x28f: 0x9f, - 0x290: 0x9f, 0x291: 0x9f, 0x292: 0x9f, 0x293: 0x9f, 0x294: 0x9f, 0x295: 0x9f, 0x296: 0x9f, 0x297: 0x9f, - 0x298: 0x9f, 0x299: 0x9f, 0x29a: 0x9f, 0x29b: 0x9f, 0x29c: 0x9f, 0x29d: 0x9f, 0x29e: 0x9f, 0x29f: 0x9f, - 0x2a0: 0x9f, 0x2a1: 0x9f, 0x2a2: 0x9f, 0x2a3: 0x9f, 0x2a4: 0x9f, 0x2a5: 0x9f, 0x2a6: 0x9f, 0x2a7: 0x9f, - 0x2a8: 0x9f, 0x2a9: 0x9f, 0x2aa: 0x9f, 0x2ab: 0x9f, 0x2ac: 0x9f, 0x2ad: 0x9f, 0x2ae: 0x9f, 0x2af: 0x9f, - 0x2b0: 0x9f, 0x2b1: 0x9f, 0x2b2: 0x9f, 0x2b3: 0x9f, 0x2b4: 0x9f, 0x2b5: 0x9f, 0x2b6: 0x9f, 0x2b7: 0x9f, - 0x2b8: 0x9f, 0x2b9: 0x9f, 0x2ba: 0x9f, 0x2bb: 0x9f, 0x2bc: 0x9f, 0x2bd: 0x9f, 0x2be: 0x9f, 0x2bf: 0xe4, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x9f, 0x2c1: 0x9f, 0x2c2: 0x9f, 0x2c3: 0x9f, 0x2c4: 0x9f, 0x2c5: 0x9f, 0x2c6: 0x9f, 0x2c7: 0x9f, - 0x2c8: 0x9f, 0x2c9: 0x9f, 0x2ca: 0x9f, 0x2cb: 0x9f, 0x2cc: 0x9f, 0x2cd: 0x9f, 0x2ce: 0x9f, 0x2cf: 0x9f, - 0x2d0: 0x9f, 0x2d1: 0x9f, 0x2d2: 0xe5, 0x2d3: 0xe6, 0x2d4: 0x9f, 0x2d5: 0x9f, 0x2d6: 0x9f, 0x2d7: 0x9f, - 0x2d8: 0xe7, 0x2d9: 0x41, 0x2da: 0x42, 0x2db: 0xe8, 0x2dc: 0x43, 0x2dd: 0x44, 0x2de: 0x45, 0x2df: 0xe9, - 0x2e0: 0xea, 0x2e1: 0xeb, 0x2e2: 0xec, 0x2e3: 0xed, 0x2e4: 0xee, 0x2e5: 0xef, 0x2e6: 0xf0, 0x2e7: 0xf1, - 0x2e8: 0xf2, 0x2e9: 0xf3, 0x2ea: 0xf4, 0x2eb: 0xf5, 0x2ec: 0xf6, 0x2ed: 0xf7, 0x2ee: 0xf8, 0x2ef: 0xf9, - 0x2f0: 0x9f, 0x2f1: 0x9f, 0x2f2: 0x9f, 0x2f3: 0x9f, 0x2f4: 0x9f, 0x2f5: 0x9f, 0x2f6: 0x9f, 0x2f7: 0x9f, - 0x2f8: 0x9f, 0x2f9: 0x9f, 0x2fa: 0x9f, 0x2fb: 0x9f, 0x2fc: 0x9f, 0x2fd: 0x9f, 0x2fe: 0x9f, 0x2ff: 0x9f, - // Block 0xc, offset 0x300 - 0x300: 0x9f, 0x301: 0x9f, 0x302: 0x9f, 0x303: 0x9f, 0x304: 0x9f, 0x305: 0x9f, 0x306: 0x9f, 0x307: 0x9f, - 0x308: 0x9f, 0x309: 0x9f, 0x30a: 0x9f, 0x30b: 0x9f, 0x30c: 0x9f, 0x30d: 0x9f, 0x30e: 0x9f, 0x30f: 0x9f, - 0x310: 0x9f, 0x311: 0x9f, 0x312: 0x9f, 0x313: 0x9f, 0x314: 0x9f, 0x315: 0x9f, 0x316: 0x9f, 0x317: 0x9f, - 0x318: 0x9f, 0x319: 0x9f, 0x31a: 0x9f, 0x31b: 0x9f, 0x31c: 0x9f, 0x31d: 0x9f, 0x31e: 0xfa, 0x31f: 0xfb, - // Block 0xd, offset 0x340 - 0x340: 0xba, 0x341: 0xba, 0x342: 0xba, 0x343: 0xba, 0x344: 0xba, 0x345: 0xba, 0x346: 0xba, 0x347: 0xba, - 0x348: 0xba, 0x349: 0xba, 0x34a: 0xba, 0x34b: 0xba, 0x34c: 0xba, 0x34d: 0xba, 0x34e: 0xba, 0x34f: 0xba, - 0x350: 0xba, 0x351: 0xba, 0x352: 0xba, 0x353: 0xba, 0x354: 0xba, 0x355: 0xba, 0x356: 0xba, 0x357: 0xba, - 0x358: 0xba, 0x359: 0xba, 0x35a: 0xba, 0x35b: 0xba, 0x35c: 0xba, 0x35d: 0xba, 0x35e: 0xba, 0x35f: 0xba, - 0x360: 0xba, 0x361: 0xba, 0x362: 0xba, 0x363: 0xba, 0x364: 0xba, 0x365: 0xba, 0x366: 0xba, 0x367: 0xba, - 0x368: 0xba, 0x369: 0xba, 0x36a: 0xba, 0x36b: 0xba, 0x36c: 0xba, 0x36d: 0xba, 0x36e: 0xba, 0x36f: 0xba, - 0x370: 0xba, 0x371: 0xba, 0x372: 0xba, 0x373: 0xba, 0x374: 0xba, 0x375: 0xba, 0x376: 0xba, 0x377: 0xba, - 0x378: 0xba, 0x379: 0xba, 0x37a: 0xba, 0x37b: 0xba, 0x37c: 0xba, 0x37d: 0xba, 0x37e: 0xba, 0x37f: 0xba, - // Block 0xe, offset 0x380 - 0x380: 0xba, 0x381: 0xba, 0x382: 0xba, 0x383: 0xba, 0x384: 0xba, 0x385: 0xba, 0x386: 0xba, 0x387: 0xba, - 0x388: 0xba, 0x389: 0xba, 0x38a: 0xba, 0x38b: 0xba, 0x38c: 0xba, 0x38d: 0xba, 0x38e: 0xba, 0x38f: 0xba, - 0x390: 0xba, 0x391: 0xba, 0x392: 0xba, 0x393: 0xba, 0x394: 0xba, 0x395: 0xba, 0x396: 0xba, 0x397: 0xba, - 0x398: 0xba, 0x399: 0xba, 0x39a: 0xba, 0x39b: 0xba, 0x39c: 0xba, 0x39d: 0xba, 0x39e: 0xba, 0x39f: 0xba, - 0x3a0: 0xba, 0x3a1: 0xba, 0x3a2: 0xba, 0x3a3: 0xba, 0x3a4: 0xfc, 0x3a5: 0xfd, 0x3a6: 0xfe, 0x3a7: 0xff, - 0x3a8: 0x46, 0x3a9: 0x100, 0x3aa: 0x101, 0x3ab: 0x47, 0x3ac: 0x48, 0x3ad: 0x49, 0x3ae: 0x4a, 0x3af: 0x4b, - 0x3b0: 0x102, 0x3b1: 0x4c, 0x3b2: 0x4d, 0x3b3: 0x4e, 0x3b4: 0x4f, 0x3b5: 0x50, 0x3b6: 0x103, 0x3b7: 0x51, - 0x3b8: 0x52, 0x3b9: 0x53, 0x3ba: 0x54, 0x3bb: 0x55, 0x3bc: 0x56, 0x3bd: 0x57, 0x3be: 0x58, 0x3bf: 0x59, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x104, 0x3c1: 0x105, 0x3c2: 0x9f, 0x3c3: 0x106, 0x3c4: 0x107, 0x3c5: 0x9b, 0x3c6: 0x108, 0x3c7: 0x109, - 0x3c8: 0xba, 0x3c9: 0xba, 0x3ca: 0x10a, 0x3cb: 0x10b, 0x3cc: 0x10c, 0x3cd: 0x10d, 0x3ce: 0x10e, 0x3cf: 0x10f, - 0x3d0: 0x110, 0x3d1: 0x9f, 0x3d2: 0x111, 0x3d3: 0x112, 0x3d4: 0x113, 0x3d5: 0x114, 0x3d6: 0xba, 0x3d7: 0xba, - 0x3d8: 0x9f, 0x3d9: 0x9f, 0x3da: 0x9f, 0x3db: 0x9f, 0x3dc: 0x115, 0x3dd: 0x116, 0x3de: 0xba, 0x3df: 0xba, - 0x3e0: 0x117, 0x3e1: 0x118, 0x3e2: 0x119, 0x3e3: 0x11a, 0x3e4: 0x11b, 0x3e5: 0xba, 0x3e6: 0x11c, 0x3e7: 0x11d, - 0x3e8: 0x11e, 0x3e9: 0x11f, 0x3ea: 0x120, 0x3eb: 0x5a, 0x3ec: 0x121, 0x3ed: 0x122, 0x3ee: 0x5b, 0x3ef: 0xba, - 0x3f0: 0x123, 0x3f1: 0x124, 0x3f2: 0x125, 0x3f3: 0x126, 0x3f4: 0xba, 0x3f5: 0xba, 0x3f6: 0xba, 0x3f7: 0xba, - 0x3f8: 0xba, 0x3f9: 0x127, 0x3fa: 0xba, 0x3fb: 0xba, 0x3fc: 0xba, 0x3fd: 0xba, 0x3fe: 0xba, 0x3ff: 0xba, - // Block 0x10, offset 0x400 - 0x400: 0x128, 0x401: 0x129, 0x402: 0x12a, 0x403: 0x12b, 0x404: 0x12c, 0x405: 0x12d, 0x406: 0x12e, 0x407: 0x12f, - 0x408: 0x130, 0x409: 0xba, 0x40a: 0x131, 0x40b: 0x132, 0x40c: 0x5c, 0x40d: 0x5d, 0x40e: 0xba, 0x40f: 0xba, - 0x410: 0x133, 0x411: 0x134, 0x412: 0x135, 0x413: 0x136, 0x414: 0xba, 0x415: 0xba, 0x416: 0x137, 0x417: 0x138, - 0x418: 0x139, 0x419: 0x13a, 0x41a: 0x13b, 0x41b: 0x13c, 0x41c: 0x13d, 0x41d: 0xba, 0x41e: 0xba, 0x41f: 0xba, - 0x420: 0xba, 0x421: 0xba, 0x422: 0x13e, 0x423: 0x13f, 0x424: 0xba, 0x425: 0xba, 0x426: 0xba, 0x427: 0xba, - 0x428: 0xba, 0x429: 0xba, 0x42a: 0xba, 0x42b: 0x140, 0x42c: 0xba, 0x42d: 0xba, 0x42e: 0xba, 0x42f: 0xba, - 0x430: 0x141, 0x431: 0x142, 0x432: 0x143, 0x433: 0xba, 0x434: 0xba, 0x435: 0xba, 0x436: 0xba, 0x437: 0xba, - 0x438: 0xba, 0x439: 0xba, 0x43a: 0xba, 0x43b: 0xba, 0x43c: 0xba, 0x43d: 0xba, 0x43e: 0xba, 0x43f: 0xba, - // Block 0x11, offset 0x440 - 0x440: 0x9f, 0x441: 0x9f, 0x442: 0x9f, 0x443: 0x9f, 0x444: 0x9f, 0x445: 0x9f, 0x446: 0x9f, 0x447: 0x9f, - 0x448: 0x9f, 0x449: 0x9f, 0x44a: 0x9f, 0x44b: 0x9f, 0x44c: 0x9f, 0x44d: 0x9f, 0x44e: 0x144, 0x44f: 0xba, - 0x450: 0x9b, 0x451: 0x145, 0x452: 0x9f, 0x453: 0x9f, 0x454: 0x9f, 0x455: 0x146, 0x456: 0xba, 0x457: 0xba, - 0x458: 0xba, 0x459: 0xba, 0x45a: 0xba, 0x45b: 0xba, 0x45c: 0xba, 0x45d: 0xba, 0x45e: 0xba, 0x45f: 0xba, - 0x460: 0xba, 0x461: 0xba, 0x462: 0xba, 0x463: 0xba, 0x464: 0xba, 0x465: 0xba, 0x466: 0xba, 0x467: 0xba, - 0x468: 0xba, 0x469: 0xba, 0x46a: 0xba, 0x46b: 0xba, 0x46c: 0xba, 0x46d: 0xba, 0x46e: 0xba, 0x46f: 0xba, - 0x470: 0xba, 0x471: 0xba, 0x472: 0xba, 0x473: 0xba, 0x474: 0xba, 0x475: 0xba, 0x476: 0xba, 0x477: 0xba, - 0x478: 0xba, 0x479: 0xba, 0x47a: 0xba, 0x47b: 0xba, 0x47c: 0xba, 0x47d: 0xba, 0x47e: 0xba, 0x47f: 0xba, - // Block 0x12, offset 0x480 - 0x480: 0x9f, 0x481: 0x9f, 0x482: 0x9f, 0x483: 0x9f, 0x484: 0x9f, 0x485: 0x9f, 0x486: 0x9f, 0x487: 0x9f, - 0x488: 0x9f, 0x489: 0x9f, 0x48a: 0x9f, 0x48b: 0x9f, 0x48c: 0x9f, 0x48d: 0x9f, 0x48e: 0x9f, 0x48f: 0x9f, - 0x490: 0x147, 0x491: 0xba, 0x492: 0xba, 0x493: 0xba, 0x494: 0xba, 0x495: 0xba, 0x496: 0xba, 0x497: 0xba, - 0x498: 0xba, 0x499: 0xba, 0x49a: 0xba, 0x49b: 0xba, 0x49c: 0xba, 0x49d: 0xba, 0x49e: 0xba, 0x49f: 0xba, - 0x4a0: 0xba, 0x4a1: 0xba, 0x4a2: 0xba, 0x4a3: 0xba, 0x4a4: 0xba, 0x4a5: 0xba, 0x4a6: 0xba, 0x4a7: 0xba, - 0x4a8: 0xba, 0x4a9: 0xba, 0x4aa: 0xba, 0x4ab: 0xba, 0x4ac: 0xba, 0x4ad: 0xba, 0x4ae: 0xba, 0x4af: 0xba, - 0x4b0: 0xba, 0x4b1: 0xba, 0x4b2: 0xba, 0x4b3: 0xba, 0x4b4: 0xba, 0x4b5: 0xba, 0x4b6: 0xba, 0x4b7: 0xba, - 0x4b8: 0xba, 0x4b9: 0xba, 0x4ba: 0xba, 0x4bb: 0xba, 0x4bc: 0xba, 0x4bd: 0xba, 0x4be: 0xba, 0x4bf: 0xba, - // Block 0x13, offset 0x4c0 - 0x4c0: 0xba, 0x4c1: 0xba, 0x4c2: 0xba, 0x4c3: 0xba, 0x4c4: 0xba, 0x4c5: 0xba, 0x4c6: 0xba, 0x4c7: 0xba, - 0x4c8: 0xba, 0x4c9: 0xba, 0x4ca: 0xba, 0x4cb: 0xba, 0x4cc: 0xba, 0x4cd: 0xba, 0x4ce: 0xba, 0x4cf: 0xba, - 0x4d0: 0x9f, 0x4d1: 0x9f, 0x4d2: 0x9f, 0x4d3: 0x9f, 0x4d4: 0x9f, 0x4d5: 0x9f, 0x4d6: 0x9f, 0x4d7: 0x9f, - 0x4d8: 0x9f, 0x4d9: 0x148, 0x4da: 0xba, 0x4db: 0xba, 0x4dc: 0xba, 0x4dd: 0xba, 0x4de: 0xba, 0x4df: 0xba, - 0x4e0: 0xba, 0x4e1: 0xba, 0x4e2: 0xba, 0x4e3: 0xba, 0x4e4: 0xba, 0x4e5: 0xba, 0x4e6: 0xba, 0x4e7: 0xba, - 0x4e8: 0xba, 0x4e9: 0xba, 0x4ea: 0xba, 0x4eb: 0xba, 0x4ec: 0xba, 0x4ed: 0xba, 0x4ee: 0xba, 0x4ef: 0xba, - 0x4f0: 0xba, 0x4f1: 0xba, 0x4f2: 0xba, 0x4f3: 0xba, 0x4f4: 0xba, 0x4f5: 0xba, 0x4f6: 0xba, 0x4f7: 0xba, - 0x4f8: 0xba, 0x4f9: 0xba, 0x4fa: 0xba, 0x4fb: 0xba, 0x4fc: 0xba, 0x4fd: 0xba, 0x4fe: 0xba, 0x4ff: 0xba, - // Block 0x14, offset 0x500 - 0x500: 0xba, 0x501: 0xba, 0x502: 0xba, 0x503: 0xba, 0x504: 0xba, 0x505: 0xba, 0x506: 0xba, 0x507: 0xba, - 0x508: 0xba, 0x509: 0xba, 0x50a: 0xba, 0x50b: 0xba, 0x50c: 0xba, 0x50d: 0xba, 0x50e: 0xba, 0x50f: 0xba, - 0x510: 0xba, 0x511: 0xba, 0x512: 0xba, 0x513: 0xba, 0x514: 0xba, 0x515: 0xba, 0x516: 0xba, 0x517: 0xba, - 0x518: 0xba, 0x519: 0xba, 0x51a: 0xba, 0x51b: 0xba, 0x51c: 0xba, 0x51d: 0xba, 0x51e: 0xba, 0x51f: 0xba, - 0x520: 0x9f, 0x521: 0x9f, 0x522: 0x9f, 0x523: 0x9f, 0x524: 0x9f, 0x525: 0x9f, 0x526: 0x9f, 0x527: 0x9f, - 0x528: 0x140, 0x529: 0x149, 0x52a: 0xba, 0x52b: 0x14a, 0x52c: 0x14b, 0x52d: 0x14c, 0x52e: 0x14d, 0x52f: 0xba, - 0x530: 0xba, 0x531: 0xba, 0x532: 0xba, 0x533: 0xba, 0x534: 0xba, 0x535: 0xba, 0x536: 0xba, 0x537: 0xba, - 0x538: 0xba, 0x539: 0xba, 0x53a: 0xba, 0x53b: 0xba, 0x53c: 0x9f, 0x53d: 0x14e, 0x53e: 0x14f, 0x53f: 0x150, - // Block 0x15, offset 0x540 - 0x540: 0x9f, 0x541: 0x9f, 0x542: 0x9f, 0x543: 0x9f, 0x544: 0x9f, 0x545: 0x9f, 0x546: 0x9f, 0x547: 0x9f, - 0x548: 0x9f, 0x549: 0x9f, 0x54a: 0x9f, 0x54b: 0x9f, 0x54c: 0x9f, 0x54d: 0x9f, 0x54e: 0x9f, 0x54f: 0x9f, - 0x550: 0x9f, 0x551: 0x9f, 0x552: 0x9f, 0x553: 0x9f, 0x554: 0x9f, 0x555: 0x9f, 0x556: 0x9f, 0x557: 0x9f, - 0x558: 0x9f, 0x559: 0x9f, 0x55a: 0x9f, 0x55b: 0x9f, 0x55c: 0x9f, 0x55d: 0x9f, 0x55e: 0x9f, 0x55f: 0x151, - 0x560: 0x9f, 0x561: 0x9f, 0x562: 0x9f, 0x563: 0x9f, 0x564: 0x9f, 0x565: 0x9f, 0x566: 0x9f, 0x567: 0x9f, - 0x568: 0x9f, 0x569: 0x9f, 0x56a: 0x9f, 0x56b: 0x152, 0x56c: 0xba, 0x56d: 0xba, 0x56e: 0xba, 0x56f: 0xba, - 0x570: 0xba, 0x571: 0xba, 0x572: 0xba, 0x573: 0xba, 0x574: 0xba, 0x575: 0xba, 0x576: 0xba, 0x577: 0xba, - 0x578: 0xba, 0x579: 0xba, 0x57a: 0xba, 0x57b: 0xba, 0x57c: 0xba, 0x57d: 0xba, 0x57e: 0xba, 0x57f: 0xba, - // Block 0x16, offset 0x580 - 0x580: 0x153, 0x581: 0xba, 0x582: 0xba, 0x583: 0xba, 0x584: 0xba, 0x585: 0xba, 0x586: 0xba, 0x587: 0xba, - 0x588: 0xba, 0x589: 0xba, 0x58a: 0xba, 0x58b: 0xba, 0x58c: 0xba, 0x58d: 0xba, 0x58e: 0xba, 0x58f: 0xba, - 0x590: 0xba, 0x591: 0xba, 0x592: 0xba, 0x593: 0xba, 0x594: 0xba, 0x595: 0xba, 0x596: 0xba, 0x597: 0xba, - 0x598: 0xba, 0x599: 0xba, 0x59a: 0xba, 0x59b: 0xba, 0x59c: 0xba, 0x59d: 0xba, 0x59e: 0xba, 0x59f: 0xba, - 0x5a0: 0xba, 0x5a1: 0xba, 0x5a2: 0xba, 0x5a3: 0xba, 0x5a4: 0xba, 0x5a5: 0xba, 0x5a6: 0xba, 0x5a7: 0xba, - 0x5a8: 0xba, 0x5a9: 0xba, 0x5aa: 0xba, 0x5ab: 0xba, 0x5ac: 0xba, 0x5ad: 0xba, 0x5ae: 0xba, 0x5af: 0xba, - 0x5b0: 0x9f, 0x5b1: 0x154, 0x5b2: 0x155, 0x5b3: 0xba, 0x5b4: 0xba, 0x5b5: 0xba, 0x5b6: 0xba, 0x5b7: 0xba, - 0x5b8: 0xba, 0x5b9: 0xba, 0x5ba: 0xba, 0x5bb: 0xba, 0x5bc: 0xba, 0x5bd: 0xba, 0x5be: 0xba, 0x5bf: 0xba, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x9b, 0x5c1: 0x9b, 0x5c2: 0x9b, 0x5c3: 0x156, 0x5c4: 0x157, 0x5c5: 0x158, 0x5c6: 0x159, 0x5c7: 0x15a, - 0x5c8: 0x9b, 0x5c9: 0x15b, 0x5ca: 0xba, 0x5cb: 0xba, 0x5cc: 0x9b, 0x5cd: 0x15c, 0x5ce: 0xba, 0x5cf: 0xba, - 0x5d0: 0x5e, 0x5d1: 0x5f, 0x5d2: 0x60, 0x5d3: 0x61, 0x5d4: 0x62, 0x5d5: 0x63, 0x5d6: 0x64, 0x5d7: 0x65, - 0x5d8: 0x66, 0x5d9: 0x67, 0x5da: 0x68, 0x5db: 0x69, 0x5dc: 0x6a, 0x5dd: 0x6b, 0x5de: 0x6c, 0x5df: 0x6d, - 0x5e0: 0x9b, 0x5e1: 0x9b, 0x5e2: 0x9b, 0x5e3: 0x9b, 0x5e4: 0x9b, 0x5e5: 0x9b, 0x5e6: 0x9b, 0x5e7: 0x9b, - 0x5e8: 0x15d, 0x5e9: 0x15e, 0x5ea: 0x15f, 0x5eb: 0xba, 0x5ec: 0xba, 0x5ed: 0xba, 0x5ee: 0xba, 0x5ef: 0xba, - 0x5f0: 0xba, 0x5f1: 0xba, 0x5f2: 0xba, 0x5f3: 0xba, 0x5f4: 0xba, 0x5f5: 0xba, 0x5f6: 0xba, 0x5f7: 0xba, - 0x5f8: 0xba, 0x5f9: 0xba, 0x5fa: 0xba, 0x5fb: 0xba, 0x5fc: 0xba, 0x5fd: 0xba, 0x5fe: 0xba, 0x5ff: 0xba, - // Block 0x18, offset 0x600 - 0x600: 0x160, 0x601: 0xba, 0x602: 0xba, 0x603: 0xba, 0x604: 0xba, 0x605: 0xba, 0x606: 0xba, 0x607: 0xba, - 0x608: 0xba, 0x609: 0xba, 0x60a: 0xba, 0x60b: 0xba, 0x60c: 0xba, 0x60d: 0xba, 0x60e: 0xba, 0x60f: 0xba, - 0x610: 0xba, 0x611: 0xba, 0x612: 0xba, 0x613: 0xba, 0x614: 0xba, 0x615: 0xba, 0x616: 0xba, 0x617: 0xba, - 0x618: 0xba, 0x619: 0xba, 0x61a: 0xba, 0x61b: 0xba, 0x61c: 0xba, 0x61d: 0xba, 0x61e: 0xba, 0x61f: 0xba, - 0x620: 0x123, 0x621: 0x123, 0x622: 0x123, 0x623: 0x161, 0x624: 0x6e, 0x625: 0x162, 0x626: 0xba, 0x627: 0xba, - 0x628: 0xba, 0x629: 0xba, 0x62a: 0xba, 0x62b: 0xba, 0x62c: 0xba, 0x62d: 0xba, 0x62e: 0xba, 0x62f: 0xba, - 0x630: 0xba, 0x631: 0xba, 0x632: 0xba, 0x633: 0xba, 0x634: 0xba, 0x635: 0xba, 0x636: 0xba, 0x637: 0xba, - 0x638: 0x6f, 0x639: 0x70, 0x63a: 0x71, 0x63b: 0x163, 0x63c: 0xba, 0x63d: 0xba, 0x63e: 0xba, 0x63f: 0xba, - // Block 0x19, offset 0x640 - 0x640: 0x164, 0x641: 0x9b, 0x642: 0x165, 0x643: 0x166, 0x644: 0x72, 0x645: 0x73, 0x646: 0x167, 0x647: 0x168, - 0x648: 0x74, 0x649: 0x169, 0x64a: 0xba, 0x64b: 0xba, 0x64c: 0x9b, 0x64d: 0x9b, 0x64e: 0x9b, 0x64f: 0x9b, - 0x650: 0x9b, 0x651: 0x9b, 0x652: 0x9b, 0x653: 0x9b, 0x654: 0x9b, 0x655: 0x9b, 0x656: 0x9b, 0x657: 0x9b, - 0x658: 0x9b, 0x659: 0x9b, 0x65a: 0x9b, 0x65b: 0x16a, 0x65c: 0x9b, 0x65d: 0x16b, 0x65e: 0x9b, 0x65f: 0x16c, - 0x660: 0x16d, 0x661: 0x16e, 0x662: 0x16f, 0x663: 0xba, 0x664: 0x170, 0x665: 0x171, 0x666: 0x172, 0x667: 0x173, - 0x668: 0xba, 0x669: 0xba, 0x66a: 0xba, 0x66b: 0xba, 0x66c: 0xba, 0x66d: 0xba, 0x66e: 0xba, 0x66f: 0xba, - 0x670: 0xba, 0x671: 0xba, 0x672: 0xba, 0x673: 0xba, 0x674: 0xba, 0x675: 0xba, 0x676: 0xba, 0x677: 0xba, - 0x678: 0xba, 0x679: 0xba, 0x67a: 0xba, 0x67b: 0xba, 0x67c: 0xba, 0x67d: 0xba, 0x67e: 0xba, 0x67f: 0xba, - // Block 0x1a, offset 0x680 - 0x680: 0x9f, 0x681: 0x9f, 0x682: 0x9f, 0x683: 0x9f, 0x684: 0x9f, 0x685: 0x9f, 0x686: 0x9f, 0x687: 0x9f, - 0x688: 0x9f, 0x689: 0x9f, 0x68a: 0x9f, 0x68b: 0x9f, 0x68c: 0x9f, 0x68d: 0x9f, 0x68e: 0x9f, 0x68f: 0x9f, - 0x690: 0x9f, 0x691: 0x9f, 0x692: 0x9f, 0x693: 0x9f, 0x694: 0x9f, 0x695: 0x9f, 0x696: 0x9f, 0x697: 0x9f, - 0x698: 0x9f, 0x699: 0x9f, 0x69a: 0x9f, 0x69b: 0x174, 0x69c: 0x9f, 0x69d: 0x9f, 0x69e: 0x9f, 0x69f: 0x9f, - 0x6a0: 0x9f, 0x6a1: 0x9f, 0x6a2: 0x9f, 0x6a3: 0x9f, 0x6a4: 0x9f, 0x6a5: 0x9f, 0x6a6: 0x9f, 0x6a7: 0x9f, - 0x6a8: 0x9f, 0x6a9: 0x9f, 0x6aa: 0x9f, 0x6ab: 0x9f, 0x6ac: 0x9f, 0x6ad: 0x9f, 0x6ae: 0x9f, 0x6af: 0x9f, - 0x6b0: 0x9f, 0x6b1: 0x9f, 0x6b2: 0x9f, 0x6b3: 0x9f, 0x6b4: 0x9f, 0x6b5: 0x9f, 0x6b6: 0x9f, 0x6b7: 0x9f, - 0x6b8: 0x9f, 0x6b9: 0x9f, 0x6ba: 0x9f, 0x6bb: 0x9f, 0x6bc: 0x9f, 0x6bd: 0x9f, 0x6be: 0x9f, 0x6bf: 0x9f, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x9f, 0x6c1: 0x9f, 0x6c2: 0x9f, 0x6c3: 0x9f, 0x6c4: 0x9f, 0x6c5: 0x9f, 0x6c6: 0x9f, 0x6c7: 0x9f, - 0x6c8: 0x9f, 0x6c9: 0x9f, 0x6ca: 0x9f, 0x6cb: 0x9f, 0x6cc: 0x9f, 0x6cd: 0x9f, 0x6ce: 0x9f, 0x6cf: 0x9f, - 0x6d0: 0x9f, 0x6d1: 0x9f, 0x6d2: 0x9f, 0x6d3: 0x9f, 0x6d4: 0x9f, 0x6d5: 0x9f, 0x6d6: 0x9f, 0x6d7: 0x9f, - 0x6d8: 0x9f, 0x6d9: 0x9f, 0x6da: 0x9f, 0x6db: 0x9f, 0x6dc: 0x175, 0x6dd: 0x9f, 0x6de: 0x9f, 0x6df: 0x9f, - 0x6e0: 0x176, 0x6e1: 0x9f, 0x6e2: 0x9f, 0x6e3: 0x9f, 0x6e4: 0x9f, 0x6e5: 0x9f, 0x6e6: 0x9f, 0x6e7: 0x9f, - 0x6e8: 0x9f, 0x6e9: 0x9f, 0x6ea: 0x9f, 0x6eb: 0x9f, 0x6ec: 0x9f, 0x6ed: 0x9f, 0x6ee: 0x9f, 0x6ef: 0x9f, - 0x6f0: 0x9f, 0x6f1: 0x9f, 0x6f2: 0x9f, 0x6f3: 0x9f, 0x6f4: 0x9f, 0x6f5: 0x9f, 0x6f6: 0x9f, 0x6f7: 0x9f, - 0x6f8: 0x9f, 0x6f9: 0x9f, 0x6fa: 0x9f, 0x6fb: 0x9f, 0x6fc: 0x9f, 0x6fd: 0x9f, 0x6fe: 0x9f, 0x6ff: 0x9f, - // Block 0x1c, offset 0x700 - 0x700: 0x9f, 0x701: 0x9f, 0x702: 0x9f, 0x703: 0x9f, 0x704: 0x9f, 0x705: 0x9f, 0x706: 0x9f, 0x707: 0x9f, - 0x708: 0x9f, 0x709: 0x9f, 0x70a: 0x9f, 0x70b: 0x9f, 0x70c: 0x9f, 0x70d: 0x9f, 0x70e: 0x9f, 0x70f: 0x9f, - 0x710: 0x9f, 0x711: 0x9f, 0x712: 0x9f, 0x713: 0x9f, 0x714: 0x9f, 0x715: 0x9f, 0x716: 0x9f, 0x717: 0x9f, - 0x718: 0x9f, 0x719: 0x9f, 0x71a: 0x9f, 0x71b: 0x9f, 0x71c: 0x9f, 0x71d: 0x9f, 0x71e: 0x9f, 0x71f: 0x9f, - 0x720: 0x9f, 0x721: 0x9f, 0x722: 0x9f, 0x723: 0x9f, 0x724: 0x9f, 0x725: 0x9f, 0x726: 0x9f, 0x727: 0x9f, - 0x728: 0x9f, 0x729: 0x9f, 0x72a: 0x9f, 0x72b: 0x9f, 0x72c: 0x9f, 0x72d: 0x9f, 0x72e: 0x9f, 0x72f: 0x9f, - 0x730: 0x9f, 0x731: 0x9f, 0x732: 0x9f, 0x733: 0x9f, 0x734: 0x9f, 0x735: 0x9f, 0x736: 0x9f, 0x737: 0x9f, - 0x738: 0x9f, 0x739: 0x9f, 0x73a: 0x177, 0x73b: 0xba, 0x73c: 0xba, 0x73d: 0xba, 0x73e: 0xba, 0x73f: 0xba, - // Block 0x1d, offset 0x740 - 0x740: 0xba, 0x741: 0xba, 0x742: 0xba, 0x743: 0xba, 0x744: 0xba, 0x745: 0xba, 0x746: 0xba, 0x747: 0xba, - 0x748: 0xba, 0x749: 0xba, 0x74a: 0xba, 0x74b: 0xba, 0x74c: 0xba, 0x74d: 0xba, 0x74e: 0xba, 0x74f: 0xba, - 0x750: 0xba, 0x751: 0xba, 0x752: 0xba, 0x753: 0xba, 0x754: 0xba, 0x755: 0xba, 0x756: 0xba, 0x757: 0xba, - 0x758: 0xba, 0x759: 0xba, 0x75a: 0xba, 0x75b: 0xba, 0x75c: 0xba, 0x75d: 0xba, 0x75e: 0xba, 0x75f: 0xba, - 0x760: 0x75, 0x761: 0x76, 0x762: 0x77, 0x763: 0x178, 0x764: 0x78, 0x765: 0x79, 0x766: 0x179, 0x767: 0x7a, - 0x768: 0x7b, 0x769: 0xba, 0x76a: 0xba, 0x76b: 0xba, 0x76c: 0xba, 0x76d: 0xba, 0x76e: 0xba, 0x76f: 0xba, - 0x770: 0xba, 0x771: 0xba, 0x772: 0xba, 0x773: 0xba, 0x774: 0xba, 0x775: 0xba, 0x776: 0xba, 0x777: 0xba, - 0x778: 0xba, 0x779: 0xba, 0x77a: 0xba, 0x77b: 0xba, 0x77c: 0xba, 0x77d: 0xba, 0x77e: 0xba, 0x77f: 0xba, - // Block 0x1e, offset 0x780 - 0x790: 0x0d, 0x791: 0x0e, 0x792: 0x0f, 0x793: 0x10, 0x794: 0x11, 0x795: 0x0b, 0x796: 0x12, 0x797: 0x07, - 0x798: 0x13, 0x799: 0x0b, 0x79a: 0x0b, 0x79b: 0x14, 0x79c: 0x0b, 0x79d: 0x15, 0x79e: 0x16, 0x79f: 0x17, - 0x7a0: 0x07, 0x7a1: 0x07, 0x7a2: 0x07, 0x7a3: 0x07, 0x7a4: 0x07, 0x7a5: 0x07, 0x7a6: 0x07, 0x7a7: 0x07, - 0x7a8: 0x07, 0x7a9: 0x07, 0x7aa: 0x18, 0x7ab: 0x19, 0x7ac: 0x1a, 0x7ad: 0x0b, 0x7ae: 0x0b, 0x7af: 0x1b, - 0x7b0: 0x0b, 0x7b1: 0x0b, 0x7b2: 0x0b, 0x7b3: 0x0b, 0x7b4: 0x0b, 0x7b5: 0x0b, 0x7b6: 0x0b, 0x7b7: 0x0b, - 0x7b8: 0x0b, 0x7b9: 0x0b, 0x7ba: 0x0b, 0x7bb: 0x0b, 0x7bc: 0x0b, 0x7bd: 0x0b, 0x7be: 0x0b, 0x7bf: 0x0b, - // Block 0x1f, offset 0x7c0 - 0x7c0: 0x0b, 0x7c1: 0x0b, 0x7c2: 0x0b, 0x7c3: 0x0b, 0x7c4: 0x0b, 0x7c5: 0x0b, 0x7c6: 0x0b, 0x7c7: 0x0b, - 0x7c8: 0x0b, 0x7c9: 0x0b, 0x7ca: 0x0b, 0x7cb: 0x0b, 0x7cc: 0x0b, 0x7cd: 0x0b, 0x7ce: 0x0b, 0x7cf: 0x0b, - 0x7d0: 0x0b, 0x7d1: 0x0b, 0x7d2: 0x0b, 0x7d3: 0x0b, 0x7d4: 0x0b, 0x7d5: 0x0b, 0x7d6: 0x0b, 0x7d7: 0x0b, - 0x7d8: 0x0b, 0x7d9: 0x0b, 0x7da: 0x0b, 0x7db: 0x0b, 0x7dc: 0x0b, 0x7dd: 0x0b, 0x7de: 0x0b, 0x7df: 0x0b, - 0x7e0: 0x0b, 0x7e1: 0x0b, 0x7e2: 0x0b, 0x7e3: 0x0b, 0x7e4: 0x0b, 0x7e5: 0x0b, 0x7e6: 0x0b, 0x7e7: 0x0b, - 0x7e8: 0x0b, 0x7e9: 0x0b, 0x7ea: 0x0b, 0x7eb: 0x0b, 0x7ec: 0x0b, 0x7ed: 0x0b, 0x7ee: 0x0b, 0x7ef: 0x0b, - 0x7f0: 0x0b, 0x7f1: 0x0b, 0x7f2: 0x0b, 0x7f3: 0x0b, 0x7f4: 0x0b, 0x7f5: 0x0b, 0x7f6: 0x0b, 0x7f7: 0x0b, - 0x7f8: 0x0b, 0x7f9: 0x0b, 0x7fa: 0x0b, 0x7fb: 0x0b, 0x7fc: 0x0b, 0x7fd: 0x0b, 0x7fe: 0x0b, 0x7ff: 0x0b, - // Block 0x20, offset 0x800 - 0x800: 0x17a, 0x801: 0x17b, 0x802: 0xba, 0x803: 0xba, 0x804: 0x17c, 0x805: 0x17c, 0x806: 0x17c, 0x807: 0x17d, - 0x808: 0xba, 0x809: 0xba, 0x80a: 0xba, 0x80b: 0xba, 0x80c: 0xba, 0x80d: 0xba, 0x80e: 0xba, 0x80f: 0xba, - 0x810: 0xba, 0x811: 0xba, 0x812: 0xba, 0x813: 0xba, 0x814: 0xba, 0x815: 0xba, 0x816: 0xba, 0x817: 0xba, - 0x818: 0xba, 0x819: 0xba, 0x81a: 0xba, 0x81b: 0xba, 0x81c: 0xba, 0x81d: 0xba, 0x81e: 0xba, 0x81f: 0xba, - 0x820: 0xba, 0x821: 0xba, 0x822: 0xba, 0x823: 0xba, 0x824: 0xba, 0x825: 0xba, 0x826: 0xba, 0x827: 0xba, - 0x828: 0xba, 0x829: 0xba, 0x82a: 0xba, 0x82b: 0xba, 0x82c: 0xba, 0x82d: 0xba, 0x82e: 0xba, 0x82f: 0xba, - 0x830: 0xba, 0x831: 0xba, 0x832: 0xba, 0x833: 0xba, 0x834: 0xba, 0x835: 0xba, 0x836: 0xba, 0x837: 0xba, - 0x838: 0xba, 0x839: 0xba, 0x83a: 0xba, 0x83b: 0xba, 0x83c: 0xba, 0x83d: 0xba, 0x83e: 0xba, 0x83f: 0xba, - // Block 0x21, offset 0x840 - 0x840: 0x0b, 0x841: 0x0b, 0x842: 0x0b, 0x843: 0x0b, 0x844: 0x0b, 0x845: 0x0b, 0x846: 0x0b, 0x847: 0x0b, - 0x848: 0x0b, 0x849: 0x0b, 0x84a: 0x0b, 0x84b: 0x0b, 0x84c: 0x0b, 0x84d: 0x0b, 0x84e: 0x0b, 0x84f: 0x0b, - 0x850: 0x0b, 0x851: 0x0b, 0x852: 0x0b, 0x853: 0x0b, 0x854: 0x0b, 0x855: 0x0b, 0x856: 0x0b, 0x857: 0x0b, - 0x858: 0x0b, 0x859: 0x0b, 0x85a: 0x0b, 0x85b: 0x0b, 0x85c: 0x0b, 0x85d: 0x0b, 0x85e: 0x0b, 0x85f: 0x0b, - 0x860: 0x1e, 0x861: 0x0b, 0x862: 0x0b, 0x863: 0x0b, 0x864: 0x0b, 0x865: 0x0b, 0x866: 0x0b, 0x867: 0x0b, - 0x868: 0x0b, 0x869: 0x0b, 0x86a: 0x0b, 0x86b: 0x0b, 0x86c: 0x0b, 0x86d: 0x0b, 0x86e: 0x0b, 0x86f: 0x0b, - 0x870: 0x0b, 0x871: 0x0b, 0x872: 0x0b, 0x873: 0x0b, 0x874: 0x0b, 0x875: 0x0b, 0x876: 0x0b, 0x877: 0x0b, - 0x878: 0x0b, 0x879: 0x0b, 0x87a: 0x0b, 0x87b: 0x0b, 0x87c: 0x0b, 0x87d: 0x0b, 0x87e: 0x0b, 0x87f: 0x0b, - // Block 0x22, offset 0x880 - 0x880: 0x0b, 0x881: 0x0b, 0x882: 0x0b, 0x883: 0x0b, 0x884: 0x0b, 0x885: 0x0b, 0x886: 0x0b, 0x887: 0x0b, - 0x888: 0x0b, 0x889: 0x0b, 0x88a: 0x0b, 0x88b: 0x0b, 0x88c: 0x0b, 0x88d: 0x0b, 0x88e: 0x0b, 0x88f: 0x0b, -} - -// idnaSparseOffset: 258 entries, 516 bytes -var idnaSparseOffset = []uint16{0x0, 0x8, 0x19, 0x25, 0x27, 0x2c, 0x34, 0x3f, 0x4b, 0x4f, 0x5e, 0x63, 0x6b, 0x77, 0x85, 0x93, 0x98, 0xa1, 0xb1, 0xbf, 0xcc, 0xd8, 0xe9, 0xf3, 0xfa, 0x107, 0x118, 0x11f, 0x12a, 0x139, 0x147, 0x151, 0x153, 0x158, 0x15b, 0x15e, 0x160, 0x16c, 0x177, 0x17f, 0x185, 0x18b, 0x190, 0x195, 0x198, 0x19c, 0x1a2, 0x1a7, 0x1b3, 0x1bd, 0x1c3, 0x1d4, 0x1de, 0x1e1, 0x1e9, 0x1ec, 0x1f9, 0x201, 0x205, 0x20c, 0x214, 0x224, 0x230, 0x232, 0x23c, 0x248, 0x254, 0x260, 0x268, 0x26d, 0x277, 0x288, 0x28c, 0x297, 0x29b, 0x2a4, 0x2ac, 0x2b2, 0x2b7, 0x2ba, 0x2bd, 0x2c1, 0x2c7, 0x2cb, 0x2cf, 0x2d5, 0x2dc, 0x2e2, 0x2ea, 0x2f1, 0x2fc, 0x306, 0x30a, 0x30d, 0x313, 0x317, 0x319, 0x31c, 0x31e, 0x321, 0x32b, 0x32e, 0x33d, 0x341, 0x346, 0x349, 0x34d, 0x352, 0x357, 0x35d, 0x363, 0x372, 0x378, 0x37c, 0x38b, 0x390, 0x398, 0x3a2, 0x3ad, 0x3b5, 0x3c6, 0x3cf, 0x3df, 0x3ec, 0x3f6, 0x3fb, 0x408, 0x40c, 0x411, 0x413, 0x417, 0x419, 0x41d, 0x426, 0x42c, 0x430, 0x440, 0x44a, 0x44f, 0x452, 0x458, 0x45f, 0x464, 0x468, 0x46e, 0x473, 0x47c, 0x481, 0x487, 0x48e, 0x495, 0x49c, 0x4a0, 0x4a5, 0x4a8, 0x4ad, 0x4b9, 0x4bf, 0x4c4, 0x4cb, 0x4d3, 0x4d8, 0x4dc, 0x4ec, 0x4f3, 0x4f7, 0x4fb, 0x502, 0x504, 0x507, 0x50a, 0x50e, 0x512, 0x518, 0x521, 0x52d, 0x534, 0x53d, 0x545, 0x54c, 0x55a, 0x567, 0x574, 0x57d, 0x581, 0x58f, 0x597, 0x5a2, 0x5ab, 0x5b1, 0x5b9, 0x5c2, 0x5cc, 0x5cf, 0x5db, 0x5de, 0x5e3, 0x5e6, 0x5f0, 0x5f9, 0x605, 0x608, 0x60d, 0x610, 0x613, 0x616, 0x61d, 0x624, 0x628, 0x633, 0x636, 0x63c, 0x641, 0x645, 0x648, 0x64b, 0x64e, 0x653, 0x65d, 0x660, 0x664, 0x673, 0x67f, 0x683, 0x688, 0x68d, 0x691, 0x696, 0x69f, 0x6aa, 0x6b0, 0x6b8, 0x6bc, 0x6c0, 0x6c6, 0x6cc, 0x6d1, 0x6d4, 0x6e2, 0x6e9, 0x6ec, 0x6ef, 0x6f3, 0x6f9, 0x6fe, 0x708, 0x70d, 0x710, 0x713, 0x716, 0x719, 0x71d, 0x720, 0x730, 0x741, 0x746, 0x748, 0x74a} - -// idnaSparseValues: 1869 entries, 7476 bytes -var idnaSparseValues = [1869]valueRange{ - // Block 0x0, offset 0x0 - {value: 0x0000, lo: 0x07}, - {value: 0xe105, lo: 0x80, hi: 0x96}, - {value: 0x0018, lo: 0x97, hi: 0x97}, - {value: 0xe105, lo: 0x98, hi: 0x9e}, - {value: 0x001f, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbf}, - // Block 0x1, offset 0x8 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0xe01d, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0335, lo: 0x83, hi: 0x83}, - {value: 0x034d, lo: 0x84, hi: 0x84}, - {value: 0x0365, lo: 0x85, hi: 0x85}, - {value: 0xe00d, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0xe00d, lo: 0x88, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x89}, - {value: 0xe00d, lo: 0x8a, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe00d, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0x8d}, - {value: 0xe00d, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0xbf}, - // Block 0x2, offset 0x19 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x0249, lo: 0xb0, hi: 0xb0}, - {value: 0x037d, lo: 0xb1, hi: 0xb1}, - {value: 0x0259, lo: 0xb2, hi: 0xb2}, - {value: 0x0269, lo: 0xb3, hi: 0xb3}, - {value: 0x034d, lo: 0xb4, hi: 0xb4}, - {value: 0x0395, lo: 0xb5, hi: 0xb5}, - {value: 0xe1bd, lo: 0xb6, hi: 0xb6}, - {value: 0x0279, lo: 0xb7, hi: 0xb7}, - {value: 0x0289, lo: 0xb8, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbf}, - // Block 0x3, offset 0x25 - {value: 0x0000, lo: 0x01}, - {value: 0x3308, lo: 0x80, hi: 0xbf}, - // Block 0x4, offset 0x27 - {value: 0x0000, lo: 0x04}, - {value: 0x03f5, lo: 0x80, hi: 0x8f}, - {value: 0xe105, lo: 0x90, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x5, offset 0x2c - {value: 0x0000, lo: 0x07}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x0545, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x0008, lo: 0x99, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xbf}, - // Block 0x6, offset 0x34 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0401, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x88}, - {value: 0x0018, lo: 0x89, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x3308, lo: 0x91, hi: 0xbd}, - {value: 0x0818, lo: 0xbe, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x7, offset 0x3f - {value: 0x0000, lo: 0x0b}, - {value: 0x0818, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x82}, - {value: 0x0818, lo: 0x83, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x85}, - {value: 0x0818, lo: 0x86, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0808, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x8, offset 0x4b - {value: 0x0000, lo: 0x03}, - {value: 0x0a08, lo: 0x80, hi: 0x87}, - {value: 0x0c08, lo: 0x88, hi: 0x99}, - {value: 0x0a08, lo: 0x9a, hi: 0xbf}, - // Block 0x9, offset 0x4f - {value: 0x0000, lo: 0x0e}, - {value: 0x3308, lo: 0x80, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8c}, - {value: 0x0c08, lo: 0x8d, hi: 0x8d}, - {value: 0x0a08, lo: 0x8e, hi: 0x98}, - {value: 0x0c08, lo: 0x99, hi: 0x9b}, - {value: 0x0a08, lo: 0x9c, hi: 0xaa}, - {value: 0x0c08, lo: 0xab, hi: 0xac}, - {value: 0x0a08, lo: 0xad, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb1}, - {value: 0x0a08, lo: 0xb2, hi: 0xb2}, - {value: 0x0c08, lo: 0xb3, hi: 0xb4}, - {value: 0x0a08, lo: 0xb5, hi: 0xb7}, - {value: 0x0c08, lo: 0xb8, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbf}, - // Block 0xa, offset 0x5e - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xb0}, - {value: 0x0808, lo: 0xb1, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xb, offset 0x63 - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x89}, - {value: 0x0a08, lo: 0x8a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0xc, offset 0x6b - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x99}, - {value: 0x0808, lo: 0x9a, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa3}, - {value: 0x0808, lo: 0xa4, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa7}, - {value: 0x0808, lo: 0xa8, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0818, lo: 0xb0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xd, offset 0x77 - {value: 0x0000, lo: 0x0d}, - {value: 0x0c08, lo: 0x80, hi: 0x80}, - {value: 0x0a08, lo: 0x81, hi: 0x85}, - {value: 0x0c08, lo: 0x86, hi: 0x87}, - {value: 0x0a08, lo: 0x88, hi: 0x88}, - {value: 0x0c08, lo: 0x89, hi: 0x89}, - {value: 0x0a08, lo: 0x8a, hi: 0x93}, - {value: 0x0c08, lo: 0x94, hi: 0x94}, - {value: 0x0a08, lo: 0x95, hi: 0x95}, - {value: 0x0808, lo: 0x96, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9d}, - {value: 0x0818, lo: 0x9e, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xbf}, - // Block 0xe, offset 0x85 - {value: 0x0000, lo: 0x0d}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0a08, lo: 0xa0, hi: 0xa9}, - {value: 0x0c08, lo: 0xaa, hi: 0xac}, - {value: 0x0808, lo: 0xad, hi: 0xad}, - {value: 0x0c08, lo: 0xae, hi: 0xae}, - {value: 0x0a08, lo: 0xaf, hi: 0xb0}, - {value: 0x0c08, lo: 0xb1, hi: 0xb2}, - {value: 0x0a08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0a08, lo: 0xb6, hi: 0xb8}, - {value: 0x0c08, lo: 0xb9, hi: 0xb9}, - {value: 0x0a08, lo: 0xba, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0xf, offset 0x93 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0xa1}, - {value: 0x0840, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xbf}, - // Block 0x10, offset 0x98 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x11, offset 0xa1 - {value: 0x0000, lo: 0x0f}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x85}, - {value: 0x3008, lo: 0x86, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x3008, lo: 0x8a, hi: 0x8c}, - {value: 0x3b08, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x12, offset 0xb1 - {value: 0x0000, lo: 0x0d}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xa9}, - {value: 0x0008, lo: 0xaa, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x13, offset 0xbf - {value: 0x0000, lo: 0x0c}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x14, offset 0xcc - {value: 0x0000, lo: 0x0b}, - {value: 0x0040, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x15, offset 0xd8 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x89}, - {value: 0x3b08, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x3008, lo: 0x98, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x16, offset 0xe9 - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb2}, - {value: 0x08f1, lo: 0xb3, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb9}, - {value: 0x3b08, lo: 0xba, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x0018, lo: 0xbf, hi: 0xbf}, - // Block 0x17, offset 0xf3 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x8e}, - {value: 0x0018, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0xbf}, - // Block 0x18, offset 0xfa - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0961, lo: 0x9c, hi: 0x9c}, - {value: 0x0999, lo: 0x9d, hi: 0x9d}, - {value: 0x0008, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x19, offset 0x107 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8a}, - {value: 0x0008, lo: 0x8b, hi: 0x8b}, - {value: 0xe03d, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x1a, offset 0x118 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0xbf}, - // Block 0x1b, offset 0x11f - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x1c, offset 0x12a - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x3008, lo: 0x96, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x3308, lo: 0x9e, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xa1}, - {value: 0x3008, lo: 0xa2, hi: 0xa4}, - {value: 0x0008, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xbf}, - // Block 0x1d, offset 0x139 - {value: 0x0000, lo: 0x0d}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x8c}, - {value: 0x3308, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x8e}, - {value: 0x3008, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x3008, lo: 0x9a, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0x1e, offset 0x147 - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x86}, - {value: 0x055d, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8c}, - {value: 0x055d, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbb}, - {value: 0xe105, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0x1f, offset 0x151 - {value: 0x0000, lo: 0x01}, - {value: 0x0018, lo: 0x80, hi: 0xbf}, - // Block 0x20, offset 0x153 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa0}, - {value: 0x2018, lo: 0xa1, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x21, offset 0x158 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa7}, - {value: 0x2018, lo: 0xa8, hi: 0xbf}, - // Block 0x22, offset 0x15b - {value: 0x0000, lo: 0x02}, - {value: 0x2018, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0xbf}, - // Block 0x23, offset 0x15e - {value: 0x0000, lo: 0x01}, - {value: 0x0008, lo: 0x80, hi: 0xbf}, - // Block 0x24, offset 0x160 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x99}, - {value: 0x0008, lo: 0x9a, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x25, offset 0x16c - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x26, offset 0x177 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x27, offset 0x17f - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0x0008, lo: 0x92, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbf}, - // Block 0x28, offset 0x185 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x29, offset 0x18b - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x2a, offset 0x190 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x2b, offset 0x195 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x2c, offset 0x198 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xbf}, - // Block 0x2d, offset 0x19c - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x2e, offset 0x1a2 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0x2f, offset 0x1a7 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8d}, - {value: 0x0008, lo: 0x8e, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x3b08, lo: 0x94, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3b08, lo: 0xb4, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x30, offset 0x1b3 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x31, offset 0x1bd - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xb3}, - {value: 0x3340, lo: 0xb4, hi: 0xb5}, - {value: 0x3008, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbf}, - // Block 0x32, offset 0x1c3 - {value: 0x0000, lo: 0x10}, - {value: 0x3008, lo: 0x80, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x3008, lo: 0x87, hi: 0x88}, - {value: 0x3308, lo: 0x89, hi: 0x91}, - {value: 0x3b08, lo: 0x92, hi: 0x92}, - {value: 0x3308, lo: 0x93, hi: 0x93}, - {value: 0x0018, lo: 0x94, hi: 0x96}, - {value: 0x0008, lo: 0x97, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x33, offset 0x1d4 - {value: 0x0000, lo: 0x09}, - {value: 0x0018, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x86}, - {value: 0x0218, lo: 0x87, hi: 0x87}, - {value: 0x0018, lo: 0x88, hi: 0x8a}, - {value: 0x33c0, lo: 0x8b, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0208, lo: 0xa0, hi: 0xbf}, - // Block 0x34, offset 0x1de - {value: 0x0000, lo: 0x02}, - {value: 0x0208, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x35, offset 0x1e1 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0208, lo: 0x87, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xa9}, - {value: 0x0208, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x36, offset 0x1e9 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0x37, offset 0x1ec - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb8}, - {value: 0x3308, lo: 0xb9, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x38, offset 0x1f9 - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0008, lo: 0x86, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0x39, offset 0x201 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x3a, offset 0x205 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0028, lo: 0x9a, hi: 0x9a}, - {value: 0x0040, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0xbf}, - // Block 0x3b, offset 0x20c - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x3308, lo: 0x97, hi: 0x98}, - {value: 0x3008, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x3c, offset 0x214 - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x94}, - {value: 0x3008, lo: 0x95, hi: 0x95}, - {value: 0x3308, lo: 0x96, hi: 0x96}, - {value: 0x3008, lo: 0x97, hi: 0x97}, - {value: 0x3308, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3b08, lo: 0xa0, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xac}, - {value: 0x3008, lo: 0xad, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0x3d, offset 0x224 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xbd}, - {value: 0x3318, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x3e, offset 0x230 - {value: 0x0000, lo: 0x01}, - {value: 0x0040, lo: 0x80, hi: 0xbf}, - // Block 0x3f, offset 0x232 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x83}, - {value: 0x3008, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x40, offset 0x23c - {value: 0x0000, lo: 0x0b}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x3808, lo: 0x84, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x41, offset 0x248 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3808, lo: 0xaa, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xbf}, - // Block 0x42, offset 0x254 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa9}, - {value: 0x3008, lo: 0xaa, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3808, lo: 0xb2, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbf}, - // Block 0x43, offset 0x260 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x3008, lo: 0xa4, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbf}, - // Block 0x44, offset 0x268 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x45, offset 0x26d - {value: 0x0000, lo: 0x09}, - {value: 0x0e29, lo: 0x80, hi: 0x80}, - {value: 0x0e41, lo: 0x81, hi: 0x81}, - {value: 0x0e59, lo: 0x82, hi: 0x82}, - {value: 0x0e71, lo: 0x83, hi: 0x83}, - {value: 0x0e89, lo: 0x84, hi: 0x85}, - {value: 0x0ea1, lo: 0x86, hi: 0x86}, - {value: 0x0eb9, lo: 0x87, hi: 0x87}, - {value: 0x057d, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0x46, offset 0x277 - {value: 0x0000, lo: 0x10}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x92}, - {value: 0x0018, lo: 0x93, hi: 0x93}, - {value: 0x3308, lo: 0x94, hi: 0xa0}, - {value: 0x3008, lo: 0xa1, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa8}, - {value: 0x0008, lo: 0xa9, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x0008, lo: 0xae, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x47, offset 0x288 - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0x48, offset 0x28c - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x87}, - {value: 0xe045, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0xe045, lo: 0x98, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0xe045, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb7}, - {value: 0xe045, lo: 0xb8, hi: 0xbf}, - // Block 0x49, offset 0x297 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x3318, lo: 0x90, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbf}, - // Block 0x4a, offset 0x29b - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x88}, - {value: 0x24c1, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x4b, offset 0x2a4 - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x24f1, lo: 0xac, hi: 0xac}, - {value: 0x2529, lo: 0xad, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xae}, - {value: 0x2579, lo: 0xaf, hi: 0xaf}, - {value: 0x25b1, lo: 0xb0, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0x4c, offset 0x2ac - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x9f}, - {value: 0x0080, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xad}, - {value: 0x0080, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x4d, offset 0x2b2 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xa8}, - {value: 0x09c5, lo: 0xa9, hi: 0xa9}, - {value: 0x09e5, lo: 0xaa, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xbf}, - // Block 0x4e, offset 0x2b7 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x4f, offset 0x2ba - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xbf}, - // Block 0x50, offset 0x2bd - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x28c1, lo: 0x8c, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0xbf}, - // Block 0x51, offset 0x2c1 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0e66, lo: 0xb4, hi: 0xb4}, - {value: 0x292a, lo: 0xb5, hi: 0xb5}, - {value: 0x0e86, lo: 0xb6, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x52, offset 0x2c7 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x9b}, - {value: 0x2941, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0xbf}, - // Block 0x53, offset 0x2cb - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0x54, offset 0x2cf - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0018, lo: 0x98, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbc}, - {value: 0x0018, lo: 0xbd, hi: 0xbf}, - // Block 0x55, offset 0x2d5 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0xab}, - {value: 0x0018, lo: 0xac, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x56, offset 0x2dc - {value: 0x0000, lo: 0x05}, - {value: 0xe185, lo: 0x80, hi: 0x8f}, - {value: 0x03f5, lo: 0x90, hi: 0x9f}, - {value: 0x0ea5, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x57, offset 0x2e2 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xa6}, - {value: 0x0008, lo: 0xa7, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xac}, - {value: 0x0008, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x58, offset 0x2ea - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xae}, - {value: 0xe075, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0x59, offset 0x2f1 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x0008, lo: 0xb8, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x5a, offset 0x2fc - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xbf}, - // Block 0x5b, offset 0x306 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0008, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x5c, offset 0x30a - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0xbf}, - // Block 0x5d, offset 0x30d - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9e}, - {value: 0x0edd, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0x5e, offset 0x313 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xb2}, - {value: 0x0efd, lo: 0xb3, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0x5f, offset 0x317 - {value: 0x0020, lo: 0x01}, - {value: 0x0f1d, lo: 0x80, hi: 0xbf}, - // Block 0x60, offset 0x319 - {value: 0x0020, lo: 0x02}, - {value: 0x171d, lo: 0x80, hi: 0x8f}, - {value: 0x18fd, lo: 0x90, hi: 0xbf}, - // Block 0x61, offset 0x31c - {value: 0x0020, lo: 0x01}, - {value: 0x1efd, lo: 0x80, hi: 0xbf}, - // Block 0x62, offset 0x31e - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0xbf}, - // Block 0x63, offset 0x321 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x98}, - {value: 0x3308, lo: 0x99, hi: 0x9a}, - {value: 0x29e2, lo: 0x9b, hi: 0x9b}, - {value: 0x2a0a, lo: 0x9c, hi: 0x9c}, - {value: 0x0008, lo: 0x9d, hi: 0x9e}, - {value: 0x2a31, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0008, lo: 0xa1, hi: 0xbf}, - // Block 0x64, offset 0x32b - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xbe}, - {value: 0x2a69, lo: 0xbf, hi: 0xbf}, - // Block 0x65, offset 0x32e - {value: 0x0000, lo: 0x0e}, - {value: 0x0040, lo: 0x80, hi: 0x84}, - {value: 0x0008, lo: 0x85, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xb0}, - {value: 0x2a1d, lo: 0xb1, hi: 0xb1}, - {value: 0x2a3d, lo: 0xb2, hi: 0xb2}, - {value: 0x2a5d, lo: 0xb3, hi: 0xb3}, - {value: 0x2a7d, lo: 0xb4, hi: 0xb4}, - {value: 0x2a5d, lo: 0xb5, hi: 0xb5}, - {value: 0x2a9d, lo: 0xb6, hi: 0xb6}, - {value: 0x2abd, lo: 0xb7, hi: 0xb7}, - {value: 0x2add, lo: 0xb8, hi: 0xb9}, - {value: 0x2afd, lo: 0xba, hi: 0xbb}, - {value: 0x2b1d, lo: 0xbc, hi: 0xbd}, - {value: 0x2afd, lo: 0xbe, hi: 0xbf}, - // Block 0x66, offset 0x33d - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x67, offset 0x341 - {value: 0x0030, lo: 0x04}, - {value: 0x2aa2, lo: 0x80, hi: 0x9d}, - {value: 0x305a, lo: 0x9e, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x30a2, lo: 0xa0, hi: 0xbf}, - // Block 0x68, offset 0x346 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0xbf}, - // Block 0x69, offset 0x349 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0040, lo: 0x8d, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0x6a, offset 0x34d - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0x6b, offset 0x352 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xbf}, - // Block 0x6c, offset 0x357 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb1}, - {value: 0x0018, lo: 0xb2, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x6d, offset 0x35d - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0xb6}, - {value: 0x0008, lo: 0xb7, hi: 0xb7}, - {value: 0x2009, lo: 0xb8, hi: 0xb8}, - {value: 0x6e89, lo: 0xb9, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xbf}, - // Block 0x6e, offset 0x363 - {value: 0x0000, lo: 0x0e}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x3308, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x3308, lo: 0x8b, hi: 0x8b}, - {value: 0x0008, lo: 0x8c, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa6}, - {value: 0x3008, lo: 0xa7, hi: 0xa7}, - {value: 0x0018, lo: 0xa8, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x6f, offset 0x372 - {value: 0x0000, lo: 0x05}, - {value: 0x0208, lo: 0x80, hi: 0xb1}, - {value: 0x0108, lo: 0xb2, hi: 0xb2}, - {value: 0x0008, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0x70, offset 0x378 - {value: 0x0000, lo: 0x03}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xbf}, - // Block 0x71, offset 0x37c - {value: 0x0000, lo: 0x0e}, - {value: 0x3008, lo: 0x80, hi: 0x83}, - {value: 0x3b08, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8d}, - {value: 0x0018, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xba}, - {value: 0x0008, lo: 0xbb, hi: 0xbb}, - {value: 0x0018, lo: 0xbc, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x72, offset 0x38b - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x73, offset 0x390 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x3308, lo: 0x87, hi: 0x91}, - {value: 0x3008, lo: 0x92, hi: 0x92}, - {value: 0x3808, lo: 0x93, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0x74, offset 0x398 - {value: 0x0000, lo: 0x09}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x3008, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb9}, - {value: 0x3008, lo: 0xba, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbf}, - // Block 0x75, offset 0x3a2 - {value: 0x0000, lo: 0x0a}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0x76, offset 0x3ad - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xa8}, - {value: 0x3308, lo: 0xa9, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb0}, - {value: 0x3308, lo: 0xb1, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x77, offset 0x3b5 - {value: 0x0000, lo: 0x10}, - {value: 0x0008, lo: 0x80, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8c}, - {value: 0x3008, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xb9}, - {value: 0x0008, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbc}, - {value: 0x3008, lo: 0xbd, hi: 0xbd}, - {value: 0x0008, lo: 0xbe, hi: 0xbf}, - // Block 0x78, offset 0x3c6 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb0}, - {value: 0x0008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb4}, - {value: 0x0008, lo: 0xb5, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb8}, - {value: 0x0008, lo: 0xb9, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbf}, - // Block 0x79, offset 0x3cf - {value: 0x0000, lo: 0x0f}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x9a}, - {value: 0x0008, lo: 0x9b, hi: 0x9d}, - {value: 0x0018, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xaa}, - {value: 0x3008, lo: 0xab, hi: 0xab}, - {value: 0x3308, lo: 0xac, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb5}, - {value: 0x3b08, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x7a, offset 0x3df - {value: 0x0000, lo: 0x0c}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x88}, - {value: 0x0008, lo: 0x89, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x90}, - {value: 0x0008, lo: 0x91, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x7b, offset 0x3ec - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x4465, lo: 0x9c, hi: 0x9c}, - {value: 0x447d, lo: 0x9d, hi: 0x9d}, - {value: 0x2971, lo: 0x9e, hi: 0x9e}, - {value: 0xe06d, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa5}, - {value: 0x0040, lo: 0xa6, hi: 0xaf}, - {value: 0x4495, lo: 0xb0, hi: 0xbf}, - // Block 0x7c, offset 0x3f6 - {value: 0x0000, lo: 0x04}, - {value: 0x44b5, lo: 0x80, hi: 0x8f}, - {value: 0x44d5, lo: 0x90, hi: 0x9f}, - {value: 0x44f5, lo: 0xa0, hi: 0xaf}, - {value: 0x44d5, lo: 0xb0, hi: 0xbf}, - // Block 0x7d, offset 0x3fb - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0xa2}, - {value: 0x3008, lo: 0xa3, hi: 0xa4}, - {value: 0x3308, lo: 0xa5, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa7}, - {value: 0x3308, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xaa}, - {value: 0x0018, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3b08, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0x7e, offset 0x408 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0x7f, offset 0x40c - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x80, offset 0x411 - {value: 0x0020, lo: 0x01}, - {value: 0x4515, lo: 0x80, hi: 0xbf}, - // Block 0x81, offset 0x413 - {value: 0x0020, lo: 0x03}, - {value: 0x4d15, lo: 0x80, hi: 0x94}, - {value: 0x4ad5, lo: 0x95, hi: 0x95}, - {value: 0x4fb5, lo: 0x96, hi: 0xbf}, - // Block 0x82, offset 0x417 - {value: 0x0020, lo: 0x01}, - {value: 0x54f5, lo: 0x80, hi: 0xbf}, - // Block 0x83, offset 0x419 - {value: 0x0020, lo: 0x03}, - {value: 0x5cf5, lo: 0x80, hi: 0x84}, - {value: 0x5655, lo: 0x85, hi: 0x85}, - {value: 0x5d95, lo: 0x86, hi: 0xbf}, - // Block 0x84, offset 0x41d - {value: 0x0020, lo: 0x08}, - {value: 0x6b55, lo: 0x80, hi: 0x8f}, - {value: 0x6d15, lo: 0x90, hi: 0x90}, - {value: 0x6d55, lo: 0x91, hi: 0xab}, - {value: 0x6ea1, lo: 0xac, hi: 0xac}, - {value: 0x70b5, lo: 0xad, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x70d5, lo: 0xb0, hi: 0xbf}, - // Block 0x85, offset 0x426 - {value: 0x0020, lo: 0x05}, - {value: 0x72d5, lo: 0x80, hi: 0xad}, - {value: 0x6535, lo: 0xae, hi: 0xae}, - {value: 0x7895, lo: 0xaf, hi: 0xb5}, - {value: 0x6f55, lo: 0xb6, hi: 0xb6}, - {value: 0x7975, lo: 0xb7, hi: 0xbf}, - // Block 0x86, offset 0x42c - {value: 0x0028, lo: 0x03}, - {value: 0x7c21, lo: 0x80, hi: 0x82}, - {value: 0x7be1, lo: 0x83, hi: 0x83}, - {value: 0x7c99, lo: 0x84, hi: 0xbf}, - // Block 0x87, offset 0x430 - {value: 0x0038, lo: 0x0f}, - {value: 0x9db1, lo: 0x80, hi: 0x83}, - {value: 0x9e59, lo: 0x84, hi: 0x85}, - {value: 0x9e91, lo: 0x86, hi: 0x87}, - {value: 0x9ec9, lo: 0x88, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x91}, - {value: 0xa089, lo: 0x92, hi: 0x97}, - {value: 0xa1a1, lo: 0x98, hi: 0x9c}, - {value: 0xa281, lo: 0x9d, hi: 0xb3}, - {value: 0x9d41, lo: 0xb4, hi: 0xb4}, - {value: 0x9db1, lo: 0xb5, hi: 0xb5}, - {value: 0xa789, lo: 0xb6, hi: 0xbb}, - {value: 0xa869, lo: 0xbc, hi: 0xbc}, - {value: 0xa7f9, lo: 0xbd, hi: 0xbd}, - {value: 0xa8d9, lo: 0xbe, hi: 0xbf}, - // Block 0x88, offset 0x440 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8c}, - {value: 0x0008, lo: 0x8d, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbb}, - {value: 0x0008, lo: 0xbc, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0x89, offset 0x44a - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0x8a, offset 0x44f - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x8b, offset 0x452 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x82}, - {value: 0x0040, lo: 0x83, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0x8c, offset 0x458 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x8e}, - {value: 0x0040, lo: 0x8f, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0x8d, offset 0x45f - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x0040, lo: 0xbe, hi: 0xbf}, - // Block 0x8e, offset 0x464 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9c}, - {value: 0x0040, lo: 0x9d, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x8f, offset 0x468 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x90}, - {value: 0x0040, lo: 0x91, hi: 0x9f}, - {value: 0x3308, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x90, offset 0x46e - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x91, offset 0x473 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x81}, - {value: 0x0008, lo: 0x82, hi: 0x89}, - {value: 0x0018, lo: 0x8a, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbf}, - // Block 0x92, offset 0x47c - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0x93, offset 0x481 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0xbf}, - // Block 0x94, offset 0x487 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x97}, - {value: 0x8ad5, lo: 0x98, hi: 0x9f}, - {value: 0x8aed, lo: 0xa0, hi: 0xa7}, - {value: 0x0008, lo: 0xa8, hi: 0xbf}, - // Block 0x95, offset 0x48e - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x8aed, lo: 0xb0, hi: 0xb7}, - {value: 0x8ad5, lo: 0xb8, hi: 0xbf}, - // Block 0x96, offset 0x495 - {value: 0x0000, lo: 0x06}, - {value: 0xe145, lo: 0x80, hi: 0x87}, - {value: 0xe1c5, lo: 0x88, hi: 0x8f}, - {value: 0xe145, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0xbb}, - {value: 0x0040, lo: 0xbc, hi: 0xbf}, - // Block 0x97, offset 0x49c - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0x98, offset 0x4a0 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xae}, - {value: 0x0018, lo: 0xaf, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x99, offset 0x4a5 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0x9a, offset 0x4a8 - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xbf}, - // Block 0x9b, offset 0x4ad - {value: 0x0000, lo: 0x0b}, - {value: 0x0808, lo: 0x80, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x87}, - {value: 0x0808, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0808, lo: 0x8a, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb6}, - {value: 0x0808, lo: 0xb7, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbb}, - {value: 0x0808, lo: 0xbc, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbe}, - {value: 0x0808, lo: 0xbf, hi: 0xbf}, - // Block 0x9c, offset 0x4b9 - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x96}, - {value: 0x0818, lo: 0x97, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb6}, - {value: 0x0818, lo: 0xb7, hi: 0xbf}, - // Block 0x9d, offset 0x4bf - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xa6}, - {value: 0x0818, lo: 0xa7, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0x9e, offset 0x4c4 - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb3}, - {value: 0x0808, lo: 0xb4, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xba}, - {value: 0x0818, lo: 0xbb, hi: 0xbf}, - // Block 0x9f, offset 0x4cb - {value: 0x0000, lo: 0x07}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0818, lo: 0x96, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbe}, - {value: 0x0818, lo: 0xbf, hi: 0xbf}, - // Block 0xa0, offset 0x4d3 - {value: 0x0000, lo: 0x04}, - {value: 0x0808, lo: 0x80, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbb}, - {value: 0x0818, lo: 0xbc, hi: 0xbd}, - {value: 0x0808, lo: 0xbe, hi: 0xbf}, - // Block 0xa1, offset 0x4d8 - {value: 0x0000, lo: 0x03}, - {value: 0x0818, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x0818, lo: 0x92, hi: 0xbf}, - // Block 0xa2, offset 0x4dc - {value: 0x0000, lo: 0x0f}, - {value: 0x0808, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x84}, - {value: 0x3308, lo: 0x85, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x8b}, - {value: 0x3308, lo: 0x8c, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x94}, - {value: 0x0808, lo: 0x95, hi: 0x97}, - {value: 0x0040, lo: 0x98, hi: 0x98}, - {value: 0x0808, lo: 0x99, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xba}, - {value: 0x0040, lo: 0xbb, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xa3, offset 0x4ec - {value: 0x0000, lo: 0x06}, - {value: 0x0818, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0818, lo: 0x90, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xbc}, - {value: 0x0818, lo: 0xbd, hi: 0xbf}, - // Block 0xa4, offset 0x4f3 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0x9c}, - {value: 0x0818, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xa5, offset 0x4f7 - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb8}, - {value: 0x0018, lo: 0xb9, hi: 0xbf}, - // Block 0xa6, offset 0x4fb - {value: 0x0000, lo: 0x06}, - {value: 0x0808, lo: 0x80, hi: 0x95}, - {value: 0x0040, lo: 0x96, hi: 0x97}, - {value: 0x0818, lo: 0x98, hi: 0x9f}, - {value: 0x0808, lo: 0xa0, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb7}, - {value: 0x0818, lo: 0xb8, hi: 0xbf}, - // Block 0xa7, offset 0x502 - {value: 0x0000, lo: 0x01}, - {value: 0x0808, lo: 0x80, hi: 0xbf}, - // Block 0xa8, offset 0x504 - {value: 0x0000, lo: 0x02}, - {value: 0x0808, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0xbf}, - // Block 0xa9, offset 0x507 - {value: 0x0000, lo: 0x02}, - {value: 0x03dd, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xaa, offset 0x50a - {value: 0x0000, lo: 0x03}, - {value: 0x0808, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xb9}, - {value: 0x0818, lo: 0xba, hi: 0xbf}, - // Block 0xab, offset 0x50e - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0818, lo: 0xa0, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xac, offset 0x512 - {value: 0x0000, lo: 0x05}, - {value: 0x3008, lo: 0x80, hi: 0x80}, - {value: 0x3308, lo: 0x81, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xad, offset 0x518 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x85}, - {value: 0x3b08, lo: 0x86, hi: 0x86}, - {value: 0x0018, lo: 0x87, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x91}, - {value: 0x0018, lo: 0x92, hi: 0xa5}, - {value: 0x0008, lo: 0xa6, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xae, offset 0x521 - {value: 0x0000, lo: 0x0b}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb6}, - {value: 0x3008, lo: 0xb7, hi: 0xb8}, - {value: 0x3b08, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x0018, lo: 0xbb, hi: 0xbc}, - {value: 0x0340, lo: 0xbd, hi: 0xbd}, - {value: 0x0018, lo: 0xbe, hi: 0xbf}, - // Block 0xaf, offset 0x52d - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb0, offset 0x534 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xb2}, - {value: 0x3b08, lo: 0xb3, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xbf}, - // Block 0xb1, offset 0x53d - {value: 0x0000, lo: 0x07}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb3}, - {value: 0x0018, lo: 0xb4, hi: 0xb5}, - {value: 0x0008, lo: 0xb6, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xb2, offset 0x545 - {value: 0x0000, lo: 0x06}, - {value: 0x3308, lo: 0x80, hi: 0x81}, - {value: 0x3008, lo: 0x82, hi: 0x82}, - {value: 0x0008, lo: 0x83, hi: 0xb2}, - {value: 0x3008, lo: 0xb3, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xbe}, - {value: 0x3008, lo: 0xbf, hi: 0xbf}, - // Block 0xb3, offset 0x54c - {value: 0x0000, lo: 0x0d}, - {value: 0x3808, lo: 0x80, hi: 0x80}, - {value: 0x0008, lo: 0x81, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x89}, - {value: 0x3308, lo: 0x8a, hi: 0x8c}, - {value: 0x0018, lo: 0x8d, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0008, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x0018, lo: 0xa1, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xb4, offset 0x55a - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xae}, - {value: 0x3308, lo: 0xaf, hi: 0xb1}, - {value: 0x3008, lo: 0xb2, hi: 0xb3}, - {value: 0x3308, lo: 0xb4, hi: 0xb4}, - {value: 0x3808, lo: 0xb5, hi: 0xb5}, - {value: 0x3308, lo: 0xb6, hi: 0xb7}, - {value: 0x0018, lo: 0xb8, hi: 0xbd}, - {value: 0x3308, lo: 0xbe, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xb5, offset 0x567 - {value: 0x0000, lo: 0x0c}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x0008, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0x8d}, - {value: 0x0040, lo: 0x8e, hi: 0x8e}, - {value: 0x0008, lo: 0x8f, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9e}, - {value: 0x0008, lo: 0x9f, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbf}, - // Block 0xb6, offset 0x574 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x3308, lo: 0x9f, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa9}, - {value: 0x3b08, lo: 0xaa, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0040, lo: 0xba, hi: 0xbf}, - // Block 0xb7, offset 0x57d - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x3008, lo: 0xb5, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbf}, - // Block 0xb8, offset 0x581 - {value: 0x0000, lo: 0x0d}, - {value: 0x3008, lo: 0x80, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x84}, - {value: 0x3008, lo: 0x85, hi: 0x85}, - {value: 0x3308, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x8a}, - {value: 0x0018, lo: 0x8b, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0x9b}, - {value: 0x0040, lo: 0x9c, hi: 0x9c}, - {value: 0x0018, lo: 0x9d, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0xb9, offset 0x58f - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xb8}, - {value: 0x3008, lo: 0xb9, hi: 0xb9}, - {value: 0x3308, lo: 0xba, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbe}, - {value: 0x3308, lo: 0xbf, hi: 0xbf}, - // Block 0xba, offset 0x597 - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x3008, lo: 0x81, hi: 0x81}, - {value: 0x3b08, lo: 0x82, hi: 0x82}, - {value: 0x3308, lo: 0x83, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x85}, - {value: 0x0018, lo: 0x86, hi: 0x86}, - {value: 0x0008, lo: 0x87, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xbb, offset 0x5a2 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xb7}, - {value: 0x3008, lo: 0xb8, hi: 0xbb}, - {value: 0x3308, lo: 0xbc, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbc, offset 0x5ab - {value: 0x0000, lo: 0x05}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x97}, - {value: 0x0008, lo: 0x98, hi: 0x9b}, - {value: 0x3308, lo: 0x9c, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0xbf}, - // Block 0xbd, offset 0x5b1 - {value: 0x0000, lo: 0x07}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3008, lo: 0xb0, hi: 0xb2}, - {value: 0x3308, lo: 0xb3, hi: 0xba}, - {value: 0x3008, lo: 0xbb, hi: 0xbc}, - {value: 0x3308, lo: 0xbd, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xbe, offset 0x5b9 - {value: 0x0000, lo: 0x08}, - {value: 0x3308, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x83}, - {value: 0x0008, lo: 0x84, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xbf, offset 0x5c2 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x3308, lo: 0xab, hi: 0xab}, - {value: 0x3008, lo: 0xac, hi: 0xac}, - {value: 0x3308, lo: 0xad, hi: 0xad}, - {value: 0x3008, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb5}, - {value: 0x3808, lo: 0xb6, hi: 0xb6}, - {value: 0x3308, lo: 0xb7, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbf}, - // Block 0xc0, offset 0x5cc - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x89}, - {value: 0x0040, lo: 0x8a, hi: 0xbf}, - // Block 0xc1, offset 0x5cf - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9f}, - {value: 0x3008, lo: 0xa0, hi: 0xa1}, - {value: 0x3308, lo: 0xa2, hi: 0xa5}, - {value: 0x3008, lo: 0xa6, hi: 0xa6}, - {value: 0x3308, lo: 0xa7, hi: 0xaa}, - {value: 0x3b08, lo: 0xab, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xb9}, - {value: 0x0018, lo: 0xba, hi: 0xbf}, - // Block 0xc2, offset 0x5db - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x049d, lo: 0xa0, hi: 0xbf}, - // Block 0xc3, offset 0x5de - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbe}, - {value: 0x0008, lo: 0xbf, hi: 0xbf}, - // Block 0xc4, offset 0x5e3 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb8}, - {value: 0x0040, lo: 0xb9, hi: 0xbf}, - // Block 0xc5, offset 0x5e6 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x89}, - {value: 0x0008, lo: 0x8a, hi: 0xae}, - {value: 0x3008, lo: 0xaf, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xb7}, - {value: 0x3308, lo: 0xb8, hi: 0xbd}, - {value: 0x3008, lo: 0xbe, hi: 0xbe}, - {value: 0x3b08, lo: 0xbf, hi: 0xbf}, - // Block 0xc6, offset 0x5f0 - {value: 0x0000, lo: 0x08}, - {value: 0x0008, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0018, lo: 0x9a, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0008, lo: 0xb2, hi: 0xbf}, - // Block 0xc7, offset 0x5f9 - {value: 0x0000, lo: 0x0b}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x91}, - {value: 0x3308, lo: 0x92, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xa8}, - {value: 0x3008, lo: 0xa9, hi: 0xa9}, - {value: 0x3308, lo: 0xaa, hi: 0xb0}, - {value: 0x3008, lo: 0xb1, hi: 0xb1}, - {value: 0x3308, lo: 0xb2, hi: 0xb3}, - {value: 0x3008, lo: 0xb4, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xc8, offset 0x605 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0xbf}, - // Block 0xc9, offset 0x608 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xca, offset 0x60d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0040, lo: 0x84, hi: 0xbf}, - // Block 0xcb, offset 0x610 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xbf}, - // Block 0xcc, offset 0x613 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0xbf}, - // Block 0xcd, offset 0x616 - {value: 0x0000, lo: 0x06}, - {value: 0x0008, lo: 0x80, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa9}, - {value: 0x0040, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xce, offset 0x61d - {value: 0x0000, lo: 0x06}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb4}, - {value: 0x0018, lo: 0xb5, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xcf, offset 0x624 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0xaf}, - {value: 0x3308, lo: 0xb0, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xbf}, - // Block 0xd0, offset 0x628 - {value: 0x0000, lo: 0x0a}, - {value: 0x0008, lo: 0x80, hi: 0x83}, - {value: 0x0018, lo: 0x84, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9a}, - {value: 0x0018, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x0008, lo: 0xa3, hi: 0xb7}, - {value: 0x0040, lo: 0xb8, hi: 0xbc}, - {value: 0x0008, lo: 0xbd, hi: 0xbf}, - // Block 0xd1, offset 0x633 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0xbf}, - // Block 0xd2, offset 0x636 - {value: 0x0000, lo: 0x05}, - {value: 0x0008, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x90}, - {value: 0x3008, lo: 0x91, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xd3, offset 0x63c - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x8e}, - {value: 0x3308, lo: 0x8f, hi: 0x92}, - {value: 0x0008, lo: 0x93, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xd4, offset 0x641 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xa0}, - {value: 0x0040, lo: 0xa1, hi: 0xbf}, - // Block 0xd5, offset 0x645 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xd6, offset 0x648 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb2}, - {value: 0x0040, lo: 0xb3, hi: 0xbf}, - // Block 0xd7, offset 0x64b - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0xbf}, - // Block 0xd8, offset 0x64e - {value: 0x0000, lo: 0x04}, - {value: 0x0008, lo: 0x80, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xaf}, - {value: 0x0008, lo: 0xb0, hi: 0xbc}, - {value: 0x0040, lo: 0xbd, hi: 0xbf}, - // Block 0xd9, offset 0x653 - {value: 0x0000, lo: 0x09}, - {value: 0x0008, lo: 0x80, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0x0008, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9b}, - {value: 0x0018, lo: 0x9c, hi: 0x9c}, - {value: 0x3308, lo: 0x9d, hi: 0x9e}, - {value: 0x0018, lo: 0x9f, hi: 0x9f}, - {value: 0x03c0, lo: 0xa0, hi: 0xa3}, - {value: 0x0040, lo: 0xa4, hi: 0xbf}, - // Block 0xda, offset 0x65d - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xdb, offset 0x660 - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xa6}, - {value: 0x0040, lo: 0xa7, hi: 0xa8}, - {value: 0x0018, lo: 0xa9, hi: 0xbf}, - // Block 0xdc, offset 0x664 - {value: 0x0000, lo: 0x0e}, - {value: 0x0018, lo: 0x80, hi: 0x9d}, - {value: 0xb5b9, lo: 0x9e, hi: 0x9e}, - {value: 0xb601, lo: 0x9f, hi: 0x9f}, - {value: 0xb649, lo: 0xa0, hi: 0xa0}, - {value: 0xb6b1, lo: 0xa1, hi: 0xa1}, - {value: 0xb719, lo: 0xa2, hi: 0xa2}, - {value: 0xb781, lo: 0xa3, hi: 0xa3}, - {value: 0xb7e9, lo: 0xa4, hi: 0xa4}, - {value: 0x3018, lo: 0xa5, hi: 0xa6}, - {value: 0x3318, lo: 0xa7, hi: 0xa9}, - {value: 0x0018, lo: 0xaa, hi: 0xac}, - {value: 0x3018, lo: 0xad, hi: 0xb2}, - {value: 0x0340, lo: 0xb3, hi: 0xba}, - {value: 0x3318, lo: 0xbb, hi: 0xbf}, - // Block 0xdd, offset 0x673 - {value: 0x0000, lo: 0x0b}, - {value: 0x3318, lo: 0x80, hi: 0x82}, - {value: 0x0018, lo: 0x83, hi: 0x84}, - {value: 0x3318, lo: 0x85, hi: 0x8b}, - {value: 0x0018, lo: 0x8c, hi: 0xa9}, - {value: 0x3318, lo: 0xaa, hi: 0xad}, - {value: 0x0018, lo: 0xae, hi: 0xba}, - {value: 0xb851, lo: 0xbb, hi: 0xbb}, - {value: 0xb899, lo: 0xbc, hi: 0xbc}, - {value: 0xb8e1, lo: 0xbd, hi: 0xbd}, - {value: 0xb949, lo: 0xbe, hi: 0xbe}, - {value: 0xb9b1, lo: 0xbf, hi: 0xbf}, - // Block 0xde, offset 0x67f - {value: 0x0000, lo: 0x03}, - {value: 0xba19, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0xa8}, - {value: 0x0040, lo: 0xa9, hi: 0xbf}, - // Block 0xdf, offset 0x683 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x81}, - {value: 0x3318, lo: 0x82, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x85}, - {value: 0x0040, lo: 0x86, hi: 0xbf}, - // Block 0xe0, offset 0x688 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xe1, offset 0x68d - {value: 0x0000, lo: 0x03}, - {value: 0x3308, lo: 0x80, hi: 0xb6}, - {value: 0x0018, lo: 0xb7, hi: 0xba}, - {value: 0x3308, lo: 0xbb, hi: 0xbf}, - // Block 0xe2, offset 0x691 - {value: 0x0000, lo: 0x04}, - {value: 0x3308, lo: 0x80, hi: 0xac}, - {value: 0x0018, lo: 0xad, hi: 0xb4}, - {value: 0x3308, lo: 0xb5, hi: 0xb5}, - {value: 0x0018, lo: 0xb6, hi: 0xbf}, - // Block 0xe3, offset 0x696 - {value: 0x0000, lo: 0x08}, - {value: 0x0018, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x84}, - {value: 0x0018, lo: 0x85, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xa0}, - {value: 0x3308, lo: 0xa1, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, - // Block 0xe4, offset 0x69f - {value: 0x0000, lo: 0x0a}, - {value: 0x3308, lo: 0x80, hi: 0x86}, - {value: 0x0040, lo: 0x87, hi: 0x87}, - {value: 0x3308, lo: 0x88, hi: 0x98}, - {value: 0x0040, lo: 0x99, hi: 0x9a}, - {value: 0x3308, lo: 0x9b, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xa2}, - {value: 0x3308, lo: 0xa3, hi: 0xa4}, - {value: 0x0040, lo: 0xa5, hi: 0xa5}, - {value: 0x3308, lo: 0xa6, hi: 0xaa}, - {value: 0x0040, lo: 0xab, hi: 0xbf}, - // Block 0xe5, offset 0x6aa - {value: 0x0000, lo: 0x05}, - {value: 0x0808, lo: 0x80, hi: 0x84}, - {value: 0x0040, lo: 0x85, hi: 0x86}, - {value: 0x0818, lo: 0x87, hi: 0x8f}, - {value: 0x3308, lo: 0x90, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0xe6, offset 0x6b0 - {value: 0x0000, lo: 0x07}, - {value: 0x0a08, lo: 0x80, hi: 0x83}, - {value: 0x3308, lo: 0x84, hi: 0x8a}, - {value: 0x0040, lo: 0x8b, hi: 0x8f}, - {value: 0x0808, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9d}, - {value: 0x0818, lo: 0x9e, hi: 0x9f}, - {value: 0x0040, lo: 0xa0, hi: 0xbf}, - // Block 0xe7, offset 0x6b8 - {value: 0x0000, lo: 0x03}, - {value: 0x0040, lo: 0x80, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb1}, - {value: 0x0040, lo: 0xb2, hi: 0xbf}, - // Block 0xe8, offset 0x6bc - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0xab}, - {value: 0x0040, lo: 0xac, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xbf}, - // Block 0xe9, offset 0x6c0 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x93}, - {value: 0x0040, lo: 0x94, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xae}, - {value: 0x0040, lo: 0xaf, hi: 0xb0}, - {value: 0x0018, lo: 0xb1, hi: 0xbf}, - // Block 0xea, offset 0x6c6 - {value: 0x0000, lo: 0x05}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0018, lo: 0x81, hi: 0x8f}, - {value: 0x0040, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xb5}, - {value: 0x0040, lo: 0xb6, hi: 0xbf}, - // Block 0xeb, offset 0x6cc - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8f}, - {value: 0xc1c1, lo: 0x90, hi: 0x90}, - {value: 0x0018, lo: 0x91, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xbf}, - // Block 0xec, offset 0x6d1 - {value: 0x0000, lo: 0x02}, - {value: 0x0040, lo: 0x80, hi: 0xa5}, - {value: 0x0018, lo: 0xa6, hi: 0xbf}, - // Block 0xed, offset 0x6d4 - {value: 0x0000, lo: 0x0d}, - {value: 0xc7e9, lo: 0x80, hi: 0x80}, - {value: 0xc839, lo: 0x81, hi: 0x81}, - {value: 0xc889, lo: 0x82, hi: 0x82}, - {value: 0xc8d9, lo: 0x83, hi: 0x83}, - {value: 0xc929, lo: 0x84, hi: 0x84}, - {value: 0xc979, lo: 0x85, hi: 0x85}, - {value: 0xc9c9, lo: 0x86, hi: 0x86}, - {value: 0xca19, lo: 0x87, hi: 0x87}, - {value: 0xca69, lo: 0x88, hi: 0x88}, - {value: 0x0040, lo: 0x89, hi: 0x8f}, - {value: 0xcab9, lo: 0x90, hi: 0x90}, - {value: 0xcad9, lo: 0x91, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0xbf}, - // Block 0xee, offset 0x6e2 - {value: 0x0000, lo: 0x06}, - {value: 0x0018, lo: 0x80, hi: 0x92}, - {value: 0x0040, lo: 0x93, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xac}, - {value: 0x0040, lo: 0xad, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb6}, - {value: 0x0040, lo: 0xb7, hi: 0xbf}, - // Block 0xef, offset 0x6e9 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0xb3}, - {value: 0x0040, lo: 0xb4, hi: 0xbf}, - // Block 0xf0, offset 0x6ec - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x94}, - {value: 0x0040, lo: 0x95, hi: 0xbf}, - // Block 0xf1, offset 0x6ef - {value: 0x0000, lo: 0x03}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xbf}, - // Block 0xf2, offset 0x6f3 - {value: 0x0000, lo: 0x05}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x99}, - {value: 0x0040, lo: 0x9a, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xbf}, - // Block 0xf3, offset 0x6f9 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x87}, - {value: 0x0040, lo: 0x88, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0xad}, - {value: 0x0040, lo: 0xae, hi: 0xbf}, - // Block 0xf4, offset 0x6fe - {value: 0x0000, lo: 0x09}, - {value: 0x0040, lo: 0x80, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0x9f}, - {value: 0x0018, lo: 0xa0, hi: 0xa7}, - {value: 0x0040, lo: 0xa8, hi: 0xaf}, - {value: 0x0018, lo: 0xb0, hi: 0xb0}, - {value: 0x0040, lo: 0xb1, hi: 0xb2}, - {value: 0x0018, lo: 0xb3, hi: 0xbe}, - {value: 0x0040, lo: 0xbf, hi: 0xbf}, - // Block 0xf5, offset 0x708 - {value: 0x0000, lo: 0x04}, - {value: 0x0018, lo: 0x80, hi: 0x8b}, - {value: 0x0040, lo: 0x8c, hi: 0x8f}, - {value: 0x0018, lo: 0x90, hi: 0x9e}, - {value: 0x0040, lo: 0x9f, hi: 0xbf}, - // Block 0xf6, offset 0x70d - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x91}, - {value: 0x0040, lo: 0x92, hi: 0xbf}, - // Block 0xf7, offset 0x710 - {value: 0x0000, lo: 0x02}, - {value: 0x0018, lo: 0x80, hi: 0x80}, - {value: 0x0040, lo: 0x81, hi: 0xbf}, - // Block 0xf8, offset 0x713 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0x96}, - {value: 0x0040, lo: 0x97, hi: 0xbf}, - // Block 0xf9, offset 0x716 - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xb4}, - {value: 0x0040, lo: 0xb5, hi: 0xbf}, - // Block 0xfa, offset 0x719 - {value: 0x0000, lo: 0x03}, - {value: 0x0008, lo: 0x80, hi: 0x9d}, - {value: 0x0040, lo: 0x9e, hi: 0x9f}, - {value: 0x0008, lo: 0xa0, hi: 0xbf}, - // Block 0xfb, offset 0x71d - {value: 0x0000, lo: 0x02}, - {value: 0x0008, lo: 0x80, hi: 0xa1}, - {value: 0x0040, lo: 0xa2, hi: 0xbf}, - // Block 0xfc, offset 0x720 - {value: 0x0020, lo: 0x0f}, - {value: 0xdeb9, lo: 0x80, hi: 0x89}, - {value: 0x8dfd, lo: 0x8a, hi: 0x8a}, - {value: 0xdff9, lo: 0x8b, hi: 0x9c}, - {value: 0x8e1d, lo: 0x9d, hi: 0x9d}, - {value: 0xe239, lo: 0x9e, hi: 0xa2}, - {value: 0x8e3d, lo: 0xa3, hi: 0xa3}, - {value: 0xe2d9, lo: 0xa4, hi: 0xab}, - {value: 0x7ed5, lo: 0xac, hi: 0xac}, - {value: 0xe3d9, lo: 0xad, hi: 0xaf}, - {value: 0x8e5d, lo: 0xb0, hi: 0xb0}, - {value: 0xe439, lo: 0xb1, hi: 0xb6}, - {value: 0x8e7d, lo: 0xb7, hi: 0xb9}, - {value: 0xe4f9, lo: 0xba, hi: 0xba}, - {value: 0x8edd, lo: 0xbb, hi: 0xbb}, - {value: 0xe519, lo: 0xbc, hi: 0xbf}, - // Block 0xfd, offset 0x730 - {value: 0x0020, lo: 0x10}, - {value: 0x937d, lo: 0x80, hi: 0x80}, - {value: 0xf099, lo: 0x81, hi: 0x86}, - {value: 0x939d, lo: 0x87, hi: 0x8a}, - {value: 0xd9f9, lo: 0x8b, hi: 0x8b}, - {value: 0xf159, lo: 0x8c, hi: 0x96}, - {value: 0x941d, lo: 0x97, hi: 0x97}, - {value: 0xf2b9, lo: 0x98, hi: 0xa3}, - {value: 0x943d, lo: 0xa4, hi: 0xa6}, - {value: 0xf439, lo: 0xa7, hi: 0xaa}, - {value: 0x949d, lo: 0xab, hi: 0xab}, - {value: 0xf4b9, lo: 0xac, hi: 0xac}, - {value: 0x94bd, lo: 0xad, hi: 0xad}, - {value: 0xf4d9, lo: 0xae, hi: 0xaf}, - {value: 0x94dd, lo: 0xb0, hi: 0xb1}, - {value: 0xf519, lo: 0xb2, hi: 0xbe}, - {value: 0x2040, lo: 0xbf, hi: 0xbf}, - // Block 0xfe, offset 0x741 - {value: 0x0000, lo: 0x04}, - {value: 0x0040, lo: 0x80, hi: 0x80}, - {value: 0x0340, lo: 0x81, hi: 0x81}, - {value: 0x0040, lo: 0x82, hi: 0x9f}, - {value: 0x0340, lo: 0xa0, hi: 0xbf}, - // Block 0xff, offset 0x746 - {value: 0x0000, lo: 0x01}, - {value: 0x0340, lo: 0x80, hi: 0xbf}, - // Block 0x100, offset 0x748 - {value: 0x0000, lo: 0x01}, - {value: 0x33c0, lo: 0x80, hi: 0xbf}, - // Block 0x101, offset 0x74a - {value: 0x0000, lo: 0x02}, - {value: 0x33c0, lo: 0x80, hi: 0xaf}, - {value: 0x0040, lo: 0xb0, hi: 0xbf}, -} - -// Total table size 41662 bytes (40KiB); checksum: 355A58A4 diff --git a/vendor/golang.org/x/net/idna/trie.go b/vendor/golang.org/x/net/idna/trie.go deleted file mode 100644 index c4ef847e7..000000000 --- a/vendor/golang.org/x/net/idna/trie.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package idna - -// appendMapping appends the mapping for the respective rune. isMapped must be -// true. A mapping is a categorization of a rune as defined in UTS #46. -func (c info) appendMapping(b []byte, s string) []byte { - index := int(c >> indexShift) - if c&xorBit == 0 { - s := mappings[index:] - return append(b, s[1:s[0]+1]...) - } - b = append(b, s...) - if c&inlineXOR == inlineXOR { - // TODO: support and handle two-byte inline masks - b[len(b)-1] ^= byte(index) - } else { - for p := len(b) - int(xorData[index]); p < len(b); p++ { - index++ - b[p] ^= xorData[index] - } - } - return b -} - -// Sparse block handling code. - -type valueRange struct { - value uint16 // header: value:stride - lo, hi byte // header: lo:n -} - -type sparseBlocks struct { - values []valueRange - offset []uint16 -} - -var idnaSparse = sparseBlocks{ - values: idnaSparseValues[:], - offset: idnaSparseOffset[:], -} - -// Don't use newIdnaTrie to avoid unconditional linking in of the table. -var trie = &idnaTrie{} - -// lookup determines the type of block n and looks up the value for b. -// For n < t.cutoff, the block is a simple lookup table. Otherwise, the block -// is a list of ranges with an accompanying value. Given a matching range r, -// the value for b is by r.value + (b - r.lo) * stride. -func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { - offset := t.offset[n] - header := t.values[offset] - lo := offset + 1 - hi := lo + uint16(header.lo) - for lo < hi { - m := lo + (hi-lo)/2 - r := t.values[m] - if r.lo <= b && b <= r.hi { - return r.value + uint16(b-r.lo)*header.value - } - if b < r.lo { - hi = m - } else { - lo = m + 1 - } - } - return 0 -} diff --git a/vendor/golang.org/x/net/idna/trieval.go b/vendor/golang.org/x/net/idna/trieval.go deleted file mode 100644 index 7a8cf889b..000000000 --- a/vendor/golang.org/x/net/idna/trieval.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package idna - -// This file contains definitions for interpreting the trie value of the idna -// trie generated by "go run gen*.go". It is shared by both the generator -// program and the resultant package. Sharing is achieved by the generator -// copying gen_trieval.go to trieval.go and changing what's above this comment. - -// info holds information from the IDNA mapping table for a single rune. It is -// the value returned by a trie lookup. In most cases, all information fits in -// a 16-bit value. For mappings, this value may contain an index into a slice -// with the mapped string. Such mappings can consist of the actual mapped value -// or an XOR pattern to be applied to the bytes of the UTF8 encoding of the -// input rune. This technique is used by the cases packages and reduces the -// table size significantly. -// -// The per-rune values have the following format: -// -// if mapped { -// if inlinedXOR { -// 15..13 inline XOR marker -// 12..11 unused -// 10..3 inline XOR mask -// } else { -// 15..3 index into xor or mapping table -// } -// } else { -// 15..14 unused -// 13 mayNeedNorm -// 12..11 attributes -// 10..8 joining type -// 7..3 category type -// } -// 2 use xor pattern -// 1..0 mapped category -// -// See the definitions below for a more detailed description of the various -// bits. -type info uint16 - -const ( - catSmallMask = 0x3 - catBigMask = 0xF8 - indexShift = 3 - xorBit = 0x4 // interpret the index as an xor pattern - inlineXOR = 0xE000 // These bits are set if the XOR pattern is inlined. - - joinShift = 8 - joinMask = 0x07 - - // Attributes - attributesMask = 0x1800 - viramaModifier = 0x1800 - modifier = 0x1000 - rtl = 0x0800 - - mayNeedNorm = 0x2000 -) - -// A category corresponds to a category defined in the IDNA mapping table. -type category uint16 - -const ( - unknown category = 0 // not currently defined in unicode. - mapped category = 1 - disallowedSTD3Mapped category = 2 - deviation category = 3 -) - -const ( - valid category = 0x08 - validNV8 category = 0x18 - validXV8 category = 0x28 - disallowed category = 0x40 - disallowedSTD3Valid category = 0x80 - ignored category = 0xC0 -) - -// join types and additional rune information -const ( - joiningL = (iota + 1) - joiningD - joiningT - joiningR - - //the following types are derived during processing - joinZWJ - joinZWNJ - joinVirama - numJoinTypes -) - -func (c info) isMapped() bool { - return c&0x3 != 0 -} - -func (c info) category() category { - small := c & catSmallMask - if small != 0 { - return category(small) - } - return category(c & catBigMask) -} - -func (c info) joinType() info { - if c.isMapped() { - return 0 - } - return (c >> joinShift) & joinMask -} - -func (c info) isModifier() bool { - return c&(modifier|catSmallMask) == modifier -} - -func (c info) isViramaModifier() bool { - return c&(attributesMask|catSmallMask) == viramaModifier -} diff --git a/vendor/golang.org/x/net/internal/iana/const.go b/vendor/golang.org/x/net/internal/iana/const.go deleted file mode 100644 index cea712fac..000000000 --- a/vendor/golang.org/x/net/internal/iana/const.go +++ /dev/null @@ -1,223 +0,0 @@ -// go generate gen.go -// Code generated by the command above; DO NOT EDIT. - -// Package iana provides protocol number resources managed by the Internet Assigned Numbers Authority (IANA). -package iana // import "golang.org/x/net/internal/iana" - -// Differentiated Services Field Codepoints (DSCP), Updated: 2018-05-04 -const ( - DiffServCS0 = 0x00 // CS0 - DiffServCS1 = 0x20 // CS1 - DiffServCS2 = 0x40 // CS2 - DiffServCS3 = 0x60 // CS3 - DiffServCS4 = 0x80 // CS4 - DiffServCS5 = 0xa0 // CS5 - DiffServCS6 = 0xc0 // CS6 - DiffServCS7 = 0xe0 // CS7 - DiffServAF11 = 0x28 // AF11 - DiffServAF12 = 0x30 // AF12 - DiffServAF13 = 0x38 // AF13 - DiffServAF21 = 0x48 // AF21 - DiffServAF22 = 0x50 // AF22 - DiffServAF23 = 0x58 // AF23 - DiffServAF31 = 0x68 // AF31 - DiffServAF32 = 0x70 // AF32 - DiffServAF33 = 0x78 // AF33 - DiffServAF41 = 0x88 // AF41 - DiffServAF42 = 0x90 // AF42 - DiffServAF43 = 0x98 // AF43 - DiffServEF = 0xb8 // EF - DiffServVOICEADMIT = 0xb0 // VOICE-ADMIT - NotECNTransport = 0x00 // Not-ECT (Not ECN-Capable Transport) - ECNTransport1 = 0x01 // ECT(1) (ECN-Capable Transport(1)) - ECNTransport0 = 0x02 // ECT(0) (ECN-Capable Transport(0)) - CongestionExperienced = 0x03 // CE (Congestion Experienced) -) - -// Protocol Numbers, Updated: 2017-10-13 -const ( - ProtocolIP = 0 // IPv4 encapsulation, pseudo protocol number - ProtocolHOPOPT = 0 // IPv6 Hop-by-Hop Option - ProtocolICMP = 1 // Internet Control Message - ProtocolIGMP = 2 // Internet Group Management - ProtocolGGP = 3 // Gateway-to-Gateway - ProtocolIPv4 = 4 // IPv4 encapsulation - ProtocolST = 5 // Stream - ProtocolTCP = 6 // Transmission Control - ProtocolCBT = 7 // CBT - ProtocolEGP = 8 // Exterior Gateway Protocol - ProtocolIGP = 9 // any private interior gateway (used by Cisco for their IGRP) - ProtocolBBNRCCMON = 10 // BBN RCC Monitoring - ProtocolNVPII = 11 // Network Voice Protocol - ProtocolPUP = 12 // PUP - ProtocolEMCON = 14 // EMCON - ProtocolXNET = 15 // Cross Net Debugger - ProtocolCHAOS = 16 // Chaos - ProtocolUDP = 17 // User Datagram - ProtocolMUX = 18 // Multiplexing - ProtocolDCNMEAS = 19 // DCN Measurement Subsystems - ProtocolHMP = 20 // Host Monitoring - ProtocolPRM = 21 // Packet Radio Measurement - ProtocolXNSIDP = 22 // XEROX NS IDP - ProtocolTRUNK1 = 23 // Trunk-1 - ProtocolTRUNK2 = 24 // Trunk-2 - ProtocolLEAF1 = 25 // Leaf-1 - ProtocolLEAF2 = 26 // Leaf-2 - ProtocolRDP = 27 // Reliable Data Protocol - ProtocolIRTP = 28 // Internet Reliable Transaction - ProtocolISOTP4 = 29 // ISO Transport Protocol Class 4 - ProtocolNETBLT = 30 // Bulk Data Transfer Protocol - ProtocolMFENSP = 31 // MFE Network Services Protocol - ProtocolMERITINP = 32 // MERIT Internodal Protocol - ProtocolDCCP = 33 // Datagram Congestion Control Protocol - Protocol3PC = 34 // Third Party Connect Protocol - ProtocolIDPR = 35 // Inter-Domain Policy Routing Protocol - ProtocolXTP = 36 // XTP - ProtocolDDP = 37 // Datagram Delivery Protocol - ProtocolIDPRCMTP = 38 // IDPR Control Message Transport Proto - ProtocolTPPP = 39 // TP++ Transport Protocol - ProtocolIL = 40 // IL Transport Protocol - ProtocolIPv6 = 41 // IPv6 encapsulation - ProtocolSDRP = 42 // Source Demand Routing Protocol - ProtocolIPv6Route = 43 // Routing Header for IPv6 - ProtocolIPv6Frag = 44 // Fragment Header for IPv6 - ProtocolIDRP = 45 // Inter-Domain Routing Protocol - ProtocolRSVP = 46 // Reservation Protocol - ProtocolGRE = 47 // Generic Routing Encapsulation - ProtocolDSR = 48 // Dynamic Source Routing Protocol - ProtocolBNA = 49 // BNA - ProtocolESP = 50 // Encap Security Payload - ProtocolAH = 51 // Authentication Header - ProtocolINLSP = 52 // Integrated Net Layer Security TUBA - ProtocolNARP = 54 // NBMA Address Resolution Protocol - ProtocolMOBILE = 55 // IP Mobility - ProtocolTLSP = 56 // Transport Layer Security Protocol using Kryptonet key management - ProtocolSKIP = 57 // SKIP - ProtocolIPv6ICMP = 58 // ICMP for IPv6 - ProtocolIPv6NoNxt = 59 // No Next Header for IPv6 - ProtocolIPv6Opts = 60 // Destination Options for IPv6 - ProtocolCFTP = 62 // CFTP - ProtocolSATEXPAK = 64 // SATNET and Backroom EXPAK - ProtocolKRYPTOLAN = 65 // Kryptolan - ProtocolRVD = 66 // MIT Remote Virtual Disk Protocol - ProtocolIPPC = 67 // Internet Pluribus Packet Core - ProtocolSATMON = 69 // SATNET Monitoring - ProtocolVISA = 70 // VISA Protocol - ProtocolIPCV = 71 // Internet Packet Core Utility - ProtocolCPNX = 72 // Computer Protocol Network Executive - ProtocolCPHB = 73 // Computer Protocol Heart Beat - ProtocolWSN = 74 // Wang Span Network - ProtocolPVP = 75 // Packet Video Protocol - ProtocolBRSATMON = 76 // Backroom SATNET Monitoring - ProtocolSUNND = 77 // SUN ND PROTOCOL-Temporary - ProtocolWBMON = 78 // WIDEBAND Monitoring - ProtocolWBEXPAK = 79 // WIDEBAND EXPAK - ProtocolISOIP = 80 // ISO Internet Protocol - ProtocolVMTP = 81 // VMTP - ProtocolSECUREVMTP = 82 // SECURE-VMTP - ProtocolVINES = 83 // VINES - ProtocolTTP = 84 // Transaction Transport Protocol - ProtocolIPTM = 84 // Internet Protocol Traffic Manager - ProtocolNSFNETIGP = 85 // NSFNET-IGP - ProtocolDGP = 86 // Dissimilar Gateway Protocol - ProtocolTCF = 87 // TCF - ProtocolEIGRP = 88 // EIGRP - ProtocolOSPFIGP = 89 // OSPFIGP - ProtocolSpriteRPC = 90 // Sprite RPC Protocol - ProtocolLARP = 91 // Locus Address Resolution Protocol - ProtocolMTP = 92 // Multicast Transport Protocol - ProtocolAX25 = 93 // AX.25 Frames - ProtocolIPIP = 94 // IP-within-IP Encapsulation Protocol - ProtocolSCCSP = 96 // Semaphore Communications Sec. Pro. - ProtocolETHERIP = 97 // Ethernet-within-IP Encapsulation - ProtocolENCAP = 98 // Encapsulation Header - ProtocolGMTP = 100 // GMTP - ProtocolIFMP = 101 // Ipsilon Flow Management Protocol - ProtocolPNNI = 102 // PNNI over IP - ProtocolPIM = 103 // Protocol Independent Multicast - ProtocolARIS = 104 // ARIS - ProtocolSCPS = 105 // SCPS - ProtocolQNX = 106 // QNX - ProtocolAN = 107 // Active Networks - ProtocolIPComp = 108 // IP Payload Compression Protocol - ProtocolSNP = 109 // Sitara Networks Protocol - ProtocolCompaqPeer = 110 // Compaq Peer Protocol - ProtocolIPXinIP = 111 // IPX in IP - ProtocolVRRP = 112 // Virtual Router Redundancy Protocol - ProtocolPGM = 113 // PGM Reliable Transport Protocol - ProtocolL2TP = 115 // Layer Two Tunneling Protocol - ProtocolDDX = 116 // D-II Data Exchange (DDX) - ProtocolIATP = 117 // Interactive Agent Transfer Protocol - ProtocolSTP = 118 // Schedule Transfer Protocol - ProtocolSRP = 119 // SpectraLink Radio Protocol - ProtocolUTI = 120 // UTI - ProtocolSMP = 121 // Simple Message Protocol - ProtocolPTP = 123 // Performance Transparency Protocol - ProtocolISIS = 124 // ISIS over IPv4 - ProtocolFIRE = 125 // FIRE - ProtocolCRTP = 126 // Combat Radio Transport Protocol - ProtocolCRUDP = 127 // Combat Radio User Datagram - ProtocolSSCOPMCE = 128 // SSCOPMCE - ProtocolIPLT = 129 // IPLT - ProtocolSPS = 130 // Secure Packet Shield - ProtocolPIPE = 131 // Private IP Encapsulation within IP - ProtocolSCTP = 132 // Stream Control Transmission Protocol - ProtocolFC = 133 // Fibre Channel - ProtocolRSVPE2EIGNORE = 134 // RSVP-E2E-IGNORE - ProtocolMobilityHeader = 135 // Mobility Header - ProtocolUDPLite = 136 // UDPLite - ProtocolMPLSinIP = 137 // MPLS-in-IP - ProtocolMANET = 138 // MANET Protocols - ProtocolHIP = 139 // Host Identity Protocol - ProtocolShim6 = 140 // Shim6 Protocol - ProtocolWESP = 141 // Wrapped Encapsulating Security Payload - ProtocolROHC = 142 // Robust Header Compression - ProtocolReserved = 255 // Reserved -) - -// Address Family Numbers, Updated: 2018-04-02 -const ( - AddrFamilyIPv4 = 1 // IP (IP version 4) - AddrFamilyIPv6 = 2 // IP6 (IP version 6) - AddrFamilyNSAP = 3 // NSAP - AddrFamilyHDLC = 4 // HDLC (8-bit multidrop) - AddrFamilyBBN1822 = 5 // BBN 1822 - AddrFamily802 = 6 // 802 (includes all 802 media plus Ethernet "canonical format") - AddrFamilyE163 = 7 // E.163 - AddrFamilyE164 = 8 // E.164 (SMDS, Frame Relay, ATM) - AddrFamilyF69 = 9 // F.69 (Telex) - AddrFamilyX121 = 10 // X.121 (X.25, Frame Relay) - AddrFamilyIPX = 11 // IPX - AddrFamilyAppletalk = 12 // Appletalk - AddrFamilyDecnetIV = 13 // Decnet IV - AddrFamilyBanyanVines = 14 // Banyan Vines - AddrFamilyE164withSubaddress = 15 // E.164 with NSAP format subaddress - AddrFamilyDNS = 16 // DNS (Domain Name System) - AddrFamilyDistinguishedName = 17 // Distinguished Name - AddrFamilyASNumber = 18 // AS Number - AddrFamilyXTPoverIPv4 = 19 // XTP over IP version 4 - AddrFamilyXTPoverIPv6 = 20 // XTP over IP version 6 - AddrFamilyXTPnativemodeXTP = 21 // XTP native mode XTP - AddrFamilyFibreChannelWorldWidePortName = 22 // Fibre Channel World-Wide Port Name - AddrFamilyFibreChannelWorldWideNodeName = 23 // Fibre Channel World-Wide Node Name - AddrFamilyGWID = 24 // GWID - AddrFamilyL2VPN = 25 // AFI for L2VPN information - AddrFamilyMPLSTPSectionEndpointID = 26 // MPLS-TP Section Endpoint Identifier - AddrFamilyMPLSTPLSPEndpointID = 27 // MPLS-TP LSP Endpoint Identifier - AddrFamilyMPLSTPPseudowireEndpointID = 28 // MPLS-TP Pseudowire Endpoint Identifier - AddrFamilyMTIPv4 = 29 // MT IP: Multi-Topology IP version 4 - AddrFamilyMTIPv6 = 30 // MT IPv6: Multi-Topology IP version 6 - AddrFamilyEIGRPCommonServiceFamily = 16384 // EIGRP Common Service Family - AddrFamilyEIGRPIPv4ServiceFamily = 16385 // EIGRP IPv4 Service Family - AddrFamilyEIGRPIPv6ServiceFamily = 16386 // EIGRP IPv6 Service Family - AddrFamilyLISPCanonicalAddressFormat = 16387 // LISP Canonical Address Format (LCAF) - AddrFamilyBGPLS = 16388 // BGP-LS - AddrFamily48bitMAC = 16389 // 48-bit MAC - AddrFamily64bitMAC = 16390 // 64-bit MAC - AddrFamilyOUI = 16391 // OUI - AddrFamilyMACFinal24bits = 16392 // MAC/24 - AddrFamilyMACFinal40bits = 16393 // MAC/40 - AddrFamilyIPv6Initial64bits = 16394 // IPv6/64 - AddrFamilyRBridgePortID = 16395 // RBridge Port ID - AddrFamilyTRILLNickname = 16396 // TRILL Nickname -) diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr.go b/vendor/golang.org/x/net/internal/socket/cmsghdr.go deleted file mode 100644 index 0a73e277e..000000000 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris - -package socket - -func (h *cmsghdr) len() int { return int(h.Len) } -func (h *cmsghdr) lvl() int { return int(h.Level) } -func (h *cmsghdr) typ() int { return int(h.Type) } diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go deleted file mode 100644 index 14dbb3ad4..000000000 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd netbsd openbsd - -package socket - -func (h *cmsghdr) set(l, lvl, typ int) { - h.Len = uint32(l) - h.Level = int32(lvl) - h.Type = int32(typ) -} diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go deleted file mode 100644 index bac66811d..000000000 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm mips mipsle 386 -// +build linux - -package socket - -func (h *cmsghdr) set(l, lvl, typ int) { - h.Len = uint32(l) - h.Level = int32(lvl) - h.Type = int32(typ) -} diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go deleted file mode 100644 index 27be0efac..000000000 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x -// +build linux - -package socket - -func (h *cmsghdr) set(l, lvl, typ int) { - h.Len = uint64(l) - h.Level = int32(lvl) - h.Type = int32(typ) -} diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go deleted file mode 100644 index 7dedd430e..000000000 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 -// +build solaris - -package socket - -func (h *cmsghdr) set(l, lvl, typ int) { - h.Len = uint32(l) - h.Level = int32(lvl) - h.Type = int32(typ) -} diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go deleted file mode 100644 index e581011b0..000000000 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris - -package socket - -type cmsghdr struct{} - -const sizeofCmsghdr = 0 - -func (h *cmsghdr) len() int { return 0 } -func (h *cmsghdr) lvl() int { return 0 } -func (h *cmsghdr) typ() int { return 0 } - -func (h *cmsghdr) set(l, lvl, typ int) {} diff --git a/vendor/golang.org/x/net/internal/socket/empty.s b/vendor/golang.org/x/net/internal/socket/empty.s deleted file mode 100644 index bff0231c7..000000000 --- a/vendor/golang.org/x/net/internal/socket/empty.s +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin,go1.12 - -// This exists solely so we can linkname in symbols from syscall. diff --git a/vendor/golang.org/x/net/internal/socket/error_unix.go b/vendor/golang.org/x/net/internal/socket/error_unix.go deleted file mode 100644 index f14872d3d..000000000 --- a/vendor/golang.org/x/net/internal/socket/error_unix.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris - -package socket - -import "syscall" - -var ( - errEAGAIN error = syscall.EAGAIN - errEINVAL error = syscall.EINVAL - errENOENT error = syscall.ENOENT -) - -// errnoErr returns common boxed Errno values, to prevent allocations -// at runtime. -func errnoErr(errno syscall.Errno) error { - switch errno { - case 0: - return nil - case syscall.EAGAIN: - return errEAGAIN - case syscall.EINVAL: - return errEINVAL - case syscall.ENOENT: - return errENOENT - } - return errno -} diff --git a/vendor/golang.org/x/net/internal/socket/error_windows.go b/vendor/golang.org/x/net/internal/socket/error_windows.go deleted file mode 100644 index 6a6379a8b..000000000 --- a/vendor/golang.org/x/net/internal/socket/error_windows.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import "syscall" - -var ( - errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING - errEINVAL error = syscall.EINVAL -) - -// errnoErr returns common boxed Errno values, to prevent allocations -// at runtime. -func errnoErr(errno syscall.Errno) error { - switch errno { - case 0: - return nil - case syscall.ERROR_IO_PENDING: - return errERROR_IO_PENDING - case syscall.EINVAL: - return errEINVAL - } - return errno -} diff --git a/vendor/golang.org/x/net/internal/socket/iovec_32bit.go b/vendor/golang.org/x/net/internal/socket/iovec_32bit.go deleted file mode 100644 index 05d6082d1..000000000 --- a/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm mips mipsle 386 -// +build darwin dragonfly freebsd linux netbsd openbsd - -package socket - -import "unsafe" - -func (v *iovec) set(b []byte) { - l := len(b) - if l == 0 { - return - } - v.Base = (*byte)(unsafe.Pointer(&b[0])) - v.Len = uint32(l) -} diff --git a/vendor/golang.org/x/net/internal/socket/iovec_64bit.go b/vendor/golang.org/x/net/internal/socket/iovec_64bit.go deleted file mode 100644 index dfeda752b..000000000 --- a/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x -// +build aix darwin dragonfly freebsd linux netbsd openbsd - -package socket - -import "unsafe" - -func (v *iovec) set(b []byte) { - l := len(b) - if l == 0 { - return - } - v.Base = (*byte)(unsafe.Pointer(&b[0])) - v.Len = uint64(l) -} diff --git a/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go b/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go deleted file mode 100644 index 8d17a40c4..000000000 --- a/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 -// +build solaris - -package socket - -import "unsafe" - -func (v *iovec) set(b []byte) { - l := len(b) - if l == 0 { - return - } - v.Base = (*int8)(unsafe.Pointer(&b[0])) - v.Len = uint64(l) -} diff --git a/vendor/golang.org/x/net/internal/socket/iovec_stub.go b/vendor/golang.org/x/net/internal/socket/iovec_stub.go deleted file mode 100644 index a746e90e3..000000000 --- a/vendor/golang.org/x/net/internal/socket/iovec_stub.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris - -package socket - -type iovec struct{} - -func (v *iovec) set(b []byte) {} diff --git a/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go b/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go deleted file mode 100644 index 1a7f2792f..000000000 --- a/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!linux,!netbsd - -package socket - -import "net" - -type mmsghdr struct{} - -type mmsghdrs []mmsghdr - -func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { - return nil -} - -func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { - return nil -} diff --git a/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go b/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go deleted file mode 100644 index f1100683a..000000000 --- a/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix linux netbsd - -package socket - -import "net" - -type mmsghdrs []mmsghdr - -func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { - for i := range hs { - vs := make([]iovec, len(ms[i].Buffers)) - var sa []byte - if parseFn != nil { - sa = make([]byte, sizeofSockaddrInet6) - } - if marshalFn != nil { - sa = marshalFn(ms[i].Addr) - } - hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa) - } - return nil -} - -func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { - for i := range hs { - ms[i].N = int(hs[i].Len) - ms[i].NN = hs[i].Hdr.controllen() - ms[i].Flags = hs[i].Hdr.flags() - if parseFn != nil { - var err error - ms[i].Addr, err = parseFn(hs[i].Hdr.name(), hint) - if err != nil { - return err - } - } - } - return nil -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go b/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go deleted file mode 100644 index 77f44c1f1..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd netbsd openbsd - -package socket - -import "unsafe" - -func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { - for i := range vs { - vs[i].set(bs[i]) - } - h.setIov(vs) - if len(oob) > 0 { - h.Control = (*byte)(unsafe.Pointer(&oob[0])) - h.Controllen = uint32(len(oob)) - } - if sa != nil { - h.Name = (*byte)(unsafe.Pointer(&sa[0])) - h.Namelen = uint32(len(sa)) - } -} - -func (h *msghdr) name() []byte { - if h.Name != nil && h.Namelen > 0 { - return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] - } - return nil -} - -func (h *msghdr) controllen() int { - return int(h.Controllen) -} - -func (h *msghdr) flags() int { - return int(h.Flags) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go b/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go deleted file mode 100644 index c5562dd66..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd netbsd - -package socket - -func (h *msghdr) setIov(vs []iovec) { - l := len(vs) - if l == 0 { - return - } - h.Iov = &vs[0] - h.Iovlen = int32(l) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_linux.go b/vendor/golang.org/x/net/internal/socket/msghdr_linux.go deleted file mode 100644 index 5a38798cc..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_linux.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import "unsafe" - -func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { - for i := range vs { - vs[i].set(bs[i]) - } - h.setIov(vs) - if len(oob) > 0 { - h.setControl(oob) - } - if sa != nil { - h.Name = (*byte)(unsafe.Pointer(&sa[0])) - h.Namelen = uint32(len(sa)) - } -} - -func (h *msghdr) name() []byte { - if h.Name != nil && h.Namelen > 0 { - return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] - } - return nil -} - -func (h *msghdr) controllen() int { - return int(h.Controllen) -} - -func (h *msghdr) flags() int { - return int(h.Flags) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go b/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go deleted file mode 100644 index a7a5987c8..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm mips mipsle 386 -// +build linux - -package socket - -import "unsafe" - -func (h *msghdr) setIov(vs []iovec) { - l := len(vs) - if l == 0 { - return - } - h.Iov = &vs[0] - h.Iovlen = uint32(l) -} - -func (h *msghdr) setControl(b []byte) { - h.Control = (*byte)(unsafe.Pointer(&b[0])) - h.Controllen = uint32(len(b)) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go b/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go deleted file mode 100644 index e731833a2..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x -// +build linux - -package socket - -import "unsafe" - -func (h *msghdr) setIov(vs []iovec) { - l := len(vs) - if l == 0 { - return - } - h.Iov = &vs[0] - h.Iovlen = uint64(l) -} - -func (h *msghdr) setControl(b []byte) { - h.Control = (*byte)(unsafe.Pointer(&b[0])) - h.Controllen = uint64(len(b)) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go b/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go deleted file mode 100644 index 71a69e251..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -func (h *msghdr) setIov(vs []iovec) { - l := len(vs) - if l == 0 { - return - } - h.Iov = &vs[0] - h.Iovlen = uint32(l) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go b/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go deleted file mode 100644 index 6465b2073..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 -// +build solaris - -package socket - -import "unsafe" - -func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { - for i := range vs { - vs[i].set(bs[i]) - } - if len(vs) > 0 { - h.Iov = &vs[0] - h.Iovlen = int32(len(vs)) - } - if len(oob) > 0 { - h.Accrights = (*int8)(unsafe.Pointer(&oob[0])) - h.Accrightslen = int32(len(oob)) - } - if sa != nil { - h.Name = (*byte)(unsafe.Pointer(&sa[0])) - h.Namelen = uint32(len(sa)) - } -} - -func (h *msghdr) controllen() int { - return int(h.Accrightslen) -} - -func (h *msghdr) flags() int { - return int(NativeEndian.Uint32(h.Pad_cgo_2[:])) -} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_stub.go b/vendor/golang.org/x/net/internal/socket/msghdr_stub.go deleted file mode 100644 index 873490a7a..000000000 --- a/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris - -package socket - -type msghdr struct{} - -func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) {} -func (h *msghdr) name() []byte { return nil } -func (h *msghdr) controllen() int { return 0 } -func (h *msghdr) flags() int { return 0 } diff --git a/vendor/golang.org/x/net/internal/socket/norace.go b/vendor/golang.org/x/net/internal/socket/norace.go deleted file mode 100644 index 9519ffbba..000000000 --- a/vendor/golang.org/x/net/internal/socket/norace.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !race - -package socket - -func (m *Message) raceRead() { -} -func (m *Message) raceWrite() { -} diff --git a/vendor/golang.org/x/net/internal/socket/race.go b/vendor/golang.org/x/net/internal/socket/race.go deleted file mode 100644 index df60c62ff..000000000 --- a/vendor/golang.org/x/net/internal/socket/race.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build race - -package socket - -import ( - "runtime" - "unsafe" -) - -// This package reads and writes the Message buffers using a -// direct system call, which the race detector can't see. -// These functions tell the race detector what is going on during the syscall. - -func (m *Message) raceRead() { - for _, b := range m.Buffers { - if len(b) > 0 { - runtime.RaceReadRange(unsafe.Pointer(&b[0]), len(b)) - } - } - if b := m.OOB; len(b) > 0 { - runtime.RaceReadRange(unsafe.Pointer(&b[0]), len(b)) - } -} -func (m *Message) raceWrite() { - for _, b := range m.Buffers { - if len(b) > 0 { - runtime.RaceWriteRange(unsafe.Pointer(&b[0]), len(b)) - } - } - if b := m.OOB; len(b) > 0 { - runtime.RaceWriteRange(unsafe.Pointer(&b[0]), len(b)) - } -} diff --git a/vendor/golang.org/x/net/internal/socket/rawconn.go b/vendor/golang.org/x/net/internal/socket/rawconn.go deleted file mode 100644 index b07b89005..000000000 --- a/vendor/golang.org/x/net/internal/socket/rawconn.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "errors" - "net" - "os" - "syscall" -) - -// A Conn represents a raw connection. -type Conn struct { - network string - c syscall.RawConn -} - -// NewConn returns a new raw connection. -func NewConn(c net.Conn) (*Conn, error) { - var err error - var cc Conn - switch c := c.(type) { - case *net.TCPConn: - cc.network = "tcp" - cc.c, err = c.SyscallConn() - case *net.UDPConn: - cc.network = "udp" - cc.c, err = c.SyscallConn() - case *net.IPConn: - cc.network = "ip" - cc.c, err = c.SyscallConn() - default: - return nil, errors.New("unknown connection type") - } - if err != nil { - return nil, err - } - return &cc, nil -} - -func (o *Option) get(c *Conn, b []byte) (int, error) { - var operr error - var n int - fn := func(s uintptr) { - n, operr = getsockopt(s, o.Level, o.Name, b) - } - if err := c.c.Control(fn); err != nil { - return 0, err - } - return n, os.NewSyscallError("getsockopt", operr) -} - -func (o *Option) set(c *Conn, b []byte) error { - var operr error - fn := func(s uintptr) { - operr = setsockopt(s, o.Level, o.Name, b) - } - if err := c.c.Control(fn); err != nil { - return err - } - return os.NewSyscallError("setsockopt", operr) -} diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go b/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go deleted file mode 100644 index d01fc4c7d..000000000 --- a/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux - -package socket - -import ( - "net" - "os" - "syscall" -) - -func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { - for i := range ms { - ms[i].raceWrite() - } - hs := make(mmsghdrs, len(ms)) - var parseFn func([]byte, string) (net.Addr, error) - if c.network != "tcp" { - parseFn = parseInetAddr - } - if err := hs.pack(ms, parseFn, nil); err != nil { - return 0, err - } - var operr error - var n int - fn := func(s uintptr) bool { - n, operr = recvmmsg(s, hs, flags) - if operr == syscall.EAGAIN { - return false - } - return true - } - if err := c.c.Read(fn); err != nil { - return n, err - } - if operr != nil { - return n, os.NewSyscallError("recvmmsg", operr) - } - if err := hs[:n].unpack(ms[:n], parseFn, c.network); err != nil { - return n, err - } - return n, nil -} - -func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { - for i := range ms { - ms[i].raceRead() - } - hs := make(mmsghdrs, len(ms)) - var marshalFn func(net.Addr) []byte - if c.network != "tcp" { - marshalFn = marshalInetAddr - } - if err := hs.pack(ms, nil, marshalFn); err != nil { - return 0, err - } - var operr error - var n int - fn := func(s uintptr) bool { - n, operr = sendmmsg(s, hs, flags) - if operr == syscall.EAGAIN { - return false - } - return true - } - if err := c.c.Write(fn); err != nil { - return n, err - } - if operr != nil { - return n, os.NewSyscallError("sendmmsg", operr) - } - if err := hs[:n].unpack(ms[:n], nil, ""); err != nil { - return n, err - } - return n, nil -} diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_msg.go b/vendor/golang.org/x/net/internal/socket/rawconn_msg.go deleted file mode 100644 index d5ae3f8e1..000000000 --- a/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows - -package socket - -import ( - "os" - "syscall" -) - -func (c *Conn) recvMsg(m *Message, flags int) error { - m.raceWrite() - var h msghdr - vs := make([]iovec, len(m.Buffers)) - var sa []byte - if c.network != "tcp" { - sa = make([]byte, sizeofSockaddrInet6) - } - h.pack(vs, m.Buffers, m.OOB, sa) - var operr error - var n int - fn := func(s uintptr) bool { - n, operr = recvmsg(s, &h, flags) - if operr == syscall.EAGAIN { - return false - } - return true - } - if err := c.c.Read(fn); err != nil { - return err - } - if operr != nil { - return os.NewSyscallError("recvmsg", operr) - } - if c.network != "tcp" { - var err error - m.Addr, err = parseInetAddr(sa[:], c.network) - if err != nil { - return err - } - } - m.N = n - m.NN = h.controllen() - m.Flags = h.flags() - return nil -} - -func (c *Conn) sendMsg(m *Message, flags int) error { - m.raceRead() - var h msghdr - vs := make([]iovec, len(m.Buffers)) - var sa []byte - if m.Addr != nil { - sa = marshalInetAddr(m.Addr) - } - h.pack(vs, m.Buffers, m.OOB, sa) - var operr error - var n int - fn := func(s uintptr) bool { - n, operr = sendmsg(s, &h, flags) - if operr == syscall.EAGAIN { - return false - } - return true - } - if err := c.c.Write(fn); err != nil { - return err - } - if operr != nil { - return os.NewSyscallError("sendmsg", operr) - } - m.N = n - m.NN = len(m.OOB) - return nil -} diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go b/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go deleted file mode 100644 index fe5bb942b..000000000 --- a/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !linux - -package socket - -func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { - return 0, errNotImplemented -} - -func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { - return 0, errNotImplemented -} diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go b/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go deleted file mode 100644 index b8cea6fe5..000000000 --- a/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows - -package socket - -func (c *Conn) recvMsg(m *Message, flags int) error { - return errNotImplemented -} - -func (c *Conn) sendMsg(m *Message, flags int) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/internal/socket/socket.go b/vendor/golang.org/x/net/internal/socket/socket.go deleted file mode 100644 index 23571b8d4..000000000 --- a/vendor/golang.org/x/net/internal/socket/socket.go +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package socket provides a portable interface for socket system -// calls. -package socket // import "golang.org/x/net/internal/socket" - -import ( - "errors" - "net" - "runtime" - "unsafe" -) - -var errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH) - -// An Option represents a sticky socket option. -type Option struct { - Level int // level - Name int // name; must be equal or greater than 1 - Len int // length of value in bytes; must be equal or greater than 1 -} - -// Get reads a value for the option from the kernel. -// It returns the number of bytes written into b. -func (o *Option) Get(c *Conn, b []byte) (int, error) { - if o.Name < 1 || o.Len < 1 { - return 0, errors.New("invalid option") - } - if len(b) < o.Len { - return 0, errors.New("short buffer") - } - return o.get(c, b) -} - -// GetInt returns an integer value for the option. -// -// The Len field of Option must be either 1 or 4. -func (o *Option) GetInt(c *Conn) (int, error) { - if o.Len != 1 && o.Len != 4 { - return 0, errors.New("invalid option") - } - var b []byte - var bb [4]byte - if o.Len == 1 { - b = bb[:1] - } else { - b = bb[:4] - } - n, err := o.get(c, b) - if err != nil { - return 0, err - } - if n != o.Len { - return 0, errors.New("invalid option length") - } - if o.Len == 1 { - return int(b[0]), nil - } - return int(NativeEndian.Uint32(b[:4])), nil -} - -// Set writes the option and value to the kernel. -func (o *Option) Set(c *Conn, b []byte) error { - if o.Name < 1 || o.Len < 1 { - return errors.New("invalid option") - } - if len(b) < o.Len { - return errors.New("short buffer") - } - return o.set(c, b) -} - -// SetInt writes the option and value to the kernel. -// -// The Len field of Option must be either 1 or 4. -func (o *Option) SetInt(c *Conn, v int) error { - if o.Len != 1 && o.Len != 4 { - return errors.New("invalid option") - } - var b []byte - if o.Len == 1 { - b = []byte{byte(v)} - } else { - var bb [4]byte - NativeEndian.PutUint32(bb[:o.Len], uint32(v)) - b = bb[:4] - } - return o.set(c, b) -} - -func controlHeaderLen() int { - return roundup(sizeofCmsghdr) -} - -func controlMessageLen(dataLen int) int { - return roundup(sizeofCmsghdr) + dataLen -} - -// ControlMessageSpace returns the whole length of control message. -func ControlMessageSpace(dataLen int) int { - return roundup(sizeofCmsghdr) + roundup(dataLen) -} - -// A ControlMessage represents the head message in a stream of control -// messages. -// -// A control message comprises of a header, data and a few padding -// fields to conform to the interface to the kernel. -// -// See RFC 3542 for further information. -type ControlMessage []byte - -// Data returns the data field of the control message at the head on -// m. -func (m ControlMessage) Data(dataLen int) []byte { - l := controlHeaderLen() - if len(m) < l || len(m) < l+dataLen { - return nil - } - return m[l : l+dataLen] -} - -// Next returns the control message at the next on m. -// -// Next works only for standard control messages. -func (m ControlMessage) Next(dataLen int) ControlMessage { - l := ControlMessageSpace(dataLen) - if len(m) < l { - return nil - } - return m[l:] -} - -// MarshalHeader marshals the header fields of the control message at -// the head on m. -func (m ControlMessage) MarshalHeader(lvl, typ, dataLen int) error { - if len(m) < controlHeaderLen() { - return errors.New("short message") - } - h := (*cmsghdr)(unsafe.Pointer(&m[0])) - h.set(controlMessageLen(dataLen), lvl, typ) - return nil -} - -// ParseHeader parses and returns the header fields of the control -// message at the head on m. -func (m ControlMessage) ParseHeader() (lvl, typ, dataLen int, err error) { - l := controlHeaderLen() - if len(m) < l { - return 0, 0, 0, errors.New("short message") - } - h := (*cmsghdr)(unsafe.Pointer(&m[0])) - return h.lvl(), h.typ(), int(uint64(h.len()) - uint64(l)), nil -} - -// Marshal marshals the control message at the head on m, and returns -// the next control message. -func (m ControlMessage) Marshal(lvl, typ int, data []byte) (ControlMessage, error) { - l := len(data) - if len(m) < ControlMessageSpace(l) { - return nil, errors.New("short message") - } - h := (*cmsghdr)(unsafe.Pointer(&m[0])) - h.set(controlMessageLen(l), lvl, typ) - if l > 0 { - copy(m.Data(l), data) - } - return m.Next(l), nil -} - -// Parse parses m as a single or multiple control messages. -// -// Parse works for both standard and compatible messages. -func (m ControlMessage) Parse() ([]ControlMessage, error) { - var ms []ControlMessage - for len(m) >= controlHeaderLen() { - h := (*cmsghdr)(unsafe.Pointer(&m[0])) - l := h.len() - if l <= 0 { - return nil, errors.New("invalid header length") - } - if uint64(l) < uint64(controlHeaderLen()) { - return nil, errors.New("invalid message length") - } - if uint64(l) > uint64(len(m)) { - return nil, errors.New("short buffer") - } - // On message reception: - // - // |<- ControlMessageSpace --------------->| - // |<- controlMessageLen ---------->| | - // |<- controlHeaderLen ->| | | - // +---------------+------+---------+------+ - // | Header | PadH | Data | PadD | - // +---------------+------+---------+------+ - // - // On compatible message reception: - // - // | ... |<- controlMessageLen ----------->| - // | ... |<- controlHeaderLen ->| | - // +-----+---------------+------+----------+ - // | ... | Header | PadH | Data | - // +-----+---------------+------+----------+ - ms = append(ms, ControlMessage(m[:l])) - ll := l - controlHeaderLen() - if len(m) >= ControlMessageSpace(ll) { - m = m[ControlMessageSpace(ll):] - } else { - m = m[controlMessageLen(ll):] - } - } - return ms, nil -} - -// NewControlMessage returns a new stream of control messages. -func NewControlMessage(dataLen []int) ControlMessage { - var l int - for i := range dataLen { - l += ControlMessageSpace(dataLen[i]) - } - return make([]byte, l) -} - -// A Message represents an IO message. -type Message struct { - // When writing, the Buffers field must contain at least one - // byte to write. - // When reading, the Buffers field will always contain a byte - // to read. - Buffers [][]byte - - // OOB contains protocol-specific control or miscellaneous - // ancillary data known as out-of-band data. - OOB []byte - - // Addr specifies a destination address when writing. - // It can be nil when the underlying protocol of the raw - // connection uses connection-oriented communication. - // After a successful read, it may contain the source address - // on the received packet. - Addr net.Addr - - N int // # of bytes read or written from/to Buffers - NN int // # of bytes read or written from/to OOB - Flags int // protocol-specific information on the received message -} - -// RecvMsg wraps recvmsg system call. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_PEEK. -func (c *Conn) RecvMsg(m *Message, flags int) error { - return c.recvMsg(m, flags) -} - -// SendMsg wraps sendmsg system call. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_DONTROUTE. -func (c *Conn) SendMsg(m *Message, flags int) error { - return c.sendMsg(m, flags) -} - -// RecvMsgs wraps recvmmsg system call. -// -// It returns the number of processed messages. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_PEEK. -// -// Only Linux supports this. -func (c *Conn) RecvMsgs(ms []Message, flags int) (int, error) { - return c.recvMsgs(ms, flags) -} - -// SendMsgs wraps sendmmsg system call. -// -// It returns the number of processed messages. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_DONTROUTE. -// -// Only Linux supports this. -func (c *Conn) SendMsgs(ms []Message, flags int) (int, error) { - return c.sendMsgs(ms, flags) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys.go b/vendor/golang.org/x/net/internal/socket/sys.go deleted file mode 100644 index ee492ba86..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "encoding/binary" - "unsafe" -) - -var ( - // NativeEndian is the machine native endian implementation of - // ByteOrder. - NativeEndian binary.ByteOrder - - kernelAlign int -) - -func init() { - i := uint32(1) - b := (*[4]byte)(unsafe.Pointer(&i)) - if b[0] == 1 { - NativeEndian = binary.LittleEndian - } else { - NativeEndian = binary.BigEndian - } - kernelAlign = probeProtocolStack() -} - -func roundup(l int) int { - return (l + kernelAlign - 1) &^ (kernelAlign - 1) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_bsd.go b/vendor/golang.org/x/net/internal/socket/sys_bsd.go deleted file mode 100644 index d432835b4..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_bsd.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd openbsd - -package socket - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go b/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go deleted file mode 100644 index b4f41b552..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix freebsd netbsd openbsd - -package socket - -import ( - "runtime" - "unsafe" -) - -func probeProtocolStack() int { - if (runtime.GOOS == "netbsd" || runtime.GOOS == "openbsd") && runtime.GOARCH == "arm" { - return 8 - } - if runtime.GOOS == "aix" { - return 1 - } - var p uintptr - return int(unsafe.Sizeof(p)) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_const_unix.go b/vendor/golang.org/x/net/internal/socket/sys_const_unix.go deleted file mode 100644 index 43797d6e5..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_const_unix.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris - -package socket - -import "golang.org/x/sys/unix" - -const ( - sysAF_UNSPEC = unix.AF_UNSPEC - sysAF_INET = unix.AF_INET - sysAF_INET6 = unix.AF_INET6 - - sysSOCK_RAW = unix.SOCK_RAW -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_darwin.go b/vendor/golang.org/x/net/internal/socket/sys_darwin.go deleted file mode 100644 index b17d223bf..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_darwin.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -func probeProtocolStack() int { return 4 } diff --git a/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go b/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go deleted file mode 100644 index ed0448fe9..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "sync" - "syscall" - "unsafe" -) - -// See version list in https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/param.h -var ( - osreldateOnce sync.Once - osreldate uint32 -) - -// First __DragonFly_version after September 2019 ABI changes -// http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html -const _dragonflyABIChangeVersion = 500705 - -func probeProtocolStack() int { - osreldateOnce.Do(func() { osreldate, _ = syscall.SysctlUint32("kern.osreldate") }) - var p uintptr - if int(unsafe.Sizeof(p)) == 8 && osreldate >= _dragonflyABIChangeVersion { - return int(unsafe.Sizeof(p)) - } - // 64-bit Dragonfly before the September 2019 ABI changes still requires - // 32-bit aligned access to network subsystem. - return 4 -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go b/vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go deleted file mode 100644 index 02d2b3cc8..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.12 - -package socket - -import ( - "syscall" - "unsafe" -) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) - return int(l), errnoErr(errno) -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) - return errnoErr(errno) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) - return int(n), errnoErr(errno) -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) - return int(n), errnoErr(errno) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_linkname.go b/vendor/golang.org/x/net/internal/socket/sys_linkname.go deleted file mode 100644 index 61c3f38a5..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linkname.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix go1.12,darwin - -package socket - -import ( - "syscall" - "unsafe" -) - -//go:linkname syscall_getsockopt syscall.getsockopt -func syscall_getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *uint32) error - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - err := syscall_getsockopt(int(s), level, name, unsafe.Pointer(&b[0]), &l) - return int(l), err -} - -//go:linkname syscall_setsockopt syscall.setsockopt -func syscall_setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error - -func setsockopt(s uintptr, level, name int, b []byte) error { - return syscall_setsockopt(int(s), level, name, unsafe.Pointer(&b[0]), uintptr(len(b))) -} - -//go:linkname syscall_recvmsg syscall.recvmsg -func syscall_recvmsg(s int, msg *syscall.Msghdr, flags int) (n int, err error) - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - return syscall_recvmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags) -} - -//go:linkname syscall_sendmsg syscall.sendmsg -func syscall_sendmsg(s int, msg *syscall.Msghdr, flags int) (n int, err error) - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - return syscall_sendmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux.go b/vendor/golang.org/x/net/internal/socket/sys_linux.go deleted file mode 100644 index 1559521e0..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux,!s390x,!386 - -package socket - -import ( - "syscall" - "unsafe" -) - -func probeProtocolStack() int { - var p uintptr - return int(unsafe.Sizeof(p)) -} - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_386.go b/vendor/golang.org/x/net/internal/socket/sys_linux_386.go deleted file mode 100644 index 235b2cc08..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_386.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "syscall" - "unsafe" -) - -func probeProtocolStack() int { return 4 } - -const ( - sysSETSOCKOPT = 0xe - sysGETSOCKOPT = 0xf - sysSENDMSG = 0x10 - sysRECVMSG = 0x11 - sysRECVMMSG = 0x13 - sysSENDMMSG = 0x14 -) - -func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) -func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) - return int(l), errnoErr(errno) -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) - return errnoErr(errno) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, errno := socketcall(sysRECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) - return int(n), errnoErr(errno) -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, errno := socketcall(sysSENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) - return int(n), errnoErr(errno) -} - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, errno := socketcall(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_386.s b/vendor/golang.org/x/net/internal/socket/sys_linux_386.s deleted file mode 100644 index 93e7d75ec..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_386.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -TEXT ·socketcall(SB),NOSPLIT,$0-36 - JMP syscall·socketcall(SB) - -TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 - JMP syscall·rawsocketcall(SB) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go b/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go deleted file mode 100644 index 9decee2e5..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x12b - sysSENDMMSG = 0x133 -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go b/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go deleted file mode 100644 index d753b436d..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x16d - sysSENDMMSG = 0x176 -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go b/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go deleted file mode 100644 index b67089436..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0xf3 - sysSENDMMSG = 0x10d -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go b/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go deleted file mode 100644 index 9c0d74014..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x10ef - sysSENDMMSG = 0x10f7 -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go b/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go deleted file mode 100644 index 071a4aba8..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x14ae - sysSENDMMSG = 0x14b6 -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go b/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go deleted file mode 100644 index 071a4aba8..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x14ae - sysSENDMMSG = 0x14b6 -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go b/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go deleted file mode 100644 index 9c0d74014..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x10ef - sysSENDMMSG = 0x10f7 -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go b/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go deleted file mode 100644 index 21c1e3f00..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x157 - sysSENDMMSG = 0x15d -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go b/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go deleted file mode 100644 index 21c1e3f00..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -const ( - sysRECVMMSG = 0x157 - sysSENDMMSG = 0x15d -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go b/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go deleted file mode 100644 index 64f69f1dc..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build riscv64 - -package socket - -const ( - sysRECVMMSG = 0xf3 - sysSENDMMSG = 0x10d -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go b/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go deleted file mode 100644 index 327979efb..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "syscall" - "unsafe" -) - -func probeProtocolStack() int { return 8 } - -const ( - sysSETSOCKOPT = 0xe - sysGETSOCKOPT = 0xf - sysSENDMSG = 0x10 - sysRECVMSG = 0x11 - sysRECVMMSG = 0x13 - sysSENDMMSG = 0x14 -) - -func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) -func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) - return int(l), errnoErr(errno) -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) - return errnoErr(errno) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, errno := socketcall(sysRECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) - return int(n), errnoErr(errno) -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, errno := socketcall(sysSENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) - return int(n), errnoErr(errno) -} - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, errno := socketcall(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s b/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s deleted file mode 100644 index 06d75628c..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 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. - -#include "textflag.h" - -TEXT ·socketcall(SB),NOSPLIT,$0-72 - JMP syscall·socketcall(SB) - -TEXT ·rawsocketcall(SB),NOSPLIT,$0-72 - JMP syscall·rawsocketcall(SB) diff --git a/vendor/golang.org/x/net/internal/socket/sys_netbsd.go b/vendor/golang.org/x/net/internal/socket/sys_netbsd.go deleted file mode 100644 index 431851c12..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_netbsd.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "syscall" - "unsafe" -) - -const ( - sysRECVMMSG = 0x1db - sysSENDMMSG = 0x1dc -) - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) - return int(n), errnoErr(errno) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_posix.go b/vendor/golang.org/x/net/internal/socket/sys_posix.go deleted file mode 100644 index 22eae809c..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_posix.go +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows - -package socket - -import ( - "encoding/binary" - "errors" - "net" - "runtime" - "strconv" - "sync" - "time" -) - -func marshalInetAddr(a net.Addr) []byte { - switch a := a.(type) { - case *net.TCPAddr: - return marshalSockaddr(a.IP, a.Port, a.Zone) - case *net.UDPAddr: - return marshalSockaddr(a.IP, a.Port, a.Zone) - case *net.IPAddr: - return marshalSockaddr(a.IP, 0, a.Zone) - default: - return nil - } -} - -func marshalSockaddr(ip net.IP, port int, zone string) []byte { - if ip4 := ip.To4(); ip4 != nil { - b := make([]byte, sizeofSockaddrInet) - switch runtime.GOOS { - case "android", "illumos", "linux", "solaris", "windows": - NativeEndian.PutUint16(b[:2], uint16(sysAF_INET)) - default: - b[0] = sizeofSockaddrInet - b[1] = sysAF_INET - } - binary.BigEndian.PutUint16(b[2:4], uint16(port)) - copy(b[4:8], ip4) - return b - } - if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil { - b := make([]byte, sizeofSockaddrInet6) - switch runtime.GOOS { - case "android", "illumos", "linux", "solaris", "windows": - NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6)) - default: - b[0] = sizeofSockaddrInet6 - b[1] = sysAF_INET6 - } - binary.BigEndian.PutUint16(b[2:4], uint16(port)) - copy(b[8:24], ip6) - if zone != "" { - NativeEndian.PutUint32(b[24:28], uint32(zoneCache.index(zone))) - } - return b - } - return nil -} - -func parseInetAddr(b []byte, network string) (net.Addr, error) { - if len(b) < 2 { - return nil, errors.New("invalid address") - } - var af int - switch runtime.GOOS { - case "android", "illumos", "linux", "solaris", "windows": - af = int(NativeEndian.Uint16(b[:2])) - default: - af = int(b[1]) - } - var ip net.IP - var zone string - if af == sysAF_INET { - if len(b) < sizeofSockaddrInet { - return nil, errors.New("short address") - } - ip = make(net.IP, net.IPv4len) - copy(ip, b[4:8]) - } - if af == sysAF_INET6 { - if len(b) < sizeofSockaddrInet6 { - return nil, errors.New("short address") - } - ip = make(net.IP, net.IPv6len) - copy(ip, b[8:24]) - if id := int(NativeEndian.Uint32(b[24:28])); id > 0 { - zone = zoneCache.name(id) - } - } - switch network { - case "tcp", "tcp4", "tcp6": - return &net.TCPAddr{IP: ip, Port: int(binary.BigEndian.Uint16(b[2:4])), Zone: zone}, nil - case "udp", "udp4", "udp6": - return &net.UDPAddr{IP: ip, Port: int(binary.BigEndian.Uint16(b[2:4])), Zone: zone}, nil - default: - return &net.IPAddr{IP: ip, Zone: zone}, nil - } -} - -// An ipv6ZoneCache represents a cache holding partial network -// interface information. It is used for reducing the cost of IPv6 -// addressing scope zone resolution. -// -// Multiple names sharing the index are managed by first-come -// first-served basis for consistency. -type ipv6ZoneCache struct { - sync.RWMutex // guard the following - lastFetched time.Time // last time routing information was fetched - toIndex map[string]int // interface name to its index - toName map[int]string // interface index to its name -} - -var zoneCache = ipv6ZoneCache{ - toIndex: make(map[string]int), - toName: make(map[int]string), -} - -// update refreshes the network interface information if the cache was last -// updated more than 1 minute ago, or if force is set. It returns whether the -// cache was updated. -func (zc *ipv6ZoneCache) update(ift []net.Interface, force bool) (updated bool) { - zc.Lock() - defer zc.Unlock() - now := time.Now() - if !force && zc.lastFetched.After(now.Add(-60*time.Second)) { - return false - } - zc.lastFetched = now - if len(ift) == 0 { - var err error - if ift, err = net.Interfaces(); err != nil { - return false - } - } - zc.toIndex = make(map[string]int, len(ift)) - zc.toName = make(map[int]string, len(ift)) - for _, ifi := range ift { - zc.toIndex[ifi.Name] = ifi.Index - if _, ok := zc.toName[ifi.Index]; !ok { - zc.toName[ifi.Index] = ifi.Name - } - } - return true -} - -func (zc *ipv6ZoneCache) name(zone int) string { - updated := zoneCache.update(nil, false) - zoneCache.RLock() - name, ok := zoneCache.toName[zone] - zoneCache.RUnlock() - if !ok && !updated { - zoneCache.update(nil, true) - zoneCache.RLock() - name, ok = zoneCache.toName[zone] - zoneCache.RUnlock() - } - if !ok { // last resort - name = strconv.Itoa(zone) - } - return name -} - -func (zc *ipv6ZoneCache) index(zone string) int { - updated := zoneCache.update(nil, false) - zoneCache.RLock() - index, ok := zoneCache.toIndex[zone] - zoneCache.RUnlock() - if !ok && !updated { - zoneCache.update(nil, true) - zoneCache.RLock() - index, ok = zoneCache.toIndex[zone] - zoneCache.RUnlock() - } - if !ok { // last resort - index, _ = strconv.Atoi(zone) - } - return index -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_solaris.go b/vendor/golang.org/x/net/internal/socket/sys_solaris.go deleted file mode 100644 index 66b554786..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_solaris.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "runtime" - "syscall" - "unsafe" -) - -func probeProtocolStack() int { - switch runtime.GOARCH { - case "amd64": - return 4 - default: - var p uintptr - return int(unsafe.Sizeof(p)) - } -} - -//go:cgo_import_dynamic libc___xnet_getsockopt __xnet_getsockopt "libsocket.so" -//go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" -//go:cgo_import_dynamic libc___xnet_recvmsg __xnet_recvmsg "libsocket.so" -//go:cgo_import_dynamic libc___xnet_sendmsg __xnet_sendmsg "libsocket.so" - -//go:linkname procGetsockopt libc___xnet_getsockopt -//go:linkname procSetsockopt libc_setsockopt -//go:linkname procRecvmsg libc___xnet_recvmsg -//go:linkname procSendmsg libc___xnet_sendmsg - -var ( - procGetsockopt uintptr - procSetsockopt uintptr - procRecvmsg uintptr - procSendmsg uintptr -) - -func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno) -func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procGetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) - return int(l), errnoErr(errno) -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procSetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) - return errnoErr(errno) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procRecvmsg)), 3, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) - return int(n), errnoErr(errno) -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procSendmsg)), 3, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) - return int(n), errnoErr(errno) -} - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s b/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s deleted file mode 100644 index a18ac5ed7..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2016 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. - -#include "textflag.h" - -TEXT ·sysvicall6(SB),NOSPLIT,$0-88 - JMP syscall·sysvicall6(SB) - -TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 - JMP syscall·rawSysvicall6(SB) diff --git a/vendor/golang.org/x/net/internal/socket/sys_stub.go b/vendor/golang.org/x/net/internal/socket/sys_stub.go deleted file mode 100644 index 0f6174262..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_stub.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows - -package socket - -import ( - "net" - "runtime" - "unsafe" -) - -const ( - sysAF_UNSPEC = 0x0 - sysAF_INET = 0x2 - sysAF_INET6 = 0xa - - sysSOCK_RAW = 0x3 -) - -func probeProtocolStack() int { - switch runtime.GOARCH { - case "amd64p32", "mips64p32": - return 4 - default: - var p uintptr - return int(unsafe.Sizeof(p)) - } -} - -func marshalInetAddr(ip net.IP, port int, zone string) []byte { - return nil -} - -func parseInetAddr(b []byte, network string) (net.Addr, error) { - return nil, errNotImplemented -} - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - return 0, errNotImplemented -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - return errNotImplemented -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_unix.go b/vendor/golang.org/x/net/internal/socket/sys_unix.go deleted file mode 100644 index 0eb71283f..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_unix.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build dragonfly freebsd linux,!s390x,!386 netbsd openbsd - -package socket - -import ( - "syscall" - "unsafe" -) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) - return int(l), errnoErr(errno) -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) - return errnoErr(errno) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) - return int(n), errnoErr(errno) -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) - return int(n), errnoErr(errno) -} diff --git a/vendor/golang.org/x/net/internal/socket/sys_windows.go b/vendor/golang.org/x/net/internal/socket/sys_windows.go deleted file mode 100644 index d556a4461..000000000 --- a/vendor/golang.org/x/net/internal/socket/sys_windows.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - "syscall" - "unsafe" - - "golang.org/x/sys/windows" -) - -func probeProtocolStack() int { - var p uintptr - return int(unsafe.Sizeof(p)) -} - -const ( - sysAF_UNSPEC = windows.AF_UNSPEC - sysAF_INET = windows.AF_INET - sysAF_INET6 = windows.AF_INET6 - - sysSOCK_RAW = windows.SOCK_RAW -) - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) - -func getsockopt(s uintptr, level, name int, b []byte) (int, error) { - l := uint32(len(b)) - err := syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), (*int32)(unsafe.Pointer(&l))) - return int(l), err -} - -func setsockopt(s uintptr, level, name int, b []byte) error { - return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), int32(len(b))) -} - -func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} - -func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { - return 0, errNotImplemented -} diff --git a/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go b/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go deleted file mode 100644 index e740c8f02..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_aix.go - -// Added for go1.11 compatibility -// +build aix - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go deleted file mode 100644 index 083bda51c..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_darwin.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go deleted file mode 100644 index 55c6c9f57..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_darwin.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go deleted file mode 100644 index 083bda51c..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_darwin.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go deleted file mode 100644 index 55c6c9f57..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_darwin.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go deleted file mode 100644 index 8b7d161d7..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_dragonfly.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go deleted file mode 100644 index 3e71ff574..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go deleted file mode 100644 index 238d90de6..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go deleted file mode 100644 index 3e71ff574..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go deleted file mode 100644 index 238d90de6..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go deleted file mode 100644 index d33025b70..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go deleted file mode 100644 index b20d21677..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go deleted file mode 100644 index 1bb10a428..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go deleted file mode 100644 index 7f6e8a7fa..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go deleted file mode 100644 index 1bb10a428..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go deleted file mode 100644 index 7f6e8a7fa..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go deleted file mode 100644 index 7f6e8a7fa..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go deleted file mode 100644 index 1bb10a428..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go deleted file mode 100644 index 7f6e8a7fa..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go deleted file mode 100644 index 7f6e8a7fa..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go deleted file mode 100644 index f12a1d768..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -// +build riscv64 - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_0 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go deleted file mode 100644 index 7f6e8a7fa..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint64 - Control *byte - Controllen uint64 - Flags int32 - Pad_cgo_1 [4]byte -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint64 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - - sizeofCmsghdr = 0x10 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go deleted file mode 100644 index 7e258cec2..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_netbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go deleted file mode 100644 index b3f9c0d7e..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_netbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go deleted file mode 100644 index 7e258cec2..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_netbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go deleted file mode 100644 index da26ef019..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_netbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type mmsghdr struct { - Hdr msghdr - Len uint32 - Pad_cgo_0 [4]byte -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go deleted file mode 100644 index 73655a14c..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_openbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go deleted file mode 100644 index 0a4de80f2..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_openbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go deleted file mode 100644 index 73655a14c..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_openbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint32 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Iov *iovec - Iovlen uint32 - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go deleted file mode 100644 index 0a4de80f2..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_openbsd.go - -package socket - -type iovec struct { - Base *byte - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen uint32 - Pad_cgo_1 [4]byte - Control *byte - Controllen uint32 - Flags int32 -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c -) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go deleted file mode 100644 index 353cd5fb4..000000000 --- a/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_solaris.go - -package socket - -type iovec struct { - Base *int8 - Len uint64 -} - -type msghdr struct { - Name *byte - Namelen uint32 - Pad_cgo_0 [4]byte - Iov *iovec - Iovlen int32 - Pad_cgo_1 [4]byte - Accrights *int8 - Accrightslen int32 - Pad_cgo_2 [4]byte -} - -type cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 - X__sin6_src_id uint32 -} - -const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x20 -) diff --git a/vendor/golang.org/x/net/internal/timeseries/timeseries.go b/vendor/golang.org/x/net/internal/timeseries/timeseries.go deleted file mode 100644 index dc5225b6d..000000000 --- a/vendor/golang.org/x/net/internal/timeseries/timeseries.go +++ /dev/null @@ -1,525 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package timeseries implements a time series structure for stats collection. -package timeseries // import "golang.org/x/net/internal/timeseries" - -import ( - "fmt" - "log" - "time" -) - -const ( - timeSeriesNumBuckets = 64 - minuteHourSeriesNumBuckets = 60 -) - -var timeSeriesResolutions = []time.Duration{ - 1 * time.Second, - 10 * time.Second, - 1 * time.Minute, - 10 * time.Minute, - 1 * time.Hour, - 6 * time.Hour, - 24 * time.Hour, // 1 day - 7 * 24 * time.Hour, // 1 week - 4 * 7 * 24 * time.Hour, // 4 weeks - 16 * 7 * 24 * time.Hour, // 16 weeks -} - -var minuteHourSeriesResolutions = []time.Duration{ - 1 * time.Second, - 1 * time.Minute, -} - -// An Observable is a kind of data that can be aggregated in a time series. -type Observable interface { - Multiply(ratio float64) // Multiplies the data in self by a given ratio - Add(other Observable) // Adds the data from a different observation to self - Clear() // Clears the observation so it can be reused. - CopyFrom(other Observable) // Copies the contents of a given observation to self -} - -// Float attaches the methods of Observable to a float64. -type Float float64 - -// NewFloat returns a Float. -func NewFloat() Observable { - f := Float(0) - return &f -} - -// String returns the float as a string. -func (f *Float) String() string { return fmt.Sprintf("%g", f.Value()) } - -// Value returns the float's value. -func (f *Float) Value() float64 { return float64(*f) } - -func (f *Float) Multiply(ratio float64) { *f *= Float(ratio) } - -func (f *Float) Add(other Observable) { - o := other.(*Float) - *f += *o -} - -func (f *Float) Clear() { *f = 0 } - -func (f *Float) CopyFrom(other Observable) { - o := other.(*Float) - *f = *o -} - -// A Clock tells the current time. -type Clock interface { - Time() time.Time -} - -type defaultClock int - -var defaultClockInstance defaultClock - -func (defaultClock) Time() time.Time { return time.Now() } - -// Information kept per level. Each level consists of a circular list of -// observations. The start of the level may be derived from end and the -// len(buckets) * sizeInMillis. -type tsLevel struct { - oldest int // index to oldest bucketed Observable - newest int // index to newest bucketed Observable - end time.Time // end timestamp for this level - size time.Duration // duration of the bucketed Observable - buckets []Observable // collections of observations - provider func() Observable // used for creating new Observable -} - -func (l *tsLevel) Clear() { - l.oldest = 0 - l.newest = len(l.buckets) - 1 - l.end = time.Time{} - for i := range l.buckets { - if l.buckets[i] != nil { - l.buckets[i].Clear() - l.buckets[i] = nil - } - } -} - -func (l *tsLevel) InitLevel(size time.Duration, numBuckets int, f func() Observable) { - l.size = size - l.provider = f - l.buckets = make([]Observable, numBuckets) -} - -// Keeps a sequence of levels. Each level is responsible for storing data at -// a given resolution. For example, the first level stores data at a one -// minute resolution while the second level stores data at a one hour -// resolution. - -// Each level is represented by a sequence of buckets. Each bucket spans an -// interval equal to the resolution of the level. New observations are added -// to the last bucket. -type timeSeries struct { - provider func() Observable // make more Observable - numBuckets int // number of buckets in each level - levels []*tsLevel // levels of bucketed Observable - lastAdd time.Time // time of last Observable tracked - total Observable // convenient aggregation of all Observable - clock Clock // Clock for getting current time - pending Observable // observations not yet bucketed - pendingTime time.Time // what time are we keeping in pending - dirty bool // if there are pending observations -} - -// init initializes a level according to the supplied criteria. -func (ts *timeSeries) init(resolutions []time.Duration, f func() Observable, numBuckets int, clock Clock) { - ts.provider = f - ts.numBuckets = numBuckets - ts.clock = clock - ts.levels = make([]*tsLevel, len(resolutions)) - - for i := range resolutions { - if i > 0 && resolutions[i-1] >= resolutions[i] { - log.Print("timeseries: resolutions must be monotonically increasing") - break - } - newLevel := new(tsLevel) - newLevel.InitLevel(resolutions[i], ts.numBuckets, ts.provider) - ts.levels[i] = newLevel - } - - ts.Clear() -} - -// Clear removes all observations from the time series. -func (ts *timeSeries) Clear() { - ts.lastAdd = time.Time{} - ts.total = ts.resetObservation(ts.total) - ts.pending = ts.resetObservation(ts.pending) - ts.pendingTime = time.Time{} - ts.dirty = false - - for i := range ts.levels { - ts.levels[i].Clear() - } -} - -// Add records an observation at the current time. -func (ts *timeSeries) Add(observation Observable) { - ts.AddWithTime(observation, ts.clock.Time()) -} - -// AddWithTime records an observation at the specified time. -func (ts *timeSeries) AddWithTime(observation Observable, t time.Time) { - - smallBucketDuration := ts.levels[0].size - - if t.After(ts.lastAdd) { - ts.lastAdd = t - } - - if t.After(ts.pendingTime) { - ts.advance(t) - ts.mergePendingUpdates() - ts.pendingTime = ts.levels[0].end - ts.pending.CopyFrom(observation) - ts.dirty = true - } else if t.After(ts.pendingTime.Add(-1 * smallBucketDuration)) { - // The observation is close enough to go into the pending bucket. - // This compensates for clock skewing and small scheduling delays - // by letting the update stay in the fast path. - ts.pending.Add(observation) - ts.dirty = true - } else { - ts.mergeValue(observation, t) - } -} - -// mergeValue inserts the observation at the specified time in the past into all levels. -func (ts *timeSeries) mergeValue(observation Observable, t time.Time) { - for _, level := range ts.levels { - index := (ts.numBuckets - 1) - int(level.end.Sub(t)/level.size) - if 0 <= index && index < ts.numBuckets { - bucketNumber := (level.oldest + index) % ts.numBuckets - if level.buckets[bucketNumber] == nil { - level.buckets[bucketNumber] = level.provider() - } - level.buckets[bucketNumber].Add(observation) - } - } - ts.total.Add(observation) -} - -// mergePendingUpdates applies the pending updates into all levels. -func (ts *timeSeries) mergePendingUpdates() { - if ts.dirty { - ts.mergeValue(ts.pending, ts.pendingTime) - ts.pending = ts.resetObservation(ts.pending) - ts.dirty = false - } -} - -// advance cycles the buckets at each level until the latest bucket in -// each level can hold the time specified. -func (ts *timeSeries) advance(t time.Time) { - if !t.After(ts.levels[0].end) { - return - } - for i := 0; i < len(ts.levels); i++ { - level := ts.levels[i] - if !level.end.Before(t) { - break - } - - // If the time is sufficiently far, just clear the level and advance - // directly. - if !t.Before(level.end.Add(level.size * time.Duration(ts.numBuckets))) { - for _, b := range level.buckets { - ts.resetObservation(b) - } - level.end = time.Unix(0, (t.UnixNano()/level.size.Nanoseconds())*level.size.Nanoseconds()) - } - - for t.After(level.end) { - level.end = level.end.Add(level.size) - level.newest = level.oldest - level.oldest = (level.oldest + 1) % ts.numBuckets - ts.resetObservation(level.buckets[level.newest]) - } - - t = level.end - } -} - -// Latest returns the sum of the num latest buckets from the level. -func (ts *timeSeries) Latest(level, num int) Observable { - now := ts.clock.Time() - if ts.levels[0].end.Before(now) { - ts.advance(now) - } - - ts.mergePendingUpdates() - - result := ts.provider() - l := ts.levels[level] - index := l.newest - - for i := 0; i < num; i++ { - if l.buckets[index] != nil { - result.Add(l.buckets[index]) - } - if index == 0 { - index = ts.numBuckets - } - index-- - } - - return result -} - -// LatestBuckets returns a copy of the num latest buckets from level. -func (ts *timeSeries) LatestBuckets(level, num int) []Observable { - if level < 0 || level > len(ts.levels) { - log.Print("timeseries: bad level argument: ", level) - return nil - } - if num < 0 || num >= ts.numBuckets { - log.Print("timeseries: bad num argument: ", num) - return nil - } - - results := make([]Observable, num) - now := ts.clock.Time() - if ts.levels[0].end.Before(now) { - ts.advance(now) - } - - ts.mergePendingUpdates() - - l := ts.levels[level] - index := l.newest - - for i := 0; i < num; i++ { - result := ts.provider() - results[i] = result - if l.buckets[index] != nil { - result.CopyFrom(l.buckets[index]) - } - - if index == 0 { - index = ts.numBuckets - } - index -= 1 - } - return results -} - -// ScaleBy updates observations by scaling by factor. -func (ts *timeSeries) ScaleBy(factor float64) { - for _, l := range ts.levels { - for i := 0; i < ts.numBuckets; i++ { - l.buckets[i].Multiply(factor) - } - } - - ts.total.Multiply(factor) - ts.pending.Multiply(factor) -} - -// Range returns the sum of observations added over the specified time range. -// If start or finish times don't fall on bucket boundaries of the same -// level, then return values are approximate answers. -func (ts *timeSeries) Range(start, finish time.Time) Observable { - return ts.ComputeRange(start, finish, 1)[0] -} - -// Recent returns the sum of observations from the last delta. -func (ts *timeSeries) Recent(delta time.Duration) Observable { - now := ts.clock.Time() - return ts.Range(now.Add(-delta), now) -} - -// Total returns the total of all observations. -func (ts *timeSeries) Total() Observable { - ts.mergePendingUpdates() - return ts.total -} - -// ComputeRange computes a specified number of values into a slice using -// the observations recorded over the specified time period. The return -// values are approximate if the start or finish times don't fall on the -// bucket boundaries at the same level or if the number of buckets spanning -// the range is not an integral multiple of num. -func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observable { - if start.After(finish) { - log.Printf("timeseries: start > finish, %v>%v", start, finish) - return nil - } - - if num < 0 { - log.Printf("timeseries: num < 0, %v", num) - return nil - } - - results := make([]Observable, num) - - for _, l := range ts.levels { - if !start.Before(l.end.Add(-l.size * time.Duration(ts.numBuckets))) { - ts.extract(l, start, finish, num, results) - return results - } - } - - // Failed to find a level that covers the desired range. So just - // extract from the last level, even if it doesn't cover the entire - // desired range. - ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results) - - return results -} - -// RecentList returns the specified number of values in slice over the most -// recent time period of the specified range. -func (ts *timeSeries) RecentList(delta time.Duration, num int) []Observable { - if delta < 0 { - return nil - } - now := ts.clock.Time() - return ts.ComputeRange(now.Add(-delta), now, num) -} - -// extract returns a slice of specified number of observations from a given -// level over a given range. -func (ts *timeSeries) extract(l *tsLevel, start, finish time.Time, num int, results []Observable) { - ts.mergePendingUpdates() - - srcInterval := l.size - dstInterval := finish.Sub(start) / time.Duration(num) - dstStart := start - srcStart := l.end.Add(-srcInterval * time.Duration(ts.numBuckets)) - - srcIndex := 0 - - // Where should scanning start? - if dstStart.After(srcStart) { - advance := int(dstStart.Sub(srcStart) / srcInterval) - srcIndex += advance - srcStart = srcStart.Add(time.Duration(advance) * srcInterval) - } - - // The i'th value is computed as show below. - // interval = (finish/start)/num - // i'th value = sum of observation in range - // [ start + i * interval, - // start + (i + 1) * interval ) - for i := 0; i < num; i++ { - results[i] = ts.resetObservation(results[i]) - dstEnd := dstStart.Add(dstInterval) - for srcIndex < ts.numBuckets && srcStart.Before(dstEnd) { - srcEnd := srcStart.Add(srcInterval) - if srcEnd.After(ts.lastAdd) { - srcEnd = ts.lastAdd - } - - if !srcEnd.Before(dstStart) { - srcValue := l.buckets[(srcIndex+l.oldest)%ts.numBuckets] - if !srcStart.Before(dstStart) && !srcEnd.After(dstEnd) { - // dst completely contains src. - if srcValue != nil { - results[i].Add(srcValue) - } - } else { - // dst partially overlaps src. - overlapStart := maxTime(srcStart, dstStart) - overlapEnd := minTime(srcEnd, dstEnd) - base := srcEnd.Sub(srcStart) - fraction := overlapEnd.Sub(overlapStart).Seconds() / base.Seconds() - - used := ts.provider() - if srcValue != nil { - used.CopyFrom(srcValue) - } - used.Multiply(fraction) - results[i].Add(used) - } - - if srcEnd.After(dstEnd) { - break - } - } - srcIndex++ - srcStart = srcStart.Add(srcInterval) - } - dstStart = dstStart.Add(dstInterval) - } -} - -// resetObservation clears the content so the struct may be reused. -func (ts *timeSeries) resetObservation(observation Observable) Observable { - if observation == nil { - observation = ts.provider() - } else { - observation.Clear() - } - return observation -} - -// TimeSeries tracks data at granularities from 1 second to 16 weeks. -type TimeSeries struct { - timeSeries -} - -// NewTimeSeries creates a new TimeSeries using the function provided for creating new Observable. -func NewTimeSeries(f func() Observable) *TimeSeries { - return NewTimeSeriesWithClock(f, defaultClockInstance) -} - -// NewTimeSeriesWithClock creates a new TimeSeries using the function provided for creating new Observable and the clock for -// assigning timestamps. -func NewTimeSeriesWithClock(f func() Observable, clock Clock) *TimeSeries { - ts := new(TimeSeries) - ts.timeSeries.init(timeSeriesResolutions, f, timeSeriesNumBuckets, clock) - return ts -} - -// MinuteHourSeries tracks data at granularities of 1 minute and 1 hour. -type MinuteHourSeries struct { - timeSeries -} - -// NewMinuteHourSeries creates a new MinuteHourSeries using the function provided for creating new Observable. -func NewMinuteHourSeries(f func() Observable) *MinuteHourSeries { - return NewMinuteHourSeriesWithClock(f, defaultClockInstance) -} - -// NewMinuteHourSeriesWithClock creates a new MinuteHourSeries using the function provided for creating new Observable and the clock for -// assigning timestamps. -func NewMinuteHourSeriesWithClock(f func() Observable, clock Clock) *MinuteHourSeries { - ts := new(MinuteHourSeries) - ts.timeSeries.init(minuteHourSeriesResolutions, f, - minuteHourSeriesNumBuckets, clock) - return ts -} - -func (ts *MinuteHourSeries) Minute() Observable { - return ts.timeSeries.Latest(0, 60) -} - -func (ts *MinuteHourSeries) Hour() Observable { - return ts.timeSeries.Latest(1, 60) -} - -func minTime(a, b time.Time) time.Time { - if a.Before(b) { - return a - } - return b -} - -func maxTime(a, b time.Time) time.Time { - if a.After(b) { - return a - } - return b -} diff --git a/vendor/golang.org/x/net/ipv4/batch.go b/vendor/golang.org/x/net/ipv4/batch.go deleted file mode 100644 index 1a3a4fc0c..000000000 --- a/vendor/golang.org/x/net/ipv4/batch.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "runtime" - - "golang.org/x/net/internal/socket" -) - -// BUG(mikio): On Windows, the ReadBatch and WriteBatch methods of -// PacketConn are not implemented. - -// BUG(mikio): On Windows, the ReadBatch and WriteBatch methods of -// RawConn are not implemented. - -// A Message represents an IO message. -// -// type Message struct { -// Buffers [][]byte -// OOB []byte -// Addr net.Addr -// N int -// NN int -// Flags int -// } -// -// The Buffers fields represents a list of contiguous buffers, which -// can be used for vectored IO, for example, putting a header and a -// payload in each slice. -// When writing, the Buffers field must contain at least one byte to -// write. -// When reading, the Buffers field will always contain a byte to read. -// -// The OOB field contains protocol-specific control or miscellaneous -// ancillary data known as out-of-band data. -// It can be nil when not required. -// -// The Addr field specifies a destination address when writing. -// It can be nil when the underlying protocol of the endpoint uses -// connection-oriented communication. -// After a successful read, it may contain the source address on the -// received packet. -// -// The N field indicates the number of bytes read or written from/to -// Buffers. -// -// The NN field indicates the number of bytes read or written from/to -// OOB. -// -// The Flags field contains protocol-specific information on the -// received message. -type Message = socket.Message - -// ReadBatch reads a batch of messages. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_PEEK. -// -// On a successful read it returns the number of messages received, up -// to len(ms). -// -// On Linux, a batch read will be optimized. -// On other platforms, this method will read only a single message. -// -// Unlike the ReadFrom method, it doesn't strip the IPv4 header -// followed by option headers from the received IPv4 datagram when the -// underlying transport is net.IPConn. Each Buffers field of Message -// must be large enough to accommodate an IPv4 header and option -// headers. -func (c *payloadHandler) ReadBatch(ms []Message, flags int) (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - switch runtime.GOOS { - case "linux": - n, err := c.RecvMsgs([]socket.Message(ms), flags) - if err != nil { - err = &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - return n, err - default: - n := 1 - err := c.RecvMsg(&ms[0], flags) - if err != nil { - n = 0 - err = &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - if compatFreeBSD32 && ms[0].NN > 0 { - adjustFreeBSD32(&ms[0]) - } - return n, err - } -} - -// WriteBatch writes a batch of messages. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_DONTROUTE. -// -// It returns the number of messages written on a successful write. -// -// On Linux, a batch write will be optimized. -// On other platforms, this method will write only a single message. -func (c *payloadHandler) WriteBatch(ms []Message, flags int) (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - switch runtime.GOOS { - case "linux": - n, err := c.SendMsgs([]socket.Message(ms), flags) - if err != nil { - err = &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - return n, err - default: - n := 1 - err := c.SendMsg(&ms[0], flags) - if err != nil { - n = 0 - err = &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - return n, err - } -} - -// ReadBatch reads a batch of messages. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_PEEK. -// -// On a successful read it returns the number of messages received, up -// to len(ms). -// -// On Linux, a batch read will be optimized. -// On other platforms, this method will read only a single message. -func (c *packetHandler) ReadBatch(ms []Message, flags int) (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - switch runtime.GOOS { - case "linux": - n, err := c.RecvMsgs([]socket.Message(ms), flags) - if err != nil { - err = &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - return n, err - default: - n := 1 - err := c.RecvMsg(&ms[0], flags) - if err != nil { - n = 0 - err = &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - if compatFreeBSD32 && ms[0].NN > 0 { - adjustFreeBSD32(&ms[0]) - } - return n, err - } -} - -// WriteBatch writes a batch of messages. -// -// The provided flags is a set of platform-dependent flags, such as -// syscall.MSG_DONTROUTE. -// -// It returns the number of messages written on a successful write. -// -// On Linux, a batch write will be optimized. -// On other platforms, this method will write only a single message. -func (c *packetHandler) WriteBatch(ms []Message, flags int) (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - switch runtime.GOOS { - case "linux": - n, err := c.SendMsgs([]socket.Message(ms), flags) - if err != nil { - err = &net.OpError{Op: "write", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - return n, err - default: - n := 1 - err := c.SendMsg(&ms[0], flags) - if err != nil { - n = 0 - err = &net.OpError{Op: "write", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - return n, err - } -} diff --git a/vendor/golang.org/x/net/ipv4/control.go b/vendor/golang.org/x/net/ipv4/control.go deleted file mode 100644 index a2b02ca95..000000000 --- a/vendor/golang.org/x/net/ipv4/control.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "fmt" - "net" - "sync" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -type rawOpt struct { - sync.RWMutex - cflags ControlFlags -} - -func (c *rawOpt) set(f ControlFlags) { c.cflags |= f } -func (c *rawOpt) clear(f ControlFlags) { c.cflags &^= f } -func (c *rawOpt) isset(f ControlFlags) bool { return c.cflags&f != 0 } - -type ControlFlags uint - -const ( - FlagTTL ControlFlags = 1 << iota // pass the TTL on the received packet - FlagSrc // pass the source address on the received packet - FlagDst // pass the destination address on the received packet - FlagInterface // pass the interface index on the received packet -) - -// A ControlMessage represents per packet basis IP-level socket options. -type ControlMessage struct { - // Receiving socket options: SetControlMessage allows to - // receive the options from the protocol stack using ReadFrom - // method of PacketConn or RawConn. - // - // Specifying socket options: ControlMessage for WriteTo - // method of PacketConn or RawConn allows to send the options - // to the protocol stack. - // - TTL int // time-to-live, receiving only - Src net.IP // source address, specifying only - Dst net.IP // destination address, receiving only - IfIndex int // interface index, must be 1 <= value when specifying -} - -func (cm *ControlMessage) String() string { - if cm == nil { - return "<nil>" - } - return fmt.Sprintf("ttl=%d src=%v dst=%v ifindex=%d", cm.TTL, cm.Src, cm.Dst, cm.IfIndex) -} - -// Marshal returns the binary encoding of cm. -func (cm *ControlMessage) Marshal() []byte { - if cm == nil { - return nil - } - var m socket.ControlMessage - if ctlOpts[ctlPacketInfo].name > 0 && (cm.Src.To4() != nil || cm.IfIndex > 0) { - m = socket.NewControlMessage([]int{ctlOpts[ctlPacketInfo].length}) - } - if len(m) > 0 { - ctlOpts[ctlPacketInfo].marshal(m, cm) - } - return m -} - -// Parse parses b as a control message and stores the result in cm. -func (cm *ControlMessage) Parse(b []byte) error { - ms, err := socket.ControlMessage(b).Parse() - if err != nil { - return err - } - for _, m := range ms { - lvl, typ, l, err := m.ParseHeader() - if err != nil { - return err - } - if lvl != iana.ProtocolIP { - continue - } - switch { - case typ == ctlOpts[ctlTTL].name && l >= ctlOpts[ctlTTL].length: - ctlOpts[ctlTTL].parse(cm, m.Data(l)) - case typ == ctlOpts[ctlDst].name && l >= ctlOpts[ctlDst].length: - ctlOpts[ctlDst].parse(cm, m.Data(l)) - case typ == ctlOpts[ctlInterface].name && l >= ctlOpts[ctlInterface].length: - ctlOpts[ctlInterface].parse(cm, m.Data(l)) - case typ == ctlOpts[ctlPacketInfo].name && l >= ctlOpts[ctlPacketInfo].length: - ctlOpts[ctlPacketInfo].parse(cm, m.Data(l)) - } - } - return nil -} - -// NewControlMessage returns a new control message. -// -// The returned message is large enough for options specified by cf. -func NewControlMessage(cf ControlFlags) []byte { - opt := rawOpt{cflags: cf} - var l int - if opt.isset(FlagTTL) && ctlOpts[ctlTTL].name > 0 { - l += socket.ControlMessageSpace(ctlOpts[ctlTTL].length) - } - if ctlOpts[ctlPacketInfo].name > 0 { - if opt.isset(FlagSrc | FlagDst | FlagInterface) { - l += socket.ControlMessageSpace(ctlOpts[ctlPacketInfo].length) - } - } else { - if opt.isset(FlagDst) && ctlOpts[ctlDst].name > 0 { - l += socket.ControlMessageSpace(ctlOpts[ctlDst].length) - } - if opt.isset(FlagInterface) && ctlOpts[ctlInterface].name > 0 { - l += socket.ControlMessageSpace(ctlOpts[ctlInterface].length) - } - } - var b []byte - if l > 0 { - b = make([]byte, l) - } - return b -} - -// Ancillary data socket options -const ( - ctlTTL = iota // header field - ctlSrc // header field - ctlDst // header field - ctlInterface // inbound or outbound interface - ctlPacketInfo // inbound or outbound packet path - ctlMax -) - -// A ctlOpt represents a binding for ancillary data socket option. -type ctlOpt struct { - name int // option name, must be equal or greater than 1 - length int // option length - marshal func([]byte, *ControlMessage) []byte - parse func(*ControlMessage, []byte) -} diff --git a/vendor/golang.org/x/net/ipv4/control_bsd.go b/vendor/golang.org/x/net/ipv4/control_bsd.go deleted file mode 100644 index 69c4f553c..000000000 --- a/vendor/golang.org/x/net/ipv4/control_bsd.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd netbsd openbsd - -package ipv4 - -import ( - "net" - "syscall" - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -func marshalDst(b []byte, cm *ControlMessage) []byte { - m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len) - return m.Next(net.IPv4len) -} - -func parseDst(cm *ControlMessage, b []byte) { - if len(cm.Dst) < net.IPv4len { - cm.Dst = make(net.IP, net.IPv4len) - } - copy(cm.Dst, b[:net.IPv4len]) -} - -func marshalInterface(b []byte, cm *ControlMessage) []byte { - m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink) - return m.Next(syscall.SizeofSockaddrDatalink) -} - -func parseInterface(cm *ControlMessage, b []byte) { - var sadl syscall.SockaddrDatalink - copy((*[unsafe.Sizeof(sadl)]byte)(unsafe.Pointer(&sadl))[:], b) - cm.IfIndex = int(sadl.Index) -} diff --git a/vendor/golang.org/x/net/ipv4/control_pktinfo.go b/vendor/golang.org/x/net/ipv4/control_pktinfo.go deleted file mode 100644 index 425338f35..000000000 --- a/vendor/golang.org/x/net/ipv4/control_pktinfo.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin linux solaris - -package ipv4 - -import ( - "net" - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { - m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo) - if cm != nil { - pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0])) - if ip := cm.Src.To4(); ip != nil { - copy(pi.Spec_dst[:], ip) - } - if cm.IfIndex > 0 { - pi.setIfindex(cm.IfIndex) - } - } - return m.Next(sizeofInetPktinfo) -} - -func parsePacketInfo(cm *ControlMessage, b []byte) { - pi := (*inetPktinfo)(unsafe.Pointer(&b[0])) - cm.IfIndex = int(pi.Ifindex) - if len(cm.Dst) < net.IPv4len { - cm.Dst = make(net.IP, net.IPv4len) - } - copy(cm.Dst, pi.Addr[:]) -} diff --git a/vendor/golang.org/x/net/ipv4/control_stub.go b/vendor/golang.org/x/net/ipv4/control_stub.go deleted file mode 100644 index a0c049d68..000000000 --- a/vendor/golang.org/x/net/ipv4/control_stub.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows - -package ipv4 - -import "golang.org/x/net/internal/socket" - -func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/control_unix.go b/vendor/golang.org/x/net/ipv4/control_unix.go deleted file mode 100644 index b27fa4903..000000000 --- a/vendor/golang.org/x/net/ipv4/control_unix.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris - -package ipv4 - -import ( - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { - opt.Lock() - defer opt.Unlock() - if so, ok := sockOpts[ssoReceiveTTL]; ok && cf&FlagTTL != 0 { - if err := so.SetInt(c, boolint(on)); err != nil { - return err - } - if on { - opt.set(FlagTTL) - } else { - opt.clear(FlagTTL) - } - } - if so, ok := sockOpts[ssoPacketInfo]; ok { - if cf&(FlagSrc|FlagDst|FlagInterface) != 0 { - if err := so.SetInt(c, boolint(on)); err != nil { - return err - } - if on { - opt.set(cf & (FlagSrc | FlagDst | FlagInterface)) - } else { - opt.clear(cf & (FlagSrc | FlagDst | FlagInterface)) - } - } - } else { - if so, ok := sockOpts[ssoReceiveDst]; ok && cf&FlagDst != 0 { - if err := so.SetInt(c, boolint(on)); err != nil { - return err - } - if on { - opt.set(FlagDst) - } else { - opt.clear(FlagDst) - } - } - if so, ok := sockOpts[ssoReceiveInterface]; ok && cf&FlagInterface != 0 { - if err := so.SetInt(c, boolint(on)); err != nil { - return err - } - if on { - opt.set(FlagInterface) - } else { - opt.clear(FlagInterface) - } - } - } - return nil -} - -func marshalTTL(b []byte, cm *ControlMessage) []byte { - m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_RECVTTL, 1) - return m.Next(1) -} - -func parseTTL(cm *ControlMessage, b []byte) { - cm.TTL = int(*(*byte)(unsafe.Pointer(&b[:1][0]))) -} diff --git a/vendor/golang.org/x/net/ipv4/control_windows.go b/vendor/golang.org/x/net/ipv4/control_windows.go deleted file mode 100644 index 82c630642..000000000 --- a/vendor/golang.org/x/net/ipv4/control_windows.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import "golang.org/x/net/internal/socket" - -func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { - // TODO(mikio): implement this - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/dgramopt.go b/vendor/golang.org/x/net/ipv4/dgramopt.go deleted file mode 100644 index c191c22ab..000000000 --- a/vendor/golang.org/x/net/ipv4/dgramopt.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - - "golang.org/x/net/bpf" -) - -// MulticastTTL returns the time-to-live field value for outgoing -// multicast packets. -func (c *dgramOpt) MulticastTTL() (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - so, ok := sockOpts[ssoMulticastTTL] - if !ok { - return 0, errNotImplemented - } - return so.GetInt(c.Conn) -} - -// SetMulticastTTL sets the time-to-live field value for future -// outgoing multicast packets. -func (c *dgramOpt) SetMulticastTTL(ttl int) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoMulticastTTL] - if !ok { - return errNotImplemented - } - return so.SetInt(c.Conn, ttl) -} - -// MulticastInterface returns the default interface for multicast -// packet transmissions. -func (c *dgramOpt) MulticastInterface() (*net.Interface, error) { - if !c.ok() { - return nil, errInvalidConn - } - so, ok := sockOpts[ssoMulticastInterface] - if !ok { - return nil, errNotImplemented - } - return so.getMulticastInterface(c.Conn) -} - -// SetMulticastInterface sets the default interface for future -// multicast packet transmissions. -func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoMulticastInterface] - if !ok { - return errNotImplemented - } - return so.setMulticastInterface(c.Conn, ifi) -} - -// MulticastLoopback reports whether transmitted multicast packets -// should be copied and send back to the originator. -func (c *dgramOpt) MulticastLoopback() (bool, error) { - if !c.ok() { - return false, errInvalidConn - } - so, ok := sockOpts[ssoMulticastLoopback] - if !ok { - return false, errNotImplemented - } - on, err := so.GetInt(c.Conn) - if err != nil { - return false, err - } - return on == 1, nil -} - -// SetMulticastLoopback sets whether transmitted multicast packets -// should be copied and send back to the originator. -func (c *dgramOpt) SetMulticastLoopback(on bool) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoMulticastLoopback] - if !ok { - return errNotImplemented - } - return so.SetInt(c.Conn, boolint(on)) -} - -// JoinGroup joins the group address group on the interface ifi. -// By default all sources that can cast data to group are accepted. -// It's possible to mute and unmute data transmission from a specific -// source by using ExcludeSourceSpecificGroup and -// IncludeSourceSpecificGroup. -// JoinGroup uses the system assigned multicast interface when ifi is -// nil, although this is not recommended because the assignment -// depends on platforms and sometimes it might require routing -// configuration. -func (c *dgramOpt) JoinGroup(ifi *net.Interface, group net.Addr) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoJoinGroup] - if !ok { - return errNotImplemented - } - grp := netAddrToIP4(group) - if grp == nil { - return errMissingAddress - } - return so.setGroup(c.Conn, ifi, grp) -} - -// LeaveGroup leaves the group address group on the interface ifi -// regardless of whether the group is any-source group or -// source-specific group. -func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoLeaveGroup] - if !ok { - return errNotImplemented - } - grp := netAddrToIP4(group) - if grp == nil { - return errMissingAddress - } - return so.setGroup(c.Conn, ifi, grp) -} - -// JoinSourceSpecificGroup joins the source-specific group comprising -// group and source on the interface ifi. -// JoinSourceSpecificGroup uses the system assigned multicast -// interface when ifi is nil, although this is not recommended because -// the assignment depends on platforms and sometimes it might require -// routing configuration. -func (c *dgramOpt) JoinSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoJoinSourceGroup] - if !ok { - return errNotImplemented - } - grp := netAddrToIP4(group) - if grp == nil { - return errMissingAddress - } - src := netAddrToIP4(source) - if src == nil { - return errMissingAddress - } - return so.setSourceGroup(c.Conn, ifi, grp, src) -} - -// LeaveSourceSpecificGroup leaves the source-specific group on the -// interface ifi. -func (c *dgramOpt) LeaveSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoLeaveSourceGroup] - if !ok { - return errNotImplemented - } - grp := netAddrToIP4(group) - if grp == nil { - return errMissingAddress - } - src := netAddrToIP4(source) - if src == nil { - return errMissingAddress - } - return so.setSourceGroup(c.Conn, ifi, grp, src) -} - -// ExcludeSourceSpecificGroup excludes the source-specific group from -// the already joined any-source groups by JoinGroup on the interface -// ifi. -func (c *dgramOpt) ExcludeSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoBlockSourceGroup] - if !ok { - return errNotImplemented - } - grp := netAddrToIP4(group) - if grp == nil { - return errMissingAddress - } - src := netAddrToIP4(source) - if src == nil { - return errMissingAddress - } - return so.setSourceGroup(c.Conn, ifi, grp, src) -} - -// IncludeSourceSpecificGroup includes the excluded source-specific -// group by ExcludeSourceSpecificGroup again on the interface ifi. -func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoUnblockSourceGroup] - if !ok { - return errNotImplemented - } - grp := netAddrToIP4(group) - if grp == nil { - return errMissingAddress - } - src := netAddrToIP4(source) - if src == nil { - return errMissingAddress - } - return so.setSourceGroup(c.Conn, ifi, grp, src) -} - -// ICMPFilter returns an ICMP filter. -// Currently only Linux supports this. -func (c *dgramOpt) ICMPFilter() (*ICMPFilter, error) { - if !c.ok() { - return nil, errInvalidConn - } - so, ok := sockOpts[ssoICMPFilter] - if !ok { - return nil, errNotImplemented - } - return so.getICMPFilter(c.Conn) -} - -// SetICMPFilter deploys the ICMP filter. -// Currently only Linux supports this. -func (c *dgramOpt) SetICMPFilter(f *ICMPFilter) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoICMPFilter] - if !ok { - return errNotImplemented - } - return so.setICMPFilter(c.Conn, f) -} - -// SetBPF attaches a BPF program to the connection. -// -// Only supported on Linux. -func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoAttachFilter] - if !ok { - return errNotImplemented - } - return so.setBPF(c.Conn, filter) -} diff --git a/vendor/golang.org/x/net/ipv4/doc.go b/vendor/golang.org/x/net/ipv4/doc.go deleted file mode 100644 index 245834979..000000000 --- a/vendor/golang.org/x/net/ipv4/doc.go +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ipv4 implements IP-level socket options for the Internet -// Protocol version 4. -// -// The package provides IP-level socket options that allow -// manipulation of IPv4 facilities. -// -// The IPv4 protocol and basic host requirements for IPv4 are defined -// in RFC 791 and RFC 1122. -// Host extensions for multicasting and socket interface extensions -// for multicast source filters are defined in RFC 1112 and RFC 3678. -// IGMPv1, IGMPv2 and IGMPv3 are defined in RFC 1112, RFC 2236 and RFC -// 3376. -// Source-specific multicast is defined in RFC 4607. -// -// -// Unicasting -// -// The options for unicasting are available for net.TCPConn, -// net.UDPConn and net.IPConn which are created as network connections -// that use the IPv4 transport. When a single TCP connection carrying -// a data flow of multiple packets needs to indicate the flow is -// important, Conn is used to set the type-of-service field on the -// IPv4 header for each packet. -// -// ln, err := net.Listen("tcp4", "0.0.0.0:1024") -// if err != nil { -// // error handling -// } -// defer ln.Close() -// for { -// c, err := ln.Accept() -// if err != nil { -// // error handling -// } -// go func(c net.Conn) { -// defer c.Close() -// -// The outgoing packets will be labeled DiffServ assured forwarding -// class 1 low drop precedence, known as AF11 packets. -// -// if err := ipv4.NewConn(c).SetTOS(0x28); err != nil { -// // error handling -// } -// if _, err := c.Write(data); err != nil { -// // error handling -// } -// }(c) -// } -// -// -// Multicasting -// -// The options for multicasting are available for net.UDPConn and -// net.IPConn which are created as network connections that use the -// IPv4 transport. A few network facilities must be prepared before -// you begin multicasting, at a minimum joining network interfaces and -// multicast groups. -// -// en0, err := net.InterfaceByName("en0") -// if err != nil { -// // error handling -// } -// en1, err := net.InterfaceByIndex(911) -// if err != nil { -// // error handling -// } -// group := net.IPv4(224, 0, 0, 250) -// -// First, an application listens to an appropriate address with an -// appropriate service port. -// -// c, err := net.ListenPacket("udp4", "0.0.0.0:1024") -// if err != nil { -// // error handling -// } -// defer c.Close() -// -// Second, the application joins multicast groups, starts listening to -// the groups on the specified network interfaces. Note that the -// service port for transport layer protocol does not matter with this -// operation as joining groups affects only network and link layer -// protocols, such as IPv4 and Ethernet. -// -// p := ipv4.NewPacketConn(c) -// if err := p.JoinGroup(en0, &net.UDPAddr{IP: group}); err != nil { -// // error handling -// } -// if err := p.JoinGroup(en1, &net.UDPAddr{IP: group}); err != nil { -// // error handling -// } -// -// The application might set per packet control message transmissions -// between the protocol stack within the kernel. When the application -// needs a destination address on an incoming packet, -// SetControlMessage of PacketConn is used to enable control message -// transmissions. -// -// if err := p.SetControlMessage(ipv4.FlagDst, true); err != nil { -// // error handling -// } -// -// The application could identify whether the received packets are -// of interest by using the control message that contains the -// destination address of the received packet. -// -// b := make([]byte, 1500) -// for { -// n, cm, src, err := p.ReadFrom(b) -// if err != nil { -// // error handling -// } -// if cm.Dst.IsMulticast() { -// if cm.Dst.Equal(group) { -// // joined group, do something -// } else { -// // unknown group, discard -// continue -// } -// } -// -// The application can also send both unicast and multicast packets. -// -// p.SetTOS(0x0) -// p.SetTTL(16) -// if _, err := p.WriteTo(data, nil, src); err != nil { -// // error handling -// } -// dst := &net.UDPAddr{IP: group, Port: 1024} -// for _, ifi := range []*net.Interface{en0, en1} { -// if err := p.SetMulticastInterface(ifi); err != nil { -// // error handling -// } -// p.SetMulticastTTL(2) -// if _, err := p.WriteTo(data, nil, dst); err != nil { -// // error handling -// } -// } -// } -// -// -// More multicasting -// -// An application that uses PacketConn or RawConn may join multiple -// multicast groups. For example, a UDP listener with port 1024 might -// join two different groups across over two different network -// interfaces by using: -// -// c, err := net.ListenPacket("udp4", "0.0.0.0:1024") -// if err != nil { -// // error handling -// } -// defer c.Close() -// p := ipv4.NewPacketConn(c) -// if err := p.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil { -// // error handling -// } -// if err := p.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 249)}); err != nil { -// // error handling -// } -// if err := p.JoinGroup(en1, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 249)}); err != nil { -// // error handling -// } -// -// It is possible for multiple UDP listeners that listen on the same -// UDP port to join the same multicast group. The net package will -// provide a socket that listens to a wildcard address with reusable -// UDP port when an appropriate multicast address prefix is passed to -// the net.ListenPacket or net.ListenUDP. -// -// c1, err := net.ListenPacket("udp4", "224.0.0.0:1024") -// if err != nil { -// // error handling -// } -// defer c1.Close() -// c2, err := net.ListenPacket("udp4", "224.0.0.0:1024") -// if err != nil { -// // error handling -// } -// defer c2.Close() -// p1 := ipv4.NewPacketConn(c1) -// if err := p1.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil { -// // error handling -// } -// p2 := ipv4.NewPacketConn(c2) -// if err := p2.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil { -// // error handling -// } -// -// Also it is possible for the application to leave or rejoin a -// multicast group on the network interface. -// -// if err := p.LeaveGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil { -// // error handling -// } -// if err := p.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 250)}); err != nil { -// // error handling -// } -// -// -// Source-specific multicasting -// -// An application that uses PacketConn or RawConn on IGMPv3 supported -// platform is able to join source-specific multicast groups. -// The application may use JoinSourceSpecificGroup and -// LeaveSourceSpecificGroup for the operation known as "include" mode, -// -// ssmgroup := net.UDPAddr{IP: net.IPv4(232, 7, 8, 9)} -// ssmsource := net.UDPAddr{IP: net.IPv4(192, 168, 0, 1)} -// if err := p.JoinSourceSpecificGroup(en0, &ssmgroup, &ssmsource); err != nil { -// // error handling -// } -// if err := p.LeaveSourceSpecificGroup(en0, &ssmgroup, &ssmsource); err != nil { -// // error handling -// } -// -// or JoinGroup, ExcludeSourceSpecificGroup, -// IncludeSourceSpecificGroup and LeaveGroup for the operation known -// as "exclude" mode. -// -// exclsource := net.UDPAddr{IP: net.IPv4(192, 168, 0, 254)} -// if err := p.JoinGroup(en0, &ssmgroup); err != nil { -// // error handling -// } -// if err := p.ExcludeSourceSpecificGroup(en0, &ssmgroup, &exclsource); err != nil { -// // error handling -// } -// if err := p.LeaveGroup(en0, &ssmgroup); err != nil { -// // error handling -// } -// -// Note that it depends on each platform implementation what happens -// when an application which runs on IGMPv3 unsupported platform uses -// JoinSourceSpecificGroup and LeaveSourceSpecificGroup. -// In general the platform tries to fall back to conversations using -// IGMPv1 or IGMPv2 and starts to listen to multicast traffic. -// In the fallback case, ExcludeSourceSpecificGroup and -// IncludeSourceSpecificGroup may return an error. -package ipv4 // import "golang.org/x/net/ipv4" - -// BUG(mikio): This package is not implemented on JS, NaCl and Plan 9. diff --git a/vendor/golang.org/x/net/ipv4/endpoint.go b/vendor/golang.org/x/net/ipv4/endpoint.go deleted file mode 100644 index 4a6d7a85e..000000000 --- a/vendor/golang.org/x/net/ipv4/endpoint.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "time" - - "golang.org/x/net/internal/socket" -) - -// BUG(mikio): On Windows, the JoinSourceSpecificGroup, -// LeaveSourceSpecificGroup, ExcludeSourceSpecificGroup and -// IncludeSourceSpecificGroup methods of PacketConn and RawConn are -// not implemented. - -// A Conn represents a network endpoint that uses the IPv4 transport. -// It is used to control basic IP-level socket options such as TOS and -// TTL. -type Conn struct { - genericOpt -} - -type genericOpt struct { - *socket.Conn -} - -func (c *genericOpt) ok() bool { return c != nil && c.Conn != nil } - -// NewConn returns a new Conn. -func NewConn(c net.Conn) *Conn { - cc, _ := socket.NewConn(c) - return &Conn{ - genericOpt: genericOpt{Conn: cc}, - } -} - -// A PacketConn represents a packet network endpoint that uses the -// IPv4 transport. It is used to control several IP-level socket -// options including multicasting. It also provides datagram based -// network I/O methods specific to the IPv4 and higher layer protocols -// such as UDP. -type PacketConn struct { - genericOpt - dgramOpt - payloadHandler -} - -type dgramOpt struct { - *socket.Conn -} - -func (c *dgramOpt) ok() bool { return c != nil && c.Conn != nil } - -// SetControlMessage sets the per packet IP-level socket options. -func (c *PacketConn) SetControlMessage(cf ControlFlags, on bool) error { - if !c.payloadHandler.ok() { - return errInvalidConn - } - return setControlMessage(c.dgramOpt.Conn, &c.payloadHandler.rawOpt, cf, on) -} - -// SetDeadline sets the read and write deadlines associated with the -// endpoint. -func (c *PacketConn) SetDeadline(t time.Time) error { - if !c.payloadHandler.ok() { - return errInvalidConn - } - return c.payloadHandler.PacketConn.SetDeadline(t) -} - -// SetReadDeadline sets the read deadline associated with the -// endpoint. -func (c *PacketConn) SetReadDeadline(t time.Time) error { - if !c.payloadHandler.ok() { - return errInvalidConn - } - return c.payloadHandler.PacketConn.SetReadDeadline(t) -} - -// SetWriteDeadline sets the write deadline associated with the -// endpoint. -func (c *PacketConn) SetWriteDeadline(t time.Time) error { - if !c.payloadHandler.ok() { - return errInvalidConn - } - return c.payloadHandler.PacketConn.SetWriteDeadline(t) -} - -// Close closes the endpoint. -func (c *PacketConn) Close() error { - if !c.payloadHandler.ok() { - return errInvalidConn - } - return c.payloadHandler.PacketConn.Close() -} - -// NewPacketConn returns a new PacketConn using c as its underlying -// transport. -func NewPacketConn(c net.PacketConn) *PacketConn { - cc, _ := socket.NewConn(c.(net.Conn)) - p := &PacketConn{ - genericOpt: genericOpt{Conn: cc}, - dgramOpt: dgramOpt{Conn: cc}, - payloadHandler: payloadHandler{PacketConn: c, Conn: cc}, - } - return p -} - -// A RawConn represents a packet network endpoint that uses the IPv4 -// transport. It is used to control several IP-level socket options -// including IPv4 header manipulation. It also provides datagram -// based network I/O methods specific to the IPv4 and higher layer -// protocols that handle IPv4 datagram directly such as OSPF, GRE. -type RawConn struct { - genericOpt - dgramOpt - packetHandler -} - -// SetControlMessage sets the per packet IP-level socket options. -func (c *RawConn) SetControlMessage(cf ControlFlags, on bool) error { - if !c.packetHandler.ok() { - return errInvalidConn - } - return setControlMessage(c.dgramOpt.Conn, &c.packetHandler.rawOpt, cf, on) -} - -// SetDeadline sets the read and write deadlines associated with the -// endpoint. -func (c *RawConn) SetDeadline(t time.Time) error { - if !c.packetHandler.ok() { - return errInvalidConn - } - return c.packetHandler.IPConn.SetDeadline(t) -} - -// SetReadDeadline sets the read deadline associated with the -// endpoint. -func (c *RawConn) SetReadDeadline(t time.Time) error { - if !c.packetHandler.ok() { - return errInvalidConn - } - return c.packetHandler.IPConn.SetReadDeadline(t) -} - -// SetWriteDeadline sets the write deadline associated with the -// endpoint. -func (c *RawConn) SetWriteDeadline(t time.Time) error { - if !c.packetHandler.ok() { - return errInvalidConn - } - return c.packetHandler.IPConn.SetWriteDeadline(t) -} - -// Close closes the endpoint. -func (c *RawConn) Close() error { - if !c.packetHandler.ok() { - return errInvalidConn - } - return c.packetHandler.IPConn.Close() -} - -// NewRawConn returns a new RawConn using c as its underlying -// transport. -func NewRawConn(c net.PacketConn) (*RawConn, error) { - cc, err := socket.NewConn(c.(net.Conn)) - if err != nil { - return nil, err - } - r := &RawConn{ - genericOpt: genericOpt{Conn: cc}, - dgramOpt: dgramOpt{Conn: cc}, - packetHandler: packetHandler{IPConn: c.(*net.IPConn), Conn: cc}, - } - so, ok := sockOpts[ssoHeaderPrepend] - if !ok { - return nil, errNotImplemented - } - if err := so.SetInt(r.dgramOpt.Conn, boolint(true)); err != nil { - return nil, err - } - return r, nil -} diff --git a/vendor/golang.org/x/net/ipv4/genericopt.go b/vendor/golang.org/x/net/ipv4/genericopt.go deleted file mode 100644 index 51c12371e..000000000 --- a/vendor/golang.org/x/net/ipv4/genericopt.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -// TOS returns the type-of-service field value for outgoing packets. -func (c *genericOpt) TOS() (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - so, ok := sockOpts[ssoTOS] - if !ok { - return 0, errNotImplemented - } - return so.GetInt(c.Conn) -} - -// SetTOS sets the type-of-service field value for future outgoing -// packets. -func (c *genericOpt) SetTOS(tos int) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoTOS] - if !ok { - return errNotImplemented - } - return so.SetInt(c.Conn, tos) -} - -// TTL returns the time-to-live field value for outgoing packets. -func (c *genericOpt) TTL() (int, error) { - if !c.ok() { - return 0, errInvalidConn - } - so, ok := sockOpts[ssoTTL] - if !ok { - return 0, errNotImplemented - } - return so.GetInt(c.Conn) -} - -// SetTTL sets the time-to-live field value for future outgoing -// packets. -func (c *genericOpt) SetTTL(ttl int) error { - if !c.ok() { - return errInvalidConn - } - so, ok := sockOpts[ssoTTL] - if !ok { - return errNotImplemented - } - return so.SetInt(c.Conn, ttl) -} diff --git a/vendor/golang.org/x/net/ipv4/header.go b/vendor/golang.org/x/net/ipv4/header.go deleted file mode 100644 index c271ca46c..000000000 --- a/vendor/golang.org/x/net/ipv4/header.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "encoding/binary" - "fmt" - "net" - "runtime" - - "golang.org/x/net/internal/socket" -) - -const ( - Version = 4 // protocol version - HeaderLen = 20 // header length without extension headers -) - -type HeaderFlags int - -const ( - MoreFragments HeaderFlags = 1 << iota // more fragments flag - DontFragment // don't fragment flag -) - -// A Header represents an IPv4 header. -type Header struct { - Version int // protocol version - Len int // header length - TOS int // type-of-service - TotalLen int // packet total length - ID int // identification - Flags HeaderFlags // flags - FragOff int // fragment offset - TTL int // time-to-live - Protocol int // next protocol - Checksum int // checksum - Src net.IP // source address - Dst net.IP // destination address - Options []byte // options, extension headers -} - -func (h *Header) String() string { - if h == nil { - return "<nil>" - } - return fmt.Sprintf("ver=%d hdrlen=%d tos=%#x totallen=%d id=%#x flags=%#x fragoff=%#x ttl=%d proto=%d cksum=%#x src=%v dst=%v", h.Version, h.Len, h.TOS, h.TotalLen, h.ID, h.Flags, h.FragOff, h.TTL, h.Protocol, h.Checksum, h.Src, h.Dst) -} - -// Marshal returns the binary encoding of h. -// -// The returned slice is in the format used by a raw IP socket on the -// local system. -// This may differ from the wire format, depending on the system. -func (h *Header) Marshal() ([]byte, error) { - if h == nil { - return nil, errNilHeader - } - if h.Len < HeaderLen { - return nil, errHeaderTooShort - } - hdrlen := HeaderLen + len(h.Options) - b := make([]byte, hdrlen) - b[0] = byte(Version<<4 | (hdrlen >> 2 & 0x0f)) - b[1] = byte(h.TOS) - flagsAndFragOff := (h.FragOff & 0x1fff) | int(h.Flags<<13) - switch runtime.GOOS { - case "darwin", "dragonfly", "netbsd": - socket.NativeEndian.PutUint16(b[2:4], uint16(h.TotalLen)) - socket.NativeEndian.PutUint16(b[6:8], uint16(flagsAndFragOff)) - case "freebsd": - if freebsdVersion < 1100000 { - socket.NativeEndian.PutUint16(b[2:4], uint16(h.TotalLen)) - socket.NativeEndian.PutUint16(b[6:8], uint16(flagsAndFragOff)) - } else { - binary.BigEndian.PutUint16(b[2:4], uint16(h.TotalLen)) - binary.BigEndian.PutUint16(b[6:8], uint16(flagsAndFragOff)) - } - default: - binary.BigEndian.PutUint16(b[2:4], uint16(h.TotalLen)) - binary.BigEndian.PutUint16(b[6:8], uint16(flagsAndFragOff)) - } - binary.BigEndian.PutUint16(b[4:6], uint16(h.ID)) - b[8] = byte(h.TTL) - b[9] = byte(h.Protocol) - binary.BigEndian.PutUint16(b[10:12], uint16(h.Checksum)) - if ip := h.Src.To4(); ip != nil { - copy(b[12:16], ip[:net.IPv4len]) - } - if ip := h.Dst.To4(); ip != nil { - copy(b[16:20], ip[:net.IPv4len]) - } else { - return nil, errMissingAddress - } - if len(h.Options) > 0 { - copy(b[HeaderLen:], h.Options) - } - return b, nil -} - -// Parse parses b as an IPv4 header and stores the result in h. -// -// The provided b must be in the format used by a raw IP socket on the -// local system. -// This may differ from the wire format, depending on the system. -func (h *Header) Parse(b []byte) error { - if h == nil || b == nil { - return errNilHeader - } - if len(b) < HeaderLen { - return errHeaderTooShort - } - hdrlen := int(b[0]&0x0f) << 2 - if len(b) < hdrlen { - return errExtHeaderTooShort - } - h.Version = int(b[0] >> 4) - h.Len = hdrlen - h.TOS = int(b[1]) - h.ID = int(binary.BigEndian.Uint16(b[4:6])) - h.TTL = int(b[8]) - h.Protocol = int(b[9]) - h.Checksum = int(binary.BigEndian.Uint16(b[10:12])) - h.Src = net.IPv4(b[12], b[13], b[14], b[15]) - h.Dst = net.IPv4(b[16], b[17], b[18], b[19]) - switch runtime.GOOS { - case "darwin", "dragonfly", "netbsd": - h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4])) + hdrlen - h.FragOff = int(socket.NativeEndian.Uint16(b[6:8])) - case "freebsd": - if freebsdVersion < 1100000 { - h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4])) - if freebsdVersion < 1000000 { - h.TotalLen += hdrlen - } - h.FragOff = int(socket.NativeEndian.Uint16(b[6:8])) - } else { - h.TotalLen = int(binary.BigEndian.Uint16(b[2:4])) - h.FragOff = int(binary.BigEndian.Uint16(b[6:8])) - } - default: - h.TotalLen = int(binary.BigEndian.Uint16(b[2:4])) - h.FragOff = int(binary.BigEndian.Uint16(b[6:8])) - } - h.Flags = HeaderFlags(h.FragOff&0xe000) >> 13 - h.FragOff = h.FragOff & 0x1fff - optlen := hdrlen - HeaderLen - if optlen > 0 && len(b) >= hdrlen { - if cap(h.Options) < optlen { - h.Options = make([]byte, optlen) - } else { - h.Options = h.Options[:optlen] - } - copy(h.Options, b[HeaderLen:hdrlen]) - } - return nil -} - -// ParseHeader parses b as an IPv4 header. -// -// The provided b must be in the format used by a raw IP socket on the -// local system. -// This may differ from the wire format, depending on the system. -func ParseHeader(b []byte) (*Header, error) { - h := new(Header) - if err := h.Parse(b); err != nil { - return nil, err - } - return h, nil -} diff --git a/vendor/golang.org/x/net/ipv4/helper.go b/vendor/golang.org/x/net/ipv4/helper.go deleted file mode 100644 index e845a7376..000000000 --- a/vendor/golang.org/x/net/ipv4/helper.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "errors" - "net" - "runtime" - - "golang.org/x/net/internal/socket" -) - -var ( - errInvalidConn = errors.New("invalid connection") - errMissingAddress = errors.New("missing address") - errNilHeader = errors.New("nil header") - errHeaderTooShort = errors.New("header too short") - errExtHeaderTooShort = errors.New("extension header too short") - errInvalidConnType = errors.New("invalid conn type") - errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH) - - // See https://www.freebsd.org/doc/en/books/porters-handbook/versions.html. - freebsdVersion uint32 - compatFreeBSD32 bool // 386 emulation on amd64 -) - -// See golang.org/issue/30899. -func adjustFreeBSD32(m *socket.Message) { - // FreeBSD 12.0-RELEASE is affected by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236737 - if 1200086 <= freebsdVersion && freebsdVersion < 1201000 { - l := (m.NN + 4 - 1) &^ (4 - 1) - if m.NN < l && l <= len(m.OOB) { - m.NN = l - } - } -} - -func boolint(b bool) int { - if b { - return 1 - } - return 0 -} - -func netAddrToIP4(a net.Addr) net.IP { - switch v := a.(type) { - case *net.UDPAddr: - if ip := v.IP.To4(); ip != nil { - return ip - } - case *net.IPAddr: - if ip := v.IP.To4(); ip != nil { - return ip - } - } - return nil -} - -func opAddr(a net.Addr) net.Addr { - switch a.(type) { - case *net.TCPAddr: - if a == nil { - return nil - } - case *net.UDPAddr: - if a == nil { - return nil - } - case *net.IPAddr: - if a == nil { - return nil - } - } - return a -} diff --git a/vendor/golang.org/x/net/ipv4/iana.go b/vendor/golang.org/x/net/ipv4/iana.go deleted file mode 100644 index 4375b4099..000000000 --- a/vendor/golang.org/x/net/ipv4/iana.go +++ /dev/null @@ -1,38 +0,0 @@ -// go generate gen.go -// Code generated by the command above; DO NOT EDIT. - -package ipv4 - -// Internet Control Message Protocol (ICMP) Parameters, Updated: 2018-02-26 -const ( - ICMPTypeEchoReply ICMPType = 0 // Echo Reply - ICMPTypeDestinationUnreachable ICMPType = 3 // Destination Unreachable - ICMPTypeRedirect ICMPType = 5 // Redirect - ICMPTypeEcho ICMPType = 8 // Echo - ICMPTypeRouterAdvertisement ICMPType = 9 // Router Advertisement - ICMPTypeRouterSolicitation ICMPType = 10 // Router Solicitation - ICMPTypeTimeExceeded ICMPType = 11 // Time Exceeded - ICMPTypeParameterProblem ICMPType = 12 // Parameter Problem - ICMPTypeTimestamp ICMPType = 13 // Timestamp - ICMPTypeTimestampReply ICMPType = 14 // Timestamp Reply - ICMPTypePhoturis ICMPType = 40 // Photuris - ICMPTypeExtendedEchoRequest ICMPType = 42 // Extended Echo Request - ICMPTypeExtendedEchoReply ICMPType = 43 // Extended Echo Reply -) - -// Internet Control Message Protocol (ICMP) Parameters, Updated: 2018-02-26 -var icmpTypes = map[ICMPType]string{ - 0: "echo reply", - 3: "destination unreachable", - 5: "redirect", - 8: "echo", - 9: "router advertisement", - 10: "router solicitation", - 11: "time exceeded", - 12: "parameter problem", - 13: "timestamp", - 14: "timestamp reply", - 40: "photuris", - 42: "extended echo request", - 43: "extended echo reply", -} diff --git a/vendor/golang.org/x/net/ipv4/icmp.go b/vendor/golang.org/x/net/ipv4/icmp.go deleted file mode 100644 index 9902bb3d2..000000000 --- a/vendor/golang.org/x/net/ipv4/icmp.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import "golang.org/x/net/internal/iana" - -// An ICMPType represents a type of ICMP message. -type ICMPType int - -func (typ ICMPType) String() string { - s, ok := icmpTypes[typ] - if !ok { - return "<nil>" - } - return s -} - -// Protocol returns the ICMPv4 protocol number. -func (typ ICMPType) Protocol() int { - return iana.ProtocolICMP -} - -// An ICMPFilter represents an ICMP message filter for incoming -// packets. The filter belongs to a packet delivery path on a host and -// it cannot interact with forwarding packets or tunnel-outer packets. -// -// Note: RFC 8200 defines a reasonable role model and it works not -// only for IPv6 but IPv4. A node means a device that implements IP. -// A router means a node that forwards IP packets not explicitly -// addressed to itself, and a host means a node that is not a router. -type ICMPFilter struct { - icmpFilter -} - -// Accept accepts incoming ICMP packets including the type field value -// typ. -func (f *ICMPFilter) Accept(typ ICMPType) { - f.accept(typ) -} - -// Block blocks incoming ICMP packets including the type field value -// typ. -func (f *ICMPFilter) Block(typ ICMPType) { - f.block(typ) -} - -// SetAll sets the filter action to the filter. -func (f *ICMPFilter) SetAll(block bool) { - f.setAll(block) -} - -// WillBlock reports whether the ICMP type will be blocked. -func (f *ICMPFilter) WillBlock(typ ICMPType) bool { - return f.willBlock(typ) -} diff --git a/vendor/golang.org/x/net/ipv4/icmp_linux.go b/vendor/golang.org/x/net/ipv4/icmp_linux.go deleted file mode 100644 index 6e1c5c80a..000000000 --- a/vendor/golang.org/x/net/ipv4/icmp_linux.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -func (f *icmpFilter) accept(typ ICMPType) { - f.Data &^= 1 << (uint32(typ) & 31) -} - -func (f *icmpFilter) block(typ ICMPType) { - f.Data |= 1 << (uint32(typ) & 31) -} - -func (f *icmpFilter) setAll(block bool) { - if block { - f.Data = 1<<32 - 1 - } else { - f.Data = 0 - } -} - -func (f *icmpFilter) willBlock(typ ICMPType) bool { - return f.Data&(1<<(uint32(typ)&31)) != 0 -} diff --git a/vendor/golang.org/x/net/ipv4/icmp_stub.go b/vendor/golang.org/x/net/ipv4/icmp_stub.go deleted file mode 100644 index 21bb29ab3..000000000 --- a/vendor/golang.org/x/net/ipv4/icmp_stub.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !linux - -package ipv4 - -const sizeofICMPFilter = 0x0 - -type icmpFilter struct { -} - -func (f *icmpFilter) accept(typ ICMPType) { -} - -func (f *icmpFilter) block(typ ICMPType) { -} - -func (f *icmpFilter) setAll(block bool) { -} - -func (f *icmpFilter) willBlock(typ ICMPType) bool { - return false -} diff --git a/vendor/golang.org/x/net/ipv4/packet.go b/vendor/golang.org/x/net/ipv4/packet.go deleted file mode 100644 index 7d784e06d..000000000 --- a/vendor/golang.org/x/net/ipv4/packet.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - - "golang.org/x/net/internal/socket" -) - -// BUG(mikio): On Windows, the ReadFrom and WriteTo methods of RawConn -// are not implemented. - -// A packetHandler represents the IPv4 datagram handler. -type packetHandler struct { - *net.IPConn - *socket.Conn - rawOpt -} - -func (c *packetHandler) ok() bool { return c != nil && c.IPConn != nil && c.Conn != nil } - -// ReadFrom reads an IPv4 datagram from the endpoint c, copying the -// datagram into b. It returns the received datagram as the IPv4 -// header h, the payload p and the control message cm. -func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) { - if !c.ok() { - return nil, nil, nil, errInvalidConn - } - c.rawOpt.RLock() - m := socket.Message{ - Buffers: [][]byte{b}, - OOB: NewControlMessage(c.rawOpt.cflags), - } - c.rawOpt.RUnlock() - if err := c.RecvMsg(&m, 0); err != nil { - return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - var hs []byte - if hs, p, err = slicePacket(b[:m.N]); err != nil { - return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - if h, err = ParseHeader(hs); err != nil { - return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - if m.NN > 0 { - if compatFreeBSD32 { - adjustFreeBSD32(&m) - } - cm = new(ControlMessage) - if err := cm.Parse(m.OOB[:m.NN]); err != nil { - return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err} - } - } - if src, ok := m.Addr.(*net.IPAddr); ok && cm != nil { - cm.Src = src.IP - } - return -} - -func slicePacket(b []byte) (h, p []byte, err error) { - if len(b) < HeaderLen { - return nil, nil, errHeaderTooShort - } - hdrlen := int(b[0]&0x0f) << 2 - return b[:hdrlen], b[hdrlen:], nil -} - -// WriteTo writes an IPv4 datagram through the endpoint c, copying the -// datagram from the IPv4 header h and the payload p. The control -// message cm allows the datagram path and the outgoing interface to be -// specified. Currently only Darwin and Linux support this. The cm -// may be nil if control of the outgoing datagram is not required. -// -// The IPv4 header h must contain appropriate fields that include: -// -// Version = <must be specified> -// Len = <must be specified> -// TOS = <must be specified> -// TotalLen = <must be specified> -// ID = platform sets an appropriate value if ID is zero -// FragOff = <must be specified> -// TTL = <must be specified> -// Protocol = <must be specified> -// Checksum = platform sets an appropriate value if Checksum is zero -// Src = platform sets an appropriate value if Src is nil -// Dst = <must be specified> -// Options = optional -func (c *packetHandler) WriteTo(h *Header, p []byte, cm *ControlMessage) error { - if !c.ok() { - return errInvalidConn - } - m := socket.Message{ - OOB: cm.Marshal(), - } - wh, err := h.Marshal() - if err != nil { - return err - } - m.Buffers = [][]byte{wh, p} - dst := new(net.IPAddr) - if cm != nil { - if ip := cm.Dst.To4(); ip != nil { - dst.IP = ip - } - } - if dst.IP == nil { - dst.IP = h.Dst - } - m.Addr = dst - if err := c.SendMsg(&m, 0); err != nil { - return &net.OpError{Op: "write", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Addr: opAddr(dst), Err: err} - } - return nil -} diff --git a/vendor/golang.org/x/net/ipv4/payload.go b/vendor/golang.org/x/net/ipv4/payload.go deleted file mode 100644 index f95f811ac..000000000 --- a/vendor/golang.org/x/net/ipv4/payload.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - - "golang.org/x/net/internal/socket" -) - -// BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo -// methods of PacketConn is not implemented. - -// A payloadHandler represents the IPv4 datagram payload handler. -type payloadHandler struct { - net.PacketConn - *socket.Conn - rawOpt -} - -func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil } diff --git a/vendor/golang.org/x/net/ipv4/payload_cmsg.go b/vendor/golang.org/x/net/ipv4/payload_cmsg.go deleted file mode 100644 index e7614661d..000000000 --- a/vendor/golang.org/x/net/ipv4/payload_cmsg.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris - -package ipv4 - -import ( - "net" - - "golang.org/x/net/internal/socket" -) - -// ReadFrom reads a payload of the received IPv4 datagram, from the -// endpoint c, copying the payload into b. It returns the number of -// bytes copied into b, the control message cm and the source address -// src of the received datagram. -func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { - if !c.ok() { - return 0, nil, nil, errInvalidConn - } - c.rawOpt.RLock() - m := socket.Message{ - OOB: NewControlMessage(c.rawOpt.cflags), - } - c.rawOpt.RUnlock() - switch c.PacketConn.(type) { - case *net.UDPConn: - m.Buffers = [][]byte{b} - if err := c.RecvMsg(&m, 0); err != nil { - return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - case *net.IPConn: - h := make([]byte, HeaderLen) - m.Buffers = [][]byte{h, b} - if err := c.RecvMsg(&m, 0); err != nil { - return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - hdrlen := int(h[0]&0x0f) << 2 - if hdrlen > len(h) { - d := hdrlen - len(h) - copy(b, b[d:]) - m.N -= d - } else { - m.N -= hdrlen - } - default: - return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: errInvalidConnType} - } - if m.NN > 0 { - if compatFreeBSD32 { - adjustFreeBSD32(&m) - } - cm = new(ControlMessage) - if err := cm.Parse(m.OOB[:m.NN]); err != nil { - return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err} - } - cm.Src = netAddrToIP4(m.Addr) - } - return m.N, cm, m.Addr, nil -} - -// WriteTo writes a payload of the IPv4 datagram, to the destination -// address dst through the endpoint c, copying the payload from b. It -// returns the number of bytes written. The control message cm allows -// the datagram path and the outgoing interface to be specified. -// Currently only Darwin and Linux support this. The cm may be nil if -// control of the outgoing datagram is not required. -func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { - if !c.ok() { - return 0, errInvalidConn - } - m := socket.Message{ - Buffers: [][]byte{b}, - OOB: cm.Marshal(), - Addr: dst, - } - err = c.SendMsg(&m, 0) - if err != nil { - err = &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Addr: opAddr(dst), Err: err} - } - return m.N, err -} diff --git a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go deleted file mode 100644 index 1116256f2..000000000 --- a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris - -package ipv4 - -import "net" - -// ReadFrom reads a payload of the received IPv4 datagram, from the -// endpoint c, copying the payload into b. It returns the number of -// bytes copied into b, the control message cm and the source address -// src of the received datagram. -func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { - if !c.ok() { - return 0, nil, nil, errInvalidConn - } - if n, src, err = c.PacketConn.ReadFrom(b); err != nil { - return 0, nil, nil, err - } - return -} - -// WriteTo writes a payload of the IPv4 datagram, to the destination -// address dst through the endpoint c, copying the payload from b. It -// returns the number of bytes written. The control message cm allows -// the datagram path and the outgoing interface to be specified. -// Currently only Darwin and Linux support this. The cm may be nil if -// control of the outgoing datagram is not required. -func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { - if !c.ok() { - return 0, errInvalidConn - } - if dst == nil { - return 0, errMissingAddress - } - return c.PacketConn.WriteTo(b, dst) -} diff --git a/vendor/golang.org/x/net/ipv4/sockopt.go b/vendor/golang.org/x/net/ipv4/sockopt.go deleted file mode 100644 index 22e90c039..000000000 --- a/vendor/golang.org/x/net/ipv4/sockopt.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import "golang.org/x/net/internal/socket" - -// Sticky socket options -const ( - ssoTOS = iota // header field for unicast packet - ssoTTL // header field for unicast packet - ssoMulticastTTL // header field for multicast packet - ssoMulticastInterface // outbound interface for multicast packet - ssoMulticastLoopback // loopback for multicast packet - ssoReceiveTTL // header field on received packet - ssoReceiveDst // header field on received packet - ssoReceiveInterface // inbound interface on received packet - ssoPacketInfo // incbound or outbound packet path - ssoHeaderPrepend // ipv4 header prepend - ssoStripHeader // strip ipv4 header - ssoICMPFilter // icmp filter - ssoJoinGroup // any-source multicast - ssoLeaveGroup // any-source multicast - ssoJoinSourceGroup // source-specific multicast - ssoLeaveSourceGroup // source-specific multicast - ssoBlockSourceGroup // any-source or source-specific multicast - ssoUnblockSourceGroup // any-source or source-specific multicast - ssoAttachFilter // attach BPF for filtering inbound traffic -) - -// Sticky socket option value types -const ( - ssoTypeIPMreq = iota + 1 - ssoTypeIPMreqn - ssoTypeGroupReq - ssoTypeGroupSourceReq -) - -// A sockOpt represents a binding for sticky socket option. -type sockOpt struct { - socket.Option - typ int // hint for option value type; optional -} diff --git a/vendor/golang.org/x/net/ipv4/sockopt_posix.go b/vendor/golang.org/x/net/ipv4/sockopt_posix.go deleted file mode 100644 index dea64519d..000000000 --- a/vendor/golang.org/x/net/ipv4/sockopt_posix.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows - -package ipv4 - -import ( - "net" - "unsafe" - - "golang.org/x/net/bpf" - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { - switch so.typ { - case ssoTypeIPMreqn: - return so.getIPMreqn(c) - default: - return so.getMulticastIf(c) - } -} - -func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { - switch so.typ { - case ssoTypeIPMreqn: - return so.setIPMreqn(c, ifi, nil) - default: - return so.setMulticastIf(c, ifi) - } -} - -func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { - b := make([]byte, so.Len) - n, err := so.Get(c, b) - if err != nil { - return nil, err - } - if n != sizeofICMPFilter { - return nil, errNotImplemented - } - return (*ICMPFilter)(unsafe.Pointer(&b[0])), nil -} - -func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { - b := (*[sizeofICMPFilter]byte)(unsafe.Pointer(f))[:sizeofICMPFilter] - return so.Set(c, b) -} - -func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - switch so.typ { - case ssoTypeIPMreq: - return so.setIPMreq(c, ifi, grp) - case ssoTypeIPMreqn: - return so.setIPMreqn(c, ifi, grp) - case ssoTypeGroupReq: - return so.setGroupReq(c, ifi, grp) - default: - return errNotImplemented - } -} - -func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { - return so.setGroupSourceReq(c, ifi, grp, src) -} - -func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { - return so.setAttachFilter(c, f) -} diff --git a/vendor/golang.org/x/net/ipv4/sockopt_stub.go b/vendor/golang.org/x/net/ipv4/sockopt_stub.go deleted file mode 100644 index 37d4806b3..000000000 --- a/vendor/golang.org/x/net/ipv4/sockopt_stub.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows - -package ipv4 - -import ( - "net" - - "golang.org/x/net/bpf" - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { - return nil, errNotImplemented -} - -func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { - return errNotImplemented -} - -func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { - return nil, errNotImplemented -} - -func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { - return errNotImplemented -} - -func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - return errNotImplemented -} - -func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { - return errNotImplemented -} - -func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/sys_aix.go b/vendor/golang.org/x/net/ipv4/sys_aix.go deleted file mode 100644 index 3d1201e6d..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_aix.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2019 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. - -// Added for go1.11 compatibility -// +build aix - -package ipv4 - -import ( - "net" - "syscall" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, - } - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - } -) diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreq.go b/vendor/golang.org/x/net/ipv4/sys_asmreq.go deleted file mode 100644 index 76d670aca..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_asmreq.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix darwin dragonfly freebsd netbsd openbsd solaris windows - -package ipv4 - -import ( - "errors" - "net" - "unsafe" - - "golang.org/x/net/internal/socket" -) - -var errNoSuchInterface = errors.New("no such interface") - -func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - mreq := ipMreq{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}} - if err := setIPMreqInterface(&mreq, ifi); err != nil { - return err - } - b := (*[sizeofIPMreq]byte)(unsafe.Pointer(&mreq))[:sizeofIPMreq] - return so.Set(c, b) -} - -func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) { - var b [4]byte - if _, err := so.Get(c, b[:]); err != nil { - return nil, err - } - ifi, err := netIP4ToInterface(net.IPv4(b[0], b[1], b[2], b[3])) - if err != nil { - return nil, err - } - return ifi, nil -} - -func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error { - ip, err := netInterfaceToIP4(ifi) - if err != nil { - return err - } - var b [4]byte - copy(b[:], ip) - return so.Set(c, b[:]) -} - -func setIPMreqInterface(mreq *ipMreq, ifi *net.Interface) error { - if ifi == nil { - return nil - } - ifat, err := ifi.Addrs() - if err != nil { - return err - } - for _, ifa := range ifat { - switch ifa := ifa.(type) { - case *net.IPAddr: - if ip := ifa.IP.To4(); ip != nil { - copy(mreq.Interface[:], ip) - return nil - } - case *net.IPNet: - if ip := ifa.IP.To4(); ip != nil { - copy(mreq.Interface[:], ip) - return nil - } - } - } - return errNoSuchInterface -} - -func netIP4ToInterface(ip net.IP) (*net.Interface, error) { - ift, err := net.Interfaces() - if err != nil { - return nil, err - } - for _, ifi := range ift { - ifat, err := ifi.Addrs() - if err != nil { - return nil, err - } - for _, ifa := range ifat { - switch ifa := ifa.(type) { - case *net.IPAddr: - if ip.Equal(ifa.IP) { - return &ifi, nil - } - case *net.IPNet: - if ip.Equal(ifa.IP) { - return &ifi, nil - } - } - } - } - return nil, errNoSuchInterface -} - -func netInterfaceToIP4(ifi *net.Interface) (net.IP, error) { - if ifi == nil { - return net.IPv4zero.To4(), nil - } - ifat, err := ifi.Addrs() - if err != nil { - return nil, err - } - for _, ifa := range ifat { - switch ifa := ifa.(type) { - case *net.IPAddr: - if ip := ifa.IP.To4(); ip != nil { - return ip, nil - } - case *net.IPNet: - if ip := ifa.IP.To4(); ip != nil { - return ip, nil - } - } - } - return nil, errNoSuchInterface -} diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go b/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go deleted file mode 100644 index 6dc339ce6..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows - -package ipv4 - -import ( - "net" - - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - return errNotImplemented -} - -func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) { - return nil, errNotImplemented -} - -func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreqn.go b/vendor/golang.org/x/net/ipv4/sys_asmreqn.go deleted file mode 100644 index 1f24f69f3..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin freebsd linux - -package ipv4 - -import ( - "net" - "unsafe" - - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { - b := make([]byte, so.Len) - if _, err := so.Get(c, b); err != nil { - return nil, err - } - mreqn := (*ipMreqn)(unsafe.Pointer(&b[0])) - if mreqn.Ifindex == 0 { - return nil, nil - } - ifi, err := net.InterfaceByIndex(int(mreqn.Ifindex)) - if err != nil { - return nil, err - } - return ifi, nil -} - -func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - var mreqn ipMreqn - if ifi != nil { - mreqn.Ifindex = int32(ifi.Index) - } - if grp != nil { - mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]} - } - b := (*[sizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:sizeofIPMreqn] - return so.Set(c, b) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go b/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go deleted file mode 100644 index 48ef55624..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !darwin,!freebsd,!linux - -package ipv4 - -import ( - "net" - - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { - return nil, errNotImplemented -} - -func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/sys_bpf.go b/vendor/golang.org/x/net/ipv4/sys_bpf.go deleted file mode 100644 index 5c03dce3b..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_bpf.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux - -package ipv4 - -import ( - "unsafe" - - "golang.org/x/net/bpf" - "golang.org/x/net/internal/socket" - "golang.org/x/sys/unix" -) - -func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { - prog := unix.SockFprog{ - Len: uint16(len(f)), - Filter: (*unix.SockFilter)(unsafe.Pointer(&f[0])), - } - b := (*[unix.SizeofSockFprog]byte)(unsafe.Pointer(&prog))[:unix.SizeofSockFprog] - return so.Set(c, b) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go b/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go deleted file mode 100644 index 5c9864271..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !linux - -package ipv4 - -import ( - "golang.org/x/net/bpf" - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/sys_bsd.go b/vendor/golang.org/x/net/ipv4/sys_bsd.go deleted file mode 100644 index 58256dd9d..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_bsd.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build netbsd openbsd - -package ipv4 - -import ( - "net" - "syscall" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, - } - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - } -) diff --git a/vendor/golang.org/x/net/ipv4/sys_darwin.go b/vendor/golang.org/x/net/ipv4/sys_darwin.go deleted file mode 100644 index ac213c735..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_darwin.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "syscall" - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, - } - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoStripHeader: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_STRIPHDR, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}}, - } -) - -func (pi *inetPktinfo) setIfindex(i int) { - pi.Ifindex = uint32(i) -} - -func (gr *groupReq) setGroup(grp net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gr)) + 4)) - sa.Len = sizeofSockaddrInet - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) -} - -func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 4)) - sa.Len = sizeofSockaddrInet - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) - sa = (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 132)) - sa.Len = sizeofSockaddrInet - sa.Family = syscall.AF_INET - copy(sa.Addr[:], src) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_dragonfly.go b/vendor/golang.org/x/net/ipv4/sys_dragonfly.go deleted file mode 100644 index 859764f33..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_dragonfly.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "syscall" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, - } - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - } -) diff --git a/vendor/golang.org/x/net/ipv4/sys_freebsd.go b/vendor/golang.org/x/net/ipv4/sys_freebsd.go deleted file mode 100644 index 482873d9a..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_freebsd.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "runtime" - "strings" - "syscall" - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, - } - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - } -) - -func init() { - freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate") - if freebsdVersion >= 1000000 { - sockOpts[ssoMulticastInterface] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn} - } - if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" { - archs, _ := syscall.Sysctl("kern.supported_archs") - for _, s := range strings.Fields(archs) { - if s == "amd64" { - compatFreeBSD32 = true - break - } - } - } -} - -func (gr *groupReq) setGroup(grp net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(&gr.Group)) - sa.Len = sizeofSockaddrInet - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) -} - -func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(&gsr.Group)) - sa.Len = sizeofSockaddrInet - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) - sa = (*sockaddrInet)(unsafe.Pointer(&gsr.Source)) - sa.Len = sizeofSockaddrInet - sa.Family = syscall.AF_INET - copy(sa.Addr[:], src) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_linux.go b/vendor/golang.org/x/net/ipv4/sys_linux.go deleted file mode 100644 index cf755c7fb..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_linux.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "syscall" - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" - "golang.org/x/sys/unix" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL}, - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, - } - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_PKTINFO, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolReserved, Name: sysICMP_FILTER, Len: sizeofICMPFilter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoAttachFilter: {Option: socket.Option{Level: unix.SOL_SOCKET, Name: unix.SO_ATTACH_FILTER, Len: unix.SizeofSockFprog}}, - } -) - -func (pi *inetPktinfo) setIfindex(i int) { - pi.Ifindex = int32(i) -} - -func (gr *groupReq) setGroup(grp net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(&gr.Group)) - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) -} - -func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(&gsr.Group)) - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) - sa = (*sockaddrInet)(unsafe.Pointer(&gsr.Source)) - sa.Family = syscall.AF_INET - copy(sa.Addr[:], src) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_solaris.go b/vendor/golang.org/x/net/ipv4/sys_solaris.go deleted file mode 100644 index 832fef1e2..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_solaris.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "net" - "syscall" - "unsafe" - - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -var ( - ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 4, marshalTTL, parseTTL}, - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, - } - - sockOpts = map[int]sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - } -) - -func (pi *inetPktinfo) setIfindex(i int) { - pi.Ifindex = uint32(i) -} - -func (gr *groupReq) setGroup(grp net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gr)) + 4)) - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) -} - -func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { - sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 4)) - sa.Family = syscall.AF_INET - copy(sa.Addr[:], grp) - sa = (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 260)) - sa.Family = syscall.AF_INET - copy(sa.Addr[:], src) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_ssmreq.go b/vendor/golang.org/x/net/ipv4/sys_ssmreq.go deleted file mode 100644 index eeced7f31..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin freebsd linux solaris - -package ipv4 - -import ( - "net" - "unsafe" - - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - var gr groupReq - if ifi != nil { - gr.Interface = uint32(ifi.Index) - } - gr.setGroup(grp) - var b []byte - if compatFreeBSD32 { - var d [sizeofGroupReq + 4]byte - s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) - copy(d[:4], s[:4]) - copy(d[8:], s[4:]) - b = d[:] - } else { - b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq] - } - return so.Set(c, b) -} - -func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { - var gsr groupSourceReq - if ifi != nil { - gsr.Interface = uint32(ifi.Index) - } - gsr.setSourceGroup(grp, src) - var b []byte - if compatFreeBSD32 { - var d [sizeofGroupSourceReq + 4]byte - s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) - copy(d[:4], s[:4]) - copy(d[8:], s[4:]) - b = d[:] - } else { - b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq] - } - return so.Set(c, b) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go b/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go deleted file mode 100644 index c0921674b..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !darwin,!freebsd,!linux,!solaris - -package ipv4 - -import ( - "net" - - "golang.org/x/net/internal/socket" -) - -func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - return errNotImplemented -} - -func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { - return errNotImplemented -} diff --git a/vendor/golang.org/x/net/ipv4/sys_stub.go b/vendor/golang.org/x/net/ipv4/sys_stub.go deleted file mode 100644 index b9c85b334..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_stub.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows - -package ipv4 - -var ( - ctlOpts = [ctlMax]ctlOpt{} - - sockOpts = map[int]*sockOpt{} -) diff --git a/vendor/golang.org/x/net/ipv4/sys_windows.go b/vendor/golang.org/x/net/ipv4/sys_windows.go deleted file mode 100644 index b0913d539..000000000 --- a/vendor/golang.org/x/net/ipv4/sys_windows.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ipv4 - -import ( - "golang.org/x/net/internal/iana" - "golang.org/x/net/internal/socket" -) - -const ( - // See ws2tcpip.h. - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_DONTFRAGMENT = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0xf - sysIP_DROP_SOURCE_MEMBERSHIP = 0x10 - sysIP_PKTINFO = 0x13 - - sizeofInetPktinfo = 0x8 - sizeofIPMreq = 0x8 - sizeofIPMreqSource = 0xc -) - -type inetPktinfo struct { - Addr [4]byte - Ifindex int32 -} - -type ipMreq struct { - Multiaddr [4]byte - Interface [4]byte -} - -type ipMreqSource struct { - Multiaddr [4]byte - Sourceaddr [4]byte - Interface [4]byte -} - -// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms738586(v=vs.85).aspx -var ( - ctlOpts = [ctlMax]ctlOpt{} - - sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - } -) - -func (pi *inetPktinfo) setIfindex(i int) { - pi.Ifindex = int32(i) -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go b/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go deleted file mode 100644 index c741d5c8e..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_aix.go - -// Added for go1.11 compatibility -// +build aix - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x20 - sysIP_RECVTTL = 0x22 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - - sizeofIPMreq = 0x8 -) - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_darwin.go b/vendor/golang.org/x/net/ipv4/zsys_darwin.go deleted file mode 100644 index e05a251ba..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_darwin.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_darwin.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_STRIPHDR = 0x17 - sysIP_RECVTTL = 0x18 - sysIP_BOUND_IF = 0x19 - sysIP_PKTINFO = 0x1a - sysIP_RECVPKTINFO = 0x1a - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_MULTICAST_IFINDEX = 0x42 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 -) - -type sockaddrStorage struct { - Len uint8 - Family uint8 - X__ss_pad1 [6]int8 - X__ss_align int64 - X__ss_pad2 [112]int8 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type inetPktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr [4]byte /* in_addr */ - Sourceaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [128]byte -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [128]byte - Pad_cgo_1 [128]byte -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go b/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go deleted file mode 100644 index 6d65e9fcb..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_dragonfly.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_RECVTTL = 0x41 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - - sizeofIPMreq = 0x8 -) - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go deleted file mode 100644 index 136e2b8f1..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 -) - -type sockaddrStorage struct { - Len uint8 - Family uint8 - X__ss_pad1 [6]int8 - X__ss_align int64 - X__ss_pad2 [112]int8 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr [4]byte /* in_addr */ - Sourceaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type groupReq struct { - Interface uint32 - Group sockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group sockaddrStorage - Source sockaddrStorage -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go deleted file mode 100644 index 4f730f19e..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 -) - -type sockaddrStorage struct { - Len uint8 - Family uint8 - X__ss_pad1 [6]int8 - X__ss_align int64 - X__ss_pad2 [112]int8 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr [4]byte /* in_addr */ - Sourceaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group sockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group sockaddrStorage - Source sockaddrStorage -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go deleted file mode 100644 index 4f730f19e..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 -) - -type sockaddrStorage struct { - Len uint8 - Family uint8 - X__ss_pad1 [6]int8 - X__ss_align int64 - X__ss_pad2 [112]int8 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr [4]byte /* in_addr */ - Sourceaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group sockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group sockaddrStorage - Source sockaddrStorage -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go deleted file mode 100644 index ecebf3272..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_freebsd.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sizeofSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 -) - -type sockaddrStorage struct { - Len uint8 - Family uint8 - X__ss_pad1 [6]uint8 - X__ss_align int64 - X__ss_pad2 [112]uint8 -} - -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr [4]byte /* in_addr */ - Sourceaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type groupReq struct { - Interface uint32 - Group sockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group sockaddrStorage - Source sockaddrStorage -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_386.go b/vendor/golang.org/x/net/ipv4/zsys_linux_386.go deleted file mode 100644 index 1c7fdfa13..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_386.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go b/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go deleted file mode 100644 index 1c7fdfa13..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go deleted file mode 100644 index 1c7fdfa13..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go deleted file mode 100644 index 1c7fdfa13..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go deleted file mode 100644 index 3c5ea5473..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x84 - sizeofGroupSourceReq = 0x104 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]uint8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go deleted file mode 100644 index e626134a8..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -// +build riscv64 - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go b/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go deleted file mode 100644 index a04e78518..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_linux.go - -package ipv4 - -const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - - sizeofKernelSockaddrStorage = 0x80 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - sizeofSockExtendedErr = 0x10 - - sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x88 - sizeofGroupSourceReq = 0x108 - - sizeofICMPFilter = 0x4 -) - -type kernelSockaddrStorage struct { - Family uint16 - X__data [126]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type inetPktinfo struct { - Ifindex int32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type sockExtendedErr struct { - Errno uint32 - Origin uint8 - Type uint8 - Code uint8 - Pad uint8 - Info uint32 - Data uint32 -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - -type ipMreqSource struct { - Multiaddr uint32 - Interface uint32 - Sourceaddr uint32 -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [4]byte - Group kernelSockaddrStorage - Source kernelSockaddrStorage -} - -type icmpFilter struct { - Data uint32 -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_netbsd.go b/vendor/golang.org/x/net/ipv4/zsys_netbsd.go deleted file mode 100644 index 8cfc648ad..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_netbsd.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_netbsd.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_RECVTTL = 0x17 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - - sizeofIPMreq = 0x8 -) - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_openbsd.go b/vendor/golang.org/x/net/ipv4/zsys_openbsd.go deleted file mode 100644 index 37629cb0a..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_openbsd.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_openbsd.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x1e - sysIP_RECVTTL = 0x1f - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - - sizeofIPMreq = 0x8 -) - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} diff --git a/vendor/golang.org/x/net/ipv4/zsys_solaris.go b/vendor/golang.org/x/net/ipv4/zsys_solaris.go deleted file mode 100644 index cb80a308b..000000000 --- a/vendor/golang.org/x/net/ipv4/zsys_solaris.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_solaris.go - -package ipv4 - -const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x9 - sysIP_RECVSLLA = 0xa - sysIP_RECVTTL = 0xb - - sysIP_MULTICAST_IF = 0x10 - sysIP_MULTICAST_TTL = 0x11 - sysIP_MULTICAST_LOOP = 0x12 - sysIP_ADD_MEMBERSHIP = 0x13 - sysIP_DROP_MEMBERSHIP = 0x14 - sysIP_BLOCK_SOURCE = 0x15 - sysIP_UNBLOCK_SOURCE = 0x16 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x17 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x18 - sysIP_NEXTHOP = 0x19 - - sysIP_PKTINFO = 0x1a - sysIP_RECVPKTINFO = 0x1a - sysIP_DONTFRAG = 0x1b - - sysIP_BOUND_IF = 0x41 - sysIP_UNSPEC_SRC = 0x42 - sysIP_BROADCAST_TTL = 0x43 - sysIP_DHCPINIT_IF = 0x45 - - sysIP_REUSEADDR = 0x104 - sysIP_DONTROUTE = 0x105 - sysIP_BROADCAST = 0x106 - - sysMCAST_JOIN_GROUP = 0x29 - sysMCAST_LEAVE_GROUP = 0x2a - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_JOIN_SOURCE_GROUP = 0x2d - sysMCAST_LEAVE_SOURCE_GROUP = 0x2e - - sizeofSockaddrStorage = 0x100 - sizeofSockaddrInet = 0x10 - sizeofInetPktinfo = 0xc - - sizeofIPMreq = 0x8 - sizeofIPMreqSource = 0xc - sizeofGroupReq = 0x104 - sizeofGroupSourceReq = 0x204 -) - -type sockaddrStorage struct { - Family uint16 - X_ss_pad1 [6]int8 - X_ss_align float64 - X_ss_pad2 [240]int8 -} - -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type inetPktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type ipMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type ipMreqSource struct { - Multiaddr [4]byte /* in_addr */ - Sourceaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type groupReq struct { - Interface uint32 - Pad_cgo_0 [256]byte -} - -type groupSourceReq struct { - Interface uint32 - Pad_cgo_0 [256]byte - Pad_cgo_1 [256]byte -} diff --git a/vendor/golang.org/x/net/publicsuffix/list.go b/vendor/golang.org/x/net/publicsuffix/list.go deleted file mode 100644 index 200617ea8..000000000 --- a/vendor/golang.org/x/net/publicsuffix/list.go +++ /dev/null @@ -1,181 +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:generate go run gen.go - -// Package publicsuffix provides a public suffix list based on data from -// https://publicsuffix.org/ -// -// A public suffix is one under which Internet users can directly register -// names. It is related to, but different from, a TLD (top level domain). -// -// "com" is a TLD (top level domain). Top level means it has no dots. -// -// "com" is also a public suffix. Amazon and Google have registered different -// siblings under that domain: "amazon.com" and "google.com". -// -// "au" is another TLD, again because it has no dots. But it's not "amazon.au". -// Instead, it's "amazon.com.au". -// -// "com.au" isn't an actual TLD, because it's not at the top level (it has -// dots). But it is an eTLD (effective TLD), because that's the branching point -// for domain name registrars. -// -// Another name for "an eTLD" is "a public suffix". Often, what's more of -// interest is the eTLD+1, or one more label than the public suffix. For -// example, browsers partition read/write access to HTTP cookies according to -// the eTLD+1. Web pages served from "amazon.com.au" can't read cookies from -// "google.com.au", but web pages served from "maps.google.com" can share -// cookies from "www.google.com", so you don't have to sign into Google Maps -// separately from signing into Google Web Search. Note that all four of those -// domains have 3 labels and 2 dots. The first two domains are each an eTLD+1, -// the last two are not (but share the same eTLD+1: "google.com"). -// -// All of these domains have the same eTLD+1: -// - "www.books.amazon.co.uk" -// - "books.amazon.co.uk" -// - "amazon.co.uk" -// Specifically, the eTLD+1 is "amazon.co.uk", because the eTLD is "co.uk". -// -// There is no closed form algorithm to calculate the eTLD of a domain. -// Instead, the calculation is data driven. This package provides a -// pre-compiled snapshot of Mozilla's PSL (Public Suffix List) data at -// https://publicsuffix.org/ -package publicsuffix // import "golang.org/x/net/publicsuffix" - -// TODO: specify case sensitivity and leading/trailing dot behavior for -// func PublicSuffix and func EffectiveTLDPlusOne. - -import ( - "fmt" - "net/http/cookiejar" - "strings" -) - -// List implements the cookiejar.PublicSuffixList interface by calling the -// PublicSuffix function. -var List cookiejar.PublicSuffixList = list{} - -type list struct{} - -func (list) PublicSuffix(domain string) string { - ps, _ := PublicSuffix(domain) - return ps -} - -func (list) String() string { - return version -} - -// PublicSuffix returns the public suffix of the domain using a copy of the -// publicsuffix.org database compiled into the library. -// -// icann is whether the public suffix is managed by the Internet Corporation -// for Assigned Names and Numbers. If not, the public suffix is either a -// privately managed domain (and in practice, not a top level domain) or an -// unmanaged top level domain (and not explicitly mentioned in the -// publicsuffix.org list). For example, "foo.org" and "foo.co.uk" are ICANN -// domains, "foo.dyndns.org" and "foo.blogspot.co.uk" are private domains and -// "cromulent" is an unmanaged top level domain. -// -// Use cases for distinguishing ICANN domains like "foo.com" from private -// domains like "foo.appspot.com" can be found at -// https://wiki.mozilla.org/Public_Suffix_List/Use_Cases -func PublicSuffix(domain string) (publicSuffix string, icann bool) { - lo, hi := uint32(0), uint32(numTLD) - s, suffix, icannNode, wildcard := domain, len(domain), false, false -loop: - for { - dot := strings.LastIndex(s, ".") - if wildcard { - icann = icannNode - suffix = 1 + dot - } - if lo == hi { - break - } - f := find(s[1+dot:], lo, hi) - if f == notFound { - break - } - - u := nodes[f] >> (nodesBitsTextOffset + nodesBitsTextLength) - icannNode = u&(1<<nodesBitsICANN-1) != 0 - u >>= nodesBitsICANN - u = children[u&(1<<nodesBitsChildren-1)] - lo = u & (1<<childrenBitsLo - 1) - u >>= childrenBitsLo - hi = u & (1<<childrenBitsHi - 1) - u >>= childrenBitsHi - switch u & (1<<childrenBitsNodeType - 1) { - case nodeTypeNormal: - suffix = 1 + dot - case nodeTypeException: - suffix = 1 + len(s) - break loop - } - u >>= childrenBitsNodeType - wildcard = u&(1<<childrenBitsWildcard-1) != 0 - if !wildcard { - icann = icannNode - } - - if dot == -1 { - break - } - s = s[:dot] - } - if suffix == len(domain) { - // If no rules match, the prevailing rule is "*". - return domain[1+strings.LastIndex(domain, "."):], icann - } - return domain[suffix:], icann -} - -const notFound uint32 = 1<<32 - 1 - -// find returns the index of the node in the range [lo, hi) whose label equals -// label, or notFound if there is no such node. The range is assumed to be in -// strictly increasing node label order. -func find(label string, lo, hi uint32) uint32 { - for lo < hi { - mid := lo + (hi-lo)/2 - s := nodeLabel(mid) - if s < label { - lo = mid + 1 - } else if s == label { - return mid - } else { - hi = mid - } - } - return notFound -} - -// nodeLabel returns the label for the i'th node. -func nodeLabel(i uint32) string { - x := nodes[i] - length := x & (1<<nodesBitsTextLength - 1) - x >>= nodesBitsTextLength - offset := x & (1<<nodesBitsTextOffset - 1) - return text[offset : offset+length] -} - -// EffectiveTLDPlusOne returns the effective top level domain plus one more -// label. For example, the eTLD+1 for "foo.bar.golang.org" is "golang.org". -func EffectiveTLDPlusOne(domain string) (string, error) { - if strings.HasPrefix(domain, ".") || strings.HasSuffix(domain, ".") || strings.Contains(domain, "..") { - return "", fmt.Errorf("publicsuffix: empty label in domain %q", domain) - } - - suffix, _ := PublicSuffix(domain) - if len(domain) <= len(suffix) { - return "", fmt.Errorf("publicsuffix: cannot derive eTLD+1 for domain %q", domain) - } - i := len(domain) - len(suffix) - 1 - if domain[i] != '.' { - return "", fmt.Errorf("publicsuffix: invalid public suffix %q for domain %q", suffix, domain) - } - return domain[1+strings.LastIndex(domain[:i], "."):], nil -} diff --git a/vendor/golang.org/x/net/publicsuffix/table.go b/vendor/golang.org/x/net/publicsuffix/table.go deleted file mode 100644 index 8e1c9d3dd..000000000 --- a/vendor/golang.org/x/net/publicsuffix/table.go +++ /dev/null @@ -1,10150 +0,0 @@ -// generated by go run gen.go; DO NOT EDIT - -package publicsuffix - -const version = "publicsuffix.org's public_suffix_list.dat, git revision dbe9da0a8abeab1b6257c57668d1ecb584189951 (2020-05-27T00:50:31Z)" - -const ( - nodesBitsChildren = 10 - nodesBitsICANN = 1 - nodesBitsTextOffset = 15 - nodesBitsTextLength = 6 - - childrenBitsWildcard = 1 - childrenBitsNodeType = 2 - childrenBitsHi = 14 - childrenBitsLo = 14 -) - -const ( - nodeTypeNormal = 0 - nodeTypeException = 1 - nodeTypeParentOnly = 2 -) - -// numTLD is the number of top level domains. -const numTLD = 1525 - -// Text is the combined text of all labels. -const text = "9guacuiababia-goracleaningroks-theatree12hpalermomahachijoinvill" + - "eksvikaracoldwarszawabogadobeaemcloud66bjarkoyusuharabjerkreimdb" + - "altimore-og-romsdalipayokozebizenakanotoddenavuotnarashinobninsk" + - "aragandaustevoll-o-g-i-naval-d-aosta-valleyboltateshinanomachimk" + - "entateyamagrocerybnikeisenbahn4tatarantours3-ap-northeast-2ix443" + - "2-balsan-suedtirolkuszczytnoipirangamvik12bjugnieznord-frontierb" + - "lackfridayusuisservehumourbloombergbauernishiazaindielddanuorrin" + - "digenamsosnowiechernihivgubs3-website-sa-east-1bloxcms3-website-" + - "us-east-1bluedaemoneyuu2-localhostoregontrailroadrayddnsfreebox-" + - "osascoli-picenordre-landraydns3-website-us-west-1bmoattachments3" + - "-website-us-west-2bms5yuzawabmwedeploybnrwegroweibolognagasakind" + - "eroybomloabathsbchernivtsiciliabondrivefsnillfjordrobaknoluoktac" + - "hikawakuyabukievennodesadoes-itvedestrandrudupontariobranconakan" + - "iikawatanagurabonnishigoddabookinghostfoldnavyboomlair-traffic-c" + - "ontrolleyboschaefflerdalivornohtawaramotoineppueblockbustermezja" + - "mpagefrontapparachutinglobalashovhachinohedmarkarpaczeladzlglobo" + - "avistanbulsan-sudtirolombardynaliaskimitsubatamibugattiffanycher" + - "novtsymantechnologybostikaruizawabostonakijinsekikogentappsselfi" + - "paraglidinglogoweirbotanicalgardenishiharabotanicgardenishiizuna" + - "zukindustriabotanynysagaeroclubmedecincinnationwidealerbouncemer" + - "ckmsdnipropetrovskjervoyageometre-experts-comptablesakyotanabell" + - "unord-aurdalpha-myqnapcloudaccesscambridgeiseiyoichippubetsubets" + - "ugarugbydgoszczecinemagentositecnologiabounty-fullensakerryprope" + - "rtiesalangenishikatakinoueboutiquebechirurgiens-dentistes-en-fra" + - "ncebozen-sudtirolomzaporizhzhegurindustriesteamfamberkeleybozen-" + - "suedtirolondrinapleskarumaifarmsteadurbanamexhibitionishikatsura" + - "git-reposalondonetskasaokamiminersaltdalorenskogloppenzaolbia-te" + - "mpio-olbiatempioolbialystokkepnogatagajobojinfinitintelligencebp" + - "lacedogawarabikomaezakirunorddalotenkawabrandywinevalleybrasilia" + - "brindisibenikindlebtimnetzparisor-fronishikawazukamisunagawabris" + - "toloseyouriparliamentjomeloyalistoragebritishcolumbialowiezagani" + - "shimerabroadcastleclerchiryukyuragifuchungbukharavennagatorodoyb" + - "roadwaybroke-itjxfinitybrokerbronnoysundurhamburglugmbhartipscbg" + - "minakamichiharabrothermesaverdealstahaugesunderseaportsinfolldal" + - "ottebrowsersafetymarketsaludweberbrumunddalottokonamegatakazakin" + - "ternationalfirearmsalvadordalibabalena-devicesalzburgmodellingmx" + - "javald-aostarnbergretakanabeautysvardoesntexisteingeekashibataka" + - "tsukiyosatokamachintaifun-dnsdojolsterbrunelastxn--0trq7p7nnishi" + - "nomiyashironomutashinaintuitkmaxxn--11b4c3dynathomebuiltwithdark" + - "ashiharabrusselsamegawabruxellesamnangerbryansklepparmattelekomm" + - "unikationishinoomotegobrynewhollandyndns-at-homedepotenzamamidsu" + - "ndyndns-at-workisboringrimstadyndns-blogdnsampalacebuskerudinewj" + - "erseybuzentsujiiebuzzwellbeingzonebwfarsundyndns-freeboxosloftra" + - "nakanojoetsuwanouchikujogaszkolancashirecreationishinoshimatsuur" + - "abzhitomirumalatvuopmicrolightingripebzzcommunexus-2community-pr" + - "ochowicecomoarekecomparemarkerryhotelsantacruzsantafedjejuifmetl" + - "ifeinsurancecompute-1computerhistoryofscience-fictioncomsecurity" + - "tacticsantamariakecondoshichinohealth-carereformitakeharaconfere" + - "nceconstructionconsuladonnaharimalopolskanlandyndns-remotewdyndn" + - "s-serverisignconsultanthropologyconsultingrpartycontactozsdeltaj" + - "irittogliattis-a-caterercontagematsubaracontemporaryarteducation" + - "alchikugodontexistmein-iservebeercontractorskenconventureshinode" + - "arthruherecipescaravantaacookingchannelsdvrdnsfor-better-thanawa" + - "tchandclockasukabedzin-berlindasdaburcooluroycooperativano-frank" + - "ivskolefrakkestadyndns-webhopencraftrani-andria-barletta-trani-a" + - "ndriacopenhagencyclopedichofunatoriginstitutemasekashiwaracoprod" + - "uctionsantoandreamhostersanukis-a-celticsfancorsicagliaricoharuo" + - "vatraniandriabarlettatraniandriacorvettemp-dnsaobernardocosenzak" + - "opanecosidnshome-webserverdalutskasumigaurawa-mazowszexnetnedalu" + - "xurycostumedicinakaiwamizawatchesaogoncartoonartdecologiacouchpo" + - "tatofriesaotomeldaluzerncouklugsmilegallocus-3councilvivanovolda" + - "couponsapporocq-acranbrookuwanalyticsardegnarusawacrdyndns-wikir" + - "kenesardiniacreditcardyndns-workshopitsitexaskoyabearalvahkikuch" + - "ikuseikarugalsacecreditunioncremonashgabadaddjaguarqcxn--12cfi8i" + - "xb8lcrewildlifedorainfracloudfrontdoorcricketrzyncrimeast-kazakh" + - "stanangercrotonecrownipasadenaritakurashikis-a-chefashioncrsvpas" + - "sagensarlcruisesarpsborgruecryptonomichigangwoncuisinellajollame" + - "ricanexpressexyculturalcentertainmentranoycuneocupcakecuritiback" + - "yardsarufutsunomiyawakasaikaitakofuefukihaboromskoguidegreecurva" + - "lled-aostaverncymrussiacyonabaruminamidaitomanchestercyouthachio" + - "jiyahooguyfetsundynnsasayamafgujohanamakinoharafhvalerfidoomdnst" + - "racefieldynservebbsasebofagemologicallyngenfigueresinstagingulen" + - "filateliafilegear-audnedalnfilegear-deatnulvikatowicefilegear-gb" + - "izfilegear-iefilegear-jpmorganfilegear-sgunmanxn--1ck2e1bananare" + - "publicasertairaumalborkarasjohkamikoaniikappuboliviajessheimemor" + - "ialaziobserverevistaples3-external-1filminamifuranofinalfinancef" + - "ineartsavonarutomobellevuelosangelesjabbottransurlfinlandynufcfa" + - "nfinnoyfirebaseappatriafirenzefirestonefirmdalegoldpoint2thisami" + - "tsukefishingolffansaxofitjarvodkafjordynv6fitnessettlementrapani" + - "izafjalerflesberguovdageaidnunusualpersonflickragerogerschoenbru" + - "nnflightschokokekschokoladenflirfloginlinefloraflorencefloridats" + - "unanjoburgushikamifuranorth-kazakhstanfloripaderbornfloristanoha" + - "takaharunzenflorokunohealthcareerscholarshipschoolschulezajskats" + - "ushikabeeldengeluidynvpnplus-4flowerschulserverfltravelchannelfl" + - "ynnhosting-clusterfndyroyrvikinguitarsaskatchewanfor-ourfor-some" + - "dizinhistorischeschwarzgwangjuniperfor-theaterforexrothachirogat" + - "akanezawaforgotdnschweizforli-cesena-forlicesenaforlillehammerfe" + - "ste-ipaviancarrdforsaleikangerforsandasuologoipfizerfortalfortmi" + - "ssoulancasterfortworthadanorthwesternmutualfosnesciencecentersci" + - "encehistoryfotaruis-a-cubicle-slavellinodeobjectscientistordalfo" + - "xfordebianfozorafredrikstadtvscjohnsonfreeddnsgeekgalaxyfreedesk" + - "topocznore-og-uvdalfreemasonryfreesitextileirfjordfreetlscotland" + - "freiburgwiddleitungsenfreseniuscountryestateofdelawareggio-calab" + - "riafribourgxn--1ctwolominamatarnobrzegyptianfriuli-v-giuliafriul" + - "i-ve-giuliafriuli-vegiuliafriuli-venezia-giuliafriuli-veneziagiu" + - "liafriuli-vgiuliafriuliv-giuliafriulive-giuliafriulivegiuliafriu" + - "livenezia-giuliafriuliveneziagiuliafriulivgiuliafrlfroganscrappe" + - "r-sitefrognfrolandfrom-akrehamnfrom-alfrom-arfrom-azfrom-capetow" + - "nnews-stagingfrom-coffeedbackplaneapplinzis-a-democratravelersin" + - "surancefrom-ctrdfrom-dchonanbulsan-suedtirolowiczest-le-patronis" + - "hitosashimizunaminamibosogndalpusercontentoyotapartsandnessjoeni" + - "shiwakinvestmentsandoyfrom-dedyn-berlincolnfrom-flanderscrapping" + - "from-gaulardalfrom-hichisochildrensgardenfrom-iafrom-idfrom-ilfr" + - "om-in-brbanzaicloudcontrolledekagaminombresciaustraliamusementdl" + - "lpages3-ap-south-1kappchizip6116-b-dataiji234lima-cityeatselinog" + - "radult3l3p0rtatamotors3-ap-northeast-1337from-kscrysechoseiroumu" + - "enchenissandiegofrom-kyowariasahikawafrom-lanciafrom-mamurogawaf" + - "rom-mdfrom-meeresistancefrom-mifunefrom-mnfrom-modalenfrom-mserv" + - "eirchoshibuyachiyodapliernewspaperfrom-mtnfrom-nctulangevagrigen" + - "tomologyeonggiehtavuoatnagahamaroyerfrom-ndfrom-nefrom-nh-serveb" + - "logsiteleafamilycompanyanagawafflecellclaimserveminecraftrentin-" + - "sud-tirolfrom-njaworznoticiasnesoddenmarkhangelskjakdnepropetrov" + - "skiervaapsteiermarkatsuyamarugame-hostrowiechoyodobashichikashuk" + - "ujitawarafrom-nminamiiserniafrom-nvalledaostargetmyiphostrodawar" + - "afrom-nyfrom-ohkurafrom-oketogurafrom-orfrom-padovaksdalfrom-pra" + - "tohmandalfrom-ris-a-designerfrom-schmidtre-gauldalfrom-sdfrom-tn" + - "from-txn--1lqs03nfrom-utsiracusaikisarazurecontainerdpolicefrom-" + - "val-daostavalleyfrom-vtrentin-sudtirolfrom-wafrom-wielunnerfrom-" + - "wvallee-aosteroyfrom-wyfrosinonefrostalowa-wolawafroyahikobierzy" + - "cefstcgroupgfoggiafujiiderafujikawaguchikonefujiminokamoenairlin" + - "edre-eikerfujinomiyadattowebcampinashikiminohostre-totendofinter" + - "net-dnsaliasiafujiokayamangonohejis-a-doctorayfujisatoshonairpor" + - "tland-4-salernoboribetsuckservemp3fujisawafujishiroishidakabirat" + - "oridefenseljordfujitsurugashimangyshlakasamatsudovre-eikerfujixe" + - "roxn--1lqs71dfujiyoshidavvenjargap-northeast-3fukayabeatservep2p" + - "harmacienservepicservequakefukuchiyamadavvesiidappnodebalancerti" + - "ficationfukudominichristiansburgrondarfukuis-a-financialadvisor-" + - "aurdalfukumitsubishigakishiwadazaifudaigojomedio-campidano-medio" + - "campidanomediofukuokazakisofukushimaniwakuratefukuroishikarikatu" + - "rindalfukusakisosakitagawafukuyamagatakahatakaishimoichinosekiga" + - "harafunabashiriuchinadafunagatakamatsukawafunahashikamiamakusats" + - "umasendaisennangooglecodespotrentin-sued-tirolfundaciofuoiskujuk" + - "uriyamannorfolkebibleirvikaufenfuosskoczowilliamhillfurnitureggi" + - "o-emilia-romagnakatombetsumitakagiizefurubirafurudonostiaafuruka" + - "wairtelebitbridgestonekobayashikshacknetcimbarcelonagawalmartatt" + - "oolforgehimejiitatebayashijonawatempresashibetsukuiiyamanouchiku" + - "hokuryugasakitaurayasudaustrheimatunduhrennesoyokosukanumazuryok" + - "oteastcoastaldefenceatonsbergjerdrumemergencyachts3-ca-central-1" + - "fusodegaurafussaintlouis-a-anarchistoireggiocalabriafutabayamagu" + - "chinomigawafutboldlygoingnowhere-for-morenakatsugawafuttsurugimp" + - "eriafuturecmservesarcasmatartanddesignfuturehostingfuturemailing" + - "fvgfylkesbiblackbaudcdn77-securebungoonord-odalfyresdalhangoutsy" + - "stemscloudhannanmokuizumodenaklodzkochikushinonsenergyhannosegaw" + - "ahanyuzenhapmircloudharstadharvestcelebrationhasamarburghasamina" + - "mi-alpsharis-a-hunterhashbanghasudahasura-appharmacysharphdfcban" + - "kazoologyhasvikazunow-dnshawaiijimaritimoduminamimakis-a-knightp" + - "ointtohobby-sitehatogayaitakaokalmykiahatoyamazakitakamiizumisan" + - "ofidelityhatsukaichikaiseiheijis-a-landscaperugiahattfjelldalhay" + - "ashimamotobungotakadagestangeorgeorgiahazuminobusells-for-usrcfa" + - "stlylbamblebesbyglandroverhalla-speziaustinnavigationavoizumizak" + - "ibigawajudaicable-modemocraciabruzzoologicalvinklein-addrammenuo" + - "rochesterimo-i-ranaamesjevuemielno-ipifonyaaarborteaches-yogasaw" + - "aracingdyniaetnabudapest-a-la-masion-riopretobamaceratabuseating" + - "-organic66helsinkitakatakarazukaluganskygearapphiladelphiaareadm" + - "yblogspotrentino-a-adigehembygdsforbundhemneshellaspeziahemsedal" + - "hepforgeherokussldheroyhgtvallee-d-aosteigenhidorahigashiagatsum" + - "agoianiahigashichichibunkyonanaoshimageandsoundandvisionthewifia" + - "tmallorcadaqueshimokawahigashihiroshimanehigashiizumozakitakyush" + - "uaiahigashikagawahigashikagurasoedahigashikawakitaaikitamihamada" + - "higashikurumeetrentino-aadigehigashimatsushimarcheapigeelvinckdd" + - "iethnologyhigashimatsuyamakitaakitadaitoigawahigashimurayamamoto" + - "rcycleshimokitayamahigashinarusells-itrentino-alto-adigehigashin" + - "ehigashiomihachimanagementrentino-altoadigehigashiosakasayamanak" + - "akogawahigashishirakawamatakasagoppdalhigashisumiyoshikawaminami" + - "aikitamotosumy-gatewayhigashitsunoshiroomurahigashiurausukitanak" + - "agusukumodernhigashiyamatokoriyamanashiibahccavuotnagareyamainte" + - "nancehigashiyodogawahigashiyoshinogaris-a-lawyerhiraizumisatohno" + - "shoooshikamaishimofusartshimonitayanagithubusercontentrentino-s-" + - "tirolhirakatashinagawahiranairtrafficplexus-1hirarahiratsukagawa" + - "hirayaizuwakamatsubushikusakadogawahistorichouseshimonosekikawah" + - "itachiomiyagildeskaliszhitachiotagotembaixadahitraeumtgeradelmen" + - "horstalbanshimosuwalkis-a-liberalhjartdalhjelmelandholeckodairah" + - "olidayhomeiphilatelyhomelinkitoolsztynsettlershimotsukehomelinux" + - "n--1qqw23ahomeofficehomesecuritymacaparecidahomesecuritypchristm" + - "aseratiresandvikcoromantovalle-d-aostatic-accessanfranciscofreak" + - "unemurorangehirnrtoyotomiyazakinzais-a-candidatehomesenseeringho" + - "meunixn--2m4a15ehondahongotpantheonsitehonjyoitakasakitashiobara" + - "hornindalhorsellsyourhomegoodshimotsumahorteneis-a-libertarianho" + - "spitalhoteleshinichinanhotmailhoyangerhoylandetroitskypehumaniti" + - "eshinjournalismailillesandefjordhurdalhurumajis-a-linux-useranis" + - "hiaritabashikaoirminamiminowahyllestadhyogoris-a-llamarriottrent" + - "ino-stirolhyugawarahyundaiwafuneis-very-badajozis-very-evillagei" + - "s-very-goodyearis-very-niceis-very-sweetpepperis-with-thebandois" + - "leofmanaustdaljevnakershuscultureggioemiliaromagnamsskoganeis-a-" + - "nascarfanjewelryjewishartgalleryjfkharkivalleedaostejgorajlljls-" + - "sto1jmphotographysiojnjcphonefosshintomikasaharajoyentrentino-su" + - "edtiroljoyokaichibajddarchitecturealtorlandjpnjprshiojirishirifu" + - "jiedajurkosherbrookegawakoshimizumakizunokunimimatakayamarylandk" + - "oshunantankhersonkosugekotohiradomainsurehabmerkotourakouhokutam" + - "akis-a-patsfankounosupplieshirakokaminokawanishiaizubangekouyama" + - "shikekouzushimashikis-a-personaltrainerkozagawakozakis-a-photogr" + - "apherokuapphilipsyno-dshinjukumanowtvalleeaosteinkjerusalembroid" + - "erykozowindmillkpnkppspdnshiranukamitsuekrasnikahokutokashikis-a" + - "-playershifteditchyouriphoenixn--2scrj9chromedicaltanissettaishi" + - "nomakinkobeardubaiduckdnsangokrasnodarkredstonekristiansandcatsh" + - "iraois-a-republicancerresearchaeologicaliforniakristiansundkrods" + - "heradkrokstadelvaldaostarostwodzislawindowskrakowinnershiraokamo" + - "gawakryminamioguni5kumatorinokumejimasoykumenantokigawakunisakis" + - "-a-rockstarachowicekunitachiarailwaykunitomigusukumamotoyamashik" + - "okuchuokunneppubtlshiratakahagitlaborkunstsammlungkunstunddesign" + - "kuokgroupilotshishikuis-a-socialistdlibestadkureisenkurgankurobe" + - "laudibleasingleshisognekurogiminamiashigarakuroisoftwarezzokurom" + - "atsunais-a-soxfankurotakikawasakis-a-studentalkushirogawakustana" + - "is-a-teacherkassyncloudkusupplykutchanelkutnokuzumakis-a-techiet" + - "is-a-musiciankvafjordkvalsundkvamlidlugolekadenagaivuotnagaokaky" + - "otambabyenebakkeshibechambagriculturennebudejjuedischesapeakebay" + - "ernukvanangenkvinesdalkvinnheradkviteseidatingkvitsoykwpspectrum" + - "inamisanrikubetsurfastvps-serveronakasatsunairguardiannakadomari" + - "nebraskauniversitychyattorneyagawakembuchikumagayagawakkanaibets" + - "ubamericanfamilydsclouderackmazerbaijan-mayen-rootaribeiraogashi" + - "madachicagoboatsassaris-a-conservativegarsheis-a-cpadualstackher" + - "o-networkinggroupassenger-associationkzmissileluxembourgmisugito" + - "kuyamatsumotofukemitourismolanxesshitaramamitoyoakemiuramiyazure" + - "websiteshikagamiishibukawamiyotamanomjondalenmlbfanmontrealestat" + - "efarmequipmentrentinoa-adigemonza-brianzapposhizukuishimogosenmo" + - "nza-e-della-brianzaptokyotangotsukitahatakamoriokakegawamonzabri" + - "anzaramonzaebrianzamonzaedellabrianzamoonscaleforcemordoviamoriy" + - "amatsunomoriyoshiminamiawajikis-an-actormormonstermoroyamatsusak" + - "ahoginankokubunjis-an-actresshinshinotsurgerymortgagemoscowioshi" + - "zuokanagawamoseushistorymosjoenmoskeneshoppingmosshopwarendalenu" + - "gmosvikhmelnytskyivaomoteginowaniihamatamakawajimansionshoujis-a" + - "n-anarchistoricalsocietymoviemovimientolgamozilla-iotrentinoaadi" + - "gemtranbymuenstermuginozawaonsenmuikamisatokaizukamikitayamatsur" + - "is-an-artistgorymukoebenhavnmulhouseoullensvanguardmunakatanemun" + - "cienciamuosattemupimientakkoelnmurmanskhplaystation-cloudmurotor" + - "craftrentinoalto-adigemusashimurayamatsushigemusashinoharamuseet" + - "rentinoaltoadigemuseumverenigingmusicargodaddyn-vpndnshowamutsuz" + - "awamy-vigorgemy-wanggouvichungnamdalseidfjordyndns-mailubindalub" + - "lindesnesanjotoyotsukaidomyactivedirectorymyasustor-elvdalmycdn7" + - "7-sslattuminamitanemydattolocalhistorymyddnskingmydissentrentino" + - "s-tirolmydobisshikis-an-engineeringmydroboehringerikemydshowtime" + - "lhusdecorativeartshriramsterdamnserverbaniamyeffectrentinostirol" + - "myfastly-terrariuminamiuonumasudamyfirewallonieruchomoscienceand" + - "industrynmyforuminamiyamashirokawanabelembetsukubankhmelnitskiya" + - "marumorimachidamyfritzmyftpaccesshwitdklabudhabikinokawabarthads" + - "electrentin-suedtirolmyhome-servermyjinomykolaivaporcloudmymaile" + - "rmymediapchurcharternidyndns-office-on-the-webhareidsbergentingr" + - "ongausdalucaniamyokohamamatsudamypepinkmpspbarclays3-sa-east-1my" + - "petsienarviikamishihoronobeauxartsandcraftsigdalmyphotoshibalati" + - "nogiftsilknx-serversailleshioyandexcloudmypictetrentinosud-tirol" + - "mypsxn--32vp30haebaruericssongdalenviknakayamaoris-a-geekautokei" + - "notteroymysecuritycamerakermyshopblocksimple-urlmytis-a-bookkeep" + - "erspectakasugais-an-entertainermytuleaprendemasakikonaikawachina" + - "ganoharamcoachampionshiphoptobishimadridvagsoygardendoftheintern" + - "etlifyis-bytomaritimekeepingmyvncircustomer-ociprianiigataitogit" + - "suldaluccarbonia-iglesias-carboniaiglesiascarboniamywirepbodynam" + - "ic-dnsirdalplatformshangrilapyplatter-appioneerplatterpippugliap" + - "lazaplcube-serversicherungplumbingoplurinacionalpodhalevangerpod" + - "lasiellaktyubinskiptveterinaireadthedocscappgafannefrankfurtrent" + - "inosudtirolpodzonepohlpoivronpokerpokrovskomakiyosunndalpolitica" + - "rrierpolitiendapolkowicepoltavalle-aostathellewismillerpomorzesz" + - "owithgoogleapiszponpesaro-urbino-pesarourbinopesaromasvuotnaroyp" + - "onypordenonepornporsangerporsangugeporsgrunnanyokoshibahikariwan" + - "umatamayufuelveruminanopoznanpraxis-a-bruinsfanprdpreservationpr" + - "esidioprgmrprimelbourneprincipeprivatizehealthinsuranceprofesion" + - "alprogressivenneslaskerrylogisticslupskomatsushimarylhurstjordal" + - "shalsenpromombetsurgeonshalloffameiwamassa-carrara-massacarraram" + - "assabusinessebyklecznagasukepropertyprotectionprotonetrentinosue" + - "d-tirolprudentialpruszkowithyoutuberspacekitagatargivestbytemark" + - "omforbarefootballooningjerstadotsuruokakamigaharauthordalandds3-" + - "eu-central-1prvcyberlevagangaviikanonjis-certifieducatorahimeshi" + - "mamateramobaraprzeworskogptplusgardenpulawypupittsburghofficialp" + - "vhagakhanamigawapvtrentinosuedtirolpwcistrondheimmobilienissayok" + - "kaichiropractichitachinakagawassamukawatarightathomeftparocherni" + - "governmentksatxn--12c1fe0bradescorporationrenderpzqhagebostadqld" + - "qponiatowadaqslingqualifioappiwatequickconnectrentinsud-tirolqui" + - "cksytestingquipelementslzqvcitadeliveryggeesusonosuzakanazawasuz" + - "ukaneyamazoesuzukis-into-animegurownprovidersvalbardunloppacific" + - "ivilaviationissedalucernesveiosvelvikomorotsukaminoyamaxunjargas" + - "vizzerasvn-reposologneswidnicasacamdvrcampinagrandebuilderschles" + - "ischesolundbeckommunalforbundswidnikkokonoeswiebodzin-butterswif" + - "tcoverswinoujscienceandhistoryswissmarterthanyousynology-disksta" + - "tionsynology-dsolutionsnoasakakinokiaturystykanmakiwientuscanytu" + - "shuissier-justicetuvalle-daostaticsootuxfamilytwmailvestnesopotr" + - "entinsudtirolvestre-slidreviewsaitoshimayfirstockholmestrandvest" + - "re-totennishiawakuravestvagoyvevelstadvibo-valentiavibovalentiav" + - "ideovillasor-odalvinnicasadelamonedancevinnytsiavipsinaappixolin" + - "ovirginiavirtual-userveftpizzavirtualservervirtualuservegame-ser" + - "vervirtueeldomein-vigorlicevirtuelvisakegawaviterboknowsitallviv" + - "olkenkundenvixn--3bst00miniservervlaanderenvladikavkazimierz-dol" + - "nyvladimirvlogintoyonezawavminnesotaketaketomisatokorozawavologd" + - "anskongsbergvolvolkswagentsor-varangervolyngdalvoorloperaunitero" + - "is-into-carshinshirovossevangenvotevotingvotoyonowmflabsorfoldwn" + - "extdirectroandinosaureplantationworldworse-thandawowiwatsukiyono" + - "tairestaurantritonwpdevcloudwritesthisblogsytewroclawloclawekong" + - "svingerwtcminterepaircraftingvollombardiamondshisuifuettertdasne" + - "tzwtfauskedsmokorsetagayaseralingenoamishirasatogokasells-for-le" + - "ssaudawuozuwzmiuwajimaxn--42c2d9axn--45br5cylxn--45brj9civilizat" + - "ionxn--45q11civilwarmiastagets-itoyouraxn--4gbriminingxn--4it168" + - "dxn--4it797konskowolayangroupictureshirahamatonbetsurnadalxn--4p" + - "vxs4allxn--54b7fta0cclanbibaidarmeniaxn--55qw42gxn--55qx5dxn--5j" + - "s045dxn--5rtp49cldmailovecollegefantasyleaguernseyxn--5rtq34kons" + - "ulatrobeepilepsykkylvenetodayxn--5su34j936bgsgxn--5tzm5gxn--6btw" + - "5axn--6frz82gxn--6orx2rxn--6qq986b3xlxn--7t0a264clic20001wwwhosw" + - "hokksundyndns-picsannohelplfinancialukowiiheyakagexn--80adxhksor" + - "ocabalestrandabergamo-siemensncfdxn--80ao21axn--80aqecdr1axn--80" + - "asehdbarreauction-webhostingjesdalillyolasitemrxn--80aswgxn--80a" + - "ugustowmcloudxn--8ltr62konyvelolipopiemontexn--8pvr4uxn--8y0a063" + - "axn--90a3academiamicaarpkomaganexn--90aeroportalabamagasakishima" + - "baraogakibichuoxn--90aishobarakawagoexn--90azhytomyravendbarrel-" + - "of-knowledgeapplicationcloudappspotagerxn--9dbhblg6digitalxn--9d" + - "bq2axn--9et52uxn--9krt00axn--andy-iraxn--aroport-byaotsurreyxn--" + - "asky-iraxn--aurskog-hland-jnbarrell-of-knowledgestackarasjokaras" + - "uyamarshallstatebankarateu-1xn--avery-yuasakuhokkaidownloadxn--b" + - "-5gaxn--b4w605ferdxn--balsan-sdtirol-nsbsorreisahayakawakamiichi" + - "kawamisatottoris-foundationxn--bck1b9a5dre4clickashiwazakiyosemi" + - "texn--bdddj-mrabdxn--bearalvhki-y4axn--berlevg-jxaxn--bhcavuotna" + - "-s4axn--bhccavuotna-k7axn--bidr-5nachikatsuuraxn--bievt-0qa2xn--" + - "bjarky-fyasakaiminatoyookaniepcexn--bjddar-ptarumizusawaxn--blt-" + - "elabourxn--bmlo-graingerxn--bod-2nativeamericanantiquesortlandxn" + - "--bozen-sdtirol-2obanazawaxn--brnny-wuacademy-firewall-gatewayxn" + - "--brnnysund-m8accident-investigation-aptibleadpagest-mon-blogueu" + - "rovision-k3sorumincomcastresindevicenzaporizhzhiaxn--brum-voagat" + - "rogstadxn--btsfjord-9zaxn--bulsan-sdtirol-nsbarsycenterprisesaki" + - "kugawaltervistaikimobetsuitainaioirasebastopologyeongnamegawakay" + - "amagazineat-urlimanowarudautomotiveconomiasakuchinotsuchiurakawa" + - "lesundeportevadsobetsumidatlanticaseihicampobassociatest-iservec" + - "ounterstrikebinagisoccertmgrazimutheworkpccwebredirectmembers3-e" + - "u-west-1xn--c1avgxn--c2br7gxn--c3s14misakis-a-therapistoiaxn--cc" + - "k2b3barsyonlinewhampshirealtysnes3-us-gov-west-1xn--cckwcxetdxn-" + - "-cesena-forl-mcbremangerxn--cesenaforl-i8axn--cg4bkis-into-carto" + - "onshintokushimaxn--ciqpnxn--clchc0ea0b2g2a9gcdxn--comunicaes-v6a" + - "2oxn--correios-e-telecomunicaes-ghc29axn--czr694bashkiriautoscan" + - "adaeguambulanceobihirosakikamijimatsuzakibmdevelopmentatsunobira" + - "ukraanghkeymachineustargardd-dnsiskinkyotobetsulikes-piedmontice" + - "llodingenatuurwetenschappenaumburggfarmerseine164-balsfjorddnsli" + - "velanddnss3-ap-southeast-1xn--czrs0tromsakataobaomoriguchiharahk" + - "keravjuegoshikijobservableusercontentrentinsuedtirolxn--czru2dxn" + - "--czrw28basicservercelliguriaveroykenglandgcahcesuoloans3-eu-wes" + - "t-2xn--d1acj3basilicataniavocatanzarowebspacebinordreisa-hockeyn" + - "utazuerichardlikescandyn53utilitiesquare7xn--d1alfaromeoxn--d1at" + - "romsojamisonxn--d5qv7z876clinichocolatelevisionishiokoppegardynd" + - "ns-ipartinuyamashinatsukigatakashimarnardalouvreitoyosatoyokawax" + - "n--davvenjrga-y4axn--djrs72d6uyxn--djty4kooris-a-nursembokukitch" + - "enxn--dnna-grajewolterskluwerxn--drbak-wuaxn--dyry-iraxn--e1a4cl" + - "iniquenoharaxn--eckvdtc9dxn--efvn9soundcastronomy-routerxn--efvy" + - "88haibarakitahiroshimapartmentservicesevastopolexn--ehqz56nxn--e" + - "lqq16hair-surveillancexn--eveni-0qa01gaxn--f6qx53axn--fct429kope" + - "rvikharkovanylvenicexn--fhbeiarnxn--finny-yuaxn--fiq228c5hsouthc" + - "arolinatalxn--fiq64basketballfinanzgoravoues3-eu-west-3xn--fiqs8" + - "southwestfalenxn--fiqz9sowaxn--fjord-lraxn--fjq720axn--fl-ziaxn-" + - "-flor-jraxn--flw351exn--forl-cesena-fcbsspeedpartnersokananiimih" + - "oboleslawiecitichitosetogakushimotoganewportlligatmparsamsclubar" + - "towhalingriwataraidyndns-homednsamsungroks-thisayamanobeokakudam" + - "atsuexn--forlcesena-c8axn--fpcrj9c3dxn--frde-grandrapidspjelkavi" + - "komonowruzhgorodeoxn--frna-woaraisaijosoyrorospreadbettingxn--fr" + - "ya-hraxn--fzc2c9e2clintonoshoesanokasserverrankoshigayameinforum" + - "zxn--fzys8d69uvgmailxn--g2xx48clothingdustdataiwanairforcebetsui" + - "kidsmynasushiobaragusabaejrietisalatinabenonicbcn-north-1xn--gck" + - "r3f0fbsbxn--12co0c3b4evalleaostavangerxn--gecrj9cn-northwest-1xn" + - "--ggaviika-8ya47hakatanortonxn--gildeskl-g0axn--givuotna-8yasugi" + - "vingxn--gjvik-wuaxn--gk3at1exn--gls-elacaixaxn--gmq050is-into-ga" + - "messinazawaxn--gmqw5axn--h-2failxn--h1aeghakodatexn--h2breg3even" + - "espydebergxn--h2brj9c8cngrossetouchihayaakasakawaharaxn--h3cuzk1" + - "discountyxn--hbmer-xqaxn--hcesuolo-7ya35batochiokinoshimakeupowi" + - "at-band-campaniaxaurskog-holandingjemnes3-ap-southeast-2xn--hery" + - "-iraxn--hgebostad-g3axn--hkkinen-5waxn--hmmrfeasta-s4accident-pr" + - "evention-rancherkasydneyxn--hnefoss-q1axn--hobl-iraxn--holtlen-h" + - "xaxn--hpmir-xqaxn--hxt814exn--hyanger-q1axn--hylandet-54axn--i1b" + - "6b1a6a2exn--imr513nxn--indery-fyasuokanoyakumoldeloittenrikuzent" + - "akatajimidorissagamiharaxn--io0a7is-leetrentino-sud-tirolxn--j1a" + - "efbx-osauheradyndns1xn--j1amhakonexn--j6w193gxn--jlq480n2rgxn--j" + - "lq61u9w7batsfjordiscoveryombolzano-altoadigeologyomitanoceanogra" + - "phics3-us-west-1xn--jlster-byatomitamamuraxn--jrpeland-54axn--jv" + - "r189misasaguris-an-accountantshinkamigotoyohashimototalxn--k7yn9" + - "5exn--karmy-yuaxn--kbrq7oxn--kcrx77d1x4axn--kfjord-iuaxn--klbu-w" + - "oaxn--klt787dxn--kltp7dxn--kltx9axn--klty5xn--3ds443gxn--koluokt" + - "a-7ya57hakubahcavuotnagaraholtaleniwaizumiotsukumiyamazonawsmppl" + - "anetariuminamiizukamiokameokameyamatotakadaxn--kprw13dxn--kpry57" + - "dxn--kpu716fbxosavannahgaxn--kput3is-lostrolekamakurazakiwakunig" + - "amiharustkannamilanotogawaxn--krager-gyatsukanraxn--kranghke-b0a" + - "xn--krdsherad-m8axn--krehamn-dxaxn--krjohka-hwab49jdfastpanelbla" + - "grarchaeologyeongbuk0emmafann-arboretumbriamallamaceiobbcg12038x" + - "n--ksnes-uuaxn--kvfjord-nxaxn--kvitsy-fyatsushiroxn--kvnangen-k0" + - "axn--l-1fairwindsrlxn--l1accentureklamborghinikolaeventsrvareser" + - "vehalflifestylexn--laheadju-7yawaraxn--langevg-jxaxn--lcvr32dxn-" + - "-ldingen-q1axn--leagaviika-52bauhausposts-and-telecommunications" + - "3-us-west-2xn--lesund-huaxn--lgbbat1ad8jelasticbeanstalkhakassia" + - "xn--lgrd-poacctrusteexn--lhppi-xqaxn--linds-pramericanartrvargga" + - "trentoyonakagyokutoyakolobrzegersundxn--lns-qlaquilanstorfjordxn" + - "--loabt-0qaxn--lrdal-sraxn--lrenskog-54axn--lt-liacnpyatigorskod" + - "jeffersonxn--lten-granexn--lury-iraxn--m3ch0j3axn--mely-iraxn--m" + - "erker-kuaxn--mgb2ddestorjdevcloudnshinyoshitomiokamitondabayashi" + - "ogamagoriziaxn--mgb9awbfedorapeoplegnicapebretonamicrosoftbankas" + - "uyanaizulminamiechizenxn--mgba3a3ejtrycloudflareportrevisohughes" + - "omaxn--mgba3a4f16axn--mgba3a4franamizuholdingstpetersburgxn--mgb" + - "a7c0bbn0axn--mgbaakc7dvfedoraprojectransportexn--mgbaam7a8hakuis" + - "-a-greenxn--mgbab2bdxn--mgbah1a3hjkrdxn--mgbai9a5eva00beneventoe" + - "idskoguchikuzenayorovigovtaxihuanflfanfshostrowwlkpmgjovikaratsu" + - "ginamikatagamilitaryonagoyaxn--mgbai9azgqp6jelenia-goraxn--mgbay" + - "h7gpaleoxn--mgbbh1a71exn--mgbc0a9azcgxn--mgbca7dzdoxn--mgberp4a5" + - "d4a87gxn--mgberp4a5d4arxn--mgbgu82axn--mgbi4ecexposedxn--mgbpl2f" + - "hskydivingxn--mgbqly7c0a67fbcnsantabarbaraxn--mgbqly7cvafranzisk" + - "anerimaringatlantakahashimamakiryuohdattorelayxn--mgbt3dhdxn--mg" + - "btf8flatangerxn--mgbtx2bentleyonagunicommbankarelianceu-2xn--mgb" + - "x4cd0abbvieeexn--mix082feiraquarelleaseeklogesaves-the-whalessan" + - "dria-trani-barletta-andriatranibarlettaandriaxn--mix891fermochiz" + - "ukirovogradoyxn--mjndalen-64axn--mk0axin-dslgbtrysiljanxn--mk1bu" + - "44cntoystre-slidrettozawaxn--mkru45is-not-certifiedugit-pagespee" + - "dmobilizeroticanonoichinomiyakexn--mlatvuopmi-s4axn--mli-tlarvik" + - "oryokamikawanehonbetsurutaharaxn--mlselv-iuaxn--moreke-juaxn--mo" + - "ri-qsakuragawaxn--mosjen-eyawatahamaxn--mot-tlavagiskexn--mre-og" + - "-romsdal-qqbuserveexchangexn--msy-ula0hakusanagochijiwadell-ogli" + - "astraderxn--mtta-vrjjat-k7aflakstadaokagakicks-assnasaarlandxn--" + - "muost-0qaxn--mxtq1misawaxn--ngbc5azdxn--ngbe9e0axn--ngbrxn--3e0b" + - "707exn--nit225kosaigawaxn--nmesjevuemie-tcbalsan-sudtirollagdene" + - "snaaseinet-freakstreamswatch-and-clockerxn--nnx388axn--nodessaku" + - "rais-savedunetflixilxn--nqv7fs00emaxn--nry-yla5gxn--ntso0iqx3axn" + - "--ntsq17gxn--nttery-byaeservehttplantsjcbnpparibaselburgxn--nvuo" + - "tna-hwaxn--nyqy26axn--o1acheltenham-radio-openairbusantiquest-a-" + - "la-maisondre-landroidxn--o3cw4haldenxn--o3cyx2axn--od0algxn--od0" + - "aq3beppublishproxyzgorzeleccogladefinimakanegasakiraxn--ogbpf8fl" + - "ekkefjordxn--oppegrd-ixaxn--ostery-fyaxn--osyro-wuaxn--otu796dxn" + - "--p1acferraraxn--p1ais-slickfhappoutwentexn--pbt977collectionxn-" + - "-pgbs0dhlxn--porsgu-sta26ferrarivnexn--pssu33lxn--pssy2uxn--q9jy" + - "b4colognewyorkshirecifedexeterxn--qcka1pmckinseyxn--qqqt11miscon" + - "fusedxn--qxa6axn--qxamuneuestudioxn--rady-iraxn--rdal-poaxn--rde" + - "-ulavangenxn--rdy-0nabaris-uberleetrentino-sudtirolxn--rennesy-v" + - "1axn--rhkkervju-01aferrerotikagoshimalvikaszubyxn--rholt-mragowo" + - "odsidemonmouthalsaitamatsukuris-a-guruslivinghistoryxn--rhqv96gx" + - "n--rht27zxn--rht3dxn--rht61exn--risa-5naturalhistorymuseumcenter" + - "xn--risr-iraxn--rland-uuaxn--rlingen-mxaxn--rmskog-byaxn--rny31h" + - "ammarfeastafricapitalonewmexicodyn-o-saurlandesevenassisicilyxn-" + - "-rovu88beskidyn-ip24xn--rros-granvindafjordxn--rskog-uuaxn--rst-" + - "0naturalsciencesnaturellestudynamisches-dnsokndalxn--rsta-franca" + - "iseharaxn--rvc1e0am3exn--ryken-vuaxn--ryrvik-byaxn--s-1faithamur" + - "akamigoris-a-hard-workersewinbarclaycards3-fips-us-gov-west-1xn-" + - "-s9brj9colonialwilliamsburgroundhandlingroznyxn--sandnessjen-ogb" + - "estbuyshouses3-website-ap-northeast-1xn--sandy-yuaxn--sdtirol-n2" + - "axn--seral-lraxn--ses554gxn--sgne-graphoxn--3hcrj9civilisationis" + - "shinguccircleverappsannaniyodogawaxn--skierv-utazastuff-4-salexn" + - "--skjervy-v1axn--skjk-soaxn--sknit-yqaxn--sknland-fxaxn--slat-5n" + - "aturbruksgymnxn--slt-elabcieszynxn--smla-hraxn--smna-gratangentl" + - "entapisa-geekosakaerodromegallupinbargainstantcloudfunctionswede" + - "nvironmentalconservationfabricafederationionjukudoyamaizuruhrhcl" + - "oudiscourses3-us-east-2xn--snase-nraxn--sndre-land-0cbetainaboxf" + - "usejnymemsettsupportcp4xn--snes-poaxn--snsa-roaxn--sr-aurdal-l8a" + - "xn--sr-fron-q1axn--sr-odal-q1axn--sr-varanger-ggbhzcasinordkappa" + - "lmasfjordenhktjeldsundishakotanhlfanhs3-website-ap-southeast-1xn" + - "--srfold-byaxn--srreisa-q1axn--srum-gratis-a-bulls-fanxn--stfold" + - "-9xaxn--stjrdal-s1axn--stjrdalshalsen-sqbieidsvollimitediskussio" + - "nsbereichaseljeepsondriodejaneirockartuzyoriikariyaltakatorin-th" + - "e-bandain-vpncateringebuildinglassassinationalheritageu-3xn--str" + - "e-toten-zcbielawashingtondclkarlsoyoshiokanzakiyokawaraxn--t60b5" + - "6axn--tckweatherchannelxn--tiq49xqyjeonnamerikawauexn--tjme-hrax" + - "n--tn0agrinetbankoseis-a-painteractivegaskvollxn--tnsberg-q1axn-" + - "-tor131oxn--trany-yuaxn--trentin-sd-tirol-rzbiellaakesvuemielecc" + - "eu-4xn--trentin-sdtirol-7vbrplsbxn--3oq18vl8pn36axn--trentino-sd" + - "-tirol-c3bieszczadygeyachimataipeigersundisrechtrainingleezevje-" + - "og-hornnes3-website-ap-southeast-2xn--trentino-sdtirol-szbievath" + - "letajimabaridagawalbrzycharitydalcesurancechirealmpmnikonanporov" + - "noceanographiquextraspace-to-rentalstomakomaibaraxn--trentinosd-" + - "tirol-rzbifukagawashtenawdev-myqnapcloudeitysfjordivtasvuodnakam" + - "agayahabaghdadivttasvuotnakamuratakahamalselvendrellimoliseminex" + - "n--trentinosdtirol-7vbigv-infoodnetworkangerxn--trentinsd-tirol-" + - "6vbihorologyukincheoninohekinannestadiyukuhashimojindianapolis-a" + - "-bloggerxn--trentinsdtirol-nsbikedaejeonbukcoalvdalaheadjudygarl" + - "andnpalmspringsakerxn--trgstad-r1axn--trna-woaxn--troms-zuaxn--t" + - "ysvr-vraxn--uc0atvaroyxn--uc0ay4axn--uist22handsonyoursidellogli" + - "astradingxn--uisz3gxn--unjrga-rtashkentunesomnarvikommunexn--unu" + - "p4yxn--uuwu58axn--vads-jraxn--valle-aoste-ebbtunkomvuxn--30rr7yx" + - "n--valle-d-aoste-ehbodollstufftoread-booksnesolarssonxn--valleao" + - "ste-e7axn--valledaoste-ebbvacationstuttgartrentinsued-tirolxn--v" + - "ard-jraxn--vegrshei-c0axn--vermgensberater-ctbilbaokinawashirosa" + - "tochigiessensiositelemarkarmoyurihonjournalistjohninomiyakonojor" + - "pelandrangedalinkyard-cloudyclusterxn--vermgensberatung-pwbillus" + - "trationredumbrellahppiacenzachpomorskienirasakindianmarketinglit" + - "chattanooganordlandray-dnsupdaternopilawaweddingliwicexn--vestvg" + - "y-ixa6oxn--vg-yiabkhaziaxn--vgan-qoaxn--vgsy-qoa0jetztrentino-su" + - "ed-tirolxn--vgu402coloradoplateaudioxn--vhquvestfoldxn--vler-qoa" + - "xn--vre-eiker-k8axn--vrggt-xqadxn--vry-yla5gxn--vuq861biocpanama" + - "tta-varjjatjmaxxxboxenapponazure-mobilexn--w4r85el8fhu5dnraxn--w" + - "4rs40lxn--wcvs22dxn--wgbh1columbusheyxn--wgbl6axn--xhq521birdart" + - "centerprisecloudcontrolappleborkdalwaysdatabaseballangenkainanae" + - "robatickets3-website-eu-west-1xn--xkc2al3hye2axn--xkc2dl3a5ee0ha" + - "ngglidingxn--y9a3aquariumishimatsumaebashimodatexn--yer-znaturhi" + - "storischesusakis-gonexn--yfro4i67oxn--ygarden-p1axn--ygbi2ammxn-" + - "-3pxu8koninjambylxn--ystre-slidre-ujbirkenesoddtangenovaranzanqu" + - "anpachigasakihokumakogengerdalaskanittedallasalleangaviikaascoli" + - "picenodumetacentrumeteorappanasonicatholicaxiashorokanaiexn--zbx" + - "025dxn--zf0ao64axn--zf0avxlxn--zfr164birthplacexnbayxz" - -// nodes is the list of nodes. Each node is represented as a uint32, which -// encodes the node's children, wildcard bit and node type (as an index into -// the children array), ICANN bit and text. -// -// If the table was generated with the -comments flag, there is a //-comment -// after each node's data. In it is the nodes-array indexes of the children, -// formatted as (n0x1234-n0x1256), with * denoting the wildcard bit. The -// nodeType is printed as + for normal, ! for exception, and o for parent-only -// nodes that have children but don't match a domain label in their own right. -// An I denotes an ICANN domain. -// -// The layout within the uint32, from MSB to LSB, is: -// [ 0 bits] unused -// [10 bits] children index -// [ 1 bits] ICANN bit -// [15 bits] text index -// [ 6 bits] text length -var nodes = [...]uint32{ - 0x297a83, - 0x32a504, - 0x2eadc6, - 0x24c943, - 0x24c946, - 0x38b146, - 0x3b05c3, - 0x214bc4, - 0x201507, - 0x2eaa08, - 0x1a000c2, - 0x1f36987, - 0x376649, - 0x36c4ca, - 0x36c4cb, - 0x201203, - 0x233985, - 0x2201602, - 0x2d2044, - 0x2eaf43, - 0x269045, - 0x2601742, - 0x343083, - 0x2a135c4, - 0x2982c5, - 0x2e0de42, - 0x26e24e, - 0x250b83, - 0x3a6286, - 0x3203082, - 0x306087, - 0x2372c6, - 0x3606bc2, - 0x27f943, - 0x27f944, - 0x399b86, - 0x35bc88, - 0x286046, - 0x26fc84, - 0x3a00ac2, - 0x34abc9, - 0x2236c7, - 0x202446, - 0x353689, - 0x32f208, - 0x2478c4, - 0x23f2c6, - 0x3c3846, - 0x3e041c2, - 0x36fcc6, - 0x242f4f, - 0x2d108e, - 0x219a44, - 0x218b45, - 0x32a405, - 0x2e7589, - 0x23d709, - 0x39a387, - 0x3ddf06, - 0x267243, - 0x42037c2, - 0x21adc3, - 0x35054a, - 0x460f283, - 0x3d95c5, - 0x29d282, - 0x38b6c9, - 0x4e01182, - 0x201c84, - 0x2f3146, - 0x28a745, - 0x36d1c4, - 0x560fbc4, - 0x220dc3, - 0x232d04, - 0x5a02d02, - 0x235784, - 0x5e79284, - 0x33cb4a, - 0x6200882, - 0x3c1f47, - 0x2d0548, - 0x76031c2, - 0x328287, - 0x2c9044, - 0x2c9047, - 0x3d57c5, - 0x378847, - 0x303c06, - 0x2f0e44, - 0x342e05, - 0x257187, - 0x8e01482, - 0x36fe43, - 0x9226782, - 0x3633c3, - 0x9606b42, - 0x274985, - 0x9a00202, - 0x2cd104, - 0x2c23c5, - 0x219987, - 0x249e0e, - 0x2b6e44, - 0x290f44, - 0x210603, - 0x286ac9, - 0x3aa74b, - 0x2edac8, - 0x303148, - 0x3b1888, - 0x3d9ac8, - 0x3534ca, - 0x378747, - 0x2cdf46, - 0x9e47402, - 0x374d83, - 0x3ccac3, - 0x3ce604, - 0x374dc3, - 0x35cb83, - 0x1732182, - 0xa2016c2, - 0x27cd05, - 0x224686, - 0x233744, - 0x38a5c7, - 0x2355c6, - 0x2c8984, - 0x3abfc7, - 0x215dc3, - 0xa6d5bc2, - 0xaa20f82, - 0xae20d42, - 0x220d46, - 0xb200282, - 0x284405, - 0x3336c3, - 0x3c8744, - 0x2f7784, - 0x2f7785, - 0x3d6d83, - 0xb602703, - 0xba019c2, - 0x205fc5, - 0x205fcb, - 0x20ec0b, - 0x229904, - 0x206689, - 0x208244, - 0xbe09c42, - 0x20a483, - 0x20a703, - 0xc202e82, - 0x398a0a, - 0xc601542, - 0x2d22c5, - 0x2e6a0a, - 0x247584, - 0x20b103, - 0x20b7c4, - 0x20d6c3, - 0x20d6c4, - 0x20d6c7, - 0x20e245, - 0x2114c6, - 0x211846, - 0x2124c3, - 0x217688, - 0x208f03, - 0xca0cd42, - 0x308648, - 0x2862cb, - 0x21ffc8, - 0x2205c6, - 0x2213c7, - 0x227208, - 0xda07682, - 0xde1d482, - 0x298408, - 0x210c07, - 0x30dcc5, - 0x30dcc8, - 0xe301108, - 0x26c243, - 0x22a444, - 0x38b1c2, - 0xe62a882, - 0xea16182, - 0xf22c042, - 0x22c043, - 0xf6086c2, - 0x296303, - 0x3b2744, - 0x2086c3, - 0x247884, - 0x296a4b, - 0x215843, - 0x2f1486, - 0x278704, - 0x2c340e, - 0x38f345, - 0x261e48, - 0x3a6387, - 0x3a638a, - 0x22f983, - 0x2343c7, - 0x3aa905, - 0x22f984, - 0x2526c6, - 0x2526c7, - 0x31a204, - 0xfb0d704, - 0x24a144, - 0x33c806, - 0x22b844, - 0x3b5cc6, - 0x232443, - 0x3ba348, - 0x3df888, - 0x290f03, - 0x3989c3, - 0x340384, - 0x355943, - 0x10215702, - 0x1068d502, - 0x218043, - 0x2435c6, - 0x343343, - 0x30c504, - 0x10a3fec2, - 0x24cf43, - 0x327783, - 0x212c02, - 0x10e00d42, - 0x2cb886, - 0x234807, - 0x3c25c7, - 0x3b91c5, - 0x3d3004, - 0x29fbc5, - 0x2253c7, - 0x2ade49, - 0x2c19c6, - 0x2ec246, - 0x1120b682, - 0x2f4b48, - 0x3ae1c6, - 0x2aed85, - 0x30a6c7, - 0x3562c4, - 0x3562c5, - 0x11668c84, - 0x268c88, - 0x11a06082, - 0x11e00482, - 0x26e986, - 0x200488, - 0x331ac5, - 0x34b646, - 0x34ef88, - 0x35b788, - 0x12201805, - 0x126136c4, - 0x2136c7, - 0x12a07cc2, - 0x12e167c2, - 0x14201242, - 0x2f3245, - 0x14a83545, - 0x262486, - 0x323647, - 0x39f087, - 0x14e14a83, - 0x338487, - 0x38a948, - 0x2022cd09, - 0x26e407, - 0x22d447, - 0x22e548, - 0x22ed46, - 0x22f486, - 0x2300cc, - 0x23180a, - 0x231c07, - 0x23384b, - 0x234647, - 0x23464e, - 0x20635944, - 0x235b44, - 0x238b07, - 0x25c7c7, - 0x23d006, - 0x23d007, - 0x3b3147, - 0x2d2c43, - 0x20a2ba02, - 0x23e306, - 0x23e30a, - 0x23f44b, - 0x240987, - 0x241405, - 0x241e43, - 0x242246, - 0x242247, - 0x2f8983, - 0x20e00102, - 0x242bca, - 0x21377dc2, - 0x2173da82, - 0x21a3fd02, - 0x21e373c2, - 0x245385, - 0x245d44, - 0x22a05582, - 0x235805, - 0x23fa43, - 0x314885, - 0x2688c4, - 0x2afb04, - 0x2cea06, - 0x250f06, - 0x2061c3, - 0x3bb644, - 0x303ec3, - 0x23a02a42, - 0x213c44, - 0x213c46, - 0x221745, - 0x244d46, - 0x30a7c8, - 0x223dc4, - 0x367bc8, - 0x231e85, - 0x262b88, - 0x2caa06, - 0x217c07, - 0x273504, - 0x24e73506, - 0x252239c3, - 0x39e183, - 0x31d988, - 0x29ffc4, - 0x2572ccc7, - 0x25ee4846, - 0x2e4849, - 0x362008, - 0x36a408, - 0x3b6544, - 0x3c7903, - 0x22dd42, - 0x2624e782, - 0x2660fa82, - 0x3c9083, - 0x26a01642, - 0x2f8904, - 0x279986, - 0x21c103, - 0x2bc7c7, - 0x303743, - 0x32fcc8, - 0x20b885, - 0x25a683, - 0x2c2345, - 0x2c2484, - 0x30bcc6, - 0x20cac6, - 0x2198c6, - 0x2f39c4, - 0x234a03, - 0x26e0fe02, - 0x27233fc5, - 0x200843, - 0x27a07382, - 0x22d1c3, - 0x2676c5, - 0x27e32dc3, - 0x28632dc9, - 0x28a00942, - 0x29208902, - 0x28ce05, - 0x213f06, - 0x28ec06, - 0x2e6608, - 0x2e660b, - 0x339c8b, - 0x3b93c5, - 0x2d6149, - 0x1600b42, - 0x2f0548, - 0x206984, - 0x29a03c42, - 0x34a843, - 0x2a25c986, - 0x3c2888, - 0x2a6142c2, - 0x35c708, - 0x2aaaac82, - 0x337f8a, - 0x2aedb383, - 0x2b776c86, - 0x392488, - 0x214886, - 0x387b87, - 0x243147, - 0x3c33ca, - 0x247604, - 0x360704, - 0x376209, - 0x2bba9dc5, - 0x26e286, - 0x210e03, - 0x24e3c4, - 0x2be196c4, - 0x3458c7, - 0x2c241c87, - 0x294f84, - 0x39f545, - 0x262548, - 0x39e647, - 0x3a24c7, - 0x2c60dec2, - 0x29cf44, - 0x293048, - 0x246d84, - 0x24b904, - 0x24bcc5, - 0x24be07, - 0x2ca7ebc9, - 0x2232c4, - 0x24d789, - 0x24d9c8, - 0x24e144, - 0x24e147, - 0x2ce4e583, - 0x24ea87, - 0x2d20bb42, - 0x16b8842, - 0x24fa46, - 0x250087, - 0x250704, - 0x251d07, - 0x253787, - 0x253f83, - 0x22dec2, - 0x20d982, - 0x303243, - 0x3c6704, - 0x3c670b, - 0x2d703248, - 0x25a044, - 0x255b85, - 0x257407, - 0x2e92c5, - 0x33144a, - 0x259f83, - 0x2da05dc2, - 0x208e04, - 0x25c589, - 0x260c03, - 0x260cc7, - 0x240749, - 0x205dc8, - 0x22af03, - 0x27b3c7, - 0x27be89, - 0x225583, - 0x283b84, - 0x284d09, - 0x28b2c6, - 0x2f4103, - 0x2015c2, - 0x23c903, - 0x2b8647, - 0x23c905, - 0x3b1686, - 0x270744, - 0x35ff85, - 0x27c7c3, - 0x212706, - 0x292503, - 0x206882, - 0x248f84, - 0x2de299c2, - 0x2e2299c3, - 0x2e607082, - 0x248343, - 0x211cc4, - 0x2ece07, - 0x2946c6, - 0x262302, - 0x2ea5cd82, - 0x30a9c4, - 0x2f20d842, - 0x2f616902, - 0x2ef084, - 0x2ef085, - 0x302c85, - 0x35ef86, - 0x2fa0f582, - 0x39b745, - 0x3ba745, - 0x283483, - 0x20f586, - 0x20fec5, - 0x220cc2, - 0x35b3c5, - 0x220cc4, - 0x223d03, - 0x223f43, - 0x2fe05b42, - 0x2e29c7, - 0x24dbc4, - 0x24dbc9, - 0x24e2c4, - 0x2833c3, - 0x2b61c8, - 0x302833c4, - 0x2833c6, - 0x2a37c3, - 0x256303, - 0x308003, - 0x306f7642, - 0x309442, - 0x30a00642, - 0x335408, - 0x36af48, - 0x3b7906, - 0x3830c5, - 0x22c805, - 0x204287, - 0x30e77185, - 0x23c782, - 0x3129b602, - 0x31600042, - 0x2cfb88, - 0x3ae105, - 0x2fc7c4, - 0x244c85, - 0x2547c7, - 0x3a3884, - 0x242ac2, - 0x31a11442, - 0x351144, - 0x220a87, - 0x28ddc7, - 0x378804, - 0x3cd483, - 0x290e44, - 0x290e48, - 0x22f7c6, - 0x25254a, - 0x326584, - 0x299288, - 0x234184, - 0x2214c6, - 0x29b5c4, - 0x2f3546, - 0x24de89, - 0x2a9fc7, - 0x207543, - 0x31e3ee42, - 0x3b62c3, - 0x209e42, - 0x32204702, - 0x349e46, - 0x381988, - 0x2abfc7, - 0x228b09, - 0x2b1549, - 0x2ad505, - 0x2afc09, - 0x2b0405, - 0x2b1245, - 0x2b1f88, - 0x32608784, - 0x32a540c7, - 0x22d803, - 0x2b2187, - 0x22d806, - 0x2b25c7, - 0x2a9ac5, - 0x22d083, - 0x32e315c2, - 0x20b344, - 0x3320e782, - 0x33606502, - 0x380e86, - 0x2d04c5, - 0x2b54c7, - 0x343a03, - 0x35cb04, - 0x209283, - 0x2cd743, - 0x33a06182, - 0x34205bc2, - 0x38b244, - 0x22de83, - 0x3047c5, - 0x34600f42, - 0x34e01f02, - 0x304fc6, - 0x201f04, - 0x306bc4, - 0x306bca, - 0x356005c2, - 0x213903, - 0x21884a, - 0x21bac8, - 0x35a21dc4, - 0x2005c3, - 0x35e96b43, - 0x237909, - 0x22e0c9, - 0x2bc8c6, - 0x3621bc83, - 0x21bc85, - 0x222f8d, - 0x226586, - 0x26518b, - 0x3660ccc2, - 0x205708, - 0x3a217782, - 0x3a605382, - 0x2bad85, - 0x3aa04582, - 0x2b3307, - 0x210083, - 0x210088, - 0x3ae07882, - 0x288304, - 0x20c743, - 0x33b805, - 0x23fb46, - 0x224004, - 0x398983, - 0x2b9583, - 0x3b201d82, - 0x3b9344, - 0x3d4c45, - 0x2b8247, - 0x279403, - 0x2b8e43, - 0x16b9102, - 0x2b9103, - 0x2b9503, - 0x3b600e02, - 0x3473c4, - 0x251106, - 0x2e42c3, - 0x2b9c03, - 0x3ba49582, - 0x249588, - 0x2bab84, - 0x347146, - 0x255707, - 0x284646, - 0x29ff44, - 0x49e03fc2, - 0x22d6cb, - 0x2ff50e, - 0x216d8f, - 0x39d6c3, - 0x4a65ac42, - 0x161fb02, - 0x4aa0af02, - 0x2928c3, - 0x2108c3, - 0x20af06, - 0x21d306, - 0x34dec7, - 0x310c44, - 0x4ae14042, - 0x4b20bd82, - 0x2e0685, - 0x2ff987, - 0x2bb206, - 0x4b662702, - 0x384c44, - 0x2c03c3, - 0x4ba01e42, - 0x4bf73103, - 0x2c2984, - 0x2c8009, - 0x4c2ced42, - 0x4c614d42, - 0x344945, - 0x4cad3942, - 0x4ce06002, - 0x35f947, - 0x3768cb, - 0x242f05, - 0x258109, - 0x26aa86, - 0x4d209504, - 0x295449, - 0x2d46c7, - 0x3dea87, - 0x22c343, - 0x2eef06, - 0x324047, - 0x25cc03, - 0x2a6a86, - 0x4da1ae42, - 0x4de33042, - 0x3b6403, - 0x38b885, - 0x21f407, - 0x236146, - 0x23c885, - 0x24db44, - 0x2a8985, - 0x38dac4, - 0x4e202482, - 0x2cc844, - 0x22dfc4, - 0x22dfcd, - 0x377189, - 0x22c648, - 0x344bc4, - 0x328845, - 0x3b8c47, - 0x3c5cc4, - 0x265907, - 0x2e4005, - 0x4e6ac604, - 0x2bf345, - 0x25f8c4, - 0x3a39c6, - 0x3973c5, - 0x4ea05442, - 0x26e903, - 0x267fc3, - 0x348cc4, - 0x348cc5, - 0x396886, - 0x23c9c5, - 0x22ae84, - 0x329743, - 0x4ee1a286, - 0x221fc5, - 0x222a85, - 0x323544, - 0x2f6283, - 0x32660c, - 0x4f208b02, - 0x4f605102, - 0x4fa02042, - 0x21a8c3, - 0x21a8c4, - 0x4fe08282, - 0x30e1c8, - 0x3b1745, - 0x2d3b84, - 0x23af86, - 0x50223502, - 0x5061b542, - 0x50a00c42, - 0x290c05, - 0x2f3886, - 0x219604, - 0x39a0c6, - 0x362dc6, - 0x211183, - 0x50ea240a, - 0x2795c5, - 0x350503, - 0x222446, - 0x3d2d09, - 0x222447, - 0x2b4d08, - 0x32f0c9, - 0x2adfc8, - 0x227d46, - 0x2105c3, - 0x512017c2, - 0x39fa08, - 0x51601f42, - 0x51a09e82, - 0x2137c3, - 0x2ec0c5, - 0x29f2c4, - 0x2fe389, - 0x2898c4, - 0x24aec8, - 0x52209e83, - 0x52696ec4, - 0x213f48, - 0x22df07, - 0x52b3d642, - 0x238442, - 0x32a385, - 0x37fc49, - 0x23c803, - 0x27e384, - 0x31d284, - 0x210943, - 0x27f28a, - 0x52e03f82, - 0x5320b182, - 0x2d5b43, - 0x390883, - 0x1627f82, - 0x374583, - 0x5361d542, - 0x53a00bc2, - 0x53f06c44, - 0x3d7846, - 0x26bbc4, - 0x277d83, - 0x281c83, - 0x54200bc3, - 0x23f7c6, - 0x208405, - 0x2d9ac7, - 0x2d9a06, - 0x2dab48, - 0x2dad46, - 0x20e944, - 0x2a0f0b, - 0x2dd603, - 0x2dd605, - 0x20f002, - 0x35fc42, - 0x54645402, - 0x54a02382, - 0x202383, - 0x54e6c9c2, - 0x26c9c3, - 0x2de083, - 0x55622902, - 0x55ae2406, - 0x258946, - 0x55e05902, - 0x5620a742, - 0x56623f82, - 0x56a15402, - 0x56e18482, - 0x57202802, - 0x214e83, - 0x385546, - 0x57619a04, - 0x213a4a, - 0x3a4986, - 0x20da84, - 0x204643, - 0x5820ce02, - 0x208482, - 0x23a0c3, - 0x5861a3c3, - 0x3bd287, - 0x3972c7, - 0x5aed3087, - 0x344407, - 0x228643, - 0x22864a, - 0x262044, - 0x31afc4, - 0x31afca, - 0x22cb45, - 0x5b21bb02, - 0x24fa03, - 0x5b600602, - 0x24e283, - 0x3b6283, - 0x5be00582, - 0x38a8c4, - 0x204484, - 0x3c2d05, - 0x3dd205, - 0x26a146, - 0x306e06, - 0x5c230a42, - 0x5c602902, - 0x310805, - 0x258652, - 0x35e586, - 0x207283, - 0x359106, - 0x2bf805, - 0x16535c2, - 0x64a0a9c2, - 0x372b43, - 0x20a9c3, - 0x292083, - 0x64e06e42, - 0x210e83, - 0x6521ad42, - 0x276e43, - 0x24b188, - 0x2624c3, - 0x2ad386, - 0x3cfc87, - 0x321486, - 0x32148b, - 0x20d9c7, - 0x31d784, - 0x65a00c02, - 0x3b15c5, - 0x65e08443, - 0x26d243, - 0x3b29c5, - 0x33f243, - 0x6673f246, - 0x3cac0a, - 0x2a7083, - 0x2366c4, - 0x2003c6, - 0x2af186, - 0x66a42543, - 0x299047, - 0x237807, - 0x2a2c85, - 0x2e4406, - 0x222003, - 0x6960f7c3, - 0x69a00a82, - 0x69e0f044, - 0x3df689, - 0x21d685, - 0x356cc4, - 0x355b48, - 0x264bc5, - 0x6a231ac5, - 0x241f49, - 0x202503, - 0x33da04, - 0x6a614282, - 0x214283, - 0x6aa57b82, - 0x257b86, - 0x1677282, - 0x6ae15302, - 0x290b08, - 0x290e03, - 0x2bf287, - 0x2b9605, - 0x2b9185, - 0x2b918b, - 0x2eec86, - 0x2b9386, - 0x27d384, - 0x2efa86, - 0x6b321708, - 0x27fd03, - 0x265f03, - 0x265f04, - 0x2ed8c4, - 0x2f6a07, - 0x315645, - 0x6b72a5c2, - 0x6ba0a882, - 0x6c21bfc5, - 0x2c1044, - 0x2e0a0b, - 0x2f7688, - 0x253604, - 0x6c62c4c2, - 0x6ca1b742, - 0x3ba2c3, - 0x2f9484, - 0x2f9745, - 0x2fa147, - 0x6cefc304, - 0x378904, - 0x6d2141c2, - 0x37ab09, - 0x2fd745, - 0x2431c5, - 0x2fe2c5, - 0x6d6141c3, - 0x237f04, - 0x237f0b, - 0x2fedc4, - 0x2ff08b, - 0x3001c5, - 0x216eca, - 0x301708, - 0x30190a, - 0x3021c3, - 0x3021ca, - 0x6de11e42, - 0x6e214b42, - 0x6e615d43, - 0x6eadbd02, - 0x3068c3, - 0x6eef6702, - 0x6f333e42, - 0x309004, - 0x2177c6, - 0x399e05, - 0x30a643, - 0x298046, - 0x399905, - 0x3573c4, - 0x6f600902, - 0x299ec4, - 0x2d5dca, - 0x2ba807, - 0x33f5c6, - 0x234207, - 0x23e343, - 0x2c29c8, - 0x3d21cb, - 0x2bc9c5, - 0x2c8b85, - 0x2c8b86, - 0x34cb84, - 0x38ab88, - 0x21aa43, - 0x26ee44, - 0x3c3747, - 0x31d3c6, - 0x380b86, - 0x2c324a, - 0x24d804, - 0x31c0ca, - 0x6fb12606, - 0x312607, - 0x255c07, - 0x2a9a04, - 0x34a189, - 0x238dc5, - 0x307a4b, - 0x2f6603, - 0x20cc83, - 0x6fe1e243, - 0x22fb84, - 0x70200682, - 0x307e06, - 0x706c60c5, - 0x359345, - 0x24fc86, - 0x2a4944, - 0x70a013c2, - 0x241e84, - 0x70e0ca42, - 0x2160c5, - 0x3b2e44, - 0x71a1c5c3, - 0x71e0aa02, - 0x20aa03, - 0x21f646, - 0x72205142, - 0x393d08, - 0x2222c4, - 0x2222c6, - 0x391106, - 0x726574c4, - 0x21a205, - 0x356d88, - 0x3577c7, - 0x2ae247, - 0x2ae24f, - 0x292f46, - 0x23d183, - 0x242144, - 0x209043, - 0x221604, - 0x24e484, - 0x72a0b382, - 0x28d203, - 0x330983, - 0x72e090c2, - 0x215803, - 0x220f03, - 0x20e2ca, - 0x273847, - 0x25284c, - 0x73252b06, - 0x252c86, - 0x255407, - 0x7362e987, - 0x25a749, - 0x308784, - 0x73a5be04, - 0x73e023c2, - 0x742045c2, - 0x2c3606, - 0x298e44, - 0x28d686, - 0x22ee08, - 0x38b944, - 0x2eafc6, - 0x28ebc5, - 0x74750788, - 0x242343, - 0x3a6b85, - 0x3aa603, - 0x2432c3, - 0x2432c4, - 0x208dc3, - 0x74a499c2, - 0x74e02d42, - 0x2f64c9, - 0x290d05, - 0x291604, - 0x29ab05, - 0x206a84, - 0x286707, - 0x35a685, - 0x7523e804, - 0x2db988, - 0x2dcdc6, - 0x2e2d44, - 0x2e6e08, - 0x2e7447, - 0x75607842, - 0x2ef184, - 0x314cc4, - 0x2c9247, - 0x75a07844, - 0x24a682, - 0x75e02f82, - 0x210883, - 0x2e5ac4, - 0x299943, - 0x2b2cc5, - 0x7622ae42, - 0x309345, - 0x23c7c2, - 0x30f885, - 0x23c7c5, - 0x76607242, - 0x327704, - 0x76a071c2, - 0x33d486, - 0x2c8686, - 0x37fd88, - 0x2c9c08, - 0x380e04, - 0x3cdb05, - 0x310389, - 0x2f0684, - 0x3cabc4, - 0x288b03, - 0x26c703, - 0x76f02905, - 0x3829c5, - 0x283644, - 0x359b4d, - 0x294ec2, - 0x376403, - 0x77206382, - 0x77603242, - 0x3937c5, - 0x24b447, - 0x224244, - 0x32f2c9, - 0x2d5f09, - 0x2770c3, - 0x2770c8, - 0x312b09, - 0x21e7c7, - 0x77a08805, - 0x396406, - 0x3a06c6, - 0x3a8645, - 0x377285, - 0x77e01bc2, - 0x27a585, - 0x2bd4c8, - 0x2cb646, - 0x783b4347, - 0x2cf3c4, - 0x2da987, - 0x30b306, - 0x78601082, - 0x396586, - 0x30ef0a, - 0x30f785, - 0x78af00c2, - 0x78e11102, - 0x365486, - 0x211108, - 0x7928df87, - 0x79601402, - 0x214b83, - 0x3c0706, - 0x2caac4, - 0x346ac6, - 0x271ac6, - 0x26930a, - 0x2047c5, - 0x286f06, - 0x384643, - 0x384644, - 0x79a35002, - 0x2869c3, - 0x79e1a902, - 0x2ea903, - 0x7a218ac4, - 0x211244, - 0x7a61124a, - 0x21bd03, - 0x237ac7, - 0x313146, - 0x33c284, - 0x20d942, - 0x2aad42, - 0x7aa007c2, - 0x226e83, - 0x2559c7, - 0x2007c7, - 0x285d84, - 0x3da107, - 0x2fa246, - 0x210d47, - 0x220e44, - 0x2ae145, - 0x205345, - 0x7ae1e502, - 0x3d7286, - 0x220383, - 0x2266c2, - 0x2266c6, - 0x7b21f3c2, - 0x7b633442, - 0x29d005, - 0x7ba02c02, - 0x7be02982, - 0x324605, - 0x2d7505, - 0x2ac745, - 0x7c65b003, - 0x279a45, - 0x2eed47, - 0x36cc85, - 0x204985, - 0x261f44, - 0x264a46, - 0x38e104, - 0x7ca008c2, - 0x7d793085, - 0x3cb087, - 0x3c0bc8, - 0x253c46, - 0x253c4d, - 0x262d49, - 0x262d52, - 0x37a385, - 0x37ae03, - 0x7da09d42, - 0x3027c4, - 0x226603, - 0x3cb985, - 0x310f85, - 0x7de0c782, - 0x25a6c3, - 0x7e226dc2, - 0x7ea1d602, - 0x7ee00082, - 0x2e9bc5, - 0x207643, - 0x7f205b02, - 0x7f60c2c2, - 0x38a886, - 0x2d020a, - 0x215003, - 0x2579c3, - 0x2ff8c3, - 0x80e01b82, - 0x8f20c1c2, - 0x8fa0a5c2, - 0x203642, - 0x3ce689, - 0x2ce144, - 0x2dfac8, - 0x8ff04382, - 0x90606482, - 0x3bd905, - 0x233c88, - 0x231148, - 0x2f738c, - 0x2398c3, - 0x90a075c2, - 0x90e00f02, - 0x24ac46, - 0x313fc5, - 0x295b43, - 0x254686, - 0x314106, - 0x296b03, - 0x314c03, - 0x315046, - 0x316884, - 0x29cc86, - 0x23cd44, - 0x316f44, - 0x31784a, - 0x912b7402, - 0x24e705, - 0x3193ca, - 0x319305, - 0x31a7c4, - 0x31a8c6, - 0x31aa44, - 0x214546, - 0x91602b42, - 0x24c5c6, - 0x33bf85, - 0x286d87, - 0x33a106, - 0x255604, - 0x2e3407, - 0x234f85, - 0x23b687, - 0x3bc247, - 0x3bc24e, - 0x278646, - 0x222705, - 0x207787, - 0x20a783, - 0x3d3a47, - 0x20ab85, - 0x2123c4, - 0x22a8c2, - 0x325ec7, - 0x310cc4, - 0x23dec4, - 0x284a4b, - 0x21cb83, - 0x2c4907, - 0x21cb84, - 0x2c4c07, - 0x3a6603, - 0x34e40d, - 0x3a2f88, - 0x91a292c4, - 0x23e705, - 0x31b805, - 0x31bc43, - 0x91e221c2, - 0x31d1c3, - 0x31e083, - 0x3d7404, - 0x27bf85, - 0x220407, - 0x3846c6, - 0x38d943, - 0x22680b, - 0x249b8b, - 0x2acfcb, - 0x2c174b, - 0x3ccd4a, - 0x31734b, - 0x36ea8b, - 0x394e0c, - 0x3ada0b, - 0x3bf811, - 0x3dcf4a, - 0x31f58b, - 0x31f84c, - 0x31fb4b, - 0x3200ca, - 0x3209ca, - 0x3221ce, - 0x32294b, - 0x322c0a, - 0x324751, - 0x324b8a, - 0x32508b, - 0x3255ce, - 0x326c8c, - 0x32784b, - 0x327b0e, - 0x327e8c, - 0x328bca, - 0x329d4c, - 0x9232a04a, - 0x32a808, - 0x32b3c9, - 0x32ce8a, - 0x32d10a, - 0x32d38b, - 0x33010e, - 0x3316d1, - 0x33e209, - 0x33e44a, - 0x33ee8b, - 0x33fc0d, - 0x340a8a, - 0x341616, - 0x34298b, - 0x34668a, - 0x347d0a, - 0x3490cb, - 0x34aa49, - 0x34ed89, - 0x34f30d, - 0x34fe0b, - 0x351c8b, - 0x352509, - 0x352b4e, - 0x35328a, - 0x353dca, - 0x35438a, - 0x354a0b, - 0x35524b, - 0x3585cd, - 0x35a18d, - 0x35b050, - 0x35b50b, - 0x35ce4c, - 0x35d98b, - 0x35f44b, - 0x360c4e, - 0x36128b, - 0x36128d, - 0x3663cb, - 0x366e4f, - 0x36720b, - 0x36860a, - 0x368e49, - 0x369509, - 0x9276988b, - 0x369b4e, - 0x369ece, - 0x36be8b, - 0x36d64f, - 0x370acb, - 0x370d8b, - 0x37104b, - 0x37164a, - 0x3764c9, - 0x37964f, - 0x37e24c, - 0x37f30c, - 0x38058e, - 0x3810cf, - 0x38148e, - 0x381e50, - 0x38224f, - 0x382b4e, - 0x38320c, - 0x383511, - 0x383952, - 0x3856d1, - 0x385dce, - 0x38620b, - 0x38620e, - 0x38658f, - 0x38694e, - 0x386cd3, - 0x387191, - 0x3875cc, - 0x3878ce, - 0x387d4c, - 0x388293, - 0x388a90, - 0x389b8c, - 0x389e8c, - 0x38a34b, - 0x38ae4e, - 0x38b34b, - 0x38cb4b, - 0x38ddcc, - 0x39424a, - 0x39460c, - 0x39490c, - 0x394c09, - 0x396a0b, - 0x396cc8, - 0x397509, - 0x39750f, - 0x3991cb, - 0x92b9a54a, - 0x39bd0c, - 0x39cccb, - 0x39cf89, - 0x39d348, - 0x39da4b, - 0x39df4b, - 0x39eb8a, - 0x39ee0b, - 0x39f78c, - 0x3a0149, - 0x3a0388, - 0x3a3d0b, - 0x3a6f4b, - 0x3a91ce, - 0x3aaf4b, - 0x3ad38b, - 0x3bbdcb, - 0x3bc089, - 0x3bc5cd, - 0x3cbe4a, - 0x3cf5d7, - 0x3d18d8, - 0x3d5909, - 0x3d6b0b, - 0x3d79d4, - 0x3d7ecb, - 0x3d844a, - 0x3d894a, - 0x3d8bcb, - 0x3da790, - 0x3dab91, - 0x3db24a, - 0x3dc54d, - 0x3dcc4d, - 0x3e06cb, - 0x3d7383, - 0x92f9b403, - 0x289b06, - 0x246085, - 0x30ccc7, - 0x2ef746, - 0x165c942, - 0x270b89, - 0x297e44, - 0x2ed408, - 0x21e183, - 0x302707, - 0x205602, - 0x2b5503, - 0x93201442, - 0x2d69c6, - 0x2d8084, - 0x38f1c4, - 0x268643, - 0x93ad3982, - 0x93e2a784, - 0x34a0c7, - 0x9422a502, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x105dc8, - 0x203dc3, - 0x2000c2, - 0x9a048, - 0x201242, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x20e2c3, - 0x337396, - 0x364d53, - 0x3d9f89, - 0x2135c8, - 0x3b1449, - 0x319546, - 0x351190, - 0x20dcd3, - 0x31d488, - 0x277e87, - 0x279e87, - 0x2a86ca, - 0x343189, - 0x267d49, - 0x2d368b, - 0x303c06, - 0x30334a, - 0x2205c6, - 0x32a4c3, - 0x2e2905, - 0x3ba348, - 0x27decd, - 0x2f330c, - 0x2ec347, - 0x30bfcd, - 0x2136c4, - 0x22fe4a, - 0x23134a, - 0x23180a, - 0x20dfc7, - 0x23cb87, - 0x240104, - 0x273506, - 0x348a44, - 0x304c08, - 0x289909, - 0x2e6606, - 0x2e6608, - 0x24360d, - 0x2d6149, - 0x392488, - 0x243147, - 0x3b27ca, - 0x250086, - 0x2fd244, - 0x212107, - 0x30800a, - 0x3ab68e, - 0x277185, - 0x3daf8b, - 0x226bc9, - 0x22e0c9, - 0x2b3147, - 0x3d090a, - 0x2c9187, - 0x2ff649, - 0x33b048, - 0x2a5e8b, - 0x2ec0c5, - 0x22c50a, - 0x223d49, - 0x295aca, - 0x20f30b, - 0x21200b, - 0x2d3415, - 0x2c8205, - 0x2431c5, - 0x237f0a, - 0x22b98a, - 0x2f5d87, - 0x233dc3, - 0x2c3588, - 0x2e0eca, - 0x2222c6, - 0x259c09, - 0x350788, - 0x2e2d44, - 0x388049, - 0x2c9c08, - 0x2ca947, - 0x393086, - 0x3cb087, - 0x2be807, - 0x23f5c5, - 0x2d314c, - 0x23e705, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x201242, - 0x214a83, - 0x21a3c3, - 0x203dc3, - 0x242543, - 0x214a83, - 0x21a3c3, - 0x3dc3, - 0x2624c3, - 0x242543, - 0x1cc203, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x9a048, - 0x201242, - 0x214a83, - 0x22ca07, - 0x86504, - 0x21a3c3, - 0x97a04, - 0x242543, - 0x201242, - 0x2052c2, - 0x3192c2, - 0x207882, - 0x201582, - 0x2eda82, - 0x908c6, - 0x50849, - 0xf3fc7, - 0x481c5c3, - 0x86107, - 0x148406, - 0x7783, - 0x11af85, - 0xc1, - 0x5214a83, - 0x232dc3, - 0x228503, - 0x308003, - 0x21bc83, - 0x23c803, - 0x2e2806, - 0x21a3c3, - 0x242543, - 0x233d43, - 0x9a048, - 0x345b44, - 0x296c87, - 0x268683, - 0x2bad84, - 0x2187c3, - 0x284d43, - 0x308003, - 0x17e707, - 0x9c4, - 0x4e83, - 0x68b05, - 0x66000c2, - 0x2703, - 0x6a01242, - 0x6c8c109, - 0x8c98d, - 0x8cccd, - 0x3192c2, - 0x21dc4, - 0x68b49, - 0x2003c2, - 0x7221cc8, - 0xfe7c4, - 0x31c843, - 0x9a048, - 0x1414882, - 0x14005c2, - 0x1414882, - 0x1517146, - 0x22f043, - 0x26f6c3, - 0x7a14a83, - 0x22fe44, - 0x7e32dc3, - 0x8b08003, - 0x206182, - 0x221dc4, - 0x21a3c3, - 0x3b1e83, - 0x204042, - 0x242543, - 0x202642, - 0x308f43, - 0x205142, - 0x2263c3, - 0x223a43, - 0x201342, - 0x9a048, - 0x22f043, - 0x3df888, - 0x83b1e83, - 0x204042, - 0x308f43, - 0x205142, - 0x86263c3, - 0x223a43, - 0x201342, - 0x252b07, - 0x232dc9, - 0x308f43, - 0x205142, - 0x2263c3, - 0x223a43, - 0x201342, - 0x214a83, - 0x16c2, - 0x32443, - 0x3c42, - 0xaac82, - 0x5cd82, - 0x17c2, - 0x1b82, - 0x43342, - 0x202703, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21bc83, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x20eb02, - 0x2141c3, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x202703, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21a3c3, - 0x242543, - 0x208805, - 0x20c782, - 0x2000c2, - 0x9a048, - 0x144ca88, - 0x12848a, - 0x308003, - 0x225cc1, - 0x2009c1, - 0x200a01, - 0x204ac1, - 0x204781, - 0x20a541, - 0x201941, - 0x225dc1, - 0x23ff81, - 0x200001, - 0x2000c1, - 0x200201, - 0x139b05, - 0x9a048, - 0x200101, - 0x201301, - 0x200501, - 0x205dc1, - 0x200041, - 0x200801, - 0x200181, - 0x200e01, - 0x200701, - 0x2004c1, - 0x200bc1, - 0x200581, - 0x2003c1, - 0x200a81, - 0x215481, - 0x200401, - 0x200741, - 0x2007c1, - 0x200081, - 0x200f01, - 0x201341, - 0x204f01, - 0x201b41, - 0x201441, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x201242, - 0x214a83, - 0x232dc3, - 0x2003c2, - 0x242543, - 0x1bf83, - 0x17e707, - 0xd1407, - 0x28886, - 0x34b8a, - 0x8b848, - 0x54e08, - 0x558c7, - 0x174586, - 0xea585, - 0x97805, - 0x125483, - 0x11ec6, - 0x365c6, - 0x2d3684, - 0x328147, - 0x9a048, - 0x2e3504, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x1242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x32a248, - 0x204244, - 0x232d04, - 0x229904, - 0x24ab47, - 0x2e0007, - 0x214a83, - 0x235b4b, - 0x29650a, - 0x33c147, - 0x23bc48, - 0x33b888, - 0x232dc3, - 0x287847, - 0x228503, - 0x206f88, - 0x2130c9, - 0x221dc4, - 0x21bc83, - 0x23b248, - 0x23c803, - 0x2dd74a, - 0x2e2806, - 0x3a4987, - 0x21a3c3, - 0x267906, - 0x26f548, - 0x242543, - 0x24d446, - 0x2f78cd, - 0x2f9e08, - 0x2fedcb, - 0x20eb46, - 0x24b347, - 0x2225c5, - 0x21674a, - 0x308245, - 0x3828ca, - 0x20c782, - 0x207783, - 0x23dec4, - 0x200006, - 0x3b05c3, - 0x299f43, - 0x27ee03, - 0x204243, - 0x296183, - 0x2041c2, - 0x355dc5, - 0x2ad8c9, - 0x23fc43, - 0x220dc3, - 0x21fdc3, - 0x200201, - 0x2f0447, - 0x2e9905, - 0x3b5c03, - 0x3d6d83, - 0x229904, - 0x343a43, - 0x20ff88, - 0x35d143, - 0x30d98d, - 0x278708, - 0x3dfa46, - 0x286a03, - 0x361583, - 0x38e083, - 0xce14a83, - 0x232608, - 0x235b44, - 0x240983, - 0x200106, - 0x243d88, - 0x27b0c3, - 0x216783, - 0x22d1c3, - 0x232dc3, - 0x21afc3, - 0x2532c3, - 0x283603, - 0x286983, - 0x2cbf83, - 0x2196c3, - 0x38b5c5, - 0x250804, - 0x251987, - 0x22dec2, - 0x254483, - 0x257d06, - 0x2592c3, - 0x25a283, - 0x277083, - 0x374e43, - 0x345843, - 0x29c047, - 0xd308003, - 0x2425c3, - 0x286a43, - 0x206c03, - 0x21bac3, - 0x24c903, - 0x20ef85, - 0x373c83, - 0x200e09, - 0x20bb83, - 0x311283, - 0xd63c883, - 0x2d3b03, - 0x219208, - 0x2ad806, - 0x374c06, - 0x2b7106, - 0x389147, - 0x227d43, - 0x2137c3, - 0x23c803, - 0x28b946, - 0x20f002, - 0x267d83, - 0x353145, - 0x21a3c3, - 0x319e87, - 0x1603dc3, - 0x202903, - 0x2089c3, - 0x21fec3, - 0x26d243, - 0x242543, - 0x209006, - 0x3b5f86, - 0x37a243, - 0x2f8a83, - 0x2141c3, - 0x220ec3, - 0x314c83, - 0x305fc3, - 0x309303, - 0x399905, - 0x22b983, - 0x39f446, - 0x2d1cc8, - 0x20cc83, - 0x20cc89, - 0x298948, - 0x223488, - 0x229a85, - 0x22f18a, - 0x23818a, - 0x239b4b, - 0x23b808, - 0x398943, - 0x38da83, - 0x30a583, - 0x326f48, - 0x376dc3, - 0x384644, - 0x235002, - 0x25ca83, - 0x2007c3, - 0x356c43, - 0x263343, - 0x233d43, - 0x20c782, - 0x229e43, - 0x2398c3, - 0x3172c3, - 0x318284, - 0x23dec4, - 0x20fe43, - 0x9a048, - 0x2000c2, - 0x200ac2, - 0x2041c2, - 0x204b42, - 0x200202, - 0x204342, - 0x240702, - 0x203c42, - 0x200382, - 0x200c42, - 0x33d642, - 0x202382, - 0x26c9c2, - 0x200a82, - 0x2eda82, - 0x214282, - 0x205742, - 0x2141c2, - 0x2c1902, - 0x2069c2, - 0x200682, - 0x206f02, - 0x2013c2, - 0x2090c2, - 0x2045c2, - 0x26c702, - 0x202982, - 0xc2, - 0xac2, - 0x41c2, - 0x4b42, - 0x202, - 0x4342, - 0x40702, - 0x3c42, - 0x382, - 0xc42, - 0x13d642, - 0x2382, - 0x6c9c2, - 0xa82, - 0xeda82, - 0x14282, - 0x5742, - 0x141c2, - 0xc1902, - 0x69c2, - 0x682, - 0x6f02, - 0x13c2, - 0x90c2, - 0x45c2, - 0x6c702, - 0x2982, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x7782, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x1242, - 0x201242, - 0x242543, - 0xee14a83, - 0x308003, - 0x23c803, - 0x1b4103, - 0x22aec2, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x3dc3, - 0x1b4103, - 0x242543, - 0x1442, - 0x2001c2, - 0x15c45c5, - 0x139b05, - 0x20b3c2, - 0x9a048, - 0x1242, - 0x2347c2, - 0x206782, - 0x204642, - 0x21bb02, - 0x230a42, - 0x97805, - 0x202f42, - 0x204042, - 0x206e42, - 0x205e42, - 0x214282, - 0x23fcc2, - 0x202f82, - 0x292882, - 0xfe98384, - 0x142, - 0x17e707, - 0x12380d, - 0xea609, - 0x115e0b, - 0xeec08, - 0x65dc9, - 0x111b86, - 0x308003, - 0x9a048, - 0x9c4, - 0x4e83, - 0x68b05, - 0x9a048, - 0xe5a47, - 0x56306, - 0x68b49, - 0x1d134e, - 0x14a887, - 0x2000c2, - 0x2d3684, - 0x201242, - 0x214a83, - 0x2052c2, - 0x232dc3, - 0x1bb43, - 0x200382, - 0x2e3504, - 0x21bc83, - 0x201f42, - 0x21a3c3, - 0x30a42, - 0x2003c2, - 0x242543, - 0x2431c6, - 0x32d94f, - 0x602, - 0x725e43, - 0x2f294a, - 0x9a048, - 0x201242, - 0x228503, - 0x308003, - 0x23c803, - 0x3dc3, - 0x1467206, - 0x1d1348, - 0x141650b, - 0x156518a, - 0xf1fc9, - 0x15d024a, - 0x1511707, - 0xa878b, - 0x10b7c5, - 0xebbc5, - 0x119bc9, - 0x139b05, - 0x17e707, - 0xfbfc4, - 0x201242, - 0x214a83, - 0x308003, - 0x21a3c3, - 0x2000c2, - 0x200c82, - 0x2019c2, - 0x13214a83, - 0x23d342, - 0x232dc3, - 0x20bb42, - 0x2299c2, - 0x308003, - 0x23c782, - 0x25d282, - 0x22a742, - 0x200cc2, - 0x290602, - 0x200802, - 0x200d82, - 0x23ee42, - 0x27b8c2, - 0x204702, - 0x1b19cc, - 0x2b8e42, - 0x252e82, - 0x2203c2, - 0x248642, - 0x23c803, - 0x200bc2, - 0x21a3c3, - 0x243802, - 0x249b42, - 0x242543, - 0x308c82, - 0x2090c2, - 0x2023c2, - 0x202d42, - 0x207242, - 0x2f00c2, - 0x21e502, - 0x226dc2, - 0x223fc2, - 0x322c0a, - 0x36860a, - 0x39abca, - 0x3e0d02, - 0x210702, - 0x20ef42, - 0x1376fcc9, - 0x13b5cbca, - 0x142e307, - 0x13e026c2, - 0x14fe3c3, - 0x4a82, - 0x15cbca, - 0x15dc0e, - 0x24c0c4, - 0x572c5, - 0x14614a83, - 0x3dc83, - 0x232dc3, - 0x24d9c4, - 0x308003, - 0x221dc4, - 0x21bc83, - 0x137a89, - 0x68006, - 0x23c803, - 0xefa04, - 0x4743, - 0x21a3c3, - 0x1df105, - 0x203dc3, - 0x242543, - 0x1464b04, - 0x22b983, - 0x11b504, - 0x207783, - 0x9a048, - 0x1521403, - 0x125d86, - 0x1574504, - 0x68445, - 0x14a64a, - 0x129cc2, - 0x1500160d, - 0x1a6286, - 0x15291, - 0x1576fcc9, - 0x684c8, - 0x62888, - 0x1c12c707, - 0x1182, - 0x16fe47, - 0x2380e, - 0x139b0b, - 0x13f10b, - 0x1b3d4a, - 0x29907, - 0x9a048, - 0x11c988, - 0x7bc7, - 0x1c4169cb, - 0x1bf87, - 0xcd42, - 0x26ccd, - 0x1c2a07, - 0xaed8a, - 0x1d92cf, - 0x6738f, - 0x167c2, - 0x1242, - 0x83548, - 0x1c8f48cc, - 0xe770a, - 0xe554a, - 0x18990a, - 0x78508, - 0x8d08, - 0x5aa88, - 0xe5a08, - 0x145e88, - 0x2a42, - 0x1c464f, - 0xc134b, - 0x79108, - 0x25687, - 0x14474a, - 0x2490b, - 0x33249, - 0x46e07, - 0x8c08, - 0x3834c, - 0x15c087, - 0x1a67ca, - 0x106c8, - 0x2888e, - 0x2904e, - 0x2974b, - 0x2aa8b, - 0x15748b, - 0x14bf09, - 0xe3b0b, - 0xec58d, - 0x1261cb, - 0x30b4d, - 0x30ecd, - 0x3640a, - 0x3dd0b, - 0x3e54b, - 0x46405, - 0x1cd79a10, - 0x199e8f, - 0x9854f, - 0x63c4d, - 0x137c50, - 0xaac82, - 0x1d20c388, - 0xd1288, - 0xe8090, - 0xcf48e, - 0x1d75d105, - 0x4d1cb, - 0x136b90, - 0x8e0a, - 0x2ac49, - 0x61487, - 0x617c7, - 0x61987, - 0x61d07, - 0x631c7, - 0x63407, - 0x65587, - 0x65ac7, - 0x66007, - 0x66387, - 0x66a47, - 0x66c07, - 0x66dc7, - 0x66f87, - 0x69a47, - 0x6a407, - 0x6ac07, - 0x6afc7, - 0x6b607, - 0x6b8c7, - 0x6ba87, - 0x6bd87, - 0x6c887, - 0x6ca87, - 0x6d907, - 0x6dac7, - 0x6dc87, - 0x6f247, - 0x71247, - 0x71707, - 0x72207, - 0x724c7, - 0x72847, - 0x72a07, - 0x72e07, - 0x73247, - 0x73707, - 0x73c87, - 0x73e47, - 0x74007, - 0x74447, - 0x74ec7, - 0x75407, - 0x75987, - 0x75b47, - 0x75ec7, - 0x76407, - 0x6882, - 0x5ab8a, - 0x11cc8, - 0x1b0ecc, - 0x71b87, - 0x85805, - 0xa7951, - 0x1c0d86, - 0xfb14a, - 0x833ca, - 0x56306, - 0xb060b, - 0x642, - 0x2f7d1, - 0xbf089, - 0x9b209, - 0x9bb06, - 0x3ee42, - 0x9218a, - 0xacdc9, - 0xad50f, - 0xadb0e, - 0xaff88, - 0x6502, - 0x174a49, - 0x8a58e, - 0x1c7f0c, - 0xf1ccf, - 0x1b7a0e, - 0x3230c, - 0x41a89, - 0xd2551, - 0xd2b08, - 0x59452, - 0x62a4d, - 0x733cd, - 0x7984b, - 0x7ea95, - 0xf0c09, - 0x182f8a, - 0x1a3749, - 0x1aa210, - 0x9028b, - 0x9378f, - 0xa694b, - 0xab54c, - 0xb1b90, - 0xb4b0a, - 0xcc00d, - 0xb7ece, - 0x14db0a, - 0x1bd50c, - 0xbe4d4, - 0xbed11, - 0xc0f0b, - 0xc310f, - 0xc5f8d, - 0xc854e, - 0xca80c, - 0xcb00c, - 0xcbd0b, - 0x13ea4e, - 0x16c350, - 0xd974b, - 0xda40d, - 0xdcf0f, - 0xdf00c, - 0xe648e, - 0xf2391, - 0x10498c, - 0x1dc387, - 0x10b44d, - 0x11a00c, - 0x140cd0, - 0x15fd8d, - 0x168847, - 0x18e8d0, - 0x19d508, - 0x1a160b, - 0xb6b8f, - 0x1b1148, - 0x149d4d, - 0x10f810, - 0x17e609, - 0x1db799c8, - 0x1deb9c06, - 0xbaac3, - 0x15a889, - 0xc00c5, - 0x1e42, - 0x144bc9, - 0x14a34a, - 0x1e259906, - 0x145990d, - 0x1e7c2c04, - 0x57a46, - 0x1e08a, - 0x6474d, - 0x1e9df489, - 0x19a83, - 0x1175ca, - 0xe4651, - 0xe4a89, - 0xe54c7, - 0xe61c8, - 0xe68c7, - 0x71c48, - 0x1540b, - 0x12bc49, - 0xf1210, - 0xf16cc, - 0xf27c8, - 0xf4705, - 0x13b1c8, - 0x1961ca, - 0x184947, - 0x2902, - 0x1ef47415, - 0x13788a, - 0x1b2589, - 0x108a08, - 0x9cd89, - 0x46145, - 0x119d0a, - 0x8decf, - 0x10b84b, - 0xf04c, - 0x18ee12, - 0x77285, - 0x114e48, - 0xf678b, - 0xe0a11, - 0x4dcca, - 0x1f2fe185, - 0x19b18c, - 0x133e43, - 0x192286, - 0x3fcc2, - 0x10948b, - 0x109f4a, - 0x150a2cc, - 0xd1608, - 0x30d08, - 0x1f708a86, - 0x1b2f07, - 0xca42, - 0x5142, - 0x18bb50, - 0x69bc7, - 0x2ee0f, - 0x11ec6, - 0x11ed0e, - 0x94c0b, - 0x472c8, - 0x33609, - 0x13ce92, - 0x19234d, - 0x115488, - 0x115cc9, - 0x176f4d, - 0x198609, - 0x63cb, - 0x6bf08, - 0x7a688, - 0x7ce08, - 0x7d249, - 0x7d44a, - 0x8c30c, - 0x3e80a, - 0xf198a, - 0x114cc7, - 0x9994a, - 0x1c350d, - 0xd2e11, - 0x1fac8846, - 0x1cd64b, - 0x97c4c, - 0x39988, - 0x13d849, - 0x15b84d, - 0x61f50, - 0x1808cd, - 0xc2c2, - 0x4f70d, - 0x1b82, - 0xc1c2, - 0x114c0a, - 0x6e70a, - 0xfb04a, - 0x10260b, - 0x292cc, - 0x11c48a, - 0x11c70e, - 0x1d74cd, - 0x1fde0bc5, - 0x128948, - 0x1442, - 0x14239c3, - 0x15a6960e, - 0x16204b4e, - 0x16a6820a, - 0x1734630e, - 0x17b63a8e, - 0x18289d0c, - 0x142e307, - 0x142e309, - 0x14fe3c3, - 0x18b0400c, - 0x1933dfc9, - 0x19b48e89, - 0x1a353b89, - 0x4a82, - 0x69551, - 0x4a91, - 0x6814d, - 0x146251, - 0x1639d1, - 0x89c4f, - 0x103f4f, - 0x13df0c, - 0x148dcc, - 0x153acc, - 0x4b5cd, - 0x1aaa15, - 0xedc8c, - 0x1b32cc, - 0x13f810, - 0x16b10c, - 0x178fcc, - 0x1ac319, - 0x1b6959, - 0x1c1259, - 0x1da294, - 0x76d4, - 0x7d54, - 0x9754, - 0x9f94, - 0x1aa07989, - 0x1b008009, - 0x1bbb3389, - 0x15ed2d09, - 0x4a82, - 0x166d2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x16ed2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x176d2d09, - 0x4a82, - 0x17ed2d09, - 0x4a82, - 0x186d2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x18ed2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x196d2d09, - 0x4a82, - 0x19ed2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x1a6d2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x1aed2d09, - 0x4a82, - 0x1b6d2d09, - 0x4a82, - 0x1bed2d09, - 0x4a82, - 0x76ca, - 0x4a82, - 0x1400401, - 0x15285, - 0x1b3d44, - 0x14c86c3, - 0x15d6e03, - 0x14f8943, - 0x6960e, - 0x4b4e, - 0x7c80e, - 0x6820a, - 0x14630e, - 0x163a8e, - 0x89d0c, - 0x10400c, - 0x13dfc9, - 0x148e89, - 0x153b89, - 0x7989, - 0x8009, - 0x1b3389, - 0x13f8cd, - 0x9a09, - 0xa249, - 0x12f604, - 0x18ad44, - 0x1bad44, - 0x1bf004, - 0xa8a44, - 0x2cc04, - 0x3ca84, - 0x53684, - 0x11dc4, - 0x62b84, - 0x1588703, - 0x13dd87, - 0x147dc8c, - 0xf283, - 0xaac82, - 0xae8c6, - 0x1d74c3, - 0xf283, - 0x9fc83, - 0x8582, - 0x8588, - 0xe9247, - 0x12bcc7, - 0x2a42, - 0x2000c2, - 0x201242, - 0x2052c2, - 0x20dec2, - 0x200382, - 0x2003c2, - 0x205142, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21bac3, - 0x21a3c3, - 0x242543, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x21a3c3, - 0x242543, - 0xb2c3, - 0x308003, - 0x21dc4, - 0x2000c2, - 0x202703, - 0x22214a83, - 0x38b9c7, - 0x308003, - 0x21a8c3, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x21e2ca, - 0x2431c5, - 0x2141c3, - 0x233442, - 0x9a048, - 0x226d8a4a, - 0xe01, - 0x9a048, - 0x1242, - 0x131a42, - 0x22fdf20b, - 0x23227fc4, - 0x1c2b45, - 0x1805, - 0xf48c6, - 0x23601805, - 0x53bc3, - 0x94e83, - 0x9c4, - 0x4e83, - 0x68b05, - 0x139b05, - 0x9a048, - 0x1bf87, - 0x14a83, - 0x2cd0d, - 0x23e3a147, - 0x144686, - 0x24146145, - 0x1b8dd2, - 0x3a247, - 0x1d35ca, - 0x1d3488, - 0x95c7, - 0x6574a, - 0x1a7308, - 0xe2b07, - 0x1a870f, - 0x169347, - 0x53486, - 0x136b90, - 0x11dccf, - 0x1a009, - 0x57ac4, - 0x2443a30e, - 0x35509, - 0x670c6, - 0x10ecc9, - 0x18d986, - 0x1ba1c6, - 0x78ecc, - 0x24b0a, - 0x333c7, - 0x14420a, - 0x33c9, - 0xf714c, - 0x1d40a, - 0x5c30a, - 0x68b49, - 0x57a46, - 0x3348a, - 0x11634a, - 0xa430a, - 0x14fbc9, - 0xe30c8, - 0xe3346, - 0xeb54d, - 0x5390b, - 0xc0545, - 0x24b55a0c, - 0x14a887, - 0x10d1c9, - 0xbf407, - 0x10fc14, - 0x11010b, - 0x254ca, - 0x13cd0a, - 0xaabcd, - 0x1502809, - 0x11524c, - 0x115acb, - 0x106c3, - 0x106c3, - 0x28886, - 0x106c3, - 0xf48c8, - 0x155983, - 0x44ec4, - 0x53f83, - 0x335c5, - 0x146e943, - 0x50849, - 0xf678b, - 0x14df283, - 0x148406, - 0x14ecac7, - 0x1aa487, - 0x2592c5c9, - 0x1a286, - 0x173d09, - 0x2703, - 0x9a048, - 0x1242, - 0x4d9c4, - 0x88c3, - 0x8805, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x220dc3, - 0x214a83, - 0x232dc3, - 0x228503, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x29b3c3, - 0x207783, - 0x220dc3, - 0x2d3684, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x2308c3, - 0x2752c6c5, - 0x142c943, - 0x214a83, - 0x232dc3, - 0x21bb43, - 0x228503, - 0x308003, - 0x221dc4, - 0x2059c3, - 0x2137c3, - 0x23c803, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x2141c3, - 0x2821e9c3, - 0x18ed09, - 0x1242, - 0x3c0743, - 0x28e14a83, - 0x232dc3, - 0x247103, - 0x308003, - 0x223703, - 0x2137c3, - 0x242543, - 0x2f4bc3, - 0x3b9a84, - 0x9a048, - 0x29614a83, - 0x232dc3, - 0x2b0043, - 0x308003, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x22e983, - 0x9a048, - 0x29e14a83, - 0x232dc3, - 0x228503, - 0x203dc3, - 0x242543, - 0x9a048, - 0x142e307, - 0x202703, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x139b05, - 0x17e707, - 0x10fe4b, - 0xe4e84, - 0xc0545, - 0x144ca88, - 0x2a54d, - 0x2b231ac5, - 0x647c4, - 0x1242, - 0x3a83, - 0x17e505, - 0x2aec2, - 0x5e42, - 0x303dc5, - 0x9a048, - 0x106c2, - 0x1d2c3, - 0x16454f, - 0x1242, - 0x105646, - 0x2000c2, - 0x202703, - 0x214a83, - 0x308003, - 0x221dc4, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x2141c3, - 0x2aec2, - 0x32a988, - 0x2d3684, - 0x349646, - 0x353986, - 0x9a048, - 0x3373c3, - 0x2cd549, - 0x217915, - 0x1791f, - 0x214a83, - 0xd1ac7, - 0x214892, - 0x169046, - 0x1712c5, - 0x8e0a, - 0x2ac49, - 0x21464f, - 0x2e3504, - 0x224445, - 0x311050, - 0x2137c7, - 0x203dc3, - 0x31bf88, - 0x1283c6, - 0x27cfca, - 0x221c84, - 0x2fdbc3, - 0x233442, - 0x2f850b, - 0x3dc3, - 0x17cc84, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x306403, - 0x201242, - 0x89ac3, - 0x1dee04, - 0x21a3c3, - 0x242543, - 0x2ed73e05, - 0x8346, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a8c3, - 0x223d43, - 0x242543, - 0x2703, - 0x201242, - 0x214a83, - 0x232dc3, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x267c2, - 0x2000c2, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x1805, - 0xf283, - 0x2d3684, - 0x214a83, - 0x232dc3, - 0x306c44, - 0x21a3c3, - 0x242543, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x1b3089, - 0x29904, - 0x214a83, - 0x2a42, - 0x232dc3, - 0x228503, - 0x206c03, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x2982, - 0x214a83, - 0x232dc3, - 0x308003, - 0x343104, - 0x221dc4, - 0x21a3c3, - 0x242543, - 0x207783, - 0x16c2, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x2f3983, - 0x13903, - 0x1a8c3, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x322c0a, - 0x3413c9, - 0x35fb0b, - 0x3602ca, - 0x36860a, - 0x377c8b, - 0x38d74a, - 0x39424a, - 0x39abca, - 0x39ae4b, - 0x3bcfc9, - 0x3ca20a, - 0x3ca58b, - 0x3d818b, - 0x3e040a, - 0x15702, - 0x214a83, - 0x232dc3, - 0x228503, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x1558b, - 0xcf487, - 0x5b788, - 0x177084, - 0x8f308, - 0xe8006, - 0x15546, - 0x366c9, - 0x9a048, - 0x214a83, - 0x8e04, - 0x261484, - 0x202742, - 0x219a04, - 0x269045, - 0x220dc3, - 0x2d3684, - 0x214a83, - 0x235b44, - 0x232dc3, - 0x24d9c4, - 0x2e3504, - 0x221dc4, - 0x2137c3, - 0x21a3c3, - 0x242543, - 0x24f8c5, - 0x2308c3, - 0x2141c3, - 0x32bf03, - 0x23e804, - 0x325d04, - 0x373fc5, - 0x9a048, - 0x203ac4, - 0x3b5cc6, - 0x268c84, - 0x201242, - 0x38f207, - 0x3a25c7, - 0x24b904, - 0x2e92c5, - 0x35ff85, - 0x22d805, - 0x221dc4, - 0x389208, - 0x22b586, - 0x3295c8, - 0x27b905, - 0x2ec0c5, - 0x262044, - 0x242543, - 0x2fe7c4, - 0x376806, - 0x2432c3, - 0x23e804, - 0x3829c5, - 0x344b44, - 0x23acc4, - 0x233442, - 0x231d86, - 0x3aeb46, - 0x313fc5, - 0x2000c2, - 0x202703, - 0x33e01242, - 0x20c504, - 0x200382, - 0x23c803, - 0x215402, - 0x21a3c3, - 0x2003c2, - 0x2fb406, - 0x20e2c3, - 0x207783, - 0x9a048, - 0x9a048, - 0x308003, - 0x1b4103, - 0x2000c2, - 0x34a01242, - 0x308003, - 0x266d43, - 0x2059c3, - 0x227fc4, - 0x21a3c3, - 0x242543, - 0x9a048, - 0x2000c2, - 0x35201242, - 0x214a83, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x682, - 0x209d42, - 0x20c782, - 0x21a8c3, - 0x2f7103, - 0x2000c2, - 0x139b05, - 0x9a048, - 0x17e707, - 0x201242, - 0x232dc3, - 0x24d9c4, - 0x207083, - 0x308003, - 0x206c03, - 0x23c803, - 0x21a3c3, - 0x2125c3, - 0x242543, - 0x233dc3, - 0x12be53, - 0x12e714, - 0x139b05, - 0x17e707, - 0x1d35c9, - 0x10d8c6, - 0xf5ecb, - 0x28886, - 0x54c47, - 0x15aec6, - 0x649, - 0x15794a, - 0x8b70d, - 0x12350c, - 0x116cca, - 0x112988, - 0x97805, - 0x1d3608, - 0x11ec6, - 0x1c6606, - 0x365c6, - 0x602, - 0x2aac82, - 0x174ec4, - 0x9fc86, - 0x12c310, - 0x147498e, - 0x68846, - 0x6264c, - 0x36a6720b, - 0x139b05, - 0x14820b, - 0x36fc6544, - 0x1b3f07, - 0x22111, - 0x1ae28a, - 0x214a83, - 0x3727db88, - 0x656c5, - 0x19b808, - 0xca04, - 0x14a545, - 0x3755ca06, - 0xa7946, - 0xc7746, - 0x908ca, - 0x1b5c43, - 0x37a0dc84, - 0x50849, - 0x129747, - 0x1274ca, - 0x14d8949, - 0x605, - 0xec503, - 0x37e33f07, - 0x1df105, - 0x1538186, - 0x1498886, - 0xb06cc, - 0x101b88, - 0x3803fcc3, - 0xf874b, - 0x13864b, - 0x38647c0c, - 0x140a503, - 0xc2dc8, - 0xf89c5, - 0xc11c9, - 0xea803, - 0x102908, - 0x141dfc6, - 0x86107, - 0x38b5b849, - 0x19d887, - 0xebbca, - 0x39fbf648, - 0x11578d, - 0xa788, - 0xf283, - 0x1443f09, - 0x174483, - 0x28886, - 0xf48c8, - 0x11dc4, - 0x1205c5, - 0x148df83, - 0x239c7, - 0x38e239c3, - 0x393c0a06, - 0x39637f04, - 0x39b0a107, - 0xf48c4, - 0xf48c4, - 0xf48c4, - 0xf48c4, - 0x41, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x2000c2, - 0x201242, - 0x308003, - 0x206182, - 0x21a3c3, - 0x242543, - 0x20e2c3, - 0x3810cf, - 0x38148e, - 0x9a048, - 0x214a83, - 0x43bc7, - 0x232dc3, - 0x308003, - 0x21bc83, - 0x21a3c3, - 0x242543, - 0x68784, - 0x4fc4, - 0x145bc4, - 0x21c9c3, - 0x296747, - 0x203082, - 0x26ce49, - 0x200ac2, - 0x38be4b, - 0x2a1b8a, - 0x2a2889, - 0x200542, - 0x20cdc6, - 0x236a55, - 0x38bf95, - 0x2391d3, - 0x38c513, - 0x2037c2, - 0x2037c5, - 0x2037cc, - 0x27514b, - 0x276205, - 0x204b42, - 0x29d282, - 0x37bb86, - 0x201182, - 0x2c9d46, - 0x20908d, - 0x3dee8c, - 0x379a84, - 0x200882, - 0x202b02, - 0x259808, - 0x200202, - 0x205086, - 0x395a8f, - 0x205090, - 0x3a1544, - 0x236c15, - 0x239353, - 0x24d2c3, - 0x34934a, - 0x214f07, - 0x383d89, - 0x327387, - 0x220f82, - 0x200282, - 0x3beb06, - 0x205fc2, - 0x9a048, - 0x202e82, - 0x201542, - 0x20ac47, - 0x36a6c7, - 0x36a6d1, - 0x2180c5, - 0x2180ce, - 0x218e8f, - 0x20cd42, - 0x2679c7, - 0x21d008, - 0x207682, - 0x21d482, - 0x2101c6, - 0x2101cf, - 0x263710, - 0x22c042, - 0x2086c2, - 0x238c48, - 0x2086c3, - 0x25cec8, - 0x2c1bcd, - 0x215843, - 0x363208, - 0x27fc4f, - 0x28000e, - 0x33c9ca, - 0x2f5211, - 0x2f5690, - 0x300acd, - 0x300e0c, - 0x24a147, - 0x3494c7, - 0x349709, - 0x220f42, - 0x204342, - 0x25678c, - 0x256a8b, - 0x200d42, - 0x2cbec6, - 0x20b682, - 0x200482, - 0x2167c2, - 0x201242, - 0x22d204, - 0x239e07, - 0x22ba02, - 0x23f707, - 0x241247, - 0x22f142, - 0x22ec02, - 0x243a85, - 0x205582, - 0x392dce, - 0x3cae0d, - 0x232dc3, - 0x28508e, - 0x2b794d, - 0x328b03, - 0x2027c2, - 0x21fc84, - 0x24cf02, - 0x222342, - 0x38cdc5, - 0x39d187, - 0x246702, - 0x20dec2, - 0x24d5c7, - 0x250bc8, - 0x22dec2, - 0x277306, - 0x25660c, - 0x25694b, - 0x205dc2, - 0x25db0f, - 0x25ded0, - 0x25e2cf, - 0x25e695, - 0x25ebd4, - 0x25f0ce, - 0x25f44e, - 0x25f7cf, - 0x25fb8e, - 0x25ff14, - 0x260413, - 0x2608cd, - 0x2765c9, - 0x28d003, - 0x207082, - 0x31e805, - 0x3ddc86, - 0x200382, - 0x37f147, - 0x308003, - 0x200642, - 0x361608, - 0x2f5451, - 0x2f5890, - 0x201f02, - 0x28bf47, - 0x204582, - 0x271547, - 0x201e42, - 0x295749, - 0x37bb47, - 0x29ac08, - 0x35c846, - 0x24b083, - 0x24b085, - 0x233042, - 0x2004c2, - 0x3bef05, - 0x39b605, - 0x202482, - 0x21bdc3, - 0x348587, - 0x20e5c7, - 0x201842, - 0x345044, - 0x210543, - 0x31d809, - 0x210548, - 0x202042, - 0x208282, - 0x2ed207, - 0x2f5145, - 0x298bc8, - 0x2ae507, - 0x20fac3, - 0x29fb06, - 0x30094d, - 0x300ccc, - 0x305086, - 0x206782, - 0x2017c2, - 0x209e82, - 0x27facf, - 0x27fece, - 0x360007, - 0x210942, - 0x372385, - 0x372386, - 0x21d542, - 0x200bc2, - 0x28e5c6, - 0x247703, - 0x3c5d46, - 0x2d6705, - 0x2d670d, - 0x2d6f95, - 0x2d7e0c, - 0x2d818d, - 0x2d84d2, - 0x202382, - 0x26c9c2, - 0x202802, - 0x219386, - 0x3c7dc6, - 0x202902, - 0x3ddd06, - 0x206e42, - 0x296f45, - 0x201582, - 0x392f09, - 0x21ae0c, - 0x21b14b, - 0x2003c2, - 0x251d88, - 0x202942, - 0x200a82, - 0x272b46, - 0x2d2c85, - 0x200a87, - 0x227c85, - 0x257145, - 0x215542, - 0x2a3882, - 0x214282, - 0x293a87, - 0x2fb4cd, - 0x2fb84c, - 0x234307, - 0x277282, - 0x205742, - 0x3d2508, - 0x344d48, - 0x3298c8, - 0x3b1104, - 0x33ecc7, - 0x3c2c83, - 0x21b742, - 0x20cb42, - 0x2fc0c9, - 0x228c87, - 0x2141c2, - 0x272f45, - 0x214b42, - 0x20eb42, - 0x2f6e43, - 0x2f6e46, - 0x305fc2, - 0x308c02, - 0x200402, - 0x35c406, - 0x21fbc7, - 0x213fc2, - 0x200902, - 0x25cd0f, - 0x284ecd, - 0x28a98e, - 0x2b77cc, - 0x206842, - 0x206142, - 0x35c685, - 0x320b86, - 0x200b82, - 0x2069c2, - 0x200682, - 0x285244, - 0x2c1a44, - 0x384486, - 0x205142, - 0x27a207, - 0x23d903, - 0x23d908, - 0x23e108, - 0x2d23c7, - 0x24c186, - 0x207842, - 0x20b603, - 0x20b607, - 0x3a6dc6, - 0x2ee0c5, - 0x274608, - 0x2071c2, - 0x3b9447, - 0x26c702, - 0x294ec2, - 0x206382, - 0x205249, - 0x201082, - 0xcb3c8, - 0x203882, - 0x234583, - 0x204847, - 0x203282, - 0x21af8c, - 0x21b28b, - 0x305106, - 0x2ec445, - 0x202c02, - 0x202982, - 0x2c55c6, - 0x216643, - 0x342e87, - 0x291f82, - 0x2008c2, - 0x2368d5, - 0x38c155, - 0x239093, - 0x38c693, - 0x24ee47, - 0x26ee11, - 0x275590, - 0x283712, - 0x2eb111, - 0x29a208, - 0x29a210, - 0x29f38f, - 0x2a1953, - 0x2a2652, - 0x2a7d50, - 0x2b4ecf, - 0x3689d2, - 0x3a1891, - 0x3d4d53, - 0x2b9d52, - 0x2d634f, - 0x2ddd0e, - 0x2e1112, - 0x2e1fd1, - 0x2e5e0f, - 0x2e7c8e, - 0x2efbd1, - 0x2f8ed0, - 0x301d52, - 0x306491, - 0x309b50, - 0x311f8f, - 0x3cea91, - 0x347910, - 0x37b006, - 0x380cc7, - 0x218987, - 0x209f42, - 0x280f85, - 0x310dc7, - 0x20c782, - 0x2018c2, - 0x229e45, - 0x21ec03, - 0x374946, - 0x2fb68d, - 0x2fb9cc, - 0x203642, - 0x20364b, - 0x27500a, - 0x22408a, - 0x2c43c9, - 0x2fa74b, - 0x2ae64d, - 0x3114cc, - 0x35d58a, - 0x244f8c, - 0x27188b, - 0x27604c, - 0x29b68e, - 0x2bf90b, - 0x2b8a0c, - 0x2dc483, - 0x376e46, - 0x3bf642, - 0x304382, - 0x24f4c3, - 0x206482, - 0x20c3c3, - 0x324506, - 0x25e847, - 0x352386, - 0x2e78c8, - 0x348408, - 0x2cf746, - 0x200f02, - 0x31398d, - 0x313ccc, - 0x338807, - 0x316b07, - 0x234a42, - 0x2143c2, - 0x20b582, - 0x27c602, - 0x330496, - 0x335f95, - 0x3395d6, - 0x33ff53, - 0x340612, - 0x355513, - 0x358152, - 0x3acc8f, - 0x3be558, - 0x3bf117, - 0x3bfc59, - 0x3c1898, - 0x3c3c58, - 0x3c5fd7, - 0x3c6b17, - 0x3c8216, - 0x3cc693, - 0x3ccfd5, - 0x3cdd52, - 0x3ce1d3, - 0x201242, - 0x21a3c3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x20e2c3, - 0x2000c2, - 0x201602, - 0x3be933c5, - 0x3c281445, - 0x3c746bc6, - 0x9a048, - 0x3caba385, - 0x201242, - 0x2052c2, - 0x3ce871c5, - 0x3d27e985, - 0x3d680387, - 0x3da806c9, - 0x3de1f844, - 0x200382, - 0x200642, - 0x3e249a05, - 0x3e69d789, - 0x3eb2fb48, - 0x3eeb4985, - 0x3f350107, - 0x3f61d988, - 0x3fb09745, - 0x3fe9e2c6, - 0x403a2709, - 0x406db0c8, - 0x40aca648, - 0x40e9ddca, - 0x412c21c4, - 0x4168e885, - 0x41ac6c08, - 0x41f44945, - 0x20fe82, - 0x42297703, - 0x426aa1c6, - 0x42aaf5c8, - 0x42ef2f86, - 0x4320ad88, - 0x43785546, - 0x43a02c44, - 0x43e08482, - 0x446f4cc7, - 0x44ab0b04, - 0x44e79487, - 0x453cfc87, - 0x2003c2, - 0x456a2c85, - 0x45a13504, - 0x45fa3407, - 0x4623d187, - 0x466830c6, - 0x46a7f445, - 0x46e9d887, - 0x472daf48, - 0x477d0007, - 0x47b41189, - 0x47ed7505, - 0x48331207, - 0x48692a06, - 0x647cb, - 0x48b3aec8, - 0x225bcd, - 0x25d2c9, - 0x27418b, - 0x27c08b, - 0x2b014b, - 0x2f010b, - 0x320d8b, - 0x32104b, - 0x321e89, - 0x322e8b, - 0x32314b, - 0x323c8b, - 0x324e0a, - 0x32534a, - 0x32594c, - 0x32934b, - 0x329aca, - 0x33e6ca, - 0x34b30e, - 0x34d44e, - 0x34d7ca, - 0x34f64a, - 0x350c0b, - 0x350ecb, - 0x3519cb, - 0x36cdcb, - 0x36d3ca, - 0x36e08b, - 0x36e34a, - 0x36e5ca, - 0x36e84a, - 0x38e64b, - 0x39510b, - 0x397c0e, - 0x397f8b, - 0x39e8cb, - 0x39fc0b, - 0x3a3fca, - 0x3a4249, - 0x3a448a, - 0x3a5d8a, - 0x3bdf4b, - 0x3ca84b, - 0x3cb24a, - 0x3cc0cb, - 0x3d520b, - 0x3dfe4b, - 0x48e81788, - 0x4928ae89, - 0x496a5789, - 0x49aed408, - 0x3597c5, - 0x2041c3, - 0x251084, - 0x3015c5, - 0x21f586, - 0x307385, - 0x28a004, - 0x37f048, - 0x31bb05, - 0x294984, - 0x3c7607, - 0x2a4b0a, - 0x38f4ca, - 0x360107, - 0x34c207, - 0x2e6307, - 0x280947, - 0x334605, - 0x3b9b46, - 0x2f2207, - 0x39bc04, - 0x2f9b46, - 0x2f9a46, - 0x3c2d85, - 0x3b6684, - 0x29ee06, - 0x2a3bc7, - 0x34bb86, - 0x3adf47, - 0x251143, - 0x384106, - 0x238e85, - 0x280487, - 0x26a5ca, - 0x356504, - 0x219d88, - 0x31a2c9, - 0x2d4847, - 0x390606, - 0x3c5808, - 0x2f36c9, - 0x383f44, - 0x31eb84, - 0x2dea45, - 0x222b48, - 0x2d4b07, - 0x36c9c9, - 0x34cdc8, - 0x318406, - 0x264a46, - 0x29f988, - 0x36b706, - 0x281445, - 0x283186, - 0x279b88, - 0x27f9c6, - 0x255d8b, - 0x39d746, - 0x2a14cd, - 0x3d0845, - 0x2b09c6, - 0x20c045, - 0x24a789, - 0x370447, - 0x385188, - 0x291386, - 0x2a0689, - 0x3b1306, - 0x26a545, - 0x2a6dc6, - 0x2e5346, - 0x2d9209, - 0x2c0b06, - 0x2a4807, - 0x360b05, - 0x201583, - 0x21b7c5, - 0x34dd07, - 0x288f46, - 0x3d0749, - 0x346bc6, - 0x279686, - 0x20f849, - 0x282b89, - 0x2a8587, - 0x343488, - 0x2a7789, - 0x280c08, - 0x394486, - 0x2e2e85, - 0x2cfd8a, - 0x279706, - 0x33a806, - 0x2dc705, - 0x2523c8, - 0x326447, - 0x22f5ca, - 0x24e1c6, - 0x2e05c5, - 0x309186, - 0x215f87, - 0x3904c7, - 0x21c2c5, - 0x26a705, - 0x263586, - 0x269d46, - 0x26c0c6, - 0x2c70c4, - 0x282109, - 0x28bd06, - 0x30618a, - 0x2211c8, - 0x330f08, - 0x38f4ca, - 0x2af785, - 0x2a3b05, - 0x3c4f48, - 0x2c4f08, - 0x237c47, - 0x3b9d86, - 0x333988, - 0x2108c7, - 0x274848, - 0x2bebc6, - 0x283ec8, - 0x29c606, - 0x27ba87, - 0x3681c6, - 0x29ee06, - 0x2643ca, - 0x305206, - 0x2e2e89, - 0x36f506, - 0x2a5c8a, - 0x202c49, - 0x241706, - 0x2c2844, - 0x31e8cd, - 0x28b107, - 0x3b2a86, - 0x2ca505, - 0x3b1385, - 0x391106, - 0x2a7349, - 0x2bd687, - 0x27ab86, - 0x31db46, - 0x28a089, - 0x281384, - 0x244744, - 0x204088, - 0x356846, - 0x2a6ec8, - 0x318a88, - 0x2883c7, - 0x3c0549, - 0x26c2c7, - 0x2ba24a, - 0x2fcb8f, - 0x2e43ca, - 0x3d9e45, - 0x279dc5, - 0x2173c5, - 0x3c2147, - 0x215b43, - 0x343688, - 0x3de2c6, - 0x3de3c9, - 0x2f2b06, - 0x2d9047, - 0x2a0449, - 0x385088, - 0x2dc7c7, - 0x31f203, - 0x359845, - 0x215ac5, - 0x2c6f0b, - 0x344a04, - 0x23ba44, - 0x277906, - 0x31f3c7, - 0x39168a, - 0x3803c7, - 0x293607, - 0x27e985, - 0x3c8785, - 0x270489, - 0x29ee06, - 0x38024d, - 0x298b05, - 0x2bc683, - 0x226283, - 0x35c505, - 0x334285, - 0x3c5808, - 0x27b4c7, - 0x2444c6, - 0x2a5406, - 0x22a145, - 0x233087, - 0x287ec7, - 0x22b447, - 0x28e90a, - 0x3841c8, - 0x2c70c4, - 0x27f747, - 0x27d6c7, - 0x35e406, - 0x29bc87, - 0x2e9688, - 0x357b08, - 0x370346, - 0x34c448, - 0x2c0b84, - 0x2f2206, - 0x37ff46, - 0x3bbc46, - 0x204506, - 0x2a3044, - 0x280a06, - 0x2c95c6, - 0x29f1c6, - 0x245806, - 0x3d0d46, - 0x2e94c6, - 0x2443c8, - 0x2bb748, - 0x2dfcc8, - 0x307588, - 0x3c4ec6, - 0x206a05, - 0x21b786, - 0x2b4a05, - 0x393907, - 0x29d485, - 0x20d743, - 0x226305, - 0x2ed004, - 0x3d0e85, - 0x202943, - 0x395407, - 0x36c188, - 0x3ae006, - 0x37e88d, - 0x279d86, - 0x29e785, - 0x205243, - 0x2c65c9, - 0x281506, - 0x299486, - 0x292104, - 0x2e4347, - 0x35bf06, - 0x244945, - 0x23a8c3, - 0x206284, - 0x27d886, - 0x35ad44, - 0x26e588, - 0x3c7989, - 0x2bdc09, - 0x2a6cca, - 0x2a914d, - 0x361a87, - 0x3ba086, - 0x2afb04, - 0x2806c9, - 0x285b48, - 0x28ad06, - 0x234e86, - 0x29bc87, - 0x2c74c6, - 0x2261c6, - 0x287346, - 0x3cfd0a, - 0x21d988, - 0x265085, - 0x295e09, - 0x2d528a, - 0x30b048, - 0x2a34c8, - 0x299408, - 0x2b0d0c, - 0x34da05, - 0x2a5688, - 0x2bba46, - 0x372046, - 0x3db607, - 0x3802c5, - 0x283305, - 0x2bdac9, - 0x20d447, - 0x3de385, - 0x2283c7, - 0x226283, - 0x2d5745, - 0x2273c8, - 0x2d6d07, - 0x2a3389, - 0x2e2d45, - 0x380fc4, - 0x2a8e08, - 0x2c1e87, - 0x2dc988, - 0x20d188, - 0x2b1a85, - 0x20c206, - 0x2a5506, - 0x2dee09, - 0x380047, - 0x2b52c6, - 0x3de007, - 0x2027c3, - 0x21f844, - 0x2da0c5, - 0x2331c4, - 0x246744, - 0x389507, - 0x2664c7, - 0x27ad44, - 0x2a31d0, - 0x296007, - 0x3c8785, - 0x30394c, - 0x20cf44, - 0x2b9a08, - 0x27b989, - 0x3bcb46, - 0x302a48, - 0x267884, - 0x277c08, - 0x22fbc6, - 0x264248, - 0x2a4186, - 0x28ba4b, - 0x32b105, - 0x2d9f48, - 0x211b44, - 0x281e8a, - 0x2a3389, - 0x3680c6, - 0x2bbc48, - 0x259345, - 0x2c5bc4, - 0x2b9906, - 0x22b308, - 0x281788, - 0x32dc86, - 0x384404, - 0x2cfd06, - 0x26c347, - 0x279387, - 0x29bc8f, - 0x339e47, - 0x2417c7, - 0x372245, - 0x372ac5, - 0x2a8249, - 0x2ead06, - 0x389745, - 0x282e87, - 0x3db888, - 0x300805, - 0x3681c6, - 0x221008, - 0x2f2f8a, - 0x22b008, - 0x28e347, - 0x2fcfc6, - 0x295dc6, - 0x2003c3, - 0x212503, - 0x2d5449, - 0x2a7609, - 0x2b9806, - 0x2e2d45, - 0x2b0b88, - 0x2bbc48, - 0x36b888, - 0x2873cb, - 0x37eac7, - 0x31bdc9, - 0x29bf08, - 0x34f104, - 0x3bb888, - 0x28fe49, - 0x2b55c5, - 0x3c2047, - 0x21f8c5, - 0x281688, - 0x29324b, - 0x29d5d0, - 0x2b0545, - 0x211a8c, - 0x244685, - 0x27ea03, - 0x2bf706, - 0x2c8b04, - 0x368486, - 0x2a3bc7, - 0x202804, - 0x242808, - 0x34354d, - 0x318845, - 0x2a2cc4, - 0x2ae044, - 0x2b3e49, - 0x2b2308, - 0x32b5c7, - 0x22fc48, - 0x2821c8, - 0x27ae85, - 0x2d0e87, - 0x27ae07, - 0x2cd307, - 0x26a709, - 0x2879c9, - 0x3dfb46, - 0x301006, - 0x282f46, - 0x322605, - 0x3b8a04, - 0x3c4206, - 0x3c7086, - 0x27aec8, - 0x215c4b, - 0x3563c7, - 0x2afb04, - 0x35be46, - 0x2e99c7, - 0x36f805, - 0x2971c5, - 0x2ae204, - 0x287946, - 0x3c4288, - 0x2806c9, - 0x24bb46, - 0x285948, - 0x244a06, - 0x360a48, - 0x321a0c, - 0x27ad46, - 0x29e44d, - 0x29e8cb, - 0x2a48c5, - 0x288007, - 0x2c0c06, - 0x390388, - 0x3dfbc9, - 0x2ee4c8, - 0x3c8785, - 0x39b947, - 0x280d08, - 0x23b4c9, - 0x35bb86, - 0x25138a, - 0x390108, - 0x2ee30b, - 0x21dc0c, - 0x277d08, - 0x27cc06, - 0x2d0888, - 0x2f2c07, - 0x33a409, - 0x35024d, - 0x29ed06, - 0x2250c8, - 0x2bb609, - 0x2c71c8, - 0x283fc8, - 0x2c9ecc, - 0x2cab87, - 0x2cb7c7, - 0x26a545, - 0x2bdf87, - 0x3db748, - 0x2b9986, - 0x24b9cc, - 0x300288, - 0x2db2c8, - 0x307846, - 0x2af0c7, - 0x3dfd44, - 0x307588, - 0x2cf84c, - 0x28538c, - 0x3d9ec5, - 0x3c2e07, - 0x384386, - 0x2af046, - 0x24a948, - 0x21d284, - 0x34bb8b, - 0x27a34b, - 0x2fcfc6, - 0x3433c7, - 0x343ec5, - 0x272605, - 0x34bcc6, - 0x259305, - 0x3449c5, - 0x2d4287, - 0x20e989, - 0x269f04, - 0x25a2c5, - 0x2f6d85, - 0x35aac8, - 0x28d785, - 0x2cf209, - 0x2badc7, - 0x2badcb, - 0x2fbbc6, - 0x244109, - 0x3b65c8, - 0x290185, - 0x2cd408, - 0x287a08, - 0x253047, - 0x2b4247, - 0x389589, - 0x264187, - 0x29d389, - 0x2da70c, - 0x341088, - 0x2c0649, - 0x2c2f87, - 0x282289, - 0x33c3c7, - 0x21dd08, - 0x33a345, - 0x2f2186, - 0x2ca548, - 0x217488, - 0x2d5149, - 0x344a07, - 0x273005, - 0x3c3909, - 0x2f42c6, - 0x292a04, - 0x37b446, - 0x2af448, - 0x320807, - 0x215e48, - 0x34c509, - 0x33be47, - 0x2a4cc6, - 0x2880c4, - 0x226389, - 0x2d0d08, - 0x307707, - 0x367a06, - 0x215b86, - 0x33a784, - 0x34c706, - 0x239f83, - 0x32ac89, - 0x32b0c6, - 0x2a3705, - 0x2a5406, - 0x2d95c5, - 0x281188, - 0x347207, - 0x2306c6, - 0x287206, - 0x330f08, - 0x2a83c7, - 0x29ed45, - 0x2a2fc8, - 0x3aa048, - 0x390108, - 0x244545, - 0x2f2206, - 0x2bd9c9, - 0x2dec84, - 0x2d944b, - 0x225ecb, - 0x264f89, - 0x226283, - 0x257845, - 0x3ae4c6, - 0x246508, - 0x306ec4, - 0x3ae006, - 0x28ea49, - 0x2c93c5, - 0x2d41c6, - 0x2c1e86, - 0x222dc4, - 0x29958a, - 0x2a3648, - 0x217486, - 0x2cd045, - 0x343d47, - 0x3344c7, - 0x20c204, - 0x226107, - 0x2ba244, - 0x34ce46, - 0x210b43, - 0x26a705, - 0x2b6e45, - 0x23ef88, - 0x27f905, - 0x27aa89, - 0x2a9fc7, - 0x3073cb, - 0x2a9fcc, - 0x2aa5ca, - 0x350107, - 0x203d03, - 0x278808, - 0x244705, - 0x300885, - 0x359904, - 0x21dc06, - 0x27b986, - 0x34c747, - 0x23a80b, - 0x2a3044, - 0x355f44, - 0x2d4444, - 0x2d8ec6, - 0x202804, - 0x222c48, - 0x359705, - 0x21c145, - 0x36b7c7, - 0x288109, - 0x334285, - 0x39110a, - 0x3db9c9, - 0x2b174a, - 0x3cfe49, - 0x3545c4, - 0x31dc05, - 0x2c75c8, - 0x3a34cb, - 0x2dea45, - 0x24c386, - 0x241304, - 0x27afc6, - 0x33bcc9, - 0x2e9ac7, - 0x346d88, - 0x2a94c6, - 0x26c2c7, - 0x281788, - 0x377746, - 0x3c72c4, - 0x3817c7, - 0x382e85, - 0x392987, - 0x267784, - 0x2c0b86, - 0x30ad48, - 0x29ea88, - 0x2ff987, - 0x202808, - 0x29c6c5, - 0x226004, - 0x38f3c8, - 0x202904, - 0x217345, - 0x30af44, - 0x2109c7, - 0x28bdc7, - 0x2823c8, - 0x2dcb06, - 0x27f885, - 0x27a888, - 0x246848, - 0x2a6c09, - 0x2261c6, - 0x22f648, - 0x281d0a, - 0x36f888, - 0x309745, - 0x21b986, - 0x2a7208, - 0x39ba0a, - 0x219507, - 0x285f85, - 0x292c08, - 0x270fc4, - 0x252446, - 0x2cbb48, - 0x3d0d46, - 0x334c08, - 0x2d7ac7, - 0x3c7506, - 0x2c2844, - 0x237687, - 0x2bc004, - 0x33bc87, - 0x367e0d, - 0x237cc5, - 0x2d6b0b, - 0x285606, - 0x251e88, - 0x2427c4, - 0x3c50c6, - 0x27d886, - 0x2d0bc7, - 0x29e10d, - 0x304807, - 0x2bc5c8, - 0x284145, - 0x270648, - 0x2d4a86, - 0x29c748, - 0x238606, - 0x3036c7, - 0x282749, - 0x35a587, - 0x28afc8, - 0x34a005, - 0x22a1c8, - 0x2aef85, - 0x228e05, - 0x362b45, - 0x24dec3, - 0x204584, - 0x292e05, - 0x3a2709, - 0x367906, - 0x2e9788, - 0x2c2105, - 0x2bde47, - 0x371bca, - 0x2d4109, - 0x2e524a, - 0x2dfd48, - 0x22820c, - 0x282f0d, - 0x311883, - 0x334b08, - 0x206245, - 0x2f2d46, - 0x384f06, - 0x31e585, - 0x3de109, - 0x33d2c5, - 0x27a888, - 0x258546, - 0x369706, - 0x2a8cc9, - 0x3a9007, - 0x293506, - 0x371b48, - 0x3bbb48, - 0x2ed607, - 0x2c974e, - 0x2d4cc5, - 0x23b3c5, - 0x3d0c48, - 0x271e87, - 0x200e42, - 0x2c9b84, - 0x36838a, - 0x3077c8, - 0x287b46, - 0x2a0588, - 0x2a5506, - 0x288b88, - 0x2b52c8, - 0x228dc4, - 0x2be205, - 0x668c84, - 0x668c84, - 0x668c84, - 0x20aec3, - 0x215a06, - 0x27ad46, - 0x2a458c, - 0x202dc3, - 0x267786, - 0x21a604, - 0x281488, - 0x28e885, - 0x368486, - 0x2c6d08, - 0x2e0e46, - 0x230646, - 0x3c5608, - 0x2da147, - 0x263f49, - 0x3ae60a, - 0x266644, - 0x29d485, - 0x2e4305, - 0x2d7746, - 0x361ac6, - 0x2a50c6, - 0x3dc246, - 0x264084, - 0x26408b, - 0x264a44, - 0x244285, - 0x2b3a45, - 0x288486, - 0x201b48, - 0x282dc7, - 0x32b044, - 0x25b603, - 0x270ac5, - 0x37b307, - 0x282ccb, - 0x23ee87, - 0x2c6c08, - 0x2be347, - 0x26b746, - 0x25d588, - 0x2c51cb, - 0x301506, - 0x212849, - 0x2c5345, - 0x31f203, - 0x2d41c6, - 0x2d79c8, - 0x20c2c3, - 0x24c343, - 0x281786, - 0x2a5506, - 0x3759ca, - 0x27cc45, - 0x27d6cb, - 0x2a534b, - 0x213c03, - 0x20ea43, - 0x2ba1c4, - 0x370587, - 0x277d04, - 0x281484, - 0x2bb8c4, - 0x36fb88, - 0x2ccf88, - 0x214d49, - 0x2d7588, - 0x3b2d07, - 0x245806, - 0x2e93cf, - 0x2d4e06, - 0x2df404, - 0x2ccdca, - 0x37b207, - 0x2bc106, - 0x292a49, - 0x214cc5, - 0x23f0c5, - 0x214e06, - 0x22a303, - 0x271009, - 0x21db06, - 0x34c2c9, - 0x391686, - 0x26a705, - 0x35c905, - 0x204583, - 0x3706c8, - 0x32b787, - 0x3de2c4, - 0x281308, - 0x371dc4, - 0x359006, - 0x2bf706, - 0x23d646, - 0x2d9e09, - 0x300805, - 0x29ee06, - 0x2713c9, - 0x2d3e06, - 0x2e94c6, - 0x3a14c6, - 0x22bd85, - 0x30af46, - 0x3036c4, - 0x33a345, - 0x217484, - 0x2bcf46, - 0x298ac4, - 0x2109c3, - 0x285c05, - 0x233d88, - 0x3572c7, - 0x306f49, - 0x285e88, - 0x29f751, - 0x2c1f0a, - 0x2fcf07, - 0x357e46, - 0x21a604, - 0x2ca648, - 0x2ea008, - 0x29f90a, - 0x2cefcd, - 0x2a6dc6, - 0x3c5706, - 0x237746, - 0x21c147, - 0x2bc685, - 0x286c47, - 0x2813c5, - 0x2baf04, - 0x3c5e46, - 0x224dc7, - 0x270d0d, - 0x2a7147, - 0x37ef48, - 0x27ab89, - 0x21b886, - 0x35bb05, - 0x23c2c4, - 0x2af546, - 0x20c106, - 0x307946, - 0x2a0e08, - 0x21ad83, - 0x2465c3, - 0x349b05, - 0x31ec06, - 0x2b5285, - 0x2a96c8, - 0x2a3d8a, - 0x347344, - 0x281488, - 0x299408, - 0x2882c7, - 0x286589, - 0x2c6908, - 0x280747, - 0x2bbb46, - 0x3d0d4a, - 0x2af5c8, - 0x30c989, - 0x2b23c8, - 0x21ef89, - 0x357d07, - 0x312785, - 0x2a5906, - 0x2b9808, - 0x252008, - 0x224508, - 0x222dc8, - 0x244285, - 0x200d04, - 0x232708, - 0x241084, - 0x3cfc44, - 0x26a705, - 0x2949c7, - 0x287ec9, - 0x2d09c7, - 0x20f8c5, - 0x277b06, - 0x36f1c6, - 0x201c44, - 0x2a9006, - 0x27db04, - 0x291746, - 0x287c86, - 0x212e86, - 0x3c8785, - 0x2a9587, - 0x203d03, - 0x211609, - 0x330d08, - 0x2805c4, - 0x2805cd, - 0x29eb88, - 0x32a608, - 0x30c906, - 0x282849, - 0x2d4109, - 0x33b9c5, - 0x2a3e8a, - 0x291aca, - 0x2b444c, - 0x2b45c6, - 0x278406, - 0x2d5686, - 0x38ce89, - 0x2f2f86, - 0x21dd86, - 0x33d386, - 0x307588, - 0x202806, - 0x2de54b, - 0x294b45, - 0x21c145, - 0x279485, - 0x203e06, - 0x226043, - 0x23d5c6, - 0x2a70c7, - 0x2ca505, - 0x2d1c05, - 0x3b1385, - 0x310686, - 0x32fa44, - 0x32fa46, - 0x2ab289, - 0x203c8c, - 0x2bac48, - 0x22b284, - 0x30ac46, - 0x285706, - 0x2d79c8, - 0x2bbc48, - 0x203b89, - 0x343d47, - 0x356589, - 0x2726c6, - 0x22c144, - 0x2082c4, - 0x27f6c4, - 0x281788, - 0x287d0a, - 0x334206, - 0x3677c7, - 0x392c07, - 0x244205, - 0x36c944, - 0x28fe06, - 0x2bc6c6, - 0x21d2c3, - 0x330b47, - 0x20d088, - 0x33bb0a, - 0x22be48, - 0x20ad88, - 0x298b05, - 0x2a49c5, - 0x3564c5, - 0x2445c6, - 0x247486, - 0x33c885, - 0x32aec9, - 0x36c74c, - 0x2f4ec7, - 0x29f988, - 0x2521c5, - 0x668c84, - 0x265444, - 0x2d6e44, - 0x218706, - 0x2a650e, - 0x23f147, - 0x21c345, - 0x2dec0c, - 0x310b07, - 0x224d47, - 0x226fc9, - 0x219e49, - 0x285f85, - 0x330d08, - 0x2bd9c9, - 0x38ffc5, - 0x2ca448, - 0x2c0886, - 0x38f646, - 0x202c44, - 0x28ee48, - 0x21ba43, - 0x215604, - 0x270b45, - 0x396f07, - 0x2c2605, - 0x281bc9, - 0x2a118d, - 0x2b3046, - 0x3df784, - 0x3b9d08, - 0x20e7ca, - 0x21c847, - 0x367d45, - 0x215643, - 0x2a550e, - 0x3707cc, - 0x30b147, - 0x2a66c7, - 0x443960c7, - 0xaf286, - 0x647c4, - 0x203083, - 0x2f2fc5, - 0x2d6e45, - 0x2a0948, - 0x29dc09, - 0x22b186, - 0x277d04, - 0x2fce46, - 0x331bcb, - 0x2e844c, - 0x24df87, - 0x2de805, - 0x3a9f48, - 0x2ed3c5, - 0x2ccdc7, - 0x2f4cc7, - 0x245fc5, - 0x226043, - 0x20c584, - 0x2e4205, - 0x269e05, - 0x269e06, - 0x2a9dc8, - 0x224dc7, - 0x385206, - 0x33a686, - 0x362a86, - 0x225249, - 0x2d0f87, - 0x250f86, - 0x2e85c6, - 0x276d06, - 0x2b0ac5, - 0x20a586, - 0x39b0c5, - 0x28d808, - 0x29428b, - 0x28fb46, - 0x392c44, - 0x304e49, - 0x2a9fc4, - 0x2c0808, - 0x30e907, - 0x283ec4, - 0x2c5dc8, - 0x2cb5c4, - 0x2b0b04, - 0x274785, - 0x318886, - 0x36fac7, - 0x23db43, - 0x2a4d85, - 0x2fd1c4, - 0x23b406, - 0x33ba48, - 0x202705, - 0x293f49, - 0x350105, - 0x267788, - 0x21a4c7, - 0x32b1c8, - 0x2c5a07, - 0x241889, - 0x280886, - 0x33e906, - 0x2a78c4, - 0x355e85, - 0x31320c, - 0x279487, - 0x279c87, - 0x361708, - 0x2b3046, - 0x2a7004, - 0x34b0c4, - 0x389409, - 0x2d5786, - 0x270507, - 0x2d0804, - 0x326b06, - 0x38a805, - 0x2dc647, - 0x2de4c6, - 0x251249, - 0x2f0387, - 0x29bc87, - 0x2a8b46, - 0x326a45, - 0x27f408, - 0x21d988, - 0x245a06, - 0x202745, - 0x2cca86, - 0x20af03, - 0x2a07c9, - 0x2a4e4e, - 0x2c5748, - 0x371ec8, - 0x24580b, - 0x294186, - 0x385544, - 0x230644, - 0x2a4f4a, - 0x211987, - 0x251045, - 0x212849, - 0x2c9685, - 0x3cfc87, - 0x2305c4, - 0x3c7b07, - 0x318988, - 0x2d4906, - 0x2c0d09, - 0x2c6a0a, - 0x211906, - 0x29e6c6, - 0x2b39c5, - 0x398545, - 0x36ac07, - 0x245608, - 0x38a748, - 0x228dc6, - 0x35c985, - 0x36184e, - 0x2c70c4, - 0x245985, - 0x277489, - 0x2eab08, - 0x28e286, - 0x2a2acc, - 0x2a3990, - 0x2a614f, - 0x2a8148, - 0x350107, - 0x3c8785, - 0x292e05, - 0x36f949, - 0x292e09, - 0x2cfe06, - 0x2deac7, - 0x355d85, - 0x237c49, - 0x35e486, - 0x2f2dcd, - 0x27f589, - 0x281484, - 0x2c54c8, - 0x2327c9, - 0x3343c6, - 0x278a05, - 0x33e906, - 0x346c49, - 0x2d0688, - 0x206a05, - 0x281e04, - 0x2a2c8b, - 0x334285, - 0x246586, - 0x283246, - 0x3b4246, - 0x2875cb, - 0x294049, - 0x33a5c5, - 0x393807, - 0x2c1e86, - 0x231f46, - 0x281a88, - 0x224f09, - 0x37ed0c, - 0x37b108, - 0x31aac6, - 0x32dc83, - 0x22f306, - 0x241745, - 0x27e208, - 0x3d9d46, - 0x2dc888, - 0x380445, - 0x291805, - 0x21a608, - 0x3bba07, - 0x384e47, - 0x34c747, - 0x302a48, - 0x2d7848, - 0x2e9f06, - 0x2bcd87, - 0x21f707, - 0x2b3f4a, - 0x2168c3, - 0x203e06, - 0x22b3c5, - 0x213504, - 0x27ab89, - 0x241804, - 0x204844, - 0x2a4204, - 0x2a66cb, - 0x32b6c7, - 0x310645, - 0x29c3c8, - 0x277b06, - 0x277b08, - 0x27cb86, - 0x28ed85, - 0x28f045, - 0x290746, - 0x292408, - 0x292988, - 0x27ad46, - 0x29c20f, - 0x2a0290, - 0x3d0845, - 0x203d03, - 0x22c205, - 0x31bd08, - 0x292d09, - 0x390108, - 0x2de8c8, - 0x235288, - 0x32b787, - 0x2777c9, - 0x2dca88, - 0x291004, - 0x2a4088, - 0x35ab89, - 0x2bd387, - 0x34de44, - 0x2d0a88, - 0x2a934a, - 0x2fd446, - 0x2a6dc6, - 0x226089, - 0x2a3bc7, - 0x2d9c88, - 0x21fd08, - 0x33ad48, - 0x24ef85, - 0x3d3205, - 0x21c145, - 0x2d6e05, - 0x2bb447, - 0x226045, - 0x2ca505, - 0x3dde06, - 0x390047, - 0x3a3407, - 0x2a9646, - 0x2e0285, - 0x246586, - 0x241985, - 0x2c4d88, - 0x355d04, - 0x2d3e86, - 0x324604, - 0x2c5bc8, - 0x318c0a, - 0x27b4cc, - 0x23aa05, - 0x21c206, - 0x37eec6, - 0x202586, - 0x31ab44, - 0x3b9a05, - 0x27c447, - 0x2a3c49, - 0x2d9307, - 0x668c84, - 0x668c84, - 0x32b545, - 0x2dda04, - 0x2a204a, - 0x277986, - 0x2bd7c4, - 0x3c2d85, - 0x3bd405, - 0x2bc5c4, - 0x282e87, - 0x3c3a87, - 0x2d8ec8, - 0x26d5c8, - 0x206a09, - 0x372488, - 0x2a220b, - 0x2acc44, - 0x232045, - 0x3897c5, - 0x34c6c9, - 0x224f09, - 0x304d48, - 0x34cc48, - 0x288484, - 0x285745, - 0x2041c3, - 0x2d7705, - 0x29ee86, - 0x29da4c, - 0x20c006, - 0x278906, - 0x28e505, - 0x310708, - 0x2e86c6, - 0x357fc6, - 0x2a6dc6, - 0x22bbcc, - 0x389884, - 0x362bca, - 0x28e448, - 0x29d887, - 0x2fd0c6, - 0x22b247, - 0x2fca45, - 0x367a06, - 0x35ee86, - 0x372987, - 0x2c6704, - 0x210ac5, - 0x277484, - 0x2baf87, - 0x2776c8, - 0x27828a, - 0x280b87, - 0x2aa847, - 0x350087, - 0x2ed509, - 0x29da4a, - 0x22c103, - 0x357285, - 0x212ec3, - 0x2bb909, - 0x2d7c08, - 0x372247, - 0x390209, - 0x21da86, - 0x339f88, - 0x395385, - 0x24694a, - 0x343809, - 0x370209, - 0x3db607, - 0x2ea109, - 0x212d88, - 0x288d86, - 0x21c3c8, - 0x2d1f47, - 0x264187, - 0x3db9c7, - 0x2daf48, - 0x30aac6, - 0x2a9105, - 0x27c447, - 0x29e1c8, - 0x362a04, - 0x306044, - 0x293407, - 0x2b5647, - 0x2bd84a, - 0x288d06, - 0x32eeca, - 0x2c9ac7, - 0x2c6e87, - 0x210b84, - 0x29d444, - 0x2dc546, - 0x35c184, - 0x35c18c, - 0x30e845, - 0x2172c9, - 0x2ef004, - 0x2bc685, - 0x20e748, - 0x292a45, - 0x391106, - 0x292f44, - 0x2acb4a, - 0x2ef646, - 0x255fca, - 0x3d0007, - 0x215f85, - 0x22a305, - 0x24424a, - 0x292585, - 0x2a6cc6, - 0x241084, - 0x2ba346, - 0x36acc5, - 0x3d9e06, - 0x2ff98c, - 0x2e18ca, - 0x291bc4, - 0x245806, - 0x2a3bc7, - 0x2de444, - 0x307588, - 0x24c286, - 0x392a89, - 0x2c8349, - 0x341189, - 0x2d9606, - 0x2d2046, - 0x21c507, - 0x32ae08, - 0x2d1e49, - 0x32b6c7, - 0x29c546, - 0x26c347, - 0x237605, - 0x2c70c4, - 0x21c0c7, - 0x21f8c5, - 0x28a2c5, - 0x200cc7, - 0x245e88, - 0x3a9ec6, - 0x29f00d, - 0x2a0b4f, - 0x2a534d, - 0x202d84, - 0x233e86, - 0x2e1c88, - 0x33d345, - 0x2b4108, - 0x252f0a, - 0x281484, - 0x331e06, - 0x2abe07, - 0x2b7d47, - 0x2da209, - 0x21c385, - 0x2bc5c4, - 0x2be14a, - 0x2c64c9, - 0x2ea207, - 0x30b706, - 0x3343c6, - 0x285686, - 0x381886, - 0x2e158f, - 0x2e1b49, - 0x202806, - 0x389046, - 0x297e89, - 0x2bce87, - 0x2146c3, - 0x22bd46, - 0x212503, - 0x31e448, - 0x26c187, - 0x2a8349, - 0x2bf588, - 0x384f88, - 0x33c506, - 0x20bf49, - 0x2f4e05, - 0x22f244, - 0x312847, - 0x38cf05, - 0x202d84, - 0x361b48, - 0x211c44, - 0x2bcbc7, - 0x36c106, - 0x263645, - 0x2b23c8, - 0x33428b, - 0x331207, - 0x2444c6, - 0x2d4e84, - 0x3854c6, - 0x26a705, - 0x21f8c5, - 0x27f189, - 0x282a89, - 0x2641c4, - 0x264205, - 0x245845, - 0x2467c6, - 0x330e08, - 0x2c8e86, - 0x20cecb, - 0x3bc9ca, - 0x2c5b05, - 0x28f0c6, - 0x23eb85, - 0x24a285, - 0x292647, - 0x204088, - 0x292484, - 0x37fb46, - 0x292a06, - 0x212f47, - 0x31f1c4, - 0x27d886, - 0x3c2245, - 0x3c2249, - 0x2d2244, - 0x36cac9, - 0x27ad46, - 0x2cac48, - 0x245845, - 0x392d05, - 0x3d9e06, - 0x37ec09, - 0x219e49, - 0x278986, - 0x2eac08, - 0x2a12c8, - 0x23eb44, - 0x2be9c4, - 0x2be9c8, - 0x3b2b88, - 0x356689, - 0x29ee06, - 0x2a6dc6, - 0x33384d, - 0x3ae006, - 0x3218c9, - 0x268945, - 0x214e06, - 0x33aec8, - 0x32f985, - 0x21f744, - 0x26a705, - 0x2825c8, - 0x2a1e09, - 0x277544, - 0x2c0b86, - 0x30cb4a, - 0x30b048, - 0x2bd9c9, - 0x26ad4a, - 0x390186, - 0x2a0d08, - 0x2ccb85, - 0x2f0988, - 0x2fcac5, - 0x21d949, - 0x336449, - 0x20c642, - 0x2c5345, - 0x272346, - 0x27ac87, - 0x213505, - 0x3469c6, - 0x316908, - 0x2b3046, - 0x2c7489, - 0x279d86, - 0x281908, - 0x278d45, - 0x38e4c6, - 0x3037c8, - 0x281788, - 0x357c08, - 0x318488, - 0x20a584, - 0x20c243, - 0x2c76c4, - 0x280d86, - 0x237644, - 0x371e07, - 0x357ec9, - 0x2d4445, - 0x21fd06, - 0x22bd46, - 0x2a9c0b, - 0x2bc046, - 0x298d46, - 0x2d3f88, - 0x264a46, - 0x215d83, - 0x208503, - 0x2c70c4, - 0x22f545, - 0x244847, - 0x2776c8, - 0x2776cf, - 0x27c34b, - 0x330c08, - 0x2c0c06, - 0x330f0e, - 0x23b443, - 0x2447c4, - 0x2bbfc5, - 0x2bc446, - 0x28ff0b, - 0x294a86, - 0x221089, - 0x263645, - 0x23da88, - 0x3d29c8, - 0x219d0c, - 0x2a6706, - 0x2d7746, - 0x2e2d45, - 0x28ad88, - 0x27b4c5, - 0x34f108, - 0x2a2e4a, - 0x2a5789, - 0x668c84, - 0x2000c2, - 0x4a201242, - 0x200382, - 0x221dc4, - 0x209e82, - 0x306c44, - 0x208482, - 0x3dc3, - 0x2003c2, - 0x2090c2, - 0x9a048, - 0x29904, - 0x214a83, - 0x232dc3, - 0x308003, - 0xccc2, - 0x49582, - 0x23c803, - 0x21a3c3, - 0x242543, - 0xc782, - 0xc2c2, - 0x1b82, - 0x202703, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21a3c3, - 0x242543, - 0x241f83, - 0x2d3684, - 0x214a83, - 0x235b44, - 0x232dc3, - 0x2e3504, - 0x308003, - 0x2137c7, - 0x23c803, - 0x203dc3, - 0x31bf88, - 0x242543, - 0x27cfcb, - 0x2fdbc3, - 0x2431c6, - 0x233442, - 0x2f850b, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x242543, - 0x21a103, - 0x208a03, - 0x2000c2, - 0x9a048, - 0x399c45, - 0x21f948, - 0x2e3648, - 0x201242, - 0x343045, - 0x3c8847, - 0x203c42, - 0x242a07, - 0x200382, - 0x2555c7, - 0x3742c9, - 0x26d188, - 0x33abc9, - 0x20b342, - 0x3c7387, - 0x22dd84, - 0x3c8907, - 0x3bc8c7, - 0x25ac42, - 0x23c803, - 0x202382, - 0x208482, - 0x2003c2, - 0x214282, - 0x200902, - 0x2090c2, - 0x2df885, - 0x210205, - 0x1242, - 0x32dc3, - 0x214a83, - 0x232dc3, - 0x29a643, - 0x308003, - 0x206c03, - 0x21a3c3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0xa983, - 0x101, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21bc83, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x214903, - 0x4d4ae8c6, - 0x239c3, - 0xd50c5, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x1b02, - 0x9a048, - 0x12a4c3, - 0x3dc3, - 0x1b4103, - 0x455c4, - 0x14226c4, - 0xed7c5, - 0x2000c2, - 0x393bc4, - 0x214a83, - 0x232dc3, - 0x308003, - 0x231a43, - 0x22d805, - 0x21bc83, - 0x21a8c3, - 0x21a3c3, - 0x24e283, - 0x242543, - 0x20e2c3, - 0x266603, - 0x207783, - 0x5c2, - 0x2aec2, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x2000c2, - 0x202703, - 0x201242, - 0x2a42, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21a3c3, - 0x242543, - 0x2090c2, - 0x9a048, - 0x308003, - 0x1b4103, - 0x9a048, - 0x1b4103, - 0x26f6c3, - 0x214a83, - 0x22fe44, - 0x232dc3, - 0x308003, - 0x206182, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x206182, - 0x2137c3, - 0x21a3c3, - 0x242543, - 0x2f7103, - 0x20e2c3, - 0x2000c2, - 0x201242, - 0x308003, - 0x21a3c3, - 0x242543, - 0x2431c5, - 0x14fc86, - 0x2d3684, - 0x233442, - 0x882, - 0x9a048, - 0x2a42, - 0x49582, - 0x2982, - 0x2000c2, - 0x139b05, - 0x1ce08, - 0x991c3, - 0x201242, - 0x3c604, - 0x51c6c486, - 0x8d04, - 0x10fe4b, - 0x34ac6, - 0xd1407, - 0x12eb09, - 0x232dc3, - 0x48248, - 0x4824b, - 0x486cb, - 0x48d4b, - 0x4908b, - 0x4934b, - 0x4978b, - 0x1d2f06, - 0x308003, - 0xf3605, - 0x68a44, - 0x210983, - 0x1182c7, - 0xe6d44, - 0x6cbc4, - 0x21a3c3, - 0x78a86, - 0x5684, - 0x1b4103, - 0x242543, - 0x2fe7c4, - 0x12bcc7, - 0x14f889, - 0x10fc08, - 0x1b44c4, - 0x1c8a44, - 0x365c6, - 0xa788, - 0x16a605, - 0x8649, - 0x2fb03, - 0x139b05, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x203dc3, - 0x242543, - 0x2fdbc3, - 0x233442, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21bac3, - 0x219a04, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x2e3504, - 0x308003, - 0x21a3c3, - 0x242543, - 0x2431c6, - 0x232dc3, - 0x308003, - 0x10e83, - 0x1b4103, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x139b05, - 0xd1407, - 0x3103, - 0x2fb03, - 0x9a048, - 0x308003, - 0x214a83, - 0x232dc3, - 0x308003, - 0x5cf43, - 0x21a3c3, - 0x242543, - 0x55214a83, - 0x232dc3, - 0x21a3c3, - 0x242543, - 0x9a048, - 0x2000c2, - 0x201242, - 0x214a83, - 0x308003, - 0x21a3c3, - 0x2003c2, - 0x242543, - 0x336987, - 0x2cd68b, - 0x20dcc3, - 0x2cfac8, - 0x32ab87, - 0x3de706, - 0x218c05, - 0x343189, - 0x242f48, - 0x3359c9, - 0x3359d0, - 0x37ab8b, - 0x2e7589, - 0x203103, - 0x2f8bc9, - 0x231506, - 0x23150c, - 0x335bc8, - 0x3db448, - 0x374789, - 0x2c368e, - 0x37408b, - 0x2ba58c, - 0x220dc3, - 0x28c68c, - 0x3d8f49, - 0x23bb47, - 0x232d0c, - 0x2b858a, - 0x24c0c4, - 0x2ee78d, - 0x28c548, - 0x3ba7cd, - 0x3a6cc6, - 0x2d368b, - 0x34fa09, - 0x3892c7, - 0x295946, - 0x267b49, - 0x33b64a, - 0x30c108, - 0x2fd7c4, - 0x2b5a07, - 0x3c51c7, - 0x204684, - 0x223804, - 0x201fc9, - 0x286ac9, - 0x3d9ac8, - 0x398bc5, - 0x20b285, - 0x2068c6, - 0x2ee649, - 0x25318d, - 0x24c488, - 0x2067c7, - 0x218c88, - 0x2355c6, - 0x239c04, - 0x284405, - 0x3cfb46, - 0x3d1e84, - 0x3d8e47, - 0x3e094a, - 0x20d384, - 0x211846, - 0x2124c9, - 0x2124cf, - 0x212a8d, - 0x213306, - 0x21ca10, - 0x21ce06, - 0x21df07, - 0x21e987, - 0x21e98f, - 0x21f1c9, - 0x225986, - 0x227207, - 0x227208, - 0x2275c9, - 0x3ba588, - 0x305c87, - 0x20ed43, - 0x3d87c6, - 0x29d1c8, - 0x2c394a, - 0x215849, - 0x243083, - 0x342f46, - 0x37f98a, - 0x2f9f87, - 0x23b98a, - 0x31458e, - 0x21f306, - 0x338547, - 0x238886, - 0x2435c6, - 0x3d300b, - 0x39964a, - 0x2cdccd, - 0x2d2107, - 0x266688, - 0x266689, - 0x26668f, - 0x3070cc, - 0x34b789, - 0x27e48e, - 0x2138ca, - 0x216406, - 0x2f4806, - 0x3adc8c, - 0x31fdcc, - 0x320308, - 0x35a487, - 0x235185, - 0x3c8ac4, - 0x28918e, - 0x3a6744, - 0x201247, - 0x39dcca, - 0x3ab1d4, - 0x3d548f, - 0x21eb48, - 0x3d8688, - 0x378c8d, - 0x378c8e, - 0x22cd09, - 0x22e548, - 0x22e54f, - 0x232a0c, - 0x232a0f, - 0x233bc7, - 0x23714a, - 0x3087cb, - 0x239808, - 0x23b107, - 0x25c7cd, - 0x3620c6, - 0x2ee946, - 0x23d449, - 0x22ba08, - 0x2433c8, - 0x2433ce, - 0x2b7687, - 0x3043c5, - 0x245385, - 0x202404, - 0x3de9c6, - 0x3d99c8, - 0x296d83, - 0x2e710e, - 0x25cb88, - 0x2aae8b, - 0x26f887, - 0x228c05, - 0x273506, - 0x2b2b07, - 0x31b348, - 0x36a409, - 0x3cd545, - 0x285c48, - 0x2209c6, - 0x3a618a, - 0x289089, - 0x232dc9, - 0x232dcb, - 0x25d908, - 0x204549, - 0x398c86, - 0x3c5a8a, - 0x2bfe4a, - 0x23734c, - 0x3488c7, - 0x26cf8a, - 0x3b1fcb, - 0x3b1fd9, - 0x324208, - 0x243245, - 0x25c986, - 0x2a0049, - 0x39f606, - 0x219aca, - 0x26e286, - 0x2196c4, - 0x2d604d, - 0x3458c7, - 0x2196c9, - 0x247105, - 0x247ac8, - 0x248009, - 0x24b904, - 0x24bfc7, - 0x24bfc8, - 0x24cc87, - 0x265c08, - 0x250dc7, - 0x2d8b85, - 0x257e8c, - 0x258349, - 0x33144a, - 0x3a8e89, - 0x2f8cc9, - 0x388e0c, - 0x25b4cb, - 0x25c008, - 0x25d0c8, - 0x260cc4, - 0x283b88, - 0x284d09, - 0x2b8647, - 0x212706, - 0x2a43c7, - 0x29fd49, - 0x24768b, - 0x36aa87, - 0x2947c7, - 0x3d0147, - 0x3ba744, - 0x3ba745, - 0x2e3205, - 0x358b4b, - 0x33d684, - 0x323a88, - 0x30060a, - 0x220a87, - 0x3caac7, - 0x28f6d2, - 0x291646, - 0x22f7c6, - 0x28870e, - 0x29ab46, - 0x299288, - 0x29a60f, - 0x3bab88, - 0x28a808, - 0x2dd1ca, - 0x2dd1d1, - 0x2a98ce, - 0x25514a, - 0x25514c, - 0x22e747, - 0x22e750, - 0x3c7108, - 0x2a9ac5, - 0x2b2e0a, - 0x3d1ecc, - 0x29c88d, - 0x3c7c86, - 0x3c7c87, - 0x3c7c8c, - 0x3d2b8c, - 0x21bc8c, - 0x3bd6cb, - 0x38b644, - 0x226204, - 0x2b6f89, - 0x34b147, - 0x37d009, - 0x2bfc89, - 0x2b8247, - 0x2b8406, - 0x2b8409, - 0x2b8803, - 0x2b314a, - 0x2961c7, - 0x3c8e0b, - 0x2cdb4a, - 0x22de04, - 0x32f4c6, - 0x280e09, - 0x35c004, - 0x2df48a, - 0x2e0685, - 0x2c7945, - 0x2c794d, - 0x2c7c8e, - 0x2c7805, - 0x335046, - 0x242dc7, - 0x22b78a, - 0x3a6a46, - 0x37bc84, - 0x3cdb87, - 0x2fab0b, - 0x265907, - 0x262944, - 0x3a39c6, - 0x3a39cd, - 0x2e568c, - 0x21a286, - 0x24c68a, - 0x34ca86, - 0x21e648, - 0x30c487, - 0x2d3b8a, - 0x23c486, - 0x27d903, - 0x2f3886, - 0x29d048, - 0x245aca, - 0x2dcc07, - 0x2dcc08, - 0x249ac4, - 0x28fc47, - 0x2f4348, - 0x291848, - 0x2bbdc8, - 0x2ffc0a, - 0x2ec0c5, - 0x2c1ac7, - 0x254f93, - 0x26b2c6, - 0x24aec8, - 0x221589, - 0x2428c8, - 0x33c58b, - 0x385308, - 0x2c02c4, - 0x21a706, - 0x320c06, - 0x3186c9, - 0x2d39c7, - 0x257f88, - 0x2a51c6, - 0x200bc4, - 0x208405, - 0x3a3188, - 0x344e4a, - 0x2d5cc8, - 0x2dad46, - 0x2a0f0a, - 0x269f88, - 0x2de248, - 0x2df708, - 0x2dff46, - 0x2e1e86, - 0x3a4d0c, - 0x2e2410, - 0x2cc145, - 0x2230c8, - 0x2230d0, - 0x3ba990, - 0x33584e, - 0x3a498e, - 0x3a4994, - 0x3a804f, - 0x3a8406, - 0x3dbe51, - 0x345213, - 0x345688, - 0x2035c5, - 0x2d0008, - 0x3a05c5, - 0x33f34c, - 0x229f09, - 0x3a6589, - 0x356947, - 0x26c649, - 0x39f1c7, - 0x334686, - 0x284207, - 0x204c05, - 0x20a9c3, - 0x210e83, - 0x213404, - 0x36adcd, - 0x3c304f, - 0x200c05, - 0x33f246, - 0x20cb87, - 0x399a87, - 0x208886, - 0x20888b, - 0x2aa785, - 0x259fc6, - 0x30be47, - 0x251ac9, - 0x229b46, - 0x3860c5, - 0x3c910b, - 0x3d6e86, - 0x21d685, - 0x241588, - 0x290b08, - 0x299b8c, - 0x299b90, - 0x2ac2c9, - 0x2c15c7, - 0x2b918b, - 0x2c8206, - 0x305b4a, - 0x36ff8b, - 0x31b58a, - 0x398806, - 0x2f6fc5, - 0x32aa86, - 0x279f48, - 0x356a0a, - 0x37891c, - 0x2fdc8c, - 0x2fdf88, - 0x2431c5, - 0x382747, - 0x24a006, - 0x24aac5, - 0x2177c6, - 0x208a48, - 0x2c6747, - 0x2c3588, - 0x26b38a, - 0x3b954c, - 0x297009, - 0x3b97c7, - 0x285244, - 0x245446, - 0x28a38a, - 0x2bfd85, - 0x22348c, - 0x223b48, - 0x26a208, - 0x2aebcc, - 0x38878c, - 0x22d949, - 0x22db87, - 0x25494c, - 0x3082c4, - 0x3713ca, - 0x30de8c, - 0x24fdcb, - 0x25044b, - 0x252b06, - 0x256447, - 0x22e987, - 0x22e98f, - 0x30f351, - 0x2e8d92, - 0x258c0d, - 0x258c0e, - 0x258f4e, - 0x3a8208, - 0x3a8212, - 0x25be08, - 0x221bc7, - 0x24ec0a, - 0x2ac988, - 0x29ab05, - 0x2bb28a, - 0x21d187, - 0x2ef184, - 0x210883, - 0x236085, - 0x2dd447, - 0x30d3c7, - 0x29ca8e, - 0x352e8d, - 0x354009, - 0x302905, - 0x361043, - 0x34a886, - 0x25a5c5, - 0x2ab0c8, - 0x224249, - 0x25c9c5, - 0x25c9cf, - 0x2e0b07, - 0x218a85, - 0x27024a, - 0x3d0b06, - 0x312b09, - 0x381b4c, - 0x3ce889, - 0x2062c6, - 0x30040c, - 0x32dd86, - 0x30cfc8, - 0x3b1ec6, - 0x365486, - 0x2bc1c4, - 0x31d203, - 0x21124a, - 0x227e11, - 0x34b94a, - 0x23ea05, - 0x25b907, - 0x2559c7, - 0x2e6f04, - 0x2f444b, - 0x33aa48, - 0x2c55c6, - 0x361785, - 0x261f44, - 0x3828c9, - 0x2008c4, - 0x20e087, - 0x37a385, - 0x37a387, - 0x288945, - 0x3801c3, - 0x221a88, - 0x2d020a, - 0x23db43, - 0x399c8a, - 0x2a74c6, - 0x25c74f, - 0x2b7609, - 0x2e7090, - 0x305748, - 0x2db3c9, - 0x29df47, - 0x3a394f, - 0x3905c4, - 0x2e3584, - 0x203946, - 0x2344c6, - 0x2ef40a, - 0x254686, - 0x2b5e07, - 0x315048, - 0x315247, - 0x3166c7, - 0x31784a, - 0x316fcb, - 0x33bf85, - 0x2e89c8, - 0x201343, - 0x3bb3cc, - 0x3965cf, - 0x234f8d, - 0x258787, - 0x354149, - 0x357087, - 0x2401c8, - 0x3ab3cc, - 0x2c01c8, - 0x23e708, - 0x32c9ce, - 0x341b94, - 0x3420a4, - 0x36080a, - 0x37b90b, - 0x39f284, - 0x39f289, - 0x331e88, - 0x245d85, - 0x29688a, - 0x291087, - 0x2135c4, - 0x202703, - 0x214a83, - 0x235b44, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21bc83, - 0x23c803, - 0x2e2406, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x2141c3, - 0x2000c2, - 0x202703, - 0x201242, - 0x214a83, - 0x235b44, - 0x232dc3, - 0x308003, - 0x21bc83, - 0x2e2406, - 0x21a3c3, - 0x242543, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x228503, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x2000c2, - 0x27ee03, - 0x201242, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x2086c2, - 0x215702, - 0x201242, - 0x214a83, - 0x208c02, - 0x2005c2, - 0x221dc4, - 0x306c44, - 0x223f82, - 0x219a04, - 0x2003c2, - 0x242543, - 0x2141c3, - 0x252b06, - 0x20c782, - 0x201b82, - 0x2221c2, - 0x57a07403, - 0x57e2e743, - 0x56246, - 0x56246, - 0x2d3684, - 0x203dc3, - 0x160d, - 0x1d984a, - 0x16300c, - 0x1d76cc, - 0xd4ecd, - 0x139b05, - 0x86209, - 0x8d2cc, - 0x29907, - 0xdb86, - 0x13dc8, - 0x1bf87, - 0x201c8, - 0x1ac0ca, - 0x10d707, - 0x58a8d505, - 0xe4f09, - 0x58c3480b, - 0x125c08, - 0x1558b, - 0x12c5c8, - 0x1c48c9, - 0x4060a, - 0x1b1b8e, - 0x1d158d, - 0x2cd0d, - 0x14426cb, - 0xe554a, - 0x8d04, - 0x5a106, - 0x19b808, - 0x79108, - 0x25687, - 0x1d35c5, - 0xc607, - 0x33249, - 0x15c087, - 0x106c8, - 0x26a89, - 0x4ce04, - 0x4e945, - 0x98e8e, - 0x12c207, - 0x59225a86, - 0x78d8d, - 0xd1288, - 0x59694f86, - 0x5a094f88, - 0x56f88, - 0x136b90, - 0x53f8c, - 0x61b47, - 0x62347, - 0x6a947, - 0x72047, - 0x6882, - 0x120687, - 0x19980c, - 0x13c945, - 0x107c07, - 0xac186, - 0xacdc9, - 0xaff88, - 0x6502, - 0x5c2, - 0x18d986, - 0x1b9ecb, - 0x1ba1c6, - 0x174d04, - 0x978c7, - 0x41a89, - 0xf0c09, - 0x1b1148, - 0x49582, - 0x193a49, - 0xd788, - 0xef24a, - 0x15adc9, - 0x1b4186, - 0xd8949, - 0xe54c7, - 0xe5c09, - 0xe7ac8, - 0xea3c7, - 0xec049, - 0xf0005, - 0xf1210, - 0x1b6786, - 0x97805, - 0x91487, - 0xec74d, - 0x41485, - 0xf8ac6, - 0xf92c7, - 0xfe7d8, - 0xd1608, - 0x13db8a, - 0xca42, - 0x5020a, - 0x60e4d, - 0x45c2, - 0xce946, - 0x11ec6, - 0xa1788, - 0xafd0a, - 0x472c8, - 0x6de89, - 0x115488, - 0x6eace, - 0x6e0c8, - 0x14a887, - 0x5a694ec4, - 0xae8cd, - 0x10a085, - 0x69148, - 0x34088, - 0x111b86, - 0xc2c2, - 0xc53c4, - 0xe2c06, - 0x365c6, - 0x5a8ef74b, - 0x1442, - 0x401, - 0x81, - 0xb8f08, - 0x5bc87, - 0x150503, - 0x59a37f04, - 0x59e9b383, - 0xc1, - 0xf586, - 0xc1, - 0x201, - 0xf586, - 0x150503, - 0x66603, - 0x647c4, - 0x1e7c7, - 0x7787, - 0x15c27c5, - 0x4e684, - 0x13d707, - 0x1242, - 0x24c0c4, - 0x214a83, - 0x24d9c4, - 0x221dc4, - 0x21a3c3, - 0x221445, - 0x214903, - 0x22b983, - 0x208805, - 0x207783, - 0x1243, - 0x5ba14a83, - 0x232dc3, - 0x4d9c4, - 0x7083, - 0x308003, - 0x200181, - 0x1a8c3, - 0x23c803, - 0x306c44, - 0x219a04, - 0x21a3c3, - 0x4e283, - 0x242543, - 0x20e2c3, - 0x9a048, - 0x2000c2, - 0x202703, - 0x201242, - 0x214a83, - 0x232dc3, - 0x228503, - 0x2005c2, - 0x221dc4, - 0x21bc83, - 0x23c803, - 0x21a3c3, - 0x203dc3, - 0x242543, - 0x207783, - 0x196504, - 0x9a048, - 0x106947, - 0x1242, - 0x1a3105, - 0x540cf, - 0xe0986, - 0x144ca88, - 0x1160ce, - 0x5ca345c2, - 0x297ac8, - 0x35c5c6, - 0x24e806, - 0x395e87, - 0x5ce00c82, - 0x5d2b7488, - 0x20bd4a, - 0x2615c8, - 0x200ac2, - 0x3c8c49, - 0x33bfc7, - 0x212686, - 0x2217c9, - 0x2c1c04, - 0x3c8b46, - 0x2cc7c4, - 0x20e904, - 0x257889, - 0x30dbc6, - 0x265445, - 0x266245, - 0x22d547, - 0x2dbd87, - 0x34c8c4, - 0x31e606, - 0x2ff485, - 0x210845, - 0x23eac5, - 0x3bd9c7, - 0x26f6c5, - 0x248489, - 0x343fc5, - 0x31b484, - 0x3a6987, - 0x36344e, - 0x2031c9, - 0x2885c9, - 0x348706, - 0x23f9c8, - 0x36f2cb, - 0x2a5a0c, - 0x322686, - 0x2ba447, - 0x2eee85, - 0x3270ca, - 0x3d9bc9, - 0x345c89, - 0x295146, - 0x30bc05, - 0x245705, - 0x36a209, - 0x23ec4b, - 0x2c2246, - 0x352686, - 0x2067c4, - 0x2ecd46, - 0x304448, - 0x3c1e46, - 0x2e3e06, - 0x3dd908, - 0x2019c7, - 0x201d49, - 0x205a85, - 0x9a048, - 0x3cd4c4, - 0x316c44, - 0x20b105, - 0x3403c9, - 0x220747, - 0x22074b, - 0x22284a, - 0x228585, - 0x5d60c282, - 0x2cda07, - 0x5da29cc8, - 0x295387, - 0x301345, - 0x348aca, - 0x1242, - 0x27c58b, - 0x27d98a, - 0x248906, - 0x20a803, - 0x206c8d, - 0x3c4c4c, - 0x3c534d, - 0x230585, - 0x27bbc5, - 0x296dc7, - 0x3d1149, - 0x20bc46, - 0x254505, - 0x37b708, - 0x2ce983, - 0x2e3948, - 0x2ecc48, - 0x383fc7, - 0x3b8a88, - 0x3c0809, - 0x2fd2c7, - 0x2cd207, - 0x3de588, - 0x23ae04, - 0x23ae07, - 0x3a6bc8, - 0x360f06, - 0x3c0ecf, - 0x22a907, - 0x31e106, - 0x22dcc5, - 0x222343, - 0x246287, - 0x387fc3, - 0x24d046, - 0x24e586, - 0x24f0c6, - 0x293d45, - 0x265c03, - 0x3936c8, - 0x38a109, - 0x39bf8b, - 0x24f248, - 0x250a85, - 0x252305, - 0x5de2dec2, - 0x2842c9, - 0x221e47, - 0x25a045, - 0x257787, - 0x258ac6, - 0x381745, - 0x25a40b, - 0x25c004, - 0x261185, - 0x2612c7, - 0x276806, - 0x276c45, - 0x283d87, - 0x2847c7, - 0x2a7484, - 0x28d0ca, - 0x28dbc8, - 0x2ccc09, - 0x23f285, - 0x205886, - 0x30460a, - 0x266146, - 0x2ed087, - 0x26d30d, - 0x2aa2c9, - 0x391c45, - 0x363847, - 0x289708, - 0x303588, - 0x3286c7, - 0x384d06, - 0x21abc7, - 0x24dbc3, - 0x30db44, - 0x37d485, - 0x3a7747, - 0x3b0d49, - 0x229588, - 0x2ecf85, - 0x2425c4, - 0x247ec5, - 0x24f40d, - 0x200cc2, - 0x2bca46, - 0x2eaf06, - 0x308cca, - 0x39a786, - 0x3a3345, - 0x26d6c5, - 0x26d6c7, - 0x3a5fcc, - 0x256e0a, - 0x28f246, - 0x2e1d85, - 0x2ecb86, - 0x28f507, - 0x291246, - 0x293c4c, - 0x221909, - 0x5e20fa07, - 0x29a9c5, - 0x29a9c6, - 0x29ae08, - 0x2c4005, - 0x2aab45, - 0x2ab848, - 0x2aba4a, - 0x5e67b8c2, - 0x5ea09e42, - 0x355fc5, - 0x237643, - 0x326008, - 0x228703, - 0x2abcc4, - 0x312c4b, - 0x36f688, - 0x2b9648, - 0x5ef03cc9, - 0x2b1009, - 0x2b19c6, - 0x2b2788, - 0x2b2989, - 0x2b3806, - 0x2b3985, - 0x246c06, - 0x2b4749, - 0x2c8947, - 0x38e386, - 0x20af47, - 0x345fc7, - 0x207584, - 0x5f2d1909, - 0x24ad08, - 0x2b7388, - 0x2257c7, - 0x2d5946, - 0x3d0f49, - 0x24e7c7, - 0x24a58a, - 0x32ed08, - 0x3bb707, - 0x3d0606, - 0x2f0e0a, - 0x23df48, - 0x2ea985, - 0x227b85, - 0x3cbc87, - 0x3190c9, - 0x31cf0b, - 0x351f08, - 0x344049, - 0x24fb47, - 0x2c2bcc, - 0x2c3bcc, - 0x2c3eca, - 0x2c414c, - 0x2cc348, - 0x2cc548, - 0x2cc744, - 0x2ce109, - 0x2ce349, - 0x2ce58a, - 0x2ce809, - 0x2ceb87, - 0x3bec0c, - 0x3d2406, - 0x26ccc8, - 0x266206, - 0x38fe86, - 0x391b47, - 0x3a1088, - 0x3debcb, - 0x295247, - 0x257549, - 0x25ba49, - 0x2844c7, - 0x2cca04, - 0x200fc7, - 0x2f0806, - 0x20e486, - 0x24c845, - 0x2f7d48, - 0x26c544, - 0x26c546, - 0x256ccb, - 0x2b3449, - 0x235686, - 0x2e4009, - 0x20b1c6, - 0x345048, - 0x210543, - 0x30bd85, - 0x21a9c9, - 0x21c7c5, - 0x30e1c4, - 0x275d46, - 0x235a05, - 0x254306, - 0x319a07, - 0x247946, - 0x22c2cb, - 0x3c5987, - 0x3a28c6, - 0x2730c6, - 0x22d606, - 0x34c889, - 0x3b604a, - 0x2c58c5, - 0x3d6f8d, - 0x2abb46, - 0x23c346, - 0x2e6f86, - 0x21e5c5, - 0x2f1507, - 0x228ec7, - 0x27390e, - 0x23c803, - 0x2d5909, - 0x297289, - 0x22d287, - 0x26bbc7, - 0x2919c5, - 0x367b05, - 0x5f60210f, - 0x2db607, - 0x2db7c8, - 0x2dbb84, - 0x2dc046, - 0x5fa45402, - 0x2e01c6, - 0x2e2406, - 0x29744e, - 0x2e378a, - 0x207106, - 0x2b7c0a, - 0x3c7709, - 0x2fbe85, - 0x2ee188, - 0x3cbb46, - 0x2b7188, - 0x202ac8, - 0x277fcb, - 0x395f85, - 0x26f748, - 0x3dda4c, - 0x301207, - 0x24eb46, - 0x30c2c8, - 0x3de888, - 0x5fe30a42, - 0x21504b, - 0x205c89, - 0x28d989, - 0x21c647, - 0x3b5dc8, - 0x603d32c8, - 0x20934b, - 0x349bc9, - 0x25b18d, - 0x202908, - 0x2f1008, - 0x60604042, - 0x20d5c4, - 0x60a2aec2, - 0x3cd9c6, - 0x60e01282, - 0x2fbc8a, - 0x2a3806, - 0x34bd48, - 0x3c6908, - 0x3d9746, - 0x2ba946, - 0x3054c6, - 0x2ab045, - 0x239e44, - 0x6122ae04, - 0x359946, - 0x276247, - 0x6160d8c7, - 0x278b4b, - 0x295589, - 0x27bc0a, - 0x26d804, - 0x2f3b08, - 0x38e14d, - 0x2fc409, - 0x2fc648, - 0x2fc8c9, - 0x2fe7c4, - 0x2aae04, - 0x38d205, - 0x346f0b, - 0x36f606, - 0x359785, - 0x236209, - 0x31e6c8, - 0x22af84, - 0x327249, - 0x24a345, - 0x2dbdc8, - 0x2cd8c7, - 0x2889c8, - 0x281006, - 0x3ba447, - 0x2e6b09, - 0x3c9289, - 0x21d705, - 0x3682c5, - 0x61a1e342, - 0x31b244, - 0x21fe85, - 0x395d86, - 0x346905, - 0x244b07, - 0x359a45, - 0x276844, - 0x3487c6, - 0x254587, - 0x238f46, - 0x30a945, - 0x217108, - 0x35c7c5, - 0x21a847, - 0x2277c9, - 0x2b358a, - 0x264cc7, - 0x264ccc, - 0x265406, - 0x2423c9, - 0x31f045, - 0x369188, - 0x211ec3, - 0x398c45, - 0x3b9285, - 0x27b207, - 0x61e08dc2, - 0x2f8087, - 0x2eea86, - 0x38dc46, - 0x2f6146, - 0x3de7c6, - 0x230988, - 0x2d0145, - 0x31e1c7, - 0x31e1cd, - 0x210883, - 0x3d28c5, - 0x270007, - 0x2f83c8, - 0x26fbc5, - 0x214408, - 0x37cf06, - 0x2e50c7, - 0x2d4605, - 0x396006, - 0x393c45, - 0x20ba0a, - 0x310586, - 0x2645c7, - 0x2c9485, - 0x3a8a87, - 0x3cdb04, - 0x30e146, - 0x3cba85, - 0x39a18b, - 0x2f0689, - 0x27ef0a, - 0x21d788, - 0x314248, - 0x31968c, - 0x31adc7, - 0x330a08, - 0x335d88, - 0x3382c5, - 0x358dca, - 0x361049, - 0x62203242, - 0x2945c6, - 0x25c9c4, - 0x2fa949, - 0x35d749, - 0x2451c7, - 0x29b947, - 0x2bfb09, - 0x2ffe08, - 0x2ffe0f, - 0x21b5c6, - 0x2e4bcb, - 0x259dc5, - 0x259dc7, - 0x37bd49, - 0x20c8c6, - 0x3271c7, - 0x2e9105, - 0x230484, - 0x2f5006, - 0x220904, - 0x2f9c47, - 0x321c88, - 0x6270bb08, - 0x30c645, - 0x30c787, - 0x324389, - 0x20d184, - 0x241048, - 0x62bd0448, - 0x2e6f04, - 0x31d648, - 0x295a04, - 0x3b6349, - 0x21e505, - 0x62e33442, - 0x21b605, - 0x2dd945, - 0x289548, - 0x233a07, - 0x632008c2, - 0x22af45, - 0x2de0c6, - 0x243906, - 0x31b208, - 0x338fc8, - 0x3468c6, - 0x34afc6, - 0x306a09, - 0x38db86, - 0x20c78b, - 0x3c2705, - 0x2ac8c6, - 0x3c4a88, - 0x33f6c6, - 0x224786, - 0x216bca, - 0x2df94a, - 0x248a45, - 0x30ce07, - 0x274586, - 0x63603642, - 0x270147, - 0x33c305, - 0x304584, - 0x304585, - 0x2f3a06, - 0x272c47, - 0x203945, - 0x2dfac4, - 0x352248, - 0x224845, - 0x37ae87, - 0x3ca445, - 0x20b945, - 0x2d2904, - 0x2d2909, - 0x2ff2c8, - 0x23a5c6, - 0x35aa06, - 0x302d06, - 0x63bd5b08, - 0x311d07, - 0x31234d, - 0x312f0c, - 0x313509, - 0x313749, - 0x63f75442, - 0x3d4a03, - 0x2010c3, - 0x2f08c5, - 0x3a784a, - 0x338e86, - 0x23cec5, - 0x31a504, - 0x31a50b, - 0x32d64c, - 0x32df0c, - 0x32e215, - 0x32f70d, - 0x33208f, - 0x332452, - 0x3328cf, - 0x332c92, - 0x333113, - 0x3335cd, - 0x333b8d, - 0x333f0e, - 0x33480e, - 0x334e0c, - 0x3351cc, - 0x33560b, - 0x33668e, - 0x336f92, - 0x338c4c, - 0x3391d0, - 0x34cfd2, - 0x34e08c, - 0x34e74d, - 0x34ea8c, - 0x351591, - 0x35280d, - 0x3546cd, - 0x354cca, - 0x354f4c, - 0x35890c, - 0x35948c, - 0x359e8c, - 0x35df93, - 0x35e710, - 0x35eb10, - 0x35f10d, - 0x35f70c, - 0x360549, - 0x36224d, - 0x362593, - 0x364111, - 0x364913, - 0x36560f, - 0x3659cc, - 0x365ccf, - 0x36608d, - 0x36668f, - 0x366a50, - 0x3674ce, - 0x36b40e, - 0x36ba90, - 0x36d08d, - 0x36da0e, - 0x36dd8c, - 0x36ed53, - 0x37268e, - 0x372c10, - 0x373011, - 0x37344f, - 0x373813, - 0x374fcd, - 0x37530f, - 0x3756ce, - 0x375c50, - 0x376049, - 0x3773d0, - 0x3778cf, - 0x377f4f, - 0x378312, - 0x3792ce, - 0x37a00d, - 0x37a54d, - 0x37a88d, - 0x37bf8d, - 0x37c2cd, - 0x37c610, - 0x37ca0b, - 0x37d24c, - 0x37d5cc, - 0x37dbcc, - 0x37dece, - 0x38d350, - 0x38f7d2, - 0x38fc4b, - 0x39078e, - 0x390b0e, - 0x39138e, - 0x39190b, - 0x64391d96, - 0x39268d, - 0x393214, - 0x393f0d, - 0x3955d5, - 0x3978cd, - 0x39824f, - 0x398e0f, - 0x39c24f, - 0x39c60e, - 0x39c98d, - 0x39e251, - 0x3a084c, - 0x3a0b4c, - 0x3a0e4b, - 0x3a128c, - 0x3a1ccf, - 0x3a2092, - 0x3a2bcd, - 0x3a470c, - 0x3a500c, - 0x3a530d, - 0x3a564f, - 0x3a5a0e, - 0x3a750c, - 0x3a7acd, - 0x3a7e0b, - 0x3a8c4c, - 0x3a954d, - 0x3a988e, - 0x3a9c09, - 0x3abb53, - 0x3ac94d, - 0x3ad04d, - 0x3ad64c, - 0x3ae88e, - 0x3aef8f, - 0x3af34c, - 0x3af64d, - 0x3af98f, - 0x3afd4c, - 0x3b034c, - 0x3b080c, - 0x3b0b0c, - 0x3b35cd, - 0x3b3912, - 0x3b45cc, - 0x3b48cc, - 0x3b4bd1, - 0x3b500f, - 0x3b53cf, - 0x3b5793, - 0x3b6f8e, - 0x3b730f, - 0x3b76cc, - 0x647b7d8e, - 0x3b810f, - 0x3b84d6, - 0x3bae52, - 0x3bcccc, - 0x3bdb8f, - 0x3be20d, - 0x3c94cf, - 0x3c988c, - 0x3c9b8d, - 0x3c9ecd, - 0x3cb4ce, - 0x3cc38c, - 0x3ceecc, - 0x3cf1d0, - 0x3d3d91, - 0x3d41cb, - 0x3d460c, - 0x3d490e, - 0x3d6011, - 0x3d644e, - 0x3d67cd, - 0x3dbc0b, - 0x3dc88f, - 0x3dd454, - 0x23c782, - 0x23c782, - 0x23e083, - 0x23c782, - 0x23e083, - 0x23c782, - 0x203802, - 0x246c45, - 0x3d5d0c, - 0x23c782, - 0x23c782, - 0x203802, - 0x23c782, - 0x29b485, - 0x2b3585, - 0x23c782, - 0x23c782, - 0x201542, - 0x29b485, - 0x32fec9, - 0x363e0c, - 0x23c782, - 0x23c782, - 0x23c782, - 0x23c782, - 0x246c45, - 0x23c782, - 0x23c782, - 0x23c782, - 0x23c782, - 0x201542, - 0x32fec9, - 0x23c782, - 0x23c782, - 0x23c782, - 0x2b3585, - 0x23c782, - 0x2b3585, - 0x363e0c, - 0x3d5d0c, - 0x202703, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21a3c3, - 0x242543, - 0x1d904f, - 0x145988, - 0x1a704, - 0x3dc3, - 0x86808, - 0x1cc203, - 0x2000c2, - 0x65601242, - 0x240983, - 0x224c84, - 0x207083, - 0x384584, - 0x22f7c6, - 0x310c83, - 0x310c44, - 0x2f0b05, - 0x23c803, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x21e2ca, - 0x252b06, - 0x390e8c, - 0x9a048, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x2137c3, - 0x2e2406, - 0x21a3c3, - 0x242543, - 0x2141c3, - 0x2fb03, - 0xac508, - 0x661d2145, - 0x47d47, - 0x139b05, - 0x156c9, - 0x1742, - 0x13a14a, - 0x66fa0505, - 0x139b05, - 0x29907, - 0x6dfc8, - 0x9c4e, - 0x8b392, - 0x9630b, - 0x10d806, - 0x6728d505, - 0x6768d50c, - 0x13d547, - 0x17e707, - 0x12364a, - 0x3be50, - 0x146145, - 0x10fe4b, - 0x79108, - 0x25687, - 0x2490b, - 0x33249, - 0x46e07, - 0x15c087, - 0xc2487, - 0x34a06, - 0x106c8, - 0x67c28886, - 0x47207, - 0x18ec46, - 0x78d8d, - 0xf3c90, - 0x680aac82, - 0xd1288, - 0x40350, - 0x17f5cc, - 0x687825cd, - 0x5a988, - 0x5ae0b, - 0x6b187, - 0x70749, - 0x56306, - 0x9b008, - 0x3ee42, - 0x9218a, - 0x157647, - 0x107c07, - 0xacdc9, - 0xaff88, - 0xf3605, - 0x18d986, - 0x1ba1c6, - 0xfd84e, - 0xaf88e, - 0x3874f, - 0x41a89, - 0xf0c09, - 0x91d0b, - 0xb3b4f, - 0xbd08c, - 0xca18b, - 0x131388, - 0x171887, - 0x197088, - 0xb580b, - 0xb5bcc, - 0xb5fcc, - 0xb63cc, - 0xb66cd, - 0x1b1148, - 0x52e82, - 0x193a49, - 0x112988, - 0x19fe8b, - 0xd5b46, - 0xdda8b, - 0x136acb, - 0xe884a, - 0xea585, - 0xf1210, - 0xf5c86, - 0x184806, - 0x97805, - 0x91487, - 0xe0448, - 0xf92c7, - 0xf9587, - 0x12c807, - 0xc7346, - 0x1cd80a, - 0x99eca, - 0x11ec6, - 0xb130d, - 0x472c8, - 0x115488, - 0x115cc9, - 0xc0545, - 0x1aec8c, - 0xb68cb, - 0x86fc9, - 0x1ccb44, - 0x111949, - 0x111b86, - 0x4cec6, - 0x3c686, - 0x1b82, - 0x365c6, - 0x13dacb, - 0x129187, - 0x11ac47, - 0x1442, - 0xd7445, - 0x27e04, - 0x101, - 0x4fd83, - 0x67a37806, - 0x9b383, - 0x382, - 0x26bc4, - 0xac2, - 0xd3684, - 0x882, - 0x31c2, - 0x16c2, - 0x20f82, - 0x86c2, - 0x8d502, - 0xd42, - 0x167c2, - 0x373c2, - 0x5582, - 0x2a42, - 0x4e782, - 0x32dc3, - 0x942, - 0x3c42, - 0xdec2, - 0x5dc2, - 0x642, - 0x315c2, - 0x6502, - 0x5bc2, - 0xf42, - 0x5c2, - 0x1bc83, - 0x4582, - 0x7882, - 0x49582, - 0x1e42, - 0x2042, - 0x8282, - 0x23502, - 0x17c2, - 0x9e82, - 0x3f82, - 0x6c9c2, - 0x15402, - 0x1a3c3, - 0x602, - 0x30a42, - 0x2902, - 0x1ad42, - 0x1d685, - 0xa882, - 0x14b42, - 0x3d383, - 0x682, - 0xca42, - 0x45c2, - 0x7842, - 0x2f82, - 0x8c2, - 0xc2c2, - 0x1b82, - 0x1805, - 0x68a03802, - 0x68edf283, - 0xf283, - 0x69203802, - 0xf283, - 0x74c47, - 0x201503, - 0x2000c2, - 0x214a83, - 0x232dc3, - 0x228503, - 0x2005c3, - 0x2137c3, - 0x21a3c3, - 0x203dc3, - 0x242543, - 0x29b3c3, - 0xc0584, - 0x19405, - 0x104305, - 0x3a83, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x228503, - 0x23c803, - 0x21a3c3, - 0x203dc3, - 0x1b4103, - 0x242543, - 0x214a83, - 0x232dc3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x200181, - 0x23c803, - 0x21a3c3, - 0x24e283, - 0x242543, - 0x69944, - 0x202703, - 0x214a83, - 0x232dc3, - 0x218bc3, - 0x228503, - 0x2c26c3, - 0x208943, - 0x2a37c3, - 0x216243, - 0x308003, - 0x221dc4, - 0x21a3c3, - 0x242543, - 0x207783, - 0x204244, - 0x24f603, - 0x20dc3, - 0x29cfc3, - 0x328fc8, - 0x2f0e44, - 0x20020a, - 0x235406, - 0x124184, - 0x3a71c7, - 0x21ec8a, - 0x21b489, - 0x3bb287, - 0x3c024a, - 0x202703, - 0x35604b, - 0x216189, - 0x2f4245, - 0x3b0647, - 0x1242, - 0x214a83, - 0x20fcc7, - 0x263bc5, - 0x2cc8c9, - 0x232dc3, - 0x373ec6, - 0x2cb983, - 0xeeb03, - 0x118f86, - 0x98186, - 0x1d3bc7, - 0x212286, - 0x220fc5, - 0x205b47, - 0x316507, - 0x6bf08003, - 0x34e2c7, - 0x23c783, - 0x3d3905, - 0x221dc4, - 0x26f3c8, - 0x385acc, - 0x2b8d05, - 0x2aa446, - 0x20fb87, - 0x3b9887, - 0x3a2a07, - 0x248b48, - 0x317ccf, - 0x21b6c5, - 0x240a87, - 0x28e747, - 0x276e0a, - 0x37b549, - 0x3dd185, - 0x3212ca, - 0xc4ac6, - 0xc0a07, - 0x2cba05, - 0x2f6684, - 0x3d9686, - 0x101406, - 0x37f847, - 0x252d87, - 0x33b388, - 0x218405, - 0x263ac6, - 0x156ec8, - 0x2e3d85, - 0xe3f46, - 0x3268c5, - 0x28ce44, - 0x24a407, - 0x2307ca, - 0x23ab88, - 0x288e06, - 0x137c3, - 0x2ec0c5, - 0x320506, - 0x3bee46, - 0x297706, - 0x23c803, - 0x3a2e47, - 0x28e6c5, - 0x21a3c3, - 0x2e8b0d, - 0x203dc3, - 0x33b488, - 0x213484, - 0x276b05, - 0x2abd06, - 0x205406, - 0x2ac7c7, - 0x25b047, - 0x350ac5, - 0x242543, - 0x271d87, - 0x371989, - 0x2708c9, - 0x384a4a, - 0x215542, - 0x3d38c4, - 0x2fb304, - 0x2f7c07, - 0x2f7f48, - 0x2fa3c9, - 0x3d2789, - 0x2fadc7, - 0x109049, - 0x362f06, - 0xfd5c6, - 0x2fe7c4, - 0x22cf8a, - 0x302448, - 0x305389, - 0x305946, - 0x2bc745, - 0x23aa48, - 0x2d5dca, - 0x32bf03, - 0x2043c6, - 0x2faec7, - 0x35a785, - 0x3b4045, - 0x2432c3, - 0x23e804, - 0x227b45, - 0x2848c7, - 0x2ff405, - 0x2ff846, - 0x111e85, - 0x2071c3, - 0x2071c9, - 0x2768cc, - 0x2c61cc, - 0x3444c8, - 0x2ab3c7, - 0x30d588, - 0x10e747, - 0x30eaca, - 0x30f18b, - 0x2162c8, - 0x205508, - 0x22b686, - 0x302bc5, - 0x25d70a, - 0x2df2c5, - 0x233442, - 0x2d44c7, - 0x253c46, - 0x376785, - 0x310949, - 0x2d0405, - 0x372185, - 0x3c2409, - 0x320446, - 0x201348, - 0x3d39c3, - 0x20aa46, - 0x275c86, - 0x31cd05, - 0x31cd09, - 0x2c4709, - 0x25d487, - 0x11cb84, - 0x31cb87, - 0x3d2689, - 0x21ee85, - 0x39f48, - 0x349845, - 0x353885, - 0x39b489, - 0x204b42, - 0x357204, - 0x209282, - 0x204582, - 0x2ed985, - 0x323f08, - 0x2c0485, - 0x2ced43, - 0x2ced45, - 0x2e03c3, - 0x20a742, - 0x2b4384, - 0x269f03, - 0x200a82, - 0x3b17c4, - 0x309703, - 0x20cb42, - 0x2c0503, - 0x211e44, - 0x305ac3, - 0x255544, - 0x205142, - 0x2140c3, - 0x21ab03, - 0x2071c2, - 0x294ec2, - 0x2c4549, - 0x205b02, - 0x28bec4, - 0x206542, - 0x23a8c4, - 0x362ec4, - 0x3b4384, - 0x201b82, - 0x22b2c2, - 0x22db03, - 0x29cec3, - 0x3269c4, - 0x3aa684, - 0x2dae84, - 0x2ea884, - 0x31bcc3, - 0x312743, - 0x2c4a44, - 0x31f184, - 0x31f2c6, - 0x21d642, - 0x1242, - 0x41483, - 0x201242, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x6c05, - 0x2000c2, - 0x202703, - 0x214a83, - 0x232dc3, - 0x209b03, - 0x308003, - 0x221dc4, - 0x2c4804, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x2141c3, - 0x2fedc4, - 0x297a83, - 0x2ad843, - 0x37a2c4, - 0x349646, - 0x210603, - 0x139b05, - 0x17e707, - 0x2d2c43, - 0x6da46f08, - 0x2532c3, - 0x2bb143, - 0x25cc03, - 0x2137c3, - 0x3c0ac5, - 0x1b0603, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x20a883, - 0x22ee03, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21bc83, - 0x21a3c3, - 0x2801c4, - 0x1b4103, - 0x242543, - 0x24a004, - 0x139b05, - 0x2c8f85, - 0x17e707, - 0x201242, - 0x2052c2, - 0x200382, - 0x208482, - 0x3dc3, - 0x2003c2, - 0x4f04, - 0x214a83, - 0x235b44, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x20e2c3, - 0x2d3684, - 0x9a048, - 0x214a83, - 0x203dc3, - 0x3a83, - 0x122504, - 0x24c0c4, - 0x9a048, - 0x214a83, - 0x24d9c4, - 0x221dc4, - 0x203dc3, - 0x204042, - 0x1b4103, - 0x242543, - 0x22b983, - 0x3e804, - 0x208805, - 0x233442, - 0x325e43, - 0x68b49, - 0xe5986, - 0x149948, - 0x2000c2, - 0x9a048, - 0x201242, - 0x232dc3, - 0x308003, - 0x2005c2, - 0x3dc3, - 0x242543, - 0x7c42, - 0x82, - 0xc2, - 0x1c0407, - 0x142c09, - 0x7aec3, - 0x9a048, - 0x20f43, - 0x713233c7, - 0x14a83, - 0x944c8, - 0x32dc3, - 0x108003, - 0x1ab9c6, - 0x1bc83, - 0x92788, - 0xcae48, - 0xcff06, - 0x3c803, - 0xd8cc8, - 0x44b83, - 0x714eb886, - 0xf1c05, - 0x32fc7, - 0x1a3c3, - 0x11003, - 0x42543, - 0xeb02, - 0x17cd0a, - 0x2cc3, - 0xeda43, - 0x10a104, - 0x117acb, - 0x118088, - 0x90602, - 0x14540c7, - 0x15636c7, - 0x14cee08, - 0x14cf583, - 0x143acb, - 0xb342, - 0x12bcc7, - 0x11b504, - 0x2000c2, - 0x201242, - 0x235b44, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x2137c3, - 0x21a3c3, - 0x242543, - 0x215d43, - 0x20e2c3, - 0x2fb03, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x602, - 0x3a83, - 0x108003, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x2137c3, - 0x21a3c3, - 0x242543, - 0x20c782, - 0x2000c1, - 0x2000c2, - 0x200201, - 0x332182, - 0x9a048, - 0x21ca05, - 0x200101, - 0x14a83, - 0x2fe44, - 0x201301, - 0x200501, - 0x205dc1, - 0x246bc2, - 0x387fc4, - 0x246bc3, - 0x200041, - 0x200801, - 0x200181, - 0x200701, - 0x302fc7, - 0x30e38f, - 0x3ccc06, - 0x2004c1, - 0x322546, - 0x200bc1, - 0x200581, - 0x3affce, - 0x2003c1, - 0x242543, - 0x200a81, - 0x34c105, - 0x20eb02, - 0x2431c5, - 0x200401, - 0x200741, - 0x2007c1, - 0x233442, - 0x200081, - 0x201341, - 0x204f01, - 0x201b41, - 0x201441, - 0x50849, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x214903, - 0x214a83, - 0x308003, - 0x90548, - 0x23c803, - 0x21a3c3, - 0x7283, - 0x242543, - 0x14f62c8, - 0x1e0603, - 0xa788, - 0x139b05, - 0x9a048, - 0x3dc3, - 0x139b05, - 0xcd184, - 0xd1488, - 0x455c4, - 0xcf487, - 0xd3b05, - 0x50849, - 0x11d287, - 0x14f62ca, - 0x9a048, - 0x1b4103, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x220dc3, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x2e3504, - 0x242543, - 0x24f8c5, - 0x2d0204, - 0x214a83, - 0x232dc3, - 0x308003, - 0x209e82, - 0x21a3c3, - 0x242543, - 0xe2c3, - 0xac60a, - 0xe8006, - 0x102804, - 0x122046, - 0x202703, - 0x214a83, - 0x232dc3, - 0x308003, - 0x21a3c3, - 0x242543, - 0x201242, - 0x214a83, - 0x2303c9, - 0x232dc3, - 0x2aa909, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x78a84, - 0x3dc3, - 0x242543, - 0x2fe5c8, - 0x23c207, - 0x208805, - 0xdbc48, - 0x1d4408, - 0x1c0407, - 0xf81ca, - 0x6f98b, - 0x122787, - 0x3f888, - 0xd174a, - 0xf648, - 0x142c09, - 0x27a07, - 0x1fa87, - 0x3ec8, - 0x944c8, - 0x40d4f, - 0x3ad45, - 0x947c7, - 0x1ab9c6, - 0x3cd87, - 0x1dd2c6, - 0x92788, - 0x99786, - 0x1147, - 0x2fc9, - 0x18ab07, - 0x179dc9, - 0xc2749, - 0xc8d06, - 0xcae48, - 0xdbf05, - 0x7b74a, - 0xd8cc8, - 0x44b83, - 0xe07c8, - 0x32fc7, - 0x95d05, - 0x51590, - 0x11003, - 0x1b4103, - 0x2e47, - 0x1acc5, - 0xf9888, - 0x66605, - 0xeda43, - 0x1cb7c8, - 0xee06, - 0x32109, - 0xb2b87, - 0x68e0b, - 0x6cc44, - 0x111444, - 0x117acb, - 0x118088, - 0x118e87, - 0x139b05, - 0x214a83, - 0x232dc3, - 0x228503, - 0x242543, - 0x23e343, - 0x308003, - 0x1b4103, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x91e4b, - 0x2000c2, - 0x201242, - 0x242543, - 0xd42, - 0x9e82, - 0x7782, - 0x9a048, - 0x1b3089, - 0x1242, - 0x2000c2, - 0x201242, - 0x200382, - 0x2005c2, - 0x210942, - 0x21a3c3, - 0x13f246, - 0x2003c2, - 0x3e804, - 0x2000c2, - 0x202703, - 0x201242, - 0x214a83, - 0x232dc3, - 0x200382, - 0x308003, - 0x21bc83, - 0x23c803, - 0x219a04, - 0x21a3c3, - 0x2125c3, - 0x3dc3, - 0x242543, - 0x30a104, - 0x207783, - 0x308003, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x203dc3, - 0x242543, - 0x3bd187, - 0x214a83, - 0x27b0c7, - 0x397206, - 0x216c83, - 0x21bb43, - 0x308003, - 0x206c03, - 0x221dc4, - 0x28a404, - 0x3383c6, - 0x213a43, - 0x21a3c3, - 0x242543, - 0x24f8c5, - 0x2af384, - 0x323b43, - 0x2ce043, - 0x2d44c7, - 0x2cd845, - 0x68703, - 0x214a83, - 0x232dc3, - 0x308003, - 0x23c803, - 0x21a3c3, - 0x6e544, - 0x242543, - 0x14583, - 0x7c30988c, - 0x53547, - 0xe4846, - 0x91487, - 0x67f05, - 0x202b02, - 0x247403, - 0x214f03, - 0x202703, - 0x7ce14a83, - 0x208c02, - 0x232dc3, - 0x207083, - 0x308003, - 0x221dc4, - 0x2059c3, - 0x21b6c3, - 0x23c803, - 0x219a04, - 0x7d20ce02, - 0x21a3c3, - 0x242543, - 0x2308c3, - 0x21bd03, - 0x21a443, - 0x20c782, - 0x207783, - 0x9a048, - 0x308003, - 0x3a83, - 0x2135c4, - 0x202703, - 0x201242, - 0x214a83, - 0x235b44, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x21bc83, - 0x3473c4, - 0x306c44, - 0x2e2406, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x2141c3, - 0x253c46, - 0x34c8b, - 0x28886, - 0xec90a, - 0x11b94a, - 0x9a048, - 0x2136c4, - 0x7e614a83, - 0x2026c4, - 0x232dc3, - 0x270744, - 0x308003, - 0x2f3983, - 0x23c803, - 0x21a3c3, - 0x1b4103, - 0x242543, - 0x4cbc3, - 0x347f8b, - 0x3ca20a, - 0x3e010c, - 0xebe48, - 0x2000c2, - 0x201242, - 0x200382, - 0x22d805, - 0x221dc4, - 0x209e82, - 0x23c803, - 0x306c44, - 0x208482, - 0x2003c2, - 0x2090c2, - 0x20c782, - 0x2703, - 0x15702, - 0x2cb209, - 0x365308, - 0x307e89, - 0x2073c9, - 0x20b40a, - 0x210f0a, - 0x206082, - 0x2167c2, - 0x1242, - 0x214a83, - 0x22ba02, - 0x240c46, - 0x377dc2, - 0x208d42, - 0x26fd0e, - 0x21410e, - 0x27e307, - 0x21a347, - 0x24dc82, - 0x232dc3, - 0x308003, - 0x210d82, - 0x2005c2, - 0x1bac3, - 0x235d4f, - 0x21fb02, - 0x2b8887, - 0x3520c7, - 0x2bc287, - 0x2e9ccc, - 0x2dc18c, - 0x20c304, - 0x38d04a, - 0x214042, - 0x201e42, - 0x2c5104, - 0x200702, - 0x2cc342, - 0x2dc3c4, - 0x20fe82, - 0x202042, - 0x1a8c3, - 0x299807, - 0x23a705, - 0x223502, - 0x23cd04, - 0x203f82, - 0x2eba08, - 0x21a3c3, - 0x376b08, - 0x2029c2, - 0x20c4c5, - 0x396e06, - 0x242543, - 0x20a882, - 0x2fa607, - 0xeb02, - 0x39e785, - 0x3c2f45, - 0x206442, - 0x20b382, - 0x33a90a, - 0x35094a, - 0x23c7c2, - 0x2a4284, - 0x203282, - 0x3d3788, - 0x20a5c2, - 0x359208, - 0xf01, - 0x314447, - 0x3149c9, - 0x2b7402, - 0x319985, - 0x3b9c45, - 0x2184cb, - 0x33894c, - 0x22c088, - 0x32bb08, - 0x21d642, - 0x2ac882, - 0x2000c2, - 0x9a048, - 0x201242, - 0x214a83, - 0x200382, - 0x208482, - 0x3dc3, - 0x2003c2, - 0x242543, - 0x2090c2, - 0x2000c2, - 0x139b05, - 0x7fa01242, - 0x1099c4, - 0x37e85, - 0x80708003, - 0x21a8c3, - 0x209e82, - 0x21a3c3, - 0x3b68c3, - 0x80a42543, - 0x2f7103, - 0x274d46, - 0x160e2c3, - 0x139b05, - 0x13f10b, - 0x9a048, - 0x7ff02e08, - 0x5c1c7, - 0x802c108a, - 0x6ddc7, - 0x97805, - 0x2a54d, - 0x8e242, - 0x118682, - 0xe01, - 0xad28a, - 0x150787, - 0x20c04, - 0x20c43, - 0x3c704, - 0x81202842, - 0x81600ac2, - 0x81a01182, - 0x81e02d02, - 0x82206b42, - 0x826086c2, - 0x17e707, - 0x82a01242, - 0x82e2ec02, - 0x8321f2c2, - 0x83602a42, - 0x214103, - 0xca04, - 0x22dcc3, - 0x83a0e442, - 0x5a988, - 0x83e015c2, - 0x4e2c7, - 0x1ad887, - 0x84200042, - 0x84600d82, - 0x84a00182, - 0x84e06182, - 0x85200f42, - 0x856005c2, - 0xf4185, - 0x24dec3, - 0x35c004, - 0x85a00702, - 0x85e14d42, - 0x86206002, - 0x7a04b, - 0x86600c42, - 0x86e01f42, - 0x87209e82, - 0x87610942, - 0x87a1d542, - 0x87e00bc2, - 0x88202382, - 0x8866c9c2, - 0x88a0ce02, - 0x88e03142, - 0x89208482, - 0x89637242, - 0x89a510c2, - 0x89e43802, - 0x5684, - 0x310543, - 0x8a200ec2, - 0x8a610e82, - 0x8aa0e742, - 0x8ae006c2, - 0x8b2003c2, - 0x8b600a82, - 0xf6bc8, - 0x91fc7, - 0x8ba141c2, - 0x8be06142, - 0x8c2090c2, - 0x8c6023c2, - 0x1aec8c, - 0x8ca02c02, - 0x8ce25b82, - 0x8d20f482, - 0x8d603642, - 0x8da00f02, - 0x8de0b582, - 0x8e201342, - 0x8e607302, - 0x8ea76002, - 0x8ee76542, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x23703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x86a059c3, - 0x223703, - 0x3c0b44, - 0x307d86, - 0x306403, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x374689, - 0x215702, - 0x39b6c3, - 0x2c2a43, - 0x2894c5, - 0x207083, - 0x2059c3, - 0x223703, - 0x267d83, - 0x211243, - 0x3c4409, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x2059c3, - 0x223703, - 0x215702, - 0x215702, - 0x2059c3, - 0x223703, - 0x8f614a83, - 0x232dc3, - 0x207603, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x9a048, - 0x201242, - 0x214a83, - 0x21a3c3, - 0x242543, - 0x141842, - 0x214a83, - 0x232dc3, - 0x308003, - 0x901192c2, - 0x23c803, - 0x21a3c3, - 0x3dc3, - 0x242543, - 0x1301, - 0x24c0c4, - 0x201242, - 0x214a83, - 0x200983, - 0x232dc3, - 0x24d9c4, - 0x228503, - 0x308003, - 0x221dc4, - 0x21bc83, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x22b983, - 0x208805, - 0x211243, - 0x207783, - 0x882, - 0x3dc3, - 0x201242, - 0x214a83, - 0x2059c3, - 0x21a3c3, - 0x242543, - 0x2000c2, - 0x202703, - 0x9a048, - 0x214a83, - 0x232dc3, - 0x308003, - 0x22f7c6, - 0x221dc4, - 0x21bc83, - 0x219a04, - 0x21a3c3, - 0x242543, - 0x2141c3, - 0x29904, - 0x214a83, - 0x239c3, - 0x232dc3, - 0x9e82, - 0x21a3c3, - 0x242543, - 0x2aec2, - 0x2982, - 0x147ee07, - 0x1807, - 0x214a83, - 0x28886, - 0x232dc3, - 0x308003, - 0xedf86, - 0x21a3c3, - 0x242543, - 0x328e48, - 0x32b949, - 0x33e209, - 0x34ae08, - 0x399488, - 0x399489, - 0x322c0a, - 0x3602ca, - 0x39424a, - 0x39abca, - 0x3ca20a, - 0x3d818b, - 0x30838d, - 0x23fd4f, - 0x35d210, - 0x361d4d, - 0x37d8cc, - 0x39a90b, - 0x6dfc8, - 0x11d548, - 0x19d705, - 0x1486107, - 0xd7445, - 0x2000c2, - 0x2cd685, - 0x202003, - 0x93601242, - 0x232dc3, - 0x308003, - 0x27e7c7, - 0x25cc03, - 0x23c803, - 0x21a3c3, - 0x24e283, - 0x2125c3, - 0x206a03, - 0x203dc3, - 0x242543, - 0x252b06, - 0x233442, - 0x207783, - 0x9a048, - 0x2000c2, - 0x202703, - 0x201242, - 0x214a83, - 0x232dc3, - 0x308003, - 0x221dc4, - 0x23c803, - 0x21a3c3, - 0x242543, - 0x20e2c3, - 0x1807, - 0xb342, - 0x68b44, - 0x151c306, - 0x2000c2, - 0x201242, - 0x308003, - 0x23c803, - 0x242543, -} - -// children is the list of nodes' children, the parent's wildcard bit and the -// parent's node type. If a node has no children then their children index -// will be in the range [0, 6), depending on the wildcard bit and node type. -// -// The layout within the uint32, from MSB to LSB, is: -// [ 1 bits] unused -// [ 1 bits] wildcard bit -// [ 2 bits] node type -// [14 bits] high nodes index (exclusive) of children -// [14 bits] low nodes index (inclusive) of children -var children = [...]uint32{ - 0x0, - 0x10000000, - 0x20000000, - 0x40000000, - 0x50000000, - 0x60000000, - 0x17ec5f5, - 0x17f05fb, - 0x17f45fc, - 0x18185fd, - 0x1970606, - 0x198865c, - 0x199c662, - 0x19b4667, - 0x19d466d, - 0x19f4675, - 0x1a0c67d, - 0x1a2c683, - 0x1a3068b, - 0x1a5868c, - 0x1a5c696, - 0x1a74697, - 0x1a7869d, - 0x1a7c69e, - 0x1ab869f, - 0x1abc6ae, - 0x1ac06af, - 0x61ac86b0, - 0x21ad06b2, - 0x1b186b4, - 0x1b1c6c6, - 0x1b406c7, - 0x1b446d0, - 0x1b486d1, - 0x1b5c6d2, - 0x1b606d7, - 0x1b806d8, - 0x1bb06e0, - 0x1bcc6ec, - 0x1bf46f3, - 0x1c046fd, - 0x1c08701, - 0x1ca0702, - 0x1cb4728, - 0x1cc872d, - 0x1d00732, - 0x1d10740, - 0x1d24744, - 0x1d3c749, - 0x1de074f, - 0x1fe4778, - 0x1fe87f9, - 0x20547fa, - 0x20c0815, - 0x20d8830, - 0x20ec836, - 0x20f083b, - 0x20f883c, - 0x210c83e, - 0x2110843, - 0x2130844, - 0x218084c, - 0x2184860, - 0x22188861, - 0x21a4862, - 0x21a8869, - 0x21ac86a, - 0x21d086b, - 0x2214874, - 0x2218885, - 0x6221c886, - 0x2238887, - 0x226488e, - 0x2270899, - 0x228089c, - 0x23348a0, - 0x23388cd, - 0x223488ce, - 0x2234c8d2, - 0x223548d3, - 0x23ac8d5, - 0x23b08eb, - 0x23b48ec, - 0x28dc8ed, - 0x28e0a37, - 0x22988a38, - 0x2298ca62, - 0x22990a63, - 0x2299ca64, - 0x229a0a67, - 0x229aca68, - 0x229b0a6b, - 0x229b4a6c, - 0x229b8a6d, - 0x229bca6e, - 0x229c0a6f, - 0x229cca70, - 0x229d0a73, - 0x229dca74, - 0x229e0a77, - 0x229e4a78, - 0x229e8a79, - 0x229f4a7a, - 0x229f8a7d, - 0x22a04a7e, - 0x22a08a81, - 0x22a0ca82, - 0x22a10a83, - 0x2a14a84, - 0x22a18a85, - 0x22a24a86, - 0x22a28a89, - 0x2a2ca8a, - 0x2a34a8b, - 0x62a40a8d, - 0x2a84a90, - 0x22aa4aa1, - 0x22aa8aa9, - 0x22aacaaa, - 0x22ab0aab, - 0x22ab8aac, - 0x22abcaae, - 0x2ac0aaf, - 0x22ac4ab0, - 0x22ac8ab1, - 0x22accab2, - 0x22ad0ab3, - 0x2ad8ab4, - 0x2ae0ab6, - 0x2ae4ab8, - 0x2b00ab9, - 0x2b18ac0, - 0x2b1cac6, - 0x2b2cac7, - 0x2b38acb, - 0x2b6cace, - 0x2b74adb, - 0x22b78add, - 0x2b90ade, - 0x22b98ae4, - 0x22b9cae6, - 0x22ba4ae7, - 0x2ca0ae9, - 0x22ca4b28, - 0x2cacb29, - 0x2cb0b2b, - 0x22cb4b2c, - 0x2cb8b2d, - 0x2ce0b2e, - 0x2ce4b38, - 0x2ce8b39, - 0x2cecb3a, - 0x2d04b3b, - 0x2d18b41, - 0x2d40b46, - 0x2d60b50, - 0x2d64b58, - 0x62d68b59, - 0x2d9cb5a, - 0x2da0b67, - 0x22da4b68, - 0x2da8b69, - 0x2dd0b6a, - 0x2dd4b74, - 0x2df8b75, - 0x2dfcb7e, - 0x2e10b7f, - 0x2e14b84, - 0x2e18b85, - 0x2e38b86, - 0x2e54b8e, - 0x2e58b95, - 0x22e5cb96, - 0x2e60b97, - 0x2e64b98, - 0x2e68b99, - 0x2e70b9a, - 0x2e84b9c, - 0x2e88ba1, - 0x2e8cba2, - 0x2eb4ba3, - 0x2eb8bad, - 0x2f2cbae, - 0x2f30bcb, - 0x2f34bcc, - 0x2f54bcd, - 0x2f6cbd5, - 0x2f70bdb, - 0x2f84bdc, - 0x2f9cbe1, - 0x2fbcbe7, - 0x2fd4bef, - 0x2fd8bf5, - 0x2ff4bf6, - 0x3010bfd, - 0x3014c04, - 0x3040c05, - 0x3060c10, - 0x3080c18, - 0x30e4c20, - 0x3104c39, - 0x3120c41, - 0x3124c48, - 0x313cc49, - 0x3180c4f, - 0x3200c60, - 0x3230c80, - 0x3234c8c, - 0x3240c8d, - 0x3260c90, - 0x3264c98, - 0x3288c99, - 0x3290ca2, - 0x32ccca4, - 0x3320cb3, - 0x3324cc8, - 0x3328cc9, - 0x3404cca, - 0x2340cd01, - 0x23410d03, - 0x23414d04, - 0x3418d05, - 0x2341cd06, - 0x23420d07, - 0x3424d08, - 0x23428d09, - 0x23438d0a, - 0x2343cd0e, - 0x23440d0f, - 0x23444d10, - 0x23448d11, - 0x2344cd12, - 0x3464d13, - 0x3488d19, - 0x34a8d22, - 0x3b14d2a, - 0x3b20ec5, - 0x3b40ec8, - 0x3d00ed0, - 0x3dd0f40, - 0x3e40f74, - 0x3e98f90, - 0x3f80fa6, - 0x3fd8fe0, - 0x4014ff6, - 0x4111005, - 0x41dd044, - 0x4275077, - 0x430509d, - 0x43690c1, - 0x45a10da, - 0x4659168, - 0x4725196, - 0x47711c9, - 0x47f91dc, - 0x48351fe, - 0x488520d, - 0x48fd221, - 0x6490123f, - 0x64905240, - 0x64909241, - 0x4985242, - 0x49e1261, - 0x4a5d278, - 0x4ad5297, - 0x4b552b5, - 0x4bc12d5, - 0x4ced2f0, - 0x4d4533b, - 0x64d49351, - 0x4de1352, - 0x4de9378, - 0x24ded37a, - 0x4e7537b, - 0x4ec139d, - 0x4f293b0, - 0x4fd13ca, - 0x50993f4, - 0x5101426, - 0x5215440, - 0x65219485, - 0x6521d486, - 0x5279487, - 0x52d549e, - 0x53654b5, - 0x53e14d9, - 0x54254f8, - 0x5509509, - 0x553d542, - 0x559d54f, - 0x5611567, - 0x5699584, - 0x56d95a6, - 0x57495b6, - 0x6574d5d2, - 0x57755d3, - 0x57795dd, - 0x57a95de, - 0x57c55ea, - 0x58095f1, - 0x5819602, - 0x5831606, - 0x58a960c, - 0x58b162a, - 0x58cd62c, - 0x58e1633, - 0x58fd638, - 0x592963f, - 0x592d64a, - 0x593564b, - 0x594964d, - 0x5969652, - 0x597965a, - 0x598565e, - 0x59c1661, - 0x59c9670, - 0x59dd672, - 0x5a05677, - 0x5a11681, - 0x5a19684, - 0x5a41686, - 0x5a65690, - 0x5a7d699, - 0x5a8169f, - 0x5a896a0, - 0x5a9d6a2, - 0x5b456a7, - 0x5b496d1, - 0x5b4d6d2, - 0x5b516d3, - 0x5b756d4, - 0x5b996dd, - 0x5bb56e6, - 0x5bc96ed, - 0x5bdd6f2, - 0x5be56f7, - 0x5bed6f9, - 0x5bf56fb, - 0x5c0d6fd, - 0x5c1d703, - 0x5c21707, - 0x5c3d708, - 0x64c570f, - 0x64fd931, - 0x652993f, - 0x654594a, - 0x6565951, - 0x6585959, - 0x65c9961, - 0x65d1972, - 0x265d5974, - 0x265d9975, - 0x65e1976, - 0x67cd978, - 0x267d19f3, - 0x67d59f4, - 0x267d99f5, - 0x267e99f6, - 0x267f19fa, - 0x267fd9fc, - 0x68019ff, - 0x26809a00, - 0x6811a02, - 0x6821a04, - 0x6849a08, - 0x6885a12, - 0x6889a21, - 0x68c1a22, - 0x68e5a30, - 0x743da39, - 0x7441d0f, - 0x7445d10, - 0x27449d11, - 0x744dd12, - 0x27451d13, - 0x7455d14, - 0x27461d15, - 0x7465d18, - 0x7469d19, - 0x2746dd1a, - 0x7471d1b, - 0x27479d1c, - 0x747dd1e, - 0x7481d1f, - 0x27491d20, - 0x7495d24, - 0x7499d25, - 0x749dd26, - 0x74a1d27, - 0x274a5d28, - 0x74a9d29, - 0x74add2a, - 0x74b1d2b, - 0x74b5d2c, - 0x274bdd2d, - 0x74c1d2f, - 0x74c5d30, - 0x74c9d31, - 0x274cdd32, - 0x74d1d33, - 0x274d9d34, - 0x274ddd36, - 0x74f9d37, - 0x7511d3e, - 0x7555d44, - 0x7559d55, - 0x757dd56, - 0x7589d5f, - 0x758dd62, - 0x7591d63, - 0x7755d64, - 0x27759dd5, - 0x27761dd6, - 0x27765dd8, - 0x27769dd9, - 0x7771dda, - 0x784dddc, - 0x27859e13, - 0x2785de16, - 0x27861e17, - 0x27865e18, - 0x7869e19, - 0x7895e1a, - 0x78a1e25, - 0x78a5e28, - 0x78c9e29, - 0x78d5e32, - 0x78f5e35, - 0x78f9e3d, - 0x7931e3e, - 0x7be1e4c, - 0x7c9def8, - 0x7ca1f27, - 0x7ca5f28, - 0x7cb9f29, - 0x7cbdf2e, - 0x7cf1f2f, - 0x7d29f3c, - 0x27d2df4a, - 0x7d49f4b, - 0x7d71f52, - 0x7d75f5c, - 0x7d99f5d, - 0x7db5f66, - 0x7dddf6d, - 0x7dedf77, - 0x7df1f7b, - 0x7df5f7c, - 0x7e2df7d, - 0x7e39f8b, - 0x7e61f8e, - 0x7ee1f98, - 0x27ee5fb8, - 0x7ef5fb9, - 0x7f05fbd, - 0x7f21fc1, - 0x7f41fc8, - 0x7f45fd0, - 0x7f59fd1, - 0x7f6dfd6, - 0x7f71fdb, - 0x7f75fdc, - 0x7f79fdd, - 0x7f99fde, - 0x8041fe6, - 0x8046010, - 0x8062011, - 0x808a018, - 0x808e022, - 0x8096023, - 0x80ba025, - 0x80c202e, - 0x80d6030, - 0x80f6035, - 0x811203d, - 0x8122044, - 0x813a048, - 0x817204e, - 0x817605c, - 0x824a05d, - 0x824e092, - 0x8262093, - 0x826a098, - 0x828209a, - 0x82860a0, - 0x82920a1, - 0x829e0a4, - 0x82a20a7, - 0x82a60a8, - 0x82aa0a9, - 0x82ce0aa, - 0x830e0b3, - 0x83120c3, - 0x83320c4, - 0x83820cc, - 0x83ae0e0, - 0x283b20eb, - 0x83ba0ec, - 0x84120ee, - 0x8416104, - 0x841a105, - 0x841e106, - 0x8462107, - 0x8472118, - 0x84b211c, - 0x84b612c, - 0x84e612d, - 0x8632139, - 0x865a18c, - 0x8692196, - 0x86b61a4, - 0x286be1ad, - 0x286c21af, - 0x86ca1b0, - 0x86d61b2, - 0x87f21b5, - 0x87fe1fc, - 0x880a1ff, - 0x8816202, - 0x8822205, - 0x882e208, - 0x883a20b, - 0x884620e, - 0x8852211, - 0x885e214, - 0x886a217, - 0x887621a, - 0x888221d, - 0x888e220, - 0x8896223, - 0x88a2225, - 0x88ae228, - 0x88ba22b, - 0x88c622e, - 0x88d2231, - 0x88de234, - 0x88ea237, - 0x88f623a, - 0x890223d, - 0x890e240, - 0x891a243, - 0x8946246, - 0x8952251, - 0x895e254, - 0x896a257, - 0x897625a, - 0x898225d, - 0x898a260, - 0x8996262, - 0x89a2265, - 0x89ae268, - 0x89ba26b, - 0x89c626e, - 0x89d2271, - 0x89de274, - 0x89ea277, - 0x89f627a, - 0x8a0227d, - 0x8a0e280, - 0x8a16283, - 0x8a22285, - 0x8a2a288, - 0x8a3628a, - 0x8a4228d, - 0x8a4e290, - 0x8a5a293, - 0x8a66296, - 0x8a72299, - 0x8a7e29c, - 0x8a8a29f, - 0x8a8e2a2, - 0x8a9a2a3, - 0x8ab62a6, - 0x8aba2ad, - 0x8aca2ae, - 0x8aee2b2, - 0x8af22bb, - 0x8b362bc, - 0x8b3e2cd, - 0x8b522cf, - 0x8b862d4, - 0x8ba22e1, - 0x8baa2e8, - 0x8bce2ea, - 0x8be62f3, - 0x8bfe2f9, - 0x8c162ff, - 0x8c2a305, - 0x28c7230a, - 0x8c7631c, - 0x8ca231d, - 0x8cb2328, - 0x8cc632c, -} - -// max children 592 (capacity 1023) -// max text offset 30772 (capacity 32767) -// max text length 36 (capacity 63) -// max hi 9009 (capacity 16383) -// max lo 9004 (capacity 16383) diff --git a/vendor/golang.org/x/net/trace/events.go b/vendor/golang.org/x/net/trace/events.go deleted file mode 100644 index c646a6952..000000000 --- a/vendor/golang.org/x/net/trace/events.go +++ /dev/null @@ -1,532 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package trace - -import ( - "bytes" - "fmt" - "html/template" - "io" - "log" - "net/http" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "text/tabwriter" - "time" -) - -const maxEventsPerLog = 100 - -type bucket struct { - MaxErrAge time.Duration - String string -} - -var buckets = []bucket{ - {0, "total"}, - {10 * time.Second, "errs<10s"}, - {1 * time.Minute, "errs<1m"}, - {10 * time.Minute, "errs<10m"}, - {1 * time.Hour, "errs<1h"}, - {10 * time.Hour, "errs<10h"}, - {24000 * time.Hour, "errors"}, -} - -// RenderEvents renders the HTML page typically served at /debug/events. -// It does not do any auth checking. The request may be nil. -// -// Most users will use the Events handler. -func RenderEvents(w http.ResponseWriter, req *http.Request, sensitive bool) { - now := time.Now() - data := &struct { - Families []string // family names - Buckets []bucket - Counts [][]int // eventLog count per family/bucket - - // Set when a bucket has been selected. - Family string - Bucket int - EventLogs eventLogs - Expanded bool - }{ - Buckets: buckets, - } - - data.Families = make([]string, 0, len(families)) - famMu.RLock() - for name := range families { - data.Families = append(data.Families, name) - } - famMu.RUnlock() - sort.Strings(data.Families) - - // Count the number of eventLogs in each family for each error age. - data.Counts = make([][]int, len(data.Families)) - for i, name := range data.Families { - // TODO(sameer): move this loop under the family lock. - f := getEventFamily(name) - data.Counts[i] = make([]int, len(data.Buckets)) - for j, b := range data.Buckets { - data.Counts[i][j] = f.Count(now, b.MaxErrAge) - } - } - - if req != nil { - var ok bool - data.Family, data.Bucket, ok = parseEventsArgs(req) - if !ok { - // No-op - } else { - data.EventLogs = getEventFamily(data.Family).Copy(now, buckets[data.Bucket].MaxErrAge) - } - if data.EventLogs != nil { - defer data.EventLogs.Free() - sort.Sort(data.EventLogs) - } - if exp, err := strconv.ParseBool(req.FormValue("exp")); err == nil { - data.Expanded = exp - } - } - - famMu.RLock() - defer famMu.RUnlock() - if err := eventsTmpl().Execute(w, data); err != nil { - log.Printf("net/trace: Failed executing template: %v", err) - } -} - -func parseEventsArgs(req *http.Request) (fam string, b int, ok bool) { - fam, bStr := req.FormValue("fam"), req.FormValue("b") - if fam == "" || bStr == "" { - return "", 0, false - } - b, err := strconv.Atoi(bStr) - if err != nil || b < 0 || b >= len(buckets) { - return "", 0, false - } - return fam, b, true -} - -// An EventLog provides a log of events associated with a specific object. -type EventLog interface { - // Printf formats its arguments with fmt.Sprintf and adds the - // result to the event log. - Printf(format string, a ...interface{}) - - // Errorf is like Printf, but it marks this event as an error. - Errorf(format string, a ...interface{}) - - // Finish declares that this event log is complete. - // The event log should not be used after calling this method. - Finish() -} - -// NewEventLog returns a new EventLog with the specified family name -// and title. -func NewEventLog(family, title string) EventLog { - el := newEventLog() - el.ref() - el.Family, el.Title = family, title - el.Start = time.Now() - el.events = make([]logEntry, 0, maxEventsPerLog) - el.stack = make([]uintptr, 32) - n := runtime.Callers(2, el.stack) - el.stack = el.stack[:n] - - getEventFamily(family).add(el) - return el -} - -func (el *eventLog) Finish() { - getEventFamily(el.Family).remove(el) - el.unref() // matches ref in New -} - -var ( - famMu sync.RWMutex - families = make(map[string]*eventFamily) // family name => family -) - -func getEventFamily(fam string) *eventFamily { - famMu.Lock() - defer famMu.Unlock() - f := families[fam] - if f == nil { - f = &eventFamily{} - families[fam] = f - } - return f -} - -type eventFamily struct { - mu sync.RWMutex - eventLogs eventLogs -} - -func (f *eventFamily) add(el *eventLog) { - f.mu.Lock() - f.eventLogs = append(f.eventLogs, el) - f.mu.Unlock() -} - -func (f *eventFamily) remove(el *eventLog) { - f.mu.Lock() - defer f.mu.Unlock() - for i, el0 := range f.eventLogs { - if el == el0 { - copy(f.eventLogs[i:], f.eventLogs[i+1:]) - f.eventLogs = f.eventLogs[:len(f.eventLogs)-1] - return - } - } -} - -func (f *eventFamily) Count(now time.Time, maxErrAge time.Duration) (n int) { - f.mu.RLock() - defer f.mu.RUnlock() - for _, el := range f.eventLogs { - if el.hasRecentError(now, maxErrAge) { - n++ - } - } - return -} - -func (f *eventFamily) Copy(now time.Time, maxErrAge time.Duration) (els eventLogs) { - f.mu.RLock() - defer f.mu.RUnlock() - els = make(eventLogs, 0, len(f.eventLogs)) - for _, el := range f.eventLogs { - if el.hasRecentError(now, maxErrAge) { - el.ref() - els = append(els, el) - } - } - return -} - -type eventLogs []*eventLog - -// Free calls unref on each element of the list. -func (els eventLogs) Free() { - for _, el := range els { - el.unref() - } -} - -// eventLogs may be sorted in reverse chronological order. -func (els eventLogs) Len() int { return len(els) } -func (els eventLogs) Less(i, j int) bool { return els[i].Start.After(els[j].Start) } -func (els eventLogs) Swap(i, j int) { els[i], els[j] = els[j], els[i] } - -// A logEntry is a timestamped log entry in an event log. -type logEntry struct { - When time.Time - Elapsed time.Duration // since previous event in log - NewDay bool // whether this event is on a different day to the previous event - What string - IsErr bool -} - -// WhenString returns a string representation of the elapsed time of the event. -// It will include the date if midnight was crossed. -func (e logEntry) WhenString() string { - if e.NewDay { - return e.When.Format("2006/01/02 15:04:05.000000") - } - return e.When.Format("15:04:05.000000") -} - -// An eventLog represents an active event log. -type eventLog struct { - // Family is the top-level grouping of event logs to which this belongs. - Family string - - // Title is the title of this event log. - Title string - - // Timing information. - Start time.Time - - // Call stack where this event log was created. - stack []uintptr - - // Append-only sequence of events. - // - // TODO(sameer): change this to a ring buffer to avoid the array copy - // when we hit maxEventsPerLog. - mu sync.RWMutex - events []logEntry - LastErrorTime time.Time - discarded int - - refs int32 // how many buckets this is in -} - -func (el *eventLog) reset() { - // Clear all but the mutex. Mutexes may not be copied, even when unlocked. - el.Family = "" - el.Title = "" - el.Start = time.Time{} - el.stack = nil - el.events = nil - el.LastErrorTime = time.Time{} - el.discarded = 0 - el.refs = 0 -} - -func (el *eventLog) hasRecentError(now time.Time, maxErrAge time.Duration) bool { - if maxErrAge == 0 { - return true - } - el.mu.RLock() - defer el.mu.RUnlock() - return now.Sub(el.LastErrorTime) < maxErrAge -} - -// delta returns the elapsed time since the last event or the log start, -// and whether it spans midnight. -// L >= el.mu -func (el *eventLog) delta(t time.Time) (time.Duration, bool) { - if len(el.events) == 0 { - return t.Sub(el.Start), false - } - prev := el.events[len(el.events)-1].When - return t.Sub(prev), prev.Day() != t.Day() - -} - -func (el *eventLog) Printf(format string, a ...interface{}) { - el.printf(false, format, a...) -} - -func (el *eventLog) Errorf(format string, a ...interface{}) { - el.printf(true, format, a...) -} - -func (el *eventLog) printf(isErr bool, format string, a ...interface{}) { - e := logEntry{When: time.Now(), IsErr: isErr, What: fmt.Sprintf(format, a...)} - el.mu.Lock() - e.Elapsed, e.NewDay = el.delta(e.When) - if len(el.events) < maxEventsPerLog { - el.events = append(el.events, e) - } else { - // Discard the oldest event. - if el.discarded == 0 { - // el.discarded starts at two to count for the event it - // is replacing, plus the next one that we are about to - // drop. - el.discarded = 2 - } else { - el.discarded++ - } - // TODO(sameer): if this causes allocations on a critical path, - // change eventLog.What to be a fmt.Stringer, as in trace.go. - el.events[0].What = fmt.Sprintf("(%d events discarded)", el.discarded) - // The timestamp of the discarded meta-event should be - // the time of the last event it is representing. - el.events[0].When = el.events[1].When - copy(el.events[1:], el.events[2:]) - el.events[maxEventsPerLog-1] = e - } - if e.IsErr { - el.LastErrorTime = e.When - } - el.mu.Unlock() -} - -func (el *eventLog) ref() { - atomic.AddInt32(&el.refs, 1) -} - -func (el *eventLog) unref() { - if atomic.AddInt32(&el.refs, -1) == 0 { - freeEventLog(el) - } -} - -func (el *eventLog) When() string { - return el.Start.Format("2006/01/02 15:04:05.000000") -} - -func (el *eventLog) ElapsedTime() string { - elapsed := time.Since(el.Start) - return fmt.Sprintf("%.6f", elapsed.Seconds()) -} - -func (el *eventLog) Stack() string { - buf := new(bytes.Buffer) - tw := tabwriter.NewWriter(buf, 1, 8, 1, '\t', 0) - printStackRecord(tw, el.stack) - tw.Flush() - return buf.String() -} - -// printStackRecord prints the function + source line information -// for a single stack trace. -// Adapted from runtime/pprof/pprof.go. -func printStackRecord(w io.Writer, stk []uintptr) { - for _, pc := range stk { - f := runtime.FuncForPC(pc) - if f == nil { - continue - } - file, line := f.FileLine(pc) - name := f.Name() - // Hide runtime.goexit and any runtime functions at the beginning. - if strings.HasPrefix(name, "runtime.") { - continue - } - fmt.Fprintf(w, "# %s\t%s:%d\n", name, file, line) - } -} - -func (el *eventLog) Events() []logEntry { - el.mu.RLock() - defer el.mu.RUnlock() - return el.events -} - -// freeEventLogs is a freelist of *eventLog -var freeEventLogs = make(chan *eventLog, 1000) - -// newEventLog returns a event log ready to use. -func newEventLog() *eventLog { - select { - case el := <-freeEventLogs: - return el - default: - return new(eventLog) - } -} - -// freeEventLog adds el to freeEventLogs if there's room. -// This is non-blocking. -func freeEventLog(el *eventLog) { - el.reset() - select { - case freeEventLogs <- el: - default: - } -} - -var eventsTmplCache *template.Template -var eventsTmplOnce sync.Once - -func eventsTmpl() *template.Template { - eventsTmplOnce.Do(func() { - eventsTmplCache = template.Must(template.New("events").Funcs(template.FuncMap{ - "elapsed": elapsed, - "trimSpace": strings.TrimSpace, - }).Parse(eventsHTML)) - }) - return eventsTmplCache -} - -const eventsHTML = ` -<html> - <head> - <title>events - - - - -

/debug/events

- - - {{range $i, $fam := .Families}} - - - - {{range $j, $bucket := $.Buckets}} - {{$n := index $.Counts $i $j}} - - {{end}} - - {{end}} -
{{$fam}} - {{if $n}}{{end}} - [{{$n}} {{$bucket.String}}] - {{if $n}}{{end}} -
- -{{if $.EventLogs}} -
-

Family: {{$.Family}}

- -{{if $.Expanded}}{{end}} -[Summary]{{if $.Expanded}}{{end}} - -{{if not $.Expanded}}{{end}} -[Expanded]{{if not $.Expanded}}{{end}} - - - - {{range $el := $.EventLogs}} - - - - - {{if $.Expanded}} - - - - - - {{range $el.Events}} - - - - - - {{end}} - {{end}} - {{end}} -
WhenElapsed
{{$el.When}}{{$el.ElapsedTime}}{{$el.Title}} -
{{$el.Stack|trimSpace}}
{{.WhenString}}{{elapsed .Elapsed}}.{{if .IsErr}}E{{else}}.{{end}}. {{.What}}
-{{end}} - - -` diff --git a/vendor/golang.org/x/net/trace/histogram.go b/vendor/golang.org/x/net/trace/histogram.go deleted file mode 100644 index 9bf4286c7..000000000 --- a/vendor/golang.org/x/net/trace/histogram.go +++ /dev/null @@ -1,365 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package trace - -// This file implements histogramming for RPC statistics collection. - -import ( - "bytes" - "fmt" - "html/template" - "log" - "math" - "sync" - - "golang.org/x/net/internal/timeseries" -) - -const ( - bucketCount = 38 -) - -// histogram keeps counts of values in buckets that are spaced -// out in powers of 2: 0-1, 2-3, 4-7... -// histogram implements timeseries.Observable -type histogram struct { - sum int64 // running total of measurements - sumOfSquares float64 // square of running total - buckets []int64 // bucketed values for histogram - value int // holds a single value as an optimization - valueCount int64 // number of values recorded for single value -} - -// AddMeasurement records a value measurement observation to the histogram. -func (h *histogram) addMeasurement(value int64) { - // TODO: assert invariant - h.sum += value - h.sumOfSquares += float64(value) * float64(value) - - bucketIndex := getBucket(value) - - if h.valueCount == 0 || (h.valueCount > 0 && h.value == bucketIndex) { - h.value = bucketIndex - h.valueCount++ - } else { - h.allocateBuckets() - h.buckets[bucketIndex]++ - } -} - -func (h *histogram) allocateBuckets() { - if h.buckets == nil { - h.buckets = make([]int64, bucketCount) - h.buckets[h.value] = h.valueCount - h.value = 0 - h.valueCount = -1 - } -} - -func log2(i int64) int { - n := 0 - for ; i >= 0x100; i >>= 8 { - n += 8 - } - for ; i > 0; i >>= 1 { - n += 1 - } - return n -} - -func getBucket(i int64) (index int) { - index = log2(i) - 1 - if index < 0 { - index = 0 - } - if index >= bucketCount { - index = bucketCount - 1 - } - return -} - -// Total returns the number of recorded observations. -func (h *histogram) total() (total int64) { - if h.valueCount >= 0 { - total = h.valueCount - } - for _, val := range h.buckets { - total += int64(val) - } - return -} - -// Average returns the average value of recorded observations. -func (h *histogram) average() float64 { - t := h.total() - if t == 0 { - return 0 - } - return float64(h.sum) / float64(t) -} - -// Variance returns the variance of recorded observations. -func (h *histogram) variance() float64 { - t := float64(h.total()) - if t == 0 { - return 0 - } - s := float64(h.sum) / t - return h.sumOfSquares/t - s*s -} - -// StandardDeviation returns the standard deviation of recorded observations. -func (h *histogram) standardDeviation() float64 { - return math.Sqrt(h.variance()) -} - -// PercentileBoundary estimates the value that the given fraction of recorded -// observations are less than. -func (h *histogram) percentileBoundary(percentile float64) int64 { - total := h.total() - - // Corner cases (make sure result is strictly less than Total()) - if total == 0 { - return 0 - } else if total == 1 { - return int64(h.average()) - } - - percentOfTotal := round(float64(total) * percentile) - var runningTotal int64 - - for i := range h.buckets { - value := h.buckets[i] - runningTotal += value - if runningTotal == percentOfTotal { - // We hit an exact bucket boundary. If the next bucket has data, it is a - // good estimate of the value. If the bucket is empty, we interpolate the - // midpoint between the next bucket's boundary and the next non-zero - // bucket. If the remaining buckets are all empty, then we use the - // boundary for the next bucket as the estimate. - j := uint8(i + 1) - min := bucketBoundary(j) - if runningTotal < total { - for h.buckets[j] == 0 { - j++ - } - } - max := bucketBoundary(j) - return min + round(float64(max-min)/2) - } else if runningTotal > percentOfTotal { - // The value is in this bucket. Interpolate the value. - delta := runningTotal - percentOfTotal - percentBucket := float64(value-delta) / float64(value) - bucketMin := bucketBoundary(uint8(i)) - nextBucketMin := bucketBoundary(uint8(i + 1)) - bucketSize := nextBucketMin - bucketMin - return bucketMin + round(percentBucket*float64(bucketSize)) - } - } - return bucketBoundary(bucketCount - 1) -} - -// Median returns the estimated median of the observed values. -func (h *histogram) median() int64 { - return h.percentileBoundary(0.5) -} - -// Add adds other to h. -func (h *histogram) Add(other timeseries.Observable) { - o := other.(*histogram) - if o.valueCount == 0 { - // Other histogram is empty - } else if h.valueCount >= 0 && o.valueCount > 0 && h.value == o.value { - // Both have a single bucketed value, aggregate them - h.valueCount += o.valueCount - } else { - // Two different values necessitate buckets in this histogram - h.allocateBuckets() - if o.valueCount >= 0 { - h.buckets[o.value] += o.valueCount - } else { - for i := range h.buckets { - h.buckets[i] += o.buckets[i] - } - } - } - h.sumOfSquares += o.sumOfSquares - h.sum += o.sum -} - -// Clear resets the histogram to an empty state, removing all observed values. -func (h *histogram) Clear() { - h.buckets = nil - h.value = 0 - h.valueCount = 0 - h.sum = 0 - h.sumOfSquares = 0 -} - -// CopyFrom copies from other, which must be a *histogram, into h. -func (h *histogram) CopyFrom(other timeseries.Observable) { - o := other.(*histogram) - if o.valueCount == -1 { - h.allocateBuckets() - copy(h.buckets, o.buckets) - } - h.sum = o.sum - h.sumOfSquares = o.sumOfSquares - h.value = o.value - h.valueCount = o.valueCount -} - -// Multiply scales the histogram by the specified ratio. -func (h *histogram) Multiply(ratio float64) { - if h.valueCount == -1 { - for i := range h.buckets { - h.buckets[i] = int64(float64(h.buckets[i]) * ratio) - } - } else { - h.valueCount = int64(float64(h.valueCount) * ratio) - } - h.sum = int64(float64(h.sum) * ratio) - h.sumOfSquares = h.sumOfSquares * ratio -} - -// New creates a new histogram. -func (h *histogram) New() timeseries.Observable { - r := new(histogram) - r.Clear() - return r -} - -func (h *histogram) String() string { - return fmt.Sprintf("%d, %f, %d, %d, %v", - h.sum, h.sumOfSquares, h.value, h.valueCount, h.buckets) -} - -// round returns the closest int64 to the argument -func round(in float64) int64 { - return int64(math.Floor(in + 0.5)) -} - -// bucketBoundary returns the first value in the bucket. -func bucketBoundary(bucket uint8) int64 { - if bucket == 0 { - return 0 - } - return 1 << bucket -} - -// bucketData holds data about a specific bucket for use in distTmpl. -type bucketData struct { - Lower, Upper int64 - N int64 - Pct, CumulativePct float64 - GraphWidth int -} - -// data holds data about a Distribution for use in distTmpl. -type data struct { - Buckets []*bucketData - Count, Median int64 - Mean, StandardDeviation float64 -} - -// maxHTMLBarWidth is the maximum width of the HTML bar for visualizing buckets. -const maxHTMLBarWidth = 350.0 - -// newData returns data representing h for use in distTmpl. -func (h *histogram) newData() *data { - // Force the allocation of buckets to simplify the rendering implementation - h.allocateBuckets() - // We scale the bars on the right so that the largest bar is - // maxHTMLBarWidth pixels in width. - maxBucket := int64(0) - for _, n := range h.buckets { - if n > maxBucket { - maxBucket = n - } - } - total := h.total() - barsizeMult := maxHTMLBarWidth / float64(maxBucket) - var pctMult float64 - if total == 0 { - pctMult = 1.0 - } else { - pctMult = 100.0 / float64(total) - } - - buckets := make([]*bucketData, len(h.buckets)) - runningTotal := int64(0) - for i, n := range h.buckets { - if n == 0 { - continue - } - runningTotal += n - var upperBound int64 - if i < bucketCount-1 { - upperBound = bucketBoundary(uint8(i + 1)) - } else { - upperBound = math.MaxInt64 - } - buckets[i] = &bucketData{ - Lower: bucketBoundary(uint8(i)), - Upper: upperBound, - N: n, - Pct: float64(n) * pctMult, - CumulativePct: float64(runningTotal) * pctMult, - GraphWidth: int(float64(n) * barsizeMult), - } - } - return &data{ - Buckets: buckets, - Count: total, - Median: h.median(), - Mean: h.average(), - StandardDeviation: h.standardDeviation(), - } -} - -func (h *histogram) html() template.HTML { - buf := new(bytes.Buffer) - if err := distTmpl().Execute(buf, h.newData()); err != nil { - buf.Reset() - log.Printf("net/trace: couldn't execute template: %v", err) - } - return template.HTML(buf.String()) -} - -var distTmplCache *template.Template -var distTmplOnce sync.Once - -func distTmpl() *template.Template { - distTmplOnce.Do(func() { - // Input: data - distTmplCache = template.Must(template.New("distTmpl").Parse(` - - - - - - - -
Count: {{.Count}}Mean: {{printf "%.0f" .Mean}}StdDev: {{printf "%.0f" .StandardDeviation}}Median: {{.Median}}
-
- -{{range $b := .Buckets}} -{{if $b}} - - - - - - - - - -{{end}} -{{end}} -
[{{.Lower}},{{.Upper}}){{.N}}{{printf "%#.3f" .Pct}}%{{printf "%#.3f" .CumulativePct}}%
-`)) - }) - return distTmplCache -} diff --git a/vendor/golang.org/x/net/trace/trace.go b/vendor/golang.org/x/net/trace/trace.go deleted file mode 100644 index 3ebf6f2da..000000000 --- a/vendor/golang.org/x/net/trace/trace.go +++ /dev/null @@ -1,1130 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package trace implements tracing of requests and long-lived objects. -It exports HTTP interfaces on /debug/requests and /debug/events. - -A trace.Trace provides tracing for short-lived objects, usually requests. -A request handler might be implemented like this: - - func fooHandler(w http.ResponseWriter, req *http.Request) { - tr := trace.New("mypkg.Foo", req.URL.Path) - defer tr.Finish() - ... - tr.LazyPrintf("some event %q happened", str) - ... - if err := somethingImportant(); err != nil { - tr.LazyPrintf("somethingImportant failed: %v", err) - tr.SetError() - } - } - -The /debug/requests HTTP endpoint organizes the traces by family, -errors, and duration. It also provides histogram of request duration -for each family. - -A trace.EventLog provides tracing for long-lived objects, such as RPC -connections. - - // A Fetcher fetches URL paths for a single domain. - type Fetcher struct { - domain string - events trace.EventLog - } - - func NewFetcher(domain string) *Fetcher { - return &Fetcher{ - domain, - trace.NewEventLog("mypkg.Fetcher", domain), - } - } - - func (f *Fetcher) Fetch(path string) (string, error) { - resp, err := http.Get("http://" + f.domain + "/" + path) - if err != nil { - f.events.Errorf("Get(%q) = %v", path, err) - return "", err - } - f.events.Printf("Get(%q) = %s", path, resp.Status) - ... - } - - func (f *Fetcher) Close() error { - f.events.Finish() - return nil - } - -The /debug/events HTTP endpoint organizes the event logs by family and -by time since the last error. The expanded view displays recent log -entries and the log's call stack. -*/ -package trace // import "golang.org/x/net/trace" - -import ( - "bytes" - "context" - "fmt" - "html/template" - "io" - "log" - "net" - "net/http" - "net/url" - "runtime" - "sort" - "strconv" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/internal/timeseries" -) - -// DebugUseAfterFinish controls whether to debug uses of Trace values after finishing. -// FOR DEBUGGING ONLY. This will slow down the program. -var DebugUseAfterFinish = false - -// HTTP ServeMux paths. -const ( - debugRequestsPath = "/debug/requests" - debugEventsPath = "/debug/events" -) - -// AuthRequest determines whether a specific request is permitted to load the -// /debug/requests or /debug/events pages. -// -// It returns two bools; the first indicates whether the page may be viewed at all, -// and the second indicates whether sensitive events will be shown. -// -// AuthRequest may be replaced by a program to customize its authorization requirements. -// -// The default AuthRequest function returns (true, true) if and only if the request -// comes from localhost/127.0.0.1/[::1]. -var AuthRequest = func(req *http.Request) (any, sensitive bool) { - // RemoteAddr is commonly in the form "IP" or "IP:port". - // If it is in the form "IP:port", split off the port. - host, _, err := net.SplitHostPort(req.RemoteAddr) - if err != nil { - host = req.RemoteAddr - } - switch host { - case "localhost", "127.0.0.1", "::1": - return true, true - default: - return false, false - } -} - -func init() { - _, pat := http.DefaultServeMux.Handler(&http.Request{URL: &url.URL{Path: debugRequestsPath}}) - if pat == debugRequestsPath { - panic("/debug/requests is already registered. You may have two independent copies of " + - "golang.org/x/net/trace in your binary, trying to maintain separate state. This may " + - "involve a vendored copy of golang.org/x/net/trace.") - } - - // TODO(jbd): Serve Traces from /debug/traces in the future? - // There is no requirement for a request to be present to have traces. - http.HandleFunc(debugRequestsPath, Traces) - http.HandleFunc(debugEventsPath, Events) -} - -// NewContext returns a copy of the parent context -// and associates it with a Trace. -func NewContext(ctx context.Context, tr Trace) context.Context { - return context.WithValue(ctx, contextKey, tr) -} - -// FromContext returns the Trace bound to the context, if any. -func FromContext(ctx context.Context) (tr Trace, ok bool) { - tr, ok = ctx.Value(contextKey).(Trace) - return -} - -// Traces responds with traces from the program. -// The package initialization registers it in http.DefaultServeMux -// at /debug/requests. -// -// It performs authorization by running AuthRequest. -func Traces(w http.ResponseWriter, req *http.Request) { - any, sensitive := AuthRequest(req) - if !any { - http.Error(w, "not allowed", http.StatusUnauthorized) - return - } - w.Header().Set("Content-Type", "text/html; charset=utf-8") - Render(w, req, sensitive) -} - -// Events responds with a page of events collected by EventLogs. -// The package initialization registers it in http.DefaultServeMux -// at /debug/events. -// -// It performs authorization by running AuthRequest. -func Events(w http.ResponseWriter, req *http.Request) { - any, sensitive := AuthRequest(req) - if !any { - http.Error(w, "not allowed", http.StatusUnauthorized) - return - } - w.Header().Set("Content-Type", "text/html; charset=utf-8") - RenderEvents(w, req, sensitive) -} - -// Render renders the HTML page typically served at /debug/requests. -// It does not do any auth checking. The request may be nil. -// -// Most users will use the Traces handler. -func Render(w io.Writer, req *http.Request, sensitive bool) { - data := &struct { - Families []string - ActiveTraceCount map[string]int - CompletedTraces map[string]*family - - // Set when a bucket has been selected. - Traces traceList - Family string - Bucket int - Expanded bool - Traced bool - Active bool - ShowSensitive bool // whether to show sensitive events - - Histogram template.HTML - HistogramWindow string // e.g. "last minute", "last hour", "all time" - - // If non-zero, the set of traces is a partial set, - // and this is the total number. - Total int - }{ - CompletedTraces: completedTraces, - } - - data.ShowSensitive = sensitive - if req != nil { - // Allow show_sensitive=0 to force hiding of sensitive data for testing. - // This only goes one way; you can't use show_sensitive=1 to see things. - if req.FormValue("show_sensitive") == "0" { - data.ShowSensitive = false - } - - if exp, err := strconv.ParseBool(req.FormValue("exp")); err == nil { - data.Expanded = exp - } - if exp, err := strconv.ParseBool(req.FormValue("rtraced")); err == nil { - data.Traced = exp - } - } - - completedMu.RLock() - data.Families = make([]string, 0, len(completedTraces)) - for fam := range completedTraces { - data.Families = append(data.Families, fam) - } - completedMu.RUnlock() - sort.Strings(data.Families) - - // We are careful here to minimize the time spent locking activeMu, - // since that lock is required every time an RPC starts and finishes. - data.ActiveTraceCount = make(map[string]int, len(data.Families)) - activeMu.RLock() - for fam, s := range activeTraces { - data.ActiveTraceCount[fam] = s.Len() - } - activeMu.RUnlock() - - var ok bool - data.Family, data.Bucket, ok = parseArgs(req) - switch { - case !ok: - // No-op - case data.Bucket == -1: - data.Active = true - n := data.ActiveTraceCount[data.Family] - data.Traces = getActiveTraces(data.Family) - if len(data.Traces) < n { - data.Total = n - } - case data.Bucket < bucketsPerFamily: - if b := lookupBucket(data.Family, data.Bucket); b != nil { - data.Traces = b.Copy(data.Traced) - } - default: - if f := getFamily(data.Family, false); f != nil { - var obs timeseries.Observable - f.LatencyMu.RLock() - switch o := data.Bucket - bucketsPerFamily; o { - case 0: - obs = f.Latency.Minute() - data.HistogramWindow = "last minute" - case 1: - obs = f.Latency.Hour() - data.HistogramWindow = "last hour" - case 2: - obs = f.Latency.Total() - data.HistogramWindow = "all time" - } - f.LatencyMu.RUnlock() - if obs != nil { - data.Histogram = obs.(*histogram).html() - } - } - } - - if data.Traces != nil { - defer data.Traces.Free() - sort.Sort(data.Traces) - } - - completedMu.RLock() - defer completedMu.RUnlock() - if err := pageTmpl().ExecuteTemplate(w, "Page", data); err != nil { - log.Printf("net/trace: Failed executing template: %v", err) - } -} - -func parseArgs(req *http.Request) (fam string, b int, ok bool) { - if req == nil { - return "", 0, false - } - fam, bStr := req.FormValue("fam"), req.FormValue("b") - if fam == "" || bStr == "" { - return "", 0, false - } - b, err := strconv.Atoi(bStr) - if err != nil || b < -1 { - return "", 0, false - } - - return fam, b, true -} - -func lookupBucket(fam string, b int) *traceBucket { - f := getFamily(fam, false) - if f == nil || b < 0 || b >= len(f.Buckets) { - return nil - } - return f.Buckets[b] -} - -type contextKeyT string - -var contextKey = contextKeyT("golang.org/x/net/trace.Trace") - -// Trace represents an active request. -type Trace interface { - // LazyLog adds x to the event log. It will be evaluated each time the - // /debug/requests page is rendered. Any memory referenced by x will be - // pinned until the trace is finished and later discarded. - LazyLog(x fmt.Stringer, sensitive bool) - - // LazyPrintf evaluates its arguments with fmt.Sprintf each time the - // /debug/requests page is rendered. Any memory referenced by a will be - // pinned until the trace is finished and later discarded. - LazyPrintf(format string, a ...interface{}) - - // SetError declares that this trace resulted in an error. - SetError() - - // SetRecycler sets a recycler for the trace. - // f will be called for each event passed to LazyLog at a time when - // it is no longer required, whether while the trace is still active - // and the event is discarded, or when a completed trace is discarded. - SetRecycler(f func(interface{})) - - // SetTraceInfo sets the trace info for the trace. - // This is currently unused. - SetTraceInfo(traceID, spanID uint64) - - // SetMaxEvents sets the maximum number of events that will be stored - // in the trace. This has no effect if any events have already been - // added to the trace. - SetMaxEvents(m int) - - // Finish declares that this trace is complete. - // The trace should not be used after calling this method. - Finish() -} - -type lazySprintf struct { - format string - a []interface{} -} - -func (l *lazySprintf) String() string { - return fmt.Sprintf(l.format, l.a...) -} - -// New returns a new Trace with the specified family and title. -func New(family, title string) Trace { - tr := newTrace() - tr.ref() - tr.Family, tr.Title = family, title - tr.Start = time.Now() - tr.maxEvents = maxEventsPerTrace - tr.events = tr.eventsBuf[:0] - - activeMu.RLock() - s := activeTraces[tr.Family] - activeMu.RUnlock() - if s == nil { - activeMu.Lock() - s = activeTraces[tr.Family] // check again - if s == nil { - s = new(traceSet) - activeTraces[tr.Family] = s - } - activeMu.Unlock() - } - s.Add(tr) - - // Trigger allocation of the completed trace structure for this family. - // This will cause the family to be present in the request page during - // the first trace of this family. We don't care about the return value, - // nor is there any need for this to run inline, so we execute it in its - // own goroutine, but only if the family isn't allocated yet. - completedMu.RLock() - if _, ok := completedTraces[tr.Family]; !ok { - go allocFamily(tr.Family) - } - completedMu.RUnlock() - - return tr -} - -func (tr *trace) Finish() { - elapsed := time.Now().Sub(tr.Start) - tr.mu.Lock() - tr.Elapsed = elapsed - tr.mu.Unlock() - - if DebugUseAfterFinish { - buf := make([]byte, 4<<10) // 4 KB should be enough - n := runtime.Stack(buf, false) - tr.finishStack = buf[:n] - } - - activeMu.RLock() - m := activeTraces[tr.Family] - activeMu.RUnlock() - m.Remove(tr) - - f := getFamily(tr.Family, true) - tr.mu.RLock() // protects tr fields in Cond.match calls - for _, b := range f.Buckets { - if b.Cond.match(tr) { - b.Add(tr) - } - } - tr.mu.RUnlock() - - // Add a sample of elapsed time as microseconds to the family's timeseries - h := new(histogram) - h.addMeasurement(elapsed.Nanoseconds() / 1e3) - f.LatencyMu.Lock() - f.Latency.Add(h) - f.LatencyMu.Unlock() - - tr.unref() // matches ref in New -} - -const ( - bucketsPerFamily = 9 - tracesPerBucket = 10 - maxActiveTraces = 20 // Maximum number of active traces to show. - maxEventsPerTrace = 10 - numHistogramBuckets = 38 -) - -var ( - // The active traces. - activeMu sync.RWMutex - activeTraces = make(map[string]*traceSet) // family -> traces - - // Families of completed traces. - completedMu sync.RWMutex - completedTraces = make(map[string]*family) // family -> traces -) - -type traceSet struct { - mu sync.RWMutex - m map[*trace]bool - - // We could avoid the entire map scan in FirstN by having a slice of all the traces - // ordered by start time, and an index into that from the trace struct, with a periodic - // repack of the slice after enough traces finish; we could also use a skip list or similar. - // However, that would shift some of the expense from /debug/requests time to RPC time, - // which is probably the wrong trade-off. -} - -func (ts *traceSet) Len() int { - ts.mu.RLock() - defer ts.mu.RUnlock() - return len(ts.m) -} - -func (ts *traceSet) Add(tr *trace) { - ts.mu.Lock() - if ts.m == nil { - ts.m = make(map[*trace]bool) - } - ts.m[tr] = true - ts.mu.Unlock() -} - -func (ts *traceSet) Remove(tr *trace) { - ts.mu.Lock() - delete(ts.m, tr) - ts.mu.Unlock() -} - -// FirstN returns the first n traces ordered by time. -func (ts *traceSet) FirstN(n int) traceList { - ts.mu.RLock() - defer ts.mu.RUnlock() - - if n > len(ts.m) { - n = len(ts.m) - } - trl := make(traceList, 0, n) - - // Fast path for when no selectivity is needed. - if n == len(ts.m) { - for tr := range ts.m { - tr.ref() - trl = append(trl, tr) - } - sort.Sort(trl) - return trl - } - - // Pick the oldest n traces. - // This is inefficient. See the comment in the traceSet struct. - for tr := range ts.m { - // Put the first n traces into trl in the order they occur. - // When we have n, sort trl, and thereafter maintain its order. - if len(trl) < n { - tr.ref() - trl = append(trl, tr) - if len(trl) == n { - // This is guaranteed to happen exactly once during this loop. - sort.Sort(trl) - } - continue - } - if tr.Start.After(trl[n-1].Start) { - continue - } - - // Find where to insert this one. - tr.ref() - i := sort.Search(n, func(i int) bool { return trl[i].Start.After(tr.Start) }) - trl[n-1].unref() - copy(trl[i+1:], trl[i:]) - trl[i] = tr - } - - return trl -} - -func getActiveTraces(fam string) traceList { - activeMu.RLock() - s := activeTraces[fam] - activeMu.RUnlock() - if s == nil { - return nil - } - return s.FirstN(maxActiveTraces) -} - -func getFamily(fam string, allocNew bool) *family { - completedMu.RLock() - f := completedTraces[fam] - completedMu.RUnlock() - if f == nil && allocNew { - f = allocFamily(fam) - } - return f -} - -func allocFamily(fam string) *family { - completedMu.Lock() - defer completedMu.Unlock() - f := completedTraces[fam] - if f == nil { - f = newFamily() - completedTraces[fam] = f - } - return f -} - -// family represents a set of trace buckets and associated latency information. -type family struct { - // traces may occur in multiple buckets. - Buckets [bucketsPerFamily]*traceBucket - - // latency time series - LatencyMu sync.RWMutex - Latency *timeseries.MinuteHourSeries -} - -func newFamily() *family { - return &family{ - Buckets: [bucketsPerFamily]*traceBucket{ - {Cond: minCond(0)}, - {Cond: minCond(50 * time.Millisecond)}, - {Cond: minCond(100 * time.Millisecond)}, - {Cond: minCond(200 * time.Millisecond)}, - {Cond: minCond(500 * time.Millisecond)}, - {Cond: minCond(1 * time.Second)}, - {Cond: minCond(10 * time.Second)}, - {Cond: minCond(100 * time.Second)}, - {Cond: errorCond{}}, - }, - Latency: timeseries.NewMinuteHourSeries(func() timeseries.Observable { return new(histogram) }), - } -} - -// traceBucket represents a size-capped bucket of historic traces, -// along with a condition for a trace to belong to the bucket. -type traceBucket struct { - Cond cond - - // Ring buffer implementation of a fixed-size FIFO queue. - mu sync.RWMutex - buf [tracesPerBucket]*trace - start int // < tracesPerBucket - length int // <= tracesPerBucket -} - -func (b *traceBucket) Add(tr *trace) { - b.mu.Lock() - defer b.mu.Unlock() - - i := b.start + b.length - if i >= tracesPerBucket { - i -= tracesPerBucket - } - if b.length == tracesPerBucket { - // "Remove" an element from the bucket. - b.buf[i].unref() - b.start++ - if b.start == tracesPerBucket { - b.start = 0 - } - } - b.buf[i] = tr - if b.length < tracesPerBucket { - b.length++ - } - tr.ref() -} - -// Copy returns a copy of the traces in the bucket. -// If tracedOnly is true, only the traces with trace information will be returned. -// The logs will be ref'd before returning; the caller should call -// the Free method when it is done with them. -// TODO(dsymonds): keep track of traced requests in separate buckets. -func (b *traceBucket) Copy(tracedOnly bool) traceList { - b.mu.RLock() - defer b.mu.RUnlock() - - trl := make(traceList, 0, b.length) - for i, x := 0, b.start; i < b.length; i++ { - tr := b.buf[x] - if !tracedOnly || tr.spanID != 0 { - tr.ref() - trl = append(trl, tr) - } - x++ - if x == b.length { - x = 0 - } - } - return trl -} - -func (b *traceBucket) Empty() bool { - b.mu.RLock() - defer b.mu.RUnlock() - return b.length == 0 -} - -// cond represents a condition on a trace. -type cond interface { - match(t *trace) bool - String() string -} - -type minCond time.Duration - -func (m minCond) match(t *trace) bool { return t.Elapsed >= time.Duration(m) } -func (m minCond) String() string { return fmt.Sprintf("≥%gs", time.Duration(m).Seconds()) } - -type errorCond struct{} - -func (e errorCond) match(t *trace) bool { return t.IsError } -func (e errorCond) String() string { return "errors" } - -type traceList []*trace - -// Free calls unref on each element of the list. -func (trl traceList) Free() { - for _, t := range trl { - t.unref() - } -} - -// traceList may be sorted in reverse chronological order. -func (trl traceList) Len() int { return len(trl) } -func (trl traceList) Less(i, j int) bool { return trl[i].Start.After(trl[j].Start) } -func (trl traceList) Swap(i, j int) { trl[i], trl[j] = trl[j], trl[i] } - -// An event is a timestamped log entry in a trace. -type event struct { - When time.Time - Elapsed time.Duration // since previous event in trace - NewDay bool // whether this event is on a different day to the previous event - Recyclable bool // whether this event was passed via LazyLog - Sensitive bool // whether this event contains sensitive information - What interface{} // string or fmt.Stringer -} - -// WhenString returns a string representation of the elapsed time of the event. -// It will include the date if midnight was crossed. -func (e event) WhenString() string { - if e.NewDay { - return e.When.Format("2006/01/02 15:04:05.000000") - } - return e.When.Format("15:04:05.000000") -} - -// discarded represents a number of discarded events. -// It is stored as *discarded to make it easier to update in-place. -type discarded int - -func (d *discarded) String() string { - return fmt.Sprintf("(%d events discarded)", int(*d)) -} - -// trace represents an active or complete request, -// either sent or received by this program. -type trace struct { - // Family is the top-level grouping of traces to which this belongs. - Family string - - // Title is the title of this trace. - Title string - - // Start time of the this trace. - Start time.Time - - mu sync.RWMutex - events []event // Append-only sequence of events (modulo discards). - maxEvents int - recycler func(interface{}) - IsError bool // Whether this trace resulted in an error. - Elapsed time.Duration // Elapsed time for this trace, zero while active. - traceID uint64 // Trace information if non-zero. - spanID uint64 - - refs int32 // how many buckets this is in - disc discarded // scratch space to avoid allocation - - finishStack []byte // where finish was called, if DebugUseAfterFinish is set - - eventsBuf [4]event // preallocated buffer in case we only log a few events -} - -func (tr *trace) reset() { - // Clear all but the mutex. Mutexes may not be copied, even when unlocked. - tr.Family = "" - tr.Title = "" - tr.Start = time.Time{} - - tr.mu.Lock() - tr.Elapsed = 0 - tr.traceID = 0 - tr.spanID = 0 - tr.IsError = false - tr.maxEvents = 0 - tr.events = nil - tr.recycler = nil - tr.mu.Unlock() - - tr.refs = 0 - tr.disc = 0 - tr.finishStack = nil - for i := range tr.eventsBuf { - tr.eventsBuf[i] = event{} - } -} - -// delta returns the elapsed time since the last event or the trace start, -// and whether it spans midnight. -// L >= tr.mu -func (tr *trace) delta(t time.Time) (time.Duration, bool) { - if len(tr.events) == 0 { - return t.Sub(tr.Start), false - } - prev := tr.events[len(tr.events)-1].When - return t.Sub(prev), prev.Day() != t.Day() -} - -func (tr *trace) addEvent(x interface{}, recyclable, sensitive bool) { - if DebugUseAfterFinish && tr.finishStack != nil { - buf := make([]byte, 4<<10) // 4 KB should be enough - n := runtime.Stack(buf, false) - log.Printf("net/trace: trace used after finish:\nFinished at:\n%s\nUsed at:\n%s", tr.finishStack, buf[:n]) - } - - /* - NOTE TO DEBUGGERS - - If you are here because your program panicked in this code, - it is almost definitely the fault of code using this package, - and very unlikely to be the fault of this code. - - The most likely scenario is that some code elsewhere is using - a trace.Trace after its Finish method is called. - You can temporarily set the DebugUseAfterFinish var - to help discover where that is; do not leave that var set, - since it makes this package much less efficient. - */ - - e := event{When: time.Now(), What: x, Recyclable: recyclable, Sensitive: sensitive} - tr.mu.Lock() - e.Elapsed, e.NewDay = tr.delta(e.When) - if len(tr.events) < tr.maxEvents { - tr.events = append(tr.events, e) - } else { - // Discard the middle events. - di := int((tr.maxEvents - 1) / 2) - if d, ok := tr.events[di].What.(*discarded); ok { - (*d)++ - } else { - // disc starts at two to count for the event it is replacing, - // plus the next one that we are about to drop. - tr.disc = 2 - if tr.recycler != nil && tr.events[di].Recyclable { - go tr.recycler(tr.events[di].What) - } - tr.events[di].What = &tr.disc - } - // The timestamp of the discarded meta-event should be - // the time of the last event it is representing. - tr.events[di].When = tr.events[di+1].When - - if tr.recycler != nil && tr.events[di+1].Recyclable { - go tr.recycler(tr.events[di+1].What) - } - copy(tr.events[di+1:], tr.events[di+2:]) - tr.events[tr.maxEvents-1] = e - } - tr.mu.Unlock() -} - -func (tr *trace) LazyLog(x fmt.Stringer, sensitive bool) { - tr.addEvent(x, true, sensitive) -} - -func (tr *trace) LazyPrintf(format string, a ...interface{}) { - tr.addEvent(&lazySprintf{format, a}, false, false) -} - -func (tr *trace) SetError() { - tr.mu.Lock() - tr.IsError = true - tr.mu.Unlock() -} - -func (tr *trace) SetRecycler(f func(interface{})) { - tr.mu.Lock() - tr.recycler = f - tr.mu.Unlock() -} - -func (tr *trace) SetTraceInfo(traceID, spanID uint64) { - tr.mu.Lock() - tr.traceID, tr.spanID = traceID, spanID - tr.mu.Unlock() -} - -func (tr *trace) SetMaxEvents(m int) { - tr.mu.Lock() - // Always keep at least three events: first, discarded count, last. - if len(tr.events) == 0 && m > 3 { - tr.maxEvents = m - } - tr.mu.Unlock() -} - -func (tr *trace) ref() { - atomic.AddInt32(&tr.refs, 1) -} - -func (tr *trace) unref() { - if atomic.AddInt32(&tr.refs, -1) == 0 { - tr.mu.RLock() - if tr.recycler != nil { - // freeTrace clears tr, so we hold tr.recycler and tr.events here. - go func(f func(interface{}), es []event) { - for _, e := range es { - if e.Recyclable { - f(e.What) - } - } - }(tr.recycler, tr.events) - } - tr.mu.RUnlock() - - freeTrace(tr) - } -} - -func (tr *trace) When() string { - return tr.Start.Format("2006/01/02 15:04:05.000000") -} - -func (tr *trace) ElapsedTime() string { - tr.mu.RLock() - t := tr.Elapsed - tr.mu.RUnlock() - - if t == 0 { - // Active trace. - t = time.Since(tr.Start) - } - return fmt.Sprintf("%.6f", t.Seconds()) -} - -func (tr *trace) Events() []event { - tr.mu.RLock() - defer tr.mu.RUnlock() - return tr.events -} - -var traceFreeList = make(chan *trace, 1000) // TODO(dsymonds): Use sync.Pool? - -// newTrace returns a trace ready to use. -func newTrace() *trace { - select { - case tr := <-traceFreeList: - return tr - default: - return new(trace) - } -} - -// freeTrace adds tr to traceFreeList if there's room. -// This is non-blocking. -func freeTrace(tr *trace) { - if DebugUseAfterFinish { - return // never reuse - } - tr.reset() - select { - case traceFreeList <- tr: - default: - } -} - -func elapsed(d time.Duration) string { - b := []byte(fmt.Sprintf("%.6f", d.Seconds())) - - // For subsecond durations, blank all zeros before decimal point, - // and all zeros between the decimal point and the first non-zero digit. - if d < time.Second { - dot := bytes.IndexByte(b, '.') - for i := 0; i < dot; i++ { - b[i] = ' ' - } - for i := dot + 1; i < len(b); i++ { - if b[i] == '0' { - b[i] = ' ' - } else { - break - } - } - } - - return string(b) -} - -var pageTmplCache *template.Template -var pageTmplOnce sync.Once - -func pageTmpl() *template.Template { - pageTmplOnce.Do(func() { - pageTmplCache = template.Must(template.New("Page").Funcs(template.FuncMap{ - "elapsed": elapsed, - "add": func(a, b int) int { return a + b }, - }).Parse(pageHTML)) - }) - return pageTmplCache -} - -const pageHTML = ` -{{template "Prolog" .}} -{{template "StatusTable" .}} -{{template "Epilog" .}} - -{{define "Prolog"}} - - - /debug/requests - - - - -

/debug/requests

-{{end}} {{/* end of Prolog */}} - -{{define "StatusTable"}} - - {{range $fam := .Families}} - - - - {{$n := index $.ActiveTraceCount $fam}} - - - {{$f := index $.CompletedTraces $fam}} - {{range $i, $b := $f.Buckets}} - {{$empty := $b.Empty}} - - {{end}} - - {{$nb := len $f.Buckets}} - - - - - - {{end}} -
{{$fam}} - {{if $n}}{{end}} - [{{$n}} active] - {{if $n}}{{end}} - - {{if not $empty}}{{end}} - [{{.Cond}}] - {{if not $empty}}{{end}} - - [minute] - - [hour] - - [total] -
-{{end}} {{/* end of StatusTable */}} - -{{define "Epilog"}} -{{if $.Traces}} -
-

Family: {{$.Family}}

- -{{if or $.Expanded $.Traced}} - [Normal/Summary] -{{else}} - [Normal/Summary] -{{end}} - -{{if or (not $.Expanded) $.Traced}} - [Normal/Expanded] -{{else}} - [Normal/Expanded] -{{end}} - -{{if not $.Active}} - {{if or $.Expanded (not $.Traced)}} - [Traced/Summary] - {{else}} - [Traced/Summary] - {{end}} - {{if or (not $.Expanded) (not $.Traced)}} - [Traced/Expanded] - {{else}} - [Traced/Expanded] - {{end}} -{{end}} - -{{if $.Total}} -

Showing {{len $.Traces}} of {{$.Total}} traces.

-{{end}} - - - - - {{range $tr := $.Traces}} - - - - - {{/* TODO: include traceID/spanID */}} - - {{if $.Expanded}} - {{range $tr.Events}} - - - - - - {{end}} - {{end}} - {{end}} -
- {{if $.Active}}Active{{else}}Completed{{end}} Requests -
WhenElapsed (s)
{{$tr.When}}{{$tr.ElapsedTime}}{{$tr.Title}}
{{.WhenString}}{{elapsed .Elapsed}}{{if or $.ShowSensitive (not .Sensitive)}}... {{.What}}{{else}}[redacted]{{end}}
-{{end}} {{/* if $.Traces */}} - -{{if $.Histogram}} -

Latency (µs) of {{$.Family}} over {{$.HistogramWindow}}

-{{$.Histogram}} -{{end}} {{/* if $.Histogram */}} - - - -{{end}} {{/* end of Epilog */}} -` diff --git a/vendor/golang.org/x/net/webdav/file.go b/vendor/golang.org/x/net/webdav/file.go deleted file mode 100644 index 9f5377879..000000000 --- a/vendor/golang.org/x/net/webdav/file.go +++ /dev/null @@ -1,795 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package webdav - -import ( - "context" - "encoding/xml" - "io" - "net/http" - "os" - "path" - "path/filepath" - "strings" - "sync" - "time" -) - -// slashClean is equivalent to but slightly more efficient than -// path.Clean("/" + name). -func slashClean(name string) string { - if name == "" || name[0] != '/' { - name = "/" + name - } - return path.Clean(name) -} - -// A FileSystem implements access to a collection of named files. The elements -// in a file path are separated by slash ('/', U+002F) characters, regardless -// of host operating system convention. -// -// Each method has the same semantics as the os package's function of the same -// name. -// -// Note that the os.Rename documentation says that "OS-specific restrictions -// might apply". In particular, whether or not renaming a file or directory -// overwriting another existing file or directory is an error is OS-dependent. -type FileSystem interface { - Mkdir(ctx context.Context, name string, perm os.FileMode) error - OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error) - RemoveAll(ctx context.Context, name string) error - Rename(ctx context.Context, oldName, newName string) error - Stat(ctx context.Context, name string) (os.FileInfo, error) -} - -// A File is returned by a FileSystem's OpenFile method and can be served by a -// Handler. -// -// A File may optionally implement the DeadPropsHolder interface, if it can -// load and save dead properties. -type File interface { - http.File - io.Writer -} - -// A Dir implements FileSystem using the native file system restricted to a -// specific directory tree. -// -// While the FileSystem.OpenFile method takes '/'-separated paths, a Dir's -// string value is a filename on the native file system, not a URL, so it is -// separated by filepath.Separator, which isn't necessarily '/'. -// -// An empty Dir is treated as ".". -type Dir string - -func (d Dir) resolve(name string) string { - // This implementation is based on Dir.Open's code in the standard net/http package. - if filepath.Separator != '/' && strings.IndexRune(name, filepath.Separator) >= 0 || - strings.Contains(name, "\x00") { - return "" - } - dir := string(d) - if dir == "" { - dir = "." - } - return filepath.Join(dir, filepath.FromSlash(slashClean(name))) -} - -func (d Dir) Mkdir(ctx context.Context, name string, perm os.FileMode) error { - if name = d.resolve(name); name == "" { - return os.ErrNotExist - } - return os.Mkdir(name, perm) -} - -func (d Dir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error) { - if name = d.resolve(name); name == "" { - return nil, os.ErrNotExist - } - f, err := os.OpenFile(name, flag, perm) - if err != nil { - return nil, err - } - return f, nil -} - -func (d Dir) RemoveAll(ctx context.Context, name string) error { - if name = d.resolve(name); name == "" { - return os.ErrNotExist - } - if name == filepath.Clean(string(d)) { - // Prohibit removing the virtual root directory. - return os.ErrInvalid - } - return os.RemoveAll(name) -} - -func (d Dir) Rename(ctx context.Context, oldName, newName string) error { - if oldName = d.resolve(oldName); oldName == "" { - return os.ErrNotExist - } - if newName = d.resolve(newName); newName == "" { - return os.ErrNotExist - } - if root := filepath.Clean(string(d)); root == oldName || root == newName { - // Prohibit renaming from or to the virtual root directory. - return os.ErrInvalid - } - return os.Rename(oldName, newName) -} - -func (d Dir) Stat(ctx context.Context, name string) (os.FileInfo, error) { - if name = d.resolve(name); name == "" { - return nil, os.ErrNotExist - } - return os.Stat(name) -} - -// NewMemFS returns a new in-memory FileSystem implementation. -func NewMemFS() FileSystem { - return &memFS{ - root: memFSNode{ - children: make(map[string]*memFSNode), - mode: 0660 | os.ModeDir, - modTime: time.Now(), - }, - } -} - -// A memFS implements FileSystem, storing all metadata and actual file data -// in-memory. No limits on filesystem size are used, so it is not recommended -// this be used where the clients are untrusted. -// -// Concurrent access is permitted. The tree structure is protected by a mutex, -// and each node's contents and metadata are protected by a per-node mutex. -// -// TODO: Enforce file permissions. -type memFS struct { - mu sync.Mutex - root memFSNode -} - -// TODO: clean up and rationalize the walk/find code. - -// walk walks the directory tree for the fullname, calling f at each step. If f -// returns an error, the walk will be aborted and return that same error. -// -// dir is the directory at that step, frag is the name fragment, and final is -// whether it is the final step. For example, walking "/foo/bar/x" will result -// in 3 calls to f: -// - "/", "foo", false -// - "/foo/", "bar", false -// - "/foo/bar/", "x", true -// The frag argument will be empty only if dir is the root node and the walk -// ends at that root node. -func (fs *memFS) walk(op, fullname string, f func(dir *memFSNode, frag string, final bool) error) error { - original := fullname - fullname = slashClean(fullname) - - // Strip any leading "/"s to make fullname a relative path, as the walk - // starts at fs.root. - if fullname[0] == '/' { - fullname = fullname[1:] - } - dir := &fs.root - - for { - frag, remaining := fullname, "" - i := strings.IndexRune(fullname, '/') - final := i < 0 - if !final { - frag, remaining = fullname[:i], fullname[i+1:] - } - if frag == "" && dir != &fs.root { - panic("webdav: empty path fragment for a clean path") - } - if err := f(dir, frag, final); err != nil { - return &os.PathError{ - Op: op, - Path: original, - Err: err, - } - } - if final { - break - } - child := dir.children[frag] - if child == nil { - return &os.PathError{ - Op: op, - Path: original, - Err: os.ErrNotExist, - } - } - if !child.mode.IsDir() { - return &os.PathError{ - Op: op, - Path: original, - Err: os.ErrInvalid, - } - } - dir, fullname = child, remaining - } - return nil -} - -// find returns the parent of the named node and the relative name fragment -// from the parent to the child. For example, if finding "/foo/bar/baz" then -// parent will be the node for "/foo/bar" and frag will be "baz". -// -// If the fullname names the root node, then parent, frag and err will be zero. -// -// find returns an error if the parent does not already exist or the parent -// isn't a directory, but it will not return an error per se if the child does -// not already exist. The error returned is either nil or an *os.PathError -// whose Op is op. -func (fs *memFS) find(op, fullname string) (parent *memFSNode, frag string, err error) { - err = fs.walk(op, fullname, func(parent0 *memFSNode, frag0 string, final bool) error { - if !final { - return nil - } - if frag0 != "" { - parent, frag = parent0, frag0 - } - return nil - }) - return parent, frag, err -} - -func (fs *memFS) Mkdir(ctx context.Context, name string, perm os.FileMode) error { - fs.mu.Lock() - defer fs.mu.Unlock() - - dir, frag, err := fs.find("mkdir", name) - if err != nil { - return err - } - if dir == nil { - // We can't create the root. - return os.ErrInvalid - } - if _, ok := dir.children[frag]; ok { - return os.ErrExist - } - dir.children[frag] = &memFSNode{ - children: make(map[string]*memFSNode), - mode: perm.Perm() | os.ModeDir, - modTime: time.Now(), - } - return nil -} - -func (fs *memFS) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error) { - fs.mu.Lock() - defer fs.mu.Unlock() - - dir, frag, err := fs.find("open", name) - if err != nil { - return nil, err - } - var n *memFSNode - if dir == nil { - // We're opening the root. - if flag&(os.O_WRONLY|os.O_RDWR) != 0 { - return nil, os.ErrPermission - } - n, frag = &fs.root, "/" - - } else { - n = dir.children[frag] - if flag&(os.O_SYNC|os.O_APPEND) != 0 { - // memFile doesn't support these flags yet. - return nil, os.ErrInvalid - } - if flag&os.O_CREATE != 0 { - if flag&os.O_EXCL != 0 && n != nil { - return nil, os.ErrExist - } - if n == nil { - n = &memFSNode{ - mode: perm.Perm(), - } - dir.children[frag] = n - } - } - if n == nil { - return nil, os.ErrNotExist - } - if flag&(os.O_WRONLY|os.O_RDWR) != 0 && flag&os.O_TRUNC != 0 { - n.mu.Lock() - n.data = nil - n.mu.Unlock() - } - } - - children := make([]os.FileInfo, 0, len(n.children)) - for cName, c := range n.children { - children = append(children, c.stat(cName)) - } - return &memFile{ - n: n, - nameSnapshot: frag, - childrenSnapshot: children, - }, nil -} - -func (fs *memFS) RemoveAll(ctx context.Context, name string) error { - fs.mu.Lock() - defer fs.mu.Unlock() - - dir, frag, err := fs.find("remove", name) - if err != nil { - return err - } - if dir == nil { - // We can't remove the root. - return os.ErrInvalid - } - delete(dir.children, frag) - return nil -} - -func (fs *memFS) Rename(ctx context.Context, oldName, newName string) error { - fs.mu.Lock() - defer fs.mu.Unlock() - - oldName = slashClean(oldName) - newName = slashClean(newName) - if oldName == newName { - return nil - } - if strings.HasPrefix(newName, oldName+"/") { - // We can't rename oldName to be a sub-directory of itself. - return os.ErrInvalid - } - - oDir, oFrag, err := fs.find("rename", oldName) - if err != nil { - return err - } - if oDir == nil { - // We can't rename from the root. - return os.ErrInvalid - } - - nDir, nFrag, err := fs.find("rename", newName) - if err != nil { - return err - } - if nDir == nil { - // We can't rename to the root. - return os.ErrInvalid - } - - oNode, ok := oDir.children[oFrag] - if !ok { - return os.ErrNotExist - } - if oNode.children != nil { - if nNode, ok := nDir.children[nFrag]; ok { - if nNode.children == nil { - return errNotADirectory - } - if len(nNode.children) != 0 { - return errDirectoryNotEmpty - } - } - } - delete(oDir.children, oFrag) - nDir.children[nFrag] = oNode - return nil -} - -func (fs *memFS) Stat(ctx context.Context, name string) (os.FileInfo, error) { - fs.mu.Lock() - defer fs.mu.Unlock() - - dir, frag, err := fs.find("stat", name) - if err != nil { - return nil, err - } - if dir == nil { - // We're stat'ting the root. - return fs.root.stat("/"), nil - } - if n, ok := dir.children[frag]; ok { - return n.stat(path.Base(name)), nil - } - return nil, os.ErrNotExist -} - -// A memFSNode represents a single entry in the in-memory filesystem and also -// implements os.FileInfo. -type memFSNode struct { - // children is protected by memFS.mu. - children map[string]*memFSNode - - mu sync.Mutex - data []byte - mode os.FileMode - modTime time.Time - deadProps map[xml.Name]Property -} - -func (n *memFSNode) stat(name string) *memFileInfo { - n.mu.Lock() - defer n.mu.Unlock() - return &memFileInfo{ - name: name, - size: int64(len(n.data)), - mode: n.mode, - modTime: n.modTime, - } -} - -func (n *memFSNode) DeadProps() (map[xml.Name]Property, error) { - n.mu.Lock() - defer n.mu.Unlock() - if len(n.deadProps) == 0 { - return nil, nil - } - ret := make(map[xml.Name]Property, len(n.deadProps)) - for k, v := range n.deadProps { - ret[k] = v - } - return ret, nil -} - -func (n *memFSNode) Patch(patches []Proppatch) ([]Propstat, error) { - n.mu.Lock() - defer n.mu.Unlock() - pstat := Propstat{Status: http.StatusOK} - for _, patch := range patches { - for _, p := range patch.Props { - pstat.Props = append(pstat.Props, Property{XMLName: p.XMLName}) - if patch.Remove { - delete(n.deadProps, p.XMLName) - continue - } - if n.deadProps == nil { - n.deadProps = map[xml.Name]Property{} - } - n.deadProps[p.XMLName] = p - } - } - return []Propstat{pstat}, nil -} - -type memFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (f *memFileInfo) Name() string { return f.name } -func (f *memFileInfo) Size() int64 { return f.size } -func (f *memFileInfo) Mode() os.FileMode { return f.mode } -func (f *memFileInfo) ModTime() time.Time { return f.modTime } -func (f *memFileInfo) IsDir() bool { return f.mode.IsDir() } -func (f *memFileInfo) Sys() interface{} { return nil } - -// A memFile is a File implementation for a memFSNode. It is a per-file (not -// per-node) read/write position, and a snapshot of the memFS' tree structure -// (a node's name and children) for that node. -type memFile struct { - n *memFSNode - nameSnapshot string - childrenSnapshot []os.FileInfo - // pos is protected by n.mu. - pos int -} - -// A *memFile implements the optional DeadPropsHolder interface. -var _ DeadPropsHolder = (*memFile)(nil) - -func (f *memFile) DeadProps() (map[xml.Name]Property, error) { return f.n.DeadProps() } -func (f *memFile) Patch(patches []Proppatch) ([]Propstat, error) { return f.n.Patch(patches) } - -func (f *memFile) Close() error { - return nil -} - -func (f *memFile) Read(p []byte) (int, error) { - f.n.mu.Lock() - defer f.n.mu.Unlock() - if f.n.mode.IsDir() { - return 0, os.ErrInvalid - } - if f.pos >= len(f.n.data) { - return 0, io.EOF - } - n := copy(p, f.n.data[f.pos:]) - f.pos += n - return n, nil -} - -func (f *memFile) Readdir(count int) ([]os.FileInfo, error) { - f.n.mu.Lock() - defer f.n.mu.Unlock() - if !f.n.mode.IsDir() { - return nil, os.ErrInvalid - } - old := f.pos - if old >= len(f.childrenSnapshot) { - // The os.File Readdir docs say that at the end of a directory, - // the error is io.EOF if count > 0 and nil if count <= 0. - if count > 0 { - return nil, io.EOF - } - return nil, nil - } - if count > 0 { - f.pos += count - if f.pos > len(f.childrenSnapshot) { - f.pos = len(f.childrenSnapshot) - } - } else { - f.pos = len(f.childrenSnapshot) - old = 0 - } - return f.childrenSnapshot[old:f.pos], nil -} - -func (f *memFile) Seek(offset int64, whence int) (int64, error) { - f.n.mu.Lock() - defer f.n.mu.Unlock() - npos := f.pos - // TODO: How to handle offsets greater than the size of system int? - switch whence { - case os.SEEK_SET: - npos = int(offset) - case os.SEEK_CUR: - npos += int(offset) - case os.SEEK_END: - npos = len(f.n.data) + int(offset) - default: - npos = -1 - } - if npos < 0 { - return 0, os.ErrInvalid - } - f.pos = npos - return int64(f.pos), nil -} - -func (f *memFile) Stat() (os.FileInfo, error) { - return f.n.stat(f.nameSnapshot), nil -} - -func (f *memFile) Write(p []byte) (int, error) { - lenp := len(p) - f.n.mu.Lock() - defer f.n.mu.Unlock() - - if f.n.mode.IsDir() { - return 0, os.ErrInvalid - } - if f.pos < len(f.n.data) { - n := copy(f.n.data[f.pos:], p) - f.pos += n - p = p[n:] - } else if f.pos > len(f.n.data) { - // Write permits the creation of holes, if we've seek'ed past the - // existing end of file. - if f.pos <= cap(f.n.data) { - oldLen := len(f.n.data) - f.n.data = f.n.data[:f.pos] - hole := f.n.data[oldLen:] - for i := range hole { - hole[i] = 0 - } - } else { - d := make([]byte, f.pos, f.pos+len(p)) - copy(d, f.n.data) - f.n.data = d - } - } - - if len(p) > 0 { - // We should only get here if f.pos == len(f.n.data). - f.n.data = append(f.n.data, p...) - f.pos = len(f.n.data) - } - f.n.modTime = time.Now() - return lenp, nil -} - -// moveFiles moves files and/or directories from src to dst. -// -// See section 9.9.4 for when various HTTP status codes apply. -func moveFiles(ctx context.Context, fs FileSystem, src, dst string, overwrite bool) (status int, err error) { - created := false - if _, err := fs.Stat(ctx, dst); err != nil { - if !os.IsNotExist(err) { - return http.StatusForbidden, err - } - created = true - } else if overwrite { - // Section 9.9.3 says that "If a resource exists at the destination - // and the Overwrite header is "T", then prior to performing the move, - // the server must perform a DELETE with "Depth: infinity" on the - // destination resource. - if err := fs.RemoveAll(ctx, dst); err != nil { - return http.StatusForbidden, err - } - } else { - return http.StatusPreconditionFailed, os.ErrExist - } - if err := fs.Rename(ctx, src, dst); err != nil { - return http.StatusForbidden, err - } - if created { - return http.StatusCreated, nil - } - return http.StatusNoContent, nil -} - -func copyProps(dst, src File) error { - d, ok := dst.(DeadPropsHolder) - if !ok { - return nil - } - s, ok := src.(DeadPropsHolder) - if !ok { - return nil - } - m, err := s.DeadProps() - if err != nil { - return err - } - props := make([]Property, 0, len(m)) - for _, prop := range m { - props = append(props, prop) - } - _, err = d.Patch([]Proppatch{{Props: props}}) - return err -} - -// copyFiles copies files and/or directories from src to dst. -// -// See section 9.8.5 for when various HTTP status codes apply. -func copyFiles(ctx context.Context, fs FileSystem, src, dst string, overwrite bool, depth int, recursion int) (status int, err error) { - if recursion == 1000 { - return http.StatusInternalServerError, errRecursionTooDeep - } - recursion++ - - // TODO: section 9.8.3 says that "Note that an infinite-depth COPY of /A/ - // into /A/B/ could lead to infinite recursion if not handled correctly." - - srcFile, err := fs.OpenFile(ctx, src, os.O_RDONLY, 0) - if err != nil { - if os.IsNotExist(err) { - return http.StatusNotFound, err - } - return http.StatusInternalServerError, err - } - defer srcFile.Close() - srcStat, err := srcFile.Stat() - if err != nil { - if os.IsNotExist(err) { - return http.StatusNotFound, err - } - return http.StatusInternalServerError, err - } - srcPerm := srcStat.Mode() & os.ModePerm - - created := false - if _, err := fs.Stat(ctx, dst); err != nil { - if os.IsNotExist(err) { - created = true - } else { - return http.StatusForbidden, err - } - } else { - if !overwrite { - return http.StatusPreconditionFailed, os.ErrExist - } - if err := fs.RemoveAll(ctx, dst); err != nil && !os.IsNotExist(err) { - return http.StatusForbidden, err - } - } - - if srcStat.IsDir() { - if err := fs.Mkdir(ctx, dst, srcPerm); err != nil { - return http.StatusForbidden, err - } - if depth == infiniteDepth { - children, err := srcFile.Readdir(-1) - if err != nil { - return http.StatusForbidden, err - } - for _, c := range children { - name := c.Name() - s := path.Join(src, name) - d := path.Join(dst, name) - cStatus, cErr := copyFiles(ctx, fs, s, d, overwrite, depth, recursion) - if cErr != nil { - // TODO: MultiStatus. - return cStatus, cErr - } - } - } - - } else { - dstFile, err := fs.OpenFile(ctx, dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, srcPerm) - if err != nil { - if os.IsNotExist(err) { - return http.StatusConflict, err - } - return http.StatusForbidden, err - - } - _, copyErr := io.Copy(dstFile, srcFile) - propsErr := copyProps(dstFile, srcFile) - closeErr := dstFile.Close() - if copyErr != nil { - return http.StatusInternalServerError, copyErr - } - if propsErr != nil { - return http.StatusInternalServerError, propsErr - } - if closeErr != nil { - return http.StatusInternalServerError, closeErr - } - } - - if created { - return http.StatusCreated, nil - } - return http.StatusNoContent, nil -} - -// walkFS traverses filesystem fs starting at name up to depth levels. -// -// Allowed values for depth are 0, 1 or infiniteDepth. For each visited node, -// walkFS calls walkFn. If a visited file system node is a directory and -// walkFn returns filepath.SkipDir, walkFS will skip traversal of this node. -func walkFS(ctx context.Context, fs FileSystem, depth int, name string, info os.FileInfo, walkFn filepath.WalkFunc) error { - // This implementation is based on Walk's code in the standard path/filepath package. - err := walkFn(name, info, nil) - if err != nil { - if info.IsDir() && err == filepath.SkipDir { - return nil - } - return err - } - if !info.IsDir() || depth == 0 { - return nil - } - if depth == 1 { - depth = 0 - } - - // Read directory names. - f, err := fs.OpenFile(ctx, name, os.O_RDONLY, 0) - if err != nil { - return walkFn(name, info, err) - } - fileInfos, err := f.Readdir(0) - f.Close() - if err != nil { - return walkFn(name, info, err) - } - - for _, fileInfo := range fileInfos { - filename := path.Join(name, fileInfo.Name()) - fileInfo, err := fs.Stat(ctx, filename) - if err != nil { - if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir { - return err - } - } else { - err = walkFS(ctx, fs, depth, filename, fileInfo, walkFn) - if err != nil { - if !fileInfo.IsDir() || err != filepath.SkipDir { - return err - } - } - } - } - return nil -} diff --git a/vendor/golang.org/x/net/webdav/if.go b/vendor/golang.org/x/net/webdav/if.go deleted file mode 100644 index 416e81cdf..000000000 --- a/vendor/golang.org/x/net/webdav/if.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package webdav - -// The If header is covered by Section 10.4. -// http://www.webdav.org/specs/rfc4918.html#HEADER_If - -import ( - "strings" -) - -// ifHeader is a disjunction (OR) of ifLists. -type ifHeader struct { - lists []ifList -} - -// ifList is a conjunction (AND) of Conditions, and an optional resource tag. -type ifList struct { - resourceTag string - conditions []Condition -} - -// parseIfHeader parses the "If: foo bar" HTTP header. The httpHeader string -// should omit the "If:" prefix and have any "\r\n"s collapsed to a " ", as is -// returned by req.Header.Get("If") for a http.Request req. -func parseIfHeader(httpHeader string) (h ifHeader, ok bool) { - s := strings.TrimSpace(httpHeader) - switch tokenType, _, _ := lex(s); tokenType { - case '(': - return parseNoTagLists(s) - case angleTokenType: - return parseTaggedLists(s) - default: - return ifHeader{}, false - } -} - -func parseNoTagLists(s string) (h ifHeader, ok bool) { - for { - l, remaining, ok := parseList(s) - if !ok { - return ifHeader{}, false - } - h.lists = append(h.lists, l) - if remaining == "" { - return h, true - } - s = remaining - } -} - -func parseTaggedLists(s string) (h ifHeader, ok bool) { - resourceTag, n := "", 0 - for first := true; ; first = false { - tokenType, tokenStr, remaining := lex(s) - switch tokenType { - case angleTokenType: - if !first && n == 0 { - return ifHeader{}, false - } - resourceTag, n = tokenStr, 0 - s = remaining - case '(': - n++ - l, remaining, ok := parseList(s) - if !ok { - return ifHeader{}, false - } - l.resourceTag = resourceTag - h.lists = append(h.lists, l) - if remaining == "" { - return h, true - } - s = remaining - default: - return ifHeader{}, false - } - } -} - -func parseList(s string) (l ifList, remaining string, ok bool) { - tokenType, _, s := lex(s) - if tokenType != '(' { - return ifList{}, "", false - } - for { - tokenType, _, remaining = lex(s) - if tokenType == ')' { - if len(l.conditions) == 0 { - return ifList{}, "", false - } - return l, remaining, true - } - c, remaining, ok := parseCondition(s) - if !ok { - return ifList{}, "", false - } - l.conditions = append(l.conditions, c) - s = remaining - } -} - -func parseCondition(s string) (c Condition, remaining string, ok bool) { - tokenType, tokenStr, s := lex(s) - if tokenType == notTokenType { - c.Not = true - tokenType, tokenStr, s = lex(s) - } - switch tokenType { - case strTokenType, angleTokenType: - c.Token = tokenStr - case squareTokenType: - c.ETag = tokenStr - default: - return Condition{}, "", false - } - return c, s, true -} - -// Single-rune tokens like '(' or ')' have a token type equal to their rune. -// All other tokens have a negative token type. -const ( - errTokenType = rune(-1) - eofTokenType = rune(-2) - strTokenType = rune(-3) - notTokenType = rune(-4) - angleTokenType = rune(-5) - squareTokenType = rune(-6) -) - -func lex(s string) (tokenType rune, tokenStr string, remaining string) { - // The net/textproto Reader that parses the HTTP header will collapse - // Linear White Space that spans multiple "\r\n" lines to a single " ", - // so we don't need to look for '\r' or '\n'. - for len(s) > 0 && (s[0] == '\t' || s[0] == ' ') { - s = s[1:] - } - if len(s) == 0 { - return eofTokenType, "", "" - } - i := 0 -loop: - for ; i < len(s); i++ { - switch s[i] { - case '\t', ' ', '(', ')', '<', '>', '[', ']': - break loop - } - } - - if i != 0 { - tokenStr, remaining = s[:i], s[i:] - if tokenStr == "Not" { - return notTokenType, "", remaining - } - return strTokenType, tokenStr, remaining - } - - j := 0 - switch s[0] { - case '<': - j, tokenType = strings.IndexByte(s, '>'), angleTokenType - case '[': - j, tokenType = strings.IndexByte(s, ']'), squareTokenType - default: - return rune(s[0]), "", s[1:] - } - if j < 0 { - return errTokenType, "", "" - } - return tokenType, s[1:j], s[j+1:] -} diff --git a/vendor/golang.org/x/net/webdav/internal/xml/README b/vendor/golang.org/x/net/webdav/internal/xml/README deleted file mode 100644 index 89656f489..000000000 --- a/vendor/golang.org/x/net/webdav/internal/xml/README +++ /dev/null @@ -1,11 +0,0 @@ -This is a fork of the encoding/xml package at ca1d6c4, the last commit before -https://go.googlesource.com/go/+/c0d6d33 "encoding/xml: restore Go 1.4 name -space behavior" made late in the lead-up to the Go 1.5 release. - -The list of encoding/xml changes is at -https://go.googlesource.com/go/+log/master/src/encoding/xml - -This fork is temporary, and I (nigeltao) expect to revert it after Go 1.6 is -released. - -See http://golang.org/issue/11841 diff --git a/vendor/golang.org/x/net/webdav/internal/xml/marshal.go b/vendor/golang.org/x/net/webdav/internal/xml/marshal.go deleted file mode 100644 index cb82ec214..000000000 --- a/vendor/golang.org/x/net/webdav/internal/xml/marshal.go +++ /dev/null @@ -1,1223 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import ( - "bufio" - "bytes" - "encoding" - "fmt" - "io" - "reflect" - "strconv" - "strings" -) - -const ( - // A generic XML header suitable for use with the output of Marshal. - // This is not automatically added to any output of this package, - // it is provided as a convenience. - Header = `` + "\n" -) - -// Marshal returns the XML encoding of v. -// -// Marshal handles an array or slice by marshalling each of the elements. -// Marshal handles a pointer by marshalling the value it points at or, if the -// pointer is nil, by writing nothing. Marshal handles an interface value by -// marshalling the value it contains or, if the interface value is nil, by -// writing nothing. Marshal handles all other data by writing one or more XML -// elements containing the data. -// -// The name for the XML elements is taken from, in order of preference: -// - the tag on the XMLName field, if the data is a struct -// - the value of the XMLName field of type xml.Name -// - the tag of the struct field used to obtain the data -// - the name of the struct field used to obtain the data -// - the name of the marshalled type -// -// The XML element for a struct contains marshalled elements for each of the -// exported fields of the struct, with these exceptions: -// - the XMLName field, described above, is omitted. -// - a field with tag "-" is omitted. -// - a field with tag "name,attr" becomes an attribute with -// the given name in the XML element. -// - a field with tag ",attr" becomes an attribute with the -// field name in the XML element. -// - a field with tag ",chardata" is written as character data, -// not as an XML element. -// - a field with tag ",innerxml" is written verbatim, not subject -// to the usual marshalling procedure. -// - a field with tag ",comment" is written as an XML comment, not -// subject to the usual marshalling procedure. It must not contain -// the "--" string within it. -// - a field with a tag including the "omitempty" option is omitted -// if the field value is empty. The empty values are false, 0, any -// nil pointer or interface value, and any array, slice, map, or -// string of length zero. -// - an anonymous struct field is handled as if the fields of its -// value were part of the outer struct. -// -// If a field uses a tag "a>b>c", then the element c will be nested inside -// parent elements a and b. Fields that appear next to each other that name -// the same parent will be enclosed in one XML element. -// -// See MarshalIndent for an example. -// -// Marshal will return an error if asked to marshal a channel, function, or map. -func Marshal(v interface{}) ([]byte, error) { - var b bytes.Buffer - if err := NewEncoder(&b).Encode(v); err != nil { - return nil, err - } - return b.Bytes(), nil -} - -// Marshaler is the interface implemented by objects that can marshal -// themselves into valid XML elements. -// -// MarshalXML encodes the receiver as zero or more XML elements. -// By convention, arrays or slices are typically encoded as a sequence -// of elements, one per entry. -// Using start as the element tag is not required, but doing so -// will enable Unmarshal to match the XML elements to the correct -// struct field. -// One common implementation strategy is to construct a separate -// value with a layout corresponding to the desired XML and then -// to encode it using e.EncodeElement. -// Another common strategy is to use repeated calls to e.EncodeToken -// to generate the XML output one token at a time. -// The sequence of encoded tokens must make up zero or more valid -// XML elements. -type Marshaler interface { - MarshalXML(e *Encoder, start StartElement) error -} - -// MarshalerAttr is the interface implemented by objects that can marshal -// themselves into valid XML attributes. -// -// MarshalXMLAttr returns an XML attribute with the encoded value of the receiver. -// Using name as the attribute name is not required, but doing so -// will enable Unmarshal to match the attribute to the correct -// struct field. -// If MarshalXMLAttr returns the zero attribute Attr{}, no attribute -// will be generated in the output. -// MarshalXMLAttr is used only for struct fields with the -// "attr" option in the field tag. -type MarshalerAttr interface { - MarshalXMLAttr(name Name) (Attr, error) -} - -// MarshalIndent works like Marshal, but each XML element begins on a new -// indented line that starts with prefix and is followed by one or more -// copies of indent according to the nesting depth. -func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - var b bytes.Buffer - enc := NewEncoder(&b) - enc.Indent(prefix, indent) - if err := enc.Encode(v); err != nil { - return nil, err - } - return b.Bytes(), nil -} - -// An Encoder writes XML data to an output stream. -type Encoder struct { - p printer -} - -// NewEncoder returns a new encoder that writes to w. -func NewEncoder(w io.Writer) *Encoder { - e := &Encoder{printer{Writer: bufio.NewWriter(w)}} - e.p.encoder = e - return e -} - -// Indent sets the encoder to generate XML in which each element -// begins on a new indented line that starts with prefix and is followed by -// one or more copies of indent according to the nesting depth. -func (enc *Encoder) Indent(prefix, indent string) { - enc.p.prefix = prefix - enc.p.indent = indent -} - -// Encode writes the XML encoding of v to the stream. -// -// See the documentation for Marshal for details about the conversion -// of Go values to XML. -// -// Encode calls Flush before returning. -func (enc *Encoder) Encode(v interface{}) error { - err := enc.p.marshalValue(reflect.ValueOf(v), nil, nil) - if err != nil { - return err - } - return enc.p.Flush() -} - -// EncodeElement writes the XML encoding of v to the stream, -// using start as the outermost tag in the encoding. -// -// See the documentation for Marshal for details about the conversion -// of Go values to XML. -// -// EncodeElement calls Flush before returning. -func (enc *Encoder) EncodeElement(v interface{}, start StartElement) error { - err := enc.p.marshalValue(reflect.ValueOf(v), nil, &start) - if err != nil { - return err - } - return enc.p.Flush() -} - -var ( - begComment = []byte("") - endProcInst = []byte("?>") - endDirective = []byte(">") -) - -// EncodeToken writes the given XML token to the stream. -// It returns an error if StartElement and EndElement tokens are not -// properly matched. -// -// EncodeToken does not call Flush, because usually it is part of a -// larger operation such as Encode or EncodeElement (or a custom -// Marshaler's MarshalXML invoked during those), and those will call -// Flush when finished. Callers that create an Encoder and then invoke -// EncodeToken directly, without using Encode or EncodeElement, need to -// call Flush when finished to ensure that the XML is written to the -// underlying writer. -// -// EncodeToken allows writing a ProcInst with Target set to "xml" only -// as the first token in the stream. -// -// When encoding a StartElement holding an XML namespace prefix -// declaration for a prefix that is not already declared, contained -// elements (including the StartElement itself) will use the declared -// prefix when encoding names with matching namespace URIs. -func (enc *Encoder) EncodeToken(t Token) error { - - p := &enc.p - switch t := t.(type) { - case StartElement: - if err := p.writeStart(&t); err != nil { - return err - } - case EndElement: - if err := p.writeEnd(t.Name); err != nil { - return err - } - case CharData: - escapeText(p, t, false) - case Comment: - if bytes.Contains(t, endComment) { - return fmt.Errorf("xml: EncodeToken of Comment containing --> marker") - } - p.WriteString("") - return p.cachedWriteError() - case ProcInst: - // First token to be encoded which is also a ProcInst with target of xml - // is the xml declaration. The only ProcInst where target of xml is allowed. - if t.Target == "xml" && p.Buffered() != 0 { - return fmt.Errorf("xml: EncodeToken of ProcInst xml target only valid for xml declaration, first token encoded") - } - if !isNameString(t.Target) { - return fmt.Errorf("xml: EncodeToken of ProcInst with invalid Target") - } - if bytes.Contains(t.Inst, endProcInst) { - return fmt.Errorf("xml: EncodeToken of ProcInst containing ?> marker") - } - p.WriteString(" 0 { - p.WriteByte(' ') - p.Write(t.Inst) - } - p.WriteString("?>") - case Directive: - if !isValidDirective(t) { - return fmt.Errorf("xml: EncodeToken of Directive containing wrong < or > markers") - } - p.WriteString("") - default: - return fmt.Errorf("xml: EncodeToken of invalid token type") - - } - return p.cachedWriteError() -} - -// isValidDirective reports whether dir is a valid directive text, -// meaning angle brackets are matched, ignoring comments and strings. -func isValidDirective(dir Directive) bool { - var ( - depth int - inquote uint8 - incomment bool - ) - for i, c := range dir { - switch { - case incomment: - if c == '>' { - if n := 1 + i - len(endComment); n >= 0 && bytes.Equal(dir[n:i+1], endComment) { - incomment = false - } - } - // Just ignore anything in comment - case inquote != 0: - if c == inquote { - inquote = 0 - } - // Just ignore anything within quotes - case c == '\'' || c == '"': - inquote = c - case c == '<': - if i+len(begComment) < len(dir) && bytes.Equal(dir[i:i+len(begComment)], begComment) { - incomment = true - } else { - depth++ - } - case c == '>': - if depth == 0 { - return false - } - depth-- - } - } - return depth == 0 && inquote == 0 && !incomment -} - -// Flush flushes any buffered XML to the underlying writer. -// See the EncodeToken documentation for details about when it is necessary. -func (enc *Encoder) Flush() error { - return enc.p.Flush() -} - -type printer struct { - *bufio.Writer - encoder *Encoder - seq int - indent string - prefix string - depth int - indentedIn bool - putNewline bool - defaultNS string - attrNS map[string]string // map prefix -> name space - attrPrefix map[string]string // map name space -> prefix - prefixes []printerPrefix - tags []Name -} - -// printerPrefix holds a namespace undo record. -// When an element is popped, the prefix record -// is set back to the recorded URL. The empty -// prefix records the URL for the default name space. -// -// The start of an element is recorded with an element -// that has mark=true. -type printerPrefix struct { - prefix string - url string - mark bool -} - -func (p *printer) prefixForNS(url string, isAttr bool) string { - // The "http://www.w3.org/XML/1998/namespace" name space is predefined as "xml" - // and must be referred to that way. - // (The "http://www.w3.org/2000/xmlns/" name space is also predefined as "xmlns", - // but users should not be trying to use that one directly - that's our job.) - if url == xmlURL { - return "xml" - } - if !isAttr && url == p.defaultNS { - // We can use the default name space. - return "" - } - return p.attrPrefix[url] -} - -// defineNS pushes any namespace definition found in the given attribute. -// If ignoreNonEmptyDefault is true, an xmlns="nonempty" -// attribute will be ignored. -func (p *printer) defineNS(attr Attr, ignoreNonEmptyDefault bool) error { - var prefix string - if attr.Name.Local == "xmlns" { - if attr.Name.Space != "" && attr.Name.Space != "xml" && attr.Name.Space != xmlURL { - return fmt.Errorf("xml: cannot redefine xmlns attribute prefix") - } - } else if attr.Name.Space == "xmlns" && attr.Name.Local != "" { - prefix = attr.Name.Local - if attr.Value == "" { - // Technically, an empty XML namespace is allowed for an attribute. - // From http://www.w3.org/TR/xml-names11/#scoping-defaulting: - // - // The attribute value in a namespace declaration for a prefix may be - // empty. This has the effect, within the scope of the declaration, of removing - // any association of the prefix with a namespace name. - // - // However our namespace prefixes here are used only as hints. There's - // no need to respect the removal of a namespace prefix, so we ignore it. - return nil - } - } else { - // Ignore: it's not a namespace definition - return nil - } - if prefix == "" { - if attr.Value == p.defaultNS { - // No need for redefinition. - return nil - } - if attr.Value != "" && ignoreNonEmptyDefault { - // We have an xmlns="..." value but - // it can't define a name space in this context, - // probably because the element has an empty - // name space. In this case, we just ignore - // the name space declaration. - return nil - } - } else if _, ok := p.attrPrefix[attr.Value]; ok { - // There's already a prefix for the given name space, - // so use that. This prevents us from - // having two prefixes for the same name space - // so attrNS and attrPrefix can remain bijective. - return nil - } - p.pushPrefix(prefix, attr.Value) - return nil -} - -// createNSPrefix creates a name space prefix attribute -// to use for the given name space, defining a new prefix -// if necessary. -// If isAttr is true, the prefix is to be created for an attribute -// prefix, which means that the default name space cannot -// be used. -func (p *printer) createNSPrefix(url string, isAttr bool) { - if _, ok := p.attrPrefix[url]; ok { - // We already have a prefix for the given URL. - return - } - switch { - case !isAttr && url == p.defaultNS: - // We can use the default name space. - return - case url == "": - // The only way we can encode names in the empty - // name space is by using the default name space, - // so we must use that. - if p.defaultNS != "" { - // The default namespace is non-empty, so we - // need to set it to empty. - p.pushPrefix("", "") - } - return - case url == xmlURL: - return - } - // TODO If the URL is an existing prefix, we could - // use it as is. That would enable the - // marshaling of elements that had been unmarshaled - // and with a name space prefix that was not found. - // although technically it would be incorrect. - - // Pick a name. We try to use the final element of the path - // but fall back to _. - prefix := strings.TrimRight(url, "/") - if i := strings.LastIndex(prefix, "/"); i >= 0 { - prefix = prefix[i+1:] - } - if prefix == "" || !isName([]byte(prefix)) || strings.Contains(prefix, ":") { - prefix = "_" - } - if strings.HasPrefix(prefix, "xml") { - // xmlanything is reserved. - prefix = "_" + prefix - } - if p.attrNS[prefix] != "" { - // Name is taken. Find a better one. - for p.seq++; ; p.seq++ { - if id := prefix + "_" + strconv.Itoa(p.seq); p.attrNS[id] == "" { - prefix = id - break - } - } - } - - p.pushPrefix(prefix, url) -} - -// writeNamespaces writes xmlns attributes for all the -// namespace prefixes that have been defined in -// the current element. -func (p *printer) writeNamespaces() { - for i := len(p.prefixes) - 1; i >= 0; i-- { - prefix := p.prefixes[i] - if prefix.mark { - return - } - p.WriteString(" ") - if prefix.prefix == "" { - // Default name space. - p.WriteString(`xmlns="`) - } else { - p.WriteString("xmlns:") - p.WriteString(prefix.prefix) - p.WriteString(`="`) - } - EscapeText(p, []byte(p.nsForPrefix(prefix.prefix))) - p.WriteString(`"`) - } -} - -// pushPrefix pushes a new prefix on the prefix stack -// without checking to see if it is already defined. -func (p *printer) pushPrefix(prefix, url string) { - p.prefixes = append(p.prefixes, printerPrefix{ - prefix: prefix, - url: p.nsForPrefix(prefix), - }) - p.setAttrPrefix(prefix, url) -} - -// nsForPrefix returns the name space for the given -// prefix. Note that this is not valid for the -// empty attribute prefix, which always has an empty -// name space. -func (p *printer) nsForPrefix(prefix string) string { - if prefix == "" { - return p.defaultNS - } - return p.attrNS[prefix] -} - -// markPrefix marks the start of an element on the prefix -// stack. -func (p *printer) markPrefix() { - p.prefixes = append(p.prefixes, printerPrefix{ - mark: true, - }) -} - -// popPrefix pops all defined prefixes for the current -// element. -func (p *printer) popPrefix() { - for len(p.prefixes) > 0 { - prefix := p.prefixes[len(p.prefixes)-1] - p.prefixes = p.prefixes[:len(p.prefixes)-1] - if prefix.mark { - break - } - p.setAttrPrefix(prefix.prefix, prefix.url) - } -} - -// setAttrPrefix sets an attribute name space prefix. -// If url is empty, the attribute is removed. -// If prefix is empty, the default name space is set. -func (p *printer) setAttrPrefix(prefix, url string) { - if prefix == "" { - p.defaultNS = url - return - } - if url == "" { - delete(p.attrPrefix, p.attrNS[prefix]) - delete(p.attrNS, prefix) - return - } - if p.attrPrefix == nil { - // Need to define a new name space. - p.attrPrefix = make(map[string]string) - p.attrNS = make(map[string]string) - } - // Remove any old prefix value. This is OK because we maintain a - // strict one-to-one mapping between prefix and URL (see - // defineNS) - delete(p.attrPrefix, p.attrNS[prefix]) - p.attrPrefix[url] = prefix - p.attrNS[prefix] = url -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() - marshalerAttrType = reflect.TypeOf((*MarshalerAttr)(nil)).Elem() - textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() -) - -// marshalValue writes one or more XML elements representing val. -// If val was obtained from a struct field, finfo must have its details. -func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplate *StartElement) error { - if startTemplate != nil && startTemplate.Name.Local == "" { - return fmt.Errorf("xml: EncodeElement of StartElement with missing name") - } - - if !val.IsValid() { - return nil - } - if finfo != nil && finfo.flags&fOmitEmpty != 0 && isEmptyValue(val) { - return nil - } - - // Drill into interfaces and pointers. - // This can turn into an infinite loop given a cyclic chain, - // but it matches the Go 1 behavior. - for val.Kind() == reflect.Interface || val.Kind() == reflect.Ptr { - if val.IsNil() { - return nil - } - val = val.Elem() - } - - kind := val.Kind() - typ := val.Type() - - // Check for marshaler. - if val.CanInterface() && typ.Implements(marshalerType) { - return p.marshalInterface(val.Interface().(Marshaler), p.defaultStart(typ, finfo, startTemplate)) - } - if val.CanAddr() { - pv := val.Addr() - if pv.CanInterface() && pv.Type().Implements(marshalerType) { - return p.marshalInterface(pv.Interface().(Marshaler), p.defaultStart(pv.Type(), finfo, startTemplate)) - } - } - - // Check for text marshaler. - if val.CanInterface() && typ.Implements(textMarshalerType) { - return p.marshalTextInterface(val.Interface().(encoding.TextMarshaler), p.defaultStart(typ, finfo, startTemplate)) - } - if val.CanAddr() { - pv := val.Addr() - if pv.CanInterface() && pv.Type().Implements(textMarshalerType) { - return p.marshalTextInterface(pv.Interface().(encoding.TextMarshaler), p.defaultStart(pv.Type(), finfo, startTemplate)) - } - } - - // Slices and arrays iterate over the elements. They do not have an enclosing tag. - if (kind == reflect.Slice || kind == reflect.Array) && typ.Elem().Kind() != reflect.Uint8 { - for i, n := 0, val.Len(); i < n; i++ { - if err := p.marshalValue(val.Index(i), finfo, startTemplate); err != nil { - return err - } - } - return nil - } - - tinfo, err := getTypeInfo(typ) - if err != nil { - return err - } - - // Create start element. - // Precedence for the XML element name is: - // 0. startTemplate - // 1. XMLName field in underlying struct; - // 2. field name/tag in the struct field; and - // 3. type name - var start StartElement - - // explicitNS records whether the element's name space has been - // explicitly set (for example an XMLName field). - explicitNS := false - - if startTemplate != nil { - start.Name = startTemplate.Name - explicitNS = true - start.Attr = append(start.Attr, startTemplate.Attr...) - } else if tinfo.xmlname != nil { - xmlname := tinfo.xmlname - if xmlname.name != "" { - start.Name.Space, start.Name.Local = xmlname.xmlns, xmlname.name - } else if v, ok := xmlname.value(val).Interface().(Name); ok && v.Local != "" { - start.Name = v - } - explicitNS = true - } - if start.Name.Local == "" && finfo != nil { - start.Name.Local = finfo.name - if finfo.xmlns != "" { - start.Name.Space = finfo.xmlns - explicitNS = true - } - } - if start.Name.Local == "" { - name := typ.Name() - if name == "" { - return &UnsupportedTypeError{typ} - } - start.Name.Local = name - } - - // defaultNS records the default name space as set by a xmlns="..." - // attribute. We don't set p.defaultNS because we want to let - // the attribute writing code (in p.defineNS) be solely responsible - // for maintaining that. - defaultNS := p.defaultNS - - // Attributes - for i := range tinfo.fields { - finfo := &tinfo.fields[i] - if finfo.flags&fAttr == 0 { - continue - } - attr, err := p.fieldAttr(finfo, val) - if err != nil { - return err - } - if attr.Name.Local == "" { - continue - } - start.Attr = append(start.Attr, attr) - if attr.Name.Space == "" && attr.Name.Local == "xmlns" { - defaultNS = attr.Value - } - } - if !explicitNS { - // Historic behavior: elements use the default name space - // they are contained in by default. - start.Name.Space = defaultNS - } - // Historic behaviour: an element that's in a namespace sets - // the default namespace for all elements contained within it. - start.setDefaultNamespace() - - if err := p.writeStart(&start); err != nil { - return err - } - - if val.Kind() == reflect.Struct { - err = p.marshalStruct(tinfo, val) - } else { - s, b, err1 := p.marshalSimple(typ, val) - if err1 != nil { - err = err1 - } else if b != nil { - EscapeText(p, b) - } else { - p.EscapeString(s) - } - } - if err != nil { - return err - } - - if err := p.writeEnd(start.Name); err != nil { - return err - } - - return p.cachedWriteError() -} - -// fieldAttr returns the attribute of the given field. -// If the returned attribute has an empty Name.Local, -// it should not be used. -// The given value holds the value containing the field. -func (p *printer) fieldAttr(finfo *fieldInfo, val reflect.Value) (Attr, error) { - fv := finfo.value(val) - name := Name{Space: finfo.xmlns, Local: finfo.name} - if finfo.flags&fOmitEmpty != 0 && isEmptyValue(fv) { - return Attr{}, nil - } - if fv.Kind() == reflect.Interface && fv.IsNil() { - return Attr{}, nil - } - if fv.CanInterface() && fv.Type().Implements(marshalerAttrType) { - attr, err := fv.Interface().(MarshalerAttr).MarshalXMLAttr(name) - return attr, err - } - if fv.CanAddr() { - pv := fv.Addr() - if pv.CanInterface() && pv.Type().Implements(marshalerAttrType) { - attr, err := pv.Interface().(MarshalerAttr).MarshalXMLAttr(name) - return attr, err - } - } - if fv.CanInterface() && fv.Type().Implements(textMarshalerType) { - text, err := fv.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return Attr{}, err - } - return Attr{name, string(text)}, nil - } - if fv.CanAddr() { - pv := fv.Addr() - if pv.CanInterface() && pv.Type().Implements(textMarshalerType) { - text, err := pv.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return Attr{}, err - } - return Attr{name, string(text)}, nil - } - } - // Dereference or skip nil pointer, interface values. - switch fv.Kind() { - case reflect.Ptr, reflect.Interface: - if fv.IsNil() { - return Attr{}, nil - } - fv = fv.Elem() - } - s, b, err := p.marshalSimple(fv.Type(), fv) - if err != nil { - return Attr{}, err - } - if b != nil { - s = string(b) - } - return Attr{name, s}, nil -} - -// defaultStart returns the default start element to use, -// given the reflect type, field info, and start template. -func (p *printer) defaultStart(typ reflect.Type, finfo *fieldInfo, startTemplate *StartElement) StartElement { - var start StartElement - // Precedence for the XML element name is as above, - // except that we do not look inside structs for the first field. - if startTemplate != nil { - start.Name = startTemplate.Name - start.Attr = append(start.Attr, startTemplate.Attr...) - } else if finfo != nil && finfo.name != "" { - start.Name.Local = finfo.name - start.Name.Space = finfo.xmlns - } else if typ.Name() != "" { - start.Name.Local = typ.Name() - } else { - // Must be a pointer to a named type, - // since it has the Marshaler methods. - start.Name.Local = typ.Elem().Name() - } - // Historic behaviour: elements use the name space of - // the element they are contained in by default. - if start.Name.Space == "" { - start.Name.Space = p.defaultNS - } - start.setDefaultNamespace() - return start -} - -// marshalInterface marshals a Marshaler interface value. -func (p *printer) marshalInterface(val Marshaler, start StartElement) error { - // Push a marker onto the tag stack so that MarshalXML - // cannot close the XML tags that it did not open. - p.tags = append(p.tags, Name{}) - n := len(p.tags) - - err := val.MarshalXML(p.encoder, start) - if err != nil { - return err - } - - // Make sure MarshalXML closed all its tags. p.tags[n-1] is the mark. - if len(p.tags) > n { - return fmt.Errorf("xml: %s.MarshalXML wrote invalid XML: <%s> not closed", receiverType(val), p.tags[len(p.tags)-1].Local) - } - p.tags = p.tags[:n-1] - return nil -} - -// marshalTextInterface marshals a TextMarshaler interface value. -func (p *printer) marshalTextInterface(val encoding.TextMarshaler, start StartElement) error { - if err := p.writeStart(&start); err != nil { - return err - } - text, err := val.MarshalText() - if err != nil { - return err - } - EscapeText(p, text) - return p.writeEnd(start.Name) -} - -// writeStart writes the given start element. -func (p *printer) writeStart(start *StartElement) error { - if start.Name.Local == "" { - return fmt.Errorf("xml: start tag with no name") - } - - p.tags = append(p.tags, start.Name) - p.markPrefix() - // Define any name spaces explicitly declared in the attributes. - // We do this as a separate pass so that explicitly declared prefixes - // will take precedence over implicitly declared prefixes - // regardless of the order of the attributes. - ignoreNonEmptyDefault := start.Name.Space == "" - for _, attr := range start.Attr { - if err := p.defineNS(attr, ignoreNonEmptyDefault); err != nil { - return err - } - } - // Define any new name spaces implied by the attributes. - for _, attr := range start.Attr { - name := attr.Name - // From http://www.w3.org/TR/xml-names11/#defaulting - // "Default namespace declarations do not apply directly - // to attribute names; the interpretation of unprefixed - // attributes is determined by the element on which they - // appear." - // This means we don't need to create a new namespace - // when an attribute name space is empty. - if name.Space != "" && !name.isNamespace() { - p.createNSPrefix(name.Space, true) - } - } - p.createNSPrefix(start.Name.Space, false) - - p.writeIndent(1) - p.WriteByte('<') - p.writeName(start.Name, false) - p.writeNamespaces() - for _, attr := range start.Attr { - name := attr.Name - if name.Local == "" || name.isNamespace() { - // Namespaces have already been written by writeNamespaces above. - continue - } - p.WriteByte(' ') - p.writeName(name, true) - p.WriteString(`="`) - p.EscapeString(attr.Value) - p.WriteByte('"') - } - p.WriteByte('>') - return nil -} - -// writeName writes the given name. It assumes -// that p.createNSPrefix(name) has already been called. -func (p *printer) writeName(name Name, isAttr bool) { - if prefix := p.prefixForNS(name.Space, isAttr); prefix != "" { - p.WriteString(prefix) - p.WriteByte(':') - } - p.WriteString(name.Local) -} - -func (p *printer) writeEnd(name Name) error { - if name.Local == "" { - return fmt.Errorf("xml: end tag with no name") - } - if len(p.tags) == 0 || p.tags[len(p.tags)-1].Local == "" { - return fmt.Errorf("xml: end tag without start tag", name.Local) - } - if top := p.tags[len(p.tags)-1]; top != name { - if top.Local != name.Local { - return fmt.Errorf("xml: end tag does not match start tag <%s>", name.Local, top.Local) - } - return fmt.Errorf("xml: end tag in namespace %s does not match start tag <%s> in namespace %s", name.Local, name.Space, top.Local, top.Space) - } - p.tags = p.tags[:len(p.tags)-1] - - p.writeIndent(-1) - p.WriteByte('<') - p.WriteByte('/') - p.writeName(name, false) - p.WriteByte('>') - p.popPrefix() - return nil -} - -func (p *printer) marshalSimple(typ reflect.Type, val reflect.Value) (string, []byte, error) { - switch val.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.FormatInt(val.Int(), 10), nil, nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return strconv.FormatUint(val.Uint(), 10), nil, nil - case reflect.Float32, reflect.Float64: - return strconv.FormatFloat(val.Float(), 'g', -1, val.Type().Bits()), nil, nil - case reflect.String: - return val.String(), nil, nil - case reflect.Bool: - return strconv.FormatBool(val.Bool()), nil, nil - case reflect.Array: - if typ.Elem().Kind() != reflect.Uint8 { - break - } - // [...]byte - var bytes []byte - if val.CanAddr() { - bytes = val.Slice(0, val.Len()).Bytes() - } else { - bytes = make([]byte, val.Len()) - reflect.Copy(reflect.ValueOf(bytes), val) - } - return "", bytes, nil - case reflect.Slice: - if typ.Elem().Kind() != reflect.Uint8 { - break - } - // []byte - return "", val.Bytes(), nil - } - return "", nil, &UnsupportedTypeError{typ} -} - -var ddBytes = []byte("--") - -func (p *printer) marshalStruct(tinfo *typeInfo, val reflect.Value) error { - s := parentStack{p: p} - for i := range tinfo.fields { - finfo := &tinfo.fields[i] - if finfo.flags&fAttr != 0 { - continue - } - vf := finfo.value(val) - - // Dereference or skip nil pointer, interface values. - switch vf.Kind() { - case reflect.Ptr, reflect.Interface: - if !vf.IsNil() { - vf = vf.Elem() - } - } - - switch finfo.flags & fMode { - case fCharData: - if err := s.setParents(&noField, reflect.Value{}); err != nil { - return err - } - if vf.CanInterface() && vf.Type().Implements(textMarshalerType) { - data, err := vf.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return err - } - Escape(p, data) - continue - } - if vf.CanAddr() { - pv := vf.Addr() - if pv.CanInterface() && pv.Type().Implements(textMarshalerType) { - data, err := pv.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return err - } - Escape(p, data) - continue - } - } - var scratch [64]byte - switch vf.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - Escape(p, strconv.AppendInt(scratch[:0], vf.Int(), 10)) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - Escape(p, strconv.AppendUint(scratch[:0], vf.Uint(), 10)) - case reflect.Float32, reflect.Float64: - Escape(p, strconv.AppendFloat(scratch[:0], vf.Float(), 'g', -1, vf.Type().Bits())) - case reflect.Bool: - Escape(p, strconv.AppendBool(scratch[:0], vf.Bool())) - case reflect.String: - if err := EscapeText(p, []byte(vf.String())); err != nil { - return err - } - case reflect.Slice: - if elem, ok := vf.Interface().([]byte); ok { - if err := EscapeText(p, elem); err != nil { - return err - } - } - } - continue - - case fComment: - if err := s.setParents(&noField, reflect.Value{}); err != nil { - return err - } - k := vf.Kind() - if !(k == reflect.String || k == reflect.Slice && vf.Type().Elem().Kind() == reflect.Uint8) { - return fmt.Errorf("xml: bad type for comment field of %s", val.Type()) - } - if vf.Len() == 0 { - continue - } - p.writeIndent(0) - p.WriteString("" is invalid grammar. Make it "- -->" - p.WriteByte(' ') - } - p.WriteString("-->") - continue - - case fInnerXml: - iface := vf.Interface() - switch raw := iface.(type) { - case []byte: - p.Write(raw) - continue - case string: - p.WriteString(raw) - continue - } - - case fElement, fElement | fAny: - if err := s.setParents(finfo, vf); err != nil { - return err - } - } - if err := p.marshalValue(vf, finfo, nil); err != nil { - return err - } - } - if err := s.setParents(&noField, reflect.Value{}); err != nil { - return err - } - return p.cachedWriteError() -} - -var noField fieldInfo - -// return the bufio Writer's cached write error -func (p *printer) cachedWriteError() error { - _, err := p.Write(nil) - return err -} - -func (p *printer) writeIndent(depthDelta int) { - if len(p.prefix) == 0 && len(p.indent) == 0 { - return - } - if depthDelta < 0 { - p.depth-- - if p.indentedIn { - p.indentedIn = false - return - } - p.indentedIn = false - } - if p.putNewline { - p.WriteByte('\n') - } else { - p.putNewline = true - } - if len(p.prefix) > 0 { - p.WriteString(p.prefix) - } - if len(p.indent) > 0 { - for i := 0; i < p.depth; i++ { - p.WriteString(p.indent) - } - } - if depthDelta > 0 { - p.depth++ - p.indentedIn = true - } -} - -type parentStack struct { - p *printer - xmlns string - parents []string -} - -// setParents sets the stack of current parents to those found in finfo. -// It only writes the start elements if vf holds a non-nil value. -// If finfo is &noField, it pops all elements. -func (s *parentStack) setParents(finfo *fieldInfo, vf reflect.Value) error { - xmlns := s.p.defaultNS - if finfo.xmlns != "" { - xmlns = finfo.xmlns - } - commonParents := 0 - if xmlns == s.xmlns { - for ; commonParents < len(finfo.parents) && commonParents < len(s.parents); commonParents++ { - if finfo.parents[commonParents] != s.parents[commonParents] { - break - } - } - } - // Pop off any parents that aren't in common with the previous field. - for i := len(s.parents) - 1; i >= commonParents; i-- { - if err := s.p.writeEnd(Name{ - Space: s.xmlns, - Local: s.parents[i], - }); err != nil { - return err - } - } - s.parents = finfo.parents - s.xmlns = xmlns - if commonParents >= len(s.parents) { - // No new elements to push. - return nil - } - if (vf.Kind() == reflect.Ptr || vf.Kind() == reflect.Interface) && vf.IsNil() { - // The element is nil, so no need for the start elements. - s.parents = s.parents[:commonParents] - return nil - } - // Push any new parents required. - for _, name := range s.parents[commonParents:] { - start := &StartElement{ - Name: Name{ - Space: s.xmlns, - Local: name, - }, - } - // Set the default name space for parent elements - // to match what we do with other elements. - if s.xmlns != s.p.defaultNS { - start.setDefaultNamespace() - } - if err := s.p.writeStart(start); err != nil { - return err - } - } - return nil -} - -// A MarshalXMLError is returned when Marshal encounters a type -// that cannot be converted into XML. -type UnsupportedTypeError struct { - Type reflect.Type -} - -func (e *UnsupportedTypeError) Error() string { - return "xml: unsupported type: " + e.Type.String() -} - -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - return false -} diff --git a/vendor/golang.org/x/net/webdav/internal/xml/read.go b/vendor/golang.org/x/net/webdav/internal/xml/read.go deleted file mode 100644 index 4089056a1..000000000 --- a/vendor/golang.org/x/net/webdav/internal/xml/read.go +++ /dev/null @@ -1,692 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import ( - "bytes" - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" -) - -// BUG(rsc): Mapping between XML elements and data structures is inherently flawed: -// an XML element is an order-dependent collection of anonymous -// values, while a data structure is an order-independent collection -// of named values. -// See package json for a textual representation more suitable -// to data structures. - -// Unmarshal parses the XML-encoded data and stores the result in -// the value pointed to by v, which must be an arbitrary struct, -// slice, or string. Well-formed data that does not fit into v is -// discarded. -// -// Because Unmarshal uses the reflect package, it can only assign -// to exported (upper case) fields. Unmarshal uses a case-sensitive -// comparison to match XML element names to tag values and struct -// field names. -// -// Unmarshal maps an XML element to a struct using the following rules. -// In the rules, the tag of a field refers to the value associated with the -// key 'xml' in the struct field's tag (see the example above). -// -// * If the struct has a field of type []byte or string with tag -// ",innerxml", Unmarshal accumulates the raw XML nested inside the -// element in that field. The rest of the rules still apply. -// -// * If the struct has a field named XMLName of type xml.Name, -// Unmarshal records the element name in that field. -// -// * If the XMLName field has an associated tag of the form -// "name" or "namespace-URL name", the XML element must have -// the given name (and, optionally, name space) or else Unmarshal -// returns an error. -// -// * If the XML element has an attribute whose name matches a -// struct field name with an associated tag containing ",attr" or -// the explicit name in a struct field tag of the form "name,attr", -// Unmarshal records the attribute value in that field. -// -// * If the XML element contains character data, that data is -// accumulated in the first struct field that has tag ",chardata". -// The struct field may have type []byte or string. -// If there is no such field, the character data is discarded. -// -// * If the XML element contains comments, they are accumulated in -// the first struct field that has tag ",comment". The struct -// field may have type []byte or string. If there is no such -// field, the comments are discarded. -// -// * If the XML element contains a sub-element whose name matches -// the prefix of a tag formatted as "a" or "a>b>c", unmarshal -// will descend into the XML structure looking for elements with the -// given names, and will map the innermost elements to that struct -// field. A tag starting with ">" is equivalent to one starting -// with the field name followed by ">". -// -// * If the XML element contains a sub-element whose name matches -// a struct field's XMLName tag and the struct field has no -// explicit name tag as per the previous rule, unmarshal maps -// the sub-element to that struct field. -// -// * If the XML element contains a sub-element whose name matches a -// field without any mode flags (",attr", ",chardata", etc), Unmarshal -// maps the sub-element to that struct field. -// -// * If the XML element contains a sub-element that hasn't matched any -// of the above rules and the struct has a field with tag ",any", -// unmarshal maps the sub-element to that struct field. -// -// * An anonymous struct field is handled as if the fields of its -// value were part of the outer struct. -// -// * A struct field with tag "-" is never unmarshalled into. -// -// Unmarshal maps an XML element to a string or []byte by saving the -// concatenation of that element's character data in the string or -// []byte. The saved []byte is never nil. -// -// Unmarshal maps an attribute value to a string or []byte by saving -// the value in the string or slice. -// -// Unmarshal maps an XML element to a slice by extending the length of -// the slice and mapping the element to the newly created value. -// -// Unmarshal maps an XML element or attribute value to a bool by -// setting it to the boolean value represented by the string. -// -// Unmarshal maps an XML element or attribute value to an integer or -// floating-point field by setting the field to the result of -// interpreting the string value in decimal. There is no check for -// overflow. -// -// Unmarshal maps an XML element to an xml.Name by recording the -// element name. -// -// Unmarshal maps an XML element to a pointer by setting the pointer -// to a freshly allocated value and then mapping the element to that value. -// -func Unmarshal(data []byte, v interface{}) error { - return NewDecoder(bytes.NewReader(data)).Decode(v) -} - -// Decode works like xml.Unmarshal, except it reads the decoder -// stream to find the start element. -func (d *Decoder) Decode(v interface{}) error { - return d.DecodeElement(v, nil) -} - -// DecodeElement works like xml.Unmarshal except that it takes -// a pointer to the start XML element to decode into v. -// It is useful when a client reads some raw XML tokens itself -// but also wants to defer to Unmarshal for some elements. -func (d *Decoder) DecodeElement(v interface{}, start *StartElement) error { - val := reflect.ValueOf(v) - if val.Kind() != reflect.Ptr { - return errors.New("non-pointer passed to Unmarshal") - } - return d.unmarshal(val.Elem(), start) -} - -// An UnmarshalError represents an error in the unmarshalling process. -type UnmarshalError string - -func (e UnmarshalError) Error() string { return string(e) } - -// Unmarshaler is the interface implemented by objects that can unmarshal -// an XML element description of themselves. -// -// UnmarshalXML decodes a single XML element -// beginning with the given start element. -// If it returns an error, the outer call to Unmarshal stops and -// returns that error. -// UnmarshalXML must consume exactly one XML element. -// One common implementation strategy is to unmarshal into -// a separate value with a layout matching the expected XML -// using d.DecodeElement, and then to copy the data from -// that value into the receiver. -// Another common strategy is to use d.Token to process the -// XML object one token at a time. -// UnmarshalXML may not use d.RawToken. -type Unmarshaler interface { - UnmarshalXML(d *Decoder, start StartElement) error -} - -// UnmarshalerAttr is the interface implemented by objects that can unmarshal -// an XML attribute description of themselves. -// -// UnmarshalXMLAttr decodes a single XML attribute. -// If it returns an error, the outer call to Unmarshal stops and -// returns that error. -// UnmarshalXMLAttr is used only for struct fields with the -// "attr" option in the field tag. -type UnmarshalerAttr interface { - UnmarshalXMLAttr(attr Attr) error -} - -// receiverType returns the receiver type to use in an expression like "%s.MethodName". -func receiverType(val interface{}) string { - t := reflect.TypeOf(val) - if t.Name() != "" { - return t.String() - } - return "(" + t.String() + ")" -} - -// unmarshalInterface unmarshals a single XML element into val. -// start is the opening tag of the element. -func (p *Decoder) unmarshalInterface(val Unmarshaler, start *StartElement) error { - // Record that decoder must stop at end tag corresponding to start. - p.pushEOF() - - p.unmarshalDepth++ - err := val.UnmarshalXML(p, *start) - p.unmarshalDepth-- - if err != nil { - p.popEOF() - return err - } - - if !p.popEOF() { - return fmt.Errorf("xml: %s.UnmarshalXML did not consume entire <%s> element", receiverType(val), start.Name.Local) - } - - return nil -} - -// unmarshalTextInterface unmarshals a single XML element into val. -// The chardata contained in the element (but not its children) -// is passed to the text unmarshaler. -func (p *Decoder) unmarshalTextInterface(val encoding.TextUnmarshaler, start *StartElement) error { - var buf []byte - depth := 1 - for depth > 0 { - t, err := p.Token() - if err != nil { - return err - } - switch t := t.(type) { - case CharData: - if depth == 1 { - buf = append(buf, t...) - } - case StartElement: - depth++ - case EndElement: - depth-- - } - } - return val.UnmarshalText(buf) -} - -// unmarshalAttr unmarshals a single XML attribute into val. -func (p *Decoder) unmarshalAttr(val reflect.Value, attr Attr) error { - if val.Kind() == reflect.Ptr { - if val.IsNil() { - val.Set(reflect.New(val.Type().Elem())) - } - val = val.Elem() - } - - if val.CanInterface() && val.Type().Implements(unmarshalerAttrType) { - // This is an unmarshaler with a non-pointer receiver, - // so it's likely to be incorrect, but we do what we're told. - return val.Interface().(UnmarshalerAttr).UnmarshalXMLAttr(attr) - } - if val.CanAddr() { - pv := val.Addr() - if pv.CanInterface() && pv.Type().Implements(unmarshalerAttrType) { - return pv.Interface().(UnmarshalerAttr).UnmarshalXMLAttr(attr) - } - } - - // Not an UnmarshalerAttr; try encoding.TextUnmarshaler. - if val.CanInterface() && val.Type().Implements(textUnmarshalerType) { - // This is an unmarshaler with a non-pointer receiver, - // so it's likely to be incorrect, but we do what we're told. - return val.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(attr.Value)) - } - if val.CanAddr() { - pv := val.Addr() - if pv.CanInterface() && pv.Type().Implements(textUnmarshalerType) { - return pv.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(attr.Value)) - } - } - - copyValue(val, []byte(attr.Value)) - return nil -} - -var ( - unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() - unmarshalerAttrType = reflect.TypeOf((*UnmarshalerAttr)(nil)).Elem() - textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() -) - -// Unmarshal a single XML element into val. -func (p *Decoder) unmarshal(val reflect.Value, start *StartElement) error { - // Find start element if we need it. - if start == nil { - for { - tok, err := p.Token() - if err != nil { - return err - } - if t, ok := tok.(StartElement); ok { - start = &t - break - } - } - } - - // Load value from interface, but only if the result will be - // usefully addressable. - if val.Kind() == reflect.Interface && !val.IsNil() { - e := val.Elem() - if e.Kind() == reflect.Ptr && !e.IsNil() { - val = e - } - } - - if val.Kind() == reflect.Ptr { - if val.IsNil() { - val.Set(reflect.New(val.Type().Elem())) - } - val = val.Elem() - } - - if val.CanInterface() && val.Type().Implements(unmarshalerType) { - // This is an unmarshaler with a non-pointer receiver, - // so it's likely to be incorrect, but we do what we're told. - return p.unmarshalInterface(val.Interface().(Unmarshaler), start) - } - - if val.CanAddr() { - pv := val.Addr() - if pv.CanInterface() && pv.Type().Implements(unmarshalerType) { - return p.unmarshalInterface(pv.Interface().(Unmarshaler), start) - } - } - - if val.CanInterface() && val.Type().Implements(textUnmarshalerType) { - return p.unmarshalTextInterface(val.Interface().(encoding.TextUnmarshaler), start) - } - - if val.CanAddr() { - pv := val.Addr() - if pv.CanInterface() && pv.Type().Implements(textUnmarshalerType) { - return p.unmarshalTextInterface(pv.Interface().(encoding.TextUnmarshaler), start) - } - } - - var ( - data []byte - saveData reflect.Value - comment []byte - saveComment reflect.Value - saveXML reflect.Value - saveXMLIndex int - saveXMLData []byte - saveAny reflect.Value - sv reflect.Value - tinfo *typeInfo - err error - ) - - switch v := val; v.Kind() { - default: - return errors.New("unknown type " + v.Type().String()) - - case reflect.Interface: - // TODO: For now, simply ignore the field. In the near - // future we may choose to unmarshal the start - // element on it, if not nil. - return p.Skip() - - case reflect.Slice: - typ := v.Type() - if typ.Elem().Kind() == reflect.Uint8 { - // []byte - saveData = v - break - } - - // Slice of element values. - // Grow slice. - n := v.Len() - if n >= v.Cap() { - ncap := 2 * n - if ncap < 4 { - ncap = 4 - } - new := reflect.MakeSlice(typ, n, ncap) - reflect.Copy(new, v) - v.Set(new) - } - v.SetLen(n + 1) - - // Recur to read element into slice. - if err := p.unmarshal(v.Index(n), start); err != nil { - v.SetLen(n) - return err - } - return nil - - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.String: - saveData = v - - case reflect.Struct: - typ := v.Type() - if typ == nameType { - v.Set(reflect.ValueOf(start.Name)) - break - } - - sv = v - tinfo, err = getTypeInfo(typ) - if err != nil { - return err - } - - // Validate and assign element name. - if tinfo.xmlname != nil { - finfo := tinfo.xmlname - if finfo.name != "" && finfo.name != start.Name.Local { - return UnmarshalError("expected element type <" + finfo.name + "> but have <" + start.Name.Local + ">") - } - if finfo.xmlns != "" && finfo.xmlns != start.Name.Space { - e := "expected element <" + finfo.name + "> in name space " + finfo.xmlns + " but have " - if start.Name.Space == "" { - e += "no name space" - } else { - e += start.Name.Space - } - return UnmarshalError(e) - } - fv := finfo.value(sv) - if _, ok := fv.Interface().(Name); ok { - fv.Set(reflect.ValueOf(start.Name)) - } - } - - // Assign attributes. - // Also, determine whether we need to save character data or comments. - for i := range tinfo.fields { - finfo := &tinfo.fields[i] - switch finfo.flags & fMode { - case fAttr: - strv := finfo.value(sv) - // Look for attribute. - for _, a := range start.Attr { - if a.Name.Local == finfo.name && (finfo.xmlns == "" || finfo.xmlns == a.Name.Space) { - if err := p.unmarshalAttr(strv, a); err != nil { - return err - } - break - } - } - - case fCharData: - if !saveData.IsValid() { - saveData = finfo.value(sv) - } - - case fComment: - if !saveComment.IsValid() { - saveComment = finfo.value(sv) - } - - case fAny, fAny | fElement: - if !saveAny.IsValid() { - saveAny = finfo.value(sv) - } - - case fInnerXml: - if !saveXML.IsValid() { - saveXML = finfo.value(sv) - if p.saved == nil { - saveXMLIndex = 0 - p.saved = new(bytes.Buffer) - } else { - saveXMLIndex = p.savedOffset() - } - } - } - } - } - - // Find end element. - // Process sub-elements along the way. -Loop: - for { - var savedOffset int - if saveXML.IsValid() { - savedOffset = p.savedOffset() - } - tok, err := p.Token() - if err != nil { - return err - } - switch t := tok.(type) { - case StartElement: - consumed := false - if sv.IsValid() { - consumed, err = p.unmarshalPath(tinfo, sv, nil, &t) - if err != nil { - return err - } - if !consumed && saveAny.IsValid() { - consumed = true - if err := p.unmarshal(saveAny, &t); err != nil { - return err - } - } - } - if !consumed { - if err := p.Skip(); err != nil { - return err - } - } - - case EndElement: - if saveXML.IsValid() { - saveXMLData = p.saved.Bytes()[saveXMLIndex:savedOffset] - if saveXMLIndex == 0 { - p.saved = nil - } - } - break Loop - - case CharData: - if saveData.IsValid() { - data = append(data, t...) - } - - case Comment: - if saveComment.IsValid() { - comment = append(comment, t...) - } - } - } - - if saveData.IsValid() && saveData.CanInterface() && saveData.Type().Implements(textUnmarshalerType) { - if err := saveData.Interface().(encoding.TextUnmarshaler).UnmarshalText(data); err != nil { - return err - } - saveData = reflect.Value{} - } - - if saveData.IsValid() && saveData.CanAddr() { - pv := saveData.Addr() - if pv.CanInterface() && pv.Type().Implements(textUnmarshalerType) { - if err := pv.Interface().(encoding.TextUnmarshaler).UnmarshalText(data); err != nil { - return err - } - saveData = reflect.Value{} - } - } - - if err := copyValue(saveData, data); err != nil { - return err - } - - switch t := saveComment; t.Kind() { - case reflect.String: - t.SetString(string(comment)) - case reflect.Slice: - t.Set(reflect.ValueOf(comment)) - } - - switch t := saveXML; t.Kind() { - case reflect.String: - t.SetString(string(saveXMLData)) - case reflect.Slice: - t.Set(reflect.ValueOf(saveXMLData)) - } - - return nil -} - -func copyValue(dst reflect.Value, src []byte) (err error) { - dst0 := dst - - if dst.Kind() == reflect.Ptr { - if dst.IsNil() { - dst.Set(reflect.New(dst.Type().Elem())) - } - dst = dst.Elem() - } - - // Save accumulated data. - switch dst.Kind() { - case reflect.Invalid: - // Probably a comment. - default: - return errors.New("cannot unmarshal into " + dst0.Type().String()) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - itmp, err := strconv.ParseInt(string(src), 10, dst.Type().Bits()) - if err != nil { - return err - } - dst.SetInt(itmp) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - utmp, err := strconv.ParseUint(string(src), 10, dst.Type().Bits()) - if err != nil { - return err - } - dst.SetUint(utmp) - case reflect.Float32, reflect.Float64: - ftmp, err := strconv.ParseFloat(string(src), dst.Type().Bits()) - if err != nil { - return err - } - dst.SetFloat(ftmp) - case reflect.Bool: - value, err := strconv.ParseBool(strings.TrimSpace(string(src))) - if err != nil { - return err - } - dst.SetBool(value) - case reflect.String: - dst.SetString(string(src)) - case reflect.Slice: - if len(src) == 0 { - // non-nil to flag presence - src = []byte{} - } - dst.SetBytes(src) - } - return nil -} - -// unmarshalPath walks down an XML structure looking for wanted -// paths, and calls unmarshal on them. -// The consumed result tells whether XML elements have been consumed -// from the Decoder until start's matching end element, or if it's -// still untouched because start is uninteresting for sv's fields. -func (p *Decoder) unmarshalPath(tinfo *typeInfo, sv reflect.Value, parents []string, start *StartElement) (consumed bool, err error) { - recurse := false -Loop: - for i := range tinfo.fields { - finfo := &tinfo.fields[i] - if finfo.flags&fElement == 0 || len(finfo.parents) < len(parents) || finfo.xmlns != "" && finfo.xmlns != start.Name.Space { - continue - } - for j := range parents { - if parents[j] != finfo.parents[j] { - continue Loop - } - } - if len(finfo.parents) == len(parents) && finfo.name == start.Name.Local { - // It's a perfect match, unmarshal the field. - return true, p.unmarshal(finfo.value(sv), start) - } - if len(finfo.parents) > len(parents) && finfo.parents[len(parents)] == start.Name.Local { - // It's a prefix for the field. Break and recurse - // since it's not ok for one field path to be itself - // the prefix for another field path. - recurse = true - - // We can reuse the same slice as long as we - // don't try to append to it. - parents = finfo.parents[:len(parents)+1] - break - } - } - if !recurse { - // We have no business with this element. - return false, nil - } - // The element is not a perfect match for any field, but one - // or more fields have the path to this element as a parent - // prefix. Recurse and attempt to match these. - for { - var tok Token - tok, err = p.Token() - if err != nil { - return true, err - } - switch t := tok.(type) { - case StartElement: - consumed2, err := p.unmarshalPath(tinfo, sv, parents, &t) - if err != nil { - return true, err - } - if !consumed2 { - if err := p.Skip(); err != nil { - return true, err - } - } - case EndElement: - return true, nil - } - } -} - -// Skip reads tokens until it has consumed the end element -// matching the most recent start element already consumed. -// It recurs if it encounters a start element, so it can be used to -// skip nested structures. -// It returns nil if it finds an end element matching the start -// element; otherwise it returns an error describing the problem. -func (d *Decoder) Skip() error { - for { - tok, err := d.Token() - if err != nil { - return err - } - switch tok.(type) { - case StartElement: - if err := d.Skip(); err != nil { - return err - } - case EndElement: - return nil - } - } -} diff --git a/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go b/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go deleted file mode 100644 index fdde288bc..000000000 --- a/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xml - -import ( - "fmt" - "reflect" - "strings" - "sync" -) - -// typeInfo holds details for the xml representation of a type. -type typeInfo struct { - xmlname *fieldInfo - fields []fieldInfo -} - -// fieldInfo holds details for the xml representation of a single field. -type fieldInfo struct { - idx []int - name string - xmlns string - flags fieldFlags - parents []string -} - -type fieldFlags int - -const ( - fElement fieldFlags = 1 << iota - fAttr - fCharData - fInnerXml - fComment - fAny - - fOmitEmpty - - fMode = fElement | fAttr | fCharData | fInnerXml | fComment | fAny -) - -var tinfoMap = make(map[reflect.Type]*typeInfo) -var tinfoLock sync.RWMutex - -var nameType = reflect.TypeOf(Name{}) - -// getTypeInfo returns the typeInfo structure with details necessary -// for marshalling and unmarshalling typ. -func getTypeInfo(typ reflect.Type) (*typeInfo, error) { - tinfoLock.RLock() - tinfo, ok := tinfoMap[typ] - tinfoLock.RUnlock() - if ok { - return tinfo, nil - } - tinfo = &typeInfo{} - if typ.Kind() == reflect.Struct && typ != nameType { - n := typ.NumField() - for i := 0; i < n; i++ { - f := typ.Field(i) - if f.PkgPath != "" || f.Tag.Get("xml") == "-" { - continue // Private field - } - - // For embedded structs, embed its fields. - if f.Anonymous { - t := f.Type - if t.Kind() == reflect.Ptr { - t = t.Elem() - } - if t.Kind() == reflect.Struct { - inner, err := getTypeInfo(t) - if err != nil { - return nil, err - } - if tinfo.xmlname == nil { - tinfo.xmlname = inner.xmlname - } - for _, finfo := range inner.fields { - finfo.idx = append([]int{i}, finfo.idx...) - if err := addFieldInfo(typ, tinfo, &finfo); err != nil { - return nil, err - } - } - continue - } - } - - finfo, err := structFieldInfo(typ, &f) - if err != nil { - return nil, err - } - - if f.Name == "XMLName" { - tinfo.xmlname = finfo - continue - } - - // Add the field if it doesn't conflict with other fields. - if err := addFieldInfo(typ, tinfo, finfo); err != nil { - return nil, err - } - } - } - tinfoLock.Lock() - tinfoMap[typ] = tinfo - tinfoLock.Unlock() - return tinfo, nil -} - -// structFieldInfo builds and returns a fieldInfo for f. -func structFieldInfo(typ reflect.Type, f *reflect.StructField) (*fieldInfo, error) { - finfo := &fieldInfo{idx: f.Index} - - // Split the tag from the xml namespace if necessary. - tag := f.Tag.Get("xml") - if i := strings.Index(tag, " "); i >= 0 { - finfo.xmlns, tag = tag[:i], tag[i+1:] - } - - // Parse flags. - tokens := strings.Split(tag, ",") - if len(tokens) == 1 { - finfo.flags = fElement - } else { - tag = tokens[0] - for _, flag := range tokens[1:] { - switch flag { - case "attr": - finfo.flags |= fAttr - case "chardata": - finfo.flags |= fCharData - case "innerxml": - finfo.flags |= fInnerXml - case "comment": - finfo.flags |= fComment - case "any": - finfo.flags |= fAny - case "omitempty": - finfo.flags |= fOmitEmpty - } - } - - // Validate the flags used. - valid := true - switch mode := finfo.flags & fMode; mode { - case 0: - finfo.flags |= fElement - case fAttr, fCharData, fInnerXml, fComment, fAny: - if f.Name == "XMLName" || tag != "" && mode != fAttr { - valid = false - } - default: - // This will also catch multiple modes in a single field. - valid = false - } - if finfo.flags&fMode == fAny { - finfo.flags |= fElement - } - if finfo.flags&fOmitEmpty != 0 && finfo.flags&(fElement|fAttr) == 0 { - valid = false - } - if !valid { - return nil, fmt.Errorf("xml: invalid tag in field %s of type %s: %q", - f.Name, typ, f.Tag.Get("xml")) - } - } - - // Use of xmlns without a name is not allowed. - if finfo.xmlns != "" && tag == "" { - return nil, fmt.Errorf("xml: namespace without name in field %s of type %s: %q", - f.Name, typ, f.Tag.Get("xml")) - } - - if f.Name == "XMLName" { - // The XMLName field records the XML element name. Don't - // process it as usual because its name should default to - // empty rather than to the field name. - finfo.name = tag - return finfo, nil - } - - if tag == "" { - // If the name part of the tag is completely empty, get - // default from XMLName of underlying struct if feasible, - // or field name otherwise. - if xmlname := lookupXMLName(f.Type); xmlname != nil { - finfo.xmlns, finfo.name = xmlname.xmlns, xmlname.name - } else { - finfo.name = f.Name - } - return finfo, nil - } - - if finfo.xmlns == "" && finfo.flags&fAttr == 0 { - // If it's an element no namespace specified, get the default - // from the XMLName of enclosing struct if possible. - if xmlname := lookupXMLName(typ); xmlname != nil { - finfo.xmlns = xmlname.xmlns - } - } - - // Prepare field name and parents. - parents := strings.Split(tag, ">") - if parents[0] == "" { - parents[0] = f.Name - } - if parents[len(parents)-1] == "" { - return nil, fmt.Errorf("xml: trailing '>' in field %s of type %s", f.Name, typ) - } - finfo.name = parents[len(parents)-1] - if len(parents) > 1 { - if (finfo.flags & fElement) == 0 { - return nil, fmt.Errorf("xml: %s chain not valid with %s flag", tag, strings.Join(tokens[1:], ",")) - } - finfo.parents = parents[:len(parents)-1] - } - - // If the field type has an XMLName field, the names must match - // so that the behavior of both marshalling and unmarshalling - // is straightforward and unambiguous. - if finfo.flags&fElement != 0 { - ftyp := f.Type - xmlname := lookupXMLName(ftyp) - if xmlname != nil && xmlname.name != finfo.name { - return nil, fmt.Errorf("xml: name %q in tag of %s.%s conflicts with name %q in %s.XMLName", - finfo.name, typ, f.Name, xmlname.name, ftyp) - } - } - return finfo, nil -} - -// lookupXMLName returns the fieldInfo for typ's XMLName field -// in case it exists and has a valid xml field tag, otherwise -// it returns nil. -func lookupXMLName(typ reflect.Type) (xmlname *fieldInfo) { - for typ.Kind() == reflect.Ptr { - typ = typ.Elem() - } - if typ.Kind() != reflect.Struct { - return nil - } - for i, n := 0, typ.NumField(); i < n; i++ { - f := typ.Field(i) - if f.Name != "XMLName" { - continue - } - finfo, err := structFieldInfo(typ, &f) - if finfo.name != "" && err == nil { - return finfo - } - // Also consider errors as a non-existent field tag - // and let getTypeInfo itself report the error. - break - } - return nil -} - -func min(a, b int) int { - if a <= b { - return a - } - return b -} - -// addFieldInfo adds finfo to tinfo.fields if there are no -// conflicts, or if conflicts arise from previous fields that were -// obtained from deeper embedded structures than finfo. In the latter -// case, the conflicting entries are dropped. -// A conflict occurs when the path (parent + name) to a field is -// itself a prefix of another path, or when two paths match exactly. -// It is okay for field paths to share a common, shorter prefix. -func addFieldInfo(typ reflect.Type, tinfo *typeInfo, newf *fieldInfo) error { - var conflicts []int -Loop: - // First, figure all conflicts. Most working code will have none. - for i := range tinfo.fields { - oldf := &tinfo.fields[i] - if oldf.flags&fMode != newf.flags&fMode { - continue - } - if oldf.xmlns != "" && newf.xmlns != "" && oldf.xmlns != newf.xmlns { - continue - } - minl := min(len(newf.parents), len(oldf.parents)) - for p := 0; p < minl; p++ { - if oldf.parents[p] != newf.parents[p] { - continue Loop - } - } - if len(oldf.parents) > len(newf.parents) { - if oldf.parents[len(newf.parents)] == newf.name { - conflicts = append(conflicts, i) - } - } else if len(oldf.parents) < len(newf.parents) { - if newf.parents[len(oldf.parents)] == oldf.name { - conflicts = append(conflicts, i) - } - } else { - if newf.name == oldf.name { - conflicts = append(conflicts, i) - } - } - } - // Without conflicts, add the new field and return. - if conflicts == nil { - tinfo.fields = append(tinfo.fields, *newf) - return nil - } - - // If any conflict is shallower, ignore the new field. - // This matches the Go field resolution on embedding. - for _, i := range conflicts { - if len(tinfo.fields[i].idx) < len(newf.idx) { - return nil - } - } - - // Otherwise, if any of them is at the same depth level, it's an error. - for _, i := range conflicts { - oldf := &tinfo.fields[i] - if len(oldf.idx) == len(newf.idx) { - f1 := typ.FieldByIndex(oldf.idx) - f2 := typ.FieldByIndex(newf.idx) - return &TagPathError{typ, f1.Name, f1.Tag.Get("xml"), f2.Name, f2.Tag.Get("xml")} - } - } - - // Otherwise, the new field is shallower, and thus takes precedence, - // so drop the conflicting fields from tinfo and append the new one. - for c := len(conflicts) - 1; c >= 0; c-- { - i := conflicts[c] - copy(tinfo.fields[i:], tinfo.fields[i+1:]) - tinfo.fields = tinfo.fields[:len(tinfo.fields)-1] - } - tinfo.fields = append(tinfo.fields, *newf) - return nil -} - -// A TagPathError represents an error in the unmarshalling process -// caused by the use of field tags with conflicting paths. -type TagPathError struct { - Struct reflect.Type - Field1, Tag1 string - Field2, Tag2 string -} - -func (e *TagPathError) Error() string { - return fmt.Sprintf("%s field %q with tag %q conflicts with field %q with tag %q", e.Struct, e.Field1, e.Tag1, e.Field2, e.Tag2) -} - -// value returns v's field value corresponding to finfo. -// It's equivalent to v.FieldByIndex(finfo.idx), but initializes -// and dereferences pointers as necessary. -func (finfo *fieldInfo) value(v reflect.Value) reflect.Value { - for i, x := range finfo.idx { - if i > 0 { - t := v.Type() - if t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct { - if v.IsNil() { - v.Set(reflect.New(v.Type().Elem())) - } - v = v.Elem() - } - } - v = v.Field(x) - } - return v -} diff --git a/vendor/golang.org/x/net/webdav/internal/xml/xml.go b/vendor/golang.org/x/net/webdav/internal/xml/xml.go deleted file mode 100644 index 7d88dac7b..000000000 --- a/vendor/golang.org/x/net/webdav/internal/xml/xml.go +++ /dev/null @@ -1,1998 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package xml implements a simple XML 1.0 parser that -// understands XML name spaces. -package xml - -// References: -// Annotated XML spec: http://www.xml.com/axml/testaxml.htm -// XML name spaces: http://www.w3.org/TR/REC-xml-names/ - -// TODO(rsc): -// Test error handling. - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io" - "strconv" - "strings" - "unicode" - "unicode/utf8" -) - -// A SyntaxError represents a syntax error in the XML input stream. -type SyntaxError struct { - Msg string - Line int -} - -func (e *SyntaxError) Error() string { - return "XML syntax error on line " + strconv.Itoa(e.Line) + ": " + e.Msg -} - -// A Name represents an XML name (Local) annotated with a name space -// identifier (Space). In tokens returned by Decoder.Token, the Space -// identifier is given as a canonical URL, not the short prefix used in -// the document being parsed. -// -// As a special case, XML namespace declarations will use the literal -// string "xmlns" for the Space field instead of the fully resolved URL. -// See Encoder.EncodeToken for more information on namespace encoding -// behaviour. -type Name struct { - Space, Local string -} - -// isNamespace reports whether the name is a namespace-defining name. -func (name Name) isNamespace() bool { - return name.Local == "xmlns" || name.Space == "xmlns" -} - -// An Attr represents an attribute in an XML element (Name=Value). -type Attr struct { - Name Name - Value string -} - -// A Token is an interface holding one of the token types: -// StartElement, EndElement, CharData, Comment, ProcInst, or Directive. -type Token interface{} - -// A StartElement represents an XML start element. -type StartElement struct { - Name Name - Attr []Attr -} - -func (e StartElement) Copy() StartElement { - attrs := make([]Attr, len(e.Attr)) - copy(attrs, e.Attr) - e.Attr = attrs - return e -} - -// End returns the corresponding XML end element. -func (e StartElement) End() EndElement { - return EndElement{e.Name} -} - -// setDefaultNamespace sets the namespace of the element -// as the default for all elements contained within it. -func (e *StartElement) setDefaultNamespace() { - if e.Name.Space == "" { - // If there's no namespace on the element, don't - // set the default. Strictly speaking this might be wrong, as - // we can't tell if the element had no namespace set - // or was just using the default namespace. - return - } - // Don't add a default name space if there's already one set. - for _, attr := range e.Attr { - if attr.Name.Space == "" && attr.Name.Local == "xmlns" { - return - } - } - e.Attr = append(e.Attr, Attr{ - Name: Name{ - Local: "xmlns", - }, - Value: e.Name.Space, - }) -} - -// An EndElement represents an XML end element. -type EndElement struct { - Name Name -} - -// A CharData represents XML character data (raw text), -// in which XML escape sequences have been replaced by -// the characters they represent. -type CharData []byte - -func makeCopy(b []byte) []byte { - b1 := make([]byte, len(b)) - copy(b1, b) - return b1 -} - -func (c CharData) Copy() CharData { return CharData(makeCopy(c)) } - -// A Comment represents an XML comment of the form . -// The bytes do not include the comment markers. -type Comment []byte - -func (c Comment) Copy() Comment { return Comment(makeCopy(c)) } - -// A ProcInst represents an XML processing instruction of the form -type ProcInst struct { - Target string - Inst []byte -} - -func (p ProcInst) Copy() ProcInst { - p.Inst = makeCopy(p.Inst) - return p -} - -// A Directive represents an XML directive of the form . -// The bytes do not include the markers. -type Directive []byte - -func (d Directive) Copy() Directive { return Directive(makeCopy(d)) } - -// CopyToken returns a copy of a Token. -func CopyToken(t Token) Token { - switch v := t.(type) { - case CharData: - return v.Copy() - case Comment: - return v.Copy() - case Directive: - return v.Copy() - case ProcInst: - return v.Copy() - case StartElement: - return v.Copy() - } - return t -} - -// A Decoder represents an XML parser reading a particular input stream. -// The parser assumes that its input is encoded in UTF-8. -type Decoder struct { - // Strict defaults to true, enforcing the requirements - // of the XML specification. - // If set to false, the parser allows input containing common - // mistakes: - // * If an element is missing an end tag, the parser invents - // end tags as necessary to keep the return values from Token - // properly balanced. - // * In attribute values and character data, unknown or malformed - // character entities (sequences beginning with &) are left alone. - // - // Setting: - // - // d.Strict = false; - // d.AutoClose = HTMLAutoClose; - // d.Entity = HTMLEntity - // - // creates a parser that can handle typical HTML. - // - // Strict mode does not enforce the requirements of the XML name spaces TR. - // In particular it does not reject name space tags using undefined prefixes. - // Such tags are recorded with the unknown prefix as the name space URL. - Strict bool - - // When Strict == false, AutoClose indicates a set of elements to - // consider closed immediately after they are opened, regardless - // of whether an end element is present. - AutoClose []string - - // Entity can be used to map non-standard entity names to string replacements. - // The parser behaves as if these standard mappings are present in the map, - // regardless of the actual map content: - // - // "lt": "<", - // "gt": ">", - // "amp": "&", - // "apos": "'", - // "quot": `"`, - Entity map[string]string - - // CharsetReader, if non-nil, defines a function to generate - // charset-conversion readers, converting from the provided - // non-UTF-8 charset into UTF-8. If CharsetReader is nil or - // returns an error, parsing stops with an error. One of the - // the CharsetReader's result values must be non-nil. - CharsetReader func(charset string, input io.Reader) (io.Reader, error) - - // DefaultSpace sets the default name space used for unadorned tags, - // as if the entire XML stream were wrapped in an element containing - // the attribute xmlns="DefaultSpace". - DefaultSpace string - - r io.ByteReader - buf bytes.Buffer - saved *bytes.Buffer - stk *stack - free *stack - needClose bool - toClose Name - nextToken Token - nextByte int - ns map[string]string - err error - line int - offset int64 - unmarshalDepth int -} - -// NewDecoder creates a new XML parser reading from r. -// If r does not implement io.ByteReader, NewDecoder will -// do its own buffering. -func NewDecoder(r io.Reader) *Decoder { - d := &Decoder{ - ns: make(map[string]string), - nextByte: -1, - line: 1, - Strict: true, - } - d.switchToReader(r) - return d -} - -// Token returns the next XML token in the input stream. -// At the end of the input stream, Token returns nil, io.EOF. -// -// Slices of bytes in the returned token data refer to the -// parser's internal buffer and remain valid only until the next -// call to Token. To acquire a copy of the bytes, call CopyToken -// or the token's Copy method. -// -// Token expands self-closing elements such as
-// into separate start and end elements returned by successive calls. -// -// Token guarantees that the StartElement and EndElement -// tokens it returns are properly nested and matched: -// if Token encounters an unexpected end element, -// it will return an error. -// -// Token implements XML name spaces as described by -// http://www.w3.org/TR/REC-xml-names/. Each of the -// Name structures contained in the Token has the Space -// set to the URL identifying its name space when known. -// If Token encounters an unrecognized name space prefix, -// it uses the prefix as the Space rather than report an error. -func (d *Decoder) Token() (t Token, err error) { - if d.stk != nil && d.stk.kind == stkEOF { - err = io.EOF - return - } - if d.nextToken != nil { - t = d.nextToken - d.nextToken = nil - } else if t, err = d.rawToken(); err != nil { - return - } - - if !d.Strict { - if t1, ok := d.autoClose(t); ok { - d.nextToken = t - t = t1 - } - } - switch t1 := t.(type) { - case StartElement: - // In XML name spaces, the translations listed in the - // attributes apply to the element name and - // to the other attribute names, so process - // the translations first. - for _, a := range t1.Attr { - if a.Name.Space == "xmlns" { - v, ok := d.ns[a.Name.Local] - d.pushNs(a.Name.Local, v, ok) - d.ns[a.Name.Local] = a.Value - } - if a.Name.Space == "" && a.Name.Local == "xmlns" { - // Default space for untagged names - v, ok := d.ns[""] - d.pushNs("", v, ok) - d.ns[""] = a.Value - } - } - - d.translate(&t1.Name, true) - for i := range t1.Attr { - d.translate(&t1.Attr[i].Name, false) - } - d.pushElement(t1.Name) - t = t1 - - case EndElement: - d.translate(&t1.Name, true) - if !d.popElement(&t1) { - return nil, d.err - } - t = t1 - } - return -} - -const xmlURL = "http://www.w3.org/XML/1998/namespace" - -// Apply name space translation to name n. -// The default name space (for Space=="") -// applies only to element names, not to attribute names. -func (d *Decoder) translate(n *Name, isElementName bool) { - switch { - case n.Space == "xmlns": - return - case n.Space == "" && !isElementName: - return - case n.Space == "xml": - n.Space = xmlURL - case n.Space == "" && n.Local == "xmlns": - return - } - if v, ok := d.ns[n.Space]; ok { - n.Space = v - } else if n.Space == "" { - n.Space = d.DefaultSpace - } -} - -func (d *Decoder) switchToReader(r io.Reader) { - // Get efficient byte at a time reader. - // Assume that if reader has its own - // ReadByte, it's efficient enough. - // Otherwise, use bufio. - if rb, ok := r.(io.ByteReader); ok { - d.r = rb - } else { - d.r = bufio.NewReader(r) - } -} - -// Parsing state - stack holds old name space translations -// and the current set of open elements. The translations to pop when -// ending a given tag are *below* it on the stack, which is -// more work but forced on us by XML. -type stack struct { - next *stack - kind int - name Name - ok bool -} - -const ( - stkStart = iota - stkNs - stkEOF -) - -func (d *Decoder) push(kind int) *stack { - s := d.free - if s != nil { - d.free = s.next - } else { - s = new(stack) - } - s.next = d.stk - s.kind = kind - d.stk = s - return s -} - -func (d *Decoder) pop() *stack { - s := d.stk - if s != nil { - d.stk = s.next - s.next = d.free - d.free = s - } - return s -} - -// Record that after the current element is finished -// (that element is already pushed on the stack) -// Token should return EOF until popEOF is called. -func (d *Decoder) pushEOF() { - // Walk down stack to find Start. - // It might not be the top, because there might be stkNs - // entries above it. - start := d.stk - for start.kind != stkStart { - start = start.next - } - // The stkNs entries below a start are associated with that - // element too; skip over them. - for start.next != nil && start.next.kind == stkNs { - start = start.next - } - s := d.free - if s != nil { - d.free = s.next - } else { - s = new(stack) - } - s.kind = stkEOF - s.next = start.next - start.next = s -} - -// Undo a pushEOF. -// The element must have been finished, so the EOF should be at the top of the stack. -func (d *Decoder) popEOF() bool { - if d.stk == nil || d.stk.kind != stkEOF { - return false - } - d.pop() - return true -} - -// Record that we are starting an element with the given name. -func (d *Decoder) pushElement(name Name) { - s := d.push(stkStart) - s.name = name -} - -// Record that we are changing the value of ns[local]. -// The old value is url, ok. -func (d *Decoder) pushNs(local string, url string, ok bool) { - s := d.push(stkNs) - s.name.Local = local - s.name.Space = url - s.ok = ok -} - -// Creates a SyntaxError with the current line number. -func (d *Decoder) syntaxError(msg string) error { - return &SyntaxError{Msg: msg, Line: d.line} -} - -// Record that we are ending an element with the given name. -// The name must match the record at the top of the stack, -// which must be a pushElement record. -// After popping the element, apply any undo records from -// the stack to restore the name translations that existed -// before we saw this element. -func (d *Decoder) popElement(t *EndElement) bool { - s := d.pop() - name := t.Name - switch { - case s == nil || s.kind != stkStart: - d.err = d.syntaxError("unexpected end element ") - return false - case s.name.Local != name.Local: - if !d.Strict { - d.needClose = true - d.toClose = t.Name - t.Name = s.name - return true - } - d.err = d.syntaxError("element <" + s.name.Local + "> closed by ") - return false - case s.name.Space != name.Space: - d.err = d.syntaxError("element <" + s.name.Local + "> in space " + s.name.Space + - "closed by in space " + name.Space) - return false - } - - // Pop stack until a Start or EOF is on the top, undoing the - // translations that were associated with the element we just closed. - for d.stk != nil && d.stk.kind != stkStart && d.stk.kind != stkEOF { - s := d.pop() - if s.ok { - d.ns[s.name.Local] = s.name.Space - } else { - delete(d.ns, s.name.Local) - } - } - - return true -} - -// If the top element on the stack is autoclosing and -// t is not the end tag, invent the end tag. -func (d *Decoder) autoClose(t Token) (Token, bool) { - if d.stk == nil || d.stk.kind != stkStart { - return nil, false - } - name := strings.ToLower(d.stk.name.Local) - for _, s := range d.AutoClose { - if strings.ToLower(s) == name { - // This one should be auto closed if t doesn't close it. - et, ok := t.(EndElement) - if !ok || et.Name.Local != name { - return EndElement{d.stk.name}, true - } - break - } - } - return nil, false -} - -var errRawToken = errors.New("xml: cannot use RawToken from UnmarshalXML method") - -// RawToken is like Token but does not verify that -// start and end elements match and does not translate -// name space prefixes to their corresponding URLs. -func (d *Decoder) RawToken() (Token, error) { - if d.unmarshalDepth > 0 { - return nil, errRawToken - } - return d.rawToken() -} - -func (d *Decoder) rawToken() (Token, error) { - if d.err != nil { - return nil, d.err - } - if d.needClose { - // The last element we read was self-closing and - // we returned just the StartElement half. - // Return the EndElement half now. - d.needClose = false - return EndElement{d.toClose}, nil - } - - b, ok := d.getc() - if !ok { - return nil, d.err - } - - if b != '<' { - // Text section. - d.ungetc(b) - data := d.text(-1, false) - if data == nil { - return nil, d.err - } - return CharData(data), nil - } - - if b, ok = d.mustgetc(); !ok { - return nil, d.err - } - switch b { - case '/': - // ' { - d.err = d.syntaxError("invalid characters between ") - return nil, d.err - } - return EndElement{name}, nil - - case '?': - // ' { - break - } - b0 = b - } - data := d.buf.Bytes() - data = data[0 : len(data)-2] // chop ?> - - if target == "xml" { - content := string(data) - ver := procInst("version", content) - if ver != "" && ver != "1.0" { - d.err = fmt.Errorf("xml: unsupported version %q; only version 1.0 is supported", ver) - return nil, d.err - } - enc := procInst("encoding", content) - if enc != "" && enc != "utf-8" && enc != "UTF-8" { - if d.CharsetReader == nil { - d.err = fmt.Errorf("xml: encoding %q declared but Decoder.CharsetReader is nil", enc) - return nil, d.err - } - newr, err := d.CharsetReader(enc, d.r.(io.Reader)) - if err != nil { - d.err = fmt.Errorf("xml: opening charset %q: %v", enc, err) - return nil, d.err - } - if newr == nil { - panic("CharsetReader returned a nil Reader for charset " + enc) - } - d.switchToReader(newr) - } - } - return ProcInst{target, data}, nil - - case '!': - // ' { - break - } - b0, b1 = b1, b - } - data := d.buf.Bytes() - data = data[0 : len(data)-3] // chop --> - return Comment(data), nil - - case '[': // . - data := d.text(-1, true) - if data == nil { - return nil, d.err - } - return CharData(data), nil - } - - // Probably a directive: , , etc. - // We don't care, but accumulate for caller. Quoted angle - // brackets do not count for nesting. - d.buf.Reset() - d.buf.WriteByte(b) - inquote := uint8(0) - depth := 0 - for { - if b, ok = d.mustgetc(); !ok { - return nil, d.err - } - if inquote == 0 && b == '>' && depth == 0 { - break - } - HandleB: - d.buf.WriteByte(b) - switch { - case b == inquote: - inquote = 0 - - case inquote != 0: - // in quotes, no special action - - case b == '\'' || b == '"': - inquote = b - - case b == '>' && inquote == 0: - depth-- - - case b == '<' && inquote == 0: - // Look for RefID = 4, RefName = "" (inside []) - RefID int64 - // RefName is the reference name for the entity that gets referenced in the event. - RefName string - // RefType indicates the referenced entity type, i.e Channel or SubChannel. - RefType RefChannelType -} - -// Channel is the interface that should be satisfied in order to be tracked by -// channelz as Channel or SubChannel. -type Channel interface { - ChannelzMetric() *ChannelInternalMetric -} - -type dummyChannel struct{} - -func (d *dummyChannel) ChannelzMetric() *ChannelInternalMetric { - return &ChannelInternalMetric{} -} - -type channel struct { - refName string - c Channel - closeCalled bool - nestedChans map[int64]string - subChans map[int64]string - id int64 - pid int64 - cm *channelMap - trace *channelTrace - // traceRefCount is the number of trace events that reference this channel. - // Non-zero traceRefCount means the trace of this channel cannot be deleted. - traceRefCount int32 -} - -func (c *channel) addChild(id int64, e entry) { - switch v := e.(type) { - case *subChannel: - c.subChans[id] = v.refName - case *channel: - c.nestedChans[id] = v.refName - default: - grpclog.Errorf("cannot add a child (id = %d) of type %T to a channel", id, e) - } -} - -func (c *channel) deleteChild(id int64) { - delete(c.subChans, id) - delete(c.nestedChans, id) - c.deleteSelfIfReady() -} - -func (c *channel) triggerDelete() { - c.closeCalled = true - c.deleteSelfIfReady() -} - -func (c *channel) getParentID() int64 { - return c.pid -} - -// deleteSelfFromTree tries to delete the channel from the channelz entry relation tree, which means -// deleting the channel reference from its parent's child list. -// -// In order for a channel to be deleted from the tree, it must meet the criteria that, removal of the -// corresponding grpc object has been invoked, and the channel does not have any children left. -// -// The returned boolean value indicates whether the channel has been successfully deleted from tree. -func (c *channel) deleteSelfFromTree() (deleted bool) { - if !c.closeCalled || len(c.subChans)+len(c.nestedChans) != 0 { - return false - } - // not top channel - if c.pid != 0 { - c.cm.findEntry(c.pid).deleteChild(c.id) - } - return true -} - -// deleteSelfFromMap checks whether it is valid to delete the channel from the map, which means -// deleting the channel from channelz's tracking entirely. Users can no longer use id to query the -// channel, and its memory will be garbage collected. -// -// The trace reference count of the channel must be 0 in order to be deleted from the map. This is -// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, -// the trace of the referenced entity must not be deleted. In order to release the resource allocated -// by grpc, the reference to the grpc object is reset to a dummy object. -// -// deleteSelfFromMap must be called after deleteSelfFromTree returns true. -// -// It returns a bool to indicate whether the channel can be safely deleted from map. -func (c *channel) deleteSelfFromMap() (delete bool) { - if c.getTraceRefCount() != 0 { - c.c = &dummyChannel{} - return false - } - return true -} - -// deleteSelfIfReady tries to delete the channel itself from the channelz database. -// The delete process includes two steps: -// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its -// parent's child list. -// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id -// will return entry not found error. -func (c *channel) deleteSelfIfReady() { - if !c.deleteSelfFromTree() { - return - } - if !c.deleteSelfFromMap() { - return - } - c.cm.deleteEntry(c.id) - c.trace.clear() -} - -func (c *channel) getChannelTrace() *channelTrace { - return c.trace -} - -func (c *channel) incrTraceRefCount() { - atomic.AddInt32(&c.traceRefCount, 1) -} - -func (c *channel) decrTraceRefCount() { - atomic.AddInt32(&c.traceRefCount, -1) -} - -func (c *channel) getTraceRefCount() int { - i := atomic.LoadInt32(&c.traceRefCount) - return int(i) -} - -func (c *channel) getRefName() string { - return c.refName -} - -type subChannel struct { - refName string - c Channel - closeCalled bool - sockets map[int64]string - id int64 - pid int64 - cm *channelMap - trace *channelTrace - traceRefCount int32 -} - -func (sc *subChannel) addChild(id int64, e entry) { - if v, ok := e.(*normalSocket); ok { - sc.sockets[id] = v.refName - } else { - grpclog.Errorf("cannot add a child (id = %d) of type %T to a subChannel", id, e) - } -} - -func (sc *subChannel) deleteChild(id int64) { - delete(sc.sockets, id) - sc.deleteSelfIfReady() -} - -func (sc *subChannel) triggerDelete() { - sc.closeCalled = true - sc.deleteSelfIfReady() -} - -func (sc *subChannel) getParentID() int64 { - return sc.pid -} - -// deleteSelfFromTree tries to delete the subchannel from the channelz entry relation tree, which -// means deleting the subchannel reference from its parent's child list. -// -// In order for a subchannel to be deleted from the tree, it must meet the criteria that, removal of -// the corresponding grpc object has been invoked, and the subchannel does not have any children left. -// -// The returned boolean value indicates whether the channel has been successfully deleted from tree. -func (sc *subChannel) deleteSelfFromTree() (deleted bool) { - if !sc.closeCalled || len(sc.sockets) != 0 { - return false - } - sc.cm.findEntry(sc.pid).deleteChild(sc.id) - return true -} - -// deleteSelfFromMap checks whether it is valid to delete the subchannel from the map, which means -// deleting the subchannel from channelz's tracking entirely. Users can no longer use id to query -// the subchannel, and its memory will be garbage collected. -// -// The trace reference count of the subchannel must be 0 in order to be deleted from the map. This is -// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, -// the trace of the referenced entity must not be deleted. In order to release the resource allocated -// by grpc, the reference to the grpc object is reset to a dummy object. -// -// deleteSelfFromMap must be called after deleteSelfFromTree returns true. -// -// It returns a bool to indicate whether the channel can be safely deleted from map. -func (sc *subChannel) deleteSelfFromMap() (delete bool) { - if sc.getTraceRefCount() != 0 { - // free the grpc struct (i.e. addrConn) - sc.c = &dummyChannel{} - return false - } - return true -} - -// deleteSelfIfReady tries to delete the subchannel itself from the channelz database. -// The delete process includes two steps: -// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from -// its parent's child list. -// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup -// by id will return entry not found error. -func (sc *subChannel) deleteSelfIfReady() { - if !sc.deleteSelfFromTree() { - return - } - if !sc.deleteSelfFromMap() { - return - } - sc.cm.deleteEntry(sc.id) - sc.trace.clear() -} - -func (sc *subChannel) getChannelTrace() *channelTrace { - return sc.trace -} - -func (sc *subChannel) incrTraceRefCount() { - atomic.AddInt32(&sc.traceRefCount, 1) -} - -func (sc *subChannel) decrTraceRefCount() { - atomic.AddInt32(&sc.traceRefCount, -1) -} - -func (sc *subChannel) getTraceRefCount() int { - i := atomic.LoadInt32(&sc.traceRefCount) - return int(i) -} - -func (sc *subChannel) getRefName() string { - return sc.refName -} - -// SocketMetric defines the info channelz provides for a specific Socket, which -// includes SocketInternalMetric and channelz-specific data, such as channelz id, etc. -type SocketMetric struct { - // ID is the channelz id of this socket. - ID int64 - // RefName is the human readable reference string of this socket. - RefName string - // SocketData contains socket internal metric reported by the socket through - // ChannelzMetric(). - SocketData *SocketInternalMetric -} - -// SocketInternalMetric defines the struct that the implementor of Socket interface -// should return from ChannelzMetric(). -type SocketInternalMetric struct { - // The number of streams that have been started. - StreamsStarted int64 - // The number of streams that have ended successfully: - // On client side, receiving frame with eos bit set. - // On server side, sending frame with eos bit set. - StreamsSucceeded int64 - // The number of streams that have ended unsuccessfully: - // On client side, termination without receiving frame with eos bit set. - // On server side, termination without sending frame with eos bit set. - StreamsFailed int64 - // The number of messages successfully sent on this socket. - MessagesSent int64 - MessagesReceived int64 - // The number of keep alives sent. This is typically implemented with HTTP/2 - // ping messages. - KeepAlivesSent int64 - // The last time a stream was created by this endpoint. Usually unset for - // servers. - LastLocalStreamCreatedTimestamp time.Time - // The last time a stream was created by the remote endpoint. Usually unset - // for clients. - LastRemoteStreamCreatedTimestamp time.Time - // The last time a message was sent by this endpoint. - LastMessageSentTimestamp time.Time - // The last time a message was received by this endpoint. - LastMessageReceivedTimestamp time.Time - // The amount of window, granted to the local endpoint by the remote endpoint. - // This may be slightly out of date due to network latency. This does NOT - // include stream level or TCP level flow control info. - LocalFlowControlWindow int64 - // The amount of window, granted to the remote endpoint by the local endpoint. - // This may be slightly out of date due to network latency. This does NOT - // include stream level or TCP level flow control info. - RemoteFlowControlWindow int64 - // The locally bound address. - LocalAddr net.Addr - // The remote bound address. May be absent. - RemoteAddr net.Addr - // Optional, represents the name of the remote endpoint, if different than - // the original target name. - RemoteName string - SocketOptions *SocketOptionData - Security credentials.ChannelzSecurityValue -} - -// Socket is the interface that should be satisfied in order to be tracked by -// channelz as Socket. -type Socket interface { - ChannelzMetric() *SocketInternalMetric -} - -type listenSocket struct { - refName string - s Socket - id int64 - pid int64 - cm *channelMap -} - -func (ls *listenSocket) addChild(id int64, e entry) { - grpclog.Errorf("cannot add a child (id = %d) of type %T to a listen socket", id, e) -} - -func (ls *listenSocket) deleteChild(id int64) { - grpclog.Errorf("cannot delete a child (id = %d) from a listen socket", id) -} - -func (ls *listenSocket) triggerDelete() { - ls.cm.deleteEntry(ls.id) - ls.cm.findEntry(ls.pid).deleteChild(ls.id) -} - -func (ls *listenSocket) deleteSelfIfReady() { - grpclog.Errorf("cannot call deleteSelfIfReady on a listen socket") -} - -func (ls *listenSocket) getParentID() int64 { - return ls.pid -} - -type normalSocket struct { - refName string - s Socket - id int64 - pid int64 - cm *channelMap -} - -func (ns *normalSocket) addChild(id int64, e entry) { - grpclog.Errorf("cannot add a child (id = %d) of type %T to a normal socket", id, e) -} - -func (ns *normalSocket) deleteChild(id int64) { - grpclog.Errorf("cannot delete a child (id = %d) from a normal socket", id) -} - -func (ns *normalSocket) triggerDelete() { - ns.cm.deleteEntry(ns.id) - ns.cm.findEntry(ns.pid).deleteChild(ns.id) -} - -func (ns *normalSocket) deleteSelfIfReady() { - grpclog.Errorf("cannot call deleteSelfIfReady on a normal socket") -} - -func (ns *normalSocket) getParentID() int64 { - return ns.pid -} - -// ServerMetric defines the info channelz provides for a specific Server, which -// includes ServerInternalMetric and channelz-specific data, such as channelz id, -// child list, etc. -type ServerMetric struct { - // ID is the channelz id of this server. - ID int64 - // RefName is the human readable reference string of this server. - RefName string - // ServerData contains server internal metric reported by the server through - // ChannelzMetric(). - ServerData *ServerInternalMetric - // ListenSockets tracks the listener socket type children of this server in the - // format of a map from socket channelz id to corresponding reference string. - ListenSockets map[int64]string -} - -// ServerInternalMetric defines the struct that the implementor of Server interface -// should return from ChannelzMetric(). -type ServerInternalMetric struct { - // The number of incoming calls started on the server. - CallsStarted int64 - // The number of incoming calls that have completed with an OK status. - CallsSucceeded int64 - // The number of incoming calls that have a completed with a non-OK status. - CallsFailed int64 - // The last time a call was started on the server. - LastCallStartedTimestamp time.Time -} - -// Server is the interface to be satisfied in order to be tracked by channelz as -// Server. -type Server interface { - ChannelzMetric() *ServerInternalMetric -} - -type server struct { - refName string - s Server - closeCalled bool - sockets map[int64]string - listenSockets map[int64]string - id int64 - cm *channelMap -} - -func (s *server) addChild(id int64, e entry) { - switch v := e.(type) { - case *normalSocket: - s.sockets[id] = v.refName - case *listenSocket: - s.listenSockets[id] = v.refName - default: - grpclog.Errorf("cannot add a child (id = %d) of type %T to a server", id, e) - } -} - -func (s *server) deleteChild(id int64) { - delete(s.sockets, id) - delete(s.listenSockets, id) - s.deleteSelfIfReady() -} - -func (s *server) triggerDelete() { - s.closeCalled = true - s.deleteSelfIfReady() -} - -func (s *server) deleteSelfIfReady() { - if !s.closeCalled || len(s.sockets)+len(s.listenSockets) != 0 { - return - } - s.cm.deleteEntry(s.id) -} - -func (s *server) getParentID() int64 { - return 0 -} - -type tracedChannel interface { - getChannelTrace() *channelTrace - incrTraceRefCount() - decrTraceRefCount() - getRefName() string -} - -type channelTrace struct { - cm *channelMap - createdTime time.Time - eventCount int64 - mu sync.Mutex - events []*TraceEvent -} - -func (c *channelTrace) append(e *TraceEvent) { - c.mu.Lock() - if len(c.events) == getMaxTraceEntry() { - del := c.events[0] - c.events = c.events[1:] - if del.RefID != 0 { - // start recursive cleanup in a goroutine to not block the call originated from grpc. - go func() { - // need to acquire c.cm.mu lock to call the unlocked attemptCleanup func. - c.cm.mu.Lock() - c.cm.decrTraceRefCount(del.RefID) - c.cm.mu.Unlock() - }() - } - } - e.Timestamp = time.Now() - c.events = append(c.events, e) - c.eventCount++ - c.mu.Unlock() -} - -func (c *channelTrace) clear() { - c.mu.Lock() - for _, e := range c.events { - if e.RefID != 0 { - // caller should have already held the c.cm.mu lock. - c.cm.decrTraceRefCount(e.RefID) - } - } - c.mu.Unlock() -} - -// Severity is the severity level of a trace event. -// The canonical enumeration of all valid values is here: -// https://github.com/grpc/grpc-proto/blob/9b13d199cc0d4703c7ea26c9c330ba695866eb23/grpc/channelz/v1/channelz.proto#L126. -type Severity int - -const ( - // CtUNKNOWN indicates unknown severity of a trace event. - CtUNKNOWN Severity = iota - // CtINFO indicates info level severity of a trace event. - CtINFO - // CtWarning indicates warning level severity of a trace event. - CtWarning - // CtError indicates error level severity of a trace event. - CtError -) - -// RefChannelType is the type of the entity being referenced in a trace event. -type RefChannelType int - -const ( - // RefChannel indicates the referenced entity is a Channel. - RefChannel RefChannelType = iota - // RefSubChannel indicates the referenced entity is a SubChannel. - RefSubChannel -) - -func (c *channelTrace) dumpData() *ChannelTrace { - c.mu.Lock() - ct := &ChannelTrace{EventNum: c.eventCount, CreationTime: c.createdTime} - ct.Events = c.events[:len(c.events)] - c.mu.Unlock() - return ct -} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_linux.go b/vendor/google.golang.org/grpc/internal/channelz/types_linux.go deleted file mode 100644 index 692dd6181..000000000 --- a/vendor/google.golang.org/grpc/internal/channelz/types_linux.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build !appengine - -/* - * - * Copyright 2018 gRPC 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 channelz - -import ( - "syscall" - - "golang.org/x/sys/unix" -) - -// SocketOptionData defines the struct to hold socket option data, and related -// getter function to obtain info from fd. -type SocketOptionData struct { - Linger *unix.Linger - RecvTimeout *unix.Timeval - SendTimeout *unix.Timeval - TCPInfo *unix.TCPInfo -} - -// Getsockopt defines the function to get socket options requested by channelz. -// It is to be passed to syscall.RawConn.Control(). -func (s *SocketOptionData) Getsockopt(fd uintptr) { - if v, err := unix.GetsockoptLinger(int(fd), syscall.SOL_SOCKET, syscall.SO_LINGER); err == nil { - s.Linger = v - } - if v, err := unix.GetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVTIMEO); err == nil { - s.RecvTimeout = v - } - if v, err := unix.GetsockoptTimeval(int(fd), syscall.SOL_SOCKET, syscall.SO_SNDTIMEO); err == nil { - s.SendTimeout = v - } - if v, err := unix.GetsockoptTCPInfo(int(fd), syscall.SOL_TCP, syscall.TCP_INFO); err == nil { - s.TCPInfo = v - } -} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go deleted file mode 100644 index 79edbefc4..000000000 --- a/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go +++ /dev/null @@ -1,44 +0,0 @@ -// +build !linux appengine - -/* - * - * Copyright 2018 gRPC 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 channelz - -import ( - "sync" - - "google.golang.org/grpc/grpclog" -) - -var once sync.Once - -// SocketOptionData defines the struct to hold socket option data, and related -// getter function to obtain info from fd. -// Windows OS doesn't support Socket Option -type SocketOptionData struct { -} - -// Getsockopt defines the function to get socket options requested by channelz. -// It is to be passed to syscall.RawConn.Control(). -// Windows OS doesn't support Socket Option -func (s *SocketOptionData) Getsockopt(fd uintptr) { - once.Do(func() { - grpclog.Warningln("Channelz: socket options are not supported on non-linux os and appengine.") - }) -} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_linux.go b/vendor/google.golang.org/grpc/internal/channelz/util_linux.go deleted file mode 100644 index fdf409d55..000000000 --- a/vendor/google.golang.org/grpc/internal/channelz/util_linux.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build linux,!appengine - -/* - * - * Copyright 2018 gRPC 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 channelz - -import ( - "syscall" -) - -// GetSocketOption gets the socket option info of the conn. -func GetSocketOption(socket interface{}) *SocketOptionData { - c, ok := socket.(syscall.Conn) - if !ok { - return nil - } - data := &SocketOptionData{} - if rawConn, err := c.SyscallConn(); err == nil { - rawConn.Control(data.Getsockopt) - return data - } - return nil -} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go deleted file mode 100644 index 8864a0811..000000000 --- a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go +++ /dev/null @@ -1,26 +0,0 @@ -// +build !linux appengine - -/* - * - * Copyright 2018 gRPC 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 channelz - -// GetSocketOption gets the socket option info of the conn. -func GetSocketOption(c interface{}) *SocketOptionData { - return nil -} diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go deleted file mode 100644 index 73931a94b..000000000 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 envconfig contains grpc settings configured by environment variables. -package envconfig - -import ( - "os" - "strings" -) - -const ( - prefix = "GRPC_GO_" - retryStr = prefix + "RETRY" - txtErrIgnoreStr = prefix + "IGNORE_TXT_ERRORS" -) - -var ( - // Retry is set if retry is explicitly enabled via "GRPC_GO_RETRY=on". - Retry = strings.EqualFold(os.Getenv(retryStr), "on") - // TXTErrIgnore is set if TXT errors should be ignored ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false"). - TXTErrIgnore = !strings.EqualFold(os.Getenv(txtErrIgnoreStr), "false") -) diff --git a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go b/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go deleted file mode 100644 index 8c8e19fce..000000000 --- a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go +++ /dev/null @@ -1,118 +0,0 @@ -/* - * - * Copyright 2020 gRPC 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 grpclog (internal) defines depth logging for grpc. -package grpclog - -// Logger is the logger used for the non-depth log functions. -var Logger LoggerV2 - -// DepthLogger is the logger used for the depth log functions. -var DepthLogger DepthLoggerV2 - -// InfoDepth logs to the INFO log at the specified depth. -func InfoDepth(depth int, args ...interface{}) { - if DepthLogger != nil { - DepthLogger.InfoDepth(depth, args...) - } else { - Logger.Info(args...) - } -} - -// WarningDepth logs to the WARNING log at the specified depth. -func WarningDepth(depth int, args ...interface{}) { - if DepthLogger != nil { - DepthLogger.WarningDepth(depth, args...) - } else { - Logger.Warning(args...) - } -} - -// ErrorDepth logs to the ERROR log at the specified depth. -func ErrorDepth(depth int, args ...interface{}) { - if DepthLogger != nil { - DepthLogger.ErrorDepth(depth, args...) - } else { - Logger.Error(args...) - } -} - -// FatalDepth logs to the FATAL log at the specified depth. -func FatalDepth(depth int, args ...interface{}) { - if DepthLogger != nil { - DepthLogger.FatalDepth(depth, args...) - } else { - Logger.Fatal(args...) - } -} - -// LoggerV2 does underlying logging work for grpclog. -// This is a copy of the LoggerV2 defined in the external grpclog package. It -// is defined here to avoid a circular dependency. -type LoggerV2 interface { - // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. - Info(args ...interface{}) - // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. - Infoln(args ...interface{}) - // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. - Infof(format string, args ...interface{}) - // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. - Warning(args ...interface{}) - // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. - Warningln(args ...interface{}) - // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. - Warningf(format string, args ...interface{}) - // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. - Error(args ...interface{}) - // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - Errorln(args ...interface{}) - // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - Errorf(format string, args ...interface{}) - // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatal(args ...interface{}) - // Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalln(args ...interface{}) - // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalf(format string, args ...interface{}) - // V reports whether verbosity level l is at least the requested verbose level. - V(l int) bool -} - -// DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements -// DepthLoggerV2, the below functions will be called with the appropriate stack -// depth set for trivial functions the logger may ignore. -// This is a copy of the DepthLoggerV2 defined in the external grpclog package. -// It is defined here to avoid a circular dependency. -// -// This API is EXPERIMENTAL. -type DepthLoggerV2 interface { - // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Print. - InfoDepth(depth int, args ...interface{}) - // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Print. - WarningDepth(depth int, args ...interface{}) - // ErrorDetph logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Print. - ErrorDepth(depth int, args ...interface{}) - // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Print. - FatalDepth(depth int, args ...interface{}) -} diff --git a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go b/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go deleted file mode 100644 index f6e0dc1da..000000000 --- a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2020 gRPC 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 grpclog - -// PrefixLogger does logging with a prefix. -// -// Logging method on a nil logs without any prefix. -type PrefixLogger struct { - prefix string -} - -// Infof does info logging. -func (pl *PrefixLogger) Infof(format string, args ...interface{}) { - if pl != nil { - // Handle nil, so the tests can pass in a nil logger. - format = pl.prefix + format - } - Logger.Infof(format, args...) -} - -// Warningf does warning logging. -func (pl *PrefixLogger) Warningf(format string, args ...interface{}) { - if pl != nil { - format = pl.prefix + format - } - Logger.Warningf(format, args...) -} - -// Errorf does error logging. -func (pl *PrefixLogger) Errorf(format string, args ...interface{}) { - if pl != nil { - format = pl.prefix + format - } - Logger.Errorf(format, args...) -} - -// Debugf does info logging at verbose level 2. -func (pl *PrefixLogger) Debugf(format string, args ...interface{}) { - if Logger.V(2) { - pl.Infof(format, args...) - } -} - -// NewPrefixLogger creates a prefix logger with the given prefix. -func NewPrefixLogger(prefix string) *PrefixLogger { - return &PrefixLogger{prefix: prefix} -} diff --git a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go deleted file mode 100644 index 200b115ca..000000000 --- a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 grpcrand implements math/rand functions in a concurrent-safe way -// with a global random source, independent of math/rand's global source. -package grpcrand - -import ( - "math/rand" - "sync" - "time" -) - -var ( - r = rand.New(rand.NewSource(time.Now().UnixNano())) - mu sync.Mutex -) - -// Int63n implements rand.Int63n on the grpcrand global source. -func Int63n(n int64) int64 { - mu.Lock() - res := r.Int63n(n) - mu.Unlock() - return res -} - -// Intn implements rand.Intn on the grpcrand global source. -func Intn(n int) int { - mu.Lock() - res := r.Intn(n) - mu.Unlock() - return res -} - -// Float64 implements rand.Float64 on the grpcrand global source. -func Float64() float64 { - mu.Lock() - res := r.Float64() - mu.Unlock() - return res -} diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/event.go b/vendor/google.golang.org/grpc/internal/grpcsync/event.go deleted file mode 100644 index fbe697c37..000000000 --- a/vendor/google.golang.org/grpc/internal/grpcsync/event.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 grpcsync implements additional synchronization primitives built upon -// the sync package. -package grpcsync - -import ( - "sync" - "sync/atomic" -) - -// Event represents a one-time event that may occur in the future. -type Event struct { - fired int32 - c chan struct{} - o sync.Once -} - -// Fire causes e to complete. It is safe to call multiple times, and -// concurrently. It returns true iff this call to Fire caused the signaling -// channel returned by Done to close. -func (e *Event) Fire() bool { - ret := false - e.o.Do(func() { - atomic.StoreInt32(&e.fired, 1) - close(e.c) - ret = true - }) - return ret -} - -// Done returns a channel that will be closed when Fire is called. -func (e *Event) Done() <-chan struct{} { - return e.c -} - -// HasFired returns true if Fire has been called. -func (e *Event) HasFired() bool { - return atomic.LoadInt32(&e.fired) == 1 -} - -// NewEvent returns a new, ready-to-use Event. -func NewEvent() *Event { - return &Event{c: make(chan struct{})} -} diff --git a/vendor/google.golang.org/grpc/internal/grpcutil/method.go b/vendor/google.golang.org/grpc/internal/grpcutil/method.go deleted file mode 100644 index 2c2ff7732..000000000 --- a/vendor/google.golang.org/grpc/internal/grpcutil/method.go +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 grpcutil - -import ( - "errors" - "strings" -) - -// ParseMethod splits service and method from the input. It expects format -// "/service/method". -// -func ParseMethod(methodName string) (service, method string, _ error) { - if !strings.HasPrefix(methodName, "/") { - return "", "", errors.New("invalid method name: should start with /") - } - methodName = methodName[1:] - - pos := strings.LastIndex(methodName, "/") - if pos < 0 { - return "", "", errors.New("invalid method name: suffix /method is missing") - } - return methodName[:pos], methodName[pos+1:], nil -} diff --git a/vendor/google.golang.org/grpc/internal/grpcutil/target.go b/vendor/google.golang.org/grpc/internal/grpcutil/target.go deleted file mode 100644 index 80b33cdaf..000000000 --- a/vendor/google.golang.org/grpc/internal/grpcutil/target.go +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright 2020 gRPC 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 grpcutil provides a bunch of utility functions to be used across the -// gRPC codebase. -package grpcutil - -import ( - "strings" - - "google.golang.org/grpc/resolver" -) - -// split2 returns the values from strings.SplitN(s, sep, 2). -// If sep is not found, it returns ("", "", false) instead. -func split2(s, sep string) (string, string, bool) { - spl := strings.SplitN(s, sep, 2) - if len(spl) < 2 { - return "", "", false - } - return spl[0], spl[1], true -} - -// ParseTarget splits target into a resolver.Target struct containing scheme, -// authority and endpoint. -// -// If target is not a valid scheme://authority/endpoint, it returns {Endpoint: -// target}. -func ParseTarget(target string) (ret resolver.Target) { - var ok bool - ret.Scheme, ret.Endpoint, ok = split2(target, "://") - if !ok { - return resolver.Target{Endpoint: target} - } - ret.Authority, ret.Endpoint, ok = split2(ret.Endpoint, "/") - if !ok { - return resolver.Target{Endpoint: target} - } - return ret -} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go deleted file mode 100644 index 818ca8579..000000000 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2016 gRPC 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 internal contains gRPC-internal code, to avoid polluting -// the godoc of the top-level grpc package. It must not import any grpc -// symbols to avoid circular dependencies. -package internal - -import ( - "context" - "time" - - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/serviceconfig" -) - -var ( - // WithHealthCheckFunc is set by dialoptions.go - WithHealthCheckFunc interface{} // func (HealthChecker) DialOption - // HealthCheckFunc is used to provide client-side LB channel health checking - HealthCheckFunc HealthChecker - // BalancerUnregister is exported by package balancer to unregister a balancer. - BalancerUnregister func(name string) - // KeepaliveMinPingTime is the minimum ping interval. This must be 10s by - // default, but tests may wish to set it lower for convenience. - KeepaliveMinPingTime = 10 * time.Second - // NewRequestInfoContext creates a new context based on the argument context attaching - // the passed in RequestInfo to the new context. - NewRequestInfoContext interface{} // func(context.Context, credentials.RequestInfo) context.Context - // NewClientHandshakeInfoContext returns a copy of the input context with - // the passed in ClientHandshakeInfo struct added to it. - NewClientHandshakeInfoContext interface{} // func(context.Context, credentials.ClientHandshakeInfo) context.Context - // ParseServiceConfigForTesting is for creating a fake - // ClientConn for resolver testing only - ParseServiceConfigForTesting interface{} // func(string) *serviceconfig.ParseResult - // EqualServiceConfigForTesting is for testing service config generation and - // parsing. Both a and b should be returned by ParseServiceConfigForTesting. - // This function compares the config without rawJSON stripped, in case the - // there's difference in white space. - EqualServiceConfigForTesting func(a, b serviceconfig.Config) bool -) - -// HealthChecker defines the signature of the client-side LB channel health checking function. -// -// The implementation is expected to create a health checking RPC stream by -// calling newStream(), watch for the health status of serviceName, and report -// it's health back by calling setConnectivityState(). -// -// The health checking protocol is defined at: -// https://github.com/grpc/grpc/blob/master/doc/health-checking.md -type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State, error), serviceName string) error - -const ( - // CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode. - CredsBundleModeFallback = "fallback" - // CredsBundleModeBalancer switches GoogleDefaultCreds to grpclb balancer - // mode. - CredsBundleModeBalancer = "balancer" - // CredsBundleModeBackendFromBalancer switches GoogleDefaultCreds to mode - // that supports backend returned by grpclb balancer. - CredsBundleModeBackendFromBalancer = "backend-from-balancer" -) diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go deleted file mode 100644 index 9d08dd8ab..000000000 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go +++ /dev/null @@ -1,444 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 dns implements a dns resolver to be installed as the default resolver -// in grpc. -package dns - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "net" - "os" - "strconv" - "strings" - "sync" - "time" - - grpclbstate "google.golang.org/grpc/balancer/grpclb/state" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/envconfig" - "google.golang.org/grpc/internal/grpcrand" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) - -// EnableSRVLookups controls whether the DNS resolver attempts to fetch gRPCLB -// addresses from SRV records. Must not be changed after init time. -var EnableSRVLookups = false - -func init() { - resolver.Register(NewBuilder()) -} - -const ( - defaultPort = "443" - defaultDNSSvrPort = "53" - golang = "GO" - // txtPrefix is the prefix string to be prepended to the host name for txt record lookup. - txtPrefix = "_grpc_config." - // In DNS, service config is encoded in a TXT record via the mechanism - // described in RFC-1464 using the attribute name grpc_config. - txtAttribute = "grpc_config=" -) - -var ( - errMissingAddr = errors.New("dns resolver: missing address") - - // Addresses ending with a colon that is supposed to be the separator - // between host and port is not allowed. E.g. "::" is a valid address as - // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with - // a colon as the host and port separator - errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") -) - -var ( - defaultResolver netResolver = net.DefaultResolver - // To prevent excessive re-resolution, we enforce a rate limit on DNS - // resolution requests. - minDNSResRate = 30 * time.Second -) - -var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) { - return func(ctx context.Context, network, address string) (net.Conn, error) { - var dialer net.Dialer - return dialer.DialContext(ctx, network, authority) - } -} - -var customAuthorityResolver = func(authority string) (netResolver, error) { - host, port, err := parseTarget(authority, defaultDNSSvrPort) - if err != nil { - return nil, err - } - - authorityWithPort := net.JoinHostPort(host, port) - - return &net.Resolver{ - PreferGo: true, - Dial: customAuthorityDialler(authorityWithPort), - }, nil -} - -// NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. -func NewBuilder() resolver.Builder { - return &dnsBuilder{} -} - -type dnsBuilder struct{} - -// Build creates and starts a DNS resolver that watches the name resolution of the target. -func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { - host, port, err := parseTarget(target.Endpoint, defaultPort) - if err != nil { - return nil, err - } - - // IP address. - if ipAddr, ok := formatIP(host); ok { - addr := []resolver.Address{{Addr: ipAddr + ":" + port}} - cc.UpdateState(resolver.State{Addresses: addr}) - return deadResolver{}, nil - } - - // DNS address (non-IP). - ctx, cancel := context.WithCancel(context.Background()) - d := &dnsResolver{ - host: host, - port: port, - ctx: ctx, - cancel: cancel, - cc: cc, - rn: make(chan struct{}, 1), - disableServiceConfig: opts.DisableServiceConfig, - } - - if target.Authority == "" { - d.resolver = defaultResolver - } else { - d.resolver, err = customAuthorityResolver(target.Authority) - if err != nil { - return nil, err - } - } - - d.wg.Add(1) - go d.watcher() - d.ResolveNow(resolver.ResolveNowOptions{}) - return d, nil -} - -// Scheme returns the naming scheme of this resolver builder, which is "dns". -func (b *dnsBuilder) Scheme() string { - return "dns" -} - -type netResolver interface { - LookupHost(ctx context.Context, host string) (addrs []string, err error) - LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) - LookupTXT(ctx context.Context, name string) (txts []string, err error) -} - -// deadResolver is a resolver that does nothing. -type deadResolver struct{} - -func (deadResolver) ResolveNow(resolver.ResolveNowOptions) {} - -func (deadResolver) Close() {} - -// dnsResolver watches for the name resolution update for a non-IP target. -type dnsResolver struct { - host string - port string - resolver netResolver - ctx context.Context - cancel context.CancelFunc - cc resolver.ClientConn - // rn channel is used by ResolveNow() to force an immediate resolution of the target. - rn chan struct{} - // wg is used to enforce Close() to return after the watcher() goroutine has finished. - // Otherwise, data race will be possible. [Race Example] in dns_resolver_test we - // replace the real lookup functions with mocked ones to facilitate testing. - // If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes - // will warns lookup (READ the lookup function pointers) inside watcher() goroutine - // has data race with replaceNetFunc (WRITE the lookup function pointers). - wg sync.WaitGroup - disableServiceConfig bool -} - -// ResolveNow invoke an immediate resolution of the target that this dnsResolver watches. -func (d *dnsResolver) ResolveNow(resolver.ResolveNowOptions) { - select { - case d.rn <- struct{}{}: - default: - } -} - -// Close closes the dnsResolver. -func (d *dnsResolver) Close() { - d.cancel() - d.wg.Wait() -} - -func (d *dnsResolver) watcher() { - defer d.wg.Done() - for { - select { - case <-d.ctx.Done(): - return - case <-d.rn: - } - - state, err := d.lookup() - if err != nil { - d.cc.ReportError(err) - } else { - d.cc.UpdateState(*state) - } - - // Sleep to prevent excessive re-resolutions. Incoming resolution requests - // will be queued in d.rn. - t := time.NewTimer(minDNSResRate) - select { - case <-t.C: - case <-d.ctx.Done(): - t.Stop() - return - } - } -} - -func (d *dnsResolver) lookupSRV() ([]resolver.Address, error) { - if !EnableSRVLookups { - return nil, nil - } - var newAddrs []resolver.Address - _, srvs, err := d.resolver.LookupSRV(d.ctx, "grpclb", "tcp", d.host) - if err != nil { - err = handleDNSError(err, "SRV") // may become nil - return nil, err - } - for _, s := range srvs { - lbAddrs, err := d.resolver.LookupHost(d.ctx, s.Target) - if err != nil { - err = handleDNSError(err, "A") // may become nil - if err == nil { - // If there are other SRV records, look them up and ignore this - // one that does not exist. - continue - } - return nil, err - } - for _, a := range lbAddrs { - ip, ok := formatIP(a) - if !ok { - return nil, fmt.Errorf("dns: error parsing A record IP address %v", a) - } - addr := ip + ":" + strconv.Itoa(int(s.Port)) - newAddrs = append(newAddrs, resolver.Address{Addr: addr, ServerName: s.Target}) - } - } - return newAddrs, nil -} - -var filterError = func(err error) error { - if dnsErr, ok := err.(*net.DNSError); ok && !dnsErr.IsTimeout && !dnsErr.IsTemporary { - // Timeouts and temporary errors should be communicated to gRPC to - // attempt another DNS query (with backoff). Other errors should be - // suppressed (they may represent the absence of a TXT record). - return nil - } - return err -} - -func handleDNSError(err error, lookupType string) error { - err = filterError(err) - if err != nil { - err = fmt.Errorf("dns: %v record lookup error: %v", lookupType, err) - grpclog.Infoln(err) - } - return err -} - -func (d *dnsResolver) lookupTXT() *serviceconfig.ParseResult { - ss, err := d.resolver.LookupTXT(d.ctx, txtPrefix+d.host) - if err != nil { - if envconfig.TXTErrIgnore { - return nil - } - if err = handleDNSError(err, "TXT"); err != nil { - return &serviceconfig.ParseResult{Err: err} - } - return nil - } - var res string - for _, s := range ss { - res += s - } - - // TXT record must have "grpc_config=" attribute in order to be used as service config. - if !strings.HasPrefix(res, txtAttribute) { - grpclog.Warningf("dns: TXT record %v missing %v attribute", res, txtAttribute) - // This is not an error; it is the equivalent of not having a service config. - return nil - } - sc := canaryingSC(strings.TrimPrefix(res, txtAttribute)) - return d.cc.ParseServiceConfig(sc) -} - -func (d *dnsResolver) lookupHost() ([]resolver.Address, error) { - var newAddrs []resolver.Address - addrs, err := d.resolver.LookupHost(d.ctx, d.host) - if err != nil { - err = handleDNSError(err, "A") - return nil, err - } - for _, a := range addrs { - ip, ok := formatIP(a) - if !ok { - return nil, fmt.Errorf("dns: error parsing A record IP address %v", a) - } - addr := ip + ":" + d.port - newAddrs = append(newAddrs, resolver.Address{Addr: addr}) - } - return newAddrs, nil -} - -func (d *dnsResolver) lookup() (*resolver.State, error) { - srv, srvErr := d.lookupSRV() - addrs, hostErr := d.lookupHost() - if hostErr != nil && (srvErr != nil || len(srv) == 0) { - return nil, hostErr - } - - state := resolver.State{Addresses: addrs} - if len(srv) > 0 { - state = grpclbstate.Set(state, &grpclbstate.State{BalancerAddresses: srv}) - } - if !d.disableServiceConfig { - state.ServiceConfig = d.lookupTXT() - } - return &state, nil -} - -// formatIP returns ok = false if addr is not a valid textual representation of an IP address. -// If addr is an IPv4 address, return the addr and ok = true. -// If addr is an IPv6 address, return the addr enclosed in square brackets and ok = true. -func formatIP(addr string) (addrIP string, ok bool) { - ip := net.ParseIP(addr) - if ip == nil { - return "", false - } - if ip.To4() != nil { - return addr, true - } - return "[" + addr + "]", true -} - -// parseTarget takes the user input target string and default port, returns formatted host and port info. -// If target doesn't specify a port, set the port to be the defaultPort. -// If target is in IPv6 format and host-name is enclosed in square brackets, brackets -// are stripped when setting the host. -// examples: -// target: "www.google.com" defaultPort: "443" returns host: "www.google.com", port: "443" -// target: "ipv4-host:80" defaultPort: "443" returns host: "ipv4-host", port: "80" -// target: "[ipv6-host]" defaultPort: "443" returns host: "ipv6-host", port: "443" -// target: ":80" defaultPort: "443" returns host: "localhost", port: "80" -func parseTarget(target, defaultPort string) (host, port string, err error) { - if target == "" { - return "", "", errMissingAddr - } - if ip := net.ParseIP(target); ip != nil { - // target is an IPv4 or IPv6(without brackets) address - return target, defaultPort, nil - } - if host, port, err = net.SplitHostPort(target); err == nil { - if port == "" { - // If the port field is empty (target ends with colon), e.g. "[::1]:", this is an error. - return "", "", errEndsWithColon - } - // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port - if host == "" { - // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. - host = "localhost" - } - return host, port, nil - } - if host, port, err = net.SplitHostPort(target + ":" + defaultPort); err == nil { - // target doesn't have port - return host, port, nil - } - return "", "", fmt.Errorf("invalid target address %v, error info: %v", target, err) -} - -type rawChoice struct { - ClientLanguage *[]string `json:"clientLanguage,omitempty"` - Percentage *int `json:"percentage,omitempty"` - ClientHostName *[]string `json:"clientHostName,omitempty"` - ServiceConfig *json.RawMessage `json:"serviceConfig,omitempty"` -} - -func containsString(a *[]string, b string) bool { - if a == nil { - return true - } - for _, c := range *a { - if c == b { - return true - } - } - return false -} - -func chosenByPercentage(a *int) bool { - if a == nil { - return true - } - return grpcrand.Intn(100)+1 <= *a -} - -func canaryingSC(js string) string { - if js == "" { - return "" - } - var rcs []rawChoice - err := json.Unmarshal([]byte(js), &rcs) - if err != nil { - grpclog.Warningf("dns: error parsing service config json: %v", err) - return "" - } - cliHostname, err := os.Hostname() - if err != nil { - grpclog.Warningf("dns: error getting client hostname: %v", err) - return "" - } - var sc string - for _, c := range rcs { - if !containsString(c.ClientLanguage, golang) || - !chosenByPercentage(c.Percentage) || - !containsString(c.ClientHostName, cliHostname) || - c.ServiceConfig == nil { - continue - } - sc = string(*c.ServiceConfig) - break - } - return sc -} diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/go113.go b/vendor/google.golang.org/grpc/internal/resolver/dns/go113.go deleted file mode 100644 index 8783a8cf8..000000000 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/go113.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build go1.13 - -/* - * - * Copyright 2019 gRPC 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 dns - -import "net" - -func init() { - filterError = func(err error) error { - if dnsErr, ok := err.(*net.DNSError); ok && dnsErr.IsNotFound { - // The name does not exist; not an error. - return nil - } - return err - } -} diff --git a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go deleted file mode 100644 index 520d9229e..000000000 --- a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 passthrough implements a pass-through resolver. It sends the target -// name without scheme back to gRPC as resolved address. -package passthrough - -import "google.golang.org/grpc/resolver" - -const scheme = "passthrough" - -type passthroughBuilder struct{} - -func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { - r := &passthroughResolver{ - target: target, - cc: cc, - } - r.start() - return r, nil -} - -func (*passthroughBuilder) Scheme() string { - return scheme -} - -type passthroughResolver struct { - target resolver.Target - cc resolver.ClientConn -} - -func (r *passthroughResolver) start() { - r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint}}}) -} - -func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {} - -func (*passthroughResolver) Close() {} - -func init() { - resolver.Register(&passthroughBuilder{}) -} diff --git a/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go b/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go deleted file mode 100644 index 9b26414d4..000000000 --- a/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright 2020 gRPC 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 serviceconfig contains utility functions to parse service config. -package serviceconfig - -import ( - "encoding/json" - "fmt" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/grpclog" - externalserviceconfig "google.golang.org/grpc/serviceconfig" -) - -// BalancerConfig is the balancer config part that service config's -// loadBalancingConfig fields can be unmarshalled to. It's a json unmarshaller. -// -// https://github.com/grpc/grpc-proto/blob/54713b1e8bc6ed2d4f25fb4dff527842150b91b2/grpc/service_config/service_config.proto#L247 -type BalancerConfig struct { - Name string - Config externalserviceconfig.LoadBalancingConfig -} - -type intermediateBalancerConfig []map[string]json.RawMessage - -// UnmarshalJSON implements json unmarshaller. -func (bc *BalancerConfig) UnmarshalJSON(b []byte) error { - var ir intermediateBalancerConfig - err := json.Unmarshal(b, &ir) - if err != nil { - return err - } - - for i, lbcfg := range ir { - if len(lbcfg) != 1 { - return fmt.Errorf("invalid loadBalancingConfig: entry %v does not contain exactly 1 policy/config pair: %q", i, lbcfg) - } - var ( - name string - jsonCfg json.RawMessage - ) - // Get the key:value pair from the map. - for name, jsonCfg = range lbcfg { - } - builder := balancer.Get(name) - if builder == nil { - // If the balancer is not registered, move on to the next config. - // This is not an error. - continue - } - bc.Name = name - - parser, ok := builder.(balancer.ConfigParser) - if !ok { - if string(jsonCfg) != "{}" { - grpclog.Warningf("non-empty balancer configuration %q, but balancer does not implement ParseConfig", string(jsonCfg)) - } - // Stop at this, though the builder doesn't support parsing config. - return nil - } - - cfg, err := parser.ParseConfig(jsonCfg) - if err != nil { - return fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err) - } - bc.Config = cfg - return nil - } - // This is reached when the for loop iterates over all entries, but didn't - // return. This means we had a loadBalancingConfig slice but did not - // encounter a registered policy. The config is considered invalid in this - // case. - return fmt.Errorf("invalid loadBalancingConfig: no supported policies found") -} diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go deleted file mode 100644 index 710223b8d..000000000 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ /dev/null @@ -1,162 +0,0 @@ -/* - * - * Copyright 2020 gRPC 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 status implements errors returned by gRPC. These errors are -// serialized and transmitted on the wire between server and client, and allow -// for additional data to be transmitted via the Details field in the status -// proto. gRPC service handlers should return an error created by this -// package, and gRPC clients should expect a corresponding error to be -// returned from the RPC call. -// -// This package upholds the invariants that a non-nil error may not -// contain an OK code, and an OK code must result in a nil error. -package status - -import ( - "errors" - "fmt" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" - spb "google.golang.org/genproto/googleapis/rpc/status" - "google.golang.org/grpc/codes" -) - -// Status represents an RPC status code, message, and details. It is immutable -// and should be created with New, Newf, or FromProto. -type Status struct { - s *spb.Status -} - -// New returns a Status representing c and msg. -func New(c codes.Code, msg string) *Status { - return &Status{s: &spb.Status{Code: int32(c), Message: msg}} -} - -// Newf returns New(c, fmt.Sprintf(format, a...)). -func Newf(c codes.Code, format string, a ...interface{}) *Status { - return New(c, fmt.Sprintf(format, a...)) -} - -// FromProto returns a Status representing s. -func FromProto(s *spb.Status) *Status { - return &Status{s: proto.Clone(s).(*spb.Status)} -} - -// Err returns an error representing c and msg. If c is OK, returns nil. -func Err(c codes.Code, msg string) error { - return New(c, msg).Err() -} - -// Errorf returns Error(c, fmt.Sprintf(format, a...)). -func Errorf(c codes.Code, format string, a ...interface{}) error { - return Err(c, fmt.Sprintf(format, a...)) -} - -// Code returns the status code contained in s. -func (s *Status) Code() codes.Code { - if s == nil || s.s == nil { - return codes.OK - } - return codes.Code(s.s.Code) -} - -// Message returns the message contained in s. -func (s *Status) Message() string { - if s == nil || s.s == nil { - return "" - } - return s.s.Message -} - -// Proto returns s's status as an spb.Status proto message. -func (s *Status) Proto() *spb.Status { - if s == nil { - return nil - } - return proto.Clone(s.s).(*spb.Status) -} - -// Err returns an immutable error representing s; returns nil if s.Code() is OK. -func (s *Status) Err() error { - if s.Code() == codes.OK { - return nil - } - return &Error{e: s.Proto()} -} - -// WithDetails returns a new status with the provided details messages appended to the status. -// If any errors are encountered, it returns nil and the first error encountered. -func (s *Status) WithDetails(details ...proto.Message) (*Status, error) { - if s.Code() == codes.OK { - return nil, errors.New("no error details for status with code OK") - } - // s.Code() != OK implies that s.Proto() != nil. - p := s.Proto() - for _, detail := range details { - any, err := ptypes.MarshalAny(detail) - if err != nil { - return nil, err - } - p.Details = append(p.Details, any) - } - return &Status{s: p}, nil -} - -// Details returns a slice of details messages attached to the status. -// If a detail cannot be decoded, the error is returned in place of the detail. -func (s *Status) Details() []interface{} { - if s == nil || s.s == nil { - return nil - } - details := make([]interface{}, 0, len(s.s.Details)) - for _, any := range s.s.Details { - detail := &ptypes.DynamicAny{} - if err := ptypes.UnmarshalAny(any, detail); err != nil { - details = append(details, err) - continue - } - details = append(details, detail.Message) - } - return details -} - -// Error wraps a pointer of a status proto. It implements error and Status, -// and a nil *Error should never be returned by this package. -type Error struct { - e *spb.Status -} - -func (e *Error) Error() string { - return fmt.Sprintf("rpc error: code = %s desc = %s", codes.Code(e.e.GetCode()), e.e.GetMessage()) -} - -// GRPCStatus returns the Status represented by se. -func (e *Error) GRPCStatus() *Status { - return FromProto(e.e) -} - -// Is implements future error.Is functionality. -// A Error is equivalent if the code and message are identical. -func (e *Error) Is(target error) bool { - tse, ok := target.(*Error) - if !ok { - return false - } - return proto.Equal(e.e, tse.e) -} diff --git a/vendor/google.golang.org/grpc/internal/syscall/syscall_linux.go b/vendor/google.golang.org/grpc/internal/syscall/syscall_linux.go deleted file mode 100644 index 43281a3e0..000000000 --- a/vendor/google.golang.org/grpc/internal/syscall/syscall_linux.go +++ /dev/null @@ -1,114 +0,0 @@ -// +build !appengine - -/* - * - * Copyright 2018 gRPC 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 syscall provides functionalities that grpc uses to get low-level operating system -// stats/info. -package syscall - -import ( - "fmt" - "net" - "syscall" - "time" - - "golang.org/x/sys/unix" - "google.golang.org/grpc/grpclog" -) - -// GetCPUTime returns the how much CPU time has passed since the start of this process. -func GetCPUTime() int64 { - var ts unix.Timespec - if err := unix.ClockGettime(unix.CLOCK_PROCESS_CPUTIME_ID, &ts); err != nil { - grpclog.Fatal(err) - } - return ts.Nano() -} - -// Rusage is an alias for syscall.Rusage under linux non-appengine environment. -type Rusage syscall.Rusage - -// GetRusage returns the resource usage of current process. -func GetRusage() (rusage *Rusage) { - rusage = new(Rusage) - syscall.Getrusage(syscall.RUSAGE_SELF, (*syscall.Rusage)(rusage)) - return -} - -// CPUTimeDiff returns the differences of user CPU time and system CPU time used -// between two Rusage structs. -func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) { - f := (*syscall.Rusage)(first) - l := (*syscall.Rusage)(latest) - var ( - utimeDiffs = l.Utime.Sec - f.Utime.Sec - utimeDiffus = l.Utime.Usec - f.Utime.Usec - stimeDiffs = l.Stime.Sec - f.Stime.Sec - stimeDiffus = l.Stime.Usec - f.Stime.Usec - ) - - uTimeElapsed := float64(utimeDiffs) + float64(utimeDiffus)*1.0e-6 - sTimeElapsed := float64(stimeDiffs) + float64(stimeDiffus)*1.0e-6 - - return uTimeElapsed, sTimeElapsed -} - -// SetTCPUserTimeout sets the TCP user timeout on a connection's socket -func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error { - tcpconn, ok := conn.(*net.TCPConn) - if !ok { - // not a TCP connection. exit early - return nil - } - rawConn, err := tcpconn.SyscallConn() - if err != nil { - return fmt.Errorf("error getting raw connection: %v", err) - } - err = rawConn.Control(func(fd uintptr) { - err = syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, int(timeout/time.Millisecond)) - }) - if err != nil { - return fmt.Errorf("error setting option on socket: %v", err) - } - - return nil -} - -// GetTCPUserTimeout gets the TCP user timeout on a connection's socket -func GetTCPUserTimeout(conn net.Conn) (opt int, err error) { - tcpconn, ok := conn.(*net.TCPConn) - if !ok { - err = fmt.Errorf("conn is not *net.TCPConn. got %T", conn) - return - } - rawConn, err := tcpconn.SyscallConn() - if err != nil { - err = fmt.Errorf("error getting raw connection: %v", err) - return - } - err = rawConn.Control(func(fd uintptr) { - opt, err = syscall.GetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT) - }) - if err != nil { - err = fmt.Errorf("error getting option on socket: %v", err) - return - } - - return -} diff --git a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go deleted file mode 100644 index ae0a9117e..000000000 --- a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go +++ /dev/null @@ -1,75 +0,0 @@ -// +build !linux appengine - -/* - * - * Copyright 2018 gRPC 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 syscall provides functionalities that grpc uses to get low-level -// operating system stats/info. -package syscall - -import ( - "net" - "sync" - "time" - - "google.golang.org/grpc/grpclog" -) - -var once sync.Once - -func log() { - once.Do(func() { - grpclog.Info("CPU time info is unavailable on non-linux or appengine environment.") - }) -} - -// GetCPUTime returns the how much CPU time has passed since the start of this process. -// It always returns 0 under non-linux or appengine environment. -func GetCPUTime() int64 { - log() - return 0 -} - -// Rusage is an empty struct under non-linux or appengine environment. -type Rusage struct{} - -// GetRusage is a no-op function under non-linux or appengine environment. -func GetRusage() (rusage *Rusage) { - log() - return nil -} - -// CPUTimeDiff returns the differences of user CPU time and system CPU time used -// between two Rusage structs. It a no-op function for non-linux or appengine environment. -func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) { - log() - return 0, 0 -} - -// SetTCPUserTimeout is a no-op function under non-linux or appengine environments -func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error { - log() - return nil -} - -// GetTCPUserTimeout is a no-op function under non-linux or appengine environments -// a negative return value indicates the operation is not supported -func GetTCPUserTimeout(conn net.Conn) (int, error) { - log() - return -1, nil -} diff --git a/vendor/google.golang.org/grpc/internal/transport/bdp_estimator.go b/vendor/google.golang.org/grpc/internal/transport/bdp_estimator.go deleted file mode 100644 index 070680edb..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/bdp_estimator.go +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 transport - -import ( - "sync" - "time" -) - -const ( - // bdpLimit is the maximum value the flow control windows will be increased - // to. TCP typically limits this to 4MB, but some systems go up to 16MB. - // Since this is only a limit, it is safe to make it optimistic. - bdpLimit = (1 << 20) * 16 - // alpha is a constant factor used to keep a moving average - // of RTTs. - alpha = 0.9 - // If the current bdp sample is greater than or equal to - // our beta * our estimated bdp and the current bandwidth - // sample is the maximum bandwidth observed so far, we - // increase our bbp estimate by a factor of gamma. - beta = 0.66 - // To put our bdp to be smaller than or equal to twice the real BDP, - // we should multiply our current sample with 4/3, however to round things out - // we use 2 as the multiplication factor. - gamma = 2 -) - -// Adding arbitrary data to ping so that its ack can be identified. -// Easter-egg: what does the ping message say? -var bdpPing = &ping{data: [8]byte{2, 4, 16, 16, 9, 14, 7, 7}} - -type bdpEstimator struct { - // sentAt is the time when the ping was sent. - sentAt time.Time - - mu sync.Mutex - // bdp is the current bdp estimate. - bdp uint32 - // sample is the number of bytes received in one measurement cycle. - sample uint32 - // bwMax is the maximum bandwidth noted so far (bytes/sec). - bwMax float64 - // bool to keep track of the beginning of a new measurement cycle. - isSent bool - // Callback to update the window sizes. - updateFlowControl func(n uint32) - // sampleCount is the number of samples taken so far. - sampleCount uint64 - // round trip time (seconds) - rtt float64 -} - -// timesnap registers the time bdp ping was sent out so that -// network rtt can be calculated when its ack is received. -// It is called (by controller) when the bdpPing is -// being written on the wire. -func (b *bdpEstimator) timesnap(d [8]byte) { - if bdpPing.data != d { - return - } - b.sentAt = time.Now() -} - -// add adds bytes to the current sample for calculating bdp. -// It returns true only if a ping must be sent. This can be used -// by the caller (handleData) to make decision about batching -// a window update with it. -func (b *bdpEstimator) add(n uint32) bool { - b.mu.Lock() - defer b.mu.Unlock() - if b.bdp == bdpLimit { - return false - } - if !b.isSent { - b.isSent = true - b.sample = n - b.sentAt = time.Time{} - b.sampleCount++ - return true - } - b.sample += n - return false -} - -// calculate is called when an ack for a bdp ping is received. -// Here we calculate the current bdp and bandwidth sample and -// decide if the flow control windows should go up. -func (b *bdpEstimator) calculate(d [8]byte) { - // Check if the ping acked for was the bdp ping. - if bdpPing.data != d { - return - } - b.mu.Lock() - rttSample := time.Since(b.sentAt).Seconds() - if b.sampleCount < 10 { - // Bootstrap rtt with an average of first 10 rtt samples. - b.rtt += (rttSample - b.rtt) / float64(b.sampleCount) - } else { - // Heed to the recent past more. - b.rtt += (rttSample - b.rtt) * float64(alpha) - } - b.isSent = false - // The number of bytes accumulated so far in the sample is smaller - // than or equal to 1.5 times the real BDP on a saturated connection. - bwCurrent := float64(b.sample) / (b.rtt * float64(1.5)) - if bwCurrent > b.bwMax { - b.bwMax = bwCurrent - } - // If the current sample (which is smaller than or equal to the 1.5 times the real BDP) is - // greater than or equal to 2/3rd our perceived bdp AND this is the maximum bandwidth seen so far, we - // should update our perception of the network BDP. - if float64(b.sample) >= beta*float64(b.bdp) && bwCurrent == b.bwMax && b.bdp != bdpLimit { - sampleFloat := float64(b.sample) - b.bdp = uint32(gamma * sampleFloat) - if b.bdp > bdpLimit { - b.bdp = bdpLimit - } - bdp := b.bdp - b.mu.Unlock() - b.updateFlowControl(bdp) - return - } - b.mu.Unlock() -} diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go deleted file mode 100644 index d4bb19c3b..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ /dev/null @@ -1,936 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 transport - -import ( - "bytes" - "fmt" - "runtime" - "sync" - "sync/atomic" - - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" -) - -var updateHeaderTblSize = func(e *hpack.Encoder, v uint32) { - e.SetMaxDynamicTableSizeLimit(v) -} - -type itemNode struct { - it interface{} - next *itemNode -} - -type itemList struct { - head *itemNode - tail *itemNode -} - -func (il *itemList) enqueue(i interface{}) { - n := &itemNode{it: i} - if il.tail == nil { - il.head, il.tail = n, n - return - } - il.tail.next = n - il.tail = n -} - -// peek returns the first item in the list without removing it from the -// list. -func (il *itemList) peek() interface{} { - return il.head.it -} - -func (il *itemList) dequeue() interface{} { - if il.head == nil { - return nil - } - i := il.head.it - il.head = il.head.next - if il.head == nil { - il.tail = nil - } - return i -} - -func (il *itemList) dequeueAll() *itemNode { - h := il.head - il.head, il.tail = nil, nil - return h -} - -func (il *itemList) isEmpty() bool { - return il.head == nil -} - -// The following defines various control items which could flow through -// the control buffer of transport. They represent different aspects of -// control tasks, e.g., flow control, settings, streaming resetting, etc. - -// maxQueuedTransportResponseFrames is the most queued "transport response" -// frames we will buffer before preventing new reads from occurring on the -// transport. These are control frames sent in response to client requests, -// such as RST_STREAM due to bad headers or settings acks. -const maxQueuedTransportResponseFrames = 50 - -type cbItem interface { - isTransportResponseFrame() bool -} - -// registerStream is used to register an incoming stream with loopy writer. -type registerStream struct { - streamID uint32 - wq *writeQuota -} - -func (*registerStream) isTransportResponseFrame() bool { return false } - -// headerFrame is also used to register stream on the client-side. -type headerFrame struct { - streamID uint32 - hf []hpack.HeaderField - endStream bool // Valid on server side. - initStream func(uint32) error // Used only on the client side. - onWrite func() - wq *writeQuota // write quota for the stream created. - cleanup *cleanupStream // Valid on the server side. - onOrphaned func(error) // Valid on client-side -} - -func (h *headerFrame) isTransportResponseFrame() bool { - return h.cleanup != nil && h.cleanup.rst // Results in a RST_STREAM -} - -type cleanupStream struct { - streamID uint32 - rst bool - rstCode http2.ErrCode - onWrite func() -} - -func (c *cleanupStream) isTransportResponseFrame() bool { return c.rst } // Results in a RST_STREAM - -type dataFrame struct { - streamID uint32 - endStream bool - h []byte - d []byte - // onEachWrite is called every time - // a part of d is written out. - onEachWrite func() -} - -func (*dataFrame) isTransportResponseFrame() bool { return false } - -type incomingWindowUpdate struct { - streamID uint32 - increment uint32 -} - -func (*incomingWindowUpdate) isTransportResponseFrame() bool { return false } - -type outgoingWindowUpdate struct { - streamID uint32 - increment uint32 -} - -func (*outgoingWindowUpdate) isTransportResponseFrame() bool { - return false // window updates are throttled by thresholds -} - -type incomingSettings struct { - ss []http2.Setting -} - -func (*incomingSettings) isTransportResponseFrame() bool { return true } // Results in a settings ACK - -type outgoingSettings struct { - ss []http2.Setting -} - -func (*outgoingSettings) isTransportResponseFrame() bool { return false } - -type incomingGoAway struct { -} - -func (*incomingGoAway) isTransportResponseFrame() bool { return false } - -type goAway struct { - code http2.ErrCode - debugData []byte - headsUp bool - closeConn bool -} - -func (*goAway) isTransportResponseFrame() bool { return false } - -type ping struct { - ack bool - data [8]byte -} - -func (*ping) isTransportResponseFrame() bool { return true } - -type outFlowControlSizeRequest struct { - resp chan uint32 -} - -func (*outFlowControlSizeRequest) isTransportResponseFrame() bool { return false } - -type outStreamState int - -const ( - active outStreamState = iota - empty - waitingOnStreamQuota -) - -type outStream struct { - id uint32 - state outStreamState - itl *itemList - bytesOutStanding int - wq *writeQuota - - next *outStream - prev *outStream -} - -func (s *outStream) deleteSelf() { - if s.prev != nil { - s.prev.next = s.next - } - if s.next != nil { - s.next.prev = s.prev - } - s.next, s.prev = nil, nil -} - -type outStreamList struct { - // Following are sentinel objects that mark the - // beginning and end of the list. They do not - // contain any item lists. All valid objects are - // inserted in between them. - // This is needed so that an outStream object can - // deleteSelf() in O(1) time without knowing which - // list it belongs to. - head *outStream - tail *outStream -} - -func newOutStreamList() *outStreamList { - head, tail := new(outStream), new(outStream) - head.next = tail - tail.prev = head - return &outStreamList{ - head: head, - tail: tail, - } -} - -func (l *outStreamList) enqueue(s *outStream) { - e := l.tail.prev - e.next = s - s.prev = e - s.next = l.tail - l.tail.prev = s -} - -// remove from the beginning of the list. -func (l *outStreamList) dequeue() *outStream { - b := l.head.next - if b == l.tail { - return nil - } - b.deleteSelf() - return b -} - -// controlBuffer is a way to pass information to loopy. -// Information is passed as specific struct types called control frames. -// A control frame not only represents data, messages or headers to be sent out -// but can also be used to instruct loopy to update its internal state. -// It shouldn't be confused with an HTTP2 frame, although some of the control frames -// like dataFrame and headerFrame do go out on wire as HTTP2 frames. -type controlBuffer struct { - ch chan struct{} - done <-chan struct{} - mu sync.Mutex - consumerWaiting bool - list *itemList - err error - - // transportResponseFrames counts the number of queued items that represent - // the response of an action initiated by the peer. trfChan is created - // when transportResponseFrames >= maxQueuedTransportResponseFrames and is - // closed and nilled when transportResponseFrames drops below the - // threshold. Both fields are protected by mu. - transportResponseFrames int - trfChan atomic.Value // *chan struct{} -} - -func newControlBuffer(done <-chan struct{}) *controlBuffer { - return &controlBuffer{ - ch: make(chan struct{}, 1), - list: &itemList{}, - done: done, - } -} - -// throttle blocks if there are too many incomingSettings/cleanupStreams in the -// controlbuf. -func (c *controlBuffer) throttle() { - ch, _ := c.trfChan.Load().(*chan struct{}) - if ch != nil { - select { - case <-*ch: - case <-c.done: - } - } -} - -func (c *controlBuffer) put(it cbItem) error { - _, err := c.executeAndPut(nil, it) - return err -} - -func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it cbItem) (bool, error) { - var wakeUp bool - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return false, c.err - } - if f != nil { - if !f(it) { // f wasn't successful - c.mu.Unlock() - return false, nil - } - } - if c.consumerWaiting { - wakeUp = true - c.consumerWaiting = false - } - c.list.enqueue(it) - if it.isTransportResponseFrame() { - c.transportResponseFrames++ - if c.transportResponseFrames == maxQueuedTransportResponseFrames { - // We are adding the frame that puts us over the threshold; create - // a throttling channel. - ch := make(chan struct{}) - c.trfChan.Store(&ch) - } - } - c.mu.Unlock() - if wakeUp { - select { - case c.ch <- struct{}{}: - default: - } - } - return true, nil -} - -// Note argument f should never be nil. -func (c *controlBuffer) execute(f func(it interface{}) bool, it interface{}) (bool, error) { - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return false, c.err - } - if !f(it) { // f wasn't successful - c.mu.Unlock() - return false, nil - } - c.mu.Unlock() - return true, nil -} - -func (c *controlBuffer) get(block bool) (interface{}, error) { - for { - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return nil, c.err - } - if !c.list.isEmpty() { - h := c.list.dequeue().(cbItem) - if h.isTransportResponseFrame() { - if c.transportResponseFrames == maxQueuedTransportResponseFrames { - // We are removing the frame that put us over the - // threshold; close and clear the throttling channel. - ch := c.trfChan.Load().(*chan struct{}) - close(*ch) - c.trfChan.Store((*chan struct{})(nil)) - } - c.transportResponseFrames-- - } - c.mu.Unlock() - return h, nil - } - if !block { - c.mu.Unlock() - return nil, nil - } - c.consumerWaiting = true - c.mu.Unlock() - select { - case <-c.ch: - case <-c.done: - c.finish() - return nil, ErrConnClosing - } - } -} - -func (c *controlBuffer) finish() { - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return - } - c.err = ErrConnClosing - // There may be headers for streams in the control buffer. - // These streams need to be cleaned out since the transport - // is still not aware of these yet. - for head := c.list.dequeueAll(); head != nil; head = head.next { - hdr, ok := head.it.(*headerFrame) - if !ok { - continue - } - if hdr.onOrphaned != nil { // It will be nil on the server-side. - hdr.onOrphaned(ErrConnClosing) - } - } - c.mu.Unlock() -} - -type side int - -const ( - clientSide side = iota - serverSide -) - -// Loopy receives frames from the control buffer. -// Each frame is handled individually; most of the work done by loopy goes -// into handling data frames. Loopy maintains a queue of active streams, and each -// stream maintains a queue of data frames; as loopy receives data frames -// it gets added to the queue of the relevant stream. -// Loopy goes over this list of active streams by processing one node every iteration, -// thereby closely resemebling to a round-robin scheduling over all streams. While -// processing a stream, loopy writes out data bytes from this stream capped by the min -// of http2MaxFrameLen, connection-level flow control and stream-level flow control. -type loopyWriter struct { - side side - cbuf *controlBuffer - sendQuota uint32 - oiws uint32 // outbound initial window size. - // estdStreams is map of all established streams that are not cleaned-up yet. - // On client-side, this is all streams whose headers were sent out. - // On server-side, this is all streams whose headers were received. - estdStreams map[uint32]*outStream // Established streams. - // activeStreams is a linked-list of all streams that have data to send and some - // stream-level flow control quota. - // Each of these streams internally have a list of data items(and perhaps trailers - // on the server-side) to be sent out. - activeStreams *outStreamList - framer *framer - hBuf *bytes.Buffer // The buffer for HPACK encoding. - hEnc *hpack.Encoder // HPACK encoder. - bdpEst *bdpEstimator - draining bool - - // Side-specific handlers - ssGoAwayHandler func(*goAway) (bool, error) -} - -func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator) *loopyWriter { - var buf bytes.Buffer - l := &loopyWriter{ - side: s, - cbuf: cbuf, - sendQuota: defaultWindowSize, - oiws: defaultWindowSize, - estdStreams: make(map[uint32]*outStream), - activeStreams: newOutStreamList(), - framer: fr, - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - bdpEst: bdpEst, - } - return l -} - -const minBatchSize = 1000 - -// run should be run in a separate goroutine. -// It reads control frames from controlBuf and processes them by: -// 1. Updating loopy's internal state, or/and -// 2. Writing out HTTP2 frames on the wire. -// -// Loopy keeps all active streams with data to send in a linked-list. -// All streams in the activeStreams linked-list must have both: -// 1. Data to send, and -// 2. Stream level flow control quota available. -// -// In each iteration of run loop, other than processing the incoming control -// frame, loopy calls processData, which processes one node from the activeStreams linked-list. -// This results in writing of HTTP2 frames into an underlying write buffer. -// When there's no more control frames to read from controlBuf, loopy flushes the write buffer. -// As an optimization, to increase the batch size for each flush, loopy yields the processor, once -// if the batch size is too low to give stream goroutines a chance to fill it up. -func (l *loopyWriter) run() (err error) { - defer func() { - if err == ErrConnClosing { - // Don't log ErrConnClosing as error since it happens - // 1. When the connection is closed by some other known issue. - // 2. User closed the connection. - // 3. A graceful close of connection. - infof("transport: loopyWriter.run returning. %v", err) - err = nil - } - }() - for { - it, err := l.cbuf.get(true) - if err != nil { - return err - } - if err = l.handle(it); err != nil { - return err - } - if _, err = l.processData(); err != nil { - return err - } - gosched := true - hasdata: - for { - it, err := l.cbuf.get(false) - if err != nil { - return err - } - if it != nil { - if err = l.handle(it); err != nil { - return err - } - if _, err = l.processData(); err != nil { - return err - } - continue hasdata - } - isEmpty, err := l.processData() - if err != nil { - return err - } - if !isEmpty { - continue hasdata - } - if gosched { - gosched = false - if l.framer.writer.offset < minBatchSize { - runtime.Gosched() - continue hasdata - } - } - l.framer.writer.Flush() - break hasdata - - } - } -} - -func (l *loopyWriter) outgoingWindowUpdateHandler(w *outgoingWindowUpdate) error { - return l.framer.fr.WriteWindowUpdate(w.streamID, w.increment) -} - -func (l *loopyWriter) incomingWindowUpdateHandler(w *incomingWindowUpdate) error { - // Otherwise update the quota. - if w.streamID == 0 { - l.sendQuota += w.increment - return nil - } - // Find the stream and update it. - if str, ok := l.estdStreams[w.streamID]; ok { - str.bytesOutStanding -= int(w.increment) - if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota > 0 && str.state == waitingOnStreamQuota { - str.state = active - l.activeStreams.enqueue(str) - return nil - } - } - return nil -} - -func (l *loopyWriter) outgoingSettingsHandler(s *outgoingSettings) error { - return l.framer.fr.WriteSettings(s.ss...) -} - -func (l *loopyWriter) incomingSettingsHandler(s *incomingSettings) error { - if err := l.applySettings(s.ss); err != nil { - return err - } - return l.framer.fr.WriteSettingsAck() -} - -func (l *loopyWriter) registerStreamHandler(h *registerStream) error { - str := &outStream{ - id: h.streamID, - state: empty, - itl: &itemList{}, - wq: h.wq, - } - l.estdStreams[h.streamID] = str - return nil -} - -func (l *loopyWriter) headerHandler(h *headerFrame) error { - if l.side == serverSide { - str, ok := l.estdStreams[h.streamID] - if !ok { - warningf("transport: loopy doesn't recognize the stream: %d", h.streamID) - return nil - } - // Case 1.A: Server is responding back with headers. - if !h.endStream { - return l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite) - } - // else: Case 1.B: Server wants to close stream. - - if str.state != empty { // either active or waiting on stream quota. - // add it str's list of items. - str.itl.enqueue(h) - return nil - } - if err := l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite); err != nil { - return err - } - return l.cleanupStreamHandler(h.cleanup) - } - // Case 2: Client wants to originate stream. - str := &outStream{ - id: h.streamID, - state: empty, - itl: &itemList{}, - wq: h.wq, - } - str.itl.enqueue(h) - return l.originateStream(str) -} - -func (l *loopyWriter) originateStream(str *outStream) error { - hdr := str.itl.dequeue().(*headerFrame) - if err := hdr.initStream(str.id); err != nil { - if err == ErrConnClosing { - return err - } - // Other errors(errStreamDrain) need not close transport. - return nil - } - if err := l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil { - return err - } - l.estdStreams[str.id] = str - return nil -} - -func (l *loopyWriter) writeHeader(streamID uint32, endStream bool, hf []hpack.HeaderField, onWrite func()) error { - if onWrite != nil { - onWrite() - } - l.hBuf.Reset() - for _, f := range hf { - if err := l.hEnc.WriteField(f); err != nil { - warningf("transport: loopyWriter.writeHeader encountered error while encoding headers:", err) - } - } - var ( - err error - endHeaders, first bool - ) - first = true - for !endHeaders { - size := l.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - if first { - first = false - err = l.framer.fr.WriteHeaders(http2.HeadersFrameParam{ - StreamID: streamID, - BlockFragment: l.hBuf.Next(size), - EndStream: endStream, - EndHeaders: endHeaders, - }) - } else { - err = l.framer.fr.WriteContinuation( - streamID, - endHeaders, - l.hBuf.Next(size), - ) - } - if err != nil { - return err - } - } - return nil -} - -func (l *loopyWriter) preprocessData(df *dataFrame) error { - str, ok := l.estdStreams[df.streamID] - if !ok { - return nil - } - // If we got data for a stream it means that - // stream was originated and the headers were sent out. - str.itl.enqueue(df) - if str.state == empty { - str.state = active - l.activeStreams.enqueue(str) - } - return nil -} - -func (l *loopyWriter) pingHandler(p *ping) error { - if !p.ack { - l.bdpEst.timesnap(p.data) - } - return l.framer.fr.WritePing(p.ack, p.data) - -} - -func (l *loopyWriter) outFlowControlSizeRequestHandler(o *outFlowControlSizeRequest) error { - o.resp <- l.sendQuota - return nil -} - -func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error { - c.onWrite() - if str, ok := l.estdStreams[c.streamID]; ok { - // On the server side it could be a trailers-only response or - // a RST_STREAM before stream initialization thus the stream might - // not be established yet. - delete(l.estdStreams, c.streamID) - str.deleteSelf() - } - if c.rst { // If RST_STREAM needs to be sent. - if err := l.framer.fr.WriteRSTStream(c.streamID, c.rstCode); err != nil { - return err - } - } - if l.side == clientSide && l.draining && len(l.estdStreams) == 0 { - return ErrConnClosing - } - return nil -} - -func (l *loopyWriter) incomingGoAwayHandler(*incomingGoAway) error { - if l.side == clientSide { - l.draining = true - if len(l.estdStreams) == 0 { - return ErrConnClosing - } - } - return nil -} - -func (l *loopyWriter) goAwayHandler(g *goAway) error { - // Handling of outgoing GoAway is very specific to side. - if l.ssGoAwayHandler != nil { - draining, err := l.ssGoAwayHandler(g) - if err != nil { - return err - } - l.draining = draining - } - return nil -} - -func (l *loopyWriter) handle(i interface{}) error { - switch i := i.(type) { - case *incomingWindowUpdate: - return l.incomingWindowUpdateHandler(i) - case *outgoingWindowUpdate: - return l.outgoingWindowUpdateHandler(i) - case *incomingSettings: - return l.incomingSettingsHandler(i) - case *outgoingSettings: - return l.outgoingSettingsHandler(i) - case *headerFrame: - return l.headerHandler(i) - case *registerStream: - return l.registerStreamHandler(i) - case *cleanupStream: - return l.cleanupStreamHandler(i) - case *incomingGoAway: - return l.incomingGoAwayHandler(i) - case *dataFrame: - return l.preprocessData(i) - case *ping: - return l.pingHandler(i) - case *goAway: - return l.goAwayHandler(i) - case *outFlowControlSizeRequest: - return l.outFlowControlSizeRequestHandler(i) - default: - return fmt.Errorf("transport: unknown control message type %T", i) - } -} - -func (l *loopyWriter) applySettings(ss []http2.Setting) error { - for _, s := range ss { - switch s.ID { - case http2.SettingInitialWindowSize: - o := l.oiws - l.oiws = s.Val - if o < l.oiws { - // If the new limit is greater make all depleted streams active. - for _, stream := range l.estdStreams { - if stream.state == waitingOnStreamQuota { - stream.state = active - l.activeStreams.enqueue(stream) - } - } - } - case http2.SettingHeaderTableSize: - updateHeaderTblSize(l.hEnc, s.Val) - } - } - return nil -} - -// processData removes the first stream from active streams, writes out at most 16KB -// of its data and then puts it at the end of activeStreams if there's still more data -// to be sent and stream has some stream-level flow control. -func (l *loopyWriter) processData() (bool, error) { - if l.sendQuota == 0 { - return true, nil - } - str := l.activeStreams.dequeue() // Remove the first stream. - if str == nil { - return true, nil - } - dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream. - // A data item is represented by a dataFrame, since it later translates into - // multiple HTTP2 data frames. - // Every dataFrame has two buffers; h that keeps grpc-message header and d that is acutal data. - // As an optimization to keep wire traffic low, data from d is copied to h to make as big as the - // maximum possilbe HTTP2 frame size. - - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame - // Client sends out empty data frame with endStream = true - if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil { - return false, err - } - str.itl.dequeue() // remove the empty data item from stream - if str.itl.isEmpty() { - str.state = empty - } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers. - if err := l.writeHeader(trailer.streamID, trailer.endStream, trailer.hf, trailer.onWrite); err != nil { - return false, err - } - if err := l.cleanupStreamHandler(trailer.cleanup); err != nil { - return false, nil - } - } else { - l.activeStreams.enqueue(str) - } - return false, nil - } - var ( - buf []byte - ) - // Figure out the maximum size we can send - maxSize := http2MaxFrameLen - if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota <= 0 { // stream-level flow control. - str.state = waitingOnStreamQuota - return false, nil - } else if maxSize > strQuota { - maxSize = strQuota - } - if maxSize > int(l.sendQuota) { // connection-level flow control. - maxSize = int(l.sendQuota) - } - // Compute how much of the header and data we can send within quota and max frame length - hSize := min(maxSize, len(dataItem.h)) - dSize := min(maxSize-hSize, len(dataItem.d)) - if hSize != 0 { - if dSize == 0 { - buf = dataItem.h - } else { - // We can add some data to grpc message header to distribute bytes more equally across frames. - // Copy on the stack to avoid generating garbage - var localBuf [http2MaxFrameLen]byte - copy(localBuf[:hSize], dataItem.h) - copy(localBuf[hSize:], dataItem.d[:dSize]) - buf = localBuf[:hSize+dSize] - } - } else { - buf = dataItem.d - } - - size := hSize + dSize - - // Now that outgoing flow controls are checked we can replenish str's write quota - str.wq.replenish(size) - var endStream bool - // If this is the last data message on this stream and all of it can be written in this iteration. - if dataItem.endStream && len(dataItem.h)+len(dataItem.d) <= size { - endStream = true - } - if dataItem.onEachWrite != nil { - dataItem.onEachWrite() - } - if err := l.framer.fr.WriteData(dataItem.streamID, endStream, buf[:size]); err != nil { - return false, err - } - str.bytesOutStanding += size - l.sendQuota -= uint32(size) - dataItem.h = dataItem.h[hSize:] - dataItem.d = dataItem.d[dSize:] - - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // All the data from that message was written out. - str.itl.dequeue() - } - if str.itl.isEmpty() { - str.state = empty - } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // The next item is trailers. - if err := l.writeHeader(trailer.streamID, trailer.endStream, trailer.hf, trailer.onWrite); err != nil { - return false, err - } - if err := l.cleanupStreamHandler(trailer.cleanup); err != nil { - return false, err - } - } else if int(l.oiws)-str.bytesOutStanding <= 0 { // Ran out of stream quota. - str.state = waitingOnStreamQuota - } else { // Otherwise add it back to the list of active streams. - l.activeStreams.enqueue(str) - } - return false, nil -} - -func min(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/google.golang.org/grpc/internal/transport/defaults.go b/vendor/google.golang.org/grpc/internal/transport/defaults.go deleted file mode 100644 index 9fa306b2e..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/defaults.go +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 transport - -import ( - "math" - "time" -) - -const ( - // The default value of flow control window size in HTTP2 spec. - defaultWindowSize = 65535 - // The initial window size for flow control. - initialWindowSize = defaultWindowSize // for an RPC - infinity = time.Duration(math.MaxInt64) - defaultClientKeepaliveTime = infinity - defaultClientKeepaliveTimeout = 20 * time.Second - defaultMaxStreamsClient = 100 - defaultMaxConnectionIdle = infinity - defaultMaxConnectionAge = infinity - defaultMaxConnectionAgeGrace = infinity - defaultServerKeepaliveTime = 2 * time.Hour - defaultServerKeepaliveTimeout = 20 * time.Second - defaultKeepalivePolicyMinTime = 5 * time.Minute - // max window limit set by HTTP2 Specs. - maxWindowSize = math.MaxInt32 - // defaultWriteQuota is the default value for number of data - // bytes that each stream can schedule before some of it being - // flushed out. - defaultWriteQuota = 64 * 1024 - defaultClientMaxHeaderListSize = uint32(16 << 20) - defaultServerMaxHeaderListSize = uint32(16 << 20) -) diff --git a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go deleted file mode 100644 index f262edd8e..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go +++ /dev/null @@ -1,217 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 transport - -import ( - "fmt" - "math" - "sync" - "sync/atomic" -) - -// writeQuota is a soft limit on the amount of data a stream can -// schedule before some of it is written out. -type writeQuota struct { - quota int32 - // get waits on read from when quota goes less than or equal to zero. - // replenish writes on it when quota goes positive again. - ch chan struct{} - // done is triggered in error case. - done <-chan struct{} - // replenish is called by loopyWriter to give quota back to. - // It is implemented as a field so that it can be updated - // by tests. - replenish func(n int) -} - -func newWriteQuota(sz int32, done <-chan struct{}) *writeQuota { - w := &writeQuota{ - quota: sz, - ch: make(chan struct{}, 1), - done: done, - } - w.replenish = w.realReplenish - return w -} - -func (w *writeQuota) get(sz int32) error { - for { - if atomic.LoadInt32(&w.quota) > 0 { - atomic.AddInt32(&w.quota, -sz) - return nil - } - select { - case <-w.ch: - continue - case <-w.done: - return errStreamDone - } - } -} - -func (w *writeQuota) realReplenish(n int) { - sz := int32(n) - a := atomic.AddInt32(&w.quota, sz) - b := a - sz - if b <= 0 && a > 0 { - select { - case w.ch <- struct{}{}: - default: - } - } -} - -type trInFlow struct { - limit uint32 - unacked uint32 - effectiveWindowSize uint32 -} - -func (f *trInFlow) newLimit(n uint32) uint32 { - d := n - f.limit - f.limit = n - f.updateEffectiveWindowSize() - return d -} - -func (f *trInFlow) onData(n uint32) uint32 { - f.unacked += n - if f.unacked >= f.limit/4 { - w := f.unacked - f.unacked = 0 - f.updateEffectiveWindowSize() - return w - } - f.updateEffectiveWindowSize() - return 0 -} - -func (f *trInFlow) reset() uint32 { - w := f.unacked - f.unacked = 0 - f.updateEffectiveWindowSize() - return w -} - -func (f *trInFlow) updateEffectiveWindowSize() { - atomic.StoreUint32(&f.effectiveWindowSize, f.limit-f.unacked) -} - -func (f *trInFlow) getSize() uint32 { - return atomic.LoadUint32(&f.effectiveWindowSize) -} - -// TODO(mmukhi): Simplify this code. -// inFlow deals with inbound flow control -type inFlow struct { - mu sync.Mutex - // The inbound flow control limit for pending data. - limit uint32 - // pendingData is the overall data which have been received but not been - // consumed by applications. - pendingData uint32 - // The amount of data the application has consumed but grpc has not sent - // window update for them. Used to reduce window update frequency. - pendingUpdate uint32 - // delta is the extra window update given by receiver when an application - // is reading data bigger in size than the inFlow limit. - delta uint32 -} - -// newLimit updates the inflow window to a new value n. -// It assumes that n is always greater than the old limit. -func (f *inFlow) newLimit(n uint32) uint32 { - f.mu.Lock() - d := n - f.limit - f.limit = n - f.mu.Unlock() - return d -} - -func (f *inFlow) maybeAdjust(n uint32) uint32 { - if n > uint32(math.MaxInt32) { - n = uint32(math.MaxInt32) - } - f.mu.Lock() - defer f.mu.Unlock() - // estSenderQuota is the receiver's view of the maximum number of bytes the sender - // can send without a window update. - estSenderQuota := int32(f.limit - (f.pendingData + f.pendingUpdate)) - // estUntransmittedData is the maximum number of bytes the sends might not have put - // on the wire yet. A value of 0 or less means that we have already received all or - // more bytes than the application is requesting to read. - estUntransmittedData := int32(n - f.pendingData) // Casting into int32 since it could be negative. - // This implies that unless we send a window update, the sender won't be able to send all the bytes - // for this message. Therefore we must send an update over the limit since there's an active read - // request from the application. - if estUntransmittedData > estSenderQuota { - // Sender's window shouldn't go more than 2^31 - 1 as specified in the HTTP spec. - if f.limit+n > maxWindowSize { - f.delta = maxWindowSize - f.limit - } else { - // Send a window update for the whole message and not just the difference between - // estUntransmittedData and estSenderQuota. This will be helpful in case the message - // is padded; We will fallback on the current available window(at least a 1/4th of the limit). - f.delta = n - } - return f.delta - } - return 0 -} - -// onData is invoked when some data frame is received. It updates pendingData. -func (f *inFlow) onData(n uint32) error { - f.mu.Lock() - f.pendingData += n - if f.pendingData+f.pendingUpdate > f.limit+f.delta { - limit := f.limit - rcvd := f.pendingData + f.pendingUpdate - f.mu.Unlock() - return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", rcvd, limit) - } - f.mu.Unlock() - return nil -} - -// onRead is invoked when the application reads the data. It returns the window size -// to be sent to the peer. -func (f *inFlow) onRead(n uint32) uint32 { - f.mu.Lock() - if f.pendingData == 0 { - f.mu.Unlock() - return 0 - } - f.pendingData -= n - if n > f.delta { - n -= f.delta - f.delta = 0 - } else { - f.delta -= n - n = 0 - } - f.pendingUpdate += n - if f.pendingUpdate >= f.limit/4 { - wu := f.pendingUpdate - f.pendingUpdate = 0 - f.mu.Unlock() - return wu - } - f.mu.Unlock() - return 0 -} diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go deleted file mode 100644 index fc44e9761..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ /dev/null @@ -1,462 +0,0 @@ -/* - * - * Copyright 2016 gRPC 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. - * - */ - -// This file is the implementation of a gRPC server using HTTP/2 which -// uses the standard Go http2 Server implementation (via the -// http.Handler interface), rather than speaking low-level HTTP/2 -// frames itself. It is the implementation of *grpc.Server.ServeHTTP. - -package transport - -import ( - "bytes" - "context" - "errors" - "fmt" - "io" - "net" - "net/http" - "strings" - "sync" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/http2" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" -) - -// NewServerHandlerTransport returns a ServerTransport handling gRPC -// from inside an http.Handler. It requires that the http Server -// supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats stats.Handler) (ServerTransport, error) { - if r.ProtoMajor != 2 { - return nil, errors.New("gRPC requires HTTP/2") - } - if r.Method != "POST" { - return nil, errors.New("invalid gRPC request method") - } - contentType := r.Header.Get("Content-Type") - // TODO: do we assume contentType is lowercase? we did before - contentSubtype, validContentType := contentSubtype(contentType) - if !validContentType { - return nil, errors.New("invalid gRPC request content-type") - } - if _, ok := w.(http.Flusher); !ok { - return nil, errors.New("gRPC requires a ResponseWriter supporting http.Flusher") - } - - st := &serverHandlerTransport{ - rw: w, - req: r, - closedCh: make(chan struct{}), - writes: make(chan func()), - contentType: contentType, - contentSubtype: contentSubtype, - stats: stats, - } - - if v := r.Header.Get("grpc-timeout"); v != "" { - to, err := decodeTimeout(v) - if err != nil { - return nil, status.Errorf(codes.Internal, "malformed time-out: %v", err) - } - st.timeoutSet = true - st.timeout = to - } - - metakv := []string{"content-type", contentType} - if r.Host != "" { - metakv = append(metakv, ":authority", r.Host) - } - for k, vv := range r.Header { - k = strings.ToLower(k) - if isReservedHeader(k) && !isWhitelistedHeader(k) { - continue - } - for _, v := range vv { - v, err := decodeMetadataHeader(k, v) - if err != nil { - return nil, status.Errorf(codes.Internal, "malformed binary metadata: %v", err) - } - metakv = append(metakv, k, v) - } - } - st.headerMD = metadata.Pairs(metakv...) - - return st, nil -} - -// serverHandlerTransport is an implementation of ServerTransport -// which replies to exactly one gRPC request (exactly one HTTP request), -// using the net/http.Handler interface. This http.Handler is guaranteed -// at this point to be speaking over HTTP/2, so it's able to speak valid -// gRPC. -type serverHandlerTransport struct { - rw http.ResponseWriter - req *http.Request - timeoutSet bool - timeout time.Duration - - headerMD metadata.MD - - closeOnce sync.Once - closedCh chan struct{} // closed on Close - - // writes is a channel of code to run serialized in the - // ServeHTTP (HandleStreams) goroutine. The channel is closed - // when WriteStatus is called. - writes chan func() - - // block concurrent WriteStatus calls - // e.g. grpc/(*serverStream).SendMsg/RecvMsg - writeStatusMu sync.Mutex - - // we just mirror the request content-type - contentType string - // we store both contentType and contentSubtype so we don't keep recreating them - // TODO make sure this is consistent across handler_server and http2_server - contentSubtype string - - stats stats.Handler -} - -func (ht *serverHandlerTransport) Close() error { - ht.closeOnce.Do(ht.closeCloseChanOnce) - return nil -} - -func (ht *serverHandlerTransport) closeCloseChanOnce() { close(ht.closedCh) } - -func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) } - -// strAddr is a net.Addr backed by either a TCP "ip:port" string, or -// the empty string if unknown. -type strAddr string - -func (a strAddr) Network() string { - if a != "" { - // Per the documentation on net/http.Request.RemoteAddr, if this is - // set, it's set to the IP:port of the peer (hence, TCP): - // https://golang.org/pkg/net/http/#Request - // - // If we want to support Unix sockets later, we can - // add our own grpc-specific convention within the - // grpc codebase to set RemoteAddr to a different - // format, or probably better: we can attach it to the - // context and use that from serverHandlerTransport.RemoteAddr. - return "tcp" - } - return "" -} - -func (a strAddr) String() string { return string(a) } - -// do runs fn in the ServeHTTP goroutine. -func (ht *serverHandlerTransport) do(fn func()) error { - select { - case <-ht.closedCh: - return ErrConnClosing - case ht.writes <- fn: - return nil - } -} - -func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) error { - ht.writeStatusMu.Lock() - defer ht.writeStatusMu.Unlock() - - headersWritten := s.updateHeaderSent() - err := ht.do(func() { - if !headersWritten { - ht.writePendingHeaders(s) - } - - // And flush, in case no header or body has been sent yet. - // This forces a separation of headers and trailers if this is the - // first call (for example, in end2end tests's TestNoService). - ht.rw.(http.Flusher).Flush() - - h := ht.rw.Header() - h.Set("Grpc-Status", fmt.Sprintf("%d", st.Code())) - if m := st.Message(); m != "" { - h.Set("Grpc-Message", encodeGrpcMessage(m)) - } - - if p := st.Proto(); p != nil && len(p.Details) > 0 { - stBytes, err := proto.Marshal(p) - if err != nil { - // TODO: return error instead, when callers are able to handle it. - panic(err) - } - - h.Set("Grpc-Status-Details-Bin", encodeBinHeader(stBytes)) - } - - if md := s.Trailer(); len(md) > 0 { - for k, vv := range md { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - // http2 ResponseWriter mechanism to send undeclared Trailers after - // the headers have possibly been written. - h.Add(http2.TrailerPrefix+k, encodeMetadataHeader(k, v)) - } - } - } - }) - - if err == nil { // transport has not been closed - if ht.stats != nil { - // Note: The trailer fields are compressed with hpack after this call returns. - // No WireLength field is set here. - ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{ - Trailer: s.trailer.Copy(), - }) - } - } - ht.Close() - return err -} - -// writePendingHeaders sets common and custom headers on the first -// write call (Write, WriteHeader, or WriteStatus) -func (ht *serverHandlerTransport) writePendingHeaders(s *Stream) { - ht.writeCommonHeaders(s) - ht.writeCustomHeaders(s) -} - -// writeCommonHeaders sets common headers on the first write -// call (Write, WriteHeader, or WriteStatus). -func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { - h := ht.rw.Header() - h["Date"] = nil // suppress Date to make tests happy; TODO: restore - h.Set("Content-Type", ht.contentType) - - // Predeclare trailers we'll set later in WriteStatus (after the body). - // This is a SHOULD in the HTTP RFC, and the way you add (known) - // Trailers per the net/http.ResponseWriter contract. - // See https://golang.org/pkg/net/http/#ResponseWriter - // and https://golang.org/pkg/net/http/#example_ResponseWriter_trailers - h.Add("Trailer", "Grpc-Status") - h.Add("Trailer", "Grpc-Message") - h.Add("Trailer", "Grpc-Status-Details-Bin") - - if s.sendCompress != "" { - h.Set("Grpc-Encoding", s.sendCompress) - } -} - -// writeCustomHeaders sets custom headers set on the stream via SetHeader -// on the first write call (Write, WriteHeader, or WriteStatus). -func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) { - h := ht.rw.Header() - - s.hdrMu.Lock() - for k, vv := range s.header { - if isReservedHeader(k) { - continue - } - for _, v := range vv { - h.Add(k, encodeMetadataHeader(k, v)) - } - } - - s.hdrMu.Unlock() -} - -func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - headersWritten := s.updateHeaderSent() - return ht.do(func() { - if !headersWritten { - ht.writePendingHeaders(s) - } - ht.rw.Write(hdr) - ht.rw.Write(data) - ht.rw.(http.Flusher).Flush() - }) -} - -func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { - if err := s.SetHeader(md); err != nil { - return err - } - - headersWritten := s.updateHeaderSent() - err := ht.do(func() { - if !headersWritten { - ht.writePendingHeaders(s) - } - - ht.rw.WriteHeader(200) - ht.rw.(http.Flusher).Flush() - }) - - if err == nil { - if ht.stats != nil { - // Note: The header fields are compressed with hpack after this call returns. - // No WireLength field is set here. - ht.stats.HandleRPC(s.Context(), &stats.OutHeader{ - Header: md.Copy(), - Compression: s.sendCompress, - }) - } - } - return err -} - -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { - // With this transport type there will be exactly 1 stream: this HTTP request. - - ctx := ht.req.Context() - var cancel context.CancelFunc - if ht.timeoutSet { - ctx, cancel = context.WithTimeout(ctx, ht.timeout) - } else { - ctx, cancel = context.WithCancel(ctx) - } - - // requestOver is closed when the status has been written via WriteStatus. - requestOver := make(chan struct{}) - go func() { - select { - case <-requestOver: - case <-ht.closedCh: - case <-ht.req.Context().Done(): - } - cancel() - ht.Close() - }() - - req := ht.req - - s := &Stream{ - id: 0, // irrelevant - requestRead: func(int) {}, - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), - contentSubtype: ht.contentSubtype, - } - pr := &peer.Peer{ - Addr: ht.RemoteAddr(), - } - if req.TLS != nil { - pr.AuthInfo = credentials.TLSInfo{State: *req.TLS, CommonAuthInfo: credentials.CommonAuthInfo{SecurityLevel: credentials.PrivacyAndIntegrity}} - } - ctx = metadata.NewIncomingContext(ctx, ht.headerMD) - s.ctx = peer.NewContext(ctx, pr) - if ht.stats != nil { - s.ctx = ht.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: ht.RemoteAddr(), - Compression: s.recvCompress, - } - ht.stats.HandleRPC(s.ctx, inHeader) - } - s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}}, - windowHandler: func(int) {}, - } - - // readerDone is closed when the Body.Read-ing goroutine exits. - readerDone := make(chan struct{}) - go func() { - defer close(readerDone) - - // TODO: minimize garbage, optimize recvBuffer code/ownership - const readSize = 8196 - for buf := make([]byte, readSize); ; { - n, err := req.Body.Read(buf) - if n > 0 { - s.buf.put(recvMsg{buffer: bytes.NewBuffer(buf[:n:n])}) - buf = buf[n:] - } - if err != nil { - s.buf.put(recvMsg{err: mapRecvMsgError(err)}) - return - } - if len(buf) == 0 { - buf = make([]byte, readSize) - } - } - }() - - // startStream is provided by the *grpc.Server's serveStreams. - // It starts a goroutine serving s and exits immediately. - // The goroutine that is started is the one that then calls - // into ht, calling WriteHeader, Write, WriteStatus, Close, etc. - startStream(s) - - ht.runStream() - close(requestOver) - - // Wait for reading goroutine to finish. - req.Body.Close() - <-readerDone -} - -func (ht *serverHandlerTransport) runStream() { - for { - select { - case fn := <-ht.writes: - fn() - case <-ht.closedCh: - return - } - } -} - -func (ht *serverHandlerTransport) IncrMsgSent() {} - -func (ht *serverHandlerTransport) IncrMsgRecv() {} - -func (ht *serverHandlerTransport) Drain() { - panic("Drain() is not implemented") -} - -// mapRecvMsgError returns the non-nil err into the appropriate -// error value as expected by callers of *grpc.parser.recvMsg. -// In particular, in can only be: -// * io.EOF -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * an error from the status package -func mapRecvMsgError(err error) error { - if err == io.EOF || err == io.ErrUnexpectedEOF { - return err - } - if se, ok := err.(http2.StreamError); ok { - if code, ok := http2ErrConvTab[se.Code]; ok { - return status.Error(code, se.Error()) - } - } - if strings.Contains(err.Error(), "body closed by handler") { - return status.Error(codes.Canceled, err.Error()) - } - return connectionErrorf(true, err, err.Error()) -} diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go deleted file mode 100644 index b43e21ffa..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ /dev/null @@ -1,1476 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 transport - -import ( - "context" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/internal" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/syscall" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" -) - -// clientConnectionCounter counts the number of connections a client has -// initiated (equal to the number of http2Clients created). Must be accessed -// atomically. -var clientConnectionCounter uint64 - -// http2Client implements the ClientTransport interface with HTTP2. -type http2Client struct { - lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. - ctx context.Context - cancel context.CancelFunc - ctxDone <-chan struct{} // Cache the ctx.Done() chan. - userAgent string - md interface{} - conn net.Conn // underlying communication channel - loopy *loopyWriter - remoteAddr net.Addr - localAddr net.Addr - authInfo credentials.AuthInfo // auth info about the connection - - readerDone chan struct{} // sync point to enable testing. - writerDone chan struct{} // sync point to enable testing. - // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) - // that the server sent GoAway on this transport. - goAway chan struct{} - - framer *framer - // controlBuf delivers all the control related tasks (e.g., window - // updates, reset streams, and various settings) to the controller. - controlBuf *controlBuffer - fc *trInFlow - // The scheme used: https if TLS is on, http otherwise. - scheme string - - isSecure bool - - perRPCCreds []credentials.PerRPCCredentials - - kp keepalive.ClientParameters - keepaliveEnabled bool - - statsHandler stats.Handler - - initialWindowSize int32 - - // configured by peer through SETTINGS_MAX_HEADER_LIST_SIZE - maxSendHeaderListSize *uint32 - - bdpEst *bdpEstimator - // onPrefaceReceipt is a callback that client transport calls upon - // receiving server preface to signal that a succefull HTTP2 - // connection was established. - onPrefaceReceipt func() - - maxConcurrentStreams uint32 - streamQuota int64 - streamsQuotaAvailable chan struct{} - waitingStreams uint32 - nextID uint32 - - mu sync.Mutex // guard the following variables - state transportState - activeStreams map[uint32]*Stream - // prevGoAway ID records the Last-Stream-ID in the previous GOAway frame. - prevGoAwayID uint32 - // goAwayReason records the http2.ErrCode and debug data received with the - // GoAway frame. - goAwayReason GoAwayReason - // A condition variable used to signal when the keepalive goroutine should - // go dormant. The condition for dormancy is based on the number of active - // streams and the `PermitWithoutStream` keepalive client parameter. And - // since the number of active streams is guarded by the above mutex, we use - // the same for this condition variable as well. - kpDormancyCond *sync.Cond - // A boolean to track whether the keepalive goroutine is dormant or not. - // This is checked before attempting to signal the above condition - // variable. - kpDormant bool - - // Fields below are for channelz metric collection. - channelzID int64 // channelz unique identification number - czData *channelzData - - onGoAway func(GoAwayReason) - onClose func() - - bufferPool *bufferPool - - connectionID uint64 -} - -func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { - if fn != nil { - return fn(ctx, addr) - } - return (&net.Dialer{}).DialContext(ctx, "tcp", addr) -} - -func isTemporary(err error) bool { - switch err := err.(type) { - case interface { - Temporary() bool - }: - return err.Temporary() - case interface { - Timeout() bool - }: - // Timeouts may be resolved upon retry, and are thus treated as - // temporary. - return err.Timeout() - } - return true -} - -// newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2 -// and starts to receive messages on it. Non-nil error returns if construction -// fails. -func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onPrefaceReceipt func(), onGoAway func(GoAwayReason), onClose func()) (_ *http2Client, err error) { - scheme := "http" - ctx, cancel := context.WithCancel(ctx) - defer func() { - if err != nil { - cancel() - } - }() - - conn, err := dial(connectCtx, opts.Dialer, addr.Addr) - if err != nil { - if opts.FailOnNonTempDialError { - return nil, connectionErrorf(isTemporary(err), err, "transport: error while dialing: %v", err) - } - return nil, connectionErrorf(true, err, "transport: Error while dialing %v", err) - } - // Any further errors will close the underlying connection - defer func(conn net.Conn) { - if err != nil { - conn.Close() - } - }(conn) - kp := opts.KeepaliveParams - // Validate keepalive parameters. - if kp.Time == 0 { - kp.Time = defaultClientKeepaliveTime - } - if kp.Timeout == 0 { - kp.Timeout = defaultClientKeepaliveTimeout - } - keepaliveEnabled := false - if kp.Time != infinity { - if err = syscall.SetTCPUserTimeout(conn, kp.Timeout); err != nil { - return nil, connectionErrorf(false, err, "transport: failed to set TCP_USER_TIMEOUT: %v", err) - } - keepaliveEnabled = true - } - var ( - isSecure bool - authInfo credentials.AuthInfo - ) - transportCreds := opts.TransportCredentials - perRPCCreds := opts.PerRPCCredentials - - if b := opts.CredsBundle; b != nil { - if t := b.TransportCredentials(); t != nil { - transportCreds = t - } - if t := b.PerRPCCredentials(); t != nil { - perRPCCreds = append(perRPCCreds, t) - } - } - if transportCreds != nil { - // gRPC, resolver, balancer etc. can specify arbitrary data in the - // Attributes field of resolver.Address, which is shoved into connectCtx - // and passed to the credential handshaker. This makes it possible for - // address specific arbitrary data to reach the credential handshaker. - contextWithHandshakeInfo := internal.NewClientHandshakeInfoContext.(func(context.Context, credentials.ClientHandshakeInfo) context.Context) - connectCtx = contextWithHandshakeInfo(connectCtx, credentials.ClientHandshakeInfo{Attributes: addr.Attributes}) - conn, authInfo, err = transportCreds.ClientHandshake(connectCtx, addr.ServerName, conn) - if err != nil { - return nil, connectionErrorf(isTemporary(err), err, "transport: authentication handshake failed: %v", err) - } - isSecure = true - if transportCreds.Info().SecurityProtocol == "tls" { - scheme = "https" - } - } - dynamicWindow := true - icwz := int32(initialWindowSize) - if opts.InitialConnWindowSize >= defaultWindowSize { - icwz = opts.InitialConnWindowSize - dynamicWindow = false - } - writeBufSize := opts.WriteBufferSize - readBufSize := opts.ReadBufferSize - maxHeaderListSize := defaultClientMaxHeaderListSize - if opts.MaxHeaderListSize != nil { - maxHeaderListSize = *opts.MaxHeaderListSize - } - t := &http2Client{ - ctx: ctx, - ctxDone: ctx.Done(), // Cache Done chan. - cancel: cancel, - userAgent: opts.UserAgent, - md: addr.Metadata, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, - readerDone: make(chan struct{}), - writerDone: make(chan struct{}), - goAway: make(chan struct{}), - framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize), - fc: &trInFlow{limit: uint32(icwz)}, - scheme: scheme, - activeStreams: make(map[uint32]*Stream), - isSecure: isSecure, - perRPCCreds: perRPCCreds, - kp: kp, - statsHandler: opts.StatsHandler, - initialWindowSize: initialWindowSize, - onPrefaceReceipt: onPrefaceReceipt, - nextID: 1, - maxConcurrentStreams: defaultMaxStreamsClient, - streamQuota: defaultMaxStreamsClient, - streamsQuotaAvailable: make(chan struct{}, 1), - czData: new(channelzData), - onGoAway: onGoAway, - onClose: onClose, - keepaliveEnabled: keepaliveEnabled, - bufferPool: newBufferPool(), - } - t.controlBuf = newControlBuffer(t.ctxDone) - if opts.InitialWindowSize >= defaultWindowSize { - t.initialWindowSize = opts.InitialWindowSize - dynamicWindow = false - } - if dynamicWindow { - t.bdpEst = &bdpEstimator{ - bdp: initialWindowSize, - updateFlowControl: t.updateFlowControl, - } - } - if t.statsHandler != nil { - t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connBegin) - } - if channelz.IsOn() { - t.channelzID = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, fmt.Sprintf("%s -> %s", t.localAddr, t.remoteAddr)) - } - if t.keepaliveEnabled { - t.kpDormancyCond = sync.NewCond(&t.mu) - go t.keepalive() - } - // Start the reader goroutine for incoming message. Each transport has - // a dedicated goroutine which reads HTTP2 frame from network. Then it - // dispatches the frame to the corresponding stream entity. - go t.reader() - - // Send connection preface to server. - n, err := t.conn.Write(clientPreface) - if err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: failed to write client preface: %v", err) - } - if n != len(clientPreface) { - t.Close() - return nil, connectionErrorf(true, err, "transport: preface mismatch, wrote %d bytes; want %d", n, len(clientPreface)) - } - var ss []http2.Setting - - if t.initialWindowSize != defaultWindowSize { - ss = append(ss, http2.Setting{ - ID: http2.SettingInitialWindowSize, - Val: uint32(t.initialWindowSize), - }) - } - if opts.MaxHeaderListSize != nil { - ss = append(ss, http2.Setting{ - ID: http2.SettingMaxHeaderListSize, - Val: *opts.MaxHeaderListSize, - }) - } - err = t.framer.fr.WriteSettings(ss...) - if err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: failed to write initial settings frame: %v", err) - } - // Adjust the connection flow control window if needed. - if delta := uint32(icwz - defaultWindowSize); delta > 0 { - if err := t.framer.fr.WriteWindowUpdate(0, delta); err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: failed to write window update: %v", err) - } - } - - t.connectionID = atomic.AddUint64(&clientConnectionCounter, 1) - - if err := t.framer.writer.Flush(); err != nil { - return nil, err - } - go func() { - t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst) - err := t.loopy.run() - if err != nil { - errorf("transport: loopyWriter.run returning. Err: %v", err) - } - // If it's a connection error, let reader goroutine handle it - // since there might be data in the buffers. - if _, ok := err.(net.Error); !ok { - t.conn.Close() - } - close(t.writerDone) - }() - return t, nil -} - -func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { - // TODO(zhaoq): Handle uint32 overflow of Stream.id. - s := &Stream{ - ct: t, - done: make(chan struct{}), - method: callHdr.Method, - sendCompress: callHdr.SendCompress, - buf: newRecvBuffer(), - headerChan: make(chan struct{}), - contentSubtype: callHdr.ContentSubtype, - } - s.wq = newWriteQuota(defaultWriteQuota, s.done) - s.requestRead = func(n int) { - t.adjustWindow(s, uint32(n)) - } - // The client side stream context should have exactly the same life cycle with the user provided context. - // That means, s.ctx should be read-only. And s.ctx is done iff ctx is done. - // So we use the original context here instead of creating a copy. - s.ctx = ctx - s.trReader = &transportReader{ - reader: &recvBufferReader{ - ctx: s.ctx, - ctxDone: s.ctx.Done(), - recv: s.buf, - closeStream: func(err error) { - t.CloseStream(s, err) - }, - freeBuffer: t.bufferPool.put, - }, - windowHandler: func(n int) { - t.updateWindow(s, uint32(n)) - }, - } - return s -} - -func (t *http2Client) getPeer() *peer.Peer { - return &peer.Peer{ - Addr: t.remoteAddr, - AuthInfo: t.authInfo, - } -} - -func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) ([]hpack.HeaderField, error) { - aud := t.createAudience(callHdr) - ri := credentials.RequestInfo{ - Method: callHdr.Method, - AuthInfo: t.authInfo, - } - ctxWithRequestInfo := internal.NewRequestInfoContext.(func(context.Context, credentials.RequestInfo) context.Context)(ctx, ri) - authData, err := t.getTrAuthData(ctxWithRequestInfo, aud) - if err != nil { - return nil, err - } - callAuthData, err := t.getCallAuthData(ctxWithRequestInfo, aud, callHdr) - if err != nil { - return nil, err - } - // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields - // first and create a slice of that exact size. - // Make the slice of certain predictable size to reduce allocations made by append. - hfLen := 7 // :method, :scheme, :path, :authority, content-type, user-agent, te - hfLen += len(authData) + len(callAuthData) - headerFields := make([]hpack.HeaderField, 0, hfLen) - headerFields = append(headerFields, hpack.HeaderField{Name: ":method", Value: "POST"}) - headerFields = append(headerFields, hpack.HeaderField{Name: ":scheme", Value: t.scheme}) - headerFields = append(headerFields, hpack.HeaderField{Name: ":path", Value: callHdr.Method}) - headerFields = append(headerFields, hpack.HeaderField{Name: ":authority", Value: callHdr.Host}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(callHdr.ContentSubtype)}) - headerFields = append(headerFields, hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) - headerFields = append(headerFields, hpack.HeaderField{Name: "te", Value: "trailers"}) - if callHdr.PreviousAttempts > 0 { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-previous-rpc-attempts", Value: strconv.Itoa(callHdr.PreviousAttempts)}) - } - - if callHdr.SendCompress != "" { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-accept-encoding", Value: callHdr.SendCompress}) - } - if dl, ok := ctx.Deadline(); ok { - // Send out timeout regardless its value. The server can detect timeout context by itself. - // TODO(mmukhi): Perhaps this field should be updated when actually writing out to the wire. - timeout := time.Until(dl) - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-timeout", Value: encodeTimeout(timeout)}) - } - for k, v := range authData { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - for k, v := range callAuthData { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - if b := stats.OutgoingTags(ctx); b != nil { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-tags-bin", Value: encodeBinHeader(b)}) - } - if b := stats.OutgoingTrace(ctx); b != nil { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) - } - - if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { - var k string - for k, vv := range md { - // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - for _, vv := range added { - for i, v := range vv { - if i%2 == 0 { - k = v - continue - } - // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. - if isReservedHeader(k) { - continue - } - headerFields = append(headerFields, hpack.HeaderField{Name: strings.ToLower(k), Value: encodeMetadataHeader(k, v)}) - } - } - } - if md, ok := t.md.(*metadata.MD); ok { - for k, vv := range *md { - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - } - return headerFields, nil -} - -func (t *http2Client) createAudience(callHdr *CallHdr) string { - // Create an audience string only if needed. - if len(t.perRPCCreds) == 0 && callHdr.Creds == nil { - return "" - } - // Construct URI required to get auth request metadata. - // Omit port if it is the default one. - host := strings.TrimSuffix(callHdr.Host, ":443") - pos := strings.LastIndex(callHdr.Method, "/") - if pos == -1 { - pos = len(callHdr.Method) - } - return "https://" + host + callHdr.Method[:pos] -} - -func (t *http2Client) getTrAuthData(ctx context.Context, audience string) (map[string]string, error) { - if len(t.perRPCCreds) == 0 { - return nil, nil - } - authData := map[string]string{} - for _, c := range t.perRPCCreds { - data, err := c.GetRequestMetadata(ctx, audience) - if err != nil { - if _, ok := status.FromError(err); ok { - return nil, err - } - - return nil, status.Errorf(codes.Unauthenticated, "transport: %v", err) - } - for k, v := range data { - // Capital header names are illegal in HTTP/2. - k = strings.ToLower(k) - authData[k] = v - } - } - return authData, nil -} - -func (t *http2Client) getCallAuthData(ctx context.Context, audience string, callHdr *CallHdr) (map[string]string, error) { - var callAuthData map[string]string - // Check if credentials.PerRPCCredentials were provided via call options. - // Note: if these credentials are provided both via dial options and call - // options, then both sets of credentials will be applied. - if callCreds := callHdr.Creds; callCreds != nil { - if !t.isSecure && callCreds.RequireTransportSecurity() { - return nil, status.Error(codes.Unauthenticated, "transport: cannot send secure credentials on an insecure connection") - } - data, err := callCreds.GetRequestMetadata(ctx, audience) - if err != nil { - return nil, status.Errorf(codes.Internal, "transport: %v", err) - } - callAuthData = make(map[string]string, len(data)) - for k, v := range data { - // Capital header names are illegal in HTTP/2 - k = strings.ToLower(k) - callAuthData[k] = v - } - } - return callAuthData, nil -} - -// PerformedIOError wraps an error to indicate IO may have been performed -// before the error occurred. -type PerformedIOError struct { - Err error -} - -// Error implements error. -func (p PerformedIOError) Error() string { - return p.Err.Error() -} - -// NewStream creates a stream and registers it into the transport as "active" -// streams. -func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { - ctx = peer.NewContext(ctx, t.getPeer()) - headerFields, err := t.createHeaderFields(ctx, callHdr) - if err != nil { - // We may have performed I/O in the per-RPC creds callback, so do not - // allow transparent retry. - return nil, PerformedIOError{err} - } - s := t.newStream(ctx, callHdr) - cleanup := func(err error) { - if s.swapState(streamDone) == streamDone { - // If it was already done, return. - return - } - // The stream was unprocessed by the server. - atomic.StoreUint32(&s.unprocessed, 1) - s.write(recvMsg{err: err}) - close(s.done) - // If headerChan isn't closed, then close it. - if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { - close(s.headerChan) - } - } - hdr := &headerFrame{ - hf: headerFields, - endStream: false, - initStream: func(id uint32) error { - t.mu.Lock() - if state := t.state; state != reachable { - t.mu.Unlock() - // Do a quick cleanup. - err := error(errStreamDrain) - if state == closing { - err = ErrConnClosing - } - cleanup(err) - return err - } - t.activeStreams[id] = s - if channelz.IsOn() { - atomic.AddInt64(&t.czData.streamsStarted, 1) - atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) - } - // If the keepalive goroutine has gone dormant, wake it up. - if t.kpDormant { - t.kpDormancyCond.Signal() - } - t.mu.Unlock() - return nil - }, - onOrphaned: cleanup, - wq: s.wq, - } - firstTry := true - var ch chan struct{} - checkForStreamQuota := func(it interface{}) bool { - if t.streamQuota <= 0 { // Can go negative if server decreases it. - if firstTry { - t.waitingStreams++ - } - ch = t.streamsQuotaAvailable - return false - } - if !firstTry { - t.waitingStreams-- - } - t.streamQuota-- - h := it.(*headerFrame) - h.streamID = t.nextID - t.nextID += 2 - s.id = h.streamID - s.fc = &inFlow{limit: uint32(t.initialWindowSize)} - if t.streamQuota > 0 && t.waitingStreams > 0 { - select { - case t.streamsQuotaAvailable <- struct{}{}: - default: - } - } - return true - } - var hdrListSizeErr error - checkForHeaderListSize := func(it interface{}) bool { - if t.maxSendHeaderListSize == nil { - return true - } - hdrFrame := it.(*headerFrame) - var sz int64 - for _, f := range hdrFrame.hf { - if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { - hdrListSizeErr = status.Errorf(codes.Internal, "header list size to send violates the maximum size (%d bytes) set by server", *t.maxSendHeaderListSize) - return false - } - } - return true - } - for { - success, err := t.controlBuf.executeAndPut(func(it interface{}) bool { - if !checkForStreamQuota(it) { - return false - } - if !checkForHeaderListSize(it) { - return false - } - return true - }, hdr) - if err != nil { - return nil, err - } - if success { - break - } - if hdrListSizeErr != nil { - return nil, hdrListSizeErr - } - firstTry = false - select { - case <-ch: - case <-s.ctx.Done(): - return nil, ContextErr(s.ctx.Err()) - case <-t.goAway: - return nil, errStreamDrain - case <-t.ctx.Done(): - return nil, ErrConnClosing - } - } - if t.statsHandler != nil { - header, ok := metadata.FromOutgoingContext(ctx) - if ok { - header.Set("user-agent", t.userAgent) - } else { - header = metadata.Pairs("user-agent", t.userAgent) - } - // Note: The header fields are compressed with hpack after this call returns. - // No WireLength field is set here. - outHeader := &stats.OutHeader{ - Client: true, - FullMethod: callHdr.Method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: callHdr.SendCompress, - Header: header, - } - t.statsHandler.HandleRPC(s.ctx, outHeader) - } - return s, nil -} - -// CloseStream clears the footprint of a stream when the stream is not needed any more. -// This must not be executed in reader's goroutine. -func (t *http2Client) CloseStream(s *Stream, err error) { - var ( - rst bool - rstCode http2.ErrCode - ) - if err != nil { - rst = true - rstCode = http2.ErrCodeCancel - } - t.closeStream(s, err, rst, rstCode, status.Convert(err), nil, false) -} - -func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2.ErrCode, st *status.Status, mdata map[string][]string, eosReceived bool) { - // Set stream status to done. - if s.swapState(streamDone) == streamDone { - // If it was already done, return. If multiple closeStream calls - // happen simultaneously, wait for the first to finish. - <-s.done - return - } - // status and trailers can be updated here without any synchronization because the stream goroutine will - // only read it after it sees an io.EOF error from read or write and we'll write those errors - // only after updating this. - s.status = st - if len(mdata) > 0 { - s.trailer = mdata - } - if err != nil { - // This will unblock reads eventually. - s.write(recvMsg{err: err}) - } - // If headerChan isn't closed, then close it. - if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { - s.noHeaders = true - close(s.headerChan) - } - cleanup := &cleanupStream{ - streamID: s.id, - onWrite: func() { - t.mu.Lock() - if t.activeStreams != nil { - delete(t.activeStreams, s.id) - } - t.mu.Unlock() - if channelz.IsOn() { - if eosReceived { - atomic.AddInt64(&t.czData.streamsSucceeded, 1) - } else { - atomic.AddInt64(&t.czData.streamsFailed, 1) - } - } - }, - rst: rst, - rstCode: rstCode, - } - addBackStreamQuota := func(interface{}) bool { - t.streamQuota++ - if t.streamQuota > 0 && t.waitingStreams > 0 { - select { - case t.streamsQuotaAvailable <- struct{}{}: - default: - } - } - return true - } - t.controlBuf.executeAndPut(addBackStreamQuota, cleanup) - // This will unblock write. - close(s.done) -} - -// Close kicks off the shutdown process of the transport. This should be called -// only once on a transport. Once it is called, the transport should not be -// accessed any more. -// -// This method blocks until the addrConn that initiated this transport is -// re-connected. This happens because t.onClose() begins reconnect logic at the -// addrConn level and blocks until the addrConn is successfully connected. -func (t *http2Client) Close() error { - t.mu.Lock() - // Make sure we only Close once. - if t.state == closing { - t.mu.Unlock() - return nil - } - // Call t.onClose before setting the state to closing to prevent the client - // from attempting to create new streams ASAP. - t.onClose() - t.state = closing - streams := t.activeStreams - t.activeStreams = nil - if t.kpDormant { - // If the keepalive goroutine is blocked on this condition variable, we - // should unblock it so that the goroutine eventually exits. - t.kpDormancyCond.Signal() - } - t.mu.Unlock() - t.controlBuf.finish() - t.cancel() - err := t.conn.Close() - if channelz.IsOn() { - channelz.RemoveEntry(t.channelzID) - } - // Notify all active streams. - for _, s := range streams { - t.closeStream(s, ErrConnClosing, false, http2.ErrCodeNo, status.New(codes.Unavailable, ErrConnClosing.Desc), nil, false) - } - if t.statsHandler != nil { - connEnd := &stats.ConnEnd{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connEnd) - } - return err -} - -// GracefulClose sets the state to draining, which prevents new streams from -// being created and causes the transport to be closed when the last active -// stream is closed. If there are no active streams, the transport is closed -// immediately. This does nothing if the transport is already draining or -// closing. -func (t *http2Client) GracefulClose() { - t.mu.Lock() - // Make sure we move to draining only from active. - if t.state == draining || t.state == closing { - t.mu.Unlock() - return - } - t.state = draining - active := len(t.activeStreams) - t.mu.Unlock() - if active == 0 { - t.Close() - return - } - t.controlBuf.put(&incomingGoAway{}) -} - -// Write formats the data into HTTP2 data frame(s) and sends it out. The caller -// should proceed only if Write returns nil. -func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - if opts.Last { - // If it's the last message, update stream state. - if !s.compareAndSwapState(streamActive, streamWriteDone) { - return errStreamDone - } - } else if s.getState() != streamActive { - return errStreamDone - } - df := &dataFrame{ - streamID: s.id, - endStream: opts.Last, - h: hdr, - d: data, - } - if hdr != nil || data != nil { // If it's not an empty data frame, check quota. - if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { - return err - } - } - return t.controlBuf.put(df) -} - -func (t *http2Client) getStream(f http2.Frame) *Stream { - t.mu.Lock() - s := t.activeStreams[f.Header().StreamID] - t.mu.Unlock() - return s -} - -// adjustWindow sends out extra window update over the initial window size -// of stream if the application is requesting data larger in size than -// the window. -func (t *http2Client) adjustWindow(s *Stream, n uint32) { - if w := s.fc.maybeAdjust(n); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, increment: w}) - } -} - -// updateWindow adjusts the inbound quota for the stream. -// Window updates will be sent out when the cumulative quota -// exceeds the corresponding threshold. -func (t *http2Client) updateWindow(s *Stream, n uint32) { - if w := s.fc.onRead(n); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, increment: w}) - } -} - -// updateFlowControl updates the incoming flow control windows -// for the transport and the stream based on the current bdp -// estimation. -func (t *http2Client) updateFlowControl(n uint32) { - t.mu.Lock() - for _, s := range t.activeStreams { - s.fc.newLimit(n) - } - t.mu.Unlock() - updateIWS := func(interface{}) bool { - t.initialWindowSize = int32(n) - return true - } - t.controlBuf.executeAndPut(updateIWS, &outgoingWindowUpdate{streamID: 0, increment: t.fc.newLimit(n)}) - t.controlBuf.put(&outgoingSettings{ - ss: []http2.Setting{ - { - ID: http2.SettingInitialWindowSize, - Val: n, - }, - }, - }) -} - -func (t *http2Client) handleData(f *http2.DataFrame) { - size := f.Header().Length - var sendBDPPing bool - if t.bdpEst != nil { - sendBDPPing = t.bdpEst.add(size) - } - // Decouple connection's flow control from application's read. - // An update on connection's flow control should not depend on - // whether user application has read the data or not. Such a - // restriction is already imposed on the stream's flow control, - // and therefore the sender will be blocked anyways. - // Decoupling the connection flow control will prevent other - // active(fast) streams from starving in presence of slow or - // inactive streams. - // - if w := t.fc.onData(size); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{ - streamID: 0, - increment: w, - }) - } - if sendBDPPing { - // Avoid excessive ping detection (e.g. in an L7 proxy) - // by sending a window update prior to the BDP ping. - - if w := t.fc.reset(); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{ - streamID: 0, - increment: w, - }) - } - - t.controlBuf.put(bdpPing) - } - // Select the right stream to dispatch. - s := t.getStream(f) - if s == nil { - return - } - if size > 0 { - if err := s.fc.onData(size); err != nil { - t.closeStream(s, io.EOF, true, http2.ErrCodeFlowControl, status.New(codes.Internal, err.Error()), nil, false) - return - } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(size - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{s.id, w}) - } - } - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - buffer := t.bufferPool.get() - buffer.Reset() - buffer.Write(f.Data()) - s.write(recvMsg{buffer: buffer}) - } - } - // The server has closed the stream without sending trailers. Record that - // the read direction is closed, and set the status appropriately. - if f.FrameHeader.Flags.Has(http2.FlagDataEndStream) { - t.closeStream(s, io.EOF, false, http2.ErrCodeNo, status.New(codes.Internal, "server closed the stream without sending trailers"), nil, true) - } -} - -func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { - s := t.getStream(f) - if s == nil { - return - } - if f.ErrCode == http2.ErrCodeRefusedStream { - // The stream was unprocessed by the server. - atomic.StoreUint32(&s.unprocessed, 1) - } - statusCode, ok := http2ErrConvTab[f.ErrCode] - if !ok { - warningf("transport: http2Client.handleRSTStream found no mapped gRPC status for the received http2 error %v", f.ErrCode) - statusCode = codes.Unknown - } - if statusCode == codes.Canceled { - if d, ok := s.ctx.Deadline(); ok && !d.After(time.Now()) { - // Our deadline was already exceeded, and that was likely the cause - // of this cancelation. Alter the status code accordingly. - statusCode = codes.DeadlineExceeded - } - } - t.closeStream(s, io.EOF, false, http2.ErrCodeNo, status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode), nil, false) -} - -func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { - if f.IsAck() { - return - } - var maxStreams *uint32 - var ss []http2.Setting - var updateFuncs []func() - f.ForeachSetting(func(s http2.Setting) error { - switch s.ID { - case http2.SettingMaxConcurrentStreams: - maxStreams = new(uint32) - *maxStreams = s.Val - case http2.SettingMaxHeaderListSize: - updateFuncs = append(updateFuncs, func() { - t.maxSendHeaderListSize = new(uint32) - *t.maxSendHeaderListSize = s.Val - }) - default: - ss = append(ss, s) - } - return nil - }) - if isFirst && maxStreams == nil { - maxStreams = new(uint32) - *maxStreams = math.MaxUint32 - } - sf := &incomingSettings{ - ss: ss, - } - if maxStreams != nil { - updateStreamQuota := func() { - delta := int64(*maxStreams) - int64(t.maxConcurrentStreams) - t.maxConcurrentStreams = *maxStreams - t.streamQuota += delta - if delta > 0 && t.waitingStreams > 0 { - close(t.streamsQuotaAvailable) // wake all of them up. - t.streamsQuotaAvailable = make(chan struct{}, 1) - } - } - updateFuncs = append(updateFuncs, updateStreamQuota) - } - t.controlBuf.executeAndPut(func(interface{}) bool { - for _, f := range updateFuncs { - f() - } - return true - }, sf) -} - -func (t *http2Client) handlePing(f *http2.PingFrame) { - if f.IsAck() { - // Maybe it's a BDP ping. - if t.bdpEst != nil { - t.bdpEst.calculate(f.Data) - } - return - } - pingAck := &ping{ack: true} - copy(pingAck.data[:], f.Data[:]) - t.controlBuf.put(pingAck) -} - -func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - return - } - if f.ErrCode == http2.ErrCodeEnhanceYourCalm { - infof("Client received GoAway with http2.ErrCodeEnhanceYourCalm.") - } - id := f.LastStreamID - if id > 0 && id%2 != 1 { - t.mu.Unlock() - t.Close() - return - } - // A client can receive multiple GoAways from the server (see - // https://github.com/grpc/grpc-go/issues/1387). The idea is that the first - // GoAway will be sent with an ID of MaxInt32 and the second GoAway will be - // sent after an RTT delay with the ID of the last stream the server will - // process. - // - // Therefore, when we get the first GoAway we don't necessarily close any - // streams. While in case of second GoAway we close all streams created after - // the GoAwayId. This way streams that were in-flight while the GoAway from - // server was being sent don't get killed. - select { - case <-t.goAway: // t.goAway has been closed (i.e.,multiple GoAways). - // If there are multiple GoAways the first one should always have an ID greater than the following ones. - if id > t.prevGoAwayID { - t.mu.Unlock() - t.Close() - return - } - default: - t.setGoAwayReason(f) - close(t.goAway) - t.controlBuf.put(&incomingGoAway{}) - // Notify the clientconn about the GOAWAY before we set the state to - // draining, to allow the client to stop attempting to create streams - // before disallowing new streams on this connection. - t.onGoAway(t.goAwayReason) - t.state = draining - } - // All streams with IDs greater than the GoAwayId - // and smaller than the previous GoAway ID should be killed. - upperLimit := t.prevGoAwayID - if upperLimit == 0 { // This is the first GoAway Frame. - upperLimit = math.MaxUint32 // Kill all streams after the GoAway ID. - } - for streamID, stream := range t.activeStreams { - if streamID > id && streamID <= upperLimit { - // The stream was unprocessed by the server. - atomic.StoreUint32(&stream.unprocessed, 1) - t.closeStream(stream, errStreamDrain, false, http2.ErrCodeNo, statusGoAway, nil, false) - } - } - t.prevGoAwayID = id - active := len(t.activeStreams) - t.mu.Unlock() - if active == 0 { - t.Close() - } -} - -// setGoAwayReason sets the value of t.goAwayReason based -// on the GoAway frame received. -// It expects a lock on transport's mutext to be held by -// the caller. -func (t *http2Client) setGoAwayReason(f *http2.GoAwayFrame) { - t.goAwayReason = GoAwayNoReason - switch f.ErrCode { - case http2.ErrCodeEnhanceYourCalm: - if string(f.DebugData()) == "too_many_pings" { - t.goAwayReason = GoAwayTooManyPings - } - } -} - -func (t *http2Client) GetGoAwayReason() GoAwayReason { - t.mu.Lock() - defer t.mu.Unlock() - return t.goAwayReason -} - -func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) { - t.controlBuf.put(&incomingWindowUpdate{ - streamID: f.Header().StreamID, - increment: f.Increment, - }) -} - -// operateHeaders takes action on the decoded headers. -func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { - s := t.getStream(frame) - if s == nil { - return - } - endStream := frame.StreamEnded() - atomic.StoreUint32(&s.bytesReceived, 1) - initialHeader := atomic.LoadUint32(&s.headerChanClosed) == 0 - - if !initialHeader && !endStream { - // As specified by gRPC over HTTP2, a HEADERS frame (and associated CONTINUATION frames) can only appear at the start or end of a stream. Therefore, second HEADERS frame must have EOS bit set. - st := status.New(codes.Internal, "a HEADERS frame cannot appear in the middle of a stream") - t.closeStream(s, st.Err(), true, http2.ErrCodeProtocol, st, nil, false) - return - } - - state := &decodeState{} - // Initialize isGRPC value to be !initialHeader, since if a gRPC Response-Headers has already been received, then it means that the peer is speaking gRPC and we are in gRPC mode. - state.data.isGRPC = !initialHeader - if err := state.decodeHeader(frame); err != nil { - t.closeStream(s, err, true, http2.ErrCodeProtocol, status.Convert(err), nil, endStream) - return - } - - isHeader := false - defer func() { - if t.statsHandler != nil { - if isHeader { - inHeader := &stats.InHeader{ - Client: true, - WireLength: int(frame.Header().Length), - Header: s.header.Copy(), - Compression: s.recvCompress, - } - t.statsHandler.HandleRPC(s.ctx, inHeader) - } else { - inTrailer := &stats.InTrailer{ - Client: true, - WireLength: int(frame.Header().Length), - Trailer: s.trailer.Copy(), - } - t.statsHandler.HandleRPC(s.ctx, inTrailer) - } - } - }() - - // If headerChan hasn't been closed yet - if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { - s.headerValid = true - if !endStream { - // HEADERS frame block carries a Response-Headers. - isHeader = true - // These values can be set without any synchronization because - // stream goroutine will read it only after seeing a closed - // headerChan which we'll close after setting this. - s.recvCompress = state.data.encoding - if len(state.data.mdata) > 0 { - s.header = state.data.mdata - } - } else { - // HEADERS frame block carries a Trailers-Only. - s.noHeaders = true - } - close(s.headerChan) - } - - if !endStream { - return - } - - // if client received END_STREAM from server while stream was still active, send RST_STREAM - rst := s.getState() == streamActive - t.closeStream(s, io.EOF, rst, http2.ErrCodeNo, state.status(), state.data.mdata, true) -} - -// reader runs as a separate goroutine in charge of reading data from network -// connection. -// -// TODO(zhaoq): currently one reader per transport. Investigate whether this is -// optimal. -// TODO(zhaoq): Check the validity of the incoming frame sequence. -func (t *http2Client) reader() { - defer close(t.readerDone) - // Check the validity of server preface. - frame, err := t.framer.fr.ReadFrame() - if err != nil { - t.Close() // this kicks off resetTransport, so must be last before return - return - } - t.conn.SetReadDeadline(time.Time{}) // reset deadline once we get the settings frame (we didn't time out, yay!) - if t.keepaliveEnabled { - atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) - } - sf, ok := frame.(*http2.SettingsFrame) - if !ok { - t.Close() // this kicks off resetTransport, so must be last before return - return - } - t.onPrefaceReceipt() - t.handleSettings(sf, true) - - // loop to keep reading incoming messages on this transport. - for { - t.controlBuf.throttle() - frame, err := t.framer.fr.ReadFrame() - if t.keepaliveEnabled { - atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) - } - if err != nil { - // Abort an active stream if the http2.Framer returns a - // http2.StreamError. This can happen only if the server's response - // is malformed http2. - if se, ok := err.(http2.StreamError); ok { - t.mu.Lock() - s := t.activeStreams[se.StreamID] - t.mu.Unlock() - if s != nil { - // use error detail to provide better err message - code := http2ErrConvTab[se.Code] - msg := t.framer.fr.ErrorDetail().Error() - t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false) - } - continue - } else { - // Transport error. - t.Close() - return - } - } - switch frame := frame.(type) { - case *http2.MetaHeadersFrame: - t.operateHeaders(frame) - case *http2.DataFrame: - t.handleData(frame) - case *http2.RSTStreamFrame: - t.handleRSTStream(frame) - case *http2.SettingsFrame: - t.handleSettings(frame, false) - case *http2.PingFrame: - t.handlePing(frame) - case *http2.GoAwayFrame: - t.handleGoAway(frame) - case *http2.WindowUpdateFrame: - t.handleWindowUpdate(frame) - default: - errorf("transport: http2Client.reader got unhandled frame type %v.", frame) - } - } -} - -func minTime(a, b time.Duration) time.Duration { - if a < b { - return a - } - return b -} - -// keepalive running in a separate goroutune makes sure the connection is alive by sending pings. -func (t *http2Client) keepalive() { - p := &ping{data: [8]byte{}} - // True iff a ping has been sent, and no data has been received since then. - outstandingPing := false - // Amount of time remaining before which we should receive an ACK for the - // last sent ping. - timeoutLeft := time.Duration(0) - // Records the last value of t.lastRead before we go block on the timer. - // This is required to check for read activity since then. - prevNano := time.Now().UnixNano() - timer := time.NewTimer(t.kp.Time) - for { - select { - case <-timer.C: - lastRead := atomic.LoadInt64(&t.lastRead) - if lastRead > prevNano { - // There has been read activity since the last time we were here. - outstandingPing = false - // Next timer should fire at kp.Time seconds from lastRead time. - timer.Reset(time.Duration(lastRead) + t.kp.Time - time.Duration(time.Now().UnixNano())) - prevNano = lastRead - continue - } - if outstandingPing && timeoutLeft <= 0 { - t.Close() - return - } - t.mu.Lock() - if t.state == closing { - // If the transport is closing, we should exit from the - // keepalive goroutine here. If not, we could have a race - // between the call to Signal() from Close() and the call to - // Wait() here, whereby the keepalive goroutine ends up - // blocking on the condition variable which will never be - // signalled again. - t.mu.Unlock() - return - } - if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { - // If a ping was sent out previously (because there were active - // streams at that point) which wasn't acked and its timeout - // hadn't fired, but we got here and are about to go dormant, - // we should make sure that we unconditionally send a ping once - // we awaken. - outstandingPing = false - t.kpDormant = true - t.kpDormancyCond.Wait() - } - t.kpDormant = false - t.mu.Unlock() - - // We get here either because we were dormant and a new stream was - // created which unblocked the Wait() call, or because the - // keepalive timer expired. In both cases, we need to send a ping. - if !outstandingPing { - if channelz.IsOn() { - atomic.AddInt64(&t.czData.kpCount, 1) - } - t.controlBuf.put(p) - timeoutLeft = t.kp.Timeout - outstandingPing = true - } - // The amount of time to sleep here is the minimum of kp.Time and - // timeoutLeft. This will ensure that we wait only for kp.Time - // before sending out the next ping (for cases where the ping is - // acked). - sleepDuration := minTime(t.kp.Time, timeoutLeft) - timeoutLeft -= sleepDuration - timer.Reset(sleepDuration) - case <-t.ctx.Done(): - if !timer.Stop() { - <-timer.C - } - return - } - } -} - -func (t *http2Client) Error() <-chan struct{} { - return t.ctx.Done() -} - -func (t *http2Client) GoAway() <-chan struct{} { - return t.goAway -} - -func (t *http2Client) ChannelzMetric() *channelz.SocketInternalMetric { - s := channelz.SocketInternalMetric{ - StreamsStarted: atomic.LoadInt64(&t.czData.streamsStarted), - StreamsSucceeded: atomic.LoadInt64(&t.czData.streamsSucceeded), - StreamsFailed: atomic.LoadInt64(&t.czData.streamsFailed), - MessagesSent: atomic.LoadInt64(&t.czData.msgSent), - MessagesReceived: atomic.LoadInt64(&t.czData.msgRecv), - KeepAlivesSent: atomic.LoadInt64(&t.czData.kpCount), - LastLocalStreamCreatedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastStreamCreatedTime)), - LastMessageSentTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgSentTime)), - LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), - LocalFlowControlWindow: int64(t.fc.getSize()), - SocketOptions: channelz.GetSocketOption(t.conn), - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, - // RemoteName : - } - if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { - s.Security = au.GetSecurityValue() - } - s.RemoteFlowControlWindow = t.getOutFlowWindow() - return &s -} - -func (t *http2Client) RemoteAddr() net.Addr { return t.remoteAddr } - -func (t *http2Client) IncrMsgSent() { - atomic.AddInt64(&t.czData.msgSent, 1) - atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) -} - -func (t *http2Client) IncrMsgRecv() { - atomic.AddInt64(&t.czData.msgRecv, 1) - atomic.StoreInt64(&t.czData.lastMsgRecvTime, time.Now().UnixNano()) -} - -func (t *http2Client) getOutFlowWindow() int64 { - resp := make(chan uint32, 1) - timer := time.NewTimer(time.Second) - defer timer.Stop() - t.controlBuf.put(&outFlowControlSizeRequest{resp}) - select { - case sz := <-resp: - return int64(sz) - case <-t.ctxDone: - return -1 - case <-timer.C: - return -2 - } -} diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go deleted file mode 100644 index e8c757321..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ /dev/null @@ -1,1244 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 transport - -import ( - "bytes" - "context" - "errors" - "fmt" - "io" - "math" - "net" - "strconv" - "sync" - "sync/atomic" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/tap" -) - -var ( - // ErrIllegalHeaderWrite indicates that setting header is illegal because of - // the stream's state. - ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") - // ErrHeaderListSizeLimitViolation indicates that the header list size is larger - // than the limit set by peer. - ErrHeaderListSizeLimitViolation = errors.New("transport: trying to send header list size larger than the limit set by peer") -) - -// serverConnectionCounter counts the number of connections a server has seen -// (equal to the number of http2Servers created). Must be accessed atomically. -var serverConnectionCounter uint64 - -// http2Server implements the ServerTransport interface with HTTP2. -type http2Server struct { - lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. - ctx context.Context - done chan struct{} - conn net.Conn - loopy *loopyWriter - readerDone chan struct{} // sync point to enable testing. - writerDone chan struct{} // sync point to enable testing. - remoteAddr net.Addr - localAddr net.Addr - maxStreamID uint32 // max stream ID ever seen - authInfo credentials.AuthInfo // auth info about the connection - inTapHandle tap.ServerInHandle - framer *framer - // The max number of concurrent streams. - maxStreams uint32 - // controlBuf delivers all the control related tasks (e.g., window - // updates, reset streams, and various settings) to the controller. - controlBuf *controlBuffer - fc *trInFlow - stats stats.Handler - // Keepalive and max-age parameters for the server. - kp keepalive.ServerParameters - // Keepalive enforcement policy. - kep keepalive.EnforcementPolicy - // The time instance last ping was received. - lastPingAt time.Time - // Number of times the client has violated keepalive ping policy so far. - pingStrikes uint8 - // Flag to signify that number of ping strikes should be reset to 0. - // This is set whenever data or header frames are sent. - // 1 means yes. - resetPingStrikes uint32 // Accessed atomically. - initialWindowSize int32 - bdpEst *bdpEstimator - maxSendHeaderListSize *uint32 - - mu sync.Mutex // guard the following - - // drainChan is initialized when drain(...) is called the first time. - // After which the server writes out the first GoAway(with ID 2^31-1) frame. - // Then an independent goroutine will be launched to later send the second GoAway. - // During this time we don't want to write another first GoAway(with ID 2^31 -1) frame. - // Thus call to drain(...) will be a no-op if drainChan is already initialized since draining is - // already underway. - drainChan chan struct{} - state transportState - activeStreams map[uint32]*Stream - // idle is the time instant when the connection went idle. - // This is either the beginning of the connection or when the number of - // RPCs go down to 0. - // When the connection is busy, this value is set to 0. - idle time.Time - - // Fields below are for channelz metric collection. - channelzID int64 // channelz unique identification number - czData *channelzData - bufferPool *bufferPool - - connectionID uint64 -} - -// newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is -// returned if something goes wrong. -func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { - writeBufSize := config.WriteBufferSize - readBufSize := config.ReadBufferSize - maxHeaderListSize := defaultServerMaxHeaderListSize - if config.MaxHeaderListSize != nil { - maxHeaderListSize = *config.MaxHeaderListSize - } - framer := newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize) - // Send initial settings as connection preface to client. - isettings := []http2.Setting{{ - ID: http2.SettingMaxFrameSize, - Val: http2MaxFrameLen, - }} - // TODO(zhaoq): Have a better way to signal "no limit" because 0 is - // permitted in the HTTP2 spec. - maxStreams := config.MaxStreams - if maxStreams == 0 { - maxStreams = math.MaxUint32 - } else { - isettings = append(isettings, http2.Setting{ - ID: http2.SettingMaxConcurrentStreams, - Val: maxStreams, - }) - } - dynamicWindow := true - iwz := int32(initialWindowSize) - if config.InitialWindowSize >= defaultWindowSize { - iwz = config.InitialWindowSize - dynamicWindow = false - } - icwz := int32(initialWindowSize) - if config.InitialConnWindowSize >= defaultWindowSize { - icwz = config.InitialConnWindowSize - dynamicWindow = false - } - if iwz != defaultWindowSize { - isettings = append(isettings, http2.Setting{ - ID: http2.SettingInitialWindowSize, - Val: uint32(iwz)}) - } - if config.MaxHeaderListSize != nil { - isettings = append(isettings, http2.Setting{ - ID: http2.SettingMaxHeaderListSize, - Val: *config.MaxHeaderListSize, - }) - } - if config.HeaderTableSize != nil { - isettings = append(isettings, http2.Setting{ - ID: http2.SettingHeaderTableSize, - Val: *config.HeaderTableSize, - }) - } - if err := framer.fr.WriteSettings(isettings...); err != nil { - return nil, connectionErrorf(false, err, "transport: %v", err) - } - // Adjust the connection flow control window if needed. - if delta := uint32(icwz - defaultWindowSize); delta > 0 { - if err := framer.fr.WriteWindowUpdate(0, delta); err != nil { - return nil, connectionErrorf(false, err, "transport: %v", err) - } - } - kp := config.KeepaliveParams - if kp.MaxConnectionIdle == 0 { - kp.MaxConnectionIdle = defaultMaxConnectionIdle - } - if kp.MaxConnectionAge == 0 { - kp.MaxConnectionAge = defaultMaxConnectionAge - } - // Add a jitter to MaxConnectionAge. - kp.MaxConnectionAge += getJitter(kp.MaxConnectionAge) - if kp.MaxConnectionAgeGrace == 0 { - kp.MaxConnectionAgeGrace = defaultMaxConnectionAgeGrace - } - if kp.Time == 0 { - kp.Time = defaultServerKeepaliveTime - } - if kp.Timeout == 0 { - kp.Timeout = defaultServerKeepaliveTimeout - } - kep := config.KeepalivePolicy - if kep.MinTime == 0 { - kep.MinTime = defaultKeepalivePolicyMinTime - } - done := make(chan struct{}) - t := &http2Server{ - ctx: context.Background(), - done: done, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: config.AuthInfo, - framer: framer, - readerDone: make(chan struct{}), - writerDone: make(chan struct{}), - maxStreams: maxStreams, - inTapHandle: config.InTapHandle, - fc: &trInFlow{limit: uint32(icwz)}, - state: reachable, - activeStreams: make(map[uint32]*Stream), - stats: config.StatsHandler, - kp: kp, - idle: time.Now(), - kep: kep, - initialWindowSize: iwz, - czData: new(channelzData), - bufferPool: newBufferPool(), - } - t.controlBuf = newControlBuffer(t.done) - if dynamicWindow { - t.bdpEst = &bdpEstimator{ - bdp: initialWindowSize, - updateFlowControl: t.updateFlowControl, - } - } - if t.stats != nil { - t.ctx = t.stats.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{} - t.stats.HandleConn(t.ctx, connBegin) - } - if channelz.IsOn() { - t.channelzID = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.remoteAddr, t.localAddr)) - } - - t.connectionID = atomic.AddUint64(&serverConnectionCounter, 1) - - t.framer.writer.Flush() - - defer func() { - if err != nil { - t.Close() - } - }() - - // Check the validity of client preface. - preface := make([]byte, len(clientPreface)) - if _, err := io.ReadFull(t.conn, preface); err != nil { - return nil, connectionErrorf(false, err, "transport: http2Server.HandleStreams failed to receive the preface from client: %v", err) - } - if !bytes.Equal(preface, clientPreface) { - return nil, connectionErrorf(false, nil, "transport: http2Server.HandleStreams received bogus greeting from client: %q", preface) - } - - frame, err := t.framer.fr.ReadFrame() - if err == io.EOF || err == io.ErrUnexpectedEOF { - return nil, err - } - if err != nil { - return nil, connectionErrorf(false, err, "transport: http2Server.HandleStreams failed to read initial settings frame: %v", err) - } - atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) - sf, ok := frame.(*http2.SettingsFrame) - if !ok { - return nil, connectionErrorf(false, nil, "transport: http2Server.HandleStreams saw invalid preface type %T from client", frame) - } - t.handleSettings(sf) - - go func() { - t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst) - t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler - if err := t.loopy.run(); err != nil { - errorf("transport: loopyWriter.run returning. Err: %v", err) - } - t.conn.Close() - close(t.writerDone) - }() - go t.keepalive() - return t, nil -} - -// operateHeader takes action on the decoded headers. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (fatal bool) { - streamID := frame.Header().StreamID - state := &decodeState{ - serverSide: true, - } - if err := state.decodeHeader(frame); err != nil { - if se, ok := status.FromError(err); ok { - t.controlBuf.put(&cleanupStream{ - streamID: streamID, - rst: true, - rstCode: statusCodeConvTab[se.Code()], - onWrite: func() {}, - }) - } - return false - } - - buf := newRecvBuffer() - s := &Stream{ - id: streamID, - st: t, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - recvCompress: state.data.encoding, - method: state.data.method, - contentSubtype: state.data.contentSubtype, - } - if frame.StreamEnded() { - // s is just created by the caller. No lock needed. - s.state = streamReadDone - } - if state.data.timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, state.data.timeout) - } else { - s.ctx, s.cancel = context.WithCancel(t.ctx) - } - pr := &peer.Peer{ - Addr: t.remoteAddr, - } - // Attach Auth info if there is any. - if t.authInfo != nil { - pr.AuthInfo = t.authInfo - } - s.ctx = peer.NewContext(s.ctx, pr) - // Attach the received metadata to the context. - if len(state.data.mdata) > 0 { - s.ctx = metadata.NewIncomingContext(s.ctx, state.data.mdata) - } - if state.data.statsTags != nil { - s.ctx = stats.SetIncomingTags(s.ctx, state.data.statsTags) - } - if state.data.statsTrace != nil { - s.ctx = stats.SetIncomingTrace(s.ctx, state.data.statsTrace) - } - if t.inTapHandle != nil { - var err error - info := &tap.Info{ - FullMethodName: state.data.method, - } - s.ctx, err = t.inTapHandle(s.ctx, info) - if err != nil { - warningf("transport: http2Server.operateHeaders got an error from InTapHandle: %v", err) - t.controlBuf.put(&cleanupStream{ - streamID: s.id, - rst: true, - rstCode: http2.ErrCodeRefusedStream, - onWrite: func() {}, - }) - s.cancel() - return false - } - } - t.mu.Lock() - if t.state != reachable { - t.mu.Unlock() - s.cancel() - return false - } - if uint32(len(t.activeStreams)) >= t.maxStreams { - t.mu.Unlock() - t.controlBuf.put(&cleanupStream{ - streamID: streamID, - rst: true, - rstCode: http2.ErrCodeRefusedStream, - onWrite: func() {}, - }) - s.cancel() - return false - } - if streamID%2 != 1 || streamID <= t.maxStreamID { - t.mu.Unlock() - // illegal gRPC stream id. - errorf("transport: http2Server.HandleStreams received an illegal stream id: %v", streamID) - s.cancel() - return true - } - t.maxStreamID = streamID - t.activeStreams[streamID] = s - if len(t.activeStreams) == 1 { - t.idle = time.Time{} - } - t.mu.Unlock() - if channelz.IsOn() { - atomic.AddInt64(&t.czData.streamsStarted, 1) - atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) - } - s.requestRead = func(n int) { - t.adjustWindow(s, uint32(n)) - } - s.ctx = traceCtx(s.ctx, s.method) - if t.stats != nil { - s.ctx = t.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: s.recvCompress, - WireLength: int(frame.Header().Length), - Header: metadata.MD(state.data.mdata).Copy(), - } - t.stats.HandleRPC(s.ctx, inHeader) - } - s.ctxDone = s.ctx.Done() - s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) - s.trReader = &transportReader{ - reader: &recvBufferReader{ - ctx: s.ctx, - ctxDone: s.ctxDone, - recv: s.buf, - freeBuffer: t.bufferPool.put, - }, - windowHandler: func(n int) { - t.updateWindow(s, uint32(n)) - }, - } - // Register the stream with loopy. - t.controlBuf.put(®isterStream{ - streamID: s.id, - wq: s.wq, - }) - handle(s) - return false -} - -// HandleStreams receives incoming streams using the given handler. This is -// typically run in a separate goroutine. -// traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { - defer close(t.readerDone) - for { - t.controlBuf.throttle() - frame, err := t.framer.fr.ReadFrame() - atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) - if err != nil { - if se, ok := err.(http2.StreamError); ok { - warningf("transport: http2Server.HandleStreams encountered http2.StreamError: %v", se) - t.mu.Lock() - s := t.activeStreams[se.StreamID] - t.mu.Unlock() - if s != nil { - t.closeStream(s, true, se.Code, false) - } else { - t.controlBuf.put(&cleanupStream{ - streamID: se.StreamID, - rst: true, - rstCode: se.Code, - onWrite: func() {}, - }) - } - continue - } - if err == io.EOF || err == io.ErrUnexpectedEOF { - t.Close() - return - } - warningf("transport: http2Server.HandleStreams failed to read frame: %v", err) - t.Close() - return - } - switch frame := frame.(type) { - case *http2.MetaHeadersFrame: - if t.operateHeaders(frame, handle, traceCtx) { - t.Close() - break - } - case *http2.DataFrame: - t.handleData(frame) - case *http2.RSTStreamFrame: - t.handleRSTStream(frame) - case *http2.SettingsFrame: - t.handleSettings(frame) - case *http2.PingFrame: - t.handlePing(frame) - case *http2.WindowUpdateFrame: - t.handleWindowUpdate(frame) - case *http2.GoAwayFrame: - // TODO: Handle GoAway from the client appropriately. - default: - errorf("transport: http2Server.HandleStreams found unhandled frame type %v.", frame) - } - } -} - -func (t *http2Server) getStream(f http2.Frame) (*Stream, bool) { - t.mu.Lock() - defer t.mu.Unlock() - if t.activeStreams == nil { - // The transport is closing. - return nil, false - } - s, ok := t.activeStreams[f.Header().StreamID] - if !ok { - // The stream is already done. - return nil, false - } - return s, true -} - -// adjustWindow sends out extra window update over the initial window size -// of stream if the application is requesting data larger in size than -// the window. -func (t *http2Server) adjustWindow(s *Stream, n uint32) { - if w := s.fc.maybeAdjust(n); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, increment: w}) - } - -} - -// updateWindow adjusts the inbound quota for the stream and the transport. -// Window updates will deliver to the controller for sending when -// the cumulative quota exceeds the corresponding threshold. -func (t *http2Server) updateWindow(s *Stream, n uint32) { - if w := s.fc.onRead(n); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{streamID: s.id, - increment: w, - }) - } -} - -// updateFlowControl updates the incoming flow control windows -// for the transport and the stream based on the current bdp -// estimation. -func (t *http2Server) updateFlowControl(n uint32) { - t.mu.Lock() - for _, s := range t.activeStreams { - s.fc.newLimit(n) - } - t.initialWindowSize = int32(n) - t.mu.Unlock() - t.controlBuf.put(&outgoingWindowUpdate{ - streamID: 0, - increment: t.fc.newLimit(n), - }) - t.controlBuf.put(&outgoingSettings{ - ss: []http2.Setting{ - { - ID: http2.SettingInitialWindowSize, - Val: n, - }, - }, - }) - -} - -func (t *http2Server) handleData(f *http2.DataFrame) { - size := f.Header().Length - var sendBDPPing bool - if t.bdpEst != nil { - sendBDPPing = t.bdpEst.add(size) - } - // Decouple connection's flow control from application's read. - // An update on connection's flow control should not depend on - // whether user application has read the data or not. Such a - // restriction is already imposed on the stream's flow control, - // and therefore the sender will be blocked anyways. - // Decoupling the connection flow control will prevent other - // active(fast) streams from starving in presence of slow or - // inactive streams. - if w := t.fc.onData(size); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{ - streamID: 0, - increment: w, - }) - } - if sendBDPPing { - // Avoid excessive ping detection (e.g. in an L7 proxy) - // by sending a window update prior to the BDP ping. - if w := t.fc.reset(); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{ - streamID: 0, - increment: w, - }) - } - t.controlBuf.put(bdpPing) - } - // Select the right stream to dispatch. - s, ok := t.getStream(f) - if !ok { - return - } - if size > 0 { - if err := s.fc.onData(size); err != nil { - t.closeStream(s, true, http2.ErrCodeFlowControl, false) - return - } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(size - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&outgoingWindowUpdate{s.id, w}) - } - } - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - buffer := t.bufferPool.get() - buffer.Reset() - buffer.Write(f.Data()) - s.write(recvMsg{buffer: buffer}) - } - } - if f.Header().Flags.Has(http2.FlagDataEndStream) { - // Received the end of stream from the client. - s.compareAndSwapState(streamActive, streamReadDone) - s.write(recvMsg{err: io.EOF}) - } -} - -func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { - // If the stream is not deleted from the transport's active streams map, then do a regular close stream. - if s, ok := t.getStream(f); ok { - t.closeStream(s, false, 0, false) - return - } - // If the stream is already deleted from the active streams map, then put a cleanupStream item into controlbuf to delete the stream from loopy writer's established streams map. - t.controlBuf.put(&cleanupStream{ - streamID: f.Header().StreamID, - rst: false, - rstCode: 0, - onWrite: func() {}, - }) -} - -func (t *http2Server) handleSettings(f *http2.SettingsFrame) { - if f.IsAck() { - return - } - var ss []http2.Setting - var updateFuncs []func() - f.ForeachSetting(func(s http2.Setting) error { - switch s.ID { - case http2.SettingMaxHeaderListSize: - updateFuncs = append(updateFuncs, func() { - t.maxSendHeaderListSize = new(uint32) - *t.maxSendHeaderListSize = s.Val - }) - default: - ss = append(ss, s) - } - return nil - }) - t.controlBuf.executeAndPut(func(interface{}) bool { - for _, f := range updateFuncs { - f() - } - return true - }, &incomingSettings{ - ss: ss, - }) -} - -const ( - maxPingStrikes = 2 - defaultPingTimeout = 2 * time.Hour -) - -func (t *http2Server) handlePing(f *http2.PingFrame) { - if f.IsAck() { - if f.Data == goAwayPing.data && t.drainChan != nil { - close(t.drainChan) - return - } - // Maybe it's a BDP ping. - if t.bdpEst != nil { - t.bdpEst.calculate(f.Data) - } - return - } - pingAck := &ping{ack: true} - copy(pingAck.data[:], f.Data[:]) - t.controlBuf.put(pingAck) - - now := time.Now() - defer func() { - t.lastPingAt = now - }() - // A reset ping strikes means that we don't need to check for policy - // violation for this ping and the pingStrikes counter should be set - // to 0. - if atomic.CompareAndSwapUint32(&t.resetPingStrikes, 1, 0) { - t.pingStrikes = 0 - return - } - t.mu.Lock() - ns := len(t.activeStreams) - t.mu.Unlock() - if ns < 1 && !t.kep.PermitWithoutStream { - // Keepalive shouldn't be active thus, this new ping should - // have come after at least defaultPingTimeout. - if t.lastPingAt.Add(defaultPingTimeout).After(now) { - t.pingStrikes++ - } - } else { - // Check if keepalive policy is respected. - if t.lastPingAt.Add(t.kep.MinTime).After(now) { - t.pingStrikes++ - } - } - - if t.pingStrikes > maxPingStrikes { - // Send goaway and close the connection. - errorf("transport: Got too many pings from the client, closing the connection.") - t.controlBuf.put(&goAway{code: http2.ErrCodeEnhanceYourCalm, debugData: []byte("too_many_pings"), closeConn: true}) - } -} - -func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) { - t.controlBuf.put(&incomingWindowUpdate{ - streamID: f.Header().StreamID, - increment: f.Increment, - }) -} - -func appendHeaderFieldsFromMD(headerFields []hpack.HeaderField, md metadata.MD) []hpack.HeaderField { - for k, vv := range md { - if isReservedHeader(k) { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - return headerFields -} - -func (t *http2Server) checkForHeaderListSize(it interface{}) bool { - if t.maxSendHeaderListSize == nil { - return true - } - hdrFrame := it.(*headerFrame) - var sz int64 - for _, f := range hdrFrame.hf { - if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { - errorf("header list size to send violates the maximum size (%d bytes) set by client", *t.maxSendHeaderListSize) - return false - } - } - return true -} - -// WriteHeader sends the header metadata md back to the client. -func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { - if s.updateHeaderSent() || s.getState() == streamDone { - return ErrIllegalHeaderWrite - } - s.hdrMu.Lock() - if md.Len() > 0 { - if s.header.Len() > 0 { - s.header = metadata.Join(s.header, md) - } else { - s.header = md - } - } - if err := t.writeHeaderLocked(s); err != nil { - s.hdrMu.Unlock() - return err - } - s.hdrMu.Unlock() - return nil -} - -func (t *http2Server) setResetPingStrikes() { - atomic.StoreUint32(&t.resetPingStrikes, 1) -} - -func (t *http2Server) writeHeaderLocked(s *Stream) error { - // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields - // first and create a slice of that exact size. - headerFields := make([]hpack.HeaderField, 0, 2) // at least :status, content-type will be there if none else. - headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) - if s.sendCompress != "" { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) - } - headerFields = appendHeaderFieldsFromMD(headerFields, s.header) - success, err := t.controlBuf.executeAndPut(t.checkForHeaderListSize, &headerFrame{ - streamID: s.id, - hf: headerFields, - endStream: false, - onWrite: t.setResetPingStrikes, - }) - if !success { - if err != nil { - return err - } - t.closeStream(s, true, http2.ErrCodeInternal, false) - return ErrHeaderListSizeLimitViolation - } - if t.stats != nil { - // Note: Headers are compressed with hpack after this call returns. - // No WireLength field is set here. - outHeader := &stats.OutHeader{ - Header: s.header.Copy(), - Compression: s.sendCompress, - } - t.stats.HandleRPC(s.Context(), outHeader) - } - return nil -} - -// WriteStatus sends stream status to the client and terminates the stream. -// There is no further I/O operations being able to perform on this stream. -// TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early -// OK is adopted. -func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { - if s.getState() == streamDone { - return nil - } - s.hdrMu.Lock() - // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields - // first and create a slice of that exact size. - headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else. - if !s.updateHeaderSent() { // No headers have been sent. - if len(s.header) > 0 { // Send a separate header frame. - if err := t.writeHeaderLocked(s); err != nil { - s.hdrMu.Unlock() - return err - } - } else { // Send a trailer only response. - headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) - } - } - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) - - if p := st.Proto(); p != nil && len(p.Details) > 0 { - stBytes, err := proto.Marshal(p) - if err != nil { - // TODO: return error instead, when callers are able to handle it. - grpclog.Errorf("transport: failed to marshal rpc status: %v, error: %v", p, err) - } else { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) - } - } - - // Attach the trailer metadata. - headerFields = appendHeaderFieldsFromMD(headerFields, s.trailer) - trailingHeader := &headerFrame{ - streamID: s.id, - hf: headerFields, - endStream: true, - onWrite: t.setResetPingStrikes, - } - s.hdrMu.Unlock() - success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader) - if !success { - if err != nil { - return err - } - t.closeStream(s, true, http2.ErrCodeInternal, false) - return ErrHeaderListSizeLimitViolation - } - // Send a RST_STREAM after the trailers if the client has not already half-closed. - rst := s.getState() == streamActive - t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true) - if t.stats != nil { - // Note: The trailer fields are compressed with hpack after this call returns. - // No WireLength field is set here. - t.stats.HandleRPC(s.Context(), &stats.OutTrailer{ - Trailer: s.trailer.Copy(), - }) - } - return nil -} - -// Write converts the data into HTTP2 data frame and sends it out. Non-nil error -// is returns if it fails (e.g., framing error, transport error). -func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - if !s.isHeaderSent() { // Headers haven't been written yet. - if err := t.WriteHeader(s, nil); err != nil { - if _, ok := err.(ConnectionError); ok { - return err - } - // TODO(mmukhi, dfawley): Make sure this is the right code to return. - return status.Errorf(codes.Internal, "transport: %v", err) - } - } else { - // Writing headers checks for this condition. - if s.getState() == streamDone { - // TODO(mmukhi, dfawley): Should the server write also return io.EOF? - s.cancel() - select { - case <-t.done: - return ErrConnClosing - default: - } - return ContextErr(s.ctx.Err()) - } - } - df := &dataFrame{ - streamID: s.id, - h: hdr, - d: data, - onEachWrite: t.setResetPingStrikes, - } - if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { - select { - case <-t.done: - return ErrConnClosing - default: - } - return ContextErr(s.ctx.Err()) - } - return t.controlBuf.put(df) -} - -// keepalive running in a separate goroutine does the following: -// 1. Gracefully closes an idle connection after a duration of keepalive.MaxConnectionIdle. -// 2. Gracefully closes any connection after a duration of keepalive.MaxConnectionAge. -// 3. Forcibly closes a connection after an additive period of keepalive.MaxConnectionAgeGrace over keepalive.MaxConnectionAge. -// 4. Makes sure a connection is alive by sending pings with a frequency of keepalive.Time and closes a non-responsive connection -// after an additional duration of keepalive.Timeout. -func (t *http2Server) keepalive() { - p := &ping{} - // True iff a ping has been sent, and no data has been received since then. - outstandingPing := false - // Amount of time remaining before which we should receive an ACK for the - // last sent ping. - kpTimeoutLeft := time.Duration(0) - // Records the last value of t.lastRead before we go block on the timer. - // This is required to check for read activity since then. - prevNano := time.Now().UnixNano() - // Initialize the different timers to their default values. - idleTimer := time.NewTimer(t.kp.MaxConnectionIdle) - ageTimer := time.NewTimer(t.kp.MaxConnectionAge) - kpTimer := time.NewTimer(t.kp.Time) - defer func() { - // We need to drain the underlying channel in these timers after a call - // to Stop(), only if we are interested in resetting them. Clearly we - // are not interested in resetting them here. - idleTimer.Stop() - ageTimer.Stop() - kpTimer.Stop() - }() - - for { - select { - case <-idleTimer.C: - t.mu.Lock() - idle := t.idle - if idle.IsZero() { // The connection is non-idle. - t.mu.Unlock() - idleTimer.Reset(t.kp.MaxConnectionIdle) - continue - } - val := t.kp.MaxConnectionIdle - time.Since(idle) - t.mu.Unlock() - if val <= 0 { - // The connection has been idle for a duration of keepalive.MaxConnectionIdle or more. - // Gracefully close the connection. - t.drain(http2.ErrCodeNo, []byte{}) - return - } - idleTimer.Reset(val) - case <-ageTimer.C: - t.drain(http2.ErrCodeNo, []byte{}) - ageTimer.Reset(t.kp.MaxConnectionAgeGrace) - select { - case <-ageTimer.C: - // Close the connection after grace period. - infof("transport: closing server transport due to maximum connection age.") - t.Close() - case <-t.done: - } - return - case <-kpTimer.C: - lastRead := atomic.LoadInt64(&t.lastRead) - if lastRead > prevNano { - // There has been read activity since the last time we were - // here. Setup the timer to fire at kp.Time seconds from - // lastRead time and continue. - outstandingPing = false - kpTimer.Reset(time.Duration(lastRead) + t.kp.Time - time.Duration(time.Now().UnixNano())) - prevNano = lastRead - continue - } - if outstandingPing && kpTimeoutLeft <= 0 { - infof("transport: closing server transport due to idleness.") - t.Close() - return - } - if !outstandingPing { - if channelz.IsOn() { - atomic.AddInt64(&t.czData.kpCount, 1) - } - t.controlBuf.put(p) - kpTimeoutLeft = t.kp.Timeout - outstandingPing = true - } - // The amount of time to sleep here is the minimum of kp.Time and - // timeoutLeft. This will ensure that we wait only for kp.Time - // before sending out the next ping (for cases where the ping is - // acked). - sleepDuration := minTime(t.kp.Time, kpTimeoutLeft) - kpTimeoutLeft -= sleepDuration - kpTimer.Reset(sleepDuration) - case <-t.done: - return - } - } -} - -// Close starts shutting down the http2Server transport. -// TODO(zhaoq): Now the destruction is not blocked on any pending streams. This -// could cause some resource issue. Revisit this later. -func (t *http2Server) Close() error { - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - return errors.New("transport: Close() was already called") - } - t.state = closing - streams := t.activeStreams - t.activeStreams = nil - t.mu.Unlock() - t.controlBuf.finish() - close(t.done) - err := t.conn.Close() - if channelz.IsOn() { - channelz.RemoveEntry(t.channelzID) - } - // Cancel all active streams. - for _, s := range streams { - s.cancel() - } - if t.stats != nil { - connEnd := &stats.ConnEnd{} - t.stats.HandleConn(t.ctx, connEnd) - } - return err -} - -// deleteStream deletes the stream s from transport's active streams. -func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { - // In case stream sending and receiving are invoked in separate - // goroutines (e.g., bi-directional streaming), cancel needs to be - // called to interrupt the potential blocking on other goroutines. - s.cancel() - - t.mu.Lock() - if _, ok := t.activeStreams[s.id]; ok { - delete(t.activeStreams, s.id) - if len(t.activeStreams) == 0 { - t.idle = time.Now() - } - } - t.mu.Unlock() - - if channelz.IsOn() { - if eosReceived { - atomic.AddInt64(&t.czData.streamsSucceeded, 1) - } else { - atomic.AddInt64(&t.czData.streamsFailed, 1) - } - } -} - -// finishStream closes the stream and puts the trailing headerFrame into controlbuf. -func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { - oldState := s.swapState(streamDone) - if oldState == streamDone { - // If the stream was already done, return. - return - } - - hdr.cleanup = &cleanupStream{ - streamID: s.id, - rst: rst, - rstCode: rstCode, - onWrite: func() { - t.deleteStream(s, eosReceived) - }, - } - t.controlBuf.put(hdr) -} - -// closeStream clears the footprint of a stream when the stream is not needed any more. -func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eosReceived bool) { - s.swapState(streamDone) - t.deleteStream(s, eosReceived) - - t.controlBuf.put(&cleanupStream{ - streamID: s.id, - rst: rst, - rstCode: rstCode, - onWrite: func() {}, - }) -} - -func (t *http2Server) RemoteAddr() net.Addr { - return t.remoteAddr -} - -func (t *http2Server) Drain() { - t.drain(http2.ErrCodeNo, []byte{}) -} - -func (t *http2Server) drain(code http2.ErrCode, debugData []byte) { - t.mu.Lock() - defer t.mu.Unlock() - if t.drainChan != nil { - return - } - t.drainChan = make(chan struct{}) - t.controlBuf.put(&goAway{code: code, debugData: debugData, headsUp: true}) -} - -var goAwayPing = &ping{data: [8]byte{1, 6, 1, 8, 0, 3, 3, 9}} - -// Handles outgoing GoAway and returns true if loopy needs to put itself -// in draining mode. -func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) { - t.mu.Lock() - if t.state == closing { // TODO(mmukhi): This seems unnecessary. - t.mu.Unlock() - // The transport is closing. - return false, ErrConnClosing - } - sid := t.maxStreamID - if !g.headsUp { - // Stop accepting more streams now. - t.state = draining - if len(t.activeStreams) == 0 { - g.closeConn = true - } - t.mu.Unlock() - if err := t.framer.fr.WriteGoAway(sid, g.code, g.debugData); err != nil { - return false, err - } - if g.closeConn { - // Abruptly close the connection following the GoAway (via - // loopywriter). But flush out what's inside the buffer first. - t.framer.writer.Flush() - return false, fmt.Errorf("transport: Connection closing") - } - return true, nil - } - t.mu.Unlock() - // For a graceful close, send out a GoAway with stream ID of MaxUInt32, - // Follow that with a ping and wait for the ack to come back or a timer - // to expire. During this time accept new streams since they might have - // originated before the GoAway reaches the client. - // After getting the ack or timer expiration send out another GoAway this - // time with an ID of the max stream server intends to process. - if err := t.framer.fr.WriteGoAway(math.MaxUint32, http2.ErrCodeNo, []byte{}); err != nil { - return false, err - } - if err := t.framer.fr.WritePing(false, goAwayPing.data); err != nil { - return false, err - } - go func() { - timer := time.NewTimer(time.Minute) - defer timer.Stop() - select { - case <-t.drainChan: - case <-timer.C: - case <-t.done: - return - } - t.controlBuf.put(&goAway{code: g.code, debugData: g.debugData}) - }() - return false, nil -} - -func (t *http2Server) ChannelzMetric() *channelz.SocketInternalMetric { - s := channelz.SocketInternalMetric{ - StreamsStarted: atomic.LoadInt64(&t.czData.streamsStarted), - StreamsSucceeded: atomic.LoadInt64(&t.czData.streamsSucceeded), - StreamsFailed: atomic.LoadInt64(&t.czData.streamsFailed), - MessagesSent: atomic.LoadInt64(&t.czData.msgSent), - MessagesReceived: atomic.LoadInt64(&t.czData.msgRecv), - KeepAlivesSent: atomic.LoadInt64(&t.czData.kpCount), - LastRemoteStreamCreatedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastStreamCreatedTime)), - LastMessageSentTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgSentTime)), - LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), - LocalFlowControlWindow: int64(t.fc.getSize()), - SocketOptions: channelz.GetSocketOption(t.conn), - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, - // RemoteName : - } - if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { - s.Security = au.GetSecurityValue() - } - s.RemoteFlowControlWindow = t.getOutFlowWindow() - return &s -} - -func (t *http2Server) IncrMsgSent() { - atomic.AddInt64(&t.czData.msgSent, 1) - atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) -} - -func (t *http2Server) IncrMsgRecv() { - atomic.AddInt64(&t.czData.msgRecv, 1) - atomic.StoreInt64(&t.czData.lastMsgRecvTime, time.Now().UnixNano()) -} - -func (t *http2Server) getOutFlowWindow() int64 { - resp := make(chan uint32, 1) - timer := time.NewTimer(time.Second) - defer timer.Stop() - t.controlBuf.put(&outFlowControlSizeRequest{resp}) - select { - case sz := <-resp: - return int64(sz) - case <-t.done: - return -1 - case <-timer.C: - return -2 - } -} - -func getJitter(v time.Duration) time.Duration { - if v == infinity { - return 0 - } - // Generate a jitter between +/- 10% of the value. - r := int64(v / 10) - j := grpcrand.Int63n(2*r) - r - return time.Duration(j) -} diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go deleted file mode 100644 index 8f5f3349d..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ /dev/null @@ -1,677 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 transport - -import ( - "bufio" - "bytes" - "encoding/base64" - "fmt" - "io" - "math" - "net" - "net/http" - "strconv" - "strings" - "time" - "unicode/utf8" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - spb "google.golang.org/genproto/googleapis/rpc/status" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -const ( - // http2MaxFrameLen specifies the max length of a HTTP2 frame. - http2MaxFrameLen = 16384 // 16KB frame - // http://http2.github.io/http2-spec/#SettingValues - http2InitHeaderTableSize = 4096 - // baseContentType is the base content-type for gRPC. This is a valid - // content-type on it's own, but can also include a content-subtype such as - // "proto" as a suffix after "+" or ";". See - // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests - // for more details. - baseContentType = "application/grpc" -) - -var ( - clientPreface = []byte(http2.ClientPreface) - http2ErrConvTab = map[http2.ErrCode]codes.Code{ - http2.ErrCodeNo: codes.Internal, - http2.ErrCodeProtocol: codes.Internal, - http2.ErrCodeInternal: codes.Internal, - http2.ErrCodeFlowControl: codes.ResourceExhausted, - http2.ErrCodeSettingsTimeout: codes.Internal, - http2.ErrCodeStreamClosed: codes.Internal, - http2.ErrCodeFrameSize: codes.Internal, - http2.ErrCodeRefusedStream: codes.Unavailable, - http2.ErrCodeCancel: codes.Canceled, - http2.ErrCodeCompression: codes.Internal, - http2.ErrCodeConnect: codes.Internal, - http2.ErrCodeEnhanceYourCalm: codes.ResourceExhausted, - http2.ErrCodeInadequateSecurity: codes.PermissionDenied, - http2.ErrCodeHTTP11Required: codes.Internal, - } - statusCodeConvTab = map[codes.Code]http2.ErrCode{ - codes.Internal: http2.ErrCodeInternal, - codes.Canceled: http2.ErrCodeCancel, - codes.Unavailable: http2.ErrCodeRefusedStream, - codes.ResourceExhausted: http2.ErrCodeEnhanceYourCalm, - codes.PermissionDenied: http2.ErrCodeInadequateSecurity, - } - // HTTPStatusConvTab is the HTTP status code to gRPC error code conversion table. - HTTPStatusConvTab = map[int]codes.Code{ - // 400 Bad Request - INTERNAL. - http.StatusBadRequest: codes.Internal, - // 401 Unauthorized - UNAUTHENTICATED. - http.StatusUnauthorized: codes.Unauthenticated, - // 403 Forbidden - PERMISSION_DENIED. - http.StatusForbidden: codes.PermissionDenied, - // 404 Not Found - UNIMPLEMENTED. - http.StatusNotFound: codes.Unimplemented, - // 429 Too Many Requests - UNAVAILABLE. - http.StatusTooManyRequests: codes.Unavailable, - // 502 Bad Gateway - UNAVAILABLE. - http.StatusBadGateway: codes.Unavailable, - // 503 Service Unavailable - UNAVAILABLE. - http.StatusServiceUnavailable: codes.Unavailable, - // 504 Gateway timeout - UNAVAILABLE. - http.StatusGatewayTimeout: codes.Unavailable, - } -) - -type parsedHeaderData struct { - encoding string - // statusGen caches the stream status received from the trailer the server - // sent. Client side only. Do not access directly. After all trailers are - // parsed, use the status method to retrieve the status. - statusGen *status.Status - // rawStatusCode and rawStatusMsg are set from the raw trailer fields and are not - // intended for direct access outside of parsing. - rawStatusCode *int - rawStatusMsg string - httpStatus *int - // Server side only fields. - timeoutSet bool - timeout time.Duration - method string - // key-value metadata map from the peer. - mdata map[string][]string - statsTags []byte - statsTrace []byte - contentSubtype string - - // isGRPC field indicates whether the peer is speaking gRPC (otherwise HTTP). - // - // We are in gRPC mode (peer speaking gRPC) if: - // * We are client side and have already received a HEADER frame that indicates gRPC peer. - // * The header contains valid a content-type, i.e. a string starts with "application/grpc" - // And we should handle error specific to gRPC. - // - // Otherwise (i.e. a content-type string starts without "application/grpc", or does not exist), we - // are in HTTP fallback mode, and should handle error specific to HTTP. - isGRPC bool - grpcErr error - httpErr error - contentTypeErr string -} - -// decodeState configures decoding criteria and records the decoded data. -type decodeState struct { - // whether decoding on server side or not - serverSide bool - - // Records the states during HPACK decoding. It will be filled with info parsed from HTTP HEADERS - // frame once decodeHeader function has been invoked and returned. - data parsedHeaderData -} - -// isReservedHeader checks whether hdr belongs to HTTP2 headers -// reserved by gRPC protocol. Any other headers are classified as the -// user-specified metadata. -func isReservedHeader(hdr string) bool { - if hdr != "" && hdr[0] == ':' { - return true - } - switch hdr { - case "content-type", - "user-agent", - "grpc-message-type", - "grpc-encoding", - "grpc-message", - "grpc-status", - "grpc-timeout", - "grpc-status-details-bin", - // Intentionally exclude grpc-previous-rpc-attempts and - // grpc-retry-pushback-ms, which are "reserved", but their API - // intentionally works via metadata. - "te": - return true - default: - return false - } -} - -// isWhitelistedHeader checks whether hdr should be propagated into metadata -// visible to users, even though it is classified as "reserved", above. -func isWhitelistedHeader(hdr string) bool { - switch hdr { - case ":authority", "user-agent": - return true - default: - return false - } -} - -// contentSubtype returns the content-subtype for the given content-type. The -// given content-type must be a valid content-type that starts with -// "application/grpc". A content-subtype will follow "application/grpc" after a -// "+" or ";". See -// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for -// more details. -// -// If contentType is not a valid content-type for gRPC, the boolean -// will be false, otherwise true. If content-type == "application/grpc", -// "application/grpc+", or "application/grpc;", the boolean will be true, -// but no content-subtype will be returned. -// -// contentType is assumed to be lowercase already. -func contentSubtype(contentType string) (string, bool) { - if contentType == baseContentType { - return "", true - } - if !strings.HasPrefix(contentType, baseContentType) { - return "", false - } - // guaranteed since != baseContentType and has baseContentType prefix - switch contentType[len(baseContentType)] { - case '+', ';': - // this will return true for "application/grpc+" or "application/grpc;" - // which the previous validContentType function tested to be valid, so we - // just say that no content-subtype is specified in this case - return contentType[len(baseContentType)+1:], true - default: - return "", false - } -} - -// contentSubtype is assumed to be lowercase -func contentType(contentSubtype string) string { - if contentSubtype == "" { - return baseContentType - } - return baseContentType + "+" + contentSubtype -} - -func (d *decodeState) status() *status.Status { - if d.data.statusGen == nil { - // No status-details were provided; generate status using code/msg. - d.data.statusGen = status.New(codes.Code(int32(*(d.data.rawStatusCode))), d.data.rawStatusMsg) - } - return d.data.statusGen -} - -const binHdrSuffix = "-bin" - -func encodeBinHeader(v []byte) string { - return base64.RawStdEncoding.EncodeToString(v) -} - -func decodeBinHeader(v string) ([]byte, error) { - if len(v)%4 == 0 { - // Input was padded, or padding was not necessary. - return base64.StdEncoding.DecodeString(v) - } - return base64.RawStdEncoding.DecodeString(v) -} - -func encodeMetadataHeader(k, v string) string { - if strings.HasSuffix(k, binHdrSuffix) { - return encodeBinHeader(([]byte)(v)) - } - return v -} - -func decodeMetadataHeader(k, v string) (string, error) { - if strings.HasSuffix(k, binHdrSuffix) { - b, err := decodeBinHeader(v) - return string(b), err - } - return v, nil -} - -func (d *decodeState) decodeHeader(frame *http2.MetaHeadersFrame) error { - // frame.Truncated is set to true when framer detects that the current header - // list size hits MaxHeaderListSize limit. - if frame.Truncated { - return status.Error(codes.Internal, "peer header list size exceeded limit") - } - - for _, hf := range frame.Fields { - d.processHeaderField(hf) - } - - if d.data.isGRPC { - if d.data.grpcErr != nil { - return d.data.grpcErr - } - if d.serverSide { - return nil - } - if d.data.rawStatusCode == nil && d.data.statusGen == nil { - // gRPC status doesn't exist. - // Set rawStatusCode to be unknown and return nil error. - // So that, if the stream has ended this Unknown status - // will be propagated to the user. - // Otherwise, it will be ignored. In which case, status from - // a later trailer, that has StreamEnded flag set, is propagated. - code := int(codes.Unknown) - d.data.rawStatusCode = &code - } - return nil - } - - // HTTP fallback mode - if d.data.httpErr != nil { - return d.data.httpErr - } - - var ( - code = codes.Internal // when header does not include HTTP status, return INTERNAL - ok bool - ) - - if d.data.httpStatus != nil { - code, ok = HTTPStatusConvTab[*(d.data.httpStatus)] - if !ok { - code = codes.Unknown - } - } - - return status.Error(code, d.constructHTTPErrMsg()) -} - -// constructErrMsg constructs error message to be returned in HTTP fallback mode. -// Format: HTTP status code and its corresponding message + content-type error message. -func (d *decodeState) constructHTTPErrMsg() string { - var errMsgs []string - - if d.data.httpStatus == nil { - errMsgs = append(errMsgs, "malformed header: missing HTTP status") - } else { - errMsgs = append(errMsgs, fmt.Sprintf("%s: HTTP status code %d", http.StatusText(*(d.data.httpStatus)), *d.data.httpStatus)) - } - - if d.data.contentTypeErr == "" { - errMsgs = append(errMsgs, "transport: missing content-type field") - } else { - errMsgs = append(errMsgs, d.data.contentTypeErr) - } - - return strings.Join(errMsgs, "; ") -} - -func (d *decodeState) addMetadata(k, v string) { - if d.data.mdata == nil { - d.data.mdata = make(map[string][]string) - } - d.data.mdata[k] = append(d.data.mdata[k], v) -} - -func (d *decodeState) processHeaderField(f hpack.HeaderField) { - switch f.Name { - case "content-type": - contentSubtype, validContentType := contentSubtype(f.Value) - if !validContentType { - d.data.contentTypeErr = fmt.Sprintf("transport: received the unexpected content-type %q", f.Value) - return - } - d.data.contentSubtype = contentSubtype - // TODO: do we want to propagate the whole content-type in the metadata, - // or come up with a way to just propagate the content-subtype if it was set? - // ie {"content-type": "application/grpc+proto"} or {"content-subtype": "proto"} - // in the metadata? - d.addMetadata(f.Name, f.Value) - d.data.isGRPC = true - case "grpc-encoding": - d.data.encoding = f.Value - case "grpc-status": - code, err := strconv.Atoi(f.Value) - if err != nil { - d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-status: %v", err) - return - } - d.data.rawStatusCode = &code - case "grpc-message": - d.data.rawStatusMsg = decodeGrpcMessage(f.Value) - case "grpc-status-details-bin": - v, err := decodeBinHeader(f.Value) - if err != nil { - d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) - return - } - s := &spb.Status{} - if err := proto.Unmarshal(v, s); err != nil { - d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) - return - } - d.data.statusGen = status.FromProto(s) - case "grpc-timeout": - d.data.timeoutSet = true - var err error - if d.data.timeout, err = decodeTimeout(f.Value); err != nil { - d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed time-out: %v", err) - } - case ":path": - d.data.method = f.Value - case ":status": - code, err := strconv.Atoi(f.Value) - if err != nil { - d.data.httpErr = status.Errorf(codes.Internal, "transport: malformed http-status: %v", err) - return - } - d.data.httpStatus = &code - case "grpc-tags-bin": - v, err := decodeBinHeader(f.Value) - if err != nil { - d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-tags-bin: %v", err) - return - } - d.data.statsTags = v - d.addMetadata(f.Name, string(v)) - case "grpc-trace-bin": - v, err := decodeBinHeader(f.Value) - if err != nil { - d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-trace-bin: %v", err) - return - } - d.data.statsTrace = v - d.addMetadata(f.Name, string(v)) - default: - if isReservedHeader(f.Name) && !isWhitelistedHeader(f.Name) { - break - } - v, err := decodeMetadataHeader(f.Name, f.Value) - if err != nil { - errorf("Failed to decode metadata header (%q, %q): %v", f.Name, f.Value, err) - return - } - d.addMetadata(f.Name, v) - } -} - -type timeoutUnit uint8 - -const ( - hour timeoutUnit = 'H' - minute timeoutUnit = 'M' - second timeoutUnit = 'S' - millisecond timeoutUnit = 'm' - microsecond timeoutUnit = 'u' - nanosecond timeoutUnit = 'n' -) - -func timeoutUnitToDuration(u timeoutUnit) (d time.Duration, ok bool) { - switch u { - case hour: - return time.Hour, true - case minute: - return time.Minute, true - case second: - return time.Second, true - case millisecond: - return time.Millisecond, true - case microsecond: - return time.Microsecond, true - case nanosecond: - return time.Nanosecond, true - default: - } - return -} - -const maxTimeoutValue int64 = 100000000 - 1 - -// div does integer division and round-up the result. Note that this is -// equivalent to (d+r-1)/r but has less chance to overflow. -func div(d, r time.Duration) int64 { - if m := d % r; m > 0 { - return int64(d/r + 1) - } - return int64(d / r) -} - -// TODO(zhaoq): It is the simplistic and not bandwidth efficient. Improve it. -func encodeTimeout(t time.Duration) string { - if t <= 0 { - return "0n" - } - if d := div(t, time.Nanosecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "n" - } - if d := div(t, time.Microsecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "u" - } - if d := div(t, time.Millisecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "m" - } - if d := div(t, time.Second); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "S" - } - if d := div(t, time.Minute); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "M" - } - // Note that maxTimeoutValue * time.Hour > MaxInt64. - return strconv.FormatInt(div(t, time.Hour), 10) + "H" -} - -func decodeTimeout(s string) (time.Duration, error) { - size := len(s) - if size < 2 { - return 0, fmt.Errorf("transport: timeout string is too short: %q", s) - } - if size > 9 { - // Spec allows for 8 digits plus the unit. - return 0, fmt.Errorf("transport: timeout string is too long: %q", s) - } - unit := timeoutUnit(s[size-1]) - d, ok := timeoutUnitToDuration(unit) - if !ok { - return 0, fmt.Errorf("transport: timeout unit is not recognized: %q", s) - } - t, err := strconv.ParseInt(s[:size-1], 10, 64) - if err != nil { - return 0, err - } - const maxHours = math.MaxInt64 / int64(time.Hour) - if d == time.Hour && t > maxHours { - // This timeout would overflow math.MaxInt64; clamp it. - return time.Duration(math.MaxInt64), nil - } - return d * time.Duration(t), nil -} - -const ( - spaceByte = ' ' - tildeByte = '~' - percentByte = '%' -) - -// encodeGrpcMessage is used to encode status code in header field -// "grpc-message". It does percent encoding and also replaces invalid utf-8 -// characters with Unicode replacement character. -// -// It checks to see if each individual byte in msg is an allowable byte, and -// then either percent encoding or passing it through. When percent encoding, -// the byte is converted into hexadecimal notation with a '%' prepended. -func encodeGrpcMessage(msg string) string { - if msg == "" { - return "" - } - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if !(c >= spaceByte && c <= tildeByte && c != percentByte) { - return encodeGrpcMessageUnchecked(msg) - } - } - return msg -} - -func encodeGrpcMessageUnchecked(msg string) string { - var buf bytes.Buffer - for len(msg) > 0 { - r, size := utf8.DecodeRuneInString(msg) - for _, b := range []byte(string(r)) { - if size > 1 { - // If size > 1, r is not ascii. Always do percent encoding. - buf.WriteString(fmt.Sprintf("%%%02X", b)) - continue - } - - // The for loop is necessary even if size == 1. r could be - // utf8.RuneError. - // - // fmt.Sprintf("%%%02X", utf8.RuneError) gives "%FFFD". - if b >= spaceByte && b <= tildeByte && b != percentByte { - buf.WriteByte(b) - } else { - buf.WriteString(fmt.Sprintf("%%%02X", b)) - } - } - msg = msg[size:] - } - return buf.String() -} - -// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage. -func decodeGrpcMessage(msg string) string { - if msg == "" { - return "" - } - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - if msg[i] == percentByte && i+2 < lenMsg { - return decodeGrpcMessageUnchecked(msg) - } - } - return msg -} - -func decodeGrpcMessageUnchecked(msg string) string { - var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c == percentByte && i+2 < lenMsg { - parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8) - if err != nil { - buf.WriteByte(c) - } else { - buf.WriteByte(byte(parsed)) - i += 2 - } - } else { - buf.WriteByte(c) - } - } - return buf.String() -} - -type bufWriter struct { - buf []byte - offset int - batchSize int - conn net.Conn - err error - - onFlush func() -} - -func newBufWriter(conn net.Conn, batchSize int) *bufWriter { - return &bufWriter{ - buf: make([]byte, batchSize*2), - batchSize: batchSize, - conn: conn, - } -} - -func (w *bufWriter) Write(b []byte) (n int, err error) { - if w.err != nil { - return 0, w.err - } - if w.batchSize == 0 { // Buffer has been disabled. - return w.conn.Write(b) - } - for len(b) > 0 { - nn := copy(w.buf[w.offset:], b) - b = b[nn:] - w.offset += nn - n += nn - if w.offset >= w.batchSize { - err = w.Flush() - } - } - return n, err -} - -func (w *bufWriter) Flush() error { - if w.err != nil { - return w.err - } - if w.offset == 0 { - return nil - } - if w.onFlush != nil { - w.onFlush() - } - _, w.err = w.conn.Write(w.buf[:w.offset]) - w.offset = 0 - return w.err -} - -type framer struct { - writer *bufWriter - fr *http2.Framer -} - -func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderListSize uint32) *framer { - if writeBufferSize < 0 { - writeBufferSize = 0 - } - var r io.Reader = conn - if readBufferSize > 0 { - r = bufio.NewReaderSize(r, readBufferSize) - } - w := newBufWriter(conn, writeBufferSize) - f := &framer{ - writer: w, - fr: http2.NewFramer(w, r), - } - f.fr.SetMaxReadFrameSize(http2MaxFrameLen) - // Opt-in to Frame reuse API on framer to reduce garbage. - // Frames aren't safe to read from after a subsequent call to ReadFrame. - f.fr.SetReuseFrames() - f.fr.MaxHeaderListSize = maxHeaderListSize - f.fr.ReadMetaHeaders = hpack.NewDecoder(http2InitHeaderTableSize, nil) - return f -} diff --git a/vendor/google.golang.org/grpc/internal/transport/log.go b/vendor/google.golang.org/grpc/internal/transport/log.go deleted file mode 100644 index 879df80c4..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/log.go +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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. - * - */ - -// This file contains wrappers for grpclog functions. -// The transport package only logs to verbose level 2 by default. - -package transport - -import "google.golang.org/grpc/grpclog" - -const logLevel = 2 - -func infof(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Infof(format, args...) - } -} - -func warningf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Warningf(format, args...) - } -} - -func errorf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Errorf(format, args...) - } -} diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go deleted file mode 100644 index 1ffd96ff4..000000000 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ /dev/null @@ -1,802 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 transport defines and implements message oriented communication -// channel to complete various transactions (e.g., an RPC). It is meant for -// grpc-internal usage and is not intended to be imported directly by users. -package transport - -import ( - "bytes" - "context" - "errors" - "fmt" - "io" - "net" - "sync" - "sync/atomic" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/tap" -) - -type bufferPool struct { - pool sync.Pool -} - -func newBufferPool() *bufferPool { - return &bufferPool{ - pool: sync.Pool{ - New: func() interface{} { - return new(bytes.Buffer) - }, - }, - } -} - -func (p *bufferPool) get() *bytes.Buffer { - return p.pool.Get().(*bytes.Buffer) -} - -func (p *bufferPool) put(b *bytes.Buffer) { - p.pool.Put(b) -} - -// recvMsg represents the received msg from the transport. All transport -// protocol specific info has been removed. -type recvMsg struct { - buffer *bytes.Buffer - // nil: received some data - // io.EOF: stream is completed. data is nil. - // other non-nil error: transport failure. data is nil. - err error -} - -// recvBuffer is an unbounded channel of recvMsg structs. -// -// Note: recvBuffer differs from buffer.Unbounded only in the fact that it -// holds a channel of recvMsg structs instead of objects implementing "item" -// interface. recvBuffer is written to much more often and using strict recvMsg -// structs helps avoid allocation in "recvBuffer.put" -type recvBuffer struct { - c chan recvMsg - mu sync.Mutex - backlog []recvMsg - err error -} - -func newRecvBuffer() *recvBuffer { - b := &recvBuffer{ - c: make(chan recvMsg, 1), - } - return b -} - -func (b *recvBuffer) put(r recvMsg) { - b.mu.Lock() - if b.err != nil { - b.mu.Unlock() - // An error had occurred earlier, don't accept more - // data or errors. - return - } - b.err = r.err - if len(b.backlog) == 0 { - select { - case b.c <- r: - b.mu.Unlock() - return - default: - } - } - b.backlog = append(b.backlog, r) - b.mu.Unlock() -} - -func (b *recvBuffer) load() { - b.mu.Lock() - if len(b.backlog) > 0 { - select { - case b.c <- b.backlog[0]: - b.backlog[0] = recvMsg{} - b.backlog = b.backlog[1:] - default: - } - } - b.mu.Unlock() -} - -// get returns the channel that receives a recvMsg in the buffer. -// -// Upon receipt of a recvMsg, the caller should call load to send another -// recvMsg onto the channel if there is any. -func (b *recvBuffer) get() <-chan recvMsg { - return b.c -} - -// recvBufferReader implements io.Reader interface to read the data from -// recvBuffer. -type recvBufferReader struct { - closeStream func(error) // Closes the client transport stream with the given error and nil trailer metadata. - ctx context.Context - ctxDone <-chan struct{} // cache of ctx.Done() (for performance). - recv *recvBuffer - last *bytes.Buffer // Stores the remaining data in the previous calls. - err error - freeBuffer func(*bytes.Buffer) -} - -// Read reads the next len(p) bytes from last. If last is drained, it tries to -// read additional data from recv. It blocks if there no additional data available -// in recv. If Read returns any non-nil error, it will continue to return that error. -func (r *recvBufferReader) Read(p []byte) (n int, err error) { - if r.err != nil { - return 0, r.err - } - if r.last != nil { - // Read remaining data left in last call. - copied, _ := r.last.Read(p) - if r.last.Len() == 0 { - r.freeBuffer(r.last) - r.last = nil - } - return copied, nil - } - if r.closeStream != nil { - n, r.err = r.readClient(p) - } else { - n, r.err = r.read(p) - } - return n, r.err -} - -func (r *recvBufferReader) read(p []byte) (n int, err error) { - select { - case <-r.ctxDone: - return 0, ContextErr(r.ctx.Err()) - case m := <-r.recv.get(): - return r.readAdditional(m, p) - } -} - -func (r *recvBufferReader) readClient(p []byte) (n int, err error) { - // If the context is canceled, then closes the stream with nil metadata. - // closeStream writes its error parameter to r.recv as a recvMsg. - // r.readAdditional acts on that message and returns the necessary error. - select { - case <-r.ctxDone: - // Note that this adds the ctx error to the end of recv buffer, and - // reads from the head. This will delay the error until recv buffer is - // empty, thus will delay ctx cancellation in Recv(). - // - // It's done this way to fix a race between ctx cancel and trailer. The - // race was, stream.Recv() may return ctx error if ctxDone wins the - // race, but stream.Trailer() may return a non-nil md because the stream - // was not marked as done when trailer is received. This closeStream - // call will mark stream as done, thus fix the race. - // - // TODO: delaying ctx error seems like a unnecessary side effect. What - // we really want is to mark the stream as done, and return ctx error - // faster. - r.closeStream(ContextErr(r.ctx.Err())) - m := <-r.recv.get() - return r.readAdditional(m, p) - case m := <-r.recv.get(): - return r.readAdditional(m, p) - } -} - -func (r *recvBufferReader) readAdditional(m recvMsg, p []byte) (n int, err error) { - r.recv.load() - if m.err != nil { - return 0, m.err - } - copied, _ := m.buffer.Read(p) - if m.buffer.Len() == 0 { - r.freeBuffer(m.buffer) - r.last = nil - } else { - r.last = m.buffer - } - return copied, nil -} - -type streamState uint32 - -const ( - streamActive streamState = iota - streamWriteDone // EndStream sent - streamReadDone // EndStream received - streamDone // the entire stream is finished. -) - -// Stream represents an RPC in the transport layer. -type Stream struct { - id uint32 - st ServerTransport // nil for client side Stream - ct *http2Client // nil for server side Stream - ctx context.Context // the associated context of the stream - cancel context.CancelFunc // always nil for client side Stream - done chan struct{} // closed at the end of stream to unblock writers. On the client side. - ctxDone <-chan struct{} // same as done chan but for server side. Cache of ctx.Done() (for performance) - method string // the associated RPC method of the stream - recvCompress string - sendCompress string - buf *recvBuffer - trReader io.Reader - fc *inFlow - wq *writeQuota - - // Callback to state application's intentions to read data. This - // is used to adjust flow control, if needed. - requestRead func(int) - - headerChan chan struct{} // closed to indicate the end of header metadata. - headerChanClosed uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. - // headerValid indicates whether a valid header was received. Only - // meaningful after headerChan is closed (always call waitOnHeader() before - // reading its value). Not valid on server side. - headerValid bool - - // hdrMu protects header and trailer metadata on the server-side. - hdrMu sync.Mutex - // On client side, header keeps the received header metadata. - // - // On server side, header keeps the header set by SetHeader(). The complete - // header will merged into this after t.WriteHeader() is called. - header metadata.MD - trailer metadata.MD // the key-value map of trailer metadata. - - noHeaders bool // set if the client never received headers (set only after the stream is done). - - // On the server-side, headerSent is atomically set to 1 when the headers are sent out. - headerSent uint32 - - state streamState - - // On client-side it is the status error received from the server. - // On server-side it is unused. - status *status.Status - - bytesReceived uint32 // indicates whether any bytes have been received on this stream - unprocessed uint32 // set if the server sends a refused stream or GOAWAY including this stream - - // contentSubtype is the content-subtype for requests. - // this must be lowercase or the behavior is undefined. - contentSubtype string -} - -// isHeaderSent is only valid on the server-side. -func (s *Stream) isHeaderSent() bool { - return atomic.LoadUint32(&s.headerSent) == 1 -} - -// updateHeaderSent updates headerSent and returns true -// if it was alreay set. It is valid only on server-side. -func (s *Stream) updateHeaderSent() bool { - return atomic.SwapUint32(&s.headerSent, 1) == 1 -} - -func (s *Stream) swapState(st streamState) streamState { - return streamState(atomic.SwapUint32((*uint32)(&s.state), uint32(st))) -} - -func (s *Stream) compareAndSwapState(oldState, newState streamState) bool { - return atomic.CompareAndSwapUint32((*uint32)(&s.state), uint32(oldState), uint32(newState)) -} - -func (s *Stream) getState() streamState { - return streamState(atomic.LoadUint32((*uint32)(&s.state))) -} - -func (s *Stream) waitOnHeader() { - if s.headerChan == nil { - // On the server headerChan is always nil since a stream originates - // only after having received headers. - return - } - select { - case <-s.ctx.Done(): - // Close the stream to prevent headers/trailers from changing after - // this function returns. - s.ct.CloseStream(s, ContextErr(s.ctx.Err())) - // headerChan could possibly not be closed yet if closeStream raced - // with operateHeaders; wait until it is closed explicitly here. - <-s.headerChan - case <-s.headerChan: - } -} - -// RecvCompress returns the compression algorithm applied to the inbound -// message. It is empty string if there is no compression applied. -func (s *Stream) RecvCompress() string { - s.waitOnHeader() - return s.recvCompress -} - -// SetSendCompress sets the compression algorithm to the stream. -func (s *Stream) SetSendCompress(str string) { - s.sendCompress = str -} - -// Done returns a channel which is closed when it receives the final status -// from the server. -func (s *Stream) Done() <-chan struct{} { - return s.done -} - -// Header returns the header metadata of the stream. -// -// On client side, it acquires the key-value pairs of header metadata once it is -// available. It blocks until i) the metadata is ready or ii) there is no header -// metadata or iii) the stream is canceled/expired. -// -// On server side, it returns the out header after t.WriteHeader is called. It -// does not block and must not be called until after WriteHeader. -func (s *Stream) Header() (metadata.MD, error) { - if s.headerChan == nil { - // On server side, return the header in stream. It will be the out - // header after t.WriteHeader is called. - return s.header.Copy(), nil - } - s.waitOnHeader() - if !s.headerValid { - return nil, s.status.Err() - } - return s.header.Copy(), nil -} - -// TrailersOnly blocks until a header or trailers-only frame is received and -// then returns true if the stream was trailers-only. If the stream ends -// before headers are received, returns true, nil. Client-side only. -func (s *Stream) TrailersOnly() bool { - s.waitOnHeader() - return s.noHeaders -} - -// Trailer returns the cached trailer metedata. Note that if it is not called -// after the entire stream is done, it could return an empty MD. Client -// side only. -// It can be safely read only after stream has ended that is either read -// or write have returned io.EOF. -func (s *Stream) Trailer() metadata.MD { - c := s.trailer.Copy() - return c -} - -// ContentSubtype returns the content-subtype for a request. For example, a -// content-subtype of "proto" will result in a content-type of -// "application/grpc+proto". This will always be lowercase. See -// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for -// more details. -func (s *Stream) ContentSubtype() string { - return s.contentSubtype -} - -// Context returns the context of the stream. -func (s *Stream) Context() context.Context { - return s.ctx -} - -// Method returns the method for the stream. -func (s *Stream) Method() string { - return s.method -} - -// Status returns the status received from the server. -// Status can be read safely only after the stream has ended, -// that is, after Done() is closed. -func (s *Stream) Status() *status.Status { - return s.status -} - -// SetHeader sets the header metadata. This can be called multiple times. -// Server side only. -// This should not be called in parallel to other data writes. -func (s *Stream) SetHeader(md metadata.MD) error { - if md.Len() == 0 { - return nil - } - if s.isHeaderSent() || s.getState() == streamDone { - return ErrIllegalHeaderWrite - } - s.hdrMu.Lock() - s.header = metadata.Join(s.header, md) - s.hdrMu.Unlock() - return nil -} - -// SendHeader sends the given header metadata. The given metadata is -// combined with any metadata set by previous calls to SetHeader and -// then written to the transport stream. -func (s *Stream) SendHeader(md metadata.MD) error { - return s.st.WriteHeader(s, md) -} - -// SetTrailer sets the trailer metadata which will be sent with the RPC status -// by the server. This can be called multiple times. Server side only. -// This should not be called parallel to other data writes. -func (s *Stream) SetTrailer(md metadata.MD) error { - if md.Len() == 0 { - return nil - } - if s.getState() == streamDone { - return ErrIllegalHeaderWrite - } - s.hdrMu.Lock() - s.trailer = metadata.Join(s.trailer, md) - s.hdrMu.Unlock() - return nil -} - -func (s *Stream) write(m recvMsg) { - s.buf.put(m) -} - -// Read reads all p bytes from the wire for this stream. -func (s *Stream) Read(p []byte) (n int, err error) { - // Don't request a read if there was an error earlier - if er := s.trReader.(*transportReader).er; er != nil { - return 0, er - } - s.requestRead(len(p)) - return io.ReadFull(s.trReader, p) -} - -// tranportReader reads all the data available for this Stream from the transport and -// passes them into the decoder, which converts them into a gRPC message stream. -// The error is io.EOF when the stream is done or another non-nil error if -// the stream broke. -type transportReader struct { - reader io.Reader - // The handler to control the window update procedure for both this - // particular stream and the associated transport. - windowHandler func(int) - er error -} - -func (t *transportReader) Read(p []byte) (n int, err error) { - n, err = t.reader.Read(p) - if err != nil { - t.er = err - return - } - t.windowHandler(n) - return -} - -// BytesReceived indicates whether any bytes have been received on this stream. -func (s *Stream) BytesReceived() bool { - return atomic.LoadUint32(&s.bytesReceived) == 1 -} - -// Unprocessed indicates whether the server did not process this stream -- -// i.e. it sent a refused stream or GOAWAY including this stream ID. -func (s *Stream) Unprocessed() bool { - return atomic.LoadUint32(&s.unprocessed) == 1 -} - -// GoString is implemented by Stream so context.String() won't -// race when printing %#v. -func (s *Stream) GoString() string { - return fmt.Sprintf("", s, s.method) -} - -// state of transport -type transportState int - -const ( - reachable transportState = iota - closing - draining -) - -// ServerConfig consists of all the configurations to establish a server transport. -type ServerConfig struct { - MaxStreams uint32 - AuthInfo credentials.AuthInfo - InTapHandle tap.ServerInHandle - StatsHandler stats.Handler - KeepaliveParams keepalive.ServerParameters - KeepalivePolicy keepalive.EnforcementPolicy - InitialWindowSize int32 - InitialConnWindowSize int32 - WriteBufferSize int - ReadBufferSize int - ChannelzParentID int64 - MaxHeaderListSize *uint32 - HeaderTableSize *uint32 -} - -// NewServerTransport creates a ServerTransport with conn or non-nil error -// if it fails. -func NewServerTransport(protocol string, conn net.Conn, config *ServerConfig) (ServerTransport, error) { - return newHTTP2Server(conn, config) -} - -// ConnectOptions covers all relevant options for communicating with the server. -type ConnectOptions struct { - // UserAgent is the application user agent. - UserAgent string - // Dialer specifies how to dial a network address. - Dialer func(context.Context, string) (net.Conn, error) - // FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors. - FailOnNonTempDialError bool - // PerRPCCredentials stores the PerRPCCredentials required to issue RPCs. - PerRPCCredentials []credentials.PerRPCCredentials - // TransportCredentials stores the Authenticator required to setup a client - // connection. Only one of TransportCredentials and CredsBundle is non-nil. - TransportCredentials credentials.TransportCredentials - // CredsBundle is the credentials bundle to be used. Only one of - // TransportCredentials and CredsBundle is non-nil. - CredsBundle credentials.Bundle - // KeepaliveParams stores the keepalive parameters. - KeepaliveParams keepalive.ClientParameters - // StatsHandler stores the handler for stats. - StatsHandler stats.Handler - // InitialWindowSize sets the initial window size for a stream. - InitialWindowSize int32 - // InitialConnWindowSize sets the initial window size for a connection. - InitialConnWindowSize int32 - // WriteBufferSize sets the size of write buffer which in turn determines how much data can be batched before it's written on the wire. - WriteBufferSize int - // ReadBufferSize sets the size of read buffer, which in turn determines how much data can be read at most for one read syscall. - ReadBufferSize int - // ChannelzParentID sets the addrConn id which initiate the creation of this client transport. - ChannelzParentID int64 - // MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received. - MaxHeaderListSize *uint32 -} - -// NewClientTransport establishes the transport with the required ConnectOptions -// and returns it to the caller. -func NewClientTransport(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onPrefaceReceipt func(), onGoAway func(GoAwayReason), onClose func()) (ClientTransport, error) { - return newHTTP2Client(connectCtx, ctx, addr, opts, onPrefaceReceipt, onGoAway, onClose) -} - -// Options provides additional hints and information for message -// transmission. -type Options struct { - // Last indicates whether this write is the last piece for - // this stream. - Last bool -} - -// CallHdr carries the information of a particular RPC. -type CallHdr struct { - // Host specifies the peer's host. - Host string - - // Method specifies the operation to perform. - Method string - - // SendCompress specifies the compression algorithm applied on - // outbound message. - SendCompress string - - // Creds specifies credentials.PerRPCCredentials for a call. - Creds credentials.PerRPCCredentials - - // ContentSubtype specifies the content-subtype for a request. For example, a - // content-subtype of "proto" will result in a content-type of - // "application/grpc+proto". The value of ContentSubtype must be all - // lowercase, otherwise the behavior is undefined. See - // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests - // for more details. - ContentSubtype string - - PreviousAttempts int // value of grpc-previous-rpc-attempts header to set -} - -// ClientTransport is the common interface for all gRPC client-side transport -// implementations. -type ClientTransport interface { - // Close tears down this transport. Once it returns, the transport - // should not be accessed any more. The caller must make sure this - // is called only once. - Close() error - - // GracefulClose starts to tear down the transport: the transport will stop - // accepting new RPCs and NewStream will return error. Once all streams are - // finished, the transport will close. - // - // It does not block. - GracefulClose() - - // Write sends the data for the given stream. A nil stream indicates - // the write is to be performed on the transport as a whole. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error - - // NewStream creates a Stream for an RPC. - NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) - - // CloseStream clears the footprint of a stream when the stream is - // not needed any more. The err indicates the error incurred when - // CloseStream is called. Must be called when a stream is finished - // unless the associated transport is closing. - CloseStream(stream *Stream, err error) - - // Error returns a channel that is closed when some I/O error - // happens. Typically the caller should have a goroutine to monitor - // this in order to take action (e.g., close the current transport - // and create a new one) in error case. It should not return nil - // once the transport is initiated. - Error() <-chan struct{} - - // GoAway returns a channel that is closed when ClientTransport - // receives the draining signal from the server (e.g., GOAWAY frame in - // HTTP/2). - GoAway() <-chan struct{} - - // GetGoAwayReason returns the reason why GoAway frame was received. - GetGoAwayReason() GoAwayReason - - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr - - // IncrMsgSent increments the number of message sent through this transport. - IncrMsgSent() - - // IncrMsgRecv increments the number of message received through this transport. - IncrMsgRecv() -} - -// ServerTransport is the common interface for all gRPC server-side transport -// implementations. -// -// Methods may be called concurrently from multiple goroutines, but -// Write methods for a given Stream will be called serially. -type ServerTransport interface { - // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream), func(context.Context, string) context.Context) - - // WriteHeader sends the header metadata for the given stream. - // WriteHeader may not be called on all streams. - WriteHeader(s *Stream, md metadata.MD) error - - // Write sends the data for the given stream. - // Write may not be called on all streams. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error - - // WriteStatus sends the status of a stream to the client. WriteStatus is - // the final call made on a stream and always occurs. - WriteStatus(s *Stream, st *status.Status) error - - // Close tears down the transport. Once it is called, the transport - // should not be accessed any more. All the pending streams and their - // handlers will be terminated asynchronously. - Close() error - - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr - - // Drain notifies the client this ServerTransport stops accepting new RPCs. - Drain() - - // IncrMsgSent increments the number of message sent through this transport. - IncrMsgSent() - - // IncrMsgRecv increments the number of message received through this transport. - IncrMsgRecv() -} - -// connectionErrorf creates an ConnectionError with the specified error description. -func connectionErrorf(temp bool, e error, format string, a ...interface{}) ConnectionError { - return ConnectionError{ - Desc: fmt.Sprintf(format, a...), - temp: temp, - err: e, - } -} - -// ConnectionError is an error that results in the termination of the -// entire connection and the retry of all the active streams. -type ConnectionError struct { - Desc string - temp bool - err error -} - -func (e ConnectionError) Error() string { - return fmt.Sprintf("connection error: desc = %q", e.Desc) -} - -// Temporary indicates if this connection error is temporary or fatal. -func (e ConnectionError) Temporary() bool { - return e.temp -} - -// Origin returns the original error of this connection error. -func (e ConnectionError) Origin() error { - // Never return nil error here. - // If the original error is nil, return itself. - if e.err == nil { - return e - } - return e.err -} - -var ( - // ErrConnClosing indicates that the transport is closing. - ErrConnClosing = connectionErrorf(true, nil, "transport is closing") - // errStreamDrain indicates that the stream is rejected because the - // connection is draining. This could be caused by goaway or balancer - // removing the address. - errStreamDrain = status.Error(codes.Unavailable, "the connection is draining") - // errStreamDone is returned from write at the client side to indiacte application - // layer of an error. - errStreamDone = errors.New("the stream is done") - // StatusGoAway indicates that the server sent a GOAWAY that included this - // stream's ID in unprocessed RPCs. - statusGoAway = status.New(codes.Unavailable, "the stream is rejected because server is draining the connection") -) - -// GoAwayReason contains the reason for the GoAway frame received. -type GoAwayReason uint8 - -const ( - // GoAwayInvalid indicates that no GoAway frame is received. - GoAwayInvalid GoAwayReason = 0 - // GoAwayNoReason is the default value when GoAway frame is received. - GoAwayNoReason GoAwayReason = 1 - // GoAwayTooManyPings indicates that a GoAway frame with - // ErrCodeEnhanceYourCalm was received and that the debug data said - // "too_many_pings". - GoAwayTooManyPings GoAwayReason = 2 -) - -// channelzData is used to store channelz related data for http2Client and http2Server. -// These fields cannot be embedded in the original structs (e.g. http2Client), since to do atomic -// operation on int64 variable on 32-bit machine, user is responsible to enforce memory alignment. -// Here, by grouping those int64 fields inside a struct, we are enforcing the alignment. -type channelzData struct { - kpCount int64 - // The number of streams that have started, including already finished ones. - streamsStarted int64 - // Client side: The number of streams that have ended successfully by receiving - // EoS bit set frame from server. - // Server side: The number of streams that have ended successfully by sending - // frame with EoS bit set. - streamsSucceeded int64 - streamsFailed int64 - // lastStreamCreatedTime stores the timestamp that the last stream gets created. It is of int64 type - // instead of time.Time since it's more costly to atomically update time.Time variable than int64 - // variable. The same goes for lastMsgSentTime and lastMsgRecvTime. - lastStreamCreatedTime int64 - msgSent int64 - msgRecv int64 - lastMsgSentTime int64 - lastMsgRecvTime int64 -} - -// ContextErr converts the error from context package into a status error. -func ContextErr(err error) error { - switch err { - case context.DeadlineExceeded: - return status.Error(codes.DeadlineExceeded, err.Error()) - case context.Canceled: - return status.Error(codes.Canceled, err.Error()) - } - return status.Errorf(codes.Internal, "Unexpected error from context packet: %v", err) -} diff --git a/vendor/google.golang.org/grpc/keepalive/keepalive.go b/vendor/google.golang.org/grpc/keepalive/keepalive.go deleted file mode 100644 index 34d31b5e7..000000000 --- a/vendor/google.golang.org/grpc/keepalive/keepalive.go +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 keepalive defines configurable parameters for point-to-point -// healthcheck. -package keepalive - -import ( - "time" -) - -// ClientParameters is used to set keepalive parameters on the client-side. -// These configure how the client will actively probe to notice when a -// connection is broken and send pings so intermediaries will be aware of the -// liveness of the connection. Make sure these parameters are set in -// coordination with the keepalive policy on the server, as incompatible -// settings can result in closing of connection. -type ClientParameters struct { - // After a duration of this time if the client doesn't see any activity it - // pings the server to see if the transport is still alive. - // If set below 10s, a minimum value of 10s will be used instead. - Time time.Duration // The current default value is infinity. - // After having pinged for keepalive check, the client waits for a duration - // of Timeout and if no activity is seen even after that the connection is - // closed. - Timeout time.Duration // The current default value is 20 seconds. - // If true, client sends keepalive pings even with no active RPCs. If false, - // when there are no active RPCs, Time and Timeout will be ignored and no - // keepalive pings will be sent. - PermitWithoutStream bool // false by default. -} - -// ServerParameters is used to set keepalive and max-age parameters on the -// server-side. -type ServerParameters struct { - // MaxConnectionIdle is a duration for the amount of time after which an - // idle connection would be closed by sending a GoAway. Idleness duration is - // defined since the most recent time the number of outstanding RPCs became - // zero or the connection establishment. - MaxConnectionIdle time.Duration // The current default value is infinity. - // MaxConnectionAge is a duration for the maximum amount of time a - // connection may exist before it will be closed by sending a GoAway. A - // random jitter of +/-10% will be added to MaxConnectionAge to spread out - // connection storms. - MaxConnectionAge time.Duration // The current default value is infinity. - // MaxConnectionAgeGrace is an additive period after MaxConnectionAge after - // which the connection will be forcibly closed. - MaxConnectionAgeGrace time.Duration // The current default value is infinity. - // After a duration of this time if the server doesn't see any activity it - // pings the client to see if the transport is still alive. - // If set below 1s, a minimum value of 1s will be used instead. - Time time.Duration // The current default value is 2 hours. - // After having pinged for keepalive check, the server waits for a duration - // of Timeout and if no activity is seen even after that the connection is - // closed. - Timeout time.Duration // The current default value is 20 seconds. -} - -// EnforcementPolicy is used to set keepalive enforcement policy on the -// server-side. Server will close connection with a client that violates this -// policy. -type EnforcementPolicy struct { - // MinTime is the minimum amount of time a client should wait before sending - // a keepalive ping. - MinTime time.Duration // The current default value is 5 minutes. - // If true, server allows keepalive pings even when there are no active - // streams(RPCs). If false, and client sends ping when there are no active - // streams, server will send GOAWAY and close the connection. - PermitWithoutStream bool // false by default. -} diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go deleted file mode 100644 index cf6d1b947..000000000 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ /dev/null @@ -1,209 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 metadata define the structure of the metadata supported by gRPC library. -// Please refer to https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md -// for more information about custom-metadata. -package metadata // import "google.golang.org/grpc/metadata" - -import ( - "context" - "fmt" - "strings" -) - -// DecodeKeyValue returns k, v, nil. -// -// Deprecated: use k and v directly instead. -func DecodeKeyValue(k, v string) (string, string, error) { - return k, v, nil -} - -// MD is a mapping from metadata keys to values. Users should use the following -// two convenience functions New and Pairs to generate MD. -type MD map[string][]string - -// New creates an MD from a given key-value map. -// -// Only the following ASCII characters are allowed in keys: -// - digits: 0-9 -// - uppercase letters: A-Z (normalized to lower) -// - lowercase letters: a-z -// - special characters: -_. -// Uppercase letters are automatically converted to lowercase. -// -// Keys beginning with "grpc-" are reserved for grpc-internal use only and may -// result in errors if set in metadata. -func New(m map[string]string) MD { - md := MD{} - for k, val := range m { - key := strings.ToLower(k) - md[key] = append(md[key], val) - } - return md -} - -// Pairs returns an MD formed by the mapping of key, value ... -// Pairs panics if len(kv) is odd. -// -// Only the following ASCII characters are allowed in keys: -// - digits: 0-9 -// - uppercase letters: A-Z (normalized to lower) -// - lowercase letters: a-z -// - special characters: -_. -// Uppercase letters are automatically converted to lowercase. -// -// Keys beginning with "grpc-" are reserved for grpc-internal use only and may -// result in errors if set in metadata. -func Pairs(kv ...string) MD { - if len(kv)%2 == 1 { - panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv))) - } - md := MD{} - var key string - for i, s := range kv { - if i%2 == 0 { - key = strings.ToLower(s) - continue - } - md[key] = append(md[key], s) - } - return md -} - -// Len returns the number of items in md. -func (md MD) Len() int { - return len(md) -} - -// Copy returns a copy of md. -func (md MD) Copy() MD { - return Join(md) -} - -// Get obtains the values for a given key. -func (md MD) Get(k string) []string { - k = strings.ToLower(k) - return md[k] -} - -// Set sets the value of a given key with a slice of values. -func (md MD) Set(k string, vals ...string) { - if len(vals) == 0 { - return - } - k = strings.ToLower(k) - md[k] = vals -} - -// Append adds the values to key k, not overwriting what was already stored at that key. -func (md MD) Append(k string, vals ...string) { - if len(vals) == 0 { - return - } - k = strings.ToLower(k) - md[k] = append(md[k], vals...) -} - -// Join joins any number of mds into a single MD. -// The order of values for each key is determined by the order in which -// the mds containing those values are presented to Join. -func Join(mds ...MD) MD { - out := MD{} - for _, md := range mds { - for k, v := range md { - out[k] = append(out[k], v...) - } - } - return out -} - -type mdIncomingKey struct{} -type mdOutgoingKey struct{} - -// NewIncomingContext creates a new context with incoming md attached. -func NewIncomingContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdIncomingKey{}, md) -} - -// NewOutgoingContext creates a new context with outgoing md attached. If used -// in conjunction with AppendToOutgoingContext, NewOutgoingContext will -// overwrite any previously-appended metadata. -func NewOutgoingContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md}) -} - -// AppendToOutgoingContext returns a new context with the provided kv merged -// with any existing metadata in the context. Please refer to the -// documentation of Pairs for a description of kv. -func AppendToOutgoingContext(ctx context.Context, kv ...string) context.Context { - if len(kv)%2 == 1 { - panic(fmt.Sprintf("metadata: AppendToOutgoingContext got an odd number of input pairs for metadata: %d", len(kv))) - } - md, _ := ctx.Value(mdOutgoingKey{}).(rawMD) - added := make([][]string, len(md.added)+1) - copy(added, md.added) - added[len(added)-1] = make([]string, len(kv)) - copy(added[len(added)-1], kv) - return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md.md, added: added}) -} - -// FromIncomingContext returns the incoming metadata in ctx if it exists. The -// returned MD should not be modified. Writing to it may cause races. -// Modification should be made to copies of the returned MD. -func FromIncomingContext(ctx context.Context) (md MD, ok bool) { - md, ok = ctx.Value(mdIncomingKey{}).(MD) - return -} - -// FromOutgoingContextRaw returns the un-merged, intermediary contents -// of rawMD. Remember to perform strings.ToLower on the keys. The returned -// MD should not be modified. Writing to it may cause races. Modification -// should be made to copies of the returned MD. -// -// This is intended for gRPC-internal use ONLY. -func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { - raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) - if !ok { - return nil, nil, false - } - - return raw.md, raw.added, true -} - -// FromOutgoingContext returns the outgoing metadata in ctx if it exists. The -// returned MD should not be modified. Writing to it may cause races. -// Modification should be made to copies of the returned MD. -func FromOutgoingContext(ctx context.Context) (MD, bool) { - raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) - if !ok { - return nil, false - } - - mds := make([]MD, 0, len(raw.added)+1) - mds = append(mds, raw.md) - for _, vv := range raw.added { - mds = append(mds, Pairs(vv...)) - } - return Join(mds...), ok -} - -type rawMD struct { - md MD - added [][]string -} diff --git a/vendor/google.golang.org/grpc/peer/peer.go b/vendor/google.golang.org/grpc/peer/peer.go deleted file mode 100644 index e01d219ff..000000000 --- a/vendor/google.golang.org/grpc/peer/peer.go +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 peer defines various peer information associated with RPCs and -// corresponding utils. -package peer - -import ( - "context" - "net" - - "google.golang.org/grpc/credentials" -) - -// Peer contains the information of the peer for an RPC, such as the address -// and authentication information. -type Peer struct { - // Addr is the peer address. - Addr net.Addr - // AuthInfo is the authentication information of the transport. - // It is nil if there is no transport security being used. - AuthInfo credentials.AuthInfo -} - -type peerKey struct{} - -// NewContext creates a new context with peer information attached. -func NewContext(ctx context.Context, p *Peer) context.Context { - return context.WithValue(ctx, peerKey{}, p) -} - -// FromContext returns the peer information in ctx if it exists. -func FromContext(ctx context.Context) (p *Peer, ok bool) { - p, ok = ctx.Value(peerKey{}).(*Peer) - return -} diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go deleted file mode 100644 index 7f3edaaed..000000000 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ /dev/null @@ -1,178 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 grpc - -import ( - "context" - "io" - "sync" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/transport" - "google.golang.org/grpc/status" -) - -// pickerWrapper is a wrapper of balancer.Picker. It blocks on certain pick -// actions and unblock when there's a picker update. -type pickerWrapper struct { - mu sync.Mutex - done bool - blockingCh chan struct{} - picker balancer.Picker -} - -func newPickerWrapper() *pickerWrapper { - return &pickerWrapper{blockingCh: make(chan struct{})} -} - -// updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. -func (pw *pickerWrapper) updatePicker(p balancer.Picker) { - pw.mu.Lock() - if pw.done { - pw.mu.Unlock() - return - } - pw.picker = p - // pw.blockingCh should never be nil. - close(pw.blockingCh) - pw.blockingCh = make(chan struct{}) - pw.mu.Unlock() -} - -func doneChannelzWrapper(acw *acBalancerWrapper, done func(balancer.DoneInfo)) func(balancer.DoneInfo) { - acw.mu.Lock() - ac := acw.ac - acw.mu.Unlock() - ac.incrCallsStarted() - return func(b balancer.DoneInfo) { - if b.Err != nil && b.Err != io.EOF { - ac.incrCallsFailed() - } else { - ac.incrCallsSucceeded() - } - if done != nil { - done(b) - } - } -} - -// pick returns the transport that will be used for the RPC. -// It may block in the following cases: -// - there's no picker -// - the current picker returns ErrNoSubConnAvailable -// - the current picker returns other errors and failfast is false. -// - the subConn returned by the current picker is not READY -// When one of these situations happens, pick blocks until the picker gets updated. -func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.PickInfo) (transport.ClientTransport, func(balancer.DoneInfo), error) { - var ch chan struct{} - - var lastPickErr error - for { - pw.mu.Lock() - if pw.done { - pw.mu.Unlock() - return nil, nil, ErrClientConnClosing - } - - if pw.picker == nil { - ch = pw.blockingCh - } - if ch == pw.blockingCh { - // This could happen when either: - // - pw.picker is nil (the previous if condition), or - // - has called pick on the current picker. - pw.mu.Unlock() - select { - case <-ctx.Done(): - var errStr string - if lastPickErr != nil { - errStr = "latest balancer error: " + lastPickErr.Error() - } else { - errStr = ctx.Err().Error() - } - switch ctx.Err() { - case context.DeadlineExceeded: - return nil, nil, status.Error(codes.DeadlineExceeded, errStr) - case context.Canceled: - return nil, nil, status.Error(codes.Canceled, errStr) - } - case <-ch: - } - continue - } - - ch = pw.blockingCh - p := pw.picker - pw.mu.Unlock() - - pickResult, err := p.Pick(info) - - if err != nil { - if err == balancer.ErrNoSubConnAvailable { - continue - } - if _, ok := status.FromError(err); ok { - // Status error: end the RPC unconditionally with this status. - return nil, nil, err - } - // For all other errors, wait for ready RPCs should block and other - // RPCs should fail with unavailable. - if !failfast { - lastPickErr = err - continue - } - return nil, nil, status.Error(codes.Unavailable, err.Error()) - } - - acw, ok := pickResult.SubConn.(*acBalancerWrapper) - if !ok { - grpclog.Error("subconn returned from pick is not *acBalancerWrapper") - continue - } - if t, ok := acw.getAddrConn().getReadyTransport(); ok { - if channelz.IsOn() { - return t, doneChannelzWrapper(acw, pickResult.Done), nil - } - return t, pickResult.Done, nil - } - if pickResult.Done != nil { - // Calling done with nil error, no bytes sent and no bytes received. - // DoneInfo with default value works. - pickResult.Done(balancer.DoneInfo{}) - } - grpclog.Infof("blockingPicker: the picked transport is not ready, loop back to repick") - // If ok == false, ac.state is not READY. - // A valid picker always returns READY subConn. This means the state of ac - // just changed, and picker will be updated shortly. - // continue back to the beginning of the for loop to repick. - } -} - -func (pw *pickerWrapper) close() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.done = true - close(pw.blockingCh) -} diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/pickfirst.go deleted file mode 100644 index 4b7340ad3..000000000 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 grpc - -import ( - "errors" - "fmt" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/grpclog" -) - -// PickFirstBalancerName is the name of the pick_first balancer. -const PickFirstBalancerName = "pick_first" - -func newPickfirstBuilder() balancer.Builder { - return &pickfirstBuilder{} -} - -type pickfirstBuilder struct{} - -func (*pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { - return &pickfirstBalancer{cc: cc} -} - -func (*pickfirstBuilder) Name() string { - return PickFirstBalancerName -} - -type pickfirstBalancer struct { - state connectivity.State - cc balancer.ClientConn - sc balancer.SubConn -} - -func (b *pickfirstBalancer) ResolverError(err error) { - switch b.state { - case connectivity.TransientFailure, connectivity.Idle, connectivity.Connecting: - // Set a failing picker if we don't have a good picker. - b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: fmt.Errorf("name resolver error: %v", err)}, - }) - } - if grpclog.V(2) { - grpclog.Infof("pickfirstBalancer: ResolverError called with error %v", err) - } -} - -func (b *pickfirstBalancer) UpdateClientConnState(cs balancer.ClientConnState) error { - if len(cs.ResolverState.Addresses) == 0 { - b.ResolverError(errors.New("produced zero addresses")) - return balancer.ErrBadResolverState - } - if b.sc == nil { - var err error - b.sc, err = b.cc.NewSubConn(cs.ResolverState.Addresses, balancer.NewSubConnOptions{}) - if err != nil { - if grpclog.V(2) { - grpclog.Errorf("pickfirstBalancer: failed to NewSubConn: %v", err) - } - b.state = connectivity.TransientFailure - b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: fmt.Errorf("error creating connection: %v", err)}, - }) - return balancer.ErrBadResolverState - } - b.state = connectivity.Idle - b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.Idle, Picker: &picker{result: balancer.PickResult{SubConn: b.sc}}}) - b.sc.Connect() - } else { - b.sc.UpdateAddresses(cs.ResolverState.Addresses) - b.sc.Connect() - } - return nil -} - -func (b *pickfirstBalancer) UpdateSubConnState(sc balancer.SubConn, s balancer.SubConnState) { - if grpclog.V(2) { - grpclog.Infof("pickfirstBalancer: UpdateSubConnState: %p, %v", sc, s) - } - if b.sc != sc { - if grpclog.V(2) { - grpclog.Infof("pickfirstBalancer: ignored state change because sc is not recognized") - } - return - } - b.state = s.ConnectivityState - if s.ConnectivityState == connectivity.Shutdown { - b.sc = nil - return - } - - switch s.ConnectivityState { - case connectivity.Ready, connectivity.Idle: - b.cc.UpdateState(balancer.State{ConnectivityState: s.ConnectivityState, Picker: &picker{result: balancer.PickResult{SubConn: sc}}}) - case connectivity.Connecting: - b.cc.UpdateState(balancer.State{ConnectivityState: s.ConnectivityState, Picker: &picker{err: balancer.ErrNoSubConnAvailable}}) - case connectivity.TransientFailure: - b.cc.UpdateState(balancer.State{ - ConnectivityState: s.ConnectivityState, - Picker: &picker{err: s.ConnectionError}, - }) - } -} - -func (b *pickfirstBalancer) Close() { -} - -type picker struct { - result balancer.PickResult - err error -} - -func (p *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { - return p.result, p.err -} - -func init() { - balancer.Register(newPickfirstBuilder()) -} diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go deleted file mode 100644 index 76acbbcc9..000000000 --- a/vendor/google.golang.org/grpc/preloader.go +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2019 gRPC 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 grpc - -import ( - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// PreparedMsg is responsible for creating a Marshalled and Compressed object. -// -// This API is EXPERIMENTAL. -type PreparedMsg struct { - // Struct for preparing msg before sending them - encodedData []byte - hdr []byte - payload []byte -} - -// Encode marshalls and compresses the message using the codec and compressor for the stream. -func (p *PreparedMsg) Encode(s Stream, msg interface{}) error { - ctx := s.Context() - rpcInfo, ok := rpcInfoFromContext(ctx) - if !ok { - return status.Errorf(codes.Internal, "grpc: unable to get rpcInfo") - } - - // check if the context has the relevant information to prepareMsg - if rpcInfo.preloaderInfo == nil { - return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo is nil") - } - if rpcInfo.preloaderInfo.codec == nil { - return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo.codec is nil") - } - - // prepare the msg - data, err := encode(rpcInfo.preloaderInfo.codec, msg) - if err != nil { - return err - } - p.encodedData = data - compData, err := compress(data, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp) - if err != nil { - return err - } - p.hdr, p.payload = msgHeader(data, compData) - return nil -} diff --git a/vendor/google.golang.org/grpc/proxy.go b/vendor/google.golang.org/grpc/proxy.go deleted file mode 100644 index f8f69bfb7..000000000 --- a/vendor/google.golang.org/grpc/proxy.go +++ /dev/null @@ -1,152 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 grpc - -import ( - "bufio" - "context" - "encoding/base64" - "errors" - "fmt" - "io" - "net" - "net/http" - "net/http/httputil" - "net/url" -) - -const proxyAuthHeaderKey = "Proxy-Authorization" - -var ( - // errDisabled indicates that proxy is disabled for the address. - errDisabled = errors.New("proxy is disabled for the address") - // The following variable will be overwritten in the tests. - httpProxyFromEnvironment = http.ProxyFromEnvironment -) - -func mapAddress(ctx context.Context, address string) (*url.URL, error) { - req := &http.Request{ - URL: &url.URL{ - Scheme: "https", - Host: address, - }, - } - url, err := httpProxyFromEnvironment(req) - if err != nil { - return nil, err - } - if url == nil { - return nil, errDisabled - } - return url, nil -} - -// To read a response from a net.Conn, http.ReadResponse() takes a bufio.Reader. -// It's possible that this reader reads more than what's need for the response and stores -// those bytes in the buffer. -// bufConn wraps the original net.Conn and the bufio.Reader to make sure we don't lose the -// bytes in the buffer. -type bufConn struct { - net.Conn - r io.Reader -} - -func (c *bufConn) Read(b []byte) (int, error) { - return c.r.Read(b) -} - -func basicAuth(username, password string) string { - auth := username + ":" + password - return base64.StdEncoding.EncodeToString([]byte(auth)) -} - -func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr string, proxyURL *url.URL) (_ net.Conn, err error) { - defer func() { - if err != nil { - conn.Close() - } - }() - - req := &http.Request{ - Method: http.MethodConnect, - URL: &url.URL{Host: backendAddr}, - Header: map[string][]string{"User-Agent": {grpcUA}}, - } - if t := proxyURL.User; t != nil { - u := t.Username() - p, _ := t.Password() - req.Header.Add(proxyAuthHeaderKey, "Basic "+basicAuth(u, p)) - } - - if err := sendHTTPRequest(ctx, req, conn); err != nil { - return nil, fmt.Errorf("failed to write the HTTP request: %v", err) - } - - r := bufio.NewReader(conn) - resp, err := http.ReadResponse(r, req) - if err != nil { - return nil, fmt.Errorf("reading server HTTP response: %v", err) - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return nil, fmt.Errorf("failed to do connect handshake, status code: %s", resp.Status) - } - return nil, fmt.Errorf("failed to do connect handshake, response: %q", dump) - } - - return &bufConn{Conn: conn, r: r}, nil -} - -// newProxyDialer returns a dialer that connects to proxy first if necessary. -// The returned dialer checks if a proxy is necessary, dial to the proxy with the -// provided dialer, does HTTP CONNECT handshake and returns the connection. -func newProxyDialer(dialer func(context.Context, string) (net.Conn, error)) func(context.Context, string) (net.Conn, error) { - return func(ctx context.Context, addr string) (conn net.Conn, err error) { - var newAddr string - proxyURL, err := mapAddress(ctx, addr) - if err != nil { - if err != errDisabled { - return nil, err - } - newAddr = addr - } else { - newAddr = proxyURL.Host - } - - conn, err = dialer(ctx, newAddr) - if err != nil { - return - } - if proxyURL != nil { - // proxy is disabled if proxyURL is nil. - conn, err = doHTTPConnectHandshake(ctx, conn, addr, proxyURL) - } - return - } -} - -func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error { - req = req.WithContext(ctx) - if err := req.Write(conn); err != nil { - return fmt.Errorf("failed to write the HTTP request: %v", err) - } - return nil -} diff --git a/vendor/google.golang.org/grpc/regenerate.sh b/vendor/google.golang.org/grpc/regenerate.sh deleted file mode 100644 index 987bc2025..000000000 --- a/vendor/google.golang.org/grpc/regenerate.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# Copyright 2020 gRPC 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. - -set -eu -o pipefail - -WORKDIR=$(mktemp -d) - -function finish { - rm -rf "$WORKDIR" -} -trap finish EXIT - -export GOBIN=${WORKDIR}/bin -export PATH=${GOBIN}:${PATH} -mkdir -p ${GOBIN} - -echo "go install github.com/golang/protobuf/protoc-gen-go" -(cd test/tools && go install github.com/golang/protobuf/protoc-gen-go) - -echo "go install cmd/protoc-gen-go-grpc" -(cd cmd/protoc-gen-go-grpc && go install .) - -echo "git clone https://github.com/grpc/grpc-proto" -git clone --quiet https://github.com/grpc/grpc-proto ${WORKDIR}/grpc-proto - -mkdir -p ${WORKDIR}/googleapis/google/rpc -echo "curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto" -curl --silent https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto > ${WORKDIR}/googleapis/google/rpc/code.proto - -mkdir -p ${WORKDIR}/out - -SOURCES=( - ${WORKDIR}/googleapis/google/rpc/code.proto - ${WORKDIR}/grpc-proto/grpc/binlog/v1/binarylog.proto - ${WORKDIR}/grpc-proto/grpc/channelz/v1/channelz.proto - ${WORKDIR}/grpc-proto/grpc/gcp/altscontext.proto - ${WORKDIR}/grpc-proto/grpc/gcp/handshaker.proto - ${WORKDIR}/grpc-proto/grpc/gcp/transport_security_common.proto - ${WORKDIR}/grpc-proto/grpc/health/v1/health.proto - ${WORKDIR}/grpc-proto/grpc/lb/v1/load_balancer.proto - ${WORKDIR}/grpc-proto/grpc/lookup/v1/rls.proto - ${WORKDIR}/grpc-proto/grpc/service_config/service_config.proto - $(git ls-files --exclude-standard --cached --others "*.proto") -) -OPTS=Mgrpc/service_config/service_config.proto=/internal/proto/grpc_service_config -for src in ${SOURCES[@]}; do - echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},requireUnimplementedServers=false:${WORKDIR}/out \ - -I"." \ - -I${WORKDIR}/grpc-proto \ - -I${WORKDIR}/googleapis \ - ${src} -done - -# The go_package option in grpc/lookup/v1/rls.proto doesn't match the -# current location. Move it into the right place. -mkdir -p ${WORKDIR}/out/google.golang.org/grpc/balancer/rls/internal/proto/grpc_lookup_v1 -mv ${WORKDIR}/out/google.golang.org/grpc/lookup/grpc_lookup_v1/* ${WORKDIR}/out/google.golang.org/grpc/balancer/rls/internal/proto/grpc_lookup_v1 - -# grpc_testingv3/testv3.pb.go is not re-generated because it was -# intentionally generated by an older version of protoc-gen-go. -rm ${WORKDIR}/out/google.golang.org/grpc/reflection/grpc_testingv3/*.pb.go - -# grpc/service_config/service_config.proto does not have a go_package option. -cp ${WORKDIR}/out/grpc/service_config/service_config.pb.go internal/proto/grpc_service_config - -cp -R ${WORKDIR}/out/google.golang.org/grpc/* . diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go deleted file mode 100644 index 379275a2d..000000000 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ /dev/null @@ -1,256 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 resolver defines APIs for name resolution in gRPC. -// All APIs in this package are experimental. -package resolver - -import ( - "context" - "net" - - "google.golang.org/grpc/attributes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/serviceconfig" -) - -var ( - // m is a map from scheme to resolver builder. - m = make(map[string]Builder) - // defaultScheme is the default scheme to use. - defaultScheme = "passthrough" -) - -// TODO(bar) install dns resolver in init(){}. - -// Register registers the resolver builder to the resolver map. b.Scheme will be -// used as the scheme registered with this builder. -// -// NOTE: this function must only be called during initialization time (i.e. in -// an init() function), and is not thread-safe. If multiple Resolvers are -// registered with the same name, the one registered last will take effect. -func Register(b Builder) { - m[b.Scheme()] = b -} - -// Get returns the resolver builder registered with the given scheme. -// -// If no builder is register with the scheme, nil will be returned. -func Get(scheme string) Builder { - if b, ok := m[scheme]; ok { - return b - } - return nil -} - -// SetDefaultScheme sets the default scheme that will be used. The default -// default scheme is "passthrough". -// -// NOTE: this function must only be called during initialization time (i.e. in -// an init() function), and is not thread-safe. The scheme set last overrides -// previously set values. -func SetDefaultScheme(scheme string) { - defaultScheme = scheme -} - -// GetDefaultScheme gets the default scheme that will be used. -func GetDefaultScheme() string { - return defaultScheme -} - -// AddressType indicates the address type returned by name resolution. -// -// Deprecated: use Attributes in Address instead. -type AddressType uint8 - -const ( - // Backend indicates the address is for a backend server. - // - // Deprecated: use Attributes in Address instead. - Backend AddressType = iota - // GRPCLB indicates the address is for a grpclb load balancer. - // - // Deprecated: to select the GRPCLB load balancing policy, use a service - // config with a corresponding loadBalancingConfig. To supply balancer - // addresses to the GRPCLB load balancing policy, set State.Attributes - // using balancer/grpclb/state.Set. - GRPCLB -) - -// Address represents a server the client connects to. -// This is the EXPERIMENTAL API and may be changed or extended in the future. -type Address struct { - // Addr is the server address on which a connection will be established. - Addr string - - // ServerName is the name of this address. - // If non-empty, the ServerName is used as the transport certification authority for - // the address, instead of the hostname from the Dial target string. In most cases, - // this should not be set. - // - // If Type is GRPCLB, ServerName should be the name of the remote load - // balancer, not the name of the backend. - // - // WARNING: ServerName must only be populated with trusted values. It - // is insecure to populate it with data from untrusted inputs since untrusted - // values could be used to bypass the authority checks performed by TLS. - ServerName string - - // Attributes contains arbitrary data about this address intended for - // consumption by the load balancing policy. - Attributes *attributes.Attributes - - // Type is the type of this address. - // - // Deprecated: use Attributes instead. - Type AddressType - - // Metadata is the information associated with Addr, which may be used - // to make load balancing decision. - // - // Deprecated: use Attributes instead. - Metadata interface{} -} - -// BuildOptions includes additional information for the builder to create -// the resolver. -type BuildOptions struct { - // DisableServiceConfig indicates whether a resolver implementation should - // fetch service config data. - DisableServiceConfig bool - // DialCreds is the transport credentials used by the ClientConn for - // communicating with the target gRPC service (set via - // WithTransportCredentials). In cases where a name resolution service - // requires the same credentials, the resolver may use this field. In most - // cases though, it is not appropriate, and this field may be ignored. - DialCreds credentials.TransportCredentials - // CredsBundle is the credentials bundle used by the ClientConn for - // communicating with the target gRPC service (set via - // WithCredentialsBundle). In cases where a name resolution service - // requires the same credentials, the resolver may use this field. In most - // cases though, it is not appropriate, and this field may be ignored. - CredsBundle credentials.Bundle - // Dialer is the custom dialer used by the ClientConn for dialling the - // target gRPC service (set via WithDialer). In cases where a name - // resolution service requires the same dialer, the resolver may use this - // field. In most cases though, it is not appropriate, and this field may - // be ignored. - Dialer func(context.Context, string) (net.Conn, error) -} - -// State contains the current Resolver state relevant to the ClientConn. -type State struct { - // Addresses is the latest set of resolved addresses for the target. - Addresses []Address - - // ServiceConfig contains the result from parsing the latest service - // config. If it is nil, it indicates no service config is present or the - // resolver does not provide service configs. - ServiceConfig *serviceconfig.ParseResult - - // Attributes contains arbitrary data about the resolver intended for - // consumption by the load balancing policy. - Attributes *attributes.Attributes -} - -// ClientConn contains the callbacks for resolver to notify any updates -// to the gRPC ClientConn. -// -// This interface is to be implemented by gRPC. Users should not need a -// brand new implementation of this interface. For the situations like -// testing, the new implementation should embed this interface. This allows -// gRPC to add new methods to this interface. -type ClientConn interface { - // UpdateState updates the state of the ClientConn appropriately. - UpdateState(State) - // ReportError notifies the ClientConn that the Resolver encountered an - // error. The ClientConn will notify the load balancer and begin calling - // ResolveNow on the Resolver with exponential backoff. - ReportError(error) - // NewAddress is called by resolver to notify ClientConn a new list - // of resolved addresses. - // The address list should be the complete list of resolved addresses. - // - // Deprecated: Use UpdateState instead. - NewAddress(addresses []Address) - // NewServiceConfig is called by resolver to notify ClientConn a new - // service config. The service config should be provided as a json string. - // - // Deprecated: Use UpdateState instead. - NewServiceConfig(serviceConfig string) - // ParseServiceConfig parses the provided service config and returns an - // object that provides the parsed config. - ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult -} - -// Target represents a target for gRPC, as specified in: -// https://github.com/grpc/grpc/blob/master/doc/naming.md. -// It is parsed from the target string that gets passed into Dial or DialContext by the user. And -// grpc passes it to the resolver and the balancer. -// -// If the target follows the naming spec, and the parsed scheme is registered with grpc, we will -// parse the target string according to the spec. e.g. "dns://some_authority/foo.bar" will be parsed -// into &Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} -// -// If the target does not contain a scheme, we will apply the default scheme, and set the Target to -// be the full target string. e.g. "foo.bar" will be parsed into -// &Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"}. -// -// If the parsed scheme is not registered (i.e. no corresponding resolver available to resolve the -// endpoint), we set the Scheme to be the default scheme, and set the Endpoint to be the full target -// string. e.g. target string "unknown_scheme://authority/endpoint" will be parsed into -// &Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"}. -type Target struct { - Scheme string - Authority string - Endpoint string -} - -// Builder creates a resolver that will be used to watch name resolution updates. -type Builder interface { - // Build creates a new resolver for the given target. - // - // gRPC dial calls Build synchronously, and fails if the returned error is - // not nil. - Build(target Target, cc ClientConn, opts BuildOptions) (Resolver, error) - // Scheme returns the scheme supported by this resolver. - // Scheme is defined at https://github.com/grpc/grpc/blob/master/doc/naming.md. - Scheme() string -} - -// ResolveNowOptions includes additional information for ResolveNow. -type ResolveNowOptions struct{} - -// Resolver watches for the updates on the specified target. -// Updates include address updates and service config updates. -type Resolver interface { - // ResolveNow will be called by gRPC to try to resolve the target name - // again. It's just a hint, resolver can ignore this if it's not necessary. - // - // It could be called multiple times concurrently. - ResolveNow(ResolveNowOptions) - // Close closes the resolver. - Close() -} - -// UnregisterForTesting removes the resolver builder with the given scheme from the -// resolver map. -// This function is for testing only. -func UnregisterForTesting(scheme string) { - delete(m, scheme) -} diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go deleted file mode 100644 index edfda866c..000000000 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ /dev/null @@ -1,222 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 grpc - -import ( - "fmt" - "strings" - "sync" - "time" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcsync" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) - -// ccResolverWrapper is a wrapper on top of cc for resolvers. -// It implements resolver.ClientConn interface. -type ccResolverWrapper struct { - cc *ClientConn - resolverMu sync.Mutex - resolver resolver.Resolver - done *grpcsync.Event - curState resolver.State - - pollingMu sync.Mutex - polling chan struct{} -} - -// newCCResolverWrapper uses the resolver.Builder to build a Resolver and -// returns a ccResolverWrapper object which wraps the newly built resolver. -func newCCResolverWrapper(cc *ClientConn, rb resolver.Builder) (*ccResolverWrapper, error) { - ccr := &ccResolverWrapper{ - cc: cc, - done: grpcsync.NewEvent(), - } - - var credsClone credentials.TransportCredentials - if creds := cc.dopts.copts.TransportCredentials; creds != nil { - credsClone = creds.Clone() - } - rbo := resolver.BuildOptions{ - DisableServiceConfig: cc.dopts.disableServiceConfig, - DialCreds: credsClone, - CredsBundle: cc.dopts.copts.CredsBundle, - Dialer: cc.dopts.copts.Dialer, - } - - var err error - // We need to hold the lock here while we assign to the ccr.resolver field - // to guard against a data race caused by the following code path, - // rb.Build-->ccr.ReportError-->ccr.poll-->ccr.resolveNow, would end up - // accessing ccr.resolver which is being assigned here. - ccr.resolverMu.Lock() - defer ccr.resolverMu.Unlock() - ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, rbo) - if err != nil { - return nil, err - } - return ccr, nil -} - -func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { - ccr.resolverMu.Lock() - if !ccr.done.HasFired() { - ccr.resolver.ResolveNow(o) - } - ccr.resolverMu.Unlock() -} - -func (ccr *ccResolverWrapper) close() { - ccr.resolverMu.Lock() - ccr.resolver.Close() - ccr.done.Fire() - ccr.resolverMu.Unlock() -} - -// poll begins or ends asynchronous polling of the resolver based on whether -// err is ErrBadResolverState. -func (ccr *ccResolverWrapper) poll(err error) { - ccr.pollingMu.Lock() - defer ccr.pollingMu.Unlock() - if err != balancer.ErrBadResolverState { - // stop polling - if ccr.polling != nil { - close(ccr.polling) - ccr.polling = nil - } - return - } - if ccr.polling != nil { - // already polling - return - } - p := make(chan struct{}) - ccr.polling = p - go func() { - for i := 0; ; i++ { - ccr.resolveNow(resolver.ResolveNowOptions{}) - t := time.NewTimer(ccr.cc.dopts.resolveNowBackoff(i)) - select { - case <-p: - t.Stop() - return - case <-ccr.done.Done(): - // Resolver has been closed. - t.Stop() - return - case <-t.C: - select { - case <-p: - return - default: - } - // Timer expired; re-resolve. - } - } - }() -} - -func (ccr *ccResolverWrapper) UpdateState(s resolver.State) { - if ccr.done.HasFired() { - return - } - channelz.Infof(ccr.cc.channelzID, "ccResolverWrapper: sending update to cc: %v", s) - if channelz.IsOn() { - ccr.addChannelzTraceEvent(s) - } - ccr.curState = s - ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil)) -} - -func (ccr *ccResolverWrapper) ReportError(err error) { - if ccr.done.HasFired() { - return - } - channelz.Warningf(ccr.cc.channelzID, "ccResolverWrapper: reporting error to cc: %v", err) - ccr.poll(ccr.cc.updateResolverState(resolver.State{}, err)) -} - -// NewAddress is called by the resolver implementation to send addresses to gRPC. -func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { - if ccr.done.HasFired() { - return - } - channelz.Infof(ccr.cc.channelzID, "ccResolverWrapper: sending new addresses to cc: %v", addrs) - if channelz.IsOn() { - ccr.addChannelzTraceEvent(resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig}) - } - ccr.curState.Addresses = addrs - ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil)) -} - -// NewServiceConfig is called by the resolver implementation to send service -// configs to gRPC. -func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { - if ccr.done.HasFired() { - return - } - channelz.Infof(ccr.cc.channelzID, "ccResolverWrapper: got new service config: %v", sc) - if ccr.cc.dopts.disableServiceConfig { - channelz.Info(ccr.cc.channelzID, "Service config lookups disabled; ignoring config") - return - } - scpr := parseServiceConfig(sc) - if scpr.Err != nil { - channelz.Warningf(ccr.cc.channelzID, "ccResolverWrapper: error parsing service config: %v", scpr.Err) - ccr.poll(balancer.ErrBadResolverState) - return - } - if channelz.IsOn() { - ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: scpr}) - } - ccr.curState.ServiceConfig = scpr - ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil)) -} - -func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { - return parseServiceConfig(scJSON) -} - -func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { - var updates []string - var oldSC, newSC *ServiceConfig - var oldOK, newOK bool - if ccr.curState.ServiceConfig != nil { - oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig) - } - if s.ServiceConfig != nil { - newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig) - } - if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { - updates = append(updates, "service config updated") - } - if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { - updates = append(updates, "resolver returned an empty address list") - } else if len(ccr.curState.Addresses) == 0 && len(s.Addresses) > 0 { - updates = append(updates, "resolver returned new addresses") - } - channelz.AddTraceEvent(ccr.cc.channelzID, 0, &channelz.TraceEventDesc{ - Desc: fmt.Sprintf("Resolver state updated: %+v (%v)", s, strings.Join(updates, "; ")), - Severity: channelz.CtINFO, - }) -} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go deleted file mode 100644 index 8644b8a7d..000000000 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ /dev/null @@ -1,882 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 grpc - -import ( - "bytes" - "compress/gzip" - "context" - "encoding/binary" - "fmt" - "io" - "io/ioutil" - "math" - "net/url" - "strings" - "sync" - "time" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/encoding" - "google.golang.org/grpc/encoding/proto" - "google.golang.org/grpc/internal/transport" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" -) - -// Compressor defines the interface gRPC uses to compress a message. -// -// Deprecated: use package encoding. -type Compressor interface { - // Do compresses p into w. - Do(w io.Writer, p []byte) error - // Type returns the compression algorithm the Compressor uses. - Type() string -} - -type gzipCompressor struct { - pool sync.Pool -} - -// NewGZIPCompressor creates a Compressor based on GZIP. -// -// Deprecated: use package encoding/gzip. -func NewGZIPCompressor() Compressor { - c, _ := NewGZIPCompressorWithLevel(gzip.DefaultCompression) - return c -} - -// NewGZIPCompressorWithLevel is like NewGZIPCompressor but specifies the gzip compression level instead -// of assuming DefaultCompression. -// -// The error returned will be nil if the level is valid. -// -// Deprecated: use package encoding/gzip. -func NewGZIPCompressorWithLevel(level int) (Compressor, error) { - if level < gzip.DefaultCompression || level > gzip.BestCompression { - return nil, fmt.Errorf("grpc: invalid compression level: %d", level) - } - return &gzipCompressor{ - pool: sync.Pool{ - New: func() interface{} { - w, err := gzip.NewWriterLevel(ioutil.Discard, level) - if err != nil { - panic(err) - } - return w - }, - }, - }, nil -} - -func (c *gzipCompressor) Do(w io.Writer, p []byte) error { - z := c.pool.Get().(*gzip.Writer) - defer c.pool.Put(z) - z.Reset(w) - if _, err := z.Write(p); err != nil { - return err - } - return z.Close() -} - -func (c *gzipCompressor) Type() string { - return "gzip" -} - -// Decompressor defines the interface gRPC uses to decompress a message. -// -// Deprecated: use package encoding. -type Decompressor interface { - // Do reads the data from r and uncompress them. - Do(r io.Reader) ([]byte, error) - // Type returns the compression algorithm the Decompressor uses. - Type() string -} - -type gzipDecompressor struct { - pool sync.Pool -} - -// NewGZIPDecompressor creates a Decompressor based on GZIP. -// -// Deprecated: use package encoding/gzip. -func NewGZIPDecompressor() Decompressor { - return &gzipDecompressor{} -} - -func (d *gzipDecompressor) Do(r io.Reader) ([]byte, error) { - var z *gzip.Reader - switch maybeZ := d.pool.Get().(type) { - case nil: - newZ, err := gzip.NewReader(r) - if err != nil { - return nil, err - } - z = newZ - case *gzip.Reader: - z = maybeZ - if err := z.Reset(r); err != nil { - d.pool.Put(z) - return nil, err - } - } - - defer func() { - z.Close() - d.pool.Put(z) - }() - return ioutil.ReadAll(z) -} - -func (d *gzipDecompressor) Type() string { - return "gzip" -} - -// callInfo contains all related configuration and information about an RPC. -type callInfo struct { - compressorType string - failFast bool - maxReceiveMessageSize *int - maxSendMessageSize *int - creds credentials.PerRPCCredentials - contentSubtype string - codec baseCodec - maxRetryRPCBufferSize int -} - -func defaultCallInfo() *callInfo { - return &callInfo{ - failFast: true, - maxRetryRPCBufferSize: 256 * 1024, // 256KB - } -} - -// CallOption configures a Call before it starts or extracts information from -// a Call after it completes. -type CallOption interface { - // before is called before the call is sent to any server. If before - // returns a non-nil error, the RPC fails with that error. - before(*callInfo) error - - // after is called after the call has completed. after cannot return an - // error, so any failures should be reported via output parameters. - after(*callInfo, *csAttempt) -} - -// EmptyCallOption does not alter the Call configuration. -// It can be embedded in another structure to carry satellite data for use -// by interceptors. -type EmptyCallOption struct{} - -func (EmptyCallOption) before(*callInfo) error { return nil } -func (EmptyCallOption) after(*callInfo, *csAttempt) {} - -// Header returns a CallOptions that retrieves the header metadata -// for a unary RPC. -func Header(md *metadata.MD) CallOption { - return HeaderCallOption{HeaderAddr: md} -} - -// HeaderCallOption is a CallOption for collecting response header metadata. -// The metadata field will be populated *after* the RPC completes. -// This is an EXPERIMENTAL API. -type HeaderCallOption struct { - HeaderAddr *metadata.MD -} - -func (o HeaderCallOption) before(c *callInfo) error { return nil } -func (o HeaderCallOption) after(c *callInfo, attempt *csAttempt) { - *o.HeaderAddr, _ = attempt.s.Header() -} - -// Trailer returns a CallOptions that retrieves the trailer metadata -// for a unary RPC. -func Trailer(md *metadata.MD) CallOption { - return TrailerCallOption{TrailerAddr: md} -} - -// TrailerCallOption is a CallOption for collecting response trailer metadata. -// The metadata field will be populated *after* the RPC completes. -// This is an EXPERIMENTAL API. -type TrailerCallOption struct { - TrailerAddr *metadata.MD -} - -func (o TrailerCallOption) before(c *callInfo) error { return nil } -func (o TrailerCallOption) after(c *callInfo, attempt *csAttempt) { - *o.TrailerAddr = attempt.s.Trailer() -} - -// Peer returns a CallOption that retrieves peer information for a unary RPC. -// The peer field will be populated *after* the RPC completes. -func Peer(p *peer.Peer) CallOption { - return PeerCallOption{PeerAddr: p} -} - -// PeerCallOption is a CallOption for collecting the identity of the remote -// peer. The peer field will be populated *after* the RPC completes. -// This is an EXPERIMENTAL API. -type PeerCallOption struct { - PeerAddr *peer.Peer -} - -func (o PeerCallOption) before(c *callInfo) error { return nil } -func (o PeerCallOption) after(c *callInfo, attempt *csAttempt) { - if x, ok := peer.FromContext(attempt.s.Context()); ok { - *o.PeerAddr = *x - } -} - -// WaitForReady configures the action to take when an RPC is attempted on broken -// connections or unreachable servers. If waitForReady is false, the RPC will fail -// immediately. Otherwise, the RPC client will block the call until a -// connection is available (or the call is canceled or times out) and will -// retry the call if it fails due to a transient error. gRPC will not retry if -// data was written to the wire unless the server indicates it did not process -// the data. Please refer to -// https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md. -// -// By default, RPCs don't "wait for ready". -func WaitForReady(waitForReady bool) CallOption { - return FailFastCallOption{FailFast: !waitForReady} -} - -// FailFast is the opposite of WaitForReady. -// -// Deprecated: use WaitForReady. -func FailFast(failFast bool) CallOption { - return FailFastCallOption{FailFast: failFast} -} - -// FailFastCallOption is a CallOption for indicating whether an RPC should fail -// fast or not. -// This is an EXPERIMENTAL API. -type FailFastCallOption struct { - FailFast bool -} - -func (o FailFastCallOption) before(c *callInfo) error { - c.failFast = o.FailFast - return nil -} -func (o FailFastCallOption) after(c *callInfo, attempt *csAttempt) {} - -// MaxCallRecvMsgSize returns a CallOption which sets the maximum message size -// in bytes the client can receive. -func MaxCallRecvMsgSize(bytes int) CallOption { - return MaxRecvMsgSizeCallOption{MaxRecvMsgSize: bytes} -} - -// MaxRecvMsgSizeCallOption is a CallOption that indicates the maximum message -// size in bytes the client can receive. -// This is an EXPERIMENTAL API. -type MaxRecvMsgSizeCallOption struct { - MaxRecvMsgSize int -} - -func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error { - c.maxReceiveMessageSize = &o.MaxRecvMsgSize - return nil -} -func (o MaxRecvMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} - -// MaxCallSendMsgSize returns a CallOption which sets the maximum message size -// in bytes the client can send. -func MaxCallSendMsgSize(bytes int) CallOption { - return MaxSendMsgSizeCallOption{MaxSendMsgSize: bytes} -} - -// MaxSendMsgSizeCallOption is a CallOption that indicates the maximum message -// size in bytes the client can send. -// This is an EXPERIMENTAL API. -type MaxSendMsgSizeCallOption struct { - MaxSendMsgSize int -} - -func (o MaxSendMsgSizeCallOption) before(c *callInfo) error { - c.maxSendMessageSize = &o.MaxSendMsgSize - return nil -} -func (o MaxSendMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} - -// PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials -// for a call. -func PerRPCCredentials(creds credentials.PerRPCCredentials) CallOption { - return PerRPCCredsCallOption{Creds: creds} -} - -// PerRPCCredsCallOption is a CallOption that indicates the per-RPC -// credentials to use for the call. -// This is an EXPERIMENTAL API. -type PerRPCCredsCallOption struct { - Creds credentials.PerRPCCredentials -} - -func (o PerRPCCredsCallOption) before(c *callInfo) error { - c.creds = o.Creds - return nil -} -func (o PerRPCCredsCallOption) after(c *callInfo, attempt *csAttempt) {} - -// UseCompressor returns a CallOption which sets the compressor used when -// sending the request. If WithCompressor is also set, UseCompressor has -// higher priority. -// -// This API is EXPERIMENTAL. -func UseCompressor(name string) CallOption { - return CompressorCallOption{CompressorType: name} -} - -// CompressorCallOption is a CallOption that indicates the compressor to use. -// This is an EXPERIMENTAL API. -type CompressorCallOption struct { - CompressorType string -} - -func (o CompressorCallOption) before(c *callInfo) error { - c.compressorType = o.CompressorType - return nil -} -func (o CompressorCallOption) after(c *callInfo, attempt *csAttempt) {} - -// CallContentSubtype returns a CallOption that will set the content-subtype -// for a call. For example, if content-subtype is "json", the Content-Type over -// the wire will be "application/grpc+json". The content-subtype is converted -// to lowercase before being included in Content-Type. See Content-Type on -// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for -// more details. -// -// If ForceCodec is not also used, the content-subtype will be used to look up -// the Codec to use in the registry controlled by RegisterCodec. See the -// documentation on RegisterCodec for details on registration. The lookup of -// content-subtype is case-insensitive. If no such Codec is found, the call -// will result in an error with code codes.Internal. -// -// If ForceCodec is also used, that Codec will be used for all request and -// response messages, with the content-subtype set to the given contentSubtype -// here for requests. -func CallContentSubtype(contentSubtype string) CallOption { - return ContentSubtypeCallOption{ContentSubtype: strings.ToLower(contentSubtype)} -} - -// ContentSubtypeCallOption is a CallOption that indicates the content-subtype -// used for marshaling messages. -// This is an EXPERIMENTAL API. -type ContentSubtypeCallOption struct { - ContentSubtype string -} - -func (o ContentSubtypeCallOption) before(c *callInfo) error { - c.contentSubtype = o.ContentSubtype - return nil -} -func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {} - -// ForceCodec returns a CallOption that will set the given Codec to be -// used for all request and response messages for a call. The result of calling -// String() will be used as the content-subtype in a case-insensitive manner. -// -// See Content-Type on -// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for -// more details. Also see the documentation on RegisterCodec and -// CallContentSubtype for more details on the interaction between Codec and -// content-subtype. -// -// This function is provided for advanced users; prefer to use only -// CallContentSubtype to select a registered codec instead. -// -// This is an EXPERIMENTAL API. -func ForceCodec(codec encoding.Codec) CallOption { - return ForceCodecCallOption{Codec: codec} -} - -// ForceCodecCallOption is a CallOption that indicates the codec used for -// marshaling messages. -// -// This is an EXPERIMENTAL API. -type ForceCodecCallOption struct { - Codec encoding.Codec -} - -func (o ForceCodecCallOption) before(c *callInfo) error { - c.codec = o.Codec - return nil -} -func (o ForceCodecCallOption) after(c *callInfo, attempt *csAttempt) {} - -// CallCustomCodec behaves like ForceCodec, but accepts a grpc.Codec instead of -// an encoding.Codec. -// -// Deprecated: use ForceCodec instead. -func CallCustomCodec(codec Codec) CallOption { - return CustomCodecCallOption{Codec: codec} -} - -// CustomCodecCallOption is a CallOption that indicates the codec used for -// marshaling messages. -// -// This is an EXPERIMENTAL API. -type CustomCodecCallOption struct { - Codec Codec -} - -func (o CustomCodecCallOption) before(c *callInfo) error { - c.codec = o.Codec - return nil -} -func (o CustomCodecCallOption) after(c *callInfo, attempt *csAttempt) {} - -// MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory -// used for buffering this RPC's requests for retry purposes. -// -// This API is EXPERIMENTAL. -func MaxRetryRPCBufferSize(bytes int) CallOption { - return MaxRetryRPCBufferSizeCallOption{bytes} -} - -// MaxRetryRPCBufferSizeCallOption is a CallOption indicating the amount of -// memory to be used for caching this RPC for retry purposes. -// This is an EXPERIMENTAL API. -type MaxRetryRPCBufferSizeCallOption struct { - MaxRetryRPCBufferSize int -} - -func (o MaxRetryRPCBufferSizeCallOption) before(c *callInfo) error { - c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize - return nil -} -func (o MaxRetryRPCBufferSizeCallOption) after(c *callInfo, attempt *csAttempt) {} - -// The format of the payload: compressed or not? -type payloadFormat uint8 - -const ( - compressionNone payloadFormat = 0 // no compression - compressionMade payloadFormat = 1 // compressed -) - -// parser reads complete gRPC messages from the underlying reader. -type parser struct { - // r is the underlying reader. - // See the comment on recvMsg for the permissible - // error types. - r io.Reader - - // The header of a gRPC message. Find more detail at - // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md - header [5]byte -} - -// recvMsg reads a complete gRPC message from the stream. -// -// It returns the message and its payload (compression/encoding) -// format. The caller owns the returned msg memory. -// -// If there is an error, possible values are: -// * io.EOF, when no messages remain -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * an error from the status package -// No other error values or types must be returned, which also means -// that the underlying io.Reader must not return an incompatible -// error. -func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byte, err error) { - if _, err := p.r.Read(p.header[:]); err != nil { - return 0, nil, err - } - - pf = payloadFormat(p.header[0]) - length := binary.BigEndian.Uint32(p.header[1:]) - - if length == 0 { - return pf, nil, nil - } - if int64(length) > int64(maxInt) { - return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max length allowed on current machine (%d vs. %d)", length, maxInt) - } - if int(length) > maxReceiveMessageSize { - return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", length, maxReceiveMessageSize) - } - // TODO(bradfitz,zhaoq): garbage. reuse buffer after proto decoding instead - // of making it for each message: - msg = make([]byte, int(length)) - if _, err := p.r.Read(msg); err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - return 0, nil, err - } - return pf, msg, nil -} - -// encode serializes msg and returns a buffer containing the message, or an -// error if it is too large to be transmitted by grpc. If msg is nil, it -// generates an empty message. -func encode(c baseCodec, msg interface{}) ([]byte, error) { - if msg == nil { // NOTE: typed nils will not be caught by this check - return nil, nil - } - b, err := c.Marshal(msg) - if err != nil { - return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) - } - if uint(len(b)) > math.MaxUint32 { - return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) - } - return b, nil -} - -// compress returns the input bytes compressed by compressor or cp. If both -// compressors are nil, returns nil. -// -// TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. -func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { - if compressor == nil && cp == nil { - return nil, nil - } - wrapErr := func(err error) error { - return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) - } - cbuf := &bytes.Buffer{} - if compressor != nil { - z, err := compressor.Compress(cbuf) - if err != nil { - return nil, wrapErr(err) - } - if _, err := z.Write(in); err != nil { - return nil, wrapErr(err) - } - if err := z.Close(); err != nil { - return nil, wrapErr(err) - } - } else { - if err := cp.Do(cbuf, in); err != nil { - return nil, wrapErr(err) - } - } - return cbuf.Bytes(), nil -} - -const ( - payloadLen = 1 - sizeLen = 4 - headerLen = payloadLen + sizeLen -) - -// msgHeader returns a 5-byte header for the message being transmitted and the -// payload, which is compData if non-nil or data otherwise. -func msgHeader(data, compData []byte) (hdr []byte, payload []byte) { - hdr = make([]byte, headerLen) - if compData != nil { - hdr[0] = byte(compressionMade) - data = compData - } else { - hdr[0] = byte(compressionNone) - } - - // Write length of payload into buf - binary.BigEndian.PutUint32(hdr[payloadLen:], uint32(len(data))) - return hdr, data -} - -func outPayload(client bool, msg interface{}, data, payload []byte, t time.Time) *stats.OutPayload { - return &stats.OutPayload{ - Client: client, - Payload: msg, - Data: data, - Length: len(data), - WireLength: len(payload) + headerLen, - SentTime: t, - } -} - -func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool) *status.Status { - switch pf { - case compressionNone: - case compressionMade: - if recvCompress == "" || recvCompress == encoding.Identity { - return status.New(codes.Internal, "grpc: compressed flag set with identity or empty encoding") - } - if !haveCompressor { - return status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) - } - default: - return status.Newf(codes.Internal, "grpc: received unexpected payload format %d", pf) - } - return nil -} - -type payloadInfo struct { - wireLength int // The compressed length got from wire. - uncompressedBytes []byte -} - -func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) ([]byte, error) { - pf, d, err := p.recvMsg(maxReceiveMessageSize) - if err != nil { - return nil, err - } - if payInfo != nil { - payInfo.wireLength = len(d) - } - - if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil { - return nil, st.Err() - } - - var size int - if pf == compressionMade { - // To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor, - // use this decompressor as the default. - if dc != nil { - d, err = dc.Do(bytes.NewReader(d)) - size = len(d) - } else { - d, size, err = decompress(compressor, d, maxReceiveMessageSize) - } - if err != nil { - return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) - } - } else { - size = len(d) - } - if size > maxReceiveMessageSize { - // TODO: Revisit the error code. Currently keep it consistent with java - // implementation. - return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", size, maxReceiveMessageSize) - } - return d, nil -} - -// Using compressor, decompress d, returning data and size. -// Optionally, if data will be over maxReceiveMessageSize, just return the size. -func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize int) ([]byte, int, error) { - dcReader, err := compressor.Decompress(bytes.NewReader(d)) - if err != nil { - return nil, 0, err - } - if sizer, ok := compressor.(interface { - DecompressedSize(compressedBytes []byte) int - }); ok { - if size := sizer.DecompressedSize(d); size >= 0 { - if size > maxReceiveMessageSize { - return nil, size, nil - } - // size is used as an estimate to size the buffer, but we - // will read more data if available. - // +MinRead so ReadFrom will not reallocate if size is correct. - buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) - bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - return buf.Bytes(), int(bytesRead), err - } - } - // Read from LimitReader with limit max+1. So if the underlying - // reader is over limit, the result will be bigger than max. - d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - return d, len(d), err -} - -// For the two compressor parameters, both should not be set, but if they are, -// dc takes precedence over compressor. -// TODO(dfawley): wrap the old compressor/decompressor using the new API? -func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error { - d, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor) - if err != nil { - return err - } - if err := c.Unmarshal(d, m); err != nil { - return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message %v", err) - } - if payInfo != nil { - payInfo.uncompressedBytes = d - } - return nil -} - -// Information about RPC -type rpcInfo struct { - failfast bool - preloaderInfo *compressorInfo -} - -// Information about Preloader -// Responsible for storing codec, and compressors -// If stream (s) has context s.Context which stores rpcInfo that has non nil -// pointers to codec, and compressors, then we can use preparedMsg for Async message prep -// and reuse marshalled bytes -type compressorInfo struct { - codec baseCodec - cp Compressor - comp encoding.Compressor -} - -type rpcInfoContextKey struct{} - -func newContextWithRPCInfo(ctx context.Context, failfast bool, codec baseCodec, cp Compressor, comp encoding.Compressor) context.Context { - return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{ - failfast: failfast, - preloaderInfo: &compressorInfo{ - codec: codec, - cp: cp, - comp: comp, - }, - }) -} - -func rpcInfoFromContext(ctx context.Context) (s *rpcInfo, ok bool) { - s, ok = ctx.Value(rpcInfoContextKey{}).(*rpcInfo) - return -} - -// Code returns the error code for err if it was produced by the rpc system. -// Otherwise, it returns codes.Unknown. -// -// Deprecated: use status.Code instead. -func Code(err error) codes.Code { - return status.Code(err) -} - -// ErrorDesc returns the error description of err if it was produced by the rpc system. -// Otherwise, it returns err.Error() or empty string when err is nil. -// -// Deprecated: use status.Convert and Message method instead. -func ErrorDesc(err error) string { - return status.Convert(err).Message() -} - -// Errorf returns an error containing an error code and a description; -// Errorf returns nil if c is OK. -// -// Deprecated: use status.Errorf instead. -func Errorf(c codes.Code, format string, a ...interface{}) error { - return status.Errorf(c, format, a...) -} - -// toRPCErr converts an error into an error from the status package. -func toRPCErr(err error) error { - if err == nil || err == io.EOF { - return err - } - if err == io.ErrUnexpectedEOF { - return status.Error(codes.Internal, err.Error()) - } - if _, ok := status.FromError(err); ok { - return err - } - switch e := err.(type) { - case transport.ConnectionError: - return status.Error(codes.Unavailable, e.Desc) - default: - switch err { - case context.DeadlineExceeded: - return status.Error(codes.DeadlineExceeded, err.Error()) - case context.Canceled: - return status.Error(codes.Canceled, err.Error()) - } - } - return status.Error(codes.Unknown, err.Error()) -} - -// setCallInfoCodec should only be called after CallOptions have been applied. -func setCallInfoCodec(c *callInfo) error { - if c.codec != nil { - // codec was already set by a CallOption; use it. - return nil - } - - if c.contentSubtype == "" { - // No codec specified in CallOptions; use proto by default. - c.codec = encoding.GetCodec(proto.Name) - return nil - } - - // c.contentSubtype is already lowercased in CallContentSubtype - c.codec = encoding.GetCodec(c.contentSubtype) - if c.codec == nil { - return status.Errorf(codes.Internal, "no codec registered for content-subtype %s", c.contentSubtype) - } - return nil -} - -// parseDialTarget returns the network and address to pass to dialer -func parseDialTarget(target string) (net string, addr string) { - net = "tcp" - - m1 := strings.Index(target, ":") - m2 := strings.Index(target, ":/") - - // handle unix:addr which will fail with url.Parse - if m1 >= 0 && m2 < 0 { - if n := target[0:m1]; n == "unix" { - net = n - addr = target[m1+1:] - return net, addr - } - } - if m2 >= 0 { - t, err := url.Parse(target) - if err != nil { - return net, target - } - scheme := t.Scheme - addr = t.Path - if scheme == "unix" { - net = scheme - if addr == "" { - addr = t.Host - } - return net, addr - } - } - - return net, target -} - -// channelzData is used to store channelz related data for ClientConn, addrConn and Server. -// These fields cannot be embedded in the original structs (e.g. ClientConn), since to do atomic -// operation on int64 variable on 32-bit machine, user is responsible to enforce memory alignment. -// Here, by grouping those int64 fields inside a struct, we are enforcing the alignment. -type channelzData struct { - callsStarted int64 - callsFailed int64 - callsSucceeded int64 - // lastCallStartedTime stores the timestamp that last call starts. It is of int64 type instead of - // time.Time since it's more costly to atomically update time.Time variable than int64 variable. - lastCallStartedTime int64 -} - -// The SupportPackageIsVersion variables are referenced from generated protocol -// buffer files to ensure compatibility with the gRPC version used. The latest -// support package version is 6. -// -// Older versions are kept for compatibility. They may be removed if -// compatibility cannot be maintained. -// -// These constants should not be referenced from any other code. -const ( - SupportPackageIsVersion3 = true - SupportPackageIsVersion4 = true - SupportPackageIsVersion5 = true - SupportPackageIsVersion6 = true -) - -const grpcUA = "grpc-go/" + Version diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go deleted file mode 100644 index c2c7cae6c..000000000 --- a/vendor/google.golang.org/grpc/server.go +++ /dev/null @@ -1,1732 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 grpc - -import ( - "context" - "errors" - "fmt" - "io" - "math" - "net" - "net/http" - "reflect" - "runtime" - "strings" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/trace" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/encoding" - "google.golang.org/grpc/encoding/proto" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/binarylog" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" - "google.golang.org/grpc/internal/grpcsync" - "google.golang.org/grpc/internal/transport" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/tap" -) - -const ( - defaultServerMaxReceiveMessageSize = 1024 * 1024 * 4 - defaultServerMaxSendMessageSize = math.MaxInt32 -) - -var statusOK = status.New(codes.OK, "") - -type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error) - -// MethodDesc represents an RPC service's method specification. -type MethodDesc struct { - MethodName string - Handler methodHandler -} - -// ServiceDesc represents an RPC service's specification. -type ServiceDesc struct { - ServiceName string - // The pointer to the service interface. Used to check whether the user - // provided implementation satisfies the interface requirements. - HandlerType interface{} - Methods []MethodDesc - Streams []StreamDesc - Metadata interface{} -} - -// service consists of the information of the server serving this service and -// the methods in this service. -type service struct { - server interface{} // the server for service methods - md map[string]*MethodDesc - sd map[string]*StreamDesc - mdata interface{} -} - -type serverWorkerData struct { - st transport.ServerTransport - wg *sync.WaitGroup - stream *transport.Stream -} - -// Server is a gRPC server to serve RPC requests. -type Server struct { - opts serverOptions - - mu sync.Mutex // guards following - lis map[net.Listener]bool - conns map[transport.ServerTransport]bool - serve bool - drain bool - cv *sync.Cond // signaled when connections close for GracefulStop - m map[string]*service // service name -> service info - events trace.EventLog - - quit *grpcsync.Event - done *grpcsync.Event - channelzRemoveOnce sync.Once - serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop - - channelzID int64 // channelz unique identification number - czData *channelzData - - serverWorkerChannels []chan *serverWorkerData -} - -type serverOptions struct { - creds credentials.TransportCredentials - codec baseCodec - cp Compressor - dc Decompressor - unaryInt UnaryServerInterceptor - streamInt StreamServerInterceptor - chainUnaryInts []UnaryServerInterceptor - chainStreamInts []StreamServerInterceptor - inTapHandle tap.ServerInHandle - statsHandler stats.Handler - maxConcurrentStreams uint32 - maxReceiveMessageSize int - maxSendMessageSize int - unknownStreamDesc *StreamDesc - keepaliveParams keepalive.ServerParameters - keepalivePolicy keepalive.EnforcementPolicy - initialWindowSize int32 - initialConnWindowSize int32 - writeBufferSize int - readBufferSize int - connectionTimeout time.Duration - maxHeaderListSize *uint32 - headerTableSize *uint32 - numServerWorkers uint32 -} - -var defaultServerOptions = serverOptions{ - maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, - maxSendMessageSize: defaultServerMaxSendMessageSize, - connectionTimeout: 120 * time.Second, - writeBufferSize: defaultWriteBufSize, - readBufferSize: defaultReadBufSize, -} - -// A ServerOption sets options such as credentials, codec and keepalive parameters, etc. -type ServerOption interface { - apply(*serverOptions) -} - -// EmptyServerOption does not alter the server configuration. It can be embedded -// in another structure to build custom server options. -// -// This API is EXPERIMENTAL. -type EmptyServerOption struct{} - -func (EmptyServerOption) apply(*serverOptions) {} - -// funcServerOption wraps a function that modifies serverOptions into an -// implementation of the ServerOption interface. -type funcServerOption struct { - f func(*serverOptions) -} - -func (fdo *funcServerOption) apply(do *serverOptions) { - fdo.f(do) -} - -func newFuncServerOption(f func(*serverOptions)) *funcServerOption { - return &funcServerOption{ - f: f, - } -} - -// WriteBufferSize determines how much data can be batched before doing a write on the wire. -// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. -// The default value for this buffer is 32KB. -// Zero will disable the write buffer such that each write will be on underlying connection. -// Note: A Send call may not directly translate to a write. -func WriteBufferSize(s int) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.writeBufferSize = s - }) -} - -// ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most -// for one read syscall. -// The default value for this buffer is 32KB. -// Zero will disable read buffer for a connection so data framer can access the underlying -// conn directly. -func ReadBufferSize(s int) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.readBufferSize = s - }) -} - -// InitialWindowSize returns a ServerOption that sets window size for stream. -// The lower bound for window size is 64K and any value smaller than that will be ignored. -func InitialWindowSize(s int32) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.initialWindowSize = s - }) -} - -// InitialConnWindowSize returns a ServerOption that sets window size for a connection. -// The lower bound for window size is 64K and any value smaller than that will be ignored. -func InitialConnWindowSize(s int32) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.initialConnWindowSize = s - }) -} - -// KeepaliveParams returns a ServerOption that sets keepalive and max-age parameters for the server. -func KeepaliveParams(kp keepalive.ServerParameters) ServerOption { - if kp.Time > 0 && kp.Time < time.Second { - grpclog.Warning("Adjusting keepalive ping interval to minimum period of 1s") - kp.Time = time.Second - } - - return newFuncServerOption(func(o *serverOptions) { - o.keepaliveParams = kp - }) -} - -// KeepaliveEnforcementPolicy returns a ServerOption that sets keepalive enforcement policy for the server. -func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.keepalivePolicy = kep - }) -} - -// CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. -// -// This will override any lookups by content-subtype for Codecs registered with RegisterCodec. -func CustomCodec(codec Codec) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.codec = codec - }) -} - -// RPCCompressor returns a ServerOption that sets a compressor for outbound -// messages. For backward compatibility, all outbound messages will be sent -// using this compressor, regardless of incoming message compression. By -// default, server messages will be sent using the same compressor with which -// request messages were sent. -// -// Deprecated: use encoding.RegisterCompressor instead. -func RPCCompressor(cp Compressor) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.cp = cp - }) -} - -// RPCDecompressor returns a ServerOption that sets a decompressor for inbound -// messages. It has higher priority than decompressors registered via -// encoding.RegisterCompressor. -// -// Deprecated: use encoding.RegisterCompressor instead. -func RPCDecompressor(dc Decompressor) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.dc = dc - }) -} - -// MaxMsgSize returns a ServerOption to set the max message size in bytes the server can receive. -// If this is not set, gRPC uses the default limit. -// -// Deprecated: use MaxRecvMsgSize instead. -func MaxMsgSize(m int) ServerOption { - return MaxRecvMsgSize(m) -} - -// MaxRecvMsgSize returns a ServerOption to set the max message size in bytes the server can receive. -// If this is not set, gRPC uses the default 4MB. -func MaxRecvMsgSize(m int) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.maxReceiveMessageSize = m - }) -} - -// MaxSendMsgSize returns a ServerOption to set the max message size in bytes the server can send. -// If this is not set, gRPC uses the default `math.MaxInt32`. -func MaxSendMsgSize(m int) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.maxSendMessageSize = m - }) -} - -// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number -// of concurrent streams to each ServerTransport. -func MaxConcurrentStreams(n uint32) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.maxConcurrentStreams = n - }) -} - -// Creds returns a ServerOption that sets credentials for server connections. -func Creds(c credentials.TransportCredentials) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.creds = c - }) -} - -// UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the -// server. Only one unary interceptor can be installed. The construction of multiple -// interceptors (e.g., chaining) can be implemented at the caller. -func UnaryInterceptor(i UnaryServerInterceptor) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - if o.unaryInt != nil { - panic("The unary server interceptor was already set and may not be reset.") - } - o.unaryInt = i - }) -} - -// ChainUnaryInterceptor returns a ServerOption that specifies the chained interceptor -// for unary RPCs. The first interceptor will be the outer most, -// while the last interceptor will be the inner most wrapper around the real call. -// All unary interceptors added by this method will be chained. -func ChainUnaryInterceptor(interceptors ...UnaryServerInterceptor) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.chainUnaryInts = append(o.chainUnaryInts, interceptors...) - }) -} - -// StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the -// server. Only one stream interceptor can be installed. -func StreamInterceptor(i StreamServerInterceptor) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - if o.streamInt != nil { - panic("The stream server interceptor was already set and may not be reset.") - } - o.streamInt = i - }) -} - -// ChainStreamInterceptor returns a ServerOption that specifies the chained interceptor -// for streaming RPCs. The first interceptor will be the outer most, -// while the last interceptor will be the inner most wrapper around the real call. -// All stream interceptors added by this method will be chained. -func ChainStreamInterceptor(interceptors ...StreamServerInterceptor) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.chainStreamInts = append(o.chainStreamInts, interceptors...) - }) -} - -// InTapHandle returns a ServerOption that sets the tap handle for all the server -// transport to be created. Only one can be installed. -func InTapHandle(h tap.ServerInHandle) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - if o.inTapHandle != nil { - panic("The tap handle was already set and may not be reset.") - } - o.inTapHandle = h - }) -} - -// StatsHandler returns a ServerOption that sets the stats handler for the server. -func StatsHandler(h stats.Handler) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.statsHandler = h - }) -} - -// UnknownServiceHandler returns a ServerOption that allows for adding a custom -// unknown service handler. The provided method is a bidi-streaming RPC service -// handler that will be invoked instead of returning the "unimplemented" gRPC -// error whenever a request is received for an unregistered service or method. -// The handling function and stream interceptor (if set) have full access to -// the ServerStream, including its Context. -func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.unknownStreamDesc = &StreamDesc{ - StreamName: "unknown_service_handler", - Handler: streamHandler, - // We need to assume that the users of the streamHandler will want to use both. - ClientStreams: true, - ServerStreams: true, - } - }) -} - -// ConnectionTimeout returns a ServerOption that sets the timeout for -// connection establishment (up to and including HTTP/2 handshaking) for all -// new connections. If this is not set, the default is 120 seconds. A zero or -// negative value will result in an immediate timeout. -// -// This API is EXPERIMENTAL. -func ConnectionTimeout(d time.Duration) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.connectionTimeout = d - }) -} - -// MaxHeaderListSize returns a ServerOption that sets the max (uncompressed) size -// of header list that the server is prepared to accept. -func MaxHeaderListSize(s uint32) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.maxHeaderListSize = &s - }) -} - -// HeaderTableSize returns a ServerOption that sets the size of dynamic -// header table for stream. -// -// This API is EXPERIMENTAL. -func HeaderTableSize(s uint32) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.headerTableSize = &s - }) -} - -// NumStreamWorkers returns a ServerOption that sets the number of worker -// goroutines that should be used to process incoming streams. Setting this to -// zero (default) will disable workers and spawn a new goroutine for each -// stream. -// -// This API is EXPERIMENTAL. -func NumStreamWorkers(numServerWorkers uint32) ServerOption { - // TODO: If/when this API gets stabilized (i.e. stream workers become the - // only way streams are processed), change the behavior of the zero value to - // a sane default. Preliminary experiments suggest that a value equal to the - // number of CPUs available is most performant; requires thorough testing. - return newFuncServerOption(func(o *serverOptions) { - o.numServerWorkers = numServerWorkers - }) -} - -// serverWorkerResetThreshold defines how often the stack must be reset. Every -// N requests, by spawning a new goroutine in its place, a worker can reset its -// stack so that large stacks don't live in memory forever. 2^16 should allow -// each goroutine stack to live for at least a few seconds in a typical -// workload (assuming a QPS of a few thousand requests/sec). -const serverWorkerResetThreshold = 1 << 16 - -// serverWorkers blocks on a *transport.Stream channel forever and waits for -// data to be fed by serveStreams. This allows different requests to be -// processed by the same goroutine, removing the need for expensive stack -// re-allocations (see the runtime.morestack problem [1]). -// -// [1] https://github.com/golang/go/issues/18138 -func (s *Server) serverWorker(ch chan *serverWorkerData) { - // To make sure all server workers don't reset at the same time, choose a - // random number of iterations before resetting. - threshold := serverWorkerResetThreshold + grpcrand.Intn(serverWorkerResetThreshold) - for completed := 0; completed < threshold; completed++ { - data, ok := <-ch - if !ok { - return - } - s.handleStream(data.st, data.stream, s.traceInfo(data.st, data.stream)) - data.wg.Done() - } - go s.serverWorker(ch) -} - -// initServerWorkers creates worker goroutines and channels to process incoming -// connections to reduce the time spent overall on runtime.morestack. -func (s *Server) initServerWorkers() { - s.serverWorkerChannels = make([]chan *serverWorkerData, s.opts.numServerWorkers) - for i := uint32(0); i < s.opts.numServerWorkers; i++ { - s.serverWorkerChannels[i] = make(chan *serverWorkerData) - go s.serverWorker(s.serverWorkerChannels[i]) - } -} - -func (s *Server) stopServerWorkers() { - for i := uint32(0); i < s.opts.numServerWorkers; i++ { - close(s.serverWorkerChannels[i]) - } -} - -// NewServer creates a gRPC server which has no service registered and has not -// started to accept requests yet. -func NewServer(opt ...ServerOption) *Server { - opts := defaultServerOptions - for _, o := range opt { - o.apply(&opts) - } - s := &Server{ - lis: make(map[net.Listener]bool), - opts: opts, - conns: make(map[transport.ServerTransport]bool), - m: make(map[string]*service), - quit: grpcsync.NewEvent(), - done: grpcsync.NewEvent(), - czData: new(channelzData), - } - chainUnaryServerInterceptors(s) - chainStreamServerInterceptors(s) - s.cv = sync.NewCond(&s.mu) - if EnableTracing { - _, file, line, _ := runtime.Caller(1) - s.events = trace.NewEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line)) - } - - if s.opts.numServerWorkers > 0 { - s.initServerWorkers() - } - - if channelz.IsOn() { - s.channelzID = channelz.RegisterServer(&channelzServer{s}, "") - } - return s -} - -// printf records an event in s's event log, unless s has been stopped. -// REQUIRES s.mu is held. -func (s *Server) printf(format string, a ...interface{}) { - if s.events != nil { - s.events.Printf(format, a...) - } -} - -// errorf records an error in s's event log, unless s has been stopped. -// REQUIRES s.mu is held. -func (s *Server) errorf(format string, a ...interface{}) { - if s.events != nil { - s.events.Errorf(format, a...) - } -} - -// RegisterService registers a service and its implementation to the gRPC -// server. It is called from the IDL generated code. This must be called before -// invoking Serve. -func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) { - ht := reflect.TypeOf(sd.HandlerType).Elem() - st := reflect.TypeOf(ss) - if !st.Implements(ht) { - grpclog.Fatalf("grpc: Server.RegisterService found the handler of type %v that does not satisfy %v", st, ht) - } - s.register(sd, ss) -} - -func (s *Server) register(sd *ServiceDesc, ss interface{}) { - s.mu.Lock() - defer s.mu.Unlock() - s.printf("RegisterService(%q)", sd.ServiceName) - if s.serve { - grpclog.Fatalf("grpc: Server.RegisterService after Server.Serve for %q", sd.ServiceName) - } - if _, ok := s.m[sd.ServiceName]; ok { - grpclog.Fatalf("grpc: Server.RegisterService found duplicate service registration for %q", sd.ServiceName) - } - srv := &service{ - server: ss, - md: make(map[string]*MethodDesc), - sd: make(map[string]*StreamDesc), - mdata: sd.Metadata, - } - for i := range sd.Methods { - d := &sd.Methods[i] - srv.md[d.MethodName] = d - } - for i := range sd.Streams { - d := &sd.Streams[i] - srv.sd[d.StreamName] = d - } - s.m[sd.ServiceName] = srv -} - -// MethodInfo contains the information of an RPC including its method name and type. -type MethodInfo struct { - // Name is the method name only, without the service name or package name. - Name string - // IsClientStream indicates whether the RPC is a client streaming RPC. - IsClientStream bool - // IsServerStream indicates whether the RPC is a server streaming RPC. - IsServerStream bool -} - -// ServiceInfo contains unary RPC method info, streaming RPC method info and metadata for a service. -type ServiceInfo struct { - Methods []MethodInfo - // Metadata is the metadata specified in ServiceDesc when registering service. - Metadata interface{} -} - -// GetServiceInfo returns a map from service names to ServiceInfo. -// Service names include the package names, in the form of .. -func (s *Server) GetServiceInfo() map[string]ServiceInfo { - ret := make(map[string]ServiceInfo) - for n, srv := range s.m { - methods := make([]MethodInfo, 0, len(srv.md)+len(srv.sd)) - for m := range srv.md { - methods = append(methods, MethodInfo{ - Name: m, - IsClientStream: false, - IsServerStream: false, - }) - } - for m, d := range srv.sd { - methods = append(methods, MethodInfo{ - Name: m, - IsClientStream: d.ClientStreams, - IsServerStream: d.ServerStreams, - }) - } - - ret[n] = ServiceInfo{ - Methods: methods, - Metadata: srv.mdata, - } - } - return ret -} - -// ErrServerStopped indicates that the operation is now illegal because of -// the server being stopped. -var ErrServerStopped = errors.New("grpc: the server has been stopped") - -func (s *Server) useTransportAuthenticator(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { - if s.opts.creds == nil { - return rawConn, nil, nil - } - return s.opts.creds.ServerHandshake(rawConn) -} - -type listenSocket struct { - net.Listener - channelzID int64 -} - -func (l *listenSocket) ChannelzMetric() *channelz.SocketInternalMetric { - return &channelz.SocketInternalMetric{ - SocketOptions: channelz.GetSocketOption(l.Listener), - LocalAddr: l.Listener.Addr(), - } -} - -func (l *listenSocket) Close() error { - err := l.Listener.Close() - if channelz.IsOn() { - channelz.RemoveEntry(l.channelzID) - } - return err -} - -// Serve accepts incoming connections on the listener lis, creating a new -// ServerTransport and service goroutine for each. The service goroutines -// read gRPC requests and then call the registered handlers to reply to them. -// Serve returns when lis.Accept fails with fatal errors. lis will be closed when -// this method returns. -// Serve will return a non-nil error unless Stop or GracefulStop is called. -func (s *Server) Serve(lis net.Listener) error { - s.mu.Lock() - s.printf("serving") - s.serve = true - if s.lis == nil { - // Serve called after Stop or GracefulStop. - s.mu.Unlock() - lis.Close() - return ErrServerStopped - } - - s.serveWG.Add(1) - defer func() { - s.serveWG.Done() - if s.quit.HasFired() { - // Stop or GracefulStop called; block until done and return nil. - <-s.done.Done() - } - }() - - ls := &listenSocket{Listener: lis} - s.lis[ls] = true - - if channelz.IsOn() { - ls.channelzID = channelz.RegisterListenSocket(ls, s.channelzID, lis.Addr().String()) - } - s.mu.Unlock() - - defer func() { - s.mu.Lock() - if s.lis != nil && s.lis[ls] { - ls.Close() - delete(s.lis, ls) - } - s.mu.Unlock() - }() - - var tempDelay time.Duration // how long to sleep on accept failure - - for { - rawConn, err := lis.Accept() - if err != nil { - if ne, ok := err.(interface { - Temporary() bool - }); ok && ne.Temporary() { - if tempDelay == 0 { - tempDelay = 5 * time.Millisecond - } else { - tempDelay *= 2 - } - if max := 1 * time.Second; tempDelay > max { - tempDelay = max - } - s.mu.Lock() - s.printf("Accept error: %v; retrying in %v", err, tempDelay) - s.mu.Unlock() - timer := time.NewTimer(tempDelay) - select { - case <-timer.C: - case <-s.quit.Done(): - timer.Stop() - return nil - } - continue - } - s.mu.Lock() - s.printf("done serving; Accept = %v", err) - s.mu.Unlock() - - if s.quit.HasFired() { - return nil - } - return err - } - tempDelay = 0 - // Start a new goroutine to deal with rawConn so we don't stall this Accept - // loop goroutine. - // - // Make sure we account for the goroutine so GracefulStop doesn't nil out - // s.conns before this conn can be added. - s.serveWG.Add(1) - go func() { - s.handleRawConn(rawConn) - s.serveWG.Done() - }() - } -} - -// handleRawConn forks a goroutine to handle a just-accepted connection that -// has not had any I/O performed on it yet. -func (s *Server) handleRawConn(rawConn net.Conn) { - if s.quit.HasFired() { - rawConn.Close() - return - } - rawConn.SetDeadline(time.Now().Add(s.opts.connectionTimeout)) - conn, authInfo, err := s.useTransportAuthenticator(rawConn) - if err != nil { - // ErrConnDispatched means that the connection was dispatched away from - // gRPC; those connections should be left open. - if err != credentials.ErrConnDispatched { - s.mu.Lock() - s.errorf("ServerHandshake(%q) failed: %v", rawConn.RemoteAddr(), err) - s.mu.Unlock() - channelz.Warningf(s.channelzID, "grpc: Server.Serve failed to complete security handshake from %q: %v", rawConn.RemoteAddr(), err) - rawConn.Close() - } - rawConn.SetDeadline(time.Time{}) - return - } - - // Finish handshaking (HTTP2) - st := s.newHTTP2Transport(conn, authInfo) - if st == nil { - return - } - - rawConn.SetDeadline(time.Time{}) - if !s.addConn(st) { - return - } - go func() { - s.serveStreams(st) - s.removeConn(st) - }() -} - -// newHTTP2Transport sets up a http/2 transport (using the -// gRPC http2 server transport in transport/http2_server.go). -func (s *Server) newHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) transport.ServerTransport { - config := &transport.ServerConfig{ - MaxStreams: s.opts.maxConcurrentStreams, - AuthInfo: authInfo, - InTapHandle: s.opts.inTapHandle, - StatsHandler: s.opts.statsHandler, - KeepaliveParams: s.opts.keepaliveParams, - KeepalivePolicy: s.opts.keepalivePolicy, - InitialWindowSize: s.opts.initialWindowSize, - InitialConnWindowSize: s.opts.initialConnWindowSize, - WriteBufferSize: s.opts.writeBufferSize, - ReadBufferSize: s.opts.readBufferSize, - ChannelzParentID: s.channelzID, - MaxHeaderListSize: s.opts.maxHeaderListSize, - HeaderTableSize: s.opts.headerTableSize, - } - st, err := transport.NewServerTransport("http2", c, config) - if err != nil { - s.mu.Lock() - s.errorf("NewServerTransport(%q) failed: %v", c.RemoteAddr(), err) - s.mu.Unlock() - c.Close() - channelz.Warning(s.channelzID, "grpc: Server.Serve failed to create ServerTransport: ", err) - return nil - } - - return st -} - -func (s *Server) serveStreams(st transport.ServerTransport) { - defer st.Close() - var wg sync.WaitGroup - - var roundRobinCounter uint32 - st.HandleStreams(func(stream *transport.Stream) { - wg.Add(1) - if s.opts.numServerWorkers > 0 { - data := &serverWorkerData{st: st, wg: &wg, stream: stream} - select { - case s.serverWorkerChannels[atomic.AddUint32(&roundRobinCounter, 1)%s.opts.numServerWorkers] <- data: - default: - // If all stream workers are busy, fallback to the default code path. - go func() { - s.handleStream(st, stream, s.traceInfo(st, stream)) - wg.Done() - }() - } - } else { - go func() { - defer wg.Done() - s.handleStream(st, stream, s.traceInfo(st, stream)) - }() - } - }, func(ctx context.Context, method string) context.Context { - if !EnableTracing { - return ctx - } - tr := trace.New("grpc.Recv."+methodFamily(method), method) - return trace.NewContext(ctx, tr) - }) - wg.Wait() -} - -var _ http.Handler = (*Server)(nil) - -// ServeHTTP implements the Go standard library's http.Handler -// interface by responding to the gRPC request r, by looking up -// the requested gRPC method in the gRPC server s. -// -// The provided HTTP request must have arrived on an HTTP/2 -// connection. When using the Go standard library's server, -// practically this means that the Request must also have arrived -// over TLS. -// -// To share one port (such as 443 for https) between gRPC and an -// existing http.Handler, use a root http.Handler such as: -// -// if r.ProtoMajor == 2 && strings.HasPrefix( -// r.Header.Get("Content-Type"), "application/grpc") { -// grpcServer.ServeHTTP(w, r) -// } else { -// yourMux.ServeHTTP(w, r) -// } -// -// Note that ServeHTTP uses Go's HTTP/2 server implementation which is totally -// separate from grpc-go's HTTP/2 server. Performance and features may vary -// between the two paths. ServeHTTP does not support some gRPC features -// available through grpc-go's HTTP/2 server, and it is currently EXPERIMENTAL -// and subject to change. -func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandler) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - if !s.addConn(st) { - return - } - defer s.removeConn(st) - s.serveStreams(st) -} - -// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. -// If tracing is not enabled, it returns nil. -func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { - if !EnableTracing { - return nil - } - tr, ok := trace.FromContext(stream.Context()) - if !ok { - return nil - } - - trInfo = &traceInfo{ - tr: tr, - firstLine: firstLine{ - client: false, - remoteAddr: st.RemoteAddr(), - }, - } - if dl, ok := stream.Context().Deadline(); ok { - trInfo.firstLine.deadline = time.Until(dl) - } - return trInfo -} - -func (s *Server) addConn(st transport.ServerTransport) bool { - s.mu.Lock() - defer s.mu.Unlock() - if s.conns == nil { - st.Close() - return false - } - if s.drain { - // Transport added after we drained our existing conns: drain it - // immediately. - st.Drain() - } - s.conns[st] = true - return true -} - -func (s *Server) removeConn(st transport.ServerTransport) { - s.mu.Lock() - defer s.mu.Unlock() - if s.conns != nil { - delete(s.conns, st) - s.cv.Broadcast() - } -} - -func (s *Server) channelzMetric() *channelz.ServerInternalMetric { - return &channelz.ServerInternalMetric{ - CallsStarted: atomic.LoadInt64(&s.czData.callsStarted), - CallsSucceeded: atomic.LoadInt64(&s.czData.callsSucceeded), - CallsFailed: atomic.LoadInt64(&s.czData.callsFailed), - LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&s.czData.lastCallStartedTime)), - } -} - -func (s *Server) incrCallsStarted() { - atomic.AddInt64(&s.czData.callsStarted, 1) - atomic.StoreInt64(&s.czData.lastCallStartedTime, time.Now().UnixNano()) -} - -func (s *Server) incrCallsSucceeded() { - atomic.AddInt64(&s.czData.callsSucceeded, 1) -} - -func (s *Server) incrCallsFailed() { - atomic.AddInt64(&s.czData.callsFailed, 1) -} - -func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { - data, err := encode(s.getCodec(stream.ContentSubtype()), msg) - if err != nil { - channelz.Error(s.channelzID, "grpc: server failed to encode response: ", err) - return err - } - compData, err := compress(data, cp, comp) - if err != nil { - channelz.Error(s.channelzID, "grpc: server failed to compress response: ", err) - return err - } - hdr, payload := msgHeader(data, compData) - // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > s.opts.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize) - } - err = t.Write(stream, hdr, payload, opts) - if err == nil && s.opts.statsHandler != nil { - s.opts.statsHandler.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now())) - } - return err -} - -// chainUnaryServerInterceptors chains all unary server interceptors into one. -func chainUnaryServerInterceptors(s *Server) { - // Prepend opts.unaryInt to the chaining interceptors if it exists, since unaryInt will - // be executed before any other chained interceptors. - interceptors := s.opts.chainUnaryInts - if s.opts.unaryInt != nil { - interceptors = append([]UnaryServerInterceptor{s.opts.unaryInt}, s.opts.chainUnaryInts...) - } - - var chainedInt UnaryServerInterceptor - if len(interceptors) == 0 { - chainedInt = nil - } else if len(interceptors) == 1 { - chainedInt = interceptors[0] - } else { - chainedInt = func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (interface{}, error) { - return interceptors[0](ctx, req, info, getChainUnaryHandler(interceptors, 0, info, handler)) - } - } - - s.opts.unaryInt = chainedInt -} - -// getChainUnaryHandler recursively generate the chained UnaryHandler -func getChainUnaryHandler(interceptors []UnaryServerInterceptor, curr int, info *UnaryServerInfo, finalHandler UnaryHandler) UnaryHandler { - if curr == len(interceptors)-1 { - return finalHandler - } - - return func(ctx context.Context, req interface{}) (interface{}, error) { - return interceptors[curr+1](ctx, req, info, getChainUnaryHandler(interceptors, curr+1, info, finalHandler)) - } -} - -func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) { - sh := s.opts.statsHandler - if sh != nil || trInfo != nil || channelz.IsOn() { - if channelz.IsOn() { - s.incrCallsStarted() - } - var statsBegin *stats.Begin - if sh != nil { - beginTime := time.Now() - statsBegin = &stats.Begin{ - BeginTime: beginTime, - } - sh.HandleRPC(stream.Context(), statsBegin) - } - if trInfo != nil { - trInfo.tr.LazyLog(&trInfo.firstLine, false) - } - // The deferred error handling for tracing, stats handler and channelz are - // combined into one function to reduce stack usage -- a defer takes ~56-64 - // bytes on the stack, so overflowing the stack will require a stack - // re-allocation, which is expensive. - // - // To maintain behavior similar to separate deferred statements, statements - // should be executed in the reverse order. That is, tracing first, stats - // handler second, and channelz last. Note that panics *within* defers will - // lead to different behavior, but that's an acceptable compromise; that - // would be undefined behavior territory anyway. - defer func() { - if trInfo != nil { - if err != nil && err != io.EOF { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - trInfo.tr.Finish() - } - - if sh != nil { - end := &stats.End{ - BeginTime: statsBegin.BeginTime, - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - } - - if channelz.IsOn() { - if err != nil && err != io.EOF { - s.incrCallsFailed() - } else { - s.incrCallsSucceeded() - } - } - }() - } - - binlog := binarylog.GetMethodLogger(stream.Method()) - if binlog != nil { - ctx := stream.Context() - md, _ := metadata.FromIncomingContext(ctx) - logEntry := &binarylog.ClientHeader{ - Header: md, - MethodName: stream.Method(), - PeerAddr: nil, - } - if deadline, ok := ctx.Deadline(); ok { - logEntry.Timeout = time.Until(deadline) - if logEntry.Timeout < 0 { - logEntry.Timeout = 0 - } - } - if a := md[":authority"]; len(a) > 0 { - logEntry.Authority = a[0] - } - if peer, ok := peer.FromContext(ctx); ok { - logEntry.PeerAddr = peer.Addr - } - binlog.Log(logEntry) - } - - // comp and cp are used for compression. decomp and dc are used for - // decompression. If comp and decomp are both set, they are the same; - // however they are kept separate to ensure that at most one of the - // compressor/decompressor variable pairs are set for use later. - var comp, decomp encoding.Compressor - var cp Compressor - var dc Decompressor - - // If dc is set and matches the stream's compression, use it. Otherwise, try - // to find a matching registered compressor for decomp. - if rc := stream.RecvCompress(); s.opts.dc != nil && s.opts.dc.Type() == rc { - dc = s.opts.dc - } else if rc != "" && rc != encoding.Identity { - decomp = encoding.GetCompressor(rc) - if decomp == nil { - st := status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", rc) - t.WriteStatus(stream, st) - return st.Err() - } - } - - // If cp is set, use it. Otherwise, attempt to compress the response using - // the incoming message compression method. - // - // NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686. - if s.opts.cp != nil { - cp = s.opts.cp - stream.SetSendCompress(cp.Type()) - } else if rc := stream.RecvCompress(); rc != "" && rc != encoding.Identity { - // Legacy compressor not specified; attempt to respond with same encoding. - comp = encoding.GetCompressor(rc) - if comp != nil { - stream.SetSendCompress(rc) - } - } - - var payInfo *payloadInfo - if sh != nil || binlog != nil { - payInfo = &payloadInfo{} - } - d, err := recvAndDecompress(&parser{r: stream}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp) - if err != nil { - if st, ok := status.FromError(err); ok { - if e := t.WriteStatus(stream, st); e != nil { - channelz.Warningf(s.channelzID, "grpc: Server.processUnaryRPC failed to write status %v", e) - } - } - return err - } - if channelz.IsOn() { - t.IncrMsgRecv() - } - df := func(v interface{}) error { - if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil { - return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) - } - if sh != nil { - sh.HandleRPC(stream.Context(), &stats.InPayload{ - RecvTime: time.Now(), - Payload: v, - WireLength: payInfo.wireLength, - Data: d, - Length: len(d), - }) - } - if binlog != nil { - binlog.Log(&binarylog.ClientMessage{ - Message: d, - }) - } - if trInfo != nil { - trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true) - } - return nil - } - ctx := NewContextWithServerTransportStream(stream.Context(), stream) - reply, appErr := md.Handler(srv.server, ctx, df, s.opts.unaryInt) - if appErr != nil { - appStatus, ok := status.FromError(appErr) - if !ok { - // Convert appErr if it is not a grpc status error. - appErr = status.Error(codes.Unknown, appErr.Error()) - appStatus, _ = status.FromError(appErr) - } - if trInfo != nil { - trInfo.tr.LazyLog(stringer(appStatus.Message()), true) - trInfo.tr.SetError() - } - if e := t.WriteStatus(stream, appStatus); e != nil { - channelz.Warningf(s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e) - } - if binlog != nil { - if h, _ := stream.Header(); h.Len() > 0 { - // Only log serverHeader if there was header. Otherwise it can - // be trailer only. - binlog.Log(&binarylog.ServerHeader{ - Header: h, - }) - } - binlog.Log(&binarylog.ServerTrailer{ - Trailer: stream.Trailer(), - Err: appErr, - }) - } - return appErr - } - if trInfo != nil { - trInfo.tr.LazyLog(stringer("OK"), false) - } - opts := &transport.Options{Last: true} - - if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil { - if err == io.EOF { - // The entire stream is done (for unary RPC only). - return err - } - if sts, ok := status.FromError(err); ok { - if e := t.WriteStatus(stream, sts); e != nil { - channelz.Warningf(s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e) - } - } else { - switch st := err.(type) { - case transport.ConnectionError: - // Nothing to do here. - default: - panic(fmt.Sprintf("grpc: Unexpected error (%T) from sendResponse: %v", st, st)) - } - } - if binlog != nil { - h, _ := stream.Header() - binlog.Log(&binarylog.ServerHeader{ - Header: h, - }) - binlog.Log(&binarylog.ServerTrailer{ - Trailer: stream.Trailer(), - Err: appErr, - }) - } - return err - } - if binlog != nil { - h, _ := stream.Header() - binlog.Log(&binarylog.ServerHeader{ - Header: h, - }) - binlog.Log(&binarylog.ServerMessage{ - Message: reply, - }) - } - if channelz.IsOn() { - t.IncrMsgSent() - } - if trInfo != nil { - trInfo.tr.LazyLog(&payload{sent: true, msg: reply}, true) - } - // TODO: Should we be logging if writing status failed here, like above? - // Should the logging be in WriteStatus? Should we ignore the WriteStatus - // error or allow the stats handler to see it? - err = t.WriteStatus(stream, statusOK) - if binlog != nil { - binlog.Log(&binarylog.ServerTrailer{ - Trailer: stream.Trailer(), - Err: appErr, - }) - } - return err -} - -// chainStreamServerInterceptors chains all stream server interceptors into one. -func chainStreamServerInterceptors(s *Server) { - // Prepend opts.streamInt to the chaining interceptors if it exists, since streamInt will - // be executed before any other chained interceptors. - interceptors := s.opts.chainStreamInts - if s.opts.streamInt != nil { - interceptors = append([]StreamServerInterceptor{s.opts.streamInt}, s.opts.chainStreamInts...) - } - - var chainedInt StreamServerInterceptor - if len(interceptors) == 0 { - chainedInt = nil - } else if len(interceptors) == 1 { - chainedInt = interceptors[0] - } else { - chainedInt = func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error { - return interceptors[0](srv, ss, info, getChainStreamHandler(interceptors, 0, info, handler)) - } - } - - s.opts.streamInt = chainedInt -} - -// getChainStreamHandler recursively generate the chained StreamHandler -func getChainStreamHandler(interceptors []StreamServerInterceptor, curr int, info *StreamServerInfo, finalHandler StreamHandler) StreamHandler { - if curr == len(interceptors)-1 { - return finalHandler - } - - return func(srv interface{}, ss ServerStream) error { - return interceptors[curr+1](srv, ss, info, getChainStreamHandler(interceptors, curr+1, info, finalHandler)) - } -} - -func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) { - if channelz.IsOn() { - s.incrCallsStarted() - } - sh := s.opts.statsHandler - var statsBegin *stats.Begin - if sh != nil { - beginTime := time.Now() - statsBegin = &stats.Begin{ - BeginTime: beginTime, - } - sh.HandleRPC(stream.Context(), statsBegin) - } - ctx := NewContextWithServerTransportStream(stream.Context(), stream) - ss := &serverStream{ - ctx: ctx, - t: t, - s: stream, - p: &parser{r: stream}, - codec: s.getCodec(stream.ContentSubtype()), - maxReceiveMessageSize: s.opts.maxReceiveMessageSize, - maxSendMessageSize: s.opts.maxSendMessageSize, - trInfo: trInfo, - statsHandler: sh, - } - - if sh != nil || trInfo != nil || channelz.IsOn() { - // See comment in processUnaryRPC on defers. - defer func() { - if trInfo != nil { - ss.mu.Lock() - if err != nil && err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - ss.trInfo.tr.Finish() - ss.trInfo.tr = nil - ss.mu.Unlock() - } - - if sh != nil { - end := &stats.End{ - BeginTime: statsBegin.BeginTime, - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - } - - if channelz.IsOn() { - if err != nil && err != io.EOF { - s.incrCallsFailed() - } else { - s.incrCallsSucceeded() - } - } - }() - } - - ss.binlog = binarylog.GetMethodLogger(stream.Method()) - if ss.binlog != nil { - md, _ := metadata.FromIncomingContext(ctx) - logEntry := &binarylog.ClientHeader{ - Header: md, - MethodName: stream.Method(), - PeerAddr: nil, - } - if deadline, ok := ctx.Deadline(); ok { - logEntry.Timeout = time.Until(deadline) - if logEntry.Timeout < 0 { - logEntry.Timeout = 0 - } - } - if a := md[":authority"]; len(a) > 0 { - logEntry.Authority = a[0] - } - if peer, ok := peer.FromContext(ss.Context()); ok { - logEntry.PeerAddr = peer.Addr - } - ss.binlog.Log(logEntry) - } - - // If dc is set and matches the stream's compression, use it. Otherwise, try - // to find a matching registered compressor for decomp. - if rc := stream.RecvCompress(); s.opts.dc != nil && s.opts.dc.Type() == rc { - ss.dc = s.opts.dc - } else if rc != "" && rc != encoding.Identity { - ss.decomp = encoding.GetCompressor(rc) - if ss.decomp == nil { - st := status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", rc) - t.WriteStatus(ss.s, st) - return st.Err() - } - } - - // If cp is set, use it. Otherwise, attempt to compress the response using - // the incoming message compression method. - // - // NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686. - if s.opts.cp != nil { - ss.cp = s.opts.cp - stream.SetSendCompress(s.opts.cp.Type()) - } else if rc := stream.RecvCompress(); rc != "" && rc != encoding.Identity { - // Legacy compressor not specified; attempt to respond with same encoding. - ss.comp = encoding.GetCompressor(rc) - if ss.comp != nil { - stream.SetSendCompress(rc) - } - } - - if trInfo != nil { - trInfo.tr.LazyLog(&trInfo.firstLine, false) - } - var appErr error - var server interface{} - if srv != nil { - server = srv.server - } - if s.opts.streamInt == nil { - appErr = sd.Handler(server, ss) - } else { - info := &StreamServerInfo{ - FullMethod: stream.Method(), - IsClientStream: sd.ClientStreams, - IsServerStream: sd.ServerStreams, - } - appErr = s.opts.streamInt(server, ss, info, sd.Handler) - } - if appErr != nil { - appStatus, ok := status.FromError(appErr) - if !ok { - appStatus = status.New(codes.Unknown, appErr.Error()) - appErr = appStatus.Err() - } - if trInfo != nil { - ss.mu.Lock() - ss.trInfo.tr.LazyLog(stringer(appStatus.Message()), true) - ss.trInfo.tr.SetError() - ss.mu.Unlock() - } - t.WriteStatus(ss.s, appStatus) - if ss.binlog != nil { - ss.binlog.Log(&binarylog.ServerTrailer{ - Trailer: ss.s.Trailer(), - Err: appErr, - }) - } - // TODO: Should we log an error from WriteStatus here and below? - return appErr - } - if trInfo != nil { - ss.mu.Lock() - ss.trInfo.tr.LazyLog(stringer("OK"), false) - ss.mu.Unlock() - } - err = t.WriteStatus(ss.s, statusOK) - if ss.binlog != nil { - ss.binlog.Log(&binarylog.ServerTrailer{ - Trailer: ss.s.Trailer(), - Err: appErr, - }) - } - return err -} - -func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) { - sm := stream.Method() - if sm != "" && sm[0] == '/' { - sm = sm[1:] - } - pos := strings.LastIndex(sm, "/") - if pos == -1 { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []interface{}{sm}}, true) - trInfo.tr.SetError() - } - errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) - if err := t.WriteStatus(stream, status.New(codes.ResourceExhausted, errDesc)); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - channelz.Warningf(s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) - } - if trInfo != nil { - trInfo.tr.Finish() - } - return - } - service := sm[:pos] - method := sm[pos+1:] - - srv, knownService := s.m[service] - if knownService { - if md, ok := srv.md[method]; ok { - s.processUnaryRPC(t, stream, srv, md, trInfo) - return - } - if sd, ok := srv.sd[method]; ok { - s.processStreamingRPC(t, stream, srv, sd, trInfo) - return - } - } - // Unknown service, or known server unknown method. - if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) - return - } - var errDesc string - if !knownService { - errDesc = fmt.Sprintf("unknown service %v", service) - } else { - errDesc = fmt.Sprintf("unknown method %v for service %v", method, service) - } - if trInfo != nil { - trInfo.tr.LazyPrintf("%s", errDesc) - trInfo.tr.SetError() - } - if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - channelz.Warningf(s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) - } - if trInfo != nil { - trInfo.tr.Finish() - } -} - -// The key to save ServerTransportStream in the context. -type streamKey struct{} - -// NewContextWithServerTransportStream creates a new context from ctx and -// attaches stream to it. -// -// This API is EXPERIMENTAL. -func NewContextWithServerTransportStream(ctx context.Context, stream ServerTransportStream) context.Context { - return context.WithValue(ctx, streamKey{}, stream) -} - -// ServerTransportStream is a minimal interface that a transport stream must -// implement. This can be used to mock an actual transport stream for tests of -// handler code that use, for example, grpc.SetHeader (which requires some -// stream to be in context). -// -// See also NewContextWithServerTransportStream. -// -// This API is EXPERIMENTAL. -type ServerTransportStream interface { - Method() string - SetHeader(md metadata.MD) error - SendHeader(md metadata.MD) error - SetTrailer(md metadata.MD) error -} - -// ServerTransportStreamFromContext returns the ServerTransportStream saved in -// ctx. Returns nil if the given context has no stream associated with it -// (which implies it is not an RPC invocation context). -// -// This API is EXPERIMENTAL. -func ServerTransportStreamFromContext(ctx context.Context) ServerTransportStream { - s, _ := ctx.Value(streamKey{}).(ServerTransportStream) - return s -} - -// Stop stops the gRPC server. It immediately closes all open -// connections and listeners. -// It cancels all active RPCs on the server side and the corresponding -// pending RPCs on the client side will get notified by connection -// errors. -func (s *Server) Stop() { - s.quit.Fire() - - defer func() { - s.serveWG.Wait() - s.done.Fire() - }() - - s.channelzRemoveOnce.Do(func() { - if channelz.IsOn() { - channelz.RemoveEntry(s.channelzID) - } - }) - - s.mu.Lock() - listeners := s.lis - s.lis = nil - st := s.conns - s.conns = nil - // interrupt GracefulStop if Stop and GracefulStop are called concurrently. - s.cv.Broadcast() - s.mu.Unlock() - - for lis := range listeners { - lis.Close() - } - for c := range st { - c.Close() - } - if s.opts.numServerWorkers > 0 { - s.stopServerWorkers() - } - - s.mu.Lock() - if s.events != nil { - s.events.Finish() - s.events = nil - } - s.mu.Unlock() -} - -// GracefulStop stops the gRPC server gracefully. It stops the server from -// accepting new connections and RPCs and blocks until all the pending RPCs are -// finished. -func (s *Server) GracefulStop() { - s.quit.Fire() - defer s.done.Fire() - - s.channelzRemoveOnce.Do(func() { - if channelz.IsOn() { - channelz.RemoveEntry(s.channelzID) - } - }) - s.mu.Lock() - if s.conns == nil { - s.mu.Unlock() - return - } - - for lis := range s.lis { - lis.Close() - } - s.lis = nil - if !s.drain { - for st := range s.conns { - st.Drain() - } - s.drain = true - } - - // Wait for serving threads to be ready to exit. Only then can we be sure no - // new conns will be created. - s.mu.Unlock() - s.serveWG.Wait() - s.mu.Lock() - - for len(s.conns) != 0 { - s.cv.Wait() - } - s.conns = nil - if s.events != nil { - s.events.Finish() - s.events = nil - } - s.mu.Unlock() -} - -// contentSubtype must be lowercase -// cannot return nil -func (s *Server) getCodec(contentSubtype string) baseCodec { - if s.opts.codec != nil { - return s.opts.codec - } - if contentSubtype == "" { - return encoding.GetCodec(proto.Name) - } - codec := encoding.GetCodec(contentSubtype) - if codec == nil { - return encoding.GetCodec(proto.Name) - } - return codec -} - -// SetHeader sets the header metadata. -// When called multiple times, all the provided metadata will be merged. -// All the metadata will be sent out when one of the following happens: -// - grpc.SendHeader() is called; -// - The first response is sent out; -// - An RPC status is sent out (error or success). -func SetHeader(ctx context.Context, md metadata.MD) error { - if md.Len() == 0 { - return nil - } - stream := ServerTransportStreamFromContext(ctx) - if stream == nil { - return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) - } - return stream.SetHeader(md) -} - -// SendHeader sends header metadata. It may be called at most once. -// The provided md and headers set by SetHeader() will be sent. -func SendHeader(ctx context.Context, md metadata.MD) error { - stream := ServerTransportStreamFromContext(ctx) - if stream == nil { - return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) - } - if err := stream.SendHeader(md); err != nil { - return toRPCErr(err) - } - return nil -} - -// SetTrailer sets the trailer metadata that will be sent when an RPC returns. -// When called more than once, all the provided metadata will be merged. -func SetTrailer(ctx context.Context, md metadata.MD) error { - if md.Len() == 0 { - return nil - } - stream := ServerTransportStreamFromContext(ctx) - if stream == nil { - return status.Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) - } - return stream.SetTrailer(md) -} - -// Method returns the method string for the server context. The returned -// string is in the format of "/service/method". -func Method(ctx context.Context) (string, bool) { - s := ServerTransportStreamFromContext(ctx) - if s == nil { - return "", false - } - return s.Method(), true -} - -type channelzServer struct { - s *Server -} - -func (c *channelzServer) ChannelzMetric() *channelz.ServerInternalMetric { - return c.s.channelzMetric() -} diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go deleted file mode 100644 index 3132a66cd..000000000 --- a/vendor/google.golang.org/grpc/service_config.go +++ /dev/null @@ -1,434 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 grpc - -import ( - "encoding/json" - "fmt" - "reflect" - "strconv" - "strings" - "time" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal" - internalserviceconfig "google.golang.org/grpc/internal/serviceconfig" - "google.golang.org/grpc/serviceconfig" -) - -const maxInt = int(^uint(0) >> 1) - -// MethodConfig defines the configuration recommended by the service providers for a -// particular method. -// -// Deprecated: Users should not use this struct. Service config should be received -// through name resolver, as specified here -// https://github.com/grpc/grpc/blob/master/doc/service_config.md -type MethodConfig struct { - // WaitForReady indicates whether RPCs sent to this method should wait until - // the connection is ready by default (!failfast). The value specified via the - // gRPC client API will override the value set here. - WaitForReady *bool - // Timeout is the default timeout for RPCs sent to this method. The actual - // deadline used will be the minimum of the value specified here and the value - // set by the application via the gRPC client API. If either one is not set, - // then the other will be used. If neither is set, then the RPC has no deadline. - Timeout *time.Duration - // MaxReqSize is the maximum allowed payload size for an individual request in a - // stream (client->server) in bytes. The size which is measured is the serialized - // payload after per-message compression (but before stream compression) in bytes. - // The actual value used is the minimum of the value specified here and the value set - // by the application via the gRPC client API. If either one is not set, then the other - // will be used. If neither is set, then the built-in default is used. - MaxReqSize *int - // MaxRespSize is the maximum allowed payload size for an individual response in a - // stream (server->client) in bytes. - MaxRespSize *int - // RetryPolicy configures retry options for the method. - retryPolicy *retryPolicy -} - -type lbConfig struct { - name string - cfg serviceconfig.LoadBalancingConfig -} - -// ServiceConfig is provided by the service provider and contains parameters for how -// clients that connect to the service should behave. -// -// Deprecated: Users should not use this struct. Service config should be received -// through name resolver, as specified here -// https://github.com/grpc/grpc/blob/master/doc/service_config.md -type ServiceConfig struct { - serviceconfig.Config - - // LB is the load balancer the service providers recommends. The balancer - // specified via grpc.WithBalancerName will override this. This is deprecated; - // lbConfigs is preferred. If lbConfig and LB are both present, lbConfig - // will be used. - LB *string - - // lbConfig is the service config's load balancing configuration. If - // lbConfig and LB are both present, lbConfig will be used. - lbConfig *lbConfig - - // Methods contains a map for the methods in this service. If there is an - // exact match for a method (i.e. /service/method) in the map, use the - // corresponding MethodConfig. If there's no exact match, look for the - // default config for the service (/service/) and use the corresponding - // MethodConfig if it exists. Otherwise, the method has no MethodConfig to - // use. - Methods map[string]MethodConfig - - // If a retryThrottlingPolicy is provided, gRPC will automatically throttle - // retry attempts and hedged RPCs when the client’s ratio of failures to - // successes exceeds a threshold. - // - // For each server name, the gRPC client will maintain a token_count which is - // initially set to maxTokens, and can take values between 0 and maxTokens. - // - // Every outgoing RPC (regardless of service or method invoked) will change - // token_count as follows: - // - // - Every failed RPC will decrement the token_count by 1. - // - Every successful RPC will increment the token_count by tokenRatio. - // - // If token_count is less than or equal to maxTokens / 2, then RPCs will not - // be retried and hedged RPCs will not be sent. - retryThrottling *retryThrottlingPolicy - // healthCheckConfig must be set as one of the requirement to enable LB channel - // health check. - healthCheckConfig *healthCheckConfig - // rawJSONString stores service config json string that get parsed into - // this service config struct. - rawJSONString string -} - -// healthCheckConfig defines the go-native version of the LB channel health check config. -type healthCheckConfig struct { - // serviceName is the service name to use in the health-checking request. - ServiceName string -} - -// retryPolicy defines the go-native version of the retry policy defined by the -// service config here: -// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config -type retryPolicy struct { - // MaxAttempts is the maximum number of attempts, including the original RPC. - // - // This field is required and must be two or greater. - maxAttempts int - - // Exponential backoff parameters. The initial retry attempt will occur at - // random(0, initialBackoff). In general, the nth attempt will occur at - // random(0, - // min(initialBackoff*backoffMultiplier**(n-1), maxBackoff)). - // - // These fields are required and must be greater than zero. - initialBackoff time.Duration - maxBackoff time.Duration - backoffMultiplier float64 - - // The set of status codes which may be retried. - // - // Status codes are specified as strings, e.g., "UNAVAILABLE". - // - // This field is required and must be non-empty. - // Note: a set is used to store this for easy lookup. - retryableStatusCodes map[codes.Code]bool -} - -type jsonRetryPolicy struct { - MaxAttempts int - InitialBackoff string - MaxBackoff string - BackoffMultiplier float64 - RetryableStatusCodes []codes.Code -} - -// retryThrottlingPolicy defines the go-native version of the retry throttling -// policy defined by the service config here: -// https://github.com/grpc/proposal/blob/master/A6-client-retries.md#integration-with-service-config -type retryThrottlingPolicy struct { - // The number of tokens starts at maxTokens. The token_count will always be - // between 0 and maxTokens. - // - // This field is required and must be greater than zero. - MaxTokens float64 - // The amount of tokens to add on each successful RPC. Typically this will - // be some number between 0 and 1, e.g., 0.1. - // - // This field is required and must be greater than zero. Up to 3 decimal - // places are supported. - TokenRatio float64 -} - -func parseDuration(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - if !strings.HasSuffix(*s, "s") { - return nil, fmt.Errorf("malformed duration %q", *s) - } - ss := strings.SplitN((*s)[:len(*s)-1], ".", 3) - if len(ss) > 2 { - return nil, fmt.Errorf("malformed duration %q", *s) - } - // hasDigits is set if either the whole or fractional part of the number is - // present, since both are optional but one is required. - hasDigits := false - var d time.Duration - if len(ss[0]) > 0 { - i, err := strconv.ParseInt(ss[0], 10, 32) - if err != nil { - return nil, fmt.Errorf("malformed duration %q: %v", *s, err) - } - d = time.Duration(i) * time.Second - hasDigits = true - } - if len(ss) == 2 && len(ss[1]) > 0 { - if len(ss[1]) > 9 { - return nil, fmt.Errorf("malformed duration %q", *s) - } - f, err := strconv.ParseInt(ss[1], 10, 64) - if err != nil { - return nil, fmt.Errorf("malformed duration %q: %v", *s, err) - } - for i := 9; i > len(ss[1]); i-- { - f *= 10 - } - d += time.Duration(f) - hasDigits = true - } - if !hasDigits { - return nil, fmt.Errorf("malformed duration %q", *s) - } - - return &d, nil -} - -type jsonName struct { - Service *string - Method *string -} - -func (j jsonName) generatePath() (string, bool) { - if j.Service == nil { - return "", false - } - res := "/" + *j.Service + "/" - if j.Method != nil { - res += *j.Method - } - return res, true -} - -// TODO(lyuxuan): delete this struct after cleaning up old service config implementation. -type jsonMC struct { - Name *[]jsonName - WaitForReady *bool - Timeout *string - MaxRequestMessageBytes *int64 - MaxResponseMessageBytes *int64 - RetryPolicy *jsonRetryPolicy -} - -// TODO(lyuxuan): delete this struct after cleaning up old service config implementation. -type jsonSC struct { - LoadBalancingPolicy *string - LoadBalancingConfig *internalserviceconfig.BalancerConfig - MethodConfig *[]jsonMC - RetryThrottling *retryThrottlingPolicy - HealthCheckConfig *healthCheckConfig -} - -func init() { - internal.ParseServiceConfigForTesting = parseServiceConfig -} -func parseServiceConfig(js string) *serviceconfig.ParseResult { - if len(js) == 0 { - return &serviceconfig.ParseResult{Err: fmt.Errorf("no JSON service config provided")} - } - var rsc jsonSC - err := json.Unmarshal([]byte(js), &rsc) - if err != nil { - grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return &serviceconfig.ParseResult{Err: err} - } - sc := ServiceConfig{ - LB: rsc.LoadBalancingPolicy, - Methods: make(map[string]MethodConfig), - retryThrottling: rsc.RetryThrottling, - healthCheckConfig: rsc.HealthCheckConfig, - rawJSONString: js, - } - if c := rsc.LoadBalancingConfig; c != nil { - sc.lbConfig = &lbConfig{ - name: c.Name, - cfg: c.Config, - } - } - - if rsc.MethodConfig == nil { - return &serviceconfig.ParseResult{Config: &sc} - } - for _, m := range *rsc.MethodConfig { - if m.Name == nil { - continue - } - d, err := parseDuration(m.Timeout) - if err != nil { - grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return &serviceconfig.ParseResult{Err: err} - } - - mc := MethodConfig{ - WaitForReady: m.WaitForReady, - Timeout: d, - } - if mc.retryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { - grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return &serviceconfig.ParseResult{Err: err} - } - if m.MaxRequestMessageBytes != nil { - if *m.MaxRequestMessageBytes > int64(maxInt) { - mc.MaxReqSize = newInt(maxInt) - } else { - mc.MaxReqSize = newInt(int(*m.MaxRequestMessageBytes)) - } - } - if m.MaxResponseMessageBytes != nil { - if *m.MaxResponseMessageBytes > int64(maxInt) { - mc.MaxRespSize = newInt(maxInt) - } else { - mc.MaxRespSize = newInt(int(*m.MaxResponseMessageBytes)) - } - } - for _, n := range *m.Name { - if path, valid := n.generatePath(); valid { - sc.Methods[path] = mc - } - } - } - - if sc.retryThrottling != nil { - if mt := sc.retryThrottling.MaxTokens; mt <= 0 || mt > 1000 { - return &serviceconfig.ParseResult{Err: fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt)} - } - if tr := sc.retryThrottling.TokenRatio; tr <= 0 { - return &serviceconfig.ParseResult{Err: fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr)} - } - } - return &serviceconfig.ParseResult{Config: &sc} -} - -func convertRetryPolicy(jrp *jsonRetryPolicy) (p *retryPolicy, err error) { - if jrp == nil { - return nil, nil - } - ib, err := parseDuration(&jrp.InitialBackoff) - if err != nil { - return nil, err - } - mb, err := parseDuration(&jrp.MaxBackoff) - if err != nil { - return nil, err - } - - if jrp.MaxAttempts <= 1 || - *ib <= 0 || - *mb <= 0 || - jrp.BackoffMultiplier <= 0 || - len(jrp.RetryableStatusCodes) == 0 { - grpclog.Warningf("grpc: ignoring retry policy %v due to illegal configuration", jrp) - return nil, nil - } - - rp := &retryPolicy{ - maxAttempts: jrp.MaxAttempts, - initialBackoff: *ib, - maxBackoff: *mb, - backoffMultiplier: jrp.BackoffMultiplier, - retryableStatusCodes: make(map[codes.Code]bool), - } - if rp.maxAttempts > 5 { - // TODO(retry): Make the max maxAttempts configurable. - rp.maxAttempts = 5 - } - for _, code := range jrp.RetryableStatusCodes { - rp.retryableStatusCodes[code] = true - } - return rp, nil -} - -func min(a, b *int) *int { - if *a < *b { - return a - } - return b -} - -func getMaxSize(mcMax, doptMax *int, defaultVal int) *int { - if mcMax == nil && doptMax == nil { - return &defaultVal - } - if mcMax != nil && doptMax != nil { - return min(mcMax, doptMax) - } - if mcMax != nil { - return mcMax - } - return doptMax -} - -func newInt(b int) *int { - return &b -} - -func init() { - internal.EqualServiceConfigForTesting = equalServiceConfig -} - -// equalServiceConfig compares two configs. The rawJSONString field is ignored, -// because they may diff in white spaces. -// -// If any of them is NOT *ServiceConfig, return false. -func equalServiceConfig(a, b serviceconfig.Config) bool { - aa, ok := a.(*ServiceConfig) - if !ok { - return false - } - bb, ok := b.(*ServiceConfig) - if !ok { - return false - } - aaRaw := aa.rawJSONString - aa.rawJSONString = "" - bbRaw := bb.rawJSONString - bb.rawJSONString = "" - defer func() { - aa.rawJSONString = aaRaw - bb.rawJSONString = bbRaw - }() - // Using reflect.DeepEqual instead of cmp.Equal because many balancer - // configs are unexported, and cmp.Equal cannot compare unexported fields - // from unexported structs. - return reflect.DeepEqual(aa, bb) -} diff --git a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go deleted file mode 100644 index 187c30442..000000000 --- a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Copyright 2019 gRPC 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 serviceconfig defines types and methods for operating on gRPC -// service configs. -// -// This package is EXPERIMENTAL. -package serviceconfig - -// Config represents an opaque data structure holding a service config. -type Config interface { - isServiceConfig() -} - -// LoadBalancingConfig represents an opaque data structure holding a load -// balancing config. -type LoadBalancingConfig interface { - isLoadBalancingConfig() -} - -// ParseResult contains a service config or an error. Exactly one must be -// non-nil. -type ParseResult struct { - Config Config - Err error -} diff --git a/vendor/google.golang.org/grpc/stats/handlers.go b/vendor/google.golang.org/grpc/stats/handlers.go deleted file mode 100644 index dc03731e4..000000000 --- a/vendor/google.golang.org/grpc/stats/handlers.go +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2016 gRPC 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 stats - -import ( - "context" - "net" -) - -// ConnTagInfo defines the relevant information needed by connection context tagger. -type ConnTagInfo struct { - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr -} - -// RPCTagInfo defines the relevant information needed by RPC context tagger. -type RPCTagInfo struct { - // FullMethodName is the RPC method in the format of /package.service/method. - FullMethodName string - // FailFast indicates if this RPC is failfast. - // This field is only valid on client side, it's always false on server side. - FailFast bool -} - -// Handler defines the interface for the related stats handling (e.g., RPCs, connections). -type Handler interface { - // TagRPC can attach some information to the given context. - // The context used for the rest lifetime of the RPC will be derived from - // the returned context. - TagRPC(context.Context, *RPCTagInfo) context.Context - // HandleRPC processes the RPC stats. - HandleRPC(context.Context, RPCStats) - - // TagConn can attach some information to the given context. - // The returned context will be used for stats handling. - // For conn stats handling, the context used in HandleConn for this - // connection will be derived from the context returned. - // For RPC stats handling, - // - On server side, the context used in HandleRPC for all RPCs on this - // connection will be derived from the context returned. - // - On client side, the context is not derived from the context returned. - TagConn(context.Context, *ConnTagInfo) context.Context - // HandleConn processes the Conn stats. - HandleConn(context.Context, ConnStats) -} diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go deleted file mode 100644 index 63e476ee7..000000000 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ /dev/null @@ -1,312 +0,0 @@ -/* - * - * Copyright 2016 gRPC 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 stats is for collecting and reporting various network and RPC stats. -// This package is for monitoring purpose only. All fields are read-only. -// All APIs are experimental. -package stats // import "google.golang.org/grpc/stats" - -import ( - "context" - "net" - "time" - - "google.golang.org/grpc/metadata" -) - -// RPCStats contains stats information about RPCs. -type RPCStats interface { - isRPCStats() - // IsClient returns true if this RPCStats is from client side. - IsClient() bool -} - -// Begin contains stats when an RPC begins. -// FailFast is only valid if this Begin is from client side. -type Begin struct { - // Client is true if this Begin is from client side. - Client bool - // BeginTime is the time when the RPC begins. - BeginTime time.Time - // FailFast indicates if this RPC is failfast. - FailFast bool -} - -// IsClient indicates if the stats information is from client side. -func (s *Begin) IsClient() bool { return s.Client } - -func (s *Begin) isRPCStats() {} - -// InPayload contains the information for an incoming payload. -type InPayload struct { - // Client is true if this InPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // RecvTime is the time when the payload is received. - RecvTime time.Time -} - -// IsClient indicates if the stats information is from client side. -func (s *InPayload) IsClient() bool { return s.Client } - -func (s *InPayload) isRPCStats() {} - -// InHeader contains stats when a header is received. -type InHeader struct { - // Client is true if this InHeader is from client side. - Client bool - // WireLength is the wire length of header. - WireLength int - // Compression is the compression algorithm used for the RPC. - Compression string - // Header contains the header metadata received. - Header metadata.MD - - // The following fields are valid only if Client is false. - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr -} - -// IsClient indicates if the stats information is from client side. -func (s *InHeader) IsClient() bool { return s.Client } - -func (s *InHeader) isRPCStats() {} - -// InTrailer contains stats when a trailer is received. -type InTrailer struct { - // Client is true if this InTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int - // Trailer contains the trailer metadata received from the server. This - // field is only valid if this InTrailer is from the client side. - Trailer metadata.MD -} - -// IsClient indicates if the stats information is from client side. -func (s *InTrailer) IsClient() bool { return s.Client } - -func (s *InTrailer) isRPCStats() {} - -// OutPayload contains the information for an outgoing payload. -type OutPayload struct { - // Client is true if this OutPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // SentTime is the time when the payload is sent. - SentTime time.Time -} - -// IsClient indicates if this stats information is from client side. -func (s *OutPayload) IsClient() bool { return s.Client } - -func (s *OutPayload) isRPCStats() {} - -// OutHeader contains stats when a header is sent. -type OutHeader struct { - // Client is true if this OutHeader is from client side. - Client bool - // Compression is the compression algorithm used for the RPC. - Compression string - // Header contains the header metadata sent. - Header metadata.MD - - // The following fields are valid only if Client is true. - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr -} - -// IsClient indicates if this stats information is from client side. -func (s *OutHeader) IsClient() bool { return s.Client } - -func (s *OutHeader) isRPCStats() {} - -// OutTrailer contains stats when a trailer is sent. -type OutTrailer struct { - // Client is true if this OutTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - // - // Deprecated: This field is never set. The length is not known when this message is - // emitted because the trailer fields are compressed with hpack after that. - WireLength int - // Trailer contains the trailer metadata sent to the client. This - // field is only valid if this OutTrailer is from the server side. - Trailer metadata.MD -} - -// IsClient indicates if this stats information is from client side. -func (s *OutTrailer) IsClient() bool { return s.Client } - -func (s *OutTrailer) isRPCStats() {} - -// End contains stats when an RPC ends. -type End struct { - // Client is true if this End is from client side. - Client bool - // BeginTime is the time when the RPC began. - BeginTime time.Time - // EndTime is the time when the RPC ends. - EndTime time.Time - // Trailer contains the trailer metadata received from the server. This - // field is only valid if this End is from the client side. - // Deprecated: use Trailer in InTrailer instead. - Trailer metadata.MD - // Error is the error the RPC ended with. It is an error generated from - // status.Status and can be converted back to status.Status using - // status.FromError if non-nil. - Error error -} - -// IsClient indicates if this is from client side. -func (s *End) IsClient() bool { return s.Client } - -func (s *End) isRPCStats() {} - -// ConnStats contains stats information about connections. -type ConnStats interface { - isConnStats() - // IsClient returns true if this ConnStats is from client side. - IsClient() bool -} - -// ConnBegin contains the stats of a connection when it is established. -type ConnBegin struct { - // Client is true if this ConnBegin is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnBegin) IsClient() bool { return s.Client } - -func (s *ConnBegin) isConnStats() {} - -// ConnEnd contains the stats of a connection when it ends. -type ConnEnd struct { - // Client is true if this ConnEnd is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnEnd) IsClient() bool { return s.Client } - -func (s *ConnEnd) isConnStats() {} - -type incomingTagsKey struct{} -type outgoingTagsKey struct{} - -// SetTags attaches stats tagging data to the context, which will be sent in -// the outgoing RPC with the header grpc-tags-bin. Subsequent calls to -// SetTags will overwrite the values from earlier calls. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func SetTags(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, outgoingTagsKey{}, b) -} - -// Tags returns the tags from the context for the inbound RPC. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func Tags(ctx context.Context) []byte { - b, _ := ctx.Value(incomingTagsKey{}).([]byte) - return b -} - -// SetIncomingTags attaches stats tagging data to the context, to be read by -// the application (not sent in outgoing RPCs). -// -// This is intended for gRPC-internal use ONLY. -func SetIncomingTags(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, incomingTagsKey{}, b) -} - -// OutgoingTags returns the tags from the context for the outbound RPC. -// -// This is intended for gRPC-internal use ONLY. -func OutgoingTags(ctx context.Context) []byte { - b, _ := ctx.Value(outgoingTagsKey{}).([]byte) - return b -} - -type incomingTraceKey struct{} -type outgoingTraceKey struct{} - -// SetTrace attaches stats tagging data to the context, which will be sent in -// the outgoing RPC with the header grpc-trace-bin. Subsequent calls to -// SetTrace will overwrite the values from earlier calls. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func SetTrace(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, outgoingTraceKey{}, b) -} - -// Trace returns the trace from the context for the inbound RPC. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func Trace(ctx context.Context) []byte { - b, _ := ctx.Value(incomingTraceKey{}).([]byte) - return b -} - -// SetIncomingTrace attaches stats tagging data to the context, to be read by -// the application (not sent in outgoing RPCs). It is intended for -// gRPC-internal use. -func SetIncomingTrace(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, incomingTraceKey{}, b) -} - -// OutgoingTrace returns the trace from the context for the outbound RPC. It is -// intended for gRPC-internal use. -func OutgoingTrace(ctx context.Context) []byte { - b, _ := ctx.Value(outgoingTraceKey{}).([]byte) - return b -} diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go deleted file mode 100644 index 01e182c30..000000000 --- a/vendor/google.golang.org/grpc/status/status.go +++ /dev/null @@ -1,127 +0,0 @@ -/* - * - * Copyright 2017 gRPC 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 status implements errors returned by gRPC. These errors are -// serialized and transmitted on the wire between server and client, and allow -// for additional data to be transmitted via the Details field in the status -// proto. gRPC service handlers should return an error created by this -// package, and gRPC clients should expect a corresponding error to be -// returned from the RPC call. -// -// This package upholds the invariants that a non-nil error may not -// contain an OK code, and an OK code must result in a nil error. -package status - -import ( - "context" - "fmt" - - spb "google.golang.org/genproto/googleapis/rpc/status" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/internal/status" -) - -// Status references google.golang.org/grpc/internal/status. It represents an -// RPC status code, message, and details. It is immutable and should be -// created with New, Newf, or FromProto. -// https://godoc.org/google.golang.org/grpc/internal/status -type Status = status.Status - -// New returns a Status representing c and msg. -func New(c codes.Code, msg string) *Status { - return status.New(c, msg) -} - -// Newf returns New(c, fmt.Sprintf(format, a...)). -func Newf(c codes.Code, format string, a ...interface{}) *Status { - return New(c, fmt.Sprintf(format, a...)) -} - -// Error returns an error representing c and msg. If c is OK, returns nil. -func Error(c codes.Code, msg string) error { - return New(c, msg).Err() -} - -// Errorf returns Error(c, fmt.Sprintf(format, a...)). -func Errorf(c codes.Code, format string, a ...interface{}) error { - return Error(c, fmt.Sprintf(format, a...)) -} - -// ErrorProto returns an error representing s. If s.Code is OK, returns nil. -func ErrorProto(s *spb.Status) error { - return FromProto(s).Err() -} - -// FromProto returns a Status representing s. -func FromProto(s *spb.Status) *Status { - return status.FromProto(s) -} - -// FromError returns a Status representing err if it was produced from this -// package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a -// Status is returned with codes.Unknown and the original error message. -func FromError(err error) (s *Status, ok bool) { - if err == nil { - return nil, true - } - if se, ok := err.(interface { - GRPCStatus() *Status - }); ok { - return se.GRPCStatus(), true - } - return New(codes.Unknown, err.Error()), false -} - -// Convert is a convenience function which removes the need to handle the -// boolean return value from FromError. -func Convert(err error) *Status { - s, _ := FromError(err) - return s -} - -// Code returns the Code of the error if it is a Status error, codes.OK if err -// is nil, or codes.Unknown otherwise. -func Code(err error) codes.Code { - // Don't use FromError to avoid allocation of OK status. - if err == nil { - return codes.OK - } - if se, ok := err.(interface { - GRPCStatus() *Status - }); ok { - return se.GRPCStatus().Code() - } - return codes.Unknown -} - -// FromContextError converts a context error into a Status. It returns a -// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is -// non-nil and not a context error. -func FromContextError(err error) *Status { - switch err { - case nil: - return nil - case context.DeadlineExceeded: - return New(codes.DeadlineExceeded, err.Error()) - case context.Canceled: - return New(codes.Canceled, err.Error()) - default: - return New(codes.Unknown, err.Error()) - } -} diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go deleted file mode 100644 index 629af76bd..000000000 --- a/vendor/google.golang.org/grpc/stream.go +++ /dev/null @@ -1,1541 +0,0 @@ -/* - * - * Copyright 2014 gRPC 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 grpc - -import ( - "context" - "errors" - "io" - "math" - "strconv" - "sync" - "time" - - "golang.org/x/net/trace" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/encoding" - "google.golang.org/grpc/internal/balancerload" - "google.golang.org/grpc/internal/binarylog" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" - "google.golang.org/grpc/internal/transport" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" -) - -// StreamHandler defines the handler called by gRPC server to complete the -// execution of a streaming RPC. If a StreamHandler returns an error, it -// should be produced by the status package, or else gRPC will use -// codes.Unknown as the status code and err.Error() as the status message -// of the RPC. -type StreamHandler func(srv interface{}, stream ServerStream) error - -// StreamDesc represents a streaming RPC service's method specification. -type StreamDesc struct { - StreamName string - Handler StreamHandler - - // At least one of these is true. - ServerStreams bool - ClientStreams bool -} - -// Stream defines the common interface a client or server stream has to satisfy. -// -// Deprecated: See ClientStream and ServerStream documentation instead. -type Stream interface { - // Deprecated: See ClientStream and ServerStream documentation instead. - Context() context.Context - // Deprecated: See ClientStream and ServerStream documentation instead. - SendMsg(m interface{}) error - // Deprecated: See ClientStream and ServerStream documentation instead. - RecvMsg(m interface{}) error -} - -// ClientStream defines the client-side behavior of a streaming RPC. -// -// All errors returned from ClientStream methods are compatible with the -// status package. -type ClientStream interface { - // Header returns the header metadata received from the server if there - // is any. It blocks if the metadata is not ready to read. - Header() (metadata.MD, error) - // Trailer returns the trailer metadata from the server, if there is any. - // It must only be called after stream.CloseAndRecv has returned, or - // stream.Recv has returned a non-nil error (including io.EOF). - Trailer() metadata.MD - // CloseSend closes the send direction of the stream. It closes the stream - // when non-nil error is met. It is also not safe to call CloseSend - // concurrently with SendMsg. - CloseSend() error - // Context returns the context for this stream. - // - // It should not be called until after Header or RecvMsg has returned. Once - // called, subsequent client-side retries are disabled. - Context() context.Context - // SendMsg is generally called by generated code. On error, SendMsg aborts - // the stream. If the error was generated by the client, the status is - // returned directly; otherwise, io.EOF is returned and the status of - // the stream may be discovered using RecvMsg. - // - // SendMsg blocks until: - // - There is sufficient flow control to schedule m with the transport, or - // - The stream is done, or - // - The stream breaks. - // - // SendMsg does not wait until the message is received by the server. An - // untimely stream closure may result in lost messages. To ensure delivery, - // users should ensure the RPC completed successfully using RecvMsg. - // - // It is safe to have a goroutine calling SendMsg and another goroutine - // calling RecvMsg on the same stream at the same time, but it is not safe - // to call SendMsg on the same stream in different goroutines. It is also - // not safe to call CloseSend concurrently with SendMsg. - SendMsg(m interface{}) error - // RecvMsg blocks until it receives a message into m or the stream is - // done. It returns io.EOF when the stream completes successfully. On - // any other error, the stream is aborted and the error contains the RPC - // status. - // - // It is safe to have a goroutine calling SendMsg and another goroutine - // calling RecvMsg on the same stream at the same time, but it is not - // safe to call RecvMsg on the same stream in different goroutines. - RecvMsg(m interface{}) error -} - -// NewStream creates a new Stream for the client side. This is typically -// called by generated code. ctx is used for the lifetime of the stream. -// -// To ensure resources are not leaked due to the stream returned, one of the following -// actions must be performed: -// -// 1. Call Close on the ClientConn. -// 2. Cancel the context provided. -// 3. Call RecvMsg until a non-nil error is returned. A protobuf-generated -// client-streaming RPC, for instance, might use the helper function -// CloseAndRecv (note that CloseSend does not Recv, therefore is not -// guaranteed to release all resources). -// 4. Receive a non-nil, non-io.EOF error from Header or SendMsg. -// -// If none of the above happen, a goroutine and a context will be leaked, and grpc -// will not call the optionally-configured stats handler with a stats.End message. -func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { - // allow interceptor to see all applicable call options, which means those - // configured as defaults from dial option as well as per-call options - opts = combine(cc.dopts.callOptions, opts) - - if cc.dopts.streamInt != nil { - return cc.dopts.streamInt(ctx, desc, cc, method, newClientStream, opts...) - } - return newClientStream(ctx, desc, cc, method, opts...) -} - -// NewClientStream is a wrapper for ClientConn.NewStream. -func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) { - return cc.NewStream(ctx, desc, method, opts...) -} - -func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { - if channelz.IsOn() { - cc.incrCallsStarted() - defer func() { - if err != nil { - cc.incrCallsFailed() - } - }() - } - c := defaultCallInfo() - // Provide an opportunity for the first RPC to see the first service config - // provided by the resolver. - if err := cc.waitForResolvedAddrs(ctx); err != nil { - return nil, err - } - mc := cc.GetMethodConfig(method) - if mc.WaitForReady != nil { - c.failFast = !*mc.WaitForReady - } - - // Possible context leak: - // The cancel function for the child context we create will only be called - // when RecvMsg returns a non-nil error, if the ClientConn is closed, or if - // an error is generated by SendMsg. - // https://github.com/grpc/grpc-go/issues/1818. - var cancel context.CancelFunc - if mc.Timeout != nil && *mc.Timeout >= 0 { - ctx, cancel = context.WithTimeout(ctx, *mc.Timeout) - } else { - ctx, cancel = context.WithCancel(ctx) - } - defer func() { - if err != nil { - cancel() - } - }() - - for _, o := range opts { - if err := o.before(c); err != nil { - return nil, toRPCErr(err) - } - } - c.maxSendMessageSize = getMaxSize(mc.MaxReqSize, c.maxSendMessageSize, defaultClientMaxSendMessageSize) - c.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) - if err := setCallInfoCodec(c); err != nil { - return nil, err - } - - callHdr := &transport.CallHdr{ - Host: cc.authority, - Method: method, - ContentSubtype: c.contentSubtype, - } - - // Set our outgoing compression according to the UseCompressor CallOption, if - // set. In that case, also find the compressor from the encoding package. - // Otherwise, use the compressor configured by the WithCompressor DialOption, - // if set. - var cp Compressor - var comp encoding.Compressor - if ct := c.compressorType; ct != "" { - callHdr.SendCompress = ct - if ct != encoding.Identity { - comp = encoding.GetCompressor(ct) - if comp == nil { - return nil, status.Errorf(codes.Internal, "grpc: Compressor is not installed for requested grpc-encoding %q", ct) - } - } - } else if cc.dopts.cp != nil { - callHdr.SendCompress = cc.dopts.cp.Type() - cp = cc.dopts.cp - } - if c.creds != nil { - callHdr.Creds = c.creds - } - var trInfo *traceInfo - if EnableTracing { - trInfo = &traceInfo{ - tr: trace.New("grpc.Sent."+methodFamily(method), method), - firstLine: firstLine{ - client: true, - }, - } - if deadline, ok := ctx.Deadline(); ok { - trInfo.firstLine.deadline = time.Until(deadline) - } - trInfo.tr.LazyLog(&trInfo.firstLine, false) - ctx = trace.NewContext(ctx, trInfo.tr) - } - ctx = newContextWithRPCInfo(ctx, c.failFast, c.codec, cp, comp) - sh := cc.dopts.copts.StatsHandler - var beginTime time.Time - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: c.failFast}) - beginTime = time.Now() - begin := &stats.Begin{ - Client: true, - BeginTime: beginTime, - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - } - - cs := &clientStream{ - callHdr: callHdr, - ctx: ctx, - methodConfig: &mc, - opts: opts, - callInfo: c, - cc: cc, - desc: desc, - codec: c.codec, - cp: cp, - comp: comp, - cancel: cancel, - beginTime: beginTime, - firstAttempt: true, - } - if !cc.dopts.disableRetry { - cs.retryThrottler = cc.retryThrottler.Load().(*retryThrottler) - } - cs.binlog = binarylog.GetMethodLogger(method) - - // Only this initial attempt has stats/tracing. - // TODO(dfawley): move to newAttempt when per-attempt stats are implemented. - if err := cs.newAttemptLocked(sh, trInfo); err != nil { - cs.finish(err) - return nil, err - } - - op := func(a *csAttempt) error { return a.newStream() } - if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }); err != nil { - cs.finish(err) - return nil, err - } - - if cs.binlog != nil { - md, _ := metadata.FromOutgoingContext(ctx) - logEntry := &binarylog.ClientHeader{ - OnClientSide: true, - Header: md, - MethodName: method, - Authority: cs.cc.authority, - } - if deadline, ok := ctx.Deadline(); ok { - logEntry.Timeout = time.Until(deadline) - if logEntry.Timeout < 0 { - logEntry.Timeout = 0 - } - } - cs.binlog.Log(logEntry) - } - - if desc != unaryStreamDesc { - // Listen on cc and stream contexts to cleanup when the user closes the - // ClientConn or cancels the stream context. In all other cases, an error - // should already be injected into the recv buffer by the transport, which - // the client will eventually receive, and then we will cancel the stream's - // context in clientStream.finish. - go func() { - select { - case <-cc.ctx.Done(): - cs.finish(ErrClientConnClosing) - case <-ctx.Done(): - cs.finish(toRPCErr(ctx.Err())) - } - }() - } - return cs, nil -} - -// newAttemptLocked creates a new attempt with a transport. -// If it succeeds, then it replaces clientStream's attempt with this new attempt. -func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo *traceInfo) (retErr error) { - newAttempt := &csAttempt{ - cs: cs, - dc: cs.cc.dopts.dc, - statsHandler: sh, - trInfo: trInfo, - } - defer func() { - if retErr != nil { - // This attempt is not set in the clientStream, so it's finish won't - // be called. Call it here for stats and trace in case they are not - // nil. - newAttempt.finish(retErr) - } - }() - - if err := cs.ctx.Err(); err != nil { - return toRPCErr(err) - } - t, done, err := cs.cc.getTransport(cs.ctx, cs.callInfo.failFast, cs.callHdr.Method) - if err != nil { - return err - } - if trInfo != nil { - trInfo.firstLine.SetRemoteAddr(t.RemoteAddr()) - } - newAttempt.t = t - newAttempt.done = done - cs.attempt = newAttempt - return nil -} - -func (a *csAttempt) newStream() error { - cs := a.cs - cs.callHdr.PreviousAttempts = cs.numRetries - s, err := a.t.NewStream(cs.ctx, cs.callHdr) - if err != nil { - if _, ok := err.(transport.PerformedIOError); ok { - // Return without converting to an RPC error so retry code can - // inspect. - return err - } - return toRPCErr(err) - } - cs.attempt.s = s - cs.attempt.p = &parser{r: s} - return nil -} - -// clientStream implements a client side Stream. -type clientStream struct { - callHdr *transport.CallHdr - opts []CallOption - callInfo *callInfo - cc *ClientConn - desc *StreamDesc - - codec baseCodec - cp Compressor - comp encoding.Compressor - - cancel context.CancelFunc // cancels all attempts - - sentLast bool // sent an end stream - beginTime time.Time - - methodConfig *MethodConfig - - ctx context.Context // the application's context, wrapped by stats/tracing - - retryThrottler *retryThrottler // The throttler active when the RPC began. - - binlog *binarylog.MethodLogger // Binary logger, can be nil. - // serverHeaderBinlogged is a boolean for whether server header has been - // logged. Server header will be logged when the first time one of those - // happens: stream.Header(), stream.Recv(). - // - // It's only read and used by Recv() and Header(), so it doesn't need to be - // synchronized. - serverHeaderBinlogged bool - - mu sync.Mutex - firstAttempt bool // if true, transparent retry is valid - numRetries int // exclusive of transparent retry attempt(s) - numRetriesSincePushback int // retries since pushback; to reset backoff - finished bool // TODO: replace with atomic cmpxchg or sync.Once? - // attempt is the active client stream attempt. - // The only place where it is written is the newAttemptLocked method and this method never writes nil. - // So, attempt can be nil only inside newClientStream function when clientStream is first created. - // One of the first things done after clientStream's creation, is to call newAttemptLocked which either - // assigns a non nil value to the attempt or returns an error. If an error is returned from newAttemptLocked, - // then newClientStream calls finish on the clientStream and returns. So, finish method is the only - // place where we need to check if the attempt is nil. - attempt *csAttempt - // TODO(hedging): hedging will have multiple attempts simultaneously. - committed bool // active attempt committed for retry? - buffer []func(a *csAttempt) error // operations to replay on retry - bufferSize int // current size of buffer -} - -// csAttempt implements a single transport stream attempt within a -// clientStream. -type csAttempt struct { - cs *clientStream - t transport.ClientTransport - s *transport.Stream - p *parser - done func(balancer.DoneInfo) - - finished bool - dc Decompressor - decomp encoding.Compressor - decompSet bool - - mu sync.Mutex // guards trInfo.tr - // trInfo may be nil (if EnableTracing is false). - // trInfo.tr is set when created (if EnableTracing is true), - // and cleared when the finish method is called. - trInfo *traceInfo - - statsHandler stats.Handler -} - -func (cs *clientStream) commitAttemptLocked() { - cs.committed = true - cs.buffer = nil -} - -func (cs *clientStream) commitAttempt() { - cs.mu.Lock() - cs.commitAttemptLocked() - cs.mu.Unlock() -} - -// shouldRetry returns nil if the RPC should be retried; otherwise it returns -// the error that should be returned by the operation. -func (cs *clientStream) shouldRetry(err error) error { - unprocessed := false - if cs.attempt.s == nil { - pioErr, ok := err.(transport.PerformedIOError) - if ok { - // Unwrap error. - err = toRPCErr(pioErr.Err) - } else { - unprocessed = true - } - if !ok && !cs.callInfo.failFast { - // In the event of a non-IO operation error from NewStream, we - // never attempted to write anything to the wire, so we can retry - // indefinitely for non-fail-fast RPCs. - return nil - } - } - if cs.finished || cs.committed { - // RPC is finished or committed; cannot retry. - return err - } - // Wait for the trailers. - if cs.attempt.s != nil { - <-cs.attempt.s.Done() - unprocessed = cs.attempt.s.Unprocessed() - } - if cs.firstAttempt && unprocessed { - // First attempt, stream unprocessed: transparently retry. - return nil - } - if cs.cc.dopts.disableRetry { - return err - } - - pushback := 0 - hasPushback := false - if cs.attempt.s != nil { - if !cs.attempt.s.TrailersOnly() { - return err - } - - // TODO(retry): Move down if the spec changes to not check server pushback - // before considering this a failure for throttling. - sps := cs.attempt.s.Trailer()["grpc-retry-pushback-ms"] - if len(sps) == 1 { - var e error - if pushback, e = strconv.Atoi(sps[0]); e != nil || pushback < 0 { - channelz.Infof(cs.cc.channelzID, "Server retry pushback specified to abort (%q).", sps[0]) - cs.retryThrottler.throttle() // This counts as a failure for throttling. - return err - } - hasPushback = true - } else if len(sps) > 1 { - channelz.Warningf(cs.cc.channelzID, "Server retry pushback specified multiple values (%q); not retrying.", sps) - cs.retryThrottler.throttle() // This counts as a failure for throttling. - return err - } - } - - var code codes.Code - if cs.attempt.s != nil { - code = cs.attempt.s.Status().Code() - } else { - code = status.Convert(err).Code() - } - - rp := cs.methodConfig.retryPolicy - if rp == nil || !rp.retryableStatusCodes[code] { - return err - } - - // Note: the ordering here is important; we count this as a failure - // only if the code matched a retryable code. - if cs.retryThrottler.throttle() { - return err - } - if cs.numRetries+1 >= rp.maxAttempts { - return err - } - - var dur time.Duration - if hasPushback { - dur = time.Millisecond * time.Duration(pushback) - cs.numRetriesSincePushback = 0 - } else { - fact := math.Pow(rp.backoffMultiplier, float64(cs.numRetriesSincePushback)) - cur := float64(rp.initialBackoff) * fact - if max := float64(rp.maxBackoff); cur > max { - cur = max - } - dur = time.Duration(grpcrand.Int63n(int64(cur))) - cs.numRetriesSincePushback++ - } - - // TODO(dfawley): we could eagerly fail here if dur puts us past the - // deadline, but unsure if it is worth doing. - t := time.NewTimer(dur) - select { - case <-t.C: - cs.numRetries++ - return nil - case <-cs.ctx.Done(): - t.Stop() - return status.FromContextError(cs.ctx.Err()).Err() - } -} - -// Returns nil if a retry was performed and succeeded; error otherwise. -func (cs *clientStream) retryLocked(lastErr error) error { - for { - cs.attempt.finish(lastErr) - if err := cs.shouldRetry(lastErr); err != nil { - cs.commitAttemptLocked() - return err - } - cs.firstAttempt = false - if err := cs.newAttemptLocked(nil, nil); err != nil { - return err - } - if lastErr = cs.replayBufferLocked(); lastErr == nil { - return nil - } - } -} - -func (cs *clientStream) Context() context.Context { - cs.commitAttempt() - // No need to lock before using attempt, since we know it is committed and - // cannot change. - return cs.attempt.s.Context() -} - -func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) error { - cs.mu.Lock() - for { - if cs.committed { - cs.mu.Unlock() - return op(cs.attempt) - } - a := cs.attempt - cs.mu.Unlock() - err := op(a) - cs.mu.Lock() - if a != cs.attempt { - // We started another attempt already. - continue - } - if err == io.EOF { - <-a.s.Done() - } - if err == nil || (err == io.EOF && a.s.Status().Code() == codes.OK) { - onSuccess() - cs.mu.Unlock() - return err - } - if err := cs.retryLocked(err); err != nil { - cs.mu.Unlock() - return err - } - } -} - -func (cs *clientStream) Header() (metadata.MD, error) { - var m metadata.MD - err := cs.withRetry(func(a *csAttempt) error { - var err error - m, err = a.s.Header() - return toRPCErr(err) - }, cs.commitAttemptLocked) - if err != nil { - cs.finish(err) - return nil, err - } - if cs.binlog != nil && !cs.serverHeaderBinlogged { - // Only log if binary log is on and header has not been logged. - logEntry := &binarylog.ServerHeader{ - OnClientSide: true, - Header: m, - PeerAddr: nil, - } - if peer, ok := peer.FromContext(cs.Context()); ok { - logEntry.PeerAddr = peer.Addr - } - cs.binlog.Log(logEntry) - cs.serverHeaderBinlogged = true - } - return m, err -} - -func (cs *clientStream) Trailer() metadata.MD { - // On RPC failure, we never need to retry, because usage requires that - // RecvMsg() returned a non-nil error before calling this function is valid. - // We would have retried earlier if necessary. - // - // Commit the attempt anyway, just in case users are not following those - // directions -- it will prevent races and should not meaningfully impact - // performance. - cs.commitAttempt() - if cs.attempt.s == nil { - return nil - } - return cs.attempt.s.Trailer() -} - -func (cs *clientStream) replayBufferLocked() error { - a := cs.attempt - for _, f := range cs.buffer { - if err := f(a); err != nil { - return err - } - } - return nil -} - -func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error) { - // Note: we still will buffer if retry is disabled (for transparent retries). - if cs.committed { - return - } - cs.bufferSize += sz - if cs.bufferSize > cs.callInfo.maxRetryRPCBufferSize { - cs.commitAttemptLocked() - return - } - cs.buffer = append(cs.buffer, op) -} - -func (cs *clientStream) SendMsg(m interface{}) (err error) { - defer func() { - if err != nil && err != io.EOF { - // Call finish on the client stream for errors generated by this SendMsg - // call, as these indicate problems created by this client. (Transport - // errors are converted to an io.EOF error in csAttempt.sendMsg; the real - // error will be returned from RecvMsg eventually in that case, or be - // retried.) - cs.finish(err) - } - }() - if cs.sentLast { - return status.Errorf(codes.Internal, "SendMsg called after CloseSend") - } - if !cs.desc.ClientStreams { - cs.sentLast = true - } - - // load hdr, payload, data - hdr, payload, data, err := prepareMsg(m, cs.codec, cs.cp, cs.comp) - if err != nil { - return err - } - - // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > *cs.callInfo.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) - } - msgBytes := data // Store the pointer before setting to nil. For binary logging. - op := func(a *csAttempt) error { - err := a.sendMsg(m, hdr, payload, data) - // nil out the message and uncomp when replaying; they are only needed for - // stats which is disabled for subsequent attempts. - m, data = nil, nil - return err - } - err = cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) }) - if cs.binlog != nil && err == nil { - cs.binlog.Log(&binarylog.ClientMessage{ - OnClientSide: true, - Message: msgBytes, - }) - } - return -} - -func (cs *clientStream) RecvMsg(m interface{}) error { - if cs.binlog != nil && !cs.serverHeaderBinlogged { - // Call Header() to binary log header if it's not already logged. - cs.Header() - } - var recvInfo *payloadInfo - if cs.binlog != nil { - recvInfo = &payloadInfo{} - } - err := cs.withRetry(func(a *csAttempt) error { - return a.recvMsg(m, recvInfo) - }, cs.commitAttemptLocked) - if cs.binlog != nil && err == nil { - cs.binlog.Log(&binarylog.ServerMessage{ - OnClientSide: true, - Message: recvInfo.uncompressedBytes, - }) - } - if err != nil || !cs.desc.ServerStreams { - // err != nil or non-server-streaming indicates end of stream. - cs.finish(err) - - if cs.binlog != nil { - // finish will not log Trailer. Log Trailer here. - logEntry := &binarylog.ServerTrailer{ - OnClientSide: true, - Trailer: cs.Trailer(), - Err: err, - } - if logEntry.Err == io.EOF { - logEntry.Err = nil - } - if peer, ok := peer.FromContext(cs.Context()); ok { - logEntry.PeerAddr = peer.Addr - } - cs.binlog.Log(logEntry) - } - } - return err -} - -func (cs *clientStream) CloseSend() error { - if cs.sentLast { - // TODO: return an error and finish the stream instead, due to API misuse? - return nil - } - cs.sentLast = true - op := func(a *csAttempt) error { - a.t.Write(a.s, nil, nil, &transport.Options{Last: true}) - // Always return nil; io.EOF is the only error that might make sense - // instead, but there is no need to signal the client to call RecvMsg - // as the only use left for the stream after CloseSend is to call - // RecvMsg. This also matches historical behavior. - return nil - } - cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }) - if cs.binlog != nil { - cs.binlog.Log(&binarylog.ClientHalfClose{ - OnClientSide: true, - }) - } - // We never returned an error here for reasons. - return nil -} - -func (cs *clientStream) finish(err error) { - if err == io.EOF { - // Ending a stream with EOF indicates a success. - err = nil - } - cs.mu.Lock() - if cs.finished { - cs.mu.Unlock() - return - } - cs.finished = true - cs.commitAttemptLocked() - if cs.attempt != nil { - cs.attempt.finish(err) - // after functions all rely upon having a stream. - if cs.attempt.s != nil { - for _, o := range cs.opts { - o.after(cs.callInfo, cs.attempt) - } - } - } - cs.mu.Unlock() - // For binary logging. only log cancel in finish (could be caused by RPC ctx - // canceled or ClientConn closed). Trailer will be logged in RecvMsg. - // - // Only one of cancel or trailer needs to be logged. In the cases where - // users don't call RecvMsg, users must have already canceled the RPC. - if cs.binlog != nil && status.Code(err) == codes.Canceled { - cs.binlog.Log(&binarylog.Cancel{ - OnClientSide: true, - }) - } - if err == nil { - cs.retryThrottler.successfulRPC() - } - if channelz.IsOn() { - if err != nil { - cs.cc.incrCallsFailed() - } else { - cs.cc.incrCallsSucceeded() - } - } - cs.cancel() -} - -func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error { - cs := a.cs - if a.trInfo != nil { - a.mu.Lock() - if a.trInfo.tr != nil { - a.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) - } - a.mu.Unlock() - } - if err := a.t.Write(a.s, hdr, payld, &transport.Options{Last: !cs.desc.ClientStreams}); err != nil { - if !cs.desc.ClientStreams { - // For non-client-streaming RPCs, we return nil instead of EOF on error - // because the generated code requires it. finish is not called; RecvMsg() - // will call it with the stream's status independently. - return nil - } - return io.EOF - } - if a.statsHandler != nil { - a.statsHandler.HandleRPC(cs.ctx, outPayload(true, m, data, payld, time.Now())) - } - if channelz.IsOn() { - a.t.IncrMsgSent() - } - return nil -} - -func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) { - cs := a.cs - if a.statsHandler != nil && payInfo == nil { - payInfo = &payloadInfo{} - } - - if !a.decompSet { - // Block until we receive headers containing received message encoding. - if ct := a.s.RecvCompress(); ct != "" && ct != encoding.Identity { - if a.dc == nil || a.dc.Type() != ct { - // No configured decompressor, or it does not match the incoming - // message encoding; attempt to find a registered compressor that does. - a.dc = nil - a.decomp = encoding.GetCompressor(ct) - } - } else { - // No compression is used; disable our decompressor. - a.dc = nil - } - // Only initialize this state once per stream. - a.decompSet = true - } - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decomp) - if err != nil { - if err == io.EOF { - if statusErr := a.s.Status().Err(); statusErr != nil { - return statusErr - } - return io.EOF // indicates successful end of stream. - } - return toRPCErr(err) - } - if a.trInfo != nil { - a.mu.Lock() - if a.trInfo.tr != nil { - a.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) - } - a.mu.Unlock() - } - if a.statsHandler != nil { - a.statsHandler.HandleRPC(cs.ctx, &stats.InPayload{ - Client: true, - RecvTime: time.Now(), - Payload: m, - // TODO truncate large payload. - Data: payInfo.uncompressedBytes, - WireLength: payInfo.wireLength, - Length: len(payInfo.uncompressedBytes), - }) - } - if channelz.IsOn() { - a.t.IncrMsgRecv() - } - if cs.desc.ServerStreams { - // Subsequent messages should be received by subsequent RecvMsg calls. - return nil - } - // Special handling for non-server-stream rpcs. - // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { - return a.s.Status().Err() // non-server streaming Recv returns nil on success - } - return toRPCErr(err) -} - -func (a *csAttempt) finish(err error) { - a.mu.Lock() - if a.finished { - a.mu.Unlock() - return - } - a.finished = true - if err == io.EOF { - // Ending a stream with EOF indicates a success. - err = nil - } - var tr metadata.MD - if a.s != nil { - a.t.CloseStream(a.s, err) - tr = a.s.Trailer() - } - - if a.done != nil { - br := false - if a.s != nil { - br = a.s.BytesReceived() - } - a.done(balancer.DoneInfo{ - Err: err, - Trailer: tr, - BytesSent: a.s != nil, - BytesReceived: br, - ServerLoad: balancerload.Parse(tr), - }) - } - if a.statsHandler != nil { - end := &stats.End{ - Client: true, - BeginTime: a.cs.beginTime, - EndTime: time.Now(), - Trailer: tr, - Error: err, - } - a.statsHandler.HandleRPC(a.cs.ctx, end) - } - if a.trInfo != nil && a.trInfo.tr != nil { - if err == nil { - a.trInfo.tr.LazyPrintf("RPC: [OK]") - } else { - a.trInfo.tr.LazyPrintf("RPC: [%v]", err) - a.trInfo.tr.SetError() - } - a.trInfo.tr.Finish() - a.trInfo.tr = nil - } - a.mu.Unlock() -} - -// newClientStream creates a ClientStream with the specified transport, on the -// given addrConn. -// -// It's expected that the given transport is either the same one in addrConn, or -// is already closed. To avoid race, transport is specified separately, instead -// of using ac.transpot. -// -// Main difference between this and ClientConn.NewStream: -// - no retry -// - no service config (or wait for service config) -// - no tracing or stats -func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method string, t transport.ClientTransport, ac *addrConn, opts ...CallOption) (_ ClientStream, err error) { - if t == nil { - // TODO: return RPC error here? - return nil, errors.New("transport provided is nil") - } - // defaultCallInfo contains unnecessary info(i.e. failfast, maxRetryRPCBufferSize), so we just initialize an empty struct. - c := &callInfo{} - - // Possible context leak: - // The cancel function for the child context we create will only be called - // when RecvMsg returns a non-nil error, if the ClientConn is closed, or if - // an error is generated by SendMsg. - // https://github.com/grpc/grpc-go/issues/1818. - ctx, cancel := context.WithCancel(ctx) - defer func() { - if err != nil { - cancel() - } - }() - - for _, o := range opts { - if err := o.before(c); err != nil { - return nil, toRPCErr(err) - } - } - c.maxReceiveMessageSize = getMaxSize(nil, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) - c.maxSendMessageSize = getMaxSize(nil, c.maxSendMessageSize, defaultServerMaxSendMessageSize) - if err := setCallInfoCodec(c); err != nil { - return nil, err - } - - callHdr := &transport.CallHdr{ - Host: ac.cc.authority, - Method: method, - ContentSubtype: c.contentSubtype, - } - - // Set our outgoing compression according to the UseCompressor CallOption, if - // set. In that case, also find the compressor from the encoding package. - // Otherwise, use the compressor configured by the WithCompressor DialOption, - // if set. - var cp Compressor - var comp encoding.Compressor - if ct := c.compressorType; ct != "" { - callHdr.SendCompress = ct - if ct != encoding.Identity { - comp = encoding.GetCompressor(ct) - if comp == nil { - return nil, status.Errorf(codes.Internal, "grpc: Compressor is not installed for requested grpc-encoding %q", ct) - } - } - } else if ac.cc.dopts.cp != nil { - callHdr.SendCompress = ac.cc.dopts.cp.Type() - cp = ac.cc.dopts.cp - } - if c.creds != nil { - callHdr.Creds = c.creds - } - - // Use a special addrConnStream to avoid retry. - as := &addrConnStream{ - callHdr: callHdr, - ac: ac, - ctx: ctx, - cancel: cancel, - opts: opts, - callInfo: c, - desc: desc, - codec: c.codec, - cp: cp, - comp: comp, - t: t, - } - - s, err := as.t.NewStream(as.ctx, as.callHdr) - if err != nil { - err = toRPCErr(err) - return nil, err - } - as.s = s - as.p = &parser{r: s} - ac.incrCallsStarted() - if desc != unaryStreamDesc { - // Listen on cc and stream contexts to cleanup when the user closes the - // ClientConn or cancels the stream context. In all other cases, an error - // should already be injected into the recv buffer by the transport, which - // the client will eventually receive, and then we will cancel the stream's - // context in clientStream.finish. - go func() { - select { - case <-ac.ctx.Done(): - as.finish(status.Error(codes.Canceled, "grpc: the SubConn is closing")) - case <-ctx.Done(): - as.finish(toRPCErr(ctx.Err())) - } - }() - } - return as, nil -} - -type addrConnStream struct { - s *transport.Stream - ac *addrConn - callHdr *transport.CallHdr - cancel context.CancelFunc - opts []CallOption - callInfo *callInfo - t transport.ClientTransport - ctx context.Context - sentLast bool - desc *StreamDesc - codec baseCodec - cp Compressor - comp encoding.Compressor - decompSet bool - dc Decompressor - decomp encoding.Compressor - p *parser - mu sync.Mutex - finished bool -} - -func (as *addrConnStream) Header() (metadata.MD, error) { - m, err := as.s.Header() - if err != nil { - as.finish(toRPCErr(err)) - } - return m, err -} - -func (as *addrConnStream) Trailer() metadata.MD { - return as.s.Trailer() -} - -func (as *addrConnStream) CloseSend() error { - if as.sentLast { - // TODO: return an error and finish the stream instead, due to API misuse? - return nil - } - as.sentLast = true - - as.t.Write(as.s, nil, nil, &transport.Options{Last: true}) - // Always return nil; io.EOF is the only error that might make sense - // instead, but there is no need to signal the client to call RecvMsg - // as the only use left for the stream after CloseSend is to call - // RecvMsg. This also matches historical behavior. - return nil -} - -func (as *addrConnStream) Context() context.Context { - return as.s.Context() -} - -func (as *addrConnStream) SendMsg(m interface{}) (err error) { - defer func() { - if err != nil && err != io.EOF { - // Call finish on the client stream for errors generated by this SendMsg - // call, as these indicate problems created by this client. (Transport - // errors are converted to an io.EOF error in csAttempt.sendMsg; the real - // error will be returned from RecvMsg eventually in that case, or be - // retried.) - as.finish(err) - } - }() - if as.sentLast { - return status.Errorf(codes.Internal, "SendMsg called after CloseSend") - } - if !as.desc.ClientStreams { - as.sentLast = true - } - - // load hdr, payload, data - hdr, payld, _, err := prepareMsg(m, as.codec, as.cp, as.comp) - if err != nil { - return err - } - - // TODO(dfawley): should we be checking len(data) instead? - if len(payld) > *as.callInfo.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payld), *as.callInfo.maxSendMessageSize) - } - - if err := as.t.Write(as.s, hdr, payld, &transport.Options{Last: !as.desc.ClientStreams}); err != nil { - if !as.desc.ClientStreams { - // For non-client-streaming RPCs, we return nil instead of EOF on error - // because the generated code requires it. finish is not called; RecvMsg() - // will call it with the stream's status independently. - return nil - } - return io.EOF - } - - if channelz.IsOn() { - as.t.IncrMsgSent() - } - return nil -} - -func (as *addrConnStream) RecvMsg(m interface{}) (err error) { - defer func() { - if err != nil || !as.desc.ServerStreams { - // err != nil or non-server-streaming indicates end of stream. - as.finish(err) - } - }() - - if !as.decompSet { - // Block until we receive headers containing received message encoding. - if ct := as.s.RecvCompress(); ct != "" && ct != encoding.Identity { - if as.dc == nil || as.dc.Type() != ct { - // No configured decompressor, or it does not match the incoming - // message encoding; attempt to find a registered compressor that does. - as.dc = nil - as.decomp = encoding.GetCompressor(ct) - } - } else { - // No compression is used; disable our decompressor. - as.dc = nil - } - // Only initialize this state once per stream. - as.decompSet = true - } - err = recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp) - if err != nil { - if err == io.EOF { - if statusErr := as.s.Status().Err(); statusErr != nil { - return statusErr - } - return io.EOF // indicates successful end of stream. - } - return toRPCErr(err) - } - - if channelz.IsOn() { - as.t.IncrMsgRecv() - } - if as.desc.ServerStreams { - // Subsequent messages should be received by subsequent RecvMsg calls. - return nil - } - - // Special handling for non-server-stream rpcs. - // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { - return as.s.Status().Err() // non-server streaming Recv returns nil on success - } - return toRPCErr(err) -} - -func (as *addrConnStream) finish(err error) { - as.mu.Lock() - if as.finished { - as.mu.Unlock() - return - } - as.finished = true - if err == io.EOF { - // Ending a stream with EOF indicates a success. - err = nil - } - if as.s != nil { - as.t.CloseStream(as.s, err) - } - - if err != nil { - as.ac.incrCallsFailed() - } else { - as.ac.incrCallsSucceeded() - } - as.cancel() - as.mu.Unlock() -} - -// ServerStream defines the server-side behavior of a streaming RPC. -// -// All errors returned from ServerStream methods are compatible with the -// status package. -type ServerStream interface { - // SetHeader sets the header metadata. It may be called multiple times. - // When call multiple times, all the provided metadata will be merged. - // All the metadata will be sent out when one of the following happens: - // - ServerStream.SendHeader() is called; - // - The first response is sent out; - // - An RPC status is sent out (error or success). - SetHeader(metadata.MD) error - // SendHeader sends the header metadata. - // The provided md and headers set by SetHeader() will be sent. - // It fails if called multiple times. - SendHeader(metadata.MD) error - // SetTrailer sets the trailer metadata which will be sent with the RPC status. - // When called more than once, all the provided metadata will be merged. - SetTrailer(metadata.MD) - // Context returns the context for this stream. - Context() context.Context - // SendMsg sends a message. On error, SendMsg aborts the stream and the - // error is returned directly. - // - // SendMsg blocks until: - // - There is sufficient flow control to schedule m with the transport, or - // - The stream is done, or - // - The stream breaks. - // - // SendMsg does not wait until the message is received by the client. An - // untimely stream closure may result in lost messages. - // - // It is safe to have a goroutine calling SendMsg and another goroutine - // calling RecvMsg on the same stream at the same time, but it is not safe - // to call SendMsg on the same stream in different goroutines. - SendMsg(m interface{}) error - // RecvMsg blocks until it receives a message into m or the stream is - // done. It returns io.EOF when the client has performed a CloseSend. On - // any non-EOF error, the stream is aborted and the error contains the - // RPC status. - // - // It is safe to have a goroutine calling SendMsg and another goroutine - // calling RecvMsg on the same stream at the same time, but it is not - // safe to call RecvMsg on the same stream in different goroutines. - RecvMsg(m interface{}) error -} - -// serverStream implements a server side Stream. -type serverStream struct { - ctx context.Context - t transport.ServerTransport - s *transport.Stream - p *parser - codec baseCodec - - cp Compressor - dc Decompressor - comp encoding.Compressor - decomp encoding.Compressor - - maxReceiveMessageSize int - maxSendMessageSize int - trInfo *traceInfo - - statsHandler stats.Handler - - binlog *binarylog.MethodLogger - // serverHeaderBinlogged indicates whether server header has been logged. It - // will happen when one of the following two happens: stream.SendHeader(), - // stream.Send(). - // - // It's only checked in send and sendHeader, doesn't need to be - // synchronized. - serverHeaderBinlogged bool - - mu sync.Mutex // protects trInfo.tr after the service handler runs. -} - -func (ss *serverStream) Context() context.Context { - return ss.ctx -} - -func (ss *serverStream) SetHeader(md metadata.MD) error { - if md.Len() == 0 { - return nil - } - return ss.s.SetHeader(md) -} - -func (ss *serverStream) SendHeader(md metadata.MD) error { - err := ss.t.WriteHeader(ss.s, md) - if ss.binlog != nil && !ss.serverHeaderBinlogged { - h, _ := ss.s.Header() - ss.binlog.Log(&binarylog.ServerHeader{ - Header: h, - }) - ss.serverHeaderBinlogged = true - } - return err -} - -func (ss *serverStream) SetTrailer(md metadata.MD) { - if md.Len() == 0 { - return - } - ss.s.SetTrailer(md) -} - -func (ss *serverStream) SendMsg(m interface{}) (err error) { - defer func() { - if ss.trInfo != nil { - ss.mu.Lock() - if ss.trInfo.tr != nil { - if err == nil { - ss.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) - } else { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - } - ss.mu.Unlock() - } - if err != nil && err != io.EOF { - st, _ := status.FromError(toRPCErr(err)) - ss.t.WriteStatus(ss.s, st) - // Non-user specified status was sent out. This should be an error - // case (as a server side Cancel maybe). - // - // This is not handled specifically now. User will return a final - // status from the service handler, we will log that error instead. - // This behavior is similar to an interceptor. - } - if channelz.IsOn() && err == nil { - ss.t.IncrMsgSent() - } - }() - - // load hdr, payload, data - hdr, payload, data, err := prepareMsg(m, ss.codec, ss.cp, ss.comp) - if err != nil { - return err - } - - // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > ss.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) - } - if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil { - return toRPCErr(err) - } - if ss.binlog != nil { - if !ss.serverHeaderBinlogged { - h, _ := ss.s.Header() - ss.binlog.Log(&binarylog.ServerHeader{ - Header: h, - }) - ss.serverHeaderBinlogged = true - } - ss.binlog.Log(&binarylog.ServerMessage{ - Message: data, - }) - } - if ss.statsHandler != nil { - ss.statsHandler.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now())) - } - return nil -} - -func (ss *serverStream) RecvMsg(m interface{}) (err error) { - defer func() { - if ss.trInfo != nil { - ss.mu.Lock() - if ss.trInfo.tr != nil { - if err == nil { - ss.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) - } else if err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - } - ss.mu.Unlock() - } - if err != nil && err != io.EOF { - st, _ := status.FromError(toRPCErr(err)) - ss.t.WriteStatus(ss.s, st) - // Non-user specified status was sent out. This should be an error - // case (as a server side Cancel maybe). - // - // This is not handled specifically now. User will return a final - // status from the service handler, we will log that error instead. - // This behavior is similar to an interceptor. - } - if channelz.IsOn() && err == nil { - ss.t.IncrMsgRecv() - } - }() - var payInfo *payloadInfo - if ss.statsHandler != nil || ss.binlog != nil { - payInfo = &payloadInfo{} - } - if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp); err != nil { - if err == io.EOF { - if ss.binlog != nil { - ss.binlog.Log(&binarylog.ClientHalfClose{}) - } - return err - } - if err == io.ErrUnexpectedEOF { - err = status.Errorf(codes.Internal, io.ErrUnexpectedEOF.Error()) - } - return toRPCErr(err) - } - if ss.statsHandler != nil { - ss.statsHandler.HandleRPC(ss.s.Context(), &stats.InPayload{ - RecvTime: time.Now(), - Payload: m, - // TODO truncate large payload. - Data: payInfo.uncompressedBytes, - WireLength: payInfo.wireLength, - Length: len(payInfo.uncompressedBytes), - }) - } - if ss.binlog != nil { - ss.binlog.Log(&binarylog.ClientMessage{ - Message: payInfo.uncompressedBytes, - }) - } - return nil -} - -// MethodFromServerStream returns the method string for the input stream. -// The returned string is in the format of "/service/method". -func MethodFromServerStream(stream ServerStream) (string, bool) { - return Method(stream.Context()) -} - -// prepareMsg returns the hdr, payload and data -// using the compressors passed or using the -// passed preparedmsg -func prepareMsg(m interface{}, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { - if preparedMsg, ok := m.(*PreparedMsg); ok { - return preparedMsg.hdr, preparedMsg.payload, preparedMsg.encodedData, nil - } - // The input interface is not a prepared msg. - // Marshal and Compress the data at this point - data, err = encode(codec, m) - if err != nil { - return nil, nil, nil, err - } - compData, err := compress(data, cp, comp) - if err != nil { - return nil, nil, nil, err - } - hdr, payload = msgHeader(data, compData) - return hdr, payload, data, nil -} diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go deleted file mode 100644 index 584360f68..000000000 --- a/vendor/google.golang.org/grpc/tap/tap.go +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright 2016 gRPC 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 tap defines the function handles which are executed on the transport -// layer of gRPC-Go and related information. Everything here is EXPERIMENTAL. -package tap - -import ( - "context" -) - -// Info defines the relevant information needed by the handles. -type Info struct { - // FullMethodName is the string of grpc method (in the format of - // /package.service/method). - FullMethodName string - // TODO: More to be added. -} - -// ServerInHandle defines the function which runs before a new stream is created -// on the server side. If it returns a non-nil error, the stream will not be -// created and a RST_STREAM will be sent back to the client with REFUSED_STREAM. -// The client will receive an RPC error "code = Unavailable, desc = stream -// terminated by RST_STREAM with error code: REFUSED_STREAM". -// -// It's intended to be used in situations where you don't want to waste the -// resources to accept the new stream (e.g. rate-limiting). And the content of -// the error will be ignored and won't be sent back to the client. For other -// general usages, please use interceptors. -// -// Note that it is executed in the per-connection I/O goroutine(s) instead of -// per-RPC goroutine. Therefore, users should NOT have any -// blocking/time-consuming work in this handle. Otherwise all the RPCs would -// slow down. Also, for the same reason, this handle won't be called -// concurrently by gRPC. -type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error) diff --git a/vendor/google.golang.org/grpc/trace.go b/vendor/google.golang.org/grpc/trace.go deleted file mode 100644 index 07a2d26b3..000000000 --- a/vendor/google.golang.org/grpc/trace.go +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Copyright 2015 gRPC 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 grpc - -import ( - "bytes" - "fmt" - "io" - "net" - "strings" - "sync" - "time" - - "golang.org/x/net/trace" -) - -// EnableTracing controls whether to trace RPCs using the golang.org/x/net/trace package. -// This should only be set before any RPCs are sent or received by this program. -var EnableTracing bool - -// methodFamily returns the trace family for the given method. -// It turns "/pkg.Service/GetFoo" into "pkg.Service". -func methodFamily(m string) string { - m = strings.TrimPrefix(m, "/") // remove leading slash - if i := strings.Index(m, "/"); i >= 0 { - m = m[:i] // remove everything from second slash - } - return m -} - -// traceInfo contains tracing information for an RPC. -type traceInfo struct { - tr trace.Trace - firstLine firstLine -} - -// firstLine is the first line of an RPC trace. -// It may be mutated after construction; remoteAddr specifically may change -// during client-side use. -type firstLine struct { - mu sync.Mutex - client bool // whether this is a client (outgoing) RPC - remoteAddr net.Addr - deadline time.Duration // may be zero -} - -func (f *firstLine) SetRemoteAddr(addr net.Addr) { - f.mu.Lock() - f.remoteAddr = addr - f.mu.Unlock() -} - -func (f *firstLine) String() string { - f.mu.Lock() - defer f.mu.Unlock() - - var line bytes.Buffer - io.WriteString(&line, "RPC: ") - if f.client { - io.WriteString(&line, "to") - } else { - io.WriteString(&line, "from") - } - fmt.Fprintf(&line, " %v deadline:", f.remoteAddr) - if f.deadline != 0 { - fmt.Fprint(&line, f.deadline) - } else { - io.WriteString(&line, "none") - } - return line.String() -} - -const truncateSize = 100 - -func truncate(x string, l int) string { - if l > len(x) { - return x - } - return x[:l] -} - -// payload represents an RPC request or response payload. -type payload struct { - sent bool // whether this is an outgoing payload - msg interface{} // e.g. a proto.Message - // TODO(dsymonds): add stringifying info to codec, and limit how much we hold here? -} - -func (p payload) String() string { - if p.sent { - return truncate(fmt.Sprintf("sent: %v", p.msg), truncateSize) - } - return truncate(fmt.Sprintf("recv: %v", p.msg), truncateSize) -} - -type fmtStringer struct { - format string - a []interface{} -} - -func (f *fmtStringer) String() string { - return fmt.Sprintf(f.format, f.a...) -} - -type stringer string - -func (s stringer) String() string { return string(s) } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go deleted file mode 100644 index c7e67b847..000000000 --- a/vendor/google.golang.org/grpc/version.go +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright 2018 gRPC 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 grpc - -// Version is the current grpc version. -const Version = "1.30.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh deleted file mode 100644 index f0a67298a..000000000 --- a/vendor/google.golang.org/grpc/vet.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash - -set -ex # Exit on error; debugging enabled. -set -o pipefail # Fail a pipe if any sub-command fails. - -# not makes sure the command passed to it does not exit with a return code of 0. -not() { - # This is required instead of the earlier (! $COMMAND) because subshells and - # pipefail don't work the same on Darwin as in Linux. - ! "$@" -} - -die() { - echo "$@" >&2 - exit 1 -} - -fail_on_output() { - tee /dev/stderr | not read -} - -# Check to make sure it's safe to modify the user's git repo. -git status --porcelain | fail_on_output - -# Undo any edits made by this script. -cleanup() { - git reset --hard HEAD -} -trap cleanup EXIT - -PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}" - -if [[ "$1" = "-install" ]]; then - # Check for module support - if go help mod >& /dev/null; then - # Install the pinned versions as defined in module tools. - pushd ./test/tools - go install \ - golang.org/x/lint/golint \ - golang.org/x/tools/cmd/goimports \ - honnef.co/go/tools/cmd/staticcheck \ - github.com/client9/misspell/cmd/misspell - popd - else - # Ye olde `go get` incantation. - # Note: this gets the latest version of all tools (vs. the pinned versions - # with Go modules). - go get -u \ - golang.org/x/lint/golint \ - golang.org/x/tools/cmd/goimports \ - honnef.co/go/tools/cmd/staticcheck \ - github.com/client9/misspell/cmd/misspell - fi - if [[ -z "${VET_SKIP_PROTO}" ]]; then - if [[ "${TRAVIS}" = "true" ]]; then - PROTOBUF_VERSION=3.3.0 - PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip - pushd /home/travis - wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME} - unzip ${PROTOC_FILENAME} - bin/protoc --version - popd - elif not which protoc > /dev/null; then - die "Please install protoc into your path" - fi - fi - exit 0 -elif [[ "$#" -ne 0 ]]; then - die "Unknown argument(s): $*" -fi - -# - Ensure all source files contain a copyright message. -not git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" -- '*.go' - -# - Make sure all tests in grpc and grpc/test use leakcheck via Teardown. -not grep 'func Test[^(]' *_test.go -not grep 'func Test[^(]' test/*.go - -# - Do not import x/net/context. -not git grep -l 'x/net/context' -- "*.go" - -# - Do not import math/rand for real library code. Use internal/grpcrand for -# thread safety. -git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^stress\|grpcrand\|^benchmark\|wrr_test' - -# - Ensure all ptypes proto packages are renamed when importing. -not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go" - -# - Ensure all xds proto imports are renamed to *pb or *grpc. -git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' | not grep -v 'pb "\|grpc "' - -# - Check imports that are illegal in appengine (until Go 1.11). -# TODO: Remove when we drop Go 1.10 support -go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go - -# - gofmt, goimports, golint (with exceptions for generated code), go vet. -gofmt -s -d -l . 2>&1 | fail_on_output -goimports -l . 2>&1 | not grep -vE "(_mock|\.pb)\.go" -golint ./... 2>&1 | not grep -vE "(_mock|\.pb)\.go:" -go vet -all ./... - -misspell -error . - -# - Check that generated proto files are up to date. -if [[ -z "${VET_SKIP_PROTO}" ]]; then - PATH="/home/travis/bin:${PATH}" make proto && \ - git status --porcelain 2>&1 | fail_on_output || \ - (git status; git --no-pager diff; exit 1) -fi - -# - Check that our module is tidy. -if go help mod >& /dev/null; then - go mod tidy && \ - git status --porcelain 2>&1 | fail_on_output || \ - (git status; git --no-pager diff; exit 1) -fi - -# - Collection of static analysis checks -# -# TODO(dfawley): don't use deprecated functions in examples or first-party -# plugins. -SC_OUT="$(mktemp)" -staticcheck -go 1.9 -checks 'inherit,-ST1015' ./... > "${SC_OUT}" || true -# Error if anything other than deprecation warnings are printed. -not grep -v "is deprecated:.*SA1019" "${SC_OUT}" -# Only ignore the following deprecated types/fields/functions. -not grep -Fv '.CredsBundle -.HeaderMap -.Metadata is deprecated: use Attributes -.NewAddress -.NewServiceConfig -.Type is deprecated: use Attributes -balancer.ErrTransientFailure -balancer.Picker -grpc.CallCustomCodec -grpc.Code -grpc.Compressor -grpc.Decompressor -grpc.MaxMsgSize -grpc.MethodConfig -grpc.NewGZIPCompressor -grpc.NewGZIPDecompressor -grpc.RPCCompressor -grpc.RPCDecompressor -grpc.ServiceConfig -grpc.WithBalancerName -grpc.WithCompressor -grpc.WithDecompressor -grpc.WithDialer -grpc.WithMaxMsgSize -grpc.WithServiceConfig -grpc.WithTimeout -http.CloseNotifier -info.SecurityVersion -resolver.Backend -resolver.GRPCLB' "${SC_OUT}" - -# - special golint on package comments. -lint_package_comment_per_package() { - # Number of files in this go package. - fileCount=$(go list -f '{{len .GoFiles}}' $1) - if [ ${fileCount} -eq 0 ]; then - return 0 - fi - # Number of package errors generated by golint. - lintPackageCommentErrorsCount=$(golint --min_confidence 0 $1 | grep -c "should have a package comment") - # golint complains about every file that's missing the package comment. If the - # number of files for this package is greater than the number of errors, there's - # at least one file with package comment, good. Otherwise, fail. - if [ ${fileCount} -le ${lintPackageCommentErrorsCount} ]; then - echo "Package $1 (with ${fileCount} files) is missing package comment" - return 1 - fi -} -lint_package_comment() { - set +ex - - count=0 - for i in $(go list ./...); do - lint_package_comment_per_package "$i" - ((count += $?)) - done - - set -ex - return $count -} -lint_package_comment - -echo SUCCESS diff --git a/vendor/google.golang.org/protobuf/AUTHORS b/vendor/google.golang.org/protobuf/AUTHORS deleted file mode 100644 index 2b00ddba0..000000000 --- a/vendor/google.golang.org/protobuf/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at https://tip.golang.org/AUTHORS. diff --git a/vendor/google.golang.org/protobuf/CONTRIBUTORS b/vendor/google.golang.org/protobuf/CONTRIBUTORS deleted file mode 100644 index 1fbd3e976..000000000 --- a/vendor/google.golang.org/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at https://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/google.golang.org/protobuf/LICENSE b/vendor/google.golang.org/protobuf/LICENSE deleted file mode 100644 index 49ea0f928..000000000 --- a/vendor/google.golang.org/protobuf/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2018 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/google.golang.org/protobuf/PATENTS b/vendor/google.golang.org/protobuf/PATENTS deleted file mode 100644 index 733099041..000000000 --- a/vendor/google.golang.org/protobuf/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go deleted file mode 100644 index cab95a427..000000000 --- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +++ /dev/null @@ -1,791 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package prototext - -import ( - "fmt" - "strings" - "unicode/utf8" - - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/encoding/text" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/internal/set" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/proto" - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -// Unmarshal reads the given []byte into the given proto.Message. -func Unmarshal(b []byte, m proto.Message) error { - return UnmarshalOptions{}.Unmarshal(b, m) -} - -// UnmarshalOptions is a configurable textproto format unmarshaler. -type UnmarshalOptions struct { - pragma.NoUnkeyedLiterals - - // AllowPartial accepts input for messages that will result in missing - // required fields. If AllowPartial is false (the default), Unmarshal will - // return error if there are any missing required fields. - AllowPartial bool - - // DiscardUnknown specifies whether to ignore unknown fields when parsing. - // An unknown field is any field whose field name or field number does not - // resolve to any known or extension field in the message. - // By default, unmarshal rejects unknown fields as an error. - DiscardUnknown bool - - // Resolver is used for looking up types when unmarshaling - // google.protobuf.Any messages or extension fields. - // If nil, this defaults to using protoregistry.GlobalTypes. - Resolver interface { - protoregistry.MessageTypeResolver - protoregistry.ExtensionTypeResolver - } -} - -// Unmarshal reads the given []byte and populates the given proto.Message using options in -// UnmarshalOptions object. -func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error { - return o.unmarshal(b, m) -} - -// unmarshal is a centralized function that all unmarshal operations go through. -// For profiling purposes, avoid changing the name of this function or -// introducing other code paths for unmarshal that do not go through this. -func (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error { - proto.Reset(m) - - if o.Resolver == nil { - o.Resolver = protoregistry.GlobalTypes - } - - dec := decoder{text.NewDecoder(b), o} - if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil { - return err - } - if o.AllowPartial { - return nil - } - return proto.CheckInitialized(m) -} - -type decoder struct { - *text.Decoder - opts UnmarshalOptions -} - -// newError returns an error object with position info. -func (d decoder) newError(pos int, f string, x ...interface{}) error { - line, column := d.Position(pos) - head := fmt.Sprintf("(line %d:%d): ", line, column) - return errors.New(head+f, x...) -} - -// unexpectedTokenError returns a syntax error for the given unexpected token. -func (d decoder) unexpectedTokenError(tok text.Token) error { - return d.syntaxError(tok.Pos(), "unexpected token: %s", tok.RawString()) -} - -// syntaxError returns a syntax error for given position. -func (d decoder) syntaxError(pos int, f string, x ...interface{}) error { - line, column := d.Position(pos) - head := fmt.Sprintf("syntax error (line %d:%d): ", line, column) - return errors.New(head+f, x...) -} - -// unmarshalMessage unmarshals into the given protoreflect.Message. -func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error { - messageDesc := m.Descriptor() - if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) { - return errors.New("no support for proto1 MessageSets") - } - - if messageDesc.FullName() == genid.Any_message_fullname { - return d.unmarshalAny(m, checkDelims) - } - - if checkDelims { - tok, err := d.Read() - if err != nil { - return err - } - - if tok.Kind() != text.MessageOpen { - return d.unexpectedTokenError(tok) - } - } - - var seenNums set.Ints - var seenOneofs set.Ints - fieldDescs := messageDesc.Fields() - - for { - // Read field name. - tok, err := d.Read() - if err != nil { - return err - } - switch typ := tok.Kind(); typ { - case text.Name: - // Continue below. - case text.EOF: - if checkDelims { - return text.ErrUnexpectedEOF - } - return nil - default: - if checkDelims && typ == text.MessageClose { - return nil - } - return d.unexpectedTokenError(tok) - } - - // Resolve the field descriptor. - var name pref.Name - var fd pref.FieldDescriptor - var xt pref.ExtensionType - var xtErr error - var isFieldNumberName bool - - switch tok.NameKind() { - case text.IdentName: - name = pref.Name(tok.IdentName()) - fd = fieldDescs.ByName(name) - if fd == nil { - // The proto name of a group field is in all lowercase, - // while the textproto field name is the group message name. - gd := fieldDescs.ByName(pref.Name(strings.ToLower(string(name)))) - if gd != nil && gd.Kind() == pref.GroupKind && gd.Message().Name() == name { - fd = gd - } - } else if fd.Kind() == pref.GroupKind && fd.Message().Name() != name { - fd = nil // reset since field name is actually the message name - } - - case text.TypeName: - // Handle extensions only. This code path is not for Any. - xt, xtErr = d.findExtension(pref.FullName(tok.TypeName())) - - case text.FieldNumber: - isFieldNumberName = true - num := pref.FieldNumber(tok.FieldNumber()) - if !num.IsValid() { - return d.newError(tok.Pos(), "invalid field number: %d", num) - } - fd = fieldDescs.ByNumber(num) - if fd == nil { - xt, xtErr = d.opts.Resolver.FindExtensionByNumber(messageDesc.FullName(), num) - } - } - - if xt != nil { - fd = xt.TypeDescriptor() - if !messageDesc.ExtensionRanges().Has(fd.Number()) || fd.ContainingMessage().FullName() != messageDesc.FullName() { - return d.newError(tok.Pos(), "message %v cannot be extended by %v", messageDesc.FullName(), fd.FullName()) - } - } else if xtErr != nil && xtErr != protoregistry.NotFound { - return d.newError(tok.Pos(), "unable to resolve [%s]: %v", tok.RawString(), xtErr) - } - if flags.ProtoLegacy { - if fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() { - fd = nil // reset since the weak reference is not linked in - } - } - - // Handle unknown fields. - if fd == nil { - if d.opts.DiscardUnknown || messageDesc.ReservedNames().Has(name) { - d.skipValue() - continue - } - return d.newError(tok.Pos(), "unknown field: %v", tok.RawString()) - } - - // Handle fields identified by field number. - if isFieldNumberName { - // TODO: Add an option to permit parsing field numbers. - // - // This requires careful thought as the MarshalOptions.EmitUnknown - // option allows formatting unknown fields as the field number and the - // best-effort textual representation of the field value. In that case, - // it may not be possible to unmarshal the value from a parser that does - // have information about the unknown field. - return d.newError(tok.Pos(), "cannot specify field by number: %v", tok.RawString()) - } - - switch { - case fd.IsList(): - kind := fd.Kind() - if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() { - return d.syntaxError(tok.Pos(), "missing field separator :") - } - - list := m.Mutable(fd).List() - if err := d.unmarshalList(fd, list); err != nil { - return err - } - - case fd.IsMap(): - mmap := m.Mutable(fd).Map() - if err := d.unmarshalMap(fd, mmap); err != nil { - return err - } - - default: - kind := fd.Kind() - if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() { - return d.syntaxError(tok.Pos(), "missing field separator :") - } - - // If field is a oneof, check if it has already been set. - if od := fd.ContainingOneof(); od != nil { - idx := uint64(od.Index()) - if seenOneofs.Has(idx) { - return d.newError(tok.Pos(), "error parsing %q, oneof %v is already set", tok.RawString(), od.FullName()) - } - seenOneofs.Set(idx) - } - - num := uint64(fd.Number()) - if seenNums.Has(num) { - return d.newError(tok.Pos(), "non-repeated field %q is repeated", tok.RawString()) - } - - if err := d.unmarshalSingular(fd, m); err != nil { - return err - } - seenNums.Set(num) - } - } - - return nil -} - -// findExtension returns protoreflect.ExtensionType from the Resolver if found. -func (d decoder) findExtension(xtName pref.FullName) (pref.ExtensionType, error) { - xt, err := d.opts.Resolver.FindExtensionByName(xtName) - if err == nil { - return xt, nil - } - return messageset.FindMessageSetExtension(d.opts.Resolver, xtName) -} - -// unmarshalSingular unmarshals a non-repeated field value specified by the -// given FieldDescriptor. -func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error { - var val pref.Value - var err error - switch fd.Kind() { - case pref.MessageKind, pref.GroupKind: - val = m.NewField(fd) - err = d.unmarshalMessage(val.Message(), true) - default: - val, err = d.unmarshalScalar(fd) - } - if err == nil { - m.Set(fd, val) - } - return err -} - -// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the -// given FieldDescriptor. -func (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) { - tok, err := d.Read() - if err != nil { - return pref.Value{}, err - } - - if tok.Kind() != text.Scalar { - return pref.Value{}, d.unexpectedTokenError(tok) - } - - kind := fd.Kind() - switch kind { - case pref.BoolKind: - if b, ok := tok.Bool(); ok { - return pref.ValueOfBool(b), nil - } - - case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind: - if n, ok := tok.Int32(); ok { - return pref.ValueOfInt32(n), nil - } - - case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind: - if n, ok := tok.Int64(); ok { - return pref.ValueOfInt64(n), nil - } - - case pref.Uint32Kind, pref.Fixed32Kind: - if n, ok := tok.Uint32(); ok { - return pref.ValueOfUint32(n), nil - } - - case pref.Uint64Kind, pref.Fixed64Kind: - if n, ok := tok.Uint64(); ok { - return pref.ValueOfUint64(n), nil - } - - case pref.FloatKind: - if n, ok := tok.Float32(); ok { - return pref.ValueOfFloat32(n), nil - } - - case pref.DoubleKind: - if n, ok := tok.Float64(); ok { - return pref.ValueOfFloat64(n), nil - } - - case pref.StringKind: - if s, ok := tok.String(); ok { - if strs.EnforceUTF8(fd) && !utf8.ValidString(s) { - return pref.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8") - } - return pref.ValueOfString(s), nil - } - - case pref.BytesKind: - if b, ok := tok.String(); ok { - return pref.ValueOfBytes([]byte(b)), nil - } - - case pref.EnumKind: - if lit, ok := tok.Enum(); ok { - // Lookup EnumNumber based on name. - if enumVal := fd.Enum().Values().ByName(pref.Name(lit)); enumVal != nil { - return pref.ValueOfEnum(enumVal.Number()), nil - } - } - if num, ok := tok.Int32(); ok { - return pref.ValueOfEnum(pref.EnumNumber(num)), nil - } - - default: - panic(fmt.Sprintf("invalid scalar kind %v", kind)) - } - - return pref.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString()) -} - -// unmarshalList unmarshals into given protoreflect.List. A list value can -// either be in [] syntax or simply just a single scalar/message value. -func (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error { - tok, err := d.Peek() - if err != nil { - return err - } - - switch fd.Kind() { - case pref.MessageKind, pref.GroupKind: - switch tok.Kind() { - case text.ListOpen: - d.Read() - for { - tok, err := d.Peek() - if err != nil { - return err - } - - switch tok.Kind() { - case text.ListClose: - d.Read() - return nil - case text.MessageOpen: - pval := list.NewElement() - if err := d.unmarshalMessage(pval.Message(), true); err != nil { - return err - } - list.Append(pval) - default: - return d.unexpectedTokenError(tok) - } - } - - case text.MessageOpen: - pval := list.NewElement() - if err := d.unmarshalMessage(pval.Message(), true); err != nil { - return err - } - list.Append(pval) - return nil - } - - default: - switch tok.Kind() { - case text.ListOpen: - d.Read() - for { - tok, err := d.Peek() - if err != nil { - return err - } - - switch tok.Kind() { - case text.ListClose: - d.Read() - return nil - case text.Scalar: - pval, err := d.unmarshalScalar(fd) - if err != nil { - return err - } - list.Append(pval) - default: - return d.unexpectedTokenError(tok) - } - } - - case text.Scalar: - pval, err := d.unmarshalScalar(fd) - if err != nil { - return err - } - list.Append(pval) - return nil - } - } - - return d.unexpectedTokenError(tok) -} - -// unmarshalMap unmarshals into given protoreflect.Map. A map value is a -// textproto message containing {key: , value: }. -func (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error { - // Determine ahead whether map entry is a scalar type or a message type in - // order to call the appropriate unmarshalMapValue func inside - // unmarshalMapEntry. - var unmarshalMapValue func() (pref.Value, error) - switch fd.MapValue().Kind() { - case pref.MessageKind, pref.GroupKind: - unmarshalMapValue = func() (pref.Value, error) { - pval := mmap.NewValue() - if err := d.unmarshalMessage(pval.Message(), true); err != nil { - return pref.Value{}, err - } - return pval, nil - } - default: - unmarshalMapValue = func() (pref.Value, error) { - return d.unmarshalScalar(fd.MapValue()) - } - } - - tok, err := d.Read() - if err != nil { - return err - } - switch tok.Kind() { - case text.MessageOpen: - return d.unmarshalMapEntry(fd, mmap, unmarshalMapValue) - - case text.ListOpen: - for { - tok, err := d.Read() - if err != nil { - return err - } - switch tok.Kind() { - case text.ListClose: - return nil - case text.MessageOpen: - if err := d.unmarshalMapEntry(fd, mmap, unmarshalMapValue); err != nil { - return err - } - default: - return d.unexpectedTokenError(tok) - } - } - - default: - return d.unexpectedTokenError(tok) - } -} - -// unmarshalMap unmarshals into given protoreflect.Map. A map value is a -// textproto message containing {key: , value: }. -func (d decoder) unmarshalMapEntry(fd pref.FieldDescriptor, mmap pref.Map, unmarshalMapValue func() (pref.Value, error)) error { - var key pref.MapKey - var pval pref.Value -Loop: - for { - // Read field name. - tok, err := d.Read() - if err != nil { - return err - } - switch tok.Kind() { - case text.Name: - if tok.NameKind() != text.IdentName { - if !d.opts.DiscardUnknown { - return d.newError(tok.Pos(), "unknown map entry field %q", tok.RawString()) - } - d.skipValue() - continue Loop - } - // Continue below. - case text.MessageClose: - break Loop - default: - return d.unexpectedTokenError(tok) - } - - switch name := pref.Name(tok.IdentName()); name { - case genid.MapEntry_Key_field_name: - if !tok.HasSeparator() { - return d.syntaxError(tok.Pos(), "missing field separator :") - } - if key.IsValid() { - return d.newError(tok.Pos(), "map entry %q cannot be repeated", name) - } - val, err := d.unmarshalScalar(fd.MapKey()) - if err != nil { - return err - } - key = val.MapKey() - - case genid.MapEntry_Value_field_name: - if kind := fd.MapValue().Kind(); (kind != pref.MessageKind) && (kind != pref.GroupKind) { - if !tok.HasSeparator() { - return d.syntaxError(tok.Pos(), "missing field separator :") - } - } - if pval.IsValid() { - return d.newError(tok.Pos(), "map entry %q cannot be repeated", name) - } - pval, err = unmarshalMapValue() - if err != nil { - return err - } - - default: - if !d.opts.DiscardUnknown { - return d.newError(tok.Pos(), "unknown map entry field %q", name) - } - d.skipValue() - } - } - - if !key.IsValid() { - key = fd.MapKey().Default().MapKey() - } - if !pval.IsValid() { - switch fd.MapValue().Kind() { - case pref.MessageKind, pref.GroupKind: - // If value field is not set for message/group types, construct an - // empty one as default. - pval = mmap.NewValue() - default: - pval = fd.MapValue().Default() - } - } - mmap.Set(key, pval) - return nil -} - -// unmarshalAny unmarshals an Any textproto. It can either be in expanded form -// or non-expanded form. -func (d decoder) unmarshalAny(m pref.Message, checkDelims bool) error { - var typeURL string - var bValue []byte - var seenTypeUrl bool - var seenValue bool - var isExpanded bool - - if checkDelims { - tok, err := d.Read() - if err != nil { - return err - } - - if tok.Kind() != text.MessageOpen { - return d.unexpectedTokenError(tok) - } - } - -Loop: - for { - // Read field name. Can only have 3 possible field names, i.e. type_url, - // value and type URL name inside []. - tok, err := d.Read() - if err != nil { - return err - } - if typ := tok.Kind(); typ != text.Name { - if checkDelims { - if typ == text.MessageClose { - break Loop - } - } else if typ == text.EOF { - break Loop - } - return d.unexpectedTokenError(tok) - } - - switch tok.NameKind() { - case text.IdentName: - // Both type_url and value fields require field separator :. - if !tok.HasSeparator() { - return d.syntaxError(tok.Pos(), "missing field separator :") - } - - switch name := pref.Name(tok.IdentName()); name { - case genid.Any_TypeUrl_field_name: - if seenTypeUrl { - return d.newError(tok.Pos(), "duplicate %v field", genid.Any_TypeUrl_field_fullname) - } - if isExpanded { - return d.newError(tok.Pos(), "conflict with [%s] field", typeURL) - } - tok, err := d.Read() - if err != nil { - return err - } - var ok bool - typeURL, ok = tok.String() - if !ok { - return d.newError(tok.Pos(), "invalid %v field value: %v", genid.Any_TypeUrl_field_fullname, tok.RawString()) - } - seenTypeUrl = true - - case genid.Any_Value_field_name: - if seenValue { - return d.newError(tok.Pos(), "duplicate %v field", genid.Any_Value_field_fullname) - } - if isExpanded { - return d.newError(tok.Pos(), "conflict with [%s] field", typeURL) - } - tok, err := d.Read() - if err != nil { - return err - } - s, ok := tok.String() - if !ok { - return d.newError(tok.Pos(), "invalid %v field value: %v", genid.Any_Value_field_fullname, tok.RawString()) - } - bValue = []byte(s) - seenValue = true - - default: - if !d.opts.DiscardUnknown { - return d.newError(tok.Pos(), "invalid field name %q in %v message", tok.RawString(), genid.Any_message_fullname) - } - } - - case text.TypeName: - if isExpanded { - return d.newError(tok.Pos(), "cannot have more than one type") - } - if seenTypeUrl { - return d.newError(tok.Pos(), "conflict with type_url field") - } - typeURL = tok.TypeName() - var err error - bValue, err = d.unmarshalExpandedAny(typeURL, tok.Pos()) - if err != nil { - return err - } - isExpanded = true - - default: - if !d.opts.DiscardUnknown { - return d.newError(tok.Pos(), "invalid field name %q in %v message", tok.RawString(), genid.Any_message_fullname) - } - } - } - - fds := m.Descriptor().Fields() - if len(typeURL) > 0 { - m.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), pref.ValueOfString(typeURL)) - } - if len(bValue) > 0 { - m.Set(fds.ByNumber(genid.Any_Value_field_number), pref.ValueOfBytes(bValue)) - } - return nil -} - -func (d decoder) unmarshalExpandedAny(typeURL string, pos int) ([]byte, error) { - mt, err := d.opts.Resolver.FindMessageByURL(typeURL) - if err != nil { - return nil, d.newError(pos, "unable to resolve message [%v]: %v", typeURL, err) - } - // Create new message for the embedded message type and unmarshal the value - // field into it. - m := mt.New() - if err := d.unmarshalMessage(m, true); err != nil { - return nil, err - } - // Serialize the embedded message and return the resulting bytes. - b, err := proto.MarshalOptions{ - AllowPartial: true, // Never check required fields inside an Any. - Deterministic: true, - }.Marshal(m.Interface()) - if err != nil { - return nil, d.newError(pos, "error in marshaling message into Any.value: %v", err) - } - return b, nil -} - -// skipValue makes the decoder parse a field value in order to advance the read -// to the next field. It relies on Read returning an error if the types are not -// in valid sequence. -func (d decoder) skipValue() error { - tok, err := d.Read() - if err != nil { - return err - } - // Only need to continue reading for messages and lists. - switch tok.Kind() { - case text.MessageOpen: - return d.skipMessageValue() - - case text.ListOpen: - for { - tok, err := d.Read() - if err != nil { - return err - } - switch tok.Kind() { - case text.ListClose: - return nil - case text.MessageOpen: - return d.skipMessageValue() - default: - // Skip items. This will not validate whether skipped values are - // of the same type or not, same behavior as C++ - // TextFormat::Parser::AllowUnknownField(true) version 3.8.0. - if err := d.skipValue(); err != nil { - return err - } - } - } - } - return nil -} - -// skipMessageValue makes the decoder parse and skip over all fields in a -// message. It assumes that the previous read type is MessageOpen. -func (d decoder) skipMessageValue() error { - for { - tok, err := d.Read() - if err != nil { - return err - } - switch tok.Kind() { - case text.MessageClose: - return nil - case text.Name: - if err := d.skipValue(); err != nil { - return err - } - } - } -} diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/doc.go b/vendor/google.golang.org/protobuf/encoding/prototext/doc.go deleted file mode 100644 index 162b4f98a..000000000 --- a/vendor/google.golang.org/protobuf/encoding/prototext/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package prototext marshals and unmarshals protocol buffer messages as the -// textproto format. -package prototext diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go deleted file mode 100644 index 0877d71c5..000000000 --- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package prototext - -import ( - "fmt" - "sort" - "strconv" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/encoding/text" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/mapsort" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/proto" - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const defaultIndent = " " - -// Format formats the message as a multiline string. -// This function is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. -func Format(m proto.Message) string { - return MarshalOptions{Multiline: true}.Format(m) -} - -// Marshal writes the given proto.Message in textproto format using default -// options. Do not depend on the output being stable. It may change over time -// across different versions of the program. -func Marshal(m proto.Message) ([]byte, error) { - return MarshalOptions{}.Marshal(m) -} - -// MarshalOptions is a configurable text format marshaler. -type MarshalOptions struct { - pragma.NoUnkeyedLiterals - - // Multiline specifies whether the marshaler should format the output in - // indented-form with every textual element on a new line. - // If Indent is an empty string, then an arbitrary indent is chosen. - Multiline bool - - // Indent specifies the set of indentation characters to use in a multiline - // formatted output such that every entry is preceded by Indent and - // terminated by a newline. If non-empty, then Multiline is treated as true. - // Indent can only be composed of space or tab characters. - Indent string - - // EmitASCII specifies whether to format strings and bytes as ASCII only - // as opposed to using UTF-8 encoding when possible. - EmitASCII bool - - // allowInvalidUTF8 specifies whether to permit the encoding of strings - // with invalid UTF-8. This is unexported as it is intended to only - // be specified by the Format method. - allowInvalidUTF8 bool - - // AllowPartial allows messages that have missing required fields to marshal - // without returning an error. If AllowPartial is false (the default), - // Marshal will return error if there are any missing required fields. - AllowPartial bool - - // EmitUnknown specifies whether to emit unknown fields in the output. - // If specified, the unmarshaler may be unable to parse the output. - // The default is to exclude unknown fields. - EmitUnknown bool - - // Resolver is used for looking up types when expanding google.protobuf.Any - // messages. If nil, this defaults to using protoregistry.GlobalTypes. - Resolver interface { - protoregistry.ExtensionTypeResolver - protoregistry.MessageTypeResolver - } -} - -// Format formats the message as a string. -// This method is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. -func (o MarshalOptions) Format(m proto.Message) string { - if m == nil || !m.ProtoReflect().IsValid() { - return "" // invalid syntax, but okay since this is for debugging - } - o.allowInvalidUTF8 = true - o.AllowPartial = true - o.EmitUnknown = true - b, _ := o.Marshal(m) - return string(b) -} - -// Marshal writes the given proto.Message in textproto format using options in -// MarshalOptions object. Do not depend on the output being stable. It may -// change over time across different versions of the program. -func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { - return o.marshal(m) -} - -// marshal is a centralized function that all marshal operations go through. -// For profiling purposes, avoid changing the name of this function or -// introducing other code paths for marshal that do not go through this. -func (o MarshalOptions) marshal(m proto.Message) ([]byte, error) { - var delims = [2]byte{'{', '}'} - - if o.Multiline && o.Indent == "" { - o.Indent = defaultIndent - } - if o.Resolver == nil { - o.Resolver = protoregistry.GlobalTypes - } - - internalEnc, err := text.NewEncoder(o.Indent, delims, o.EmitASCII) - if err != nil { - return nil, err - } - - // Treat nil message interface as an empty message, - // in which case there is nothing to output. - if m == nil { - return []byte{}, nil - } - - enc := encoder{internalEnc, o} - err = enc.marshalMessage(m.ProtoReflect(), false) - if err != nil { - return nil, err - } - out := enc.Bytes() - if len(o.Indent) > 0 && len(out) > 0 { - out = append(out, '\n') - } - if o.AllowPartial { - return out, nil - } - return out, proto.CheckInitialized(m) -} - -type encoder struct { - *text.Encoder - opts MarshalOptions -} - -// marshalMessage marshals the given protoreflect.Message. -func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error { - messageDesc := m.Descriptor() - if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) { - return errors.New("no support for proto1 MessageSets") - } - - if inclDelims { - e.StartMessage() - defer e.EndMessage() - } - - // Handle Any expansion. - if messageDesc.FullName() == genid.Any_message_fullname { - if e.marshalAny(m) { - return nil - } - // If unable to expand, continue on to marshal Any as a regular message. - } - - // Marshal known fields. - fieldDescs := messageDesc.Fields() - size := fieldDescs.Len() - for i := 0; i < size; { - fd := fieldDescs.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - } else { - i++ - } - - if fd == nil || !m.Has(fd) { - continue - } - - name := fd.Name() - // Use type name for group field name. - if fd.Kind() == pref.GroupKind { - name = fd.Message().Name() - } - val := m.Get(fd) - if err := e.marshalField(string(name), val, fd); err != nil { - return err - } - } - - // Marshal extensions. - if err := e.marshalExtensions(m); err != nil { - return err - } - - // Marshal unknown fields. - if e.opts.EmitUnknown { - e.marshalUnknown(m.GetUnknown()) - } - - return nil -} - -// marshalField marshals the given field with protoreflect.Value. -func (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescriptor) error { - switch { - case fd.IsList(): - return e.marshalList(name, val.List(), fd) - case fd.IsMap(): - return e.marshalMap(name, val.Map(), fd) - default: - e.WriteName(name) - return e.marshalSingular(val, fd) - } -} - -// marshalSingular marshals the given non-repeated field value. This includes -// all scalar types, enums, messages, and groups. -func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error { - kind := fd.Kind() - switch kind { - case pref.BoolKind: - e.WriteBool(val.Bool()) - - case pref.StringKind: - s := val.String() - if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) { - return errors.InvalidUTF8(string(fd.FullName())) - } - e.WriteString(s) - - case pref.Int32Kind, pref.Int64Kind, - pref.Sint32Kind, pref.Sint64Kind, - pref.Sfixed32Kind, pref.Sfixed64Kind: - e.WriteInt(val.Int()) - - case pref.Uint32Kind, pref.Uint64Kind, - pref.Fixed32Kind, pref.Fixed64Kind: - e.WriteUint(val.Uint()) - - case pref.FloatKind: - // Encoder.WriteFloat handles the special numbers NaN and infinites. - e.WriteFloat(val.Float(), 32) - - case pref.DoubleKind: - // Encoder.WriteFloat handles the special numbers NaN and infinites. - e.WriteFloat(val.Float(), 64) - - case pref.BytesKind: - e.WriteString(string(val.Bytes())) - - case pref.EnumKind: - num := val.Enum() - if desc := fd.Enum().Values().ByNumber(num); desc != nil { - e.WriteLiteral(string(desc.Name())) - } else { - // Use numeric value if there is no enum description. - e.WriteInt(int64(num)) - } - - case pref.MessageKind, pref.GroupKind: - return e.marshalMessage(val.Message(), true) - - default: - panic(fmt.Sprintf("%v has unknown kind: %v", fd.FullName(), kind)) - } - return nil -} - -// marshalList marshals the given protoreflect.List as multiple name-value fields. -func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescriptor) error { - size := list.Len() - for i := 0; i < size; i++ { - e.WriteName(name) - if err := e.marshalSingular(list.Get(i), fd); err != nil { - return err - } - } - return nil -} - -// marshalMap marshals the given protoreflect.Map as multiple name-value fields. -func (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error { - var err error - mapsort.Range(mmap, fd.MapKey().Kind(), func(key pref.MapKey, val pref.Value) bool { - e.WriteName(name) - e.StartMessage() - defer e.EndMessage() - - e.WriteName(string(genid.MapEntry_Key_field_name)) - err = e.marshalSingular(key.Value(), fd.MapKey()) - if err != nil { - return false - } - - e.WriteName(string(genid.MapEntry_Value_field_name)) - err = e.marshalSingular(val, fd.MapValue()) - if err != nil { - return false - } - return true - }) - return err -} - -// marshalExtensions marshals extension fields. -func (e encoder) marshalExtensions(m pref.Message) error { - type entry struct { - key string - value pref.Value - desc pref.FieldDescriptor - } - - // Get a sorted list based on field key first. - var entries []entry - m.Range(func(fd pref.FieldDescriptor, v pref.Value) bool { - if !fd.IsExtension() { - return true - } - // For MessageSet extensions, the name used is the parent message. - name := fd.FullName() - if messageset.IsMessageSetExtension(fd) { - name = name.Parent() - } - entries = append(entries, entry{ - key: string(name), - value: v, - desc: fd, - }) - return true - }) - // Sort extensions lexicographically. - sort.Slice(entries, func(i, j int) bool { - return entries[i].key < entries[j].key - }) - - // Write out sorted list. - for _, entry := range entries { - // Extension field name is the proto field name enclosed in []. - name := "[" + entry.key + "]" - if err := e.marshalField(name, entry.value, entry.desc); err != nil { - return err - } - } - return nil -} - -// marshalUnknown parses the given []byte and marshals fields out. -// This function assumes proper encoding in the given []byte. -func (e encoder) marshalUnknown(b []byte) { - const dec = 10 - const hex = 16 - for len(b) > 0 { - num, wtype, n := protowire.ConsumeTag(b) - b = b[n:] - e.WriteName(strconv.FormatInt(int64(num), dec)) - - switch wtype { - case protowire.VarintType: - var v uint64 - v, n = protowire.ConsumeVarint(b) - e.WriteUint(v) - case protowire.Fixed32Type: - var v uint32 - v, n = protowire.ConsumeFixed32(b) - e.WriteLiteral("0x" + strconv.FormatUint(uint64(v), hex)) - case protowire.Fixed64Type: - var v uint64 - v, n = protowire.ConsumeFixed64(b) - e.WriteLiteral("0x" + strconv.FormatUint(v, hex)) - case protowire.BytesType: - var v []byte - v, n = protowire.ConsumeBytes(b) - e.WriteString(string(v)) - case protowire.StartGroupType: - e.StartMessage() - var v []byte - v, n = protowire.ConsumeGroup(num, b) - e.marshalUnknown(v) - e.EndMessage() - default: - panic(fmt.Sprintf("prototext: error parsing unknown field wire type: %v", wtype)) - } - - b = b[n:] - } -} - -// marshalAny marshals the given google.protobuf.Any message in expanded form. -// It returns true if it was able to marshal, else false. -func (e encoder) marshalAny(any pref.Message) bool { - // Construct the embedded message. - fds := any.Descriptor().Fields() - fdType := fds.ByNumber(genid.Any_TypeUrl_field_number) - typeURL := any.Get(fdType).String() - mt, err := e.opts.Resolver.FindMessageByURL(typeURL) - if err != nil { - return false - } - m := mt.New().Interface() - - // Unmarshal bytes into embedded message. - fdValue := fds.ByNumber(genid.Any_Value_field_number) - value := any.Get(fdValue) - err = proto.UnmarshalOptions{ - AllowPartial: true, - Resolver: e.opts.Resolver, - }.Unmarshal(value.Bytes(), m) - if err != nil { - return false - } - - // Get current encoder position. If marshaling fails, reset encoder output - // back to this position. - pos := e.Snapshot() - - // Field name is the proto field name enclosed in []. - e.WriteName("[" + typeURL + "]") - err = e.marshalMessage(m.ProtoReflect(), true) - if err != nil { - e.Reset(pos) - return false - } - return true -} diff --git a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go deleted file mode 100644 index a427f8b70..000000000 --- a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +++ /dev/null @@ -1,538 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package protowire parses and formats the raw wire encoding. -// See https://developers.google.com/protocol-buffers/docs/encoding. -// -// For marshaling and unmarshaling entire protobuf messages, -// use the "google.golang.org/protobuf/proto" package instead. -package protowire - -import ( - "io" - "math" - "math/bits" - - "google.golang.org/protobuf/internal/errors" -) - -// Number represents the field number. -type Number int32 - -const ( - MinValidNumber Number = 1 - FirstReservedNumber Number = 19000 - LastReservedNumber Number = 19999 - MaxValidNumber Number = 1<<29 - 1 -) - -// IsValid reports whether the field number is semantically valid. -// -// Note that while numbers within the reserved range are semantically invalid, -// they are syntactically valid in the wire format. -// Implementations may treat records with reserved field numbers as unknown. -func (n Number) IsValid() bool { - return MinValidNumber <= n && n < FirstReservedNumber || LastReservedNumber < n && n <= MaxValidNumber -} - -// Type represents the wire type. -type Type int8 - -const ( - VarintType Type = 0 - Fixed32Type Type = 5 - Fixed64Type Type = 1 - BytesType Type = 2 - StartGroupType Type = 3 - EndGroupType Type = 4 -) - -const ( - _ = -iota - errCodeTruncated - errCodeFieldNumber - errCodeOverflow - errCodeReserved - errCodeEndGroup -) - -var ( - errFieldNumber = errors.New("invalid field number") - errOverflow = errors.New("variable length integer overflow") - errReserved = errors.New("cannot parse reserved wire type") - errEndGroup = errors.New("mismatching end group marker") - errParse = errors.New("parse error") -) - -// ParseError converts an error code into an error value. -// This returns nil if n is a non-negative number. -func ParseError(n int) error { - if n >= 0 { - return nil - } - switch n { - case errCodeTruncated: - return io.ErrUnexpectedEOF - case errCodeFieldNumber: - return errFieldNumber - case errCodeOverflow: - return errOverflow - case errCodeReserved: - return errReserved - case errCodeEndGroup: - return errEndGroup - default: - return errParse - } -} - -// ConsumeField parses an entire field record (both tag and value) and returns -// the field number, the wire type, and the total length. -// This returns a negative length upon an error (see ParseError). -// -// The total length includes the tag header and the end group marker (if the -// field is a group). -func ConsumeField(b []byte) (Number, Type, int) { - num, typ, n := ConsumeTag(b) - if n < 0 { - return 0, 0, n // forward error code - } - m := ConsumeFieldValue(num, typ, b[n:]) - if m < 0 { - return 0, 0, m // forward error code - } - return num, typ, n + m -} - -// ConsumeFieldValue parses a field value and returns its length. -// This assumes that the field Number and wire Type have already been parsed. -// This returns a negative length upon an error (see ParseError). -// -// When parsing a group, the length includes the end group marker and -// the end group is verified to match the starting field number. -func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) { - switch typ { - case VarintType: - _, n = ConsumeVarint(b) - return n - case Fixed32Type: - _, n = ConsumeFixed32(b) - return n - case Fixed64Type: - _, n = ConsumeFixed64(b) - return n - case BytesType: - _, n = ConsumeBytes(b) - return n - case StartGroupType: - n0 := len(b) - for { - num2, typ2, n := ConsumeTag(b) - if n < 0 { - return n // forward error code - } - b = b[n:] - if typ2 == EndGroupType { - if num != num2 { - return errCodeEndGroup - } - return n0 - len(b) - } - - n = ConsumeFieldValue(num2, typ2, b) - if n < 0 { - return n // forward error code - } - b = b[n:] - } - case EndGroupType: - return errCodeEndGroup - default: - return errCodeReserved - } -} - -// AppendTag encodes num and typ as a varint-encoded tag and appends it to b. -func AppendTag(b []byte, num Number, typ Type) []byte { - return AppendVarint(b, EncodeTag(num, typ)) -} - -// ConsumeTag parses b as a varint-encoded tag, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeTag(b []byte) (Number, Type, int) { - v, n := ConsumeVarint(b) - if n < 0 { - return 0, 0, n // forward error code - } - num, typ := DecodeTag(v) - if num < MinValidNumber { - return 0, 0, errCodeFieldNumber - } - return num, typ, n -} - -func SizeTag(num Number) int { - return SizeVarint(EncodeTag(num, 0)) // wire type has no effect on size -} - -// AppendVarint appends v to b as a varint-encoded uint64. -func AppendVarint(b []byte, v uint64) []byte { - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte((v>>0)&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -// ConsumeVarint parses b as a varint-encoded uint64, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeVarint(b []byte) (v uint64, n int) { - var y uint64 - if len(b) <= 0 { - return 0, errCodeTruncated - } - v = uint64(b[0]) - if v < 0x80 { - return v, 1 - } - v -= 0x80 - - if len(b) <= 1 { - return 0, errCodeTruncated - } - y = uint64(b[1]) - v += y << 7 - if y < 0x80 { - return v, 2 - } - v -= 0x80 << 7 - - if len(b) <= 2 { - return 0, errCodeTruncated - } - y = uint64(b[2]) - v += y << 14 - if y < 0x80 { - return v, 3 - } - v -= 0x80 << 14 - - if len(b) <= 3 { - return 0, errCodeTruncated - } - y = uint64(b[3]) - v += y << 21 - if y < 0x80 { - return v, 4 - } - v -= 0x80 << 21 - - if len(b) <= 4 { - return 0, errCodeTruncated - } - y = uint64(b[4]) - v += y << 28 - if y < 0x80 { - return v, 5 - } - v -= 0x80 << 28 - - if len(b) <= 5 { - return 0, errCodeTruncated - } - y = uint64(b[5]) - v += y << 35 - if y < 0x80 { - return v, 6 - } - v -= 0x80 << 35 - - if len(b) <= 6 { - return 0, errCodeTruncated - } - y = uint64(b[6]) - v += y << 42 - if y < 0x80 { - return v, 7 - } - v -= 0x80 << 42 - - if len(b) <= 7 { - return 0, errCodeTruncated - } - y = uint64(b[7]) - v += y << 49 - if y < 0x80 { - return v, 8 - } - v -= 0x80 << 49 - - if len(b) <= 8 { - return 0, errCodeTruncated - } - y = uint64(b[8]) - v += y << 56 - if y < 0x80 { - return v, 9 - } - v -= 0x80 << 56 - - if len(b) <= 9 { - return 0, errCodeTruncated - } - y = uint64(b[9]) - v += y << 63 - if y < 2 { - return v, 10 - } - return 0, errCodeOverflow -} - -// SizeVarint returns the encoded size of a varint. -// The size is guaranteed to be within 1 and 10, inclusive. -func SizeVarint(v uint64) int { - // This computes 1 + (bits.Len64(v)-1)/7. - // 9/64 is a good enough approximation of 1/7 - return int(9*uint32(bits.Len64(v))+64) / 64 -} - -// AppendFixed32 appends v to b as a little-endian uint32. -func AppendFixed32(b []byte, v uint32) []byte { - return append(b, - byte(v>>0), - byte(v>>8), - byte(v>>16), - byte(v>>24)) -} - -// ConsumeFixed32 parses b as a little-endian uint32, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeFixed32(b []byte) (v uint32, n int) { - if len(b) < 4 { - return 0, errCodeTruncated - } - v = uint32(b[0])<<0 | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - return v, 4 -} - -// SizeFixed32 returns the encoded size of a fixed32; which is always 4. -func SizeFixed32() int { - return 4 -} - -// AppendFixed64 appends v to b as a little-endian uint64. -func AppendFixed64(b []byte, v uint64) []byte { - return append(b, - byte(v>>0), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) -} - -// ConsumeFixed64 parses b as a little-endian uint64, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeFixed64(b []byte) (v uint64, n int) { - if len(b) < 8 { - return 0, errCodeTruncated - } - v = uint64(b[0])<<0 | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - return v, 8 -} - -// SizeFixed64 returns the encoded size of a fixed64; which is always 8. -func SizeFixed64() int { - return 8 -} - -// AppendBytes appends v to b as a length-prefixed bytes value. -func AppendBytes(b []byte, v []byte) []byte { - return append(AppendVarint(b, uint64(len(v))), v...) -} - -// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeBytes(b []byte) (v []byte, n int) { - m, n := ConsumeVarint(b) - if n < 0 { - return nil, n // forward error code - } - if m > uint64(len(b[n:])) { - return nil, errCodeTruncated - } - return b[n:][:m], n + int(m) -} - -// SizeBytes returns the encoded size of a length-prefixed bytes value, -// given only the length. -func SizeBytes(n int) int { - return SizeVarint(uint64(n)) + n -} - -// AppendString appends v to b as a length-prefixed bytes value. -func AppendString(b []byte, v string) []byte { - return append(AppendVarint(b, uint64(len(v))), v...) -} - -// ConsumeString parses b as a length-prefixed bytes value, reporting its length. -// This returns a negative length upon an error (see ParseError). -func ConsumeString(b []byte) (v string, n int) { - bb, n := ConsumeBytes(b) - return string(bb), n -} - -// AppendGroup appends v to b as group value, with a trailing end group marker. -// The value v must not contain the end marker. -func AppendGroup(b []byte, num Number, v []byte) []byte { - return AppendVarint(append(b, v...), EncodeTag(num, EndGroupType)) -} - -// ConsumeGroup parses b as a group value until the trailing end group marker, -// and verifies that the end marker matches the provided num. The value v -// does not contain the end marker, while the length does contain the end marker. -// This returns a negative length upon an error (see ParseError). -func ConsumeGroup(num Number, b []byte) (v []byte, n int) { - n = ConsumeFieldValue(num, StartGroupType, b) - if n < 0 { - return nil, n // forward error code - } - b = b[:n] - - // Truncate off end group marker, but need to handle denormalized varints. - // Assuming end marker is never 0 (which is always the case since - // EndGroupType is non-zero), we can truncate all trailing bytes where the - // lower 7 bits are all zero (implying that the varint is denormalized). - for len(b) > 0 && b[len(b)-1]&0x7f == 0 { - b = b[:len(b)-1] - } - b = b[:len(b)-SizeTag(num)] - return b, n -} - -// SizeGroup returns the encoded size of a group, given only the length. -func SizeGroup(num Number, n int) int { - return n + SizeTag(num) -} - -// DecodeTag decodes the field Number and wire Type from its unified form. -// The Number is -1 if the decoded field number overflows int32. -// Other than overflow, this does not check for field number validity. -func DecodeTag(x uint64) (Number, Type) { - // NOTE: MessageSet allows for larger field numbers than normal. - if x>>3 > uint64(math.MaxInt32) { - return -1, 0 - } - return Number(x >> 3), Type(x & 7) -} - -// EncodeTag encodes the field Number and wire Type into its unified form. -func EncodeTag(num Number, typ Type) uint64 { - return uint64(num)<<3 | uint64(typ&7) -} - -// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64. -// Input: {…, 5, 3, 1, 0, 2, 4, 6, …} -// Output: {…, -3, -2, -1, 0, +1, +2, +3, …} -func DecodeZigZag(x uint64) int64 { - return int64(x>>1) ^ int64(x)<<63>>63 -} - -// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64. -// Input: {…, -3, -2, -1, 0, +1, +2, +3, …} -// Output: {…, 5, 3, 1, 0, 2, 4, 6, …} -func EncodeZigZag(x int64) uint64 { - return uint64(x<<1) ^ uint64(x>>63) -} - -// DecodeBool decodes a uint64 as a bool. -// Input: { 0, 1, 2, …} -// Output: {false, true, true, …} -func DecodeBool(x uint64) bool { - return x != 0 -} - -// EncodeBool encodes a bool as a uint64. -// Input: {false, true} -// Output: { 0, 1} -func EncodeBool(x bool) uint64 { - if x { - return 1 - } - return 0 -} diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go deleted file mode 100644 index e7af0fe0d..000000000 --- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package descfmt provides functionality to format descriptors. -package descfmt - -import ( - "fmt" - "io" - "reflect" - "strconv" - "strings" - - "google.golang.org/protobuf/internal/detrand" - "google.golang.org/protobuf/internal/pragma" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type list interface { - Len() int - pragma.DoNotImplement -} - -func FormatList(s fmt.State, r rune, vs list) { - io.WriteString(s, formatListOpt(vs, true, r == 'v' && (s.Flag('+') || s.Flag('#')))) -} -func formatListOpt(vs list, isRoot, allowMulti bool) string { - start, end := "[", "]" - if isRoot { - var name string - switch vs.(type) { - case pref.Names: - name = "Names" - case pref.FieldNumbers: - name = "FieldNumbers" - case pref.FieldRanges: - name = "FieldRanges" - case pref.EnumRanges: - name = "EnumRanges" - case pref.FileImports: - name = "FileImports" - case pref.Descriptor: - name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s" - } - start, end = name+"{", "}" - } - - var ss []string - switch vs := vs.(type) { - case pref.Names: - for i := 0; i < vs.Len(); i++ { - ss = append(ss, fmt.Sprint(vs.Get(i))) - } - return start + joinStrings(ss, false) + end - case pref.FieldNumbers: - for i := 0; i < vs.Len(); i++ { - ss = append(ss, fmt.Sprint(vs.Get(i))) - } - return start + joinStrings(ss, false) + end - case pref.FieldRanges: - for i := 0; i < vs.Len(); i++ { - r := vs.Get(i) - if r[0]+1 == r[1] { - ss = append(ss, fmt.Sprintf("%d", r[0])) - } else { - ss = append(ss, fmt.Sprintf("%d:%d", r[0], r[1])) // enum ranges are end exclusive - } - } - return start + joinStrings(ss, false) + end - case pref.EnumRanges: - for i := 0; i < vs.Len(); i++ { - r := vs.Get(i) - if r[0] == r[1] { - ss = append(ss, fmt.Sprintf("%d", r[0])) - } else { - ss = append(ss, fmt.Sprintf("%d:%d", r[0], int64(r[1])+1)) // enum ranges are end inclusive - } - } - return start + joinStrings(ss, false) + end - case pref.FileImports: - for i := 0; i < vs.Len(); i++ { - var rs records - rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak") - ss = append(ss, "{"+rs.Join()+"}") - } - return start + joinStrings(ss, allowMulti) + end - default: - _, isEnumValue := vs.(pref.EnumValueDescriptors) - for i := 0; i < vs.Len(); i++ { - m := reflect.ValueOf(vs).MethodByName("Get") - v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface() - ss = append(ss, formatDescOpt(v.(pref.Descriptor), false, allowMulti && !isEnumValue)) - } - return start + joinStrings(ss, allowMulti && isEnumValue) + end - } -} - -// descriptorAccessors is a list of accessors to print for each descriptor. -// -// Do not print all accessors since some contain redundant information, -// while others are pointers that we do not want to follow since the descriptor -// is actually a cyclic graph. -// -// Using a list allows us to print the accessors in a sensible order. -var descriptorAccessors = map[reflect.Type][]string{ - reflect.TypeOf((*pref.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"}, - reflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"}, - reflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"}, - reflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt - reflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"}, - reflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {"Number"}, - reflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem(): {"Methods"}, - reflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"}, -} - -func FormatDesc(s fmt.State, r rune, t pref.Descriptor) { - io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#')))) -} -func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string { - rv := reflect.ValueOf(t) - rt := rv.MethodByName("ProtoType").Type().In(0) - - start, end := "{", "}" - if isRoot { - start = rt.Name() + "{" - } - - _, isFile := t.(pref.FileDescriptor) - rs := records{allowMulti: allowMulti} - if t.IsPlaceholder() { - if isFile { - rs.Append(rv, "Path", "Package", "IsPlaceholder") - } else { - rs.Append(rv, "FullName", "IsPlaceholder") - } - } else { - switch { - case isFile: - rs.Append(rv, "Syntax") - case isRoot: - rs.Append(rv, "Syntax", "FullName") - default: - rs.Append(rv, "Name") - } - switch t := t.(type) { - case pref.FieldDescriptor: - for _, s := range descriptorAccessors[rt] { - switch s { - case "MapKey": - if k := t.MapKey(); k != nil { - rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()}) - } - case "MapValue": - if v := t.MapValue(); v != nil { - switch v.Kind() { - case pref.EnumKind: - rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())}) - case pref.MessageKind, pref.GroupKind: - rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())}) - default: - rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()}) - } - } - case "ContainingOneof": - if od := t.ContainingOneof(); od != nil { - rs.recs = append(rs.recs, [2]string{"Oneof", string(od.Name())}) - } - case "ContainingMessage": - if t.IsExtension() { - rs.recs = append(rs.recs, [2]string{"Extendee", string(t.ContainingMessage().FullName())}) - } - case "Message": - if !t.IsMap() { - rs.Append(rv, s) - } - default: - rs.Append(rv, s) - } - } - case pref.OneofDescriptor: - var ss []string - fs := t.Fields() - for i := 0; i < fs.Len(); i++ { - ss = append(ss, string(fs.Get(i).Name())) - } - if len(ss) > 0 { - rs.recs = append(rs.recs, [2]string{"Fields", "[" + joinStrings(ss, false) + "]"}) - } - default: - rs.Append(rv, descriptorAccessors[rt]...) - } - if rv.MethodByName("GoType").IsValid() { - rs.Append(rv, "GoType") - } - } - return start + rs.Join() + end -} - -type records struct { - recs [][2]string - allowMulti bool -} - -func (rs *records) Append(v reflect.Value, accessors ...string) { - for _, a := range accessors { - var rv reflect.Value - if m := v.MethodByName(a); m.IsValid() { - rv = m.Call(nil)[0] - } - if v.Kind() == reflect.Struct && !rv.IsValid() { - rv = v.FieldByName(a) - } - if !rv.IsValid() { - panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a)) - } - if _, ok := rv.Interface().(pref.Value); ok { - rv = rv.MethodByName("Interface").Call(nil)[0] - if !rv.IsNil() { - rv = rv.Elem() - } - } - - // Ignore zero values. - var isZero bool - switch rv.Kind() { - case reflect.Interface, reflect.Slice: - isZero = rv.IsNil() - case reflect.Bool: - isZero = rv.Bool() == false - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - isZero = rv.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - isZero = rv.Uint() == 0 - case reflect.String: - isZero = rv.String() == "" - } - if n, ok := rv.Interface().(list); ok { - isZero = n.Len() == 0 - } - if isZero { - continue - } - - // Format the value. - var s string - v := rv.Interface() - switch v := v.(type) { - case list: - s = formatListOpt(v, false, rs.allowMulti) - case pref.FieldDescriptor, pref.OneofDescriptor, pref.EnumValueDescriptor, pref.MethodDescriptor: - s = string(v.(pref.Descriptor).Name()) - case pref.Descriptor: - s = string(v.FullName()) - case string: - s = strconv.Quote(v) - case []byte: - s = fmt.Sprintf("%q", v) - default: - s = fmt.Sprint(v) - } - rs.recs = append(rs.recs, [2]string{a, s}) - } -} - -func (rs *records) Join() string { - var ss []string - - // In single line mode, simply join all records with commas. - if !rs.allowMulti { - for _, r := range rs.recs { - ss = append(ss, r[0]+formatColon(0)+r[1]) - } - return joinStrings(ss, false) - } - - // In allowMulti line mode, align single line records for more readable output. - var maxLen int - flush := func(i int) { - for _, r := range rs.recs[len(ss):i] { - ss = append(ss, r[0]+formatColon(maxLen-len(r[0]))+r[1]) - } - maxLen = 0 - } - for i, r := range rs.recs { - if isMulti := strings.Contains(r[1], "\n"); isMulti { - flush(i) - ss = append(ss, r[0]+formatColon(0)+strings.Join(strings.Split(r[1], "\n"), "\n\t")) - } else if maxLen < len(r[0]) { - maxLen = len(r[0]) - } - } - flush(len(rs.recs)) - return joinStrings(ss, true) -} - -func formatColon(padding int) string { - // Deliberately introduce instability into the debug output to - // discourage users from performing string comparisons. - // This provides us flexibility to change the output in the future. - if detrand.Bool() { - return ":" + strings.Repeat(" ", 1+padding) // use non-breaking spaces (U+00a0) - } else { - return ":" + strings.Repeat(" ", 1+padding) // use regular spaces (U+0020) - } -} - -func joinStrings(ss []string, isMulti bool) string { - if len(ss) == 0 { - return "" - } - if isMulti { - return "\n\t" + strings.Join(ss, "\n\t") + "\n" - } - return strings.Join(ss, ", ") -} diff --git a/vendor/google.golang.org/protobuf/internal/descopts/options.go b/vendor/google.golang.org/protobuf/internal/descopts/options.go deleted file mode 100644 index 8401be8c8..000000000 --- a/vendor/google.golang.org/protobuf/internal/descopts/options.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package descopts contains the nil pointers to concrete descriptor options. -// -// This package exists as a form of reverse dependency injection so that certain -// packages (e.g., internal/filedesc and internal/filetype can avoid a direct -// dependency on the descriptor proto package). -package descopts - -import pref "google.golang.org/protobuf/reflect/protoreflect" - -// These variables are set by the init function in descriptor.pb.go via logic -// in internal/filetype. In other words, so long as the descriptor proto package -// is linked in, these variables will be populated. -// -// Each variable is populated with a nil pointer to the options struct. -var ( - File pref.ProtoMessage - Enum pref.ProtoMessage - EnumValue pref.ProtoMessage - Message pref.ProtoMessage - Field pref.ProtoMessage - Oneof pref.ProtoMessage - ExtensionRange pref.ProtoMessage - Service pref.ProtoMessage - Method pref.ProtoMessage -) diff --git a/vendor/google.golang.org/protobuf/internal/detrand/rand.go b/vendor/google.golang.org/protobuf/internal/detrand/rand.go deleted file mode 100644 index a904dd1f9..000000000 --- a/vendor/google.golang.org/protobuf/internal/detrand/rand.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package detrand provides deterministically random functionality. -// -// The pseudo-randomness of these functions is seeded by the program binary -// itself and guarantees that the output does not change within a program, -// while ensuring that the output is unstable across different builds. -package detrand - -import ( - "encoding/binary" - "hash/fnv" - "os" -) - -// Disable disables detrand such that all functions returns the zero value. -// This function is not concurrent-safe and must be called during program init. -func Disable() { - randSeed = 0 -} - -// Bool returns a deterministically random boolean. -func Bool() bool { - return randSeed%2 == 1 -} - -// randSeed is a best-effort at an approximate hash of the Go binary. -var randSeed = binaryHash() - -func binaryHash() uint64 { - // Open the Go binary. - s, err := os.Executable() - if err != nil { - return 0 - } - f, err := os.Open(s) - if err != nil { - return 0 - } - defer f.Close() - - // Hash the size and several samples of the Go binary. - const numSamples = 8 - var buf [64]byte - h := fnv.New64() - fi, err := f.Stat() - if err != nil { - return 0 - } - binary.LittleEndian.PutUint64(buf[:8], uint64(fi.Size())) - h.Write(buf[:8]) - for i := int64(0); i < numSamples; i++ { - if _, err := f.ReadAt(buf[:], i*fi.Size()/numSamples); err != nil { - return 0 - } - h.Write(buf[:]) - } - return h.Sum64() -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go b/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go deleted file mode 100644 index fdd9b13f2..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package defval marshals and unmarshals textual forms of default values. -// -// This package handles both the form historically used in Go struct field tags -// and also the form used by google.protobuf.FieldDescriptorProto.default_value -// since they differ in superficial ways. -package defval - -import ( - "fmt" - "math" - "strconv" - - ptext "google.golang.org/protobuf/internal/encoding/text" - errors "google.golang.org/protobuf/internal/errors" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// Format is the serialization format used to represent the default value. -type Format int - -const ( - _ Format = iota - - // Descriptor uses the serialization format that protoc uses with the - // google.protobuf.FieldDescriptorProto.default_value field. - Descriptor - - // GoTag uses the historical serialization format in Go struct field tags. - GoTag -) - -// Unmarshal deserializes the default string s according to the given kind k. -// When k is an enum, a list of enum value descriptors must be provided. -func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error) { - switch k { - case pref.BoolKind: - if f == GoTag { - switch s { - case "1": - return pref.ValueOfBool(true), nil, nil - case "0": - return pref.ValueOfBool(false), nil, nil - } - } else { - switch s { - case "true": - return pref.ValueOfBool(true), nil, nil - case "false": - return pref.ValueOfBool(false), nil, nil - } - } - case pref.EnumKind: - if f == GoTag { - // Go tags use the numeric form of the enum value. - if n, err := strconv.ParseInt(s, 10, 32); err == nil { - if ev := evs.ByNumber(pref.EnumNumber(n)); ev != nil { - return pref.ValueOfEnum(ev.Number()), ev, nil - } - } - } else { - // Descriptor default_value use the enum identifier. - ev := evs.ByName(pref.Name(s)) - if ev != nil { - return pref.ValueOfEnum(ev.Number()), ev, nil - } - } - case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind: - if v, err := strconv.ParseInt(s, 10, 32); err == nil { - return pref.ValueOfInt32(int32(v)), nil, nil - } - case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind: - if v, err := strconv.ParseInt(s, 10, 64); err == nil { - return pref.ValueOfInt64(int64(v)), nil, nil - } - case pref.Uint32Kind, pref.Fixed32Kind: - if v, err := strconv.ParseUint(s, 10, 32); err == nil { - return pref.ValueOfUint32(uint32(v)), nil, nil - } - case pref.Uint64Kind, pref.Fixed64Kind: - if v, err := strconv.ParseUint(s, 10, 64); err == nil { - return pref.ValueOfUint64(uint64(v)), nil, nil - } - case pref.FloatKind, pref.DoubleKind: - var v float64 - var err error - switch s { - case "-inf": - v = math.Inf(-1) - case "inf": - v = math.Inf(+1) - case "nan": - v = math.NaN() - default: - v, err = strconv.ParseFloat(s, 64) - } - if err == nil { - if k == pref.FloatKind { - return pref.ValueOfFloat32(float32(v)), nil, nil - } else { - return pref.ValueOfFloat64(float64(v)), nil, nil - } - } - case pref.StringKind: - // String values are already unescaped and can be used as is. - return pref.ValueOfString(s), nil, nil - case pref.BytesKind: - if b, ok := unmarshalBytes(s); ok { - return pref.ValueOfBytes(b), nil, nil - } - } - return pref.Value{}, nil, errors.New("could not parse value for %v: %q", k, s) -} - -// Marshal serializes v as the default string according to the given kind k. -// When specifying the Descriptor format for an enum kind, the associated -// enum value descriptor must be provided. -func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error) { - switch k { - case pref.BoolKind: - if f == GoTag { - if v.Bool() { - return "1", nil - } else { - return "0", nil - } - } else { - if v.Bool() { - return "true", nil - } else { - return "false", nil - } - } - case pref.EnumKind: - if f == GoTag { - return strconv.FormatInt(int64(v.Enum()), 10), nil - } else { - return string(ev.Name()), nil - } - case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind: - return strconv.FormatInt(v.Int(), 10), nil - case pref.Uint32Kind, pref.Fixed32Kind, pref.Uint64Kind, pref.Fixed64Kind: - return strconv.FormatUint(v.Uint(), 10), nil - case pref.FloatKind, pref.DoubleKind: - f := v.Float() - switch { - case math.IsInf(f, -1): - return "-inf", nil - case math.IsInf(f, +1): - return "inf", nil - case math.IsNaN(f): - return "nan", nil - default: - if k == pref.FloatKind { - return strconv.FormatFloat(f, 'g', -1, 32), nil - } else { - return strconv.FormatFloat(f, 'g', -1, 64), nil - } - } - case pref.StringKind: - // String values are serialized as is without any escaping. - return v.String(), nil - case pref.BytesKind: - if s, ok := marshalBytes(v.Bytes()); ok { - return s, nil - } - } - return "", errors.New("could not format value for %v: %v", k, v) -} - -// unmarshalBytes deserializes bytes by applying C unescaping. -func unmarshalBytes(s string) ([]byte, bool) { - // Bytes values use the same escaping as the text format, - // however they lack the surrounding double quotes. - v, err := ptext.UnmarshalString(`"` + s + `"`) - if err != nil { - return nil, false - } - return []byte(v), true -} - -// marshalBytes serializes bytes by using C escaping. -// To match the exact output of protoc, this is identical to the -// CEscape function in strutil.cc of the protoc source code. -func marshalBytes(b []byte) (string, bool) { - var s []byte - for _, c := range b { - switch c { - case '\n': - s = append(s, `\n`...) - case '\r': - s = append(s, `\r`...) - case '\t': - s = append(s, `\t`...) - case '"': - s = append(s, `\"`...) - case '\'': - s = append(s, `\'`...) - case '\\': - s = append(s, `\\`...) - default: - if printableASCII := c >= 0x20 && c <= 0x7e; printableASCII { - s = append(s, c) - } else { - s = append(s, fmt.Sprintf(`\%03o`, c)...) - } - } - } - return string(s), true -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go b/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go deleted file mode 100644 index b1eeea507..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package messageset encodes and decodes the obsolete MessageSet wire format. -package messageset - -import ( - "math" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/errors" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" -) - -// The MessageSet wire format is equivalent to a message defiend as follows, -// where each Item defines an extension field with a field number of 'type_id' -// and content of 'message'. MessageSet extensions must be non-repeated message -// fields. -// -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// } -// } -const ( - FieldItem = protowire.Number(1) - FieldTypeID = protowire.Number(2) - FieldMessage = protowire.Number(3) -) - -// ExtensionName is the field name for extensions of MessageSet. -// -// A valid MessageSet extension must be of the form: -// message MyMessage { -// extend proto2.bridge.MessageSet { -// optional MyMessage message_set_extension = 1234; -// } -// ... -// } -const ExtensionName = "message_set_extension" - -// IsMessageSet returns whether the message uses the MessageSet wire format. -func IsMessageSet(md pref.MessageDescriptor) bool { - xmd, ok := md.(interface{ IsMessageSet() bool }) - return ok && xmd.IsMessageSet() -} - -// IsMessageSetExtension reports this field extends a MessageSet. -func IsMessageSetExtension(fd pref.FieldDescriptor) bool { - if fd.Name() != ExtensionName { - return false - } - if fd.FullName().Parent() != fd.Message().FullName() { - return false - } - return IsMessageSet(fd.ContainingMessage()) -} - -// FindMessageSetExtension locates a MessageSet extension field by name. -// In text and JSON formats, the extension name used is the message itself. -// The extension field name is derived by appending ExtensionName. -func FindMessageSetExtension(r preg.ExtensionTypeResolver, s pref.FullName) (pref.ExtensionType, error) { - name := s.Append(ExtensionName) - xt, err := r.FindExtensionByName(name) - if err != nil { - if err == preg.NotFound { - return nil, err - } - return nil, errors.Wrap(err, "%q", name) - } - if !IsMessageSetExtension(xt.TypeDescriptor()) { - return nil, preg.NotFound - } - return xt, nil -} - -// SizeField returns the size of a MessageSet item field containing an extension -// with the given field number, not counting the contents of the message subfield. -func SizeField(num protowire.Number) int { - return 2*protowire.SizeTag(FieldItem) + protowire.SizeTag(FieldTypeID) + protowire.SizeVarint(uint64(num)) -} - -// Unmarshal parses a MessageSet. -// -// It calls fn with the type ID and value of each item in the MessageSet. -// Unknown fields are discarded. -// -// If wantLen is true, the item values include the varint length prefix. -// This is ugly, but simplifies the fast-path decoder in internal/impl. -func Unmarshal(b []byte, wantLen bool, fn func(typeID protowire.Number, value []byte) error) error { - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return protowire.ParseError(n) - } - b = b[n:] - if num != FieldItem || wtyp != protowire.StartGroupType { - n := protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return protowire.ParseError(n) - } - b = b[n:] - continue - } - typeID, value, n, err := ConsumeFieldValue(b, wantLen) - if err != nil { - return err - } - b = b[n:] - if typeID == 0 { - continue - } - if err := fn(typeID, value); err != nil { - return err - } - } - return nil -} - -// ConsumeFieldValue parses b as a MessageSet item field value until and including -// the trailing end group marker. It assumes the start group tag has already been parsed. -// It returns the contents of the type_id and message subfields and the total -// item length. -// -// If wantLen is true, the returned message value includes the length prefix. -func ConsumeFieldValue(b []byte, wantLen bool) (typeid protowire.Number, message []byte, n int, err error) { - ilen := len(b) - for { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return 0, nil, 0, protowire.ParseError(n) - } - b = b[n:] - switch { - case num == FieldItem && wtyp == protowire.EndGroupType: - if wantLen && len(message) == 0 { - // The message field was missing, which should never happen. - // Be prepared for this case anyway. - message = protowire.AppendVarint(message, 0) - } - return typeid, message, ilen - len(b), nil - case num == FieldTypeID && wtyp == protowire.VarintType: - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, nil, 0, protowire.ParseError(n) - } - b = b[n:] - if v < 1 || v > math.MaxInt32 { - return 0, nil, 0, errors.New("invalid type_id in message set") - } - typeid = protowire.Number(v) - case num == FieldMessage && wtyp == protowire.BytesType: - m, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, nil, 0, protowire.ParseError(n) - } - if message == nil { - if wantLen { - message = b[:n:n] - } else { - message = m[:len(m):len(m)] - } - } else { - // This case should never happen in practice, but handle it for - // correctness: The MessageSet item contains multiple message - // fields, which need to be merged. - // - // In the case where we're returning the length, this becomes - // quite inefficient since we need to strip the length off - // the existing data and reconstruct it with the combined length. - if wantLen { - _, nn := protowire.ConsumeVarint(message) - m0 := message[nn:] - message = nil - message = protowire.AppendVarint(message, uint64(len(m0)+len(m))) - message = append(message, m0...) - message = append(message, m...) - } else { - message = append(message, m...) - } - } - b = b[n:] - default: - // We have no place to put it, so we just ignore unknown fields. - n := protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return 0, nil, 0, protowire.ParseError(n) - } - b = b[n:] - } - } -} - -// AppendFieldStart appends the start of a MessageSet item field containing -// an extension with the given number. The caller must add the message -// subfield (including the tag). -func AppendFieldStart(b []byte, num protowire.Number) []byte { - b = protowire.AppendTag(b, FieldItem, protowire.StartGroupType) - b = protowire.AppendTag(b, FieldTypeID, protowire.VarintType) - b = protowire.AppendVarint(b, uint64(num)) - return b -} - -// AppendFieldEnd appends the trailing end group marker for a MessageSet item field. -func AppendFieldEnd(b []byte) []byte { - return protowire.AppendTag(b, FieldItem, protowire.EndGroupType) -} - -// SizeUnknown returns the size of an unknown fields section in MessageSet format. -// -// See AppendUnknown. -func SizeUnknown(unknown []byte) (size int) { - for len(unknown) > 0 { - num, typ, n := protowire.ConsumeTag(unknown) - if n < 0 || typ != protowire.BytesType { - return 0 - } - unknown = unknown[n:] - _, n = protowire.ConsumeBytes(unknown) - if n < 0 { - return 0 - } - unknown = unknown[n:] - size += SizeField(num) + protowire.SizeTag(FieldMessage) + n - } - return size -} - -// AppendUnknown appends unknown fields to b in MessageSet format. -// -// For historic reasons, unresolved items in a MessageSet are stored in a -// message's unknown fields section in non-MessageSet format. That is, an -// unknown item with typeID T and value V appears in the unknown fields as -// a field with number T and value V. -// -// This function converts the unknown fields back into MessageSet form. -func AppendUnknown(b, unknown []byte) ([]byte, error) { - for len(unknown) > 0 { - num, typ, n := protowire.ConsumeTag(unknown) - if n < 0 || typ != protowire.BytesType { - return nil, errors.New("invalid data in message set unknown fields") - } - unknown = unknown[n:] - _, n = protowire.ConsumeBytes(unknown) - if n < 0 { - return nil, errors.New("invalid data in message set unknown fields") - } - b = AppendFieldStart(b, num) - b = protowire.AppendTag(b, FieldMessage, protowire.BytesType) - b = append(b, unknown[:n]...) - b = AppendFieldEnd(b) - unknown = unknown[n:] - } - return b, nil -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go deleted file mode 100644 index 16c02d7b6..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package tag marshals and unmarshals the legacy struct tags as generated -// by historical versions of protoc-gen-go. -package tag - -import ( - "reflect" - "strconv" - "strings" - - defval "google.golang.org/protobuf/internal/encoding/defval" - fdesc "google.golang.org/protobuf/internal/filedesc" - "google.golang.org/protobuf/internal/strs" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -var byteType = reflect.TypeOf(byte(0)) - -// Unmarshal decodes the tag into a prototype.Field. -// -// The goType is needed to determine the original protoreflect.Kind since the -// tag does not record sufficient information to determine that. -// The type is the underlying field type (e.g., a repeated field may be -// represented by []T, but the Go type passed in is just T). -// A list of enum value descriptors must be provided for enum fields. -// This does not populate the Enum or Message (except for weak message). -// -// This function is a best effort attempt; parsing errors are ignored. -func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) pref.FieldDescriptor { - f := new(fdesc.Field) - f.L0.ParentFile = fdesc.SurrogateProto2 - for len(tag) > 0 { - i := strings.IndexByte(tag, ',') - if i < 0 { - i = len(tag) - } - switch s := tag[:i]; { - case strings.HasPrefix(s, "name="): - f.L0.FullName = pref.FullName(s[len("name="):]) - case strings.Trim(s, "0123456789") == "": - n, _ := strconv.ParseUint(s, 10, 32) - f.L1.Number = pref.FieldNumber(n) - case s == "opt": - f.L1.Cardinality = pref.Optional - case s == "req": - f.L1.Cardinality = pref.Required - case s == "rep": - f.L1.Cardinality = pref.Repeated - case s == "varint": - switch goType.Kind() { - case reflect.Bool: - f.L1.Kind = pref.BoolKind - case reflect.Int32: - f.L1.Kind = pref.Int32Kind - case reflect.Int64: - f.L1.Kind = pref.Int64Kind - case reflect.Uint32: - f.L1.Kind = pref.Uint32Kind - case reflect.Uint64: - f.L1.Kind = pref.Uint64Kind - } - case s == "zigzag32": - if goType.Kind() == reflect.Int32 { - f.L1.Kind = pref.Sint32Kind - } - case s == "zigzag64": - if goType.Kind() == reflect.Int64 { - f.L1.Kind = pref.Sint64Kind - } - case s == "fixed32": - switch goType.Kind() { - case reflect.Int32: - f.L1.Kind = pref.Sfixed32Kind - case reflect.Uint32: - f.L1.Kind = pref.Fixed32Kind - case reflect.Float32: - f.L1.Kind = pref.FloatKind - } - case s == "fixed64": - switch goType.Kind() { - case reflect.Int64: - f.L1.Kind = pref.Sfixed64Kind - case reflect.Uint64: - f.L1.Kind = pref.Fixed64Kind - case reflect.Float64: - f.L1.Kind = pref.DoubleKind - } - case s == "bytes": - switch { - case goType.Kind() == reflect.String: - f.L1.Kind = pref.StringKind - case goType.Kind() == reflect.Slice && goType.Elem() == byteType: - f.L1.Kind = pref.BytesKind - default: - f.L1.Kind = pref.MessageKind - } - case s == "group": - f.L1.Kind = pref.GroupKind - case strings.HasPrefix(s, "enum="): - f.L1.Kind = pref.EnumKind - case strings.HasPrefix(s, "json="): - jsonName := s[len("json="):] - if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) { - f.L1.JSONName.Init(jsonName) - } - case s == "packed": - f.L1.HasPacked = true - f.L1.IsPacked = true - case strings.HasPrefix(s, "weak="): - f.L1.IsWeak = true - f.L1.Message = fdesc.PlaceholderMessage(pref.FullName(s[len("weak="):])) - case strings.HasPrefix(s, "def="): - // The default tag is special in that everything afterwards is the - // default regardless of the presence of commas. - s, i = tag[len("def="):], len(tag) - v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag) - f.L1.Default = fdesc.DefaultValue(v, ev) - case s == "proto3": - f.L0.ParentFile = fdesc.SurrogateProto3 - } - tag = strings.TrimPrefix(tag[i:], ",") - } - - // The generator uses the group message name instead of the field name. - // We obtain the real field name by lowercasing the group name. - if f.L1.Kind == pref.GroupKind { - f.L0.FullName = pref.FullName(strings.ToLower(string(f.L0.FullName))) - } - return f -} - -// Marshal encodes the protoreflect.FieldDescriptor as a tag. -// -// The enumName must be provided if the kind is an enum. -// Historically, the formulation of the enum "name" was the proto package -// dot-concatenated with the generated Go identifier for the enum type. -// Depending on the context on how Marshal is called, there are different ways -// through which that information is determined. As such it is the caller's -// responsibility to provide a function to obtain that information. -func Marshal(fd pref.FieldDescriptor, enumName string) string { - var tag []string - switch fd.Kind() { - case pref.BoolKind, pref.EnumKind, pref.Int32Kind, pref.Uint32Kind, pref.Int64Kind, pref.Uint64Kind: - tag = append(tag, "varint") - case pref.Sint32Kind: - tag = append(tag, "zigzag32") - case pref.Sint64Kind: - tag = append(tag, "zigzag64") - case pref.Sfixed32Kind, pref.Fixed32Kind, pref.FloatKind: - tag = append(tag, "fixed32") - case pref.Sfixed64Kind, pref.Fixed64Kind, pref.DoubleKind: - tag = append(tag, "fixed64") - case pref.StringKind, pref.BytesKind, pref.MessageKind: - tag = append(tag, "bytes") - case pref.GroupKind: - tag = append(tag, "group") - } - tag = append(tag, strconv.Itoa(int(fd.Number()))) - switch fd.Cardinality() { - case pref.Optional: - tag = append(tag, "opt") - case pref.Required: - tag = append(tag, "req") - case pref.Repeated: - tag = append(tag, "rep") - } - if fd.IsPacked() { - tag = append(tag, "packed") - } - name := string(fd.Name()) - if fd.Kind() == pref.GroupKind { - // The name of the FieldDescriptor for a group field is - // lowercased. To find the original capitalization, we - // look in the field's MessageType. - name = string(fd.Message().Name()) - } - tag = append(tag, "name="+name) - if jsonName := fd.JSONName(); jsonName != "" && jsonName != name && !fd.IsExtension() { - // NOTE: The jsonName != name condition is suspect, but it preserve - // the exact same semantics from the previous generator. - tag = append(tag, "json="+jsonName) - } - if fd.IsWeak() { - tag = append(tag, "weak="+string(fd.Message().FullName())) - } - // The previous implementation does not tag extension fields as proto3, - // even when the field is defined in a proto3 file. Match that behavior - // for consistency. - if fd.Syntax() == pref.Proto3 && !fd.IsExtension() { - tag = append(tag, "proto3") - } - if fd.Kind() == pref.EnumKind && enumName != "" { - tag = append(tag, "enum="+enumName) - } - if fd.ContainingOneof() != nil { - tag = append(tag, "oneof") - } - // This must appear last in the tag, since commas in strings aren't escaped. - if fd.HasDefault() { - def, _ := defval.Marshal(fd.Default(), fd.DefaultEnumValue(), fd.Kind(), defval.GoTag) - tag = append(tag, "def="+def) - } - return strings.Join(tag, ",") -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go deleted file mode 100644 index eb10ea102..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +++ /dev/null @@ -1,665 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package text - -import ( - "bytes" - "fmt" - "io" - "regexp" - "strconv" - "unicode/utf8" - - "google.golang.org/protobuf/internal/errors" -) - -// Decoder is a token-based textproto decoder. -type Decoder struct { - // lastCall is last method called, either readCall or peekCall. - // Initial value is readCall. - lastCall call - - // lastToken contains the last read token. - lastToken Token - - // lastErr contains the last read error. - lastErr error - - // openStack is a stack containing the byte characters for MessageOpen and - // ListOpen kinds. The top of stack represents the message or the list that - // the current token is nested in. An empty stack means the current token is - // at the top level message. The characters '{' and '<' both represent the - // MessageOpen kind. - openStack []byte - - // orig is used in reporting line and column. - orig []byte - // in contains the unconsumed input. - in []byte -} - -// NewDecoder returns a Decoder to read the given []byte. -func NewDecoder(b []byte) *Decoder { - return &Decoder{orig: b, in: b} -} - -// ErrUnexpectedEOF means that EOF was encountered in the middle of the input. -var ErrUnexpectedEOF = errors.New("%v", io.ErrUnexpectedEOF) - -// call specifies which Decoder method was invoked. -type call uint8 - -const ( - readCall call = iota - peekCall -) - -// Peek looks ahead and returns the next token and error without advancing a read. -func (d *Decoder) Peek() (Token, error) { - defer func() { d.lastCall = peekCall }() - if d.lastCall == readCall { - d.lastToken, d.lastErr = d.Read() - } - return d.lastToken, d.lastErr -} - -// Read returns the next token. -// It will return an error if there is no valid token. -func (d *Decoder) Read() (Token, error) { - defer func() { d.lastCall = readCall }() - if d.lastCall == peekCall { - return d.lastToken, d.lastErr - } - - tok, err := d.parseNext(d.lastToken.kind) - if err != nil { - return Token{}, err - } - - switch tok.kind { - case comma, semicolon: - tok, err = d.parseNext(tok.kind) - if err != nil { - return Token{}, err - } - } - d.lastToken = tok - return tok, nil -} - -const ( - mismatchedFmt = "mismatched close character %q" - unexpectedFmt = "unexpected character %q" -) - -// parseNext parses the next Token based on given last kind. -func (d *Decoder) parseNext(lastKind Kind) (Token, error) { - // Trim leading spaces. - d.consume(0) - isEOF := false - if len(d.in) == 0 { - isEOF = true - } - - switch lastKind { - case EOF: - return d.consumeToken(EOF, 0, 0), nil - - case bof: - // Start of top level message. Next token can be EOF or Name. - if isEOF { - return d.consumeToken(EOF, 0, 0), nil - } - return d.parseFieldName() - - case Name: - // Next token can be MessageOpen, ListOpen or Scalar. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case '{', '<': - d.pushOpenStack(ch) - return d.consumeToken(MessageOpen, 1, 0), nil - case '[': - d.pushOpenStack(ch) - return d.consumeToken(ListOpen, 1, 0), nil - default: - return d.parseScalar() - } - - case Scalar: - openKind, closeCh := d.currentOpenKind() - switch openKind { - case bof: - // Top level message. - // Next token can be EOF, comma, semicolon or Name. - if isEOF { - return d.consumeToken(EOF, 0, 0), nil - } - switch d.in[0] { - case ',': - return d.consumeToken(comma, 1, 0), nil - case ';': - return d.consumeToken(semicolon, 1, 0), nil - default: - return d.parseFieldName() - } - - case MessageOpen: - // Next token can be MessageClose, comma, semicolon or Name. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case closeCh: - d.popOpenStack() - return d.consumeToken(MessageClose, 1, 0), nil - case otherCloseChar[closeCh]: - return Token{}, d.newSyntaxError(mismatchedFmt, ch) - case ',': - return d.consumeToken(comma, 1, 0), nil - case ';': - return d.consumeToken(semicolon, 1, 0), nil - default: - return d.parseFieldName() - } - - case ListOpen: - // Next token can be ListClose or comma. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case ']': - d.popOpenStack() - return d.consumeToken(ListClose, 1, 0), nil - case ',': - return d.consumeToken(comma, 1, 0), nil - default: - return Token{}, d.newSyntaxError(unexpectedFmt, ch) - } - } - - case MessageOpen: - // Next token can be MessageClose or Name. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - _, closeCh := d.currentOpenKind() - switch ch := d.in[0]; ch { - case closeCh: - d.popOpenStack() - return d.consumeToken(MessageClose, 1, 0), nil - case otherCloseChar[closeCh]: - return Token{}, d.newSyntaxError(mismatchedFmt, ch) - default: - return d.parseFieldName() - } - - case MessageClose: - openKind, closeCh := d.currentOpenKind() - switch openKind { - case bof: - // Top level message. - // Next token can be EOF, comma, semicolon or Name. - if isEOF { - return d.consumeToken(EOF, 0, 0), nil - } - switch ch := d.in[0]; ch { - case ',': - return d.consumeToken(comma, 1, 0), nil - case ';': - return d.consumeToken(semicolon, 1, 0), nil - default: - return d.parseFieldName() - } - - case MessageOpen: - // Next token can be MessageClose, comma, semicolon or Name. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case closeCh: - d.popOpenStack() - return d.consumeToken(MessageClose, 1, 0), nil - case otherCloseChar[closeCh]: - return Token{}, d.newSyntaxError(mismatchedFmt, ch) - case ',': - return d.consumeToken(comma, 1, 0), nil - case ';': - return d.consumeToken(semicolon, 1, 0), nil - default: - return d.parseFieldName() - } - - case ListOpen: - // Next token can be ListClose or comma - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case closeCh: - d.popOpenStack() - return d.consumeToken(ListClose, 1, 0), nil - case ',': - return d.consumeToken(comma, 1, 0), nil - default: - return Token{}, d.newSyntaxError(unexpectedFmt, ch) - } - } - - case ListOpen: - // Next token can be ListClose, MessageStart or Scalar. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case ']': - d.popOpenStack() - return d.consumeToken(ListClose, 1, 0), nil - case '{', '<': - d.pushOpenStack(ch) - return d.consumeToken(MessageOpen, 1, 0), nil - default: - return d.parseScalar() - } - - case ListClose: - openKind, closeCh := d.currentOpenKind() - switch openKind { - case bof: - // Top level message. - // Next token can be EOF, comma, semicolon or Name. - if isEOF { - return d.consumeToken(EOF, 0, 0), nil - } - switch ch := d.in[0]; ch { - case ',': - return d.consumeToken(comma, 1, 0), nil - case ';': - return d.consumeToken(semicolon, 1, 0), nil - default: - return d.parseFieldName() - } - - case MessageOpen: - // Next token can be MessageClose, comma, semicolon or Name. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case closeCh: - d.popOpenStack() - return d.consumeToken(MessageClose, 1, 0), nil - case otherCloseChar[closeCh]: - return Token{}, d.newSyntaxError(mismatchedFmt, ch) - case ',': - return d.consumeToken(comma, 1, 0), nil - case ';': - return d.consumeToken(semicolon, 1, 0), nil - default: - return d.parseFieldName() - } - - default: - // It is not possible to have this case. Let it panic below. - } - - case comma, semicolon: - openKind, closeCh := d.currentOpenKind() - switch openKind { - case bof: - // Top level message. Next token can be EOF or Name. - if isEOF { - return d.consumeToken(EOF, 0, 0), nil - } - return d.parseFieldName() - - case MessageOpen: - // Next token can be MessageClose or Name. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case closeCh: - d.popOpenStack() - return d.consumeToken(MessageClose, 1, 0), nil - case otherCloseChar[closeCh]: - return Token{}, d.newSyntaxError(mismatchedFmt, ch) - default: - return d.parseFieldName() - } - - case ListOpen: - if lastKind == semicolon { - // It is not be possible to have this case as logic here - // should not have produced a semicolon Token when inside a - // list. Let it panic below. - break - } - // Next token can be MessageOpen or Scalar. - if isEOF { - return Token{}, ErrUnexpectedEOF - } - switch ch := d.in[0]; ch { - case '{', '<': - d.pushOpenStack(ch) - return d.consumeToken(MessageOpen, 1, 0), nil - default: - return d.parseScalar() - } - } - } - - line, column := d.Position(len(d.orig) - len(d.in)) - panic(fmt.Sprintf("Decoder.parseNext: bug at handling line %d:%d with lastKind=%v", line, column, lastKind)) -} - -var otherCloseChar = map[byte]byte{ - '}': '>', - '>': '}', -} - -// currentOpenKind indicates whether current position is inside a message, list -// or top-level message by returning MessageOpen, ListOpen or bof respectively. -// If the returned kind is either a MessageOpen or ListOpen, it also returns the -// corresponding closing character. -func (d *Decoder) currentOpenKind() (Kind, byte) { - if len(d.openStack) == 0 { - return bof, 0 - } - openCh := d.openStack[len(d.openStack)-1] - switch openCh { - case '{': - return MessageOpen, '}' - case '<': - return MessageOpen, '>' - case '[': - return ListOpen, ']' - } - panic(fmt.Sprintf("Decoder: openStack contains invalid byte %s", string(openCh))) -} - -func (d *Decoder) pushOpenStack(ch byte) { - d.openStack = append(d.openStack, ch) -} - -func (d *Decoder) popOpenStack() { - d.openStack = d.openStack[:len(d.openStack)-1] -} - -// parseFieldName parses field name and separator. -func (d *Decoder) parseFieldName() (tok Token, err error) { - defer func() { - if err == nil && d.tryConsumeChar(':') { - tok.attrs |= hasSeparator - } - }() - - // Extension or Any type URL. - if d.in[0] == '[' { - return d.parseTypeName() - } - - // Identifier. - if size := parseIdent(d.in, false); size > 0 { - return d.consumeToken(Name, size, uint8(IdentName)), nil - } - - // Field number. Identify if input is a valid number that is not negative - // and is decimal integer within 32-bit range. - if num := parseNumber(d.in); num.size > 0 { - if !num.neg && num.kind == numDec { - if _, err := strconv.ParseInt(string(d.in[:num.size]), 10, 32); err == nil { - return d.consumeToken(Name, num.size, uint8(FieldNumber)), nil - } - } - return Token{}, d.newSyntaxError("invalid field number: %s", d.in[:num.size]) - } - - return Token{}, d.newSyntaxError("invalid field name: %s", errRegexp.Find(d.in)) -} - -// parseTypeName parses Any type URL or extension field name. The name is -// enclosed in [ and ] characters. The C++ parser does not handle many legal URL -// strings. This implementation is more liberal and allows for the pattern -// ^[-_a-zA-Z0-9]+([./][-_a-zA-Z0-9]+)*`). Whitespaces and comments are allowed -// in between [ ], '.', '/' and the sub names. -func (d *Decoder) parseTypeName() (Token, error) { - startPos := len(d.orig) - len(d.in) - // Use alias s to advance first in order to use d.in for error handling. - // Caller already checks for [ as first character. - s := consume(d.in[1:], 0) - if len(s) == 0 { - return Token{}, ErrUnexpectedEOF - } - - var name []byte - for len(s) > 0 && isTypeNameChar(s[0]) { - name = append(name, s[0]) - s = s[1:] - } - s = consume(s, 0) - - var closed bool - for len(s) > 0 && !closed { - switch { - case s[0] == ']': - s = s[1:] - closed = true - - case s[0] == '/', s[0] == '.': - if len(name) > 0 && (name[len(name)-1] == '/' || name[len(name)-1] == '.') { - return Token{}, d.newSyntaxError("invalid type URL/extension field name: %s", - d.orig[startPos:len(d.orig)-len(s)+1]) - } - name = append(name, s[0]) - s = s[1:] - s = consume(s, 0) - for len(s) > 0 && isTypeNameChar(s[0]) { - name = append(name, s[0]) - s = s[1:] - } - s = consume(s, 0) - - default: - return Token{}, d.newSyntaxError( - "invalid type URL/extension field name: %s", d.orig[startPos:len(d.orig)-len(s)+1]) - } - } - - if !closed { - return Token{}, ErrUnexpectedEOF - } - - // First character cannot be '.'. Last character cannot be '.' or '/'. - size := len(name) - if size == 0 || name[0] == '.' || name[size-1] == '.' || name[size-1] == '/' { - return Token{}, d.newSyntaxError("invalid type URL/extension field name: %s", - d.orig[startPos:len(d.orig)-len(s)]) - } - - d.in = s - endPos := len(d.orig) - len(d.in) - d.consume(0) - - return Token{ - kind: Name, - attrs: uint8(TypeName), - pos: startPos, - raw: d.orig[startPos:endPos], - str: string(name), - }, nil -} - -func isTypeNameChar(b byte) bool { - return (b == '-' || b == '_' || - ('0' <= b && b <= '9') || - ('a' <= b && b <= 'z') || - ('A' <= b && b <= 'Z')) -} - -func isWhiteSpace(b byte) bool { - switch b { - case ' ', '\n', '\r', '\t': - return true - default: - return false - } -} - -// parseIdent parses an unquoted proto identifier and returns size. -// If allowNeg is true, it allows '-' to be the first character in the -// identifier. This is used when parsing literal values like -infinity, etc. -// Regular expression matches an identifier: `^[_a-zA-Z][_a-zA-Z0-9]*` -func parseIdent(input []byte, allowNeg bool) int { - var size int - - s := input - if len(s) == 0 { - return 0 - } - - if allowNeg && s[0] == '-' { - s = s[1:] - size++ - if len(s) == 0 { - return 0 - } - } - - switch { - case s[0] == '_', - 'a' <= s[0] && s[0] <= 'z', - 'A' <= s[0] && s[0] <= 'Z': - s = s[1:] - size++ - default: - return 0 - } - - for len(s) > 0 && (s[0] == '_' || - 'a' <= s[0] && s[0] <= 'z' || - 'A' <= s[0] && s[0] <= 'Z' || - '0' <= s[0] && s[0] <= '9') { - s = s[1:] - size++ - } - - if len(s) > 0 && !isDelim(s[0]) { - return 0 - } - - return size -} - -// parseScalar parses for a string, literal or number value. -func (d *Decoder) parseScalar() (Token, error) { - if d.in[0] == '"' || d.in[0] == '\'' { - return d.parseStringValue() - } - - if tok, ok := d.parseLiteralValue(); ok { - return tok, nil - } - - if tok, ok := d.parseNumberValue(); ok { - return tok, nil - } - - return Token{}, d.newSyntaxError("invalid scalar value: %s", errRegexp.Find(d.in)) -} - -// parseLiteralValue parses a literal value. A literal value is used for -// bools, special floats and enums. This function simply identifies that the -// field value is a literal. -func (d *Decoder) parseLiteralValue() (Token, bool) { - size := parseIdent(d.in, true) - if size == 0 { - return Token{}, false - } - return d.consumeToken(Scalar, size, literalValue), true -} - -// consumeToken constructs a Token for given Kind from d.in and consumes given -// size-length from it. -func (d *Decoder) consumeToken(kind Kind, size int, attrs uint8) Token { - // Important to compute raw and pos before consuming. - tok := Token{ - kind: kind, - attrs: attrs, - pos: len(d.orig) - len(d.in), - raw: d.in[:size], - } - d.consume(size) - return tok -} - -// newSyntaxError returns a syntax error with line and column information for -// current position. -func (d *Decoder) newSyntaxError(f string, x ...interface{}) error { - e := errors.New(f, x...) - line, column := d.Position(len(d.orig) - len(d.in)) - return errors.New("syntax error (line %d:%d): %v", line, column, e) -} - -// Position returns line and column number of given index of the original input. -// It will panic if index is out of range. -func (d *Decoder) Position(idx int) (line int, column int) { - b := d.orig[:idx] - line = bytes.Count(b, []byte("\n")) + 1 - if i := bytes.LastIndexByte(b, '\n'); i >= 0 { - b = b[i+1:] - } - column = utf8.RuneCount(b) + 1 // ignore multi-rune characters - return line, column -} - -func (d *Decoder) tryConsumeChar(c byte) bool { - if len(d.in) > 0 && d.in[0] == c { - d.consume(1) - return true - } - return false -} - -// consume consumes n bytes of input and any subsequent whitespace or comments. -func (d *Decoder) consume(n int) { - d.in = consume(d.in, n) - return -} - -// consume consumes n bytes of input and any subsequent whitespace or comments. -func consume(b []byte, n int) []byte { - b = b[n:] - for len(b) > 0 { - switch b[0] { - case ' ', '\n', '\r', '\t': - b = b[1:] - case '#': - if i := bytes.IndexByte(b, '\n'); i >= 0 { - b = b[i+len("\n"):] - } else { - b = nil - } - default: - return b - } - } - return b -} - -// Any sequence that looks like a non-delimiter (for error reporting). -var errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9\/]+|.)`) - -// isDelim returns true if given byte is a delimiter character. -func isDelim(c byte) bool { - return !(c == '-' || c == '+' || c == '.' || c == '_' || - ('a' <= c && c <= 'z') || - ('A' <= c && c <= 'Z') || - ('0' <= c && c <= '9')) -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go deleted file mode 100644 index f2d90b789..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package text - -// parseNumberValue parses a number from the input and returns a Token object. -func (d *Decoder) parseNumberValue() (Token, bool) { - in := d.in - num := parseNumber(in) - if num.size == 0 { - return Token{}, false - } - numAttrs := num.kind - if num.neg { - numAttrs |= isNegative - } - strSize := num.size - last := num.size - 1 - if num.kind == numFloat && (d.in[last] == 'f' || d.in[last] == 'F') { - strSize = last - } - tok := Token{ - kind: Scalar, - attrs: numberValue, - pos: len(d.orig) - len(d.in), - raw: d.in[:num.size], - str: string(d.in[:strSize]), - numAttrs: numAttrs, - } - d.consume(num.size) - return tok, true -} - -const ( - numDec uint8 = (1 << iota) / 2 - numHex - numOct - numFloat -) - -// number is the result of parsing out a valid number from parseNumber. It -// contains data for doing float or integer conversion via the strconv package -// in conjunction with the input bytes. -type number struct { - kind uint8 - neg bool - size int -} - -// parseNumber constructs a number object from given input. It allows for the -// following patterns: -// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*) -// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?) -// It also returns the number of parsed bytes for the given number, 0 if it is -// not a number. -func parseNumber(input []byte) number { - kind := numDec - var size int - var neg bool - - s := input - if len(s) == 0 { - return number{} - } - - // Optional - - if s[0] == '-' { - neg = true - s = s[1:] - size++ - if len(s) == 0 { - return number{} - } - } - - // C++ allows for whitespace and comments in between the negative sign and - // the rest of the number. This logic currently does not but is consistent - // with v1. - - switch { - case s[0] == '0': - if len(s) > 1 { - switch { - case s[1] == 'x' || s[1] == 'X': - // Parse as hex number. - kind = numHex - n := 2 - s = s[2:] - for len(s) > 0 && (('0' <= s[0] && s[0] <= '9') || - ('a' <= s[0] && s[0] <= 'f') || - ('A' <= s[0] && s[0] <= 'F')) { - s = s[1:] - n++ - } - if n == 2 { - return number{} - } - size += n - - case '0' <= s[1] && s[1] <= '7': - // Parse as octal number. - kind = numOct - n := 2 - s = s[2:] - for len(s) > 0 && '0' <= s[0] && s[0] <= '7' { - s = s[1:] - n++ - } - size += n - } - - if kind&(numHex|numOct) > 0 { - if len(s) > 0 && !isDelim(s[0]) { - return number{} - } - return number{kind: kind, neg: neg, size: size} - } - } - s = s[1:] - size++ - - case '1' <= s[0] && s[0] <= '9': - n := 1 - s = s[1:] - for len(s) > 0 && '0' <= s[0] && s[0] <= '9' { - s = s[1:] - n++ - } - size += n - - case s[0] == '.': - // Set kind to numFloat to signify the intent to parse as float. And - // that it needs to have other digits after '.'. - kind = numFloat - - default: - return number{} - } - - // . followed by 0 or more digits. - if len(s) > 0 && s[0] == '.' { - n := 1 - s = s[1:] - // If decimal point was before any digits, it should be followed by - // other digits. - if len(s) == 0 && kind == numFloat { - return number{} - } - for len(s) > 0 && '0' <= s[0] && s[0] <= '9' { - s = s[1:] - n++ - } - size += n - kind = numFloat - } - - // e or E followed by an optional - or + and 1 or more digits. - if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') { - kind = numFloat - s = s[1:] - n := 1 - if s[0] == '+' || s[0] == '-' { - s = s[1:] - n++ - if len(s) == 0 { - return number{} - } - } - for len(s) > 0 && '0' <= s[0] && s[0] <= '9' { - s = s[1:] - n++ - } - size += n - } - - // Optional suffix f or F for floats. - if len(s) > 0 && (s[0] == 'f' || s[0] == 'F') { - kind = numFloat - s = s[1:] - size++ - } - - // Check that next byte is a delimiter or it is at the end. - if len(s) > 0 && !isDelim(s[0]) { - return number{} - } - - return number{kind: kind, neg: neg, size: size} -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go deleted file mode 100644 index d4d349023..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package text - -import ( - "bytes" - "strconv" - "strings" - "unicode" - "unicode/utf16" - "unicode/utf8" - - "google.golang.org/protobuf/internal/strs" -) - -// parseStringValue parses string field token. -// This differs from parseString since the text format allows -// multiple back-to-back string literals where they are semantically treated -// as a single large string with all values concatenated. -// -// E.g., `"foo" "bar" "baz"` => "foobarbaz" -func (d *Decoder) parseStringValue() (Token, error) { - // Note that the ending quote is sufficient to unambiguously mark the end - // of a string. Thus, the text grammar does not require intervening - // whitespace or control characters in-between strings. - // Thus, the following is valid: - // `"foo"'bar'"baz"` => "foobarbaz" - in0 := d.in - var ss []string - for len(d.in) > 0 && (d.in[0] == '"' || d.in[0] == '\'') { - s, err := d.parseString() - if err != nil { - return Token{}, err - } - ss = append(ss, s) - } - // d.in already points to the end of the value at this point. - return Token{ - kind: Scalar, - attrs: stringValue, - pos: len(d.orig) - len(in0), - raw: in0[:len(in0)-len(d.in)], - str: strings.Join(ss, ""), - }, nil -} - -// parseString parses a string value enclosed in " or '. -func (d *Decoder) parseString() (string, error) { - in := d.in - if len(in) == 0 { - return "", ErrUnexpectedEOF - } - quote := in[0] - in = in[1:] - i := indexNeedEscapeInBytes(in) - in, out := in[i:], in[:i:i] // set cap to prevent mutations - for len(in) > 0 { - switch r, n := utf8.DecodeRune(in); { - case r == utf8.RuneError && n == 1: - return "", d.newSyntaxError("invalid UTF-8 detected") - case r == 0 || r == '\n': - return "", d.newSyntaxError("invalid character %q in string", r) - case r == rune(quote): - in = in[1:] - d.consume(len(d.in) - len(in)) - return string(out), nil - case r == '\\': - if len(in) < 2 { - return "", ErrUnexpectedEOF - } - switch r := in[1]; r { - case '"', '\'', '\\', '?': - in, out = in[2:], append(out, r) - case 'a': - in, out = in[2:], append(out, '\a') - case 'b': - in, out = in[2:], append(out, '\b') - case 'n': - in, out = in[2:], append(out, '\n') - case 'r': - in, out = in[2:], append(out, '\r') - case 't': - in, out = in[2:], append(out, '\t') - case 'v': - in, out = in[2:], append(out, '\v') - case 'f': - in, out = in[2:], append(out, '\f') - case '0', '1', '2', '3', '4', '5', '6', '7': - // One, two, or three octal characters. - n := len(in[1:]) - len(bytes.TrimLeft(in[1:], "01234567")) - if n > 3 { - n = 3 - } - v, err := strconv.ParseUint(string(in[1:1+n]), 8, 8) - if err != nil { - return "", d.newSyntaxError("invalid octal escape code %q in string", in[:1+n]) - } - in, out = in[1+n:], append(out, byte(v)) - case 'x': - // One or two hexadecimal characters. - n := len(in[2:]) - len(bytes.TrimLeft(in[2:], "0123456789abcdefABCDEF")) - if n > 2 { - n = 2 - } - v, err := strconv.ParseUint(string(in[2:2+n]), 16, 8) - if err != nil { - return "", d.newSyntaxError("invalid hex escape code %q in string", in[:2+n]) - } - in, out = in[2+n:], append(out, byte(v)) - case 'u', 'U': - // Four or eight hexadecimal characters - n := 6 - if r == 'U' { - n = 10 - } - if len(in) < n { - return "", ErrUnexpectedEOF - } - v, err := strconv.ParseUint(string(in[2:n]), 16, 32) - if utf8.MaxRune < v || err != nil { - return "", d.newSyntaxError("invalid Unicode escape code %q in string", in[:n]) - } - in = in[n:] - - r := rune(v) - if utf16.IsSurrogate(r) { - if len(in) < 6 { - return "", ErrUnexpectedEOF - } - v, err := strconv.ParseUint(string(in[2:6]), 16, 16) - r = utf16.DecodeRune(r, rune(v)) - if in[0] != '\\' || in[1] != 'u' || r == unicode.ReplacementChar || err != nil { - return "", d.newSyntaxError("invalid Unicode escape code %q in string", in[:6]) - } - in = in[6:] - } - out = append(out, string(r)...) - default: - return "", d.newSyntaxError("invalid escape code %q in string", in[:2]) - } - default: - i := indexNeedEscapeInBytes(in[n:]) - in, out = in[n+i:], append(out, in[:n+i]...) - } - } - return "", ErrUnexpectedEOF -} - -// indexNeedEscapeInString returns the index of the character that needs -// escaping. If no characters need escaping, this returns the input length. -func indexNeedEscapeInBytes(b []byte) int { return indexNeedEscapeInString(strs.UnsafeString(b)) } - -// UnmarshalString returns an unescaped string given a textproto string value. -// String value needs to contain single or double quotes. This is only used by -// internal/encoding/defval package for unmarshaling bytes. -func UnmarshalString(s string) (string, error) { - d := NewDecoder([]byte(s)) - return d.parseString() -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go deleted file mode 100644 index 83d2b0d5a..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package text - -import ( - "bytes" - "fmt" - "math" - "strconv" - "strings" - - "google.golang.org/protobuf/internal/flags" -) - -// Kind represents a token kind expressible in the textproto format. -type Kind uint8 - -// Kind values. -const ( - Invalid Kind = iota - EOF - Name // Name indicates the field name. - Scalar // Scalar are scalar values, e.g. "string", 47, ENUM_LITERAL, true. - MessageOpen - MessageClose - ListOpen - ListClose - - // comma and semi-colon are only for parsing in between values and should not be exposed. - comma - semicolon - - // bof indicates beginning of file, which is the default token - // kind at the beginning of parsing. - bof = Invalid -) - -func (t Kind) String() string { - switch t { - case Invalid: - return "" - case EOF: - return "eof" - case Scalar: - return "scalar" - case Name: - return "name" - case MessageOpen: - return "{" - case MessageClose: - return "}" - case ListOpen: - return "[" - case ListClose: - return "]" - case comma: - return "," - case semicolon: - return ";" - default: - return fmt.Sprintf("", uint8(t)) - } -} - -// NameKind represents different types of field names. -type NameKind uint8 - -// NameKind values. -const ( - IdentName NameKind = iota + 1 - TypeName - FieldNumber -) - -func (t NameKind) String() string { - switch t { - case IdentName: - return "IdentName" - case TypeName: - return "TypeName" - case FieldNumber: - return "FieldNumber" - default: - return fmt.Sprintf("", uint8(t)) - } -} - -// Bit mask in Token.attrs to indicate if a Name token is followed by the -// separator char ':'. The field name separator char is optional for message -// field or repeated message field, but required for all other types. Decoder -// simply indicates whether a Name token is followed by separator or not. It is -// up to the prototext package to validate. -const hasSeparator = 1 << 7 - -// Scalar value types. -const ( - numberValue = iota + 1 - stringValue - literalValue -) - -// Bit mask in Token.numAttrs to indicate that the number is a negative. -const isNegative = 1 << 7 - -// Token provides a parsed token kind and value. Values are provided by the -// different accessor methods. -type Token struct { - // Kind of the Token object. - kind Kind - // attrs contains metadata for the following Kinds: - // Name: hasSeparator bit and one of NameKind. - // Scalar: one of numberValue, stringValue, literalValue. - attrs uint8 - // numAttrs contains metadata for numberValue: - // - highest bit is whether negative or positive. - // - lower bits indicate one of numDec, numHex, numOct, numFloat. - numAttrs uint8 - // pos provides the position of the token in the original input. - pos int - // raw bytes of the serialized token. - // This is a subslice into the original input. - raw []byte - // str contains parsed string for the following: - // - stringValue of Scalar kind - // - numberValue of Scalar kind - // - TypeName of Name kind - str string -} - -// Kind returns the token kind. -func (t Token) Kind() Kind { - return t.kind -} - -// RawString returns the read value in string. -func (t Token) RawString() string { - return string(t.raw) -} - -// Pos returns the token position from the input. -func (t Token) Pos() int { - return t.pos -} - -// NameKind returns IdentName, TypeName or FieldNumber. -// It panics if type is not Name. -func (t Token) NameKind() NameKind { - if t.kind == Name { - return NameKind(t.attrs &^ hasSeparator) - } - panic(fmt.Sprintf("Token is not a Name type: %s", t.kind)) -} - -// HasSeparator returns true if the field name is followed by the separator char -// ':', else false. It panics if type is not Name. -func (t Token) HasSeparator() bool { - if t.kind == Name { - return t.attrs&hasSeparator != 0 - } - panic(fmt.Sprintf("Token is not a Name type: %s", t.kind)) -} - -// IdentName returns the value for IdentName type. -func (t Token) IdentName() string { - if t.kind == Name && t.attrs&uint8(IdentName) != 0 { - return string(t.raw) - } - panic(fmt.Sprintf("Token is not an IdentName: %s:%s", t.kind, NameKind(t.attrs&^hasSeparator))) -} - -// TypeName returns the value for TypeName type. -func (t Token) TypeName() string { - if t.kind == Name && t.attrs&uint8(TypeName) != 0 { - return t.str - } - panic(fmt.Sprintf("Token is not a TypeName: %s:%s", t.kind, NameKind(t.attrs&^hasSeparator))) -} - -// FieldNumber returns the value for FieldNumber type. It returns a -// non-negative int32 value. Caller will still need to validate for the correct -// field number range. -func (t Token) FieldNumber() int32 { - if t.kind != Name || t.attrs&uint8(FieldNumber) == 0 { - panic(fmt.Sprintf("Token is not a FieldNumber: %s:%s", t.kind, NameKind(t.attrs&^hasSeparator))) - } - // Following should not return an error as it had already been called right - // before this Token was constructed. - num, _ := strconv.ParseInt(string(t.raw), 10, 32) - return int32(num) -} - -// String returns the string value for a Scalar type. -func (t Token) String() (string, bool) { - if t.kind != Scalar || t.attrs != stringValue { - return "", false - } - return t.str, true -} - -// Enum returns the literal value for a Scalar type for use as enum literals. -func (t Token) Enum() (string, bool) { - if t.kind != Scalar || t.attrs != literalValue || (len(t.raw) > 0 && t.raw[0] == '-') { - return "", false - } - return string(t.raw), true -} - -// Bool returns the bool value for a Scalar type. -func (t Token) Bool() (bool, bool) { - if t.kind != Scalar { - return false, false - } - switch t.attrs { - case literalValue: - if b, ok := boolLits[string(t.raw)]; ok { - return b, true - } - case numberValue: - // Unsigned integer representation of 0 or 1 is permitted: 00, 0x0, 01, - // 0x1, etc. - n, err := strconv.ParseUint(t.str, 0, 64) - if err == nil { - switch n { - case 0: - return false, true - case 1: - return true, true - } - } - } - return false, false -} - -// These exact boolean literals are the ones supported in C++. -var boolLits = map[string]bool{ - "t": true, - "true": true, - "True": true, - "f": false, - "false": false, - "False": false, -} - -// Uint64 returns the uint64 value for a Scalar type. -func (t Token) Uint64() (uint64, bool) { - if t.kind != Scalar || t.attrs != numberValue || - t.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 { - return 0, false - } - n, err := strconv.ParseUint(t.str, 0, 64) - if err != nil { - return 0, false - } - return n, true -} - -// Uint32 returns the uint32 value for a Scalar type. -func (t Token) Uint32() (uint32, bool) { - if t.kind != Scalar || t.attrs != numberValue || - t.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 { - return 0, false - } - n, err := strconv.ParseUint(t.str, 0, 32) - if err != nil { - return 0, false - } - return uint32(n), true -} - -// Int64 returns the int64 value for a Scalar type. -func (t Token) Int64() (int64, bool) { - if t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 { - return 0, false - } - if n, err := strconv.ParseInt(t.str, 0, 64); err == nil { - return n, true - } - // C++ accepts large positive hex numbers as negative values. - // This feature is here for proto1 backwards compatibility purposes. - if flags.ProtoLegacy && (t.numAttrs == numHex) { - if n, err := strconv.ParseUint(t.str, 0, 64); err == nil { - return int64(n), true - } - } - return 0, false -} - -// Int32 returns the int32 value for a Scalar type. -func (t Token) Int32() (int32, bool) { - if t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 { - return 0, false - } - if n, err := strconv.ParseInt(t.str, 0, 32); err == nil { - return int32(n), true - } - // C++ accepts large positive hex numbers as negative values. - // This feature is here for proto1 backwards compatibility purposes. - if flags.ProtoLegacy && (t.numAttrs == numHex) { - if n, err := strconv.ParseUint(t.str, 0, 32); err == nil { - return int32(n), true - } - } - return 0, false -} - -// Float64 returns the float64 value for a Scalar type. -func (t Token) Float64() (float64, bool) { - if t.kind != Scalar { - return 0, false - } - switch t.attrs { - case literalValue: - if f, ok := floatLits[strings.ToLower(string(t.raw))]; ok { - return f, true - } - case numberValue: - n, err := strconv.ParseFloat(t.str, 64) - if err == nil { - return n, true - } - nerr := err.(*strconv.NumError) - if nerr.Err == strconv.ErrRange { - return n, true - } - } - return 0, false -} - -// Float32 returns the float32 value for a Scalar type. -func (t Token) Float32() (float32, bool) { - if t.kind != Scalar { - return 0, false - } - switch t.attrs { - case literalValue: - if f, ok := floatLits[strings.ToLower(string(t.raw))]; ok { - return float32(f), true - } - case numberValue: - n, err := strconv.ParseFloat(t.str, 64) - if err == nil { - // Overflows are treated as (-)infinity. - return float32(n), true - } - nerr := err.(*strconv.NumError) - if nerr.Err == strconv.ErrRange { - return float32(n), true - } - } - return 0, false -} - -// These are the supported float literals which C++ permits case-insensitive -// variants of these. -var floatLits = map[string]float64{ - "nan": math.NaN(), - "inf": math.Inf(1), - "infinity": math.Inf(1), - "-inf": math.Inf(-1), - "-infinity": math.Inf(-1), -} - -// TokenEquals returns true if given Tokens are equal, else false. -func TokenEquals(x, y Token) bool { - return x.kind == y.kind && - x.attrs == y.attrs && - x.numAttrs == y.numAttrs && - x.pos == y.pos && - bytes.Equal(x.raw, y.raw) && - x.str == y.str -} diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go b/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go deleted file mode 100644 index 0ce8d6fb8..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package text implements the text format for protocol buffers. -// This package has no semantic understanding for protocol buffers and is only -// a parser and composer for the format. -// -// There is no formal specification for the protobuf text format, as such the -// C++ implementation (see google::protobuf::TextFormat) is the reference -// implementation of the text format. -// -// This package is neither a superset nor a subset of the C++ implementation. -// This implementation permits a more liberal grammar in some cases to be -// backwards compatible with the historical Go implementation. -// Future parsings unique to Go should not be added. -// Some grammars allowed by the C++ implementation are deliberately -// not implemented here because they are considered a bug by the protobuf team -// and should not be replicated. -// -// The Go implementation should implement a sufficient amount of the C++ -// grammar such that the default text serialization by C++ can be parsed by Go. -// However, just because the C++ parser accepts some input does not mean that -// the Go implementation should as well. -// -// The text format is almost a superset of JSON except: -// * message keys are not quoted strings, but identifiers -// * the top-level value must be a message without the delimiters -package text diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go deleted file mode 100644 index c4ba1c598..000000000 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package text - -import ( - "math" - "math/bits" - "strconv" - "strings" - "unicode/utf8" - - "google.golang.org/protobuf/internal/detrand" - "google.golang.org/protobuf/internal/errors" -) - -// encType represents an encoding type. -type encType uint8 - -const ( - _ encType = (1 << iota) / 2 - name - scalar - messageOpen - messageClose -) - -// Encoder provides methods to write out textproto constructs and values. The user is -// responsible for producing valid sequences of constructs and values. -type Encoder struct { - encoderState - - indent string - newline string // set to "\n" if len(indent) > 0 - delims [2]byte - outputASCII bool -} - -type encoderState struct { - lastType encType - indents []byte - out []byte -} - -// NewEncoder returns an Encoder. -// -// If indent is a non-empty string, it causes every entry in a List or Message -// to be preceded by the indent and trailed by a newline. -// -// If delims is not the zero value, it controls the delimiter characters used -// for messages (e.g., "{}" vs "<>"). -// -// If outputASCII is true, strings will be serialized in such a way that -// multi-byte UTF-8 sequences are escaped. This property ensures that the -// overall output is ASCII (as opposed to UTF-8). -func NewEncoder(indent string, delims [2]byte, outputASCII bool) (*Encoder, error) { - e := &Encoder{} - if len(indent) > 0 { - if strings.Trim(indent, " \t") != "" { - return nil, errors.New("indent may only be composed of space and tab characters") - } - e.indent = indent - e.newline = "\n" - } - switch delims { - case [2]byte{0, 0}: - e.delims = [2]byte{'{', '}'} - case [2]byte{'{', '}'}, [2]byte{'<', '>'}: - e.delims = delims - default: - return nil, errors.New("delimiters may only be \"{}\" or \"<>\"") - } - e.outputASCII = outputASCII - - return e, nil -} - -// Bytes returns the content of the written bytes. -func (e *Encoder) Bytes() []byte { - return e.out -} - -// StartMessage writes out the '{' or '<' symbol. -func (e *Encoder) StartMessage() { - e.prepareNext(messageOpen) - e.out = append(e.out, e.delims[0]) -} - -// EndMessage writes out the '}' or '>' symbol. -func (e *Encoder) EndMessage() { - e.prepareNext(messageClose) - e.out = append(e.out, e.delims[1]) -} - -// WriteName writes out the field name and the separator ':'. -func (e *Encoder) WriteName(s string) { - e.prepareNext(name) - e.out = append(e.out, s...) - e.out = append(e.out, ':') -} - -// WriteBool writes out the given boolean value. -func (e *Encoder) WriteBool(b bool) { - if b { - e.WriteLiteral("true") - } else { - e.WriteLiteral("false") - } -} - -// WriteString writes out the given string value. -func (e *Encoder) WriteString(s string) { - e.prepareNext(scalar) - e.out = appendString(e.out, s, e.outputASCII) -} - -func appendString(out []byte, in string, outputASCII bool) []byte { - out = append(out, '"') - i := indexNeedEscapeInString(in) - in, out = in[i:], append(out, in[:i]...) - for len(in) > 0 { - switch r, n := utf8.DecodeRuneInString(in); { - case r == utf8.RuneError && n == 1: - // We do not report invalid UTF-8 because strings in the text format - // are used to represent both the proto string and bytes type. - r = rune(in[0]) - fallthrough - case r < ' ' || r == '"' || r == '\\': - out = append(out, '\\') - switch r { - case '"', '\\': - out = append(out, byte(r)) - case '\n': - out = append(out, 'n') - case '\r': - out = append(out, 'r') - case '\t': - out = append(out, 't') - default: - out = append(out, 'x') - out = append(out, "00"[1+(bits.Len32(uint32(r))-1)/4:]...) - out = strconv.AppendUint(out, uint64(r), 16) - } - in = in[n:] - case outputASCII && r >= utf8.RuneSelf: - out = append(out, '\\') - if r <= math.MaxUint16 { - out = append(out, 'u') - out = append(out, "0000"[1+(bits.Len32(uint32(r))-1)/4:]...) - out = strconv.AppendUint(out, uint64(r), 16) - } else { - out = append(out, 'U') - out = append(out, "00000000"[1+(bits.Len32(uint32(r))-1)/4:]...) - out = strconv.AppendUint(out, uint64(r), 16) - } - in = in[n:] - default: - i := indexNeedEscapeInString(in[n:]) - in, out = in[n+i:], append(out, in[:n+i]...) - } - } - out = append(out, '"') - return out -} - -// indexNeedEscapeInString returns the index of the character that needs -// escaping. If no characters need escaping, this returns the input length. -func indexNeedEscapeInString(s string) int { - for i := 0; i < len(s); i++ { - if c := s[i]; c < ' ' || c == '"' || c == '\'' || c == '\\' || c >= utf8.RuneSelf { - return i - } - } - return len(s) -} - -// WriteFloat writes out the given float value for given bitSize. -func (e *Encoder) WriteFloat(n float64, bitSize int) { - e.prepareNext(scalar) - e.out = appendFloat(e.out, n, bitSize) -} - -func appendFloat(out []byte, n float64, bitSize int) []byte { - switch { - case math.IsNaN(n): - return append(out, "nan"...) - case math.IsInf(n, +1): - return append(out, "inf"...) - case math.IsInf(n, -1): - return append(out, "-inf"...) - default: - return strconv.AppendFloat(out, n, 'g', -1, bitSize) - } -} - -// WriteInt writes out the given signed integer value. -func (e *Encoder) WriteInt(n int64) { - e.prepareNext(scalar) - e.out = append(e.out, strconv.FormatInt(n, 10)...) -} - -// WriteUint writes out the given unsigned integer value. -func (e *Encoder) WriteUint(n uint64) { - e.prepareNext(scalar) - e.out = append(e.out, strconv.FormatUint(n, 10)...) -} - -// WriteLiteral writes out the given string as a literal value without quotes. -// This is used for writing enum literal strings. -func (e *Encoder) WriteLiteral(s string) { - e.prepareNext(scalar) - e.out = append(e.out, s...) -} - -// prepareNext adds possible space and indentation for the next value based -// on last encType and indent option. It also updates e.lastType to next. -func (e *Encoder) prepareNext(next encType) { - defer func() { - e.lastType = next - }() - - // Single line. - if len(e.indent) == 0 { - // Add space after each field before the next one. - if e.lastType&(scalar|messageClose) != 0 && next == name { - e.out = append(e.out, ' ') - // Add a random extra space to make output unstable. - if detrand.Bool() { - e.out = append(e.out, ' ') - } - } - return - } - - // Multi-line. - switch { - case e.lastType == name: - e.out = append(e.out, ' ') - // Add a random extra space after name: to make output unstable. - if detrand.Bool() { - e.out = append(e.out, ' ') - } - - case e.lastType == messageOpen && next != messageClose: - e.indents = append(e.indents, e.indent...) - e.out = append(e.out, '\n') - e.out = append(e.out, e.indents...) - - case e.lastType&(scalar|messageClose) != 0: - if next == messageClose { - e.indents = e.indents[:len(e.indents)-len(e.indent)] - } - e.out = append(e.out, '\n') - e.out = append(e.out, e.indents...) - } -} - -// Snapshot returns the current snapshot for use in Reset. -func (e *Encoder) Snapshot() encoderState { - return e.encoderState -} - -// Reset resets the Encoder to the given encoderState from a Snapshot. -func (e *Encoder) Reset(es encoderState) { - e.encoderState = es -} diff --git a/vendor/google.golang.org/protobuf/internal/errors/errors.go b/vendor/google.golang.org/protobuf/internal/errors/errors.go deleted file mode 100644 index 20c17b35e..000000000 --- a/vendor/google.golang.org/protobuf/internal/errors/errors.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package errors implements functions to manipulate errors. -package errors - -import ( - "errors" - "fmt" - - "google.golang.org/protobuf/internal/detrand" -) - -// Error is a sentinel matching all errors produced by this package. -var Error = errors.New("protobuf error") - -// New formats a string according to the format specifier and arguments and -// returns an error that has a "proto" prefix. -func New(f string, x ...interface{}) error { - return &prefixError{s: format(f, x...)} -} - -type prefixError struct{ s string } - -var prefix = func() string { - // Deliberately introduce instability into the error message string to - // discourage users from performing error string comparisons. - if detrand.Bool() { - return "proto: " // use non-breaking spaces (U+00a0) - } else { - return "proto: " // use regular spaces (U+0020) - } -}() - -func (e *prefixError) Error() string { - return prefix + e.s -} - -func (e *prefixError) Unwrap() error { - return Error -} - -// Wrap returns an error that has a "proto" prefix, the formatted string described -// by the format specifier and arguments, and a suffix of err. The error wraps err. -func Wrap(err error, f string, x ...interface{}) error { - return &wrapError{ - s: format(f, x...), - err: err, - } -} - -type wrapError struct { - s string - err error -} - -func (e *wrapError) Error() string { - return format("%v%v: %v", prefix, e.s, e.err) -} - -func (e *wrapError) Unwrap() error { - return e.err -} - -func (e *wrapError) Is(target error) bool { - return target == Error -} - -func format(f string, x ...interface{}) string { - // avoid "proto: " prefix when chaining - for i := 0; i < len(x); i++ { - switch e := x[i].(type) { - case *prefixError: - x[i] = e.s - case *wrapError: - x[i] = format("%v: %v", e.s, e.err) - } - } - return fmt.Sprintf(f, x...) -} - -func InvalidUTF8(name string) error { - return New("field %v contains invalid UTF-8", name) -} - -func RequiredNotSet(name string) error { - return New("required field %v not set", name) -} diff --git a/vendor/google.golang.org/protobuf/internal/errors/is_go112.go b/vendor/google.golang.org/protobuf/internal/errors/is_go112.go deleted file mode 100644 index f90e909b3..000000000 --- a/vendor/google.golang.org/protobuf/internal/errors/is_go112.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.13 - -package errors - -import "reflect" - -// Is is a copy of Go 1.13's errors.Is for use with older Go versions. -func Is(err, target error) bool { - if target == nil { - return err == target - } - - isComparable := reflect.TypeOf(target).Comparable() - for { - if isComparable && err == target { - return true - } - if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { - return true - } - if err = unwrap(err); err == nil { - return false - } - } -} - -func unwrap(err error) error { - u, ok := err.(interface { - Unwrap() error - }) - if !ok { - return nil - } - return u.Unwrap() -} diff --git a/vendor/google.golang.org/protobuf/internal/errors/is_go113.go b/vendor/google.golang.org/protobuf/internal/errors/is_go113.go deleted file mode 100644 index dc05f4191..000000000 --- a/vendor/google.golang.org/protobuf/internal/errors/is_go113.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.13 - -package errors - -import "errors" - -// Is is errors.Is. -func Is(err, target error) bool { return errors.Is(err, target) } diff --git a/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go b/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go deleted file mode 100644 index 517c4e2a0..000000000 --- a/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fieldsort defines an ordering of fields. -// -// The ordering defined by this package matches the historic behavior of the proto -// package, placing extensions first and oneofs last. -// -// There is no guarantee about stability of the wire encoding, and users should not -// depend on the order defined in this package as it is subject to change without -// notice. -package fieldsort - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Less returns true if field a comes before field j in ordered wire marshal output. -func Less(a, b protoreflect.FieldDescriptor) bool { - ea := a.IsExtension() - eb := b.IsExtension() - oa := a.ContainingOneof() - ob := b.ContainingOneof() - switch { - case ea != eb: - return ea - case oa != nil && ob != nil: - if oa == ob { - return a.Number() < b.Number() - } - return oa.Index() < ob.Index() - case oa != nil && !oa.IsSynthetic(): - return false - case ob != nil && !ob.IsSynthetic(): - return true - default: - return a.Number() < b.Number() - } -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/build.go b/vendor/google.golang.org/protobuf/internal/filedesc/build.go deleted file mode 100644 index d02d770c9..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/build.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package filedesc provides functionality for constructing descriptors. -package filedesc - -import ( - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/reflect/protoreflect" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" -) - -// Builder construct a protoreflect.FileDescriptor from the raw descriptor. -type Builder struct { - // GoPackagePath is the Go package path that is invoking this builder. - GoPackagePath string - - // RawDescriptor is the wire-encoded bytes of FileDescriptorProto - // and must be populated. - RawDescriptor []byte - - // NumEnums is the total number of enums declared in the file. - NumEnums int32 - // NumMessages is the total number of messages declared in the file. - // It includes the implicit message declarations for map entries. - NumMessages int32 - // NumExtensions is the total number of extensions declared in the file. - NumExtensions int32 - // NumServices is the total number of services declared in the file. - NumServices int32 - - // TypeResolver resolves extension field types for descriptor options. - // If nil, it uses protoregistry.GlobalTypes. - TypeResolver interface { - preg.ExtensionTypeResolver - } - - // FileRegistry is use to lookup file, enum, and message dependencies. - // Once constructed, the file descriptor is registered here. - // If nil, it uses protoregistry.GlobalFiles. - FileRegistry interface { - FindFileByPath(string) (protoreflect.FileDescriptor, error) - FindDescriptorByName(pref.FullName) (pref.Descriptor, error) - RegisterFile(pref.FileDescriptor) error - } -} - -// resolverByIndex is an interface Builder.FileRegistry may implement. -// If so, it permits looking up an enum or message dependency based on the -// sub-list and element index into filetype.Builder.DependencyIndexes. -type resolverByIndex interface { - FindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor - FindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor -} - -// Indexes of each sub-list in filetype.Builder.DependencyIndexes. -const ( - listFieldDeps int32 = iota - listExtTargets - listExtDeps - listMethInDeps - listMethOutDeps -) - -// Out is the output of the Builder. -type Out struct { - File pref.FileDescriptor - - // Enums is all enum descriptors in "flattened ordering". - Enums []Enum - // Messages is all message descriptors in "flattened ordering". - // It includes the implicit message declarations for map entries. - Messages []Message - // Extensions is all extension descriptors in "flattened ordering". - Extensions []Extension - // Service is all service descriptors in "flattened ordering". - Services []Service -} - -// Build constructs a FileDescriptor given the parameters set in Builder. -// It assumes that the inputs are well-formed and panics if any inconsistencies -// are encountered. -// -// If NumEnums+NumMessages+NumExtensions+NumServices is zero, -// then Build automatically derives them from the raw descriptor. -func (db Builder) Build() (out Out) { - // Populate the counts if uninitialized. - if db.NumEnums+db.NumMessages+db.NumExtensions+db.NumServices == 0 { - db.unmarshalCounts(db.RawDescriptor, true) - } - - // Initialize resolvers and registries if unpopulated. - if db.TypeResolver == nil { - db.TypeResolver = preg.GlobalTypes - } - if db.FileRegistry == nil { - db.FileRegistry = preg.GlobalFiles - } - - fd := newRawFile(db) - out.File = fd - out.Enums = fd.allEnums - out.Messages = fd.allMessages - out.Extensions = fd.allExtensions - out.Services = fd.allServices - - if err := db.FileRegistry.RegisterFile(fd); err != nil { - panic(err) - } - return out -} - -// unmarshalCounts counts the number of enum, message, extension, and service -// declarations in the raw message, which is either a FileDescriptorProto -// or a MessageDescriptorProto depending on whether isFile is set. -func (db *Builder) unmarshalCounts(b []byte, isFile bool) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - if isFile { - switch num { - case genid.FileDescriptorProto_EnumType_field_number: - db.NumEnums++ - case genid.FileDescriptorProto_MessageType_field_number: - db.unmarshalCounts(v, false) - db.NumMessages++ - case genid.FileDescriptorProto_Extension_field_number: - db.NumExtensions++ - case genid.FileDescriptorProto_Service_field_number: - db.NumServices++ - } - } else { - switch num { - case genid.DescriptorProto_EnumType_field_number: - db.NumEnums++ - case genid.DescriptorProto_NestedType_field_number: - db.unmarshalCounts(v, false) - db.NumMessages++ - case genid.DescriptorProto_Extension_field_number: - db.NumExtensions++ - } - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go deleted file mode 100644 index 9385126fb..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ /dev/null @@ -1,614 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package filedesc - -import ( - "bytes" - "fmt" - "sync" - "sync/atomic" - - "google.golang.org/protobuf/internal/descfmt" - "google.golang.org/protobuf/internal/descopts" - "google.golang.org/protobuf/internal/encoding/defval" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/internal/strs" - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -// The types in this file may have a suffix: -// • L0: Contains fields common to all descriptors (except File) and -// must be initialized up front. -// • L1: Contains fields specific to a descriptor and -// must be initialized up front. -// • L2: Contains fields that are lazily initialized when constructing -// from the raw file descriptor. When constructing as a literal, the L2 -// fields must be initialized up front. -// -// The types are exported so that packages like reflect/protodesc can -// directly construct descriptors. - -type ( - File struct { - fileRaw - L1 FileL1 - - once uint32 // atomically set if L2 is valid - mu sync.Mutex // protects L2 - L2 *FileL2 - } - FileL1 struct { - Syntax pref.Syntax - Path string - Package pref.FullName - - Enums Enums - Messages Messages - Extensions Extensions - Services Services - } - FileL2 struct { - Options func() pref.ProtoMessage - Imports FileImports - Locations SourceLocations - } -) - -func (fd *File) ParentFile() pref.FileDescriptor { return fd } -func (fd *File) Parent() pref.Descriptor { return nil } -func (fd *File) Index() int { return 0 } -func (fd *File) Syntax() pref.Syntax { return fd.L1.Syntax } -func (fd *File) Name() pref.Name { return fd.L1.Package.Name() } -func (fd *File) FullName() pref.FullName { return fd.L1.Package } -func (fd *File) IsPlaceholder() bool { return false } -func (fd *File) Options() pref.ProtoMessage { - if f := fd.lazyInit().Options; f != nil { - return f() - } - return descopts.File -} -func (fd *File) Path() string { return fd.L1.Path } -func (fd *File) Package() pref.FullName { return fd.L1.Package } -func (fd *File) Imports() pref.FileImports { return &fd.lazyInit().Imports } -func (fd *File) Enums() pref.EnumDescriptors { return &fd.L1.Enums } -func (fd *File) Messages() pref.MessageDescriptors { return &fd.L1.Messages } -func (fd *File) Extensions() pref.ExtensionDescriptors { return &fd.L1.Extensions } -func (fd *File) Services() pref.ServiceDescriptors { return &fd.L1.Services } -func (fd *File) SourceLocations() pref.SourceLocations { return &fd.lazyInit().Locations } -func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) } -func (fd *File) ProtoType(pref.FileDescriptor) {} -func (fd *File) ProtoInternal(pragma.DoNotImplement) {} - -func (fd *File) lazyInit() *FileL2 { - if atomic.LoadUint32(&fd.once) == 0 { - fd.lazyInitOnce() - } - return fd.L2 -} - -func (fd *File) lazyInitOnce() { - fd.mu.Lock() - if fd.L2 == nil { - fd.lazyRawInit() // recursively initializes all L2 structures - } - atomic.StoreUint32(&fd.once, 1) - fd.mu.Unlock() -} - -// ProtoLegacyRawDesc is a pseudo-internal API for allowing the v1 code -// to be able to retrieve the raw descriptor. -// -// WARNING: This method is exempt from the compatibility promise and may be -// removed in the future without warning. -func (fd *File) ProtoLegacyRawDesc() []byte { - return fd.builder.RawDescriptor -} - -// GoPackagePath is a pseudo-internal API for determining the Go package path -// that this file descriptor is declared in. -// -// WARNING: This method is exempt from the compatibility promise and may be -// removed in the future without warning. -func (fd *File) GoPackagePath() string { - return fd.builder.GoPackagePath -} - -type ( - Enum struct { - Base - L1 EnumL1 - L2 *EnumL2 // protected by fileDesc.once - } - EnumL1 struct { - eagerValues bool // controls whether EnumL2.Values is already populated - } - EnumL2 struct { - Options func() pref.ProtoMessage - Values EnumValues - ReservedNames Names - ReservedRanges EnumRanges - } - - EnumValue struct { - Base - L1 EnumValueL1 - } - EnumValueL1 struct { - Options func() pref.ProtoMessage - Number pref.EnumNumber - } -) - -func (ed *Enum) Options() pref.ProtoMessage { - if f := ed.lazyInit().Options; f != nil { - return f() - } - return descopts.Enum -} -func (ed *Enum) Values() pref.EnumValueDescriptors { - if ed.L1.eagerValues { - return &ed.L2.Values - } - return &ed.lazyInit().Values -} -func (ed *Enum) ReservedNames() pref.Names { return &ed.lazyInit().ReservedNames } -func (ed *Enum) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().ReservedRanges } -func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) } -func (ed *Enum) ProtoType(pref.EnumDescriptor) {} -func (ed *Enum) lazyInit() *EnumL2 { - ed.L0.ParentFile.lazyInit() // implicitly initializes L2 - return ed.L2 -} - -func (ed *EnumValue) Options() pref.ProtoMessage { - if f := ed.L1.Options; f != nil { - return f() - } - return descopts.EnumValue -} -func (ed *EnumValue) Number() pref.EnumNumber { return ed.L1.Number } -func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) } -func (ed *EnumValue) ProtoType(pref.EnumValueDescriptor) {} - -type ( - Message struct { - Base - L1 MessageL1 - L2 *MessageL2 // protected by fileDesc.once - } - MessageL1 struct { - Enums Enums - Messages Messages - Extensions Extensions - IsMapEntry bool // promoted from google.protobuf.MessageOptions - IsMessageSet bool // promoted from google.protobuf.MessageOptions - } - MessageL2 struct { - Options func() pref.ProtoMessage - Fields Fields - Oneofs Oneofs - ReservedNames Names - ReservedRanges FieldRanges - RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality - ExtensionRanges FieldRanges - ExtensionRangeOptions []func() pref.ProtoMessage // must be same length as ExtensionRanges - } - - Field struct { - Base - L1 FieldL1 - } - FieldL1 struct { - Options func() pref.ProtoMessage - Number pref.FieldNumber - Cardinality pref.Cardinality // must be consistent with Message.RequiredNumbers - Kind pref.Kind - JSONName jsonName - IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto - IsWeak bool // promoted from google.protobuf.FieldOptions - HasPacked bool // promoted from google.protobuf.FieldOptions - IsPacked bool // promoted from google.protobuf.FieldOptions - HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions - EnforceUTF8 bool // promoted from google.protobuf.FieldOptions - Default defaultValue - ContainingOneof pref.OneofDescriptor // must be consistent with Message.Oneofs.Fields - Enum pref.EnumDescriptor - Message pref.MessageDescriptor - } - - Oneof struct { - Base - L1 OneofL1 - } - OneofL1 struct { - Options func() pref.ProtoMessage - Fields OneofFields // must be consistent with Message.Fields.ContainingOneof - } -) - -func (md *Message) Options() pref.ProtoMessage { - if f := md.lazyInit().Options; f != nil { - return f() - } - return descopts.Message -} -func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry } -func (md *Message) Fields() pref.FieldDescriptors { return &md.lazyInit().Fields } -func (md *Message) Oneofs() pref.OneofDescriptors { return &md.lazyInit().Oneofs } -func (md *Message) ReservedNames() pref.Names { return &md.lazyInit().ReservedNames } -func (md *Message) ReservedRanges() pref.FieldRanges { return &md.lazyInit().ReservedRanges } -func (md *Message) RequiredNumbers() pref.FieldNumbers { return &md.lazyInit().RequiredNumbers } -func (md *Message) ExtensionRanges() pref.FieldRanges { return &md.lazyInit().ExtensionRanges } -func (md *Message) ExtensionRangeOptions(i int) pref.ProtoMessage { - if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil { - return f() - } - return descopts.ExtensionRange -} -func (md *Message) Enums() pref.EnumDescriptors { return &md.L1.Enums } -func (md *Message) Messages() pref.MessageDescriptors { return &md.L1.Messages } -func (md *Message) Extensions() pref.ExtensionDescriptors { return &md.L1.Extensions } -func (md *Message) ProtoType(pref.MessageDescriptor) {} -func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) } -func (md *Message) lazyInit() *MessageL2 { - md.L0.ParentFile.lazyInit() // implicitly initializes L2 - return md.L2 -} - -// IsMessageSet is a pseudo-internal API for checking whether a message -// should serialize in the proto1 message format. -// -// WARNING: This method is exempt from the compatibility promise and may be -// removed in the future without warning. -func (md *Message) IsMessageSet() bool { - return md.L1.IsMessageSet -} - -func (fd *Field) Options() pref.ProtoMessage { - if f := fd.L1.Options; f != nil { - return f() - } - return descopts.Field -} -func (fd *Field) Number() pref.FieldNumber { return fd.L1.Number } -func (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality } -func (fd *Field) Kind() pref.Kind { return fd.L1.Kind } -func (fd *Field) HasJSONName() bool { return fd.L1.JSONName.has } -func (fd *Field) JSONName() string { return fd.L1.JSONName.get(fd) } -func (fd *Field) HasPresence() bool { - return fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil) -} -func (fd *Field) HasOptionalKeyword() bool { - return (fd.L0.ParentFile.L1.Syntax == pref.Proto2 && fd.L1.Cardinality == pref.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional -} -func (fd *Field) IsPacked() bool { - if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != pref.Proto2 && fd.L1.Cardinality == pref.Repeated { - switch fd.L1.Kind { - case pref.StringKind, pref.BytesKind, pref.MessageKind, pref.GroupKind: - default: - return true - } - } - return fd.L1.IsPacked -} -func (fd *Field) IsExtension() bool { return false } -func (fd *Field) IsWeak() bool { return fd.L1.IsWeak } -func (fd *Field) IsList() bool { return fd.Cardinality() == pref.Repeated && !fd.IsMap() } -func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() } -func (fd *Field) MapKey() pref.FieldDescriptor { - if !fd.IsMap() { - return nil - } - return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number) -} -func (fd *Field) MapValue() pref.FieldDescriptor { - if !fd.IsMap() { - return nil - } - return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number) -} -func (fd *Field) HasDefault() bool { return fd.L1.Default.has } -func (fd *Field) Default() pref.Value { return fd.L1.Default.get(fd) } -func (fd *Field) DefaultEnumValue() pref.EnumValueDescriptor { return fd.L1.Default.enum } -func (fd *Field) ContainingOneof() pref.OneofDescriptor { return fd.L1.ContainingOneof } -func (fd *Field) ContainingMessage() pref.MessageDescriptor { - return fd.L0.Parent.(pref.MessageDescriptor) -} -func (fd *Field) Enum() pref.EnumDescriptor { - return fd.L1.Enum -} -func (fd *Field) Message() pref.MessageDescriptor { - if fd.L1.IsWeak { - if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil { - return d.(pref.MessageDescriptor) - } - } - return fd.L1.Message -} -func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) } -func (fd *Field) ProtoType(pref.FieldDescriptor) {} - -// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8 -// validation for the string field. This exists for Google-internal use only -// since proto3 did not enforce UTF-8 validity prior to the open-source release. -// If this method does not exist, the default is to enforce valid UTF-8. -// -// WARNING: This method is exempt from the compatibility promise and may be -// removed in the future without warning. -func (fd *Field) EnforceUTF8() bool { - if fd.L1.HasEnforceUTF8 { - return fd.L1.EnforceUTF8 - } - return fd.L0.ParentFile.L1.Syntax == pref.Proto3 -} - -func (od *Oneof) IsSynthetic() bool { - return od.L0.ParentFile.L1.Syntax == pref.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword() -} -func (od *Oneof) Options() pref.ProtoMessage { - if f := od.L1.Options; f != nil { - return f() - } - return descopts.Oneof -} -func (od *Oneof) Fields() pref.FieldDescriptors { return &od.L1.Fields } -func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) } -func (od *Oneof) ProtoType(pref.OneofDescriptor) {} - -type ( - Extension struct { - Base - L1 ExtensionL1 - L2 *ExtensionL2 // protected by fileDesc.once - } - ExtensionL1 struct { - Number pref.FieldNumber - Extendee pref.MessageDescriptor - Cardinality pref.Cardinality - Kind pref.Kind - } - ExtensionL2 struct { - Options func() pref.ProtoMessage - JSONName jsonName - IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto - IsPacked bool // promoted from google.protobuf.FieldOptions - Default defaultValue - Enum pref.EnumDescriptor - Message pref.MessageDescriptor - } -) - -func (xd *Extension) Options() pref.ProtoMessage { - if f := xd.lazyInit().Options; f != nil { - return f() - } - return descopts.Field -} -func (xd *Extension) Number() pref.FieldNumber { return xd.L1.Number } -func (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality } -func (xd *Extension) Kind() pref.Kind { return xd.L1.Kind } -func (xd *Extension) HasJSONName() bool { return xd.lazyInit().JSONName.has } -func (xd *Extension) JSONName() string { return xd.lazyInit().JSONName.get(xd) } -func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != pref.Repeated } -func (xd *Extension) HasOptionalKeyword() bool { - return (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional -} -func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked } -func (xd *Extension) IsExtension() bool { return true } -func (xd *Extension) IsWeak() bool { return false } -func (xd *Extension) IsList() bool { return xd.Cardinality() == pref.Repeated } -func (xd *Extension) IsMap() bool { return false } -func (xd *Extension) MapKey() pref.FieldDescriptor { return nil } -func (xd *Extension) MapValue() pref.FieldDescriptor { return nil } -func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has } -func (xd *Extension) Default() pref.Value { return xd.lazyInit().Default.get(xd) } -func (xd *Extension) DefaultEnumValue() pref.EnumValueDescriptor { return xd.lazyInit().Default.enum } -func (xd *Extension) ContainingOneof() pref.OneofDescriptor { return nil } -func (xd *Extension) ContainingMessage() pref.MessageDescriptor { return xd.L1.Extendee } -func (xd *Extension) Enum() pref.EnumDescriptor { return xd.lazyInit().Enum } -func (xd *Extension) Message() pref.MessageDescriptor { return xd.lazyInit().Message } -func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) } -func (xd *Extension) ProtoType(pref.FieldDescriptor) {} -func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {} -func (xd *Extension) lazyInit() *ExtensionL2 { - xd.L0.ParentFile.lazyInit() // implicitly initializes L2 - return xd.L2 -} - -type ( - Service struct { - Base - L1 ServiceL1 - L2 *ServiceL2 // protected by fileDesc.once - } - ServiceL1 struct{} - ServiceL2 struct { - Options func() pref.ProtoMessage - Methods Methods - } - - Method struct { - Base - L1 MethodL1 - } - MethodL1 struct { - Options func() pref.ProtoMessage - Input pref.MessageDescriptor - Output pref.MessageDescriptor - IsStreamingClient bool - IsStreamingServer bool - } -) - -func (sd *Service) Options() pref.ProtoMessage { - if f := sd.lazyInit().Options; f != nil { - return f() - } - return descopts.Service -} -func (sd *Service) Methods() pref.MethodDescriptors { return &sd.lazyInit().Methods } -func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) } -func (sd *Service) ProtoType(pref.ServiceDescriptor) {} -func (sd *Service) ProtoInternal(pragma.DoNotImplement) {} -func (sd *Service) lazyInit() *ServiceL2 { - sd.L0.ParentFile.lazyInit() // implicitly initializes L2 - return sd.L2 -} - -func (md *Method) Options() pref.ProtoMessage { - if f := md.L1.Options; f != nil { - return f() - } - return descopts.Method -} -func (md *Method) Input() pref.MessageDescriptor { return md.L1.Input } -func (md *Method) Output() pref.MessageDescriptor { return md.L1.Output } -func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient } -func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer } -func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) } -func (md *Method) ProtoType(pref.MethodDescriptor) {} -func (md *Method) ProtoInternal(pragma.DoNotImplement) {} - -// Surrogate files are can be used to create standalone descriptors -// where the syntax is only information derived from the parent file. -var ( - SurrogateProto2 = &File{L1: FileL1{Syntax: pref.Proto2}, L2: &FileL2{}} - SurrogateProto3 = &File{L1: FileL1{Syntax: pref.Proto3}, L2: &FileL2{}} -) - -type ( - Base struct { - L0 BaseL0 - } - BaseL0 struct { - FullName pref.FullName // must be populated - ParentFile *File // must be populated - Parent pref.Descriptor - Index int - } -) - -func (d *Base) Name() pref.Name { return d.L0.FullName.Name() } -func (d *Base) FullName() pref.FullName { return d.L0.FullName } -func (d *Base) ParentFile() pref.FileDescriptor { - if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 { - return nil // surrogate files are not real parents - } - return d.L0.ParentFile -} -func (d *Base) Parent() pref.Descriptor { return d.L0.Parent } -func (d *Base) Index() int { return d.L0.Index } -func (d *Base) Syntax() pref.Syntax { return d.L0.ParentFile.Syntax() } -func (d *Base) IsPlaceholder() bool { return false } -func (d *Base) ProtoInternal(pragma.DoNotImplement) {} - -type jsonName struct { - has bool - once sync.Once - name string -} - -// Init initializes the name. It is exported for use by other internal packages. -func (js *jsonName) Init(s string) { - js.has = true - js.name = s -} - -func (js *jsonName) get(fd pref.FieldDescriptor) string { - if !js.has { - js.once.Do(func() { - js.name = strs.JSONCamelCase(string(fd.Name())) - }) - } - return js.name -} - -func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue { - dv := defaultValue{has: v.IsValid(), val: v, enum: ev} - if b, ok := v.Interface().([]byte); ok { - // Store a copy of the default bytes, so that we can detect - // accidental mutations of the original value. - dv.bytes = append([]byte(nil), b...) - } - return dv -} - -func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) defaultValue { - var evs pref.EnumValueDescriptors - if k == pref.EnumKind { - // If the enum is declared within the same file, be careful not to - // blindly call the Values method, lest we bind ourselves in a deadlock. - if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf { - evs = &e.L2.Values - } else { - evs = ed.Values() - } - - // If we are unable to resolve the enum dependency, use a placeholder - // enum value since we will not be able to parse the default value. - if ed.IsPlaceholder() && pref.Name(b).IsValid() { - v := pref.ValueOfEnum(0) - ev := PlaceholderEnumValue(ed.FullName().Parent().Append(pref.Name(b))) - return DefaultValue(v, ev) - } - } - - v, ev, err := defval.Unmarshal(string(b), k, evs, defval.Descriptor) - if err != nil { - panic(err) - } - return DefaultValue(v, ev) -} - -type defaultValue struct { - has bool - val pref.Value - enum pref.EnumValueDescriptor - bytes []byte -} - -func (dv *defaultValue) get(fd pref.FieldDescriptor) pref.Value { - // Return the zero value as the default if unpopulated. - if !dv.has { - if fd.Cardinality() == pref.Repeated { - return pref.Value{} - } - switch fd.Kind() { - case pref.BoolKind: - return pref.ValueOfBool(false) - case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind: - return pref.ValueOfInt32(0) - case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind: - return pref.ValueOfInt64(0) - case pref.Uint32Kind, pref.Fixed32Kind: - return pref.ValueOfUint32(0) - case pref.Uint64Kind, pref.Fixed64Kind: - return pref.ValueOfUint64(0) - case pref.FloatKind: - return pref.ValueOfFloat32(0) - case pref.DoubleKind: - return pref.ValueOfFloat64(0) - case pref.StringKind: - return pref.ValueOfString("") - case pref.BytesKind: - return pref.ValueOfBytes(nil) - case pref.EnumKind: - if evs := fd.Enum().Values(); evs.Len() > 0 { - return pref.ValueOfEnum(evs.Get(0).Number()) - } - return pref.ValueOfEnum(0) - } - } - - if len(dv.bytes) > 0 && !bytes.Equal(dv.bytes, dv.val.Bytes()) { - // TODO: Avoid panic if we're running with the race detector - // and instead spawn a goroutine that periodically resets - // this value back to the original to induce a race. - panic(fmt.Sprintf("detected mutation on the default bytes for %v", fd.FullName())) - } - return dv.val -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go deleted file mode 100644 index 66e1fee52..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package filedesc - -import ( - "sync" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/strs" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// fileRaw is a data struct used when initializing a file descriptor from -// a raw FileDescriptorProto. -type fileRaw struct { - builder Builder - allEnums []Enum - allMessages []Message - allExtensions []Extension - allServices []Service -} - -func newRawFile(db Builder) *File { - fd := &File{fileRaw: fileRaw{builder: db}} - fd.initDecls(db.NumEnums, db.NumMessages, db.NumExtensions, db.NumServices) - fd.unmarshalSeed(db.RawDescriptor) - - // Extended message targets are eagerly resolved since registration - // needs this information at program init time. - for i := range fd.allExtensions { - xd := &fd.allExtensions[i] - xd.L1.Extendee = fd.resolveMessageDependency(xd.L1.Extendee, listExtTargets, int32(i)) - } - - fd.checkDecls() - return fd -} - -// initDecls pre-allocates slices for the exact number of enums, messages -// (including map entries), extensions, and services declared in the proto file. -// This is done to avoid regrowing the slice, which would change the address -// for any previously seen declaration. -// -// The alloc methods "allocates" slices by pulling from the capacity. -func (fd *File) initDecls(numEnums, numMessages, numExtensions, numServices int32) { - fd.allEnums = make([]Enum, 0, numEnums) - fd.allMessages = make([]Message, 0, numMessages) - fd.allExtensions = make([]Extension, 0, numExtensions) - fd.allServices = make([]Service, 0, numServices) -} - -func (fd *File) allocEnums(n int) []Enum { - total := len(fd.allEnums) - es := fd.allEnums[total : total+n] - fd.allEnums = fd.allEnums[:total+n] - return es -} -func (fd *File) allocMessages(n int) []Message { - total := len(fd.allMessages) - ms := fd.allMessages[total : total+n] - fd.allMessages = fd.allMessages[:total+n] - return ms -} -func (fd *File) allocExtensions(n int) []Extension { - total := len(fd.allExtensions) - xs := fd.allExtensions[total : total+n] - fd.allExtensions = fd.allExtensions[:total+n] - return xs -} -func (fd *File) allocServices(n int) []Service { - total := len(fd.allServices) - xs := fd.allServices[total : total+n] - fd.allServices = fd.allServices[:total+n] - return xs -} - -// checkDecls performs a sanity check that the expected number of expected -// declarations matches the number that were found in the descriptor proto. -func (fd *File) checkDecls() { - switch { - case len(fd.allEnums) != cap(fd.allEnums): - case len(fd.allMessages) != cap(fd.allMessages): - case len(fd.allExtensions) != cap(fd.allExtensions): - case len(fd.allServices) != cap(fd.allServices): - default: - return - } - panic("mismatching cardinality") -} - -func (fd *File) unmarshalSeed(b []byte) { - sb := getBuilder() - defer putBuilder(sb) - - var prevField pref.FieldNumber - var numEnums, numMessages, numExtensions, numServices int - var posEnums, posMessages, posExtensions, posServices int - b0 := b - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.FileDescriptorProto_Syntax_field_number: - switch string(v) { - case "proto2": - fd.L1.Syntax = pref.Proto2 - case "proto3": - fd.L1.Syntax = pref.Proto3 - default: - panic("invalid syntax") - } - case genid.FileDescriptorProto_Name_field_number: - fd.L1.Path = sb.MakeString(v) - case genid.FileDescriptorProto_Package_field_number: - fd.L1.Package = pref.FullName(sb.MakeString(v)) - case genid.FileDescriptorProto_EnumType_field_number: - if prevField != genid.FileDescriptorProto_EnumType_field_number { - if numEnums > 0 { - panic("non-contiguous repeated field") - } - posEnums = len(b0) - len(b) - n - m - } - numEnums++ - case genid.FileDescriptorProto_MessageType_field_number: - if prevField != genid.FileDescriptorProto_MessageType_field_number { - if numMessages > 0 { - panic("non-contiguous repeated field") - } - posMessages = len(b0) - len(b) - n - m - } - numMessages++ - case genid.FileDescriptorProto_Extension_field_number: - if prevField != genid.FileDescriptorProto_Extension_field_number { - if numExtensions > 0 { - panic("non-contiguous repeated field") - } - posExtensions = len(b0) - len(b) - n - m - } - numExtensions++ - case genid.FileDescriptorProto_Service_field_number: - if prevField != genid.FileDescriptorProto_Service_field_number { - if numServices > 0 { - panic("non-contiguous repeated field") - } - posServices = len(b0) - len(b) - n - m - } - numServices++ - } - prevField = num - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - prevField = -1 // ignore known field numbers of unknown wire type - } - } - - // If syntax is missing, it is assumed to be proto2. - if fd.L1.Syntax == 0 { - fd.L1.Syntax = pref.Proto2 - } - - // Must allocate all declarations before parsing each descriptor type - // to ensure we handled all descriptors in "flattened ordering". - if numEnums > 0 { - fd.L1.Enums.List = fd.allocEnums(numEnums) - } - if numMessages > 0 { - fd.L1.Messages.List = fd.allocMessages(numMessages) - } - if numExtensions > 0 { - fd.L1.Extensions.List = fd.allocExtensions(numExtensions) - } - if numServices > 0 { - fd.L1.Services.List = fd.allocServices(numServices) - } - - if numEnums > 0 { - b := b0[posEnums:] - for i := range fd.L1.Enums.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - fd.L1.Enums.List[i].unmarshalSeed(v, sb, fd, fd, i) - b = b[n+m:] - } - } - if numMessages > 0 { - b := b0[posMessages:] - for i := range fd.L1.Messages.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - fd.L1.Messages.List[i].unmarshalSeed(v, sb, fd, fd, i) - b = b[n+m:] - } - } - if numExtensions > 0 { - b := b0[posExtensions:] - for i := range fd.L1.Extensions.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - fd.L1.Extensions.List[i].unmarshalSeed(v, sb, fd, fd, i) - b = b[n+m:] - } - } - if numServices > 0 { - b := b0[posServices:] - for i := range fd.L1.Services.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - fd.L1.Services.List[i].unmarshalSeed(v, sb, fd, fd, i) - b = b[n+m:] - } - } -} - -func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - ed.L0.ParentFile = pf - ed.L0.Parent = pd - ed.L0.Index = i - - var numValues int - for b := b; len(b) > 0; { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.EnumDescriptorProto_Name_field_number: - ed.L0.FullName = appendFullName(sb, pd.FullName(), v) - case genid.EnumDescriptorProto_Value_field_number: - numValues++ - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - - // Only construct enum value descriptors for top-level enums since - // they are needed for registration. - if pd != pf { - return - } - ed.L1.eagerValues = true - ed.L2 = new(EnumL2) - ed.L2.Values.List = make([]EnumValue, numValues) - for i := 0; len(b) > 0; { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.EnumDescriptorProto_Value_field_number: - ed.L2.Values.List[i].unmarshalFull(v, sb, pf, ed, i) - i++ - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - md.L0.ParentFile = pf - md.L0.Parent = pd - md.L0.Index = i - - var prevField pref.FieldNumber - var numEnums, numMessages, numExtensions int - var posEnums, posMessages, posExtensions int - b0 := b - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.DescriptorProto_Name_field_number: - md.L0.FullName = appendFullName(sb, pd.FullName(), v) - case genid.DescriptorProto_EnumType_field_number: - if prevField != genid.DescriptorProto_EnumType_field_number { - if numEnums > 0 { - panic("non-contiguous repeated field") - } - posEnums = len(b0) - len(b) - n - m - } - numEnums++ - case genid.DescriptorProto_NestedType_field_number: - if prevField != genid.DescriptorProto_NestedType_field_number { - if numMessages > 0 { - panic("non-contiguous repeated field") - } - posMessages = len(b0) - len(b) - n - m - } - numMessages++ - case genid.DescriptorProto_Extension_field_number: - if prevField != genid.DescriptorProto_Extension_field_number { - if numExtensions > 0 { - panic("non-contiguous repeated field") - } - posExtensions = len(b0) - len(b) - n - m - } - numExtensions++ - case genid.DescriptorProto_Options_field_number: - md.unmarshalSeedOptions(v) - } - prevField = num - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - prevField = -1 // ignore known field numbers of unknown wire type - } - } - - // Must allocate all declarations before parsing each descriptor type - // to ensure we handled all descriptors in "flattened ordering". - if numEnums > 0 { - md.L1.Enums.List = pf.allocEnums(numEnums) - } - if numMessages > 0 { - md.L1.Messages.List = pf.allocMessages(numMessages) - } - if numExtensions > 0 { - md.L1.Extensions.List = pf.allocExtensions(numExtensions) - } - - if numEnums > 0 { - b := b0[posEnums:] - for i := range md.L1.Enums.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - md.L1.Enums.List[i].unmarshalSeed(v, sb, pf, md, i) - b = b[n+m:] - } - } - if numMessages > 0 { - b := b0[posMessages:] - for i := range md.L1.Messages.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - md.L1.Messages.List[i].unmarshalSeed(v, sb, pf, md, i) - b = b[n+m:] - } - } - if numExtensions > 0 { - b := b0[posExtensions:] - for i := range md.L1.Extensions.List { - _, n := protowire.ConsumeVarint(b) - v, m := protowire.ConsumeBytes(b[n:]) - md.L1.Extensions.List[i].unmarshalSeed(v, sb, pf, md, i) - b = b[n+m:] - } - } -} - -func (md *Message) unmarshalSeedOptions(b []byte) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.MessageOptions_MapEntry_field_number: - md.L1.IsMapEntry = protowire.DecodeBool(v) - case genid.MessageOptions_MessageSetWireFormat_field_number: - md.L1.IsMessageSet = protowire.DecodeBool(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - xd.L0.ParentFile = pf - xd.L0.Parent = pd - xd.L0.Index = i - - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FieldDescriptorProto_Number_field_number: - xd.L1.Number = pref.FieldNumber(v) - case genid.FieldDescriptorProto_Label_field_number: - xd.L1.Cardinality = pref.Cardinality(v) - case genid.FieldDescriptorProto_Type_field_number: - xd.L1.Kind = pref.Kind(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.FieldDescriptorProto_Name_field_number: - xd.L0.FullName = appendFullName(sb, pd.FullName(), v) - case genid.FieldDescriptorProto_Extendee_field_number: - xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v)) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - sd.L0.ParentFile = pf - sd.L0.Parent = pd - sd.L0.Index = i - - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.ServiceDescriptorProto_Name_field_number: - sd.L0.FullName = appendFullName(sb, pd.FullName(), v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -var nameBuilderPool = sync.Pool{ - New: func() interface{} { return new(strs.Builder) }, -} - -func getBuilder() *strs.Builder { - return nameBuilderPool.Get().(*strs.Builder) -} -func putBuilder(b *strs.Builder) { - nameBuilderPool.Put(b) -} - -// makeFullName converts b to a protoreflect.FullName, -// where b must start with a leading dot. -func makeFullName(sb *strs.Builder, b []byte) pref.FullName { - if len(b) == 0 || b[0] != '.' { - panic("name reference must be fully qualified") - } - return pref.FullName(sb.MakeString(b[1:])) -} - -func appendFullName(sb *strs.Builder, prefix pref.FullName, suffix []byte) pref.FullName { - return sb.AppendFullName(prefix, pref.Name(strs.UnsafeString(suffix))) -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go deleted file mode 100644 index e672233e7..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ /dev/null @@ -1,704 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package filedesc - -import ( - "reflect" - "sync" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/descopts" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/proto" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -func (fd *File) lazyRawInit() { - fd.unmarshalFull(fd.builder.RawDescriptor) - fd.resolveMessages() - fd.resolveExtensions() - fd.resolveServices() -} - -func (file *File) resolveMessages() { - var depIdx int32 - for i := range file.allMessages { - md := &file.allMessages[i] - - // Resolve message field dependencies. - for j := range md.L2.Fields.List { - fd := &md.L2.Fields.List[j] - - // Weak fields are resolved upon actual use. - if fd.L1.IsWeak { - continue - } - - // Resolve message field dependency. - switch fd.L1.Kind { - case pref.EnumKind: - fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx) - depIdx++ - case pref.MessageKind, pref.GroupKind: - fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx) - depIdx++ - } - - // Default is resolved here since it depends on Enum being resolved. - if v := fd.L1.Default.val; v.IsValid() { - fd.L1.Default = unmarshalDefault(v.Bytes(), fd.L1.Kind, file, fd.L1.Enum) - } - } - } -} - -func (file *File) resolveExtensions() { - var depIdx int32 - for i := range file.allExtensions { - xd := &file.allExtensions[i] - - // Resolve extension field dependency. - switch xd.L1.Kind { - case pref.EnumKind: - xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx) - depIdx++ - case pref.MessageKind, pref.GroupKind: - xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx) - depIdx++ - } - - // Default is resolved here since it depends on Enum being resolved. - if v := xd.L2.Default.val; v.IsValid() { - xd.L2.Default = unmarshalDefault(v.Bytes(), xd.L1.Kind, file, xd.L2.Enum) - } - } -} - -func (file *File) resolveServices() { - var depIdx int32 - for i := range file.allServices { - sd := &file.allServices[i] - - // Resolve method dependencies. - for j := range sd.L2.Methods.List { - md := &sd.L2.Methods.List[j] - md.L1.Input = file.resolveMessageDependency(md.L1.Input, listMethInDeps, depIdx) - md.L1.Output = file.resolveMessageDependency(md.L1.Output, listMethOutDeps, depIdx) - depIdx++ - } - } -} - -func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref.EnumDescriptor { - r := file.builder.FileRegistry - if r, ok := r.(resolverByIndex); ok { - if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil { - return ed2 - } - } - for i := range file.allEnums { - if ed2 := &file.allEnums[i]; ed2.L0.FullName == ed.FullName() { - return ed2 - } - } - if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil { - return d.(pref.EnumDescriptor) - } - return ed -} - -func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32) pref.MessageDescriptor { - r := file.builder.FileRegistry - if r, ok := r.(resolverByIndex); ok { - if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil { - return md2 - } - } - for i := range file.allMessages { - if md2 := &file.allMessages[i]; md2.L0.FullName == md.FullName() { - return md2 - } - } - if d, _ := r.FindDescriptorByName(md.FullName()); d != nil { - return d.(pref.MessageDescriptor) - } - return md -} - -func (fd *File) unmarshalFull(b []byte) { - sb := getBuilder() - defer putBuilder(sb) - - var enumIdx, messageIdx, extensionIdx, serviceIdx int - var rawOptions []byte - fd.L2 = new(FileL2) - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FileDescriptorProto_PublicDependency_field_number: - fd.L2.Imports[v].IsPublic = true - case genid.FileDescriptorProto_WeakDependency_field_number: - fd.L2.Imports[v].IsWeak = true - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.FileDescriptorProto_Dependency_field_number: - path := sb.MakeString(v) - imp, _ := fd.builder.FileRegistry.FindFileByPath(path) - if imp == nil { - imp = PlaceholderFile(path) - } - fd.L2.Imports = append(fd.L2.Imports, pref.FileImport{FileDescriptor: imp}) - case genid.FileDescriptorProto_EnumType_field_number: - fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb) - enumIdx++ - case genid.FileDescriptorProto_MessageType_field_number: - fd.L1.Messages.List[messageIdx].unmarshalFull(v, sb) - messageIdx++ - case genid.FileDescriptorProto_Extension_field_number: - fd.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb) - extensionIdx++ - case genid.FileDescriptorProto_Service_field_number: - fd.L1.Services.List[serviceIdx].unmarshalFull(v, sb) - serviceIdx++ - case genid.FileDescriptorProto_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - fd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions) -} - -func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) { - var rawValues [][]byte - var rawOptions []byte - if !ed.L1.eagerValues { - ed.L2 = new(EnumL2) - } - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.EnumDescriptorProto_Value_field_number: - rawValues = append(rawValues, v) - case genid.EnumDescriptorProto_ReservedName_field_number: - ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, pref.Name(sb.MakeString(v))) - case genid.EnumDescriptorProto_ReservedRange_field_number: - ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v)) - case genid.EnumDescriptorProto_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - if !ed.L1.eagerValues && len(rawValues) > 0 { - ed.L2.Values.List = make([]EnumValue, len(rawValues)) - for i, b := range rawValues { - ed.L2.Values.List[i].unmarshalFull(b, sb, ed.L0.ParentFile, ed, i) - } - } - ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions) -} - -func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number: - r[0] = pref.EnumNumber(v) - case genid.EnumDescriptorProto_EnumReservedRange_End_field_number: - r[1] = pref.EnumNumber(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - return r -} - -func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - vd.L0.ParentFile = pf - vd.L0.Parent = pd - vd.L0.Index = i - - var rawOptions []byte - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.EnumValueDescriptorProto_Number_field_number: - vd.L1.Number = pref.EnumNumber(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.EnumValueDescriptorProto_Name_field_number: - // NOTE: Enum values are in the same scope as the enum parent. - vd.L0.FullName = appendFullName(sb, pd.Parent().FullName(), v) - case genid.EnumValueDescriptorProto_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - vd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.EnumValue, rawOptions) -} - -func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) { - var rawFields, rawOneofs [][]byte - var enumIdx, messageIdx, extensionIdx int - var rawOptions []byte - md.L2 = new(MessageL2) - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.DescriptorProto_Field_field_number: - rawFields = append(rawFields, v) - case genid.DescriptorProto_OneofDecl_field_number: - rawOneofs = append(rawOneofs, v) - case genid.DescriptorProto_ReservedName_field_number: - md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, pref.Name(sb.MakeString(v))) - case genid.DescriptorProto_ReservedRange_field_number: - md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v)) - case genid.DescriptorProto_ExtensionRange_field_number: - r, rawOptions := unmarshalMessageExtensionRange(v) - opts := md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.ExtensionRange, rawOptions) - md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, r) - md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, opts) - case genid.DescriptorProto_EnumType_field_number: - md.L1.Enums.List[enumIdx].unmarshalFull(v, sb) - enumIdx++ - case genid.DescriptorProto_NestedType_field_number: - md.L1.Messages.List[messageIdx].unmarshalFull(v, sb) - messageIdx++ - case genid.DescriptorProto_Extension_field_number: - md.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb) - extensionIdx++ - case genid.DescriptorProto_Options_field_number: - md.unmarshalOptions(v) - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - if len(rawFields) > 0 || len(rawOneofs) > 0 { - md.L2.Fields.List = make([]Field, len(rawFields)) - md.L2.Oneofs.List = make([]Oneof, len(rawOneofs)) - for i, b := range rawFields { - fd := &md.L2.Fields.List[i] - fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i) - if fd.L1.Cardinality == pref.Required { - md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number) - } - } - for i, b := range rawOneofs { - od := &md.L2.Oneofs.List[i] - od.unmarshalFull(b, sb, md.L0.ParentFile, md, i) - } - } - md.L2.Options = md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Message, rawOptions) -} - -func (md *Message) unmarshalOptions(b []byte) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.MessageOptions_MapEntry_field_number: - md.L1.IsMapEntry = protowire.DecodeBool(v) - case genid.MessageOptions_MessageSetWireFormat_field_number: - md.L1.IsMessageSet = protowire.DecodeBool(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.DescriptorProto_ReservedRange_Start_field_number: - r[0] = pref.FieldNumber(v) - case genid.DescriptorProto_ReservedRange_End_field_number: - r[1] = pref.FieldNumber(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - return r -} - -func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.DescriptorProto_ExtensionRange_Start_field_number: - r[0] = pref.FieldNumber(v) - case genid.DescriptorProto_ExtensionRange_End_field_number: - r[1] = pref.FieldNumber(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.DescriptorProto_ExtensionRange_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - return r, rawOptions -} - -func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - fd.L0.ParentFile = pf - fd.L0.Parent = pd - fd.L0.Index = i - - var rawTypeName []byte - var rawOptions []byte - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FieldDescriptorProto_Number_field_number: - fd.L1.Number = pref.FieldNumber(v) - case genid.FieldDescriptorProto_Label_field_number: - fd.L1.Cardinality = pref.Cardinality(v) - case genid.FieldDescriptorProto_Type_field_number: - fd.L1.Kind = pref.Kind(v) - case genid.FieldDescriptorProto_OneofIndex_field_number: - // In Message.unmarshalFull, we allocate slices for both - // the field and oneof descriptors before unmarshaling either - // of them. This ensures pointers to slice elements are stable. - od := &pd.(*Message).L2.Oneofs.List[v] - od.L1.Fields.List = append(od.L1.Fields.List, fd) - if fd.L1.ContainingOneof != nil { - panic("oneof type already set") - } - fd.L1.ContainingOneof = od - case genid.FieldDescriptorProto_Proto3Optional_field_number: - fd.L1.IsProto3Optional = protowire.DecodeBool(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.FieldDescriptorProto_Name_field_number: - fd.L0.FullName = appendFullName(sb, pd.FullName(), v) - case genid.FieldDescriptorProto_JsonName_field_number: - fd.L1.JSONName.Init(sb.MakeString(v)) - case genid.FieldDescriptorProto_DefaultValue_field_number: - fd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages - case genid.FieldDescriptorProto_TypeName_field_number: - rawTypeName = v - case genid.FieldDescriptorProto_Options_field_number: - fd.unmarshalOptions(v) - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - if rawTypeName != nil { - name := makeFullName(sb, rawTypeName) - switch fd.L1.Kind { - case pref.EnumKind: - fd.L1.Enum = PlaceholderEnum(name) - case pref.MessageKind, pref.GroupKind: - fd.L1.Message = PlaceholderMessage(name) - } - } - fd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Field, rawOptions) -} - -func (fd *Field) unmarshalOptions(b []byte) { - const FieldOptions_EnforceUTF8 = 13 - - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FieldOptions_Packed_field_number: - fd.L1.HasPacked = true - fd.L1.IsPacked = protowire.DecodeBool(v) - case genid.FieldOptions_Weak_field_number: - fd.L1.IsWeak = protowire.DecodeBool(v) - case FieldOptions_EnforceUTF8: - fd.L1.HasEnforceUTF8 = true - fd.L1.EnforceUTF8 = protowire.DecodeBool(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - od.L0.ParentFile = pf - od.L0.Parent = pd - od.L0.Index = i - - var rawOptions []byte - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.OneofDescriptorProto_Name_field_number: - od.L0.FullName = appendFullName(sb, pd.FullName(), v) - case genid.OneofDescriptorProto_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - od.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Oneof, rawOptions) -} - -func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { - var rawTypeName []byte - var rawOptions []byte - xd.L2 = new(ExtensionL2) - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FieldDescriptorProto_Proto3Optional_field_number: - xd.L2.IsProto3Optional = protowire.DecodeBool(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.FieldDescriptorProto_JsonName_field_number: - xd.L2.JSONName.Init(sb.MakeString(v)) - case genid.FieldDescriptorProto_DefaultValue_field_number: - xd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions - case genid.FieldDescriptorProto_TypeName_field_number: - rawTypeName = v - case genid.FieldDescriptorProto_Options_field_number: - xd.unmarshalOptions(v) - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - if rawTypeName != nil { - name := makeFullName(sb, rawTypeName) - switch xd.L1.Kind { - case pref.EnumKind: - xd.L2.Enum = PlaceholderEnum(name) - case pref.MessageKind, pref.GroupKind: - xd.L2.Message = PlaceholderMessage(name) - } - } - xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions) -} - -func (xd *Extension) unmarshalOptions(b []byte) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FieldOptions_Packed_field_number: - xd.L2.IsPacked = protowire.DecodeBool(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - -func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) { - var rawMethods [][]byte - var rawOptions []byte - sd.L2 = new(ServiceL2) - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.ServiceDescriptorProto_Method_field_number: - rawMethods = append(rawMethods, v) - case genid.ServiceDescriptorProto_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - if len(rawMethods) > 0 { - sd.L2.Methods.List = make([]Method, len(rawMethods)) - for i, b := range rawMethods { - sd.L2.Methods.List[i].unmarshalFull(b, sb, sd.L0.ParentFile, sd, i) - } - } - sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions) -} - -func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) { - md.L0.ParentFile = pf - md.L0.Parent = pd - md.L0.Index = i - - var rawOptions []byte - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.MethodDescriptorProto_ClientStreaming_field_number: - md.L1.IsStreamingClient = protowire.DecodeBool(v) - case genid.MethodDescriptorProto_ServerStreaming_field_number: - md.L1.IsStreamingServer = protowire.DecodeBool(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.MethodDescriptorProto_Name_field_number: - md.L0.FullName = appendFullName(sb, pd.FullName(), v) - case genid.MethodDescriptorProto_InputType_field_number: - md.L1.Input = PlaceholderMessage(makeFullName(sb, v)) - case genid.MethodDescriptorProto_OutputType_field_number: - md.L1.Output = PlaceholderMessage(makeFullName(sb, v)) - case genid.MethodDescriptorProto_Options_field_number: - rawOptions = appendOptions(rawOptions, v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } - md.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Method, rawOptions) -} - -// appendOptions appends src to dst, where the returned slice is never nil. -// This is necessary to distinguish between empty and unpopulated options. -func appendOptions(dst, src []byte) []byte { - if dst == nil { - dst = []byte{} - } - return append(dst, src...) -} - -// optionsUnmarshaler constructs a lazy unmarshal function for an options message. -// -// The type of message to unmarshal to is passed as a pointer since the -// vars in descopts may not yet be populated at the time this function is called. -func (db *Builder) optionsUnmarshaler(p *pref.ProtoMessage, b []byte) func() pref.ProtoMessage { - if b == nil { - return nil - } - var opts pref.ProtoMessage - var once sync.Once - return func() pref.ProtoMessage { - once.Do(func() { - if *p == nil { - panic("Descriptor.Options called without importing the descriptor package") - } - opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(pref.ProtoMessage) - if err := (proto.UnmarshalOptions{ - AllowPartial: true, - Resolver: db.TypeResolver, - }).Unmarshal(b, opts); err != nil { - panic(err) - } - }) - return opts - } -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go deleted file mode 100644 index c876cd34d..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package filedesc - -import ( - "fmt" - "sort" - "sync" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/descfmt" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/reflect/protoreflect" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type FileImports []pref.FileImport - -func (p *FileImports) Len() int { return len(*p) } -func (p *FileImports) Get(i int) pref.FileImport { return (*p)[i] } -func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } -func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {} - -type Names struct { - List []pref.Name - once sync.Once - has map[pref.Name]int // protected by once -} - -func (p *Names) Len() int { return len(p.List) } -func (p *Names) Get(i int) pref.Name { return p.List[i] } -func (p *Names) Has(s pref.Name) bool { return p.lazyInit().has[s] > 0 } -func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } -func (p *Names) ProtoInternal(pragma.DoNotImplement) {} -func (p *Names) lazyInit() *Names { - p.once.Do(func() { - if len(p.List) > 0 { - p.has = make(map[pref.Name]int, len(p.List)) - for _, s := range p.List { - p.has[s] = p.has[s] + 1 - } - } - }) - return p -} - -// CheckValid reports any errors with the set of names with an error message -// that completes the sentence: "ranges is invalid because it has ..." -func (p *Names) CheckValid() error { - for s, n := range p.lazyInit().has { - switch { - case n > 1: - return errors.New("duplicate name: %q", s) - case false && !s.IsValid(): - // NOTE: The C++ implementation does not validate the identifier. - // See https://github.com/protocolbuffers/protobuf/issues/6335. - return errors.New("invalid name: %q", s) - } - } - return nil -} - -type EnumRanges struct { - List [][2]pref.EnumNumber // start inclusive; end inclusive - once sync.Once - sorted [][2]pref.EnumNumber // protected by once -} - -func (p *EnumRanges) Len() int { return len(p.List) } -func (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] } -func (p *EnumRanges) Has(n pref.EnumNumber) bool { - for ls := p.lazyInit().sorted; len(ls) > 0; { - i := len(ls) / 2 - switch r := enumRange(ls[i]); { - case n < r.Start(): - ls = ls[:i] // search lower - case n > r.End(): - ls = ls[i+1:] // search upper - default: - return true - } - } - return false -} -func (p *EnumRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } -func (p *EnumRanges) ProtoInternal(pragma.DoNotImplement) {} -func (p *EnumRanges) lazyInit() *EnumRanges { - p.once.Do(func() { - p.sorted = append(p.sorted, p.List...) - sort.Slice(p.sorted, func(i, j int) bool { - return p.sorted[i][0] < p.sorted[j][0] - }) - }) - return p -} - -// CheckValid reports any errors with the set of names with an error message -// that completes the sentence: "ranges is invalid because it has ..." -func (p *EnumRanges) CheckValid() error { - var rp enumRange - for i, r := range p.lazyInit().sorted { - r := enumRange(r) - switch { - case !(r.Start() <= r.End()): - return errors.New("invalid range: %v", r) - case !(rp.End() < r.Start()) && i > 0: - return errors.New("overlapping ranges: %v with %v", rp, r) - } - rp = r - } - return nil -} - -type enumRange [2]protoreflect.EnumNumber - -func (r enumRange) Start() protoreflect.EnumNumber { return r[0] } // inclusive -func (r enumRange) End() protoreflect.EnumNumber { return r[1] } // inclusive -func (r enumRange) String() string { - if r.Start() == r.End() { - return fmt.Sprintf("%d", r.Start()) - } - return fmt.Sprintf("%d to %d", r.Start(), r.End()) -} - -type FieldRanges struct { - List [][2]pref.FieldNumber // start inclusive; end exclusive - once sync.Once - sorted [][2]pref.FieldNumber // protected by once -} - -func (p *FieldRanges) Len() int { return len(p.List) } -func (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] } -func (p *FieldRanges) Has(n pref.FieldNumber) bool { - for ls := p.lazyInit().sorted; len(ls) > 0; { - i := len(ls) / 2 - switch r := fieldRange(ls[i]); { - case n < r.Start(): - ls = ls[:i] // search lower - case n > r.End(): - ls = ls[i+1:] // search upper - default: - return true - } - } - return false -} -func (p *FieldRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } -func (p *FieldRanges) ProtoInternal(pragma.DoNotImplement) {} -func (p *FieldRanges) lazyInit() *FieldRanges { - p.once.Do(func() { - p.sorted = append(p.sorted, p.List...) - sort.Slice(p.sorted, func(i, j int) bool { - return p.sorted[i][0] < p.sorted[j][0] - }) - }) - return p -} - -// CheckValid reports any errors with the set of ranges with an error message -// that completes the sentence: "ranges is invalid because it has ..." -func (p *FieldRanges) CheckValid(isMessageSet bool) error { - var rp fieldRange - for i, r := range p.lazyInit().sorted { - r := fieldRange(r) - switch { - case !isValidFieldNumber(r.Start(), isMessageSet): - return errors.New("invalid field number: %d", r.Start()) - case !isValidFieldNumber(r.End(), isMessageSet): - return errors.New("invalid field number: %d", r.End()) - case !(r.Start() <= r.End()): - return errors.New("invalid range: %v", r) - case !(rp.End() < r.Start()) && i > 0: - return errors.New("overlapping ranges: %v with %v", rp, r) - } - rp = r - } - return nil -} - -// isValidFieldNumber reports whether the field number is valid. -// Unlike the FieldNumber.IsValid method, it allows ranges that cover the -// reserved number range. -func isValidFieldNumber(n protoreflect.FieldNumber, isMessageSet bool) bool { - return protowire.MinValidNumber <= n && (n <= protowire.MaxValidNumber || isMessageSet) -} - -// CheckOverlap reports an error if p and q overlap. -func (p *FieldRanges) CheckOverlap(q *FieldRanges) error { - rps := p.lazyInit().sorted - rqs := q.lazyInit().sorted - for pi, qi := 0, 0; pi < len(rps) && qi < len(rqs); { - rp := fieldRange(rps[pi]) - rq := fieldRange(rqs[qi]) - if !(rp.End() < rq.Start() || rq.End() < rp.Start()) { - return errors.New("overlapping ranges: %v with %v", rp, rq) - } - if rp.Start() < rq.Start() { - pi++ - } else { - qi++ - } - } - return nil -} - -type fieldRange [2]protoreflect.FieldNumber - -func (r fieldRange) Start() protoreflect.FieldNumber { return r[0] } // inclusive -func (r fieldRange) End() protoreflect.FieldNumber { return r[1] - 1 } // inclusive -func (r fieldRange) String() string { - if r.Start() == r.End() { - return fmt.Sprintf("%d", r.Start()) - } - return fmt.Sprintf("%d to %d", r.Start(), r.End()) -} - -type FieldNumbers struct { - List []pref.FieldNumber - once sync.Once - has map[pref.FieldNumber]struct{} // protected by once -} - -func (p *FieldNumbers) Len() int { return len(p.List) } -func (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] } -func (p *FieldNumbers) Has(n pref.FieldNumber) bool { - p.once.Do(func() { - if len(p.List) > 0 { - p.has = make(map[pref.FieldNumber]struct{}, len(p.List)) - for _, n := range p.List { - p.has[n] = struct{}{} - } - } - }) - _, ok := p.has[n] - return ok -} -func (p *FieldNumbers) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } -func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {} - -type OneofFields struct { - List []pref.FieldDescriptor - once sync.Once - byName map[pref.Name]pref.FieldDescriptor // protected by once - byJSON map[string]pref.FieldDescriptor // protected by once - byNum map[pref.FieldNumber]pref.FieldDescriptor // protected by once -} - -func (p *OneofFields) Len() int { return len(p.List) } -func (p *OneofFields) Get(i int) pref.FieldDescriptor { return p.List[i] } -func (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.lazyInit().byName[s] } -func (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.lazyInit().byJSON[s] } -func (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] } -func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } -func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {} - -func (p *OneofFields) lazyInit() *OneofFields { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List)) - p.byJSON = make(map[string]pref.FieldDescriptor, len(p.List)) - p.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List)) - for _, f := range p.List { - // Field names and numbers are guaranteed to be unique. - p.byName[f.Name()] = f - p.byJSON[f.JSONName()] = f - p.byNum[f.Number()] = f - } - } - }) - return p -} - -type SourceLocations struct { - List []pref.SourceLocation -} - -func (p *SourceLocations) Len() int { return len(p.List) } -func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.List[i] } -func (p *SourceLocations) ProtoInternal(pragma.DoNotImplement) {} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go deleted file mode 100644 index 6a8825e80..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package filedesc - -import ( - "fmt" - "sync" - - "google.golang.org/protobuf/internal/descfmt" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/reflect/protoreflect" -) - -type Enums struct { - List []Enum - once sync.Once - byName map[protoreflect.Name]*Enum // protected by once -} - -func (p *Enums) Len() int { - return len(p.List) -} -func (p *Enums) Get(i int) protoreflect.EnumDescriptor { - return &p.List[i] -} -func (p *Enums) ByName(s protoreflect.Name) protoreflect.EnumDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Enums) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Enums) ProtoInternal(pragma.DoNotImplement) {} -func (p *Enums) lazyInit() *Enums { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Enum, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - } - } - }) - return p -} - -type EnumValues struct { - List []EnumValue - once sync.Once - byName map[protoreflect.Name]*EnumValue // protected by once - byNum map[protoreflect.EnumNumber]*EnumValue // protected by once -} - -func (p *EnumValues) Len() int { - return len(p.List) -} -func (p *EnumValues) Get(i int) protoreflect.EnumValueDescriptor { - return &p.List[i] -} -func (p *EnumValues) ByName(s protoreflect.Name) protoreflect.EnumValueDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *EnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor { - if d := p.lazyInit().byNum[n]; d != nil { - return d - } - return nil -} -func (p *EnumValues) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *EnumValues) ProtoInternal(pragma.DoNotImplement) {} -func (p *EnumValues) lazyInit() *EnumValues { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*EnumValue, len(p.List)) - p.byNum = make(map[protoreflect.EnumNumber]*EnumValue, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - if _, ok := p.byNum[d.Number()]; !ok { - p.byNum[d.Number()] = d - } - } - } - }) - return p -} - -type Messages struct { - List []Message - once sync.Once - byName map[protoreflect.Name]*Message // protected by once -} - -func (p *Messages) Len() int { - return len(p.List) -} -func (p *Messages) Get(i int) protoreflect.MessageDescriptor { - return &p.List[i] -} -func (p *Messages) ByName(s protoreflect.Name) protoreflect.MessageDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Messages) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Messages) ProtoInternal(pragma.DoNotImplement) {} -func (p *Messages) lazyInit() *Messages { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Message, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - } - } - }) - return p -} - -type Fields struct { - List []Field - once sync.Once - byName map[protoreflect.Name]*Field // protected by once - byJSON map[string]*Field // protected by once - byNum map[protoreflect.FieldNumber]*Field // protected by once -} - -func (p *Fields) Len() int { - return len(p.List) -} -func (p *Fields) Get(i int) protoreflect.FieldDescriptor { - return &p.List[i] -} -func (p *Fields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor { - if d := p.lazyInit().byJSON[s]; d != nil { - return d - } - return nil -} -func (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor { - if d := p.lazyInit().byNum[n]; d != nil { - return d - } - return nil -} -func (p *Fields) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Fields) ProtoInternal(pragma.DoNotImplement) {} -func (p *Fields) lazyInit() *Fields { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Field, len(p.List)) - p.byJSON = make(map[string]*Field, len(p.List)) - p.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - if _, ok := p.byJSON[d.JSONName()]; !ok { - p.byJSON[d.JSONName()] = d - } - if _, ok := p.byNum[d.Number()]; !ok { - p.byNum[d.Number()] = d - } - } - } - }) - return p -} - -type Oneofs struct { - List []Oneof - once sync.Once - byName map[protoreflect.Name]*Oneof // protected by once -} - -func (p *Oneofs) Len() int { - return len(p.List) -} -func (p *Oneofs) Get(i int) protoreflect.OneofDescriptor { - return &p.List[i] -} -func (p *Oneofs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Oneofs) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Oneofs) ProtoInternal(pragma.DoNotImplement) {} -func (p *Oneofs) lazyInit() *Oneofs { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Oneof, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - } - } - }) - return p -} - -type Extensions struct { - List []Extension - once sync.Once - byName map[protoreflect.Name]*Extension // protected by once -} - -func (p *Extensions) Len() int { - return len(p.List) -} -func (p *Extensions) Get(i int) protoreflect.ExtensionDescriptor { - return &p.List[i] -} -func (p *Extensions) ByName(s protoreflect.Name) protoreflect.ExtensionDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Extensions) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Extensions) ProtoInternal(pragma.DoNotImplement) {} -func (p *Extensions) lazyInit() *Extensions { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Extension, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - } - } - }) - return p -} - -type Services struct { - List []Service - once sync.Once - byName map[protoreflect.Name]*Service // protected by once -} - -func (p *Services) Len() int { - return len(p.List) -} -func (p *Services) Get(i int) protoreflect.ServiceDescriptor { - return &p.List[i] -} -func (p *Services) ByName(s protoreflect.Name) protoreflect.ServiceDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Services) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Services) ProtoInternal(pragma.DoNotImplement) {} -func (p *Services) lazyInit() *Services { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Service, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - } - } - }) - return p -} - -type Methods struct { - List []Method - once sync.Once - byName map[protoreflect.Name]*Method // protected by once -} - -func (p *Methods) Len() int { - return len(p.List) -} -func (p *Methods) Get(i int) protoreflect.MethodDescriptor { - return &p.List[i] -} -func (p *Methods) ByName(s protoreflect.Name) protoreflect.MethodDescriptor { - if d := p.lazyInit().byName[s]; d != nil { - return d - } - return nil -} -func (p *Methods) Format(s fmt.State, r rune) { - descfmt.FormatList(s, r, p) -} -func (p *Methods) ProtoInternal(pragma.DoNotImplement) {} -func (p *Methods) lazyInit() *Methods { - p.once.Do(func() { - if len(p.List) > 0 { - p.byName = make(map[protoreflect.Name]*Method, len(p.List)) - for i := range p.List { - d := &p.List[i] - if _, ok := p.byName[d.Name()]; !ok { - p.byName[d.Name()] = d - } - } - } - }) - return p -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go deleted file mode 100644 index dbf2c605b..000000000 --- a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package filedesc - -import ( - "google.golang.org/protobuf/internal/descopts" - "google.golang.org/protobuf/internal/pragma" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -var ( - emptyNames = new(Names) - emptyEnumRanges = new(EnumRanges) - emptyFieldRanges = new(FieldRanges) - emptyFieldNumbers = new(FieldNumbers) - emptySourceLocations = new(SourceLocations) - - emptyFiles = new(FileImports) - emptyMessages = new(Messages) - emptyFields = new(Fields) - emptyOneofs = new(Oneofs) - emptyEnums = new(Enums) - emptyEnumValues = new(EnumValues) - emptyExtensions = new(Extensions) - emptyServices = new(Services) -) - -// PlaceholderFile is a placeholder, representing only the file path. -type PlaceholderFile string - -func (f PlaceholderFile) ParentFile() pref.FileDescriptor { return f } -func (f PlaceholderFile) Parent() pref.Descriptor { return nil } -func (f PlaceholderFile) Index() int { return 0 } -func (f PlaceholderFile) Syntax() pref.Syntax { return 0 } -func (f PlaceholderFile) Name() pref.Name { return "" } -func (f PlaceholderFile) FullName() pref.FullName { return "" } -func (f PlaceholderFile) IsPlaceholder() bool { return true } -func (f PlaceholderFile) Options() pref.ProtoMessage { return descopts.File } -func (f PlaceholderFile) Path() string { return string(f) } -func (f PlaceholderFile) Package() pref.FullName { return "" } -func (f PlaceholderFile) Imports() pref.FileImports { return emptyFiles } -func (f PlaceholderFile) Messages() pref.MessageDescriptors { return emptyMessages } -func (f PlaceholderFile) Enums() pref.EnumDescriptors { return emptyEnums } -func (f PlaceholderFile) Extensions() pref.ExtensionDescriptors { return emptyExtensions } -func (f PlaceholderFile) Services() pref.ServiceDescriptors { return emptyServices } -func (f PlaceholderFile) SourceLocations() pref.SourceLocations { return emptySourceLocations } -func (f PlaceholderFile) ProtoType(pref.FileDescriptor) { return } -func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return } - -// PlaceholderEnum is a placeholder, representing only the full name. -type PlaceholderEnum pref.FullName - -func (e PlaceholderEnum) ParentFile() pref.FileDescriptor { return nil } -func (e PlaceholderEnum) Parent() pref.Descriptor { return nil } -func (e PlaceholderEnum) Index() int { return 0 } -func (e PlaceholderEnum) Syntax() pref.Syntax { return 0 } -func (e PlaceholderEnum) Name() pref.Name { return pref.FullName(e).Name() } -func (e PlaceholderEnum) FullName() pref.FullName { return pref.FullName(e) } -func (e PlaceholderEnum) IsPlaceholder() bool { return true } -func (e PlaceholderEnum) Options() pref.ProtoMessage { return descopts.Enum } -func (e PlaceholderEnum) Values() pref.EnumValueDescriptors { return emptyEnumValues } -func (e PlaceholderEnum) ReservedNames() pref.Names { return emptyNames } -func (e PlaceholderEnum) ReservedRanges() pref.EnumRanges { return emptyEnumRanges } -func (e PlaceholderEnum) ProtoType(pref.EnumDescriptor) { return } -func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return } - -// PlaceholderEnumValue is a placeholder, representing only the full name. -type PlaceholderEnumValue pref.FullName - -func (e PlaceholderEnumValue) ParentFile() pref.FileDescriptor { return nil } -func (e PlaceholderEnumValue) Parent() pref.Descriptor { return nil } -func (e PlaceholderEnumValue) Index() int { return 0 } -func (e PlaceholderEnumValue) Syntax() pref.Syntax { return 0 } -func (e PlaceholderEnumValue) Name() pref.Name { return pref.FullName(e).Name() } -func (e PlaceholderEnumValue) FullName() pref.FullName { return pref.FullName(e) } -func (e PlaceholderEnumValue) IsPlaceholder() bool { return true } -func (e PlaceholderEnumValue) Options() pref.ProtoMessage { return descopts.EnumValue } -func (e PlaceholderEnumValue) Number() pref.EnumNumber { return 0 } -func (e PlaceholderEnumValue) ProtoType(pref.EnumValueDescriptor) { return } -func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return } - -// PlaceholderMessage is a placeholder, representing only the full name. -type PlaceholderMessage pref.FullName - -func (m PlaceholderMessage) ParentFile() pref.FileDescriptor { return nil } -func (m PlaceholderMessage) Parent() pref.Descriptor { return nil } -func (m PlaceholderMessage) Index() int { return 0 } -func (m PlaceholderMessage) Syntax() pref.Syntax { return 0 } -func (m PlaceholderMessage) Name() pref.Name { return pref.FullName(m).Name() } -func (m PlaceholderMessage) FullName() pref.FullName { return pref.FullName(m) } -func (m PlaceholderMessage) IsPlaceholder() bool { return true } -func (m PlaceholderMessage) Options() pref.ProtoMessage { return descopts.Message } -func (m PlaceholderMessage) IsMapEntry() bool { return false } -func (m PlaceholderMessage) Fields() pref.FieldDescriptors { return emptyFields } -func (m PlaceholderMessage) Oneofs() pref.OneofDescriptors { return emptyOneofs } -func (m PlaceholderMessage) ReservedNames() pref.Names { return emptyNames } -func (m PlaceholderMessage) ReservedRanges() pref.FieldRanges { return emptyFieldRanges } -func (m PlaceholderMessage) RequiredNumbers() pref.FieldNumbers { return emptyFieldNumbers } -func (m PlaceholderMessage) ExtensionRanges() pref.FieldRanges { return emptyFieldRanges } -func (m PlaceholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic("index out of range") } -func (m PlaceholderMessage) Messages() pref.MessageDescriptors { return emptyMessages } -func (m PlaceholderMessage) Enums() pref.EnumDescriptors { return emptyEnums } -func (m PlaceholderMessage) Extensions() pref.ExtensionDescriptors { return emptyExtensions } -func (m PlaceholderMessage) ProtoType(pref.MessageDescriptor) { return } -func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return } diff --git a/vendor/google.golang.org/protobuf/internal/filetype/build.go b/vendor/google.golang.org/protobuf/internal/filetype/build.go deleted file mode 100644 index 0a0dd35de..000000000 --- a/vendor/google.golang.org/protobuf/internal/filetype/build.go +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package filetype provides functionality for wrapping descriptors -// with Go type information. -package filetype - -import ( - "reflect" - - "google.golang.org/protobuf/internal/descopts" - fdesc "google.golang.org/protobuf/internal/filedesc" - pimpl "google.golang.org/protobuf/internal/impl" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" -) - -// Builder constructs type descriptors from a raw file descriptor -// and associated Go types for each enum and message declaration. -// -// -// Flattened Ordering -// -// The protobuf type system represents declarations as a tree. Certain nodes in -// the tree require us to either associate it with a concrete Go type or to -// resolve a dependency, which is information that must be provided separately -// since it cannot be derived from the file descriptor alone. -// -// However, representing a tree as Go literals is difficult to simply do in a -// space and time efficient way. Thus, we store them as a flattened list of -// objects where the serialization order from the tree-based form is important. -// -// The "flattened ordering" is defined as a tree traversal of all enum, message, -// extension, and service declarations using the following algorithm: -// -// def VisitFileDecls(fd): -// for e in fd.Enums: yield e -// for m in fd.Messages: yield m -// for x in fd.Extensions: yield x -// for s in fd.Services: yield s -// for m in fd.Messages: yield from VisitMessageDecls(m) -// -// def VisitMessageDecls(md): -// for e in md.Enums: yield e -// for m in md.Messages: yield m -// for x in md.Extensions: yield x -// for m in md.Messages: yield from VisitMessageDecls(m) -// -// The traversal starts at the root file descriptor and yields each direct -// declaration within each node before traversing into sub-declarations -// that children themselves may have. -type Builder struct { - // File is the underlying file descriptor builder. - File fdesc.Builder - - // GoTypes is a unique set of the Go types for all declarations and - // dependencies. Each type is represented as a zero value of the Go type. - // - // Declarations are Go types generated for enums and messages directly - // declared (not publicly imported) in the proto source file. - // Messages for map entries are accounted for, but represented by nil. - // Enum declarations in "flattened ordering" come first, followed by - // message declarations in "flattened ordering". - // - // Dependencies are Go types for enums or messages referenced by - // message fields (excluding weak fields), for parent extended messages of - // extension fields, for enums or messages referenced by extension fields, - // and for input and output messages referenced by service methods. - // Dependencies must come after declarations, but the ordering of - // dependencies themselves is unspecified. - GoTypes []interface{} - - // DependencyIndexes is an ordered list of indexes into GoTypes for the - // dependencies of messages, extensions, or services. - // - // There are 5 sub-lists in "flattened ordering" concatenated back-to-back: - // 0. Message field dependencies: list of the enum or message type - // referred to by every message field. - // 1. Extension field targets: list of the extended parent message of - // every extension. - // 2. Extension field dependencies: list of the enum or message type - // referred to by every extension field. - // 3. Service method inputs: list of the input message type - // referred to by every service method. - // 4. Service method outputs: list of the output message type - // referred to by every service method. - // - // The offset into DependencyIndexes for the start of each sub-list - // is appended to the end in reverse order. - DependencyIndexes []int32 - - // EnumInfos is a list of enum infos in "flattened ordering". - EnumInfos []pimpl.EnumInfo - - // MessageInfos is a list of message infos in "flattened ordering". - // If provided, the GoType and PBType for each element is populated. - // - // Requirement: len(MessageInfos) == len(Build.Messages) - MessageInfos []pimpl.MessageInfo - - // ExtensionInfos is a list of extension infos in "flattened ordering". - // Each element is initialized and registered with the protoregistry package. - // - // Requirement: len(LegacyExtensions) == len(Build.Extensions) - ExtensionInfos []pimpl.ExtensionInfo - - // TypeRegistry is the registry to register each type descriptor. - // If nil, it uses protoregistry.GlobalTypes. - TypeRegistry interface { - RegisterMessage(pref.MessageType) error - RegisterEnum(pref.EnumType) error - RegisterExtension(pref.ExtensionType) error - } -} - -// Out is the output of the builder. -type Out struct { - File pref.FileDescriptor -} - -func (tb Builder) Build() (out Out) { - // Replace the resolver with one that resolves dependencies by index, - // which is faster and more reliable than relying on the global registry. - if tb.File.FileRegistry == nil { - tb.File.FileRegistry = preg.GlobalFiles - } - tb.File.FileRegistry = &resolverByIndex{ - goTypes: tb.GoTypes, - depIdxs: tb.DependencyIndexes, - fileRegistry: tb.File.FileRegistry, - } - - // Initialize registry if unpopulated. - if tb.TypeRegistry == nil { - tb.TypeRegistry = preg.GlobalTypes - } - - fbOut := tb.File.Build() - out.File = fbOut.File - - // Process enums. - enumGoTypes := tb.GoTypes[:len(fbOut.Enums)] - if len(tb.EnumInfos) != len(fbOut.Enums) { - panic("mismatching enum lengths") - } - if len(fbOut.Enums) > 0 { - for i := range fbOut.Enums { - tb.EnumInfos[i] = pimpl.EnumInfo{ - GoReflectType: reflect.TypeOf(enumGoTypes[i]), - Desc: &fbOut.Enums[i], - } - // Register enum types. - if err := tb.TypeRegistry.RegisterEnum(&tb.EnumInfos[i]); err != nil { - panic(err) - } - } - } - - // Process messages. - messageGoTypes := tb.GoTypes[len(fbOut.Enums):][:len(fbOut.Messages)] - if len(tb.MessageInfos) != len(fbOut.Messages) { - panic("mismatching message lengths") - } - if len(fbOut.Messages) > 0 { - for i := range fbOut.Messages { - if messageGoTypes[i] == nil { - continue // skip map entry - } - - tb.MessageInfos[i].GoReflectType = reflect.TypeOf(messageGoTypes[i]) - tb.MessageInfos[i].Desc = &fbOut.Messages[i] - - // Register message types. - if err := tb.TypeRegistry.RegisterMessage(&tb.MessageInfos[i]); err != nil { - panic(err) - } - } - - // As a special-case for descriptor.proto, - // locally register concrete message type for the options. - if out.File.Path() == "google/protobuf/descriptor.proto" && out.File.Package() == "google.protobuf" { - for i := range fbOut.Messages { - switch fbOut.Messages[i].Name() { - case "FileOptions": - descopts.File = messageGoTypes[i].(pref.ProtoMessage) - case "EnumOptions": - descopts.Enum = messageGoTypes[i].(pref.ProtoMessage) - case "EnumValueOptions": - descopts.EnumValue = messageGoTypes[i].(pref.ProtoMessage) - case "MessageOptions": - descopts.Message = messageGoTypes[i].(pref.ProtoMessage) - case "FieldOptions": - descopts.Field = messageGoTypes[i].(pref.ProtoMessage) - case "OneofOptions": - descopts.Oneof = messageGoTypes[i].(pref.ProtoMessage) - case "ExtensionRangeOptions": - descopts.ExtensionRange = messageGoTypes[i].(pref.ProtoMessage) - case "ServiceOptions": - descopts.Service = messageGoTypes[i].(pref.ProtoMessage) - case "MethodOptions": - descopts.Method = messageGoTypes[i].(pref.ProtoMessage) - } - } - } - } - - // Process extensions. - if len(tb.ExtensionInfos) != len(fbOut.Extensions) { - panic("mismatching extension lengths") - } - var depIdx int32 - for i := range fbOut.Extensions { - // For enum and message kinds, determine the referent Go type so - // that we can construct their constructors. - const listExtDeps = 2 - var goType reflect.Type - switch fbOut.Extensions[i].L1.Kind { - case pref.EnumKind: - j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx) - goType = reflect.TypeOf(tb.GoTypes[j]) - depIdx++ - case pref.MessageKind, pref.GroupKind: - j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx) - goType = reflect.TypeOf(tb.GoTypes[j]) - depIdx++ - default: - goType = goTypeForPBKind[fbOut.Extensions[i].L1.Kind] - } - if fbOut.Extensions[i].IsList() { - goType = reflect.SliceOf(goType) - } - - pimpl.InitExtensionInfo(&tb.ExtensionInfos[i], &fbOut.Extensions[i], goType) - - // Register extension types. - if err := tb.TypeRegistry.RegisterExtension(&tb.ExtensionInfos[i]); err != nil { - panic(err) - } - } - - return out -} - -var goTypeForPBKind = map[pref.Kind]reflect.Type{ - pref.BoolKind: reflect.TypeOf(bool(false)), - pref.Int32Kind: reflect.TypeOf(int32(0)), - pref.Sint32Kind: reflect.TypeOf(int32(0)), - pref.Sfixed32Kind: reflect.TypeOf(int32(0)), - pref.Int64Kind: reflect.TypeOf(int64(0)), - pref.Sint64Kind: reflect.TypeOf(int64(0)), - pref.Sfixed64Kind: reflect.TypeOf(int64(0)), - pref.Uint32Kind: reflect.TypeOf(uint32(0)), - pref.Fixed32Kind: reflect.TypeOf(uint32(0)), - pref.Uint64Kind: reflect.TypeOf(uint64(0)), - pref.Fixed64Kind: reflect.TypeOf(uint64(0)), - pref.FloatKind: reflect.TypeOf(float32(0)), - pref.DoubleKind: reflect.TypeOf(float64(0)), - pref.StringKind: reflect.TypeOf(string("")), - pref.BytesKind: reflect.TypeOf([]byte(nil)), -} - -type depIdxs []int32 - -// Get retrieves the jth element of the ith sub-list. -func (x depIdxs) Get(i, j int32) int32 { - return x[x[int32(len(x))-i-1]+j] -} - -type ( - resolverByIndex struct { - goTypes []interface{} - depIdxs depIdxs - fileRegistry - } - fileRegistry interface { - FindFileByPath(string) (pref.FileDescriptor, error) - FindDescriptorByName(pref.FullName) (pref.Descriptor, error) - RegisterFile(pref.FileDescriptor) error - } -) - -func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.EnumDescriptor { - if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) { - return &es[depIdx] - } else { - return pimpl.Export{}.EnumDescriptorOf(r.goTypes[depIdx]) - } -} - -func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.MessageDescriptor { - if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) { - return &ms[depIdx-len(es)] - } else { - return pimpl.Export{}.MessageDescriptorOf(r.goTypes[depIdx]) - } -} diff --git a/vendor/google.golang.org/protobuf/internal/flags/flags.go b/vendor/google.golang.org/protobuf/internal/flags/flags.go deleted file mode 100644 index 58372dd34..000000000 --- a/vendor/google.golang.org/protobuf/internal/flags/flags.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package flags provides a set of flags controlled by build tags. -package flags - -// ProtoLegacy specifies whether to enable support for legacy functionality -// such as MessageSets, weak fields, and various other obscure behavior -// that is necessary to maintain backwards compatibility with proto1 or -// the pre-release variants of proto2 and proto3. -// -// This is disabled by default unless built with the "protolegacy" tag. -// -// WARNING: The compatibility agreement covers nothing provided by this flag. -// As such, functionality may suddenly be removed or changed at our discretion. -const ProtoLegacy = protoLegacy - -// LazyUnmarshalExtensions specifies whether to lazily unmarshal extensions. -// -// Lazy extension unmarshaling validates the contents of message-valued -// extension fields at unmarshal time, but defers creating the message -// structure until the extension is first accessed. -const LazyUnmarshalExtensions = ProtoLegacy diff --git a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go b/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go deleted file mode 100644 index a72995f02..000000000 --- a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !protolegacy - -package flags - -const protoLegacy = false diff --git a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go b/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go deleted file mode 100644 index 772e2f0e4..000000000 --- a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build protolegacy - -package flags - -const protoLegacy = true diff --git a/vendor/google.golang.org/protobuf/internal/genid/any_gen.go b/vendor/google.golang.org/protobuf/internal/genid/any_gen.go deleted file mode 100644 index e6f7d47ab..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/any_gen.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_any_proto = "google/protobuf/any.proto" - -// Names for google.protobuf.Any. -const ( - Any_message_name protoreflect.Name = "Any" - Any_message_fullname protoreflect.FullName = "google.protobuf.Any" -) - -// Field names for google.protobuf.Any. -const ( - Any_TypeUrl_field_name protoreflect.Name = "type_url" - Any_Value_field_name protoreflect.Name = "value" - - Any_TypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Any.type_url" - Any_Value_field_fullname protoreflect.FullName = "google.protobuf.Any.value" -) - -// Field numbers for google.protobuf.Any. -const ( - Any_TypeUrl_field_number protoreflect.FieldNumber = 1 - Any_Value_field_number protoreflect.FieldNumber = 2 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/api_gen.go b/vendor/google.golang.org/protobuf/internal/genid/api_gen.go deleted file mode 100644 index df8f91850..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_api_proto = "google/protobuf/api.proto" - -// Names for google.protobuf.Api. -const ( - Api_message_name protoreflect.Name = "Api" - Api_message_fullname protoreflect.FullName = "google.protobuf.Api" -) - -// Field names for google.protobuf.Api. -const ( - Api_Name_field_name protoreflect.Name = "name" - Api_Methods_field_name protoreflect.Name = "methods" - Api_Options_field_name protoreflect.Name = "options" - Api_Version_field_name protoreflect.Name = "version" - Api_SourceContext_field_name protoreflect.Name = "source_context" - Api_Mixins_field_name protoreflect.Name = "mixins" - Api_Syntax_field_name protoreflect.Name = "syntax" - - Api_Name_field_fullname protoreflect.FullName = "google.protobuf.Api.name" - Api_Methods_field_fullname protoreflect.FullName = "google.protobuf.Api.methods" - Api_Options_field_fullname protoreflect.FullName = "google.protobuf.Api.options" - Api_Version_field_fullname protoreflect.FullName = "google.protobuf.Api.version" - Api_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Api.source_context" - Api_Mixins_field_fullname protoreflect.FullName = "google.protobuf.Api.mixins" - Api_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Api.syntax" -) - -// Field numbers for google.protobuf.Api. -const ( - Api_Name_field_number protoreflect.FieldNumber = 1 - Api_Methods_field_number protoreflect.FieldNumber = 2 - Api_Options_field_number protoreflect.FieldNumber = 3 - Api_Version_field_number protoreflect.FieldNumber = 4 - Api_SourceContext_field_number protoreflect.FieldNumber = 5 - Api_Mixins_field_number protoreflect.FieldNumber = 6 - Api_Syntax_field_number protoreflect.FieldNumber = 7 -) - -// Names for google.protobuf.Method. -const ( - Method_message_name protoreflect.Name = "Method" - Method_message_fullname protoreflect.FullName = "google.protobuf.Method" -) - -// Field names for google.protobuf.Method. -const ( - Method_Name_field_name protoreflect.Name = "name" - Method_RequestTypeUrl_field_name protoreflect.Name = "request_type_url" - Method_RequestStreaming_field_name protoreflect.Name = "request_streaming" - Method_ResponseTypeUrl_field_name protoreflect.Name = "response_type_url" - Method_ResponseStreaming_field_name protoreflect.Name = "response_streaming" - Method_Options_field_name protoreflect.Name = "options" - Method_Syntax_field_name protoreflect.Name = "syntax" - - Method_Name_field_fullname protoreflect.FullName = "google.protobuf.Method.name" - Method_RequestTypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Method.request_type_url" - Method_RequestStreaming_field_fullname protoreflect.FullName = "google.protobuf.Method.request_streaming" - Method_ResponseTypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Method.response_type_url" - Method_ResponseStreaming_field_fullname protoreflect.FullName = "google.protobuf.Method.response_streaming" - Method_Options_field_fullname protoreflect.FullName = "google.protobuf.Method.options" - Method_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Method.syntax" -) - -// Field numbers for google.protobuf.Method. -const ( - Method_Name_field_number protoreflect.FieldNumber = 1 - Method_RequestTypeUrl_field_number protoreflect.FieldNumber = 2 - Method_RequestStreaming_field_number protoreflect.FieldNumber = 3 - Method_ResponseTypeUrl_field_number protoreflect.FieldNumber = 4 - Method_ResponseStreaming_field_number protoreflect.FieldNumber = 5 - Method_Options_field_number protoreflect.FieldNumber = 6 - Method_Syntax_field_number protoreflect.FieldNumber = 7 -) - -// Names for google.protobuf.Mixin. -const ( - Mixin_message_name protoreflect.Name = "Mixin" - Mixin_message_fullname protoreflect.FullName = "google.protobuf.Mixin" -) - -// Field names for google.protobuf.Mixin. -const ( - Mixin_Name_field_name protoreflect.Name = "name" - Mixin_Root_field_name protoreflect.Name = "root" - - Mixin_Name_field_fullname protoreflect.FullName = "google.protobuf.Mixin.name" - Mixin_Root_field_fullname protoreflect.FullName = "google.protobuf.Mixin.root" -) - -// Field numbers for google.protobuf.Mixin. -const ( - Mixin_Name_field_number protoreflect.FieldNumber = 1 - Mixin_Root_field_number protoreflect.FieldNumber = 2 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go deleted file mode 100644 index e3cdf1c20..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +++ /dev/null @@ -1,829 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto" - -// Names for google.protobuf.FileDescriptorSet. -const ( - FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet" - FileDescriptorSet_message_fullname protoreflect.FullName = "google.protobuf.FileDescriptorSet" -) - -// Field names for google.protobuf.FileDescriptorSet. -const ( - FileDescriptorSet_File_field_name protoreflect.Name = "file" - - FileDescriptorSet_File_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorSet.file" -) - -// Field numbers for google.protobuf.FileDescriptorSet. -const ( - FileDescriptorSet_File_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.FileDescriptorProto. -const ( - FileDescriptorProto_message_name protoreflect.Name = "FileDescriptorProto" - FileDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto" -) - -// Field names for google.protobuf.FileDescriptorProto. -const ( - FileDescriptorProto_Name_field_name protoreflect.Name = "name" - FileDescriptorProto_Package_field_name protoreflect.Name = "package" - FileDescriptorProto_Dependency_field_name protoreflect.Name = "dependency" - FileDescriptorProto_PublicDependency_field_name protoreflect.Name = "public_dependency" - FileDescriptorProto_WeakDependency_field_name protoreflect.Name = "weak_dependency" - FileDescriptorProto_MessageType_field_name protoreflect.Name = "message_type" - FileDescriptorProto_EnumType_field_name protoreflect.Name = "enum_type" - FileDescriptorProto_Service_field_name protoreflect.Name = "service" - FileDescriptorProto_Extension_field_name protoreflect.Name = "extension" - FileDescriptorProto_Options_field_name protoreflect.Name = "options" - FileDescriptorProto_SourceCodeInfo_field_name protoreflect.Name = "source_code_info" - FileDescriptorProto_Syntax_field_name protoreflect.Name = "syntax" - - FileDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.name" - FileDescriptorProto_Package_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.package" - FileDescriptorProto_Dependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.dependency" - FileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.public_dependency" - FileDescriptorProto_WeakDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.weak_dependency" - FileDescriptorProto_MessageType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.message_type" - FileDescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.enum_type" - FileDescriptorProto_Service_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.service" - FileDescriptorProto_Extension_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.extension" - FileDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.options" - FileDescriptorProto_SourceCodeInfo_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.source_code_info" - FileDescriptorProto_Syntax_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.syntax" -) - -// Field numbers for google.protobuf.FileDescriptorProto. -const ( - FileDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - FileDescriptorProto_Package_field_number protoreflect.FieldNumber = 2 - FileDescriptorProto_Dependency_field_number protoreflect.FieldNumber = 3 - FileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10 - FileDescriptorProto_WeakDependency_field_number protoreflect.FieldNumber = 11 - FileDescriptorProto_MessageType_field_number protoreflect.FieldNumber = 4 - FileDescriptorProto_EnumType_field_number protoreflect.FieldNumber = 5 - FileDescriptorProto_Service_field_number protoreflect.FieldNumber = 6 - FileDescriptorProto_Extension_field_number protoreflect.FieldNumber = 7 - FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8 - FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9 - FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12 -) - -// Names for google.protobuf.DescriptorProto. -const ( - DescriptorProto_message_name protoreflect.Name = "DescriptorProto" - DescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.DescriptorProto" -) - -// Field names for google.protobuf.DescriptorProto. -const ( - DescriptorProto_Name_field_name protoreflect.Name = "name" - DescriptorProto_Field_field_name protoreflect.Name = "field" - DescriptorProto_Extension_field_name protoreflect.Name = "extension" - DescriptorProto_NestedType_field_name protoreflect.Name = "nested_type" - DescriptorProto_EnumType_field_name protoreflect.Name = "enum_type" - DescriptorProto_ExtensionRange_field_name protoreflect.Name = "extension_range" - DescriptorProto_OneofDecl_field_name protoreflect.Name = "oneof_decl" - DescriptorProto_Options_field_name protoreflect.Name = "options" - DescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range" - DescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name" - - DescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.name" - DescriptorProto_Field_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.field" - DescriptorProto_Extension_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.extension" - DescriptorProto_NestedType_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.nested_type" - DescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.enum_type" - DescriptorProto_ExtensionRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.extension_range" - DescriptorProto_OneofDecl_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.oneof_decl" - DescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.options" - DescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_range" - DescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_name" -) - -// Field numbers for google.protobuf.DescriptorProto. -const ( - DescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - DescriptorProto_Field_field_number protoreflect.FieldNumber = 2 - DescriptorProto_Extension_field_number protoreflect.FieldNumber = 6 - DescriptorProto_NestedType_field_number protoreflect.FieldNumber = 3 - DescriptorProto_EnumType_field_number protoreflect.FieldNumber = 4 - DescriptorProto_ExtensionRange_field_number protoreflect.FieldNumber = 5 - DescriptorProto_OneofDecl_field_number protoreflect.FieldNumber = 8 - DescriptorProto_Options_field_number protoreflect.FieldNumber = 7 - DescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 9 - DescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 10 -) - -// Names for google.protobuf.DescriptorProto.ExtensionRange. -const ( - DescriptorProto_ExtensionRange_message_name protoreflect.Name = "ExtensionRange" - DescriptorProto_ExtensionRange_message_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange" -) - -// Field names for google.protobuf.DescriptorProto.ExtensionRange. -const ( - DescriptorProto_ExtensionRange_Start_field_name protoreflect.Name = "start" - DescriptorProto_ExtensionRange_End_field_name protoreflect.Name = "end" - DescriptorProto_ExtensionRange_Options_field_name protoreflect.Name = "options" - - DescriptorProto_ExtensionRange_Start_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange.start" - DescriptorProto_ExtensionRange_End_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange.end" - DescriptorProto_ExtensionRange_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange.options" -) - -// Field numbers for google.protobuf.DescriptorProto.ExtensionRange. -const ( - DescriptorProto_ExtensionRange_Start_field_number protoreflect.FieldNumber = 1 - DescriptorProto_ExtensionRange_End_field_number protoreflect.FieldNumber = 2 - DescriptorProto_ExtensionRange_Options_field_number protoreflect.FieldNumber = 3 -) - -// Names for google.protobuf.DescriptorProto.ReservedRange. -const ( - DescriptorProto_ReservedRange_message_name protoreflect.Name = "ReservedRange" - DescriptorProto_ReservedRange_message_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ReservedRange" -) - -// Field names for google.protobuf.DescriptorProto.ReservedRange. -const ( - DescriptorProto_ReservedRange_Start_field_name protoreflect.Name = "start" - DescriptorProto_ReservedRange_End_field_name protoreflect.Name = "end" - - DescriptorProto_ReservedRange_Start_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ReservedRange.start" - DescriptorProto_ReservedRange_End_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ReservedRange.end" -) - -// Field numbers for google.protobuf.DescriptorProto.ReservedRange. -const ( - DescriptorProto_ReservedRange_Start_field_number protoreflect.FieldNumber = 1 - DescriptorProto_ReservedRange_End_field_number protoreflect.FieldNumber = 2 -) - -// Names for google.protobuf.ExtensionRangeOptions. -const ( - ExtensionRangeOptions_message_name protoreflect.Name = "ExtensionRangeOptions" - ExtensionRangeOptions_message_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions" -) - -// Field names for google.protobuf.ExtensionRangeOptions. -const ( - ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.ExtensionRangeOptions. -const ( - ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Names for google.protobuf.FieldDescriptorProto. -const ( - FieldDescriptorProto_message_name protoreflect.Name = "FieldDescriptorProto" - FieldDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto" -) - -// Field names for google.protobuf.FieldDescriptorProto. -const ( - FieldDescriptorProto_Name_field_name protoreflect.Name = "name" - FieldDescriptorProto_Number_field_name protoreflect.Name = "number" - FieldDescriptorProto_Label_field_name protoreflect.Name = "label" - FieldDescriptorProto_Type_field_name protoreflect.Name = "type" - FieldDescriptorProto_TypeName_field_name protoreflect.Name = "type_name" - FieldDescriptorProto_Extendee_field_name protoreflect.Name = "extendee" - FieldDescriptorProto_DefaultValue_field_name protoreflect.Name = "default_value" - FieldDescriptorProto_OneofIndex_field_name protoreflect.Name = "oneof_index" - FieldDescriptorProto_JsonName_field_name protoreflect.Name = "json_name" - FieldDescriptorProto_Options_field_name protoreflect.Name = "options" - FieldDescriptorProto_Proto3Optional_field_name protoreflect.Name = "proto3_optional" - - FieldDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.name" - FieldDescriptorProto_Number_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.number" - FieldDescriptorProto_Label_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.label" - FieldDescriptorProto_Type_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.type" - FieldDescriptorProto_TypeName_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.type_name" - FieldDescriptorProto_Extendee_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.extendee" - FieldDescriptorProto_DefaultValue_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.default_value" - FieldDescriptorProto_OneofIndex_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.oneof_index" - FieldDescriptorProto_JsonName_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.json_name" - FieldDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.options" - FieldDescriptorProto_Proto3Optional_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.proto3_optional" -) - -// Field numbers for google.protobuf.FieldDescriptorProto. -const ( - FieldDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - FieldDescriptorProto_Number_field_number protoreflect.FieldNumber = 3 - FieldDescriptorProto_Label_field_number protoreflect.FieldNumber = 4 - FieldDescriptorProto_Type_field_number protoreflect.FieldNumber = 5 - FieldDescriptorProto_TypeName_field_number protoreflect.FieldNumber = 6 - FieldDescriptorProto_Extendee_field_number protoreflect.FieldNumber = 2 - FieldDescriptorProto_DefaultValue_field_number protoreflect.FieldNumber = 7 - FieldDescriptorProto_OneofIndex_field_number protoreflect.FieldNumber = 9 - FieldDescriptorProto_JsonName_field_number protoreflect.FieldNumber = 10 - FieldDescriptorProto_Options_field_number protoreflect.FieldNumber = 8 - FieldDescriptorProto_Proto3Optional_field_number protoreflect.FieldNumber = 17 -) - -// Full and short names for google.protobuf.FieldDescriptorProto.Type. -const ( - FieldDescriptorProto_Type_enum_fullname = "google.protobuf.FieldDescriptorProto.Type" - FieldDescriptorProto_Type_enum_name = "Type" -) - -// Full and short names for google.protobuf.FieldDescriptorProto.Label. -const ( - FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label" - FieldDescriptorProto_Label_enum_name = "Label" -) - -// Names for google.protobuf.OneofDescriptorProto. -const ( - OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto" - OneofDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.OneofDescriptorProto" -) - -// Field names for google.protobuf.OneofDescriptorProto. -const ( - OneofDescriptorProto_Name_field_name protoreflect.Name = "name" - OneofDescriptorProto_Options_field_name protoreflect.Name = "options" - - OneofDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.OneofDescriptorProto.name" - OneofDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.OneofDescriptorProto.options" -) - -// Field numbers for google.protobuf.OneofDescriptorProto. -const ( - OneofDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - OneofDescriptorProto_Options_field_number protoreflect.FieldNumber = 2 -) - -// Names for google.protobuf.EnumDescriptorProto. -const ( - EnumDescriptorProto_message_name protoreflect.Name = "EnumDescriptorProto" - EnumDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto" -) - -// Field names for google.protobuf.EnumDescriptorProto. -const ( - EnumDescriptorProto_Name_field_name protoreflect.Name = "name" - EnumDescriptorProto_Value_field_name protoreflect.Name = "value" - EnumDescriptorProto_Options_field_name protoreflect.Name = "options" - EnumDescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range" - EnumDescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name" - - EnumDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.name" - EnumDescriptorProto_Value_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.value" - EnumDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.options" - EnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_range" - EnumDescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_name" -) - -// Field numbers for google.protobuf.EnumDescriptorProto. -const ( - EnumDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - EnumDescriptorProto_Value_field_number protoreflect.FieldNumber = 2 - EnumDescriptorProto_Options_field_number protoreflect.FieldNumber = 3 - EnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4 - EnumDescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 5 -) - -// Names for google.protobuf.EnumDescriptorProto.EnumReservedRange. -const ( - EnumDescriptorProto_EnumReservedRange_message_name protoreflect.Name = "EnumReservedRange" - EnumDescriptorProto_EnumReservedRange_message_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.EnumReservedRange" -) - -// Field names for google.protobuf.EnumDescriptorProto.EnumReservedRange. -const ( - EnumDescriptorProto_EnumReservedRange_Start_field_name protoreflect.Name = "start" - EnumDescriptorProto_EnumReservedRange_End_field_name protoreflect.Name = "end" - - EnumDescriptorProto_EnumReservedRange_Start_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.EnumReservedRange.start" - EnumDescriptorProto_EnumReservedRange_End_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.EnumReservedRange.end" -) - -// Field numbers for google.protobuf.EnumDescriptorProto.EnumReservedRange. -const ( - EnumDescriptorProto_EnumReservedRange_Start_field_number protoreflect.FieldNumber = 1 - EnumDescriptorProto_EnumReservedRange_End_field_number protoreflect.FieldNumber = 2 -) - -// Names for google.protobuf.EnumValueDescriptorProto. -const ( - EnumValueDescriptorProto_message_name protoreflect.Name = "EnumValueDescriptorProto" - EnumValueDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto" -) - -// Field names for google.protobuf.EnumValueDescriptorProto. -const ( - EnumValueDescriptorProto_Name_field_name protoreflect.Name = "name" - EnumValueDescriptorProto_Number_field_name protoreflect.Name = "number" - EnumValueDescriptorProto_Options_field_name protoreflect.Name = "options" - - EnumValueDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto.name" - EnumValueDescriptorProto_Number_field_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto.number" - EnumValueDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto.options" -) - -// Field numbers for google.protobuf.EnumValueDescriptorProto. -const ( - EnumValueDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - EnumValueDescriptorProto_Number_field_number protoreflect.FieldNumber = 2 - EnumValueDescriptorProto_Options_field_number protoreflect.FieldNumber = 3 -) - -// Names for google.protobuf.ServiceDescriptorProto. -const ( - ServiceDescriptorProto_message_name protoreflect.Name = "ServiceDescriptorProto" - ServiceDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto" -) - -// Field names for google.protobuf.ServiceDescriptorProto. -const ( - ServiceDescriptorProto_Name_field_name protoreflect.Name = "name" - ServiceDescriptorProto_Method_field_name protoreflect.Name = "method" - ServiceDescriptorProto_Options_field_name protoreflect.Name = "options" - - ServiceDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto.name" - ServiceDescriptorProto_Method_field_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto.method" - ServiceDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto.options" -) - -// Field numbers for google.protobuf.ServiceDescriptorProto. -const ( - ServiceDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - ServiceDescriptorProto_Method_field_number protoreflect.FieldNumber = 2 - ServiceDescriptorProto_Options_field_number protoreflect.FieldNumber = 3 -) - -// Names for google.protobuf.MethodDescriptorProto. -const ( - MethodDescriptorProto_message_name protoreflect.Name = "MethodDescriptorProto" - MethodDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto" -) - -// Field names for google.protobuf.MethodDescriptorProto. -const ( - MethodDescriptorProto_Name_field_name protoreflect.Name = "name" - MethodDescriptorProto_InputType_field_name protoreflect.Name = "input_type" - MethodDescriptorProto_OutputType_field_name protoreflect.Name = "output_type" - MethodDescriptorProto_Options_field_name protoreflect.Name = "options" - MethodDescriptorProto_ClientStreaming_field_name protoreflect.Name = "client_streaming" - MethodDescriptorProto_ServerStreaming_field_name protoreflect.Name = "server_streaming" - - MethodDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.name" - MethodDescriptorProto_InputType_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.input_type" - MethodDescriptorProto_OutputType_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.output_type" - MethodDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.options" - MethodDescriptorProto_ClientStreaming_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.client_streaming" - MethodDescriptorProto_ServerStreaming_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.server_streaming" -) - -// Field numbers for google.protobuf.MethodDescriptorProto. -const ( - MethodDescriptorProto_Name_field_number protoreflect.FieldNumber = 1 - MethodDescriptorProto_InputType_field_number protoreflect.FieldNumber = 2 - MethodDescriptorProto_OutputType_field_number protoreflect.FieldNumber = 3 - MethodDescriptorProto_Options_field_number protoreflect.FieldNumber = 4 - MethodDescriptorProto_ClientStreaming_field_number protoreflect.FieldNumber = 5 - MethodDescriptorProto_ServerStreaming_field_number protoreflect.FieldNumber = 6 -) - -// Names for google.protobuf.FileOptions. -const ( - FileOptions_message_name protoreflect.Name = "FileOptions" - FileOptions_message_fullname protoreflect.FullName = "google.protobuf.FileOptions" -) - -// Field names for google.protobuf.FileOptions. -const ( - FileOptions_JavaPackage_field_name protoreflect.Name = "java_package" - FileOptions_JavaOuterClassname_field_name protoreflect.Name = "java_outer_classname" - FileOptions_JavaMultipleFiles_field_name protoreflect.Name = "java_multiple_files" - FileOptions_JavaGenerateEqualsAndHash_field_name protoreflect.Name = "java_generate_equals_and_hash" - FileOptions_JavaStringCheckUtf8_field_name protoreflect.Name = "java_string_check_utf8" - FileOptions_OptimizeFor_field_name protoreflect.Name = "optimize_for" - FileOptions_GoPackage_field_name protoreflect.Name = "go_package" - FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services" - FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services" - FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services" - FileOptions_PhpGenericServices_field_name protoreflect.Name = "php_generic_services" - FileOptions_Deprecated_field_name protoreflect.Name = "deprecated" - FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas" - FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix" - FileOptions_CsharpNamespace_field_name protoreflect.Name = "csharp_namespace" - FileOptions_SwiftPrefix_field_name protoreflect.Name = "swift_prefix" - FileOptions_PhpClassPrefix_field_name protoreflect.Name = "php_class_prefix" - FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace" - FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace" - FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package" - FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package" - FileOptions_JavaOuterClassname_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_outer_classname" - FileOptions_JavaMultipleFiles_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_multiple_files" - FileOptions_JavaGenerateEqualsAndHash_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generate_equals_and_hash" - FileOptions_JavaStringCheckUtf8_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_string_check_utf8" - FileOptions_OptimizeFor_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.optimize_for" - FileOptions_GoPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.go_package" - FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services" - FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services" - FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services" - FileOptions_PhpGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_generic_services" - FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated" - FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas" - FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix" - FileOptions_CsharpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.csharp_namespace" - FileOptions_SwiftPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.swift_prefix" - FileOptions_PhpClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_class_prefix" - FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace" - FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace" - FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package" - FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.FileOptions. -const ( - FileOptions_JavaPackage_field_number protoreflect.FieldNumber = 1 - FileOptions_JavaOuterClassname_field_number protoreflect.FieldNumber = 8 - FileOptions_JavaMultipleFiles_field_number protoreflect.FieldNumber = 10 - FileOptions_JavaGenerateEqualsAndHash_field_number protoreflect.FieldNumber = 20 - FileOptions_JavaStringCheckUtf8_field_number protoreflect.FieldNumber = 27 - FileOptions_OptimizeFor_field_number protoreflect.FieldNumber = 9 - FileOptions_GoPackage_field_number protoreflect.FieldNumber = 11 - FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16 - FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17 - FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18 - FileOptions_PhpGenericServices_field_number protoreflect.FieldNumber = 42 - FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23 - FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31 - FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36 - FileOptions_CsharpNamespace_field_number protoreflect.FieldNumber = 37 - FileOptions_SwiftPrefix_field_number protoreflect.FieldNumber = 39 - FileOptions_PhpClassPrefix_field_number protoreflect.FieldNumber = 40 - FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41 - FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44 - FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45 - FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Full and short names for google.protobuf.FileOptions.OptimizeMode. -const ( - FileOptions_OptimizeMode_enum_fullname = "google.protobuf.FileOptions.OptimizeMode" - FileOptions_OptimizeMode_enum_name = "OptimizeMode" -) - -// Names for google.protobuf.MessageOptions. -const ( - MessageOptions_message_name protoreflect.Name = "MessageOptions" - MessageOptions_message_fullname protoreflect.FullName = "google.protobuf.MessageOptions" -) - -// Field names for google.protobuf.MessageOptions. -const ( - MessageOptions_MessageSetWireFormat_field_name protoreflect.Name = "message_set_wire_format" - MessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = "no_standard_descriptor_accessor" - MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated" - MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry" - MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format" - MessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.no_standard_descriptor_accessor" - MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated" - MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry" - MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.MessageOptions. -const ( - MessageOptions_MessageSetWireFormat_field_number protoreflect.FieldNumber = 1 - MessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2 - MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3 - MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7 - MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Names for google.protobuf.FieldOptions. -const ( - FieldOptions_message_name protoreflect.Name = "FieldOptions" - FieldOptions_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions" -) - -// Field names for google.protobuf.FieldOptions. -const ( - FieldOptions_Ctype_field_name protoreflect.Name = "ctype" - FieldOptions_Packed_field_name protoreflect.Name = "packed" - FieldOptions_Jstype_field_name protoreflect.Name = "jstype" - FieldOptions_Lazy_field_name protoreflect.Name = "lazy" - FieldOptions_Deprecated_field_name protoreflect.Name = "deprecated" - FieldOptions_Weak_field_name protoreflect.Name = "weak" - FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype" - FieldOptions_Packed_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.packed" - FieldOptions_Jstype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.jstype" - FieldOptions_Lazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.lazy" - FieldOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.deprecated" - FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak" - FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.FieldOptions. -const ( - FieldOptions_Ctype_field_number protoreflect.FieldNumber = 1 - FieldOptions_Packed_field_number protoreflect.FieldNumber = 2 - FieldOptions_Jstype_field_number protoreflect.FieldNumber = 6 - FieldOptions_Lazy_field_number protoreflect.FieldNumber = 5 - FieldOptions_Deprecated_field_number protoreflect.FieldNumber = 3 - FieldOptions_Weak_field_number protoreflect.FieldNumber = 10 - FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Full and short names for google.protobuf.FieldOptions.CType. -const ( - FieldOptions_CType_enum_fullname = "google.protobuf.FieldOptions.CType" - FieldOptions_CType_enum_name = "CType" -) - -// Full and short names for google.protobuf.FieldOptions.JSType. -const ( - FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType" - FieldOptions_JSType_enum_name = "JSType" -) - -// Names for google.protobuf.OneofOptions. -const ( - OneofOptions_message_name protoreflect.Name = "OneofOptions" - OneofOptions_message_fullname protoreflect.FullName = "google.protobuf.OneofOptions" -) - -// Field names for google.protobuf.OneofOptions. -const ( - OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.OneofOptions. -const ( - OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Names for google.protobuf.EnumOptions. -const ( - EnumOptions_message_name protoreflect.Name = "EnumOptions" - EnumOptions_message_fullname protoreflect.FullName = "google.protobuf.EnumOptions" -) - -// Field names for google.protobuf.EnumOptions. -const ( - EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias" - EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated" - EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias" - EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated" - EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.EnumOptions. -const ( - EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2 - EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3 - EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Names for google.protobuf.EnumValueOptions. -const ( - EnumValueOptions_message_name protoreflect.Name = "EnumValueOptions" - EnumValueOptions_message_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions" -) - -// Field names for google.protobuf.EnumValueOptions. -const ( - EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated" - EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated" - EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.EnumValueOptions. -const ( - EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1 - EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Names for google.protobuf.ServiceOptions. -const ( - ServiceOptions_message_name protoreflect.Name = "ServiceOptions" - ServiceOptions_message_fullname protoreflect.FullName = "google.protobuf.ServiceOptions" -) - -// Field names for google.protobuf.ServiceOptions. -const ( - ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated" - ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated" - ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.ServiceOptions. -const ( - ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33 - ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Names for google.protobuf.MethodOptions. -const ( - MethodOptions_message_name protoreflect.Name = "MethodOptions" - MethodOptions_message_fullname protoreflect.FullName = "google.protobuf.MethodOptions" -) - -// Field names for google.protobuf.MethodOptions. -const ( - MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated" - MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level" - MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" - - MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated" - MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level" - MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option" -) - -// Field numbers for google.protobuf.MethodOptions. -const ( - MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33 - MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34 - MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 -) - -// Full and short names for google.protobuf.MethodOptions.IdempotencyLevel. -const ( - MethodOptions_IdempotencyLevel_enum_fullname = "google.protobuf.MethodOptions.IdempotencyLevel" - MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel" -) - -// Names for google.protobuf.UninterpretedOption. -const ( - UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption" - UninterpretedOption_message_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption" -) - -// Field names for google.protobuf.UninterpretedOption. -const ( - UninterpretedOption_Name_field_name protoreflect.Name = "name" - UninterpretedOption_IdentifierValue_field_name protoreflect.Name = "identifier_value" - UninterpretedOption_PositiveIntValue_field_name protoreflect.Name = "positive_int_value" - UninterpretedOption_NegativeIntValue_field_name protoreflect.Name = "negative_int_value" - UninterpretedOption_DoubleValue_field_name protoreflect.Name = "double_value" - UninterpretedOption_StringValue_field_name protoreflect.Name = "string_value" - UninterpretedOption_AggregateValue_field_name protoreflect.Name = "aggregate_value" - - UninterpretedOption_Name_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.name" - UninterpretedOption_IdentifierValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.identifier_value" - UninterpretedOption_PositiveIntValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.positive_int_value" - UninterpretedOption_NegativeIntValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.negative_int_value" - UninterpretedOption_DoubleValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.double_value" - UninterpretedOption_StringValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.string_value" - UninterpretedOption_AggregateValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.aggregate_value" -) - -// Field numbers for google.protobuf.UninterpretedOption. -const ( - UninterpretedOption_Name_field_number protoreflect.FieldNumber = 2 - UninterpretedOption_IdentifierValue_field_number protoreflect.FieldNumber = 3 - UninterpretedOption_PositiveIntValue_field_number protoreflect.FieldNumber = 4 - UninterpretedOption_NegativeIntValue_field_number protoreflect.FieldNumber = 5 - UninterpretedOption_DoubleValue_field_number protoreflect.FieldNumber = 6 - UninterpretedOption_StringValue_field_number protoreflect.FieldNumber = 7 - UninterpretedOption_AggregateValue_field_number protoreflect.FieldNumber = 8 -) - -// Names for google.protobuf.UninterpretedOption.NamePart. -const ( - UninterpretedOption_NamePart_message_name protoreflect.Name = "NamePart" - UninterpretedOption_NamePart_message_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.NamePart" -) - -// Field names for google.protobuf.UninterpretedOption.NamePart. -const ( - UninterpretedOption_NamePart_NamePart_field_name protoreflect.Name = "name_part" - UninterpretedOption_NamePart_IsExtension_field_name protoreflect.Name = "is_extension" - - UninterpretedOption_NamePart_NamePart_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.NamePart.name_part" - UninterpretedOption_NamePart_IsExtension_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.NamePart.is_extension" -) - -// Field numbers for google.protobuf.UninterpretedOption.NamePart. -const ( - UninterpretedOption_NamePart_NamePart_field_number protoreflect.FieldNumber = 1 - UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2 -) - -// Names for google.protobuf.SourceCodeInfo. -const ( - SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo" - SourceCodeInfo_message_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo" -) - -// Field names for google.protobuf.SourceCodeInfo. -const ( - SourceCodeInfo_Location_field_name protoreflect.Name = "location" - - SourceCodeInfo_Location_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.location" -) - -// Field numbers for google.protobuf.SourceCodeInfo. -const ( - SourceCodeInfo_Location_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.SourceCodeInfo.Location. -const ( - SourceCodeInfo_Location_message_name protoreflect.Name = "Location" - SourceCodeInfo_Location_message_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location" -) - -// Field names for google.protobuf.SourceCodeInfo.Location. -const ( - SourceCodeInfo_Location_Path_field_name protoreflect.Name = "path" - SourceCodeInfo_Location_Span_field_name protoreflect.Name = "span" - SourceCodeInfo_Location_LeadingComments_field_name protoreflect.Name = "leading_comments" - SourceCodeInfo_Location_TrailingComments_field_name protoreflect.Name = "trailing_comments" - SourceCodeInfo_Location_LeadingDetachedComments_field_name protoreflect.Name = "leading_detached_comments" - - SourceCodeInfo_Location_Path_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.path" - SourceCodeInfo_Location_Span_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.span" - SourceCodeInfo_Location_LeadingComments_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.leading_comments" - SourceCodeInfo_Location_TrailingComments_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.trailing_comments" - SourceCodeInfo_Location_LeadingDetachedComments_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.leading_detached_comments" -) - -// Field numbers for google.protobuf.SourceCodeInfo.Location. -const ( - SourceCodeInfo_Location_Path_field_number protoreflect.FieldNumber = 1 - SourceCodeInfo_Location_Span_field_number protoreflect.FieldNumber = 2 - SourceCodeInfo_Location_LeadingComments_field_number protoreflect.FieldNumber = 3 - SourceCodeInfo_Location_TrailingComments_field_number protoreflect.FieldNumber = 4 - SourceCodeInfo_Location_LeadingDetachedComments_field_number protoreflect.FieldNumber = 6 -) - -// Names for google.protobuf.GeneratedCodeInfo. -const ( - GeneratedCodeInfo_message_name protoreflect.Name = "GeneratedCodeInfo" - GeneratedCodeInfo_message_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo" -) - -// Field names for google.protobuf.GeneratedCodeInfo. -const ( - GeneratedCodeInfo_Annotation_field_name protoreflect.Name = "annotation" - - GeneratedCodeInfo_Annotation_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.annotation" -) - -// Field numbers for google.protobuf.GeneratedCodeInfo. -const ( - GeneratedCodeInfo_Annotation_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.GeneratedCodeInfo.Annotation. -const ( - GeneratedCodeInfo_Annotation_message_name protoreflect.Name = "Annotation" - GeneratedCodeInfo_Annotation_message_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation" -) - -// Field names for google.protobuf.GeneratedCodeInfo.Annotation. -const ( - GeneratedCodeInfo_Annotation_Path_field_name protoreflect.Name = "path" - GeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = "source_file" - GeneratedCodeInfo_Annotation_Begin_field_name protoreflect.Name = "begin" - GeneratedCodeInfo_Annotation_End_field_name protoreflect.Name = "end" - - GeneratedCodeInfo_Annotation_Path_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.path" - GeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.source_file" - GeneratedCodeInfo_Annotation_Begin_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.begin" - GeneratedCodeInfo_Annotation_End_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.end" -) - -// Field numbers for google.protobuf.GeneratedCodeInfo.Annotation. -const ( - GeneratedCodeInfo_Annotation_Path_field_number protoreflect.FieldNumber = 1 - GeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2 - GeneratedCodeInfo_Annotation_Begin_field_number protoreflect.FieldNumber = 3 - GeneratedCodeInfo_Annotation_End_field_number protoreflect.FieldNumber = 4 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/doc.go b/vendor/google.golang.org/protobuf/internal/genid/doc.go deleted file mode 100644 index 45ccd0121..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package genid contains constants for declarations in descriptor.proto -// and the well-known types. -package genid - -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" - -const GoogleProtobuf_package protoreflect.FullName = "google.protobuf" diff --git a/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go b/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go deleted file mode 100644 index b070ef4fd..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_duration_proto = "google/protobuf/duration.proto" - -// Names for google.protobuf.Duration. -const ( - Duration_message_name protoreflect.Name = "Duration" - Duration_message_fullname protoreflect.FullName = "google.protobuf.Duration" -) - -// Field names for google.protobuf.Duration. -const ( - Duration_Seconds_field_name protoreflect.Name = "seconds" - Duration_Nanos_field_name protoreflect.Name = "nanos" - - Duration_Seconds_field_fullname protoreflect.FullName = "google.protobuf.Duration.seconds" - Duration_Nanos_field_fullname protoreflect.FullName = "google.protobuf.Duration.nanos" -) - -// Field numbers for google.protobuf.Duration. -const ( - Duration_Seconds_field_number protoreflect.FieldNumber = 1 - Duration_Nanos_field_number protoreflect.FieldNumber = 2 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go b/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go deleted file mode 100644 index 762abb34a..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_empty_proto = "google/protobuf/empty.proto" - -// Names for google.protobuf.Empty. -const ( - Empty_message_name protoreflect.Name = "Empty" - Empty_message_fullname protoreflect.FullName = "google.protobuf.Empty" -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go b/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go deleted file mode 100644 index 70bed453f..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_field_mask_proto = "google/protobuf/field_mask.proto" - -// Names for google.protobuf.FieldMask. -const ( - FieldMask_message_name protoreflect.Name = "FieldMask" - FieldMask_message_fullname protoreflect.FullName = "google.protobuf.FieldMask" -) - -// Field names for google.protobuf.FieldMask. -const ( - FieldMask_Paths_field_name protoreflect.Name = "paths" - - FieldMask_Paths_field_fullname protoreflect.FullName = "google.protobuf.FieldMask.paths" -) - -// Field numbers for google.protobuf.FieldMask. -const ( - FieldMask_Paths_field_number protoreflect.FieldNumber = 1 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/goname.go b/vendor/google.golang.org/protobuf/internal/genid/goname.go deleted file mode 100644 index 693d2e9e1..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/goname.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package genid - -// Go names of implementation-specific struct fields in generated messages. -const ( - State_goname = "state" - - SizeCache_goname = "sizeCache" - SizeCacheA_goname = "XXX_sizecache" - - WeakFields_goname = "weakFields" - WeakFieldsA_goname = "XXX_weak" - - UnknownFields_goname = "unknownFields" - UnknownFieldsA_goname = "XXX_unrecognized" - - ExtensionFields_goname = "extensionFields" - ExtensionFieldsA_goname = "XXX_InternalExtensions" - ExtensionFieldsB_goname = "XXX_extensions" - - WeakFieldPrefix_goname = "XXX_weak_" -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go b/vendor/google.golang.org/protobuf/internal/genid/map_entry.go deleted file mode 100644 index 8f9ea02ff..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package genid - -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" - -// Generic field names and numbers for synthetic map entry messages. -const ( - MapEntry_Key_field_name protoreflect.Name = "key" - MapEntry_Value_field_name protoreflect.Name = "value" - - MapEntry_Key_field_number protoreflect.FieldNumber = 1 - MapEntry_Value_field_number protoreflect.FieldNumber = 2 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go b/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go deleted file mode 100644 index 3e99ae16c..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_source_context_proto = "google/protobuf/source_context.proto" - -// Names for google.protobuf.SourceContext. -const ( - SourceContext_message_name protoreflect.Name = "SourceContext" - SourceContext_message_fullname protoreflect.FullName = "google.protobuf.SourceContext" -) - -// Field names for google.protobuf.SourceContext. -const ( - SourceContext_FileName_field_name protoreflect.Name = "file_name" - - SourceContext_FileName_field_fullname protoreflect.FullName = "google.protobuf.SourceContext.file_name" -) - -// Field numbers for google.protobuf.SourceContext. -const ( - SourceContext_FileName_field_number protoreflect.FieldNumber = 1 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go b/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go deleted file mode 100644 index 1a38944b2..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_struct_proto = "google/protobuf/struct.proto" - -// Full and short names for google.protobuf.NullValue. -const ( - NullValue_enum_fullname = "google.protobuf.NullValue" - NullValue_enum_name = "NullValue" -) - -// Names for google.protobuf.Struct. -const ( - Struct_message_name protoreflect.Name = "Struct" - Struct_message_fullname protoreflect.FullName = "google.protobuf.Struct" -) - -// Field names for google.protobuf.Struct. -const ( - Struct_Fields_field_name protoreflect.Name = "fields" - - Struct_Fields_field_fullname protoreflect.FullName = "google.protobuf.Struct.fields" -) - -// Field numbers for google.protobuf.Struct. -const ( - Struct_Fields_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.Struct.FieldsEntry. -const ( - Struct_FieldsEntry_message_name protoreflect.Name = "FieldsEntry" - Struct_FieldsEntry_message_fullname protoreflect.FullName = "google.protobuf.Struct.FieldsEntry" -) - -// Field names for google.protobuf.Struct.FieldsEntry. -const ( - Struct_FieldsEntry_Key_field_name protoreflect.Name = "key" - Struct_FieldsEntry_Value_field_name protoreflect.Name = "value" - - Struct_FieldsEntry_Key_field_fullname protoreflect.FullName = "google.protobuf.Struct.FieldsEntry.key" - Struct_FieldsEntry_Value_field_fullname protoreflect.FullName = "google.protobuf.Struct.FieldsEntry.value" -) - -// Field numbers for google.protobuf.Struct.FieldsEntry. -const ( - Struct_FieldsEntry_Key_field_number protoreflect.FieldNumber = 1 - Struct_FieldsEntry_Value_field_number protoreflect.FieldNumber = 2 -) - -// Names for google.protobuf.Value. -const ( - Value_message_name protoreflect.Name = "Value" - Value_message_fullname protoreflect.FullName = "google.protobuf.Value" -) - -// Field names for google.protobuf.Value. -const ( - Value_NullValue_field_name protoreflect.Name = "null_value" - Value_NumberValue_field_name protoreflect.Name = "number_value" - Value_StringValue_field_name protoreflect.Name = "string_value" - Value_BoolValue_field_name protoreflect.Name = "bool_value" - Value_StructValue_field_name protoreflect.Name = "struct_value" - Value_ListValue_field_name protoreflect.Name = "list_value" - - Value_NullValue_field_fullname protoreflect.FullName = "google.protobuf.Value.null_value" - Value_NumberValue_field_fullname protoreflect.FullName = "google.protobuf.Value.number_value" - Value_StringValue_field_fullname protoreflect.FullName = "google.protobuf.Value.string_value" - Value_BoolValue_field_fullname protoreflect.FullName = "google.protobuf.Value.bool_value" - Value_StructValue_field_fullname protoreflect.FullName = "google.protobuf.Value.struct_value" - Value_ListValue_field_fullname protoreflect.FullName = "google.protobuf.Value.list_value" -) - -// Field numbers for google.protobuf.Value. -const ( - Value_NullValue_field_number protoreflect.FieldNumber = 1 - Value_NumberValue_field_number protoreflect.FieldNumber = 2 - Value_StringValue_field_number protoreflect.FieldNumber = 3 - Value_BoolValue_field_number protoreflect.FieldNumber = 4 - Value_StructValue_field_number protoreflect.FieldNumber = 5 - Value_ListValue_field_number protoreflect.FieldNumber = 6 -) - -// Oneof names for google.protobuf.Value. -const ( - Value_Kind_oneof_name protoreflect.Name = "kind" - - Value_Kind_oneof_fullname protoreflect.FullName = "google.protobuf.Value.kind" -) - -// Names for google.protobuf.ListValue. -const ( - ListValue_message_name protoreflect.Name = "ListValue" - ListValue_message_fullname protoreflect.FullName = "google.protobuf.ListValue" -) - -// Field names for google.protobuf.ListValue. -const ( - ListValue_Values_field_name protoreflect.Name = "values" - - ListValue_Values_field_fullname protoreflect.FullName = "google.protobuf.ListValue.values" -) - -// Field numbers for google.protobuf.ListValue. -const ( - ListValue_Values_field_number protoreflect.FieldNumber = 1 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go b/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go deleted file mode 100644 index f5cd5634c..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_timestamp_proto = "google/protobuf/timestamp.proto" - -// Names for google.protobuf.Timestamp. -const ( - Timestamp_message_name protoreflect.Name = "Timestamp" - Timestamp_message_fullname protoreflect.FullName = "google.protobuf.Timestamp" -) - -// Field names for google.protobuf.Timestamp. -const ( - Timestamp_Seconds_field_name protoreflect.Name = "seconds" - Timestamp_Nanos_field_name protoreflect.Name = "nanos" - - Timestamp_Seconds_field_fullname protoreflect.FullName = "google.protobuf.Timestamp.seconds" - Timestamp_Nanos_field_fullname protoreflect.FullName = "google.protobuf.Timestamp.nanos" -) - -// Field numbers for google.protobuf.Timestamp. -const ( - Timestamp_Seconds_field_number protoreflect.FieldNumber = 1 - Timestamp_Nanos_field_number protoreflect.FieldNumber = 2 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/type_gen.go b/vendor/google.golang.org/protobuf/internal/genid/type_gen.go deleted file mode 100644 index 3bc710138..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/type_gen.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_type_proto = "google/protobuf/type.proto" - -// Full and short names for google.protobuf.Syntax. -const ( - Syntax_enum_fullname = "google.protobuf.Syntax" - Syntax_enum_name = "Syntax" -) - -// Names for google.protobuf.Type. -const ( - Type_message_name protoreflect.Name = "Type" - Type_message_fullname protoreflect.FullName = "google.protobuf.Type" -) - -// Field names for google.protobuf.Type. -const ( - Type_Name_field_name protoreflect.Name = "name" - Type_Fields_field_name protoreflect.Name = "fields" - Type_Oneofs_field_name protoreflect.Name = "oneofs" - Type_Options_field_name protoreflect.Name = "options" - Type_SourceContext_field_name protoreflect.Name = "source_context" - Type_Syntax_field_name protoreflect.Name = "syntax" - - Type_Name_field_fullname protoreflect.FullName = "google.protobuf.Type.name" - Type_Fields_field_fullname protoreflect.FullName = "google.protobuf.Type.fields" - Type_Oneofs_field_fullname protoreflect.FullName = "google.protobuf.Type.oneofs" - Type_Options_field_fullname protoreflect.FullName = "google.protobuf.Type.options" - Type_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Type.source_context" - Type_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Type.syntax" -) - -// Field numbers for google.protobuf.Type. -const ( - Type_Name_field_number protoreflect.FieldNumber = 1 - Type_Fields_field_number protoreflect.FieldNumber = 2 - Type_Oneofs_field_number protoreflect.FieldNumber = 3 - Type_Options_field_number protoreflect.FieldNumber = 4 - Type_SourceContext_field_number protoreflect.FieldNumber = 5 - Type_Syntax_field_number protoreflect.FieldNumber = 6 -) - -// Names for google.protobuf.Field. -const ( - Field_message_name protoreflect.Name = "Field" - Field_message_fullname protoreflect.FullName = "google.protobuf.Field" -) - -// Field names for google.protobuf.Field. -const ( - Field_Kind_field_name protoreflect.Name = "kind" - Field_Cardinality_field_name protoreflect.Name = "cardinality" - Field_Number_field_name protoreflect.Name = "number" - Field_Name_field_name protoreflect.Name = "name" - Field_TypeUrl_field_name protoreflect.Name = "type_url" - Field_OneofIndex_field_name protoreflect.Name = "oneof_index" - Field_Packed_field_name protoreflect.Name = "packed" - Field_Options_field_name protoreflect.Name = "options" - Field_JsonName_field_name protoreflect.Name = "json_name" - Field_DefaultValue_field_name protoreflect.Name = "default_value" - - Field_Kind_field_fullname protoreflect.FullName = "google.protobuf.Field.kind" - Field_Cardinality_field_fullname protoreflect.FullName = "google.protobuf.Field.cardinality" - Field_Number_field_fullname protoreflect.FullName = "google.protobuf.Field.number" - Field_Name_field_fullname protoreflect.FullName = "google.protobuf.Field.name" - Field_TypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Field.type_url" - Field_OneofIndex_field_fullname protoreflect.FullName = "google.protobuf.Field.oneof_index" - Field_Packed_field_fullname protoreflect.FullName = "google.protobuf.Field.packed" - Field_Options_field_fullname protoreflect.FullName = "google.protobuf.Field.options" - Field_JsonName_field_fullname protoreflect.FullName = "google.protobuf.Field.json_name" - Field_DefaultValue_field_fullname protoreflect.FullName = "google.protobuf.Field.default_value" -) - -// Field numbers for google.protobuf.Field. -const ( - Field_Kind_field_number protoreflect.FieldNumber = 1 - Field_Cardinality_field_number protoreflect.FieldNumber = 2 - Field_Number_field_number protoreflect.FieldNumber = 3 - Field_Name_field_number protoreflect.FieldNumber = 4 - Field_TypeUrl_field_number protoreflect.FieldNumber = 6 - Field_OneofIndex_field_number protoreflect.FieldNumber = 7 - Field_Packed_field_number protoreflect.FieldNumber = 8 - Field_Options_field_number protoreflect.FieldNumber = 9 - Field_JsonName_field_number protoreflect.FieldNumber = 10 - Field_DefaultValue_field_number protoreflect.FieldNumber = 11 -) - -// Full and short names for google.protobuf.Field.Kind. -const ( - Field_Kind_enum_fullname = "google.protobuf.Field.Kind" - Field_Kind_enum_name = "Kind" -) - -// Full and short names for google.protobuf.Field.Cardinality. -const ( - Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality" - Field_Cardinality_enum_name = "Cardinality" -) - -// Names for google.protobuf.Enum. -const ( - Enum_message_name protoreflect.Name = "Enum" - Enum_message_fullname protoreflect.FullName = "google.protobuf.Enum" -) - -// Field names for google.protobuf.Enum. -const ( - Enum_Name_field_name protoreflect.Name = "name" - Enum_Enumvalue_field_name protoreflect.Name = "enumvalue" - Enum_Options_field_name protoreflect.Name = "options" - Enum_SourceContext_field_name protoreflect.Name = "source_context" - Enum_Syntax_field_name protoreflect.Name = "syntax" - - Enum_Name_field_fullname protoreflect.FullName = "google.protobuf.Enum.name" - Enum_Enumvalue_field_fullname protoreflect.FullName = "google.protobuf.Enum.enumvalue" - Enum_Options_field_fullname protoreflect.FullName = "google.protobuf.Enum.options" - Enum_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Enum.source_context" - Enum_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Enum.syntax" -) - -// Field numbers for google.protobuf.Enum. -const ( - Enum_Name_field_number protoreflect.FieldNumber = 1 - Enum_Enumvalue_field_number protoreflect.FieldNumber = 2 - Enum_Options_field_number protoreflect.FieldNumber = 3 - Enum_SourceContext_field_number protoreflect.FieldNumber = 4 - Enum_Syntax_field_number protoreflect.FieldNumber = 5 -) - -// Names for google.protobuf.EnumValue. -const ( - EnumValue_message_name protoreflect.Name = "EnumValue" - EnumValue_message_fullname protoreflect.FullName = "google.protobuf.EnumValue" -) - -// Field names for google.protobuf.EnumValue. -const ( - EnumValue_Name_field_name protoreflect.Name = "name" - EnumValue_Number_field_name protoreflect.Name = "number" - EnumValue_Options_field_name protoreflect.Name = "options" - - EnumValue_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumValue.name" - EnumValue_Number_field_fullname protoreflect.FullName = "google.protobuf.EnumValue.number" - EnumValue_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumValue.options" -) - -// Field numbers for google.protobuf.EnumValue. -const ( - EnumValue_Name_field_number protoreflect.FieldNumber = 1 - EnumValue_Number_field_number protoreflect.FieldNumber = 2 - EnumValue_Options_field_number protoreflect.FieldNumber = 3 -) - -// Names for google.protobuf.Option. -const ( - Option_message_name protoreflect.Name = "Option" - Option_message_fullname protoreflect.FullName = "google.protobuf.Option" -) - -// Field names for google.protobuf.Option. -const ( - Option_Name_field_name protoreflect.Name = "name" - Option_Value_field_name protoreflect.Name = "value" - - Option_Name_field_fullname protoreflect.FullName = "google.protobuf.Option.name" - Option_Value_field_fullname protoreflect.FullName = "google.protobuf.Option.value" -) - -// Field numbers for google.protobuf.Option. -const ( - Option_Name_field_number protoreflect.FieldNumber = 1 - Option_Value_field_number protoreflect.FieldNumber = 2 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go b/vendor/google.golang.org/protobuf/internal/genid/wrappers.go deleted file mode 100644 index 429384b85..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package genid - -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" - -// Generic field name and number for messages in wrappers.proto. -const ( - WrapperValue_Value_field_name protoreflect.Name = "value" - WrapperValue_Value_field_number protoreflect.FieldNumber = 1 -) diff --git a/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go b/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go deleted file mode 100644 index 72527d2ab..000000000 --- a/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2019 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. - -// Code generated by generate-protos. DO NOT EDIT. - -package genid - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" -) - -const File_google_protobuf_wrappers_proto = "google/protobuf/wrappers.proto" - -// Names for google.protobuf.DoubleValue. -const ( - DoubleValue_message_name protoreflect.Name = "DoubleValue" - DoubleValue_message_fullname protoreflect.FullName = "google.protobuf.DoubleValue" -) - -// Field names for google.protobuf.DoubleValue. -const ( - DoubleValue_Value_field_name protoreflect.Name = "value" - - DoubleValue_Value_field_fullname protoreflect.FullName = "google.protobuf.DoubleValue.value" -) - -// Field numbers for google.protobuf.DoubleValue. -const ( - DoubleValue_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.FloatValue. -const ( - FloatValue_message_name protoreflect.Name = "FloatValue" - FloatValue_message_fullname protoreflect.FullName = "google.protobuf.FloatValue" -) - -// Field names for google.protobuf.FloatValue. -const ( - FloatValue_Value_field_name protoreflect.Name = "value" - - FloatValue_Value_field_fullname protoreflect.FullName = "google.protobuf.FloatValue.value" -) - -// Field numbers for google.protobuf.FloatValue. -const ( - FloatValue_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.Int64Value. -const ( - Int64Value_message_name protoreflect.Name = "Int64Value" - Int64Value_message_fullname protoreflect.FullName = "google.protobuf.Int64Value" -) - -// Field names for google.protobuf.Int64Value. -const ( - Int64Value_Value_field_name protoreflect.Name = "value" - - Int64Value_Value_field_fullname protoreflect.FullName = "google.protobuf.Int64Value.value" -) - -// Field numbers for google.protobuf.Int64Value. -const ( - Int64Value_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.UInt64Value. -const ( - UInt64Value_message_name protoreflect.Name = "UInt64Value" - UInt64Value_message_fullname protoreflect.FullName = "google.protobuf.UInt64Value" -) - -// Field names for google.protobuf.UInt64Value. -const ( - UInt64Value_Value_field_name protoreflect.Name = "value" - - UInt64Value_Value_field_fullname protoreflect.FullName = "google.protobuf.UInt64Value.value" -) - -// Field numbers for google.protobuf.UInt64Value. -const ( - UInt64Value_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.Int32Value. -const ( - Int32Value_message_name protoreflect.Name = "Int32Value" - Int32Value_message_fullname protoreflect.FullName = "google.protobuf.Int32Value" -) - -// Field names for google.protobuf.Int32Value. -const ( - Int32Value_Value_field_name protoreflect.Name = "value" - - Int32Value_Value_field_fullname protoreflect.FullName = "google.protobuf.Int32Value.value" -) - -// Field numbers for google.protobuf.Int32Value. -const ( - Int32Value_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.UInt32Value. -const ( - UInt32Value_message_name protoreflect.Name = "UInt32Value" - UInt32Value_message_fullname protoreflect.FullName = "google.protobuf.UInt32Value" -) - -// Field names for google.protobuf.UInt32Value. -const ( - UInt32Value_Value_field_name protoreflect.Name = "value" - - UInt32Value_Value_field_fullname protoreflect.FullName = "google.protobuf.UInt32Value.value" -) - -// Field numbers for google.protobuf.UInt32Value. -const ( - UInt32Value_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.BoolValue. -const ( - BoolValue_message_name protoreflect.Name = "BoolValue" - BoolValue_message_fullname protoreflect.FullName = "google.protobuf.BoolValue" -) - -// Field names for google.protobuf.BoolValue. -const ( - BoolValue_Value_field_name protoreflect.Name = "value" - - BoolValue_Value_field_fullname protoreflect.FullName = "google.protobuf.BoolValue.value" -) - -// Field numbers for google.protobuf.BoolValue. -const ( - BoolValue_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.StringValue. -const ( - StringValue_message_name protoreflect.Name = "StringValue" - StringValue_message_fullname protoreflect.FullName = "google.protobuf.StringValue" -) - -// Field names for google.protobuf.StringValue. -const ( - StringValue_Value_field_name protoreflect.Name = "value" - - StringValue_Value_field_fullname protoreflect.FullName = "google.protobuf.StringValue.value" -) - -// Field numbers for google.protobuf.StringValue. -const ( - StringValue_Value_field_number protoreflect.FieldNumber = 1 -) - -// Names for google.protobuf.BytesValue. -const ( - BytesValue_message_name protoreflect.Name = "BytesValue" - BytesValue_message_fullname protoreflect.FullName = "google.protobuf.BytesValue" -) - -// Field names for google.protobuf.BytesValue. -const ( - BytesValue_Value_field_name protoreflect.Name = "value" - - BytesValue_Value_field_fullname protoreflect.FullName = "google.protobuf.BytesValue.value" -) - -// Field numbers for google.protobuf.BytesValue. -const ( - BytesValue_Value_field_number protoreflect.FieldNumber = 1 -) diff --git a/vendor/google.golang.org/protobuf/internal/impl/api_export.go b/vendor/google.golang.org/protobuf/internal/impl/api_export.go deleted file mode 100644 index b5974528d..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/api_export.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - "strconv" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/proto" - pref "google.golang.org/protobuf/reflect/protoreflect" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -// Export is a zero-length named type that exists only to export a set of -// functions that we do not want to appear in godoc. -type Export struct{} - -// NewError formats a string according to the format specifier and arguments and -// returns an error that has a "proto" prefix. -func (Export) NewError(f string, x ...interface{}) error { - return errors.New(f, x...) -} - -// enum is any enum type generated by protoc-gen-go -// and must be a named int32 type. -type enum = interface{} - -// EnumOf returns the protoreflect.Enum interface over e. -// It returns nil if e is nil. -func (Export) EnumOf(e enum) pref.Enum { - switch e := e.(type) { - case nil: - return nil - case pref.Enum: - return e - default: - return legacyWrapEnum(reflect.ValueOf(e)) - } -} - -// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e. -// It returns nil if e is nil. -func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor { - switch e := e.(type) { - case nil: - return nil - case pref.Enum: - return e.Descriptor() - default: - return LegacyLoadEnumDesc(reflect.TypeOf(e)) - } -} - -// EnumTypeOf returns the protoreflect.EnumType for e. -// It returns nil if e is nil. -func (Export) EnumTypeOf(e enum) pref.EnumType { - switch e := e.(type) { - case nil: - return nil - case pref.Enum: - return e.Type() - default: - return legacyLoadEnumType(reflect.TypeOf(e)) - } -} - -// EnumStringOf returns the enum value as a string, either as the name if -// the number is resolvable, or the number formatted as a string. -func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string { - ev := ed.Values().ByNumber(n) - if ev != nil { - return string(ev.Name()) - } - return strconv.Itoa(int(n)) -} - -// message is any message type generated by protoc-gen-go -// and must be a pointer to a named struct type. -type message = interface{} - -// legacyMessageWrapper wraps a v2 message as a v1 message. -type legacyMessageWrapper struct{ m pref.ProtoMessage } - -func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) } -func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) } -func (m legacyMessageWrapper) ProtoMessage() {} - -// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message. -// It returns nil if m is nil. -func (Export) ProtoMessageV1Of(m message) piface.MessageV1 { - switch mv := m.(type) { - case nil: - return nil - case piface.MessageV1: - return mv - case unwrapper: - return Export{}.ProtoMessageV1Of(mv.protoUnwrap()) - case pref.ProtoMessage: - return legacyMessageWrapper{mv} - default: - panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m)) - } -} - -func (Export) protoMessageV2Of(m message) pref.ProtoMessage { - switch mv := m.(type) { - case nil: - return nil - case pref.ProtoMessage: - return mv - case legacyMessageWrapper: - return mv.m - case piface.MessageV1: - return nil - default: - panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m)) - } -} - -// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message. -// It returns nil if m is nil. -func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage { - if m == nil { - return nil - } - if mv := (Export{}).protoMessageV2Of(m); mv != nil { - return mv - } - return legacyWrapMessage(reflect.ValueOf(m)).Interface() -} - -// MessageOf returns the protoreflect.Message interface over m. -// It returns nil if m is nil. -func (Export) MessageOf(m message) pref.Message { - if m == nil { - return nil - } - if mv := (Export{}).protoMessageV2Of(m); mv != nil { - return mv.ProtoReflect() - } - return legacyWrapMessage(reflect.ValueOf(m)) -} - -// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m. -// It returns nil if m is nil. -func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor { - if m == nil { - return nil - } - if mv := (Export{}).protoMessageV2Of(m); mv != nil { - return mv.ProtoReflect().Descriptor() - } - return LegacyLoadMessageDesc(reflect.TypeOf(m)) -} - -// MessageTypeOf returns the protoreflect.MessageType for m. -// It returns nil if m is nil. -func (Export) MessageTypeOf(m message) pref.MessageType { - if m == nil { - return nil - } - if mv := (Export{}).protoMessageV2Of(m); mv != nil { - return mv.ProtoReflect().Type() - } - return legacyLoadMessageInfo(reflect.TypeOf(m), "") -} - -// MessageStringOf returns the message value as a string, -// which is the message serialized in the protobuf text format. -func (Export) MessageStringOf(m pref.ProtoMessage) string { - return prototext.MarshalOptions{Multiline: false}.Format(m) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go deleted file mode 100644 index b82341e57..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "sync" - - "google.golang.org/protobuf/internal/errors" - pref "google.golang.org/protobuf/reflect/protoreflect" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -func (mi *MessageInfo) checkInitialized(in piface.CheckInitializedInput) (piface.CheckInitializedOutput, error) { - var p pointer - if ms, ok := in.Message.(*messageState); ok { - p = ms.pointer() - } else { - p = in.Message.(*messageReflectWrapper).pointer() - } - return piface.CheckInitializedOutput{}, mi.checkInitializedPointer(p) -} - -func (mi *MessageInfo) checkInitializedPointer(p pointer) error { - mi.init() - if !mi.needsInitCheck { - return nil - } - if p.IsNil() { - for _, f := range mi.orderedCoderFields { - if f.isRequired { - return errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName())) - } - } - return nil - } - if mi.extensionOffset.IsValid() { - e := p.Apply(mi.extensionOffset).Extensions() - if err := mi.isInitExtensions(e); err != nil { - return err - } - } - for _, f := range mi.orderedCoderFields { - if !f.isRequired && f.funcs.isInit == nil { - continue - } - fptr := p.Apply(f.offset) - if f.isPointer && fptr.Elem().IsNil() { - if f.isRequired { - return errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName())) - } - continue - } - if f.funcs.isInit == nil { - continue - } - if err := f.funcs.isInit(fptr, f); err != nil { - return err - } - } - return nil -} - -func (mi *MessageInfo) isInitExtensions(ext *map[int32]ExtensionField) error { - if ext == nil { - return nil - } - for _, x := range *ext { - ei := getExtensionFieldInfo(x.Type()) - if ei.funcs.isInit == nil { - continue - } - v := x.Value() - if !v.IsValid() { - continue - } - if err := ei.funcs.isInit(v); err != nil { - return err - } - } - return nil -} - -var ( - needsInitCheckMu sync.Mutex - needsInitCheckMap sync.Map -) - -// needsInitCheck reports whether a message needs to be checked for partial initialization. -// -// It returns true if the message transitively includes any required or extension fields. -func needsInitCheck(md pref.MessageDescriptor) bool { - if v, ok := needsInitCheckMap.Load(md); ok { - if has, ok := v.(bool); ok { - return has - } - } - needsInitCheckMu.Lock() - defer needsInitCheckMu.Unlock() - return needsInitCheckLocked(md) -} - -func needsInitCheckLocked(md pref.MessageDescriptor) (has bool) { - if v, ok := needsInitCheckMap.Load(md); ok { - // If has is true, we've previously determined that this message - // needs init checks. - // - // If has is false, we've previously determined that it can never - // be uninitialized. - // - // If has is not a bool, we've just encountered a cycle in the - // message graph. In this case, it is safe to return false: If - // the message does have required fields, we'll detect them later - // in the graph traversal. - has, ok := v.(bool) - return ok && has - } - needsInitCheckMap.Store(md, struct{}{}) // avoid cycles while descending into this message - defer func() { - needsInitCheckMap.Store(md, has) - }() - if md.RequiredNumbers().Len() > 0 { - return true - } - if md.ExtensionRanges().Len() > 0 { - return true - } - for i := 0; i < md.Fields().Len(); i++ { - fd := md.Fields().Get(i) - // Map keys are never messages, so just consider the map value. - if fd.IsMap() { - fd = fd.MapValue() - } - fmd := fd.Message() - if fmd != nil && needsInitCheckLocked(fmd) { - return true - } - } - return false -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go deleted file mode 100644 index 08d35170b..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "sync" - "sync/atomic" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/errors" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type extensionFieldInfo struct { - wiretag uint64 - tagsize int - unmarshalNeedsValue bool - funcs valueCoderFuncs - validation validationInfo -} - -var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo - -func getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo { - if xi, ok := xt.(*ExtensionInfo); ok { - xi.lazyInit() - return xi.info - } - return legacyLoadExtensionFieldInfo(xt) -} - -// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt. -func legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo { - if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok { - return xi.(*extensionFieldInfo) - } - e := makeExtensionFieldInfo(xt.TypeDescriptor()) - if e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok { - return e.(*extensionFieldInfo) - } - return e -} - -func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo { - var wiretag uint64 - if !xd.IsPacked() { - wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()]) - } else { - wiretag = protowire.EncodeTag(xd.Number(), protowire.BytesType) - } - e := &extensionFieldInfo{ - wiretag: wiretag, - tagsize: protowire.SizeVarint(wiretag), - funcs: encoderFuncsForValue(xd), - } - // Does the unmarshal function need a value passed to it? - // This is true for composite types, where we pass in a message, list, or map to fill in, - // and for enums, where we pass in a prototype value to specify the concrete enum type. - switch xd.Kind() { - case pref.MessageKind, pref.GroupKind, pref.EnumKind: - e.unmarshalNeedsValue = true - default: - if xd.Cardinality() == pref.Repeated { - e.unmarshalNeedsValue = true - } - } - return e -} - -type lazyExtensionValue struct { - atomicOnce uint32 // atomically set if value is valid - mu sync.Mutex - xi *extensionFieldInfo - value pref.Value - b []byte - fn func() pref.Value -} - -type ExtensionField struct { - typ pref.ExtensionType - - // value is either the value of GetValue, - // or a *lazyExtensionValue that then returns the value of GetValue. - value pref.Value - lazy *lazyExtensionValue -} - -func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) { - if f.lazy == nil { - f.lazy = &lazyExtensionValue{xi: xi} - } - f.typ = xt - f.lazy.xi = xi - f.lazy.b = protowire.AppendTag(f.lazy.b, num, wtyp) - f.lazy.b = append(f.lazy.b, b...) -} - -func (f *ExtensionField) canLazy(xt pref.ExtensionType) bool { - if f.typ == nil { - return true - } - if f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0 { - return true - } - return false -} - -func (f *ExtensionField) lazyInit() { - f.lazy.mu.Lock() - defer f.lazy.mu.Unlock() - if atomic.LoadUint32(&f.lazy.atomicOnce) == 1 { - return - } - if f.lazy.xi != nil { - b := f.lazy.b - val := f.typ.New() - for len(b) > 0 { - var tag uint64 - if b[0] < 0x80 { - tag = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - tag = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - tag, n = protowire.ConsumeVarint(b) - if n < 0 { - panic(errors.New("bad tag in lazy extension decoding")) - } - b = b[n:] - } - num := protowire.Number(tag >> 3) - wtyp := protowire.Type(tag & 7) - var out unmarshalOutput - var err error - val, out, err = f.lazy.xi.funcs.unmarshal(b, val, num, wtyp, lazyUnmarshalOptions) - if err != nil { - panic(errors.New("decode failure in lazy extension decoding: %v", err)) - } - b = b[out.n:] - } - f.lazy.value = val - } else { - f.lazy.value = f.lazy.fn() - } - f.lazy.xi = nil - f.lazy.fn = nil - f.lazy.b = nil - atomic.StoreUint32(&f.lazy.atomicOnce, 1) -} - -// Set sets the type and value of the extension field. -// This must not be called concurrently. -func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) { - f.typ = t - f.value = v - f.lazy = nil -} - -// SetLazy sets the type and a value that is to be lazily evaluated upon first use. -// This must not be called concurrently. -func (f *ExtensionField) SetLazy(t pref.ExtensionType, fn func() pref.Value) { - f.typ = t - f.lazy = &lazyExtensionValue{fn: fn} -} - -// Value returns the value of the extension field. -// This may be called concurrently. -func (f *ExtensionField) Value() pref.Value { - if f.lazy != nil { - if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 { - f.lazyInit() - } - return f.lazy.value - } - return f.value -} - -// Type returns the type of the extension field. -// This may be called concurrently. -func (f ExtensionField) Type() pref.ExtensionType { - return f.typ -} - -// IsSet returns whether the extension field is set. -// This may be called concurrently. -func (f ExtensionField) IsSet() bool { - return f.typ != nil -} - -// IsLazy reports whether a field is lazily encoded. -// It is exported for testing. -func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool { - var mi *MessageInfo - var p pointer - switch m := m.(type) { - case *messageState: - mi = m.messageInfo() - p = m.pointer() - case *messageReflectWrapper: - mi = m.messageInfo() - p = m.pointer() - default: - return false - } - xd, ok := fd.(pref.ExtensionTypeDescriptor) - if !ok { - return false - } - xt := xd.Type() - ext := mi.extensionMap(p) - if ext == nil { - return false - } - f, ok := (*ext)[int32(fd.Number())] - if !ok { - return false - } - return f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0 -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go deleted file mode 100644 index c00744d38..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +++ /dev/null @@ -1,828 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - "sync" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -type errInvalidUTF8 struct{} - -func (errInvalidUTF8) Error() string { return "string field contains invalid UTF-8" } -func (errInvalidUTF8) InvalidUTF8() bool { return true } - -// initOneofFieldCoders initializes the fast-path functions for the fields in a oneof. -// -// For size, marshal, and isInit operations, functions are set only on the first field -// in the oneof. The functions are called when the oneof is non-nil, and will dispatch -// to the appropriate field-specific function as necessary. -// -// The unmarshal function is set on each field individually as usual. -func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structInfo) { - fs := si.oneofsByName[od.Name()] - ft := fs.Type - oneofFields := make(map[reflect.Type]*coderFieldInfo) - needIsInit := false - fields := od.Fields() - for i, lim := 0, fields.Len(); i < lim; i++ { - fd := od.Fields().Get(i) - num := fd.Number() - // Make a copy of the original coderFieldInfo for use in unmarshaling. - // - // oneofFields[oneofType].funcs.marshal is the field-specific marshal function. - // - // mi.coderFields[num].marshal is set on only the first field in the oneof, - // and dispatches to the field-specific marshaler in oneofFields. - cf := *mi.coderFields[num] - ot := si.oneofWrappersByNumber[num] - cf.ft = ot.Field(0).Type - cf.mi, cf.funcs = fieldCoder(fd, cf.ft) - oneofFields[ot] = &cf - if cf.funcs.isInit != nil { - needIsInit = true - } - mi.coderFields[num].funcs.unmarshal = func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - var vw reflect.Value // pointer to wrapper type - vi := p.AsValueOf(ft).Elem() // oneof field value of interface kind - if !vi.IsNil() && !vi.Elem().IsNil() && vi.Elem().Elem().Type() == ot { - vw = vi.Elem() - } else { - vw = reflect.New(ot) - } - out, err := cf.funcs.unmarshal(b, pointerOfValue(vw).Apply(zeroOffset), wtyp, &cf, opts) - if err != nil { - return out, err - } - vi.Set(vw) - return out, nil - } - } - getInfo := func(p pointer) (pointer, *coderFieldInfo) { - v := p.AsValueOf(ft).Elem() - if v.IsNil() { - return pointer{}, nil - } - v = v.Elem() // interface -> *struct - if v.IsNil() { - return pointer{}, nil - } - return pointerOfValue(v).Apply(zeroOffset), oneofFields[v.Elem().Type()] - } - first := mi.coderFields[od.Fields().Get(0).Number()] - first.funcs.size = func(p pointer, _ *coderFieldInfo, opts marshalOptions) int { - p, info := getInfo(p) - if info == nil || info.funcs.size == nil { - return 0 - } - return info.funcs.size(p, info, opts) - } - first.funcs.marshal = func(b []byte, p pointer, _ *coderFieldInfo, opts marshalOptions) ([]byte, error) { - p, info := getInfo(p) - if info == nil || info.funcs.marshal == nil { - return b, nil - } - return info.funcs.marshal(b, p, info, opts) - } - first.funcs.merge = func(dst, src pointer, _ *coderFieldInfo, opts mergeOptions) { - srcp, srcinfo := getInfo(src) - if srcinfo == nil || srcinfo.funcs.merge == nil { - return - } - dstp, dstinfo := getInfo(dst) - if dstinfo != srcinfo { - dst.AsValueOf(ft).Elem().Set(reflect.New(src.AsValueOf(ft).Elem().Elem().Elem().Type())) - dstp = pointerOfValue(dst.AsValueOf(ft).Elem().Elem()).Apply(zeroOffset) - } - srcinfo.funcs.merge(dstp, srcp, srcinfo, opts) - } - if needIsInit { - first.funcs.isInit = func(p pointer, _ *coderFieldInfo) error { - p, info := getInfo(p) - if info == nil || info.funcs.isInit == nil { - return nil - } - return info.funcs.isInit(p, info) - } - } -} - -func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs { - var once sync.Once - var messageType pref.MessageType - lazyInit := func() { - once.Do(func() { - messageName := fd.Message().FullName() - messageType, _ = preg.GlobalTypes.FindMessageByName(messageName) - }) - } - - return pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - m, ok := p.WeakFields().get(f.num) - if !ok { - return 0 - } - lazyInit() - if messageType == nil { - panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName())) - } - return sizeMessage(m, f.tagsize, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - m, ok := p.WeakFields().get(f.num) - if !ok { - return b, nil - } - lazyInit() - if messageType == nil { - panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName())) - } - return appendMessage(b, m, f.wiretag, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - fs := p.WeakFields() - m, ok := fs.get(f.num) - if !ok { - lazyInit() - if messageType == nil { - return unmarshalOutput{}, errUnknown - } - m = messageType.New().Interface() - fs.set(f.num, m) - } - return consumeMessage(b, m, wtyp, opts) - }, - isInit: func(p pointer, f *coderFieldInfo) error { - m, ok := p.WeakFields().get(f.num) - if !ok { - return nil - } - return proto.CheckInitialized(m) - }, - merge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - sm, ok := src.WeakFields().get(f.num) - if !ok { - return - } - dm, ok := dst.WeakFields().get(f.num) - if !ok { - lazyInit() - if messageType == nil { - panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName())) - } - dm = messageType.New().Interface() - dst.WeakFields().set(f.num, dm) - } - opts.Merge(dm, sm) - }, - } -} - -func makeMessageFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs { - if mi := getMessageInfo(ft); mi != nil { - funcs := pointerCoderFuncs{ - size: sizeMessageInfo, - marshal: appendMessageInfo, - unmarshal: consumeMessageInfo, - merge: mergeMessage, - } - if needsInitCheck(mi.Desc) { - funcs.isInit = isInitMessageInfo - } - return funcs - } else { - return pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - m := asMessage(p.AsValueOf(ft).Elem()) - return sizeMessage(m, f.tagsize, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - m := asMessage(p.AsValueOf(ft).Elem()) - return appendMessage(b, m, f.wiretag, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - mp := p.AsValueOf(ft).Elem() - if mp.IsNil() { - mp.Set(reflect.New(ft.Elem())) - } - return consumeMessage(b, asMessage(mp), wtyp, opts) - }, - isInit: func(p pointer, f *coderFieldInfo) error { - m := asMessage(p.AsValueOf(ft).Elem()) - return proto.CheckInitialized(m) - }, - merge: mergeMessage, - } - } -} - -func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int { - return protowire.SizeBytes(f.mi.sizePointer(p.Elem(), opts)) + f.tagsize -} - -func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts))) - return f.mi.marshalAppendPointer(b, p.Elem(), opts) -} - -func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if p.Elem().IsNil() { - p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) - } - o, err := f.mi.unmarshalPointer(v, p.Elem(), 0, opts) - if err != nil { - return out, err - } - out.n = n - out.initialized = o.initialized - return out, nil -} - -func isInitMessageInfo(p pointer, f *coderFieldInfo) error { - return f.mi.checkInitializedPointer(p.Elem()) -} - -func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int { - return protowire.SizeBytes(proto.Size(m)) + tagsize -} - -func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(proto.Size(m))) - return opts.Options().MarshalAppend(b, m) -} - -func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ - Buf: v, - Message: m.ProtoReflect(), - }) - if err != nil { - return out, err - } - out.n = n - out.initialized = o.Flags&piface.UnmarshalInitialized != 0 - return out, nil -} - -func sizeMessageValue(v pref.Value, tagsize int, opts marshalOptions) int { - m := v.Message().Interface() - return sizeMessage(m, tagsize, opts) -} - -func appendMessageValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { - m := v.Message().Interface() - return appendMessage(b, m, wiretag, opts) -} - -func consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) { - m := v.Message().Interface() - out, err := consumeMessage(b, m, wtyp, opts) - return v, out, err -} - -func isInitMessageValue(v pref.Value) error { - m := v.Message().Interface() - return proto.CheckInitialized(m) -} - -var coderMessageValue = valueCoderFuncs{ - size: sizeMessageValue, - marshal: appendMessageValue, - unmarshal: consumeMessageValue, - isInit: isInitMessageValue, - merge: mergeMessageValue, -} - -func sizeGroupValue(v pref.Value, tagsize int, opts marshalOptions) int { - m := v.Message().Interface() - return sizeGroup(m, tagsize, opts) -} - -func appendGroupValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { - m := v.Message().Interface() - return appendGroup(b, m, wiretag, opts) -} - -func consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) { - m := v.Message().Interface() - out, err := consumeGroup(b, m, num, wtyp, opts) - return v, out, err -} - -var coderGroupValue = valueCoderFuncs{ - size: sizeGroupValue, - marshal: appendGroupValue, - unmarshal: consumeGroupValue, - isInit: isInitMessageValue, - merge: mergeMessageValue, -} - -func makeGroupFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs { - num := fd.Number() - if mi := getMessageInfo(ft); mi != nil { - funcs := pointerCoderFuncs{ - size: sizeGroupType, - marshal: appendGroupType, - unmarshal: consumeGroupType, - merge: mergeMessage, - } - if needsInitCheck(mi.Desc) { - funcs.isInit = isInitMessageInfo - } - return funcs - } else { - return pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - m := asMessage(p.AsValueOf(ft).Elem()) - return sizeGroup(m, f.tagsize, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - m := asMessage(p.AsValueOf(ft).Elem()) - return appendGroup(b, m, f.wiretag, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - mp := p.AsValueOf(ft).Elem() - if mp.IsNil() { - mp.Set(reflect.New(ft.Elem())) - } - return consumeGroup(b, asMessage(mp), num, wtyp, opts) - }, - isInit: func(p pointer, f *coderFieldInfo) error { - m := asMessage(p.AsValueOf(ft).Elem()) - return proto.CheckInitialized(m) - }, - merge: mergeMessage, - } - } -} - -func sizeGroupType(p pointer, f *coderFieldInfo, opts marshalOptions) int { - return 2*f.tagsize + f.mi.sizePointer(p.Elem(), opts) -} - -func appendGroupType(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, f.wiretag) // start group - b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts) - b = protowire.AppendVarint(b, f.wiretag+1) // end group - return b, err -} - -func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.StartGroupType { - return out, errUnknown - } - if p.Elem().IsNil() { - p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) - } - return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts) -} - -func sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int { - return 2*tagsize + proto.Size(m) -} - -func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) // start group - b, err := opts.Options().MarshalAppend(b, m) - b = protowire.AppendVarint(b, wiretag+1) // end group - return b, err -} - -func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.StartGroupType { - return out, errUnknown - } - b, n := protowire.ConsumeGroup(num, b) - if n < 0 { - return out, protowire.ParseError(n) - } - o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ - Buf: b, - Message: m.ProtoReflect(), - }) - if err != nil { - return out, err - } - out.n = n - out.initialized = o.Flags&piface.UnmarshalInitialized != 0 - return out, nil -} - -func makeMessageSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs { - if mi := getMessageInfo(ft); mi != nil { - funcs := pointerCoderFuncs{ - size: sizeMessageSliceInfo, - marshal: appendMessageSliceInfo, - unmarshal: consumeMessageSliceInfo, - merge: mergeMessageSlice, - } - if needsInitCheck(mi.Desc) { - funcs.isInit = isInitMessageSliceInfo - } - return funcs - } - return pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - return sizeMessageSlice(p, ft, f.tagsize, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - return appendMessageSlice(b, p, f.wiretag, ft, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - return consumeMessageSlice(b, p, ft, wtyp, opts) - }, - isInit: func(p pointer, f *coderFieldInfo) error { - return isInitMessageSlice(p, ft) - }, - merge: mergeMessageSlice, - } -} - -func sizeMessageSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int { - s := p.PointerSlice() - n := 0 - for _, v := range s { - n += protowire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize - } - return n -} - -func appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.PointerSlice() - var err error - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - siz := f.mi.sizePointer(v, opts) - b = protowire.AppendVarint(b, uint64(siz)) - b, err = f.mi.marshalAppendPointer(b, v, opts) - if err != nil { - return b, err - } - } - return b, nil -} - -func consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - m := reflect.New(f.mi.GoReflectType.Elem()).Interface() - mp := pointerOfIface(m) - o, err := f.mi.unmarshalPointer(v, mp, 0, opts) - if err != nil { - return out, err - } - p.AppendPointerSlice(mp) - out.n = n - out.initialized = o.initialized - return out, nil -} - -func isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error { - s := p.PointerSlice() - for _, v := range s { - if err := f.mi.checkInitializedPointer(v); err != nil { - return err - } - } - return nil -} - -func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int { - s := p.PointerSlice() - n := 0 - for _, v := range s { - m := asMessage(v.AsValueOf(goType.Elem())) - n += protowire.SizeBytes(proto.Size(m)) + tagsize - } - return n -} - -func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) { - s := p.PointerSlice() - var err error - for _, v := range s { - m := asMessage(v.AsValueOf(goType.Elem())) - b = protowire.AppendVarint(b, wiretag) - siz := proto.Size(m) - b = protowire.AppendVarint(b, uint64(siz)) - b, err = opts.Options().MarshalAppend(b, m) - if err != nil { - return b, err - } - } - return b, nil -} - -func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - mp := reflect.New(goType.Elem()) - o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ - Buf: v, - Message: asMessage(mp).ProtoReflect(), - }) - if err != nil { - return out, err - } - p.AppendPointerSlice(pointerOfValue(mp)) - out.n = n - out.initialized = o.Flags&piface.UnmarshalInitialized != 0 - return out, nil -} - -func isInitMessageSlice(p pointer, goType reflect.Type) error { - s := p.PointerSlice() - for _, v := range s { - m := asMessage(v.AsValueOf(goType.Elem())) - if err := proto.CheckInitialized(m); err != nil { - return err - } - } - return nil -} - -// Slices of messages - -func sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int { - list := listv.List() - n := 0 - for i, llen := 0, list.Len(); i < llen; i++ { - m := list.Get(i).Message().Interface() - n += protowire.SizeBytes(proto.Size(m)) + tagsize - } - return n -} - -func appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { - list := listv.List() - mopts := opts.Options() - for i, llen := 0, list.Len(); i < llen; i++ { - m := list.Get(i).Message().Interface() - b = protowire.AppendVarint(b, wiretag) - siz := proto.Size(m) - b = protowire.AppendVarint(b, uint64(siz)) - var err error - b, err = mopts.MarshalAppend(b, m) - if err != nil { - return b, err - } - } - return b, nil -} - -func consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp != protowire.BytesType { - return pref.Value{}, out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return pref.Value{}, out, protowire.ParseError(n) - } - m := list.NewElement() - o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ - Buf: v, - Message: m.Message(), - }) - if err != nil { - return pref.Value{}, out, err - } - list.Append(m) - out.n = n - out.initialized = o.Flags&piface.UnmarshalInitialized != 0 - return listv, out, nil -} - -func isInitMessageSliceValue(listv pref.Value) error { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - m := list.Get(i).Message().Interface() - if err := proto.CheckInitialized(m); err != nil { - return err - } - } - return nil -} - -var coderMessageSliceValue = valueCoderFuncs{ - size: sizeMessageSliceValue, - marshal: appendMessageSliceValue, - unmarshal: consumeMessageSliceValue, - isInit: isInitMessageSliceValue, - merge: mergeMessageListValue, -} - -func sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int { - list := listv.List() - n := 0 - for i, llen := 0, list.Len(); i < llen; i++ { - m := list.Get(i).Message().Interface() - n += 2*tagsize + proto.Size(m) - } - return n -} - -func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { - list := listv.List() - mopts := opts.Options() - for i, llen := 0, list.Len(); i < llen; i++ { - m := list.Get(i).Message().Interface() - b = protowire.AppendVarint(b, wiretag) // start group - var err error - b, err = mopts.MarshalAppend(b, m) - if err != nil { - return b, err - } - b = protowire.AppendVarint(b, wiretag+1) // end group - } - return b, nil -} - -func consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp != protowire.StartGroupType { - return pref.Value{}, out, errUnknown - } - b, n := protowire.ConsumeGroup(num, b) - if n < 0 { - return pref.Value{}, out, protowire.ParseError(n) - } - m := list.NewElement() - o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ - Buf: b, - Message: m.Message(), - }) - if err != nil { - return pref.Value{}, out, err - } - list.Append(m) - out.n = n - out.initialized = o.Flags&piface.UnmarshalInitialized != 0 - return listv, out, nil -} - -var coderGroupSliceValue = valueCoderFuncs{ - size: sizeGroupSliceValue, - marshal: appendGroupSliceValue, - unmarshal: consumeGroupSliceValue, - isInit: isInitMessageSliceValue, - merge: mergeMessageListValue, -} - -func makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs { - num := fd.Number() - if mi := getMessageInfo(ft); mi != nil { - funcs := pointerCoderFuncs{ - size: sizeGroupSliceInfo, - marshal: appendGroupSliceInfo, - unmarshal: consumeGroupSliceInfo, - merge: mergeMessageSlice, - } - if needsInitCheck(mi.Desc) { - funcs.isInit = isInitMessageSliceInfo - } - return funcs - } - return pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - return sizeGroupSlice(p, ft, f.tagsize, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - return appendGroupSlice(b, p, f.wiretag, ft, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - return consumeGroupSlice(b, p, num, wtyp, ft, opts) - }, - isInit: func(p pointer, f *coderFieldInfo) error { - return isInitMessageSlice(p, ft) - }, - merge: mergeMessageSlice, - } -} - -func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int { - s := p.PointerSlice() - n := 0 - for _, v := range s { - m := asMessage(v.AsValueOf(messageType.Elem())) - n += 2*tagsize + proto.Size(m) - } - return n -} - -func appendGroupSlice(b []byte, p pointer, wiretag uint64, messageType reflect.Type, opts marshalOptions) ([]byte, error) { - s := p.PointerSlice() - var err error - for _, v := range s { - m := asMessage(v.AsValueOf(messageType.Elem())) - b = protowire.AppendVarint(b, wiretag) // start group - b, err = opts.Options().MarshalAppend(b, m) - if err != nil { - return b, err - } - b = protowire.AppendVarint(b, wiretag+1) // end group - } - return b, nil -} - -func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire.Type, goType reflect.Type, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.StartGroupType { - return out, errUnknown - } - b, n := protowire.ConsumeGroup(num, b) - if n < 0 { - return out, protowire.ParseError(n) - } - mp := reflect.New(goType.Elem()) - o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ - Buf: b, - Message: asMessage(mp).ProtoReflect(), - }) - if err != nil { - return out, err - } - p.AppendPointerSlice(pointerOfValue(mp)) - out.n = n - out.initialized = o.Flags&piface.UnmarshalInitialized != 0 - return out, nil -} - -func sizeGroupSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int { - s := p.PointerSlice() - n := 0 - for _, v := range s { - n += 2*f.tagsize + f.mi.sizePointer(v, opts) - } - return n -} - -func appendGroupSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.PointerSlice() - var err error - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) // start group - b, err = f.mi.marshalAppendPointer(b, v, opts) - if err != nil { - return b, err - } - b = protowire.AppendVarint(b, f.wiretag+1) // end group - } - return b, nil -} - -func consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - if wtyp != protowire.StartGroupType { - return unmarshalOutput{}, errUnknown - } - m := reflect.New(f.mi.GoReflectType.Elem()).Interface() - mp := pointerOfIface(m) - out, err := f.mi.unmarshalPointer(b, mp, f.num, opts) - if err != nil { - return out, err - } - p.AppendPointerSlice(mp) - return out, nil -} - -func asMessage(v reflect.Value) pref.ProtoMessage { - if m, ok := v.Interface().(pref.ProtoMessage); ok { - return m - } - return legacyWrapMessage(v).Interface() -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go b/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go deleted file mode 100644 index ff198d0a1..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +++ /dev/null @@ -1,5637 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package impl - -import ( - "math" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// sizeBool returns the size of wire encoding a bool pointer as a Bool. -func sizeBool(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Bool() - return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) -} - -// appendBool wire encodes a bool pointer as a Bool. -func appendBool(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Bool() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeBool(v)) - return b, nil -} - -// consumeBool wire decodes a bool pointer as a Bool. -func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Bool() = protowire.DecodeBool(v) - out.n = n - return out, nil -} - -var coderBool = pointerCoderFuncs{ - size: sizeBool, - marshal: appendBool, - unmarshal: consumeBool, - merge: mergeBool, -} - -// sizeBoolNoZero returns the size of wire encoding a bool pointer as a Bool. -// The zero value is not encoded. -func sizeBoolNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Bool() - if v == false { - return 0 - } - return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) -} - -// appendBoolNoZero wire encodes a bool pointer as a Bool. -// The zero value is not encoded. -func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Bool() - if v == false { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeBool(v)) - return b, nil -} - -var coderBoolNoZero = pointerCoderFuncs{ - size: sizeBoolNoZero, - marshal: appendBoolNoZero, - unmarshal: consumeBool, - merge: mergeBoolNoZero, -} - -// sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool. -// It panics if the pointer is nil. -func sizeBoolPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.BoolPtr() - return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) -} - -// appendBoolPtr wire encodes a *bool pointer as a Bool. -// It panics if the pointer is nil. -func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.BoolPtr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeBool(v)) - return b, nil -} - -// consumeBoolPtr wire decodes a *bool pointer as a Bool. -func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.BoolPtr() - if *vp == nil { - *vp = new(bool) - } - **vp = protowire.DecodeBool(v) - out.n = n - return out, nil -} - -var coderBoolPtr = pointerCoderFuncs{ - size: sizeBoolPtr, - marshal: appendBoolPtr, - unmarshal: consumeBoolPtr, - merge: mergeBoolPtr, -} - -// sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool. -func sizeBoolSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.BoolSlice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) - } - return size -} - -// appendBoolSlice encodes a []bool pointer as a repeated Bool. -func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.BoolSlice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeBool(v)) - } - return b, nil -} - -// consumeBoolSlice wire decodes a []bool pointer as a repeated Bool. -func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.BoolSlice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, protowire.DecodeBool(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, protowire.DecodeBool(v)) - out.n = n - return out, nil -} - -var coderBoolSlice = pointerCoderFuncs{ - size: sizeBoolSlice, - marshal: appendBoolSlice, - unmarshal: consumeBoolSlice, - merge: mergeBoolSlice, -} - -// sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool. -func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.BoolSlice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(protowire.EncodeBool(v)) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool. -func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.BoolSlice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(protowire.EncodeBool(v)) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, protowire.EncodeBool(v)) - } - return b, nil -} - -var coderBoolPackedSlice = pointerCoderFuncs{ - size: sizeBoolPackedSlice, - marshal: appendBoolPackedSlice, - unmarshal: consumeBoolSlice, - merge: mergeBoolSlice, -} - -// sizeBoolValue returns the size of wire encoding a bool value as a Bool. -func sizeBoolValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool())) -} - -// appendBoolValue encodes a bool value as a Bool. -func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool())) - return b, nil -} - -// consumeBoolValue decodes a bool value as a Bool. -func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil -} - -var coderBoolValue = valueCoderFuncs{ - size: sizeBoolValue, - marshal: appendBoolValue, - unmarshal: consumeBoolValue, - merge: mergeScalarValue, -} - -// sizeBoolSliceValue returns the size of wire encoding a []bool value as a repeated Bool. -func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool())) - } - return size -} - -// appendBoolSliceValue encodes a []bool value as a repeated Bool. -func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool())) - } - return b, nil -} - -// consumeBoolSliceValue wire decodes a []bool value as a repeated Bool. -func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) - out.n = n - return listv, out, nil -} - -var coderBoolSliceValue = valueCoderFuncs{ - size: sizeBoolSliceValue, - marshal: appendBoolSliceValue, - unmarshal: consumeBoolSliceValue, - merge: mergeListValue, -} - -// sizeBoolPackedSliceValue returns the size of wire encoding a []bool value as a packed repeated Bool. -func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(protowire.EncodeBool(v.Bool())) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool. -func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(protowire.EncodeBool(v.Bool())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool())) - } - return b, nil -} - -var coderBoolPackedSliceValue = valueCoderFuncs{ - size: sizeBoolPackedSliceValue, - marshal: appendBoolPackedSliceValue, - unmarshal: consumeBoolSliceValue, - merge: mergeListValue, -} - -// sizeEnumValue returns the size of wire encoding a value as a Enum. -func sizeEnumValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(uint64(v.Enum())) -} - -// appendEnumValue encodes a value as a Enum. -func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(v.Enum())) - return b, nil -} - -// consumeEnumValue decodes a value as a Enum. -func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil -} - -var coderEnumValue = valueCoderFuncs{ - size: sizeEnumValue, - marshal: appendEnumValue, - unmarshal: consumeEnumValue, - merge: mergeScalarValue, -} - -// sizeEnumSliceValue returns the size of wire encoding a [] value as a repeated Enum. -func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(uint64(v.Enum())) - } - return size -} - -// appendEnumSliceValue encodes a [] value as a repeated Enum. -func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(v.Enum())) - } - return b, nil -} - -// consumeEnumSliceValue wire decodes a [] value as a repeated Enum. -func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) - out.n = n - return listv, out, nil -} - -var coderEnumSliceValue = valueCoderFuncs{ - size: sizeEnumSliceValue, - marshal: appendEnumSliceValue, - unmarshal: consumeEnumSliceValue, - merge: mergeListValue, -} - -// sizeEnumPackedSliceValue returns the size of wire encoding a [] value as a packed repeated Enum. -func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(v.Enum())) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum. -func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(v.Enum())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, uint64(v.Enum())) - } - return b, nil -} - -var coderEnumPackedSliceValue = valueCoderFuncs{ - size: sizeEnumPackedSliceValue, - marshal: appendEnumPackedSliceValue, - unmarshal: consumeEnumSliceValue, - merge: mergeListValue, -} - -// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32. -func sizeInt32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int32() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendInt32 wire encodes a int32 pointer as a Int32. -func appendInt32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int32() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -// consumeInt32 wire decodes a int32 pointer as a Int32. -func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Int32() = int32(v) - out.n = n - return out, nil -} - -var coderInt32 = pointerCoderFuncs{ - size: sizeInt32, - marshal: appendInt32, - unmarshal: consumeInt32, - merge: mergeInt32, -} - -// sizeInt32NoZero returns the size of wire encoding a int32 pointer as a Int32. -// The zero value is not encoded. -func sizeInt32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int32() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendInt32NoZero wire encodes a int32 pointer as a Int32. -// The zero value is not encoded. -func appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int32() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -var coderInt32NoZero = pointerCoderFuncs{ - size: sizeInt32NoZero, - marshal: appendInt32NoZero, - unmarshal: consumeInt32, - merge: mergeInt32NoZero, -} - -// sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32. -// It panics if the pointer is nil. -func sizeInt32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.Int32Ptr() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendInt32Ptr wire encodes a *int32 pointer as a Int32. -// It panics if the pointer is nil. -func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Int32Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -// consumeInt32Ptr wire decodes a *int32 pointer as a Int32. -func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Int32Ptr() - if *vp == nil { - *vp = new(int32) - } - **vp = int32(v) - out.n = n - return out, nil -} - -var coderInt32Ptr = pointerCoderFuncs{ - size: sizeInt32Ptr, - marshal: appendInt32Ptr, - unmarshal: consumeInt32Ptr, - merge: mergeInt32Ptr, -} - -// sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32. -func sizeInt32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int32Slice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(uint64(v)) - } - return size -} - -// appendInt32Slice encodes a []int32 pointer as a repeated Int32. -func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int32Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - } - return b, nil -} - -// consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32. -func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Int32Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, int32(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, int32(v)) - out.n = n - return out, nil -} - -var coderInt32Slice = pointerCoderFuncs{ - size: sizeInt32Slice, - marshal: appendInt32Slice, - unmarshal: consumeInt32Slice, - merge: mergeInt32Slice, -} - -// sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32. -func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(uint64(v)) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32. -func appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int32Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(uint64(v)) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, uint64(v)) - } - return b, nil -} - -var coderInt32PackedSlice = pointerCoderFuncs{ - size: sizeInt32PackedSlice, - marshal: appendInt32PackedSlice, - unmarshal: consumeInt32Slice, - merge: mergeInt32Slice, -} - -// sizeInt32Value returns the size of wire encoding a int32 value as a Int32. -func sizeInt32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(uint64(int32(v.Int()))) -} - -// appendInt32Value encodes a int32 value as a Int32. -func appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(int32(v.Int()))) - return b, nil -} - -// consumeInt32Value decodes a int32 value as a Int32. -func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfInt32(int32(v)), out, nil -} - -var coderInt32Value = valueCoderFuncs{ - size: sizeInt32Value, - marshal: appendInt32Value, - unmarshal: consumeInt32Value, - merge: mergeScalarValue, -} - -// sizeInt32SliceValue returns the size of wire encoding a []int32 value as a repeated Int32. -func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(uint64(int32(v.Int()))) - } - return size -} - -// appendInt32SliceValue encodes a []int32 value as a repeated Int32. -func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(int32(v.Int()))) - } - return b, nil -} - -// consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32. -func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(v))) - out.n = n - return listv, out, nil -} - -var coderInt32SliceValue = valueCoderFuncs{ - size: sizeInt32SliceValue, - marshal: appendInt32SliceValue, - unmarshal: consumeInt32SliceValue, - merge: mergeListValue, -} - -// sizeInt32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Int32. -func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(int32(v.Int()))) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32. -func appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(int32(v.Int()))) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, uint64(int32(v.Int()))) - } - return b, nil -} - -var coderInt32PackedSliceValue = valueCoderFuncs{ - size: sizeInt32PackedSliceValue, - marshal: appendInt32PackedSliceValue, - unmarshal: consumeInt32SliceValue, - merge: mergeListValue, -} - -// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32. -func sizeSint32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int32() - return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) -} - -// appendSint32 wire encodes a int32 pointer as a Sint32. -func appendSint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int32() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) - return b, nil -} - -// consumeSint32 wire decodes a int32 pointer as a Sint32. -func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32)) - out.n = n - return out, nil -} - -var coderSint32 = pointerCoderFuncs{ - size: sizeSint32, - marshal: appendSint32, - unmarshal: consumeSint32, - merge: mergeInt32, -} - -// sizeSint32NoZero returns the size of wire encoding a int32 pointer as a Sint32. -// The zero value is not encoded. -func sizeSint32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int32() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) -} - -// appendSint32NoZero wire encodes a int32 pointer as a Sint32. -// The zero value is not encoded. -func appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int32() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) - return b, nil -} - -var coderSint32NoZero = pointerCoderFuncs{ - size: sizeSint32NoZero, - marshal: appendSint32NoZero, - unmarshal: consumeSint32, - merge: mergeInt32NoZero, -} - -// sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32. -// It panics if the pointer is nil. -func sizeSint32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.Int32Ptr() - return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) -} - -// appendSint32Ptr wire encodes a *int32 pointer as a Sint32. -// It panics if the pointer is nil. -func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Int32Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) - return b, nil -} - -// consumeSint32Ptr wire decodes a *int32 pointer as a Sint32. -func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Int32Ptr() - if *vp == nil { - *vp = new(int32) - } - **vp = int32(protowire.DecodeZigZag(v & math.MaxUint32)) - out.n = n - return out, nil -} - -var coderSint32Ptr = pointerCoderFuncs{ - size: sizeSint32Ptr, - marshal: appendSint32Ptr, - unmarshal: consumeSint32Ptr, - merge: mergeInt32Ptr, -} - -// sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32. -func sizeSint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int32Slice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) - } - return size -} - -// appendSint32Slice encodes a []int32 pointer as a repeated Sint32. -func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int32Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) - } - return b, nil -} - -// consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32. -func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Int32Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32))) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32))) - out.n = n - return out, nil -} - -var coderSint32Slice = pointerCoderFuncs{ - size: sizeSint32Slice, - marshal: appendSint32Slice, - unmarshal: consumeSint32Slice, - merge: mergeInt32Slice, -} - -// sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32. -func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32. -func appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int32Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) - } - return b, nil -} - -var coderSint32PackedSlice = pointerCoderFuncs{ - size: sizeSint32PackedSlice, - marshal: appendSint32PackedSlice, - unmarshal: consumeSint32Slice, - merge: mergeInt32Slice, -} - -// sizeSint32Value returns the size of wire encoding a int32 value as a Sint32. -func sizeSint32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int())))) -} - -// appendSint32Value encodes a int32 value as a Sint32. -func appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int())))) - return b, nil -} - -// consumeSint32Value decodes a int32 value as a Sint32. -func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil -} - -var coderSint32Value = valueCoderFuncs{ - size: sizeSint32Value, - marshal: appendSint32Value, - unmarshal: consumeSint32Value, - merge: mergeScalarValue, -} - -// sizeSint32SliceValue returns the size of wire encoding a []int32 value as a repeated Sint32. -func sizeSint32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int())))) - } - return size -} - -// appendSint32SliceValue encodes a []int32 value as a repeated Sint32. -func appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int())))) - } - return b, nil -} - -// consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32. -func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) - out.n = n - return listv, out, nil -} - -var coderSint32SliceValue = valueCoderFuncs{ - size: sizeSint32SliceValue, - marshal: appendSint32SliceValue, - unmarshal: consumeSint32SliceValue, - merge: mergeListValue, -} - -// sizeSint32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sint32. -func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int())))) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32. -func appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int())))) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int())))) - } - return b, nil -} - -var coderSint32PackedSliceValue = valueCoderFuncs{ - size: sizeSint32PackedSliceValue, - marshal: appendSint32PackedSliceValue, - unmarshal: consumeSint32SliceValue, - merge: mergeListValue, -} - -// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32. -func sizeUint32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Uint32() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendUint32 wire encodes a uint32 pointer as a Uint32. -func appendUint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint32() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -// consumeUint32 wire decodes a uint32 pointer as a Uint32. -func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Uint32() = uint32(v) - out.n = n - return out, nil -} - -var coderUint32 = pointerCoderFuncs{ - size: sizeUint32, - marshal: appendUint32, - unmarshal: consumeUint32, - merge: mergeUint32, -} - -// sizeUint32NoZero returns the size of wire encoding a uint32 pointer as a Uint32. -// The zero value is not encoded. -func sizeUint32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Uint32() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendUint32NoZero wire encodes a uint32 pointer as a Uint32. -// The zero value is not encoded. -func appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint32() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -var coderUint32NoZero = pointerCoderFuncs{ - size: sizeUint32NoZero, - marshal: appendUint32NoZero, - unmarshal: consumeUint32, - merge: mergeUint32NoZero, -} - -// sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32. -// It panics if the pointer is nil. -func sizeUint32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.Uint32Ptr() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendUint32Ptr wire encodes a *uint32 pointer as a Uint32. -// It panics if the pointer is nil. -func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Uint32Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -// consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32. -func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Uint32Ptr() - if *vp == nil { - *vp = new(uint32) - } - **vp = uint32(v) - out.n = n - return out, nil -} - -var coderUint32Ptr = pointerCoderFuncs{ - size: sizeUint32Ptr, - marshal: appendUint32Ptr, - unmarshal: consumeUint32Ptr, - merge: mergeUint32Ptr, -} - -// sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32. -func sizeUint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint32Slice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(uint64(v)) - } - return size -} - -// appendUint32Slice encodes a []uint32 pointer as a repeated Uint32. -func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint32Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - } - return b, nil -} - -// consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32. -func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Uint32Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, uint32(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, uint32(v)) - out.n = n - return out, nil -} - -var coderUint32Slice = pointerCoderFuncs{ - size: sizeUint32Slice, - marshal: appendUint32Slice, - unmarshal: consumeUint32Slice, - merge: mergeUint32Slice, -} - -// sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32. -func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(uint64(v)) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32. -func appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint32Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(uint64(v)) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, uint64(v)) - } - return b, nil -} - -var coderUint32PackedSlice = pointerCoderFuncs{ - size: sizeUint32PackedSlice, - marshal: appendUint32PackedSlice, - unmarshal: consumeUint32Slice, - merge: mergeUint32Slice, -} - -// sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32. -func sizeUint32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(uint64(uint32(v.Uint()))) -} - -// appendUint32Value encodes a uint32 value as a Uint32. -func appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(uint32(v.Uint()))) - return b, nil -} - -// consumeUint32Value decodes a uint32 value as a Uint32. -func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfUint32(uint32(v)), out, nil -} - -var coderUint32Value = valueCoderFuncs{ - size: sizeUint32Value, - marshal: appendUint32Value, - unmarshal: consumeUint32Value, - merge: mergeScalarValue, -} - -// sizeUint32SliceValue returns the size of wire encoding a []uint32 value as a repeated Uint32. -func sizeUint32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint()))) - } - return size -} - -// appendUint32SliceValue encodes a []uint32 value as a repeated Uint32. -func appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(uint32(v.Uint()))) - } - return b, nil -} - -// consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32. -func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint32(uint32(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint32(uint32(v))) - out.n = n - return listv, out, nil -} - -var coderUint32SliceValue = valueCoderFuncs{ - size: sizeUint32SliceValue, - marshal: appendUint32SliceValue, - unmarshal: consumeUint32SliceValue, - merge: mergeListValue, -} - -// sizeUint32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Uint32. -func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(uint32(v.Uint()))) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32. -func appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(uint32(v.Uint()))) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, uint64(uint32(v.Uint()))) - } - return b, nil -} - -var coderUint32PackedSliceValue = valueCoderFuncs{ - size: sizeUint32PackedSliceValue, - marshal: appendUint32PackedSliceValue, - unmarshal: consumeUint32SliceValue, - merge: mergeListValue, -} - -// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64. -func sizeInt64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int64() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendInt64 wire encodes a int64 pointer as a Int64. -func appendInt64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int64() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -// consumeInt64 wire decodes a int64 pointer as a Int64. -func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Int64() = int64(v) - out.n = n - return out, nil -} - -var coderInt64 = pointerCoderFuncs{ - size: sizeInt64, - marshal: appendInt64, - unmarshal: consumeInt64, - merge: mergeInt64, -} - -// sizeInt64NoZero returns the size of wire encoding a int64 pointer as a Int64. -// The zero value is not encoded. -func sizeInt64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int64() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendInt64NoZero wire encodes a int64 pointer as a Int64. -// The zero value is not encoded. -func appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int64() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -var coderInt64NoZero = pointerCoderFuncs{ - size: sizeInt64NoZero, - marshal: appendInt64NoZero, - unmarshal: consumeInt64, - merge: mergeInt64NoZero, -} - -// sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64. -// It panics if the pointer is nil. -func sizeInt64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.Int64Ptr() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -// appendInt64Ptr wire encodes a *int64 pointer as a Int64. -// It panics if the pointer is nil. -func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Int64Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -// consumeInt64Ptr wire decodes a *int64 pointer as a Int64. -func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Int64Ptr() - if *vp == nil { - *vp = new(int64) - } - **vp = int64(v) - out.n = n - return out, nil -} - -var coderInt64Ptr = pointerCoderFuncs{ - size: sizeInt64Ptr, - marshal: appendInt64Ptr, - unmarshal: consumeInt64Ptr, - merge: mergeInt64Ptr, -} - -// sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64. -func sizeInt64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int64Slice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(uint64(v)) - } - return size -} - -// appendInt64Slice encodes a []int64 pointer as a repeated Int64. -func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int64Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - } - return b, nil -} - -// consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64. -func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Int64Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, int64(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, int64(v)) - out.n = n - return out, nil -} - -var coderInt64Slice = pointerCoderFuncs{ - size: sizeInt64Slice, - marshal: appendInt64Slice, - unmarshal: consumeInt64Slice, - merge: mergeInt64Slice, -} - -// sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64. -func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(uint64(v)) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64. -func appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int64Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(uint64(v)) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, uint64(v)) - } - return b, nil -} - -var coderInt64PackedSlice = pointerCoderFuncs{ - size: sizeInt64PackedSlice, - marshal: appendInt64PackedSlice, - unmarshal: consumeInt64Slice, - merge: mergeInt64Slice, -} - -// sizeInt64Value returns the size of wire encoding a int64 value as a Int64. -func sizeInt64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(uint64(v.Int())) -} - -// appendInt64Value encodes a int64 value as a Int64. -func appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(v.Int())) - return b, nil -} - -// consumeInt64Value decodes a int64 value as a Int64. -func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfInt64(int64(v)), out, nil -} - -var coderInt64Value = valueCoderFuncs{ - size: sizeInt64Value, - marshal: appendInt64Value, - unmarshal: consumeInt64Value, - merge: mergeScalarValue, -} - -// sizeInt64SliceValue returns the size of wire encoding a []int64 value as a repeated Int64. -func sizeInt64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(uint64(v.Int())) - } - return size -} - -// appendInt64SliceValue encodes a []int64 value as a repeated Int64. -func appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(v.Int())) - } - return b, nil -} - -// consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64. -func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(int64(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(int64(v))) - out.n = n - return listv, out, nil -} - -var coderInt64SliceValue = valueCoderFuncs{ - size: sizeInt64SliceValue, - marshal: appendInt64SliceValue, - unmarshal: consumeInt64SliceValue, - merge: mergeListValue, -} - -// sizeInt64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Int64. -func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(v.Int())) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64. -func appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(uint64(v.Int())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, uint64(v.Int())) - } - return b, nil -} - -var coderInt64PackedSliceValue = valueCoderFuncs{ - size: sizeInt64PackedSliceValue, - marshal: appendInt64PackedSliceValue, - unmarshal: consumeInt64SliceValue, - merge: mergeListValue, -} - -// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64. -func sizeSint64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int64() - return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) -} - -// appendSint64 wire encodes a int64 pointer as a Sint64. -func appendSint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int64() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) - return b, nil -} - -// consumeSint64 wire decodes a int64 pointer as a Sint64. -func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Int64() = protowire.DecodeZigZag(v) - out.n = n - return out, nil -} - -var coderSint64 = pointerCoderFuncs{ - size: sizeSint64, - marshal: appendSint64, - unmarshal: consumeSint64, - merge: mergeInt64, -} - -// sizeSint64NoZero returns the size of wire encoding a int64 pointer as a Sint64. -// The zero value is not encoded. -func sizeSint64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int64() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) -} - -// appendSint64NoZero wire encodes a int64 pointer as a Sint64. -// The zero value is not encoded. -func appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int64() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) - return b, nil -} - -var coderSint64NoZero = pointerCoderFuncs{ - size: sizeSint64NoZero, - marshal: appendSint64NoZero, - unmarshal: consumeSint64, - merge: mergeInt64NoZero, -} - -// sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64. -// It panics if the pointer is nil. -func sizeSint64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.Int64Ptr() - return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) -} - -// appendSint64Ptr wire encodes a *int64 pointer as a Sint64. -// It panics if the pointer is nil. -func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Int64Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) - return b, nil -} - -// consumeSint64Ptr wire decodes a *int64 pointer as a Sint64. -func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Int64Ptr() - if *vp == nil { - *vp = new(int64) - } - **vp = protowire.DecodeZigZag(v) - out.n = n - return out, nil -} - -var coderSint64Ptr = pointerCoderFuncs{ - size: sizeSint64Ptr, - marshal: appendSint64Ptr, - unmarshal: consumeSint64Ptr, - merge: mergeInt64Ptr, -} - -// sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64. -func sizeSint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int64Slice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) - } - return size -} - -// appendSint64Slice encodes a []int64 pointer as a repeated Sint64. -func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int64Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) - } - return b, nil -} - -// consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64. -func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Int64Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, protowire.DecodeZigZag(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, protowire.DecodeZigZag(v)) - out.n = n - return out, nil -} - -var coderSint64Slice = pointerCoderFuncs{ - size: sizeSint64Slice, - marshal: appendSint64Slice, - unmarshal: consumeSint64Slice, - merge: mergeInt64Slice, -} - -// sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64. -func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(protowire.EncodeZigZag(v)) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64. -func appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int64Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(protowire.EncodeZigZag(v)) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) - } - return b, nil -} - -var coderSint64PackedSlice = pointerCoderFuncs{ - size: sizeSint64PackedSlice, - marshal: appendSint64PackedSlice, - unmarshal: consumeSint64Slice, - merge: mergeInt64Slice, -} - -// sizeSint64Value returns the size of wire encoding a int64 value as a Sint64. -func sizeSint64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int())) -} - -// appendSint64Value encodes a int64 value as a Sint64. -func appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int())) - return b, nil -} - -// consumeSint64Value decodes a int64 value as a Sint64. -func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil -} - -var coderSint64Value = valueCoderFuncs{ - size: sizeSint64Value, - marshal: appendSint64Value, - unmarshal: consumeSint64Value, - merge: mergeScalarValue, -} - -// sizeSint64SliceValue returns the size of wire encoding a []int64 value as a repeated Sint64. -func sizeSint64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int())) - } - return size -} - -// appendSint64SliceValue encodes a []int64 value as a repeated Sint64. -func appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int())) - } - return b, nil -} - -// consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64. -func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) - out.n = n - return listv, out, nil -} - -var coderSint64SliceValue = valueCoderFuncs{ - size: sizeSint64SliceValue, - marshal: appendSint64SliceValue, - unmarshal: consumeSint64SliceValue, - merge: mergeListValue, -} - -// sizeSint64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sint64. -func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int())) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64. -func appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int())) - } - return b, nil -} - -var coderSint64PackedSliceValue = valueCoderFuncs{ - size: sizeSint64PackedSliceValue, - marshal: appendSint64PackedSliceValue, - unmarshal: consumeSint64SliceValue, - merge: mergeListValue, -} - -// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64. -func sizeUint64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Uint64() - return f.tagsize + protowire.SizeVarint(v) -} - -// appendUint64 wire encodes a uint64 pointer as a Uint64. -func appendUint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint64() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, v) - return b, nil -} - -// consumeUint64 wire decodes a uint64 pointer as a Uint64. -func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Uint64() = v - out.n = n - return out, nil -} - -var coderUint64 = pointerCoderFuncs{ - size: sizeUint64, - marshal: appendUint64, - unmarshal: consumeUint64, - merge: mergeUint64, -} - -// sizeUint64NoZero returns the size of wire encoding a uint64 pointer as a Uint64. -// The zero value is not encoded. -func sizeUint64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Uint64() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeVarint(v) -} - -// appendUint64NoZero wire encodes a uint64 pointer as a Uint64. -// The zero value is not encoded. -func appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint64() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, v) - return b, nil -} - -var coderUint64NoZero = pointerCoderFuncs{ - size: sizeUint64NoZero, - marshal: appendUint64NoZero, - unmarshal: consumeUint64, - merge: mergeUint64NoZero, -} - -// sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64. -// It panics if the pointer is nil. -func sizeUint64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.Uint64Ptr() - return f.tagsize + protowire.SizeVarint(v) -} - -// appendUint64Ptr wire encodes a *uint64 pointer as a Uint64. -// It panics if the pointer is nil. -func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Uint64Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, v) - return b, nil -} - -// consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64. -func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Uint64Ptr() - if *vp == nil { - *vp = new(uint64) - } - **vp = v - out.n = n - return out, nil -} - -var coderUint64Ptr = pointerCoderFuncs{ - size: sizeUint64Ptr, - marshal: appendUint64Ptr, - unmarshal: consumeUint64Ptr, - merge: mergeUint64Ptr, -} - -// sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64. -func sizeUint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint64Slice() - for _, v := range s { - size += f.tagsize + protowire.SizeVarint(v) - } - return size -} - -// appendUint64Slice encodes a []uint64 pointer as a repeated Uint64. -func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint64Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, v) - } - return b, nil -} - -// consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64. -func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Uint64Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, v) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, v) - out.n = n - return out, nil -} - -var coderUint64Slice = pointerCoderFuncs{ - size: sizeUint64Slice, - marshal: appendUint64Slice, - unmarshal: consumeUint64Slice, - merge: mergeUint64Slice, -} - -// sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64. -func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += protowire.SizeVarint(v) - } - return f.tagsize + protowire.SizeBytes(n) -} - -// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64. -func appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint64Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for _, v := range s { - n += protowire.SizeVarint(v) - } - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendVarint(b, v) - } - return b, nil -} - -var coderUint64PackedSlice = pointerCoderFuncs{ - size: sizeUint64PackedSlice, - marshal: appendUint64PackedSlice, - unmarshal: consumeUint64Slice, - merge: mergeUint64Slice, -} - -// sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64. -func sizeUint64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeVarint(v.Uint()) -} - -// appendUint64Value encodes a uint64 value as a Uint64. -func appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, v.Uint()) - return b, nil -} - -// consumeUint64Value decodes a uint64 value as a Uint64. -func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfUint64(v), out, nil -} - -var coderUint64Value = valueCoderFuncs{ - size: sizeUint64Value, - marshal: appendUint64Value, - unmarshal: consumeUint64Value, - merge: mergeScalarValue, -} - -// sizeUint64SliceValue returns the size of wire encoding a []uint64 value as a repeated Uint64. -func sizeUint64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeVarint(v.Uint()) - } - return size -} - -// appendUint64SliceValue encodes a []uint64 value as a repeated Uint64. -func appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, v.Uint()) - } - return b, nil -} - -// consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64. -func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint64(v)) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.VarintType { - return protoreflect.Value{}, out, errUnknown - } - var v uint64 - var n int - if len(b) >= 1 && b[0] < 0x80 { - v = uint64(b[0]) - n = 1 - } else if len(b) >= 2 && b[1] < 128 { - v = uint64(b[0]&0x7f) + uint64(b[1])<<7 - n = 2 - } else { - v, n = protowire.ConsumeVarint(b) - } - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint64(v)) - out.n = n - return listv, out, nil -} - -var coderUint64SliceValue = valueCoderFuncs{ - size: sizeUint64SliceValue, - marshal: appendUint64SliceValue, - unmarshal: consumeUint64SliceValue, - merge: mergeListValue, -} - -// sizeUint64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Uint64. -func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := 0 - for i, llen := 0, llen; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(v.Uint()) - } - return tagsize + protowire.SizeBytes(n) -} - -// appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64. -func appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := 0 - for i := 0; i < llen; i++ { - v := list.Get(i) - n += protowire.SizeVarint(v.Uint()) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, v.Uint()) - } - return b, nil -} - -var coderUint64PackedSliceValue = valueCoderFuncs{ - size: sizeUint64PackedSliceValue, - marshal: appendUint64PackedSliceValue, - unmarshal: consumeUint64SliceValue, - merge: mergeListValue, -} - -// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32. -func sizeSfixed32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - - return f.tagsize + protowire.SizeFixed32() -} - -// appendSfixed32 wire encodes a int32 pointer as a Sfixed32. -func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int32() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, uint32(v)) - return b, nil -} - -// consumeSfixed32 wire decodes a int32 pointer as a Sfixed32. -func consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Int32() = int32(v) - out.n = n - return out, nil -} - -var coderSfixed32 = pointerCoderFuncs{ - size: sizeSfixed32, - marshal: appendSfixed32, - unmarshal: consumeSfixed32, - merge: mergeInt32, -} - -// sizeSfixed32NoZero returns the size of wire encoding a int32 pointer as a Sfixed32. -// The zero value is not encoded. -func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int32() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeFixed32() -} - -// appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32. -// The zero value is not encoded. -func appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int32() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, uint32(v)) - return b, nil -} - -var coderSfixed32NoZero = pointerCoderFuncs{ - size: sizeSfixed32NoZero, - marshal: appendSfixed32NoZero, - unmarshal: consumeSfixed32, - merge: mergeInt32NoZero, -} - -// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32. -// It panics if the pointer is nil. -func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - return f.tagsize + protowire.SizeFixed32() -} - -// appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32. -// It panics if the pointer is nil. -func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Int32Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, uint32(v)) - return b, nil -} - -// consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32. -func consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Int32Ptr() - if *vp == nil { - *vp = new(int32) - } - **vp = int32(v) - out.n = n - return out, nil -} - -var coderSfixed32Ptr = pointerCoderFuncs{ - size: sizeSfixed32Ptr, - marshal: appendSfixed32Ptr, - unmarshal: consumeSfixed32Ptr, - merge: mergeInt32Ptr, -} - -// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32. -func sizeSfixed32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int32Slice() - size = len(s) * (f.tagsize + protowire.SizeFixed32()) - return size -} - -// appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32. -func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int32Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, uint32(v)) - } - return b, nil -} - -// consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32. -func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Int32Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, int32(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, int32(v)) - out.n = n - return out, nil -} - -var coderSfixed32Slice = pointerCoderFuncs{ - size: sizeSfixed32Slice, - marshal: appendSfixed32Slice, - unmarshal: consumeSfixed32Slice, - merge: mergeInt32Slice, -} - -// sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32. -func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int32Slice() - if len(s) == 0 { - return 0 - } - n := len(s) * protowire.SizeFixed32() - return f.tagsize + protowire.SizeBytes(n) -} - -// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32. -func appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int32Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := len(s) * protowire.SizeFixed32() - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendFixed32(b, uint32(v)) - } - return b, nil -} - -var coderSfixed32PackedSlice = pointerCoderFuncs{ - size: sizeSfixed32PackedSlice, - marshal: appendSfixed32PackedSlice, - unmarshal: consumeSfixed32Slice, - merge: mergeInt32Slice, -} - -// sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32. -func sizeSfixed32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeFixed32() -} - -// appendSfixed32Value encodes a int32 value as a Sfixed32. -func appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed32(b, uint32(v.Int())) - return b, nil -} - -// consumeSfixed32Value decodes a int32 value as a Sfixed32. -func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfInt32(int32(v)), out, nil -} - -var coderSfixed32Value = valueCoderFuncs{ - size: sizeSfixed32Value, - marshal: appendSfixed32Value, - unmarshal: consumeSfixed32Value, - merge: mergeScalarValue, -} - -// sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32. -func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - size = list.Len() * (tagsize + protowire.SizeFixed32()) - return size -} - -// appendSfixed32SliceValue encodes a []int32 value as a repeated Sfixed32. -func appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed32(b, uint32(v.Int())) - } - return b, nil -} - -// consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32. -func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.Fixed32Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(v))) - out.n = n - return listv, out, nil -} - -var coderSfixed32SliceValue = valueCoderFuncs{ - size: sizeSfixed32SliceValue, - marshal: appendSfixed32SliceValue, - unmarshal: consumeSfixed32SliceValue, - merge: mergeListValue, -} - -// sizeSfixed32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sfixed32. -func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := llen * protowire.SizeFixed32() - return tagsize + protowire.SizeBytes(n) -} - -// appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32. -func appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := llen * protowire.SizeFixed32() - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendFixed32(b, uint32(v.Int())) - } - return b, nil -} - -var coderSfixed32PackedSliceValue = valueCoderFuncs{ - size: sizeSfixed32PackedSliceValue, - marshal: appendSfixed32PackedSliceValue, - unmarshal: consumeSfixed32SliceValue, - merge: mergeListValue, -} - -// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32. -func sizeFixed32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - - return f.tagsize + protowire.SizeFixed32() -} - -// appendFixed32 wire encodes a uint32 pointer as a Fixed32. -func appendFixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint32() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, v) - return b, nil -} - -// consumeFixed32 wire decodes a uint32 pointer as a Fixed32. -func consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Uint32() = v - out.n = n - return out, nil -} - -var coderFixed32 = pointerCoderFuncs{ - size: sizeFixed32, - marshal: appendFixed32, - unmarshal: consumeFixed32, - merge: mergeUint32, -} - -// sizeFixed32NoZero returns the size of wire encoding a uint32 pointer as a Fixed32. -// The zero value is not encoded. -func sizeFixed32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Uint32() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeFixed32() -} - -// appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32. -// The zero value is not encoded. -func appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint32() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, v) - return b, nil -} - -var coderFixed32NoZero = pointerCoderFuncs{ - size: sizeFixed32NoZero, - marshal: appendFixed32NoZero, - unmarshal: consumeFixed32, - merge: mergeUint32NoZero, -} - -// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32. -// It panics if the pointer is nil. -func sizeFixed32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - return f.tagsize + protowire.SizeFixed32() -} - -// appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32. -// It panics if the pointer is nil. -func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Uint32Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, v) - return b, nil -} - -// consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32. -func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Uint32Ptr() - if *vp == nil { - *vp = new(uint32) - } - **vp = v - out.n = n - return out, nil -} - -var coderFixed32Ptr = pointerCoderFuncs{ - size: sizeFixed32Ptr, - marshal: appendFixed32Ptr, - unmarshal: consumeFixed32Ptr, - merge: mergeUint32Ptr, -} - -// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32. -func sizeFixed32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint32Slice() - size = len(s) * (f.tagsize + protowire.SizeFixed32()) - return size -} - -// appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32. -func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint32Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, v) - } - return b, nil -} - -// consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32. -func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Uint32Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, v) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, v) - out.n = n - return out, nil -} - -var coderFixed32Slice = pointerCoderFuncs{ - size: sizeFixed32Slice, - marshal: appendFixed32Slice, - unmarshal: consumeFixed32Slice, - merge: mergeUint32Slice, -} - -// sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32. -func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint32Slice() - if len(s) == 0 { - return 0 - } - n := len(s) * protowire.SizeFixed32() - return f.tagsize + protowire.SizeBytes(n) -} - -// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32. -func appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint32Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := len(s) * protowire.SizeFixed32() - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendFixed32(b, v) - } - return b, nil -} - -var coderFixed32PackedSlice = pointerCoderFuncs{ - size: sizeFixed32PackedSlice, - marshal: appendFixed32PackedSlice, - unmarshal: consumeFixed32Slice, - merge: mergeUint32Slice, -} - -// sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32. -func sizeFixed32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeFixed32() -} - -// appendFixed32Value encodes a uint32 value as a Fixed32. -func appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed32(b, uint32(v.Uint())) - return b, nil -} - -// consumeFixed32Value decodes a uint32 value as a Fixed32. -func consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfUint32(uint32(v)), out, nil -} - -var coderFixed32Value = valueCoderFuncs{ - size: sizeFixed32Value, - marshal: appendFixed32Value, - unmarshal: consumeFixed32Value, - merge: mergeScalarValue, -} - -// sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32. -func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - size = list.Len() * (tagsize + protowire.SizeFixed32()) - return size -} - -// appendFixed32SliceValue encodes a []uint32 value as a repeated Fixed32. -func appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed32(b, uint32(v.Uint())) - } - return b, nil -} - -// consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32. -func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint32(uint32(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.Fixed32Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint32(uint32(v))) - out.n = n - return listv, out, nil -} - -var coderFixed32SliceValue = valueCoderFuncs{ - size: sizeFixed32SliceValue, - marshal: appendFixed32SliceValue, - unmarshal: consumeFixed32SliceValue, - merge: mergeListValue, -} - -// sizeFixed32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Fixed32. -func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := llen * protowire.SizeFixed32() - return tagsize + protowire.SizeBytes(n) -} - -// appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32. -func appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := llen * protowire.SizeFixed32() - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendFixed32(b, uint32(v.Uint())) - } - return b, nil -} - -var coderFixed32PackedSliceValue = valueCoderFuncs{ - size: sizeFixed32PackedSliceValue, - marshal: appendFixed32PackedSliceValue, - unmarshal: consumeFixed32SliceValue, - merge: mergeListValue, -} - -// sizeFloat returns the size of wire encoding a float32 pointer as a Float. -func sizeFloat(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - - return f.tagsize + protowire.SizeFixed32() -} - -// appendFloat wire encodes a float32 pointer as a Float. -func appendFloat(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Float32() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, math.Float32bits(v)) - return b, nil -} - -// consumeFloat wire decodes a float32 pointer as a Float. -func consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Float32() = math.Float32frombits(v) - out.n = n - return out, nil -} - -var coderFloat = pointerCoderFuncs{ - size: sizeFloat, - marshal: appendFloat, - unmarshal: consumeFloat, - merge: mergeFloat32, -} - -// sizeFloatNoZero returns the size of wire encoding a float32 pointer as a Float. -// The zero value is not encoded. -func sizeFloatNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Float32() - if v == 0 && !math.Signbit(float64(v)) { - return 0 - } - return f.tagsize + protowire.SizeFixed32() -} - -// appendFloatNoZero wire encodes a float32 pointer as a Float. -// The zero value is not encoded. -func appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Float32() - if v == 0 && !math.Signbit(float64(v)) { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, math.Float32bits(v)) - return b, nil -} - -var coderFloatNoZero = pointerCoderFuncs{ - size: sizeFloatNoZero, - marshal: appendFloatNoZero, - unmarshal: consumeFloat, - merge: mergeFloat32NoZero, -} - -// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float. -// It panics if the pointer is nil. -func sizeFloatPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - return f.tagsize + protowire.SizeFixed32() -} - -// appendFloatPtr wire encodes a *float32 pointer as a Float. -// It panics if the pointer is nil. -func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Float32Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, math.Float32bits(v)) - return b, nil -} - -// consumeFloatPtr wire decodes a *float32 pointer as a Float. -func consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Float32Ptr() - if *vp == nil { - *vp = new(float32) - } - **vp = math.Float32frombits(v) - out.n = n - return out, nil -} - -var coderFloatPtr = pointerCoderFuncs{ - size: sizeFloatPtr, - marshal: appendFloatPtr, - unmarshal: consumeFloatPtr, - merge: mergeFloat32Ptr, -} - -// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float. -func sizeFloatSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Float32Slice() - size = len(s) * (f.tagsize + protowire.SizeFixed32()) - return size -} - -// appendFloatSlice encodes a []float32 pointer as a repeated Float. -func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Float32Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed32(b, math.Float32bits(v)) - } - return b, nil -} - -// consumeFloatSlice wire decodes a []float32 pointer as a repeated Float. -func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Float32Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, math.Float32frombits(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.Fixed32Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, math.Float32frombits(v)) - out.n = n - return out, nil -} - -var coderFloatSlice = pointerCoderFuncs{ - size: sizeFloatSlice, - marshal: appendFloatSlice, - unmarshal: consumeFloatSlice, - merge: mergeFloat32Slice, -} - -// sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float. -func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Float32Slice() - if len(s) == 0 { - return 0 - } - n := len(s) * protowire.SizeFixed32() - return f.tagsize + protowire.SizeBytes(n) -} - -// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float. -func appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Float32Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := len(s) * protowire.SizeFixed32() - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendFixed32(b, math.Float32bits(v)) - } - return b, nil -} - -var coderFloatPackedSlice = pointerCoderFuncs{ - size: sizeFloatPackedSlice, - marshal: appendFloatPackedSlice, - unmarshal: consumeFloatSlice, - merge: mergeFloat32Slice, -} - -// sizeFloatValue returns the size of wire encoding a float32 value as a Float. -func sizeFloatValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeFixed32() -} - -// appendFloatValue encodes a float32 value as a Float. -func appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float()))) - return b, nil -} - -// consumeFloatValue decodes a float32 value as a Float. -func consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.Fixed32Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil -} - -var coderFloatValue = valueCoderFuncs{ - size: sizeFloatValue, - marshal: appendFloatValue, - unmarshal: consumeFloatValue, - merge: mergeScalarValue, -} - -// sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float. -func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - size = list.Len() * (tagsize + protowire.SizeFixed32()) - return size -} - -// appendFloatSliceValue encodes a []float32 value as a repeated Float. -func appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float()))) - } - return b, nil -} - -// consumeFloatSliceValue wire decodes a []float32 value as a repeated Float. -func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.Fixed32Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) - out.n = n - return listv, out, nil -} - -var coderFloatSliceValue = valueCoderFuncs{ - size: sizeFloatSliceValue, - marshal: appendFloatSliceValue, - unmarshal: consumeFloatSliceValue, - merge: mergeListValue, -} - -// sizeFloatPackedSliceValue returns the size of wire encoding a []float32 value as a packed repeated Float. -func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := llen * protowire.SizeFixed32() - return tagsize + protowire.SizeBytes(n) -} - -// appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float. -func appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := llen * protowire.SizeFixed32() - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float()))) - } - return b, nil -} - -var coderFloatPackedSliceValue = valueCoderFuncs{ - size: sizeFloatPackedSliceValue, - marshal: appendFloatPackedSliceValue, - unmarshal: consumeFloatSliceValue, - merge: mergeListValue, -} - -// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64. -func sizeSfixed64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - - return f.tagsize + protowire.SizeFixed64() -} - -// appendSfixed64 wire encodes a int64 pointer as a Sfixed64. -func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int64() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, uint64(v)) - return b, nil -} - -// consumeSfixed64 wire decodes a int64 pointer as a Sfixed64. -func consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Int64() = int64(v) - out.n = n - return out, nil -} - -var coderSfixed64 = pointerCoderFuncs{ - size: sizeSfixed64, - marshal: appendSfixed64, - unmarshal: consumeSfixed64, - merge: mergeInt64, -} - -// sizeSfixed64NoZero returns the size of wire encoding a int64 pointer as a Sfixed64. -// The zero value is not encoded. -func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Int64() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeFixed64() -} - -// appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64. -// The zero value is not encoded. -func appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Int64() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, uint64(v)) - return b, nil -} - -var coderSfixed64NoZero = pointerCoderFuncs{ - size: sizeSfixed64NoZero, - marshal: appendSfixed64NoZero, - unmarshal: consumeSfixed64, - merge: mergeInt64NoZero, -} - -// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64. -// It panics if the pointer is nil. -func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - return f.tagsize + protowire.SizeFixed64() -} - -// appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64. -// It panics if the pointer is nil. -func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Int64Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, uint64(v)) - return b, nil -} - -// consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64. -func consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Int64Ptr() - if *vp == nil { - *vp = new(int64) - } - **vp = int64(v) - out.n = n - return out, nil -} - -var coderSfixed64Ptr = pointerCoderFuncs{ - size: sizeSfixed64Ptr, - marshal: appendSfixed64Ptr, - unmarshal: consumeSfixed64Ptr, - merge: mergeInt64Ptr, -} - -// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64. -func sizeSfixed64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int64Slice() - size = len(s) * (f.tagsize + protowire.SizeFixed64()) - return size -} - -// appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64. -func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int64Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, uint64(v)) - } - return b, nil -} - -// consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64. -func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Int64Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, int64(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, int64(v)) - out.n = n - return out, nil -} - -var coderSfixed64Slice = pointerCoderFuncs{ - size: sizeSfixed64Slice, - marshal: appendSfixed64Slice, - unmarshal: consumeSfixed64Slice, - merge: mergeInt64Slice, -} - -// sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64. -func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Int64Slice() - if len(s) == 0 { - return 0 - } - n := len(s) * protowire.SizeFixed64() - return f.tagsize + protowire.SizeBytes(n) -} - -// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64. -func appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Int64Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := len(s) * protowire.SizeFixed64() - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendFixed64(b, uint64(v)) - } - return b, nil -} - -var coderSfixed64PackedSlice = pointerCoderFuncs{ - size: sizeSfixed64PackedSlice, - marshal: appendSfixed64PackedSlice, - unmarshal: consumeSfixed64Slice, - merge: mergeInt64Slice, -} - -// sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64. -func sizeSfixed64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeFixed64() -} - -// appendSfixed64Value encodes a int64 value as a Sfixed64. -func appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed64(b, uint64(v.Int())) - return b, nil -} - -// consumeSfixed64Value decodes a int64 value as a Sfixed64. -func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfInt64(int64(v)), out, nil -} - -var coderSfixed64Value = valueCoderFuncs{ - size: sizeSfixed64Value, - marshal: appendSfixed64Value, - unmarshal: consumeSfixed64Value, - merge: mergeScalarValue, -} - -// sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64. -func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - size = list.Len() * (tagsize + protowire.SizeFixed64()) - return size -} - -// appendSfixed64SliceValue encodes a []int64 value as a repeated Sfixed64. -func appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed64(b, uint64(v.Int())) - } - return b, nil -} - -// consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64. -func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(int64(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.Fixed64Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(int64(v))) - out.n = n - return listv, out, nil -} - -var coderSfixed64SliceValue = valueCoderFuncs{ - size: sizeSfixed64SliceValue, - marshal: appendSfixed64SliceValue, - unmarshal: consumeSfixed64SliceValue, - merge: mergeListValue, -} - -// sizeSfixed64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sfixed64. -func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := llen * protowire.SizeFixed64() - return tagsize + protowire.SizeBytes(n) -} - -// appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64. -func appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := llen * protowire.SizeFixed64() - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendFixed64(b, uint64(v.Int())) - } - return b, nil -} - -var coderSfixed64PackedSliceValue = valueCoderFuncs{ - size: sizeSfixed64PackedSliceValue, - marshal: appendSfixed64PackedSliceValue, - unmarshal: consumeSfixed64SliceValue, - merge: mergeListValue, -} - -// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64. -func sizeFixed64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - - return f.tagsize + protowire.SizeFixed64() -} - -// appendFixed64 wire encodes a uint64 pointer as a Fixed64. -func appendFixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint64() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, v) - return b, nil -} - -// consumeFixed64 wire decodes a uint64 pointer as a Fixed64. -func consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Uint64() = v - out.n = n - return out, nil -} - -var coderFixed64 = pointerCoderFuncs{ - size: sizeFixed64, - marshal: appendFixed64, - unmarshal: consumeFixed64, - merge: mergeUint64, -} - -// sizeFixed64NoZero returns the size of wire encoding a uint64 pointer as a Fixed64. -// The zero value is not encoded. -func sizeFixed64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Uint64() - if v == 0 { - return 0 - } - return f.tagsize + protowire.SizeFixed64() -} - -// appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64. -// The zero value is not encoded. -func appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Uint64() - if v == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, v) - return b, nil -} - -var coderFixed64NoZero = pointerCoderFuncs{ - size: sizeFixed64NoZero, - marshal: appendFixed64NoZero, - unmarshal: consumeFixed64, - merge: mergeUint64NoZero, -} - -// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64. -// It panics if the pointer is nil. -func sizeFixed64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - return f.tagsize + protowire.SizeFixed64() -} - -// appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64. -// It panics if the pointer is nil. -func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Uint64Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, v) - return b, nil -} - -// consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64. -func consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Uint64Ptr() - if *vp == nil { - *vp = new(uint64) - } - **vp = v - out.n = n - return out, nil -} - -var coderFixed64Ptr = pointerCoderFuncs{ - size: sizeFixed64Ptr, - marshal: appendFixed64Ptr, - unmarshal: consumeFixed64Ptr, - merge: mergeUint64Ptr, -} - -// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64. -func sizeFixed64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint64Slice() - size = len(s) * (f.tagsize + protowire.SizeFixed64()) - return size -} - -// appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64. -func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint64Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, v) - } - return b, nil -} - -// consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64. -func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Uint64Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, v) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, v) - out.n = n - return out, nil -} - -var coderFixed64Slice = pointerCoderFuncs{ - size: sizeFixed64Slice, - marshal: appendFixed64Slice, - unmarshal: consumeFixed64Slice, - merge: mergeUint64Slice, -} - -// sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64. -func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Uint64Slice() - if len(s) == 0 { - return 0 - } - n := len(s) * protowire.SizeFixed64() - return f.tagsize + protowire.SizeBytes(n) -} - -// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64. -func appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Uint64Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := len(s) * protowire.SizeFixed64() - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendFixed64(b, v) - } - return b, nil -} - -var coderFixed64PackedSlice = pointerCoderFuncs{ - size: sizeFixed64PackedSlice, - marshal: appendFixed64PackedSlice, - unmarshal: consumeFixed64Slice, - merge: mergeUint64Slice, -} - -// sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64. -func sizeFixed64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeFixed64() -} - -// appendFixed64Value encodes a uint64 value as a Fixed64. -func appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed64(b, v.Uint()) - return b, nil -} - -// consumeFixed64Value decodes a uint64 value as a Fixed64. -func consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfUint64(v), out, nil -} - -var coderFixed64Value = valueCoderFuncs{ - size: sizeFixed64Value, - marshal: appendFixed64Value, - unmarshal: consumeFixed64Value, - merge: mergeScalarValue, -} - -// sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64. -func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - size = list.Len() * (tagsize + protowire.SizeFixed64()) - return size -} - -// appendFixed64SliceValue encodes a []uint64 value as a repeated Fixed64. -func appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed64(b, v.Uint()) - } - return b, nil -} - -// consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64. -func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint64(v)) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.Fixed64Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint64(v)) - out.n = n - return listv, out, nil -} - -var coderFixed64SliceValue = valueCoderFuncs{ - size: sizeFixed64SliceValue, - marshal: appendFixed64SliceValue, - unmarshal: consumeFixed64SliceValue, - merge: mergeListValue, -} - -// sizeFixed64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Fixed64. -func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := llen * protowire.SizeFixed64() - return tagsize + protowire.SizeBytes(n) -} - -// appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64. -func appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := llen * protowire.SizeFixed64() - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendFixed64(b, v.Uint()) - } - return b, nil -} - -var coderFixed64PackedSliceValue = valueCoderFuncs{ - size: sizeFixed64PackedSliceValue, - marshal: appendFixed64PackedSliceValue, - unmarshal: consumeFixed64SliceValue, - merge: mergeListValue, -} - -// sizeDouble returns the size of wire encoding a float64 pointer as a Double. -func sizeDouble(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - - return f.tagsize + protowire.SizeFixed64() -} - -// appendDouble wire encodes a float64 pointer as a Double. -func appendDouble(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Float64() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, math.Float64bits(v)) - return b, nil -} - -// consumeDouble wire decodes a float64 pointer as a Double. -func consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Float64() = math.Float64frombits(v) - out.n = n - return out, nil -} - -var coderDouble = pointerCoderFuncs{ - size: sizeDouble, - marshal: appendDouble, - unmarshal: consumeDouble, - merge: mergeFloat64, -} - -// sizeDoubleNoZero returns the size of wire encoding a float64 pointer as a Double. -// The zero value is not encoded. -func sizeDoubleNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Float64() - if v == 0 && !math.Signbit(float64(v)) { - return 0 - } - return f.tagsize + protowire.SizeFixed64() -} - -// appendDoubleNoZero wire encodes a float64 pointer as a Double. -// The zero value is not encoded. -func appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Float64() - if v == 0 && !math.Signbit(float64(v)) { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, math.Float64bits(v)) - return b, nil -} - -var coderDoubleNoZero = pointerCoderFuncs{ - size: sizeDoubleNoZero, - marshal: appendDoubleNoZero, - unmarshal: consumeDouble, - merge: mergeFloat64NoZero, -} - -// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double. -// It panics if the pointer is nil. -func sizeDoublePtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - return f.tagsize + protowire.SizeFixed64() -} - -// appendDoublePtr wire encodes a *float64 pointer as a Double. -// It panics if the pointer is nil. -func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.Float64Ptr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, math.Float64bits(v)) - return b, nil -} - -// consumeDoublePtr wire decodes a *float64 pointer as a Double. -func consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.Float64Ptr() - if *vp == nil { - *vp = new(float64) - } - **vp = math.Float64frombits(v) - out.n = n - return out, nil -} - -var coderDoublePtr = pointerCoderFuncs{ - size: sizeDoublePtr, - marshal: appendDoublePtr, - unmarshal: consumeDoublePtr, - merge: mergeFloat64Ptr, -} - -// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double. -func sizeDoubleSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Float64Slice() - size = len(s) * (f.tagsize + protowire.SizeFixed64()) - return size -} - -// appendDoubleSlice encodes a []float64 pointer as a repeated Double. -func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Float64Slice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendFixed64(b, math.Float64bits(v)) - } - return b, nil -} - -// consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double. -func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.Float64Slice() - if wtyp == protowire.BytesType { - s := *sp - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - s = append(s, math.Float64frombits(v)) - b = b[n:] - } - *sp = s - out.n = n - return out, nil - } - if wtyp != protowire.Fixed64Type { - return out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, math.Float64frombits(v)) - out.n = n - return out, nil -} - -var coderDoubleSlice = pointerCoderFuncs{ - size: sizeDoubleSlice, - marshal: appendDoubleSlice, - unmarshal: consumeDoubleSlice, - merge: mergeFloat64Slice, -} - -// sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double. -func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.Float64Slice() - if len(s) == 0 { - return 0 - } - n := len(s) * protowire.SizeFixed64() - return f.tagsize + protowire.SizeBytes(n) -} - -// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double. -func appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.Float64Slice() - if len(s) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := len(s) * protowire.SizeFixed64() - b = protowire.AppendVarint(b, uint64(n)) - for _, v := range s { - b = protowire.AppendFixed64(b, math.Float64bits(v)) - } - return b, nil -} - -var coderDoublePackedSlice = pointerCoderFuncs{ - size: sizeDoublePackedSlice, - marshal: appendDoublePackedSlice, - unmarshal: consumeDoubleSlice, - merge: mergeFloat64Slice, -} - -// sizeDoubleValue returns the size of wire encoding a float64 value as a Double. -func sizeDoubleValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeFixed64() -} - -// appendDoubleValue encodes a float64 value as a Double. -func appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed64(b, math.Float64bits(v.Float())) - return b, nil -} - -// consumeDoubleValue decodes a float64 value as a Double. -func consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.Fixed64Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil -} - -var coderDoubleValue = valueCoderFuncs{ - size: sizeDoubleValue, - marshal: appendDoubleValue, - unmarshal: consumeDoubleValue, - merge: mergeScalarValue, -} - -// sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double. -func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - size = list.Len() * (tagsize + protowire.SizeFixed64()) - return size -} - -// appendDoubleSliceValue encodes a []float64 value as a repeated Double. -func appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendFixed64(b, math.Float64bits(v.Float())) - } - return b, nil -} - -// consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double. -func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) - b = b[n:] - } - out.n = n - return listv, out, nil - } - if wtyp != protowire.Fixed64Type { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) - out.n = n - return listv, out, nil -} - -var coderDoubleSliceValue = valueCoderFuncs{ - size: sizeDoubleSliceValue, - marshal: appendDoubleSliceValue, - unmarshal: consumeDoubleSliceValue, - merge: mergeListValue, -} - -// sizeDoublePackedSliceValue returns the size of wire encoding a []float64 value as a packed repeated Double. -func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return 0 - } - n := llen * protowire.SizeFixed64() - return tagsize + protowire.SizeBytes(n) -} - -// appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double. -func appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - llen := list.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, wiretag) - n := llen * protowire.SizeFixed64() - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - v := list.Get(i) - b = protowire.AppendFixed64(b, math.Float64bits(v.Float())) - } - return b, nil -} - -var coderDoublePackedSliceValue = valueCoderFuncs{ - size: sizeDoublePackedSliceValue, - marshal: appendDoublePackedSliceValue, - unmarshal: consumeDoubleSliceValue, - merge: mergeListValue, -} - -// sizeString returns the size of wire encoding a string pointer as a String. -func sizeString(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.String() - return f.tagsize + protowire.SizeBytes(len(v)) -} - -// appendString wire encodes a string pointer as a String. -func appendString(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.String() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - return b, nil -} - -// consumeString wire decodes a string pointer as a String. -func consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.String() = v - out.n = n - return out, nil -} - -var coderString = pointerCoderFuncs{ - size: sizeString, - marshal: appendString, - unmarshal: consumeString, - merge: mergeString, -} - -// appendStringValidateUTF8 wire encodes a string pointer as a String. -func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.String() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - if !utf8.ValidString(v) { - return b, errInvalidUTF8{} - } - return b, nil -} - -// consumeStringValidateUTF8 wire decodes a string pointer as a String. -func consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !utf8.ValidString(v) { - return out, errInvalidUTF8{} - } - *p.String() = v - out.n = n - return out, nil -} - -var coderStringValidateUTF8 = pointerCoderFuncs{ - size: sizeString, - marshal: appendStringValidateUTF8, - unmarshal: consumeStringValidateUTF8, - merge: mergeString, -} - -// sizeStringNoZero returns the size of wire encoding a string pointer as a String. -// The zero value is not encoded. -func sizeStringNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.String() - if len(v) == 0 { - return 0 - } - return f.tagsize + protowire.SizeBytes(len(v)) -} - -// appendStringNoZero wire encodes a string pointer as a String. -// The zero value is not encoded. -func appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.String() - if len(v) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - return b, nil -} - -var coderStringNoZero = pointerCoderFuncs{ - size: sizeStringNoZero, - marshal: appendStringNoZero, - unmarshal: consumeString, - merge: mergeStringNoZero, -} - -// appendStringNoZeroValidateUTF8 wire encodes a string pointer as a String. -// The zero value is not encoded. -func appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.String() - if len(v) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - if !utf8.ValidString(v) { - return b, errInvalidUTF8{} - } - return b, nil -} - -var coderStringNoZeroValidateUTF8 = pointerCoderFuncs{ - size: sizeStringNoZero, - marshal: appendStringNoZeroValidateUTF8, - unmarshal: consumeStringValidateUTF8, - merge: mergeStringNoZero, -} - -// sizeStringPtr returns the size of wire encoding a *string pointer as a String. -// It panics if the pointer is nil. -func sizeStringPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := **p.StringPtr() - return f.tagsize + protowire.SizeBytes(len(v)) -} - -// appendStringPtr wire encodes a *string pointer as a String. -// It panics if the pointer is nil. -func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.StringPtr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - return b, nil -} - -// consumeStringPtr wire decodes a *string pointer as a String. -func consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return out, protowire.ParseError(n) - } - vp := p.StringPtr() - if *vp == nil { - *vp = new(string) - } - **vp = v - out.n = n - return out, nil -} - -var coderStringPtr = pointerCoderFuncs{ - size: sizeStringPtr, - marshal: appendStringPtr, - unmarshal: consumeStringPtr, - merge: mergeStringPtr, -} - -// appendStringPtrValidateUTF8 wire encodes a *string pointer as a String. -// It panics if the pointer is nil. -func appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := **p.StringPtr() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - if !utf8.ValidString(v) { - return b, errInvalidUTF8{} - } - return b, nil -} - -// consumeStringPtrValidateUTF8 wire decodes a *string pointer as a String. -func consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !utf8.ValidString(v) { - return out, errInvalidUTF8{} - } - vp := p.StringPtr() - if *vp == nil { - *vp = new(string) - } - **vp = v - out.n = n - return out, nil -} - -var coderStringPtrValidateUTF8 = pointerCoderFuncs{ - size: sizeStringPtr, - marshal: appendStringPtrValidateUTF8, - unmarshal: consumeStringPtrValidateUTF8, - merge: mergeStringPtr, -} - -// sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String. -func sizeStringSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.StringSlice() - for _, v := range s { - size += f.tagsize + protowire.SizeBytes(len(v)) - } - return size -} - -// appendStringSlice encodes a []string pointer as a repeated String. -func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.StringSlice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - } - return b, nil -} - -// consumeStringSlice wire decodes a []string pointer as a repeated String. -func consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.StringSlice() - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, v) - out.n = n - return out, nil -} - -var coderStringSlice = pointerCoderFuncs{ - size: sizeStringSlice, - marshal: appendStringSlice, - unmarshal: consumeStringSlice, - merge: mergeStringSlice, -} - -// appendStringSliceValidateUTF8 encodes a []string pointer as a repeated String. -func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.StringSlice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendString(b, v) - if !utf8.ValidString(v) { - return b, errInvalidUTF8{} - } - } - return b, nil -} - -// consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String. -func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.StringSlice() - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !utf8.ValidString(v) { - return out, errInvalidUTF8{} - } - *sp = append(*sp, v) - out.n = n - return out, nil -} - -var coderStringSliceValidateUTF8 = pointerCoderFuncs{ - size: sizeStringSlice, - marshal: appendStringSliceValidateUTF8, - unmarshal: consumeStringSliceValidateUTF8, - merge: mergeStringSlice, -} - -// sizeStringValue returns the size of wire encoding a string value as a String. -func sizeStringValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeBytes(len(v.String())) -} - -// appendStringValue encodes a string value as a String. -func appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendString(b, v.String()) - return b, nil -} - -// consumeStringValue decodes a string value as a String. -func consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfString(string(v)), out, nil -} - -var coderStringValue = valueCoderFuncs{ - size: sizeStringValue, - marshal: appendStringValue, - unmarshal: consumeStringValue, - merge: mergeScalarValue, -} - -// appendStringValueValidateUTF8 encodes a string value as a String. -func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendString(b, v.String()) - if !utf8.ValidString(v.String()) { - return b, errInvalidUTF8{} - } - return b, nil -} - -// consumeStringValueValidateUTF8 decodes a string value as a String. -func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - if !utf8.ValidString(v) { - return protoreflect.Value{}, out, errInvalidUTF8{} - } - out.n = n - return protoreflect.ValueOfString(string(v)), out, nil -} - -var coderStringValueValidateUTF8 = valueCoderFuncs{ - size: sizeStringValue, - marshal: appendStringValueValidateUTF8, - unmarshal: consumeStringValueValidateUTF8, - merge: mergeScalarValue, -} - -// sizeStringSliceValue returns the size of wire encoding a []string value as a repeated String. -func sizeStringSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeBytes(len(v.String())) - } - return size -} - -// appendStringSliceValue encodes a []string value as a repeated String. -func appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendString(b, v.String()) - } - return b, nil -} - -// consumeStringSliceValue wire decodes a []string value as a repeated String. -func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp != protowire.BytesType { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeString(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfString(string(v))) - out.n = n - return listv, out, nil -} - -var coderStringSliceValue = valueCoderFuncs{ - size: sizeStringSliceValue, - marshal: appendStringSliceValue, - unmarshal: consumeStringSliceValue, - merge: mergeListValue, -} - -// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes. -func sizeBytes(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Bytes() - return f.tagsize + protowire.SizeBytes(len(v)) -} - -// appendBytes wire encodes a []byte pointer as a Bytes. -func appendBytes(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Bytes() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendBytes(b, v) - return b, nil -} - -// consumeBytes wire decodes a []byte pointer as a Bytes. -func consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Bytes() = append(emptyBuf[:], v...) - out.n = n - return out, nil -} - -var coderBytes = pointerCoderFuncs{ - size: sizeBytes, - marshal: appendBytes, - unmarshal: consumeBytes, - merge: mergeBytes, -} - -// appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes. -func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Bytes() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendBytes(b, v) - if !utf8.Valid(v) { - return b, errInvalidUTF8{} - } - return b, nil -} - -// consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes. -func consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !utf8.Valid(v) { - return out, errInvalidUTF8{} - } - *p.Bytes() = append(emptyBuf[:], v...) - out.n = n - return out, nil -} - -var coderBytesValidateUTF8 = pointerCoderFuncs{ - size: sizeBytes, - marshal: appendBytesValidateUTF8, - unmarshal: consumeBytesValidateUTF8, - merge: mergeBytes, -} - -// sizeBytesNoZero returns the size of wire encoding a []byte pointer as a Bytes. -// The zero value is not encoded. -func sizeBytesNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := *p.Bytes() - if len(v) == 0 { - return 0 - } - return f.tagsize + protowire.SizeBytes(len(v)) -} - -// appendBytesNoZero wire encodes a []byte pointer as a Bytes. -// The zero value is not encoded. -func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Bytes() - if len(v) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendBytes(b, v) - return b, nil -} - -// consumeBytesNoZero wire decodes a []byte pointer as a Bytes. -// The zero value is not decoded. -func consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *p.Bytes() = append(([]byte)(nil), v...) - out.n = n - return out, nil -} - -var coderBytesNoZero = pointerCoderFuncs{ - size: sizeBytesNoZero, - marshal: appendBytesNoZero, - unmarshal: consumeBytesNoZero, - merge: mergeBytesNoZero, -} - -// appendBytesNoZeroValidateUTF8 wire encodes a []byte pointer as a Bytes. -// The zero value is not encoded. -func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - v := *p.Bytes() - if len(v) == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendBytes(b, v) - if !utf8.Valid(v) { - return b, errInvalidUTF8{} - } - return b, nil -} - -// consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes. -func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !utf8.Valid(v) { - return out, errInvalidUTF8{} - } - *p.Bytes() = append(([]byte)(nil), v...) - out.n = n - return out, nil -} - -var coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{ - size: sizeBytesNoZero, - marshal: appendBytesNoZeroValidateUTF8, - unmarshal: consumeBytesNoZeroValidateUTF8, - merge: mergeBytesNoZero, -} - -// sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes. -func sizeBytesSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - s := *p.BytesSlice() - for _, v := range s { - size += f.tagsize + protowire.SizeBytes(len(v)) - } - return size -} - -// appendBytesSlice encodes a [][]byte pointer as a repeated Bytes. -func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.BytesSlice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendBytes(b, v) - } - return b, nil -} - -// consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes. -func consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.BytesSlice() - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - *sp = append(*sp, append(emptyBuf[:], v...)) - out.n = n - return out, nil -} - -var coderBytesSlice = pointerCoderFuncs{ - size: sizeBytesSlice, - marshal: appendBytesSlice, - unmarshal: consumeBytesSlice, - merge: mergeBytesSlice, -} - -// appendBytesSliceValidateUTF8 encodes a [][]byte pointer as a repeated Bytes. -func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { - s := *p.BytesSlice() - for _, v := range s { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendBytes(b, v) - if !utf8.Valid(v) { - return b, errInvalidUTF8{} - } - } - return b, nil -} - -// consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes. -func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.BytesSlice() - if wtyp != protowire.BytesType { - return out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !utf8.Valid(v) { - return out, errInvalidUTF8{} - } - *sp = append(*sp, append(emptyBuf[:], v...)) - out.n = n - return out, nil -} - -var coderBytesSliceValidateUTF8 = pointerCoderFuncs{ - size: sizeBytesSlice, - marshal: appendBytesSliceValidateUTF8, - unmarshal: consumeBytesSliceValidateUTF8, - merge: mergeBytesSlice, -} - -// sizeBytesValue returns the size of wire encoding a []byte value as a Bytes. -func sizeBytesValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { - return tagsize + protowire.SizeBytes(len(v.Bytes())) -} - -// appendBytesValue encodes a []byte value as a Bytes. -func appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendBytes(b, v.Bytes()) - return b, nil -} - -// consumeBytesValue decodes a []byte value as a Bytes. -func consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - out.n = n - return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil -} - -var coderBytesValue = valueCoderFuncs{ - size: sizeBytesValue, - marshal: appendBytesValue, - unmarshal: consumeBytesValue, - merge: mergeBytesValue, -} - -// sizeBytesSliceValue returns the size of wire encoding a [][]byte value as a repeated Bytes. -func sizeBytesSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - size += tagsize + protowire.SizeBytes(len(v.Bytes())) - } - return size -} - -// appendBytesSliceValue encodes a [][]byte value as a repeated Bytes. -func appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { - list := listv.List() - for i, llen := 0, list.Len(); i < llen; i++ { - v := list.Get(i) - b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendBytes(b, v.Bytes()) - } - return b, nil -} - -// consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes. -func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { - list := listv.List() - if wtyp != protowire.BytesType { - return protoreflect.Value{}, out, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...))) - out.n = n - return listv, out, nil -} - -var coderBytesSliceValue = valueCoderFuncs{ - size: sizeBytesSliceValue, - marshal: appendBytesSliceValue, - unmarshal: consumeBytesSliceValue, - merge: mergeBytesListValue, -} - -// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices. -var emptyBuf [0]byte - -var wireTypes = map[protoreflect.Kind]protowire.Type{ - protoreflect.BoolKind: protowire.VarintType, - protoreflect.EnumKind: protowire.VarintType, - protoreflect.Int32Kind: protowire.VarintType, - protoreflect.Sint32Kind: protowire.VarintType, - protoreflect.Uint32Kind: protowire.VarintType, - protoreflect.Int64Kind: protowire.VarintType, - protoreflect.Sint64Kind: protowire.VarintType, - protoreflect.Uint64Kind: protowire.VarintType, - protoreflect.Sfixed32Kind: protowire.Fixed32Type, - protoreflect.Fixed32Kind: protowire.Fixed32Type, - protoreflect.FloatKind: protowire.Fixed32Type, - protoreflect.Sfixed64Kind: protowire.Fixed64Type, - protoreflect.Fixed64Kind: protowire.Fixed64Type, - protoreflect.DoubleKind: protowire.Fixed64Type, - protoreflect.StringKind: protowire.BytesType, - protoreflect.BytesKind: protowire.BytesType, - protoreflect.MessageKind: protowire.BytesType, - protoreflect.GroupKind: protowire.StartGroupType, -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go deleted file mode 100644 index 44885a761..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "errors" - "reflect" - "sort" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/genid" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type mapInfo struct { - goType reflect.Type - keyWiretag uint64 - valWiretag uint64 - keyFuncs valueCoderFuncs - valFuncs valueCoderFuncs - keyZero pref.Value - keyKind pref.Kind - conv *mapConverter -} - -func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) { - // TODO: Consider generating specialized map coders. - keyField := fd.MapKey() - valField := fd.MapValue() - keyWiretag := protowire.EncodeTag(1, wireTypes[keyField.Kind()]) - valWiretag := protowire.EncodeTag(2, wireTypes[valField.Kind()]) - keyFuncs := encoderFuncsForValue(keyField) - valFuncs := encoderFuncsForValue(valField) - conv := newMapConverter(ft, fd) - - mapi := &mapInfo{ - goType: ft, - keyWiretag: keyWiretag, - valWiretag: valWiretag, - keyFuncs: keyFuncs, - valFuncs: valFuncs, - keyZero: keyField.Default(), - keyKind: keyField.Kind(), - conv: conv, - } - if valField.Kind() == pref.MessageKind { - valueMessage = getMessageInfo(ft.Elem()) - } - - funcs = pointerCoderFuncs{ - size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { - return sizeMap(p.AsValueOf(ft).Elem(), mapi, f, opts) - }, - marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - return appendMap(b, p.AsValueOf(ft).Elem(), mapi, f, opts) - }, - unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { - mp := p.AsValueOf(ft) - if mp.Elem().IsNil() { - mp.Elem().Set(reflect.MakeMap(mapi.goType)) - } - if f.mi == nil { - return consumeMap(b, mp.Elem(), wtyp, mapi, f, opts) - } else { - return consumeMapOfMessage(b, mp.Elem(), wtyp, mapi, f, opts) - } - }, - } - switch valField.Kind() { - case pref.MessageKind: - funcs.merge = mergeMapOfMessage - case pref.BytesKind: - funcs.merge = mergeMapOfBytes - default: - funcs.merge = mergeMap - } - if valFuncs.isInit != nil { - funcs.isInit = func(p pointer, f *coderFieldInfo) error { - return isInitMap(p.AsValueOf(ft).Elem(), mapi, f) - } - } - return valueMessage, funcs -} - -const ( - mapKeyTagSize = 1 // field 1, tag size 1. - mapValTagSize = 1 // field 2, tag size 2. -) - -func sizeMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) int { - if mapv.Len() == 0 { - return 0 - } - n := 0 - iter := mapRange(mapv) - for iter.Next() { - key := mapi.conv.keyConv.PBValueOf(iter.Key()).MapKey() - keySize := mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts) - var valSize int - value := mapi.conv.valConv.PBValueOf(iter.Value()) - if f.mi == nil { - valSize = mapi.valFuncs.size(value, mapValTagSize, opts) - } else { - p := pointerOfValue(iter.Value()) - valSize += mapValTagSize - valSize += protowire.SizeBytes(f.mi.sizePointer(p, opts)) - } - n += f.tagsize + protowire.SizeBytes(keySize+valSize) - } - return n -} - -func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - var ( - key = mapi.keyZero - val = mapi.conv.valConv.New() - ) - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if num > protowire.MaxValidNumber { - return out, errors.New("invalid field number") - } - b = b[n:] - err := errUnknown - switch num { - case genid.MapEntry_Key_field_number: - var v pref.Value - var o unmarshalOutput - v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts) - if err != nil { - break - } - key = v - n = o.n - case genid.MapEntry_Value_field_number: - var v pref.Value - var o unmarshalOutput - v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts) - if err != nil { - break - } - val = v - n = o.n - } - if err == errUnknown { - n = protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return out, protowire.ParseError(n) - } - } else if err != nil { - return out, err - } - b = b[n:] - } - mapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), mapi.conv.valConv.GoValueOf(val)) - out.n = n - return out, nil -} - -func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.BytesType { - return out, errUnknown - } - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - var ( - key = mapi.keyZero - val = reflect.New(f.mi.GoReflectType.Elem()) - ) - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return out, protowire.ParseError(n) - } - if num > protowire.MaxValidNumber { - return out, errors.New("invalid field number") - } - b = b[n:] - err := errUnknown - switch num { - case 1: - var v pref.Value - var o unmarshalOutput - v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts) - if err != nil { - break - } - key = v - n = o.n - case 2: - if wtyp != protowire.BytesType { - break - } - var v []byte - v, n = protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - var o unmarshalOutput - o, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts) - if o.initialized { - // Consider this map item initialized so long as we see - // an initialized value. - out.initialized = true - } - } - if err == errUnknown { - n = protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return out, protowire.ParseError(n) - } - } else if err != nil { - return out, err - } - b = b[n:] - } - mapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), val) - out.n = n - return out, nil -} - -func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - if f.mi == nil { - key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey() - val := mapi.conv.valConv.PBValueOf(valrv) - size := 0 - size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts) - size += mapi.valFuncs.size(val, mapValTagSize, opts) - b = protowire.AppendVarint(b, uint64(size)) - b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts) - if err != nil { - return nil, err - } - return mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts) - } else { - key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey() - val := pointerOfValue(valrv) - valSize := f.mi.sizePointer(val, opts) - size := 0 - size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts) - size += mapValTagSize + protowire.SizeBytes(valSize) - b = protowire.AppendVarint(b, uint64(size)) - b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts) - if err != nil { - return nil, err - } - b = protowire.AppendVarint(b, mapi.valWiretag) - b = protowire.AppendVarint(b, uint64(valSize)) - return f.mi.marshalAppendPointer(b, val, opts) - } -} - -func appendMap(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - if mapv.Len() == 0 { - return b, nil - } - if opts.Deterministic() { - return appendMapDeterministic(b, mapv, mapi, f, opts) - } - iter := mapRange(mapv) - for iter.Next() { - var err error - b = protowire.AppendVarint(b, f.wiretag) - b, err = appendMapItem(b, iter.Key(), iter.Value(), mapi, f, opts) - if err != nil { - return b, err - } - } - return b, nil -} - -func appendMapDeterministic(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - keys := mapv.MapKeys() - sort.Slice(keys, func(i, j int) bool { - switch keys[i].Kind() { - case reflect.Bool: - return !keys[i].Bool() && keys[j].Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return keys[i].Int() < keys[j].Int() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return keys[i].Uint() < keys[j].Uint() - case reflect.Float32, reflect.Float64: - return keys[i].Float() < keys[j].Float() - case reflect.String: - return keys[i].String() < keys[j].String() - default: - panic("invalid kind: " + keys[i].Kind().String()) - } - }) - for _, key := range keys { - var err error - b = protowire.AppendVarint(b, f.wiretag) - b, err = appendMapItem(b, key, mapv.MapIndex(key), mapi, f, opts) - if err != nil { - return b, err - } - } - return b, nil -} - -func isInitMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo) error { - if mi := f.mi; mi != nil { - mi.init() - if !mi.needsInitCheck { - return nil - } - iter := mapRange(mapv) - for iter.Next() { - val := pointerOfValue(iter.Value()) - if err := mi.checkInitializedPointer(val); err != nil { - return err - } - } - } else { - iter := mapRange(mapv) - for iter.Next() { - val := mapi.conv.valConv.PBValueOf(iter.Value()) - if err := mapi.valFuncs.isInit(val); err != nil { - return err - } - } - } - return nil -} - -func mergeMap(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - dstm := dst.AsValueOf(f.ft).Elem() - srcm := src.AsValueOf(f.ft).Elem() - if srcm.Len() == 0 { - return - } - if dstm.IsNil() { - dstm.Set(reflect.MakeMap(f.ft)) - } - iter := mapRange(srcm) - for iter.Next() { - dstm.SetMapIndex(iter.Key(), iter.Value()) - } -} - -func mergeMapOfBytes(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - dstm := dst.AsValueOf(f.ft).Elem() - srcm := src.AsValueOf(f.ft).Elem() - if srcm.Len() == 0 { - return - } - if dstm.IsNil() { - dstm.Set(reflect.MakeMap(f.ft)) - } - iter := mapRange(srcm) - for iter.Next() { - dstm.SetMapIndex(iter.Key(), reflect.ValueOf(append(emptyBuf[:], iter.Value().Bytes()...))) - } -} - -func mergeMapOfMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - dstm := dst.AsValueOf(f.ft).Elem() - srcm := src.AsValueOf(f.ft).Elem() - if srcm.Len() == 0 { - return - } - if dstm.IsNil() { - dstm.Set(reflect.MakeMap(f.ft)) - } - iter := mapRange(srcm) - for iter.Next() { - val := reflect.New(f.ft.Elem().Elem()) - if f.mi != nil { - f.mi.mergePointer(pointerOfValue(val), pointerOfValue(iter.Value()), opts) - } else { - opts.Merge(asMessage(val), asMessage(iter.Value())) - } - dstm.SetMapIndex(iter.Key(), val) - } -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go deleted file mode 100644 index 2706bb67f..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.12 - -package impl - -import "reflect" - -type mapIter struct { - v reflect.Value - keys []reflect.Value -} - -// mapRange provides a less-efficient equivalent to -// the Go 1.12 reflect.Value.MapRange method. -func mapRange(v reflect.Value) *mapIter { - return &mapIter{v: v} -} - -func (i *mapIter) Next() bool { - if i.keys == nil { - i.keys = i.v.MapKeys() - } else { - i.keys = i.keys[1:] - } - return len(i.keys) > 0 -} - -func (i *mapIter) Key() reflect.Value { - return i.keys[0] -} - -func (i *mapIter) Value() reflect.Value { - return i.v.MapIndex(i.keys[0]) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go deleted file mode 100644 index 1533ef600..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.12 - -package impl - -import "reflect" - -func mapRange(v reflect.Value) *reflect.MapIter { return v.MapRange() } diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go deleted file mode 100644 index 0e176d565..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - "sort" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/fieldsort" - pref "google.golang.org/protobuf/reflect/protoreflect" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -// coderMessageInfo contains per-message information used by the fast-path functions. -// This is a different type from MessageInfo to keep MessageInfo as general-purpose as -// possible. -type coderMessageInfo struct { - methods piface.Methods - - orderedCoderFields []*coderFieldInfo - denseCoderFields []*coderFieldInfo - coderFields map[protowire.Number]*coderFieldInfo - sizecacheOffset offset - unknownOffset offset - extensionOffset offset - needsInitCheck bool - isMessageSet bool - numRequiredFields uint8 -} - -type coderFieldInfo struct { - funcs pointerCoderFuncs // fast-path per-field functions - mi *MessageInfo // field's message - ft reflect.Type - validation validationInfo // information used by message validation - num pref.FieldNumber // field number - offset offset // struct field offset - wiretag uint64 // field tag (number + wire type) - tagsize int // size of the varint-encoded tag - isPointer bool // true if IsNil may be called on the struct field - isRequired bool // true if field is required -} - -func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { - mi.sizecacheOffset = si.sizecacheOffset - mi.unknownOffset = si.unknownOffset - mi.extensionOffset = si.extensionOffset - - mi.coderFields = make(map[protowire.Number]*coderFieldInfo) - fields := mi.Desc.Fields() - preallocFields := make([]coderFieldInfo, fields.Len()) - for i := 0; i < fields.Len(); i++ { - fd := fields.Get(i) - - fs := si.fieldsByNumber[fd.Number()] - isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic() - if isOneof { - fs = si.oneofsByName[fd.ContainingOneof().Name()] - } - ft := fs.Type - var wiretag uint64 - if !fd.IsPacked() { - wiretag = protowire.EncodeTag(fd.Number(), wireTypes[fd.Kind()]) - } else { - wiretag = protowire.EncodeTag(fd.Number(), protowire.BytesType) - } - var fieldOffset offset - var funcs pointerCoderFuncs - var childMessage *MessageInfo - switch { - case isOneof: - fieldOffset = offsetOf(fs, mi.Exporter) - case fd.IsWeak(): - fieldOffset = si.weakOffset - funcs = makeWeakMessageFieldCoder(fd) - default: - fieldOffset = offsetOf(fs, mi.Exporter) - childMessage, funcs = fieldCoder(fd, ft) - } - cf := &preallocFields[i] - *cf = coderFieldInfo{ - num: fd.Number(), - offset: fieldOffset, - wiretag: wiretag, - ft: ft, - tagsize: protowire.SizeVarint(wiretag), - funcs: funcs, - mi: childMessage, - validation: newFieldValidationInfo(mi, si, fd, ft), - isPointer: fd.Cardinality() == pref.Repeated || fd.HasPresence(), - isRequired: fd.Cardinality() == pref.Required, - } - mi.orderedCoderFields = append(mi.orderedCoderFields, cf) - mi.coderFields[cf.num] = cf - } - for i, oneofs := 0, mi.Desc.Oneofs(); i < oneofs.Len(); i++ { - if od := oneofs.Get(i); !od.IsSynthetic() { - mi.initOneofFieldCoders(od, si) - } - } - if messageset.IsMessageSet(mi.Desc) { - if !mi.extensionOffset.IsValid() { - panic(fmt.Sprintf("%v: MessageSet with no extensions field", mi.Desc.FullName())) - } - if !mi.unknownOffset.IsValid() { - panic(fmt.Sprintf("%v: MessageSet with no unknown field", mi.Desc.FullName())) - } - mi.isMessageSet = true - } - sort.Slice(mi.orderedCoderFields, func(i, j int) bool { - return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num - }) - - var maxDense pref.FieldNumber - for _, cf := range mi.orderedCoderFields { - if cf.num >= 16 && cf.num >= 2*maxDense { - break - } - maxDense = cf.num - } - mi.denseCoderFields = make([]*coderFieldInfo, maxDense+1) - for _, cf := range mi.orderedCoderFields { - if int(cf.num) >= len(mi.denseCoderFields) { - break - } - mi.denseCoderFields[cf.num] = cf - } - - // To preserve compatibility with historic wire output, marshal oneofs last. - if mi.Desc.Oneofs().Len() > 0 { - sort.Slice(mi.orderedCoderFields, func(i, j int) bool { - fi := fields.ByNumber(mi.orderedCoderFields[i].num) - fj := fields.ByNumber(mi.orderedCoderFields[j].num) - return fieldsort.Less(fi, fj) - }) - } - - mi.needsInitCheck = needsInitCheck(mi.Desc) - if mi.methods.Marshal == nil && mi.methods.Size == nil { - mi.methods.Flags |= piface.SupportMarshalDeterministic - mi.methods.Marshal = mi.marshal - mi.methods.Size = mi.size - } - if mi.methods.Unmarshal == nil { - mi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown - mi.methods.Unmarshal = mi.unmarshal - } - if mi.methods.CheckInitialized == nil { - mi.methods.CheckInitialized = mi.checkInitialized - } - if mi.methods.Merge == nil { - mi.methods.Merge = mi.merge - } -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go deleted file mode 100644 index cfb68e12f..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "sort" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" -) - -func sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int) { - if !flags.ProtoLegacy { - return 0 - } - - ext := *p.Apply(mi.extensionOffset).Extensions() - for _, x := range ext { - xi := getExtensionFieldInfo(x.Type()) - if xi.funcs.size == nil { - continue - } - num, _ := protowire.DecodeTag(xi.wiretag) - size += messageset.SizeField(num) - size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts) - } - - unknown := *p.Apply(mi.unknownOffset).Bytes() - size += messageset.SizeUnknown(unknown) - - return size -} - -func marshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts marshalOptions) ([]byte, error) { - if !flags.ProtoLegacy { - return b, errors.New("no support for message_set_wire_format") - } - - ext := *p.Apply(mi.extensionOffset).Extensions() - switch len(ext) { - case 0: - case 1: - // Fast-path for one extension: Don't bother sorting the keys. - for _, x := range ext { - var err error - b, err = marshalMessageSetField(mi, b, x, opts) - if err != nil { - return b, err - } - } - default: - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(ext)) - for k := range ext { - keys = append(keys, int(k)) - } - sort.Ints(keys) - for _, k := range keys { - var err error - b, err = marshalMessageSetField(mi, b, ext[int32(k)], opts) - if err != nil { - return b, err - } - } - } - - unknown := *p.Apply(mi.unknownOffset).Bytes() - b, err := messageset.AppendUnknown(b, unknown) - if err != nil { - return b, err - } - - return b, nil -} - -func marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts marshalOptions) ([]byte, error) { - xi := getExtensionFieldInfo(x.Type()) - num, _ := protowire.DecodeTag(xi.wiretag) - b = messageset.AppendFieldStart(b, num) - b, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts) - if err != nil { - return b, err - } - b = messageset.AppendFieldEnd(b) - return b, nil -} - -func unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOptions) (out unmarshalOutput, err error) { - if !flags.ProtoLegacy { - return out, errors.New("no support for message_set_wire_format") - } - - ep := p.Apply(mi.extensionOffset).Extensions() - if *ep == nil { - *ep = make(map[int32]ExtensionField) - } - ext := *ep - unknown := p.Apply(mi.unknownOffset).Bytes() - initialized := true - err = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error { - o, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts) - if err == errUnknown { - *unknown = protowire.AppendTag(*unknown, num, protowire.BytesType) - *unknown = append(*unknown, v...) - return nil - } - if !o.initialized { - initialized = false - } - return err - }) - out.n = len(b) - out.initialized = initialized - return out, err -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go deleted file mode 100644 index 86f7dc3c9..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build purego appengine - -package impl - -import ( - "reflect" - - "google.golang.org/protobuf/encoding/protowire" -) - -func sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := p.v.Elem().Int() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -func appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - v := p.v.Elem().Int() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, protowire.ParseError(n) - } - p.v.Elem().SetInt(int64(v)) - out.n = n - return out, nil -} - -func mergeEnum(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - dst.v.Elem().Set(src.v.Elem()) -} - -var coderEnum = pointerCoderFuncs{ - size: sizeEnum, - marshal: appendEnum, - unmarshal: consumeEnum, - merge: mergeEnum, -} - -func sizeEnumNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - if p.v.Elem().Int() == 0 { - return 0 - } - return sizeEnum(p, f, opts) -} - -func appendEnumNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - if p.v.Elem().Int() == 0 { - return b, nil - } - return appendEnum(b, p, f, opts) -} - -func mergeEnumNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - if src.v.Elem().Int() != 0 { - dst.v.Elem().Set(src.v.Elem()) - } -} - -var coderEnumNoZero = pointerCoderFuncs{ - size: sizeEnumNoZero, - marshal: appendEnumNoZero, - unmarshal: consumeEnum, - merge: mergeEnumNoZero, -} - -func sizeEnumPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - return sizeEnum(pointer{p.v.Elem()}, f, opts) -} - -func appendEnumPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - return appendEnum(b, pointer{p.v.Elem()}, f, opts) -} - -func consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - if p.v.Elem().IsNil() { - p.v.Elem().Set(reflect.New(p.v.Elem().Type().Elem())) - } - return consumeEnum(b, pointer{p.v.Elem()}, wtyp, f, opts) -} - -func mergeEnumPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - if !src.v.Elem().IsNil() { - v := reflect.New(dst.v.Type().Elem().Elem()) - v.Elem().Set(src.v.Elem().Elem()) - dst.v.Elem().Set(v) - } -} - -var coderEnumPtr = pointerCoderFuncs{ - size: sizeEnumPtr, - marshal: appendEnumPtr, - unmarshal: consumeEnumPtr, - merge: mergeEnumPtr, -} - -func sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - s := p.v.Elem() - for i, llen := 0, s.Len(); i < llen; i++ { - size += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize - } - return size -} - -func appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.v.Elem() - for i, llen := 0, s.Len(); i < llen; i++ { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(s.Index(i).Int())) - } - return b, nil -} - -func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - s := p.v.Elem() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, protowire.ParseError(n) - } - for len(b) > 0 { - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, protowire.ParseError(n) - } - rv := reflect.New(s.Type().Elem()).Elem() - rv.SetInt(int64(v)) - s.Set(reflect.Append(s, rv)) - b = b[n:] - } - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, protowire.ParseError(n) - } - rv := reflect.New(s.Type().Elem()).Elem() - rv.SetInt(int64(v)) - s.Set(reflect.Append(s, rv)) - out.n = n - return out, nil -} - -func mergeEnumSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - dst.v.Elem().Set(reflect.AppendSlice(dst.v.Elem(), src.v.Elem())) -} - -var coderEnumSlice = pointerCoderFuncs{ - size: sizeEnumSlice, - marshal: appendEnumSlice, - unmarshal: consumeEnumSlice, - merge: mergeEnumSlice, -} - -func sizeEnumPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - s := p.v.Elem() - llen := s.Len() - if llen == 0 { - return 0 - } - n := 0 - for i := 0; i < llen; i++ { - n += protowire.SizeVarint(uint64(s.Index(i).Int())) - } - return f.tagsize + protowire.SizeBytes(n) -} - -func appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.v.Elem() - llen := s.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for i := 0; i < llen; i++ { - n += protowire.SizeVarint(uint64(s.Index(i).Int())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - b = protowire.AppendVarint(b, uint64(s.Index(i).Int())) - } - return b, nil -} - -var coderEnumPackedSlice = pointerCoderFuncs{ - size: sizeEnumPackedSlice, - marshal: appendEnumPackedSlice, - unmarshal: consumeEnumSlice, - merge: mergeEnumSlice, -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go b/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go deleted file mode 100644 index e89971238..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go +++ /dev/null @@ -1,557 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/strs" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// pointerCoderFuncs is a set of pointer encoding functions. -type pointerCoderFuncs struct { - mi *MessageInfo - size func(p pointer, f *coderFieldInfo, opts marshalOptions) int - marshal func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) - unmarshal func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) - isInit func(p pointer, f *coderFieldInfo) error - merge func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) -} - -// valueCoderFuncs is a set of protoreflect.Value encoding functions. -type valueCoderFuncs struct { - size func(v pref.Value, tagsize int, opts marshalOptions) int - marshal func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) - unmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) - isInit func(v pref.Value) error - merge func(dst, src pref.Value, opts mergeOptions) pref.Value -} - -// fieldCoder returns pointer functions for a field, used for operating on -// struct fields. -func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) { - switch { - case fd.IsMap(): - return encoderFuncsForMap(fd, ft) - case fd.Cardinality() == pref.Repeated && !fd.IsPacked(): - // Repeated fields (not packed). - if ft.Kind() != reflect.Slice { - break - } - ft := ft.Elem() - switch fd.Kind() { - case pref.BoolKind: - if ft.Kind() == reflect.Bool { - return nil, coderBoolSlice - } - case pref.EnumKind: - if ft.Kind() == reflect.Int32 { - return nil, coderEnumSlice - } - case pref.Int32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderInt32Slice - } - case pref.Sint32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSint32Slice - } - case pref.Uint32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderUint32Slice - } - case pref.Int64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderInt64Slice - } - case pref.Sint64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSint64Slice - } - case pref.Uint64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderUint64Slice - } - case pref.Sfixed32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSfixed32Slice - } - case pref.Fixed32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderFixed32Slice - } - case pref.FloatKind: - if ft.Kind() == reflect.Float32 { - return nil, coderFloatSlice - } - case pref.Sfixed64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSfixed64Slice - } - case pref.Fixed64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderFixed64Slice - } - case pref.DoubleKind: - if ft.Kind() == reflect.Float64 { - return nil, coderDoubleSlice - } - case pref.StringKind: - if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) { - return nil, coderStringSliceValidateUTF8 - } - if ft.Kind() == reflect.String { - return nil, coderStringSlice - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) { - return nil, coderBytesSliceValidateUTF8 - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 { - return nil, coderBytesSlice - } - case pref.BytesKind: - if ft.Kind() == reflect.String { - return nil, coderStringSlice - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 { - return nil, coderBytesSlice - } - case pref.MessageKind: - return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft) - case pref.GroupKind: - return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft) - } - case fd.Cardinality() == pref.Repeated && fd.IsPacked(): - // Packed repeated fields. - // - // Only repeated fields of primitive numeric types - // (Varint, Fixed32, or Fixed64 wire type) can be packed. - if ft.Kind() != reflect.Slice { - break - } - ft := ft.Elem() - switch fd.Kind() { - case pref.BoolKind: - if ft.Kind() == reflect.Bool { - return nil, coderBoolPackedSlice - } - case pref.EnumKind: - if ft.Kind() == reflect.Int32 { - return nil, coderEnumPackedSlice - } - case pref.Int32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderInt32PackedSlice - } - case pref.Sint32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSint32PackedSlice - } - case pref.Uint32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderUint32PackedSlice - } - case pref.Int64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderInt64PackedSlice - } - case pref.Sint64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSint64PackedSlice - } - case pref.Uint64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderUint64PackedSlice - } - case pref.Sfixed32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSfixed32PackedSlice - } - case pref.Fixed32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderFixed32PackedSlice - } - case pref.FloatKind: - if ft.Kind() == reflect.Float32 { - return nil, coderFloatPackedSlice - } - case pref.Sfixed64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSfixed64PackedSlice - } - case pref.Fixed64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderFixed64PackedSlice - } - case pref.DoubleKind: - if ft.Kind() == reflect.Float64 { - return nil, coderDoublePackedSlice - } - } - case fd.Kind() == pref.MessageKind: - return getMessageInfo(ft), makeMessageFieldCoder(fd, ft) - case fd.Kind() == pref.GroupKind: - return getMessageInfo(ft), makeGroupFieldCoder(fd, ft) - case fd.Syntax() == pref.Proto3 && fd.ContainingOneof() == nil: - // Populated oneof fields always encode even if set to the zero value, - // which normally are not encoded in proto3. - switch fd.Kind() { - case pref.BoolKind: - if ft.Kind() == reflect.Bool { - return nil, coderBoolNoZero - } - case pref.EnumKind: - if ft.Kind() == reflect.Int32 { - return nil, coderEnumNoZero - } - case pref.Int32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderInt32NoZero - } - case pref.Sint32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSint32NoZero - } - case pref.Uint32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderUint32NoZero - } - case pref.Int64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderInt64NoZero - } - case pref.Sint64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSint64NoZero - } - case pref.Uint64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderUint64NoZero - } - case pref.Sfixed32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSfixed32NoZero - } - case pref.Fixed32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderFixed32NoZero - } - case pref.FloatKind: - if ft.Kind() == reflect.Float32 { - return nil, coderFloatNoZero - } - case pref.Sfixed64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSfixed64NoZero - } - case pref.Fixed64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderFixed64NoZero - } - case pref.DoubleKind: - if ft.Kind() == reflect.Float64 { - return nil, coderDoubleNoZero - } - case pref.StringKind: - if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) { - return nil, coderStringNoZeroValidateUTF8 - } - if ft.Kind() == reflect.String { - return nil, coderStringNoZero - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) { - return nil, coderBytesNoZeroValidateUTF8 - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 { - return nil, coderBytesNoZero - } - case pref.BytesKind: - if ft.Kind() == reflect.String { - return nil, coderStringNoZero - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 { - return nil, coderBytesNoZero - } - } - case ft.Kind() == reflect.Ptr: - ft := ft.Elem() - switch fd.Kind() { - case pref.BoolKind: - if ft.Kind() == reflect.Bool { - return nil, coderBoolPtr - } - case pref.EnumKind: - if ft.Kind() == reflect.Int32 { - return nil, coderEnumPtr - } - case pref.Int32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderInt32Ptr - } - case pref.Sint32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSint32Ptr - } - case pref.Uint32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderUint32Ptr - } - case pref.Int64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderInt64Ptr - } - case pref.Sint64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSint64Ptr - } - case pref.Uint64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderUint64Ptr - } - case pref.Sfixed32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSfixed32Ptr - } - case pref.Fixed32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderFixed32Ptr - } - case pref.FloatKind: - if ft.Kind() == reflect.Float32 { - return nil, coderFloatPtr - } - case pref.Sfixed64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSfixed64Ptr - } - case pref.Fixed64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderFixed64Ptr - } - case pref.DoubleKind: - if ft.Kind() == reflect.Float64 { - return nil, coderDoublePtr - } - case pref.StringKind: - if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) { - return nil, coderStringPtrValidateUTF8 - } - if ft.Kind() == reflect.String { - return nil, coderStringPtr - } - case pref.BytesKind: - if ft.Kind() == reflect.String { - return nil, coderStringPtr - } - } - default: - switch fd.Kind() { - case pref.BoolKind: - if ft.Kind() == reflect.Bool { - return nil, coderBool - } - case pref.EnumKind: - if ft.Kind() == reflect.Int32 { - return nil, coderEnum - } - case pref.Int32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderInt32 - } - case pref.Sint32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSint32 - } - case pref.Uint32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderUint32 - } - case pref.Int64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderInt64 - } - case pref.Sint64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSint64 - } - case pref.Uint64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderUint64 - } - case pref.Sfixed32Kind: - if ft.Kind() == reflect.Int32 { - return nil, coderSfixed32 - } - case pref.Fixed32Kind: - if ft.Kind() == reflect.Uint32 { - return nil, coderFixed32 - } - case pref.FloatKind: - if ft.Kind() == reflect.Float32 { - return nil, coderFloat - } - case pref.Sfixed64Kind: - if ft.Kind() == reflect.Int64 { - return nil, coderSfixed64 - } - case pref.Fixed64Kind: - if ft.Kind() == reflect.Uint64 { - return nil, coderFixed64 - } - case pref.DoubleKind: - if ft.Kind() == reflect.Float64 { - return nil, coderDouble - } - case pref.StringKind: - if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) { - return nil, coderStringValidateUTF8 - } - if ft.Kind() == reflect.String { - return nil, coderString - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) { - return nil, coderBytesValidateUTF8 - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 { - return nil, coderBytes - } - case pref.BytesKind: - if ft.Kind() == reflect.String { - return nil, coderString - } - if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 { - return nil, coderBytes - } - } - } - panic(fmt.Sprintf("invalid type: no encoder for %v %v %v/%v", fd.FullName(), fd.Cardinality(), fd.Kind(), ft)) -} - -// encoderFuncsForValue returns value functions for a field, used for -// extension values and map encoding. -func encoderFuncsForValue(fd pref.FieldDescriptor) valueCoderFuncs { - switch { - case fd.Cardinality() == pref.Repeated && !fd.IsPacked(): - switch fd.Kind() { - case pref.BoolKind: - return coderBoolSliceValue - case pref.EnumKind: - return coderEnumSliceValue - case pref.Int32Kind: - return coderInt32SliceValue - case pref.Sint32Kind: - return coderSint32SliceValue - case pref.Uint32Kind: - return coderUint32SliceValue - case pref.Int64Kind: - return coderInt64SliceValue - case pref.Sint64Kind: - return coderSint64SliceValue - case pref.Uint64Kind: - return coderUint64SliceValue - case pref.Sfixed32Kind: - return coderSfixed32SliceValue - case pref.Fixed32Kind: - return coderFixed32SliceValue - case pref.FloatKind: - return coderFloatSliceValue - case pref.Sfixed64Kind: - return coderSfixed64SliceValue - case pref.Fixed64Kind: - return coderFixed64SliceValue - case pref.DoubleKind: - return coderDoubleSliceValue - case pref.StringKind: - // We don't have a UTF-8 validating coder for repeated string fields. - // Value coders are used for extensions and maps. - // Extensions are never proto3, and maps never contain lists. - return coderStringSliceValue - case pref.BytesKind: - return coderBytesSliceValue - case pref.MessageKind: - return coderMessageSliceValue - case pref.GroupKind: - return coderGroupSliceValue - } - case fd.Cardinality() == pref.Repeated && fd.IsPacked(): - switch fd.Kind() { - case pref.BoolKind: - return coderBoolPackedSliceValue - case pref.EnumKind: - return coderEnumPackedSliceValue - case pref.Int32Kind: - return coderInt32PackedSliceValue - case pref.Sint32Kind: - return coderSint32PackedSliceValue - case pref.Uint32Kind: - return coderUint32PackedSliceValue - case pref.Int64Kind: - return coderInt64PackedSliceValue - case pref.Sint64Kind: - return coderSint64PackedSliceValue - case pref.Uint64Kind: - return coderUint64PackedSliceValue - case pref.Sfixed32Kind: - return coderSfixed32PackedSliceValue - case pref.Fixed32Kind: - return coderFixed32PackedSliceValue - case pref.FloatKind: - return coderFloatPackedSliceValue - case pref.Sfixed64Kind: - return coderSfixed64PackedSliceValue - case pref.Fixed64Kind: - return coderFixed64PackedSliceValue - case pref.DoubleKind: - return coderDoublePackedSliceValue - } - default: - switch fd.Kind() { - default: - case pref.BoolKind: - return coderBoolValue - case pref.EnumKind: - return coderEnumValue - case pref.Int32Kind: - return coderInt32Value - case pref.Sint32Kind: - return coderSint32Value - case pref.Uint32Kind: - return coderUint32Value - case pref.Int64Kind: - return coderInt64Value - case pref.Sint64Kind: - return coderSint64Value - case pref.Uint64Kind: - return coderUint64Value - case pref.Sfixed32Kind: - return coderSfixed32Value - case pref.Fixed32Kind: - return coderFixed32Value - case pref.FloatKind: - return coderFloatValue - case pref.Sfixed64Kind: - return coderSfixed64Value - case pref.Fixed64Kind: - return coderFixed64Value - case pref.DoubleKind: - return coderDoubleValue - case pref.StringKind: - if strs.EnforceUTF8(fd) { - return coderStringValueValidateUTF8 - } - return coderStringValue - case pref.BytesKind: - return coderBytesValue - case pref.MessageKind: - return coderMessageValue - case pref.GroupKind: - return coderGroupValue - } - } - panic(fmt.Sprintf("invalid field: no encoder for %v %v %v", fd.FullName(), fd.Cardinality(), fd.Kind())) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go deleted file mode 100644 index e118af1e2..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !purego,!appengine - -package impl - -// When using unsafe pointers, we can just treat enum values as int32s. - -var ( - coderEnumNoZero = coderInt32NoZero - coderEnum = coderInt32 - coderEnumPtr = coderInt32Ptr - coderEnumSlice = coderInt32Slice - coderEnumPackedSlice = coderInt32PackedSlice -) diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go deleted file mode 100644 index 36a90dff3..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/convert.go +++ /dev/null @@ -1,467 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// unwrapper unwraps the value to the underlying value. -// This is implemented by List and Map. -type unwrapper interface { - protoUnwrap() interface{} -} - -// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types. -type Converter interface { - // PBValueOf converts a reflect.Value to a protoreflect.Value. - PBValueOf(reflect.Value) pref.Value - - // GoValueOf converts a protoreflect.Value to a reflect.Value. - GoValueOf(pref.Value) reflect.Value - - // IsValidPB returns whether a protoreflect.Value is compatible with this type. - IsValidPB(pref.Value) bool - - // IsValidGo returns whether a reflect.Value is compatible with this type. - IsValidGo(reflect.Value) bool - - // New returns a new field value. - // For scalars, it returns the default value of the field. - // For composite types, it returns a new mutable value. - New() pref.Value - - // Zero returns a new field value. - // For scalars, it returns the default value of the field. - // For composite types, it returns an immutable, empty value. - Zero() pref.Value -} - -// NewConverter matches a Go type with a protobuf field and returns a Converter -// that converts between the two. Enums must be a named int32 kind that -// implements protoreflect.Enum, and messages must be pointer to a named -// struct type that implements protoreflect.ProtoMessage. -// -// This matcher deliberately supports a wider range of Go types than what -// protoc-gen-go historically generated to be able to automatically wrap some -// v1 messages generated by other forks of protoc-gen-go. -func NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter { - switch { - case fd.IsList(): - return newListConverter(t, fd) - case fd.IsMap(): - return newMapConverter(t, fd) - default: - return newSingularConverter(t, fd) - } - panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName())) -} - -var ( - boolType = reflect.TypeOf(bool(false)) - int32Type = reflect.TypeOf(int32(0)) - int64Type = reflect.TypeOf(int64(0)) - uint32Type = reflect.TypeOf(uint32(0)) - uint64Type = reflect.TypeOf(uint64(0)) - float32Type = reflect.TypeOf(float32(0)) - float64Type = reflect.TypeOf(float64(0)) - stringType = reflect.TypeOf(string("")) - bytesType = reflect.TypeOf([]byte(nil)) - byteType = reflect.TypeOf(byte(0)) -) - -var ( - boolZero = pref.ValueOfBool(false) - int32Zero = pref.ValueOfInt32(0) - int64Zero = pref.ValueOfInt64(0) - uint32Zero = pref.ValueOfUint32(0) - uint64Zero = pref.ValueOfUint64(0) - float32Zero = pref.ValueOfFloat32(0) - float64Zero = pref.ValueOfFloat64(0) - stringZero = pref.ValueOfString("") - bytesZero = pref.ValueOfBytes(nil) -) - -func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter { - defVal := func(fd pref.FieldDescriptor, zero pref.Value) pref.Value { - if fd.Cardinality() == pref.Repeated { - // Default isn't defined for repeated fields. - return zero - } - return fd.Default() - } - switch fd.Kind() { - case pref.BoolKind: - if t.Kind() == reflect.Bool { - return &boolConverter{t, defVal(fd, boolZero)} - } - case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind: - if t.Kind() == reflect.Int32 { - return &int32Converter{t, defVal(fd, int32Zero)} - } - case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind: - if t.Kind() == reflect.Int64 { - return &int64Converter{t, defVal(fd, int64Zero)} - } - case pref.Uint32Kind, pref.Fixed32Kind: - if t.Kind() == reflect.Uint32 { - return &uint32Converter{t, defVal(fd, uint32Zero)} - } - case pref.Uint64Kind, pref.Fixed64Kind: - if t.Kind() == reflect.Uint64 { - return &uint64Converter{t, defVal(fd, uint64Zero)} - } - case pref.FloatKind: - if t.Kind() == reflect.Float32 { - return &float32Converter{t, defVal(fd, float32Zero)} - } - case pref.DoubleKind: - if t.Kind() == reflect.Float64 { - return &float64Converter{t, defVal(fd, float64Zero)} - } - case pref.StringKind: - if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) { - return &stringConverter{t, defVal(fd, stringZero)} - } - case pref.BytesKind: - if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) { - return &bytesConverter{t, defVal(fd, bytesZero)} - } - case pref.EnumKind: - // Handle enums, which must be a named int32 type. - if t.Kind() == reflect.Int32 { - return newEnumConverter(t, fd) - } - case pref.MessageKind, pref.GroupKind: - return newMessageConverter(t) - } - panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName())) -} - -type boolConverter struct { - goType reflect.Type - def pref.Value -} - -func (c *boolConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfBool(v.Bool()) -} -func (c *boolConverter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(v.Bool()).Convert(c.goType) -} -func (c *boolConverter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(bool) - return ok -} -func (c *boolConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *boolConverter) New() pref.Value { return c.def } -func (c *boolConverter) Zero() pref.Value { return c.def } - -type int32Converter struct { - goType reflect.Type - def pref.Value -} - -func (c *int32Converter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfInt32(int32(v.Int())) -} -func (c *int32Converter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(int32(v.Int())).Convert(c.goType) -} -func (c *int32Converter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(int32) - return ok -} -func (c *int32Converter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *int32Converter) New() pref.Value { return c.def } -func (c *int32Converter) Zero() pref.Value { return c.def } - -type int64Converter struct { - goType reflect.Type - def pref.Value -} - -func (c *int64Converter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfInt64(int64(v.Int())) -} -func (c *int64Converter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(int64(v.Int())).Convert(c.goType) -} -func (c *int64Converter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(int64) - return ok -} -func (c *int64Converter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *int64Converter) New() pref.Value { return c.def } -func (c *int64Converter) Zero() pref.Value { return c.def } - -type uint32Converter struct { - goType reflect.Type - def pref.Value -} - -func (c *uint32Converter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfUint32(uint32(v.Uint())) -} -func (c *uint32Converter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType) -} -func (c *uint32Converter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(uint32) - return ok -} -func (c *uint32Converter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *uint32Converter) New() pref.Value { return c.def } -func (c *uint32Converter) Zero() pref.Value { return c.def } - -type uint64Converter struct { - goType reflect.Type - def pref.Value -} - -func (c *uint64Converter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfUint64(uint64(v.Uint())) -} -func (c *uint64Converter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType) -} -func (c *uint64Converter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(uint64) - return ok -} -func (c *uint64Converter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *uint64Converter) New() pref.Value { return c.def } -func (c *uint64Converter) Zero() pref.Value { return c.def } - -type float32Converter struct { - goType reflect.Type - def pref.Value -} - -func (c *float32Converter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfFloat32(float32(v.Float())) -} -func (c *float32Converter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(float32(v.Float())).Convert(c.goType) -} -func (c *float32Converter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(float32) - return ok -} -func (c *float32Converter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *float32Converter) New() pref.Value { return c.def } -func (c *float32Converter) Zero() pref.Value { return c.def } - -type float64Converter struct { - goType reflect.Type - def pref.Value -} - -func (c *float64Converter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfFloat64(float64(v.Float())) -} -func (c *float64Converter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(float64(v.Float())).Convert(c.goType) -} -func (c *float64Converter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(float64) - return ok -} -func (c *float64Converter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *float64Converter) New() pref.Value { return c.def } -func (c *float64Converter) Zero() pref.Value { return c.def } - -type stringConverter struct { - goType reflect.Type - def pref.Value -} - -func (c *stringConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfString(v.Convert(stringType).String()) -} -func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value { - // pref.Value.String never panics, so we go through an interface - // conversion here to check the type. - s := v.Interface().(string) - if c.goType.Kind() == reflect.Slice && s == "" { - return reflect.Zero(c.goType) // ensure empty string is []byte(nil) - } - return reflect.ValueOf(s).Convert(c.goType) -} -func (c *stringConverter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(string) - return ok -} -func (c *stringConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *stringConverter) New() pref.Value { return c.def } -func (c *stringConverter) Zero() pref.Value { return c.def } - -type bytesConverter struct { - goType reflect.Type - def pref.Value -} - -func (c *bytesConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - if c.goType.Kind() == reflect.String && v.Len() == 0 { - return pref.ValueOfBytes(nil) // ensure empty string is []byte(nil) - } - return pref.ValueOfBytes(v.Convert(bytesType).Bytes()) -} -func (c *bytesConverter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(v.Bytes()).Convert(c.goType) -} -func (c *bytesConverter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().([]byte) - return ok -} -func (c *bytesConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} -func (c *bytesConverter) New() pref.Value { return c.def } -func (c *bytesConverter) Zero() pref.Value { return c.def } - -type enumConverter struct { - goType reflect.Type - def pref.Value -} - -func newEnumConverter(goType reflect.Type, fd pref.FieldDescriptor) Converter { - var def pref.Value - if fd.Cardinality() == pref.Repeated { - def = pref.ValueOfEnum(fd.Enum().Values().Get(0).Number()) - } else { - def = fd.Default() - } - return &enumConverter{goType, def} -} - -func (c *enumConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfEnum(pref.EnumNumber(v.Int())) -} - -func (c *enumConverter) GoValueOf(v pref.Value) reflect.Value { - return reflect.ValueOf(v.Enum()).Convert(c.goType) -} - -func (c *enumConverter) IsValidPB(v pref.Value) bool { - _, ok := v.Interface().(pref.EnumNumber) - return ok -} - -func (c *enumConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} - -func (c *enumConverter) New() pref.Value { - return c.def -} - -func (c *enumConverter) Zero() pref.Value { - return c.def -} - -type messageConverter struct { - goType reflect.Type -} - -func newMessageConverter(goType reflect.Type) Converter { - return &messageConverter{goType} -} - -func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - if m, ok := v.Interface().(pref.ProtoMessage); ok { - return pref.ValueOfMessage(m.ProtoReflect()) - } - return pref.ValueOfMessage(legacyWrapMessage(v)) -} - -func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value { - m := v.Message() - var rv reflect.Value - if u, ok := m.(unwrapper); ok { - rv = reflect.ValueOf(u.protoUnwrap()) - } else { - rv = reflect.ValueOf(m.Interface()) - } - if rv.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), c.goType)) - } - return rv -} - -func (c *messageConverter) IsValidPB(v pref.Value) bool { - m := v.Message() - var rv reflect.Value - if u, ok := m.(unwrapper); ok { - rv = reflect.ValueOf(u.protoUnwrap()) - } else { - rv = reflect.ValueOf(m.Interface()) - } - return rv.Type() == c.goType -} - -func (c *messageConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} - -func (c *messageConverter) New() pref.Value { - return c.PBValueOf(reflect.New(c.goType.Elem())) -} - -func (c *messageConverter) Zero() pref.Value { - return c.PBValueOf(reflect.Zero(c.goType)) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go b/vendor/google.golang.org/protobuf/internal/impl/convert_list.go deleted file mode 100644 index 6fccab520..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -func newListConverter(t reflect.Type, fd pref.FieldDescriptor) Converter { - switch { - case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice: - return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)} - case t.Kind() == reflect.Slice: - return &listConverter{t, newSingularConverter(t.Elem(), fd)} - } - panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName())) -} - -type listConverter struct { - goType reflect.Type // []T - c Converter -} - -func (c *listConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - pv := reflect.New(c.goType) - pv.Elem().Set(v) - return pref.ValueOfList(&listReflect{pv, c.c}) -} - -func (c *listConverter) GoValueOf(v pref.Value) reflect.Value { - rv := v.List().(*listReflect).v - if rv.IsNil() { - return reflect.Zero(c.goType) - } - return rv.Elem() -} - -func (c *listConverter) IsValidPB(v pref.Value) bool { - list, ok := v.Interface().(*listReflect) - if !ok { - return false - } - return list.v.Type().Elem() == c.goType -} - -func (c *listConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} - -func (c *listConverter) New() pref.Value { - return pref.ValueOfList(&listReflect{reflect.New(c.goType), c.c}) -} - -func (c *listConverter) Zero() pref.Value { - return pref.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c}) -} - -type listPtrConverter struct { - goType reflect.Type // *[]T - c Converter -} - -func (c *listPtrConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfList(&listReflect{v, c.c}) -} - -func (c *listPtrConverter) GoValueOf(v pref.Value) reflect.Value { - return v.List().(*listReflect).v -} - -func (c *listPtrConverter) IsValidPB(v pref.Value) bool { - list, ok := v.Interface().(*listReflect) - if !ok { - return false - } - return list.v.Type() == c.goType -} - -func (c *listPtrConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} - -func (c *listPtrConverter) New() pref.Value { - return c.PBValueOf(reflect.New(c.goType.Elem())) -} - -func (c *listPtrConverter) Zero() pref.Value { - return c.PBValueOf(reflect.Zero(c.goType)) -} - -type listReflect struct { - v reflect.Value // *[]T - conv Converter -} - -func (ls *listReflect) Len() int { - if ls.v.IsNil() { - return 0 - } - return ls.v.Elem().Len() -} -func (ls *listReflect) Get(i int) pref.Value { - return ls.conv.PBValueOf(ls.v.Elem().Index(i)) -} -func (ls *listReflect) Set(i int, v pref.Value) { - ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v)) -} -func (ls *listReflect) Append(v pref.Value) { - ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v))) -} -func (ls *listReflect) AppendMutable() pref.Value { - if _, ok := ls.conv.(*messageConverter); !ok { - panic("invalid AppendMutable on list with non-message type") - } - v := ls.NewElement() - ls.Append(v) - return v -} -func (ls *listReflect) Truncate(i int) { - ls.v.Elem().Set(ls.v.Elem().Slice(0, i)) -} -func (ls *listReflect) NewElement() pref.Value { - return ls.conv.New() -} -func (ls *listReflect) IsValid() bool { - return !ls.v.IsNil() -} -func (ls *listReflect) protoUnwrap() interface{} { - return ls.v.Interface() -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go deleted file mode 100644 index de06b2593..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type mapConverter struct { - goType reflect.Type // map[K]V - keyConv, valConv Converter -} - -func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter { - if t.Kind() != reflect.Map { - panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName())) - } - return &mapConverter{ - goType: t, - keyConv: newSingularConverter(t.Key(), fd.MapKey()), - valConv: newSingularConverter(t.Elem(), fd.MapValue()), - } -} - -func (c *mapConverter) PBValueOf(v reflect.Value) pref.Value { - if v.Type() != c.goType { - panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) - } - return pref.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv}) -} - -func (c *mapConverter) GoValueOf(v pref.Value) reflect.Value { - return v.Map().(*mapReflect).v -} - -func (c *mapConverter) IsValidPB(v pref.Value) bool { - mapv, ok := v.Interface().(*mapReflect) - if !ok { - return false - } - return mapv.v.Type() == c.goType -} - -func (c *mapConverter) IsValidGo(v reflect.Value) bool { - return v.IsValid() && v.Type() == c.goType -} - -func (c *mapConverter) New() pref.Value { - return c.PBValueOf(reflect.MakeMap(c.goType)) -} - -func (c *mapConverter) Zero() pref.Value { - return c.PBValueOf(reflect.Zero(c.goType)) -} - -type mapReflect struct { - v reflect.Value // map[K]V - keyConv Converter - valConv Converter -} - -func (ms *mapReflect) Len() int { - return ms.v.Len() -} -func (ms *mapReflect) Has(k pref.MapKey) bool { - rk := ms.keyConv.GoValueOf(k.Value()) - rv := ms.v.MapIndex(rk) - return rv.IsValid() -} -func (ms *mapReflect) Get(k pref.MapKey) pref.Value { - rk := ms.keyConv.GoValueOf(k.Value()) - rv := ms.v.MapIndex(rk) - if !rv.IsValid() { - return pref.Value{} - } - return ms.valConv.PBValueOf(rv) -} -func (ms *mapReflect) Set(k pref.MapKey, v pref.Value) { - rk := ms.keyConv.GoValueOf(k.Value()) - rv := ms.valConv.GoValueOf(v) - ms.v.SetMapIndex(rk, rv) -} -func (ms *mapReflect) Clear(k pref.MapKey) { - rk := ms.keyConv.GoValueOf(k.Value()) - ms.v.SetMapIndex(rk, reflect.Value{}) -} -func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value { - if _, ok := ms.valConv.(*messageConverter); !ok { - panic("invalid Mutable on map with non-message value type") - } - v := ms.Get(k) - if !v.IsValid() { - v = ms.NewValue() - ms.Set(k, v) - } - return v -} -func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) { - iter := mapRange(ms.v) - for iter.Next() { - k := ms.keyConv.PBValueOf(iter.Key()).MapKey() - v := ms.valConv.PBValueOf(iter.Value()) - if !f(k, v) { - return - } - } -} -func (ms *mapReflect) NewValue() pref.Value { - return ms.valConv.New() -} -func (ms *mapReflect) IsValid() bool { - return !ms.v.IsNil() -} -func (ms *mapReflect) protoUnwrap() interface{} { - return ms.v.Interface() -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/decode.go b/vendor/google.golang.org/protobuf/internal/impl/decode.go deleted file mode 100644 index 85ba1d3b3..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/decode.go +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "math/bits" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoiface" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -type unmarshalOptions struct { - flags protoiface.UnmarshalInputFlags - resolver interface { - FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) - FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) - } -} - -func (o unmarshalOptions) Options() proto.UnmarshalOptions { - return proto.UnmarshalOptions{ - Merge: true, - AllowPartial: true, - DiscardUnknown: o.DiscardUnknown(), - Resolver: o.resolver, - } -} - -func (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 } - -func (o unmarshalOptions) IsDefault() bool { - return o.flags == 0 && o.resolver == preg.GlobalTypes -} - -var lazyUnmarshalOptions = unmarshalOptions{ - resolver: preg.GlobalTypes, -} - -type unmarshalOutput struct { - n int // number of bytes consumed - initialized bool -} - -// unmarshal is protoreflect.Methods.Unmarshal. -func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) { - var p pointer - if ms, ok := in.Message.(*messageState); ok { - p = ms.pointer() - } else { - p = in.Message.(*messageReflectWrapper).pointer() - } - out, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{ - flags: in.Flags, - resolver: in.Resolver, - }) - var flags piface.UnmarshalOutputFlags - if out.initialized { - flags |= piface.UnmarshalInitialized - } - return piface.UnmarshalOutput{ - Flags: flags, - }, err -} - -// errUnknown is returned during unmarshaling to indicate a parse error that -// should result in a field being placed in the unknown fields section (for example, -// when the wire type doesn't match) as opposed to the entire unmarshal operation -// failing (for example, when a field extends past the available input). -// -// This is a sentinel error which should never be visible to the user. -var errUnknown = errors.New("unknown") - -func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) { - mi.init() - if flags.ProtoLegacy && mi.isMessageSet { - return unmarshalMessageSet(mi, b, p, opts) - } - initialized := true - var requiredMask uint64 - var exts *map[int32]ExtensionField - start := len(b) - for len(b) > 0 { - // Parse the tag (field number and wire type). - var tag uint64 - if b[0] < 0x80 { - tag = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - tag = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - tag, n = protowire.ConsumeVarint(b) - if n < 0 { - return out, protowire.ParseError(n) - } - b = b[n:] - } - var num protowire.Number - if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) { - return out, errors.New("invalid field number") - } else { - num = protowire.Number(n) - } - wtyp := protowire.Type(tag & 7) - - if wtyp == protowire.EndGroupType { - if num != groupTag { - return out, errors.New("mismatching end group marker") - } - groupTag = 0 - break - } - - var f *coderFieldInfo - if int(num) < len(mi.denseCoderFields) { - f = mi.denseCoderFields[num] - } else { - f = mi.coderFields[num] - } - var n int - err := errUnknown - switch { - case f != nil: - if f.funcs.unmarshal == nil { - break - } - var o unmarshalOutput - o, err = f.funcs.unmarshal(b, p.Apply(f.offset), wtyp, f, opts) - n = o.n - if err != nil { - break - } - requiredMask |= f.validation.requiredBit - if f.funcs.isInit != nil && !o.initialized { - initialized = false - } - default: - // Possible extension. - if exts == nil && mi.extensionOffset.IsValid() { - exts = p.Apply(mi.extensionOffset).Extensions() - if *exts == nil { - *exts = make(map[int32]ExtensionField) - } - } - if exts == nil { - break - } - var o unmarshalOutput - o, err = mi.unmarshalExtension(b, num, wtyp, *exts, opts) - if err != nil { - break - } - n = o.n - if !o.initialized { - initialized = false - } - } - if err != nil { - if err != errUnknown { - return out, err - } - n = protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return out, protowire.ParseError(n) - } - if !opts.DiscardUnknown() && mi.unknownOffset.IsValid() { - u := p.Apply(mi.unknownOffset).Bytes() - *u = protowire.AppendTag(*u, num, wtyp) - *u = append(*u, b[:n]...) - } - } - b = b[n:] - } - if groupTag != 0 { - return out, errors.New("missing end group marker") - } - if mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) { - initialized = false - } - if initialized { - out.initialized = true - } - out.n = start - len(b) - return out, nil -} - -func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp protowire.Type, exts map[int32]ExtensionField, opts unmarshalOptions) (out unmarshalOutput, err error) { - x := exts[int32(num)] - xt := x.Type() - if xt == nil { - var err error - xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num) - if err != nil { - if err == preg.NotFound { - return out, errUnknown - } - return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err) - } - } - xi := getExtensionFieldInfo(xt) - if xi.funcs.unmarshal == nil { - return out, errUnknown - } - if flags.LazyUnmarshalExtensions { - if opts.IsDefault() && x.canLazy(xt) { - out, valid := skipExtension(b, xi, num, wtyp, opts) - switch valid { - case ValidationValid: - if out.initialized { - x.appendLazyBytes(xt, xi, num, wtyp, b[:out.n]) - exts[int32(num)] = x - return out, nil - } - case ValidationInvalid: - return out, errors.New("invalid wire format") - case ValidationUnknown: - } - } - } - ival := x.Value() - if !ival.IsValid() && xi.unmarshalNeedsValue { - // Create a new message, list, or map value to fill in. - // For enums, create a prototype value to let the unmarshal func know the - // concrete type. - ival = xt.New() - } - v, out, err := xi.funcs.unmarshal(b, ival, num, wtyp, opts) - if err != nil { - return out, err - } - if xi.funcs.isInit == nil { - out.initialized = true - } - x.Set(xt, v) - exts[int32(num)] = x - return out, nil -} - -func skipExtension(b []byte, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) { - if xi.validation.mi == nil { - return out, ValidationUnknown - } - xi.validation.mi.init() - switch xi.validation.typ { - case validationTypeMessage: - if wtyp != protowire.BytesType { - return out, ValidationUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, ValidationUnknown - } - out, st := xi.validation.mi.validate(v, 0, opts) - out.n = n - return out, st - case validationTypeGroup: - if wtyp != protowire.StartGroupType { - return out, ValidationUnknown - } - out, st := xi.validation.mi.validate(b, num, opts) - return out, st - default: - return out, ValidationUnknown - } -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go deleted file mode 100644 index 8c8a794c6..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/encode.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "math" - "sort" - "sync/atomic" - - "google.golang.org/protobuf/internal/flags" - proto "google.golang.org/protobuf/proto" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -type marshalOptions struct { - flags piface.MarshalInputFlags -} - -func (o marshalOptions) Options() proto.MarshalOptions { - return proto.MarshalOptions{ - AllowPartial: true, - Deterministic: o.Deterministic(), - UseCachedSize: o.UseCachedSize(), - } -} - -func (o marshalOptions) Deterministic() bool { return o.flags&piface.MarshalDeterministic != 0 } -func (o marshalOptions) UseCachedSize() bool { return o.flags&piface.MarshalUseCachedSize != 0 } - -// size is protoreflect.Methods.Size. -func (mi *MessageInfo) size(in piface.SizeInput) piface.SizeOutput { - var p pointer - if ms, ok := in.Message.(*messageState); ok { - p = ms.pointer() - } else { - p = in.Message.(*messageReflectWrapper).pointer() - } - size := mi.sizePointer(p, marshalOptions{ - flags: in.Flags, - }) - return piface.SizeOutput{Size: size} -} - -func (mi *MessageInfo) sizePointer(p pointer, opts marshalOptions) (size int) { - mi.init() - if p.IsNil() { - return 0 - } - if opts.UseCachedSize() && mi.sizecacheOffset.IsValid() { - if size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size >= 0 { - return int(size) - } - } - return mi.sizePointerSlow(p, opts) -} - -func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int) { - if flags.ProtoLegacy && mi.isMessageSet { - size = sizeMessageSet(mi, p, opts) - if mi.sizecacheOffset.IsValid() { - atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size)) - } - return size - } - if mi.extensionOffset.IsValid() { - e := p.Apply(mi.extensionOffset).Extensions() - size += mi.sizeExtensions(e, opts) - } - for _, f := range mi.orderedCoderFields { - if f.funcs.size == nil { - continue - } - fptr := p.Apply(f.offset) - if f.isPointer && fptr.Elem().IsNil() { - continue - } - size += f.funcs.size(fptr, f, opts) - } - if mi.unknownOffset.IsValid() { - u := *p.Apply(mi.unknownOffset).Bytes() - size += len(u) - } - if mi.sizecacheOffset.IsValid() { - if size > math.MaxInt32 { - // The size is too large for the int32 sizecache field. - // We will need to recompute the size when encoding; - // unfortunately expensive, but better than invalid output. - atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), -1) - } else { - atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size)) - } - } - return size -} - -// marshal is protoreflect.Methods.Marshal. -func (mi *MessageInfo) marshal(in piface.MarshalInput) (out piface.MarshalOutput, err error) { - var p pointer - if ms, ok := in.Message.(*messageState); ok { - p = ms.pointer() - } else { - p = in.Message.(*messageReflectWrapper).pointer() - } - b, err := mi.marshalAppendPointer(in.Buf, p, marshalOptions{ - flags: in.Flags, - }) - return piface.MarshalOutput{Buf: b}, err -} - -func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOptions) ([]byte, error) { - mi.init() - if p.IsNil() { - return b, nil - } - if flags.ProtoLegacy && mi.isMessageSet { - return marshalMessageSet(mi, b, p, opts) - } - var err error - // The old marshaler encodes extensions at beginning. - if mi.extensionOffset.IsValid() { - e := p.Apply(mi.extensionOffset).Extensions() - // TODO: Special handling for MessageSet? - b, err = mi.appendExtensions(b, e, opts) - if err != nil { - return b, err - } - } - for _, f := range mi.orderedCoderFields { - if f.funcs.marshal == nil { - continue - } - fptr := p.Apply(f.offset) - if f.isPointer && fptr.Elem().IsNil() { - continue - } - b, err = f.funcs.marshal(b, fptr, f, opts) - if err != nil { - return b, err - } - } - if mi.unknownOffset.IsValid() && !mi.isMessageSet { - u := *p.Apply(mi.unknownOffset).Bytes() - b = append(b, u...) - } - return b, nil -} - -func (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marshalOptions) (n int) { - if ext == nil { - return 0 - } - for _, x := range *ext { - xi := getExtensionFieldInfo(x.Type()) - if xi.funcs.size == nil { - continue - } - n += xi.funcs.size(x.Value(), xi.tagsize, opts) - } - return n -} - -func (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField, opts marshalOptions) ([]byte, error) { - if ext == nil { - return b, nil - } - - switch len(*ext) { - case 0: - return b, nil - case 1: - // Fast-path for one extension: Don't bother sorting the keys. - var err error - for _, x := range *ext { - xi := getExtensionFieldInfo(x.Type()) - b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts) - } - return b, err - default: - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(*ext)) - for k := range *ext { - keys = append(keys, int(k)) - } - sort.Ints(keys) - var err error - for _, k := range keys { - x := (*ext)[int32(k)] - xi := getExtensionFieldInfo(x.Type()) - b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts) - if err != nil { - return b, err - } - } - return b, nil - } -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/enum.go b/vendor/google.golang.org/protobuf/internal/impl/enum.go deleted file mode 100644 index 8c1eab4bf..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/enum.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "reflect" - - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type EnumInfo struct { - GoReflectType reflect.Type // int32 kind - Desc pref.EnumDescriptor -} - -func (t *EnumInfo) New(n pref.EnumNumber) pref.Enum { - return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum) -} -func (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc } diff --git a/vendor/google.golang.org/protobuf/internal/impl/extension.go b/vendor/google.golang.org/protobuf/internal/impl/extension.go deleted file mode 100644 index e904fd993..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/extension.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "reflect" - "sync" - "sync/atomic" - - pref "google.golang.org/protobuf/reflect/protoreflect" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -// ExtensionInfo implements ExtensionType. -// -// This type contains a number of exported fields for legacy compatibility. -// The only non-deprecated use of this type is through the methods of the -// ExtensionType interface. -type ExtensionInfo struct { - // An ExtensionInfo may exist in several stages of initialization. - // - // extensionInfoUninitialized: Some or all of the legacy exported - // fields may be set, but none of the unexported fields have been - // initialized. This is the starting state for an ExtensionInfo - // in legacy generated code. - // - // extensionInfoDescInit: The desc field is set, but other unexported fields - // may not be initialized. Legacy exported fields may or may not be set. - // This is the starting state for an ExtensionInfo in newly generated code. - // - // extensionInfoFullInit: The ExtensionInfo is fully initialized. - // This state is only entered after lazy initialization is complete. - init uint32 - mu sync.Mutex - - goType reflect.Type - desc extensionTypeDescriptor - conv Converter - info *extensionFieldInfo // for fast-path method implementations - - // ExtendedType is a typed nil-pointer to the parent message type that - // is being extended. It is possible for this to be unpopulated in v2 - // since the message may no longer implement the MessageV1 interface. - // - // Deprecated: Use the ExtendedType method instead. - ExtendedType piface.MessageV1 - - // ExtensionType is the zero value of the extension type. - // - // For historical reasons, reflect.TypeOf(ExtensionType) and the - // type returned by InterfaceOf may not be identical. - // - // Deprecated: Use InterfaceOf(xt.Zero()) instead. - ExtensionType interface{} - - // Field is the field number of the extension. - // - // Deprecated: Use the Descriptor().Number method instead. - Field int32 - - // Name is the fully qualified name of extension. - // - // Deprecated: Use the Descriptor().FullName method instead. - Name string - - // Tag is the protobuf struct tag used in the v1 API. - // - // Deprecated: Do not use. - Tag string - - // Filename is the proto filename in which the extension is defined. - // - // Deprecated: Use Descriptor().ParentFile().Path() instead. - Filename string -} - -// Stages of initialization: See the ExtensionInfo.init field. -const ( - extensionInfoUninitialized = 0 - extensionInfoDescInit = 1 - extensionInfoFullInit = 2 -) - -func InitExtensionInfo(xi *ExtensionInfo, xd pref.ExtensionDescriptor, goType reflect.Type) { - xi.goType = goType - xi.desc = extensionTypeDescriptor{xd, xi} - xi.init = extensionInfoDescInit -} - -func (xi *ExtensionInfo) New() pref.Value { - return xi.lazyInit().New() -} -func (xi *ExtensionInfo) Zero() pref.Value { - return xi.lazyInit().Zero() -} -func (xi *ExtensionInfo) ValueOf(v interface{}) pref.Value { - return xi.lazyInit().PBValueOf(reflect.ValueOf(v)) -} -func (xi *ExtensionInfo) InterfaceOf(v pref.Value) interface{} { - return xi.lazyInit().GoValueOf(v).Interface() -} -func (xi *ExtensionInfo) IsValidValue(v pref.Value) bool { - return xi.lazyInit().IsValidPB(v) -} -func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool { - return xi.lazyInit().IsValidGo(reflect.ValueOf(v)) -} -func (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor { - if atomic.LoadUint32(&xi.init) < extensionInfoDescInit { - xi.lazyInitSlow() - } - return &xi.desc -} - -func (xi *ExtensionInfo) lazyInit() Converter { - if atomic.LoadUint32(&xi.init) < extensionInfoFullInit { - xi.lazyInitSlow() - } - return xi.conv -} - -func (xi *ExtensionInfo) lazyInitSlow() { - xi.mu.Lock() - defer xi.mu.Unlock() - - if xi.init == extensionInfoFullInit { - return - } - defer atomic.StoreUint32(&xi.init, extensionInfoFullInit) - - if xi.desc.ExtensionDescriptor == nil { - xi.initFromLegacy() - } - if !xi.desc.ExtensionDescriptor.IsPlaceholder() { - if xi.ExtensionType == nil { - xi.initToLegacy() - } - xi.conv = NewConverter(xi.goType, xi.desc.ExtensionDescriptor) - xi.info = makeExtensionFieldInfo(xi.desc.ExtensionDescriptor) - xi.info.validation = newValidationInfo(xi.desc.ExtensionDescriptor, xi.goType) - } -} - -type extensionTypeDescriptor struct { - pref.ExtensionDescriptor - xi *ExtensionInfo -} - -func (xtd *extensionTypeDescriptor) Type() pref.ExtensionType { - return xtd.xi -} -func (xtd *extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor { - return xtd.ExtensionDescriptor -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go deleted file mode 100644 index f7d7ffb51..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - "strings" - "sync" - - "google.golang.org/protobuf/internal/filedesc" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/reflect/protoreflect" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// legacyEnumName returns the name of enums used in legacy code. -// It is neither the protobuf full name nor the qualified Go name, -// but rather an odd hybrid of both. -func legacyEnumName(ed pref.EnumDescriptor) string { - var protoPkg string - enumName := string(ed.FullName()) - if fd := ed.ParentFile(); fd != nil { - protoPkg = string(fd.Package()) - enumName = strings.TrimPrefix(enumName, protoPkg+".") - } - if protoPkg == "" { - return strs.GoCamelCase(enumName) - } - return protoPkg + "." + strs.GoCamelCase(enumName) -} - -// legacyWrapEnum wraps v as a protoreflect.Enum, -// where v must be a int32 kind and not implement the v2 API already. -func legacyWrapEnum(v reflect.Value) pref.Enum { - et := legacyLoadEnumType(v.Type()) - return et.New(pref.EnumNumber(v.Int())) -} - -var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType - -// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t, -// where t must be an int32 kind and not implement the v2 API already. -func legacyLoadEnumType(t reflect.Type) pref.EnumType { - // Fast-path: check if a EnumType is cached for this concrete type. - if et, ok := legacyEnumTypeCache.Load(t); ok { - return et.(pref.EnumType) - } - - // Slow-path: derive enum descriptor and initialize EnumType. - var et pref.EnumType - ed := LegacyLoadEnumDesc(t) - et = &legacyEnumType{ - desc: ed, - goType: t, - } - if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok { - return et.(pref.EnumType) - } - return et -} - -type legacyEnumType struct { - desc pref.EnumDescriptor - goType reflect.Type - m sync.Map // map[protoreflect.EnumNumber]proto.Enum -} - -func (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum { - if e, ok := t.m.Load(n); ok { - return e.(pref.Enum) - } - e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType} - t.m.Store(n, e) - return e -} -func (t *legacyEnumType) Descriptor() pref.EnumDescriptor { - return t.desc -} - -type legacyEnumWrapper struct { - num pref.EnumNumber - pbTyp pref.EnumType - goTyp reflect.Type -} - -func (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor { - return e.pbTyp.Descriptor() -} -func (e *legacyEnumWrapper) Type() pref.EnumType { - return e.pbTyp -} -func (e *legacyEnumWrapper) Number() pref.EnumNumber { - return e.num -} -func (e *legacyEnumWrapper) ProtoReflect() pref.Enum { - return e -} -func (e *legacyEnumWrapper) protoUnwrap() interface{} { - v := reflect.New(e.goTyp).Elem() - v.SetInt(int64(e.num)) - return v.Interface() -} - -var ( - _ pref.Enum = (*legacyEnumWrapper)(nil) - _ unwrapper = (*legacyEnumWrapper)(nil) -) - -var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor - -// LegacyLoadEnumDesc returns an EnumDescriptor derived from the Go type, -// which must be an int32 kind and not implement the v2 API already. -// -// This is exported for testing purposes. -func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor { - // Fast-path: check if an EnumDescriptor is cached for this concrete type. - if ed, ok := legacyEnumDescCache.Load(t); ok { - return ed.(pref.EnumDescriptor) - } - - // Slow-path: initialize EnumDescriptor from the raw descriptor. - ev := reflect.Zero(t).Interface() - if _, ok := ev.(pref.Enum); ok { - panic(fmt.Sprintf("%v already implements proto.Enum", t)) - } - edV1, ok := ev.(enumV1) - if !ok { - return aberrantLoadEnumDesc(t) - } - b, idxs := edV1.EnumDescriptor() - - var ed pref.EnumDescriptor - if len(idxs) == 1 { - ed = legacyLoadFileDesc(b).Enums().Get(idxs[0]) - } else { - md := legacyLoadFileDesc(b).Messages().Get(idxs[0]) - for _, i := range idxs[1 : len(idxs)-1] { - md = md.Messages().Get(i) - } - ed = md.Enums().Get(idxs[len(idxs)-1]) - } - if ed, ok := legacyEnumDescCache.LoadOrStore(t, ed); ok { - return ed.(protoreflect.EnumDescriptor) - } - return ed -} - -var aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor - -// aberrantLoadEnumDesc returns an EnumDescriptor derived from the Go type, -// which must not implement protoreflect.Enum or enumV1. -// -// If the type does not implement enumV1, then there is no reliable -// way to derive the original protobuf type information. -// We are unable to use the global enum registry since it is -// unfortunately keyed by the protobuf full name, which we also do not know. -// Thus, this produces some bogus enum descriptor based on the Go type name. -func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor { - // Fast-path: check if an EnumDescriptor is cached for this concrete type. - if ed, ok := aberrantEnumDescCache.Load(t); ok { - return ed.(pref.EnumDescriptor) - } - - // Slow-path: construct a bogus, but unique EnumDescriptor. - ed := &filedesc.Enum{L2: new(filedesc.EnumL2)} - ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum - ed.L0.ParentFile = filedesc.SurrogateProto3 - ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{}) - - // TODO: Use the presence of a UnmarshalJSON method to determine proto2? - - vd := &ed.L2.Values.List[0] - vd.L0.FullName = ed.L0.FullName + "_UNKNOWN" // e.g., github_com.user.repo.MyEnum_UNKNOWN - vd.L0.ParentFile = ed.L0.ParentFile - vd.L0.Parent = ed - - // TODO: We could use the String method to obtain some enum value names by - // starting at 0 and print the enum until it produces invalid identifiers. - // An exhaustive query is clearly impractical, but can be best-effort. - - if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok { - return ed.(pref.EnumDescriptor) - } - return ed -} - -// AberrantDeriveFullName derives a fully qualified protobuf name for the given Go type -// The provided name is not guaranteed to be stable nor universally unique. -// It should be sufficiently unique within a program. -// -// This is exported for testing purposes. -func AberrantDeriveFullName(t reflect.Type) pref.FullName { - sanitize := func(r rune) rune { - switch { - case r == '/': - return '.' - case 'a' <= r && r <= 'z', 'A' <= r && r <= 'Z', '0' <= r && r <= '9': - return r - default: - return '_' - } - } - prefix := strings.Map(sanitize, t.PkgPath()) - suffix := strings.Map(sanitize, t.Name()) - if suffix == "" { - suffix = fmt.Sprintf("UnknownX%X", reflect.ValueOf(t).Pointer()) - } - - ss := append(strings.Split(prefix, "."), suffix) - for i, s := range ss { - if s == "" || ('0' <= s[0] && s[0] <= '9') { - ss[i] = "x" + s - } - } - return pref.FullName(strings.Join(ss, ".")) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go deleted file mode 100644 index c3d741c2f..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "encoding/binary" - "encoding/json" - "hash/crc32" - "math" - "reflect" - - "google.golang.org/protobuf/internal/errors" - pref "google.golang.org/protobuf/reflect/protoreflect" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -// These functions exist to support exported APIs in generated protobufs. -// While these are deprecated, they cannot be removed for compatibility reasons. - -// LegacyEnumName returns the name of enums used in legacy code. -func (Export) LegacyEnumName(ed pref.EnumDescriptor) string { - return legacyEnumName(ed) -} - -// LegacyMessageTypeOf returns the protoreflect.MessageType for m, -// with name used as the message name if necessary. -func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.MessageType { - if mv := (Export{}).protoMessageV2Of(m); mv != nil { - return mv.ProtoReflect().Type() - } - return legacyLoadMessageInfo(reflect.TypeOf(m), name) -} - -// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input. -// The input can either be a string representing the enum value by name, -// or a number representing the enum number itself. -func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumber, error) { - if b[0] == '"' { - var name pref.Name - if err := json.Unmarshal(b, &name); err != nil { - return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b) - } - ev := ed.Values().ByName(name) - if ev == nil { - return 0, errors.New("invalid value for enum %v: %s", ed.FullName(), name) - } - return ev.Number(), nil - } else { - var num pref.EnumNumber - if err := json.Unmarshal(b, &num); err != nil { - return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b) - } - return num, nil - } -} - -// CompressGZIP compresses the input as a GZIP-encoded file. -// The current implementation does no compression. -func (Export) CompressGZIP(in []byte) (out []byte) { - // RFC 1952, section 2.3.1. - var gzipHeader = [10]byte{0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff} - - // RFC 1951, section 3.2.4. - var blockHeader [5]byte - const maxBlockSize = math.MaxUint16 - numBlocks := 1 + len(in)/maxBlockSize - - // RFC 1952, section 2.3.1. - var gzipFooter [8]byte - binary.LittleEndian.PutUint32(gzipFooter[0:4], crc32.ChecksumIEEE(in)) - binary.LittleEndian.PutUint32(gzipFooter[4:8], uint32(len(in))) - - // Encode the input without compression using raw DEFLATE blocks. - out = make([]byte, 0, len(gzipHeader)+len(blockHeader)*numBlocks+len(in)+len(gzipFooter)) - out = append(out, gzipHeader[:]...) - for blockHeader[0] == 0 { - blockSize := maxBlockSize - if blockSize > len(in) { - blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3. - blockSize = len(in) - } - binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000) - binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff) - out = append(out, blockHeader[:]...) - out = append(out, in[:blockSize]...) - in = in[blockSize:] - } - out = append(out, gzipFooter[:]...) - return out -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go deleted file mode 100644 index 61757ce50..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "reflect" - - "google.golang.org/protobuf/internal/descopts" - "google.golang.org/protobuf/internal/encoding/messageset" - ptag "google.golang.org/protobuf/internal/encoding/tag" - "google.golang.org/protobuf/internal/filedesc" - "google.golang.org/protobuf/internal/pragma" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -func (xi *ExtensionInfo) initToLegacy() { - xd := xi.desc - var parent piface.MessageV1 - messageName := xd.ContainingMessage().FullName() - if mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil { - // Create a new parent message and unwrap it if possible. - mv := mt.New().Interface() - t := reflect.TypeOf(mv) - if mv, ok := mv.(unwrapper); ok { - t = reflect.TypeOf(mv.protoUnwrap()) - } - - // Check whether the message implements the legacy v1 Message interface. - mz := reflect.Zero(t).Interface() - if mz, ok := mz.(piface.MessageV1); ok { - parent = mz - } - } - - // Determine the v1 extension type, which is unfortunately not the same as - // the v2 ExtensionType.GoType. - extType := xi.goType - switch extType.Kind() { - case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - extType = reflect.PtrTo(extType) // T -> *T for singular scalar fields - } - - // Reconstruct the legacy enum full name. - var enumName string - if xd.Kind() == pref.EnumKind { - enumName = legacyEnumName(xd.Enum()) - } - - // Derive the proto file that the extension was declared within. - var filename string - if fd := xd.ParentFile(); fd != nil { - filename = fd.Path() - } - - // For MessageSet extensions, the name used is the parent message. - name := xd.FullName() - if messageset.IsMessageSetExtension(xd) { - name = name.Parent() - } - - xi.ExtendedType = parent - xi.ExtensionType = reflect.Zero(extType).Interface() - xi.Field = int32(xd.Number()) - xi.Name = string(name) - xi.Tag = ptag.Marshal(xd, enumName) - xi.Filename = filename -} - -// initFromLegacy initializes an ExtensionInfo from -// the contents of the deprecated exported fields of the type. -func (xi *ExtensionInfo) initFromLegacy() { - // The v1 API returns "type incomplete" descriptors where only the - // field number is specified. In such a case, use a placeholder. - if xi.ExtendedType == nil || xi.ExtensionType == nil { - xd := placeholderExtension{ - name: pref.FullName(xi.Name), - number: pref.FieldNumber(xi.Field), - } - xi.desc = extensionTypeDescriptor{xd, xi} - return - } - - // Resolve enum or message dependencies. - var ed pref.EnumDescriptor - var md pref.MessageDescriptor - t := reflect.TypeOf(xi.ExtensionType) - isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct - isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 - if isOptional || isRepeated { - t = t.Elem() - } - switch v := reflect.Zero(t).Interface().(type) { - case pref.Enum: - ed = v.Descriptor() - case enumV1: - ed = LegacyLoadEnumDesc(t) - case pref.ProtoMessage: - md = v.ProtoReflect().Descriptor() - case messageV1: - md = LegacyLoadMessageDesc(t) - } - - // Derive basic field information from the struct tag. - var evs pref.EnumValueDescriptors - if ed != nil { - evs = ed.Values() - } - fd := ptag.Unmarshal(xi.Tag, t, evs).(*filedesc.Field) - - // Construct a v2 ExtensionType. - xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)} - xd.L0.ParentFile = filedesc.SurrogateProto2 - xd.L0.FullName = pref.FullName(xi.Name) - xd.L1.Number = pref.FieldNumber(xi.Field) - xd.L1.Cardinality = fd.L1.Cardinality - xd.L1.Kind = fd.L1.Kind - xd.L2.IsPacked = fd.L1.IsPacked - xd.L2.Default = fd.L1.Default - xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType) - xd.L2.Enum = ed - xd.L2.Message = md - - // Derive real extension field name for MessageSets. - if messageset.IsMessageSet(xd.L1.Extendee) && md.FullName() == xd.L0.FullName { - xd.L0.FullName = xd.L0.FullName.Append(messageset.ExtensionName) - } - - tt := reflect.TypeOf(xi.ExtensionType) - if isOptional { - tt = tt.Elem() - } - xi.goType = tt - xi.desc = extensionTypeDescriptor{xd, xi} -} - -type placeholderExtension struct { - name pref.FullName - number pref.FieldNumber -} - -func (x placeholderExtension) ParentFile() pref.FileDescriptor { return nil } -func (x placeholderExtension) Parent() pref.Descriptor { return nil } -func (x placeholderExtension) Index() int { return 0 } -func (x placeholderExtension) Syntax() pref.Syntax { return 0 } -func (x placeholderExtension) Name() pref.Name { return x.name.Name() } -func (x placeholderExtension) FullName() pref.FullName { return x.name } -func (x placeholderExtension) IsPlaceholder() bool { return true } -func (x placeholderExtension) Options() pref.ProtoMessage { return descopts.Field } -func (x placeholderExtension) Number() pref.FieldNumber { return x.number } -func (x placeholderExtension) Cardinality() pref.Cardinality { return 0 } -func (x placeholderExtension) Kind() pref.Kind { return 0 } -func (x placeholderExtension) HasJSONName() bool { return false } -func (x placeholderExtension) JSONName() string { return "" } -func (x placeholderExtension) HasPresence() bool { return false } -func (x placeholderExtension) HasOptionalKeyword() bool { return false } -func (x placeholderExtension) IsExtension() bool { return true } -func (x placeholderExtension) IsWeak() bool { return false } -func (x placeholderExtension) IsPacked() bool { return false } -func (x placeholderExtension) IsList() bool { return false } -func (x placeholderExtension) IsMap() bool { return false } -func (x placeholderExtension) MapKey() pref.FieldDescriptor { return nil } -func (x placeholderExtension) MapValue() pref.FieldDescriptor { return nil } -func (x placeholderExtension) HasDefault() bool { return false } -func (x placeholderExtension) Default() pref.Value { return pref.Value{} } -func (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil } -func (x placeholderExtension) ContainingOneof() pref.OneofDescriptor { return nil } -func (x placeholderExtension) ContainingMessage() pref.MessageDescriptor { return nil } -func (x placeholderExtension) Enum() pref.EnumDescriptor { return nil } -func (x placeholderExtension) Message() pref.MessageDescriptor { return nil } -func (x placeholderExtension) ProtoType(pref.FieldDescriptor) { return } -func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return } diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go deleted file mode 100644 index 9ab091086..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "bytes" - "compress/gzip" - "io/ioutil" - "sync" - - "google.golang.org/protobuf/internal/filedesc" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -// Every enum and message type generated by protoc-gen-go since commit 2fc053c5 -// on February 25th, 2016 has had a method to get the raw descriptor. -// Types that were not generated by protoc-gen-go or were generated prior -// to that version are not supported. -// -// The []byte returned is the encoded form of a FileDescriptorProto message -// compressed using GZIP. The []int is the path from the top-level file -// to the specific message or enum declaration. -type ( - enumV1 interface { - EnumDescriptor() ([]byte, []int) - } - messageV1 interface { - Descriptor() ([]byte, []int) - } -) - -var legacyFileDescCache sync.Map // map[*byte]protoreflect.FileDescriptor - -// legacyLoadFileDesc unmarshals b as a compressed FileDescriptorProto message. -// -// This assumes that b is immutable and that b does not refer to part of a -// concatenated series of GZIP files (which would require shenanigans that -// rely on the concatenation properties of both protobufs and GZIP). -// File descriptors generated by protoc-gen-go do not rely on that property. -func legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor { - // Fast-path: check whether we already have a cached file descriptor. - if fd, ok := legacyFileDescCache.Load(&b[0]); ok { - return fd.(protoreflect.FileDescriptor) - } - - // Slow-path: decompress and unmarshal the file descriptor proto. - zr, err := gzip.NewReader(bytes.NewReader(b)) - if err != nil { - panic(err) - } - b2, err := ioutil.ReadAll(zr) - if err != nil { - panic(err) - } - - fd := filedesc.Builder{ - RawDescriptor: b2, - FileRegistry: resolverOnly{protoregistry.GlobalFiles}, // do not register back to global registry - }.Build().File - if fd, ok := legacyFileDescCache.LoadOrStore(&b[0], fd); ok { - return fd.(protoreflect.FileDescriptor) - } - return fd -} - -type resolverOnly struct { - reg *protoregistry.Files -} - -func (r resolverOnly) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { - return r.reg.FindFileByPath(path) -} -func (r resolverOnly) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) { - return r.reg.FindDescriptorByName(name) -} -func (resolverOnly) RegisterFile(protoreflect.FileDescriptor) error { - return nil -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go deleted file mode 100644 index 06c68e117..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - "strings" - "sync" - - "google.golang.org/protobuf/internal/descopts" - ptag "google.golang.org/protobuf/internal/encoding/tag" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/filedesc" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/reflect/protoreflect" - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -// legacyWrapMessage wraps v as a protoreflect.Message, -// where v must be a *struct kind and not implement the v2 API already. -func legacyWrapMessage(v reflect.Value) pref.Message { - typ := v.Type() - if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct { - return aberrantMessage{v: v} - } - mt := legacyLoadMessageInfo(typ, "") - return mt.MessageOf(v.Interface()) -} - -var legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo - -// legacyLoadMessageInfo dynamically loads a *MessageInfo for t, -// where t must be a *struct kind and not implement the v2 API already. -// The provided name is used if it cannot be determined from the message. -func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo { - // Fast-path: check if a MessageInfo is cached for this concrete type. - if mt, ok := legacyMessageTypeCache.Load(t); ok { - return mt.(*MessageInfo) - } - - // Slow-path: derive message descriptor and initialize MessageInfo. - mi := &MessageInfo{ - Desc: legacyLoadMessageDesc(t, name), - GoReflectType: t, - } - - v := reflect.Zero(t).Interface() - if _, ok := v.(legacyMarshaler); ok { - mi.methods.Marshal = legacyMarshal - - // We have no way to tell whether the type's Marshal method - // supports deterministic serialization or not, but this - // preserves the v1 implementation's behavior of always - // calling Marshal methods when present. - mi.methods.Flags |= piface.SupportMarshalDeterministic - } - if _, ok := v.(legacyUnmarshaler); ok { - mi.methods.Unmarshal = legacyUnmarshal - } - if _, ok := v.(legacyMerger); ok { - mi.methods.Merge = legacyMerge - } - - if mi, ok := legacyMessageTypeCache.LoadOrStore(t, mi); ok { - return mi.(*MessageInfo) - } - return mi -} - -var legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDescriptor - -// LegacyLoadMessageDesc returns an MessageDescriptor derived from the Go type, -// which must be a *struct kind and not implement the v2 API already. -// -// This is exported for testing purposes. -func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor { - return legacyLoadMessageDesc(t, "") -} -func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor { - // Fast-path: check if a MessageDescriptor is cached for this concrete type. - if mi, ok := legacyMessageDescCache.Load(t); ok { - return mi.(pref.MessageDescriptor) - } - - // Slow-path: initialize MessageDescriptor from the raw descriptor. - mv := reflect.Zero(t).Interface() - if _, ok := mv.(pref.ProtoMessage); ok { - panic(fmt.Sprintf("%v already implements proto.Message", t)) - } - mdV1, ok := mv.(messageV1) - if !ok { - return aberrantLoadMessageDesc(t, name) - } - - // If this is a dynamic message type where there isn't a 1-1 mapping between - // Go and protobuf types, calling the Descriptor method on the zero value of - // the message type isn't likely to work. If it panics, swallow the panic and - // continue as if the Descriptor method wasn't present. - b, idxs := func() ([]byte, []int) { - defer func() { - recover() - }() - return mdV1.Descriptor() - }() - if b == nil { - return aberrantLoadMessageDesc(t, name) - } - - // If the Go type has no fields, then this might be a proto3 empty message - // from before the size cache was added. If there are any fields, check to - // see that at least one of them looks like something we generated. - if nfield := t.Elem().NumField(); nfield > 0 { - hasProtoField := false - for i := 0; i < nfield; i++ { - f := t.Elem().Field(i) - if f.Tag.Get("protobuf") != "" || f.Tag.Get("protobuf_oneof") != "" || strings.HasPrefix(f.Name, "XXX_") { - hasProtoField = true - break - } - } - if !hasProtoField { - return aberrantLoadMessageDesc(t, name) - } - } - - md := legacyLoadFileDesc(b).Messages().Get(idxs[0]) - for _, i := range idxs[1:] { - md = md.Messages().Get(i) - } - if name != "" && md.FullName() != name { - panic(fmt.Sprintf("mismatching message name: got %v, want %v", md.FullName(), name)) - } - if md, ok := legacyMessageDescCache.LoadOrStore(t, md); ok { - return md.(protoreflect.MessageDescriptor) - } - return md -} - -var ( - aberrantMessageDescLock sync.Mutex - aberrantMessageDescCache map[reflect.Type]protoreflect.MessageDescriptor -) - -// aberrantLoadMessageDesc returns an MessageDescriptor derived from the Go type, -// which must not implement protoreflect.ProtoMessage or messageV1. -// -// This is a best-effort derivation of the message descriptor using the protobuf -// tags on the struct fields. -func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor { - aberrantMessageDescLock.Lock() - defer aberrantMessageDescLock.Unlock() - if aberrantMessageDescCache == nil { - aberrantMessageDescCache = make(map[reflect.Type]protoreflect.MessageDescriptor) - } - return aberrantLoadMessageDescReentrant(t, name) -} -func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor { - // Fast-path: check if an MessageDescriptor is cached for this concrete type. - if md, ok := aberrantMessageDescCache[t]; ok { - return md - } - - // Slow-path: construct a descriptor from the Go struct type (best-effort). - // Cache the MessageDescriptor early on so that we can resolve internal - // cyclic references. - md := &filedesc.Message{L2: new(filedesc.MessageL2)} - md.L0.FullName = aberrantDeriveMessageName(t, name) - md.L0.ParentFile = filedesc.SurrogateProto2 - aberrantMessageDescCache[t] = md - - if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct { - return md - } - - // Try to determine if the message is using proto3 by checking scalars. - for i := 0; i < t.Elem().NumField(); i++ { - f := t.Elem().Field(i) - if tag := f.Tag.Get("protobuf"); tag != "" { - switch f.Type.Kind() { - case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - md.L0.ParentFile = filedesc.SurrogateProto3 - } - for _, s := range strings.Split(tag, ",") { - if s == "proto3" { - md.L0.ParentFile = filedesc.SurrogateProto3 - } - } - } - } - - // Obtain a list of oneof wrapper types. - var oneofWrappers []reflect.Type - for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} { - if fn, ok := t.MethodByName(method); ok { - for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { - if vs, ok := v.Interface().([]interface{}); ok { - for _, v := range vs { - oneofWrappers = append(oneofWrappers, reflect.TypeOf(v)) - } - } - } - } - } - - // Obtain a list of the extension ranges. - if fn, ok := t.MethodByName("ExtensionRangeArray"); ok { - vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0] - for i := 0; i < vs.Len(); i++ { - v := vs.Index(i) - md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{ - pref.FieldNumber(v.FieldByName("Start").Int()), - pref.FieldNumber(v.FieldByName("End").Int() + 1), - }) - md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil) - } - } - - // Derive the message fields by inspecting the struct fields. - for i := 0; i < t.Elem().NumField(); i++ { - f := t.Elem().Field(i) - if tag := f.Tag.Get("protobuf"); tag != "" { - tagKey := f.Tag.Get("protobuf_key") - tagVal := f.Tag.Get("protobuf_val") - aberrantAppendField(md, f.Type, tag, tagKey, tagVal) - } - if tag := f.Tag.Get("protobuf_oneof"); tag != "" { - n := len(md.L2.Oneofs.List) - md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{}) - od := &md.L2.Oneofs.List[n] - od.L0.FullName = md.FullName().Append(pref.Name(tag)) - od.L0.ParentFile = md.L0.ParentFile - od.L0.Parent = md - od.L0.Index = n - - for _, t := range oneofWrappers { - if t.Implements(f.Type) { - f := t.Elem().Field(0) - if tag := f.Tag.Get("protobuf"); tag != "" { - aberrantAppendField(md, f.Type, tag, "", "") - fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1] - fd.L1.ContainingOneof = od - od.L1.Fields.List = append(od.L1.Fields.List, fd) - } - } - } - } - } - - return md -} - -func aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName { - if name.IsValid() { - return name - } - func() { - defer func() { recover() }() // swallow possible nil panics - if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok { - name = pref.FullName(m.XXX_MessageName()) - } - }() - if name.IsValid() { - return name - } - if t.Kind() == reflect.Ptr { - t = t.Elem() - } - return AberrantDeriveFullName(t) -} - -func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, tagVal string) { - t := goType - isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct - isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 - if isOptional || isRepeated { - t = t.Elem() - } - fd := ptag.Unmarshal(tag, t, placeholderEnumValues{}).(*filedesc.Field) - - // Append field descriptor to the message. - n := len(md.L2.Fields.List) - md.L2.Fields.List = append(md.L2.Fields.List, *fd) - fd = &md.L2.Fields.List[n] - fd.L0.FullName = md.FullName().Append(fd.Name()) - fd.L0.ParentFile = md.L0.ParentFile - fd.L0.Parent = md - fd.L0.Index = n - - if fd.L1.IsWeak || fd.L1.HasPacked { - fd.L1.Options = func() pref.ProtoMessage { - opts := descopts.Field.ProtoReflect().New() - if fd.L1.IsWeak { - opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true)) - } - if fd.L1.HasPacked { - opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.IsPacked)) - } - return opts.Interface() - } - } - - // Populate Enum and Message. - if fd.Enum() == nil && fd.Kind() == pref.EnumKind { - switch v := reflect.Zero(t).Interface().(type) { - case pref.Enum: - fd.L1.Enum = v.Descriptor() - default: - fd.L1.Enum = LegacyLoadEnumDesc(t) - } - } - if fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) { - switch v := reflect.Zero(t).Interface().(type) { - case pref.ProtoMessage: - fd.L1.Message = v.ProtoReflect().Descriptor() - case messageV1: - fd.L1.Message = LegacyLoadMessageDesc(t) - default: - if t.Kind() == reflect.Map { - n := len(md.L1.Messages.List) - md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)}) - md2 := &md.L1.Messages.List[n] - md2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name())))) - md2.L0.ParentFile = md.L0.ParentFile - md2.L0.Parent = md - md2.L0.Index = n - - md2.L1.IsMapEntry = true - md2.L2.Options = func() pref.ProtoMessage { - opts := descopts.Message.ProtoReflect().New() - opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true)) - return opts.Interface() - } - - aberrantAppendField(md2, t.Key(), tagKey, "", "") - aberrantAppendField(md2, t.Elem(), tagVal, "", "") - - fd.L1.Message = md2 - break - } - fd.L1.Message = aberrantLoadMessageDescReentrant(t, "") - } - } -} - -type placeholderEnumValues struct { - protoreflect.EnumValueDescriptors -} - -func (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor { - return filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf("UNKNOWN_%d", n))) -} - -// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder. -type legacyMarshaler interface { - Marshal() ([]byte, error) -} - -// legacyUnmarshaler is the proto.Unmarshaler interface superseded by protoiface.Methoder. -type legacyUnmarshaler interface { - Unmarshal([]byte) error -} - -// legacyMerger is the proto.Merger interface superseded by protoiface.Methoder. -type legacyMerger interface { - Merge(protoiface.MessageV1) -} - -var legacyProtoMethods = &piface.Methods{ - Marshal: legacyMarshal, - Unmarshal: legacyUnmarshal, - Merge: legacyMerge, - - // We have no way to tell whether the type's Marshal method - // supports deterministic serialization or not, but this - // preserves the v1 implementation's behavior of always - // calling Marshal methods when present. - Flags: piface.SupportMarshalDeterministic, -} - -func legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) { - v := in.Message.(unwrapper).protoUnwrap() - marshaler, ok := v.(legacyMarshaler) - if !ok { - return piface.MarshalOutput{}, errors.New("%T does not implement Marshal", v) - } - out, err := marshaler.Marshal() - if in.Buf != nil { - out = append(in.Buf, out...) - } - return piface.MarshalOutput{ - Buf: out, - }, err -} - -func legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) { - v := in.Message.(unwrapper).protoUnwrap() - unmarshaler, ok := v.(legacyUnmarshaler) - if !ok { - return piface.UnmarshalOutput{}, errors.New("%T does not implement Marshal", v) - } - return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf) -} - -func legacyMerge(in piface.MergeInput) piface.MergeOutput { - dstv := in.Destination.(unwrapper).protoUnwrap() - merger, ok := dstv.(legacyMerger) - if !ok { - return piface.MergeOutput{} - } - merger.Merge(Export{}.ProtoMessageV1Of(in.Source)) - return piface.MergeOutput{Flags: piface.MergeComplete} -} - -// aberrantMessageType implements MessageType for all types other than pointer-to-struct. -type aberrantMessageType struct { - t reflect.Type -} - -func (mt aberrantMessageType) New() pref.Message { - return aberrantMessage{reflect.Zero(mt.t)} -} -func (mt aberrantMessageType) Zero() pref.Message { - return aberrantMessage{reflect.Zero(mt.t)} -} -func (mt aberrantMessageType) GoType() reflect.Type { - return mt.t -} -func (mt aberrantMessageType) Descriptor() pref.MessageDescriptor { - return LegacyLoadMessageDesc(mt.t) -} - -// aberrantMessage implements Message for all types other than pointer-to-struct. -// -// When the underlying type implements legacyMarshaler or legacyUnmarshaler, -// the aberrant Message can be marshaled or unmarshaled. Otherwise, there is -// not much that can be done with values of this type. -type aberrantMessage struct { - v reflect.Value -} - -func (m aberrantMessage) ProtoReflect() pref.Message { - return m -} - -func (m aberrantMessage) Descriptor() pref.MessageDescriptor { - return LegacyLoadMessageDesc(m.v.Type()) -} -func (m aberrantMessage) Type() pref.MessageType { - return aberrantMessageType{m.v.Type()} -} -func (m aberrantMessage) New() pref.Message { - return aberrantMessage{reflect.Zero(m.v.Type())} -} -func (m aberrantMessage) Interface() pref.ProtoMessage { - return m -} -func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) { -} -func (m aberrantMessage) Has(pref.FieldDescriptor) bool { - panic("invalid field descriptor") -} -func (m aberrantMessage) Clear(pref.FieldDescriptor) { - panic("invalid field descriptor") -} -func (m aberrantMessage) Get(pref.FieldDescriptor) pref.Value { - panic("invalid field descriptor") -} -func (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) { - panic("invalid field descriptor") -} -func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value { - panic("invalid field descriptor") -} -func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value { - panic("invalid field descriptor") -} -func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor { - panic("invalid oneof descriptor") -} -func (m aberrantMessage) GetUnknown() pref.RawFields { - return nil -} -func (m aberrantMessage) SetUnknown(pref.RawFields) { - // SetUnknown discards its input on messages which don't support unknown field storage. -} -func (m aberrantMessage) IsValid() bool { - // An invalid message is a read-only, empty message. Since we don't know anything - // about the alleged contents of this message, we can't say with confidence that - // it is invalid in this sense. Therefore, report it as valid. - return true -} -func (m aberrantMessage) ProtoMethods() *piface.Methods { - return legacyProtoMethods -} -func (m aberrantMessage) protoUnwrap() interface{} { - return m.v.Interface() -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/merge.go b/vendor/google.golang.org/protobuf/internal/impl/merge.go deleted file mode 100644 index cdc4267df..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/merge.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - - "google.golang.org/protobuf/proto" - pref "google.golang.org/protobuf/reflect/protoreflect" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -type mergeOptions struct{} - -func (o mergeOptions) Merge(dst, src proto.Message) { - proto.Merge(dst, src) -} - -// merge is protoreflect.Methods.Merge. -func (mi *MessageInfo) merge(in piface.MergeInput) piface.MergeOutput { - dp, ok := mi.getPointer(in.Destination) - if !ok { - return piface.MergeOutput{} - } - sp, ok := mi.getPointer(in.Source) - if !ok { - return piface.MergeOutput{} - } - mi.mergePointer(dp, sp, mergeOptions{}) - return piface.MergeOutput{Flags: piface.MergeComplete} -} - -func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) { - mi.init() - if dst.IsNil() { - panic(fmt.Sprintf("invalid value: merging into nil message")) - } - if src.IsNil() { - return - } - for _, f := range mi.orderedCoderFields { - if f.funcs.merge == nil { - continue - } - sfptr := src.Apply(f.offset) - if f.isPointer && sfptr.Elem().IsNil() { - continue - } - f.funcs.merge(dst.Apply(f.offset), sfptr, f, opts) - } - if mi.extensionOffset.IsValid() { - sext := src.Apply(mi.extensionOffset).Extensions() - dext := dst.Apply(mi.extensionOffset).Extensions() - if *dext == nil { - *dext = make(map[int32]ExtensionField) - } - for num, sx := range *sext { - xt := sx.Type() - xi := getExtensionFieldInfo(xt) - if xi.funcs.merge == nil { - continue - } - dx := (*dext)[num] - var dv pref.Value - if dx.Type() == sx.Type() { - dv = dx.Value() - } - if !dv.IsValid() && xi.unmarshalNeedsValue { - dv = xt.New() - } - dv = xi.funcs.merge(dv, sx.Value(), opts) - dx.Set(sx.Type(), dv) - (*dext)[num] = dx - } - } - if mi.unknownOffset.IsValid() { - du := dst.Apply(mi.unknownOffset).Bytes() - su := src.Apply(mi.unknownOffset).Bytes() - if len(*su) > 0 { - *du = append(*du, *su...) - } - } -} - -func mergeScalarValue(dst, src pref.Value, opts mergeOptions) pref.Value { - return src -} - -func mergeBytesValue(dst, src pref.Value, opts mergeOptions) pref.Value { - return pref.ValueOfBytes(append(emptyBuf[:], src.Bytes()...)) -} - -func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value { - dstl := dst.List() - srcl := src.List() - for i, llen := 0, srcl.Len(); i < llen; i++ { - dstl.Append(srcl.Get(i)) - } - return dst -} - -func mergeBytesListValue(dst, src pref.Value, opts mergeOptions) pref.Value { - dstl := dst.List() - srcl := src.List() - for i, llen := 0, srcl.Len(); i < llen; i++ { - sb := srcl.Get(i).Bytes() - db := append(emptyBuf[:], sb...) - dstl.Append(pref.ValueOfBytes(db)) - } - return dst -} - -func mergeMessageListValue(dst, src pref.Value, opts mergeOptions) pref.Value { - dstl := dst.List() - srcl := src.List() - for i, llen := 0, srcl.Len(); i < llen; i++ { - sm := srcl.Get(i).Message() - dm := proto.Clone(sm.Interface()).ProtoReflect() - dstl.Append(pref.ValueOfMessage(dm)) - } - return dst -} - -func mergeMessageValue(dst, src pref.Value, opts mergeOptions) pref.Value { - opts.Merge(dst.Message().Interface(), src.Message().Interface()) - return dst -} - -func mergeMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - if f.mi != nil { - if dst.Elem().IsNil() { - dst.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) - } - f.mi.mergePointer(dst.Elem(), src.Elem(), opts) - } else { - dm := dst.AsValueOf(f.ft).Elem() - sm := src.AsValueOf(f.ft).Elem() - if dm.IsNil() { - dm.Set(reflect.New(f.ft.Elem())) - } - opts.Merge(asMessage(dm), asMessage(sm)) - } -} - -func mergeMessageSlice(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { - for _, sp := range src.PointerSlice() { - dm := reflect.New(f.ft.Elem().Elem()) - if f.mi != nil { - f.mi.mergePointer(pointerOfValue(dm), sp, opts) - } else { - opts.Merge(asMessage(dm), asMessage(sp.AsValueOf(f.ft.Elem().Elem()))) - } - dst.AppendPointerSlice(pointerOfValue(dm)) - } -} - -func mergeBytes(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Bytes() = append(emptyBuf[:], *src.Bytes()...) -} - -func mergeBytesNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Bytes() - if len(v) > 0 { - *dst.Bytes() = append(emptyBuf[:], v...) - } -} - -func mergeBytesSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.BytesSlice() - for _, v := range *src.BytesSlice() { - *ds = append(*ds, append(emptyBuf[:], v...)) - } -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go b/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go deleted file mode 100644 index 8816c274d..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package impl - -import () - -func mergeBool(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Bool() = *src.Bool() -} - -func mergeBoolNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Bool() - if v != false { - *dst.Bool() = v - } -} - -func mergeBoolPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.BoolPtr() - if p != nil { - v := *p - *dst.BoolPtr() = &v - } -} - -func mergeBoolSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.BoolSlice() - ss := src.BoolSlice() - *ds = append(*ds, *ss...) -} - -func mergeInt32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Int32() = *src.Int32() -} - -func mergeInt32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Int32() - if v != 0 { - *dst.Int32() = v - } -} - -func mergeInt32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.Int32Ptr() - if p != nil { - v := *p - *dst.Int32Ptr() = &v - } -} - -func mergeInt32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.Int32Slice() - ss := src.Int32Slice() - *ds = append(*ds, *ss...) -} - -func mergeUint32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Uint32() = *src.Uint32() -} - -func mergeUint32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Uint32() - if v != 0 { - *dst.Uint32() = v - } -} - -func mergeUint32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.Uint32Ptr() - if p != nil { - v := *p - *dst.Uint32Ptr() = &v - } -} - -func mergeUint32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.Uint32Slice() - ss := src.Uint32Slice() - *ds = append(*ds, *ss...) -} - -func mergeInt64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Int64() = *src.Int64() -} - -func mergeInt64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Int64() - if v != 0 { - *dst.Int64() = v - } -} - -func mergeInt64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.Int64Ptr() - if p != nil { - v := *p - *dst.Int64Ptr() = &v - } -} - -func mergeInt64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.Int64Slice() - ss := src.Int64Slice() - *ds = append(*ds, *ss...) -} - -func mergeUint64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Uint64() = *src.Uint64() -} - -func mergeUint64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Uint64() - if v != 0 { - *dst.Uint64() = v - } -} - -func mergeUint64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.Uint64Ptr() - if p != nil { - v := *p - *dst.Uint64Ptr() = &v - } -} - -func mergeUint64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.Uint64Slice() - ss := src.Uint64Slice() - *ds = append(*ds, *ss...) -} - -func mergeFloat32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Float32() = *src.Float32() -} - -func mergeFloat32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Float32() - if v != 0 { - *dst.Float32() = v - } -} - -func mergeFloat32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.Float32Ptr() - if p != nil { - v := *p - *dst.Float32Ptr() = &v - } -} - -func mergeFloat32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.Float32Slice() - ss := src.Float32Slice() - *ds = append(*ds, *ss...) -} - -func mergeFloat64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.Float64() = *src.Float64() -} - -func mergeFloat64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.Float64() - if v != 0 { - *dst.Float64() = v - } -} - -func mergeFloat64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.Float64Ptr() - if p != nil { - v := *p - *dst.Float64Ptr() = &v - } -} - -func mergeFloat64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.Float64Slice() - ss := src.Float64Slice() - *ds = append(*ds, *ss...) -} - -func mergeString(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - *dst.String() = *src.String() -} - -func mergeStringNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - v := *src.String() - if v != "" { - *dst.String() = v - } -} - -func mergeStringPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - p := *src.StringPtr() - if p != nil { - v := *p - *dst.StringPtr() = &v - } -} - -func mergeStringSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - ds := dst.StringSlice() - ss := src.StringSlice() - *ds = append(*ds, *ss...) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go deleted file mode 100644 index c026a9818..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/message.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/reflect/protoreflect" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// MessageInfo provides protobuf related functionality for a given Go type -// that represents a message. A given instance of MessageInfo is tied to -// exactly one Go type, which must be a pointer to a struct type. -// -// The exported fields must be populated before any methods are called -// and cannot be mutated after set. -type MessageInfo struct { - // GoReflectType is the underlying message Go type and must be populated. - GoReflectType reflect.Type // pointer to struct - - // Desc is the underlying message descriptor type and must be populated. - Desc pref.MessageDescriptor - - // Exporter must be provided in a purego environment in order to provide - // access to unexported fields. - Exporter exporter - - // OneofWrappers is list of pointers to oneof wrapper struct types. - OneofWrappers []interface{} - - initMu sync.Mutex // protects all unexported fields - initDone uint32 - - reflectMessageInfo // for reflection implementation - coderMessageInfo // for fast-path method implementations -} - -// exporter is a function that returns a reference to the ith field of v, -// where v is a pointer to a struct. It returns nil if it does not support -// exporting the requested field (e.g., already exported). -type exporter func(v interface{}, i int) interface{} - -// getMessageInfo returns the MessageInfo for any message type that -// is generated by our implementation of protoc-gen-go (for v2 and on). -// If it is unable to obtain a MessageInfo, it returns nil. -func getMessageInfo(mt reflect.Type) *MessageInfo { - m, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage) - if !ok { - return nil - } - mr, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *MessageInfo }) - if !ok { - return nil - } - return mr.ProtoMessageInfo() -} - -func (mi *MessageInfo) init() { - // This function is called in the hot path. Inline the sync.Once logic, - // since allocating a closure for Once.Do is expensive. - // Keep init small to ensure that it can be inlined. - if atomic.LoadUint32(&mi.initDone) == 0 { - mi.initOnce() - } -} - -func (mi *MessageInfo) initOnce() { - mi.initMu.Lock() - defer mi.initMu.Unlock() - if mi.initDone == 1 { - return - } - - t := mi.GoReflectType - if t.Kind() != reflect.Ptr && t.Elem().Kind() != reflect.Struct { - panic(fmt.Sprintf("got %v, want *struct kind", t)) - } - t = t.Elem() - - si := mi.makeStructInfo(t) - mi.makeReflectFuncs(t, si) - mi.makeCoderMethods(t, si) - - atomic.StoreUint32(&mi.initDone, 1) -} - -// getPointer returns the pointer for a message, which should be of -// the type of the MessageInfo. If the message is of a different type, -// it returns ok==false. -func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) { - switch m := m.(type) { - case *messageState: - return m.pointer(), m.messageInfo() == mi - case *messageReflectWrapper: - return m.pointer(), m.messageInfo() == mi - } - return pointer{}, false -} - -type ( - SizeCache = int32 - WeakFields = map[int32]protoreflect.ProtoMessage - UnknownFields = []byte - ExtensionFields = map[int32]ExtensionField -) - -var ( - sizecacheType = reflect.TypeOf(SizeCache(0)) - weakFieldsType = reflect.TypeOf(WeakFields(nil)) - unknownFieldsType = reflect.TypeOf(UnknownFields(nil)) - extensionFieldsType = reflect.TypeOf(ExtensionFields(nil)) -) - -type structInfo struct { - sizecacheOffset offset - weakOffset offset - unknownOffset offset - extensionOffset offset - - fieldsByNumber map[pref.FieldNumber]reflect.StructField - oneofsByName map[pref.Name]reflect.StructField - oneofWrappersByType map[reflect.Type]pref.FieldNumber - oneofWrappersByNumber map[pref.FieldNumber]reflect.Type -} - -func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo { - si := structInfo{ - sizecacheOffset: invalidOffset, - weakOffset: invalidOffset, - unknownOffset: invalidOffset, - extensionOffset: invalidOffset, - - fieldsByNumber: map[pref.FieldNumber]reflect.StructField{}, - oneofsByName: map[pref.Name]reflect.StructField{}, - oneofWrappersByType: map[reflect.Type]pref.FieldNumber{}, - oneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{}, - } - -fieldLoop: - for i := 0; i < t.NumField(); i++ { - switch f := t.Field(i); f.Name { - case genid.SizeCache_goname, genid.SizeCacheA_goname: - if f.Type == sizecacheType { - si.sizecacheOffset = offsetOf(f, mi.Exporter) - } - case genid.WeakFields_goname, genid.WeakFieldsA_goname: - if f.Type == weakFieldsType { - si.weakOffset = offsetOf(f, mi.Exporter) - } - case genid.UnknownFields_goname, genid.UnknownFieldsA_goname: - if f.Type == unknownFieldsType { - si.unknownOffset = offsetOf(f, mi.Exporter) - } - case genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname: - if f.Type == extensionFieldsType { - si.extensionOffset = offsetOf(f, mi.Exporter) - } - default: - for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") { - if len(s) > 0 && strings.Trim(s, "0123456789") == "" { - n, _ := strconv.ParseUint(s, 10, 64) - si.fieldsByNumber[pref.FieldNumber(n)] = f - continue fieldLoop - } - } - if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 { - si.oneofsByName[pref.Name(s)] = f - continue fieldLoop - } - } - } - - // Derive a mapping of oneof wrappers to fields. - oneofWrappers := mi.OneofWrappers - for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} { - if fn, ok := reflect.PtrTo(t).MethodByName(method); ok { - for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { - if vs, ok := v.Interface().([]interface{}); ok { - oneofWrappers = vs - } - } - } - } - for _, v := range oneofWrappers { - tf := reflect.TypeOf(v).Elem() - f := tf.Field(0) - for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") { - if len(s) > 0 && strings.Trim(s, "0123456789") == "" { - n, _ := strconv.ParseUint(s, 10, 64) - si.oneofWrappersByType[tf] = pref.FieldNumber(n) - si.oneofWrappersByNumber[pref.FieldNumber(n)] = tf - break - } - } - } - - return si -} - -func (mi *MessageInfo) New() protoreflect.Message { - return mi.MessageOf(reflect.New(mi.GoReflectType.Elem()).Interface()) -} -func (mi *MessageInfo) Zero() protoreflect.Message { - return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface()) -} -func (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor { return mi.Desc } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go deleted file mode 100644 index 0f4b8db76..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "reflect" - - "google.golang.org/protobuf/internal/pragma" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type reflectMessageInfo struct { - fields map[pref.FieldNumber]*fieldInfo - oneofs map[pref.Name]*oneofInfo - - // denseFields is a subset of fields where: - // 0 < fieldDesc.Number() < len(denseFields) - // It provides faster access to the fieldInfo, but may be incomplete. - denseFields []*fieldInfo - - // rangeInfos is a list of all fields (not belonging to a oneof) and oneofs. - rangeInfos []interface{} // either *fieldInfo or *oneofInfo - - getUnknown func(pointer) pref.RawFields - setUnknown func(pointer, pref.RawFields) - extensionMap func(pointer) *extensionMap - - nilMessage atomicNilMessage -} - -// makeReflectFuncs generates the set of functions to support reflection. -func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) { - mi.makeKnownFieldsFunc(si) - mi.makeUnknownFieldsFunc(t, si) - mi.makeExtensionFieldsFunc(t, si) -} - -// makeKnownFieldsFunc generates functions for operations that can be performed -// on each protobuf message field. It takes in a reflect.Type representing the -// Go struct and matches message fields with struct fields. -// -// This code assumes that the struct is well-formed and panics if there are -// any discrepancies. -func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) { - mi.fields = map[pref.FieldNumber]*fieldInfo{} - md := mi.Desc - fds := md.Fields() - for i := 0; i < fds.Len(); i++ { - fd := fds.Get(i) - fs := si.fieldsByNumber[fd.Number()] - var fi fieldInfo - switch { - case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): - fi = fieldInfoForOneof(fd, si.oneofsByName[fd.ContainingOneof().Name()], mi.Exporter, si.oneofWrappersByNumber[fd.Number()]) - case fd.IsMap(): - fi = fieldInfoForMap(fd, fs, mi.Exporter) - case fd.IsList(): - fi = fieldInfoForList(fd, fs, mi.Exporter) - case fd.IsWeak(): - fi = fieldInfoForWeakMessage(fd, si.weakOffset) - case fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind: - fi = fieldInfoForMessage(fd, fs, mi.Exporter) - default: - fi = fieldInfoForScalar(fd, fs, mi.Exporter) - } - mi.fields[fd.Number()] = &fi - } - - mi.oneofs = map[pref.Name]*oneofInfo{} - for i := 0; i < md.Oneofs().Len(); i++ { - od := md.Oneofs().Get(i) - mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter) - } - - mi.denseFields = make([]*fieldInfo, fds.Len()*2) - for i := 0; i < fds.Len(); i++ { - if fd := fds.Get(i); int(fd.Number()) < len(mi.denseFields) { - mi.denseFields[fd.Number()] = mi.fields[fd.Number()] - } - } - - for i := 0; i < fds.Len(); { - fd := fds.Get(i) - if od := fd.ContainingOneof(); od != nil && !od.IsSynthetic() { - mi.rangeInfos = append(mi.rangeInfos, mi.oneofs[od.Name()]) - i += od.Fields().Len() - } else { - mi.rangeInfos = append(mi.rangeInfos, mi.fields[fd.Number()]) - i++ - } - } -} - -func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) { - mi.getUnknown = func(pointer) pref.RawFields { return nil } - mi.setUnknown = func(pointer, pref.RawFields) { return } - if si.unknownOffset.IsValid() { - mi.getUnknown = func(p pointer) pref.RawFields { - if p.IsNil() { - return nil - } - rv := p.Apply(si.unknownOffset).AsValueOf(unknownFieldsType) - return pref.RawFields(*rv.Interface().(*[]byte)) - } - mi.setUnknown = func(p pointer, b pref.RawFields) { - if p.IsNil() { - panic("invalid SetUnknown on nil Message") - } - rv := p.Apply(si.unknownOffset).AsValueOf(unknownFieldsType) - *rv.Interface().(*[]byte) = []byte(b) - } - } else { - mi.getUnknown = func(pointer) pref.RawFields { - return nil - } - mi.setUnknown = func(p pointer, _ pref.RawFields) { - if p.IsNil() { - panic("invalid SetUnknown on nil Message") - } - } - } -} - -func (mi *MessageInfo) makeExtensionFieldsFunc(t reflect.Type, si structInfo) { - if si.extensionOffset.IsValid() { - mi.extensionMap = func(p pointer) *extensionMap { - if p.IsNil() { - return (*extensionMap)(nil) - } - v := p.Apply(si.extensionOffset).AsValueOf(extensionFieldsType) - return (*extensionMap)(v.Interface().(*map[int32]ExtensionField)) - } - } else { - mi.extensionMap = func(pointer) *extensionMap { - return (*extensionMap)(nil) - } - } -} - -type extensionMap map[int32]ExtensionField - -func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) { - if m != nil { - for _, x := range *m { - xd := x.Type().TypeDescriptor() - v := x.Value() - if xd.IsList() && v.List().Len() == 0 { - continue - } - if !f(xd, v) { - return - } - } - } -} -func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) { - if m == nil { - return false - } - xd := xt.TypeDescriptor() - x, ok := (*m)[int32(xd.Number())] - if !ok { - return false - } - switch { - case xd.IsList(): - return x.Value().List().Len() > 0 - case xd.IsMap(): - return x.Value().Map().Len() > 0 - case xd.Message() != nil: - return x.Value().Message().IsValid() - } - return true -} -func (m *extensionMap) Clear(xt pref.ExtensionType) { - delete(*m, int32(xt.TypeDescriptor().Number())) -} -func (m *extensionMap) Get(xt pref.ExtensionType) pref.Value { - xd := xt.TypeDescriptor() - if m != nil { - if x, ok := (*m)[int32(xd.Number())]; ok { - return x.Value() - } - } - return xt.Zero() -} -func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) { - xd := xt.TypeDescriptor() - isValid := true - switch { - case !xt.IsValidValue(v): - isValid = false - case xd.IsList(): - isValid = v.List().IsValid() - case xd.IsMap(): - isValid = v.Map().IsValid() - case xd.Message() != nil: - isValid = v.Message().IsValid() - } - if !isValid { - panic(fmt.Sprintf("%v: assigning invalid value", xt.TypeDescriptor().FullName())) - } - - if *m == nil { - *m = make(map[int32]ExtensionField) - } - var x ExtensionField - x.Set(xt, v) - (*m)[int32(xd.Number())] = x -} -func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value { - xd := xt.TypeDescriptor() - if xd.Kind() != pref.MessageKind && xd.Kind() != pref.GroupKind && !xd.IsList() && !xd.IsMap() { - panic("invalid Mutable on field with non-composite type") - } - if x, ok := (*m)[int32(xd.Number())]; ok { - return x.Value() - } - v := xt.New() - m.Set(xt, v) - return v -} - -// MessageState is a data structure that is nested as the first field in a -// concrete message. It provides a way to implement the ProtoReflect method -// in an allocation-free way without needing to have a shadow Go type generated -// for every message type. This technique only works using unsafe. -// -// -// Example generated code: -// -// type M struct { -// state protoimpl.MessageState -// -// Field1 int32 -// Field2 string -// Field3 *BarMessage -// ... -// } -// -// func (m *M) ProtoReflect() protoreflect.Message { -// mi := &file_fizz_buzz_proto_msgInfos[5] -// if protoimpl.UnsafeEnabled && m != nil { -// ms := protoimpl.X.MessageStateOf(Pointer(m)) -// if ms.LoadMessageInfo() == nil { -// ms.StoreMessageInfo(mi) -// } -// return ms -// } -// return mi.MessageOf(m) -// } -// -// The MessageState type holds a *MessageInfo, which must be atomically set to -// the message info associated with a given message instance. -// By unsafely converting a *M into a *MessageState, the MessageState object -// has access to all the information needed to implement protobuf reflection. -// It has access to the message info as its first field, and a pointer to the -// MessageState is identical to a pointer to the concrete message value. -// -// -// Requirements: -// • The type M must implement protoreflect.ProtoMessage. -// • The address of m must not be nil. -// • The address of m and the address of m.state must be equal, -// even though they are different Go types. -type MessageState struct { - pragma.NoUnkeyedLiterals - pragma.DoNotCompare - pragma.DoNotCopy - - atomicMessageInfo *MessageInfo -} - -type messageState MessageState - -var ( - _ pref.Message = (*messageState)(nil) - _ unwrapper = (*messageState)(nil) -) - -// messageDataType is a tuple of a pointer to the message data and -// a pointer to the message type. It is a generalized way of providing a -// reflective view over a message instance. The disadvantage of this approach -// is the need to allocate this tuple of 16B. -type messageDataType struct { - p pointer - mi *MessageInfo -} - -type ( - messageReflectWrapper messageDataType - messageIfaceWrapper messageDataType -) - -var ( - _ pref.Message = (*messageReflectWrapper)(nil) - _ unwrapper = (*messageReflectWrapper)(nil) - _ pref.ProtoMessage = (*messageIfaceWrapper)(nil) - _ unwrapper = (*messageIfaceWrapper)(nil) -) - -// MessageOf returns a reflective view over a message. The input must be a -// pointer to a named Go struct. If the provided type has a ProtoReflect method, -// it must be implemented by calling this method. -func (mi *MessageInfo) MessageOf(m interface{}) pref.Message { - // TODO: Switch the input to be an opaque Pointer. - if reflect.TypeOf(m) != mi.GoReflectType { - panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType)) - } - p := pointerOfIface(m) - if p.IsNil() { - return mi.nilMessage.Init(mi) - } - return &messageReflectWrapper{p, mi} -} - -func (m *messageReflectWrapper) pointer() pointer { return m.p } -func (m *messageReflectWrapper) messageInfo() *MessageInfo { return m.mi } - -func (m *messageIfaceWrapper) ProtoReflect() pref.Message { - return (*messageReflectWrapper)(m) -} -func (m *messageIfaceWrapper) protoUnwrap() interface{} { - return m.p.AsIfaceOf(m.mi.GoReflectType.Elem()) -} - -// checkField verifies that the provided field descriptor is valid. -// Exactly one of the returned values is populated. -func (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.ExtensionType) { - var fi *fieldInfo - if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) { - fi = mi.denseFields[n] - } else { - fi = mi.fields[n] - } - if fi != nil { - if fi.fieldDesc != fd { - if got, want := fd.FullName(), fi.fieldDesc.FullName(); got != want { - panic(fmt.Sprintf("mismatching field: got %v, want %v", got, want)) - } - panic(fmt.Sprintf("mismatching field: %v", fd.FullName())) - } - return fi, nil - } - - if fd.IsExtension() { - if got, want := fd.ContainingMessage().FullName(), mi.Desc.FullName(); got != want { - // TODO: Should this be exact containing message descriptor match? - panic(fmt.Sprintf("extension %v has mismatching containing message: got %v, want %v", fd.FullName(), got, want)) - } - if !mi.Desc.ExtensionRanges().Has(fd.Number()) { - panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName())) - } - xtd, ok := fd.(pref.ExtensionTypeDescriptor) - if !ok { - panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName())) - } - return nil, xtd.Type() - } - panic(fmt.Sprintf("field %v is invalid", fd.FullName())) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go deleted file mode 100644 index 23124a86e..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +++ /dev/null @@ -1,466 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "math" - "reflect" - "sync" - - "google.golang.org/protobuf/internal/flags" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" -) - -type fieldInfo struct { - fieldDesc pref.FieldDescriptor - - // These fields are used for protobuf reflection support. - has func(pointer) bool - clear func(pointer) - get func(pointer) pref.Value - set func(pointer, pref.Value) - mutable func(pointer) pref.Value - newMessage func() pref.Message - newField func() pref.Value -} - -func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo { - ft := fs.Type - if ft.Kind() != reflect.Interface { - panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft)) - } - if ot.Kind() != reflect.Struct { - panic(fmt.Sprintf("field %v has invalid type: got %v, want struct kind", fd.FullName(), ot)) - } - if !reflect.PtrTo(ot).Implements(ft) { - panic(fmt.Sprintf("field %v has invalid type: %v does not implement %v", fd.FullName(), ot, ft)) - } - conv := NewConverter(ot.Field(0).Type, fd) - isMessage := fd.Message() != nil - - // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) - return fieldInfo{ - // NOTE: The logic below intentionally assumes that oneof fields are - // well-formatted. That is, the oneof interface never contains a - // typed nil pointer to one of the wrapper structs. - - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() { - return false - } - return true - }, - clear: func(p pointer) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() || rv.Elem().Type().Elem() != ot { - // NOTE: We intentionally don't check for rv.Elem().IsNil() - // so that (*OneofWrapperType)(nil) gets cleared to nil. - return - } - rv.Set(reflect.Zero(rv.Type())) - }, - get: func(p pointer) pref.Value { - if p.IsNil() { - return conv.Zero() - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() { - return conv.Zero() - } - rv = rv.Elem().Elem().Field(0) - return conv.PBValueOf(rv) - }, - set: func(p pointer, v pref.Value) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() { - rv.Set(reflect.New(ot)) - } - rv = rv.Elem().Elem().Field(0) - rv.Set(conv.GoValueOf(v)) - }, - mutable: func(p pointer) pref.Value { - if !isMessage { - panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName())) - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() { - rv.Set(reflect.New(ot)) - } - rv = rv.Elem().Elem().Field(0) - if rv.IsNil() { - rv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message()))) - } - return conv.PBValueOf(rv) - }, - newMessage: func() pref.Message { - return conv.New().Message() - }, - newField: func() pref.Value { - return conv.New() - }, - } -} - -func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo { - ft := fs.Type - if ft.Kind() != reflect.Map { - panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft)) - } - conv := NewConverter(ft, fd) - - // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) - return fieldInfo{ - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - return rv.Len() > 0 - }, - clear: func(p pointer) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - rv.Set(reflect.Zero(rv.Type())) - }, - get: func(p pointer) pref.Value { - if p.IsNil() { - return conv.Zero() - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.Len() == 0 { - return conv.Zero() - } - return conv.PBValueOf(rv) - }, - set: func(p pointer, v pref.Value) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - pv := conv.GoValueOf(v) - if pv.IsNil() { - panic(fmt.Sprintf("map field %v cannot be set with read-only value", fd.FullName())) - } - rv.Set(pv) - }, - mutable: func(p pointer) pref.Value { - v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if v.IsNil() { - v.Set(reflect.MakeMap(fs.Type)) - } - return conv.PBValueOf(v) - }, - newField: func() pref.Value { - return conv.New() - }, - } -} - -func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo { - ft := fs.Type - if ft.Kind() != reflect.Slice { - panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft)) - } - conv := NewConverter(reflect.PtrTo(ft), fd) - - // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) - return fieldInfo{ - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - return rv.Len() > 0 - }, - clear: func(p pointer) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - rv.Set(reflect.Zero(rv.Type())) - }, - get: func(p pointer) pref.Value { - if p.IsNil() { - return conv.Zero() - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type) - if rv.Elem().Len() == 0 { - return conv.Zero() - } - return conv.PBValueOf(rv) - }, - set: func(p pointer, v pref.Value) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - pv := conv.GoValueOf(v) - if pv.IsNil() { - panic(fmt.Sprintf("list field %v cannot be set with read-only value", fd.FullName())) - } - rv.Set(pv.Elem()) - }, - mutable: func(p pointer) pref.Value { - v := p.Apply(fieldOffset).AsValueOf(fs.Type) - return conv.PBValueOf(v) - }, - newField: func() pref.Value { - return conv.New() - }, - } -} - -var ( - nilBytes = reflect.ValueOf([]byte(nil)) - emptyBytes = reflect.ValueOf([]byte{}) -) - -func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo { - ft := fs.Type - nullable := fd.HasPresence() - isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 - if nullable { - if ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice { - panic(fmt.Sprintf("field %v has invalid type: got %v, want pointer", fd.FullName(), ft)) - } - if ft.Kind() == reflect.Ptr { - ft = ft.Elem() - } - } - conv := NewConverter(ft, fd) - - // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) - return fieldInfo{ - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if nullable { - return !rv.IsNil() - } - switch rv.Kind() { - case reflect.Bool: - return rv.Bool() - case reflect.Int32, reflect.Int64: - return rv.Int() != 0 - case reflect.Uint32, reflect.Uint64: - return rv.Uint() != 0 - case reflect.Float32, reflect.Float64: - return rv.Float() != 0 || math.Signbit(rv.Float()) - case reflect.String, reflect.Slice: - return rv.Len() > 0 - default: - panic(fmt.Sprintf("field %v has invalid type: %v", fd.FullName(), rv.Type())) // should never happen - } - }, - clear: func(p pointer) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - rv.Set(reflect.Zero(rv.Type())) - }, - get: func(p pointer) pref.Value { - if p.IsNil() { - return conv.Zero() - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if nullable { - if rv.IsNil() { - return conv.Zero() - } - if rv.Kind() == reflect.Ptr { - rv = rv.Elem() - } - } - return conv.PBValueOf(rv) - }, - set: func(p pointer, v pref.Value) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if nullable && rv.Kind() == reflect.Ptr { - if rv.IsNil() { - rv.Set(reflect.New(ft)) - } - rv = rv.Elem() - } - rv.Set(conv.GoValueOf(v)) - if isBytes && rv.Len() == 0 { - if nullable { - rv.Set(emptyBytes) // preserve presence - } else { - rv.Set(nilBytes) // do not preserve presence - } - } - }, - newField: func() pref.Value { - return conv.New() - }, - } -} - -func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldInfo { - if !flags.ProtoLegacy { - panic("no support for proto1 weak fields") - } - - var once sync.Once - var messageType pref.MessageType - lazyInit := func() { - once.Do(func() { - messageName := fd.Message().FullName() - messageType, _ = preg.GlobalTypes.FindMessageByName(messageName) - if messageType == nil { - panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName())) - } - }) - } - - num := fd.Number() - return fieldInfo{ - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - _, ok := p.Apply(weakOffset).WeakFields().get(num) - return ok - }, - clear: func(p pointer) { - p.Apply(weakOffset).WeakFields().clear(num) - }, - get: func(p pointer) pref.Value { - lazyInit() - if p.IsNil() { - return pref.ValueOfMessage(messageType.Zero()) - } - m, ok := p.Apply(weakOffset).WeakFields().get(num) - if !ok { - return pref.ValueOfMessage(messageType.Zero()) - } - return pref.ValueOfMessage(m.ProtoReflect()) - }, - set: func(p pointer, v pref.Value) { - lazyInit() - m := v.Message() - if m.Descriptor() != messageType.Descriptor() { - if got, want := m.Descriptor().FullName(), messageType.Descriptor().FullName(); got != want { - panic(fmt.Sprintf("field %v has mismatching message descriptor: got %v, want %v", fd.FullName(), got, want)) - } - panic(fmt.Sprintf("field %v has mismatching message descriptor: %v", fd.FullName(), m.Descriptor().FullName())) - } - p.Apply(weakOffset).WeakFields().set(num, m.Interface()) - }, - mutable: func(p pointer) pref.Value { - lazyInit() - fs := p.Apply(weakOffset).WeakFields() - m, ok := fs.get(num) - if !ok { - m = messageType.New().Interface() - fs.set(num, m) - } - return pref.ValueOfMessage(m.ProtoReflect()) - }, - newMessage: func() pref.Message { - lazyInit() - return messageType.New() - }, - newField: func() pref.Value { - lazyInit() - return pref.ValueOfMessage(messageType.New()) - }, - } -} - -func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo { - ft := fs.Type - conv := NewConverter(ft, fd) - - // TODO: Implement unsafe fast path? - fieldOffset := offsetOf(fs, x) - return fieldInfo{ - fieldDesc: fd, - has: func(p pointer) bool { - if p.IsNil() { - return false - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - return !rv.IsNil() - }, - clear: func(p pointer) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - rv.Set(reflect.Zero(rv.Type())) - }, - get: func(p pointer) pref.Value { - if p.IsNil() { - return conv.Zero() - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - return conv.PBValueOf(rv) - }, - set: func(p pointer, v pref.Value) { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - rv.Set(conv.GoValueOf(v)) - if rv.IsNil() { - panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName())) - } - }, - mutable: func(p pointer) pref.Value { - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() { - rv.Set(conv.GoValueOf(conv.New())) - } - return conv.PBValueOf(rv) - }, - newMessage: func() pref.Message { - return conv.New().Message() - }, - newField: func() pref.Value { - return conv.New() - }, - } -} - -type oneofInfo struct { - oneofDesc pref.OneofDescriptor - which func(pointer) pref.FieldNumber -} - -func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInfo { - oi := &oneofInfo{oneofDesc: od} - if od.IsSynthetic() { - fs := si.fieldsByNumber[od.Fields().Get(0).Number()] - fieldOffset := offsetOf(fs, x) - oi.which = func(p pointer) pref.FieldNumber { - if p.IsNil() { - return 0 - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() { // valid on either *T or []byte - return 0 - } - return od.Fields().Get(0).Number() - } - } else { - fs := si.oneofsByName[od.Name()] - fieldOffset := offsetOf(fs, x) - oi.which = func(p pointer) pref.FieldNumber { - if p.IsNil() { - return 0 - } - rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() { - return 0 - } - rv = rv.Elem() - if rv.IsNil() { - return 0 - } - return si.oneofWrappersByType[rv.Type().Elem()] - } - } - return oi -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go deleted file mode 100644 index 741d6e5b6..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package impl - -import ( - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -func (m *messageState) Descriptor() protoreflect.MessageDescriptor { - return m.messageInfo().Desc -} -func (m *messageState) Type() protoreflect.MessageType { - return m.messageInfo() -} -func (m *messageState) New() protoreflect.Message { - return m.messageInfo().New() -} -func (m *messageState) Interface() protoreflect.ProtoMessage { - return m.protoUnwrap().(protoreflect.ProtoMessage) -} -func (m *messageState) protoUnwrap() interface{} { - return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem()) -} -func (m *messageState) ProtoMethods() *protoiface.Methods { - m.messageInfo().init() - return &m.messageInfo().methods -} - -// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code -// to be able to retrieve a v2 MessageInfo struct. -// -// WARNING: This method is exempt from the compatibility promise and -// may be removed in the future without warning. -func (m *messageState) ProtoMessageInfo() *MessageInfo { - return m.messageInfo() -} - -func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - m.messageInfo().init() - for _, ri := range m.messageInfo().rangeInfos { - switch ri := ri.(type) { - case *fieldInfo: - if ri.has(m.pointer()) { - if !f(ri.fieldDesc, ri.get(m.pointer())) { - return - } - } - case *oneofInfo: - if n := ri.which(m.pointer()); n > 0 { - fi := m.messageInfo().fields[n] - if !f(fi.fieldDesc, fi.get(m.pointer())) { - return - } - } - } - } - m.messageInfo().extensionMap(m.pointer()).Range(f) -} -func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.has(m.pointer()) - } else { - return m.messageInfo().extensionMap(m.pointer()).Has(xt) - } -} -func (m *messageState) Clear(fd protoreflect.FieldDescriptor) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - fi.clear(m.pointer()) - } else { - m.messageInfo().extensionMap(m.pointer()).Clear(xt) - } -} -func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.get(m.pointer()) - } else { - return m.messageInfo().extensionMap(m.pointer()).Get(xt) - } -} -func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - fi.set(m.pointer(), v) - } else { - m.messageInfo().extensionMap(m.pointer()).Set(xt, v) - } -} -func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.mutable(m.pointer()) - } else { - return m.messageInfo().extensionMap(m.pointer()).Mutable(xt) - } -} -func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.newField() - } else { - return xt.New() - } -} -func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - m.messageInfo().init() - if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { - return od.Fields().ByNumber(oi.which(m.pointer())) - } - panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName())) -} -func (m *messageState) GetUnknown() protoreflect.RawFields { - m.messageInfo().init() - return m.messageInfo().getUnknown(m.pointer()) -} -func (m *messageState) SetUnknown(b protoreflect.RawFields) { - m.messageInfo().init() - m.messageInfo().setUnknown(m.pointer(), b) -} -func (m *messageState) IsValid() bool { - return !m.pointer().IsNil() -} - -func (m *messageReflectWrapper) Descriptor() protoreflect.MessageDescriptor { - return m.messageInfo().Desc -} -func (m *messageReflectWrapper) Type() protoreflect.MessageType { - return m.messageInfo() -} -func (m *messageReflectWrapper) New() protoreflect.Message { - return m.messageInfo().New() -} -func (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage { - if m, ok := m.protoUnwrap().(protoreflect.ProtoMessage); ok { - return m - } - return (*messageIfaceWrapper)(m) -} -func (m *messageReflectWrapper) protoUnwrap() interface{} { - return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem()) -} -func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods { - m.messageInfo().init() - return &m.messageInfo().methods -} - -// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code -// to be able to retrieve a v2 MessageInfo struct. -// -// WARNING: This method is exempt from the compatibility promise and -// may be removed in the future without warning. -func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo { - return m.messageInfo() -} - -func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - m.messageInfo().init() - for _, ri := range m.messageInfo().rangeInfos { - switch ri := ri.(type) { - case *fieldInfo: - if ri.has(m.pointer()) { - if !f(ri.fieldDesc, ri.get(m.pointer())) { - return - } - } - case *oneofInfo: - if n := ri.which(m.pointer()); n > 0 { - fi := m.messageInfo().fields[n] - if !f(fi.fieldDesc, fi.get(m.pointer())) { - return - } - } - } - } - m.messageInfo().extensionMap(m.pointer()).Range(f) -} -func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.has(m.pointer()) - } else { - return m.messageInfo().extensionMap(m.pointer()).Has(xt) - } -} -func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - fi.clear(m.pointer()) - } else { - m.messageInfo().extensionMap(m.pointer()).Clear(xt) - } -} -func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.get(m.pointer()) - } else { - return m.messageInfo().extensionMap(m.pointer()).Get(xt) - } -} -func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - fi.set(m.pointer(), v) - } else { - m.messageInfo().extensionMap(m.pointer()).Set(xt, v) - } -} -func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.mutable(m.pointer()) - } else { - return m.messageInfo().extensionMap(m.pointer()).Mutable(xt) - } -} -func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { - return fi.newField() - } else { - return xt.New() - } -} -func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - m.messageInfo().init() - if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { - return od.Fields().ByNumber(oi.which(m.pointer())) - } - panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName())) -} -func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields { - m.messageInfo().init() - return m.messageInfo().getUnknown(m.pointer()) -} -func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) { - m.messageInfo().init() - m.messageInfo().setUnknown(m.pointer(), b) -} -func (m *messageReflectWrapper) IsValid() bool { - return !m.pointer().IsNil() -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go deleted file mode 100644 index 67b4ede67..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build purego appengine - -package impl - -import ( - "fmt" - "reflect" - "sync" -) - -const UnsafeEnabled = false - -// Pointer is an opaque pointer type. -type Pointer interface{} - -// offset represents the offset to a struct field, accessible from a pointer. -// The offset is the field index into a struct. -type offset struct { - index int - export exporter -} - -// offsetOf returns a field offset for the struct field. -func offsetOf(f reflect.StructField, x exporter) offset { - if len(f.Index) != 1 { - panic("embedded structs are not supported") - } - if f.PkgPath == "" { - return offset{index: f.Index[0]} // field is already exported - } - if x == nil { - panic("exporter must be provided for unexported field") - } - return offset{index: f.Index[0], export: x} -} - -// IsValid reports whether the offset is valid. -func (f offset) IsValid() bool { return f.index >= 0 } - -// invalidOffset is an invalid field offset. -var invalidOffset = offset{index: -1} - -// zeroOffset is a noop when calling pointer.Apply. -var zeroOffset = offset{index: 0} - -// pointer is an abstract representation of a pointer to a struct or field. -type pointer struct{ v reflect.Value } - -// pointerOf returns p as a pointer. -func pointerOf(p Pointer) pointer { - return pointerOfIface(p) -} - -// pointerOfValue returns v as a pointer. -func pointerOfValue(v reflect.Value) pointer { - return pointer{v: v} -} - -// pointerOfIface returns the pointer portion of an interface. -func pointerOfIface(v interface{}) pointer { - return pointer{v: reflect.ValueOf(v)} -} - -// IsNil reports whether the pointer is nil. -func (p pointer) IsNil() bool { - return p.v.IsNil() -} - -// Apply adds an offset to the pointer to derive a new pointer -// to a specified field. The current pointer must be pointing at a struct. -func (p pointer) Apply(f offset) pointer { - if f.export != nil { - if v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() { - return pointer{v: v} - } - } - return pointer{v: p.v.Elem().Field(f.index).Addr()} -} - -// AsValueOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t)) -func (p pointer) AsValueOf(t reflect.Type) reflect.Value { - if got := p.v.Type().Elem(); got != t { - panic(fmt.Sprintf("invalid type: got %v, want %v", got, t)) - } - return p.v -} - -// AsIfaceOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to p.AsValueOf(t).Interface() -func (p pointer) AsIfaceOf(t reflect.Type) interface{} { - return p.AsValueOf(t).Interface() -} - -func (p pointer) Bool() *bool { return p.v.Interface().(*bool) } -func (p pointer) BoolPtr() **bool { return p.v.Interface().(**bool) } -func (p pointer) BoolSlice() *[]bool { return p.v.Interface().(*[]bool) } -func (p pointer) Int32() *int32 { return p.v.Interface().(*int32) } -func (p pointer) Int32Ptr() **int32 { return p.v.Interface().(**int32) } -func (p pointer) Int32Slice() *[]int32 { return p.v.Interface().(*[]int32) } -func (p pointer) Int64() *int64 { return p.v.Interface().(*int64) } -func (p pointer) Int64Ptr() **int64 { return p.v.Interface().(**int64) } -func (p pointer) Int64Slice() *[]int64 { return p.v.Interface().(*[]int64) } -func (p pointer) Uint32() *uint32 { return p.v.Interface().(*uint32) } -func (p pointer) Uint32Ptr() **uint32 { return p.v.Interface().(**uint32) } -func (p pointer) Uint32Slice() *[]uint32 { return p.v.Interface().(*[]uint32) } -func (p pointer) Uint64() *uint64 { return p.v.Interface().(*uint64) } -func (p pointer) Uint64Ptr() **uint64 { return p.v.Interface().(**uint64) } -func (p pointer) Uint64Slice() *[]uint64 { return p.v.Interface().(*[]uint64) } -func (p pointer) Float32() *float32 { return p.v.Interface().(*float32) } -func (p pointer) Float32Ptr() **float32 { return p.v.Interface().(**float32) } -func (p pointer) Float32Slice() *[]float32 { return p.v.Interface().(*[]float32) } -func (p pointer) Float64() *float64 { return p.v.Interface().(*float64) } -func (p pointer) Float64Ptr() **float64 { return p.v.Interface().(**float64) } -func (p pointer) Float64Slice() *[]float64 { return p.v.Interface().(*[]float64) } -func (p pointer) String() *string { return p.v.Interface().(*string) } -func (p pointer) StringPtr() **string { return p.v.Interface().(**string) } -func (p pointer) StringSlice() *[]string { return p.v.Interface().(*[]string) } -func (p pointer) Bytes() *[]byte { return p.v.Interface().(*[]byte) } -func (p pointer) BytesSlice() *[][]byte { return p.v.Interface().(*[][]byte) } -func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.v.Interface().(*WeakFields)) } -func (p pointer) Extensions() *map[int32]ExtensionField { - return p.v.Interface().(*map[int32]ExtensionField) -} - -func (p pointer) Elem() pointer { - return pointer{v: p.v.Elem()} -} - -// PointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) PointerSlice() []pointer { - // TODO: reconsider this - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// AppendPointerSlice appends v to p, which must be a []*T. -func (p pointer) AppendPointerSlice(v pointer) { - sp := p.v.Elem() - sp.Set(reflect.Append(sp, v.v)) -} - -// SetPointer sets *p to v. -func (p pointer) SetPointer(v pointer) { - p.v.Elem().Set(v.v) -} - -func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") } -func (ms *messageState) pointer() pointer { panic("not supported") } -func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") } -func (ms *messageState) LoadMessageInfo() *MessageInfo { panic("not supported") } -func (ms *messageState) StoreMessageInfo(mi *MessageInfo) { panic("not supported") } - -type atomicNilMessage struct { - once sync.Once - m messageReflectWrapper -} - -func (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper { - m.once.Do(func() { - m.m.p = pointerOfIface(reflect.Zero(mi.GoReflectType).Interface()) - m.m.mi = mi - }) - return &m.m -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go deleted file mode 100644 index 088aa85d4..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !purego,!appengine - -package impl - -import ( - "reflect" - "sync/atomic" - "unsafe" -) - -const UnsafeEnabled = true - -// Pointer is an opaque pointer type. -type Pointer unsafe.Pointer - -// offset represents the offset to a struct field, accessible from a pointer. -// The offset is the byte offset to the field from the start of the struct. -type offset uintptr - -// offsetOf returns a field offset for the struct field. -func offsetOf(f reflect.StructField, x exporter) offset { - return offset(f.Offset) -} - -// IsValid reports whether the offset is valid. -func (f offset) IsValid() bool { return f != invalidOffset } - -// invalidOffset is an invalid field offset. -var invalidOffset = ^offset(0) - -// zeroOffset is a noop when calling pointer.Apply. -var zeroOffset = offset(0) - -// pointer is a pointer to a message struct or field. -type pointer struct{ p unsafe.Pointer } - -// pointerOf returns p as a pointer. -func pointerOf(p Pointer) pointer { - return pointer{p: unsafe.Pointer(p)} -} - -// pointerOfValue returns v as a pointer. -func pointerOfValue(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// pointerOfIface returns the pointer portion of an interface. -func pointerOfIface(v interface{}) pointer { - type ifaceHeader struct { - Type unsafe.Pointer - Data unsafe.Pointer - } - return pointer{p: (*ifaceHeader)(unsafe.Pointer(&v)).Data} -} - -// IsNil reports whether the pointer is nil. -func (p pointer) IsNil() bool { - return p.p == nil -} - -// Apply adds an offset to the pointer to derive a new pointer -// to a specified field. The pointer must be valid and pointing at a struct. -func (p pointer) Apply(f offset) pointer { - if p.IsNil() { - panic("invalid nil pointer") - } - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -// AsValueOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t)) -func (p pointer) AsValueOf(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -// AsIfaceOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to p.AsValueOf(t).Interface() -func (p pointer) AsIfaceOf(t reflect.Type) interface{} { - // TODO: Use tricky unsafe magic to directly create ifaceHeader. - return p.AsValueOf(t).Interface() -} - -func (p pointer) Bool() *bool { return (*bool)(p.p) } -func (p pointer) BoolPtr() **bool { return (**bool)(p.p) } -func (p pointer) BoolSlice() *[]bool { return (*[]bool)(p.p) } -func (p pointer) Int32() *int32 { return (*int32)(p.p) } -func (p pointer) Int32Ptr() **int32 { return (**int32)(p.p) } -func (p pointer) Int32Slice() *[]int32 { return (*[]int32)(p.p) } -func (p pointer) Int64() *int64 { return (*int64)(p.p) } -func (p pointer) Int64Ptr() **int64 { return (**int64)(p.p) } -func (p pointer) Int64Slice() *[]int64 { return (*[]int64)(p.p) } -func (p pointer) Uint32() *uint32 { return (*uint32)(p.p) } -func (p pointer) Uint32Ptr() **uint32 { return (**uint32)(p.p) } -func (p pointer) Uint32Slice() *[]uint32 { return (*[]uint32)(p.p) } -func (p pointer) Uint64() *uint64 { return (*uint64)(p.p) } -func (p pointer) Uint64Ptr() **uint64 { return (**uint64)(p.p) } -func (p pointer) Uint64Slice() *[]uint64 { return (*[]uint64)(p.p) } -func (p pointer) Float32() *float32 { return (*float32)(p.p) } -func (p pointer) Float32Ptr() **float32 { return (**float32)(p.p) } -func (p pointer) Float32Slice() *[]float32 { return (*[]float32)(p.p) } -func (p pointer) Float64() *float64 { return (*float64)(p.p) } -func (p pointer) Float64Ptr() **float64 { return (**float64)(p.p) } -func (p pointer) Float64Slice() *[]float64 { return (*[]float64)(p.p) } -func (p pointer) String() *string { return (*string)(p.p) } -func (p pointer) StringPtr() **string { return (**string)(p.p) } -func (p pointer) StringSlice() *[]string { return (*[]string)(p.p) } -func (p pointer) Bytes() *[]byte { return (*[]byte)(p.p) } -func (p pointer) BytesSlice() *[][]byte { return (*[][]byte)(p.p) } -func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.p) } -func (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) } - -func (p pointer) Elem() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// PointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) PointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// AppendPointerSlice appends v to p, which must be a []*T. -func (p pointer) AppendPointerSlice(v pointer) { - *(*[]pointer)(p.p) = append(*(*[]pointer)(p.p), v) -} - -// SetPointer sets *p to v. -func (p pointer) SetPointer(v pointer) { - *(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p) -} - -// Static check that MessageState does not exceed the size of a pointer. -const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{})) - -func (Export) MessageStateOf(p Pointer) *messageState { - // Super-tricky - see documentation on MessageState. - return (*messageState)(unsafe.Pointer(p)) -} -func (ms *messageState) pointer() pointer { - // Super-tricky - see documentation on MessageState. - return pointer{p: unsafe.Pointer(ms)} -} -func (ms *messageState) messageInfo() *MessageInfo { - mi := ms.LoadMessageInfo() - if mi == nil { - panic("invalid nil message info; this suggests memory corruption due to a race or shallow copy on the message struct") - } - return mi -} -func (ms *messageState) LoadMessageInfo() *MessageInfo { - return (*MessageInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo)))) -} -func (ms *messageState) StoreMessageInfo(mi *MessageInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo)), unsafe.Pointer(mi)) -} - -type atomicNilMessage struct{ p unsafe.Pointer } // p is a *messageReflectWrapper - -func (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper { - if p := atomic.LoadPointer(&m.p); p != nil { - return (*messageReflectWrapper)(p) - } - w := &messageReflectWrapper{mi: mi} - atomic.CompareAndSwapPointer(&m.p, nil, (unsafe.Pointer)(w)) - return (*messageReflectWrapper)(atomic.LoadPointer(&m.p)) -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/validate.go b/vendor/google.golang.org/protobuf/internal/impl/validate.go deleted file mode 100644 index 08cfb6054..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/validate.go +++ /dev/null @@ -1,576 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - "math" - "math/bits" - "reflect" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/strs" - pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" - piface "google.golang.org/protobuf/runtime/protoiface" -) - -// ValidationStatus is the result of validating the wire-format encoding of a message. -type ValidationStatus int - -const ( - // ValidationUnknown indicates that unmarshaling the message might succeed or fail. - // The validator was unable to render a judgement. - // - // The only causes of this status are an aberrant message type appearing somewhere - // in the message or a failure in the extension resolver. - ValidationUnknown ValidationStatus = iota + 1 - - // ValidationInvalid indicates that unmarshaling the message will fail. - ValidationInvalid - - // ValidationValid indicates that unmarshaling the message will succeed. - ValidationValid -) - -func (v ValidationStatus) String() string { - switch v { - case ValidationUnknown: - return "ValidationUnknown" - case ValidationInvalid: - return "ValidationInvalid" - case ValidationValid: - return "ValidationValid" - default: - return fmt.Sprintf("ValidationStatus(%d)", int(v)) - } -} - -// Validate determines whether the contents of the buffer are a valid wire encoding -// of the message type. -// -// This function is exposed for testing. -func Validate(mt pref.MessageType, in piface.UnmarshalInput) (out piface.UnmarshalOutput, _ ValidationStatus) { - mi, ok := mt.(*MessageInfo) - if !ok { - return out, ValidationUnknown - } - if in.Resolver == nil { - in.Resolver = preg.GlobalTypes - } - o, st := mi.validate(in.Buf, 0, unmarshalOptions{ - flags: in.Flags, - resolver: in.Resolver, - }) - if o.initialized { - out.Flags |= piface.UnmarshalInitialized - } - return out, st -} - -type validationInfo struct { - mi *MessageInfo - typ validationType - keyType, valType validationType - - // For non-required fields, requiredBit is 0. - // - // For required fields, requiredBit's nth bit is set, where n is a - // unique index in the range [0, MessageInfo.numRequiredFields). - // - // If there are more than 64 required fields, requiredBit is 0. - requiredBit uint64 -} - -type validationType uint8 - -const ( - validationTypeOther validationType = iota - validationTypeMessage - validationTypeGroup - validationTypeMap - validationTypeRepeatedVarint - validationTypeRepeatedFixed32 - validationTypeRepeatedFixed64 - validationTypeVarint - validationTypeFixed32 - validationTypeFixed64 - validationTypeBytes - validationTypeUTF8String - validationTypeMessageSetItem -) - -func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescriptor, ft reflect.Type) validationInfo { - var vi validationInfo - switch { - case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): - switch fd.Kind() { - case pref.MessageKind: - vi.typ = validationTypeMessage - if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok { - vi.mi = getMessageInfo(ot.Field(0).Type) - } - case pref.GroupKind: - vi.typ = validationTypeGroup - if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok { - vi.mi = getMessageInfo(ot.Field(0).Type) - } - case pref.StringKind: - if strs.EnforceUTF8(fd) { - vi.typ = validationTypeUTF8String - } - } - default: - vi = newValidationInfo(fd, ft) - } - if fd.Cardinality() == pref.Required { - // Avoid overflow. The required field check is done with a 64-bit mask, with - // any message containing more than 64 required fields always reported as - // potentially uninitialized, so it is not important to get a precise count - // of the required fields past 64. - if mi.numRequiredFields < math.MaxUint8 { - mi.numRequiredFields++ - vi.requiredBit = 1 << (mi.numRequiredFields - 1) - } - } - return vi -} - -func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo { - var vi validationInfo - switch { - case fd.IsList(): - switch fd.Kind() { - case pref.MessageKind: - vi.typ = validationTypeMessage - if ft.Kind() == reflect.Slice { - vi.mi = getMessageInfo(ft.Elem()) - } - case pref.GroupKind: - vi.typ = validationTypeGroup - if ft.Kind() == reflect.Slice { - vi.mi = getMessageInfo(ft.Elem()) - } - case pref.StringKind: - vi.typ = validationTypeBytes - if strs.EnforceUTF8(fd) { - vi.typ = validationTypeUTF8String - } - default: - switch wireTypes[fd.Kind()] { - case protowire.VarintType: - vi.typ = validationTypeRepeatedVarint - case protowire.Fixed32Type: - vi.typ = validationTypeRepeatedFixed32 - case protowire.Fixed64Type: - vi.typ = validationTypeRepeatedFixed64 - } - } - case fd.IsMap(): - vi.typ = validationTypeMap - switch fd.MapKey().Kind() { - case pref.StringKind: - if strs.EnforceUTF8(fd) { - vi.keyType = validationTypeUTF8String - } - } - switch fd.MapValue().Kind() { - case pref.MessageKind: - vi.valType = validationTypeMessage - if ft.Kind() == reflect.Map { - vi.mi = getMessageInfo(ft.Elem()) - } - case pref.StringKind: - if strs.EnforceUTF8(fd) { - vi.valType = validationTypeUTF8String - } - } - default: - switch fd.Kind() { - case pref.MessageKind: - vi.typ = validationTypeMessage - if !fd.IsWeak() { - vi.mi = getMessageInfo(ft) - } - case pref.GroupKind: - vi.typ = validationTypeGroup - vi.mi = getMessageInfo(ft) - case pref.StringKind: - vi.typ = validationTypeBytes - if strs.EnforceUTF8(fd) { - vi.typ = validationTypeUTF8String - } - default: - switch wireTypes[fd.Kind()] { - case protowire.VarintType: - vi.typ = validationTypeVarint - case protowire.Fixed32Type: - vi.typ = validationTypeFixed32 - case protowire.Fixed64Type: - vi.typ = validationTypeFixed64 - case protowire.BytesType: - vi.typ = validationTypeBytes - } - } - } - return vi -} - -func (mi *MessageInfo) validate(b []byte, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, result ValidationStatus) { - mi.init() - type validationState struct { - typ validationType - keyType, valType validationType - endGroup protowire.Number - mi *MessageInfo - tail []byte - requiredMask uint64 - } - - // Pre-allocate some slots to avoid repeated slice reallocation. - states := make([]validationState, 0, 16) - states = append(states, validationState{ - typ: validationTypeMessage, - mi: mi, - }) - if groupTag > 0 { - states[0].typ = validationTypeGroup - states[0].endGroup = groupTag - } - initialized := true - start := len(b) -State: - for len(states) > 0 { - st := &states[len(states)-1] - for len(b) > 0 { - // Parse the tag (field number and wire type). - var tag uint64 - if b[0] < 0x80 { - tag = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - tag = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - tag, n = protowire.ConsumeVarint(b) - if n < 0 { - return out, ValidationInvalid - } - b = b[n:] - } - var num protowire.Number - if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) { - return out, ValidationInvalid - } else { - num = protowire.Number(n) - } - wtyp := protowire.Type(tag & 7) - - if wtyp == protowire.EndGroupType { - if st.endGroup == num { - goto PopState - } - return out, ValidationInvalid - } - var vi validationInfo - switch { - case st.typ == validationTypeMap: - switch num { - case genid.MapEntry_Key_field_number: - vi.typ = st.keyType - case genid.MapEntry_Value_field_number: - vi.typ = st.valType - vi.mi = st.mi - vi.requiredBit = 1 - } - case flags.ProtoLegacy && st.mi.isMessageSet: - switch num { - case messageset.FieldItem: - vi.typ = validationTypeMessageSetItem - } - default: - var f *coderFieldInfo - if int(num) < len(st.mi.denseCoderFields) { - f = st.mi.denseCoderFields[num] - } else { - f = st.mi.coderFields[num] - } - if f != nil { - vi = f.validation - if vi.typ == validationTypeMessage && vi.mi == nil { - // Probable weak field. - // - // TODO: Consider storing the results of this lookup somewhere - // rather than recomputing it on every validation. - fd := st.mi.Desc.Fields().ByNumber(num) - if fd == nil || !fd.IsWeak() { - break - } - messageName := fd.Message().FullName() - messageType, err := preg.GlobalTypes.FindMessageByName(messageName) - switch err { - case nil: - vi.mi, _ = messageType.(*MessageInfo) - case preg.NotFound: - vi.typ = validationTypeBytes - default: - return out, ValidationUnknown - } - } - break - } - // Possible extension field. - // - // TODO: We should return ValidationUnknown when: - // 1. The resolver is not frozen. (More extensions may be added to it.) - // 2. The resolver returns preg.NotFound. - // In this case, a type added to the resolver in the future could cause - // unmarshaling to begin failing. Supporting this requires some way to - // determine if the resolver is frozen. - xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num) - if err != nil && err != preg.NotFound { - return out, ValidationUnknown - } - if err == nil { - vi = getExtensionFieldInfo(xt).validation - } - } - if vi.requiredBit != 0 { - // Check that the field has a compatible wire type. - // We only need to consider non-repeated field types, - // since repeated fields (and maps) can never be required. - ok := false - switch vi.typ { - case validationTypeVarint: - ok = wtyp == protowire.VarintType - case validationTypeFixed32: - ok = wtyp == protowire.Fixed32Type - case validationTypeFixed64: - ok = wtyp == protowire.Fixed64Type - case validationTypeBytes, validationTypeUTF8String, validationTypeMessage: - ok = wtyp == protowire.BytesType - case validationTypeGroup: - ok = wtyp == protowire.StartGroupType - } - if ok { - st.requiredMask |= vi.requiredBit - } - } - - switch wtyp { - case protowire.VarintType: - if len(b) >= 10 { - switch { - case b[0] < 0x80: - b = b[1:] - case b[1] < 0x80: - b = b[2:] - case b[2] < 0x80: - b = b[3:] - case b[3] < 0x80: - b = b[4:] - case b[4] < 0x80: - b = b[5:] - case b[5] < 0x80: - b = b[6:] - case b[6] < 0x80: - b = b[7:] - case b[7] < 0x80: - b = b[8:] - case b[8] < 0x80: - b = b[9:] - case b[9] < 0x80 && b[9] < 2: - b = b[10:] - default: - return out, ValidationInvalid - } - } else { - switch { - case len(b) > 0 && b[0] < 0x80: - b = b[1:] - case len(b) > 1 && b[1] < 0x80: - b = b[2:] - case len(b) > 2 && b[2] < 0x80: - b = b[3:] - case len(b) > 3 && b[3] < 0x80: - b = b[4:] - case len(b) > 4 && b[4] < 0x80: - b = b[5:] - case len(b) > 5 && b[5] < 0x80: - b = b[6:] - case len(b) > 6 && b[6] < 0x80: - b = b[7:] - case len(b) > 7 && b[7] < 0x80: - b = b[8:] - case len(b) > 8 && b[8] < 0x80: - b = b[9:] - case len(b) > 9 && b[9] < 2: - b = b[10:] - default: - return out, ValidationInvalid - } - } - continue State - case protowire.BytesType: - var size uint64 - if len(b) >= 1 && b[0] < 0x80 { - size = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - size = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - size, n = protowire.ConsumeVarint(b) - if n < 0 { - return out, ValidationInvalid - } - b = b[n:] - } - if size > uint64(len(b)) { - return out, ValidationInvalid - } - v := b[:size] - b = b[size:] - switch vi.typ { - case validationTypeMessage: - if vi.mi == nil { - return out, ValidationUnknown - } - vi.mi.init() - fallthrough - case validationTypeMap: - if vi.mi != nil { - vi.mi.init() - } - states = append(states, validationState{ - typ: vi.typ, - keyType: vi.keyType, - valType: vi.valType, - mi: vi.mi, - tail: b, - }) - b = v - continue State - case validationTypeRepeatedVarint: - // Packed field. - for len(v) > 0 { - _, n := protowire.ConsumeVarint(v) - if n < 0 { - return out, ValidationInvalid - } - v = v[n:] - } - case validationTypeRepeatedFixed32: - // Packed field. - if len(v)%4 != 0 { - return out, ValidationInvalid - } - case validationTypeRepeatedFixed64: - // Packed field. - if len(v)%8 != 0 { - return out, ValidationInvalid - } - case validationTypeUTF8String: - if !utf8.Valid(v) { - return out, ValidationInvalid - } - } - case protowire.Fixed32Type: - if len(b) < 4 { - return out, ValidationInvalid - } - b = b[4:] - case protowire.Fixed64Type: - if len(b) < 8 { - return out, ValidationInvalid - } - b = b[8:] - case protowire.StartGroupType: - switch { - case vi.typ == validationTypeGroup: - if vi.mi == nil { - return out, ValidationUnknown - } - vi.mi.init() - states = append(states, validationState{ - typ: validationTypeGroup, - mi: vi.mi, - endGroup: num, - }) - continue State - case flags.ProtoLegacy && vi.typ == validationTypeMessageSetItem: - typeid, v, n, err := messageset.ConsumeFieldValue(b, false) - if err != nil { - return out, ValidationInvalid - } - xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid) - switch { - case err == preg.NotFound: - b = b[n:] - case err != nil: - return out, ValidationUnknown - default: - xvi := getExtensionFieldInfo(xt).validation - if xvi.mi != nil { - xvi.mi.init() - } - states = append(states, validationState{ - typ: xvi.typ, - mi: xvi.mi, - tail: b[n:], - }) - b = v - continue State - } - default: - n := protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return out, ValidationInvalid - } - b = b[n:] - } - default: - return out, ValidationInvalid - } - } - if st.endGroup != 0 { - return out, ValidationInvalid - } - if len(b) != 0 { - return out, ValidationInvalid - } - b = st.tail - PopState: - numRequiredFields := 0 - switch st.typ { - case validationTypeMessage, validationTypeGroup: - numRequiredFields = int(st.mi.numRequiredFields) - case validationTypeMap: - // If this is a map field with a message value that contains - // required fields, require that the value be present. - if st.mi != nil && st.mi.numRequiredFields > 0 { - numRequiredFields = 1 - } - } - // If there are more than 64 required fields, this check will - // always fail and we will report that the message is potentially - // uninitialized. - if numRequiredFields > 0 && bits.OnesCount64(st.requiredMask) != numRequiredFields { - initialized = false - } - states = states[:len(states)-1] - } - out.n = start - len(b) - if initialized { - out.initialized = true - } - return out, ValidationValid -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/weak.go b/vendor/google.golang.org/protobuf/internal/impl/weak.go deleted file mode 100644 index 009cbefd1..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/weak.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package impl - -import ( - "fmt" - - pref "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -// weakFields adds methods to the exported WeakFields type for internal use. -// -// The exported type is an alias to an unnamed type, so methods can't be -// defined directly on it. -type weakFields WeakFields - -func (w weakFields) get(num pref.FieldNumber) (pref.ProtoMessage, bool) { - m, ok := w[int32(num)] - return m, ok -} - -func (w *weakFields) set(num pref.FieldNumber, m pref.ProtoMessage) { - if *w == nil { - *w = make(weakFields) - } - (*w)[int32(num)] = m -} - -func (w *weakFields) clear(num pref.FieldNumber) { - delete(*w, int32(num)) -} - -func (Export) HasWeak(w WeakFields, num pref.FieldNumber) bool { - _, ok := w[int32(num)] - return ok -} - -func (Export) ClearWeak(w *WeakFields, num pref.FieldNumber) { - delete(*w, int32(num)) -} - -func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pref.ProtoMessage { - if m, ok := w[int32(num)]; ok { - return m - } - mt, _ := protoregistry.GlobalTypes.FindMessageByName(name) - if mt == nil { - panic(fmt.Sprintf("message %v for weak field is not linked in", name)) - } - return mt.Zero().Interface() -} - -func (Export) SetWeak(w *WeakFields, num pref.FieldNumber, name pref.FullName, m pref.ProtoMessage) { - if m != nil { - mt, _ := protoregistry.GlobalTypes.FindMessageByName(name) - if mt == nil { - panic(fmt.Sprintf("message %v for weak field is not linked in", name)) - } - if mt != m.ProtoReflect().Type() { - panic(fmt.Sprintf("invalid message type for weak field: got %T, want %T", m, mt.Zero().Interface())) - } - } - if m == nil || !m.ProtoReflect().IsValid() { - delete(*w, int32(num)) - return - } - if *w == nil { - *w = make(weakFields) - } - (*w)[int32(num)] = m -} diff --git a/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go b/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go deleted file mode 100644 index a3de1cf32..000000000 --- a/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package mapsort provides sorted access to maps. -package mapsort - -import ( - "sort" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Range iterates over every map entry in sorted key order, -// calling f for each key and value encountered. -func Range(mapv protoreflect.Map, keyKind protoreflect.Kind, f func(protoreflect.MapKey, protoreflect.Value) bool) { - var keys []protoreflect.MapKey - mapv.Range(func(key protoreflect.MapKey, _ protoreflect.Value) bool { - keys = append(keys, key) - return true - }) - sort.Slice(keys, func(i, j int) bool { - switch keyKind { - case protoreflect.BoolKind: - return !keys[i].Bool() && keys[j].Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, - protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return keys[i].Int() < keys[j].Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, - protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return keys[i].Uint() < keys[j].Uint() - case protoreflect.StringKind: - return keys[i].String() < keys[j].String() - default: - panic("invalid kind: " + keyKind.String()) - } - }) - for _, key := range keys { - if !f(key, mapv.Get(key)) { - break - } - } -} diff --git a/vendor/google.golang.org/protobuf/internal/pragma/pragma.go b/vendor/google.golang.org/protobuf/internal/pragma/pragma.go deleted file mode 100644 index 49dc4fcd9..000000000 --- a/vendor/google.golang.org/protobuf/internal/pragma/pragma.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package pragma provides types that can be embedded into a struct to -// statically enforce or prevent certain language properties. -package pragma - -import "sync" - -// NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals. -type NoUnkeyedLiterals struct{} - -// DoNotImplement can be embedded in an interface to prevent trivial -// implementations of the interface. -// -// This is useful to prevent unauthorized implementations of an interface -// so that it can be extended in the future for any protobuf language changes. -type DoNotImplement interface{ ProtoInternal(DoNotImplement) } - -// DoNotCompare can be embedded in a struct to prevent comparability. -type DoNotCompare [0]func() - -// DoNotCopy can be embedded in a struct to help prevent shallow copies. -// This does not rely on a Go language feature, but rather a special case -// within the vet checker. -// -// See https://golang.org/issues/8005. -type DoNotCopy [0]sync.Mutex diff --git a/vendor/google.golang.org/protobuf/internal/set/ints.go b/vendor/google.golang.org/protobuf/internal/set/ints.go deleted file mode 100644 index d3d7f89ab..000000000 --- a/vendor/google.golang.org/protobuf/internal/set/ints.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package set provides simple set data structures for uint64s. -package set - -import "math/bits" - -// int64s represents a set of integers within the range of 0..63. -type int64s uint64 - -func (bs *int64s) Len() int { - return bits.OnesCount64(uint64(*bs)) -} -func (bs *int64s) Has(n uint64) bool { - return uint64(*bs)&(uint64(1)< 0 -} -func (bs *int64s) Set(n uint64) { - *(*uint64)(bs) |= uint64(1) << n -} -func (bs *int64s) Clear(n uint64) { - *(*uint64)(bs) &^= uint64(1) << n -} - -// Ints represents a set of integers within the range of 0..math.MaxUint64. -type Ints struct { - lo int64s - hi map[uint64]struct{} -} - -func (bs *Ints) Len() int { - return bs.lo.Len() + len(bs.hi) -} -func (bs *Ints) Has(n uint64) bool { - if n < 64 { - return bs.lo.Has(n) - } - _, ok := bs.hi[n] - return ok -} -func (bs *Ints) Set(n uint64) { - if n < 64 { - bs.lo.Set(n) - return - } - if bs.hi == nil { - bs.hi = make(map[uint64]struct{}) - } - bs.hi[n] = struct{}{} -} -func (bs *Ints) Clear(n uint64) { - if n < 64 { - bs.lo.Clear(n) - return - } - delete(bs.hi, n) -} diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings.go b/vendor/google.golang.org/protobuf/internal/strs/strings.go deleted file mode 100644 index 0b74e7658..000000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package strs provides string manipulation functionality specific to protobuf. -package strs - -import ( - "go/token" - "strings" - "unicode" - "unicode/utf8" - - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// EnforceUTF8 reports whether to enforce strict UTF-8 validation. -func EnforceUTF8(fd protoreflect.FieldDescriptor) bool { - if flags.ProtoLegacy { - if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok { - return fd.EnforceUTF8() - } - } - return fd.Syntax() == protoreflect.Proto3 -} - -// GoCamelCase camel-cases a protobuf name for use as a Go identifier. -// -// If there is an interior underscore followed by a lower case letter, -// drop the underscore and convert the letter to upper case. -func GoCamelCase(s string) string { - // Invariant: if the next letter is lower case, it must be converted - // to upper case. - // That is, we process a word at a time, where words are marked by _ or - // upper case letter. Digits are treated as words. - var b []byte - for i := 0; i < len(s); i++ { - c := s[i] - switch { - case c == '.' && i+1 < len(s) && isASCIILower(s[i+1]): - // Skip over '.' in ".{{lowercase}}". - case c == '.': - b = append(b, '_') // convert '.' to '_' - case c == '_' && (i == 0 || s[i-1] == '.'): - // Convert initial '_' to ensure we start with a capital letter. - // Do the same for '_' after '.' to match historic behavior. - b = append(b, 'X') // convert '_' to 'X' - case c == '_' && i+1 < len(s) && isASCIILower(s[i+1]): - // Skip over '_' in "_{{lowercase}}". - case isASCIIDigit(c): - b = append(b, c) - default: - // Assume we have a letter now - if not, it's a bogus identifier. - // The next word is a sequence of characters that must start upper case. - if isASCIILower(c) { - c -= 'a' - 'A' // convert lowercase to uppercase - } - b = append(b, c) - - // Accept lower case sequence that follows. - for ; i+1 < len(s) && isASCIILower(s[i+1]); i++ { - b = append(b, s[i+1]) - } - } - } - return string(b) -} - -// GoSanitized converts a string to a valid Go identifier. -func GoSanitized(s string) string { - // Sanitize the input to the set of valid characters, - // which must be '_' or be in the Unicode L or N categories. - s = strings.Map(func(r rune) rune { - if unicode.IsLetter(r) || unicode.IsDigit(r) { - return r - } - return '_' - }, s) - - // Prepend '_' in the event of a Go keyword conflict or if - // the identifier is invalid (does not start in the Unicode L category). - r, _ := utf8.DecodeRuneInString(s) - if token.Lookup(s).IsKeyword() || !unicode.IsLetter(r) { - return "_" + s - } - return s -} - -// JSONCamelCase converts a snake_case identifier to a camelCase identifier, -// according to the protobuf JSON specification. -func JSONCamelCase(s string) string { - var b []byte - var wasUnderscore bool - for i := 0; i < len(s); i++ { // proto identifiers are always ASCII - c := s[i] - if c != '_' { - if wasUnderscore && isASCIILower(c) { - c -= 'a' - 'A' // convert to uppercase - } - b = append(b, c) - } - wasUnderscore = c == '_' - } - return string(b) -} - -// JSONSnakeCase converts a camelCase identifier to a snake_case identifier, -// according to the protobuf JSON specification. -func JSONSnakeCase(s string) string { - var b []byte - for i := 0; i < len(s); i++ { // proto identifiers are always ASCII - c := s[i] - if isASCIIUpper(c) { - b = append(b, '_') - c += 'a' - 'A' // convert to lowercase - } - b = append(b, c) - } - return string(b) -} - -// MapEntryName derives the name of the map entry message given the field name. -// See protoc v3.8.0: src/google/protobuf/descriptor.cc:254-276,6057 -func MapEntryName(s string) string { - var b []byte - upperNext := true - for _, c := range s { - switch { - case c == '_': - upperNext = true - case upperNext: - b = append(b, byte(unicode.ToUpper(c))) - upperNext = false - default: - b = append(b, byte(c)) - } - } - b = append(b, "Entry"...) - return string(b) -} - -// EnumValueName derives the camel-cased enum value name. -// See protoc v3.8.0: src/google/protobuf/descriptor.cc:297-313 -func EnumValueName(s string) string { - var b []byte - upperNext := true - for _, c := range s { - switch { - case c == '_': - upperNext = true - case upperNext: - b = append(b, byte(unicode.ToUpper(c))) - upperNext = false - default: - b = append(b, byte(unicode.ToLower(c))) - upperNext = false - } - } - return string(b) -} - -// TrimEnumPrefix trims the enum name prefix from an enum value name, -// where the prefix is all lowercase without underscores. -// See protoc v3.8.0: src/google/protobuf/descriptor.cc:330-375 -func TrimEnumPrefix(s, prefix string) string { - s0 := s // original input - for len(s) > 0 && len(prefix) > 0 { - if s[0] == '_' { - s = s[1:] - continue - } - if unicode.ToLower(rune(s[0])) != rune(prefix[0]) { - return s0 // no prefix match - } - s, prefix = s[1:], prefix[1:] - } - if len(prefix) > 0 { - return s0 // no prefix match - } - s = strings.TrimLeft(s, "_") - if len(s) == 0 { - return s0 // avoid returning empty string - } - return s -} - -func isASCIILower(c byte) bool { - return 'a' <= c && c <= 'z' -} -func isASCIIUpper(c byte) bool { - return 'A' <= c && c <= 'Z' -} -func isASCIIDigit(c byte) bool { - return '0' <= c && c <= '9' -} diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go b/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go deleted file mode 100644 index 85e074c97..000000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build purego appengine - -package strs - -import pref "google.golang.org/protobuf/reflect/protoreflect" - -func UnsafeString(b []byte) string { - return string(b) -} - -func UnsafeBytes(s string) []byte { - return []byte(s) -} - -type Builder struct{} - -func (*Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName { - return prefix.Append(name) -} - -func (*Builder) MakeString(b []byte) string { - return string(b) -} diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go deleted file mode 100644 index 2160c7019..000000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !purego,!appengine - -package strs - -import ( - "unsafe" - - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -type ( - stringHeader struct { - Data unsafe.Pointer - Len int - } - sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int - } -) - -// UnsafeString returns an unsafe string reference of b. -// The caller must treat the input slice as immutable. -// -// WARNING: Use carefully. The returned result must not leak to the end user -// unless the input slice is provably immutable. -func UnsafeString(b []byte) (s string) { - src := (*sliceHeader)(unsafe.Pointer(&b)) - dst := (*stringHeader)(unsafe.Pointer(&s)) - dst.Data = src.Data - dst.Len = src.Len - return s -} - -// UnsafeBytes returns an unsafe bytes slice reference of s. -// The caller must treat returned slice as immutable. -// -// WARNING: Use carefully. The returned result must not leak to the end user. -func UnsafeBytes(s string) (b []byte) { - src := (*stringHeader)(unsafe.Pointer(&s)) - dst := (*sliceHeader)(unsafe.Pointer(&b)) - dst.Data = src.Data - dst.Len = src.Len - dst.Cap = src.Len - return b -} - -// Builder builds a set of strings with shared lifetime. -// This differs from strings.Builder, which is for building a single string. -type Builder struct { - buf []byte -} - -// AppendFullName is equivalent to protoreflect.FullName.Append, -// but optimized for large batches where each name has a shared lifetime. -func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName { - n := len(prefix) + len(".") + len(name) - if len(prefix) == 0 { - n -= len(".") - } - sb.grow(n) - sb.buf = append(sb.buf, prefix...) - sb.buf = append(sb.buf, '.') - sb.buf = append(sb.buf, name...) - return pref.FullName(sb.last(n)) -} - -// MakeString is equivalent to string(b), but optimized for large batches -// with a shared lifetime. -func (sb *Builder) MakeString(b []byte) string { - sb.grow(len(b)) - sb.buf = append(sb.buf, b...) - return sb.last(len(b)) -} - -func (sb *Builder) grow(n int) { - if cap(sb.buf)-len(sb.buf) >= n { - return - } - - // Unlike strings.Builder, we do not need to copy over the contents - // of the old buffer since our builder provides no API for - // retrieving previously created strings. - sb.buf = make([]byte, 2*(cap(sb.buf)+n)) -} - -func (sb *Builder) last(n int) string { - return UnsafeString(sb.buf[len(sb.buf)-n:]) -} diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go deleted file mode 100644 index 72cf770b4..000000000 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package version records versioning information about this module. -package version - -import ( - "fmt" - "strings" -) - -// These constants determine the current version of this module. -// -// -// For our release process, we enforce the following rules: -// * Tagged releases use a tag that is identical to String. -// * Tagged releases never reference a commit where the String -// contains "devel". -// * The set of all commits in this repository where String -// does not contain "devel" must have a unique String. -// -// -// Steps for tagging a new release: -// 1. Create a new CL. -// -// 2. Update Minor, Patch, and/or PreRelease as necessary. -// PreRelease must not contain the string "devel". -// -// 3. Since the last released minor version, have there been any changes to -// generator that relies on new functionality in the runtime? -// If yes, then increment RequiredGenerated. -// -// 4. Since the last released minor version, have there been any changes to -// the runtime that removes support for old .pb.go source code? -// If yes, then increment SupportMinimum. -// -// 5. Send out the CL for review and submit it. -// Note that the next CL in step 8 must be submitted after this CL -// without any other CLs in-between. -// -// 6. Tag a new version, where the tag is is the current String. -// -// 7. Write release notes for all notable changes -// between this release and the last release. -// -// 8. Create a new CL. -// -// 9. Update PreRelease to include the string "devel". -// For example: "" -> "devel" or "rc.1" -> "rc.1.devel" -// -// 10. Send out the CL for review and submit it. -const ( - Major = 1 - Minor = 25 - Patch = 0 - PreRelease = "" -) - -// String formats the version string for this module in semver format. -// -// Examples: -// v1.20.1 -// v1.21.0-rc.1 -func String() string { - v := fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch) - if PreRelease != "" { - v += "-" + PreRelease - - // TODO: Add metadata about the commit or build hash. - // See https://golang.org/issue/29814 - // See https://golang.org/issue/33533 - var metadata string - if strings.Contains(PreRelease, "devel") && metadata != "" { - v += "+" + metadata - } - } - return v -} diff --git a/vendor/google.golang.org/protobuf/proto/checkinit.go b/vendor/google.golang.org/protobuf/proto/checkinit.go deleted file mode 100644 index 3e9a6a2f6..000000000 --- a/vendor/google.golang.org/protobuf/proto/checkinit.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -// CheckInitialized returns an error if any required fields in m are not set. -func CheckInitialized(m Message) error { - // Treat a nil message interface as an "untyped" empty message, - // which we assume to have no required fields. - if m == nil { - return nil - } - - return checkInitialized(m.ProtoReflect()) -} - -// CheckInitialized returns an error if any required fields in m are not set. -func checkInitialized(m protoreflect.Message) error { - if methods := protoMethods(m); methods != nil && methods.CheckInitialized != nil { - _, err := methods.CheckInitialized(protoiface.CheckInitializedInput{ - Message: m, - }) - return err - } - return checkInitializedSlow(m) -} - -func checkInitializedSlow(m protoreflect.Message) error { - md := m.Descriptor() - fds := md.Fields() - for i, nums := 0, md.RequiredNumbers(); i < nums.Len(); i++ { - fd := fds.ByNumber(nums.Get(i)) - if !m.Has(fd) { - return errors.RequiredNotSet(string(fd.FullName())) - } - } - var err error - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - switch { - case fd.IsList(): - if fd.Message() == nil { - return true - } - for i, list := 0, v.List(); i < list.Len() && err == nil; i++ { - err = checkInitialized(list.Get(i).Message()) - } - case fd.IsMap(): - if fd.MapValue().Message() == nil { - return true - } - v.Map().Range(func(key protoreflect.MapKey, v protoreflect.Value) bool { - err = checkInitialized(v.Message()) - return err == nil - }) - default: - if fd.Message() == nil { - return true - } - err = checkInitialized(v.Message()) - } - return err == nil - }) - return err -} diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go deleted file mode 100644 index 42fc5195e..000000000 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoiface" -) - -// UnmarshalOptions configures the unmarshaler. -// -// Example usage: -// err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m) -type UnmarshalOptions struct { - pragma.NoUnkeyedLiterals - - // Merge merges the input into the destination message. - // The default behavior is to always reset the message before unmarshaling, - // unless Merge is specified. - Merge bool - - // AllowPartial accepts input for messages that will result in missing - // required fields. If AllowPartial is false (the default), Unmarshal will - // return an error if there are any missing required fields. - AllowPartial bool - - // If DiscardUnknown is set, unknown fields are ignored. - DiscardUnknown bool - - // Resolver is used for looking up types when unmarshaling extension fields. - // If nil, this defaults to using protoregistry.GlobalTypes. - Resolver interface { - FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) - FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) - } -} - -// Unmarshal parses the wire-format message in b and places the result in m. -func Unmarshal(b []byte, m Message) error { - _, err := UnmarshalOptions{}.unmarshal(b, m.ProtoReflect()) - return err -} - -// Unmarshal parses the wire-format message in b and places the result in m. -func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error { - _, err := o.unmarshal(b, m.ProtoReflect()) - return err -} - -// UnmarshalState parses a wire-format message and places the result in m. -// -// This method permits fine-grained control over the unmarshaler. -// Most users should use Unmarshal instead. -func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - return o.unmarshal(in.Buf, in.Message) -} - -// unmarshal is a centralized function that all unmarshal operations go through. -// For profiling purposes, avoid changing the name of this function or -// introducing other code paths for unmarshal that do not go through this. -func (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out protoiface.UnmarshalOutput, err error) { - if o.Resolver == nil { - o.Resolver = protoregistry.GlobalTypes - } - if !o.Merge { - Reset(m.Interface()) - } - allowPartial := o.AllowPartial - o.Merge = true - o.AllowPartial = true - methods := protoMethods(m) - if methods != nil && methods.Unmarshal != nil && - !(o.DiscardUnknown && methods.Flags&protoiface.SupportUnmarshalDiscardUnknown == 0) { - in := protoiface.UnmarshalInput{ - Message: m, - Buf: b, - Resolver: o.Resolver, - } - if o.DiscardUnknown { - in.Flags |= protoiface.UnmarshalDiscardUnknown - } - out, err = methods.Unmarshal(in) - } else { - err = o.unmarshalMessageSlow(b, m) - } - if err != nil { - return out, err - } - if allowPartial || (out.Flags&protoiface.UnmarshalInitialized != 0) { - return out, nil - } - return out, checkInitialized(m) -} - -func (o UnmarshalOptions) unmarshalMessage(b []byte, m protoreflect.Message) error { - _, err := o.unmarshal(b, m) - return err -} - -func (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) error { - md := m.Descriptor() - if messageset.IsMessageSet(md) { - return o.unmarshalMessageSet(b, m) - } - fields := md.Fields() - for len(b) > 0 { - // Parse the tag (field number and wire type). - num, wtyp, tagLen := protowire.ConsumeTag(b) - if tagLen < 0 { - return protowire.ParseError(tagLen) - } - if num > protowire.MaxValidNumber { - return errors.New("invalid field number") - } - - // Find the field descriptor for this field number. - fd := fields.ByNumber(num) - if fd == nil && md.ExtensionRanges().Has(num) { - extType, err := o.Resolver.FindExtensionByNumber(md.FullName(), num) - if err != nil && err != protoregistry.NotFound { - return errors.New("%v: unable to resolve extension %v: %v", md.FullName(), num, err) - } - if extType != nil { - fd = extType.TypeDescriptor() - } - } - var err error - if fd == nil { - err = errUnknown - } else if flags.ProtoLegacy { - if fd.IsWeak() && fd.Message().IsPlaceholder() { - err = errUnknown // weak referent is not linked in - } - } - - // Parse the field value. - var valLen int - switch { - case err != nil: - case fd.IsList(): - valLen, err = o.unmarshalList(b[tagLen:], wtyp, m.Mutable(fd).List(), fd) - case fd.IsMap(): - valLen, err = o.unmarshalMap(b[tagLen:], wtyp, m.Mutable(fd).Map(), fd) - default: - valLen, err = o.unmarshalSingular(b[tagLen:], wtyp, m, fd) - } - if err != nil { - if err != errUnknown { - return err - } - valLen = protowire.ConsumeFieldValue(num, wtyp, b[tagLen:]) - if valLen < 0 { - return protowire.ParseError(valLen) - } - if !o.DiscardUnknown { - m.SetUnknown(append(m.GetUnknown(), b[:tagLen+valLen]...)) - } - } - b = b[tagLen+valLen:] - } - return nil -} - -func (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp protowire.Type, m protoreflect.Message, fd protoreflect.FieldDescriptor) (n int, err error) { - v, n, err := o.unmarshalScalar(b, wtyp, fd) - if err != nil { - return 0, err - } - switch fd.Kind() { - case protoreflect.GroupKind, protoreflect.MessageKind: - m2 := m.Mutable(fd).Message() - if err := o.unmarshalMessage(v.Bytes(), m2); err != nil { - return n, err - } - default: - // Non-message scalars replace the previous value. - m.Set(fd, v) - } - return n, nil -} - -func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) { - if wtyp != protowire.BytesType { - return 0, errUnknown - } - b, n = protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - var ( - keyField = fd.MapKey() - valField = fd.MapValue() - key protoreflect.Value - val protoreflect.Value - haveKey bool - haveVal bool - ) - switch valField.Kind() { - case protoreflect.GroupKind, protoreflect.MessageKind: - val = mapv.NewValue() - } - // Map entries are represented as a two-element message with fields - // containing the key and value. - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - if num > protowire.MaxValidNumber { - return 0, errors.New("invalid field number") - } - b = b[n:] - err = errUnknown - switch num { - case genid.MapEntry_Key_field_number: - key, n, err = o.unmarshalScalar(b, wtyp, keyField) - if err != nil { - break - } - haveKey = true - case genid.MapEntry_Value_field_number: - var v protoreflect.Value - v, n, err = o.unmarshalScalar(b, wtyp, valField) - if err != nil { - break - } - switch valField.Kind() { - case protoreflect.GroupKind, protoreflect.MessageKind: - if err := o.unmarshalMessage(v.Bytes(), val.Message()); err != nil { - return 0, err - } - default: - val = v - } - haveVal = true - } - if err == errUnknown { - n = protowire.ConsumeFieldValue(num, wtyp, b) - if n < 0 { - return 0, protowire.ParseError(n) - } - } else if err != nil { - return 0, err - } - b = b[n:] - } - // Every map entry should have entries for key and value, but this is not strictly required. - if !haveKey { - key = keyField.Default() - } - if !haveVal { - switch valField.Kind() { - case protoreflect.GroupKind, protoreflect.MessageKind: - default: - val = valField.Default() - } - } - mapv.Set(key.MapKey(), val) - return n, nil -} - -// errUnknown is used internally to indicate fields which should be added -// to the unknown field set of a message. It is never returned from an exported -// function. -var errUnknown = errors.New("BUG: internal error (unknown)") diff --git a/vendor/google.golang.org/protobuf/proto/decode_gen.go b/vendor/google.golang.org/protobuf/proto/decode_gen.go deleted file mode 100644 index d6dc904dc..000000000 --- a/vendor/google.golang.org/protobuf/proto/decode_gen.go +++ /dev/null @@ -1,603 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package proto - -import ( - "math" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// unmarshalScalar decodes a value of the given kind. -// -// Message values are decoded into a []byte which aliases the input data. -func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) { - switch fd.Kind() { - case protoreflect.BoolKind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil - case protoreflect.EnumKind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil - case protoreflect.Int32Kind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfInt32(int32(v)), n, nil - case protoreflect.Sint32Kind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil - case protoreflect.Uint32Kind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfUint32(uint32(v)), n, nil - case protoreflect.Int64Kind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfInt64(int64(v)), n, nil - case protoreflect.Sint64Kind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil - case protoreflect.Uint64Kind: - if wtyp != protowire.VarintType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfUint64(v), n, nil - case protoreflect.Sfixed32Kind: - if wtyp != protowire.Fixed32Type { - return val, 0, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfInt32(int32(v)), n, nil - case protoreflect.Fixed32Kind: - if wtyp != protowire.Fixed32Type { - return val, 0, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfUint32(uint32(v)), n, nil - case protoreflect.FloatKind: - if wtyp != protowire.Fixed32Type { - return val, 0, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil - case protoreflect.Sfixed64Kind: - if wtyp != protowire.Fixed64Type { - return val, 0, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfInt64(int64(v)), n, nil - case protoreflect.Fixed64Kind: - if wtyp != protowire.Fixed64Type { - return val, 0, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfUint64(v), n, nil - case protoreflect.DoubleKind: - if wtyp != protowire.Fixed64Type { - return val, 0, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil - case protoreflect.StringKind: - if wtyp != protowire.BytesType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - if strs.EnforceUTF8(fd) && !utf8.Valid(v) { - return protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName())) - } - return protoreflect.ValueOfString(string(v)), n, nil - case protoreflect.BytesKind: - if wtyp != protowire.BytesType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil - case protoreflect.MessageKind: - if wtyp != protowire.BytesType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfBytes(v), n, nil - case protoreflect.GroupKind: - if wtyp != protowire.StartGroupType { - return val, 0, errUnknown - } - v, n := protowire.ConsumeGroup(fd.Number(), b) - if n < 0 { - return val, 0, protowire.ParseError(n) - } - return protoreflect.ValueOfBytes(v), n, nil - default: - return val, 0, errUnknown - } -} - -func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) { - switch fd.Kind() { - case protoreflect.BoolKind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) - return n, nil - case protoreflect.EnumKind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) - return n, nil - case protoreflect.Int32Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfInt32(int32(v))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(v))) - return n, nil - case protoreflect.Sint32Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) - return n, nil - case protoreflect.Uint32Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfUint32(uint32(v))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint32(uint32(v))) - return n, nil - case protoreflect.Int64Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfInt64(int64(v))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(int64(v))) - return n, nil - case protoreflect.Sint64Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) - return n, nil - case protoreflect.Uint64Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeVarint(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfUint64(v)) - } - return n, nil - } - if wtyp != protowire.VarintType { - return 0, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint64(v)) - return n, nil - case protoreflect.Sfixed32Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeFixed32(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfInt32(int32(v))) - } - return n, nil - } - if wtyp != protowire.Fixed32Type { - return 0, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt32(int32(v))) - return n, nil - case protoreflect.Fixed32Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeFixed32(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfUint32(uint32(v))) - } - return n, nil - } - if wtyp != protowire.Fixed32Type { - return 0, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint32(uint32(v))) - return n, nil - case protoreflect.FloatKind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeFixed32(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) - } - return n, nil - } - if wtyp != protowire.Fixed32Type { - return 0, errUnknown - } - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) - return n, nil - case protoreflect.Sfixed64Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeFixed64(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfInt64(int64(v))) - } - return n, nil - } - if wtyp != protowire.Fixed64Type { - return 0, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfInt64(int64(v))) - return n, nil - case protoreflect.Fixed64Kind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeFixed64(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfUint64(v)) - } - return n, nil - } - if wtyp != protowire.Fixed64Type { - return 0, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfUint64(v)) - return n, nil - case protoreflect.DoubleKind: - if wtyp == protowire.BytesType { - buf, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - for len(buf) > 0 { - v, n := protowire.ConsumeFixed64(buf) - if n < 0 { - return 0, protowire.ParseError(n) - } - buf = buf[n:] - list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) - } - return n, nil - } - if wtyp != protowire.Fixed64Type { - return 0, errUnknown - } - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) - return n, nil - case protoreflect.StringKind: - if wtyp != protowire.BytesType { - return 0, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - if strs.EnforceUTF8(fd) && !utf8.Valid(v) { - return 0, errors.InvalidUTF8(string(fd.FullName())) - } - list.Append(protoreflect.ValueOfString(string(v))) - return n, nil - case protoreflect.BytesKind: - if wtyp != protowire.BytesType { - return 0, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...))) - return n, nil - case protoreflect.MessageKind: - if wtyp != protowire.BytesType { - return 0, errUnknown - } - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return 0, protowire.ParseError(n) - } - m := list.NewElement() - if err := o.unmarshalMessage(v, m.Message()); err != nil { - return 0, err - } - list.Append(m) - return n, nil - case protoreflect.GroupKind: - if wtyp != protowire.StartGroupType { - return 0, errUnknown - } - v, n := protowire.ConsumeGroup(fd.Number(), b) - if n < 0 { - return 0, protowire.ParseError(n) - } - m := list.NewElement() - if err := o.unmarshalMessage(v, m.Message()); err != nil { - return 0, err - } - list.Append(m) - return n, nil - default: - return 0, errUnknown - } -} - -// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices. -var emptyBuf [0]byte diff --git a/vendor/google.golang.org/protobuf/proto/doc.go b/vendor/google.golang.org/protobuf/proto/doc.go deleted file mode 100644 index c52d8c4ab..000000000 --- a/vendor/google.golang.org/protobuf/proto/doc.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package proto provides functions operating on protocol buffer messages. -// -// For documentation on protocol buffers in general, see: -// -// https://developers.google.com/protocol-buffers -// -// For a tutorial on using protocol buffers with Go, see: -// -// https://developers.google.com/protocol-buffers/docs/gotutorial -// -// For a guide to generated Go protocol buffer code, see: -// -// https://developers.google.com/protocol-buffers/docs/reference/go-generated -// -// -// Binary serialization -// -// This package contains functions to convert to and from the wire format, -// an efficient binary serialization of protocol buffers. -// -// • Size reports the size of a message in the wire format. -// -// • Marshal converts a message to the wire format. -// The MarshalOptions type provides more control over wire marshaling. -// -// • Unmarshal converts a message from the wire format. -// The UnmarshalOptions type provides more control over wire unmarshaling. -// -// -// Basic message operations -// -// • Clone makes a deep copy of a message. -// -// • Merge merges the content of a message into another. -// -// • Equal compares two messages. For more control over comparisons -// and detailed reporting of differences, see package -// "google.golang.org/protobuf/testing/protocmp". -// -// • Reset clears the content of a message. -// -// • CheckInitialized reports whether all required fields in a message are set. -// -// -// Optional scalar constructors -// -// The API for some generated messages represents optional scalar fields -// as pointers to a value. For example, an optional string field has the -// Go type *string. -// -// • Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String -// take a value and return a pointer to a new instance of it, -// to simplify construction of optional field values. -// -// Generated enum types usually have an Enum method which performs the -// same operation. -// -// Optional scalar fields are only supported in proto2. -// -// -// Extension accessors -// -// • HasExtension, GetExtension, SetExtension, and ClearExtension -// access extension field values in a protocol buffer message. -// -// Extension fields are only supported in proto2. -// -// -// Related packages -// -// • Package "google.golang.org/protobuf/encoding/protojson" converts messages to -// and from JSON. -// -// • Package "google.golang.org/protobuf/encoding/prototext" converts messages to -// and from the text format. -// -// • Package "google.golang.org/protobuf/reflect/protoreflect" provides a -// reflection interface for protocol buffer data types. -// -// • Package "google.golang.org/protobuf/testing/protocmp" provides features -// to compare protocol buffer messages with the "github.com/google/go-cmp/cmp" -// package. -// -// • Package "google.golang.org/protobuf/types/dynamicpb" provides a dynamic -// message type, suitable for working with messages where the protocol buffer -// type is only known at runtime. -// -// This module contains additional packages for more specialized use cases. -// Consult the individual package documentation for details. -package proto diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go deleted file mode 100644 index 7b47a1180..000000000 --- a/vendor/google.golang.org/protobuf/proto/encode.go +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "sort" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/fieldsort" - "google.golang.org/protobuf/internal/mapsort" - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -// MarshalOptions configures the marshaler. -// -// Example usage: -// b, err := MarshalOptions{Deterministic: true}.Marshal(m) -type MarshalOptions struct { - pragma.NoUnkeyedLiterals - - // AllowPartial allows messages that have missing required fields to marshal - // without returning an error. If AllowPartial is false (the default), - // Marshal will return an error if there are any missing required fields. - AllowPartial bool - - // Deterministic controls whether the same message will always be - // serialized to the same bytes within the same binary. - // - // Setting this option guarantees that repeated serialization of - // the same message will return the same bytes, and that different - // processes of the same binary (which may be executing on different - // machines) will serialize equal messages to the same bytes. - // It has no effect on the resulting size of the encoded message compared - // to a non-deterministic marshal. - // - // Note that the deterministic serialization is NOT canonical across - // languages. It is not guaranteed to remain stable over time. It is - // unstable across different builds with schema changes due to unknown - // fields. Users who need canonical serialization (e.g., persistent - // storage in a canonical form, fingerprinting, etc.) must define - // their own canonicalization specification and implement their own - // serializer rather than relying on this API. - // - // If deterministic serialization is requested, map entries will be - // sorted by keys in lexographical order. This is an implementation - // detail and subject to change. - Deterministic bool - - // UseCachedSize indicates that the result of a previous Size call - // may be reused. - // - // Setting this option asserts that: - // - // 1. Size has previously been called on this message with identical - // options (except for UseCachedSize itself). - // - // 2. The message and all its submessages have not changed in any - // way since the Size call. - // - // If either of these invariants is violated, - // the results are undefined and may include panics or corrupted output. - // - // Implementations MAY take this option into account to provide - // better performance, but there is no guarantee that they will do so. - // There is absolutely no guarantee that Size followed by Marshal with - // UseCachedSize set will perform equivalently to Marshal alone. - UseCachedSize bool -} - -// Marshal returns the wire-format encoding of m. -func Marshal(m Message) ([]byte, error) { - // Treat nil message interface as an empty message; nothing to output. - if m == nil { - return nil, nil - } - - out, err := MarshalOptions{}.marshal(nil, m.ProtoReflect()) - if len(out.Buf) == 0 && err == nil { - out.Buf = emptyBytesForMessage(m) - } - return out.Buf, err -} - -// Marshal returns the wire-format encoding of m. -func (o MarshalOptions) Marshal(m Message) ([]byte, error) { - // Treat nil message interface as an empty message; nothing to output. - if m == nil { - return nil, nil - } - - out, err := o.marshal(nil, m.ProtoReflect()) - if len(out.Buf) == 0 && err == nil { - out.Buf = emptyBytesForMessage(m) - } - return out.Buf, err -} - -// emptyBytesForMessage returns a nil buffer if and only if m is invalid, -// otherwise it returns a non-nil empty buffer. -// -// This is to assist the edge-case where user-code does the following: -// m1.OptionalBytes, _ = proto.Marshal(m2) -// where they expect the proto2 "optional_bytes" field to be populated -// if any only if m2 is a valid message. -func emptyBytesForMessage(m Message) []byte { - if m == nil || !m.ProtoReflect().IsValid() { - return nil - } - return emptyBuf[:] -} - -// MarshalAppend appends the wire-format encoding of m to b, -// returning the result. -func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) { - // Treat nil message interface as an empty message; nothing to append. - if m == nil { - return b, nil - } - - out, err := o.marshal(b, m.ProtoReflect()) - return out.Buf, err -} - -// MarshalState returns the wire-format encoding of a message. -// -// This method permits fine-grained control over the marshaler. -// Most users should use Marshal instead. -func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - return o.marshal(in.Buf, in.Message) -} - -// marshal is a centralized function that all marshal operations go through. -// For profiling purposes, avoid changing the name of this function or -// introducing other code paths for marshal that do not go through this. -func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoiface.MarshalOutput, err error) { - allowPartial := o.AllowPartial - o.AllowPartial = true - if methods := protoMethods(m); methods != nil && methods.Marshal != nil && - !(o.Deterministic && methods.Flags&protoiface.SupportMarshalDeterministic == 0) { - in := protoiface.MarshalInput{ - Message: m, - Buf: b, - } - if o.Deterministic { - in.Flags |= protoiface.MarshalDeterministic - } - if o.UseCachedSize { - in.Flags |= protoiface.MarshalUseCachedSize - } - if methods.Size != nil { - sout := methods.Size(protoiface.SizeInput{ - Message: m, - Flags: in.Flags, - }) - if cap(b) < len(b)+sout.Size { - in.Buf = make([]byte, len(b), growcap(cap(b), len(b)+sout.Size)) - copy(in.Buf, b) - } - in.Flags |= protoiface.MarshalUseCachedSize - } - out, err = methods.Marshal(in) - } else { - out.Buf, err = o.marshalMessageSlow(b, m) - } - if err != nil { - return out, err - } - if allowPartial { - return out, nil - } - return out, checkInitialized(m) -} - -func (o MarshalOptions) marshalMessage(b []byte, m protoreflect.Message) ([]byte, error) { - out, err := o.marshal(b, m) - return out.Buf, err -} - -// growcap scales up the capacity of a slice. -// -// Given a slice with a current capacity of oldcap and a desired -// capacity of wantcap, growcap returns a new capacity >= wantcap. -// -// The algorithm is mostly identical to the one used by append as of Go 1.14. -func growcap(oldcap, wantcap int) (newcap int) { - if wantcap > oldcap*2 { - newcap = wantcap - } else if oldcap < 1024 { - // The Go 1.14 runtime takes this case when len(s) < 1024, - // not when cap(s) < 1024. The difference doesn't seem - // significant here. - newcap = oldcap * 2 - } else { - newcap = oldcap - for 0 < newcap && newcap < wantcap { - newcap += newcap / 4 - } - if newcap <= 0 { - newcap = wantcap - } - } - return newcap -} - -func (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([]byte, error) { - if messageset.IsMessageSet(m.Descriptor()) { - return o.marshalMessageSet(b, m) - } - // There are many choices for what order we visit fields in. The default one here - // is chosen for reasonable efficiency and simplicity given the protoreflect API. - // It is not deterministic, since Message.Range does not return fields in any - // defined order. - // - // When using deterministic serialization, we sort the known fields. - var err error - o.rangeFields(m, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - b, err = o.marshalField(b, fd, v) - return err == nil - }) - if err != nil { - return b, err - } - b = append(b, m.GetUnknown()...) - return b, nil -} - -// rangeFields visits fields in a defined order when deterministic serialization is enabled. -func (o MarshalOptions) rangeFields(m protoreflect.Message, f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if !o.Deterministic { - m.Range(f) - return - } - var fds []protoreflect.FieldDescriptor - m.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - fds = append(fds, fd) - return true - }) - sort.Slice(fds, func(a, b int) bool { - return fieldsort.Less(fds[a], fds[b]) - }) - for _, fd := range fds { - if !f(fd, m.Get(fd)) { - break - } - } -} - -func (o MarshalOptions) marshalField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) { - switch { - case fd.IsList(): - return o.marshalList(b, fd, value.List()) - case fd.IsMap(): - return o.marshalMap(b, fd, value.Map()) - default: - b = protowire.AppendTag(b, fd.Number(), wireTypes[fd.Kind()]) - return o.marshalSingular(b, fd, value) - } -} - -func (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, list protoreflect.List) ([]byte, error) { - if fd.IsPacked() && list.Len() > 0 { - b = protowire.AppendTag(b, fd.Number(), protowire.BytesType) - b, pos := appendSpeculativeLength(b) - for i, llen := 0, list.Len(); i < llen; i++ { - var err error - b, err = o.marshalSingular(b, fd, list.Get(i)) - if err != nil { - return b, err - } - } - b = finishSpeculativeLength(b, pos) - return b, nil - } - - kind := fd.Kind() - for i, llen := 0, list.Len(); i < llen; i++ { - var err error - b = protowire.AppendTag(b, fd.Number(), wireTypes[kind]) - b, err = o.marshalSingular(b, fd, list.Get(i)) - if err != nil { - return b, err - } - } - return b, nil -} - -func (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) ([]byte, error) { - keyf := fd.MapKey() - valf := fd.MapValue() - var err error - o.rangeMap(mapv, keyf.Kind(), func(key protoreflect.MapKey, value protoreflect.Value) bool { - b = protowire.AppendTag(b, fd.Number(), protowire.BytesType) - var pos int - b, pos = appendSpeculativeLength(b) - - b, err = o.marshalField(b, keyf, key.Value()) - if err != nil { - return false - } - b, err = o.marshalField(b, valf, value) - if err != nil { - return false - } - b = finishSpeculativeLength(b, pos) - return true - }) - return b, err -} - -func (o MarshalOptions) rangeMap(mapv protoreflect.Map, kind protoreflect.Kind, f func(protoreflect.MapKey, protoreflect.Value) bool) { - if !o.Deterministic { - mapv.Range(f) - return - } - mapsort.Range(mapv, kind, f) -} - -// When encoding length-prefixed fields, we speculatively set aside some number of bytes -// for the length, encode the data, and then encode the length (shifting the data if necessary -// to make room). -const speculativeLength = 1 - -func appendSpeculativeLength(b []byte) ([]byte, int) { - pos := len(b) - b = append(b, "\x00\x00\x00\x00"[:speculativeLength]...) - return b, pos -} - -func finishSpeculativeLength(b []byte, pos int) []byte { - mlen := len(b) - pos - speculativeLength - msiz := protowire.SizeVarint(uint64(mlen)) - if msiz != speculativeLength { - for i := 0; i < msiz-speculativeLength; i++ { - b = append(b, 0) - } - copy(b[pos+msiz:], b[pos+speculativeLength:]) - b = b[:pos+msiz+mlen] - } - protowire.AppendVarint(b[:pos], uint64(mlen)) - return b -} diff --git a/vendor/google.golang.org/protobuf/proto/encode_gen.go b/vendor/google.golang.org/protobuf/proto/encode_gen.go deleted file mode 100644 index 185dacfb4..000000000 --- a/vendor/google.golang.org/protobuf/proto/encode_gen.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package proto - -import ( - "math" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/strs" - "google.golang.org/protobuf/reflect/protoreflect" -) - -var wireTypes = map[protoreflect.Kind]protowire.Type{ - protoreflect.BoolKind: protowire.VarintType, - protoreflect.EnumKind: protowire.VarintType, - protoreflect.Int32Kind: protowire.VarintType, - protoreflect.Sint32Kind: protowire.VarintType, - protoreflect.Uint32Kind: protowire.VarintType, - protoreflect.Int64Kind: protowire.VarintType, - protoreflect.Sint64Kind: protowire.VarintType, - protoreflect.Uint64Kind: protowire.VarintType, - protoreflect.Sfixed32Kind: protowire.Fixed32Type, - protoreflect.Fixed32Kind: protowire.Fixed32Type, - protoreflect.FloatKind: protowire.Fixed32Type, - protoreflect.Sfixed64Kind: protowire.Fixed64Type, - protoreflect.Fixed64Kind: protowire.Fixed64Type, - protoreflect.DoubleKind: protowire.Fixed64Type, - protoreflect.StringKind: protowire.BytesType, - protoreflect.BytesKind: protowire.BytesType, - protoreflect.MessageKind: protowire.BytesType, - protoreflect.GroupKind: protowire.StartGroupType, -} - -func (o MarshalOptions) marshalSingular(b []byte, fd protoreflect.FieldDescriptor, v protoreflect.Value) ([]byte, error) { - switch fd.Kind() { - case protoreflect.BoolKind: - b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool())) - case protoreflect.EnumKind: - b = protowire.AppendVarint(b, uint64(v.Enum())) - case protoreflect.Int32Kind: - b = protowire.AppendVarint(b, uint64(int32(v.Int()))) - case protoreflect.Sint32Kind: - b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int())))) - case protoreflect.Uint32Kind: - b = protowire.AppendVarint(b, uint64(uint32(v.Uint()))) - case protoreflect.Int64Kind: - b = protowire.AppendVarint(b, uint64(v.Int())) - case protoreflect.Sint64Kind: - b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int())) - case protoreflect.Uint64Kind: - b = protowire.AppendVarint(b, v.Uint()) - case protoreflect.Sfixed32Kind: - b = protowire.AppendFixed32(b, uint32(v.Int())) - case protoreflect.Fixed32Kind: - b = protowire.AppendFixed32(b, uint32(v.Uint())) - case protoreflect.FloatKind: - b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float()))) - case protoreflect.Sfixed64Kind: - b = protowire.AppendFixed64(b, uint64(v.Int())) - case protoreflect.Fixed64Kind: - b = protowire.AppendFixed64(b, v.Uint()) - case protoreflect.DoubleKind: - b = protowire.AppendFixed64(b, math.Float64bits(v.Float())) - case protoreflect.StringKind: - if strs.EnforceUTF8(fd) && !utf8.ValidString(v.String()) { - return b, errors.InvalidUTF8(string(fd.FullName())) - } - b = protowire.AppendString(b, v.String()) - case protoreflect.BytesKind: - b = protowire.AppendBytes(b, v.Bytes()) - case protoreflect.MessageKind: - var pos int - var err error - b, pos = appendSpeculativeLength(b) - b, err = o.marshalMessage(b, v.Message()) - if err != nil { - return b, err - } - b = finishSpeculativeLength(b, pos) - case protoreflect.GroupKind: - var err error - b, err = o.marshalMessage(b, v.Message()) - if err != nil { - return b, err - } - b = protowire.AppendVarint(b, protowire.EncodeTag(fd.Number(), protowire.EndGroupType)) - default: - return b, errors.New("invalid kind %v", fd.Kind()) - } - return b, nil -} diff --git a/vendor/google.golang.org/protobuf/proto/equal.go b/vendor/google.golang.org/protobuf/proto/equal.go deleted file mode 100644 index 10902bd85..000000000 --- a/vendor/google.golang.org/protobuf/proto/equal.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "bytes" - "math" - "reflect" - - "google.golang.org/protobuf/encoding/protowire" - pref "google.golang.org/protobuf/reflect/protoreflect" -) - -// Equal reports whether two messages are equal. -// If two messages marshal to the same bytes under deterministic serialization, -// then Equal is guaranteed to report true. -// -// Two messages are equal if they belong to the same message descriptor, -// have the same set of populated known and extension field values, -// and the same set of unknown fields values. If either of the top-level -// messages are invalid, then Equal reports true only if both are invalid. -// -// Scalar values are compared with the equivalent of the == operator in Go, -// except bytes values which are compared using bytes.Equal and -// floating point values which specially treat NaNs as equal. -// Message values are compared by recursively calling Equal. -// Lists are equal if each element value is also equal. -// Maps are equal if they have the same set of keys, where the pair of values -// for each key is also equal. -func Equal(x, y Message) bool { - if x == nil || y == nil { - return x == nil && y == nil - } - mx := x.ProtoReflect() - my := y.ProtoReflect() - if mx.IsValid() != my.IsValid() { - return false - } - return equalMessage(mx, my) -} - -// equalMessage compares two messages. -func equalMessage(mx, my pref.Message) bool { - if mx.Descriptor() != my.Descriptor() { - return false - } - - nx := 0 - equal := true - mx.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool { - nx++ - vy := my.Get(fd) - equal = my.Has(fd) && equalField(fd, vx, vy) - return equal - }) - if !equal { - return false - } - ny := 0 - my.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool { - ny++ - return true - }) - if nx != ny { - return false - } - - return equalUnknown(mx.GetUnknown(), my.GetUnknown()) -} - -// equalField compares two fields. -func equalField(fd pref.FieldDescriptor, x, y pref.Value) bool { - switch { - case fd.IsList(): - return equalList(fd, x.List(), y.List()) - case fd.IsMap(): - return equalMap(fd, x.Map(), y.Map()) - default: - return equalValue(fd, x, y) - } -} - -// equalMap compares two maps. -func equalMap(fd pref.FieldDescriptor, x, y pref.Map) bool { - if x.Len() != y.Len() { - return false - } - equal := true - x.Range(func(k pref.MapKey, vx pref.Value) bool { - vy := y.Get(k) - equal = y.Has(k) && equalValue(fd.MapValue(), vx, vy) - return equal - }) - return equal -} - -// equalList compares two lists. -func equalList(fd pref.FieldDescriptor, x, y pref.List) bool { - if x.Len() != y.Len() { - return false - } - for i := x.Len() - 1; i >= 0; i-- { - if !equalValue(fd, x.Get(i), y.Get(i)) { - return false - } - } - return true -} - -// equalValue compares two singular values. -func equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool { - switch { - case fd.Message() != nil: - return equalMessage(x.Message(), y.Message()) - case fd.Kind() == pref.BytesKind: - return bytes.Equal(x.Bytes(), y.Bytes()) - case fd.Kind() == pref.FloatKind, fd.Kind() == pref.DoubleKind: - fx := x.Float() - fy := y.Float() - if math.IsNaN(fx) || math.IsNaN(fy) { - return math.IsNaN(fx) && math.IsNaN(fy) - } - return fx == fy - default: - return x.Interface() == y.Interface() - } -} - -// equalUnknown compares unknown fields by direct comparison on the raw bytes -// of each individual field number. -func equalUnknown(x, y pref.RawFields) bool { - if len(x) != len(y) { - return false - } - if bytes.Equal([]byte(x), []byte(y)) { - return true - } - - mx := make(map[pref.FieldNumber]pref.RawFields) - my := make(map[pref.FieldNumber]pref.RawFields) - for len(x) > 0 { - fnum, _, n := protowire.ConsumeField(x) - mx[fnum] = append(mx[fnum], x[:n]...) - x = x[n:] - } - for len(y) > 0 { - fnum, _, n := protowire.ConsumeField(y) - my[fnum] = append(my[fnum], y[:n]...) - y = y[n:] - } - return reflect.DeepEqual(mx, my) -} diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go deleted file mode 100644 index 5f293cda8..000000000 --- a/vendor/google.golang.org/protobuf/proto/extension.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// HasExtension reports whether an extension field is populated. -// It returns false if m is invalid or if xt does not extend m. -func HasExtension(m Message, xt protoreflect.ExtensionType) bool { - // Treat nil message interface as an empty message; no populated fields. - if m == nil { - return false - } - - // As a special-case, we reports invalid or mismatching descriptors - // as always not being populated (since they aren't). - if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() { - return false - } - - return m.ProtoReflect().Has(xt.TypeDescriptor()) -} - -// ClearExtension clears an extension field such that subsequent -// HasExtension calls return false. -// It panics if m is invalid or if xt does not extend m. -func ClearExtension(m Message, xt protoreflect.ExtensionType) { - m.ProtoReflect().Clear(xt.TypeDescriptor()) -} - -// GetExtension retrieves the value for an extension field. -// If the field is unpopulated, it returns the default value for -// scalars and an immutable, empty value for lists or messages. -// It panics if xt does not extend m. -func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} { - // Treat nil message interface as an empty message; return the default. - if m == nil { - return xt.InterfaceOf(xt.Zero()) - } - - return xt.InterfaceOf(m.ProtoReflect().Get(xt.TypeDescriptor())) -} - -// SetExtension stores the value of an extension field. -// It panics if m is invalid, xt does not extend m, or if type of v -// is invalid for the specified extension field. -func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) { - xd := xt.TypeDescriptor() - pv := xt.ValueOf(v) - - // Specially treat an invalid list, map, or message as clear. - isValid := true - switch { - case xd.IsList(): - isValid = pv.List().IsValid() - case xd.IsMap(): - isValid = pv.Map().IsValid() - case xd.Message() != nil: - isValid = pv.Message().IsValid() - } - if !isValid { - m.ProtoReflect().Clear(xd) - return - } - - m.ProtoReflect().Set(xd, pv) -} - -// RangeExtensions iterates over every populated extension field in m in an -// undefined order, calling f for each extension type and value encountered. -// It returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current extension field. -func RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) { - // Treat nil message interface as an empty message; nothing to range over. - if m == nil { - return - } - - m.ProtoReflect().Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - xt := fd.(protoreflect.ExtensionTypeDescriptor).Type() - vi := xt.InterfaceOf(v) - return f(xt, vi) - } - return true - }) -} diff --git a/vendor/google.golang.org/protobuf/proto/merge.go b/vendor/google.golang.org/protobuf/proto/merge.go deleted file mode 100644 index d761ab331..000000000 --- a/vendor/google.golang.org/protobuf/proto/merge.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "fmt" - - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -// Merge merges src into dst, which must be a message with the same descriptor. -// -// Populated scalar fields in src are copied to dst, while populated -// singular messages in src are merged into dst by recursively calling Merge. -// The elements of every list field in src is appended to the corresponded -// list fields in dst. The entries of every map field in src is copied into -// the corresponding map field in dst, possibly replacing existing entries. -// The unknown fields of src are appended to the unknown fields of dst. -// -// It is semantically equivalent to unmarshaling the encoded form of src -// into dst with the UnmarshalOptions.Merge option specified. -func Merge(dst, src Message) { - // TODO: Should nil src be treated as semantically equivalent to a - // untyped, read-only, empty message? What about a nil dst? - - dstMsg, srcMsg := dst.ProtoReflect(), src.ProtoReflect() - if dstMsg.Descriptor() != srcMsg.Descriptor() { - if got, want := dstMsg.Descriptor().FullName(), srcMsg.Descriptor().FullName(); got != want { - panic(fmt.Sprintf("descriptor mismatch: %v != %v", got, want)) - } - panic("descriptor mismatch") - } - mergeOptions{}.mergeMessage(dstMsg, srcMsg) -} - -// Clone returns a deep copy of m. -// If the top-level message is invalid, it returns an invalid message as well. -func Clone(m Message) Message { - // NOTE: Most usages of Clone assume the following properties: - // t := reflect.TypeOf(m) - // t == reflect.TypeOf(m.ProtoReflect().New().Interface()) - // t == reflect.TypeOf(m.ProtoReflect().Type().Zero().Interface()) - // - // Embedding protobuf messages breaks this since the parent type will have - // a forwarded ProtoReflect method, but the Interface method will return - // the underlying embedded message type. - if m == nil { - return nil - } - src := m.ProtoReflect() - if !src.IsValid() { - return src.Type().Zero().Interface() - } - dst := src.New() - mergeOptions{}.mergeMessage(dst, src) - return dst.Interface() -} - -// mergeOptions provides a namespace for merge functions, and can be -// exported in the future if we add user-visible merge options. -type mergeOptions struct{} - -func (o mergeOptions) mergeMessage(dst, src protoreflect.Message) { - methods := protoMethods(dst) - if methods != nil && methods.Merge != nil { - in := protoiface.MergeInput{ - Destination: dst, - Source: src, - } - out := methods.Merge(in) - if out.Flags&protoiface.MergeComplete != 0 { - return - } - } - - if !dst.IsValid() { - panic(fmt.Sprintf("cannot merge into invalid %v message", dst.Descriptor().FullName())) - } - - src.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - switch { - case fd.IsList(): - o.mergeList(dst.Mutable(fd).List(), v.List(), fd) - case fd.IsMap(): - o.mergeMap(dst.Mutable(fd).Map(), v.Map(), fd.MapValue()) - case fd.Message() != nil: - o.mergeMessage(dst.Mutable(fd).Message(), v.Message()) - case fd.Kind() == protoreflect.BytesKind: - dst.Set(fd, o.cloneBytes(v)) - default: - dst.Set(fd, v) - } - return true - }) - - if len(src.GetUnknown()) > 0 { - dst.SetUnknown(append(dst.GetUnknown(), src.GetUnknown()...)) - } -} - -func (o mergeOptions) mergeList(dst, src protoreflect.List, fd protoreflect.FieldDescriptor) { - // Merge semantics appends to the end of the existing list. - for i, n := 0, src.Len(); i < n; i++ { - switch v := src.Get(i); { - case fd.Message() != nil: - dstv := dst.NewElement() - o.mergeMessage(dstv.Message(), v.Message()) - dst.Append(dstv) - case fd.Kind() == protoreflect.BytesKind: - dst.Append(o.cloneBytes(v)) - default: - dst.Append(v) - } - } -} - -func (o mergeOptions) mergeMap(dst, src protoreflect.Map, fd protoreflect.FieldDescriptor) { - // Merge semantics replaces, rather than merges into existing entries. - src.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { - switch { - case fd.Message() != nil: - dstv := dst.NewValue() - o.mergeMessage(dstv.Message(), v.Message()) - dst.Set(k, dstv) - case fd.Kind() == protoreflect.BytesKind: - dst.Set(k, o.cloneBytes(v)) - default: - dst.Set(k, v) - } - return true - }) -} - -func (o mergeOptions) cloneBytes(v protoreflect.Value) protoreflect.Value { - return protoreflect.ValueOfBytes(append([]byte{}, v.Bytes()...)) -} diff --git a/vendor/google.golang.org/protobuf/proto/messageset.go b/vendor/google.golang.org/protobuf/proto/messageset.go deleted file mode 100644 index 1d692c3a8..000000000 --- a/vendor/google.golang.org/protobuf/proto/messageset.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/internal/flags" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -func (o MarshalOptions) sizeMessageSet(m protoreflect.Message) (size int) { - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - size += messageset.SizeField(fd.Number()) - size += protowire.SizeTag(messageset.FieldMessage) - size += protowire.SizeBytes(o.size(v.Message())) - return true - }) - size += messageset.SizeUnknown(m.GetUnknown()) - return size -} - -func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]byte, error) { - if !flags.ProtoLegacy { - return b, errors.New("no support for message_set_wire_format") - } - var err error - o.rangeFields(m, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - b, err = o.marshalMessageSetField(b, fd, v) - return err == nil - }) - if err != nil { - return b, err - } - return messageset.AppendUnknown(b, m.GetUnknown()) -} - -func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) { - b = messageset.AppendFieldStart(b, fd.Number()) - b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType) - b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface()))) - b, err := o.marshalMessage(b, value.Message()) - if err != nil { - return b, err - } - b = messageset.AppendFieldEnd(b) - return b, nil -} - -func (o UnmarshalOptions) unmarshalMessageSet(b []byte, m protoreflect.Message) error { - if !flags.ProtoLegacy { - return errors.New("no support for message_set_wire_format") - } - return messageset.Unmarshal(b, false, func(num protowire.Number, v []byte) error { - err := o.unmarshalMessageSetField(m, num, v) - if err == errUnknown { - unknown := m.GetUnknown() - unknown = protowire.AppendTag(unknown, num, protowire.BytesType) - unknown = protowire.AppendBytes(unknown, v) - m.SetUnknown(unknown) - return nil - } - return err - }) -} - -func (o UnmarshalOptions) unmarshalMessageSetField(m protoreflect.Message, num protowire.Number, v []byte) error { - md := m.Descriptor() - if !md.ExtensionRanges().Has(num) { - return errUnknown - } - xt, err := o.Resolver.FindExtensionByNumber(md.FullName(), num) - if err == protoregistry.NotFound { - return errUnknown - } - if err != nil { - return errors.New("%v: unable to resolve extension %v: %v", md.FullName(), num, err) - } - xd := xt.TypeDescriptor() - if err := o.unmarshalMessage(v, m.Mutable(xd).Message()); err != nil { - return err - } - return nil -} diff --git a/vendor/google.golang.org/protobuf/proto/proto.go b/vendor/google.golang.org/protobuf/proto/proto.go deleted file mode 100644 index ca14b09c3..000000000 --- a/vendor/google.golang.org/protobuf/proto/proto.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Message is the top-level interface that all messages must implement. -// It provides access to a reflective view of a message. -// Any implementation of this interface may be used with all functions in the -// protobuf module that accept a Message, except where otherwise specified. -// -// This is the v2 interface definition for protobuf messages. -// The v1 interface definition is "github.com/golang/protobuf/proto".Message. -// -// To convert a v1 message to a v2 message, -// use "github.com/golang/protobuf/proto".MessageV2. -// To convert a v2 message to a v1 message, -// use "github.com/golang/protobuf/proto".MessageV1. -type Message = protoreflect.ProtoMessage - -// Error matches all errors produced by packages in the protobuf module. -// -// That is, errors.Is(err, Error) reports whether an error is produced -// by this module. -var Error error - -func init() { - Error = errors.Error -} diff --git a/vendor/google.golang.org/protobuf/proto/proto_methods.go b/vendor/google.golang.org/protobuf/proto/proto_methods.go deleted file mode 100644 index d8dd604f6..000000000 --- a/vendor/google.golang.org/protobuf/proto/proto_methods.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// The protoreflect build tag disables use of fast-path methods. -// +build !protoreflect - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -const hasProtoMethods = true - -func protoMethods(m protoreflect.Message) *protoiface.Methods { - return m.ProtoMethods() -} diff --git a/vendor/google.golang.org/protobuf/proto/proto_reflect.go b/vendor/google.golang.org/protobuf/proto/proto_reflect.go deleted file mode 100644 index b103d4320..000000000 --- a/vendor/google.golang.org/protobuf/proto/proto_reflect.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// The protoreflect build tag disables use of fast-path methods. -// +build protoreflect - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -const hasProtoMethods = false - -func protoMethods(m protoreflect.Message) *protoiface.Methods { - return nil -} diff --git a/vendor/google.golang.org/protobuf/proto/reset.go b/vendor/google.golang.org/protobuf/proto/reset.go deleted file mode 100644 index 3d7f89436..000000000 --- a/vendor/google.golang.org/protobuf/proto/reset.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "fmt" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Reset clears every field in the message. -// The resulting message shares no observable memory with its previous state -// other than the memory for the message itself. -func Reset(m Message) { - if mr, ok := m.(interface{ Reset() }); ok && hasProtoMethods { - mr.Reset() - return - } - resetMessage(m.ProtoReflect()) -} - -func resetMessage(m protoreflect.Message) { - if !m.IsValid() { - panic(fmt.Sprintf("cannot reset invalid %v message", m.Descriptor().FullName())) - } - - // Clear all known fields. - fds := m.Descriptor().Fields() - for i := 0; i < fds.Len(); i++ { - m.Clear(fds.Get(i)) - } - - // Clear extension fields. - m.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - m.Clear(fd) - return true - }) - - // Clear unknown fields. - m.SetUnknown(nil) -} diff --git a/vendor/google.golang.org/protobuf/proto/size.go b/vendor/google.golang.org/protobuf/proto/size.go deleted file mode 100644 index 554b9c6c0..000000000 --- a/vendor/google.golang.org/protobuf/proto/size.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" -) - -// Size returns the size in bytes of the wire-format encoding of m. -func Size(m Message) int { - return MarshalOptions{}.Size(m) -} - -// Size returns the size in bytes of the wire-format encoding of m. -func (o MarshalOptions) Size(m Message) int { - // Treat a nil message interface as an empty message; nothing to output. - if m == nil { - return 0 - } - - return o.size(m.ProtoReflect()) -} - -// size is a centralized function that all size operations go through. -// For profiling purposes, avoid changing the name of this function or -// introducing other code paths for size that do not go through this. -func (o MarshalOptions) size(m protoreflect.Message) (size int) { - methods := protoMethods(m) - if methods != nil && methods.Size != nil { - out := methods.Size(protoiface.SizeInput{ - Message: m, - }) - return out.Size - } - if methods != nil && methods.Marshal != nil { - // This is not efficient, but we don't have any choice. - // This case is mainly used for legacy types with a Marshal method. - out, _ := methods.Marshal(protoiface.MarshalInput{ - Message: m, - }) - return len(out.Buf) - } - return o.sizeMessageSlow(m) -} - -func (o MarshalOptions) sizeMessageSlow(m protoreflect.Message) (size int) { - if messageset.IsMessageSet(m.Descriptor()) { - return o.sizeMessageSet(m) - } - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - size += o.sizeField(fd, v) - return true - }) - size += len(m.GetUnknown()) - return size -} - -func (o MarshalOptions) sizeField(fd protoreflect.FieldDescriptor, value protoreflect.Value) (size int) { - num := fd.Number() - switch { - case fd.IsList(): - return o.sizeList(num, fd, value.List()) - case fd.IsMap(): - return o.sizeMap(num, fd, value.Map()) - default: - return protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), value) - } -} - -func (o MarshalOptions) sizeList(num protowire.Number, fd protoreflect.FieldDescriptor, list protoreflect.List) (size int) { - if fd.IsPacked() && list.Len() > 0 { - content := 0 - for i, llen := 0, list.Len(); i < llen; i++ { - content += o.sizeSingular(num, fd.Kind(), list.Get(i)) - } - return protowire.SizeTag(num) + protowire.SizeBytes(content) - } - - for i, llen := 0, list.Len(); i < llen; i++ { - size += protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), list.Get(i)) - } - return size -} - -func (o MarshalOptions) sizeMap(num protowire.Number, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) (size int) { - mapv.Range(func(key protoreflect.MapKey, value protoreflect.Value) bool { - size += protowire.SizeTag(num) - size += protowire.SizeBytes(o.sizeField(fd.MapKey(), key.Value()) + o.sizeField(fd.MapValue(), value)) - return true - }) - return size -} diff --git a/vendor/google.golang.org/protobuf/proto/size_gen.go b/vendor/google.golang.org/protobuf/proto/size_gen.go deleted file mode 100644 index 3cf61a824..000000000 --- a/vendor/google.golang.org/protobuf/proto/size_gen.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2018 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. - -// Code generated by generate-types. DO NOT EDIT. - -package proto - -import ( - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/reflect/protoreflect" -) - -func (o MarshalOptions) sizeSingular(num protowire.Number, kind protoreflect.Kind, v protoreflect.Value) int { - switch kind { - case protoreflect.BoolKind: - return protowire.SizeVarint(protowire.EncodeBool(v.Bool())) - case protoreflect.EnumKind: - return protowire.SizeVarint(uint64(v.Enum())) - case protoreflect.Int32Kind: - return protowire.SizeVarint(uint64(int32(v.Int()))) - case protoreflect.Sint32Kind: - return protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int())))) - case protoreflect.Uint32Kind: - return protowire.SizeVarint(uint64(uint32(v.Uint()))) - case protoreflect.Int64Kind: - return protowire.SizeVarint(uint64(v.Int())) - case protoreflect.Sint64Kind: - return protowire.SizeVarint(protowire.EncodeZigZag(v.Int())) - case protoreflect.Uint64Kind: - return protowire.SizeVarint(v.Uint()) - case protoreflect.Sfixed32Kind: - return protowire.SizeFixed32() - case protoreflect.Fixed32Kind: - return protowire.SizeFixed32() - case protoreflect.FloatKind: - return protowire.SizeFixed32() - case protoreflect.Sfixed64Kind: - return protowire.SizeFixed64() - case protoreflect.Fixed64Kind: - return protowire.SizeFixed64() - case protoreflect.DoubleKind: - return protowire.SizeFixed64() - case protoreflect.StringKind: - return protowire.SizeBytes(len(v.String())) - case protoreflect.BytesKind: - return protowire.SizeBytes(len(v.Bytes())) - case protoreflect.MessageKind: - return protowire.SizeBytes(o.size(v.Message())) - case protoreflect.GroupKind: - return protowire.SizeGroup(num, o.size(v.Message())) - default: - return 0 - } -} diff --git a/vendor/google.golang.org/protobuf/proto/wrappers.go b/vendor/google.golang.org/protobuf/proto/wrappers.go deleted file mode 100644 index 653b12c3a..000000000 --- a/vendor/google.golang.org/protobuf/proto/wrappers.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -// Bool stores v in a new bool value and returns a pointer to it. -func Bool(v bool) *bool { return &v } - -// Int32 stores v in a new int32 value and returns a pointer to it. -func Int32(v int32) *int32 { return &v } - -// Int64 stores v in a new int64 value and returns a pointer to it. -func Int64(v int64) *int64 { return &v } - -// Float32 stores v in a new float32 value and returns a pointer to it. -func Float32(v float32) *float32 { return &v } - -// Float64 stores v in a new float64 value and returns a pointer to it. -func Float64(v float64) *float64 { return &v } - -// Uint32 stores v in a new uint32 value and returns a pointer to it. -func Uint32(v uint32) *uint32 { return &v } - -// Uint64 stores v in a new uint64 value and returns a pointer to it. -func Uint64(v uint64) *uint64 { return &v } - -// String stores v in a new string value and returns a pointer to it. -func String(v string) *string { return &v } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go deleted file mode 100644 index 6be5d16e9..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoreflect - -import ( - "google.golang.org/protobuf/internal/pragma" -) - -// The following types are used by the fast-path Message.ProtoMethods method. -// -// To avoid polluting the public protoreflect API with types used only by -// low-level implementations, the canonical definitions of these types are -// in the runtime/protoiface package. The definitions here and in protoiface -// must be kept in sync. -type ( - methods = struct { - pragma.NoUnkeyedLiterals - Flags supportFlags - Size func(sizeInput) sizeOutput - Marshal func(marshalInput) (marshalOutput, error) - Unmarshal func(unmarshalInput) (unmarshalOutput, error) - Merge func(mergeInput) mergeOutput - CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error) - } - supportFlags = uint64 - sizeInput = struct { - pragma.NoUnkeyedLiterals - Message Message - Flags uint8 - } - sizeOutput = struct { - pragma.NoUnkeyedLiterals - Size int - } - marshalInput = struct { - pragma.NoUnkeyedLiterals - Message Message - Buf []byte - Flags uint8 - } - marshalOutput = struct { - pragma.NoUnkeyedLiterals - Buf []byte - } - unmarshalInput = struct { - pragma.NoUnkeyedLiterals - Message Message - Buf []byte - Flags uint8 - Resolver interface { - FindExtensionByName(field FullName) (ExtensionType, error) - FindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error) - } - } - unmarshalOutput = struct { - pragma.NoUnkeyedLiterals - Flags uint8 - } - mergeInput = struct { - pragma.NoUnkeyedLiterals - Source Message - Destination Message - } - mergeOutput = struct { - pragma.NoUnkeyedLiterals - Flags uint8 - } - checkInitializedInput = struct { - pragma.NoUnkeyedLiterals - Message Message - } - checkInitializedOutput = struct { - pragma.NoUnkeyedLiterals - } -) diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go deleted file mode 100644 index dd85915bd..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package protoreflect provides interfaces to dynamically manipulate messages. -// -// This package includes type descriptors which describe the structure of types -// defined in proto source files and value interfaces which provide the -// ability to examine and manipulate the contents of messages. -// -// -// Protocol Buffer Descriptors -// -// Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor) -// are immutable objects that represent protobuf type information. -// They are wrappers around the messages declared in descriptor.proto. -// Protobuf descriptors alone lack any information regarding Go types. -// -// Enums and messages generated by this module implement Enum and ProtoMessage, -// where the Descriptor and ProtoReflect.Descriptor accessors respectively -// return the protobuf descriptor for the values. -// -// The protobuf descriptor interfaces are not meant to be implemented by -// user code since they might need to be extended in the future to support -// additions to the protobuf language. -// The "google.golang.org/protobuf/reflect/protodesc" package converts between -// google.protobuf.DescriptorProto messages and protobuf descriptors. -// -// -// Go Type Descriptors -// -// A type descriptor (e.g., EnumType or MessageType) is a constructor for -// a concrete Go type that represents the associated protobuf descriptor. -// There is commonly a one-to-one relationship between protobuf descriptors and -// Go type descriptors, but it can potentially be a one-to-many relationship. -// -// Enums and messages generated by this module implement Enum and ProtoMessage, -// where the Type and ProtoReflect.Type accessors respectively -// return the protobuf descriptor for the values. -// -// The "google.golang.org/protobuf/types/dynamicpb" package can be used to -// create Go type descriptors from protobuf descriptors. -// -// -// Value Interfaces -// -// The Enum and Message interfaces provide a reflective view over an -// enum or message instance. For enums, it provides the ability to retrieve -// the enum value number for any concrete enum type. For messages, it provides -// the ability to access or manipulate fields of the message. -// -// To convert a proto.Message to a protoreflect.Message, use the -// former's ProtoReflect method. Since the ProtoReflect method is new to the -// v2 message interface, it may not be present on older message implementations. -// The "github.com/golang/protobuf/proto".MessageReflect function can be used -// to obtain a reflective view on older messages. -// -// -// Relationships -// -// The following diagrams demonstrate the relationships between -// various types declared in this package. -// -// -// ┌───────────────────────────────────┐ -// V │ -// ┌────────────── New(n) ─────────────┐ │ -// │ │ │ -// │ ┌──── Descriptor() ──┐ │ ┌── Number() ──┐ │ -// │ │ V V │ V │ -// ╔════════════╗ ╔════════════════╗ ╔════════╗ ╔════════════╗ -// ║ EnumType ║ ║ EnumDescriptor ║ ║ Enum ║ ║ EnumNumber ║ -// ╚════════════╝ ╚════════════════╝ ╚════════╝ ╚════════════╝ -// Λ Λ │ │ -// │ └─── Descriptor() ──┘ │ -// │ │ -// └────────────────── Type() ───────┘ -// -// • An EnumType describes a concrete Go enum type. -// It has an EnumDescriptor and can construct an Enum instance. -// -// • An EnumDescriptor describes an abstract protobuf enum type. -// -// • An Enum is a concrete enum instance. Generated enums implement Enum. -// -// -// ┌──────────────── New() ─────────────────┐ -// │ │ -// │ ┌─── Descriptor() ─────┐ │ ┌── Interface() ───┐ -// │ │ V V │ V -// ╔═════════════╗ ╔═══════════════════╗ ╔═════════╗ ╔══════════════╗ -// ║ MessageType ║ ║ MessageDescriptor ║ ║ Message ║ ║ ProtoMessage ║ -// ╚═════════════╝ ╚═══════════════════╝ ╚═════════╝ ╚══════════════╝ -// Λ Λ │ │ Λ │ -// │ └──── Descriptor() ────┘ │ └─ ProtoReflect() ─┘ -// │ │ -// └─────────────────── Type() ─────────┘ -// -// • A MessageType describes a concrete Go message type. -// It has a MessageDescriptor and can construct a Message instance. -// -// • A MessageDescriptor describes an abstract protobuf message type. -// -// • A Message is a concrete message instance. Generated messages implement -// ProtoMessage, which can convert to/from a Message. -// -// -// ┌── TypeDescriptor() ──┐ ┌───── Descriptor() ─────┐ -// │ V │ V -// ╔═══════════════╗ ╔═════════════════════════╗ ╔═════════════════════╗ -// ║ ExtensionType ║ ║ ExtensionTypeDescriptor ║ ║ ExtensionDescriptor ║ -// ╚═══════════════╝ ╚═════════════════════════╝ ╚═════════════════════╝ -// Λ │ │ Λ │ Λ -// └─────── Type() ───────┘ │ └─── may implement ────┘ │ -// │ │ -// └────── implements ────────┘ -// -// • An ExtensionType describes a concrete Go implementation of an extension. -// It has an ExtensionTypeDescriptor and can convert to/from -// abstract Values and Go values. -// -// • An ExtensionTypeDescriptor is an ExtensionDescriptor -// which also has an ExtensionType. -// -// • An ExtensionDescriptor describes an abstract protobuf extension field and -// may not always be an ExtensionTypeDescriptor. -package protoreflect - -import ( - "fmt" - "strings" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/internal/pragma" -) - -type doNotImplement pragma.DoNotImplement - -// ProtoMessage is the top-level interface that all proto messages implement. -// This is declared in the protoreflect package to avoid a cyclic dependency; -// use the proto.Message type instead, which aliases this type. -type ProtoMessage interface{ ProtoReflect() Message } - -// Syntax is the language version of the proto file. -type Syntax syntax - -type syntax int8 // keep exact type opaque as the int type may change - -const ( - Proto2 Syntax = 2 - Proto3 Syntax = 3 -) - -// IsValid reports whether the syntax is valid. -func (s Syntax) IsValid() bool { - switch s { - case Proto2, Proto3: - return true - default: - return false - } -} - -// String returns s as a proto source identifier (e.g., "proto2"). -func (s Syntax) String() string { - switch s { - case Proto2: - return "proto2" - case Proto3: - return "proto3" - default: - return fmt.Sprintf("", s) - } -} - -// GoString returns s as a Go source identifier (e.g., "Proto2"). -func (s Syntax) GoString() string { - switch s { - case Proto2: - return "Proto2" - case Proto3: - return "Proto3" - default: - return fmt.Sprintf("Syntax(%d)", s) - } -} - -// Cardinality determines whether a field is optional, required, or repeated. -type Cardinality cardinality - -type cardinality int8 // keep exact type opaque as the int type may change - -// Constants as defined by the google.protobuf.Cardinality enumeration. -const ( - Optional Cardinality = 1 // appears zero or one times - Required Cardinality = 2 // appears exactly one time; invalid with Proto3 - Repeated Cardinality = 3 // appears zero or more times -) - -// IsValid reports whether the cardinality is valid. -func (c Cardinality) IsValid() bool { - switch c { - case Optional, Required, Repeated: - return true - default: - return false - } -} - -// String returns c as a proto source identifier (e.g., "optional"). -func (c Cardinality) String() string { - switch c { - case Optional: - return "optional" - case Required: - return "required" - case Repeated: - return "repeated" - default: - return fmt.Sprintf("", c) - } -} - -// GoString returns c as a Go source identifier (e.g., "Optional"). -func (c Cardinality) GoString() string { - switch c { - case Optional: - return "Optional" - case Required: - return "Required" - case Repeated: - return "Repeated" - default: - return fmt.Sprintf("Cardinality(%d)", c) - } -} - -// Kind indicates the basic proto kind of a field. -type Kind kind - -type kind int8 // keep exact type opaque as the int type may change - -// Constants as defined by the google.protobuf.Field.Kind enumeration. -const ( - BoolKind Kind = 8 - EnumKind Kind = 14 - Int32Kind Kind = 5 - Sint32Kind Kind = 17 - Uint32Kind Kind = 13 - Int64Kind Kind = 3 - Sint64Kind Kind = 18 - Uint64Kind Kind = 4 - Sfixed32Kind Kind = 15 - Fixed32Kind Kind = 7 - FloatKind Kind = 2 - Sfixed64Kind Kind = 16 - Fixed64Kind Kind = 6 - DoubleKind Kind = 1 - StringKind Kind = 9 - BytesKind Kind = 12 - MessageKind Kind = 11 - GroupKind Kind = 10 -) - -// IsValid reports whether the kind is valid. -func (k Kind) IsValid() bool { - switch k { - case BoolKind, EnumKind, - Int32Kind, Sint32Kind, Uint32Kind, - Int64Kind, Sint64Kind, Uint64Kind, - Sfixed32Kind, Fixed32Kind, FloatKind, - Sfixed64Kind, Fixed64Kind, DoubleKind, - StringKind, BytesKind, MessageKind, GroupKind: - return true - default: - return false - } -} - -// String returns k as a proto source identifier (e.g., "bool"). -func (k Kind) String() string { - switch k { - case BoolKind: - return "bool" - case EnumKind: - return "enum" - case Int32Kind: - return "int32" - case Sint32Kind: - return "sint32" - case Uint32Kind: - return "uint32" - case Int64Kind: - return "int64" - case Sint64Kind: - return "sint64" - case Uint64Kind: - return "uint64" - case Sfixed32Kind: - return "sfixed32" - case Fixed32Kind: - return "fixed32" - case FloatKind: - return "float" - case Sfixed64Kind: - return "sfixed64" - case Fixed64Kind: - return "fixed64" - case DoubleKind: - return "double" - case StringKind: - return "string" - case BytesKind: - return "bytes" - case MessageKind: - return "message" - case GroupKind: - return "group" - default: - return fmt.Sprintf("", k) - } -} - -// GoString returns k as a Go source identifier (e.g., "BoolKind"). -func (k Kind) GoString() string { - switch k { - case BoolKind: - return "BoolKind" - case EnumKind: - return "EnumKind" - case Int32Kind: - return "Int32Kind" - case Sint32Kind: - return "Sint32Kind" - case Uint32Kind: - return "Uint32Kind" - case Int64Kind: - return "Int64Kind" - case Sint64Kind: - return "Sint64Kind" - case Uint64Kind: - return "Uint64Kind" - case Sfixed32Kind: - return "Sfixed32Kind" - case Fixed32Kind: - return "Fixed32Kind" - case FloatKind: - return "FloatKind" - case Sfixed64Kind: - return "Sfixed64Kind" - case Fixed64Kind: - return "Fixed64Kind" - case DoubleKind: - return "DoubleKind" - case StringKind: - return "StringKind" - case BytesKind: - return "BytesKind" - case MessageKind: - return "MessageKind" - case GroupKind: - return "GroupKind" - default: - return fmt.Sprintf("Kind(%d)", k) - } -} - -// FieldNumber is the field number in a message. -type FieldNumber = protowire.Number - -// FieldNumbers represent a list of field numbers. -type FieldNumbers interface { - // Len reports the number of fields in the list. - Len() int - // Get returns the ith field number. It panics if out of bounds. - Get(i int) FieldNumber - // Has reports whether n is within the list of fields. - Has(n FieldNumber) bool - - doNotImplement -} - -// FieldRanges represent a list of field number ranges. -type FieldRanges interface { - // Len reports the number of ranges in the list. - Len() int - // Get returns the ith range. It panics if out of bounds. - Get(i int) [2]FieldNumber // start inclusive; end exclusive - // Has reports whether n is within any of the ranges. - Has(n FieldNumber) bool - - doNotImplement -} - -// EnumNumber is the numeric value for an enum. -type EnumNumber int32 - -// EnumRanges represent a list of enum number ranges. -type EnumRanges interface { - // Len reports the number of ranges in the list. - Len() int - // Get returns the ith range. It panics if out of bounds. - Get(i int) [2]EnumNumber // start inclusive; end inclusive - // Has reports whether n is within any of the ranges. - Has(n EnumNumber) bool - - doNotImplement -} - -// Name is the short name for a proto declaration. This is not the name -// as used in Go source code, which might not be identical to the proto name. -type Name string // e.g., "Kind" - -// IsValid reports whether s is a syntactically valid name. -// An empty name is invalid. -func (s Name) IsValid() bool { - return consumeIdent(string(s)) == len(s) -} - -// Names represent a list of names. -type Names interface { - // Len reports the number of names in the list. - Len() int - // Get returns the ith name. It panics if out of bounds. - Get(i int) Name - // Has reports whether s matches any names in the list. - Has(s Name) bool - - doNotImplement -} - -// FullName is a qualified name that uniquely identifies a proto declaration. -// A qualified name is the concatenation of the proto package along with the -// fully-declared name (i.e., name of parent preceding the name of the child), -// with a '.' delimiter placed between each Name. -// -// This should not have any leading or trailing dots. -type FullName string // e.g., "google.protobuf.Field.Kind" - -// IsValid reports whether s is a syntactically valid full name. -// An empty full name is invalid. -func (s FullName) IsValid() bool { - i := consumeIdent(string(s)) - if i < 0 { - return false - } - for len(s) > i { - if s[i] != '.' { - return false - } - i++ - n := consumeIdent(string(s[i:])) - if n < 0 { - return false - } - i += n - } - return true -} - -func consumeIdent(s string) (i int) { - if len(s) == 0 || !isLetter(s[i]) { - return -1 - } - i++ - for len(s) > i && isLetterDigit(s[i]) { - i++ - } - return i -} -func isLetter(c byte) bool { - return c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') -} -func isLetterDigit(c byte) bool { - return isLetter(c) || ('0' <= c && c <= '9') -} - -// Name returns the short name, which is the last identifier segment. -// A single segment FullName is the Name itself. -func (n FullName) Name() Name { - if i := strings.LastIndexByte(string(n), '.'); i >= 0 { - return Name(n[i+1:]) - } - return Name(n) -} - -// Parent returns the full name with the trailing identifier removed. -// A single segment FullName has no parent. -func (n FullName) Parent() FullName { - if i := strings.LastIndexByte(string(n), '.'); i >= 0 { - return n[:i] - } - return "" -} - -// Append returns the qualified name appended with the provided short name. -// -// Invariant: n == n.Parent().Append(n.Name()) // assuming n is valid -func (n FullName) Append(s Name) FullName { - if n == "" { - return FullName(s) - } - return n + "." + FullName(s) -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go deleted file mode 100644 index 32ea3d98c..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoreflect - -// SourceLocations is a list of source locations. -type SourceLocations interface { - // Len reports the number of source locations in the proto file. - Len() int - // Get returns the ith SourceLocation. It panics if out of bounds. - Get(int) SourceLocation - - doNotImplement - - // TODO: Add ByPath and ByDescriptor helper methods. -} - -// SourceLocation describes a source location and -// corresponds with the google.protobuf.SourceCodeInfo.Location message. -type SourceLocation struct { - // Path is the path to the declaration from the root file descriptor. - // The contents of this slice must not be mutated. - Path SourcePath - - // StartLine and StartColumn are the zero-indexed starting location - // in the source file for the declaration. - StartLine, StartColumn int - // EndLine and EndColumn are the zero-indexed ending location - // in the source file for the declaration. - // In the descriptor.proto, the end line may be omitted if it is identical - // to the start line. Here, it is always populated. - EndLine, EndColumn int - - // LeadingDetachedComments are the leading detached comments - // for the declaration. The contents of this slice must not be mutated. - LeadingDetachedComments []string - // LeadingComments is the leading attached comment for the declaration. - LeadingComments string - // TrailingComments is the trailing attached comment for the declaration. - TrailingComments string -} - -// SourcePath identifies part of a file descriptor for a source location. -// The SourcePath is a sequence of either field numbers or indexes into -// a repeated field that form a path starting from the root file descriptor. -// -// See google.protobuf.SourceCodeInfo.Location.path. -type SourcePath []int32 - -// TODO: Add SourcePath.String method to pretty-print the path. For example: -// ".message_type[6].nested_type[15].field[3]" diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go deleted file mode 100644 index 5be14a725..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +++ /dev/null @@ -1,631 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoreflect - -// Descriptor provides a set of accessors that are common to every descriptor. -// Each descriptor type wraps the equivalent google.protobuf.XXXDescriptorProto, -// but provides efficient lookup and immutability. -// -// Each descriptor is comparable. Equality implies that the two types are -// exactly identical. However, it is possible for the same semantically -// identical proto type to be represented by multiple type descriptors. -// -// For example, suppose we have t1 and t2 which are both MessageDescriptors. -// If t1 == t2, then the types are definitely equal and all accessors return -// the same information. However, if t1 != t2, then it is still possible that -// they still represent the same proto type (e.g., t1.FullName == t2.FullName). -// This can occur if a descriptor type is created dynamically, or multiple -// versions of the same proto type are accidentally linked into the Go binary. -type Descriptor interface { - // ParentFile returns the parent file descriptor that this descriptor - // is declared within. The parent file for the file descriptor is itself. - // - // Support for this functionality is optional and may return nil. - ParentFile() FileDescriptor - - // Parent returns the parent containing this descriptor declaration. - // The following shows the mapping from child type to possible parent types: - // - // ╔═════════════════════╤═══════════════════════════════════╗ - // ║ Child type │ Possible parent types ║ - // ╠═════════════════════╪═══════════════════════════════════╣ - // ║ FileDescriptor │ nil ║ - // ║ MessageDescriptor │ FileDescriptor, MessageDescriptor ║ - // ║ FieldDescriptor │ FileDescriptor, MessageDescriptor ║ - // ║ OneofDescriptor │ MessageDescriptor ║ - // ║ EnumDescriptor │ FileDescriptor, MessageDescriptor ║ - // ║ EnumValueDescriptor │ EnumDescriptor ║ - // ║ ServiceDescriptor │ FileDescriptor ║ - // ║ MethodDescriptor │ ServiceDescriptor ║ - // ╚═════════════════════╧═══════════════════════════════════╝ - // - // Support for this functionality is optional and may return nil. - Parent() Descriptor - - // Index returns the index of this descriptor within its parent. - // It returns 0 if the descriptor does not have a parent or if the parent - // is unknown. - Index() int - - // Syntax is the protobuf syntax. - Syntax() Syntax // e.g., Proto2 or Proto3 - - // Name is the short name of the declaration (i.e., FullName.Name). - Name() Name // e.g., "Any" - - // FullName is the fully-qualified name of the declaration. - // - // The FullName is a concatenation of the full name of the type that this - // type is declared within and the declaration name. For example, - // field "foo_field" in message "proto.package.MyMessage" is - // uniquely identified as "proto.package.MyMessage.foo_field". - // Enum values are an exception to the rule (see EnumValueDescriptor). - FullName() FullName // e.g., "google.protobuf.Any" - - // IsPlaceholder reports whether type information is missing since a - // dependency is not resolved, in which case only name information is known. - // - // Placeholder types may only be returned by the following accessors - // as a result of unresolved dependencies or weak imports: - // - // ╔═══════════════════════════════════╤═════════════════════╗ - // ║ Accessor │ Descriptor ║ - // ╠═══════════════════════════════════╪═════════════════════╣ - // ║ FileImports.FileDescriptor │ FileDescriptor ║ - // ║ FieldDescriptor.Enum │ EnumDescriptor ║ - // ║ FieldDescriptor.Message │ MessageDescriptor ║ - // ║ FieldDescriptor.DefaultEnumValue │ EnumValueDescriptor ║ - // ║ FieldDescriptor.ContainingMessage │ MessageDescriptor ║ - // ║ MethodDescriptor.Input │ MessageDescriptor ║ - // ║ MethodDescriptor.Output │ MessageDescriptor ║ - // ╚═══════════════════════════════════╧═════════════════════╝ - // - // If true, only Name and FullName are valid. - // For FileDescriptor, the Path is also valid. - IsPlaceholder() bool - - // Options returns the descriptor options. The caller must not modify - // the returned value. - // - // To avoid a dependency cycle, this function returns a proto.Message value. - // The proto message type returned for each descriptor type is as follows: - // ╔═════════════════════╤══════════════════════════════════════════╗ - // ║ Go type │ Protobuf message type ║ - // ╠═════════════════════╪══════════════════════════════════════════╣ - // ║ FileDescriptor │ google.protobuf.FileOptions ║ - // ║ EnumDescriptor │ google.protobuf.EnumOptions ║ - // ║ EnumValueDescriptor │ google.protobuf.EnumValueOptions ║ - // ║ MessageDescriptor │ google.protobuf.MessageOptions ║ - // ║ FieldDescriptor │ google.protobuf.FieldOptions ║ - // ║ OneofDescriptor │ google.protobuf.OneofOptions ║ - // ║ ServiceDescriptor │ google.protobuf.ServiceOptions ║ - // ║ MethodDescriptor │ google.protobuf.MethodOptions ║ - // ╚═════════════════════╧══════════════════════════════════════════╝ - // - // This method returns a typed nil-pointer if no options are present. - // The caller must import the descriptorpb package to use this. - Options() ProtoMessage - - doNotImplement -} - -// FileDescriptor describes the types in a complete proto file and -// corresponds with the google.protobuf.FileDescriptorProto message. -// -// Top-level declarations: -// EnumDescriptor, MessageDescriptor, FieldDescriptor, and/or ServiceDescriptor. -type FileDescriptor interface { - Descriptor // Descriptor.FullName is identical to Package - - // Path returns the file name, relative to the source tree root. - Path() string // e.g., "path/to/file.proto" - // Package returns the protobuf package namespace. - Package() FullName // e.g., "google.protobuf" - - // Imports is a list of imported proto files. - Imports() FileImports - - // Enums is a list of the top-level enum declarations. - Enums() EnumDescriptors - // Messages is a list of the top-level message declarations. - Messages() MessageDescriptors - // Extensions is a list of the top-level extension declarations. - Extensions() ExtensionDescriptors - // Services is a list of the top-level service declarations. - Services() ServiceDescriptors - - // SourceLocations is a list of source locations. - SourceLocations() SourceLocations - - isFileDescriptor -} -type isFileDescriptor interface{ ProtoType(FileDescriptor) } - -// FileImports is a list of file imports. -type FileImports interface { - // Len reports the number of files imported by this proto file. - Len() int - // Get returns the ith FileImport. It panics if out of bounds. - Get(i int) FileImport - - doNotImplement -} - -// FileImport is the declaration for a proto file import. -type FileImport struct { - // FileDescriptor is the file type for the given import. - // It is a placeholder descriptor if IsWeak is set or if a dependency has - // not been regenerated to implement the new reflection APIs. - FileDescriptor - - // IsPublic reports whether this is a public import, which causes this file - // to alias declarations within the imported file. The intended use cases - // for this feature is the ability to move proto files without breaking - // existing dependencies. - // - // The current file and the imported file must be within proto package. - IsPublic bool - - // IsWeak reports whether this is a weak import, which does not impose - // a direct dependency on the target file. - // - // Weak imports are a legacy proto1 feature. Equivalent behavior is - // achieved using proto2 extension fields or proto3 Any messages. - IsWeak bool -} - -// MessageDescriptor describes a message and -// corresponds with the google.protobuf.DescriptorProto message. -// -// Nested declarations: -// FieldDescriptor, OneofDescriptor, FieldDescriptor, EnumDescriptor, -// and/or MessageDescriptor. -type MessageDescriptor interface { - Descriptor - - // IsMapEntry indicates that this is an auto-generated message type to - // represent the entry type for a map field. - // - // Map entry messages have only two fields: - // • a "key" field with a field number of 1 - // • a "value" field with a field number of 2 - // The key and value types are determined by these two fields. - // - // If IsMapEntry is true, it implies that FieldDescriptor.IsMap is true - // for some field with this message type. - IsMapEntry() bool - - // Fields is a list of nested field declarations. - Fields() FieldDescriptors - // Oneofs is a list of nested oneof declarations. - Oneofs() OneofDescriptors - - // ReservedNames is a list of reserved field names. - ReservedNames() Names - // ReservedRanges is a list of reserved ranges of field numbers. - ReservedRanges() FieldRanges - // RequiredNumbers is a list of required field numbers. - // In Proto3, it is always an empty list. - RequiredNumbers() FieldNumbers - // ExtensionRanges is the field ranges used for extension fields. - // In Proto3, it is always an empty ranges. - ExtensionRanges() FieldRanges - // ExtensionRangeOptions returns the ith extension range options. - // - // To avoid a dependency cycle, this method returns a proto.Message value, - // which always contains a google.protobuf.ExtensionRangeOptions message. - // This method returns a typed nil-pointer if no options are present. - // The caller must import the descriptorpb package to use this. - ExtensionRangeOptions(i int) ProtoMessage - - // Enums is a list of nested enum declarations. - Enums() EnumDescriptors - // Messages is a list of nested message declarations. - Messages() MessageDescriptors - // Extensions is a list of nested extension declarations. - Extensions() ExtensionDescriptors - - isMessageDescriptor -} -type isMessageDescriptor interface{ ProtoType(MessageDescriptor) } - -// MessageType encapsulates a MessageDescriptor with a concrete Go implementation. -type MessageType interface { - // New returns a newly allocated empty message. - New() Message - - // Zero returns an empty, read-only message. - Zero() Message - - // Descriptor returns the message descriptor. - // - // Invariant: t.Descriptor() == t.New().Descriptor() - Descriptor() MessageDescriptor -} - -// MessageDescriptors is a list of message declarations. -type MessageDescriptors interface { - // Len reports the number of messages. - Len() int - // Get returns the ith MessageDescriptor. It panics if out of bounds. - Get(i int) MessageDescriptor - // ByName returns the MessageDescriptor for a message named s. - // It returns nil if not found. - ByName(s Name) MessageDescriptor - - doNotImplement -} - -// FieldDescriptor describes a field within a message and -// corresponds with the google.protobuf.FieldDescriptorProto message. -// -// It is used for both normal fields defined within the parent message -// (e.g., MessageDescriptor.Fields) and fields that extend some remote message -// (e.g., FileDescriptor.Extensions or MessageDescriptor.Extensions). -type FieldDescriptor interface { - Descriptor - - // Number reports the unique number for this field. - Number() FieldNumber - // Cardinality reports the cardinality for this field. - Cardinality() Cardinality - // Kind reports the basic kind for this field. - Kind() Kind - - // HasJSONName reports whether this field has an explicitly set JSON name. - HasJSONName() bool - - // JSONName reports the name used for JSON serialization. - // It is usually the camel-cased form of the field name. - JSONName() string - - // HasPresence reports whether the field distinguishes between unpopulated - // and default values. - HasPresence() bool - - // IsExtension reports whether this is an extension field. If false, - // then Parent and ContainingMessage refer to the same message. - // Otherwise, ContainingMessage and Parent likely differ. - IsExtension() bool - - // HasOptionalKeyword reports whether the "optional" keyword was explicitly - // specified in the source .proto file. - HasOptionalKeyword() bool - - // IsWeak reports whether this is a weak field, which does not impose a - // direct dependency on the target type. - // If true, then Message returns a placeholder type. - IsWeak() bool - - // IsPacked reports whether repeated primitive numeric kinds should be - // serialized using a packed encoding. - // If true, then it implies Cardinality is Repeated. - IsPacked() bool - - // IsList reports whether this field represents a list, - // where the value type for the associated field is a List. - // It is equivalent to checking whether Cardinality is Repeated and - // that IsMap reports false. - IsList() bool - - // IsMap reports whether this field represents a map, - // where the value type for the associated field is a Map. - // It is equivalent to checking whether Cardinality is Repeated, - // that the Kind is MessageKind, and that Message.IsMapEntry reports true. - IsMap() bool - - // MapKey returns the field descriptor for the key in the map entry. - // It returns nil if IsMap reports false. - MapKey() FieldDescriptor - - // MapValue returns the field descriptor for the value in the map entry. - // It returns nil if IsMap reports false. - MapValue() FieldDescriptor - - // HasDefault reports whether this field has a default value. - HasDefault() bool - - // Default returns the default value for scalar fields. - // For proto2, it is the default value as specified in the proto file, - // or the zero value if unspecified. - // For proto3, it is always the zero value of the scalar. - // The Value type is determined by the Kind. - Default() Value - - // DefaultEnumValue returns the enum value descriptor for the default value - // of an enum field, and is nil for any other kind of field. - DefaultEnumValue() EnumValueDescriptor - - // ContainingOneof is the containing oneof that this field belongs to, - // and is nil if this field is not part of a oneof. - ContainingOneof() OneofDescriptor - - // ContainingMessage is the containing message that this field belongs to. - // For extension fields, this may not necessarily be the parent message - // that the field is declared within. - ContainingMessage() MessageDescriptor - - // Enum is the enum descriptor if Kind is EnumKind. - // It returns nil for any other Kind. - Enum() EnumDescriptor - - // Message is the message descriptor if Kind is - // MessageKind or GroupKind. It returns nil for any other Kind. - Message() MessageDescriptor - - isFieldDescriptor -} -type isFieldDescriptor interface{ ProtoType(FieldDescriptor) } - -// FieldDescriptors is a list of field declarations. -type FieldDescriptors interface { - // Len reports the number of fields. - Len() int - // Get returns the ith FieldDescriptor. It panics if out of bounds. - Get(i int) FieldDescriptor - // ByName returns the FieldDescriptor for a field named s. - // It returns nil if not found. - ByName(s Name) FieldDescriptor - // ByJSONName returns the FieldDescriptor for a field with s as the JSON name. - // It returns nil if not found. - ByJSONName(s string) FieldDescriptor - // ByNumber returns the FieldDescriptor for a field numbered n. - // It returns nil if not found. - ByNumber(n FieldNumber) FieldDescriptor - - doNotImplement -} - -// OneofDescriptor describes a oneof field set within a given message and -// corresponds with the google.protobuf.OneofDescriptorProto message. -type OneofDescriptor interface { - Descriptor - - // IsSynthetic reports whether this is a synthetic oneof created to support - // proto3 optional semantics. If true, Fields contains exactly one field - // with HasOptionalKeyword specified. - IsSynthetic() bool - - // Fields is a list of fields belonging to this oneof. - Fields() FieldDescriptors - - isOneofDescriptor -} -type isOneofDescriptor interface{ ProtoType(OneofDescriptor) } - -// OneofDescriptors is a list of oneof declarations. -type OneofDescriptors interface { - // Len reports the number of oneof fields. - Len() int - // Get returns the ith OneofDescriptor. It panics if out of bounds. - Get(i int) OneofDescriptor - // ByName returns the OneofDescriptor for a oneof named s. - // It returns nil if not found. - ByName(s Name) OneofDescriptor - - doNotImplement -} - -// ExtensionDescriptor is an alias of FieldDescriptor for documentation. -type ExtensionDescriptor = FieldDescriptor - -// ExtensionTypeDescriptor is an ExtensionDescriptor with an associated ExtensionType. -type ExtensionTypeDescriptor interface { - ExtensionDescriptor - - // Type returns the associated ExtensionType. - Type() ExtensionType - - // Descriptor returns the plain ExtensionDescriptor without the - // associated ExtensionType. - Descriptor() ExtensionDescriptor -} - -// ExtensionDescriptors is a list of field declarations. -type ExtensionDescriptors interface { - // Len reports the number of fields. - Len() int - // Get returns the ith ExtensionDescriptor. It panics if out of bounds. - Get(i int) ExtensionDescriptor - // ByName returns the ExtensionDescriptor for a field named s. - // It returns nil if not found. - ByName(s Name) ExtensionDescriptor - - doNotImplement -} - -// ExtensionType encapsulates an ExtensionDescriptor with a concrete -// Go implementation. The nested field descriptor must be for a extension field. -// -// While a normal field is a member of the parent message that it is declared -// within (see Descriptor.Parent), an extension field is a member of some other -// target message (see ExtensionDescriptor.Extendee) and may have no -// relationship with the parent. However, the full name of an extension field is -// relative to the parent that it is declared within. -// -// For example: -// syntax = "proto2"; -// package example; -// message FooMessage { -// extensions 100 to max; -// } -// message BarMessage { -// extends FooMessage { optional BarMessage bar_field = 100; } -// } -// -// Field "bar_field" is an extension of FooMessage, but its full name is -// "example.BarMessage.bar_field" instead of "example.FooMessage.bar_field". -type ExtensionType interface { - // New returns a new value for the field. - // For scalars, this returns the default value in native Go form. - New() Value - - // Zero returns a new value for the field. - // For scalars, this returns the default value in native Go form. - // For composite types, this returns an empty, read-only message, list, or map. - Zero() Value - - // TypeDescriptor returns the extension type descriptor. - TypeDescriptor() ExtensionTypeDescriptor - - // ValueOf wraps the input and returns it as a Value. - // ValueOf panics if the input value is invalid or not the appropriate type. - // - // ValueOf is more extensive than protoreflect.ValueOf for a given field's - // value as it has more type information available. - ValueOf(interface{}) Value - - // InterfaceOf completely unwraps the Value to the underlying Go type. - // InterfaceOf panics if the input is nil or does not represent the - // appropriate underlying Go type. For composite types, it panics if the - // value is not mutable. - // - // InterfaceOf is able to unwrap the Value further than Value.Interface - // as it has more type information available. - InterfaceOf(Value) interface{} - - // IsValidValue reports whether the Value is valid to assign to the field. - IsValidValue(Value) bool - - // IsValidInterface reports whether the input is valid to assign to the field. - IsValidInterface(interface{}) bool -} - -// EnumDescriptor describes an enum and -// corresponds with the google.protobuf.EnumDescriptorProto message. -// -// Nested declarations: -// EnumValueDescriptor. -type EnumDescriptor interface { - Descriptor - - // Values is a list of nested enum value declarations. - Values() EnumValueDescriptors - - // ReservedNames is a list of reserved enum names. - ReservedNames() Names - // ReservedRanges is a list of reserved ranges of enum numbers. - ReservedRanges() EnumRanges - - isEnumDescriptor -} -type isEnumDescriptor interface{ ProtoType(EnumDescriptor) } - -// EnumType encapsulates an EnumDescriptor with a concrete Go implementation. -type EnumType interface { - // New returns an instance of this enum type with its value set to n. - New(n EnumNumber) Enum - - // Descriptor returns the enum descriptor. - // - // Invariant: t.Descriptor() == t.New(0).Descriptor() - Descriptor() EnumDescriptor -} - -// EnumDescriptors is a list of enum declarations. -type EnumDescriptors interface { - // Len reports the number of enum types. - Len() int - // Get returns the ith EnumDescriptor. It panics if out of bounds. - Get(i int) EnumDescriptor - // ByName returns the EnumDescriptor for an enum named s. - // It returns nil if not found. - ByName(s Name) EnumDescriptor - - doNotImplement -} - -// EnumValueDescriptor describes an enum value and -// corresponds with the google.protobuf.EnumValueDescriptorProto message. -// -// All other proto declarations are in the namespace of the parent. -// However, enum values do not follow this rule and are within the namespace -// of the parent's parent (i.e., they are a sibling of the containing enum). -// Thus, a value named "FOO_VALUE" declared within an enum uniquely identified -// as "proto.package.MyEnum" has a full name of "proto.package.FOO_VALUE". -type EnumValueDescriptor interface { - Descriptor - - // Number returns the enum value as an integer. - Number() EnumNumber - - isEnumValueDescriptor -} -type isEnumValueDescriptor interface{ ProtoType(EnumValueDescriptor) } - -// EnumValueDescriptors is a list of enum value declarations. -type EnumValueDescriptors interface { - // Len reports the number of enum values. - Len() int - // Get returns the ith EnumValueDescriptor. It panics if out of bounds. - Get(i int) EnumValueDescriptor - // ByName returns the EnumValueDescriptor for the enum value named s. - // It returns nil if not found. - ByName(s Name) EnumValueDescriptor - // ByNumber returns the EnumValueDescriptor for the enum value numbered n. - // If multiple have the same number, the first one defined is returned - // It returns nil if not found. - ByNumber(n EnumNumber) EnumValueDescriptor - - doNotImplement -} - -// ServiceDescriptor describes a service and -// corresponds with the google.protobuf.ServiceDescriptorProto message. -// -// Nested declarations: MethodDescriptor. -type ServiceDescriptor interface { - Descriptor - - // Methods is a list of nested message declarations. - Methods() MethodDescriptors - - isServiceDescriptor -} -type isServiceDescriptor interface{ ProtoType(ServiceDescriptor) } - -// ServiceDescriptors is a list of service declarations. -type ServiceDescriptors interface { - // Len reports the number of services. - Len() int - // Get returns the ith ServiceDescriptor. It panics if out of bounds. - Get(i int) ServiceDescriptor - // ByName returns the ServiceDescriptor for a service named s. - // It returns nil if not found. - ByName(s Name) ServiceDescriptor - - doNotImplement -} - -// MethodDescriptor describes a method and -// corresponds with the google.protobuf.MethodDescriptorProto message. -type MethodDescriptor interface { - Descriptor - - // Input is the input message descriptor. - Input() MessageDescriptor - // Output is the output message descriptor. - Output() MessageDescriptor - // IsStreamingClient reports whether the client streams multiple messages. - IsStreamingClient() bool - // IsStreamingServer reports whether the server streams multiple messages. - IsStreamingServer() bool - - isMethodDescriptor -} -type isMethodDescriptor interface{ ProtoType(MethodDescriptor) } - -// MethodDescriptors is a list of method declarations. -type MethodDescriptors interface { - // Len reports the number of methods. - Len() int - // Get returns the ith MethodDescriptor. It panics if out of bounds. - Get(i int) MethodDescriptor - // ByName returns the MethodDescriptor for a service method named s. - // It returns nil if not found. - ByName(s Name) MethodDescriptor - - doNotImplement -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go deleted file mode 100644 index f31981077..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoreflect - -import "google.golang.org/protobuf/encoding/protowire" - -// Enum is a reflection interface for a concrete enum value, -// which provides type information and a getter for the enum number. -// Enum does not provide a mutable API since enums are commonly backed by -// Go constants, which are not addressable. -type Enum interface { - // Descriptor returns enum descriptor, which contains only the protobuf - // type information for the enum. - Descriptor() EnumDescriptor - - // Type returns the enum type, which encapsulates both Go and protobuf - // type information. If the Go type information is not needed, - // it is recommended that the enum descriptor be used instead. - Type() EnumType - - // Number returns the enum value as an integer. - Number() EnumNumber -} - -// Message is a reflective interface for a concrete message value, -// encapsulating both type and value information for the message. -// -// Accessor/mutators for individual fields are keyed by FieldDescriptor. -// For non-extension fields, the descriptor must exactly match the -// field known by the parent message. -// For extension fields, the descriptor must implement ExtensionTypeDescriptor, -// extend the parent message (i.e., have the same message FullName), and -// be within the parent's extension range. -// -// Each field Value can be a scalar or a composite type (Message, List, or Map). -// See Value for the Go types associated with a FieldDescriptor. -// Providing a Value that is invalid or of an incorrect type panics. -type Message interface { - // Descriptor returns message descriptor, which contains only the protobuf - // type information for the message. - Descriptor() MessageDescriptor - - // Type returns the message type, which encapsulates both Go and protobuf - // type information. If the Go type information is not needed, - // it is recommended that the message descriptor be used instead. - Type() MessageType - - // New returns a newly allocated and mutable empty message. - New() Message - - // Interface unwraps the message reflection interface and - // returns the underlying ProtoMessage interface. - Interface() ProtoMessage - - // Range iterates over every populated field in an undefined order, - // calling f for each field descriptor and value encountered. - // Range returns immediately if f returns false. - // While iterating, mutating operations may only be performed - // on the current field descriptor. - Range(f func(FieldDescriptor, Value) bool) - - // Has reports whether a field is populated. - // - // Some fields have the property of nullability where it is possible to - // distinguish between the default value of a field and whether the field - // was explicitly populated with the default value. Singular message fields, - // member fields of a oneof, and proto2 scalar fields are nullable. Such - // fields are populated only if explicitly set. - // - // In other cases (aside from the nullable cases above), - // a proto3 scalar field is populated if it contains a non-zero value, and - // a repeated field is populated if it is non-empty. - Has(FieldDescriptor) bool - - // Clear clears the field such that a subsequent Has call reports false. - // - // Clearing an extension field clears both the extension type and value - // associated with the given field number. - // - // Clear is a mutating operation and unsafe for concurrent use. - Clear(FieldDescriptor) - - // Get retrieves the value for a field. - // - // For unpopulated scalars, it returns the default value, where - // the default value of a bytes scalar is guaranteed to be a copy. - // For unpopulated composite types, it returns an empty, read-only view - // of the value; to obtain a mutable reference, use Mutable. - Get(FieldDescriptor) Value - - // Set stores the value for a field. - // - // For a field belonging to a oneof, it implicitly clears any other field - // that may be currently set within the same oneof. - // For extension fields, it implicitly stores the provided ExtensionType. - // When setting a composite type, it is unspecified whether the stored value - // aliases the source's memory in any way. If the composite value is an - // empty, read-only value, then it panics. - // - // Set is a mutating operation and unsafe for concurrent use. - Set(FieldDescriptor, Value) - - // Mutable returns a mutable reference to a composite type. - // - // If the field is unpopulated, it may allocate a composite value. - // For a field belonging to a oneof, it implicitly clears any other field - // that may be currently set within the same oneof. - // For extension fields, it implicitly stores the provided ExtensionType - // if not already stored. - // It panics if the field does not contain a composite type. - // - // Mutable is a mutating operation and unsafe for concurrent use. - Mutable(FieldDescriptor) Value - - // NewField returns a new value that is assignable to the field - // for the given descriptor. For scalars, this returns the default value. - // For lists, maps, and messages, this returns a new, empty, mutable value. - NewField(FieldDescriptor) Value - - // WhichOneof reports which field within the oneof is populated, - // returning nil if none are populated. - // It panics if the oneof descriptor does not belong to this message. - WhichOneof(OneofDescriptor) FieldDescriptor - - // GetUnknown retrieves the entire list of unknown fields. - // The caller may only mutate the contents of the RawFields - // if the mutated bytes are stored back into the message with SetUnknown. - GetUnknown() RawFields - - // SetUnknown stores an entire list of unknown fields. - // The raw fields must be syntactically valid according to the wire format. - // An implementation may panic if this is not the case. - // Once stored, the caller must not mutate the content of the RawFields. - // An empty RawFields may be passed to clear the fields. - // - // SetUnknown is a mutating operation and unsafe for concurrent use. - SetUnknown(RawFields) - - // IsValid reports whether the message is valid. - // - // An invalid message is an empty, read-only value. - // - // An invalid message often corresponds to a nil pointer of the concrete - // message type, but the details are implementation dependent. - // Validity is not part of the protobuf data model, and may not - // be preserved in marshaling or other operations. - IsValid() bool - - // ProtoMethods returns optional fast-path implementions of various operations. - // This method may return nil. - // - // The returned methods type is identical to - // "google.golang.org/protobuf/runtime/protoiface".Methods. - // Consult the protoiface package documentation for details. - ProtoMethods() *methods -} - -// RawFields is the raw bytes for an ordered sequence of fields. -// Each field contains both the tag (representing field number and wire type), -// and also the wire data itself. -type RawFields []byte - -// IsValid reports whether b is syntactically correct wire format. -func (b RawFields) IsValid() bool { - for len(b) > 0 { - _, _, n := protowire.ConsumeField(b) - if n < 0 { - return false - } - b = b[n:] - } - return true -} - -// List is a zero-indexed, ordered list. -// The element Value type is determined by FieldDescriptor.Kind. -// Providing a Value that is invalid or of an incorrect type panics. -type List interface { - // Len reports the number of entries in the List. - // Get, Set, and Truncate panic with out of bound indexes. - Len() int - - // Get retrieves the value at the given index. - // It never returns an invalid value. - Get(int) Value - - // Set stores a value for the given index. - // When setting a composite type, it is unspecified whether the set - // value aliases the source's memory in any way. - // - // Set is a mutating operation and unsafe for concurrent use. - Set(int, Value) - - // Append appends the provided value to the end of the list. - // When appending a composite type, it is unspecified whether the appended - // value aliases the source's memory in any way. - // - // Append is a mutating operation and unsafe for concurrent use. - Append(Value) - - // AppendMutable appends a new, empty, mutable message value to the end - // of the list and returns it. - // It panics if the list does not contain a message type. - AppendMutable() Value - - // Truncate truncates the list to a smaller length. - // - // Truncate is a mutating operation and unsafe for concurrent use. - Truncate(int) - - // NewElement returns a new value for a list element. - // For enums, this returns the first enum value. - // For other scalars, this returns the zero value. - // For messages, this returns a new, empty, mutable value. - NewElement() Value - - // IsValid reports whether the list is valid. - // - // An invalid list is an empty, read-only value. - // - // Validity is not part of the protobuf data model, and may not - // be preserved in marshaling or other operations. - IsValid() bool -} - -// Map is an unordered, associative map. -// The entry MapKey type is determined by FieldDescriptor.MapKey.Kind. -// The entry Value type is determined by FieldDescriptor.MapValue.Kind. -// Providing a MapKey or Value that is invalid or of an incorrect type panics. -type Map interface { - // Len reports the number of elements in the map. - Len() int - - // Range iterates over every map entry in an undefined order, - // calling f for each key and value encountered. - // Range calls f Len times unless f returns false, which stops iteration. - // While iterating, mutating operations may only be performed - // on the current map key. - Range(f func(MapKey, Value) bool) - - // Has reports whether an entry with the given key is in the map. - Has(MapKey) bool - - // Clear clears the entry associated with they given key. - // The operation does nothing if there is no entry associated with the key. - // - // Clear is a mutating operation and unsafe for concurrent use. - Clear(MapKey) - - // Get retrieves the value for an entry with the given key. - // It returns an invalid value for non-existent entries. - Get(MapKey) Value - - // Set stores the value for an entry with the given key. - // It panics when given a key or value that is invalid or the wrong type. - // When setting a composite type, it is unspecified whether the set - // value aliases the source's memory in any way. - // - // Set is a mutating operation and unsafe for concurrent use. - Set(MapKey, Value) - - // Mutable retrieves a mutable reference to the entry for the given key. - // If no entry exists for the key, it creates a new, empty, mutable value - // and stores it as the entry for the key. - // It panics if the map value is not a message. - Mutable(MapKey) Value - - // NewValue returns a new value assignable as a map value. - // For enums, this returns the first enum value. - // For other scalars, this returns the zero value. - // For messages, this returns a new, empty, mutable value. - NewValue() Value - - // IsValid reports whether the map is valid. - // - // An invalid map is an empty, read-only value. - // - // An invalid message often corresponds to a nil Go map value, - // but the details are implementation dependent. - // Validity is not part of the protobuf data model, and may not - // be preserved in marshaling or other operations. - IsValid() bool -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go deleted file mode 100644 index 918e685e1..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build purego appengine - -package protoreflect - -import "google.golang.org/protobuf/internal/pragma" - -type valueType int - -const ( - nilType valueType = iota - boolType - int32Type - int64Type - uint32Type - uint64Type - float32Type - float64Type - stringType - bytesType - enumType - ifaceType -) - -// value is a union where only one type can be represented at a time. -// This uses a distinct field for each type. This is type safe in Go, but -// occupies more memory than necessary (72B). -type value struct { - pragma.DoNotCompare // 0B - - typ valueType // 8B - num uint64 // 8B - str string // 16B - bin []byte // 24B - iface interface{} // 16B -} - -func valueOfString(v string) Value { - return Value{typ: stringType, str: v} -} -func valueOfBytes(v []byte) Value { - return Value{typ: bytesType, bin: v} -} -func valueOfIface(v interface{}) Value { - return Value{typ: ifaceType, iface: v} -} - -func (v Value) getString() string { - return v.str -} -func (v Value) getBytes() []byte { - return v.bin -} -func (v Value) getIface() interface{} { - return v.iface -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go deleted file mode 100644 index 5a3414724..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoreflect - -import ( - "fmt" - "math" -) - -// Value is a union where only one Go type may be set at a time. -// The Value is used to represent all possible values a field may take. -// The following shows which Go type is used to represent each proto Kind: -// -// ╔════════════╤═════════════════════════════════════╗ -// ║ Go type │ Protobuf kind ║ -// ╠════════════╪═════════════════════════════════════╣ -// ║ bool │ BoolKind ║ -// ║ int32 │ Int32Kind, Sint32Kind, Sfixed32Kind ║ -// ║ int64 │ Int64Kind, Sint64Kind, Sfixed64Kind ║ -// ║ uint32 │ Uint32Kind, Fixed32Kind ║ -// ║ uint64 │ Uint64Kind, Fixed64Kind ║ -// ║ float32 │ FloatKind ║ -// ║ float64 │ DoubleKind ║ -// ║ string │ StringKind ║ -// ║ []byte │ BytesKind ║ -// ║ EnumNumber │ EnumKind ║ -// ║ Message │ MessageKind, GroupKind ║ -// ╚════════════╧═════════════════════════════════════╝ -// -// Multiple protobuf Kinds may be represented by a single Go type if the type -// can losslessly represent the information for the proto kind. For example, -// Int64Kind, Sint64Kind, and Sfixed64Kind are all represented by int64, -// but use different integer encoding methods. -// -// The List or Map types are used if the field cardinality is repeated. -// A field is a List if FieldDescriptor.IsList reports true. -// A field is a Map if FieldDescriptor.IsMap reports true. -// -// Converting to/from a Value and a concrete Go value panics on type mismatch. -// For example, ValueOf("hello").Int() panics because this attempts to -// retrieve an int64 from a string. -type Value value - -// The protoreflect API uses a custom Value union type instead of interface{} -// to keep the future open for performance optimizations. Using an interface{} -// always incurs an allocation for primitives (e.g., int64) since it needs to -// be boxed on the heap (as interfaces can only contain pointers natively). -// Instead, we represent the Value union as a flat struct that internally keeps -// track of which type is set. Using unsafe, the Value union can be reduced -// down to 24B, which is identical in size to a slice. -// -// The latest compiler (Go1.11) currently suffers from some limitations: -// • With inlining, the compiler should be able to statically prove that -// only one of these switch cases are taken and inline one specific case. -// See https://golang.org/issue/22310. - -// ValueOf returns a Value initialized with the concrete value stored in v. -// This panics if the type does not match one of the allowed types in the -// Value union. -func ValueOf(v interface{}) Value { - switch v := v.(type) { - case nil: - return Value{} - case bool: - return ValueOfBool(v) - case int32: - return ValueOfInt32(v) - case int64: - return ValueOfInt64(v) - case uint32: - return ValueOfUint32(v) - case uint64: - return ValueOfUint64(v) - case float32: - return ValueOfFloat32(v) - case float64: - return ValueOfFloat64(v) - case string: - return ValueOfString(v) - case []byte: - return ValueOfBytes(v) - case EnumNumber: - return ValueOfEnum(v) - case Message, List, Map: - return valueOfIface(v) - case ProtoMessage: - panic(fmt.Sprintf("invalid proto.Message(%T) type, expected a protoreflect.Message type", v)) - default: - panic(fmt.Sprintf("invalid type: %T", v)) - } -} - -// ValueOfBool returns a new boolean value. -func ValueOfBool(v bool) Value { - if v { - return Value{typ: boolType, num: 1} - } else { - return Value{typ: boolType, num: 0} - } -} - -// ValueOfInt32 returns a new int32 value. -func ValueOfInt32(v int32) Value { - return Value{typ: int32Type, num: uint64(v)} -} - -// ValueOfInt64 returns a new int64 value. -func ValueOfInt64(v int64) Value { - return Value{typ: int64Type, num: uint64(v)} -} - -// ValueOfUint32 returns a new uint32 value. -func ValueOfUint32(v uint32) Value { - return Value{typ: uint32Type, num: uint64(v)} -} - -// ValueOfUint64 returns a new uint64 value. -func ValueOfUint64(v uint64) Value { - return Value{typ: uint64Type, num: v} -} - -// ValueOfFloat32 returns a new float32 value. -func ValueOfFloat32(v float32) Value { - return Value{typ: float32Type, num: uint64(math.Float64bits(float64(v)))} -} - -// ValueOfFloat64 returns a new float64 value. -func ValueOfFloat64(v float64) Value { - return Value{typ: float64Type, num: uint64(math.Float64bits(float64(v)))} -} - -// ValueOfString returns a new string value. -func ValueOfString(v string) Value { - return valueOfString(v) -} - -// ValueOfBytes returns a new bytes value. -func ValueOfBytes(v []byte) Value { - return valueOfBytes(v[:len(v):len(v)]) -} - -// ValueOfEnum returns a new enum value. -func ValueOfEnum(v EnumNumber) Value { - return Value{typ: enumType, num: uint64(v)} -} - -// ValueOfMessage returns a new Message value. -func ValueOfMessage(v Message) Value { - return valueOfIface(v) -} - -// ValueOfList returns a new List value. -func ValueOfList(v List) Value { - return valueOfIface(v) -} - -// ValueOfMap returns a new Map value. -func ValueOfMap(v Map) Value { - return valueOfIface(v) -} - -// IsValid reports whether v is populated with a value. -func (v Value) IsValid() bool { - return v.typ != nilType -} - -// Interface returns v as an interface{}. -// -// Invariant: v == ValueOf(v).Interface() -func (v Value) Interface() interface{} { - switch v.typ { - case nilType: - return nil - case boolType: - return v.Bool() - case int32Type: - return int32(v.Int()) - case int64Type: - return int64(v.Int()) - case uint32Type: - return uint32(v.Uint()) - case uint64Type: - return uint64(v.Uint()) - case float32Type: - return float32(v.Float()) - case float64Type: - return float64(v.Float()) - case stringType: - return v.String() - case bytesType: - return v.Bytes() - case enumType: - return v.Enum() - default: - return v.getIface() - } -} - -func (v Value) typeName() string { - switch v.typ { - case nilType: - return "nil" - case boolType: - return "bool" - case int32Type: - return "int32" - case int64Type: - return "int64" - case uint32Type: - return "uint32" - case uint64Type: - return "uint64" - case float32Type: - return "float32" - case float64Type: - return "float64" - case stringType: - return "string" - case bytesType: - return "bytes" - case enumType: - return "enum" - default: - switch v := v.getIface().(type) { - case Message: - return "message" - case List: - return "list" - case Map: - return "map" - default: - return fmt.Sprintf("", v) - } - } -} - -func (v Value) panicMessage(what string) string { - return fmt.Sprintf("type mismatch: cannot convert %v to %s", v.typeName(), what) -} - -// Bool returns v as a bool and panics if the type is not a bool. -func (v Value) Bool() bool { - switch v.typ { - case boolType: - return v.num > 0 - default: - panic(v.panicMessage("bool")) - } -} - -// Int returns v as a int64 and panics if the type is not a int32 or int64. -func (v Value) Int() int64 { - switch v.typ { - case int32Type, int64Type: - return int64(v.num) - default: - panic(v.panicMessage("int")) - } -} - -// Uint returns v as a uint64 and panics if the type is not a uint32 or uint64. -func (v Value) Uint() uint64 { - switch v.typ { - case uint32Type, uint64Type: - return uint64(v.num) - default: - panic(v.panicMessage("uint")) - } -} - -// Float returns v as a float64 and panics if the type is not a float32 or float64. -func (v Value) Float() float64 { - switch v.typ { - case float32Type, float64Type: - return math.Float64frombits(uint64(v.num)) - default: - panic(v.panicMessage("float")) - } -} - -// String returns v as a string. Since this method implements fmt.Stringer, -// this returns the formatted string value for any non-string type. -func (v Value) String() string { - switch v.typ { - case stringType: - return v.getString() - default: - return fmt.Sprint(v.Interface()) - } -} - -// Bytes returns v as a []byte and panics if the type is not a []byte. -func (v Value) Bytes() []byte { - switch v.typ { - case bytesType: - return v.getBytes() - default: - panic(v.panicMessage("bytes")) - } -} - -// Enum returns v as a EnumNumber and panics if the type is not a EnumNumber. -func (v Value) Enum() EnumNumber { - switch v.typ { - case enumType: - return EnumNumber(v.num) - default: - panic(v.panicMessage("enum")) - } -} - -// Message returns v as a Message and panics if the type is not a Message. -func (v Value) Message() Message { - switch vi := v.getIface().(type) { - case Message: - return vi - default: - panic(v.panicMessage("message")) - } -} - -// List returns v as a List and panics if the type is not a List. -func (v Value) List() List { - switch vi := v.getIface().(type) { - case List: - return vi - default: - panic(v.panicMessage("list")) - } -} - -// Map returns v as a Map and panics if the type is not a Map. -func (v Value) Map() Map { - switch vi := v.getIface().(type) { - case Map: - return vi - default: - panic(v.panicMessage("map")) - } -} - -// MapKey returns v as a MapKey and panics for invalid MapKey types. -func (v Value) MapKey() MapKey { - switch v.typ { - case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType: - return MapKey(v) - default: - panic(v.panicMessage("map key")) - } -} - -// MapKey is used to index maps, where the Go type of the MapKey must match -// the specified key Kind (see MessageDescriptor.IsMapEntry). -// The following shows what Go type is used to represent each proto Kind: -// -// ╔═════════╤═════════════════════════════════════╗ -// ║ Go type │ Protobuf kind ║ -// ╠═════════╪═════════════════════════════════════╣ -// ║ bool │ BoolKind ║ -// ║ int32 │ Int32Kind, Sint32Kind, Sfixed32Kind ║ -// ║ int64 │ Int64Kind, Sint64Kind, Sfixed64Kind ║ -// ║ uint32 │ Uint32Kind, Fixed32Kind ║ -// ║ uint64 │ Uint64Kind, Fixed64Kind ║ -// ║ string │ StringKind ║ -// ╚═════════╧═════════════════════════════════════╝ -// -// A MapKey is constructed and accessed through a Value: -// k := ValueOf("hash").MapKey() // convert string to MapKey -// s := k.String() // convert MapKey to string -// -// The MapKey is a strict subset of valid types used in Value; -// converting a Value to a MapKey with an invalid type panics. -type MapKey value - -// IsValid reports whether k is populated with a value. -func (k MapKey) IsValid() bool { - return Value(k).IsValid() -} - -// Interface returns k as an interface{}. -func (k MapKey) Interface() interface{} { - return Value(k).Interface() -} - -// Bool returns k as a bool and panics if the type is not a bool. -func (k MapKey) Bool() bool { - return Value(k).Bool() -} - -// Int returns k as a int64 and panics if the type is not a int32 or int64. -func (k MapKey) Int() int64 { - return Value(k).Int() -} - -// Uint returns k as a uint64 and panics if the type is not a uint32 or uint64. -func (k MapKey) Uint() uint64 { - return Value(k).Uint() -} - -// String returns k as a string. Since this method implements fmt.Stringer, -// this returns the formatted string value for any non-string type. -func (k MapKey) String() string { - return Value(k).String() -} - -// Value returns k as a Value. -func (k MapKey) Value() Value { - return Value(k) -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go deleted file mode 100644 index c45debdca..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !purego,!appengine - -package protoreflect - -import ( - "unsafe" - - "google.golang.org/protobuf/internal/pragma" -) - -type ( - stringHeader struct { - Data unsafe.Pointer - Len int - } - sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int - } - ifaceHeader struct { - Type unsafe.Pointer - Data unsafe.Pointer - } -) - -var ( - nilType = typeOf(nil) - boolType = typeOf(*new(bool)) - int32Type = typeOf(*new(int32)) - int64Type = typeOf(*new(int64)) - uint32Type = typeOf(*new(uint32)) - uint64Type = typeOf(*new(uint64)) - float32Type = typeOf(*new(float32)) - float64Type = typeOf(*new(float64)) - stringType = typeOf(*new(string)) - bytesType = typeOf(*new([]byte)) - enumType = typeOf(*new(EnumNumber)) -) - -// typeOf returns a pointer to the Go type information. -// The pointer is comparable and equal if and only if the types are identical. -func typeOf(t interface{}) unsafe.Pointer { - return (*ifaceHeader)(unsafe.Pointer(&t)).Type -} - -// value is a union where only one type can be represented at a time. -// The struct is 24B large on 64-bit systems and requires the minimum storage -// necessary to represent each possible type. -// -// The Go GC needs to be able to scan variables containing pointers. -// As such, pointers and non-pointers cannot be intermixed. -type value struct { - pragma.DoNotCompare // 0B - - // typ stores the type of the value as a pointer to the Go type. - typ unsafe.Pointer // 8B - - // ptr stores the data pointer for a String, Bytes, or interface value. - ptr unsafe.Pointer // 8B - - // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or - // Enum value as a raw uint64. - // - // It is also used to store the length of a String or Bytes value; - // the capacity is ignored. - num uint64 // 8B -} - -func valueOfString(v string) Value { - p := (*stringHeader)(unsafe.Pointer(&v)) - return Value{typ: stringType, ptr: p.Data, num: uint64(len(v))} -} -func valueOfBytes(v []byte) Value { - p := (*sliceHeader)(unsafe.Pointer(&v)) - return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))} -} -func valueOfIface(v interface{}) Value { - p := (*ifaceHeader)(unsafe.Pointer(&v)) - return Value{typ: p.Type, ptr: p.Data} -} - -func (v Value) getString() (x string) { - *(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)} - return x -} -func (v Value) getBytes() (x []byte) { - *(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)} - return x -} -func (v Value) getIface() (x interface{}) { - *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} - return x -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go deleted file mode 100644 index 5e5f96716..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +++ /dev/null @@ -1,800 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package protoregistry provides data structures to register and lookup -// protobuf descriptor types. -// -// The Files registry contains file descriptors and provides the ability -// to iterate over the files or lookup a specific descriptor within the files. -// Files only contains protobuf descriptors and has no understanding of Go -// type information that may be associated with each descriptor. -// -// The Types registry contains descriptor types for which there is a known -// Go type associated with that descriptor. It provides the ability to iterate -// over the registered types or lookup a type by name. -package protoregistry - -import ( - "fmt" - "log" - "strings" - "sync" - - "google.golang.org/protobuf/internal/errors" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// ignoreConflict reports whether to ignore a registration conflict -// given the descriptor being registered and the error. -// It is a variable so that the behavior is easily overridden in another file. -var ignoreConflict = func(d protoreflect.Descriptor, err error) bool { - log.Printf(""+ - "WARNING: %v\n"+ - "A future release will panic on registration conflicts. See:\n"+ - "https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict\n"+ - "\n", err) - return true -} - -var globalMutex sync.RWMutex - -// GlobalFiles is a global registry of file descriptors. -var GlobalFiles *Files = new(Files) - -// GlobalTypes is the registry used by default for type lookups -// unless a local registry is provided by the user. -var GlobalTypes *Types = new(Types) - -// NotFound is a sentinel error value to indicate that the type was not found. -// -// Since registry lookup can happen in the critical performance path, resolvers -// must return this exact error value, not an error wrapping it. -var NotFound = errors.New("not found") - -// Files is a registry for looking up or iterating over files and the -// descriptors contained within them. -// The Find and Range methods are safe for concurrent use. -type Files struct { - // The map of descsByName contains: - // EnumDescriptor - // EnumValueDescriptor - // MessageDescriptor - // ExtensionDescriptor - // ServiceDescriptor - // *packageDescriptor - // - // Note that files are stored as a slice, since a package may contain - // multiple files. Only top-level declarations are registered. - // Note that enum values are in the top-level since that are in the same - // scope as the parent enum. - descsByName map[protoreflect.FullName]interface{} - filesByPath map[string]protoreflect.FileDescriptor -} - -type packageDescriptor struct { - files []protoreflect.FileDescriptor -} - -// RegisterFile registers the provided file descriptor. -// -// If any descriptor within the file conflicts with the descriptor of any -// previously registered file (e.g., two enums with the same full name), -// then the file is not registered and an error is returned. -// -// It is permitted for multiple files to have the same file path. -func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error { - if r == GlobalFiles { - globalMutex.Lock() - defer globalMutex.Unlock() - } - if r.descsByName == nil { - r.descsByName = map[protoreflect.FullName]interface{}{ - "": &packageDescriptor{}, - } - r.filesByPath = make(map[string]protoreflect.FileDescriptor) - } - path := file.Path() - if prev := r.filesByPath[path]; prev != nil { - // TODO: Remove this after some soak-in period after moving these types. - var prevPath string - const prevModule = "google.golang.org/genproto" - const prevVersion = "cb27e3aa (May 26th, 2020)" - switch path { - case "google/protobuf/field_mask.proto": - prevPath = prevModule + "/protobuf/field_mask" - case "google/protobuf/api.proto": - prevPath = prevModule + "/protobuf/api" - case "google/protobuf/type.proto": - prevPath = prevModule + "/protobuf/ptype" - case "google/protobuf/source_context.proto": - prevPath = prevModule + "/protobuf/source_context" - } - if r == GlobalFiles && prevPath != "" { - pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto") - pkgName = strings.Replace(pkgName, "_", "", -1) + "pb" - currPath := "google.golang.org/protobuf/types/known/" + pkgName - panic(fmt.Sprintf(""+ - "duplicate registration of %q\n"+ - "\n"+ - "The generated definition for this file has moved:\n"+ - "\tfrom: %q\n"+ - "\tto: %q\n"+ - "A dependency on the %q module must\n"+ - "be at version %v or higher.\n"+ - "\n"+ - "Upgrade the dependency by running:\n"+ - "\tgo get -u %v\n", - path, prevPath, currPath, prevModule, prevVersion, prevPath)) - } - - err := errors.New("file %q is already registered", file.Path()) - err = amendErrorWithCaller(err, prev, file) - if r == GlobalFiles && ignoreConflict(file, err) { - err = nil - } - return err - } - - for name := file.Package(); name != ""; name = name.Parent() { - switch prev := r.descsByName[name]; prev.(type) { - case nil, *packageDescriptor: - default: - err := errors.New("file %q has a package name conflict over %v", file.Path(), name) - err = amendErrorWithCaller(err, prev, file) - if r == GlobalFiles && ignoreConflict(file, err) { - err = nil - } - return err - } - } - var err error - var hasConflict bool - rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) { - if prev := r.descsByName[d.FullName()]; prev != nil { - hasConflict = true - err = errors.New("file %q has a name conflict over %v", file.Path(), d.FullName()) - err = amendErrorWithCaller(err, prev, file) - if r == GlobalFiles && ignoreConflict(d, err) { - err = nil - } - } - }) - if hasConflict { - return err - } - - for name := file.Package(); name != ""; name = name.Parent() { - if r.descsByName[name] == nil { - r.descsByName[name] = &packageDescriptor{} - } - } - p := r.descsByName[file.Package()].(*packageDescriptor) - p.files = append(p.files, file) - rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) { - r.descsByName[d.FullName()] = d - }) - r.filesByPath[path] = file - return nil -} - -// FindDescriptorByName looks up a descriptor by the full name. -// -// This returns (nil, NotFound) if not found. -func (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) { - if r == nil { - return nil, NotFound - } - if r == GlobalFiles { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - prefix := name - suffix := nameSuffix("") - for prefix != "" { - if d, ok := r.descsByName[prefix]; ok { - switch d := d.(type) { - case protoreflect.EnumDescriptor: - if d.FullName() == name { - return d, nil - } - case protoreflect.EnumValueDescriptor: - if d.FullName() == name { - return d, nil - } - case protoreflect.MessageDescriptor: - if d.FullName() == name { - return d, nil - } - if d := findDescriptorInMessage(d, suffix); d != nil && d.FullName() == name { - return d, nil - } - case protoreflect.ExtensionDescriptor: - if d.FullName() == name { - return d, nil - } - case protoreflect.ServiceDescriptor: - if d.FullName() == name { - return d, nil - } - if d := d.Methods().ByName(suffix.Pop()); d != nil && d.FullName() == name { - return d, nil - } - } - return nil, NotFound - } - prefix = prefix.Parent() - suffix = nameSuffix(name[len(prefix)+len("."):]) - } - return nil, NotFound -} - -func findDescriptorInMessage(md protoreflect.MessageDescriptor, suffix nameSuffix) protoreflect.Descriptor { - name := suffix.Pop() - if suffix == "" { - if ed := md.Enums().ByName(name); ed != nil { - return ed - } - for i := md.Enums().Len() - 1; i >= 0; i-- { - if vd := md.Enums().Get(i).Values().ByName(name); vd != nil { - return vd - } - } - if xd := md.Extensions().ByName(name); xd != nil { - return xd - } - if fd := md.Fields().ByName(name); fd != nil { - return fd - } - if od := md.Oneofs().ByName(name); od != nil { - return od - } - } - if md := md.Messages().ByName(name); md != nil { - if suffix == "" { - return md - } - return findDescriptorInMessage(md, suffix) - } - return nil -} - -type nameSuffix string - -func (s *nameSuffix) Pop() (name protoreflect.Name) { - if i := strings.IndexByte(string(*s), '.'); i >= 0 { - name, *s = protoreflect.Name((*s)[:i]), (*s)[i+1:] - } else { - name, *s = protoreflect.Name((*s)), "" - } - return name -} - -// FindFileByPath looks up a file by the path. -// -// This returns (nil, NotFound) if not found. -func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { - if r == nil { - return nil, NotFound - } - if r == GlobalFiles { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - if fd, ok := r.filesByPath[path]; ok { - return fd, nil - } - return nil, NotFound -} - -// NumFiles reports the number of registered files. -func (r *Files) NumFiles() int { - if r == nil { - return 0 - } - if r == GlobalFiles { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - return len(r.filesByPath) -} - -// RangeFiles iterates over all registered files while f returns true. -// The iteration order is undefined. -func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) { - if r == nil { - return - } - if r == GlobalFiles { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - for _, file := range r.filesByPath { - if !f(file) { - return - } - } -} - -// NumFilesByPackage reports the number of registered files in a proto package. -func (r *Files) NumFilesByPackage(name protoreflect.FullName) int { - if r == nil { - return 0 - } - if r == GlobalFiles { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - p, ok := r.descsByName[name].(*packageDescriptor) - if !ok { - return 0 - } - return len(p.files) -} - -// RangeFilesByPackage iterates over all registered files in a given proto package -// while f returns true. The iteration order is undefined. -func (r *Files) RangeFilesByPackage(name protoreflect.FullName, f func(protoreflect.FileDescriptor) bool) { - if r == nil { - return - } - if r == GlobalFiles { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - p, ok := r.descsByName[name].(*packageDescriptor) - if !ok { - return - } - for _, file := range p.files { - if !f(file) { - return - } - } -} - -// rangeTopLevelDescriptors iterates over all top-level descriptors in a file -// which will be directly entered into the registry. -func rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflect.Descriptor)) { - eds := fd.Enums() - for i := eds.Len() - 1; i >= 0; i-- { - f(eds.Get(i)) - vds := eds.Get(i).Values() - for i := vds.Len() - 1; i >= 0; i-- { - f(vds.Get(i)) - } - } - mds := fd.Messages() - for i := mds.Len() - 1; i >= 0; i-- { - f(mds.Get(i)) - } - xds := fd.Extensions() - for i := xds.Len() - 1; i >= 0; i-- { - f(xds.Get(i)) - } - sds := fd.Services() - for i := sds.Len() - 1; i >= 0; i-- { - f(sds.Get(i)) - } -} - -// MessageTypeResolver is an interface for looking up messages. -// -// A compliant implementation must deterministically return the same type -// if no error is encountered. -// -// The Types type implements this interface. -type MessageTypeResolver interface { - // FindMessageByName looks up a message by its full name. - // E.g., "google.protobuf.Any" - // - // This return (nil, NotFound) if not found. - FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) - - // FindMessageByURL looks up a message by a URL identifier. - // See documentation on google.protobuf.Any.type_url for the URL format. - // - // This returns (nil, NotFound) if not found. - FindMessageByURL(url string) (protoreflect.MessageType, error) -} - -// ExtensionTypeResolver is an interface for looking up extensions. -// -// A compliant implementation must deterministically return the same type -// if no error is encountered. -// -// The Types type implements this interface. -type ExtensionTypeResolver interface { - // FindExtensionByName looks up a extension field by the field's full name. - // Note that this is the full name of the field as determined by - // where the extension is declared and is unrelated to the full name of the - // message being extended. - // - // This returns (nil, NotFound) if not found. - FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) - - // FindExtensionByNumber looks up a extension field by the field number - // within some parent message, identified by full name. - // - // This returns (nil, NotFound) if not found. - FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) -} - -var ( - _ MessageTypeResolver = (*Types)(nil) - _ ExtensionTypeResolver = (*Types)(nil) -) - -// Types is a registry for looking up or iterating over descriptor types. -// The Find and Range methods are safe for concurrent use. -type Types struct { - typesByName typesByName - extensionsByMessage extensionsByMessage - - numEnums int - numMessages int - numExtensions int -} - -type ( - typesByName map[protoreflect.FullName]interface{} - extensionsByMessage map[protoreflect.FullName]extensionsByNumber - extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType -) - -// RegisterMessage registers the provided message type. -// -// If a naming conflict occurs, the type is not registered and an error is returned. -func (r *Types) RegisterMessage(mt protoreflect.MessageType) error { - // Under rare circumstances getting the descriptor might recursively - // examine the registry, so fetch it before locking. - md := mt.Descriptor() - - if r == GlobalTypes { - globalMutex.Lock() - defer globalMutex.Unlock() - } - - if err := r.register("message", md, mt); err != nil { - return err - } - r.numMessages++ - return nil -} - -// RegisterEnum registers the provided enum type. -// -// If a naming conflict occurs, the type is not registered and an error is returned. -func (r *Types) RegisterEnum(et protoreflect.EnumType) error { - // Under rare circumstances getting the descriptor might recursively - // examine the registry, so fetch it before locking. - ed := et.Descriptor() - - if r == GlobalTypes { - globalMutex.Lock() - defer globalMutex.Unlock() - } - - if err := r.register("enum", ed, et); err != nil { - return err - } - r.numEnums++ - return nil -} - -// RegisterExtension registers the provided extension type. -// -// If a naming conflict occurs, the type is not registered and an error is returned. -func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error { - // Under rare circumstances getting the descriptor might recursively - // examine the registry, so fetch it before locking. - // - // A known case where this can happen: Fetching the TypeDescriptor for a - // legacy ExtensionDesc can consult the global registry. - xd := xt.TypeDescriptor() - - if r == GlobalTypes { - globalMutex.Lock() - defer globalMutex.Unlock() - } - - field := xd.Number() - message := xd.ContainingMessage().FullName() - if prev := r.extensionsByMessage[message][field]; prev != nil { - err := errors.New("extension number %d is already registered on message %v", field, message) - err = amendErrorWithCaller(err, prev, xt) - if !(r == GlobalTypes && ignoreConflict(xd, err)) { - return err - } - } - - if err := r.register("extension", xd, xt); err != nil { - return err - } - if r.extensionsByMessage == nil { - r.extensionsByMessage = make(extensionsByMessage) - } - if r.extensionsByMessage[message] == nil { - r.extensionsByMessage[message] = make(extensionsByNumber) - } - r.extensionsByMessage[message][field] = xt - r.numExtensions++ - return nil -} - -func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error { - name := desc.FullName() - prev := r.typesByName[name] - if prev != nil { - err := errors.New("%v %v is already registered", kind, name) - err = amendErrorWithCaller(err, prev, typ) - if !(r == GlobalTypes && ignoreConflict(desc, err)) { - return err - } - } - if r.typesByName == nil { - r.typesByName = make(typesByName) - } - r.typesByName[name] = typ - return nil -} - -// FindEnumByName looks up an enum by its full name. -// E.g., "google.protobuf.Field.Kind". -// -// This returns (nil, NotFound) if not found. -func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) { - if r == nil { - return nil, NotFound - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - if v := r.typesByName[enum]; v != nil { - if et, _ := v.(protoreflect.EnumType); et != nil { - return et, nil - } - return nil, errors.New("found wrong type: got %v, want enum", typeName(v)) - } - return nil, NotFound -} - -// FindMessageByName looks up a message by its full name. -// E.g., "google.protobuf.Any" -// -// This return (nil, NotFound) if not found. -func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { - // The full name by itself is a valid URL. - return r.FindMessageByURL(string(message)) -} - -// FindMessageByURL looks up a message by a URL identifier. -// See documentation on google.protobuf.Any.type_url for the URL format. -// -// This returns (nil, NotFound) if not found. -func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) { - if r == nil { - return nil, NotFound - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - message := protoreflect.FullName(url) - if i := strings.LastIndexByte(url, '/'); i >= 0 { - message = message[i+len("/"):] - } - - if v := r.typesByName[message]; v != nil { - if mt, _ := v.(protoreflect.MessageType); mt != nil { - return mt, nil - } - return nil, errors.New("found wrong type: got %v, want message", typeName(v)) - } - return nil, NotFound -} - -// FindExtensionByName looks up a extension field by the field's full name. -// Note that this is the full name of the field as determined by -// where the extension is declared and is unrelated to the full name of the -// message being extended. -// -// This returns (nil, NotFound) if not found. -func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { - if r == nil { - return nil, NotFound - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - if v := r.typesByName[field]; v != nil { - if xt, _ := v.(protoreflect.ExtensionType); xt != nil { - return xt, nil - } - return nil, errors.New("found wrong type: got %v, want extension", typeName(v)) - } - return nil, NotFound -} - -// FindExtensionByNumber looks up a extension field by the field number -// within some parent message, identified by full name. -// -// This returns (nil, NotFound) if not found. -func (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { - if r == nil { - return nil, NotFound - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - if xt, ok := r.extensionsByMessage[message][field]; ok { - return xt, nil - } - return nil, NotFound -} - -// NumEnums reports the number of registered enums. -func (r *Types) NumEnums() int { - if r == nil { - return 0 - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - return r.numEnums -} - -// RangeEnums iterates over all registered enums while f returns true. -// Iteration order is undefined. -func (r *Types) RangeEnums(f func(protoreflect.EnumType) bool) { - if r == nil { - return - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - for _, typ := range r.typesByName { - if et, ok := typ.(protoreflect.EnumType); ok { - if !f(et) { - return - } - } - } -} - -// NumMessages reports the number of registered messages. -func (r *Types) NumMessages() int { - if r == nil { - return 0 - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - return r.numMessages -} - -// RangeMessages iterates over all registered messages while f returns true. -// Iteration order is undefined. -func (r *Types) RangeMessages(f func(protoreflect.MessageType) bool) { - if r == nil { - return - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - for _, typ := range r.typesByName { - if mt, ok := typ.(protoreflect.MessageType); ok { - if !f(mt) { - return - } - } - } -} - -// NumExtensions reports the number of registered extensions. -func (r *Types) NumExtensions() int { - if r == nil { - return 0 - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - return r.numExtensions -} - -// RangeExtensions iterates over all registered extensions while f returns true. -// Iteration order is undefined. -func (r *Types) RangeExtensions(f func(protoreflect.ExtensionType) bool) { - if r == nil { - return - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - for _, typ := range r.typesByName { - if xt, ok := typ.(protoreflect.ExtensionType); ok { - if !f(xt) { - return - } - } - } -} - -// NumExtensionsByMessage reports the number of registered extensions for -// a given message type. -func (r *Types) NumExtensionsByMessage(message protoreflect.FullName) int { - if r == nil { - return 0 - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - return len(r.extensionsByMessage[message]) -} - -// RangeExtensionsByMessage iterates over all registered extensions filtered -// by a given message type while f returns true. Iteration order is undefined. -func (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool) { - if r == nil { - return - } - if r == GlobalTypes { - globalMutex.RLock() - defer globalMutex.RUnlock() - } - for _, xt := range r.extensionsByMessage[message] { - if !f(xt) { - return - } - } -} - -func typeName(t interface{}) string { - switch t.(type) { - case protoreflect.EnumType: - return "enum" - case protoreflect.MessageType: - return "message" - case protoreflect.ExtensionType: - return "extension" - default: - return fmt.Sprintf("%T", t) - } -} - -func amendErrorWithCaller(err error, prev, curr interface{}) error { - prevPkg := goPackage(prev) - currPkg := goPackage(curr) - if prevPkg == "" || currPkg == "" || prevPkg == currPkg { - return err - } - return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg) -} - -func goPackage(v interface{}) string { - switch d := v.(type) { - case protoreflect.EnumType: - v = d.Descriptor() - case protoreflect.MessageType: - v = d.Descriptor() - case protoreflect.ExtensionType: - v = d.TypeDescriptor() - } - if d, ok := v.(protoreflect.Descriptor); ok { - v = d.ParentFile() - } - if d, ok := v.(interface{ GoPackagePath() string }); ok { - return d.GoPackagePath() - } - return "" -} diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go b/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go deleted file mode 100644 index c58727675..000000000 --- a/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoiface - -type MessageV1 interface { - Reset() - String() string - ProtoMessage() -} - -type ExtensionRangeV1 struct { - Start, End int32 // both inclusive -} diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go deleted file mode 100644 index 32c04f67e..000000000 --- a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package protoiface contains types referenced or implemented by messages. -// -// WARNING: This package should only be imported by message implementations. -// The functionality found in this package should be accessed through -// higher-level abstractions provided by the proto package. -package protoiface - -import ( - "google.golang.org/protobuf/internal/pragma" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Methods is a set of optional fast-path implementations of various operations. -type Methods = struct { - pragma.NoUnkeyedLiterals - - // Flags indicate support for optional features. - Flags SupportFlags - - // Size returns the size in bytes of the wire-format encoding of a message. - // Marshal must be provided if a custom Size is provided. - Size func(SizeInput) SizeOutput - - // Marshal formats a message in the wire-format encoding to the provided buffer. - // Size should be provided if a custom Marshal is provided. - // It must not return an error for a partial message. - Marshal func(MarshalInput) (MarshalOutput, error) - - // Unmarshal parses the wire-format encoding and merges the result into a message. - // It must not reset the target message or return an error for a partial message. - Unmarshal func(UnmarshalInput) (UnmarshalOutput, error) - - // Merge merges the contents of a source message into a destination message. - Merge func(MergeInput) MergeOutput - - // CheckInitialized returns an error if any required fields in the message are not set. - CheckInitialized func(CheckInitializedInput) (CheckInitializedOutput, error) -} - -// SupportFlags indicate support for optional features. -type SupportFlags = uint64 - -const ( - // SupportMarshalDeterministic reports whether MarshalOptions.Deterministic is supported. - SupportMarshalDeterministic SupportFlags = 1 << iota - - // SupportUnmarshalDiscardUnknown reports whether UnmarshalOptions.DiscardUnknown is supported. - SupportUnmarshalDiscardUnknown -) - -// SizeInput is input to the Size method. -type SizeInput = struct { - pragma.NoUnkeyedLiterals - - Message protoreflect.Message - Flags MarshalInputFlags -} - -// SizeOutput is output from the Size method. -type SizeOutput = struct { - pragma.NoUnkeyedLiterals - - Size int -} - -// MarshalInput is input to the Marshal method. -type MarshalInput = struct { - pragma.NoUnkeyedLiterals - - Message protoreflect.Message - Buf []byte // output is appended to this buffer - Flags MarshalInputFlags -} - -// MarshalOutput is output from the Marshal method. -type MarshalOutput = struct { - pragma.NoUnkeyedLiterals - - Buf []byte // contains marshaled message -} - -// MarshalInputFlags configure the marshaler. -// Most flags correspond to fields in proto.MarshalOptions. -type MarshalInputFlags = uint8 - -const ( - MarshalDeterministic MarshalInputFlags = 1 << iota - MarshalUseCachedSize -) - -// UnmarshalInput is input to the Unmarshal method. -type UnmarshalInput = struct { - pragma.NoUnkeyedLiterals - - Message protoreflect.Message - Buf []byte // input buffer - Flags UnmarshalInputFlags - Resolver interface { - FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) - FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) - } -} - -// UnmarshalOutput is output from the Unmarshal method. -type UnmarshalOutput = struct { - pragma.NoUnkeyedLiterals - - Flags UnmarshalOutputFlags -} - -// UnmarshalInputFlags configure the unmarshaler. -// Most flags correspond to fields in proto.UnmarshalOptions. -type UnmarshalInputFlags = uint8 - -const ( - UnmarshalDiscardUnknown UnmarshalInputFlags = 1 << iota -) - -// UnmarshalOutputFlags are output from the Unmarshal method. -type UnmarshalOutputFlags = uint8 - -const ( - // UnmarshalInitialized may be set on return if all required fields are known to be set. - // If unset, then it does not necessarily indicate that the message is uninitialized, - // only that its status could not be confirmed. - UnmarshalInitialized UnmarshalOutputFlags = 1 << iota -) - -// MergeInput is input to the Merge method. -type MergeInput = struct { - pragma.NoUnkeyedLiterals - - Source protoreflect.Message - Destination protoreflect.Message -} - -// MergeOutput is output from the Merge method. -type MergeOutput = struct { - pragma.NoUnkeyedLiterals - - Flags MergeOutputFlags -} - -// MergeOutputFlags are output from the Merge method. -type MergeOutputFlags = uint8 - -const ( - // MergeComplete reports whether the merge was performed. - // If unset, the merger must have made no changes to the destination. - MergeComplete MergeOutputFlags = 1 << iota -) - -// CheckInitializedInput is input to the CheckInitialized method. -type CheckInitializedInput = struct { - pragma.NoUnkeyedLiterals - - Message protoreflect.Message -} - -// CheckInitializedOutput is output from the CheckInitialized method. -type CheckInitializedOutput = struct { - pragma.NoUnkeyedLiterals -} diff --git a/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go b/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go deleted file mode 100644 index 4a1ab7fb3..000000000 --- a/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package protoimpl contains the default implementation for messages -// generated by protoc-gen-go. -// -// WARNING: This package should only ever be imported by generated messages. -// The compatibility agreement covers nothing except for functionality needed -// to keep existing generated messages operational. Breakages that occur due -// to unauthorized usages of this package are not the author's responsibility. -package protoimpl - -import ( - "google.golang.org/protobuf/internal/filedesc" - "google.golang.org/protobuf/internal/filetype" - "google.golang.org/protobuf/internal/impl" -) - -// UnsafeEnabled specifies whether package unsafe can be used. -const UnsafeEnabled = impl.UnsafeEnabled - -type ( - // Types used by generated code in init functions. - DescBuilder = filedesc.Builder - TypeBuilder = filetype.Builder - - // Types used by generated code to implement EnumType, MessageType, and ExtensionType. - EnumInfo = impl.EnumInfo - MessageInfo = impl.MessageInfo - ExtensionInfo = impl.ExtensionInfo - - // Types embedded in generated messages. - MessageState = impl.MessageState - SizeCache = impl.SizeCache - WeakFields = impl.WeakFields - UnknownFields = impl.UnknownFields - ExtensionFields = impl.ExtensionFields - ExtensionFieldV1 = impl.ExtensionField - - Pointer = impl.Pointer -) - -var X impl.Export diff --git a/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go b/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go deleted file mode 100644 index ff094e1ba..000000000 --- a/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package protoimpl - -import ( - "google.golang.org/protobuf/internal/version" -) - -const ( - // MaxVersion is the maximum supported version for generated .pb.go files. - // It is always the current version of the module. - MaxVersion = version.Minor - - // GenVersion is the runtime version required by generated .pb.go files. - // This is incremented when generated code relies on new functionality - // in the runtime. - GenVersion = 20 - - // MinVersion is the minimum supported version for generated .pb.go files. - // This is incremented when the runtime drops support for old code. - MinVersion = 0 -) - -// EnforceVersion is used by code generated by protoc-gen-go -// to statically enforce minimum and maximum versions of this package. -// A compilation failure implies either that: -// * the runtime package is too old and needs to be updated OR -// * the generated code is too old and needs to be regenerated. -// -// The runtime package can be upgraded by running: -// go get google.golang.org/protobuf -// -// The generated code can be regenerated by running: -// protoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES} -// -// Example usage by generated code: -// const ( -// // Verify that this generated code is sufficiently up-to-date. -// _ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion) -// // Verify that runtime/protoimpl is sufficiently up-to-date. -// _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion) -// ) -// -// The genVersion is the current minor version used to generated the code. -// This compile-time check relies on negative integer overflow of a uint -// being a compilation failure (guaranteed by the Go specification). -type EnforceVersion uint - -// This enforces the following invariant: -// MinVersion ≤ GenVersion ≤ MaxVersion -const ( - _ = EnforceVersion(GenVersion - MinVersion) - _ = EnforceVersion(MaxVersion - GenVersion) -) diff --git a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go deleted file mode 100644 index 82a473e26..000000000 --- a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go +++ /dev/null @@ -1,494 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/any.proto - -// Package anypb contains generated types for google/protobuf/any.proto. -// -// The Any message is a dynamic representation of any other message value. -// It is functionally a tuple of the full name of the remote message type and -// the serialized bytes of the remote message value. -// -// -// Constructing an Any -// -// An Any message containing another message value is constructed using New: -// -// any, err := anypb.New(m) -// if err != nil { -// ... // handle error -// } -// ... // make use of any -// -// -// Unmarshaling an Any -// -// With a populated Any message, the underlying message can be serialized into -// a remote concrete message value in a few ways. -// -// If the exact concrete type is known, then a new (or pre-existing) instance -// of that message can be passed to the UnmarshalTo method: -// -// m := new(foopb.MyMessage) -// if err := any.UnmarshalTo(m); err != nil { -// ... // handle error -// } -// ... // make use of m -// -// If the exact concrete type is not known, then the UnmarshalNew method can be -// used to unmarshal the contents into a new instance of the remote message type: -// -// m, err := any.UnmarshalNew() -// if err != nil { -// ... // handle error -// } -// ... // make use of m -// -// UnmarshalNew uses the global type registry to resolve the message type and -// construct a new instance of that message to unmarshal into. In order for a -// message type to appear in the global registry, the Go type representing that -// protobuf message type must be linked into the Go binary. For messages -// generated by protoc-gen-go, this is achieved through an import of the -// generated Go package representing a .proto file. -// -// A common pattern with UnmarshalNew is to use a type switch with the resulting -// proto.Message value: -// -// switch m := m.(type) { -// case *foopb.MyMessage: -// ... // make use of m as a *foopb.MyMessage -// case *barpb.OtherMessage: -// ... // make use of m as a *barpb.OtherMessage -// case *bazpb.SomeMessage: -// ... // make use of m as a *bazpb.SomeMessage -// } -// -// This pattern ensures that the generated packages containing the message types -// listed in the case clauses are linked into the Go binary and therefore also -// registered in the global registry. -// -// -// Type checking an Any -// -// In order to type check whether an Any message represents some other message, -// then use the MessageIs method: -// -// if any.MessageIs((*foopb.MyMessage)(nil)) { -// ... // make use of any, knowing that it contains a foopb.MyMessage -// } -// -// The MessageIs method can also be used with an allocated instance of the target -// message type if the intention is to unmarshal into it if the type matches: -// -// m := new(foopb.MyMessage) -// if any.MessageIs(m) { -// if err := any.UnmarshalTo(m); err != nil { -// ... // handle error -// } -// ... // make use of m -// } -// -package anypb - -import ( - proto "google.golang.org/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoregistry "google.golang.org/protobuf/reflect/protoregistry" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - strings "strings" - sync "sync" -) - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -type Any struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -// New marshals src into a new Any instance. -func New(src proto.Message) (*Any, error) { - dst := new(Any) - if err := dst.MarshalFrom(src); err != nil { - return nil, err - } - return dst, nil -} - -// MarshalFrom marshals src into dst as the underlying message -// using the provided marshal options. -// -// If no options are specified, call dst.MarshalFrom instead. -func MarshalFrom(dst *Any, src proto.Message, opts proto.MarshalOptions) error { - const urlPrefix = "type.googleapis.com/" - if src == nil { - return protoimpl.X.NewError("invalid nil source message") - } - b, err := opts.Marshal(src) - if err != nil { - return err - } - dst.TypeUrl = urlPrefix + string(src.ProtoReflect().Descriptor().FullName()) - dst.Value = b - return nil -} - -// UnmarshalTo unmarshals the underlying message from src into dst -// using the provided unmarshal options. -// It reports an error if dst is not of the right message type. -// -// If no options are specified, call src.UnmarshalTo instead. -func UnmarshalTo(src *Any, dst proto.Message, opts proto.UnmarshalOptions) error { - if src == nil { - return protoimpl.X.NewError("invalid nil source message") - } - if !src.MessageIs(dst) { - got := dst.ProtoReflect().Descriptor().FullName() - want := src.MessageName() - return protoimpl.X.NewError("mismatched message type: got %q, want %q", got, want) - } - return opts.Unmarshal(src.GetValue(), dst) -} - -// UnmarshalNew unmarshals the underlying message from src into dst, -// which is newly created message using a type resolved from the type URL. -// The message type is resolved according to opt.Resolver, -// which should implement protoregistry.MessageTypeResolver. -// It reports an error if the underlying message type could not be resolved. -// -// If no options are specified, call src.UnmarshalNew instead. -func UnmarshalNew(src *Any, opts proto.UnmarshalOptions) (dst proto.Message, err error) { - if src.GetTypeUrl() == "" { - return nil, protoimpl.X.NewError("invalid empty type URL") - } - if opts.Resolver == nil { - opts.Resolver = protoregistry.GlobalTypes - } - r, ok := opts.Resolver.(protoregistry.MessageTypeResolver) - if !ok { - return nil, protoregistry.NotFound - } - mt, err := r.FindMessageByURL(src.GetTypeUrl()) - if err != nil { - if err == protoregistry.NotFound { - return nil, err - } - return nil, protoimpl.X.NewError("could not resolve %q: %v", src.GetTypeUrl(), err) - } - dst = mt.New().Interface() - return dst, opts.Unmarshal(src.GetValue(), dst) -} - -// MessageIs reports whether the underlying message is of the same type as m. -func (x *Any) MessageIs(m proto.Message) bool { - if m == nil { - return false - } - url := x.GetTypeUrl() - name := string(m.ProtoReflect().Descriptor().FullName()) - if !strings.HasSuffix(url, name) { - return false - } - return len(url) == len(name) || url[len(url)-len(name)-1] == '/' -} - -// MessageName reports the full name of the underlying message, -// returning an empty string if invalid. -func (x *Any) MessageName() protoreflect.FullName { - url := x.GetTypeUrl() - name := protoreflect.FullName(url) - if i := strings.LastIndexByte(url, '/'); i >= 0 { - name = name[i+len("/"):] - } - if !name.IsValid() { - return "" - } - return name -} - -// MarshalFrom marshals m into x as the underlying message. -func (x *Any) MarshalFrom(m proto.Message) error { - return MarshalFrom(x, m, proto.MarshalOptions{}) -} - -// UnmarshalTo unmarshals the contents of the underlying message of x into m. -// It resets m before performing the unmarshal operation. -// It reports an error if m is not of the right message type. -func (x *Any) UnmarshalTo(m proto.Message) error { - return UnmarshalTo(x, m, proto.UnmarshalOptions{}) -} - -// UnmarshalNew unmarshals the contents of the underlying message of x into -// a newly allocated message of the specified type. -// It reports an error if the underlying message type could not be resolved. -func (x *Any) UnmarshalNew() (proto.Message, error) { - return UnmarshalNew(x, proto.UnmarshalOptions{}) -} - -func (x *Any) Reset() { - *x = Any{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_any_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Any) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Any) ProtoMessage() {} - -func (x *Any) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_any_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Any.ProtoReflect.Descriptor instead. -func (*Any) Descriptor() ([]byte, []int) { - return file_google_protobuf_any_proto_rawDescGZIP(), []int{0} -} - -func (x *Any) GetTypeUrl() string { - if x != nil { - return x.TypeUrl - } - return "" -} - -func (x *Any) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -var File_google_protobuf_any_proto protoreflect.FileDescriptor - -var file_google_protobuf_any_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x36, 0x0a, 0x03, - 0x41, 0x6e, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x6f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x08, 0x41, 0x6e, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0xa2, 0x02, - 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_google_protobuf_any_proto_rawDescOnce sync.Once - file_google_protobuf_any_proto_rawDescData = file_google_protobuf_any_proto_rawDesc -) - -func file_google_protobuf_any_proto_rawDescGZIP() []byte { - file_google_protobuf_any_proto_rawDescOnce.Do(func() { - file_google_protobuf_any_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_any_proto_rawDescData) - }) - return file_google_protobuf_any_proto_rawDescData -} - -var file_google_protobuf_any_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_any_proto_goTypes = []interface{}{ - (*Any)(nil), // 0: google.protobuf.Any -} -var file_google_protobuf_any_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_google_protobuf_any_proto_init() } -func file_google_protobuf_any_proto_init() { - if File_google_protobuf_any_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_any_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Any); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_google_protobuf_any_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_google_protobuf_any_proto_goTypes, - DependencyIndexes: file_google_protobuf_any_proto_depIdxs, - MessageInfos: file_google_protobuf_any_proto_msgTypes, - }.Build() - File_google_protobuf_any_proto = out.File - file_google_protobuf_any_proto_rawDesc = nil - file_google_protobuf_any_proto_goTypes = nil - file_google_protobuf_any_proto_depIdxs = nil -} diff --git a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go deleted file mode 100644 index f7a110994..000000000 --- a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go +++ /dev/null @@ -1,379 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/duration.proto - -// Package durationpb contains generated types for google/protobuf/duration.proto. -// -// The Duration message represents a signed span of time. -// -// -// Conversion to a Go Duration -// -// The AsDuration method can be used to convert a Duration message to a -// standard Go time.Duration value: -// -// d := dur.AsDuration() -// ... // make use of d as a time.Duration -// -// Converting to a time.Duration is a common operation so that the extensive -// set of time-based operations provided by the time package can be leveraged. -// See https://golang.org/pkg/time for more information. -// -// The AsDuration method performs the conversion on a best-effort basis. -// Durations with denormal values (e.g., nanoseconds beyond -99999999 and -// +99999999, inclusive; or seconds and nanoseconds with opposite signs) -// are normalized during the conversion to a time.Duration. To manually check for -// invalid Duration per the documented limitations in duration.proto, -// additionally call the CheckValid method: -// -// if err := dur.CheckValid(); err != nil { -// ... // handle error -// } -// -// Note that the documented limitations in duration.proto does not protect a -// Duration from overflowing the representable range of a time.Duration in Go. -// The AsDuration method uses saturation arithmetic such that an overflow clamps -// the resulting value to the closest representable value (e.g., math.MaxInt64 -// for positive overflow and math.MinInt64 for negative overflow). -// -// -// Conversion from a Go Duration -// -// The durationpb.New function can be used to construct a Duration message -// from a standard Go time.Duration value: -// -// dur := durationpb.New(d) -// ... // make use of d as a *durationpb.Duration -// -package durationpb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - math "math" - reflect "reflect" - sync "sync" - time "time" -) - -// A Duration represents a signed, fixed-length span of time represented -// as a count of seconds and fractions of seconds at nanosecond -// resolution. It is independent of any calendar and concepts like "day" -// or "month". It is related to Timestamp in that the difference between -// two Timestamp values is a Duration and it can be added or subtracted -// from a Timestamp. Range is approximately +-10,000 years. -// -// # Examples -// -// Example 1: Compute Duration from two Timestamps in pseudo code. -// -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; -// -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; -// -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (duration.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } -// -// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -// -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; -// -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; -// -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } -// -// Example 3: Compute Duration from datetime.timedelta in Python. -// -// td = datetime.timedelta(days=3, minutes=10) -// duration = Duration() -// duration.FromTimedelta(td) -// -// # JSON Mapping -// -// In JSON format, the Duration type is encoded as a string rather than an -// object, where the string ends in the suffix "s" (indicating seconds) and -// is preceded by the number of seconds, with nanoseconds expressed as -// fractional seconds. For example, 3 seconds with 0 nanoseconds should be -// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should -// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 -// microsecond should be expressed in JSON format as "3.000001s". -// -// -type Duration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. Note: these bounds are computed from: - // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -// New constructs a new Duration from the provided time.Duration. -func New(d time.Duration) *Duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &Duration{Seconds: int64(secs), Nanos: int32(nanos)} -} - -// AsDuration converts x to a time.Duration, -// returning the closest duration value in the event of overflow. -func (x *Duration) AsDuration() time.Duration { - secs := x.GetSeconds() - nanos := x.GetNanos() - d := time.Duration(secs) * time.Second - overflow := d/time.Second != time.Duration(secs) - d += time.Duration(nanos) * time.Nanosecond - overflow = overflow || (secs < 0 && nanos < 0 && d > 0) - overflow = overflow || (secs > 0 && nanos > 0 && d < 0) - if overflow { - switch { - case secs < 0: - return time.Duration(math.MinInt64) - case secs > 0: - return time.Duration(math.MaxInt64) - } - } - return d -} - -// IsValid reports whether the duration is valid. -// It is equivalent to CheckValid == nil. -func (x *Duration) IsValid() bool { - return x.check() == 0 -} - -// CheckValid returns an error if the duration is invalid. -// In particular, it checks whether the value is within the range of -// -10000 years to +10000 years inclusive. -// An error is reported for a nil Duration. -func (x *Duration) CheckValid() error { - switch x.check() { - case invalidNil: - return protoimpl.X.NewError("invalid nil Duration") - case invalidUnderflow: - return protoimpl.X.NewError("duration (%v) exceeds -10000 years", x) - case invalidOverflow: - return protoimpl.X.NewError("duration (%v) exceeds +10000 years", x) - case invalidNanosRange: - return protoimpl.X.NewError("duration (%v) has out-of-range nanos", x) - case invalidNanosSign: - return protoimpl.X.NewError("duration (%v) has seconds and nanos with different signs", x) - default: - return nil - } -} - -const ( - _ = iota - invalidNil - invalidUnderflow - invalidOverflow - invalidNanosRange - invalidNanosSign -) - -func (x *Duration) check() uint { - const absDuration = 315576000000 // 10000yr * 365.25day/yr * 24hr/day * 60min/hr * 60sec/min - secs := x.GetSeconds() - nanos := x.GetNanos() - switch { - case x == nil: - return invalidNil - case secs < -absDuration: - return invalidUnderflow - case secs > +absDuration: - return invalidOverflow - case nanos <= -1e9 || nanos >= +1e9: - return invalidNanosRange - case (secs > 0 && nanos < 0) || (secs < 0 && nanos > 0): - return invalidNanosSign - default: - return 0 - } -} - -func (x *Duration) Reset() { - *x = Duration{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_duration_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Duration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Duration) ProtoMessage() {} - -func (x *Duration) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_duration_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Duration.ProtoReflect.Descriptor instead. -func (*Duration) Descriptor() ([]byte, []int) { - return file_google_protobuf_duration_proto_rawDescGZIP(), []int{0} -} - -func (x *Duration) GetSeconds() int64 { - if x != nil { - return x.Seconds - } - return 0 -} - -func (x *Duration) GetNanos() int32 { - if x != nil { - return x.Nanos - } - return 0 -} - -var File_google_protobuf_duration_proto protoreflect.FileDescriptor - -var file_google_protobuf_duration_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, - 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x7c, 0x0a, - 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, - 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_google_protobuf_duration_proto_rawDescOnce sync.Once - file_google_protobuf_duration_proto_rawDescData = file_google_protobuf_duration_proto_rawDesc -) - -func file_google_protobuf_duration_proto_rawDescGZIP() []byte { - file_google_protobuf_duration_proto_rawDescOnce.Do(func() { - file_google_protobuf_duration_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_duration_proto_rawDescData) - }) - return file_google_protobuf_duration_proto_rawDescData -} - -var file_google_protobuf_duration_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_duration_proto_goTypes = []interface{}{ - (*Duration)(nil), // 0: google.protobuf.Duration -} -var file_google_protobuf_duration_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_google_protobuf_duration_proto_init() } -func file_google_protobuf_duration_proto_init() { - if File_google_protobuf_duration_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_duration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Duration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_google_protobuf_duration_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_google_protobuf_duration_proto_goTypes, - DependencyIndexes: file_google_protobuf_duration_proto_depIdxs, - MessageInfos: file_google_protobuf_duration_proto_msgTypes, - }.Build() - File_google_protobuf_duration_proto = out.File - file_google_protobuf_duration_proto_rawDesc = nil - file_google_protobuf_duration_proto_goTypes = nil - file_google_protobuf_duration_proto_depIdxs = nil -} diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go deleted file mode 100644 index c25e4bd7d..000000000 --- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go +++ /dev/null @@ -1,381 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/protobuf/timestamp.proto - -// Package timestamppb contains generated types for google/protobuf/timestamp.proto. -// -// The Timestamp message represents a timestamp, -// an instant in time since the Unix epoch (January 1st, 1970). -// -// -// Conversion to a Go Time -// -// The AsTime method can be used to convert a Timestamp message to a -// standard Go time.Time value in UTC: -// -// t := ts.AsTime() -// ... // make use of t as a time.Time -// -// Converting to a time.Time is a common operation so that the extensive -// set of time-based operations provided by the time package can be leveraged. -// See https://golang.org/pkg/time for more information. -// -// The AsTime method performs the conversion on a best-effort basis. Timestamps -// with denormal values (e.g., nanoseconds beyond 0 and 99999999, inclusive) -// are normalized during the conversion to a time.Time. To manually check for -// invalid Timestamps per the documented limitations in timestamp.proto, -// additionally call the CheckValid method: -// -// if err := ts.CheckValid(); err != nil { -// ... // handle error -// } -// -// -// Conversion from a Go Time -// -// The timestamppb.New function can be used to construct a Timestamp message -// from a standard Go time.Time value: -// -// ts := timestamppb.New(t) -// ... // make use of ts as a *timestamppb.Timestamp -// -// In order to construct a Timestamp representing the current time, use Now: -// -// ts := timestamppb.Now() -// ... // make use of ts as a *timestamppb.Timestamp -// -package timestamppb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - time "time" -) - -// A Timestamp represents a point in time independent of any time zone or local -// calendar, encoded as a count of seconds and fractions of seconds at -// nanosecond resolution. The count is relative to an epoch at UTC midnight on -// January 1, 1970, in the proleptic Gregorian calendar which extends the -// Gregorian calendar backwards to year one. -// -// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -// second table is needed for interpretation, using a [24-hour linear -// smear](https://developers.google.com/time/smear). -// -// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -// restricting to that range, we ensure that we can convert to and from [RFC -// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -// -// # Examples -// -// Example 1: Compute Timestamp from POSIX `time()`. -// -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); -// -// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -// -// struct timeval tv; -// gettimeofday(&tv, NULL); -// -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); -// -// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -// -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -// -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -// -// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -// -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); -// -// -// Example 5: Compute Timestamp from current time in Python. -// -// timestamp = Timestamp() -// timestamp.GetCurrentTime() -// -// # JSON Mapping -// -// In JSON format, the Timestamp type is encoded as a string in the -// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -// where {year} is always expressed using four digits while {month}, {day}, -// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be -// able to accept both UTC and other timezones (as indicated by an offset). -// -// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -// 01:30 UTC on January 15, 2017. -// -// In JavaScript, one can convert a Date object to this format using the -// standard -// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) -// method. In Python, a standard `datetime.datetime` object can be converted -// to this format using -// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with -// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D -// ) to obtain a formatter capable of generating timestamps in this format. -// -// -type Timestamp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -// Now constructs a new Timestamp from the current time. -func Now() *Timestamp { - return New(time.Now()) -} - -// New constructs a new Timestamp from the provided time.Time. -func New(t time.Time) *Timestamp { - return &Timestamp{Seconds: int64(t.Unix()), Nanos: int32(t.Nanosecond())} -} - -// AsTime converts x to a time.Time. -func (x *Timestamp) AsTime() time.Time { - return time.Unix(int64(x.GetSeconds()), int64(x.GetNanos())).UTC() -} - -// IsValid reports whether the timestamp is valid. -// It is equivalent to CheckValid == nil. -func (x *Timestamp) IsValid() bool { - return x.check() == 0 -} - -// CheckValid returns an error if the timestamp is invalid. -// In particular, it checks whether the value represents a date that is -// in the range of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. -// An error is reported for a nil Timestamp. -func (x *Timestamp) CheckValid() error { - switch x.check() { - case invalidNil: - return protoimpl.X.NewError("invalid nil Timestamp") - case invalidUnderflow: - return protoimpl.X.NewError("timestamp (%v) before 0001-01-01", x) - case invalidOverflow: - return protoimpl.X.NewError("timestamp (%v) after 9999-12-31", x) - case invalidNanos: - return protoimpl.X.NewError("timestamp (%v) has out-of-range nanos", x) - default: - return nil - } -} - -const ( - _ = iota - invalidNil - invalidUnderflow - invalidOverflow - invalidNanos -) - -func (x *Timestamp) check() uint { - const minTimestamp = -62135596800 // Seconds between 1970-01-01T00:00:00Z and 0001-01-01T00:00:00Z, inclusive - const maxTimestamp = +253402300799 // Seconds between 1970-01-01T00:00:00Z and 9999-12-31T23:59:59Z, inclusive - secs := x.GetSeconds() - nanos := x.GetNanos() - switch { - case x == nil: - return invalidNil - case secs < minTimestamp: - return invalidUnderflow - case secs > maxTimestamp: - return invalidOverflow - case nanos < 0 || nanos >= 1e9: - return invalidNanos - default: - return 0 - } -} - -func (x *Timestamp) Reset() { - *x = Timestamp{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_timestamp_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Timestamp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Timestamp) ProtoMessage() {} - -func (x *Timestamp) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_timestamp_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Timestamp.ProtoReflect.Descriptor instead. -func (*Timestamp) Descriptor() ([]byte, []int) { - return file_google_protobuf_timestamp_proto_rawDescGZIP(), []int{0} -} - -func (x *Timestamp) GetSeconds() int64 { - if x != nil { - return x.Seconds - } - return 0 -} - -func (x *Timestamp) GetNanos() int32 { - if x != nil { - return x.Nanos - } - return 0 -} - -var File_google_protobuf_timestamp_proto protoreflect.FileDescriptor - -var file_google_protobuf_timestamp_proto_rawDesc = []byte{ - 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, - 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, - 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, - 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_google_protobuf_timestamp_proto_rawDescOnce sync.Once - file_google_protobuf_timestamp_proto_rawDescData = file_google_protobuf_timestamp_proto_rawDesc -) - -func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte { - file_google_protobuf_timestamp_proto_rawDescOnce.Do(func() { - file_google_protobuf_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_timestamp_proto_rawDescData) - }) - return file_google_protobuf_timestamp_proto_rawDescData -} - -var file_google_protobuf_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_timestamp_proto_goTypes = []interface{}{ - (*Timestamp)(nil), // 0: google.protobuf.Timestamp -} -var file_google_protobuf_timestamp_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_google_protobuf_timestamp_proto_init() } -func file_google_protobuf_timestamp_proto_init() { - if File_google_protobuf_timestamp_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Timestamp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_google_protobuf_timestamp_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_google_protobuf_timestamp_proto_goTypes, - DependencyIndexes: file_google_protobuf_timestamp_proto_depIdxs, - MessageInfos: file_google_protobuf_timestamp_proto_msgTypes, - }.Build() - File_google_protobuf_timestamp_proto = out.File - file_google_protobuf_timestamp_proto_rawDesc = nil - file_google_protobuf_timestamp_proto_goTypes = nil - file_google_protobuf_timestamp_proto_depIdxs = nil -} diff --git a/vendor/gopkg.in/ini.v1/.gitignore b/vendor/gopkg.in/ini.v1/.gitignore deleted file mode 100644 index 12411127b..000000000 --- a/vendor/gopkg.in/ini.v1/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -testdata/conf_out.ini -ini.sublime-project -ini.sublime-workspace -testdata/conf_reflect.ini -.idea -/.vscode diff --git a/vendor/gopkg.in/ini.v1/LICENSE b/vendor/gopkg.in/ini.v1/LICENSE deleted file mode 100644 index d361bbcdf..000000000 --- a/vendor/gopkg.in/ini.v1/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 2014 Unknwon - - 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/gopkg.in/ini.v1/Makefile b/vendor/gopkg.in/ini.v1/Makefile deleted file mode 100644 index f3b0dae2d..000000000 --- a/vendor/gopkg.in/ini.v1/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: build test bench vet coverage - -build: vet bench - -test: - go test -v -cover -race - -bench: - go test -v -cover -test.bench=. -test.benchmem - -vet: - go vet - -coverage: - go test -coverprofile=c.out && go tool cover -html=c.out && rm c.out diff --git a/vendor/gopkg.in/ini.v1/README.md b/vendor/gopkg.in/ini.v1/README.md deleted file mode 100644 index 5d65658b2..000000000 --- a/vendor/gopkg.in/ini.v1/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# INI - -[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/go-ini/ini/Go?logo=github&style=for-the-badge)](https://github.com/go-ini/ini/actions?query=workflow%3AGo) -[![codecov](https://img.shields.io/codecov/c/github/go-ini/ini/master?logo=codecov&style=for-the-badge)](https://codecov.io/gh/go-ini/ini) -[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/go-ini/ini?tab=doc) -[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=for-the-badge&logo=sourcegraph)](https://sourcegraph.com/github.com/go-ini/ini) - -![](https://avatars0.githubusercontent.com/u/10216035?v=3&s=200) - -Package ini provides INI file read and write functionality in Go. - -## Features - -- Load from multiple data sources(file, `[]byte`, `io.Reader` and `io.ReadCloser`) with overwrites. -- Read with recursion values. -- Read with parent-child sections. -- Read with auto-increment key names. -- Read with multiple-line values. -- Read with tons of helper methods. -- Read and convert values to Go types. -- Read and **WRITE** comments of sections and keys. -- Manipulate sections, keys and comments with ease. -- Keep sections and keys in order as you parse and save. - -## Installation - -The minimum requirement of Go is **1.6**. - -```sh -$ go get gopkg.in/ini.v1 -``` - -Please add `-u` flag to update in the future. - -## Getting Help - -- [Getting Started](https://ini.unknwon.io/docs/intro/getting_started) -- [API Documentation](https://gowalker.org/gopkg.in/ini.v1) -- 中国大陆镜像:https://ini.unknwon.cn - -## License - -This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text. diff --git a/vendor/gopkg.in/ini.v1/codecov.yml b/vendor/gopkg.in/ini.v1/codecov.yml deleted file mode 100644 index fc947f230..000000000 --- a/vendor/gopkg.in/ini.v1/codecov.yml +++ /dev/null @@ -1,9 +0,0 @@ -coverage: - range: "60...95" - status: - project: - default: - threshold: 1% - -comment: - layout: 'diff, files' diff --git a/vendor/gopkg.in/ini.v1/data_source.go b/vendor/gopkg.in/ini.v1/data_source.go deleted file mode 100644 index c3a541f1d..000000000 --- a/vendor/gopkg.in/ini.v1/data_source.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2019 Unknwon -// -// 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 ini - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" -) - -var ( - _ dataSource = (*sourceFile)(nil) - _ dataSource = (*sourceData)(nil) - _ dataSource = (*sourceReadCloser)(nil) -) - -// dataSource is an interface that returns object which can be read and closed. -type dataSource interface { - ReadCloser() (io.ReadCloser, error) -} - -// sourceFile represents an object that contains content on the local file system. -type sourceFile struct { - name string -} - -func (s sourceFile) ReadCloser() (_ io.ReadCloser, err error) { - return os.Open(s.name) -} - -// sourceData represents an object that contains content in memory. -type sourceData struct { - data []byte -} - -func (s *sourceData) ReadCloser() (io.ReadCloser, error) { - return ioutil.NopCloser(bytes.NewReader(s.data)), nil -} - -// sourceReadCloser represents an input stream with Close method. -type sourceReadCloser struct { - reader io.ReadCloser -} - -func (s *sourceReadCloser) ReadCloser() (io.ReadCloser, error) { - return s.reader, nil -} - -func parseDataSource(source interface{}) (dataSource, error) { - switch s := source.(type) { - case string: - return sourceFile{s}, nil - case []byte: - return &sourceData{s}, nil - case io.ReadCloser: - return &sourceReadCloser{s}, nil - case io.Reader: - return &sourceReadCloser{ioutil.NopCloser(s)}, nil - default: - return nil, fmt.Errorf("error parsing data source: unknown type %q", s) - } -} diff --git a/vendor/gopkg.in/ini.v1/deprecated.go b/vendor/gopkg.in/ini.v1/deprecated.go deleted file mode 100644 index e8bda06e6..000000000 --- a/vendor/gopkg.in/ini.v1/deprecated.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2019 Unknwon -// -// 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 ini - -const ( - // Deprecated: Use "DefaultSection" instead. - DEFAULT_SECTION = DefaultSection -) - -var ( - // Deprecated: AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE. - AllCapsUnderscore = SnackCase -) diff --git a/vendor/gopkg.in/ini.v1/error.go b/vendor/gopkg.in/ini.v1/error.go deleted file mode 100644 index d88347c54..000000000 --- a/vendor/gopkg.in/ini.v1/error.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 Unknwon -// -// 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 ini - -import ( - "fmt" -) - -// ErrDelimiterNotFound indicates the error type of no delimiter is found which there should be one. -type ErrDelimiterNotFound struct { - Line string -} - -// IsErrDelimiterNotFound returns true if the given error is an instance of ErrDelimiterNotFound. -func IsErrDelimiterNotFound(err error) bool { - _, ok := err.(ErrDelimiterNotFound) - return ok -} - -func (err ErrDelimiterNotFound) Error() string { - return fmt.Sprintf("key-value delimiter not found: %s", err.Line) -} diff --git a/vendor/gopkg.in/ini.v1/file.go b/vendor/gopkg.in/ini.v1/file.go deleted file mode 100644 index f95606f90..000000000 --- a/vendor/gopkg.in/ini.v1/file.go +++ /dev/null @@ -1,509 +0,0 @@ -// Copyright 2017 Unknwon -// -// 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 ini - -import ( - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "strings" - "sync" -) - -// File represents a combination of one or more INI files in memory. -type File struct { - options LoadOptions - dataSources []dataSource - - // Should make things safe, but sometimes doesn't matter. - BlockMode bool - lock sync.RWMutex - - // To keep data in order. - sectionList []string - // To keep track of the index of a section with same name. - // This meta list is only used with non-unique section names are allowed. - sectionIndexes []int - - // Actual data is stored here. - sections map[string][]*Section - - NameMapper - ValueMapper -} - -// newFile initializes File object with given data sources. -func newFile(dataSources []dataSource, opts LoadOptions) *File { - if len(opts.KeyValueDelimiters) == 0 { - opts.KeyValueDelimiters = "=:" - } - if len(opts.KeyValueDelimiterOnWrite) == 0 { - opts.KeyValueDelimiterOnWrite = "=" - } - - return &File{ - BlockMode: true, - dataSources: dataSources, - sections: make(map[string][]*Section), - options: opts, - } -} - -// Empty returns an empty file object. -func Empty(opts ...LoadOptions) *File { - var opt LoadOptions - if len(opts) > 0 { - opt = opts[0] - } - - // Ignore error here, we are sure our data is good. - f, _ := LoadSources(opt, []byte("")) - return f -} - -// NewSection creates a new section. -func (f *File) NewSection(name string) (*Section, error) { - if len(name) == 0 { - return nil, errors.New("empty section name") - } - - if f.options.Insensitive && name != DefaultSection { - name = strings.ToLower(name) - } - - if f.BlockMode { - f.lock.Lock() - defer f.lock.Unlock() - } - - if !f.options.AllowNonUniqueSections && inSlice(name, f.sectionList) { - return f.sections[name][0], nil - } - - f.sectionList = append(f.sectionList, name) - - // NOTE: Append to indexes must happen before appending to sections, - // otherwise index will have off-by-one problem. - f.sectionIndexes = append(f.sectionIndexes, len(f.sections[name])) - - sec := newSection(f, name) - f.sections[name] = append(f.sections[name], sec) - - return sec, nil -} - -// NewRawSection creates a new section with an unparseable body. -func (f *File) NewRawSection(name, body string) (*Section, error) { - section, err := f.NewSection(name) - if err != nil { - return nil, err - } - - section.isRawSection = true - section.rawBody = body - return section, nil -} - -// NewSections creates a list of sections. -func (f *File) NewSections(names ...string) (err error) { - for _, name := range names { - if _, err = f.NewSection(name); err != nil { - return err - } - } - return nil -} - -// GetSection returns section by given name. -func (f *File) GetSection(name string) (*Section, error) { - secs, err := f.SectionsByName(name) - if err != nil { - return nil, err - } - - return secs[0], err -} - -// SectionsByName returns all sections with given name. -func (f *File) SectionsByName(name string) ([]*Section, error) { - if len(name) == 0 { - name = DefaultSection - } - if f.options.Insensitive { - name = strings.ToLower(name) - } - - if f.BlockMode { - f.lock.RLock() - defer f.lock.RUnlock() - } - - secs := f.sections[name] - if len(secs) == 0 { - return nil, fmt.Errorf("section %q does not exist", name) - } - - return secs, nil -} - -// Section assumes named section exists and returns a zero-value when not. -func (f *File) Section(name string) *Section { - sec, err := f.GetSection(name) - if err != nil { - // Note: It's OK here because the only possible error is empty section name, - // but if it's empty, this piece of code won't be executed. - sec, _ = f.NewSection(name) - return sec - } - return sec -} - -// SectionWithIndex assumes named section exists and returns a new section when not. -func (f *File) SectionWithIndex(name string, index int) *Section { - secs, err := f.SectionsByName(name) - if err != nil || len(secs) <= index { - // NOTE: It's OK here because the only possible error is empty section name, - // but if it's empty, this piece of code won't be executed. - newSec, _ := f.NewSection(name) - return newSec - } - - return secs[index] -} - -// Sections returns a list of Section stored in the current instance. -func (f *File) Sections() []*Section { - if f.BlockMode { - f.lock.RLock() - defer f.lock.RUnlock() - } - - sections := make([]*Section, len(f.sectionList)) - for i, name := range f.sectionList { - sections[i] = f.sections[name][f.sectionIndexes[i]] - } - return sections -} - -// ChildSections returns a list of child sections of given section name. -func (f *File) ChildSections(name string) []*Section { - return f.Section(name).ChildSections() -} - -// SectionStrings returns list of section names. -func (f *File) SectionStrings() []string { - list := make([]string, len(f.sectionList)) - copy(list, f.sectionList) - return list -} - -// DeleteSection deletes a section or all sections with given name. -func (f *File) DeleteSection(name string) { - secs, err := f.SectionsByName(name) - if err != nil { - return - } - - for i := 0; i < len(secs); i++ { - // For non-unique sections, it is always needed to remove the first one so - // in the next iteration, the subsequent section continue having index 0. - // Ignoring the error as index 0 never returns an error. - _ = f.DeleteSectionWithIndex(name, 0) - } -} - -// DeleteSectionWithIndex deletes a section with given name and index. -func (f *File) DeleteSectionWithIndex(name string, index int) error { - if !f.options.AllowNonUniqueSections && index != 0 { - return fmt.Errorf("delete section with non-zero index is only allowed when non-unique sections is enabled") - } - - if len(name) == 0 { - name = DefaultSection - } - if f.options.Insensitive { - name = strings.ToLower(name) - } - - if f.BlockMode { - f.lock.Lock() - defer f.lock.Unlock() - } - - // Count occurrences of the sections - occurrences := 0 - - sectionListCopy := make([]string, len(f.sectionList)) - copy(sectionListCopy, f.sectionList) - - for i, s := range sectionListCopy { - if s != name { - continue - } - - if occurrences == index { - if len(f.sections[name]) <= 1 { - delete(f.sections, name) // The last one in the map - } else { - f.sections[name] = append(f.sections[name][:index], f.sections[name][index+1:]...) - } - - // Fix section lists - f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...) - f.sectionIndexes = append(f.sectionIndexes[:i], f.sectionIndexes[i+1:]...) - - } else if occurrences > index { - // Fix the indices of all following sections with this name. - f.sectionIndexes[i-1]-- - } - - occurrences++ - } - - return nil -} - -func (f *File) reload(s dataSource) error { - r, err := s.ReadCloser() - if err != nil { - return err - } - defer r.Close() - - return f.parse(r) -} - -// Reload reloads and parses all data sources. -func (f *File) Reload() (err error) { - for _, s := range f.dataSources { - if err = f.reload(s); err != nil { - // In loose mode, we create an empty default section for nonexistent files. - if os.IsNotExist(err) && f.options.Loose { - _ = f.parse(bytes.NewBuffer(nil)) - continue - } - return err - } - } - return nil -} - -// Append appends one or more data sources and reloads automatically. -func (f *File) Append(source interface{}, others ...interface{}) error { - ds, err := parseDataSource(source) - if err != nil { - return err - } - f.dataSources = append(f.dataSources, ds) - for _, s := range others { - ds, err = parseDataSource(s) - if err != nil { - return err - } - f.dataSources = append(f.dataSources, ds) - } - return f.Reload() -} - -func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { - equalSign := DefaultFormatLeft + f.options.KeyValueDelimiterOnWrite + DefaultFormatRight - - if PrettyFormat || PrettyEqual { - equalSign = fmt.Sprintf(" %s ", f.options.KeyValueDelimiterOnWrite) - } - - // Use buffer to make sure target is safe until finish encoding. - buf := bytes.NewBuffer(nil) - for i, sname := range f.sectionList { - sec := f.SectionWithIndex(sname, f.sectionIndexes[i]) - if len(sec.Comment) > 0 { - // Support multiline comments - lines := strings.Split(sec.Comment, LineBreak) - for i := range lines { - if lines[i][0] != '#' && lines[i][0] != ';' { - lines[i] = "; " + lines[i] - } else { - lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:]) - } - - if _, err := buf.WriteString(lines[i] + LineBreak); err != nil { - return nil, err - } - } - } - - if i > 0 || DefaultHeader { - if _, err := buf.WriteString("[" + sname + "]" + LineBreak); err != nil { - return nil, err - } - } else { - // Write nothing if default section is empty - if len(sec.keyList) == 0 { - continue - } - } - - if sec.isRawSection { - if _, err := buf.WriteString(sec.rawBody); err != nil { - return nil, err - } - - if PrettySection { - // Put a line between sections - if _, err := buf.WriteString(LineBreak); err != nil { - return nil, err - } - } - continue - } - - // Count and generate alignment length and buffer spaces using the - // longest key. Keys may be modified if they contain certain characters so - // we need to take that into account in our calculation. - alignLength := 0 - if PrettyFormat { - for _, kname := range sec.keyList { - keyLength := len(kname) - // First case will surround key by ` and second by """ - if strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters) { - keyLength += 2 - } else if strings.Contains(kname, "`") { - keyLength += 6 - } - - if keyLength > alignLength { - alignLength = keyLength - } - } - } - alignSpaces := bytes.Repeat([]byte(" "), alignLength) - - KeyList: - for _, kname := range sec.keyList { - key := sec.Key(kname) - if len(key.Comment) > 0 { - if len(indent) > 0 && sname != DefaultSection { - buf.WriteString(indent) - } - - // Support multiline comments - lines := strings.Split(key.Comment, LineBreak) - for i := range lines { - if lines[i][0] != '#' && lines[i][0] != ';' { - lines[i] = "; " + strings.TrimSpace(lines[i]) - } else { - lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:]) - } - - if _, err := buf.WriteString(lines[i] + LineBreak); err != nil { - return nil, err - } - } - } - - if len(indent) > 0 && sname != DefaultSection { - buf.WriteString(indent) - } - - switch { - case key.isAutoIncrement: - kname = "-" - case strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters): - kname = "`" + kname + "`" - case strings.Contains(kname, "`"): - kname = `"""` + kname + `"""` - } - - for _, val := range key.ValueWithShadows() { - if _, err := buf.WriteString(kname); err != nil { - return nil, err - } - - if key.isBooleanType { - if kname != sec.keyList[len(sec.keyList)-1] { - buf.WriteString(LineBreak) - } - continue KeyList - } - - // Write out alignment spaces before "=" sign - if PrettyFormat { - buf.Write(alignSpaces[:alignLength-len(kname)]) - } - - // In case key value contains "\n", "`", "\"", "#" or ";" - if strings.ContainsAny(val, "\n`") { - val = `"""` + val + `"""` - } else if !f.options.IgnoreInlineComment && strings.ContainsAny(val, "#;") { - val = "`" + val + "`" - } - if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil { - return nil, err - } - } - - for _, val := range key.nestedValues { - if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil { - return nil, err - } - } - } - - if PrettySection { - // Put a line between sections - if _, err := buf.WriteString(LineBreak); err != nil { - return nil, err - } - } - } - - return buf, nil -} - -// WriteToIndent writes content into io.Writer with given indention. -// If PrettyFormat has been set to be true, -// it will align "=" sign with spaces under each section. -func (f *File) WriteToIndent(w io.Writer, indent string) (int64, error) { - buf, err := f.writeToBuffer(indent) - if err != nil { - return 0, err - } - return buf.WriteTo(w) -} - -// WriteTo writes file content into io.Writer. -func (f *File) WriteTo(w io.Writer) (int64, error) { - return f.WriteToIndent(w, "") -} - -// SaveToIndent writes content to file system with given value indention. -func (f *File) SaveToIndent(filename, indent string) error { - // Note: Because we are truncating with os.Create, - // so it's safer to save to a temporary file location and rename afte done. - buf, err := f.writeToBuffer(indent) - if err != nil { - return err - } - - return ioutil.WriteFile(filename, buf.Bytes(), 0666) -} - -// SaveTo writes content to file system. -func (f *File) SaveTo(filename string) error { - return f.SaveToIndent(filename, "") -} diff --git a/vendor/gopkg.in/ini.v1/helper.go b/vendor/gopkg.in/ini.v1/helper.go deleted file mode 100644 index f9d80a682..000000000 --- a/vendor/gopkg.in/ini.v1/helper.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2019 Unknwon -// -// 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 ini - -func inSlice(str string, s []string) bool { - for _, v := range s { - if str == v { - return true - } - } - return false -} diff --git a/vendor/gopkg.in/ini.v1/ini.go b/vendor/gopkg.in/ini.v1/ini.go deleted file mode 100644 index 2961543f9..000000000 --- a/vendor/gopkg.in/ini.v1/ini.go +++ /dev/null @@ -1,168 +0,0 @@ -// +build go1.6 - -// Copyright 2014 Unknwon -// -// 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 ini provides INI file read and write functionality in Go. -package ini - -import ( - "os" - "regexp" - "runtime" - "strings" -) - -const ( - // DefaultSection is the name of default section. You can use this constant or the string literal. - // In most of cases, an empty string is all you need to access the section. - DefaultSection = "DEFAULT" - - // Maximum allowed depth when recursively substituing variable names. - depthValues = 99 -) - -var ( - // LineBreak is the delimiter to determine or compose a new line. - // This variable will be changed to "\r\n" automatically on Windows at package init time. - LineBreak = "\n" - - // Variable regexp pattern: %(variable)s - varPattern = regexp.MustCompile(`%\(([^)]+)\)s`) - - // DefaultHeader explicitly writes default section header. - DefaultHeader = false - - // PrettySection indicates whether to put a line between sections. - PrettySection = true - // PrettyFormat indicates whether to align "=" sign with spaces to produce pretty output - // or reduce all possible spaces for compact format. - PrettyFormat = true - // PrettyEqual places spaces around "=" sign even when PrettyFormat is false. - PrettyEqual = false - // DefaultFormatLeft places custom spaces on the left when PrettyFormat and PrettyEqual are both disabled. - DefaultFormatLeft = "" - // DefaultFormatRight places custom spaces on the right when PrettyFormat and PrettyEqual are both disabled. - DefaultFormatRight = "" -) - -var inTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test") - -func init() { - if runtime.GOOS == "windows" && !inTest { - LineBreak = "\r\n" - } -} - -// LoadOptions contains all customized options used for load data source(s). -type LoadOptions struct { - // Loose indicates whether the parser should ignore nonexistent files or return error. - Loose bool - // Insensitive indicates whether the parser forces all section and key names to lowercase. - Insensitive bool - // IgnoreContinuation indicates whether to ignore continuation lines while parsing. - IgnoreContinuation bool - // IgnoreInlineComment indicates whether to ignore comments at the end of value and treat it as part of value. - IgnoreInlineComment bool - // SkipUnrecognizableLines indicates whether to skip unrecognizable lines that do not conform to key/value pairs. - SkipUnrecognizableLines bool - // AllowBooleanKeys indicates whether to allow boolean type keys or treat as value is missing. - // This type of keys are mostly used in my.cnf. - AllowBooleanKeys bool - // AllowShadows indicates whether to keep track of keys with same name under same section. - AllowShadows bool - // AllowNestedValues indicates whether to allow AWS-like nested values. - // Docs: http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#nested-values - AllowNestedValues bool - // AllowPythonMultilineValues indicates whether to allow Python-like multi-line values. - // Docs: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure - // Relevant quote: Values can also span multiple lines, as long as they are indented deeper - // than the first line of the value. - AllowPythonMultilineValues bool - // SpaceBeforeInlineComment indicates whether to allow comment symbols (\# and \;) inside value. - // Docs: https://docs.python.org/2/library/configparser.html - // Quote: Comments may appear on their own in an otherwise empty line, or may be entered in lines holding values or section names. - // In the latter case, they need to be preceded by a whitespace character to be recognized as a comment. - SpaceBeforeInlineComment bool - // UnescapeValueDoubleQuotes indicates whether to unescape double quotes inside value to regular format - // when value is surrounded by double quotes, e.g. key="a \"value\"" => key=a "value" - UnescapeValueDoubleQuotes bool - // UnescapeValueCommentSymbols indicates to unescape comment symbols (\# and \;) inside value to regular format - // when value is NOT surrounded by any quotes. - // Note: UNSTABLE, behavior might change to only unescape inside double quotes but may noy necessary at all. - UnescapeValueCommentSymbols bool - // UnparseableSections stores a list of blocks that are allowed with raw content which do not otherwise - // conform to key/value pairs. Specify the names of those blocks here. - UnparseableSections []string - // KeyValueDelimiters is the sequence of delimiters that are used to separate key and value. By default, it is "=:". - KeyValueDelimiters string - // KeyValueDelimiters is the delimiter that are used to separate key and value output. By default, it is "=". - KeyValueDelimiterOnWrite string - // PreserveSurroundedQuote indicates whether to preserve surrounded quote (single and double quotes). - PreserveSurroundedQuote bool - // DebugFunc is called to collect debug information (currently only useful to debug parsing Python-style multiline values). - DebugFunc DebugFunc - // ReaderBufferSize is the buffer size of the reader in bytes. - ReaderBufferSize int - // AllowNonUniqueSections indicates whether to allow sections with the same name multiple times. - AllowNonUniqueSections bool -} - -// DebugFunc is the type of function called to log parse events. -type DebugFunc func(message string) - -// LoadSources allows caller to apply customized options for loading from data source(s). -func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) { - sources := make([]dataSource, len(others)+1) - sources[0], err = parseDataSource(source) - if err != nil { - return nil, err - } - for i := range others { - sources[i+1], err = parseDataSource(others[i]) - if err != nil { - return nil, err - } - } - f := newFile(sources, opts) - if err = f.Reload(); err != nil { - return nil, err - } - return f, nil -} - -// Load loads and parses from INI data sources. -// Arguments can be mixed of file name with string type, or raw data in []byte. -// It will return error if list contains nonexistent files. -func Load(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{}, source, others...) -} - -// LooseLoad has exactly same functionality as Load function -// except it ignores nonexistent files instead of returning error. -func LooseLoad(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{Loose: true}, source, others...) -} - -// InsensitiveLoad has exactly same functionality as Load function -// except it forces all section and key names to be lowercased. -func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{Insensitive: true}, source, others...) -} - -// ShadowLoad has exactly same functionality as Load function -// except it allows have shadow keys. -func ShadowLoad(source interface{}, others ...interface{}) (*File, error) { - return LoadSources(LoadOptions{AllowShadows: true}, source, others...) -} diff --git a/vendor/gopkg.in/ini.v1/key.go b/vendor/gopkg.in/ini.v1/key.go deleted file mode 100644 index 8baafd9ea..000000000 --- a/vendor/gopkg.in/ini.v1/key.go +++ /dev/null @@ -1,829 +0,0 @@ -// Copyright 2014 Unknwon -// -// 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 ini - -import ( - "bytes" - "errors" - "fmt" - "strconv" - "strings" - "time" -) - -// Key represents a key under a section. -type Key struct { - s *Section - Comment string - name string - value string - isAutoIncrement bool - isBooleanType bool - - isShadow bool - shadows []*Key - - nestedValues []string -} - -// newKey simply return a key object with given values. -func newKey(s *Section, name, val string) *Key { - return &Key{ - s: s, - name: name, - value: val, - } -} - -func (k *Key) addShadow(val string) error { - if k.isShadow { - return errors.New("cannot add shadow to another shadow key") - } else if k.isAutoIncrement || k.isBooleanType { - return errors.New("cannot add shadow to auto-increment or boolean key") - } - - // Deduplicate shadows based on their values. - if k.value == val { - return nil - } - for i := range k.shadows { - if k.shadows[i].value == val { - return nil - } - } - - shadow := newKey(k.s, k.name, val) - shadow.isShadow = true - k.shadows = append(k.shadows, shadow) - return nil -} - -// AddShadow adds a new shadow key to itself. -func (k *Key) AddShadow(val string) error { - if !k.s.f.options.AllowShadows { - return errors.New("shadow key is not allowed") - } - return k.addShadow(val) -} - -func (k *Key) addNestedValue(val string) error { - if k.isAutoIncrement || k.isBooleanType { - return errors.New("cannot add nested value to auto-increment or boolean key") - } - - k.nestedValues = append(k.nestedValues, val) - return nil -} - -// AddNestedValue adds a nested value to the key. -func (k *Key) AddNestedValue(val string) error { - if !k.s.f.options.AllowNestedValues { - return errors.New("nested value is not allowed") - } - return k.addNestedValue(val) -} - -// ValueMapper represents a mapping function for values, e.g. os.ExpandEnv -type ValueMapper func(string) string - -// Name returns name of key. -func (k *Key) Name() string { - return k.name -} - -// Value returns raw value of key for performance purpose. -func (k *Key) Value() string { - return k.value -} - -// ValueWithShadows returns raw values of key and its shadows if any. -func (k *Key) ValueWithShadows() []string { - if len(k.shadows) == 0 { - return []string{k.value} - } - vals := make([]string, len(k.shadows)+1) - vals[0] = k.value - for i := range k.shadows { - vals[i+1] = k.shadows[i].value - } - return vals -} - -// NestedValues returns nested values stored in the key. -// It is possible returned value is nil if no nested values stored in the key. -func (k *Key) NestedValues() []string { - return k.nestedValues -} - -// transformValue takes a raw value and transforms to its final string. -func (k *Key) transformValue(val string) string { - if k.s.f.ValueMapper != nil { - val = k.s.f.ValueMapper(val) - } - - // Fail-fast if no indicate char found for recursive value - if !strings.Contains(val, "%") { - return val - } - for i := 0; i < depthValues; i++ { - vr := varPattern.FindString(val) - if len(vr) == 0 { - break - } - - // Take off leading '%(' and trailing ')s'. - noption := vr[2 : len(vr)-2] - - // Search in the same section. - // If not found or found the key itself, then search again in default section. - nk, err := k.s.GetKey(noption) - if err != nil || k == nk { - nk, _ = k.s.f.Section("").GetKey(noption) - if nk == nil { - // Stop when no results found in the default section, - // and returns the value as-is. - break - } - } - - // Substitute by new value and take off leading '%(' and trailing ')s'. - val = strings.Replace(val, vr, nk.value, -1) - } - return val -} - -// String returns string representation of value. -func (k *Key) String() string { - return k.transformValue(k.value) -} - -// Validate accepts a validate function which can -// return modifed result as key value. -func (k *Key) Validate(fn func(string) string) string { - return fn(k.String()) -} - -// parseBool returns the boolean value represented by the string. -// -// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On, -// 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off. -// Any other value returns an error. -func parseBool(str string) (value bool, err error) { - switch str { - case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On": - return true, nil - case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off": - return false, nil - } - return false, fmt.Errorf("parsing \"%s\": invalid syntax", str) -} - -// Bool returns bool type value. -func (k *Key) Bool() (bool, error) { - return parseBool(k.String()) -} - -// Float64 returns float64 type value. -func (k *Key) Float64() (float64, error) { - return strconv.ParseFloat(k.String(), 64) -} - -// Int returns int type value. -func (k *Key) Int() (int, error) { - v, err := strconv.ParseInt(k.String(), 0, 64) - return int(v), err -} - -// Int64 returns int64 type value. -func (k *Key) Int64() (int64, error) { - return strconv.ParseInt(k.String(), 0, 64) -} - -// Uint returns uint type valued. -func (k *Key) Uint() (uint, error) { - u, e := strconv.ParseUint(k.String(), 0, 64) - return uint(u), e -} - -// Uint64 returns uint64 type value. -func (k *Key) Uint64() (uint64, error) { - return strconv.ParseUint(k.String(), 0, 64) -} - -// Duration returns time.Duration type value. -func (k *Key) Duration() (time.Duration, error) { - return time.ParseDuration(k.String()) -} - -// TimeFormat parses with given format and returns time.Time type value. -func (k *Key) TimeFormat(format string) (time.Time, error) { - return time.Parse(format, k.String()) -} - -// Time parses with RFC3339 format and returns time.Time type value. -func (k *Key) Time() (time.Time, error) { - return k.TimeFormat(time.RFC3339) -} - -// MustString returns default value if key value is empty. -func (k *Key) MustString(defaultVal string) string { - val := k.String() - if len(val) == 0 { - k.value = defaultVal - return defaultVal - } - return val -} - -// MustBool always returns value without error, -// it returns false if error occurs. -func (k *Key) MustBool(defaultVal ...bool) bool { - val, err := k.Bool() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatBool(defaultVal[0]) - return defaultVal[0] - } - return val -} - -// MustFloat64 always returns value without error, -// it returns 0.0 if error occurs. -func (k *Key) MustFloat64(defaultVal ...float64) float64 { - val, err := k.Float64() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatFloat(defaultVal[0], 'f', -1, 64) - return defaultVal[0] - } - return val -} - -// MustInt always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustInt(defaultVal ...int) int { - val, err := k.Int() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatInt(int64(defaultVal[0]), 10) - return defaultVal[0] - } - return val -} - -// MustInt64 always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustInt64(defaultVal ...int64) int64 { - val, err := k.Int64() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatInt(defaultVal[0], 10) - return defaultVal[0] - } - return val -} - -// MustUint always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustUint(defaultVal ...uint) uint { - val, err := k.Uint() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatUint(uint64(defaultVal[0]), 10) - return defaultVal[0] - } - return val -} - -// MustUint64 always returns value without error, -// it returns 0 if error occurs. -func (k *Key) MustUint64(defaultVal ...uint64) uint64 { - val, err := k.Uint64() - if len(defaultVal) > 0 && err != nil { - k.value = strconv.FormatUint(defaultVal[0], 10) - return defaultVal[0] - } - return val -} - -// MustDuration always returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration { - val, err := k.Duration() - if len(defaultVal) > 0 && err != nil { - k.value = defaultVal[0].String() - return defaultVal[0] - } - return val -} - -// MustTimeFormat always parses with given format and returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time { - val, err := k.TimeFormat(format) - if len(defaultVal) > 0 && err != nil { - k.value = defaultVal[0].Format(format) - return defaultVal[0] - } - return val -} - -// MustTime always parses with RFC3339 format and returns value without error, -// it returns zero value if error occurs. -func (k *Key) MustTime(defaultVal ...time.Time) time.Time { - return k.MustTimeFormat(time.RFC3339, defaultVal...) -} - -// In always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) In(defaultVal string, candidates []string) string { - val := k.String() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InFloat64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 { - val := k.MustFloat64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InInt always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InInt(defaultVal int, candidates []int) int { - val := k.MustInt() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InInt64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 { - val := k.MustInt64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InUint always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InUint(defaultVal uint, candidates []uint) uint { - val := k.MustUint() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InUint64 always returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 { - val := k.MustUint64() - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InTimeFormat always parses with given format and returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time { - val := k.MustTimeFormat(format) - for _, cand := range candidates { - if val == cand { - return val - } - } - return defaultVal -} - -// InTime always parses with RFC3339 format and returns value without error, -// it returns default value if error occurs or doesn't fit into candidates. -func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time { - return k.InTimeFormat(time.RFC3339, defaultVal, candidates) -} - -// RangeFloat64 checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 { - val := k.MustFloat64() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeInt checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeInt(defaultVal, min, max int) int { - val := k.MustInt() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeInt64 checks if value is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeInt64(defaultVal, min, max int64) int64 { - val := k.MustInt64() - if val < min || val > max { - return defaultVal - } - return val -} - -// RangeTimeFormat checks if value with given format is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time { - val := k.MustTimeFormat(format) - if val.Unix() < min.Unix() || val.Unix() > max.Unix() { - return defaultVal - } - return val -} - -// RangeTime checks if value with RFC3339 format is in given range inclusively, -// and returns default value if it's not. -func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time { - return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max) -} - -// Strings returns list of string divided by given delimiter. -func (k *Key) Strings(delim string) []string { - str := k.String() - if len(str) == 0 { - return []string{} - } - - runes := []rune(str) - vals := make([]string, 0, 2) - var buf bytes.Buffer - escape := false - idx := 0 - for { - if escape { - escape = false - if runes[idx] != '\\' && !strings.HasPrefix(string(runes[idx:]), delim) { - buf.WriteRune('\\') - } - buf.WriteRune(runes[idx]) - } else { - if runes[idx] == '\\' { - escape = true - } else if strings.HasPrefix(string(runes[idx:]), delim) { - idx += len(delim) - 1 - vals = append(vals, strings.TrimSpace(buf.String())) - buf.Reset() - } else { - buf.WriteRune(runes[idx]) - } - } - idx++ - if idx == len(runes) { - break - } - } - - if buf.Len() > 0 { - vals = append(vals, strings.TrimSpace(buf.String())) - } - - return vals -} - -// StringsWithShadows returns list of string divided by given delimiter. -// Shadows will also be appended if any. -func (k *Key) StringsWithShadows(delim string) []string { - vals := k.ValueWithShadows() - results := make([]string, 0, len(vals)*2) - for i := range vals { - if len(vals) == 0 { - continue - } - - results = append(results, strings.Split(vals[i], delim)...) - } - - for i := range results { - results[i] = k.transformValue(strings.TrimSpace(results[i])) - } - return results -} - -// Float64s returns list of float64 divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Float64s(delim string) []float64 { - vals, _ := k.parseFloat64s(k.Strings(delim), true, false) - return vals -} - -// Ints returns list of int divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Ints(delim string) []int { - vals, _ := k.parseInts(k.Strings(delim), true, false) - return vals -} - -// Int64s returns list of int64 divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Int64s(delim string) []int64 { - vals, _ := k.parseInt64s(k.Strings(delim), true, false) - return vals -} - -// Uints returns list of uint divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Uints(delim string) []uint { - vals, _ := k.parseUints(k.Strings(delim), true, false) - return vals -} - -// Uint64s returns list of uint64 divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Uint64s(delim string) []uint64 { - vals, _ := k.parseUint64s(k.Strings(delim), true, false) - return vals -} - -// Bools returns list of bool divided by given delimiter. Any invalid input will be treated as zero value. -func (k *Key) Bools(delim string) []bool { - vals, _ := k.parseBools(k.Strings(delim), true, false) - return vals -} - -// TimesFormat parses with given format and returns list of time.Time divided by given delimiter. -// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC). -func (k *Key) TimesFormat(format, delim string) []time.Time { - vals, _ := k.parseTimesFormat(format, k.Strings(delim), true, false) - return vals -} - -// Times parses with RFC3339 format and returns list of time.Time divided by given delimiter. -// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC). -func (k *Key) Times(delim string) []time.Time { - return k.TimesFormat(time.RFC3339, delim) -} - -// ValidFloat64s returns list of float64 divided by given delimiter. If some value is not float, then -// it will not be included to result list. -func (k *Key) ValidFloat64s(delim string) []float64 { - vals, _ := k.parseFloat64s(k.Strings(delim), false, false) - return vals -} - -// ValidInts returns list of int divided by given delimiter. If some value is not integer, then it will -// not be included to result list. -func (k *Key) ValidInts(delim string) []int { - vals, _ := k.parseInts(k.Strings(delim), false, false) - return vals -} - -// ValidInt64s returns list of int64 divided by given delimiter. If some value is not 64-bit integer, -// then it will not be included to result list. -func (k *Key) ValidInt64s(delim string) []int64 { - vals, _ := k.parseInt64s(k.Strings(delim), false, false) - return vals -} - -// ValidUints returns list of uint divided by given delimiter. If some value is not unsigned integer, -// then it will not be included to result list. -func (k *Key) ValidUints(delim string) []uint { - vals, _ := k.parseUints(k.Strings(delim), false, false) - return vals -} - -// ValidUint64s returns list of uint64 divided by given delimiter. If some value is not 64-bit unsigned -// integer, then it will not be included to result list. -func (k *Key) ValidUint64s(delim string) []uint64 { - vals, _ := k.parseUint64s(k.Strings(delim), false, false) - return vals -} - -// ValidBools returns list of bool divided by given delimiter. If some value is not 64-bit unsigned -// integer, then it will not be included to result list. -func (k *Key) ValidBools(delim string) []bool { - vals, _ := k.parseBools(k.Strings(delim), false, false) - return vals -} - -// ValidTimesFormat parses with given format and returns list of time.Time divided by given delimiter. -func (k *Key) ValidTimesFormat(format, delim string) []time.Time { - vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false) - return vals -} - -// ValidTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter. -func (k *Key) ValidTimes(delim string) []time.Time { - return k.ValidTimesFormat(time.RFC3339, delim) -} - -// StrictFloat64s returns list of float64 divided by given delimiter or error on first invalid input. -func (k *Key) StrictFloat64s(delim string) ([]float64, error) { - return k.parseFloat64s(k.Strings(delim), false, true) -} - -// StrictInts returns list of int divided by given delimiter or error on first invalid input. -func (k *Key) StrictInts(delim string) ([]int, error) { - return k.parseInts(k.Strings(delim), false, true) -} - -// StrictInt64s returns list of int64 divided by given delimiter or error on first invalid input. -func (k *Key) StrictInt64s(delim string) ([]int64, error) { - return k.parseInt64s(k.Strings(delim), false, true) -} - -// StrictUints returns list of uint divided by given delimiter or error on first invalid input. -func (k *Key) StrictUints(delim string) ([]uint, error) { - return k.parseUints(k.Strings(delim), false, true) -} - -// StrictUint64s returns list of uint64 divided by given delimiter or error on first invalid input. -func (k *Key) StrictUint64s(delim string) ([]uint64, error) { - return k.parseUint64s(k.Strings(delim), false, true) -} - -// StrictBools returns list of bool divided by given delimiter or error on first invalid input. -func (k *Key) StrictBools(delim string) ([]bool, error) { - return k.parseBools(k.Strings(delim), false, true) -} - -// StrictTimesFormat parses with given format and returns list of time.Time divided by given delimiter -// or error on first invalid input. -func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) { - return k.parseTimesFormat(format, k.Strings(delim), false, true) -} - -// StrictTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter -// or error on first invalid input. -func (k *Key) StrictTimes(delim string) ([]time.Time, error) { - return k.StrictTimesFormat(time.RFC3339, delim) -} - -// parseBools transforms strings to bools. -func (k *Key) parseBools(strs []string, addInvalid, returnOnInvalid bool) ([]bool, error) { - vals := make([]bool, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := parseBool(str) - return val, err - } - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, val.(bool)) - } - } - return vals, err -} - -// parseFloat64s transforms strings to float64s. -func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) { - vals := make([]float64, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := strconv.ParseFloat(str, 64) - return val, err - } - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, val.(float64)) - } - } - return vals, err -} - -// parseInts transforms strings to ints. -func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) { - vals := make([]int, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := strconv.ParseInt(str, 0, 64) - return val, err - } - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, int(val.(int64))) - } - } - return vals, err -} - -// parseInt64s transforms strings to int64s. -func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) { - vals := make([]int64, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := strconv.ParseInt(str, 0, 64) - return val, err - } - - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, val.(int64)) - } - } - return vals, err -} - -// parseUints transforms strings to uints. -func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) { - vals := make([]uint, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := strconv.ParseUint(str, 0, 64) - return val, err - } - - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, uint(val.(uint64))) - } - } - return vals, err -} - -// parseUint64s transforms strings to uint64s. -func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) { - vals := make([]uint64, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := strconv.ParseUint(str, 0, 64) - return val, err - } - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, val.(uint64)) - } - } - return vals, err -} - - -type Parser func(str string) (interface{}, error) - - -// parseTimesFormat transforms strings to times in given format. -func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) { - vals := make([]time.Time, 0, len(strs)) - parser := func(str string) (interface{}, error) { - val, err := time.Parse(format, str) - return val, err - } - rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser) - if err == nil { - for _, val := range rawVals { - vals = append(vals, val.(time.Time)) - } - } - return vals, err -} - - -// doParse transforms strings to different types -func (k *Key) doParse(strs []string, addInvalid, returnOnInvalid bool, parser Parser) ([]interface{}, error) { - vals := make([]interface{}, 0, len(strs)) - for _, str := range strs { - val, err := parser(str) - if err != nil && returnOnInvalid { - return nil, err - } - if err == nil || addInvalid { - vals = append(vals, val) - } - } - return vals, nil -} - -// SetValue changes key value. -func (k *Key) SetValue(v string) { - if k.s.f.BlockMode { - k.s.f.lock.Lock() - defer k.s.f.lock.Unlock() - } - - k.value = v - k.s.keysHash[k.name] = v -} diff --git a/vendor/gopkg.in/ini.v1/parser.go b/vendor/gopkg.in/ini.v1/parser.go deleted file mode 100644 index ea6c08b02..000000000 --- a/vendor/gopkg.in/ini.v1/parser.go +++ /dev/null @@ -1,535 +0,0 @@ -// Copyright 2015 Unknwon -// -// 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 ini - -import ( - "bufio" - "bytes" - "fmt" - "io" - "regexp" - "strconv" - "strings" - "unicode" -) - -const minReaderBufferSize = 4096 - -var pythonMultiline = regexp.MustCompile(`^([\t\f ]+)(.*)`) - -type parserOptions struct { - IgnoreContinuation bool - IgnoreInlineComment bool - AllowPythonMultilineValues bool - SpaceBeforeInlineComment bool - UnescapeValueDoubleQuotes bool - UnescapeValueCommentSymbols bool - PreserveSurroundedQuote bool - DebugFunc DebugFunc - ReaderBufferSize int -} - -type parser struct { - buf *bufio.Reader - options parserOptions - - isEOF bool - count int - comment *bytes.Buffer -} - -func (p *parser) debug(format string, args ...interface{}) { - if p.options.DebugFunc != nil { - p.options.DebugFunc(fmt.Sprintf(format, args...)) - } -} - -func newParser(r io.Reader, opts parserOptions) *parser { - size := opts.ReaderBufferSize - if size < minReaderBufferSize { - size = minReaderBufferSize - } - - return &parser{ - buf: bufio.NewReaderSize(r, size), - options: opts, - count: 1, - comment: &bytes.Buffer{}, - } -} - -// BOM handles header of UTF-8, UTF-16 LE and UTF-16 BE's BOM format. -// http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding -func (p *parser) BOM() error { - mask, err := p.buf.Peek(2) - if err != nil && err != io.EOF { - return err - } else if len(mask) < 2 { - return nil - } - - switch { - case mask[0] == 254 && mask[1] == 255: - fallthrough - case mask[0] == 255 && mask[1] == 254: - _, err = p.buf.Read(mask) - if err != nil { - return err - } - case mask[0] == 239 && mask[1] == 187: - mask, err := p.buf.Peek(3) - if err != nil && err != io.EOF { - return err - } else if len(mask) < 3 { - return nil - } - if mask[2] == 191 { - _, err = p.buf.Read(mask) - if err != nil { - return err - } - } - } - return nil -} - -func (p *parser) readUntil(delim byte) ([]byte, error) { - data, err := p.buf.ReadBytes(delim) - if err != nil { - if err == io.EOF { - p.isEOF = true - } else { - return nil, err - } - } - return data, nil -} - -func cleanComment(in []byte) ([]byte, bool) { - i := bytes.IndexAny(in, "#;") - if i == -1 { - return nil, false - } - return in[i:], true -} - -func readKeyName(delimiters string, in []byte) (string, int, error) { - line := string(in) - - // Check if key name surrounded by quotes. - var keyQuote string - if line[0] == '"' { - if len(line) > 6 && string(line[0:3]) == `"""` { - keyQuote = `"""` - } else { - keyQuote = `"` - } - } else if line[0] == '`' { - keyQuote = "`" - } - - // Get out key name - var endIdx int - if len(keyQuote) > 0 { - startIdx := len(keyQuote) - // FIXME: fail case -> """"""name"""=value - pos := strings.Index(line[startIdx:], keyQuote) - if pos == -1 { - return "", -1, fmt.Errorf("missing closing key quote: %s", line) - } - pos += startIdx - - // Find key-value delimiter - i := strings.IndexAny(line[pos+startIdx:], delimiters) - if i < 0 { - return "", -1, ErrDelimiterNotFound{line} - } - endIdx = pos + i - return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil - } - - endIdx = strings.IndexAny(line, delimiters) - if endIdx < 0 { - return "", -1, ErrDelimiterNotFound{line} - } - return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil -} - -func (p *parser) readMultilines(line, val, valQuote string) (string, error) { - for { - data, err := p.readUntil('\n') - if err != nil { - return "", err - } - next := string(data) - - pos := strings.LastIndex(next, valQuote) - if pos > -1 { - val += next[:pos] - - comment, has := cleanComment([]byte(next[pos:])) - if has { - p.comment.Write(bytes.TrimSpace(comment)) - } - break - } - val += next - if p.isEOF { - return "", fmt.Errorf("missing closing key quote from %q to %q", line, next) - } - } - return val, nil -} - -func (p *parser) readContinuationLines(val string) (string, error) { - for { - data, err := p.readUntil('\n') - if err != nil { - return "", err - } - next := strings.TrimSpace(string(data)) - - if len(next) == 0 { - break - } - val += next - if val[len(val)-1] != '\\' { - break - } - val = val[:len(val)-1] - } - return val, nil -} - -// hasSurroundedQuote check if and only if the first and last characters -// are quotes \" or \'. -// It returns false if any other parts also contain same kind of quotes. -func hasSurroundedQuote(in string, quote byte) bool { - return len(in) >= 2 && in[0] == quote && in[len(in)-1] == quote && - strings.IndexByte(in[1:], quote) == len(in)-2 -} - -func (p *parser) readValue(in []byte, bufferSize int) (string, error) { - - line := strings.TrimLeftFunc(string(in), unicode.IsSpace) - if len(line) == 0 { - if p.options.AllowPythonMultilineValues && len(in) > 0 && in[len(in)-1] == '\n' { - return p.readPythonMultilines(line, bufferSize) - } - return "", nil - } - - var valQuote string - if len(line) > 3 && string(line[0:3]) == `"""` { - valQuote = `"""` - } else if line[0] == '`' { - valQuote = "`" - } else if p.options.UnescapeValueDoubleQuotes && line[0] == '"' { - valQuote = `"` - } - - if len(valQuote) > 0 { - startIdx := len(valQuote) - pos := strings.LastIndex(line[startIdx:], valQuote) - // Check for multi-line value - if pos == -1 { - return p.readMultilines(line, line[startIdx:], valQuote) - } - - if p.options.UnescapeValueDoubleQuotes && valQuote == `"` { - return strings.Replace(line[startIdx:pos+startIdx], `\"`, `"`, -1), nil - } - return line[startIdx : pos+startIdx], nil - } - - lastChar := line[len(line)-1] - // Won't be able to reach here if value only contains whitespace - line = strings.TrimSpace(line) - trimmedLastChar := line[len(line)-1] - - // Check continuation lines when desired - if !p.options.IgnoreContinuation && trimmedLastChar == '\\' { - return p.readContinuationLines(line[:len(line)-1]) - } - - // Check if ignore inline comment - if !p.options.IgnoreInlineComment { - var i int - if p.options.SpaceBeforeInlineComment { - i = strings.Index(line, " #") - if i == -1 { - i = strings.Index(line, " ;") - } - - } else { - i = strings.IndexAny(line, "#;") - } - - if i > -1 { - p.comment.WriteString(line[i:]) - line = strings.TrimSpace(line[:i]) - } - - } - - // Trim single and double quotes - if (hasSurroundedQuote(line, '\'') || - hasSurroundedQuote(line, '"')) && !p.options.PreserveSurroundedQuote { - line = line[1 : len(line)-1] - } else if len(valQuote) == 0 && p.options.UnescapeValueCommentSymbols { - if strings.Contains(line, `\;`) { - line = strings.Replace(line, `\;`, ";", -1) - } - if strings.Contains(line, `\#`) { - line = strings.Replace(line, `\#`, "#", -1) - } - } else if p.options.AllowPythonMultilineValues && lastChar == '\n' { - return p.readPythonMultilines(line, bufferSize) - } - - return line, nil -} - -func (p *parser) readPythonMultilines(line string, bufferSize int) (string, error) { - parserBufferPeekResult, _ := p.buf.Peek(bufferSize) - peekBuffer := bytes.NewBuffer(parserBufferPeekResult) - - indentSize := 0 - for { - peekData, peekErr := peekBuffer.ReadBytes('\n') - if peekErr != nil { - if peekErr == io.EOF { - p.debug("readPythonMultilines: io.EOF, peekData: %q, line: %q", string(peekData), line) - return line, nil - } - - p.debug("readPythonMultilines: failed to peek with error: %v", peekErr) - return "", peekErr - } - - p.debug("readPythonMultilines: parsing %q", string(peekData)) - - peekMatches := pythonMultiline.FindStringSubmatch(string(peekData)) - p.debug("readPythonMultilines: matched %d parts", len(peekMatches)) - for n, v := range peekMatches { - p.debug(" %d: %q", n, v) - } - - // Return if not a Python multiline value. - if len(peekMatches) != 3 { - p.debug("readPythonMultilines: end of value, got: %q", line) - return line, nil - } - - // Determine indent size and line prefix. - currentIndentSize := len(peekMatches[1]) - if indentSize < 1 { - indentSize = currentIndentSize - p.debug("readPythonMultilines: indent size is %d", indentSize) - } - - // Make sure each line is indented at least as far as first line. - if currentIndentSize < indentSize { - p.debug("readPythonMultilines: end of value, current indent: %d, expected indent: %d, line: %q", currentIndentSize, indentSize, line) - return line, nil - } - - // Advance the parser reader (buffer) in-sync with the peek buffer. - _, err := p.buf.Discard(len(peekData)) - if err != nil { - p.debug("readPythonMultilines: failed to skip to the end, returning error") - return "", err - } - - // Handle indented empty line. - line += "\n" + peekMatches[1][indentSize:] + peekMatches[2] - } -} - -// parse parses data through an io.Reader. -func (f *File) parse(reader io.Reader) (err error) { - p := newParser(reader, parserOptions{ - IgnoreContinuation: f.options.IgnoreContinuation, - IgnoreInlineComment: f.options.IgnoreInlineComment, - AllowPythonMultilineValues: f.options.AllowPythonMultilineValues, - SpaceBeforeInlineComment: f.options.SpaceBeforeInlineComment, - UnescapeValueDoubleQuotes: f.options.UnescapeValueDoubleQuotes, - UnescapeValueCommentSymbols: f.options.UnescapeValueCommentSymbols, - PreserveSurroundedQuote: f.options.PreserveSurroundedQuote, - DebugFunc: f.options.DebugFunc, - ReaderBufferSize: f.options.ReaderBufferSize, - }) - if err = p.BOM(); err != nil { - return fmt.Errorf("BOM: %v", err) - } - - // Ignore error because default section name is never empty string. - name := DefaultSection - if f.options.Insensitive { - name = strings.ToLower(DefaultSection) - } - section, _ := f.NewSection(name) - - // This "last" is not strictly equivalent to "previous one" if current key is not the first nested key - var isLastValueEmpty bool - var lastRegularKey *Key - - var line []byte - var inUnparseableSection bool - - // NOTE: Iterate and increase `currentPeekSize` until - // the size of the parser buffer is found. - // TODO(unknwon): When Golang 1.10 is the lowest version supported, replace with `parserBufferSize := p.buf.Size()`. - parserBufferSize := 0 - // NOTE: Peek 4kb at a time. - currentPeekSize := minReaderBufferSize - - if f.options.AllowPythonMultilineValues { - for { - peekBytes, _ := p.buf.Peek(currentPeekSize) - peekBytesLength := len(peekBytes) - - if parserBufferSize >= peekBytesLength { - break - } - - currentPeekSize *= 2 - parserBufferSize = peekBytesLength - } - } - - for !p.isEOF { - line, err = p.readUntil('\n') - if err != nil { - return err - } - - if f.options.AllowNestedValues && - isLastValueEmpty && len(line) > 0 { - if line[0] == ' ' || line[0] == '\t' { - err = lastRegularKey.addNestedValue(string(bytes.TrimSpace(line))) - if err != nil { - return err - } - continue - } - } - - line = bytes.TrimLeftFunc(line, unicode.IsSpace) - if len(line) == 0 { - continue - } - - // Comments - if line[0] == '#' || line[0] == ';' { - // Note: we do not care ending line break, - // it is needed for adding second line, - // so just clean it once at the end when set to value. - p.comment.Write(line) - continue - } - - // Section - if line[0] == '[' { - // Read to the next ']' (TODO: support quoted strings) - closeIdx := bytes.LastIndexByte(line, ']') - if closeIdx == -1 { - return fmt.Errorf("unclosed section: %s", line) - } - - name := string(line[1:closeIdx]) - section, err = f.NewSection(name) - if err != nil { - return err - } - - comment, has := cleanComment(line[closeIdx+1:]) - if has { - p.comment.Write(comment) - } - - section.Comment = strings.TrimSpace(p.comment.String()) - - // Reset auto-counter and comments - p.comment.Reset() - p.count = 1 - - inUnparseableSection = false - for i := range f.options.UnparseableSections { - if f.options.UnparseableSections[i] == name || - (f.options.Insensitive && strings.EqualFold(f.options.UnparseableSections[i], name)) { - inUnparseableSection = true - continue - } - } - continue - } - - if inUnparseableSection { - section.isRawSection = true - section.rawBody += string(line) - continue - } - - kname, offset, err := readKeyName(f.options.KeyValueDelimiters, line) - if err != nil { - // Treat as boolean key when desired, and whole line is key name. - if IsErrDelimiterNotFound(err) { - switch { - case f.options.AllowBooleanKeys: - kname, err := p.readValue(line, parserBufferSize) - if err != nil { - return err - } - key, err := section.NewBooleanKey(kname) - if err != nil { - return err - } - key.Comment = strings.TrimSpace(p.comment.String()) - p.comment.Reset() - continue - - case f.options.SkipUnrecognizableLines: - continue - } - } - return err - } - - // Auto increment. - isAutoIncr := false - if kname == "-" { - isAutoIncr = true - kname = "#" + strconv.Itoa(p.count) - p.count++ - } - - value, err := p.readValue(line[offset:], parserBufferSize) - if err != nil { - return err - } - isLastValueEmpty = len(value) == 0 - - key, err := section.NewKey(kname, value) - if err != nil { - return err - } - key.isAutoIncrement = isAutoIncr - key.Comment = strings.TrimSpace(p.comment.String()) - p.comment.Reset() - lastRegularKey = key - } - return nil -} diff --git a/vendor/gopkg.in/ini.v1/section.go b/vendor/gopkg.in/ini.v1/section.go deleted file mode 100644 index 6ba5ac290..000000000 --- a/vendor/gopkg.in/ini.v1/section.go +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2014 Unknwon -// -// 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 ini - -import ( - "errors" - "fmt" - "strings" -) - -// Section represents a config section. -type Section struct { - f *File - Comment string - name string - keys map[string]*Key - keyList []string - keysHash map[string]string - - isRawSection bool - rawBody string -} - -func newSection(f *File, name string) *Section { - return &Section{ - f: f, - name: name, - keys: make(map[string]*Key), - keyList: make([]string, 0, 10), - keysHash: make(map[string]string), - } -} - -// Name returns name of Section. -func (s *Section) Name() string { - return s.name -} - -// Body returns rawBody of Section if the section was marked as unparseable. -// It still follows the other rules of the INI format surrounding leading/trailing whitespace. -func (s *Section) Body() string { - return strings.TrimSpace(s.rawBody) -} - -// SetBody updates body content only if section is raw. -func (s *Section) SetBody(body string) { - if !s.isRawSection { - return - } - s.rawBody = body -} - -// NewKey creates a new key to given section. -func (s *Section) NewKey(name, val string) (*Key, error) { - if len(name) == 0 { - return nil, errors.New("error creating new key: empty key name") - } else if s.f.options.Insensitive { - name = strings.ToLower(name) - } - - if s.f.BlockMode { - s.f.lock.Lock() - defer s.f.lock.Unlock() - } - - if inSlice(name, s.keyList) { - if s.f.options.AllowShadows { - if err := s.keys[name].addShadow(val); err != nil { - return nil, err - } - } else { - s.keys[name].value = val - s.keysHash[name] = val - } - return s.keys[name], nil - } - - s.keyList = append(s.keyList, name) - s.keys[name] = newKey(s, name, val) - s.keysHash[name] = val - return s.keys[name], nil -} - -// NewBooleanKey creates a new boolean type key to given section. -func (s *Section) NewBooleanKey(name string) (*Key, error) { - key, err := s.NewKey(name, "true") - if err != nil { - return nil, err - } - - key.isBooleanType = true - return key, nil -} - -// GetKey returns key in section by given name. -func (s *Section) GetKey(name string) (*Key, error) { - if s.f.BlockMode { - s.f.lock.RLock() - } - if s.f.options.Insensitive { - name = strings.ToLower(name) - } - key := s.keys[name] - if s.f.BlockMode { - s.f.lock.RUnlock() - } - - if key == nil { - // Check if it is a child-section. - sname := s.name - for { - if i := strings.LastIndex(sname, "."); i > -1 { - sname = sname[:i] - sec, err := s.f.GetSection(sname) - if err != nil { - continue - } - return sec.GetKey(name) - } - break - } - return nil, fmt.Errorf("error when getting key of section %q: key %q not exists", s.name, name) - } - return key, nil -} - -// HasKey returns true if section contains a key with given name. -func (s *Section) HasKey(name string) bool { - key, _ := s.GetKey(name) - return key != nil -} - -// Deprecated: Use "HasKey" instead. -func (s *Section) Haskey(name string) bool { - return s.HasKey(name) -} - -// HasValue returns true if section contains given raw value. -func (s *Section) HasValue(value string) bool { - if s.f.BlockMode { - s.f.lock.RLock() - defer s.f.lock.RUnlock() - } - - for _, k := range s.keys { - if value == k.value { - return true - } - } - return false -} - -// Key assumes named Key exists in section and returns a zero-value when not. -func (s *Section) Key(name string) *Key { - key, err := s.GetKey(name) - if err != nil { - // It's OK here because the only possible error is empty key name, - // but if it's empty, this piece of code won't be executed. - key, _ = s.NewKey(name, "") - return key - } - return key -} - -// Keys returns list of keys of section. -func (s *Section) Keys() []*Key { - keys := make([]*Key, len(s.keyList)) - for i := range s.keyList { - keys[i] = s.Key(s.keyList[i]) - } - return keys -} - -// ParentKeys returns list of keys of parent section. -func (s *Section) ParentKeys() []*Key { - var parentKeys []*Key - sname := s.name - for { - if i := strings.LastIndex(sname, "."); i > -1 { - sname = sname[:i] - sec, err := s.f.GetSection(sname) - if err != nil { - continue - } - parentKeys = append(parentKeys, sec.Keys()...) - } else { - break - } - - } - return parentKeys -} - -// KeyStrings returns list of key names of section. -func (s *Section) KeyStrings() []string { - list := make([]string, len(s.keyList)) - copy(list, s.keyList) - return list -} - -// KeysHash returns keys hash consisting of names and values. -func (s *Section) KeysHash() map[string]string { - if s.f.BlockMode { - s.f.lock.RLock() - defer s.f.lock.RUnlock() - } - - hash := map[string]string{} - for key, value := range s.keysHash { - hash[key] = value - } - return hash -} - -// DeleteKey deletes a key from section. -func (s *Section) DeleteKey(name string) { - if s.f.BlockMode { - s.f.lock.Lock() - defer s.f.lock.Unlock() - } - - for i, k := range s.keyList { - if k == name { - s.keyList = append(s.keyList[:i], s.keyList[i+1:]...) - delete(s.keys, name) - delete(s.keysHash, name) - return - } - } -} - -// ChildSections returns a list of child sections of current section. -// For example, "[parent.child1]" and "[parent.child12]" are child sections -// of section "[parent]". -func (s *Section) ChildSections() []*Section { - prefix := s.name + "." - children := make([]*Section, 0, 3) - for _, name := range s.f.sectionList { - if strings.HasPrefix(name, prefix) { - children = append(children, s.f.sections[name]...) - } - } - return children -} diff --git a/vendor/gopkg.in/ini.v1/struct.go b/vendor/gopkg.in/ini.v1/struct.go deleted file mode 100644 index 9be40a920..000000000 --- a/vendor/gopkg.in/ini.v1/struct.go +++ /dev/null @@ -1,729 +0,0 @@ -// Copyright 2014 Unknwon -// -// 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 ini - -import ( - "bytes" - "errors" - "fmt" - "reflect" - "strings" - "time" - "unicode" -) - -// NameMapper represents a ini tag name mapper. -type NameMapper func(string) string - -// Built-in name getters. -var ( - // SnackCase converts to format SNACK_CASE. - SnackCase NameMapper = func(raw string) string { - newstr := make([]rune, 0, len(raw)) - for i, chr := range raw { - if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { - if i > 0 { - newstr = append(newstr, '_') - } - } - newstr = append(newstr, unicode.ToUpper(chr)) - } - return string(newstr) - } - // TitleUnderscore converts to format title_underscore. - TitleUnderscore NameMapper = func(raw string) string { - newstr := make([]rune, 0, len(raw)) - for i, chr := range raw { - if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { - if i > 0 { - newstr = append(newstr, '_') - } - chr -= 'A' - 'a' - } - newstr = append(newstr, chr) - } - return string(newstr) - } -) - -func (s *Section) parseFieldName(raw, actual string) string { - if len(actual) > 0 { - return actual - } - if s.f.NameMapper != nil { - return s.f.NameMapper(raw) - } - return raw -} - -func parseDelim(actual string) string { - if len(actual) > 0 { - return actual - } - return "," -} - -var reflectTime = reflect.TypeOf(time.Now()).Kind() - -// setSliceWithProperType sets proper values to slice based on its type. -func setSliceWithProperType(key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error { - var strs []string - if allowShadow { - strs = key.StringsWithShadows(delim) - } else { - strs = key.Strings(delim) - } - - numVals := len(strs) - if numVals == 0 { - return nil - } - - var vals interface{} - var err error - - sliceOf := field.Type().Elem().Kind() - switch sliceOf { - case reflect.String: - vals = strs - case reflect.Int: - vals, err = key.parseInts(strs, true, false) - case reflect.Int64: - vals, err = key.parseInt64s(strs, true, false) - case reflect.Uint: - vals, err = key.parseUints(strs, true, false) - case reflect.Uint64: - vals, err = key.parseUint64s(strs, true, false) - case reflect.Float64: - vals, err = key.parseFloat64s(strs, true, false) - case reflect.Bool: - vals, err = key.parseBools(strs, true, false) - case reflectTime: - vals, err = key.parseTimesFormat(time.RFC3339, strs, true, false) - default: - return fmt.Errorf("unsupported type '[]%s'", sliceOf) - } - if err != nil && isStrict { - return err - } - - slice := reflect.MakeSlice(field.Type(), numVals, numVals) - for i := 0; i < numVals; i++ { - switch sliceOf { - case reflect.String: - slice.Index(i).Set(reflect.ValueOf(vals.([]string)[i])) - case reflect.Int: - slice.Index(i).Set(reflect.ValueOf(vals.([]int)[i])) - case reflect.Int64: - slice.Index(i).Set(reflect.ValueOf(vals.([]int64)[i])) - case reflect.Uint: - slice.Index(i).Set(reflect.ValueOf(vals.([]uint)[i])) - case reflect.Uint64: - slice.Index(i).Set(reflect.ValueOf(vals.([]uint64)[i])) - case reflect.Float64: - slice.Index(i).Set(reflect.ValueOf(vals.([]float64)[i])) - case reflect.Bool: - slice.Index(i).Set(reflect.ValueOf(vals.([]bool)[i])) - case reflectTime: - slice.Index(i).Set(reflect.ValueOf(vals.([]time.Time)[i])) - } - } - field.Set(slice) - return nil -} - -func wrapStrictError(err error, isStrict bool) error { - if isStrict { - return err - } - return nil -} - -// setWithProperType sets proper value to field based on its type, -// but it does not return error for failing parsing, -// because we want to use default value that is already assigned to struct. -func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error { - vt := t - isPtr := t.Kind() == reflect.Ptr - if isPtr { - vt = t.Elem() - } - switch vt.Kind() { - case reflect.String: - stringVal := key.String() - if isPtr { - field.Set(reflect.ValueOf(&stringVal)) - } else if len(stringVal) > 0 { - field.SetString(key.String()) - } - case reflect.Bool: - boolVal, err := key.Bool() - if err != nil { - return wrapStrictError(err, isStrict) - } - if isPtr { - field.Set(reflect.ValueOf(&boolVal)) - } else { - field.SetBool(boolVal) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - // ParseDuration will not return err for `0`, so check the type name - if vt.Name() == "Duration" { - durationVal, err := key.Duration() - if err != nil { - if intVal, err := key.Int64(); err == nil { - field.SetInt(intVal) - return nil - } - return wrapStrictError(err, isStrict) - } - if isPtr { - field.Set(reflect.ValueOf(&durationVal)) - } else if int64(durationVal) > 0 { - field.Set(reflect.ValueOf(durationVal)) - } - return nil - } - - intVal, err := key.Int64() - if err != nil { - return wrapStrictError(err, isStrict) - } - if isPtr { - pv := reflect.New(t.Elem()) - pv.Elem().SetInt(intVal) - field.Set(pv) - } else { - field.SetInt(intVal) - } - // byte is an alias for uint8, so supporting uint8 breaks support for byte - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - durationVal, err := key.Duration() - // Skip zero value - if err == nil && uint64(durationVal) > 0 { - if isPtr { - field.Set(reflect.ValueOf(&durationVal)) - } else { - field.Set(reflect.ValueOf(durationVal)) - } - return nil - } - - uintVal, err := key.Uint64() - if err != nil { - return wrapStrictError(err, isStrict) - } - if isPtr { - pv := reflect.New(t.Elem()) - pv.Elem().SetUint(uintVal) - field.Set(pv) - } else { - field.SetUint(uintVal) - } - - case reflect.Float32, reflect.Float64: - floatVal, err := key.Float64() - if err != nil { - return wrapStrictError(err, isStrict) - } - if isPtr { - pv := reflect.New(t.Elem()) - pv.Elem().SetFloat(floatVal) - field.Set(pv) - } else { - field.SetFloat(floatVal) - } - case reflectTime: - timeVal, err := key.Time() - if err != nil { - return wrapStrictError(err, isStrict) - } - if isPtr { - field.Set(reflect.ValueOf(&timeVal)) - } else { - field.Set(reflect.ValueOf(timeVal)) - } - case reflect.Slice: - return setSliceWithProperType(key, field, delim, allowShadow, isStrict) - default: - return fmt.Errorf("unsupported type %q", t) - } - return nil -} - -func parseTagOptions(tag string) (rawName string, omitEmpty bool, allowShadow bool, allowNonUnique bool) { - opts := strings.SplitN(tag, ",", 4) - rawName = opts[0] - if len(opts) > 1 { - omitEmpty = opts[1] == "omitempty" - } - if len(opts) > 2 { - allowShadow = opts[2] == "allowshadow" - } - if len(opts) > 3 { - allowNonUnique = opts[3] == "nonunique" - } - return rawName, omitEmpty, allowShadow, allowNonUnique -} - -// mapToField maps the given value to the matching field of the given section. -// The sectionIndex is the index (if non unique sections are enabled) to which the value should be added. -func (s *Section) mapToField(val reflect.Value, isStrict bool, sectionIndex int) error { - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - typ := val.Type() - - for i := 0; i < typ.NumField(); i++ { - field := val.Field(i) - tpField := typ.Field(i) - - tag := tpField.Tag.Get("ini") - if tag == "-" { - continue - } - - rawName, _, allowShadow, allowNonUnique := parseTagOptions(tag) - fieldName := s.parseFieldName(tpField.Name, rawName) - if len(fieldName) == 0 || !field.CanSet() { - continue - } - - isStruct := tpField.Type.Kind() == reflect.Struct - isStructPtr := tpField.Type.Kind() == reflect.Ptr && tpField.Type.Elem().Kind() == reflect.Struct - isAnonymous := tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous - if isAnonymous { - field.Set(reflect.New(tpField.Type.Elem())) - } - - if isAnonymous || isStruct || isStructPtr { - if secs, err := s.f.SectionsByName(fieldName); err == nil { - if len(secs) <= sectionIndex { - return fmt.Errorf("there are not enough sections (%d <= %d) for the field %q", len(secs), sectionIndex, fieldName) - } - // Only set the field to non-nil struct value if we have a section for it. - // Otherwise, we end up with a non-nil struct ptr even though there is no data. - if isStructPtr && field.IsNil() { - field.Set(reflect.New(tpField.Type.Elem())) - } - if err = secs[sectionIndex].mapToField(field, isStrict, sectionIndex); err != nil { - return fmt.Errorf("map to field %q: %v", fieldName, err) - } - continue - } - } - - // Map non-unique sections - if allowNonUnique && tpField.Type.Kind() == reflect.Slice { - newField, err := s.mapToSlice(fieldName, field, isStrict) - if err != nil { - return fmt.Errorf("map to slice %q: %v", fieldName, err) - } - - field.Set(newField) - continue - } - - if key, err := s.GetKey(fieldName); err == nil { - delim := parseDelim(tpField.Tag.Get("delim")) - if err = setWithProperType(tpField.Type, key, field, delim, allowShadow, isStrict); err != nil { - return fmt.Errorf("set field %q: %v", fieldName, err) - } - } - } - return nil -} - -// mapToSlice maps all sections with the same name and returns the new value. -// The type of the Value must be a slice. -func (s *Section) mapToSlice(secName string, val reflect.Value, isStrict bool) (reflect.Value, error) { - secs, err := s.f.SectionsByName(secName) - if err != nil { - return reflect.Value{}, err - } - - typ := val.Type().Elem() - for i, sec := range secs { - elem := reflect.New(typ) - if err = sec.mapToField(elem, isStrict, i); err != nil { - return reflect.Value{}, fmt.Errorf("map to field from section %q: %v", secName, err) - } - - val = reflect.Append(val, elem.Elem()) - } - return val, nil -} - -// mapTo maps a section to object v. -func (s *Section) mapTo(v interface{}, isStrict bool) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - val = val.Elem() - } else { - return errors.New("not a pointer to a struct") - } - - if typ.Kind() == reflect.Slice { - newField, err := s.mapToSlice(s.name, val, isStrict) - if err != nil { - return err - } - - val.Set(newField) - return nil - } - - return s.mapToField(val, isStrict, 0) -} - -// MapTo maps section to given struct. -func (s *Section) MapTo(v interface{}) error { - return s.mapTo(v, false) -} - -// StrictMapTo maps section to given struct in strict mode, -// which returns all possible error including value parsing error. -func (s *Section) StrictMapTo(v interface{}) error { - return s.mapTo(v, true) -} - -// MapTo maps file to given struct. -func (f *File) MapTo(v interface{}) error { - return f.Section("").MapTo(v) -} - -// StrictMapTo maps file to given struct in strict mode, -// which returns all possible error including value parsing error. -func (f *File) StrictMapTo(v interface{}) error { - return f.Section("").StrictMapTo(v) -} - -// MapToWithMapper maps data sources to given struct with name mapper. -func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { - cfg, err := Load(source, others...) - if err != nil { - return err - } - cfg.NameMapper = mapper - return cfg.MapTo(v) -} - -// StrictMapToWithMapper maps data sources to given struct with name mapper in strict mode, -// which returns all possible error including value parsing error. -func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { - cfg, err := Load(source, others...) - if err != nil { - return err - } - cfg.NameMapper = mapper - return cfg.StrictMapTo(v) -} - -// MapTo maps data sources to given struct. -func MapTo(v, source interface{}, others ...interface{}) error { - return MapToWithMapper(v, nil, source, others...) -} - -// StrictMapTo maps data sources to given struct in strict mode, -// which returns all possible error including value parsing error. -func StrictMapTo(v, source interface{}, others ...interface{}) error { - return StrictMapToWithMapper(v, nil, source, others...) -} - -// reflectSliceWithProperType does the opposite thing as setSliceWithProperType. -func reflectSliceWithProperType(key *Key, field reflect.Value, delim string, allowShadow bool) error { - slice := field.Slice(0, field.Len()) - if field.Len() == 0 { - return nil - } - sliceOf := field.Type().Elem().Kind() - - if allowShadow { - var keyWithShadows *Key - for i := 0; i < field.Len(); i++ { - var val string - switch sliceOf { - case reflect.String: - val = slice.Index(i).String() - case reflect.Int, reflect.Int64: - val = fmt.Sprint(slice.Index(i).Int()) - case reflect.Uint, reflect.Uint64: - val = fmt.Sprint(slice.Index(i).Uint()) - case reflect.Float64: - val = fmt.Sprint(slice.Index(i).Float()) - case reflect.Bool: - val = fmt.Sprint(slice.Index(i).Bool()) - case reflectTime: - val = slice.Index(i).Interface().(time.Time).Format(time.RFC3339) - default: - return fmt.Errorf("unsupported type '[]%s'", sliceOf) - } - - if i == 0 { - keyWithShadows = newKey(key.s, key.name, val) - } else { - _ = keyWithShadows.AddShadow(val) - } - } - key = keyWithShadows - return nil - } - - var buf bytes.Buffer - for i := 0; i < field.Len(); i++ { - switch sliceOf { - case reflect.String: - buf.WriteString(slice.Index(i).String()) - case reflect.Int, reflect.Int64: - buf.WriteString(fmt.Sprint(slice.Index(i).Int())) - case reflect.Uint, reflect.Uint64: - buf.WriteString(fmt.Sprint(slice.Index(i).Uint())) - case reflect.Float64: - buf.WriteString(fmt.Sprint(slice.Index(i).Float())) - case reflect.Bool: - buf.WriteString(fmt.Sprint(slice.Index(i).Bool())) - case reflectTime: - buf.WriteString(slice.Index(i).Interface().(time.Time).Format(time.RFC3339)) - default: - return fmt.Errorf("unsupported type '[]%s'", sliceOf) - } - buf.WriteString(delim) - } - key.SetValue(buf.String()[:buf.Len()-len(delim)]) - return nil -} - -// reflectWithProperType does the opposite thing as setWithProperType. -func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow bool) error { - switch t.Kind() { - case reflect.String: - key.SetValue(field.String()) - case reflect.Bool: - key.SetValue(fmt.Sprint(field.Bool())) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - key.SetValue(fmt.Sprint(field.Int())) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - key.SetValue(fmt.Sprint(field.Uint())) - case reflect.Float32, reflect.Float64: - key.SetValue(fmt.Sprint(field.Float())) - case reflectTime: - key.SetValue(fmt.Sprint(field.Interface().(time.Time).Format(time.RFC3339))) - case reflect.Slice: - return reflectSliceWithProperType(key, field, delim, allowShadow) - case reflect.Ptr: - if !field.IsNil() { - return reflectWithProperType(t.Elem(), key, field.Elem(), delim, allowShadow) - } - default: - return fmt.Errorf("unsupported type %q", t) - } - return nil -} - -// CR: copied from encoding/json/encode.go with modifications of time.Time support. -// TODO: add more test coverage. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - case reflectTime: - t, ok := v.Interface().(time.Time) - return ok && t.IsZero() - } - return false -} - -// StructReflector is the interface implemented by struct types that can extract themselves into INI objects. -type StructReflector interface { - ReflectINIStruct(*File) error -} - -func (s *Section) reflectFrom(val reflect.Value) error { - if val.Kind() == reflect.Ptr { - val = val.Elem() - } - typ := val.Type() - - for i := 0; i < typ.NumField(); i++ { - if !val.Field(i).CanInterface() { - continue - } - - field := val.Field(i) - tpField := typ.Field(i) - - tag := tpField.Tag.Get("ini") - if tag == "-" { - continue - } - - rawName, omitEmpty, allowShadow, allowNonUnique := parseTagOptions(tag) - if omitEmpty && isEmptyValue(field) { - continue - } - - if r, ok := field.Interface().(StructReflector); ok { - return r.ReflectINIStruct(s.f) - } - - fieldName := s.parseFieldName(tpField.Name, rawName) - if len(fieldName) == 0 || !field.CanSet() { - continue - } - - if (tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous) || - (tpField.Type.Kind() == reflect.Struct && tpField.Type.Name() != "Time") { - // Note: The only error here is section doesn't exist. - sec, err := s.f.GetSection(fieldName) - if err != nil { - // Note: fieldName can never be empty here, ignore error. - sec, _ = s.f.NewSection(fieldName) - } - - // Add comment from comment tag - if len(sec.Comment) == 0 { - sec.Comment = tpField.Tag.Get("comment") - } - - if err = sec.reflectFrom(field); err != nil { - return fmt.Errorf("reflect from field %q: %v", fieldName, err) - } - continue - } - - if allowNonUnique && tpField.Type.Kind() == reflect.Slice { - slice := field.Slice(0, field.Len()) - if field.Len() == 0 { - return nil - } - sliceOf := field.Type().Elem().Kind() - - for i := 0; i < field.Len(); i++ { - if sliceOf != reflect.Struct && sliceOf != reflect.Ptr { - return fmt.Errorf("field %q is not a slice of pointer or struct", fieldName) - } - - sec, err := s.f.NewSection(fieldName) - if err != nil { - return err - } - - // Add comment from comment tag - if len(sec.Comment) == 0 { - sec.Comment = tpField.Tag.Get("comment") - } - - if err := sec.reflectFrom(slice.Index(i)); err != nil { - return fmt.Errorf("reflect from field %q: %v", fieldName, err) - } - } - continue - } - - // Note: Same reason as section. - key, err := s.GetKey(fieldName) - if err != nil { - key, _ = s.NewKey(fieldName, "") - } - - // Add comment from comment tag - if len(key.Comment) == 0 { - key.Comment = tpField.Tag.Get("comment") - } - - delim := parseDelim(tpField.Tag.Get("delim")) - if err = reflectWithProperType(tpField.Type, key, field, delim, allowShadow); err != nil { - return fmt.Errorf("reflect field %q: %v", fieldName, err) - } - - } - return nil -} - -// ReflectFrom reflects section from given struct. It overwrites existing ones. -func (s *Section) ReflectFrom(v interface{}) error { - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - - if s.name != DefaultSection && s.f.options.AllowNonUniqueSections && - (typ.Kind() == reflect.Slice || typ.Kind() == reflect.Ptr) { - // Clear sections to make sure none exists before adding the new ones - s.f.DeleteSection(s.name) - - if typ.Kind() == reflect.Ptr { - sec, err := s.f.NewSection(s.name) - if err != nil { - return err - } - return sec.reflectFrom(val.Elem()) - } - - slice := val.Slice(0, val.Len()) - sliceOf := val.Type().Elem().Kind() - if sliceOf != reflect.Ptr { - return fmt.Errorf("not a slice of pointers") - } - - for i := 0; i < slice.Len(); i++ { - sec, err := s.f.NewSection(s.name) - if err != nil { - return err - } - - err = sec.reflectFrom(slice.Index(i)) - if err != nil { - return fmt.Errorf("reflect from %dth field: %v", i, err) - } - } - - return nil - } - - if typ.Kind() == reflect.Ptr { - val = val.Elem() - } else { - return errors.New("not a pointer to a struct") - } - - return s.reflectFrom(val) -} - -// ReflectFrom reflects file from given struct. -func (f *File) ReflectFrom(v interface{}) error { - return f.Section("").ReflectFrom(v) -} - -// ReflectFromWithMapper reflects data sources from given struct with name mapper. -func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error { - cfg.NameMapper = mapper - return cfg.ReflectFrom(v) -} - -// ReflectFrom reflects data sources from given struct. -func ReflectFrom(cfg *File, v interface{}) error { - return ReflectFromWithMapper(cfg, v, nil) -} diff --git a/vendor/gopkg.in/yaml.v2/.travis.yml b/vendor/gopkg.in/yaml.v2/.travis.yml deleted file mode 100644 index 055480b9e..000000000 --- a/vendor/gopkg.in/yaml.v2/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go - -go: - - "1.4.x" - - "1.5.x" - - "1.6.x" - - "1.7.x" - - "1.8.x" - - "1.9.x" - - "1.10.x" - - "1.11.x" - - "1.12.x" - - "1.13.x" - - "tip" - -go_import_path: gopkg.in/yaml.v2 diff --git a/vendor/gopkg.in/yaml.v2/LICENSE b/vendor/gopkg.in/yaml.v2/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/gopkg.in/yaml.v2/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/gopkg.in/yaml.v2/LICENSE.libyaml b/vendor/gopkg.in/yaml.v2/LICENSE.libyaml deleted file mode 100644 index 8da58fbf6..000000000 --- a/vendor/gopkg.in/yaml.v2/LICENSE.libyaml +++ /dev/null @@ -1,31 +0,0 @@ -The following files were ported to Go from C files of libyaml, and thus -are still covered by their original copyright and license: - - apic.go - emitterc.go - parserc.go - readerc.go - scannerc.go - writerc.go - yamlh.go - yamlprivateh.go - -Copyright (c) 2006 Kirill Simonov - -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/gopkg.in/yaml.v2/NOTICE b/vendor/gopkg.in/yaml.v2/NOTICE deleted file mode 100644 index 866d74a7a..000000000 --- a/vendor/gopkg.in/yaml.v2/NOTICE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2011-2016 Canonical Ltd. - -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/gopkg.in/yaml.v2/README.md b/vendor/gopkg.in/yaml.v2/README.md deleted file mode 100644 index b50c6e877..000000000 --- a/vendor/gopkg.in/yaml.v2/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# YAML support for the Go language - -Introduction ------------- - -The yaml package enables Go programs to comfortably encode and decode YAML -values. It was developed within [Canonical](https://www.canonical.com) as -part of the [juju](https://juju.ubuntu.com) project, and is based on a -pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) -C library to parse and generate YAML data quickly and reliably. - -Compatibility -------------- - -The yaml package supports most of YAML 1.1 and 1.2, including support for -anchors, tags, map merging, etc. Multi-document unmarshalling is not yet -implemented, and base-60 floats from YAML 1.1 are purposefully not -supported since they're a poor design and are gone in YAML 1.2. - -Installation and usage ----------------------- - -The import path for the package is *gopkg.in/yaml.v2*. - -To install it, run: - - go get gopkg.in/yaml.v2 - -API documentation ------------------ - -If opened in a browser, the import path itself leads to the API documentation: - - * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) - -API stability -------------- - -The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). - - -License -------- - -The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. - - -Example -------- - -```Go -package main - -import ( - "fmt" - "log" - - "gopkg.in/yaml.v2" -) - -var data = ` -a: Easy! -b: - c: 2 - d: [3, 4] -` - -// Note: struct fields must be public in order for unmarshal to -// correctly populate the data. -type T struct { - A string - B struct { - RenamedC int `yaml:"c"` - D []int `yaml:",flow"` - } -} - -func main() { - t := T{} - - err := yaml.Unmarshal([]byte(data), &t) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- t:\n%v\n\n", t) - - d, err := yaml.Marshal(&t) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- t dump:\n%s\n\n", string(d)) - - m := make(map[interface{}]interface{}) - - err = yaml.Unmarshal([]byte(data), &m) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- m:\n%v\n\n", m) - - d, err = yaml.Marshal(&m) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- m dump:\n%s\n\n", string(d)) -} -``` - -This example will generate the following output: - -``` ---- t: -{Easy! {2 [3 4]}} - ---- t dump: -a: Easy! -b: - c: 2 - d: [3, 4] - - ---- m: -map[a:Easy! b:map[c:2 d:[3 4]]] - ---- m dump: -a: Easy! -b: - c: 2 - d: - - 3 - - 4 -``` - diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go deleted file mode 100644 index d2c2308f1..000000000 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ /dev/null @@ -1,740 +0,0 @@ -package yaml - -import ( - "io" -) - -func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { - //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) - - // Check if we can move the queue at the beginning of the buffer. - if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { - if parser.tokens_head != len(parser.tokens) { - copy(parser.tokens, parser.tokens[parser.tokens_head:]) - } - parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] - parser.tokens_head = 0 - } - parser.tokens = append(parser.tokens, *token) - if pos < 0 { - return - } - copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) - parser.tokens[parser.tokens_head+pos] = *token -} - -// Create a new parser object. -func yaml_parser_initialize(parser *yaml_parser_t) bool { - *parser = yaml_parser_t{ - raw_buffer: make([]byte, 0, input_raw_buffer_size), - buffer: make([]byte, 0, input_buffer_size), - } - return true -} - -// Destroy a parser object. -func yaml_parser_delete(parser *yaml_parser_t) { - *parser = yaml_parser_t{} -} - -// String read handler. -func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - if parser.input_pos == len(parser.input) { - return 0, io.EOF - } - n = copy(buffer, parser.input[parser.input_pos:]) - parser.input_pos += n - return n, nil -} - -// Reader read handler. -func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - return parser.input_reader.Read(buffer) -} - -// Set a string input. -func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { - if parser.read_handler != nil { - panic("must set the input source only once") - } - parser.read_handler = yaml_string_read_handler - parser.input = input - parser.input_pos = 0 -} - -// Set a file input. -func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { - if parser.read_handler != nil { - panic("must set the input source only once") - } - parser.read_handler = yaml_reader_read_handler - parser.input_reader = r -} - -// Set the source encoding. -func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { - if parser.encoding != yaml_ANY_ENCODING { - panic("must set the encoding only once") - } - parser.encoding = encoding -} - -// Create a new emitter object. -func yaml_emitter_initialize(emitter *yaml_emitter_t) { - *emitter = yaml_emitter_t{ - buffer: make([]byte, output_buffer_size), - raw_buffer: make([]byte, 0, output_raw_buffer_size), - states: make([]yaml_emitter_state_t, 0, initial_stack_size), - events: make([]yaml_event_t, 0, initial_queue_size), - best_width: -1, - } -} - -// Destroy an emitter object. -func yaml_emitter_delete(emitter *yaml_emitter_t) { - *emitter = yaml_emitter_t{} -} - -// String write handler. -func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - *emitter.output_buffer = append(*emitter.output_buffer, buffer...) - return nil -} - -// yaml_writer_write_handler uses emitter.output_writer to write the -// emitted text. -func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - _, err := emitter.output_writer.Write(buffer) - return err -} - -// Set a string output. -func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { - if emitter.write_handler != nil { - panic("must set the output target only once") - } - emitter.write_handler = yaml_string_write_handler - emitter.output_buffer = output_buffer -} - -// Set a file output. -func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { - if emitter.write_handler != nil { - panic("must set the output target only once") - } - emitter.write_handler = yaml_writer_write_handler - emitter.output_writer = w -} - -// Set the output encoding. -func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { - if emitter.encoding != yaml_ANY_ENCODING { - panic("must set the output encoding only once") - } - emitter.encoding = encoding -} - -// Set the canonical output style. -func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { - emitter.canonical = canonical -} - -//// Set the indentation increment. -func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { - if indent < 2 || indent > 9 { - indent = 2 - } - emitter.best_indent = indent -} - -// Set the preferred line width. -func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { - if width < 0 { - width = -1 - } - emitter.best_width = width -} - -// Set if unescaped non-ASCII characters are allowed. -func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { - emitter.unicode = unicode -} - -// Set the preferred line break character. -func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { - emitter.line_break = line_break -} - -///* -// * Destroy a token object. -// */ -// -//YAML_DECLARE(void) -//yaml_token_delete(yaml_token_t *token) -//{ -// assert(token); // Non-NULL token object expected. -// -// switch (token.type) -// { -// case YAML_TAG_DIRECTIVE_TOKEN: -// yaml_free(token.data.tag_directive.handle); -// yaml_free(token.data.tag_directive.prefix); -// break; -// -// case YAML_ALIAS_TOKEN: -// yaml_free(token.data.alias.value); -// break; -// -// case YAML_ANCHOR_TOKEN: -// yaml_free(token.data.anchor.value); -// break; -// -// case YAML_TAG_TOKEN: -// yaml_free(token.data.tag.handle); -// yaml_free(token.data.tag.suffix); -// break; -// -// case YAML_SCALAR_TOKEN: -// yaml_free(token.data.scalar.value); -// break; -// -// default: -// break; -// } -// -// memset(token, 0, sizeof(yaml_token_t)); -//} -// -///* -// * Check if a string is a valid UTF-8 sequence. -// * -// * Check 'reader.c' for more details on UTF-8 encoding. -// */ -// -//static int -//yaml_check_utf8(yaml_char_t *start, size_t length) -//{ -// yaml_char_t *end = start+length; -// yaml_char_t *pointer = start; -// -// while (pointer < end) { -// unsigned char octet; -// unsigned int width; -// unsigned int value; -// size_t k; -// -// octet = pointer[0]; -// width = (octet & 0x80) == 0x00 ? 1 : -// (octet & 0xE0) == 0xC0 ? 2 : -// (octet & 0xF0) == 0xE0 ? 3 : -// (octet & 0xF8) == 0xF0 ? 4 : 0; -// value = (octet & 0x80) == 0x00 ? octet & 0x7F : -// (octet & 0xE0) == 0xC0 ? octet & 0x1F : -// (octet & 0xF0) == 0xE0 ? octet & 0x0F : -// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; -// if (!width) return 0; -// if (pointer+width > end) return 0; -// for (k = 1; k < width; k ++) { -// octet = pointer[k]; -// if ((octet & 0xC0) != 0x80) return 0; -// value = (value << 6) + (octet & 0x3F); -// } -// if (!((width == 1) || -// (width == 2 && value >= 0x80) || -// (width == 3 && value >= 0x800) || -// (width == 4 && value >= 0x10000))) return 0; -// -// pointer += width; -// } -// -// return 1; -//} -// - -// Create STREAM-START. -func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { - *event = yaml_event_t{ - typ: yaml_STREAM_START_EVENT, - encoding: encoding, - } -} - -// Create STREAM-END. -func yaml_stream_end_event_initialize(event *yaml_event_t) { - *event = yaml_event_t{ - typ: yaml_STREAM_END_EVENT, - } -} - -// Create DOCUMENT-START. -func yaml_document_start_event_initialize( - event *yaml_event_t, - version_directive *yaml_version_directive_t, - tag_directives []yaml_tag_directive_t, - implicit bool, -) { - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - version_directive: version_directive, - tag_directives: tag_directives, - implicit: implicit, - } -} - -// Create DOCUMENT-END. -func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { - *event = yaml_event_t{ - typ: yaml_DOCUMENT_END_EVENT, - implicit: implicit, - } -} - -///* -// * Create ALIAS. -// */ -// -//YAML_DECLARE(int) -//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t) -//{ -// mark yaml_mark_t = { 0, 0, 0 } -// anchor_copy *yaml_char_t = NULL -// -// assert(event) // Non-NULL event object is expected. -// assert(anchor) // Non-NULL anchor is expected. -// -// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0 -// -// anchor_copy = yaml_strdup(anchor) -// if (!anchor_copy) -// return 0 -// -// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark) -// -// return 1 -//} - -// Create SCALAR. -func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - anchor: anchor, - tag: tag, - value: value, - implicit: plain_implicit, - quoted_implicit: quoted_implicit, - style: yaml_style_t(style), - } - return true -} - -// Create SEQUENCE-START. -func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(style), - } - return true -} - -// Create SEQUENCE-END. -func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - } - return true -} - -// Create MAPPING-START. -func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(style), - } -} - -// Create MAPPING-END. -func yaml_mapping_end_event_initialize(event *yaml_event_t) { - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - } -} - -// Destroy an event object. -func yaml_event_delete(event *yaml_event_t) { - *event = yaml_event_t{} -} - -///* -// * Create a document object. -// */ -// -//YAML_DECLARE(int) -//yaml_document_initialize(document *yaml_document_t, -// version_directive *yaml_version_directive_t, -// tag_directives_start *yaml_tag_directive_t, -// tag_directives_end *yaml_tag_directive_t, -// start_implicit int, end_implicit int) -//{ -// struct { -// error yaml_error_type_t -// } context -// struct { -// start *yaml_node_t -// end *yaml_node_t -// top *yaml_node_t -// } nodes = { NULL, NULL, NULL } -// version_directive_copy *yaml_version_directive_t = NULL -// struct { -// start *yaml_tag_directive_t -// end *yaml_tag_directive_t -// top *yaml_tag_directive_t -// } tag_directives_copy = { NULL, NULL, NULL } -// value yaml_tag_directive_t = { NULL, NULL } -// mark yaml_mark_t = { 0, 0, 0 } -// -// assert(document) // Non-NULL document object is expected. -// assert((tag_directives_start && tag_directives_end) || -// (tag_directives_start == tag_directives_end)) -// // Valid tag directives are expected. -// -// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error -// -// if (version_directive) { -// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) -// if (!version_directive_copy) goto error -// version_directive_copy.major = version_directive.major -// version_directive_copy.minor = version_directive.minor -// } -// -// if (tag_directives_start != tag_directives_end) { -// tag_directive *yaml_tag_directive_t -// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) -// goto error -// for (tag_directive = tag_directives_start -// tag_directive != tag_directives_end; tag_directive ++) { -// assert(tag_directive.handle) -// assert(tag_directive.prefix) -// if (!yaml_check_utf8(tag_directive.handle, -// strlen((char *)tag_directive.handle))) -// goto error -// if (!yaml_check_utf8(tag_directive.prefix, -// strlen((char *)tag_directive.prefix))) -// goto error -// value.handle = yaml_strdup(tag_directive.handle) -// value.prefix = yaml_strdup(tag_directive.prefix) -// if (!value.handle || !value.prefix) goto error -// if (!PUSH(&context, tag_directives_copy, value)) -// goto error -// value.handle = NULL -// value.prefix = NULL -// } -// } -// -// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, -// tag_directives_copy.start, tag_directives_copy.top, -// start_implicit, end_implicit, mark, mark) -// -// return 1 -// -//error: -// STACK_DEL(&context, nodes) -// yaml_free(version_directive_copy) -// while (!STACK_EMPTY(&context, tag_directives_copy)) { -// value yaml_tag_directive_t = POP(&context, tag_directives_copy) -// yaml_free(value.handle) -// yaml_free(value.prefix) -// } -// STACK_DEL(&context, tag_directives_copy) -// yaml_free(value.handle) -// yaml_free(value.prefix) -// -// return 0 -//} -// -///* -// * Destroy a document object. -// */ -// -//YAML_DECLARE(void) -//yaml_document_delete(document *yaml_document_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// tag_directive *yaml_tag_directive_t -// -// context.error = YAML_NO_ERROR // Eliminate a compiler warning. -// -// assert(document) // Non-NULL document object is expected. -// -// while (!STACK_EMPTY(&context, document.nodes)) { -// node yaml_node_t = POP(&context, document.nodes) -// yaml_free(node.tag) -// switch (node.type) { -// case YAML_SCALAR_NODE: -// yaml_free(node.data.scalar.value) -// break -// case YAML_SEQUENCE_NODE: -// STACK_DEL(&context, node.data.sequence.items) -// break -// case YAML_MAPPING_NODE: -// STACK_DEL(&context, node.data.mapping.pairs) -// break -// default: -// assert(0) // Should not happen. -// } -// } -// STACK_DEL(&context, document.nodes) -// -// yaml_free(document.version_directive) -// for (tag_directive = document.tag_directives.start -// tag_directive != document.tag_directives.end -// tag_directive++) { -// yaml_free(tag_directive.handle) -// yaml_free(tag_directive.prefix) -// } -// yaml_free(document.tag_directives.start) -// -// memset(document, 0, sizeof(yaml_document_t)) -//} -// -///** -// * Get a document node. -// */ -// -//YAML_DECLARE(yaml_node_t *) -//yaml_document_get_node(document *yaml_document_t, index int) -//{ -// assert(document) // Non-NULL document object is expected. -// -// if (index > 0 && document.nodes.start + index <= document.nodes.top) { -// return document.nodes.start + index - 1 -// } -// return NULL -//} -// -///** -// * Get the root object. -// */ -// -//YAML_DECLARE(yaml_node_t *) -//yaml_document_get_root_node(document *yaml_document_t) -//{ -// assert(document) // Non-NULL document object is expected. -// -// if (document.nodes.top != document.nodes.start) { -// return document.nodes.start -// } -// return NULL -//} -// -///* -// * Add a scalar node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_scalar(document *yaml_document_t, -// tag *yaml_char_t, value *yaml_char_t, length int, -// style yaml_scalar_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// value_copy *yaml_char_t = NULL -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// assert(value) // Non-NULL value is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (length < 0) { -// length = strlen((char *)value) -// } -// -// if (!yaml_check_utf8(value, length)) goto error -// value_copy = yaml_malloc(length+1) -// if (!value_copy) goto error -// memcpy(value_copy, value, length) -// value_copy[length] = '\0' -// -// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// yaml_free(tag_copy) -// yaml_free(value_copy) -// -// return 0 -//} -// -///* -// * Add a sequence node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_sequence(document *yaml_document_t, -// tag *yaml_char_t, style yaml_sequence_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// struct { -// start *yaml_node_item_t -// end *yaml_node_item_t -// top *yaml_node_item_t -// } items = { NULL, NULL, NULL } -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error -// -// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, -// style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// STACK_DEL(&context, items) -// yaml_free(tag_copy) -// -// return 0 -//} -// -///* -// * Add a mapping node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_mapping(document *yaml_document_t, -// tag *yaml_char_t, style yaml_mapping_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// struct { -// start *yaml_node_pair_t -// end *yaml_node_pair_t -// top *yaml_node_pair_t -// } pairs = { NULL, NULL, NULL } -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error -// -// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, -// style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// STACK_DEL(&context, pairs) -// yaml_free(tag_copy) -// -// return 0 -//} -// -///* -// * Append an item to a sequence node. -// */ -// -//YAML_DECLARE(int) -//yaml_document_append_sequence_item(document *yaml_document_t, -// sequence int, item int) -//{ -// struct { -// error yaml_error_type_t -// } context -// -// assert(document) // Non-NULL document is required. -// assert(sequence > 0 -// && document.nodes.start + sequence <= document.nodes.top) -// // Valid sequence id is required. -// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) -// // A sequence node is required. -// assert(item > 0 && document.nodes.start + item <= document.nodes.top) -// // Valid item id is required. -// -// if (!PUSH(&context, -// document.nodes.start[sequence-1].data.sequence.items, item)) -// return 0 -// -// return 1 -//} -// -///* -// * Append a pair of a key and a value to a mapping node. -// */ -// -//YAML_DECLARE(int) -//yaml_document_append_mapping_pair(document *yaml_document_t, -// mapping int, key int, value int) -//{ -// struct { -// error yaml_error_type_t -// } context -// -// pair yaml_node_pair_t -// -// assert(document) // Non-NULL document is required. -// assert(mapping > 0 -// && document.nodes.start + mapping <= document.nodes.top) -// // Valid mapping id is required. -// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) -// // A mapping node is required. -// assert(key > 0 && document.nodes.start + key <= document.nodes.top) -// // Valid key id is required. -// assert(value > 0 && document.nodes.start + value <= document.nodes.top) -// // Valid value id is required. -// -// pair.key = key -// pair.value = value -// -// if (!PUSH(&context, -// document.nodes.start[mapping-1].data.mapping.pairs, pair)) -// return 0 -// -// return 1 -//} -// -// diff --git a/vendor/gopkg.in/yaml.v2/decode.go b/vendor/gopkg.in/yaml.v2/decode.go deleted file mode 100644 index 129bc2a97..000000000 --- a/vendor/gopkg.in/yaml.v2/decode.go +++ /dev/null @@ -1,815 +0,0 @@ -package yaml - -import ( - "encoding" - "encoding/base64" - "fmt" - "io" - "math" - "reflect" - "strconv" - "time" -) - -const ( - documentNode = 1 << iota - mappingNode - sequenceNode - scalarNode - aliasNode -) - -type node struct { - kind int - line, column int - tag string - // For an alias node, alias holds the resolved alias. - alias *node - value string - implicit bool - children []*node - anchors map[string]*node -} - -// ---------------------------------------------------------------------------- -// Parser, produces a node tree out of a libyaml event stream. - -type parser struct { - parser yaml_parser_t - event yaml_event_t - doc *node - doneInit bool -} - -func newParser(b []byte) *parser { - p := parser{} - if !yaml_parser_initialize(&p.parser) { - panic("failed to initialize YAML emitter") - } - if len(b) == 0 { - b = []byte{'\n'} - } - yaml_parser_set_input_string(&p.parser, b) - return &p -} - -func newParserFromReader(r io.Reader) *parser { - p := parser{} - if !yaml_parser_initialize(&p.parser) { - panic("failed to initialize YAML emitter") - } - yaml_parser_set_input_reader(&p.parser, r) - return &p -} - -func (p *parser) init() { - if p.doneInit { - return - } - p.expect(yaml_STREAM_START_EVENT) - p.doneInit = true -} - -func (p *parser) destroy() { - if p.event.typ != yaml_NO_EVENT { - yaml_event_delete(&p.event) - } - yaml_parser_delete(&p.parser) -} - -// expect consumes an event from the event stream and -// checks that it's of the expected type. -func (p *parser) expect(e yaml_event_type_t) { - if p.event.typ == yaml_NO_EVENT { - if !yaml_parser_parse(&p.parser, &p.event) { - p.fail() - } - } - if p.event.typ == yaml_STREAM_END_EVENT { - failf("attempted to go past the end of stream; corrupted value?") - } - if p.event.typ != e { - p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) - p.fail() - } - yaml_event_delete(&p.event) - p.event.typ = yaml_NO_EVENT -} - -// peek peeks at the next event in the event stream, -// puts the results into p.event and returns the event type. -func (p *parser) peek() yaml_event_type_t { - if p.event.typ != yaml_NO_EVENT { - return p.event.typ - } - if !yaml_parser_parse(&p.parser, &p.event) { - p.fail() - } - return p.event.typ -} - -func (p *parser) fail() { - var where string - var line int - if p.parser.problem_mark.line != 0 { - line = p.parser.problem_mark.line - // Scanner errors don't iterate line before returning error - if p.parser.error == yaml_SCANNER_ERROR { - line++ - } - } else if p.parser.context_mark.line != 0 { - line = p.parser.context_mark.line - } - if line != 0 { - where = "line " + strconv.Itoa(line) + ": " - } - var msg string - if len(p.parser.problem) > 0 { - msg = p.parser.problem - } else { - msg = "unknown problem parsing YAML content" - } - failf("%s%s", where, msg) -} - -func (p *parser) anchor(n *node, anchor []byte) { - if anchor != nil { - p.doc.anchors[string(anchor)] = n - } -} - -func (p *parser) parse() *node { - p.init() - switch p.peek() { - case yaml_SCALAR_EVENT: - return p.scalar() - case yaml_ALIAS_EVENT: - return p.alias() - case yaml_MAPPING_START_EVENT: - return p.mapping() - case yaml_SEQUENCE_START_EVENT: - return p.sequence() - case yaml_DOCUMENT_START_EVENT: - return p.document() - case yaml_STREAM_END_EVENT: - // Happens when attempting to decode an empty buffer. - return nil - default: - panic("attempted to parse unknown event: " + p.event.typ.String()) - } -} - -func (p *parser) node(kind int) *node { - return &node{ - kind: kind, - line: p.event.start_mark.line, - column: p.event.start_mark.column, - } -} - -func (p *parser) document() *node { - n := p.node(documentNode) - n.anchors = make(map[string]*node) - p.doc = n - p.expect(yaml_DOCUMENT_START_EVENT) - n.children = append(n.children, p.parse()) - p.expect(yaml_DOCUMENT_END_EVENT) - return n -} - -func (p *parser) alias() *node { - n := p.node(aliasNode) - n.value = string(p.event.anchor) - n.alias = p.doc.anchors[n.value] - if n.alias == nil { - failf("unknown anchor '%s' referenced", n.value) - } - p.expect(yaml_ALIAS_EVENT) - return n -} - -func (p *parser) scalar() *node { - n := p.node(scalarNode) - n.value = string(p.event.value) - n.tag = string(p.event.tag) - n.implicit = p.event.implicit - p.anchor(n, p.event.anchor) - p.expect(yaml_SCALAR_EVENT) - return n -} - -func (p *parser) sequence() *node { - n := p.node(sequenceNode) - p.anchor(n, p.event.anchor) - p.expect(yaml_SEQUENCE_START_EVENT) - for p.peek() != yaml_SEQUENCE_END_EVENT { - n.children = append(n.children, p.parse()) - } - p.expect(yaml_SEQUENCE_END_EVENT) - return n -} - -func (p *parser) mapping() *node { - n := p.node(mappingNode) - p.anchor(n, p.event.anchor) - p.expect(yaml_MAPPING_START_EVENT) - for p.peek() != yaml_MAPPING_END_EVENT { - n.children = append(n.children, p.parse(), p.parse()) - } - p.expect(yaml_MAPPING_END_EVENT) - return n -} - -// ---------------------------------------------------------------------------- -// Decoder, unmarshals a node into a provided value. - -type decoder struct { - doc *node - aliases map[*node]bool - mapType reflect.Type - terrors []string - strict bool - - decodeCount int - aliasCount int - aliasDepth int -} - -var ( - mapItemType = reflect.TypeOf(MapItem{}) - durationType = reflect.TypeOf(time.Duration(0)) - defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) - ifaceType = defaultMapType.Elem() - timeType = reflect.TypeOf(time.Time{}) - ptrTimeType = reflect.TypeOf(&time.Time{}) -) - -func newDecoder(strict bool) *decoder { - d := &decoder{mapType: defaultMapType, strict: strict} - d.aliases = make(map[*node]bool) - return d -} - -func (d *decoder) terror(n *node, tag string, out reflect.Value) { - if n.tag != "" { - tag = n.tag - } - value := n.value - if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG { - if len(value) > 10 { - value = " `" + value[:7] + "...`" - } else { - value = " `" + value + "`" - } - } - d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type())) -} - -func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) { - terrlen := len(d.terrors) - err := u.UnmarshalYAML(func(v interface{}) (err error) { - defer handleErr(&err) - d.unmarshal(n, reflect.ValueOf(v)) - if len(d.terrors) > terrlen { - issues := d.terrors[terrlen:] - d.terrors = d.terrors[:terrlen] - return &TypeError{issues} - } - return nil - }) - if e, ok := err.(*TypeError); ok { - d.terrors = append(d.terrors, e.Errors...) - return false - } - if err != nil { - fail(err) - } - return true -} - -// d.prepare initializes and dereferences pointers and calls UnmarshalYAML -// if a value is found to implement it. -// It returns the initialized and dereferenced out value, whether -// unmarshalling was already done by UnmarshalYAML, and if so whether -// its types unmarshalled appropriately. -// -// If n holds a null value, prepare returns before doing anything. -func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { - if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) { - return out, false, false - } - again := true - for again { - again = false - if out.Kind() == reflect.Ptr { - if out.IsNil() { - out.Set(reflect.New(out.Type().Elem())) - } - out = out.Elem() - again = true - } - if out.CanAddr() { - if u, ok := out.Addr().Interface().(Unmarshaler); ok { - good = d.callUnmarshaler(n, u) - return out, true, good - } - } - } - return out, false, false -} - -const ( - // 400,000 decode operations is ~500kb of dense object declarations, or - // ~5kb of dense object declarations with 10000% alias expansion - alias_ratio_range_low = 400000 - - // 4,000,000 decode operations is ~5MB of dense object declarations, or - // ~4.5MB of dense object declarations with 10% alias expansion - alias_ratio_range_high = 4000000 - - // alias_ratio_range is the range over which we scale allowed alias ratios - alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) -) - -func allowedAliasRatio(decodeCount int) float64 { - switch { - case decodeCount <= alias_ratio_range_low: - // allow 99% to come from alias expansion for small-to-medium documents - return 0.99 - case decodeCount >= alias_ratio_range_high: - // allow 10% to come from alias expansion for very large documents - return 0.10 - default: - // scale smoothly from 99% down to 10% over the range. - // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. - // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). - return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) - } -} - -func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { - d.decodeCount++ - if d.aliasDepth > 0 { - d.aliasCount++ - } - if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { - failf("document contains excessive aliasing") - } - switch n.kind { - case documentNode: - return d.document(n, out) - case aliasNode: - return d.alias(n, out) - } - out, unmarshaled, good := d.prepare(n, out) - if unmarshaled { - return good - } - switch n.kind { - case scalarNode: - good = d.scalar(n, out) - case mappingNode: - good = d.mapping(n, out) - case sequenceNode: - good = d.sequence(n, out) - default: - panic("internal error: unknown node kind: " + strconv.Itoa(n.kind)) - } - return good -} - -func (d *decoder) document(n *node, out reflect.Value) (good bool) { - if len(n.children) == 1 { - d.doc = n - d.unmarshal(n.children[0], out) - return true - } - return false -} - -func (d *decoder) alias(n *node, out reflect.Value) (good bool) { - if d.aliases[n] { - // TODO this could actually be allowed in some circumstances. - failf("anchor '%s' value contains itself", n.value) - } - d.aliases[n] = true - d.aliasDepth++ - good = d.unmarshal(n.alias, out) - d.aliasDepth-- - delete(d.aliases, n) - return good -} - -var zeroValue reflect.Value - -func resetMap(out reflect.Value) { - for _, k := range out.MapKeys() { - out.SetMapIndex(k, zeroValue) - } -} - -func (d *decoder) scalar(n *node, out reflect.Value) bool { - var tag string - var resolved interface{} - if n.tag == "" && !n.implicit { - tag = yaml_STR_TAG - resolved = n.value - } else { - tag, resolved = resolve(n.tag, n.value) - if tag == yaml_BINARY_TAG { - data, err := base64.StdEncoding.DecodeString(resolved.(string)) - if err != nil { - failf("!!binary value contains invalid base64 data") - } - resolved = string(data) - } - } - if resolved == nil { - if out.Kind() == reflect.Map && !out.CanAddr() { - resetMap(out) - } else { - out.Set(reflect.Zero(out.Type())) - } - return true - } - if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { - // We've resolved to exactly the type we want, so use that. - out.Set(resolvedv) - return true - } - // Perhaps we can use the value as a TextUnmarshaler to - // set its value. - if out.CanAddr() { - u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) - if ok { - var text []byte - if tag == yaml_BINARY_TAG { - text = []byte(resolved.(string)) - } else { - // We let any value be unmarshaled into TextUnmarshaler. - // That might be more lax than we'd like, but the - // TextUnmarshaler itself should bowl out any dubious values. - text = []byte(n.value) - } - err := u.UnmarshalText(text) - if err != nil { - fail(err) - } - return true - } - } - switch out.Kind() { - case reflect.String: - if tag == yaml_BINARY_TAG { - out.SetString(resolved.(string)) - return true - } - if resolved != nil { - out.SetString(n.value) - return true - } - case reflect.Interface: - if resolved == nil { - out.Set(reflect.Zero(out.Type())) - } else if tag == yaml_TIMESTAMP_TAG { - // It looks like a timestamp but for backward compatibility - // reasons we set it as a string, so that code that unmarshals - // timestamp-like values into interface{} will continue to - // see a string and not a time.Time. - // TODO(v3) Drop this. - out.Set(reflect.ValueOf(n.value)) - } else { - out.Set(reflect.ValueOf(resolved)) - } - return true - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - switch resolved := resolved.(type) { - case int: - if !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - return true - } - case int64: - if !out.OverflowInt(resolved) { - out.SetInt(resolved) - return true - } - case uint64: - if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - return true - } - case float64: - if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - return true - } - case string: - if out.Type() == durationType { - d, err := time.ParseDuration(resolved) - if err == nil { - out.SetInt(int64(d)) - return true - } - } - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - switch resolved := resolved.(type) { - case int: - if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - case int64: - if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - case uint64: - if !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - case float64: - if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - } - case reflect.Bool: - switch resolved := resolved.(type) { - case bool: - out.SetBool(resolved) - return true - } - case reflect.Float32, reflect.Float64: - switch resolved := resolved.(type) { - case int: - out.SetFloat(float64(resolved)) - return true - case int64: - out.SetFloat(float64(resolved)) - return true - case uint64: - out.SetFloat(float64(resolved)) - return true - case float64: - out.SetFloat(resolved) - return true - } - case reflect.Struct: - if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { - out.Set(resolvedv) - return true - } - case reflect.Ptr: - if out.Type().Elem() == reflect.TypeOf(resolved) { - // TODO DOes this make sense? When is out a Ptr except when decoding a nil value? - elem := reflect.New(out.Type().Elem()) - elem.Elem().Set(reflect.ValueOf(resolved)) - out.Set(elem) - return true - } - } - d.terror(n, tag, out) - return false -} - -func settableValueOf(i interface{}) reflect.Value { - v := reflect.ValueOf(i) - sv := reflect.New(v.Type()).Elem() - sv.Set(v) - return sv -} - -func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { - l := len(n.children) - - var iface reflect.Value - switch out.Kind() { - case reflect.Slice: - out.Set(reflect.MakeSlice(out.Type(), l, l)) - case reflect.Array: - if l != out.Len() { - failf("invalid array: want %d elements but got %d", out.Len(), l) - } - case reflect.Interface: - // No type hints. Will have to use a generic sequence. - iface = out - out = settableValueOf(make([]interface{}, l)) - default: - d.terror(n, yaml_SEQ_TAG, out) - return false - } - et := out.Type().Elem() - - j := 0 - for i := 0; i < l; i++ { - e := reflect.New(et).Elem() - if ok := d.unmarshal(n.children[i], e); ok { - out.Index(j).Set(e) - j++ - } - } - if out.Kind() != reflect.Array { - out.Set(out.Slice(0, j)) - } - if iface.IsValid() { - iface.Set(out) - } - return true -} - -func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { - switch out.Kind() { - case reflect.Struct: - return d.mappingStruct(n, out) - case reflect.Slice: - return d.mappingSlice(n, out) - case reflect.Map: - // okay - case reflect.Interface: - if d.mapType.Kind() == reflect.Map { - iface := out - out = reflect.MakeMap(d.mapType) - iface.Set(out) - } else { - slicev := reflect.New(d.mapType).Elem() - if !d.mappingSlice(n, slicev) { - return false - } - out.Set(slicev) - return true - } - default: - d.terror(n, yaml_MAP_TAG, out) - return false - } - outt := out.Type() - kt := outt.Key() - et := outt.Elem() - - mapType := d.mapType - if outt.Key() == ifaceType && outt.Elem() == ifaceType { - d.mapType = outt - } - - if out.IsNil() { - out.Set(reflect.MakeMap(outt)) - } - l := len(n.children) - for i := 0; i < l; i += 2 { - if isMerge(n.children[i]) { - d.merge(n.children[i+1], out) - continue - } - k := reflect.New(kt).Elem() - if d.unmarshal(n.children[i], k) { - kkind := k.Kind() - if kkind == reflect.Interface { - kkind = k.Elem().Kind() - } - if kkind == reflect.Map || kkind == reflect.Slice { - failf("invalid map key: %#v", k.Interface()) - } - e := reflect.New(et).Elem() - if d.unmarshal(n.children[i+1], e) { - d.setMapIndex(n.children[i+1], out, k, e) - } - } - } - d.mapType = mapType - return true -} - -func (d *decoder) setMapIndex(n *node, out, k, v reflect.Value) { - if d.strict && out.MapIndex(k) != zeroValue { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: key %#v already set in map", n.line+1, k.Interface())) - return - } - out.SetMapIndex(k, v) -} - -func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) { - outt := out.Type() - if outt.Elem() != mapItemType { - d.terror(n, yaml_MAP_TAG, out) - return false - } - - mapType := d.mapType - d.mapType = outt - - var slice []MapItem - var l = len(n.children) - for i := 0; i < l; i += 2 { - if isMerge(n.children[i]) { - d.merge(n.children[i+1], out) - continue - } - item := MapItem{} - k := reflect.ValueOf(&item.Key).Elem() - if d.unmarshal(n.children[i], k) { - v := reflect.ValueOf(&item.Value).Elem() - if d.unmarshal(n.children[i+1], v) { - slice = append(slice, item) - } - } - } - out.Set(reflect.ValueOf(slice)) - d.mapType = mapType - return true -} - -func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { - sinfo, err := getStructInfo(out.Type()) - if err != nil { - panic(err) - } - name := settableValueOf("") - l := len(n.children) - - var inlineMap reflect.Value - var elemType reflect.Type - if sinfo.InlineMap != -1 { - inlineMap = out.Field(sinfo.InlineMap) - inlineMap.Set(reflect.New(inlineMap.Type()).Elem()) - elemType = inlineMap.Type().Elem() - } - - var doneFields []bool - if d.strict { - doneFields = make([]bool, len(sinfo.FieldsList)) - } - for i := 0; i < l; i += 2 { - ni := n.children[i] - if isMerge(ni) { - d.merge(n.children[i+1], out) - continue - } - if !d.unmarshal(ni, name) { - continue - } - if info, ok := sinfo.FieldsMap[name.String()]; ok { - if d.strict { - if doneFields[info.Id] { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.line+1, name.String(), out.Type())) - continue - } - doneFields[info.Id] = true - } - var field reflect.Value - if info.Inline == nil { - field = out.Field(info.Num) - } else { - field = out.FieldByIndex(info.Inline) - } - d.unmarshal(n.children[i+1], field) - } else if sinfo.InlineMap != -1 { - if inlineMap.IsNil() { - inlineMap.Set(reflect.MakeMap(inlineMap.Type())) - } - value := reflect.New(elemType).Elem() - d.unmarshal(n.children[i+1], value) - d.setMapIndex(n.children[i+1], inlineMap, name, value) - } else if d.strict { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.line+1, name.String(), out.Type())) - } - } - return true -} - -func failWantMap() { - failf("map merge requires map or sequence of maps as the value") -} - -func (d *decoder) merge(n *node, out reflect.Value) { - switch n.kind { - case mappingNode: - d.unmarshal(n, out) - case aliasNode: - if n.alias != nil && n.alias.kind != mappingNode { - failWantMap() - } - d.unmarshal(n, out) - case sequenceNode: - // Step backwards as earlier nodes take precedence. - for i := len(n.children) - 1; i >= 0; i-- { - ni := n.children[i] - if ni.kind == aliasNode { - if ni.alias != nil && ni.alias.kind != mappingNode { - failWantMap() - } - } else if ni.kind != mappingNode { - failWantMap() - } - d.unmarshal(ni, out) - } - default: - failWantMap() - } -} - -func isMerge(n *node) bool { - return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG) -} diff --git a/vendor/gopkg.in/yaml.v2/emitterc.go b/vendor/gopkg.in/yaml.v2/emitterc.go deleted file mode 100644 index a1c2cc526..000000000 --- a/vendor/gopkg.in/yaml.v2/emitterc.go +++ /dev/null @@ -1,1685 +0,0 @@ -package yaml - -import ( - "bytes" - "fmt" -) - -// Flush the buffer if needed. -func flush(emitter *yaml_emitter_t) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) { - return yaml_emitter_flush(emitter) - } - return true -} - -// Put a character to the output buffer. -func put(emitter *yaml_emitter_t, value byte) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - emitter.buffer[emitter.buffer_pos] = value - emitter.buffer_pos++ - emitter.column++ - return true -} - -// Put a line break to the output buffer. -func put_break(emitter *yaml_emitter_t) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - switch emitter.line_break { - case yaml_CR_BREAK: - emitter.buffer[emitter.buffer_pos] = '\r' - emitter.buffer_pos += 1 - case yaml_LN_BREAK: - emitter.buffer[emitter.buffer_pos] = '\n' - emitter.buffer_pos += 1 - case yaml_CRLN_BREAK: - emitter.buffer[emitter.buffer_pos+0] = '\r' - emitter.buffer[emitter.buffer_pos+1] = '\n' - emitter.buffer_pos += 2 - default: - panic("unknown line break setting") - } - emitter.column = 0 - emitter.line++ - return true -} - -// Copy a character from a string into buffer. -func write(emitter *yaml_emitter_t, s []byte, i *int) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - p := emitter.buffer_pos - w := width(s[*i]) - switch w { - case 4: - emitter.buffer[p+3] = s[*i+3] - fallthrough - case 3: - emitter.buffer[p+2] = s[*i+2] - fallthrough - case 2: - emitter.buffer[p+1] = s[*i+1] - fallthrough - case 1: - emitter.buffer[p+0] = s[*i+0] - default: - panic("unknown character width") - } - emitter.column++ - emitter.buffer_pos += w - *i += w - return true -} - -// Write a whole string into buffer. -func write_all(emitter *yaml_emitter_t, s []byte) bool { - for i := 0; i < len(s); { - if !write(emitter, s, &i) { - return false - } - } - return true -} - -// Copy a line break character from a string into buffer. -func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { - if s[*i] == '\n' { - if !put_break(emitter) { - return false - } - *i++ - } else { - if !write(emitter, s, i) { - return false - } - emitter.column = 0 - emitter.line++ - } - return true -} - -// Set an emitter error and return false. -func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_EMITTER_ERROR - emitter.problem = problem - return false -} - -// Emit an event. -func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { - emitter.events = append(emitter.events, *event) - for !yaml_emitter_need_more_events(emitter) { - event := &emitter.events[emitter.events_head] - if !yaml_emitter_analyze_event(emitter, event) { - return false - } - if !yaml_emitter_state_machine(emitter, event) { - return false - } - yaml_event_delete(event) - emitter.events_head++ - } - return true -} - -// Check if we need to accumulate more events before emitting. -// -// We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// -func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { - if emitter.events_head == len(emitter.events) { - return true - } - var accumulate int - switch emitter.events[emitter.events_head].typ { - case yaml_DOCUMENT_START_EVENT: - accumulate = 1 - break - case yaml_SEQUENCE_START_EVENT: - accumulate = 2 - break - case yaml_MAPPING_START_EVENT: - accumulate = 3 - break - default: - return false - } - if len(emitter.events)-emitter.events_head > accumulate { - return false - } - var level int - for i := emitter.events_head; i < len(emitter.events); i++ { - switch emitter.events[i].typ { - case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: - level++ - case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: - level-- - } - if level == 0 { - return false - } - } - return true -} - -// Append a directive to the directives stack. -func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { - for i := 0; i < len(emitter.tag_directives); i++ { - if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { - if allow_duplicates { - return true - } - return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") - } - } - - // [Go] Do we actually need to copy this given garbage collection - // and the lack of deallocating destructors? - tag_copy := yaml_tag_directive_t{ - handle: make([]byte, len(value.handle)), - prefix: make([]byte, len(value.prefix)), - } - copy(tag_copy.handle, value.handle) - copy(tag_copy.prefix, value.prefix) - emitter.tag_directives = append(emitter.tag_directives, tag_copy) - return true -} - -// Increase the indentation level. -func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { - emitter.indents = append(emitter.indents, emitter.indent) - if emitter.indent < 0 { - if flow { - emitter.indent = emitter.best_indent - } else { - emitter.indent = 0 - } - } else if !indentless { - emitter.indent += emitter.best_indent - } - return true -} - -// State dispatcher. -func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { - switch emitter.state { - default: - case yaml_EMIT_STREAM_START_STATE: - return yaml_emitter_emit_stream_start(emitter, event) - - case yaml_EMIT_FIRST_DOCUMENT_START_STATE: - return yaml_emitter_emit_document_start(emitter, event, true) - - case yaml_EMIT_DOCUMENT_START_STATE: - return yaml_emitter_emit_document_start(emitter, event, false) - - case yaml_EMIT_DOCUMENT_CONTENT_STATE: - return yaml_emitter_emit_document_content(emitter, event) - - case yaml_EMIT_DOCUMENT_END_STATE: - return yaml_emitter_emit_document_end(emitter, event) - - case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, true) - - case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, false) - - case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, true) - - case yaml_EMIT_FLOW_MAPPING_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, false) - - case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: - return yaml_emitter_emit_flow_mapping_value(emitter, event, true) - - case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: - return yaml_emitter_emit_flow_mapping_value(emitter, event, false) - - case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_block_sequence_item(emitter, event, true) - - case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_block_sequence_item(emitter, event, false) - - case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_block_mapping_key(emitter, event, true) - - case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: - return yaml_emitter_emit_block_mapping_key(emitter, event, false) - - case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: - return yaml_emitter_emit_block_mapping_value(emitter, event, true) - - case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: - return yaml_emitter_emit_block_mapping_value(emitter, event, false) - - case yaml_EMIT_END_STATE: - return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") - } - panic("invalid emitter state") -} - -// Expect STREAM-START. -func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if event.typ != yaml_STREAM_START_EVENT { - return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") - } - if emitter.encoding == yaml_ANY_ENCODING { - emitter.encoding = event.encoding - if emitter.encoding == yaml_ANY_ENCODING { - emitter.encoding = yaml_UTF8_ENCODING - } - } - if emitter.best_indent < 2 || emitter.best_indent > 9 { - emitter.best_indent = 2 - } - if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { - emitter.best_width = 80 - } - if emitter.best_width < 0 { - emitter.best_width = 1<<31 - 1 - } - if emitter.line_break == yaml_ANY_BREAK { - emitter.line_break = yaml_LN_BREAK - } - - emitter.indent = -1 - emitter.line = 0 - emitter.column = 0 - emitter.whitespace = true - emitter.indention = true - - if emitter.encoding != yaml_UTF8_ENCODING { - if !yaml_emitter_write_bom(emitter) { - return false - } - } - emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE - return true -} - -// Expect DOCUMENT-START or STREAM-END. -func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - - if event.typ == yaml_DOCUMENT_START_EVENT { - - if event.version_directive != nil { - if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { - return false - } - } - - for i := 0; i < len(event.tag_directives); i++ { - tag_directive := &event.tag_directives[i] - if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { - return false - } - if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { - return false - } - } - - for i := 0; i < len(default_tag_directives); i++ { - tag_directive := &default_tag_directives[i] - if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { - return false - } - } - - implicit := event.implicit - if !first || emitter.canonical { - implicit = false - } - - if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if event.version_directive != nil { - implicit = false - if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if len(event.tag_directives) > 0 { - implicit = false - for i := 0; i < len(event.tag_directives); i++ { - tag_directive := &event.tag_directives[i] - if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { - return false - } - if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { - return false - } - if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - - if yaml_emitter_check_empty_document(emitter) { - implicit = false - } - if !implicit { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { - return false - } - if emitter.canonical { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - - emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE - return true - } - - if event.typ == yaml_STREAM_END_EVENT { - if emitter.open_ended { - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_flush(emitter) { - return false - } - emitter.state = yaml_EMIT_END_STATE - return true - } - - return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") -} - -// Expect the root node. -func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { - emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) - return yaml_emitter_emit_node(emitter, event, true, false, false, false) -} - -// Expect DOCUMENT-END. -func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if event.typ != yaml_DOCUMENT_END_EVENT { - return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !event.implicit { - // [Go] Allocate the slice elsewhere. - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_flush(emitter) { - return false - } - emitter.state = yaml_EMIT_DOCUMENT_START_STATE - emitter.tag_directives = emitter.tag_directives[:0] - return true -} - -// Expect a flow item node. -func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - emitter.flow_level++ - } - - if event.typ == yaml_SEQUENCE_END_EVENT { - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.canonical && !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - - return true - } - - if !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) - return yaml_emitter_emit_node(emitter, event, false, true, false, false) -} - -// Expect a flow key node. -func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - emitter.flow_level++ - } - - if event.typ == yaml_MAPPING_END_EVENT { - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.canonical && !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - - if !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, true) - } - if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a flow value node. -func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { - if simple { - if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { - return false - } - } else { - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { - return false - } - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a block item node. -func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) { - return false - } - } - if event.typ == yaml_SEQUENCE_END_EVENT { - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) - return yaml_emitter_emit_node(emitter, event, false, true, false, false) -} - -// Expect a block key node. -func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_increase_indent(emitter, false, false) { - return false - } - } - if event.typ == yaml_MAPPING_END_EVENT { - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if yaml_emitter_check_simple_key(emitter) { - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, true) - } - if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a block value node. -func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { - if simple { - if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { - return false - } - } else { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { - return false - } - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a node. -func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, - root bool, sequence bool, mapping bool, simple_key bool) bool { - - emitter.root_context = root - emitter.sequence_context = sequence - emitter.mapping_context = mapping - emitter.simple_key_context = simple_key - - switch event.typ { - case yaml_ALIAS_EVENT: - return yaml_emitter_emit_alias(emitter, event) - case yaml_SCALAR_EVENT: - return yaml_emitter_emit_scalar(emitter, event) - case yaml_SEQUENCE_START_EVENT: - return yaml_emitter_emit_sequence_start(emitter, event) - case yaml_MAPPING_START_EVENT: - return yaml_emitter_emit_mapping_start(emitter, event) - default: - return yaml_emitter_set_emitter_error(emitter, - fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) - } -} - -// Expect ALIAS. -func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true -} - -// Expect SCALAR. -func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_select_scalar_style(emitter, event) { - return false - } - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - if !yaml_emitter_process_scalar(emitter) { - return false - } - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true -} - -// Expect SEQUENCE-START. -func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || - yaml_emitter_check_empty_sequence(emitter) { - emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE - } else { - emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE - } - return true -} - -// Expect MAPPING-START. -func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || - yaml_emitter_check_empty_mapping(emitter) { - emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE - } else { - emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE - } - return true -} - -// Check if the document content is an empty scalar. -func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { - return false // [Go] Huh? -} - -// Check if the next events represent an empty sequence. -func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { - if len(emitter.events)-emitter.events_head < 2 { - return false - } - return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && - emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT -} - -// Check if the next events represent an empty mapping. -func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { - if len(emitter.events)-emitter.events_head < 2 { - return false - } - return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && - emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT -} - -// Check if the next node can be expressed as a simple key. -func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { - length := 0 - switch emitter.events[emitter.events_head].typ { - case yaml_ALIAS_EVENT: - length += len(emitter.anchor_data.anchor) - case yaml_SCALAR_EVENT: - if emitter.scalar_data.multiline { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) + - len(emitter.scalar_data.value) - case yaml_SEQUENCE_START_EVENT: - if !yaml_emitter_check_empty_sequence(emitter) { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) - case yaml_MAPPING_START_EVENT: - if !yaml_emitter_check_empty_mapping(emitter) { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) - default: - return false - } - return length <= 128 -} - -// Determine an acceptable scalar style. -func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { - - no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 - if no_tag && !event.implicit && !event.quoted_implicit { - return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") - } - - style := event.scalar_style() - if style == yaml_ANY_SCALAR_STYLE { - style = yaml_PLAIN_SCALAR_STYLE - } - if emitter.canonical { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - if emitter.simple_key_context && emitter.scalar_data.multiline { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - - if style == yaml_PLAIN_SCALAR_STYLE { - if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || - emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - if no_tag && !event.implicit { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - } - if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { - if !emitter.scalar_data.single_quoted_allowed { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - } - if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { - if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - } - - if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { - emitter.tag_data.handle = []byte{'!'} - } - emitter.scalar_data.style = style - return true -} - -// Write an anchor. -func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { - if emitter.anchor_data.anchor == nil { - return true - } - c := []byte{'&'} - if emitter.anchor_data.alias { - c[0] = '*' - } - if !yaml_emitter_write_indicator(emitter, c, true, false, false) { - return false - } - return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) -} - -// Write a tag. -func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { - if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { - return true - } - if len(emitter.tag_data.handle) > 0 { - if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { - return false - } - if len(emitter.tag_data.suffix) > 0 { - if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { - return false - } - } - } else { - // [Go] Allocate these slices elsewhere. - if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { - return false - } - if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { - return false - } - } - return true -} - -// Write a scalar. -func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { - switch emitter.scalar_data.style { - case yaml_PLAIN_SCALAR_STYLE: - return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_SINGLE_QUOTED_SCALAR_STYLE: - return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_DOUBLE_QUOTED_SCALAR_STYLE: - return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_LITERAL_SCALAR_STYLE: - return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) - - case yaml_FOLDED_SCALAR_STYLE: - return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) - } - panic("unknown scalar style") -} - -// Check if a %YAML directive is valid. -func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { - if version_directive.major != 1 || version_directive.minor != 1 { - return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") - } - return true -} - -// Check if a %TAG directive is valid. -func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { - handle := tag_directive.handle - prefix := tag_directive.prefix - if len(handle) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") - } - if handle[0] != '!' { - return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") - } - if handle[len(handle)-1] != '!' { - return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") - } - for i := 1; i < len(handle)-1; i += width(handle[i]) { - if !is_alpha(handle, i) { - return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") - } - } - if len(prefix) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") - } - return true -} - -// Check if an anchor is valid. -func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { - if len(anchor) == 0 { - problem := "anchor value must not be empty" - if alias { - problem = "alias value must not be empty" - } - return yaml_emitter_set_emitter_error(emitter, problem) - } - for i := 0; i < len(anchor); i += width(anchor[i]) { - if !is_alpha(anchor, i) { - problem := "anchor value must contain alphanumerical characters only" - if alias { - problem = "alias value must contain alphanumerical characters only" - } - return yaml_emitter_set_emitter_error(emitter, problem) - } - } - emitter.anchor_data.anchor = anchor - emitter.anchor_data.alias = alias - return true -} - -// Check if a tag is valid. -func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { - if len(tag) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") - } - for i := 0; i < len(emitter.tag_directives); i++ { - tag_directive := &emitter.tag_directives[i] - if bytes.HasPrefix(tag, tag_directive.prefix) { - emitter.tag_data.handle = tag_directive.handle - emitter.tag_data.suffix = tag[len(tag_directive.prefix):] - return true - } - } - emitter.tag_data.suffix = tag - return true -} - -// Check if a scalar is valid. -func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { - var ( - block_indicators = false - flow_indicators = false - line_breaks = false - special_characters = false - - leading_space = false - leading_break = false - trailing_space = false - trailing_break = false - break_space = false - space_break = false - - preceded_by_whitespace = false - followed_by_whitespace = false - previous_space = false - previous_break = false - ) - - emitter.scalar_data.value = value - - if len(value) == 0 { - emitter.scalar_data.multiline = false - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = true - emitter.scalar_data.single_quoted_allowed = true - emitter.scalar_data.block_allowed = false - return true - } - - if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { - block_indicators = true - flow_indicators = true - } - - preceded_by_whitespace = true - for i, w := 0, 0; i < len(value); i += w { - w = width(value[i]) - followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) - - if i == 0 { - switch value[i] { - case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': - flow_indicators = true - block_indicators = true - case '?', ':': - flow_indicators = true - if followed_by_whitespace { - block_indicators = true - } - case '-': - if followed_by_whitespace { - flow_indicators = true - block_indicators = true - } - } - } else { - switch value[i] { - case ',', '?', '[', ']', '{', '}': - flow_indicators = true - case ':': - flow_indicators = true - if followed_by_whitespace { - block_indicators = true - } - case '#': - if preceded_by_whitespace { - flow_indicators = true - block_indicators = true - } - } - } - - if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { - special_characters = true - } - if is_space(value, i) { - if i == 0 { - leading_space = true - } - if i+width(value[i]) == len(value) { - trailing_space = true - } - if previous_break { - break_space = true - } - previous_space = true - previous_break = false - } else if is_break(value, i) { - line_breaks = true - if i == 0 { - leading_break = true - } - if i+width(value[i]) == len(value) { - trailing_break = true - } - if previous_space { - space_break = true - } - previous_space = false - previous_break = true - } else { - previous_space = false - previous_break = false - } - - // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. - preceded_by_whitespace = is_blankz(value, i) - } - - emitter.scalar_data.multiline = line_breaks - emitter.scalar_data.flow_plain_allowed = true - emitter.scalar_data.block_plain_allowed = true - emitter.scalar_data.single_quoted_allowed = true - emitter.scalar_data.block_allowed = true - - if leading_space || leading_break || trailing_space || trailing_break { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - } - if trailing_space { - emitter.scalar_data.block_allowed = false - } - if break_space { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - emitter.scalar_data.single_quoted_allowed = false - } - if space_break || special_characters { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - emitter.scalar_data.single_quoted_allowed = false - emitter.scalar_data.block_allowed = false - } - if line_breaks { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - } - if flow_indicators { - emitter.scalar_data.flow_plain_allowed = false - } - if block_indicators { - emitter.scalar_data.block_plain_allowed = false - } - return true -} - -// Check if the event data is valid. -func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { - - emitter.anchor_data.anchor = nil - emitter.tag_data.handle = nil - emitter.tag_data.suffix = nil - emitter.scalar_data.value = nil - - switch event.typ { - case yaml_ALIAS_EVENT: - if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { - return false - } - - case yaml_SCALAR_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - if !yaml_emitter_analyze_scalar(emitter, event.value) { - return false - } - - case yaml_SEQUENCE_START_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - - case yaml_MAPPING_START_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - } - return true -} - -// Write the BOM character. -func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { - if !flush(emitter) { - return false - } - pos := emitter.buffer_pos - emitter.buffer[pos+0] = '\xEF' - emitter.buffer[pos+1] = '\xBB' - emitter.buffer[pos+2] = '\xBF' - emitter.buffer_pos += 3 - return true -} - -func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { - indent := emitter.indent - if indent < 0 { - indent = 0 - } - if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { - if !put_break(emitter) { - return false - } - } - for emitter.column < indent { - if !put(emitter, ' ') { - return false - } - } - emitter.whitespace = true - emitter.indention = true - return true -} - -func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { - if need_whitespace && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !write_all(emitter, indicator) { - return false - } - emitter.whitespace = is_whitespace - emitter.indention = (emitter.indention && is_indention) - emitter.open_ended = false - return true -} - -func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { - if !write_all(emitter, value) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { - if !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !write_all(emitter, value) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { - if need_whitespace && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - for i := 0; i < len(value); { - var must_write bool - switch value[i] { - case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': - must_write = true - default: - must_write = is_alpha(value, i) - } - if must_write { - if !write(emitter, value, &i) { - return false - } - } else { - w := width(value[i]) - for k := 0; k < w; k++ { - octet := value[i] - i++ - if !put(emitter, '%') { - return false - } - - c := octet >> 4 - if c < 10 { - c += '0' - } else { - c += 'A' - 10 - } - if !put(emitter, c) { - return false - } - - c = octet & 0x0f - if c < 10 { - c += '0' - } else { - c += 'A' - 10 - } - if !put(emitter, c) { - return false - } - } - } - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - if !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - - spaces := false - breaks := false - for i := 0; i < len(value); { - if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - spaces = true - } else if is_break(value, i) { - if !breaks && value[i] == '\n' { - if !put_break(emitter) { - return false - } - } - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - spaces = false - breaks = false - } - } - - emitter.whitespace = false - emitter.indention = false - if emitter.root_context { - emitter.open_ended = true - } - - return true -} - -func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - - if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { - return false - } - - spaces := false - breaks := false - for i := 0; i < len(value); { - if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - spaces = true - } else if is_break(value, i) { - if !breaks && value[i] == '\n' { - if !put_break(emitter) { - return false - } - } - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if value[i] == '\'' { - if !put(emitter, '\'') { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - spaces = false - breaks = false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - spaces := false - if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { - return false - } - - for i := 0; i < len(value); { - if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || - is_bom(value, i) || is_break(value, i) || - value[i] == '"' || value[i] == '\\' { - - octet := value[i] - - var w int - var v rune - switch { - case octet&0x80 == 0x00: - w, v = 1, rune(octet&0x7F) - case octet&0xE0 == 0xC0: - w, v = 2, rune(octet&0x1F) - case octet&0xF0 == 0xE0: - w, v = 3, rune(octet&0x0F) - case octet&0xF8 == 0xF0: - w, v = 4, rune(octet&0x07) - } - for k := 1; k < w; k++ { - octet = value[i+k] - v = (v << 6) + (rune(octet) & 0x3F) - } - i += w - - if !put(emitter, '\\') { - return false - } - - var ok bool - switch v { - case 0x00: - ok = put(emitter, '0') - case 0x07: - ok = put(emitter, 'a') - case 0x08: - ok = put(emitter, 'b') - case 0x09: - ok = put(emitter, 't') - case 0x0A: - ok = put(emitter, 'n') - case 0x0b: - ok = put(emitter, 'v') - case 0x0c: - ok = put(emitter, 'f') - case 0x0d: - ok = put(emitter, 'r') - case 0x1b: - ok = put(emitter, 'e') - case 0x22: - ok = put(emitter, '"') - case 0x5c: - ok = put(emitter, '\\') - case 0x85: - ok = put(emitter, 'N') - case 0xA0: - ok = put(emitter, '_') - case 0x2028: - ok = put(emitter, 'L') - case 0x2029: - ok = put(emitter, 'P') - default: - if v <= 0xFF { - ok = put(emitter, 'x') - w = 2 - } else if v <= 0xFFFF { - ok = put(emitter, 'u') - w = 4 - } else { - ok = put(emitter, 'U') - w = 8 - } - for k := (w - 1) * 4; ok && k >= 0; k -= 4 { - digit := byte((v >> uint(k)) & 0x0F) - if digit < 10 { - ok = put(emitter, digit+'0') - } else { - ok = put(emitter, digit+'A'-10) - } - } - } - if !ok { - return false - } - spaces = false - } else if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { - if !yaml_emitter_write_indent(emitter) { - return false - } - if is_space(value, i+1) { - if !put(emitter, '\\') { - return false - } - } - i += width(value[i]) - } else if !write(emitter, value, &i) { - return false - } - spaces = true - } else { - if !write(emitter, value, &i) { - return false - } - spaces = false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { - if is_space(value, 0) || is_break(value, 0) { - indent_hint := []byte{'0' + byte(emitter.best_indent)} - if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { - return false - } - } - - emitter.open_ended = false - - var chomp_hint [1]byte - if len(value) == 0 { - chomp_hint[0] = '-' - } else { - i := len(value) - 1 - for value[i]&0xC0 == 0x80 { - i-- - } - if !is_break(value, i) { - chomp_hint[0] = '-' - } else if i == 0 { - chomp_hint[0] = '+' - emitter.open_ended = true - } else { - i-- - for value[i]&0xC0 == 0x80 { - i-- - } - if is_break(value, i) { - chomp_hint[0] = '+' - emitter.open_ended = true - } - } - } - if chomp_hint[0] != 0 { - if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { - return false - } - } - return true -} - -func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { - if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { - return false - } - if !yaml_emitter_write_block_scalar_hints(emitter, value) { - return false - } - if !put_break(emitter) { - return false - } - emitter.indention = true - emitter.whitespace = true - breaks := true - for i := 0; i < len(value); { - if is_break(value, i) { - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - breaks = false - } - } - - return true -} - -func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { - if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { - return false - } - if !yaml_emitter_write_block_scalar_hints(emitter, value) { - return false - } - - if !put_break(emitter) { - return false - } - emitter.indention = true - emitter.whitespace = true - - breaks := true - leading_spaces := true - for i := 0; i < len(value); { - if is_break(value, i) { - if !breaks && !leading_spaces && value[i] == '\n' { - k := 0 - for is_break(value, k) { - k += width(value[k]) - } - if !is_blankz(value, k) { - if !put_break(emitter) { - return false - } - } - } - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - leading_spaces = is_blank(value, i) - } - if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - emitter.indention = false - breaks = false - } - } - return true -} diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go deleted file mode 100644 index 0ee738e11..000000000 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ /dev/null @@ -1,390 +0,0 @@ -package yaml - -import ( - "encoding" - "fmt" - "io" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// jsonNumber is the interface of the encoding/json.Number datatype. -// Repeating the interface here avoids a dependency on encoding/json, and also -// supports other libraries like jsoniter, which use a similar datatype with -// the same interface. Detecting this interface is useful when dealing with -// structures containing json.Number, which is a string under the hood. The -// encoder should prefer the use of Int64(), Float64() and string(), in that -// order, when encoding this type. -type jsonNumber interface { - Float64() (float64, error) - Int64() (int64, error) - String() string -} - -type encoder struct { - emitter yaml_emitter_t - event yaml_event_t - out []byte - flow bool - // doneInit holds whether the initial stream_start_event has been - // emitted. - doneInit bool -} - -func newEncoder() *encoder { - e := &encoder{} - yaml_emitter_initialize(&e.emitter) - yaml_emitter_set_output_string(&e.emitter, &e.out) - yaml_emitter_set_unicode(&e.emitter, true) - return e -} - -func newEncoderWithWriter(w io.Writer) *encoder { - e := &encoder{} - yaml_emitter_initialize(&e.emitter) - yaml_emitter_set_output_writer(&e.emitter, w) - yaml_emitter_set_unicode(&e.emitter, true) - return e -} - -func (e *encoder) init() { - if e.doneInit { - return - } - yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) - e.emit() - e.doneInit = true -} - -func (e *encoder) finish() { - e.emitter.open_ended = false - yaml_stream_end_event_initialize(&e.event) - e.emit() -} - -func (e *encoder) destroy() { - yaml_emitter_delete(&e.emitter) -} - -func (e *encoder) emit() { - // This will internally delete the e.event value. - e.must(yaml_emitter_emit(&e.emitter, &e.event)) -} - -func (e *encoder) must(ok bool) { - if !ok { - msg := e.emitter.problem - if msg == "" { - msg = "unknown problem generating YAML content" - } - failf("%s", msg) - } -} - -func (e *encoder) marshalDoc(tag string, in reflect.Value) { - e.init() - yaml_document_start_event_initialize(&e.event, nil, nil, true) - e.emit() - e.marshal(tag, in) - yaml_document_end_event_initialize(&e.event, true) - e.emit() -} - -func (e *encoder) marshal(tag string, in reflect.Value) { - if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { - e.nilv() - return - } - iface := in.Interface() - switch m := iface.(type) { - case jsonNumber: - integer, err := m.Int64() - if err == nil { - // In this case the json.Number is a valid int64 - in = reflect.ValueOf(integer) - break - } - float, err := m.Float64() - if err == nil { - // In this case the json.Number is a valid float64 - in = reflect.ValueOf(float) - break - } - // fallback case - no number could be obtained - in = reflect.ValueOf(m.String()) - case time.Time, *time.Time: - // Although time.Time implements TextMarshaler, - // we don't want to treat it as a string for YAML - // purposes because YAML has special support for - // timestamps. - case Marshaler: - v, err := m.MarshalYAML() - if err != nil { - fail(err) - } - if v == nil { - e.nilv() - return - } - in = reflect.ValueOf(v) - case encoding.TextMarshaler: - text, err := m.MarshalText() - if err != nil { - fail(err) - } - in = reflect.ValueOf(string(text)) - case nil: - e.nilv() - return - } - switch in.Kind() { - case reflect.Interface: - e.marshal(tag, in.Elem()) - case reflect.Map: - e.mapv(tag, in) - case reflect.Ptr: - if in.Type() == ptrTimeType { - e.timev(tag, in.Elem()) - } else { - e.marshal(tag, in.Elem()) - } - case reflect.Struct: - if in.Type() == timeType { - e.timev(tag, in) - } else { - e.structv(tag, in) - } - case reflect.Slice, reflect.Array: - if in.Type().Elem() == mapItemType { - e.itemsv(tag, in) - } else { - e.slicev(tag, in) - } - case reflect.String: - e.stringv(tag, in) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - if in.Type() == durationType { - e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String())) - } else { - e.intv(tag, in) - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - e.uintv(tag, in) - case reflect.Float32, reflect.Float64: - e.floatv(tag, in) - case reflect.Bool: - e.boolv(tag, in) - default: - panic("cannot marshal type: " + in.Type().String()) - } -} - -func (e *encoder) mapv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - keys := keyList(in.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - e.marshal("", k) - e.marshal("", in.MapIndex(k)) - } - }) -} - -func (e *encoder) itemsv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem) - for _, item := range slice { - e.marshal("", reflect.ValueOf(item.Key)) - e.marshal("", reflect.ValueOf(item.Value)) - } - }) -} - -func (e *encoder) structv(tag string, in reflect.Value) { - sinfo, err := getStructInfo(in.Type()) - if err != nil { - panic(err) - } - e.mappingv(tag, func() { - for _, info := range sinfo.FieldsList { - var value reflect.Value - if info.Inline == nil { - value = in.Field(info.Num) - } else { - value = in.FieldByIndex(info.Inline) - } - if info.OmitEmpty && isZero(value) { - continue - } - e.marshal("", reflect.ValueOf(info.Key)) - e.flow = info.Flow - e.marshal("", value) - } - if sinfo.InlineMap >= 0 { - m := in.Field(sinfo.InlineMap) - if m.Len() > 0 { - e.flow = false - keys := keyList(m.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - if _, found := sinfo.FieldsMap[k.String()]; found { - panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String())) - } - e.marshal("", k) - e.flow = false - e.marshal("", m.MapIndex(k)) - } - } - } - }) -} - -func (e *encoder) mappingv(tag string, f func()) { - implicit := tag == "" - style := yaml_BLOCK_MAPPING_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_MAPPING_STYLE - } - yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) - e.emit() - f() - yaml_mapping_end_event_initialize(&e.event) - e.emit() -} - -func (e *encoder) slicev(tag string, in reflect.Value) { - implicit := tag == "" - style := yaml_BLOCK_SEQUENCE_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_SEQUENCE_STYLE - } - e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) - e.emit() - n := in.Len() - for i := 0; i < n; i++ { - e.marshal("", in.Index(i)) - } - e.must(yaml_sequence_end_event_initialize(&e.event)) - e.emit() -} - -// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. -// -// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported -// in YAML 1.2 and by this package, but these should be marshalled quoted for -// the time being for compatibility with other parsers. -func isBase60Float(s string) (result bool) { - // Fast path. - if s == "" { - return false - } - c := s[0] - if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { - return false - } - // Do the full match. - return base60float.MatchString(s) -} - -// From http://yaml.org/type/float.html, except the regular expression there -// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. -var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) - -func (e *encoder) stringv(tag string, in reflect.Value) { - var style yaml_scalar_style_t - s := in.String() - canUsePlain := true - switch { - case !utf8.ValidString(s): - if tag == yaml_BINARY_TAG { - failf("explicitly tagged !!binary data must be base64-encoded") - } - if tag != "" { - failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) - } - // It can't be encoded directly as YAML so use a binary tag - // and encode it as base64. - tag = yaml_BINARY_TAG - s = encodeBase64(s) - case tag == "": - // Check to see if it would resolve to a specific - // tag when encoded unquoted. If it doesn't, - // there's no need to quote it. - rtag, _ := resolve("", s) - canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s) - } - // Note: it's possible for user code to emit invalid YAML - // if they explicitly specify a tag and a string containing - // text that's incompatible with that tag. - switch { - case strings.Contains(s, "\n"): - style = yaml_LITERAL_SCALAR_STYLE - case canUsePlain: - style = yaml_PLAIN_SCALAR_STYLE - default: - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - e.emitScalar(s, "", tag, style) -} - -func (e *encoder) boolv(tag string, in reflect.Value) { - var s string - if in.Bool() { - s = "true" - } else { - s = "false" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) intv(tag string, in reflect.Value) { - s := strconv.FormatInt(in.Int(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) uintv(tag string, in reflect.Value) { - s := strconv.FormatUint(in.Uint(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) timev(tag string, in reflect.Value) { - t := in.Interface().(time.Time) - s := t.Format(time.RFC3339Nano) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) floatv(tag string, in reflect.Value) { - // Issue #352: When formatting, use the precision of the underlying value - precision := 64 - if in.Kind() == reflect.Float32 { - precision = 32 - } - - s := strconv.FormatFloat(in.Float(), 'g', -1, precision) - switch s { - case "+Inf": - s = ".inf" - case "-Inf": - s = "-.inf" - case "NaN": - s = ".nan" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) nilv() { - e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { - implicit := tag == "" - e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) - e.emit() -} diff --git a/vendor/gopkg.in/yaml.v2/go.mod b/vendor/gopkg.in/yaml.v2/go.mod deleted file mode 100644 index 1934e8769..000000000 --- a/vendor/gopkg.in/yaml.v2/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module "gopkg.in/yaml.v2" - -require ( - "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 -) diff --git a/vendor/gopkg.in/yaml.v2/parserc.go b/vendor/gopkg.in/yaml.v2/parserc.go deleted file mode 100644 index 81d05dfe5..000000000 --- a/vendor/gopkg.in/yaml.v2/parserc.go +++ /dev/null @@ -1,1095 +0,0 @@ -package yaml - -import ( - "bytes" -) - -// The parser implements the following grammar: -// -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// implicit_document ::= block_node DOCUMENT-END* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// block_node_or_indentless_sequence ::= -// ALIAS -// | properties (block_content | indentless_block_sequence)? -// | block_content -// | indentless_block_sequence -// block_node ::= ALIAS -// | properties block_content? -// | block_content -// flow_node ::= ALIAS -// | properties flow_content? -// | flow_content -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// block_content ::= block_collection | flow_collection | SCALAR -// flow_content ::= flow_collection | SCALAR -// block_collection ::= block_sequence | block_mapping -// flow_collection ::= flow_sequence | flow_mapping -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// block_mapping ::= BLOCK-MAPPING_START -// ((KEY block_node_or_indentless_sequence?)? -// (VALUE block_node_or_indentless_sequence?)?)* -// BLOCK-END -// flow_sequence ::= FLOW-SEQUENCE-START -// (flow_sequence_entry FLOW-ENTRY)* -// flow_sequence_entry? -// FLOW-SEQUENCE-END -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// flow_mapping ::= FLOW-MAPPING-START -// (flow_mapping_entry FLOW-ENTRY)* -// flow_mapping_entry? -// FLOW-MAPPING-END -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? - -// Peek the next token in the token queue. -func peek_token(parser *yaml_parser_t) *yaml_token_t { - if parser.token_available || yaml_parser_fetch_more_tokens(parser) { - return &parser.tokens[parser.tokens_head] - } - return nil -} - -// Remove the next token from the queue (must be called after peek_token). -func skip_token(parser *yaml_parser_t) { - parser.token_available = false - parser.tokens_parsed++ - parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN - parser.tokens_head++ -} - -// Get the next event. -func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { - // Erase the event object. - *event = yaml_event_t{} - - // No events after the end of the stream or error. - if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { - return true - } - - // Generate the next event. - return yaml_parser_state_machine(parser, event) -} - -// Set parser error. -func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { - parser.error = yaml_PARSER_ERROR - parser.problem = problem - parser.problem_mark = problem_mark - return false -} - -func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { - parser.error = yaml_PARSER_ERROR - parser.context = context - parser.context_mark = context_mark - parser.problem = problem - parser.problem_mark = problem_mark - return false -} - -// State dispatcher. -func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { - //trace("yaml_parser_state_machine", "state:", parser.state.String()) - - switch parser.state { - case yaml_PARSE_STREAM_START_STATE: - return yaml_parser_parse_stream_start(parser, event) - - case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: - return yaml_parser_parse_document_start(parser, event, true) - - case yaml_PARSE_DOCUMENT_START_STATE: - return yaml_parser_parse_document_start(parser, event, false) - - case yaml_PARSE_DOCUMENT_CONTENT_STATE: - return yaml_parser_parse_document_content(parser, event) - - case yaml_PARSE_DOCUMENT_END_STATE: - return yaml_parser_parse_document_end(parser, event) - - case yaml_PARSE_BLOCK_NODE_STATE: - return yaml_parser_parse_node(parser, event, true, false) - - case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: - return yaml_parser_parse_node(parser, event, true, true) - - case yaml_PARSE_FLOW_NODE_STATE: - return yaml_parser_parse_node(parser, event, false, false) - - case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: - return yaml_parser_parse_block_sequence_entry(parser, event, true) - - case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_block_sequence_entry(parser, event, false) - - case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_indentless_sequence_entry(parser, event) - - case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: - return yaml_parser_parse_block_mapping_key(parser, event, true) - - case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: - return yaml_parser_parse_block_mapping_key(parser, event, false) - - case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: - return yaml_parser_parse_block_mapping_value(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: - return yaml_parser_parse_flow_sequence_entry(parser, event, true) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_flow_sequence_entry(parser, event, false) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) - - case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_parser_parse_flow_mapping_key(parser, event, true) - - case yaml_PARSE_FLOW_MAPPING_KEY_STATE: - return yaml_parser_parse_flow_mapping_key(parser, event, false) - - case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: - return yaml_parser_parse_flow_mapping_value(parser, event, false) - - case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: - return yaml_parser_parse_flow_mapping_value(parser, event, true) - - default: - panic("invalid parser state") - } -} - -// Parse the production: -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ -func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_STREAM_START_TOKEN { - return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) - } - parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE - *event = yaml_event_t{ - typ: yaml_STREAM_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - encoding: token.encoding, - } - skip_token(parser) - return true -} - -// Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// * -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* -func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { - - token := peek_token(parser) - if token == nil { - return false - } - - // Parse extra document end indicators. - if !implicit { - for token.typ == yaml_DOCUMENT_END_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } - - if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && - token.typ != yaml_TAG_DIRECTIVE_TOKEN && - token.typ != yaml_DOCUMENT_START_TOKEN && - token.typ != yaml_STREAM_END_TOKEN { - // Parse an implicit document. - if !yaml_parser_process_directives(parser, nil, nil) { - return false - } - parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) - parser.state = yaml_PARSE_BLOCK_NODE_STATE - - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - } else if token.typ != yaml_STREAM_END_TOKEN { - // Parse an explicit document. - var version_directive *yaml_version_directive_t - var tag_directives []yaml_tag_directive_t - start_mark := token.start_mark - if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { - return false - } - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_DOCUMENT_START_TOKEN { - yaml_parser_set_parser_error(parser, - "did not find expected ", token.start_mark) - return false - } - parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) - parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE - end_mark := token.end_mark - - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - version_directive: version_directive, - tag_directives: tag_directives, - implicit: false, - } - skip_token(parser) - - } else { - // Parse the stream end. - parser.state = yaml_PARSE_END_STATE - *event = yaml_event_t{ - typ: yaml_STREAM_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - } - - return true -} - -// Parse the productions: -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** -// -func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || - token.typ == yaml_TAG_DIRECTIVE_TOKEN || - token.typ == yaml_DOCUMENT_START_TOKEN || - token.typ == yaml_DOCUMENT_END_TOKEN || - token.typ == yaml_STREAM_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - return yaml_parser_process_empty_scalar(parser, event, - token.start_mark) - } - return yaml_parser_parse_node(parser, event, true, false) -} - -// Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// -func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - start_mark := token.start_mark - end_mark := token.start_mark - - implicit := true - if token.typ == yaml_DOCUMENT_END_TOKEN { - end_mark = token.end_mark - skip_token(parser) - implicit = false - } - - parser.tag_directives = parser.tag_directives[:0] - - parser.state = yaml_PARSE_DOCUMENT_START_STATE - *event = yaml_event_t{ - typ: yaml_DOCUMENT_END_EVENT, - start_mark: start_mark, - end_mark: end_mark, - implicit: implicit, - } - return true -} - -// Parse the productions: -// block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * -// block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * -// flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* -// block_content ::= block_collection | flow_collection | SCALAR -// ****** -// flow_content ::= flow_collection | SCALAR -// ****** -func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { - //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_ALIAS_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - *event = yaml_event_t{ - typ: yaml_ALIAS_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - anchor: token.value, - } - skip_token(parser) - return true - } - - start_mark := token.start_mark - end_mark := token.start_mark - - var tag_token bool - var tag_handle, tag_suffix, anchor []byte - var tag_mark yaml_mark_t - if token.typ == yaml_ANCHOR_TOKEN { - anchor = token.value - start_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_TAG_TOKEN { - tag_token = true - tag_handle = token.value - tag_suffix = token.suffix - tag_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } else if token.typ == yaml_TAG_TOKEN { - tag_token = true - tag_handle = token.value - tag_suffix = token.suffix - start_mark = token.start_mark - tag_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_ANCHOR_TOKEN { - anchor = token.value - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } - - var tag []byte - if tag_token { - if len(tag_handle) == 0 { - tag = tag_suffix - tag_suffix = nil - } else { - for i := range parser.tag_directives { - if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { - tag = append([]byte(nil), parser.tag_directives[i].prefix...) - tag = append(tag, tag_suffix...) - break - } - } - if len(tag) == 0 { - yaml_parser_set_parser_error_context(parser, - "while parsing a node", start_mark, - "found undefined tag handle", tag_mark) - return false - } - } - } - - implicit := len(tag) == 0 - if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), - } - return true - } - if token.typ == yaml_SCALAR_TOKEN { - var plain_implicit, quoted_implicit bool - end_mark = token.end_mark - if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { - plain_implicit = true - } else if len(tag) == 0 { - quoted_implicit = true - } - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - value: token.value, - implicit: plain_implicit, - quoted_implicit: quoted_implicit, - style: yaml_style_t(token.style), - } - skip_token(parser) - return true - } - if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { - // [Go] Some of the events below can be merged as they differ only on style. - end_mark = token.end_mark - parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), - } - return true - } - if token.typ == yaml_FLOW_MAPPING_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), - } - return true - } - if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), - } - return true - } - if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), - } - return true - } - if len(anchor) > 0 || len(tag) > 0 { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - quoted_implicit: false, - style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), - } - return true - } - - context := "while parsing a flow node" - if block { - context = "while parsing a block node" - } - yaml_parser_set_parser_error_context(parser, context, start_mark, - "did not find expected node content", token.start_mark) - return false -} - -// Parse the productions: -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* -// -func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_BLOCK_ENTRY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, true, false) - } else { - parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - } - if token.typ == yaml_BLOCK_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - skip_token(parser) - return true - } - - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a block collection", context_mark, - "did not find expected '-' indicator", token.start_mark) -} - -// Parse the productions: -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * -func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_BLOCK_ENTRY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_BLOCK_ENTRY_TOKEN && - token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, true, false) - } - parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? - } - return true -} - -// Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* -// -// BLOCK-END -// ********* -// -func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_KEY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, true, true) - } else { - parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - } else if token.typ == yaml_BLOCK_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - return true - } - - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a block mapping", context_mark, - "did not find expected key", token.start_mark) -} - -// Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START -// -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// -// -func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VALUE_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) - return yaml_parser_parse_node(parser, event, true, true) - } - parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Parse the productions: -// flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * -// -func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - if !first { - if token.typ == yaml_FLOW_ENTRY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } else { - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a flow sequence", context_mark, - "did not find expected ',' or ']'", token.start_mark) - } - } - - if token.typ == yaml_KEY_TOKEN { - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - implicit: true, - style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), - } - skip_token(parser) - return true - } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - skip_token(parser) - return true -} - -// -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * -// -func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_FLOW_ENTRY_TOKEN && - token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - mark := token.end_mark - skip_token(parser) - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) -} - -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * -// -func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VALUE_TOKEN { - skip_token(parser) - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * -// -func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? - } - return true -} - -// Parse the productions: -// flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * -// -func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ != yaml_FLOW_MAPPING_END_TOKEN { - if !first { - if token.typ == yaml_FLOW_ENTRY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } else { - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a flow mapping", context_mark, - "did not find expected ',' or '}'", token.start_mark) - } - } - - if token.typ == yaml_KEY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_FLOW_ENTRY_TOKEN && - token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } else { - parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) - } - } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - return true -} - -// Parse the productions: -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// -func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { - token := peek_token(parser) - if token == nil { - return false - } - if empty { - parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) - } - if token.typ == yaml_VALUE_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Generate an empty scalar event. -func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: mark, - end_mark: mark, - value: nil, // Empty - implicit: true, - style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), - } - return true -} - -var default_tag_directives = []yaml_tag_directive_t{ - {[]byte("!"), []byte("!")}, - {[]byte("!!"), []byte("tag:yaml.org,2002:")}, -} - -// Parse directives. -func yaml_parser_process_directives(parser *yaml_parser_t, - version_directive_ref **yaml_version_directive_t, - tag_directives_ref *[]yaml_tag_directive_t) bool { - - var version_directive *yaml_version_directive_t - var tag_directives []yaml_tag_directive_t - - token := peek_token(parser) - if token == nil { - return false - } - - for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { - if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { - if version_directive != nil { - yaml_parser_set_parser_error(parser, - "found duplicate %YAML directive", token.start_mark) - return false - } - if token.major != 1 || token.minor != 1 { - yaml_parser_set_parser_error(parser, - "found incompatible YAML document", token.start_mark) - return false - } - version_directive = &yaml_version_directive_t{ - major: token.major, - minor: token.minor, - } - } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { - value := yaml_tag_directive_t{ - handle: token.value, - prefix: token.prefix, - } - if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { - return false - } - tag_directives = append(tag_directives, value) - } - - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - - for i := range default_tag_directives { - if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { - return false - } - } - - if version_directive_ref != nil { - *version_directive_ref = version_directive - } - if tag_directives_ref != nil { - *tag_directives_ref = tag_directives - } - return true -} - -// Append a tag directive to the directives stack. -func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { - for i := range parser.tag_directives { - if bytes.Equal(value.handle, parser.tag_directives[i].handle) { - if allow_duplicates { - return true - } - return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) - } - } - - // [Go] I suspect the copy is unnecessary. This was likely done - // because there was no way to track ownership of the data. - value_copy := yaml_tag_directive_t{ - handle: make([]byte, len(value.handle)), - prefix: make([]byte, len(value.prefix)), - } - copy(value_copy.handle, value.handle) - copy(value_copy.prefix, value.prefix) - parser.tag_directives = append(parser.tag_directives, value_copy) - return true -} diff --git a/vendor/gopkg.in/yaml.v2/readerc.go b/vendor/gopkg.in/yaml.v2/readerc.go deleted file mode 100644 index 7c1f5fac3..000000000 --- a/vendor/gopkg.in/yaml.v2/readerc.go +++ /dev/null @@ -1,412 +0,0 @@ -package yaml - -import ( - "io" -) - -// Set the reader error and return 0. -func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { - parser.error = yaml_READER_ERROR - parser.problem = problem - parser.problem_offset = offset - parser.problem_value = value - return false -} - -// Byte order marks. -const ( - bom_UTF8 = "\xef\xbb\xbf" - bom_UTF16LE = "\xff\xfe" - bom_UTF16BE = "\xfe\xff" -) - -// Determine the input stream encoding by checking the BOM symbol. If no BOM is -// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. -func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { - // Ensure that we had enough bytes in the raw buffer. - for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { - if !yaml_parser_update_raw_buffer(parser) { - return false - } - } - - // Determine the encoding. - buf := parser.raw_buffer - pos := parser.raw_buffer_pos - avail := len(buf) - pos - if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { - parser.encoding = yaml_UTF16LE_ENCODING - parser.raw_buffer_pos += 2 - parser.offset += 2 - } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { - parser.encoding = yaml_UTF16BE_ENCODING - parser.raw_buffer_pos += 2 - parser.offset += 2 - } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { - parser.encoding = yaml_UTF8_ENCODING - parser.raw_buffer_pos += 3 - parser.offset += 3 - } else { - parser.encoding = yaml_UTF8_ENCODING - } - return true -} - -// Update the raw buffer. -func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { - size_read := 0 - - // Return if the raw buffer is full. - if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { - return true - } - - // Return on EOF. - if parser.eof { - return true - } - - // Move the remaining bytes in the raw buffer to the beginning. - if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { - copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) - } - parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] - parser.raw_buffer_pos = 0 - - // Call the read handler to fill the buffer. - size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) - parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] - if err == io.EOF { - parser.eof = true - } else if err != nil { - return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) - } - return true -} - -// Ensure that the buffer contains at least `length` characters. -// Return true on success, false on failure. -// -// The length is supposed to be significantly less that the buffer size. -func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { - if parser.read_handler == nil { - panic("read handler must be set") - } - - // [Go] This function was changed to guarantee the requested length size at EOF. - // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests - - // If the EOF flag is set and the raw buffer is empty, do nothing. - if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { - // [Go] ACTUALLY! Read the documentation of this function above. - // This is just broken. To return true, we need to have the - // given length in the buffer. Not doing that means every single - // check that calls this function to make sure the buffer has a - // given length is Go) panicking; or C) accessing invalid memory. - //return true - } - - // Return if the buffer contains enough characters. - if parser.unread >= length { - return true - } - - // Determine the input encoding if it is not known yet. - if parser.encoding == yaml_ANY_ENCODING { - if !yaml_parser_determine_encoding(parser) { - return false - } - } - - // Move the unread characters to the beginning of the buffer. - buffer_len := len(parser.buffer) - if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { - copy(parser.buffer, parser.buffer[parser.buffer_pos:]) - buffer_len -= parser.buffer_pos - parser.buffer_pos = 0 - } else if parser.buffer_pos == buffer_len { - buffer_len = 0 - parser.buffer_pos = 0 - } - - // Open the whole buffer for writing, and cut it before returning. - parser.buffer = parser.buffer[:cap(parser.buffer)] - - // Fill the buffer until it has enough characters. - first := true - for parser.unread < length { - - // Fill the raw buffer if necessary. - if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { - if !yaml_parser_update_raw_buffer(parser) { - parser.buffer = parser.buffer[:buffer_len] - return false - } - } - first = false - - // Decode the raw buffer. - inner: - for parser.raw_buffer_pos != len(parser.raw_buffer) { - var value rune - var width int - - raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos - - // Decode the next character. - switch parser.encoding { - case yaml_UTF8_ENCODING: - // Decode a UTF-8 character. Check RFC 3629 - // (http://www.ietf.org/rfc/rfc3629.txt) for more details. - // - // The following table (taken from the RFC) is used for - // decoding. - // - // Char. number range | UTF-8 octet sequence - // (hexadecimal) | (binary) - // --------------------+------------------------------------ - // 0000 0000-0000 007F | 0xxxxxxx - // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - // - // Additionally, the characters in the range 0xD800-0xDFFF - // are prohibited as they are reserved for use with UTF-16 - // surrogate pairs. - - // Determine the length of the UTF-8 sequence. - octet := parser.raw_buffer[parser.raw_buffer_pos] - switch { - case octet&0x80 == 0x00: - width = 1 - case octet&0xE0 == 0xC0: - width = 2 - case octet&0xF0 == 0xE0: - width = 3 - case octet&0xF8 == 0xF0: - width = 4 - default: - // The leading octet is invalid. - return yaml_parser_set_reader_error(parser, - "invalid leading UTF-8 octet", - parser.offset, int(octet)) - } - - // Check if the raw buffer contains an incomplete character. - if width > raw_unread { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-8 octet sequence", - parser.offset, -1) - } - break inner - } - - // Decode the leading octet. - switch { - case octet&0x80 == 0x00: - value = rune(octet & 0x7F) - case octet&0xE0 == 0xC0: - value = rune(octet & 0x1F) - case octet&0xF0 == 0xE0: - value = rune(octet & 0x0F) - case octet&0xF8 == 0xF0: - value = rune(octet & 0x07) - default: - value = 0 - } - - // Check and decode the trailing octets. - for k := 1; k < width; k++ { - octet = parser.raw_buffer[parser.raw_buffer_pos+k] - - // Check if the octet is valid. - if (octet & 0xC0) != 0x80 { - return yaml_parser_set_reader_error(parser, - "invalid trailing UTF-8 octet", - parser.offset+k, int(octet)) - } - - // Decode the octet. - value = (value << 6) + rune(octet&0x3F) - } - - // Check the length of the sequence against the value. - switch { - case width == 1: - case width == 2 && value >= 0x80: - case width == 3 && value >= 0x800: - case width == 4 && value >= 0x10000: - default: - return yaml_parser_set_reader_error(parser, - "invalid length of a UTF-8 sequence", - parser.offset, -1) - } - - // Check the range of the value. - if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { - return yaml_parser_set_reader_error(parser, - "invalid Unicode character", - parser.offset, int(value)) - } - - case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: - var low, high int - if parser.encoding == yaml_UTF16LE_ENCODING { - low, high = 0, 1 - } else { - low, high = 1, 0 - } - - // The UTF-16 encoding is not as simple as one might - // naively think. Check RFC 2781 - // (http://www.ietf.org/rfc/rfc2781.txt). - // - // Normally, two subsequent bytes describe a Unicode - // character. However a special technique (called a - // surrogate pair) is used for specifying character - // values larger than 0xFFFF. - // - // A surrogate pair consists of two pseudo-characters: - // high surrogate area (0xD800-0xDBFF) - // low surrogate area (0xDC00-0xDFFF) - // - // The following formulas are used for decoding - // and encoding characters using surrogate pairs: - // - // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) - // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) - // W1 = 110110yyyyyyyyyy - // W2 = 110111xxxxxxxxxx - // - // where U is the character value, W1 is the high surrogate - // area, W2 is the low surrogate area. - - // Check for incomplete UTF-16 character. - if raw_unread < 2 { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 character", - parser.offset, -1) - } - break inner - } - - // Get the character. - value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + - (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) - - // Check for unexpected low surrogate area. - if value&0xFC00 == 0xDC00 { - return yaml_parser_set_reader_error(parser, - "unexpected low surrogate area", - parser.offset, int(value)) - } - - // Check for a high surrogate area. - if value&0xFC00 == 0xD800 { - width = 4 - - // Check for incomplete surrogate pair. - if raw_unread < 4 { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 surrogate pair", - parser.offset, -1) - } - break inner - } - - // Get the next character. - value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + - (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) - - // Check for a low surrogate area. - if value2&0xFC00 != 0xDC00 { - return yaml_parser_set_reader_error(parser, - "expected low surrogate area", - parser.offset+2, int(value2)) - } - - // Generate the value of the surrogate pair. - value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) - } else { - width = 2 - } - - default: - panic("impossible") - } - - // Check if the character is in the allowed range: - // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) - // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) - // | [#x10000-#x10FFFF] (32 bit) - switch { - case value == 0x09: - case value == 0x0A: - case value == 0x0D: - case value >= 0x20 && value <= 0x7E: - case value == 0x85: - case value >= 0xA0 && value <= 0xD7FF: - case value >= 0xE000 && value <= 0xFFFD: - case value >= 0x10000 && value <= 0x10FFFF: - default: - return yaml_parser_set_reader_error(parser, - "control characters are not allowed", - parser.offset, int(value)) - } - - // Move the raw pointers. - parser.raw_buffer_pos += width - parser.offset += width - - // Finally put the character into the buffer. - if value <= 0x7F { - // 0000 0000-0000 007F . 0xxxxxxx - parser.buffer[buffer_len+0] = byte(value) - buffer_len += 1 - } else if value <= 0x7FF { - // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) - parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) - buffer_len += 2 - } else if value <= 0xFFFF { - // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) - parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) - parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) - buffer_len += 3 - } else { - // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) - parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) - parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) - parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) - buffer_len += 4 - } - - parser.unread++ - } - - // On EOF, put NUL into the buffer and return. - if parser.eof { - parser.buffer[buffer_len] = 0 - buffer_len++ - parser.unread++ - break - } - } - // [Go] Read the documentation of this function above. To return true, - // we need to have the given length in the buffer. Not doing that means - // every single check that calls this function to make sure the buffer - // has a given length is Go) panicking; or C) accessing invalid memory. - // This happens here due to the EOF above breaking early. - for buffer_len < length { - parser.buffer[buffer_len] = 0 - buffer_len++ - } - parser.buffer = parser.buffer[:buffer_len] - return true -} diff --git a/vendor/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v2/resolve.go deleted file mode 100644 index 4120e0c91..000000000 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ /dev/null @@ -1,258 +0,0 @@ -package yaml - -import ( - "encoding/base64" - "math" - "regexp" - "strconv" - "strings" - "time" -) - -type resolveMapItem struct { - value interface{} - tag string -} - -var resolveTable = make([]byte, 256) -var resolveMap = make(map[string]resolveMapItem) - -func init() { - t := resolveTable - t[int('+')] = 'S' // Sign - t[int('-')] = 'S' - for _, c := range "0123456789" { - t[int(c)] = 'D' // Digit - } - for _, c := range "yYnNtTfFoO~" { - t[int(c)] = 'M' // In map - } - t[int('.')] = '.' // Float (potentially in map) - - var resolveMapList = []struct { - v interface{} - tag string - l []string - }{ - {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}}, - {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}}, - {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}}, - {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}}, - {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}}, - {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}}, - {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}}, - {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}}, - {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}}, - {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}}, - {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}}, - {"<<", yaml_MERGE_TAG, []string{"<<"}}, - } - - m := resolveMap - for _, item := range resolveMapList { - for _, s := range item.l { - m[s] = resolveMapItem{item.v, item.tag} - } - } -} - -const longTagPrefix = "tag:yaml.org,2002:" - -func shortTag(tag string) string { - // TODO This can easily be made faster and produce less garbage. - if strings.HasPrefix(tag, longTagPrefix) { - return "!!" + tag[len(longTagPrefix):] - } - return tag -} - -func longTag(tag string) string { - if strings.HasPrefix(tag, "!!") { - return longTagPrefix + tag[2:] - } - return tag -} - -func resolvableTag(tag string) bool { - switch tag { - case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG, yaml_TIMESTAMP_TAG: - return true - } - return false -} - -var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) - -func resolve(tag string, in string) (rtag string, out interface{}) { - if !resolvableTag(tag) { - return tag, in - } - - defer func() { - switch tag { - case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG: - return - case yaml_FLOAT_TAG: - if rtag == yaml_INT_TAG { - switch v := out.(type) { - case int64: - rtag = yaml_FLOAT_TAG - out = float64(v) - return - case int: - rtag = yaml_FLOAT_TAG - out = float64(v) - return - } - } - } - failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) - }() - - // Any data is accepted as a !!str or !!binary. - // Otherwise, the prefix is enough of a hint about what it might be. - hint := byte('N') - if in != "" { - hint = resolveTable[in[0]] - } - if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG { - // Handle things we can lookup in a map. - if item, ok := resolveMap[in]; ok { - return item.tag, item.value - } - - // Base 60 floats are a bad idea, were dropped in YAML 1.2, and - // are purposefully unsupported here. They're still quoted on - // the way out for compatibility with other parser, though. - - switch hint { - case 'M': - // We've already checked the map above. - - case '.': - // Not in the map, so maybe a normal float. - floatv, err := strconv.ParseFloat(in, 64) - if err == nil { - return yaml_FLOAT_TAG, floatv - } - - case 'D', 'S': - // Int, float, or timestamp. - // Only try values as a timestamp if the value is unquoted or there's an explicit - // !!timestamp tag. - if tag == "" || tag == yaml_TIMESTAMP_TAG { - t, ok := parseTimestamp(in) - if ok { - return yaml_TIMESTAMP_TAG, t - } - } - - plain := strings.Replace(in, "_", "", -1) - intv, err := strconv.ParseInt(plain, 0, 64) - if err == nil { - if intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) - } else { - return yaml_INT_TAG, intv - } - } - uintv, err := strconv.ParseUint(plain, 0, 64) - if err == nil { - return yaml_INT_TAG, uintv - } - if yamlStyleFloat.MatchString(plain) { - floatv, err := strconv.ParseFloat(plain, 64) - if err == nil { - return yaml_FLOAT_TAG, floatv - } - } - if strings.HasPrefix(plain, "0b") { - intv, err := strconv.ParseInt(plain[2:], 2, 64) - if err == nil { - if intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) - } else { - return yaml_INT_TAG, intv - } - } - uintv, err := strconv.ParseUint(plain[2:], 2, 64) - if err == nil { - return yaml_INT_TAG, uintv - } - } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) - if err == nil { - if true || intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) - } else { - return yaml_INT_TAG, intv - } - } - } - default: - panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")") - } - } - return yaml_STR_TAG, in -} - -// encodeBase64 encodes s as base64 that is broken up into multiple lines -// as appropriate for the resulting length. -func encodeBase64(s string) string { - const lineLen = 70 - encLen := base64.StdEncoding.EncodedLen(len(s)) - lines := encLen/lineLen + 1 - buf := make([]byte, encLen*2+lines) - in := buf[0:encLen] - out := buf[encLen:] - base64.StdEncoding.Encode(in, []byte(s)) - k := 0 - for i := 0; i < len(in); i += lineLen { - j := i + lineLen - if j > len(in) { - j = len(in) - } - k += copy(out[k:], in[i:j]) - if lines > 1 { - out[k] = '\n' - k++ - } - } - return string(out[:k]) -} - -// This is a subset of the formats allowed by the regular expression -// defined at http://yaml.org/type/timestamp.html. -var allowedTimestampFormats = []string{ - "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields. - "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t". - "2006-1-2 15:4:5.999999999", // space separated with no time zone - "2006-1-2", // date only - // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" - // from the set of examples. -} - -// parseTimestamp parses s as a timestamp string and -// returns the timestamp and reports whether it succeeded. -// Timestamp formats are defined at http://yaml.org/type/timestamp.html -func parseTimestamp(s string) (time.Time, bool) { - // TODO write code to check all the formats supported by - // http://yaml.org/type/timestamp.html instead of using time.Parse. - - // Quick check: all date formats start with YYYY-. - i := 0 - for ; i < len(s); i++ { - if c := s[i]; c < '0' || c > '9' { - break - } - } - if i != 4 || i == len(s) || s[i] != '-' { - return time.Time{}, false - } - for _, format := range allowedTimestampFormats { - if t, err := time.Parse(format, s); err == nil { - return t, true - } - } - return time.Time{}, false -} diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go deleted file mode 100644 index 0b9bb6030..000000000 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ /dev/null @@ -1,2711 +0,0 @@ -package yaml - -import ( - "bytes" - "fmt" -) - -// Introduction -// ************ -// -// The following notes assume that you are familiar with the YAML specification -// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in -// some cases we are less restrictive that it requires. -// -// The process of transforming a YAML stream into a sequence of events is -// divided on two steps: Scanning and Parsing. -// -// The Scanner transforms the input stream into a sequence of tokens, while the -// parser transform the sequence of tokens produced by the Scanner into a -// sequence of parsing events. -// -// The Scanner is rather clever and complicated. The Parser, on the contrary, -// is a straightforward implementation of a recursive-descendant parser (or, -// LL(1) parser, as it is usually called). -// -// Actually there are two issues of Scanning that might be called "clever", the -// rest is quite straightforward. The issues are "block collection start" and -// "simple keys". Both issues are explained below in details. -// -// Here the Scanning step is explained and implemented. We start with the list -// of all the tokens produced by the Scanner together with short descriptions. -// -// Now, tokens: -// -// STREAM-START(encoding) # The stream start. -// STREAM-END # The stream end. -// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. -// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. -// DOCUMENT-START # '---' -// DOCUMENT-END # '...' -// BLOCK-SEQUENCE-START # Indentation increase denoting a block -// BLOCK-MAPPING-START # sequence or a block mapping. -// BLOCK-END # Indentation decrease. -// FLOW-SEQUENCE-START # '[' -// FLOW-SEQUENCE-END # ']' -// BLOCK-SEQUENCE-START # '{' -// BLOCK-SEQUENCE-END # '}' -// BLOCK-ENTRY # '-' -// FLOW-ENTRY # ',' -// KEY # '?' or nothing (simple keys). -// VALUE # ':' -// ALIAS(anchor) # '*anchor' -// ANCHOR(anchor) # '&anchor' -// TAG(handle,suffix) # '!handle!suffix' -// SCALAR(value,style) # A scalar. -// -// The following two tokens are "virtual" tokens denoting the beginning and the -// end of the stream: -// -// STREAM-START(encoding) -// STREAM-END -// -// We pass the information about the input stream encoding with the -// STREAM-START token. -// -// The next two tokens are responsible for tags: -// -// VERSION-DIRECTIVE(major,minor) -// TAG-DIRECTIVE(handle,prefix) -// -// Example: -// -// %YAML 1.1 -// %TAG ! !foo -// %TAG !yaml! tag:yaml.org,2002: -// --- -// -// The correspoding sequence of tokens: -// -// STREAM-START(utf-8) -// VERSION-DIRECTIVE(1,1) -// TAG-DIRECTIVE("!","!foo") -// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") -// DOCUMENT-START -// STREAM-END -// -// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole -// line. -// -// The document start and end indicators are represented by: -// -// DOCUMENT-START -// DOCUMENT-END -// -// Note that if a YAML stream contains an implicit document (without '---' -// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be -// produced. -// -// In the following examples, we present whole documents together with the -// produced tokens. -// -// 1. An implicit document: -// -// 'a scalar' -// -// Tokens: -// -// STREAM-START(utf-8) -// SCALAR("a scalar",single-quoted) -// STREAM-END -// -// 2. An explicit document: -// -// --- -// 'a scalar' -// ... -// -// Tokens: -// -// STREAM-START(utf-8) -// DOCUMENT-START -// SCALAR("a scalar",single-quoted) -// DOCUMENT-END -// STREAM-END -// -// 3. Several documents in a stream: -// -// 'a scalar' -// --- -// 'another scalar' -// --- -// 'yet another scalar' -// -// Tokens: -// -// STREAM-START(utf-8) -// SCALAR("a scalar",single-quoted) -// DOCUMENT-START -// SCALAR("another scalar",single-quoted) -// DOCUMENT-START -// SCALAR("yet another scalar",single-quoted) -// STREAM-END -// -// We have already introduced the SCALAR token above. The following tokens are -// used to describe aliases, anchors, tag, and scalars: -// -// ALIAS(anchor) -// ANCHOR(anchor) -// TAG(handle,suffix) -// SCALAR(value,style) -// -// The following series of examples illustrate the usage of these tokens: -// -// 1. A recursive sequence: -// -// &A [ *A ] -// -// Tokens: -// -// STREAM-START(utf-8) -// ANCHOR("A") -// FLOW-SEQUENCE-START -// ALIAS("A") -// FLOW-SEQUENCE-END -// STREAM-END -// -// 2. A tagged scalar: -// -// !!float "3.14" # A good approximation. -// -// Tokens: -// -// STREAM-START(utf-8) -// TAG("!!","float") -// SCALAR("3.14",double-quoted) -// STREAM-END -// -// 3. Various scalar styles: -// -// --- # Implicit empty plain scalars do not produce tokens. -// --- a plain scalar -// --- 'a single-quoted scalar' -// --- "a double-quoted scalar" -// --- |- -// a literal scalar -// --- >- -// a folded -// scalar -// -// Tokens: -// -// STREAM-START(utf-8) -// DOCUMENT-START -// DOCUMENT-START -// SCALAR("a plain scalar",plain) -// DOCUMENT-START -// SCALAR("a single-quoted scalar",single-quoted) -// DOCUMENT-START -// SCALAR("a double-quoted scalar",double-quoted) -// DOCUMENT-START -// SCALAR("a literal scalar",literal) -// DOCUMENT-START -// SCALAR("a folded scalar",folded) -// STREAM-END -// -// Now it's time to review collection-related tokens. We will start with -// flow collections: -// -// FLOW-SEQUENCE-START -// FLOW-SEQUENCE-END -// FLOW-MAPPING-START -// FLOW-MAPPING-END -// FLOW-ENTRY -// KEY -// VALUE -// -// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and -// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' -// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the -// indicators '?' and ':', which are used for denoting mapping keys and values, -// are represented by the KEY and VALUE tokens. -// -// The following examples show flow collections: -// -// 1. A flow sequence: -// -// [item 1, item 2, item 3] -// -// Tokens: -// -// STREAM-START(utf-8) -// FLOW-SEQUENCE-START -// SCALAR("item 1",plain) -// FLOW-ENTRY -// SCALAR("item 2",plain) -// FLOW-ENTRY -// SCALAR("item 3",plain) -// FLOW-SEQUENCE-END -// STREAM-END -// -// 2. A flow mapping: -// -// { -// a simple key: a value, # Note that the KEY token is produced. -// ? a complex key: another value, -// } -// -// Tokens: -// -// STREAM-START(utf-8) -// FLOW-MAPPING-START -// KEY -// SCALAR("a simple key",plain) -// VALUE -// SCALAR("a value",plain) -// FLOW-ENTRY -// KEY -// SCALAR("a complex key",plain) -// VALUE -// SCALAR("another value",plain) -// FLOW-ENTRY -// FLOW-MAPPING-END -// STREAM-END -// -// A simple key is a key which is not denoted by the '?' indicator. Note that -// the Scanner still produce the KEY token whenever it encounters a simple key. -// -// For scanning block collections, the following tokens are used (note that we -// repeat KEY and VALUE here): -// -// BLOCK-SEQUENCE-START -// BLOCK-MAPPING-START -// BLOCK-END -// BLOCK-ENTRY -// KEY -// VALUE -// -// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation -// increase that precedes a block collection (cf. the INDENT token in Python). -// The token BLOCK-END denote indentation decrease that ends a block collection -// (cf. the DEDENT token in Python). However YAML has some syntax pecularities -// that makes detections of these tokens more complex. -// -// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators -// '-', '?', and ':' correspondingly. -// -// The following examples show how the tokens BLOCK-SEQUENCE-START, -// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: -// -// 1. Block sequences: -// -// - item 1 -// - item 2 -// - -// - item 3.1 -// - item 3.2 -// - -// key 1: value 1 -// key 2: value 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-ENTRY -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 3.1",plain) -// BLOCK-ENTRY -// SCALAR("item 3.2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// 2. Block mappings: -// -// a simple key: a value # The KEY token is produced here. -// ? a complex key -// : another value -// a mapping: -// key 1: value 1 -// key 2: value 2 -// a sequence: -// - item 1 -// - item 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("a simple key",plain) -// VALUE -// SCALAR("a value",plain) -// KEY -// SCALAR("a complex key",plain) -// VALUE -// SCALAR("another value",plain) -// KEY -// SCALAR("a mapping",plain) -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// KEY -// SCALAR("a sequence",plain) -// VALUE -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// YAML does not always require to start a new block collection from a new -// line. If the current line contains only '-', '?', and ':' indicators, a new -// block collection may start at the current line. The following examples -// illustrate this case: -// -// 1. Collections in a sequence: -// -// - - item 1 -// - item 2 -// - key 1: value 1 -// key 2: value 2 -// - ? complex key -// : complex value -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("complex key") -// VALUE -// SCALAR("complex value") -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// 2. Collections in a mapping: -// -// ? a sequence -// : - item 1 -// - item 2 -// ? a mapping -// : key 1: value 1 -// key 2: value 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("a sequence",plain) -// VALUE -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// KEY -// SCALAR("a mapping",plain) -// VALUE -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// YAML also permits non-indented sequences if they are included into a block -// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: -// -// key: -// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. -// - item 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("key",plain) -// VALUE -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// - -// Ensure that the buffer contains the required number of characters. -// Return true on success, false on failure (reader error or memory error). -func cache(parser *yaml_parser_t, length int) bool { - // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) - return parser.unread >= length || yaml_parser_update_buffer(parser, length) -} - -// Advance the buffer pointer. -func skip(parser *yaml_parser_t) { - parser.mark.index++ - parser.mark.column++ - parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) -} - -func skip_line(parser *yaml_parser_t) { - if is_crlf(parser.buffer, parser.buffer_pos) { - parser.mark.index += 2 - parser.mark.column = 0 - parser.mark.line++ - parser.unread -= 2 - parser.buffer_pos += 2 - } else if is_break(parser.buffer, parser.buffer_pos) { - parser.mark.index++ - parser.mark.column = 0 - parser.mark.line++ - parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) - } -} - -// Copy a character to a string buffer and advance pointers. -func read(parser *yaml_parser_t, s []byte) []byte { - w := width(parser.buffer[parser.buffer_pos]) - if w == 0 { - panic("invalid character sequence") - } - if len(s) == 0 { - s = make([]byte, 0, 32) - } - if w == 1 && len(s)+w <= cap(s) { - s = s[:len(s)+1] - s[len(s)-1] = parser.buffer[parser.buffer_pos] - parser.buffer_pos++ - } else { - s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) - parser.buffer_pos += w - } - parser.mark.index++ - parser.mark.column++ - parser.unread-- - return s -} - -// Copy a line break character to a string buffer and advance pointers. -func read_line(parser *yaml_parser_t, s []byte) []byte { - buf := parser.buffer - pos := parser.buffer_pos - switch { - case buf[pos] == '\r' && buf[pos+1] == '\n': - // CR LF . LF - s = append(s, '\n') - parser.buffer_pos += 2 - parser.mark.index++ - parser.unread-- - case buf[pos] == '\r' || buf[pos] == '\n': - // CR|LF . LF - s = append(s, '\n') - parser.buffer_pos += 1 - case buf[pos] == '\xC2' && buf[pos+1] == '\x85': - // NEL . LF - s = append(s, '\n') - parser.buffer_pos += 2 - case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): - // LS|PS . LS|PS - s = append(s, buf[parser.buffer_pos:pos+3]...) - parser.buffer_pos += 3 - default: - return s - } - parser.mark.index++ - parser.mark.column = 0 - parser.mark.line++ - parser.unread-- - return s -} - -// Get the next token. -func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { - // Erase the token object. - *token = yaml_token_t{} // [Go] Is this necessary? - - // No tokens after STREAM-END or error. - if parser.stream_end_produced || parser.error != yaml_NO_ERROR { - return true - } - - // Ensure that the tokens queue contains enough tokens. - if !parser.token_available { - if !yaml_parser_fetch_more_tokens(parser) { - return false - } - } - - // Fetch the next token from the queue. - *token = parser.tokens[parser.tokens_head] - parser.tokens_head++ - parser.tokens_parsed++ - parser.token_available = false - - if token.typ == yaml_STREAM_END_TOKEN { - parser.stream_end_produced = true - } - return true -} - -// Set the scanner error and return false. -func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { - parser.error = yaml_SCANNER_ERROR - parser.context = context - parser.context_mark = context_mark - parser.problem = problem - parser.problem_mark = parser.mark - return false -} - -func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { - context := "while parsing a tag" - if directive { - context = "while parsing a %TAG directive" - } - return yaml_parser_set_scanner_error(parser, context, context_mark, problem) -} - -func trace(args ...interface{}) func() { - pargs := append([]interface{}{"+++"}, args...) - fmt.Println(pargs...) - pargs = append([]interface{}{"---"}, args...) - return func() { fmt.Println(pargs...) } -} - -// Ensure that the tokens queue contains at least one token which can be -// returned to the Parser. -func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { - // While we need more tokens to fetch, do it. - for { - if parser.tokens_head != len(parser.tokens) { - // If queue is non-empty, check if any potential simple key may - // occupy the head position. - head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] - if !ok { - break - } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { - return false - } else if !valid { - break - } - } - // Fetch the next token. - if !yaml_parser_fetch_next_token(parser) { - return false - } - } - - parser.token_available = true - return true -} - -// The dispatcher for token fetchers. -func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { - // Ensure that the buffer is initialized. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check if we just started scanning. Fetch STREAM-START then. - if !parser.stream_start_produced { - return yaml_parser_fetch_stream_start(parser) - } - - // Eat whitespaces and comments until we reach the next token. - if !yaml_parser_scan_to_next_token(parser) { - return false - } - - // Check the indentation level against the current column. - if !yaml_parser_unroll_indent(parser, parser.mark.column) { - return false - } - - // Ensure that the buffer contains at least 4 characters. 4 is the length - // of the longest indicators ('--- ' and '... '). - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - - // Is it the end of the stream? - if is_z(parser.buffer, parser.buffer_pos) { - return yaml_parser_fetch_stream_end(parser) - } - - // Is it a directive? - if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { - return yaml_parser_fetch_directive(parser) - } - - buf := parser.buffer - pos := parser.buffer_pos - - // Is it the document start indicator? - if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { - return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) - } - - // Is it the document end indicator? - if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { - return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) - } - - // Is it the flow sequence start indicator? - if buf[pos] == '[' { - return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) - } - - // Is it the flow mapping start indicator? - if parser.buffer[parser.buffer_pos] == '{' { - return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) - } - - // Is it the flow sequence end indicator? - if parser.buffer[parser.buffer_pos] == ']' { - return yaml_parser_fetch_flow_collection_end(parser, - yaml_FLOW_SEQUENCE_END_TOKEN) - } - - // Is it the flow mapping end indicator? - if parser.buffer[parser.buffer_pos] == '}' { - return yaml_parser_fetch_flow_collection_end(parser, - yaml_FLOW_MAPPING_END_TOKEN) - } - - // Is it the flow entry indicator? - if parser.buffer[parser.buffer_pos] == ',' { - return yaml_parser_fetch_flow_entry(parser) - } - - // Is it the block entry indicator? - if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { - return yaml_parser_fetch_block_entry(parser) - } - - // Is it the key indicator? - if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_key(parser) - } - - // Is it the value indicator? - if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_value(parser) - } - - // Is it an alias? - if parser.buffer[parser.buffer_pos] == '*' { - return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) - } - - // Is it an anchor? - if parser.buffer[parser.buffer_pos] == '&' { - return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) - } - - // Is it a tag? - if parser.buffer[parser.buffer_pos] == '!' { - return yaml_parser_fetch_tag(parser) - } - - // Is it a literal scalar? - if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { - return yaml_parser_fetch_block_scalar(parser, true) - } - - // Is it a folded scalar? - if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { - return yaml_parser_fetch_block_scalar(parser, false) - } - - // Is it a single-quoted scalar? - if parser.buffer[parser.buffer_pos] == '\'' { - return yaml_parser_fetch_flow_scalar(parser, true) - } - - // Is it a double-quoted scalar? - if parser.buffer[parser.buffer_pos] == '"' { - return yaml_parser_fetch_flow_scalar(parser, false) - } - - // Is it a plain scalar? - // - // A plain scalar may start with any non-blank characters except - // - // '-', '?', ':', ',', '[', ']', '{', '}', - // '#', '&', '*', '!', '|', '>', '\'', '\"', - // '%', '@', '`'. - // - // In the block context (and, for the '-' indicator, in the flow context - // too), it may also start with the characters - // - // '-', '?', ':' - // - // if it is followed by a non-space character. - // - // The last rule is more restrictive than the specification requires. - // [Go] Make this logic more reasonable. - //switch parser.buffer[parser.buffer_pos] { - //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': - //} - if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || - parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || - parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || - parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || - parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || - parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || - parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || - parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || - parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || - (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || - (parser.flow_level == 0 && - (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && - !is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_plain_scalar(parser) - } - - // If we don't determine the token type so far, it is an error. - return yaml_parser_set_scanner_error(parser, - "while scanning for the next token", parser.mark, - "found character that cannot start any token") -} - -func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { - if !simple_key.possible { - return false, true - } - - // The 1.2 specification says: - // - // "If the ? indicator is omitted, parsing needs to see past the - // implicit key to recognize it as such. To limit the amount of - // lookahead required, the “:” indicator must appear at most 1024 - // Unicode characters beyond the start of the key. In addition, the key - // is restricted to a single line." - // - if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { - // Check if the potential simple key to be removed is required. - if simple_key.required { - return false, yaml_parser_set_scanner_error(parser, - "while scanning a simple key", simple_key.mark, - "could not find expected ':'") - } - simple_key.possible = false - return false, true - } - return true, true -} - -// Check if a simple key may start at the current position and add it if -// needed. -func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { - // A simple key is required at the current position if the scanner is in - // the block context and the current column coincides with the indentation - // level. - - required := parser.flow_level == 0 && parser.indent == parser.mark.column - - // - // If the current position may start a simple key, save it. - // - if parser.simple_key_allowed { - simple_key := yaml_simple_key_t{ - possible: true, - required: required, - token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), - mark: parser.mark, - } - - if !yaml_parser_remove_simple_key(parser) { - return false - } - parser.simple_keys[len(parser.simple_keys)-1] = simple_key - parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 - } - return true -} - -// Remove a potential simple key at the current flow level. -func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { - i := len(parser.simple_keys) - 1 - if parser.simple_keys[i].possible { - // If the key is required, it is an error. - if parser.simple_keys[i].required { - return yaml_parser_set_scanner_error(parser, - "while scanning a simple key", parser.simple_keys[i].mark, - "could not find expected ':'") - } - // Remove the key from the stack. - parser.simple_keys[i].possible = false - delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) - } - return true -} - -// max_flow_level limits the flow_level -const max_flow_level = 10000 - -// Increase the flow level and resize the simple key list if needed. -func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { - // Reset the simple key on the next level. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ - possible: false, - required: false, - token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), - mark: parser.mark, - }) - - // Increase the flow level. - parser.flow_level++ - if parser.flow_level > max_flow_level { - return yaml_parser_set_scanner_error(parser, - "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, - fmt.Sprintf("exceeded max depth of %d", max_flow_level)) - } - return true -} - -// Decrease the flow level. -func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { - if parser.flow_level > 0 { - parser.flow_level-- - last := len(parser.simple_keys) - 1 - delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) - parser.simple_keys = parser.simple_keys[:last] - } - return true -} - -// max_indents limits the indents stack size -const max_indents = 10000 - -// Push the current indentation level to the stack and set the new level -// the current column is greater than the indentation level. In this case, -// append or insert the specified token into the token queue. -func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { - // In the flow context, do nothing. - if parser.flow_level > 0 { - return true - } - - if parser.indent < column { - // Push the current indentation level to the stack and set the new - // indentation level. - parser.indents = append(parser.indents, parser.indent) - parser.indent = column - if len(parser.indents) > max_indents { - return yaml_parser_set_scanner_error(parser, - "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, - fmt.Sprintf("exceeded max depth of %d", max_indents)) - } - - // Create a token and insert it into the queue. - token := yaml_token_t{ - typ: typ, - start_mark: mark, - end_mark: mark, - } - if number > -1 { - number -= parser.tokens_parsed - } - yaml_insert_token(parser, number, &token) - } - return true -} - -// Pop indentation levels from the indents stack until the current level -// becomes less or equal to the column. For each indentation level, append -// the BLOCK-END token. -func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool { - // In the flow context, do nothing. - if parser.flow_level > 0 { - return true - } - - // Loop through the indentation levels in the stack. - for parser.indent > column { - // Create a token and append it to the queue. - token := yaml_token_t{ - typ: yaml_BLOCK_END_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - } - yaml_insert_token(parser, -1, &token) - - // Pop the indentation level. - parser.indent = parser.indents[len(parser.indents)-1] - parser.indents = parser.indents[:len(parser.indents)-1] - } - return true -} - -// Initialize the scanner and produce the STREAM-START token. -func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { - - // Set the initial indentation. - parser.indent = -1 - - // Initialize the simple key stack. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) - - parser.simple_keys_by_tok = make(map[int]int) - - // A simple key is allowed at the beginning of the stream. - parser.simple_key_allowed = true - - // We have started. - parser.stream_start_produced = true - - // Create the STREAM-START token and append it to the queue. - token := yaml_token_t{ - typ: yaml_STREAM_START_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - encoding: parser.encoding, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the STREAM-END token and shut down the scanner. -func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { - - // Force new line. - if parser.mark.column != 0 { - parser.mark.column = 0 - parser.mark.line++ - } - - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Create the STREAM-END token and append it to the queue. - token := yaml_token_t{ - typ: yaml_STREAM_END_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. -func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. - token := yaml_token_t{} - if !yaml_parser_scan_directive(parser, &token) { - return false - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the DOCUMENT-START or DOCUMENT-END token. -func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Consume the token. - start_mark := parser.mark - - skip(parser) - skip(parser) - skip(parser) - - end_mark := parser.mark - - // Create the DOCUMENT-START or DOCUMENT-END token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. -func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // The indicators '[' and '{' may start a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // Increase the flow level. - if !yaml_parser_increase_flow_level(parser) { - return false - } - - // A simple key may follow the indicators '[' and '{'. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. -func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // Reset any potential simple key on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Decrease the flow level. - if !yaml_parser_decrease_flow_level(parser) { - return false - } - - // No simple keys after the indicators ']' and '}'. - parser.simple_key_allowed = false - - // Consume the token. - - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-ENTRY token. -func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after ','. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-ENTRY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_FLOW_ENTRY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the BLOCK-ENTRY token. -func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { - // Check if the scanner is in the block context. - if parser.flow_level == 0 { - // Check if we are allowed to start a new entry. - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "block sequence entries are not allowed in this context") - } - // Add the BLOCK-SEQUENCE-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { - return false - } - } else { - // It is an error for the '-' indicator to occur in the flow context, - // but we let the Parser detect and report about it because the Parser - // is able to point to the context. - } - - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after '-'. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the BLOCK-ENTRY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_BLOCK_ENTRY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the KEY token. -func yaml_parser_fetch_key(parser *yaml_parser_t) bool { - - // In the block context, additional checks are required. - if parser.flow_level == 0 { - // Check if we are allowed to start a new key (not nessesary simple). - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "mapping keys are not allowed in this context") - } - // Add the BLOCK-MAPPING-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { - return false - } - } - - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after '?' in the block context. - parser.simple_key_allowed = parser.flow_level == 0 - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the KEY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_KEY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the VALUE token. -func yaml_parser_fetch_value(parser *yaml_parser_t) bool { - - simple_key := &parser.simple_keys[len(parser.simple_keys)-1] - - // Have we found a simple key? - if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok { - return false - - } else if valid { - - // Create the KEY token and insert it into the queue. - token := yaml_token_t{ - typ: yaml_KEY_TOKEN, - start_mark: simple_key.mark, - end_mark: simple_key.mark, - } - yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) - - // In the block context, we may need to add the BLOCK-MAPPING-START token. - if !yaml_parser_roll_indent(parser, simple_key.mark.column, - simple_key.token_number, - yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { - return false - } - - // Remove the simple key. - simple_key.possible = false - delete(parser.simple_keys_by_tok, simple_key.token_number) - - // A simple key cannot follow another simple key. - parser.simple_key_allowed = false - - } else { - // The ':' indicator follows a complex key. - - // In the block context, extra checks are required. - if parser.flow_level == 0 { - - // Check if we are allowed to start a complex value. - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "mapping values are not allowed in this context") - } - - // Add the BLOCK-MAPPING-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { - return false - } - } - - // Simple keys after ':' are allowed in the block context. - parser.simple_key_allowed = parser.flow_level == 0 - } - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the VALUE token and append it to the queue. - token := yaml_token_t{ - typ: yaml_VALUE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the ALIAS or ANCHOR token. -func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // An anchor or an alias could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow an anchor or an alias. - parser.simple_key_allowed = false - - // Create the ALIAS or ANCHOR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_anchor(parser, &token, typ) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the TAG token. -func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { - // A tag could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a tag. - parser.simple_key_allowed = false - - // Create the TAG token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_tag(parser, &token) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. -func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { - // Remove any potential simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // A simple key may follow a block scalar. - parser.simple_key_allowed = true - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_block_scalar(parser, &token, literal) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. -func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { - // A plain scalar could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a flow scalar. - parser.simple_key_allowed = false - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_flow_scalar(parser, &token, single) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,plain) token. -func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { - // A plain scalar could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a flow scalar. - parser.simple_key_allowed = false - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_plain_scalar(parser, &token) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Eat whitespaces and comments until the next token is found. -func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { - - // Until the next token is not found. - for { - // Allow the BOM mark to start a line. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { - skip(parser) - } - - // Eat whitespaces. - // Tabs are allowed: - // - in the flow context - // - in the block context, but not at the beginning of the line or - // after '-', '?', or ':' (complex value). - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Eat a comment until a line break. - if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // If it is a line break, eat it. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - - // In the block context, a new line may start a simple key. - if parser.flow_level == 0 { - parser.simple_key_allowed = true - } - } else { - break // We have found a token. - } - } - - return true -} - -// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// -func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { - // Eat '%'. - start_mark := parser.mark - skip(parser) - - // Scan the directive name. - var name []byte - if !yaml_parser_scan_directive_name(parser, start_mark, &name) { - return false - } - - // Is it a YAML directive? - if bytes.Equal(name, []byte("YAML")) { - // Scan the VERSION directive value. - var major, minor int8 - if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { - return false - } - end_mark := parser.mark - - // Create a VERSION-DIRECTIVE token. - *token = yaml_token_t{ - typ: yaml_VERSION_DIRECTIVE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - major: major, - minor: minor, - } - - // Is it a TAG directive? - } else if bytes.Equal(name, []byte("TAG")) { - // Scan the TAG directive value. - var handle, prefix []byte - if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { - return false - } - end_mark := parser.mark - - // Create a TAG-DIRECTIVE token. - *token = yaml_token_t{ - typ: yaml_TAG_DIRECTIVE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: handle, - prefix: prefix, - } - - // Unknown directive. - } else { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "found unknown directive name") - return false - } - - // Eat the rest of the line including any comments. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // Check if we are at the end of the line. - if !is_breakz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "did not find expected comment or line break") - return false - } - - // Eat a line break. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } - - return true -} - -// Scan the directive name. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ -// -func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { - // Consume the directive name. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - var s []byte - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the name is empty. - if len(s) == 0 { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "could not find expected directive name") - return false - } - - // Check for an blank character after the name. - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "found unexpected non-alphabetical character") - return false - } - *name = s - return true -} - -// Scan the value of VERSION-DIRECTIVE. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ -func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { - // Eat whitespaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Consume the major version number. - if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { - return false - } - - // Eat '.'. - if parser.buffer[parser.buffer_pos] != '.' { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "did not find expected digit or '.' character") - } - - skip(parser) - - // Consume the minor version number. - if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { - return false - } - return true -} - -const max_number_length = 2 - -// Scan the version number of VERSION-DIRECTIVE. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ -func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { - - // Repeat while the next character is digit. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - var value, length int8 - for is_digit(parser.buffer, parser.buffer_pos) { - // Check if the number is too long. - length++ - if length > max_number_length { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "found extremely long version number") - } - value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the number was present. - if length == 0 { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "did not find expected version number") - } - *number = value - return true -} - -// Scan the value of a TAG-DIRECTIVE token. -// -// Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// -func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { - var handle_value, prefix_value []byte - - // Eat whitespaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Scan a handle. - if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { - return false - } - - // Expect a whitespace. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blank(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", - start_mark, "did not find expected whitespace") - return false - } - - // Eat whitespaces. - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Scan a prefix. - if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { - return false - } - - // Expect a whitespace or line break. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", - start_mark, "did not find expected whitespace or line break") - return false - } - - *handle = handle_value - *prefix = prefix_value - return true -} - -func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { - var s []byte - - // Eat the indicator character. - start_mark := parser.mark - skip(parser) - - // Consume the value. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - end_mark := parser.mark - - /* - * Check if length of the anchor is greater than 0 and it is followed by - * a whitespace character or one of the indicators: - * - * '?', ':', ',', ']', '}', '%', '@', '`'. - */ - - if len(s) == 0 || - !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || - parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || - parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || - parser.buffer[parser.buffer_pos] == '`') { - context := "while scanning an alias" - if typ == yaml_ANCHOR_TOKEN { - context = "while scanning an anchor" - } - yaml_parser_set_scanner_error(parser, context, start_mark, - "did not find expected alphabetic or numeric character") - return false - } - - // Create a token. - *token = yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - value: s, - } - - return true -} - -/* - * Scan a TAG token. - */ - -func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { - var handle, suffix []byte - - start_mark := parser.mark - - // Check if the tag is in the canonical form. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - if parser.buffer[parser.buffer_pos+1] == '<' { - // Keep the handle as '' - - // Eat '!<' - skip(parser) - skip(parser) - - // Consume the tag value. - if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { - return false - } - - // Check for '>' and eat it. - if parser.buffer[parser.buffer_pos] != '>' { - yaml_parser_set_scanner_error(parser, "while scanning a tag", - start_mark, "did not find the expected '>'") - return false - } - - skip(parser) - } else { - // The tag has either the '!suffix' or the '!handle!suffix' form. - - // First, try to scan a handle. - if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { - return false - } - - // Check if it is, indeed, handle. - if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { - // Scan the suffix now. - if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { - return false - } - } else { - // It wasn't a handle after all. Scan the rest of the tag. - if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { - return false - } - - // Set the handle to '!'. - handle = []byte{'!'} - - // A special case: the '!' tag. Set the handle to '' and the - // suffix to '!'. - if len(suffix) == 0 { - handle, suffix = suffix, handle - } - } - } - - // Check the character which ends the tag. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a tag", - start_mark, "did not find expected whitespace or line break") - return false - } - - end_mark := parser.mark - - // Create a token. - *token = yaml_token_t{ - typ: yaml_TAG_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: handle, - suffix: suffix, - } - return true -} - -// Scan a tag handle. -func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { - // Check the initial '!' character. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.buffer[parser.buffer_pos] != '!' { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected '!'") - return false - } - - var s []byte - - // Copy the '!' character. - s = read(parser, s) - - // Copy all subsequent alphabetical and numerical characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the trailing character is '!' and copy it. - if parser.buffer[parser.buffer_pos] == '!' { - s = read(parser, s) - } else { - // It's either the '!' tag or not really a tag handle. If it's a %TAG - // directive, it's an error. If it's a tag token, it must be a part of URI. - if directive && string(s) != "!" { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected '!'") - return false - } - } - - *handle = s - return true -} - -// Scan a tag. -func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { - //size_t length = head ? strlen((char *)head) : 0 - var s []byte - hasTag := len(head) > 0 - - // Copy the head if needed. - // - // Note that we don't copy the leading '!' character. - if len(head) > 1 { - s = append(s, head[1:]...) - } - - // Scan the tag. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // The set of characters that may appear in URI is as follows: - // - // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', - // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', - // '%'. - // [Go] Convert this into more reasonable logic. - for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || - parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || - parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || - parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || - parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || - parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || - parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || - parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || - parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || - parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || - parser.buffer[parser.buffer_pos] == '%' { - // Check if it is a URI-escape sequence. - if parser.buffer[parser.buffer_pos] == '%' { - if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { - return false - } - } else { - s = read(parser, s) - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - hasTag = true - } - - if !hasTag { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected tag URI") - return false - } - *uri = s - return true -} - -// Decode an URI-escape sequence corresponding to a single UTF-8 character. -func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { - - // Decode the required number of characters. - w := 1024 - for w > 0 { - // Check for a URI-escaped octet. - if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { - return false - } - - if !(parser.buffer[parser.buffer_pos] == '%' && - is_hex(parser.buffer, parser.buffer_pos+1) && - is_hex(parser.buffer, parser.buffer_pos+2)) { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find URI escaped octet") - } - - // Get the octet. - octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) - - // If it is the leading octet, determine the length of the UTF-8 sequence. - if w == 1024 { - w = width(octet) - if w == 0 { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "found an incorrect leading UTF-8 octet") - } - } else { - // Check if the trailing octet is correct. - if octet&0xC0 != 0x80 { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "found an incorrect trailing UTF-8 octet") - } - } - - // Copy the octet and move the pointers. - *s = append(*s, octet) - skip(parser) - skip(parser) - skip(parser) - w-- - } - return true -} - -// Scan a block scalar. -func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { - // Eat the indicator '|' or '>'. - start_mark := parser.mark - skip(parser) - - // Scan the additional block scalar indicators. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check for a chomping indicator. - var chomping, increment int - if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { - // Set the chomping method and eat the indicator. - if parser.buffer[parser.buffer_pos] == '+' { - chomping = +1 - } else { - chomping = -1 - } - skip(parser) - - // Check for an indentation indicator. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if is_digit(parser.buffer, parser.buffer_pos) { - // Check that the indentation is greater than 0. - if parser.buffer[parser.buffer_pos] == '0' { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found an indentation indicator equal to 0") - return false - } - - // Get the indentation level and eat the indicator. - increment = as_digit(parser.buffer, parser.buffer_pos) - skip(parser) - } - - } else if is_digit(parser.buffer, parser.buffer_pos) { - // Do the same as above, but in the opposite order. - - if parser.buffer[parser.buffer_pos] == '0' { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found an indentation indicator equal to 0") - return false - } - increment = as_digit(parser.buffer, parser.buffer_pos) - skip(parser) - - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { - if parser.buffer[parser.buffer_pos] == '+' { - chomping = +1 - } else { - chomping = -1 - } - skip(parser) - } - } - - // Eat whitespaces and comments to the end of the line. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // Check if we are at the end of the line. - if !is_breakz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "did not find expected comment or line break") - return false - } - - // Eat a line break. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } - - end_mark := parser.mark - - // Set the indentation level if it was specified. - var indent int - if increment > 0 { - if parser.indent >= 0 { - indent = parser.indent + increment - } else { - indent = increment - } - } - - // Scan the leading line breaks and determine the indentation level if needed. - var s, leading_break, trailing_breaks []byte - if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { - return false - } - - // Scan the block scalar content. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - var leading_blank, trailing_blank bool - for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { - // We are at the beginning of a non-empty line. - - // Is it a trailing whitespace? - trailing_blank = is_blank(parser.buffer, parser.buffer_pos) - - // Check if we need to fold the leading line break. - if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { - // Do we need to join the lines by space? - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } - } else { - s = append(s, leading_break...) - } - leading_break = leading_break[:0] - - // Append the remaining line breaks. - s = append(s, trailing_breaks...) - trailing_breaks = trailing_breaks[:0] - - // Is it a leading whitespace? - leading_blank = is_blank(parser.buffer, parser.buffer_pos) - - // Consume the current line. - for !is_breakz(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Consume the line break. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - leading_break = read_line(parser, leading_break) - - // Eat the following indentation spaces and line breaks. - if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { - return false - } - } - - // Chomp the tail. - if chomping != -1 { - s = append(s, leading_break...) - } - if chomping == 1 { - s = append(s, trailing_breaks...) - } - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_LITERAL_SCALAR_STYLE, - } - if !literal { - token.style = yaml_FOLDED_SCALAR_STYLE - } - return true -} - -// Scan indentation spaces and line breaks for a block scalar. Determine the -// indentation level if needed. -func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { - *end_mark = parser.mark - - // Eat the indentation spaces and line breaks. - max_indent := 0 - for { - // Eat the indentation spaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - if parser.mark.column > max_indent { - max_indent = parser.mark.column - } - - // Check for a tab character messing the indentation. - if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { - return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found a tab character where an indentation space is expected") - } - - // Have we found a non-empty line? - if !is_break(parser.buffer, parser.buffer_pos) { - break - } - - // Consume the line break. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - // [Go] Should really be returning breaks instead. - *breaks = read_line(parser, *breaks) - *end_mark = parser.mark - } - - // Determine the indentation level if needed. - if *indent == 0 { - *indent = max_indent - if *indent < parser.indent+1 { - *indent = parser.indent + 1 - } - if *indent < 1 { - *indent = 1 - } - } - return true -} - -// Scan a quoted scalar. -func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { - // Eat the left quote. - start_mark := parser.mark - skip(parser) - - // Consume the content of the quoted scalar. - var s, leading_break, trailing_breaks, whitespaces []byte - for { - // Check that there are no document indicators at the beginning of the line. - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - - if parser.mark.column == 0 && - ((parser.buffer[parser.buffer_pos+0] == '-' && - parser.buffer[parser.buffer_pos+1] == '-' && - parser.buffer[parser.buffer_pos+2] == '-') || - (parser.buffer[parser.buffer_pos+0] == '.' && - parser.buffer[parser.buffer_pos+1] == '.' && - parser.buffer[parser.buffer_pos+2] == '.')) && - is_blankz(parser.buffer, parser.buffer_pos+3) { - yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", - start_mark, "found unexpected document indicator") - return false - } - - // Check for EOF. - if is_z(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", - start_mark, "found unexpected end of stream") - return false - } - - // Consume non-blank characters. - leading_blanks := false - for !is_blankz(parser.buffer, parser.buffer_pos) { - if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { - // Is is an escaped single quote. - s = append(s, '\'') - skip(parser) - skip(parser) - - } else if single && parser.buffer[parser.buffer_pos] == '\'' { - // It is a right single quote. - break - } else if !single && parser.buffer[parser.buffer_pos] == '"' { - // It is a right double quote. - break - - } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { - // It is an escaped line break. - if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { - return false - } - skip(parser) - skip_line(parser) - leading_blanks = true - break - - } else if !single && parser.buffer[parser.buffer_pos] == '\\' { - // It is an escape sequence. - code_length := 0 - - // Check the escape character. - switch parser.buffer[parser.buffer_pos+1] { - case '0': - s = append(s, 0) - case 'a': - s = append(s, '\x07') - case 'b': - s = append(s, '\x08') - case 't', '\t': - s = append(s, '\x09') - case 'n': - s = append(s, '\x0A') - case 'v': - s = append(s, '\x0B') - case 'f': - s = append(s, '\x0C') - case 'r': - s = append(s, '\x0D') - case 'e': - s = append(s, '\x1B') - case ' ': - s = append(s, '\x20') - case '"': - s = append(s, '"') - case '\'': - s = append(s, '\'') - case '\\': - s = append(s, '\\') - case 'N': // NEL (#x85) - s = append(s, '\xC2') - s = append(s, '\x85') - case '_': // #xA0 - s = append(s, '\xC2') - s = append(s, '\xA0') - case 'L': // LS (#x2028) - s = append(s, '\xE2') - s = append(s, '\x80') - s = append(s, '\xA8') - case 'P': // PS (#x2029) - s = append(s, '\xE2') - s = append(s, '\x80') - s = append(s, '\xA9') - case 'x': - code_length = 2 - case 'u': - code_length = 4 - case 'U': - code_length = 8 - default: - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "found unknown escape character") - return false - } - - skip(parser) - skip(parser) - - // Consume an arbitrary escape code. - if code_length > 0 { - var value int - - // Scan the character value. - if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { - return false - } - for k := 0; k < code_length; k++ { - if !is_hex(parser.buffer, parser.buffer_pos+k) { - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "did not find expected hexdecimal number") - return false - } - value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) - } - - // Check the value and write the character. - if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "found invalid Unicode character escape code") - return false - } - if value <= 0x7F { - s = append(s, byte(value)) - } else if value <= 0x7FF { - s = append(s, byte(0xC0+(value>>6))) - s = append(s, byte(0x80+(value&0x3F))) - } else if value <= 0xFFFF { - s = append(s, byte(0xE0+(value>>12))) - s = append(s, byte(0x80+((value>>6)&0x3F))) - s = append(s, byte(0x80+(value&0x3F))) - } else { - s = append(s, byte(0xF0+(value>>18))) - s = append(s, byte(0x80+((value>>12)&0x3F))) - s = append(s, byte(0x80+((value>>6)&0x3F))) - s = append(s, byte(0x80+(value&0x3F))) - } - - // Advance the pointer. - for k := 0; k < code_length; k++ { - skip(parser) - } - } - } else { - // It is a non-escaped non-blank character. - s = read(parser, s) - } - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - } - - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check if we are at the end of the scalar. - if single { - if parser.buffer[parser.buffer_pos] == '\'' { - break - } - } else { - if parser.buffer[parser.buffer_pos] == '"' { - break - } - } - - // Consume blank characters. - for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { - if is_blank(parser.buffer, parser.buffer_pos) { - // Consume a space or a tab character. - if !leading_blanks { - whitespaces = read(parser, whitespaces) - } else { - skip(parser) - } - } else { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - // Check if it is a first line break. - if !leading_blanks { - whitespaces = whitespaces[:0] - leading_break = read_line(parser, leading_break) - leading_blanks = true - } else { - trailing_breaks = read_line(parser, trailing_breaks) - } - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Join the whitespaces or fold line breaks. - if leading_blanks { - // Do we need to fold line breaks? - if len(leading_break) > 0 && leading_break[0] == '\n' { - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } else { - s = append(s, trailing_breaks...) - } - } else { - s = append(s, leading_break...) - s = append(s, trailing_breaks...) - } - trailing_breaks = trailing_breaks[:0] - leading_break = leading_break[:0] - } else { - s = append(s, whitespaces...) - whitespaces = whitespaces[:0] - } - } - - // Eat the right quote. - skip(parser) - end_mark := parser.mark - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_SINGLE_QUOTED_SCALAR_STYLE, - } - if !single { - token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - return true -} - -// Scan a plain scalar. -func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { - - var s, leading_break, trailing_breaks, whitespaces []byte - var leading_blanks bool - var indent = parser.indent + 1 - - start_mark := parser.mark - end_mark := parser.mark - - // Consume the content of the plain scalar. - for { - // Check for a document indicator. - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - if parser.mark.column == 0 && - ((parser.buffer[parser.buffer_pos+0] == '-' && - parser.buffer[parser.buffer_pos+1] == '-' && - parser.buffer[parser.buffer_pos+2] == '-') || - (parser.buffer[parser.buffer_pos+0] == '.' && - parser.buffer[parser.buffer_pos+1] == '.' && - parser.buffer[parser.buffer_pos+2] == '.')) && - is_blankz(parser.buffer, parser.buffer_pos+3) { - break - } - - // Check for a comment. - if parser.buffer[parser.buffer_pos] == '#' { - break - } - - // Consume non-blank characters. - for !is_blankz(parser.buffer, parser.buffer_pos) { - - // Check for indicators that may end a plain scalar. - if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || - (parser.flow_level > 0 && - (parser.buffer[parser.buffer_pos] == ',' || - parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || - parser.buffer[parser.buffer_pos] == '}')) { - break - } - - // Check if we need to join whitespaces and breaks. - if leading_blanks || len(whitespaces) > 0 { - if leading_blanks { - // Do we need to fold line breaks? - if leading_break[0] == '\n' { - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } else { - s = append(s, trailing_breaks...) - } - } else { - s = append(s, leading_break...) - s = append(s, trailing_breaks...) - } - trailing_breaks = trailing_breaks[:0] - leading_break = leading_break[:0] - leading_blanks = false - } else { - s = append(s, whitespaces...) - whitespaces = whitespaces[:0] - } - } - - // Copy the character. - s = read(parser, s) - - end_mark = parser.mark - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - } - - // Is it the end? - if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { - break - } - - // Consume blank characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { - if is_blank(parser.buffer, parser.buffer_pos) { - - // Check for tab characters that abuse indentation. - if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", - start_mark, "found a tab character that violates indentation") - return false - } - - // Consume a space or a tab character. - if !leading_blanks { - whitespaces = read(parser, whitespaces) - } else { - skip(parser) - } - } else { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - // Check if it is a first line break. - if !leading_blanks { - whitespaces = whitespaces[:0] - leading_break = read_line(parser, leading_break) - leading_blanks = true - } else { - trailing_breaks = read_line(parser, trailing_breaks) - } - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check indentation level. - if parser.flow_level == 0 && parser.mark.column < indent { - break - } - } - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_PLAIN_SCALAR_STYLE, - } - - // Note that we change the 'simple_key_allowed' flag. - if leading_blanks { - parser.simple_key_allowed = true - } - return true -} diff --git a/vendor/gopkg.in/yaml.v2/sorter.go b/vendor/gopkg.in/yaml.v2/sorter.go deleted file mode 100644 index 4c45e660a..000000000 --- a/vendor/gopkg.in/yaml.v2/sorter.go +++ /dev/null @@ -1,113 +0,0 @@ -package yaml - -import ( - "reflect" - "unicode" -) - -type keyList []reflect.Value - -func (l keyList) Len() int { return len(l) } -func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } -func (l keyList) Less(i, j int) bool { - a := l[i] - b := l[j] - ak := a.Kind() - bk := b.Kind() - for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { - a = a.Elem() - ak = a.Kind() - } - for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { - b = b.Elem() - bk = b.Kind() - } - af, aok := keyFloat(a) - bf, bok := keyFloat(b) - if aok && bok { - if af != bf { - return af < bf - } - if ak != bk { - return ak < bk - } - return numLess(a, b) - } - if ak != reflect.String || bk != reflect.String { - return ak < bk - } - ar, br := []rune(a.String()), []rune(b.String()) - for i := 0; i < len(ar) && i < len(br); i++ { - if ar[i] == br[i] { - continue - } - al := unicode.IsLetter(ar[i]) - bl := unicode.IsLetter(br[i]) - if al && bl { - return ar[i] < br[i] - } - if al || bl { - return bl - } - var ai, bi int - var an, bn int64 - if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { - if ar[j] != '0' { - an = 1 - bn = 1 - break - } - } - } - for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { - an = an*10 + int64(ar[ai]-'0') - } - for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { - bn = bn*10 + int64(br[bi]-'0') - } - if an != bn { - return an < bn - } - if ai != bi { - return ai < bi - } - return ar[i] < br[i] - } - return len(ar) < len(br) -} - -// keyFloat returns a float value for v if it is a number/bool -// and whether it is a number/bool or not. -func keyFloat(v reflect.Value) (f float64, ok bool) { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return float64(v.Int()), true - case reflect.Float32, reflect.Float64: - return v.Float(), true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return float64(v.Uint()), true - case reflect.Bool: - if v.Bool() { - return 1, true - } - return 0, true - } - return 0, false -} - -// numLess returns whether a < b. -// a and b must necessarily have the same kind. -func numLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return a.Int() < b.Int() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Bool: - return !a.Bool() && b.Bool() - } - panic("not a number") -} diff --git a/vendor/gopkg.in/yaml.v2/writerc.go b/vendor/gopkg.in/yaml.v2/writerc.go deleted file mode 100644 index a2dde608c..000000000 --- a/vendor/gopkg.in/yaml.v2/writerc.go +++ /dev/null @@ -1,26 +0,0 @@ -package yaml - -// Set the writer error and return false. -func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_WRITER_ERROR - emitter.problem = problem - return false -} - -// Flush the output buffer. -func yaml_emitter_flush(emitter *yaml_emitter_t) bool { - if emitter.write_handler == nil { - panic("write handler not set") - } - - // Check if the buffer is empty. - if emitter.buffer_pos == 0 { - return true - } - - if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { - return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) - } - emitter.buffer_pos = 0 - return true -} diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go deleted file mode 100644 index 89650e293..000000000 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ /dev/null @@ -1,466 +0,0 @@ -// Package yaml implements YAML support for the Go language. -// -// Source code and other details for the project are available at GitHub: -// -// https://github.com/go-yaml/yaml -// -package yaml - -import ( - "errors" - "fmt" - "io" - "reflect" - "strings" - "sync" -) - -// MapSlice encodes and decodes as a YAML map. -// The order of keys is preserved when encoding and decoding. -type MapSlice []MapItem - -// MapItem is an item in a MapSlice. -type MapItem struct { - Key, Value interface{} -} - -// The Unmarshaler interface may be implemented by types to customize their -// behavior when being unmarshaled from a YAML document. The UnmarshalYAML -// method receives a function that may be called to unmarshal the original -// YAML value into a field or variable. It is safe to call the unmarshal -// function parameter more than once if necessary. -type Unmarshaler interface { - UnmarshalYAML(unmarshal func(interface{}) error) error -} - -// The Marshaler interface may be implemented by types to customize their -// behavior when being marshaled into a YAML document. The returned value -// is marshaled in place of the original value implementing Marshaler. -// -// If an error is returned by MarshalYAML, the marshaling procedure stops -// and returns with the provided error. -type Marshaler interface { - MarshalYAML() (interface{}, error) -} - -// Unmarshal decodes the first document found within the in byte slice -// and assigns decoded values into the out value. -// -// Maps and pointers (to a struct, string, int, etc) are accepted as out -// values. If an internal pointer within a struct is not initialized, -// the yaml package will initialize it if necessary for unmarshalling -// the provided data. The out parameter must not be nil. -// -// The type of the decoded values should be compatible with the respective -// values in out. If one or more values cannot be decoded due to a type -// mismatches, decoding continues partially until the end of the YAML -// content, and a *yaml.TypeError is returned with details for all -// missed values. -// -// Struct fields are only unmarshalled if they are exported (have an -// upper case first letter), and are unmarshalled using the field name -// lowercased as the default key. Custom keys may be defined via the -// "yaml" name in the field tag: the content preceding the first comma -// is used as the key, and the following comma-separated options are -// used to tweak the marshalling process (see Marshal). -// Conflicting names result in a runtime error. -// -// For example: -// -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) -// -// See the documentation of Marshal for the format of tags and a list of -// supported tag options. -// -func Unmarshal(in []byte, out interface{}) (err error) { - return unmarshal(in, out, false) -} - -// UnmarshalStrict is like Unmarshal except that any fields that are found -// in the data that do not have corresponding struct members, or mapping -// keys that are duplicates, will result in -// an error. -func UnmarshalStrict(in []byte, out interface{}) (err error) { - return unmarshal(in, out, true) -} - -// A Decoder reads and decodes YAML values from an input stream. -type Decoder struct { - strict bool - parser *parser -} - -// NewDecoder returns a new decoder that reads from r. -// -// The decoder introduces its own buffering and may read -// data from r beyond the YAML values requested. -func NewDecoder(r io.Reader) *Decoder { - return &Decoder{ - parser: newParserFromReader(r), - } -} - -// SetStrict sets whether strict decoding behaviour is enabled when -// decoding items in the data (see UnmarshalStrict). By default, decoding is not strict. -func (dec *Decoder) SetStrict(strict bool) { - dec.strict = strict -} - -// Decode reads the next YAML-encoded value from its input -// and stores it in the value pointed to by v. -// -// See the documentation for Unmarshal for details about the -// conversion of YAML into a Go value. -func (dec *Decoder) Decode(v interface{}) (err error) { - d := newDecoder(dec.strict) - defer handleErr(&err) - node := dec.parser.parse() - if node == nil { - return io.EOF - } - out := reflect.ValueOf(v) - if out.Kind() == reflect.Ptr && !out.IsNil() { - out = out.Elem() - } - d.unmarshal(node, out) - if len(d.terrors) > 0 { - return &TypeError{d.terrors} - } - return nil -} - -func unmarshal(in []byte, out interface{}, strict bool) (err error) { - defer handleErr(&err) - d := newDecoder(strict) - p := newParser(in) - defer p.destroy() - node := p.parse() - if node != nil { - v := reflect.ValueOf(out) - if v.Kind() == reflect.Ptr && !v.IsNil() { - v = v.Elem() - } - d.unmarshal(node, v) - } - if len(d.terrors) > 0 { - return &TypeError{d.terrors} - } - return nil -} - -// Marshal serializes the value provided into a YAML document. The structure -// of the generated document will reflect the structure of the value itself. -// Maps and pointers (to struct, string, int, etc) are accepted as the in value. -// -// Struct fields are only marshalled if they are exported (have an upper case -// first letter), and are marshalled using the field name lowercased as the -// default key. Custom keys may be defined via the "yaml" name in the field -// tag: the content preceding the first comma is used as the key, and the -// following comma-separated options are used to tweak the marshalling process. -// Conflicting names result in a runtime error. -// -// The field tag format accepted is: -// -// `(...) yaml:"[][,[,]]" (...)` -// -// The following flags are currently supported: -// -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be included if that method returns true. -// -// flow Marshal using a flow style (useful for structs, -// sequences and maps). -// -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. -// -// In addition, if the key is "-", the field is ignored. -// -// For example: -// -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// -func Marshal(in interface{}) (out []byte, err error) { - defer handleErr(&err) - e := newEncoder() - defer e.destroy() - e.marshalDoc("", reflect.ValueOf(in)) - e.finish() - out = e.out - return -} - -// An Encoder writes YAML values to an output stream. -type Encoder struct { - encoder *encoder -} - -// NewEncoder returns a new encoder that writes to w. -// The Encoder should be closed after use to flush all data -// to w. -func NewEncoder(w io.Writer) *Encoder { - return &Encoder{ - encoder: newEncoderWithWriter(w), - } -} - -// Encode writes the YAML encoding of v to the stream. -// If multiple items are encoded to the stream, the -// second and subsequent document will be preceded -// with a "---" document separator, but the first will not. -// -// See the documentation for Marshal for details about the conversion of Go -// values to YAML. -func (e *Encoder) Encode(v interface{}) (err error) { - defer handleErr(&err) - e.encoder.marshalDoc("", reflect.ValueOf(v)) - return nil -} - -// Close closes the encoder by writing any remaining data. -// It does not write a stream terminating string "...". -func (e *Encoder) Close() (err error) { - defer handleErr(&err) - e.encoder.finish() - return nil -} - -func handleErr(err *error) { - if v := recover(); v != nil { - if e, ok := v.(yamlError); ok { - *err = e.err - } else { - panic(v) - } - } -} - -type yamlError struct { - err error -} - -func fail(err error) { - panic(yamlError{err}) -} - -func failf(format string, args ...interface{}) { - panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) -} - -// A TypeError is returned by Unmarshal when one or more fields in -// the YAML document cannot be properly decoded into the requested -// types. When this error is returned, the value is still -// unmarshaled partially. -type TypeError struct { - Errors []string -} - -func (e *TypeError) Error() string { - return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) -} - -// -------------------------------------------------------------------------- -// Maintain a mapping of keys to structure field indexes - -// The code in this section was copied from mgo/bson. - -// structInfo holds details for the serialization of fields of -// a given struct. -type structInfo struct { - FieldsMap map[string]fieldInfo - FieldsList []fieldInfo - - // InlineMap is the number of the field in the struct that - // contains an ,inline map, or -1 if there's none. - InlineMap int -} - -type fieldInfo struct { - Key string - Num int - OmitEmpty bool - Flow bool - // Id holds the unique field identifier, so we can cheaply - // check for field duplicates without maintaining an extra map. - Id int - - // Inline holds the field index if the field is part of an inlined struct. - Inline []int -} - -var structMap = make(map[reflect.Type]*structInfo) -var fieldMapMutex sync.RWMutex - -func getStructInfo(st reflect.Type) (*structInfo, error) { - fieldMapMutex.RLock() - sinfo, found := structMap[st] - fieldMapMutex.RUnlock() - if found { - return sinfo, nil - } - - n := st.NumField() - fieldsMap := make(map[string]fieldInfo) - fieldsList := make([]fieldInfo, 0, n) - inlineMap := -1 - for i := 0; i != n; i++ { - field := st.Field(i) - if field.PkgPath != "" && !field.Anonymous { - continue // Private field - } - - info := fieldInfo{Num: i} - - tag := field.Tag.Get("yaml") - if tag == "" && strings.Index(string(field.Tag), ":") < 0 { - tag = string(field.Tag) - } - if tag == "-" { - continue - } - - inline := false - fields := strings.Split(tag, ",") - if len(fields) > 1 { - for _, flag := range fields[1:] { - switch flag { - case "omitempty": - info.OmitEmpty = true - case "flow": - info.Flow = true - case "inline": - inline = true - default: - return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st)) - } - } - tag = fields[0] - } - - if inline { - switch field.Type.Kind() { - case reflect.Map: - if inlineMap >= 0 { - return nil, errors.New("Multiple ,inline maps in struct " + st.String()) - } - if field.Type.Key() != reflect.TypeOf("") { - return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String()) - } - inlineMap = info.Num - case reflect.Struct: - sinfo, err := getStructInfo(field.Type) - if err != nil { - return nil, err - } - for _, finfo := range sinfo.FieldsList { - if _, found := fieldsMap[finfo.Key]; found { - msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String() - return nil, errors.New(msg) - } - if finfo.Inline == nil { - finfo.Inline = []int{i, finfo.Num} - } else { - finfo.Inline = append([]int{i}, finfo.Inline...) - } - finfo.Id = len(fieldsList) - fieldsMap[finfo.Key] = finfo - fieldsList = append(fieldsList, finfo) - } - default: - //return nil, errors.New("Option ,inline needs a struct value or map field") - return nil, errors.New("Option ,inline needs a struct value field") - } - continue - } - - if tag != "" { - info.Key = tag - } else { - info.Key = strings.ToLower(field.Name) - } - - if _, found = fieldsMap[info.Key]; found { - msg := "Duplicated key '" + info.Key + "' in struct " + st.String() - return nil, errors.New(msg) - } - - info.Id = len(fieldsList) - fieldsList = append(fieldsList, info) - fieldsMap[info.Key] = info - } - - sinfo = &structInfo{ - FieldsMap: fieldsMap, - FieldsList: fieldsList, - InlineMap: inlineMap, - } - - fieldMapMutex.Lock() - structMap[st] = sinfo - fieldMapMutex.Unlock() - return sinfo, nil -} - -// IsZeroer is used to check whether an object is zero to -// determine whether it should be omitted when marshaling -// with the omitempty flag. One notable implementation -// is time.Time. -type IsZeroer interface { - IsZero() bool -} - -func isZero(v reflect.Value) bool { - kind := v.Kind() - if z, ok := v.Interface().(IsZeroer); ok { - if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { - return true - } - return z.IsZero() - } - switch kind { - case reflect.String: - return len(v.String()) == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - case reflect.Slice: - return v.Len() == 0 - case reflect.Map: - return v.Len() == 0 - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Struct: - vt := v.Type() - for i := v.NumField() - 1; i >= 0; i-- { - if vt.Field(i).PkgPath != "" { - continue // Private field - } - if !isZero(v.Field(i)) { - return false - } - } - return true - } - return false -} diff --git a/vendor/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v2/yamlh.go deleted file mode 100644 index f6a9c8e34..000000000 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ /dev/null @@ -1,739 +0,0 @@ -package yaml - -import ( - "fmt" - "io" -) - -// The version directive data. -type yaml_version_directive_t struct { - major int8 // The major version number. - minor int8 // The minor version number. -} - -// The tag directive data. -type yaml_tag_directive_t struct { - handle []byte // The tag handle. - prefix []byte // The tag prefix. -} - -type yaml_encoding_t int - -// The stream encoding. -const ( - // Let the parser choose the encoding. - yaml_ANY_ENCODING yaml_encoding_t = iota - - yaml_UTF8_ENCODING // The default UTF-8 encoding. - yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. - yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. -) - -type yaml_break_t int - -// Line break types. -const ( - // Let the parser choose the break type. - yaml_ANY_BREAK yaml_break_t = iota - - yaml_CR_BREAK // Use CR for line breaks (Mac style). - yaml_LN_BREAK // Use LN for line breaks (Unix style). - yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). -) - -type yaml_error_type_t int - -// Many bad things could happen with the parser and emitter. -const ( - // No error is produced. - yaml_NO_ERROR yaml_error_type_t = iota - - yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. - yaml_READER_ERROR // Cannot read or decode the input stream. - yaml_SCANNER_ERROR // Cannot scan the input stream. - yaml_PARSER_ERROR // Cannot parse the input stream. - yaml_COMPOSER_ERROR // Cannot compose a YAML document. - yaml_WRITER_ERROR // Cannot write to the output stream. - yaml_EMITTER_ERROR // Cannot emit a YAML stream. -) - -// The pointer position. -type yaml_mark_t struct { - index int // The position index. - line int // The position line. - column int // The position column. -} - -// Node Styles - -type yaml_style_t int8 - -type yaml_scalar_style_t yaml_style_t - -// Scalar styles. -const ( - // Let the emitter choose the style. - yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota - - yaml_PLAIN_SCALAR_STYLE // The plain scalar style. - yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. - yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. - yaml_LITERAL_SCALAR_STYLE // The literal scalar style. - yaml_FOLDED_SCALAR_STYLE // The folded scalar style. -) - -type yaml_sequence_style_t yaml_style_t - -// Sequence styles. -const ( - // Let the emitter choose the style. - yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota - - yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. - yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. -) - -type yaml_mapping_style_t yaml_style_t - -// Mapping styles. -const ( - // Let the emitter choose the style. - yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota - - yaml_BLOCK_MAPPING_STYLE // The block mapping style. - yaml_FLOW_MAPPING_STYLE // The flow mapping style. -) - -// Tokens - -type yaml_token_type_t int - -// Token types. -const ( - // An empty token. - yaml_NO_TOKEN yaml_token_type_t = iota - - yaml_STREAM_START_TOKEN // A STREAM-START token. - yaml_STREAM_END_TOKEN // A STREAM-END token. - - yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. - yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. - yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. - yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. - - yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. - yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. - yaml_BLOCK_END_TOKEN // A BLOCK-END token. - - yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. - yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. - yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. - yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. - - yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. - yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. - yaml_KEY_TOKEN // A KEY token. - yaml_VALUE_TOKEN // A VALUE token. - - yaml_ALIAS_TOKEN // An ALIAS token. - yaml_ANCHOR_TOKEN // An ANCHOR token. - yaml_TAG_TOKEN // A TAG token. - yaml_SCALAR_TOKEN // A SCALAR token. -) - -func (tt yaml_token_type_t) String() string { - switch tt { - case yaml_NO_TOKEN: - return "yaml_NO_TOKEN" - case yaml_STREAM_START_TOKEN: - return "yaml_STREAM_START_TOKEN" - case yaml_STREAM_END_TOKEN: - return "yaml_STREAM_END_TOKEN" - case yaml_VERSION_DIRECTIVE_TOKEN: - return "yaml_VERSION_DIRECTIVE_TOKEN" - case yaml_TAG_DIRECTIVE_TOKEN: - return "yaml_TAG_DIRECTIVE_TOKEN" - case yaml_DOCUMENT_START_TOKEN: - return "yaml_DOCUMENT_START_TOKEN" - case yaml_DOCUMENT_END_TOKEN: - return "yaml_DOCUMENT_END_TOKEN" - case yaml_BLOCK_SEQUENCE_START_TOKEN: - return "yaml_BLOCK_SEQUENCE_START_TOKEN" - case yaml_BLOCK_MAPPING_START_TOKEN: - return "yaml_BLOCK_MAPPING_START_TOKEN" - case yaml_BLOCK_END_TOKEN: - return "yaml_BLOCK_END_TOKEN" - case yaml_FLOW_SEQUENCE_START_TOKEN: - return "yaml_FLOW_SEQUENCE_START_TOKEN" - case yaml_FLOW_SEQUENCE_END_TOKEN: - return "yaml_FLOW_SEQUENCE_END_TOKEN" - case yaml_FLOW_MAPPING_START_TOKEN: - return "yaml_FLOW_MAPPING_START_TOKEN" - case yaml_FLOW_MAPPING_END_TOKEN: - return "yaml_FLOW_MAPPING_END_TOKEN" - case yaml_BLOCK_ENTRY_TOKEN: - return "yaml_BLOCK_ENTRY_TOKEN" - case yaml_FLOW_ENTRY_TOKEN: - return "yaml_FLOW_ENTRY_TOKEN" - case yaml_KEY_TOKEN: - return "yaml_KEY_TOKEN" - case yaml_VALUE_TOKEN: - return "yaml_VALUE_TOKEN" - case yaml_ALIAS_TOKEN: - return "yaml_ALIAS_TOKEN" - case yaml_ANCHOR_TOKEN: - return "yaml_ANCHOR_TOKEN" - case yaml_TAG_TOKEN: - return "yaml_TAG_TOKEN" - case yaml_SCALAR_TOKEN: - return "yaml_SCALAR_TOKEN" - } - return "" -} - -// The token structure. -type yaml_token_t struct { - // The token type. - typ yaml_token_type_t - - // The start/end of the token. - start_mark, end_mark yaml_mark_t - - // The stream encoding (for yaml_STREAM_START_TOKEN). - encoding yaml_encoding_t - - // The alias/anchor/scalar value or tag/tag directive handle - // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). - value []byte - - // The tag suffix (for yaml_TAG_TOKEN). - suffix []byte - - // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). - prefix []byte - - // The scalar style (for yaml_SCALAR_TOKEN). - style yaml_scalar_style_t - - // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). - major, minor int8 -} - -// Events - -type yaml_event_type_t int8 - -// Event types. -const ( - // An empty event. - yaml_NO_EVENT yaml_event_type_t = iota - - yaml_STREAM_START_EVENT // A STREAM-START event. - yaml_STREAM_END_EVENT // A STREAM-END event. - yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. - yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. - yaml_ALIAS_EVENT // An ALIAS event. - yaml_SCALAR_EVENT // A SCALAR event. - yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. - yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. - yaml_MAPPING_START_EVENT // A MAPPING-START event. - yaml_MAPPING_END_EVENT // A MAPPING-END event. -) - -var eventStrings = []string{ - yaml_NO_EVENT: "none", - yaml_STREAM_START_EVENT: "stream start", - yaml_STREAM_END_EVENT: "stream end", - yaml_DOCUMENT_START_EVENT: "document start", - yaml_DOCUMENT_END_EVENT: "document end", - yaml_ALIAS_EVENT: "alias", - yaml_SCALAR_EVENT: "scalar", - yaml_SEQUENCE_START_EVENT: "sequence start", - yaml_SEQUENCE_END_EVENT: "sequence end", - yaml_MAPPING_START_EVENT: "mapping start", - yaml_MAPPING_END_EVENT: "mapping end", -} - -func (e yaml_event_type_t) String() string { - if e < 0 || int(e) >= len(eventStrings) { - return fmt.Sprintf("unknown event %d", e) - } - return eventStrings[e] -} - -// The event structure. -type yaml_event_t struct { - - // The event type. - typ yaml_event_type_t - - // The start and end of the event. - start_mark, end_mark yaml_mark_t - - // The document encoding (for yaml_STREAM_START_EVENT). - encoding yaml_encoding_t - - // The version directive (for yaml_DOCUMENT_START_EVENT). - version_directive *yaml_version_directive_t - - // The list of tag directives (for yaml_DOCUMENT_START_EVENT). - tag_directives []yaml_tag_directive_t - - // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). - anchor []byte - - // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). - tag []byte - - // The scalar value (for yaml_SCALAR_EVENT). - value []byte - - // Is the document start/end indicator implicit, or the tag optional? - // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). - implicit bool - - // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). - quoted_implicit bool - - // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). - style yaml_style_t -} - -func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } -func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } -func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } - -// Nodes - -const ( - yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. - yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. - yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. - yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. - yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. - yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. - - yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. - yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. - - // Not in original libyaml. - yaml_BINARY_TAG = "tag:yaml.org,2002:binary" - yaml_MERGE_TAG = "tag:yaml.org,2002:merge" - - yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. - yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. - yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. -) - -type yaml_node_type_t int - -// Node types. -const ( - // An empty node. - yaml_NO_NODE yaml_node_type_t = iota - - yaml_SCALAR_NODE // A scalar node. - yaml_SEQUENCE_NODE // A sequence node. - yaml_MAPPING_NODE // A mapping node. -) - -// An element of a sequence node. -type yaml_node_item_t int - -// An element of a mapping node. -type yaml_node_pair_t struct { - key int // The key of the element. - value int // The value of the element. -} - -// The node structure. -type yaml_node_t struct { - typ yaml_node_type_t // The node type. - tag []byte // The node tag. - - // The node data. - - // The scalar parameters (for yaml_SCALAR_NODE). - scalar struct { - value []byte // The scalar value. - length int // The length of the scalar value. - style yaml_scalar_style_t // The scalar style. - } - - // The sequence parameters (for YAML_SEQUENCE_NODE). - sequence struct { - items_data []yaml_node_item_t // The stack of sequence items. - style yaml_sequence_style_t // The sequence style. - } - - // The mapping parameters (for yaml_MAPPING_NODE). - mapping struct { - pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). - pairs_start *yaml_node_pair_t // The beginning of the stack. - pairs_end *yaml_node_pair_t // The end of the stack. - pairs_top *yaml_node_pair_t // The top of the stack. - style yaml_mapping_style_t // The mapping style. - } - - start_mark yaml_mark_t // The beginning of the node. - end_mark yaml_mark_t // The end of the node. - -} - -// The document structure. -type yaml_document_t struct { - - // The document nodes. - nodes []yaml_node_t - - // The version directive. - version_directive *yaml_version_directive_t - - // The list of tag directives. - tag_directives_data []yaml_tag_directive_t - tag_directives_start int // The beginning of the tag directives list. - tag_directives_end int // The end of the tag directives list. - - start_implicit int // Is the document start indicator implicit? - end_implicit int // Is the document end indicator implicit? - - // The start/end of the document. - start_mark, end_mark yaml_mark_t -} - -// The prototype of a read handler. -// -// The read handler is called when the parser needs to read more bytes from the -// source. The handler should write not more than size bytes to the buffer. -// The number of written bytes should be set to the size_read variable. -// -// [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). -// [out] buffer The buffer to write the data from the source. -// [in] size The size of the buffer. -// [out] size_read The actual number of bytes read from the source. -// -// On success, the handler should return 1. If the handler failed, -// the returned value should be 0. On EOF, the handler should set the -// size_read to 0 and return 1. -type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) - -// This structure holds information about a potential simple key. -type yaml_simple_key_t struct { - possible bool // Is a simple key possible? - required bool // Is a simple key required? - token_number int // The number of the token. - mark yaml_mark_t // The position mark. -} - -// The states of the parser. -type yaml_parser_state_t int - -const ( - yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota - - yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. - yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. - yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. - yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. - yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. - yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. - yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. - yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. - yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. - yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. - yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. - yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. - yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. - yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. - yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. - yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. - yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. - yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. - yaml_PARSE_END_STATE // Expect nothing. -) - -func (ps yaml_parser_state_t) String() string { - switch ps { - case yaml_PARSE_STREAM_START_STATE: - return "yaml_PARSE_STREAM_START_STATE" - case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: - return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" - case yaml_PARSE_DOCUMENT_START_STATE: - return "yaml_PARSE_DOCUMENT_START_STATE" - case yaml_PARSE_DOCUMENT_CONTENT_STATE: - return "yaml_PARSE_DOCUMENT_CONTENT_STATE" - case yaml_PARSE_DOCUMENT_END_STATE: - return "yaml_PARSE_DOCUMENT_END_STATE" - case yaml_PARSE_BLOCK_NODE_STATE: - return "yaml_PARSE_BLOCK_NODE_STATE" - case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: - return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" - case yaml_PARSE_FLOW_NODE_STATE: - return "yaml_PARSE_FLOW_NODE_STATE" - case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: - return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" - case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: - return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" - case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: - return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" - case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: - return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" - case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: - return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" - case yaml_PARSE_FLOW_MAPPING_KEY_STATE: - return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" - case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: - return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: - return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" - case yaml_PARSE_END_STATE: - return "yaml_PARSE_END_STATE" - } - return "" -} - -// This structure holds aliases data. -type yaml_alias_data_t struct { - anchor []byte // The anchor. - index int // The node id. - mark yaml_mark_t // The anchor mark. -} - -// The parser structure. -// -// All members are internal. Manage the structure using the -// yaml_parser_ family of functions. -type yaml_parser_t struct { - - // Error handling - - error yaml_error_type_t // Error type. - - problem string // Error description. - - // The byte about which the problem occurred. - problem_offset int - problem_value int - problem_mark yaml_mark_t - - // The error context. - context string - context_mark yaml_mark_t - - // Reader stuff - - read_handler yaml_read_handler_t // Read handler. - - input_reader io.Reader // File input data. - input []byte // String input data. - input_pos int - - eof bool // EOF flag - - buffer []byte // The working buffer. - buffer_pos int // The current position of the buffer. - - unread int // The number of unread characters in the buffer. - - raw_buffer []byte // The raw buffer. - raw_buffer_pos int // The current position of the buffer. - - encoding yaml_encoding_t // The input encoding. - - offset int // The offset of the current position (in bytes). - mark yaml_mark_t // The mark of the current position. - - // Scanner stuff - - stream_start_produced bool // Have we started to scan the input stream? - stream_end_produced bool // Have we reached the end of the input stream? - - flow_level int // The number of unclosed '[' and '{' indicators. - - tokens []yaml_token_t // The tokens queue. - tokens_head int // The head of the tokens queue. - tokens_parsed int // The number of tokens fetched from the queue. - token_available bool // Does the tokens queue contain a token ready for dequeueing. - - indent int // The current indentation level. - indents []int // The indentation levels stack. - - simple_key_allowed bool // May a simple key occur at the current position? - simple_keys []yaml_simple_key_t // The stack of simple keys. - simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number - - // Parser stuff - - state yaml_parser_state_t // The current parser state. - states []yaml_parser_state_t // The parser states stack. - marks []yaml_mark_t // The stack of marks. - tag_directives []yaml_tag_directive_t // The list of TAG directives. - - // Dumper stuff - - aliases []yaml_alias_data_t // The alias data. - - document *yaml_document_t // The currently parsed document. -} - -// Emitter Definitions - -// The prototype of a write handler. -// -// The write handler is called when the emitter needs to flush the accumulated -// characters to the output. The handler should write @a size bytes of the -// @a buffer to the output. -// -// @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). -// @param[in] buffer The buffer with bytes to be written. -// @param[in] size The size of the buffer. -// -// @returns On success, the handler should return @c 1. If the handler failed, -// the returned value should be @c 0. -// -type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error - -type yaml_emitter_state_t int - -// The emitter states. -const ( - // Expect STREAM-START. - yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota - - yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. - yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. - yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. - yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. - yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. - yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. - yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. - yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. - yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. - yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. - yaml_EMIT_END_STATE // Expect nothing. -) - -// The emitter structure. -// -// All members are internal. Manage the structure using the @c yaml_emitter_ -// family of functions. -type yaml_emitter_t struct { - - // Error handling - - error yaml_error_type_t // Error type. - problem string // Error description. - - // Writer stuff - - write_handler yaml_write_handler_t // Write handler. - - output_buffer *[]byte // String output data. - output_writer io.Writer // File output data. - - buffer []byte // The working buffer. - buffer_pos int // The current position of the buffer. - - raw_buffer []byte // The raw buffer. - raw_buffer_pos int // The current position of the buffer. - - encoding yaml_encoding_t // The stream encoding. - - // Emitter stuff - - canonical bool // If the output is in the canonical style? - best_indent int // The number of indentation spaces. - best_width int // The preferred width of the output lines. - unicode bool // Allow unescaped non-ASCII characters? - line_break yaml_break_t // The preferred line break. - - state yaml_emitter_state_t // The current emitter state. - states []yaml_emitter_state_t // The stack of states. - - events []yaml_event_t // The event queue. - events_head int // The head of the event queue. - - indents []int // The stack of indentation levels. - - tag_directives []yaml_tag_directive_t // The list of tag directives. - - indent int // The current indentation level. - - flow_level int // The current flow level. - - root_context bool // Is it the document root context? - sequence_context bool // Is it a sequence context? - mapping_context bool // Is it a mapping context? - simple_key_context bool // Is it a simple mapping key context? - - line int // The current line. - column int // The current column. - whitespace bool // If the last character was a whitespace? - indention bool // If the last character was an indentation character (' ', '-', '?', ':')? - open_ended bool // If an explicit document end is required? - - // Anchor analysis. - anchor_data struct { - anchor []byte // The anchor value. - alias bool // Is it an alias? - } - - // Tag analysis. - tag_data struct { - handle []byte // The tag handle. - suffix []byte // The tag suffix. - } - - // Scalar analysis. - scalar_data struct { - value []byte // The scalar value. - multiline bool // Does the scalar contain line breaks? - flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? - block_plain_allowed bool // Can the scalar be expressed in the block plain style? - single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? - block_allowed bool // Can the scalar be expressed in the literal or folded styles? - style yaml_scalar_style_t // The output style. - } - - // Dumper stuff - - opened bool // If the stream was already opened? - closed bool // If the stream was already closed? - - // The information associated with the document nodes. - anchors *struct { - references int // The number of references. - anchor int // The anchor id. - serialized bool // If the node has been emitted? - } - - last_anchor_id int // The last assigned anchor id. - - document *yaml_document_t // The currently emitted document. -} diff --git a/vendor/gopkg.in/yaml.v2/yamlprivateh.go b/vendor/gopkg.in/yaml.v2/yamlprivateh.go deleted file mode 100644 index 8110ce3c3..000000000 --- a/vendor/gopkg.in/yaml.v2/yamlprivateh.go +++ /dev/null @@ -1,173 +0,0 @@ -package yaml - -const ( - // The size of the input raw buffer. - input_raw_buffer_size = 512 - - // The size of the input buffer. - // It should be possible to decode the whole raw buffer. - input_buffer_size = input_raw_buffer_size * 3 - - // The size of the output buffer. - output_buffer_size = 128 - - // The size of the output raw buffer. - // It should be possible to encode the whole output buffer. - output_raw_buffer_size = (output_buffer_size*2 + 2) - - // The size of other stacks and queues. - initial_stack_size = 16 - initial_queue_size = 16 - initial_string_size = 16 -) - -// Check if the character at the specified position is an alphabetical -// character, a digit, '_', or '-'. -func is_alpha(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' -} - -// Check if the character at the specified position is a digit. -func is_digit(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' -} - -// Get the value of a digit. -func as_digit(b []byte, i int) int { - return int(b[i]) - '0' -} - -// Check if the character at the specified position is a hex-digit. -func is_hex(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' -} - -// Get the value of a hex-digit. -func as_hex(b []byte, i int) int { - bi := b[i] - if bi >= 'A' && bi <= 'F' { - return int(bi) - 'A' + 10 - } - if bi >= 'a' && bi <= 'f' { - return int(bi) - 'a' + 10 - } - return int(bi) - '0' -} - -// Check if the character is ASCII. -func is_ascii(b []byte, i int) bool { - return b[i] <= 0x7F -} - -// Check if the character at the start of the buffer can be printed unescaped. -func is_printable(b []byte, i int) bool { - return ((b[i] == 0x0A) || // . == #x0A - (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E - (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF - (b[i] > 0xC2 && b[i] < 0xED) || - (b[i] == 0xED && b[i+1] < 0xA0) || - (b[i] == 0xEE) || - (b[i] == 0xEF && // #xE000 <= . <= #xFFFD - !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF - !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) -} - -// Check if the character at the specified position is NUL. -func is_z(b []byte, i int) bool { - return b[i] == 0x00 -} - -// Check if the beginning of the buffer is a BOM. -func is_bom(b []byte, i int) bool { - return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF -} - -// Check if the character at the specified position is space. -func is_space(b []byte, i int) bool { - return b[i] == ' ' -} - -// Check if the character at the specified position is tab. -func is_tab(b []byte, i int) bool { - return b[i] == '\t' -} - -// Check if the character at the specified position is blank (space or tab). -func is_blank(b []byte, i int) bool { - //return is_space(b, i) || is_tab(b, i) - return b[i] == ' ' || b[i] == '\t' -} - -// Check if the character at the specified position is a line break. -func is_break(b []byte, i int) bool { - return (b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) -} - -func is_crlf(b []byte, i int) bool { - return b[i] == '\r' && b[i+1] == '\n' -} - -// Check if the character is a line break or NUL. -func is_breakz(b []byte, i int) bool { - //return is_break(b, i) || is_z(b, i) - return ( // is_break: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - // is_z: - b[i] == 0) -} - -// Check if the character is a line break, space, or NUL. -func is_spacez(b []byte, i int) bool { - //return is_space(b, i) || is_breakz(b, i) - return ( // is_space: - b[i] == ' ' || - // is_breakz: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - b[i] == 0) -} - -// Check if the character is a line break, space, tab, or NUL. -func is_blankz(b []byte, i int) bool { - //return is_blank(b, i) || is_breakz(b, i) - return ( // is_blank: - b[i] == ' ' || b[i] == '\t' || - // is_breakz: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - b[i] == 0) -} - -// Determine the width of the character. -func width(b byte) int { - // Don't replace these by a switch without first - // confirming that it is being inlined. - if b&0x80 == 0x00 { - return 1 - } - if b&0xE0 == 0xC0 { - return 2 - } - if b&0xF0 == 0xE0 { - return 3 - } - if b&0xF8 == 0xF0 { - return 4 - } - return 0 - -} diff --git a/vendor/gopkg.in/yaml.v3/.travis.yml b/vendor/gopkg.in/yaml.v3/.travis.yml deleted file mode 100644 index a130fe883..000000000 --- a/vendor/gopkg.in/yaml.v3/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -go: - - "1.4.x" - - "1.5.x" - - "1.6.x" - - "1.7.x" - - "1.8.x" - - "1.9.x" - - "1.10.x" - - "1.11.x" - - "1.12.x" - - "1.13.x" - - "1.14.x" - - "tip" - -go_import_path: gopkg.in/yaml.v3 diff --git a/vendor/gopkg.in/yaml.v3/LICENSE b/vendor/gopkg.in/yaml.v3/LICENSE deleted file mode 100644 index 2683e4bb1..000000000 --- a/vendor/gopkg.in/yaml.v3/LICENSE +++ /dev/null @@ -1,50 +0,0 @@ - -This project is covered by two different licenses: MIT and Apache. - -#### MIT License #### - -The following files were ported to Go from C files of libyaml, and thus -are still covered by their original MIT license, with the additional -copyright staring in 2011 when the project was ported over: - - apic.go emitterc.go parserc.go readerc.go scannerc.go - writerc.go yamlh.go yamlprivateh.go - -Copyright (c) 2006-2010 Kirill Simonov -Copyright (c) 2006-2011 Kirill Simonov - -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. - -### Apache License ### - -All the remaining project files are covered by the Apache license: - -Copyright (c) 2011-2019 Canonical Ltd - -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/gopkg.in/yaml.v3/NOTICE b/vendor/gopkg.in/yaml.v3/NOTICE deleted file mode 100644 index 866d74a7a..000000000 --- a/vendor/gopkg.in/yaml.v3/NOTICE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2011-2016 Canonical Ltd. - -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/gopkg.in/yaml.v3/README.md b/vendor/gopkg.in/yaml.v3/README.md deleted file mode 100644 index 08eb1babd..000000000 --- a/vendor/gopkg.in/yaml.v3/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# YAML support for the Go language - -Introduction ------------- - -The yaml package enables Go programs to comfortably encode and decode YAML -values. It was developed within [Canonical](https://www.canonical.com) as -part of the [juju](https://juju.ubuntu.com) project, and is based on a -pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) -C library to parse and generate YAML data quickly and reliably. - -Compatibility -------------- - -The yaml package supports most of YAML 1.2, but preserves some behavior -from 1.1 for backwards compatibility. - -Specifically, as of v3 of the yaml package: - - - YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being - decoded into a typed bool value. Otherwise they behave as a string. Booleans - in YAML 1.2 are _true/false_ only. - - Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_ - as specified in YAML 1.2, because most parsers still use the old format. - Octals in the _0o777_ format are supported though, so new files work. - - Does not support base-60 floats. These are gone from YAML 1.2, and were - actually never supported by this package as it's clearly a poor choice. - -and offers backwards -compatibility with YAML 1.1 in some cases. -1.2, including support for -anchors, tags, map merging, etc. Multi-document unmarshalling is not yet -implemented, and base-60 floats from YAML 1.1 are purposefully not -supported since they're a poor design and are gone in YAML 1.2. - -Installation and usage ----------------------- - -The import path for the package is *gopkg.in/yaml.v3*. - -To install it, run: - - go get gopkg.in/yaml.v3 - -API documentation ------------------ - -If opened in a browser, the import path itself leads to the API documentation: - - - [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) - -API stability -------------- - -The package API for yaml v3 will remain stable as described in [gopkg.in](https://gopkg.in). - - -License -------- - -The yaml package is licensed under the MIT and Apache License 2.0 licenses. -Please see the LICENSE file for details. - - -Example -------- - -```Go -package main - -import ( - "fmt" - "log" - - "gopkg.in/yaml.v3" -) - -var data = ` -a: Easy! -b: - c: 2 - d: [3, 4] -` - -// Note: struct fields must be public in order for unmarshal to -// correctly populate the data. -type T struct { - A string - B struct { - RenamedC int `yaml:"c"` - D []int `yaml:",flow"` - } -} - -func main() { - t := T{} - - err := yaml.Unmarshal([]byte(data), &t) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- t:\n%v\n\n", t) - - d, err := yaml.Marshal(&t) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- t dump:\n%s\n\n", string(d)) - - m := make(map[interface{}]interface{}) - - err = yaml.Unmarshal([]byte(data), &m) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- m:\n%v\n\n", m) - - d, err = yaml.Marshal(&m) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- m dump:\n%s\n\n", string(d)) -} -``` - -This example will generate the following output: - -``` ---- t: -{Easy! {2 [3 4]}} - ---- t dump: -a: Easy! -b: - c: 2 - d: [3, 4] - - ---- m: -map[a:Easy! b:map[c:2 d:[3 4]]] - ---- m dump: -a: Easy! -b: - c: 2 - d: - - 3 - - 4 -``` - diff --git a/vendor/gopkg.in/yaml.v3/apic.go b/vendor/gopkg.in/yaml.v3/apic.go deleted file mode 100644 index ae7d049f1..000000000 --- a/vendor/gopkg.in/yaml.v3/apic.go +++ /dev/null @@ -1,747 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -import ( - "io" -) - -func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { - //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) - - // Check if we can move the queue at the beginning of the buffer. - if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { - if parser.tokens_head != len(parser.tokens) { - copy(parser.tokens, parser.tokens[parser.tokens_head:]) - } - parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] - parser.tokens_head = 0 - } - parser.tokens = append(parser.tokens, *token) - if pos < 0 { - return - } - copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) - parser.tokens[parser.tokens_head+pos] = *token -} - -// Create a new parser object. -func yaml_parser_initialize(parser *yaml_parser_t) bool { - *parser = yaml_parser_t{ - raw_buffer: make([]byte, 0, input_raw_buffer_size), - buffer: make([]byte, 0, input_buffer_size), - } - return true -} - -// Destroy a parser object. -func yaml_parser_delete(parser *yaml_parser_t) { - *parser = yaml_parser_t{} -} - -// String read handler. -func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - if parser.input_pos == len(parser.input) { - return 0, io.EOF - } - n = copy(buffer, parser.input[parser.input_pos:]) - parser.input_pos += n - return n, nil -} - -// Reader read handler. -func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - return parser.input_reader.Read(buffer) -} - -// Set a string input. -func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { - if parser.read_handler != nil { - panic("must set the input source only once") - } - parser.read_handler = yaml_string_read_handler - parser.input = input - parser.input_pos = 0 -} - -// Set a file input. -func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { - if parser.read_handler != nil { - panic("must set the input source only once") - } - parser.read_handler = yaml_reader_read_handler - parser.input_reader = r -} - -// Set the source encoding. -func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { - if parser.encoding != yaml_ANY_ENCODING { - panic("must set the encoding only once") - } - parser.encoding = encoding -} - -// Create a new emitter object. -func yaml_emitter_initialize(emitter *yaml_emitter_t) { - *emitter = yaml_emitter_t{ - buffer: make([]byte, output_buffer_size), - raw_buffer: make([]byte, 0, output_raw_buffer_size), - states: make([]yaml_emitter_state_t, 0, initial_stack_size), - events: make([]yaml_event_t, 0, initial_queue_size), - best_width: -1, - } -} - -// Destroy an emitter object. -func yaml_emitter_delete(emitter *yaml_emitter_t) { - *emitter = yaml_emitter_t{} -} - -// String write handler. -func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - *emitter.output_buffer = append(*emitter.output_buffer, buffer...) - return nil -} - -// yaml_writer_write_handler uses emitter.output_writer to write the -// emitted text. -func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - _, err := emitter.output_writer.Write(buffer) - return err -} - -// Set a string output. -func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { - if emitter.write_handler != nil { - panic("must set the output target only once") - } - emitter.write_handler = yaml_string_write_handler - emitter.output_buffer = output_buffer -} - -// Set a file output. -func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { - if emitter.write_handler != nil { - panic("must set the output target only once") - } - emitter.write_handler = yaml_writer_write_handler - emitter.output_writer = w -} - -// Set the output encoding. -func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { - if emitter.encoding != yaml_ANY_ENCODING { - panic("must set the output encoding only once") - } - emitter.encoding = encoding -} - -// Set the canonical output style. -func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { - emitter.canonical = canonical -} - -// Set the indentation increment. -func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { - if indent < 2 || indent > 9 { - indent = 2 - } - emitter.best_indent = indent -} - -// Set the preferred line width. -func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { - if width < 0 { - width = -1 - } - emitter.best_width = width -} - -// Set if unescaped non-ASCII characters are allowed. -func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { - emitter.unicode = unicode -} - -// Set the preferred line break character. -func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { - emitter.line_break = line_break -} - -///* -// * Destroy a token object. -// */ -// -//YAML_DECLARE(void) -//yaml_token_delete(yaml_token_t *token) -//{ -// assert(token); // Non-NULL token object expected. -// -// switch (token.type) -// { -// case YAML_TAG_DIRECTIVE_TOKEN: -// yaml_free(token.data.tag_directive.handle); -// yaml_free(token.data.tag_directive.prefix); -// break; -// -// case YAML_ALIAS_TOKEN: -// yaml_free(token.data.alias.value); -// break; -// -// case YAML_ANCHOR_TOKEN: -// yaml_free(token.data.anchor.value); -// break; -// -// case YAML_TAG_TOKEN: -// yaml_free(token.data.tag.handle); -// yaml_free(token.data.tag.suffix); -// break; -// -// case YAML_SCALAR_TOKEN: -// yaml_free(token.data.scalar.value); -// break; -// -// default: -// break; -// } -// -// memset(token, 0, sizeof(yaml_token_t)); -//} -// -///* -// * Check if a string is a valid UTF-8 sequence. -// * -// * Check 'reader.c' for more details on UTF-8 encoding. -// */ -// -//static int -//yaml_check_utf8(yaml_char_t *start, size_t length) -//{ -// yaml_char_t *end = start+length; -// yaml_char_t *pointer = start; -// -// while (pointer < end) { -// unsigned char octet; -// unsigned int width; -// unsigned int value; -// size_t k; -// -// octet = pointer[0]; -// width = (octet & 0x80) == 0x00 ? 1 : -// (octet & 0xE0) == 0xC0 ? 2 : -// (octet & 0xF0) == 0xE0 ? 3 : -// (octet & 0xF8) == 0xF0 ? 4 : 0; -// value = (octet & 0x80) == 0x00 ? octet & 0x7F : -// (octet & 0xE0) == 0xC0 ? octet & 0x1F : -// (octet & 0xF0) == 0xE0 ? octet & 0x0F : -// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; -// if (!width) return 0; -// if (pointer+width > end) return 0; -// for (k = 1; k < width; k ++) { -// octet = pointer[k]; -// if ((octet & 0xC0) != 0x80) return 0; -// value = (value << 6) + (octet & 0x3F); -// } -// if (!((width == 1) || -// (width == 2 && value >= 0x80) || -// (width == 3 && value >= 0x800) || -// (width == 4 && value >= 0x10000))) return 0; -// -// pointer += width; -// } -// -// return 1; -//} -// - -// Create STREAM-START. -func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { - *event = yaml_event_t{ - typ: yaml_STREAM_START_EVENT, - encoding: encoding, - } -} - -// Create STREAM-END. -func yaml_stream_end_event_initialize(event *yaml_event_t) { - *event = yaml_event_t{ - typ: yaml_STREAM_END_EVENT, - } -} - -// Create DOCUMENT-START. -func yaml_document_start_event_initialize( - event *yaml_event_t, - version_directive *yaml_version_directive_t, - tag_directives []yaml_tag_directive_t, - implicit bool, -) { - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - version_directive: version_directive, - tag_directives: tag_directives, - implicit: implicit, - } -} - -// Create DOCUMENT-END. -func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { - *event = yaml_event_t{ - typ: yaml_DOCUMENT_END_EVENT, - implicit: implicit, - } -} - -// Create ALIAS. -func yaml_alias_event_initialize(event *yaml_event_t, anchor []byte) bool { - *event = yaml_event_t{ - typ: yaml_ALIAS_EVENT, - anchor: anchor, - } - return true -} - -// Create SCALAR. -func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - anchor: anchor, - tag: tag, - value: value, - implicit: plain_implicit, - quoted_implicit: quoted_implicit, - style: yaml_style_t(style), - } - return true -} - -// Create SEQUENCE-START. -func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(style), - } - return true -} - -// Create SEQUENCE-END. -func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - } - return true -} - -// Create MAPPING-START. -func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(style), - } -} - -// Create MAPPING-END. -func yaml_mapping_end_event_initialize(event *yaml_event_t) { - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - } -} - -// Destroy an event object. -func yaml_event_delete(event *yaml_event_t) { - *event = yaml_event_t{} -} - -///* -// * Create a document object. -// */ -// -//YAML_DECLARE(int) -//yaml_document_initialize(document *yaml_document_t, -// version_directive *yaml_version_directive_t, -// tag_directives_start *yaml_tag_directive_t, -// tag_directives_end *yaml_tag_directive_t, -// start_implicit int, end_implicit int) -//{ -// struct { -// error yaml_error_type_t -// } context -// struct { -// start *yaml_node_t -// end *yaml_node_t -// top *yaml_node_t -// } nodes = { NULL, NULL, NULL } -// version_directive_copy *yaml_version_directive_t = NULL -// struct { -// start *yaml_tag_directive_t -// end *yaml_tag_directive_t -// top *yaml_tag_directive_t -// } tag_directives_copy = { NULL, NULL, NULL } -// value yaml_tag_directive_t = { NULL, NULL } -// mark yaml_mark_t = { 0, 0, 0 } -// -// assert(document) // Non-NULL document object is expected. -// assert((tag_directives_start && tag_directives_end) || -// (tag_directives_start == tag_directives_end)) -// // Valid tag directives are expected. -// -// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error -// -// if (version_directive) { -// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) -// if (!version_directive_copy) goto error -// version_directive_copy.major = version_directive.major -// version_directive_copy.minor = version_directive.minor -// } -// -// if (tag_directives_start != tag_directives_end) { -// tag_directive *yaml_tag_directive_t -// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) -// goto error -// for (tag_directive = tag_directives_start -// tag_directive != tag_directives_end; tag_directive ++) { -// assert(tag_directive.handle) -// assert(tag_directive.prefix) -// if (!yaml_check_utf8(tag_directive.handle, -// strlen((char *)tag_directive.handle))) -// goto error -// if (!yaml_check_utf8(tag_directive.prefix, -// strlen((char *)tag_directive.prefix))) -// goto error -// value.handle = yaml_strdup(tag_directive.handle) -// value.prefix = yaml_strdup(tag_directive.prefix) -// if (!value.handle || !value.prefix) goto error -// if (!PUSH(&context, tag_directives_copy, value)) -// goto error -// value.handle = NULL -// value.prefix = NULL -// } -// } -// -// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, -// tag_directives_copy.start, tag_directives_copy.top, -// start_implicit, end_implicit, mark, mark) -// -// return 1 -// -//error: -// STACK_DEL(&context, nodes) -// yaml_free(version_directive_copy) -// while (!STACK_EMPTY(&context, tag_directives_copy)) { -// value yaml_tag_directive_t = POP(&context, tag_directives_copy) -// yaml_free(value.handle) -// yaml_free(value.prefix) -// } -// STACK_DEL(&context, tag_directives_copy) -// yaml_free(value.handle) -// yaml_free(value.prefix) -// -// return 0 -//} -// -///* -// * Destroy a document object. -// */ -// -//YAML_DECLARE(void) -//yaml_document_delete(document *yaml_document_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// tag_directive *yaml_tag_directive_t -// -// context.error = YAML_NO_ERROR // Eliminate a compiler warning. -// -// assert(document) // Non-NULL document object is expected. -// -// while (!STACK_EMPTY(&context, document.nodes)) { -// node yaml_node_t = POP(&context, document.nodes) -// yaml_free(node.tag) -// switch (node.type) { -// case YAML_SCALAR_NODE: -// yaml_free(node.data.scalar.value) -// break -// case YAML_SEQUENCE_NODE: -// STACK_DEL(&context, node.data.sequence.items) -// break -// case YAML_MAPPING_NODE: -// STACK_DEL(&context, node.data.mapping.pairs) -// break -// default: -// assert(0) // Should not happen. -// } -// } -// STACK_DEL(&context, document.nodes) -// -// yaml_free(document.version_directive) -// for (tag_directive = document.tag_directives.start -// tag_directive != document.tag_directives.end -// tag_directive++) { -// yaml_free(tag_directive.handle) -// yaml_free(tag_directive.prefix) -// } -// yaml_free(document.tag_directives.start) -// -// memset(document, 0, sizeof(yaml_document_t)) -//} -// -///** -// * Get a document node. -// */ -// -//YAML_DECLARE(yaml_node_t *) -//yaml_document_get_node(document *yaml_document_t, index int) -//{ -// assert(document) // Non-NULL document object is expected. -// -// if (index > 0 && document.nodes.start + index <= document.nodes.top) { -// return document.nodes.start + index - 1 -// } -// return NULL -//} -// -///** -// * Get the root object. -// */ -// -//YAML_DECLARE(yaml_node_t *) -//yaml_document_get_root_node(document *yaml_document_t) -//{ -// assert(document) // Non-NULL document object is expected. -// -// if (document.nodes.top != document.nodes.start) { -// return document.nodes.start -// } -// return NULL -//} -// -///* -// * Add a scalar node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_scalar(document *yaml_document_t, -// tag *yaml_char_t, value *yaml_char_t, length int, -// style yaml_scalar_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// value_copy *yaml_char_t = NULL -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// assert(value) // Non-NULL value is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (length < 0) { -// length = strlen((char *)value) -// } -// -// if (!yaml_check_utf8(value, length)) goto error -// value_copy = yaml_malloc(length+1) -// if (!value_copy) goto error -// memcpy(value_copy, value, length) -// value_copy[length] = '\0' -// -// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// yaml_free(tag_copy) -// yaml_free(value_copy) -// -// return 0 -//} -// -///* -// * Add a sequence node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_sequence(document *yaml_document_t, -// tag *yaml_char_t, style yaml_sequence_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// struct { -// start *yaml_node_item_t -// end *yaml_node_item_t -// top *yaml_node_item_t -// } items = { NULL, NULL, NULL } -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error -// -// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, -// style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// STACK_DEL(&context, items) -// yaml_free(tag_copy) -// -// return 0 -//} -// -///* -// * Add a mapping node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_mapping(document *yaml_document_t, -// tag *yaml_char_t, style yaml_mapping_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// struct { -// start *yaml_node_pair_t -// end *yaml_node_pair_t -// top *yaml_node_pair_t -// } pairs = { NULL, NULL, NULL } -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error -// -// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, -// style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// STACK_DEL(&context, pairs) -// yaml_free(tag_copy) -// -// return 0 -//} -// -///* -// * Append an item to a sequence node. -// */ -// -//YAML_DECLARE(int) -//yaml_document_append_sequence_item(document *yaml_document_t, -// sequence int, item int) -//{ -// struct { -// error yaml_error_type_t -// } context -// -// assert(document) // Non-NULL document is required. -// assert(sequence > 0 -// && document.nodes.start + sequence <= document.nodes.top) -// // Valid sequence id is required. -// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) -// // A sequence node is required. -// assert(item > 0 && document.nodes.start + item <= document.nodes.top) -// // Valid item id is required. -// -// if (!PUSH(&context, -// document.nodes.start[sequence-1].data.sequence.items, item)) -// return 0 -// -// return 1 -//} -// -///* -// * Append a pair of a key and a value to a mapping node. -// */ -// -//YAML_DECLARE(int) -//yaml_document_append_mapping_pair(document *yaml_document_t, -// mapping int, key int, value int) -//{ -// struct { -// error yaml_error_type_t -// } context -// -// pair yaml_node_pair_t -// -// assert(document) // Non-NULL document is required. -// assert(mapping > 0 -// && document.nodes.start + mapping <= document.nodes.top) -// // Valid mapping id is required. -// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) -// // A mapping node is required. -// assert(key > 0 && document.nodes.start + key <= document.nodes.top) -// // Valid key id is required. -// assert(value > 0 && document.nodes.start + value <= document.nodes.top) -// // Valid value id is required. -// -// pair.key = key -// pair.value = value -// -// if (!PUSH(&context, -// document.nodes.start[mapping-1].data.mapping.pairs, pair)) -// return 0 -// -// return 1 -//} -// -// diff --git a/vendor/gopkg.in/yaml.v3/decode.go b/vendor/gopkg.in/yaml.v3/decode.go deleted file mode 100644 index 21c0dacfd..000000000 --- a/vendor/gopkg.in/yaml.v3/decode.go +++ /dev/null @@ -1,948 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// -// 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 yaml - -import ( - "encoding" - "encoding/base64" - "fmt" - "io" - "math" - "reflect" - "strconv" - "time" -) - -// ---------------------------------------------------------------------------- -// Parser, produces a node tree out of a libyaml event stream. - -type parser struct { - parser yaml_parser_t - event yaml_event_t - doc *Node - anchors map[string]*Node - doneInit bool - textless bool -} - -func newParser(b []byte) *parser { - p := parser{} - if !yaml_parser_initialize(&p.parser) { - panic("failed to initialize YAML emitter") - } - if len(b) == 0 { - b = []byte{'\n'} - } - yaml_parser_set_input_string(&p.parser, b) - return &p -} - -func newParserFromReader(r io.Reader) *parser { - p := parser{} - if !yaml_parser_initialize(&p.parser) { - panic("failed to initialize YAML emitter") - } - yaml_parser_set_input_reader(&p.parser, r) - return &p -} - -func (p *parser) init() { - if p.doneInit { - return - } - p.anchors = make(map[string]*Node) - p.expect(yaml_STREAM_START_EVENT) - p.doneInit = true -} - -func (p *parser) destroy() { - if p.event.typ != yaml_NO_EVENT { - yaml_event_delete(&p.event) - } - yaml_parser_delete(&p.parser) -} - -// expect consumes an event from the event stream and -// checks that it's of the expected type. -func (p *parser) expect(e yaml_event_type_t) { - if p.event.typ == yaml_NO_EVENT { - if !yaml_parser_parse(&p.parser, &p.event) { - p.fail() - } - } - if p.event.typ == yaml_STREAM_END_EVENT { - failf("attempted to go past the end of stream; corrupted value?") - } - if p.event.typ != e { - p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) - p.fail() - } - yaml_event_delete(&p.event) - p.event.typ = yaml_NO_EVENT -} - -// peek peeks at the next event in the event stream, -// puts the results into p.event and returns the event type. -func (p *parser) peek() yaml_event_type_t { - if p.event.typ != yaml_NO_EVENT { - return p.event.typ - } - if !yaml_parser_parse(&p.parser, &p.event) { - p.fail() - } - return p.event.typ -} - -func (p *parser) fail() { - var where string - var line int - if p.parser.context_mark.line != 0 { - line = p.parser.context_mark.line - // Scanner errors don't iterate line before returning error - if p.parser.error == yaml_SCANNER_ERROR { - line++ - } - } else if p.parser.problem_mark.line != 0 { - line = p.parser.problem_mark.line - // Scanner errors don't iterate line before returning error - if p.parser.error == yaml_SCANNER_ERROR { - line++ - } - } - if line != 0 { - where = "line " + strconv.Itoa(line) + ": " - } - var msg string - if len(p.parser.problem) > 0 { - msg = p.parser.problem - } else { - msg = "unknown problem parsing YAML content" - } - failf("%s%s", where, msg) -} - -func (p *parser) anchor(n *Node, anchor []byte) { - if anchor != nil { - n.Anchor = string(anchor) - p.anchors[n.Anchor] = n - } -} - -func (p *parser) parse() *Node { - p.init() - switch p.peek() { - case yaml_SCALAR_EVENT: - return p.scalar() - case yaml_ALIAS_EVENT: - return p.alias() - case yaml_MAPPING_START_EVENT: - return p.mapping() - case yaml_SEQUENCE_START_EVENT: - return p.sequence() - case yaml_DOCUMENT_START_EVENT: - return p.document() - case yaml_STREAM_END_EVENT: - // Happens when attempting to decode an empty buffer. - return nil - case yaml_TAIL_COMMENT_EVENT: - panic("internal error: unexpected tail comment event (please report)") - default: - panic("internal error: attempted to parse unknown event (please report): " + p.event.typ.String()) - } -} - -func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node { - var style Style - if tag != "" && tag != "!" { - tag = shortTag(tag) - style = TaggedStyle - } else if defaultTag != "" { - tag = defaultTag - } else if kind == ScalarNode { - tag, _ = resolve("", value) - } - n := &Node{ - Kind: kind, - Tag: tag, - Value: value, - Style: style, - } - if !p.textless { - n.Line = p.event.start_mark.line + 1 - n.Column = p.event.start_mark.column + 1 - n.HeadComment = string(p.event.head_comment) - n.LineComment = string(p.event.line_comment) - n.FootComment = string(p.event.foot_comment) - } - return n -} - -func (p *parser) parseChild(parent *Node) *Node { - child := p.parse() - parent.Content = append(parent.Content, child) - return child -} - -func (p *parser) document() *Node { - n := p.node(DocumentNode, "", "", "") - p.doc = n - p.expect(yaml_DOCUMENT_START_EVENT) - p.parseChild(n) - if p.peek() == yaml_DOCUMENT_END_EVENT { - n.FootComment = string(p.event.foot_comment) - } - p.expect(yaml_DOCUMENT_END_EVENT) - return n -} - -func (p *parser) alias() *Node { - n := p.node(AliasNode, "", "", string(p.event.anchor)) - n.Alias = p.anchors[n.Value] - if n.Alias == nil { - failf("unknown anchor '%s' referenced", n.Value) - } - p.expect(yaml_ALIAS_EVENT) - return n -} - -func (p *parser) scalar() *Node { - var parsedStyle = p.event.scalar_style() - var nodeStyle Style - switch { - case parsedStyle&yaml_DOUBLE_QUOTED_SCALAR_STYLE != 0: - nodeStyle = DoubleQuotedStyle - case parsedStyle&yaml_SINGLE_QUOTED_SCALAR_STYLE != 0: - nodeStyle = SingleQuotedStyle - case parsedStyle&yaml_LITERAL_SCALAR_STYLE != 0: - nodeStyle = LiteralStyle - case parsedStyle&yaml_FOLDED_SCALAR_STYLE != 0: - nodeStyle = FoldedStyle - } - var nodeValue = string(p.event.value) - var nodeTag = string(p.event.tag) - var defaultTag string - if nodeStyle == 0 { - if nodeValue == "<<" { - defaultTag = mergeTag - } - } else { - defaultTag = strTag - } - n := p.node(ScalarNode, defaultTag, nodeTag, nodeValue) - n.Style |= nodeStyle - p.anchor(n, p.event.anchor) - p.expect(yaml_SCALAR_EVENT) - return n -} - -func (p *parser) sequence() *Node { - n := p.node(SequenceNode, seqTag, string(p.event.tag), "") - if p.event.sequence_style()&yaml_FLOW_SEQUENCE_STYLE != 0 { - n.Style |= FlowStyle - } - p.anchor(n, p.event.anchor) - p.expect(yaml_SEQUENCE_START_EVENT) - for p.peek() != yaml_SEQUENCE_END_EVENT { - p.parseChild(n) - } - n.LineComment = string(p.event.line_comment) - n.FootComment = string(p.event.foot_comment) - p.expect(yaml_SEQUENCE_END_EVENT) - return n -} - -func (p *parser) mapping() *Node { - n := p.node(MappingNode, mapTag, string(p.event.tag), "") - block := true - if p.event.mapping_style()&yaml_FLOW_MAPPING_STYLE != 0 { - block = false - n.Style |= FlowStyle - } - p.anchor(n, p.event.anchor) - p.expect(yaml_MAPPING_START_EVENT) - for p.peek() != yaml_MAPPING_END_EVENT { - k := p.parseChild(n) - if block && k.FootComment != "" { - // Must be a foot comment for the prior value when being dedented. - if len(n.Content) > 2 { - n.Content[len(n.Content)-3].FootComment = k.FootComment - k.FootComment = "" - } - } - v := p.parseChild(n) - if k.FootComment == "" && v.FootComment != "" { - k.FootComment = v.FootComment - v.FootComment = "" - } - if p.peek() == yaml_TAIL_COMMENT_EVENT { - if k.FootComment == "" { - k.FootComment = string(p.event.foot_comment) - } - p.expect(yaml_TAIL_COMMENT_EVENT) - } - } - n.LineComment = string(p.event.line_comment) - n.FootComment = string(p.event.foot_comment) - if n.Style&FlowStyle == 0 && n.FootComment != "" && len(n.Content) > 1 { - n.Content[len(n.Content)-2].FootComment = n.FootComment - n.FootComment = "" - } - p.expect(yaml_MAPPING_END_EVENT) - return n -} - -// ---------------------------------------------------------------------------- -// Decoder, unmarshals a node into a provided value. - -type decoder struct { - doc *Node - aliases map[*Node]bool - terrors []string - - stringMapType reflect.Type - generalMapType reflect.Type - - knownFields bool - uniqueKeys bool - decodeCount int - aliasCount int - aliasDepth int -} - -var ( - nodeType = reflect.TypeOf(Node{}) - durationType = reflect.TypeOf(time.Duration(0)) - stringMapType = reflect.TypeOf(map[string]interface{}{}) - generalMapType = reflect.TypeOf(map[interface{}]interface{}{}) - ifaceType = generalMapType.Elem() - timeType = reflect.TypeOf(time.Time{}) - ptrTimeType = reflect.TypeOf(&time.Time{}) -) - -func newDecoder() *decoder { - d := &decoder{ - stringMapType: stringMapType, - generalMapType: generalMapType, - uniqueKeys: true, - } - d.aliases = make(map[*Node]bool) - return d -} - -func (d *decoder) terror(n *Node, tag string, out reflect.Value) { - if n.Tag != "" { - tag = n.Tag - } - value := n.Value - if tag != seqTag && tag != mapTag { - if len(value) > 10 { - value = " `" + value[:7] + "...`" - } else { - value = " `" + value + "`" - } - } - d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.Line, shortTag(tag), value, out.Type())) -} - -func (d *decoder) callUnmarshaler(n *Node, u Unmarshaler) (good bool) { - err := u.UnmarshalYAML(n) - if e, ok := err.(*TypeError); ok { - d.terrors = append(d.terrors, e.Errors...) - return false - } - if err != nil { - fail(err) - } - return true -} - -func (d *decoder) callObsoleteUnmarshaler(n *Node, u obsoleteUnmarshaler) (good bool) { - terrlen := len(d.terrors) - err := u.UnmarshalYAML(func(v interface{}) (err error) { - defer handleErr(&err) - d.unmarshal(n, reflect.ValueOf(v)) - if len(d.terrors) > terrlen { - issues := d.terrors[terrlen:] - d.terrors = d.terrors[:terrlen] - return &TypeError{issues} - } - return nil - }) - if e, ok := err.(*TypeError); ok { - d.terrors = append(d.terrors, e.Errors...) - return false - } - if err != nil { - fail(err) - } - return true -} - -// d.prepare initializes and dereferences pointers and calls UnmarshalYAML -// if a value is found to implement it. -// It returns the initialized and dereferenced out value, whether -// unmarshalling was already done by UnmarshalYAML, and if so whether -// its types unmarshalled appropriately. -// -// If n holds a null value, prepare returns before doing anything. -func (d *decoder) prepare(n *Node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { - if n.ShortTag() == nullTag || n.Kind == 0 && n.IsZero() { - return out, false, false - } - again := true - for again { - again = false - if out.Kind() == reflect.Ptr { - if out.IsNil() { - out.Set(reflect.New(out.Type().Elem())) - } - out = out.Elem() - again = true - } - if out.CanAddr() { - outi := out.Addr().Interface() - if u, ok := outi.(Unmarshaler); ok { - good = d.callUnmarshaler(n, u) - return out, true, good - } - if u, ok := outi.(obsoleteUnmarshaler); ok { - good = d.callObsoleteUnmarshaler(n, u) - return out, true, good - } - } - } - return out, false, false -} - -func (d *decoder) fieldByIndex(n *Node, v reflect.Value, index []int) (field reflect.Value) { - if n.ShortTag() == nullTag { - return reflect.Value{} - } - for _, num := range index { - for { - if v.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(v.Type().Elem())) - } - v = v.Elem() - continue - } - break - } - v = v.Field(num) - } - return v -} - -const ( - // 400,000 decode operations is ~500kb of dense object declarations, or - // ~5kb of dense object declarations with 10000% alias expansion - alias_ratio_range_low = 400000 - - // 4,000,000 decode operations is ~5MB of dense object declarations, or - // ~4.5MB of dense object declarations with 10% alias expansion - alias_ratio_range_high = 4000000 - - // alias_ratio_range is the range over which we scale allowed alias ratios - alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) -) - -func allowedAliasRatio(decodeCount int) float64 { - switch { - case decodeCount <= alias_ratio_range_low: - // allow 99% to come from alias expansion for small-to-medium documents - return 0.99 - case decodeCount >= alias_ratio_range_high: - // allow 10% to come from alias expansion for very large documents - return 0.10 - default: - // scale smoothly from 99% down to 10% over the range. - // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. - // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). - return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) - } -} - -func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) { - d.decodeCount++ - if d.aliasDepth > 0 { - d.aliasCount++ - } - if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { - failf("document contains excessive aliasing") - } - if out.Type() == nodeType { - out.Set(reflect.ValueOf(n).Elem()) - return true - } - switch n.Kind { - case DocumentNode: - return d.document(n, out) - case AliasNode: - return d.alias(n, out) - } - out, unmarshaled, good := d.prepare(n, out) - if unmarshaled { - return good - } - switch n.Kind { - case ScalarNode: - good = d.scalar(n, out) - case MappingNode: - good = d.mapping(n, out) - case SequenceNode: - good = d.sequence(n, out) - case 0: - if n.IsZero() { - return d.null(out) - } - fallthrough - default: - failf("cannot decode node with unknown kind %d", n.Kind) - } - return good -} - -func (d *decoder) document(n *Node, out reflect.Value) (good bool) { - if len(n.Content) == 1 { - d.doc = n - d.unmarshal(n.Content[0], out) - return true - } - return false -} - -func (d *decoder) alias(n *Node, out reflect.Value) (good bool) { - if d.aliases[n] { - // TODO this could actually be allowed in some circumstances. - failf("anchor '%s' value contains itself", n.Value) - } - d.aliases[n] = true - d.aliasDepth++ - good = d.unmarshal(n.Alias, out) - d.aliasDepth-- - delete(d.aliases, n) - return good -} - -var zeroValue reflect.Value - -func resetMap(out reflect.Value) { - for _, k := range out.MapKeys() { - out.SetMapIndex(k, zeroValue) - } -} - -func (d *decoder) null(out reflect.Value) bool { - if out.CanAddr() { - switch out.Kind() { - case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: - out.Set(reflect.Zero(out.Type())) - return true - } - } - return false -} - -func (d *decoder) scalar(n *Node, out reflect.Value) bool { - var tag string - var resolved interface{} - if n.indicatedString() { - tag = strTag - resolved = n.Value - } else { - tag, resolved = resolve(n.Tag, n.Value) - if tag == binaryTag { - data, err := base64.StdEncoding.DecodeString(resolved.(string)) - if err != nil { - failf("!!binary value contains invalid base64 data") - } - resolved = string(data) - } - } - if resolved == nil { - return d.null(out) - } - if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { - // We've resolved to exactly the type we want, so use that. - out.Set(resolvedv) - return true - } - // Perhaps we can use the value as a TextUnmarshaler to - // set its value. - if out.CanAddr() { - u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) - if ok { - var text []byte - if tag == binaryTag { - text = []byte(resolved.(string)) - } else { - // We let any value be unmarshaled into TextUnmarshaler. - // That might be more lax than we'd like, but the - // TextUnmarshaler itself should bowl out any dubious values. - text = []byte(n.Value) - } - err := u.UnmarshalText(text) - if err != nil { - fail(err) - } - return true - } - } - switch out.Kind() { - case reflect.String: - if tag == binaryTag { - out.SetString(resolved.(string)) - return true - } - out.SetString(n.Value) - return true - case reflect.Interface: - out.Set(reflect.ValueOf(resolved)) - return true - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - // This used to work in v2, but it's very unfriendly. - isDuration := out.Type() == durationType - - switch resolved := resolved.(type) { - case int: - if !isDuration && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - return true - } - case int64: - if !isDuration && !out.OverflowInt(resolved) { - out.SetInt(resolved) - return true - } - case uint64: - if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - return true - } - case float64: - if !isDuration && resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - return true - } - case string: - if out.Type() == durationType { - d, err := time.ParseDuration(resolved) - if err == nil { - out.SetInt(int64(d)) - return true - } - } - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - switch resolved := resolved.(type) { - case int: - if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - case int64: - if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - case uint64: - if !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - case float64: - if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - return true - } - } - case reflect.Bool: - switch resolved := resolved.(type) { - case bool: - out.SetBool(resolved) - return true - case string: - // This offers some compatibility with the 1.1 spec (https://yaml.org/type/bool.html). - // It only works if explicitly attempting to unmarshal into a typed bool value. - switch resolved { - case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON": - out.SetBool(true) - return true - case "n", "N", "no", "No", "NO", "off", "Off", "OFF": - out.SetBool(false) - return true - } - } - case reflect.Float32, reflect.Float64: - switch resolved := resolved.(type) { - case int: - out.SetFloat(float64(resolved)) - return true - case int64: - out.SetFloat(float64(resolved)) - return true - case uint64: - out.SetFloat(float64(resolved)) - return true - case float64: - out.SetFloat(resolved) - return true - } - case reflect.Struct: - if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { - out.Set(resolvedv) - return true - } - case reflect.Ptr: - panic("yaml internal error: please report the issue") - } - d.terror(n, tag, out) - return false -} - -func settableValueOf(i interface{}) reflect.Value { - v := reflect.ValueOf(i) - sv := reflect.New(v.Type()).Elem() - sv.Set(v) - return sv -} - -func (d *decoder) sequence(n *Node, out reflect.Value) (good bool) { - l := len(n.Content) - - var iface reflect.Value - switch out.Kind() { - case reflect.Slice: - out.Set(reflect.MakeSlice(out.Type(), l, l)) - case reflect.Array: - if l != out.Len() { - failf("invalid array: want %d elements but got %d", out.Len(), l) - } - case reflect.Interface: - // No type hints. Will have to use a generic sequence. - iface = out - out = settableValueOf(make([]interface{}, l)) - default: - d.terror(n, seqTag, out) - return false - } - et := out.Type().Elem() - - j := 0 - for i := 0; i < l; i++ { - e := reflect.New(et).Elem() - if ok := d.unmarshal(n.Content[i], e); ok { - out.Index(j).Set(e) - j++ - } - } - if out.Kind() != reflect.Array { - out.Set(out.Slice(0, j)) - } - if iface.IsValid() { - iface.Set(out) - } - return true -} - -func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { - l := len(n.Content) - if d.uniqueKeys { - nerrs := len(d.terrors) - for i := 0; i < l; i += 2 { - ni := n.Content[i] - for j := i + 2; j < l; j += 2 { - nj := n.Content[j] - if ni.Kind == nj.Kind && ni.Value == nj.Value { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: mapping key %#v already defined at line %d", nj.Line, nj.Value, ni.Line)) - } - } - } - if len(d.terrors) > nerrs { - return false - } - } - switch out.Kind() { - case reflect.Struct: - return d.mappingStruct(n, out) - case reflect.Map: - // okay - case reflect.Interface: - iface := out - if isStringMap(n) { - out = reflect.MakeMap(d.stringMapType) - } else { - out = reflect.MakeMap(d.generalMapType) - } - iface.Set(out) - default: - d.terror(n, mapTag, out) - return false - } - - outt := out.Type() - kt := outt.Key() - et := outt.Elem() - - stringMapType := d.stringMapType - generalMapType := d.generalMapType - if outt.Elem() == ifaceType { - if outt.Key().Kind() == reflect.String { - d.stringMapType = outt - } else if outt.Key() == ifaceType { - d.generalMapType = outt - } - } - - if out.IsNil() { - out.Set(reflect.MakeMap(outt)) - } - for i := 0; i < l; i += 2 { - if isMerge(n.Content[i]) { - d.merge(n.Content[i+1], out) - continue - } - k := reflect.New(kt).Elem() - if d.unmarshal(n.Content[i], k) { - kkind := k.Kind() - if kkind == reflect.Interface { - kkind = k.Elem().Kind() - } - if kkind == reflect.Map || kkind == reflect.Slice { - failf("invalid map key: %#v", k.Interface()) - } - e := reflect.New(et).Elem() - if d.unmarshal(n.Content[i+1], e) { - out.SetMapIndex(k, e) - } - } - } - d.stringMapType = stringMapType - d.generalMapType = generalMapType - return true -} - -func isStringMap(n *Node) bool { - if n.Kind != MappingNode { - return false - } - l := len(n.Content) - for i := 0; i < l; i += 2 { - if n.Content[i].ShortTag() != strTag { - return false - } - } - return true -} - -func (d *decoder) mappingStruct(n *Node, out reflect.Value) (good bool) { - sinfo, err := getStructInfo(out.Type()) - if err != nil { - panic(err) - } - - var inlineMap reflect.Value - var elemType reflect.Type - if sinfo.InlineMap != -1 { - inlineMap = out.Field(sinfo.InlineMap) - inlineMap.Set(reflect.New(inlineMap.Type()).Elem()) - elemType = inlineMap.Type().Elem() - } - - for _, index := range sinfo.InlineUnmarshalers { - field := d.fieldByIndex(n, out, index) - d.prepare(n, field) - } - - var doneFields []bool - if d.uniqueKeys { - doneFields = make([]bool, len(sinfo.FieldsList)) - } - name := settableValueOf("") - l := len(n.Content) - for i := 0; i < l; i += 2 { - ni := n.Content[i] - if isMerge(ni) { - d.merge(n.Content[i+1], out) - continue - } - if !d.unmarshal(ni, name) { - continue - } - if info, ok := sinfo.FieldsMap[name.String()]; ok { - if d.uniqueKeys { - if doneFields[info.Id] { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.Line, name.String(), out.Type())) - continue - } - doneFields[info.Id] = true - } - var field reflect.Value - if info.Inline == nil { - field = out.Field(info.Num) - } else { - field = d.fieldByIndex(n, out, info.Inline) - } - d.unmarshal(n.Content[i+1], field) - } else if sinfo.InlineMap != -1 { - if inlineMap.IsNil() { - inlineMap.Set(reflect.MakeMap(inlineMap.Type())) - } - value := reflect.New(elemType).Elem() - d.unmarshal(n.Content[i+1], value) - inlineMap.SetMapIndex(name, value) - } else if d.knownFields { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.Line, name.String(), out.Type())) - } - } - return true -} - -func failWantMap() { - failf("map merge requires map or sequence of maps as the value") -} - -func (d *decoder) merge(n *Node, out reflect.Value) { - switch n.Kind { - case MappingNode: - d.unmarshal(n, out) - case AliasNode: - if n.Alias != nil && n.Alias.Kind != MappingNode { - failWantMap() - } - d.unmarshal(n, out) - case SequenceNode: - // Step backwards as earlier nodes take precedence. - for i := len(n.Content) - 1; i >= 0; i-- { - ni := n.Content[i] - if ni.Kind == AliasNode { - if ni.Alias != nil && ni.Alias.Kind != MappingNode { - failWantMap() - } - } else if ni.Kind != MappingNode { - failWantMap() - } - d.unmarshal(ni, out) - } - default: - failWantMap() - } -} - -func isMerge(n *Node) bool { - return n.Kind == ScalarNode && n.Value == "<<" && (n.Tag == "" || n.Tag == "!" || shortTag(n.Tag) == mergeTag) -} diff --git a/vendor/gopkg.in/yaml.v3/emitterc.go b/vendor/gopkg.in/yaml.v3/emitterc.go deleted file mode 100644 index c29217ef5..000000000 --- a/vendor/gopkg.in/yaml.v3/emitterc.go +++ /dev/null @@ -1,2022 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -import ( - "bytes" - "fmt" -) - -// Flush the buffer if needed. -func flush(emitter *yaml_emitter_t) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) { - return yaml_emitter_flush(emitter) - } - return true -} - -// Put a character to the output buffer. -func put(emitter *yaml_emitter_t, value byte) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - emitter.buffer[emitter.buffer_pos] = value - emitter.buffer_pos++ - emitter.column++ - return true -} - -// Put a line break to the output buffer. -func put_break(emitter *yaml_emitter_t) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - switch emitter.line_break { - case yaml_CR_BREAK: - emitter.buffer[emitter.buffer_pos] = '\r' - emitter.buffer_pos += 1 - case yaml_LN_BREAK: - emitter.buffer[emitter.buffer_pos] = '\n' - emitter.buffer_pos += 1 - case yaml_CRLN_BREAK: - emitter.buffer[emitter.buffer_pos+0] = '\r' - emitter.buffer[emitter.buffer_pos+1] = '\n' - emitter.buffer_pos += 2 - default: - panic("unknown line break setting") - } - if emitter.column == 0 { - emitter.space_above = true - } - emitter.column = 0 - emitter.line++ - // [Go] Do this here and below and drop from everywhere else (see commented lines). - emitter.indention = true - return true -} - -// Copy a character from a string into buffer. -func write(emitter *yaml_emitter_t, s []byte, i *int) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - p := emitter.buffer_pos - w := width(s[*i]) - switch w { - case 4: - emitter.buffer[p+3] = s[*i+3] - fallthrough - case 3: - emitter.buffer[p+2] = s[*i+2] - fallthrough - case 2: - emitter.buffer[p+1] = s[*i+1] - fallthrough - case 1: - emitter.buffer[p+0] = s[*i+0] - default: - panic("unknown character width") - } - emitter.column++ - emitter.buffer_pos += w - *i += w - return true -} - -// Write a whole string into buffer. -func write_all(emitter *yaml_emitter_t, s []byte) bool { - for i := 0; i < len(s); { - if !write(emitter, s, &i) { - return false - } - } - return true -} - -// Copy a line break character from a string into buffer. -func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { - if s[*i] == '\n' { - if !put_break(emitter) { - return false - } - *i++ - } else { - if !write(emitter, s, i) { - return false - } - if emitter.column == 0 { - emitter.space_above = true - } - emitter.column = 0 - emitter.line++ - // [Go] Do this here and above and drop from everywhere else (see commented lines). - emitter.indention = true - } - return true -} - -// Set an emitter error and return false. -func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_EMITTER_ERROR - emitter.problem = problem - return false -} - -// Emit an event. -func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { - emitter.events = append(emitter.events, *event) - for !yaml_emitter_need_more_events(emitter) { - event := &emitter.events[emitter.events_head] - if !yaml_emitter_analyze_event(emitter, event) { - return false - } - if !yaml_emitter_state_machine(emitter, event) { - return false - } - yaml_event_delete(event) - emitter.events_head++ - } - return true -} - -// Check if we need to accumulate more events before emitting. -// -// We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// -func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { - if emitter.events_head == len(emitter.events) { - return true - } - var accumulate int - switch emitter.events[emitter.events_head].typ { - case yaml_DOCUMENT_START_EVENT: - accumulate = 1 - break - case yaml_SEQUENCE_START_EVENT: - accumulate = 2 - break - case yaml_MAPPING_START_EVENT: - accumulate = 3 - break - default: - return false - } - if len(emitter.events)-emitter.events_head > accumulate { - return false - } - var level int - for i := emitter.events_head; i < len(emitter.events); i++ { - switch emitter.events[i].typ { - case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: - level++ - case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: - level-- - } - if level == 0 { - return false - } - } - return true -} - -// Append a directive to the directives stack. -func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { - for i := 0; i < len(emitter.tag_directives); i++ { - if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { - if allow_duplicates { - return true - } - return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") - } - } - - // [Go] Do we actually need to copy this given garbage collection - // and the lack of deallocating destructors? - tag_copy := yaml_tag_directive_t{ - handle: make([]byte, len(value.handle)), - prefix: make([]byte, len(value.prefix)), - } - copy(tag_copy.handle, value.handle) - copy(tag_copy.prefix, value.prefix) - emitter.tag_directives = append(emitter.tag_directives, tag_copy) - return true -} - -// Increase the indentation level. -func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { - emitter.indents = append(emitter.indents, emitter.indent) - if emitter.indent < 0 { - if flow { - emitter.indent = emitter.best_indent - } else { - emitter.indent = 0 - } - } else if !indentless { - // [Go] This was changed so that indentations are more regular. - if emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { - // The first indent inside a sequence will just skip the "- " indicator. - emitter.indent += 2 - } else { - // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) - } - } - return true -} - -// State dispatcher. -func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { - switch emitter.state { - default: - case yaml_EMIT_STREAM_START_STATE: - return yaml_emitter_emit_stream_start(emitter, event) - - case yaml_EMIT_FIRST_DOCUMENT_START_STATE: - return yaml_emitter_emit_document_start(emitter, event, true) - - case yaml_EMIT_DOCUMENT_START_STATE: - return yaml_emitter_emit_document_start(emitter, event, false) - - case yaml_EMIT_DOCUMENT_CONTENT_STATE: - return yaml_emitter_emit_document_content(emitter, event) - - case yaml_EMIT_DOCUMENT_END_STATE: - return yaml_emitter_emit_document_end(emitter, event) - - case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, true, false) - - case yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, false, true) - - case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, false, false) - - case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, true, false) - - case yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, false, true) - - case yaml_EMIT_FLOW_MAPPING_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, false, false) - - case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: - return yaml_emitter_emit_flow_mapping_value(emitter, event, true) - - case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: - return yaml_emitter_emit_flow_mapping_value(emitter, event, false) - - case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_block_sequence_item(emitter, event, true) - - case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_block_sequence_item(emitter, event, false) - - case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_block_mapping_key(emitter, event, true) - - case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: - return yaml_emitter_emit_block_mapping_key(emitter, event, false) - - case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: - return yaml_emitter_emit_block_mapping_value(emitter, event, true) - - case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: - return yaml_emitter_emit_block_mapping_value(emitter, event, false) - - case yaml_EMIT_END_STATE: - return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") - } - panic("invalid emitter state") -} - -// Expect STREAM-START. -func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if event.typ != yaml_STREAM_START_EVENT { - return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") - } - if emitter.encoding == yaml_ANY_ENCODING { - emitter.encoding = event.encoding - if emitter.encoding == yaml_ANY_ENCODING { - emitter.encoding = yaml_UTF8_ENCODING - } - } - if emitter.best_indent < 2 || emitter.best_indent > 9 { - emitter.best_indent = 2 - } - if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { - emitter.best_width = 80 - } - if emitter.best_width < 0 { - emitter.best_width = 1<<31 - 1 - } - if emitter.line_break == yaml_ANY_BREAK { - emitter.line_break = yaml_LN_BREAK - } - - emitter.indent = -1 - emitter.line = 0 - emitter.column = 0 - emitter.whitespace = true - emitter.indention = true - emitter.space_above = true - emitter.foot_indent = -1 - - if emitter.encoding != yaml_UTF8_ENCODING { - if !yaml_emitter_write_bom(emitter) { - return false - } - } - emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE - return true -} - -// Expect DOCUMENT-START or STREAM-END. -func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - - if event.typ == yaml_DOCUMENT_START_EVENT { - - if event.version_directive != nil { - if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { - return false - } - } - - for i := 0; i < len(event.tag_directives); i++ { - tag_directive := &event.tag_directives[i] - if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { - return false - } - if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { - return false - } - } - - for i := 0; i < len(default_tag_directives); i++ { - tag_directive := &default_tag_directives[i] - if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { - return false - } - } - - implicit := event.implicit - if !first || emitter.canonical { - implicit = false - } - - if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if event.version_directive != nil { - implicit = false - if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if len(event.tag_directives) > 0 { - implicit = false - for i := 0; i < len(event.tag_directives); i++ { - tag_directive := &event.tag_directives[i] - if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { - return false - } - if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { - return false - } - if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - - if yaml_emitter_check_empty_document(emitter) { - implicit = false - } - if !implicit { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { - return false - } - if emitter.canonical || true { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - - if len(emitter.head_comment) > 0 { - if !yaml_emitter_process_head_comment(emitter) { - return false - } - if !put_break(emitter) { - return false - } - } - - emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE - return true - } - - if event.typ == yaml_STREAM_END_EVENT { - if emitter.open_ended { - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_flush(emitter) { - return false - } - emitter.state = yaml_EMIT_END_STATE - return true - } - - return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") -} - -// Expect the root node. -func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { - emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) - - if !yaml_emitter_process_head_comment(emitter) { - return false - } - if !yaml_emitter_emit_node(emitter, event, true, false, false, false) { - return false - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - return true -} - -// Expect DOCUMENT-END. -func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if event.typ != yaml_DOCUMENT_END_EVENT { - return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") - } - // [Go] Force document foot separation. - emitter.foot_indent = 0 - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - emitter.foot_indent = -1 - if !yaml_emitter_write_indent(emitter) { - return false - } - if !event.implicit { - // [Go] Allocate the slice elsewhere. - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_flush(emitter) { - return false - } - emitter.state = yaml_EMIT_DOCUMENT_START_STATE - emitter.tag_directives = emitter.tag_directives[:0] - return true -} - -// Expect a flow item node. -func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { - if first { - if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - emitter.flow_level++ - } - - if event.typ == yaml_SEQUENCE_END_EVENT { - if emitter.canonical && !first && !trail { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.column == 0 || emitter.canonical && !first { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { - return false - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - - return true - } - - if !first && !trail { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - - if !yaml_emitter_process_head_comment(emitter) { - return false - } - if emitter.column == 0 { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE) - } else { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) - } - if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { - return false - } - if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - return true -} - -// Expect a flow key node. -func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first, trail bool) bool { - if first { - if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - emitter.flow_level++ - } - - if event.typ == yaml_MAPPING_END_EVENT { - if (emitter.canonical || len(emitter.head_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0) && !first && !trail { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - if !yaml_emitter_process_head_comment(emitter) { - return false - } - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.canonical && !first { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { - return false - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - - if !first && !trail { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - - if !yaml_emitter_process_head_comment(emitter) { - return false - } - - if emitter.column == 0 { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, true) - } - if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a flow value node. -func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { - if simple { - if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { - return false - } - } else { - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { - return false - } - } - if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE) - } else { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) - } - if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { - return false - } - if len(emitter.line_comment)+len(emitter.foot_comment)+len(emitter.tail_comment) > 0 { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - return true -} - -// Expect a block item node. -func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_increase_indent(emitter, false, false) { - return false - } - } - if event.typ == yaml_SEQUENCE_END_EVENT { - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - if !yaml_emitter_process_head_comment(emitter) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) - if !yaml_emitter_emit_node(emitter, event, false, true, false, false) { - return false - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - return true -} - -// Expect a block key node. -func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_increase_indent(emitter, false, false) { - return false - } - } - if !yaml_emitter_process_head_comment(emitter) { - return false - } - if event.typ == yaml_MAPPING_END_EVENT { - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if len(emitter.line_comment) > 0 { - // [Go] A line comment was provided for the key. That's unusual as the - // scanner associates line comments with the value. Either way, - // save the line comment and render it appropriately later. - emitter.key_line_comment = emitter.line_comment - emitter.line_comment = nil - } - if yaml_emitter_check_simple_key(emitter) { - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, true) - } - if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a block value node. -func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { - if simple { - if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { - return false - } - } else { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { - return false - } - } - if len(emitter.key_line_comment) > 0 { - // [Go] A line comment was previously provided for the key. Handle it before - // the value so the inline comments are placed correctly. - if yaml_emitter_silent_nil_event(emitter, event) && len(emitter.line_comment) == 0 { - // Nothing other than the line comment will be written on the line. - emitter.line_comment = emitter.key_line_comment - emitter.key_line_comment = nil - } else { - // An actual value is coming, so emit the comment line. - emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment - if !yaml_emitter_process_line_comment(emitter) { - return false - } - emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment - // Indent in unless it's a block that will reindent anyway. - if event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || (event.typ != yaml_MAPPING_START_EVENT && event.typ != yaml_SEQUENCE_START_EVENT) { - emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) - if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { - return false - } - if !yaml_emitter_process_line_comment(emitter) { - return false - } - if !yaml_emitter_process_foot_comment(emitter) { - return false - } - return true -} - -func yaml_emitter_silent_nil_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { - return event.typ == yaml_SCALAR_EVENT && event.implicit && !emitter.canonical && len(emitter.scalar_data.value) == 0 -} - -// Expect a node. -func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, - root bool, sequence bool, mapping bool, simple_key bool) bool { - - emitter.root_context = root - emitter.sequence_context = sequence - emitter.mapping_context = mapping - emitter.simple_key_context = simple_key - - switch event.typ { - case yaml_ALIAS_EVENT: - return yaml_emitter_emit_alias(emitter, event) - case yaml_SCALAR_EVENT: - return yaml_emitter_emit_scalar(emitter, event) - case yaml_SEQUENCE_START_EVENT: - return yaml_emitter_emit_sequence_start(emitter, event) - case yaml_MAPPING_START_EVENT: - return yaml_emitter_emit_mapping_start(emitter, event) - default: - return yaml_emitter_set_emitter_error(emitter, - fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) - } -} - -// Expect ALIAS. -func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true -} - -// Expect SCALAR. -func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_select_scalar_style(emitter, event) { - return false - } - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - if !yaml_emitter_process_scalar(emitter) { - return false - } - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true -} - -// Expect SEQUENCE-START. -func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || - yaml_emitter_check_empty_sequence(emitter) { - emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE - } else { - emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE - } - return true -} - -// Expect MAPPING-START. -func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || - yaml_emitter_check_empty_mapping(emitter) { - emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE - } else { - emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE - } - return true -} - -// Check if the document content is an empty scalar. -func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { - return false // [Go] Huh? -} - -// Check if the next events represent an empty sequence. -func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { - if len(emitter.events)-emitter.events_head < 2 { - return false - } - return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && - emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT -} - -// Check if the next events represent an empty mapping. -func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { - if len(emitter.events)-emitter.events_head < 2 { - return false - } - return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && - emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT -} - -// Check if the next node can be expressed as a simple key. -func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { - length := 0 - switch emitter.events[emitter.events_head].typ { - case yaml_ALIAS_EVENT: - length += len(emitter.anchor_data.anchor) - case yaml_SCALAR_EVENT: - if emitter.scalar_data.multiline { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) + - len(emitter.scalar_data.value) - case yaml_SEQUENCE_START_EVENT: - if !yaml_emitter_check_empty_sequence(emitter) { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) - case yaml_MAPPING_START_EVENT: - if !yaml_emitter_check_empty_mapping(emitter) { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) - default: - return false - } - return length <= 128 -} - -// Determine an acceptable scalar style. -func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { - - no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 - if no_tag && !event.implicit && !event.quoted_implicit { - return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") - } - - style := event.scalar_style() - if style == yaml_ANY_SCALAR_STYLE { - style = yaml_PLAIN_SCALAR_STYLE - } - if emitter.canonical { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - if emitter.simple_key_context && emitter.scalar_data.multiline { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - - if style == yaml_PLAIN_SCALAR_STYLE { - if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || - emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - if no_tag && !event.implicit { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - } - if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { - if !emitter.scalar_data.single_quoted_allowed { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - } - if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { - if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - } - - if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { - emitter.tag_data.handle = []byte{'!'} - } - emitter.scalar_data.style = style - return true -} - -// Write an anchor. -func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { - if emitter.anchor_data.anchor == nil { - return true - } - c := []byte{'&'} - if emitter.anchor_data.alias { - c[0] = '*' - } - if !yaml_emitter_write_indicator(emitter, c, true, false, false) { - return false - } - return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) -} - -// Write a tag. -func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { - if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { - return true - } - if len(emitter.tag_data.handle) > 0 { - if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { - return false - } - if len(emitter.tag_data.suffix) > 0 { - if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { - return false - } - } - } else { - // [Go] Allocate these slices elsewhere. - if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { - return false - } - if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { - return false - } - } - return true -} - -// Write a scalar. -func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { - switch emitter.scalar_data.style { - case yaml_PLAIN_SCALAR_STYLE: - return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_SINGLE_QUOTED_SCALAR_STYLE: - return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_DOUBLE_QUOTED_SCALAR_STYLE: - return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_LITERAL_SCALAR_STYLE: - return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) - - case yaml_FOLDED_SCALAR_STYLE: - return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) - } - panic("unknown scalar style") -} - -// Write a head comment. -func yaml_emitter_process_head_comment(emitter *yaml_emitter_t) bool { - if len(emitter.tail_comment) > 0 { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_comment(emitter, emitter.tail_comment) { - return false - } - emitter.tail_comment = emitter.tail_comment[:0] - emitter.foot_indent = emitter.indent - if emitter.foot_indent < 0 { - emitter.foot_indent = 0 - } - } - - if len(emitter.head_comment) == 0 { - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_comment(emitter, emitter.head_comment) { - return false - } - emitter.head_comment = emitter.head_comment[:0] - return true -} - -// Write an line comment. -func yaml_emitter_process_line_comment(emitter *yaml_emitter_t) bool { - if len(emitter.line_comment) == 0 { - return true - } - if !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !yaml_emitter_write_comment(emitter, emitter.line_comment) { - return false - } - emitter.line_comment = emitter.line_comment[:0] - return true -} - -// Write a foot comment. -func yaml_emitter_process_foot_comment(emitter *yaml_emitter_t) bool { - if len(emitter.foot_comment) == 0 { - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_comment(emitter, emitter.foot_comment) { - return false - } - emitter.foot_comment = emitter.foot_comment[:0] - emitter.foot_indent = emitter.indent - if emitter.foot_indent < 0 { - emitter.foot_indent = 0 - } - return true -} - -// Check if a %YAML directive is valid. -func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { - if version_directive.major != 1 || version_directive.minor != 1 { - return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") - } - return true -} - -// Check if a %TAG directive is valid. -func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { - handle := tag_directive.handle - prefix := tag_directive.prefix - if len(handle) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") - } - if handle[0] != '!' { - return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") - } - if handle[len(handle)-1] != '!' { - return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") - } - for i := 1; i < len(handle)-1; i += width(handle[i]) { - if !is_alpha(handle, i) { - return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") - } - } - if len(prefix) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") - } - return true -} - -// Check if an anchor is valid. -func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { - if len(anchor) == 0 { - problem := "anchor value must not be empty" - if alias { - problem = "alias value must not be empty" - } - return yaml_emitter_set_emitter_error(emitter, problem) - } - for i := 0; i < len(anchor); i += width(anchor[i]) { - if !is_alpha(anchor, i) { - problem := "anchor value must contain alphanumerical characters only" - if alias { - problem = "alias value must contain alphanumerical characters only" - } - return yaml_emitter_set_emitter_error(emitter, problem) - } - } - emitter.anchor_data.anchor = anchor - emitter.anchor_data.alias = alias - return true -} - -// Check if a tag is valid. -func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { - if len(tag) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") - } - for i := 0; i < len(emitter.tag_directives); i++ { - tag_directive := &emitter.tag_directives[i] - if bytes.HasPrefix(tag, tag_directive.prefix) { - emitter.tag_data.handle = tag_directive.handle - emitter.tag_data.suffix = tag[len(tag_directive.prefix):] - return true - } - } - emitter.tag_data.suffix = tag - return true -} - -// Check if a scalar is valid. -func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { - var ( - block_indicators = false - flow_indicators = false - line_breaks = false - special_characters = false - tab_characters = false - - leading_space = false - leading_break = false - trailing_space = false - trailing_break = false - break_space = false - space_break = false - - preceded_by_whitespace = false - followed_by_whitespace = false - previous_space = false - previous_break = false - ) - - emitter.scalar_data.value = value - - if len(value) == 0 { - emitter.scalar_data.multiline = false - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = true - emitter.scalar_data.single_quoted_allowed = true - emitter.scalar_data.block_allowed = false - return true - } - - if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { - block_indicators = true - flow_indicators = true - } - - preceded_by_whitespace = true - for i, w := 0, 0; i < len(value); i += w { - w = width(value[i]) - followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) - - if i == 0 { - switch value[i] { - case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': - flow_indicators = true - block_indicators = true - case '?', ':': - flow_indicators = true - if followed_by_whitespace { - block_indicators = true - } - case '-': - if followed_by_whitespace { - flow_indicators = true - block_indicators = true - } - } - } else { - switch value[i] { - case ',', '?', '[', ']', '{', '}': - flow_indicators = true - case ':': - flow_indicators = true - if followed_by_whitespace { - block_indicators = true - } - case '#': - if preceded_by_whitespace { - flow_indicators = true - block_indicators = true - } - } - } - - if value[i] == '\t' { - tab_characters = true - } else if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { - special_characters = true - } - if is_space(value, i) { - if i == 0 { - leading_space = true - } - if i+width(value[i]) == len(value) { - trailing_space = true - } - if previous_break { - break_space = true - } - previous_space = true - previous_break = false - } else if is_break(value, i) { - line_breaks = true - if i == 0 { - leading_break = true - } - if i+width(value[i]) == len(value) { - trailing_break = true - } - if previous_space { - space_break = true - } - previous_space = false - previous_break = true - } else { - previous_space = false - previous_break = false - } - - // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. - preceded_by_whitespace = is_blankz(value, i) - } - - emitter.scalar_data.multiline = line_breaks - emitter.scalar_data.flow_plain_allowed = true - emitter.scalar_data.block_plain_allowed = true - emitter.scalar_data.single_quoted_allowed = true - emitter.scalar_data.block_allowed = true - - if leading_space || leading_break || trailing_space || trailing_break { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - } - if trailing_space { - emitter.scalar_data.block_allowed = false - } - if break_space { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - emitter.scalar_data.single_quoted_allowed = false - } - if space_break || tab_characters || special_characters { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - emitter.scalar_data.single_quoted_allowed = false - } - if space_break || special_characters { - emitter.scalar_data.block_allowed = false - } - if line_breaks { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - } - if flow_indicators { - emitter.scalar_data.flow_plain_allowed = false - } - if block_indicators { - emitter.scalar_data.block_plain_allowed = false - } - return true -} - -// Check if the event data is valid. -func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { - - emitter.anchor_data.anchor = nil - emitter.tag_data.handle = nil - emitter.tag_data.suffix = nil - emitter.scalar_data.value = nil - - if len(event.head_comment) > 0 { - emitter.head_comment = event.head_comment - } - if len(event.line_comment) > 0 { - emitter.line_comment = event.line_comment - } - if len(event.foot_comment) > 0 { - emitter.foot_comment = event.foot_comment - } - if len(event.tail_comment) > 0 { - emitter.tail_comment = event.tail_comment - } - - switch event.typ { - case yaml_ALIAS_EVENT: - if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { - return false - } - - case yaml_SCALAR_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - if !yaml_emitter_analyze_scalar(emitter, event.value) { - return false - } - - case yaml_SEQUENCE_START_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - - case yaml_MAPPING_START_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - } - return true -} - -// Write the BOM character. -func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { - if !flush(emitter) { - return false - } - pos := emitter.buffer_pos - emitter.buffer[pos+0] = '\xEF' - emitter.buffer[pos+1] = '\xBB' - emitter.buffer[pos+2] = '\xBF' - emitter.buffer_pos += 3 - return true -} - -func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { - indent := emitter.indent - if indent < 0 { - indent = 0 - } - if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { - if !put_break(emitter) { - return false - } - } - if emitter.foot_indent == indent { - if !put_break(emitter) { - return false - } - } - for emitter.column < indent { - if !put(emitter, ' ') { - return false - } - } - emitter.whitespace = true - //emitter.indention = true - emitter.space_above = false - emitter.foot_indent = -1 - return true -} - -func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { - if need_whitespace && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !write_all(emitter, indicator) { - return false - } - emitter.whitespace = is_whitespace - emitter.indention = (emitter.indention && is_indention) - emitter.open_ended = false - return true -} - -func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { - if !write_all(emitter, value) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { - if !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !write_all(emitter, value) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { - if need_whitespace && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - for i := 0; i < len(value); { - var must_write bool - switch value[i] { - case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': - must_write = true - default: - must_write = is_alpha(value, i) - } - if must_write { - if !write(emitter, value, &i) { - return false - } - } else { - w := width(value[i]) - for k := 0; k < w; k++ { - octet := value[i] - i++ - if !put(emitter, '%') { - return false - } - - c := octet >> 4 - if c < 10 { - c += '0' - } else { - c += 'A' - 10 - } - if !put(emitter, c) { - return false - } - - c = octet & 0x0f - if c < 10 { - c += '0' - } else { - c += 'A' - 10 - } - if !put(emitter, c) { - return false - } - } - } - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - if len(value) > 0 && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - - spaces := false - breaks := false - for i := 0; i < len(value); { - if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - spaces = true - } else if is_break(value, i) { - if !breaks && value[i] == '\n' { - if !put_break(emitter) { - return false - } - } - if !write_break(emitter, value, &i) { - return false - } - //emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - spaces = false - breaks = false - } - } - - if len(value) > 0 { - emitter.whitespace = false - } - emitter.indention = false - if emitter.root_context { - emitter.open_ended = true - } - - return true -} - -func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - - if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { - return false - } - - spaces := false - breaks := false - for i := 0; i < len(value); { - if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - spaces = true - } else if is_break(value, i) { - if !breaks && value[i] == '\n' { - if !put_break(emitter) { - return false - } - } - if !write_break(emitter, value, &i) { - return false - } - //emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if value[i] == '\'' { - if !put(emitter, '\'') { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - spaces = false - breaks = false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - spaces := false - if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { - return false - } - - for i := 0; i < len(value); { - if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || - is_bom(value, i) || is_break(value, i) || - value[i] == '"' || value[i] == '\\' { - - octet := value[i] - - var w int - var v rune - switch { - case octet&0x80 == 0x00: - w, v = 1, rune(octet&0x7F) - case octet&0xE0 == 0xC0: - w, v = 2, rune(octet&0x1F) - case octet&0xF0 == 0xE0: - w, v = 3, rune(octet&0x0F) - case octet&0xF8 == 0xF0: - w, v = 4, rune(octet&0x07) - } - for k := 1; k < w; k++ { - octet = value[i+k] - v = (v << 6) + (rune(octet) & 0x3F) - } - i += w - - if !put(emitter, '\\') { - return false - } - - var ok bool - switch v { - case 0x00: - ok = put(emitter, '0') - case 0x07: - ok = put(emitter, 'a') - case 0x08: - ok = put(emitter, 'b') - case 0x09: - ok = put(emitter, 't') - case 0x0A: - ok = put(emitter, 'n') - case 0x0b: - ok = put(emitter, 'v') - case 0x0c: - ok = put(emitter, 'f') - case 0x0d: - ok = put(emitter, 'r') - case 0x1b: - ok = put(emitter, 'e') - case 0x22: - ok = put(emitter, '"') - case 0x5c: - ok = put(emitter, '\\') - case 0x85: - ok = put(emitter, 'N') - case 0xA0: - ok = put(emitter, '_') - case 0x2028: - ok = put(emitter, 'L') - case 0x2029: - ok = put(emitter, 'P') - default: - if v <= 0xFF { - ok = put(emitter, 'x') - w = 2 - } else if v <= 0xFFFF { - ok = put(emitter, 'u') - w = 4 - } else { - ok = put(emitter, 'U') - w = 8 - } - for k := (w - 1) * 4; ok && k >= 0; k -= 4 { - digit := byte((v >> uint(k)) & 0x0F) - if digit < 10 { - ok = put(emitter, digit+'0') - } else { - ok = put(emitter, digit+'A'-10) - } - } - } - if !ok { - return false - } - spaces = false - } else if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { - if !yaml_emitter_write_indent(emitter) { - return false - } - if is_space(value, i+1) { - if !put(emitter, '\\') { - return false - } - } - i += width(value[i]) - } else if !write(emitter, value, &i) { - return false - } - spaces = true - } else { - if !write(emitter, value, &i) { - return false - } - spaces = false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { - if is_space(value, 0) || is_break(value, 0) { - indent_hint := []byte{'0' + byte(emitter.best_indent)} - if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { - return false - } - } - - emitter.open_ended = false - - var chomp_hint [1]byte - if len(value) == 0 { - chomp_hint[0] = '-' - } else { - i := len(value) - 1 - for value[i]&0xC0 == 0x80 { - i-- - } - if !is_break(value, i) { - chomp_hint[0] = '-' - } else if i == 0 { - chomp_hint[0] = '+' - emitter.open_ended = true - } else { - i-- - for value[i]&0xC0 == 0x80 { - i-- - } - if is_break(value, i) { - chomp_hint[0] = '+' - emitter.open_ended = true - } - } - } - if chomp_hint[0] != 0 { - if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { - return false - } - } - return true -} - -func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { - if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { - return false - } - if !yaml_emitter_write_block_scalar_hints(emitter, value) { - return false - } - if !put_break(emitter) { - return false - } - //emitter.indention = true - emitter.whitespace = true - breaks := true - for i := 0; i < len(value); { - if is_break(value, i) { - if !write_break(emitter, value, &i) { - return false - } - //emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - breaks = false - } - } - - return true -} - -func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { - if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { - return false - } - if !yaml_emitter_write_block_scalar_hints(emitter, value) { - return false - } - - if !put_break(emitter) { - return false - } - //emitter.indention = true - emitter.whitespace = true - - breaks := true - leading_spaces := true - for i := 0; i < len(value); { - if is_break(value, i) { - if !breaks && !leading_spaces && value[i] == '\n' { - k := 0 - for is_break(value, k) { - k += width(value[k]) - } - if !is_blankz(value, k) { - if !put_break(emitter) { - return false - } - } - } - if !write_break(emitter, value, &i) { - return false - } - //emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - leading_spaces = is_blank(value, i) - } - if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - emitter.indention = false - breaks = false - } - } - return true -} - -func yaml_emitter_write_comment(emitter *yaml_emitter_t, comment []byte) bool { - breaks := false - pound := false - for i := 0; i < len(comment); { - if is_break(comment, i) { - if !write_break(emitter, comment, &i) { - return false - } - //emitter.indention = true - breaks = true - pound = false - } else { - if breaks && !yaml_emitter_write_indent(emitter) { - return false - } - if !pound { - if comment[i] != '#' && (!put(emitter, '#') || !put(emitter, ' ')) { - return false - } - pound = true - } - if !write(emitter, comment, &i) { - return false - } - emitter.indention = false - breaks = false - } - } - if !breaks && !put_break(emitter) { - return false - } - - emitter.whitespace = true - //emitter.indention = true - return true -} diff --git a/vendor/gopkg.in/yaml.v3/encode.go b/vendor/gopkg.in/yaml.v3/encode.go deleted file mode 100644 index 45e8d1e1b..000000000 --- a/vendor/gopkg.in/yaml.v3/encode.go +++ /dev/null @@ -1,572 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// -// 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 yaml - -import ( - "encoding" - "fmt" - "io" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -type encoder struct { - emitter yaml_emitter_t - event yaml_event_t - out []byte - flow bool - indent int - doneInit bool -} - -func newEncoder() *encoder { - e := &encoder{} - yaml_emitter_initialize(&e.emitter) - yaml_emitter_set_output_string(&e.emitter, &e.out) - yaml_emitter_set_unicode(&e.emitter, true) - return e -} - -func newEncoderWithWriter(w io.Writer) *encoder { - e := &encoder{} - yaml_emitter_initialize(&e.emitter) - yaml_emitter_set_output_writer(&e.emitter, w) - yaml_emitter_set_unicode(&e.emitter, true) - return e -} - -func (e *encoder) init() { - if e.doneInit { - return - } - if e.indent == 0 { - e.indent = 4 - } - e.emitter.best_indent = e.indent - yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) - e.emit() - e.doneInit = true -} - -func (e *encoder) finish() { - e.emitter.open_ended = false - yaml_stream_end_event_initialize(&e.event) - e.emit() -} - -func (e *encoder) destroy() { - yaml_emitter_delete(&e.emitter) -} - -func (e *encoder) emit() { - // This will internally delete the e.event value. - e.must(yaml_emitter_emit(&e.emitter, &e.event)) -} - -func (e *encoder) must(ok bool) { - if !ok { - msg := e.emitter.problem - if msg == "" { - msg = "unknown problem generating YAML content" - } - failf("%s", msg) - } -} - -func (e *encoder) marshalDoc(tag string, in reflect.Value) { - e.init() - var node *Node - if in.IsValid() { - node, _ = in.Interface().(*Node) - } - if node != nil && node.Kind == DocumentNode { - e.nodev(in) - } else { - yaml_document_start_event_initialize(&e.event, nil, nil, true) - e.emit() - e.marshal(tag, in) - yaml_document_end_event_initialize(&e.event, true) - e.emit() - } -} - -func (e *encoder) marshal(tag string, in reflect.Value) { - tag = shortTag(tag) - if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { - e.nilv() - return - } - iface := in.Interface() - switch value := iface.(type) { - case *Node: - e.nodev(in) - return - case Node: - e.nodev(in.Addr()) - return - case time.Time: - e.timev(tag, in) - return - case *time.Time: - e.timev(tag, in.Elem()) - return - case time.Duration: - e.stringv(tag, reflect.ValueOf(value.String())) - return - case Marshaler: - v, err := value.MarshalYAML() - if err != nil { - fail(err) - } - if v == nil { - e.nilv() - return - } - e.marshal(tag, reflect.ValueOf(v)) - return - case encoding.TextMarshaler: - text, err := value.MarshalText() - if err != nil { - fail(err) - } - in = reflect.ValueOf(string(text)) - case nil: - e.nilv() - return - } - switch in.Kind() { - case reflect.Interface: - e.marshal(tag, in.Elem()) - case reflect.Map: - e.mapv(tag, in) - case reflect.Ptr: - e.marshal(tag, in.Elem()) - case reflect.Struct: - e.structv(tag, in) - case reflect.Slice, reflect.Array: - e.slicev(tag, in) - case reflect.String: - e.stringv(tag, in) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - e.intv(tag, in) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - e.uintv(tag, in) - case reflect.Float32, reflect.Float64: - e.floatv(tag, in) - case reflect.Bool: - e.boolv(tag, in) - default: - panic("cannot marshal type: " + in.Type().String()) - } -} - -func (e *encoder) mapv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - keys := keyList(in.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - e.marshal("", k) - e.marshal("", in.MapIndex(k)) - } - }) -} - -func (e *encoder) fieldByIndex(v reflect.Value, index []int) (field reflect.Value) { - for _, num := range index { - for { - if v.Kind() == reflect.Ptr { - if v.IsNil() { - return reflect.Value{} - } - v = v.Elem() - continue - } - break - } - v = v.Field(num) - } - return v -} - -func (e *encoder) structv(tag string, in reflect.Value) { - sinfo, err := getStructInfo(in.Type()) - if err != nil { - panic(err) - } - e.mappingv(tag, func() { - for _, info := range sinfo.FieldsList { - var value reflect.Value - if info.Inline == nil { - value = in.Field(info.Num) - } else { - value = e.fieldByIndex(in, info.Inline) - if !value.IsValid() { - continue - } - } - if info.OmitEmpty && isZero(value) { - continue - } - e.marshal("", reflect.ValueOf(info.Key)) - e.flow = info.Flow - e.marshal("", value) - } - if sinfo.InlineMap >= 0 { - m := in.Field(sinfo.InlineMap) - if m.Len() > 0 { - e.flow = false - keys := keyList(m.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - if _, found := sinfo.FieldsMap[k.String()]; found { - panic(fmt.Sprintf("cannot have key %q in inlined map: conflicts with struct field", k.String())) - } - e.marshal("", k) - e.flow = false - e.marshal("", m.MapIndex(k)) - } - } - } - }) -} - -func (e *encoder) mappingv(tag string, f func()) { - implicit := tag == "" - style := yaml_BLOCK_MAPPING_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_MAPPING_STYLE - } - yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) - e.emit() - f() - yaml_mapping_end_event_initialize(&e.event) - e.emit() -} - -func (e *encoder) slicev(tag string, in reflect.Value) { - implicit := tag == "" - style := yaml_BLOCK_SEQUENCE_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_SEQUENCE_STYLE - } - e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) - e.emit() - n := in.Len() - for i := 0; i < n; i++ { - e.marshal("", in.Index(i)) - } - e.must(yaml_sequence_end_event_initialize(&e.event)) - e.emit() -} - -// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. -// -// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported -// in YAML 1.2 and by this package, but these should be marshalled quoted for -// the time being for compatibility with other parsers. -func isBase60Float(s string) (result bool) { - // Fast path. - if s == "" { - return false - } - c := s[0] - if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { - return false - } - // Do the full match. - return base60float.MatchString(s) -} - -// From http://yaml.org/type/float.html, except the regular expression there -// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. -var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) - -// isOldBool returns whether s is bool notation as defined in YAML 1.1. -// -// We continue to force strings that YAML 1.1 would interpret as booleans to be -// rendered as quotes strings so that the marshalled output valid for YAML 1.1 -// parsing. -func isOldBool(s string) (result bool) { - switch s { - case "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", - "n", "N", "no", "No", "NO", "off", "Off", "OFF": - return true - default: - return false - } -} - -func (e *encoder) stringv(tag string, in reflect.Value) { - var style yaml_scalar_style_t - s := in.String() - canUsePlain := true - switch { - case !utf8.ValidString(s): - if tag == binaryTag { - failf("explicitly tagged !!binary data must be base64-encoded") - } - if tag != "" { - failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) - } - // It can't be encoded directly as YAML so use a binary tag - // and encode it as base64. - tag = binaryTag - s = encodeBase64(s) - case tag == "": - // Check to see if it would resolve to a specific - // tag when encoded unquoted. If it doesn't, - // there's no need to quote it. - rtag, _ := resolve("", s) - canUsePlain = rtag == strTag && !(isBase60Float(s) || isOldBool(s)) - } - // Note: it's possible for user code to emit invalid YAML - // if they explicitly specify a tag and a string containing - // text that's incompatible with that tag. - switch { - case strings.Contains(s, "\n"): - if e.flow { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } else { - style = yaml_LITERAL_SCALAR_STYLE - } - case canUsePlain: - style = yaml_PLAIN_SCALAR_STYLE - default: - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - e.emitScalar(s, "", tag, style, nil, nil, nil, nil) -} - -func (e *encoder) boolv(tag string, in reflect.Value) { - var s string - if in.Bool() { - s = "true" - } else { - s = "false" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) -} - -func (e *encoder) intv(tag string, in reflect.Value) { - s := strconv.FormatInt(in.Int(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) -} - -func (e *encoder) uintv(tag string, in reflect.Value) { - s := strconv.FormatUint(in.Uint(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) -} - -func (e *encoder) timev(tag string, in reflect.Value) { - t := in.Interface().(time.Time) - s := t.Format(time.RFC3339Nano) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) -} - -func (e *encoder) floatv(tag string, in reflect.Value) { - // Issue #352: When formatting, use the precision of the underlying value - precision := 64 - if in.Kind() == reflect.Float32 { - precision = 32 - } - - s := strconv.FormatFloat(in.Float(), 'g', -1, precision) - switch s { - case "+Inf": - s = ".inf" - case "-Inf": - s = "-.inf" - case "NaN": - s = ".nan" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) -} - -func (e *encoder) nilv() { - e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE, nil, nil, nil, nil) -} - -func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t, head, line, foot, tail []byte) { - // TODO Kill this function. Replace all initialize calls by their underlining Go literals. - implicit := tag == "" - if !implicit { - tag = longTag(tag) - } - e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) - e.event.head_comment = head - e.event.line_comment = line - e.event.foot_comment = foot - e.event.tail_comment = tail - e.emit() -} - -func (e *encoder) nodev(in reflect.Value) { - e.node(in.Interface().(*Node), "") -} - -func (e *encoder) node(node *Node, tail string) { - // Zero nodes behave as nil. - if node.Kind == 0 && node.IsZero() { - e.nilv() - return - } - - // If the tag was not explicitly requested, and dropping it won't change the - // implicit tag of the value, don't include it in the presentation. - var tag = node.Tag - var stag = shortTag(tag) - var forceQuoting bool - if tag != "" && node.Style&TaggedStyle == 0 { - if node.Kind == ScalarNode { - if stag == strTag && node.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0 { - tag = "" - } else { - rtag, _ := resolve("", node.Value) - if rtag == stag { - tag = "" - } else if stag == strTag { - tag = "" - forceQuoting = true - } - } - } else { - var rtag string - switch node.Kind { - case MappingNode: - rtag = mapTag - case SequenceNode: - rtag = seqTag - } - if rtag == stag { - tag = "" - } - } - } - - switch node.Kind { - case DocumentNode: - yaml_document_start_event_initialize(&e.event, nil, nil, true) - e.event.head_comment = []byte(node.HeadComment) - e.emit() - for _, node := range node.Content { - e.node(node, "") - } - yaml_document_end_event_initialize(&e.event, true) - e.event.foot_comment = []byte(node.FootComment) - e.emit() - - case SequenceNode: - style := yaml_BLOCK_SEQUENCE_STYLE - if node.Style&FlowStyle != 0 { - style = yaml_FLOW_SEQUENCE_STYLE - } - e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style)) - e.event.head_comment = []byte(node.HeadComment) - e.emit() - for _, node := range node.Content { - e.node(node, "") - } - e.must(yaml_sequence_end_event_initialize(&e.event)) - e.event.line_comment = []byte(node.LineComment) - e.event.foot_comment = []byte(node.FootComment) - e.emit() - - case MappingNode: - style := yaml_BLOCK_MAPPING_STYLE - if node.Style&FlowStyle != 0 { - style = yaml_FLOW_MAPPING_STYLE - } - yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style) - e.event.tail_comment = []byte(tail) - e.event.head_comment = []byte(node.HeadComment) - e.emit() - - // The tail logic below moves the foot comment of prior keys to the following key, - // since the value for each key may be a nested structure and the foot needs to be - // processed only the entirety of the value is streamed. The last tail is processed - // with the mapping end event. - var tail string - for i := 0; i+1 < len(node.Content); i += 2 { - k := node.Content[i] - foot := k.FootComment - if foot != "" { - kopy := *k - kopy.FootComment = "" - k = &kopy - } - e.node(k, tail) - tail = foot - - v := node.Content[i+1] - e.node(v, "") - } - - yaml_mapping_end_event_initialize(&e.event) - e.event.tail_comment = []byte(tail) - e.event.line_comment = []byte(node.LineComment) - e.event.foot_comment = []byte(node.FootComment) - e.emit() - - case AliasNode: - yaml_alias_event_initialize(&e.event, []byte(node.Value)) - e.event.head_comment = []byte(node.HeadComment) - e.event.line_comment = []byte(node.LineComment) - e.event.foot_comment = []byte(node.FootComment) - e.emit() - - case ScalarNode: - value := node.Value - if !utf8.ValidString(value) { - if stag == binaryTag { - failf("explicitly tagged !!binary data must be base64-encoded") - } - if stag != "" { - failf("cannot marshal invalid UTF-8 data as %s", stag) - } - // It can't be encoded directly as YAML so use a binary tag - // and encode it as base64. - tag = binaryTag - value = encodeBase64(value) - } - - style := yaml_PLAIN_SCALAR_STYLE - switch { - case node.Style&DoubleQuotedStyle != 0: - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - case node.Style&SingleQuotedStyle != 0: - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - case node.Style&LiteralStyle != 0: - style = yaml_LITERAL_SCALAR_STYLE - case node.Style&FoldedStyle != 0: - style = yaml_FOLDED_SCALAR_STYLE - case strings.Contains(value, "\n"): - style = yaml_LITERAL_SCALAR_STYLE - case forceQuoting: - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - - e.emitScalar(value, node.Anchor, tag, style, []byte(node.HeadComment), []byte(node.LineComment), []byte(node.FootComment), []byte(tail)) - default: - failf("cannot encode node with unknown kind %d", node.Kind) - } -} diff --git a/vendor/gopkg.in/yaml.v3/go.mod b/vendor/gopkg.in/yaml.v3/go.mod deleted file mode 100644 index f407ea321..000000000 --- a/vendor/gopkg.in/yaml.v3/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module "gopkg.in/yaml.v3" - -require ( - "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 -) diff --git a/vendor/gopkg.in/yaml.v3/parserc.go b/vendor/gopkg.in/yaml.v3/parserc.go deleted file mode 100644 index ac66fccc0..000000000 --- a/vendor/gopkg.in/yaml.v3/parserc.go +++ /dev/null @@ -1,1249 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -import ( - "bytes" -) - -// The parser implements the following grammar: -// -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// implicit_document ::= block_node DOCUMENT-END* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// block_node_or_indentless_sequence ::= -// ALIAS -// | properties (block_content | indentless_block_sequence)? -// | block_content -// | indentless_block_sequence -// block_node ::= ALIAS -// | properties block_content? -// | block_content -// flow_node ::= ALIAS -// | properties flow_content? -// | flow_content -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// block_content ::= block_collection | flow_collection | SCALAR -// flow_content ::= flow_collection | SCALAR -// block_collection ::= block_sequence | block_mapping -// flow_collection ::= flow_sequence | flow_mapping -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// block_mapping ::= BLOCK-MAPPING_START -// ((KEY block_node_or_indentless_sequence?)? -// (VALUE block_node_or_indentless_sequence?)?)* -// BLOCK-END -// flow_sequence ::= FLOW-SEQUENCE-START -// (flow_sequence_entry FLOW-ENTRY)* -// flow_sequence_entry? -// FLOW-SEQUENCE-END -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// flow_mapping ::= FLOW-MAPPING-START -// (flow_mapping_entry FLOW-ENTRY)* -// flow_mapping_entry? -// FLOW-MAPPING-END -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? - -// Peek the next token in the token queue. -func peek_token(parser *yaml_parser_t) *yaml_token_t { - if parser.token_available || yaml_parser_fetch_more_tokens(parser) { - token := &parser.tokens[parser.tokens_head] - yaml_parser_unfold_comments(parser, token) - return token - } - return nil -} - -// yaml_parser_unfold_comments walks through the comments queue and joins all -// comments behind the position of the provided token into the respective -// top-level comment slices in the parser. -func yaml_parser_unfold_comments(parser *yaml_parser_t, token *yaml_token_t) { - for parser.comments_head < len(parser.comments) && token.start_mark.index >= parser.comments[parser.comments_head].token_mark.index { - comment := &parser.comments[parser.comments_head] - if len(comment.head) > 0 { - if token.typ == yaml_BLOCK_END_TOKEN { - // No heads on ends, so keep comment.head for a follow up token. - break - } - if len(parser.head_comment) > 0 { - parser.head_comment = append(parser.head_comment, '\n') - } - parser.head_comment = append(parser.head_comment, comment.head...) - } - if len(comment.foot) > 0 { - if len(parser.foot_comment) > 0 { - parser.foot_comment = append(parser.foot_comment, '\n') - } - parser.foot_comment = append(parser.foot_comment, comment.foot...) - } - if len(comment.line) > 0 { - if len(parser.line_comment) > 0 { - parser.line_comment = append(parser.line_comment, '\n') - } - parser.line_comment = append(parser.line_comment, comment.line...) - } - *comment = yaml_comment_t{} - parser.comments_head++ - } -} - -// Remove the next token from the queue (must be called after peek_token). -func skip_token(parser *yaml_parser_t) { - parser.token_available = false - parser.tokens_parsed++ - parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN - parser.tokens_head++ -} - -// Get the next event. -func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { - // Erase the event object. - *event = yaml_event_t{} - - // No events after the end of the stream or error. - if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { - return true - } - - // Generate the next event. - return yaml_parser_state_machine(parser, event) -} - -// Set parser error. -func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { - parser.error = yaml_PARSER_ERROR - parser.problem = problem - parser.problem_mark = problem_mark - return false -} - -func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { - parser.error = yaml_PARSER_ERROR - parser.context = context - parser.context_mark = context_mark - parser.problem = problem - parser.problem_mark = problem_mark - return false -} - -// State dispatcher. -func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { - //trace("yaml_parser_state_machine", "state:", parser.state.String()) - - switch parser.state { - case yaml_PARSE_STREAM_START_STATE: - return yaml_parser_parse_stream_start(parser, event) - - case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: - return yaml_parser_parse_document_start(parser, event, true) - - case yaml_PARSE_DOCUMENT_START_STATE: - return yaml_parser_parse_document_start(parser, event, false) - - case yaml_PARSE_DOCUMENT_CONTENT_STATE: - return yaml_parser_parse_document_content(parser, event) - - case yaml_PARSE_DOCUMENT_END_STATE: - return yaml_parser_parse_document_end(parser, event) - - case yaml_PARSE_BLOCK_NODE_STATE: - return yaml_parser_parse_node(parser, event, true, false) - - case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: - return yaml_parser_parse_node(parser, event, true, true) - - case yaml_PARSE_FLOW_NODE_STATE: - return yaml_parser_parse_node(parser, event, false, false) - - case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: - return yaml_parser_parse_block_sequence_entry(parser, event, true) - - case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_block_sequence_entry(parser, event, false) - - case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_indentless_sequence_entry(parser, event) - - case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: - return yaml_parser_parse_block_mapping_key(parser, event, true) - - case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: - return yaml_parser_parse_block_mapping_key(parser, event, false) - - case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: - return yaml_parser_parse_block_mapping_value(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: - return yaml_parser_parse_flow_sequence_entry(parser, event, true) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_flow_sequence_entry(parser, event, false) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) - - case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_parser_parse_flow_mapping_key(parser, event, true) - - case yaml_PARSE_FLOW_MAPPING_KEY_STATE: - return yaml_parser_parse_flow_mapping_key(parser, event, false) - - case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: - return yaml_parser_parse_flow_mapping_value(parser, event, false) - - case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: - return yaml_parser_parse_flow_mapping_value(parser, event, true) - - default: - panic("invalid parser state") - } -} - -// Parse the production: -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ -func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_STREAM_START_TOKEN { - return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) - } - parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE - *event = yaml_event_t{ - typ: yaml_STREAM_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - encoding: token.encoding, - } - skip_token(parser) - return true -} - -// Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// * -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* -func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { - - token := peek_token(parser) - if token == nil { - return false - } - - // Parse extra document end indicators. - if !implicit { - for token.typ == yaml_DOCUMENT_END_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } - - if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && - token.typ != yaml_TAG_DIRECTIVE_TOKEN && - token.typ != yaml_DOCUMENT_START_TOKEN && - token.typ != yaml_STREAM_END_TOKEN { - // Parse an implicit document. - if !yaml_parser_process_directives(parser, nil, nil) { - return false - } - parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) - parser.state = yaml_PARSE_BLOCK_NODE_STATE - - var head_comment []byte - if len(parser.head_comment) > 0 { - // [Go] Scan the header comment backwards, and if an empty line is found, break - // the header so the part before the last empty line goes into the - // document header, while the bottom of it goes into a follow up event. - for i := len(parser.head_comment) - 1; i > 0; i-- { - if parser.head_comment[i] == '\n' { - if i == len(parser.head_comment)-1 { - head_comment = parser.head_comment[:i] - parser.head_comment = parser.head_comment[i+1:] - break - } else if parser.head_comment[i-1] == '\n' { - head_comment = parser.head_comment[:i-1] - parser.head_comment = parser.head_comment[i+1:] - break - } - } - } - } - - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - - head_comment: head_comment, - } - - } else if token.typ != yaml_STREAM_END_TOKEN { - // Parse an explicit document. - var version_directive *yaml_version_directive_t - var tag_directives []yaml_tag_directive_t - start_mark := token.start_mark - if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { - return false - } - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_DOCUMENT_START_TOKEN { - yaml_parser_set_parser_error(parser, - "did not find expected ", token.start_mark) - return false - } - parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) - parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE - end_mark := token.end_mark - - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - version_directive: version_directive, - tag_directives: tag_directives, - implicit: false, - } - skip_token(parser) - - } else { - // Parse the stream end. - parser.state = yaml_PARSE_END_STATE - *event = yaml_event_t{ - typ: yaml_STREAM_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - } - - return true -} - -// Parse the productions: -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** -// -func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || - token.typ == yaml_TAG_DIRECTIVE_TOKEN || - token.typ == yaml_DOCUMENT_START_TOKEN || - token.typ == yaml_DOCUMENT_END_TOKEN || - token.typ == yaml_STREAM_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - return yaml_parser_process_empty_scalar(parser, event, - token.start_mark) - } - return yaml_parser_parse_node(parser, event, true, false) -} - -// Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// -func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - start_mark := token.start_mark - end_mark := token.start_mark - - implicit := true - if token.typ == yaml_DOCUMENT_END_TOKEN { - end_mark = token.end_mark - skip_token(parser) - implicit = false - } - - parser.tag_directives = parser.tag_directives[:0] - - parser.state = yaml_PARSE_DOCUMENT_START_STATE - *event = yaml_event_t{ - typ: yaml_DOCUMENT_END_EVENT, - start_mark: start_mark, - end_mark: end_mark, - implicit: implicit, - } - yaml_parser_set_event_comments(parser, event) - if len(event.head_comment) > 0 && len(event.foot_comment) == 0 { - event.foot_comment = event.head_comment - event.head_comment = nil - } - return true -} - -func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) { - event.head_comment = parser.head_comment - event.line_comment = parser.line_comment - event.foot_comment = parser.foot_comment - parser.head_comment = nil - parser.line_comment = nil - parser.foot_comment = nil - parser.tail_comment = nil - parser.stem_comment = nil -} - -// Parse the productions: -// block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * -// block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * -// flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* -// block_content ::= block_collection | flow_collection | SCALAR -// ****** -// flow_content ::= flow_collection | SCALAR -// ****** -func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { - //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_ALIAS_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - *event = yaml_event_t{ - typ: yaml_ALIAS_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - anchor: token.value, - } - yaml_parser_set_event_comments(parser, event) - skip_token(parser) - return true - } - - start_mark := token.start_mark - end_mark := token.start_mark - - var tag_token bool - var tag_handle, tag_suffix, anchor []byte - var tag_mark yaml_mark_t - if token.typ == yaml_ANCHOR_TOKEN { - anchor = token.value - start_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_TAG_TOKEN { - tag_token = true - tag_handle = token.value - tag_suffix = token.suffix - tag_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } else if token.typ == yaml_TAG_TOKEN { - tag_token = true - tag_handle = token.value - tag_suffix = token.suffix - start_mark = token.start_mark - tag_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_ANCHOR_TOKEN { - anchor = token.value - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } - - var tag []byte - if tag_token { - if len(tag_handle) == 0 { - tag = tag_suffix - tag_suffix = nil - } else { - for i := range parser.tag_directives { - if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { - tag = append([]byte(nil), parser.tag_directives[i].prefix...) - tag = append(tag, tag_suffix...) - break - } - } - if len(tag) == 0 { - yaml_parser_set_parser_error_context(parser, - "while parsing a node", start_mark, - "found undefined tag handle", tag_mark) - return false - } - } - } - - implicit := len(tag) == 0 - if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), - } - return true - } - if token.typ == yaml_SCALAR_TOKEN { - var plain_implicit, quoted_implicit bool - end_mark = token.end_mark - if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { - plain_implicit = true - } else if len(tag) == 0 { - quoted_implicit = true - } - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - value: token.value, - implicit: plain_implicit, - quoted_implicit: quoted_implicit, - style: yaml_style_t(token.style), - } - yaml_parser_set_event_comments(parser, event) - skip_token(parser) - return true - } - if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { - // [Go] Some of the events below can be merged as they differ only on style. - end_mark = token.end_mark - parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), - } - yaml_parser_set_event_comments(parser, event) - return true - } - if token.typ == yaml_FLOW_MAPPING_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), - } - yaml_parser_set_event_comments(parser, event) - return true - } - if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), - } - if parser.stem_comment != nil { - event.head_comment = parser.stem_comment - parser.stem_comment = nil - } - return true - } - if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), - } - if parser.stem_comment != nil { - event.head_comment = parser.stem_comment - parser.stem_comment = nil - } - return true - } - if len(anchor) > 0 || len(tag) > 0 { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - quoted_implicit: false, - style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), - } - return true - } - - context := "while parsing a flow node" - if block { - context = "while parsing a block node" - } - yaml_parser_set_parser_error_context(parser, context, start_mark, - "did not find expected node content", token.start_mark) - return false -} - -// Parse the productions: -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* -// -func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_BLOCK_ENTRY_TOKEN { - mark := token.end_mark - prior_head_len := len(parser.head_comment) - skip_token(parser) - yaml_parser_split_stem_comment(parser, prior_head_len) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, true, false) - } else { - parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - } - if token.typ == yaml_BLOCK_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - skip_token(parser) - return true - } - - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a block collection", context_mark, - "did not find expected '-' indicator", token.start_mark) -} - -// Parse the productions: -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * -func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_BLOCK_ENTRY_TOKEN { - mark := token.end_mark - prior_head_len := len(parser.head_comment) - skip_token(parser) - yaml_parser_split_stem_comment(parser, prior_head_len) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_BLOCK_ENTRY_TOKEN && - token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, true, false) - } - parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? - } - return true -} - -// Split stem comment from head comment. -// -// When a sequence or map is found under a sequence entry, the former head comment -// is assigned to the underlying sequence or map as a whole, not the individual -// sequence or map entry as would be expected otherwise. To handle this case the -// previous head comment is moved aside as the stem comment. -func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { - if stem_len == 0 { - return - } - - token := peek_token(parser) - if token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN { - return - } - - parser.stem_comment = parser.head_comment[:stem_len] - if len(parser.head_comment) == stem_len { - parser.head_comment = nil - } else { - // Copy suffix to prevent very strange bugs if someone ever appends - // further bytes to the prefix in the stem_comment slice above. - parser.head_comment = append([]byte(nil), parser.head_comment[stem_len+1:]...) - } -} - -// Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* -// -// BLOCK-END -// ********* -// -func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - // [Go] A tail comment was left from the prior mapping value processed. Emit an event - // as it needs to be processed with that value and not the following key. - if len(parser.tail_comment) > 0 { - *event = yaml_event_t{ - typ: yaml_TAIL_COMMENT_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - foot_comment: parser.tail_comment, - } - parser.tail_comment = nil - return true - } - - if token.typ == yaml_KEY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, true, true) - } else { - parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - } else if token.typ == yaml_BLOCK_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - yaml_parser_set_event_comments(parser, event) - skip_token(parser) - return true - } - - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a block mapping", context_mark, - "did not find expected key", token.start_mark) -} - -// Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START -// -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// -// -func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VALUE_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) - return yaml_parser_parse_node(parser, event, true, true) - } - parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Parse the productions: -// flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * -// -func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - if !first { - if token.typ == yaml_FLOW_ENTRY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } else { - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a flow sequence", context_mark, - "did not find expected ',' or ']'", token.start_mark) - } - } - - if token.typ == yaml_KEY_TOKEN { - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - implicit: true, - style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), - } - skip_token(parser) - return true - } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - yaml_parser_set_event_comments(parser, event) - - skip_token(parser) - return true -} - -// -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * -// -func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_FLOW_ENTRY_TOKEN && - token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - mark := token.end_mark - skip_token(parser) - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) -} - -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * -// -func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VALUE_TOKEN { - skip_token(parser) - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * -// -func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? - } - return true -} - -// Parse the productions: -// flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * -// -func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ != yaml_FLOW_MAPPING_END_TOKEN { - if !first { - if token.typ == yaml_FLOW_ENTRY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } else { - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a flow mapping", context_mark, - "did not find expected ',' or '}'", token.start_mark) - } - } - - if token.typ == yaml_KEY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_FLOW_ENTRY_TOKEN && - token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } else { - parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) - } - } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - yaml_parser_set_event_comments(parser, event) - skip_token(parser) - return true -} - -// Parse the productions: -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// -func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { - token := peek_token(parser) - if token == nil { - return false - } - if empty { - parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) - } - if token.typ == yaml_VALUE_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Generate an empty scalar event. -func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: mark, - end_mark: mark, - value: nil, // Empty - implicit: true, - style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), - } - return true -} - -var default_tag_directives = []yaml_tag_directive_t{ - {[]byte("!"), []byte("!")}, - {[]byte("!!"), []byte("tag:yaml.org,2002:")}, -} - -// Parse directives. -func yaml_parser_process_directives(parser *yaml_parser_t, - version_directive_ref **yaml_version_directive_t, - tag_directives_ref *[]yaml_tag_directive_t) bool { - - var version_directive *yaml_version_directive_t - var tag_directives []yaml_tag_directive_t - - token := peek_token(parser) - if token == nil { - return false - } - - for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { - if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { - if version_directive != nil { - yaml_parser_set_parser_error(parser, - "found duplicate %YAML directive", token.start_mark) - return false - } - if token.major != 1 || token.minor != 1 { - yaml_parser_set_parser_error(parser, - "found incompatible YAML document", token.start_mark) - return false - } - version_directive = &yaml_version_directive_t{ - major: token.major, - minor: token.minor, - } - } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { - value := yaml_tag_directive_t{ - handle: token.value, - prefix: token.prefix, - } - if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { - return false - } - tag_directives = append(tag_directives, value) - } - - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - - for i := range default_tag_directives { - if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { - return false - } - } - - if version_directive_ref != nil { - *version_directive_ref = version_directive - } - if tag_directives_ref != nil { - *tag_directives_ref = tag_directives - } - return true -} - -// Append a tag directive to the directives stack. -func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { - for i := range parser.tag_directives { - if bytes.Equal(value.handle, parser.tag_directives[i].handle) { - if allow_duplicates { - return true - } - return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) - } - } - - // [Go] I suspect the copy is unnecessary. This was likely done - // because there was no way to track ownership of the data. - value_copy := yaml_tag_directive_t{ - handle: make([]byte, len(value.handle)), - prefix: make([]byte, len(value.prefix)), - } - copy(value_copy.handle, value.handle) - copy(value_copy.prefix, value.prefix) - parser.tag_directives = append(parser.tag_directives, value_copy) - return true -} diff --git a/vendor/gopkg.in/yaml.v3/readerc.go b/vendor/gopkg.in/yaml.v3/readerc.go deleted file mode 100644 index b7de0a89c..000000000 --- a/vendor/gopkg.in/yaml.v3/readerc.go +++ /dev/null @@ -1,434 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -import ( - "io" -) - -// Set the reader error and return 0. -func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { - parser.error = yaml_READER_ERROR - parser.problem = problem - parser.problem_offset = offset - parser.problem_value = value - return false -} - -// Byte order marks. -const ( - bom_UTF8 = "\xef\xbb\xbf" - bom_UTF16LE = "\xff\xfe" - bom_UTF16BE = "\xfe\xff" -) - -// Determine the input stream encoding by checking the BOM symbol. If no BOM is -// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. -func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { - // Ensure that we had enough bytes in the raw buffer. - for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { - if !yaml_parser_update_raw_buffer(parser) { - return false - } - } - - // Determine the encoding. - buf := parser.raw_buffer - pos := parser.raw_buffer_pos - avail := len(buf) - pos - if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { - parser.encoding = yaml_UTF16LE_ENCODING - parser.raw_buffer_pos += 2 - parser.offset += 2 - } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { - parser.encoding = yaml_UTF16BE_ENCODING - parser.raw_buffer_pos += 2 - parser.offset += 2 - } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { - parser.encoding = yaml_UTF8_ENCODING - parser.raw_buffer_pos += 3 - parser.offset += 3 - } else { - parser.encoding = yaml_UTF8_ENCODING - } - return true -} - -// Update the raw buffer. -func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { - size_read := 0 - - // Return if the raw buffer is full. - if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { - return true - } - - // Return on EOF. - if parser.eof { - return true - } - - // Move the remaining bytes in the raw buffer to the beginning. - if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { - copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) - } - parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] - parser.raw_buffer_pos = 0 - - // Call the read handler to fill the buffer. - size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) - parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] - if err == io.EOF { - parser.eof = true - } else if err != nil { - return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) - } - return true -} - -// Ensure that the buffer contains at least `length` characters. -// Return true on success, false on failure. -// -// The length is supposed to be significantly less that the buffer size. -func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { - if parser.read_handler == nil { - panic("read handler must be set") - } - - // [Go] This function was changed to guarantee the requested length size at EOF. - // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests - - // If the EOF flag is set and the raw buffer is empty, do nothing. - if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { - // [Go] ACTUALLY! Read the documentation of this function above. - // This is just broken. To return true, we need to have the - // given length in the buffer. Not doing that means every single - // check that calls this function to make sure the buffer has a - // given length is Go) panicking; or C) accessing invalid memory. - //return true - } - - // Return if the buffer contains enough characters. - if parser.unread >= length { - return true - } - - // Determine the input encoding if it is not known yet. - if parser.encoding == yaml_ANY_ENCODING { - if !yaml_parser_determine_encoding(parser) { - return false - } - } - - // Move the unread characters to the beginning of the buffer. - buffer_len := len(parser.buffer) - if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { - copy(parser.buffer, parser.buffer[parser.buffer_pos:]) - buffer_len -= parser.buffer_pos - parser.buffer_pos = 0 - } else if parser.buffer_pos == buffer_len { - buffer_len = 0 - parser.buffer_pos = 0 - } - - // Open the whole buffer for writing, and cut it before returning. - parser.buffer = parser.buffer[:cap(parser.buffer)] - - // Fill the buffer until it has enough characters. - first := true - for parser.unread < length { - - // Fill the raw buffer if necessary. - if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { - if !yaml_parser_update_raw_buffer(parser) { - parser.buffer = parser.buffer[:buffer_len] - return false - } - } - first = false - - // Decode the raw buffer. - inner: - for parser.raw_buffer_pos != len(parser.raw_buffer) { - var value rune - var width int - - raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos - - // Decode the next character. - switch parser.encoding { - case yaml_UTF8_ENCODING: - // Decode a UTF-8 character. Check RFC 3629 - // (http://www.ietf.org/rfc/rfc3629.txt) for more details. - // - // The following table (taken from the RFC) is used for - // decoding. - // - // Char. number range | UTF-8 octet sequence - // (hexadecimal) | (binary) - // --------------------+------------------------------------ - // 0000 0000-0000 007F | 0xxxxxxx - // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - // - // Additionally, the characters in the range 0xD800-0xDFFF - // are prohibited as they are reserved for use with UTF-16 - // surrogate pairs. - - // Determine the length of the UTF-8 sequence. - octet := parser.raw_buffer[parser.raw_buffer_pos] - switch { - case octet&0x80 == 0x00: - width = 1 - case octet&0xE0 == 0xC0: - width = 2 - case octet&0xF0 == 0xE0: - width = 3 - case octet&0xF8 == 0xF0: - width = 4 - default: - // The leading octet is invalid. - return yaml_parser_set_reader_error(parser, - "invalid leading UTF-8 octet", - parser.offset, int(octet)) - } - - // Check if the raw buffer contains an incomplete character. - if width > raw_unread { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-8 octet sequence", - parser.offset, -1) - } - break inner - } - - // Decode the leading octet. - switch { - case octet&0x80 == 0x00: - value = rune(octet & 0x7F) - case octet&0xE0 == 0xC0: - value = rune(octet & 0x1F) - case octet&0xF0 == 0xE0: - value = rune(octet & 0x0F) - case octet&0xF8 == 0xF0: - value = rune(octet & 0x07) - default: - value = 0 - } - - // Check and decode the trailing octets. - for k := 1; k < width; k++ { - octet = parser.raw_buffer[parser.raw_buffer_pos+k] - - // Check if the octet is valid. - if (octet & 0xC0) != 0x80 { - return yaml_parser_set_reader_error(parser, - "invalid trailing UTF-8 octet", - parser.offset+k, int(octet)) - } - - // Decode the octet. - value = (value << 6) + rune(octet&0x3F) - } - - // Check the length of the sequence against the value. - switch { - case width == 1: - case width == 2 && value >= 0x80: - case width == 3 && value >= 0x800: - case width == 4 && value >= 0x10000: - default: - return yaml_parser_set_reader_error(parser, - "invalid length of a UTF-8 sequence", - parser.offset, -1) - } - - // Check the range of the value. - if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { - return yaml_parser_set_reader_error(parser, - "invalid Unicode character", - parser.offset, int(value)) - } - - case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: - var low, high int - if parser.encoding == yaml_UTF16LE_ENCODING { - low, high = 0, 1 - } else { - low, high = 1, 0 - } - - // The UTF-16 encoding is not as simple as one might - // naively think. Check RFC 2781 - // (http://www.ietf.org/rfc/rfc2781.txt). - // - // Normally, two subsequent bytes describe a Unicode - // character. However a special technique (called a - // surrogate pair) is used for specifying character - // values larger than 0xFFFF. - // - // A surrogate pair consists of two pseudo-characters: - // high surrogate area (0xD800-0xDBFF) - // low surrogate area (0xDC00-0xDFFF) - // - // The following formulas are used for decoding - // and encoding characters using surrogate pairs: - // - // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) - // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) - // W1 = 110110yyyyyyyyyy - // W2 = 110111xxxxxxxxxx - // - // where U is the character value, W1 is the high surrogate - // area, W2 is the low surrogate area. - - // Check for incomplete UTF-16 character. - if raw_unread < 2 { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 character", - parser.offset, -1) - } - break inner - } - - // Get the character. - value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + - (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) - - // Check for unexpected low surrogate area. - if value&0xFC00 == 0xDC00 { - return yaml_parser_set_reader_error(parser, - "unexpected low surrogate area", - parser.offset, int(value)) - } - - // Check for a high surrogate area. - if value&0xFC00 == 0xD800 { - width = 4 - - // Check for incomplete surrogate pair. - if raw_unread < 4 { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 surrogate pair", - parser.offset, -1) - } - break inner - } - - // Get the next character. - value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + - (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) - - // Check for a low surrogate area. - if value2&0xFC00 != 0xDC00 { - return yaml_parser_set_reader_error(parser, - "expected low surrogate area", - parser.offset+2, int(value2)) - } - - // Generate the value of the surrogate pair. - value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) - } else { - width = 2 - } - - default: - panic("impossible") - } - - // Check if the character is in the allowed range: - // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) - // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) - // | [#x10000-#x10FFFF] (32 bit) - switch { - case value == 0x09: - case value == 0x0A: - case value == 0x0D: - case value >= 0x20 && value <= 0x7E: - case value == 0x85: - case value >= 0xA0 && value <= 0xD7FF: - case value >= 0xE000 && value <= 0xFFFD: - case value >= 0x10000 && value <= 0x10FFFF: - default: - return yaml_parser_set_reader_error(parser, - "control characters are not allowed", - parser.offset, int(value)) - } - - // Move the raw pointers. - parser.raw_buffer_pos += width - parser.offset += width - - // Finally put the character into the buffer. - if value <= 0x7F { - // 0000 0000-0000 007F . 0xxxxxxx - parser.buffer[buffer_len+0] = byte(value) - buffer_len += 1 - } else if value <= 0x7FF { - // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) - parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) - buffer_len += 2 - } else if value <= 0xFFFF { - // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) - parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) - parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) - buffer_len += 3 - } else { - // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) - parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) - parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) - parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) - buffer_len += 4 - } - - parser.unread++ - } - - // On EOF, put NUL into the buffer and return. - if parser.eof { - parser.buffer[buffer_len] = 0 - buffer_len++ - parser.unread++ - break - } - } - // [Go] Read the documentation of this function above. To return true, - // we need to have the given length in the buffer. Not doing that means - // every single check that calls this function to make sure the buffer - // has a given length is Go) panicking; or C) accessing invalid memory. - // This happens here due to the EOF above breaking early. - for buffer_len < length { - parser.buffer[buffer_len] = 0 - buffer_len++ - } - parser.buffer = parser.buffer[:buffer_len] - return true -} diff --git a/vendor/gopkg.in/yaml.v3/resolve.go b/vendor/gopkg.in/yaml.v3/resolve.go deleted file mode 100644 index 64ae88805..000000000 --- a/vendor/gopkg.in/yaml.v3/resolve.go +++ /dev/null @@ -1,326 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// -// 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 yaml - -import ( - "encoding/base64" - "math" - "regexp" - "strconv" - "strings" - "time" -) - -type resolveMapItem struct { - value interface{} - tag string -} - -var resolveTable = make([]byte, 256) -var resolveMap = make(map[string]resolveMapItem) - -func init() { - t := resolveTable - t[int('+')] = 'S' // Sign - t[int('-')] = 'S' - for _, c := range "0123456789" { - t[int(c)] = 'D' // Digit - } - for _, c := range "yYnNtTfFoO~" { - t[int(c)] = 'M' // In map - } - t[int('.')] = '.' // Float (potentially in map) - - var resolveMapList = []struct { - v interface{} - tag string - l []string - }{ - {true, boolTag, []string{"true", "True", "TRUE"}}, - {false, boolTag, []string{"false", "False", "FALSE"}}, - {nil, nullTag, []string{"", "~", "null", "Null", "NULL"}}, - {math.NaN(), floatTag, []string{".nan", ".NaN", ".NAN"}}, - {math.Inf(+1), floatTag, []string{".inf", ".Inf", ".INF"}}, - {math.Inf(+1), floatTag, []string{"+.inf", "+.Inf", "+.INF"}}, - {math.Inf(-1), floatTag, []string{"-.inf", "-.Inf", "-.INF"}}, - {"<<", mergeTag, []string{"<<"}}, - } - - m := resolveMap - for _, item := range resolveMapList { - for _, s := range item.l { - m[s] = resolveMapItem{item.v, item.tag} - } - } -} - -const ( - nullTag = "!!null" - boolTag = "!!bool" - strTag = "!!str" - intTag = "!!int" - floatTag = "!!float" - timestampTag = "!!timestamp" - seqTag = "!!seq" - mapTag = "!!map" - binaryTag = "!!binary" - mergeTag = "!!merge" -) - -var longTags = make(map[string]string) -var shortTags = make(map[string]string) - -func init() { - for _, stag := range []string{nullTag, boolTag, strTag, intTag, floatTag, timestampTag, seqTag, mapTag, binaryTag, mergeTag} { - ltag := longTag(stag) - longTags[stag] = ltag - shortTags[ltag] = stag - } -} - -const longTagPrefix = "tag:yaml.org,2002:" - -func shortTag(tag string) string { - if strings.HasPrefix(tag, longTagPrefix) { - if stag, ok := shortTags[tag]; ok { - return stag - } - return "!!" + tag[len(longTagPrefix):] - } - return tag -} - -func longTag(tag string) string { - if strings.HasPrefix(tag, "!!") { - if ltag, ok := longTags[tag]; ok { - return ltag - } - return longTagPrefix + tag[2:] - } - return tag -} - -func resolvableTag(tag string) bool { - switch tag { - case "", strTag, boolTag, intTag, floatTag, nullTag, timestampTag: - return true - } - return false -} - -var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) - -func resolve(tag string, in string) (rtag string, out interface{}) { - tag = shortTag(tag) - if !resolvableTag(tag) { - return tag, in - } - - defer func() { - switch tag { - case "", rtag, strTag, binaryTag: - return - case floatTag: - if rtag == intTag { - switch v := out.(type) { - case int64: - rtag = floatTag - out = float64(v) - return - case int: - rtag = floatTag - out = float64(v) - return - } - } - } - failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) - }() - - // Any data is accepted as a !!str or !!binary. - // Otherwise, the prefix is enough of a hint about what it might be. - hint := byte('N') - if in != "" { - hint = resolveTable[in[0]] - } - if hint != 0 && tag != strTag && tag != binaryTag { - // Handle things we can lookup in a map. - if item, ok := resolveMap[in]; ok { - return item.tag, item.value - } - - // Base 60 floats are a bad idea, were dropped in YAML 1.2, and - // are purposefully unsupported here. They're still quoted on - // the way out for compatibility with other parser, though. - - switch hint { - case 'M': - // We've already checked the map above. - - case '.': - // Not in the map, so maybe a normal float. - floatv, err := strconv.ParseFloat(in, 64) - if err == nil { - return floatTag, floatv - } - - case 'D', 'S': - // Int, float, or timestamp. - // Only try values as a timestamp if the value is unquoted or there's an explicit - // !!timestamp tag. - if tag == "" || tag == timestampTag { - t, ok := parseTimestamp(in) - if ok { - return timestampTag, t - } - } - - plain := strings.Replace(in, "_", "", -1) - intv, err := strconv.ParseInt(plain, 0, 64) - if err == nil { - if intv == int64(int(intv)) { - return intTag, int(intv) - } else { - return intTag, intv - } - } - uintv, err := strconv.ParseUint(plain, 0, 64) - if err == nil { - return intTag, uintv - } - if yamlStyleFloat.MatchString(plain) { - floatv, err := strconv.ParseFloat(plain, 64) - if err == nil { - return floatTag, floatv - } - } - if strings.HasPrefix(plain, "0b") { - intv, err := strconv.ParseInt(plain[2:], 2, 64) - if err == nil { - if intv == int64(int(intv)) { - return intTag, int(intv) - } else { - return intTag, intv - } - } - uintv, err := strconv.ParseUint(plain[2:], 2, 64) - if err == nil { - return intTag, uintv - } - } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) - if err == nil { - if true || intv == int64(int(intv)) { - return intTag, int(intv) - } else { - return intTag, intv - } - } - } - // Octals as introduced in version 1.2 of the spec. - // Octals from the 1.1 spec, spelled as 0777, are still - // decoded by default in v3 as well for compatibility. - // May be dropped in v4 depending on how usage evolves. - if strings.HasPrefix(plain, "0o") { - intv, err := strconv.ParseInt(plain[2:], 8, 64) - if err == nil { - if intv == int64(int(intv)) { - return intTag, int(intv) - } else { - return intTag, intv - } - } - uintv, err := strconv.ParseUint(plain[2:], 8, 64) - if err == nil { - return intTag, uintv - } - } else if strings.HasPrefix(plain, "-0o") { - intv, err := strconv.ParseInt("-"+plain[3:], 8, 64) - if err == nil { - if true || intv == int64(int(intv)) { - return intTag, int(intv) - } else { - return intTag, intv - } - } - } - default: - panic("internal error: missing handler for resolver table: " + string(rune(hint)) + " (with " + in + ")") - } - } - return strTag, in -} - -// encodeBase64 encodes s as base64 that is broken up into multiple lines -// as appropriate for the resulting length. -func encodeBase64(s string) string { - const lineLen = 70 - encLen := base64.StdEncoding.EncodedLen(len(s)) - lines := encLen/lineLen + 1 - buf := make([]byte, encLen*2+lines) - in := buf[0:encLen] - out := buf[encLen:] - base64.StdEncoding.Encode(in, []byte(s)) - k := 0 - for i := 0; i < len(in); i += lineLen { - j := i + lineLen - if j > len(in) { - j = len(in) - } - k += copy(out[k:], in[i:j]) - if lines > 1 { - out[k] = '\n' - k++ - } - } - return string(out[:k]) -} - -// This is a subset of the formats allowed by the regular expression -// defined at http://yaml.org/type/timestamp.html. -var allowedTimestampFormats = []string{ - "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields. - "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t". - "2006-1-2 15:4:5.999999999", // space separated with no time zone - "2006-1-2", // date only - // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" - // from the set of examples. -} - -// parseTimestamp parses s as a timestamp string and -// returns the timestamp and reports whether it succeeded. -// Timestamp formats are defined at http://yaml.org/type/timestamp.html -func parseTimestamp(s string) (time.Time, bool) { - // TODO write code to check all the formats supported by - // http://yaml.org/type/timestamp.html instead of using time.Parse. - - // Quick check: all date formats start with YYYY-. - i := 0 - for ; i < len(s); i++ { - if c := s[i]; c < '0' || c > '9' { - break - } - } - if i != 4 || i == len(s) || s[i] != '-' { - return time.Time{}, false - } - for _, format := range allowedTimestampFormats { - if t, err := time.Parse(format, s); err == nil { - return t, true - } - } - return time.Time{}, false -} diff --git a/vendor/gopkg.in/yaml.v3/scannerc.go b/vendor/gopkg.in/yaml.v3/scannerc.go deleted file mode 100644 index d9a539c39..000000000 --- a/vendor/gopkg.in/yaml.v3/scannerc.go +++ /dev/null @@ -1,3028 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -import ( - "bytes" - "fmt" -) - -// Introduction -// ************ -// -// The following notes assume that you are familiar with the YAML specification -// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in -// some cases we are less restrictive that it requires. -// -// The process of transforming a YAML stream into a sequence of events is -// divided on two steps: Scanning and Parsing. -// -// The Scanner transforms the input stream into a sequence of tokens, while the -// parser transform the sequence of tokens produced by the Scanner into a -// sequence of parsing events. -// -// The Scanner is rather clever and complicated. The Parser, on the contrary, -// is a straightforward implementation of a recursive-descendant parser (or, -// LL(1) parser, as it is usually called). -// -// Actually there are two issues of Scanning that might be called "clever", the -// rest is quite straightforward. The issues are "block collection start" and -// "simple keys". Both issues are explained below in details. -// -// Here the Scanning step is explained and implemented. We start with the list -// of all the tokens produced by the Scanner together with short descriptions. -// -// Now, tokens: -// -// STREAM-START(encoding) # The stream start. -// STREAM-END # The stream end. -// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. -// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. -// DOCUMENT-START # '---' -// DOCUMENT-END # '...' -// BLOCK-SEQUENCE-START # Indentation increase denoting a block -// BLOCK-MAPPING-START # sequence or a block mapping. -// BLOCK-END # Indentation decrease. -// FLOW-SEQUENCE-START # '[' -// FLOW-SEQUENCE-END # ']' -// BLOCK-SEQUENCE-START # '{' -// BLOCK-SEQUENCE-END # '}' -// BLOCK-ENTRY # '-' -// FLOW-ENTRY # ',' -// KEY # '?' or nothing (simple keys). -// VALUE # ':' -// ALIAS(anchor) # '*anchor' -// ANCHOR(anchor) # '&anchor' -// TAG(handle,suffix) # '!handle!suffix' -// SCALAR(value,style) # A scalar. -// -// The following two tokens are "virtual" tokens denoting the beginning and the -// end of the stream: -// -// STREAM-START(encoding) -// STREAM-END -// -// We pass the information about the input stream encoding with the -// STREAM-START token. -// -// The next two tokens are responsible for tags: -// -// VERSION-DIRECTIVE(major,minor) -// TAG-DIRECTIVE(handle,prefix) -// -// Example: -// -// %YAML 1.1 -// %TAG ! !foo -// %TAG !yaml! tag:yaml.org,2002: -// --- -// -// The correspoding sequence of tokens: -// -// STREAM-START(utf-8) -// VERSION-DIRECTIVE(1,1) -// TAG-DIRECTIVE("!","!foo") -// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") -// DOCUMENT-START -// STREAM-END -// -// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole -// line. -// -// The document start and end indicators are represented by: -// -// DOCUMENT-START -// DOCUMENT-END -// -// Note that if a YAML stream contains an implicit document (without '---' -// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be -// produced. -// -// In the following examples, we present whole documents together with the -// produced tokens. -// -// 1. An implicit document: -// -// 'a scalar' -// -// Tokens: -// -// STREAM-START(utf-8) -// SCALAR("a scalar",single-quoted) -// STREAM-END -// -// 2. An explicit document: -// -// --- -// 'a scalar' -// ... -// -// Tokens: -// -// STREAM-START(utf-8) -// DOCUMENT-START -// SCALAR("a scalar",single-quoted) -// DOCUMENT-END -// STREAM-END -// -// 3. Several documents in a stream: -// -// 'a scalar' -// --- -// 'another scalar' -// --- -// 'yet another scalar' -// -// Tokens: -// -// STREAM-START(utf-8) -// SCALAR("a scalar",single-quoted) -// DOCUMENT-START -// SCALAR("another scalar",single-quoted) -// DOCUMENT-START -// SCALAR("yet another scalar",single-quoted) -// STREAM-END -// -// We have already introduced the SCALAR token above. The following tokens are -// used to describe aliases, anchors, tag, and scalars: -// -// ALIAS(anchor) -// ANCHOR(anchor) -// TAG(handle,suffix) -// SCALAR(value,style) -// -// The following series of examples illustrate the usage of these tokens: -// -// 1. A recursive sequence: -// -// &A [ *A ] -// -// Tokens: -// -// STREAM-START(utf-8) -// ANCHOR("A") -// FLOW-SEQUENCE-START -// ALIAS("A") -// FLOW-SEQUENCE-END -// STREAM-END -// -// 2. A tagged scalar: -// -// !!float "3.14" # A good approximation. -// -// Tokens: -// -// STREAM-START(utf-8) -// TAG("!!","float") -// SCALAR("3.14",double-quoted) -// STREAM-END -// -// 3. Various scalar styles: -// -// --- # Implicit empty plain scalars do not produce tokens. -// --- a plain scalar -// --- 'a single-quoted scalar' -// --- "a double-quoted scalar" -// --- |- -// a literal scalar -// --- >- -// a folded -// scalar -// -// Tokens: -// -// STREAM-START(utf-8) -// DOCUMENT-START -// DOCUMENT-START -// SCALAR("a plain scalar",plain) -// DOCUMENT-START -// SCALAR("a single-quoted scalar",single-quoted) -// DOCUMENT-START -// SCALAR("a double-quoted scalar",double-quoted) -// DOCUMENT-START -// SCALAR("a literal scalar",literal) -// DOCUMENT-START -// SCALAR("a folded scalar",folded) -// STREAM-END -// -// Now it's time to review collection-related tokens. We will start with -// flow collections: -// -// FLOW-SEQUENCE-START -// FLOW-SEQUENCE-END -// FLOW-MAPPING-START -// FLOW-MAPPING-END -// FLOW-ENTRY -// KEY -// VALUE -// -// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and -// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' -// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the -// indicators '?' and ':', which are used for denoting mapping keys and values, -// are represented by the KEY and VALUE tokens. -// -// The following examples show flow collections: -// -// 1. A flow sequence: -// -// [item 1, item 2, item 3] -// -// Tokens: -// -// STREAM-START(utf-8) -// FLOW-SEQUENCE-START -// SCALAR("item 1",plain) -// FLOW-ENTRY -// SCALAR("item 2",plain) -// FLOW-ENTRY -// SCALAR("item 3",plain) -// FLOW-SEQUENCE-END -// STREAM-END -// -// 2. A flow mapping: -// -// { -// a simple key: a value, # Note that the KEY token is produced. -// ? a complex key: another value, -// } -// -// Tokens: -// -// STREAM-START(utf-8) -// FLOW-MAPPING-START -// KEY -// SCALAR("a simple key",plain) -// VALUE -// SCALAR("a value",plain) -// FLOW-ENTRY -// KEY -// SCALAR("a complex key",plain) -// VALUE -// SCALAR("another value",plain) -// FLOW-ENTRY -// FLOW-MAPPING-END -// STREAM-END -// -// A simple key is a key which is not denoted by the '?' indicator. Note that -// the Scanner still produce the KEY token whenever it encounters a simple key. -// -// For scanning block collections, the following tokens are used (note that we -// repeat KEY and VALUE here): -// -// BLOCK-SEQUENCE-START -// BLOCK-MAPPING-START -// BLOCK-END -// BLOCK-ENTRY -// KEY -// VALUE -// -// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation -// increase that precedes a block collection (cf. the INDENT token in Python). -// The token BLOCK-END denote indentation decrease that ends a block collection -// (cf. the DEDENT token in Python). However YAML has some syntax pecularities -// that makes detections of these tokens more complex. -// -// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators -// '-', '?', and ':' correspondingly. -// -// The following examples show how the tokens BLOCK-SEQUENCE-START, -// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: -// -// 1. Block sequences: -// -// - item 1 -// - item 2 -// - -// - item 3.1 -// - item 3.2 -// - -// key 1: value 1 -// key 2: value 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-ENTRY -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 3.1",plain) -// BLOCK-ENTRY -// SCALAR("item 3.2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// 2. Block mappings: -// -// a simple key: a value # The KEY token is produced here. -// ? a complex key -// : another value -// a mapping: -// key 1: value 1 -// key 2: value 2 -// a sequence: -// - item 1 -// - item 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("a simple key",plain) -// VALUE -// SCALAR("a value",plain) -// KEY -// SCALAR("a complex key",plain) -// VALUE -// SCALAR("another value",plain) -// KEY -// SCALAR("a mapping",plain) -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// KEY -// SCALAR("a sequence",plain) -// VALUE -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// YAML does not always require to start a new block collection from a new -// line. If the current line contains only '-', '?', and ':' indicators, a new -// block collection may start at the current line. The following examples -// illustrate this case: -// -// 1. Collections in a sequence: -// -// - - item 1 -// - item 2 -// - key 1: value 1 -// key 2: value 2 -// - ? complex key -// : complex value -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("complex key") -// VALUE -// SCALAR("complex value") -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// 2. Collections in a mapping: -// -// ? a sequence -// : - item 1 -// - item 2 -// ? a mapping -// : key 1: value 1 -// key 2: value 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("a sequence",plain) -// VALUE -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// KEY -// SCALAR("a mapping",plain) -// VALUE -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// YAML also permits non-indented sequences if they are included into a block -// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: -// -// key: -// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. -// - item 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("key",plain) -// VALUE -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// - -// Ensure that the buffer contains the required number of characters. -// Return true on success, false on failure (reader error or memory error). -func cache(parser *yaml_parser_t, length int) bool { - // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) - return parser.unread >= length || yaml_parser_update_buffer(parser, length) -} - -// Advance the buffer pointer. -func skip(parser *yaml_parser_t) { - if !is_blank(parser.buffer, parser.buffer_pos) { - parser.newlines = 0 - } - parser.mark.index++ - parser.mark.column++ - parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) -} - -func skip_line(parser *yaml_parser_t) { - if is_crlf(parser.buffer, parser.buffer_pos) { - parser.mark.index += 2 - parser.mark.column = 0 - parser.mark.line++ - parser.unread -= 2 - parser.buffer_pos += 2 - parser.newlines++ - } else if is_break(parser.buffer, parser.buffer_pos) { - parser.mark.index++ - parser.mark.column = 0 - parser.mark.line++ - parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) - parser.newlines++ - } -} - -// Copy a character to a string buffer and advance pointers. -func read(parser *yaml_parser_t, s []byte) []byte { - if !is_blank(parser.buffer, parser.buffer_pos) { - parser.newlines = 0 - } - w := width(parser.buffer[parser.buffer_pos]) - if w == 0 { - panic("invalid character sequence") - } - if len(s) == 0 { - s = make([]byte, 0, 32) - } - if w == 1 && len(s)+w <= cap(s) { - s = s[:len(s)+1] - s[len(s)-1] = parser.buffer[parser.buffer_pos] - parser.buffer_pos++ - } else { - s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) - parser.buffer_pos += w - } - parser.mark.index++ - parser.mark.column++ - parser.unread-- - return s -} - -// Copy a line break character to a string buffer and advance pointers. -func read_line(parser *yaml_parser_t, s []byte) []byte { - buf := parser.buffer - pos := parser.buffer_pos - switch { - case buf[pos] == '\r' && buf[pos+1] == '\n': - // CR LF . LF - s = append(s, '\n') - parser.buffer_pos += 2 - parser.mark.index++ - parser.unread-- - case buf[pos] == '\r' || buf[pos] == '\n': - // CR|LF . LF - s = append(s, '\n') - parser.buffer_pos += 1 - case buf[pos] == '\xC2' && buf[pos+1] == '\x85': - // NEL . LF - s = append(s, '\n') - parser.buffer_pos += 2 - case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): - // LS|PS . LS|PS - s = append(s, buf[parser.buffer_pos:pos+3]...) - parser.buffer_pos += 3 - default: - return s - } - parser.mark.index++ - parser.mark.column = 0 - parser.mark.line++ - parser.unread-- - parser.newlines++ - return s -} - -// Get the next token. -func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { - // Erase the token object. - *token = yaml_token_t{} // [Go] Is this necessary? - - // No tokens after STREAM-END or error. - if parser.stream_end_produced || parser.error != yaml_NO_ERROR { - return true - } - - // Ensure that the tokens queue contains enough tokens. - if !parser.token_available { - if !yaml_parser_fetch_more_tokens(parser) { - return false - } - } - - // Fetch the next token from the queue. - *token = parser.tokens[parser.tokens_head] - parser.tokens_head++ - parser.tokens_parsed++ - parser.token_available = false - - if token.typ == yaml_STREAM_END_TOKEN { - parser.stream_end_produced = true - } - return true -} - -// Set the scanner error and return false. -func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { - parser.error = yaml_SCANNER_ERROR - parser.context = context - parser.context_mark = context_mark - parser.problem = problem - parser.problem_mark = parser.mark - return false -} - -func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { - context := "while parsing a tag" - if directive { - context = "while parsing a %TAG directive" - } - return yaml_parser_set_scanner_error(parser, context, context_mark, problem) -} - -func trace(args ...interface{}) func() { - pargs := append([]interface{}{"+++"}, args...) - fmt.Println(pargs...) - pargs = append([]interface{}{"---"}, args...) - return func() { fmt.Println(pargs...) } -} - -// Ensure that the tokens queue contains at least one token which can be -// returned to the Parser. -func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { - // While we need more tokens to fetch, do it. - for { - // [Go] The comment parsing logic requires a lookahead of two tokens - // so that foot comments may be parsed in time of associating them - // with the tokens that are parsed before them, and also for line - // comments to be transformed into head comments in some edge cases. - if parser.tokens_head < len(parser.tokens)-2 { - // If a potential simple key is at the head position, we need to fetch - // the next token to disambiguate it. - head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] - if !ok { - break - } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { - return false - } else if !valid { - break - } - } - // Fetch the next token. - if !yaml_parser_fetch_next_token(parser) { - return false - } - } - - parser.token_available = true - return true -} - -// The dispatcher for token fetchers. -func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) { - // Ensure that the buffer is initialized. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check if we just started scanning. Fetch STREAM-START then. - if !parser.stream_start_produced { - return yaml_parser_fetch_stream_start(parser) - } - - scan_mark := parser.mark - - // Eat whitespaces and comments until we reach the next token. - if !yaml_parser_scan_to_next_token(parser) { - return false - } - - // [Go] While unrolling indents, transform the head comments of prior - // indentation levels observed after scan_start into foot comments at - // the respective indexes. - - // Check the indentation level against the current column. - if !yaml_parser_unroll_indent(parser, parser.mark.column, scan_mark) { - return false - } - - // Ensure that the buffer contains at least 4 characters. 4 is the length - // of the longest indicators ('--- ' and '... '). - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - - // Is it the end of the stream? - if is_z(parser.buffer, parser.buffer_pos) { - return yaml_parser_fetch_stream_end(parser) - } - - // Is it a directive? - if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { - return yaml_parser_fetch_directive(parser) - } - - buf := parser.buffer - pos := parser.buffer_pos - - // Is it the document start indicator? - if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { - return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) - } - - // Is it the document end indicator? - if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { - return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) - } - - comment_mark := parser.mark - if len(parser.tokens) > 0 && (parser.flow_level == 0 && buf[pos] == ':' || parser.flow_level > 0 && buf[pos] == ',') { - // Associate any following comments with the prior token. - comment_mark = parser.tokens[len(parser.tokens)-1].start_mark - } - defer func() { - if !ok { - return - } - if len(parser.tokens) > 0 && parser.tokens[len(parser.tokens)-1].typ == yaml_BLOCK_ENTRY_TOKEN { - // Sequence indicators alone have no line comments. It becomes - // a head comment for whatever follows. - return - } - if !yaml_parser_scan_line_comment(parser, comment_mark) { - ok = false - return - } - }() - - // Is it the flow sequence start indicator? - if buf[pos] == '[' { - return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) - } - - // Is it the flow mapping start indicator? - if parser.buffer[parser.buffer_pos] == '{' { - return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) - } - - // Is it the flow sequence end indicator? - if parser.buffer[parser.buffer_pos] == ']' { - return yaml_parser_fetch_flow_collection_end(parser, - yaml_FLOW_SEQUENCE_END_TOKEN) - } - - // Is it the flow mapping end indicator? - if parser.buffer[parser.buffer_pos] == '}' { - return yaml_parser_fetch_flow_collection_end(parser, - yaml_FLOW_MAPPING_END_TOKEN) - } - - // Is it the flow entry indicator? - if parser.buffer[parser.buffer_pos] == ',' { - return yaml_parser_fetch_flow_entry(parser) - } - - // Is it the block entry indicator? - if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { - return yaml_parser_fetch_block_entry(parser) - } - - // Is it the key indicator? - if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_key(parser) - } - - // Is it the value indicator? - if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_value(parser) - } - - // Is it an alias? - if parser.buffer[parser.buffer_pos] == '*' { - return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) - } - - // Is it an anchor? - if parser.buffer[parser.buffer_pos] == '&' { - return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) - } - - // Is it a tag? - if parser.buffer[parser.buffer_pos] == '!' { - return yaml_parser_fetch_tag(parser) - } - - // Is it a literal scalar? - if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { - return yaml_parser_fetch_block_scalar(parser, true) - } - - // Is it a folded scalar? - if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { - return yaml_parser_fetch_block_scalar(parser, false) - } - - // Is it a single-quoted scalar? - if parser.buffer[parser.buffer_pos] == '\'' { - return yaml_parser_fetch_flow_scalar(parser, true) - } - - // Is it a double-quoted scalar? - if parser.buffer[parser.buffer_pos] == '"' { - return yaml_parser_fetch_flow_scalar(parser, false) - } - - // Is it a plain scalar? - // - // A plain scalar may start with any non-blank characters except - // - // '-', '?', ':', ',', '[', ']', '{', '}', - // '#', '&', '*', '!', '|', '>', '\'', '\"', - // '%', '@', '`'. - // - // In the block context (and, for the '-' indicator, in the flow context - // too), it may also start with the characters - // - // '-', '?', ':' - // - // if it is followed by a non-space character. - // - // The last rule is more restrictive than the specification requires. - // [Go] TODO Make this logic more reasonable. - //switch parser.buffer[parser.buffer_pos] { - //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': - //} - if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || - parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || - parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || - parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || - parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || - parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || - parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || - parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || - parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || - (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || - (parser.flow_level == 0 && - (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && - !is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_plain_scalar(parser) - } - - // If we don't determine the token type so far, it is an error. - return yaml_parser_set_scanner_error(parser, - "while scanning for the next token", parser.mark, - "found character that cannot start any token") -} - -func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { - if !simple_key.possible { - return false, true - } - - // The 1.2 specification says: - // - // "If the ? indicator is omitted, parsing needs to see past the - // implicit key to recognize it as such. To limit the amount of - // lookahead required, the “:” indicator must appear at most 1024 - // Unicode characters beyond the start of the key. In addition, the key - // is restricted to a single line." - // - if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { - // Check if the potential simple key to be removed is required. - if simple_key.required { - return false, yaml_parser_set_scanner_error(parser, - "while scanning a simple key", simple_key.mark, - "could not find expected ':'") - } - simple_key.possible = false - return false, true - } - return true, true -} - -// Check if a simple key may start at the current position and add it if -// needed. -func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { - // A simple key is required at the current position if the scanner is in - // the block context and the current column coincides with the indentation - // level. - - required := parser.flow_level == 0 && parser.indent == parser.mark.column - - // - // If the current position may start a simple key, save it. - // - if parser.simple_key_allowed { - simple_key := yaml_simple_key_t{ - possible: true, - required: required, - token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), - mark: parser.mark, - } - - if !yaml_parser_remove_simple_key(parser) { - return false - } - parser.simple_keys[len(parser.simple_keys)-1] = simple_key - parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 - } - return true -} - -// Remove a potential simple key at the current flow level. -func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { - i := len(parser.simple_keys) - 1 - if parser.simple_keys[i].possible { - // If the key is required, it is an error. - if parser.simple_keys[i].required { - return yaml_parser_set_scanner_error(parser, - "while scanning a simple key", parser.simple_keys[i].mark, - "could not find expected ':'") - } - // Remove the key from the stack. - parser.simple_keys[i].possible = false - delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) - } - return true -} - -// max_flow_level limits the flow_level -const max_flow_level = 10000 - -// Increase the flow level and resize the simple key list if needed. -func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { - // Reset the simple key on the next level. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ - possible: false, - required: false, - token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), - mark: parser.mark, - }) - - // Increase the flow level. - parser.flow_level++ - if parser.flow_level > max_flow_level { - return yaml_parser_set_scanner_error(parser, - "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, - fmt.Sprintf("exceeded max depth of %d", max_flow_level)) - } - return true -} - -// Decrease the flow level. -func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { - if parser.flow_level > 0 { - parser.flow_level-- - last := len(parser.simple_keys) - 1 - delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) - parser.simple_keys = parser.simple_keys[:last] - } - return true -} - -// max_indents limits the indents stack size -const max_indents = 10000 - -// Push the current indentation level to the stack and set the new level -// the current column is greater than the indentation level. In this case, -// append or insert the specified token into the token queue. -func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { - // In the flow context, do nothing. - if parser.flow_level > 0 { - return true - } - - if parser.indent < column { - // Push the current indentation level to the stack and set the new - // indentation level. - parser.indents = append(parser.indents, parser.indent) - parser.indent = column - if len(parser.indents) > max_indents { - return yaml_parser_set_scanner_error(parser, - "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, - fmt.Sprintf("exceeded max depth of %d", max_indents)) - } - - // Create a token and insert it into the queue. - token := yaml_token_t{ - typ: typ, - start_mark: mark, - end_mark: mark, - } - if number > -1 { - number -= parser.tokens_parsed - } - yaml_insert_token(parser, number, &token) - } - return true -} - -// Pop indentation levels from the indents stack until the current level -// becomes less or equal to the column. For each indentation level, append -// the BLOCK-END token. -func yaml_parser_unroll_indent(parser *yaml_parser_t, column int, scan_mark yaml_mark_t) bool { - // In the flow context, do nothing. - if parser.flow_level > 0 { - return true - } - - block_mark := scan_mark - block_mark.index-- - - // Loop through the indentation levels in the stack. - for parser.indent > column { - - // [Go] Reposition the end token before potential following - // foot comments of parent blocks. For that, search - // backwards for recent comments that were at the same - // indent as the block that is ending now. - stop_index := block_mark.index - for i := len(parser.comments) - 1; i >= 0; i-- { - comment := &parser.comments[i] - - if comment.end_mark.index < stop_index { - // Don't go back beyond the start of the comment/whitespace scan, unless column < 0. - // If requested indent column is < 0, then the document is over and everything else - // is a foot anyway. - break - } - if comment.start_mark.column == parser.indent+1 { - // This is a good match. But maybe there's a former comment - // at that same indent level, so keep searching. - block_mark = comment.start_mark - } - - // While the end of the former comment matches with - // the start of the following one, we know there's - // nothing in between and scanning is still safe. - stop_index = comment.scan_mark.index - } - - // Create a token and append it to the queue. - token := yaml_token_t{ - typ: yaml_BLOCK_END_TOKEN, - start_mark: block_mark, - end_mark: block_mark, - } - yaml_insert_token(parser, -1, &token) - - // Pop the indentation level. - parser.indent = parser.indents[len(parser.indents)-1] - parser.indents = parser.indents[:len(parser.indents)-1] - } - return true -} - -// Initialize the scanner and produce the STREAM-START token. -func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { - - // Set the initial indentation. - parser.indent = -1 - - // Initialize the simple key stack. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) - - parser.simple_keys_by_tok = make(map[int]int) - - // A simple key is allowed at the beginning of the stream. - parser.simple_key_allowed = true - - // We have started. - parser.stream_start_produced = true - - // Create the STREAM-START token and append it to the queue. - token := yaml_token_t{ - typ: yaml_STREAM_START_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - encoding: parser.encoding, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the STREAM-END token and shut down the scanner. -func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { - - // Force new line. - if parser.mark.column != 0 { - parser.mark.column = 0 - parser.mark.line++ - } - - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1, parser.mark) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Create the STREAM-END token and append it to the queue. - token := yaml_token_t{ - typ: yaml_STREAM_END_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. -func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1, parser.mark) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. - token := yaml_token_t{} - if !yaml_parser_scan_directive(parser, &token) { - return false - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the DOCUMENT-START or DOCUMENT-END token. -func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1, parser.mark) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Consume the token. - start_mark := parser.mark - - skip(parser) - skip(parser) - skip(parser) - - end_mark := parser.mark - - // Create the DOCUMENT-START or DOCUMENT-END token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. -func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { - - // The indicators '[' and '{' may start a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // Increase the flow level. - if !yaml_parser_increase_flow_level(parser) { - return false - } - - // A simple key may follow the indicators '[' and '{'. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. -func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // Reset any potential simple key on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Decrease the flow level. - if !yaml_parser_decrease_flow_level(parser) { - return false - } - - // No simple keys after the indicators ']' and '}'. - parser.simple_key_allowed = false - - // Consume the token. - - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-ENTRY token. -func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after ','. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-ENTRY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_FLOW_ENTRY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the BLOCK-ENTRY token. -func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { - // Check if the scanner is in the block context. - if parser.flow_level == 0 { - // Check if we are allowed to start a new entry. - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "block sequence entries are not allowed in this context") - } - // Add the BLOCK-SEQUENCE-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { - return false - } - } else { - // It is an error for the '-' indicator to occur in the flow context, - // but we let the Parser detect and report about it because the Parser - // is able to point to the context. - } - - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after '-'. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the BLOCK-ENTRY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_BLOCK_ENTRY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the KEY token. -func yaml_parser_fetch_key(parser *yaml_parser_t) bool { - - // In the block context, additional checks are required. - if parser.flow_level == 0 { - // Check if we are allowed to start a new key (not nessesary simple). - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "mapping keys are not allowed in this context") - } - // Add the BLOCK-MAPPING-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { - return false - } - } - - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after '?' in the block context. - parser.simple_key_allowed = parser.flow_level == 0 - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the KEY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_KEY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the VALUE token. -func yaml_parser_fetch_value(parser *yaml_parser_t) bool { - - simple_key := &parser.simple_keys[len(parser.simple_keys)-1] - - // Have we found a simple key? - if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok { - return false - - } else if valid { - - // Create the KEY token and insert it into the queue. - token := yaml_token_t{ - typ: yaml_KEY_TOKEN, - start_mark: simple_key.mark, - end_mark: simple_key.mark, - } - yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) - - // In the block context, we may need to add the BLOCK-MAPPING-START token. - if !yaml_parser_roll_indent(parser, simple_key.mark.column, - simple_key.token_number, - yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { - return false - } - - // Remove the simple key. - simple_key.possible = false - delete(parser.simple_keys_by_tok, simple_key.token_number) - - // A simple key cannot follow another simple key. - parser.simple_key_allowed = false - - } else { - // The ':' indicator follows a complex key. - - // In the block context, extra checks are required. - if parser.flow_level == 0 { - - // Check if we are allowed to start a complex value. - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "mapping values are not allowed in this context") - } - - // Add the BLOCK-MAPPING-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { - return false - } - } - - // Simple keys after ':' are allowed in the block context. - parser.simple_key_allowed = parser.flow_level == 0 - } - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the VALUE token and append it to the queue. - token := yaml_token_t{ - typ: yaml_VALUE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the ALIAS or ANCHOR token. -func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // An anchor or an alias could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow an anchor or an alias. - parser.simple_key_allowed = false - - // Create the ALIAS or ANCHOR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_anchor(parser, &token, typ) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the TAG token. -func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { - // A tag could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a tag. - parser.simple_key_allowed = false - - // Create the TAG token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_tag(parser, &token) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. -func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { - // Remove any potential simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // A simple key may follow a block scalar. - parser.simple_key_allowed = true - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_block_scalar(parser, &token, literal) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. -func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { - // A plain scalar could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a flow scalar. - parser.simple_key_allowed = false - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_flow_scalar(parser, &token, single) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,plain) token. -func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { - // A plain scalar could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a flow scalar. - parser.simple_key_allowed = false - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_plain_scalar(parser, &token) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Eat whitespaces and comments until the next token is found. -func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { - - scan_mark := parser.mark - - // Until the next token is not found. - for { - // Allow the BOM mark to start a line. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { - skip(parser) - } - - // Eat whitespaces. - // Tabs are allowed: - // - in the flow context - // - in the block context, but not at the beginning of the line or - // after '-', '?', or ':' (complex value). - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if we just had a line comment under a sequence entry that - // looks more like a header to the following content. Similar to this: - // - // - # The comment - // - Some data - // - // If so, transform the line comment to a head comment and reposition. - if len(parser.comments) > 0 && len(parser.tokens) > 1 { - tokenA := parser.tokens[len(parser.tokens)-2] - tokenB := parser.tokens[len(parser.tokens)-1] - comment := &parser.comments[len(parser.comments)-1] - if tokenA.typ == yaml_BLOCK_SEQUENCE_START_TOKEN && tokenB.typ == yaml_BLOCK_ENTRY_TOKEN && len(comment.line) > 0 && !is_break(parser.buffer, parser.buffer_pos) { - // If it was in the prior line, reposition so it becomes a - // header of the follow up token. Otherwise, keep it in place - // so it becomes a header of the former. - comment.head = comment.line - comment.line = nil - if comment.start_mark.line == parser.mark.line-1 { - comment.token_mark = parser.mark - } - } - } - - // Eat a comment until a line break. - if parser.buffer[parser.buffer_pos] == '#' { - if !yaml_parser_scan_comments(parser, scan_mark) { - return false - } - } - - // If it is a line break, eat it. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - - // In the block context, a new line may start a simple key. - if parser.flow_level == 0 { - parser.simple_key_allowed = true - } - } else { - break // We have found a token. - } - } - - return true -} - -// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// -func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { - // Eat '%'. - start_mark := parser.mark - skip(parser) - - // Scan the directive name. - var name []byte - if !yaml_parser_scan_directive_name(parser, start_mark, &name) { - return false - } - - // Is it a YAML directive? - if bytes.Equal(name, []byte("YAML")) { - // Scan the VERSION directive value. - var major, minor int8 - if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { - return false - } - end_mark := parser.mark - - // Create a VERSION-DIRECTIVE token. - *token = yaml_token_t{ - typ: yaml_VERSION_DIRECTIVE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - major: major, - minor: minor, - } - - // Is it a TAG directive? - } else if bytes.Equal(name, []byte("TAG")) { - // Scan the TAG directive value. - var handle, prefix []byte - if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { - return false - } - end_mark := parser.mark - - // Create a TAG-DIRECTIVE token. - *token = yaml_token_t{ - typ: yaml_TAG_DIRECTIVE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: handle, - prefix: prefix, - } - - // Unknown directive. - } else { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "found unknown directive name") - return false - } - - // Eat the rest of the line including any comments. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - if parser.buffer[parser.buffer_pos] == '#' { - // [Go] Discard this inline comment for the time being. - //if !yaml_parser_scan_line_comment(parser, start_mark) { - // return false - //} - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // Check if we are at the end of the line. - if !is_breakz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "did not find expected comment or line break") - return false - } - - // Eat a line break. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } - - return true -} - -// Scan the directive name. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ -// -func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { - // Consume the directive name. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - var s []byte - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the name is empty. - if len(s) == 0 { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "could not find expected directive name") - return false - } - - // Check for an blank character after the name. - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "found unexpected non-alphabetical character") - return false - } - *name = s - return true -} - -// Scan the value of VERSION-DIRECTIVE. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ -func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { - // Eat whitespaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Consume the major version number. - if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { - return false - } - - // Eat '.'. - if parser.buffer[parser.buffer_pos] != '.' { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "did not find expected digit or '.' character") - } - - skip(parser) - - // Consume the minor version number. - if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { - return false - } - return true -} - -const max_number_length = 2 - -// Scan the version number of VERSION-DIRECTIVE. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ -func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { - - // Repeat while the next character is digit. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - var value, length int8 - for is_digit(parser.buffer, parser.buffer_pos) { - // Check if the number is too long. - length++ - if length > max_number_length { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "found extremely long version number") - } - value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the number was present. - if length == 0 { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "did not find expected version number") - } - *number = value - return true -} - -// Scan the value of a TAG-DIRECTIVE token. -// -// Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// -func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { - var handle_value, prefix_value []byte - - // Eat whitespaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Scan a handle. - if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { - return false - } - - // Expect a whitespace. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blank(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", - start_mark, "did not find expected whitespace") - return false - } - - // Eat whitespaces. - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Scan a prefix. - if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { - return false - } - - // Expect a whitespace or line break. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", - start_mark, "did not find expected whitespace or line break") - return false - } - - *handle = handle_value - *prefix = prefix_value - return true -} - -func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { - var s []byte - - // Eat the indicator character. - start_mark := parser.mark - skip(parser) - - // Consume the value. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - end_mark := parser.mark - - /* - * Check if length of the anchor is greater than 0 and it is followed by - * a whitespace character or one of the indicators: - * - * '?', ':', ',', ']', '}', '%', '@', '`'. - */ - - if len(s) == 0 || - !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || - parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || - parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || - parser.buffer[parser.buffer_pos] == '`') { - context := "while scanning an alias" - if typ == yaml_ANCHOR_TOKEN { - context = "while scanning an anchor" - } - yaml_parser_set_scanner_error(parser, context, start_mark, - "did not find expected alphabetic or numeric character") - return false - } - - // Create a token. - *token = yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - value: s, - } - - return true -} - -/* - * Scan a TAG token. - */ - -func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { - var handle, suffix []byte - - start_mark := parser.mark - - // Check if the tag is in the canonical form. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - if parser.buffer[parser.buffer_pos+1] == '<' { - // Keep the handle as '' - - // Eat '!<' - skip(parser) - skip(parser) - - // Consume the tag value. - if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { - return false - } - - // Check for '>' and eat it. - if parser.buffer[parser.buffer_pos] != '>' { - yaml_parser_set_scanner_error(parser, "while scanning a tag", - start_mark, "did not find the expected '>'") - return false - } - - skip(parser) - } else { - // The tag has either the '!suffix' or the '!handle!suffix' form. - - // First, try to scan a handle. - if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { - return false - } - - // Check if it is, indeed, handle. - if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { - // Scan the suffix now. - if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { - return false - } - } else { - // It wasn't a handle after all. Scan the rest of the tag. - if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { - return false - } - - // Set the handle to '!'. - handle = []byte{'!'} - - // A special case: the '!' tag. Set the handle to '' and the - // suffix to '!'. - if len(suffix) == 0 { - handle, suffix = suffix, handle - } - } - } - - // Check the character which ends the tag. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a tag", - start_mark, "did not find expected whitespace or line break") - return false - } - - end_mark := parser.mark - - // Create a token. - *token = yaml_token_t{ - typ: yaml_TAG_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: handle, - suffix: suffix, - } - return true -} - -// Scan a tag handle. -func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { - // Check the initial '!' character. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.buffer[parser.buffer_pos] != '!' { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected '!'") - return false - } - - var s []byte - - // Copy the '!' character. - s = read(parser, s) - - // Copy all subsequent alphabetical and numerical characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the trailing character is '!' and copy it. - if parser.buffer[parser.buffer_pos] == '!' { - s = read(parser, s) - } else { - // It's either the '!' tag or not really a tag handle. If it's a %TAG - // directive, it's an error. If it's a tag token, it must be a part of URI. - if directive && string(s) != "!" { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected '!'") - return false - } - } - - *handle = s - return true -} - -// Scan a tag. -func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { - //size_t length = head ? strlen((char *)head) : 0 - var s []byte - hasTag := len(head) > 0 - - // Copy the head if needed. - // - // Note that we don't copy the leading '!' character. - if len(head) > 1 { - s = append(s, head[1:]...) - } - - // Scan the tag. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // The set of characters that may appear in URI is as follows: - // - // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', - // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', - // '%'. - // [Go] TODO Convert this into more reasonable logic. - for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || - parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || - parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || - parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || - parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || - parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || - parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || - parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || - parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || - parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || - parser.buffer[parser.buffer_pos] == '%' { - // Check if it is a URI-escape sequence. - if parser.buffer[parser.buffer_pos] == '%' { - if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { - return false - } - } else { - s = read(parser, s) - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - hasTag = true - } - - if !hasTag { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected tag URI") - return false - } - *uri = s - return true -} - -// Decode an URI-escape sequence corresponding to a single UTF-8 character. -func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { - - // Decode the required number of characters. - w := 1024 - for w > 0 { - // Check for a URI-escaped octet. - if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { - return false - } - - if !(parser.buffer[parser.buffer_pos] == '%' && - is_hex(parser.buffer, parser.buffer_pos+1) && - is_hex(parser.buffer, parser.buffer_pos+2)) { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find URI escaped octet") - } - - // Get the octet. - octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) - - // If it is the leading octet, determine the length of the UTF-8 sequence. - if w == 1024 { - w = width(octet) - if w == 0 { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "found an incorrect leading UTF-8 octet") - } - } else { - // Check if the trailing octet is correct. - if octet&0xC0 != 0x80 { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "found an incorrect trailing UTF-8 octet") - } - } - - // Copy the octet and move the pointers. - *s = append(*s, octet) - skip(parser) - skip(parser) - skip(parser) - w-- - } - return true -} - -// Scan a block scalar. -func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { - // Eat the indicator '|' or '>'. - start_mark := parser.mark - skip(parser) - - // Scan the additional block scalar indicators. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check for a chomping indicator. - var chomping, increment int - if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { - // Set the chomping method and eat the indicator. - if parser.buffer[parser.buffer_pos] == '+' { - chomping = +1 - } else { - chomping = -1 - } - skip(parser) - - // Check for an indentation indicator. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if is_digit(parser.buffer, parser.buffer_pos) { - // Check that the indentation is greater than 0. - if parser.buffer[parser.buffer_pos] == '0' { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found an indentation indicator equal to 0") - return false - } - - // Get the indentation level and eat the indicator. - increment = as_digit(parser.buffer, parser.buffer_pos) - skip(parser) - } - - } else if is_digit(parser.buffer, parser.buffer_pos) { - // Do the same as above, but in the opposite order. - - if parser.buffer[parser.buffer_pos] == '0' { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found an indentation indicator equal to 0") - return false - } - increment = as_digit(parser.buffer, parser.buffer_pos) - skip(parser) - - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { - if parser.buffer[parser.buffer_pos] == '+' { - chomping = +1 - } else { - chomping = -1 - } - skip(parser) - } - } - - // Eat whitespaces and comments to the end of the line. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - if parser.buffer[parser.buffer_pos] == '#' { - // TODO Test this and then re-enable it. - //if !yaml_parser_scan_line_comment(parser, start_mark) { - // return false - //} - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // Check if we are at the end of the line. - if !is_breakz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "did not find expected comment or line break") - return false - } - - // Eat a line break. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } - - end_mark := parser.mark - - // Set the indentation level if it was specified. - var indent int - if increment > 0 { - if parser.indent >= 0 { - indent = parser.indent + increment - } else { - indent = increment - } - } - - // Scan the leading line breaks and determine the indentation level if needed. - var s, leading_break, trailing_breaks []byte - if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { - return false - } - - // Scan the block scalar content. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - var leading_blank, trailing_blank bool - for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { - // We are at the beginning of a non-empty line. - - // Is it a trailing whitespace? - trailing_blank = is_blank(parser.buffer, parser.buffer_pos) - - // Check if we need to fold the leading line break. - if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { - // Do we need to join the lines by space? - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } - } else { - s = append(s, leading_break...) - } - leading_break = leading_break[:0] - - // Append the remaining line breaks. - s = append(s, trailing_breaks...) - trailing_breaks = trailing_breaks[:0] - - // Is it a leading whitespace? - leading_blank = is_blank(parser.buffer, parser.buffer_pos) - - // Consume the current line. - for !is_breakz(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Consume the line break. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - leading_break = read_line(parser, leading_break) - - // Eat the following indentation spaces and line breaks. - if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { - return false - } - } - - // Chomp the tail. - if chomping != -1 { - s = append(s, leading_break...) - } - if chomping == 1 { - s = append(s, trailing_breaks...) - } - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_LITERAL_SCALAR_STYLE, - } - if !literal { - token.style = yaml_FOLDED_SCALAR_STYLE - } - return true -} - -// Scan indentation spaces and line breaks for a block scalar. Determine the -// indentation level if needed. -func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { - *end_mark = parser.mark - - // Eat the indentation spaces and line breaks. - max_indent := 0 - for { - // Eat the indentation spaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - if parser.mark.column > max_indent { - max_indent = parser.mark.column - } - - // Check for a tab character messing the indentation. - if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { - return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found a tab character where an indentation space is expected") - } - - // Have we found a non-empty line? - if !is_break(parser.buffer, parser.buffer_pos) { - break - } - - // Consume the line break. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - // [Go] Should really be returning breaks instead. - *breaks = read_line(parser, *breaks) - *end_mark = parser.mark - } - - // Determine the indentation level if needed. - if *indent == 0 { - *indent = max_indent - if *indent < parser.indent+1 { - *indent = parser.indent + 1 - } - if *indent < 1 { - *indent = 1 - } - } - return true -} - -// Scan a quoted scalar. -func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { - // Eat the left quote. - start_mark := parser.mark - skip(parser) - - // Consume the content of the quoted scalar. - var s, leading_break, trailing_breaks, whitespaces []byte - for { - // Check that there are no document indicators at the beginning of the line. - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - - if parser.mark.column == 0 && - ((parser.buffer[parser.buffer_pos+0] == '-' && - parser.buffer[parser.buffer_pos+1] == '-' && - parser.buffer[parser.buffer_pos+2] == '-') || - (parser.buffer[parser.buffer_pos+0] == '.' && - parser.buffer[parser.buffer_pos+1] == '.' && - parser.buffer[parser.buffer_pos+2] == '.')) && - is_blankz(parser.buffer, parser.buffer_pos+3) { - yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", - start_mark, "found unexpected document indicator") - return false - } - - // Check for EOF. - if is_z(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", - start_mark, "found unexpected end of stream") - return false - } - - // Consume non-blank characters. - leading_blanks := false - for !is_blankz(parser.buffer, parser.buffer_pos) { - if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { - // Is is an escaped single quote. - s = append(s, '\'') - skip(parser) - skip(parser) - - } else if single && parser.buffer[parser.buffer_pos] == '\'' { - // It is a right single quote. - break - } else if !single && parser.buffer[parser.buffer_pos] == '"' { - // It is a right double quote. - break - - } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { - // It is an escaped line break. - if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { - return false - } - skip(parser) - skip_line(parser) - leading_blanks = true - break - - } else if !single && parser.buffer[parser.buffer_pos] == '\\' { - // It is an escape sequence. - code_length := 0 - - // Check the escape character. - switch parser.buffer[parser.buffer_pos+1] { - case '0': - s = append(s, 0) - case 'a': - s = append(s, '\x07') - case 'b': - s = append(s, '\x08') - case 't', '\t': - s = append(s, '\x09') - case 'n': - s = append(s, '\x0A') - case 'v': - s = append(s, '\x0B') - case 'f': - s = append(s, '\x0C') - case 'r': - s = append(s, '\x0D') - case 'e': - s = append(s, '\x1B') - case ' ': - s = append(s, '\x20') - case '"': - s = append(s, '"') - case '\'': - s = append(s, '\'') - case '\\': - s = append(s, '\\') - case 'N': // NEL (#x85) - s = append(s, '\xC2') - s = append(s, '\x85') - case '_': // #xA0 - s = append(s, '\xC2') - s = append(s, '\xA0') - case 'L': // LS (#x2028) - s = append(s, '\xE2') - s = append(s, '\x80') - s = append(s, '\xA8') - case 'P': // PS (#x2029) - s = append(s, '\xE2') - s = append(s, '\x80') - s = append(s, '\xA9') - case 'x': - code_length = 2 - case 'u': - code_length = 4 - case 'U': - code_length = 8 - default: - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "found unknown escape character") - return false - } - - skip(parser) - skip(parser) - - // Consume an arbitrary escape code. - if code_length > 0 { - var value int - - // Scan the character value. - if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { - return false - } - for k := 0; k < code_length; k++ { - if !is_hex(parser.buffer, parser.buffer_pos+k) { - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "did not find expected hexdecimal number") - return false - } - value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) - } - - // Check the value and write the character. - if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "found invalid Unicode character escape code") - return false - } - if value <= 0x7F { - s = append(s, byte(value)) - } else if value <= 0x7FF { - s = append(s, byte(0xC0+(value>>6))) - s = append(s, byte(0x80+(value&0x3F))) - } else if value <= 0xFFFF { - s = append(s, byte(0xE0+(value>>12))) - s = append(s, byte(0x80+((value>>6)&0x3F))) - s = append(s, byte(0x80+(value&0x3F))) - } else { - s = append(s, byte(0xF0+(value>>18))) - s = append(s, byte(0x80+((value>>12)&0x3F))) - s = append(s, byte(0x80+((value>>6)&0x3F))) - s = append(s, byte(0x80+(value&0x3F))) - } - - // Advance the pointer. - for k := 0; k < code_length; k++ { - skip(parser) - } - } - } else { - // It is a non-escaped non-blank character. - s = read(parser, s) - } - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - } - - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check if we are at the end of the scalar. - if single { - if parser.buffer[parser.buffer_pos] == '\'' { - break - } - } else { - if parser.buffer[parser.buffer_pos] == '"' { - break - } - } - - // Consume blank characters. - for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { - if is_blank(parser.buffer, parser.buffer_pos) { - // Consume a space or a tab character. - if !leading_blanks { - whitespaces = read(parser, whitespaces) - } else { - skip(parser) - } - } else { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - // Check if it is a first line break. - if !leading_blanks { - whitespaces = whitespaces[:0] - leading_break = read_line(parser, leading_break) - leading_blanks = true - } else { - trailing_breaks = read_line(parser, trailing_breaks) - } - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Join the whitespaces or fold line breaks. - if leading_blanks { - // Do we need to fold line breaks? - if len(leading_break) > 0 && leading_break[0] == '\n' { - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } else { - s = append(s, trailing_breaks...) - } - } else { - s = append(s, leading_break...) - s = append(s, trailing_breaks...) - } - trailing_breaks = trailing_breaks[:0] - leading_break = leading_break[:0] - } else { - s = append(s, whitespaces...) - whitespaces = whitespaces[:0] - } - } - - // Eat the right quote. - skip(parser) - end_mark := parser.mark - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_SINGLE_QUOTED_SCALAR_STYLE, - } - if !single { - token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - return true -} - -// Scan a plain scalar. -func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { - - var s, leading_break, trailing_breaks, whitespaces []byte - var leading_blanks bool - var indent = parser.indent + 1 - - start_mark := parser.mark - end_mark := parser.mark - - // Consume the content of the plain scalar. - for { - // Check for a document indicator. - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - if parser.mark.column == 0 && - ((parser.buffer[parser.buffer_pos+0] == '-' && - parser.buffer[parser.buffer_pos+1] == '-' && - parser.buffer[parser.buffer_pos+2] == '-') || - (parser.buffer[parser.buffer_pos+0] == '.' && - parser.buffer[parser.buffer_pos+1] == '.' && - parser.buffer[parser.buffer_pos+2] == '.')) && - is_blankz(parser.buffer, parser.buffer_pos+3) { - break - } - - // Check for a comment. - if parser.buffer[parser.buffer_pos] == '#' { - break - } - - // Consume non-blank characters. - for !is_blankz(parser.buffer, parser.buffer_pos) { - - // Check for indicators that may end a plain scalar. - if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || - (parser.flow_level > 0 && - (parser.buffer[parser.buffer_pos] == ',' || - parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || - parser.buffer[parser.buffer_pos] == '}')) { - break - } - - // Check if we need to join whitespaces and breaks. - if leading_blanks || len(whitespaces) > 0 { - if leading_blanks { - // Do we need to fold line breaks? - if leading_break[0] == '\n' { - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } else { - s = append(s, trailing_breaks...) - } - } else { - s = append(s, leading_break...) - s = append(s, trailing_breaks...) - } - trailing_breaks = trailing_breaks[:0] - leading_break = leading_break[:0] - leading_blanks = false - } else { - s = append(s, whitespaces...) - whitespaces = whitespaces[:0] - } - } - - // Copy the character. - s = read(parser, s) - - end_mark = parser.mark - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - } - - // Is it the end? - if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { - break - } - - // Consume blank characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { - if is_blank(parser.buffer, parser.buffer_pos) { - - // Check for tab characters that abuse indentation. - if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", - start_mark, "found a tab character that violates indentation") - return false - } - - // Consume a space or a tab character. - if !leading_blanks { - whitespaces = read(parser, whitespaces) - } else { - skip(parser) - } - } else { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - // Check if it is a first line break. - if !leading_blanks { - whitespaces = whitespaces[:0] - leading_break = read_line(parser, leading_break) - leading_blanks = true - } else { - trailing_breaks = read_line(parser, trailing_breaks) - } - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check indentation level. - if parser.flow_level == 0 && parser.mark.column < indent { - break - } - } - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_PLAIN_SCALAR_STYLE, - } - - // Note that we change the 'simple_key_allowed' flag. - if leading_blanks { - parser.simple_key_allowed = true - } - return true -} - -func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t) bool { - if parser.newlines > 0 { - return true - } - - var start_mark yaml_mark_t - var text []byte - - for peek := 0; peek < 512; peek++ { - if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { - break - } - if is_blank(parser.buffer, parser.buffer_pos+peek) { - continue - } - if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index+peek - for { - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if is_breakz(parser.buffer, parser.buffer_pos) { - if parser.mark.index >= seen { - break - } - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } else if parser.mark.index >= seen { - if len(text) == 0 { - start_mark = parser.mark - } - text = read(parser, text) - } else { - skip(parser) - } - } - } - break - } - if len(text) > 0 { - parser.comments = append(parser.comments, yaml_comment_t{ - token_mark: token_mark, - start_mark: start_mark, - line: text, - }) - } - return true -} - -func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) bool { - token := parser.tokens[len(parser.tokens)-1] - - if token.typ == yaml_FLOW_ENTRY_TOKEN && len(parser.tokens) > 1 { - token = parser.tokens[len(parser.tokens)-2] - } - - var token_mark = token.start_mark - var start_mark yaml_mark_t - - var recent_empty = false - var first_empty = parser.newlines <= 1 - - var line = parser.mark.line - var column = parser.mark.column - - var text []byte - - // The foot line is the place where a comment must start to - // still be considered as a foot of the prior content. - // If there's some content in the currently parsed line, then - // the foot is the line below it. - var foot_line = -1 - if scan_mark.line > 0 { - foot_line = parser.mark.line-parser.newlines+1 - if parser.newlines == 0 && parser.mark.column > 1 { - foot_line++ - } - } - - var peek = 0 - for ; peek < 512; peek++ { - if parser.unread < peek+1 && !yaml_parser_update_buffer(parser, peek+1) { - break - } - column++ - if is_blank(parser.buffer, parser.buffer_pos+peek) { - continue - } - c := parser.buffer[parser.buffer_pos+peek] - if is_breakz(parser.buffer, parser.buffer_pos+peek) || parser.flow_level > 0 && (c == ']' || c == '}') { - // Got line break or terminator. - if !recent_empty { - if first_empty && (start_mark.line == foot_line || start_mark.column-1 < parser.indent) { - // This is the first empty line and there were no empty lines before, - // so this initial part of the comment is a foot of the prior token - // instead of being a head for the following one. Split it up. - if len(text) > 0 { - if start_mark.column-1 < parser.indent { - // If dedented it's unrelated to the prior token. - token_mark = start_mark - } - parser.comments = append(parser.comments, yaml_comment_t{ - scan_mark: scan_mark, - token_mark: token_mark, - start_mark: start_mark, - end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, - foot: text, - }) - scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} - token_mark = scan_mark - text = nil - } - } else { - if len(text) > 0 && parser.buffer[parser.buffer_pos+peek] != 0 { - text = append(text, '\n') - } - } - } - if !is_break(parser.buffer, parser.buffer_pos+peek) { - break - } - first_empty = false - recent_empty = true - column = 0 - line++ - continue - } - - if len(text) > 0 && column < parser.indent+1 && column != start_mark.column { - // The comment at the different indentation is a foot of the - // preceding data rather than a head of the upcoming one. - parser.comments = append(parser.comments, yaml_comment_t{ - scan_mark: scan_mark, - token_mark: token_mark, - start_mark: start_mark, - end_mark: yaml_mark_t{parser.mark.index + peek, line, column}, - foot: text, - }) - scan_mark = yaml_mark_t{parser.mark.index + peek, line, column} - token_mark = scan_mark - text = nil - } - - if parser.buffer[parser.buffer_pos+peek] != '#' { - break - } - - if len(text) == 0 { - start_mark = yaml_mark_t{parser.mark.index + peek, line, column} - } else { - text = append(text, '\n') - } - - recent_empty = false - - // Consume until after the consumed comment line. - seen := parser.mark.index+peek - for { - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if is_breakz(parser.buffer, parser.buffer_pos) { - if parser.mark.index >= seen { - break - } - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } else if parser.mark.index >= seen { - text = read(parser, text) - } else { - skip(parser) - } - } - - peek = 0 - column = 0 - line = parser.mark.line - } - - if len(text) > 0 { - parser.comments = append(parser.comments, yaml_comment_t{ - scan_mark: scan_mark, - token_mark: start_mark, - start_mark: start_mark, - end_mark: yaml_mark_t{parser.mark.index + peek - 1, line, column}, - head: text, - }) - } - return true -} diff --git a/vendor/gopkg.in/yaml.v3/sorter.go b/vendor/gopkg.in/yaml.v3/sorter.go deleted file mode 100644 index 9210ece7e..000000000 --- a/vendor/gopkg.in/yaml.v3/sorter.go +++ /dev/null @@ -1,134 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// -// 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 yaml - -import ( - "reflect" - "unicode" -) - -type keyList []reflect.Value - -func (l keyList) Len() int { return len(l) } -func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } -func (l keyList) Less(i, j int) bool { - a := l[i] - b := l[j] - ak := a.Kind() - bk := b.Kind() - for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { - a = a.Elem() - ak = a.Kind() - } - for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { - b = b.Elem() - bk = b.Kind() - } - af, aok := keyFloat(a) - bf, bok := keyFloat(b) - if aok && bok { - if af != bf { - return af < bf - } - if ak != bk { - return ak < bk - } - return numLess(a, b) - } - if ak != reflect.String || bk != reflect.String { - return ak < bk - } - ar, br := []rune(a.String()), []rune(b.String()) - digits := false - for i := 0; i < len(ar) && i < len(br); i++ { - if ar[i] == br[i] { - digits = unicode.IsDigit(ar[i]) - continue - } - al := unicode.IsLetter(ar[i]) - bl := unicode.IsLetter(br[i]) - if al && bl { - return ar[i] < br[i] - } - if al || bl { - if digits { - return al - } else { - return bl - } - } - var ai, bi int - var an, bn int64 - if ar[i] == '0' || br[i] == '0' { - for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { - if ar[j] != '0' { - an = 1 - bn = 1 - break - } - } - } - for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { - an = an*10 + int64(ar[ai]-'0') - } - for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { - bn = bn*10 + int64(br[bi]-'0') - } - if an != bn { - return an < bn - } - if ai != bi { - return ai < bi - } - return ar[i] < br[i] - } - return len(ar) < len(br) -} - -// keyFloat returns a float value for v if it is a number/bool -// and whether it is a number/bool or not. -func keyFloat(v reflect.Value) (f float64, ok bool) { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return float64(v.Int()), true - case reflect.Float32, reflect.Float64: - return v.Float(), true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return float64(v.Uint()), true - case reflect.Bool: - if v.Bool() { - return 1, true - } - return 0, true - } - return 0, false -} - -// numLess returns whether a < b. -// a and b must necessarily have the same kind. -func numLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return a.Int() < b.Int() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Bool: - return !a.Bool() && b.Bool() - } - panic("not a number") -} diff --git a/vendor/gopkg.in/yaml.v3/writerc.go b/vendor/gopkg.in/yaml.v3/writerc.go deleted file mode 100644 index b8a116bf9..000000000 --- a/vendor/gopkg.in/yaml.v3/writerc.go +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -// Set the writer error and return false. -func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_WRITER_ERROR - emitter.problem = problem - return false -} - -// Flush the output buffer. -func yaml_emitter_flush(emitter *yaml_emitter_t) bool { - if emitter.write_handler == nil { - panic("write handler not set") - } - - // Check if the buffer is empty. - if emitter.buffer_pos == 0 { - return true - } - - if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { - return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) - } - emitter.buffer_pos = 0 - return true -} diff --git a/vendor/gopkg.in/yaml.v3/yaml.go b/vendor/gopkg.in/yaml.v3/yaml.go deleted file mode 100644 index 56e8a8490..000000000 --- a/vendor/gopkg.in/yaml.v3/yaml.go +++ /dev/null @@ -1,693 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// -// 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 yaml implements YAML support for the Go language. -// -// Source code and other details for the project are available at GitHub: -// -// https://github.com/go-yaml/yaml -// -package yaml - -import ( - "errors" - "fmt" - "io" - "reflect" - "strings" - "sync" - "unicode/utf8" -) - -// The Unmarshaler interface may be implemented by types to customize their -// behavior when being unmarshaled from a YAML document. -type Unmarshaler interface { - UnmarshalYAML(value *Node) error -} - -type obsoleteUnmarshaler interface { - UnmarshalYAML(unmarshal func(interface{}) error) error -} - -// The Marshaler interface may be implemented by types to customize their -// behavior when being marshaled into a YAML document. The returned value -// is marshaled in place of the original value implementing Marshaler. -// -// If an error is returned by MarshalYAML, the marshaling procedure stops -// and returns with the provided error. -type Marshaler interface { - MarshalYAML() (interface{}, error) -} - -// Unmarshal decodes the first document found within the in byte slice -// and assigns decoded values into the out value. -// -// Maps and pointers (to a struct, string, int, etc) are accepted as out -// values. If an internal pointer within a struct is not initialized, -// the yaml package will initialize it if necessary for unmarshalling -// the provided data. The out parameter must not be nil. -// -// The type of the decoded values should be compatible with the respective -// values in out. If one or more values cannot be decoded due to a type -// mismatches, decoding continues partially until the end of the YAML -// content, and a *yaml.TypeError is returned with details for all -// missed values. -// -// Struct fields are only unmarshalled if they are exported (have an -// upper case first letter), and are unmarshalled using the field name -// lowercased as the default key. Custom keys may be defined via the -// "yaml" name in the field tag: the content preceding the first comma -// is used as the key, and the following comma-separated options are -// used to tweak the marshalling process (see Marshal). -// Conflicting names result in a runtime error. -// -// For example: -// -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) -// -// See the documentation of Marshal for the format of tags and a list of -// supported tag options. -// -func Unmarshal(in []byte, out interface{}) (err error) { - return unmarshal(in, out, false) -} - -// A Decoder reads and decodes YAML values from an input stream. -type Decoder struct { - parser *parser - knownFields bool -} - -// NewDecoder returns a new decoder that reads from r. -// -// The decoder introduces its own buffering and may read -// data from r beyond the YAML values requested. -func NewDecoder(r io.Reader) *Decoder { - return &Decoder{ - parser: newParserFromReader(r), - } -} - -// KnownFields ensures that the keys in decoded mappings to -// exist as fields in the struct being decoded into. -func (dec *Decoder) KnownFields(enable bool) { - dec.knownFields = enable -} - -// Decode reads the next YAML-encoded value from its input -// and stores it in the value pointed to by v. -// -// See the documentation for Unmarshal for details about the -// conversion of YAML into a Go value. -func (dec *Decoder) Decode(v interface{}) (err error) { - d := newDecoder() - d.knownFields = dec.knownFields - defer handleErr(&err) - node := dec.parser.parse() - if node == nil { - return io.EOF - } - out := reflect.ValueOf(v) - if out.Kind() == reflect.Ptr && !out.IsNil() { - out = out.Elem() - } - d.unmarshal(node, out) - if len(d.terrors) > 0 { - return &TypeError{d.terrors} - } - return nil -} - -// Decode decodes the node and stores its data into the value pointed to by v. -// -// See the documentation for Unmarshal for details about the -// conversion of YAML into a Go value. -func (n *Node) Decode(v interface{}) (err error) { - d := newDecoder() - defer handleErr(&err) - out := reflect.ValueOf(v) - if out.Kind() == reflect.Ptr && !out.IsNil() { - out = out.Elem() - } - d.unmarshal(n, out) - if len(d.terrors) > 0 { - return &TypeError{d.terrors} - } - return nil -} - -func unmarshal(in []byte, out interface{}, strict bool) (err error) { - defer handleErr(&err) - d := newDecoder() - p := newParser(in) - defer p.destroy() - node := p.parse() - if node != nil { - v := reflect.ValueOf(out) - if v.Kind() == reflect.Ptr && !v.IsNil() { - v = v.Elem() - } - d.unmarshal(node, v) - } - if len(d.terrors) > 0 { - return &TypeError{d.terrors} - } - return nil -} - -// Marshal serializes the value provided into a YAML document. The structure -// of the generated document will reflect the structure of the value itself. -// Maps and pointers (to struct, string, int, etc) are accepted as the in value. -// -// Struct fields are only marshalled if they are exported (have an upper case -// first letter), and are marshalled using the field name lowercased as the -// default key. Custom keys may be defined via the "yaml" name in the field -// tag: the content preceding the first comma is used as the key, and the -// following comma-separated options are used to tweak the marshalling process. -// Conflicting names result in a runtime error. -// -// The field tag format accepted is: -// -// `(...) yaml:"[][,[,]]" (...)` -// -// The following flags are currently supported: -// -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. -// -// flow Marshal using a flow style (useful for structs, -// sequences and maps). -// -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. -// -// In addition, if the key is "-", the field is ignored. -// -// For example: -// -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// -func Marshal(in interface{}) (out []byte, err error) { - defer handleErr(&err) - e := newEncoder() - defer e.destroy() - e.marshalDoc("", reflect.ValueOf(in)) - e.finish() - out = e.out - return -} - -// An Encoder writes YAML values to an output stream. -type Encoder struct { - encoder *encoder -} - -// NewEncoder returns a new encoder that writes to w. -// The Encoder should be closed after use to flush all data -// to w. -func NewEncoder(w io.Writer) *Encoder { - return &Encoder{ - encoder: newEncoderWithWriter(w), - } -} - -// Encode writes the YAML encoding of v to the stream. -// If multiple items are encoded to the stream, the -// second and subsequent document will be preceded -// with a "---" document separator, but the first will not. -// -// See the documentation for Marshal for details about the conversion of Go -// values to YAML. -func (e *Encoder) Encode(v interface{}) (err error) { - defer handleErr(&err) - e.encoder.marshalDoc("", reflect.ValueOf(v)) - return nil -} - -// Encode encodes value v and stores its representation in n. -// -// See the documentation for Marshal for details about the -// conversion of Go values into YAML. -func (n *Node) Encode(v interface{}) (err error) { - defer handleErr(&err) - e := newEncoder() - defer e.destroy() - e.marshalDoc("", reflect.ValueOf(v)) - e.finish() - p := newParser(e.out) - p.textless = true - defer p.destroy() - doc := p.parse() - *n = *doc.Content[0] - return nil -} - -// SetIndent changes the used indentation used when encoding. -func (e *Encoder) SetIndent(spaces int) { - if spaces < 0 { - panic("yaml: cannot indent to a negative number of spaces") - } - e.encoder.indent = spaces -} - -// Close closes the encoder by writing any remaining data. -// It does not write a stream terminating string "...". -func (e *Encoder) Close() (err error) { - defer handleErr(&err) - e.encoder.finish() - return nil -} - -func handleErr(err *error) { - if v := recover(); v != nil { - if e, ok := v.(yamlError); ok { - *err = e.err - } else { - panic(v) - } - } -} - -type yamlError struct { - err error -} - -func fail(err error) { - panic(yamlError{err}) -} - -func failf(format string, args ...interface{}) { - panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) -} - -// A TypeError is returned by Unmarshal when one or more fields in -// the YAML document cannot be properly decoded into the requested -// types. When this error is returned, the value is still -// unmarshaled partially. -type TypeError struct { - Errors []string -} - -func (e *TypeError) Error() string { - return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) -} - -type Kind uint32 - -const ( - DocumentNode Kind = 1 << iota - SequenceNode - MappingNode - ScalarNode - AliasNode -) - -type Style uint32 - -const ( - TaggedStyle Style = 1 << iota - DoubleQuotedStyle - SingleQuotedStyle - LiteralStyle - FoldedStyle - FlowStyle -) - -// Node represents an element in the YAML document hierarchy. While documents -// are typically encoded and decoded into higher level types, such as structs -// and maps, Node is an intermediate representation that allows detailed -// control over the content being decoded or encoded. -// -// It's worth noting that although Node offers access into details such as -// line numbers, colums, and comments, the content when re-encoded will not -// have its original textual representation preserved. An effort is made to -// render the data plesantly, and to preserve comments near the data they -// describe, though. -// -// Values that make use of the Node type interact with the yaml package in the -// same way any other type would do, by encoding and decoding yaml data -// directly or indirectly into them. -// -// For example: -// -// var person struct { -// Name string -// Address yaml.Node -// } -// err := yaml.Unmarshal(data, &person) -// -// Or by itself: -// -// var person Node -// err := yaml.Unmarshal(data, &person) -// -type Node struct { - // Kind defines whether the node is a document, a mapping, a sequence, - // a scalar value, or an alias to another node. The specific data type of - // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind - - // Style allows customizing the apperance of the node in the tree. - Style Style - - // Tag holds the YAML tag defining the data type for the value. - // When decoding, this field will always be set to the resolved tag, - // even when it wasn't explicitly provided in the YAML content. - // When encoding, if this field is unset the value type will be - // implied from the node properties, and if it is set, it will only - // be serialized into the representation if TaggedStyle is used or - // the implicit tag diverges from the provided one. - Tag string - - // Value holds the unescaped and unquoted represenation of the value. - Value string - - // Anchor holds the anchor name for this node, which allows aliases to point to it. - Anchor string - - // Alias holds the node that this alias points to. Only valid when Kind is AliasNode. - Alias *Node - - // Content holds contained nodes for documents, mappings, and sequences. - Content []*Node - - // HeadComment holds any comments in the lines preceding the node and - // not separated by an empty line. - HeadComment string - - // LineComment holds any comments at the end of the line where the node is in. - LineComment string - - // FootComment holds any comments following the node and before empty lines. - FootComment string - - // Line and Column hold the node position in the decoded YAML text. - // These fields are not respected when encoding the node. - Line int - Column int -} - -// IsZero returns whether the node has all of its fields unset. -func (n *Node) IsZero() bool { - return n.Kind == 0 && n.Style == 0 && n.Tag == "" && n.Value == "" && n.Anchor == "" && n.Alias == nil && n.Content == nil && - n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 -} - - -// LongTag returns the long form of the tag that indicates the data type for -// the node. If the Tag field isn't explicitly defined, one will be computed -// based on the node properties. -func (n *Node) LongTag() string { - return longTag(n.ShortTag()) -} - -// ShortTag returns the short form of the YAML tag that indicates data type for -// the node. If the Tag field isn't explicitly defined, one will be computed -// based on the node properties. -func (n *Node) ShortTag() string { - if n.indicatedString() { - return strTag - } - if n.Tag == "" || n.Tag == "!" { - switch n.Kind { - case MappingNode: - return mapTag - case SequenceNode: - return seqTag - case AliasNode: - if n.Alias != nil { - return n.Alias.ShortTag() - } - case ScalarNode: - tag, _ := resolve("", n.Value) - return tag - } - return "" - } - return shortTag(n.Tag) -} - -func (n *Node) indicatedString() bool { - return n.Kind == ScalarNode && - (shortTag(n.Tag) == strTag || - (n.Tag == "" || n.Tag == "!") && n.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0) -} - -// SetString is a convenience function that sets the node to a string value -// and defines its style in a pleasant way depending on its content. -func (n *Node) SetString(s string) { - n.Kind = ScalarNode - if utf8.ValidString(s) { - n.Value = s - n.Tag = strTag - } else { - n.Value = encodeBase64(s) - n.Tag = binaryTag - } - if strings.Contains(n.Value, "\n") { - n.Style = LiteralStyle - } -} - -// -------------------------------------------------------------------------- -// Maintain a mapping of keys to structure field indexes - -// The code in this section was copied from mgo/bson. - -// structInfo holds details for the serialization of fields of -// a given struct. -type structInfo struct { - FieldsMap map[string]fieldInfo - FieldsList []fieldInfo - - // InlineMap is the number of the field in the struct that - // contains an ,inline map, or -1 if there's none. - InlineMap int - - // InlineUnmarshalers holds indexes to inlined fields that - // contain unmarshaler values. - InlineUnmarshalers [][]int -} - -type fieldInfo struct { - Key string - Num int - OmitEmpty bool - Flow bool - // Id holds the unique field identifier, so we can cheaply - // check for field duplicates without maintaining an extra map. - Id int - - // Inline holds the field index if the field is part of an inlined struct. - Inline []int -} - -var structMap = make(map[reflect.Type]*structInfo) -var fieldMapMutex sync.RWMutex -var unmarshalerType reflect.Type - -func init() { - var v Unmarshaler - unmarshalerType = reflect.ValueOf(&v).Elem().Type() -} - -func getStructInfo(st reflect.Type) (*structInfo, error) { - fieldMapMutex.RLock() - sinfo, found := structMap[st] - fieldMapMutex.RUnlock() - if found { - return sinfo, nil - } - - n := st.NumField() - fieldsMap := make(map[string]fieldInfo) - fieldsList := make([]fieldInfo, 0, n) - inlineMap := -1 - inlineUnmarshalers := [][]int(nil) - for i := 0; i != n; i++ { - field := st.Field(i) - if field.PkgPath != "" && !field.Anonymous { - continue // Private field - } - - info := fieldInfo{Num: i} - - tag := field.Tag.Get("yaml") - if tag == "" && strings.Index(string(field.Tag), ":") < 0 { - tag = string(field.Tag) - } - if tag == "-" { - continue - } - - inline := false - fields := strings.Split(tag, ",") - if len(fields) > 1 { - for _, flag := range fields[1:] { - switch flag { - case "omitempty": - info.OmitEmpty = true - case "flow": - info.Flow = true - case "inline": - inline = true - default: - return nil, errors.New(fmt.Sprintf("unsupported flag %q in tag %q of type %s", flag, tag, st)) - } - } - tag = fields[0] - } - - if inline { - switch field.Type.Kind() { - case reflect.Map: - if inlineMap >= 0 { - return nil, errors.New("multiple ,inline maps in struct " + st.String()) - } - if field.Type.Key() != reflect.TypeOf("") { - return nil, errors.New("option ,inline needs a map with string keys in struct " + st.String()) - } - inlineMap = info.Num - case reflect.Struct, reflect.Ptr: - ftype := field.Type - for ftype.Kind() == reflect.Ptr { - ftype = ftype.Elem() - } - if ftype.Kind() != reflect.Struct { - return nil, errors.New("option ,inline may only be used on a struct or map field") - } - if reflect.PtrTo(ftype).Implements(unmarshalerType) { - inlineUnmarshalers = append(inlineUnmarshalers, []int{i}) - } else { - sinfo, err := getStructInfo(ftype) - if err != nil { - return nil, err - } - for _, index := range sinfo.InlineUnmarshalers { - inlineUnmarshalers = append(inlineUnmarshalers, append([]int{i}, index...)) - } - for _, finfo := range sinfo.FieldsList { - if _, found := fieldsMap[finfo.Key]; found { - msg := "duplicated key '" + finfo.Key + "' in struct " + st.String() - return nil, errors.New(msg) - } - if finfo.Inline == nil { - finfo.Inline = []int{i, finfo.Num} - } else { - finfo.Inline = append([]int{i}, finfo.Inline...) - } - finfo.Id = len(fieldsList) - fieldsMap[finfo.Key] = finfo - fieldsList = append(fieldsList, finfo) - } - } - default: - return nil, errors.New("option ,inline may only be used on a struct or map field") - } - continue - } - - if tag != "" { - info.Key = tag - } else { - info.Key = strings.ToLower(field.Name) - } - - if _, found = fieldsMap[info.Key]; found { - msg := "duplicated key '" + info.Key + "' in struct " + st.String() - return nil, errors.New(msg) - } - - info.Id = len(fieldsList) - fieldsList = append(fieldsList, info) - fieldsMap[info.Key] = info - } - - sinfo = &structInfo{ - FieldsMap: fieldsMap, - FieldsList: fieldsList, - InlineMap: inlineMap, - InlineUnmarshalers: inlineUnmarshalers, - } - - fieldMapMutex.Lock() - structMap[st] = sinfo - fieldMapMutex.Unlock() - return sinfo, nil -} - -// IsZeroer is used to check whether an object is zero to -// determine whether it should be omitted when marshaling -// with the omitempty flag. One notable implementation -// is time.Time. -type IsZeroer interface { - IsZero() bool -} - -func isZero(v reflect.Value) bool { - kind := v.Kind() - if z, ok := v.Interface().(IsZeroer); ok { - if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { - return true - } - return z.IsZero() - } - switch kind { - case reflect.String: - return len(v.String()) == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - case reflect.Slice: - return v.Len() == 0 - case reflect.Map: - return v.Len() == 0 - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Struct: - vt := v.Type() - for i := v.NumField() - 1; i >= 0; i-- { - if vt.Field(i).PkgPath != "" { - continue // Private field - } - if !isZero(v.Field(i)) { - return false - } - } - return true - } - return false -} diff --git a/vendor/gopkg.in/yaml.v3/yamlh.go b/vendor/gopkg.in/yaml.v3/yamlh.go deleted file mode 100644 index 7c6d00770..000000000 --- a/vendor/gopkg.in/yaml.v3/yamlh.go +++ /dev/null @@ -1,807 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -import ( - "fmt" - "io" -) - -// The version directive data. -type yaml_version_directive_t struct { - major int8 // The major version number. - minor int8 // The minor version number. -} - -// The tag directive data. -type yaml_tag_directive_t struct { - handle []byte // The tag handle. - prefix []byte // The tag prefix. -} - -type yaml_encoding_t int - -// The stream encoding. -const ( - // Let the parser choose the encoding. - yaml_ANY_ENCODING yaml_encoding_t = iota - - yaml_UTF8_ENCODING // The default UTF-8 encoding. - yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. - yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. -) - -type yaml_break_t int - -// Line break types. -const ( - // Let the parser choose the break type. - yaml_ANY_BREAK yaml_break_t = iota - - yaml_CR_BREAK // Use CR for line breaks (Mac style). - yaml_LN_BREAK // Use LN for line breaks (Unix style). - yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). -) - -type yaml_error_type_t int - -// Many bad things could happen with the parser and emitter. -const ( - // No error is produced. - yaml_NO_ERROR yaml_error_type_t = iota - - yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. - yaml_READER_ERROR // Cannot read or decode the input stream. - yaml_SCANNER_ERROR // Cannot scan the input stream. - yaml_PARSER_ERROR // Cannot parse the input stream. - yaml_COMPOSER_ERROR // Cannot compose a YAML document. - yaml_WRITER_ERROR // Cannot write to the output stream. - yaml_EMITTER_ERROR // Cannot emit a YAML stream. -) - -// The pointer position. -type yaml_mark_t struct { - index int // The position index. - line int // The position line. - column int // The position column. -} - -// Node Styles - -type yaml_style_t int8 - -type yaml_scalar_style_t yaml_style_t - -// Scalar styles. -const ( - // Let the emitter choose the style. - yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = 0 - - yaml_PLAIN_SCALAR_STYLE yaml_scalar_style_t = 1 << iota // The plain scalar style. - yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. - yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. - yaml_LITERAL_SCALAR_STYLE // The literal scalar style. - yaml_FOLDED_SCALAR_STYLE // The folded scalar style. -) - -type yaml_sequence_style_t yaml_style_t - -// Sequence styles. -const ( - // Let the emitter choose the style. - yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota - - yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. - yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. -) - -type yaml_mapping_style_t yaml_style_t - -// Mapping styles. -const ( - // Let the emitter choose the style. - yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota - - yaml_BLOCK_MAPPING_STYLE // The block mapping style. - yaml_FLOW_MAPPING_STYLE // The flow mapping style. -) - -// Tokens - -type yaml_token_type_t int - -// Token types. -const ( - // An empty token. - yaml_NO_TOKEN yaml_token_type_t = iota - - yaml_STREAM_START_TOKEN // A STREAM-START token. - yaml_STREAM_END_TOKEN // A STREAM-END token. - - yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. - yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. - yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. - yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. - - yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. - yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. - yaml_BLOCK_END_TOKEN // A BLOCK-END token. - - yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. - yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. - yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. - yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. - - yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. - yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. - yaml_KEY_TOKEN // A KEY token. - yaml_VALUE_TOKEN // A VALUE token. - - yaml_ALIAS_TOKEN // An ALIAS token. - yaml_ANCHOR_TOKEN // An ANCHOR token. - yaml_TAG_TOKEN // A TAG token. - yaml_SCALAR_TOKEN // A SCALAR token. -) - -func (tt yaml_token_type_t) String() string { - switch tt { - case yaml_NO_TOKEN: - return "yaml_NO_TOKEN" - case yaml_STREAM_START_TOKEN: - return "yaml_STREAM_START_TOKEN" - case yaml_STREAM_END_TOKEN: - return "yaml_STREAM_END_TOKEN" - case yaml_VERSION_DIRECTIVE_TOKEN: - return "yaml_VERSION_DIRECTIVE_TOKEN" - case yaml_TAG_DIRECTIVE_TOKEN: - return "yaml_TAG_DIRECTIVE_TOKEN" - case yaml_DOCUMENT_START_TOKEN: - return "yaml_DOCUMENT_START_TOKEN" - case yaml_DOCUMENT_END_TOKEN: - return "yaml_DOCUMENT_END_TOKEN" - case yaml_BLOCK_SEQUENCE_START_TOKEN: - return "yaml_BLOCK_SEQUENCE_START_TOKEN" - case yaml_BLOCK_MAPPING_START_TOKEN: - return "yaml_BLOCK_MAPPING_START_TOKEN" - case yaml_BLOCK_END_TOKEN: - return "yaml_BLOCK_END_TOKEN" - case yaml_FLOW_SEQUENCE_START_TOKEN: - return "yaml_FLOW_SEQUENCE_START_TOKEN" - case yaml_FLOW_SEQUENCE_END_TOKEN: - return "yaml_FLOW_SEQUENCE_END_TOKEN" - case yaml_FLOW_MAPPING_START_TOKEN: - return "yaml_FLOW_MAPPING_START_TOKEN" - case yaml_FLOW_MAPPING_END_TOKEN: - return "yaml_FLOW_MAPPING_END_TOKEN" - case yaml_BLOCK_ENTRY_TOKEN: - return "yaml_BLOCK_ENTRY_TOKEN" - case yaml_FLOW_ENTRY_TOKEN: - return "yaml_FLOW_ENTRY_TOKEN" - case yaml_KEY_TOKEN: - return "yaml_KEY_TOKEN" - case yaml_VALUE_TOKEN: - return "yaml_VALUE_TOKEN" - case yaml_ALIAS_TOKEN: - return "yaml_ALIAS_TOKEN" - case yaml_ANCHOR_TOKEN: - return "yaml_ANCHOR_TOKEN" - case yaml_TAG_TOKEN: - return "yaml_TAG_TOKEN" - case yaml_SCALAR_TOKEN: - return "yaml_SCALAR_TOKEN" - } - return "" -} - -// The token structure. -type yaml_token_t struct { - // The token type. - typ yaml_token_type_t - - // The start/end of the token. - start_mark, end_mark yaml_mark_t - - // The stream encoding (for yaml_STREAM_START_TOKEN). - encoding yaml_encoding_t - - // The alias/anchor/scalar value or tag/tag directive handle - // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). - value []byte - - // The tag suffix (for yaml_TAG_TOKEN). - suffix []byte - - // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). - prefix []byte - - // The scalar style (for yaml_SCALAR_TOKEN). - style yaml_scalar_style_t - - // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). - major, minor int8 -} - -// Events - -type yaml_event_type_t int8 - -// Event types. -const ( - // An empty event. - yaml_NO_EVENT yaml_event_type_t = iota - - yaml_STREAM_START_EVENT // A STREAM-START event. - yaml_STREAM_END_EVENT // A STREAM-END event. - yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. - yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. - yaml_ALIAS_EVENT // An ALIAS event. - yaml_SCALAR_EVENT // A SCALAR event. - yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. - yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. - yaml_MAPPING_START_EVENT // A MAPPING-START event. - yaml_MAPPING_END_EVENT // A MAPPING-END event. - yaml_TAIL_COMMENT_EVENT -) - -var eventStrings = []string{ - yaml_NO_EVENT: "none", - yaml_STREAM_START_EVENT: "stream start", - yaml_STREAM_END_EVENT: "stream end", - yaml_DOCUMENT_START_EVENT: "document start", - yaml_DOCUMENT_END_EVENT: "document end", - yaml_ALIAS_EVENT: "alias", - yaml_SCALAR_EVENT: "scalar", - yaml_SEQUENCE_START_EVENT: "sequence start", - yaml_SEQUENCE_END_EVENT: "sequence end", - yaml_MAPPING_START_EVENT: "mapping start", - yaml_MAPPING_END_EVENT: "mapping end", - yaml_TAIL_COMMENT_EVENT: "tail comment", -} - -func (e yaml_event_type_t) String() string { - if e < 0 || int(e) >= len(eventStrings) { - return fmt.Sprintf("unknown event %d", e) - } - return eventStrings[e] -} - -// The event structure. -type yaml_event_t struct { - - // The event type. - typ yaml_event_type_t - - // The start and end of the event. - start_mark, end_mark yaml_mark_t - - // The document encoding (for yaml_STREAM_START_EVENT). - encoding yaml_encoding_t - - // The version directive (for yaml_DOCUMENT_START_EVENT). - version_directive *yaml_version_directive_t - - // The list of tag directives (for yaml_DOCUMENT_START_EVENT). - tag_directives []yaml_tag_directive_t - - // The comments - head_comment []byte - line_comment []byte - foot_comment []byte - tail_comment []byte - - // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). - anchor []byte - - // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). - tag []byte - - // The scalar value (for yaml_SCALAR_EVENT). - value []byte - - // Is the document start/end indicator implicit, or the tag optional? - // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). - implicit bool - - // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). - quoted_implicit bool - - // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). - style yaml_style_t -} - -func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } -func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } -func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } - -// Nodes - -const ( - yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. - yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. - yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. - yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. - yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. - yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. - - yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. - yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. - - // Not in original libyaml. - yaml_BINARY_TAG = "tag:yaml.org,2002:binary" - yaml_MERGE_TAG = "tag:yaml.org,2002:merge" - - yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. - yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. - yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. -) - -type yaml_node_type_t int - -// Node types. -const ( - // An empty node. - yaml_NO_NODE yaml_node_type_t = iota - - yaml_SCALAR_NODE // A scalar node. - yaml_SEQUENCE_NODE // A sequence node. - yaml_MAPPING_NODE // A mapping node. -) - -// An element of a sequence node. -type yaml_node_item_t int - -// An element of a mapping node. -type yaml_node_pair_t struct { - key int // The key of the element. - value int // The value of the element. -} - -// The node structure. -type yaml_node_t struct { - typ yaml_node_type_t // The node type. - tag []byte // The node tag. - - // The node data. - - // The scalar parameters (for yaml_SCALAR_NODE). - scalar struct { - value []byte // The scalar value. - length int // The length of the scalar value. - style yaml_scalar_style_t // The scalar style. - } - - // The sequence parameters (for YAML_SEQUENCE_NODE). - sequence struct { - items_data []yaml_node_item_t // The stack of sequence items. - style yaml_sequence_style_t // The sequence style. - } - - // The mapping parameters (for yaml_MAPPING_NODE). - mapping struct { - pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). - pairs_start *yaml_node_pair_t // The beginning of the stack. - pairs_end *yaml_node_pair_t // The end of the stack. - pairs_top *yaml_node_pair_t // The top of the stack. - style yaml_mapping_style_t // The mapping style. - } - - start_mark yaml_mark_t // The beginning of the node. - end_mark yaml_mark_t // The end of the node. - -} - -// The document structure. -type yaml_document_t struct { - - // The document nodes. - nodes []yaml_node_t - - // The version directive. - version_directive *yaml_version_directive_t - - // The list of tag directives. - tag_directives_data []yaml_tag_directive_t - tag_directives_start int // The beginning of the tag directives list. - tag_directives_end int // The end of the tag directives list. - - start_implicit int // Is the document start indicator implicit? - end_implicit int // Is the document end indicator implicit? - - // The start/end of the document. - start_mark, end_mark yaml_mark_t -} - -// The prototype of a read handler. -// -// The read handler is called when the parser needs to read more bytes from the -// source. The handler should write not more than size bytes to the buffer. -// The number of written bytes should be set to the size_read variable. -// -// [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). -// [out] buffer The buffer to write the data from the source. -// [in] size The size of the buffer. -// [out] size_read The actual number of bytes read from the source. -// -// On success, the handler should return 1. If the handler failed, -// the returned value should be 0. On EOF, the handler should set the -// size_read to 0 and return 1. -type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) - -// This structure holds information about a potential simple key. -type yaml_simple_key_t struct { - possible bool // Is a simple key possible? - required bool // Is a simple key required? - token_number int // The number of the token. - mark yaml_mark_t // The position mark. -} - -// The states of the parser. -type yaml_parser_state_t int - -const ( - yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota - - yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. - yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. - yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. - yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. - yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. - yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. - yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. - yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. - yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. - yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. - yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. - yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. - yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. - yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. - yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. - yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. - yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. - yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. - yaml_PARSE_END_STATE // Expect nothing. -) - -func (ps yaml_parser_state_t) String() string { - switch ps { - case yaml_PARSE_STREAM_START_STATE: - return "yaml_PARSE_STREAM_START_STATE" - case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: - return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" - case yaml_PARSE_DOCUMENT_START_STATE: - return "yaml_PARSE_DOCUMENT_START_STATE" - case yaml_PARSE_DOCUMENT_CONTENT_STATE: - return "yaml_PARSE_DOCUMENT_CONTENT_STATE" - case yaml_PARSE_DOCUMENT_END_STATE: - return "yaml_PARSE_DOCUMENT_END_STATE" - case yaml_PARSE_BLOCK_NODE_STATE: - return "yaml_PARSE_BLOCK_NODE_STATE" - case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: - return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" - case yaml_PARSE_FLOW_NODE_STATE: - return "yaml_PARSE_FLOW_NODE_STATE" - case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: - return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" - case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: - return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" - case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: - return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" - case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: - return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" - case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: - return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" - case yaml_PARSE_FLOW_MAPPING_KEY_STATE: - return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" - case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: - return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: - return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" - case yaml_PARSE_END_STATE: - return "yaml_PARSE_END_STATE" - } - return "" -} - -// This structure holds aliases data. -type yaml_alias_data_t struct { - anchor []byte // The anchor. - index int // The node id. - mark yaml_mark_t // The anchor mark. -} - -// The parser structure. -// -// All members are internal. Manage the structure using the -// yaml_parser_ family of functions. -type yaml_parser_t struct { - - // Error handling - - error yaml_error_type_t // Error type. - - problem string // Error description. - - // The byte about which the problem occurred. - problem_offset int - problem_value int - problem_mark yaml_mark_t - - // The error context. - context string - context_mark yaml_mark_t - - // Reader stuff - - read_handler yaml_read_handler_t // Read handler. - - input_reader io.Reader // File input data. - input []byte // String input data. - input_pos int - - eof bool // EOF flag - - buffer []byte // The working buffer. - buffer_pos int // The current position of the buffer. - - unread int // The number of unread characters in the buffer. - - newlines int // The number of line breaks since last non-break/non-blank character - - raw_buffer []byte // The raw buffer. - raw_buffer_pos int // The current position of the buffer. - - encoding yaml_encoding_t // The input encoding. - - offset int // The offset of the current position (in bytes). - mark yaml_mark_t // The mark of the current position. - - // Comments - - head_comment []byte // The current head comments - line_comment []byte // The current line comments - foot_comment []byte // The current foot comments - tail_comment []byte // Foot comment that happens at the end of a block. - stem_comment []byte // Comment in item preceding a nested structure (list inside list item, etc) - - comments []yaml_comment_t // The folded comments for all parsed tokens - comments_head int - - // Scanner stuff - - stream_start_produced bool // Have we started to scan the input stream? - stream_end_produced bool // Have we reached the end of the input stream? - - flow_level int // The number of unclosed '[' and '{' indicators. - - tokens []yaml_token_t // The tokens queue. - tokens_head int // The head of the tokens queue. - tokens_parsed int // The number of tokens fetched from the queue. - token_available bool // Does the tokens queue contain a token ready for dequeueing. - - indent int // The current indentation level. - indents []int // The indentation levels stack. - - simple_key_allowed bool // May a simple key occur at the current position? - simple_keys []yaml_simple_key_t // The stack of simple keys. - simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number - - // Parser stuff - - state yaml_parser_state_t // The current parser state. - states []yaml_parser_state_t // The parser states stack. - marks []yaml_mark_t // The stack of marks. - tag_directives []yaml_tag_directive_t // The list of TAG directives. - - // Dumper stuff - - aliases []yaml_alias_data_t // The alias data. - - document *yaml_document_t // The currently parsed document. -} - -type yaml_comment_t struct { - - scan_mark yaml_mark_t // Position where scanning for comments started - token_mark yaml_mark_t // Position after which tokens will be associated with this comment - start_mark yaml_mark_t // Position of '#' comment mark - end_mark yaml_mark_t // Position where comment terminated - - head []byte - line []byte - foot []byte -} - -// Emitter Definitions - -// The prototype of a write handler. -// -// The write handler is called when the emitter needs to flush the accumulated -// characters to the output. The handler should write @a size bytes of the -// @a buffer to the output. -// -// @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). -// @param[in] buffer The buffer with bytes to be written. -// @param[in] size The size of the buffer. -// -// @returns On success, the handler should return @c 1. If the handler failed, -// the returned value should be @c 0. -// -type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error - -type yaml_emitter_state_t int - -// The emitter states. -const ( - // Expect STREAM-START. - yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota - - yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. - yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. - yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. - yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. - yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. - yaml_EMIT_FLOW_SEQUENCE_TRAIL_ITEM_STATE // Expect the next item of a flow sequence, with the comma already written out - yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. - yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_TRAIL_KEY_STATE // Expect the next key of a flow mapping, with the comma already written out - yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. - yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. - yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. - yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. - yaml_EMIT_END_STATE // Expect nothing. -) - -// The emitter structure. -// -// All members are internal. Manage the structure using the @c yaml_emitter_ -// family of functions. -type yaml_emitter_t struct { - - // Error handling - - error yaml_error_type_t // Error type. - problem string // Error description. - - // Writer stuff - - write_handler yaml_write_handler_t // Write handler. - - output_buffer *[]byte // String output data. - output_writer io.Writer // File output data. - - buffer []byte // The working buffer. - buffer_pos int // The current position of the buffer. - - raw_buffer []byte // The raw buffer. - raw_buffer_pos int // The current position of the buffer. - - encoding yaml_encoding_t // The stream encoding. - - // Emitter stuff - - canonical bool // If the output is in the canonical style? - best_indent int // The number of indentation spaces. - best_width int // The preferred width of the output lines. - unicode bool // Allow unescaped non-ASCII characters? - line_break yaml_break_t // The preferred line break. - - state yaml_emitter_state_t // The current emitter state. - states []yaml_emitter_state_t // The stack of states. - - events []yaml_event_t // The event queue. - events_head int // The head of the event queue. - - indents []int // The stack of indentation levels. - - tag_directives []yaml_tag_directive_t // The list of tag directives. - - indent int // The current indentation level. - - flow_level int // The current flow level. - - root_context bool // Is it the document root context? - sequence_context bool // Is it a sequence context? - mapping_context bool // Is it a mapping context? - simple_key_context bool // Is it a simple mapping key context? - - line int // The current line. - column int // The current column. - whitespace bool // If the last character was a whitespace? - indention bool // If the last character was an indentation character (' ', '-', '?', ':')? - open_ended bool // If an explicit document end is required? - - space_above bool // Is there's an empty line above? - foot_indent int // The indent used to write the foot comment above, or -1 if none. - - // Anchor analysis. - anchor_data struct { - anchor []byte // The anchor value. - alias bool // Is it an alias? - } - - // Tag analysis. - tag_data struct { - handle []byte // The tag handle. - suffix []byte // The tag suffix. - } - - // Scalar analysis. - scalar_data struct { - value []byte // The scalar value. - multiline bool // Does the scalar contain line breaks? - flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? - block_plain_allowed bool // Can the scalar be expressed in the block plain style? - single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? - block_allowed bool // Can the scalar be expressed in the literal or folded styles? - style yaml_scalar_style_t // The output style. - } - - // Comments - head_comment []byte - line_comment []byte - foot_comment []byte - tail_comment []byte - - key_line_comment []byte - - // Dumper stuff - - opened bool // If the stream was already opened? - closed bool // If the stream was already closed? - - // The information associated with the document nodes. - anchors *struct { - references int // The number of references. - anchor int // The anchor id. - serialized bool // If the node has been emitted? - } - - last_anchor_id int // The last assigned anchor id. - - document *yaml_document_t // The currently emitted document. -} diff --git a/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/vendor/gopkg.in/yaml.v3/yamlprivateh.go deleted file mode 100644 index e88f9c54a..000000000 --- a/vendor/gopkg.in/yaml.v3/yamlprivateh.go +++ /dev/null @@ -1,198 +0,0 @@ -// -// Copyright (c) 2011-2019 Canonical Ltd -// Copyright (c) 2006-2010 Kirill Simonov -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -// of the Software, and to permit persons to whom the Software is furnished to do -// so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -package yaml - -const ( - // The size of the input raw buffer. - input_raw_buffer_size = 512 - - // The size of the input buffer. - // It should be possible to decode the whole raw buffer. - input_buffer_size = input_raw_buffer_size * 3 - - // The size of the output buffer. - output_buffer_size = 128 - - // The size of the output raw buffer. - // It should be possible to encode the whole output buffer. - output_raw_buffer_size = (output_buffer_size*2 + 2) - - // The size of other stacks and queues. - initial_stack_size = 16 - initial_queue_size = 16 - initial_string_size = 16 -) - -// Check if the character at the specified position is an alphabetical -// character, a digit, '_', or '-'. -func is_alpha(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' -} - -// Check if the character at the specified position is a digit. -func is_digit(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' -} - -// Get the value of a digit. -func as_digit(b []byte, i int) int { - return int(b[i]) - '0' -} - -// Check if the character at the specified position is a hex-digit. -func is_hex(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' -} - -// Get the value of a hex-digit. -func as_hex(b []byte, i int) int { - bi := b[i] - if bi >= 'A' && bi <= 'F' { - return int(bi) - 'A' + 10 - } - if bi >= 'a' && bi <= 'f' { - return int(bi) - 'a' + 10 - } - return int(bi) - '0' -} - -// Check if the character is ASCII. -func is_ascii(b []byte, i int) bool { - return b[i] <= 0x7F -} - -// Check if the character at the start of the buffer can be printed unescaped. -func is_printable(b []byte, i int) bool { - return ((b[i] == 0x0A) || // . == #x0A - (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E - (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF - (b[i] > 0xC2 && b[i] < 0xED) || - (b[i] == 0xED && b[i+1] < 0xA0) || - (b[i] == 0xEE) || - (b[i] == 0xEF && // #xE000 <= . <= #xFFFD - !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF - !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) -} - -// Check if the character at the specified position is NUL. -func is_z(b []byte, i int) bool { - return b[i] == 0x00 -} - -// Check if the beginning of the buffer is a BOM. -func is_bom(b []byte, i int) bool { - return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF -} - -// Check if the character at the specified position is space. -func is_space(b []byte, i int) bool { - return b[i] == ' ' -} - -// Check if the character at the specified position is tab. -func is_tab(b []byte, i int) bool { - return b[i] == '\t' -} - -// Check if the character at the specified position is blank (space or tab). -func is_blank(b []byte, i int) bool { - //return is_space(b, i) || is_tab(b, i) - return b[i] == ' ' || b[i] == '\t' -} - -// Check if the character at the specified position is a line break. -func is_break(b []byte, i int) bool { - return (b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) -} - -func is_crlf(b []byte, i int) bool { - return b[i] == '\r' && b[i+1] == '\n' -} - -// Check if the character is a line break or NUL. -func is_breakz(b []byte, i int) bool { - //return is_break(b, i) || is_z(b, i) - return ( - // is_break: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - // is_z: - b[i] == 0) -} - -// Check if the character is a line break, space, or NUL. -func is_spacez(b []byte, i int) bool { - //return is_space(b, i) || is_breakz(b, i) - return ( - // is_space: - b[i] == ' ' || - // is_breakz: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - b[i] == 0) -} - -// Check if the character is a line break, space, tab, or NUL. -func is_blankz(b []byte, i int) bool { - //return is_blank(b, i) || is_breakz(b, i) - return ( - // is_blank: - b[i] == ' ' || b[i] == '\t' || - // is_breakz: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - b[i] == 0) -} - -// Determine the width of the character. -func width(b byte) int { - // Don't replace these by a switch without first - // confirming that it is being inlined. - if b&0x80 == 0x00 { - return 1 - } - if b&0xE0 == 0xC0 { - return 2 - } - if b&0xF0 == 0xE0 { - return 3 - } - if b&0xF8 == 0xF0 { - return 4 - } - return 0 - -} diff --git a/vendor/modules.txt b/vendor/modules.txt deleted file mode 100644 index cb776291b..000000000 --- a/vendor/modules.txt +++ /dev/null @@ -1,584 +0,0 @@ -# bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512 -## explicit -bazil.org/fuse -bazil.org/fuse/fs -bazil.org/fuse/fuseutil -# cloud.google.com/go v0.59.0 -## explicit -cloud.google.com/go/compute/metadata -# code.gitea.io/log v0.0.0-20191208183219-f31613838113 -## explicit -# github.com/Azure/azure-pipeline-go v0.2.2 -## explicit -github.com/Azure/azure-pipeline-go/pipeline -# github.com/Azure/azure-storage-blob-go v0.10.0 -## explicit -github.com/Azure/azure-storage-blob-go/azblob -# github.com/Unknwon/goconfig v0.0.0-20191126170842-860a72fb44fd -## explicit -github.com/Unknwon/goconfig -# github.com/a8m/tree v0.0.0-20181222104329-6a0b80129de4 -## explicit -github.com/a8m/tree -# github.com/aalpar/deheap v0.0.0-20200318053559-9a0c2883bd56 -## explicit -github.com/aalpar/deheap -# github.com/abbot/go-http-auth v0.4.0 -## explicit -github.com/abbot/go-http-auth -# github.com/anacrolix/dms v1.1.0 -## explicit -github.com/anacrolix/dms/dlna -github.com/anacrolix/dms/soap -github.com/anacrolix/dms/ssdp -github.com/anacrolix/dms/upnp -# github.com/atotto/clipboard v0.1.2 -## explicit -github.com/atotto/clipboard -# github.com/aws/aws-sdk-go v1.32.11 -## explicit -github.com/aws/aws-sdk-go/aws -github.com/aws/aws-sdk-go/aws/arn -github.com/aws/aws-sdk-go/aws/awserr -github.com/aws/aws-sdk-go/aws/awsutil -github.com/aws/aws-sdk-go/aws/client -github.com/aws/aws-sdk-go/aws/client/metadata -github.com/aws/aws-sdk-go/aws/corehandlers -github.com/aws/aws-sdk-go/aws/credentials -github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds -github.com/aws/aws-sdk-go/aws/credentials/endpointcreds -github.com/aws/aws-sdk-go/aws/credentials/processcreds -github.com/aws/aws-sdk-go/aws/credentials/stscreds -github.com/aws/aws-sdk-go/aws/csm -github.com/aws/aws-sdk-go/aws/defaults -github.com/aws/aws-sdk-go/aws/ec2metadata -github.com/aws/aws-sdk-go/aws/endpoints -github.com/aws/aws-sdk-go/aws/request -github.com/aws/aws-sdk-go/aws/session -github.com/aws/aws-sdk-go/aws/signer/v4 -github.com/aws/aws-sdk-go/internal/context -github.com/aws/aws-sdk-go/internal/ini -github.com/aws/aws-sdk-go/internal/s3err -github.com/aws/aws-sdk-go/internal/sdkio -github.com/aws/aws-sdk-go/internal/sdkmath -github.com/aws/aws-sdk-go/internal/sdkrand -github.com/aws/aws-sdk-go/internal/sdkuri -github.com/aws/aws-sdk-go/internal/shareddefaults -github.com/aws/aws-sdk-go/internal/strings -github.com/aws/aws-sdk-go/internal/sync/singleflight -github.com/aws/aws-sdk-go/private/checksum -github.com/aws/aws-sdk-go/private/protocol -github.com/aws/aws-sdk-go/private/protocol/eventstream -github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi -github.com/aws/aws-sdk-go/private/protocol/json/jsonutil -github.com/aws/aws-sdk-go/private/protocol/query -github.com/aws/aws-sdk-go/private/protocol/query/queryutil -github.com/aws/aws-sdk-go/private/protocol/rest -github.com/aws/aws-sdk-go/private/protocol/restxml -github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil -github.com/aws/aws-sdk-go/service/s3 -github.com/aws/aws-sdk-go/service/s3/internal/arn -github.com/aws/aws-sdk-go/service/sts -github.com/aws/aws-sdk-go/service/sts/stsiface -# github.com/beorn7/perks v1.0.1 -github.com/beorn7/perks/quantile -# github.com/billziss-gh/cgofuse v1.3.0 -## explicit -github.com/billziss-gh/cgofuse/fuse -# github.com/btcsuite/btcutil v1.0.2 -## explicit -github.com/btcsuite/btcutil/base58 -# github.com/calebcase/tmpfile v1.0.2 -## explicit -github.com/calebcase/tmpfile -# github.com/cespare/xxhash/v2 v2.1.1 -github.com/cespare/xxhash/v2 -# github.com/coreos/go-semver v0.3.0 -## explicit -github.com/coreos/go-semver/semver -# github.com/cpuguy83/go-md2man/v2 v2.0.0 -github.com/cpuguy83/go-md2man/v2/md2man -# github.com/davecgh/go-spew v1.1.1 -github.com/davecgh/go-spew/spew -# github.com/djherbis/times v1.2.0 -## explicit -# github.com/dropbox/dropbox-sdk-go-unofficial v5.6.0+incompatible -## explicit -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users -github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common -# github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813 -## explicit -# github.com/elazarl/go-bindata-assetfs v1.0.0 -## explicit -# github.com/gogo/protobuf v1.3.1 -## explicit -github.com/gogo/protobuf/proto -# github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e -github.com/golang/groupcache/lru -# github.com/golang/protobuf v1.4.2 -github.com/golang/protobuf/proto -github.com/golang/protobuf/ptypes -github.com/golang/protobuf/ptypes/any -github.com/golang/protobuf/ptypes/duration -github.com/golang/protobuf/ptypes/timestamp -# github.com/google/go-querystring v1.0.0 -## explicit -github.com/google/go-querystring/query -# github.com/google/uuid v1.1.1 -github.com/google/uuid -# github.com/googleapis/gax-go/v2 v2.0.5 -github.com/googleapis/gax-go/v2 -# github.com/hanwen/go-fuse/v2 v2.0.3 -## explicit -github.com/hanwen/go-fuse/v2/fs -github.com/hanwen/go-fuse/v2/fuse -github.com/hanwen/go-fuse/v2/internal -github.com/hanwen/go-fuse/v2/internal/utimens -github.com/hanwen/go-fuse/v2/splice -# github.com/inconshreveable/mousetrap v1.0.0 -github.com/inconshreveable/mousetrap -# github.com/jlaffaye/ftp v0.0.0-20200602180915-5563613968bf -## explicit -github.com/jlaffaye/ftp -# github.com/jmespath/go-jmespath v0.3.0 -github.com/jmespath/go-jmespath -# github.com/json-iterator/go v1.1.10 -github.com/json-iterator/go -# github.com/jzelinskie/whirlpool v0.0.0-20170603002051-c19460b8caa6 -## explicit -github.com/jzelinskie/whirlpool -# github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 -## explicit -github.com/kardianos/osext -# github.com/klauspost/cpuid v1.3.0 -## explicit -github.com/klauspost/cpuid -# github.com/konsorten/go-windows-terminal-sequences v1.0.3 -github.com/konsorten/go-windows-terminal-sequences -# github.com/koofr/go-httpclient v0.0.0-20200420163713-93aa7c75b348 -## explicit -github.com/koofr/go-httpclient -# github.com/koofr/go-koofrclient v0.0.0-20190724113126-8e5366da203a -## explicit -github.com/koofr/go-koofrclient -# github.com/kr/fs v0.1.0 -github.com/kr/fs -# github.com/mattn/go-colorable v0.1.7 -## explicit -github.com/mattn/go-colorable -# github.com/mattn/go-ieproxy v0.0.1 -## explicit -github.com/mattn/go-ieproxy -# github.com/mattn/go-isatty v0.0.12 -github.com/mattn/go-isatty -# github.com/mattn/go-runewidth v0.0.9 -## explicit -github.com/mattn/go-runewidth -# github.com/matttproud/golang_protobuf_extensions v1.0.1 -github.com/matttproud/golang_protobuf_extensions/pbutil -# github.com/minio/md5-simd v1.1.0 -github.com/minio/md5-simd -# github.com/minio/minio-go/v6 v6.0.57 -## explicit -github.com/minio/minio-go/v6 -github.com/minio/minio-go/v6/pkg/credentials -github.com/minio/minio-go/v6/pkg/encrypt -github.com/minio/minio-go/v6/pkg/s3utils -github.com/minio/minio-go/v6/pkg/set -github.com/minio/minio-go/v6/pkg/signer -github.com/minio/minio-go/v6/pkg/tags -# github.com/minio/sha256-simd v0.1.1 -github.com/minio/sha256-simd -# github.com/mitchellh/go-homedir v1.1.0 -## explicit -github.com/mitchellh/go-homedir -# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd -github.com/modern-go/concurrent -# github.com/modern-go/reflect2 v1.0.1 -github.com/modern-go/reflect2 -# github.com/ncw/go-acd v0.0.0-20171120105400-887eb06ab6a2 -## explicit -github.com/ncw/go-acd -# github.com/ncw/swift v1.0.52 -## explicit -github.com/ncw/swift -# github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 -## explicit -github.com/nsf/termbox-go -# github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd -## explicit -github.com/okzk/sdnotify -# github.com/patrickmn/go-cache v2.1.0+incompatible -## explicit -github.com/patrickmn/go-cache -# github.com/pengsrc/go-shared v0.2.1-0.20190131101655-1999055a4a14 -github.com/pengsrc/go-shared/buffer -github.com/pengsrc/go-shared/check -github.com/pengsrc/go-shared/convert -github.com/pengsrc/go-shared/log -github.com/pengsrc/go-shared/reopen -# github.com/pkg/errors v0.9.1 -## explicit -github.com/pkg/errors -# github.com/pkg/sftp v1.11.0 -## explicit -github.com/pkg/sftp -# github.com/pmezard/go-difflib v1.0.0 -github.com/pmezard/go-difflib/difflib -# github.com/prometheus/client_golang v1.7.1 -## explicit -github.com/prometheus/client_golang/prometheus -github.com/prometheus/client_golang/prometheus/internal -github.com/prometheus/client_golang/prometheus/promhttp -# github.com/prometheus/client_model v0.2.0 -github.com/prometheus/client_model/go -# github.com/prometheus/common v0.10.0 -github.com/prometheus/common/expfmt -github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg -github.com/prometheus/common/model -# github.com/prometheus/procfs v0.1.3 -github.com/prometheus/procfs -github.com/prometheus/procfs/internal/fs -github.com/prometheus/procfs/internal/util -# github.com/putdotio/go-putio/putio v0.0.0-20200123120452-16d982cac2b8 -## explicit -github.com/putdotio/go-putio/putio -# github.com/rfjakob/eme v1.1.1 -## explicit -github.com/rfjakob/eme -# github.com/russross/blackfriday/v2 v2.0.1 -github.com/russross/blackfriday/v2 -# github.com/sevlyar/go-daemon v0.1.5 -## explicit -github.com/sevlyar/go-daemon -# github.com/shurcooL/sanitized_anchor_name v1.0.0 -github.com/shurcooL/sanitized_anchor_name -# github.com/sirupsen/logrus v1.6.0 -## explicit -github.com/sirupsen/logrus -# github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 -## explicit -github.com/skratchdot/open-golang/open -# github.com/spacemonkeygo/monkit/v3 v3.0.7-0.20200515175308-072401d8c752 -github.com/spacemonkeygo/monkit/v3 -github.com/spacemonkeygo/monkit/v3/monotime -# github.com/spf13/cobra v1.0.0 -## explicit -github.com/spf13/cobra -github.com/spf13/cobra/doc -# github.com/spf13/pflag v1.0.5 -## explicit -github.com/spf13/pflag -# github.com/stephens2424/writerset v1.0.2 -## explicit -# github.com/stretchr/testify v1.6.1 -## explicit -github.com/stretchr/testify/assert -github.com/stretchr/testify/require -# github.com/t3rm1n4l/go-mega v0.0.0-20200416171014-ffad7fcb44b8 -## explicit -github.com/t3rm1n4l/go-mega -# github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3 -github.com/vivint/infectious -# github.com/xanzy/ssh-agent v0.2.1 -## explicit -github.com/xanzy/ssh-agent -# github.com/youmark/pkcs8 v0.0.0-20200520070018-fad002e585ce -## explicit -github.com/youmark/pkcs8 -# github.com/yunify/qingstor-sdk-go/v3 v3.2.0 -## explicit -github.com/yunify/qingstor-sdk-go/v3 -github.com/yunify/qingstor-sdk-go/v3/config -github.com/yunify/qingstor-sdk-go/v3/logger -github.com/yunify/qingstor-sdk-go/v3/request -github.com/yunify/qingstor-sdk-go/v3/request/builder -github.com/yunify/qingstor-sdk-go/v3/request/data -github.com/yunify/qingstor-sdk-go/v3/request/errors -github.com/yunify/qingstor-sdk-go/v3/request/signer -github.com/yunify/qingstor-sdk-go/v3/request/unpacker -github.com/yunify/qingstor-sdk-go/v3/service -github.com/yunify/qingstor-sdk-go/v3/utils -# github.com/zeebo/errs v1.2.2 -github.com/zeebo/errs -# go.etcd.io/bbolt v1.3.5 -## explicit -go.etcd.io/bbolt -# go.opencensus.io v0.22.4 -## explicit -go.opencensus.io -go.opencensus.io/internal -go.opencensus.io/internal/tagencoding -go.opencensus.io/metric/metricdata -go.opencensus.io/metric/metricproducer -go.opencensus.io/plugin/ochttp -go.opencensus.io/plugin/ochttp/propagation/b3 -go.opencensus.io/resource -go.opencensus.io/stats -go.opencensus.io/stats/internal -go.opencensus.io/stats/view -go.opencensus.io/tag -go.opencensus.io/trace -go.opencensus.io/trace/internal -go.opencensus.io/trace/propagation -go.opencensus.io/trace/tracestate -# go.uber.org/atomic v1.6.0 -go.uber.org/atomic -# go.uber.org/multierr v1.5.0 -go.uber.org/multierr -# go.uber.org/zap v1.15.0 -## explicit -go.uber.org/zap -go.uber.org/zap/buffer -go.uber.org/zap/internal/bufferpool -go.uber.org/zap/internal/color -go.uber.org/zap/internal/exit -go.uber.org/zap/zapcore -# goftp.io/server v0.3.5-0.20200630051340-d7b447417587 -## explicit -goftp.io/server -# golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 -## explicit -golang.org/x/crypto/argon2 -golang.org/x/crypto/bcrypt -golang.org/x/crypto/blake2b -golang.org/x/crypto/blowfish -golang.org/x/crypto/chacha20 -golang.org/x/crypto/curve25519 -golang.org/x/crypto/ed25519 -golang.org/x/crypto/ed25519/internal/edwards25519 -golang.org/x/crypto/internal/subtle -golang.org/x/crypto/nacl/secretbox -golang.org/x/crypto/pbkdf2 -golang.org/x/crypto/poly1305 -golang.org/x/crypto/salsa20/salsa -golang.org/x/crypto/scrypt -golang.org/x/crypto/ssh -golang.org/x/crypto/ssh/agent -golang.org/x/crypto/ssh/internal/bcrypt_pbkdf -golang.org/x/crypto/ssh/terminal -# golang.org/x/net v0.0.0-20200625001655-4c5254603344 -## explicit -golang.org/x/net/bpf -golang.org/x/net/context -golang.org/x/net/context/ctxhttp -golang.org/x/net/html -golang.org/x/net/html/atom -golang.org/x/net/http/httpguts -golang.org/x/net/http/httpproxy -golang.org/x/net/http2 -golang.org/x/net/http2/hpack -golang.org/x/net/idna -golang.org/x/net/internal/iana -golang.org/x/net/internal/socket -golang.org/x/net/internal/timeseries -golang.org/x/net/ipv4 -golang.org/x/net/publicsuffix -golang.org/x/net/trace -golang.org/x/net/webdav -golang.org/x/net/webdav/internal/xml -golang.org/x/net/websocket -# golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d -## explicit -golang.org/x/oauth2 -golang.org/x/oauth2/google -golang.org/x/oauth2/internal -golang.org/x/oauth2/jws -golang.org/x/oauth2/jwt -# golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 -## explicit -golang.org/x/sync/errgroup -golang.org/x/sync/semaphore -# golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae -## explicit -golang.org/x/sys/cpu -golang.org/x/sys/internal/unsafeheader -golang.org/x/sys/unix -golang.org/x/sys/windows -golang.org/x/sys/windows/registry -# golang.org/x/text v0.3.3 -## explicit -golang.org/x/text/secure/bidirule -golang.org/x/text/transform -golang.org/x/text/unicode/bidi -golang.org/x/text/unicode/norm -# golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 -## explicit -golang.org/x/time/rate -# google.golang.org/api v0.28.0 -## explicit -google.golang.org/api/drive/v2 -google.golang.org/api/drive/v3 -google.golang.org/api/googleapi -google.golang.org/api/googleapi/transport -google.golang.org/api/internal -google.golang.org/api/internal/gensupport -google.golang.org/api/internal/third_party/uritemplates -google.golang.org/api/option -google.golang.org/api/option/internaloption -google.golang.org/api/storage/v1 -google.golang.org/api/transport/cert -google.golang.org/api/transport/http -google.golang.org/api/transport/http/internal/propagation -# google.golang.org/appengine v1.6.6 -google.golang.org/appengine -google.golang.org/appengine/internal -google.golang.org/appengine/internal/app_identity -google.golang.org/appengine/internal/base -google.golang.org/appengine/internal/datastore -google.golang.org/appengine/internal/log -google.golang.org/appengine/internal/modules -google.golang.org/appengine/internal/remote_api -google.golang.org/appengine/internal/urlfetch -google.golang.org/appengine/urlfetch -# google.golang.org/genproto v0.0.0-20200626011028-ee7919e894b5 -## explicit -google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.30.0 -## explicit -google.golang.org/grpc -google.golang.org/grpc/attributes -google.golang.org/grpc/backoff -google.golang.org/grpc/balancer -google.golang.org/grpc/balancer/base -google.golang.org/grpc/balancer/grpclb/state -google.golang.org/grpc/balancer/roundrobin -google.golang.org/grpc/binarylog/grpc_binarylog_v1 -google.golang.org/grpc/codes -google.golang.org/grpc/connectivity -google.golang.org/grpc/credentials -google.golang.org/grpc/credentials/internal -google.golang.org/grpc/encoding -google.golang.org/grpc/encoding/proto -google.golang.org/grpc/grpclog -google.golang.org/grpc/internal -google.golang.org/grpc/internal/backoff -google.golang.org/grpc/internal/balancerload -google.golang.org/grpc/internal/binarylog -google.golang.org/grpc/internal/buffer -google.golang.org/grpc/internal/channelz -google.golang.org/grpc/internal/envconfig -google.golang.org/grpc/internal/grpclog -google.golang.org/grpc/internal/grpcrand -google.golang.org/grpc/internal/grpcsync -google.golang.org/grpc/internal/grpcutil -google.golang.org/grpc/internal/resolver/dns -google.golang.org/grpc/internal/resolver/passthrough -google.golang.org/grpc/internal/serviceconfig -google.golang.org/grpc/internal/status -google.golang.org/grpc/internal/syscall -google.golang.org/grpc/internal/transport -google.golang.org/grpc/keepalive -google.golang.org/grpc/metadata -google.golang.org/grpc/peer -google.golang.org/grpc/resolver -google.golang.org/grpc/serviceconfig -google.golang.org/grpc/stats -google.golang.org/grpc/status -google.golang.org/grpc/tap -# google.golang.org/protobuf v1.25.0 -## explicit -google.golang.org/protobuf/encoding/prototext -google.golang.org/protobuf/encoding/protowire -google.golang.org/protobuf/internal/descfmt -google.golang.org/protobuf/internal/descopts -google.golang.org/protobuf/internal/detrand -google.golang.org/protobuf/internal/encoding/defval -google.golang.org/protobuf/internal/encoding/messageset -google.golang.org/protobuf/internal/encoding/tag -google.golang.org/protobuf/internal/encoding/text -google.golang.org/protobuf/internal/errors -google.golang.org/protobuf/internal/fieldsort -google.golang.org/protobuf/internal/filedesc -google.golang.org/protobuf/internal/filetype -google.golang.org/protobuf/internal/flags -google.golang.org/protobuf/internal/genid -google.golang.org/protobuf/internal/impl -google.golang.org/protobuf/internal/mapsort -google.golang.org/protobuf/internal/pragma -google.golang.org/protobuf/internal/set -google.golang.org/protobuf/internal/strs -google.golang.org/protobuf/internal/version -google.golang.org/protobuf/proto -google.golang.org/protobuf/reflect/protoreflect -google.golang.org/protobuf/reflect/protoregistry -google.golang.org/protobuf/runtime/protoiface -google.golang.org/protobuf/runtime/protoimpl -google.golang.org/protobuf/types/known/anypb -google.golang.org/protobuf/types/known/durationpb -google.golang.org/protobuf/types/known/timestamppb -# gopkg.in/ini.v1 v1.57.0 -## explicit -gopkg.in/ini.v1 -# gopkg.in/src-d/go-git.v4 v4.13.1 -## explicit -# gopkg.in/yaml.v2 v2.3.0 -## explicit -gopkg.in/yaml.v2 -# gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 -## explicit -gopkg.in/yaml.v3 -# storj.io/common v0.0.0-20200624215549-bf610d22d466 -## explicit -storj.io/common/encryption -storj.io/common/errs2 -storj.io/common/fpath -storj.io/common/identity -storj.io/common/macaroon -storj.io/common/memory -storj.io/common/netutil -storj.io/common/paths -storj.io/common/pb -storj.io/common/peertls -storj.io/common/peertls/extensions -storj.io/common/peertls/tlsopts -storj.io/common/pkcrypto -storj.io/common/ranger -storj.io/common/readcloser -storj.io/common/rpc -storj.io/common/rpc/rpcpeer -storj.io/common/rpc/rpcpool -storj.io/common/rpc/rpcstatus -storj.io/common/rpc/rpctracing -storj.io/common/signing -storj.io/common/storj -storj.io/common/sync2 -storj.io/common/uuid -# storj.io/drpc v0.0.13 -storj.io/drpc -storj.io/drpc/drpccache -storj.io/drpc/drpcconn -storj.io/drpc/drpcctx -storj.io/drpc/drpcdebug -storj.io/drpc/drpcerr -storj.io/drpc/drpcmanager -storj.io/drpc/drpcmetadata -storj.io/drpc/drpcmetadata/invoke -storj.io/drpc/drpcmux -storj.io/drpc/drpcsignal -storj.io/drpc/drpcstream -storj.io/drpc/drpcwire -# storj.io/uplink v1.1.2 -## explicit -storj.io/uplink -storj.io/uplink/internal/expose -storj.io/uplink/internal/telemetryclient -storj.io/uplink/private/ecclient -storj.io/uplink/private/eestream -storj.io/uplink/private/metainfo -storj.io/uplink/private/piecestore -storj.io/uplink/private/storage/segments -storj.io/uplink/private/storage/streams -storj.io/uplink/private/stream -storj.io/uplink/private/testuplink diff --git a/vendor/storj.io/common/LICENSE b/vendor/storj.io/common/LICENSE deleted file mode 100644 index 8d869750c..000000000 --- a/vendor/storj.io/common/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Storj Labs, Inc. - -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/storj.io/common/encryption/aesgcm.go b/vendor/storj.io/common/encryption/aesgcm.go deleted file mode 100644 index 74e3d029d..000000000 --- a/vendor/storj.io/common/encryption/aesgcm.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "crypto/aes" - "crypto/cipher" - - "storj.io/common/storj" -) - -type aesgcmEncrypter struct { - blockSize int - key *storj.Key - startingNonce *AESGCMNonce - overhead int - aesgcm cipher.AEAD -} - -// NewAESGCMEncrypter returns a Transformer that encrypts the data passing -// through with key. -// -// startingNonce is treated as a big-endian encoded unsigned -// integer, and as blocks pass through, their block number and the starting -// nonce is added together to come up with that block's nonce. Encrypting -// different data with the same key and the same nonce is a huge security -// issue. It's safe to always encode new data with a random key and random -// startingNonce. The monotonically-increasing nonce (that rolls over) is to -// protect against data reordering. -// -// When in doubt, generate a new key from crypto/rand and a startingNonce -// from crypto/rand as often as possible. -func NewAESGCMEncrypter(key *storj.Key, startingNonce *AESGCMNonce, encryptedBlockSize int) (Transformer, error) { - block, err := aes.NewCipher(key[:]) - if err != nil { - return nil, Error.Wrap(err) - } - aesgcmEncrypt, err := cipher.NewGCM(block) - if err != nil { - return nil, Error.Wrap(err) - } - if encryptedBlockSize <= aesgcmEncrypt.Overhead() { - return nil, ErrInvalidConfig.New("encrypted block size %d too small", encryptedBlockSize) - } - return &aesgcmEncrypter{ - blockSize: encryptedBlockSize - aesgcmEncrypt.Overhead(), - key: key, - startingNonce: startingNonce, - overhead: aesgcmEncrypt.Overhead(), - aesgcm: aesgcmEncrypt, - }, nil -} - -func (s *aesgcmEncrypter) InBlockSize() int { - return s.blockSize -} - -func (s *aesgcmEncrypter) OutBlockSize() int { - return s.blockSize + s.overhead -} - -func calcGCMNonce(startingNonce *AESGCMNonce, blockNum int64) (rv [12]byte, err error) { - if copy(rv[:], (*startingNonce)[:]) != len(rv) { - return rv, Error.New("didn't copy memory?!") - } - _, err = incrementBytes(rv[:], blockNum) - return rv, err -} - -func (s *aesgcmEncrypter) Transform(out, in []byte, blockNum int64) ([]byte, error) { - nonce, err := calcGCMNonce(s.startingNonce, blockNum) - if err != nil { - return nil, err - } - - cipherData := s.aesgcm.Seal(out, nonce[:], in, nil) - return cipherData, nil -} - -type aesgcmDecrypter struct { - blockSize int - key *storj.Key - startingNonce *AESGCMNonce - overhead int - aesgcm cipher.AEAD -} - -// NewAESGCMDecrypter returns a Transformer that decrypts the data passing -// through with key. See the comments for NewAESGCMEncrypter about -// startingNonce. -func NewAESGCMDecrypter(key *storj.Key, startingNonce *AESGCMNonce, encryptedBlockSize int) (Transformer, error) { - block, err := aes.NewCipher(key[:]) - if err != nil { - return nil, Error.Wrap(err) - } - aesgcmDecrypt, err := cipher.NewGCM(block) - if err != nil { - return nil, Error.Wrap(err) - } - if encryptedBlockSize <= aesgcmDecrypt.Overhead() { - return nil, ErrInvalidConfig.New("encrypted block size %d too small", encryptedBlockSize) - } - return &aesgcmDecrypter{ - blockSize: encryptedBlockSize - aesgcmDecrypt.Overhead(), - key: key, - startingNonce: startingNonce, - overhead: aesgcmDecrypt.Overhead(), - aesgcm: aesgcmDecrypt, - }, nil -} -func (s *aesgcmDecrypter) InBlockSize() int { - return s.blockSize + s.overhead -} - -func (s *aesgcmDecrypter) OutBlockSize() int { - return s.blockSize -} - -func (s *aesgcmDecrypter) Transform(out, in []byte, blockNum int64) ([]byte, error) { - nonce, err := calcGCMNonce(s.startingNonce, blockNum) - if err != nil { - return nil, err - } - - plainData, err := s.aesgcm.Open(out, nonce[:], in, nil) - if err != nil { - return nil, ErrDecryptFailed.Wrap(err) - } - return plainData, nil -} - -// EncryptAESGCM encrypts byte data with a key and nonce. It returns the cipher data. -func EncryptAESGCM(data []byte, key *storj.Key, nonce *AESGCMNonce) (cipherData []byte, err error) { - block, err := aes.NewCipher(key[:]) - if err != nil { - return []byte{}, Error.Wrap(err) - } - aesgcm, err := cipher.NewGCM(block) - if err != nil { - return []byte{}, Error.Wrap(err) - } - cipherData = aesgcm.Seal(nil, nonce[:], data, nil) - return cipherData, nil -} - -// DecryptAESGCM decrypts byte data with a key and nonce. It returns the plain data. -func DecryptAESGCM(cipherData []byte, key *storj.Key, nonce *AESGCMNonce) (data []byte, err error) { - if len(cipherData) == 0 { - return []byte{}, Error.New("empty cipher data") - } - block, err := aes.NewCipher(key[:]) - if err != nil { - return []byte{}, Error.Wrap(err) - } - aesgcm, err := cipher.NewGCM(block) - if err != nil { - return []byte{}, Error.Wrap(err) - } - plainData, err := aesgcm.Open(nil, nonce[:], cipherData, nil) - if err != nil { - return []byte{}, ErrDecryptFailed.Wrap(err) - } - return plainData, nil -} diff --git a/vendor/storj.io/common/encryption/bits.go b/vendor/storj.io/common/encryption/bits.go deleted file mode 100644 index 7a1472542..000000000 --- a/vendor/storj.io/common/encryption/bits.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -// incrementBytes takes a byte slice buf and treats it like a little-endian -// encoded unsigned integer. it adds amount to it (which must be nonnegative) -// in place. if rollover happens (the most significant bytes don't fit -// anymore), truncated is true. -func incrementBytes(buf []byte, amount int64) (truncated bool, err error) { - if amount < 0 { - return false, Error.New("amount was negative") - } - - idx := 0 - for amount > 0 && idx < len(buf) { - var inc, prev byte - inc, amount = byte(amount), amount>>8 - - prev = buf[idx] - buf[idx] += inc - if buf[idx] < prev { - amount++ - } - - idx++ - } - - return amount != 0, nil -} diff --git a/vendor/storj.io/common/encryption/common.go b/vendor/storj.io/common/encryption/common.go deleted file mode 100644 index 3aa90bb7b..000000000 --- a/vendor/storj.io/common/encryption/common.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package encryption collects common cryptographic primitives needed for path and data encryption. -package encryption - -import ( - "github.com/zeebo/errs" -) - -// Error is the default encryption errs class. -var Error = errs.Class("encryption error") - -// ErrDecryptFailed is the errs class when the decryption fails. -var ErrDecryptFailed = errs.Class("decryption failed, check encryption key") - -// ErrInvalidConfig is the errs class for invalid configuration. -var ErrInvalidConfig = errs.Class("invalid encryption configuration") diff --git a/vendor/storj.io/common/encryption/encryption.go b/vendor/storj.io/common/encryption/encryption.go deleted file mode 100644 index 4fdf8e344..000000000 --- a/vendor/storj.io/common/encryption/encryption.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "crypto/hmac" - "crypto/sha512" - - "storj.io/common/storj" -) - -const ( - // AESGCMNonceSize is the size of an AES-GCM nonce. - AESGCMNonceSize = 12 - // unit32Size is the number of bytes in the uint32 type. - uint32Size = 4 -) - -// AESGCMNonce represents the nonce used by the AES-GCM protocol. -type AESGCMNonce [AESGCMNonceSize]byte - -// ToAESGCMNonce returns the nonce as a AES-GCM nonce. -func ToAESGCMNonce(nonce *storj.Nonce) *AESGCMNonce { - aes := new(AESGCMNonce) - copy((*aes)[:], nonce[:AESGCMNonceSize]) - return aes -} - -// Increment increments the nonce with the given amount. -func Increment(nonce *storj.Nonce, amount int64) (truncated bool, err error) { - return incrementBytes(nonce[:], amount) -} - -// Encrypt encrypts data with the given cipher, key and nonce. -func Encrypt(data []byte, cipher storj.CipherSuite, key *storj.Key, nonce *storj.Nonce) (cipherData []byte, err error) { - // Don't encrypt empty slice - if len(data) == 0 { - return []byte{}, nil - } - - switch cipher { - case storj.EncNull: - return data, nil - case storj.EncAESGCM: - return EncryptAESGCM(data, key, ToAESGCMNonce(nonce)) - case storj.EncSecretBox: - return EncryptSecretBox(data, key, nonce) - case storj.EncNullBase64URL: - return nil, ErrInvalidConfig.New("base64 encoding not supported for this operation") - default: - return nil, ErrInvalidConfig.New("encryption type %d is not supported", cipher) - } -} - -// Decrypt decrypts cipherData with the given cipher, key and nonce. -func Decrypt(cipherData []byte, cipher storj.CipherSuite, key *storj.Key, nonce *storj.Nonce) (data []byte, err error) { - // Don't decrypt empty slice - if len(cipherData) == 0 { - return []byte{}, nil - } - - switch cipher { - case storj.EncNull: - return cipherData, nil - case storj.EncAESGCM: - return DecryptAESGCM(cipherData, key, ToAESGCMNonce(nonce)) - case storj.EncSecretBox: - return DecryptSecretBox(cipherData, key, nonce) - case storj.EncNullBase64URL: - return nil, ErrInvalidConfig.New("base64 encoding not supported for this operation") - default: - return nil, ErrInvalidConfig.New("encryption type %d is not supported", cipher) - } -} - -// NewEncrypter creates a Transformer using the given cipher, key and nonce to encrypt data passing through it. -func NewEncrypter(cipher storj.CipherSuite, key *storj.Key, startingNonce *storj.Nonce, encryptedBlockSize int) (Transformer, error) { - switch cipher { - case storj.EncNull: - return &NoopTransformer{}, nil - case storj.EncAESGCM: - return NewAESGCMEncrypter(key, ToAESGCMNonce(startingNonce), encryptedBlockSize) - case storj.EncSecretBox: - return NewSecretboxEncrypter(key, startingNonce, encryptedBlockSize) - case storj.EncNullBase64URL: - return nil, ErrInvalidConfig.New("base64 encoding not supported for this operation") - default: - return nil, ErrInvalidConfig.New("encryption type %d is not supported", cipher) - } -} - -// NewDecrypter creates a Transformer using the given cipher, key and nonce to decrypt data passing through it. -func NewDecrypter(cipher storj.CipherSuite, key *storj.Key, startingNonce *storj.Nonce, encryptedBlockSize int) (Transformer, error) { - switch cipher { - case storj.EncNull: - return &NoopTransformer{}, nil - case storj.EncAESGCM: - return NewAESGCMDecrypter(key, ToAESGCMNonce(startingNonce), encryptedBlockSize) - case storj.EncSecretBox: - return NewSecretboxDecrypter(key, startingNonce, encryptedBlockSize) - case storj.EncNullBase64URL: - return nil, ErrInvalidConfig.New("base64 encoding not supported for this operation") - default: - return nil, ErrInvalidConfig.New("encryption type %d is not supported", cipher) - } -} - -// EncryptKey encrypts keyToEncrypt with the given cipher, key and nonce. -func EncryptKey(keyToEncrypt *storj.Key, cipher storj.CipherSuite, key *storj.Key, nonce *storj.Nonce) (storj.EncryptedPrivateKey, error) { - return Encrypt(keyToEncrypt[:], cipher, key, nonce) -} - -// DecryptKey decrypts keyToDecrypt with the given cipher, key and nonce. -func DecryptKey(keyToDecrypt storj.EncryptedPrivateKey, cipher storj.CipherSuite, key *storj.Key, nonce *storj.Nonce) (*storj.Key, error) { - plainData, err := Decrypt(keyToDecrypt, cipher, key, nonce) - if err != nil { - return nil, err - } - - var decryptedKey storj.Key - copy(decryptedKey[:], plainData) - - return &decryptedKey, nil -} - -// DeriveKey derives new key from the given key and message using HMAC-SHA512. -func DeriveKey(key *storj.Key, message string) (*storj.Key, error) { - mac := hmac.New(sha512.New, key[:]) - _, err := mac.Write([]byte(message)) - if err != nil { - return nil, Error.Wrap(err) - } - - derived := new(storj.Key) - copy(derived[:], mac.Sum(nil)) - - return derived, nil -} - -// CalcEncryptedSize calculates what would be the size of the cipher data after -// encrypting data with dataSize using a Transformer with the given encryption -// parameters. -func CalcEncryptedSize(dataSize int64, parameters storj.EncryptionParameters) (int64, error) { - transformer, err := NewEncrypter(parameters.CipherSuite, new(storj.Key), new(storj.Nonce), int(parameters.BlockSize)) - if err != nil { - return 0, err - } - - inBlockSize := int64(transformer.InBlockSize()) - blocks := (dataSize + uint32Size + inBlockSize - 1) / inBlockSize - - encryptedSize := blocks * int64(transformer.OutBlockSize()) - - return encryptedSize, nil -} diff --git a/vendor/storj.io/common/encryption/pad.go b/vendor/storj.io/common/encryption/pad.go deleted file mode 100644 index ff3468239..000000000 --- a/vendor/storj.io/common/encryption/pad.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "io/ioutil" - - "storj.io/common/ranger" - "storj.io/common/readcloser" -) - -// makePadding calculates how many bytes of padding are needed to fill -// an encryption block then creates a slice of zero bytes that size. -// The last byte of the padding slice contains the count of the total padding bytes added. -func makePadding(dataLen int64, blockSize int) []byte { - amount := dataLen + uint32Size - r := amount % int64(blockSize) - padding := uint32Size - if r > 0 { - padding += blockSize - int(r) - } - paddingBytes := bytes.Repeat([]byte{0}, padding) - binary.BigEndian.PutUint32(paddingBytes[padding-uint32Size:], uint32(padding)) - return paddingBytes -} - -// Pad takes a Ranger and returns another Ranger that is a multiple of -// blockSize in length. The return value padding is a convenience to report how -// much padding was added. -func Pad(data ranger.Ranger, blockSize int) ( - rr ranger.Ranger, padding int) { - paddingBytes := makePadding(data.Size(), blockSize) - return ranger.Concat(data, ranger.ByteRanger(paddingBytes)), len(paddingBytes) -} - -// Unpad takes a previously padded Ranger data source and returns an unpadded -// ranger, given the amount of padding. This is preferable to UnpadSlow if you -// can swing it. -func Unpad(data ranger.Ranger, padding int) (ranger.Ranger, error) { - return ranger.Subrange(data, 0, data.Size()-int64(padding)) -} - -// UnpadSlow is like Unpad, but does not require the amount of padding. -// UnpadSlow will have to do extra work to make up for this missing information. -func UnpadSlow(ctx context.Context, data ranger.Ranger) (_ ranger.Ranger, err error) { - r, err := data.Range(ctx, data.Size()-uint32Size, uint32Size) - if err != nil { - return nil, Error.Wrap(err) - } - var p [uint32Size]byte - _, err = io.ReadFull(r, p[:]) - if err != nil { - return nil, Error.Wrap(err) - } - return Unpad(data, int(binary.BigEndian.Uint32(p[:]))) -} - -// PadReader is like Pad but works on a basic Reader instead of a Ranger. -func PadReader(data io.ReadCloser, blockSize int) io.ReadCloser { - cr := newCountingReader(data) - return readcloser.MultiReadCloser(cr, - readcloser.LazyReadCloser(func() (io.ReadCloser, error) { - return ioutil.NopCloser(bytes.NewReader(makePadding(cr.N, blockSize))), nil - })) -} - -type countingReader struct { - R io.ReadCloser - N int64 -} - -func newCountingReader(r io.ReadCloser) *countingReader { - return &countingReader{R: r} -} - -func (cr *countingReader) Read(p []byte) (n int, err error) { - n, err = cr.R.Read(p) - cr.N += int64(n) - return n, err -} - -func (cr *countingReader) Close() error { - return cr.R.Close() -} diff --git a/vendor/storj.io/common/encryption/password.go b/vendor/storj.io/common/encryption/password.go deleted file mode 100644 index f87ea99f2..000000000 --- a/vendor/storj.io/common/encryption/password.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "crypto/hmac" - "crypto/sha256" - - "github.com/zeebo/errs" - "golang.org/x/crypto/argon2" - - "storj.io/common/memory" - "storj.io/common/storj" -) - -func sha256hmac(key, data []byte) ([]byte, error) { - h := hmac.New(sha256.New, key) - if _, err := h.Write(data); err != nil { - return nil, err - } - return h.Sum(nil), nil -} - -// DeriveRootKey derives a root key for some path using the salt for the bucket and -// a password from the user. See the password key derivation design doc. -func DeriveRootKey(password, salt []byte, path storj.Path, argon2Threads uint8) (*storj.Key, error) { - mixedSalt, err := sha256hmac(password, salt) - if err != nil { - return nil, err - } - - pathSalt, err := sha256hmac(mixedSalt, []byte(path)) - if err != nil { - return nil, err - } - - // use a time of 1, 64MB of ram, and all of the cores. - keyData := argon2.IDKey(password, pathSalt, 1, uint32(64*memory.MiB/memory.KiB), argon2Threads, 32) - if len(keyData) != len(storj.Key{}) { - return nil, errs.New("invalid output from argon2id") - } - - var key storj.Key - copy(key[:], keyData) - return &key, nil -} diff --git a/vendor/storj.io/common/encryption/path.go b/vendor/storj.io/common/encryption/path.go deleted file mode 100644 index 8a176b352..000000000 --- a/vendor/storj.io/common/encryption/path.go +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "crypto/hmac" - "crypto/sha512" - "encoding/base64" - "strings" - - "github.com/zeebo/errs" - - "storj.io/common/paths" - "storj.io/common/storj" -) - -var ( - emptyComponentPrefix = byte('\x01') - notEmptyComponentPrefix = byte('\x02') - emptyComponent = []byte{emptyComponentPrefix} - - escapeSlash = byte('\x2e') - escapeFF = byte('\xfe') - escape01 = byte('\x01') -) - -// EncryptPathWithStoreCipher encrypts the path looking up keys and the cipher from the -// provided store and bucket. -func EncryptPathWithStoreCipher(bucket string, path paths.Unencrypted, store *Store) ( - encPath paths.Encrypted, err error) { - - return encryptPath(bucket, path, nil, store) -} - -// EncryptPrefixWithStoreCipher encrypts the prefix using the provided cipher and looking up keys from the -// provided store and bucket. Because it is a prefix, it does not assume there is an empty component -// at the end of a path like "foo/bar/". -func EncryptPrefixWithStoreCipher(bucket string, path paths.Unencrypted, store *Store) ( - encPath paths.Encrypted, err error) { - - raw := path.Raw() - hasTrailing := strings.HasSuffix(raw, "/") - if hasTrailing { - path = paths.NewUnencrypted(raw[:len(raw)-1]) - } - encPath, err = encryptPath(bucket, path, nil, store) - if err != nil { - return encPath, err - } - if hasTrailing { - encPath = paths.NewEncrypted(encPath.Raw() + "/") - } - return encPath, nil -} - -// EncryptPath encrypts the path using the provided cipher and looking up keys from the -// provided store and bucket. -func EncryptPath(bucket string, path paths.Unencrypted, pathCipher storj.CipherSuite, store *Store) ( - encPath paths.Encrypted, err error) { - - return encryptPath(bucket, path, &pathCipher, store) -} - -func encryptPath(bucket string, path paths.Unencrypted, pathCipher *storj.CipherSuite, store *Store) ( - encPath paths.Encrypted, err error) { - - // Invalid paths map to invalid paths - if !path.Valid() { - return paths.Encrypted{}, nil - } - - _, consumed, base := store.LookupUnencrypted(bucket, path) - if base == nil { - return paths.Encrypted{}, errs.New("unable to find encryption base for: %s/%q", bucket, path) - } - - if pathCipher == nil { - pathCipher = &base.PathCipher - } - if store.EncryptionBypass { - *pathCipher = storj.EncNullBase64URL - } - if *pathCipher == storj.EncNull { - return paths.NewEncrypted(path.Raw()), nil - } - - remaining, ok := path.Consume(consumed) - if !ok { - return paths.Encrypted{}, errs.New("unable to encrypt bucket path: %s/%q", bucket, path) - } - - // if we're using the default base (meaning the default key), we need - // to include the bucket name in the path derivation. - key := &base.Key - if base.Default { - key, err = derivePathKeyComponent(key, bucket) - if err != nil { - return paths.Encrypted{}, errs.Wrap(err) - } - } - - encrypted, err := EncryptPathRaw(remaining.Raw(), *pathCipher, key) - if err != nil { - return paths.Encrypted{}, errs.Wrap(err) - } - - var builder strings.Builder - _, _ = builder.WriteString(base.Encrypted.Raw()) - - if len(encrypted) > 0 { - if builder.Len() > 0 { - _ = builder.WriteByte('/') - } - _, _ = builder.WriteString(encrypted) - } - - return paths.NewEncrypted(builder.String()), nil -} - -// EncryptPathRaw encrypts the path using the provided key directly. EncryptPath should be -// preferred if possible. -func EncryptPathRaw(raw string, cipher storj.CipherSuite, key *storj.Key) (string, error) { - if cipher == storj.EncNull { - return raw, nil - } - - var builder strings.Builder - for iter, i := paths.NewIterator(raw), 0; !iter.Done(); i++ { - component := iter.Next() - encComponent, err := encryptPathComponent(component, cipher, key) - if err != nil { - return "", errs.Wrap(err) - } - key, err = derivePathKeyComponent(key, component) - if err != nil { - return "", errs.Wrap(err) - } - if i > 0 { - _ = builder.WriteByte('/') - } - - _, _ = builder.WriteString(encComponent) - } - return builder.String(), nil -} - -// DecryptPathWithStoreCipher decrypts the path looking up keys and the cipher from the -// provided store and bucket. -func DecryptPathWithStoreCipher(bucket string, path paths.Encrypted, store *Store) ( - encPath paths.Unencrypted, err error) { - - return decryptPath(bucket, path, nil, store) -} - -// DecryptPath decrypts the path using the provided cipher and looking up keys from the -// provided store and bucket. -func DecryptPath(bucket string, path paths.Encrypted, pathCipher storj.CipherSuite, store *Store) ( - encPath paths.Unencrypted, err error) { - - return decryptPath(bucket, path, &pathCipher, store) -} - -func decryptPath(bucket string, path paths.Encrypted, pathCipher *storj.CipherSuite, store *Store) ( - encPath paths.Unencrypted, err error) { - - // Invalid paths map to invalid paths - if !path.Valid() { - return paths.Unencrypted{}, nil - } - - _, consumed, base := store.LookupEncrypted(bucket, path) - if base == nil { - return paths.Unencrypted{}, errs.New("unable to find decryption base for: %q", path) - } - - if pathCipher == nil { - pathCipher = &base.PathCipher - } - if store.EncryptionBypass { - *pathCipher = storj.EncNullBase64URL - } - if *pathCipher == storj.EncNull { - return paths.NewUnencrypted(path.Raw()), nil - } - - remaining, ok := path.Consume(consumed) - if !ok { - return paths.Unencrypted{}, errs.New("unable to decrypt bucket path: %q", path) - } - - // if we're using the default base (meaning the default key), we need - // to include the bucket name in the path derivation. - key := &base.Key - if base.Default { - key, err = derivePathKeyComponent(key, bucket) - if err != nil { - return paths.Unencrypted{}, errs.Wrap(err) - } - } - - decrypted, err := DecryptPathRaw(remaining.Raw(), *pathCipher, key) - if err != nil { - return paths.Unencrypted{}, errs.Wrap(err) - } - - var builder strings.Builder - _, _ = builder.WriteString(base.Unencrypted.Raw()) - - if len(decrypted) > 0 { - if builder.Len() > 0 { - _ = builder.WriteByte('/') - } - - _, _ = builder.WriteString(decrypted) - } - - return paths.NewUnencrypted(builder.String()), nil -} - -// DecryptPathRaw decrypts the path using the provided key directly. DecryptPath should be -// preferred if possible. -func DecryptPathRaw(raw string, cipher storj.CipherSuite, key *storj.Key) (string, error) { - if cipher == storj.EncNull { - return raw, nil - } - - var builder strings.Builder - for iter, i := paths.NewIterator(raw), 0; !iter.Done(); i++ { - component := iter.Next() - unencComponent, err := decryptPathComponent(component, cipher, key) - if err != nil { - return "", errs.Wrap(err) - } - key, err = derivePathKeyComponent(key, unencComponent) - if err != nil { - return "", errs.Wrap(err) - } - if i > 0 { - _ = builder.WriteByte('/') - } - - _, _ = builder.WriteString(unencComponent) - } - return builder.String(), nil -} - -// DeriveContentKey returns the content key for the passed in path by looking up -// the appropriate base key from the store and bucket and deriving the rest. -func DeriveContentKey(bucket string, path paths.Unencrypted, store *Store) (key *storj.Key, err error) { - key, err = DerivePathKey(bucket, path, store) - if err != nil { - return nil, errs.Wrap(err) - } - key, err = DeriveKey(key, "content") - return key, errs.Wrap(err) -} - -// DerivePathKey returns the path key for the passed in path by looking up the -// appropriate base key from the store and bucket and deriving the rest. -func DerivePathKey(bucket string, path paths.Unencrypted, store *Store) (key *storj.Key, err error) { - _, consumed, base := store.LookupUnencrypted(bucket, path) - if base == nil { - return nil, errs.New("unable to find encryption base for: %s/%q", bucket, path) - } - - // If asking for the key at the bucket, do that and return. - if !path.Valid() { - // if we're using the default base (meaning the default key), we need - // to include the bucket name in the path derivation. - key = &base.Key - if base.Default { - key, err = derivePathKeyComponent(&base.Key, bucket) - if err != nil { - return nil, errs.Wrap(err) - } - } - return key, nil - } - - remaining, ok := path.Consume(consumed) - if !ok { - return nil, errs.New("unable to derive path key for: %s/%q", bucket, path) - } - - // if we're using the default base (meaning the default key), we need - // to include the bucket name in the path derivation. - key = &base.Key - if base.Default { - key, err = derivePathKeyComponent(key, bucket) - if err != nil { - return nil, errs.Wrap(err) - } - } - - for iter := remaining.Iterator(); !iter.Done(); { - key, err = derivePathKeyComponent(key, iter.Next()) - if err != nil { - return nil, errs.Wrap(err) - } - } - return key, nil -} - -// derivePathKeyComponent derives a new key from the provided one using the component. It -// should be preferred over DeriveKey when adding path components as it performs the -// necessary transformation to the component. -func derivePathKeyComponent(key *storj.Key, component string) (*storj.Key, error) { - return DeriveKey(key, "path:"+component) -} - -// encryptPathComponent encrypts a single path component with the provided cipher and key. -func encryptPathComponent(comp string, cipher storj.CipherSuite, key *storj.Key) (string, error) { - - if cipher == storj.EncNullBase64URL { - decoded, err := base64.URLEncoding.DecodeString(comp) - if err != nil { - return "", Error.New("invalid base64 data: %v", err) - } - return string(decoded), nil - } - - // derive the key for the next path component. this is so that - // every encrypted component has a unique nonce. - derivedKey, err := derivePathKeyComponent(key, comp) - if err != nil { - return "", err - } - - // use the derived key to derive the nonce - mac := hmac.New(sha512.New, derivedKey[:]) - _, err = mac.Write([]byte("nonce")) - if err != nil { - return "", Error.Wrap(err) - } - - nonce := new(storj.Nonce) - copy(nonce[:], mac.Sum(nil)) - - // encrypt the path components with the parent's key and the derived nonce - cipherText, err := Encrypt([]byte(comp), cipher, key, nonce) - if err != nil { - return "", Error.Wrap(err) - } - - nonceSize := storj.NonceSize - if cipher == storj.EncAESGCM { - nonceSize = AESGCMNonceSize - } - - // keep the nonce together with the cipher text - return string(encodeSegment(append(nonce[:nonceSize], cipherText...))), nil -} - -// decryptPathComponent decrypts a single path component with the provided cipher and key. -func decryptPathComponent(comp string, cipher storj.CipherSuite, key *storj.Key) (string, error) { - if comp == "" { - return "", nil - } - - if cipher == storj.EncNullBase64URL { - return base64.URLEncoding.EncodeToString([]byte(comp)), nil - } - - data, err := decodeSegment([]byte(comp)) - if err != nil { - return "", Error.Wrap(err) - } - - nonceSize := storj.NonceSize - if cipher == storj.EncAESGCM { - nonceSize = AESGCMNonceSize - } - if len(data) < nonceSize || nonceSize < 0 { - return "", errs.New("component did not contain enough nonce bytes") - } - - // extract the nonce from the cipher text - nonce := new(storj.Nonce) - copy(nonce[:], data[:nonceSize]) - - decrypted, err := Decrypt(data[nonceSize:], cipher, key, nonce) - if err != nil { - return "", Error.Wrap(err) - } - - return string(decrypted), nil -} - -// encodeSegment encodes segment according to specific rules -// The empty path component is encoded as `\x01` -// Any other path component is encoded as `\x02 + escape(component)` -// -// `\x2e` escapes to `\x2e\x01` -// `\x2f` escapes to `\x2e\x02` -// `\xfe` escapes to `\xfe\x01` -// `\xff` escapes to `\xfe\x02` -// `\x00` escapes to `\x01\x01` -// `\x01` escapes to `\x01\x02 -// for more details see docs/design/path-component-encoding.md. -func encodeSegment(segment []byte) []byte { - if len(segment) == 0 { - return emptyComponent - } - - result := make([]byte, 0, len(segment)*2+1) - result = append(result, notEmptyComponentPrefix) - for i := 0; i < len(segment); i++ { - switch segment[i] { - case escapeSlash: - result = append(result, []byte{escapeSlash, 1}...) - case escapeSlash + 1: - result = append(result, []byte{escapeSlash, 2}...) - case escapeFF: - result = append(result, []byte{escapeFF, 1}...) - case escapeFF + 1: - result = append(result, []byte{escapeFF, 2}...) - case escape01 - 1: - result = append(result, []byte{escape01, 1}...) - case escape01: - result = append(result, []byte{escape01, 2}...) - default: - result = append(result, segment[i]) - } - } - return result -} - -func decodeSegment(segment []byte) ([]byte, error) { - err := validateEncodedSegment(segment) - if err != nil { - return []byte{}, err - } - if segment[0] == emptyComponentPrefix { - return []byte{}, nil - } - - currentIndex := 0 - for i := 1; i < len(segment); i++ { - switch { - case i == len(segment)-1: - segment[currentIndex] = segment[i] - case segment[i] == escapeSlash || segment[i] == escapeFF: - segment[currentIndex] = segment[i] + segment[i+1] - 1 - i++ - case segment[i] == escape01: - segment[currentIndex] = segment[i+1] - 1 - i++ - default: - segment[currentIndex] = segment[i] - } - currentIndex++ - } - return segment[:currentIndex], nil -} - -// validateEncodedSegment checks if: -// * The last byte/sequence is not in {escape1, escape2, escape3} -// * Any byte after an escape character is \x01 or \x02 -// * It does not contain any characters in {\x00, \xff, \x2f} -// * It is non-empty -// * It begins with a character in {\x01, \x02} -func validateEncodedSegment(segment []byte) error { - switch { - case len(segment) == 0: - return errs.New("encoded segment cannot be empty") - case segment[0] != emptyComponentPrefix && segment[0] != notEmptyComponentPrefix: - return errs.New("invalid segment prefix") - case segment[0] == emptyComponentPrefix && len(segment) > 1: - return errs.New("segment encoded as empty but contains data") - case segment[0] == notEmptyComponentPrefix && len(segment) == 1: - return errs.New("segment encoded as not empty but doesn't contain data") - } - - if len(segment) == 1 { - return nil - } - - index := 1 - for ; index < len(segment)-1; index++ { - if isEscapeByte(segment[index]) { - if segment[index+1] == 1 || segment[index+1] == 2 { - index++ - continue - } - return errs.New("invalid escape sequence") - } - if isDisallowedByte(segment[index]) { - return errs.New("invalid character in segment") - } - } - if index == len(segment)-1 { - if isEscapeByte(segment[index]) { - return errs.New("invalid escape sequence") - } - if isDisallowedByte(segment[index]) { - return errs.New("invalid character") - } - } - - return nil -} - -func isEscapeByte(b byte) bool { - return b == escapeSlash || b == escapeFF || b == escape01 -} - -func isDisallowedByte(b byte) bool { - return b == 0 || b == '\xff' || b == '/' -} diff --git a/vendor/storj.io/common/encryption/secretbox.go b/vendor/storj.io/common/encryption/secretbox.go deleted file mode 100644 index 9cb804d3c..000000000 --- a/vendor/storj.io/common/encryption/secretbox.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "golang.org/x/crypto/nacl/secretbox" - - "storj.io/common/storj" -) - -type secretboxEncrypter struct { - blockSize int - key *storj.Key - startingNonce *storj.Nonce -} - -// NewSecretboxEncrypter returns a Transformer that encrypts the data passing -// through with key. -// -// startingNonce is treated as a big-endian encoded unsigned -// integer, and as blocks pass through, their block number and the starting -// nonce is added together to come up with that block's nonce. Encrypting -// different data with the same key and the same nonce is a huge security -// issue. It's safe to always encode new data with a random key and random -// startingNonce. The monotonically-increasing nonce (that rolls over) is to -// protect against data reordering. -// -// When in doubt, generate a new key from crypto/rand and a startingNonce -// from crypto/rand as often as possible. -func NewSecretboxEncrypter(key *storj.Key, startingNonce *storj.Nonce, encryptedBlockSize int) (Transformer, error) { - if encryptedBlockSize <= secretbox.Overhead { - return nil, ErrInvalidConfig.New("encrypted block size %d too small", encryptedBlockSize) - } - return &secretboxEncrypter{ - blockSize: encryptedBlockSize - secretbox.Overhead, - key: key, - startingNonce: startingNonce, - }, nil -} - -func (s *secretboxEncrypter) InBlockSize() int { - return s.blockSize -} - -func (s *secretboxEncrypter) OutBlockSize() int { - return s.blockSize + secretbox.Overhead -} - -func calcNonce(startingNonce *storj.Nonce, blockNum int64) (rv *storj.Nonce, err error) { - rv = new(storj.Nonce) - if copy(rv[:], (*startingNonce)[:]) != len(rv) { - return rv, Error.New("didn't copy memory?!") - } - _, err = incrementBytes(rv[:], blockNum) - return rv, err -} - -func (s *secretboxEncrypter) Transform(out, in []byte, blockNum int64) ([]byte, error) { - nonce, err := calcNonce(s.startingNonce, blockNum) - if err != nil { - return nil, err - } - return secretbox.Seal(out, in, nonce.Raw(), s.key.Raw()), nil -} - -type secretboxDecrypter struct { - blockSize int - key *storj.Key - startingNonce *storj.Nonce -} - -// NewSecretboxDecrypter returns a Transformer that decrypts the data passing -// through with key. See the comments for NewSecretboxEncrypter about -// startingNonce. -func NewSecretboxDecrypter(key *storj.Key, startingNonce *storj.Nonce, encryptedBlockSize int) (Transformer, error) { - if encryptedBlockSize <= secretbox.Overhead { - return nil, ErrInvalidConfig.New("encrypted block size %d too small", encryptedBlockSize) - } - return &secretboxDecrypter{ - blockSize: encryptedBlockSize - secretbox.Overhead, - key: key, - startingNonce: startingNonce, - }, nil -} - -func (s *secretboxDecrypter) InBlockSize() int { - return s.blockSize + secretbox.Overhead -} - -func (s *secretboxDecrypter) OutBlockSize() int { - return s.blockSize -} - -func (s *secretboxDecrypter) Transform(out, in []byte, blockNum int64) ([]byte, error) { - nonce, err := calcNonce(s.startingNonce, blockNum) - if err != nil { - return nil, err - } - rv, success := secretbox.Open(out, in, nonce.Raw(), s.key.Raw()) - if !success { - return nil, ErrDecryptFailed.New("") - } - return rv, nil -} - -// EncryptSecretBox encrypts byte data with a key and nonce. The cipher data is returned. -func EncryptSecretBox(data []byte, key *storj.Key, nonce *storj.Nonce) (cipherData []byte, err error) { - return secretbox.Seal(nil, data, nonce.Raw(), key.Raw()), nil -} - -// DecryptSecretBox decrypts byte data with a key and nonce. The plain data is returned. -func DecryptSecretBox(cipherData []byte, key *storj.Key, nonce *storj.Nonce) (data []byte, err error) { - data, success := secretbox.Open(nil, cipherData, nonce.Raw(), key.Raw()) - if !success { - return nil, ErrDecryptFailed.New("") - } - return data, nil -} diff --git a/vendor/storj.io/common/encryption/store.go b/vendor/storj.io/common/encryption/store.go deleted file mode 100644 index 4b507220e..000000000 --- a/vendor/storj.io/common/encryption/store.go +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "github.com/zeebo/errs" - - "storj.io/common/paths" - "storj.io/common/storj" -) - -// The Store allows one to find the matching most encrypted key and path for -// some unencrypted path. It also reports a mapping of encrypted to unencrypted paths -// at the searched for unencrypted path. -// -// For example, if the Store contains the mappings -// -// b1, u1/u2/u3 => -// b1, u1/u2/u3/u4 => -// b1, u1/u5 => -// b1, u6 => -// b1, u6/u7/u8 => -// b2, u1 => -// -// Then the following lookups have outputs -// -// b1, u1 => <{e2:u2, e5:u5}, u1, nil> -// b1, u1/u2/u3 => <{e4:u4}, u1/u2/u3, > -// b1, u1/u2/u3/u6 => <{}, u1/u2/u3/, > -// b1, u1/u2/u3/u4 => <{}, u1/u2/u3/u4, > -// b1, u6/u7 => <{e8:u8}, u6/, > -// b2, u1 => <{}, u1, > -type Store struct { - roots map[string]*node - defaultKey *storj.Key - defaultPathCipher storj.CipherSuite - - // EncryptionBypass makes it so we can interoperate with - // the network without having encryption keys. paths will be encrypted but - // base64-encoded, and certain metadata will be unable to be retrieved. - EncryptionBypass bool -} - -// node is a node in the Store graph. It may contain an encryption key and encrypted path, -// a list of children nodes, and data to ensure a bijection between encrypted and unencrypted -// path entries. -type node struct { - unenc map[string]*node // unenc => node - unencMap map[string]string // unenc => enc - enc map[string]*node // enc => node - encMap map[string]string // enc => unenc - base *Base -} - -// Base represents a key with which to derive further keys at some encrypted/unencrypted path. -type Base struct { - Unencrypted paths.Unencrypted - Encrypted paths.Encrypted - Key storj.Key - PathCipher storj.CipherSuite - Default bool -} - -// clone returns a copy of the Base. The implementation can be simple because the -// types of its fields do not contain any references. -func (b *Base) clone() *Base { - if b == nil { - return nil - } - bc := *b - return &bc -} - -// NewStore constructs a Store. -func NewStore() *Store { - return &Store{roots: make(map[string]*node)} -} - -// newNode constructs a node. -func newNode() *node { - return &node{ - unenc: make(map[string]*node), - unencMap: make(map[string]string), - enc: make(map[string]*node), - encMap: make(map[string]string), - } -} - -// SetDefaultKey adds a default key to be returned for any lookup that does not match a bucket. -func (s *Store) SetDefaultKey(defaultKey *storj.Key) { - s.defaultKey = defaultKey -} - -// GetDefaultKey returns the default key, or nil if none has been set. -func (s *Store) GetDefaultKey() *storj.Key { - return s.defaultKey -} - -// SetDefaultPathCipher adds a default path cipher to be returned for any lookup that does not match a bucket. -func (s *Store) SetDefaultPathCipher(defaultPathCipher storj.CipherSuite) { - s.defaultPathCipher = defaultPathCipher -} - -// GetDefaultPathCipher returns the default path cipher, or EncUnspecified if none has been set. -func (s *Store) GetDefaultPathCipher() storj.CipherSuite { - return s.defaultPathCipher -} - -// Add creates a mapping from the unencrypted path to the encrypted path and key. It uses the current default cipher. -func (s *Store) Add(bucket string, unenc paths.Unencrypted, enc paths.Encrypted, key storj.Key) error { - return s.AddWithCipher(bucket, unenc, enc, key, s.defaultPathCipher) -} - -// AddWithCipher creates a mapping from the unencrypted path to the encrypted path and key with the given cipher. -func (s *Store) AddWithCipher(bucket string, unenc paths.Unencrypted, enc paths.Encrypted, key storj.Key, pathCipher storj.CipherSuite) error { - root, ok := s.roots[bucket] - if !ok { - root = newNode() - } - - // Perform the addition starting at the root node. - if err := root.add(unenc.Iterator(), enc.Iterator(), &Base{ - Unencrypted: unenc, - Encrypted: enc, - Key: key, - PathCipher: pathCipher, - }); err != nil { - return err - } - - // only update the root for the bucket if the add was successful. - s.roots[bucket] = root - return nil -} - -// add places the paths and base into the node tree structure. -func (n *node) add(unenc, enc paths.Iterator, base *Base) error { - if unenc.Done() != enc.Done() { - return errs.New("encrypted and unencrypted paths had different number of components") - } - - // If we're done walking the paths, this node must have the provided base. - if unenc.Done() { - n.base = base - return nil - } - - // Walk to the next parts and ensure they're consistent with previous additions. - unencPart, encPart := unenc.Next(), enc.Next() - if exUnencPart, ok := n.encMap[encPart]; ok && exUnencPart != unencPart { - return errs.New("conflicting encrypted parts for unencrypted path") - } - if exEncPart, ok := n.unencMap[unencPart]; ok && exEncPart != encPart { - return errs.New("conflicting encrypted parts for unencrypted path") - } - - // Look up the child node. Since we're sure the unenc and enc mappings are - // consistent, we can look it up in one map and unconditionally insert it - // into both maps if necessary. - child, ok := n.unenc[unencPart] - if !ok { - child = newNode() - } - - // Recurse to the next node in the tree. - if err := child.add(unenc, enc, base); err != nil { - return err - } - - // Only add to the maps if the child add was successful. - n.unencMap[unencPart] = encPart - n.encMap[encPart] = unencPart - n.unenc[unencPart] = child - n.enc[encPart] = child - return nil -} - -// LookupUnencrypted finds the matching most unencrypted path added to the Store, reports how -// much of the path matched, any known unencrypted paths at the requested path, and if a key -// and encrypted path exists for some prefix of the unencrypted path. -func (s *Store) LookupUnencrypted(bucket string, path paths.Unencrypted) ( - revealed map[string]string, consumed paths.Unencrypted, base *Base) { - - root, ok := s.roots[bucket] - if ok { - var rawConsumed string - revealed, rawConsumed, base = root.lookup(path.Iterator(), "", nil, true) - consumed = paths.NewUnencrypted(rawConsumed) - } - if base == nil && s.defaultKey != nil { - return nil, paths.Unencrypted{}, s.defaultBase() - } - return revealed, consumed, base.clone() -} - -// LookupEncrypted finds the matching most encrypted path added to the Store, reports how -// much of the path matched, any known encrypted paths at the requested path, and if a key -// an encrypted path exists for some prefix of the encrypted path. -func (s *Store) LookupEncrypted(bucket string, path paths.Encrypted) ( - revealed map[string]string, consumed paths.Encrypted, base *Base) { - - root, ok := s.roots[bucket] - if ok { - var rawConsumed string - revealed, rawConsumed, base = root.lookup(path.Iterator(), "", nil, false) - consumed = paths.NewEncrypted(rawConsumed) - } - if base == nil && s.defaultKey != nil { - return nil, paths.Encrypted{}, s.defaultBase() - } - return revealed, consumed, base.clone() -} - -func (s *Store) defaultBase() *Base { - return &Base{ - Key: *s.defaultKey, - PathCipher: s.defaultPathCipher, - Default: true, - } -} - -// lookup searches for the path in the node tree structure. -func (n *node) lookup(path paths.Iterator, bestConsumed string, bestBase *Base, unenc bool) ( - map[string]string, string, *Base) { - - // Keep track of the best match so far. - if n.base != nil || bestBase == nil { - bestBase, bestConsumed = n.base, path.Consumed() - } - - // Pick the tree we're walking down based on the unenc bool. - revealed, children := n.unencMap, n.enc - if unenc { - revealed, children = n.encMap, n.unenc - } - - // If we're done walking the path, then return our best match along with the - // revealed paths at this node. - if path.Done() { - return revealed, bestConsumed, bestBase - } - - // Walk to the next node in the tree. If there is no node, then report our best match. - child, ok := children[path.Next()] - if !ok { - return nil, bestConsumed, bestBase - } - - // Recurse to the next node in the tree. - return child.lookup(path, bestConsumed, bestBase, unenc) -} - -// Iterate executes the callback with every value that has been Added to the Store. -// NOTE: This call is lossy! Please upgrade any code paths to use IterateWithCipher! -func (s *Store) Iterate(fn func(string, paths.Unencrypted, paths.Encrypted, storj.Key) error) error { - for bucket, root := range s.roots { - if err := root.iterate(fn, bucket); err != nil { - return err - } - } - return nil -} - -// iterate calls the callback if the node has a base, and recurses to its children. -func (n *node) iterate(fn func(string, paths.Unencrypted, paths.Encrypted, storj.Key) error, bucket string) error { - if n.base != nil { - err := fn(bucket, n.base.Unencrypted, n.base.Encrypted, n.base.Key) - if err != nil { - return err - } - } - - // recurse down only the unenc map, as the enc map should be the same. - for _, child := range n.unenc { - err := child.iterate(fn, bucket) - if err != nil { - return err - } - } - - return nil -} - -// IterateWithCipher executes the callback with every value that has been Added to the Store. -func (s *Store) IterateWithCipher(fn func(string, paths.Unencrypted, paths.Encrypted, storj.Key, storj.CipherSuite) error) error { - for bucket, root := range s.roots { - if err := root.iterateWithCipher(fn, bucket); err != nil { - return err - } - } - return nil -} - -// iterateWithCipher calls the callback if the node has a base, and recurses to its children. -func (n *node) iterateWithCipher(fn func(string, paths.Unencrypted, paths.Encrypted, storj.Key, storj.CipherSuite) error, bucket string) error { - if n.base != nil { - err := fn(bucket, n.base.Unencrypted, n.base.Encrypted, n.base.Key, n.base.PathCipher) - if err != nil { - return err - } - } - - // recurse down only the unenc map, as the enc map should be the same. - for _, child := range n.unenc { - err := child.iterateWithCipher(fn, bucket) - if err != nil { - return err - } - } - - return nil -} diff --git a/vendor/storj.io/common/encryption/transform.go b/vendor/storj.io/common/encryption/transform.go deleted file mode 100644 index 2b6638bf8..000000000 --- a/vendor/storj.io/common/encryption/transform.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package encryption - -import ( - "bytes" - "context" - "io" - "io/ioutil" - - "github.com/spacemonkeygo/monkit/v3" - - "storj.io/common/ranger" - "storj.io/common/readcloser" -) - -var mon = monkit.Package() - -// A Transformer is a data transformation that may change the size of the blocks -// of data it operates on in a deterministic fashion. -type Transformer interface { - InBlockSize() int // The block size prior to transformation - OutBlockSize() int // The block size after transformation - Transform(out, in []byte, blockNum int64) ([]byte, error) -} - -type transformedReader struct { - r io.ReadCloser - t Transformer - blockNum int64 - inbuf []byte - outbuf []byte - expectedSize int64 - bytesRead int -} - -// NoopTransformer is a dummy Transformer that passes data through without modifying it. -type NoopTransformer struct{} - -// InBlockSize is 1. -func (t *NoopTransformer) InBlockSize() int { - return 1 -} - -// OutBlockSize is 1. -func (t *NoopTransformer) OutBlockSize() int { - return 1 -} - -// Transform returns the input without modification. -func (t *NoopTransformer) Transform(out, in []byte, blockNum int64) ([]byte, error) { - return append(out, in...), nil -} - -// TransformReader applies a Transformer to a Reader. startingBlockNum should -// probably be 0 unless you know you're already starting at a block offset. -func TransformReader(r io.ReadCloser, t Transformer, - startingBlockNum int64) io.ReadCloser { - return &transformedReader{ - r: r, - t: t, - blockNum: startingBlockNum, - inbuf: make([]byte, t.InBlockSize()), - outbuf: make([]byte, 0, t.OutBlockSize()), - } -} - -// TransformReaderSize creates a TransformReader with expected size, -// i.e. the number of bytes that is expected to be read from this reader. -// If less than the expected bytes are read, the reader will return -// io.ErrUnexpectedEOF instead of io.EOF. -func TransformReaderSize(r io.ReadCloser, t Transformer, - startingBlockNum int64, expectedSize int64) io.ReadCloser { - return &transformedReader{ - r: r, - t: t, - blockNum: startingBlockNum, - inbuf: make([]byte, t.InBlockSize()), - outbuf: make([]byte, 0, t.OutBlockSize()), - expectedSize: expectedSize, - } -} - -func (t *transformedReader) Read(p []byte) (n int, err error) { - if len(t.outbuf) == 0 { - // If there's no more buffered data left, let's fill the buffer with - // the next block - b, err := io.ReadFull(t.r, t.inbuf) - t.bytesRead += b - if err == io.EOF && int64(t.bytesRead) < t.expectedSize { - return 0, io.ErrUnexpectedEOF - } else if err != nil { - return 0, err - } - t.outbuf, err = t.t.Transform(t.outbuf, t.inbuf, t.blockNum) - if err != nil { - if err == io.EOF { - return 0, err - } - return 0, Error.Wrap(err) - } - t.blockNum++ - } - - // return as much as we can from the current buffered block - n = copy(p, t.outbuf) - // slide the uncopied data to the beginning of the buffer - copy(t.outbuf, t.outbuf[n:]) - // resize the buffer - t.outbuf = t.outbuf[:len(t.outbuf)-n] - return n, nil -} - -func (t *transformedReader) Close() error { - return t.r.Close() -} - -type transformedRanger struct { - rr ranger.Ranger - t Transformer -} - -// Transform will apply a Transformer to a Ranger. -func Transform(rr ranger.Ranger, t Transformer) (ranger.Ranger, error) { - if rr.Size()%int64(t.InBlockSize()) != 0 { - return nil, Error.New("invalid transformer and range reader combination." + - "the range reader size is not a multiple of the block size") - } - return &transformedRanger{rr: rr, t: t}, nil -} - -func (t *transformedRanger) Size() int64 { - blocks := t.rr.Size() / int64(t.t.InBlockSize()) - return blocks * int64(t.t.OutBlockSize()) -} - -// CalcEncompassingBlocks is a useful helper function that, given an offset, -// length, and blockSize, will tell you which blocks contain the requested -// offset and length. -func CalcEncompassingBlocks(offset, length int64, blockSize int) ( - firstBlock, blockCount int64) { - firstBlock = offset / int64(blockSize) - if length <= 0 { - return firstBlock, 0 - } - lastBlock := (offset + length) / int64(blockSize) - if (offset+length)%int64(blockSize) == 0 { - return firstBlock, lastBlock - firstBlock - } - return firstBlock, 1 + lastBlock - firstBlock -} - -func (t *transformedRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - - // Range may not have been called for block-aligned offsets and lengths, so - // let's figure out which blocks encompass the request - firstBlock, blockCount := CalcEncompassingBlocks( - offset, length, t.t.OutBlockSize()) - // If block count is 0, there is nothing to transform, so return a dumb - // reader that will just return io.EOF on read - if blockCount == 0 { - return ioutil.NopCloser(bytes.NewReader(nil)), nil - } - // okay, now let's get the range on the underlying ranger for those blocks - // and then Transform it. - r, err := t.rr.Range(ctx, - firstBlock*int64(t.t.InBlockSize()), - blockCount*int64(t.t.InBlockSize())) - if err != nil { - return nil, err - } - tr := TransformReaderSize(r, t.t, firstBlock, blockCount*int64(t.t.InBlockSize())) - // the range we got potentially includes more than we wanted. if the - // offset started past the beginning of the first block, we need to - // swallow the first few bytes - _, err = io.CopyN(ioutil.Discard, tr, - offset-firstBlock*int64(t.t.OutBlockSize())) - if err != nil { - if err == io.EOF { - return nil, io.ErrUnexpectedEOF - } - return nil, Error.Wrap(err) - } - // the range might have been too long. only return what was requested - return readcloser.LimitReadCloser(tr, length), nil -} diff --git a/vendor/storj.io/common/errs2/collect.go b/vendor/storj.io/common/errs2/collect.go deleted file mode 100644 index 68bb93ee2..000000000 --- a/vendor/storj.io/common/errs2/collect.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package errs2 - -import ( - "time" - - "github.com/zeebo/errs" -) - -// Collect returns first error from channel and all errors that happen within duration. -func Collect(errch chan error, duration time.Duration) error { - errch = discardNil(errch) - errlist := []error{<-errch} - timeout := time.After(duration) - for { - select { - case err := <-errch: - errlist = append(errlist, err) - case <-timeout: - return errs.Combine(errlist...) - } - } -} - -// discard nil errors that are returned from services. -func discardNil(ch chan error) chan error { - r := make(chan error) - go func() { - for err := range ch { - if err == nil { - continue - } - r <- err - } - close(r) - }() - return r -} diff --git a/vendor/storj.io/common/errs2/doc.go b/vendor/storj.io/common/errs2/doc.go deleted file mode 100644 index c9313aaae..000000000 --- a/vendor/storj.io/common/errs2/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package errs2 collects common error handling functions. -package errs2 diff --git a/vendor/storj.io/common/errs2/group.go b/vendor/storj.io/common/errs2/group.go deleted file mode 100644 index 8cbad5f67..000000000 --- a/vendor/storj.io/common/errs2/group.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package errs2 - -import "sync" - -// Group is a collection of goroutines working on subtasks that are part of -// the same overall task. -type Group struct { - wg sync.WaitGroup - mu sync.Mutex - errors []error -} - -// Go calls the given function in a new goroutine. -func (group *Group) Go(f func() error) { - group.wg.Add(1) - - go func() { - defer group.wg.Done() - - if err := f(); err != nil { - group.mu.Lock() - defer group.mu.Unlock() - - group.errors = append(group.errors, err) - } - }() -} - -// Wait blocks until all function calls from the Go method have returned, then -// returns all errors (if any) from them. -func (group *Group) Wait() []error { - group.wg.Wait() - - return group.errors -} diff --git a/vendor/storj.io/common/errs2/ignore.go b/vendor/storj.io/common/errs2/ignore.go deleted file mode 100644 index 55437af0f..000000000 --- a/vendor/storj.io/common/errs2/ignore.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package errs2 - -import ( - "context" - - "github.com/zeebo/errs" - - "storj.io/common/rpc/rpcstatus" -) - -// IsCanceled returns true, when the error is a cancellation. -func IsCanceled(err error) bool { - return errs.IsFunc(err, func(err error) bool { - return err == context.Canceled || - rpcstatus.Code(err) == rpcstatus.Canceled - }) -} - -// IgnoreCanceled returns nil, when the operation was about canceling. -func IgnoreCanceled(err error) error { - if IsCanceled(err) { - return nil - } - return err -} diff --git a/vendor/storj.io/common/errs2/rpc.go b/vendor/storj.io/common/errs2/rpc.go deleted file mode 100644 index ae19ed019..000000000 --- a/vendor/storj.io/common/errs2/rpc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package errs2 - -import ( - "github.com/zeebo/errs" - - "storj.io/common/rpc/rpcstatus" -) - -// IsRPC checks if err contains an RPC error with the given status code. -func IsRPC(err error, code rpcstatus.StatusCode) bool { - return errs.IsFunc(err, func(err error) bool { - return rpcstatus.Code(err) == code - }) -} diff --git a/vendor/storj.io/common/errs2/sanatizer.go b/vendor/storj.io/common/errs2/sanatizer.go deleted file mode 100644 index 6d33aeecf..000000000 --- a/vendor/storj.io/common/errs2/sanatizer.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package errs2 - -import ( - "github.com/zeebo/errs" - "go.uber.org/zap" - - "storj.io/common/rpc/rpcstatus" -) - -// CodeMap is used to apply the correct rpc status code to error classes. -type CodeMap map[*errs.Class]rpcstatus.StatusCode - -// LoggingSanitizer consolidates logging of original errors with sanitization of internal errors. -type LoggingSanitizer struct { - wrapper *errs.Class - log *zap.Logger - codeMap CodeMap -} - -// NewLoggingSanitizer creates a new LoggingSanitizer. -func NewLoggingSanitizer(wrapper *errs.Class, log *zap.Logger, codeMap CodeMap) *LoggingSanitizer { - return &LoggingSanitizer{ - wrapper: wrapper, - log: log, - codeMap: codeMap, - } -} - -// Error logs the message and error to the logger and returns the sanitized error. -func (sanitizer *LoggingSanitizer) Error(msg string, err error) error { - if sanitizer.wrapper != nil { - err = sanitizer.wrapper.Wrap(err) - } - - if sanitizer.log != nil { - sanitizer.log.Error(msg, zap.Error(err)) - } - - for errClass, code := range sanitizer.codeMap { - if errClass.Has(err) { - return rpcstatus.Error(code, err.Error()) - } - } - - if sanitizer.wrapper == nil { - return rpcstatus.Error(rpcstatus.Internal, msg) - } - return rpcstatus.Error(rpcstatus.Internal, sanitizer.wrapper.New(msg).Error()) -} diff --git a/vendor/storj.io/common/fpath/atomic.go b/vendor/storj.io/common/fpath/atomic.go deleted file mode 100644 index 49f3defbb..000000000 --- a/vendor/storj.io/common/fpath/atomic.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package fpath - -import ( - "io/ioutil" - "os" - "path/filepath" - - "github.com/zeebo/errs" -) - -// AtomicWriteFile is a helper to atomically write the data to the outfile. -func AtomicWriteFile(outfile string, data []byte, mode os.FileMode) (err error) { - // TODO: provide better atomicity guarantees, like fsyncing the parent - // directory and, on windows, using MoveFileEx with MOVEFILE_WRITE_THROUGH. - - fh, err := ioutil.TempFile(filepath.Dir(outfile), filepath.Base(outfile)) - if err != nil { - return errs.Wrap(err) - } - defer func() { - if err != nil { - err = errs.Combine(err, fh.Close()) - err = errs.Combine(err, os.Remove(fh.Name())) - } - }() - if _, err := fh.Write(data); err != nil { - return errs.Wrap(err) - } - if err := fh.Sync(); err != nil { - return errs.Wrap(err) - } - if err := fh.Close(); err != nil { - return errs.Wrap(err) - } - if err := os.Rename(fh.Name(), outfile); err != nil { - return errs.Wrap(err) - } - return nil -} diff --git a/vendor/storj.io/common/fpath/doc.go b/vendor/storj.io/common/fpath/doc.go deleted file mode 100644 index 8971eab8c..000000000 --- a/vendor/storj.io/common/fpath/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package fpath implements cross-platform file and object path handling. -package fpath diff --git a/vendor/storj.io/common/fpath/editor.go b/vendor/storj.io/common/fpath/editor.go deleted file mode 100644 index 2e8787065..000000000 --- a/vendor/storj.io/common/fpath/editor.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package fpath - -import ( - "fmt" - "os" - "os/exec" - "strings" -) - -//EditFile opens the best OS-specific text editor we can find. -func EditFile(fileToEdit string) error { - editorPath := getEditorPath() - if editorPath == "" { - return fmt.Errorf("unable to find suitable editor for file %s", fileToEdit) - } - - /* #nosec G204 */ // This function is used by CLI implementations for opening a configuration file - cmd := exec.Command(editorPath, fileToEdit) - cmd.Stdout = os.Stdout - cmd.Stdin = os.Stdin - cmd.Stderr = os.Stderr - return cmd.Run() -} - -func getEditorPath() string { - // we currently only attempt to open TTY-friendly editors here - // we could consider using https://github.com/mattn/go-isatty - // alongside "start" / "open" / "xdg-open" - - //look for a preference in environment variables - for _, eVar := range [...]string{"EDITOR", "VISUAL", "GIT_EDITOR"} { - path := os.Getenv(eVar) - _, err := os.Stat(path) - if len(path) > 0 && err == nil { - return path - } - } - //look for a preference via 'git config' - git, err := exec.LookPath("git") - if err == nil { - /* #nosec G204 */ // The parameter's value is controlled - out, err := exec.Command(git, "config", "core.editor").Output() - if err == nil { - cmd := strings.TrimSpace(string(out)) - _, err := os.Stat(cmd) - if len(cmd) > 0 && err == nil { - return cmd - } - } - } - //heck, just try a bunch of options - for _, exe := range [...]string{"nvim", "vim", "vi", "emacs", "nano", "pico"} { - path, err := exec.LookPath(exe) - if err == nil { - return path - } - } - return "" -} diff --git a/vendor/storj.io/common/fpath/os.go b/vendor/storj.io/common/fpath/os.go deleted file mode 100644 index f97bea3ec..000000000 --- a/vendor/storj.io/common/fpath/os.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package fpath - -import ( - "fmt" - "io" - "os" - "path" - "path/filepath" - "runtime" - "strings" - - "github.com/zeebo/errs" -) - -// IsRoot returns whether path is the root directory. -func IsRoot(path string) bool { - abs, err := filepath.Abs(path) - if err == nil { - path = abs - } - - return filepath.Dir(path) == path -} - -// ApplicationDir returns best base directory for specific OS. -func ApplicationDir(subdir ...string) string { - for i := range subdir { - if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { - subdir[i] = strings.Title(subdir[i]) - } else { - subdir[i] = strings.ToLower(subdir[i]) - } - } - var appdir string - home := os.Getenv("HOME") - - switch runtime.GOOS { - case "windows": - // Windows standards: https://msdn.microsoft.com/en-us/library/windows/apps/hh465094.aspx?f=255&MSPPError=-2147217396 - for _, env := range []string{"AppData", "AppDataLocal", "UserProfile", "Home"} { - val := os.Getenv(env) - if val != "" { - appdir = val - break - } - } - case "darwin": - // Mac standards: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html - appdir = filepath.Join(home, "Library", "Application Support") - case "linux": - fallthrough - default: - // Linux standards: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html - appdir = os.Getenv("XDG_DATA_HOME") - if appdir == "" && home != "" { - appdir = filepath.Join(home, ".local", "share") - } - } - return filepath.Join(append([]string{appdir}, subdir...)...) -} - -// IsValidSetupDir checks if directory is valid for setup configuration. -func IsValidSetupDir(name string) (ok bool, err error) { - _, err = os.Stat(name) - if err != nil { - if os.IsNotExist(err) { - return true, err - } - return false, err - } - - /* #nosec G304 */ // The function limits later on paths having a config file - f, err := os.Open(name) - if err != nil { - return false, err - } - defer func() { - err = errs.Combine(err, f.Close()) - }() - - for { - var filenames []string - filenames, err = f.Readdirnames(100) - if err == io.EOF { - // nothing more - return true, nil - } else if err != nil { - // something went wrong - return false, err - } - - for _, filename := range filenames { - if filename == "config.yaml" { - return false, nil - } - } - } -} - -// IsWritable determines if a directory is writeable. -func IsWritable(filepath string) (bool, error) { - info, err := os.Stat(filepath) - if err != nil { - return false, err - } - - if !info.IsDir() { - return false, fmt.Errorf("path %s is not a directory", filepath) - } - - // Check if the user bit is enabled in file permission - if info.Mode().Perm()&0200 == 0 { - return false, fmt.Errorf("write permission bit is not set on this file for user") - } - - // Test if user can create file - // There is no OS cross-compatible method for - // determining if a user has write permissions on a folder. - // We can test by attempting to create a file in the folder. - testFile := path.Join(filepath, ".perm") - file, err := os.Create(testFile) // For read access. - if err != nil { - return false, fmt.Errorf("write permission bit is not set on this file for user") - } - - _ = file.Close() - _ = os.Remove(testFile) - - return true, nil -} diff --git a/vendor/storj.io/common/fpath/path.go b/vendor/storj.io/common/fpath/path.go deleted file mode 100644 index 505127641..000000000 --- a/vendor/storj.io/common/fpath/path.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package fpath - -import ( - "errors" - "fmt" - "path" - "path/filepath" - "regexp" - "strings" -) - -// FPath is an OS independent path handling structure. -type FPath struct { - original string // the original URL or local path - local bool // if local path - bucket string // only for Storj URL - path string // only for Storj URL - the path within the bucket, cleaned from duplicated slashes -} - -var parseSchemeRegex = regexp.MustCompile(`^([a-zA-Z][a-zA-Z0-9+.-]*):(.*)$`) - -func parseScheme(o string) (scheme, rest string) { - found := parseSchemeRegex.FindStringSubmatch(o) - - switch len(found) { - case 2: - return strings.ToLower(found[1]), "" - case 3: - return strings.ToLower(found[1]), found[2] - } - - return "", o -} - -var parseBucketRegex = regexp.MustCompile(`^/{1,4}([^/]+)(/.*)?$`) - -func parseBucket(o string) (bucket, rest string) { - found := parseBucketRegex.FindStringSubmatch(o) - - switch len(found) { - case 2: - return found[1], "" - case 3: - return found[1], found[2] - } - - return "", o -} - -// New creates new FPath from the given URL. -func New(p string) (FPath, error) { - fp := FPath{original: p} - - // Skip processing further if we can determine this is an absolute - // path to a local file. - if filepath.IsAbs(p) { - fp.local = true - - return fp, nil - } - - // Does the path have a scheme? If not then we treat it as a local - // path. Otherwise we validate that the scheme is a supported one. - scheme, rest := parseScheme(p) - if scheme == "" { - // Forbid the use of an empty scheme. - if strings.HasPrefix(rest, ":") { - return fp, errors.New("malformed URL: missing scheme, use format sj://bucket/") - } - - fp.local = true - - return fp, nil - } - - switch scheme { - case "s3": - case "sj": - default: - return fp, fmt.Errorf("unsupported URL scheme: %s, use format sj://bucket/", scheme) - } - - // The remaining portion of the path must begin with a bucket. - bucket, rest := parseBucket(rest) - if bucket == "" { - return fp, errors.New("no bucket specified, use format sj://bucket/") - } - - fp.bucket = bucket - - // We only want to clean the path if it is non-empty. This is because - // path. Clean will turn an empty path into ".". - rest = strings.TrimLeft(rest, "/") - if rest != "" { - fp.path = path.Clean(rest) - } - - return fp, nil -} - -// Join is appends the given segment to the path. -func (p FPath) Join(segment string) FPath { - if p.local { - p.original = filepath.Join(p.original, segment) - return p - } - - p.original += "/" + segment - p.path = path.Join(p.path, segment) - return p -} - -// Base returns the last segment of the path. -func (p FPath) Base() string { - if p.local { - return filepath.Base(p.original) - } - if p.path == "" { - return "" - } - return path.Base(p.path) -} - -// Bucket returns the first segment of path. -func (p FPath) Bucket() string { - return p.bucket -} - -// Path returns the URL path without the scheme. -func (p FPath) Path() string { - if p.local { - return p.original - } - return p.path -} - -// IsLocal returns whether the path refers to local or remote location. -func (p FPath) IsLocal() bool { - return p.local -} - -// String returns the entire URL (untouched). -func (p FPath) String() string { - return p.original -} diff --git a/vendor/storj.io/common/fpath/temp_data.go b/vendor/storj.io/common/fpath/temp_data.go deleted file mode 100644 index 5a6ad5614..000000000 --- a/vendor/storj.io/common/fpath/temp_data.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// TODO maybe there is better place for this - -package fpath - -import "context" - -// The key type is unexported to prevent collisions with context keys defined in -// other packages. -type key int - -// temp is the context key for temp struct. -const tempKey key = 0 - -type temp struct { - inmemory bool - directory string -} - -// WithTempData creates context with information how store temporary data, in memory or on disk. -func WithTempData(ctx context.Context, directory string, inmemory bool) context.Context { - temp := temp{ - inmemory: inmemory, - directory: directory, - } - return context.WithValue(ctx, tempKey, temp) -} - -// GetTempData returns if temporary data should be stored in memory or on disk. -func GetTempData(ctx context.Context) (string, bool, bool) { - tempValue, ok := ctx.Value(tempKey).(temp) - if !ok { - return "", false, false - } - return tempValue.directory, tempValue.inmemory, ok -} diff --git a/vendor/storj.io/common/identity/certificate_authority.go b/vendor/storj.io/common/identity/certificate_authority.go deleted file mode 100644 index 9dbee4fa3..000000000 --- a/vendor/storj.io/common/identity/certificate_authority.go +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package identity - -import ( - "bytes" - "context" - "crypto" - "crypto/x509" - "crypto/x509/pkix" - "fmt" - "io" - "io/ioutil" - "log" - "sync" - "sync/atomic" - - "github.com/zeebo/errs" - - "storj.io/common/peertls" - "storj.io/common/peertls/extensions" - "storj.io/common/pkcrypto" - "storj.io/common/storj" -) - -const minimumLoggableDifficulty = 8 - -// PeerCertificateAuthority represents the CA which is used to validate peer identities. -type PeerCertificateAuthority struct { - RestChain []*x509.Certificate - // Cert is the x509 certificate of the CA - Cert *x509.Certificate - // The ID is calculated from the CA public key. - ID storj.NodeID -} - -// FullCertificateAuthority represents the CA which is used to author and validate full identities. -type FullCertificateAuthority struct { - RestChain []*x509.Certificate - // Cert is the x509 certificate of the CA - Cert *x509.Certificate - // The ID is calculated from the CA public key. - ID storj.NodeID - // Key is the private key of the CA - Key crypto.PrivateKey -} - -// CASetupConfig is for creating a CA. -type CASetupConfig struct { - VersionNumber uint `default:"0" help:"which identity version to use (0 is latest)"` - ParentCertPath string `help:"path to the parent authority's certificate chain"` - ParentKeyPath string `help:"path to the parent authority's private key"` - CertPath string `help:"path to the certificate chain for this identity" default:"$IDENTITYDIR/ca.cert"` - KeyPath string `help:"path to the private key for this identity" default:"$IDENTITYDIR/ca.key"` - Difficulty uint64 `help:"minimum difficulty for identity generation" default:"36"` - Timeout string `help:"timeout for CA generation; golang duration string (0 no timeout)" default:"5m"` - Overwrite bool `help:"if true, existing CA certs AND keys will overwritten" default:"false" setup:"true"` - Concurrency uint `help:"number of concurrent workers for certificate authority generation" default:"4"` -} - -// NewCAOptions is used to pass parameters to `NewCA`. -type NewCAOptions struct { - // VersionNumber is the IDVersion to use for the identity - VersionNumber storj.IDVersionNumber - // Difficulty is the number of trailing zero-bits the nodeID must have - Difficulty uint16 - // Concurrency is the number of go routines used to generate a CA of sufficient difficulty - Concurrency uint - // ParentCert, if provided will be prepended to the certificate chain - ParentCert *x509.Certificate - // ParentKey () - ParentKey crypto.PrivateKey - // Logger is used to log generation status updates - Logger io.Writer -} - -// PeerCAConfig is for locating a CA certificate without a private key. -type PeerCAConfig struct { - CertPath string `help:"path to the certificate chain for this identity" default:"$IDENTITYDIR/ca.cert"` -} - -// FullCAConfig is for locating a CA certificate and it's private key. -type FullCAConfig struct { - CertPath string `help:"path to the certificate chain for this identity" default:"$IDENTITYDIR/ca.cert"` - KeyPath string `help:"path to the private key for this identity" default:"$IDENTITYDIR/ca.key"` -} - -// NewCA creates a new full identity with the given difficulty. -func NewCA(ctx context.Context, opts NewCAOptions) (_ *FullCertificateAuthority, err error) { - defer mon.Task()(&ctx)(&err) - var ( - highscore = new(uint32) - i = new(uint32) - - mu sync.Mutex - selectedKey crypto.PrivateKey - selectedID storj.NodeID - ) - - if opts.Concurrency < 1 { - opts.Concurrency = 1 - } - - if opts.Logger != nil { - fmt.Fprintf(opts.Logger, "Generating key with a minimum a difficulty of %d...\n", opts.Difficulty) - } - - version, err := storj.GetIDVersion(opts.VersionNumber) - if err != nil { - return nil, err - } - - updateStatus := func() { - if opts.Logger != nil { - count := atomic.LoadUint32(i) - hs := atomic.LoadUint32(highscore) - _, err := fmt.Fprintf(opts.Logger, "\rGenerated %d keys; best difficulty so far: %d", count, hs) - if err != nil { - log.Print(errs.Wrap(err)) - } - } - } - err = GenerateKeys(ctx, minimumLoggableDifficulty, int(opts.Concurrency), version, - func(k crypto.PrivateKey, id storj.NodeID) (done bool, err error) { - if opts.Logger != nil { - if atomic.AddUint32(i, 1)%100 == 0 { - updateStatus() - } - } - - difficulty, err := id.Difficulty() - if err != nil { - return false, err - } - if difficulty >= opts.Difficulty { - mu.Lock() - if selectedKey == nil { - updateStatus() - selectedKey = k - selectedID = id - } - mu.Unlock() - if opts.Logger != nil { - atomic.SwapUint32(highscore, uint32(difficulty)) - updateStatus() - _, err := fmt.Fprintf(opts.Logger, "\nFound a key with difficulty %d!\n", difficulty) - if err != nil { - log.Print(errs.Wrap(err)) - } - } - return true, nil - } - for { - hs := atomic.LoadUint32(highscore) - if uint32(difficulty) <= hs { - return false, nil - } - if atomic.CompareAndSwapUint32(highscore, hs, uint32(difficulty)) { - updateStatus() - return false, nil - } - } - }) - if err != nil { - return nil, err - } - - ct, err := peertls.CATemplate() - if err != nil { - return nil, err - } - - if err := extensions.AddExtraExtension(ct, storj.NewVersionExt(version)); err != nil { - return nil, err - } - - var cert *x509.Certificate - if opts.ParentKey == nil { - cert, err = peertls.CreateSelfSignedCertificate(selectedKey, ct) - } else { - var pubKey crypto.PublicKey - pubKey, err = pkcrypto.PublicKeyFromPrivate(selectedKey) - if err != nil { - return nil, err - } - cert, err = peertls.CreateCertificate(pubKey, opts.ParentKey, ct, opts.ParentCert) - } - if err != nil { - return nil, err - } - - ca := &FullCertificateAuthority{ - Cert: cert, - Key: selectedKey, - ID: selectedID, - } - if opts.ParentCert != nil { - ca.RestChain = []*x509.Certificate{opts.ParentCert} - } - return ca, nil -} - -// Status returns the status of the CA cert/key files for the config. -func (caS CASetupConfig) Status() (TLSFilesStatus, error) { - return statTLSFiles(caS.CertPath, caS.KeyPath) -} - -// Create generates and saves a CA using the config. -func (caS CASetupConfig) Create(ctx context.Context, logger io.Writer) (*FullCertificateAuthority, error) { - var ( - err error - parent *FullCertificateAuthority - ) - if caS.ParentCertPath != "" && caS.ParentKeyPath != "" { - parent, err = FullCAConfig{ - CertPath: caS.ParentCertPath, - KeyPath: caS.ParentKeyPath, - }.Load() - if err != nil { - return nil, err - } - } - - if parent == nil { - parent = &FullCertificateAuthority{} - } - - version, err := storj.GetIDVersion(storj.IDVersionNumber(caS.VersionNumber)) - if err != nil { - return nil, err - } - - ca, err := NewCA(ctx, NewCAOptions{ - VersionNumber: version.Number, - Difficulty: uint16(caS.Difficulty), - Concurrency: caS.Concurrency, - ParentCert: parent.Cert, - ParentKey: parent.Key, - Logger: logger, - }) - if err != nil { - return nil, err - } - caC := FullCAConfig{ - CertPath: caS.CertPath, - KeyPath: caS.KeyPath, - } - return ca, caC.Save(ca) -} - -// FullConfig converts a `CASetupConfig` to `FullCAConfig`. -func (caS CASetupConfig) FullConfig() FullCAConfig { - return FullCAConfig{ - CertPath: caS.CertPath, - KeyPath: caS.KeyPath, - } -} - -// Load loads a CA from the given configuration. -func (fc FullCAConfig) Load() (*FullCertificateAuthority, error) { - p, err := fc.PeerConfig().Load() - if err != nil { - return nil, err - } - - kb, err := ioutil.ReadFile(fc.KeyPath) - if err != nil { - return nil, peertls.ErrNotExist.Wrap(err) - } - k, err := pkcrypto.PrivateKeyFromPEM(kb) - if err != nil { - return nil, err - } - - return &FullCertificateAuthority{ - RestChain: p.RestChain, - Cert: p.Cert, - Key: k, - ID: p.ID, - }, nil -} - -// PeerConfig converts a full ca config to a peer ca config. -func (fc FullCAConfig) PeerConfig() PeerCAConfig { - return PeerCAConfig{ - CertPath: fc.CertPath, - } -} - -// Save saves a CA with the given configuration. -func (fc FullCAConfig) Save(ca *FullCertificateAuthority) error { - var ( - keyData bytes.Buffer - writeErrs errs.Group - ) - if err := fc.PeerConfig().Save(ca.PeerCA()); err != nil { - writeErrs.Add(err) - return writeErrs.Err() - } - - if fc.KeyPath != "" { - if err := pkcrypto.WritePrivateKeyPEM(&keyData, ca.Key); err != nil { - writeErrs.Add(err) - return writeErrs.Err() - } - if err := writeKeyData(fc.KeyPath, keyData.Bytes()); err != nil { - writeErrs.Add(err) - return writeErrs.Err() - } - } - - return writeErrs.Err() -} - -// SaveBackup saves the certificate of the config wth a timestamped filename. -func (fc FullCAConfig) SaveBackup(ca *FullCertificateAuthority) error { - return FullCAConfig{ - CertPath: backupPath(fc.CertPath), - KeyPath: backupPath(fc.KeyPath), - }.Save(ca) -} - -// Load loads a CA from the given configuration. -func (pc PeerCAConfig) Load() (*PeerCertificateAuthority, error) { - chainPEM, err := ioutil.ReadFile(pc.CertPath) - if err != nil { - return nil, peertls.ErrNotExist.Wrap(err) - } - - chain, err := pkcrypto.CertsFromPEM(chainPEM) - if err != nil { - return nil, errs.New("failed to load identity %#v: %v", - pc.CertPath, err) - } - - // NB: `CAIndex` is in the context of a complete chain (incl. leaf). - // Here we're loading the CA chain (i.e. without leaf). - nodeID, err := NodeIDFromCert(chain[peertls.CAIndex-1]) - if err != nil { - return nil, err - } - - return &PeerCertificateAuthority{ - // NB: `CAIndex` is in the context of a complete chain (incl. leaf). - // Here we're loading the CA chain (i.e. without leaf). - RestChain: chain[peertls.CAIndex:], - Cert: chain[peertls.CAIndex-1], - ID: nodeID, - }, nil -} - -// Save saves a peer CA (cert, no key) with the given configuration. -func (pc PeerCAConfig) Save(ca *PeerCertificateAuthority) error { - var ( - certData bytes.Buffer - writeErrs errs.Group - ) - - chain := []*x509.Certificate{ca.Cert} - chain = append(chain, ca.RestChain...) - - if pc.CertPath != "" { - if err := peertls.WriteChain(&certData, chain...); err != nil { - writeErrs.Add(err) - return writeErrs.Err() - } - if err := writeChainData(pc.CertPath, certData.Bytes()); err != nil { - writeErrs.Add(err) - return writeErrs.Err() - } - } - return nil -} - -// SaveBackup saves the certificate of the config wth a timestamped filename. -func (pc PeerCAConfig) SaveBackup(ca *PeerCertificateAuthority) error { - return PeerCAConfig{ - CertPath: backupPath(pc.CertPath), - }.Save(ca) -} - -// NewIdentity generates a new `FullIdentity` based on the CA. The CA -// cert is included in the identity's cert chain and the identity's leaf cert -// is signed by the CA. -func (ca *FullCertificateAuthority) NewIdentity(exts ...pkix.Extension) (*FullIdentity, error) { - leafTemplate, err := peertls.LeafTemplate() - if err != nil { - return nil, err - } - // TODO: add test for this! - version, err := ca.Version() - if err != nil { - return nil, err - } - leafKey, err := version.NewPrivateKey() - if err != nil { - return nil, err - } - - if err := extensions.AddExtraExtension(leafTemplate, exts...); err != nil { - return nil, err - } - - pubKey, err := pkcrypto.PublicKeyFromPrivate(leafKey) - if err != nil { - return nil, err - } - - leafCert, err := peertls.CreateCertificate(pubKey, ca.Key, leafTemplate, ca.Cert) - if err != nil { - return nil, err - } - - return &FullIdentity{ - RestChain: ca.RestChain, - CA: ca.Cert, - Leaf: leafCert, - Key: leafKey, - ID: ca.ID, - }, nil - -} - -// Chain returns the CA's certificate chain. -func (ca *FullCertificateAuthority) Chain() []*x509.Certificate { - return append([]*x509.Certificate{ca.Cert}, ca.RestChain...) -} - -// RawChain returns the CA's certificate chain as a 2d byte slice. -func (ca *FullCertificateAuthority) RawChain() [][]byte { - chain := ca.Chain() - rawChain := make([][]byte, len(chain)) - for i, cert := range chain { - rawChain[i] = cert.Raw - } - return rawChain -} - -// RawRestChain returns the "rest" (excluding `ca.Cert`) of the certificate chain as a 2d byte slice. -func (ca *FullCertificateAuthority) RawRestChain() [][]byte { - var chain [][]byte - for _, cert := range ca.RestChain { - chain = append(chain, cert.Raw) - } - return chain -} - -// PeerCA converts a FullCertificateAuthority to a PeerCertificateAuthority. -func (ca *FullCertificateAuthority) PeerCA() *PeerCertificateAuthority { - return &PeerCertificateAuthority{ - Cert: ca.Cert, - ID: ca.ID, - RestChain: ca.RestChain, - } -} - -// Sign signs the passed certificate with ca certificate. -func (ca *FullCertificateAuthority) Sign(cert *x509.Certificate) (*x509.Certificate, error) { - signedCert, err := peertls.CreateCertificate(cert.PublicKey, ca.Key, cert, ca.Cert) - if err != nil { - return nil, errs.Wrap(err) - } - return signedCert, nil -} - -// Version looks up the version based on the certificate's ID version extension. -func (ca *FullCertificateAuthority) Version() (storj.IDVersion, error) { - return storj.IDVersionFromCert(ca.Cert) -} - -// AddExtension adds extensions to certificate authority certificate. Extensions -// are serialized into the certificate's raw bytes and it is re-signed by itself. -func (ca *FullCertificateAuthority) AddExtension(exts ...pkix.Extension) error { - // TODO: how to properly handle this? - if len(ca.RestChain) > 0 { - return errs.New("adding extensions requires parent certificate's private key") - } - - if err := extensions.AddExtraExtension(ca.Cert, exts...); err != nil { - return err - } - - updatedCert, err := peertls.CreateSelfSignedCertificate(ca.Key, ca.Cert) - if err != nil { - return err - } - - ca.Cert = updatedCert - return nil -} - -// Revoke extends the certificate authority certificate with a certificate revocation extension. -func (ca *FullCertificateAuthority) Revoke() error { - ext, err := extensions.NewRevocationExt(ca.Key, ca.Cert) - if err != nil { - return err - } - - return ca.AddExtension(ext) -} diff --git a/vendor/storj.io/common/identity/common.go b/vendor/storj.io/common/identity/common.go deleted file mode 100644 index 2a35c6c94..000000000 --- a/vendor/storj.io/common/identity/common.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package identity - -import ( - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" -) - -var ( - mon = monkit.Package() - - // Error is a pkg/identity error - Error = errs.Class("identity error") -) diff --git a/vendor/storj.io/common/identity/doc.go b/vendor/storj.io/common/identity/doc.go deleted file mode 100644 index f692c4709..000000000 --- a/vendor/storj.io/common/identity/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package identity implements CA and Peer identity management and generation. -package identity diff --git a/vendor/storj.io/common/identity/generate.go b/vendor/storj.io/common/identity/generate.go deleted file mode 100644 index 70f5fbf7d..000000000 --- a/vendor/storj.io/common/identity/generate.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package identity - -import ( - "context" - "crypto" - - "storj.io/common/pkcrypto" - "storj.io/common/storj" -) - -// GenerateKey generates a private key with a node id with difficulty at least -// minDifficulty. No parallelism is used. -func GenerateKey(ctx context.Context, minDifficulty uint16, version storj.IDVersion) ( - k crypto.PrivateKey, id storj.NodeID, err error) { - defer mon.Task()(&ctx)(&err) - - var d uint16 - for { - err = ctx.Err() - if err != nil { - break - } - k, err = version.NewPrivateKey() - if err != nil { - break - } - - var pubKey crypto.PublicKey - pubKey, err = pkcrypto.PublicKeyFromPrivate(k) - if err != nil { - break - } - - id, err = NodeIDFromKey(pubKey, version) - if err != nil { - break - } - d, err = id.Difficulty() - if err != nil { - break - } - if d >= minDifficulty { - return k, id, nil - } - } - return k, id, storj.ErrNodeID.Wrap(err) -} - -// GenerateCallback indicates that key generation is done when done is true. -// if err != nil key generation will stop with that error. -type GenerateCallback func(crypto.PrivateKey, storj.NodeID) (done bool, err error) - -// GenerateKeys continues to generate keys until found returns done == false, -// or the ctx is canceled. -func GenerateKeys(ctx context.Context, minDifficulty uint16, concurrency int, version storj.IDVersion, found GenerateCallback) (err error) { - defer mon.Task()(&ctx)(&err) - ctx, cancel := context.WithCancel(ctx) - defer cancel() - errchan := make(chan error, concurrency) - - for i := 0; i < concurrency; i++ { - go func() { - for { - k, id, err := GenerateKey(ctx, minDifficulty, version) - if err != nil { - errchan <- err - return - } - - done, err := found(k, id) - if err != nil { - errchan <- err - return - } - if done { - errchan <- nil - return - } - } - }() - } - - // we only care about the first error. the rest of the errors will be - // context cancellation errors - return <-errchan -} diff --git a/vendor/storj.io/common/identity/identity.go b/vendor/storj.io/common/identity/identity.go deleted file mode 100644 index dd65fdb36..000000000 --- a/vendor/storj.io/common/identity/identity.go +++ /dev/null @@ -1,547 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package identity - -import ( - "bytes" - "context" - "crypto" - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - "fmt" - "io/ioutil" - "path/filepath" - "strconv" - "strings" - "time" - - "github.com/zeebo/errs" - - "storj.io/common/peertls" - "storj.io/common/peertls/extensions" - "storj.io/common/pkcrypto" - "storj.io/common/rpc/rpcpeer" - "storj.io/common/storj" -) - -// PeerIdentity represents another peer on the network. -type PeerIdentity struct { - RestChain []*x509.Certificate - // CA represents the peer's self-signed CA. - CA *x509.Certificate - // Leaf represents the leaf they're currently using. The leaf should be - // signed by the CA. The leaf is what is used for communication. - Leaf *x509.Certificate - // The ID taken from the CA public key. - ID storj.NodeID -} - -// FullIdentity represents you on the network. In addition to a PeerIdentity, -// a FullIdentity also has a Key, which a PeerIdentity doesn't have. -type FullIdentity struct { - RestChain []*x509.Certificate - // CA represents the peer's self-signed CA. The ID is taken from this cert. - CA *x509.Certificate - // Leaf represents the leaf they're currently using. The leaf should be - // signed by the CA. The leaf is what is used for communication. - Leaf *x509.Certificate - // The ID taken from the CA public key. - ID storj.NodeID - // Key is the key this identity uses with the leaf for communication. - Key crypto.PrivateKey -} - -// ManageablePeerIdentity is a `PeerIdentity` and its corresponding `FullCertificateAuthority` -// in a single struct. It is used for making changes to the identity that require CA -// authorization; e.g. adding extensions. -type ManageablePeerIdentity struct { - *PeerIdentity - CA *FullCertificateAuthority -} - -// ManageableFullIdentity is a `FullIdentity` and its corresponding `FullCertificateAuthority` -// in a single struct. It is used for making changes to the identity that require CA -// authorization and the leaf private key; e.g. revoking a leaf cert (private key changes). -type ManageableFullIdentity struct { - *FullIdentity - CA *FullCertificateAuthority -} - -// SetupConfig allows you to run a set of Responsibilities with the given -// identity. You can also just load an Identity from disk. -type SetupConfig struct { - CertPath string `help:"path to the certificate chain for this identity" default:"$IDENTITYDIR/identity.cert" path:"true"` - KeyPath string `help:"path to the private key for this identity" default:"$IDENTITYDIR/identity.key" path:"true"` - Overwrite bool `help:"if true, existing identity certs AND keys will overwritten for" default:"false" setup:"true"` - Version string `help:"semantic version of identity storage format" default:"0"` -} - -// Config allows you to run a set of Responsibilities with the given -// identity. You can also just load an Identity from disk. -type Config struct { - CertPath string `help:"path to the certificate chain for this identity" default:"$IDENTITYDIR/identity.cert" user:"true" path:"true"` - KeyPath string `help:"path to the private key for this identity" default:"$IDENTITYDIR/identity.key" user:"true" path:"true"` -} - -// PeerConfig allows you to interact with a peer identity (cert, no key) on disk. -type PeerConfig struct { - CertPath string `help:"path to the certificate chain for this identity" default:"$IDENTITYDIR/identity.cert" user:"true" path:"true"` -} - -// FullCertificateAuthorityFromPEM loads a FullIdentity from a certificate chain and -// private key PEM-encoded bytes. -func FullCertificateAuthorityFromPEM(chainPEM, keyPEM []byte) (*FullCertificateAuthority, error) { - peerCA, err := PeerCertificateAuthorityFromPEM(chainPEM) - if err != nil { - return nil, err - } - - // NB: there shouldn't be multiple keys in the key file but if there - // are, this uses the first one - key, err := pkcrypto.PrivateKeyFromPEM(keyPEM) - if err != nil { - return nil, err - } - - return &FullCertificateAuthority{ - RestChain: peerCA.RestChain, - Cert: peerCA.Cert, - Key: key, - ID: peerCA.ID, - }, nil -} - -// PeerCertificateAuthorityFromPEM loads a FullIdentity from a certificate chain and -// private key PEM-encoded bytes. -func PeerCertificateAuthorityFromPEM(chainPEM []byte) (*PeerCertificateAuthority, error) { - chain, err := pkcrypto.CertsFromPEM(chainPEM) - if err != nil { - return nil, errs.Wrap(err) - } - // NB: the "leaf" cert in a CA chain is the "CA" cert in an identity chain - nodeID, err := NodeIDFromCert(chain[peertls.LeafIndex]) - if err != nil { - return nil, err - } - - return &PeerCertificateAuthority{ - RestChain: chain[peertls.CAIndex:], - Cert: chain[peertls.LeafIndex], - ID: nodeID, - }, nil -} - -// FullIdentityFromPEM loads a FullIdentity from a certificate chain and -// private key PEM-encoded bytes. -func FullIdentityFromPEM(chainPEM, keyPEM []byte) (*FullIdentity, error) { - peerIdent, err := PeerIdentityFromPEM(chainPEM) - if err != nil { - return nil, err - } - - // NB: there shouldn't be multiple keys in the key file but if there - // are, this uses the first one - key, err := pkcrypto.PrivateKeyFromPEM(keyPEM) - if err != nil { - return nil, err - } - - return &FullIdentity{ - RestChain: peerIdent.RestChain, - CA: peerIdent.CA, - Leaf: peerIdent.Leaf, - Key: key, - ID: peerIdent.ID, - }, nil -} - -// PeerIdentityFromPEM loads a PeerIdentity from a certificate chain and -// private key PEM-encoded bytes. -func PeerIdentityFromPEM(chainPEM []byte) (*PeerIdentity, error) { - chain, err := pkcrypto.CertsFromPEM(chainPEM) - if err != nil { - return nil, errs.Wrap(err) - } - if len(chain) < peertls.CAIndex+1 { - return nil, pkcrypto.ErrChainLength.New("identity chain does not contain a CA certificate") - } - nodeID, err := NodeIDFromCert(chain[peertls.CAIndex]) - if err != nil { - return nil, err - } - - return &PeerIdentity{ - RestChain: chain[peertls.CAIndex+1:], - CA: chain[peertls.CAIndex], - Leaf: chain[peertls.LeafIndex], - ID: nodeID, - }, nil -} - -// PeerIdentityFromChain loads a PeerIdentity from an identity certificate chain. -func PeerIdentityFromChain(chain []*x509.Certificate) (*PeerIdentity, error) { - nodeID, err := NodeIDFromCert(chain[peertls.CAIndex]) - if err != nil { - return nil, err - } - - return &PeerIdentity{ - RestChain: chain[peertls.CAIndex+1:], - CA: chain[peertls.CAIndex], - ID: nodeID, - Leaf: chain[peertls.LeafIndex], - }, nil -} - -// PeerIdentityFromPeer loads a PeerIdentity from a peer connection. -func PeerIdentityFromPeer(peer *rpcpeer.Peer) (*PeerIdentity, error) { - chain := peer.State.PeerCertificates - if len(chain)-1 < peertls.CAIndex { - return nil, Error.New("invalid certificate chain") - } - pi, err := PeerIdentityFromChain(chain) - if err != nil { - return nil, err - } - return pi, nil -} - -// PeerIdentityFromContext loads a PeerIdentity from a ctx TLS credentials. -func PeerIdentityFromContext(ctx context.Context) (*PeerIdentity, error) { - peer, err := rpcpeer.FromContext(ctx) - if err != nil { - return nil, err - } - return PeerIdentityFromPeer(peer) -} - -// NodeIDFromCertPath loads a node ID from a certificate file path. -func NodeIDFromCertPath(certPath string) (storj.NodeID, error) { - /* #nosec G304 */ // Subsequent calls ensure that the file is a certificate - certBytes, err := ioutil.ReadFile(certPath) - if err != nil { - return storj.NodeID{}, err - } - return NodeIDFromPEM(certBytes) -} - -// NodeIDFromPEM loads a node ID from certificate bytes. -func NodeIDFromPEM(pemBytes []byte) (storj.NodeID, error) { - chain, err := pkcrypto.CertsFromPEM(pemBytes) - if err != nil { - return storj.NodeID{}, Error.New("invalid identity certificate") - } - if len(chain)-1 < peertls.CAIndex { - return storj.NodeID{}, Error.New("no CA in identity certificate") - } - return NodeIDFromCert(chain[peertls.CAIndex]) -} - -// NodeIDFromCert looks for a version in an ID version extension in the passed -// cert and then calculates a versioned node ID using the certificate public key. -// NB: `cert` would typically be an identity's certificate authority certificate. -func NodeIDFromCert(cert *x509.Certificate) (id storj.NodeID, err error) { - version, err := storj.IDVersionFromCert(cert) - if err != nil { - return id, Error.Wrap(err) - } - return NodeIDFromKey(cert.PublicKey, version) -} - -// NodeIDFromKey calculates the node ID for a given public key with the passed version. -func NodeIDFromKey(k crypto.PublicKey, version storj.IDVersion) (storj.NodeID, error) { - idBytes, err := peertls.DoubleSHA256PublicKey(k) - if err != nil { - return storj.NodeID{}, storj.ErrNodeID.Wrap(err) - } - return storj.NewVersionedID(idBytes, version), nil -} - -// NewFullIdentity creates a new ID for nodes with difficulty and concurrency params. -func NewFullIdentity(ctx context.Context, opts NewCAOptions) (*FullIdentity, error) { - ca, err := NewCA(ctx, opts) - if err != nil { - return nil, err - } - identity, err := ca.NewIdentity() - if err != nil { - return nil, err - } - return identity, err -} - -// ToChains takes a number of certificate chains and returns them as a 2d slice of chains of certificates. -func ToChains(chains ...[]*x509.Certificate) [][]*x509.Certificate { - combinedChains := make([][]*x509.Certificate, len(chains)) - copy(combinedChains, chains) - return combinedChains -} - -// NewManageablePeerIdentity returns a manageable identity given a full identity and a full certificate authority. -func NewManageablePeerIdentity(ident *PeerIdentity, ca *FullCertificateAuthority) *ManageablePeerIdentity { - return &ManageablePeerIdentity{ - PeerIdentity: ident, - CA: ca, - } -} - -// NewManageableFullIdentity returns a manageable identity given a full identity and a full certificate authority. -func NewManageableFullIdentity(ident *FullIdentity, ca *FullCertificateAuthority) *ManageableFullIdentity { - return &ManageableFullIdentity{ - FullIdentity: ident, - CA: ca, - } -} - -// Status returns the status of the identity cert/key files for the config. -func (is SetupConfig) Status() (TLSFilesStatus, error) { - return statTLSFiles(is.CertPath, is.KeyPath) -} - -// Create generates and saves a CA using the config. -func (is SetupConfig) Create(ca *FullCertificateAuthority) (*FullIdentity, error) { - fi, err := ca.NewIdentity() - if err != nil { - return nil, err - } - fi.CA = ca.Cert - ic := Config{ - CertPath: is.CertPath, - KeyPath: is.KeyPath, - } - return fi, ic.Save(fi) -} - -// FullConfig converts a `SetupConfig` to `Config`. -func (is SetupConfig) FullConfig() Config { - return Config{ - CertPath: is.CertPath, - KeyPath: is.KeyPath, - } -} - -// Load loads a FullIdentity from the config. -func (ic Config) Load() (*FullIdentity, error) { - c, err := ioutil.ReadFile(ic.CertPath) - if err != nil { - return nil, peertls.ErrNotExist.Wrap(err) - } - k, err := ioutil.ReadFile(ic.KeyPath) - if err != nil { - return nil, peertls.ErrNotExist.Wrap(err) - } - fi, err := FullIdentityFromPEM(c, k) - if err != nil { - return nil, errs.New("failed to load identity %#v, %#v: %v", - ic.CertPath, ic.KeyPath, err) - } - return fi, nil -} - -// Save saves a FullIdentity according to the config. -func (ic Config) Save(fi *FullIdentity) error { - var ( - certData, keyData bytes.Buffer - writeChainErr, writeChainDataErr, writeKeyErr, writeKeyDataErr error - ) - - chain := []*x509.Certificate{fi.Leaf, fi.CA} - chain = append(chain, fi.RestChain...) - - if ic.CertPath != "" { - writeChainErr = peertls.WriteChain(&certData, chain...) - writeChainDataErr = writeChainData(ic.CertPath, certData.Bytes()) - } - - if ic.KeyPath != "" { - writeKeyErr = pkcrypto.WritePrivateKeyPEM(&keyData, fi.Key) - writeKeyDataErr = writeKeyData(ic.KeyPath, keyData.Bytes()) - } - - writeErr := errs.Combine(writeChainErr, writeKeyErr) - if writeErr != nil { - return writeErr - } - - return errs.Combine( - writeChainDataErr, - writeKeyDataErr, - ) -} - -// SaveBackup saves the certificate of the config with a timestamped filename. -func (ic Config) SaveBackup(fi *FullIdentity) error { - return Config{ - CertPath: backupPath(ic.CertPath), - KeyPath: backupPath(ic.KeyPath), - }.Save(fi) -} - -// PeerConfig converts a Config to a PeerConfig. -func (ic Config) PeerConfig() *PeerConfig { - return &PeerConfig{ - CertPath: ic.CertPath, - } -} - -// Load loads a PeerIdentity from the config. -func (ic PeerConfig) Load() (*PeerIdentity, error) { - c, err := ioutil.ReadFile(ic.CertPath) - if err != nil { - return nil, peertls.ErrNotExist.Wrap(err) - } - pi, err := PeerIdentityFromPEM(c) - if err != nil { - return nil, errs.New("failed to load identity %#v: %v", ic.CertPath, err) - } - return pi, nil -} - -// Save saves a PeerIdentity according to the config. -func (ic PeerConfig) Save(peerIdent *PeerIdentity) error { - chain := []*x509.Certificate{peerIdent.Leaf, peerIdent.CA} - chain = append(chain, peerIdent.RestChain...) - - if ic.CertPath != "" { - var certData bytes.Buffer - err := peertls.WriteChain(&certData, chain...) - if err != nil { - return err - } - - return writeChainData(ic.CertPath, certData.Bytes()) - } - - return nil -} - -// SaveBackup saves the certificate of the config with a timestamped filename. -func (ic PeerConfig) SaveBackup(pi *PeerIdentity) error { - return PeerConfig{ - CertPath: backupPath(ic.CertPath), - }.Save(pi) -} - -// Chain returns the Identity's certificate chain. -func (fi *FullIdentity) Chain() []*x509.Certificate { - return append([]*x509.Certificate{fi.Leaf, fi.CA}, fi.RestChain...) -} - -// RawChain returns all of the certificate chain as a 2d byte slice. -func (fi *FullIdentity) RawChain() [][]byte { - chain := fi.Chain() - rawChain := make([][]byte, len(chain)) - for i, cert := range chain { - rawChain[i] = cert.Raw - } - return rawChain -} - -// RawRestChain returns the rest (excluding leaf and CA) of the certificate chain as a 2d byte slice. -func (fi *FullIdentity) RawRestChain() [][]byte { - rawChain := make([][]byte, len(fi.RestChain)) - for _, cert := range fi.RestChain { - rawChain = append(rawChain, cert.Raw) - } - return rawChain -} - -// PeerIdentity converts a FullIdentity into a PeerIdentity. -func (fi *FullIdentity) PeerIdentity() *PeerIdentity { - return &PeerIdentity{ - CA: fi.CA, - Leaf: fi.Leaf, - ID: fi.ID, - RestChain: fi.RestChain, - } -} - -// Version looks up the version based on the certificate's ID version extension. -func (fi *FullIdentity) Version() (storj.IDVersion, error) { - return storj.IDVersionFromCert(fi.CA) -} - -// AddExtension adds extensions to the leaf cert of an identity. Extensions -// are serialized into the certificate's raw bytes and is re-signed by it's -// certificate authority. -func (manageableIdent *ManageablePeerIdentity) AddExtension(ext ...pkix.Extension) error { - if err := extensions.AddExtraExtension(manageableIdent.Leaf, ext...); err != nil { - return err - } - - updatedCert, err := peertls.CreateCertificate(manageableIdent.Leaf.PublicKey, manageableIdent.CA.Key, manageableIdent.Leaf, manageableIdent.CA.Cert) - if err != nil { - return err - } - - manageableIdent.Leaf = updatedCert - return nil -} - -// Revoke extends the CA certificate with a certificate revocation extension. -func (manageableIdent *ManageableFullIdentity) Revoke() error { - ext, err := extensions.NewRevocationExt(manageableIdent.CA.Key, manageableIdent.Leaf) - if err != nil { - return err - } - - revokingIdent, err := manageableIdent.CA.NewIdentity(ext) - if err != nil { - return err - } - - manageableIdent.Leaf = revokingIdent.Leaf - - return nil -} - -func backupPath(path string) string { - pathExt := filepath.Ext(path) - base := strings.TrimSuffix(path, pathExt) - return fmt.Sprintf( - "%s.%s%s", - base, - strconv.Itoa(int(time.Now().Unix())), - pathExt, - ) -} - -// EncodePeerIdentity encodes the complete identity chain to bytes. -func EncodePeerIdentity(pi *PeerIdentity) []byte { - var chain []byte - chain = append(chain, pi.Leaf.Raw...) - chain = append(chain, pi.CA.Raw...) - for _, cert := range pi.RestChain { - chain = append(chain, cert.Raw...) - } - return chain -} - -// DecodePeerIdentity Decodes the bytes into complete identity chain. -func DecodePeerIdentity(ctx context.Context, chain []byte) (_ *PeerIdentity, err error) { - defer mon.Task()(&ctx)(&err) - - var certs []*x509.Certificate - for len(chain) > 0 { - var raw asn1.RawValue - var err error - - chain, err = asn1.Unmarshal(chain, &raw) - if err != nil { - return nil, Error.Wrap(err) - } - - cert, err := pkcrypto.CertFromDER(raw.FullBytes) - if err != nil { - return nil, Error.Wrap(err) - } - - certs = append(certs, cert) - } - if len(certs) < 2 { - return nil, Error.New("not enough certificates") - } - return PeerIdentityFromChain(certs) -} diff --git a/vendor/storj.io/common/identity/utils.go b/vendor/storj.io/common/identity/utils.go deleted file mode 100644 index f80901315..000000000 --- a/vendor/storj.io/common/identity/utils.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package identity - -import ( - "io/ioutil" - "os" - "path/filepath" - - "github.com/zeebo/errs" - - "storj.io/common/fpath" -) - -// TLSFilesStatus is the status of keys. -type TLSFilesStatus int - -// Four possible outcomes for four files. -const ( - NoCertNoKey = TLSFilesStatus(iota) - CertNoKey - NoCertKey - CertKey -) - -var ( - // ErrZeroBytes is returned for zero slice. - ErrZeroBytes = errs.New("byte slice was unexpectedly empty") -) - -// writeChainData writes data to path ensuring permissions are appropriate for a cert. -func writeChainData(path string, data []byte) error { - err := writeFile(path, 0744, 0644, data) - if err != nil { - return errs.New("unable to write certificate to \"%s\": %v", path, err) - } - return nil -} - -// writeKeyData writes data to path ensuring permissions are appropriate for a cert. -func writeKeyData(path string, data []byte) error { - err := writeFile(path, 0700, 0600, data) - if err != nil { - return errs.New("unable to write key to \"%s\": %v", path, err) - } - return nil -} - -// writeFile writes to path, creating directories and files with the necessary permissions. -func writeFile(path string, dirmode, filemode os.FileMode, data []byte) error { - if err := os.MkdirAll(filepath.Dir(path), dirmode); err != nil { - return errs.Wrap(err) - } - if writable, err := fpath.IsWritable(filepath.Dir(path)); !writable || err != nil { - return errs.Wrap(errs.New("%s is not a writeable directory: %s\n", path, err)) - } - if err := ioutil.WriteFile(path, data, filemode); err != nil { - return errs.Wrap(err) - } - - return nil -} - -func statTLSFiles(certPath, keyPath string) (status TLSFilesStatus, err error) { - hasKey := true - hasCert := true - - _, err = os.Stat(certPath) - if err != nil { - if os.IsNotExist(err) { - hasCert = false - } else { - return NoCertNoKey, err - } - } - - _, err = os.Stat(keyPath) - if err != nil { - if os.IsNotExist(err) { - hasKey = false - } else { - return NoCertNoKey, err - } - } - switch { - case hasCert && hasKey: - return CertKey, nil - case hasCert: - return CertNoKey, nil - case hasKey: - return NoCertKey, nil - } - - return NoCertNoKey, nil -} - -func (t TLSFilesStatus) String() string { - switch t { - case CertKey: - return "certificate and key" - case CertNoKey: - return "certificate" - case NoCertKey: - return "key" - } - return "" -} diff --git a/vendor/storj.io/common/macaroon/apikey.go b/vendor/storj.io/common/macaroon/apikey.go deleted file mode 100644 index 6ba391618..000000000 --- a/vendor/storj.io/common/macaroon/apikey.go +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package macaroon - -import ( - "bytes" - "context" - "time" - - "github.com/btcsuite/btcutil/base58" - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/common/pb" -) - -// revoker is supplied when checking a macaroon for validation. -type revoker interface { - // Check is intended to return a bool if any of the supplied tails are revoked. - Check(ctx context.Context, tails [][]byte) (bool, error) -} - -var ( - // Error is a general API Key error. - Error = errs.Class("api key error") - // ErrFormat means that the structural formatting of the API Key is invalid. - ErrFormat = errs.Class("api key format error") - // ErrInvalid means that the API Key is improperly signed. - ErrInvalid = errs.Class("api key invalid error") - // ErrUnauthorized means that the API key does not grant the requested permission. - ErrUnauthorized = errs.Class("api key unauthorized error") - // ErrRevoked means the API key has been revoked. - ErrRevoked = errs.Class("api key revocation error") - - mon = monkit.Package() -) - -// ActionType specifies the operation type being performed that the Macaroon will validate. -type ActionType int - -const ( - // not using iota because these values are persisted in macaroons. - _ ActionType = 0 - - // ActionRead specifies a read operation. - ActionRead ActionType = 1 - // ActionWrite specifies a read operation. - ActionWrite ActionType = 2 - // ActionList specifies a read operation. - ActionList ActionType = 3 - // ActionDelete specifies a read operation. - ActionDelete ActionType = 4 - // ActionProjectInfo requests project-level information. - ActionProjectInfo ActionType = 5 -) - -// Action specifies the specific operation being performed that the Macaroon will validate. -type Action struct { - Op ActionType - Bucket []byte - EncryptedPath []byte - Time time.Time -} - -// APIKey implements a Macaroon-backed Storj-v3 API key. -type APIKey struct { - mac *Macaroon -} - -// ParseAPIKey parses a given api key string and returns an APIKey if the -// APIKey was correctly formatted. It does not validate the key. -func ParseAPIKey(key string) (*APIKey, error) { - data, version, err := base58.CheckDecode(key) - if err != nil || version != 0 { - return nil, ErrFormat.New("invalid api key format") - } - mac, err := ParseMacaroon(data) - if err != nil { - return nil, ErrFormat.Wrap(err) - } - return &APIKey{mac: mac}, nil -} - -// ParseRawAPIKey parses raw api key data and returns an APIKey if the APIKey -// was correctly formatted. It does not validate the key. -func ParseRawAPIKey(data []byte) (*APIKey, error) { - mac, err := ParseMacaroon(data) - if err != nil { - return nil, ErrFormat.Wrap(err) - } - return &APIKey{mac: mac}, nil -} - -// NewAPIKey generates a brand new unrestricted API key given the provided. -// server project secret. -func NewAPIKey(secret []byte) (*APIKey, error) { - mac, err := NewUnrestricted(secret) - if err != nil { - return nil, Error.Wrap(err) - } - return &APIKey{mac: mac}, nil -} - -// Check makes sure that the key authorizes the provided action given the root -// project secret and any possible revocations, returning an error if the action -// is not authorized. 'revoked' is a list of revoked heads. -func (a *APIKey) Check(ctx context.Context, secret []byte, action Action, revoker revoker) (err error) { - defer mon.Task()(&ctx)(&err) - if !a.mac.Validate(secret) { - return ErrInvalid.New("macaroon unauthorized") - } - - // a timestamp is always required on an action - if action.Time.IsZero() { - return Error.New("no timestamp provided") - } - - caveats := a.mac.Caveats() - for _, cavbuf := range caveats { - var cav Caveat - err := pb.Unmarshal(cavbuf, &cav) - if err != nil { - return ErrFormat.New("invalid caveat format") - } - if !cav.Allows(action) { - return ErrUnauthorized.New("action disallowed") - } - } - - if revoker != nil { - revoked, err := revoker.Check(ctx, a.mac.Tails(secret)) - if err != nil { - return ErrRevoked.Wrap(err) - } - if revoked { - return ErrRevoked.New("contains revoked tail") - } - } - - return nil -} - -// AllowedBuckets stores information about which buckets are -// allowed to be accessed, where `Buckets` stores names of buckets that are -// allowed and `All` is a bool that indicates if all buckets are allowed or not. -type AllowedBuckets struct { - All bool - Buckets map[string]struct{} -} - -// GetAllowedBuckets returns a list of all the allowed bucket paths that match the Action operation. -func (a *APIKey) GetAllowedBuckets(ctx context.Context, action Action) (allowed AllowedBuckets, err error) { - defer mon.Task()(&ctx)(&err) - - // Every bucket is allowed until we find a caveat that restricts some paths. - allowed.All = true - - // every caveat that includes a list of allowed paths must include the bucket for - // the bucket to be allowed. in other words, the set of allowed buckets is the - // intersection of all of the buckets in the allowed paths. - for _, cavbuf := range a.mac.Caveats() { - var cav Caveat - err := pb.Unmarshal(cavbuf, &cav) - if err != nil { - return AllowedBuckets{}, ErrFormat.New("invalid caveat format: %v", err) - } - if !cav.Allows(action) { - return AllowedBuckets{}, ErrUnauthorized.New("action disallowed") - } - - // If the caveat does not include any allowed paths, then it is not restricting it. - if len(cav.AllowedPaths) == 0 { - continue - } - - // Since we found some path restrictions, it's definitely the case that not every - // bucket is allowed. - allowed.All = false - - caveatBuckets := map[string]struct{}{} - for _, caveatPath := range cav.AllowedPaths { - caveatBuckets[string(caveatPath.Bucket)] = struct{}{} - } - - if allowed.Buckets == nil { - allowed.Buckets = caveatBuckets - } else { - for bucket := range allowed.Buckets { - if _, ok := caveatBuckets[bucket]; !ok { - delete(allowed.Buckets, bucket) - } - } - } - } - - return allowed, err -} - -// Restrict generates a new APIKey with the provided Caveat attached. -func (a *APIKey) Restrict(caveat Caveat) (*APIKey, error) { - buf, err := pb.Marshal(&caveat) - if err != nil { - return nil, Error.Wrap(err) - } - mac, err := a.mac.AddFirstPartyCaveat(buf) - if err != nil { - return nil, Error.Wrap(err) - } - return &APIKey{mac: mac}, nil -} - -// Head returns the identifier for this macaroon's root ancestor. -func (a *APIKey) Head() []byte { - return a.mac.Head() -} - -// Tail returns the identifier for this macaroon only. -func (a *APIKey) Tail() []byte { - return a.mac.Tail() -} - -// Serialize serializes the API Key to a string. -func (a *APIKey) Serialize() string { - return base58.CheckEncode(a.mac.Serialize(), 0) -} - -// SerializeRaw serialize the API Key to raw bytes. -func (a *APIKey) SerializeRaw() []byte { - return a.mac.Serialize() -} - -// Allows returns true if the provided action is allowed by the caveat. -func (c *Caveat) Allows(action Action) bool { - // if the action is after the caveat's "not after" field, then it is invalid - if c.NotAfter != nil && action.Time.After(*c.NotAfter) { - return false - } - // if the caveat's "not before" field is *after* the action, then the action - // is before the "not before" field and it is invalid - if c.NotBefore != nil && c.NotBefore.After(action.Time) { - return false - } - - // we want to always allow reads for bucket metadata, perhaps filtered by the - // buckets in the allowed paths. - if action.Op == ActionRead && len(action.EncryptedPath) == 0 { - if len(c.AllowedPaths) == 0 { - return true - } - if len(action.Bucket) == 0 { - // if no action.bucket name is provided, then this call is checking that - // we can list all buckets. In that case, return true here and we will - // filter out buckets that aren't allowed later with `GetAllowedBuckets()` - return true - } - for _, path := range c.AllowedPaths { - if bytes.Equal(path.Bucket, action.Bucket) { - return true - } - } - return false - } - - switch action.Op { - case ActionRead: - if c.DisallowReads { - return false - } - case ActionWrite: - if c.DisallowWrites { - return false - } - case ActionList: - if c.DisallowLists { - return false - } - case ActionDelete: - if c.DisallowDeletes { - return false - } - case ActionProjectInfo: - // allow - default: - return false - } - - if len(c.AllowedPaths) > 0 && action.Op != ActionProjectInfo { - found := false - for _, path := range c.AllowedPaths { - if bytes.Equal(action.Bucket, path.Bucket) && - bytes.HasPrefix(action.EncryptedPath, path.EncryptedPathPrefix) { - found = true - break - } - } - if !found { - return false - } - } - - return true -} diff --git a/vendor/storj.io/common/macaroon/caveat.go b/vendor/storj.io/common/macaroon/caveat.go deleted file mode 100644 index 1d451a997..000000000 --- a/vendor/storj.io/common/macaroon/caveat.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package macaroon - -import ( - "crypto/rand" -) - -// NewCaveat returns a Caveat with a random generated nonce. -func NewCaveat() (Caveat, error) { - var buf [8]byte - _, err := rand.Read(buf[:]) - return Caveat{Nonce: buf[:]}, err -} diff --git a/vendor/storj.io/common/macaroon/doc.go b/vendor/storj.io/common/macaroon/doc.go deleted file mode 100644 index 0aa7ef854..000000000 --- a/vendor/storj.io/common/macaroon/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package macaroon implements contextual caveats and authorization. -package macaroon diff --git a/vendor/storj.io/common/macaroon/macaroon.go b/vendor/storj.io/common/macaroon/macaroon.go deleted file mode 100644 index acc1f50eb..000000000 --- a/vendor/storj.io/common/macaroon/macaroon.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package macaroon - -import ( - "crypto/hmac" - "crypto/rand" - "crypto/sha256" - "crypto/subtle" -) - -// Macaroon is a struct that determine contextual caveats and authorization. -type Macaroon struct { - head []byte - caveats [][]byte - tail []byte -} - -// NewUnrestricted creates Macaroon with random Head and generated Tail. -func NewUnrestricted(secret []byte) (*Macaroon, error) { - head, err := NewSecret() - if err != nil { - return nil, err - } - return &Macaroon{ - head: head, - tail: sign(secret, head), - }, nil -} - -func sign(secret []byte, data []byte) []byte { - signer := hmac.New(sha256.New, secret) - _, err := signer.Write(data) - if err != nil { - // Error skipped because sha256 does not return error - panic(err) - } - - return signer.Sum(nil) -} - -// NewSecret generates cryptographically random 32 bytes. -func NewSecret() (secret []byte, err error) { - secret = make([]byte, 32) - - _, err = rand.Read(secret) - if err != nil { - return nil, err - } - - return secret, nil -} - -// AddFirstPartyCaveat creates signed macaroon with appended caveat. -func (m *Macaroon) AddFirstPartyCaveat(c []byte) (macaroon *Macaroon, err error) { - macaroon = m.Copy() - - macaroon.caveats = append(macaroon.caveats, c) - macaroon.tail = sign(macaroon.tail, c) - - return macaroon, nil -} - -// Validate reconstructs with all caveats from the secret and compares tails, -// returning true if the tails match. -func (m *Macaroon) Validate(secret []byte) (ok bool) { - tail := sign(secret, m.head) - for _, cav := range m.caveats { - tail = sign(tail, cav) - } - - return subtle.ConstantTimeCompare(tail, m.tail) == 1 -} - -// Tails returns all ancestor tails up to and including the current tail. -func (m *Macaroon) Tails(secret []byte) [][]byte { - tails := make([][]byte, 0, len(m.caveats)+1) - tail := sign(secret, m.head) - tails = append(tails, tail) - for _, cav := range m.caveats { - tail = sign(tail, cav) - tails = append(tails, tail) - } - return tails -} - -// Head returns copy of macaroon head. -func (m *Macaroon) Head() (head []byte) { - if len(m.head) == 0 { - return nil - } - return append([]byte(nil), m.head...) -} - -// CaveatLen returns the number of caveats this macaroon has. -func (m *Macaroon) CaveatLen() int { - return len(m.caveats) -} - -// Caveats returns copy of macaroon caveats. -func (m *Macaroon) Caveats() (caveats [][]byte) { - if len(m.caveats) == 0 { - return nil - } - caveats = make([][]byte, 0, len(m.caveats)) - for _, cav := range m.caveats { - caveats = append(caveats, append([]byte(nil), cav...)) - } - return caveats -} - -// Tail returns copy of macaroon tail. -func (m *Macaroon) Tail() (tail []byte) { - if len(m.tail) == 0 { - return nil - } - return append([]byte(nil), m.tail...) -} - -// Copy return copy of macaroon. -func (m *Macaroon) Copy() *Macaroon { - return &Macaroon{ - head: m.Head(), - caveats: m.Caveats(), - tail: m.Tail(), - } -} diff --git a/vendor/storj.io/common/macaroon/serialize.go b/vendor/storj.io/common/macaroon/serialize.go deleted file mode 100644 index cc3e283e7..000000000 --- a/vendor/storj.io/common/macaroon/serialize.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package macaroon - -import ( - "encoding/binary" - "errors" -) - -type fieldType int - -const ( - fieldEOS fieldType = 0 - fieldLocation fieldType = 1 - fieldIdentifier fieldType = 2 - fieldVerificationID fieldType = 4 - fieldSignature fieldType = 6 -) - -const ( - version byte = 2 -) - -type packet struct { - fieldType fieldType - data []byte -} - -// Serialize converts macaroon to binary format. -func (m *Macaroon) Serialize() (data []byte) { - // Start data from version int - data = append(data, version) - - // Serilize Identity - data = serializePacket(data, packet{ - fieldType: fieldIdentifier, - data: m.head, - }) - data = append(data, 0) - - // Serialize caveats - for _, cav := range m.caveats { - data = serializePacket(data, packet{ - fieldType: fieldIdentifier, - data: cav, - }) - data = append(data, 0) - } - - data = append(data, 0) - - // Serialize tail - data = serializePacket(data, packet{ - fieldType: fieldSignature, - data: m.tail, - }) - - return data -} - -// serializePacket converts packet to binary. -func serializePacket(data []byte, p packet) []byte { - data = appendVarint(data, int(p.fieldType)) - data = appendVarint(data, len(p.data)) - data = append(data, p.data...) - - return data -} - -func appendVarint(data []byte, x int) []byte { - var buf [binary.MaxVarintLen32]byte - n := binary.PutUvarint(buf[:], uint64(x)) - - return append(data, buf[:n]...) -} - -// ParseMacaroon converts binary to macaroon. -func ParseMacaroon(data []byte) (_ *Macaroon, err error) { - if len(data) < 2 { - return nil, errors.New("empty macaroon") - } - if data[0] != version { - return nil, errors.New("invalid macaroon version") - } - // skip version - data = data[1:] - // Parse Location - data, section, err := parseSection(data) - if err != nil { - return nil, err - } - if len(section) > 0 && section[0].fieldType == fieldLocation { - section = section[1:] - } - if len(section) != 1 || section[0].fieldType != fieldIdentifier { - return nil, errors.New("invalid macaroon header") - } - - mac := Macaroon{} - mac.head = section[0].data - for { - rest, section, err := parseSection(data) - if err != nil { - return nil, err - } - data = rest - if len(section) == 0 { - break - } - if len(section) > 0 && section[0].fieldType == fieldLocation { - section = section[1:] - } - if len(section) == 0 || section[0].fieldType != fieldIdentifier { - return nil, errors.New("no Identifier in caveat") - } - cav := append([]byte(nil), section[0].data...) - section = section[1:] - if len(section) == 0 { - // First party caveat. - //if cav.Location != "" { - // return nil, errors.New("location not allowed in first party caveat") - //} - mac.caveats = append(mac.caveats, cav) - continue - } - if len(section) != 1 { - return nil, errors.New("extra fields found in caveat") - } - if section[0].fieldType != fieldVerificationID { - return nil, errors.New("invalid field found in caveat") - } - //cav.VerificationId = section[0].data - mac.caveats = append(mac.caveats, cav) - } - _, sig, err := parsePacket(data) - if err != nil { - return nil, err - } - if sig.fieldType != fieldSignature { - return nil, errors.New("unexpected field found instead of signature") - } - if len(sig.data) != 32 { - return nil, errors.New("signature has unexpected length") - } - mac.tail = make([]byte, 32) - copy(mac.tail, sig.data) - //return data, nil - // Parse Identity - // Parse caveats - // Parse tail - return &mac, nil -} - -// parseSection returns data leftover and packet array. -func parseSection(data []byte) ([]byte, []packet, error) { - prevFieldType := fieldType(-1) - var packets []packet - for { - if len(data) == 0 { - return nil, nil, errors.New("section extends past end of buffer") - } - rest, p, err := parsePacket(data) - if err != nil { - return nil, nil, err - } - if p.fieldType == fieldEOS { - return rest, packets, nil - } - if p.fieldType <= prevFieldType { - return nil, nil, errors.New("fields out of order") - } - packets = append(packets, p) - prevFieldType = p.fieldType - data = rest - } -} - -// parsePacket returns data leftover and packet. -func parsePacket(data []byte) ([]byte, packet, error) { - data, ft, err := parseVarint(data) - if err != nil { - return nil, packet{}, err - } - - p := packet{fieldType: fieldType(ft)} - if p.fieldType == fieldEOS { - return data, p, nil - } - data, packLen, err := parseVarint(data) - if err != nil { - return nil, packet{}, err - } - - if packLen > len(data) { - return nil, packet{}, errors.New("out of bounds") - } - if packLen == 0 { - p.data = nil - - return data, p, nil - } - - p.data = data[0:packLen] - - return data[packLen:], p, nil -} - -func parseVarint(data []byte) ([]byte, int, error) { - value, n := binary.Uvarint(data) - if n <= 0 || value > 0x7fffffff { - return nil, 0, errors.New("varint error") - } - return data[n:], int(value), nil -} diff --git a/vendor/storj.io/common/macaroon/types.pb.go b/vendor/storj.io/common/macaroon/types.pb.go deleted file mode 100644 index 6a04afaad..000000000 --- a/vendor/storj.io/common/macaroon/types.pb.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: types.proto - -package macaroon - -import ( - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Caveat struct { - // if any of these three are set, disallow that type of access - DisallowReads bool `protobuf:"varint,1,opt,name=disallow_reads,json=disallowReads,proto3" json:"disallow_reads,omitempty"` - DisallowWrites bool `protobuf:"varint,2,opt,name=disallow_writes,json=disallowWrites,proto3" json:"disallow_writes,omitempty"` - DisallowLists bool `protobuf:"varint,3,opt,name=disallow_lists,json=disallowLists,proto3" json:"disallow_lists,omitempty"` - DisallowDeletes bool `protobuf:"varint,4,opt,name=disallow_deletes,json=disallowDeletes,proto3" json:"disallow_deletes,omitempty"` - AllowedPaths []*Caveat_Path `protobuf:"bytes,10,rep,name=allowed_paths,json=allowedPaths,proto3" json:"allowed_paths,omitempty"` - // if set, the validity time window - NotAfter *time.Time `protobuf:"bytes,20,opt,name=not_after,json=notAfter,proto3,stdtime" json:"not_after,omitempty"` - NotBefore *time.Time `protobuf:"bytes,21,opt,name=not_before,json=notBefore,proto3,stdtime" json:"not_before,omitempty"` - // nonce is set to some random bytes so that you can make arbitrarily - // many restricted macaroons with the same (or no) restrictions. - Nonce []byte `protobuf:"bytes,30,opt,name=nonce,proto3" json:"nonce,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Caveat) Reset() { *m = Caveat{} } -func (m *Caveat) String() string { return proto.CompactTextString(m) } -func (*Caveat) ProtoMessage() {} -func (*Caveat) Descriptor() ([]byte, []int) { - return fileDescriptor_d938547f84707355, []int{0} -} -func (m *Caveat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Caveat.Unmarshal(m, b) -} -func (m *Caveat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Caveat.Marshal(b, m, deterministic) -} -func (m *Caveat) XXX_Merge(src proto.Message) { - xxx_messageInfo_Caveat.Merge(m, src) -} -func (m *Caveat) XXX_Size() int { - return xxx_messageInfo_Caveat.Size(m) -} -func (m *Caveat) XXX_DiscardUnknown() { - xxx_messageInfo_Caveat.DiscardUnknown(m) -} - -var xxx_messageInfo_Caveat proto.InternalMessageInfo - -func (m *Caveat) GetDisallowReads() bool { - if m != nil { - return m.DisallowReads - } - return false -} - -func (m *Caveat) GetDisallowWrites() bool { - if m != nil { - return m.DisallowWrites - } - return false -} - -func (m *Caveat) GetDisallowLists() bool { - if m != nil { - return m.DisallowLists - } - return false -} - -func (m *Caveat) GetDisallowDeletes() bool { - if m != nil { - return m.DisallowDeletes - } - return false -} - -func (m *Caveat) GetAllowedPaths() []*Caveat_Path { - if m != nil { - return m.AllowedPaths - } - return nil -} - -func (m *Caveat) GetNotAfter() *time.Time { - if m != nil { - return m.NotAfter - } - return nil -} - -func (m *Caveat) GetNotBefore() *time.Time { - if m != nil { - return m.NotBefore - } - return nil -} - -func (m *Caveat) GetNonce() []byte { - if m != nil { - return m.Nonce - } - return nil -} - -// If any entries exist, require all access to happen in at least -// one of them. -type Caveat_Path struct { - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPathPrefix []byte `protobuf:"bytes,2,opt,name=encrypted_path_prefix,json=encryptedPathPrefix,proto3" json:"encrypted_path_prefix,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Caveat_Path) Reset() { *m = Caveat_Path{} } -func (m *Caveat_Path) String() string { return proto.CompactTextString(m) } -func (*Caveat_Path) ProtoMessage() {} -func (*Caveat_Path) Descriptor() ([]byte, []int) { - return fileDescriptor_d938547f84707355, []int{0, 0} -} -func (m *Caveat_Path) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Caveat_Path.Unmarshal(m, b) -} -func (m *Caveat_Path) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Caveat_Path.Marshal(b, m, deterministic) -} -func (m *Caveat_Path) XXX_Merge(src proto.Message) { - xxx_messageInfo_Caveat_Path.Merge(m, src) -} -func (m *Caveat_Path) XXX_Size() int { - return xxx_messageInfo_Caveat_Path.Size(m) -} -func (m *Caveat_Path) XXX_DiscardUnknown() { - xxx_messageInfo_Caveat_Path.DiscardUnknown(m) -} - -var xxx_messageInfo_Caveat_Path proto.InternalMessageInfo - -func (m *Caveat_Path) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *Caveat_Path) GetEncryptedPathPrefix() []byte { - if m != nil { - return m.EncryptedPathPrefix - } - return nil -} - -func init() { - proto.RegisterType((*Caveat)(nil), "macaroon.Caveat") - proto.RegisterType((*Caveat_Path)(nil), "macaroon.Caveat.Path") -} - -func init() { proto.RegisterFile("types.proto", fileDescriptor_d938547f84707355) } - -var fileDescriptor_d938547f84707355 = []byte{ - // 343 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x50, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x25, 0xaf, 0x7d, 0xa5, 0xef, 0x36, 0x7d, 0xef, 0x31, 0xb6, 0x12, 0xb2, 0xb0, 0x41, 0x10, - 0xe3, 0x66, 0x0a, 0x75, 0x27, 0x88, 0x58, 0x5d, 0xba, 0x28, 0x83, 0xe0, 0x32, 0x4c, 0x92, 0x9b, - 0x34, 0x98, 0x66, 0xc2, 0xcc, 0xd4, 0xda, 0xbf, 0xf0, 0xd3, 0xfc, 0x03, 0x7f, 0x45, 0x66, 0xd2, - 0x04, 0xba, 0x73, 0x79, 0xce, 0x3d, 0xe7, 0xdc, 0x7b, 0x0f, 0x8c, 0xf4, 0xbe, 0x46, 0x45, 0x6b, - 0x29, 0xb4, 0x20, 0xc3, 0x0d, 0x4f, 0xb8, 0x14, 0xa2, 0xf2, 0x21, 0x17, 0xb9, 0x68, 0x58, 0x7f, - 0x96, 0x0b, 0x91, 0x97, 0x38, 0xb7, 0x28, 0xde, 0x66, 0x73, 0x5d, 0x6c, 0x50, 0x69, 0xbe, 0xa9, - 0x1b, 0xc1, 0xf9, 0x67, 0x0f, 0x06, 0x0f, 0xfc, 0x0d, 0xb9, 0x26, 0x17, 0xf0, 0x37, 0x2d, 0x14, - 0x2f, 0x4b, 0xb1, 0x8b, 0x24, 0xf2, 0x54, 0x79, 0x4e, 0xe0, 0x84, 0x43, 0x36, 0x6e, 0x59, 0x66, - 0x48, 0x72, 0x09, 0xff, 0x3a, 0xd9, 0x4e, 0x16, 0x1a, 0x95, 0xf7, 0xcb, 0xea, 0x3a, 0xf7, 0x8b, - 0x65, 0x8f, 0xf2, 0xca, 0x42, 0x69, 0xe5, 0xf5, 0x8e, 0xf3, 0x9e, 0x0c, 0x49, 0xae, 0xe0, 0x7f, - 0x27, 0x4b, 0xb1, 0x44, 0x13, 0xd8, 0xb7, 0xc2, 0x6e, 0xcf, 0x63, 0x43, 0x93, 0x1b, 0x18, 0x5b, - 0x8c, 0x69, 0x54, 0x73, 0xbd, 0x56, 0x1e, 0x04, 0xbd, 0x70, 0xb4, 0x98, 0xd2, 0xf6, 0x77, 0xda, - 0xbc, 0x42, 0x57, 0x5c, 0xaf, 0x99, 0x7b, 0xd0, 0x1a, 0xa0, 0xc8, 0x2d, 0xfc, 0xa9, 0x84, 0x8e, - 0x78, 0xa6, 0x51, 0x7a, 0x93, 0xc0, 0x09, 0x47, 0x0b, 0x9f, 0x36, 0xed, 0xd0, 0xb6, 0x1d, 0xfa, - 0xdc, 0xb6, 0xb3, 0xec, 0x7f, 0x7c, 0xcd, 0x1c, 0x36, 0xac, 0x84, 0xbe, 0x37, 0x0e, 0x72, 0x07, - 0x60, 0xec, 0x31, 0x66, 0x42, 0xa2, 0x37, 0xfd, 0xa1, 0xdf, 0xac, 0x5c, 0x5a, 0x0b, 0x99, 0xc0, - 0xef, 0x4a, 0x54, 0x09, 0x7a, 0x67, 0x81, 0x13, 0xba, 0xac, 0x01, 0x3e, 0x83, 0xbe, 0x39, 0x8f, - 0x9c, 0xc2, 0x20, 0xde, 0x26, 0xaf, 0xa8, 0x6d, 0xe7, 0x2e, 0x3b, 0x20, 0xb2, 0x80, 0x29, 0x56, - 0x89, 0xdc, 0xd7, 0xfa, 0xf0, 0x73, 0x54, 0x4b, 0xcc, 0x8a, 0x77, 0x5b, 0xb9, 0xcb, 0x4e, 0xba, - 0xa1, 0x49, 0x59, 0xd9, 0x51, 0x3c, 0xb0, 0xe7, 0x5c, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xca, - 0x7b, 0x7d, 0xfc, 0x1f, 0x02, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/macaroon/types.proto b/vendor/storj.io/common/macaroon/types.proto deleted file mode 100644 index c71567d92..000000000 --- a/vendor/storj.io/common/macaroon/types.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; - -package macaroon; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -message Caveat { - // if any of these three are set, disallow that type of access - bool disallow_reads = 1; - bool disallow_writes = 2; - bool disallow_lists = 3; - bool disallow_deletes = 4; - - // If any entries exist, require all access to happen in at least - // one of them. - message Path { - bytes bucket = 1; - bytes encrypted_path_prefix = 2; - } - repeated Path allowed_paths = 10; - - // if set, the validity time window - google.protobuf.Timestamp not_after = 20 [(gogoproto.stdtime) = true]; - google.protobuf.Timestamp not_before = 21 [(gogoproto.stdtime) = true]; - - // nonce is set to some random bytes so that you can make arbitrarily - // many restricted macaroons with the same (or no) restrictions. - bytes nonce = 30; -} diff --git a/vendor/storj.io/common/memory/doc.go b/vendor/storj.io/common/memory/doc.go deleted file mode 100644 index b7f3e0264..000000000 --- a/vendor/storj.io/common/memory/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package memory contains byte size types and manipulation. -package memory diff --git a/vendor/storj.io/common/memory/size.go b/vendor/storj.io/common/memory/size.go deleted file mode 100644 index cca376618..000000000 --- a/vendor/storj.io/common/memory/size.go +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package memory - -import ( - "errors" - "fmt" - "strconv" - "strings" -) - -// base 2 and base 10 sizes. -const ( - B Size = 1 << (10 * iota) - KiB - MiB - GiB - TiB - PiB - EiB - - KB Size = 1e3 - MB Size = 1e6 - GB Size = 1e9 - TB Size = 1e12 - PB Size = 1e15 - EB Size = 1e18 -) - -// Size implements flag.Value for collecting memory size in bytes. -type Size int64 - -// Int returns bytes size as int. -func (size Size) Int() int { return int(size) } - -// Int32 returns bytes size as int32. -func (size Size) Int32() int32 { return int32(size) } - -// Int64 returns bytes size as int64. -func (size Size) Int64() int64 { return int64(size) } - -// Float64 returns bytes size as float64. -func (size Size) Float64() float64 { return float64(size) } - -// KiB returns size in kibibytes. -func (size Size) KiB() float64 { return size.Float64() / KiB.Float64() } - -// MiB returns size in mebibytes. -func (size Size) MiB() float64 { return size.Float64() / MiB.Float64() } - -// GiB returns size in gibibytes. -func (size Size) GiB() float64 { return size.Float64() / GiB.Float64() } - -// TiB returns size in tebibytes. -func (size Size) TiB() float64 { return size.Float64() / TiB.Float64() } - -// PiB returns size in pebibytes. -func (size Size) PiB() float64 { return size.Float64() / PiB.Float64() } - -// EiB returns size in exbibytes. -func (size Size) EiB() float64 { return size.Float64() / EiB.Float64() } - -// KB returns size in kilobytes. -func (size Size) KB() float64 { return size.Float64() / KB.Float64() } - -// MB returns size in megabytes. -func (size Size) MB() float64 { return size.Float64() / MB.Float64() } - -// GB returns size in gigabytes. -func (size Size) GB() float64 { return size.Float64() / GB.Float64() } - -// TB returns size in terabytes. -func (size Size) TB() float64 { return size.Float64() / TB.Float64() } - -// PB returns size in petabytes. -func (size Size) PB() float64 { return size.Float64() / PB.Float64() } - -// EB returns size in exabytes. -func (size Size) EB() float64 { return size.Float64() / EB.Float64() } - -// String converts size to a string using base-2 prefixes, unless the number -// appears to be in base 10. -func (size Size) String() string { - if countZeros(int64(size), 1000) > countZeros(int64(size), 1024) { - return size.Base10String() - } - return size.Base2String() -} - -// countZeros considers a number num in base base. It counts zeros of that -// number in that base from least significant to most, stopping when a non-zero -// value is hit. -func countZeros(num, base int64) (count int) { - for num != 0 && num%base == 0 { - num /= base - count++ - } - return count -} - -// Base2String converts size to a string using base-2 prefixes. -func (size Size) Base2String() string { - if size == 0 { - return "0 B" - } - - switch { - case abs(size) >= EiB*2/3: - return fmt.Sprintf("%.1f EiB", size.EiB()) - case abs(size) >= PiB*2/3: - return fmt.Sprintf("%.1f PiB", size.PiB()) - case abs(size) >= TiB*2/3: - return fmt.Sprintf("%.1f TiB", size.TiB()) - case abs(size) >= GiB*2/3: - return fmt.Sprintf("%.1f GiB", size.GiB()) - case abs(size) >= MiB*2/3: - return fmt.Sprintf("%.1f MiB", size.MiB()) - case abs(size) >= KiB*2/3: - return fmt.Sprintf("%.1f KiB", size.KiB()) - } - - return strconv.FormatInt(size.Int64(), 10) + " B" -} - -// Base10String converts size to a string using base-10 prefixes. -func (size Size) Base10String() string { - if size == 0 { - return "0 B" - } - - switch { - case abs(size) >= EB*2/3: - return fmt.Sprintf("%.1f EB", size.EB()) - case abs(size) >= PB*2/3: - return fmt.Sprintf("%.1f PB", size.PB()) - case abs(size) >= TB*2/3: - return fmt.Sprintf("%.1f TB", size.TB()) - case abs(size) >= GB*2/3: - return fmt.Sprintf("%.1f GB", size.GB()) - case abs(size) >= MB*2/3: - return fmt.Sprintf("%.1f MB", size.MB()) - case abs(size) >= KB*2/3: - return fmt.Sprintf("%.1f KB", size.KB()) - } - - return strconv.FormatInt(size.Int64(), 10) + " B" -} - -func abs(size Size) Size { - if size > 0 { - return size - } - return -size -} - -func isLetter(b byte) bool { - return ('a' <= b && b <= 'z') || ('A' <= b && b <= 'Z') -} - -// Set updates value from string. -func (size *Size) Set(s string) error { - if s == "" { - return errors.New("empty size") - } - - p := len(s) - for isLetter(s[p-1]) { - p-- - - if p < 0 { - return errors.New("p out of bounds") - } - } - - value, suffix := s[:p], s[p:] - suffix = strings.ToUpper(suffix) - if suffix == "" || suffix[len(suffix)-1] != 'B' { - suffix += "B" - } - - value = strings.TrimSpace(value) - v, err := strconv.ParseFloat(value, 64) - if err != nil { - return err - } - - switch suffix { - case "EB": - *size = Size(v * EB.Float64()) - case "EIB": - *size = Size(v * EiB.Float64()) - case "PB": - *size = Size(v * PB.Float64()) - case "PIB": - *size = Size(v * PiB.Float64()) - case "TB": - *size = Size(v * TB.Float64()) - case "TIB": - *size = Size(v * TiB.Float64()) - case "GB": - *size = Size(v * GB.Float64()) - case "GIB": - *size = Size(v * GiB.Float64()) - case "MB": - *size = Size(v * MB.Float64()) - case "MIB": - *size = Size(v * MiB.Float64()) - case "KB": - *size = Size(v * KB.Float64()) - case "KIB": - *size = Size(v * KiB.Float64()) - case "B", "": - *size = Size(v) - default: - return fmt.Errorf("unknown suffix %q", suffix) - } - - return nil -} - -// Type implements pflag.Value. -func (Size) Type() string { return "memory.Size" } - -// MarshalText returns size as a string. -func (size Size) MarshalText() (string, error) { - return size.String(), nil -} - -// UnmarshalText parses text as a string. -func (size *Size) UnmarshalText(text []byte) error { - return size.Set(string(text)) -} - -// MarshalJSON returns size as a json string. -func (size Size) MarshalJSON() ([]byte, error) { - return []byte(strconv.Quote(size.String())), nil -} - -// UnmarshalJSON parses text from a json string. -func (size *Size) UnmarshalJSON(text []byte) error { - unquoted, err := strconv.Unquote(string(text)) - if err != nil { - return err - } - return size.Set(unquoted) -} diff --git a/vendor/storj.io/common/memory/sizes.go b/vendor/storj.io/common/memory/sizes.go deleted file mode 100644 index 021acbd34..000000000 --- a/vendor/storj.io/common/memory/sizes.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package memory - -import "strings" - -// Sizes implements flag.Value for collecting memory size. -type Sizes struct { - Default []Size - Custom []Size -} - -// Sizes returns the loaded values. -func (sizes Sizes) Sizes() []Size { - if len(sizes.Custom) > 0 { - return sizes.Custom - } - return sizes.Default -} - -// String converts values to a string. -func (sizes Sizes) String() string { - sz := sizes.Sizes() - xs := make([]string, len(sz)) - for i, size := range sz { - xs[i] = size.String() - } - return strings.Join(xs, " ") -} - -// Set adds values from byte values. -func (sizes *Sizes) Set(s string) error { - for _, x := range strings.Fields(s) { - var size Size - if err := size.Set(x); err != nil { - return err - } - sizes.Custom = append(sizes.Custom, size) - } - return nil -} diff --git a/vendor/storj.io/common/memory/string.go b/vendor/storj.io/common/memory/string.go deleted file mode 100644 index e4a4d561f..000000000 --- a/vendor/storj.io/common/memory/string.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package memory - -// FormatBytes converts number of bytes to appropriately sized string. -func FormatBytes(bytes int64) string { - return Size(bytes).String() -} - -// ParseString converts string to number of bytes. -func ParseString(s string) (int64, error) { - var size Size - err := size.Set(s) - return size.Int64(), err -} diff --git a/vendor/storj.io/common/netutil/common.go b/vendor/storj.io/common/netutil/common.go deleted file mode 100644 index 9b9b147ae..000000000 --- a/vendor/storj.io/common/netutil/common.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package netutil - -import "github.com/spacemonkeygo/monkit/v3" - -var mon = monkit.Package() diff --git a/vendor/storj.io/common/netutil/timeout_linux.go b/vendor/storj.io/common/netutil/timeout_linux.go deleted file mode 100644 index 381172f3b..000000000 --- a/vendor/storj.io/common/netutil/timeout_linux.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build linux - -package netutil - -import ( - "errors" - "net" - "syscall" - "time" - - "golang.org/x/sys/unix" -) - -// SetUserTimeout sets the TCP_USER_TIMEOUT setting on the provided conn. -func SetUserTimeout(conn *net.TCPConn, timeout time.Duration) error { - // By default from Go, keep alive period + idle are ~15sec. The default - // keep count is 8 according to some kernel docs. That means it should - // fail after ~120 seconds. Unfortunately, keep alive only happens if - // there is no send-q on the socket, and so a slow reader can still cause - // hanging sockets forever. By setting user timeout, we will kill the - // connection if any writes go unacknowledged for the amount of time. - // This should close the keep alive hole. - // - // See https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/ - - rawConn, err := conn.SyscallConn() - if err != nil { - return err - } - controlErr := rawConn.Control(func(fd uintptr) { - err = unix.SetsockoptInt(int(fd), unix.SOL_TCP, unix.TCP_USER_TIMEOUT, int(timeout.Milliseconds())) - }) - if controlErr != nil { - return controlErr - } - if ignoreProtocolNotAvailable(err) != nil { - return err - } - return nil -} - -// ignoreProtocolNotAvailable ignores the "protocol not available" error that -// is returned when netutil.SetUserTimeout is called if running on the Windows -// Subsystem for Linux (see Jira issue COM-23). -func ignoreProtocolNotAvailable(err error) error { - var errno syscall.Errno - if errors.As(err, &errno) { - if errno == syscall.ENOPROTOOPT { - return nil - } - } - return err -} diff --git a/vendor/storj.io/common/netutil/timeout_other.go b/vendor/storj.io/common/netutil/timeout_other.go deleted file mode 100644 index 99bde7da6..000000000 --- a/vendor/storj.io/common/netutil/timeout_other.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build !linux - -package netutil - -import ( - "net" - "time" -) - -// SetUserTimeout sets the TCP_USER_TIMEOUT setting on the provided conn. -func SetUserTimeout(conn *net.TCPConn, timeout time.Duration) error { - return nil -} diff --git a/vendor/storj.io/common/netutil/tracking.go b/vendor/storj.io/common/netutil/tracking.go deleted file mode 100644 index 726b74a90..000000000 --- a/vendor/storj.io/common/netutil/tracking.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package netutil - -import ( - "net" - "runtime" -) - -// closeTrackingConn wraps a net.Conn and keeps track of if it was closed -// or if it was leaked (and closes it if it was leaked). -type closeTrackingConn struct { - net.Conn -} - -// TrackClose wraps the conn and sets a finalizer on the returned value to -// close the conn and monitor that it was leaked. -func TrackClose(conn net.Conn) net.Conn { - tracked := &closeTrackingConn{Conn: conn} - runtime.SetFinalizer(tracked, (*closeTrackingConn).finalize) - return tracked -} - -// Close clears the finalizer and closes the connection. -func (c *closeTrackingConn) Close() error { - runtime.SetFinalizer(c, nil) - mon.Event("connection_closed") - return c.Conn.Close() -} - -// finalize monitors that a connection was leaked and closes the connection. -func (c *closeTrackingConn) finalize() { - mon.Event("connection_leaked") - _ = c.Conn.Close() -} diff --git a/vendor/storj.io/common/paths/doc.go b/vendor/storj.io/common/paths/doc.go deleted file mode 100644 index 4ddc20d62..000000000 --- a/vendor/storj.io/common/paths/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package paths implements wrappers for handling encrypted and unencrypted -// paths safely. -package paths diff --git a/vendor/storj.io/common/paths/path.go b/vendor/storj.io/common/paths/path.go deleted file mode 100644 index c97f2651e..000000000 --- a/vendor/storj.io/common/paths/path.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package paths - -import ( - "strings" -) - -// -// To avoid confusion about when paths are encrypted, unencrypted, empty or -// non existent, we create some wrapper types so that the compiler will complain -// if someone attempts to use one in the wrong context. -// - -// Unencrypted is an opaque type representing an unencrypted path. -type Unencrypted struct { - raw string -} - -// Encrypted is an opaque type representing an encrypted path. -type Encrypted struct { - raw string -} - -// -// unencrypted paths -// - -// NewUnencrypted takes a raw unencrypted path and returns it wrapped. -func NewUnencrypted(raw string) Unencrypted { - return Unencrypted{raw: raw} -} - -// Valid returns if the unencrypted path is valid, which is the same as not being empty. -func (path Unencrypted) Valid() bool { - return path.raw != "" -} - -// Raw returns the original raw path for the Unencrypted. -func (path Unencrypted) Raw() string { - return path.raw -} - -// String returns a human readable form of the Unencrypted. -func (path Unencrypted) String() string { - return path.Raw() -} - -// Consume attempts to remove the prefix from the Unencrypted path and -// reports a boolean indicating if it was able to do so. -func (path Unencrypted) Consume(prefix Unencrypted) (Unencrypted, bool) { - if len(path.raw) >= len(prefix.raw) && path.raw[:len(prefix.raw)] == prefix.raw { - return NewUnencrypted(path.raw[len(prefix.raw):]), true - } - return Unencrypted{}, false -} - -// Iterator returns an iterator over the components of the Unencrypted. -func (path Unencrypted) Iterator() Iterator { - return NewIterator(path.raw) -} - -// Less returns true if 'path' should be sorted earlier than 'other'. -func (path Unencrypted) Less(other Unencrypted) bool { - return path.raw < other.raw -} - -// -// encrypted path -// - -// NewEncrypted takes a raw encrypted path and returns it wrapped. -func NewEncrypted(raw string) Encrypted { - return Encrypted{raw: raw} -} - -// Valid returns if the encrypted path is valid, which is the same as not being empty. -func (path Encrypted) Valid() bool { - return path.raw != "" -} - -// Raw returns the original path for the Encrypted. -func (path Encrypted) Raw() string { - return path.raw -} - -// String returns a human readable form of the Encrypted. -func (path Encrypted) String() string { - return path.Raw() -} - -// Consume attempts to remove the prefix from the Encrypted path and -// reports a boolean indicating if it was able to do so. -func (path Encrypted) Consume(prefix Encrypted) (Encrypted, bool) { - if len(path.raw) >= len(prefix.raw) && path.raw[:len(prefix.raw)] == prefix.raw { - return NewEncrypted(path.raw[len(prefix.raw):]), true - } - return Encrypted{}, false -} - -// Iterator returns an iterator over the components of the Encrypted. -func (path Encrypted) Iterator() Iterator { - return NewIterator(path.raw) -} - -// Less returns true if 'path' should be sorted earlier than 'other'. -func (path Encrypted) Less(other Encrypted) bool { - return path.raw < other.raw -} - -// -// path component iteration -// - -// Iterator allows one to efficiently iterate over components of a path. -type Iterator struct { - raw string - consumed int - lastEmpty bool -} - -// NewIterator returns an Iterator for components of the provided raw path. -func NewIterator(raw string) Iterator { - return Iterator{raw: raw, lastEmpty: raw != ""} -} - -// Consumed reports how much of the path has been consumed (if any). -func (pi Iterator) Consumed() string { return pi.raw[:pi.consumed] } - -// Remaining reports how much of the path is remaining. -func (pi Iterator) Remaining() string { return pi.raw[pi.consumed:] } - -// Done reports if the path has been fully consumed. -func (pi Iterator) Done() bool { return len(pi.raw) == pi.consumed && !pi.lastEmpty } - -// Next returns the first component of the path, consuming it. -func (pi *Iterator) Next() string { - if pi.Done() { - return "" - } - - rem := pi.Remaining() - index := strings.IndexByte(rem, '/') - if index == -1 { - pi.consumed += len(rem) - pi.lastEmpty = false - return rem - } - pi.consumed += index + 1 - pi.lastEmpty = index == len(rem)-1 - return rem[:index] -} diff --git a/vendor/storj.io/common/pb/alias.go b/vendor/storj.io/common/pb/alias.go deleted file mode 100644 index 4a506c3af..000000000 --- a/vendor/storj.io/common/pb/alias.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package pb - -import proto "github.com/gogo/protobuf/proto" - -// Unmarshal is an alias for proto.Unmarshal. -func Unmarshal(buf []byte, pb proto.Message) error { return proto.Unmarshal(buf, pb) } - -// Marshal is an alias for proto.Marshal. -func Marshal(pb proto.Message) ([]byte, error) { return proto.Marshal(pb) } diff --git a/vendor/storj.io/common/pb/certificate.pb.go b/vendor/storj.io/common/pb/certificate.pb.go deleted file mode 100644 index 0ef043c0c..000000000 --- a/vendor/storj.io/common/pb/certificate.pb.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: certificate.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type SigningRequest struct { - AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SigningRequest) Reset() { *m = SigningRequest{} } -func (m *SigningRequest) String() string { return proto.CompactTextString(m) } -func (*SigningRequest) ProtoMessage() {} -func (*SigningRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c0d34c34dd33be4b, []int{0} -} -func (m *SigningRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SigningRequest.Unmarshal(m, b) -} -func (m *SigningRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SigningRequest.Marshal(b, m, deterministic) -} -func (m *SigningRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SigningRequest.Merge(m, src) -} -func (m *SigningRequest) XXX_Size() int { - return xxx_messageInfo_SigningRequest.Size(m) -} -func (m *SigningRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SigningRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SigningRequest proto.InternalMessageInfo - -func (m *SigningRequest) GetAuthToken() string { - if m != nil { - return m.AuthToken - } - return "" -} - -func (m *SigningRequest) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -type SigningResponse struct { - Chain [][]byte `protobuf:"bytes,1,rep,name=chain,proto3" json:"chain,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SigningResponse) Reset() { *m = SigningResponse{} } -func (m *SigningResponse) String() string { return proto.CompactTextString(m) } -func (*SigningResponse) ProtoMessage() {} -func (*SigningResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c0d34c34dd33be4b, []int{1} -} -func (m *SigningResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SigningResponse.Unmarshal(m, b) -} -func (m *SigningResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SigningResponse.Marshal(b, m, deterministic) -} -func (m *SigningResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SigningResponse.Merge(m, src) -} -func (m *SigningResponse) XXX_Size() int { - return xxx_messageInfo_SigningResponse.Size(m) -} -func (m *SigningResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SigningResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SigningResponse proto.InternalMessageInfo - -func (m *SigningResponse) GetChain() [][]byte { - if m != nil { - return m.Chain - } - return nil -} - -func init() { - proto.RegisterType((*SigningRequest)(nil), "node.SigningRequest") - proto.RegisterType((*SigningResponse)(nil), "node.SigningResponse") -} - -func init() { proto.RegisterFile("certificate.proto", fileDescriptor_c0d34c34dd33be4b) } - -var fileDescriptor_c0d34c34dd33be4b = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x8f, 0xc1, 0x4a, 0xc6, 0x30, - 0x10, 0x06, 0xa9, 0xff, 0xaf, 0xd0, 0xa5, 0x28, 0x86, 0x0a, 0x45, 0x14, 0x4a, 0x2f, 0xf6, 0x94, - 0x82, 0x7d, 0x03, 0x7b, 0xf6, 0x12, 0x3d, 0x79, 0x91, 0x34, 0xae, 0x6d, 0x94, 0x64, 0x63, 0xb3, - 0x7d, 0x7f, 0x89, 0x05, 0x8b, 0x1e, 0x77, 0x60, 0x87, 0xf9, 0xe0, 0xd2, 0xe0, 0xc2, 0xf6, 0xdd, - 0x1a, 0xcd, 0x28, 0xc3, 0x42, 0x4c, 0xe2, 0xe8, 0xe9, 0x0d, 0x9b, 0x47, 0x38, 0x7f, 0xb2, 0x93, - 0xb7, 0x7e, 0x52, 0xf8, 0xb5, 0x62, 0x64, 0x71, 0x0b, 0xa0, 0x57, 0x9e, 0x5f, 0x99, 0x3e, 0xd1, - 0x57, 0x59, 0x9d, 0xb5, 0xb9, 0xca, 0x13, 0x79, 0x4e, 0x40, 0xdc, 0x40, 0xce, 0xd6, 0x61, 0x64, - 0xed, 0x42, 0x75, 0x52, 0x67, 0xed, 0x41, 0xed, 0xa0, 0xb9, 0x83, 0x8b, 0x5f, 0x5d, 0x0c, 0xe4, - 0x23, 0x8a, 0x12, 0x4e, 0xcd, 0xac, 0x6d, 0x52, 0x1d, 0xda, 0x42, 0x6d, 0xc7, 0xfd, 0x00, 0xc5, - 0xb0, 0x27, 0x45, 0xd1, 0xc3, 0x31, 0x3d, 0x8a, 0x52, 0xa6, 0x2c, 0xf9, 0xb7, 0xe9, 0xfa, 0xea, - 0x1f, 0xdd, 0xd4, 0x0f, 0xe5, 0x8b, 0x88, 0x4c, 0xcb, 0x87, 0xb4, 0xd4, 0x19, 0x72, 0x8e, 0x7c, - 0x17, 0xc6, 0xf1, 0xec, 0x67, 0x5f, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xe3, 0xe4, 0xf2, - 0xf4, 0x00, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCCertificatesClient interface { - DRPCConn() drpc.Conn - - Sign(ctx context.Context, in *SigningRequest) (*SigningResponse, error) -} - -type drpcCertificatesClient struct { - cc drpc.Conn -} - -func NewDRPCCertificatesClient(cc drpc.Conn) DRPCCertificatesClient { - return &drpcCertificatesClient{cc} -} - -func (c *drpcCertificatesClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcCertificatesClient) Sign(ctx context.Context, in *SigningRequest) (*SigningResponse, error) { - out := new(SigningResponse) - err := c.cc.Invoke(ctx, "/node.Certificates/Sign", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCCertificatesServer interface { - Sign(context.Context, *SigningRequest) (*SigningResponse, error) -} - -type DRPCCertificatesDescription struct{} - -func (DRPCCertificatesDescription) NumMethods() int { return 1 } - -func (DRPCCertificatesDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/node.Certificates/Sign", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCCertificatesServer). - Sign( - ctx, - in1.(*SigningRequest), - ) - }, DRPCCertificatesServer.Sign, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterCertificates(mux drpc.Mux, impl DRPCCertificatesServer) error { - return mux.Register(impl, DRPCCertificatesDescription{}) -} - -type DRPCCertificates_SignStream interface { - drpc.Stream - SendAndClose(*SigningResponse) error -} - -type drpcCertificatesSignStream struct { - drpc.Stream -} - -func (x *drpcCertificatesSignStream) SendAndClose(m *SigningResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/certificate.proto b/vendor/storj.io/common/pb/certificate.proto deleted file mode 100644 index d753acb7d..000000000 --- a/vendor/storj.io/common/pb/certificate.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package node; - -service Certificates { - rpc Sign(SigningRequest) returns (SigningResponse); -} - -message SigningRequest { - string auth_token = 1; - int64 timestamp = 2; -} - -message SigningResponse { - repeated bytes chain = 1; -} diff --git a/vendor/storj.io/common/pb/contact.pb.go b/vendor/storj.io/common/pb/contact.pb.go deleted file mode 100644 index 1a47f1ddf..000000000 --- a/vendor/storj.io/common/pb/contact.pb.go +++ /dev/null @@ -1,483 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: contact.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type CheckInRequest struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Version *NodeVersion `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Capacity *NodeCapacity `protobuf:"bytes,3,opt,name=capacity,proto3" json:"capacity,omitempty"` - Operator *NodeOperator `protobuf:"bytes,4,opt,name=operator,proto3" json:"operator,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CheckInRequest) Reset() { *m = CheckInRequest{} } -func (m *CheckInRequest) String() string { return proto.CompactTextString(m) } -func (*CheckInRequest) ProtoMessage() {} -func (*CheckInRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{0} -} -func (m *CheckInRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CheckInRequest.Unmarshal(m, b) -} -func (m *CheckInRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CheckInRequest.Marshal(b, m, deterministic) -} -func (m *CheckInRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CheckInRequest.Merge(m, src) -} -func (m *CheckInRequest) XXX_Size() int { - return xxx_messageInfo_CheckInRequest.Size(m) -} -func (m *CheckInRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CheckInRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CheckInRequest proto.InternalMessageInfo - -func (m *CheckInRequest) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *CheckInRequest) GetVersion() *NodeVersion { - if m != nil { - return m.Version - } - return nil -} - -func (m *CheckInRequest) GetCapacity() *NodeCapacity { - if m != nil { - return m.Capacity - } - return nil -} - -func (m *CheckInRequest) GetOperator() *NodeOperator { - if m != nil { - return m.Operator - } - return nil -} - -type CheckInResponse struct { - PingNodeSuccess bool `protobuf:"varint,1,opt,name=ping_node_success,json=pingNodeSuccess,proto3" json:"ping_node_success,omitempty"` - PingErrorMessage string `protobuf:"bytes,2,opt,name=ping_error_message,json=pingErrorMessage,proto3" json:"ping_error_message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CheckInResponse) Reset() { *m = CheckInResponse{} } -func (m *CheckInResponse) String() string { return proto.CompactTextString(m) } -func (*CheckInResponse) ProtoMessage() {} -func (*CheckInResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{1} -} -func (m *CheckInResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CheckInResponse.Unmarshal(m, b) -} -func (m *CheckInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CheckInResponse.Marshal(b, m, deterministic) -} -func (m *CheckInResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CheckInResponse.Merge(m, src) -} -func (m *CheckInResponse) XXX_Size() int { - return xxx_messageInfo_CheckInResponse.Size(m) -} -func (m *CheckInResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CheckInResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CheckInResponse proto.InternalMessageInfo - -func (m *CheckInResponse) GetPingNodeSuccess() bool { - if m != nil { - return m.PingNodeSuccess - } - return false -} - -func (m *CheckInResponse) GetPingErrorMessage() string { - if m != nil { - return m.PingErrorMessage - } - return "" -} - -type GetTimeRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetTimeRequest) Reset() { *m = GetTimeRequest{} } -func (m *GetTimeRequest) String() string { return proto.CompactTextString(m) } -func (*GetTimeRequest) ProtoMessage() {} -func (*GetTimeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{2} -} -func (m *GetTimeRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTimeRequest.Unmarshal(m, b) -} -func (m *GetTimeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTimeRequest.Marshal(b, m, deterministic) -} -func (m *GetTimeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTimeRequest.Merge(m, src) -} -func (m *GetTimeRequest) XXX_Size() int { - return xxx_messageInfo_GetTimeRequest.Size(m) -} -func (m *GetTimeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetTimeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetTimeRequest proto.InternalMessageInfo - -type GetTimeResponse struct { - Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetTimeResponse) Reset() { *m = GetTimeResponse{} } -func (m *GetTimeResponse) String() string { return proto.CompactTextString(m) } -func (*GetTimeResponse) ProtoMessage() {} -func (*GetTimeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{3} -} -func (m *GetTimeResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTimeResponse.Unmarshal(m, b) -} -func (m *GetTimeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTimeResponse.Marshal(b, m, deterministic) -} -func (m *GetTimeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTimeResponse.Merge(m, src) -} -func (m *GetTimeResponse) XXX_Size() int { - return xxx_messageInfo_GetTimeResponse.Size(m) -} -func (m *GetTimeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetTimeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetTimeResponse proto.InternalMessageInfo - -func (m *GetTimeResponse) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - -type ContactPingRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ContactPingRequest) Reset() { *m = ContactPingRequest{} } -func (m *ContactPingRequest) String() string { return proto.CompactTextString(m) } -func (*ContactPingRequest) ProtoMessage() {} -func (*ContactPingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{4} -} -func (m *ContactPingRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ContactPingRequest.Unmarshal(m, b) -} -func (m *ContactPingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ContactPingRequest.Marshal(b, m, deterministic) -} -func (m *ContactPingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContactPingRequest.Merge(m, src) -} -func (m *ContactPingRequest) XXX_Size() int { - return xxx_messageInfo_ContactPingRequest.Size(m) -} -func (m *ContactPingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ContactPingRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ContactPingRequest proto.InternalMessageInfo - -type ContactPingResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ContactPingResponse) Reset() { *m = ContactPingResponse{} } -func (m *ContactPingResponse) String() string { return proto.CompactTextString(m) } -func (*ContactPingResponse) ProtoMessage() {} -func (*ContactPingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{5} -} -func (m *ContactPingResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ContactPingResponse.Unmarshal(m, b) -} -func (m *ContactPingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ContactPingResponse.Marshal(b, m, deterministic) -} -func (m *ContactPingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContactPingResponse.Merge(m, src) -} -func (m *ContactPingResponse) XXX_Size() int { - return xxx_messageInfo_ContactPingResponse.Size(m) -} -func (m *ContactPingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ContactPingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ContactPingResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*CheckInRequest)(nil), "contact.CheckInRequest") - proto.RegisterType((*CheckInResponse)(nil), "contact.CheckInResponse") - proto.RegisterType((*GetTimeRequest)(nil), "contact.GetTimeRequest") - proto.RegisterType((*GetTimeResponse)(nil), "contact.GetTimeResponse") - proto.RegisterType((*ContactPingRequest)(nil), "contact.ContactPingRequest") - proto.RegisterType((*ContactPingResponse)(nil), "contact.ContactPingResponse") -} - -func init() { proto.RegisterFile("contact.proto", fileDescriptor_a5036fff2565fb15) } - -var fileDescriptor_a5036fff2565fb15 = []byte{ - // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xc5, 0x50, 0xe1, 0x64, 0x2a, 0x9a, 0x76, 0x29, 0xc2, 0x32, 0x48, 0xa9, 0x7c, 0xaa, 0x00, - 0xad, 0xa5, 0x70, 0xed, 0x29, 0x51, 0x85, 0x38, 0x00, 0xd1, 0x52, 0x38, 0x70, 0x89, 0x9c, 0xf5, - 0x60, 0x4c, 0xf1, 0x8e, 0xd9, 0xdd, 0x20, 0x71, 0xe5, 0x0b, 0xf8, 0x1b, 0x7e, 0x81, 0xaf, 0x80, - 0x5f, 0x41, 0xde, 0x5d, 0x3b, 0x4d, 0xcb, 0xcd, 0xf3, 0xde, 0x9b, 0x37, 0x9e, 0x37, 0x0b, 0xf7, - 0x24, 0x29, 0x5b, 0x48, 0xcb, 0x5b, 0x4d, 0x96, 0x58, 0x1c, 0xca, 0x14, 0x2a, 0xaa, 0xc8, 0x83, - 0xe9, 0xb4, 0x22, 0xaa, 0xbe, 0x60, 0xee, 0xaa, 0xf5, 0xe6, 0x63, 0x6e, 0xeb, 0x06, 0x8d, 0x2d, - 0x9a, 0x36, 0x08, 0x40, 0x51, 0x89, 0xfe, 0x3b, 0xfb, 0x15, 0xc1, 0xc1, 0xe2, 0x13, 0xca, 0xcb, - 0x97, 0x4a, 0xe0, 0xd7, 0x0d, 0x1a, 0xcb, 0x12, 0x88, 0x8b, 0xb2, 0xd4, 0x68, 0x4c, 0x12, 0x9d, - 0x44, 0xa7, 0x63, 0xd1, 0x97, 0xec, 0x29, 0xc4, 0xdf, 0x50, 0x9b, 0x9a, 0x54, 0x72, 0xfb, 0x24, - 0x3a, 0xdd, 0x9f, 0x1d, 0x71, 0x67, 0xf5, 0x9a, 0x4a, 0x7c, 0xef, 0x09, 0xd1, 0x2b, 0x18, 0x87, - 0x91, 0x2c, 0xda, 0x42, 0xd6, 0xf6, 0x7b, 0x72, 0xc7, 0xa9, 0xd9, 0x56, 0xbd, 0x08, 0x8c, 0x18, - 0x34, 0x9d, 0x9e, 0x5a, 0xd4, 0x85, 0x25, 0x9d, 0xec, 0x5d, 0xd7, 0xbf, 0x09, 0x8c, 0x18, 0x34, - 0xd9, 0x25, 0x4c, 0x86, 0x1f, 0x37, 0x2d, 0x29, 0x83, 0xec, 0x09, 0x1c, 0xb5, 0xb5, 0xaa, 0x56, - 0x5d, 0xdb, 0xca, 0x6c, 0xa4, 0xec, 0x77, 0x18, 0x89, 0x49, 0x47, 0x74, 0x4e, 0x6f, 0x3d, 0xcc, - 0x9e, 0x01, 0x73, 0x5a, 0xd4, 0x9a, 0xf4, 0xaa, 0x41, 0x63, 0x8a, 0x0a, 0xdd, 0x5a, 0x63, 0x71, - 0xd8, 0x31, 0xe7, 0x1d, 0xf1, 0xca, 0xe3, 0xd9, 0x21, 0x1c, 0xbc, 0x40, 0x7b, 0x51, 0x37, 0x18, - 0x52, 0xca, 0xde, 0xc1, 0x64, 0x40, 0xc2, 0xf8, 0x39, 0x8c, 0x87, 0xa8, 0xdd, 0xd8, 0xfd, 0x59, - 0xca, 0xfd, 0x31, 0x78, 0x7f, 0x0c, 0x7e, 0xd1, 0x2b, 0xe6, 0xa3, 0xdf, 0x7f, 0xa6, 0xb7, 0x7e, - 0xfe, 0x9d, 0x46, 0x62, 0xdb, 0x96, 0x1d, 0x03, 0x5b, 0xf8, 0x9b, 0x2e, 0x6b, 0x55, 0xf5, 0xc3, - 0x1e, 0xc0, 0xfd, 0x1d, 0xd4, 0x0f, 0x9c, 0x2d, 0x21, 0x0e, 0x30, 0x3b, 0x87, 0xd1, 0x32, 0x6c, - 0xc8, 0x1e, 0xf1, 0xfe, 0x95, 0xdc, 0xb4, 0x4a, 0x1f, 0xff, 0x9f, 0x0c, 0x8e, 0x3f, 0x22, 0xd8, - 0x73, 0x1e, 0x67, 0x10, 0x87, 0x74, 0xd9, 0xc3, 0x6d, 0xc7, 0xce, 0x43, 0x49, 0x93, 0x9b, 0x44, - 0x48, 0xe2, 0x0c, 0xe2, 0x10, 0xce, 0x95, 0xee, 0xdd, 0x00, 0xaf, 0x74, 0x5f, 0xcb, 0x71, 0x7e, - 0xfc, 0x81, 0x19, 0x4b, 0xfa, 0x33, 0xaf, 0x29, 0x97, 0xd4, 0x34, 0xa4, 0xf2, 0x76, 0xbd, 0xbe, - 0xeb, 0x22, 0x7c, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x76, 0x56, 0xc3, 0x57, 0x03, 0x03, 0x00, - 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCContactClient interface { - DRPCConn() drpc.Conn - - PingNode(ctx context.Context, in *ContactPingRequest) (*ContactPingResponse, error) -} - -type drpcContactClient struct { - cc drpc.Conn -} - -func NewDRPCContactClient(cc drpc.Conn) DRPCContactClient { - return &drpcContactClient{cc} -} - -func (c *drpcContactClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcContactClient) PingNode(ctx context.Context, in *ContactPingRequest) (*ContactPingResponse, error) { - out := new(ContactPingResponse) - err := c.cc.Invoke(ctx, "/contact.Contact/PingNode", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCContactServer interface { - PingNode(context.Context, *ContactPingRequest) (*ContactPingResponse, error) -} - -type DRPCContactDescription struct{} - -func (DRPCContactDescription) NumMethods() int { return 1 } - -func (DRPCContactDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/contact.Contact/PingNode", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCContactServer). - PingNode( - ctx, - in1.(*ContactPingRequest), - ) - }, DRPCContactServer.PingNode, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterContact(mux drpc.Mux, impl DRPCContactServer) error { - return mux.Register(impl, DRPCContactDescription{}) -} - -type DRPCContact_PingNodeStream interface { - drpc.Stream - SendAndClose(*ContactPingResponse) error -} - -type drpcContactPingNodeStream struct { - drpc.Stream -} - -func (x *drpcContactPingNodeStream) SendAndClose(m *ContactPingResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNodeClient interface { - DRPCConn() drpc.Conn - - CheckIn(ctx context.Context, in *CheckInRequest) (*CheckInResponse, error) - GetTime(ctx context.Context, in *GetTimeRequest) (*GetTimeResponse, error) -} - -type drpcNodeClient struct { - cc drpc.Conn -} - -func NewDRPCNodeClient(cc drpc.Conn) DRPCNodeClient { - return &drpcNodeClient{cc} -} - -func (c *drpcNodeClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcNodeClient) CheckIn(ctx context.Context, in *CheckInRequest) (*CheckInResponse, error) { - out := new(CheckInResponse) - err := c.cc.Invoke(ctx, "/contact.Node/CheckIn", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcNodeClient) GetTime(ctx context.Context, in *GetTimeRequest) (*GetTimeResponse, error) { - out := new(GetTimeResponse) - err := c.cc.Invoke(ctx, "/contact.Node/GetTime", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCNodeServer interface { - CheckIn(context.Context, *CheckInRequest) (*CheckInResponse, error) - GetTime(context.Context, *GetTimeRequest) (*GetTimeResponse, error) -} - -type DRPCNodeDescription struct{} - -func (DRPCNodeDescription) NumMethods() int { return 2 } - -func (DRPCNodeDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/contact.Node/CheckIn", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeServer). - CheckIn( - ctx, - in1.(*CheckInRequest), - ) - }, DRPCNodeServer.CheckIn, true - case 1: - return "/contact.Node/GetTime", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeServer). - GetTime( - ctx, - in1.(*GetTimeRequest), - ) - }, DRPCNodeServer.GetTime, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterNode(mux drpc.Mux, impl DRPCNodeServer) error { - return mux.Register(impl, DRPCNodeDescription{}) -} - -type DRPCNode_CheckInStream interface { - drpc.Stream - SendAndClose(*CheckInResponse) error -} - -type drpcNodeCheckInStream struct { - drpc.Stream -} - -func (x *drpcNodeCheckInStream) SendAndClose(m *CheckInResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNode_GetTimeStream interface { - drpc.Stream - SendAndClose(*GetTimeResponse) error -} - -type drpcNodeGetTimeStream struct { - drpc.Stream -} - -func (x *drpcNodeGetTimeStream) SendAndClose(m *GetTimeResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/contact.proto b/vendor/storj.io/common/pb/contact.proto deleted file mode 100644 index ec322fcda..000000000 --- a/vendor/storj.io/common/pb/contact.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package contact; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "node.proto"; - -service Contact { - rpc PingNode(ContactPingRequest) returns (ContactPingResponse); -} - -service Node { - rpc CheckIn(CheckInRequest) returns (CheckInResponse); - rpc GetTime(GetTimeRequest) returns (GetTimeResponse); -} - -message CheckInRequest { - string address = 1; - node.NodeVersion version = 2; - node.NodeCapacity capacity = 3; - node.NodeOperator operator = 4; -} - -message CheckInResponse { - bool ping_node_success = 1; - string ping_error_message = 2; -} - -message GetTimeRequest {} - -message GetTimeResponse { - google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message ContactPingRequest {} - -message ContactPingResponse {} diff --git a/vendor/storj.io/common/pb/datarepair.pb.go b/vendor/storj.io/common/pb/datarepair.pb.go deleted file mode 100644 index fb508619f..000000000 --- a/vendor/storj.io/common/pb/datarepair.pb.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: datarepair.proto - -package pb - -import ( - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// InjuredSegment is the queue item used for the data repair queue. -type InjuredSegment struct { - Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - LostPieces []int32 `protobuf:"varint,2,rep,packed,name=lost_pieces,json=lostPieces,proto3" json:"lost_pieces,omitempty"` - InsertedTime time.Time `protobuf:"bytes,3,opt,name=inserted_time,json=insertedTime,proto3,stdtime" json:"inserted_time"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InjuredSegment) Reset() { *m = InjuredSegment{} } -func (m *InjuredSegment) String() string { return proto.CompactTextString(m) } -func (*InjuredSegment) ProtoMessage() {} -func (*InjuredSegment) Descriptor() ([]byte, []int) { - return fileDescriptor_b1b08e6fe9398aa6, []int{0} -} -func (m *InjuredSegment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InjuredSegment.Unmarshal(m, b) -} -func (m *InjuredSegment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InjuredSegment.Marshal(b, m, deterministic) -} -func (m *InjuredSegment) XXX_Merge(src proto.Message) { - xxx_messageInfo_InjuredSegment.Merge(m, src) -} -func (m *InjuredSegment) XXX_Size() int { - return xxx_messageInfo_InjuredSegment.Size(m) -} -func (m *InjuredSegment) XXX_DiscardUnknown() { - xxx_messageInfo_InjuredSegment.DiscardUnknown(m) -} - -var xxx_messageInfo_InjuredSegment proto.InternalMessageInfo - -func (m *InjuredSegment) GetPath() []byte { - if m != nil { - return m.Path - } - return nil -} - -func (m *InjuredSegment) GetLostPieces() []int32 { - if m != nil { - return m.LostPieces - } - return nil -} - -func (m *InjuredSegment) GetInsertedTime() time.Time { - if m != nil { - return m.InsertedTime - } - return time.Time{} -} - -func init() { - proto.RegisterType((*InjuredSegment)(nil), "repair.InjuredSegment") -} - -func init() { proto.RegisterFile("datarepair.proto", fileDescriptor_b1b08e6fe9398aa6) } - -var fileDescriptor_b1b08e6fe9398aa6 = []byte{ - // 217 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8e, 0x3f, 0x4e, 0xc3, 0x30, - 0x14, 0x87, 0x31, 0x85, 0x0a, 0xb9, 0x05, 0x21, 0x8b, 0x21, 0xca, 0x92, 0x88, 0x29, 0x93, 0x2d, - 0xc1, 0x0d, 0xba, 0x75, 0x43, 0x81, 0x89, 0xa5, 0x72, 0x9a, 0x87, 0x71, 0x55, 0xfb, 0x59, 0xf6, - 0xeb, 0x3d, 0x72, 0x2c, 0x4e, 0x01, 0x57, 0x41, 0xb1, 0x95, 0xed, 0xfd, 0xbe, 0xf7, 0xef, 0xe3, - 0x8f, 0xa3, 0x26, 0x1d, 0x21, 0x68, 0x1b, 0x65, 0x88, 0x48, 0x28, 0xd6, 0x25, 0xd5, 0xdc, 0xa0, - 0xc1, 0xc2, 0xea, 0xc6, 0x20, 0x9a, 0x33, 0xa8, 0x9c, 0x86, 0xcb, 0x97, 0x22, 0xeb, 0x20, 0x91, - 0x76, 0xa1, 0x0c, 0x3c, 0x4f, 0x8c, 0x3f, 0xec, 0xfd, 0xe9, 0x12, 0x61, 0x7c, 0x07, 0xe3, 0xc0, - 0x93, 0x10, 0xfc, 0x26, 0x68, 0xfa, 0xae, 0x58, 0xcb, 0xba, 0x6d, 0x9f, 0x6b, 0xd1, 0xf0, 0xcd, - 0x19, 0x13, 0x1d, 0x82, 0x85, 0x23, 0xa4, 0xea, 0xba, 0x5d, 0x75, 0xb7, 0x3d, 0x9f, 0xd1, 0x5b, - 0x26, 0x62, 0xcf, 0xef, 0xad, 0x4f, 0x10, 0x09, 0xc6, 0xc3, 0xfc, 0xa3, 0x5a, 0xb5, 0xac, 0xdb, - 0xbc, 0xd4, 0xb2, 0x08, 0xc8, 0x45, 0x40, 0x7e, 0x2c, 0x02, 0xbb, 0xbb, 0x9f, 0xdf, 0xe6, 0x6a, - 0xfa, 0x6b, 0x58, 0xbf, 0x5d, 0x56, 0xe7, 0xe6, 0xee, 0xe9, 0x53, 0x24, 0xc2, 0x78, 0x92, 0x16, - 0xd5, 0x11, 0x9d, 0x43, 0xaf, 0xc2, 0x30, 0xac, 0xf3, 0x85, 0xd7, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x1f, 0x51, 0xa8, 0x4d, 0xf8, 0x00, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/datarepair.proto b/vendor/storj.io/common/pb/datarepair.proto deleted file mode 100644 index ad6697081..000000000 --- a/vendor/storj.io/common/pb/datarepair.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -package repair; - -// InjuredSegment is the queue item used for the data repair queue. -message InjuredSegment { - bytes path = 1; - repeated int32 lost_pieces = 2; - google.protobuf.Timestamp inserted_time = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} diff --git a/vendor/storj.io/common/pb/doc.go b/vendor/storj.io/common/pb/doc.go deleted file mode 100644 index 9d3a437f4..000000000 --- a/vendor/storj.io/common/pb/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package pb contains protobuf definitions for Storj peers. -package pb - -//go:generate go run gen.go diff --git a/vendor/storj.io/common/pb/encryption.pb.go b/vendor/storj.io/common/pb/encryption.pb.go deleted file mode 100644 index 94fa4989e..000000000 --- a/vendor/storj.io/common/pb/encryption.pb.go +++ /dev/null @@ -1,125 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: encryption.proto - -package pb - -import ( - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type CipherSuite int32 - -const ( - CipherSuite_ENC_UNSPECIFIED CipherSuite = 0 - CipherSuite_ENC_NULL CipherSuite = 1 - CipherSuite_ENC_AESGCM CipherSuite = 2 - CipherSuite_ENC_SECRETBOX CipherSuite = 3 -) - -var CipherSuite_name = map[int32]string{ - 0: "ENC_UNSPECIFIED", - 1: "ENC_NULL", - 2: "ENC_AESGCM", - 3: "ENC_SECRETBOX", -} - -var CipherSuite_value = map[string]int32{ - "ENC_UNSPECIFIED": 0, - "ENC_NULL": 1, - "ENC_AESGCM": 2, - "ENC_SECRETBOX": 3, -} - -func (x CipherSuite) String() string { - return proto.EnumName(CipherSuite_name, int32(x)) -} - -func (CipherSuite) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8293a649ce9418c6, []int{0} -} - -type EncryptionParameters struct { - CipherSuite CipherSuite `protobuf:"varint,1,opt,name=cipher_suite,json=cipherSuite,proto3,enum=encryption.CipherSuite" json:"cipher_suite,omitempty"` - BlockSize int64 `protobuf:"varint,2,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EncryptionParameters) Reset() { *m = EncryptionParameters{} } -func (m *EncryptionParameters) String() string { return proto.CompactTextString(m) } -func (*EncryptionParameters) ProtoMessage() {} -func (*EncryptionParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_8293a649ce9418c6, []int{0} -} -func (m *EncryptionParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EncryptionParameters.Unmarshal(m, b) -} -func (m *EncryptionParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EncryptionParameters.Marshal(b, m, deterministic) -} -func (m *EncryptionParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_EncryptionParameters.Merge(m, src) -} -func (m *EncryptionParameters) XXX_Size() int { - return xxx_messageInfo_EncryptionParameters.Size(m) -} -func (m *EncryptionParameters) XXX_DiscardUnknown() { - xxx_messageInfo_EncryptionParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_EncryptionParameters proto.InternalMessageInfo - -func (m *EncryptionParameters) GetCipherSuite() CipherSuite { - if m != nil { - return m.CipherSuite - } - return CipherSuite_ENC_UNSPECIFIED -} - -func (m *EncryptionParameters) GetBlockSize() int64 { - if m != nil { - return m.BlockSize - } - return 0 -} - -func init() { - proto.RegisterEnum("encryption.CipherSuite", CipherSuite_name, CipherSuite_value) - proto.RegisterType((*EncryptionParameters)(nil), "encryption.EncryptionParameters") -} - -func init() { proto.RegisterFile("encryption.proto", fileDescriptor_8293a649ce9418c6) } - -var fileDescriptor_8293a649ce9418c6 = []byte{ - // 225 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcd, 0x4b, 0x2e, - 0xaa, 0x2c, 0x28, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, - 0x28, 0x15, 0x72, 0x89, 0xb8, 0xc2, 0x79, 0x01, 0x89, 0x45, 0x89, 0xb9, 0xa9, 0x25, 0xa9, 0x45, - 0xc5, 0x42, 0x56, 0x5c, 0x3c, 0xc9, 0x99, 0x05, 0x19, 0xa9, 0x45, 0xf1, 0xc5, 0xa5, 0x99, 0x25, - 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x7c, 0x46, 0xe2, 0x7a, 0x48, 0x86, 0x39, 0x83, 0xe5, 0x83, - 0x41, 0xd2, 0x41, 0xdc, 0xc9, 0x08, 0x8e, 0x90, 0x2c, 0x17, 0x57, 0x52, 0x4e, 0x7e, 0x72, 0x76, - 0x7c, 0x71, 0x66, 0x55, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x27, 0x58, 0x24, 0x38, - 0xb3, 0x2a, 0x55, 0x2b, 0x98, 0x8b, 0x1b, 0x49, 0xab, 0x90, 0x30, 0x17, 0xbf, 0xab, 0x9f, 0x73, - 0x7c, 0xa8, 0x5f, 0x70, 0x80, 0xab, 0xb3, 0xa7, 0x9b, 0xa7, 0xab, 0x8b, 0x00, 0x83, 0x10, 0x0f, - 0x17, 0x07, 0x48, 0xd0, 0x2f, 0xd4, 0xc7, 0x47, 0x80, 0x51, 0x88, 0x8f, 0x8b, 0x0b, 0xc4, 0x73, - 0x74, 0x0d, 0x76, 0x77, 0xf6, 0x15, 0x60, 0x12, 0x12, 0xe4, 0xe2, 0x05, 0xf1, 0x83, 0x5d, 0x9d, - 0x83, 0x5c, 0x43, 0x9c, 0xfc, 0x23, 0x04, 0x98, 0x9d, 0x44, 0xa2, 0x84, 0x8a, 0x4b, 0xf2, 0x8b, - 0xb2, 0xf4, 0x32, 0xf3, 0xf5, 0x93, 0xf3, 0x73, 0x73, 0xf3, 0xf3, 0xf4, 0x0b, 0x92, 0x92, 0xd8, - 0xc0, 0x1e, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x70, 0xc9, 0x84, 0x04, 0x01, 0x00, - 0x00, -} diff --git a/vendor/storj.io/common/pb/encryption.proto b/vendor/storj.io/common/pb/encryption.proto deleted file mode 100644 index 792a28884..000000000 --- a/vendor/storj.io/common/pb/encryption.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package encryption; - -message EncryptionParameters { - CipherSuite cipher_suite = 1; - int64 block_size = 2; -} - -enum CipherSuite { - ENC_UNSPECIFIED = 0; - ENC_NULL = 1; - ENC_AESGCM = 2; - ENC_SECRETBOX = 3; -} diff --git a/vendor/storj.io/common/pb/encryption_access.pb.go b/vendor/storj.io/common/pb/encryption_access.pb.go deleted file mode 100644 index a3be557b5..000000000 --- a/vendor/storj.io/common/pb/encryption_access.pb.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: encryption_access.proto - -package pb - -import ( - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type EncryptionAccess struct { - DefaultKey []byte `protobuf:"bytes,1,opt,name=default_key,json=defaultKey,proto3" json:"default_key,omitempty"` - StoreEntries []*EncryptionAccess_StoreEntry `protobuf:"bytes,2,rep,name=store_entries,json=storeEntries,proto3" json:"store_entries,omitempty"` - DefaultPathCipher CipherSuite `protobuf:"varint,3,opt,name=default_path_cipher,json=defaultPathCipher,proto3,enum=encryption.CipherSuite" json:"default_path_cipher,omitempty"` - DefaultEncryptionParameters *EncryptionParameters `protobuf:"bytes,4,opt,name=default_encryption_parameters,json=defaultEncryptionParameters,proto3" json:"default_encryption_parameters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EncryptionAccess) Reset() { *m = EncryptionAccess{} } -func (m *EncryptionAccess) String() string { return proto.CompactTextString(m) } -func (*EncryptionAccess) ProtoMessage() {} -func (*EncryptionAccess) Descriptor() ([]byte, []int) { - return fileDescriptor_464b1a18bff4a17b, []int{0} -} -func (m *EncryptionAccess) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EncryptionAccess.Unmarshal(m, b) -} -func (m *EncryptionAccess) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EncryptionAccess.Marshal(b, m, deterministic) -} -func (m *EncryptionAccess) XXX_Merge(src proto.Message) { - xxx_messageInfo_EncryptionAccess.Merge(m, src) -} -func (m *EncryptionAccess) XXX_Size() int { - return xxx_messageInfo_EncryptionAccess.Size(m) -} -func (m *EncryptionAccess) XXX_DiscardUnknown() { - xxx_messageInfo_EncryptionAccess.DiscardUnknown(m) -} - -var xxx_messageInfo_EncryptionAccess proto.InternalMessageInfo - -func (m *EncryptionAccess) GetDefaultKey() []byte { - if m != nil { - return m.DefaultKey - } - return nil -} - -func (m *EncryptionAccess) GetStoreEntries() []*EncryptionAccess_StoreEntry { - if m != nil { - return m.StoreEntries - } - return nil -} - -func (m *EncryptionAccess) GetDefaultPathCipher() CipherSuite { - if m != nil { - return m.DefaultPathCipher - } - return CipherSuite_ENC_UNSPECIFIED -} - -func (m *EncryptionAccess) GetDefaultEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.DefaultEncryptionParameters - } - return nil -} - -type EncryptionAccess_StoreEntry struct { - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - UnencryptedPath []byte `protobuf:"bytes,2,opt,name=unencrypted_path,json=unencryptedPath,proto3" json:"unencrypted_path,omitempty"` - EncryptedPath []byte `protobuf:"bytes,3,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` - PathCipher CipherSuite `protobuf:"varint,5,opt,name=path_cipher,json=pathCipher,proto3,enum=encryption.CipherSuite" json:"path_cipher,omitempty"` - EncryptionParameters *EncryptionParameters `protobuf:"bytes,6,opt,name=encryption_parameters,json=encryptionParameters,proto3" json:"encryption_parameters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EncryptionAccess_StoreEntry) Reset() { *m = EncryptionAccess_StoreEntry{} } -func (m *EncryptionAccess_StoreEntry) String() string { return proto.CompactTextString(m) } -func (*EncryptionAccess_StoreEntry) ProtoMessage() {} -func (*EncryptionAccess_StoreEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_464b1a18bff4a17b, []int{0, 0} -} -func (m *EncryptionAccess_StoreEntry) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EncryptionAccess_StoreEntry.Unmarshal(m, b) -} -func (m *EncryptionAccess_StoreEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EncryptionAccess_StoreEntry.Marshal(b, m, deterministic) -} -func (m *EncryptionAccess_StoreEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_EncryptionAccess_StoreEntry.Merge(m, src) -} -func (m *EncryptionAccess_StoreEntry) XXX_Size() int { - return xxx_messageInfo_EncryptionAccess_StoreEntry.Size(m) -} -func (m *EncryptionAccess_StoreEntry) XXX_DiscardUnknown() { - xxx_messageInfo_EncryptionAccess_StoreEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_EncryptionAccess_StoreEntry proto.InternalMessageInfo - -func (m *EncryptionAccess_StoreEntry) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *EncryptionAccess_StoreEntry) GetUnencryptedPath() []byte { - if m != nil { - return m.UnencryptedPath - } - return nil -} - -func (m *EncryptionAccess_StoreEntry) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *EncryptionAccess_StoreEntry) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *EncryptionAccess_StoreEntry) GetPathCipher() CipherSuite { - if m != nil { - return m.PathCipher - } - return CipherSuite_ENC_UNSPECIFIED -} - -func (m *EncryptionAccess_StoreEntry) GetEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.EncryptionParameters - } - return nil -} - -func init() { - proto.RegisterType((*EncryptionAccess)(nil), "encryption_access.EncryptionAccess") - proto.RegisterType((*EncryptionAccess_StoreEntry)(nil), "encryption_access.EncryptionAccess.StoreEntry") -} - -func init() { proto.RegisterFile("encryption_access.proto", fileDescriptor_464b1a18bff4a17b) } - -var fileDescriptor_464b1a18bff4a17b = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x4f, 0xf2, 0x40, - 0x14, 0x4c, 0x29, 0x1f, 0x87, 0x57, 0xe0, 0x2b, 0x2b, 0x4a, 0x83, 0x31, 0x36, 0x26, 0x26, 0xf5, - 0x52, 0x12, 0xbc, 0x78, 0x55, 0x43, 0x3c, 0x78, 0x21, 0x25, 0x5e, 0xbc, 0x34, 0xa5, 0x3c, 0x43, - 0x45, 0x76, 0x37, 0xbb, 0xdb, 0x43, 0x7f, 0x8a, 0xbf, 0xcb, 0x3f, 0x64, 0xba, 0x2c, 0xb4, 0x02, - 0x31, 0xde, 0xb6, 0x33, 0xb3, 0xb3, 0xf3, 0xe6, 0x15, 0x06, 0x48, 0x53, 0x51, 0x70, 0x95, 0x31, - 0x1a, 0x27, 0x69, 0x8a, 0x52, 0x86, 0x5c, 0x30, 0xc5, 0x48, 0xef, 0x80, 0x18, 0xba, 0x15, 0xb4, - 0x11, 0x5d, 0x7d, 0x35, 0xc1, 0x9d, 0xec, 0xc0, 0x7b, 0x2d, 0x23, 0x97, 0xe0, 0x2c, 0xf0, 0x2d, - 0xc9, 0x3f, 0x54, 0xbc, 0xc2, 0xc2, 0xb3, 0x7c, 0x2b, 0x68, 0x47, 0x60, 0xa0, 0x67, 0x2c, 0xc8, - 0x0c, 0x3a, 0x52, 0x31, 0x81, 0x31, 0x52, 0x25, 0x32, 0x94, 0x5e, 0xc3, 0xb7, 0x03, 0x67, 0x1c, - 0x86, 0x87, 0x59, 0xf6, 0xcd, 0xc3, 0x59, 0x79, 0x71, 0x42, 0x95, 0x28, 0xa2, 0xb6, 0xdc, 0x9e, - 0x33, 0x94, 0xe4, 0x09, 0x4e, 0xb6, 0xaf, 0xf2, 0x44, 0x2d, 0xe3, 0x34, 0xe3, 0x4b, 0x14, 0x9e, - 0xed, 0x5b, 0x41, 0x77, 0x3c, 0xa8, 0x59, 0x87, 0x8f, 0x9a, 0x99, 0xe5, 0x99, 0xc2, 0xa8, 0x67, - 0xee, 0x4c, 0x13, 0xb5, 0xdc, 0xe0, 0x64, 0x01, 0x17, 0x5b, 0xa3, 0x5a, 0x1e, 0x9e, 0x88, 0x64, - 0x8d, 0x0a, 0x85, 0xf4, 0x9a, 0xbe, 0x15, 0x38, 0x63, 0xbf, 0x6e, 0x59, 0xc5, 0x9c, 0xee, 0x74, - 0xd1, 0xb9, 0xb1, 0x39, 0x46, 0x0e, 0x3f, 0x1b, 0x00, 0xd5, 0x2c, 0xe4, 0x0c, 0x5a, 0xf3, 0x3c, - 0x5d, 0xa1, 0x32, 0x75, 0x99, 0x2f, 0x72, 0x03, 0x6e, 0x4e, 0xcd, 0x43, 0xb8, 0xd0, 0x93, 0x79, - 0x0d, 0xad, 0xf8, 0x5f, 0xc3, 0xcb, 0xf4, 0xe4, 0x1a, 0xba, 0x7b, 0x42, 0x5b, 0x0b, 0x3b, 0x3f, - 0x65, 0x2e, 0xd8, 0xe5, 0x56, 0x9a, 0x9a, 0x2b, 0x8f, 0xe4, 0x0e, 0x9c, 0x7a, 0x63, 0xff, 0x7e, - 0x6f, 0x0c, 0x78, 0x55, 0xd5, 0x0b, 0x9c, 0x1e, 0xaf, 0xa8, 0xf5, 0xc7, 0x8a, 0xfa, 0x78, 0x04, - 0x7d, 0xe8, 0xbf, 0x92, 0x72, 0xb5, 0xef, 0x61, 0xc6, 0x46, 0x29, 0x5b, 0xaf, 0x19, 0x1d, 0xf1, - 0xf9, 0xbc, 0xa5, 0x7f, 0xb9, 0xdb, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xa8, 0x25, 0x28, - 0xb2, 0x02, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/encryption_access.proto b/vendor/storj.io/common/pb/encryption_access.proto deleted file mode 100644 index 031d861d7..000000000 --- a/vendor/storj.io/common/pb/encryption_access.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; - -option go_package = "storj.io/common/pb"; - -package encryption_access; - -import "encryption.proto"; - -message EncryptionAccess { - message StoreEntry { - bytes bucket = 1; - bytes unencrypted_path = 2; - bytes encrypted_path = 3; - bytes key = 4; - - encryption.CipherSuite path_cipher = 5; - encryption.EncryptionParameters encryption_parameters = 6; - } - - bytes default_key = 1; - repeated StoreEntry store_entries = 2; - encryption.CipherSuite default_path_cipher = 3; - encryption.EncryptionParameters default_encryption_parameters = 4; -} diff --git a/vendor/storj.io/common/pb/gogo.proto b/vendor/storj.io/common/pb/gogo.proto deleted file mode 100644 index 937487bf8..000000000 --- a/vendor/storj.io/common/pb/gogo.proto +++ /dev/null @@ -1,143 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// 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. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - optional bool compare = 65013; - -} \ No newline at end of file diff --git a/vendor/storj.io/common/pb/gracefulexit.pb.go b/vendor/storj.io/common/pb/gracefulexit.pb.go deleted file mode 100644 index 48f3b6de2..000000000 --- a/vendor/storj.io/common/pb/gracefulexit.pb.go +++ /dev/null @@ -1,1608 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gracefulexit.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type TransferFailed_Error int32 - -const ( - TransferFailed_NOT_FOUND TransferFailed_Error = 0 - TransferFailed_STORAGE_NODE_UNAVAILABLE TransferFailed_Error = 1 - TransferFailed_HASH_VERIFICATION TransferFailed_Error = 2 - TransferFailed_UNKNOWN TransferFailed_Error = 10 -) - -var TransferFailed_Error_name = map[int32]string{ - 0: "NOT_FOUND", - 1: "STORAGE_NODE_UNAVAILABLE", - 2: "HASH_VERIFICATION", - 10: "UNKNOWN", -} - -var TransferFailed_Error_value = map[string]int32{ - "NOT_FOUND": 0, - "STORAGE_NODE_UNAVAILABLE": 1, - "HASH_VERIFICATION": 2, - "UNKNOWN": 10, -} - -func (x TransferFailed_Error) String() string { - return proto.EnumName(TransferFailed_Error_name, int32(x)) -} - -func (TransferFailed_Error) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{11, 0} -} - -type ExitFailed_Reason int32 - -const ( - ExitFailed_VERIFICATION_FAILED ExitFailed_Reason = 0 - ExitFailed_INACTIVE_TIMEFRAME_EXCEEDED ExitFailed_Reason = 1 - ExitFailed_OVERALL_FAILURE_PERCENTAGE_EXCEEDED ExitFailed_Reason = 2 -) - -var ExitFailed_Reason_name = map[int32]string{ - 0: "VERIFICATION_FAILED", - 1: "INACTIVE_TIMEFRAME_EXCEEDED", - 2: "OVERALL_FAILURE_PERCENTAGE_EXCEEDED", -} - -var ExitFailed_Reason_value = map[string]int32{ - "VERIFICATION_FAILED": 0, - "INACTIVE_TIMEFRAME_EXCEEDED": 1, - "OVERALL_FAILURE_PERCENTAGE_EXCEEDED": 2, -} - -func (x ExitFailed_Reason) String() string { - return proto.EnumName(ExitFailed_Reason_name, int32(x)) -} - -func (ExitFailed_Reason) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{17, 0} -} - -type GracefulExitFeasibilityNodeRequest struct { - NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GracefulExitFeasibilityNodeRequest) Reset() { *m = GracefulExitFeasibilityNodeRequest{} } -func (m *GracefulExitFeasibilityNodeRequest) String() string { return proto.CompactTextString(m) } -func (*GracefulExitFeasibilityNodeRequest) ProtoMessage() {} -func (*GracefulExitFeasibilityNodeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{0} -} -func (m *GracefulExitFeasibilityNodeRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GracefulExitFeasibilityNodeRequest.Unmarshal(m, b) -} -func (m *GracefulExitFeasibilityNodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GracefulExitFeasibilityNodeRequest.Marshal(b, m, deterministic) -} -func (m *GracefulExitFeasibilityNodeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GracefulExitFeasibilityNodeRequest.Merge(m, src) -} -func (m *GracefulExitFeasibilityNodeRequest) XXX_Size() int { - return xxx_messageInfo_GracefulExitFeasibilityNodeRequest.Size(m) -} -func (m *GracefulExitFeasibilityNodeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GracefulExitFeasibilityNodeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GracefulExitFeasibilityNodeRequest proto.InternalMessageInfo - -type GetNonExitingSatellitesRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetNonExitingSatellitesRequest) Reset() { *m = GetNonExitingSatellitesRequest{} } -func (m *GetNonExitingSatellitesRequest) String() string { return proto.CompactTextString(m) } -func (*GetNonExitingSatellitesRequest) ProtoMessage() {} -func (*GetNonExitingSatellitesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{1} -} -func (m *GetNonExitingSatellitesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetNonExitingSatellitesRequest.Unmarshal(m, b) -} -func (m *GetNonExitingSatellitesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetNonExitingSatellitesRequest.Marshal(b, m, deterministic) -} -func (m *GetNonExitingSatellitesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetNonExitingSatellitesRequest.Merge(m, src) -} -func (m *GetNonExitingSatellitesRequest) XXX_Size() int { - return xxx_messageInfo_GetNonExitingSatellitesRequest.Size(m) -} -func (m *GetNonExitingSatellitesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetNonExitingSatellitesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetNonExitingSatellitesRequest proto.InternalMessageInfo - -type InitiateGracefulExitRequest struct { - NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InitiateGracefulExitRequest) Reset() { *m = InitiateGracefulExitRequest{} } -func (m *InitiateGracefulExitRequest) String() string { return proto.CompactTextString(m) } -func (*InitiateGracefulExitRequest) ProtoMessage() {} -func (*InitiateGracefulExitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{2} -} -func (m *InitiateGracefulExitRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InitiateGracefulExitRequest.Unmarshal(m, b) -} -func (m *InitiateGracefulExitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InitiateGracefulExitRequest.Marshal(b, m, deterministic) -} -func (m *InitiateGracefulExitRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitiateGracefulExitRequest.Merge(m, src) -} -func (m *InitiateGracefulExitRequest) XXX_Size() int { - return xxx_messageInfo_InitiateGracefulExitRequest.Size(m) -} -func (m *InitiateGracefulExitRequest) XXX_DiscardUnknown() { - xxx_messageInfo_InitiateGracefulExitRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_InitiateGracefulExitRequest proto.InternalMessageInfo - -// NonExitingSatellite contains information that's needed for a storagenode to start graceful exit. -type NonExitingSatellite struct { - NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - DomainName string `protobuf:"bytes,2,opt,name=domain_name,json=domainName,proto3" json:"domain_name,omitempty"` - SpaceUsed float64 `protobuf:"fixed64,3,opt,name=space_used,json=spaceUsed,proto3" json:"space_used,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NonExitingSatellite) Reset() { *m = NonExitingSatellite{} } -func (m *NonExitingSatellite) String() string { return proto.CompactTextString(m) } -func (*NonExitingSatellite) ProtoMessage() {} -func (*NonExitingSatellite) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{3} -} -func (m *NonExitingSatellite) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NonExitingSatellite.Unmarshal(m, b) -} -func (m *NonExitingSatellite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NonExitingSatellite.Marshal(b, m, deterministic) -} -func (m *NonExitingSatellite) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonExitingSatellite.Merge(m, src) -} -func (m *NonExitingSatellite) XXX_Size() int { - return xxx_messageInfo_NonExitingSatellite.Size(m) -} -func (m *NonExitingSatellite) XXX_DiscardUnknown() { - xxx_messageInfo_NonExitingSatellite.DiscardUnknown(m) -} - -var xxx_messageInfo_NonExitingSatellite proto.InternalMessageInfo - -func (m *NonExitingSatellite) GetDomainName() string { - if m != nil { - return m.DomainName - } - return "" -} - -func (m *NonExitingSatellite) GetSpaceUsed() float64 { - if m != nil { - return m.SpaceUsed - } - return 0 -} - -type GetNonExitingSatellitesResponse struct { - Satellites []*NonExitingSatellite `protobuf:"bytes,1,rep,name=satellites,proto3" json:"satellites,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetNonExitingSatellitesResponse) Reset() { *m = GetNonExitingSatellitesResponse{} } -func (m *GetNonExitingSatellitesResponse) String() string { return proto.CompactTextString(m) } -func (*GetNonExitingSatellitesResponse) ProtoMessage() {} -func (*GetNonExitingSatellitesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{4} -} -func (m *GetNonExitingSatellitesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetNonExitingSatellitesResponse.Unmarshal(m, b) -} -func (m *GetNonExitingSatellitesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetNonExitingSatellitesResponse.Marshal(b, m, deterministic) -} -func (m *GetNonExitingSatellitesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetNonExitingSatellitesResponse.Merge(m, src) -} -func (m *GetNonExitingSatellitesResponse) XXX_Size() int { - return xxx_messageInfo_GetNonExitingSatellitesResponse.Size(m) -} -func (m *GetNonExitingSatellitesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetNonExitingSatellitesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetNonExitingSatellitesResponse proto.InternalMessageInfo - -func (m *GetNonExitingSatellitesResponse) GetSatellites() []*NonExitingSatellite { - if m != nil { - return m.Satellites - } - return nil -} - -type GetExitProgressRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetExitProgressRequest) Reset() { *m = GetExitProgressRequest{} } -func (m *GetExitProgressRequest) String() string { return proto.CompactTextString(m) } -func (*GetExitProgressRequest) ProtoMessage() {} -func (*GetExitProgressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{5} -} -func (m *GetExitProgressRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetExitProgressRequest.Unmarshal(m, b) -} -func (m *GetExitProgressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetExitProgressRequest.Marshal(b, m, deterministic) -} -func (m *GetExitProgressRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExitProgressRequest.Merge(m, src) -} -func (m *GetExitProgressRequest) XXX_Size() int { - return xxx_messageInfo_GetExitProgressRequest.Size(m) -} -func (m *GetExitProgressRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetExitProgressRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetExitProgressRequest proto.InternalMessageInfo - -type GetExitProgressResponse struct { - Progress []*ExitProgress `protobuf:"bytes,1,rep,name=progress,proto3" json:"progress,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetExitProgressResponse) Reset() { *m = GetExitProgressResponse{} } -func (m *GetExitProgressResponse) String() string { return proto.CompactTextString(m) } -func (*GetExitProgressResponse) ProtoMessage() {} -func (*GetExitProgressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{6} -} -func (m *GetExitProgressResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetExitProgressResponse.Unmarshal(m, b) -} -func (m *GetExitProgressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetExitProgressResponse.Marshal(b, m, deterministic) -} -func (m *GetExitProgressResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetExitProgressResponse.Merge(m, src) -} -func (m *GetExitProgressResponse) XXX_Size() int { - return xxx_messageInfo_GetExitProgressResponse.Size(m) -} -func (m *GetExitProgressResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetExitProgressResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetExitProgressResponse proto.InternalMessageInfo - -func (m *GetExitProgressResponse) GetProgress() []*ExitProgress { - if m != nil { - return m.Progress - } - return nil -} - -type ExitProgress struct { - DomainName string `protobuf:"bytes,1,opt,name=domain_name,json=domainName,proto3" json:"domain_name,omitempty"` - NodeId NodeID `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - PercentComplete float32 `protobuf:"fixed32,3,opt,name=percent_complete,json=percentComplete,proto3" json:"percent_complete,omitempty"` - Successful bool `protobuf:"varint,4,opt,name=successful,proto3" json:"successful,omitempty"` - CompletionReceipt []byte `protobuf:"bytes,5,opt,name=completion_receipt,json=completionReceipt,proto3" json:"completion_receipt,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExitProgress) Reset() { *m = ExitProgress{} } -func (m *ExitProgress) String() string { return proto.CompactTextString(m) } -func (*ExitProgress) ProtoMessage() {} -func (*ExitProgress) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{7} -} -func (m *ExitProgress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExitProgress.Unmarshal(m, b) -} -func (m *ExitProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExitProgress.Marshal(b, m, deterministic) -} -func (m *ExitProgress) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExitProgress.Merge(m, src) -} -func (m *ExitProgress) XXX_Size() int { - return xxx_messageInfo_ExitProgress.Size(m) -} -func (m *ExitProgress) XXX_DiscardUnknown() { - xxx_messageInfo_ExitProgress.DiscardUnknown(m) -} - -var xxx_messageInfo_ExitProgress proto.InternalMessageInfo - -func (m *ExitProgress) GetDomainName() string { - if m != nil { - return m.DomainName - } - return "" -} - -func (m *ExitProgress) GetPercentComplete() float32 { - if m != nil { - return m.PercentComplete - } - return 0 -} - -func (m *ExitProgress) GetSuccessful() bool { - if m != nil { - return m.Successful - } - return false -} - -func (m *ExitProgress) GetCompletionReceipt() []byte { - if m != nil { - return m.CompletionReceipt - } - return nil -} - -type GracefulExitFeasibilityRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GracefulExitFeasibilityRequest) Reset() { *m = GracefulExitFeasibilityRequest{} } -func (m *GracefulExitFeasibilityRequest) String() string { return proto.CompactTextString(m) } -func (*GracefulExitFeasibilityRequest) ProtoMessage() {} -func (*GracefulExitFeasibilityRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{8} -} -func (m *GracefulExitFeasibilityRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GracefulExitFeasibilityRequest.Unmarshal(m, b) -} -func (m *GracefulExitFeasibilityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GracefulExitFeasibilityRequest.Marshal(b, m, deterministic) -} -func (m *GracefulExitFeasibilityRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GracefulExitFeasibilityRequest.Merge(m, src) -} -func (m *GracefulExitFeasibilityRequest) XXX_Size() int { - return xxx_messageInfo_GracefulExitFeasibilityRequest.Size(m) -} -func (m *GracefulExitFeasibilityRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GracefulExitFeasibilityRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GracefulExitFeasibilityRequest proto.InternalMessageInfo - -type GracefulExitFeasibilityResponse struct { - JoinedAt time.Time `protobuf:"bytes,1,opt,name=joined_at,json=joinedAt,proto3,stdtime" json:"joined_at"` - MonthsRequired int32 `protobuf:"varint,2,opt,name=months_required,json=monthsRequired,proto3" json:"months_required,omitempty"` - IsAllowed bool `protobuf:"varint,3,opt,name=is_allowed,json=isAllowed,proto3" json:"is_allowed,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GracefulExitFeasibilityResponse) Reset() { *m = GracefulExitFeasibilityResponse{} } -func (m *GracefulExitFeasibilityResponse) String() string { return proto.CompactTextString(m) } -func (*GracefulExitFeasibilityResponse) ProtoMessage() {} -func (*GracefulExitFeasibilityResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{9} -} -func (m *GracefulExitFeasibilityResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GracefulExitFeasibilityResponse.Unmarshal(m, b) -} -func (m *GracefulExitFeasibilityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GracefulExitFeasibilityResponse.Marshal(b, m, deterministic) -} -func (m *GracefulExitFeasibilityResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GracefulExitFeasibilityResponse.Merge(m, src) -} -func (m *GracefulExitFeasibilityResponse) XXX_Size() int { - return xxx_messageInfo_GracefulExitFeasibilityResponse.Size(m) -} -func (m *GracefulExitFeasibilityResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GracefulExitFeasibilityResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GracefulExitFeasibilityResponse proto.InternalMessageInfo - -func (m *GracefulExitFeasibilityResponse) GetJoinedAt() time.Time { - if m != nil { - return m.JoinedAt - } - return time.Time{} -} - -func (m *GracefulExitFeasibilityResponse) GetMonthsRequired() int32 { - if m != nil { - return m.MonthsRequired - } - return 0 -} - -func (m *GracefulExitFeasibilityResponse) GetIsAllowed() bool { - if m != nil { - return m.IsAllowed - } - return false -} - -type TransferSucceeded struct { - OriginalOrderLimit *OrderLimit `protobuf:"bytes,1,opt,name=original_order_limit,json=originalOrderLimit,proto3" json:"original_order_limit,omitempty"` - OriginalPieceHash *PieceHash `protobuf:"bytes,2,opt,name=original_piece_hash,json=originalPieceHash,proto3" json:"original_piece_hash,omitempty"` - ReplacementPieceHash *PieceHash `protobuf:"bytes,3,opt,name=replacement_piece_hash,json=replacementPieceHash,proto3" json:"replacement_piece_hash,omitempty"` - OriginalPieceId PieceID `protobuf:"bytes,4,opt,name=original_piece_id,json=originalPieceId,proto3,customtype=PieceID" json:"original_piece_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TransferSucceeded) Reset() { *m = TransferSucceeded{} } -func (m *TransferSucceeded) String() string { return proto.CompactTextString(m) } -func (*TransferSucceeded) ProtoMessage() {} -func (*TransferSucceeded) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{10} -} -func (m *TransferSucceeded) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransferSucceeded.Unmarshal(m, b) -} -func (m *TransferSucceeded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransferSucceeded.Marshal(b, m, deterministic) -} -func (m *TransferSucceeded) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransferSucceeded.Merge(m, src) -} -func (m *TransferSucceeded) XXX_Size() int { - return xxx_messageInfo_TransferSucceeded.Size(m) -} -func (m *TransferSucceeded) XXX_DiscardUnknown() { - xxx_messageInfo_TransferSucceeded.DiscardUnknown(m) -} - -var xxx_messageInfo_TransferSucceeded proto.InternalMessageInfo - -func (m *TransferSucceeded) GetOriginalOrderLimit() *OrderLimit { - if m != nil { - return m.OriginalOrderLimit - } - return nil -} - -func (m *TransferSucceeded) GetOriginalPieceHash() *PieceHash { - if m != nil { - return m.OriginalPieceHash - } - return nil -} - -func (m *TransferSucceeded) GetReplacementPieceHash() *PieceHash { - if m != nil { - return m.ReplacementPieceHash - } - return nil -} - -type TransferFailed struct { - OriginalPieceId PieceID `protobuf:"bytes,1,opt,name=original_piece_id,json=originalPieceId,proto3,customtype=PieceID" json:"original_piece_id"` - Error TransferFailed_Error `protobuf:"varint,2,opt,name=error,proto3,enum=gracefulexit.TransferFailed_Error" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TransferFailed) Reset() { *m = TransferFailed{} } -func (m *TransferFailed) String() string { return proto.CompactTextString(m) } -func (*TransferFailed) ProtoMessage() {} -func (*TransferFailed) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{11} -} -func (m *TransferFailed) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransferFailed.Unmarshal(m, b) -} -func (m *TransferFailed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransferFailed.Marshal(b, m, deterministic) -} -func (m *TransferFailed) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransferFailed.Merge(m, src) -} -func (m *TransferFailed) XXX_Size() int { - return xxx_messageInfo_TransferFailed.Size(m) -} -func (m *TransferFailed) XXX_DiscardUnknown() { - xxx_messageInfo_TransferFailed.DiscardUnknown(m) -} - -var xxx_messageInfo_TransferFailed proto.InternalMessageInfo - -func (m *TransferFailed) GetError() TransferFailed_Error { - if m != nil { - return m.Error - } - return TransferFailed_NOT_FOUND -} - -type StorageNodeMessage struct { - // Types that are valid to be assigned to Message: - // *StorageNodeMessage_Succeeded - // *StorageNodeMessage_Failed - Message isStorageNodeMessage_Message `protobuf_oneof:"Message"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StorageNodeMessage) Reset() { *m = StorageNodeMessage{} } -func (m *StorageNodeMessage) String() string { return proto.CompactTextString(m) } -func (*StorageNodeMessage) ProtoMessage() {} -func (*StorageNodeMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{12} -} -func (m *StorageNodeMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StorageNodeMessage.Unmarshal(m, b) -} -func (m *StorageNodeMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StorageNodeMessage.Marshal(b, m, deterministic) -} -func (m *StorageNodeMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_StorageNodeMessage.Merge(m, src) -} -func (m *StorageNodeMessage) XXX_Size() int { - return xxx_messageInfo_StorageNodeMessage.Size(m) -} -func (m *StorageNodeMessage) XXX_DiscardUnknown() { - xxx_messageInfo_StorageNodeMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_StorageNodeMessage proto.InternalMessageInfo - -type isStorageNodeMessage_Message interface { - isStorageNodeMessage_Message() -} - -type StorageNodeMessage_Succeeded struct { - Succeeded *TransferSucceeded `protobuf:"bytes,1,opt,name=succeeded,proto3,oneof"` -} -type StorageNodeMessage_Failed struct { - Failed *TransferFailed `protobuf:"bytes,2,opt,name=failed,proto3,oneof"` -} - -func (*StorageNodeMessage_Succeeded) isStorageNodeMessage_Message() {} -func (*StorageNodeMessage_Failed) isStorageNodeMessage_Message() {} - -func (m *StorageNodeMessage) GetMessage() isStorageNodeMessage_Message { - if m != nil { - return m.Message - } - return nil -} - -func (m *StorageNodeMessage) GetSucceeded() *TransferSucceeded { - if x, ok := m.GetMessage().(*StorageNodeMessage_Succeeded); ok { - return x.Succeeded - } - return nil -} - -func (m *StorageNodeMessage) GetFailed() *TransferFailed { - if x, ok := m.GetMessage().(*StorageNodeMessage_Failed); ok { - return x.Failed - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*StorageNodeMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _StorageNodeMessage_OneofMarshaler, _StorageNodeMessage_OneofUnmarshaler, _StorageNodeMessage_OneofSizer, []interface{}{ - (*StorageNodeMessage_Succeeded)(nil), - (*StorageNodeMessage_Failed)(nil), - } -} - -func _StorageNodeMessage_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*StorageNodeMessage) - // Message - switch x := m.Message.(type) { - case *StorageNodeMessage_Succeeded: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Succeeded); err != nil { - return err - } - case *StorageNodeMessage_Failed: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Failed); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("StorageNodeMessage.Message has unexpected type %T", x) - } - return nil -} - -func _StorageNodeMessage_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*StorageNodeMessage) - switch tag { - case 1: // Message.succeeded - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TransferSucceeded) - err := b.DecodeMessage(msg) - m.Message = &StorageNodeMessage_Succeeded{msg} - return true, err - case 2: // Message.failed - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TransferFailed) - err := b.DecodeMessage(msg) - m.Message = &StorageNodeMessage_Failed{msg} - return true, err - default: - return false, nil - } -} - -func _StorageNodeMessage_OneofSizer(msg proto.Message) (n int) { - m := msg.(*StorageNodeMessage) - // Message - switch x := m.Message.(type) { - case *StorageNodeMessage_Succeeded: - s := proto.Size(x.Succeeded) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *StorageNodeMessage_Failed: - s := proto.Size(x.Failed) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type NotReady struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NotReady) Reset() { *m = NotReady{} } -func (m *NotReady) String() string { return proto.CompactTextString(m) } -func (*NotReady) ProtoMessage() {} -func (*NotReady) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{13} -} -func (m *NotReady) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NotReady.Unmarshal(m, b) -} -func (m *NotReady) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NotReady.Marshal(b, m, deterministic) -} -func (m *NotReady) XXX_Merge(src proto.Message) { - xxx_messageInfo_NotReady.Merge(m, src) -} -func (m *NotReady) XXX_Size() int { - return xxx_messageInfo_NotReady.Size(m) -} -func (m *NotReady) XXX_DiscardUnknown() { - xxx_messageInfo_NotReady.DiscardUnknown(m) -} - -var xxx_messageInfo_NotReady proto.InternalMessageInfo - -type TransferPiece struct { - OriginalPieceId PieceID `protobuf:"bytes,1,opt,name=original_piece_id,json=originalPieceId,proto3,customtype=PieceID" json:"original_piece_id"` - PrivateKey PiecePrivateKey `protobuf:"bytes,2,opt,name=private_key,json=privateKey,proto3,customtype=PiecePrivateKey" json:"private_key"` - // addressed_order_limit contains the new piece id. - AddressedOrderLimit *AddressedOrderLimit `protobuf:"bytes,3,opt,name=addressed_order_limit,json=addressedOrderLimit,proto3" json:"addressed_order_limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TransferPiece) Reset() { *m = TransferPiece{} } -func (m *TransferPiece) String() string { return proto.CompactTextString(m) } -func (*TransferPiece) ProtoMessage() {} -func (*TransferPiece) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{14} -} -func (m *TransferPiece) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransferPiece.Unmarshal(m, b) -} -func (m *TransferPiece) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransferPiece.Marshal(b, m, deterministic) -} -func (m *TransferPiece) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransferPiece.Merge(m, src) -} -func (m *TransferPiece) XXX_Size() int { - return xxx_messageInfo_TransferPiece.Size(m) -} -func (m *TransferPiece) XXX_DiscardUnknown() { - xxx_messageInfo_TransferPiece.DiscardUnknown(m) -} - -var xxx_messageInfo_TransferPiece proto.InternalMessageInfo - -func (m *TransferPiece) GetAddressedOrderLimit() *AddressedOrderLimit { - if m != nil { - return m.AddressedOrderLimit - } - return nil -} - -type DeletePiece struct { - OriginalPieceId PieceID `protobuf:"bytes,1,opt,name=original_piece_id,json=originalPieceId,proto3,customtype=PieceID" json:"original_piece_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeletePiece) Reset() { *m = DeletePiece{} } -func (m *DeletePiece) String() string { return proto.CompactTextString(m) } -func (*DeletePiece) ProtoMessage() {} -func (*DeletePiece) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{15} -} -func (m *DeletePiece) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeletePiece.Unmarshal(m, b) -} -func (m *DeletePiece) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeletePiece.Marshal(b, m, deterministic) -} -func (m *DeletePiece) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeletePiece.Merge(m, src) -} -func (m *DeletePiece) XXX_Size() int { - return xxx_messageInfo_DeletePiece.Size(m) -} -func (m *DeletePiece) XXX_DiscardUnknown() { - xxx_messageInfo_DeletePiece.DiscardUnknown(m) -} - -var xxx_messageInfo_DeletePiece proto.InternalMessageInfo - -type ExitCompleted struct { - // when everything is completed - ExitCompleteSignature []byte `protobuf:"bytes,1,opt,name=exit_complete_signature,json=exitCompleteSignature,proto3" json:"exit_complete_signature,omitempty"` - // satellite who issued this exit completed - SatelliteId NodeID `protobuf:"bytes,2,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` - // storage node this exit completed was issued to - NodeId NodeID `protobuf:"bytes,3,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - // timestamp when the exit completed - Completed time.Time `protobuf:"bytes,4,opt,name=completed,proto3,stdtime" json:"completed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExitCompleted) Reset() { *m = ExitCompleted{} } -func (m *ExitCompleted) String() string { return proto.CompactTextString(m) } -func (*ExitCompleted) ProtoMessage() {} -func (*ExitCompleted) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{16} -} -func (m *ExitCompleted) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExitCompleted.Unmarshal(m, b) -} -func (m *ExitCompleted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExitCompleted.Marshal(b, m, deterministic) -} -func (m *ExitCompleted) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExitCompleted.Merge(m, src) -} -func (m *ExitCompleted) XXX_Size() int { - return xxx_messageInfo_ExitCompleted.Size(m) -} -func (m *ExitCompleted) XXX_DiscardUnknown() { - xxx_messageInfo_ExitCompleted.DiscardUnknown(m) -} - -var xxx_messageInfo_ExitCompleted proto.InternalMessageInfo - -func (m *ExitCompleted) GetExitCompleteSignature() []byte { - if m != nil { - return m.ExitCompleteSignature - } - return nil -} - -func (m *ExitCompleted) GetCompleted() time.Time { - if m != nil { - return m.Completed - } - return time.Time{} -} - -type ExitFailed struct { - // on failure - ExitFailureSignature []byte `protobuf:"bytes,1,opt,name=exit_failure_signature,json=exitFailureSignature,proto3" json:"exit_failure_signature,omitempty"` - Reason ExitFailed_Reason `protobuf:"varint,2,opt,name=reason,proto3,enum=gracefulexit.ExitFailed_Reason" json:"reason,omitempty"` - // satellite who issued this exit failed - SatelliteId NodeID `protobuf:"bytes,3,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` - // storage node this exit failed was issued to - NodeId NodeID `protobuf:"bytes,4,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - // timestamp when the exit failed - Failed time.Time `protobuf:"bytes,5,opt,name=failed,proto3,stdtime" json:"failed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ExitFailed) Reset() { *m = ExitFailed{} } -func (m *ExitFailed) String() string { return proto.CompactTextString(m) } -func (*ExitFailed) ProtoMessage() {} -func (*ExitFailed) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{17} -} -func (m *ExitFailed) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ExitFailed.Unmarshal(m, b) -} -func (m *ExitFailed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ExitFailed.Marshal(b, m, deterministic) -} -func (m *ExitFailed) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExitFailed.Merge(m, src) -} -func (m *ExitFailed) XXX_Size() int { - return xxx_messageInfo_ExitFailed.Size(m) -} -func (m *ExitFailed) XXX_DiscardUnknown() { - xxx_messageInfo_ExitFailed.DiscardUnknown(m) -} - -var xxx_messageInfo_ExitFailed proto.InternalMessageInfo - -func (m *ExitFailed) GetExitFailureSignature() []byte { - if m != nil { - return m.ExitFailureSignature - } - return nil -} - -func (m *ExitFailed) GetReason() ExitFailed_Reason { - if m != nil { - return m.Reason - } - return ExitFailed_VERIFICATION_FAILED -} - -func (m *ExitFailed) GetFailed() time.Time { - if m != nil { - return m.Failed - } - return time.Time{} -} - -type SatelliteMessage struct { - // Types that are valid to be assigned to Message: - // *SatelliteMessage_NotReady - // *SatelliteMessage_TransferPiece - // *SatelliteMessage_DeletePiece - // *SatelliteMessage_ExitCompleted - // *SatelliteMessage_ExitFailed - Message isSatelliteMessage_Message `protobuf_oneof:"Message"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SatelliteMessage) Reset() { *m = SatelliteMessage{} } -func (m *SatelliteMessage) String() string { return proto.CompactTextString(m) } -func (*SatelliteMessage) ProtoMessage() {} -func (*SatelliteMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8f0acbf2ce5fa631, []int{18} -} -func (m *SatelliteMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SatelliteMessage.Unmarshal(m, b) -} -func (m *SatelliteMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SatelliteMessage.Marshal(b, m, deterministic) -} -func (m *SatelliteMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_SatelliteMessage.Merge(m, src) -} -func (m *SatelliteMessage) XXX_Size() int { - return xxx_messageInfo_SatelliteMessage.Size(m) -} -func (m *SatelliteMessage) XXX_DiscardUnknown() { - xxx_messageInfo_SatelliteMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_SatelliteMessage proto.InternalMessageInfo - -type isSatelliteMessage_Message interface { - isSatelliteMessage_Message() -} - -type SatelliteMessage_NotReady struct { - NotReady *NotReady `protobuf:"bytes,1,opt,name=not_ready,json=notReady,proto3,oneof"` -} -type SatelliteMessage_TransferPiece struct { - TransferPiece *TransferPiece `protobuf:"bytes,2,opt,name=transfer_piece,json=transferPiece,proto3,oneof"` -} -type SatelliteMessage_DeletePiece struct { - DeletePiece *DeletePiece `protobuf:"bytes,3,opt,name=delete_piece,json=deletePiece,proto3,oneof"` -} -type SatelliteMessage_ExitCompleted struct { - ExitCompleted *ExitCompleted `protobuf:"bytes,4,opt,name=exit_completed,json=exitCompleted,proto3,oneof"` -} -type SatelliteMessage_ExitFailed struct { - ExitFailed *ExitFailed `protobuf:"bytes,5,opt,name=exit_failed,json=exitFailed,proto3,oneof"` -} - -func (*SatelliteMessage_NotReady) isSatelliteMessage_Message() {} -func (*SatelliteMessage_TransferPiece) isSatelliteMessage_Message() {} -func (*SatelliteMessage_DeletePiece) isSatelliteMessage_Message() {} -func (*SatelliteMessage_ExitCompleted) isSatelliteMessage_Message() {} -func (*SatelliteMessage_ExitFailed) isSatelliteMessage_Message() {} - -func (m *SatelliteMessage) GetMessage() isSatelliteMessage_Message { - if m != nil { - return m.Message - } - return nil -} - -func (m *SatelliteMessage) GetNotReady() *NotReady { - if x, ok := m.GetMessage().(*SatelliteMessage_NotReady); ok { - return x.NotReady - } - return nil -} - -func (m *SatelliteMessage) GetTransferPiece() *TransferPiece { - if x, ok := m.GetMessage().(*SatelliteMessage_TransferPiece); ok { - return x.TransferPiece - } - return nil -} - -func (m *SatelliteMessage) GetDeletePiece() *DeletePiece { - if x, ok := m.GetMessage().(*SatelliteMessage_DeletePiece); ok { - return x.DeletePiece - } - return nil -} - -func (m *SatelliteMessage) GetExitCompleted() *ExitCompleted { - if x, ok := m.GetMessage().(*SatelliteMessage_ExitCompleted); ok { - return x.ExitCompleted - } - return nil -} - -func (m *SatelliteMessage) GetExitFailed() *ExitFailed { - if x, ok := m.GetMessage().(*SatelliteMessage_ExitFailed); ok { - return x.ExitFailed - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*SatelliteMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _SatelliteMessage_OneofMarshaler, _SatelliteMessage_OneofUnmarshaler, _SatelliteMessage_OneofSizer, []interface{}{ - (*SatelliteMessage_NotReady)(nil), - (*SatelliteMessage_TransferPiece)(nil), - (*SatelliteMessage_DeletePiece)(nil), - (*SatelliteMessage_ExitCompleted)(nil), - (*SatelliteMessage_ExitFailed)(nil), - } -} - -func _SatelliteMessage_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*SatelliteMessage) - // Message - switch x := m.Message.(type) { - case *SatelliteMessage_NotReady: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.NotReady); err != nil { - return err - } - case *SatelliteMessage_TransferPiece: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TransferPiece); err != nil { - return err - } - case *SatelliteMessage_DeletePiece: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.DeletePiece); err != nil { - return err - } - case *SatelliteMessage_ExitCompleted: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ExitCompleted); err != nil { - return err - } - case *SatelliteMessage_ExitFailed: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ExitFailed); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("SatelliteMessage.Message has unexpected type %T", x) - } - return nil -} - -func _SatelliteMessage_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*SatelliteMessage) - switch tag { - case 1: // Message.not_ready - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(NotReady) - err := b.DecodeMessage(msg) - m.Message = &SatelliteMessage_NotReady{msg} - return true, err - case 2: // Message.transfer_piece - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TransferPiece) - err := b.DecodeMessage(msg) - m.Message = &SatelliteMessage_TransferPiece{msg} - return true, err - case 3: // Message.delete_piece - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(DeletePiece) - err := b.DecodeMessage(msg) - m.Message = &SatelliteMessage_DeletePiece{msg} - return true, err - case 4: // Message.exit_completed - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ExitCompleted) - err := b.DecodeMessage(msg) - m.Message = &SatelliteMessage_ExitCompleted{msg} - return true, err - case 5: // Message.exit_failed - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ExitFailed) - err := b.DecodeMessage(msg) - m.Message = &SatelliteMessage_ExitFailed{msg} - return true, err - default: - return false, nil - } -} - -func _SatelliteMessage_OneofSizer(msg proto.Message) (n int) { - m := msg.(*SatelliteMessage) - // Message - switch x := m.Message.(type) { - case *SatelliteMessage_NotReady: - s := proto.Size(x.NotReady) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *SatelliteMessage_TransferPiece: - s := proto.Size(x.TransferPiece) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *SatelliteMessage_DeletePiece: - s := proto.Size(x.DeletePiece) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *SatelliteMessage_ExitCompleted: - s := proto.Size(x.ExitCompleted) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *SatelliteMessage_ExitFailed: - s := proto.Size(x.ExitFailed) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -func init() { - proto.RegisterEnum("gracefulexit.TransferFailed_Error", TransferFailed_Error_name, TransferFailed_Error_value) - proto.RegisterEnum("gracefulexit.ExitFailed_Reason", ExitFailed_Reason_name, ExitFailed_Reason_value) - proto.RegisterType((*GracefulExitFeasibilityNodeRequest)(nil), "gracefulexit.GracefulExitFeasibilityNodeRequest") - proto.RegisterType((*GetNonExitingSatellitesRequest)(nil), "gracefulexit.GetNonExitingSatellitesRequest") - proto.RegisterType((*InitiateGracefulExitRequest)(nil), "gracefulexit.InitiateGracefulExitRequest") - proto.RegisterType((*NonExitingSatellite)(nil), "gracefulexit.NonExitingSatellite") - proto.RegisterType((*GetNonExitingSatellitesResponse)(nil), "gracefulexit.GetNonExitingSatellitesResponse") - proto.RegisterType((*GetExitProgressRequest)(nil), "gracefulexit.GetExitProgressRequest") - proto.RegisterType((*GetExitProgressResponse)(nil), "gracefulexit.GetExitProgressResponse") - proto.RegisterType((*ExitProgress)(nil), "gracefulexit.ExitProgress") - proto.RegisterType((*GracefulExitFeasibilityRequest)(nil), "gracefulexit.GracefulExitFeasibilityRequest") - proto.RegisterType((*GracefulExitFeasibilityResponse)(nil), "gracefulexit.GracefulExitFeasibilityResponse") - proto.RegisterType((*TransferSucceeded)(nil), "gracefulexit.TransferSucceeded") - proto.RegisterType((*TransferFailed)(nil), "gracefulexit.TransferFailed") - proto.RegisterType((*StorageNodeMessage)(nil), "gracefulexit.StorageNodeMessage") - proto.RegisterType((*NotReady)(nil), "gracefulexit.NotReady") - proto.RegisterType((*TransferPiece)(nil), "gracefulexit.TransferPiece") - proto.RegisterType((*DeletePiece)(nil), "gracefulexit.DeletePiece") - proto.RegisterType((*ExitCompleted)(nil), "gracefulexit.ExitCompleted") - proto.RegisterType((*ExitFailed)(nil), "gracefulexit.ExitFailed") - proto.RegisterType((*SatelliteMessage)(nil), "gracefulexit.SatelliteMessage") -} - -func init() { proto.RegisterFile("gracefulexit.proto", fileDescriptor_8f0acbf2ce5fa631) } - -var fileDescriptor_8f0acbf2ce5fa631 = []byte{ - // 1380 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x5d, 0x73, 0xdb, 0x44, - 0x17, 0xb6, 0x92, 0xe6, 0xc3, 0xc7, 0x4e, 0xe2, 0x6c, 0xbe, 0xfc, 0x26, 0x6d, 0x9d, 0x57, 0xc0, - 0x34, 0x9d, 0x69, 0x9d, 0x12, 0xa0, 0x30, 0x53, 0x06, 0x46, 0x89, 0x95, 0x58, 0x34, 0x91, 0xd3, - 0x8d, 0x13, 0x3a, 0xcc, 0x80, 0x46, 0xb1, 0x4e, 0x9c, 0x6d, 0x6d, 0xad, 0x2b, 0xc9, 0xa5, 0xe1, - 0x82, 0x0b, 0x7e, 0x01, 0x97, 0x5c, 0x73, 0xcd, 0xdf, 0x60, 0x86, 0x6b, 0xee, 0x60, 0x86, 0x02, - 0x57, 0xfc, 0x0d, 0x46, 0xd2, 0x4a, 0x91, 0xfc, 0xd5, 0x94, 0x5e, 0xc5, 0x3a, 0x7b, 0xce, 0xd9, - 0xb3, 0xcf, 0x9e, 0xe7, 0xd9, 0x13, 0x20, 0x4d, 0xc7, 0x6c, 0xe0, 0x59, 0xb7, 0x85, 0x2f, 0x98, - 0x57, 0xee, 0x38, 0xdc, 0xe3, 0x24, 0x9f, 0xb4, 0xad, 0x42, 0x93, 0x37, 0x79, 0xb8, 0xb2, 0x5a, - 0x6a, 0x72, 0xde, 0x6c, 0xe1, 0x66, 0xf0, 0x75, 0xda, 0x3d, 0xdb, 0xf4, 0x58, 0x1b, 0x5d, 0xcf, - 0x6c, 0x77, 0x84, 0xc3, 0x6c, 0x1b, 0x3d, 0x93, 0xd9, 0x67, 0x51, 0x40, 0x9e, 0x3b, 0x16, 0x3a, - 0x6e, 0xf8, 0x25, 0x1f, 0x80, 0xbc, 0x27, 0x52, 0xab, 0x2f, 0x98, 0xb7, 0x8b, 0xa6, 0xcb, 0x4e, - 0x59, 0x8b, 0x79, 0x17, 0x3a, 0xb7, 0x90, 0xe2, 0xb3, 0x2e, 0xba, 0x1e, 0xb9, 0x05, 0x53, 0x36, - 0xb7, 0xd0, 0x60, 0x56, 0x51, 0x5a, 0x97, 0x36, 0xf2, 0xdb, 0xb3, 0xbf, 0xbc, 0x2c, 0x65, 0x7e, - 0x7f, 0x59, 0x9a, 0xf4, 0xbd, 0xb4, 0x0a, 0x9d, 0xf4, 0x97, 0x35, 0x4b, 0x5e, 0x87, 0x9b, 0x7b, - 0xe8, 0xe9, 0xdc, 0xf6, 0x93, 0x31, 0xbb, 0x79, 0x64, 0x7a, 0xd8, 0x6a, 0x31, 0x0f, 0x5d, 0x91, - 0x4a, 0xde, 0x85, 0x35, 0xcd, 0x66, 0x1e, 0x33, 0x3d, 0x4c, 0x6e, 0xfc, 0xda, 0x3b, 0x7d, 0x0b, - 0x0b, 0x03, 0xb6, 0xb9, 0x72, 0x3c, 0x29, 0x41, 0xce, 0xe2, 0x6d, 0x93, 0xd9, 0x86, 0x6d, 0xb6, - 0xb1, 0x38, 0xb6, 0x2e, 0x6d, 0x64, 0x29, 0x84, 0x26, 0xdd, 0x6c, 0x23, 0xb9, 0x01, 0xe0, 0x76, - 0xcc, 0x06, 0x1a, 0x5d, 0x17, 0xad, 0xe2, 0xf8, 0xba, 0xb4, 0x21, 0xd1, 0x6c, 0x60, 0x39, 0x76, - 0xd1, 0x92, 0x2d, 0x28, 0x0d, 0x3d, 0xa9, 0xdb, 0xe1, 0xb6, 0x8b, 0x44, 0x01, 0x70, 0x63, 0x6b, - 0x51, 0x5a, 0x1f, 0xdf, 0xc8, 0x6d, 0xfd, 0xbf, 0x9c, 0xba, 0xdd, 0x01, 0xf1, 0x34, 0x11, 0x24, - 0x17, 0x61, 0x79, 0x0f, 0x3d, 0xdf, 0xe5, 0xd0, 0xe1, 0x4d, 0x07, 0xdd, 0x18, 0xc7, 0x47, 0xb0, - 0xd2, 0xb7, 0x22, 0xf6, 0xbd, 0x0f, 0xd3, 0x1d, 0x61, 0x13, 0xbb, 0xae, 0xa6, 0x77, 0x4d, 0x45, - 0xc5, 0xbe, 0xf2, 0xaf, 0x12, 0xe4, 0x93, 0x4b, 0xbd, 0x18, 0x49, 0x7d, 0x18, 0x25, 0xd0, 0x1e, - 0x1b, 0x89, 0xf6, 0x6d, 0x28, 0x74, 0xd0, 0x69, 0xa0, 0xed, 0x19, 0x0d, 0xde, 0xee, 0xb4, 0xd0, - 0xc3, 0x00, 0xd2, 0x31, 0x3a, 0x27, 0xec, 0x3b, 0xc2, 0x4c, 0x6e, 0x02, 0xb8, 0xdd, 0x46, 0x03, - 0x5d, 0xf7, 0xac, 0xdb, 0x2a, 0x5e, 0x5b, 0x97, 0x36, 0xa6, 0x69, 0xc2, 0x42, 0xee, 0x02, 0x11, - 0x29, 0x18, 0xb7, 0x0d, 0x07, 0x1b, 0xc8, 0x3a, 0x5e, 0x71, 0xc2, 0xdf, 0x9e, 0xce, 0x5f, 0xae, - 0xd0, 0x70, 0x21, 0xe8, 0xc8, 0xc1, 0x0d, 0x1e, 0x21, 0xf9, 0x93, 0x04, 0xa5, 0xa1, 0x2e, 0xf1, - 0x55, 0x66, 0x9f, 0x70, 0x66, 0xa3, 0x65, 0x98, 0x5e, 0x80, 0x43, 0x80, 0x69, 0xc0, 0xbc, 0x72, - 0xc4, 0xbc, 0x72, 0x3d, 0x62, 0xde, 0xf6, 0xb4, 0x0f, 0xc3, 0xf7, 0x7f, 0x96, 0x24, 0x3a, 0x1d, - 0x86, 0x29, 0x7e, 0x67, 0xcf, 0xb5, 0xb9, 0xed, 0x9d, 0xbb, 0x86, 0x83, 0xcf, 0xba, 0xcc, 0xc1, - 0x10, 0xb3, 0x09, 0x3a, 0x1b, 0x9a, 0xa9, 0xb0, 0xfa, 0x8d, 0xc7, 0x5c, 0xc3, 0x6c, 0xb5, 0xf8, - 0xd7, 0xa2, 0xf1, 0xa6, 0x69, 0x96, 0xb9, 0x4a, 0x68, 0x90, 0x7f, 0x1c, 0x83, 0xf9, 0xba, 0x63, - 0xda, 0xee, 0x19, 0x3a, 0x47, 0x3e, 0x2c, 0x68, 0xa1, 0x45, 0x2a, 0xb0, 0xc8, 0x1d, 0xd6, 0x64, - 0xb6, 0xd9, 0x32, 0x02, 0x82, 0x1b, 0x2d, 0xd6, 0x66, 0x51, 0xad, 0xa4, 0x2c, 0x48, 0x5f, 0xf3, - 0xff, 0xec, 0xfb, 0x2b, 0x94, 0x44, 0xfe, 0x97, 0x36, 0xa2, 0xc0, 0x42, 0x9c, 0xa5, 0xc3, 0xb0, - 0x81, 0xc6, 0xb9, 0xe9, 0x9e, 0x07, 0x75, 0xe6, 0xb6, 0xe6, 0xa3, 0x24, 0x87, 0xfe, 0x4a, 0xd5, - 0x74, 0xcf, 0xe9, 0x7c, 0xe4, 0x1d, 0x9b, 0xc8, 0x1e, 0x2c, 0x3b, 0xd8, 0x69, 0x99, 0x0d, 0x6c, - 0xfb, 0xb7, 0x9d, 0xc8, 0x32, 0x3e, 0x2c, 0xcb, 0x62, 0x22, 0xe0, 0x32, 0xd1, 0x03, 0x98, 0xef, - 0xa9, 0x85, 0x59, 0x41, 0x3b, 0xe4, 0xb7, 0xe7, 0x44, 0x97, 0x4d, 0x05, 0xde, 0x5a, 0x85, 0xce, - 0xa5, 0xea, 0xd0, 0x2c, 0xf9, 0x6f, 0x09, 0x66, 0x23, 0x90, 0x76, 0x4d, 0xd6, 0x42, 0x6b, 0x70, - 0x3e, 0xe9, 0x6a, 0xf9, 0xc8, 0x47, 0x30, 0x81, 0x8e, 0xc3, 0x9d, 0x00, 0x8a, 0xd9, 0x2d, 0x39, - 0xcd, 0xa7, 0xf4, 0x4e, 0x65, 0xd5, 0xf7, 0xa4, 0x61, 0x80, 0xfc, 0x18, 0x26, 0x82, 0x6f, 0x32, - 0x03, 0x59, 0xbd, 0x56, 0x37, 0x76, 0x6b, 0xc7, 0x7a, 0xa5, 0x90, 0x21, 0xd7, 0xa1, 0x78, 0x54, - 0xaf, 0x51, 0x65, 0x4f, 0x35, 0xf4, 0x5a, 0x45, 0x35, 0x8e, 0x75, 0xe5, 0x44, 0xd1, 0xf6, 0x95, - 0xed, 0x7d, 0xb5, 0x20, 0x91, 0x25, 0x98, 0xaf, 0x2a, 0x47, 0x55, 0xe3, 0x44, 0xa5, 0xda, 0xae, - 0xb6, 0xa3, 0xd4, 0xb5, 0x9a, 0x5e, 0x18, 0x23, 0x39, 0x98, 0x3a, 0xd6, 0x1f, 0xea, 0xb5, 0xcf, - 0xf5, 0x02, 0xc8, 0x3f, 0x48, 0x40, 0x8e, 0x3c, 0xee, 0x98, 0x4d, 0xf4, 0xd9, 0x76, 0x80, 0xae, - 0x6b, 0x36, 0x91, 0x7c, 0x0a, 0x59, 0x37, 0x6a, 0x0b, 0x71, 0xfd, 0xa5, 0xc1, 0xe5, 0xc6, 0xdd, - 0x53, 0xcd, 0xd0, 0xcb, 0x18, 0x72, 0x1f, 0x26, 0xcf, 0x82, 0x83, 0x88, 0x7b, 0xbf, 0x3e, 0xea, - 0xb0, 0xd5, 0x0c, 0x15, 0xde, 0xdb, 0x59, 0x98, 0x12, 0x35, 0xc8, 0x00, 0xd3, 0x3a, 0xf7, 0x28, - 0x9a, 0xd6, 0x85, 0xfc, 0x9b, 0x04, 0x33, 0x51, 0x4c, 0x00, 0xe7, 0x9b, 0xde, 0x44, 0xae, 0xe3, - 0xb0, 0xe7, 0xa6, 0x87, 0xc6, 0x53, 0xbc, 0x10, 0xb2, 0xb3, 0x22, 0xc2, 0xe6, 0x02, 0xaf, 0xc3, - 0x70, 0xfd, 0x21, 0x5e, 0x50, 0xe8, 0xc4, 0xbf, 0xc9, 0x23, 0x58, 0x32, 0x2d, 0xcb, 0x17, 0x36, - 0xb4, 0x52, 0x1c, 0x09, 0x1b, 0xf3, 0x46, 0x39, 0x7e, 0x28, 0x95, 0xc8, 0x2d, 0x41, 0x97, 0x05, - 0xb3, 0xdf, 0x28, 0x7f, 0x06, 0xb9, 0x0a, 0xfa, 0xaa, 0xf5, 0xe6, 0x07, 0x93, 0xff, 0x91, 0x60, - 0xc6, 0x97, 0x9f, 0x48, 0x08, 0xfd, 0x8b, 0x58, 0xf1, 0x11, 0x8f, 0x15, 0xd3, 0x70, 0x59, 0xd3, - 0x36, 0xbd, 0xae, 0x13, 0x4a, 0x71, 0x9e, 0x2e, 0x61, 0xc2, 0xff, 0x28, 0x5a, 0x24, 0xef, 0x42, - 0x3e, 0x7e, 0x42, 0x86, 0x4b, 0x73, 0x2e, 0xf6, 0xd1, 0xac, 0xa4, 0x90, 0x8f, 0x8f, 0x14, 0xf2, - 0x6d, 0xc8, 0x46, 0xe5, 0x84, 0x6c, 0xbc, 0xaa, 0x10, 0x5e, 0x86, 0xc9, 0xdf, 0x8d, 0x03, 0x04, - 0x42, 0x1b, 0x12, 0xf3, 0x7d, 0x58, 0x0e, 0x8e, 0xe9, 0xb7, 0x51, 0xd7, 0xe9, 0x3f, 0xe5, 0x22, - 0x0a, 0xdf, 0xae, 0x93, 0x38, 0xe4, 0x87, 0x30, 0xe9, 0xa0, 0xe9, 0x72, 0x5b, 0x50, 0xb2, 0xd4, - 0xff, 0xc4, 0x09, 0x3a, 0xd2, 0xc0, 0x8d, 0x0a, 0xf7, 0x3e, 0x74, 0xc6, 0x5f, 0x0b, 0x9d, 0x6b, - 0x23, 0xd1, 0xf9, 0x38, 0xa6, 0xce, 0xc4, 0x6b, 0x40, 0x23, 0x62, 0xe4, 0xa7, 0x30, 0x19, 0xd6, - 0x4a, 0x56, 0x60, 0x21, 0xc9, 0x7c, 0x63, 0x57, 0xd1, 0xf6, 0x55, 0x5f, 0x35, 0x4a, 0xb0, 0xa6, - 0xe9, 0xca, 0x4e, 0x5d, 0x3b, 0x51, 0x8d, 0xba, 0x76, 0xa0, 0xee, 0x52, 0xe5, 0x40, 0x35, 0xd4, - 0xc7, 0x3b, 0xaa, 0x5a, 0x51, 0x2b, 0x05, 0x89, 0xdc, 0x82, 0xb7, 0x6a, 0x27, 0x2a, 0x55, 0xf6, - 0xf7, 0x83, 0xa0, 0x63, 0xaa, 0x1a, 0x87, 0x2a, 0xdd, 0x51, 0xf5, 0xba, 0xaf, 0x34, 0xb1, 0xe3, - 0x98, 0xfc, 0xc7, 0x18, 0x14, 0xe2, 0x99, 0x23, 0xd2, 0x8e, 0x0f, 0x20, 0x6b, 0x73, 0xcf, 0x70, - 0x7c, 0xe2, 0x0a, 0xed, 0x58, 0xee, 0x1d, 0x58, 0x42, 0x5a, 0x57, 0x33, 0x74, 0xda, 0x16, 0xbf, - 0x49, 0x05, 0x66, 0x3d, 0xc1, 0xf0, 0xb0, 0xef, 0x85, 0x72, 0xac, 0x0d, 0x56, 0x8e, 0x50, 0xe3, - 0x33, 0x74, 0xc6, 0x4b, 0xc9, 0xc2, 0x27, 0x90, 0xb7, 0x02, 0x32, 0x89, 0x1c, 0x21, 0x2d, 0xff, - 0x97, 0xce, 0x91, 0xa0, 0x5b, 0x35, 0x43, 0x73, 0x56, 0x82, 0x7d, 0x15, 0x98, 0x4d, 0xd1, 0x25, - 0xea, 0xcf, 0xb5, 0xfe, 0xce, 0x88, 0x39, 0xe6, 0x57, 0x81, 0x29, 0xd2, 0x3d, 0x80, 0x5c, 0xdc, - 0x8d, 0xf1, 0x3d, 0x16, 0x87, 0x35, 0x57, 0x35, 0x43, 0x01, 0xe3, 0xaf, 0x84, 0x04, 0x6e, 0xfd, - 0x3c, 0x0e, 0x05, 0xbf, 0x3b, 0x92, 0x93, 0x05, 0x79, 0x1e, 0x0c, 0x6d, 0x83, 0x86, 0x46, 0x72, - 0x27, 0xbd, 0xc5, 0xe8, 0x29, 0x7a, 0xf5, 0xee, 0x15, 0xbd, 0xc5, 0xf8, 0xf2, 0x25, 0x2c, 0x0e, - 0x1a, 0xba, 0xc9, 0xed, 0x74, 0x9a, 0x11, 0x83, 0xf9, 0xea, 0x88, 0x11, 0x92, 0x7c, 0x05, 0x73, - 0x3d, 0xb3, 0x28, 0x79, 0xbb, 0xaf, 0xc0, 0x01, 0x43, 0xec, 0xea, 0x3b, 0xaf, 0xf0, 0x12, 0xe5, - 0x7f, 0x03, 0x2b, 0x43, 0x06, 0x34, 0x72, 0xaf, 0x27, 0xc3, 0x2b, 0xff, 0x97, 0xe9, 0x83, 0x6e, - 0xf4, 0xe4, 0xb7, 0xf5, 0x97, 0x04, 0x4b, 0x31, 0xa2, 0x29, 0xf0, 0x6a, 0x30, 0x75, 0xe8, 0x70, - 0x7f, 0x2c, 0x25, 0xeb, 0xe9, 0x9c, 0xfd, 0xaf, 0xf2, 0xea, 0xcd, 0x1e, 0x8f, 0x1e, 0xe6, 0x6d, - 0x48, 0xf7, 0xa4, 0xa0, 0x3b, 0x86, 0x1c, 0xf3, 0xce, 0x15, 0x8b, 0xfe, 0x2f, 0x47, 0xdc, 0x5e, - 0xfc, 0x82, 0xb8, 0x1e, 0x77, 0x9e, 0x94, 0x19, 0xdf, 0x6c, 0xf0, 0x76, 0x9b, 0xdb, 0x9b, 0x9d, - 0xd3, 0xd3, 0xc9, 0x40, 0xb3, 0xde, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0x03, 0x63, 0xdd, 0xfc, - 0x8f, 0x0e, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCNodeGracefulExitClient interface { - DRPCConn() drpc.Conn - - // GetSatellitesList returns a list of satellites that the storagenode has not exited. - GetNonExitingSatellites(ctx context.Context, in *GetNonExitingSatellitesRequest) (*GetNonExitingSatellitesResponse, error) - // InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting. - InitiateGracefulExit(ctx context.Context, in *InitiateGracefulExitRequest) (*ExitProgress, error) - // GetExitProgress returns graceful exit status on each satellite for a given storagenode. - GetExitProgress(ctx context.Context, in *GetExitProgressRequest) (*GetExitProgressResponse, error) - // GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed. - GracefulExitFeasibility(ctx context.Context, in *GracefulExitFeasibilityNodeRequest) (*GracefulExitFeasibilityResponse, error) -} - -type drpcNodeGracefulExitClient struct { - cc drpc.Conn -} - -func NewDRPCNodeGracefulExitClient(cc drpc.Conn) DRPCNodeGracefulExitClient { - return &drpcNodeGracefulExitClient{cc} -} - -func (c *drpcNodeGracefulExitClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcNodeGracefulExitClient) GetNonExitingSatellites(ctx context.Context, in *GetNonExitingSatellitesRequest) (*GetNonExitingSatellitesResponse, error) { - out := new(GetNonExitingSatellitesResponse) - err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/GetNonExitingSatellites", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcNodeGracefulExitClient) InitiateGracefulExit(ctx context.Context, in *InitiateGracefulExitRequest) (*ExitProgress, error) { - out := new(ExitProgress) - err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/InitiateGracefulExit", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcNodeGracefulExitClient) GetExitProgress(ctx context.Context, in *GetExitProgressRequest) (*GetExitProgressResponse, error) { - out := new(GetExitProgressResponse) - err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/GetExitProgress", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcNodeGracefulExitClient) GracefulExitFeasibility(ctx context.Context, in *GracefulExitFeasibilityNodeRequest) (*GracefulExitFeasibilityResponse, error) { - out := new(GracefulExitFeasibilityResponse) - err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/GracefulExitFeasibility", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCNodeGracefulExitServer interface { - // GetSatellitesList returns a list of satellites that the storagenode has not exited. - GetNonExitingSatellites(context.Context, *GetNonExitingSatellitesRequest) (*GetNonExitingSatellitesResponse, error) - // InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting. - InitiateGracefulExit(context.Context, *InitiateGracefulExitRequest) (*ExitProgress, error) - // GetExitProgress returns graceful exit status on each satellite for a given storagenode. - GetExitProgress(context.Context, *GetExitProgressRequest) (*GetExitProgressResponse, error) - // GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed. - GracefulExitFeasibility(context.Context, *GracefulExitFeasibilityNodeRequest) (*GracefulExitFeasibilityResponse, error) -} - -type DRPCNodeGracefulExitDescription struct{} - -func (DRPCNodeGracefulExitDescription) NumMethods() int { return 4 } - -func (DRPCNodeGracefulExitDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/gracefulexit.NodeGracefulExit/GetNonExitingSatellites", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeGracefulExitServer). - GetNonExitingSatellites( - ctx, - in1.(*GetNonExitingSatellitesRequest), - ) - }, DRPCNodeGracefulExitServer.GetNonExitingSatellites, true - case 1: - return "/gracefulexit.NodeGracefulExit/InitiateGracefulExit", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeGracefulExitServer). - InitiateGracefulExit( - ctx, - in1.(*InitiateGracefulExitRequest), - ) - }, DRPCNodeGracefulExitServer.InitiateGracefulExit, true - case 2: - return "/gracefulexit.NodeGracefulExit/GetExitProgress", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeGracefulExitServer). - GetExitProgress( - ctx, - in1.(*GetExitProgressRequest), - ) - }, DRPCNodeGracefulExitServer.GetExitProgress, true - case 3: - return "/gracefulexit.NodeGracefulExit/GracefulExitFeasibility", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeGracefulExitServer). - GracefulExitFeasibility( - ctx, - in1.(*GracefulExitFeasibilityNodeRequest), - ) - }, DRPCNodeGracefulExitServer.GracefulExitFeasibility, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterNodeGracefulExit(mux drpc.Mux, impl DRPCNodeGracefulExitServer) error { - return mux.Register(impl, DRPCNodeGracefulExitDescription{}) -} - -type DRPCNodeGracefulExit_GetNonExitingSatellitesStream interface { - drpc.Stream - SendAndClose(*GetNonExitingSatellitesResponse) error -} - -type drpcNodeGracefulExitGetNonExitingSatellitesStream struct { - drpc.Stream -} - -func (x *drpcNodeGracefulExitGetNonExitingSatellitesStream) SendAndClose(m *GetNonExitingSatellitesResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNodeGracefulExit_InitiateGracefulExitStream interface { - drpc.Stream - SendAndClose(*ExitProgress) error -} - -type drpcNodeGracefulExitInitiateGracefulExitStream struct { - drpc.Stream -} - -func (x *drpcNodeGracefulExitInitiateGracefulExitStream) SendAndClose(m *ExitProgress) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNodeGracefulExit_GetExitProgressStream interface { - drpc.Stream - SendAndClose(*GetExitProgressResponse) error -} - -type drpcNodeGracefulExitGetExitProgressStream struct { - drpc.Stream -} - -func (x *drpcNodeGracefulExitGetExitProgressStream) SendAndClose(m *GetExitProgressResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNodeGracefulExit_GracefulExitFeasibilityStream interface { - drpc.Stream - SendAndClose(*GracefulExitFeasibilityResponse) error -} - -type drpcNodeGracefulExitGracefulExitFeasibilityStream struct { - drpc.Stream -} - -func (x *drpcNodeGracefulExitGracefulExitFeasibilityStream) SendAndClose(m *GracefulExitFeasibilityResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCSatelliteGracefulExitClient interface { - DRPCConn() drpc.Conn - - // Process is called by storage nodes to initiate the graceful exit, get pieces to transfer, and receive exit status. - Process(ctx context.Context) (DRPCSatelliteGracefulExit_ProcessClient, error) - // GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed. - GracefulExitFeasibility(ctx context.Context, in *GracefulExitFeasibilityRequest) (*GracefulExitFeasibilityResponse, error) -} - -type drpcSatelliteGracefulExitClient struct { - cc drpc.Conn -} - -func NewDRPCSatelliteGracefulExitClient(cc drpc.Conn) DRPCSatelliteGracefulExitClient { - return &drpcSatelliteGracefulExitClient{cc} -} - -func (c *drpcSatelliteGracefulExitClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcSatelliteGracefulExitClient) Process(ctx context.Context) (DRPCSatelliteGracefulExit_ProcessClient, error) { - stream, err := c.cc.NewStream(ctx, "/gracefulexit.SatelliteGracefulExit/Process") - if err != nil { - return nil, err - } - x := &drpcSatelliteGracefulExitProcessClient{stream} - return x, nil -} - -type DRPCSatelliteGracefulExit_ProcessClient interface { - drpc.Stream - Send(*StorageNodeMessage) error - Recv() (*SatelliteMessage, error) -} - -type drpcSatelliteGracefulExitProcessClient struct { - drpc.Stream -} - -func (x *drpcSatelliteGracefulExitProcessClient) Send(m *StorageNodeMessage) error { - return x.MsgSend(m) -} - -func (x *drpcSatelliteGracefulExitProcessClient) Recv() (*SatelliteMessage, error) { - m := new(SatelliteMessage) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *drpcSatelliteGracefulExitClient) GracefulExitFeasibility(ctx context.Context, in *GracefulExitFeasibilityRequest) (*GracefulExitFeasibilityResponse, error) { - out := new(GracefulExitFeasibilityResponse) - err := c.cc.Invoke(ctx, "/gracefulexit.SatelliteGracefulExit/GracefulExitFeasibility", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCSatelliteGracefulExitServer interface { - // Process is called by storage nodes to initiate the graceful exit, get pieces to transfer, and receive exit status. - Process(DRPCSatelliteGracefulExit_ProcessStream) error - // GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed. - GracefulExitFeasibility(context.Context, *GracefulExitFeasibilityRequest) (*GracefulExitFeasibilityResponse, error) -} - -type DRPCSatelliteGracefulExitDescription struct{} - -func (DRPCSatelliteGracefulExitDescription) NumMethods() int { return 2 } - -func (DRPCSatelliteGracefulExitDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/gracefulexit.SatelliteGracefulExit/Process", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCSatelliteGracefulExitServer). - Process( - &drpcSatelliteGracefulExitProcessStream{in1.(drpc.Stream)}, - ) - }, DRPCSatelliteGracefulExitServer.Process, true - case 1: - return "/gracefulexit.SatelliteGracefulExit/GracefulExitFeasibility", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCSatelliteGracefulExitServer). - GracefulExitFeasibility( - ctx, - in1.(*GracefulExitFeasibilityRequest), - ) - }, DRPCSatelliteGracefulExitServer.GracefulExitFeasibility, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterSatelliteGracefulExit(mux drpc.Mux, impl DRPCSatelliteGracefulExitServer) error { - return mux.Register(impl, DRPCSatelliteGracefulExitDescription{}) -} - -type DRPCSatelliteGracefulExit_ProcessStream interface { - drpc.Stream - Send(*SatelliteMessage) error - Recv() (*StorageNodeMessage, error) -} - -type drpcSatelliteGracefulExitProcessStream struct { - drpc.Stream -} - -func (x *drpcSatelliteGracefulExitProcessStream) Send(m *SatelliteMessage) error { - return x.MsgSend(m) -} - -func (x *drpcSatelliteGracefulExitProcessStream) Recv() (*StorageNodeMessage, error) { - m := new(StorageNodeMessage) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -type DRPCSatelliteGracefulExit_GracefulExitFeasibilityStream interface { - drpc.Stream - SendAndClose(*GracefulExitFeasibilityResponse) error -} - -type drpcSatelliteGracefulExitGracefulExitFeasibilityStream struct { - drpc.Stream -} - -func (x *drpcSatelliteGracefulExitGracefulExitFeasibilityStream) SendAndClose(m *GracefulExitFeasibilityResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/gracefulexit.proto b/vendor/storj.io/common/pb/gracefulexit.proto deleted file mode 100644 index 088434c34..000000000 --- a/vendor/storj.io/common/pb/gracefulexit.proto +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "metainfo.proto"; -import "orders.proto"; - -package gracefulexit; - -// NodeGracefulExit is a private service on storagenodes. -service NodeGracefulExit { - // GetSatellitesList returns a list of satellites that the storagenode has not exited. - rpc GetNonExitingSatellites(GetNonExitingSatellitesRequest) returns (GetNonExitingSatellitesResponse); - // InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting. - rpc InitiateGracefulExit(InitiateGracefulExitRequest) returns (ExitProgress); - // GetExitProgress returns graceful exit status on each satellite for a given storagenode. - rpc GetExitProgress(GetExitProgressRequest) returns (GetExitProgressResponse); - // GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed. - rpc GracefulExitFeasibility(GracefulExitFeasibilityNodeRequest) returns (GracefulExitFeasibilityResponse); -} - -message GracefulExitFeasibilityNodeRequest { - bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; -} - -message GetNonExitingSatellitesRequest{} - -message InitiateGracefulExitRequest { - bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; -} - -// NonExitingSatellite contains information that's needed for a storagenode to start graceful exit. -message NonExitingSatellite { - bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - string domain_name = 2; - double space_used = 3; -} - -message GetNonExitingSatellitesResponse { - repeated NonExitingSatellite satellites = 1; -} - -message GetExitProgressRequest {} - -message GetExitProgressResponse { - repeated ExitProgress progress = 1; -} - -message ExitProgress { - string domain_name = 1; - bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - float percent_complete = 3; - bool successful = 4; - bytes completion_receipt = 5; -} - -service SatelliteGracefulExit { - // Process is called by storage nodes to initiate the graceful exit, get pieces to transfer, and receive exit status. - rpc Process(stream StorageNodeMessage) returns (stream SatelliteMessage); - // GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed. - rpc GracefulExitFeasibility(GracefulExitFeasibilityRequest) returns (GracefulExitFeasibilityResponse); -} - -message GracefulExitFeasibilityRequest {} - -message GracefulExitFeasibilityResponse { - google.protobuf.Timestamp joined_at = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - int32 months_required = 2; - bool is_allowed = 3; -} - -message TransferSucceeded { - orders.OrderLimit original_order_limit = 1; - orders.PieceHash original_piece_hash = 2; - orders.PieceHash replacement_piece_hash = 3; - bytes original_piece_id = 4 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; -} - -message TransferFailed { - bytes original_piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - enum Error { - NOT_FOUND = 0; - STORAGE_NODE_UNAVAILABLE = 1; - HASH_VERIFICATION = 2; - - UNKNOWN = 10; - } - Error error = 2; -} - -message StorageNodeMessage { - oneof Message { - TransferSucceeded succeeded = 1; - TransferFailed failed = 2; - } -} - -message NotReady {} - -message TransferPiece { - bytes original_piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - bytes private_key = 2 [(gogoproto.customtype) = "PiecePrivateKey", (gogoproto.nullable) = false]; - - // addressed_order_limit contains the new piece id. - metainfo.AddressedOrderLimit addressed_order_limit =3; -} - -message DeletePiece { - bytes original_piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; -} - -message ExitCompleted { - // when everything is completed - bytes exit_complete_signature = 1; - // satellite who issued this exit completed - bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - // storage node this exit completed was issued to - bytes node_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - // timestamp when the exit completed - google.protobuf.Timestamp completed = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message ExitFailed { - enum Reason { - VERIFICATION_FAILED = 0; - INACTIVE_TIMEFRAME_EXCEEDED = 1; - OVERALL_FAILURE_PERCENTAGE_EXCEEDED = 2; - } - // on failure - bytes exit_failure_signature = 1; - Reason reason = 2; - // satellite who issued this exit failed - bytes satellite_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - // storage node this exit failed was issued to - bytes node_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - // timestamp when the exit failed - google.protobuf.Timestamp failed = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message SatelliteMessage { - oneof Message { - NotReady not_ready = 1; - TransferPiece transfer_piece = 2; - DeletePiece delete_piece = 3; - ExitCompleted exit_completed = 4; - ExitFailed exit_failed = 5; - } -} - diff --git a/vendor/storj.io/common/pb/heldamount.pb.go b/vendor/storj.io/common/pb/heldamount.pb.go deleted file mode 100644 index 6ce8bf4a1..000000000 --- a/vendor/storj.io/common/pb/heldamount.pb.go +++ /dev/null @@ -1,483 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: heldamount.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type GetHeldAmountRequest struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetHeldAmountRequest) Reset() { *m = GetHeldAmountRequest{} } -func (m *GetHeldAmountRequest) String() string { return proto.CompactTextString(m) } -func (*GetHeldAmountRequest) ProtoMessage() {} -func (*GetHeldAmountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5c5d9f6e3ee97993, []int{0} -} -func (m *GetHeldAmountRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetHeldAmountRequest.Unmarshal(m, b) -} -func (m *GetHeldAmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetHeldAmountRequest.Marshal(b, m, deterministic) -} -func (m *GetHeldAmountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetHeldAmountRequest.Merge(m, src) -} -func (m *GetHeldAmountRequest) XXX_Size() int { - return xxx_messageInfo_GetHeldAmountRequest.Size(m) -} -func (m *GetHeldAmountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetHeldAmountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetHeldAmountRequest proto.InternalMessageInfo - -func (m *GetHeldAmountRequest) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -type GetHeldAmountResponse struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - NodeId NodeID `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - CreatedAt time.Time `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` - Codes string `protobuf:"bytes,4,opt,name=codes,proto3" json:"codes,omitempty"` - UsageAtRest float64 `protobuf:"fixed64,5,opt,name=usage_at_rest,json=usageAtRest,proto3" json:"usage_at_rest,omitempty"` - UsageGet int64 `protobuf:"varint,6,opt,name=usage_get,json=usageGet,proto3" json:"usage_get,omitempty"` - UsagePut int64 `protobuf:"varint,7,opt,name=usage_put,json=usagePut,proto3" json:"usage_put,omitempty"` - UsageGetRepair int64 `protobuf:"varint,8,opt,name=usage_get_repair,json=usageGetRepair,proto3" json:"usage_get_repair,omitempty"` - UsagePutRepair int64 `protobuf:"varint,9,opt,name=usage_put_repair,json=usagePutRepair,proto3" json:"usage_put_repair,omitempty"` - UsageGetAudit int64 `protobuf:"varint,10,opt,name=usage_get_audit,json=usageGetAudit,proto3" json:"usage_get_audit,omitempty"` - CompAtRest int64 `protobuf:"varint,11,opt,name=comp_at_rest,json=compAtRest,proto3" json:"comp_at_rest,omitempty"` - CompGet int64 `protobuf:"varint,12,opt,name=comp_get,json=compGet,proto3" json:"comp_get,omitempty"` - CompPut int64 `protobuf:"varint,13,opt,name=comp_put,json=compPut,proto3" json:"comp_put,omitempty"` - CompGetRepair int64 `protobuf:"varint,14,opt,name=comp_get_repair,json=compGetRepair,proto3" json:"comp_get_repair,omitempty"` - CompPutRepair int64 `protobuf:"varint,15,opt,name=comp_put_repair,json=compPutRepair,proto3" json:"comp_put_repair,omitempty"` - CompGetAudit int64 `protobuf:"varint,16,opt,name=comp_get_audit,json=compGetAudit,proto3" json:"comp_get_audit,omitempty"` - SurgePercent int64 `protobuf:"varint,17,opt,name=surge_percent,json=surgePercent,proto3" json:"surge_percent,omitempty"` - Held int64 `protobuf:"varint,18,opt,name=held,proto3" json:"held,omitempty"` - Owed int64 `protobuf:"varint,19,opt,name=owed,proto3" json:"owed,omitempty"` - Disposed int64 `protobuf:"varint,20,opt,name=disposed,proto3" json:"disposed,omitempty"` - Paid int64 `protobuf:"varint,21,opt,name=paid,proto3" json:"paid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetHeldAmountResponse) Reset() { *m = GetHeldAmountResponse{} } -func (m *GetHeldAmountResponse) String() string { return proto.CompactTextString(m) } -func (*GetHeldAmountResponse) ProtoMessage() {} -func (*GetHeldAmountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5c5d9f6e3ee97993, []int{1} -} -func (m *GetHeldAmountResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetHeldAmountResponse.Unmarshal(m, b) -} -func (m *GetHeldAmountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetHeldAmountResponse.Marshal(b, m, deterministic) -} -func (m *GetHeldAmountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetHeldAmountResponse.Merge(m, src) -} -func (m *GetHeldAmountResponse) XXX_Size() int { - return xxx_messageInfo_GetHeldAmountResponse.Size(m) -} -func (m *GetHeldAmountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetHeldAmountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetHeldAmountResponse proto.InternalMessageInfo - -func (m *GetHeldAmountResponse) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -func (m *GetHeldAmountResponse) GetCreatedAt() time.Time { - if m != nil { - return m.CreatedAt - } - return time.Time{} -} - -func (m *GetHeldAmountResponse) GetCodes() string { - if m != nil { - return m.Codes - } - return "" -} - -func (m *GetHeldAmountResponse) GetUsageAtRest() float64 { - if m != nil { - return m.UsageAtRest - } - return 0 -} - -func (m *GetHeldAmountResponse) GetUsageGet() int64 { - if m != nil { - return m.UsageGet - } - return 0 -} - -func (m *GetHeldAmountResponse) GetUsagePut() int64 { - if m != nil { - return m.UsagePut - } - return 0 -} - -func (m *GetHeldAmountResponse) GetUsageGetRepair() int64 { - if m != nil { - return m.UsageGetRepair - } - return 0 -} - -func (m *GetHeldAmountResponse) GetUsagePutRepair() int64 { - if m != nil { - return m.UsagePutRepair - } - return 0 -} - -func (m *GetHeldAmountResponse) GetUsageGetAudit() int64 { - if m != nil { - return m.UsageGetAudit - } - return 0 -} - -func (m *GetHeldAmountResponse) GetCompAtRest() int64 { - if m != nil { - return m.CompAtRest - } - return 0 -} - -func (m *GetHeldAmountResponse) GetCompGet() int64 { - if m != nil { - return m.CompGet - } - return 0 -} - -func (m *GetHeldAmountResponse) GetCompPut() int64 { - if m != nil { - return m.CompPut - } - return 0 -} - -func (m *GetHeldAmountResponse) GetCompGetRepair() int64 { - if m != nil { - return m.CompGetRepair - } - return 0 -} - -func (m *GetHeldAmountResponse) GetCompPutRepair() int64 { - if m != nil { - return m.CompPutRepair - } - return 0 -} - -func (m *GetHeldAmountResponse) GetCompGetAudit() int64 { - if m != nil { - return m.CompGetAudit - } - return 0 -} - -func (m *GetHeldAmountResponse) GetSurgePercent() int64 { - if m != nil { - return m.SurgePercent - } - return 0 -} - -func (m *GetHeldAmountResponse) GetHeld() int64 { - if m != nil { - return m.Held - } - return 0 -} - -func (m *GetHeldAmountResponse) GetOwed() int64 { - if m != nil { - return m.Owed - } - return 0 -} - -func (m *GetHeldAmountResponse) GetDisposed() int64 { - if m != nil { - return m.Disposed - } - return 0 -} - -func (m *GetHeldAmountResponse) GetPaid() int64 { - if m != nil { - return m.Paid - } - return 0 -} - -type GetAllPaystubsRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetAllPaystubsRequest) Reset() { *m = GetAllPaystubsRequest{} } -func (m *GetAllPaystubsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllPaystubsRequest) ProtoMessage() {} -func (*GetAllPaystubsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5c5d9f6e3ee97993, []int{2} -} -func (m *GetAllPaystubsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllPaystubsRequest.Unmarshal(m, b) -} -func (m *GetAllPaystubsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllPaystubsRequest.Marshal(b, m, deterministic) -} -func (m *GetAllPaystubsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllPaystubsRequest.Merge(m, src) -} -func (m *GetAllPaystubsRequest) XXX_Size() int { - return xxx_messageInfo_GetAllPaystubsRequest.Size(m) -} -func (m *GetAllPaystubsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllPaystubsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllPaystubsRequest proto.InternalMessageInfo - -type GetAllPaystubsResponse struct { - Paystub []*GetHeldAmountResponse `protobuf:"bytes,1,rep,name=paystub,proto3" json:"paystub,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetAllPaystubsResponse) Reset() { *m = GetAllPaystubsResponse{} } -func (m *GetAllPaystubsResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllPaystubsResponse) ProtoMessage() {} -func (*GetAllPaystubsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5c5d9f6e3ee97993, []int{3} -} -func (m *GetAllPaystubsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllPaystubsResponse.Unmarshal(m, b) -} -func (m *GetAllPaystubsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllPaystubsResponse.Marshal(b, m, deterministic) -} -func (m *GetAllPaystubsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllPaystubsResponse.Merge(m, src) -} -func (m *GetAllPaystubsResponse) XXX_Size() int { - return xxx_messageInfo_GetAllPaystubsResponse.Size(m) -} -func (m *GetAllPaystubsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllPaystubsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllPaystubsResponse proto.InternalMessageInfo - -func (m *GetAllPaystubsResponse) GetPaystub() []*GetHeldAmountResponse { - if m != nil { - return m.Paystub - } - return nil -} - -func init() { - proto.RegisterType((*GetHeldAmountRequest)(nil), "heldamount.GetHeldAmountRequest") - proto.RegisterType((*GetHeldAmountResponse)(nil), "heldamount.GetHeldAmountResponse") - proto.RegisterType((*GetAllPaystubsRequest)(nil), "heldamount.GetAllPaystubsRequest") - proto.RegisterType((*GetAllPaystubsResponse)(nil), "heldamount.GetAllPaystubsResponse") -} - -func init() { proto.RegisterFile("heldamount.proto", fileDescriptor_5c5d9f6e3ee97993) } - -var fileDescriptor_5c5d9f6e3ee97993 = []byte{ - // 581 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcf, 0x6e, 0x13, 0x31, - 0x10, 0xc6, 0x59, 0xda, 0xe6, 0xcf, 0xe4, 0x4f, 0x8b, 0x49, 0xc1, 0x84, 0x43, 0x96, 0x80, 0xca, - 0x9e, 0x12, 0xa9, 0x1c, 0xe1, 0x92, 0x82, 0x54, 0x7a, 0x41, 0x61, 0x29, 0x42, 0xe2, 0x12, 0x6d, - 0xe2, 0x61, 0x59, 0x94, 0x8d, 0xcd, 0xda, 0x16, 0xea, 0x5b, 0xf0, 0x38, 0x3c, 0x02, 0xcf, 0xc0, - 0xa1, 0xbc, 0x09, 0x42, 0xb6, 0xd7, 0xd9, 0x10, 0x50, 0x11, 0xe2, 0x66, 0x7f, 0xf3, 0x9b, 0xcf, - 0xf3, 0x25, 0x3b, 0x70, 0xf0, 0x1e, 0x97, 0x2c, 0xc9, 0xb9, 0x5e, 0xa9, 0x91, 0x28, 0xb8, 0xe2, - 0x04, 0x2a, 0xa5, 0x0f, 0x29, 0x4f, 0xb9, 0xd3, 0xfb, 0x83, 0x94, 0xf3, 0x74, 0x89, 0x63, 0x7b, - 0x9b, 0xeb, 0x77, 0x63, 0x95, 0xe5, 0x28, 0x55, 0x92, 0x0b, 0x07, 0x0c, 0xcf, 0xa1, 0x77, 0x8a, - 0xea, 0x39, 0x2e, 0xd9, 0xc4, 0x76, 0xc7, 0xf8, 0x51, 0xa3, 0x54, 0xe4, 0x09, 0xd4, 0x04, 0x16, - 0x19, 0x67, 0x34, 0x08, 0x83, 0xa8, 0x75, 0xdc, 0x1f, 0x39, 0xa7, 0x91, 0x77, 0x1a, 0x9d, 0x7b, - 0xa7, 0x93, 0xc6, 0xd7, 0xcb, 0xc1, 0xb5, 0xcf, 0xdf, 0x07, 0x41, 0x5c, 0xf6, 0x0c, 0x7f, 0xec, - 0xc1, 0xe1, 0x96, 0xad, 0x14, 0x7c, 0x25, 0xf1, 0xff, 0x7c, 0xc9, 0x43, 0xa8, 0xaf, 0x38, 0xc3, - 0x59, 0xc6, 0xe8, 0xf5, 0x30, 0x88, 0xda, 0x27, 0x5d, 0x83, 0x7c, 0xbb, 0x1c, 0xd4, 0x5e, 0x70, - 0x86, 0x67, 0xcf, 0xe2, 0x9a, 0x29, 0x9f, 0x31, 0xf2, 0x14, 0x60, 0x51, 0x60, 0xa2, 0x90, 0xcd, - 0x12, 0x45, 0x77, 0xfe, 0xe1, 0xa9, 0x66, 0xd9, 0x37, 0x51, 0xa4, 0x07, 0x7b, 0x0b, 0xce, 0x50, - 0xd2, 0xdd, 0x30, 0x88, 0x9a, 0xb1, 0xbb, 0x90, 0x21, 0x74, 0xb4, 0x4c, 0x52, 0x9c, 0x25, 0x6a, - 0x56, 0xa0, 0x54, 0x74, 0x2f, 0x0c, 0xa2, 0x20, 0x6e, 0x59, 0x71, 0x62, 0x92, 0x2a, 0x72, 0x17, - 0x9a, 0x8e, 0x49, 0x51, 0xd1, 0x5a, 0x18, 0x44, 0x3b, 0x71, 0xc3, 0x0a, 0xa7, 0xb8, 0x51, 0x14, - 0x5a, 0xd1, 0xfa, 0x46, 0x71, 0xaa, 0x15, 0x89, 0xe0, 0x60, 0xdd, 0x39, 0x2b, 0x50, 0x24, 0x59, - 0x41, 0x1b, 0x96, 0xe9, 0x7a, 0x83, 0xd8, 0xaa, 0x15, 0x29, 0xf4, 0x9a, 0x6c, 0x6e, 0x90, 0x53, - 0xed, 0xc9, 0x23, 0xd8, 0xaf, 0x3c, 0x13, 0xcd, 0x32, 0x45, 0xc1, 0x82, 0x1d, 0x6f, 0x39, 0x31, - 0x22, 0x09, 0xa1, 0xbd, 0xe0, 0xb9, 0x58, 0x07, 0x6b, 0x59, 0x08, 0x8c, 0x56, 0xe6, 0xba, 0x03, - 0x0d, 0x4b, 0x98, 0x58, 0x6d, 0x5b, 0xad, 0x9b, 0xbb, 0x49, 0xe5, 0x4b, 0x26, 0x54, 0xa7, 0x2a, - 0x99, 0x4c, 0x47, 0xb0, 0xef, 0xbb, 0xfc, 0xa0, 0x5d, 0xf7, 0x7e, 0xd9, 0x5c, 0xcd, 0xe9, 0x2d, - 0x3c, 0xb7, 0x5f, 0x71, 0x55, 0x9e, 0x07, 0xd0, 0x5d, 0xfb, 0xb9, 0x38, 0x07, 0x16, 0x6b, 0x97, - 0x76, 0x2e, 0xcd, 0x7d, 0xe8, 0x48, 0x5d, 0x98, 0xdf, 0x07, 0x8b, 0x05, 0xae, 0x14, 0xbd, 0xe1, - 0x20, 0x2b, 0x4e, 0x9d, 0x46, 0x08, 0xec, 0x9a, 0xcd, 0xa1, 0xc4, 0xd6, 0xec, 0xd9, 0x68, 0xfc, - 0x13, 0x32, 0x7a, 0xd3, 0x69, 0xe6, 0x4c, 0xfa, 0xd0, 0x60, 0x99, 0x14, 0x5c, 0x22, 0xa3, 0x3d, - 0xf7, 0x97, 0xf9, 0xbb, 0xe1, 0x45, 0x92, 0x31, 0x7a, 0xe8, 0x78, 0x73, 0x1e, 0xde, 0xb6, 0xdf, - 0xff, 0x64, 0xb9, 0x9c, 0x26, 0x17, 0x52, 0xe9, 0xb9, 0x2c, 0xf7, 0x6a, 0xf8, 0x1a, 0x6e, 0x6d, - 0x17, 0xca, 0xcd, 0x78, 0x0c, 0x75, 0xe1, 0x34, 0x1a, 0x84, 0x3b, 0x51, 0xeb, 0xf8, 0xde, 0x68, - 0x63, 0xcd, 0xff, 0xb8, 0x4d, 0xb1, 0xef, 0x38, 0xfe, 0x12, 0x00, 0x54, 0x75, 0xf2, 0x12, 0xe0, - 0x14, 0xd5, 0x34, 0xb9, 0x78, 0xa5, 0xf4, 0x9c, 0x84, 0x57, 0x18, 0xd9, 0xa9, 0xfa, 0x7f, 0x7f, - 0x8a, 0xbc, 0x81, 0xee, 0xaf, 0x83, 0x93, 0xed, 0xa6, 0xdf, 0xd3, 0xf6, 0x87, 0x57, 0x21, 0xce, - 0xf8, 0xa4, 0xf7, 0x96, 0x48, 0xc5, 0x8b, 0x0f, 0xa3, 0x8c, 0x8f, 0x17, 0x3c, 0xcf, 0xf9, 0x6a, - 0x2c, 0xe6, 0xf3, 0x9a, 0x5d, 0xd2, 0x47, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x39, 0xbf, 0xc5, - 0x06, 0xeb, 0x04, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCHeldAmountClient interface { - DRPCConn() drpc.Conn - - GetPayStub(ctx context.Context, in *GetHeldAmountRequest) (*GetHeldAmountResponse, error) - GetAllPaystubs(ctx context.Context, in *GetAllPaystubsRequest) (*GetAllPaystubsResponse, error) -} - -type drpcHeldAmountClient struct { - cc drpc.Conn -} - -func NewDRPCHeldAmountClient(cc drpc.Conn) DRPCHeldAmountClient { - return &drpcHeldAmountClient{cc} -} - -func (c *drpcHeldAmountClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcHeldAmountClient) GetPayStub(ctx context.Context, in *GetHeldAmountRequest) (*GetHeldAmountResponse, error) { - out := new(GetHeldAmountResponse) - err := c.cc.Invoke(ctx, "/heldamount.HeldAmount/GetPayStub", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcHeldAmountClient) GetAllPaystubs(ctx context.Context, in *GetAllPaystubsRequest) (*GetAllPaystubsResponse, error) { - out := new(GetAllPaystubsResponse) - err := c.cc.Invoke(ctx, "/heldamount.HeldAmount/GetAllPaystubs", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCHeldAmountServer interface { - GetPayStub(context.Context, *GetHeldAmountRequest) (*GetHeldAmountResponse, error) - GetAllPaystubs(context.Context, *GetAllPaystubsRequest) (*GetAllPaystubsResponse, error) -} - -type DRPCHeldAmountDescription struct{} - -func (DRPCHeldAmountDescription) NumMethods() int { return 2 } - -func (DRPCHeldAmountDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/heldamount.HeldAmount/GetPayStub", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCHeldAmountServer). - GetPayStub( - ctx, - in1.(*GetHeldAmountRequest), - ) - }, DRPCHeldAmountServer.GetPayStub, true - case 1: - return "/heldamount.HeldAmount/GetAllPaystubs", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCHeldAmountServer). - GetAllPaystubs( - ctx, - in1.(*GetAllPaystubsRequest), - ) - }, DRPCHeldAmountServer.GetAllPaystubs, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterHeldAmount(mux drpc.Mux, impl DRPCHeldAmountServer) error { - return mux.Register(impl, DRPCHeldAmountDescription{}) -} - -type DRPCHeldAmount_GetPayStubStream interface { - drpc.Stream - SendAndClose(*GetHeldAmountResponse) error -} - -type drpcHeldAmountGetPayStubStream struct { - drpc.Stream -} - -func (x *drpcHeldAmountGetPayStubStream) SendAndClose(m *GetHeldAmountResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCHeldAmount_GetAllPaystubsStream interface { - drpc.Stream - SendAndClose(*GetAllPaystubsResponse) error -} - -type drpcHeldAmountGetAllPaystubsStream struct { - drpc.Stream -} - -func (x *drpcHeldAmountGetAllPaystubsStream) SendAndClose(m *GetAllPaystubsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/heldamount.proto b/vendor/storj.io/common/pb/heldamount.proto deleted file mode 100644 index eae758d90..000000000 --- a/vendor/storj.io/common/pb/heldamount.proto +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -package heldamount; - -service HeldAmount { - rpc GetPayStub(GetHeldAmountRequest) returns (GetHeldAmountResponse); - rpc GetAllPaystubs(GetAllPaystubsRequest) returns (GetAllPaystubsResponse); -} - -message GetHeldAmountRequest { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message GetHeldAmountResponse { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - string codes = 4; - double usage_at_rest = 5; - int64 usage_get = 6; - int64 usage_put = 7; - int64 usage_get_repair = 8; - int64 usage_put_repair = 9; - int64 usage_get_audit = 10; - int64 comp_at_rest = 11; - int64 comp_get = 12; - int64 comp_put = 13; - int64 comp_get_repair = 14; - int64 comp_put_repair = 15; - int64 comp_get_audit = 16; - int64 surge_percent = 17; - int64 held = 18; - int64 owed = 19; - int64 disposed = 20; - int64 paid = 21; -} - -message GetAllPaystubsRequest {} - -message GetAllPaystubsResponse { - repeated GetHeldAmountResponse paystub = 1; -} \ No newline at end of file diff --git a/vendor/storj.io/common/pb/inspector.pb.go b/vendor/storj.io/common/pb/inspector.pb.go deleted file mode 100644 index f606cc575..000000000 --- a/vendor/storj.io/common/pb/inspector.pb.go +++ /dev/null @@ -1,1346 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: inspector.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type ListIrreparableSegmentsRequest struct { - Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - LastSeenSegmentPath []byte `protobuf:"bytes,2,opt,name=last_seen_segment_path,json=lastSeenSegmentPath,proto3" json:"last_seen_segment_path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListIrreparableSegmentsRequest) Reset() { *m = ListIrreparableSegmentsRequest{} } -func (m *ListIrreparableSegmentsRequest) String() string { return proto.CompactTextString(m) } -func (*ListIrreparableSegmentsRequest) ProtoMessage() {} -func (*ListIrreparableSegmentsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{0} -} -func (m *ListIrreparableSegmentsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListIrreparableSegmentsRequest.Unmarshal(m, b) -} -func (m *ListIrreparableSegmentsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListIrreparableSegmentsRequest.Marshal(b, m, deterministic) -} -func (m *ListIrreparableSegmentsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListIrreparableSegmentsRequest.Merge(m, src) -} -func (m *ListIrreparableSegmentsRequest) XXX_Size() int { - return xxx_messageInfo_ListIrreparableSegmentsRequest.Size(m) -} -func (m *ListIrreparableSegmentsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListIrreparableSegmentsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListIrreparableSegmentsRequest proto.InternalMessageInfo - -func (m *ListIrreparableSegmentsRequest) GetLimit() int32 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *ListIrreparableSegmentsRequest) GetLastSeenSegmentPath() []byte { - if m != nil { - return m.LastSeenSegmentPath - } - return nil -} - -type IrreparableSegment struct { - Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - SegmentDetail *Pointer `protobuf:"bytes,2,opt,name=segment_detail,json=segmentDetail,proto3" json:"segment_detail,omitempty"` - LostPieces int32 `protobuf:"varint,3,opt,name=lost_pieces,json=lostPieces,proto3" json:"lost_pieces,omitempty"` - LastRepairAttempt int64 `protobuf:"varint,4,opt,name=last_repair_attempt,json=lastRepairAttempt,proto3" json:"last_repair_attempt,omitempty"` - RepairAttemptCount int64 `protobuf:"varint,5,opt,name=repair_attempt_count,json=repairAttemptCount,proto3" json:"repair_attempt_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IrreparableSegment) Reset() { *m = IrreparableSegment{} } -func (m *IrreparableSegment) String() string { return proto.CompactTextString(m) } -func (*IrreparableSegment) ProtoMessage() {} -func (*IrreparableSegment) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{1} -} -func (m *IrreparableSegment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IrreparableSegment.Unmarshal(m, b) -} -func (m *IrreparableSegment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IrreparableSegment.Marshal(b, m, deterministic) -} -func (m *IrreparableSegment) XXX_Merge(src proto.Message) { - xxx_messageInfo_IrreparableSegment.Merge(m, src) -} -func (m *IrreparableSegment) XXX_Size() int { - return xxx_messageInfo_IrreparableSegment.Size(m) -} -func (m *IrreparableSegment) XXX_DiscardUnknown() { - xxx_messageInfo_IrreparableSegment.DiscardUnknown(m) -} - -var xxx_messageInfo_IrreparableSegment proto.InternalMessageInfo - -func (m *IrreparableSegment) GetPath() []byte { - if m != nil { - return m.Path - } - return nil -} - -func (m *IrreparableSegment) GetSegmentDetail() *Pointer { - if m != nil { - return m.SegmentDetail - } - return nil -} - -func (m *IrreparableSegment) GetLostPieces() int32 { - if m != nil { - return m.LostPieces - } - return 0 -} - -func (m *IrreparableSegment) GetLastRepairAttempt() int64 { - if m != nil { - return m.LastRepairAttempt - } - return 0 -} - -func (m *IrreparableSegment) GetRepairAttemptCount() int64 { - if m != nil { - return m.RepairAttemptCount - } - return 0 -} - -type ListIrreparableSegmentsResponse struct { - Segments []*IrreparableSegment `protobuf:"bytes,1,rep,name=segments,proto3" json:"segments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListIrreparableSegmentsResponse) Reset() { *m = ListIrreparableSegmentsResponse{} } -func (m *ListIrreparableSegmentsResponse) String() string { return proto.CompactTextString(m) } -func (*ListIrreparableSegmentsResponse) ProtoMessage() {} -func (*ListIrreparableSegmentsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{2} -} -func (m *ListIrreparableSegmentsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListIrreparableSegmentsResponse.Unmarshal(m, b) -} -func (m *ListIrreparableSegmentsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListIrreparableSegmentsResponse.Marshal(b, m, deterministic) -} -func (m *ListIrreparableSegmentsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListIrreparableSegmentsResponse.Merge(m, src) -} -func (m *ListIrreparableSegmentsResponse) XXX_Size() int { - return xxx_messageInfo_ListIrreparableSegmentsResponse.Size(m) -} -func (m *ListIrreparableSegmentsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListIrreparableSegmentsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListIrreparableSegmentsResponse proto.InternalMessageInfo - -func (m *ListIrreparableSegmentsResponse) GetSegments() []*IrreparableSegment { - if m != nil { - return m.Segments - } - return nil -} - -type CountNodesResponse struct { - Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CountNodesResponse) Reset() { *m = CountNodesResponse{} } -func (m *CountNodesResponse) String() string { return proto.CompactTextString(m) } -func (*CountNodesResponse) ProtoMessage() {} -func (*CountNodesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{3} -} -func (m *CountNodesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CountNodesResponse.Unmarshal(m, b) -} -func (m *CountNodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CountNodesResponse.Marshal(b, m, deterministic) -} -func (m *CountNodesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CountNodesResponse.Merge(m, src) -} -func (m *CountNodesResponse) XXX_Size() int { - return xxx_messageInfo_CountNodesResponse.Size(m) -} -func (m *CountNodesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CountNodesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CountNodesResponse proto.InternalMessageInfo - -func (m *CountNodesResponse) GetCount() int64 { - if m != nil { - return m.Count - } - return 0 -} - -type CountNodesRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CountNodesRequest) Reset() { *m = CountNodesRequest{} } -func (m *CountNodesRequest) String() string { return proto.CompactTextString(m) } -func (*CountNodesRequest) ProtoMessage() {} -func (*CountNodesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{4} -} -func (m *CountNodesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CountNodesRequest.Unmarshal(m, b) -} -func (m *CountNodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CountNodesRequest.Marshal(b, m, deterministic) -} -func (m *CountNodesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CountNodesRequest.Merge(m, src) -} -func (m *CountNodesRequest) XXX_Size() int { - return xxx_messageInfo_CountNodesRequest.Size(m) -} -func (m *CountNodesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CountNodesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CountNodesRequest proto.InternalMessageInfo - -type DumpNodesRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DumpNodesRequest) Reset() { *m = DumpNodesRequest{} } -func (m *DumpNodesRequest) String() string { return proto.CompactTextString(m) } -func (*DumpNodesRequest) ProtoMessage() {} -func (*DumpNodesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{5} -} -func (m *DumpNodesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DumpNodesRequest.Unmarshal(m, b) -} -func (m *DumpNodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DumpNodesRequest.Marshal(b, m, deterministic) -} -func (m *DumpNodesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpNodesRequest.Merge(m, src) -} -func (m *DumpNodesRequest) XXX_Size() int { - return xxx_messageInfo_DumpNodesRequest.Size(m) -} -func (m *DumpNodesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DumpNodesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DumpNodesRequest proto.InternalMessageInfo - -type DumpNodesResponse struct { - Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DumpNodesResponse) Reset() { *m = DumpNodesResponse{} } -func (m *DumpNodesResponse) String() string { return proto.CompactTextString(m) } -func (*DumpNodesResponse) ProtoMessage() {} -func (*DumpNodesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{6} -} -func (m *DumpNodesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DumpNodesResponse.Unmarshal(m, b) -} -func (m *DumpNodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DumpNodesResponse.Marshal(b, m, deterministic) -} -func (m *DumpNodesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DumpNodesResponse.Merge(m, src) -} -func (m *DumpNodesResponse) XXX_Size() int { - return xxx_messageInfo_DumpNodesResponse.Size(m) -} -func (m *DumpNodesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DumpNodesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DumpNodesResponse proto.InternalMessageInfo - -func (m *DumpNodesResponse) GetNodes() []*Node { - if m != nil { - return m.Nodes - } - return nil -} - -type StatsRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StatsRequest) Reset() { *m = StatsRequest{} } -func (m *StatsRequest) String() string { return proto.CompactTextString(m) } -func (*StatsRequest) ProtoMessage() {} -func (*StatsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{7} -} -func (m *StatsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatsRequest.Unmarshal(m, b) -} -func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatsRequest.Marshal(b, m, deterministic) -} -func (m *StatsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatsRequest.Merge(m, src) -} -func (m *StatsRequest) XXX_Size() int { - return xxx_messageInfo_StatsRequest.Size(m) -} -func (m *StatsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StatsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_StatsRequest proto.InternalMessageInfo - -type StatSummaryResponse struct { - UsedSpace int64 `protobuf:"varint,1,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"` - AvailableSpace int64 `protobuf:"varint,2,opt,name=available_space,json=availableSpace,proto3" json:"available_space,omitempty"` - UsedIngress int64 `protobuf:"varint,3,opt,name=used_ingress,json=usedIngress,proto3" json:"used_ingress,omitempty"` - UsedEgress int64 `protobuf:"varint,4,opt,name=used_egress,json=usedEgress,proto3" json:"used_egress,omitempty"` - UsedBandwidth int64 `protobuf:"varint,5,opt,name=used_bandwidth,json=usedBandwidth,proto3" json:"used_bandwidth,omitempty"` - AvailableBandwidth int64 `protobuf:"varint,6,opt,name=available_bandwidth,json=availableBandwidth,proto3" json:"available_bandwidth,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StatSummaryResponse) Reset() { *m = StatSummaryResponse{} } -func (m *StatSummaryResponse) String() string { return proto.CompactTextString(m) } -func (*StatSummaryResponse) ProtoMessage() {} -func (*StatSummaryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{8} -} -func (m *StatSummaryResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatSummaryResponse.Unmarshal(m, b) -} -func (m *StatSummaryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatSummaryResponse.Marshal(b, m, deterministic) -} -func (m *StatSummaryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatSummaryResponse.Merge(m, src) -} -func (m *StatSummaryResponse) XXX_Size() int { - return xxx_messageInfo_StatSummaryResponse.Size(m) -} -func (m *StatSummaryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StatSummaryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_StatSummaryResponse proto.InternalMessageInfo - -func (m *StatSummaryResponse) GetUsedSpace() int64 { - if m != nil { - return m.UsedSpace - } - return 0 -} - -func (m *StatSummaryResponse) GetAvailableSpace() int64 { - if m != nil { - return m.AvailableSpace - } - return 0 -} - -func (m *StatSummaryResponse) GetUsedIngress() int64 { - if m != nil { - return m.UsedIngress - } - return 0 -} - -func (m *StatSummaryResponse) GetUsedEgress() int64 { - if m != nil { - return m.UsedEgress - } - return 0 -} - -func (m *StatSummaryResponse) GetUsedBandwidth() int64 { - if m != nil { - return m.UsedBandwidth - } - return 0 -} - -func (m *StatSummaryResponse) GetAvailableBandwidth() int64 { - if m != nil { - return m.AvailableBandwidth - } - return 0 -} - -type DashboardRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardRequest) Reset() { *m = DashboardRequest{} } -func (m *DashboardRequest) String() string { return proto.CompactTextString(m) } -func (*DashboardRequest) ProtoMessage() {} -func (*DashboardRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{9} -} -func (m *DashboardRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardRequest.Unmarshal(m, b) -} -func (m *DashboardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardRequest.Marshal(b, m, deterministic) -} -func (m *DashboardRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardRequest.Merge(m, src) -} -func (m *DashboardRequest) XXX_Size() int { - return xxx_messageInfo_DashboardRequest.Size(m) -} -func (m *DashboardRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardRequest proto.InternalMessageInfo - -type DashboardResponse struct { - NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - NodeConnections int64 `protobuf:"varint,2,opt,name=node_connections,json=nodeConnections,proto3" json:"node_connections,omitempty"` - BootstrapAddress string `protobuf:"bytes,3,opt,name=bootstrap_address,json=bootstrapAddress,proto3" json:"bootstrap_address,omitempty"` // Deprecated: Do not use. - InternalAddress string `protobuf:"bytes,4,opt,name=internal_address,json=internalAddress,proto3" json:"internal_address,omitempty"` - ExternalAddress string `protobuf:"bytes,5,opt,name=external_address,json=externalAddress,proto3" json:"external_address,omitempty"` - DashboardAddress string `protobuf:"bytes,6,opt,name=dashboard_address,json=dashboardAddress,proto3" json:"dashboard_address,omitempty"` - Stats *StatSummaryResponse `protobuf:"bytes,7,opt,name=stats,proto3" json:"stats,omitempty"` - Uptime string `protobuf:"bytes,8,opt,name=uptime,proto3" json:"uptime,omitempty"` - LastPinged time.Time `protobuf:"bytes,9,opt,name=last_pinged,json=lastPinged,proto3,stdtime" json:"last_pinged"` - LastQueried time.Time `protobuf:"bytes,10,opt,name=last_queried,json=lastQueried,proto3,stdtime" json:"last_queried"` - LastPingFromId *NodeID `protobuf:"bytes,11,opt,name=last_ping_from_id,json=lastPingFromId,proto3,customtype=NodeID" json:"last_ping_from_id,omitempty"` - LastPingFromAddress string `protobuf:"bytes,12,opt,name=last_ping_from_address,json=lastPingFromAddress,proto3" json:"last_ping_from_address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DashboardResponse) Reset() { *m = DashboardResponse{} } -func (m *DashboardResponse) String() string { return proto.CompactTextString(m) } -func (*DashboardResponse) ProtoMessage() {} -func (*DashboardResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{10} -} -func (m *DashboardResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DashboardResponse.Unmarshal(m, b) -} -func (m *DashboardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DashboardResponse.Marshal(b, m, deterministic) -} -func (m *DashboardResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DashboardResponse.Merge(m, src) -} -func (m *DashboardResponse) XXX_Size() int { - return xxx_messageInfo_DashboardResponse.Size(m) -} -func (m *DashboardResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DashboardResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DashboardResponse proto.InternalMessageInfo - -func (m *DashboardResponse) GetNodeConnections() int64 { - if m != nil { - return m.NodeConnections - } - return 0 -} - -// Deprecated: Do not use. -func (m *DashboardResponse) GetBootstrapAddress() string { - if m != nil { - return m.BootstrapAddress - } - return "" -} - -func (m *DashboardResponse) GetInternalAddress() string { - if m != nil { - return m.InternalAddress - } - return "" -} - -func (m *DashboardResponse) GetExternalAddress() string { - if m != nil { - return m.ExternalAddress - } - return "" -} - -func (m *DashboardResponse) GetDashboardAddress() string { - if m != nil { - return m.DashboardAddress - } - return "" -} - -func (m *DashboardResponse) GetStats() *StatSummaryResponse { - if m != nil { - return m.Stats - } - return nil -} - -func (m *DashboardResponse) GetUptime() string { - if m != nil { - return m.Uptime - } - return "" -} - -func (m *DashboardResponse) GetLastPinged() time.Time { - if m != nil { - return m.LastPinged - } - return time.Time{} -} - -func (m *DashboardResponse) GetLastQueried() time.Time { - if m != nil { - return m.LastQueried - } - return time.Time{} -} - -func (m *DashboardResponse) GetLastPingFromAddress() string { - if m != nil { - return m.LastPingFromAddress - } - return "" -} - -type SegmentHealthRequest struct { - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - SegmentIndex int64 `protobuf:"varint,3,opt,name=segment_index,json=segmentIndex,proto3" json:"segment_index,omitempty"` - ProjectId []byte `protobuf:"bytes,4,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentHealthRequest) Reset() { *m = SegmentHealthRequest{} } -func (m *SegmentHealthRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentHealthRequest) ProtoMessage() {} -func (*SegmentHealthRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{11} -} -func (m *SegmentHealthRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentHealthRequest.Unmarshal(m, b) -} -func (m *SegmentHealthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentHealthRequest.Marshal(b, m, deterministic) -} -func (m *SegmentHealthRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentHealthRequest.Merge(m, src) -} -func (m *SegmentHealthRequest) XXX_Size() int { - return xxx_messageInfo_SegmentHealthRequest.Size(m) -} -func (m *SegmentHealthRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentHealthRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentHealthRequest proto.InternalMessageInfo - -func (m *SegmentHealthRequest) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *SegmentHealthRequest) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *SegmentHealthRequest) GetSegmentIndex() int64 { - if m != nil { - return m.SegmentIndex - } - return 0 -} - -func (m *SegmentHealthRequest) GetProjectId() []byte { - if m != nil { - return m.ProjectId - } - return nil -} - -type SegmentHealth struct { - HealthyIds []NodeID `protobuf:"bytes,1,rep,name=healthy_ids,json=healthyIds,proto3,customtype=NodeID" json:"healthy_ids,omitempty"` - UnhealthyIds []NodeID `protobuf:"bytes,2,rep,name=unhealthy_ids,json=unhealthyIds,proto3,customtype=NodeID" json:"unhealthy_ids,omitempty"` - OfflineIds []NodeID `protobuf:"bytes,3,rep,name=offline_ids,json=offlineIds,proto3,customtype=NodeID" json:"offline_ids,omitempty"` - Segment []byte `protobuf:"bytes,4,opt,name=segment,proto3" json:"segment,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentHealth) Reset() { *m = SegmentHealth{} } -func (m *SegmentHealth) String() string { return proto.CompactTextString(m) } -func (*SegmentHealth) ProtoMessage() {} -func (*SegmentHealth) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{12} -} -func (m *SegmentHealth) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentHealth.Unmarshal(m, b) -} -func (m *SegmentHealth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentHealth.Marshal(b, m, deterministic) -} -func (m *SegmentHealth) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentHealth.Merge(m, src) -} -func (m *SegmentHealth) XXX_Size() int { - return xxx_messageInfo_SegmentHealth.Size(m) -} -func (m *SegmentHealth) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentHealth.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentHealth proto.InternalMessageInfo - -func (m *SegmentHealth) GetSegment() []byte { - if m != nil { - return m.Segment - } - return nil -} - -type SegmentHealthResponse struct { - Health *SegmentHealth `protobuf:"bytes,1,opt,name=health,proto3" json:"health,omitempty"` - Redundancy *RedundancyScheme `protobuf:"bytes,2,opt,name=redundancy,proto3" json:"redundancy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentHealthResponse) Reset() { *m = SegmentHealthResponse{} } -func (m *SegmentHealthResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentHealthResponse) ProtoMessage() {} -func (*SegmentHealthResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{13} -} -func (m *SegmentHealthResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentHealthResponse.Unmarshal(m, b) -} -func (m *SegmentHealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentHealthResponse.Marshal(b, m, deterministic) -} -func (m *SegmentHealthResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentHealthResponse.Merge(m, src) -} -func (m *SegmentHealthResponse) XXX_Size() int { - return xxx_messageInfo_SegmentHealthResponse.Size(m) -} -func (m *SegmentHealthResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentHealthResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentHealthResponse proto.InternalMessageInfo - -func (m *SegmentHealthResponse) GetHealth() *SegmentHealth { - if m != nil { - return m.Health - } - return nil -} - -func (m *SegmentHealthResponse) GetRedundancy() *RedundancyScheme { - if m != nil { - return m.Redundancy - } - return nil -} - -type ObjectHealthRequest struct { - EncryptedPath []byte `protobuf:"bytes,1,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Bucket []byte `protobuf:"bytes,2,opt,name=bucket,proto3" json:"bucket,omitempty"` - ProjectId []byte `protobuf:"bytes,3,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` - StartAfterSegment int64 `protobuf:"varint,4,opt,name=start_after_segment,json=startAfterSegment,proto3" json:"start_after_segment,omitempty"` - EndBeforeSegment int64 `protobuf:"varint,5,opt,name=end_before_segment,json=endBeforeSegment,proto3" json:"end_before_segment,omitempty"` - Limit int32 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectHealthRequest) Reset() { *m = ObjectHealthRequest{} } -func (m *ObjectHealthRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectHealthRequest) ProtoMessage() {} -func (*ObjectHealthRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{14} -} -func (m *ObjectHealthRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectHealthRequest.Unmarshal(m, b) -} -func (m *ObjectHealthRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectHealthRequest.Marshal(b, m, deterministic) -} -func (m *ObjectHealthRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectHealthRequest.Merge(m, src) -} -func (m *ObjectHealthRequest) XXX_Size() int { - return xxx_messageInfo_ObjectHealthRequest.Size(m) -} -func (m *ObjectHealthRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectHealthRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectHealthRequest proto.InternalMessageInfo - -func (m *ObjectHealthRequest) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *ObjectHealthRequest) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *ObjectHealthRequest) GetProjectId() []byte { - if m != nil { - return m.ProjectId - } - return nil -} - -func (m *ObjectHealthRequest) GetStartAfterSegment() int64 { - if m != nil { - return m.StartAfterSegment - } - return 0 -} - -func (m *ObjectHealthRequest) GetEndBeforeSegment() int64 { - if m != nil { - return m.EndBeforeSegment - } - return 0 -} - -func (m *ObjectHealthRequest) GetLimit() int32 { - if m != nil { - return m.Limit - } - return 0 -} - -type ObjectHealthResponse struct { - Segments []*SegmentHealth `protobuf:"bytes,1,rep,name=segments,proto3" json:"segments,omitempty"` - Redundancy *RedundancyScheme `protobuf:"bytes,2,opt,name=redundancy,proto3" json:"redundancy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectHealthResponse) Reset() { *m = ObjectHealthResponse{} } -func (m *ObjectHealthResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectHealthResponse) ProtoMessage() {} -func (*ObjectHealthResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a07d9034b2dd9d26, []int{15} -} -func (m *ObjectHealthResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectHealthResponse.Unmarshal(m, b) -} -func (m *ObjectHealthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectHealthResponse.Marshal(b, m, deterministic) -} -func (m *ObjectHealthResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectHealthResponse.Merge(m, src) -} -func (m *ObjectHealthResponse) XXX_Size() int { - return xxx_messageInfo_ObjectHealthResponse.Size(m) -} -func (m *ObjectHealthResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectHealthResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectHealthResponse proto.InternalMessageInfo - -func (m *ObjectHealthResponse) GetSegments() []*SegmentHealth { - if m != nil { - return m.Segments - } - return nil -} - -func (m *ObjectHealthResponse) GetRedundancy() *RedundancyScheme { - if m != nil { - return m.Redundancy - } - return nil -} - -func init() { - proto.RegisterType((*ListIrreparableSegmentsRequest)(nil), "inspector.ListIrreparableSegmentsRequest") - proto.RegisterType((*IrreparableSegment)(nil), "inspector.IrreparableSegment") - proto.RegisterType((*ListIrreparableSegmentsResponse)(nil), "inspector.ListIrreparableSegmentsResponse") - proto.RegisterType((*CountNodesResponse)(nil), "inspector.CountNodesResponse") - proto.RegisterType((*CountNodesRequest)(nil), "inspector.CountNodesRequest") - proto.RegisterType((*DumpNodesRequest)(nil), "inspector.DumpNodesRequest") - proto.RegisterType((*DumpNodesResponse)(nil), "inspector.DumpNodesResponse") - proto.RegisterType((*StatsRequest)(nil), "inspector.StatsRequest") - proto.RegisterType((*StatSummaryResponse)(nil), "inspector.StatSummaryResponse") - proto.RegisterType((*DashboardRequest)(nil), "inspector.DashboardRequest") - proto.RegisterType((*DashboardResponse)(nil), "inspector.DashboardResponse") - proto.RegisterType((*SegmentHealthRequest)(nil), "inspector.SegmentHealthRequest") - proto.RegisterType((*SegmentHealth)(nil), "inspector.SegmentHealth") - proto.RegisterType((*SegmentHealthResponse)(nil), "inspector.SegmentHealthResponse") - proto.RegisterType((*ObjectHealthRequest)(nil), "inspector.ObjectHealthRequest") - proto.RegisterType((*ObjectHealthResponse)(nil), "inspector.ObjectHealthResponse") -} - -func init() { proto.RegisterFile("inspector.proto", fileDescriptor_a07d9034b2dd9d26) } - -var fileDescriptor_a07d9034b2dd9d26 = []byte{ - // 1247 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x8e, 0x1b, 0x45, - 0x10, 0xce, 0xac, 0xd7, 0x4e, 0x5c, 0xf6, 0xfe, 0xb8, 0x6d, 0x92, 0x91, 0xf3, 0xe3, 0x65, 0x10, - 0xca, 0x26, 0x41, 0xde, 0x68, 0x93, 0x1c, 0x22, 0x4e, 0x71, 0x7e, 0x88, 0x25, 0x44, 0x36, 0xe3, - 0x9c, 0x10, 0xd2, 0xa8, 0xed, 0x6e, 0xdb, 0x93, 0x78, 0xba, 0x27, 0x3d, 0xed, 0x90, 0x7d, 0x01, - 0x04, 0x37, 0xae, 0x9c, 0x11, 0x6f, 0xc0, 0x89, 0x27, 0xe0, 0x19, 0x38, 0x84, 0x13, 0xf0, 0x0c, - 0xdc, 0x50, 0xff, 0x4c, 0x7b, 0x6c, 0xaf, 0xf9, 0x11, 0xb7, 0x99, 0xaf, 0xbe, 0xaa, 0xa9, 0xfe, - 0xaa, 0xba, 0x6a, 0x60, 0x2f, 0x66, 0x59, 0x4a, 0x47, 0x92, 0x8b, 0x6e, 0x2a, 0xb8, 0xe4, 0xa8, - 0xea, 0x80, 0x36, 0x4c, 0xf8, 0x84, 0x1b, 0xb8, 0x0d, 0x8c, 0x13, 0x6a, 0x9f, 0xf7, 0x52, 0x1e, - 0x33, 0x49, 0x05, 0x19, 0x5a, 0xa0, 0x33, 0xe1, 0x7c, 0x32, 0xa3, 0x47, 0xfa, 0x6d, 0x38, 0x1f, - 0x1f, 0xc9, 0x38, 0xa1, 0x99, 0xc4, 0x49, 0x6a, 0x08, 0xc1, 0x2b, 0xb8, 0xf6, 0x69, 0x9c, 0xc9, - 0xbe, 0x10, 0x34, 0xc5, 0x02, 0x0f, 0x67, 0x74, 0x40, 0x27, 0x09, 0x65, 0x32, 0x0b, 0xe9, 0xeb, - 0x39, 0xcd, 0x24, 0x6a, 0x41, 0x79, 0x16, 0x27, 0xb1, 0xf4, 0xbd, 0x03, 0xef, 0xb0, 0x1c, 0x9a, - 0x17, 0x74, 0x07, 0x2e, 0xce, 0x70, 0x26, 0xa3, 0x8c, 0x52, 0x16, 0x65, 0xc6, 0x25, 0x4a, 0xb1, - 0x9c, 0xfa, 0x5b, 0x07, 0xde, 0x61, 0x3d, 0x6c, 0x2a, 0xeb, 0x80, 0x52, 0x66, 0xc3, 0x9d, 0x60, - 0x39, 0x0d, 0x7e, 0xf7, 0x00, 0xad, 0x7f, 0x09, 0x21, 0xd8, 0xd6, 0x9e, 0x9e, 0xf6, 0xd4, 0xcf, - 0xe8, 0x3e, 0xec, 0xe6, 0x51, 0x09, 0x95, 0x38, 0x9e, 0xe9, 0xb8, 0xb5, 0x63, 0xd4, 0x5d, 0x1c, - 0xf1, 0xc4, 0x3c, 0x85, 0x3b, 0x96, 0xf9, 0x48, 0x13, 0x51, 0x07, 0x6a, 0x33, 0x9e, 0xc9, 0x28, - 0x8d, 0xe9, 0x88, 0x66, 0x7e, 0x49, 0xa7, 0x0d, 0x0a, 0x3a, 0xd1, 0x08, 0xea, 0x82, 0xce, 0x2e, - 0x52, 0x89, 0xc4, 0x22, 0xc2, 0x52, 0xd2, 0x24, 0x95, 0xfe, 0xf6, 0x81, 0x77, 0x58, 0x0a, 0x1b, - 0xca, 0x14, 0x6a, 0xcb, 0x03, 0x63, 0x40, 0xb7, 0xa1, 0xb5, 0x4c, 0x8d, 0x46, 0x7c, 0xce, 0xa4, - 0x5f, 0xd6, 0x0e, 0x48, 0x14, 0xc9, 0x0f, 0x95, 0x25, 0xf8, 0x02, 0x3a, 0x1b, 0x55, 0xcd, 0x52, - 0xce, 0x32, 0x8a, 0xee, 0xc3, 0x05, 0x9b, 0x76, 0xe6, 0x7b, 0x07, 0xa5, 0xc3, 0xda, 0xf1, 0xd5, - 0xee, 0xa2, 0xe2, 0xeb, 0x9e, 0xa1, 0xa3, 0x07, 0x37, 0x01, 0xe9, 0xcf, 0x7c, 0xc6, 0x09, 0x5d, - 0x04, 0x6c, 0x41, 0xd9, 0xa4, 0xe5, 0xe9, 0xb4, 0xcc, 0x4b, 0xd0, 0x84, 0x46, 0x91, 0xab, 0x4b, - 0x1a, 0x20, 0xd8, 0x7f, 0x34, 0x4f, 0xd2, 0x25, 0xec, 0x1e, 0x34, 0x0a, 0x98, 0x8d, 0x79, 0x00, - 0x65, 0xd5, 0x5d, 0x79, 0x86, 0xd0, 0xd5, 0xbd, 0xa6, 0x38, 0xa1, 0x31, 0x04, 0xbb, 0x50, 0x1f, - 0x48, 0xec, 0xba, 0x25, 0xf8, 0xd3, 0x83, 0xa6, 0x02, 0x06, 0xf3, 0x24, 0xc1, 0xe2, 0xd4, 0x45, - 0xba, 0x0a, 0x30, 0xcf, 0x28, 0x89, 0xb2, 0x14, 0x8f, 0xa8, 0x4d, 0xb1, 0xaa, 0x90, 0x81, 0x02, - 0xd0, 0x75, 0xd8, 0xc3, 0x6f, 0x70, 0x3c, 0x53, 0x07, 0xb6, 0x9c, 0x2d, 0xcd, 0xd9, 0x75, 0xb0, - 0x21, 0xbe, 0x0f, 0x75, 0x1d, 0x27, 0x66, 0x13, 0x41, 0x33, 0x53, 0xdd, 0x52, 0x58, 0x53, 0x58, - 0xdf, 0x40, 0xaa, 0xfe, 0x9a, 0x42, 0x0d, 0xc3, 0x94, 0x55, 0x7f, 0xfd, 0xb1, 0x21, 0x7c, 0x08, - 0xbb, 0x9a, 0x30, 0xc4, 0x8c, 0x7c, 0x19, 0x13, 0x39, 0xb5, 0x95, 0xdc, 0x51, 0x68, 0x2f, 0x07, - 0xd1, 0x11, 0x34, 0x17, 0x39, 0x2d, 0xb8, 0x15, 0x53, 0x75, 0x67, 0x72, 0x0e, 0x5a, 0x56, 0x9c, - 0x4d, 0x87, 0x1c, 0x0b, 0x92, 0xeb, 0xf1, 0xdb, 0x36, 0x34, 0x0a, 0xa0, 0x55, 0xe3, 0x3a, 0x9c, - 0x57, 0xf2, 0x45, 0x31, 0x31, 0x4d, 0xdf, 0xdb, 0xfd, 0xf9, 0x5d, 0xe7, 0xdc, 0x2f, 0xef, 0x3a, - 0x15, 0xa5, 0x6d, 0xff, 0x51, 0x58, 0x51, 0xe6, 0x3e, 0x41, 0x37, 0x60, 0x5f, 0x13, 0x47, 0x9c, - 0x31, 0x3a, 0x92, 0x31, 0x67, 0x99, 0x15, 0x66, 0x4f, 0xe1, 0x0f, 0x17, 0x30, 0x3a, 0x82, 0xc6, - 0x90, 0x73, 0x99, 0x49, 0x81, 0xd3, 0x08, 0x13, 0xe2, 0xe4, 0xa9, 0xf6, 0xb6, 0x7c, 0x2f, 0xdc, - 0x77, 0xc6, 0x07, 0xc6, 0xa6, 0x62, 0xeb, 0xfb, 0xc3, 0xf0, 0xcc, 0xf1, 0x95, 0x58, 0xd5, 0x70, - 0x2f, 0xc7, 0x0b, 0x54, 0xfa, 0x76, 0x85, 0x5a, 0x36, 0xd4, 0x1c, 0xcf, 0xa9, 0xb7, 0xa0, 0x41, - 0xf2, 0xf3, 0x3a, 0x6e, 0x45, 0x73, 0xf7, 0x9d, 0x21, 0x27, 0xdf, 0x85, 0x72, 0xa6, 0xba, 0xc7, - 0x3f, 0xaf, 0x2f, 0xf7, 0xb5, 0xc2, 0x0d, 0x38, 0xa3, 0x89, 0x42, 0x43, 0x46, 0x17, 0xa1, 0x32, - 0x4f, 0xd5, 0x20, 0xf3, 0x2f, 0xe8, 0xb8, 0xf6, 0x0d, 0x3d, 0x86, 0x9a, 0xbe, 0xd7, 0x69, 0xcc, - 0x26, 0x94, 0xf8, 0x55, 0x1d, 0xb3, 0xdd, 0x35, 0x23, 0xb0, 0x9b, 0x8f, 0xc0, 0xee, 0x8b, 0x7c, - 0x04, 0xf6, 0x2e, 0x28, 0xd5, 0xbf, 0xfd, 0xb5, 0xe3, 0x85, 0xa0, 0x1c, 0x4f, 0xb4, 0x1f, 0xfa, - 0x04, 0xea, 0x3a, 0xcc, 0xeb, 0x39, 0x15, 0x31, 0x25, 0x3e, 0xfc, 0x87, 0x38, 0x3a, 0x81, 0xe7, - 0xc6, 0x11, 0xdd, 0x83, 0x86, 0xcb, 0x27, 0x1a, 0x0b, 0x9e, 0xa8, 0x7a, 0xd7, 0x74, 0xbd, 0xa1, - 0x50, 0xeb, 0xdd, 0xfc, 0xdb, 0x4f, 0x04, 0x4f, 0xfa, 0xc4, 0x8d, 0xd6, 0x85, 0x5b, 0x2e, 0x63, - 0x5d, 0x1f, 0xb7, 0x59, 0xe4, 0x5b, 0x25, 0x83, 0xef, 0x3c, 0x68, 0xd9, 0x49, 0xf1, 0x94, 0xe2, - 0x99, 0x9c, 0xe6, 0xe3, 0xfb, 0x22, 0x54, 0x86, 0xf3, 0xd1, 0x2b, 0x2a, 0xed, 0x78, 0xb5, 0x6f, - 0xea, 0x12, 0x50, 0x36, 0x12, 0xa7, 0xa9, 0xa4, 0xa4, 0x38, 0xb8, 0x77, 0x1c, 0xaa, 0x46, 0x36, - 0xfa, 0x00, 0xf2, 0xe9, 0x1a, 0xc5, 0x8c, 0xd0, 0xb7, 0xf6, 0xc2, 0xd5, 0x2d, 0xd8, 0x57, 0x98, - 0xba, 0xdc, 0xa9, 0xe0, 0x2f, 0xe9, 0x48, 0xaa, 0x13, 0x6e, 0xeb, 0x38, 0x55, 0x8b, 0xf4, 0x49, - 0xf0, 0xa3, 0x07, 0x3b, 0x4b, 0xb9, 0xa1, 0x5b, 0x50, 0x9b, 0xea, 0xa7, 0xd3, 0x28, 0x26, 0x66, - 0xba, 0x2c, 0x6b, 0x02, 0xd6, 0xdc, 0x27, 0xaa, 0xb1, 0x77, 0xe6, 0xac, 0x48, 0xdf, 0x5a, 0xa3, - 0xd7, 0x1d, 0x41, 0x39, 0xdc, 0x82, 0x1a, 0x1f, 0x8f, 0x67, 0x31, 0xa3, 0x9a, 0x5e, 0x5a, 0x8f, - 0x6e, 0xcd, 0x8a, 0xec, 0xc3, 0x79, 0x7b, 0x16, 0x9b, 0x78, 0xfe, 0x1a, 0x7c, 0xe5, 0xc1, 0x7b, - 0x2b, 0x92, 0xda, 0xeb, 0x7b, 0x1b, 0x2a, 0xe6, 0x73, 0x5a, 0xd3, 0xda, 0xb1, 0x5f, 0xec, 0xdb, - 0x25, 0x0f, 0xcb, 0x43, 0x1f, 0x03, 0x08, 0x4a, 0xe6, 0x8c, 0x60, 0x36, 0x3a, 0xb5, 0xab, 0xec, - 0x72, 0x61, 0x95, 0x85, 0xce, 0x38, 0x18, 0x4d, 0x69, 0x42, 0xc3, 0x02, 0x3d, 0xf8, 0xc3, 0x83, - 0xe6, 0xb3, 0xa1, 0x12, 0x73, 0xb9, 0xb4, 0xeb, 0x25, 0xf4, 0xce, 0x2a, 0xe1, 0xa2, 0x03, 0xb6, - 0x96, 0x3a, 0x60, 0xb9, 0x6a, 0xa5, 0x95, 0xaa, 0xa9, 0x2d, 0x99, 0x49, 0x2c, 0x64, 0x84, 0xc7, - 0x92, 0x8a, 0xa8, 0x28, 0x52, 0x29, 0x6c, 0x68, 0xd3, 0x03, 0x65, 0xc9, 0xb7, 0xf8, 0x47, 0x80, - 0x28, 0x23, 0xd1, 0x90, 0x8e, 0xb9, 0xa0, 0x8e, 0x6e, 0x26, 0xeb, 0x3e, 0x65, 0xa4, 0xa7, 0x0d, - 0x39, 0xdb, 0xfd, 0x55, 0x54, 0x0a, 0x7f, 0x15, 0xc1, 0x37, 0x1e, 0xb4, 0x96, 0x4f, 0x6a, 0x15, - 0xbf, 0xbb, 0xb6, 0x2d, 0x37, 0x6b, 0xee, 0x98, 0xff, 0x4b, 0xf5, 0xe3, 0x1f, 0x3c, 0xd8, 0x7f, - 0xf6, 0x86, 0x8a, 0x19, 0x3e, 0xed, 0xe7, 0x5f, 0x42, 0x7d, 0x80, 0xc5, 0x3a, 0x45, 0x57, 0x0a, - 0x39, 0xac, 0x6d, 0xd9, 0xf6, 0xd5, 0x0d, 0x56, 0x7b, 0xa4, 0x27, 0x50, 0x75, 0x0b, 0x17, 0x5d, - 0x2e, 0x70, 0x57, 0x57, 0x73, 0xfb, 0xca, 0xd9, 0x46, 0x13, 0xe7, 0xf8, 0x7b, 0x0f, 0x9a, 0xfa, - 0xc7, 0x66, 0x20, 0xb9, 0xa0, 0x8b, 0x54, 0x7b, 0x50, 0xd6, 0x9b, 0x19, 0x5d, 0x5a, 0x99, 0xaa, - 0x2e, 0xee, 0x3f, 0x8c, 0xdb, 0xe0, 0x1c, 0x7a, 0x0a, 0x55, 0xb7, 0xbc, 0x96, 0x73, 0x5c, 0xd9, - 0x73, 0xcb, 0x39, 0xae, 0xee, 0xbb, 0xe0, 0xdc, 0xf1, 0xd7, 0x1e, 0xb4, 0x0a, 0x3f, 0x35, 0x8b, - 0x34, 0x53, 0xb8, 0xb4, 0xe1, 0x57, 0x09, 0xdd, 0x28, 0xc4, 0xfc, 0xfb, 0x9f, 0xd4, 0xf6, 0xcd, - 0x7f, 0x43, 0xb5, 0x82, 0xfd, 0xe4, 0xc1, 0x9e, 0x69, 0x95, 0x45, 0x16, 0xcf, 0xa1, 0x5e, 0xec, - 0x3b, 0x54, 0x94, 0xe6, 0x8c, 0xab, 0xd7, 0xee, 0x6c, 0xb4, 0x3b, 0xed, 0x5e, 0xac, 0x0e, 0xbd, - 0xce, 0xc6, 0x8e, 0xb5, 0x41, 0x0f, 0x36, 0x13, 0xf2, 0xa8, 0xbd, 0xd6, 0xe7, 0x28, 0x93, 0x5c, - 0xbc, 0xec, 0xc6, 0xfc, 0x68, 0xc4, 0x93, 0x84, 0xb3, 0xa3, 0x74, 0x38, 0xac, 0xe8, 0xa5, 0x74, - 0xe7, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb0, 0xd5, 0x0c, 0xd9, 0x34, 0x0c, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCOverlayInspectorClient interface { - DRPCConn() drpc.Conn - - // CountNodes returns the number of nodes in the cache - CountNodes(ctx context.Context, in *CountNodesRequest) (*CountNodesResponse, error) - // DumpNodes returns all the nodes in the cache - DumpNodes(ctx context.Context, in *DumpNodesRequest) (*DumpNodesResponse, error) -} - -type drpcOverlayInspectorClient struct { - cc drpc.Conn -} - -func NewDRPCOverlayInspectorClient(cc drpc.Conn) DRPCOverlayInspectorClient { - return &drpcOverlayInspectorClient{cc} -} - -func (c *drpcOverlayInspectorClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcOverlayInspectorClient) CountNodes(ctx context.Context, in *CountNodesRequest) (*CountNodesResponse, error) { - out := new(CountNodesResponse) - err := c.cc.Invoke(ctx, "/inspector.OverlayInspector/CountNodes", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcOverlayInspectorClient) DumpNodes(ctx context.Context, in *DumpNodesRequest) (*DumpNodesResponse, error) { - out := new(DumpNodesResponse) - err := c.cc.Invoke(ctx, "/inspector.OverlayInspector/DumpNodes", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCOverlayInspectorServer interface { - // CountNodes returns the number of nodes in the cache - CountNodes(context.Context, *CountNodesRequest) (*CountNodesResponse, error) - // DumpNodes returns all the nodes in the cache - DumpNodes(context.Context, *DumpNodesRequest) (*DumpNodesResponse, error) -} - -type DRPCOverlayInspectorDescription struct{} - -func (DRPCOverlayInspectorDescription) NumMethods() int { return 2 } - -func (DRPCOverlayInspectorDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/inspector.OverlayInspector/CountNodes", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCOverlayInspectorServer). - CountNodes( - ctx, - in1.(*CountNodesRequest), - ) - }, DRPCOverlayInspectorServer.CountNodes, true - case 1: - return "/inspector.OverlayInspector/DumpNodes", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCOverlayInspectorServer). - DumpNodes( - ctx, - in1.(*DumpNodesRequest), - ) - }, DRPCOverlayInspectorServer.DumpNodes, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterOverlayInspector(mux drpc.Mux, impl DRPCOverlayInspectorServer) error { - return mux.Register(impl, DRPCOverlayInspectorDescription{}) -} - -type DRPCOverlayInspector_CountNodesStream interface { - drpc.Stream - SendAndClose(*CountNodesResponse) error -} - -type drpcOverlayInspectorCountNodesStream struct { - drpc.Stream -} - -func (x *drpcOverlayInspectorCountNodesStream) SendAndClose(m *CountNodesResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCOverlayInspector_DumpNodesStream interface { - drpc.Stream - SendAndClose(*DumpNodesResponse) error -} - -type drpcOverlayInspectorDumpNodesStream struct { - drpc.Stream -} - -func (x *drpcOverlayInspectorDumpNodesStream) SendAndClose(m *DumpNodesResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPieceStoreInspectorClient interface { - DRPCConn() drpc.Conn - - // Stats return space and bandwidth stats for a storagenode - Stats(ctx context.Context, in *StatsRequest) (*StatSummaryResponse, error) - // Dashboard returns stats for a specific storagenode - Dashboard(ctx context.Context, in *DashboardRequest) (*DashboardResponse, error) -} - -type drpcPieceStoreInspectorClient struct { - cc drpc.Conn -} - -func NewDRPCPieceStoreInspectorClient(cc drpc.Conn) DRPCPieceStoreInspectorClient { - return &drpcPieceStoreInspectorClient{cc} -} - -func (c *drpcPieceStoreInspectorClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcPieceStoreInspectorClient) Stats(ctx context.Context, in *StatsRequest) (*StatSummaryResponse, error) { - out := new(StatSummaryResponse) - err := c.cc.Invoke(ctx, "/inspector.PieceStoreInspector/Stats", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPieceStoreInspectorClient) Dashboard(ctx context.Context, in *DashboardRequest) (*DashboardResponse, error) { - out := new(DashboardResponse) - err := c.cc.Invoke(ctx, "/inspector.PieceStoreInspector/Dashboard", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCPieceStoreInspectorServer interface { - // Stats return space and bandwidth stats for a storagenode - Stats(context.Context, *StatsRequest) (*StatSummaryResponse, error) - // Dashboard returns stats for a specific storagenode - Dashboard(context.Context, *DashboardRequest) (*DashboardResponse, error) -} - -type DRPCPieceStoreInspectorDescription struct{} - -func (DRPCPieceStoreInspectorDescription) NumMethods() int { return 2 } - -func (DRPCPieceStoreInspectorDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/inspector.PieceStoreInspector/Stats", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPieceStoreInspectorServer). - Stats( - ctx, - in1.(*StatsRequest), - ) - }, DRPCPieceStoreInspectorServer.Stats, true - case 1: - return "/inspector.PieceStoreInspector/Dashboard", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPieceStoreInspectorServer). - Dashboard( - ctx, - in1.(*DashboardRequest), - ) - }, DRPCPieceStoreInspectorServer.Dashboard, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterPieceStoreInspector(mux drpc.Mux, impl DRPCPieceStoreInspectorServer) error { - return mux.Register(impl, DRPCPieceStoreInspectorDescription{}) -} - -type DRPCPieceStoreInspector_StatsStream interface { - drpc.Stream - SendAndClose(*StatSummaryResponse) error -} - -type drpcPieceStoreInspectorStatsStream struct { - drpc.Stream -} - -func (x *drpcPieceStoreInspectorStatsStream) SendAndClose(m *StatSummaryResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPieceStoreInspector_DashboardStream interface { - drpc.Stream - SendAndClose(*DashboardResponse) error -} - -type drpcPieceStoreInspectorDashboardStream struct { - drpc.Stream -} - -func (x *drpcPieceStoreInspectorDashboardStream) SendAndClose(m *DashboardResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCIrreparableInspectorClient interface { - DRPCConn() drpc.Conn - - // ListIrreparableSegments returns damaged segments - ListIrreparableSegments(ctx context.Context, in *ListIrreparableSegmentsRequest) (*ListIrreparableSegmentsResponse, error) -} - -type drpcIrreparableInspectorClient struct { - cc drpc.Conn -} - -func NewDRPCIrreparableInspectorClient(cc drpc.Conn) DRPCIrreparableInspectorClient { - return &drpcIrreparableInspectorClient{cc} -} - -func (c *drpcIrreparableInspectorClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcIrreparableInspectorClient) ListIrreparableSegments(ctx context.Context, in *ListIrreparableSegmentsRequest) (*ListIrreparableSegmentsResponse, error) { - out := new(ListIrreparableSegmentsResponse) - err := c.cc.Invoke(ctx, "/inspector.IrreparableInspector/ListIrreparableSegments", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCIrreparableInspectorServer interface { - // ListIrreparableSegments returns damaged segments - ListIrreparableSegments(context.Context, *ListIrreparableSegmentsRequest) (*ListIrreparableSegmentsResponse, error) -} - -type DRPCIrreparableInspectorDescription struct{} - -func (DRPCIrreparableInspectorDescription) NumMethods() int { return 1 } - -func (DRPCIrreparableInspectorDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/inspector.IrreparableInspector/ListIrreparableSegments", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCIrreparableInspectorServer). - ListIrreparableSegments( - ctx, - in1.(*ListIrreparableSegmentsRequest), - ) - }, DRPCIrreparableInspectorServer.ListIrreparableSegments, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterIrreparableInspector(mux drpc.Mux, impl DRPCIrreparableInspectorServer) error { - return mux.Register(impl, DRPCIrreparableInspectorDescription{}) -} - -type DRPCIrreparableInspector_ListIrreparableSegmentsStream interface { - drpc.Stream - SendAndClose(*ListIrreparableSegmentsResponse) error -} - -type drpcIrreparableInspectorListIrreparableSegmentsStream struct { - drpc.Stream -} - -func (x *drpcIrreparableInspectorListIrreparableSegmentsStream) SendAndClose(m *ListIrreparableSegmentsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCHealthInspectorClient interface { - DRPCConn() drpc.Conn - - // ObjectHealth will return stats about the health of an object - ObjectHealth(ctx context.Context, in *ObjectHealthRequest) (*ObjectHealthResponse, error) - // SegmentHealth will return stats about the health of a segment - SegmentHealth(ctx context.Context, in *SegmentHealthRequest) (*SegmentHealthResponse, error) -} - -type drpcHealthInspectorClient struct { - cc drpc.Conn -} - -func NewDRPCHealthInspectorClient(cc drpc.Conn) DRPCHealthInspectorClient { - return &drpcHealthInspectorClient{cc} -} - -func (c *drpcHealthInspectorClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcHealthInspectorClient) ObjectHealth(ctx context.Context, in *ObjectHealthRequest) (*ObjectHealthResponse, error) { - out := new(ObjectHealthResponse) - err := c.cc.Invoke(ctx, "/inspector.HealthInspector/ObjectHealth", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcHealthInspectorClient) SegmentHealth(ctx context.Context, in *SegmentHealthRequest) (*SegmentHealthResponse, error) { - out := new(SegmentHealthResponse) - err := c.cc.Invoke(ctx, "/inspector.HealthInspector/SegmentHealth", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCHealthInspectorServer interface { - // ObjectHealth will return stats about the health of an object - ObjectHealth(context.Context, *ObjectHealthRequest) (*ObjectHealthResponse, error) - // SegmentHealth will return stats about the health of a segment - SegmentHealth(context.Context, *SegmentHealthRequest) (*SegmentHealthResponse, error) -} - -type DRPCHealthInspectorDescription struct{} - -func (DRPCHealthInspectorDescription) NumMethods() int { return 2 } - -func (DRPCHealthInspectorDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/inspector.HealthInspector/ObjectHealth", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCHealthInspectorServer). - ObjectHealth( - ctx, - in1.(*ObjectHealthRequest), - ) - }, DRPCHealthInspectorServer.ObjectHealth, true - case 1: - return "/inspector.HealthInspector/SegmentHealth", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCHealthInspectorServer). - SegmentHealth( - ctx, - in1.(*SegmentHealthRequest), - ) - }, DRPCHealthInspectorServer.SegmentHealth, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterHealthInspector(mux drpc.Mux, impl DRPCHealthInspectorServer) error { - return mux.Register(impl, DRPCHealthInspectorDescription{}) -} - -type DRPCHealthInspector_ObjectHealthStream interface { - drpc.Stream - SendAndClose(*ObjectHealthResponse) error -} - -type drpcHealthInspectorObjectHealthStream struct { - drpc.Stream -} - -func (x *drpcHealthInspectorObjectHealthStream) SendAndClose(m *ObjectHealthResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCHealthInspector_SegmentHealthStream interface { - drpc.Stream - SendAndClose(*SegmentHealthResponse) error -} - -type drpcHealthInspectorSegmentHealthStream struct { - drpc.Stream -} - -func (x *drpcHealthInspectorSegmentHealthStream) SendAndClose(m *SegmentHealthResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/inspector.proto b/vendor/storj.io/common/pb/inspector.proto deleted file mode 100644 index f393c1606..000000000 --- a/vendor/storj.io/common/pb/inspector.proto +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -import "gogo.proto"; -import "node.proto"; -import "pointerdb.proto"; -import "google/protobuf/timestamp.proto"; - -package inspector; - -service OverlayInspector { - // CountNodes returns the number of nodes in the cache - rpc CountNodes(CountNodesRequest) returns (CountNodesResponse); - // DumpNodes returns all the nodes in the cache - rpc DumpNodes(DumpNodesRequest) returns (DumpNodesResponse); -} - -service PieceStoreInspector { - // Stats return space and bandwidth stats for a storagenode - rpc Stats(StatsRequest) returns (StatSummaryResponse) {} - // Dashboard returns stats for a specific storagenode - rpc Dashboard(DashboardRequest) returns (DashboardResponse) {} -} - -service IrreparableInspector { - // ListIrreparableSegments returns damaged segments - rpc ListIrreparableSegments(ListIrreparableSegmentsRequest) returns (ListIrreparableSegmentsResponse); -} - -service HealthInspector { - // ObjectHealth will return stats about the health of an object - rpc ObjectHealth(ObjectHealthRequest) returns (ObjectHealthResponse) {} - // SegmentHealth will return stats about the health of a segment - rpc SegmentHealth(SegmentHealthRequest) returns (SegmentHealthResponse) {} -} - -message ListIrreparableSegmentsRequest { - int32 limit = 1; - bytes last_seen_segment_path = 2; -} - -message IrreparableSegment { - bytes path = 1; - pointerdb.Pointer segment_detail = 2; - int32 lost_pieces = 3; - int64 last_repair_attempt = 4; - int64 repair_attempt_count = 5; -} - -message ListIrreparableSegmentsResponse { - repeated IrreparableSegment segments = 1; -} - -message CountNodesResponse { - int64 count = 1; -} - -message CountNodesRequest { -} - -message DumpNodesRequest {} - -message DumpNodesResponse { - repeated node.Node nodes = 1; -} -message StatsRequest { -} - -message StatSummaryResponse { - int64 used_space = 1; - int64 available_space = 2; - int64 used_ingress = 3; - int64 used_egress = 4; - int64 used_bandwidth = 5; - int64 available_bandwidth = 6; -} - -message DashboardRequest { -} - -message DashboardResponse { - bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - int64 node_connections = 2; - string bootstrap_address = 3 [deprecated=true]; - string internal_address = 4; - string external_address = 5; - string dashboard_address = 6; - StatSummaryResponse stats = 7; - string uptime = 8; - google.protobuf.Timestamp last_pinged = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp last_queried = 10 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - bytes last_ping_from_id = 11 [(gogoproto.customtype) = "NodeID"]; - string last_ping_from_address = 12; -} - -message SegmentHealthRequest { - bytes bucket = 1; // segment bucket name - bytes encrypted_path = 2; // segment encrypted path - int64 segment_index = 3; // segment index - bytes project_id = 4; // segment project id -} - -message SegmentHealth { - repeated bytes healthy_ids = 1 [(gogoproto.customtype) = "NodeID"]; // online + not disqualified - repeated bytes unhealthy_ids = 2 [(gogoproto.customtype) = "NodeID"]; // online + disqualified - repeated bytes offline_ids = 3 [(gogoproto.customtype) = "NodeID"]; // offline - bytes segment = 4; // path formatted segment index -} - -message SegmentHealthResponse { - SegmentHealth health = 1; // Information about a segment's health - pointerdb.RedundancyScheme redundancy = 2; // expected segment info -} - -message ObjectHealthRequest { - bytes encrypted_path = 1; // object encrypted path - bytes bucket = 2; // object bucket name - bytes project_id = 3; // object project id - int64 start_after_segment = 4; // Get all segments after specified segment index - int64 end_before_segment = 5; // Stop at segment before specified segment index - int32 limit = 6; // Max number of segments that are checked -} - -message ObjectHealthResponse { - repeated SegmentHealth segments = 1; // actual segment info - pointerdb.RedundancyScheme redundancy = 2; // expected segment info -} \ No newline at end of file diff --git a/vendor/storj.io/common/pb/meta.pb.go b/vendor/storj.io/common/pb/meta.pb.go deleted file mode 100644 index 824c6d005..000000000 --- a/vendor/storj.io/common/pb/meta.pb.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: meta.proto - -package pb - -import ( - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// SerializableMeta is the object metadata that will be stored serialized. -type SerializableMeta struct { - ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - UserDefined map[string]string `protobuf:"bytes,2,rep,name=user_defined,json=userDefined,proto3" json:"user_defined,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SerializableMeta) Reset() { *m = SerializableMeta{} } -func (m *SerializableMeta) String() string { return proto.CompactTextString(m) } -func (*SerializableMeta) ProtoMessage() {} -func (*SerializableMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_3b5ea8fe65782bcc, []int{0} -} -func (m *SerializableMeta) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SerializableMeta.Unmarshal(m, b) -} -func (m *SerializableMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SerializableMeta.Marshal(b, m, deterministic) -} -func (m *SerializableMeta) XXX_Merge(src proto.Message) { - xxx_messageInfo_SerializableMeta.Merge(m, src) -} -func (m *SerializableMeta) XXX_Size() int { - return xxx_messageInfo_SerializableMeta.Size(m) -} -func (m *SerializableMeta) XXX_DiscardUnknown() { - xxx_messageInfo_SerializableMeta.DiscardUnknown(m) -} - -var xxx_messageInfo_SerializableMeta proto.InternalMessageInfo - -func (m *SerializableMeta) GetContentType() string { - if m != nil { - return m.ContentType - } - return "" -} - -func (m *SerializableMeta) GetUserDefined() map[string]string { - if m != nil { - return m.UserDefined - } - return nil -} - -func init() { - proto.RegisterType((*SerializableMeta)(nil), "objects.SerializableMeta") - proto.RegisterMapType((map[string]string)(nil), "objects.SerializableMeta.UserDefinedEntry") -} - -func init() { proto.RegisterFile("meta.proto", fileDescriptor_3b5ea8fe65782bcc) } - -var fileDescriptor_3b5ea8fe65782bcc = []byte{ - // 207 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xca, 0x4d, 0x2d, 0x49, - 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcf, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0x29, 0x56, - 0x3a, 0xc2, 0xc8, 0x25, 0x10, 0x9c, 0x5a, 0x94, 0x99, 0x98, 0x93, 0x59, 0x95, 0x98, 0x94, 0x93, - 0xea, 0x9b, 0x5a, 0x92, 0x28, 0xa4, 0xc8, 0xc5, 0x93, 0x9c, 0x9f, 0x57, 0x92, 0x9a, 0x57, 0x12, - 0x5f, 0x52, 0x59, 0x90, 0x2a, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x0d, 0x15, 0x0b, 0xa9, - 0x2c, 0x48, 0x15, 0xf2, 0xe5, 0xe2, 0x29, 0x2d, 0x4e, 0x2d, 0x8a, 0x4f, 0x49, 0x4d, 0xcb, 0xcc, - 0x4b, 0x4d, 0x91, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, 0xd2, 0xd2, 0x83, 0x9a, 0xab, 0x87, 0x6e, - 0xa6, 0x5e, 0x68, 0x71, 0x6a, 0x91, 0x0b, 0x44, 0xb1, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x77, - 0x29, 0x42, 0x44, 0xca, 0x8e, 0x4b, 0x00, 0x5d, 0x81, 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0x25, - 0xd4, 0x72, 0x10, 0x53, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c, - 0x06, 0xe1, 0x58, 0x31, 0x59, 0x30, 0x3a, 0x89, 0x44, 0x09, 0x15, 0x97, 0xe4, 0x17, 0x65, 0xe9, - 0x65, 0xe6, 0xeb, 0x27, 0xe7, 0xe7, 0xe6, 0xe6, 0xe7, 0xe9, 0x17, 0x24, 0x25, 0xb1, 0x81, 0x3d, - 0x6b, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xec, 0xbb, 0x6b, 0x9d, 0xfa, 0x00, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/meta.proto b/vendor/storj.io/common/pb/meta.proto deleted file mode 100644 index f3813be56..000000000 --- a/vendor/storj.io/common/pb/meta.proto +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package objects; - -// SerializableMeta is the object metadata that will be stored serialized. -message SerializableMeta { - string content_type = 1; - map user_defined = 2; -} \ No newline at end of file diff --git a/vendor/storj.io/common/pb/metainfo.pb.go b/vendor/storj.io/common/pb/metainfo.pb.go deleted file mode 100644 index b64e83e15..000000000 --- a/vendor/storj.io/common/pb/metainfo.pb.go +++ /dev/null @@ -1,5355 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: metainfo.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Object_Status int32 - -const ( - Object_INVALID Object_Status = 0 - Object_UPLOADING Object_Status = 1 - Object_COMMITTING Object_Status = 2 - Object_COMMITTED Object_Status = 3 - Object_DELETING Object_Status = 4 -) - -var Object_Status_name = map[int32]string{ - 0: "INVALID", - 1: "UPLOADING", - 2: "COMMITTING", - 3: "COMMITTED", - 4: "DELETING", -} - -var Object_Status_value = map[string]int32{ - "INVALID": 0, - "UPLOADING": 1, - "COMMITTING": 2, - "COMMITTED": 3, - "DELETING": 4, -} - -func (x Object_Status) String() string { - return proto.EnumName(Object_Status_name, int32(x)) -} - -func (Object_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{16, 0} -} - -type RequestHeader struct { - ApiKey []byte `protobuf:"bytes,1,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` - UserAgent []byte `protobuf:"bytes,2,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestHeader) Reset() { *m = RequestHeader{} } -func (m *RequestHeader) String() string { return proto.CompactTextString(m) } -func (*RequestHeader) ProtoMessage() {} -func (*RequestHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{0} -} -func (m *RequestHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestHeader.Unmarshal(m, b) -} -func (m *RequestHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestHeader.Marshal(b, m, deterministic) -} -func (m *RequestHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestHeader.Merge(m, src) -} -func (m *RequestHeader) XXX_Size() int { - return xxx_messageInfo_RequestHeader.Size(m) -} -func (m *RequestHeader) XXX_DiscardUnknown() { - xxx_messageInfo_RequestHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestHeader proto.InternalMessageInfo - -func (m *RequestHeader) GetApiKey() []byte { - if m != nil { - return m.ApiKey - } - return nil -} - -func (m *RequestHeader) GetUserAgent() []byte { - if m != nil { - return m.UserAgent - } - return nil -} - -type Bucket struct { - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - PathCipher CipherSuite `protobuf:"varint,2,opt,name=path_cipher,json=pathCipher,proto3,enum=encryption.CipherSuite" json:"path_cipher,omitempty"` - CreatedAt time.Time `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` - DefaultSegmentSize int64 `protobuf:"varint,4,opt,name=default_segment_size,json=defaultSegmentSize,proto3" json:"default_segment_size,omitempty"` - DefaultRedundancyScheme *RedundancyScheme `protobuf:"bytes,5,opt,name=default_redundancy_scheme,json=defaultRedundancyScheme,proto3" json:"default_redundancy_scheme,omitempty"` - DefaultEncryptionParameters *EncryptionParameters `protobuf:"bytes,6,opt,name=default_encryption_parameters,json=defaultEncryptionParameters,proto3" json:"default_encryption_parameters,omitempty"` - PartnerId []byte `protobuf:"bytes,7,opt,name=partner_id,json=partnerId,proto3" json:"partner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Bucket) Reset() { *m = Bucket{} } -func (m *Bucket) String() string { return proto.CompactTextString(m) } -func (*Bucket) ProtoMessage() {} -func (*Bucket) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{1} -} -func (m *Bucket) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Bucket.Unmarshal(m, b) -} -func (m *Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Bucket.Marshal(b, m, deterministic) -} -func (m *Bucket) XXX_Merge(src proto.Message) { - xxx_messageInfo_Bucket.Merge(m, src) -} -func (m *Bucket) XXX_Size() int { - return xxx_messageInfo_Bucket.Size(m) -} -func (m *Bucket) XXX_DiscardUnknown() { - xxx_messageInfo_Bucket.DiscardUnknown(m) -} - -var xxx_messageInfo_Bucket proto.InternalMessageInfo - -func (m *Bucket) GetName() []byte { - if m != nil { - return m.Name - } - return nil -} - -func (m *Bucket) GetPathCipher() CipherSuite { - if m != nil { - return m.PathCipher - } - return CipherSuite_ENC_UNSPECIFIED -} - -func (m *Bucket) GetCreatedAt() time.Time { - if m != nil { - return m.CreatedAt - } - return time.Time{} -} - -func (m *Bucket) GetDefaultSegmentSize() int64 { - if m != nil { - return m.DefaultSegmentSize - } - return 0 -} - -func (m *Bucket) GetDefaultRedundancyScheme() *RedundancyScheme { - if m != nil { - return m.DefaultRedundancyScheme - } - return nil -} - -func (m *Bucket) GetDefaultEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.DefaultEncryptionParameters - } - return nil -} - -func (m *Bucket) GetPartnerId() []byte { - if m != nil { - return m.PartnerId - } - return nil -} - -type BucketListItem struct { - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - CreatedAt time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketListItem) Reset() { *m = BucketListItem{} } -func (m *BucketListItem) String() string { return proto.CompactTextString(m) } -func (*BucketListItem) ProtoMessage() {} -func (*BucketListItem) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{2} -} -func (m *BucketListItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketListItem.Unmarshal(m, b) -} -func (m *BucketListItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketListItem.Marshal(b, m, deterministic) -} -func (m *BucketListItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketListItem.Merge(m, src) -} -func (m *BucketListItem) XXX_Size() int { - return xxx_messageInfo_BucketListItem.Size(m) -} -func (m *BucketListItem) XXX_DiscardUnknown() { - xxx_messageInfo_BucketListItem.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketListItem proto.InternalMessageInfo - -func (m *BucketListItem) GetName() []byte { - if m != nil { - return m.Name - } - return nil -} - -func (m *BucketListItem) GetCreatedAt() time.Time { - if m != nil { - return m.CreatedAt - } - return time.Time{} -} - -type BucketCreateRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - PathCipher CipherSuite `protobuf:"varint,2,opt,name=path_cipher,json=pathCipher,proto3,enum=encryption.CipherSuite" json:"path_cipher,omitempty"` - DefaultSegmentSize int64 `protobuf:"varint,3,opt,name=default_segment_size,json=defaultSegmentSize,proto3" json:"default_segment_size,omitempty"` - DefaultRedundancyScheme *RedundancyScheme `protobuf:"bytes,4,opt,name=default_redundancy_scheme,json=defaultRedundancyScheme,proto3" json:"default_redundancy_scheme,omitempty"` - DefaultEncryptionParameters *EncryptionParameters `protobuf:"bytes,5,opt,name=default_encryption_parameters,json=defaultEncryptionParameters,proto3" json:"default_encryption_parameters,omitempty"` - PartnerId []byte `protobuf:"bytes,6,opt,name=partner_id,json=partnerId,proto3" json:"partner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketCreateRequest) Reset() { *m = BucketCreateRequest{} } -func (m *BucketCreateRequest) String() string { return proto.CompactTextString(m) } -func (*BucketCreateRequest) ProtoMessage() {} -func (*BucketCreateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{3} -} -func (m *BucketCreateRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketCreateRequest.Unmarshal(m, b) -} -func (m *BucketCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketCreateRequest.Marshal(b, m, deterministic) -} -func (m *BucketCreateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketCreateRequest.Merge(m, src) -} -func (m *BucketCreateRequest) XXX_Size() int { - return xxx_messageInfo_BucketCreateRequest.Size(m) -} -func (m *BucketCreateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BucketCreateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketCreateRequest proto.InternalMessageInfo - -func (m *BucketCreateRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BucketCreateRequest) GetName() []byte { - if m != nil { - return m.Name - } - return nil -} - -func (m *BucketCreateRequest) GetPathCipher() CipherSuite { - if m != nil { - return m.PathCipher - } - return CipherSuite_ENC_UNSPECIFIED -} - -func (m *BucketCreateRequest) GetDefaultSegmentSize() int64 { - if m != nil { - return m.DefaultSegmentSize - } - return 0 -} - -func (m *BucketCreateRequest) GetDefaultRedundancyScheme() *RedundancyScheme { - if m != nil { - return m.DefaultRedundancyScheme - } - return nil -} - -func (m *BucketCreateRequest) GetDefaultEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.DefaultEncryptionParameters - } - return nil -} - -func (m *BucketCreateRequest) GetPartnerId() []byte { - if m != nil { - return m.PartnerId - } - return nil -} - -type BucketCreateResponse struct { - Bucket *Bucket `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketCreateResponse) Reset() { *m = BucketCreateResponse{} } -func (m *BucketCreateResponse) String() string { return proto.CompactTextString(m) } -func (*BucketCreateResponse) ProtoMessage() {} -func (*BucketCreateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{4} -} -func (m *BucketCreateResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketCreateResponse.Unmarshal(m, b) -} -func (m *BucketCreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketCreateResponse.Marshal(b, m, deterministic) -} -func (m *BucketCreateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketCreateResponse.Merge(m, src) -} -func (m *BucketCreateResponse) XXX_Size() int { - return xxx_messageInfo_BucketCreateResponse.Size(m) -} -func (m *BucketCreateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BucketCreateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketCreateResponse proto.InternalMessageInfo - -func (m *BucketCreateResponse) GetBucket() *Bucket { - if m != nil { - return m.Bucket - } - return nil -} - -type BucketGetRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketGetRequest) Reset() { *m = BucketGetRequest{} } -func (m *BucketGetRequest) String() string { return proto.CompactTextString(m) } -func (*BucketGetRequest) ProtoMessage() {} -func (*BucketGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{5} -} -func (m *BucketGetRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketGetRequest.Unmarshal(m, b) -} -func (m *BucketGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketGetRequest.Marshal(b, m, deterministic) -} -func (m *BucketGetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketGetRequest.Merge(m, src) -} -func (m *BucketGetRequest) XXX_Size() int { - return xxx_messageInfo_BucketGetRequest.Size(m) -} -func (m *BucketGetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BucketGetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketGetRequest proto.InternalMessageInfo - -func (m *BucketGetRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BucketGetRequest) GetName() []byte { - if m != nil { - return m.Name - } - return nil -} - -type BucketGetResponse struct { - Bucket *Bucket `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketGetResponse) Reset() { *m = BucketGetResponse{} } -func (m *BucketGetResponse) String() string { return proto.CompactTextString(m) } -func (*BucketGetResponse) ProtoMessage() {} -func (*BucketGetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{6} -} -func (m *BucketGetResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketGetResponse.Unmarshal(m, b) -} -func (m *BucketGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketGetResponse.Marshal(b, m, deterministic) -} -func (m *BucketGetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketGetResponse.Merge(m, src) -} -func (m *BucketGetResponse) XXX_Size() int { - return xxx_messageInfo_BucketGetResponse.Size(m) -} -func (m *BucketGetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BucketGetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketGetResponse proto.InternalMessageInfo - -func (m *BucketGetResponse) GetBucket() *Bucket { - if m != nil { - return m.Bucket - } - return nil -} - -type BucketDeleteRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketDeleteRequest) Reset() { *m = BucketDeleteRequest{} } -func (m *BucketDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*BucketDeleteRequest) ProtoMessage() {} -func (*BucketDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{7} -} -func (m *BucketDeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketDeleteRequest.Unmarshal(m, b) -} -func (m *BucketDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketDeleteRequest.Marshal(b, m, deterministic) -} -func (m *BucketDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketDeleteRequest.Merge(m, src) -} -func (m *BucketDeleteRequest) XXX_Size() int { - return xxx_messageInfo_BucketDeleteRequest.Size(m) -} -func (m *BucketDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BucketDeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketDeleteRequest proto.InternalMessageInfo - -func (m *BucketDeleteRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BucketDeleteRequest) GetName() []byte { - if m != nil { - return m.Name - } - return nil -} - -type BucketDeleteResponse struct { - Bucket *Bucket `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketDeleteResponse) Reset() { *m = BucketDeleteResponse{} } -func (m *BucketDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*BucketDeleteResponse) ProtoMessage() {} -func (*BucketDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{8} -} -func (m *BucketDeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketDeleteResponse.Unmarshal(m, b) -} -func (m *BucketDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketDeleteResponse.Marshal(b, m, deterministic) -} -func (m *BucketDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketDeleteResponse.Merge(m, src) -} -func (m *BucketDeleteResponse) XXX_Size() int { - return xxx_messageInfo_BucketDeleteResponse.Size(m) -} -func (m *BucketDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BucketDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketDeleteResponse proto.InternalMessageInfo - -func (m *BucketDeleteResponse) GetBucket() *Bucket { - if m != nil { - return m.Bucket - } - return nil -} - -type BucketListRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Cursor []byte `protobuf:"bytes,1,opt,name=cursor,proto3" json:"cursor,omitempty"` - Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` - Direction int32 `protobuf:"varint,3,opt,name=direction,proto3" json:"direction,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketListRequest) Reset() { *m = BucketListRequest{} } -func (m *BucketListRequest) String() string { return proto.CompactTextString(m) } -func (*BucketListRequest) ProtoMessage() {} -func (*BucketListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{9} -} -func (m *BucketListRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketListRequest.Unmarshal(m, b) -} -func (m *BucketListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketListRequest.Marshal(b, m, deterministic) -} -func (m *BucketListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketListRequest.Merge(m, src) -} -func (m *BucketListRequest) XXX_Size() int { - return xxx_messageInfo_BucketListRequest.Size(m) -} -func (m *BucketListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BucketListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketListRequest proto.InternalMessageInfo - -func (m *BucketListRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BucketListRequest) GetCursor() []byte { - if m != nil { - return m.Cursor - } - return nil -} - -func (m *BucketListRequest) GetLimit() int32 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *BucketListRequest) GetDirection() int32 { - if m != nil { - return m.Direction - } - return 0 -} - -type BucketListResponse struct { - Items []*BucketListItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` - More bool `protobuf:"varint,2,opt,name=more,proto3" json:"more,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketListResponse) Reset() { *m = BucketListResponse{} } -func (m *BucketListResponse) String() string { return proto.CompactTextString(m) } -func (*BucketListResponse) ProtoMessage() {} -func (*BucketListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{10} -} -func (m *BucketListResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketListResponse.Unmarshal(m, b) -} -func (m *BucketListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketListResponse.Marshal(b, m, deterministic) -} -func (m *BucketListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketListResponse.Merge(m, src) -} -func (m *BucketListResponse) XXX_Size() int { - return xxx_messageInfo_BucketListResponse.Size(m) -} -func (m *BucketListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BucketListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketListResponse proto.InternalMessageInfo - -func (m *BucketListResponse) GetItems() []*BucketListItem { - if m != nil { - return m.Items - } - return nil -} - -func (m *BucketListResponse) GetMore() bool { - if m != nil { - return m.More - } - return false -} - -type BucketSetAttributionRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - PartnerId []byte `protobuf:"bytes,2,opt,name=partner_id,json=partnerId,proto3" json:"partner_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketSetAttributionRequest) Reset() { *m = BucketSetAttributionRequest{} } -func (m *BucketSetAttributionRequest) String() string { return proto.CompactTextString(m) } -func (*BucketSetAttributionRequest) ProtoMessage() {} -func (*BucketSetAttributionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{11} -} -func (m *BucketSetAttributionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketSetAttributionRequest.Unmarshal(m, b) -} -func (m *BucketSetAttributionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketSetAttributionRequest.Marshal(b, m, deterministic) -} -func (m *BucketSetAttributionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketSetAttributionRequest.Merge(m, src) -} -func (m *BucketSetAttributionRequest) XXX_Size() int { - return xxx_messageInfo_BucketSetAttributionRequest.Size(m) -} -func (m *BucketSetAttributionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BucketSetAttributionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketSetAttributionRequest proto.InternalMessageInfo - -func (m *BucketSetAttributionRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BucketSetAttributionRequest) GetName() []byte { - if m != nil { - return m.Name - } - return nil -} - -func (m *BucketSetAttributionRequest) GetPartnerId() []byte { - if m != nil { - return m.PartnerId - } - return nil -} - -type BucketSetAttributionResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BucketSetAttributionResponse) Reset() { *m = BucketSetAttributionResponse{} } -func (m *BucketSetAttributionResponse) String() string { return proto.CompactTextString(m) } -func (*BucketSetAttributionResponse) ProtoMessage() {} -func (*BucketSetAttributionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{12} -} -func (m *BucketSetAttributionResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BucketSetAttributionResponse.Unmarshal(m, b) -} -func (m *BucketSetAttributionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BucketSetAttributionResponse.Marshal(b, m, deterministic) -} -func (m *BucketSetAttributionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BucketSetAttributionResponse.Merge(m, src) -} -func (m *BucketSetAttributionResponse) XXX_Size() int { - return xxx_messageInfo_BucketSetAttributionResponse.Size(m) -} -func (m *BucketSetAttributionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BucketSetAttributionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BucketSetAttributionResponse proto.InternalMessageInfo - -type AddressedOrderLimit struct { - Limit *OrderLimit `protobuf:"bytes,1,opt,name=limit,proto3" json:"limit,omitempty"` - StorageNodeAddress *NodeAddress `protobuf:"bytes,2,opt,name=storage_node_address,json=storageNodeAddress,proto3" json:"storage_node_address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AddressedOrderLimit) Reset() { *m = AddressedOrderLimit{} } -func (m *AddressedOrderLimit) String() string { return proto.CompactTextString(m) } -func (*AddressedOrderLimit) ProtoMessage() {} -func (*AddressedOrderLimit) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{13} -} -func (m *AddressedOrderLimit) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddressedOrderLimit.Unmarshal(m, b) -} -func (m *AddressedOrderLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddressedOrderLimit.Marshal(b, m, deterministic) -} -func (m *AddressedOrderLimit) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddressedOrderLimit.Merge(m, src) -} -func (m *AddressedOrderLimit) XXX_Size() int { - return xxx_messageInfo_AddressedOrderLimit.Size(m) -} -func (m *AddressedOrderLimit) XXX_DiscardUnknown() { - xxx_messageInfo_AddressedOrderLimit.DiscardUnknown(m) -} - -var xxx_messageInfo_AddressedOrderLimit proto.InternalMessageInfo - -func (m *AddressedOrderLimit) GetLimit() *OrderLimit { - if m != nil { - return m.Limit - } - return nil -} - -func (m *AddressedOrderLimit) GetStorageNodeAddress() *NodeAddress { - if m != nil { - return m.StorageNodeAddress - } - return nil -} - -type ProjectInfoRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ProjectInfoRequest) Reset() { *m = ProjectInfoRequest{} } -func (m *ProjectInfoRequest) String() string { return proto.CompactTextString(m) } -func (*ProjectInfoRequest) ProtoMessage() {} -func (*ProjectInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{14} -} -func (m *ProjectInfoRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ProjectInfoRequest.Unmarshal(m, b) -} -func (m *ProjectInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ProjectInfoRequest.Marshal(b, m, deterministic) -} -func (m *ProjectInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProjectInfoRequest.Merge(m, src) -} -func (m *ProjectInfoRequest) XXX_Size() int { - return xxx_messageInfo_ProjectInfoRequest.Size(m) -} -func (m *ProjectInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ProjectInfoRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ProjectInfoRequest proto.InternalMessageInfo - -func (m *ProjectInfoRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -type ProjectInfoResponse struct { - ProjectSalt []byte `protobuf:"bytes,1,opt,name=project_salt,json=projectSalt,proto3" json:"project_salt,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ProjectInfoResponse) Reset() { *m = ProjectInfoResponse{} } -func (m *ProjectInfoResponse) String() string { return proto.CompactTextString(m) } -func (*ProjectInfoResponse) ProtoMessage() {} -func (*ProjectInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{15} -} -func (m *ProjectInfoResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ProjectInfoResponse.Unmarshal(m, b) -} -func (m *ProjectInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ProjectInfoResponse.Marshal(b, m, deterministic) -} -func (m *ProjectInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProjectInfoResponse.Merge(m, src) -} -func (m *ProjectInfoResponse) XXX_Size() int { - return xxx_messageInfo_ProjectInfoResponse.Size(m) -} -func (m *ProjectInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ProjectInfoResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ProjectInfoResponse proto.InternalMessageInfo - -func (m *ProjectInfoResponse) GetProjectSalt() []byte { - if m != nil { - return m.ProjectSalt - } - return nil -} - -type Object struct { - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - Status Object_Status `protobuf:"varint,4,opt,name=status,proto3,enum=metainfo.Object_Status" json:"status,omitempty"` - StreamId StreamID `protobuf:"bytes,5,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - CreatedAt time.Time `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` - StatusAt time.Time `protobuf:"bytes,7,opt,name=status_at,json=statusAt,proto3,stdtime" json:"status_at"` - ExpiresAt time.Time `protobuf:"bytes,8,opt,name=expires_at,json=expiresAt,proto3,stdtime" json:"expires_at"` - EncryptedMetadataNonce Nonce `protobuf:"bytes,9,opt,name=encrypted_metadata_nonce,json=encryptedMetadataNonce,proto3,customtype=Nonce" json:"encrypted_metadata_nonce"` - EncryptedMetadata []byte `protobuf:"bytes,10,opt,name=encrypted_metadata,json=encryptedMetadata,proto3" json:"encrypted_metadata,omitempty"` - FixedSegmentSize int64 `protobuf:"varint,11,opt,name=fixed_segment_size,json=fixedSegmentSize,proto3" json:"fixed_segment_size,omitempty"` - RedundancyScheme *RedundancyScheme `protobuf:"bytes,12,opt,name=redundancy_scheme,json=redundancyScheme,proto3" json:"redundancy_scheme,omitempty"` - EncryptionParameters *EncryptionParameters `protobuf:"bytes,13,opt,name=encryption_parameters,json=encryptionParameters,proto3" json:"encryption_parameters,omitempty"` - TotalSize int64 `protobuf:"varint,14,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` - InlineSize int64 `protobuf:"varint,15,opt,name=inline_size,json=inlineSize,proto3" json:"inline_size,omitempty"` - RemoteSize int64 `protobuf:"varint,16,opt,name=remote_size,json=remoteSize,proto3" json:"remote_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Object) Reset() { *m = Object{} } -func (m *Object) String() string { return proto.CompactTextString(m) } -func (*Object) ProtoMessage() {} -func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{16} -} -func (m *Object) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Object.Unmarshal(m, b) -} -func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Object.Marshal(b, m, deterministic) -} -func (m *Object) XXX_Merge(src proto.Message) { - xxx_messageInfo_Object.Merge(m, src) -} -func (m *Object) XXX_Size() int { - return xxx_messageInfo_Object.Size(m) -} -func (m *Object) XXX_DiscardUnknown() { - xxx_messageInfo_Object.DiscardUnknown(m) -} - -var xxx_messageInfo_Object proto.InternalMessageInfo - -func (m *Object) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *Object) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *Object) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *Object) GetStatus() Object_Status { - if m != nil { - return m.Status - } - return Object_INVALID -} - -func (m *Object) GetCreatedAt() time.Time { - if m != nil { - return m.CreatedAt - } - return time.Time{} -} - -func (m *Object) GetStatusAt() time.Time { - if m != nil { - return m.StatusAt - } - return time.Time{} -} - -func (m *Object) GetExpiresAt() time.Time { - if m != nil { - return m.ExpiresAt - } - return time.Time{} -} - -func (m *Object) GetEncryptedMetadata() []byte { - if m != nil { - return m.EncryptedMetadata - } - return nil -} - -func (m *Object) GetFixedSegmentSize() int64 { - if m != nil { - return m.FixedSegmentSize - } - return 0 -} - -func (m *Object) GetRedundancyScheme() *RedundancyScheme { - if m != nil { - return m.RedundancyScheme - } - return nil -} - -func (m *Object) GetEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.EncryptionParameters - } - return nil -} - -func (m *Object) GetTotalSize() int64 { - if m != nil { - return m.TotalSize - } - return 0 -} - -func (m *Object) GetInlineSize() int64 { - if m != nil { - return m.InlineSize - } - return 0 -} - -func (m *Object) GetRemoteSize() int64 { - if m != nil { - return m.RemoteSize - } - return 0 -} - -type ObjectBeginRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - ExpiresAt time.Time `protobuf:"bytes,4,opt,name=expires_at,json=expiresAt,proto3,stdtime" json:"expires_at"` - RedundancyScheme *RedundancyScheme `protobuf:"bytes,7,opt,name=redundancy_scheme,json=redundancyScheme,proto3" json:"redundancy_scheme,omitempty"` - EncryptionParameters *EncryptionParameters `protobuf:"bytes,8,opt,name=encryption_parameters,json=encryptionParameters,proto3" json:"encryption_parameters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectBeginRequest) Reset() { *m = ObjectBeginRequest{} } -func (m *ObjectBeginRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectBeginRequest) ProtoMessage() {} -func (*ObjectBeginRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{17} -} -func (m *ObjectBeginRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectBeginRequest.Unmarshal(m, b) -} -func (m *ObjectBeginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectBeginRequest.Marshal(b, m, deterministic) -} -func (m *ObjectBeginRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectBeginRequest.Merge(m, src) -} -func (m *ObjectBeginRequest) XXX_Size() int { - return xxx_messageInfo_ObjectBeginRequest.Size(m) -} -func (m *ObjectBeginRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectBeginRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectBeginRequest proto.InternalMessageInfo - -func (m *ObjectBeginRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *ObjectBeginRequest) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *ObjectBeginRequest) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *ObjectBeginRequest) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *ObjectBeginRequest) GetExpiresAt() time.Time { - if m != nil { - return m.ExpiresAt - } - return time.Time{} -} - -func (m *ObjectBeginRequest) GetRedundancyScheme() *RedundancyScheme { - if m != nil { - return m.RedundancyScheme - } - return nil -} - -func (m *ObjectBeginRequest) GetEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.EncryptionParameters - } - return nil -} - -type ObjectBeginResponse struct { - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - StreamId StreamID `protobuf:"bytes,4,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - RedundancyScheme *RedundancyScheme `protobuf:"bytes,5,opt,name=redundancy_scheme,json=redundancyScheme,proto3" json:"redundancy_scheme,omitempty"` - EncryptionParameters *EncryptionParameters `protobuf:"bytes,6,opt,name=encryption_parameters,json=encryptionParameters,proto3" json:"encryption_parameters,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectBeginResponse) Reset() { *m = ObjectBeginResponse{} } -func (m *ObjectBeginResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectBeginResponse) ProtoMessage() {} -func (*ObjectBeginResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{18} -} -func (m *ObjectBeginResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectBeginResponse.Unmarshal(m, b) -} -func (m *ObjectBeginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectBeginResponse.Marshal(b, m, deterministic) -} -func (m *ObjectBeginResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectBeginResponse.Merge(m, src) -} -func (m *ObjectBeginResponse) XXX_Size() int { - return xxx_messageInfo_ObjectBeginResponse.Size(m) -} -func (m *ObjectBeginResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectBeginResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectBeginResponse proto.InternalMessageInfo - -func (m *ObjectBeginResponse) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *ObjectBeginResponse) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *ObjectBeginResponse) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *ObjectBeginResponse) GetRedundancyScheme() *RedundancyScheme { - if m != nil { - return m.RedundancyScheme - } - return nil -} - -func (m *ObjectBeginResponse) GetEncryptionParameters() *EncryptionParameters { - if m != nil { - return m.EncryptionParameters - } - return nil -} - -type ObjectCommitRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - EncryptedMetadataNonce Nonce `protobuf:"bytes,2,opt,name=encrypted_metadata_nonce,json=encryptedMetadataNonce,proto3,customtype=Nonce" json:"encrypted_metadata_nonce"` - EncryptedMetadata []byte `protobuf:"bytes,3,opt,name=encrypted_metadata,json=encryptedMetadata,proto3" json:"encrypted_metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectCommitRequest) Reset() { *m = ObjectCommitRequest{} } -func (m *ObjectCommitRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectCommitRequest) ProtoMessage() {} -func (*ObjectCommitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{19} -} -func (m *ObjectCommitRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectCommitRequest.Unmarshal(m, b) -} -func (m *ObjectCommitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectCommitRequest.Marshal(b, m, deterministic) -} -func (m *ObjectCommitRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectCommitRequest.Merge(m, src) -} -func (m *ObjectCommitRequest) XXX_Size() int { - return xxx_messageInfo_ObjectCommitRequest.Size(m) -} -func (m *ObjectCommitRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectCommitRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectCommitRequest proto.InternalMessageInfo - -func (m *ObjectCommitRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *ObjectCommitRequest) GetEncryptedMetadata() []byte { - if m != nil { - return m.EncryptedMetadata - } - return nil -} - -type ObjectCommitResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectCommitResponse) Reset() { *m = ObjectCommitResponse{} } -func (m *ObjectCommitResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectCommitResponse) ProtoMessage() {} -func (*ObjectCommitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{20} -} -func (m *ObjectCommitResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectCommitResponse.Unmarshal(m, b) -} -func (m *ObjectCommitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectCommitResponse.Marshal(b, m, deterministic) -} -func (m *ObjectCommitResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectCommitResponse.Merge(m, src) -} -func (m *ObjectCommitResponse) XXX_Size() int { - return xxx_messageInfo_ObjectCommitResponse.Size(m) -} -func (m *ObjectCommitResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectCommitResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectCommitResponse proto.InternalMessageInfo - -type ObjectGetRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectGetRequest) Reset() { *m = ObjectGetRequest{} } -func (m *ObjectGetRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectGetRequest) ProtoMessage() {} -func (*ObjectGetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{21} -} -func (m *ObjectGetRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectGetRequest.Unmarshal(m, b) -} -func (m *ObjectGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectGetRequest.Marshal(b, m, deterministic) -} -func (m *ObjectGetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectGetRequest.Merge(m, src) -} -func (m *ObjectGetRequest) XXX_Size() int { - return xxx_messageInfo_ObjectGetRequest.Size(m) -} -func (m *ObjectGetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectGetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectGetRequest proto.InternalMessageInfo - -func (m *ObjectGetRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *ObjectGetRequest) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *ObjectGetRequest) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *ObjectGetRequest) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -type ObjectGetResponse struct { - Object *Object `protobuf:"bytes,1,opt,name=object,proto3" json:"object,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectGetResponse) Reset() { *m = ObjectGetResponse{} } -func (m *ObjectGetResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectGetResponse) ProtoMessage() {} -func (*ObjectGetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{22} -} -func (m *ObjectGetResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectGetResponse.Unmarshal(m, b) -} -func (m *ObjectGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectGetResponse.Marshal(b, m, deterministic) -} -func (m *ObjectGetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectGetResponse.Merge(m, src) -} -func (m *ObjectGetResponse) XXX_Size() int { - return xxx_messageInfo_ObjectGetResponse.Size(m) -} -func (m *ObjectGetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectGetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectGetResponse proto.InternalMessageInfo - -func (m *ObjectGetResponse) GetObject() *Object { - if m != nil { - return m.Object - } - return nil -} - -type ObjectListRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPrefix []byte `protobuf:"bytes,2,opt,name=encrypted_prefix,json=encryptedPrefix,proto3" json:"encrypted_prefix,omitempty"` - EncryptedCursor []byte `protobuf:"bytes,3,opt,name=encrypted_cursor,json=encryptedCursor,proto3" json:"encrypted_cursor,omitempty"` - Recursive bool `protobuf:"varint,4,opt,name=recursive,proto3" json:"recursive,omitempty"` - Limit int32 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"` - ObjectIncludes *ObjectListItemIncludes `protobuf:"bytes,6,opt,name=object_includes,json=objectIncludes,proto3" json:"object_includes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectListRequest) Reset() { *m = ObjectListRequest{} } -func (m *ObjectListRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectListRequest) ProtoMessage() {} -func (*ObjectListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{23} -} -func (m *ObjectListRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectListRequest.Unmarshal(m, b) -} -func (m *ObjectListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectListRequest.Marshal(b, m, deterministic) -} -func (m *ObjectListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectListRequest.Merge(m, src) -} -func (m *ObjectListRequest) XXX_Size() int { - return xxx_messageInfo_ObjectListRequest.Size(m) -} -func (m *ObjectListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectListRequest proto.InternalMessageInfo - -func (m *ObjectListRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *ObjectListRequest) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *ObjectListRequest) GetEncryptedPrefix() []byte { - if m != nil { - return m.EncryptedPrefix - } - return nil -} - -func (m *ObjectListRequest) GetEncryptedCursor() []byte { - if m != nil { - return m.EncryptedCursor - } - return nil -} - -func (m *ObjectListRequest) GetRecursive() bool { - if m != nil { - return m.Recursive - } - return false -} - -func (m *ObjectListRequest) GetLimit() int32 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *ObjectListRequest) GetObjectIncludes() *ObjectListItemIncludes { - if m != nil { - return m.ObjectIncludes - } - return nil -} - -type ObjectListResponse struct { - Items []*ObjectListItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` - More bool `protobuf:"varint,2,opt,name=more,proto3" json:"more,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectListResponse) Reset() { *m = ObjectListResponse{} } -func (m *ObjectListResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectListResponse) ProtoMessage() {} -func (*ObjectListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{24} -} -func (m *ObjectListResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectListResponse.Unmarshal(m, b) -} -func (m *ObjectListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectListResponse.Marshal(b, m, deterministic) -} -func (m *ObjectListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectListResponse.Merge(m, src) -} -func (m *ObjectListResponse) XXX_Size() int { - return xxx_messageInfo_ObjectListResponse.Size(m) -} -func (m *ObjectListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectListResponse proto.InternalMessageInfo - -func (m *ObjectListResponse) GetItems() []*ObjectListItem { - if m != nil { - return m.Items - } - return nil -} - -func (m *ObjectListResponse) GetMore() bool { - if m != nil { - return m.More - } - return false -} - -type ObjectListItem struct { - EncryptedPath []byte `protobuf:"bytes,1,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - Status Object_Status `protobuf:"varint,3,opt,name=status,proto3,enum=metainfo.Object_Status" json:"status,omitempty"` - CreatedAt time.Time `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` - StatusAt time.Time `protobuf:"bytes,5,opt,name=status_at,json=statusAt,proto3,stdtime" json:"status_at"` - ExpiresAt time.Time `protobuf:"bytes,6,opt,name=expires_at,json=expiresAt,proto3,stdtime" json:"expires_at"` - EncryptedMetadataNonce Nonce `protobuf:"bytes,7,opt,name=encrypted_metadata_nonce,json=encryptedMetadataNonce,proto3,customtype=Nonce" json:"encrypted_metadata_nonce"` - EncryptedMetadata []byte `protobuf:"bytes,8,opt,name=encrypted_metadata,json=encryptedMetadata,proto3" json:"encrypted_metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectListItem) Reset() { *m = ObjectListItem{} } -func (m *ObjectListItem) String() string { return proto.CompactTextString(m) } -func (*ObjectListItem) ProtoMessage() {} -func (*ObjectListItem) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{25} -} -func (m *ObjectListItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectListItem.Unmarshal(m, b) -} -func (m *ObjectListItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectListItem.Marshal(b, m, deterministic) -} -func (m *ObjectListItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectListItem.Merge(m, src) -} -func (m *ObjectListItem) XXX_Size() int { - return xxx_messageInfo_ObjectListItem.Size(m) -} -func (m *ObjectListItem) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectListItem.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectListItem proto.InternalMessageInfo - -func (m *ObjectListItem) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *ObjectListItem) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *ObjectListItem) GetStatus() Object_Status { - if m != nil { - return m.Status - } - return Object_INVALID -} - -func (m *ObjectListItem) GetCreatedAt() time.Time { - if m != nil { - return m.CreatedAt - } - return time.Time{} -} - -func (m *ObjectListItem) GetStatusAt() time.Time { - if m != nil { - return m.StatusAt - } - return time.Time{} -} - -func (m *ObjectListItem) GetExpiresAt() time.Time { - if m != nil { - return m.ExpiresAt - } - return time.Time{} -} - -func (m *ObjectListItem) GetEncryptedMetadata() []byte { - if m != nil { - return m.EncryptedMetadata - } - return nil -} - -type ObjectListItemIncludes struct { - Metadata bool `protobuf:"varint,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectListItemIncludes) Reset() { *m = ObjectListItemIncludes{} } -func (m *ObjectListItemIncludes) String() string { return proto.CompactTextString(m) } -func (*ObjectListItemIncludes) ProtoMessage() {} -func (*ObjectListItemIncludes) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{26} -} -func (m *ObjectListItemIncludes) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectListItemIncludes.Unmarshal(m, b) -} -func (m *ObjectListItemIncludes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectListItemIncludes.Marshal(b, m, deterministic) -} -func (m *ObjectListItemIncludes) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectListItemIncludes.Merge(m, src) -} -func (m *ObjectListItemIncludes) XXX_Size() int { - return xxx_messageInfo_ObjectListItemIncludes.Size(m) -} -func (m *ObjectListItemIncludes) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectListItemIncludes.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectListItemIncludes proto.InternalMessageInfo - -func (m *ObjectListItemIncludes) GetMetadata() bool { - if m != nil { - return m.Metadata - } - return false -} - -type ObjectBeginDeleteRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectBeginDeleteRequest) Reset() { *m = ObjectBeginDeleteRequest{} } -func (m *ObjectBeginDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectBeginDeleteRequest) ProtoMessage() {} -func (*ObjectBeginDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{27} -} -func (m *ObjectBeginDeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectBeginDeleteRequest.Unmarshal(m, b) -} -func (m *ObjectBeginDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectBeginDeleteRequest.Marshal(b, m, deterministic) -} -func (m *ObjectBeginDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectBeginDeleteRequest.Merge(m, src) -} -func (m *ObjectBeginDeleteRequest) XXX_Size() int { - return xxx_messageInfo_ObjectBeginDeleteRequest.Size(m) -} -func (m *ObjectBeginDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectBeginDeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectBeginDeleteRequest proto.InternalMessageInfo - -func (m *ObjectBeginDeleteRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *ObjectBeginDeleteRequest) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *ObjectBeginDeleteRequest) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *ObjectBeginDeleteRequest) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -type ObjectBeginDeleteResponse struct { - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - Object *Object `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectBeginDeleteResponse) Reset() { *m = ObjectBeginDeleteResponse{} } -func (m *ObjectBeginDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectBeginDeleteResponse) ProtoMessage() {} -func (*ObjectBeginDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{28} -} -func (m *ObjectBeginDeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectBeginDeleteResponse.Unmarshal(m, b) -} -func (m *ObjectBeginDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectBeginDeleteResponse.Marshal(b, m, deterministic) -} -func (m *ObjectBeginDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectBeginDeleteResponse.Merge(m, src) -} -func (m *ObjectBeginDeleteResponse) XXX_Size() int { - return xxx_messageInfo_ObjectBeginDeleteResponse.Size(m) -} -func (m *ObjectBeginDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectBeginDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectBeginDeleteResponse proto.InternalMessageInfo - -func (m *ObjectBeginDeleteResponse) GetObject() *Object { - if m != nil { - return m.Object - } - return nil -} - -type ObjectFinishDeleteRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectFinishDeleteRequest) Reset() { *m = ObjectFinishDeleteRequest{} } -func (m *ObjectFinishDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectFinishDeleteRequest) ProtoMessage() {} -func (*ObjectFinishDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{29} -} -func (m *ObjectFinishDeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectFinishDeleteRequest.Unmarshal(m, b) -} -func (m *ObjectFinishDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectFinishDeleteRequest.Marshal(b, m, deterministic) -} -func (m *ObjectFinishDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectFinishDeleteRequest.Merge(m, src) -} -func (m *ObjectFinishDeleteRequest) XXX_Size() int { - return xxx_messageInfo_ObjectFinishDeleteRequest.Size(m) -} -func (m *ObjectFinishDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectFinishDeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectFinishDeleteRequest proto.InternalMessageInfo - -func (m *ObjectFinishDeleteRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -type ObjectFinishDeleteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ObjectFinishDeleteResponse) Reset() { *m = ObjectFinishDeleteResponse{} } -func (m *ObjectFinishDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectFinishDeleteResponse) ProtoMessage() {} -func (*ObjectFinishDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{30} -} -func (m *ObjectFinishDeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ObjectFinishDeleteResponse.Unmarshal(m, b) -} -func (m *ObjectFinishDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ObjectFinishDeleteResponse.Marshal(b, m, deterministic) -} -func (m *ObjectFinishDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectFinishDeleteResponse.Merge(m, src) -} -func (m *ObjectFinishDeleteResponse) XXX_Size() int { - return xxx_messageInfo_ObjectFinishDeleteResponse.Size(m) -} -func (m *ObjectFinishDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectFinishDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectFinishDeleteResponse proto.InternalMessageInfo - -type SatStreamID struct { - Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` - EncryptedPath []byte `protobuf:"bytes,2,opt,name=encrypted_path,json=encryptedPath,proto3" json:"encrypted_path,omitempty"` - Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - Redundancy *RedundancyScheme `protobuf:"bytes,4,opt,name=redundancy,proto3" json:"redundancy,omitempty"` - CreationDate time.Time `protobuf:"bytes,5,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"` - ExpirationDate time.Time `protobuf:"bytes,6,opt,name=expiration_date,json=expirationDate,proto3,stdtime" json:"expiration_date"` - SatelliteSignature []byte `protobuf:"bytes,9,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SatStreamID) Reset() { *m = SatStreamID{} } -func (m *SatStreamID) String() string { return proto.CompactTextString(m) } -func (*SatStreamID) ProtoMessage() {} -func (*SatStreamID) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{31} -} -func (m *SatStreamID) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SatStreamID.Unmarshal(m, b) -} -func (m *SatStreamID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SatStreamID.Marshal(b, m, deterministic) -} -func (m *SatStreamID) XXX_Merge(src proto.Message) { - xxx_messageInfo_SatStreamID.Merge(m, src) -} -func (m *SatStreamID) XXX_Size() int { - return xxx_messageInfo_SatStreamID.Size(m) -} -func (m *SatStreamID) XXX_DiscardUnknown() { - xxx_messageInfo_SatStreamID.DiscardUnknown(m) -} - -var xxx_messageInfo_SatStreamID proto.InternalMessageInfo - -func (m *SatStreamID) GetBucket() []byte { - if m != nil { - return m.Bucket - } - return nil -} - -func (m *SatStreamID) GetEncryptedPath() []byte { - if m != nil { - return m.EncryptedPath - } - return nil -} - -func (m *SatStreamID) GetVersion() int32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *SatStreamID) GetRedundancy() *RedundancyScheme { - if m != nil { - return m.Redundancy - } - return nil -} - -func (m *SatStreamID) GetCreationDate() time.Time { - if m != nil { - return m.CreationDate - } - return time.Time{} -} - -func (m *SatStreamID) GetExpirationDate() time.Time { - if m != nil { - return m.ExpirationDate - } - return time.Time{} -} - -func (m *SatStreamID) GetSatelliteSignature() []byte { - if m != nil { - return m.SatelliteSignature - } - return nil -} - -type Segment struct { - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - Position *SegmentPosition `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"` - EncryptedKeyNonce Nonce `protobuf:"bytes,3,opt,name=encrypted_key_nonce,json=encryptedKeyNonce,proto3,customtype=Nonce" json:"encrypted_key_nonce"` - EncryptedKey []byte `protobuf:"bytes,4,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` - SizeEncryptedData int64 `protobuf:"varint,5,opt,name=size_encrypted_data,json=sizeEncryptedData,proto3" json:"size_encrypted_data,omitempty"` - EncryptedInlineData []byte `protobuf:"bytes,6,opt,name=encrypted_inline_data,json=encryptedInlineData,proto3" json:"encrypted_inline_data,omitempty"` - Pieces []*Piece `protobuf:"bytes,7,rep,name=pieces,proto3" json:"pieces,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Segment) Reset() { *m = Segment{} } -func (m *Segment) String() string { return proto.CompactTextString(m) } -func (*Segment) ProtoMessage() {} -func (*Segment) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{32} -} -func (m *Segment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Segment.Unmarshal(m, b) -} -func (m *Segment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Segment.Marshal(b, m, deterministic) -} -func (m *Segment) XXX_Merge(src proto.Message) { - xxx_messageInfo_Segment.Merge(m, src) -} -func (m *Segment) XXX_Size() int { - return xxx_messageInfo_Segment.Size(m) -} -func (m *Segment) XXX_DiscardUnknown() { - xxx_messageInfo_Segment.DiscardUnknown(m) -} - -var xxx_messageInfo_Segment proto.InternalMessageInfo - -func (m *Segment) GetPosition() *SegmentPosition { - if m != nil { - return m.Position - } - return nil -} - -func (m *Segment) GetEncryptedKey() []byte { - if m != nil { - return m.EncryptedKey - } - return nil -} - -func (m *Segment) GetSizeEncryptedData() int64 { - if m != nil { - return m.SizeEncryptedData - } - return 0 -} - -func (m *Segment) GetEncryptedInlineData() []byte { - if m != nil { - return m.EncryptedInlineData - } - return nil -} - -func (m *Segment) GetPieces() []*Piece { - if m != nil { - return m.Pieces - } - return nil -} - -type Piece struct { - PieceNum int32 `protobuf:"varint,1,opt,name=piece_num,json=pieceNum,proto3" json:"piece_num,omitempty"` - Node NodeID `protobuf:"bytes,2,opt,name=node,proto3,customtype=NodeID" json:"node"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Piece) Reset() { *m = Piece{} } -func (m *Piece) String() string { return proto.CompactTextString(m) } -func (*Piece) ProtoMessage() {} -func (*Piece) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{33} -} -func (m *Piece) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Piece.Unmarshal(m, b) -} -func (m *Piece) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Piece.Marshal(b, m, deterministic) -} -func (m *Piece) XXX_Merge(src proto.Message) { - xxx_messageInfo_Piece.Merge(m, src) -} -func (m *Piece) XXX_Size() int { - return xxx_messageInfo_Piece.Size(m) -} -func (m *Piece) XXX_DiscardUnknown() { - xxx_messageInfo_Piece.DiscardUnknown(m) -} - -var xxx_messageInfo_Piece proto.InternalMessageInfo - -func (m *Piece) GetPieceNum() int32 { - if m != nil { - return m.PieceNum - } - return 0 -} - -type SegmentPosition struct { - PartNumber int32 `protobuf:"varint,1,opt,name=part_number,json=partNumber,proto3" json:"part_number,omitempty"` - Index int32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentPosition) Reset() { *m = SegmentPosition{} } -func (m *SegmentPosition) String() string { return proto.CompactTextString(m) } -func (*SegmentPosition) ProtoMessage() {} -func (*SegmentPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{34} -} -func (m *SegmentPosition) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentPosition.Unmarshal(m, b) -} -func (m *SegmentPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentPosition.Marshal(b, m, deterministic) -} -func (m *SegmentPosition) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentPosition.Merge(m, src) -} -func (m *SegmentPosition) XXX_Size() int { - return xxx_messageInfo_SegmentPosition.Size(m) -} -func (m *SegmentPosition) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentPosition.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentPosition proto.InternalMessageInfo - -func (m *SegmentPosition) GetPartNumber() int32 { - if m != nil { - return m.PartNumber - } - return 0 -} - -func (m *SegmentPosition) GetIndex() int32 { - if m != nil { - return m.Index - } - return 0 -} - -type SegmentBeginRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - Position *SegmentPosition `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"` - MaxOrderLimit int64 `protobuf:"varint,3,opt,name=max_order_limit,json=maxOrderLimit,proto3" json:"max_order_limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentBeginRequest) Reset() { *m = SegmentBeginRequest{} } -func (m *SegmentBeginRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentBeginRequest) ProtoMessage() {} -func (*SegmentBeginRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{35} -} -func (m *SegmentBeginRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentBeginRequest.Unmarshal(m, b) -} -func (m *SegmentBeginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentBeginRequest.Marshal(b, m, deterministic) -} -func (m *SegmentBeginRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentBeginRequest.Merge(m, src) -} -func (m *SegmentBeginRequest) XXX_Size() int { - return xxx_messageInfo_SegmentBeginRequest.Size(m) -} -func (m *SegmentBeginRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentBeginRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentBeginRequest proto.InternalMessageInfo - -func (m *SegmentBeginRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentBeginRequest) GetPosition() *SegmentPosition { - if m != nil { - return m.Position - } - return nil -} - -func (m *SegmentBeginRequest) GetMaxOrderLimit() int64 { - if m != nil { - return m.MaxOrderLimit - } - return 0 -} - -type SegmentBeginResponse struct { - SegmentId SegmentID `protobuf:"bytes,1,opt,name=segment_id,json=segmentId,proto3,customtype=SegmentID" json:"segment_id"` - AddressedLimits []*AddressedOrderLimit `protobuf:"bytes,2,rep,name=addressed_limits,json=addressedLimits,proto3" json:"addressed_limits,omitempty"` - PrivateKey PiecePrivateKey `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3,customtype=PiecePrivateKey" json:"private_key"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentBeginResponse) Reset() { *m = SegmentBeginResponse{} } -func (m *SegmentBeginResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentBeginResponse) ProtoMessage() {} -func (*SegmentBeginResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{36} -} -func (m *SegmentBeginResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentBeginResponse.Unmarshal(m, b) -} -func (m *SegmentBeginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentBeginResponse.Marshal(b, m, deterministic) -} -func (m *SegmentBeginResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentBeginResponse.Merge(m, src) -} -func (m *SegmentBeginResponse) XXX_Size() int { - return xxx_messageInfo_SegmentBeginResponse.Size(m) -} -func (m *SegmentBeginResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentBeginResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentBeginResponse proto.InternalMessageInfo - -func (m *SegmentBeginResponse) GetAddressedLimits() []*AddressedOrderLimit { - if m != nil { - return m.AddressedLimits - } - return nil -} - -type SegmentCommitRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - SegmentId SegmentID `protobuf:"bytes,1,opt,name=segment_id,json=segmentId,proto3,customtype=SegmentID" json:"segment_id"` - EncryptedKeyNonce Nonce `protobuf:"bytes,2,opt,name=encrypted_key_nonce,json=encryptedKeyNonce,proto3,customtype=Nonce" json:"encrypted_key_nonce"` - EncryptedKey []byte `protobuf:"bytes,3,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` - SizeEncryptedData int64 `protobuf:"varint,4,opt,name=size_encrypted_data,json=sizeEncryptedData,proto3" json:"size_encrypted_data,omitempty"` - UploadResult []*SegmentPieceUploadResult `protobuf:"bytes,5,rep,name=upload_result,json=uploadResult,proto3" json:"upload_result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentCommitRequest) Reset() { *m = SegmentCommitRequest{} } -func (m *SegmentCommitRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentCommitRequest) ProtoMessage() {} -func (*SegmentCommitRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{37} -} -func (m *SegmentCommitRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentCommitRequest.Unmarshal(m, b) -} -func (m *SegmentCommitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentCommitRequest.Marshal(b, m, deterministic) -} -func (m *SegmentCommitRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentCommitRequest.Merge(m, src) -} -func (m *SegmentCommitRequest) XXX_Size() int { - return xxx_messageInfo_SegmentCommitRequest.Size(m) -} -func (m *SegmentCommitRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentCommitRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentCommitRequest proto.InternalMessageInfo - -func (m *SegmentCommitRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentCommitRequest) GetEncryptedKey() []byte { - if m != nil { - return m.EncryptedKey - } - return nil -} - -func (m *SegmentCommitRequest) GetSizeEncryptedData() int64 { - if m != nil { - return m.SizeEncryptedData - } - return 0 -} - -func (m *SegmentCommitRequest) GetUploadResult() []*SegmentPieceUploadResult { - if m != nil { - return m.UploadResult - } - return nil -} - -type SegmentPieceUploadResult struct { - PieceNum int32 `protobuf:"varint,1,opt,name=piece_num,json=pieceNum,proto3" json:"piece_num,omitempty"` - NodeId NodeID `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - Hash *PieceHash `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentPieceUploadResult) Reset() { *m = SegmentPieceUploadResult{} } -func (m *SegmentPieceUploadResult) String() string { return proto.CompactTextString(m) } -func (*SegmentPieceUploadResult) ProtoMessage() {} -func (*SegmentPieceUploadResult) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{38} -} -func (m *SegmentPieceUploadResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentPieceUploadResult.Unmarshal(m, b) -} -func (m *SegmentPieceUploadResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentPieceUploadResult.Marshal(b, m, deterministic) -} -func (m *SegmentPieceUploadResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentPieceUploadResult.Merge(m, src) -} -func (m *SegmentPieceUploadResult) XXX_Size() int { - return xxx_messageInfo_SegmentPieceUploadResult.Size(m) -} -func (m *SegmentPieceUploadResult) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentPieceUploadResult.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentPieceUploadResult proto.InternalMessageInfo - -func (m *SegmentPieceUploadResult) GetPieceNum() int32 { - if m != nil { - return m.PieceNum - } - return 0 -} - -func (m *SegmentPieceUploadResult) GetHash() *PieceHash { - if m != nil { - return m.Hash - } - return nil -} - -// only for satellite use -type SatSegmentID struct { - StreamId *SatStreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` - PartNumber int32 `protobuf:"varint,2,opt,name=part_number,json=partNumber,proto3" json:"part_number,omitempty"` - Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` - // TODO we have redundancy in SatStreamID, do we need it here? - // pointerdb.RedundancyScheme redundancy = 4; - RootPieceId PieceID `protobuf:"bytes,5,opt,name=root_piece_id,json=rootPieceId,proto3,customtype=PieceID" json:"root_piece_id"` - OriginalOrderLimits []*AddressedOrderLimit `protobuf:"bytes,6,rep,name=original_order_limits,json=originalOrderLimits,proto3" json:"original_order_limits,omitempty"` - CreationDate time.Time `protobuf:"bytes,7,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"` - SatelliteSignature []byte `protobuf:"bytes,8,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SatSegmentID) Reset() { *m = SatSegmentID{} } -func (m *SatSegmentID) String() string { return proto.CompactTextString(m) } -func (*SatSegmentID) ProtoMessage() {} -func (*SatSegmentID) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{39} -} -func (m *SatSegmentID) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SatSegmentID.Unmarshal(m, b) -} -func (m *SatSegmentID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SatSegmentID.Marshal(b, m, deterministic) -} -func (m *SatSegmentID) XXX_Merge(src proto.Message) { - xxx_messageInfo_SatSegmentID.Merge(m, src) -} -func (m *SatSegmentID) XXX_Size() int { - return xxx_messageInfo_SatSegmentID.Size(m) -} -func (m *SatSegmentID) XXX_DiscardUnknown() { - xxx_messageInfo_SatSegmentID.DiscardUnknown(m) -} - -var xxx_messageInfo_SatSegmentID proto.InternalMessageInfo - -func (m *SatSegmentID) GetStreamId() *SatStreamID { - if m != nil { - return m.StreamId - } - return nil -} - -func (m *SatSegmentID) GetPartNumber() int32 { - if m != nil { - return m.PartNumber - } - return 0 -} - -func (m *SatSegmentID) GetIndex() int32 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *SatSegmentID) GetOriginalOrderLimits() []*AddressedOrderLimit { - if m != nil { - return m.OriginalOrderLimits - } - return nil -} - -func (m *SatSegmentID) GetCreationDate() time.Time { - if m != nil { - return m.CreationDate - } - return time.Time{} -} - -func (m *SatSegmentID) GetSatelliteSignature() []byte { - if m != nil { - return m.SatelliteSignature - } - return nil -} - -type SegmentCommitResponse struct { - SuccessfulPieces int32 `protobuf:"varint,1,opt,name=successful_pieces,json=successfulPieces,proto3" json:"successful_pieces,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentCommitResponse) Reset() { *m = SegmentCommitResponse{} } -func (m *SegmentCommitResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentCommitResponse) ProtoMessage() {} -func (*SegmentCommitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{40} -} -func (m *SegmentCommitResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentCommitResponse.Unmarshal(m, b) -} -func (m *SegmentCommitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentCommitResponse.Marshal(b, m, deterministic) -} -func (m *SegmentCommitResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentCommitResponse.Merge(m, src) -} -func (m *SegmentCommitResponse) XXX_Size() int { - return xxx_messageInfo_SegmentCommitResponse.Size(m) -} -func (m *SegmentCommitResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentCommitResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentCommitResponse proto.InternalMessageInfo - -func (m *SegmentCommitResponse) GetSuccessfulPieces() int32 { - if m != nil { - return m.SuccessfulPieces - } - return 0 -} - -type SegmentMakeInlineRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - Position *SegmentPosition `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"` - EncryptedKeyNonce Nonce `protobuf:"bytes,3,opt,name=encrypted_key_nonce,json=encryptedKeyNonce,proto3,customtype=Nonce" json:"encrypted_key_nonce"` - EncryptedKey []byte `protobuf:"bytes,4,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` - EncryptedInlineData []byte `protobuf:"bytes,5,opt,name=encrypted_inline_data,json=encryptedInlineData,proto3" json:"encrypted_inline_data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentMakeInlineRequest) Reset() { *m = SegmentMakeInlineRequest{} } -func (m *SegmentMakeInlineRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentMakeInlineRequest) ProtoMessage() {} -func (*SegmentMakeInlineRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{41} -} -func (m *SegmentMakeInlineRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentMakeInlineRequest.Unmarshal(m, b) -} -func (m *SegmentMakeInlineRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentMakeInlineRequest.Marshal(b, m, deterministic) -} -func (m *SegmentMakeInlineRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentMakeInlineRequest.Merge(m, src) -} -func (m *SegmentMakeInlineRequest) XXX_Size() int { - return xxx_messageInfo_SegmentMakeInlineRequest.Size(m) -} -func (m *SegmentMakeInlineRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentMakeInlineRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentMakeInlineRequest proto.InternalMessageInfo - -func (m *SegmentMakeInlineRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentMakeInlineRequest) GetPosition() *SegmentPosition { - if m != nil { - return m.Position - } - return nil -} - -func (m *SegmentMakeInlineRequest) GetEncryptedKey() []byte { - if m != nil { - return m.EncryptedKey - } - return nil -} - -func (m *SegmentMakeInlineRequest) GetEncryptedInlineData() []byte { - if m != nil { - return m.EncryptedInlineData - } - return nil -} - -type SegmentMakeInlineResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentMakeInlineResponse) Reset() { *m = SegmentMakeInlineResponse{} } -func (m *SegmentMakeInlineResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentMakeInlineResponse) ProtoMessage() {} -func (*SegmentMakeInlineResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{42} -} -func (m *SegmentMakeInlineResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentMakeInlineResponse.Unmarshal(m, b) -} -func (m *SegmentMakeInlineResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentMakeInlineResponse.Marshal(b, m, deterministic) -} -func (m *SegmentMakeInlineResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentMakeInlineResponse.Merge(m, src) -} -func (m *SegmentMakeInlineResponse) XXX_Size() int { - return xxx_messageInfo_SegmentMakeInlineResponse.Size(m) -} -func (m *SegmentMakeInlineResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentMakeInlineResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentMakeInlineResponse proto.InternalMessageInfo - -type SegmentBeginDeleteRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - Position *SegmentPosition `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentBeginDeleteRequest) Reset() { *m = SegmentBeginDeleteRequest{} } -func (m *SegmentBeginDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentBeginDeleteRequest) ProtoMessage() {} -func (*SegmentBeginDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{43} -} -func (m *SegmentBeginDeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentBeginDeleteRequest.Unmarshal(m, b) -} -func (m *SegmentBeginDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentBeginDeleteRequest.Marshal(b, m, deterministic) -} -func (m *SegmentBeginDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentBeginDeleteRequest.Merge(m, src) -} -func (m *SegmentBeginDeleteRequest) XXX_Size() int { - return xxx_messageInfo_SegmentBeginDeleteRequest.Size(m) -} -func (m *SegmentBeginDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentBeginDeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentBeginDeleteRequest proto.InternalMessageInfo - -func (m *SegmentBeginDeleteRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentBeginDeleteRequest) GetPosition() *SegmentPosition { - if m != nil { - return m.Position - } - return nil -} - -type SegmentBeginDeleteResponse struct { - SegmentId SegmentID `protobuf:"bytes,1,opt,name=segment_id,json=segmentId,proto3,customtype=SegmentID" json:"segment_id"` - AddressedLimits []*AddressedOrderLimit `protobuf:"bytes,2,rep,name=addressed_limits,json=addressedLimits,proto3" json:"addressed_limits,omitempty"` - PrivateKey PiecePrivateKey `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3,customtype=PiecePrivateKey" json:"private_key"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentBeginDeleteResponse) Reset() { *m = SegmentBeginDeleteResponse{} } -func (m *SegmentBeginDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentBeginDeleteResponse) ProtoMessage() {} -func (*SegmentBeginDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{44} -} -func (m *SegmentBeginDeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentBeginDeleteResponse.Unmarshal(m, b) -} -func (m *SegmentBeginDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentBeginDeleteResponse.Marshal(b, m, deterministic) -} -func (m *SegmentBeginDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentBeginDeleteResponse.Merge(m, src) -} -func (m *SegmentBeginDeleteResponse) XXX_Size() int { - return xxx_messageInfo_SegmentBeginDeleteResponse.Size(m) -} -func (m *SegmentBeginDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentBeginDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentBeginDeleteResponse proto.InternalMessageInfo - -func (m *SegmentBeginDeleteResponse) GetAddressedLimits() []*AddressedOrderLimit { - if m != nil { - return m.AddressedLimits - } - return nil -} - -type SegmentFinishDeleteRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - SegmentId SegmentID `protobuf:"bytes,1,opt,name=segment_id,json=segmentId,proto3,customtype=SegmentID" json:"segment_id"` - Results []*SegmentPieceDeleteResult `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentFinishDeleteRequest) Reset() { *m = SegmentFinishDeleteRequest{} } -func (m *SegmentFinishDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentFinishDeleteRequest) ProtoMessage() {} -func (*SegmentFinishDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{45} -} -func (m *SegmentFinishDeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentFinishDeleteRequest.Unmarshal(m, b) -} -func (m *SegmentFinishDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentFinishDeleteRequest.Marshal(b, m, deterministic) -} -func (m *SegmentFinishDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentFinishDeleteRequest.Merge(m, src) -} -func (m *SegmentFinishDeleteRequest) XXX_Size() int { - return xxx_messageInfo_SegmentFinishDeleteRequest.Size(m) -} -func (m *SegmentFinishDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentFinishDeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentFinishDeleteRequest proto.InternalMessageInfo - -func (m *SegmentFinishDeleteRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentFinishDeleteRequest) GetResults() []*SegmentPieceDeleteResult { - if m != nil { - return m.Results - } - return nil -} - -type SegmentPieceDeleteResult struct { - PieceNum int32 `protobuf:"varint,1,opt,name=piece_num,json=pieceNum,proto3" json:"piece_num,omitempty"` - NodeId NodeID `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - Hash *PieceHash `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentPieceDeleteResult) Reset() { *m = SegmentPieceDeleteResult{} } -func (m *SegmentPieceDeleteResult) String() string { return proto.CompactTextString(m) } -func (*SegmentPieceDeleteResult) ProtoMessage() {} -func (*SegmentPieceDeleteResult) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{46} -} -func (m *SegmentPieceDeleteResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentPieceDeleteResult.Unmarshal(m, b) -} -func (m *SegmentPieceDeleteResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentPieceDeleteResult.Marshal(b, m, deterministic) -} -func (m *SegmentPieceDeleteResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentPieceDeleteResult.Merge(m, src) -} -func (m *SegmentPieceDeleteResult) XXX_Size() int { - return xxx_messageInfo_SegmentPieceDeleteResult.Size(m) -} -func (m *SegmentPieceDeleteResult) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentPieceDeleteResult.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentPieceDeleteResult proto.InternalMessageInfo - -func (m *SegmentPieceDeleteResult) GetPieceNum() int32 { - if m != nil { - return m.PieceNum - } - return 0 -} - -func (m *SegmentPieceDeleteResult) GetHash() *PieceHash { - if m != nil { - return m.Hash - } - return nil -} - -type SegmentFinishDeleteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentFinishDeleteResponse) Reset() { *m = SegmentFinishDeleteResponse{} } -func (m *SegmentFinishDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentFinishDeleteResponse) ProtoMessage() {} -func (*SegmentFinishDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{47} -} -func (m *SegmentFinishDeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentFinishDeleteResponse.Unmarshal(m, b) -} -func (m *SegmentFinishDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentFinishDeleteResponse.Marshal(b, m, deterministic) -} -func (m *SegmentFinishDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentFinishDeleteResponse.Merge(m, src) -} -func (m *SegmentFinishDeleteResponse) XXX_Size() int { - return xxx_messageInfo_SegmentFinishDeleteResponse.Size(m) -} -func (m *SegmentFinishDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentFinishDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentFinishDeleteResponse proto.InternalMessageInfo - -type SegmentListRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - CursorPosition *SegmentPosition `protobuf:"bytes,2,opt,name=cursor_position,json=cursorPosition,proto3" json:"cursor_position,omitempty"` - Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentListRequest) Reset() { *m = SegmentListRequest{} } -func (m *SegmentListRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentListRequest) ProtoMessage() {} -func (*SegmentListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{48} -} -func (m *SegmentListRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentListRequest.Unmarshal(m, b) -} -func (m *SegmentListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentListRequest.Marshal(b, m, deterministic) -} -func (m *SegmentListRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentListRequest.Merge(m, src) -} -func (m *SegmentListRequest) XXX_Size() int { - return xxx_messageInfo_SegmentListRequest.Size(m) -} -func (m *SegmentListRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentListRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentListRequest proto.InternalMessageInfo - -func (m *SegmentListRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentListRequest) GetCursorPosition() *SegmentPosition { - if m != nil { - return m.CursorPosition - } - return nil -} - -func (m *SegmentListRequest) GetLimit() int32 { - if m != nil { - return m.Limit - } - return 0 -} - -type SegmentListResponse struct { - Items []*SegmentListItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` - More bool `protobuf:"varint,2,opt,name=more,proto3" json:"more,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentListResponse) Reset() { *m = SegmentListResponse{} } -func (m *SegmentListResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentListResponse) ProtoMessage() {} -func (*SegmentListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{49} -} -func (m *SegmentListResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentListResponse.Unmarshal(m, b) -} -func (m *SegmentListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentListResponse.Marshal(b, m, deterministic) -} -func (m *SegmentListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentListResponse.Merge(m, src) -} -func (m *SegmentListResponse) XXX_Size() int { - return xxx_messageInfo_SegmentListResponse.Size(m) -} -func (m *SegmentListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentListResponse proto.InternalMessageInfo - -func (m *SegmentListResponse) GetItems() []*SegmentListItem { - if m != nil { - return m.Items - } - return nil -} - -func (m *SegmentListResponse) GetMore() bool { - if m != nil { - return m.More - } - return false -} - -type SegmentListItem struct { - Position *SegmentPosition `protobuf:"bytes,1,opt,name=position,proto3" json:"position,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentListItem) Reset() { *m = SegmentListItem{} } -func (m *SegmentListItem) String() string { return proto.CompactTextString(m) } -func (*SegmentListItem) ProtoMessage() {} -func (*SegmentListItem) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{50} -} -func (m *SegmentListItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentListItem.Unmarshal(m, b) -} -func (m *SegmentListItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentListItem.Marshal(b, m, deterministic) -} -func (m *SegmentListItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentListItem.Merge(m, src) -} -func (m *SegmentListItem) XXX_Size() int { - return xxx_messageInfo_SegmentListItem.Size(m) -} -func (m *SegmentListItem) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentListItem.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentListItem proto.InternalMessageInfo - -func (m *SegmentListItem) GetPosition() *SegmentPosition { - if m != nil { - return m.Position - } - return nil -} - -type SegmentDownloadRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - StreamId StreamID `protobuf:"bytes,1,opt,name=stream_id,json=streamId,proto3,customtype=StreamID" json:"stream_id"` - CursorPosition *SegmentPosition `protobuf:"bytes,2,opt,name=cursor_position,json=cursorPosition,proto3" json:"cursor_position,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentDownloadRequest) Reset() { *m = SegmentDownloadRequest{} } -func (m *SegmentDownloadRequest) String() string { return proto.CompactTextString(m) } -func (*SegmentDownloadRequest) ProtoMessage() {} -func (*SegmentDownloadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{51} -} -func (m *SegmentDownloadRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentDownloadRequest.Unmarshal(m, b) -} -func (m *SegmentDownloadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentDownloadRequest.Marshal(b, m, deterministic) -} -func (m *SegmentDownloadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentDownloadRequest.Merge(m, src) -} -func (m *SegmentDownloadRequest) XXX_Size() int { - return xxx_messageInfo_SegmentDownloadRequest.Size(m) -} -func (m *SegmentDownloadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentDownloadRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentDownloadRequest proto.InternalMessageInfo - -func (m *SegmentDownloadRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *SegmentDownloadRequest) GetCursorPosition() *SegmentPosition { - if m != nil { - return m.CursorPosition - } - return nil -} - -type SegmentDownloadResponse struct { - SegmentId SegmentID `protobuf:"bytes,1,opt,name=segment_id,json=segmentId,proto3,customtype=SegmentID" json:"segment_id"` - AddressedLimits []*AddressedOrderLimit `protobuf:"bytes,2,rep,name=addressed_limits,json=addressedLimits,proto3" json:"addressed_limits,omitempty"` - PrivateKey PiecePrivateKey `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3,customtype=PiecePrivateKey" json:"private_key"` - EncryptedInlineData []byte `protobuf:"bytes,4,opt,name=encrypted_inline_data,json=encryptedInlineData,proto3" json:"encrypted_inline_data,omitempty"` - SegmentSize int64 `protobuf:"varint,5,opt,name=segment_size,json=segmentSize,proto3" json:"segment_size,omitempty"` - EncryptedKeyNonce Nonce `protobuf:"bytes,6,opt,name=encrypted_key_nonce,json=encryptedKeyNonce,proto3,customtype=Nonce" json:"encrypted_key_nonce"` - EncryptedKey []byte `protobuf:"bytes,7,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` - Next *SegmentPosition `protobuf:"bytes,8,opt,name=next,proto3" json:"next,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentDownloadResponse) Reset() { *m = SegmentDownloadResponse{} } -func (m *SegmentDownloadResponse) String() string { return proto.CompactTextString(m) } -func (*SegmentDownloadResponse) ProtoMessage() {} -func (*SegmentDownloadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{52} -} -func (m *SegmentDownloadResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentDownloadResponse.Unmarshal(m, b) -} -func (m *SegmentDownloadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentDownloadResponse.Marshal(b, m, deterministic) -} -func (m *SegmentDownloadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentDownloadResponse.Merge(m, src) -} -func (m *SegmentDownloadResponse) XXX_Size() int { - return xxx_messageInfo_SegmentDownloadResponse.Size(m) -} -func (m *SegmentDownloadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentDownloadResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentDownloadResponse proto.InternalMessageInfo - -func (m *SegmentDownloadResponse) GetAddressedLimits() []*AddressedOrderLimit { - if m != nil { - return m.AddressedLimits - } - return nil -} - -func (m *SegmentDownloadResponse) GetEncryptedInlineData() []byte { - if m != nil { - return m.EncryptedInlineData - } - return nil -} - -func (m *SegmentDownloadResponse) GetSegmentSize() int64 { - if m != nil { - return m.SegmentSize - } - return 0 -} - -func (m *SegmentDownloadResponse) GetEncryptedKey() []byte { - if m != nil { - return m.EncryptedKey - } - return nil -} - -func (m *SegmentDownloadResponse) GetNext() *SegmentPosition { - if m != nil { - return m.Next - } - return nil -} - -type BatchRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - // headers for specific BatchRequestItems are ignored entirely - Requests []*BatchRequestItem `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BatchRequest) Reset() { *m = BatchRequest{} } -func (m *BatchRequest) String() string { return proto.CompactTextString(m) } -func (*BatchRequest) ProtoMessage() {} -func (*BatchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{53} -} -func (m *BatchRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BatchRequest.Unmarshal(m, b) -} -func (m *BatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BatchRequest.Marshal(b, m, deterministic) -} -func (m *BatchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchRequest.Merge(m, src) -} -func (m *BatchRequest) XXX_Size() int { - return xxx_messageInfo_BatchRequest.Size(m) -} -func (m *BatchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BatchRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchRequest proto.InternalMessageInfo - -func (m *BatchRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BatchRequest) GetRequests() []*BatchRequestItem { - if m != nil { - return m.Requests - } - return nil -} - -type BatchRequestItem struct { - // Types that are valid to be assigned to Request: - // *BatchRequestItem_BucketCreate - // *BatchRequestItem_BucketGet - // *BatchRequestItem_BucketDelete - // *BatchRequestItem_BucketList - // *BatchRequestItem_ObjectBegin - // *BatchRequestItem_ObjectCommit - // *BatchRequestItem_ObjectGet - // *BatchRequestItem_ObjectList - // *BatchRequestItem_ObjectBeginDelete - // *BatchRequestItem_ObjectFinishDelete - // *BatchRequestItem_SegmentBegin - // *BatchRequestItem_SegmentCommit - // *BatchRequestItem_SegmentMakeInline - // *BatchRequestItem_SegmentBeginDelete - // *BatchRequestItem_SegmentFinishDelete - // *BatchRequestItem_SegmentList - // *BatchRequestItem_SegmentDownload - // *BatchRequestItem_RevokeApiKey - Request isBatchRequestItem_Request `protobuf_oneof:"Request"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BatchRequestItem) Reset() { *m = BatchRequestItem{} } -func (m *BatchRequestItem) String() string { return proto.CompactTextString(m) } -func (*BatchRequestItem) ProtoMessage() {} -func (*BatchRequestItem) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{54} -} -func (m *BatchRequestItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BatchRequestItem.Unmarshal(m, b) -} -func (m *BatchRequestItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BatchRequestItem.Marshal(b, m, deterministic) -} -func (m *BatchRequestItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchRequestItem.Merge(m, src) -} -func (m *BatchRequestItem) XXX_Size() int { - return xxx_messageInfo_BatchRequestItem.Size(m) -} -func (m *BatchRequestItem) XXX_DiscardUnknown() { - xxx_messageInfo_BatchRequestItem.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchRequestItem proto.InternalMessageInfo - -type isBatchRequestItem_Request interface { - isBatchRequestItem_Request() -} - -type BatchRequestItem_BucketCreate struct { - BucketCreate *BucketCreateRequest `protobuf:"bytes,1,opt,name=bucket_create,json=bucketCreate,proto3,oneof"` -} -type BatchRequestItem_BucketGet struct { - BucketGet *BucketGetRequest `protobuf:"bytes,2,opt,name=bucket_get,json=bucketGet,proto3,oneof"` -} -type BatchRequestItem_BucketDelete struct { - BucketDelete *BucketDeleteRequest `protobuf:"bytes,3,opt,name=bucket_delete,json=bucketDelete,proto3,oneof"` -} -type BatchRequestItem_BucketList struct { - BucketList *BucketListRequest `protobuf:"bytes,4,opt,name=bucket_list,json=bucketList,proto3,oneof"` -} -type BatchRequestItem_ObjectBegin struct { - ObjectBegin *ObjectBeginRequest `protobuf:"bytes,6,opt,name=object_begin,json=objectBegin,proto3,oneof"` -} -type BatchRequestItem_ObjectCommit struct { - ObjectCommit *ObjectCommitRequest `protobuf:"bytes,7,opt,name=object_commit,json=objectCommit,proto3,oneof"` -} -type BatchRequestItem_ObjectGet struct { - ObjectGet *ObjectGetRequest `protobuf:"bytes,8,opt,name=object_get,json=objectGet,proto3,oneof"` -} -type BatchRequestItem_ObjectList struct { - ObjectList *ObjectListRequest `protobuf:"bytes,9,opt,name=object_list,json=objectList,proto3,oneof"` -} -type BatchRequestItem_ObjectBeginDelete struct { - ObjectBeginDelete *ObjectBeginDeleteRequest `protobuf:"bytes,10,opt,name=object_begin_delete,json=objectBeginDelete,proto3,oneof"` -} -type BatchRequestItem_ObjectFinishDelete struct { - ObjectFinishDelete *ObjectFinishDeleteRequest `protobuf:"bytes,11,opt,name=object_finish_delete,json=objectFinishDelete,proto3,oneof"` -} -type BatchRequestItem_SegmentBegin struct { - SegmentBegin *SegmentBeginRequest `protobuf:"bytes,12,opt,name=segment_begin,json=segmentBegin,proto3,oneof"` -} -type BatchRequestItem_SegmentCommit struct { - SegmentCommit *SegmentCommitRequest `protobuf:"bytes,13,opt,name=segment_commit,json=segmentCommit,proto3,oneof"` -} -type BatchRequestItem_SegmentMakeInline struct { - SegmentMakeInline *SegmentMakeInlineRequest `protobuf:"bytes,14,opt,name=segment_make_inline,json=segmentMakeInline,proto3,oneof"` -} -type BatchRequestItem_SegmentBeginDelete struct { - SegmentBeginDelete *SegmentBeginDeleteRequest `protobuf:"bytes,15,opt,name=segment_begin_delete,json=segmentBeginDelete,proto3,oneof"` -} -type BatchRequestItem_SegmentFinishDelete struct { - SegmentFinishDelete *SegmentFinishDeleteRequest `protobuf:"bytes,16,opt,name=segment_finish_delete,json=segmentFinishDelete,proto3,oneof"` -} -type BatchRequestItem_SegmentList struct { - SegmentList *SegmentListRequest `protobuf:"bytes,17,opt,name=segment_list,json=segmentList,proto3,oneof"` -} -type BatchRequestItem_SegmentDownload struct { - SegmentDownload *SegmentDownloadRequest `protobuf:"bytes,18,opt,name=segment_download,json=segmentDownload,proto3,oneof"` -} -type BatchRequestItem_RevokeApiKey struct { - RevokeApiKey *RevokeAPIKeyRequest `protobuf:"bytes,19,opt,name=revoke_api_key,json=revokeApiKey,proto3,oneof"` -} - -func (*BatchRequestItem_BucketCreate) isBatchRequestItem_Request() {} -func (*BatchRequestItem_BucketGet) isBatchRequestItem_Request() {} -func (*BatchRequestItem_BucketDelete) isBatchRequestItem_Request() {} -func (*BatchRequestItem_BucketList) isBatchRequestItem_Request() {} -func (*BatchRequestItem_ObjectBegin) isBatchRequestItem_Request() {} -func (*BatchRequestItem_ObjectCommit) isBatchRequestItem_Request() {} -func (*BatchRequestItem_ObjectGet) isBatchRequestItem_Request() {} -func (*BatchRequestItem_ObjectList) isBatchRequestItem_Request() {} -func (*BatchRequestItem_ObjectBeginDelete) isBatchRequestItem_Request() {} -func (*BatchRequestItem_ObjectFinishDelete) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentBegin) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentCommit) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentMakeInline) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentBeginDelete) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentFinishDelete) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentList) isBatchRequestItem_Request() {} -func (*BatchRequestItem_SegmentDownload) isBatchRequestItem_Request() {} -func (*BatchRequestItem_RevokeApiKey) isBatchRequestItem_Request() {} - -func (m *BatchRequestItem) GetRequest() isBatchRequestItem_Request { - if m != nil { - return m.Request - } - return nil -} - -func (m *BatchRequestItem) GetBucketCreate() *BucketCreateRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_BucketCreate); ok { - return x.BucketCreate - } - return nil -} - -func (m *BatchRequestItem) GetBucketGet() *BucketGetRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_BucketGet); ok { - return x.BucketGet - } - return nil -} - -func (m *BatchRequestItem) GetBucketDelete() *BucketDeleteRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_BucketDelete); ok { - return x.BucketDelete - } - return nil -} - -func (m *BatchRequestItem) GetBucketList() *BucketListRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_BucketList); ok { - return x.BucketList - } - return nil -} - -func (m *BatchRequestItem) GetObjectBegin() *ObjectBeginRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_ObjectBegin); ok { - return x.ObjectBegin - } - return nil -} - -func (m *BatchRequestItem) GetObjectCommit() *ObjectCommitRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_ObjectCommit); ok { - return x.ObjectCommit - } - return nil -} - -func (m *BatchRequestItem) GetObjectGet() *ObjectGetRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_ObjectGet); ok { - return x.ObjectGet - } - return nil -} - -func (m *BatchRequestItem) GetObjectList() *ObjectListRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_ObjectList); ok { - return x.ObjectList - } - return nil -} - -func (m *BatchRequestItem) GetObjectBeginDelete() *ObjectBeginDeleteRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_ObjectBeginDelete); ok { - return x.ObjectBeginDelete - } - return nil -} - -func (m *BatchRequestItem) GetObjectFinishDelete() *ObjectFinishDeleteRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_ObjectFinishDelete); ok { - return x.ObjectFinishDelete - } - return nil -} - -func (m *BatchRequestItem) GetSegmentBegin() *SegmentBeginRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentBegin); ok { - return x.SegmentBegin - } - return nil -} - -func (m *BatchRequestItem) GetSegmentCommit() *SegmentCommitRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentCommit); ok { - return x.SegmentCommit - } - return nil -} - -func (m *BatchRequestItem) GetSegmentMakeInline() *SegmentMakeInlineRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentMakeInline); ok { - return x.SegmentMakeInline - } - return nil -} - -func (m *BatchRequestItem) GetSegmentBeginDelete() *SegmentBeginDeleteRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentBeginDelete); ok { - return x.SegmentBeginDelete - } - return nil -} - -func (m *BatchRequestItem) GetSegmentFinishDelete() *SegmentFinishDeleteRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentFinishDelete); ok { - return x.SegmentFinishDelete - } - return nil -} - -func (m *BatchRequestItem) GetSegmentList() *SegmentListRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentList); ok { - return x.SegmentList - } - return nil -} - -func (m *BatchRequestItem) GetSegmentDownload() *SegmentDownloadRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_SegmentDownload); ok { - return x.SegmentDownload - } - return nil -} - -func (m *BatchRequestItem) GetRevokeApiKey() *RevokeAPIKeyRequest { - if x, ok := m.GetRequest().(*BatchRequestItem_RevokeApiKey); ok { - return x.RevokeApiKey - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*BatchRequestItem) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _BatchRequestItem_OneofMarshaler, _BatchRequestItem_OneofUnmarshaler, _BatchRequestItem_OneofSizer, []interface{}{ - (*BatchRequestItem_BucketCreate)(nil), - (*BatchRequestItem_BucketGet)(nil), - (*BatchRequestItem_BucketDelete)(nil), - (*BatchRequestItem_BucketList)(nil), - (*BatchRequestItem_ObjectBegin)(nil), - (*BatchRequestItem_ObjectCommit)(nil), - (*BatchRequestItem_ObjectGet)(nil), - (*BatchRequestItem_ObjectList)(nil), - (*BatchRequestItem_ObjectBeginDelete)(nil), - (*BatchRequestItem_ObjectFinishDelete)(nil), - (*BatchRequestItem_SegmentBegin)(nil), - (*BatchRequestItem_SegmentCommit)(nil), - (*BatchRequestItem_SegmentMakeInline)(nil), - (*BatchRequestItem_SegmentBeginDelete)(nil), - (*BatchRequestItem_SegmentFinishDelete)(nil), - (*BatchRequestItem_SegmentList)(nil), - (*BatchRequestItem_SegmentDownload)(nil), - (*BatchRequestItem_RevokeApiKey)(nil), - } -} - -func _BatchRequestItem_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*BatchRequestItem) - // Request - switch x := m.Request.(type) { - case *BatchRequestItem_BucketCreate: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketCreate); err != nil { - return err - } - case *BatchRequestItem_BucketGet: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketGet); err != nil { - return err - } - case *BatchRequestItem_BucketDelete: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketDelete); err != nil { - return err - } - case *BatchRequestItem_BucketList: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketList); err != nil { - return err - } - case *BatchRequestItem_ObjectBegin: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectBegin); err != nil { - return err - } - case *BatchRequestItem_ObjectCommit: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectCommit); err != nil { - return err - } - case *BatchRequestItem_ObjectGet: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectGet); err != nil { - return err - } - case *BatchRequestItem_ObjectList: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectList); err != nil { - return err - } - case *BatchRequestItem_ObjectBeginDelete: - _ = b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectBeginDelete); err != nil { - return err - } - case *BatchRequestItem_ObjectFinishDelete: - _ = b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectFinishDelete); err != nil { - return err - } - case *BatchRequestItem_SegmentBegin: - _ = b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentBegin); err != nil { - return err - } - case *BatchRequestItem_SegmentCommit: - _ = b.EncodeVarint(13<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentCommit); err != nil { - return err - } - case *BatchRequestItem_SegmentMakeInline: - _ = b.EncodeVarint(14<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentMakeInline); err != nil { - return err - } - case *BatchRequestItem_SegmentBeginDelete: - _ = b.EncodeVarint(15<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentBeginDelete); err != nil { - return err - } - case *BatchRequestItem_SegmentFinishDelete: - _ = b.EncodeVarint(16<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentFinishDelete); err != nil { - return err - } - case *BatchRequestItem_SegmentList: - _ = b.EncodeVarint(17<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentList); err != nil { - return err - } - case *BatchRequestItem_SegmentDownload: - _ = b.EncodeVarint(18<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentDownload); err != nil { - return err - } - case *BatchRequestItem_RevokeApiKey: - _ = b.EncodeVarint(19<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.RevokeApiKey); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("BatchRequestItem.Request has unexpected type %T", x) - } - return nil -} - -func _BatchRequestItem_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*BatchRequestItem) - switch tag { - case 1: // Request.bucket_create - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketCreateRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_BucketCreate{msg} - return true, err - case 2: // Request.bucket_get - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketGetRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_BucketGet{msg} - return true, err - case 3: // Request.bucket_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketDeleteRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_BucketDelete{msg} - return true, err - case 4: // Request.bucket_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketListRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_BucketList{msg} - return true, err - case 6: // Request.object_begin - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectBeginRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_ObjectBegin{msg} - return true, err - case 7: // Request.object_commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectCommitRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_ObjectCommit{msg} - return true, err - case 8: // Request.object_get - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectGetRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_ObjectGet{msg} - return true, err - case 9: // Request.object_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectListRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_ObjectList{msg} - return true, err - case 10: // Request.object_begin_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectBeginDeleteRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_ObjectBeginDelete{msg} - return true, err - case 11: // Request.object_finish_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectFinishDeleteRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_ObjectFinishDelete{msg} - return true, err - case 12: // Request.segment_begin - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentBeginRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentBegin{msg} - return true, err - case 13: // Request.segment_commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentCommitRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentCommit{msg} - return true, err - case 14: // Request.segment_make_inline - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentMakeInlineRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentMakeInline{msg} - return true, err - case 15: // Request.segment_begin_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentBeginDeleteRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentBeginDelete{msg} - return true, err - case 16: // Request.segment_finish_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentFinishDeleteRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentFinishDelete{msg} - return true, err - case 17: // Request.segment_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentListRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentList{msg} - return true, err - case 18: // Request.segment_download - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentDownloadRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_SegmentDownload{msg} - return true, err - case 19: // Request.revoke_api_key - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RevokeAPIKeyRequest) - err := b.DecodeMessage(msg) - m.Request = &BatchRequestItem_RevokeApiKey{msg} - return true, err - default: - return false, nil - } -} - -func _BatchRequestItem_OneofSizer(msg proto.Message) (n int) { - m := msg.(*BatchRequestItem) - // Request - switch x := m.Request.(type) { - case *BatchRequestItem_BucketCreate: - s := proto.Size(x.BucketCreate) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_BucketGet: - s := proto.Size(x.BucketGet) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_BucketDelete: - s := proto.Size(x.BucketDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_BucketList: - s := proto.Size(x.BucketList) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_ObjectBegin: - s := proto.Size(x.ObjectBegin) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_ObjectCommit: - s := proto.Size(x.ObjectCommit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_ObjectGet: - s := proto.Size(x.ObjectGet) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_ObjectList: - s := proto.Size(x.ObjectList) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_ObjectBeginDelete: - s := proto.Size(x.ObjectBeginDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_ObjectFinishDelete: - s := proto.Size(x.ObjectFinishDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentBegin: - s := proto.Size(x.SegmentBegin) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentCommit: - s := proto.Size(x.SegmentCommit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentMakeInline: - s := proto.Size(x.SegmentMakeInline) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentBeginDelete: - s := proto.Size(x.SegmentBeginDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentFinishDelete: - s := proto.Size(x.SegmentFinishDelete) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentList: - s := proto.Size(x.SegmentList) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_SegmentDownload: - s := proto.Size(x.SegmentDownload) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchRequestItem_RevokeApiKey: - s := proto.Size(x.RevokeApiKey) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type BatchResponse struct { - Responses []*BatchResponseItem `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BatchResponse) Reset() { *m = BatchResponse{} } -func (m *BatchResponse) String() string { return proto.CompactTextString(m) } -func (*BatchResponse) ProtoMessage() {} -func (*BatchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{55} -} -func (m *BatchResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BatchResponse.Unmarshal(m, b) -} -func (m *BatchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BatchResponse.Marshal(b, m, deterministic) -} -func (m *BatchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchResponse.Merge(m, src) -} -func (m *BatchResponse) XXX_Size() int { - return xxx_messageInfo_BatchResponse.Size(m) -} -func (m *BatchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BatchResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchResponse proto.InternalMessageInfo - -func (m *BatchResponse) GetResponses() []*BatchResponseItem { - if m != nil { - return m.Responses - } - return nil -} - -type BatchResponseItem struct { - // Types that are valid to be assigned to Response: - // *BatchResponseItem_BucketCreate - // *BatchResponseItem_BucketGet - // *BatchResponseItem_BucketDelete - // *BatchResponseItem_BucketList - // *BatchResponseItem_ObjectBegin - // *BatchResponseItem_ObjectCommit - // *BatchResponseItem_ObjectGet - // *BatchResponseItem_ObjectList - // *BatchResponseItem_ObjectBeginDelete - // *BatchResponseItem_ObjectFinishDelete - // *BatchResponseItem_SegmentBegin - // *BatchResponseItem_SegmentCommit - // *BatchResponseItem_SegmentMakeInline - // *BatchResponseItem_SegmentBeginDelete - // *BatchResponseItem_SegmentFinishDelete - // *BatchResponseItem_SegmentList - // *BatchResponseItem_SegmentDownload - // *BatchResponseItem_RevokeApiKey - Response isBatchResponseItem_Response `protobuf_oneof:"Response"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BatchResponseItem) Reset() { *m = BatchResponseItem{} } -func (m *BatchResponseItem) String() string { return proto.CompactTextString(m) } -func (*BatchResponseItem) ProtoMessage() {} -func (*BatchResponseItem) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{56} -} -func (m *BatchResponseItem) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BatchResponseItem.Unmarshal(m, b) -} -func (m *BatchResponseItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BatchResponseItem.Marshal(b, m, deterministic) -} -func (m *BatchResponseItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchResponseItem.Merge(m, src) -} -func (m *BatchResponseItem) XXX_Size() int { - return xxx_messageInfo_BatchResponseItem.Size(m) -} -func (m *BatchResponseItem) XXX_DiscardUnknown() { - xxx_messageInfo_BatchResponseItem.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchResponseItem proto.InternalMessageInfo - -type isBatchResponseItem_Response interface { - isBatchResponseItem_Response() -} - -type BatchResponseItem_BucketCreate struct { - BucketCreate *BucketCreateResponse `protobuf:"bytes,1,opt,name=bucket_create,json=bucketCreate,proto3,oneof"` -} -type BatchResponseItem_BucketGet struct { - BucketGet *BucketGetResponse `protobuf:"bytes,2,opt,name=bucket_get,json=bucketGet,proto3,oneof"` -} -type BatchResponseItem_BucketDelete struct { - BucketDelete *BucketDeleteResponse `protobuf:"bytes,3,opt,name=bucket_delete,json=bucketDelete,proto3,oneof"` -} -type BatchResponseItem_BucketList struct { - BucketList *BucketListResponse `protobuf:"bytes,4,opt,name=bucket_list,json=bucketList,proto3,oneof"` -} -type BatchResponseItem_ObjectBegin struct { - ObjectBegin *ObjectBeginResponse `protobuf:"bytes,6,opt,name=object_begin,json=objectBegin,proto3,oneof"` -} -type BatchResponseItem_ObjectCommit struct { - ObjectCommit *ObjectCommitResponse `protobuf:"bytes,7,opt,name=object_commit,json=objectCommit,proto3,oneof"` -} -type BatchResponseItem_ObjectGet struct { - ObjectGet *ObjectGetResponse `protobuf:"bytes,8,opt,name=object_get,json=objectGet,proto3,oneof"` -} -type BatchResponseItem_ObjectList struct { - ObjectList *ObjectListResponse `protobuf:"bytes,9,opt,name=object_list,json=objectList,proto3,oneof"` -} -type BatchResponseItem_ObjectBeginDelete struct { - ObjectBeginDelete *ObjectBeginDeleteResponse `protobuf:"bytes,10,opt,name=object_begin_delete,json=objectBeginDelete,proto3,oneof"` -} -type BatchResponseItem_ObjectFinishDelete struct { - ObjectFinishDelete *ObjectFinishDeleteResponse `protobuf:"bytes,11,opt,name=object_finish_delete,json=objectFinishDelete,proto3,oneof"` -} -type BatchResponseItem_SegmentBegin struct { - SegmentBegin *SegmentBeginResponse `protobuf:"bytes,12,opt,name=segment_begin,json=segmentBegin,proto3,oneof"` -} -type BatchResponseItem_SegmentCommit struct { - SegmentCommit *SegmentCommitResponse `protobuf:"bytes,13,opt,name=segment_commit,json=segmentCommit,proto3,oneof"` -} -type BatchResponseItem_SegmentMakeInline struct { - SegmentMakeInline *SegmentMakeInlineResponse `protobuf:"bytes,14,opt,name=segment_make_inline,json=segmentMakeInline,proto3,oneof"` -} -type BatchResponseItem_SegmentBeginDelete struct { - SegmentBeginDelete *SegmentBeginDeleteResponse `protobuf:"bytes,15,opt,name=segment_begin_delete,json=segmentBeginDelete,proto3,oneof"` -} -type BatchResponseItem_SegmentFinishDelete struct { - SegmentFinishDelete *SegmentFinishDeleteResponse `protobuf:"bytes,16,opt,name=segment_finish_delete,json=segmentFinishDelete,proto3,oneof"` -} -type BatchResponseItem_SegmentList struct { - SegmentList *SegmentListResponse `protobuf:"bytes,17,opt,name=segment_list,json=segmentList,proto3,oneof"` -} -type BatchResponseItem_SegmentDownload struct { - SegmentDownload *SegmentDownloadResponse `protobuf:"bytes,18,opt,name=segment_download,json=segmentDownload,proto3,oneof"` -} -type BatchResponseItem_RevokeApiKey struct { - RevokeApiKey *RevokeAPIKeyResponse `protobuf:"bytes,19,opt,name=revoke_api_key,json=revokeApiKey,proto3,oneof"` -} - -func (*BatchResponseItem_BucketCreate) isBatchResponseItem_Response() {} -func (*BatchResponseItem_BucketGet) isBatchResponseItem_Response() {} -func (*BatchResponseItem_BucketDelete) isBatchResponseItem_Response() {} -func (*BatchResponseItem_BucketList) isBatchResponseItem_Response() {} -func (*BatchResponseItem_ObjectBegin) isBatchResponseItem_Response() {} -func (*BatchResponseItem_ObjectCommit) isBatchResponseItem_Response() {} -func (*BatchResponseItem_ObjectGet) isBatchResponseItem_Response() {} -func (*BatchResponseItem_ObjectList) isBatchResponseItem_Response() {} -func (*BatchResponseItem_ObjectBeginDelete) isBatchResponseItem_Response() {} -func (*BatchResponseItem_ObjectFinishDelete) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentBegin) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentCommit) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentMakeInline) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentBeginDelete) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentFinishDelete) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentList) isBatchResponseItem_Response() {} -func (*BatchResponseItem_SegmentDownload) isBatchResponseItem_Response() {} -func (*BatchResponseItem_RevokeApiKey) isBatchResponseItem_Response() {} - -func (m *BatchResponseItem) GetResponse() isBatchResponseItem_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *BatchResponseItem) GetBucketCreate() *BucketCreateResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_BucketCreate); ok { - return x.BucketCreate - } - return nil -} - -func (m *BatchResponseItem) GetBucketGet() *BucketGetResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_BucketGet); ok { - return x.BucketGet - } - return nil -} - -func (m *BatchResponseItem) GetBucketDelete() *BucketDeleteResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_BucketDelete); ok { - return x.BucketDelete - } - return nil -} - -func (m *BatchResponseItem) GetBucketList() *BucketListResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_BucketList); ok { - return x.BucketList - } - return nil -} - -func (m *BatchResponseItem) GetObjectBegin() *ObjectBeginResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_ObjectBegin); ok { - return x.ObjectBegin - } - return nil -} - -func (m *BatchResponseItem) GetObjectCommit() *ObjectCommitResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_ObjectCommit); ok { - return x.ObjectCommit - } - return nil -} - -func (m *BatchResponseItem) GetObjectGet() *ObjectGetResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_ObjectGet); ok { - return x.ObjectGet - } - return nil -} - -func (m *BatchResponseItem) GetObjectList() *ObjectListResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_ObjectList); ok { - return x.ObjectList - } - return nil -} - -func (m *BatchResponseItem) GetObjectBeginDelete() *ObjectBeginDeleteResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_ObjectBeginDelete); ok { - return x.ObjectBeginDelete - } - return nil -} - -func (m *BatchResponseItem) GetObjectFinishDelete() *ObjectFinishDeleteResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_ObjectFinishDelete); ok { - return x.ObjectFinishDelete - } - return nil -} - -func (m *BatchResponseItem) GetSegmentBegin() *SegmentBeginResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentBegin); ok { - return x.SegmentBegin - } - return nil -} - -func (m *BatchResponseItem) GetSegmentCommit() *SegmentCommitResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentCommit); ok { - return x.SegmentCommit - } - return nil -} - -func (m *BatchResponseItem) GetSegmentMakeInline() *SegmentMakeInlineResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentMakeInline); ok { - return x.SegmentMakeInline - } - return nil -} - -func (m *BatchResponseItem) GetSegmentBeginDelete() *SegmentBeginDeleteResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentBeginDelete); ok { - return x.SegmentBeginDelete - } - return nil -} - -func (m *BatchResponseItem) GetSegmentFinishDelete() *SegmentFinishDeleteResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentFinishDelete); ok { - return x.SegmentFinishDelete - } - return nil -} - -func (m *BatchResponseItem) GetSegmentList() *SegmentListResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentList); ok { - return x.SegmentList - } - return nil -} - -func (m *BatchResponseItem) GetSegmentDownload() *SegmentDownloadResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_SegmentDownload); ok { - return x.SegmentDownload - } - return nil -} - -func (m *BatchResponseItem) GetRevokeApiKey() *RevokeAPIKeyResponse { - if x, ok := m.GetResponse().(*BatchResponseItem_RevokeApiKey); ok { - return x.RevokeApiKey - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*BatchResponseItem) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _BatchResponseItem_OneofMarshaler, _BatchResponseItem_OneofUnmarshaler, _BatchResponseItem_OneofSizer, []interface{}{ - (*BatchResponseItem_BucketCreate)(nil), - (*BatchResponseItem_BucketGet)(nil), - (*BatchResponseItem_BucketDelete)(nil), - (*BatchResponseItem_BucketList)(nil), - (*BatchResponseItem_ObjectBegin)(nil), - (*BatchResponseItem_ObjectCommit)(nil), - (*BatchResponseItem_ObjectGet)(nil), - (*BatchResponseItem_ObjectList)(nil), - (*BatchResponseItem_ObjectBeginDelete)(nil), - (*BatchResponseItem_ObjectFinishDelete)(nil), - (*BatchResponseItem_SegmentBegin)(nil), - (*BatchResponseItem_SegmentCommit)(nil), - (*BatchResponseItem_SegmentMakeInline)(nil), - (*BatchResponseItem_SegmentBeginDelete)(nil), - (*BatchResponseItem_SegmentFinishDelete)(nil), - (*BatchResponseItem_SegmentList)(nil), - (*BatchResponseItem_SegmentDownload)(nil), - (*BatchResponseItem_RevokeApiKey)(nil), - } -} - -func _BatchResponseItem_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*BatchResponseItem) - // Response - switch x := m.Response.(type) { - case *BatchResponseItem_BucketCreate: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketCreate); err != nil { - return err - } - case *BatchResponseItem_BucketGet: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketGet); err != nil { - return err - } - case *BatchResponseItem_BucketDelete: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketDelete); err != nil { - return err - } - case *BatchResponseItem_BucketList: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BucketList); err != nil { - return err - } - case *BatchResponseItem_ObjectBegin: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectBegin); err != nil { - return err - } - case *BatchResponseItem_ObjectCommit: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectCommit); err != nil { - return err - } - case *BatchResponseItem_ObjectGet: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectGet); err != nil { - return err - } - case *BatchResponseItem_ObjectList: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectList); err != nil { - return err - } - case *BatchResponseItem_ObjectBeginDelete: - _ = b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectBeginDelete); err != nil { - return err - } - case *BatchResponseItem_ObjectFinishDelete: - _ = b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ObjectFinishDelete); err != nil { - return err - } - case *BatchResponseItem_SegmentBegin: - _ = b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentBegin); err != nil { - return err - } - case *BatchResponseItem_SegmentCommit: - _ = b.EncodeVarint(13<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentCommit); err != nil { - return err - } - case *BatchResponseItem_SegmentMakeInline: - _ = b.EncodeVarint(14<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentMakeInline); err != nil { - return err - } - case *BatchResponseItem_SegmentBeginDelete: - _ = b.EncodeVarint(15<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentBeginDelete); err != nil { - return err - } - case *BatchResponseItem_SegmentFinishDelete: - _ = b.EncodeVarint(16<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentFinishDelete); err != nil { - return err - } - case *BatchResponseItem_SegmentList: - _ = b.EncodeVarint(17<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentList); err != nil { - return err - } - case *BatchResponseItem_SegmentDownload: - _ = b.EncodeVarint(18<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SegmentDownload); err != nil { - return err - } - case *BatchResponseItem_RevokeApiKey: - _ = b.EncodeVarint(19<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.RevokeApiKey); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("BatchResponseItem.Response has unexpected type %T", x) - } - return nil -} - -func _BatchResponseItem_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*BatchResponseItem) - switch tag { - case 1: // Response.bucket_create - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketCreateResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_BucketCreate{msg} - return true, err - case 2: // Response.bucket_get - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketGetResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_BucketGet{msg} - return true, err - case 3: // Response.bucket_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketDeleteResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_BucketDelete{msg} - return true, err - case 4: // Response.bucket_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BucketListResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_BucketList{msg} - return true, err - case 6: // Response.object_begin - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectBeginResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_ObjectBegin{msg} - return true, err - case 7: // Response.object_commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectCommitResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_ObjectCommit{msg} - return true, err - case 8: // Response.object_get - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectGetResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_ObjectGet{msg} - return true, err - case 9: // Response.object_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectListResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_ObjectList{msg} - return true, err - case 10: // Response.object_begin_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectBeginDeleteResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_ObjectBeginDelete{msg} - return true, err - case 11: // Response.object_finish_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ObjectFinishDeleteResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_ObjectFinishDelete{msg} - return true, err - case 12: // Response.segment_begin - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentBeginResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentBegin{msg} - return true, err - case 13: // Response.segment_commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentCommitResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentCommit{msg} - return true, err - case 14: // Response.segment_make_inline - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentMakeInlineResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentMakeInline{msg} - return true, err - case 15: // Response.segment_begin_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentBeginDeleteResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentBeginDelete{msg} - return true, err - case 16: // Response.segment_finish_delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentFinishDeleteResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentFinishDelete{msg} - return true, err - case 17: // Response.segment_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentListResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentList{msg} - return true, err - case 18: // Response.segment_download - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SegmentDownloadResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_SegmentDownload{msg} - return true, err - case 19: // Response.revoke_api_key - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RevokeAPIKeyResponse) - err := b.DecodeMessage(msg) - m.Response = &BatchResponseItem_RevokeApiKey{msg} - return true, err - default: - return false, nil - } -} - -func _BatchResponseItem_OneofSizer(msg proto.Message) (n int) { - m := msg.(*BatchResponseItem) - // Response - switch x := m.Response.(type) { - case *BatchResponseItem_BucketCreate: - s := proto.Size(x.BucketCreate) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_BucketGet: - s := proto.Size(x.BucketGet) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_BucketDelete: - s := proto.Size(x.BucketDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_BucketList: - s := proto.Size(x.BucketList) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_ObjectBegin: - s := proto.Size(x.ObjectBegin) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_ObjectCommit: - s := proto.Size(x.ObjectCommit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_ObjectGet: - s := proto.Size(x.ObjectGet) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_ObjectList: - s := proto.Size(x.ObjectList) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_ObjectBeginDelete: - s := proto.Size(x.ObjectBeginDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_ObjectFinishDelete: - s := proto.Size(x.ObjectFinishDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentBegin: - s := proto.Size(x.SegmentBegin) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentCommit: - s := proto.Size(x.SegmentCommit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentMakeInline: - s := proto.Size(x.SegmentMakeInline) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentBeginDelete: - s := proto.Size(x.SegmentBeginDelete) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentFinishDelete: - s := proto.Size(x.SegmentFinishDelete) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentList: - s := proto.Size(x.SegmentList) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_SegmentDownload: - s := proto.Size(x.SegmentDownload) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *BatchResponseItem_RevokeApiKey: - s := proto.Size(x.RevokeApiKey) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type RevokeAPIKeyRequest struct { - Header *RequestHeader `protobuf:"bytes,15,opt,name=header,proto3" json:"header,omitempty"` - ApiKey []byte `protobuf:"bytes,1,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RevokeAPIKeyRequest) Reset() { *m = RevokeAPIKeyRequest{} } -func (m *RevokeAPIKeyRequest) String() string { return proto.CompactTextString(m) } -func (*RevokeAPIKeyRequest) ProtoMessage() {} -func (*RevokeAPIKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{57} -} -func (m *RevokeAPIKeyRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RevokeAPIKeyRequest.Unmarshal(m, b) -} -func (m *RevokeAPIKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RevokeAPIKeyRequest.Marshal(b, m, deterministic) -} -func (m *RevokeAPIKeyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RevokeAPIKeyRequest.Merge(m, src) -} -func (m *RevokeAPIKeyRequest) XXX_Size() int { - return xxx_messageInfo_RevokeAPIKeyRequest.Size(m) -} -func (m *RevokeAPIKeyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RevokeAPIKeyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RevokeAPIKeyRequest proto.InternalMessageInfo - -func (m *RevokeAPIKeyRequest) GetHeader() *RequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *RevokeAPIKeyRequest) GetApiKey() []byte { - if m != nil { - return m.ApiKey - } - return nil -} - -type RevokeAPIKeyResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RevokeAPIKeyResponse) Reset() { *m = RevokeAPIKeyResponse{} } -func (m *RevokeAPIKeyResponse) String() string { return proto.CompactTextString(m) } -func (*RevokeAPIKeyResponse) ProtoMessage() {} -func (*RevokeAPIKeyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_631e2f30a93cd64e, []int{58} -} -func (m *RevokeAPIKeyResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RevokeAPIKeyResponse.Unmarshal(m, b) -} -func (m *RevokeAPIKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RevokeAPIKeyResponse.Marshal(b, m, deterministic) -} -func (m *RevokeAPIKeyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RevokeAPIKeyResponse.Merge(m, src) -} -func (m *RevokeAPIKeyResponse) XXX_Size() int { - return xxx_messageInfo_RevokeAPIKeyResponse.Size(m) -} -func (m *RevokeAPIKeyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RevokeAPIKeyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RevokeAPIKeyResponse proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("metainfo.Object_Status", Object_Status_name, Object_Status_value) - proto.RegisterType((*RequestHeader)(nil), "metainfo.RequestHeader") - proto.RegisterType((*Bucket)(nil), "metainfo.Bucket") - proto.RegisterType((*BucketListItem)(nil), "metainfo.BucketListItem") - proto.RegisterType((*BucketCreateRequest)(nil), "metainfo.BucketCreateRequest") - proto.RegisterType((*BucketCreateResponse)(nil), "metainfo.BucketCreateResponse") - proto.RegisterType((*BucketGetRequest)(nil), "metainfo.BucketGetRequest") - proto.RegisterType((*BucketGetResponse)(nil), "metainfo.BucketGetResponse") - proto.RegisterType((*BucketDeleteRequest)(nil), "metainfo.BucketDeleteRequest") - proto.RegisterType((*BucketDeleteResponse)(nil), "metainfo.BucketDeleteResponse") - proto.RegisterType((*BucketListRequest)(nil), "metainfo.BucketListRequest") - proto.RegisterType((*BucketListResponse)(nil), "metainfo.BucketListResponse") - proto.RegisterType((*BucketSetAttributionRequest)(nil), "metainfo.BucketSetAttributionRequest") - proto.RegisterType((*BucketSetAttributionResponse)(nil), "metainfo.BucketSetAttributionResponse") - proto.RegisterType((*AddressedOrderLimit)(nil), "metainfo.AddressedOrderLimit") - proto.RegisterType((*ProjectInfoRequest)(nil), "metainfo.ProjectInfoRequest") - proto.RegisterType((*ProjectInfoResponse)(nil), "metainfo.ProjectInfoResponse") - proto.RegisterType((*Object)(nil), "metainfo.Object") - proto.RegisterType((*ObjectBeginRequest)(nil), "metainfo.ObjectBeginRequest") - proto.RegisterType((*ObjectBeginResponse)(nil), "metainfo.ObjectBeginResponse") - proto.RegisterType((*ObjectCommitRequest)(nil), "metainfo.ObjectCommitRequest") - proto.RegisterType((*ObjectCommitResponse)(nil), "metainfo.ObjectCommitResponse") - proto.RegisterType((*ObjectGetRequest)(nil), "metainfo.ObjectGetRequest") - proto.RegisterType((*ObjectGetResponse)(nil), "metainfo.ObjectGetResponse") - proto.RegisterType((*ObjectListRequest)(nil), "metainfo.ObjectListRequest") - proto.RegisterType((*ObjectListResponse)(nil), "metainfo.ObjectListResponse") - proto.RegisterType((*ObjectListItem)(nil), "metainfo.ObjectListItem") - proto.RegisterType((*ObjectListItemIncludes)(nil), "metainfo.ObjectListItemIncludes") - proto.RegisterType((*ObjectBeginDeleteRequest)(nil), "metainfo.ObjectBeginDeleteRequest") - proto.RegisterType((*ObjectBeginDeleteResponse)(nil), "metainfo.ObjectBeginDeleteResponse") - proto.RegisterType((*ObjectFinishDeleteRequest)(nil), "metainfo.ObjectFinishDeleteRequest") - proto.RegisterType((*ObjectFinishDeleteResponse)(nil), "metainfo.ObjectFinishDeleteResponse") - proto.RegisterType((*SatStreamID)(nil), "metainfo.SatStreamID") - proto.RegisterType((*Segment)(nil), "metainfo.Segment") - proto.RegisterType((*Piece)(nil), "metainfo.Piece") - proto.RegisterType((*SegmentPosition)(nil), "metainfo.SegmentPosition") - proto.RegisterType((*SegmentBeginRequest)(nil), "metainfo.SegmentBeginRequest") - proto.RegisterType((*SegmentBeginResponse)(nil), "metainfo.SegmentBeginResponse") - proto.RegisterType((*SegmentCommitRequest)(nil), "metainfo.SegmentCommitRequest") - proto.RegisterType((*SegmentPieceUploadResult)(nil), "metainfo.SegmentPieceUploadResult") - proto.RegisterType((*SatSegmentID)(nil), "metainfo.SatSegmentID") - proto.RegisterType((*SegmentCommitResponse)(nil), "metainfo.SegmentCommitResponse") - proto.RegisterType((*SegmentMakeInlineRequest)(nil), "metainfo.SegmentMakeInlineRequest") - proto.RegisterType((*SegmentMakeInlineResponse)(nil), "metainfo.SegmentMakeInlineResponse") - proto.RegisterType((*SegmentBeginDeleteRequest)(nil), "metainfo.SegmentBeginDeleteRequest") - proto.RegisterType((*SegmentBeginDeleteResponse)(nil), "metainfo.SegmentBeginDeleteResponse") - proto.RegisterType((*SegmentFinishDeleteRequest)(nil), "metainfo.SegmentFinishDeleteRequest") - proto.RegisterType((*SegmentPieceDeleteResult)(nil), "metainfo.SegmentPieceDeleteResult") - proto.RegisterType((*SegmentFinishDeleteResponse)(nil), "metainfo.SegmentFinishDeleteResponse") - proto.RegisterType((*SegmentListRequest)(nil), "metainfo.SegmentListRequest") - proto.RegisterType((*SegmentListResponse)(nil), "metainfo.SegmentListResponse") - proto.RegisterType((*SegmentListItem)(nil), "metainfo.SegmentListItem") - proto.RegisterType((*SegmentDownloadRequest)(nil), "metainfo.SegmentDownloadRequest") - proto.RegisterType((*SegmentDownloadResponse)(nil), "metainfo.SegmentDownloadResponse") - proto.RegisterType((*BatchRequest)(nil), "metainfo.BatchRequest") - proto.RegisterType((*BatchRequestItem)(nil), "metainfo.BatchRequestItem") - proto.RegisterType((*BatchResponse)(nil), "metainfo.BatchResponse") - proto.RegisterType((*BatchResponseItem)(nil), "metainfo.BatchResponseItem") - proto.RegisterType((*RevokeAPIKeyRequest)(nil), "metainfo.RevokeAPIKeyRequest") - proto.RegisterType((*RevokeAPIKeyResponse)(nil), "metainfo.RevokeAPIKeyResponse") -} - -func init() { proto.RegisterFile("metainfo.proto", fileDescriptor_631e2f30a93cd64e) } - -var fileDescriptor_631e2f30a93cd64e = []byte{ - // 3232 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5b, 0xcd, 0x6f, 0xe3, 0xc6, - 0x15, 0xb7, 0x24, 0xeb, 0xeb, 0x49, 0x96, 0xe4, 0x91, 0xd7, 0xd6, 0xd2, 0x1f, 0xbb, 0xe1, 0x26, - 0xcd, 0x16, 0x6d, 0xec, 0xc0, 0x69, 0x8b, 0x14, 0x49, 0x9a, 0xda, 0x96, 0x63, 0x2b, 0xbb, 0xf6, - 0x3a, 0xf4, 0x6e, 0x12, 0x6c, 0x0b, 0x10, 0xb4, 0x38, 0xb6, 0x99, 0x95, 0x48, 0x95, 0xa4, 0x36, - 0x76, 0x7a, 0x2a, 0x10, 0xa0, 0xe8, 0x2d, 0x7f, 0x40, 0x8f, 0xb9, 0xf5, 0xd4, 0xde, 0x0a, 0xb4, - 0xbd, 0xb6, 0x05, 0x8a, 0x1c, 0x8a, 0xa2, 0x87, 0x1e, 0xd2, 0xa0, 0xf7, 0xf6, 0x3f, 0x28, 0x50, - 0xcc, 0x17, 0xbf, 0x44, 0x52, 0xf2, 0xc7, 0x2e, 0x9a, 0x9b, 0xf8, 0xde, 0x9b, 0x37, 0x33, 0xbf, - 0x79, 0xf3, 0x7b, 0x6f, 0x86, 0x14, 0xd4, 0xfa, 0xd8, 0xd5, 0x0c, 0xf3, 0xd8, 0x5a, 0x1d, 0xd8, - 0x96, 0x6b, 0xa1, 0x92, 0x78, 0x96, 0x1a, 0xd8, 0xec, 0xda, 0xe7, 0x03, 0xd7, 0xb0, 0x4c, 0xa6, - 0x93, 0xe0, 0xc4, 0x3a, 0xe1, 0x76, 0xd2, 0xad, 0x13, 0xcb, 0x3a, 0xe9, 0xe1, 0x35, 0xfa, 0x74, - 0x34, 0x3c, 0x5e, 0x73, 0x8d, 0x3e, 0x76, 0x5c, 0xad, 0x3f, 0x10, 0xc6, 0xa6, 0xa5, 0x63, 0xfe, - 0xbb, 0x3e, 0xb0, 0x0c, 0xd3, 0xc5, 0xb6, 0x7e, 0xc4, 0x05, 0x55, 0xcb, 0xd6, 0xb1, 0xed, 0xb0, - 0x27, 0x79, 0x07, 0x66, 0x14, 0xfc, 0x93, 0x21, 0x76, 0xdc, 0x5d, 0xac, 0xe9, 0xd8, 0x46, 0x0b, - 0x50, 0xd4, 0x06, 0x86, 0xfa, 0x04, 0x9f, 0xb7, 0x32, 0xb7, 0x33, 0x77, 0xab, 0x4a, 0x41, 0x1b, - 0x18, 0xf7, 0xf0, 0x39, 0x5a, 0x06, 0x18, 0x3a, 0xd8, 0x56, 0xb5, 0x13, 0x6c, 0xba, 0xad, 0x2c, - 0xd5, 0x95, 0x89, 0x64, 0x83, 0x08, 0xe4, 0x5f, 0xe5, 0xa0, 0xb0, 0x39, 0xec, 0x3e, 0xc1, 0x2e, - 0x42, 0x30, 0x6d, 0x6a, 0x7d, 0xcc, 0xdb, 0xd3, 0xdf, 0xe8, 0x75, 0xa8, 0x0c, 0x34, 0xf7, 0x54, - 0xed, 0x1a, 0x83, 0x53, 0x6c, 0xd3, 0xe6, 0xb5, 0xf5, 0x85, 0xd5, 0xc0, 0x3c, 0xb7, 0xa8, 0xe6, - 0x70, 0x68, 0xb8, 0x58, 0x01, 0x62, 0xcb, 0x04, 0x68, 0x0b, 0xa0, 0x6b, 0x63, 0xcd, 0xc5, 0xba, - 0xaa, 0xb9, 0xad, 0xdc, 0xed, 0xcc, 0xdd, 0xca, 0xba, 0xb4, 0xca, 0x20, 0x58, 0x15, 0x10, 0xac, - 0x3e, 0x14, 0x10, 0x6c, 0x96, 0xfe, 0xf4, 0xe5, 0xad, 0xa9, 0xcf, 0xfe, 0x79, 0x2b, 0xa3, 0x94, - 0x79, 0xbb, 0x0d, 0x17, 0xbd, 0x0a, 0x73, 0x3a, 0x3e, 0xd6, 0x86, 0x3d, 0x57, 0x75, 0xf0, 0x49, - 0x1f, 0x9b, 0xae, 0xea, 0x18, 0x9f, 0xe0, 0xd6, 0xf4, 0xed, 0xcc, 0xdd, 0x9c, 0x82, 0xb8, 0xee, - 0x90, 0xa9, 0x0e, 0x8d, 0x4f, 0x30, 0xfa, 0x00, 0x6e, 0x8a, 0x16, 0x36, 0xd6, 0x87, 0xa6, 0xae, - 0x99, 0xdd, 0x73, 0xd5, 0xe9, 0x9e, 0xe2, 0x3e, 0x6e, 0xe5, 0xe9, 0x28, 0x16, 0x57, 0x7d, 0x6c, - 0x15, 0xcf, 0xe6, 0x90, 0x9a, 0x28, 0x0b, 0xbc, 0x75, 0x54, 0x81, 0x74, 0x58, 0x16, 0x8e, 0xfd, - 0xd9, 0xab, 0x03, 0xcd, 0xd6, 0xfa, 0xd8, 0xc5, 0xb6, 0xd3, 0x2a, 0x50, 0xe7, 0xb7, 0x83, 0xd8, - 0x6c, 0x7b, 0x3f, 0x0f, 0x3c, 0x3b, 0x65, 0x91, 0xbb, 0x89, 0x53, 0x92, 0xd5, 0x1a, 0x68, 0xb6, - 0x6b, 0x62, 0x5b, 0x35, 0xf4, 0x56, 0x91, 0xad, 0x16, 0x97, 0x74, 0x74, 0xd9, 0x80, 0x1a, 0x5b, - 0xac, 0xfb, 0x86, 0xe3, 0x76, 0x5c, 0xdc, 0x8f, 0x5d, 0xb4, 0x30, 0xf4, 0xd9, 0x4b, 0x41, 0x2f, - 0x7f, 0x9e, 0x83, 0x26, 0xeb, 0x6b, 0x8b, 0xca, 0x78, 0xb8, 0xa1, 0x35, 0x28, 0x9c, 0xd2, 0x90, - 0x6b, 0xd5, 0xa9, 0xe3, 0x85, 0x55, 0x6f, 0x3b, 0x84, 0x22, 0x52, 0xe1, 0x66, 0xd7, 0x1c, 0x56, - 0x49, 0x11, 0x91, 0xbb, 0x5c, 0x44, 0x4c, 0x3f, 0xcb, 0x88, 0xc8, 0x5f, 0x7f, 0x44, 0x14, 0xa2, - 0x11, 0xf1, 0x43, 0x98, 0x0b, 0xaf, 0x92, 0x33, 0xb0, 0x4c, 0x07, 0xa3, 0xbb, 0x50, 0x38, 0xa2, - 0x72, 0x8a, 0x7b, 0x65, 0xbd, 0xe1, 0x2f, 0x13, 0xb3, 0x57, 0xb8, 0x5e, 0xfe, 0x00, 0x1a, 0x4c, - 0xb2, 0x83, 0xdd, 0xeb, 0x5c, 0x64, 0xf9, 0x2d, 0x98, 0x0d, 0x38, 0xbe, 0xf0, 0xb8, 0x1e, 0x8b, - 0xf8, 0x6b, 0xe3, 0x1e, 0xbe, 0xde, 0xf8, 0xf3, 0x51, 0x13, 0xbe, 0x2f, 0x3c, 0xba, 0xcf, 0x32, - 0x62, 0x76, 0x64, 0x2b, 0x5e, 0x7a, 0x70, 0xf3, 0x50, 0xe8, 0x0e, 0x6d, 0xc7, 0xb2, 0x05, 0x6b, - 0xb3, 0x27, 0x34, 0x07, 0xf9, 0x9e, 0xd1, 0x37, 0xd8, 0xee, 0xcd, 0x2b, 0xec, 0x01, 0x2d, 0x41, - 0x59, 0x37, 0x6c, 0xdc, 0x25, 0x21, 0x42, 0x23, 0x3e, 0xaf, 0xf8, 0x02, 0xf9, 0x43, 0x40, 0xc1, - 0x11, 0xf1, 0x29, 0xad, 0x42, 0xde, 0x70, 0x71, 0xdf, 0x69, 0x65, 0x6e, 0xe7, 0xee, 0x56, 0xd6, - 0x5b, 0xd1, 0x19, 0x09, 0x26, 0x51, 0x98, 0x19, 0x81, 0xab, 0x6f, 0xd9, 0x98, 0x76, 0x5c, 0x52, - 0xe8, 0x6f, 0xf9, 0x67, 0x19, 0x58, 0x64, 0xd6, 0x87, 0xd8, 0xdd, 0x70, 0x5d, 0xdb, 0x38, 0x1a, - 0x92, 0x2e, 0xaf, 0x95, 0x13, 0xc2, 0x81, 0x9e, 0x8d, 0x06, 0xfa, 0x0a, 0x2c, 0xc5, 0x0f, 0x81, - 0xcd, 0x53, 0xfe, 0x34, 0x03, 0xcd, 0x0d, 0x5d, 0xb7, 0xb1, 0xe3, 0x60, 0xfd, 0x01, 0xc9, 0x95, - 0xf7, 0x29, 0x66, 0x77, 0x05, 0x92, 0x6c, 0x45, 0xd1, 0x2a, 0xcf, 0xa3, 0xbe, 0x89, 0x40, 0x77, - 0x0b, 0xe6, 0x1c, 0xd7, 0xb2, 0xb5, 0x13, 0xac, 0x92, 0x44, 0xac, 0x6a, 0xcc, 0x1b, 0x27, 0xd0, - 0xd9, 0x55, 0x9a, 0x9d, 0xf7, 0x2d, 0x1d, 0xf3, 0x6e, 0x14, 0xc4, 0xcd, 0x03, 0x32, 0x79, 0x1b, - 0xd0, 0x81, 0x6d, 0x7d, 0x84, 0xbb, 0x6e, 0xc7, 0x3c, 0xb6, 0x2e, 0x0b, 0x90, 0xfc, 0x3a, 0x34, - 0x43, 0x6e, 0xf8, 0x62, 0xbe, 0x00, 0xd5, 0x01, 0x13, 0xab, 0x8e, 0xd6, 0x73, 0x39, 0x7e, 0x15, - 0x2e, 0x3b, 0xd4, 0x7a, 0xae, 0xfc, 0x8b, 0x22, 0x14, 0x1e, 0x1c, 0x91, 0x47, 0x12, 0x5c, 0x81, - 0x68, 0xae, 0x8a, 0xd8, 0x45, 0x2f, 0x41, 0x8d, 0x53, 0x12, 0xd6, 0x55, 0xc2, 0xad, 0x1c, 0xed, - 0x19, 0x4f, 0x7a, 0xa0, 0xb9, 0xa7, 0xa8, 0x05, 0xc5, 0xa7, 0xd8, 0x76, 0xfc, 0x58, 0x13, 0x8f, - 0x64, 0x3a, 0x8e, 0xab, 0xb9, 0x43, 0x87, 0xf2, 0x67, 0x2d, 0x38, 0x1d, 0xd6, 0xf5, 0xea, 0x21, - 0x55, 0x2b, 0xdc, 0x0c, 0xbd, 0x02, 0x65, 0xc7, 0xb5, 0xb1, 0xd6, 0x27, 0x4b, 0x4b, 0x68, 0xb1, - 0xba, 0xd9, 0x20, 0x49, 0xe7, 0x1f, 0x5f, 0xde, 0x2a, 0x1d, 0x52, 0x45, 0xa7, 0xad, 0x94, 0x98, - 0x49, 0x47, 0x8f, 0x24, 0xb0, 0xc2, 0xe5, 0x6a, 0x87, 0x0d, 0xd2, 0x27, 0xe9, 0x9d, 0xf8, 0x28, - 0x5e, 0xc0, 0x47, 0x89, 0x35, 0xdb, 0x20, 0x11, 0x01, 0xf8, 0x6c, 0x60, 0xd8, 0x98, 0xfa, 0x28, - 0x5d, 0x64, 0x1c, 0xbc, 0xdd, 0x86, 0x8b, 0x76, 0xa0, 0xe5, 0xa3, 0x4d, 0x70, 0xd2, 0x35, 0x57, - 0x53, 0x4d, 0xcb, 0xec, 0xe2, 0x56, 0x99, 0x42, 0x31, 0xc3, 0xa1, 0xc8, 0xef, 0x13, 0xa1, 0x32, - 0xef, 0x99, 0xef, 0x71, 0x6b, 0x2a, 0x47, 0xaf, 0x00, 0x1a, 0x75, 0xd4, 0x02, 0xba, 0x74, 0xb3, - 0x23, 0x6d, 0xd0, 0xb7, 0x01, 0x1d, 0x1b, 0x67, 0x58, 0x0f, 0xe7, 0xc9, 0x0a, 0xcd, 0x93, 0x0d, - 0xaa, 0x09, 0x66, 0xc9, 0x5d, 0x98, 0x1d, 0xcd, 0x8e, 0xd5, 0xf1, 0xd9, 0xb1, 0x61, 0x47, 0xd3, - 0xe2, 0x23, 0xb8, 0x11, 0x9f, 0x0e, 0x67, 0x26, 0x4c, 0x87, 0x73, 0x38, 0x21, 0x0f, 0xba, 0x96, - 0xab, 0xf5, 0xd8, 0x34, 0x6a, 0x74, 0x1a, 0x65, 0x2a, 0xa1, 0xe3, 0xbf, 0x05, 0x15, 0xc3, 0xec, - 0x19, 0x26, 0x66, 0xfa, 0x3a, 0xd5, 0x03, 0x13, 0x09, 0x03, 0x1b, 0xf7, 0x2d, 0x97, 0x1b, 0x34, - 0x98, 0x01, 0x13, 0x11, 0x03, 0xf9, 0x3d, 0x28, 0xb0, 0xa8, 0x45, 0x15, 0x28, 0x76, 0xf6, 0xdf, - 0xdf, 0xb8, 0xdf, 0x69, 0x37, 0xa6, 0xd0, 0x0c, 0x94, 0x1f, 0x1d, 0xdc, 0x7f, 0xb0, 0xd1, 0xee, - 0xec, 0xef, 0x34, 0x32, 0xa8, 0x06, 0xb0, 0xf5, 0x60, 0x6f, 0xaf, 0xf3, 0xf0, 0x21, 0x79, 0xce, - 0x12, 0x35, 0x7f, 0xde, 0x6e, 0x37, 0x72, 0xa8, 0x0a, 0xa5, 0xf6, 0xf6, 0xfd, 0x6d, 0xaa, 0x9c, - 0x96, 0x3f, 0xcd, 0x01, 0x62, 0x1b, 0x62, 0x13, 0x9f, 0x18, 0xe6, 0x55, 0xb2, 0xc4, 0xb3, 0xd9, - 0xc8, 0xe1, 0x00, 0x9f, 0xbe, 0x5c, 0x80, 0xc7, 0x86, 0x4e, 0xf1, 0x5a, 0x43, 0xa7, 0x74, 0x95, - 0xd0, 0x91, 0xff, 0x90, 0x85, 0x66, 0x68, 0x19, 0x38, 0x9b, 0x3e, 0x33, 0x58, 0x43, 0x74, 0x37, - 0x3d, 0x96, 0xee, 0x62, 0x01, 0xcc, 0x5f, 0x2b, 0x80, 0x85, 0x2b, 0x01, 0xf8, 0xef, 0x8c, 0x00, - 0x70, 0xcb, 0xea, 0x93, 0x8c, 0x79, 0xd9, 0x40, 0x0e, 0x01, 0x93, 0x19, 0x0b, 0x4c, 0x1a, 0x75, - 0x66, 0xaf, 0x4e, 0x9d, 0xb9, 0x04, 0xea, 0x94, 0xe7, 0x61, 0x2e, 0x3c, 0x5d, 0x5e, 0x63, 0xfc, - 0x32, 0x03, 0x0d, 0xa6, 0xb8, 0x4a, 0xad, 0xfc, 0xac, 0xc2, 0x8e, 0x14, 0xdc, 0x81, 0xd1, 0xf9, - 0x25, 0xad, 0x45, 0x85, 0xa3, 0x25, 0x2d, 0x33, 0x56, 0xb8, 0x5e, 0xfe, 0x75, 0x56, 0xb4, 0xbf, - 0x6a, 0x49, 0x1b, 0x3b, 0xbd, 0x6f, 0x42, 0x23, 0x30, 0x3d, 0x1b, 0x1f, 0x1b, 0x67, 0x7c, 0x82, - 0x75, 0x7f, 0x82, 0x54, 0x1c, 0x36, 0xe5, 0xf5, 0x71, 0x2e, 0x62, 0xba, 0xc5, 0x0a, 0xe5, 0x25, - 0x28, 0xdb, 0x98, 0x98, 0x18, 0x4f, 0xd9, 0x69, 0xae, 0xa4, 0xf8, 0x02, 0xbf, 0x8c, 0xce, 0x07, - 0xcb, 0xe8, 0x0e, 0xd4, 0xd9, 0x94, 0x55, 0xc3, 0xec, 0xf6, 0x86, 0x3a, 0xf6, 0xf7, 0x47, 0x04, - 0x1b, 0x51, 0x1c, 0x77, 0xb8, 0x9d, 0x52, 0x63, 0x0d, 0xc5, 0x33, 0xa9, 0xb9, 0x83, 0x90, 0x8d, - 0xad, 0xb9, 0xc3, 0x6e, 0xd3, 0x6a, 0xee, 0x3f, 0xe6, 0xa0, 0x16, 0xb6, 0x8e, 0x09, 0x90, 0xcc, - 0x98, 0x00, 0xc9, 0x26, 0xd5, 0x6d, 0xb9, 0xc9, 0xea, 0xb6, 0x70, 0x21, 0x36, 0x7d, 0x0d, 0x85, - 0x58, 0xfe, 0x1a, 0x0a, 0xb1, 0xc2, 0xf5, 0x17, 0x62, 0xc5, 0xab, 0xb3, 0x49, 0x29, 0x89, 0x4d, - 0xbe, 0x03, 0xf3, 0xf1, 0xd1, 0x84, 0x24, 0x28, 0x79, 0xcd, 0x33, 0x74, 0xed, 0xbd, 0x67, 0xf9, - 0xf3, 0x0c, 0xb4, 0x02, 0x49, 0xeb, 0x8a, 0x87, 0xe0, 0x67, 0xc6, 0x39, 0x2e, 0xdc, 0x8c, 0x19, - 0x25, 0xdf, 0x07, 0x17, 0xa4, 0x7b, 0x9f, 0xaa, 0xb2, 0x63, 0xa8, 0xea, 0xa7, 0xa2, 0xd7, 0x77, - 0x0c, 0xd3, 0x70, 0x4e, 0xaf, 0x08, 0xce, 0xc5, 0x86, 0x29, 0x2f, 0x81, 0x14, 0xd7, 0x39, 0xcf, - 0x11, 0xff, 0xc9, 0x42, 0xe5, 0x50, 0x73, 0x45, 0xbb, 0x67, 0x57, 0x64, 0xbc, 0x01, 0xe0, 0xe7, - 0xff, 0x49, 0x2e, 0xb2, 0x02, 0xe6, 0xa8, 0x03, 0x33, 0x74, 0x83, 0x92, 0x32, 0x41, 0xd7, 0x5c, - 0x7c, 0xa1, 0x7d, 0x59, 0x15, 0x4d, 0xdb, 0x9a, 0x8b, 0xd1, 0x1e, 0xd4, 0xe9, 0x1e, 0x0b, 0x38, - 0xbb, 0xc8, 0x06, 0xad, 0xf9, 0x8d, 0xa9, 0xbb, 0x35, 0x68, 0x3a, 0x9a, 0x8b, 0x7b, 0x3d, 0x83, - 0x96, 0xea, 0x27, 0xa6, 0xe6, 0x0e, 0x6d, 0x7e, 0x52, 0x52, 0x90, 0xa7, 0x3a, 0x14, 0x1a, 0xf9, - 0xab, 0x2c, 0x14, 0xf9, 0x49, 0xe6, 0xa2, 0x01, 0xf7, 0x5d, 0x28, 0x0d, 0x2c, 0xc7, 0x70, 0x05, - 0x55, 0x56, 0xd6, 0x6f, 0xfa, 0xb1, 0xc2, 0x7d, 0x1e, 0x70, 0x03, 0xc5, 0x33, 0x45, 0x6f, 0x41, - 0xd3, 0x5f, 0xba, 0x27, 0xf8, 0x9c, 0x73, 0x48, 0x2e, 0x8e, 0x43, 0x7c, 0x3e, 0xb8, 0x87, 0xcf, - 0x19, 0x7d, 0xdc, 0x81, 0x99, 0x50, 0x73, 0x56, 0x21, 0x2a, 0xd5, 0xa0, 0x25, 0x5a, 0x85, 0x26, - 0x39, 0xa7, 0xa8, 0xbe, 0x25, 0x65, 0x89, 0x3c, 0x3d, 0xb6, 0xcc, 0x12, 0xd5, 0xb6, 0xd0, 0xb4, - 0xc9, 0x69, 0x6f, 0xdd, 0xab, 0xfc, 0xb0, 0xae, 0xf2, 0x93, 0x10, 0x6d, 0xc1, 0x6e, 0x0c, 0xfd, - 0x01, 0x77, 0xa8, 0x8e, 0xb6, 0x79, 0x19, 0x0a, 0x03, 0x03, 0x77, 0xb1, 0xd3, 0x2a, 0xd2, 0x3c, - 0x55, 0xf7, 0x27, 0x7f, 0x40, 0xe4, 0x0a, 0x57, 0xcb, 0xbb, 0x90, 0xa7, 0x02, 0xb4, 0x08, 0x65, - 0x2a, 0x52, 0xcd, 0x61, 0x9f, 0xe2, 0x9b, 0x57, 0x4a, 0x54, 0xb0, 0x3f, 0xec, 0x23, 0x19, 0xa6, - 0x4d, 0x4b, 0x17, 0x95, 0x59, 0x8d, 0xe3, 0x50, 0xd8, 0xb7, 0x74, 0xdc, 0x69, 0x2b, 0x54, 0x27, - 0xef, 0x42, 0x3d, 0x82, 0x2b, 0x39, 0x98, 0x0d, 0x34, 0xdb, 0x25, 0x2e, 0x8f, 0xb0, 0xcd, 0xbd, - 0xd2, 0xab, 0xa0, 0x7d, 0x2a, 0x21, 0x49, 0xdc, 0x30, 0x75, 0x7c, 0x26, 0xee, 0xc2, 0xe8, 0x83, - 0xfc, 0xb7, 0x0c, 0x34, 0xb9, 0xab, 0xab, 0x1d, 0xae, 0x9e, 0x4f, 0xcc, 0x7c, 0x03, 0xea, 0x7d, - 0xed, 0x4c, 0xa5, 0x97, 0x4f, 0x2a, 0xab, 0x49, 0xd8, 0x95, 0xf5, 0x4c, 0x5f, 0x3b, 0xf3, 0xef, - 0xa2, 0xe4, 0xbf, 0x64, 0x60, 0x2e, 0x3c, 0x2d, 0xce, 0xa5, 0xaf, 0x02, 0x88, 0x83, 0xbc, 0x37, - 0xce, 0x59, 0x3e, 0xce, 0x32, 0x6f, 0xd1, 0x69, 0x2b, 0x65, 0x6e, 0x44, 0x8f, 0x15, 0x0d, 0x4d, - 0x5c, 0x88, 0xb1, 0x2e, 0x9d, 0x56, 0x96, 0x2e, 0xf4, 0xb2, 0x3f, 0xe2, 0x98, 0x2b, 0x33, 0xa5, - 0xee, 0x35, 0xa3, 0xcf, 0x0e, 0xbd, 0xae, 0xb7, 0x8d, 0xa7, 0x9a, 0x8b, 0x69, 0xbc, 0xb2, 0x40, - 0x5f, 0xe0, 0x9d, 0xd7, 0x69, 0x68, 0x1c, 0x30, 0xfd, 0x3d, 0x7c, 0xae, 0xc0, 0xc0, 0xfb, 0x2d, - 0xff, 0x3d, 0xeb, 0x4d, 0xe7, 0x8a, 0x47, 0x87, 0x8b, 0xcf, 0x3f, 0x61, 0x9b, 0x66, 0x2f, 0xbb, - 0x4d, 0x73, 0x93, 0x6f, 0xd3, 0xe9, 0xa4, 0x6d, 0xba, 0x03, 0x33, 0xc3, 0x41, 0xcf, 0xd2, 0x74, - 0xd5, 0xc6, 0xce, 0xb0, 0x47, 0xea, 0x21, 0xb2, 0x20, 0xf2, 0x68, 0x08, 0x11, 0x50, 0x1f, 0x51, - 0x53, 0x85, 0x5a, 0x2a, 0xd5, 0x61, 0xe0, 0x49, 0xfe, 0x79, 0x06, 0x5a, 0x49, 0xa6, 0xe9, 0xdb, - 0xf4, 0x65, 0x28, 0xd2, 0xeb, 0x4d, 0x71, 0xc9, 0x3a, 0xb2, 0x53, 0x0b, 0x44, 0xdd, 0xd1, 0xd1, - 0x4b, 0x30, 0x7d, 0xaa, 0x39, 0xa7, 0xfc, 0xdd, 0xdd, 0xac, 0xb8, 0x38, 0xa5, 0xdd, 0xed, 0x6a, - 0xce, 0xa9, 0x42, 0xd5, 0xf2, 0x7f, 0xb3, 0x50, 0x25, 0x09, 0x4f, 0x2c, 0x01, 0x5a, 0x8f, 0x6e, - 0xa8, 0xca, 0xfa, 0x8d, 0xc0, 0xfc, 0xfc, 0xdc, 0x18, 0xd8, 0x55, 0x11, 0x12, 0xc8, 0x26, 0x93, - 0x40, 0x2e, 0x40, 0x02, 0xe8, 0x35, 0x98, 0xb1, 0x2d, 0xcb, 0x55, 0xd9, 0x6c, 0xbd, 0xbb, 0xc5, - 0x3a, 0x9f, 0x51, 0x91, 0x8e, 0xb5, 0xd3, 0x56, 0x2a, 0xc4, 0x8a, 0x3d, 0xe8, 0xe8, 0x3d, 0xb8, - 0x61, 0xd9, 0xc6, 0x89, 0x61, 0x6a, 0xbd, 0xe0, 0x7e, 0x24, 0x87, 0x80, 0x09, 0x36, 0x47, 0x53, - 0xb4, 0xf5, 0x65, 0xce, 0x68, 0x3a, 0x2d, 0x5e, 0x3a, 0x9d, 0x26, 0xe4, 0xbf, 0x52, 0x62, 0xfe, - 0x6b, 0xc3, 0x8d, 0xc8, 0x0e, 0xe3, 0x8c, 0xf1, 0x2d, 0x98, 0x75, 0x86, 0xdd, 0x2e, 0x76, 0x9c, - 0xe3, 0x61, 0x4f, 0xe5, 0x4c, 0xcf, 0xa2, 0xa1, 0xe1, 0x2b, 0x0e, 0x18, 0xc5, 0xff, 0x39, 0xeb, - 0xc5, 0xd3, 0x9e, 0xf6, 0x04, 0xb3, 0x2c, 0xf1, 0x7f, 0xce, 0xa9, 0xcf, 0x23, 0x0f, 0x27, 0xe6, - 0xd5, 0x7c, 0x62, 0x5e, 0x95, 0x17, 0xe1, 0x66, 0x0c, 0x94, 0xbc, 0x3e, 0xfc, 0x4d, 0xc6, 0xd3, - 0x5e, 0x47, 0x61, 0xff, 0x5c, 0x90, 0x96, 0xff, 0x9a, 0x01, 0x29, 0x6e, 0xd0, 0x5f, 0xeb, 0xdc, - 0xf4, 0x7b, 0x7f, 0x52, 0xd7, 0x72, 0x8c, 0xb8, 0x38, 0x0a, 0x6f, 0x42, 0x91, 0xa5, 0x01, 0x31, - 0xf9, 0x84, 0x3c, 0xe0, 0xc1, 0x4d, 0xf2, 0x80, 0x68, 0x32, 0x92, 0x02, 0x82, 0x56, 0xcf, 0x37, - 0x05, 0x2c, 0xc3, 0x62, 0x2c, 0x90, 0x3c, 0xe4, 0xbf, 0xc8, 0x00, 0xe2, 0xfa, 0x2b, 0xdd, 0x2c, - 0x5d, 0x30, 0xd6, 0x37, 0xa1, 0xce, 0xee, 0x8e, 0xd4, 0xc9, 0x43, 0xbe, 0xc6, 0x5a, 0x78, 0xc5, - 0xa9, 0x77, 0x81, 0x94, 0x0b, 0x5c, 0x20, 0xc9, 0x8f, 0xbd, 0xd2, 0x33, 0x74, 0xed, 0xb3, 0x16, - 0xbe, 0xf6, 0x19, 0xed, 0x66, 0x92, 0x7b, 0x1f, 0xbf, 0x42, 0xf6, 0xee, 0x7d, 0x82, 0x9b, 0x36, - 0x33, 0xf9, 0xa6, 0xfd, 0x5d, 0x06, 0xe6, 0xb9, 0xb6, 0x6d, 0x7d, 0x6c, 0xb2, 0xfa, 0xe0, 0x6b, - 0x03, 0xbd, 0xfc, 0xdb, 0x1c, 0x2c, 0x8c, 0x0c, 0xff, 0xeb, 0x4c, 0x38, 0xc9, 0xb9, 0x64, 0x3a, - 0xf9, 0x8c, 0xf6, 0x02, 0x54, 0x43, 0xef, 0xef, 0xd8, 0x01, 0xb0, 0xe2, 0x04, 0x5e, 0xdd, 0x25, - 0xa4, 0xc1, 0xc2, 0x65, 0xd3, 0x60, 0x31, 0x26, 0x0d, 0xbe, 0x02, 0xd3, 0x26, 0x3e, 0x13, 0xef, - 0x40, 0x53, 0x56, 0x91, 0x9a, 0xc9, 0x1f, 0x43, 0x75, 0x53, 0x73, 0xbb, 0xa7, 0x97, 0x8e, 0xb7, - 0xef, 0x41, 0xc9, 0x66, 0x0a, 0xb1, 0x9b, 0xa4, 0xc0, 0x87, 0x0b, 0x01, 0xd7, 0x74, 0x3b, 0x79, - 0xb6, 0xf2, 0x17, 0x00, 0x8d, 0xa8, 0x1a, 0xb5, 0x61, 0x86, 0x5d, 0xba, 0xa8, 0xec, 0x52, 0x92, - 0x6f, 0xa2, 0xe5, 0xe8, 0xa7, 0x10, 0xa1, 0x0f, 0x9d, 0x76, 0xa7, 0x94, 0xea, 0x51, 0x40, 0x8c, - 0xde, 0x00, 0xe0, 0x5e, 0x4e, 0xb0, 0xff, 0x55, 0x55, 0xc4, 0x85, 0xff, 0x5e, 0x60, 0x77, 0x4a, - 0x29, 0x1f, 0x09, 0x59, 0x60, 0x08, 0x3a, 0xe5, 0x46, 0xce, 0xa8, 0x23, 0x43, 0x08, 0xa5, 0x20, - 0x7f, 0x08, 0x4c, 0x8c, 0x7e, 0x00, 0x15, 0xee, 0xa5, 0x67, 0x38, 0xae, 0x77, 0xe7, 0x13, 0xf3, - 0x45, 0x87, 0xef, 0x81, 0x0f, 0x9a, 0x08, 0xd1, 0x06, 0x54, 0xf9, 0xc5, 0xf7, 0x11, 0xc9, 0xe2, - 0xfc, 0x9e, 0x66, 0x29, 0x7a, 0xcd, 0x16, 0x3c, 0x4f, 0xef, 0x4e, 0x29, 0x15, 0xcb, 0x97, 0x92, - 0x89, 0x70, 0x17, 0x5d, 0x5a, 0x6d, 0xf2, 0x4a, 0x77, 0x39, 0xea, 0x23, 0x74, 0xda, 0x23, 0x13, - 0xb1, 0x02, 0x62, 0x82, 0x25, 0xf7, 0x42, 0xb0, 0x2c, 0x45, 0xb1, 0x8c, 0xbe, 0x63, 0x21, 0x58, - 0x5a, 0x42, 0x46, 0x50, 0xe0, 0x8d, 0x29, 0x0a, 0xe5, 0x28, 0x0a, 0x23, 0xef, 0x30, 0x08, 0x0a, - 0x96, 0x27, 0x44, 0x0f, 0xa1, 0x19, 0x44, 0x41, 0xac, 0x08, 0x50, 0x3f, 0x72, 0x2c, 0x18, 0xd1, - 0x65, 0x99, 0xb5, 0xa2, 0x3a, 0xf4, 0x01, 0xcc, 0x71, 0xaf, 0xc7, 0x34, 0x07, 0x0a, 0xb7, 0x15, - 0xea, 0xf6, 0x4e, 0xd4, 0x6d, 0x4c, 0xc5, 0xb1, 0x3b, 0xa5, 0x20, 0x6b, 0x44, 0x49, 0x10, 0x17, - 0x0c, 0xc0, 0x56, 0xad, 0x1a, 0x45, 0x3c, 0xe6, 0x1a, 0x84, 0x20, 0xee, 0x04, 0xc4, 0x68, 0x07, - 0x6a, 0xc2, 0x0b, 0x5f, 0x38, 0xf6, 0x3a, 0x7e, 0x65, 0xc4, 0x4d, 0x74, 0xe5, 0x44, 0xef, 0x7c, - 0xe9, 0x1e, 0x42, 0x53, 0x38, 0xea, 0x6b, 0x4f, 0x30, 0xe7, 0x31, 0xfa, 0x42, 0x3e, 0xae, 0x7e, - 0x19, 0x39, 0x4c, 0x10, 0xf4, 0x9c, 0xa8, 0x8e, 0xa0, 0x17, 0x9a, 0xa4, 0x40, 0xaf, 0x1e, 0x45, - 0x2f, 0xb1, 0x74, 0x26, 0xe8, 0x39, 0x23, 0x4a, 0xf4, 0x18, 0x6e, 0x08, 0xc7, 0xe1, 0x75, 0x69, - 0x50, 0xcf, 0x2f, 0x8e, 0x78, 0x8e, 0x5f, 0x18, 0x31, 0xe7, 0xd0, 0xca, 0x6c, 0xf8, 0xdc, 0x4c, - 0x23, 0x71, 0x36, 0xba, 0x9d, 0x46, 0x8b, 0x1e, 0xb2, 0x9d, 0x1c, 0x5f, 0x8a, 0xf6, 0xa0, 0x21, - 0x5c, 0xe8, 0x3c, 0xc9, 0xb5, 0x50, 0xf4, 0x5d, 0x54, 0x7c, 0x12, 0xdf, 0x9d, 0x52, 0xea, 0x4e, - 0x58, 0x83, 0xb6, 0xa1, 0x66, 0xe3, 0xa7, 0xd6, 0x13, 0xac, 0x8a, 0x8f, 0x81, 0x9b, 0xd1, 0x60, - 0x51, 0xa8, 0x7e, 0xe3, 0xa0, 0x43, 0xb2, 0x93, 0x1f, 0x2c, 0xac, 0xd9, 0x06, 0xfd, 0x66, 0x78, - 0xb3, 0x0c, 0x45, 0xae, 0x92, 0xdf, 0x85, 0x19, 0xce, 0xa7, 0x3c, 0xf5, 0x7e, 0x1f, 0xca, 0x36, - 0xff, 0x2d, 0xa8, 0x79, 0x71, 0x84, 0x9a, 0x99, 0x9e, 0x72, 0xb3, 0x6f, 0x2d, 0xff, 0x0b, 0x60, - 0x76, 0xc4, 0x00, 0x6d, 0xc7, 0xb3, 0xf3, 0x4a, 0x12, 0x3b, 0xb3, 0xa6, 0x23, 0xf4, 0xfc, 0x66, - 0x0c, 0x3d, 0x2f, 0xc6, 0xd2, 0xb3, 0xe7, 0x20, 0xc0, 0xcf, 0xdb, 0xf1, 0xfc, 0xbc, 0x92, 0xc4, - 0xcf, 0xd1, 0x41, 0xf0, 0x88, 0x78, 0x3b, 0x8e, 0xa0, 0x97, 0xe2, 0x09, 0xda, 0x73, 0x11, 0x64, - 0xe8, 0xcd, 0x58, 0x86, 0x5e, 0x4e, 0x60, 0x68, 0xcf, 0x45, 0x88, 0xa2, 0xb7, 0xe3, 0x29, 0x7a, - 0x25, 0x89, 0xa2, 0xfd, 0xb9, 0x84, 0x38, 0xfa, 0xcd, 0x18, 0x8e, 0x5e, 0x8c, 0xe5, 0x68, 0x1f, - 0x50, 0x9f, 0xa4, 0xdf, 0x8e, 0x23, 0xe9, 0xa5, 0x78, 0x92, 0xf6, 0x91, 0x08, 0xb0, 0xf4, 0xa3, - 0x34, 0x96, 0xbe, 0x93, 0xca, 0xd2, 0x9e, 0xbf, 0x18, 0x9a, 0xfe, 0x30, 0x95, 0xa6, 0x5f, 0x4c, - 0xa7, 0x69, 0xcf, 0x71, 0x1c, 0x4f, 0x6f, 0xc7, 0xf3, 0xf4, 0x4a, 0x12, 0x4f, 0xfb, 0xb0, 0x87, - 0x88, 0x7a, 0x37, 0x81, 0xa8, 0x6f, 0x25, 0x12, 0xb5, 0xe7, 0x28, 0xc2, 0xd4, 0x8f, 0xd2, 0x98, - 0xfa, 0x4e, 0x2a, 0x53, 0xfb, 0x08, 0x8e, 0x52, 0xf5, 0x87, 0xa9, 0x54, 0xfd, 0x62, 0x3a, 0x55, - 0xfb, 0x08, 0xc6, 0x70, 0xf5, 0x8f, 0xd2, 0xb9, 0xfa, 0xa5, 0x31, 0x5c, 0xed, 0xf9, 0x8e, 0x25, - 0xeb, 0xcd, 0x58, 0xb2, 0x5e, 0x4e, 0x20, 0x6b, 0x7f, 0x67, 0x05, 0xd9, 0x7a, 0x3f, 0x91, 0xad, - 0x5f, 0x48, 0x61, 0x6b, 0xcf, 0xd7, 0x08, 0x5d, 0xbf, 0x93, 0x40, 0xd7, 0x2b, 0x49, 0x74, 0xed, - 0xc7, 0x4c, 0x88, 0xaf, 0x01, 0x4a, 0xde, 0x61, 0x5b, 0x85, 0x66, 0x0c, 0xc5, 0x5f, 0xbc, 0x02, - 0x4f, 0xfa, 0x43, 0x89, 0x3c, 0x0f, 0x73, 0x71, 0x83, 0x5a, 0xff, 0xaa, 0x0a, 0xa5, 0x3d, 0xee, - 0x13, 0xed, 0x41, 0x95, 0xf1, 0x32, 0xff, 0x6f, 0x49, 0x7a, 0xad, 0x2d, 0x8d, 0x21, 0x7b, 0xd4, - 0x86, 0xf2, 0x0e, 0x76, 0xb9, 0xaf, 0x94, 0xa2, 0x5b, 0x4a, 0x63, 0x7c, 0x32, 0x28, 0x16, 0x0c, - 0x49, 0x83, 0x0a, 0x65, 0x7d, 0x69, 0x0c, 0xf9, 0xa3, 0x5d, 0xa8, 0x90, 0xa8, 0x60, 0x3a, 0x07, - 0xa5, 0xd5, 0xe1, 0x52, 0x6a, 0x0e, 0x40, 0xef, 0x42, 0x85, 0xee, 0x03, 0xfe, 0xdd, 0x6e, 0x6a, - 0x41, 0x2e, 0xa5, 0x27, 0x03, 0x8a, 0x3c, 0xdd, 0xff, 0xdc, 0x59, 0x7a, 0x65, 0x2e, 0x8d, 0xc9, - 0x0a, 0x1c, 0x79, 0xee, 0x2b, 0xa5, 0x44, 0x97, 0xd2, 0x52, 0x83, 0x80, 0x8a, 0x29, 0x42, 0x50, - 0x8d, 0x14, 0xeb, 0x52, 0x6a, 0x92, 0x40, 0x3f, 0x86, 0xd9, 0x00, 0x65, 0xf0, 0x71, 0x4d, 0x50, - 0xb4, 0x4b, 0x93, 0xa4, 0x0c, 0xa4, 0x02, 0x0a, 0x92, 0x06, 0x77, 0x3f, 0x49, 0xf1, 0x2e, 0x4d, - 0x94, 0x3a, 0xc8, 0xea, 0xd0, 0x7e, 0xc5, 0x0b, 0xeb, 0xf4, 0x2a, 0x5e, 0x1a, 0x93, 0x3c, 0xd0, - 0x01, 0xcc, 0xb0, 0xf5, 0x12, 0xfe, 0xc6, 0x94, 0xf3, 0xd2, 0xb8, 0x2c, 0x42, 0xf0, 0xf5, 0xb9, - 0x5e, 0x78, 0x9d, 0xa0, 0xac, 0x97, 0x26, 0x49, 0x28, 0x04, 0xdf, 0x00, 0xec, 0xc2, 0xfd, 0x24, - 0xe5, 0xbd, 0x34, 0x51, 0x62, 0x41, 0x47, 0xd0, 0x0c, 0xe2, 0x2e, 0x7a, 0x98, 0xa8, 0xcc, 0x97, - 0x26, 0x4b, 0x30, 0xe8, 0x1e, 0x54, 0x49, 0x48, 0x72, 0x13, 0x07, 0xa5, 0x16, 0xfc, 0x52, 0x7a, - 0x86, 0x41, 0xef, 0x43, 0x5d, 0xa4, 0x03, 0x31, 0xd8, 0xb1, 0x95, 0xbf, 0x34, 0x3e, 0xdb, 0xa0, - 0xd7, 0x21, 0x4f, 0x4b, 0x6d, 0x34, 0x1f, 0x7f, 0x6f, 0x22, 0x2d, 0x24, 0x14, 0xed, 0x84, 0x8c, - 0x02, 0x7f, 0x3d, 0x08, 0xce, 0x6e, 0xf4, 0x8f, 0x0d, 0xc1, 0xd9, 0xc5, 0xfd, 0x5f, 0x61, 0x0f, - 0xaa, 0xc1, 0x5c, 0x81, 0xd2, 0xcf, 0x21, 0xd2, 0x98, 0xbc, 0xb7, 0x39, 0xf7, 0x98, 0xfe, 0xe5, - 0xe2, 0xa3, 0x55, 0xc3, 0x5a, 0x23, 0xc5, 0x91, 0x65, 0xae, 0x0d, 0x8e, 0x8e, 0x0a, 0xf4, 0xed, - 0xda, 0x6b, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x99, 0x55, 0x49, 0x9a, 0x98, 0x39, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCMetainfoClient interface { - DRPCConn() drpc.Conn - - // Bucket - CreateBucket(ctx context.Context, in *BucketCreateRequest) (*BucketCreateResponse, error) - GetBucket(ctx context.Context, in *BucketGetRequest) (*BucketGetResponse, error) - DeleteBucket(ctx context.Context, in *BucketDeleteRequest) (*BucketDeleteResponse, error) - ListBuckets(ctx context.Context, in *BucketListRequest) (*BucketListResponse, error) - // Object - BeginObject(ctx context.Context, in *ObjectBeginRequest) (*ObjectBeginResponse, error) - CommitObject(ctx context.Context, in *ObjectCommitRequest) (*ObjectCommitResponse, error) - GetObject(ctx context.Context, in *ObjectGetRequest) (*ObjectGetResponse, error) - ListObjects(ctx context.Context, in *ObjectListRequest) (*ObjectListResponse, error) - BeginDeleteObject(ctx context.Context, in *ObjectBeginDeleteRequest) (*ObjectBeginDeleteResponse, error) - FinishDeleteObject(ctx context.Context, in *ObjectFinishDeleteRequest) (*ObjectFinishDeleteResponse, error) - BeginSegment(ctx context.Context, in *SegmentBeginRequest) (*SegmentBeginResponse, error) - CommitSegment(ctx context.Context, in *SegmentCommitRequest) (*SegmentCommitResponse, error) - MakeInlineSegment(ctx context.Context, in *SegmentMakeInlineRequest) (*SegmentMakeInlineResponse, error) - BeginDeleteSegment(ctx context.Context, in *SegmentBeginDeleteRequest) (*SegmentBeginDeleteResponse, error) - FinishDeleteSegment(ctx context.Context, in *SegmentFinishDeleteRequest) (*SegmentFinishDeleteResponse, error) - ListSegments(ctx context.Context, in *SegmentListRequest) (*SegmentListResponse, error) - DownloadSegment(ctx context.Context, in *SegmentDownloadRequest) (*SegmentDownloadResponse, error) - Batch(ctx context.Context, in *BatchRequest) (*BatchResponse, error) - ProjectInfo(ctx context.Context, in *ProjectInfoRequest) (*ProjectInfoResponse, error) - RevokeAPIKey(ctx context.Context, in *RevokeAPIKeyRequest) (*RevokeAPIKeyResponse, error) -} - -type drpcMetainfoClient struct { - cc drpc.Conn -} - -func NewDRPCMetainfoClient(cc drpc.Conn) DRPCMetainfoClient { - return &drpcMetainfoClient{cc} -} - -func (c *drpcMetainfoClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcMetainfoClient) CreateBucket(ctx context.Context, in *BucketCreateRequest) (*BucketCreateResponse, error) { - out := new(BucketCreateResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/CreateBucket", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) GetBucket(ctx context.Context, in *BucketGetRequest) (*BucketGetResponse, error) { - out := new(BucketGetResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/GetBucket", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) DeleteBucket(ctx context.Context, in *BucketDeleteRequest) (*BucketDeleteResponse, error) { - out := new(BucketDeleteResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/DeleteBucket", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) ListBuckets(ctx context.Context, in *BucketListRequest) (*BucketListResponse, error) { - out := new(BucketListResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/ListBuckets", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) BeginObject(ctx context.Context, in *ObjectBeginRequest) (*ObjectBeginResponse, error) { - out := new(ObjectBeginResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/BeginObject", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) CommitObject(ctx context.Context, in *ObjectCommitRequest) (*ObjectCommitResponse, error) { - out := new(ObjectCommitResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/CommitObject", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) GetObject(ctx context.Context, in *ObjectGetRequest) (*ObjectGetResponse, error) { - out := new(ObjectGetResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/GetObject", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) ListObjects(ctx context.Context, in *ObjectListRequest) (*ObjectListResponse, error) { - out := new(ObjectListResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/ListObjects", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) BeginDeleteObject(ctx context.Context, in *ObjectBeginDeleteRequest) (*ObjectBeginDeleteResponse, error) { - out := new(ObjectBeginDeleteResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/BeginDeleteObject", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) FinishDeleteObject(ctx context.Context, in *ObjectFinishDeleteRequest) (*ObjectFinishDeleteResponse, error) { - out := new(ObjectFinishDeleteResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/FinishDeleteObject", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) BeginSegment(ctx context.Context, in *SegmentBeginRequest) (*SegmentBeginResponse, error) { - out := new(SegmentBeginResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/BeginSegment", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) CommitSegment(ctx context.Context, in *SegmentCommitRequest) (*SegmentCommitResponse, error) { - out := new(SegmentCommitResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/CommitSegment", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) MakeInlineSegment(ctx context.Context, in *SegmentMakeInlineRequest) (*SegmentMakeInlineResponse, error) { - out := new(SegmentMakeInlineResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/MakeInlineSegment", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) BeginDeleteSegment(ctx context.Context, in *SegmentBeginDeleteRequest) (*SegmentBeginDeleteResponse, error) { - out := new(SegmentBeginDeleteResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/BeginDeleteSegment", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) FinishDeleteSegment(ctx context.Context, in *SegmentFinishDeleteRequest) (*SegmentFinishDeleteResponse, error) { - out := new(SegmentFinishDeleteResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/FinishDeleteSegment", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) ListSegments(ctx context.Context, in *SegmentListRequest) (*SegmentListResponse, error) { - out := new(SegmentListResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/ListSegments", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) DownloadSegment(ctx context.Context, in *SegmentDownloadRequest) (*SegmentDownloadResponse, error) { - out := new(SegmentDownloadResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/DownloadSegment", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) Batch(ctx context.Context, in *BatchRequest) (*BatchResponse, error) { - out := new(BatchResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/Batch", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) ProjectInfo(ctx context.Context, in *ProjectInfoRequest) (*ProjectInfoResponse, error) { - out := new(ProjectInfoResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/ProjectInfo", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcMetainfoClient) RevokeAPIKey(ctx context.Context, in *RevokeAPIKeyRequest) (*RevokeAPIKeyResponse, error) { - out := new(RevokeAPIKeyResponse) - err := c.cc.Invoke(ctx, "/metainfo.Metainfo/RevokeAPIKey", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCMetainfoServer interface { - // Bucket - CreateBucket(context.Context, *BucketCreateRequest) (*BucketCreateResponse, error) - GetBucket(context.Context, *BucketGetRequest) (*BucketGetResponse, error) - DeleteBucket(context.Context, *BucketDeleteRequest) (*BucketDeleteResponse, error) - ListBuckets(context.Context, *BucketListRequest) (*BucketListResponse, error) - // Object - BeginObject(context.Context, *ObjectBeginRequest) (*ObjectBeginResponse, error) - CommitObject(context.Context, *ObjectCommitRequest) (*ObjectCommitResponse, error) - GetObject(context.Context, *ObjectGetRequest) (*ObjectGetResponse, error) - ListObjects(context.Context, *ObjectListRequest) (*ObjectListResponse, error) - BeginDeleteObject(context.Context, *ObjectBeginDeleteRequest) (*ObjectBeginDeleteResponse, error) - FinishDeleteObject(context.Context, *ObjectFinishDeleteRequest) (*ObjectFinishDeleteResponse, error) - BeginSegment(context.Context, *SegmentBeginRequest) (*SegmentBeginResponse, error) - CommitSegment(context.Context, *SegmentCommitRequest) (*SegmentCommitResponse, error) - MakeInlineSegment(context.Context, *SegmentMakeInlineRequest) (*SegmentMakeInlineResponse, error) - BeginDeleteSegment(context.Context, *SegmentBeginDeleteRequest) (*SegmentBeginDeleteResponse, error) - FinishDeleteSegment(context.Context, *SegmentFinishDeleteRequest) (*SegmentFinishDeleteResponse, error) - ListSegments(context.Context, *SegmentListRequest) (*SegmentListResponse, error) - DownloadSegment(context.Context, *SegmentDownloadRequest) (*SegmentDownloadResponse, error) - Batch(context.Context, *BatchRequest) (*BatchResponse, error) - ProjectInfo(context.Context, *ProjectInfoRequest) (*ProjectInfoResponse, error) - RevokeAPIKey(context.Context, *RevokeAPIKeyRequest) (*RevokeAPIKeyResponse, error) -} - -type DRPCMetainfoDescription struct{} - -func (DRPCMetainfoDescription) NumMethods() int { return 20 } - -func (DRPCMetainfoDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/metainfo.Metainfo/CreateBucket", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - CreateBucket( - ctx, - in1.(*BucketCreateRequest), - ) - }, DRPCMetainfoServer.CreateBucket, true - case 1: - return "/metainfo.Metainfo/GetBucket", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - GetBucket( - ctx, - in1.(*BucketGetRequest), - ) - }, DRPCMetainfoServer.GetBucket, true - case 2: - return "/metainfo.Metainfo/DeleteBucket", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - DeleteBucket( - ctx, - in1.(*BucketDeleteRequest), - ) - }, DRPCMetainfoServer.DeleteBucket, true - case 3: - return "/metainfo.Metainfo/ListBuckets", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - ListBuckets( - ctx, - in1.(*BucketListRequest), - ) - }, DRPCMetainfoServer.ListBuckets, true - case 4: - return "/metainfo.Metainfo/BeginObject", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - BeginObject( - ctx, - in1.(*ObjectBeginRequest), - ) - }, DRPCMetainfoServer.BeginObject, true - case 5: - return "/metainfo.Metainfo/CommitObject", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - CommitObject( - ctx, - in1.(*ObjectCommitRequest), - ) - }, DRPCMetainfoServer.CommitObject, true - case 6: - return "/metainfo.Metainfo/GetObject", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - GetObject( - ctx, - in1.(*ObjectGetRequest), - ) - }, DRPCMetainfoServer.GetObject, true - case 7: - return "/metainfo.Metainfo/ListObjects", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - ListObjects( - ctx, - in1.(*ObjectListRequest), - ) - }, DRPCMetainfoServer.ListObjects, true - case 8: - return "/metainfo.Metainfo/BeginDeleteObject", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - BeginDeleteObject( - ctx, - in1.(*ObjectBeginDeleteRequest), - ) - }, DRPCMetainfoServer.BeginDeleteObject, true - case 9: - return "/metainfo.Metainfo/FinishDeleteObject", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - FinishDeleteObject( - ctx, - in1.(*ObjectFinishDeleteRequest), - ) - }, DRPCMetainfoServer.FinishDeleteObject, true - case 10: - return "/metainfo.Metainfo/BeginSegment", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - BeginSegment( - ctx, - in1.(*SegmentBeginRequest), - ) - }, DRPCMetainfoServer.BeginSegment, true - case 11: - return "/metainfo.Metainfo/CommitSegment", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - CommitSegment( - ctx, - in1.(*SegmentCommitRequest), - ) - }, DRPCMetainfoServer.CommitSegment, true - case 12: - return "/metainfo.Metainfo/MakeInlineSegment", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - MakeInlineSegment( - ctx, - in1.(*SegmentMakeInlineRequest), - ) - }, DRPCMetainfoServer.MakeInlineSegment, true - case 13: - return "/metainfo.Metainfo/BeginDeleteSegment", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - BeginDeleteSegment( - ctx, - in1.(*SegmentBeginDeleteRequest), - ) - }, DRPCMetainfoServer.BeginDeleteSegment, true - case 14: - return "/metainfo.Metainfo/FinishDeleteSegment", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - FinishDeleteSegment( - ctx, - in1.(*SegmentFinishDeleteRequest), - ) - }, DRPCMetainfoServer.FinishDeleteSegment, true - case 15: - return "/metainfo.Metainfo/ListSegments", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - ListSegments( - ctx, - in1.(*SegmentListRequest), - ) - }, DRPCMetainfoServer.ListSegments, true - case 16: - return "/metainfo.Metainfo/DownloadSegment", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - DownloadSegment( - ctx, - in1.(*SegmentDownloadRequest), - ) - }, DRPCMetainfoServer.DownloadSegment, true - case 17: - return "/metainfo.Metainfo/Batch", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - Batch( - ctx, - in1.(*BatchRequest), - ) - }, DRPCMetainfoServer.Batch, true - case 18: - return "/metainfo.Metainfo/ProjectInfo", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - ProjectInfo( - ctx, - in1.(*ProjectInfoRequest), - ) - }, DRPCMetainfoServer.ProjectInfo, true - case 19: - return "/metainfo.Metainfo/RevokeAPIKey", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCMetainfoServer). - RevokeAPIKey( - ctx, - in1.(*RevokeAPIKeyRequest), - ) - }, DRPCMetainfoServer.RevokeAPIKey, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterMetainfo(mux drpc.Mux, impl DRPCMetainfoServer) error { - return mux.Register(impl, DRPCMetainfoDescription{}) -} - -type DRPCMetainfo_CreateBucketStream interface { - drpc.Stream - SendAndClose(*BucketCreateResponse) error -} - -type drpcMetainfoCreateBucketStream struct { - drpc.Stream -} - -func (x *drpcMetainfoCreateBucketStream) SendAndClose(m *BucketCreateResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_GetBucketStream interface { - drpc.Stream - SendAndClose(*BucketGetResponse) error -} - -type drpcMetainfoGetBucketStream struct { - drpc.Stream -} - -func (x *drpcMetainfoGetBucketStream) SendAndClose(m *BucketGetResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_DeleteBucketStream interface { - drpc.Stream - SendAndClose(*BucketDeleteResponse) error -} - -type drpcMetainfoDeleteBucketStream struct { - drpc.Stream -} - -func (x *drpcMetainfoDeleteBucketStream) SendAndClose(m *BucketDeleteResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_ListBucketsStream interface { - drpc.Stream - SendAndClose(*BucketListResponse) error -} - -type drpcMetainfoListBucketsStream struct { - drpc.Stream -} - -func (x *drpcMetainfoListBucketsStream) SendAndClose(m *BucketListResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_BeginObjectStream interface { - drpc.Stream - SendAndClose(*ObjectBeginResponse) error -} - -type drpcMetainfoBeginObjectStream struct { - drpc.Stream -} - -func (x *drpcMetainfoBeginObjectStream) SendAndClose(m *ObjectBeginResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_CommitObjectStream interface { - drpc.Stream - SendAndClose(*ObjectCommitResponse) error -} - -type drpcMetainfoCommitObjectStream struct { - drpc.Stream -} - -func (x *drpcMetainfoCommitObjectStream) SendAndClose(m *ObjectCommitResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_GetObjectStream interface { - drpc.Stream - SendAndClose(*ObjectGetResponse) error -} - -type drpcMetainfoGetObjectStream struct { - drpc.Stream -} - -func (x *drpcMetainfoGetObjectStream) SendAndClose(m *ObjectGetResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_ListObjectsStream interface { - drpc.Stream - SendAndClose(*ObjectListResponse) error -} - -type drpcMetainfoListObjectsStream struct { - drpc.Stream -} - -func (x *drpcMetainfoListObjectsStream) SendAndClose(m *ObjectListResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_BeginDeleteObjectStream interface { - drpc.Stream - SendAndClose(*ObjectBeginDeleteResponse) error -} - -type drpcMetainfoBeginDeleteObjectStream struct { - drpc.Stream -} - -func (x *drpcMetainfoBeginDeleteObjectStream) SendAndClose(m *ObjectBeginDeleteResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_FinishDeleteObjectStream interface { - drpc.Stream - SendAndClose(*ObjectFinishDeleteResponse) error -} - -type drpcMetainfoFinishDeleteObjectStream struct { - drpc.Stream -} - -func (x *drpcMetainfoFinishDeleteObjectStream) SendAndClose(m *ObjectFinishDeleteResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_BeginSegmentStream interface { - drpc.Stream - SendAndClose(*SegmentBeginResponse) error -} - -type drpcMetainfoBeginSegmentStream struct { - drpc.Stream -} - -func (x *drpcMetainfoBeginSegmentStream) SendAndClose(m *SegmentBeginResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_CommitSegmentStream interface { - drpc.Stream - SendAndClose(*SegmentCommitResponse) error -} - -type drpcMetainfoCommitSegmentStream struct { - drpc.Stream -} - -func (x *drpcMetainfoCommitSegmentStream) SendAndClose(m *SegmentCommitResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_MakeInlineSegmentStream interface { - drpc.Stream - SendAndClose(*SegmentMakeInlineResponse) error -} - -type drpcMetainfoMakeInlineSegmentStream struct { - drpc.Stream -} - -func (x *drpcMetainfoMakeInlineSegmentStream) SendAndClose(m *SegmentMakeInlineResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_BeginDeleteSegmentStream interface { - drpc.Stream - SendAndClose(*SegmentBeginDeleteResponse) error -} - -type drpcMetainfoBeginDeleteSegmentStream struct { - drpc.Stream -} - -func (x *drpcMetainfoBeginDeleteSegmentStream) SendAndClose(m *SegmentBeginDeleteResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_FinishDeleteSegmentStream interface { - drpc.Stream - SendAndClose(*SegmentFinishDeleteResponse) error -} - -type drpcMetainfoFinishDeleteSegmentStream struct { - drpc.Stream -} - -func (x *drpcMetainfoFinishDeleteSegmentStream) SendAndClose(m *SegmentFinishDeleteResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_ListSegmentsStream interface { - drpc.Stream - SendAndClose(*SegmentListResponse) error -} - -type drpcMetainfoListSegmentsStream struct { - drpc.Stream -} - -func (x *drpcMetainfoListSegmentsStream) SendAndClose(m *SegmentListResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_DownloadSegmentStream interface { - drpc.Stream - SendAndClose(*SegmentDownloadResponse) error -} - -type drpcMetainfoDownloadSegmentStream struct { - drpc.Stream -} - -func (x *drpcMetainfoDownloadSegmentStream) SendAndClose(m *SegmentDownloadResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_BatchStream interface { - drpc.Stream - SendAndClose(*BatchResponse) error -} - -type drpcMetainfoBatchStream struct { - drpc.Stream -} - -func (x *drpcMetainfoBatchStream) SendAndClose(m *BatchResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_ProjectInfoStream interface { - drpc.Stream - SendAndClose(*ProjectInfoResponse) error -} - -type drpcMetainfoProjectInfoStream struct { - drpc.Stream -} - -func (x *drpcMetainfoProjectInfoStream) SendAndClose(m *ProjectInfoResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCMetainfo_RevokeAPIKeyStream interface { - drpc.Stream - SendAndClose(*RevokeAPIKeyResponse) error -} - -type drpcMetainfoRevokeAPIKeyStream struct { - drpc.Stream -} - -func (x *drpcMetainfoRevokeAPIKeyStream) SendAndClose(m *RevokeAPIKeyResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/metainfo.proto b/vendor/storj.io/common/pb/metainfo.proto deleted file mode 100644 index 7bede0359..000000000 --- a/vendor/storj.io/common/pb/metainfo.proto +++ /dev/null @@ -1,536 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package metainfo; - -import "encryption.proto"; -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "node.proto"; -import "pointerdb.proto"; -import "orders.proto"; - -// NOTE!!! -// * If someone will add stream_id or segment_id to existing or new message in this protobuf -// then Batch method (satellite/metainfo/batch.go) needs to be updated as well - -// Metainfo it's a satellite RPC service. -service Metainfo { - // Bucket - rpc CreateBucket(BucketCreateRequest) returns (BucketCreateResponse); - rpc GetBucket(BucketGetRequest) returns (BucketGetResponse); - rpc DeleteBucket(BucketDeleteRequest) returns (BucketDeleteResponse); - rpc ListBuckets(BucketListRequest) returns (BucketListResponse); - - // Object - rpc BeginObject(ObjectBeginRequest) returns (ObjectBeginResponse); - rpc CommitObject(ObjectCommitRequest) returns (ObjectCommitResponse); - rpc GetObject(ObjectGetRequest) returns (ObjectGetResponse); - rpc ListObjects(ObjectListRequest) returns (ObjectListResponse); - rpc BeginDeleteObject(ObjectBeginDeleteRequest) returns (ObjectBeginDeleteResponse); - rpc FinishDeleteObject(ObjectFinishDeleteRequest) returns (ObjectFinishDeleteResponse); - - rpc BeginSegment(SegmentBeginRequest) returns (SegmentBeginResponse); - rpc CommitSegment(SegmentCommitRequest) returns (SegmentCommitResponse); - rpc MakeInlineSegment(SegmentMakeInlineRequest) returns (SegmentMakeInlineResponse); - rpc BeginDeleteSegment(SegmentBeginDeleteRequest) returns (SegmentBeginDeleteResponse); - rpc FinishDeleteSegment(SegmentFinishDeleteRequest) returns (SegmentFinishDeleteResponse); - rpc ListSegments(SegmentListRequest) returns (SegmentListResponse); - rpc DownloadSegment(SegmentDownloadRequest) returns (SegmentDownloadResponse); - - rpc Batch(BatchRequest) returns (BatchResponse); - - rpc ProjectInfo(ProjectInfoRequest) returns (ProjectInfoResponse); - rpc RevokeAPIKey(RevokeAPIKeyRequest) returns (RevokeAPIKeyResponse); -} - -message RequestHeader { - bytes api_key = 1; - bytes user_agent = 2; -} - -message Bucket { - bytes name = 1; - encryption.CipherSuite path_cipher = 2; - - google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - int64 default_segment_size = 4; - pointerdb.RedundancyScheme default_redundancy_scheme = 5; - encryption.EncryptionParameters default_encryption_parameters = 6; - bytes partner_id = 7; -} - -message BucketListItem { - bytes name = 1; - - google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message BucketCreateRequest { - RequestHeader header = 15; - - bytes name = 1; - encryption.CipherSuite path_cipher = 2; - - int64 default_segment_size = 3; - pointerdb.RedundancyScheme default_redundancy_scheme = 4; - encryption.EncryptionParameters default_encryption_parameters = 5; - bytes partner_id = 6; -} - -message BucketCreateResponse { - Bucket bucket = 1; -} - -message BucketGetRequest { - RequestHeader header = 15; - - bytes name = 1; -} - -message BucketGetResponse { - Bucket bucket = 1; -} - -message BucketDeleteRequest { - RequestHeader header = 15; - - bytes name = 1; -} - -message BucketDeleteResponse { - Bucket bucket = 1; -} - -message BucketListRequest { - RequestHeader header = 15; - - bytes cursor = 1; - int32 limit = 2; - int32 direction = 3; -} - -message BucketListResponse { - repeated BucketListItem items = 1; - bool more = 2; -} - -message BucketSetAttributionRequest { - RequestHeader header = 15; - - bytes name = 1; - bytes partner_id = 2; -} - -message BucketSetAttributionResponse { -} - -message AddressedOrderLimit { - orders.OrderLimit limit = 1; - node.NodeAddress storage_node_address = 2; -} - -message ProjectInfoRequest { - RequestHeader header = 15; -} - -message ProjectInfoResponse { - bytes project_salt = 1; -} - -//--------------------------- -// Object -//--------------------------- - -message Object { - enum Status { - INVALID = 0; - UPLOADING = 1; - COMMITTING = 2; - COMMITTED = 3; - DELETING = 4; - } - - bytes bucket = 1; - bytes encrypted_path = 2; - int32 version = 3; - Status status = 4; - - bytes stream_id = 5 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - - google.protobuf.Timestamp created_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp status_at = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp expires_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes encrypted_metadata_nonce = 9 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_metadata = 10; - - int64 fixed_segment_size = 11; - pointerdb.RedundancyScheme redundancy_scheme = 12; - encryption.EncryptionParameters encryption_parameters = 13; - - int64 total_size = 14; // total size of object - int64 inline_size = 15; // size of inline part of object - int64 remote_size = 16; // size of remote part of object -} - -message ObjectBeginRequest { - RequestHeader header = 15; - - bytes bucket = 1; - bytes encrypted_path = 2; - int32 version = 3; - - google.protobuf.Timestamp expires_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - pointerdb.RedundancyScheme redundancy_scheme = 7; // can be zero - encryption.EncryptionParameters encryption_parameters = 8; // can be zero -} - -message ObjectBeginResponse { - bytes bucket = 1; - bytes encrypted_path = 2; - int32 version = 3; - - bytes stream_id = 4 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - - pointerdb.RedundancyScheme redundancy_scheme = 5; - encryption.EncryptionParameters encryption_parameters = 6; -} - -message ObjectCommitRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - - bytes encrypted_metadata_nonce = 2 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_metadata = 3; // TODO: set maximum size limit -} - -message ObjectCommitResponse { -} - -message ObjectGetRequest { - RequestHeader header = 15; - - bytes bucket = 1; - bytes encrypted_path = 2; - int32 version = 3; -} - -message ObjectGetResponse { - Object object = 1; -} - -message ObjectListRequest { - RequestHeader header = 15; - - bytes bucket = 1; - bytes encrypted_prefix = 2; - bytes encrypted_cursor = 3; - bool recursive = 4; - int32 limit = 5; - - ObjectListItemIncludes object_includes = 6; -} - -message ObjectListResponse { - repeated ObjectListItem items = 1; - bool more = 2; -} - -message ObjectListItem { - bytes encrypted_path = 1; - int32 version = 2; - Object.Status status = 3; - - google.protobuf.Timestamp created_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp status_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp expires_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes encrypted_metadata_nonce = 7 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_metadata = 8; -} - -message ObjectListItemIncludes { - bool metadata = 1; -} - -message ObjectBeginDeleteRequest { - RequestHeader header = 15; - - bytes bucket = 1; - bytes encrypted_path = 2; - int32 version = 3; -} - -message ObjectBeginDeleteResponse { - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - Object object = 2; -} - -message ObjectFinishDeleteRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; -} - -message ObjectFinishDeleteResponse { -} - -// -// Only for satellite use -// - -message SatStreamID { - bytes bucket = 1; - bytes encrypted_path = 2; - int32 version = 3; - - pointerdb.RedundancyScheme redundancy = 4; - - google.protobuf.Timestamp creation_date = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp expiration_date = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes satellite_signature = 9; -} - -//--------------------------- -// Segment -//--------------------------- - -message Segment { - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - SegmentPosition position = 2; - - bytes encrypted_key_nonce = 3 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_key = 4; - - int64 size_encrypted_data = 5; // refers to segment size not piece size - - bytes encrypted_inline_data = 6; - repeated Piece pieces = 7; -} - -message Piece { - int32 piece_num = 1; - bytes node = 2[(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; -} - -message SegmentPosition { - int32 part_number = 1; - int32 index = 2; -} - -message SegmentBeginRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - SegmentPosition position = 2; - - int64 max_order_limit = 3; -} - -message SegmentBeginResponse { - bytes segment_id = 1 [(gogoproto.customtype) = "SegmentID", (gogoproto.nullable) = false]; - repeated AddressedOrderLimit addressed_limits = 2; - bytes private_key = 3 [(gogoproto.customtype) = "PiecePrivateKey", (gogoproto.nullable) = false]; -} - -message SegmentCommitRequest { - RequestHeader header = 15; - - bytes segment_id = 1 [(gogoproto.customtype) = "SegmentID", (gogoproto.nullable) = false]; - - bytes encrypted_key_nonce = 2 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_key = 3; - - int64 size_encrypted_data = 4; // refers to segment size not piece size - - repeated SegmentPieceUploadResult upload_result = 5; -} - -message SegmentPieceUploadResult { - int32 piece_num = 1; - bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - orders.PieceHash hash = 3; -} - -// only for satellite use -message SatSegmentID { - SatStreamID stream_id = 1; - int32 part_number = 2; - int32 index = 3; - - // TODO we have redundancy in SatStreamID, do we need it here? - // pointerdb.RedundancyScheme redundancy = 4; - bytes root_piece_id = 5 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - repeated AddressedOrderLimit original_order_limits = 6; - google.protobuf.Timestamp creation_date = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes satellite_signature = 8; -} - -message SegmentCommitResponse { - int32 successful_pieces = 1; -} - -message SegmentMakeInlineRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - SegmentPosition position = 2; - - bytes encrypted_key_nonce = 3 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_key = 4; - - bytes encrypted_inline_data = 5; -} - -message SegmentMakeInlineResponse {} - -message SegmentBeginDeleteRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - SegmentPosition position = 2; -} - -message SegmentBeginDeleteResponse { - bytes segment_id = 1 [(gogoproto.customtype) = "SegmentID", (gogoproto.nullable) = false]; - repeated AddressedOrderLimit addressed_limits = 2; - bytes private_key = 3 [(gogoproto.customtype) = "PiecePrivateKey", (gogoproto.nullable) = false]; -} - -message SegmentFinishDeleteRequest { - RequestHeader header = 15; - - bytes segment_id = 1 [(gogoproto.customtype) = "SegmentID", (gogoproto.nullable) = false]; - repeated SegmentPieceDeleteResult results = 2; -} - -message SegmentPieceDeleteResult { - int32 piece_num = 1; - bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - orders.PieceHash hash = 3; -} - -message SegmentFinishDeleteResponse {} - -message SegmentListRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - SegmentPosition cursor_position = 2; - int32 limit = 3; -} - -message SegmentListResponse { - repeated SegmentListItem items = 1; - bool more = 2; -} - -message SegmentListItem { - SegmentPosition position = 1; -} - -message SegmentDownloadRequest { - RequestHeader header = 15; - - bytes stream_id = 1 [(gogoproto.customtype) = "StreamID", (gogoproto.nullable) = false]; - SegmentPosition cursor_position = 2; -} - -message SegmentDownloadResponse { - bytes segment_id = 1 [(gogoproto.customtype) = "SegmentID", (gogoproto.nullable) = false]; - - repeated AddressedOrderLimit addressed_limits = 2; - bytes private_key = 3 [(gogoproto.customtype) = "PiecePrivateKey", (gogoproto.nullable) = false]; - - bytes encrypted_inline_data = 4; - int64 segment_size = 5; - bytes encrypted_key_nonce = 6 [(gogoproto.customtype) = "Nonce", (gogoproto.nullable) = false]; - bytes encrypted_key = 7; - - SegmentPosition next = 8; // can be nil -} - -message BatchRequest { - RequestHeader header = 15; // the only header that matters in a batch. - - // headers for specific BatchRequestItems are ignored entirely - repeated BatchRequestItem requests = 1; -} - -message BatchRequestItem { - oneof Request { - BucketCreateRequest bucket_create = 1; - BucketGetRequest bucket_get = 2; - BucketDeleteRequest bucket_delete = 3; - BucketListRequest bucket_list = 4; - - ObjectBeginRequest object_begin = 6; - ObjectCommitRequest object_commit = 7; - ObjectGetRequest object_get = 8; - ObjectListRequest object_list = 9; - ObjectBeginDeleteRequest object_begin_delete = 10; - ObjectFinishDeleteRequest object_finish_delete = 11; - - SegmentBeginRequest segment_begin = 12; - SegmentCommitRequest segment_commit = 13; - SegmentMakeInlineRequest segment_make_inline = 14; - - SegmentBeginDeleteRequest segment_begin_delete = 15; - SegmentFinishDeleteRequest segment_finish_delete = 16; - - SegmentListRequest segment_list = 17; - SegmentDownloadRequest segment_download = 18; - - RevokeAPIKeyRequest revoke_api_key = 19; - - } -} - -message BatchResponse { - repeated BatchResponseItem responses = 1; -} - -message BatchResponseItem { - oneof Response { - BucketCreateResponse bucket_create = 1; - BucketGetResponse bucket_get = 2; - BucketDeleteResponse bucket_delete = 3; - BucketListResponse bucket_list = 4; - - ObjectBeginResponse object_begin = 6; - ObjectCommitResponse object_commit = 7; - ObjectGetResponse object_get = 8; - ObjectListResponse object_list = 9; - ObjectBeginDeleteResponse object_begin_delete = 10; - ObjectFinishDeleteResponse object_finish_delete = 11; - - SegmentBeginResponse segment_begin = 12; - SegmentCommitResponse segment_commit = 13; - SegmentMakeInlineResponse segment_make_inline = 14; - - SegmentBeginDeleteResponse segment_begin_delete = 15; - SegmentFinishDeleteResponse segment_finish_delete = 16; - - SegmentListResponse segment_list = 17; - SegmentDownloadResponse segment_download = 18; - - RevokeAPIKeyResponse revoke_api_key = 19; - } -} - -message RevokeAPIKeyRequest { - RequestHeader header = 15; - - bytes api_key = 1; -} - -message RevokeAPIKeyResponse { } diff --git a/vendor/storj.io/common/pb/node.pb.go b/vendor/storj.io/common/pb/node.pb.go deleted file mode 100644 index e6f39f4fc..000000000 --- a/vendor/storj.io/common/pb/node.pb.go +++ /dev/null @@ -1,488 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: node.proto - -package pb - -import ( - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// NodeType is an enum of possible node types. -type NodeType int32 - -const ( - NodeType_INVALID NodeType = 0 - NodeType_SATELLITE NodeType = 1 - NodeType_STORAGE NodeType = 2 - NodeType_UPLINK NodeType = 3 - NodeType_BOOTSTRAP NodeType = 4 // Deprecated: Do not use. -) - -var NodeType_name = map[int32]string{ - 0: "INVALID", - 1: "SATELLITE", - 2: "STORAGE", - 3: "UPLINK", - 4: "BOOTSTRAP", -} - -var NodeType_value = map[string]int32{ - "INVALID": 0, - "SATELLITE": 1, - "STORAGE": 2, - "UPLINK": 3, - "BOOTSTRAP": 4, -} - -func (x NodeType) String() string { - return proto.EnumName(NodeType_name, int32(x)) -} - -func (NodeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{0} -} - -// NodeTransport is an enum of possible transports for the overlay network. -type NodeTransport int32 - -const ( - NodeTransport_TCP_TLS_GRPC NodeTransport = 0 -) - -var NodeTransport_name = map[int32]string{ - 0: "TCP_TLS_GRPC", -} - -var NodeTransport_value = map[string]int32{ - "TCP_TLS_GRPC": 0, -} - -func (x NodeTransport) String() string { - return proto.EnumName(NodeTransport_name, int32(x)) -} - -func (NodeTransport) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{1} -} - -// Node represents a node in the overlay network. -// Node is info for a updating a single storagenode, used in the Update rpc calls. -type Node struct { - Id NodeID `protobuf:"bytes,1,opt,name=id,proto3,customtype=NodeID" json:"id"` - Address *NodeAddress `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - DeprecatedLastIp string `protobuf:"bytes,14,opt,name=deprecated_last_ip,json=deprecatedLastIp,proto3" json:"deprecated_last_ip,omitempty"` // Deprecated: Do not use. - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Node) Reset() { *m = Node{} } -func (m *Node) String() string { return proto.CompactTextString(m) } -func (*Node) ProtoMessage() {} -func (*Node) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{0} -} -func (m *Node) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Node.Unmarshal(m, b) -} -func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Node.Marshal(b, m, deterministic) -} -func (m *Node) XXX_Merge(src proto.Message) { - xxx_messageInfo_Node.Merge(m, src) -} -func (m *Node) XXX_Size() int { - return xxx_messageInfo_Node.Size(m) -} -func (m *Node) XXX_DiscardUnknown() { - xxx_messageInfo_Node.DiscardUnknown(m) -} - -var xxx_messageInfo_Node proto.InternalMessageInfo - -func (m *Node) GetAddress() *NodeAddress { - if m != nil { - return m.Address - } - return nil -} - -// Deprecated: Do not use. -func (m *Node) GetDeprecatedLastIp() string { - if m != nil { - return m.DeprecatedLastIp - } - return "" -} - -// NodeAddress contains the information needed to communicate with a node on the network. -type NodeAddress struct { - Transport NodeTransport `protobuf:"varint,1,opt,name=transport,proto3,enum=node.NodeTransport" json:"transport,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeAddress) Reset() { *m = NodeAddress{} } -func (m *NodeAddress) String() string { return proto.CompactTextString(m) } -func (*NodeAddress) ProtoMessage() {} -func (*NodeAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{1} -} -func (m *NodeAddress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeAddress.Unmarshal(m, b) -} -func (m *NodeAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeAddress.Marshal(b, m, deterministic) -} -func (m *NodeAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeAddress.Merge(m, src) -} -func (m *NodeAddress) XXX_Size() int { - return xxx_messageInfo_NodeAddress.Size(m) -} -func (m *NodeAddress) XXX_DiscardUnknown() { - xxx_messageInfo_NodeAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeAddress proto.InternalMessageInfo - -func (m *NodeAddress) GetTransport() NodeTransport { - if m != nil { - return m.Transport - } - return NodeTransport_TCP_TLS_GRPC -} - -func (m *NodeAddress) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -// NodeOperator contains info about the storage node operator. -type NodeOperator struct { - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` - Wallet string `protobuf:"bytes,2,opt,name=wallet,proto3" json:"wallet,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeOperator) Reset() { *m = NodeOperator{} } -func (m *NodeOperator) String() string { return proto.CompactTextString(m) } -func (*NodeOperator) ProtoMessage() {} -func (*NodeOperator) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{2} -} -func (m *NodeOperator) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeOperator.Unmarshal(m, b) -} -func (m *NodeOperator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeOperator.Marshal(b, m, deterministic) -} -func (m *NodeOperator) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeOperator.Merge(m, src) -} -func (m *NodeOperator) XXX_Size() int { - return xxx_messageInfo_NodeOperator.Size(m) -} -func (m *NodeOperator) XXX_DiscardUnknown() { - xxx_messageInfo_NodeOperator.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeOperator proto.InternalMessageInfo - -func (m *NodeOperator) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *NodeOperator) GetWallet() string { - if m != nil { - return m.Wallet - } - return "" -} - -// NodeCapacity contains all relevant data about a nodes ability to store data. -type NodeCapacity struct { - FreeBandwidth int64 `protobuf:"varint,1,opt,name=free_bandwidth,json=freeBandwidth,proto3" json:"free_bandwidth,omitempty"` // Deprecated: Do not use. - FreeDisk int64 `protobuf:"varint,2,opt,name=free_disk,json=freeDisk,proto3" json:"free_disk,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeCapacity) Reset() { *m = NodeCapacity{} } -func (m *NodeCapacity) String() string { return proto.CompactTextString(m) } -func (*NodeCapacity) ProtoMessage() {} -func (*NodeCapacity) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{3} -} -func (m *NodeCapacity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeCapacity.Unmarshal(m, b) -} -func (m *NodeCapacity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeCapacity.Marshal(b, m, deterministic) -} -func (m *NodeCapacity) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeCapacity.Merge(m, src) -} -func (m *NodeCapacity) XXX_Size() int { - return xxx_messageInfo_NodeCapacity.Size(m) -} -func (m *NodeCapacity) XXX_DiscardUnknown() { - xxx_messageInfo_NodeCapacity.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeCapacity proto.InternalMessageInfo - -// Deprecated: Do not use. -func (m *NodeCapacity) GetFreeBandwidth() int64 { - if m != nil { - return m.FreeBandwidth - } - return 0 -} - -func (m *NodeCapacity) GetFreeDisk() int64 { - if m != nil { - return m.FreeDisk - } - return 0 -} - -// Deprecated: use NodeOperator instead. -type NodeMetadata struct { - Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` - Wallet string `protobuf:"bytes,2,opt,name=wallet,proto3" json:"wallet,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeMetadata) Reset() { *m = NodeMetadata{} } -func (m *NodeMetadata) String() string { return proto.CompactTextString(m) } -func (*NodeMetadata) ProtoMessage() {} -func (*NodeMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{4} -} -func (m *NodeMetadata) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeMetadata.Unmarshal(m, b) -} -func (m *NodeMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeMetadata.Marshal(b, m, deterministic) -} -func (m *NodeMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeMetadata.Merge(m, src) -} -func (m *NodeMetadata) XXX_Size() int { - return xxx_messageInfo_NodeMetadata.Size(m) -} -func (m *NodeMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_NodeMetadata.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeMetadata proto.InternalMessageInfo - -func (m *NodeMetadata) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *NodeMetadata) GetWallet() string { - if m != nil { - return m.Wallet - } - return "" -} - -// Deprecated: use NodeCapacity instead. -type NodeRestrictions struct { - FreeBandwidth int64 `protobuf:"varint,1,opt,name=free_bandwidth,json=freeBandwidth,proto3" json:"free_bandwidth,omitempty"` - FreeDisk int64 `protobuf:"varint,2,opt,name=free_disk,json=freeDisk,proto3" json:"free_disk,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeRestrictions) Reset() { *m = NodeRestrictions{} } -func (m *NodeRestrictions) String() string { return proto.CompactTextString(m) } -func (*NodeRestrictions) ProtoMessage() {} -func (*NodeRestrictions) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{5} -} -func (m *NodeRestrictions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeRestrictions.Unmarshal(m, b) -} -func (m *NodeRestrictions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeRestrictions.Marshal(b, m, deterministic) -} -func (m *NodeRestrictions) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeRestrictions.Merge(m, src) -} -func (m *NodeRestrictions) XXX_Size() int { - return xxx_messageInfo_NodeRestrictions.Size(m) -} -func (m *NodeRestrictions) XXX_DiscardUnknown() { - xxx_messageInfo_NodeRestrictions.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeRestrictions proto.InternalMessageInfo - -func (m *NodeRestrictions) GetFreeBandwidth() int64 { - if m != nil { - return m.FreeBandwidth - } - return 0 -} - -func (m *NodeRestrictions) GetFreeDisk() int64 { - if m != nil { - return m.FreeDisk - } - return 0 -} - -// NodeVersion contains version information about a node. -type NodeVersion struct { - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` - Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - Release bool `protobuf:"varint,4,opt,name=release,proto3" json:"release,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NodeVersion) Reset() { *m = NodeVersion{} } -func (m *NodeVersion) String() string { return proto.CompactTextString(m) } -func (*NodeVersion) ProtoMessage() {} -func (*NodeVersion) Descriptor() ([]byte, []int) { - return fileDescriptor_0c843d59d2d938e7, []int{6} -} -func (m *NodeVersion) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeVersion.Unmarshal(m, b) -} -func (m *NodeVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeVersion.Marshal(b, m, deterministic) -} -func (m *NodeVersion) XXX_Merge(src proto.Message) { - xxx_messageInfo_NodeVersion.Merge(m, src) -} -func (m *NodeVersion) XXX_Size() int { - return xxx_messageInfo_NodeVersion.Size(m) -} -func (m *NodeVersion) XXX_DiscardUnknown() { - xxx_messageInfo_NodeVersion.DiscardUnknown(m) -} - -var xxx_messageInfo_NodeVersion proto.InternalMessageInfo - -func (m *NodeVersion) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - -func (m *NodeVersion) GetCommitHash() string { - if m != nil { - return m.CommitHash - } - return "" -} - -func (m *NodeVersion) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - -func (m *NodeVersion) GetRelease() bool { - if m != nil { - return m.Release - } - return false -} - -func init() { - proto.RegisterEnum("node.NodeType", NodeType_name, NodeType_value) - proto.RegisterEnum("node.NodeTransport", NodeTransport_name, NodeTransport_value) - proto.RegisterType((*Node)(nil), "node.Node") - proto.RegisterType((*NodeAddress)(nil), "node.NodeAddress") - proto.RegisterType((*NodeOperator)(nil), "node.NodeOperator") - proto.RegisterType((*NodeCapacity)(nil), "node.NodeCapacity") - proto.RegisterType((*NodeMetadata)(nil), "node.NodeMetadata") - proto.RegisterType((*NodeRestrictions)(nil), "node.NodeRestrictions") - proto.RegisterType((*NodeVersion)(nil), "node.NodeVersion") -} - -func init() { proto.RegisterFile("node.proto", fileDescriptor_0c843d59d2d938e7) } - -var fileDescriptor_0c843d59d2d938e7 = []byte{ - // 623 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcb, 0x6e, 0xdb, 0x38, - 0x14, 0x8d, 0x6c, 0xc7, 0x91, 0xe8, 0x07, 0x14, 0x4e, 0x30, 0x10, 0x3c, 0xc0, 0xd8, 0x63, 0x60, - 0x00, 0x37, 0x05, 0xec, 0x36, 0xdd, 0x76, 0x63, 0x25, 0x41, 0xea, 0xd6, 0x8d, 0x0d, 0x5a, 0xcd, - 0x22, 0x1b, 0x81, 0x16, 0x19, 0x9b, 0x8d, 0x2c, 0x12, 0x24, 0xd5, 0xc0, 0x7f, 0xd1, 0x5d, 0xff, - 0xa0, 0xdf, 0xd2, 0x6f, 0xe8, 0x22, 0xfd, 0x95, 0x82, 0x7a, 0xc4, 0x09, 0xd0, 0x4d, 0x76, 0x3a, - 0xf7, 0x9c, 0x4b, 0x1d, 0x9e, 0x7b, 0x09, 0x40, 0xc2, 0x09, 0x1d, 0x0a, 0xc9, 0x35, 0x87, 0x35, - 0xf3, 0xdd, 0x01, 0x2b, 0xbe, 0xe2, 0x79, 0xa5, 0xd3, 0x5d, 0x71, 0xbe, 0x8a, 0xe9, 0x28, 0x43, - 0xcb, 0xf4, 0x66, 0xa4, 0xd9, 0x86, 0x2a, 0x8d, 0x37, 0x22, 0x17, 0xf4, 0xbf, 0x55, 0x40, 0xed, - 0x92, 0x13, 0x0a, 0xff, 0x05, 0x15, 0x46, 0x3c, 0xab, 0x67, 0x0d, 0x9a, 0x7e, 0xfb, 0xc7, 0x7d, - 0x77, 0xef, 0xe7, 0x7d, 0xb7, 0x6e, 0x98, 0xc9, 0x19, 0xaa, 0x30, 0x02, 0x5f, 0x82, 0x03, 0x4c, - 0x88, 0xa4, 0x4a, 0x79, 0x95, 0x9e, 0x35, 0x68, 0x9c, 0x1c, 0x0e, 0xb3, 0x3f, 0x1b, 0xc9, 0x38, - 0x27, 0x50, 0xa9, 0x80, 0xaf, 0x00, 0x24, 0x54, 0x48, 0x1a, 0x61, 0x4d, 0x49, 0x18, 0x63, 0xa5, - 0x43, 0x26, 0xbc, 0x76, 0xcf, 0x1a, 0x38, 0x7e, 0xc5, 0xb3, 0x90, 0xbb, 0x63, 0xa7, 0x58, 0xe9, - 0x89, 0x78, 0x5f, 0xb3, 0xab, 0x6e, 0x1b, 0xd5, 0xf4, 0x56, 0x50, 0xd4, 0x94, 0x54, 0x69, 0xc9, - 0x22, 0xcd, 0x78, 0xa2, 0x10, 0x90, 0x54, 0xa4, 0x1a, 0x1b, 0x80, 0xec, 0x0d, 0xd5, 0x98, 0x60, - 0x8d, 0x51, 0x33, 0xc6, 0x9a, 0x26, 0xd1, 0x36, 0x8c, 0x99, 0xd2, 0xa8, 0x85, 0x53, 0xc2, 0x74, - 0xa8, 0xd2, 0x28, 0x32, 0x3e, 0xf6, 0x99, 0x0a, 0x53, 0x81, 0xda, 0xa9, 0x20, 0x58, 0xd3, 0xb0, - 0x90, 0xa2, 0xa3, 0x02, 0x3f, 0x15, 0xb7, 0x8a, 0x6a, 0x2a, 0x4c, 0x36, 0xe8, 0xe0, 0x0b, 0x95, - 0x8a, 0xf1, 0xa4, 0x7f, 0x0d, 0x1a, 0x8f, 0xee, 0x06, 0x5f, 0x03, 0x47, 0x4b, 0x9c, 0x28, 0xc1, - 0xa5, 0xce, 0x62, 0x6a, 0x9f, 0xfc, 0xb5, 0x4b, 0x20, 0x28, 0x29, 0xb4, 0x53, 0x41, 0xef, 0x69, - 0x64, 0xce, 0x43, 0x3e, 0xfd, 0xb7, 0xa0, 0x69, 0xba, 0x66, 0x82, 0x4a, 0xac, 0xb9, 0x84, 0x47, - 0x60, 0x9f, 0x6e, 0x30, 0x8b, 0xb3, 0x83, 0x1d, 0x94, 0x03, 0xf8, 0x37, 0xa8, 0xdf, 0xe1, 0x38, - 0xa6, 0xba, 0x68, 0x2f, 0x50, 0xff, 0x2a, 0xef, 0x3e, 0xc5, 0x02, 0x47, 0x4c, 0x6f, 0xe1, 0x0b, - 0xd0, 0xbe, 0x91, 0x94, 0x86, 0x4b, 0x9c, 0x90, 0x3b, 0x46, 0xf4, 0x3a, 0x3b, 0xa6, 0x9a, 0x25, - 0xdd, 0x32, 0x8c, 0x5f, 0x12, 0xf0, 0x1f, 0xe0, 0x64, 0x52, 0xc2, 0xd4, 0x6d, 0x76, 0x6a, 0x15, - 0xd9, 0xa6, 0x70, 0xc6, 0xd4, 0x6d, 0xe9, 0xea, 0x63, 0x91, 0xf1, 0xb3, 0x5d, 0xb9, 0xa6, 0x1b, - 0x3d, 0x9a, 0x1d, 0xfc, 0xff, 0xcf, 0xce, 0x9e, 0xe5, 0xea, 0xbb, 0x95, 0x0f, 0xe2, 0x2a, 0x9f, - 0x8b, 0x49, 0xb5, 0x18, 0x51, 0xe1, 0xab, 0x84, 0xb0, 0x0b, 0x1a, 0x11, 0xdf, 0x6c, 0x98, 0x0e, - 0xd7, 0x58, 0xad, 0x0b, 0x7b, 0x20, 0x2f, 0xbd, 0xc3, 0x6a, 0x0d, 0x7d, 0xe0, 0x3c, 0xec, 0xbf, - 0x57, 0xcd, 0xb6, 0xb8, 0x33, 0xcc, 0x5f, 0xc8, 0xb0, 0x7c, 0x21, 0xc3, 0xa0, 0x54, 0xf8, 0xb6, - 0x79, 0x06, 0x5f, 0x7f, 0x75, 0x2d, 0xb4, 0x6b, 0x33, 0xbf, 0x97, 0x34, 0xa6, 0x58, 0x51, 0xaf, - 0xd6, 0xb3, 0x06, 0x36, 0x2a, 0xe1, 0x31, 0x02, 0x76, 0xb6, 0x0a, 0x5b, 0x41, 0x61, 0x03, 0x1c, - 0x4c, 0x2e, 0xaf, 0xc6, 0xd3, 0xc9, 0x99, 0xbb, 0x07, 0x5b, 0xc0, 0x59, 0x8c, 0x83, 0xf3, 0xe9, - 0x74, 0x12, 0x9c, 0xbb, 0x96, 0xe1, 0x16, 0xc1, 0x0c, 0x8d, 0x2f, 0xce, 0xdd, 0x0a, 0x04, 0xa0, - 0xfe, 0x69, 0x3e, 0x9d, 0x5c, 0x7e, 0x70, 0xab, 0xf0, 0x10, 0x38, 0xfe, 0x6c, 0x16, 0x2c, 0x02, - 0x34, 0x9e, 0xbb, 0xb5, 0x4e, 0xc5, 0xb6, 0x8e, 0xff, 0x03, 0xad, 0x27, 0xeb, 0x05, 0x5d, 0xd0, - 0x0c, 0x4e, 0xe7, 0x61, 0x30, 0x5d, 0x84, 0x17, 0x68, 0x7e, 0xea, 0xee, 0xf9, 0x47, 0xd7, 0x50, - 0x69, 0x2e, 0x3f, 0x0f, 0x19, 0x1f, 0x99, 0xbb, 0xf2, 0x64, 0x24, 0x96, 0xcb, 0x7a, 0x76, 0x9f, - 0x37, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x80, 0xb8, 0x51, 0x1f, 0x04, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/node.proto b/vendor/storj.io/common/pb/node.proto deleted file mode 100644 index c2c860680..000000000 --- a/vendor/storj.io/common/pb/node.proto +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package node; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -// Node represents a node in the overlay network. -// Node is info for a updating a single storagenode, used in the Update rpc calls. -message Node { - bytes id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - NodeAddress address = 2; - reserved 3 to 13; - string deprecated_last_ip = 14 [deprecated=true]; - reserved "type", "restrictions", "reputation", "metadata", "latency_list", "audit_success", "is_up", "update_latency", "update_audit_success", "update_uptime", "version"; -} - -// NodeType is an enum of possible node types. -enum NodeType { - INVALID = 0; - SATELLITE = 1; - STORAGE = 2; - UPLINK = 3; - BOOTSTRAP = 4 [deprecated=true]; -} - -// NodeAddress contains the information needed to communicate with a node on the network. -message NodeAddress { - NodeTransport transport = 1; - string address = 2; -} - -// NodeTransport is an enum of possible transports for the overlay network. -enum NodeTransport { - TCP_TLS_GRPC = 0; -} - -// NodeOperator contains info about the storage node operator. -message NodeOperator { - string email = 1; - string wallet = 2; -} - -// NodeCapacity contains all relevant data about a nodes ability to store data. -message NodeCapacity { - int64 free_bandwidth = 1 [deprecated=true]; - int64 free_disk = 2; -} - -// Deprecated: use NodeOperator instead. -message NodeMetadata { - string email = 1; - string wallet = 2; -} - -// Deprecated: use NodeCapacity instead. -message NodeRestrictions { - int64 free_bandwidth = 1; - int64 free_disk = 2; -} - -// NodeVersion contains version information about a node. -message NodeVersion { - string version = 1; // must be semver formatted - string commit_hash = 2; - google.protobuf.Timestamp timestamp = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - bool release = 4; -} diff --git a/vendor/storj.io/common/pb/nodestats.pb.go b/vendor/storj.io/common/pb/nodestats.pb.go deleted file mode 100644 index d8d269f73..000000000 --- a/vendor/storj.io/common/pb/nodestats.pb.go +++ /dev/null @@ -1,654 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nodestats.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type ReputationStats struct { - TotalCount int64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` - SuccessCount int64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"` - ReputationAlpha float64 `protobuf:"fixed64,3,opt,name=reputation_alpha,json=reputationAlpha,proto3" json:"reputation_alpha,omitempty"` - ReputationBeta float64 `protobuf:"fixed64,4,opt,name=reputation_beta,json=reputationBeta,proto3" json:"reputation_beta,omitempty"` - ReputationScore float64 `protobuf:"fixed64,5,opt,name=reputation_score,json=reputationScore,proto3" json:"reputation_score,omitempty"` - UnknownReputationAlpha float64 `protobuf:"fixed64,6,opt,name=unknown_reputation_alpha,json=unknownReputationAlpha,proto3" json:"unknown_reputation_alpha,omitempty"` - UnknownReputationBeta float64 `protobuf:"fixed64,7,opt,name=unknown_reputation_beta,json=unknownReputationBeta,proto3" json:"unknown_reputation_beta,omitempty"` - UnknownReputationScore float64 `protobuf:"fixed64,8,opt,name=unknown_reputation_score,json=unknownReputationScore,proto3" json:"unknown_reputation_score,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ReputationStats) Reset() { *m = ReputationStats{} } -func (m *ReputationStats) String() string { return proto.CompactTextString(m) } -func (*ReputationStats) ProtoMessage() {} -func (*ReputationStats) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{0} -} -func (m *ReputationStats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReputationStats.Unmarshal(m, b) -} -func (m *ReputationStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReputationStats.Marshal(b, m, deterministic) -} -func (m *ReputationStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReputationStats.Merge(m, src) -} -func (m *ReputationStats) XXX_Size() int { - return xxx_messageInfo_ReputationStats.Size(m) -} -func (m *ReputationStats) XXX_DiscardUnknown() { - xxx_messageInfo_ReputationStats.DiscardUnknown(m) -} - -var xxx_messageInfo_ReputationStats proto.InternalMessageInfo - -func (m *ReputationStats) GetTotalCount() int64 { - if m != nil { - return m.TotalCount - } - return 0 -} - -func (m *ReputationStats) GetSuccessCount() int64 { - if m != nil { - return m.SuccessCount - } - return 0 -} - -func (m *ReputationStats) GetReputationAlpha() float64 { - if m != nil { - return m.ReputationAlpha - } - return 0 -} - -func (m *ReputationStats) GetReputationBeta() float64 { - if m != nil { - return m.ReputationBeta - } - return 0 -} - -func (m *ReputationStats) GetReputationScore() float64 { - if m != nil { - return m.ReputationScore - } - return 0 -} - -func (m *ReputationStats) GetUnknownReputationAlpha() float64 { - if m != nil { - return m.UnknownReputationAlpha - } - return 0 -} - -func (m *ReputationStats) GetUnknownReputationBeta() float64 { - if m != nil { - return m.UnknownReputationBeta - } - return 0 -} - -func (m *ReputationStats) GetUnknownReputationScore() float64 { - if m != nil { - return m.UnknownReputationScore - } - return 0 -} - -type GetStatsRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetStatsRequest) Reset() { *m = GetStatsRequest{} } -func (m *GetStatsRequest) String() string { return proto.CompactTextString(m) } -func (*GetStatsRequest) ProtoMessage() {} -func (*GetStatsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{1} -} -func (m *GetStatsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetStatsRequest.Unmarshal(m, b) -} -func (m *GetStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetStatsRequest.Marshal(b, m, deterministic) -} -func (m *GetStatsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetStatsRequest.Merge(m, src) -} -func (m *GetStatsRequest) XXX_Size() int { - return xxx_messageInfo_GetStatsRequest.Size(m) -} -func (m *GetStatsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetStatsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetStatsRequest proto.InternalMessageInfo - -type GetStatsResponse struct { - UptimeCheck *ReputationStats `protobuf:"bytes,1,opt,name=uptime_check,json=uptimeCheck,proto3" json:"uptime_check,omitempty"` - AuditCheck *ReputationStats `protobuf:"bytes,2,opt,name=audit_check,json=auditCheck,proto3" json:"audit_check,omitempty"` - Disqualified *time.Time `protobuf:"bytes,3,opt,name=disqualified,proto3,stdtime" json:"disqualified,omitempty"` - Suspended *time.Time `protobuf:"bytes,4,opt,name=suspended,proto3,stdtime" json:"suspended,omitempty"` - JoinedAt time.Time `protobuf:"bytes,5,opt,name=joined_at,json=joinedAt,proto3,stdtime" json:"joined_at"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetStatsResponse) Reset() { *m = GetStatsResponse{} } -func (m *GetStatsResponse) String() string { return proto.CompactTextString(m) } -func (*GetStatsResponse) ProtoMessage() {} -func (*GetStatsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{2} -} -func (m *GetStatsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetStatsResponse.Unmarshal(m, b) -} -func (m *GetStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetStatsResponse.Marshal(b, m, deterministic) -} -func (m *GetStatsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetStatsResponse.Merge(m, src) -} -func (m *GetStatsResponse) XXX_Size() int { - return xxx_messageInfo_GetStatsResponse.Size(m) -} -func (m *GetStatsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetStatsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetStatsResponse proto.InternalMessageInfo - -func (m *GetStatsResponse) GetUptimeCheck() *ReputationStats { - if m != nil { - return m.UptimeCheck - } - return nil -} - -func (m *GetStatsResponse) GetAuditCheck() *ReputationStats { - if m != nil { - return m.AuditCheck - } - return nil -} - -func (m *GetStatsResponse) GetDisqualified() *time.Time { - if m != nil { - return m.Disqualified - } - return nil -} - -func (m *GetStatsResponse) GetSuspended() *time.Time { - if m != nil { - return m.Suspended - } - return nil -} - -func (m *GetStatsResponse) GetJoinedAt() time.Time { - if m != nil { - return m.JoinedAt - } - return time.Time{} -} - -type DailyStorageUsageRequest struct { - From time.Time `protobuf:"bytes,1,opt,name=from,proto3,stdtime" json:"from"` - To time.Time `protobuf:"bytes,2,opt,name=to,proto3,stdtime" json:"to"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DailyStorageUsageRequest) Reset() { *m = DailyStorageUsageRequest{} } -func (m *DailyStorageUsageRequest) String() string { return proto.CompactTextString(m) } -func (*DailyStorageUsageRequest) ProtoMessage() {} -func (*DailyStorageUsageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{3} -} -func (m *DailyStorageUsageRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DailyStorageUsageRequest.Unmarshal(m, b) -} -func (m *DailyStorageUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DailyStorageUsageRequest.Marshal(b, m, deterministic) -} -func (m *DailyStorageUsageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DailyStorageUsageRequest.Merge(m, src) -} -func (m *DailyStorageUsageRequest) XXX_Size() int { - return xxx_messageInfo_DailyStorageUsageRequest.Size(m) -} -func (m *DailyStorageUsageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DailyStorageUsageRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DailyStorageUsageRequest proto.InternalMessageInfo - -func (m *DailyStorageUsageRequest) GetFrom() time.Time { - if m != nil { - return m.From - } - return time.Time{} -} - -func (m *DailyStorageUsageRequest) GetTo() time.Time { - if m != nil { - return m.To - } - return time.Time{} -} - -type DailyStorageUsageResponse struct { - NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - DailyStorageUsage []*DailyStorageUsageResponse_StorageUsage `protobuf:"bytes,2,rep,name=daily_storage_usage,json=dailyStorageUsage,proto3" json:"daily_storage_usage,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DailyStorageUsageResponse) Reset() { *m = DailyStorageUsageResponse{} } -func (m *DailyStorageUsageResponse) String() string { return proto.CompactTextString(m) } -func (*DailyStorageUsageResponse) ProtoMessage() {} -func (*DailyStorageUsageResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{4} -} -func (m *DailyStorageUsageResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DailyStorageUsageResponse.Unmarshal(m, b) -} -func (m *DailyStorageUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DailyStorageUsageResponse.Marshal(b, m, deterministic) -} -func (m *DailyStorageUsageResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DailyStorageUsageResponse.Merge(m, src) -} -func (m *DailyStorageUsageResponse) XXX_Size() int { - return xxx_messageInfo_DailyStorageUsageResponse.Size(m) -} -func (m *DailyStorageUsageResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DailyStorageUsageResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DailyStorageUsageResponse proto.InternalMessageInfo - -func (m *DailyStorageUsageResponse) GetDailyStorageUsage() []*DailyStorageUsageResponse_StorageUsage { - if m != nil { - return m.DailyStorageUsage - } - return nil -} - -type DailyStorageUsageResponse_StorageUsage struct { - AtRestTotal float64 `protobuf:"fixed64,1,opt,name=at_rest_total,json=atRestTotal,proto3" json:"at_rest_total,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DailyStorageUsageResponse_StorageUsage) Reset() { - *m = DailyStorageUsageResponse_StorageUsage{} -} -func (m *DailyStorageUsageResponse_StorageUsage) String() string { return proto.CompactTextString(m) } -func (*DailyStorageUsageResponse_StorageUsage) ProtoMessage() {} -func (*DailyStorageUsageResponse_StorageUsage) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{4, 0} -} -func (m *DailyStorageUsageResponse_StorageUsage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Unmarshal(m, b) -} -func (m *DailyStorageUsageResponse_StorageUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Marshal(b, m, deterministic) -} -func (m *DailyStorageUsageResponse_StorageUsage) XXX_Merge(src proto.Message) { - xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Merge(m, src) -} -func (m *DailyStorageUsageResponse_StorageUsage) XXX_Size() int { - return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Size(m) -} -func (m *DailyStorageUsageResponse_StorageUsage) XXX_DiscardUnknown() { - xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.DiscardUnknown(m) -} - -var xxx_messageInfo_DailyStorageUsageResponse_StorageUsage proto.InternalMessageInfo - -func (m *DailyStorageUsageResponse_StorageUsage) GetAtRestTotal() float64 { - if m != nil { - return m.AtRestTotal - } - return 0 -} - -func (m *DailyStorageUsageResponse_StorageUsage) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - -type PricingModelRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PricingModelRequest) Reset() { *m = PricingModelRequest{} } -func (m *PricingModelRequest) String() string { return proto.CompactTextString(m) } -func (*PricingModelRequest) ProtoMessage() {} -func (*PricingModelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{5} -} -func (m *PricingModelRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PricingModelRequest.Unmarshal(m, b) -} -func (m *PricingModelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PricingModelRequest.Marshal(b, m, deterministic) -} -func (m *PricingModelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PricingModelRequest.Merge(m, src) -} -func (m *PricingModelRequest) XXX_Size() int { - return xxx_messageInfo_PricingModelRequest.Size(m) -} -func (m *PricingModelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PricingModelRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PricingModelRequest proto.InternalMessageInfo - -type PricingModelResponse struct { - EgressBandwidthPrice int64 `protobuf:"varint,1,opt,name=egress_bandwidth_price,json=egressBandwidthPrice,proto3" json:"egress_bandwidth_price,omitempty"` - RepairBandwidthPrice int64 `protobuf:"varint,2,opt,name=repair_bandwidth_price,json=repairBandwidthPrice,proto3" json:"repair_bandwidth_price,omitempty"` - DiskSpacePrice int64 `protobuf:"varint,3,opt,name=disk_space_price,json=diskSpacePrice,proto3" json:"disk_space_price,omitempty"` - AuditBandwidthPrice int64 `protobuf:"varint,4,opt,name=audit_bandwidth_price,json=auditBandwidthPrice,proto3" json:"audit_bandwidth_price,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PricingModelResponse) Reset() { *m = PricingModelResponse{} } -func (m *PricingModelResponse) String() string { return proto.CompactTextString(m) } -func (*PricingModelResponse) ProtoMessage() {} -func (*PricingModelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b184ee117142aa, []int{6} -} -func (m *PricingModelResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PricingModelResponse.Unmarshal(m, b) -} -func (m *PricingModelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PricingModelResponse.Marshal(b, m, deterministic) -} -func (m *PricingModelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PricingModelResponse.Merge(m, src) -} -func (m *PricingModelResponse) XXX_Size() int { - return xxx_messageInfo_PricingModelResponse.Size(m) -} -func (m *PricingModelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PricingModelResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PricingModelResponse proto.InternalMessageInfo - -func (m *PricingModelResponse) GetEgressBandwidthPrice() int64 { - if m != nil { - return m.EgressBandwidthPrice - } - return 0 -} - -func (m *PricingModelResponse) GetRepairBandwidthPrice() int64 { - if m != nil { - return m.RepairBandwidthPrice - } - return 0 -} - -func (m *PricingModelResponse) GetDiskSpacePrice() int64 { - if m != nil { - return m.DiskSpacePrice - } - return 0 -} - -func (m *PricingModelResponse) GetAuditBandwidthPrice() int64 { - if m != nil { - return m.AuditBandwidthPrice - } - return 0 -} - -func init() { - proto.RegisterType((*ReputationStats)(nil), "nodestats.ReputationStats") - proto.RegisterType((*GetStatsRequest)(nil), "nodestats.GetStatsRequest") - proto.RegisterType((*GetStatsResponse)(nil), "nodestats.GetStatsResponse") - proto.RegisterType((*DailyStorageUsageRequest)(nil), "nodestats.DailyStorageUsageRequest") - proto.RegisterType((*DailyStorageUsageResponse)(nil), "nodestats.DailyStorageUsageResponse") - proto.RegisterType((*DailyStorageUsageResponse_StorageUsage)(nil), "nodestats.DailyStorageUsageResponse.StorageUsage") - proto.RegisterType((*PricingModelRequest)(nil), "nodestats.PricingModelRequest") - proto.RegisterType((*PricingModelResponse)(nil), "nodestats.PricingModelResponse") -} - -func init() { proto.RegisterFile("nodestats.proto", fileDescriptor_e0b184ee117142aa) } - -var fileDescriptor_e0b184ee117142aa = []byte{ - // 733 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xfd, 0xec, 0xf4, 0x4b, 0x93, 0x9b, 0xb4, 0x69, 0xa7, 0x69, 0x09, 0x41, 0x22, 0x55, 0x8a, - 0xd4, 0xb0, 0x49, 0x44, 0xa8, 0x50, 0x25, 0xc4, 0xa2, 0x69, 0x25, 0xe8, 0x82, 0x1f, 0x39, 0x65, - 0xc3, 0x02, 0x6b, 0xe2, 0x99, 0xba, 0xd3, 0x26, 0x1e, 0xd7, 0x33, 0xa6, 0x62, 0x09, 0x4b, 0x56, - 0xbc, 0x01, 0xaf, 0xc3, 0x33, 0xb0, 0x68, 0x79, 0x14, 0x34, 0x33, 0xce, 0x9f, 0x93, 0xd2, 0xb0, - 0xf4, 0xb9, 0xe7, 0x1c, 0x5f, 0xdd, 0x73, 0xe7, 0x42, 0x29, 0xe0, 0x84, 0x0a, 0x89, 0xa5, 0x68, - 0x86, 0x11, 0x97, 0x1c, 0xe5, 0x47, 0x40, 0x15, 0x7c, 0xee, 0x73, 0x03, 0x57, 0x6b, 0x3e, 0xe7, - 0x7e, 0x9f, 0xb6, 0xf4, 0x57, 0x2f, 0x3e, 0x6d, 0x49, 0x36, 0x50, 0xb4, 0x41, 0x68, 0x08, 0xf5, - 0xaf, 0x19, 0x28, 0x39, 0x34, 0x8c, 0x25, 0x96, 0x8c, 0x07, 0x5d, 0x65, 0x80, 0x6a, 0x50, 0x90, - 0x5c, 0xe2, 0xbe, 0xeb, 0xf1, 0x38, 0x90, 0x15, 0x6b, 0xdb, 0x6a, 0x64, 0x1c, 0xd0, 0xd0, 0xa1, - 0x42, 0xd0, 0x0e, 0xac, 0x88, 0xd8, 0xf3, 0xa8, 0x10, 0x09, 0xc5, 0xd6, 0x94, 0x62, 0x02, 0x1a, - 0xd2, 0x63, 0x58, 0x8b, 0x46, 0xc6, 0x2e, 0xee, 0x87, 0x67, 0xb8, 0x92, 0xd9, 0xb6, 0x1a, 0x96, - 0x53, 0x1a, 0xe3, 0x07, 0x0a, 0x46, 0xbb, 0x30, 0x01, 0xb9, 0x3d, 0x2a, 0x71, 0x65, 0x49, 0x33, - 0x57, 0xc7, 0x70, 0x87, 0x4a, 0x9c, 0xf2, 0x14, 0x1e, 0x8f, 0x68, 0xe5, 0xff, 0xb4, 0x67, 0x57, - 0xc1, 0x68, 0x1f, 0x2a, 0x71, 0x70, 0x11, 0xf0, 0xab, 0xc0, 0x9d, 0x69, 0x23, 0xab, 0x25, 0x5b, - 0x49, 0xdd, 0x49, 0x75, 0xf3, 0x0c, 0xee, 0xcd, 0x51, 0xea, 0xae, 0x96, 0xb5, 0x70, 0x73, 0x46, - 0xa8, 0x9b, 0x9b, 0xff, 0x47, 0xd3, 0x64, 0xee, 0x96, 0x3f, 0xea, 0x5e, 0xeb, 0xeb, 0x50, 0x7a, - 0x49, 0xa5, 0x1e, 0xbe, 0x43, 0x2f, 0x63, 0x2a, 0x64, 0xfd, 0xc6, 0x86, 0xb5, 0x31, 0x26, 0x42, - 0x1e, 0x08, 0x8a, 0x5e, 0x40, 0x31, 0x0e, 0x55, 0x82, 0xae, 0x77, 0x46, 0xbd, 0x0b, 0x9d, 0x4c, - 0xa1, 0x5d, 0x6d, 0x8e, 0x97, 0x21, 0x15, 0xa5, 0x53, 0x30, 0xfc, 0x43, 0x45, 0x47, 0xcf, 0xa1, - 0x80, 0x63, 0xc2, 0x64, 0xa2, 0xb6, 0xef, 0x54, 0x83, 0xa6, 0x1b, 0xf1, 0x2b, 0x28, 0x12, 0x26, - 0x2e, 0x63, 0xdc, 0x67, 0xa7, 0x8c, 0x12, 0x1d, 0xa5, 0x52, 0x9b, 0x05, 0x6b, 0x0e, 0x17, 0xac, - 0x79, 0x32, 0x5c, 0xb0, 0x4e, 0xee, 0xe7, 0x75, 0xcd, 0xfa, 0x7e, 0x53, 0xb3, 0x9c, 0x29, 0x25, - 0xea, 0x40, 0x5e, 0xc4, 0x22, 0xa4, 0x01, 0xa1, 0x44, 0xe7, 0xbc, 0xa8, 0xcd, 0x58, 0x86, 0x0e, - 0x20, 0x7f, 0xce, 0x59, 0x40, 0x89, 0x8b, 0xa5, 0xde, 0x80, 0xbb, 0x3d, 0xfe, 0xd3, 0x1e, 0x39, - 0x23, 0x3b, 0x90, 0xf5, 0x6f, 0x16, 0x54, 0x8e, 0x30, 0xeb, 0x7f, 0xee, 0x4a, 0x1e, 0x61, 0x9f, - 0xbe, 0x17, 0xd8, 0xa7, 0xc9, 0xf8, 0xd1, 0x3e, 0x2c, 0x9d, 0x46, 0x7c, 0x30, 0x9a, 0xf0, 0x22, - 0xd6, 0x5a, 0x81, 0xf6, 0xc0, 0x96, 0x7c, 0x34, 0xdb, 0x45, 0x74, 0xb6, 0xe4, 0xf5, 0x1f, 0x36, - 0xdc, 0x9f, 0xd3, 0x4c, 0x92, 0xfb, 0x2e, 0x2c, 0xab, 0x90, 0x5c, 0x46, 0x74, 0x43, 0xc5, 0xce, - 0xaa, 0x12, 0xff, 0xba, 0xae, 0x65, 0xdf, 0x70, 0x42, 0x8f, 0x8f, 0x9c, 0xac, 0x2a, 0x1f, 0x13, - 0x84, 0x61, 0x83, 0x28, 0x17, 0x57, 0x18, 0x1b, 0x37, 0x56, 0x3e, 0x15, 0x7b, 0x3b, 0xd3, 0x28, - 0xb4, 0x9f, 0x4c, 0x24, 0x7d, 0xeb, 0xbf, 0x9a, 0x53, 0xe0, 0x3a, 0x49, 0xf3, 0xaa, 0x9f, 0xa0, - 0x38, 0xf9, 0x8d, 0xea, 0xb0, 0x82, 0xa5, 0x1b, 0x51, 0x21, 0x5d, 0x7d, 0x21, 0x74, 0x87, 0x96, - 0x53, 0xc0, 0xd2, 0xa1, 0x42, 0x9e, 0x28, 0x48, 0x25, 0x3e, 0xba, 0x3b, 0xff, 0x34, 0x9a, 0xb1, - 0xac, 0xbe, 0x09, 0x1b, 0xef, 0x22, 0xe6, 0xb1, 0xc0, 0x7f, 0xcd, 0x09, 0xed, 0x0f, 0xdf, 0xc9, - 0x6f, 0x0b, 0xca, 0xd3, 0x78, 0x32, 0xb3, 0x3d, 0xd8, 0xa2, 0x7e, 0xa4, 0x4e, 0x54, 0x0f, 0x07, - 0xe4, 0x8a, 0x11, 0x79, 0xe6, 0x86, 0x11, 0xf3, 0x68, 0x72, 0xcf, 0xca, 0xa6, 0xda, 0x19, 0x16, - 0x95, 0x89, 0x56, 0x45, 0x34, 0xc4, 0x2c, 0x9a, 0x51, 0x99, 0x13, 0x57, 0x36, 0xd5, 0x94, 0xaa, - 0x01, 0x6b, 0x84, 0x89, 0x0b, 0x57, 0x84, 0xd8, 0xa3, 0x09, 0x3f, 0xa3, 0xf9, 0xab, 0x0a, 0xef, - 0x2a, 0xd8, 0x30, 0xdb, 0xb0, 0x69, 0x9e, 0x60, 0xda, 0x7e, 0x49, 0xd3, 0x37, 0x74, 0x71, 0xda, - 0xbd, 0xfd, 0xc5, 0x86, 0xbc, 0xca, 0xd9, 0x1c, 0xe7, 0x43, 0xc8, 0x0d, 0xef, 0x02, 0x9a, 0x7c, - 0xbb, 0xa9, 0x03, 0x52, 0x7d, 0x30, 0xb7, 0x96, 0x0c, 0xe7, 0x23, 0xac, 0xcf, 0x6c, 0x00, 0xda, - 0xf9, 0xfb, 0x7e, 0x18, 0xdb, 0x47, 0x8b, 0x2c, 0x11, 0x7a, 0x0b, 0xc5, 0xc9, 0x50, 0xd0, 0xc3, - 0x09, 0xd5, 0x9c, 0x14, 0xab, 0xb5, 0x5b, 0xeb, 0xc6, 0xb0, 0x53, 0xfe, 0x80, 0xd4, 0x4a, 0x9f, - 0x37, 0x19, 0x6f, 0x79, 0x7c, 0x30, 0xe0, 0x41, 0x2b, 0xec, 0xf5, 0xb2, 0x7a, 0x79, 0x9e, 0xfe, - 0x09, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xa2, 0xc8, 0x62, 0x0e, 0x07, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCNodeStatsClient interface { - DRPCConn() drpc.Conn - - GetStats(ctx context.Context, in *GetStatsRequest) (*GetStatsResponse, error) - DailyStorageUsage(ctx context.Context, in *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) - PricingModel(ctx context.Context, in *PricingModelRequest) (*PricingModelResponse, error) -} - -type drpcNodeStatsClient struct { - cc drpc.Conn -} - -func NewDRPCNodeStatsClient(cc drpc.Conn) DRPCNodeStatsClient { - return &drpcNodeStatsClient{cc} -} - -func (c *drpcNodeStatsClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcNodeStatsClient) GetStats(ctx context.Context, in *GetStatsRequest) (*GetStatsResponse, error) { - out := new(GetStatsResponse) - err := c.cc.Invoke(ctx, "/nodestats.NodeStats/GetStats", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcNodeStatsClient) DailyStorageUsage(ctx context.Context, in *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) { - out := new(DailyStorageUsageResponse) - err := c.cc.Invoke(ctx, "/nodestats.NodeStats/DailyStorageUsage", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcNodeStatsClient) PricingModel(ctx context.Context, in *PricingModelRequest) (*PricingModelResponse, error) { - out := new(PricingModelResponse) - err := c.cc.Invoke(ctx, "/nodestats.NodeStats/PricingModel", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCNodeStatsServer interface { - GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error) - DailyStorageUsage(context.Context, *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) - PricingModel(context.Context, *PricingModelRequest) (*PricingModelResponse, error) -} - -type DRPCNodeStatsDescription struct{} - -func (DRPCNodeStatsDescription) NumMethods() int { return 3 } - -func (DRPCNodeStatsDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/nodestats.NodeStats/GetStats", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeStatsServer). - GetStats( - ctx, - in1.(*GetStatsRequest), - ) - }, DRPCNodeStatsServer.GetStats, true - case 1: - return "/nodestats.NodeStats/DailyStorageUsage", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeStatsServer). - DailyStorageUsage( - ctx, - in1.(*DailyStorageUsageRequest), - ) - }, DRPCNodeStatsServer.DailyStorageUsage, true - case 2: - return "/nodestats.NodeStats/PricingModel", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCNodeStatsServer). - PricingModel( - ctx, - in1.(*PricingModelRequest), - ) - }, DRPCNodeStatsServer.PricingModel, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterNodeStats(mux drpc.Mux, impl DRPCNodeStatsServer) error { - return mux.Register(impl, DRPCNodeStatsDescription{}) -} - -type DRPCNodeStats_GetStatsStream interface { - drpc.Stream - SendAndClose(*GetStatsResponse) error -} - -type drpcNodeStatsGetStatsStream struct { - drpc.Stream -} - -func (x *drpcNodeStatsGetStatsStream) SendAndClose(m *GetStatsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNodeStats_DailyStorageUsageStream interface { - drpc.Stream - SendAndClose(*DailyStorageUsageResponse) error -} - -type drpcNodeStatsDailyStorageUsageStream struct { - drpc.Stream -} - -func (x *drpcNodeStatsDailyStorageUsageStream) SendAndClose(m *DailyStorageUsageResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCNodeStats_PricingModelStream interface { - drpc.Stream - SendAndClose(*PricingModelResponse) error -} - -type drpcNodeStatsPricingModelStream struct { - drpc.Stream -} - -func (x *drpcNodeStatsPricingModelStream) SendAndClose(m *PricingModelResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/nodestats.proto b/vendor/storj.io/common/pb/nodestats.proto deleted file mode 100644 index 90513b7c8..000000000 --- a/vendor/storj.io/common/pb/nodestats.proto +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package nodestats; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -service NodeStats { - rpc GetStats(GetStatsRequest) returns (GetStatsResponse); - rpc DailyStorageUsage(DailyStorageUsageRequest) returns (DailyStorageUsageResponse); - rpc PricingModel(PricingModelRequest) returns (PricingModelResponse); -} - -message ReputationStats { - int64 total_count = 1; - int64 success_count = 2; - double reputation_alpha = 3; - double reputation_beta = 4; - double reputation_score = 5; - double unknown_reputation_alpha = 6; - double unknown_reputation_beta = 7; - double unknown_reputation_score = 8; -} - -message GetStatsRequest {} - -message GetStatsResponse { - ReputationStats uptime_check = 1; - ReputationStats audit_check = 2; - google.protobuf.Timestamp disqualified = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; - google.protobuf.Timestamp suspended = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; - google.protobuf.Timestamp joined_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message DailyStorageUsageRequest { - google.protobuf.Timestamp from = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp to = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message DailyStorageUsageResponse { - message StorageUsage { - double at_rest_total = 1; - google.protobuf.Timestamp timestamp = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - } - - bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - repeated StorageUsage daily_storage_usage = 2; -} - -message PricingModelRequest {} - -message PricingModelResponse { - int64 egress_bandwidth_price = 1; - int64 repair_bandwidth_price = 2; - int64 disk_space_price = 3; - int64 audit_bandwidth_price = 4; -} diff --git a/vendor/storj.io/common/pb/orders.pb.go b/vendor/storj.io/common/pb/orders.pb.go deleted file mode 100644 index 5d59ed080..000000000 --- a/vendor/storj.io/common/pb/orders.pb.go +++ /dev/null @@ -1,821 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: orders.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// PieceAction is an enumeration of all possible executed actions on storage node. -type PieceAction int32 - -const ( - PieceAction_INVALID PieceAction = 0 - PieceAction_PUT PieceAction = 1 - PieceAction_GET PieceAction = 2 - PieceAction_GET_AUDIT PieceAction = 3 - PieceAction_GET_REPAIR PieceAction = 4 - PieceAction_PUT_REPAIR PieceAction = 5 - PieceAction_DELETE PieceAction = 6 - PieceAction_PUT_GRACEFUL_EXIT PieceAction = 7 -) - -var PieceAction_name = map[int32]string{ - 0: "INVALID", - 1: "PUT", - 2: "GET", - 3: "GET_AUDIT", - 4: "GET_REPAIR", - 5: "PUT_REPAIR", - 6: "DELETE", - 7: "PUT_GRACEFUL_EXIT", -} - -var PieceAction_value = map[string]int32{ - "INVALID": 0, - "PUT": 1, - "GET": 2, - "GET_AUDIT": 3, - "GET_REPAIR": 4, - "PUT_REPAIR": 5, - "DELETE": 6, - "PUT_GRACEFUL_EXIT": 7, -} - -func (x PieceAction) String() string { - return proto.EnumName(PieceAction_name, int32(x)) -} - -func (PieceAction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{0} -} - -type SettlementResponse_Status int32 - -const ( - SettlementResponse_INVALID SettlementResponse_Status = 0 - SettlementResponse_ACCEPTED SettlementResponse_Status = 1 - SettlementResponse_REJECTED SettlementResponse_Status = 2 -) - -var SettlementResponse_Status_name = map[int32]string{ - 0: "INVALID", - 1: "ACCEPTED", - 2: "REJECTED", -} - -var SettlementResponse_Status_value = map[string]int32{ - "INVALID": 0, - "ACCEPTED": 1, - "REJECTED": 2, -} - -func (x SettlementResponse_Status) String() string { - return proto.EnumName(SettlementResponse_Status_name, int32(x)) -} - -func (SettlementResponse_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{7, 0} -} - -// OrderLimit is provided by satellite to execute specific action on storage node within some limits. -type OrderLimit struct { - // unique serial to avoid replay attacks - SerialNumber SerialNumber `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3,customtype=SerialNumber" json:"serial_number"` - // satellite who issued this order limit allowing orderer to do the specified action - SatelliteId NodeID `protobuf:"bytes,2,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` - // uplink who requested or whom behalf the order limit to do an action - DeprecatedUplinkId *NodeID `protobuf:"bytes,3,opt,name=deprecated_uplink_id,json=deprecatedUplinkId,proto3,customtype=NodeID" json:"deprecated_uplink_id,omitempty"` - // public key that will be used to sign orders and piece hash - UplinkPublicKey PiecePublicKey `protobuf:"bytes,13,opt,name=uplink_public_key,json=uplinkPublicKey,proto3,customtype=PiecePublicKey" json:"uplink_public_key"` - // storage node who can re claimthe order limit specified by serial - StorageNodeId NodeID `protobuf:"bytes,4,opt,name=storage_node_id,json=storageNodeId,proto3,customtype=NodeID" json:"storage_node_id"` - // piece which is allowed to be touched - PieceId PieceID `protobuf:"bytes,5,opt,name=piece_id,json=pieceId,proto3,customtype=PieceID" json:"piece_id"` - // limit in bytes how much can be changed - Limit int64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` - Action PieceAction `protobuf:"varint,7,opt,name=action,proto3,enum=orders.PieceAction" json:"action,omitempty"` - PieceExpiration time.Time `protobuf:"bytes,8,opt,name=piece_expiration,json=pieceExpiration,proto3,stdtime" json:"piece_expiration"` - OrderExpiration time.Time `protobuf:"bytes,9,opt,name=order_expiration,json=orderExpiration,proto3,stdtime" json:"order_expiration"` - OrderCreation time.Time `protobuf:"bytes,12,opt,name=order_creation,json=orderCreation,proto3,stdtime" json:"order_creation"` - SatelliteSignature []byte `protobuf:"bytes,10,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"` - // satellites aren't necessarily discoverable in kademlia. this allows - // a storage node to find a satellite and handshake with it to get its key. - SatelliteAddress *NodeAddress `protobuf:"bytes,11,opt,name=satellite_address,json=satelliteAddress,proto3" json:"satellite_address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrderLimit) Reset() { *m = OrderLimit{} } -func (m *OrderLimit) String() string { return proto.CompactTextString(m) } -func (*OrderLimit) ProtoMessage() {} -func (*OrderLimit) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{0} -} -func (m *OrderLimit) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrderLimit.Unmarshal(m, b) -} -func (m *OrderLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrderLimit.Marshal(b, m, deterministic) -} -func (m *OrderLimit) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrderLimit.Merge(m, src) -} -func (m *OrderLimit) XXX_Size() int { - return xxx_messageInfo_OrderLimit.Size(m) -} -func (m *OrderLimit) XXX_DiscardUnknown() { - xxx_messageInfo_OrderLimit.DiscardUnknown(m) -} - -var xxx_messageInfo_OrderLimit proto.InternalMessageInfo - -func (m *OrderLimit) GetLimit() int64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *OrderLimit) GetAction() PieceAction { - if m != nil { - return m.Action - } - return PieceAction_INVALID -} - -func (m *OrderLimit) GetPieceExpiration() time.Time { - if m != nil { - return m.PieceExpiration - } - return time.Time{} -} - -func (m *OrderLimit) GetOrderExpiration() time.Time { - if m != nil { - return m.OrderExpiration - } - return time.Time{} -} - -func (m *OrderLimit) GetOrderCreation() time.Time { - if m != nil { - return m.OrderCreation - } - return time.Time{} -} - -func (m *OrderLimit) GetSatelliteSignature() []byte { - if m != nil { - return m.SatelliteSignature - } - return nil -} - -func (m *OrderLimit) GetSatelliteAddress() *NodeAddress { - if m != nil { - return m.SatelliteAddress - } - return nil -} - -// OrderLimitSigning provides OrderLimit signing serialization. -// -// It is never used for sending across the network, it is -// used in signing to ensure that nullable=false fields get handled properly. -// Its purpose is to solidify the format of how we serialize for -// signing, to handle some backwards compatibility considerations. -type OrderLimitSigning struct { - // unique serial to avoid replay attacks - SerialNumber SerialNumber `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3,customtype=SerialNumber" json:"serial_number"` - // satellite who issued this order limit allowing orderer to do the specified action - SatelliteId NodeID `protobuf:"bytes,2,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` - // uplink who requested or whom behalf the order limit to do an action - DeprecatedUplinkId *NodeID `protobuf:"bytes,3,opt,name=deprecated_uplink_id,json=deprecatedUplinkId,proto3,customtype=NodeID" json:"deprecated_uplink_id,omitempty"` - // public key that will be used to sign orders and piece hash - UplinkPublicKey *PiecePublicKey `protobuf:"bytes,13,opt,name=uplink_public_key,json=uplinkPublicKey,proto3,customtype=PiecePublicKey" json:"uplink_public_key,omitempty"` - // storage node who can re claimthe order limit specified by serial - StorageNodeId NodeID `protobuf:"bytes,4,opt,name=storage_node_id,json=storageNodeId,proto3,customtype=NodeID" json:"storage_node_id"` - // piece which is allowed to be touched - PieceId PieceID `protobuf:"bytes,5,opt,name=piece_id,json=pieceId,proto3,customtype=PieceID" json:"piece_id"` - // limit in bytes how much can be changed - Limit int64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` - Action PieceAction `protobuf:"varint,7,opt,name=action,proto3,enum=orders.PieceAction" json:"action,omitempty"` - PieceExpiration *time.Time `protobuf:"bytes,8,opt,name=piece_expiration,json=pieceExpiration,proto3,stdtime" json:"piece_expiration,omitempty"` - OrderExpiration *time.Time `protobuf:"bytes,9,opt,name=order_expiration,json=orderExpiration,proto3,stdtime" json:"order_expiration,omitempty"` - OrderCreation *time.Time `protobuf:"bytes,12,opt,name=order_creation,json=orderCreation,proto3,stdtime" json:"order_creation,omitempty"` - SatelliteSignature []byte `protobuf:"bytes,10,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"` - // this allows a storage node to find a satellite and handshake with it to get its key. - SatelliteAddress *NodeAddress `protobuf:"bytes,11,opt,name=satellite_address,json=satelliteAddress,proto3" json:"satellite_address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrderLimitSigning) Reset() { *m = OrderLimitSigning{} } -func (m *OrderLimitSigning) String() string { return proto.CompactTextString(m) } -func (*OrderLimitSigning) ProtoMessage() {} -func (*OrderLimitSigning) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{1} -} -func (m *OrderLimitSigning) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrderLimitSigning.Unmarshal(m, b) -} -func (m *OrderLimitSigning) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrderLimitSigning.Marshal(b, m, deterministic) -} -func (m *OrderLimitSigning) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrderLimitSigning.Merge(m, src) -} -func (m *OrderLimitSigning) XXX_Size() int { - return xxx_messageInfo_OrderLimitSigning.Size(m) -} -func (m *OrderLimitSigning) XXX_DiscardUnknown() { - xxx_messageInfo_OrderLimitSigning.DiscardUnknown(m) -} - -var xxx_messageInfo_OrderLimitSigning proto.InternalMessageInfo - -func (m *OrderLimitSigning) GetLimit() int64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *OrderLimitSigning) GetAction() PieceAction { - if m != nil { - return m.Action - } - return PieceAction_INVALID -} - -func (m *OrderLimitSigning) GetPieceExpiration() *time.Time { - if m != nil { - return m.PieceExpiration - } - return nil -} - -func (m *OrderLimitSigning) GetOrderExpiration() *time.Time { - if m != nil { - return m.OrderExpiration - } - return nil -} - -func (m *OrderLimitSigning) GetOrderCreation() *time.Time { - if m != nil { - return m.OrderCreation - } - return nil -} - -func (m *OrderLimitSigning) GetSatelliteSignature() []byte { - if m != nil { - return m.SatelliteSignature - } - return nil -} - -func (m *OrderLimitSigning) GetSatelliteAddress() *NodeAddress { - if m != nil { - return m.SatelliteAddress - } - return nil -} - -// Order is a one step of fullfilling Amount number of bytes from an OrderLimit with SerialNumber. -type Order struct { - // serial of the order limit that was signed - SerialNumber SerialNumber `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3,customtype=SerialNumber" json:"serial_number"` - // amount to be signed for - Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` - // signature - UplinkSignature []byte `protobuf:"bytes,3,opt,name=uplink_signature,json=uplinkSignature,proto3" json:"uplink_signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Order) Reset() { *m = Order{} } -func (m *Order) String() string { return proto.CompactTextString(m) } -func (*Order) ProtoMessage() {} -func (*Order) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{2} -} -func (m *Order) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Order.Unmarshal(m, b) -} -func (m *Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Order.Marshal(b, m, deterministic) -} -func (m *Order) XXX_Merge(src proto.Message) { - xxx_messageInfo_Order.Merge(m, src) -} -func (m *Order) XXX_Size() int { - return xxx_messageInfo_Order.Size(m) -} -func (m *Order) XXX_DiscardUnknown() { - xxx_messageInfo_Order.DiscardUnknown(m) -} - -var xxx_messageInfo_Order proto.InternalMessageInfo - -func (m *Order) GetAmount() int64 { - if m != nil { - return m.Amount - } - return 0 -} - -func (m *Order) GetUplinkSignature() []byte { - if m != nil { - return m.UplinkSignature - } - return nil -} - -// OrderSigning provides Order signing format. -// -// It is never used for sending across the network, it is -// used in signing to ensure that nullable=false fields get handled properly. -// Its purpose is to solidify the format of how we serialize for -// signing, to handle some backwards compatibility considerations. -type OrderSigning struct { - // serial of the order limit that was signed - SerialNumber SerialNumber `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3,customtype=SerialNumber" json:"serial_number"` - // amount to be signed for - Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` - // signature - UplinkSignature []byte `protobuf:"bytes,3,opt,name=uplink_signature,json=uplinkSignature,proto3" json:"uplink_signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrderSigning) Reset() { *m = OrderSigning{} } -func (m *OrderSigning) String() string { return proto.CompactTextString(m) } -func (*OrderSigning) ProtoMessage() {} -func (*OrderSigning) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{3} -} -func (m *OrderSigning) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrderSigning.Unmarshal(m, b) -} -func (m *OrderSigning) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrderSigning.Marshal(b, m, deterministic) -} -func (m *OrderSigning) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrderSigning.Merge(m, src) -} -func (m *OrderSigning) XXX_Size() int { - return xxx_messageInfo_OrderSigning.Size(m) -} -func (m *OrderSigning) XXX_DiscardUnknown() { - xxx_messageInfo_OrderSigning.DiscardUnknown(m) -} - -var xxx_messageInfo_OrderSigning proto.InternalMessageInfo - -func (m *OrderSigning) GetAmount() int64 { - if m != nil { - return m.Amount - } - return 0 -} - -func (m *OrderSigning) GetUplinkSignature() []byte { - if m != nil { - return m.UplinkSignature - } - return nil -} - -type PieceHash struct { - // piece id - PieceId PieceID `protobuf:"bytes,1,opt,name=piece_id,json=pieceId,proto3,customtype=PieceID" json:"piece_id"` - // hash of the piece that was/is uploaded - Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` - // size of uploaded piece - PieceSize int64 `protobuf:"varint,4,opt,name=piece_size,json=pieceSize,proto3" json:"piece_size,omitempty"` - // timestamp when upload occurred - Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - // signature either satellite or storage node - Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceHash) Reset() { *m = PieceHash{} } -func (m *PieceHash) String() string { return proto.CompactTextString(m) } -func (*PieceHash) ProtoMessage() {} -func (*PieceHash) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{4} -} -func (m *PieceHash) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceHash.Unmarshal(m, b) -} -func (m *PieceHash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceHash.Marshal(b, m, deterministic) -} -func (m *PieceHash) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceHash.Merge(m, src) -} -func (m *PieceHash) XXX_Size() int { - return xxx_messageInfo_PieceHash.Size(m) -} -func (m *PieceHash) XXX_DiscardUnknown() { - xxx_messageInfo_PieceHash.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceHash proto.InternalMessageInfo - -func (m *PieceHash) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *PieceHash) GetPieceSize() int64 { - if m != nil { - return m.PieceSize - } - return 0 -} - -func (m *PieceHash) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - -func (m *PieceHash) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -// PieceHashSigning provides piece hash signing format. -// -// It is never used for sending across the network, it is -// used in signing to ensure that nullable=false fields get handled properly. -// Its purpose is to solidify the format of how we serialize for -// signing, to handle some backwards compatibility considerations. -type PieceHashSigning struct { - // piece id - PieceId PieceID `protobuf:"bytes,1,opt,name=piece_id,json=pieceId,proto3,customtype=PieceID" json:"piece_id"` - // hash of the piece that was/is uploaded - Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` - // size of uploaded piece - PieceSize int64 `protobuf:"varint,4,opt,name=piece_size,json=pieceSize,proto3" json:"piece_size,omitempty"` - // timestamp when upload occurred - Timestamp *time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp,omitempty"` - // signature either satellite or storage node - Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceHashSigning) Reset() { *m = PieceHashSigning{} } -func (m *PieceHashSigning) String() string { return proto.CompactTextString(m) } -func (*PieceHashSigning) ProtoMessage() {} -func (*PieceHashSigning) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{5} -} -func (m *PieceHashSigning) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceHashSigning.Unmarshal(m, b) -} -func (m *PieceHashSigning) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceHashSigning.Marshal(b, m, deterministic) -} -func (m *PieceHashSigning) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceHashSigning.Merge(m, src) -} -func (m *PieceHashSigning) XXX_Size() int { - return xxx_messageInfo_PieceHashSigning.Size(m) -} -func (m *PieceHashSigning) XXX_DiscardUnknown() { - xxx_messageInfo_PieceHashSigning.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceHashSigning proto.InternalMessageInfo - -func (m *PieceHashSigning) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *PieceHashSigning) GetPieceSize() int64 { - if m != nil { - return m.PieceSize - } - return 0 -} - -func (m *PieceHashSigning) GetTimestamp() *time.Time { - if m != nil { - return m.Timestamp - } - return nil -} - -func (m *PieceHashSigning) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -// Expected order of messages from storagenode: -// go repeated -// SettlementRequest -> (async) -// go repeated -// <- SettlementResponse -type SettlementRequest struct { - Limit *OrderLimit `protobuf:"bytes,1,opt,name=limit,proto3" json:"limit,omitempty"` - Order *Order `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SettlementRequest) Reset() { *m = SettlementRequest{} } -func (m *SettlementRequest) String() string { return proto.CompactTextString(m) } -func (*SettlementRequest) ProtoMessage() {} -func (*SettlementRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{6} -} -func (m *SettlementRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SettlementRequest.Unmarshal(m, b) -} -func (m *SettlementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SettlementRequest.Marshal(b, m, deterministic) -} -func (m *SettlementRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SettlementRequest.Merge(m, src) -} -func (m *SettlementRequest) XXX_Size() int { - return xxx_messageInfo_SettlementRequest.Size(m) -} -func (m *SettlementRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SettlementRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SettlementRequest proto.InternalMessageInfo - -func (m *SettlementRequest) GetLimit() *OrderLimit { - if m != nil { - return m.Limit - } - return nil -} - -func (m *SettlementRequest) GetOrder() *Order { - if m != nil { - return m.Order - } - return nil -} - -type SettlementResponse struct { - SerialNumber SerialNumber `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3,customtype=SerialNumber" json:"serial_number"` - Status SettlementResponse_Status `protobuf:"varint,2,opt,name=status,proto3,enum=orders.SettlementResponse_Status" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SettlementResponse) Reset() { *m = SettlementResponse{} } -func (m *SettlementResponse) String() string { return proto.CompactTextString(m) } -func (*SettlementResponse) ProtoMessage() {} -func (*SettlementResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0f5d4cf0fc9e41b, []int{7} -} -func (m *SettlementResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SettlementResponse.Unmarshal(m, b) -} -func (m *SettlementResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SettlementResponse.Marshal(b, m, deterministic) -} -func (m *SettlementResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SettlementResponse.Merge(m, src) -} -func (m *SettlementResponse) XXX_Size() int { - return xxx_messageInfo_SettlementResponse.Size(m) -} -func (m *SettlementResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SettlementResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SettlementResponse proto.InternalMessageInfo - -func (m *SettlementResponse) GetStatus() SettlementResponse_Status { - if m != nil { - return m.Status - } - return SettlementResponse_INVALID -} - -func init() { - proto.RegisterEnum("orders.PieceAction", PieceAction_name, PieceAction_value) - proto.RegisterEnum("orders.SettlementResponse_Status", SettlementResponse_Status_name, SettlementResponse_Status_value) - proto.RegisterType((*OrderLimit)(nil), "orders.OrderLimit") - proto.RegisterType((*OrderLimitSigning)(nil), "orders.OrderLimitSigning") - proto.RegisterType((*Order)(nil), "orders.Order") - proto.RegisterType((*OrderSigning)(nil), "orders.OrderSigning") - proto.RegisterType((*PieceHash)(nil), "orders.PieceHash") - proto.RegisterType((*PieceHashSigning)(nil), "orders.PieceHashSigning") - proto.RegisterType((*SettlementRequest)(nil), "orders.SettlementRequest") - proto.RegisterType((*SettlementResponse)(nil), "orders.SettlementResponse") -} - -func init() { proto.RegisterFile("orders.proto", fileDescriptor_e0f5d4cf0fc9e41b) } - -var fileDescriptor_e0f5d4cf0fc9e41b = []byte{ - // 892 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x55, 0x4b, 0x6f, 0x23, 0x45, - 0x10, 0x4e, 0xc7, 0xf6, 0x38, 0x2e, 0x3f, 0x32, 0xee, 0x0d, 0x2b, 0x63, 0x81, 0x12, 0xcc, 0xc5, - 0x2c, 0x92, 0xcd, 0x1a, 0x09, 0x69, 0x25, 0x14, 0xc9, 0x8f, 0x21, 0x0c, 0x89, 0xb2, 0x56, 0xdb, - 0x46, 0x88, 0x8b, 0x35, 0xf6, 0x34, 0xce, 0xb0, 0xf6, 0xcc, 0x30, 0xdd, 0x23, 0xb1, 0x7b, 0xe0, - 0x82, 0xb8, 0x71, 0xe0, 0x0f, 0x71, 0xe7, 0x80, 0xc4, 0x9d, 0xc3, 0xf2, 0x3f, 0x38, 0xa1, 0xae, - 0x79, 0x39, 0x90, 0x15, 0x38, 0x1b, 0x24, 0xd8, 0xdb, 0x54, 0x57, 0x7d, 0x55, 0x5d, 0x5d, 0xdf, - 0x57, 0x03, 0x15, 0x2f, 0xb0, 0x79, 0x20, 0x3a, 0x7e, 0xe0, 0x49, 0x8f, 0x6a, 0x91, 0xd5, 0x84, - 0x95, 0xb7, 0xf2, 0xa2, 0xb3, 0xe6, 0xf1, 0xca, 0xf3, 0x56, 0x6b, 0xde, 0x45, 0x6b, 0x11, 0x7e, - 0xd1, 0x95, 0xce, 0x86, 0x0b, 0x69, 0x6d, 0xfc, 0x38, 0x00, 0x5c, 0xcf, 0xe6, 0xd1, 0x77, 0xeb, - 0x5b, 0x0d, 0xe0, 0xb1, 0xca, 0x71, 0xe1, 0x6c, 0x1c, 0x49, 0x1f, 0x41, 0x55, 0xf0, 0xc0, 0xb1, - 0xd6, 0x73, 0x37, 0xdc, 0x2c, 0x78, 0xd0, 0x20, 0x27, 0xa4, 0x5d, 0x19, 0x1c, 0xfd, 0xf4, 0xfc, - 0x78, 0xef, 0xd7, 0xe7, 0xc7, 0x95, 0x09, 0x3a, 0x2f, 0xd1, 0xc7, 0x2a, 0x62, 0xcb, 0xa2, 0x0f, - 0xa1, 0x22, 0x2c, 0xc9, 0xd7, 0x6b, 0x47, 0xf2, 0xb9, 0x63, 0x37, 0xf6, 0x11, 0x59, 0x8b, 0x91, - 0xda, 0xa5, 0x67, 0x73, 0x73, 0xc4, 0xca, 0x69, 0x8c, 0x69, 0xd3, 0x0f, 0xe1, 0xc8, 0xe6, 0x7e, - 0xc0, 0x97, 0x96, 0xe4, 0xf6, 0x3c, 0xf4, 0xd7, 0x8e, 0xfb, 0x44, 0x41, 0x73, 0x08, 0x85, 0x2d, - 0x18, 0xcd, 0xe2, 0x66, 0x18, 0x66, 0xda, 0x74, 0x00, 0xf5, 0x18, 0xe2, 0x87, 0x8b, 0xb5, 0xb3, - 0x9c, 0x3f, 0xe1, 0x4f, 0x1b, 0x55, 0x84, 0xde, 0x8f, 0xab, 0xd6, 0xc6, 0x0e, 0x5f, 0xf2, 0x31, - 0xba, 0xcf, 0xf9, 0x53, 0x76, 0x18, 0x01, 0xd2, 0x03, 0xfa, 0x01, 0x1c, 0x0a, 0xe9, 0x05, 0xd6, - 0x8a, 0xcf, 0xd5, 0xa3, 0xa8, 0xe2, 0xf9, 0x1b, 0xef, 0x5d, 0x8d, 0xc3, 0xd0, 0xb4, 0xe9, 0x03, - 0x38, 0xf0, 0x55, 0x6a, 0x05, 0x28, 0x20, 0xe0, 0x30, 0x06, 0x14, 0xb1, 0xa4, 0x39, 0x62, 0x45, - 0x0c, 0x30, 0x6d, 0x7a, 0x04, 0x85, 0xb5, 0x7a, 0xdc, 0x86, 0x76, 0x42, 0xda, 0x39, 0x16, 0x19, - 0xf4, 0x5d, 0xd0, 0xac, 0xa5, 0x74, 0x3c, 0xb7, 0x51, 0x3c, 0x21, 0xed, 0x5a, 0xef, 0x5e, 0x27, - 0x1e, 0x2c, 0xe2, 0xfb, 0xe8, 0x62, 0x71, 0x08, 0x7d, 0x0c, 0x7a, 0x54, 0x8e, 0x7f, 0xed, 0x3b, - 0x81, 0x85, 0xb0, 0x83, 0x13, 0xd2, 0x2e, 0xf7, 0x9a, 0x9d, 0x68, 0xda, 0x9d, 0x64, 0xda, 0x9d, - 0x69, 0x32, 0xed, 0xc1, 0x81, 0xba, 0xd2, 0x0f, 0xbf, 0x1d, 0x13, 0x76, 0x88, 0x68, 0x23, 0x05, - 0xab, 0x84, 0x58, 0x6e, 0x3b, 0x61, 0x69, 0x97, 0x84, 0x88, 0xde, 0x4a, 0x78, 0x0e, 0xb5, 0x28, - 0xe1, 0x32, 0xe0, 0x51, 0xba, 0xca, 0x0e, 0xe9, 0xaa, 0x88, 0x1d, 0xc6, 0x50, 0xda, 0x85, 0x7b, - 0x19, 0x95, 0x84, 0xb3, 0x72, 0x2d, 0x19, 0x06, 0xbc, 0x01, 0xea, 0xa1, 0x19, 0x4d, 0x5d, 0x93, - 0xc4, 0x43, 0x4f, 0xa1, 0x9e, 0x01, 0x2c, 0xdb, 0x0e, 0xb8, 0x10, 0x8d, 0x32, 0x5e, 0xa0, 0xde, - 0x41, 0xb6, 0xab, 0xb9, 0xf5, 0x23, 0x07, 0xd3, 0xd3, 0xd8, 0xf8, 0xa4, 0xf5, 0x7b, 0x01, 0xea, - 0x99, 0x0a, 0x54, 0x5e, 0xc7, 0x5d, 0xfd, 0xaf, 0xc4, 0x70, 0xfa, 0x62, 0x31, 0xd0, 0x57, 0x48, - 0x08, 0xe7, 0xb7, 0x12, 0x42, 0xfe, 0x66, 0x11, 0x9c, 0xdf, 0x4a, 0x04, 0xf9, 0x9b, 0x05, 0x70, - 0x76, 0x0b, 0x01, 0xe4, 0xff, 0x13, 0xe4, 0xff, 0x8e, 0x40, 0x01, 0xc9, 0xff, 0x32, 0x84, 0xbf, - 0x0f, 0x9a, 0xb5, 0xf1, 0x42, 0x57, 0x22, 0xd5, 0x73, 0x2c, 0xb6, 0xe8, 0x3b, 0xa0, 0xc7, 0xbc, - 0xcc, 0x5a, 0x41, 0x46, 0x27, 0x14, 0x4c, 0xfb, 0x68, 0x7d, 0x4f, 0xa0, 0x82, 0xf7, 0xb8, 0x03, - 0xfd, 0xdd, 0xc1, 0x75, 0x7e, 0x26, 0x50, 0x42, 0x0a, 0x7e, 0x6c, 0x89, 0xab, 0x6b, 0x3c, 0x27, - 0x7f, 0xc3, 0x73, 0x0a, 0xf9, 0x2b, 0x4b, 0x5c, 0x45, 0xa2, 0x67, 0xf8, 0x4d, 0xdf, 0x04, 0x88, - 0xf0, 0xc2, 0x79, 0xc6, 0x51, 0x5a, 0x39, 0x56, 0xc2, 0x93, 0x89, 0xf3, 0x8c, 0xd3, 0x01, 0x94, - 0xd2, 0xbf, 0x34, 0xea, 0xe8, 0x9f, 0x6e, 0xce, 0x0c, 0x46, 0xdf, 0x80, 0xd2, 0x9f, 0x9b, 0xca, - 0x0e, 0x5a, 0xbf, 0x10, 0xd0, 0xd3, 0x76, 0x92, 0x17, 0xfe, 0x97, 0xbb, 0x3a, 0xdd, 0xad, 0xab, - 0xfc, 0x6e, 0x1d, 0x2d, 0xa0, 0x3e, 0xe1, 0x52, 0xae, 0xf9, 0x86, 0xbb, 0x92, 0xf1, 0xaf, 0x42, - 0x2e, 0x24, 0x6d, 0x27, 0x3b, 0x86, 0x60, 0x39, 0x9a, 0x2c, 0x93, 0x6c, 0xbb, 0x27, 0x7b, 0xe7, - 0x6d, 0x28, 0xa0, 0x0f, 0x1b, 0x2a, 0xf7, 0xaa, 0xd7, 0x22, 0x59, 0xe4, 0x6b, 0xfd, 0x48, 0x80, - 0x6e, 0x17, 0x11, 0xbe, 0xe7, 0x0a, 0xfe, 0x32, 0xcc, 0x7c, 0x04, 0x9a, 0x90, 0x96, 0x0c, 0x05, - 0xd6, 0xad, 0xf5, 0xde, 0x4a, 0xea, 0xfe, 0xb5, 0x4c, 0x67, 0x82, 0x81, 0x2c, 0x06, 0xb4, 0x1e, - 0x82, 0x16, 0x9d, 0xd0, 0x32, 0x14, 0xcd, 0xcb, 0x4f, 0xfb, 0x17, 0xe6, 0x48, 0xdf, 0xa3, 0x15, - 0x38, 0xe8, 0x0f, 0x87, 0xc6, 0x78, 0x6a, 0x8c, 0x74, 0xa2, 0x2c, 0x66, 0x7c, 0x62, 0x0c, 0x95, - 0xb5, 0xff, 0xe0, 0x1b, 0x28, 0x6f, 0xad, 0xd1, 0xeb, 0xb8, 0x22, 0xe4, 0xc6, 0xb3, 0xa9, 0x4e, - 0xd4, 0xc7, 0x99, 0x31, 0xd5, 0xf7, 0x69, 0x15, 0x4a, 0x67, 0xc6, 0x74, 0xde, 0x9f, 0x8d, 0xcc, - 0xa9, 0x9e, 0xa3, 0x35, 0x00, 0x65, 0x32, 0x63, 0xdc, 0x37, 0x99, 0x9e, 0x57, 0xf6, 0x78, 0x96, - 0xda, 0x05, 0x0a, 0xa0, 0x8d, 0x8c, 0x0b, 0x63, 0x6a, 0xe8, 0x1a, 0x7d, 0x0d, 0xea, 0xca, 0x77, - 0xc6, 0xfa, 0x43, 0xe3, 0xa3, 0xd9, 0xc5, 0xdc, 0xf8, 0xcc, 0x9c, 0xea, 0xc5, 0xde, 0x04, 0x34, - 0x7c, 0x4f, 0x41, 0x4d, 0x80, 0xac, 0x43, 0xfa, 0xfa, 0x4d, 0x5d, 0xe3, 0x04, 0x9b, 0xcd, 0x17, - 0x3f, 0x48, 0x6b, 0xaf, 0x4d, 0xde, 0x23, 0x83, 0xa3, 0xcf, 0xa9, 0xfa, 0x09, 0x7d, 0xd9, 0x71, - 0xbc, 0xee, 0xd2, 0xdb, 0x6c, 0x3c, 0xb7, 0xeb, 0x2f, 0x16, 0x1a, 0x32, 0xea, 0xfd, 0x3f, 0x02, - 0x00, 0x00, 0xff, 0xff, 0xb4, 0xbc, 0x85, 0xa1, 0x21, 0x0b, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCOrdersClient interface { - DRPCConn() drpc.Conn - - Settlement(ctx context.Context) (DRPCOrders_SettlementClient, error) -} - -type drpcOrdersClient struct { - cc drpc.Conn -} - -func NewDRPCOrdersClient(cc drpc.Conn) DRPCOrdersClient { - return &drpcOrdersClient{cc} -} - -func (c *drpcOrdersClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcOrdersClient) Settlement(ctx context.Context) (DRPCOrders_SettlementClient, error) { - stream, err := c.cc.NewStream(ctx, "/orders.Orders/Settlement") - if err != nil { - return nil, err - } - x := &drpcOrdersSettlementClient{stream} - return x, nil -} - -type DRPCOrders_SettlementClient interface { - drpc.Stream - Send(*SettlementRequest) error - Recv() (*SettlementResponse, error) -} - -type drpcOrdersSettlementClient struct { - drpc.Stream -} - -func (x *drpcOrdersSettlementClient) Send(m *SettlementRequest) error { - return x.MsgSend(m) -} - -func (x *drpcOrdersSettlementClient) Recv() (*SettlementResponse, error) { - m := new(SettlementResponse) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -type DRPCOrdersServer interface { - Settlement(DRPCOrders_SettlementStream) error -} - -type DRPCOrdersDescription struct{} - -func (DRPCOrdersDescription) NumMethods() int { return 1 } - -func (DRPCOrdersDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/orders.Orders/Settlement", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCOrdersServer). - Settlement( - &drpcOrdersSettlementStream{in1.(drpc.Stream)}, - ) - }, DRPCOrdersServer.Settlement, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterOrders(mux drpc.Mux, impl DRPCOrdersServer) error { - return mux.Register(impl, DRPCOrdersDescription{}) -} - -type DRPCOrders_SettlementStream interface { - drpc.Stream - Send(*SettlementResponse) error - Recv() (*SettlementRequest, error) -} - -type drpcOrdersSettlementStream struct { - drpc.Stream -} - -func (x *drpcOrdersSettlementStream) Send(m *SettlementResponse) error { - return x.MsgSend(m) -} - -func (x *drpcOrdersSettlementStream) Recv() (*SettlementRequest, error) { - m := new(SettlementRequest) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/orders.proto b/vendor/storj.io/common/pb/orders.proto deleted file mode 100644 index 66179684d..000000000 --- a/vendor/storj.io/common/pb/orders.proto +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package orders; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "node.proto"; - -// PieceAction is an enumeration of all possible executed actions on storage node. -enum PieceAction { - INVALID = 0; - PUT = 1; - GET = 2; - GET_AUDIT = 3; - GET_REPAIR = 4; - PUT_REPAIR = 5; - DELETE = 6; - PUT_GRACEFUL_EXIT = 7; -} - -// OrderLimit is provided by satellite to execute specific action on storage node within some limits. -message OrderLimit { - // unique serial to avoid replay attacks - bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false]; - // satellite who issued this order limit allowing orderer to do the specified action - bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - // uplink who requested or whom behalf the order limit to do an action - bytes deprecated_uplink_id = 3 [(gogoproto.customtype) = "NodeID"]; - // public key that will be used to sign orders and piece hash - bytes uplink_public_key = 13 [(gogoproto.customtype) = "PiecePublicKey", (gogoproto.nullable) = false]; - // storage node who can re claimthe order limit specified by serial - bytes storage_node_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - - // piece which is allowed to be touched - bytes piece_id = 5 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - // limit in bytes how much can be changed - int64 limit = 6; - PieceAction action = 7; - - google.protobuf.Timestamp piece_expiration = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp order_expiration = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp order_creation = 12 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes satellite_signature = 10; - // satellites aren't necessarily discoverable in kademlia. this allows - // a storage node to find a satellite and handshake with it to get its key. - node.NodeAddress satellite_address = 11; -} - -// OrderLimitSigning provides OrderLimit signing serialization. -// -// It is never used for sending across the network, it is -// used in signing to ensure that nullable=false fields get handled properly. -// Its purpose is to solidify the format of how we serialize for -// signing, to handle some backwards compatibility considerations. -message OrderLimitSigning { - // unique serial to avoid replay attacks - bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false]; - // satellite who issued this order limit allowing orderer to do the specified action - bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - // uplink who requested or whom behalf the order limit to do an action - bytes deprecated_uplink_id = 3 [(gogoproto.customtype) = "NodeID"]; - // public key that will be used to sign orders and piece hash - bytes uplink_public_key = 13 [(gogoproto.customtype) = "PiecePublicKey"]; - // storage node who can re claimthe order limit specified by serial - bytes storage_node_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - - // piece which is allowed to be touched - bytes piece_id = 5 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - // limit in bytes how much can be changed - int64 limit = 6; - PieceAction action = 7; - - google.protobuf.Timestamp piece_expiration = 8 [(gogoproto.stdtime) = true]; - google.protobuf.Timestamp order_expiration = 9 [(gogoproto.stdtime) = true]; - google.protobuf.Timestamp order_creation = 12 [(gogoproto.stdtime) = true]; - - bytes satellite_signature = 10; - - // this allows a storage node to find a satellite and handshake with it to get its key. - node.NodeAddress satellite_address = 11; -} - -// Order is a one step of fullfilling Amount number of bytes from an OrderLimit with SerialNumber. -message Order { - // serial of the order limit that was signed - bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false]; - // amount to be signed for - int64 amount = 2; - // signature - bytes uplink_signature = 3; -} - -// OrderSigning provides Order signing format. -// -// It is never used for sending across the network, it is -// used in signing to ensure that nullable=false fields get handled properly. -// Its purpose is to solidify the format of how we serialize for -// signing, to handle some backwards compatibility considerations. -message OrderSigning { - // serial of the order limit that was signed - bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false]; - // amount to be signed for - int64 amount = 2; - // signature - bytes uplink_signature = 3; -} - -message PieceHash { - // piece id - bytes piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - // hash of the piece that was/is uploaded - bytes hash = 2; - // size of uploaded piece - int64 piece_size = 4; - // timestamp when upload occurred - google.protobuf.Timestamp timestamp = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - // signature either satellite or storage node - bytes signature = 3; -} - -// PieceHashSigning provides piece hash signing format. -// -// It is never used for sending across the network, it is -// used in signing to ensure that nullable=false fields get handled properly. -// Its purpose is to solidify the format of how we serialize for -// signing, to handle some backwards compatibility considerations. -message PieceHashSigning { - // piece id - bytes piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - // hash of the piece that was/is uploaded - bytes hash = 2; - // size of uploaded piece - int64 piece_size = 4; - // timestamp when upload occurred - google.protobuf.Timestamp timestamp = 5 [(gogoproto.stdtime) = true]; - // signature either satellite or storage node - bytes signature = 3; -} - -service Orders { - rpc Settlement(stream SettlementRequest) returns (stream SettlementResponse) {} -} - -// Expected order of messages from storagenode: -// go repeated -// SettlementRequest -> (async) -// go repeated -// <- SettlementResponse -message SettlementRequest { - OrderLimit limit = 1; - Order order = 2; -} - -message SettlementResponse { - enum Status { - INVALID = 0; - ACCEPTED = 1; - REJECTED = 2; - } - - bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false]; - Status status = 2; -} diff --git a/vendor/storj.io/common/pb/payments.pb.go b/vendor/storj.io/common/pb/payments.pb.go deleted file mode 100644 index 1cc9127d2..000000000 --- a/vendor/storj.io/common/pb/payments.pb.go +++ /dev/null @@ -1,625 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: payments.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type PrepareInvoiceRecordsRequest struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PrepareInvoiceRecordsRequest) Reset() { *m = PrepareInvoiceRecordsRequest{} } -func (m *PrepareInvoiceRecordsRequest) String() string { return proto.CompactTextString(m) } -func (*PrepareInvoiceRecordsRequest) ProtoMessage() {} -func (*PrepareInvoiceRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{0} -} -func (m *PrepareInvoiceRecordsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PrepareInvoiceRecordsRequest.Unmarshal(m, b) -} -func (m *PrepareInvoiceRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PrepareInvoiceRecordsRequest.Marshal(b, m, deterministic) -} -func (m *PrepareInvoiceRecordsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrepareInvoiceRecordsRequest.Merge(m, src) -} -func (m *PrepareInvoiceRecordsRequest) XXX_Size() int { - return xxx_messageInfo_PrepareInvoiceRecordsRequest.Size(m) -} -func (m *PrepareInvoiceRecordsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PrepareInvoiceRecordsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PrepareInvoiceRecordsRequest proto.InternalMessageInfo - -func (m *PrepareInvoiceRecordsRequest) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -type PrepareInvoiceRecordsResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PrepareInvoiceRecordsResponse) Reset() { *m = PrepareInvoiceRecordsResponse{} } -func (m *PrepareInvoiceRecordsResponse) String() string { return proto.CompactTextString(m) } -func (*PrepareInvoiceRecordsResponse) ProtoMessage() {} -func (*PrepareInvoiceRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{1} -} -func (m *PrepareInvoiceRecordsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PrepareInvoiceRecordsResponse.Unmarshal(m, b) -} -func (m *PrepareInvoiceRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PrepareInvoiceRecordsResponse.Marshal(b, m, deterministic) -} -func (m *PrepareInvoiceRecordsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrepareInvoiceRecordsResponse.Merge(m, src) -} -func (m *PrepareInvoiceRecordsResponse) XXX_Size() int { - return xxx_messageInfo_PrepareInvoiceRecordsResponse.Size(m) -} -func (m *PrepareInvoiceRecordsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PrepareInvoiceRecordsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PrepareInvoiceRecordsResponse proto.InternalMessageInfo - -type ApplyInvoiceRecordsRequest struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplyInvoiceRecordsRequest) Reset() { *m = ApplyInvoiceRecordsRequest{} } -func (m *ApplyInvoiceRecordsRequest) String() string { return proto.CompactTextString(m) } -func (*ApplyInvoiceRecordsRequest) ProtoMessage() {} -func (*ApplyInvoiceRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{2} -} -func (m *ApplyInvoiceRecordsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyInvoiceRecordsRequest.Unmarshal(m, b) -} -func (m *ApplyInvoiceRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyInvoiceRecordsRequest.Marshal(b, m, deterministic) -} -func (m *ApplyInvoiceRecordsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyInvoiceRecordsRequest.Merge(m, src) -} -func (m *ApplyInvoiceRecordsRequest) XXX_Size() int { - return xxx_messageInfo_ApplyInvoiceRecordsRequest.Size(m) -} -func (m *ApplyInvoiceRecordsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyInvoiceRecordsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplyInvoiceRecordsRequest proto.InternalMessageInfo - -func (m *ApplyInvoiceRecordsRequest) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -type ApplyInvoiceRecordsResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplyInvoiceRecordsResponse) Reset() { *m = ApplyInvoiceRecordsResponse{} } -func (m *ApplyInvoiceRecordsResponse) String() string { return proto.CompactTextString(m) } -func (*ApplyInvoiceRecordsResponse) ProtoMessage() {} -func (*ApplyInvoiceRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{3} -} -func (m *ApplyInvoiceRecordsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyInvoiceRecordsResponse.Unmarshal(m, b) -} -func (m *ApplyInvoiceRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyInvoiceRecordsResponse.Marshal(b, m, deterministic) -} -func (m *ApplyInvoiceRecordsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyInvoiceRecordsResponse.Merge(m, src) -} -func (m *ApplyInvoiceRecordsResponse) XXX_Size() int { - return xxx_messageInfo_ApplyInvoiceRecordsResponse.Size(m) -} -func (m *ApplyInvoiceRecordsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyInvoiceRecordsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplyInvoiceRecordsResponse proto.InternalMessageInfo - -type ApplyInvoiceCouponsRequest struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplyInvoiceCouponsRequest) Reset() { *m = ApplyInvoiceCouponsRequest{} } -func (m *ApplyInvoiceCouponsRequest) String() string { return proto.CompactTextString(m) } -func (*ApplyInvoiceCouponsRequest) ProtoMessage() {} -func (*ApplyInvoiceCouponsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{4} -} -func (m *ApplyInvoiceCouponsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyInvoiceCouponsRequest.Unmarshal(m, b) -} -func (m *ApplyInvoiceCouponsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyInvoiceCouponsRequest.Marshal(b, m, deterministic) -} -func (m *ApplyInvoiceCouponsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyInvoiceCouponsRequest.Merge(m, src) -} -func (m *ApplyInvoiceCouponsRequest) XXX_Size() int { - return xxx_messageInfo_ApplyInvoiceCouponsRequest.Size(m) -} -func (m *ApplyInvoiceCouponsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyInvoiceCouponsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplyInvoiceCouponsRequest proto.InternalMessageInfo - -func (m *ApplyInvoiceCouponsRequest) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -type ApplyInvoiceCouponsResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplyInvoiceCouponsResponse) Reset() { *m = ApplyInvoiceCouponsResponse{} } -func (m *ApplyInvoiceCouponsResponse) String() string { return proto.CompactTextString(m) } -func (*ApplyInvoiceCouponsResponse) ProtoMessage() {} -func (*ApplyInvoiceCouponsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{5} -} -func (m *ApplyInvoiceCouponsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyInvoiceCouponsResponse.Unmarshal(m, b) -} -func (m *ApplyInvoiceCouponsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyInvoiceCouponsResponse.Marshal(b, m, deterministic) -} -func (m *ApplyInvoiceCouponsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyInvoiceCouponsResponse.Merge(m, src) -} -func (m *ApplyInvoiceCouponsResponse) XXX_Size() int { - return xxx_messageInfo_ApplyInvoiceCouponsResponse.Size(m) -} -func (m *ApplyInvoiceCouponsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyInvoiceCouponsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplyInvoiceCouponsResponse proto.InternalMessageInfo - -type ApplyInvoiceCreditsRequest struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplyInvoiceCreditsRequest) Reset() { *m = ApplyInvoiceCreditsRequest{} } -func (m *ApplyInvoiceCreditsRequest) String() string { return proto.CompactTextString(m) } -func (*ApplyInvoiceCreditsRequest) ProtoMessage() {} -func (*ApplyInvoiceCreditsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{6} -} -func (m *ApplyInvoiceCreditsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyInvoiceCreditsRequest.Unmarshal(m, b) -} -func (m *ApplyInvoiceCreditsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyInvoiceCreditsRequest.Marshal(b, m, deterministic) -} -func (m *ApplyInvoiceCreditsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyInvoiceCreditsRequest.Merge(m, src) -} -func (m *ApplyInvoiceCreditsRequest) XXX_Size() int { - return xxx_messageInfo_ApplyInvoiceCreditsRequest.Size(m) -} -func (m *ApplyInvoiceCreditsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyInvoiceCreditsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplyInvoiceCreditsRequest proto.InternalMessageInfo - -func (m *ApplyInvoiceCreditsRequest) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -type ApplyInvoiceCreditsResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplyInvoiceCreditsResponse) Reset() { *m = ApplyInvoiceCreditsResponse{} } -func (m *ApplyInvoiceCreditsResponse) String() string { return proto.CompactTextString(m) } -func (*ApplyInvoiceCreditsResponse) ProtoMessage() {} -func (*ApplyInvoiceCreditsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{7} -} -func (m *ApplyInvoiceCreditsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyInvoiceCreditsResponse.Unmarshal(m, b) -} -func (m *ApplyInvoiceCreditsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyInvoiceCreditsResponse.Marshal(b, m, deterministic) -} -func (m *ApplyInvoiceCreditsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyInvoiceCreditsResponse.Merge(m, src) -} -func (m *ApplyInvoiceCreditsResponse) XXX_Size() int { - return xxx_messageInfo_ApplyInvoiceCreditsResponse.Size(m) -} -func (m *ApplyInvoiceCreditsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyInvoiceCreditsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplyInvoiceCreditsResponse proto.InternalMessageInfo - -type CreateInvoicesRequest struct { - Period time.Time `protobuf:"bytes,1,opt,name=period,proto3,stdtime" json:"period"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateInvoicesRequest) Reset() { *m = CreateInvoicesRequest{} } -func (m *CreateInvoicesRequest) String() string { return proto.CompactTextString(m) } -func (*CreateInvoicesRequest) ProtoMessage() {} -func (*CreateInvoicesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{8} -} -func (m *CreateInvoicesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateInvoicesRequest.Unmarshal(m, b) -} -func (m *CreateInvoicesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateInvoicesRequest.Marshal(b, m, deterministic) -} -func (m *CreateInvoicesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateInvoicesRequest.Merge(m, src) -} -func (m *CreateInvoicesRequest) XXX_Size() int { - return xxx_messageInfo_CreateInvoicesRequest.Size(m) -} -func (m *CreateInvoicesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateInvoicesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateInvoicesRequest proto.InternalMessageInfo - -func (m *CreateInvoicesRequest) GetPeriod() time.Time { - if m != nil { - return m.Period - } - return time.Time{} -} - -type CreateInvoicesResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateInvoicesResponse) Reset() { *m = CreateInvoicesResponse{} } -func (m *CreateInvoicesResponse) String() string { return proto.CompactTextString(m) } -func (*CreateInvoicesResponse) ProtoMessage() {} -func (*CreateInvoicesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a9566e6e864d2854, []int{9} -} -func (m *CreateInvoicesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateInvoicesResponse.Unmarshal(m, b) -} -func (m *CreateInvoicesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateInvoicesResponse.Marshal(b, m, deterministic) -} -func (m *CreateInvoicesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateInvoicesResponse.Merge(m, src) -} -func (m *CreateInvoicesResponse) XXX_Size() int { - return xxx_messageInfo_CreateInvoicesResponse.Size(m) -} -func (m *CreateInvoicesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateInvoicesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateInvoicesResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*PrepareInvoiceRecordsRequest)(nil), "nodestats.PrepareInvoiceRecordsRequest") - proto.RegisterType((*PrepareInvoiceRecordsResponse)(nil), "nodestats.PrepareInvoiceRecordsResponse") - proto.RegisterType((*ApplyInvoiceRecordsRequest)(nil), "nodestats.ApplyInvoiceRecordsRequest") - proto.RegisterType((*ApplyInvoiceRecordsResponse)(nil), "nodestats.ApplyInvoiceRecordsResponse") - proto.RegisterType((*ApplyInvoiceCouponsRequest)(nil), "nodestats.ApplyInvoiceCouponsRequest") - proto.RegisterType((*ApplyInvoiceCouponsResponse)(nil), "nodestats.ApplyInvoiceCouponsResponse") - proto.RegisterType((*ApplyInvoiceCreditsRequest)(nil), "nodestats.ApplyInvoiceCreditsRequest") - proto.RegisterType((*ApplyInvoiceCreditsResponse)(nil), "nodestats.ApplyInvoiceCreditsResponse") - proto.RegisterType((*CreateInvoicesRequest)(nil), "nodestats.CreateInvoicesRequest") - proto.RegisterType((*CreateInvoicesResponse)(nil), "nodestats.CreateInvoicesResponse") -} - -func init() { proto.RegisterFile("payments.proto", fileDescriptor_a9566e6e864d2854) } - -var fileDescriptor_a9566e6e864d2854 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0x41, 0x4e, 0xc2, 0x40, - 0x14, 0x86, 0x25, 0x26, 0x04, 0x9f, 0x09, 0x8b, 0x51, 0x0c, 0xa9, 0x92, 0x22, 0x89, 0xca, 0x6a, - 0x9a, 0xe0, 0xd6, 0x8d, 0xb0, 0x72, 0x47, 0x88, 0x6c, 0x88, 0x9b, 0x42, 0x9f, 0x4d, 0x09, 0xed, - 0x1b, 0x67, 0x06, 0x13, 0x6e, 0xe1, 0xb1, 0x3c, 0x85, 0x1e, 0x45, 0x03, 0xd3, 0x12, 0x8a, 0x1d, - 0xd8, 0xc8, 0xb2, 0xcd, 0x9b, 0xef, 0x5b, 0xfc, 0x1f, 0x54, 0x85, 0xbf, 0x88, 0x31, 0xd1, 0x8a, - 0x0b, 0x49, 0x9a, 0xd8, 0x49, 0x42, 0x01, 0x2a, 0xed, 0x6b, 0xe5, 0x40, 0x48, 0x21, 0x99, 0xdf, - 0x8e, 0x1b, 0x12, 0x85, 0x33, 0xf4, 0x56, 0x5f, 0xe3, 0xf9, 0xab, 0xa7, 0xa3, 0x78, 0x79, 0x16, - 0x0b, 0x73, 0xd0, 0x7a, 0x81, 0xab, 0xbe, 0x44, 0xe1, 0x4b, 0x7c, 0x4a, 0xde, 0x29, 0x9a, 0xe0, - 0x00, 0x27, 0x24, 0x03, 0x35, 0xc0, 0xb7, 0x39, 0x2a, 0xcd, 0x1e, 0xa0, 0x2c, 0x50, 0x46, 0x14, - 0xd4, 0x4b, 0xcd, 0x52, 0xfb, 0xb4, 0xe3, 0x70, 0x43, 0xe4, 0x19, 0x91, 0x3f, 0x67, 0xc4, 0x6e, - 0xe5, 0xf3, 0xcb, 0x3d, 0xfa, 0xf8, 0x76, 0x4b, 0x83, 0xf4, 0x4d, 0xcb, 0x85, 0x86, 0x85, 0xae, - 0x04, 0x25, 0x0a, 0x5b, 0x23, 0x70, 0x1e, 0x85, 0x98, 0x2d, 0x0e, 0x21, 0x6f, 0xc0, 0x65, 0x21, - 0xbb, 0x58, 0xdd, 0xa3, 0xf9, 0xf2, 0xff, 0x41, 0xd4, 0x6b, 0xb6, 0x45, 0x2d, 0x31, 0x88, 0xf4, - 0x81, 0xd4, 0x19, 0x3b, 0x55, 0x0f, 0xa1, 0xd6, 0x93, 0xe8, 0xeb, 0x6c, 0x90, 0x7f, 0xb2, 0xd6, - 0xe1, 0x62, 0x1b, 0x6b, 0x84, 0x9d, 0x9f, 0x63, 0xa8, 0xf4, 0xd3, 0x56, 0xd9, 0x14, 0x6a, 0x85, - 0x3d, 0xb0, 0x3b, 0xbe, 0xee, 0x97, 0xef, 0xea, 0xd1, 0x69, 0xef, 0x3f, 0x34, 0x62, 0x16, 0xc0, - 0x59, 0xc1, 0xfc, 0xec, 0x66, 0x03, 0x60, 0x4f, 0xcf, 0xb9, 0xdd, 0x77, 0x56, 0x6c, 0x49, 0x97, - 0xb6, 0x5a, 0xf2, 0x95, 0x59, 0x2d, 0x5b, 0xc1, 0xfc, 0xb1, 0x98, 0x51, 0xed, 0x96, 0x5c, 0x50, - 0x76, 0x4b, 0xbe, 0x0d, 0x36, 0x84, 0x6a, 0x7e, 0x44, 0xd6, 0xdc, 0x78, 0x59, 0x98, 0x8d, 0x73, - 0xbd, 0xe3, 0xc2, 0x60, 0xbb, 0xe7, 0x23, 0xa6, 0x34, 0xc9, 0x29, 0x8f, 0xc8, 0x9b, 0x50, 0x1c, - 0x53, 0xe2, 0x89, 0xf1, 0xb8, 0xbc, 0xea, 0xea, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xde, - 0x0b, 0xc5, 0xc9, 0x04, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCPaymentsClient interface { - DRPCConn() drpc.Conn - - PrepareInvoiceRecords(ctx context.Context, in *PrepareInvoiceRecordsRequest) (*PrepareInvoiceRecordsResponse, error) - ApplyInvoiceRecords(ctx context.Context, in *ApplyInvoiceRecordsRequest) (*ApplyInvoiceRecordsResponse, error) - ApplyInvoiceCoupons(ctx context.Context, in *ApplyInvoiceCouponsRequest) (*ApplyInvoiceCouponsResponse, error) - ApplyInvoiceCredits(ctx context.Context, in *ApplyInvoiceCreditsRequest) (*ApplyInvoiceCreditsResponse, error) - CreateInvoices(ctx context.Context, in *CreateInvoicesRequest) (*CreateInvoicesResponse, error) -} - -type drpcPaymentsClient struct { - cc drpc.Conn -} - -func NewDRPCPaymentsClient(cc drpc.Conn) DRPCPaymentsClient { - return &drpcPaymentsClient{cc} -} - -func (c *drpcPaymentsClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcPaymentsClient) PrepareInvoiceRecords(ctx context.Context, in *PrepareInvoiceRecordsRequest) (*PrepareInvoiceRecordsResponse, error) { - out := new(PrepareInvoiceRecordsResponse) - err := c.cc.Invoke(ctx, "/nodestats.Payments/PrepareInvoiceRecords", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPaymentsClient) ApplyInvoiceRecords(ctx context.Context, in *ApplyInvoiceRecordsRequest) (*ApplyInvoiceRecordsResponse, error) { - out := new(ApplyInvoiceRecordsResponse) - err := c.cc.Invoke(ctx, "/nodestats.Payments/ApplyInvoiceRecords", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPaymentsClient) ApplyInvoiceCoupons(ctx context.Context, in *ApplyInvoiceCouponsRequest) (*ApplyInvoiceCouponsResponse, error) { - out := new(ApplyInvoiceCouponsResponse) - err := c.cc.Invoke(ctx, "/nodestats.Payments/ApplyInvoiceCoupons", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPaymentsClient) ApplyInvoiceCredits(ctx context.Context, in *ApplyInvoiceCreditsRequest) (*ApplyInvoiceCreditsResponse, error) { - out := new(ApplyInvoiceCreditsResponse) - err := c.cc.Invoke(ctx, "/nodestats.Payments/ApplyInvoiceCredits", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPaymentsClient) CreateInvoices(ctx context.Context, in *CreateInvoicesRequest) (*CreateInvoicesResponse, error) { - out := new(CreateInvoicesResponse) - err := c.cc.Invoke(ctx, "/nodestats.Payments/CreateInvoices", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCPaymentsServer interface { - PrepareInvoiceRecords(context.Context, *PrepareInvoiceRecordsRequest) (*PrepareInvoiceRecordsResponse, error) - ApplyInvoiceRecords(context.Context, *ApplyInvoiceRecordsRequest) (*ApplyInvoiceRecordsResponse, error) - ApplyInvoiceCoupons(context.Context, *ApplyInvoiceCouponsRequest) (*ApplyInvoiceCouponsResponse, error) - ApplyInvoiceCredits(context.Context, *ApplyInvoiceCreditsRequest) (*ApplyInvoiceCreditsResponse, error) - CreateInvoices(context.Context, *CreateInvoicesRequest) (*CreateInvoicesResponse, error) -} - -type DRPCPaymentsDescription struct{} - -func (DRPCPaymentsDescription) NumMethods() int { return 5 } - -func (DRPCPaymentsDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/nodestats.Payments/PrepareInvoiceRecords", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPaymentsServer). - PrepareInvoiceRecords( - ctx, - in1.(*PrepareInvoiceRecordsRequest), - ) - }, DRPCPaymentsServer.PrepareInvoiceRecords, true - case 1: - return "/nodestats.Payments/ApplyInvoiceRecords", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPaymentsServer). - ApplyInvoiceRecords( - ctx, - in1.(*ApplyInvoiceRecordsRequest), - ) - }, DRPCPaymentsServer.ApplyInvoiceRecords, true - case 2: - return "/nodestats.Payments/ApplyInvoiceCoupons", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPaymentsServer). - ApplyInvoiceCoupons( - ctx, - in1.(*ApplyInvoiceCouponsRequest), - ) - }, DRPCPaymentsServer.ApplyInvoiceCoupons, true - case 3: - return "/nodestats.Payments/ApplyInvoiceCredits", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPaymentsServer). - ApplyInvoiceCredits( - ctx, - in1.(*ApplyInvoiceCreditsRequest), - ) - }, DRPCPaymentsServer.ApplyInvoiceCredits, true - case 4: - return "/nodestats.Payments/CreateInvoices", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPaymentsServer). - CreateInvoices( - ctx, - in1.(*CreateInvoicesRequest), - ) - }, DRPCPaymentsServer.CreateInvoices, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterPayments(mux drpc.Mux, impl DRPCPaymentsServer) error { - return mux.Register(impl, DRPCPaymentsDescription{}) -} - -type DRPCPayments_PrepareInvoiceRecordsStream interface { - drpc.Stream - SendAndClose(*PrepareInvoiceRecordsResponse) error -} - -type drpcPaymentsPrepareInvoiceRecordsStream struct { - drpc.Stream -} - -func (x *drpcPaymentsPrepareInvoiceRecordsStream) SendAndClose(m *PrepareInvoiceRecordsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPayments_ApplyInvoiceRecordsStream interface { - drpc.Stream - SendAndClose(*ApplyInvoiceRecordsResponse) error -} - -type drpcPaymentsApplyInvoiceRecordsStream struct { - drpc.Stream -} - -func (x *drpcPaymentsApplyInvoiceRecordsStream) SendAndClose(m *ApplyInvoiceRecordsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPayments_ApplyInvoiceCouponsStream interface { - drpc.Stream - SendAndClose(*ApplyInvoiceCouponsResponse) error -} - -type drpcPaymentsApplyInvoiceCouponsStream struct { - drpc.Stream -} - -func (x *drpcPaymentsApplyInvoiceCouponsStream) SendAndClose(m *ApplyInvoiceCouponsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPayments_ApplyInvoiceCreditsStream interface { - drpc.Stream - SendAndClose(*ApplyInvoiceCreditsResponse) error -} - -type drpcPaymentsApplyInvoiceCreditsStream struct { - drpc.Stream -} - -func (x *drpcPaymentsApplyInvoiceCreditsStream) SendAndClose(m *ApplyInvoiceCreditsResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPayments_CreateInvoicesStream interface { - drpc.Stream - SendAndClose(*CreateInvoicesResponse) error -} - -type drpcPaymentsCreateInvoicesStream struct { - drpc.Stream -} - -func (x *drpcPaymentsCreateInvoicesStream) SendAndClose(m *CreateInvoicesResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/payments.proto b/vendor/storj.io/common/pb/payments.proto deleted file mode 100644 index e7d173cca..000000000 --- a/vendor/storj.io/common/pb/payments.proto +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package nodestats; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -service Payments { - rpc PrepareInvoiceRecords(PrepareInvoiceRecordsRequest) returns (PrepareInvoiceRecordsResponse); - rpc ApplyInvoiceRecords(ApplyInvoiceRecordsRequest) returns (ApplyInvoiceRecordsResponse); - rpc ApplyInvoiceCoupons(ApplyInvoiceCouponsRequest) returns (ApplyInvoiceCouponsResponse); - rpc ApplyInvoiceCredits(ApplyInvoiceCreditsRequest) returns (ApplyInvoiceCreditsResponse); - rpc CreateInvoices(CreateInvoicesRequest) returns (CreateInvoicesResponse); -} - -message PrepareInvoiceRecordsRequest { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message PrepareInvoiceRecordsResponse {} - -message ApplyInvoiceRecordsRequest { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message ApplyInvoiceRecordsResponse {} - -message ApplyInvoiceCouponsRequest { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message ApplyInvoiceCouponsResponse {} - -message ApplyInvoiceCreditsRequest { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message ApplyInvoiceCreditsResponse {} - -message CreateInvoicesRequest { - google.protobuf.Timestamp period = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; -} - -message CreateInvoicesResponse {} diff --git a/vendor/storj.io/common/pb/piecestore2.pb.go b/vendor/storj.io/common/pb/piecestore2.pb.go deleted file mode 100644 index 04cecdf71..000000000 --- a/vendor/storj.io/common/pb/piecestore2.pb.go +++ /dev/null @@ -1,1164 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: piecestore2.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type PieceHeader_FormatVersion int32 - -const ( - PieceHeader_FORMAT_V0 PieceHeader_FormatVersion = 0 - PieceHeader_FORMAT_V1 PieceHeader_FormatVersion = 1 -) - -var PieceHeader_FormatVersion_name = map[int32]string{ - 0: "FORMAT_V0", - 1: "FORMAT_V1", -} - -var PieceHeader_FormatVersion_value = map[string]int32{ - "FORMAT_V0": 0, - "FORMAT_V1": 1, -} - -func (x PieceHeader_FormatVersion) String() string { - return proto.EnumName(PieceHeader_FormatVersion_name, int32(x)) -} - -func (PieceHeader_FormatVersion) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{12, 0} -} - -// Expected order of messages from uplink: -// OrderLimit -> -// repeated -// Order -> -// Chunk -> -// PieceHash signed by uplink -> -// <- PieceHash signed by storage node -type PieceUploadRequest struct { - // first message to show that we are allowed to upload - Limit *OrderLimit `protobuf:"bytes,1,opt,name=limit,proto3" json:"limit,omitempty"` - // order for uploading - Order *Order `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"` - Chunk *PieceUploadRequest_Chunk `protobuf:"bytes,3,opt,name=chunk,proto3" json:"chunk,omitempty"` - // final message - Done *PieceHash `protobuf:"bytes,4,opt,name=done,proto3" json:"done,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceUploadRequest) Reset() { *m = PieceUploadRequest{} } -func (m *PieceUploadRequest) String() string { return proto.CompactTextString(m) } -func (*PieceUploadRequest) ProtoMessage() {} -func (*PieceUploadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{0} -} -func (m *PieceUploadRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceUploadRequest.Unmarshal(m, b) -} -func (m *PieceUploadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceUploadRequest.Marshal(b, m, deterministic) -} -func (m *PieceUploadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceUploadRequest.Merge(m, src) -} -func (m *PieceUploadRequest) XXX_Size() int { - return xxx_messageInfo_PieceUploadRequest.Size(m) -} -func (m *PieceUploadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PieceUploadRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceUploadRequest proto.InternalMessageInfo - -func (m *PieceUploadRequest) GetLimit() *OrderLimit { - if m != nil { - return m.Limit - } - return nil -} - -func (m *PieceUploadRequest) GetOrder() *Order { - if m != nil { - return m.Order - } - return nil -} - -func (m *PieceUploadRequest) GetChunk() *PieceUploadRequest_Chunk { - if m != nil { - return m.Chunk - } - return nil -} - -func (m *PieceUploadRequest) GetDone() *PieceHash { - if m != nil { - return m.Done - } - return nil -} - -// data message -type PieceUploadRequest_Chunk struct { - Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceUploadRequest_Chunk) Reset() { *m = PieceUploadRequest_Chunk{} } -func (m *PieceUploadRequest_Chunk) String() string { return proto.CompactTextString(m) } -func (*PieceUploadRequest_Chunk) ProtoMessage() {} -func (*PieceUploadRequest_Chunk) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{0, 0} -} -func (m *PieceUploadRequest_Chunk) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceUploadRequest_Chunk.Unmarshal(m, b) -} -func (m *PieceUploadRequest_Chunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceUploadRequest_Chunk.Marshal(b, m, deterministic) -} -func (m *PieceUploadRequest_Chunk) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceUploadRequest_Chunk.Merge(m, src) -} -func (m *PieceUploadRequest_Chunk) XXX_Size() int { - return xxx_messageInfo_PieceUploadRequest_Chunk.Size(m) -} -func (m *PieceUploadRequest_Chunk) XXX_DiscardUnknown() { - xxx_messageInfo_PieceUploadRequest_Chunk.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceUploadRequest_Chunk proto.InternalMessageInfo - -func (m *PieceUploadRequest_Chunk) GetOffset() int64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *PieceUploadRequest_Chunk) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -type PieceUploadResponse struct { - Done *PieceHash `protobuf:"bytes,1,opt,name=done,proto3" json:"done,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceUploadResponse) Reset() { *m = PieceUploadResponse{} } -func (m *PieceUploadResponse) String() string { return proto.CompactTextString(m) } -func (*PieceUploadResponse) ProtoMessage() {} -func (*PieceUploadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{1} -} -func (m *PieceUploadResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceUploadResponse.Unmarshal(m, b) -} -func (m *PieceUploadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceUploadResponse.Marshal(b, m, deterministic) -} -func (m *PieceUploadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceUploadResponse.Merge(m, src) -} -func (m *PieceUploadResponse) XXX_Size() int { - return xxx_messageInfo_PieceUploadResponse.Size(m) -} -func (m *PieceUploadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PieceUploadResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceUploadResponse proto.InternalMessageInfo - -func (m *PieceUploadResponse) GetDone() *PieceHash { - if m != nil { - return m.Done - } - return nil -} - -// Expected order of messages from uplink: -// {OrderLimit, Chunk} -> -// go repeated -// Order -> (async) -// go repeated -// <- PieceDownloadResponse.Chunk -type PieceDownloadRequest struct { - // first message to show that we are allowed to upload - Limit *OrderLimit `protobuf:"bytes,1,opt,name=limit,proto3" json:"limit,omitempty"` - // order for downloading - Order *Order `protobuf:"bytes,2,opt,name=order,proto3" json:"order,omitempty"` - // request for the chunk - Chunk *PieceDownloadRequest_Chunk `protobuf:"bytes,3,opt,name=chunk,proto3" json:"chunk,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceDownloadRequest) Reset() { *m = PieceDownloadRequest{} } -func (m *PieceDownloadRequest) String() string { return proto.CompactTextString(m) } -func (*PieceDownloadRequest) ProtoMessage() {} -func (*PieceDownloadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{2} -} -func (m *PieceDownloadRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceDownloadRequest.Unmarshal(m, b) -} -func (m *PieceDownloadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceDownloadRequest.Marshal(b, m, deterministic) -} -func (m *PieceDownloadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceDownloadRequest.Merge(m, src) -} -func (m *PieceDownloadRequest) XXX_Size() int { - return xxx_messageInfo_PieceDownloadRequest.Size(m) -} -func (m *PieceDownloadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PieceDownloadRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceDownloadRequest proto.InternalMessageInfo - -func (m *PieceDownloadRequest) GetLimit() *OrderLimit { - if m != nil { - return m.Limit - } - return nil -} - -func (m *PieceDownloadRequest) GetOrder() *Order { - if m != nil { - return m.Order - } - return nil -} - -func (m *PieceDownloadRequest) GetChunk() *PieceDownloadRequest_Chunk { - if m != nil { - return m.Chunk - } - return nil -} - -// Chunk that we wish to download -type PieceDownloadRequest_Chunk struct { - Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` - ChunkSize int64 `protobuf:"varint,2,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceDownloadRequest_Chunk) Reset() { *m = PieceDownloadRequest_Chunk{} } -func (m *PieceDownloadRequest_Chunk) String() string { return proto.CompactTextString(m) } -func (*PieceDownloadRequest_Chunk) ProtoMessage() {} -func (*PieceDownloadRequest_Chunk) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{2, 0} -} -func (m *PieceDownloadRequest_Chunk) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceDownloadRequest_Chunk.Unmarshal(m, b) -} -func (m *PieceDownloadRequest_Chunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceDownloadRequest_Chunk.Marshal(b, m, deterministic) -} -func (m *PieceDownloadRequest_Chunk) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceDownloadRequest_Chunk.Merge(m, src) -} -func (m *PieceDownloadRequest_Chunk) XXX_Size() int { - return xxx_messageInfo_PieceDownloadRequest_Chunk.Size(m) -} -func (m *PieceDownloadRequest_Chunk) XXX_DiscardUnknown() { - xxx_messageInfo_PieceDownloadRequest_Chunk.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceDownloadRequest_Chunk proto.InternalMessageInfo - -func (m *PieceDownloadRequest_Chunk) GetOffset() int64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *PieceDownloadRequest_Chunk) GetChunkSize() int64 { - if m != nil { - return m.ChunkSize - } - return 0 -} - -type PieceDownloadResponse struct { - Chunk *PieceDownloadResponse_Chunk `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"` - Hash *PieceHash `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` - Limit *OrderLimit `protobuf:"bytes,3,opt,name=limit,proto3" json:"limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceDownloadResponse) Reset() { *m = PieceDownloadResponse{} } -func (m *PieceDownloadResponse) String() string { return proto.CompactTextString(m) } -func (*PieceDownloadResponse) ProtoMessage() {} -func (*PieceDownloadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{3} -} -func (m *PieceDownloadResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceDownloadResponse.Unmarshal(m, b) -} -func (m *PieceDownloadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceDownloadResponse.Marshal(b, m, deterministic) -} -func (m *PieceDownloadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceDownloadResponse.Merge(m, src) -} -func (m *PieceDownloadResponse) XXX_Size() int { - return xxx_messageInfo_PieceDownloadResponse.Size(m) -} -func (m *PieceDownloadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PieceDownloadResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceDownloadResponse proto.InternalMessageInfo - -func (m *PieceDownloadResponse) GetChunk() *PieceDownloadResponse_Chunk { - if m != nil { - return m.Chunk - } - return nil -} - -func (m *PieceDownloadResponse) GetHash() *PieceHash { - if m != nil { - return m.Hash - } - return nil -} - -func (m *PieceDownloadResponse) GetLimit() *OrderLimit { - if m != nil { - return m.Limit - } - return nil -} - -// Chunk response for download request -type PieceDownloadResponse_Chunk struct { - Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceDownloadResponse_Chunk) Reset() { *m = PieceDownloadResponse_Chunk{} } -func (m *PieceDownloadResponse_Chunk) String() string { return proto.CompactTextString(m) } -func (*PieceDownloadResponse_Chunk) ProtoMessage() {} -func (*PieceDownloadResponse_Chunk) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{3, 0} -} -func (m *PieceDownloadResponse_Chunk) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceDownloadResponse_Chunk.Unmarshal(m, b) -} -func (m *PieceDownloadResponse_Chunk) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceDownloadResponse_Chunk.Marshal(b, m, deterministic) -} -func (m *PieceDownloadResponse_Chunk) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceDownloadResponse_Chunk.Merge(m, src) -} -func (m *PieceDownloadResponse_Chunk) XXX_Size() int { - return xxx_messageInfo_PieceDownloadResponse_Chunk.Size(m) -} -func (m *PieceDownloadResponse_Chunk) XXX_DiscardUnknown() { - xxx_messageInfo_PieceDownloadResponse_Chunk.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceDownloadResponse_Chunk proto.InternalMessageInfo - -func (m *PieceDownloadResponse_Chunk) GetOffset() int64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *PieceDownloadResponse_Chunk) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -type PieceDeleteRequest struct { - Limit *OrderLimit `protobuf:"bytes,1,opt,name=limit,proto3" json:"limit,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceDeleteRequest) Reset() { *m = PieceDeleteRequest{} } -func (m *PieceDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*PieceDeleteRequest) ProtoMessage() {} -func (*PieceDeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{4} -} -func (m *PieceDeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceDeleteRequest.Unmarshal(m, b) -} -func (m *PieceDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceDeleteRequest.Marshal(b, m, deterministic) -} -func (m *PieceDeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceDeleteRequest.Merge(m, src) -} -func (m *PieceDeleteRequest) XXX_Size() int { - return xxx_messageInfo_PieceDeleteRequest.Size(m) -} -func (m *PieceDeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PieceDeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceDeleteRequest proto.InternalMessageInfo - -func (m *PieceDeleteRequest) GetLimit() *OrderLimit { - if m != nil { - return m.Limit - } - return nil -} - -type PieceDeleteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceDeleteResponse) Reset() { *m = PieceDeleteResponse{} } -func (m *PieceDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*PieceDeleteResponse) ProtoMessage() {} -func (*PieceDeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{5} -} -func (m *PieceDeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceDeleteResponse.Unmarshal(m, b) -} -func (m *PieceDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceDeleteResponse.Marshal(b, m, deterministic) -} -func (m *PieceDeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceDeleteResponse.Merge(m, src) -} -func (m *PieceDeleteResponse) XXX_Size() int { - return xxx_messageInfo_PieceDeleteResponse.Size(m) -} -func (m *PieceDeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PieceDeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceDeleteResponse proto.InternalMessageInfo - -type DeletePiecesRequest struct { - PieceIds []PieceID `protobuf:"bytes,1,rep,name=piece_ids,json=pieceIds,proto3,customtype=PieceID" json:"piece_ids"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeletePiecesRequest) Reset() { *m = DeletePiecesRequest{} } -func (m *DeletePiecesRequest) String() string { return proto.CompactTextString(m) } -func (*DeletePiecesRequest) ProtoMessage() {} -func (*DeletePiecesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{6} -} -func (m *DeletePiecesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeletePiecesRequest.Unmarshal(m, b) -} -func (m *DeletePiecesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeletePiecesRequest.Marshal(b, m, deterministic) -} -func (m *DeletePiecesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeletePiecesRequest.Merge(m, src) -} -func (m *DeletePiecesRequest) XXX_Size() int { - return xxx_messageInfo_DeletePiecesRequest.Size(m) -} -func (m *DeletePiecesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeletePiecesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeletePiecesRequest proto.InternalMessageInfo - -type DeletePiecesResponse struct { - UnhandledCount int64 `protobuf:"varint,1,opt,name=unhandled_count,json=unhandledCount,proto3" json:"unhandled_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeletePiecesResponse) Reset() { *m = DeletePiecesResponse{} } -func (m *DeletePiecesResponse) String() string { return proto.CompactTextString(m) } -func (*DeletePiecesResponse) ProtoMessage() {} -func (*DeletePiecesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{7} -} -func (m *DeletePiecesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeletePiecesResponse.Unmarshal(m, b) -} -func (m *DeletePiecesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeletePiecesResponse.Marshal(b, m, deterministic) -} -func (m *DeletePiecesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeletePiecesResponse.Merge(m, src) -} -func (m *DeletePiecesResponse) XXX_Size() int { - return xxx_messageInfo_DeletePiecesResponse.Size(m) -} -func (m *DeletePiecesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeletePiecesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeletePiecesResponse proto.InternalMessageInfo - -func (m *DeletePiecesResponse) GetUnhandledCount() int64 { - if m != nil { - return m.UnhandledCount - } - return 0 -} - -type RetainRequest struct { - CreationDate time.Time `protobuf:"bytes,1,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"` - Filter []byte `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RetainRequest) Reset() { *m = RetainRequest{} } -func (m *RetainRequest) String() string { return proto.CompactTextString(m) } -func (*RetainRequest) ProtoMessage() {} -func (*RetainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{8} -} -func (m *RetainRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RetainRequest.Unmarshal(m, b) -} -func (m *RetainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RetainRequest.Marshal(b, m, deterministic) -} -func (m *RetainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RetainRequest.Merge(m, src) -} -func (m *RetainRequest) XXX_Size() int { - return xxx_messageInfo_RetainRequest.Size(m) -} -func (m *RetainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RetainRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RetainRequest proto.InternalMessageInfo - -func (m *RetainRequest) GetCreationDate() time.Time { - if m != nil { - return m.CreationDate - } - return time.Time{} -} - -func (m *RetainRequest) GetFilter() []byte { - if m != nil { - return m.Filter - } - return nil -} - -type RetainResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RetainResponse) Reset() { *m = RetainResponse{} } -func (m *RetainResponse) String() string { return proto.CompactTextString(m) } -func (*RetainResponse) ProtoMessage() {} -func (*RetainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{9} -} -func (m *RetainResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RetainResponse.Unmarshal(m, b) -} -func (m *RetainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RetainResponse.Marshal(b, m, deterministic) -} -func (m *RetainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RetainResponse.Merge(m, src) -} -func (m *RetainResponse) XXX_Size() int { - return xxx_messageInfo_RetainResponse.Size(m) -} -func (m *RetainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RetainResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RetainResponse proto.InternalMessageInfo - -type RestoreTrashRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RestoreTrashRequest) Reset() { *m = RestoreTrashRequest{} } -func (m *RestoreTrashRequest) String() string { return proto.CompactTextString(m) } -func (*RestoreTrashRequest) ProtoMessage() {} -func (*RestoreTrashRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{10} -} -func (m *RestoreTrashRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RestoreTrashRequest.Unmarshal(m, b) -} -func (m *RestoreTrashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RestoreTrashRequest.Marshal(b, m, deterministic) -} -func (m *RestoreTrashRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RestoreTrashRequest.Merge(m, src) -} -func (m *RestoreTrashRequest) XXX_Size() int { - return xxx_messageInfo_RestoreTrashRequest.Size(m) -} -func (m *RestoreTrashRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RestoreTrashRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RestoreTrashRequest proto.InternalMessageInfo - -type RestoreTrashResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RestoreTrashResponse) Reset() { *m = RestoreTrashResponse{} } -func (m *RestoreTrashResponse) String() string { return proto.CompactTextString(m) } -func (*RestoreTrashResponse) ProtoMessage() {} -func (*RestoreTrashResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{11} -} -func (m *RestoreTrashResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RestoreTrashResponse.Unmarshal(m, b) -} -func (m *RestoreTrashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RestoreTrashResponse.Marshal(b, m, deterministic) -} -func (m *RestoreTrashResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RestoreTrashResponse.Merge(m, src) -} -func (m *RestoreTrashResponse) XXX_Size() int { - return xxx_messageInfo_RestoreTrashResponse.Size(m) -} -func (m *RestoreTrashResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RestoreTrashResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RestoreTrashResponse proto.InternalMessageInfo - -// PieceHeader is used in piece storage to keep track of piece attributes. -type PieceHeader struct { - // the storage format version being used for this piece. The piece filename should agree with this. - // The inclusion of this field is intended to aid repairability when filenames are damaged. - FormatVersion PieceHeader_FormatVersion `protobuf:"varint,1,opt,name=format_version,json=formatVersion,proto3,enum=piecestore.PieceHeader_FormatVersion" json:"format_version,omitempty"` - // content hash of the piece - Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` - // timestamp when upload occurred, as given by the "timestamp" field in the original orders.PieceHash - CreationTime time.Time `protobuf:"bytes,3,opt,name=creation_time,json=creationTime,proto3,stdtime" json:"creation_time"` - // signature from uplink over the original orders.PieceHash (the corresponding PieceHashSigning - // is reconstructable using the piece id from the piecestore, the piece size from the - // filesystem (minus the piece header size), and these (hash, upload_time, signature) fields). - Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` - // the OrderLimit authorizing storage of this piece, as signed by the satellite and sent by - // the uplink - OrderLimit OrderLimit `protobuf:"bytes,5,opt,name=order_limit,json=orderLimit,proto3" json:"order_limit"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PieceHeader) Reset() { *m = PieceHeader{} } -func (m *PieceHeader) String() string { return proto.CompactTextString(m) } -func (*PieceHeader) ProtoMessage() {} -func (*PieceHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_23ff32dd550c2439, []int{12} -} -func (m *PieceHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PieceHeader.Unmarshal(m, b) -} -func (m *PieceHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PieceHeader.Marshal(b, m, deterministic) -} -func (m *PieceHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_PieceHeader.Merge(m, src) -} -func (m *PieceHeader) XXX_Size() int { - return xxx_messageInfo_PieceHeader.Size(m) -} -func (m *PieceHeader) XXX_DiscardUnknown() { - xxx_messageInfo_PieceHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_PieceHeader proto.InternalMessageInfo - -func (m *PieceHeader) GetFormatVersion() PieceHeader_FormatVersion { - if m != nil { - return m.FormatVersion - } - return PieceHeader_FORMAT_V0 -} - -func (m *PieceHeader) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *PieceHeader) GetCreationTime() time.Time { - if m != nil { - return m.CreationTime - } - return time.Time{} -} - -func (m *PieceHeader) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func (m *PieceHeader) GetOrderLimit() OrderLimit { - if m != nil { - return m.OrderLimit - } - return OrderLimit{} -} - -func init() { - proto.RegisterEnum("piecestore.PieceHeader_FormatVersion", PieceHeader_FormatVersion_name, PieceHeader_FormatVersion_value) - proto.RegisterType((*PieceUploadRequest)(nil), "piecestore.PieceUploadRequest") - proto.RegisterType((*PieceUploadRequest_Chunk)(nil), "piecestore.PieceUploadRequest.Chunk") - proto.RegisterType((*PieceUploadResponse)(nil), "piecestore.PieceUploadResponse") - proto.RegisterType((*PieceDownloadRequest)(nil), "piecestore.PieceDownloadRequest") - proto.RegisterType((*PieceDownloadRequest_Chunk)(nil), "piecestore.PieceDownloadRequest.Chunk") - proto.RegisterType((*PieceDownloadResponse)(nil), "piecestore.PieceDownloadResponse") - proto.RegisterType((*PieceDownloadResponse_Chunk)(nil), "piecestore.PieceDownloadResponse.Chunk") - proto.RegisterType((*PieceDeleteRequest)(nil), "piecestore.PieceDeleteRequest") - proto.RegisterType((*PieceDeleteResponse)(nil), "piecestore.PieceDeleteResponse") - proto.RegisterType((*DeletePiecesRequest)(nil), "piecestore.DeletePiecesRequest") - proto.RegisterType((*DeletePiecesResponse)(nil), "piecestore.DeletePiecesResponse") - proto.RegisterType((*RetainRequest)(nil), "piecestore.RetainRequest") - proto.RegisterType((*RetainResponse)(nil), "piecestore.RetainResponse") - proto.RegisterType((*RestoreTrashRequest)(nil), "piecestore.RestoreTrashRequest") - proto.RegisterType((*RestoreTrashResponse)(nil), "piecestore.RestoreTrashResponse") - proto.RegisterType((*PieceHeader)(nil), "piecestore.PieceHeader") -} - -func init() { proto.RegisterFile("piecestore2.proto", fileDescriptor_23ff32dd550c2439) } - -var fileDescriptor_23ff32dd550c2439 = []byte{ - // 786 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x4f, 0x13, 0x5d, - 0x14, 0xee, 0xd0, 0x8f, 0x97, 0x1e, 0xa6, 0x05, 0x2e, 0x85, 0xf4, 0x9d, 0xbc, 0xaf, 0xad, 0xa3, - 0x48, 0x17, 0x3a, 0xc5, 0xb2, 0xd2, 0x20, 0xc4, 0xd2, 0x10, 0x49, 0x40, 0xf0, 0xf2, 0xb1, 0x70, - 0xd3, 0x0c, 0x9d, 0xdb, 0x76, 0xb4, 0x9d, 0x5b, 0x67, 0x6e, 0x35, 0xe1, 0x17, 0xb8, 0xf4, 0x37, - 0xb9, 0xf2, 0x37, 0x18, 0x83, 0x0b, 0x97, 0xfe, 0x04, 0x37, 0xe6, 0x7e, 0x4c, 0xdb, 0xa1, 0x85, - 0x06, 0x13, 0x57, 0xed, 0x3d, 0xe7, 0x39, 0xf7, 0x3c, 0xf7, 0x99, 0xe7, 0x1c, 0x58, 0xec, 0xb9, - 0xa4, 0x41, 0x02, 0x46, 0x7d, 0x52, 0xb1, 0x7a, 0x3e, 0x65, 0x14, 0xc1, 0x30, 0x64, 0x40, 0x8b, - 0xb6, 0xa8, 0x8c, 0x1b, 0x85, 0x16, 0xa5, 0xad, 0x0e, 0x29, 0x8b, 0xd3, 0x79, 0xbf, 0x59, 0x66, - 0x6e, 0x97, 0x04, 0xcc, 0xee, 0xf6, 0x14, 0x40, 0xa7, 0xbe, 0x43, 0xfc, 0x40, 0x9e, 0xcc, 0x5f, - 0x1a, 0xa0, 0x23, 0x7e, 0xd3, 0x69, 0xaf, 0x43, 0x6d, 0x07, 0x93, 0x77, 0x7d, 0x12, 0x30, 0x54, - 0x82, 0x64, 0xc7, 0xed, 0xba, 0x2c, 0xaf, 0x15, 0xb5, 0xd2, 0x5c, 0x05, 0x59, 0xaa, 0xe8, 0x90, - 0xff, 0xec, 0xf3, 0x0c, 0x96, 0x00, 0x74, 0x0f, 0x92, 0x22, 0x97, 0x9f, 0x11, 0xc8, 0x4c, 0x04, - 0x89, 0x65, 0x0e, 0x3d, 0x85, 0x64, 0xa3, 0xdd, 0xf7, 0xde, 0xe6, 0xe3, 0x02, 0x74, 0xdf, 0x1a, - 0x92, 0xb7, 0xc6, 0xbb, 0x5b, 0x3b, 0x1c, 0x8b, 0x65, 0x09, 0x5a, 0x85, 0x84, 0x43, 0x3d, 0x92, - 0x4f, 0x88, 0xd2, 0xc5, 0xf0, 0x7e, 0x51, 0xf6, 0xc2, 0x0e, 0xda, 0x58, 0xa4, 0x8d, 0x0d, 0x48, - 0x8a, 0x32, 0xb4, 0x02, 0x29, 0xda, 0x6c, 0x06, 0x44, 0x72, 0x8f, 0x63, 0x75, 0x42, 0x08, 0x12, - 0x8e, 0xcd, 0x6c, 0xc1, 0x53, 0xc7, 0xe2, 0xbf, 0xb9, 0x09, 0x4b, 0x91, 0xf6, 0x41, 0x8f, 0x7a, - 0x01, 0x19, 0xb4, 0xd4, 0x6e, 0x6c, 0x69, 0xfe, 0xd0, 0x20, 0x27, 0x62, 0x35, 0xfa, 0xc1, 0xfb, - 0x8b, 0xea, 0x6d, 0x46, 0xd5, 0x7b, 0x30, 0xa6, 0xde, 0x95, 0xfe, 0x11, 0xfd, 0x8c, 0xad, 0x69, - 0xc2, 0xfc, 0x0f, 0x20, 0x90, 0xf5, 0xc0, 0xbd, 0x20, 0x82, 0x48, 0x1c, 0xa7, 0x45, 0xe4, 0xd8, - 0xbd, 0x20, 0xe6, 0x37, 0x0d, 0x96, 0xaf, 0x74, 0x51, 0x32, 0x3d, 0x0b, 0x79, 0xc9, 0x67, 0xae, - 0xdd, 0xc0, 0x4b, 0x56, 0x8c, 0x7d, 0xd8, 0xb6, 0x1d, 0xb4, 0xd5, 0xd3, 0x27, 0xa9, 0xcc, 0xd3, - 0x43, 0x31, 0xe3, 0x53, 0xc4, 0xfc, 0x33, 0x0b, 0x6c, 0x29, 0xff, 0xd7, 0x48, 0x87, 0x30, 0x72, - 0xeb, 0x2f, 0x68, 0x2e, 0x2b, 0x0b, 0x85, 0xf5, 0xf2, 0xa5, 0xe6, 0x0e, 0x2c, 0xc9, 0x88, 0x48, - 0x06, 0xe1, 0xbd, 0x0f, 0x21, 0x2d, 0x44, 0xaa, 0xbb, 0x4e, 0x90, 0xd7, 0x8a, 0xf1, 0x92, 0x5e, - 0x9d, 0xff, 0x72, 0x59, 0x88, 0x7d, 0xbd, 0x2c, 0xfc, 0x23, 0x90, 0x7b, 0x35, 0x3c, 0x2b, 0x10, - 0x7b, 0x4e, 0x60, 0x6e, 0x43, 0x2e, 0x7a, 0x89, 0x12, 0x7e, 0x0d, 0xe6, 0xfb, 0x5e, 0xdb, 0xf6, - 0x9c, 0x0e, 0x71, 0xea, 0x0d, 0xda, 0xf7, 0xc2, 0x87, 0x66, 0x07, 0xe1, 0x1d, 0x1e, 0x35, 0x7d, - 0xc8, 0x60, 0xc2, 0x6c, 0xd7, 0x0b, 0xfb, 0xef, 0x41, 0xa6, 0xe1, 0x13, 0x9b, 0xb9, 0xd4, 0xab, - 0x3b, 0x36, 0x0b, 0x2d, 0x6e, 0x58, 0x72, 0x6b, 0x58, 0xe1, 0xd6, 0xb0, 0x4e, 0xc2, 0xad, 0x51, - 0x9d, 0xe5, 0xfc, 0x3e, 0x7d, 0x2f, 0x68, 0x58, 0x0f, 0x4b, 0x6b, 0x36, 0x23, 0x5c, 0xe4, 0xa6, - 0xdb, 0x61, 0xca, 0xbb, 0x3a, 0x56, 0x27, 0x73, 0x01, 0xb2, 0x61, 0x4f, 0xa5, 0xc5, 0x32, 0x2c, - 0x61, 0x69, 0x8b, 0x13, 0x9f, 0x7f, 0x57, 0xc9, 0xc5, 0x5c, 0x81, 0x5c, 0x34, 0xac, 0xe0, 0x9f, - 0x67, 0x60, 0x4e, 0x9a, 0x80, 0xd8, 0xdc, 0xfe, 0xfb, 0x90, 0x6d, 0x52, 0xbf, 0x6b, 0xb3, 0xfa, - 0x7b, 0xe2, 0x07, 0x2e, 0xf5, 0x04, 0xe9, 0x6c, 0x65, 0x75, 0xcc, 0x6f, 0xb2, 0xc0, 0xda, 0x15, - 0xe8, 0x33, 0x09, 0xc6, 0x99, 0xe6, 0xe8, 0x91, 0x7b, 0x60, 0xe0, 0x3a, 0x5d, 0x59, 0x6c, 0x54, - 0x15, 0xbe, 0x2e, 0x95, 0xd5, 0x6e, 0xa9, 0x0a, 0x4f, 0xa2, 0xff, 0x20, 0x1d, 0xb8, 0x2d, 0xcf, - 0x66, 0x7d, 0x5f, 0xae, 0x2c, 0x1d, 0x0f, 0x03, 0xe8, 0x09, 0xcc, 0x09, 0x23, 0xd5, 0xa5, 0xb9, - 0x92, 0xd7, 0x99, 0xab, 0x9a, 0xe0, 0xd7, 0x63, 0xa0, 0x83, 0x88, 0xf9, 0x08, 0x32, 0x91, 0x77, - 0xa1, 0x0c, 0xa4, 0x77, 0x0f, 0xf1, 0xc1, 0xf3, 0x93, 0xfa, 0xd9, 0xfa, 0x42, 0x6c, 0xf4, 0xf8, - 0x78, 0x41, 0xab, 0xfc, 0x8c, 0x03, 0x1c, 0x0d, 0xe4, 0x41, 0x07, 0x90, 0x92, 0x3b, 0x0e, 0xdd, - 0xb9, 0x79, 0xf7, 0x1a, 0x85, 0x6b, 0xf3, 0xea, 0xf3, 0xc4, 0x4a, 0x1a, 0x3a, 0x85, 0xd9, 0x70, - 0xb6, 0x51, 0x71, 0xda, 0x3a, 0x32, 0xee, 0x4e, 0x5d, 0x0c, 0xfc, 0xd2, 0x75, 0x0d, 0xbd, 0x84, - 0x94, 0xf4, 0xfb, 0x04, 0x96, 0x91, 0xf9, 0x9c, 0xc0, 0xf2, 0xca, 0xfc, 0xc5, 0x3f, 0xce, 0x68, - 0xe8, 0x15, 0xe8, 0xa3, 0xf3, 0x83, 0x22, 0x55, 0x13, 0xc6, 0xd3, 0x28, 0x5e, 0x0f, 0x50, 0xa3, - 0xb7, 0x0d, 0x29, 0xe9, 0x6e, 0xf4, 0xef, 0x28, 0x36, 0x32, 0x65, 0x86, 0x31, 0x29, 0xa5, 0x2e, - 0x38, 0x06, 0x7d, 0xd4, 0xf5, 0x51, 0x4e, 0x13, 0xc6, 0x24, 0xca, 0x69, 0xe2, 0xc0, 0xc4, 0xaa, - 0xb9, 0xd7, 0x88, 0xc7, 0xdf, 0x58, 0x2e, 0x2d, 0x37, 0x68, 0xb7, 0x4b, 0xbd, 0x72, 0xef, 0xfc, - 0x3c, 0x25, 0x7c, 0xbb, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x46, 0xf3, 0x6f, 0x64, 0x3e, 0x08, - 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCPiecestoreClient interface { - DRPCConn() drpc.Conn - - Upload(ctx context.Context) (DRPCPiecestore_UploadClient, error) - Download(ctx context.Context) (DRPCPiecestore_DownloadClient, error) - Delete(ctx context.Context, in *PieceDeleteRequest) (*PieceDeleteResponse, error) - // DeletePieces deletes a set of pieces on satellite request - DeletePieces(ctx context.Context, in *DeletePiecesRequest) (*DeletePiecesResponse, error) - Retain(ctx context.Context, in *RetainRequest) (*RetainResponse, error) - RestoreTrash(ctx context.Context, in *RestoreTrashRequest) (*RestoreTrashResponse, error) -} - -type drpcPiecestoreClient struct { - cc drpc.Conn -} - -func NewDRPCPiecestoreClient(cc drpc.Conn) DRPCPiecestoreClient { - return &drpcPiecestoreClient{cc} -} - -func (c *drpcPiecestoreClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcPiecestoreClient) Upload(ctx context.Context) (DRPCPiecestore_UploadClient, error) { - stream, err := c.cc.NewStream(ctx, "/piecestore.Piecestore/Upload") - if err != nil { - return nil, err - } - x := &drpcPiecestoreUploadClient{stream} - return x, nil -} - -type DRPCPiecestore_UploadClient interface { - drpc.Stream - Send(*PieceUploadRequest) error - CloseAndRecv() (*PieceUploadResponse, error) -} - -type drpcPiecestoreUploadClient struct { - drpc.Stream -} - -func (x *drpcPiecestoreUploadClient) Send(m *PieceUploadRequest) error { - return x.MsgSend(m) -} - -func (x *drpcPiecestoreUploadClient) CloseAndRecv() (*PieceUploadResponse, error) { - if err := x.CloseSend(); err != nil { - return nil, err - } - m := new(PieceUploadResponse) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *drpcPiecestoreClient) Download(ctx context.Context) (DRPCPiecestore_DownloadClient, error) { - stream, err := c.cc.NewStream(ctx, "/piecestore.Piecestore/Download") - if err != nil { - return nil, err - } - x := &drpcPiecestoreDownloadClient{stream} - return x, nil -} - -type DRPCPiecestore_DownloadClient interface { - drpc.Stream - Send(*PieceDownloadRequest) error - Recv() (*PieceDownloadResponse, error) -} - -type drpcPiecestoreDownloadClient struct { - drpc.Stream -} - -func (x *drpcPiecestoreDownloadClient) Send(m *PieceDownloadRequest) error { - return x.MsgSend(m) -} - -func (x *drpcPiecestoreDownloadClient) Recv() (*PieceDownloadResponse, error) { - m := new(PieceDownloadResponse) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *drpcPiecestoreClient) Delete(ctx context.Context, in *PieceDeleteRequest) (*PieceDeleteResponse, error) { - out := new(PieceDeleteResponse) - err := c.cc.Invoke(ctx, "/piecestore.Piecestore/Delete", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPiecestoreClient) DeletePieces(ctx context.Context, in *DeletePiecesRequest) (*DeletePiecesResponse, error) { - out := new(DeletePiecesResponse) - err := c.cc.Invoke(ctx, "/piecestore.Piecestore/DeletePieces", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPiecestoreClient) Retain(ctx context.Context, in *RetainRequest) (*RetainResponse, error) { - out := new(RetainResponse) - err := c.cc.Invoke(ctx, "/piecestore.Piecestore/Retain", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcPiecestoreClient) RestoreTrash(ctx context.Context, in *RestoreTrashRequest) (*RestoreTrashResponse, error) { - out := new(RestoreTrashResponse) - err := c.cc.Invoke(ctx, "/piecestore.Piecestore/RestoreTrash", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCPiecestoreServer interface { - Upload(DRPCPiecestore_UploadStream) error - Download(DRPCPiecestore_DownloadStream) error - Delete(context.Context, *PieceDeleteRequest) (*PieceDeleteResponse, error) - // DeletePieces deletes a set of pieces on satellite request - DeletePieces(context.Context, *DeletePiecesRequest) (*DeletePiecesResponse, error) - Retain(context.Context, *RetainRequest) (*RetainResponse, error) - RestoreTrash(context.Context, *RestoreTrashRequest) (*RestoreTrashResponse, error) -} - -type DRPCPiecestoreDescription struct{} - -func (DRPCPiecestoreDescription) NumMethods() int { return 6 } - -func (DRPCPiecestoreDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/piecestore.Piecestore/Upload", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCPiecestoreServer). - Upload( - &drpcPiecestoreUploadStream{in1.(drpc.Stream)}, - ) - }, DRPCPiecestoreServer.Upload, true - case 1: - return "/piecestore.Piecestore/Download", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCPiecestoreServer). - Download( - &drpcPiecestoreDownloadStream{in1.(drpc.Stream)}, - ) - }, DRPCPiecestoreServer.Download, true - case 2: - return "/piecestore.Piecestore/Delete", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPiecestoreServer). - Delete( - ctx, - in1.(*PieceDeleteRequest), - ) - }, DRPCPiecestoreServer.Delete, true - case 3: - return "/piecestore.Piecestore/DeletePieces", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPiecestoreServer). - DeletePieces( - ctx, - in1.(*DeletePiecesRequest), - ) - }, DRPCPiecestoreServer.DeletePieces, true - case 4: - return "/piecestore.Piecestore/Retain", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPiecestoreServer). - Retain( - ctx, - in1.(*RetainRequest), - ) - }, DRPCPiecestoreServer.Retain, true - case 5: - return "/piecestore.Piecestore/RestoreTrash", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPiecestoreServer). - RestoreTrash( - ctx, - in1.(*RestoreTrashRequest), - ) - }, DRPCPiecestoreServer.RestoreTrash, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterPiecestore(mux drpc.Mux, impl DRPCPiecestoreServer) error { - return mux.Register(impl, DRPCPiecestoreDescription{}) -} - -type DRPCPiecestore_UploadStream interface { - drpc.Stream - SendAndClose(*PieceUploadResponse) error - Recv() (*PieceUploadRequest, error) -} - -type drpcPiecestoreUploadStream struct { - drpc.Stream -} - -func (x *drpcPiecestoreUploadStream) SendAndClose(m *PieceUploadResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -func (x *drpcPiecestoreUploadStream) Recv() (*PieceUploadRequest, error) { - m := new(PieceUploadRequest) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -type DRPCPiecestore_DownloadStream interface { - drpc.Stream - Send(*PieceDownloadResponse) error - Recv() (*PieceDownloadRequest, error) -} - -type drpcPiecestoreDownloadStream struct { - drpc.Stream -} - -func (x *drpcPiecestoreDownloadStream) Send(m *PieceDownloadResponse) error { - return x.MsgSend(m) -} - -func (x *drpcPiecestoreDownloadStream) Recv() (*PieceDownloadRequest, error) { - m := new(PieceDownloadRequest) - if err := x.MsgRecv(m); err != nil { - return nil, err - } - return m, nil -} - -type DRPCPiecestore_DeleteStream interface { - drpc.Stream - SendAndClose(*PieceDeleteResponse) error -} - -type drpcPiecestoreDeleteStream struct { - drpc.Stream -} - -func (x *drpcPiecestoreDeleteStream) SendAndClose(m *PieceDeleteResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPiecestore_DeletePiecesStream interface { - drpc.Stream - SendAndClose(*DeletePiecesResponse) error -} - -type drpcPiecestoreDeletePiecesStream struct { - drpc.Stream -} - -func (x *drpcPiecestoreDeletePiecesStream) SendAndClose(m *DeletePiecesResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPiecestore_RetainStream interface { - drpc.Stream - SendAndClose(*RetainResponse) error -} - -type drpcPiecestoreRetainStream struct { - drpc.Stream -} - -func (x *drpcPiecestoreRetainStream) SendAndClose(m *RetainResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCPiecestore_RestoreTrashStream interface { - drpc.Stream - SendAndClose(*RestoreTrashResponse) error -} - -type drpcPiecestoreRestoreTrashStream struct { - drpc.Stream -} - -func (x *drpcPiecestoreRestoreTrashStream) SendAndClose(m *RestoreTrashResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/piecestore2.proto b/vendor/storj.io/common/pb/piecestore2.proto deleted file mode 100644 index 488cce3b7..000000000 --- a/vendor/storj.io/common/pb/piecestore2.proto +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package piecestore; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "orders.proto"; - -service Piecestore { - rpc Upload(stream PieceUploadRequest) returns (PieceUploadResponse) {} - rpc Download(stream PieceDownloadRequest) returns (stream PieceDownloadResponse) {} - rpc Delete(PieceDeleteRequest) returns (PieceDeleteResponse) { - option deprecated = true; - } - // DeletePieces deletes a set of pieces on satellite request - rpc DeletePieces(DeletePiecesRequest) returns (DeletePiecesResponse); - rpc Retain(RetainRequest) returns (RetainResponse); - rpc RestoreTrash(RestoreTrashRequest) returns (RestoreTrashResponse) {} -} - -// Expected order of messages from uplink: -// OrderLimit -> -// repeated -// Order -> -// Chunk -> -// PieceHash signed by uplink -> -// <- PieceHash signed by storage node -message PieceUploadRequest { - // first message to show that we are allowed to upload - orders.OrderLimit limit = 1; - // order for uploading - orders.Order order = 2; - - // data message - message Chunk { - int64 offset = 1; - bytes data = 2; - } - Chunk chunk = 3; - // final message - orders.PieceHash done = 4; -} - -message PieceUploadResponse { - orders.PieceHash done = 1; -} - -// Expected order of messages from uplink: -// {OrderLimit, Chunk} -> -// go repeated -// Order -> (async) -// go repeated -// <- PieceDownloadResponse.Chunk -message PieceDownloadRequest { - // first message to show that we are allowed to upload - orders.OrderLimit limit = 1; - // order for downloading - orders.Order order = 2; - - // Chunk that we wish to download - message Chunk { - int64 offset = 1; - int64 chunk_size = 2; - } - - // request for the chunk - Chunk chunk = 3; -} - -message PieceDownloadResponse { - // Chunk response for download request - message Chunk { - int64 offset = 1; - bytes data = 2; - } - Chunk chunk = 1; - orders.PieceHash hash = 2; - orders.OrderLimit limit = 3; -} - -message PieceDeleteRequest { - orders.OrderLimit limit = 1; -} - -message PieceDeleteResponse { -} - -message DeletePiecesRequest { - repeated bytes piece_ids = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; -} - -message DeletePiecesResponse { - int64 unhandled_count = 1; -} - -message RetainRequest { - google.protobuf.Timestamp creation_date = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - bytes filter = 2; -} - -message RetainResponse { -} - -message RestoreTrashRequest {} -message RestoreTrashResponse {} - -// PieceHeader is used in piece storage to keep track of piece attributes. -message PieceHeader { - enum FormatVersion { - FORMAT_V0 = 0; - FORMAT_V1 = 1; - } - // the storage format version being used for this piece. The piece filename should agree with this. - // The inclusion of this field is intended to aid repairability when filenames are damaged. - FormatVersion format_version = 1; - // content hash of the piece - bytes hash = 2; - // timestamp when upload occurred, as given by the "timestamp" field in the original orders.PieceHash - google.protobuf.Timestamp creation_time = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - // signature from uplink over the original orders.PieceHash (the corresponding PieceHashSigning - // is reconstructable using the piece id from the piecestore, the piece size from the - // filesystem (minus the piece header size), and these (hash, upload_time, signature) fields). - bytes signature = 4; - // the OrderLimit authorizing storage of this piece, as signed by the satellite and sent by - // the uplink - orders.OrderLimit order_limit = 5 [(gogoproto.nullable) = false]; -} diff --git a/vendor/storj.io/common/pb/pointerdb.pb.go b/vendor/storj.io/common/pb/pointerdb.pb.go deleted file mode 100644 index cb7775180..000000000 --- a/vendor/storj.io/common/pb/pointerdb.pb.go +++ /dev/null @@ -1,533 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pointerdb.proto - -package pb - -import ( - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type RedundancyScheme_SchemeType int32 - -const ( - RedundancyScheme_INVALID RedundancyScheme_SchemeType = 0 - RedundancyScheme_RS RedundancyScheme_SchemeType = 1 -) - -var RedundancyScheme_SchemeType_name = map[int32]string{ - 0: "INVALID", - 1: "RS", -} - -var RedundancyScheme_SchemeType_value = map[string]int32{ - "INVALID": 0, - "RS": 1, -} - -func (x RedundancyScheme_SchemeType) String() string { - return proto.EnumName(RedundancyScheme_SchemeType_name, int32(x)) -} - -func (RedundancyScheme_SchemeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{0, 0} -} - -type Pointer_DataType int32 - -const ( - Pointer_INLINE Pointer_DataType = 0 - Pointer_REMOTE Pointer_DataType = 1 -) - -var Pointer_DataType_name = map[int32]string{ - 0: "INLINE", - 1: "REMOTE", -} - -var Pointer_DataType_value = map[string]int32{ - "INLINE": 0, - "REMOTE": 1, -} - -func (x Pointer_DataType) String() string { - return proto.EnumName(Pointer_DataType_name, int32(x)) -} - -func (Pointer_DataType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{3, 0} -} - -type RedundancyScheme struct { - Type RedundancyScheme_SchemeType `protobuf:"varint,1,opt,name=type,proto3,enum=pointerdb.RedundancyScheme_SchemeType" json:"type,omitempty"` - // these values apply to RS encoding - MinReq int32 `protobuf:"varint,2,opt,name=min_req,json=minReq,proto3" json:"min_req,omitempty"` - Total int32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` - RepairThreshold int32 `protobuf:"varint,4,opt,name=repair_threshold,json=repairThreshold,proto3" json:"repair_threshold,omitempty"` - SuccessThreshold int32 `protobuf:"varint,5,opt,name=success_threshold,json=successThreshold,proto3" json:"success_threshold,omitempty"` - ErasureShareSize int32 `protobuf:"varint,6,opt,name=erasure_share_size,json=erasureShareSize,proto3" json:"erasure_share_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RedundancyScheme) Reset() { *m = RedundancyScheme{} } -func (m *RedundancyScheme) String() string { return proto.CompactTextString(m) } -func (*RedundancyScheme) ProtoMessage() {} -func (*RedundancyScheme) Descriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{0} -} -func (m *RedundancyScheme) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedundancyScheme.Unmarshal(m, b) -} -func (m *RedundancyScheme) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedundancyScheme.Marshal(b, m, deterministic) -} -func (m *RedundancyScheme) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedundancyScheme.Merge(m, src) -} -func (m *RedundancyScheme) XXX_Size() int { - return xxx_messageInfo_RedundancyScheme.Size(m) -} -func (m *RedundancyScheme) XXX_DiscardUnknown() { - xxx_messageInfo_RedundancyScheme.DiscardUnknown(m) -} - -var xxx_messageInfo_RedundancyScheme proto.InternalMessageInfo - -func (m *RedundancyScheme) GetType() RedundancyScheme_SchemeType { - if m != nil { - return m.Type - } - return RedundancyScheme_INVALID -} - -func (m *RedundancyScheme) GetMinReq() int32 { - if m != nil { - return m.MinReq - } - return 0 -} - -func (m *RedundancyScheme) GetTotal() int32 { - if m != nil { - return m.Total - } - return 0 -} - -func (m *RedundancyScheme) GetRepairThreshold() int32 { - if m != nil { - return m.RepairThreshold - } - return 0 -} - -func (m *RedundancyScheme) GetSuccessThreshold() int32 { - if m != nil { - return m.SuccessThreshold - } - return 0 -} - -func (m *RedundancyScheme) GetErasureShareSize() int32 { - if m != nil { - return m.ErasureShareSize - } - return 0 -} - -type RemotePiece struct { - PieceNum int32 `protobuf:"varint,1,opt,name=piece_num,json=pieceNum,proto3" json:"piece_num,omitempty"` - NodeId NodeID `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"` - Hash *PieceHash `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RemotePiece) Reset() { *m = RemotePiece{} } -func (m *RemotePiece) String() string { return proto.CompactTextString(m) } -func (*RemotePiece) ProtoMessage() {} -func (*RemotePiece) Descriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{1} -} -func (m *RemotePiece) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemotePiece.Unmarshal(m, b) -} -func (m *RemotePiece) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemotePiece.Marshal(b, m, deterministic) -} -func (m *RemotePiece) XXX_Merge(src proto.Message) { - xxx_messageInfo_RemotePiece.Merge(m, src) -} -func (m *RemotePiece) XXX_Size() int { - return xxx_messageInfo_RemotePiece.Size(m) -} -func (m *RemotePiece) XXX_DiscardUnknown() { - xxx_messageInfo_RemotePiece.DiscardUnknown(m) -} - -var xxx_messageInfo_RemotePiece proto.InternalMessageInfo - -func (m *RemotePiece) GetPieceNum() int32 { - if m != nil { - return m.PieceNum - } - return 0 -} - -func (m *RemotePiece) GetHash() *PieceHash { - if m != nil { - return m.Hash - } - return nil -} - -type RemoteSegment struct { - Redundancy *RedundancyScheme `protobuf:"bytes,1,opt,name=redundancy,proto3" json:"redundancy,omitempty"` - RootPieceId PieceID `protobuf:"bytes,2,opt,name=root_piece_id,json=rootPieceId,proto3,customtype=PieceID" json:"root_piece_id"` - RemotePieces []*RemotePiece `protobuf:"bytes,3,rep,name=remote_pieces,json=remotePieces,proto3" json:"remote_pieces,omitempty"` - MerkleRoot []byte `protobuf:"bytes,4,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RemoteSegment) Reset() { *m = RemoteSegment{} } -func (m *RemoteSegment) String() string { return proto.CompactTextString(m) } -func (*RemoteSegment) ProtoMessage() {} -func (*RemoteSegment) Descriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{2} -} -func (m *RemoteSegment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RemoteSegment.Unmarshal(m, b) -} -func (m *RemoteSegment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RemoteSegment.Marshal(b, m, deterministic) -} -func (m *RemoteSegment) XXX_Merge(src proto.Message) { - xxx_messageInfo_RemoteSegment.Merge(m, src) -} -func (m *RemoteSegment) XXX_Size() int { - return xxx_messageInfo_RemoteSegment.Size(m) -} -func (m *RemoteSegment) XXX_DiscardUnknown() { - xxx_messageInfo_RemoteSegment.DiscardUnknown(m) -} - -var xxx_messageInfo_RemoteSegment proto.InternalMessageInfo - -func (m *RemoteSegment) GetRedundancy() *RedundancyScheme { - if m != nil { - return m.Redundancy - } - return nil -} - -func (m *RemoteSegment) GetRemotePieces() []*RemotePiece { - if m != nil { - return m.RemotePieces - } - return nil -} - -func (m *RemoteSegment) GetMerkleRoot() []byte { - if m != nil { - return m.MerkleRoot - } - return nil -} - -type Pointer struct { - Type Pointer_DataType `protobuf:"varint,1,opt,name=type,proto3,enum=pointerdb.Pointer_DataType" json:"type,omitempty"` - InlineSegment []byte `protobuf:"bytes,3,opt,name=inline_segment,json=inlineSegment,proto3" json:"inline_segment,omitempty"` - Remote *RemoteSegment `protobuf:"bytes,4,opt,name=remote,proto3" json:"remote,omitempty"` - SegmentSize int64 `protobuf:"varint,5,opt,name=segment_size,json=segmentSize,proto3" json:"segment_size,omitempty"` - CreationDate time.Time `protobuf:"bytes,6,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"` - ExpirationDate time.Time `protobuf:"bytes,7,opt,name=expiration_date,json=expirationDate,proto3,stdtime" json:"expiration_date"` - Metadata []byte `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"` - LastRepaired time.Time `protobuf:"bytes,9,opt,name=last_repaired,json=lastRepaired,proto3,stdtime" json:"last_repaired"` - RepairCount int32 `protobuf:"varint,10,opt,name=repair_count,json=repairCount,proto3" json:"repair_count,omitempty"` - PieceHashesVerified bool `protobuf:"varint,11,opt,name=piece_hashes_verified,json=pieceHashesVerified,proto3" json:"piece_hashes_verified,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Pointer) Reset() { *m = Pointer{} } -func (m *Pointer) String() string { return proto.CompactTextString(m) } -func (*Pointer) ProtoMessage() {} -func (*Pointer) Descriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{3} -} -func (m *Pointer) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Pointer.Unmarshal(m, b) -} -func (m *Pointer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Pointer.Marshal(b, m, deterministic) -} -func (m *Pointer) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pointer.Merge(m, src) -} -func (m *Pointer) XXX_Size() int { - return xxx_messageInfo_Pointer.Size(m) -} -func (m *Pointer) XXX_DiscardUnknown() { - xxx_messageInfo_Pointer.DiscardUnknown(m) -} - -var xxx_messageInfo_Pointer proto.InternalMessageInfo - -func (m *Pointer) GetType() Pointer_DataType { - if m != nil { - return m.Type - } - return Pointer_INLINE -} - -func (m *Pointer) GetInlineSegment() []byte { - if m != nil { - return m.InlineSegment - } - return nil -} - -func (m *Pointer) GetRemote() *RemoteSegment { - if m != nil { - return m.Remote - } - return nil -} - -func (m *Pointer) GetSegmentSize() int64 { - if m != nil { - return m.SegmentSize - } - return 0 -} - -func (m *Pointer) GetCreationDate() time.Time { - if m != nil { - return m.CreationDate - } - return time.Time{} -} - -func (m *Pointer) GetExpirationDate() time.Time { - if m != nil { - return m.ExpirationDate - } - return time.Time{} -} - -func (m *Pointer) GetMetadata() []byte { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *Pointer) GetLastRepaired() time.Time { - if m != nil { - return m.LastRepaired - } - return time.Time{} -} - -func (m *Pointer) GetRepairCount() int32 { - if m != nil { - return m.RepairCount - } - return 0 -} - -func (m *Pointer) GetPieceHashesVerified() bool { - if m != nil { - return m.PieceHashesVerified - } - return false -} - -type ListResponse struct { - Items []*ListResponse_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` - More bool `protobuf:"varint,2,opt,name=more,proto3" json:"more,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (m *ListResponse) String() string { return proto.CompactTextString(m) } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{4} -} -func (m *ListResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListResponse.Unmarshal(m, b) -} -func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) -} -func (m *ListResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListResponse.Merge(m, src) -} -func (m *ListResponse) XXX_Size() int { - return xxx_messageInfo_ListResponse.Size(m) -} -func (m *ListResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListResponse proto.InternalMessageInfo - -func (m *ListResponse) GetItems() []*ListResponse_Item { - if m != nil { - return m.Items - } - return nil -} - -func (m *ListResponse) GetMore() bool { - if m != nil { - return m.More - } - return false -} - -type ListResponse_Item struct { - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - Pointer *Pointer `protobuf:"bytes,2,opt,name=pointer,proto3" json:"pointer,omitempty"` - IsPrefix bool `protobuf:"varint,3,opt,name=is_prefix,json=isPrefix,proto3" json:"is_prefix,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ListResponse_Item) Reset() { *m = ListResponse_Item{} } -func (m *ListResponse_Item) String() string { return proto.CompactTextString(m) } -func (*ListResponse_Item) ProtoMessage() {} -func (*ListResponse_Item) Descriptor() ([]byte, []int) { - return fileDescriptor_75fef806d28fc810, []int{4, 0} -} -func (m *ListResponse_Item) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ListResponse_Item.Unmarshal(m, b) -} -func (m *ListResponse_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ListResponse_Item.Marshal(b, m, deterministic) -} -func (m *ListResponse_Item) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListResponse_Item.Merge(m, src) -} -func (m *ListResponse_Item) XXX_Size() int { - return xxx_messageInfo_ListResponse_Item.Size(m) -} -func (m *ListResponse_Item) XXX_DiscardUnknown() { - xxx_messageInfo_ListResponse_Item.DiscardUnknown(m) -} - -var xxx_messageInfo_ListResponse_Item proto.InternalMessageInfo - -func (m *ListResponse_Item) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func (m *ListResponse_Item) GetPointer() *Pointer { - if m != nil { - return m.Pointer - } - return nil -} - -func (m *ListResponse_Item) GetIsPrefix() bool { - if m != nil { - return m.IsPrefix - } - return false -} - -func init() { - proto.RegisterEnum("pointerdb.RedundancyScheme_SchemeType", RedundancyScheme_SchemeType_name, RedundancyScheme_SchemeType_value) - proto.RegisterEnum("pointerdb.Pointer_DataType", Pointer_DataType_name, Pointer_DataType_value) - proto.RegisterType((*RedundancyScheme)(nil), "pointerdb.RedundancyScheme") - proto.RegisterType((*RemotePiece)(nil), "pointerdb.RemotePiece") - proto.RegisterType((*RemoteSegment)(nil), "pointerdb.RemoteSegment") - proto.RegisterType((*Pointer)(nil), "pointerdb.Pointer") - proto.RegisterType((*ListResponse)(nil), "pointerdb.ListResponse") - proto.RegisterType((*ListResponse_Item)(nil), "pointerdb.ListResponse.Item") -} - -func init() { proto.RegisterFile("pointerdb.proto", fileDescriptor_75fef806d28fc810) } - -var fileDescriptor_75fef806d28fc810 = []byte{ - // 810 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x36, 0x6d, 0xfd, 0xd0, 0x43, 0xc9, 0x56, 0xb6, 0x69, 0x4b, 0x28, 0x05, 0xe4, 0x08, 0x48, - 0xeb, 0xa2, 0x01, 0x55, 0x30, 0xb7, 0xe6, 0x54, 0x57, 0x06, 0x4a, 0xc0, 0x51, 0x8d, 0x95, 0x91, - 0x43, 0x2f, 0xc4, 0x4a, 0x1c, 0x4b, 0xdb, 0x6a, 0xb9, 0xcc, 0xee, 0xaa, 0x88, 0xfd, 0x14, 0x7d, - 0x8a, 0x3e, 0x40, 0xef, 0xbd, 0xf7, 0x19, 0x7a, 0x48, 0x5e, 0xa5, 0xd8, 0x5d, 0xea, 0x27, 0x0d, - 0x50, 0xc0, 0x17, 0x7b, 0x67, 0xe6, 0x9b, 0x1f, 0x7e, 0xf3, 0x8d, 0xe0, 0xb4, 0x92, 0xbc, 0x34, - 0xa8, 0x8a, 0x59, 0x52, 0x29, 0x69, 0x24, 0x39, 0xde, 0x3a, 0xfa, 0x83, 0x85, 0x94, 0x8b, 0x15, - 0x8e, 0x5c, 0x60, 0xb6, 0xbe, 0x1d, 0x19, 0x2e, 0x50, 0x1b, 0x26, 0x2a, 0x8f, 0xed, 0xc3, 0x42, - 0x2e, 0x64, 0xfd, 0xee, 0x48, 0x55, 0xa0, 0xd2, 0xde, 0x1a, 0xfe, 0x71, 0x08, 0x3d, 0x8a, 0xc5, - 0xba, 0x2c, 0x58, 0x39, 0xbf, 0x9b, 0xce, 0x97, 0x28, 0x90, 0x7c, 0x07, 0x0d, 0x73, 0x57, 0x61, - 0x1c, 0x9c, 0x05, 0xe7, 0x27, 0xe9, 0x97, 0xc9, 0xae, 0xf5, 0x7f, 0xa1, 0x89, 0xff, 0x77, 0x73, - 0x57, 0x21, 0x75, 0x39, 0xe4, 0x73, 0x68, 0x0b, 0x5e, 0xe6, 0x0a, 0xdf, 0xc4, 0x87, 0x67, 0xc1, - 0x79, 0x93, 0xb6, 0x04, 0x2f, 0x29, 0xbe, 0x21, 0x8f, 0xa1, 0x69, 0xa4, 0x61, 0xab, 0xf8, 0xc8, - 0xb9, 0xbd, 0x41, 0xbe, 0x86, 0x9e, 0xc2, 0x8a, 0x71, 0x95, 0x9b, 0xa5, 0x42, 0xbd, 0x94, 0xab, - 0x22, 0x6e, 0x38, 0xc0, 0xa9, 0xf7, 0xdf, 0x6c, 0xdc, 0xe4, 0x1b, 0x78, 0xa4, 0xd7, 0xf3, 0x39, - 0x6a, 0xbd, 0x87, 0x6d, 0x3a, 0x6c, 0xaf, 0x0e, 0xec, 0xc0, 0xcf, 0x81, 0xa0, 0x62, 0x7a, 0xad, - 0x30, 0xd7, 0x4b, 0x66, 0xff, 0xf2, 0x7b, 0x8c, 0x5b, 0x1e, 0x5d, 0x47, 0xa6, 0x36, 0x30, 0xe5, - 0xf7, 0x38, 0x7c, 0x0a, 0xb0, 0xfb, 0x10, 0x12, 0x41, 0x3b, 0x9b, 0xbc, 0xfe, 0xfe, 0x2a, 0x1b, - 0xf7, 0x0e, 0x48, 0x0b, 0x0e, 0xe9, 0xb4, 0x17, 0x0c, 0xef, 0x21, 0xa2, 0x28, 0xa4, 0xc1, 0x6b, - 0x8e, 0x73, 0x24, 0x4f, 0xe0, 0xb8, 0xb2, 0x8f, 0xbc, 0x5c, 0x0b, 0xc7, 0x53, 0x93, 0x86, 0xce, - 0x31, 0x59, 0x0b, 0xf2, 0x15, 0xb4, 0x4b, 0x59, 0x60, 0xce, 0x0b, 0xc7, 0x41, 0xe7, 0xe2, 0xe4, - 0xef, 0x77, 0x83, 0x83, 0x7f, 0xde, 0x0d, 0x5a, 0x13, 0x59, 0x60, 0x36, 0xa6, 0x2d, 0x1b, 0xce, - 0x0a, 0xf2, 0x0c, 0x1a, 0x4b, 0xa6, 0x97, 0x8e, 0x92, 0x28, 0x7d, 0x94, 0xd4, 0xab, 0x71, 0x2d, - 0x7e, 0x64, 0x7a, 0x49, 0x5d, 0x78, 0xf8, 0x3e, 0x80, 0xae, 0x6f, 0x3e, 0xc5, 0x85, 0xc0, 0xd2, - 0x90, 0x97, 0x00, 0x6a, 0xbb, 0x0a, 0xd7, 0x3f, 0x4a, 0x9f, 0xfc, 0xcf, 0x9e, 0xe8, 0x1e, 0x9c, - 0xbc, 0x80, 0xae, 0x92, 0xd2, 0xe4, 0xfe, 0x03, 0xb6, 0x43, 0x9e, 0xd6, 0x43, 0xb6, 0x5d, 0xfb, - 0x6c, 0x4c, 0x23, 0x8b, 0xf2, 0x46, 0x41, 0x5e, 0x42, 0x57, 0xb9, 0x11, 0x7c, 0x9a, 0x8e, 0x8f, - 0xce, 0x8e, 0xce, 0xa3, 0xf4, 0xb3, 0x0f, 0x9a, 0x6e, 0xf9, 0xa1, 0x1d, 0xb5, 0x33, 0x34, 0x19, - 0x40, 0x24, 0x50, 0xfd, 0xba, 0xc2, 0xdc, 0x96, 0x74, 0x0b, 0xee, 0x50, 0xf0, 0x2e, 0x2a, 0xa5, - 0x19, 0xfe, 0xd9, 0x80, 0xf6, 0xb5, 0x2f, 0x44, 0x46, 0x1f, 0xa8, 0x6f, 0xff, 0xab, 0x6a, 0x44, - 0x32, 0x66, 0x86, 0xed, 0x49, 0xee, 0x19, 0x9c, 0xf0, 0x72, 0xc5, 0x4b, 0xcc, 0xb5, 0xa7, 0xc7, - 0xf1, 0xd9, 0xa1, 0x5d, 0xef, 0xdd, 0x70, 0xf6, 0x2d, 0xb4, 0xfc, 0x50, 0xae, 0x7f, 0x94, 0xc6, - 0x1f, 0x8d, 0x5e, 0x23, 0x69, 0x8d, 0x23, 0x4f, 0xa1, 0x53, 0x57, 0xf4, 0xf2, 0xb1, 0x62, 0x3b, - 0xa2, 0x51, 0xed, 0xb3, 0xca, 0x21, 0x19, 0x74, 0xe7, 0x0a, 0x99, 0xe1, 0xb2, 0xcc, 0x0b, 0x66, - 0xbc, 0xc4, 0xa2, 0xb4, 0x9f, 0xf8, 0x93, 0x4c, 0x36, 0x27, 0x99, 0xdc, 0x6c, 0x4e, 0xf2, 0x22, - 0xb4, 0x3c, 0xff, 0xfe, 0x7e, 0x10, 0xd0, 0xce, 0x26, 0x75, 0xcc, 0x0c, 0x92, 0x57, 0x70, 0x8a, - 0x6f, 0x2b, 0xae, 0xf6, 0x8a, 0xb5, 0x1f, 0x50, 0xec, 0x64, 0x97, 0xec, 0xca, 0xf5, 0x21, 0x14, - 0x68, 0x58, 0xc1, 0x0c, 0x8b, 0x43, 0xc7, 0xc7, 0xd6, 0xb6, 0x53, 0xaf, 0x98, 0x36, 0xb9, 0x3f, - 0x31, 0x2c, 0xe2, 0xe3, 0x87, 0x4c, 0x6d, 0x53, 0x69, 0x9d, 0x69, 0x39, 0xaa, 0x0f, 0x78, 0x2e, - 0xd7, 0xa5, 0x89, 0xc1, 0xdd, 0x42, 0xe4, 0x7d, 0x3f, 0x58, 0x17, 0x49, 0xe1, 0x53, 0x2f, 0x35, - 0x2b, 0x66, 0xd4, 0xf9, 0x6f, 0xa8, 0xf8, 0x2d, 0xc7, 0x22, 0x8e, 0xce, 0x82, 0xf3, 0x90, 0x7e, - 0x52, 0x6d, 0xe4, 0x8e, 0xfa, 0x75, 0x1d, 0x1a, 0x0e, 0x21, 0xdc, 0x6c, 0x99, 0x00, 0xb4, 0xb2, - 0xc9, 0x55, 0x36, 0xb9, 0xec, 0x1d, 0xd8, 0x37, 0xbd, 0x7c, 0xf5, 0xd3, 0xcd, 0x65, 0x2f, 0x18, - 0xfe, 0x15, 0x40, 0xe7, 0x8a, 0xdb, 0x59, 0x74, 0x25, 0x4b, 0x8d, 0x24, 0x85, 0x26, 0x37, 0x28, - 0x74, 0x1c, 0x38, 0x6d, 0x7e, 0xb1, 0xb7, 0xe0, 0x7d, 0x5c, 0x92, 0x19, 0x14, 0xd4, 0x43, 0x09, - 0x81, 0x86, 0x90, 0x0a, 0xdd, 0x0d, 0x84, 0xd4, 0xbd, 0xfb, 0x08, 0x0d, 0x0b, 0xb1, 0xb1, 0x8a, - 0x99, 0xa5, 0x53, 0xe2, 0x31, 0x75, 0x6f, 0xf2, 0x1c, 0xda, 0x75, 0x55, 0x97, 0x12, 0xa5, 0xe4, - 0x63, 0x81, 0xd2, 0x0d, 0xc4, 0xfe, 0x4c, 0x70, 0x9d, 0x57, 0x0a, 0x6f, 0xf9, 0x5b, 0xa7, 0xca, - 0x90, 0x86, 0x5c, 0x5f, 0x3b, 0xfb, 0xe2, 0xf1, 0xcf, 0x44, 0x1b, 0xa9, 0x7e, 0x49, 0xb8, 0x1c, - 0xcd, 0xa5, 0x10, 0xb2, 0x1c, 0x55, 0xb3, 0x59, 0xcb, 0x91, 0xff, 0xe2, 0xdf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xbf, 0x28, 0x12, 0xfc, 0xf1, 0x05, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/pointerdb.proto b/vendor/storj.io/common/pb/pointerdb.proto deleted file mode 100644 index e37c1a325..000000000 --- a/vendor/storj.io/common/pb/pointerdb.proto +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package pointerdb; - -import "google/protobuf/timestamp.proto"; -import "gogo.proto"; -import "orders.proto"; - -message RedundancyScheme { - enum SchemeType { - INVALID = 0; - RS = 1; - } - SchemeType type = 1; - - // these values apply to RS encoding - int32 min_req = 2; // minimum required for reconstruction - int32 total = 3; // total amount of pieces we generated - int32 repair_threshold = 4; // amount of pieces we need to drop to before triggering repair - int32 success_threshold = 5; // amount of pieces we need to store to call it a success - - int32 erasure_share_size = 6; -} - -message RemotePiece { - int32 piece_num = 1; - bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - orders.PieceHash hash = 3; -} - -message RemoteSegment { - RedundancyScheme redundancy = 1; - bytes root_piece_id = 2 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; - repeated RemotePiece remote_pieces = 3; - bytes merkle_root = 4; // root hash of the hashes of all of these pieces -} - -message Pointer { - enum DataType { - INLINE = 0; - REMOTE = 1; - } - - DataType type = 1; - - bytes inline_segment = 3; - RemoteSegment remote = 4; - int64 segment_size = 5; - - google.protobuf.Timestamp creation_date = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp expiration_date = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes metadata = 8; - - google.protobuf.Timestamp last_repaired = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - int32 repair_count = 10; - bool piece_hashes_verified = 11; -} - -message ListResponse { - message Item { - string path = 1; - Pointer pointer = 2; - bool is_prefix = 3; - } - - repeated Item items = 1; - bool more = 2; -} diff --git a/vendor/storj.io/common/pb/referralmanager.pb.go b/vendor/storj.io/common/pb/referralmanager.pb.go deleted file mode 100644 index 12c05a60c..000000000 --- a/vendor/storj.io/common/pb/referralmanager.pb.go +++ /dev/null @@ -1,326 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: referralmanager.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type GetTokensRequest struct { - OwnerUserId []byte `protobuf:"bytes,1,opt,name=owner_user_id,json=ownerUserId,proto3" json:"owner_user_id,omitempty"` - OwnerSatelliteId NodeID `protobuf:"bytes,2,opt,name=owner_satellite_id,json=ownerSatelliteId,proto3,customtype=NodeID" json:"owner_satellite_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetTokensRequest) Reset() { *m = GetTokensRequest{} } -func (m *GetTokensRequest) String() string { return proto.CompactTextString(m) } -func (*GetTokensRequest) ProtoMessage() {} -func (*GetTokensRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_45d96ad24f1e021c, []int{0} -} -func (m *GetTokensRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTokensRequest.Unmarshal(m, b) -} -func (m *GetTokensRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTokensRequest.Marshal(b, m, deterministic) -} -func (m *GetTokensRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTokensRequest.Merge(m, src) -} -func (m *GetTokensRequest) XXX_Size() int { - return xxx_messageInfo_GetTokensRequest.Size(m) -} -func (m *GetTokensRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetTokensRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetTokensRequest proto.InternalMessageInfo - -func (m *GetTokensRequest) GetOwnerUserId() []byte { - if m != nil { - return m.OwnerUserId - } - return nil -} - -type GetTokensResponse struct { - TokenSecrets [][]byte `protobuf:"bytes,1,rep,name=token_secrets,json=tokenSecrets,proto3" json:"token_secrets,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetTokensResponse) Reset() { *m = GetTokensResponse{} } -func (m *GetTokensResponse) String() string { return proto.CompactTextString(m) } -func (*GetTokensResponse) ProtoMessage() {} -func (*GetTokensResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_45d96ad24f1e021c, []int{1} -} -func (m *GetTokensResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTokensResponse.Unmarshal(m, b) -} -func (m *GetTokensResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTokensResponse.Marshal(b, m, deterministic) -} -func (m *GetTokensResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTokensResponse.Merge(m, src) -} -func (m *GetTokensResponse) XXX_Size() int { - return xxx_messageInfo_GetTokensResponse.Size(m) -} -func (m *GetTokensResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetTokensResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetTokensResponse proto.InternalMessageInfo - -func (m *GetTokensResponse) GetTokenSecrets() [][]byte { - if m != nil { - return m.TokenSecrets - } - return nil -} - -type RedeemTokenRequest struct { - Token []byte `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - RedeemUserId []byte `protobuf:"bytes,2,opt,name=redeem_user_id,json=redeemUserId,proto3" json:"redeem_user_id,omitempty"` - RedeemSatelliteId NodeID `protobuf:"bytes,3,opt,name=redeem_satellite_id,json=redeemSatelliteId,proto3,customtype=NodeID" json:"redeem_satellite_id"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RedeemTokenRequest) Reset() { *m = RedeemTokenRequest{} } -func (m *RedeemTokenRequest) String() string { return proto.CompactTextString(m) } -func (*RedeemTokenRequest) ProtoMessage() {} -func (*RedeemTokenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_45d96ad24f1e021c, []int{2} -} -func (m *RedeemTokenRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedeemTokenRequest.Unmarshal(m, b) -} -func (m *RedeemTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedeemTokenRequest.Marshal(b, m, deterministic) -} -func (m *RedeemTokenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedeemTokenRequest.Merge(m, src) -} -func (m *RedeemTokenRequest) XXX_Size() int { - return xxx_messageInfo_RedeemTokenRequest.Size(m) -} -func (m *RedeemTokenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RedeemTokenRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RedeemTokenRequest proto.InternalMessageInfo - -func (m *RedeemTokenRequest) GetToken() []byte { - if m != nil { - return m.Token - } - return nil -} - -func (m *RedeemTokenRequest) GetRedeemUserId() []byte { - if m != nil { - return m.RedeemUserId - } - return nil -} - -type RedeemTokenResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RedeemTokenResponse) Reset() { *m = RedeemTokenResponse{} } -func (m *RedeemTokenResponse) String() string { return proto.CompactTextString(m) } -func (*RedeemTokenResponse) ProtoMessage() {} -func (*RedeemTokenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_45d96ad24f1e021c, []int{3} -} -func (m *RedeemTokenResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedeemTokenResponse.Unmarshal(m, b) -} -func (m *RedeemTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedeemTokenResponse.Marshal(b, m, deterministic) -} -func (m *RedeemTokenResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedeemTokenResponse.Merge(m, src) -} -func (m *RedeemTokenResponse) XXX_Size() int { - return xxx_messageInfo_RedeemTokenResponse.Size(m) -} -func (m *RedeemTokenResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RedeemTokenResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RedeemTokenResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*GetTokensRequest)(nil), "referralmanager.GetTokensRequest") - proto.RegisterType((*GetTokensResponse)(nil), "referralmanager.GetTokensResponse") - proto.RegisterType((*RedeemTokenRequest)(nil), "referralmanager.RedeemTokenRequest") - proto.RegisterType((*RedeemTokenResponse)(nil), "referralmanager.RedeemTokenResponse") -} - -func init() { proto.RegisterFile("referralmanager.proto", fileDescriptor_45d96ad24f1e021c) } - -var fileDescriptor_45d96ad24f1e021c = []byte{ - // 333 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xcf, 0x4e, 0xf2, 0x40, - 0x14, 0xc5, 0xbf, 0x7e, 0x44, 0x12, 0x2f, 0xe5, 0xdf, 0x00, 0x09, 0x61, 0x03, 0x16, 0x16, 0xac, - 0x20, 0xd1, 0x8d, 0x0b, 0xe3, 0x82, 0x98, 0x18, 0x16, 0xba, 0x18, 0x34, 0x31, 0x6e, 0x48, 0xa1, - 0x57, 0x52, 0x6d, 0x7b, 0xeb, 0xcc, 0x10, 0x5f, 0xc3, 0x37, 0x72, 0xeb, 0x33, 0xb8, 0xe0, 0x59, - 0x4c, 0x67, 0x0a, 0x29, 0xc5, 0xb0, 0xec, 0xe9, 0xef, 0xf6, 0x9e, 0x73, 0x6e, 0xa1, 0x25, 0xf0, - 0x05, 0x85, 0x70, 0x83, 0xd0, 0x8d, 0xdc, 0x15, 0x8a, 0x51, 0x2c, 0x48, 0x11, 0xab, 0xe6, 0xe4, - 0x0e, 0xac, 0x68, 0x45, 0xe6, 0xa5, 0xa3, 0xa0, 0x76, 0x8b, 0xea, 0x81, 0xde, 0x30, 0x92, 0x1c, - 0xdf, 0xd7, 0x28, 0x15, 0x73, 0xa0, 0x4c, 0x1f, 0x11, 0x8a, 0xf9, 0x5a, 0xa2, 0x98, 0xfb, 0x5e, - 0xdb, 0xea, 0x59, 0x43, 0x9b, 0x97, 0xb4, 0xf8, 0x28, 0x51, 0x4c, 0x3d, 0x76, 0x05, 0xcc, 0x30, - 0xd2, 0x55, 0x18, 0x04, 0xbe, 0xc2, 0x04, 0xfc, 0x9f, 0x80, 0x93, 0xca, 0xf7, 0xa6, 0xfb, 0xef, - 0x67, 0xd3, 0x2d, 0xde, 0x93, 0x87, 0xd3, 0x1b, 0x5e, 0xd3, 0xe4, 0x6c, 0x0b, 0x4e, 0x3d, 0xe7, - 0x12, 0xea, 0x99, 0xad, 0x32, 0xa6, 0x48, 0x22, 0xeb, 0x43, 0x59, 0x25, 0xca, 0x5c, 0xe2, 0x52, - 0xa0, 0x92, 0x6d, 0xab, 0x57, 0x18, 0xda, 0xdc, 0xd6, 0xe2, 0xcc, 0x68, 0xce, 0xa7, 0x05, 0x8c, - 0xa3, 0x87, 0x18, 0xea, 0xe9, 0xad, 0xe5, 0x26, 0x9c, 0x68, 0x2c, 0xb5, 0x6a, 0x1e, 0xd8, 0x00, - 0x2a, 0x42, 0xb3, 0xbb, 0x24, 0xda, 0x20, 0xb7, 0x8d, 0x9a, 0x46, 0xb9, 0x86, 0x46, 0x4a, 0xed, - 0x65, 0x29, 0xfc, 0x99, 0xa5, 0x6e, 0xd0, 0x6c, 0x98, 0x16, 0x34, 0xf6, 0x1c, 0x99, 0x38, 0xe7, - 0x5f, 0x16, 0x54, 0x79, 0xda, 0xfc, 0x9d, 0x69, 0x9e, 0x71, 0x38, 0xdd, 0xe5, 0x66, 0x67, 0xa3, - 0xfc, 0xbd, 0xf2, 0x97, 0xe8, 0x38, 0xc7, 0x90, 0xb4, 0xb6, 0x27, 0x28, 0x65, 0xd6, 0xb3, 0xfe, - 0xc1, 0xc8, 0x61, 0x5d, 0x9d, 0xc1, 0x71, 0xc8, 0x7c, 0x79, 0xd2, 0x7c, 0x66, 0x52, 0x91, 0x78, - 0x1d, 0xf9, 0x34, 0x5e, 0x52, 0x18, 0x52, 0x34, 0x8e, 0x17, 0x8b, 0xa2, 0xfe, 0x71, 0x2e, 0x7e, - 0x03, 0x00, 0x00, 0xff, 0xff, 0x85, 0x79, 0x33, 0xba, 0x6e, 0x02, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCReferralManagerClient interface { - DRPCConn() drpc.Conn - - // GetTokens retrieves a list of unredeemed tokens for a user - GetTokens(ctx context.Context, in *GetTokensRequest) (*GetTokensResponse, error) - // RedeemToken saves newly created user info in referral manager - RedeemToken(ctx context.Context, in *RedeemTokenRequest) (*RedeemTokenResponse, error) -} - -type drpcReferralManagerClient struct { - cc drpc.Conn -} - -func NewDRPCReferralManagerClient(cc drpc.Conn) DRPCReferralManagerClient { - return &drpcReferralManagerClient{cc} -} - -func (c *drpcReferralManagerClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcReferralManagerClient) GetTokens(ctx context.Context, in *GetTokensRequest) (*GetTokensResponse, error) { - out := new(GetTokensResponse) - err := c.cc.Invoke(ctx, "/referralmanager.ReferralManager/GetTokens", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *drpcReferralManagerClient) RedeemToken(ctx context.Context, in *RedeemTokenRequest) (*RedeemTokenResponse, error) { - out := new(RedeemTokenResponse) - err := c.cc.Invoke(ctx, "/referralmanager.ReferralManager/RedeemToken", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCReferralManagerServer interface { - // GetTokens retrieves a list of unredeemed tokens for a user - GetTokens(context.Context, *GetTokensRequest) (*GetTokensResponse, error) - // RedeemToken saves newly created user info in referral manager - RedeemToken(context.Context, *RedeemTokenRequest) (*RedeemTokenResponse, error) -} - -type DRPCReferralManagerDescription struct{} - -func (DRPCReferralManagerDescription) NumMethods() int { return 2 } - -func (DRPCReferralManagerDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/referralmanager.ReferralManager/GetTokens", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCReferralManagerServer). - GetTokens( - ctx, - in1.(*GetTokensRequest), - ) - }, DRPCReferralManagerServer.GetTokens, true - case 1: - return "/referralmanager.ReferralManager/RedeemToken", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCReferralManagerServer). - RedeemToken( - ctx, - in1.(*RedeemTokenRequest), - ) - }, DRPCReferralManagerServer.RedeemToken, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterReferralManager(mux drpc.Mux, impl DRPCReferralManagerServer) error { - return mux.Register(impl, DRPCReferralManagerDescription{}) -} - -type DRPCReferralManager_GetTokensStream interface { - drpc.Stream - SendAndClose(*GetTokensResponse) error -} - -type drpcReferralManagerGetTokensStream struct { - drpc.Stream -} - -func (x *drpcReferralManagerGetTokensStream) SendAndClose(m *GetTokensResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -type DRPCReferralManager_RedeemTokenStream interface { - drpc.Stream - SendAndClose(*RedeemTokenResponse) error -} - -type drpcReferralManagerRedeemTokenStream struct { - drpc.Stream -} - -func (x *drpcReferralManagerRedeemTokenStream) SendAndClose(m *RedeemTokenResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/referralmanager.proto b/vendor/storj.io/common/pb/referralmanager.proto deleted file mode 100644 index 4dc950055..000000000 --- a/vendor/storj.io/common/pb/referralmanager.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -import "gogo.proto"; - -package referralmanager; - -// ReferralManager is a service for handling referrals. -service ReferralManager { - // GetTokens retrieves a list of unredeemed tokens for a user - rpc GetTokens(GetTokensRequest) returns (GetTokensResponse); - // RedeemToken saves newly created user info in referral manager - rpc RedeemToken(RedeemTokenRequest) returns (RedeemTokenResponse); -} - -message GetTokensRequest{ - bytes owner_user_id = 1; - bytes owner_satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; -} - -message GetTokensResponse { - repeated bytes token_secrets = 1; -} - -message RedeemTokenRequest { - bytes token = 1; - bytes redeem_user_id = 2; - bytes redeem_satellite_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; -} - -message RedeemTokenResponse {} diff --git a/vendor/storj.io/common/pb/scannerValuer.go b/vendor/storj.io/common/pb/scannerValuer.go deleted file mode 100644 index 258d790c4..000000000 --- a/vendor/storj.io/common/pb/scannerValuer.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package pb - -import ( - "database/sql/driver" - - proto "github.com/gogo/protobuf/proto" - "github.com/zeebo/errs" -) - -var scanError = errs.Class("Protobuf Scanner") -var valueError = errs.Class("Protobuf Valuer") - -//scan automatically converts database []byte to proto.Messages -func scan(msg proto.Message, value interface{}) error { - bytes, ok := value.([]byte) - if !ok { - return scanError.New("%t was %t, expected []bytes", msg, value) - } - return scanError.Wrap(Unmarshal(bytes, msg)) -} - -//value automatically converts proto.Messages to database []byte -func value(msg proto.Message) (driver.Value, error) { - value, err := Marshal(msg) - return value, valueError.Wrap(err) -} - -// Scan implements the Scanner interface. -func (n *InjuredSegment) Scan(value interface{}) error { - return scan(n, value) -} - -// Value implements the driver Valuer interface. -func (n InjuredSegment) Value() (driver.Value, error) { - return value(&n) -} diff --git a/vendor/storj.io/common/pb/scope.pb.go b/vendor/storj.io/common/pb/scope.pb.go deleted file mode 100644 index 0073476b2..000000000 --- a/vendor/storj.io/common/pb/scope.pb.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: scope.proto - -package pb - -import ( - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Scope struct { - SatelliteAddr string `protobuf:"bytes,1,opt,name=satellite_addr,json=satelliteAddr,proto3" json:"satellite_addr,omitempty"` - ApiKey []byte `protobuf:"bytes,2,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` - EncryptionAccess *EncryptionAccess `protobuf:"bytes,3,opt,name=encryption_access,json=encryptionAccess,proto3" json:"encryption_access,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Scope) Reset() { *m = Scope{} } -func (m *Scope) String() string { return proto.CompactTextString(m) } -func (*Scope) ProtoMessage() {} -func (*Scope) Descriptor() ([]byte, []int) { - return fileDescriptor_c67276d5d71daf81, []int{0} -} -func (m *Scope) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Scope.Unmarshal(m, b) -} -func (m *Scope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Scope.Marshal(b, m, deterministic) -} -func (m *Scope) XXX_Merge(src proto.Message) { - xxx_messageInfo_Scope.Merge(m, src) -} -func (m *Scope) XXX_Size() int { - return xxx_messageInfo_Scope.Size(m) -} -func (m *Scope) XXX_DiscardUnknown() { - xxx_messageInfo_Scope.DiscardUnknown(m) -} - -var xxx_messageInfo_Scope proto.InternalMessageInfo - -func (m *Scope) GetSatelliteAddr() string { - if m != nil { - return m.SatelliteAddr - } - return "" -} - -func (m *Scope) GetApiKey() []byte { - if m != nil { - return m.ApiKey - } - return nil -} - -func (m *Scope) GetEncryptionAccess() *EncryptionAccess { - if m != nil { - return m.EncryptionAccess - } - return nil -} - -func init() { - proto.RegisterType((*Scope)(nil), "scope.Scope") -} - -func init() { proto.RegisterFile("scope.proto", fileDescriptor_c67276d5d71daf81) } - -var fileDescriptor_c67276d5d71daf81 = []byte{ - // 182 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x4e, 0xce, 0x2f, - 0x48, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0xa4, 0xc4, 0x53, 0xf3, 0x92, - 0x8b, 0x2a, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0xe2, 0x13, 0x93, 0x93, 0x53, 0x8b, 0x8b, 0x21, 0xf2, - 0x4a, 0x33, 0x19, 0xb9, 0x58, 0x83, 0x41, 0x4a, 0x84, 0x54, 0xb9, 0xf8, 0x8a, 0x13, 0x4b, 0x52, - 0x73, 0x72, 0x32, 0x4b, 0x52, 0xe3, 0x13, 0x53, 0x52, 0x8a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, - 0x83, 0x78, 0xe1, 0xa2, 0x8e, 0x29, 0x29, 0x45, 0x42, 0xe2, 0x5c, 0xec, 0x89, 0x05, 0x99, 0xf1, - 0xd9, 0xa9, 0x95, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x6c, 0x89, 0x05, 0x99, 0xde, 0xa9, - 0x95, 0x42, 0x01, 0x5c, 0x82, 0x18, 0x96, 0x48, 0x30, 0x2b, 0x30, 0x6a, 0x70, 0x1b, 0x29, 0xeb, - 0x61, 0x5a, 0xef, 0x0a, 0x17, 0x71, 0x04, 0x0b, 0x04, 0x09, 0xa4, 0xa2, 0x89, 0x38, 0x89, 0x44, - 0x09, 0x15, 0x97, 0xe4, 0x17, 0x65, 0xe9, 0x65, 0xe6, 0xeb, 0x27, 0xe7, 0xe7, 0xe6, 0xe6, 0xe7, - 0xe9, 0x17, 0x24, 0x25, 0xb1, 0x81, 0x1d, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xab, 0xe3, - 0xb0, 0xca, 0xe7, 0x00, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/scope.proto b/vendor/storj.io/common/pb/scope.proto deleted file mode 100644 index ebab90221..000000000 --- a/vendor/storj.io/common/pb/scope.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; - -option go_package = "storj.io/common/pb"; - -package scope; - -import "encryption_access.proto"; - -message Scope { - string satellite_addr = 1; - - bytes api_key = 2; - - encryption_access.EncryptionAccess encryption_access = 3; -} diff --git a/vendor/storj.io/common/pb/streams.pb.go b/vendor/storj.io/common/pb/streams.pb.go deleted file mode 100644 index 5bf12979d..000000000 --- a/vendor/storj.io/common/pb/streams.pb.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: streams.proto - -package pb - -import ( - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type SegmentMeta struct { - EncryptedKey []byte `protobuf:"bytes,1,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` - KeyNonce []byte `protobuf:"bytes,2,opt,name=key_nonce,json=keyNonce,proto3" json:"key_nonce,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SegmentMeta) Reset() { *m = SegmentMeta{} } -func (m *SegmentMeta) String() string { return proto.CompactTextString(m) } -func (*SegmentMeta) ProtoMessage() {} -func (*SegmentMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_c6bbf8af0ec331d6, []int{0} -} -func (m *SegmentMeta) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SegmentMeta.Unmarshal(m, b) -} -func (m *SegmentMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SegmentMeta.Marshal(b, m, deterministic) -} -func (m *SegmentMeta) XXX_Merge(src proto.Message) { - xxx_messageInfo_SegmentMeta.Merge(m, src) -} -func (m *SegmentMeta) XXX_Size() int { - return xxx_messageInfo_SegmentMeta.Size(m) -} -func (m *SegmentMeta) XXX_DiscardUnknown() { - xxx_messageInfo_SegmentMeta.DiscardUnknown(m) -} - -var xxx_messageInfo_SegmentMeta proto.InternalMessageInfo - -func (m *SegmentMeta) GetEncryptedKey() []byte { - if m != nil { - return m.EncryptedKey - } - return nil -} - -func (m *SegmentMeta) GetKeyNonce() []byte { - if m != nil { - return m.KeyNonce - } - return nil -} - -type StreamInfo struct { - DeprecatedNumberOfSegments int64 `protobuf:"varint,1,opt,name=deprecated_number_of_segments,json=deprecatedNumberOfSegments,proto3" json:"deprecated_number_of_segments,omitempty"` - SegmentsSize int64 `protobuf:"varint,2,opt,name=segments_size,json=segmentsSize,proto3" json:"segments_size,omitempty"` - LastSegmentSize int64 `protobuf:"varint,3,opt,name=last_segment_size,json=lastSegmentSize,proto3" json:"last_segment_size,omitempty"` - Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StreamInfo) Reset() { *m = StreamInfo{} } -func (m *StreamInfo) String() string { return proto.CompactTextString(m) } -func (*StreamInfo) ProtoMessage() {} -func (*StreamInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_c6bbf8af0ec331d6, []int{1} -} -func (m *StreamInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamInfo.Unmarshal(m, b) -} -func (m *StreamInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamInfo.Marshal(b, m, deterministic) -} -func (m *StreamInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamInfo.Merge(m, src) -} -func (m *StreamInfo) XXX_Size() int { - return xxx_messageInfo_StreamInfo.Size(m) -} -func (m *StreamInfo) XXX_DiscardUnknown() { - xxx_messageInfo_StreamInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamInfo proto.InternalMessageInfo - -func (m *StreamInfo) GetDeprecatedNumberOfSegments() int64 { - if m != nil { - return m.DeprecatedNumberOfSegments - } - return 0 -} - -func (m *StreamInfo) GetSegmentsSize() int64 { - if m != nil { - return m.SegmentsSize - } - return 0 -} - -func (m *StreamInfo) GetLastSegmentSize() int64 { - if m != nil { - return m.LastSegmentSize - } - return 0 -} - -func (m *StreamInfo) GetMetadata() []byte { - if m != nil { - return m.Metadata - } - return nil -} - -type StreamMeta struct { - EncryptedStreamInfo []byte `protobuf:"bytes,1,opt,name=encrypted_stream_info,json=encryptedStreamInfo,proto3" json:"encrypted_stream_info,omitempty"` - EncryptionType int32 `protobuf:"varint,2,opt,name=encryption_type,json=encryptionType,proto3" json:"encryption_type,omitempty"` - EncryptionBlockSize int32 `protobuf:"varint,3,opt,name=encryption_block_size,json=encryptionBlockSize,proto3" json:"encryption_block_size,omitempty"` - LastSegmentMeta *SegmentMeta `protobuf:"bytes,4,opt,name=last_segment_meta,json=lastSegmentMeta,proto3" json:"last_segment_meta,omitempty"` - NumberOfSegments int64 `protobuf:"varint,5,opt,name=number_of_segments,json=numberOfSegments,proto3" json:"number_of_segments,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StreamMeta) Reset() { *m = StreamMeta{} } -func (m *StreamMeta) String() string { return proto.CompactTextString(m) } -func (*StreamMeta) ProtoMessage() {} -func (*StreamMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_c6bbf8af0ec331d6, []int{2} -} -func (m *StreamMeta) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StreamMeta.Unmarshal(m, b) -} -func (m *StreamMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StreamMeta.Marshal(b, m, deterministic) -} -func (m *StreamMeta) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamMeta.Merge(m, src) -} -func (m *StreamMeta) XXX_Size() int { - return xxx_messageInfo_StreamMeta.Size(m) -} -func (m *StreamMeta) XXX_DiscardUnknown() { - xxx_messageInfo_StreamMeta.DiscardUnknown(m) -} - -var xxx_messageInfo_StreamMeta proto.InternalMessageInfo - -func (m *StreamMeta) GetEncryptedStreamInfo() []byte { - if m != nil { - return m.EncryptedStreamInfo - } - return nil -} - -func (m *StreamMeta) GetEncryptionType() int32 { - if m != nil { - return m.EncryptionType - } - return 0 -} - -func (m *StreamMeta) GetEncryptionBlockSize() int32 { - if m != nil { - return m.EncryptionBlockSize - } - return 0 -} - -func (m *StreamMeta) GetLastSegmentMeta() *SegmentMeta { - if m != nil { - return m.LastSegmentMeta - } - return nil -} - -func (m *StreamMeta) GetNumberOfSegments() int64 { - if m != nil { - return m.NumberOfSegments - } - return 0 -} - -func init() { - proto.RegisterType((*SegmentMeta)(nil), "streams.SegmentMeta") - proto.RegisterType((*StreamInfo)(nil), "streams.StreamInfo") - proto.RegisterType((*StreamMeta)(nil), "streams.StreamMeta") -} - -func init() { proto.RegisterFile("streams.proto", fileDescriptor_c6bbf8af0ec331d6) } - -var fileDescriptor_c6bbf8af0ec331d6 = []byte{ - // 343 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x41, 0x4f, 0xf2, 0x40, - 0x10, 0x0d, 0xf0, 0xf1, 0x89, 0x0b, 0x88, 0xae, 0x98, 0x10, 0x8c, 0x89, 0xc1, 0x83, 0xc6, 0x18, - 0x48, 0xf0, 0x0f, 0x28, 0x37, 0x63, 0x84, 0xa4, 0x78, 0xf2, 0xb2, 0xd9, 0x96, 0xa9, 0xa9, 0xa5, - 0x3b, 0x4d, 0x77, 0x3d, 0x2c, 0xff, 0xc1, 0x7f, 0xe4, 0x8f, 0x33, 0x3b, 0x6d, 0x29, 0x12, 0x8f, - 0xfb, 0xe6, 0xe5, 0xcd, 0x7b, 0x6f, 0x96, 0x75, 0xb5, 0xc9, 0x40, 0x26, 0x7a, 0x9c, 0x66, 0x68, - 0x90, 0x1f, 0x14, 0xcf, 0xd1, 0x82, 0xb5, 0x97, 0xf0, 0x9e, 0x80, 0x32, 0x2f, 0x60, 0x24, 0xbf, - 0x62, 0x5d, 0x50, 0x41, 0x66, 0x53, 0x03, 0x2b, 0x11, 0x83, 0x1d, 0xd4, 0x2e, 0x6b, 0x37, 0x1d, - 0xaf, 0xb3, 0x05, 0x9f, 0xc1, 0xf2, 0x73, 0x76, 0x18, 0x83, 0x15, 0x0a, 0x55, 0x00, 0x83, 0x3a, - 0x11, 0x5a, 0x31, 0xd8, 0xb9, 0x7b, 0x8f, 0xbe, 0x6b, 0x8c, 0x2d, 0x49, 0xfc, 0x49, 0x85, 0xc8, - 0x1f, 0xd9, 0xc5, 0x0a, 0xd2, 0x0c, 0x02, 0xe9, 0x14, 0xd5, 0x67, 0xe2, 0x43, 0x26, 0x30, 0x14, - 0x3a, 0x5f, 0xaa, 0x69, 0x41, 0xc3, 0x1b, 0x56, 0xa4, 0x39, 0x71, 0x16, 0x61, 0x61, 0x4b, 0x3b, - 0x4f, 0x25, 0x5b, 0xe8, 0x68, 0x93, 0xaf, 0x6c, 0x78, 0x9d, 0x12, 0x5c, 0x46, 0x1b, 0xe0, 0xb7, - 0xec, 0x64, 0x2d, 0xb5, 0x29, 0x75, 0x73, 0x62, 0x83, 0x88, 0x3d, 0x37, 0x28, 0xd4, 0x88, 0x3b, - 0x64, 0xad, 0x04, 0x8c, 0x5c, 0x49, 0x23, 0x07, 0xff, 0x72, 0xfb, 0xe5, 0x7b, 0xf4, 0x55, 0x2f, - 0xed, 0x53, 0x1f, 0x53, 0x76, 0x56, 0xf5, 0x91, 0x77, 0x26, 0x22, 0x15, 0x62, 0xd1, 0xcb, 0xe9, - 0x76, 0xb8, 0x13, 0xf9, 0x9a, 0xf5, 0x0a, 0x38, 0x42, 0x25, 0x8c, 0x4d, 0x73, 0xc7, 0x4d, 0xef, - 0xa8, 0x82, 0x5f, 0x6d, 0x0a, 0x3b, 0xe2, 0x8e, 0xe8, 0xaf, 0x31, 0x88, 0x2b, 0xdf, 0xcd, 0xad, - 0x78, 0x84, 0x6a, 0xe6, 0x66, 0xe4, 0xfd, 0x61, 0x2f, 0xa7, 0x33, 0x4e, 0x21, 0xda, 0xd3, 0xfe, - 0xb8, 0xbc, 0xf1, 0xce, 0x45, 0x7f, 0xa5, 0xa7, 0x48, 0x77, 0x8c, 0xff, 0x71, 0x86, 0x26, 0x55, - 0x75, 0xac, 0xf6, 0xca, 0x9f, 0xf5, 0xdf, 0xb8, 0x36, 0x98, 0x7d, 0x8c, 0x23, 0x9c, 0x04, 0x98, - 0x24, 0xa8, 0x26, 0xa9, 0xef, 0xff, 0xa7, 0x5f, 0x74, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x0d, - 0x06, 0x13, 0x61, 0x56, 0x02, 0x00, 0x00, -} diff --git a/vendor/storj.io/common/pb/streams.proto b/vendor/storj.io/common/pb/streams.proto deleted file mode 100644 index d4fdd8f1a..000000000 --- a/vendor/storj.io/common/pb/streams.proto +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package streams; - -message SegmentMeta { - bytes encrypted_key = 1; - bytes key_nonce = 2; -} - -message StreamInfo { - int64 deprecated_number_of_segments = 1; - int64 segments_size = 2; - int64 last_segment_size = 3; - bytes metadata = 4; -} - -message StreamMeta { - bytes encrypted_stream_info = 1; - int32 encryption_type = 2; - int32 encryption_block_size = 3; - SegmentMeta last_segment_meta = 4; - int64 number_of_segments = 5; -} diff --git a/vendor/storj.io/common/pb/types.go b/vendor/storj.io/common/pb/types.go deleted file mode 100644 index 7a5591f72..000000000 --- a/vendor/storj.io/common/pb/types.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package pb - -import "storj.io/common/storj" - -// Path represents a object path. -type Path = storj.Path - -// NodeID is an alias to storj.NodeID for use in generated protobuf code. -type NodeID = storj.NodeID - -// NodeIDList is an alias to storj.NodeIDList for use in generated protobuf code. -type NodeIDList = storj.NodeIDList - -// PieceID is an alias to storj.PieceID for use in generated protobuf code. -type PieceID = storj.PieceID - -// PiecePublicKey is an alias to storj.PiecePublicKey for use in generated protobuf code. -type PiecePublicKey = storj.PiecePublicKey - -// PiecePrivateKey is an alias to storj.PiecePrivateKey for use in generated protobuf code. -type PiecePrivateKey = storj.PiecePrivateKey - -// SerialNumber is an alias to storj.SerialNumber for use in generated protobuf code. -type SerialNumber = storj.SerialNumber - -// StreamID is an alias to storj.StreamID for use in generated protobuf code. -type StreamID = storj.StreamID - -// Nonce is an alias to storj.Nonce for use in generated protobuf code. -type Nonce = storj.Nonce - -// SegmentID is an alias to storj.SegmentID for use in generated protobuf code. -type SegmentID = storj.SegmentID diff --git a/vendor/storj.io/common/pb/utils.go b/vendor/storj.io/common/pb/utils.go deleted file mode 100644 index e37d1ac71..000000000 --- a/vendor/storj.io/common/pb/utils.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package pb - -import ( - "bytes" - "reflect" - - "github.com/gogo/protobuf/proto" - - "storj.io/common/storj" -) - -// Equal compares two Protobuf messages via serialization. -func Equal(msg1, msg2 proto.Message) bool { - //reflect.DeepEqual and proto.Equal don't seem work in all cases - //todo: see how slow this is compared to custom equality checks - if msg1 == nil { - return msg2 == nil - } - if reflect.TypeOf(msg1) != reflect.TypeOf(msg2) { - return false - } - msg1Bytes, err := Marshal(msg1) - if err != nil { - return false - } - msg2Bytes, err := Marshal(msg2) - if err != nil { - return false - } - return bytes.Equal(msg1Bytes, msg2Bytes) -} - -// NodesToIDs extracts Node-s into a list of ids. -func NodesToIDs(nodes []*Node) storj.NodeIDList { - ids := make(storj.NodeIDList, len(nodes)) - for i, node := range nodes { - if node != nil { - ids[i] = node.Id - } - } - return ids -} - -// CopyNode returns a deep copy of a node -// It would be better to use `proto.Clone` but it is curently incompatible -// with gogo's customtype extension. -// (see https://github.com/gogo/protobuf/issues/147). -func CopyNode(src *Node) (dst *Node) { - node := Node{Id: storj.NodeID{}} - copy(node.Id[:], src.Id[:]) - - if src.Address != nil { - node.Address = &NodeAddress{ - Transport: src.Address.Transport, - Address: src.Address.Address, - } - } - - return &node -} - -// AddressEqual compares two node addresses. -func AddressEqual(a1, a2 *NodeAddress) bool { - if a1 == nil && a2 == nil { - return true - } - if a1 == nil || a2 == nil { - return false - } - return a1.Transport == a2.Transport && - a1.Address == a2.Address -} - -// NewRedundancySchemeToStorj creates new storj.RedundancyScheme from the given -// protobuf RedundancyScheme. -func NewRedundancySchemeToStorj(scheme *RedundancyScheme) *storj.RedundancyScheme { - return &storj.RedundancyScheme{ - Algorithm: storj.RedundancyAlgorithm(scheme.GetType()), - ShareSize: scheme.GetErasureShareSize(), - RequiredShares: int16(scheme.GetMinReq()), - RepairShares: int16(scheme.GetRepairThreshold()), - OptimalShares: int16(scheme.GetSuccessThreshold()), - TotalShares: int16(scheme.GetTotal()), - } -} diff --git a/vendor/storj.io/common/pb/vouchers.pb.go b/vendor/storj.io/common/pb/vouchers.pb.go deleted file mode 100644 index b771457e3..000000000 --- a/vendor/storj.io/common/pb/vouchers.pb.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: vouchers.proto - -package pb - -import ( - context "context" - fmt "fmt" - math "math" - time "time" - - proto "github.com/gogo/protobuf/proto" - - drpc "storj.io/drpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type VoucherResponse_Status int32 - -const ( - VoucherResponse_INVALID VoucherResponse_Status = 0 - VoucherResponse_ACCEPTED VoucherResponse_Status = 1 - VoucherResponse_REJECTED VoucherResponse_Status = 2 -) - -var VoucherResponse_Status_name = map[int32]string{ - 0: "INVALID", - 1: "ACCEPTED", - 2: "REJECTED", -} - -var VoucherResponse_Status_value = map[string]int32{ - "INVALID": 0, - "ACCEPTED": 1, - "REJECTED": 2, -} - -func (x VoucherResponse_Status) String() string { - return proto.EnumName(VoucherResponse_Status_name, int32(x)) -} - -func (VoucherResponse_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_3659b9a115b8060d, []int{2, 0} -} - -// Voucher is a signed message verifying that a node has been vetted by a particular satellite. -type Voucher struct { - SatelliteId NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` - StorageNodeId NodeID `protobuf:"bytes,2,opt,name=storage_node_id,json=storageNodeId,proto3,customtype=NodeID" json:"storage_node_id"` - Expiration time.Time `protobuf:"bytes,3,opt,name=expiration,proto3,stdtime" json:"expiration"` - SatelliteSignature []byte `protobuf:"bytes,4,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Voucher) Reset() { *m = Voucher{} } -func (m *Voucher) String() string { return proto.CompactTextString(m) } -func (*Voucher) ProtoMessage() {} -func (*Voucher) Descriptor() ([]byte, []int) { - return fileDescriptor_3659b9a115b8060d, []int{0} -} -func (m *Voucher) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Voucher.Unmarshal(m, b) -} -func (m *Voucher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Voucher.Marshal(b, m, deterministic) -} -func (m *Voucher) XXX_Merge(src proto.Message) { - xxx_messageInfo_Voucher.Merge(m, src) -} -func (m *Voucher) XXX_Size() int { - return xxx_messageInfo_Voucher.Size(m) -} -func (m *Voucher) XXX_DiscardUnknown() { - xxx_messageInfo_Voucher.DiscardUnknown(m) -} - -var xxx_messageInfo_Voucher proto.InternalMessageInfo - -func (m *Voucher) GetExpiration() time.Time { - if m != nil { - return m.Expiration - } - return time.Time{} -} - -func (m *Voucher) GetSatelliteSignature() []byte { - if m != nil { - return m.SatelliteSignature - } - return nil -} - -type VoucherRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *VoucherRequest) Reset() { *m = VoucherRequest{} } -func (m *VoucherRequest) String() string { return proto.CompactTextString(m) } -func (*VoucherRequest) ProtoMessage() {} -func (*VoucherRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3659b9a115b8060d, []int{1} -} -func (m *VoucherRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VoucherRequest.Unmarshal(m, b) -} -func (m *VoucherRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VoucherRequest.Marshal(b, m, deterministic) -} -func (m *VoucherRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_VoucherRequest.Merge(m, src) -} -func (m *VoucherRequest) XXX_Size() int { - return xxx_messageInfo_VoucherRequest.Size(m) -} -func (m *VoucherRequest) XXX_DiscardUnknown() { - xxx_messageInfo_VoucherRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_VoucherRequest proto.InternalMessageInfo - -type VoucherResponse struct { - Voucher *Voucher `protobuf:"bytes,1,opt,name=voucher,proto3" json:"voucher,omitempty"` - Status VoucherResponse_Status `protobuf:"varint,2,opt,name=status,proto3,enum=vouchers.VoucherResponse_Status" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *VoucherResponse) Reset() { *m = VoucherResponse{} } -func (m *VoucherResponse) String() string { return proto.CompactTextString(m) } -func (*VoucherResponse) ProtoMessage() {} -func (*VoucherResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3659b9a115b8060d, []int{2} -} -func (m *VoucherResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VoucherResponse.Unmarshal(m, b) -} -func (m *VoucherResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VoucherResponse.Marshal(b, m, deterministic) -} -func (m *VoucherResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_VoucherResponse.Merge(m, src) -} -func (m *VoucherResponse) XXX_Size() int { - return xxx_messageInfo_VoucherResponse.Size(m) -} -func (m *VoucherResponse) XXX_DiscardUnknown() { - xxx_messageInfo_VoucherResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_VoucherResponse proto.InternalMessageInfo - -func (m *VoucherResponse) GetVoucher() *Voucher { - if m != nil { - return m.Voucher - } - return nil -} - -func (m *VoucherResponse) GetStatus() VoucherResponse_Status { - if m != nil { - return m.Status - } - return VoucherResponse_INVALID -} - -func init() { - proto.RegisterEnum("vouchers.VoucherResponse_Status", VoucherResponse_Status_name, VoucherResponse_Status_value) - proto.RegisterType((*Voucher)(nil), "vouchers.Voucher") - proto.RegisterType((*VoucherRequest)(nil), "vouchers.VoucherRequest") - proto.RegisterType((*VoucherResponse)(nil), "vouchers.VoucherResponse") -} - -func init() { proto.RegisterFile("vouchers.proto", fileDescriptor_3659b9a115b8060d) } - -var fileDescriptor_3659b9a115b8060d = []byte{ - // 382 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4f, 0x6e, 0x9b, 0x40, - 0x14, 0xc6, 0x8d, 0x5b, 0x01, 0x7a, 0xb8, 0xd8, 0x9d, 0x76, 0x41, 0xd9, 0x60, 0xb1, 0xb2, 0x54, - 0x09, 0x64, 0x2a, 0x55, 0x5d, 0xd6, 0x36, 0x2c, 0xa8, 0x2c, 0xab, 0xc2, 0x96, 0x17, 0xdd, 0x58, - 0xd8, 0x4c, 0x09, 0x91, 0x61, 0x08, 0x33, 0x44, 0x39, 0x46, 0xee, 0x91, 0x8b, 0xe4, 0x0c, 0x59, - 0x38, 0x07, 0xc8, 0x25, 0x22, 0x86, 0x3f, 0x89, 0x14, 0x67, 0xf9, 0xbd, 0xf7, 0x7b, 0x6f, 0xbe, - 0xf7, 0x0d, 0xa8, 0xd7, 0xa4, 0x3c, 0x5c, 0xe0, 0x82, 0x5a, 0x79, 0x41, 0x18, 0x41, 0x72, 0xab, - 0x75, 0x88, 0x49, 0x4c, 0xea, 0xaa, 0x6e, 0xc4, 0x84, 0xc4, 0x47, 0x6c, 0x73, 0xb5, 0x2f, 0xff, - 0xdb, 0x2c, 0x49, 0x31, 0x65, 0x61, 0x9a, 0xd7, 0x80, 0xf9, 0x24, 0x80, 0xb4, 0xad, 0x27, 0xd1, - 0x14, 0x06, 0x34, 0x64, 0xf8, 0x78, 0x4c, 0x18, 0xde, 0x25, 0x91, 0x26, 0x8c, 0x85, 0xc9, 0x60, - 0xae, 0xde, 0x9f, 0x8c, 0xde, 0xc3, 0xc9, 0x10, 0x57, 0x24, 0xc2, 0xbe, 0x1b, 0x28, 0x1d, 0xe3, - 0x47, 0xe8, 0x27, 0x0c, 0x29, 0x23, 0x45, 0x18, 0xe3, 0x5d, 0x46, 0x22, 0x3e, 0xd5, 0x3f, 0x3b, - 0xf5, 0xa9, 0xc1, 0xb8, 0x8c, 0x90, 0x0b, 0x80, 0x6f, 0xf2, 0xa4, 0x08, 0x59, 0x42, 0x32, 0xed, - 0xc3, 0x58, 0x98, 0x28, 0x8e, 0x6e, 0xd5, 0x66, 0xad, 0xd6, 0xac, 0xb5, 0x69, 0xcd, 0xce, 0xe5, - 0x6a, 0xdd, 0xed, 0xa3, 0x21, 0x04, 0xaf, 0xe6, 0x90, 0x0d, 0x5f, 0x5e, 0x0c, 0xd3, 0x24, 0xce, - 0x42, 0x56, 0x16, 0x58, 0xfb, 0x58, 0x39, 0x08, 0x50, 0xd7, 0x5a, 0xb7, 0x1d, 0x73, 0x04, 0x6a, - 0x73, 0x6c, 0x80, 0xaf, 0x4a, 0x4c, 0x99, 0x79, 0x27, 0xc0, 0xb0, 0x2b, 0xd1, 0x9c, 0x64, 0x14, - 0xa3, 0xef, 0x20, 0x35, 0x61, 0xf2, 0x08, 0x14, 0xe7, 0xb3, 0xd5, 0x85, 0xdd, 0xb2, 0x2d, 0x81, - 0x7e, 0x81, 0x48, 0x59, 0xc8, 0x4a, 0xca, 0x0f, 0x57, 0x9d, 0xf1, 0x5b, 0xb6, 0xd9, 0x6b, 0xad, - 0x39, 0x17, 0x34, 0xbc, 0x39, 0x05, 0xb1, 0xae, 0x20, 0x05, 0x24, 0x7f, 0xb5, 0x9d, 0x2d, 0x7d, - 0x77, 0xd4, 0x43, 0x03, 0x90, 0x67, 0x8b, 0x85, 0xf7, 0x77, 0xe3, 0xb9, 0x23, 0xa1, 0x52, 0x81, - 0xf7, 0xc7, 0x5b, 0x54, 0xaa, 0xef, 0x2c, 0x41, 0x6e, 0x96, 0x52, 0xf4, 0x1b, 0xa4, 0xe6, 0x08, - 0xa4, 0x9d, 0x79, 0x93, 0x77, 0xf4, 0x6f, 0xef, 0xba, 0x31, 0x7b, 0xf3, 0xaf, 0xff, 0x50, 0xf5, - 0x2b, 0x97, 0x56, 0x42, 0xec, 0x03, 0x49, 0x53, 0x92, 0xd9, 0xf9, 0x7e, 0x2f, 0xf2, 0xf8, 0x7f, - 0x3c, 0x07, 0x00, 0x00, 0xff, 0xff, 0x89, 0xab, 0x2f, 0x68, 0x61, 0x02, 0x00, 0x00, -} - -// --- DRPC BEGIN --- - -type DRPCVouchersClient interface { - DRPCConn() drpc.Conn - - Request(ctx context.Context, in *VoucherRequest) (*VoucherResponse, error) -} - -type drpcVouchersClient struct { - cc drpc.Conn -} - -func NewDRPCVouchersClient(cc drpc.Conn) DRPCVouchersClient { - return &drpcVouchersClient{cc} -} - -func (c *drpcVouchersClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcVouchersClient) Request(ctx context.Context, in *VoucherRequest) (*VoucherResponse, error) { - out := new(VoucherResponse) - err := c.cc.Invoke(ctx, "/vouchers.Vouchers/Request", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCVouchersServer interface { - Request(context.Context, *VoucherRequest) (*VoucherResponse, error) -} - -type DRPCVouchersDescription struct{} - -func (DRPCVouchersDescription) NumMethods() int { return 1 } - -func (DRPCVouchersDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/vouchers.Vouchers/Request", - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCVouchersServer). - Request( - ctx, - in1.(*VoucherRequest), - ) - }, DRPCVouchersServer.Request, true - default: - return "", nil, nil, false - } -} - -func DRPCRegisterVouchers(mux drpc.Mux, impl DRPCVouchersServer) error { - return mux.Register(impl, DRPCVouchersDescription{}) -} - -type DRPCVouchers_RequestStream interface { - drpc.Stream - SendAndClose(*VoucherResponse) error -} - -type drpcVouchersRequestStream struct { - drpc.Stream -} - -func (x *drpcVouchersRequestStream) SendAndClose(m *VoucherResponse) error { - if err := x.MsgSend(m); err != nil { - return err - } - return x.CloseSend() -} - -// --- DRPC END --- diff --git a/vendor/storj.io/common/pb/vouchers.proto b/vendor/storj.io/common/pb/vouchers.proto deleted file mode 100644 index e4ba38a52..000000000 --- a/vendor/storj.io/common/pb/vouchers.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "storj.io/common/pb"; - -package vouchers; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; - -// Voucher is a signed message verifying that a node has been vetted by a particular satellite. -message Voucher { - bytes satellite_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - bytes storage_node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; - - google.protobuf.Timestamp expiration = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - - bytes satellite_signature = 4; -} - -message VoucherRequest {} - -message VoucherResponse { - enum Status { - INVALID = 0; - ACCEPTED = 1; - REJECTED = 2; - } - - Voucher voucher = 1; - - Status status = 2; -} - - -service Vouchers { - rpc Request(VoucherRequest) returns (VoucherResponse) {} -} diff --git a/vendor/storj.io/common/peertls/doc.go b/vendor/storj.io/common/peertls/doc.go deleted file mode 100644 index 1af75b5eb..000000000 --- a/vendor/storj.io/common/peertls/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package peertls manages TLS configuration for peers. -package peertls diff --git a/vendor/storj.io/common/peertls/extensions/doc.go b/vendor/storj.io/common/peertls/extensions/doc.go deleted file mode 100644 index e3f6f1877..000000000 --- a/vendor/storj.io/common/peertls/extensions/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package extensions contains extensions to TLS certificate handling. -package extensions diff --git a/vendor/storj.io/common/peertls/extensions/extensions.go b/vendor/storj.io/common/peertls/extensions/extensions.go deleted file mode 100644 index 2bfda7d46..000000000 --- a/vendor/storj.io/common/peertls/extensions/extensions.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package extensions - -import ( - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - - "github.com/zeebo/errs" - - "storj.io/common/peertls" - "storj.io/common/pkcrypto" -) - -const ( - // RevocationBucket is the bolt bucket to store revocation data in - RevocationBucket = "revocations" -) - -var ( - // DefaultHandlers is a slice of handlers that we use by default. - // - IDVersionHandler - DefaultHandlers HandlerFactories - - // CAWhitelistSignedLeafHandler verifies that the leaf cert of the remote peer's - // identity was signed by one of the CA certs in the whitelist. - CAWhitelistSignedLeafHandler = NewHandlerFactory( - &SignedCertExtID, caWhitelistSignedLeafHandler, - ) - - // NB: 2.999.X is reserved for "example" OIDs - // (see http://oid-info.com/get/2.999) - // 2.999.1.X -- storj general/misc. extensions - // 2.999.2.X -- storj identity extensions - - // SignedCertExtID is the asn1 object ID for a pkix extension holding a - // signature of the cert it's extending, signed by some CA (e.g. the root cert chain). - // This extensionHandler allows for an additional signature per certificate. - SignedCertExtID = ExtensionID{2, 999, 1, 1} - // RevocationExtID is the asn1 object ID for a pkix extension containing the - // most recent certificate revocation data - // for the current TLS cert chain. - RevocationExtID = ExtensionID{2, 999, 1, 2} - // IdentityVersionExtID is the asn1 object ID for a pkix extension that - // specifies the identity version of the certificate chain. - IdentityVersionExtID = ExtensionID{2, 999, 2, 1} - // IdentityPOWCounterExtID is the asn1 object ID for a pkix extension that - // specifies how many times to hash the CA public key to calculate the node ID. - IdentityPOWCounterExtID = ExtensionID{2, 999, 2, 2} - - // Error is used when an error occurs while processing an extension. - Error = errs.Class("extension error") - - // ErrVerifyCASignedLeaf is used when a signed leaf extension signature wasn't produced - // by any CA in the whitelist. - ErrVerifyCASignedLeaf = Error.New("leaf not signed by any CA in the whitelist") - // ErrUniqueExtensions is used when multiple extensions have the same Id - ErrUniqueExtensions = Error.New("extensions are not unique") -) - -// ExtensionID is an alias to an `asn1.ObjectIdentifier`. -type ExtensionID = asn1.ObjectIdentifier - -// Config is used to bind cli flags for determining which extensions will -// be used by the server. -type Config struct { - Revocation bool `default:"true" help:"if true, client leaves may contain the most recent certificate revocation for the current certificate"` - WhitelistSignedLeaf bool `default:"false" help:"if true, client leaves must contain a valid \"signed certificate extension\" (NB: verified against certs in the peer ca whitelist; i.e. if true, a whitelist must be provided)"` -} - -// Options holds common options for use in handling extensions. -type Options struct { - PeerCAWhitelist []*x509.Certificate - RevocationDB RevocationDB - PeerIDVersions string -} - -// HandlerFactories is a collection of `HandlerFactory`s for convenience. -// Defines `Register` and `WithOptions` methods. -type HandlerFactories []*HandlerFactory - -// HandlerFactory holds a factory for a handler function given the passed `Options`. -// For use in handling extensions with the corresponding ExtensionID. -type HandlerFactory struct { - id *ExtensionID - factory HandlerFactoryFunc -} - -// HandlerFactoryFunc is a factory function used to build `HandlerFunc`s given -// the passed options. -type HandlerFactoryFunc func(options *Options) HandlerFunc - -// HandlerFunc takes an extension and the remote peer's certificate chains for -// use in extension handling. -type HandlerFunc func(pkix.Extension, [][]*x509.Certificate) error - -// HandlerFuncMap maps an `ExtensionID` pointer to a `HandlerFunc`. -// Because an `ExtensionID` is a pointer , one can use a new pointer to the same -// asn1 object ID constant to store multiple `HandlerFunc`s for the same -// underlying extension id value. -type HandlerFuncMap map[*ExtensionID]HandlerFunc - -// NewHandlerFactory builds a `HandlerFactory` pointer from an `ExtensionID` and a `HandlerFactoryFunc`. -func NewHandlerFactory(id *ExtensionID, handlerFactory HandlerFactoryFunc) *HandlerFactory { - return &HandlerFactory{ - id: id, - factory: handlerFactory, - } -} - -// AddExtraExtension adds one or more extensions to a certificate for serialization. -// NB: this *does not* serialize or persist the extension into the certificates's -// raw bytes. To add a persistent extension use `FullCertificateAuthority.AddExtension` -// or `ManageableIdentity.AddExtension`. -func AddExtraExtension(cert *x509.Certificate, exts ...pkix.Extension) (err error) { - if len(exts) == 0 { - return nil - } - if !uniqueExts(append(cert.ExtraExtensions, exts...)) { - return ErrUniqueExtensions - } - - for _, ext := range exts { - e := pkix.Extension{Id: ext.Id, Value: make([]byte, len(ext.Value))} - copy(e.Value, ext.Value) - cert.ExtraExtensions = append(cert.ExtraExtensions, e) - } - return nil -} - -// Register adds an extension handler factory to the list. -func (factories *HandlerFactories) Register(newHandlers ...*HandlerFactory) { - *factories = append(*factories, newHandlers...) -} - -// WithOptions builds a `HandlerFuncMap` by calling each `HandlerFactory` with -// the passed `Options` pointer and using the respective `ExtensionID` pointer -// as the key. -func (factories HandlerFactories) WithOptions(opts *Options) HandlerFuncMap { - handlerFuncMap := make(HandlerFuncMap) - for _, factory := range factories { - handlerFuncMap[factory.ID()] = factory.NewHandlerFunc(opts) - } - return handlerFuncMap -} - -// ID returns the `ExtensionID` pointer stored with this factory. This factory -// will only handle extensions that have a matching id value. -func (handlerFactory *HandlerFactory) ID() *ExtensionID { - return handlerFactory.id -} - -// NewHandlerFunc returns a new `HandlerFunc` with the passed `Options`. -func (handlerFactory *HandlerFactory) NewHandlerFunc(opts *Options) HandlerFunc { - return handlerFactory.factory(opts) -} - -func uniqueExts(exts []pkix.Extension) bool { - seen := make(map[string]struct{}, len(exts)) - for _, e := range exts { - s := e.Id.String() - if _, ok := seen[s]; ok { - return false - } - seen[s] = struct{}{} - } - return true -} - -func caWhitelistSignedLeafHandler(opts *Options) HandlerFunc { - return func(ext pkix.Extension, chains [][]*x509.Certificate) error { - if opts.PeerCAWhitelist == nil { - return Error.New("no whitelist provided") - } - - leaf := chains[0][peertls.LeafIndex] - for _, ca := range opts.PeerCAWhitelist { - err := pkcrypto.HashAndVerifySignature(ca.PublicKey, leaf.RawTBSCertificate, ext.Value) - if err == nil { - return nil - } - } - return ErrVerifyCASignedLeaf - } -} diff --git a/vendor/storj.io/common/peertls/extensions/fuzz.go b/vendor/storj.io/common/peertls/extensions/fuzz.go deleted file mode 100644 index aefa84108..000000000 --- a/vendor/storj.io/common/peertls/extensions/fuzz.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build gofuzz - -package extensions - -// To run fuzzing tests: -// -// clone github.com/storj/fuzz-corpus -// -// Install fuzzing tools: -// GO111MODULE=off go get github.com/dvyukov/go-fuzz/... -// -// Build binaries: -// go-fuzz-build . -// -// Run with test corpus: -// go-fuzz -bin extensions-fuzz.zip -workdir $FUZZCORPUS/peertls/extensions - -// Fuzz implements a simple fuzz test for revocationDecoder. -func Fuzz(data []byte) int { - var dec revocationDecoder - _, err := dec.decode(data) - if err != nil { - return 0 - } - return 1 -} diff --git a/vendor/storj.io/common/peertls/extensions/gob.go b/vendor/storj.io/common/peertls/extensions/gob.go deleted file mode 100644 index 2c99744d1..000000000 --- a/vendor/storj.io/common/peertls/extensions/gob.go +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package extensions - -import ( - "bytes" - "encoding/binary" - "io" - "math/bits" - - "github.com/zeebo/errs" -) - -const ( - uint64Size = 8 - firstCustomTypeID = 65 - encFirstCustomTypeID = 130 // encoded 65 -) - -// hardcoded initial part of Revocation gob encoding, its constant until Revocation struct won't change, -// contains definition of Revocation struct with fields names and types. -// https://golang.org/pkg/encoding/gob/ -var wireEncoding = []byte{ - 64, 255, 129, 3, 1, 1, 10, 82, 101, 118, 111, 99, 97, 116, 105, 111, 110, 1, 255, 130, 0, - 1, 3, 1, 9, 84, 105, 109, 101, 115, 116, 97, 109, 112, 1, 4, 0, 1, 7, 75, 101, 121, 72, - 97, 115, 104, 1, 10, 0, 1, 9, 83, 105, 103, 110, 97, 116, 117, 114, 101, 1, 10, 0, 0, 0, -} - -type revocationEncoder struct { - value *bytes.Buffer -} - -func (encoder *revocationEncoder) encode(revocation Revocation) ([]byte, error) { - encoder.value = new(bytes.Buffer) - - encoder.encodeInt(firstCustomTypeID) - delta := uint64(1) - if revocation.Timestamp != 0 { - encoder.encodeUint(delta) - encoder.encodeInt(revocation.Timestamp) - } else { - delta++ - } - - if len(revocation.KeyHash) > 0 { - encoder.encodeUint(delta) - encoder.encodeUint(uint64(len(revocation.KeyHash))) - encoder.writeBytes(revocation.KeyHash) - delta = uint64(1) - } else { - delta++ - } - - if len(revocation.Signature) > 0 { - encoder.encodeUint(delta) - encoder.encodeUint(uint64(len(revocation.Signature))) - encoder.writeBytes(revocation.Signature) - } - - encoder.encodeUint(0) - - valueLength := encoder.value.Len() - - encoder.encodeUint(uint64(valueLength)) - - value := encoder.value.Bytes() - lengthData := value[valueLength:] - valueData := value[:valueLength] - return append(wireEncoding, append(lengthData, valueData...)...), nil -} - -func (encoder *revocationEncoder) encodeInt(i int64) { - var x uint64 - if i < 0 { - x = uint64(^i<<1) | 1 - } else { - x = uint64(i << 1) - } - encoder.encodeUint(x) -} - -func (encoder *revocationEncoder) encodeUint(x uint64) { - if x <= 0x7F { - encoder.writeByte(uint8(x)) - return - } - - var stateBuf [1 + uint64Size]byte - binary.BigEndian.PutUint64(stateBuf[1:], x) - bc := bits.LeadingZeros64(x) >> 3 // 8 - bytelen(x) - stateBuf[bc] = uint8(bc - uint64Size) // and then we subtract 8 to get -bytelen(x) - - encoder.writeBytes(stateBuf[bc : uint64Size+1]) -} - -func (encoder *revocationEncoder) writeByte(x byte) { - encoder.value.WriteByte(x) -} - -func (encoder *revocationEncoder) writeBytes(x []byte) { - encoder.value.Write(x) -} - -type revocationDecoder struct { - data *bytes.Buffer -} - -func (decoder *revocationDecoder) decode(data []byte) (revocation Revocation, err error) { - decoder.data = bytes.NewBuffer(data) - - wire := make([]byte, len(wireEncoding)) - _, err = io.ReadFull(decoder.data, wire) - if err != nil { - return revocation, err - } - if !bytes.Equal(wire, wireEncoding) { - return revocation, ErrRevocation.New("invalid revocation encoding") - } - - length, err := decoder.decodeUint() - if err != nil { - return revocation, err - } - - if length != uint64(len(decoder.data.Bytes())) { - return revocation, ErrRevocation.New("invalid revocation encoding") - } - - typeID, err := decoder.decodeUint() - if err != nil { - return revocation, err - } - if typeID != encFirstCustomTypeID { - return revocation, ErrRevocation.New("invalid revocation encoding") - } - - index := uint64(0) - for { - field, err := decoder.decodeUint() - if err != nil { - return revocation, err - } - - if field == 0 { - break - } - - switch field + index { - case 1: - revocation.Timestamp, err = decoder.decodeInt() - if err != nil { - return revocation, err - } - case 2: - revocation.KeyHash, err = decoder.decodeByteArray() - if err != nil { - return revocation, err - } - case 3: - revocation.Signature, err = decoder.decodeByteArray() - if err != nil { - return revocation, err - } - default: - return revocation, errs.New("invalid field") - } - - index += field - } - - return revocation, nil -} - -func (decoder *revocationDecoder) decodeUint() (x uint64, err error) { - b, err := decoder.data.ReadByte() - if err != nil { - return 0, err - } - if b <= 0x7f { - return uint64(b), nil - } - n := -int(int8(b)) - if n > uint64Size { - return 0, errs.New("encoded unsigned integer out of range") - } - buf := make([]byte, n) - read, err := io.ReadFull(decoder.data, buf) - if err != nil { - return 0, err - } - if read < n { - return 0, errs.New("invalid uint data length %d: exceeds input size %d", n, len(buf)) - } - // Don't need to check error; it's safe to loop regardless. - // Could check that the high byte is zero but it's not worth it. - for _, b := range buf { - x = x<<8 | uint64(b) - } - return x, nil -} - -func (decoder *revocationDecoder) decodeInt() (int64, error) { - x, err := decoder.decodeUint() - if err != nil { - return 0, err - } - if x&1 != 0 { - return ^int64(x >> 1), nil - } - return int64(x >> 1), nil -} - -func (decoder *revocationDecoder) decodeByteArray() ([]byte, error) { - length, err := decoder.decodeUint() - if err != nil { - return nil, err - } - - n := int(length) - if uint64(n) != length || decoder.data.Len() < n { - return nil, errs.New("invalid array length: %d", length) - } - - buf := make([]byte, n) - _, err = io.ReadFull(decoder.data, buf) - if err != nil { - return nil, err - } - return buf, nil -} diff --git a/vendor/storj.io/common/peertls/extensions/revocations.go b/vendor/storj.io/common/peertls/extensions/revocations.go deleted file mode 100644 index 4b6035442..000000000 --- a/vendor/storj.io/common/peertls/extensions/revocations.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package extensions - -import ( - "bytes" - "context" - "crypto" - "crypto/x509" - "crypto/x509/pkix" - "encoding/binary" - "time" - - "github.com/zeebo/errs" - - "storj.io/common/peertls" - "storj.io/common/pkcrypto" -) - -var ( - // RevocationCheckHandler ensures that a remote peer's certificate chain - // doesn't contain any revoked certificates. - RevocationCheckHandler = NewHandlerFactory(&RevocationExtID, revocationChecker) - // RevocationUpdateHandler looks for certificate revocation extensions on a - // remote peer's certificate chain, adding them to the revocation DB if valid. - RevocationUpdateHandler = NewHandlerFactory(&RevocationExtID, revocationUpdater) -) - -// ErrRevocation is used when an error occurs involving a certificate revocation. -var ErrRevocation = errs.Class("revocation processing error") - -// ErrRevocationDB is used when an error occurs involving the revocations database. -var ErrRevocationDB = errs.Class("revocation database error") - -// ErrRevokedCert is used when a certificate in the chain is revoked and not expected to be. -var ErrRevokedCert = ErrRevocation.New("a certificate in the chain is revoked") - -// ErrRevocationTimestamp is used when a revocation's timestamp is older than the last recorded revocation. -var ErrRevocationTimestamp = Error.New("revocation timestamp is older than last known revocation") - -// Revocation represents a certificate revocation for storage in the revocation -// database and for use in a TLS extension. -type Revocation struct { - Timestamp int64 - KeyHash []byte - Signature []byte -} - -// RevocationDB stores certificate revocation data. -type RevocationDB interface { - Get(ctx context.Context, chain []*x509.Certificate) (*Revocation, error) - Put(ctx context.Context, chain []*x509.Certificate, ext pkix.Extension) error - List(ctx context.Context) ([]*Revocation, error) -} - -// NewRevocationExt generates a revocation extension for a certificate. -func NewRevocationExt(key crypto.PrivateKey, revokedCert *x509.Certificate) (pkix.Extension, error) { - nowUnix := time.Now().Unix() - - keyHash, err := peertls.DoubleSHA256PublicKey(revokedCert.PublicKey) - if err != nil { - return pkix.Extension{}, err - } - rev := Revocation{ - Timestamp: nowUnix, - KeyHash: keyHash[:], - } - - if err := rev.Sign(key); err != nil { - return pkix.Extension{}, err - } - - revBytes, err := rev.Marshal() - if err != nil { - return pkix.Extension{}, err - } - - ext := pkix.Extension{ - Id: RevocationExtID, - Value: revBytes, - } - - return ext, nil -} - -func revocationChecker(opts *Options) HandlerFunc { - return func(_ pkix.Extension, chains [][]*x509.Certificate) error { - ca, leaf := chains[0][peertls.CAIndex], chains[0][peertls.LeafIndex] - lastRev, lastRevErr := opts.RevocationDB.Get(context.TODO(), chains[0]) - if lastRevErr != nil { - return Error.Wrap(lastRevErr) - } - if lastRev == nil { - return nil - } - - nodeID, err := peertls.DoubleSHA256PublicKey(ca.PublicKey) - if err != nil { - return err - } - leafKeyHash, err := peertls.DoubleSHA256PublicKey(leaf.PublicKey) - if err != nil { - return err - } - - // NB: we trust that anything that made it into the revocation DB is valid - // (i.e. no need for further verification) - switch { - case bytes.Equal(lastRev.KeyHash, nodeID[:]): - fallthrough - case bytes.Equal(lastRev.KeyHash, leafKeyHash[:]): - return ErrRevokedCert - default: - return nil - } - } -} - -func revocationUpdater(opts *Options) HandlerFunc { - return func(ext pkix.Extension, chains [][]*x509.Certificate) error { - if err := opts.RevocationDB.Put(context.TODO(), chains[0], ext); err != nil { - return err - } - return nil - } -} - -// Verify checks if the signature of the revocation was produced by the passed cert's public key. -func (r Revocation) Verify(signingCert *x509.Certificate) error { - pubKey, ok := signingCert.PublicKey.(crypto.PublicKey) - if !ok { - return pkcrypto.ErrUnsupportedKey.New("%T", signingCert.PublicKey) - } - - data := r.TBSBytes() - if err := pkcrypto.HashAndVerifySignature(pubKey, data, r.Signature); err != nil { - return err - } - return nil -} - -// TBSBytes (ToBeSigned) returns the hash of the revoked certificate key hash -// and the timestamp (i.e. hash(hash(cert bytes) + timestamp)). -func (r *Revocation) TBSBytes() []byte { - var tsBytes [binary.MaxVarintLen64]byte - binary.PutVarint(tsBytes[:], r.Timestamp) - toHash := append(append([]byte{}, r.KeyHash...), tsBytes[:]...) - - return pkcrypto.SHA256Hash(toHash) -} - -// Sign generates a signature using the passed key and attaches it to the revocation. -func (r *Revocation) Sign(key crypto.PrivateKey) error { - data := r.TBSBytes() - sig, err := pkcrypto.HashAndSign(key, data) - if err != nil { - return err - } - r.Signature = sig - return nil -} - -// Marshal serializes a revocation to bytes. -func (r Revocation) Marshal() ([]byte, error) { - return (&revocationEncoder{}).encode(r) -} - -// Unmarshal deserializes a revocation from bytes. -func (r *Revocation) Unmarshal(data []byte) error { - revocation, err := (&revocationDecoder{}).decode(data) - if err != nil { - return err - } - *r = revocation - return nil -} diff --git a/vendor/storj.io/common/peertls/peertls.go b/vendor/storj.io/common/peertls/peertls.go deleted file mode 100644 index db8cd9539..000000000 --- a/vendor/storj.io/common/peertls/peertls.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package peertls - -import ( - "bytes" - "crypto" - "crypto/rand" - "crypto/tls" - "crypto/x509" - "io" - - "github.com/zeebo/errs" - - "storj.io/common/pkcrypto" -) - -const ( - // LeafIndex is the index of the leaf certificate in a cert chain (0) - LeafIndex = iota - // CAIndex is the index of the CA certificate in a cert chain (1) - CAIndex -) - -var ( - // ErrNotExist is used when a file or directory doesn't exist. - ErrNotExist = errs.Class("file or directory not found error") - // ErrGenerate is used when an error occurred during cert/key generation. - ErrGenerate = errs.Class("tls generation error") - // ErrTLSTemplate is used when an error occurs during tls template generation. - ErrTLSTemplate = errs.Class("tls template error") - // ErrVerifyPeerCert is used when an error occurs during `VerifyPeerCertificate`. - ErrVerifyPeerCert = errs.Class("tls peer certificate verification error") - // ErrVerifyCertificateChain is used when a certificate chain can't be verified from leaf to root - // (i.e.: each cert in the chain should be signed by the preceding cert and the root should be self-signed). - ErrVerifyCertificateChain = errs.Class("certificate chain signature verification failed") - // ErrVerifyCAWhitelist is used when a signature wasn't produced by any CA in the whitelist. - ErrVerifyCAWhitelist = errs.Class("not signed by any CA in the whitelist") -) - -// PeerCertVerificationFunc is the signature for a `*tls.Config{}`'s -// `VerifyPeerCertificate` function. -type PeerCertVerificationFunc func([][]byte, [][]*x509.Certificate) error - -// VerifyPeerFunc combines multiple `*tls.Config#VerifyPeerCertificate` -// functions and adds certificate parsing. -func VerifyPeerFunc(next ...PeerCertVerificationFunc) PeerCertVerificationFunc { - return func(chain [][]byte, _ [][]*x509.Certificate) error { - c, err := pkcrypto.CertsFromDER(chain) - if err != nil { - return NewNonTemporaryError(ErrVerifyPeerCert.Wrap(err)) - } - - for _, n := range next { - if n != nil { - if err := n(chain, [][]*x509.Certificate{c}); err != nil { - return NewNonTemporaryError(ErrVerifyPeerCert.Wrap(err)) - } - } - } - return nil - } -} - -// VerifyPeerCertChains verifies that the first certificate chain contains certificates -// which are signed by their respective parents, ending with a self-signed root. -func VerifyPeerCertChains(_ [][]byte, parsedChains [][]*x509.Certificate) error { - return verifyChainSignatures(parsedChains[0]) -} - -// VerifyCAWhitelist verifies that the peer identity's CA was signed by any one -// of the (certificate authority) certificates in the provided whitelist. -func VerifyCAWhitelist(cas []*x509.Certificate) PeerCertVerificationFunc { - if cas == nil { - return nil - } - return func(_ [][]byte, parsedChains [][]*x509.Certificate) error { - for _, ca := range cas { - err := verifyCertSignature(ca, parsedChains[0][CAIndex]) - if err == nil { - return nil - } - } - return ErrVerifyCAWhitelist.New("CA cert") - } -} - -// TLSCert creates a tls.Certificate from chains, key and leaf. -func TLSCert(chain [][]byte, leaf *x509.Certificate, key crypto.PrivateKey) (*tls.Certificate, error) { - var err error - if leaf == nil { - leaf, err = pkcrypto.CertFromDER(chain[LeafIndex]) - if err != nil { - return nil, err - } - } - - return &tls.Certificate{ - Leaf: leaf, - Certificate: chain, - PrivateKey: key, - }, nil -} - -// WriteChain writes the certificate chain (leaf-first) and extensions to the writer, PEM-encoded. -func WriteChain(w io.Writer, chain ...*x509.Certificate) error { - if len(chain) < 1 { - return errs.New("expected at least one certificate for writing") - } - - var extErrs errs.Group - for _, c := range chain { - if err := pkcrypto.WriteCertPEM(w, c); err != nil { - return errs.Wrap(err) - } - } - return extErrs.Err() -} - -// ChainBytes returns bytes of the certificate chain (leaf-first) to the writer, PEM-encoded. -func ChainBytes(chain ...*x509.Certificate) ([]byte, error) { - var data bytes.Buffer - err := WriteChain(&data, chain...) - return data.Bytes(), err -} - -// CreateSelfSignedCertificate creates a new self-signed X.509v3 certificate -// using fields from the given template. -// -// A part of the errors that CreateCertificate can return it can return -// pkcrypto.ErrUnsuportedKey error. -func CreateSelfSignedCertificate(key crypto.PrivateKey, template *x509.Certificate) (*x509.Certificate, error) { - pubKey, err := pkcrypto.PublicKeyFromPrivate(key) - if err != nil { - return nil, err - } - return CreateCertificate(pubKey, key, template, template) -} - -// CreateCertificate creates a new X.509v3 certificate based on a template. -// The new certificate: -// -// * will have the public key given as 'signee' -// * will be signed by 'signer' (which should be the private key of 'issuer') -// * will be issued by 'issuer' -// * will have metadata fields copied from 'template' -// -// Returns the new Certificate object. -func CreateCertificate(signee crypto.PublicKey, signer crypto.PrivateKey, template, issuer *x509.Certificate) (*x509.Certificate, error) { - if _, ok := signer.(crypto.Signer); !ok { - // x509.CreateCertificate will panic in this case, so check here and make debugging easier - return nil, errs.New("can't sign certificate with signer key of type %T", signer) - } - - // TODO: should we check for uniqueness? - template.ExtraExtensions = append(template.ExtraExtensions, template.Extensions...) - cb, err := x509.CreateCertificate( - rand.Reader, - template, - issuer, - signee, - signer, - ) - if err != nil { - return nil, errs.Wrap(err) - } - return pkcrypto.CertFromDER(cb) -} diff --git a/vendor/storj.io/common/peertls/templates.go b/vendor/storj.io/common/peertls/templates.go deleted file mode 100644 index ca1d75c85..000000000 --- a/vendor/storj.io/common/peertls/templates.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package peertls - -import ( - "crypto/x509" - "crypto/x509/pkix" -) - -// CATemplate returns x509.Certificate template for certificate authority. -func CATemplate() (*x509.Certificate, error) { - serialNumber, err := newSerialNumber() - if err != nil { - return nil, ErrTLSTemplate.Wrap(err) - } - - template := &x509.Certificate{ - SerialNumber: serialNumber, - KeyUsage: x509.KeyUsageCertSign, - BasicConstraintsValid: true, - IsCA: true, - Subject: pkix.Name{Organization: []string{"Storj"}}, - } - - return template, nil -} - -// LeafTemplate returns x509.Certificate template for signing and encrypting. -func LeafTemplate() (*x509.Certificate, error) { - serialNumber, err := newSerialNumber() - if err != nil { - return nil, ErrTLSTemplate.Wrap(err) - } - - template := &x509.Certificate{ - SerialNumber: serialNumber, - KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, - BasicConstraintsValid: true, - IsCA: false, - Subject: pkix.Name{Organization: []string{"Storj"}}, - } - - return template, nil -} diff --git a/vendor/storj.io/common/peertls/tlsopts/cert.go b/vendor/storj.io/common/peertls/tlsopts/cert.go deleted file mode 100644 index 820709b99..000000000 --- a/vendor/storj.io/common/peertls/tlsopts/cert.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package tlsopts - -const ( - // DefaultPeerCAWhitelist includes the production Storj network CAs - DefaultPeerCAWhitelist = `-----BEGIN CERTIFICATE----- -MIIBWzCCAQGgAwIBAgIRAK7f/E+PDEvB/TrUSaHxOEYwCgYIKoZIzj0EAwIwEDEO -MAwGA1UEChMFU3RvcmowIhgPMDAwMTAxMDEwMDAwMDBaGA8wMDAxMDEwMTAwMDAw -MFowEDEOMAwGA1UEChMFU3RvcmowWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATr -sDBAh7sr9eVZJUIFb79WK2qTcSKw/sP95JF5rCIJ5FvvwA/cx70VdW6IQjVhIaDY -llQONAD90PeoOpqSyo+iozgwNjAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0lBAwwCgYI -KwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiEAzPdn -5ZK9hIUm+0b7iBHfk1T/O7gpwGTmsSLps4cF6KgCIDhgQ4g2givMj5Khmuhnr/e7 -z6HlDVf3PJOQv1yZqg7W ------END CERTIFICATE-----` -) diff --git a/vendor/storj.io/common/peertls/tlsopts/config.go b/vendor/storj.io/common/peertls/tlsopts/config.go deleted file mode 100644 index 14d2e785f..000000000 --- a/vendor/storj.io/common/peertls/tlsopts/config.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package tlsopts - -import ( - "storj.io/common/peertls/extensions" -) - -// Config holds tls configuration parameters. -type Config struct { - RevocationDBURL string `default:"bolt://$CONFDIR/revocations.db" help:"url for revocation database (e.g. bolt://some.db OR redis://127.0.0.1:6378?db=2&password=abc123)"` - PeerCAWhitelistPath string `help:"path to the CA cert whitelist (peer identities must be signed by one these to be verified). this will override the default peer whitelist"` - UsePeerCAWhitelist bool `devDefault:"false" releaseDefault:"true" help:"if true, uses peer ca whitelist checking"` - PeerIDVersions string `default:"latest" help:"identity version(s) the server will be allowed to talk to"` - Extensions extensions.Config -} diff --git a/vendor/storj.io/common/peertls/tlsopts/doc.go b/vendor/storj.io/common/peertls/tlsopts/doc.go deleted file mode 100644 index 4db784d37..000000000 --- a/vendor/storj.io/common/peertls/tlsopts/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package tlsopts handles TLS server options. -package tlsopts diff --git a/vendor/storj.io/common/peertls/tlsopts/options.go b/vendor/storj.io/common/peertls/tlsopts/options.go deleted file mode 100644 index a2af7d5d1..000000000 --- a/vendor/storj.io/common/peertls/tlsopts/options.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package tlsopts - -import ( - "crypto/tls" - "crypto/x509" - "crypto/x509/pkix" - "io/ioutil" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/common/identity" - "storj.io/common/peertls" - "storj.io/common/peertls/extensions" - "storj.io/common/pkcrypto" -) - -var ( - mon = monkit.Package() - // Error is error for tlsopts - Error = errs.Class("tlsopts error") -) - -// Options holds config, identity, and peer verification function data for use with tls. -type Options struct { - Config Config - Ident *identity.FullIdentity - RevDB extensions.RevocationDB - PeerCAWhitelist []*x509.Certificate - VerificationFuncs *VerificationFuncs - Cert *tls.Certificate -} - -// VerificationFuncs keeps track of of client and server peer certificate verification -// functions for use in tls handshakes. -type VerificationFuncs struct { - client []peertls.PeerCertVerificationFunc - server []peertls.PeerCertVerificationFunc -} - -// ExtensionMap maps `pkix.Extension`s to their respective asn1 object ID string. -type ExtensionMap map[string]pkix.Extension - -// NewOptions is a constructor for `tls options` given an identity, config, and -// revocation DB. A caller may pass a nil revocation DB if the revocation -// extension is disabled. -func NewOptions(i *identity.FullIdentity, c Config, revocationDB extensions.RevocationDB) (*Options, error) { - opts := &Options{ - Config: c, - RevDB: revocationDB, - Ident: i, - VerificationFuncs: new(VerificationFuncs), - } - - err := opts.configure() - if err != nil { - return nil, err - } - - return opts, nil -} - -// NewExtensionsMap builds an `ExtensionsMap` from the extensions in the passed certificate(s). -func NewExtensionsMap(chain ...*x509.Certificate) ExtensionMap { - extensionMap := make(ExtensionMap) - for _, cert := range chain { - for _, ext := range cert.Extensions { - extensionMap[ext.Id.String()] = ext - } - } - return extensionMap -} - -// ExtensionOptions converts options for use in extension handling. -func (opts *Options) ExtensionOptions() *extensions.Options { - return &extensions.Options{ - PeerCAWhitelist: opts.PeerCAWhitelist, - RevocationDB: opts.RevDB, - PeerIDVersions: opts.Config.PeerIDVersions, - } -} - -// configure adds peer certificate verification functions and data structures -// required for completing TLS handshakes to the options. -func (opts *Options) configure() (err error) { - if opts.Config.UsePeerCAWhitelist { - whitelist := []byte(DefaultPeerCAWhitelist) - if opts.Config.PeerCAWhitelistPath != "" { - whitelist, err = ioutil.ReadFile(opts.Config.PeerCAWhitelistPath) - if err != nil { - return Error.New("unable to find whitelist file %v: %v", opts.Config.PeerCAWhitelistPath, err) - } - } - opts.PeerCAWhitelist, err = pkcrypto.CertsFromPEM(whitelist) - if err != nil { - return Error.Wrap(err) - } - opts.VerificationFuncs.ClientAdd(peertls.VerifyCAWhitelist(opts.PeerCAWhitelist)) - } - - handlers := make(extensions.HandlerFactories, len(extensions.DefaultHandlers)) - copy(handlers, extensions.DefaultHandlers) - - if opts.Config.Extensions.Revocation { - handlers.Register( - extensions.RevocationCheckHandler, - extensions.RevocationUpdateHandler, - ) - } - - if opts.Config.Extensions.WhitelistSignedLeaf { - handlers.Register(extensions.CAWhitelistSignedLeafHandler) - } - - opts.handleExtensions(handlers) - - opts.Cert, err = peertls.TLSCert(opts.Ident.RawChain(), opts.Ident.Leaf, opts.Ident.Key) - return err -} - -// handleExtensions combines and wraps all extension handler functions into a peer -// certificate verification function. This allows extension handling via the -// `VerifyPeerCertificate` field in a `tls.Config` during a TLS handshake. -func (opts *Options) handleExtensions(handlers extensions.HandlerFactories) { - if len(handlers) == 0 { - return - } - - handlerFuncMap := handlers.WithOptions(opts.ExtensionOptions()) - - combinedHandlerFunc := func(_ [][]byte, parsedChains [][]*x509.Certificate) error { - extensionMap := NewExtensionsMap(parsedChains[0]...) - return extensionMap.HandleExtensions(handlerFuncMap, parsedChains) - } - - opts.VerificationFuncs.Add(combinedHandlerFunc) -} - -// HandleExtensions calls each `extensions.HandlerFunc` with its respective extension -// and the certificate chain where its object ID string matches the extension's. -func (extensionMap ExtensionMap) HandleExtensions(handlerFuncMap extensions.HandlerFuncMap, chain [][]*x509.Certificate) error { - for idStr, extension := range extensionMap { - for id, handlerFunc := range handlerFuncMap { - if idStr == id.String() { - err := handlerFunc(extension, chain) - if err != nil { - return Error.Wrap(err) - } - } - } - } - return nil -} - -// Client returns the client verification functions. -func (vf *VerificationFuncs) Client() []peertls.PeerCertVerificationFunc { - return vf.client -} - -// Server returns the server verification functions. -func (vf *VerificationFuncs) Server() []peertls.PeerCertVerificationFunc { - return vf.server -} - -// Add adds verification functions so the client and server lists. -func (vf *VerificationFuncs) Add(verificationFuncs ...peertls.PeerCertVerificationFunc) { - vf.ClientAdd(verificationFuncs...) - vf.ServerAdd(verificationFuncs...) -} - -// ClientAdd adds verification functions so the client list. -func (vf *VerificationFuncs) ClientAdd(verificationFuncs ...peertls.PeerCertVerificationFunc) { - verificationFuncs = removeNils(verificationFuncs) - vf.client = append(vf.client, verificationFuncs...) -} - -// ServerAdd adds verification functions so the server list. -func (vf *VerificationFuncs) ServerAdd(verificationFuncs ...peertls.PeerCertVerificationFunc) { - verificationFuncs = removeNils(verificationFuncs) - vf.server = append(vf.server, verificationFuncs...) -} - -func removeNils(verificationFuncs []peertls.PeerCertVerificationFunc) []peertls.PeerCertVerificationFunc { - result := verificationFuncs[:0] - for _, f := range verificationFuncs { - if f != nil { - result = append(result, f) - } - } - return result -} diff --git a/vendor/storj.io/common/peertls/tlsopts/tls.go b/vendor/storj.io/common/peertls/tlsopts/tls.go deleted file mode 100644 index c479b1823..000000000 --- a/vendor/storj.io/common/peertls/tlsopts/tls.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package tlsopts - -import ( - "crypto/tls" - "crypto/x509" - - "storj.io/common/identity" - "storj.io/common/peertls" - "storj.io/common/storj" -) - -// ServerTLSConfig returns a TSLConfig for use as a server in handshaking with a peer. -func (opts *Options) ServerTLSConfig() *tls.Config { - return opts.tlsConfig(true) -} - -// ClientTLSConfig returns a TSLConfig for use as a client in handshaking with a peer. -func (opts *Options) ClientTLSConfig(id storj.NodeID) *tls.Config { - return opts.tlsConfig(false, verifyIdentity(id)) -} - -// UnverifiedClientTLSConfig returns a TLSConfig for use as a client in handshaking with -// an unknown peer. -func (opts *Options) UnverifiedClientTLSConfig() *tls.Config { - return opts.tlsConfig(false) -} - -func (opts *Options) tlsConfig(isServer bool, verificationFuncs ...peertls.PeerCertVerificationFunc) *tls.Config { - verificationFuncs = append( - []peertls.PeerCertVerificationFunc{ - peertls.VerifyPeerCertChains, - }, - verificationFuncs..., - ) - - switch isServer { - case true: - verificationFuncs = append( - verificationFuncs, - opts.VerificationFuncs.server..., - ) - case false: - verificationFuncs = append( - verificationFuncs, - opts.VerificationFuncs.client..., - ) - } - - /* #nosec G402 */ // We don't use trusted root certificates, since storage - // nodes might not have a CA signed certificate. We use node id-s for the - // verification instead, that's why we enable InsecureSkipVerify - config := &tls.Config{ - Certificates: []tls.Certificate{*opts.Cert}, - InsecureSkipVerify: true, - MinVersion: tls.VersionTLS12, - DynamicRecordSizingDisabled: true, // always start with big records - VerifyPeerCertificate: peertls.VerifyPeerFunc( - verificationFuncs..., - ), - } - - if isServer { - config.ClientAuth = tls.RequireAnyClientCert - } - - return config -} - -func verifyIdentity(id storj.NodeID) peertls.PeerCertVerificationFunc { - return func(_ [][]byte, parsedChains [][]*x509.Certificate) (err error) { - defer mon.TaskNamed("verifyIdentity")(nil)(&err) - peer, err := identity.PeerIdentityFromChain(parsedChains[0]) - if err != nil { - return err - } - - if peer.ID.String() != id.String() { - return Error.New("peer ID did not match requested ID") - } - - return nil - } -} diff --git a/vendor/storj.io/common/peertls/utils.go b/vendor/storj.io/common/peertls/utils.go deleted file mode 100644 index c0ae6ec30..000000000 --- a/vendor/storj.io/common/peertls/utils.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package peertls - -// Many cryptography standards use ASN.1 to define their data structures, -// and Distinguished Encoding Rules (DER) to serialize those structures. -// Because DER produces binary output, it can be challenging to transmit -// the resulting files through systems, like electronic mail, that only -// support ASCII. The PEM format solves this problem by encoding the -// binary data using base64. -// (see https://en.wikipedia.org/wiki/Privacy-enhanced_Electronic_Mail) - -import ( - "crypto" - "crypto/rand" - "crypto/sha256" - "crypto/x509" - "math/big" - - "github.com/zeebo/errs" - - "storj.io/common/pkcrypto" -) - -// NonTemporaryError is an error with a `Temporary` method which always returns false. -// It is intended for use with grpc. -// -// (see https://godoc.org/google.golang.org/grpc#WithDialer -// and https://godoc.org/google.golang.org/grpc#FailOnNonTempDialError). -type NonTemporaryError struct{ error } - -// NewNonTemporaryError returns a new temporary error for use with grpc. -func NewNonTemporaryError(err error) NonTemporaryError { - return NonTemporaryError{ - error: errs.Wrap(err), - } -} - -// DoubleSHA256PublicKey returns the hash of the hash of (double-hash, SHA226) -// the binary format of the given public key. -func DoubleSHA256PublicKey(k crypto.PublicKey) ([sha256.Size]byte, error) { - kb, err := x509.MarshalPKIXPublicKey(k) - if err != nil { - return [sha256.Size]byte{}, err - } - mid := sha256.Sum256(kb) - end := sha256.Sum256(mid[:]) - return end, nil -} - -// Temporary returns false to indicate that is is a non-temporary error. -func (nte NonTemporaryError) Temporary() bool { - return false -} - -// Err returns the underlying error. -func (nte NonTemporaryError) Err() error { - return nte.error -} - -func verifyChainSignatures(certs []*x509.Certificate) error { - for i, cert := range certs { - j := len(certs) - if i+1 < j { - err := verifyCertSignature(certs[i+1], cert) - if err != nil { - return ErrVerifyCertificateChain.Wrap(err) - } - - continue - } - - err := verifyCertSignature(cert, cert) - if err != nil { - return ErrVerifyCertificateChain.Wrap(err) - } - - } - - return nil -} - -func verifyCertSignature(parentCert, childCert *x509.Certificate) error { - return pkcrypto.HashAndVerifySignature(parentCert.PublicKey, childCert.RawTBSCertificate, childCert.Signature) -} - -func newSerialNumber() (*big.Int, error) { - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - return nil, errs.New("failed to generateServerTls serial number: %s", err.Error()) - } - - return serialNumber, nil -} diff --git a/vendor/storj.io/common/pkcrypto/common.go b/vendor/storj.io/common/pkcrypto/common.go deleted file mode 100644 index 9a78cd65f..000000000 --- a/vendor/storj.io/common/pkcrypto/common.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package pkcrypto - -import ( - "github.com/zeebo/errs" -) - -const ( - // BlockLabelEcPrivateKey is the value to define a block label of EC private key - // (which is used here only for backwards compatibility). Use a general PKCS#8 - // encoding instead. - BlockLabelEcPrivateKey = "EC PRIVATE KEY" - // BlockLabelPrivateKey is the value to define a block label of general private key - // (used for PKCS#8-encoded private keys of type RSA, ECDSA, and others). - BlockLabelPrivateKey = "PRIVATE KEY" - // BlockLabelPublicKey is the value to define a block label of general public key - // (used for PKIX-encoded public keys of type RSA, ECDSA, and others). - BlockLabelPublicKey = "PUBLIC KEY" - // BlockLabelCertificate is the value to define a block label of certificates - BlockLabelCertificate = "CERTIFICATE" - // BlockLabelExtension is the value to define a block label of certificate extensions - BlockLabelExtension = "EXTENSION" -) - -var ( - // ErrUnsupportedKey is used when key type is not supported. - ErrUnsupportedKey = errs.Class("unsupported key type") - // ErrParse is used when an error occurs while parsing a certificate or key. - ErrParse = errs.Class("unable to parse") - // ErrSign is used when something goes wrong while generating a signature. - ErrSign = errs.Class("unable to generate signature") - // ErrVerifySignature is used when a signature verification error occurs. - ErrVerifySignature = errs.Class("signature verification error") - // ErrChainLength is used when the length of a cert chain isn't what was expected - ErrChainLength = errs.Class("cert chain length error") -) diff --git a/vendor/storj.io/common/pkcrypto/doc.go b/vendor/storj.io/common/pkcrypto/doc.go deleted file mode 100644 index c346a6b90..000000000 --- a/vendor/storj.io/common/pkcrypto/doc.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -/*Package pkcrypto contains a set of helper functions and constants to perform -common cryptographic operations like: - -* Signing and verification - -* Public and private key generation - -* Certification generation - -*/ -package pkcrypto diff --git a/vendor/storj.io/common/pkcrypto/encoding.go b/vendor/storj.io/common/pkcrypto/encoding.go deleted file mode 100644 index ba1bb30c7..000000000 --- a/vendor/storj.io/common/pkcrypto/encoding.go +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package pkcrypto - -import ( - "crypto" - "crypto/x509" - "encoding/asn1" - "encoding/pem" - "io" - "math/big" - - "github.com/zeebo/errs" -) - -// WritePublicKeyPEM writes the public key, in a PEM-enveloped -// PKIX form. -func WritePublicKeyPEM(w io.Writer, key crypto.PublicKey) error { - kb, err := PublicKeyToPKIX(key) - if err != nil { - return err - } - err = pem.Encode(w, &pem.Block{Type: BlockLabelPublicKey, Bytes: kb}) - return errs.Wrap(err) -} - -// PublicKeyToPEM encodes a public key to a PEM-enveloped PKIX form. -func PublicKeyToPEM(key crypto.PublicKey) ([]byte, error) { - kb, err := PublicKeyToPKIX(key) - if err != nil { - return nil, err - } - return pem.EncodeToMemory(&pem.Block{Type: BlockLabelPublicKey, Bytes: kb}), nil -} - -// PublicKeyToPKIX serializes a public key to a PKIX-encoded form. -func PublicKeyToPKIX(key crypto.PublicKey) ([]byte, error) { - return x509.MarshalPKIXPublicKey(key) -} - -// PublicKeyFromPKIX parses a public key from its PKIX encoding. -func PublicKeyFromPKIX(pkixData []byte) (crypto.PublicKey, error) { - return x509.ParsePKIXPublicKey(pkixData) -} - -// PublicKeyFromPEM parses a public key from its PEM-enveloped PKIX -// encoding. -func PublicKeyFromPEM(pemData []byte) (crypto.PublicKey, error) { - pb, _ := pem.Decode(pemData) - if pb == nil { - return nil, ErrParse.New("could not parse PEM encoding") - } - if pb.Type != BlockLabelPublicKey { - return nil, ErrParse.New("can not parse public key from PEM block labeled %q", pb.Type) - } - return PublicKeyFromPKIX(pb.Bytes) -} - -// WritePrivateKeyPEM writes the private key to the writer, in a PEM-enveloped -// PKCS#8 form. -func WritePrivateKeyPEM(w io.Writer, key crypto.PrivateKey) error { - kb, err := PrivateKeyToPKCS8(key) - if err != nil { - return errs.Wrap(err) - } - err = pem.Encode(w, &pem.Block{Type: BlockLabelPrivateKey, Bytes: kb}) - return errs.Wrap(err) -} - -// PrivateKeyToPEM serializes a private key to a PEM-enveloped PKCS#8 form. -func PrivateKeyToPEM(key crypto.PrivateKey) ([]byte, error) { - kb, err := PrivateKeyToPKCS8(key) - if err != nil { - return nil, errs.Wrap(err) - } - return pem.EncodeToMemory(&pem.Block{Type: BlockLabelPrivateKey, Bytes: kb}), nil -} - -// PrivateKeyToPKCS8 serializes a private key to a PKCS#8-encoded form. -func PrivateKeyToPKCS8(key crypto.PrivateKey) ([]byte, error) { - return x509.MarshalPKCS8PrivateKey(key) -} - -// PrivateKeyFromPKCS8 parses a private key from its PKCS#8 encoding. -func PrivateKeyFromPKCS8(keyBytes []byte) (crypto.PrivateKey, error) { - key, err := x509.ParsePKCS8PrivateKey(keyBytes) - if err != nil { - return nil, err - } - return crypto.PrivateKey(key), nil -} - -// PrivateKeyFromPEM parses a private key from its PEM-enveloped PKCS#8 -// encoding. -func PrivateKeyFromPEM(keyBytes []byte) (crypto.PrivateKey, error) { - pb, _ := pem.Decode(keyBytes) - if pb == nil { - return nil, ErrParse.New("could not parse PEM encoding") - } - switch pb.Type { - case BlockLabelEcPrivateKey: - return ecPrivateKeyFromASN1(pb.Bytes) - case BlockLabelPrivateKey: - return PrivateKeyFromPKCS8(pb.Bytes) - } - return nil, ErrParse.New("can not parse private key from PEM block labeled %q", pb.Type) -} - -// WriteCertPEM writes the certificate to the writer, in a PEM-enveloped DER -// encoding. -func WriteCertPEM(w io.Writer, certs ...*x509.Certificate) error { - if len(certs) == 0 { - return errs.New("no certs to encode") - } - encodeErrs := new(errs.Group) - for _, cert := range certs { - encodeErrs.Add(pem.Encode(w, &pem.Block{Type: BlockLabelCertificate, Bytes: cert.Raw})) - } - return encodeErrs.Err() -} - -// CertToPEM returns the bytes of the certificate, in a PEM-enveloped DER -// encoding. -func CertToPEM(cert *x509.Certificate) []byte { - return pem.EncodeToMemory(&pem.Block{Type: BlockLabelCertificate, Bytes: cert.Raw}) -} - -// CertToDER returns the bytes of the certificate, in a DER encoding. -// -// Note that this is fairly useless, as x509.Certificate objects are always -// supposed to have a member containing the raw DER encoding. But this is -// included for completeness with the rest of this module's API. -func CertToDER(cert *x509.Certificate) ([]byte, error) { - return cert.Raw, nil -} - -// CertFromDER parses an X.509 certificate from its DER encoding. -func CertFromDER(certDER []byte) (*x509.Certificate, error) { - return x509.ParseCertificate(certDER) -} - -// CertFromPEM parses an X.509 certificate from its PEM-enveloped DER encoding. -func CertFromPEM(certPEM []byte) (*x509.Certificate, error) { - kb, _ := pem.Decode(certPEM) - if kb == nil { - return nil, ErrParse.New("could not decode certificate as PEM") - } - if kb.Type != BlockLabelCertificate { - return nil, ErrParse.New("can not parse certificate from PEM block labeled %q", kb.Type) - } - return CertFromDER(kb.Bytes) -} - -// CertsFromDER parses an x509 certificate from each of the given byte -// slices, which should be encoded in DER. -func CertsFromDER(rawCerts [][]byte) ([]*x509.Certificate, error) { - certs := make([]*x509.Certificate, len(rawCerts)) - for i, c := range rawCerts { - var err error - certs[i], err = CertFromDER(c) - if err != nil { - return nil, ErrParse.New("unable to parse certificate at index %d", i) - } - } - return certs, nil -} - -// CertsFromPEM parses a PEM chain from a single byte string (the PEM-enveloped -// certificates should be concatenated). The PEM blocks may include PKIX -// extensions. -func CertsFromPEM(pemBytes []byte) ([]*x509.Certificate, error) { - var ( - encChain encodedChain - blockErrs errs.Group - ) - for { - var pemBlock *pem.Block - pemBlock, pemBytes = pem.Decode(pemBytes) - if pemBlock == nil { - break - } - if pemBlock.Type == BlockLabelCertificate { - encChain.AddCert(pemBlock.Bytes) - } - } - if err := blockErrs.Err(); err != nil { - return nil, err - } - - return encChain.Parse() -} - -type encodedChain struct { - chain [][]byte -} - -func (e *encodedChain) AddCert(b []byte) { - e.chain = append(e.chain, b) -} - -func (e *encodedChain) Parse() ([]*x509.Certificate, error) { - chain, err := CertsFromDER(e.chain) - if err != nil { - return nil, err - } - - return chain, nil -} - -type ecdsaSignature struct { - R, S *big.Int -} - -func marshalECDSASignature(r, s *big.Int) ([]byte, error) { - return asn1.Marshal(ecdsaSignature{R: r, S: s}) -} - -func unmarshalECDSASignature(signatureBytes []byte) (r, s *big.Int, err error) { - var signature ecdsaSignature - if _, err = asn1.Unmarshal(signatureBytes, &signature); err != nil { - return nil, nil, err - } - return signature.R, signature.S, nil -} - -// ecPrivateKeyFromASN1 parses a private key from the special Elliptic Curve -// Private Key ASN.1 structure. This is here only for backward compatibility. -// Use PKCS#8 instead. -func ecPrivateKeyFromASN1(privKeyData []byte) (crypto.PrivateKey, error) { - key, err := x509.ParseECPrivateKey(privKeyData) - if err != nil { - return nil, err - } - return crypto.PrivateKey(key), nil -} diff --git a/vendor/storj.io/common/pkcrypto/hashing.go b/vendor/storj.io/common/pkcrypto/hashing.go deleted file mode 100644 index 06590989f..000000000 --- a/vendor/storj.io/common/pkcrypto/hashing.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build !stdsha256 - -package pkcrypto - -import ( - "hash" - - "github.com/minio/sha256-simd" -) - -// NewHash returns default hash in storj. -func NewHash() hash.Hash { - return sha256.New() -} - -// SHA256Hash calculates the SHA256 hash of the input data. -func SHA256Hash(data []byte) []byte { - sum := sha256.Sum256(data) - return sum[:] -} diff --git a/vendor/storj.io/common/pkcrypto/hashing_std.go b/vendor/storj.io/common/pkcrypto/hashing_std.go deleted file mode 100644 index da4b4eca4..000000000 --- a/vendor/storj.io/common/pkcrypto/hashing_std.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build stdsha256 - -package pkcrypto - -import ( - "crypto/sha256" - "hash" -) - -// NewHash returns default hash in storj. -func NewHash() hash.Hash { - return sha256.New() -} - -// SHA256Hash calculates the SHA256 hash of the input data. -func SHA256Hash(data []byte) []byte { - sum := sha256.Sum256(data) - return sum[:] -} diff --git a/vendor/storj.io/common/pkcrypto/signing.go b/vendor/storj.io/common/pkcrypto/signing.go deleted file mode 100644 index c7c333c2c..000000000 --- a/vendor/storj.io/common/pkcrypto/signing.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package pkcrypto - -import ( - "crypto" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - "math/big" - "reflect" -) - -const ( - // StorjPSSSaltLength holds the correct value for the PSS salt length - // when signing with RSA in Storj code and verifying RSA signatures - // from Storj. - StorjPSSSaltLength = rsa.PSSSaltLengthAuto - - // StorjRSAKeyBits holds the number of bits to use for new RSA keys - // by default. - StorjRSAKeyBits = 2048 -) - -var ( - authECCurve = elliptic.P256() - - pssParams = rsa.PSSOptions{ - SaltLength: StorjPSSSaltLength, - Hash: crypto.SHA256, - } -) - -// GeneratePrivateKey returns a new PrivateKey for signing messages. -func GeneratePrivateKey() (crypto.PrivateKey, error) { - return GeneratePrivateECDSAKey(authECCurve) - // return GeneratePrivateRSAKey(StorjRSAKeyBits) -} - -// GeneratePrivateECDSAKey returns a new private ECDSA key for signing messages. -func GeneratePrivateECDSAKey(curve elliptic.Curve) (*ecdsa.PrivateKey, error) { - return ecdsa.GenerateKey(curve, rand.Reader) -} - -// GeneratePrivateRSAKey returns a new private RSA key for signing messages. -func GeneratePrivateRSAKey(bits int) (*rsa.PrivateKey, error) { - return rsa.GenerateKey(rand.Reader, bits) -} - -// HashAndVerifySignature checks that signature was made by the private key -// corresponding to the given public key, over a SHA-256 digest of the given -// data. It returns an error if verification fails, or nil otherwise. -func HashAndVerifySignature(key crypto.PublicKey, data, signature []byte) error { - digest := SHA256Hash(data) - return VerifySignatureWithoutHashing(key, digest, signature) -} - -// VerifySignatureWithoutHashing checks the signature against the passed data -// (which is normally a digest) and public key. It returns an error if -// verification fails, or nil otherwise. -func VerifySignatureWithoutHashing(pubKey crypto.PublicKey, digest, signature []byte) error { - switch key := pubKey.(type) { - case *ecdsa.PublicKey: - return verifyECDSASignatureWithoutHashing(key, digest, signature) - case *rsa.PublicKey: - return verifyRSASignatureWithoutHashing(key, digest, signature) - } - return ErrUnsupportedKey.New("%T", pubKey) -} - -func verifyECDSASignatureWithoutHashing(pubKey *ecdsa.PublicKey, digest, signatureBytes []byte) error { - r, s, err := unmarshalECDSASignature(signatureBytes) - if err != nil { - return ErrVerifySignature.New("unable to unmarshal ecdsa signature: %v", err) - } - if !ecdsa.Verify(pubKey, digest, r, s) { - return ErrVerifySignature.New("signature is not valid") - } - return nil -} - -func verifyRSASignatureWithoutHashing(pubKey *rsa.PublicKey, digest, signatureBytes []byte) error { - err := rsa.VerifyPSS(pubKey, pssParams.Hash, digest, signatureBytes, &pssParams) - if err != nil { - return ErrVerifySignature.New("signature is not valid") - } - return nil -} - -// PublicKeyFromPrivate returns the public key corresponding to a given private -// key. -// It returns an error if the key isn't of an accepted implementation. -func PublicKeyFromPrivate(privKey crypto.PrivateKey) (crypto.PublicKey, error) { - switch key := privKey.(type) { - case *ecdsa.PrivateKey: - return key.Public(), nil - case *rsa.PrivateKey: - return key.Public(), nil - } - return nil, ErrUnsupportedKey.New("%T", privKey) -} - -// SignWithoutHashing signs the given digest with the private key and returns -// the new signature. -func SignWithoutHashing(privKey crypto.PrivateKey, digest []byte) ([]byte, error) { - switch key := privKey.(type) { - case *ecdsa.PrivateKey: - return signECDSAWithoutHashing(key, digest) - case *rsa.PrivateKey: - return signRSAWithoutHashing(key, digest) - } - return nil, ErrUnsupportedKey.New("%T", privKey) -} - -func signECDSAWithoutHashing(privKey *ecdsa.PrivateKey, digest []byte) ([]byte, error) { - r, s, err := ecdsa.Sign(rand.Reader, privKey, digest) - if err != nil { - return nil, ErrSign.Wrap(err) - } - return marshalECDSASignature(r, s) -} - -func signRSAWithoutHashing(privKey *rsa.PrivateKey, digest []byte) ([]byte, error) { - return privKey.Sign(rand.Reader, digest, &pssParams) -} - -// HashAndSign signs a SHA-256 digest of the given data and returns the new -// signature. -func HashAndSign(key crypto.PrivateKey, data []byte) ([]byte, error) { - digest := SHA256Hash(data) - signature, err := SignWithoutHashing(key, digest) - if err != nil { - return nil, ErrSign.Wrap(err) - } - return signature, nil -} - -// PublicKeyEqual returns true if two public keys are the same. -func PublicKeyEqual(a, b crypto.PublicKey) bool { - switch aConcrete := a.(type) { - case *ecdsa.PublicKey: - bConcrete, ok := b.(*ecdsa.PublicKey) - if !ok { - return false - } - return publicECDSAKeyEqual(aConcrete, bConcrete) - case *rsa.PublicKey: - bConcrete, ok := b.(*rsa.PublicKey) - if !ok { - return false - } - return publicRSAKeyEqual(aConcrete, bConcrete) - } - // a best-effort here is probably better than adding an err return - return reflect.DeepEqual(a, b) -} - -// publicECDSAKeyEqual returns true if two ECDSA public keys are the same. -func publicECDSAKeyEqual(a, b *ecdsa.PublicKey) bool { - return a.Curve == b.Curve && bigIntEq(a.X, b.X) && bigIntEq(a.Y, b.Y) -} - -// publicRSAKeyEqual returns true if two RSA public keys are the same. -func publicRSAKeyEqual(a, b *rsa.PublicKey) bool { - return bigIntEq(a.N, b.N) && a.E == b.E -} - -func bigIntEq(a, b *big.Int) bool { - return a.Cmp(b) == 0 -} diff --git a/vendor/storj.io/common/ranger/common.go b/vendor/storj.io/common/ranger/common.go deleted file mode 100644 index a3eae7c2c..000000000 --- a/vendor/storj.io/common/ranger/common.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package ranger - -import ( - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" -) - -// Error is the errs class of standard Ranger errors. -var Error = errs.Class("ranger error") - -var mon = monkit.Package() diff --git a/vendor/storj.io/common/ranger/doc.go b/vendor/storj.io/common/ranger/doc.go deleted file mode 100644 index 4979934b9..000000000 --- a/vendor/storj.io/common/ranger/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package ranger implements lazy io.Reader and io.Writer interfaces. -package ranger diff --git a/vendor/storj.io/common/ranger/file.go b/vendor/storj.io/common/ranger/file.go deleted file mode 100644 index 71b145035..000000000 --- a/vendor/storj.io/common/ranger/file.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package ranger - -import ( - "context" - "io" - "os" - - "github.com/zeebo/errs" -) - -type fileRanger struct { - path string - size int64 -} - -// FileRanger returns a Ranger from a path. -func FileRanger(path string) (Ranger, error) { - info, err := os.Stat(path) - if err != nil { - return nil, Error.Wrap(err) - } - return &fileRanger{path: path, size: info.Size()}, nil -} - -func (rr *fileRanger) Size() int64 { - return rr.size -} - -func (rr *fileRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - if offset < 0 { - return nil, Error.New("negative offset") - } - if length < 0 { - return nil, Error.New("negative length") - } - if offset+length > rr.size { - return nil, Error.New("range beyond end") - } - - fh, err := os.Open(rr.path) - if err != nil { - return nil, Error.Wrap(err) - } - _, err = fh.Seek(offset, io.SeekStart) - if err != nil { - return nil, Error.Wrap(errs.Combine(err, fh.Close())) - } - - return &FileReader{fh, length}, nil -} - -// FileReader implements limit reader with io.EOF only on last read. -type FileReader struct { - file *os.File - remaining int64 -} - -// Read reads from the underlying file. -func (reader *FileReader) Read(data []byte) (n int, err error) { - if reader.remaining <= 0 { - return 0, io.EOF - } - if int64(len(data)) > reader.remaining { - data = data[0:reader.remaining] - } - n, err = reader.file.Read(data) - reader.remaining -= int64(n) - if err == io.EOF && reader.remaining == 0 { - err = nil - } - return -} - -// Close closes the underlying file. -func (reader *FileReader) Close() error { - return reader.file.Close() -} diff --git a/vendor/storj.io/common/ranger/reader.go b/vendor/storj.io/common/ranger/reader.go deleted file mode 100644 index a002f45c7..000000000 --- a/vendor/storj.io/common/ranger/reader.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package ranger - -import ( - "bytes" - "context" - "io" - "io/ioutil" - - "storj.io/common/readcloser" -) - -// A Ranger is a flexible data stream type that allows for more effective -// pipelining during seeking. A Ranger can return multiple parallel Readers for -// any subranges. -type Ranger interface { - Size() int64 - Range(ctx context.Context, offset, length int64) (io.ReadCloser, error) -} - -// ByteRanger turns a byte slice into a Ranger. -type ByteRanger []byte - -// Size implements Ranger.Size. -func (b ByteRanger) Size() int64 { return int64(len(b)) } - -// Range implements Ranger.Range. -func (b ByteRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - if offset < 0 { - return nil, Error.New("negative offset") - } - if length < 0 { - return nil, Error.New("negative length") - } - if offset+length > int64(len(b)) { - return nil, Error.New("buffer runoff") - } - - return ioutil.NopCloser(bytes.NewReader(b[offset : offset+length])), nil -} - -type concatReader struct { - r1 Ranger - r2 Ranger -} - -func (c *concatReader) Size() int64 { - return c.r1.Size() + c.r2.Size() -} - -func (c *concatReader) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - r1Size := c.r1.Size() - if offset+length <= r1Size { - return c.r1.Range(ctx, offset, length) - } - if offset >= r1Size { - return c.r2.Range(ctx, offset-r1Size, length) - } - r1Range, err := c.r1.Range(ctx, offset, r1Size-offset) - if err != nil { - return nil, err - } - return readcloser.MultiReadCloser( - r1Range, - readcloser.LazyReadCloser(func() (io.ReadCloser, error) { - return c.r2.Range(ctx, 0, length-(r1Size-offset)) - })), nil -} - -func concat2(r1, r2 Ranger) Ranger { - return &concatReader{r1: r1, r2: r2} -} - -// Concat concatenates Rangers. -func Concat(r ...Ranger) Ranger { - switch len(r) { - case 0: - return ByteRanger(nil) - case 1: - return r[0] - case 2: - return concat2(r[0], r[1]) - default: - mid := len(r) / 2 - return concat2(Concat(r[:mid]...), Concat(r[mid:]...)) - } -} - -type subrange struct { - r Ranger - offset, length int64 -} - -// Subrange returns a subset of a Ranger. -func Subrange(data Ranger, offset, length int64) (Ranger, error) { - dSize := data.Size() - if offset < 0 || offset > dSize { - return nil, Error.New("invalid offset") - } - if length+offset > dSize { - return nil, Error.New("invalid length") - } - return &subrange{r: data, offset: offset, length: length}, nil -} - -func (s *subrange) Size() int64 { - return s.length -} - -func (s *subrange) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - return s.r.Range(ctx, offset+s.offset, length) -} diff --git a/vendor/storj.io/common/ranger/readerat.go b/vendor/storj.io/common/ranger/readerat.go deleted file mode 100644 index be8b8617d..000000000 --- a/vendor/storj.io/common/ranger/readerat.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package ranger - -import ( - "context" - "io" -) - -type readerAtRanger struct { - r io.ReaderAt - size int64 -} - -// ReaderAtRanger converts a ReaderAt with a given size to a Ranger. -func ReaderAtRanger(r io.ReaderAt, size int64) Ranger { - return &readerAtRanger{ - r: r, - size: size, - } -} - -func (r *readerAtRanger) Size() int64 { - return r.size -} - -type readerAtReader struct { - r io.ReaderAt - offset, length int64 -} - -func (r *readerAtRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - if offset < 0 { - return nil, Error.New("negative offset") - } - if length < 0 { - return nil, Error.New("negative length") - } - if offset+length > r.size { - return nil, Error.New("buffer runoff") - } - return &readerAtReader{r: r.r, offset: offset, length: length}, nil -} - -func (r *readerAtReader) Read(p []byte) (n int, err error) { - if r.length == 0 { - return 0, io.EOF - } - if int64(len(p)) > r.length { - p = p[:r.length] - } - n, err = r.r.ReadAt(p, r.offset) - r.offset += int64(n) - r.length -= int64(n) - return n, err -} - -func (r *readerAtReader) Close() error { - return nil -} diff --git a/vendor/storj.io/common/readcloser/doc.go b/vendor/storj.io/common/readcloser/doc.go deleted file mode 100644 index 7cbda60a7..000000000 --- a/vendor/storj.io/common/readcloser/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package readcloser implements utilities for io.ReadClosers. -package readcloser diff --git a/vendor/storj.io/common/readcloser/fatal.go b/vendor/storj.io/common/readcloser/fatal.go deleted file mode 100644 index 0bd3358ff..000000000 --- a/vendor/storj.io/common/readcloser/fatal.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package readcloser - -import "io" - -// FatalReadCloser returns a ReadCloser that always fails with err. -func FatalReadCloser(err error) io.ReadCloser { - return &fatalReadCloser{Err: err} -} - -type fatalReadCloser struct { - Err error -} - -func (f *fatalReadCloser) Read(p []byte) (n int, err error) { - return 0, f.Err -} - -func (f *fatalReadCloser) Close() error { - return nil -} diff --git a/vendor/storj.io/common/readcloser/lazy.go b/vendor/storj.io/common/readcloser/lazy.go deleted file mode 100644 index 2aab2c542..000000000 --- a/vendor/storj.io/common/readcloser/lazy.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package readcloser - -import "io" - -// LazyReadCloser returns an ReadCloser that doesn't initialize the backing -// Reader until the first Read. -func LazyReadCloser(reader func() (io.ReadCloser, error)) io.ReadCloser { - return &lazyReadCloser{fn: reader} -} - -type lazyReadCloser struct { - fn func() (io.ReadCloser, error) - r io.ReadCloser -} - -func (l *lazyReadCloser) Read(p []byte) (n int, err error) { - if l.r == nil { - l.r, err = l.fn() - if err != nil { - return 0, err - } - l.fn = nil - } - return l.r.Read(p) -} - -func (l *lazyReadCloser) Close() error { - if l.r != nil { - return l.r.Close() - } - return nil -} diff --git a/vendor/storj.io/common/readcloser/limit.go b/vendor/storj.io/common/readcloser/limit.go deleted file mode 100644 index b4493a33d..000000000 --- a/vendor/storj.io/common/readcloser/limit.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package readcloser - -import "io" - -// LimitReadCloser is a LimitReader extension that returns a ReadCloser -// that reads from r but stops with EOF after n bytes. -func LimitReadCloser(r io.ReadCloser, n int64) io.ReadCloser { - return &limitedReadCloser{io.LimitReader(r, n), r} -} - -type limitedReadCloser struct { - R io.Reader - C io.Closer -} - -func (l *limitedReadCloser) Read(p []byte) (n int, err error) { - return l.R.Read(p) -} - -func (l *limitedReadCloser) Close() error { - return l.C.Close() -} diff --git a/vendor/storj.io/common/readcloser/multi.go b/vendor/storj.io/common/readcloser/multi.go deleted file mode 100644 index 76779599e..000000000 --- a/vendor/storj.io/common/readcloser/multi.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package readcloser - -import ( - "io" - - "github.com/zeebo/errs" -) - -type eofReadCloser struct{} - -func (eofReadCloser) Read([]byte) (int, error) { - return 0, io.EOF -} - -func (eofReadCloser) Close() error { - return nil -} - -type multiReadCloser struct { - readers []io.ReadCloser -} - -// MultiReadCloser is a MultiReader extension that returns a ReaderCloser -// that's the logical concatenation of the provided input readers. -// They're read sequentially. Once all inputs have returned EOF, -// Read will return EOF. If any of the readers return a non-nil, -// non-EOF error, Read will return that error. -func MultiReadCloser(readers ...io.ReadCloser) io.ReadCloser { - r := make([]io.ReadCloser, len(readers)) - copy(r, readers) - return &multiReadCloser{r} -} - -func (mr *multiReadCloser) Read(p []byte) (n int, err error) { - for len(mr.readers) > 0 { - // Optimization to flatten nested multiReaders. - if len(mr.readers) == 1 { - if r, ok := mr.readers[0].(*multiReadCloser); ok { - mr.readers = r.readers - continue - } - } - n, err = mr.readers[0].Read(p) - if err == io.EOF { - err = mr.readers[0].Close() - // Use eofReader instead of nil to avoid nil panic - // after performing flatten (Issue 18232). - mr.readers[0] = eofReadCloser{} // permit earlier GC - mr.readers = mr.readers[1:] - } - if n > 0 || err != io.EOF { - if err == io.EOF && len(mr.readers) > 0 { - // Don't return EOF yet. More readers remain. - err = nil - } - return - } - } - return 0, io.EOF -} - -func (mr *multiReadCloser) Close() error { - errlist := make([]error, len(mr.readers)) - for i, r := range mr.readers { - errlist[i] = r.Close() - } - return errs.Combine(errlist...) -} diff --git a/vendor/storj.io/common/rpc/common.go b/vendor/storj.io/common/rpc/common.go deleted file mode 100644 index f1079e3b0..000000000 --- a/vendor/storj.io/common/rpc/common.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package rpc - -import ( - "net" - "time" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/common/memory" -) - -//go:generate go run gen.go ../pb drpc alias.go - -const ( - // IsDRPC is true if drpc is being used. - IsDRPC = true -) - -var mon = monkit.Package() - -// Error wraps all of the errors returned by this package. -var Error = errs.Class("rpccompat") - -// timedConn wraps a net.Conn so that all reads and writes get the specified timeout and -// return bytes no faster than the rate. If the timeout or rate are zero, they are -// ignored. -type timedConn struct { - net.Conn - rate memory.Size -} - -// now returns time.Now if there's a nonzero rate. -func (t *timedConn) now() (now time.Time) { - if t.rate > 0 { - now = time.Now() - } - return now -} - -// delay ensures that we sleep to keep the rate if it is nonzero. n is the number of -// bytes in the read or write operation we need to delay. -func (t *timedConn) delay(start time.Time, n int) { - if t.rate > 0 { - expected := time.Duration(n * int(time.Second) / t.rate.Int()) - if actual := time.Since(start); expected > actual { - time.Sleep(expected - actual) - } - } -} - -// Read wraps the connection read and adds sleeping to ensure the rate. -func (t *timedConn) Read(p []byte) (int, error) { - start := t.now() - n, err := t.Conn.Read(p) - t.delay(start, n) - return n, err -} - -// Write wraps the connection write and adds sleeping to ensure the rate. -func (t *timedConn) Write(p []byte) (int, error) { - start := t.now() - n, err := t.Conn.Write(p) - t.delay(start, n) - return n, err -} diff --git a/vendor/storj.io/common/rpc/conn.go b/vendor/storj.io/common/rpc/conn.go deleted file mode 100644 index 15214847e..000000000 --- a/vendor/storj.io/common/rpc/conn.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package rpc - -import ( - "crypto/tls" - - "storj.io/common/identity" - "storj.io/drpc" -) - -// Conn is a wrapper around a drpc client connection. -type Conn struct { - state tls.ConnectionState - drpc.Conn -} - -// Close closes the connection. -func (c *Conn) Close() error { return c.Conn.Close() } - -// ConnectionState returns the tls connection state. -func (c *Conn) ConnectionState() tls.ConnectionState { return c.state } - -// PeerIdentity returns the peer identity on the other end of the connection. -func (c *Conn) PeerIdentity() (*identity.PeerIdentity, error) { - return identity.PeerIdentityFromChain(c.state.PeerCertificates) -} - -// Raw returns the underlying connection. -func (c *Conn) Raw() drpc.Conn { - return c.Conn -} diff --git a/vendor/storj.io/common/rpc/dial.go b/vendor/storj.io/common/rpc/dial.go deleted file mode 100644 index 88542863b..000000000 --- a/vendor/storj.io/common/rpc/dial.go +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package rpc - -import ( - "context" - "crypto/tls" - "net" - "sync" - "time" - - "github.com/zeebo/errs" - - "storj.io/common/memory" - "storj.io/common/netutil" - "storj.io/common/peertls/tlsopts" - "storj.io/common/rpc/rpcpool" - "storj.io/common/rpc/rpctracing" - "storj.io/common/storj" - "storj.io/drpc" - "storj.io/drpc/drpcconn" - "storj.io/drpc/drpcmanager" - "storj.io/drpc/drpcstream" -) - -// NewDefaultManagerOptions returns the default options we use for drpc managers. -func NewDefaultManagerOptions() drpcmanager.Options { - return drpcmanager.Options{ - WriterBufferSize: 1024, - Stream: drpcstream.Options{ - SplitSize: (4096 * 2) - 256, - }, - } -} - -// Transport is a type that creates net.Conns, given an address. -// net.Dialer implements this interface and is used by default. -type Transport interface { - // DialContext is called to establish a connection. - DialContext(ctx context.Context, network, address string) (net.Conn, error) -} - -// Dialer holds configuration for dialing. -type Dialer struct { - // TLSOptions controls the tls options for dialing. If it is nil, only - // insecure connections can be made. - TLSOptions *tlsopts.Options - - // DialTimeout causes all the tcp dials to error if they take longer - // than it if it is non-zero. - DialTimeout time.Duration - - // DialLatency sleeps this amount if it is non-zero before every dial. - // The timeout runs while the sleep is happening. - DialLatency time.Duration - - // TransferRate limits all read/write operations to go slower than - // the size per second if it is non-zero. - TransferRate memory.Size - - // PoolOptions controls options for the connection pool. - PoolOptions rpcpool.Options - - // ConnectionOptions controls the options that we pass to drpc connections. - ConnectionOptions drpcconn.Options - - // TCPUserTimeout controls what setting to use for the TCP_USER_TIMEOUT - // socket option on dialed connections. Only valid on linux. Only set - // if positive. - TCPUserTimeout time.Duration - - // Transport is how sockets are opened. If nil, net.Dialer is used. - Transport Transport -} - -// NewDefaultDialer returns a Dialer with default timeouts set. -func NewDefaultDialer(tlsOptions *tlsopts.Options) Dialer { - return Dialer{ - TLSOptions: tlsOptions, - DialTimeout: 20 * time.Second, - TCPUserTimeout: 15 * time.Minute, - PoolOptions: rpcpool.Options{ - Capacity: 5, - IdleExpiration: 2 * time.Minute, - }, - ConnectionOptions: drpcconn.Options{ - Manager: NewDefaultManagerOptions(), - }, - } -} - -// dialContext does a raw tcp dial to the address and wraps the connection with the -// provided timeout. -func (d Dialer) dialContext(ctx context.Context, address string) (net.Conn, error) { - if d.DialLatency > 0 { - timer := time.NewTimer(d.DialLatency) - select { - case <-timer.C: - case <-ctx.Done(): - timer.Stop() - return nil, Error.Wrap(ctx.Err()) - } - } - - dialer := d.Transport - if dialer == nil { - dialer = new(net.Dialer) - } - - conn, err := dialer.DialContext(ctx, "tcp", address) - if err != nil { - // N.B. this error is not wrapped on purpose! grpc code cares about inspecting - // it and it's not smart enough to attempt to do any unwrapping. :( Additionally - // DialContext does not return an error that can be inspected easily to see if it - // came from the context being canceled. Thus, we do this racy thing where if the - // context is canceled at this point, we return it, rather than return the error - // from dialing. It's a slight lie, but arguably still correct because the cancel - // must be racing with the dial anyway. - select { - case <-ctx.Done(): - return nil, ctx.Err() - default: - return nil, err - } - } - - if tcpconn, ok := conn.(*net.TCPConn); d.TCPUserTimeout > 0 && ok { - if err := netutil.SetUserTimeout(tcpconn, d.TCPUserTimeout); err != nil { - return nil, errs.Combine(Error.Wrap(err), Error.Wrap(conn.Close())) - } - } - - return &timedConn{ - Conn: netutil.TrackClose(conn), - rate: d.TransferRate, - }, nil -} - -// DialNodeURL dials to the specified node url and asserts it has the given node id. -func (d Dialer) DialNodeURL(ctx context.Context, nodeURL storj.NodeURL) (_ *Conn, err error) { - defer mon.Task()(&ctx, "node: "+nodeURL.ID.String()[0:8])(&err) - - if d.TLSOptions == nil { - return nil, Error.New("tls options not set when required for this dial") - } - - return d.dial(ctx, nodeURL.Address, d.TLSOptions.ClientTLSConfig(nodeURL.ID)) -} - -// DialAddressInsecure dials to the specified address and does not check the node id. -func (d Dialer) DialAddressInsecure(ctx context.Context, address string) (_ *Conn, err error) { - defer mon.Task()(&ctx)(&err) - - if d.TLSOptions == nil { - return nil, Error.New("tls options not set when required for this dial") - } - - return d.dial(ctx, address, d.TLSOptions.UnverifiedClientTLSConfig()) -} - -// DialAddressUnencrypted dials to the specified address without tls. -func (d Dialer) DialAddressUnencrypted(ctx context.Context, address string) (_ *Conn, err error) { - defer mon.Task()(&ctx)(&err) - - return d.dialUnencrypted(ctx, address) -} - -// drpcHeader is the first bytes we send on a connection so that the remote -// knows to expect drpc on the wire instead of grpc. -const drpcHeader = "DRPC!!!1" - -// dial performs the dialing to the drpc endpoint with tls. -func (d Dialer) dial(ctx context.Context, address string, tlsConfig *tls.Config) (_ *Conn, err error) { - defer mon.Task()(&ctx)(&err) - - // include the timeout here so that it includes all aspects of the dial - if d.DialTimeout > 0 { - var cancel func() - ctx, cancel = context.WithTimeout(ctx, d.DialTimeout) - defer cancel() - } - - pool := rpcpool.New(d.PoolOptions, func(ctx context.Context) (drpc.Transport, error) { - return d.dialTransport(ctx, address, tlsConfig) - }) - - conn, err := d.dialTransport(ctx, address, tlsConfig) - if err != nil { - return nil, err - } - state := conn.ConnectionState() - - if err := pool.Put(drpcconn.New(conn)); err != nil { - return nil, err - } - - return &Conn{ - state: state, - Conn: rpctracing.NewTracingWrapper(pool), - }, nil -} - -// dialTransport performs dialing to the drpc endpoint with tls. -func (d Dialer) dialTransport(ctx context.Context, address string, tlsConfig *tls.Config) (_ *tlsConnWrapper, err error) { - defer mon.Task()(&ctx)(&err) - - // open the tcp socket to the address - rawConn, err := d.dialContext(ctx, address) - if err != nil { - return nil, Error.Wrap(err) - } - rawConn = newDrpcHeaderConn(rawConn) - - // perform the handshake racing with the context closing. we use a buffer - // of size 1 so that the handshake can proceed even if no one is reading. - errCh := make(chan error, 1) - conn := tls.Client(rawConn, tlsConfig) - go func() { errCh <- conn.Handshake() }() - - // see which wins and close the raw conn if there was any error. we can't - // close the tls connection concurrently with handshakes or it sometimes - // will panic. cool, huh? - select { - case <-ctx.Done(): - err = ctx.Err() - case err = <-errCh: - } - if err != nil { - _ = rawConn.Close() - return nil, Error.Wrap(err) - } - - return &tlsConnWrapper{ - Conn: conn, - underlying: rawConn, - }, nil -} - -// dialUnencrypted performs dialing to the drpc endpoint with no tls. -func (d Dialer) dialUnencrypted(ctx context.Context, address string) (_ *Conn, err error) { - defer mon.Task()(&ctx)(&err) - - // include the timeout here so that it includes all aspects of the dial - if d.DialTimeout > 0 { - var cancel func() - ctx, cancel = context.WithTimeout(ctx, d.DialTimeout) - defer cancel() - } - - conn := rpcpool.New(d.PoolOptions, func(ctx context.Context) (drpc.Transport, error) { - return d.dialTransportUnencrypted(ctx, address) - }) - return &Conn{ - Conn: rpctracing.NewTracingWrapper(conn), - }, nil -} - -// dialTransportUnencrypted performs dialing to the drpc endpoint with no tls. -func (d Dialer) dialTransportUnencrypted(ctx context.Context, address string) (_ net.Conn, err error) { - defer mon.Task()(&ctx)(&err) - - // open the tcp socket to the address - conn, err := d.dialContext(ctx, address) - if err != nil { - return nil, Error.Wrap(err) - } - - return newDrpcHeaderConn(conn), nil -} - -// tlsConnWrapper is a wrapper around a *tls.Conn that calls Close on the -// underlying connection when closed rather than trying to send a -// notification to the other side which may block forever. -type tlsConnWrapper struct { - *tls.Conn - underlying net.Conn -} - -// Close closes the underlying connection. -func (t *tlsConnWrapper) Close() error { return t.underlying.Close() } - -// drpcHeaderConn fulfills the net.Conn interface. On the first call to Write -// it will write the drpcHeader. -type drpcHeaderConn struct { - net.Conn - once sync.Once -} - -// newDrpcHeaderConn returns a new *drpcHeaderConn. -func newDrpcHeaderConn(conn net.Conn) *drpcHeaderConn { - return &drpcHeaderConn{ - Conn: conn, - } -} - -// Write will write buf to the underlying conn. If this is the first time Write -// is called it will prepend the drpcHeader to the beginning of the write. -func (d *drpcHeaderConn) Write(buf []byte) (n int, err error) { - var didOnce bool - d.once.Do(func() { - didOnce = true - header := []byte(drpcHeader) - n, err = d.Conn.Write(append(header, buf...)) - }) - if didOnce { - n -= len(drpcHeader) - if n < 0 { - n = 0 - } - return n, err - } - return d.Conn.Write(buf) -} diff --git a/vendor/storj.io/common/rpc/doc.go b/vendor/storj.io/common/rpc/doc.go deleted file mode 100644 index e824c5f98..000000000 --- a/vendor/storj.io/common/rpc/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpc implements dialing on Storj Network. -package rpc diff --git a/vendor/storj.io/common/rpc/known_ids.go b/vendor/storj.io/common/rpc/known_ids.go deleted file mode 100644 index 55c188c07..000000000 --- a/vendor/storj.io/common/rpc/known_ids.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package rpc - -import ( - "net" - - "storj.io/common/storj" -) - -var ( - knownNodeIDs = map[string]storj.NodeID{} -) - -func init() { - // !!!! NOTE !!!! - // - // These exist for backwards compatibility. - // - // Do not add more here, any new satellite MUST use node ID, - // Adding new satellites here will break forwards compatibility. - for _, nodeURL := range []string{ - "12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S@us-central-1.tardigrade.io:7777", - "12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S@mars.tardigrade.io:7777", - "121RTSDpyNZVcEU84Ticf2L1ntiuUimbWgfATz21tuvgk3vzoA6@asia-east-1.tardigrade.io:7777", - "121RTSDpyNZVcEU84Ticf2L1ntiuUimbWgfATz21tuvgk3vzoA6@saturn.tardigrade.io:7777", - "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs@europe-west-1.tardigrade.io:7777", - "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs@jupiter.tardigrade.io:7777", - "118UWpMCHzs6CvSgWd9BfFVjw5K9pZbJjkfZJexMtSkmKxvvAW@satellite.stefan-benten.de:7777", - "1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE@saltlake.tardigrade.io:7777", - } { - url, err := storj.ParseNodeURL(nodeURL) - if err != nil { - panic(err) - } - knownNodeIDs[url.Address] = url.ID - host, _, err := net.SplitHostPort(url.Address) - if err != nil { - panic(err) - } - knownNodeIDs[host] = url.ID - } -} - -// KnownNodeID looks for a well-known node id for a given address. -func KnownNodeID(address string) (id storj.NodeID, known bool) { - id, known = knownNodeIDs[address] - if !known { - host, _, err := net.SplitHostPort(address) - if err != nil { - return id, false - } - id, known = knownNodeIDs[host] - } - return id, known -} diff --git a/vendor/storj.io/common/rpc/lookup.go b/vendor/storj.io/common/rpc/lookup.go deleted file mode 100644 index f0170029b..000000000 --- a/vendor/storj.io/common/rpc/lookup.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package rpc - -import ( - "context" - "net" -) - -// LookupNodeAddress resolves a storage node address to the first IP address resolved. -// If an IP address is accidentally provided it is returned back. This function -// is used to resolve storage node IP addresses so that uplinks can use -// IP addresses directly without resolving many hosts. -func LookupNodeAddress(ctx context.Context, nodeAddress string) string { - host, port, err := net.SplitHostPort(nodeAddress) - if err != nil { - // If there was an error parsing out the port we just use a plain host. - host = nodeAddress - port = "" - } - - // We check if the address is an IP address to decide if we need to resolve it or not. - ip := net.ParseIP(host) - // nodeAddress is already an IP, so we can use that. - if ip != nil { - return nodeAddress - } - - // We have a hostname not an IP address so we should resolve the IP address - // to give back to the uplink client. - addresses, err := net.DefaultResolver.LookupHost(ctx, host) - if err != nil || len(addresses) == 0 { - // We ignore the error because if this fails for some reason we can just - // re-use the hostname, it just won't be as fast for the uplink to dial. - return nodeAddress - } - - // We return the first address found because some DNS servers already do - // round robin load balancing and we would be messing with their behaviour - // if we tried to get smart here. - first := addresses[0] - - if port == "" { - return first - } - return net.JoinHostPort(first, port) -} diff --git a/vendor/storj.io/common/rpc/rpcpeer/peer.go b/vendor/storj.io/common/rpc/rpcpeer/peer.go deleted file mode 100644 index 477cc83f5..000000000 --- a/vendor/storj.io/common/rpc/rpcpeer/peer.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpcpeer implements context.Context peer tagging. -package rpcpeer - -import ( - "context" - "crypto/tls" - "net" - - "github.com/zeebo/errs" - - "storj.io/drpc/drpcctx" -) - -// Error is the class of errors returned by this package. -var Error = errs.Class("rpcpeer") - -// Peer represents an rpc peer. -type Peer struct { - Addr net.Addr - State tls.ConnectionState -} - -// peerKey is used as a unique value for context keys. -type peerKey struct{} - -// NewContext returns a new context with the peer associated as a value. -func NewContext(ctx context.Context, peer *Peer) context.Context { - return context.WithValue(ctx, peerKey{}, peer) -} - -// FromContext returns the peer that was previously associated by NewContext. -func FromContext(ctx context.Context) (*Peer, error) { - if peer, ok := ctx.Value(peerKey{}).(*Peer); ok { - return peer, nil - } else if peer, drpcErr := drpcInternalFromContext(ctx); drpcErr == nil { - return peer, nil - } else { - return nil, drpcErr - } -} - -// drpcInternalFromContext returns a peer from the context using drpc. -func drpcInternalFromContext(ctx context.Context) (*Peer, error) { - tr, ok := drpcctx.Transport(ctx) - if !ok { - return nil, Error.New("unable to get drpc peer from context") - } - - conn, ok := tr.(interface { - RemoteAddr() net.Addr - ConnectionState() tls.ConnectionState - }) - if !ok { - return nil, Error.New("drpc transport does not have required methods") - } - - return &Peer{ - Addr: conn.RemoteAddr(), - State: conn.ConnectionState(), - }, nil -} diff --git a/vendor/storj.io/common/rpc/rpcpool/pool.go b/vendor/storj.io/common/rpc/rpcpool/pool.go deleted file mode 100644 index 9562086bf..000000000 --- a/vendor/storj.io/common/rpc/rpcpool/pool.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpcpool implements connection pooling for rpc. -package rpcpool - -import ( - "context" - "sync" - "time" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/drpc" - "storj.io/drpc/drpcconn" -) - -var mon = monkit.Package() - -// NOTE(jeff): conn expiration could remove the connection from the pool so -// that it doesn't take up a slot causing us to throw away a connection that -// we may want to keep. that adds quite a bit of complexity because channels -// do not support removing buffered elements, so it didn't seem worth it. - -// expiringConn wraps a connection. -type expiringConn struct { - conn *drpcconn.Conn - timer *time.Timer -} - -// newExpiringConn wraps the connection with a timer that will close it after the -// specified duration. If the duration is non-positive, no timer is set. -func newExpiringConn(conn *drpcconn.Conn, dur time.Duration) *expiringConn { - ex := &expiringConn{conn: conn} - if dur > 0 { - ex.timer = time.AfterFunc(dur, func() { _ = conn.Close() }) - } - return ex -} - -// Closed returns true if the connection is already closed. -func (ex *expiringConn) Closed() bool { - return ex.conn.Closed() -} - -// Cancel attempts to cancel the expiration timer and returns true if the -// timer will not close the connection. -func (ex *expiringConn) Cancel() bool { - return ex.timer == nil || ex.timer.Stop() -} - -// Options controls the options for a connection pool. -type Options struct { - // Capacity is how many connections to keep open. - Capacity int - - // IdleExpiration is how long a connection in the pool is allowed to be - // kept idle. If zero, connections do not expire. - IdleExpiration time.Duration -} - -// Error is the class of errors returned by this package. -var Error = errs.Class("rpcpool") - -// Dialer is the type of function to create a new connection. -type Dialer = func(context.Context) (drpc.Transport, error) - -// Conn implements drpc.Conn but keeps a pool of connections open. -type Conn struct { - opts Options - mu sync.Mutex - pool chan *expiringConn - done chan struct{} - dial Dialer -} - -var _ drpc.Conn = (*Conn)(nil) - -// New returns a new Conn that will keep cap connections open using the provided -// dialer when it needs new ones. -func New(opts Options, dial Dialer) *Conn { - return &Conn{ - opts: opts, - pool: make(chan *expiringConn, opts.Capacity), - done: make(chan struct{}), - dial: dial, - } -} - -// Close closes all of the pool's connections and ensures no new ones will be made. -func (c *Conn) Close() (err error) { - var pool chan *expiringConn - - // only one call will ever see a non-nil pool variable. additionally, anyone - // holding the mutex will either see a nil c.pool or a non-closed c.pool. - c.mu.Lock() - pool, c.pool = c.pool, nil - c.mu.Unlock() - - if pool != nil { - close(pool) - for ex := range pool { - if ex.Cancel() { - err = errs.Combine(err, ex.conn.Close()) - } - } - close(c.done) - } - - <-c.done - return err -} - -// Closed returns true if the connection is already closed. -func (c *Conn) Closed() bool { - select { - case <-c.done: - return true - default: - return false - } -} - -// newConn creates a new connection using the dialer. -func (c *Conn) newConn(ctx context.Context) (_ *drpcconn.Conn, err error) { - defer mon.Task()(&ctx)(&err) - - tr, err := c.dial(ctx) - if err != nil { - return nil, err - } - return drpcconn.New(tr), nil -} - -// getConn attempts to get a pooled connection or dials a new one if necessary. -func (c *Conn) getConn(ctx context.Context) (_ *drpcconn.Conn, err error) { - defer mon.Task()(&ctx)(&err) - - c.mu.Lock() - pool := c.pool - c.mu.Unlock() - - for { - select { - case ex, ok := <-pool: - if !ok { - return nil, Error.New("connection pool closed") - } - - // if the connection died in the pool, try again - if !ex.Cancel() || ex.conn.Closed() { - continue - } - - return ex.conn, nil - default: - return c.newConn(ctx) - } - } -} - -// Put places the connection back into the pool if there's room. It -// closes the connection if there is no room or the pool is closed. If the -// connection is closed, it does not attempt to place it into the pool. -func (c *Conn) Put(conn *drpcconn.Conn) error { - c.mu.Lock() - defer c.mu.Unlock() - - // if the connection is closed already, don't replace it. - if conn.Closed() { - return nil - } - - ex := newExpiringConn(conn, c.opts.IdleExpiration) - select { - case c.pool <- ex: - return nil - default: - if ex.Cancel() { - return conn.Close() - } - return nil - } -} - -// Transport returns nil because there is no well defined transport to use. -func (c *Conn) Transport() drpc.Transport { return nil } - -// Invoke implements drpc.Conn's Invoke method using a pooled connection. -func (c *Conn) Invoke(ctx context.Context, rpc string, in drpc.Message, out drpc.Message) (err error) { - defer mon.Task()(&ctx)(&err) - - conn, err := c.getConn(ctx) - if err != nil { - return err - } - err = conn.Invoke(ctx, rpc, in, out) - return errs.Combine(err, c.Put(conn)) -} - -// NewStream implements drpc.Conn's NewStream method using a pooled connection. It -// waits for the stream to be finished before replacing the connection into the pool. -func (c *Conn) NewStream(ctx context.Context, rpc string) (_ drpc.Stream, err error) { - defer mon.Task()(&ctx)(&err) - - conn, err := c.getConn(ctx) - if err != nil { - return nil, err - } - - stream, err := conn.NewStream(ctx, rpc) - if err != nil { - return nil, err - } - - // the stream's done channel is closed when we're sure no reads/writes are - // coming in for that stream anymore. it has been fully terminated. - go func() { - <-stream.Context().Done() - _ = c.Put(conn) - }() - - return stream, nil -} diff --git a/vendor/storj.io/common/rpc/rpcstatus/status.go b/vendor/storj.io/common/rpc/rpcstatus/status.go deleted file mode 100644 index a00b4cc22..000000000 --- a/vendor/storj.io/common/rpc/rpcstatus/status.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpcstatus contains status code definitions for rpc. -package rpcstatus - -import ( - "context" - "fmt" - - "github.com/zeebo/errs" - - "storj.io/drpc/drpcerr" -) - -// StatusCode is an enumeration of rpc status codes. -type StatusCode uint64 - -// These constants are all the rpc error codes. It is important that -// their numerical values do not change. -const ( - Unknown StatusCode = iota - OK - Canceled - InvalidArgument - DeadlineExceeded - NotFound - AlreadyExists - PermissionDenied - ResourceExhausted - FailedPrecondition - Aborted - OutOfRange - Unimplemented - Internal - Unavailable - DataLoss - Unauthenticated -) - -// Code returns the status code associated with the error. -func Code(err error) StatusCode { - // special case: if the error is context canceled or deadline exceeded, the code - // must be those. additionally, grpc returns OK for a nil error, so we will, too. - switch err { - case nil: - return OK - case context.Canceled: - return Canceled - case context.DeadlineExceeded: - return DeadlineExceeded - default: - if code := StatusCode(drpcerr.Code(err)); code != Unknown { - return code - } - - return Unknown - } -} - -// Wrap wraps the error with the provided status code. -func Wrap(code StatusCode, err error) error { - if err == nil { - return nil - } - - ce := &codeErr{ - code: code, - } - - if ee, ok := err.(errsError); ok { - ce.errsError = ee - } else { - ce.errsError = errs.Wrap(err).(errsError) - } - - return ce -} - -// Error wraps the message with a status code into an error. -func Error(code StatusCode, msg string) error { - return Wrap(code, errs.New("%s", msg)) -} - -// Errorf : Error :: fmt.Sprintf : fmt.Sprint. -func Errorf(code StatusCode, format string, a ...interface{}) error { - return Wrap(code, errs.New(format, a...)) -} - -type errsError interface { - error - fmt.Formatter - Name() (string, bool) -} - -// codeErr implements error that can work both in grpc and drpc. -type codeErr struct { - errsError - code StatusCode -} - -func (c *codeErr) Unwrap() error { return c.errsError } -func (c *codeErr) Cause() error { return c.errsError } - -func (c *codeErr) Code() uint64 { return uint64(c.code) } diff --git a/vendor/storj.io/common/rpc/rpctracing/common.go b/vendor/storj.io/common/rpc/rpctracing/common.go deleted file mode 100644 index d08179c6a..000000000 --- a/vendor/storj.io/common/rpc/rpctracing/common.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpctracing implements tracing for rpc. -package rpctracing - -import "github.com/spacemonkeygo/monkit/v3" - -const ( - // TraceID is the key we use to store trace id value into context. - TraceID = "trace-id" - // ParentID is the key we use to store parent's span id value into context. - ParentID = "parent-id" - // Sampled is the key we use to store sampled flag into context - Sampled = "sampled" -) - -var mon = monkit.Package() diff --git a/vendor/storj.io/common/rpc/rpctracing/handler.go b/vendor/storj.io/common/rpc/rpctracing/handler.go deleted file mode 100644 index abf4479b2..000000000 --- a/vendor/storj.io/common/rpc/rpctracing/handler.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpctracing implements tracing for rpc. -package rpctracing - -import ( - "context" - - "github.com/spacemonkeygo/monkit/v3" - - "storj.io/drpc" - "storj.io/drpc/drpcmetadata" - "storj.io/drpc/drpcmux" -) - -type streamWrapper struct { - drpc.Stream - ctx context.Context -} - -func (s *streamWrapper) Context() context.Context { return s.ctx } - -type handlerFunc func(metadata map[string]string) (trace *monkit.Trace, spanID int64) - -func defaultHandlerFunc(metadata map[string]string) (*monkit.Trace, int64) { - return monkit.NewTrace(monkit.NewId()), monkit.NewId() -} - -// Handler implements drpc handler interface and takes in a callback function. -type Handler struct { - mux *drpcmux.Mux - cb handlerFunc -} - -// NewHandler returns a new instance of Handler. -func NewHandler(mux *drpcmux.Mux, cb handlerFunc) *Handler { - if cb == nil { - cb = defaultHandlerFunc - } - return &Handler{ - mux: mux, - cb: cb, - } -} - -// HandleRPC adds tracing metadata onto server stream. -func (handler *Handler) HandleRPC(stream drpc.Stream, rpc string) (err error) { - streamCtx := stream.Context() - metadata, ok := drpcmetadata.Get(streamCtx) - if ok { - trace, spanID := handler.cb(metadata) - defer mon.FuncNamed(rpc).RemoteTrace(&streamCtx, spanID, trace)(&err) - } - - return handler.mux.HandleRPC(&streamWrapper{Stream: stream, ctx: streamCtx}, rpc) -} diff --git a/vendor/storj.io/common/rpc/rpctracing/tracing.go b/vendor/storj.io/common/rpc/rpctracing/tracing.go deleted file mode 100644 index 33b067bca..000000000 --- a/vendor/storj.io/common/rpc/rpctracing/tracing.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package rpctracing implements tracing for rpc. -package rpctracing - -import ( - "context" - "strconv" - - "github.com/spacemonkeygo/monkit/v3" - - "storj.io/drpc" - "storj.io/drpc/drpcmetadata" -) - -// TracingWrapper wraps a drpc.Conn with tracing information. -type TracingWrapper struct { - drpc.Conn -} - -// NewTracingWrapper creates a new instance of the wrapper. -func NewTracingWrapper(conn drpc.Conn) *TracingWrapper { - return &TracingWrapper{ - conn, - } -} - -// Invoke implements drpc.Conn's Invoke method with tracing information injected into the context. -func (c *TracingWrapper) Invoke(ctx context.Context, rpc string, in drpc.Message, out drpc.Message) (err error) { - return c.Conn.Invoke(c.trace(ctx), rpc, in, out) -} - -// NewStream implements drpc.Conn's NewStream method with tracing information injected into the context. -func (c *TracingWrapper) NewStream(ctx context.Context, rpc string) (_ drpc.Stream, err error) { - return c.Conn.NewStream(c.trace(ctx), rpc) -} - -// trace injects tracing related information into the context. -func (c *TracingWrapper) trace(ctx context.Context) context.Context { - span := monkit.SpanFromCtx(ctx) - if span == nil || span.Parent() == nil { - return ctx - } - - sampled, exist := span.Trace().Get(Sampled).(bool) - if !exist || !sampled { - return ctx - } - - data := map[string]string{ - TraceID: strconv.FormatInt(span.Trace().Id(), 10), - ParentID: strconv.FormatInt(span.Id(), 10), - Sampled: strconv.FormatBool(sampled), - } - - return drpcmetadata.AddPairs(ctx, data) -} diff --git a/vendor/storj.io/common/signing/doc.go b/vendor/storj.io/common/signing/doc.go deleted file mode 100644 index a3d8f97f0..000000000 --- a/vendor/storj.io/common/signing/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package signing implements consistent signing and verifying protobuf messages. -package signing diff --git a/vendor/storj.io/common/signing/encode.go b/vendor/storj.io/common/signing/encode.go deleted file mode 100644 index 6b98af628..000000000 --- a/vendor/storj.io/common/signing/encode.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package signing - -import ( - "context" - - "storj.io/common/pb" -) - -// EncodeOrderLimit encodes order limit into bytes for signing. Removes signature from serialized limit. -func EncodeOrderLimit(ctx context.Context, limit *pb.OrderLimit) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - - // protobuf has problems with serializing types with nullable=false - // this uses a different message for signing, such that the rest of the code - // doesn't have to deal with pointers for those particular fields. - - signing := pb.OrderLimitSigning{} - signing.SerialNumber = limit.SerialNumber - signing.SatelliteId = limit.SatelliteId - if limit.DeprecatedUplinkId != nil && !limit.DeprecatedUplinkId.IsZero() { - signing.DeprecatedUplinkId = limit.DeprecatedUplinkId - } - if !limit.UplinkPublicKey.IsZero() { - signing.UplinkPublicKey = &limit.UplinkPublicKey - } - signing.StorageNodeId = limit.StorageNodeId - signing.PieceId = limit.PieceId - signing.Limit = limit.Limit - signing.Action = limit.Action - if !limit.PieceExpiration.IsZero() { - signing.PieceExpiration = &limit.PieceExpiration - } - if !limit.OrderExpiration.IsZero() { - signing.OrderExpiration = &limit.OrderExpiration - } - if !limit.OrderCreation.IsZero() { - signing.OrderCreation = &limit.OrderCreation - } - signing.SatelliteAddress = limit.SatelliteAddress - - return pb.Marshal(&signing) -} - -// EncodeOrder encodes order into bytes for signing. Removes signature from serialized order. -func EncodeOrder(ctx context.Context, order *pb.Order) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - - // protobuf has problems with serializing types with nullable=false - // this uses a different message for signing, such that the rest of the code - // doesn't have to deal with pointers for those particular fields. - - signing := pb.OrderSigning{} - signing.SerialNumber = order.SerialNumber - signing.Amount = order.Amount - - return pb.Marshal(&signing) -} - -// EncodePieceHash encodes piece hash into bytes for signing. Removes signature from serialized hash. -func EncodePieceHash(ctx context.Context, hash *pb.PieceHash) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - - // protobuf has problems with serializing types with nullable=false - // this uses a different message for signing, such that the rest of the code - // doesn't have to deal with pointers for those particular fields. - - signing := pb.PieceHashSigning{} - signing.PieceId = hash.PieceId - signing.Hash = hash.Hash - signing.PieceSize = hash.PieceSize - if !hash.Timestamp.IsZero() { - signing.Timestamp = &hash.Timestamp - } - return pb.Marshal(&signing) -} - -// EncodeStreamID encodes stream ID into bytes for signing. -func EncodeStreamID(ctx context.Context, streamID *pb.SatStreamID) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - signature := streamID.SatelliteSignature - streamID.SatelliteSignature = nil - out, err := pb.Marshal(streamID) - streamID.SatelliteSignature = signature - return out, err -} - -// EncodeSegmentID encodes segment ID into bytes for signing. -func EncodeSegmentID(ctx context.Context, segmentID *pb.SatSegmentID) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - signature := segmentID.SatelliteSignature - segmentID.SatelliteSignature = nil - out, err := pb.Marshal(segmentID) - segmentID.SatelliteSignature = signature - return out, err -} - -// EncodeExitCompleted encodes ExitCompleted into bytes for signing. -func EncodeExitCompleted(ctx context.Context, exitCompleted *pb.ExitCompleted) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - signature := exitCompleted.ExitCompleteSignature - exitCompleted.ExitCompleteSignature = nil - out, err := pb.Marshal(exitCompleted) - exitCompleted.ExitCompleteSignature = signature - - return out, err -} - -// EncodeExitFailed encodes ExitFailed into bytes for signing. -func EncodeExitFailed(ctx context.Context, exitFailed *pb.ExitFailed) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - signature := exitFailed.ExitFailureSignature - exitFailed.ExitFailureSignature = nil - out, err := pb.Marshal(exitFailed) - exitFailed.ExitFailureSignature = signature - - return out, err -} diff --git a/vendor/storj.io/common/signing/peers.go b/vendor/storj.io/common/signing/peers.go deleted file mode 100644 index e723c7a2c..000000000 --- a/vendor/storj.io/common/signing/peers.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package signing - -import ( - "context" - "crypto" - - "github.com/spacemonkeygo/monkit/v3" - - "storj.io/common/identity" - "storj.io/common/pkcrypto" - "storj.io/common/storj" -) - -var mon = monkit.Package() - -// PrivateKey implements a signer and signee using a crypto.PrivateKey. -type PrivateKey struct { - Self storj.NodeID - Key crypto.PrivateKey -} - -// SignerFromFullIdentity returns signer based on full identity. -func SignerFromFullIdentity(identity *identity.FullIdentity) Signer { - return &PrivateKey{ - Self: identity.ID, - Key: identity.Key, - } -} - -// ID returns node id associated with PrivateKey. -func (private *PrivateKey) ID() storj.NodeID { return private.Self } - -// HashAndSign hashes the data and signs with the used key. -func (private *PrivateKey) HashAndSign(ctx context.Context, data []byte) (_ []byte, err error) { - defer mon.Task()(&ctx)(&err) - return pkcrypto.HashAndSign(private.Key, data) -} - -// HashAndVerifySignature hashes the data and verifies that the signature belongs to the PrivateKey. -func (private *PrivateKey) HashAndVerifySignature(ctx context.Context, data, signature []byte) (err error) { - defer mon.Task()(&ctx)(&err) - pub, err := pkcrypto.PublicKeyFromPrivate(private.Key) - if err != nil { - return err - } - - return pkcrypto.HashAndVerifySignature(pub, data, signature) -} - -// PublicKey implements a signee using crypto.PublicKey. -type PublicKey struct { - Self storj.NodeID - Key crypto.PublicKey -} - -// SigneeFromPeerIdentity returns signee based on peer identity. -func SigneeFromPeerIdentity(identity *identity.PeerIdentity) Signee { - return &PublicKey{ - Self: identity.ID, - Key: identity.Leaf.PublicKey, - } -} - -// ID returns node id associated with this PublicKey. -func (public *PublicKey) ID() storj.NodeID { return public.Self } - -// HashAndVerifySignature hashes the data and verifies that the signature belongs to the PublicKey. -func (public *PublicKey) HashAndVerifySignature(ctx context.Context, data, signature []byte) (err error) { - defer mon.Task()(&ctx)(&err) - return pkcrypto.HashAndVerifySignature(public.Key, data, signature) -} diff --git a/vendor/storj.io/common/signing/sign.go b/vendor/storj.io/common/signing/sign.go deleted file mode 100644 index bf664bd8e..000000000 --- a/vendor/storj.io/common/signing/sign.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package signing - -import ( - "context" - - "github.com/zeebo/errs" - - "storj.io/common/pb" - "storj.io/common/storj" -) - -// Error is the default error class for signing package. -var Error = errs.Class("signing") - -// Signer is able to sign data and verify own signature belongs. -type Signer interface { - ID() storj.NodeID - HashAndSign(ctx context.Context, data []byte) ([]byte, error) - HashAndVerifySignature(ctx context.Context, data, signature []byte) error -} - -// SignOrderLimit signs the order limit using the specified signer. -// Signer is a satellite. -func SignOrderLimit(ctx context.Context, satellite Signer, unsigned *pb.OrderLimit) (_ *pb.OrderLimit, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeOrderLimit(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.SatelliteSignature, err = satellite.HashAndSign(ctx, bytes) - if err != nil { - return nil, Error.Wrap(err) - } - - return &signed, nil -} - -// SignUplinkOrder signs the order using the specified signer. -// Signer is an uplink. -func SignUplinkOrder(ctx context.Context, privateKey storj.PiecePrivateKey, unsigned *pb.Order) (_ *pb.Order, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeOrder(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.UplinkSignature, err = privateKey.Sign(bytes) - if err != nil { - return nil, Error.Wrap(err) - } - return &signed, nil -} - -// SignPieceHash signs the piece hash using the specified signer. -// Signer is either uplink or storage node. -func SignPieceHash(ctx context.Context, signer Signer, unsigned *pb.PieceHash) (_ *pb.PieceHash, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodePieceHash(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.Signature, err = signer.HashAndSign(ctx, bytes) - if err != nil { - return nil, Error.Wrap(err) - } - - return &signed, nil -} - -// SignUplinkPieceHash signs the piece hash using the specified signer. -// Signer is either uplink or storage node. -func SignUplinkPieceHash(ctx context.Context, privateKey storj.PiecePrivateKey, unsigned *pb.PieceHash) (_ *pb.PieceHash, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodePieceHash(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.Signature, err = privateKey.Sign(bytes) - if err != nil { - return nil, Error.Wrap(err) - } - return &signed, nil -} - -// SignStreamID signs the stream ID using the specified signer. -// Signer is a satellite. -func SignStreamID(ctx context.Context, signer Signer, unsigned *pb.SatStreamID) (_ *pb.SatStreamID, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeStreamID(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.SatelliteSignature, err = signer.HashAndSign(ctx, bytes) - if err != nil { - return nil, Error.Wrap(err) - } - - return &signed, nil -} - -// SignSegmentID signs the segment ID using the specified signer. -// Signer is a satellite. -func SignSegmentID(ctx context.Context, signer Signer, unsigned *pb.SatSegmentID) (_ *pb.SatSegmentID, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeSegmentID(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.SatelliteSignature, err = signer.HashAndSign(ctx, bytes) - if err != nil { - return nil, Error.Wrap(err) - } - - return &signed, nil -} - -// SignExitCompleted signs the ExitCompleted using the specified signer. -// Signer is a satellite. -func SignExitCompleted(ctx context.Context, signer Signer, unsigned *pb.ExitCompleted) (_ *pb.ExitCompleted, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeExitCompleted(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.ExitCompleteSignature, err = signer.HashAndSign(ctx, bytes) - if err != nil { - return nil, Error.Wrap(err) - } - - return &signed, nil -} - -// SignExitFailed signs the ExitFailed using the specified signer. -// Signer is a satellite. -func SignExitFailed(ctx context.Context, signer Signer, unsigned *pb.ExitFailed) (_ *pb.ExitFailed, err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeExitFailed(ctx, unsigned) - if err != nil { - return nil, Error.Wrap(err) - } - - signed := *unsigned - signed.ExitFailureSignature, err = signer.HashAndSign(ctx, bytes) - if err != nil { - return nil, Error.Wrap(err) - } - - return &signed, nil -} diff --git a/vendor/storj.io/common/signing/verify.go b/vendor/storj.io/common/signing/verify.go deleted file mode 100644 index a1ef224be..000000000 --- a/vendor/storj.io/common/signing/verify.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package signing - -import ( - "context" - - "storj.io/common/pb" - "storj.io/common/storj" -) - -// Signee is able to verify that the data signature belongs to the signee. -type Signee interface { - ID() storj.NodeID - HashAndVerifySignature(ctx context.Context, data, signature []byte) error -} - -// VerifyOrderLimitSignature verifies that the signature inside order limit is valid and belongs to the satellite. -func VerifyOrderLimitSignature(ctx context.Context, satellite Signee, signed *pb.OrderLimit) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeOrderLimit(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return satellite.HashAndVerifySignature(ctx, bytes, signed.SatelliteSignature) -} - -// VerifyOrderSignature verifies that the signature inside order is valid and belongs to the uplink. -func VerifyOrderSignature(ctx context.Context, uplink Signee, signed *pb.Order) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeOrder(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return uplink.HashAndVerifySignature(ctx, bytes, signed.UplinkSignature) -} - -// VerifyUplinkOrderSignature verifies that the signature inside order is valid and belongs to the uplink. -func VerifyUplinkOrderSignature(ctx context.Context, publicKey storj.PiecePublicKey, signed *pb.Order) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeOrder(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return Error.Wrap(publicKey.Verify(bytes, signed.UplinkSignature)) -} - -// VerifyPieceHashSignature verifies that the signature inside piece hash is valid and belongs to the signer, which is either uplink or storage node. -func VerifyPieceHashSignature(ctx context.Context, signee Signee, signed *pb.PieceHash) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodePieceHash(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return signee.HashAndVerifySignature(ctx, bytes, signed.Signature) -} - -// VerifyUplinkPieceHashSignature verifies that the signature inside piece hash is valid and belongs to the signer, which is either uplink or storage node. -func VerifyUplinkPieceHashSignature(ctx context.Context, publicKey storj.PiecePublicKey, signed *pb.PieceHash) (err error) { - defer mon.Task()(&ctx)(&err) - - bytes, err := EncodePieceHash(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return Error.Wrap(publicKey.Verify(bytes, signed.Signature)) -} - -// VerifyStreamID verifies that the signature inside stream ID belongs to the satellite. -func VerifyStreamID(ctx context.Context, satellite Signee, signed *pb.SatStreamID) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeStreamID(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return satellite.HashAndVerifySignature(ctx, bytes, signed.SatelliteSignature) -} - -// VerifySegmentID verifies that the signature inside segment ID belongs to the satellite. -func VerifySegmentID(ctx context.Context, satellite Signee, signed *pb.SatSegmentID) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeSegmentID(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return satellite.HashAndVerifySignature(ctx, bytes, signed.SatelliteSignature) -} - -// VerifyExitCompleted verifies that the signature inside ExitCompleted belongs to the satellite. -func VerifyExitCompleted(ctx context.Context, satellite Signee, signed *pb.ExitCompleted) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeExitCompleted(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return Error.Wrap(satellite.HashAndVerifySignature(ctx, bytes, signed.ExitCompleteSignature)) -} - -// VerifyExitFailed verifies that the signature inside ExitFailed belongs to the satellite. -func VerifyExitFailed(ctx context.Context, satellite Signee, signed *pb.ExitFailed) (err error) { - defer mon.Task()(&ctx)(&err) - bytes, err := EncodeExitFailed(ctx, signed) - if err != nil { - return Error.Wrap(err) - } - - return Error.Wrap(satellite.HashAndVerifySignature(ctx, bytes, signed.ExitFailureSignature)) -} diff --git a/vendor/storj.io/common/storj/bucket.go b/vendor/storj.io/common/storj/bucket.go deleted file mode 100644 index fc4ddfca6..000000000 --- a/vendor/storj.io/common/storj/bucket.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "time" - - "github.com/zeebo/errs" - - "storj.io/common/uuid" -) - -var ( - // ErrBucket is an error class for general bucket errors. - ErrBucket = errs.Class("bucket") - - // ErrNoBucket is an error class for using empty bucket name. - ErrNoBucket = errs.Class("no bucket specified") - - // ErrBucketNotFound is an error class for non-existing bucket. - ErrBucketNotFound = errs.Class("bucket not found") -) - -// Bucket contains information about a specific bucket. -type Bucket struct { - ID uuid.UUID - Name string - ProjectID uuid.UUID - PartnerID uuid.UUID - Created time.Time - PathCipher CipherSuite - DefaultSegmentsSize int64 - DefaultRedundancyScheme RedundancyScheme - DefaultEncryptionParameters EncryptionParameters -} diff --git a/vendor/storj.io/common/storj/doc.go b/vendor/storj.io/common/storj/doc.go deleted file mode 100644 index 17c20655b..000000000 --- a/vendor/storj.io/common/storj/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package storj contains the types which represent the main entities of the Storj domain. -package storj diff --git a/vendor/storj.io/common/storj/encryption.go b/vendor/storj.io/common/storj/encryption.go deleted file mode 100644 index 1f521d640..000000000 --- a/vendor/storj.io/common/storj/encryption.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "encoding/base32" - - "github.com/zeebo/errs" -) - -// EncryptionParameters is the cipher suite and parameters used for encryption. -type EncryptionParameters struct { - // CipherSuite specifies the cipher suite to be used for encryption. - CipherSuite CipherSuite - // BlockSize determines the unit size at which encryption is performed. - // It is important to distinguish this from the block size used by the - // cipher suite (probably 128 bits). There is some small overhead for - // each encryption unit, so BlockSize should not be too small, but - // smaller sizes yield shorter first-byte latency and better seek times. - // Note that BlockSize itself is the size of data blocks _after_ they - // have been encrypted and the authentication overhead has been added. - // It is _not_ the size of the data blocks to _be_ encrypted. - BlockSize int32 -} - -// IsZero returns true if no field in the struct is set to non-zero value. -func (params EncryptionParameters) IsZero() bool { - return params == (EncryptionParameters{}) -} - -// CipherSuite specifies one of the encryption suites supported by Storj -// libraries for encryption of in-network data. -type CipherSuite byte - -const ( - // EncUnspecified indicates no encryption suite has been selected. - EncUnspecified = CipherSuite(iota) - // EncNull indicates use of the NULL cipher; that is, no encryption is - // done. The ciphertext is equal to the plaintext. - EncNull - // EncAESGCM indicates use of AES128-GCM encryption. - EncAESGCM - // EncSecretBox indicates use of XSalsa20-Poly1305 encryption, as provided - // by the NaCl cryptography library under the name "Secretbox". - EncSecretBox - // EncNullBase64URL is like EncNull but Base64 encodes/decodes the - // binary path data (URL-safe). - EncNullBase64URL -) - -// Constant definitions for key and nonce sizes. -const ( - KeySize = 32 - NonceSize = 24 -) - -// NewKey creates a new Storj key from humanReadableKey. -func NewKey(humanReadableKey []byte) (*Key, error) { - var key Key - - // Because of backward compatibility the key is filled with 0 or truncated if - // humanReadableKey isn't of the same size that KeySize. - // See https://github.com/storj/storj/pull/1967#discussion_r285544849 - copy(key[:], humanReadableKey) - return &key, nil -} - -// Key represents the largest key used by any encryption protocol. -type Key [KeySize]byte - -// Raw returns the key as a raw byte array pointer. -func (key *Key) Raw() *[KeySize]byte { - return (*[KeySize]byte)(key) -} - -// IsZero returns true if key is nil or it points to its zero value. -func (key *Key) IsZero() bool { - return key == nil || *key == (Key{}) -} - -// ErrNonce is used when something goes wrong with a stream ID. -var ErrNonce = errs.Class("nonce error") - -// nonceEncoding is base32 without padding. -var nonceEncoding = base32.StdEncoding.WithPadding(base32.NoPadding) - -// Nonce represents the largest nonce used by any encryption protocol. -type Nonce [NonceSize]byte - -// NonceFromString decodes an base32 encoded. -func NonceFromString(s string) (Nonce, error) { - nonceBytes, err := nonceEncoding.DecodeString(s) - if err != nil { - return Nonce{}, ErrNonce.Wrap(err) - } - return NonceFromBytes(nonceBytes) -} - -// NonceFromBytes converts a byte slice into a nonce. -func NonceFromBytes(b []byte) (Nonce, error) { - if len(b) != len(Nonce{}) { - return Nonce{}, ErrNonce.New("not enough bytes to make a nonce; have %d, need %d", len(b), len(NodeID{})) - } - - var nonce Nonce - copy(nonce[:], b) - return nonce, nil -} - -// IsZero returns whether nonce is unassigned. -func (nonce Nonce) IsZero() bool { - return nonce == Nonce{} -} - -// String representation of the nonce. -func (nonce Nonce) String() string { return nonceEncoding.EncodeToString(nonce.Bytes()) } - -// Bytes returns bytes of the nonce. -func (nonce Nonce) Bytes() []byte { return nonce[:] } - -// Raw returns the nonce as a raw byte array pointer. -func (nonce *Nonce) Raw() *[NonceSize]byte { - return (*[NonceSize]byte)(nonce) -} - -// Marshal serializes a nonce. -func (nonce Nonce) Marshal() ([]byte, error) { - return nonce.Bytes(), nil -} - -// MarshalTo serializes a nonce into the passed byte slice. -func (nonce *Nonce) MarshalTo(data []byte) (n int, err error) { - n = copy(data, nonce.Bytes()) - return n, nil -} - -// Unmarshal deserializes a nonce. -func (nonce *Nonce) Unmarshal(data []byte) error { - var err error - *nonce, err = NonceFromBytes(data) - return err -} - -// Size returns the length of a nonce (implements gogo's custom type interface). -func (nonce Nonce) Size() int { - return len(nonce) -} - -// MarshalJSON serializes a nonce to a json string as bytes. -func (nonce Nonce) MarshalJSON() ([]byte, error) { - return []byte(`"` + nonce.String() + `"`), nil -} - -// UnmarshalJSON deserializes a json string (as bytes) to a nonce. -func (nonce *Nonce) UnmarshalJSON(data []byte) error { - var err error - *nonce, err = NonceFromString(string(data)) - return err -} - -// EncryptedPrivateKey is a private key that has been encrypted. -type EncryptedPrivateKey []byte diff --git a/vendor/storj.io/common/storj/identity_version.go b/vendor/storj.io/common/storj/identity_version.go deleted file mode 100644 index 1fe28316c..000000000 --- a/vendor/storj.io/common/storj/identity_version.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "crypto" - "crypto/x509" - "crypto/x509/pkix" - "strconv" - "strings" - - "storj.io/common/peertls/extensions" - "storj.io/common/pkcrypto" -) - -const ( - // V0 represents identity version 0 - // NB: identities created before identity versioning (i.e. which don't have a - // version extension; "legacy") will be recognized as V0. - V0 = IDVersionNumber(iota) -) - -var ( - // IDVersions is a map of all identity versions - IDVersions = map[IDVersionNumber]IDVersion{ - V0: { - Number: V0, - NewPrivateKey: pkcrypto.GeneratePrivateKey, - }, - } - - // IDVersionHandler compares the identity version of the remote peers - // certificate chain to the extension options passed to the factory. - IDVersionHandler = extensions.NewHandlerFactory( - &extensions.IdentityVersionExtID, idVersionHandler, - ) -) - -// IDVersionNumber is the number of an identity version. -type IDVersionNumber uint8 - -// IDVersion holds fields that are used to distinguish different identity -// versions from one another; used in identity generation. -type IDVersion struct { - Number IDVersionNumber - NewPrivateKey func() (crypto.PrivateKey, error) -} - -func init() { - extensions.DefaultHandlers.Register(IDVersionHandler) -} - -// GetIDVersion looks up the given version number in the map of registered -// versions, returning an error if none is found. -func GetIDVersion(number IDVersionNumber) (IDVersion, error) { - version, ok := IDVersions[number] - if !ok { - return IDVersion{}, ErrVersion.New("unknown version") - } - - return version, nil -} - -// LatestIDVersion returns the last IDVersion registered. -func LatestIDVersion() IDVersion { - return IDVersions[IDVersionNumber(len(IDVersions)-1)] -} - -// IDVersionFromCert parsed the IDVersion from the passed certificate's IDVersion extension. -func IDVersionFromCert(cert *x509.Certificate) (IDVersion, error) { - for _, ext := range cert.Extensions { - if extensions.IdentityVersionExtID.Equal(ext.Id) { - return GetIDVersion(IDVersionNumber(ext.Value[0])) - } - } - - // NB: for backward-compatibility with V0 certificate generation, V0 is used - // when no version extension exists. - // TODO(beta maybe?): Error here instead; we should drop support for - // certificates without a version extension. - // - // return IDVersion{}, ErrVersion.New("certificate doesn't contain an identity version extension") - return IDVersions[V0], nil -} - -// IDVersionInVersions returns an error if the given version is in the given string of version(s)/range(s). -func IDVersionInVersions(versionNumber IDVersionNumber, versionsStr string) error { - switch versionsStr { - case "": - return ErrVersion.New("no allowed peer identity versions specified") - case "*": - return nil - case "latest": - if versionNumber == LatestIDVersion().Number { - return nil - } - default: - versionRanges := strings.Split(versionsStr, ",") - for _, versionRange := range versionRanges { - if strings.Contains(versionRange, "-") { - versionLimits := strings.Split(versionRange, "-") - if len(versionLimits) != 2 { - return ErrVersion.New("malformed PeerIDVersions string: %s", versionsStr) - } - - begin, err := strconv.Atoi(versionLimits[0]) - if err != nil { - return ErrVersion.Wrap(err) - } - - end, err := strconv.Atoi(versionLimits[1]) - if err != nil { - return ErrVersion.Wrap(err) - } - - for i := begin; i <= end; i++ { - if versionNumber == IDVersionNumber(i) { - return nil - } - } - } else { - versionInt, err := strconv.Atoi(versionRange) - if err != nil { - return ErrVersion.Wrap(err) - } - if versionNumber == IDVersionNumber(versionInt) { - return nil - } - } - } - } - return ErrVersion.New("version %d not in versions %s", versionNumber, versionsStr) -} - -func idVersionHandler(opts *extensions.Options) extensions.HandlerFunc { - return func(ext pkix.Extension, chain [][]*x509.Certificate) error { - return IDVersionInVersions(IDVersionNumber(ext.Value[0]), opts.PeerIDVersions) - } -} diff --git a/vendor/storj.io/common/storj/metainfo.go b/vendor/storj.io/common/storj/metainfo.go deleted file mode 100644 index 00190dd3b..000000000 --- a/vendor/storj.io/common/storj/metainfo.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -// ListDirection specifies listing direction. -type ListDirection int8 - -const ( - // Before lists backwards from cursor, without cursor [NOT SUPPORTED]. - Before = ListDirection(-2) - // Backward lists backwards from cursor, including cursor [NOT SUPPORTED]. - Backward = ListDirection(-1) - // Forward lists forwards from cursor, including cursor. - Forward = ListDirection(1) - // After lists forwards from cursor, without cursor. - After = ListDirection(2) -) - -// ListOptions lists objects. -type ListOptions struct { - Prefix Path - Cursor Path // Cursor is relative to Prefix, full path is Prefix + Cursor - Delimiter rune - Recursive bool - Direction ListDirection - Limit int -} - -// ObjectList is a list of objects. -type ObjectList struct { - Bucket string - Prefix Path - More bool - - // Items paths are relative to Prefix - // To get the full path use list.Prefix + list.Items[0].Path - Items []Object -} - -// NextPage returns options for listing the next page. -func (opts ListOptions) NextPage(list ObjectList) ListOptions { - if !list.More || len(list.Items) == 0 { - return ListOptions{} - } - - return ListOptions{ - Prefix: opts.Prefix, - Cursor: list.Items[len(list.Items)-1].Path, - Delimiter: opts.Delimiter, - Recursive: opts.Recursive, - Direction: After, - Limit: opts.Limit, - } -} - -// BucketListOptions lists objects. -type BucketListOptions struct { - Cursor string - Direction ListDirection - Limit int -} - -// BucketList is a list of buckets. -type BucketList struct { - More bool - Items []Bucket -} - -// NextPage returns options for listing the next page. -func (opts BucketListOptions) NextPage(list BucketList) BucketListOptions { - if !list.More || len(list.Items) == 0 { - return BucketListOptions{} - } - - return BucketListOptions{ - Cursor: list.Items[len(list.Items)-1].Name, - Direction: After, - Limit: opts.Limit, - } -} diff --git a/vendor/storj.io/common/storj/node.go b/vendor/storj.io/common/storj/node.go deleted file mode 100644 index d0efc587b..000000000 --- a/vendor/storj.io/common/storj/node.go +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "crypto/sha256" - "crypto/x509/pkix" - "database/sql/driver" - "encoding/json" - "math/bits" - - "github.com/btcsuite/btcutil/base58" - "github.com/zeebo/errs" - - "storj.io/common/peertls/extensions" -) - -var ( - // ErrNodeID is used when something goes wrong with a node id. - ErrNodeID = errs.Class("node ID error") - // ErrVersion is used for identity version related errors. - ErrVersion = errs.Class("node ID version error") -) - -// NodeIDSize is the byte length of a NodeID. -const NodeIDSize = sha256.Size - -// NodeID is a unique node identifier. -type NodeID [NodeIDSize]byte - -// NodeIDList is a slice of NodeIDs (implements sort). -type NodeIDList []NodeID - -// NewVersionedID adds an identity version to a node ID. -func NewVersionedID(id NodeID, version IDVersion) NodeID { - var versionedID NodeID - copy(versionedID[:], id[:]) - - versionedID[NodeIDSize-1] = byte(version.Number) - return versionedID -} - -// NewVersionExt creates a new identity version certificate extension for the -// given identity version. -func NewVersionExt(version IDVersion) pkix.Extension { - return pkix.Extension{ - Id: extensions.IdentityVersionExtID, - Value: []byte{byte(version.Number)}, - } -} - -// NodeIDFromString decodes a base58check encoded node id string. -func NodeIDFromString(s string) (NodeID, error) { - idBytes, versionNumber, err := base58.CheckDecode(s) - if err != nil { - return NodeID{}, ErrNodeID.Wrap(err) - } - unversionedID, err := NodeIDFromBytes(idBytes) - if err != nil { - return NodeID{}, err - } - - version := IDVersions[IDVersionNumber(versionNumber)] - return NewVersionedID(unversionedID, version), nil -} - -// NodeIDsFromBytes converts a 2d byte slice into a list of nodes. -func NodeIDsFromBytes(b [][]byte) (ids NodeIDList, err error) { - var idErrs []error - for _, idBytes := range b { - id, err := NodeIDFromBytes(idBytes) - if err != nil { - idErrs = append(idErrs, err) - continue - } - - ids = append(ids, id) - } - - if err = errs.Combine(idErrs...); err != nil { - return nil, err - } - return ids, nil -} - -// NodeIDFromBytes converts a byte slice into a node id. -func NodeIDFromBytes(b []byte) (NodeID, error) { - bLen := len(b) - if bLen != len(NodeID{}) { - return NodeID{}, ErrNodeID.New("not enough bytes to make a node id; have %d, need %d", bLen, len(NodeID{})) - } - - var id NodeID - copy(id[:], b) - return id, nil -} - -// String returns NodeID as base58 encoded string with checksum and version bytes. -func (id NodeID) String() string { - unversionedID := id.unversioned() - return base58.CheckEncode(unversionedID[:], byte(id.Version().Number)) -} - -// IsZero returns whether NodeID is unassigned. -func (id NodeID) IsZero() bool { - return id == NodeID{} -} - -// Bytes returns raw bytes of the id. -func (id NodeID) Bytes() []byte { return id[:] } - -// Less returns whether id is smaller than other in lexicographic order. -func (id NodeID) Less(other NodeID) bool { - for k, v := range id { - if v < other[k] { - return true - } else if v > other[k] { - return false - } - } - return false -} - -// Version returns the version of the identity format. -func (id NodeID) Version() IDVersion { - versionNumber := id.versionByte() - if versionNumber == 0 { - return IDVersions[V0] - } - - version, err := GetIDVersion(IDVersionNumber(versionNumber)) - // NB: when in doubt, use V0 - if err != nil { - return IDVersions[V0] - } - - return version -} - -// Difficulty returns the number of trailing zero bits in a node ID. -func (id NodeID) Difficulty() (uint16, error) { - idLen := len(id) - var b byte - var zeroBits int - // NB: last difficulty byte is used for version - for i := 2; i <= idLen; i++ { - b = id[idLen-i] - - if b != 0 { - zeroBits = bits.TrailingZeros16(uint16(b)) - if zeroBits == 16 { - // we already checked that b != 0. - return 0, ErrNodeID.New("impossible codepath!") - } - - return uint16((i-1)*8 + zeroBits), nil - } - } - - return 0, ErrNodeID.New("difficulty matches id hash length: %d; hash (hex): % x", idLen, id) -} - -// Marshal serializes a node id. -func (id NodeID) Marshal() ([]byte, error) { - return id.Bytes(), nil -} - -// MarshalTo serializes a node ID into the passed byte slice. -func (id *NodeID) MarshalTo(data []byte) (n int, err error) { - n = copy(data, id.Bytes()) - return n, nil -} - -// Unmarshal deserializes a node ID. -func (id *NodeID) Unmarshal(data []byte) error { - var err error - *id, err = NodeIDFromBytes(data) - return err -} - -func (id NodeID) versionByte() byte { - return id[NodeIDSize-1] -} - -// unversioned returns the node ID with the version byte replaced with `0`. -// NB: Legacy node IDs (i.e. pre-identity-versions) with a difficulty less -// than `8` are unsupported. -func (id NodeID) unversioned() NodeID { - unversionedID := NodeID{} - copy(unversionedID[:], id[:NodeIDSize-1]) - return unversionedID -} - -// Size returns the length of a node ID (implements gogo's custom type interface). -func (id *NodeID) Size() int { - return len(id) -} - -// MarshalJSON serializes a node ID to a json string as bytes. -func (id NodeID) MarshalJSON() ([]byte, error) { - return []byte(`"` + id.String() + `"`), nil -} - -// Value converts a NodeID to a database field. -func (id NodeID) Value() (driver.Value, error) { - return id.Bytes(), nil -} - -// Scan extracts a NodeID from a database field. -func (id *NodeID) Scan(src interface{}) (err error) { - b, ok := src.([]byte) - if !ok { - return ErrNodeID.New("NodeID Scan expects []byte") - } - n, err := NodeIDFromBytes(b) - *id = n - return err -} - -// UnmarshalJSON deserializes a json string (as bytes) to a node ID. -func (id *NodeID) UnmarshalJSON(data []byte) error { - var unquoted string - err := json.Unmarshal(data, &unquoted) - if err != nil { - return err - } - - *id, err = NodeIDFromString(unquoted) - if err != nil { - return err - } - return nil -} - -// Strings returns a string slice of the node IDs. -func (n NodeIDList) Strings() []string { - var strings []string - for _, nid := range n { - strings = append(strings, nid.String()) - } - return strings -} - -// Bytes returns a 2d byte slice of the node IDs. -func (n NodeIDList) Bytes() (idsBytes [][]byte) { - for _, nid := range n { - idsBytes = append(idsBytes, nid.Bytes()) - } - return idsBytes -} - -// Len implements sort.Interface.Len(). -func (n NodeIDList) Len() int { return len(n) } - -// Swap implements sort.Interface.Swap(). -func (n NodeIDList) Swap(i, j int) { n[i], n[j] = n[j], n[i] } - -// Less implements sort.Interface.Less(). -func (n NodeIDList) Less(i, j int) bool { return n[i].Less(n[j]) } diff --git a/vendor/storj.io/common/storj/nodeurl.go b/vendor/storj.io/common/storj/nodeurl.go deleted file mode 100644 index f68922343..000000000 --- a/vendor/storj.io/common/storj/nodeurl.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "net/url" - "strings" - - "github.com/zeebo/errs" -) - -var ( - // ErrNodeURL is used when something goes wrong with a node url. - ErrNodeURL = errs.Class("node URL error") -) - -// NodeURL defines a structure for connecting to a node. -type NodeURL struct { - ID NodeID - Address string -} - -// ParseNodeURL parses node URL string. -// -// Examples: -// -// raw IP: -// 33.20.0.1:7777 -// [2001:db8:1f70::999:de8:7648:6e8]:7777 -// -// with NodeID: -// 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@33.20.0.1:7777 -// 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@[2001:db8:1f70::999:de8:7648:6e8]:7777 -// -// without host: -// 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@ -func ParseNodeURL(s string) (NodeURL, error) { - if s == "" { - return NodeURL{}, nil - } - if !strings.HasPrefix(s, "storj://") { - if !strings.Contains(s, "://") { - s = "storj://" + s - } - } - - u, err := url.Parse(s) - if err != nil { - return NodeURL{}, ErrNodeURL.Wrap(err) - } - if u.Scheme != "" && u.Scheme != "storj" { - return NodeURL{}, ErrNodeURL.New("unknown scheme %q", u.Scheme) - } - - var node NodeURL - if u.User != nil { - node.ID, err = NodeIDFromString(u.User.String()) - if err != nil { - return NodeURL{}, ErrNodeURL.Wrap(err) - } - } - node.Address = u.Host - - return node, nil -} - -// IsZero returns whether the url is empty. -func (url NodeURL) IsZero() bool { - return url == NodeURL{} -} - -// String converts NodeURL to a string. -func (url NodeURL) String() string { - if url.ID.IsZero() { - return url.Address - } - return url.ID.String() + "@" + url.Address -} - -// Set implements flag.Value interface. -func (url *NodeURL) Set(s string) error { - parsed, err := ParseNodeURL(s) - if err != nil { - return ErrNodeURL.Wrap(err) - } - - *url = parsed - return nil -} - -// Type implements pflag.Value. -func (NodeURL) Type() string { return "storj.NodeURL" } - -// NodeURLs defines a comma delimited flag for defining a list node url-s. -type NodeURLs []NodeURL - -// ParseNodeURLs parses comma delimited list of node urls. -func ParseNodeURLs(s string) (NodeURLs, error) { - var urls NodeURLs - if s == "" { - return nil, nil - } - - for _, s := range strings.Split(s, ",") { - u, err := ParseNodeURL(s) - if err != nil { - return nil, ErrNodeURL.Wrap(err) - } - urls = append(urls, u) - } - - return urls, nil -} - -// String converts NodeURLs to a string. -func (urls NodeURLs) String() string { - var xs []string - for _, u := range urls { - xs = append(xs, u.String()) - } - return strings.Join(xs, ",") -} - -// Set implements flag.Value interface. -func (urls *NodeURLs) Set(s string) error { - parsed, err := ParseNodeURLs(s) - if err != nil { - return ErrNodeURL.Wrap(err) - } - - *urls = parsed - return nil -} - -// Type implements pflag.Value. -func (NodeURLs) Type() string { return "storj.NodeURLs" } diff --git a/vendor/storj.io/common/storj/object.go b/vendor/storj.io/common/storj/object.go deleted file mode 100644 index 1f71a9583..000000000 --- a/vendor/storj.io/common/storj/object.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "time" - - "github.com/zeebo/errs" -) - -var ( - // ErrNoPath is an error class for using empty path. - ErrNoPath = errs.Class("no path specified") - - // ErrObjectNotFound is an error class for non-existing object. - ErrObjectNotFound = errs.Class("object not found") -) - -// Object contains information about a specific object. -type Object struct { - Version uint32 - Bucket Bucket - Path Path - IsPrefix bool - - Metadata map[string]string - - ContentType string - Created time.Time - Modified time.Time - Expires time.Time - - Stream -} - -// ObjectInfo contains information about a specific object. -type ObjectInfo struct { - Version uint32 - Bucket string - Path Path - IsPrefix bool - - StreamID StreamID - - Metadata []byte - - ContentType string - Created time.Time - Modified time.Time - Expires time.Time - - Stream -} - -// Stream is information about an object stream. -type Stream struct { - ID StreamID - - // Size is the total size of the stream in bytes - Size int64 - // Checksum is the checksum of the segment checksums - Checksum []byte - - // SegmentCount is the number of segments - SegmentCount int64 - // FixedSegmentSize is the size of each segment, - // when all segments have the same size. It is -1 otherwise. - FixedSegmentSize int64 - - // RedundancyScheme specifies redundancy strategy used for this stream - RedundancyScheme - // EncryptionParameters specifies encryption strategy used for this stream - EncryptionParameters - - LastSegment LastSegment // TODO: remove -} - -// LastSegment contains info about last segment. -// -// TODO: remove. -type LastSegment struct { - Size int64 - EncryptedKeyNonce Nonce - EncryptedKey EncryptedPrivateKey -} - -// Segment is full segment information. -type Segment struct { - Index int64 - // Size is the size of the content in bytes - Size int64 - // Checksum is the checksum of the content - Checksum []byte - // Local data - Inline []byte - // Remote data - PieceID PieceID - Pieces []Piece - // Encryption - EncryptedKeyNonce Nonce - EncryptedKey EncryptedPrivateKey -} - -// Piece is information where a piece is located. -type Piece struct { - Number byte - Location NodeID -} diff --git a/vendor/storj.io/common/storj/object_list_item.go b/vendor/storj.io/common/storj/object_list_item.go deleted file mode 100644 index 9387f5920..000000000 --- a/vendor/storj.io/common/storj/object_list_item.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "time" -) - -// ObjectListItem represents listed object. -type ObjectListItem struct { - EncryptedPath []byte - Version int32 - Status int32 - CreatedAt time.Time - StatusAt time.Time - ExpiresAt time.Time - EncryptedMetadataNonce Nonce - EncryptedMetadata []byte - IsPrefix bool -} diff --git a/vendor/storj.io/common/storj/path.go b/vendor/storj.io/common/storj/path.go deleted file mode 100644 index da4a17090..000000000 --- a/vendor/storj.io/common/storj/path.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "strings" -) - -// Path represents a object path. -type Path = string - -// SplitPath splits path into a slice of path components. -func SplitPath(path Path) []string { - return strings.Split(path, "/") -} - -// JoinPaths concatenates paths to a new single path. -func JoinPaths(paths ...Path) Path { - return strings.Join(paths, "/") -} diff --git a/vendor/storj.io/common/storj/pieceid.go b/vendor/storj.io/common/storj/pieceid.go deleted file mode 100644 index dd264babd..000000000 --- a/vendor/storj.io/common/storj/pieceid.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "crypto/hmac" - "crypto/rand" - "crypto/sha512" - "database/sql/driver" - "encoding/base32" - "encoding/binary" - "encoding/json" - - "github.com/zeebo/errs" -) - -// ErrPieceID is used when something goes wrong with a piece ID. -var ErrPieceID = errs.Class("piece ID error") - -// pieceIDEncoding is base32 without padding. -var pieceIDEncoding = base32.StdEncoding.WithPadding(base32.NoPadding) - -// PieceID is the unique identifier for pieces. -type PieceID [32]byte - -// NewPieceID creates a piece ID. -func NewPieceID() PieceID { - var id PieceID - - _, err := rand.Read(id[:]) - if err != nil { - panic(err) - } - - return id -} - -// PieceIDFromString decodes a hex encoded piece ID string. -func PieceIDFromString(s string) (PieceID, error) { - idBytes, err := pieceIDEncoding.DecodeString(s) - if err != nil { - return PieceID{}, ErrPieceID.Wrap(err) - } - return PieceIDFromBytes(idBytes) -} - -// PieceIDFromBytes converts a byte slice into a piece ID. -func PieceIDFromBytes(b []byte) (PieceID, error) { - if len(b) != len(PieceID{}) { - return PieceID{}, ErrPieceID.New("not enough bytes to make a piece ID; have %d, need %d", len(b), len(PieceID{})) - } - - var id PieceID - copy(id[:], b) - return id, nil -} - -// IsZero returns whether piece ID is unassigned. -func (id PieceID) IsZero() bool { - return id == PieceID{} -} - -// String representation of the piece ID. -func (id PieceID) String() string { return pieceIDEncoding.EncodeToString(id.Bytes()) } - -// Bytes returns bytes of the piece ID. -func (id PieceID) Bytes() []byte { return id[:] } - -// Derive a new PieceID from the current piece ID, the given storage node ID and piece number. -func (id PieceID) Derive(storagenodeID NodeID, pieceNum int32) PieceID { - // TODO: should the secret / content be swapped? - mac := hmac.New(sha512.New, id.Bytes()) - _, _ = mac.Write(storagenodeID.Bytes()) // on hash.Hash write never returns an error - num := make([]byte, 4) - binary.BigEndian.PutUint32(num, uint32(pieceNum)) - _, _ = mac.Write(num) // on hash.Hash write never returns an error - var derived PieceID - copy(derived[:], mac.Sum(nil)) - return derived -} - -// Marshal serializes a piece ID. -func (id PieceID) Marshal() ([]byte, error) { - return id.Bytes(), nil -} - -// MarshalTo serializes a piece ID into the passed byte slice. -func (id *PieceID) MarshalTo(data []byte) (n int, err error) { - n = copy(data, id.Bytes()) - return n, nil -} - -// Unmarshal deserializes a piece ID. -func (id *PieceID) Unmarshal(data []byte) error { - var err error - *id, err = PieceIDFromBytes(data) - return err -} - -// Size returns the length of a piece ID (implements gogo's custom type interface). -func (id *PieceID) Size() int { - return len(id) -} - -// MarshalJSON serializes a piece ID to a json string as bytes. -func (id PieceID) MarshalJSON() ([]byte, error) { - return []byte(`"` + id.String() + `"`), nil -} - -// UnmarshalJSON deserializes a json string (as bytes) to a piece ID. -func (id *PieceID) UnmarshalJSON(data []byte) error { - var unquoted string - err := json.Unmarshal(data, &unquoted) - if err != nil { - return err - } - - *id, err = PieceIDFromString(unquoted) - if err != nil { - return err - } - return nil -} - -// Value set a PieceID to a database field. -func (id PieceID) Value() (driver.Value, error) { - return id.Bytes(), nil -} - -// Scan extracts a PieceID from a database field. -func (id *PieceID) Scan(src interface{}) (err error) { - b, ok := src.([]byte) - if !ok { - return ErrPieceID.New("PieceID Scan expects []byte") - } - n, err := PieceIDFromBytes(b) - *id = n - return err -} diff --git a/vendor/storj.io/common/storj/piecekey.go b/vendor/storj.io/common/storj/piecekey.go deleted file mode 100644 index f74ff7fce..000000000 --- a/vendor/storj.io/common/storj/piecekey.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "database/sql/driver" - - "github.com/zeebo/errs" - "golang.org/x/crypto/ed25519" -) - -// ErrPieceKey is used when something goes wrong with a piece key. -var ErrPieceKey = errs.Class("piece key error") - -// PiecePublicKey is the unique identifier for pieces. -type PiecePublicKey struct { - pub ed25519.PublicKey -} - -// PiecePrivateKey is the unique identifier for pieces. -type PiecePrivateKey struct { - priv ed25519.PrivateKey -} - -// NewPieceKey creates a piece key pair. -func NewPieceKey() (PiecePublicKey, PiecePrivateKey, error) { - pub, priv, err := ed25519.GenerateKey(nil) - - return PiecePublicKey{pub}, PiecePrivateKey{priv}, ErrPieceKey.Wrap(err) -} - -// PiecePublicKeyFromBytes converts bytes to a piece public key. -func PiecePublicKeyFromBytes(data []byte) (PiecePublicKey, error) { - if len(data) != ed25519.PublicKeySize { - return PiecePublicKey{}, ErrPieceKey.New("invalid public key length %v", len(data)) - } - return PiecePublicKey{ed25519.PublicKey(data)}, nil -} - -// PiecePrivateKeyFromBytes converts bytes to a piece private key. -func PiecePrivateKeyFromBytes(data []byte) (PiecePrivateKey, error) { - if len(data) != ed25519.PrivateKeySize { - return PiecePrivateKey{}, ErrPieceKey.New("invalid private key length %v", len(data)) - } - return PiecePrivateKey{ed25519.PrivateKey(data)}, nil -} - -// Sign signs the message with privateKey and returns a signature. -func (key PiecePrivateKey) Sign(data []byte) ([]byte, error) { - if len(key.priv) != ed25519.PrivateKeySize { - return nil, ErrPieceKey.New("invalid private key length %v", len(key.priv)) - } - return ed25519.Sign(key.priv, data), nil -} - -// Verify reports whether signature is a valid signature of message by publicKey. -func (key PiecePublicKey) Verify(data, signature []byte) error { - if len(key.pub) != ed25519.PublicKeySize { - return ErrPieceKey.New("invalid public key length %v", len(key.pub)) - } - if !ed25519.Verify(key.pub, data, signature) { - return ErrPieceKey.New("invalid signature") - } - return nil -} - -// Bytes returns bytes of the piece public key. -func (key PiecePublicKey) Bytes() []byte { return key.pub[:] } - -// Bytes returns bytes of the piece private key. -func (key PiecePrivateKey) Bytes() []byte { return key.priv[:] } - -// IsZero returns whether the key is empty. -func (key PiecePublicKey) IsZero() bool { return len(key.pub) == 0 } - -// IsZero returns whether the key is empty. -func (key PiecePrivateKey) IsZero() bool { return len(key.priv) == 0 } - -// Marshal serializes a piece public key. -func (key PiecePublicKey) Marshal() ([]byte, error) { return key.Bytes(), nil } - -// Marshal serializes a piece private key. -func (key PiecePrivateKey) Marshal() ([]byte, error) { return key.Bytes(), nil } - -// MarshalTo serializes a piece public key into the passed byte slice. -func (key *PiecePublicKey) MarshalTo(data []byte) (n int, err error) { - n = copy(data, key.Bytes()) - return n, nil -} - -// MarshalTo serializes a piece private key into the passed byte slice. -func (key *PiecePrivateKey) MarshalTo(data []byte) (n int, err error) { - n = copy(data, key.Bytes()) - return n, nil -} - -// Unmarshal deserializes a piece public key. -func (key *PiecePublicKey) Unmarshal(data []byte) error { - // allow empty keys - if len(data) == 0 { - key.pub = nil - return nil - } - var err error - *key, err = PiecePublicKeyFromBytes(data) - return err -} - -// Unmarshal deserializes a piece private key. -func (key *PiecePrivateKey) Unmarshal(data []byte) error { - // allow empty keys - if len(data) == 0 { - key.priv = nil - return nil - } - if len(data) == 0 { - return nil - } - var err error - *key, err = PiecePrivateKeyFromBytes(data) - return err -} - -// Size returns the length of a piece public key (implements gogo's custom type interface). -func (key *PiecePublicKey) Size() int { return len(key.pub) } - -// Size returns the length of a piece private key (implements gogo's custom type interface). -func (key *PiecePrivateKey) Size() int { return len(key.priv) } - -// Value set a PiecePublicKey to a database field. -func (key PiecePublicKey) Value() (driver.Value, error) { - return key.Bytes(), nil -} - -// Value set a PiecePrivateKey to a database field. -func (key PiecePrivateKey) Value() (driver.Value, error) { return key.Bytes(), nil } - -// Scan extracts a PiecePublicKey from a database field. -func (key *PiecePublicKey) Scan(src interface{}) (err error) { - b, ok := src.([]byte) - if !ok { - return ErrPieceKey.New("PiecePublicKey Scan expects []byte") - } - n, err := PiecePublicKeyFromBytes(b) - *key = n - return err -} - -// Scan extracts a PiecePrivateKey from a database field. -func (key *PiecePrivateKey) Scan(src interface{}) (err error) { - b, ok := src.([]byte) - if !ok { - return ErrPieceKey.New("PiecePrivateKey Scan expects []byte") - } - n, err := PiecePrivateKeyFromBytes(b) - *key = n - return err -} diff --git a/vendor/storj.io/common/storj/redundancy.go b/vendor/storj.io/common/storj/redundancy.go deleted file mode 100644 index 015feb6b6..000000000 --- a/vendor/storj.io/common/storj/redundancy.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -// RedundancyScheme specifies the parameters and the algorithm for redundancy. -type RedundancyScheme struct { - // Algorithm determines the algorithm to be used for redundancy. - Algorithm RedundancyAlgorithm - - // ShareSize is the size in bytes for each erasure shares. - ShareSize int32 - - // RequiredShares is the minimum number of shares required to recover a - // stripe, reed-solomon k. - RequiredShares int16 - // RepairShares is the minimum number of safe shares that can remain - // before a repair is triggered. - RepairShares int16 - // OptimalShares is the desired total number of shares for a segment. - OptimalShares int16 - // TotalShares is the number of shares to encode. If it is larger than - // OptimalShares, slower uploads of the excess shares will be aborted in - // order to improve performance. - TotalShares int16 -} - -// IsZero returns true if no field in the struct is set to non-zero value. -func (scheme RedundancyScheme) IsZero() bool { - return scheme == (RedundancyScheme{}) -} - -// StripeSize is the number of bytes for a stripe. -// Stripes are erasure encoded and split into n shares, where we need k to -// reconstruct the stripe. Therefore a stripe size is the erasure share size -// times the required shares, k. -func (scheme RedundancyScheme) StripeSize() int32 { - return scheme.ShareSize * int32(scheme.RequiredShares) -} - -// DownloadNodes calculates the number of nodes needed to download in the -// presence of node failure based on t = k + (n-o)k/o. -func (scheme RedundancyScheme) DownloadNodes() int32 { - extra := int32(1) - - if scheme.OptimalShares > 0 { - extra = int32(((scheme.TotalShares - scheme.OptimalShares) * scheme.RequiredShares) / scheme.OptimalShares) - if extra == 0 { - // ensure there is at least one extra node, so we can have error detection/correction - extra = 1 - } - } - - needed := int32(scheme.RequiredShares) + extra - - if needed > int32(scheme.TotalShares) { - needed = int32(scheme.TotalShares) - } - return needed -} - -// RedundancyAlgorithm is the algorithm used for redundancy. -type RedundancyAlgorithm byte - -// List of supported redundancy algorithms. -const ( - InvalidRedundancyAlgorithm = RedundancyAlgorithm(iota) - ReedSolomon -) diff --git a/vendor/storj.io/common/storj/segment.go b/vendor/storj.io/common/storj/segment.go deleted file mode 100644 index 54fe1afa8..000000000 --- a/vendor/storj.io/common/storj/segment.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -// SegmentPosition segment position in object. -type SegmentPosition struct { - PartNumber int32 - Index int32 -} - -// SegmentListItem represents listed segment. -type SegmentListItem struct { - Position SegmentPosition -} - -// SegmentDownloadInfo represents segment download information inline/remote. -type SegmentDownloadInfo struct { - SegmentID SegmentID - Size int64 - EncryptedInlineData []byte - Next SegmentPosition - PiecePrivateKey PiecePrivateKey - - SegmentEncryption SegmentEncryption -} - -// SegmentEncryption represents segment encryption key and nonce. -type SegmentEncryption struct { - EncryptedKeyNonce Nonce - EncryptedKey EncryptedPrivateKey -} diff --git a/vendor/storj.io/common/storj/segmentid.go b/vendor/storj.io/common/storj/segmentid.go deleted file mode 100644 index 9754249bd..000000000 --- a/vendor/storj.io/common/storj/segmentid.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "encoding/base32" - - "github.com/zeebo/errs" -) - -// ErrSegmentID is used when something goes wrong with a segment ID. -var ErrSegmentID = errs.Class("segment ID error") - -// segmentIDEncoding is base32 without padding. -var segmentIDEncoding = base32.StdEncoding.WithPadding(base32.NoPadding) - -// SegmentID is the unique identifier for segment related to object. -type SegmentID []byte - -// SegmentIDFromString decodes an base32 encoded. -func SegmentIDFromString(s string) (SegmentID, error) { - idBytes, err := segmentIDEncoding.DecodeString(s) - if err != nil { - return SegmentID{}, ErrSegmentID.Wrap(err) - } - return SegmentIDFromBytes(idBytes) -} - -// SegmentIDFromBytes converts a byte slice into a segment ID. -func SegmentIDFromBytes(b []byte) (SegmentID, error) { - // return error will be used in future implementation - id := make([]byte, len(b)) - copy(id, b) - return id, nil -} - -// IsZero returns whether segment ID is unassigned. -func (id SegmentID) IsZero() bool { - return len(id) == 0 -} - -// String representation of the segment ID. -func (id SegmentID) String() string { return segmentIDEncoding.EncodeToString(id.Bytes()) } - -// Bytes returns bytes of the segment ID. -func (id SegmentID) Bytes() []byte { return id[:] } - -// Marshal serializes a segment ID (implements gogo's custom type interface). -func (id SegmentID) Marshal() ([]byte, error) { - return id.Bytes(), nil -} - -// MarshalTo serializes a segment ID into the passed byte slice (implements gogo's custom type interface). -func (id *SegmentID) MarshalTo(data []byte) (n int, err error) { - return copy(data, id.Bytes()), nil -} - -// Unmarshal deserializes a segment ID (implements gogo's custom type interface). -func (id *SegmentID) Unmarshal(data []byte) error { - var err error - *id, err = SegmentIDFromBytes(data) - return err -} - -// Size returns the length of a segment ID (implements gogo's custom type interface). -func (id SegmentID) Size() int { - return len(id) -} - -// MarshalJSON serializes a segment ID to a json string as bytes (implements gogo's custom type interface). -func (id SegmentID) MarshalJSON() ([]byte, error) { - return []byte(`"` + id.String() + `"`), nil -} - -// UnmarshalJSON deserializes a json string (as bytes) to a segment ID (implements gogo's custom type interface). -func (id *SegmentID) UnmarshalJSON(data []byte) error { - var err error - *id, err = SegmentIDFromString(string(data)) - return err -} diff --git a/vendor/storj.io/common/storj/serialnumber.go b/vendor/storj.io/common/storj/serialnumber.go deleted file mode 100644 index 1deef724d..000000000 --- a/vendor/storj.io/common/storj/serialnumber.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "database/sql/driver" - "encoding/base32" - - "github.com/zeebo/errs" -) - -// ErrSerialNumber is used when something goes wrong with a serial number. -var ErrSerialNumber = errs.Class("serial number error") - -// serialNumberEncoding is base32 without padding. -var serialNumberEncoding = base32.StdEncoding.WithPadding(base32.NoPadding) - -// SerialNumber is the unique identifier for pieces. -type SerialNumber [16]byte - -// SerialNumberFromString decodes an base32 encoded. -func SerialNumberFromString(s string) (SerialNumber, error) { - idBytes, err := serialNumberEncoding.DecodeString(s) - if err != nil { - return SerialNumber{}, ErrNodeID.Wrap(err) - } - return SerialNumberFromBytes(idBytes) -} - -// SerialNumberFromBytes converts a byte slice into a serial number. -func SerialNumberFromBytes(b []byte) (SerialNumber, error) { - if len(b) != len(SerialNumber{}) { - return SerialNumber{}, ErrSerialNumber.New("not enough bytes to make a serial number; have %d, need %d", len(b), len(NodeID{})) - } - - var id SerialNumber - copy(id[:], b) - return id, nil -} - -// IsZero returns whether serial number is unassigned. -func (id SerialNumber) IsZero() bool { - return id == SerialNumber{} -} - -// Less returns whether id is smaller than other in lexicographic order. -func (id SerialNumber) Less(other SerialNumber) bool { - for k, v := range id { - if v < other[k] { - return true - } else if v > other[k] { - return false - } - } - return false -} - -// String representation of the serial number. -func (id SerialNumber) String() string { return serialNumberEncoding.EncodeToString(id.Bytes()) } - -// Bytes returns bytes of the serial number. -func (id SerialNumber) Bytes() []byte { return id[:] } - -// Marshal serializes a serial number. -func (id SerialNumber) Marshal() ([]byte, error) { - return id.Bytes(), nil -} - -// MarshalTo serializes a serial number into the passed byte slice. -func (id *SerialNumber) MarshalTo(data []byte) (n int, err error) { - n = copy(data, id.Bytes()) - return n, nil -} - -// Unmarshal deserializes a serial number. -func (id *SerialNumber) Unmarshal(data []byte) error { - var err error - *id, err = SerialNumberFromBytes(data) - return err -} - -// Size returns the length of a serial number (implements gogo's custom type interface). -func (id *SerialNumber) Size() int { - return len(id) -} - -// MarshalJSON serializes a serial number to a json string as bytes. -func (id SerialNumber) MarshalJSON() ([]byte, error) { - return []byte(`"` + id.String() + `"`), nil -} - -// UnmarshalJSON deserializes a json string (as bytes) to a serial number. -func (id *SerialNumber) UnmarshalJSON(data []byte) error { - var err error - *id, err = SerialNumberFromString(string(data)) - if err != nil { - return err - } - return nil -} - -// Value set a SerialNumber to a database field. -func (id SerialNumber) Value() (driver.Value, error) { - return id.Bytes(), nil -} - -// Scan extracts a SerialNumber from a database field. -func (id *SerialNumber) Scan(src interface{}) (err error) { - b, ok := src.([]byte) - if !ok { - return ErrSerialNumber.New("SerialNumber Scan expects []byte") - } - n, err := SerialNumberFromBytes(b) - *id = n - return err -} diff --git a/vendor/storj.io/common/storj/streamid.go b/vendor/storj.io/common/storj/streamid.go deleted file mode 100644 index 2bd6ce5bd..000000000 --- a/vendor/storj.io/common/storj/streamid.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package storj - -import ( - "database/sql/driver" - "encoding/base32" - - "github.com/zeebo/errs" -) - -// ErrStreamID is used when something goes wrong with a stream ID. -var ErrStreamID = errs.Class("stream ID error") - -// streamIDEncoding is base32 without padding. -var streamIDEncoding = base32.StdEncoding.WithPadding(base32.NoPadding) - -// StreamID is the unique identifier for stream related to object. -type StreamID []byte - -// StreamIDFromString decodes an base32 encoded. -func StreamIDFromString(s string) (StreamID, error) { - idBytes, err := streamIDEncoding.DecodeString(s) - if err != nil { - return StreamID{}, ErrStreamID.Wrap(err) - } - return StreamIDFromBytes(idBytes) -} - -// StreamIDFromBytes converts a byte slice into a stream ID. -func StreamIDFromBytes(b []byte) (StreamID, error) { - id := make([]byte, len(b)) - copy(id, b) - return id, nil -} - -// IsZero returns whether stream ID is unassigned. -func (id StreamID) IsZero() bool { - return len(id) == 0 -} - -// String representation of the stream ID. -func (id StreamID) String() string { return streamIDEncoding.EncodeToString(id.Bytes()) } - -// Bytes returns bytes of the stream ID. -func (id StreamID) Bytes() []byte { return id[:] } - -// Marshal serializes a stream ID. -func (id StreamID) Marshal() ([]byte, error) { - return id.Bytes(), nil -} - -// MarshalTo serializes a stream ID into the passed byte slice. -func (id *StreamID) MarshalTo(data []byte) (n int, err error) { - n = copy(data, id.Bytes()) - return n, nil -} - -// Unmarshal deserializes a stream ID. -func (id *StreamID) Unmarshal(data []byte) error { - var err error - *id, err = StreamIDFromBytes(data) - return err -} - -// Size returns the length of a stream ID (implements gogo's custom type interface). -func (id StreamID) Size() int { - return len(id) -} - -// MarshalJSON serializes a stream ID to a json string as bytes. -func (id StreamID) MarshalJSON() ([]byte, error) { - return []byte(`"` + id.String() + `"`), nil -} - -// UnmarshalJSON deserializes a json string (as bytes) to a stream ID. -func (id *StreamID) UnmarshalJSON(data []byte) error { - var err error - *id, err = StreamIDFromString(string(data)) - if err != nil { - return err - } - return nil -} - -// Value set a stream ID to a database field. -func (id StreamID) Value() (driver.Value, error) { - return id.Bytes(), nil -} - -// Scan extracts a stream ID from a database field. -func (id *StreamID) Scan(src interface{}) (err error) { - b, ok := src.([]byte) - if !ok { - return ErrStreamID.New("Stream ID Scan expects []byte") - } - n, err := StreamIDFromBytes(b) - *id = n - return err -} diff --git a/vendor/storj.io/common/sync2/cooldown.go b/vendor/storj.io/common/sync2/cooldown.go deleted file mode 100644 index 97c399226..000000000 --- a/vendor/storj.io/common/sync2/cooldown.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "sync" - "sync/atomic" - "time" - - "golang.org/x/sync/errgroup" -) - -// Cooldown implements an event that can only occur once in a given timeframe. -// -// Cooldown control methods PANICS after Close has been called and don't have any -// effect after Stop has been called. -// -// Start or Run (only one of them, not both) must be only called once. -type Cooldown struct { - noCopy noCopy // nolint: structcheck - - stopsent int32 - runexec int32 - - interval time.Duration - - init sync.Once - trigger chan struct{} - stopping chan struct{} - stopped chan struct{} -} - -// NewCooldown creates a new cooldown with the specified interval. -func NewCooldown(interval time.Duration) *Cooldown { - cooldown := &Cooldown{} - cooldown.SetInterval(interval) - return cooldown -} - -// SetInterval allows to change the interval before starting. -func (cooldown *Cooldown) SetInterval(interval time.Duration) { - cooldown.interval = interval -} - -func (cooldown *Cooldown) initialize() { - cooldown.init.Do(func() { - cooldown.stopped = make(chan struct{}) - cooldown.stopping = make(chan struct{}) - cooldown.trigger = make(chan struct{}, 1) - }) -} - -// Start runs the specified function with an errgroup. -func (cooldown *Cooldown) Start(ctx context.Context, group *errgroup.Group, fn func(ctx context.Context) error) { - atomic.StoreInt32(&cooldown.runexec, 1) - group.Go(func() error { - return cooldown.Run(ctx, fn) - }) -} - -// Run waits for a message on the trigger channel, then runs the specified function. -// Afterwards it will sleep for the cooldown duration and drain the trigger channel. -// -// Run PANICS if it's called after Stop has been called. -func (cooldown *Cooldown) Run(ctx context.Context, fn func(ctx context.Context) error) error { - atomic.StoreInt32(&cooldown.runexec, 1) - cooldown.initialize() - defer close(cooldown.stopped) - for { - // prioritize stopping messages - select { - case <-cooldown.stopping: - return nil - case <-ctx.Done(): - return ctx.Err() - default: - } - - // handle trigger message - select { - case <-cooldown.trigger: - // trigger the function - if err := fn(ctx); err != nil { - return err - } - if !Sleep(ctx, cooldown.interval) { - return ctx.Err() - } - - // drain the channel to prevent messages received during sleep from triggering the function again - select { - case <-cooldown.trigger: - default: - } - case <-ctx.Done(): - return ctx.Err() - case <-cooldown.stopping: - return nil - } - - } -} - -// Close closes all resources associated with it. -// -// It MUST NOT be called concurrently. -func (cooldown *Cooldown) Close() { - cooldown.Stop() - - if atomic.LoadInt32(&cooldown.runexec) == 1 { - <-cooldown.stopped - } - - close(cooldown.trigger) -} - -// Stop stops the cooldown permanently. -func (cooldown *Cooldown) Stop() { - cooldown.initialize() - if atomic.CompareAndSwapInt32(&cooldown.stopsent, 0, 1) { - close(cooldown.stopping) - } - - if atomic.LoadInt32(&cooldown.runexec) == 1 { - <-cooldown.stopped - } -} - -// Trigger attempts to run the cooldown function. -// If the timer has not expired, the function will not run. -func (cooldown *Cooldown) Trigger() { - cooldown.initialize() - select { - case cooldown.trigger <- struct{}{}: - default: - } -} diff --git a/vendor/storj.io/common/sync2/copy.go b/vendor/storj.io/common/sync2/copy.go deleted file mode 100644 index f7ea15545..000000000 --- a/vendor/storj.io/common/sync2/copy.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "io" - - "github.com/spacemonkeygo/monkit/v3" -) - -var mon = monkit.Package() - -type readerFunc func(p []byte) (n int, err error) - -func (rf readerFunc) Read(p []byte) (n int, err error) { return rf(p) } - -// Copy implements copying with cancellation. -func Copy(ctx context.Context, dst io.Writer, src io.Reader) (written int64, err error) { - defer mon.Task()(&ctx)(&err) - written, err = io.Copy(dst, readerFunc(func(p []byte) (int, error) { - select { - case <-ctx.Done(): - return 0, ctx.Err() - default: - return src.Read(p) - } - })) - - return written, err -} diff --git a/vendor/storj.io/common/sync2/cycle.go b/vendor/storj.io/common/sync2/cycle.go deleted file mode 100644 index d72503a5b..000000000 --- a/vendor/storj.io/common/sync2/cycle.go +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "sync" - "sync/atomic" - "time" - - monkit "github.com/spacemonkeygo/monkit/v3" - "golang.org/x/sync/errgroup" -) - -// Cycle implements a controllable recurring event. -// -// Cycle control methods PANICS after Close has been called and don't have any -// effect after Stop has been called. -// -// Start or Run (only one of them, not both) must be only called once. -type Cycle struct { - noCopy noCopy // nolint: structcheck - - stopsent int32 - runexec int32 - - interval time.Duration - - ticker *time.Ticker - control chan interface{} - - stopping chan struct{} - stopped chan struct{} - - init sync.Once -} - -type ( - // cycle control messages - cyclePause struct{} - cycleContinue struct{} - cycleChangeInterval struct{ Interval time.Duration } - cycleTrigger struct{ done chan struct{} } -) - -// NewCycle creates a new cycle with the specified interval. -func NewCycle(interval time.Duration) *Cycle { - cycle := &Cycle{} - cycle.SetInterval(interval) - return cycle -} - -// SetInterval allows to change the interval before starting. -func (cycle *Cycle) SetInterval(interval time.Duration) { - cycle.interval = interval -} - -func (cycle *Cycle) initialize() { - cycle.init.Do(func() { - cycle.stopped = make(chan struct{}) - cycle.stopping = make(chan struct{}) - cycle.control = make(chan interface{}) - }) -} - -// Start runs the specified function with an errgroup. -func (cycle *Cycle) Start(ctx context.Context, group *errgroup.Group, fn func(ctx context.Context) error) { - atomic.CompareAndSwapInt32(&cycle.runexec, 0, 1) - group.Go(func() error { - return cycle.Run(ctx, fn) - }) -} - -// Run runs the specified in an interval. -// -// Every interval `fn` is started. -// When `fn` is not fast enough, it may skip some of those executions. -// -// Run PANICS if it's called after Stop has been called. -func (cycle *Cycle) Run(ctx context.Context, fn func(ctx context.Context) error) error { - atomic.CompareAndSwapInt32(&cycle.runexec, 0, 1) - cycle.initialize() - defer close(cycle.stopped) - - currentInterval := cycle.interval - cycle.ticker = time.NewTicker(currentInterval) - defer cycle.ticker.Stop() - - choreCtx := monkit.ResetContextSpan(ctx) - - if err := fn(choreCtx); err != nil { - return err - } - for { - // prioritize stopping messages - select { - case <-cycle.stopping: - return nil - - case <-ctx.Done(): - // handle control messages - return ctx.Err() - - default: - } - - // handle other messages as well - select { - - case message := <-cycle.control: - // handle control messages - - switch message := message.(type) { - - case cycleChangeInterval: - currentInterval = message.Interval - cycle.ticker.Stop() - cycle.ticker = time.NewTicker(currentInterval) - - case cyclePause: - cycle.ticker.Stop() - // ensure we don't have ticks left - select { - case <-cycle.ticker.C: - default: - } - - case cycleContinue: - cycle.ticker.Stop() - cycle.ticker = time.NewTicker(currentInterval) - - case cycleTrigger: - // trigger the function - if err := fn(choreCtx); err != nil { - return err - } - if message.done != nil { - close(message.done) - } - } - - case <-cycle.stopping: - return nil - - case <-ctx.Done(): - // handle control messages - return ctx.Err() - - case <-cycle.ticker.C: - // trigger the function - if err := fn(choreCtx); err != nil { - return err - } - } - } -} - -// Close closes all resources associated with it. -// -// It MUST NOT be called concurrently. -func (cycle *Cycle) Close() { - cycle.Stop() - - if atomic.LoadInt32(&cycle.runexec) == 1 { - <-cycle.stopped - } - - close(cycle.control) -} - -// sendControl sends a control message. -func (cycle *Cycle) sendControl(message interface{}) { - cycle.initialize() - select { - case cycle.control <- message: - case <-cycle.stopped: - } -} - -// Stop stops the cycle permanently. -func (cycle *Cycle) Stop() { - cycle.initialize() - if atomic.CompareAndSwapInt32(&cycle.stopsent, 0, 1) { - close(cycle.stopping) - } - - if atomic.LoadInt32(&cycle.runexec) == 1 { - <-cycle.stopped - } -} - -// ChangeInterval allows to change the ticker interval after it has started. -func (cycle *Cycle) ChangeInterval(interval time.Duration) { - cycle.sendControl(cycleChangeInterval{interval}) -} - -// Pause pauses the cycle. -func (cycle *Cycle) Pause() { - cycle.sendControl(cyclePause{}) -} - -// Restart restarts the ticker from 0. -func (cycle *Cycle) Restart() { - cycle.sendControl(cycleContinue{}) -} - -// Trigger ensures that the loop is done at least once. -// If it's currently running it waits for the previous to complete and then runs. -func (cycle *Cycle) Trigger() { - cycle.sendControl(cycleTrigger{}) -} - -// TriggerWait ensures that the loop is done at least once and waits for completion. -// If it's currently running it waits for the previous to complete and then runs. -func (cycle *Cycle) TriggerWait() { - done := make(chan struct{}) - - cycle.sendControl(cycleTrigger{done}) - select { - case <-done: - case <-cycle.stopped: - } -} diff --git a/vendor/storj.io/common/sync2/doc.go b/vendor/storj.io/common/sync2/doc.go deleted file mode 100644 index 13dba7d14..000000000 --- a/vendor/storj.io/common/sync2/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -/*Package sync2 provides a set of functions and types for: - -* Having context aware functionalities which aren't present in the standard - library. -* For offloading memory through the file system. -* To control execution of tasks which can run repetitively, concurrently or - asynchronously. -*/ -package sync2 diff --git a/vendor/storj.io/common/sync2/fence.go b/vendor/storj.io/common/sync2/fence.go deleted file mode 100644 index 655899880..000000000 --- a/vendor/storj.io/common/sync2/fence.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "sync" -) - -// Fence allows to wait for something to happen. -type Fence struct { - noCopy noCopy // nolint: structcheck - - setup sync.Once - release sync.Once - done chan struct{} -} - -// init sets up the initial lock into wait. -func (fence *Fence) init() { - fence.setup.Do(func() { - fence.done = make(chan struct{}) - }) -} - -// Release releases everyone from Wait. -func (fence *Fence) Release() { - fence.init() - fence.release.Do(func() { close(fence.done) }) -} - -// Wait waits for wait to be unlocked. -// Returns true when it was successfully released. -func (fence *Fence) Wait(ctx context.Context) bool { - fence.init() - - select { - case <-fence.done: - return true - default: - select { - case <-ctx.Done(): - return false - case <-fence.done: - return true - } - } -} - -// Released returns whether the fence has been released. -func (fence *Fence) Released() bool { - fence.init() - - select { - case <-fence.done: - return true - default: - return false - } -} - -// Done returns channel that will be closed when the fence is released. -func (fence *Fence) Done() chan struct{} { - fence.init() - return fence.done -} diff --git a/vendor/storj.io/common/sync2/io.go b/vendor/storj.io/common/sync2/io.go deleted file mode 100644 index cd97bbdd3..000000000 --- a/vendor/storj.io/common/sync2/io.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "io" - "os" - "sync/atomic" -) - -// ReadAtWriteAtCloser implements all io.ReaderAt, io.WriterAt and io.Closer. -type ReadAtWriteAtCloser interface { - io.ReaderAt - io.WriterAt - io.Closer -} - -// PipeWriter allows closing the writer with an error. -type PipeWriter interface { - io.WriteCloser - CloseWithError(reason error) error -} - -// PipeReader allows closing the reader with an error. -type PipeReader interface { - io.ReadCloser - CloseWithError(reason error) error -} - -// memory implements ReadAtWriteAtCloser on a memory buffer. -type memory []byte - -// Size returns size of memory buffer. -func (memory memory) Size() int { return len(memory) } - -// ReadAt implements io.ReaderAt methods. -func (memory memory) ReadAt(data []byte, at int64) (amount int, err error) { - if at > int64(len(memory)) { - return 0, io.ErrClosedPipe - } - amount = copy(data, memory[at:]) - return amount, nil -} - -// WriteAt implements io.WriterAt methods. -func (memory memory) WriteAt(data []byte, at int64) (amount int, err error) { - if at > int64(len(memory)) { - return 0, io.ErrClosedPipe - } - amount = copy(memory[at:], data) - return amount, nil -} - -// Close implements io.Closer implementation. -func (memory memory) Close() error { return nil } - -// offsetFile implements ReadAt, WriteAt offset to the file with reference counting. -type offsetFile struct { - file *os.File - offset int64 - open *int64 // number of handles open -} - -// ReadAt implements io.ReaderAt methods. -func (file offsetFile) ReadAt(data []byte, at int64) (amount int, err error) { - return file.file.ReadAt(data, file.offset+at) -} - -// WriteAt implements io.WriterAt methods. -func (file offsetFile) WriteAt(data []byte, at int64) (amount int, err error) { - return file.file.WriteAt(data, file.offset+at) -} - -// Close implements io.Closer methods. -func (file offsetFile) Close() error { - if atomic.AddInt64(file.open, -1) == 0 { - return file.file.Close() - } - return nil -} diff --git a/vendor/storj.io/common/sync2/limiter.go b/vendor/storj.io/common/sync2/limiter.go deleted file mode 100644 index d311ee223..000000000 --- a/vendor/storj.io/common/sync2/limiter.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "sync" -) - -// Limiter implements concurrent goroutine limiting. -type Limiter struct { - noCopy noCopy // nolint: structcheck - - limit chan struct{} - working sync.WaitGroup -} - -// NewLimiter creates a new limiter with limit set to n. -func NewLimiter(n int) *Limiter { - limiter := &Limiter{} - limiter.limit = make(chan struct{}, n) - return limiter -} - -// Go tries to start fn as a goroutine. -// When the limit is reached it will wait until it can run it -// or the context is canceled. -func (limiter *Limiter) Go(ctx context.Context, fn func()) bool { - select { - case limiter.limit <- struct{}{}: - case <-ctx.Done(): - return false - } - - limiter.working.Add(1) - go func() { - defer func() { - <-limiter.limit - limiter.working.Done() - }() - - fn() - }() - - return true -} - -// Wait waits for all running goroutines to finish. -func (limiter *Limiter) Wait() { - limiter.working.Wait() -} diff --git a/vendor/storj.io/common/sync2/nocopy.go b/vendor/storj.io/common/sync2/nocopy.go deleted file mode 100644 index 8d82926a4..000000000 --- a/vendor/storj.io/common/sync2/nocopy.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -// noCopy is used to ensure that we don't copy things that shouldn't -// be copied. -// -// See https://golang.org/issues/8005#issuecomment-190753527. -// -// Currently users of noCopy must use "// nolint: structcheck", -// because golint-ci does not handle this correctly. -type noCopy struct{} - -func (noCopy) Lock() {} diff --git a/vendor/storj.io/common/sync2/parent_child_limiter.go b/vendor/storj.io/common/sync2/parent_child_limiter.go deleted file mode 100644 index 6f3821150..000000000 --- a/vendor/storj.io/common/sync2/parent_child_limiter.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "sync" -) - -// ParentLimiter limits the concurrent goroutines that children run. -// See Child method. -type ParentLimiter struct { - limiter *Limiter -} - -// NewParentLimiter creates a new ParentLimiter with limit set to n. -func NewParentLimiter(n int) *ParentLimiter { - return &ParentLimiter{ - limiter: NewLimiter(n), - } -} - -// Child create a new parent's child. -func (parent *ParentLimiter) Child() *ChildLimiter { - return &ChildLimiter{ - parentLimiter: parent.limiter, - } -} - -// Wait waits for all the children's running goroutines to finish. -func (parent *ParentLimiter) Wait() { - parent.limiter.Wait() -} - -// ChildLimiter limits concurrent goroutines by its parent limit -// (ParentLimiter). -type ChildLimiter struct { - parentLimiter *Limiter - working sync.WaitGroup -} - -// Go tries to start fn as a goroutine. -// When the parent limit is reached it will wait until it can run it or the -// context is canceled. -// Cancel the context only interrupt the child goroutines waiting to run. -func (child *ChildLimiter) Go(ctx context.Context, fn func()) bool { - child.working.Add(1) - - return child.parentLimiter.Go(ctx, func() { - defer child.working.Done() - fn() - }) -} - -// Wait waits for all the child's running goroutines to finish. -func (child *ChildLimiter) Wait() { - child.working.Wait() -} diff --git a/vendor/storj.io/common/sync2/pipe.go b/vendor/storj.io/common/sync2/pipe.go deleted file mode 100644 index 24a274123..000000000 --- a/vendor/storj.io/common/sync2/pipe.go +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "fmt" - "io" - "io/ioutil" - "math" - "sync" -) - -// pipe is a io.Reader/io.Writer pipe backed by ReadAtWriteAtCloser. -type pipe struct { - noCopy noCopy // nolint: structcheck - - buffer ReadAtWriteAtCloser - - mu sync.Mutex - nodata sync.Cond - read int64 - write int64 - limit int64 - - writerDone bool - writerErr error - - readerDone bool - readerErr error -} - -// NewPipeFile returns a pipe that uses file-system to offload memory. -func NewPipeFile(tempdir string) (PipeReader, PipeWriter, error) { - tempfile, err := ioutil.TempFile(tempdir, "filepipe") - if err != nil { - return nil, nil, err - } - - handles := int64(2) - pipe := &pipe{ - buffer: &offsetFile{ - file: tempfile, - open: &handles, - }, - limit: math.MaxInt64, - } - pipe.nodata.L = &pipe.mu - - return pipeReader{pipe}, pipeWriter{pipe}, nil -} - -// NewPipeMemory returns a pipe that uses an in-memory buffer. -func NewPipeMemory(pipeSize int64) (PipeReader, PipeWriter, error) { - pipe := &pipe{ - buffer: make(memory, pipeSize), - limit: pipeSize, - } - pipe.nodata.L = &pipe.mu - return pipeReader{pipe}, pipeWriter{pipe}, nil -} - -type pipeReader struct{ pipe *pipe } -type pipeWriter struct{ pipe *pipe } - -// Close implements io.Reader Close. -func (reader pipeReader) Close() error { return reader.CloseWithError(nil) } - -// Close implements io.Writer Close. -func (writer pipeWriter) Close() error { return writer.CloseWithError(nil) } - -// CloseWithError implements closing with error. -func (reader pipeReader) CloseWithError(err error) error { - if err == nil { - err = io.ErrClosedPipe - } - - pipe := reader.pipe - pipe.mu.Lock() - if pipe.readerDone { - pipe.mu.Unlock() - return io.ErrClosedPipe - } - pipe.readerDone = true - pipe.readerErr = err - pipe.mu.Unlock() - - return pipe.buffer.Close() -} - -// CloseWithError implements closing with error. -func (writer pipeWriter) CloseWithError(err error) error { - if err == nil { - err = io.EOF - } - - pipe := writer.pipe - pipe.mu.Lock() - if pipe.writerDone { - pipe.mu.Unlock() - return io.ErrClosedPipe - } - pipe.writerDone = true - pipe.writerErr = err - pipe.nodata.Broadcast() - pipe.mu.Unlock() - - return pipe.buffer.Close() -} - -// Write writes to the pipe returning io.ErrClosedPipe when pipeSize is reached. -func (writer pipeWriter) Write(data []byte) (n int, err error) { - pipe := writer.pipe - pipe.mu.Lock() - - // has the reader finished? - if pipe.readerDone { - pipe.mu.Unlock() - return 0, pipe.readerErr - } - - // have we closed already - if pipe.writerDone { - pipe.mu.Unlock() - return 0, io.ErrClosedPipe - } - - // check how much do they want to write - canWrite := pipe.limit - pipe.write - - // no more room to write - if canWrite == 0 { - pipe.mu.Unlock() - return 0, io.ErrClosedPipe - } - - // figure out how much to write - toWrite := int64(len(data)) - if toWrite > canWrite { - toWrite = canWrite - } - - writeAt := pipe.write - pipe.mu.Unlock() - - // write data to buffer - writeAmount, err := pipe.buffer.WriteAt(data[:toWrite], writeAt) - - pipe.mu.Lock() - // update writing head - pipe.write += int64(writeAmount) - // wake up reader - pipe.nodata.Broadcast() - // check whether we have finished - done := pipe.write >= pipe.limit - pipe.mu.Unlock() - - if err == nil && done { - err = io.ErrClosedPipe - } - return writeAmount, err -} - -// Read reads from the pipe returning io.EOF when writer is closed or pipeSize is reached. -func (reader pipeReader) Read(data []byte) (n int, err error) { - pipe := reader.pipe - pipe.mu.Lock() - // wait until we have something to read - for pipe.read >= pipe.write { - // has the writer finished? - if pipe.writerDone { - pipe.mu.Unlock() - return 0, pipe.writerErr - } - - // have we closed already - if pipe.readerDone { - pipe.mu.Unlock() - return 0, io.ErrClosedPipe - } - - // have we run out of the limit - if pipe.read >= pipe.limit { - pipe.mu.Unlock() - return 0, io.EOF - } - - // ok, lets wait - pipe.nodata.Wait() - } - - // how much there's available for reading - canRead := pipe.write - pipe.read - // how much do they want to read? - toRead := int64(len(data)) - if toRead > canRead { - toRead = canRead - } - readAt := pipe.read - pipe.mu.Unlock() - - // read data - readAmount, err := pipe.buffer.ReadAt(data[:toRead], readAt) - - pipe.mu.Lock() - // update info on how much we have read - pipe.read += int64(readAmount) - done := pipe.read >= pipe.limit - pipe.mu.Unlock() - - if err == nil && done { - err = io.EOF - } - return readAmount, err -} - -// MultiPipe is a multipipe backed by a single file. -type MultiPipe struct { - pipes []pipe -} - -// NewMultiPipeFile returns a new MultiPipe that is created in tempdir -// if tempdir == "" the fill will be created it into os.TempDir. -func NewMultiPipeFile(tempdir string, pipeCount, pipeSize int64) (*MultiPipe, error) { - tempfile, err := ioutil.TempFile(tempdir, "multifilepipe") - if err != nil { - return nil, err - } - - err = tempfile.Truncate(pipeCount * pipeSize) - if err != nil { - closeErr := tempfile.Close() - if closeErr != nil { - return nil, fmt.Errorf("%v/%v", err, closeErr) - } - return nil, err - } - - multipipe := &MultiPipe{ - pipes: make([]pipe, pipeCount), - } - - handles := 2 * pipeCount - for i := range multipipe.pipes { - pipe := &multipipe.pipes[i] - pipe.buffer = offsetFile{ - file: tempfile, - offset: int64(i) * pipeSize, - open: &handles, - } - pipe.limit = pipeSize - pipe.nodata.L = &pipe.mu - } - - return multipipe, nil -} - -// NewMultiPipeMemory returns a new MultiPipe that is using a memory buffer. -func NewMultiPipeMemory(pipeCount, pipeSize int64) (*MultiPipe, error) { - buffer := make(memory, pipeCount*pipeSize) - - multipipe := &MultiPipe{ - pipes: make([]pipe, pipeCount), - } - - for i := range multipipe.pipes { - pipe := &multipipe.pipes[i] - pipe.buffer = buffer[i*int(pipeSize) : (i+1)*int(pipeSize)] - pipe.limit = pipeSize - pipe.nodata.L = &pipe.mu - } - - return multipipe, nil -} - -// Pipe returns the two ends of a block stream pipe. -func (multipipe *MultiPipe) Pipe(index int) (PipeReader, PipeWriter) { - pipe := &multipipe.pipes[index] - return pipeReader{pipe}, pipeWriter{pipe} -} diff --git a/vendor/storj.io/common/sync2/semaphore.go b/vendor/storj.io/common/sync2/semaphore.go deleted file mode 100644 index 9b89b0cdb..000000000 --- a/vendor/storj.io/common/sync2/semaphore.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - - "golang.org/x/sync/semaphore" -) - -// Semaphore implements a closable semaphore. -type Semaphore struct { - noCopy noCopy // nolint: structcheck - - ctx context.Context - close func() - sema *semaphore.Weighted -} - -// NewSemaphore creates a semaphore with the specified size. -func NewSemaphore(size int) *Semaphore { - sema := &Semaphore{} - sema.Init(size) - return sema -} - -// Init initializes semaphore to the specified size. -func (sema *Semaphore) Init(size int) { - sema.ctx, sema.close = context.WithCancel(context.Background()) - sema.sema = semaphore.NewWeighted(int64(size)) -} - -// Close closes the semaphore from further use. -func (sema *Semaphore) Close() { - sema.close() -} - -// Lock locks the semaphore. -func (sema *Semaphore) Lock() bool { - return sema.sema.Acquire(sema.ctx, 1) == nil -} - -// Unlock unlocks the semaphore. -func (sema *Semaphore) Unlock() { - sema.sema.Release(1) -} diff --git a/vendor/storj.io/common/sync2/sleep.go b/vendor/storj.io/common/sync2/sleep.go deleted file mode 100644 index 532dce630..000000000 --- a/vendor/storj.io/common/sync2/sleep.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "context" - "time" -) - -// Sleep implements sleeping with cancellation. -func Sleep(ctx context.Context, duration time.Duration) bool { - timer := time.NewTimer(duration) - defer timer.Stop() - - select { - case <-ctx.Done(): - return false - case <-timer.C: - return true - } -} diff --git a/vendor/storj.io/common/sync2/success_threshold.go b/vendor/storj.io/common/sync2/success_threshold.go deleted file mode 100644 index be58e93d6..000000000 --- a/vendor/storj.io/common/sync2/success_threshold.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package sync2 - -import ( - "context" - "math" - "sync" - "sync/atomic" - - "github.com/zeebo/errs" -) - -// SuccessThreshold tracks task formed by a known amount of concurrent tasks. -// It notifies the caller when reached a specific successful threshold without -// interrupting the remaining tasks. -type SuccessThreshold struct { - noCopy noCopy // nolint: structcheck - - toSucceed int64 - pending int64 - - successes int64 - failures int64 - - done chan struct{} - once sync.Once -} - -// NewSuccessThreshold creates a SuccessThreshold with the tasks number and -// successThreshold. -// -// It returns an error if tasks is less or equal than 1 or successThreshold -// is less or equal than 0 or greater or equal than 1. -func NewSuccessThreshold(tasks int, successThreshold float64) (*SuccessThreshold, error) { - switch { - case tasks <= 1: - return nil, errs.New( - "invalid number of tasks. It must be greater than 1, got %d", tasks, - ) - case successThreshold <= 0 || successThreshold > 1: - return nil, errs.New( - "invalid successThreshold. It must be greater than 0 and less or equal to 1, got %f", successThreshold, - ) - } - - tasksToSuccess := int64(math.Ceil(float64(tasks) * successThreshold)) - - // just in case of floating point issues - if tasksToSuccess > int64(tasks) { - tasksToSuccess = int64(tasks) - } - - return &SuccessThreshold{ - toSucceed: tasksToSuccess, - pending: int64(tasks), - done: make(chan struct{}), - }, nil -} - -// Success tells the SuccessThreshold that one tasks was successful. -func (threshold *SuccessThreshold) Success() { - atomic.AddInt64(&threshold.successes, 1) - - if atomic.AddInt64(&threshold.toSucceed, -1) <= 0 { - threshold.markAsDone() - } - - if atomic.AddInt64(&threshold.pending, -1) <= 0 { - threshold.markAsDone() - } -} - -// Failure tells the SuccessThreshold that one task was a failure. -func (threshold *SuccessThreshold) Failure() { - atomic.AddInt64(&threshold.failures, 1) - - if atomic.AddInt64(&threshold.pending, -1) <= 0 { - threshold.markAsDone() - } -} - -// Wait blocks the caller until the successThreshold is reached or all the tasks -// have finished. -func (threshold *SuccessThreshold) Wait(ctx context.Context) { - select { - case <-ctx.Done(): - case <-threshold.done: - } -} - -// markAsDone finalizes threshold closing the completed channel just once. -// It's safe to be called multiple times. -func (threshold *SuccessThreshold) markAsDone() { - threshold.once.Do(func() { - close(threshold.done) - }) -} - -// SuccessCount returns the number of successes so far. -func (threshold *SuccessThreshold) SuccessCount() int { - return int(atomic.LoadInt64(&threshold.successes)) -} - -// FailureCount returns the number of failures so far. -func (threshold *SuccessThreshold) FailureCount() int { - return int(atomic.LoadInt64(&threshold.failures)) -} diff --git a/vendor/storj.io/common/sync2/tee.go b/vendor/storj.io/common/sync2/tee.go deleted file mode 100644 index 9cf9d6ff1..000000000 --- a/vendor/storj.io/common/sync2/tee.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "io" - "sync" - "sync/atomic" - - "github.com/calebcase/tmpfile" -) - -type tee struct { - noCopy noCopy // nolint: structcheck - - buffer ReadAtWriteAtCloser - open *int64 - - mu sync.Mutex - nodata sync.Cond - noreader sync.Cond - - maxRead int64 - write int64 - - writerDone bool - writerErr error -} - -// NewTeeFile returns a tee that uses file-system to offload memory. -func NewTeeFile(readers int, tempdir string) ([]PipeReader, PipeWriter, error) { - file, err := tmpfile.New(tempdir, "tee") - if err != nil { - return nil, nil, err - } - - handles := int64(readers + 1) // +1 for the writer - - buffer := &offsetFile{ - file: file, - open: &handles, - } - - return newTee(buffer, readers, &handles) -} - -// NewTeeInmemory returns a tee that uses inmemory. -func NewTeeInmemory(readers int, allocMemory int64) ([]PipeReader, PipeWriter, error) { - handles := int64(readers + 1) // +1 for the writer - memory := memory(make([]byte, allocMemory)) - return newTee(memory, readers, &handles) -} - -func newTee(buffer ReadAtWriteAtCloser, readers int, open *int64) ([]PipeReader, PipeWriter, error) { - tee := &tee{ - buffer: buffer, - open: open, - } - tee.nodata.L = &tee.mu - tee.noreader.L = &tee.mu - - teeReaders := make([]PipeReader, readers) - for i := 0; i < readers; i++ { - teeReaders[i] = &teeReader{tee: tee} - } - - return teeReaders, &teeWriter{tee}, nil -} - -type teeReader struct { - tee *tee - pos int64 - closed int32 -} - -type teeWriter struct{ tee *tee } - -// Read reads from the tee returning io.EOF when writer is closed or bufSize is reached. -// -// It will block if the writer has not provided the data yet. -func (reader *teeReader) Read(data []byte) (n int, err error) { - tee := reader.tee - tee.mu.Lock() - - // fail fast on writer error - if tee.writerErr != nil && tee.writerErr != io.EOF { - tee.mu.Unlock() - return 0, tee.writerErr - } - - toRead := int64(len(data)) - end := reader.pos + toRead - - if end > tee.maxRead { - tee.maxRead = end - tee.noreader.Broadcast() - } - - // wait until we have any data to read - for reader.pos >= tee.write { - // has the writer finished? - if tee.writerDone { - tee.mu.Unlock() - return 0, tee.writerErr - } - - // ok, let's wait - tee.nodata.Wait() - } - - // how much there's available for reading - canRead := tee.write - reader.pos - if toRead > canRead { - toRead = canRead - } - readAt := reader.pos - tee.mu.Unlock() - - // read data - readAmount, err := tee.buffer.ReadAt(data[:toRead], readAt) - reader.pos += int64(readAmount) - - return readAmount, err -} - -// Write writes to the buffer returning io.ErrClosedPipe when limit is reached. -// -// It will block until at least one reader require the data. -func (writer *teeWriter) Write(data []byte) (n int, err error) { - tee := writer.tee - tee.mu.Lock() - - // have we closed already - if tee.writerDone { - tee.mu.Unlock() - return 0, io.ErrClosedPipe - } - - for tee.write > tee.maxRead { - // are all readers already closed? - if atomic.LoadInt64(tee.open) <= 1 { - tee.mu.Unlock() - return 0, io.ErrClosedPipe - } - // wait until new data is required by any reader - tee.noreader.Wait() - } - - writeAt := tee.write - tee.mu.Unlock() - - // write data to buffer - writeAmount, err := tee.buffer.WriteAt(data, writeAt) - - tee.mu.Lock() - // update writing head - tee.write += int64(writeAmount) - // wake up reader - tee.nodata.Broadcast() - tee.mu.Unlock() - - return writeAmount, err -} - -// Close implements io.Reader Close. -func (reader *teeReader) Close() error { return reader.CloseWithError(nil) } - -// Close implements io.Writer Close. -func (writer *teeWriter) Close() error { return writer.CloseWithError(nil) } - -// CloseWithError implements closing with error. -func (reader *teeReader) CloseWithError(reason error) (err error) { - tee := reader.tee - if atomic.CompareAndSwapInt32(&reader.closed, 0, 1) { - err = tee.buffer.Close() - } - - tee.mu.Lock() - tee.noreader.Broadcast() - tee.mu.Unlock() - - return err -} - -// CloseWithError implements closing with error. -func (writer *teeWriter) CloseWithError(reason error) error { - if reason == nil { - reason = io.EOF - } - - tee := writer.tee - tee.mu.Lock() - if tee.writerDone { - tee.mu.Unlock() - return io.ErrClosedPipe - } - tee.writerDone = true - tee.writerErr = reason - tee.nodata.Broadcast() - tee.mu.Unlock() - - return tee.buffer.Close() -} diff --git a/vendor/storj.io/common/sync2/throttle.go b/vendor/storj.io/common/sync2/throttle.go deleted file mode 100644 index dd35b59c2..000000000 --- a/vendor/storj.io/common/sync2/throttle.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "sync" -) - -// Throttle implements two-sided throttling, between a consumer and producer. -type Throttle struct { - noCopy noCopy // nolint: structcheck - - mu sync.Mutex - consumer sync.Cond - producer sync.Cond - - // error tracking for terminating Consume and Allocate - errs []error - - // how much is available in the throttle - // consumer decreases availability and blocks when it's below zero - // producer increses availability and blocks as needed - available int64 -} - -// NewThrottle returns a new Throttle primitive. -func NewThrottle() *Throttle { - var throttle Throttle - throttle.consumer.L = &throttle.mu - throttle.producer.L = &throttle.mu - return &throttle -} - -// Consume subtracts amount from the throttle. -func (throttle *Throttle) Consume(amount int64) error { - throttle.mu.Lock() - defer throttle.mu.Unlock() - throttle.available -= amount - throttle.producer.Signal() - return throttle.combinedError() -} - -// ConsumeOrWait tries to consume at most maxAmount. -func (throttle *Throttle) ConsumeOrWait(maxAmount int64) (int64, error) { - throttle.mu.Lock() - defer throttle.mu.Unlock() - - for throttle.alive() && throttle.available <= 0 { - throttle.consumer.Wait() - } - - available := throttle.available - if available > maxAmount { - available = maxAmount - } - throttle.available -= available - throttle.producer.Signal() - - return available, throttle.combinedError() -} - -// WaitUntilAbove waits until availability drops below limit. -func (throttle *Throttle) WaitUntilAbove(limit int64) error { - throttle.mu.Lock() - defer throttle.mu.Unlock() - for throttle.alive() && throttle.available <= limit { - throttle.consumer.Wait() - } - return throttle.combinedError() -} - -// Produce adds amount to the throttle. -func (throttle *Throttle) Produce(amount int64) error { - throttle.mu.Lock() - defer throttle.mu.Unlock() - throttle.available += amount - throttle.consumer.Signal() - return throttle.combinedError() -} - -// ProduceAndWaitUntilBelow adds amount to the throttle and waits until it's below the given threshold. -func (throttle *Throttle) ProduceAndWaitUntilBelow(amount, limit int64) error { - throttle.mu.Lock() - defer throttle.mu.Unlock() - throttle.available += amount - throttle.consumer.Signal() - for throttle.alive() && throttle.available >= limit { - throttle.producer.Wait() - } - return throttle.combinedError() -} - -// WaitUntilBelow waits until availability drops below limit. -func (throttle *Throttle) WaitUntilBelow(limit int64) error { - throttle.mu.Lock() - defer throttle.mu.Unlock() - for throttle.alive() && throttle.available >= limit { - throttle.producer.Wait() - } - return throttle.combinedError() -} - -// Fail stops both consumer and allocator. -func (throttle *Throttle) Fail(err error) { - throttle.mu.Lock() - defer throttle.mu.Unlock() - - throttle.errs = append(throttle.errs, err) - throttle.consumer.Signal() - throttle.producer.Signal() -} - -// must hold mutex when calling this. -func (throttle *Throttle) alive() bool { return len(throttle.errs) == 0 } - -func (throttle *Throttle) combinedError() error { - if len(throttle.errs) == 0 { - return nil - } - // TODO: combine errors - return throttle.errs[0] -} - -// Err returns the finishing error. -func (throttle *Throttle) Err() error { - throttle.mu.Lock() - defer throttle.mu.Unlock() - return throttle.combinedError() -} diff --git a/vendor/storj.io/common/sync2/workgroup.go b/vendor/storj.io/common/sync2/workgroup.go deleted file mode 100644 index 19c1a27c6..000000000 --- a/vendor/storj.io/common/sync2/workgroup.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information - -package sync2 - -import ( - "sync" -) - -// WorkGroup implements waitable and closable group of workers. -type WorkGroup struct { - noCopy noCopy // nolint: structcheck - - mu sync.Mutex - cond sync.Cond - - initialized bool - closed bool - workers int -} - -// init initializes work group. -func (group *WorkGroup) init() { - if !group.initialized { - group.cond.L = &group.mu - } -} - -// Go starts func and tracks the execution. -// Returns false when WorkGroup has been closed. -func (group *WorkGroup) Go(fn func()) bool { - if !group.Start() { - return false - } - go func() { - defer group.Done() - fn() - }() - return true -} - -// Start returns true when work can be started. -func (group *WorkGroup) Start() bool { - group.mu.Lock() - defer group.mu.Unlock() - - group.init() - if group.closed { - return false - } - group.workers++ - return true -} - -// Done finishes a pending work item. -func (group *WorkGroup) Done() { - group.mu.Lock() - defer group.mu.Unlock() - - group.workers-- - if group.workers < 0 { - panic("worker count below zero") - } - if group.workers == 0 { - group.cond.Broadcast() - } -} - -// Wait waits for all workers to finish. -func (group *WorkGroup) Wait() { - group.mu.Lock() - defer group.mu.Unlock() - - group.init() - - for group.workers != 0 { - group.cond.Wait() - } -} - -// Close prevents from new work being started. -func (group *WorkGroup) Close() { - group.mu.Lock() - defer group.mu.Unlock() - - group.init() - group.closed = true -} diff --git a/vendor/storj.io/common/uuid/db.go b/vendor/storj.io/common/uuid/db.go deleted file mode 100644 index 3e44d728a..000000000 --- a/vendor/storj.io/common/uuid/db.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uuid - -import ( - "database/sql/driver" -) - -// Value implements sql/driver.Valuer interface. -func (uuid UUID) Value() (driver.Value, error) { - return uuid[:], nil -} - -// Scan implements sql.Scanner interface. -func (uuid *UUID) Scan(value interface{}) error { - switch value := value.(type) { - case []byte: - x, err := FromBytes(value) - if err != nil { - return Error.Wrap(err) - } - *uuid = x - return nil - case string: - x, err := FromString(value) - if err != nil { - return Error.Wrap(err) - } - *uuid = x - return nil - default: - return Error.New("unable to scan %T into UUID", value) - } -} - -// NullUUID represents a UUID that may be null. -// NullUUID implements the Scanner interface so it can be used -// as a scan destination, similar to sql.NullString. -type NullUUID struct { - UUID UUID - Valid bool // Valid is true if UUID is not NULL -} - -// Value implements sql/driver.Valuer interface. -func (n NullUUID) Value() (driver.Value, error) { - if !n.Valid { - return nil, nil - } - return n.UUID.Value() -} - -// Scan implements sql.Scanner interface. -func (n *NullUUID) Scan(value interface{}) error { - if value == nil { - n.UUID, n.Valid = UUID{}, false - return nil - } - - n.Valid = true - return n.UUID.Scan(value) -} diff --git a/vendor/storj.io/common/uuid/fuzz.go b/vendor/storj.io/common/uuid/fuzz.go deleted file mode 100644 index 39d812f6e..000000000 --- a/vendor/storj.io/common/uuid/fuzz.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build gofuzz - -package uuid - -// To run fuzzing tests: -// -// clone github.com/storj/fuzz-corpus -// -// Install fuzzing tools: -// GO111MODULE=off go get github.com/dvyukov/go-fuzz/... -// -// Build binaries: -// go-fuzz-build . -// -// Run with test corpus: -// go-fuzz -bin uuid-fuzz.zip -workdir $FUZZCORPUS/uuid/testdata - -// Fuzz implements a simple fuzz test for uuid.Parse. -func Fuzz(data []byte) int { - _, err := FromString(string(data)) - if err != nil { - return 0 - } - return 1 -} diff --git a/vendor/storj.io/common/uuid/uuid.go b/vendor/storj.io/common/uuid/uuid.go deleted file mode 100644 index b8a290176..000000000 --- a/vendor/storj.io/common/uuid/uuid.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package uuid implements UUID v4 based on RFC4122. -package uuid - -import ( - "crypto/rand" - "encoding/hex" - "io" - - "github.com/zeebo/errs" -) - -// Error is the default error class for uuid. -var Error = errs.Class("uuid") - -// UUID is big-endian encoded UUID. -// -// UUID can be of any version or variant. -type UUID [16]byte - -// New returns a random UUID (version 4 variant 2). -func New() (UUID, error) { - return newRandomFromReader(rand.Reader) -} - -// newRandomFromReader returns a random UUID (version 4 variant 2) -// using a custom reader. -func newRandomFromReader(r io.Reader) (UUID, error) { - var uuid UUID - _, err := io.ReadFull(r, uuid[:]) - if err != nil { - return uuid, Error.Wrap(err) - } - - // version 4, variant 2 - uuid[6] = (uuid[6] & 0x0f) | 0x40 - uuid[8] = (uuid[8] & 0x3f) | 0x80 - return uuid, nil -} - -// IsZero returns true when all bytes in uuid are 0. -func (uuid UUID) IsZero() bool { return uuid == UUID{} } - -// String returns uuid in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format. -func (uuid UUID) String() string { - s := [36]byte{8: '-', 13: '-', 18: '-', 23: '-'} - hex.Encode(s[0:8], uuid[0:4]) - hex.Encode(s[9:13], uuid[4:6]) - hex.Encode(s[14:18], uuid[6:8]) - hex.Encode(s[19:23], uuid[8:10]) - hex.Encode(s[24:36], uuid[10:16]) - return string(s[:]) -} - -// FromBytes converts big-endian raw-bytes to an UUID. -// -// FromBytes allows for any version or variant of an UUID. -func FromBytes(bytes []byte) (UUID, error) { - var uuid UUID - if len(uuid) != len(bytes) { - return uuid, Error.New("bytes have wrong length %d expected %d", len(bytes), len(uuid)) - } - copy(uuid[:], bytes) - return uuid, nil -} - -// FromString parses "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" string form. -// -// FromString allows for any version or variant of an UUID. -func FromString(s string) (UUID, error) { - var uuid UUID - if len(s) != 36 { - return uuid, Error.New("invalid string length %d expected %d", len(s), 36) - } - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return uuid, Error.New("invalid string") - } - - var err error - _, err = hex.Decode(uuid[0:4], []byte(s)[0:8]) - if err != nil { - return uuid, Error.New("invalid string") - } - _, err = hex.Decode(uuid[4:6], []byte(s)[9:13]) - if err != nil { - return uuid, Error.New("invalid string") - } - _, err = hex.Decode(uuid[6:8], []byte(s)[14:18]) - if err != nil { - return uuid, Error.New("invalid string") - } - _, err = hex.Decode(uuid[8:10], []byte(s)[19:23]) - if err != nil { - return uuid, Error.New("invalid string") - } - _, err = hex.Decode(uuid[10:16], []byte(s)[24:36]) - if err != nil { - return uuid, Error.New("invalid string") - } - - return uuid, nil -} - -// MarshalText marshals UUID in `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` form. -func (uuid UUID) MarshalText() ([]byte, error) { - return []byte(uuid.String()), nil -} - -// UnmarshalText unmarshals UUID from `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. -func (uuid *UUID) UnmarshalText(b []byte) error { - x, err := FromString(string(b)) - if err != nil { - return Error.Wrap(err) - } - *uuid = x - return nil -} - -// MarshalJSON marshals UUID in `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` form. -func (uuid UUID) MarshalJSON() ([]byte, error) { - return []byte(`"` + uuid.String() + `"`), nil -} - -// UnmarshalJSON unmarshals UUID from `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"`. -func (uuid *UUID) UnmarshalJSON(b []byte) error { - if len(b) != 36+2 { - return Error.New("bytes have wrong length %d expected %d", len(b), 36+2) - } - if b[0] != '"' && b[len(b)-1] != '"' { - return Error.New("expected quotes around string") - } - - x, err := FromString(string(b[1 : len(b)-1])) - if err != nil { - return Error.Wrap(err) - } - *uuid = x - return nil -} diff --git a/vendor/storj.io/drpc/.gitignore b/vendor/storj.io/drpc/.gitignore deleted file mode 100644 index c24adb9d0..000000000 --- a/vendor/storj.io/drpc/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.test -.vscode -vendor diff --git a/vendor/storj.io/drpc/.golangci.yml b/vendor/storj.io/drpc/.golangci.yml deleted file mode 100644 index 32d8f65fd..000000000 --- a/vendor/storj.io/drpc/.golangci.yml +++ /dev/null @@ -1,129 +0,0 @@ -run: - deadline: 10m - issues-exit-code: 1 - tests: true - - skip-files: - - ".*\\.pb\\.go$" - - ".*\\.dbx\\.go$" - - -linters: - enable: - - govet # check standard vet rules - - golint # check standard linting rules - - staticcheck # comprehensive checks - - errcheck # find unchecked errors - - ineffassign # find ineffective assignments - - varcheck # find unused global variables and constants - - structcheck # check for unused struct parameters - - deadcode # find code that is not used - - bodyclose # find unclosed http response bodies - - nakedret # check for naked returns - - gofmt # sanity check formatting - - misspell # check spelling - - unconvert # remove unnecessary conversions - - scopelint # checks for unpinned variables - - gocritic # checks for style, performance issues, and common programming errors - - dogsled # checks for too many ignored arguments - - goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false] - - gosec - #TODO#- whitespace # checks for leading/trailing newlines - #TODO#- unparam # check for unused parameters - #TODO#- maligned # check for better memory usage - #TODO#- prealloc # easy optimizations - disable: - - godox - - wsl # too much noise - - goimports # disabled, because it's slow, using scripts/check-imports.go instead. - - goconst # check for things that could be replaced by constants - - gocyclo # needs tweaking - - depguard # unused - - stylecheck # has false positives - - dupl # slow - - interfacer # not that useful - - gosimple # part of staticcheck - - unused # part of staticcheck - - lll - - rowserrcheck # checks if sql.Rows.Err is checked correctly - Disabled because it reports false positive with defer statements after Query call - fast: false - -output: - format: colored-line-number - print-issued-lines: true - print-linter-name: true - -linters-settings: - errcheck: - # report about not checking of errors in type assetions: `a := b.(MyStruct)`; - # default is false: such cases aren't reported by default. - check-type-assertions: false - - # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; - # default is false: such cases aren't reported by default. - check-blank: false - govet: - # report about shadowed variables - #TODO# check-shadowing: true - - # Obtain type information from installed (to $GOPATH/pkg) package files: - # golangci-lint will execute `go install -i` and `go test -i` for analyzed packages - # before analyzing them. - # Enable this option only if all conditions are met: - # 1. you use only "fast" linters (--fast e.g.): no program loading occurs - # 2. you use go >= 1.10 - # 3. you do repeated runs (false for CI) or cache $GOPATH/pkg or `go env GOCACHE` dir in CI. - use-installed-packages: false - gocritic: - disabled-checks: - - ifElseChain - goimports: - local: "storj.io" - golint: - min-confidence: 0.8 - gofmt: - simplify: true - gocyclo: - min-complexity: 10 - maligned: - suggest-new: true - dupl: - threshold: 150 - goconst: - min-len: 3 - min-occurrences: 3 - misspell: - lll: - line-length: 140 - tab-width: 1 - unused: - # treat code as a program (not a library) and report unused exported identifiers; default is false. - # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find funcs usages. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false - unparam: - # call graph construction algorithm (cha, rta). In general, use cha for libraries, - # and rta for programs with main packages. Default is cha. - algo: cha - - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. - # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find external interfaces. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false - nakedret: - # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 - max-func-lines: 30 - prealloc: - # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. - # True by default. - simple: true - range-loops: true # Report preallocation suggestions on range loops, true by default - for-loops: false # Report preallocation suggestions on for loops, false by default - -issues: - max-issues-per-linter: 0 - max-same-issues: 0 - new: false - exclude-use-default: false diff --git a/vendor/storj.io/drpc/Dockerfile.jenkins b/vendor/storj.io/drpc/Dockerfile.jenkins deleted file mode 100644 index bd4da981f..000000000 --- a/vendor/storj.io/drpc/Dockerfile.jenkins +++ /dev/null @@ -1,11 +0,0 @@ -FROM golang:1.13.0 - -# Linters - -RUN GO111MODULE=on go get honnef.co/go/tools/cmd/staticcheck@2019.2.3 -RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.23.1 - -# Set our entrypoint to close after 28 minutes, and forcefully close at 30 minutes. -# This is to prevent Jenkins collecting cats. - -ENTRYPOINT ["timeout", "-k30m", "28m"] diff --git a/vendor/storj.io/drpc/Jenkinsfile b/vendor/storj.io/drpc/Jenkinsfile deleted file mode 100644 index b69937da1..000000000 --- a/vendor/storj.io/drpc/Jenkinsfile +++ /dev/null @@ -1,27 +0,0 @@ -pipeline { - agent { - dockerfile { - filename 'Dockerfile.jenkins' - args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod' - label 'main' - } - } - stages { - stage('Download') { - steps { - checkout scm - sh 'make download' - } - } - stage('Test') { - steps { - sh 'make test' - } - } - stage('Lint') { - steps { - sh 'make lint' - } - } - } -} diff --git a/vendor/storj.io/drpc/LICENSE b/vendor/storj.io/drpc/LICENSE deleted file mode 100644 index 8d869750c..000000000 --- a/vendor/storj.io/drpc/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Storj Labs, Inc. - -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/storj.io/drpc/Makefile b/vendor/storj.io/drpc/Makefile deleted file mode 100644 index 3d21e2ce8..000000000 --- a/vendor/storj.io/drpc/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -.DEFAULT_GOAL = check - -.PHONY: check -check: generate build lint test docs - -.PHONY: build -build: - ./scripts/run.sh go build ./... - -.PHONY: docs -docs: - ./scripts/docs.sh - -.PHONY: download -download: - ./scripts/run.sh go mod download - -.PHONY: generate -generate: - ./scripts/run.sh go generate ./... - -.PHONY: lint -lint: - ./scripts/run.sh staticcheck ./... - ./scripts/run.sh golangci-lint -j=2 run - -.PHONY: tidy -tidy: - ./scripts/run.sh go mod tidy - -.PHONY: test -test: - ./scripts/run.sh go test ./... -count=1 diff --git a/vendor/storj.io/drpc/README.md b/vendor/storj.io/drpc/README.md deleted file mode 100644 index 10a32c410..000000000 --- a/vendor/storj.io/drpc/README.md +++ /dev/null @@ -1,137 +0,0 @@ -# package drpc - -`import "storj.io/drpc"` - -Package drpc is a light replacement for gprc. - -## Usage - -```go -var ( - Error = errs.Class("drpc") - InternalError = errs.Class("internal error") - ProtocolError = errs.Class("protocol error") -) -``` -These error classes represent some common errors that drpc generates. - -#### type Conn - -```go -type Conn interface { - // Close closes the connection. - Close() error - - // Closed returns true if the connection is definitely closed. - Closed() bool - - // Transport returns the transport the connection is using. - Transport() Transport - - // Invoke issues a unary rpc to the remote. Only one Invoke or Stream may be - // open at once. - Invoke(ctx context.Context, rpc string, in, out Message) error - - // NewStream starts a stream with the remote. Only one Invoke or Stream may be - // open at once. - NewStream(ctx context.Context, rpc string) (Stream, error) -} -``` - -Conn represents a client connection to a server. - -#### type Description - -```go -type Description interface { - // NumMethods returns the number of methods available. - NumMethods() int - - // Method returns the information about the nth method along with a handler - // to invoke it. The method interface that it returns is expected to be - // a method expression like `(*Type).HandlerName`. - Method(n int) (rpc string, receiver Receiver, method interface{}, ok bool) -} -``` - -Description is the interface implemented by things that can be registered by a -Server. - -#### type Handler - -```go -type Handler interface { - HandleRPC(stream Stream, rpc string) (err error) -} -``` - -Handler handles streams and rpcs dispatched to it by a Server. - -#### type Message - -```go -type Message interface { - Reset() - String() string - ProtoMessage() -} -``` - -Message is a protobuf message, just here so protobuf isn't necessary to import -or be exposed in the types. - -#### type Mux - -```go -type Mux interface { - Register(srv interface{}, desc Description) error -} -``` - -Mux is a type that can have an implementation and a Description registered with -it. - -#### type Receiver - -```go -type Receiver = func(srv interface{}, ctx context.Context, in1, in2 interface{}) (out Message, err error) -``` - -Receiver is invoked by a server for a given rpc. - -#### type Stream - -```go -type Stream interface { - // Context returns the context associated with the stream. It is canceled - // when the Stream is closed and no more messages will ever be sent or - // received on it. - Context() context.Context - - // MsgSend sends the Message to the remote. - MsgSend(msg Message) error - - // MsgRecv receives a Message from the remote. - MsgRecv(msg Message) error - - // CloseSend signals to the remote that we will no longer send any messages. - CloseSend() error - - // Close closes the stream. - Close() error -} -``` - -Stream is a bi-directional stream of messages to some other party. - -#### type Transport - -```go -type Transport interface { - io.Reader - io.Writer - io.Closer -} -``` - -Transport is an interface describing what is required for a drpc connection. diff --git a/vendor/storj.io/drpc/doc.go b/vendor/storj.io/drpc/doc.go deleted file mode 100644 index a551f92af..000000000 --- a/vendor/storj.io/drpc/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpc is a light replacement for gprc. -package drpc diff --git a/vendor/storj.io/drpc/drpc.go b/vendor/storj.io/drpc/drpc.go deleted file mode 100644 index 8618d252b..000000000 --- a/vendor/storj.io/drpc/drpc.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpc - -import ( - "context" - "io" - - "github.com/zeebo/errs" -) - -// These error classes represent some common errors that drpc generates. -var ( - Error = errs.Class("drpc") - InternalError = errs.Class("internal error") - ProtocolError = errs.Class("protocol error") -) - -// Transport is an interface describing what is required for a drpc connection. -type Transport interface { - io.Reader - io.Writer - io.Closer -} - -// Message is a protobuf message, just here so protobuf isn't necessary to -// import or be exposed in the types. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// Conn represents a client connection to a server. -type Conn interface { - // Close closes the connection. - Close() error - - // Closed returns true if the connection is definitely closed. - Closed() bool - - // Transport returns the transport the connection is using. - Transport() Transport - - // Invoke issues a unary rpc to the remote. Only one Invoke or Stream may be - // open at once. - Invoke(ctx context.Context, rpc string, in, out Message) error - - // NewStream starts a stream with the remote. Only one Invoke or Stream may be - // open at once. - NewStream(ctx context.Context, rpc string) (Stream, error) -} - -// Stream is a bi-directional stream of messages to some other party. -type Stream interface { - // Context returns the context associated with the stream. It is canceled - // when the Stream is closed and no more messages will ever be sent or - // received on it. - Context() context.Context - - // MsgSend sends the Message to the remote. - MsgSend(msg Message) error - - // MsgRecv receives a Message from the remote. - MsgRecv(msg Message) error - - // CloseSend signals to the remote that we will no longer send any messages. - CloseSend() error - - // Close closes the stream. - Close() error -} - -// Receiver is invoked by a server for a given rpc. -type Receiver = func(srv interface{}, ctx context.Context, in1, in2 interface{}) (out Message, err error) - -// Description is the interface implemented by things that can be registered by -// a Server. -type Description interface { - // NumMethods returns the number of methods available. - NumMethods() int - - // Method returns the information about the nth method along with a handler - // to invoke it. The method interface that it returns is expected to be - // a method expression like `(*Type).HandlerName`. - Method(n int) (rpc string, receiver Receiver, method interface{}, ok bool) -} - -// Mux is a type that can have an implementation and a Description registered with it. -type Mux interface { - Register(srv interface{}, desc Description) error -} - -// Handler handles streams and rpcs dispatched to it by a Server. -type Handler interface { - HandleRPC(stream Stream, rpc string) (err error) -} diff --git a/vendor/storj.io/drpc/drpccache/README.md b/vendor/storj.io/drpc/drpccache/README.md deleted file mode 100644 index 5739abcc3..000000000 --- a/vendor/storj.io/drpc/drpccache/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# package drpccache - -`import "storj.io/drpc/drpccache"` - -Package drpccache implements per stream cache for drpc. - -## Usage - -#### func WithContext - -```go -func WithContext(parent context.Context, cache *Cache) context.Context -``` -WithContext returns a context with the value cache associated with the context. - -#### type Cache - -```go -type Cache struct { -} -``` - -Cache is a per stream cache. - -#### func FromContext - -```go -func FromContext(ctx context.Context) *Cache -``` -FromContext returns a cache from a context. - -Example usage: - - cache := drpccache.FromContext(stream.Context()) - if cache != nil { - value := cache.LoadOrCreate("initialized", func() (interface{}) { - return 42 - }) - } - -#### func New - -```go -func New() *Cache -``` -New returns a new cache. - -#### func (*Cache) Clear - -```go -func (cache *Cache) Clear() -``` -Clear clears the cache. - -#### func (*Cache) Load - -```go -func (cache *Cache) Load(key interface{}) interface{} -``` -Load returns the value with the given key. - -#### func (*Cache) LoadOrCreate - -```go -func (cache *Cache) LoadOrCreate(key interface{}, fn func() interface{}) interface{} -``` -LoadOrCreate returns the value with the given key. - -#### func (*Cache) Store - -```go -func (cache *Cache) Store(key, value interface{}) -``` -Store sets the value at a key. diff --git a/vendor/storj.io/drpc/drpccache/cache.go b/vendor/storj.io/drpc/drpccache/cache.go deleted file mode 100644 index 040598335..000000000 --- a/vendor/storj.io/drpc/drpccache/cache.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpccache - -import ( - "context" - "sync" -) - -type cacheKey struct{} - -// Cache is a per stream cache. -type Cache struct { - mu sync.Mutex - values map[interface{}]interface{} -} - -// New returns a new cache. -func New() *Cache { return &Cache{} } - -// FromContext returns a cache from a context. -// -// Example usage: -// -// cache := drpccache.FromContext(stream.Context()) -// if cache != nil { -// value := cache.LoadOrCreate("initialized", func() (interface{}) { -// return 42 -// }) -// } -func FromContext(ctx context.Context) *Cache { - value := ctx.Value(cacheKey{}) - if value == nil { - return nil - } - - cache, ok := value.(*Cache) - if !ok { - return nil - } - - return cache -} - -// WithContext returns a context with the value cache associated with the context. -func WithContext(parent context.Context, cache *Cache) context.Context { - return context.WithValue(parent, cacheKey{}, cache) -} - -// init ensures that the values map exist. -func (cache *Cache) init() { - if cache.values == nil { - cache.values = map[interface{}]interface{}{} - } -} - -// Clear clears the cache. -func (cache *Cache) Clear() { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.values = nil -} - -// Store sets the value at a key. -func (cache *Cache) Store(key, value interface{}) { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.init() - cache.values[key] = value -} - -// Load returns the value with the given key. -func (cache *Cache) Load(key interface{}) interface{} { - cache.mu.Lock() - defer cache.mu.Unlock() - - if cache.values == nil { - return nil - } - - return cache.values[key] -} - -// LoadOrCreate returns the value with the given key. -func (cache *Cache) LoadOrCreate(key interface{}, fn func() interface{}) interface{} { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.init() - - value, ok := cache.values[key] - if !ok { - value = fn() - cache.values[key] = value - } - - return value -} diff --git a/vendor/storj.io/drpc/drpccache/doc.go b/vendor/storj.io/drpc/drpccache/doc.go deleted file mode 100644 index 6926e5d4e..000000000 --- a/vendor/storj.io/drpc/drpccache/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpccache implements per stream cache for drpc. -package drpccache diff --git a/vendor/storj.io/drpc/drpcconn/README.md b/vendor/storj.io/drpc/drpcconn/README.md deleted file mode 100644 index fb6523e97..000000000 --- a/vendor/storj.io/drpc/drpcconn/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# package drpcconn - -`import "storj.io/drpc/drpcconn"` - -Package drpcconn creates a drpc client connection from a transport. - -## Usage - -#### type Conn - -```go -type Conn struct { -} -``` - -Conn is a drpc client connection. - -#### func New - -```go -func New(tr drpc.Transport) *Conn -``` -New returns a conn that uses the transport for reads and writes. - -#### func NewWithOptions - -```go -func NewWithOptions(tr drpc.Transport, opts Options) *Conn -``` -NewWithOptions returns a conn that uses the transport for reads and writes. The -Options control details of how the conn operates. - -#### func (*Conn) Close - -```go -func (c *Conn) Close() (err error) -``` -Close closes the connection. - -#### func (*Conn) Closed - -```go -func (c *Conn) Closed() bool -``` -Closed returns true if the connection is already closed. - -#### func (*Conn) Invoke - -```go -func (c *Conn) Invoke(ctx context.Context, rpc string, in, out drpc.Message) (err error) -``` -Invoke issues the rpc on the transport serializing in, waits for a response, and -deserializes it into out. Only one Invoke or Stream may be open at a time. - -#### func (*Conn) NewStream - -```go -func (c *Conn) NewStream(ctx context.Context, rpc string) (_ drpc.Stream, err error) -``` -NewStream begins a streaming rpc on the connection. Only one Invoke or Stream -may be open at a time. - -#### func (*Conn) Transport - -```go -func (c *Conn) Transport() drpc.Transport -``` -Transport returns the transport the conn is using. - -#### type Options - -```go -type Options struct { - // Manager controls the options we pass to the manager of this conn. - Manager drpcmanager.Options -} -``` - -Options controls configuration settings for a conn. diff --git a/vendor/storj.io/drpc/drpcconn/conn.go b/vendor/storj.io/drpc/drpcconn/conn.go deleted file mode 100644 index 1c7c5df89..000000000 --- a/vendor/storj.io/drpc/drpcconn/conn.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcconn - -import ( - "context" - - "github.com/gogo/protobuf/proto" - "github.com/zeebo/errs" - - "storj.io/drpc" - "storj.io/drpc/drpcmanager" - "storj.io/drpc/drpcmetadata" - "storj.io/drpc/drpcstream" - "storj.io/drpc/drpcwire" -) - -// Options controls configuration settings for a conn. -type Options struct { - // Manager controls the options we pass to the manager of this conn. - Manager drpcmanager.Options -} - -// Conn is a drpc client connection. -type Conn struct { - tr drpc.Transport - man *drpcmanager.Manager -} - -var _ drpc.Conn = (*Conn)(nil) - -// New returns a conn that uses the transport for reads and writes. -func New(tr drpc.Transport) *Conn { - return NewWithOptions(tr, Options{}) -} - -// NewWithOptions returns a conn that uses the transport for reads and writes. -// The Options control details of how the conn operates. -func NewWithOptions(tr drpc.Transport, opts Options) *Conn { - return &Conn{ - tr: tr, - man: drpcmanager.NewWithOptions(tr, opts.Manager), - } -} - -// Transport returns the transport the conn is using. -func (c *Conn) Transport() drpc.Transport { - return c.tr -} - -// Closed returns true if the connection is already closed. -func (c *Conn) Closed() bool { - return c.man.Closed() -} - -// Close closes the connection. -func (c *Conn) Close() (err error) { - return c.man.Close() -} - -// Invoke issues the rpc on the transport serializing in, waits for a response, and -// deserializes it into out. Only one Invoke or Stream may be open at a time. -func (c *Conn) Invoke(ctx context.Context, rpc string, in, out drpc.Message) (err error) { - defer mon.Task()(&ctx)(&err) - defer mon.TaskNamed("invoke" + rpc)(&ctx)(&err) - mon.Event("outgoing_requests") - mon.Event("outgoing_invokes") - - var metadata []byte - if md, ok := drpcmetadata.Get(ctx); ok { - metadata, err = drpcmetadata.Encode(metadata, md) - if err != nil { - return err - } - } - - data, err := proto.Marshal(in) - if err != nil { - return errs.Wrap(err) - } - - stream, err := c.man.NewClientStream(ctx) - if err != nil { - return err - } - defer func() { err = errs.Combine(err, stream.Close()) }() - - if err := c.doInvoke(stream, []byte(rpc), data, metadata, out); err != nil { - return err - } - return nil -} - -func (c *Conn) doInvoke(stream *drpcstream.Stream, rpc, data []byte, metadata []byte, out drpc.Message) (err error) { - if len(metadata) > 0 { - if err := stream.RawWrite(drpcwire.KindInvokeMetadata, metadata); err != nil { - return err - } - } - if err := stream.RawWrite(drpcwire.KindInvoke, rpc); err != nil { - return err - } - if err := stream.RawWrite(drpcwire.KindMessage, data); err != nil { - return err - } - if err := stream.CloseSend(); err != nil { - return err - } - if err := stream.MsgRecv(out); err != nil { - return err - } - return nil -} - -// NewStream begins a streaming rpc on the connection. Only one Invoke or Stream may -// be open at a time. -func (c *Conn) NewStream(ctx context.Context, rpc string) (_ drpc.Stream, err error) { - defer mon.Task()(&ctx)(&err) - defer mon.TaskNamed("stream" + rpc)(&ctx)(&err) - mon.Event("outgoing_requests") - mon.Event("outgoing_streams") - - var metadata []byte - if md, ok := drpcmetadata.Get(ctx); ok { - metadata, err = drpcmetadata.Encode(metadata, md) - if err != nil { - return nil, err - } - } - - stream, err := c.man.NewClientStream(ctx) - if err != nil { - return nil, err - } - - if err := c.doNewStream(stream, []byte(rpc), metadata); err != nil { - return nil, errs.Combine(err, stream.Close()) - } - return stream, nil -} - -func (c *Conn) doNewStream(stream *drpcstream.Stream, rpc []byte, metadata []byte) error { - if len(metadata) > 0 { - if err := stream.RawWrite(drpcwire.KindInvokeMetadata, metadata); err != nil { - return err - } - } - if err := stream.RawWrite(drpcwire.KindInvoke, rpc); err != nil { - return err - } - if err := stream.RawFlush(); err != nil { - return err - } - return nil -} diff --git a/vendor/storj.io/drpc/drpcconn/doc.go b/vendor/storj.io/drpc/drpcconn/doc.go deleted file mode 100644 index e2a50817e..000000000 --- a/vendor/storj.io/drpc/drpcconn/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcconn creates a drpc client connection from a transport. -package drpcconn - -import "github.com/spacemonkeygo/monkit/v3" - -var mon = monkit.Package() diff --git a/vendor/storj.io/drpc/drpcctx/README.md b/vendor/storj.io/drpc/drpcctx/README.md deleted file mode 100644 index 38f6e870a..000000000 --- a/vendor/storj.io/drpc/drpcctx/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# package drpcctx - -`import "storj.io/drpc/drpcctx"` - -Package drpcctx has helpers to interact with context.Context. - -## Usage - -#### func Transport - -```go -func Transport(ctx context.Context) (drpc.Transport, bool) -``` -Transport returns the drpc.Transport associated with the context and a bool if -it existed. - -#### func WithTransport - -```go -func WithTransport(ctx context.Context, tr drpc.Transport) context.Context -``` -WithTransport associates the drpc.Transport as a value on the context. - -#### type Tracker - -```go -type Tracker struct { - context.Context -} -``` - -Tracker keeps track of launched goroutines with a context. - -#### func NewTracker - -```go -func NewTracker(ctx context.Context) *Tracker -``` -NewTracker creates a Tracker bound to the provided context. - -#### func (*Tracker) Cancel - -```go -func (t *Tracker) Cancel() -``` -Cancel cancels the tracker's context. - -#### func (*Tracker) Run - -```go -func (t *Tracker) Run(cb func(ctx context.Context)) -``` -Run starts a goroutine running the callback with the tracker as the context. - -#### func (*Tracker) Wait - -```go -func (t *Tracker) Wait() -``` -Wait blocks until all callbacks started with Run have exited. diff --git a/vendor/storj.io/drpc/drpcctx/doc.go b/vendor/storj.io/drpc/drpcctx/doc.go deleted file mode 100644 index b098de782..000000000 --- a/vendor/storj.io/drpc/drpcctx/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcctx has helpers to interact with context.Context. -package drpcctx diff --git a/vendor/storj.io/drpc/drpcctx/transport.go b/vendor/storj.io/drpc/drpcctx/transport.go deleted file mode 100644 index 39b86a178..000000000 --- a/vendor/storj.io/drpc/drpcctx/transport.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcctx - -import ( - "context" - "sync" - - "storj.io/drpc" -) - -type transportKey struct{} - -// WithTransport associates the drpc.Transport as a value on the context. -func WithTransport(ctx context.Context, tr drpc.Transport) context.Context { - return context.WithValue(ctx, transportKey{}, tr) -} - -// Transport returns the drpc.Transport associated with the context and a bool if it -// existed. -func Transport(ctx context.Context) (drpc.Transport, bool) { - tr, ok := ctx.Value(transportKey{}).(drpc.Transport) - return tr, ok -} - -// Tracker keeps track of launched goroutines with a context. -type Tracker struct { - context.Context - cancel func() - wg sync.WaitGroup -} - -// NewTracker creates a Tracker bound to the provided context. -func NewTracker(ctx context.Context) *Tracker { - ctx, cancel := context.WithCancel(ctx) - return &Tracker{ - Context: ctx, - cancel: cancel, - } -} - -// Run starts a goroutine running the callback with the tracker as the context. -func (t *Tracker) Run(cb func(ctx context.Context)) { - t.wg.Add(1) - go t.track(cb) -} - -// track is a helper to call done on the waitgroup after the callback returns. -func (t *Tracker) track(cb func(ctx context.Context)) { - cb(t) - t.wg.Done() -} - -// Cancel cancels the tracker's context. -func (t *Tracker) Cancel() { t.cancel() } - -// Wait blocks until all callbacks started with Run have exited. -func (t *Tracker) Wait() { t.wg.Wait() } diff --git a/vendor/storj.io/drpc/drpcdebug/README.md b/vendor/storj.io/drpc/drpcdebug/README.md deleted file mode 100644 index cd833b27c..000000000 --- a/vendor/storj.io/drpc/drpcdebug/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# package drpcdebug - -`import "storj.io/drpc/drpcdebug"` - -Package drpcdebug provides helpers for debugging. - -## Usage - -#### func Log - -```go -func Log(cb func() string) -``` -Log executes the callback for a string to log if built with the debug tag. diff --git a/vendor/storj.io/drpc/drpcdebug/doc.go b/vendor/storj.io/drpc/drpcdebug/doc.go deleted file mode 100644 index 0f90ff296..000000000 --- a/vendor/storj.io/drpc/drpcdebug/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcdebug provides helpers for debugging. -package drpcdebug diff --git a/vendor/storj.io/drpc/drpcdebug/log_disabled.go b/vendor/storj.io/drpc/drpcdebug/log_disabled.go deleted file mode 100644 index 4a87b4b6d..000000000 --- a/vendor/storj.io/drpc/drpcdebug/log_disabled.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build !debug - -package drpcdebug - -// Log executes the callback for a string to log if built with the debug tag. -func Log(cb func() string) {} diff --git a/vendor/storj.io/drpc/drpcdebug/log_enabled.go b/vendor/storj.io/drpc/drpcdebug/log_enabled.go deleted file mode 100644 index a3de6d06f..000000000 --- a/vendor/storj.io/drpc/drpcdebug/log_enabled.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// +build debug - -package drpcdebug - -import ( - "log" - "os" -) - -var logger = log.New(os.Stderr, "", 0) - -// Log executes the callback for a string to log if built with the debug tag. -func Log(cb func() string) { - logger.Output(2, "\t"+cb()) -} diff --git a/vendor/storj.io/drpc/drpcerr/README.md b/vendor/storj.io/drpc/drpcerr/README.md deleted file mode 100644 index 141326d35..000000000 --- a/vendor/storj.io/drpc/drpcerr/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# package drpcerr - -`import "storj.io/drpc/drpcerr"` - -Package drpcerr lets one associate error codes with errors. - -## Usage - -#### func Code - -```go -func Code(err error) uint64 -``` -Code returns the error code associated with the error or 0 if none is. - -#### func WithCode - -```go -func WithCode(err error, code uint64) error -``` -WithCode associates the code with the error if it is non nil and the code is -non-zero. diff --git a/vendor/storj.io/drpc/drpcerr/doc.go b/vendor/storj.io/drpc/drpcerr/doc.go deleted file mode 100644 index 53ff88e16..000000000 --- a/vendor/storj.io/drpc/drpcerr/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcerr lets one associate error codes with errors. -package drpcerr diff --git a/vendor/storj.io/drpc/drpcerr/err.go b/vendor/storj.io/drpc/drpcerr/err.go deleted file mode 100644 index f0383bfe6..000000000 --- a/vendor/storj.io/drpc/drpcerr/err.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcerr - -// Code returns the error code associated with the error or 0 if none is. -func Code(err error) uint64 { - for i := 0; i < 100; i++ { - switch v := err.(type) { - case interface{ Code() uint64 }: - return v.Code() - case interface{ Cause() error }: - err = v.Cause() - case interface{ Unwrap() error }: - err = v.Unwrap() - case nil: - return 0 - } - } - return 0 -} - -// WithCode associates the code with the error if it is non nil and the code -// is non-zero. -func WithCode(err error, code uint64) error { - if err == nil || code == 0 { - return err - } - return &codeErr{err: err, code: code} -} - -type codeErr struct { - err error - code uint64 -} - -func (c *codeErr) Error() string { return c.err.Error() } -func (c *codeErr) Unwrap() error { return c.err } -func (c *codeErr) Cause() error { return c.err } -func (c *codeErr) Code() uint64 { return c.code } diff --git a/vendor/storj.io/drpc/drpcmanager/README.md b/vendor/storj.io/drpc/drpcmanager/README.md deleted file mode 100644 index e89564678..000000000 --- a/vendor/storj.io/drpc/drpcmanager/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# package drpcmanager - -`import "storj.io/drpc/drpcmanager"` - -Package drpcmanager reads packets from a transport to make streams. - -## Usage - -#### type Manager - -```go -type Manager struct { -} -``` - -Manager handles the logic of managing a transport for a drpc client or server. -It ensures that the connection is always being read from, that it is closed in -the case that the manager is and forwarding drpc protocol messages to the -appropriate stream. - -#### func New - -```go -func New(tr drpc.Transport) *Manager -``` -New returns a new Manager for the transport. - -#### func NewWithOptions - -```go -func NewWithOptions(tr drpc.Transport, opts Options) *Manager -``` -NewWithOptions returns a new manager for the transport. It uses the provided -options to manage details of how it uses it. - -#### func (*Manager) Close - -```go -func (m *Manager) Close() error -``` -Close closes the transport the manager is using. - -#### func (*Manager) Closed - -```go -func (m *Manager) Closed() bool -``` -Closed returns if the manager has been closed. - -#### func (*Manager) NewClientStream - -```go -func (m *Manager) NewClientStream(ctx context.Context) (stream *drpcstream.Stream, err error) -``` -NewClientStream starts a stream on the managed transport for use by a client. - -#### func (*Manager) NewServerStream - -```go -func (m *Manager) NewServerStream(ctx context.Context) (stream *drpcstream.Stream, rpc string, err error) -``` -NewServerStream starts a stream on the managed transport for use by a server. It -does this by waiting for the client to issue an invoke message and returning the -details. - -#### type Options - -```go -type Options struct { - // WriterBufferSize controls the size of the buffer that we will fill before - // flushing. Normal writes to streams typically issue a flush explicitly. - WriterBufferSize int - - // Stream are passed to any streams the manager creates. - Stream drpcstream.Options -} -``` - -Options controls configuration settings for a manager. diff --git a/vendor/storj.io/drpc/drpcmanager/doc.go b/vendor/storj.io/drpc/drpcmanager/doc.go deleted file mode 100644 index 8cc5aa48b..000000000 --- a/vendor/storj.io/drpc/drpcmanager/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcmanager reads packets from a transport to make streams. -package drpcmanager - -import "github.com/spacemonkeygo/monkit/v3" - -var mon = monkit.Package() diff --git a/vendor/storj.io/drpc/drpcmanager/manager.go b/vendor/storj.io/drpc/drpcmanager/manager.go deleted file mode 100644 index ce96826b2..000000000 --- a/vendor/storj.io/drpc/drpcmanager/manager.go +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcmanager - -import ( - "context" - "fmt" - "sync" - - "github.com/zeebo/errs" - - "storj.io/drpc" - "storj.io/drpc/drpccache" - "storj.io/drpc/drpcctx" - "storj.io/drpc/drpcdebug" - "storj.io/drpc/drpcmetadata" - "storj.io/drpc/drpcsignal" - "storj.io/drpc/drpcstream" - "storj.io/drpc/drpcwire" -) - -var managerClosed = errs.New("manager closed") - -// Options controls configuration settings for a manager. -type Options struct { - // WriterBufferSize controls the size of the buffer that we will fill before - // flushing. Normal writes to streams typically issue a flush explicitly. - WriterBufferSize int - - // Stream are passed to any streams the manager creates. - Stream drpcstream.Options -} - -// Manager handles the logic of managing a transport for a drpc client or server. -// It ensures that the connection is always being read from, that it is closed -// in the case that the manager is and forwarding drpc protocol messages to the -// appropriate stream. -type Manager struct { - tr drpc.Transport - wr *drpcwire.Writer - rd *drpcwire.Reader - opts Options - - once sync.Once - - sid uint64 - sem chan struct{} - term drpcsignal.Signal // set when the manager should start terminating - read drpcsignal.Signal // set after the goroutine reading from the transport is done - tport drpcsignal.Signal // set after the transport has been closed - queue chan drpcwire.Packet - ctx context.Context -} - -// New returns a new Manager for the transport. -func New(tr drpc.Transport) *Manager { - return NewWithOptions(tr, Options{}) -} - -// NewWithOptions returns a new manager for the transport. It uses the provided -// options to manage details of how it uses it. -func NewWithOptions(tr drpc.Transport, opts Options) *Manager { - m := &Manager{ - tr: tr, - wr: drpcwire.NewWriter(tr, opts.WriterBufferSize), - rd: drpcwire.NewReader(tr), - opts: opts, - - // this semaphore controls the number of concurrent streams. it MUST be 1. - sem: make(chan struct{}, 1), - queue: make(chan drpcwire.Packet), - ctx: drpcctx.WithTransport(context.Background(), tr), - } - - go m.manageTransport() - go m.manageReader() - - return m -} - -// -// helpers -// - -// poll checks if a channel is immediately ready. -func poll(ch <-chan struct{}) bool { - select { - case <-ch: - return true - default: - return false - } -} - -// poll checks if the context is canceled or the manager is terminated. -func (m *Manager) poll(ctx context.Context) error { - switch { - case poll(ctx.Done()): - return ctx.Err() - - case poll(m.term.Signal()): - return m.term.Err() - - default: - return nil - } -} - -// acquireSemaphore attempts to acquire the semaphore protecting streams. If the -// context is canceled or the manager is terminated, it returns an error. -func (m *Manager) acquireSemaphore(ctx context.Context) error { - if err := m.poll(ctx); err != nil { - return err - } - select { - case <-ctx.Done(): - return ctx.Err() - - case <-m.term.Signal(): - return m.term.Err() - - case m.sem <- struct{}{}: - return nil - } -} - -// -// exported interface -// - -// Closed returns if the manager has been closed. -func (m *Manager) Closed() bool { - return m.term.IsSet() -} - -// Close closes the transport the manager is using. -func (m *Manager) Close() error { - // when closing, we set the manager terminated signal, wait for the goroutine - // managing the transport to notice and close it, acquire the semaphore to ensure - // there are streams running, then wait for the goroutine reading packets to be done. - // we protect it with a once to ensure both that we only do this once, and that - // concurrent calls are sure that it has fully executed. - - m.once.Do(func() { - m.term.Set(managerClosed) - <-m.tport.Signal() - m.sem <- struct{}{} - <-m.read.Signal() - }) - - return m.tport.Err() -} - -// NewClientStream starts a stream on the managed transport for use by a client. -func (m *Manager) NewClientStream(ctx context.Context) (stream *drpcstream.Stream, err error) { - if err := m.acquireSemaphore(ctx); err != nil { - return nil, err - } - - m.sid++ - stream = drpcstream.NewWithOptions(m.ctx, m.sid, m.wr, m.opts.Stream) - go m.manageStream(ctx, stream) - return stream, nil -} - -// NewServerStream starts a stream on the managed transport for use by a server. It does -// this by waiting for the client to issue an invoke message and returning the details. -func (m *Manager) NewServerStream(ctx context.Context) (stream *drpcstream.Stream, rpc string, err error) { - if err := m.acquireSemaphore(ctx); err != nil { - return nil, "", err - } - - callerCache := drpccache.FromContext(ctx) - - var metadata drpcwire.Packet - - for { - select { - case <-ctx.Done(): - <-m.sem - return nil, "", ctx.Err() - - case <-m.term.Signal(): - <-m.sem - return nil, "", m.term.Err() - - case pkt := <-m.queue: - switch pkt.Kind { - case drpcwire.KindInvokeMetadata: - // keep track of any metadata being sent before an invoke so that we can - // include it if the stream id matches the eventual invoke. - metadata = pkt - continue - - case drpcwire.KindInvoke: - streamCtx := m.ctx - - if callerCache != nil { - streamCtx = drpccache.WithContext(streamCtx, callerCache) - } - - if metadata.ID.Stream == pkt.ID.Stream { - md, err := drpcmetadata.Decode(metadata.Data) - if err != nil { - return nil, "", err - } - streamCtx = drpcmetadata.AddPairs(streamCtx, md) - } - - stream = drpcstream.NewWithOptions(streamCtx, pkt.ID.Stream, m.wr, m.opts.Stream) - go m.manageStream(ctx, stream) - return stream, string(pkt.Data), nil - default: - // we ignore packets that arent invokes because perhaps older streams have - // messages in the queue sent concurrently with our notification to them - // that the stream they were sent for is done. - continue - } - } - } -} - -// -// manage transport -// - -// manageTransport ensures that if the manager's term signal is ever set, then -// the underlying transport is closed and the error is recorded. -func (m *Manager) manageTransport() { - defer mon.Task()(nil)(nil) - <-m.term.Signal() - m.tport.Set(m.tr.Close()) -} - -// -// manage reader -// - -// manageReader is always reading a packet and sending it into the queue of packets -// the manager has. It sets the read signal when it exits so that one can wait to -// ensure that no one is reading on the reader. It sets the term signal if there is -// any error reading packets. -func (m *Manager) manageReader() { - defer mon.Task()(nil)(nil) - defer m.read.Set(managerClosed) - - for { - pkt, err := m.rd.ReadPacket() - if err != nil { - m.term.Set(errs.Wrap(err)) - return - } - - drpcdebug.Log(func() string { return fmt.Sprintf("MAN[%p]: %v", m, pkt) }) - - select { - case <-m.term.Signal(): - return - - case m.queue <- pkt: - } - } -} - -// -// manage stream -// - -// manageStream watches the context and the stream and returns when the stream is -// finished, canceling the stream if the context is canceled. -func (m *Manager) manageStream(ctx context.Context, stream *drpcstream.Stream) { - defer mon.Task()(nil)(nil) - - // create a wait group, launch the workers, and wait for them - wg := new(sync.WaitGroup) - wg.Add(2) - go m.manageStreamPackets(wg, stream) - go m.manageStreamContext(ctx, wg, stream) - wg.Wait() - - // release semaphore - <-m.sem -} - -// manageStreamPackets repeatedly reads from the queue of packets and asks the stream to -// handle them. If there is an error handling a packet, that is considered to -// be fatal to the manager, so we set term. HandlePacket also returns a bool to -// indicate that the stream requires no more packets, and so manageStream can -// just exit. It releases the semaphore whenever it exits. -func (m *Manager) manageStreamPackets(wg *sync.WaitGroup, stream *drpcstream.Stream) { - defer mon.Task()(nil)(nil) - defer wg.Done() - - for { - select { - case <-m.term.Signal(): - stream.Cancel(context.Canceled) - return - - case <-stream.Terminated(): - return - - case pkt := <-m.queue: - drpcdebug.Log(func() string { return fmt.Sprintf("FWD[%p][%p]: %v", m, stream, pkt) }) - - ok, err := stream.HandlePacket(pkt) - if err != nil { - m.term.Set(errs.Wrap(err)) - return - } else if !ok { - return - } - } - } -} - -// manageStreamContext ensures that if the stream context is canceled, we inform the stream and -// possibly abort the underlying transport if the stream isn't finished. -func (m *Manager) manageStreamContext(ctx context.Context, wg *sync.WaitGroup, stream *drpcstream.Stream) { - defer mon.Task()(nil)(nil) - defer wg.Done() - - select { - case <-m.term.Signal(): - stream.Cancel(context.Canceled) - return - - case <-stream.Terminated(): - return - - case <-ctx.Done(): - stream.Cancel(ctx.Err()) - if !stream.Finished() { - m.term.Set(ctx.Err()) - } - } -} diff --git a/vendor/storj.io/drpc/drpcmetadata/README.md b/vendor/storj.io/drpc/drpcmetadata/README.md deleted file mode 100644 index 8e7632559..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# package drpcmetadata - -`import "storj.io/drpc/drpcmetadata"` - -Package drpcmetadata define the structure of the metadata supported by drpc -library. - -## Usage - -#### func Add - -```go -func Add(ctx context.Context, key, value string) context.Context -``` -Add associates a key/value pair on the context. - -#### func AddPairs - -```go -func AddPairs(ctx context.Context, metadata map[string]string) context.Context -``` -AddPairs attaches metadata onto a context and return the context. - -#### func Decode - -```go -func Decode(data []byte) (map[string]string, error) -``` -Decode translate byte form of metadata into key/value metadata. - -#### func Encode - -```go -func Encode(buffer []byte, metadata map[string]string) ([]byte, error) -``` -Encode generates byte form of the metadata and appends it onto the passed in -buffer. - -#### func Get - -```go -func Get(ctx context.Context) (map[string]string, bool) -``` -Get returns all key/value pairs on the given context. diff --git a/vendor/storj.io/drpc/drpcmetadata/doc.go b/vendor/storj.io/drpc/drpcmetadata/doc.go deleted file mode 100644 index 61f9a219e..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcmetadata define the structure of the metadata supported by drpc library. -package drpcmetadata diff --git a/vendor/storj.io/drpc/drpcmetadata/invoke/README.md b/vendor/storj.io/drpc/drpcmetadata/invoke/README.md deleted file mode 100644 index 9ce369862..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/invoke/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# package invoke - -`import "storj.io/drpc/drpcmetadata/invoke"` - -Package invoke defines the proto messages exposed by drpc for sending metadata -across the wire. - -## Usage - -#### type Metadata - -```go -type Metadata struct { - Data map[string]string `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} -``` - - -#### func (*Metadata) Descriptor - -```go -func (*Metadata) Descriptor() ([]byte, []int) -``` - -#### func (*Metadata) GetData - -```go -func (m *Metadata) GetData() map[string]string -``` - -#### func (*Metadata) ProtoMessage - -```go -func (*Metadata) ProtoMessage() -``` - -#### func (*Metadata) Reset - -```go -func (m *Metadata) Reset() -``` - -#### func (*Metadata) String - -```go -func (m *Metadata) String() string -``` - -#### func (*Metadata) XXX_DiscardUnknown - -```go -func (m *Metadata) XXX_DiscardUnknown() -``` - -#### func (*Metadata) XXX_Marshal - -```go -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -``` - -#### func (*Metadata) XXX_Merge - -```go -func (m *Metadata) XXX_Merge(src proto.Message) -``` - -#### func (*Metadata) XXX_Size - -```go -func (m *Metadata) XXX_Size() int -``` - -#### func (*Metadata) XXX_Unmarshal - -```go -func (m *Metadata) XXX_Unmarshal(b []byte) error -``` diff --git a/vendor/storj.io/drpc/drpcmetadata/invoke/doc.go b/vendor/storj.io/drpc/drpcmetadata/invoke/doc.go deleted file mode 100644 index 183dafc44..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/invoke/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package invoke defines the proto messages exposed by drpc for -// sending metadata across the wire. -package invoke - -//go:generate bash -c "go install storj.io/drpc/cmd/protoc-gen-drpc && protoc --drpc_out=plugins=drpc:. metadata.proto" diff --git a/vendor/storj.io/drpc/drpcmetadata/invoke/metadata.pb.go b/vendor/storj.io/drpc/drpcmetadata/invoke/metadata.pb.go deleted file mode 100644 index df224b567..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/invoke/metadata.pb.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: metadata.proto - -package invoke - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - math "math" -) - -// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Metadata struct { - Data map[string]string `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_56d9f74966f40d04, []int{0} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Metadata.Unmarshal(m, b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) -} -func (m *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} -func (m *Metadata) XXX_Size() int { - return xxx_messageInfo_Metadata.Size(m) -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) -} - -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetData() map[string]string { - if m != nil { - return m.Data - } - return nil -} - -func init() { - proto.RegisterType((*Metadata)(nil), "metadata.Metadata") - proto.RegisterMapType((map[string]string)(nil), "metadata.Metadata.DataEntry") -} - -func init() { proto.RegisterFile("metadata.proto", fileDescriptor_56d9f74966f40d04) } - -var fileDescriptor_56d9f74966f40d04 = []byte{ - // 138 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x4d, 0x2d, 0x49, - 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0x95, 0x4a, - 0xb9, 0x38, 0x7c, 0xa1, 0x6c, 0x21, 0x03, 0x2e, 0x16, 0x10, 0x2d, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, - 0x6d, 0x24, 0xa3, 0x07, 0xd7, 0x04, 0x53, 0xa1, 0xe7, 0x92, 0x58, 0x92, 0xe8, 0x9a, 0x57, 0x52, - 0x54, 0x19, 0x04, 0x56, 0x29, 0x65, 0xce, 0xc5, 0x09, 0x17, 0x12, 0x12, 0xe0, 0x62, 0xce, 0x4e, - 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x12, - 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, 0x8e, 0x15, 0x93, 0x05, 0xa3, 0x13, 0x47, 0x14, - 0x5b, 0x66, 0x5e, 0x59, 0x7e, 0x76, 0x6a, 0x12, 0x1b, 0xd8, 0x45, 0xc6, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xc2, 0xda, 0x43, 0xa9, 0xa3, 0x00, 0x00, 0x00, -} diff --git a/vendor/storj.io/drpc/drpcmetadata/invoke/metadata.proto b/vendor/storj.io/drpc/drpcmetadata/invoke/metadata.proto deleted file mode 100644 index 0c73ad0f2..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/invoke/metadata.proto +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -syntax = "proto3"; -option go_package = "invoke"; - -package metadata; - -message Metadata { - map data = 1; -} diff --git a/vendor/storj.io/drpc/drpcmetadata/metadata.go b/vendor/storj.io/drpc/drpcmetadata/metadata.go deleted file mode 100644 index 3cf6aed30..000000000 --- a/vendor/storj.io/drpc/drpcmetadata/metadata.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcmetadata - -import ( - "context" - - "github.com/gogo/protobuf/proto" - - "storj.io/drpc/drpcmetadata/invoke" -) - -// AddPairs attaches metadata onto a context and return the context. -func AddPairs(ctx context.Context, metadata map[string]string) context.Context { - for key, val := range metadata { - ctx = Add(ctx, key, val) - } - return ctx -} - -// Encode generates byte form of the metadata and appends it onto the passed in buffer. -func Encode(buffer []byte, metadata map[string]string) ([]byte, error) { - data, err := proto.Marshal(&invoke.Metadata{Data: metadata}) - if err != nil { - return buffer, err - } - return append(buffer, data...), nil -} - -// Decode translate byte form of metadata into key/value metadata. -func Decode(data []byte) (map[string]string, error) { - var md invoke.Metadata - err := proto.Unmarshal(data, &md) - if err != nil { - return nil, err - } - return md.Data, nil -} - -type metadataKey struct{} - -// Add associates a key/value pair on the context. -func Add(ctx context.Context, key, value string) context.Context { - metadata, ok := Get(ctx) - if !ok { - metadata = make(map[string]string) - ctx = context.WithValue(ctx, metadataKey{}, metadata) - } - metadata[key] = value - return ctx -} - -// Get returns all key/value pairs on the given context. -func Get(ctx context.Context) (map[string]string, bool) { - metadata, ok := ctx.Value(metadataKey{}).(map[string]string) - return metadata, ok -} diff --git a/vendor/storj.io/drpc/drpcmux/README.md b/vendor/storj.io/drpc/drpcmux/README.md deleted file mode 100644 index 194965d07..000000000 --- a/vendor/storj.io/drpc/drpcmux/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# package drpcmux - -`import "storj.io/drpc/drpcmux"` - -Package drpcmux is a handler to dispatch rpcs to implementations. - -## Usage - -#### type Mux - -```go -type Mux struct { -} -``` - -Mux is an implementation of Handler to serve drpc connections to the appropriate -Receivers registered by Descriptions. - -#### func New - -```go -func New() *Mux -``` -New constructs a new Mux. - -#### func (*Mux) HandleRPC - -```go -func (m *Mux) HandleRPC(stream drpc.Stream, rpc string) (err error) -``` -HandleRPC handles the rpc that has been requested by the stream. - -#### func (*Mux) Register - -```go -func (m *Mux) Register(srv interface{}, desc drpc.Description) error -``` -Register associates the rpcs described by the description in the server. It -returns an error if there was a problem registering it. diff --git a/vendor/storj.io/drpc/drpcmux/doc.go b/vendor/storj.io/drpc/drpcmux/doc.go deleted file mode 100644 index 89f79f464..000000000 --- a/vendor/storj.io/drpc/drpcmux/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcmux is a handler to dispatch rpcs to implementations. -package drpcmux diff --git a/vendor/storj.io/drpc/drpcmux/mux.go b/vendor/storj.io/drpc/drpcmux/mux.go deleted file mode 100644 index ca265fcb4..000000000 --- a/vendor/storj.io/drpc/drpcmux/mux.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcmux - -import ( - "reflect" - - "github.com/zeebo/errs" - - "storj.io/drpc" -) - -// Mux is an implementation of Handler to serve drpc connections to the -// appropriate Receivers registered by Descriptions. -type Mux struct { - rpcs map[string]rpcData -} - -// New constructs a new Mux. -func New() *Mux { - return &Mux{ - rpcs: make(map[string]rpcData), - } -} - -var ( - streamType = reflect.TypeOf((*drpc.Stream)(nil)).Elem() - messageType = reflect.TypeOf((*drpc.Message)(nil)).Elem() -) - -type rpcData struct { - srv interface{} - receiver drpc.Receiver - in1 reflect.Type - in2 reflect.Type -} - -// Register associates the rpcs described by the description in the server. -// It returns an error if there was a problem registering it. -func (m *Mux) Register(srv interface{}, desc drpc.Description) error { - n := desc.NumMethods() - for i := 0; i < n; i++ { - rpc, receiver, method, ok := desc.Method(i) - if !ok { - return errs.New("Description returned invalid method for index %d", i) - } - if err := m.registerOne(srv, rpc, receiver, method); err != nil { - return err - } - } - return nil -} - -// registerOne does the work to register a single rpc. -func (m *Mux) registerOne(srv interface{}, rpc string, receiver drpc.Receiver, method interface{}) error { - data := rpcData{srv: srv, receiver: receiver} - - switch mt := reflect.TypeOf(method); { - // unitary input, unitary output - case mt.NumOut() == 2: - data.in1 = mt.In(2) - if !data.in1.Implements(messageType) { - return errs.New("input argument not a drpc message: %v", data.in1) - } - - // unitary input, stream output - case mt.NumIn() == 3: - data.in1 = mt.In(1) - if !data.in1.Implements(messageType) { - return errs.New("input argument not a drpc message: %v", data.in1) - } - data.in2 = streamType - - // stream input - case mt.NumIn() == 2: - data.in1 = streamType - - // code gen bug? - default: - return errs.New("unknown method type: %v", mt) - } - - m.rpcs[rpc] = data - return nil -} - -// HandleRPC handles the rpc that has been requested by the stream. -func (m *Mux) HandleRPC(stream drpc.Stream, rpc string) (err error) { - data, ok := m.rpcs[rpc] - if !ok { - return drpc.ProtocolError.New("unknown rpc: %q", rpc) - } - - in := interface{}(stream) - if data.in1 != streamType { - msg, ok := reflect.New(data.in1.Elem()).Interface().(drpc.Message) - if !ok { - return drpc.InternalError.New("invalid rpc input type") - } - if err := stream.MsgRecv(msg); err != nil { - return errs.Wrap(err) - } - in = msg - } - - out, err := data.receiver(data.srv, stream.Context(), in, stream) - switch { - case err != nil: - return errs.Wrap(err) - case out != nil: - return stream.MsgSend(out) - default: - return nil - } -} diff --git a/vendor/storj.io/drpc/drpcsignal/README.md b/vendor/storj.io/drpc/drpcsignal/README.md deleted file mode 100644 index ccaab1f84..000000000 --- a/vendor/storj.io/drpc/drpcsignal/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# package drpcsignal - -`import "storj.io/drpc/drpcsignal"` - -Package drpcsignal holds a helper type to signal errors. - -## Usage - -#### type Signal - -```go -type Signal struct { -} -``` - -Signal contains an error value that can be set one and exports a number of ways -to inspect it. - -#### func (*Signal) Err - -```go -func (s *Signal) Err() error -``` -Err returns the error stored in the signal. Since one can store a nil error care -must be taken. A non-nil error returned from this method means that the Signal -has been set, but the inverse is not true. - -#### func (*Signal) Get - -```go -func (s *Signal) Get() (error, bool) -``` -Get returns the error set with the signal and a boolean indicating if the result -is valid. - -#### func (*Signal) IsSet - -```go -func (s *Signal) IsSet() bool -``` -IsSet returns true if the Signal is set. - -#### func (*Signal) Set - -```go -func (s *Signal) Set(err error) (ok bool) -``` -Set stores the error in the signal. It only keeps track of the first error set, -and returns true if it was the first error set. - -#### func (*Signal) Signal - -```go -func (s *Signal) Signal() chan struct{} -``` -Signal returns a channel that will be closed when the signal is set. diff --git a/vendor/storj.io/drpc/drpcsignal/doc.go b/vendor/storj.io/drpc/drpcsignal/doc.go deleted file mode 100644 index d03192e7a..000000000 --- a/vendor/storj.io/drpc/drpcsignal/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcsignal holds a helper type to signal errors. -package drpcsignal diff --git a/vendor/storj.io/drpc/drpcsignal/signal.go b/vendor/storj.io/drpc/drpcsignal/signal.go deleted file mode 100644 index a4aa1d570..000000000 --- a/vendor/storj.io/drpc/drpcsignal/signal.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcsignal - -import ( - "sync" - "sync/atomic" -) - -// Signal contains an error value that can be set one and exports -// a number of ways to inspect it. -type Signal struct { - set uint32 - on sync.Once - mu sync.Mutex - sig chan struct{} - err error -} - -func (s *Signal) init() { s.sig = make(chan struct{}) } - -// Signal returns a channel that will be closed when the signal is set. -func (s *Signal) Signal() chan struct{} { - s.on.Do(s.init) - return s.sig -} - -// Set stores the error in the signal. It only keeps track of the first -// error set, and returns true if it was the first error set. -func (s *Signal) Set(err error) (ok bool) { - if atomic.LoadUint32(&s.set) != 0 { - return false - } - return s.setSlow(err) -} - -// setSlow is the slow path for Set, so that the fast path is inlined into -// callers. -func (s *Signal) setSlow(err error) (ok bool) { - s.mu.Lock() - if s.set == 0 { - s.err = err - atomic.StoreUint32(&s.set, 1) - s.on.Do(s.init) - close(s.sig) - ok = true - } - s.mu.Unlock() - return ok -} - -// Get returns the error set with the signal and a boolean indicating if -// the result is valid. -func (s *Signal) Get() (error, bool) { //nolint - if atomic.LoadUint32(&s.set) != 0 { - return s.err, true - } - return nil, false -} - -// IsSet returns true if the Signal is set. -func (s *Signal) IsSet() bool { - return atomic.LoadUint32(&s.set) != 0 -} - -// Err returns the error stored in the signal. Since one can store a nil error -// care must be taken. A non-nil error returned from this method means that -// the Signal has been set, but the inverse is not true. -func (s *Signal) Err() error { - if atomic.LoadUint32(&s.set) != 0 { - return s.err - } - return nil -} diff --git a/vendor/storj.io/drpc/drpcstream/README.md b/vendor/storj.io/drpc/drpcstream/README.md deleted file mode 100644 index aeafa7935..000000000 --- a/vendor/storj.io/drpc/drpcstream/README.md +++ /dev/null @@ -1,147 +0,0 @@ -# package drpcstream - -`import "storj.io/drpc/drpcstream"` - -Package drpcstream sends protobufs using the dprc wire protocol. - -## Usage - -#### type Options - -```go -type Options struct { - // SplitSize controls the default size we split packets into frames. - SplitSize int -} -``` - -Options controls configuration settings for a stream. - -#### type Stream - -```go -type Stream struct { -} -``` - -Stream represents an rpc actively happening on a transport. - -#### func New - -```go -func New(ctx context.Context, sid uint64, wr *drpcwire.Writer) *Stream -``` -New returns a new stream bound to the context with the given stream id and will -use the writer to write messages on. It is important use monotonically -increasing stream ids within a single transport. - -#### func NewWithOptions - -```go -func NewWithOptions(ctx context.Context, sid uint64, wr *drpcwire.Writer, opts Options) *Stream -``` -NewWithOptions returns a new stream bound to the context with the given stream -id and will use the writer to write messages on. It is important use -monotonically increasing stream ids within a single transport. The options are -used to control details of how the Stream operates. - -#### func (*Stream) Cancel - -```go -func (s *Stream) Cancel(err error) -``` -Cancel transitions the stream into a state where all writes to the transport -will return the provided error, and terminates the stream. It is a no-op if the -stream is already terminated. - -#### func (*Stream) Close - -```go -func (s *Stream) Close() (err error) -``` -Close terminates the stream and sends that the stream has been closed to the -remote. It is a no-op if the stream is already terminated. - -#### func (*Stream) CloseSend - -```go -func (s *Stream) CloseSend() (err error) -``` -CloseSend informs the remote that no more messages will be sent. If the remote -has also already issued a CloseSend, the stream is terminated. It is a no-op if -the stream already has sent a CloseSend or if it is terminated. - -#### func (*Stream) Context - -```go -func (s *Stream) Context() context.Context -``` -Context returns the context associated with the stream. It is closed when the -Stream will no longer issue any writes or reads. - -#### func (*Stream) Finished - -```go -func (s *Stream) Finished() bool -``` -Finished returns true if the stream is fully finished and will no longer issue -any writes or reads. - -#### func (*Stream) HandlePacket - -```go -func (s *Stream) HandlePacket(pkt drpcwire.Packet) (more bool, err error) -``` -HandlePacket advances the stream state machine by inspecting the packet. It -returns any major errors that should terminate the transport the stream is -operating on as well as a boolean indicating if the stream expects more packets. - -#### func (*Stream) MsgRecv - -```go -func (s *Stream) MsgRecv(msg drpc.Message) (err error) -``` -MsgRecv recives some protobuf data and unmarshals it into msg. - -#### func (*Stream) MsgSend - -```go -func (s *Stream) MsgSend(msg drpc.Message) (err error) -``` -MsgSend marshals the message with protobuf, writes it, and flushes. - -#### func (*Stream) RawFlush - -```go -func (s *Stream) RawFlush() (err error) -``` -RawFlush flushes any buffers of data. - -#### func (*Stream) RawRecv - -```go -func (s *Stream) RawRecv() (data []byte, err error) -``` -RawRecv returns the raw bytes received for a message. - -#### func (*Stream) RawWrite - -```go -func (s *Stream) RawWrite(kind drpcwire.Kind, data []byte) (err error) -``` -RawWrite sends the data bytes with the given kind. - -#### func (*Stream) SendError - -```go -func (s *Stream) SendError(serr error) (err error) -``` -SendError terminates the stream and sends the error to the remote. It is a no-op -if the stream is already terminated. - -#### func (*Stream) Terminated - -```go -func (s *Stream) Terminated() <-chan struct{} -``` -Terminated returns a channel when the stream has been terminated. diff --git a/vendor/storj.io/drpc/drpcstream/chmutex.go b/vendor/storj.io/drpc/drpcstream/chmutex.go deleted file mode 100644 index 72a826fff..000000000 --- a/vendor/storj.io/drpc/drpcstream/chmutex.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcstream - -import "sync" - -type chMutex struct { - ch chan struct{} - once sync.Once -} - -func (m *chMutex) init() { m.ch = make(chan struct{}, 1) } - -func (m *chMutex) Chan() chan struct{} { - m.once.Do(m.init) - return m.ch -} - -func (m *chMutex) Lock() { - m.once.Do(m.init) - m.ch <- struct{}{} -} - -func (m *chMutex) TryLock() bool { - m.once.Do(m.init) - select { - case m.ch <- struct{}{}: - return true - default: - return false - } -} - -func (m *chMutex) Unlock() { - m.once.Do(m.init) - <-m.ch -} diff --git a/vendor/storj.io/drpc/drpcstream/doc.go b/vendor/storj.io/drpc/drpcstream/doc.go deleted file mode 100644 index e9e0e45d0..000000000 --- a/vendor/storj.io/drpc/drpcstream/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcstream sends protobufs using the dprc wire protocol. -package drpcstream - -import "github.com/spacemonkeygo/monkit/v3" - -var mon = monkit.Package() diff --git a/vendor/storj.io/drpc/drpcstream/stream.go b/vendor/storj.io/drpc/drpcstream/stream.go deleted file mode 100644 index d97d66189..000000000 --- a/vendor/storj.io/drpc/drpcstream/stream.go +++ /dev/null @@ -1,424 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcstream - -import ( - "context" - "fmt" - "io" - "sync" - - "github.com/gogo/protobuf/proto" - "github.com/zeebo/errs" - - "storj.io/drpc" - "storj.io/drpc/drpcdebug" - "storj.io/drpc/drpcsignal" - "storj.io/drpc/drpcwire" -) - -// Options controls configuration settings for a stream. -type Options struct { - // SplitSize controls the default size we split packets into frames. - SplitSize int -} - -// Stream represents an rpc actively happening on a transport. -type Stream struct { - ctx context.Context - cancel func() - opts Options - - writeMu chMutex - id drpcwire.ID - wr *drpcwire.Writer - - mu sync.Mutex // protects state transitions - sigs struct { - send drpcsignal.Signal // set when done sending messages - recv drpcsignal.Signal // set when done receiving messages - term drpcsignal.Signal // set when in terminated state - finish drpcsignal.Signal // set when all writes are complete - cancel drpcsignal.Signal // set when externally canceled and transport will be closed - } - queue chan drpcwire.Packet - - // avoids allocations of closures - pollWriteFn func(drpcwire.Frame) error -} - -var _ drpc.Stream = (*Stream)(nil) - -// New returns a new stream bound to the context with the given stream id and will -// use the writer to write messages on. It is important use monotonically increasing -// stream ids within a single transport. -func New(ctx context.Context, sid uint64, wr *drpcwire.Writer) *Stream { - return NewWithOptions(ctx, sid, wr, Options{}) -} - -// NewWithOptions returns a new stream bound to the context with the given stream id -// and will use the writer to write messages on. It is important use monotonically increasing -// stream ids within a single transport. The options are used to control details of how -// the Stream operates. -func NewWithOptions(ctx context.Context, sid uint64, wr *drpcwire.Writer, opts Options) *Stream { - ctx, cancel := context.WithCancel(ctx) - - s := &Stream{ - ctx: ctx, - cancel: cancel, - opts: opts, - - wr: wr, - - id: drpcwire.ID{Stream: sid}, - queue: make(chan drpcwire.Packet), - } - - s.pollWriteFn = s.pollWrite - - return s -} - -// -// monitoring helpers -// - -// monCtx returns a copy of the context for use with mon.Task so that there aren't -// races overwriting the stream's context. -func (s *Stream) monCtx() *context.Context { - ctx := s.ctx - return &ctx -} - -// -// accessors -// - -// Context returns the context associated with the stream. It is closed when -// the Stream will no longer issue any writes or reads. -func (s *Stream) Context() context.Context { return s.ctx } - -// Terminated returns a channel when the stream has been terminated. -func (s *Stream) Terminated() <-chan struct{} { return s.sigs.term.Signal() } - -// Finished returns true if the stream is fully finished and will no longer -// issue any writes or reads. -func (s *Stream) Finished() bool { return s.sigs.finish.IsSet() } - -// -// packet handler -// - -// HandlePacket advances the stream state machine by inspecting the packet. It returns -// any major errors that should terminate the transport the stream is operating on as -// well as a boolean indicating if the stream expects more packets. -func (s *Stream) HandlePacket(pkt drpcwire.Packet) (more bool, err error) { - defer mon.Task()(s.monCtx())(&err) - - s.mu.Lock() - defer s.mu.Unlock() - - drpcdebug.Log(func() string { return fmt.Sprintf("STR[%p][%d]: %v", s, s.id.Stream, pkt) }) - - if pkt.ID.Stream != s.id.Stream { - return true, nil - } - - switch pkt.Kind { - case drpcwire.KindInvoke: - err := drpc.ProtocolError.New("invoke on existing stream") - s.terminate(err) - return false, err - - case drpcwire.KindMessage: - if s.sigs.recv.IsSet() || s.sigs.term.IsSet() { - return true, nil - } - - // drop the mutex while we either send into the queue or we're told that - // receiving is done. we don't handle any more packets until the message - // is delivered, so the only way it can become set is from some of the - // stream terminating calls, in which case, shutting down the stream is - // racing with the message being received, so dropping it is valid. - s.mu.Unlock() - defer s.mu.Lock() - - select { - case <-s.sigs.recv.Signal(): - case <-s.sigs.term.Signal(): - case s.queue <- pkt: - } - - return true, nil - - case drpcwire.KindError: - err := drpcwire.UnmarshalError(pkt.Data) - s.sigs.send.Set(io.EOF) // in this state, gRPC returns io.EOF on send. - s.terminate(err) - return false, nil - - case drpcwire.KindClose: - s.sigs.recv.Set(io.EOF) - s.terminate(drpc.Error.New("remote closed the stream")) - return false, nil - - case drpcwire.KindCloseSend: - s.sigs.recv.Set(io.EOF) - s.terminateIfBothClosed() - return false, nil - - default: - err := drpc.InternalError.New("unknown packet kind: %s", pkt.Kind) - s.terminate(err) - return false, err - } -} - -// -// helpers -// - -// checkFinished checks to see if the stream is terminated, and if so, sets the finished -// flag. This must be called every time right before we release the write mutex. -func (s *Stream) checkFinished() { - if s.sigs.term.IsSet() { - s.sigs.finish.Set(nil) - } -} - -// checkCancelError will replace the error with one from the cancel signal if it is -// set. This is to prevent errors from reads/writes to a transport after it has been -// asynchronously closed due to context cancelation. -func (s *Stream) checkCancelError(err error) error { - if sigErr, ok := s.sigs.cancel.Get(); ok { - return sigErr - } - return err -} - -// newPackage bumps the internal message id and returns a packet. It must be called -// under a mutex. -func (s *Stream) newPacket(kind drpcwire.Kind, data []byte) drpcwire.Packet { - s.id.Message++ - return drpcwire.Packet{ - Data: data, - ID: s.id, - Kind: kind, - } -} - -// pollWrite checks for any conditions that should cause a write to not happen and -// then issues the write of the frame. -func (s *Stream) pollWrite(fr drpcwire.Frame) (err error) { - switch { - case s.sigs.send.IsSet(): - return s.sigs.send.Err() - case s.sigs.term.IsSet(): - return s.sigs.term.Err() - } - - return s.checkCancelError(errs.Wrap(s.wr.WriteFrame(fr))) -} - -// sendPacket sends the packet in a single write and flushes. It does not check for -// any conditions to stop it from writing and is meant for internal stream use to -// do things like signal errors or closes to the remote side. -func (s *Stream) sendPacket(kind drpcwire.Kind, data []byte) (err error) { - defer mon.Task()(s.monCtx())(&err) - - if err := s.wr.WritePacket(s.newPacket(kind, data)); err != nil { - return errs.Wrap(err) - } - if err := s.wr.Flush(); err != nil { - return errs.Wrap(err) - } - return nil -} - -// terminateIfBothClosed is a helper to terminate the stream if both sides have -// issued a CloseSend. -func (s *Stream) terminateIfBothClosed() { - if s.sigs.send.IsSet() && s.sigs.recv.IsSet() { - s.terminate(drpc.Error.New("stream terminated by both issuing close send")) - } -} - -// terminate marks the stream as terminated with the given error. It also marks -// the stream as finished if no writes are happening at the time of the call. -func (s *Stream) terminate(err error) { - s.sigs.send.Set(err) - s.sigs.recv.Set(err) - s.sigs.term.Set(err) - s.cancel() - - // if we can acquire the write mutex, then checkFinished. if not, then we know - // some other write is happening, and it will call checkFinished before it - // releases the mutex. - if s.writeMu.TryLock() { - s.checkFinished() - s.writeMu.Unlock() - } -} - -// -// raw read/write -// - -// RawWrite sends the data bytes with the given kind. -func (s *Stream) RawWrite(kind drpcwire.Kind, data []byte) (err error) { - defer mon.Task()(s.monCtx())(&err) - - s.writeMu.Lock() - defer s.writeMu.Unlock() - defer s.checkFinished() - - return drpcwire.SplitN(s.newPacket(kind, data), s.opts.SplitSize, s.pollWriteFn) -} - -// RawFlush flushes any buffers of data. -func (s *Stream) RawFlush() (err error) { - defer mon.Task()(s.monCtx())(&err) - - s.writeMu.Lock() - defer s.writeMu.Unlock() - defer s.checkFinished() - - return s.checkCancelError(errs.Wrap(s.wr.Flush())) -} - -// RawRecv returns the raw bytes received for a message. -func (s *Stream) RawRecv() (data []byte, err error) { - defer mon.Task()(s.monCtx())(&err) - - if s.sigs.recv.IsSet() { - return nil, s.sigs.recv.Err() - } - - select { - case <-s.sigs.recv.Signal(): - return nil, s.sigs.recv.Err() - case pkt := <-s.queue: - return pkt.Data, nil - } -} - -// -// msg read/write -// - -// MsgSend marshals the message with protobuf, writes it, and flushes. -func (s *Stream) MsgSend(msg drpc.Message) (err error) { - defer mon.Task()(s.monCtx())(&err) - - data, err := proto.Marshal(msg) - if err != nil { - return errs.Wrap(err) - } - if err := s.RawWrite(drpcwire.KindMessage, data); err != nil { - return err - } - if err := s.RawFlush(); err != nil { - return err - } - return nil -} - -// MsgRecv recives some protobuf data and unmarshals it into msg. -func (s *Stream) MsgRecv(msg drpc.Message) (err error) { - defer mon.Task()(s.monCtx())(&err) - - data, err := s.RawRecv() - if err != nil { - return err - } - return proto.Unmarshal(data, msg) -} - -// -// terminal messages -// - -// SendError terminates the stream and sends the error to the remote. It is a no-op if -// the stream is already terminated. -func (s *Stream) SendError(serr error) (err error) { - defer mon.Task()(s.monCtx())(&err) - - s.mu.Lock() - if s.sigs.term.IsSet() { - s.mu.Unlock() - return nil - } - - s.writeMu.Lock() - defer s.writeMu.Unlock() - defer s.checkFinished() - - s.sigs.send.Set(io.EOF) // in this state, gRPC returns io.EOF on send. - s.terminate(drpc.Error.New("stream terminated by sending error")) - s.mu.Unlock() - - return s.checkCancelError(s.sendPacket(drpcwire.KindError, drpcwire.MarshalError(serr))) -} - -// Close terminates the stream and sends that the stream has been closed to the remote. -// It is a no-op if the stream is already terminated. -func (s *Stream) Close() (err error) { - defer mon.Task()(s.monCtx())(&err) - - s.mu.Lock() - if s.sigs.term.IsSet() { - s.mu.Unlock() - return nil - } - - s.writeMu.Lock() - defer s.writeMu.Unlock() - defer s.checkFinished() - - s.terminate(drpc.Error.New("stream terminated by sending close")) - s.mu.Unlock() - - return s.checkCancelError(s.sendPacket(drpcwire.KindClose, nil)) -} - -// CloseSend informs the remote that no more messages will be sent. If the remote has -// also already issued a CloseSend, the stream is terminated. It is a no-op if the -// stream already has sent a CloseSend or if it is terminated. -func (s *Stream) CloseSend() (err error) { - defer mon.Task()(s.monCtx())(&err) - - s.mu.Lock() - if s.sigs.send.IsSet() || s.sigs.term.IsSet() { - s.mu.Unlock() - return nil - } - - s.writeMu.Lock() - defer s.writeMu.Unlock() - defer s.checkFinished() - - s.sigs.send.Set(drpc.Error.New("send closed")) - s.terminateIfBothClosed() - s.mu.Unlock() - - return s.checkCancelError(s.sendPacket(drpcwire.KindCloseSend, nil)) -} - -// Cancel transitions the stream into a state where all writes to the transport will return -// the provided error, and terminates the stream. It is a no-op if the stream is already -// terminated. -func (s *Stream) Cancel(err error) { - defer mon.Task()(s.monCtx())(nil) - - s.mu.Lock() - defer s.mu.Unlock() - - if s.sigs.term.IsSet() { - return - } - - s.sigs.cancel.Set(err) - s.sigs.send.Set(io.EOF) // in this state, gRPC returns io.EOF on send. - s.terminate(err) -} diff --git a/vendor/storj.io/drpc/drpcwire/README.md b/vendor/storj.io/drpc/drpcwire/README.md deleted file mode 100644 index 04f4f41bc..000000000 --- a/vendor/storj.io/drpc/drpcwire/README.md +++ /dev/null @@ -1,253 +0,0 @@ -# package drpcwire - -`import "storj.io/drpc/drpcwire"` - -Package drpcwire provides low level helpers for the drpc wire protocol. - -## Usage - -#### func AppendFrame - -```go -func AppendFrame(buf []byte, fr Frame) []byte -``` -AppendFrame appends a marshaled form of the frame to the provided buffer. - -#### func AppendVarint - -```go -func AppendVarint(buf []byte, x uint64) []byte -``` -AppendVarint appends the varint encoding of x to the buffer and returns it. - -#### func MarshalError - -```go -func MarshalError(err error) []byte -``` -MarshalError returns a byte form of the error with any error code incorporated. - -#### func ReadVarint - -```go -func ReadVarint(buf []byte) (rem []byte, out uint64, ok bool, err error) -``` -ReadVarint reads a varint encoded integer from the front of buf, returning the -remaining bytes, the value, and if there was a success. if ok is false, the -returned buffer is the same as the passed in buffer. - -#### func SplitFrame - -```go -func SplitFrame(data []byte, atEOF bool) (int, []byte, error) -``` -SplitFrame is used by bufio.Scanner to split frames out of a stream of bytes. - -#### func SplitN - -```go -func SplitN(pkt Packet, n int, cb func(fr Frame) error) error -``` -SplitN splits the marshaled form of the Packet into a number of frames such that -each frame is at most n bytes. It calls the callback with every such frame. If n -is zero, a default of 1024 is used. - -#### func UnmarshalError - -```go -func UnmarshalError(data []byte) error -``` -UnmarshalError unmarshals the marshaled error to one with a code. - -#### type Frame - -```go -type Frame struct { - // Data is the payload of bytes. - Data []byte - - // ID is used so that the frame can be reconstructed. - ID ID - - // Kind is the kind of the payload. - Kind Kind - - // Done is true if this is the last frame for the ID. - Done bool - - // Control is true if the frame has the control bit set. - Control bool -} -``` - -Frame is a split data frame on the wire. - -#### func ParseFrame - -```go -func ParseFrame(buf []byte) (rem []byte, fr Frame, ok bool, err error) -``` -ParseFrame attempts to parse a frame at the beginning of buf. If successful then -rem contains the unparsed data, fr contains the parsed frame, ok will be true, -and err will be nil. If there is not enough data for a frame, ok will be false -and err will be nil. If the data in the buf is malformed, then an error is -returned. - -#### type ID - -```go -type ID struct { - // Stream is the stream identifier. - Stream uint64 - - // Message is the message identifier. - Message uint64 -} -``` - -ID represents a packet id. - -#### func (ID) Less - -```go -func (i ID) Less(j ID) bool -``` -Less returns true if the id is less than the provided one. An ID is less than -another if the Stream is less, and if the stream is equal, if the Message is -less. - -#### func (ID) String - -```go -func (i ID) String() string -``` -String returns a human readable form of the ID. - -#### type Kind - -```go -type Kind uint8 -``` - -Kind is the enumeration of all the different kinds of messages drpc sends. - -```go -const ( - - // KindInvoke is used to invoke an rpc. The body is the name of the rpc. - KindInvoke Kind = 1 - - // KindMessage is used to send messages. The body is a protobuf. - KindMessage Kind = 2 - - // KindError is used to inform that an error happened. The body is an error - // with a code attached. - KindError Kind = 3 - - // KindClose is used to inform that the rpc is dead. It has no body. - KindClose Kind = 5 - - // KindCloseSend is used to inform that no more messages will be sent. - // It has no body. - KindCloseSend Kind = 6 // body must be empty - - // KindInvokeMetadata includes metadata about the next Invoke packet. - KindInvokeMetadata Kind = 7 -) -``` - -#### func (Kind) String - -```go -func (i Kind) String() string -``` - -#### type Packet - -```go -type Packet struct { - // Data is the payload of the packet. - Data []byte - - // ID is the identifier for the packet. - ID ID - - // Kind is the kind of the packet. - Kind Kind -} -``` - -Packet is a single message sent by drpc. - -#### func (Packet) String - -```go -func (p Packet) String() string -``` -String returns a human readable form of the packet. - -#### type Reader - -```go -type Reader struct { -} -``` - -Reader reconstructs packets from frames read from an io.Reader. - -#### func NewReader - -```go -func NewReader(r io.Reader) *Reader -``` -NewReader constructs a Reader to read Packets from the io.Reader. - -#### func (*Reader) ReadPacket - -```go -func (s *Reader) ReadPacket() (pkt Packet, err error) -``` -ReadPacket reads a packet from the io.Reader. IDs read from frames must be -monotonically increasing. When a new ID is read, the old data is discarded. This -allows for easier asynchronous interrupts. If the amount of data in the Packet -becomes too large, an error is returned. - -#### type Writer - -```go -type Writer struct { -} -``` - -Writer is a helper to buffer and write packets and frames to an io.Writer. - -#### func NewWriter - -```go -func NewWriter(w io.Writer, size int) *Writer -``` -NewWriter returns a Writer that will attempt to buffer size data before sending -it to the io.Writer. - -#### func (*Writer) Flush - -```go -func (b *Writer) Flush() (err error) -``` -Flush forces a flush of any buffered data to the io.Writer. It is a no-op if -there is no data in the buffer. - -#### func (*Writer) WriteFrame - -```go -func (b *Writer) WriteFrame(fr Frame) (err error) -``` -WriteFrame appends the frame into the buffer, and if the buffer is larger than -the configured size, flushes it. - -#### func (*Writer) WritePacket - -```go -func (b *Writer) WritePacket(pkt Packet) (err error) -``` -WritePacket writes the packet as a single frame, ignoring any size constraints. diff --git a/vendor/storj.io/drpc/drpcwire/doc.go b/vendor/storj.io/drpc/drpcwire/doc.go deleted file mode 100644 index c41753e19..000000000 --- a/vendor/storj.io/drpc/drpcwire/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package drpcwire provides low level helpers for the drpc wire protocol. -package drpcwire - -import "github.com/spacemonkeygo/monkit/v3" - -var mon = monkit.Package() diff --git a/vendor/storj.io/drpc/drpcwire/error.go b/vendor/storj.io/drpc/drpcwire/error.go deleted file mode 100644 index 605ef7208..000000000 --- a/vendor/storj.io/drpc/drpcwire/error.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcwire - -import ( - "encoding/binary" - - "github.com/zeebo/errs" - - "storj.io/drpc/drpcerr" -) - -// MarshalError returns a byte form of the error with any error code incorporated. -func MarshalError(err error) []byte { - var buf [8]byte - binary.BigEndian.PutUint64(buf[:], drpcerr.Code(err)) - return append(buf[:], err.Error()...) -} - -// UnmarshalError unmarshals the marshaled error to one with a code. -func UnmarshalError(data []byte) error { - if len(data) < 8 { - return errs.New("%s (drpcwire note: invalid error data)", data) - } - return drpcerr.WithCode(errs.New("%s", data[8:]), binary.BigEndian.Uint64(data[:8])) -} diff --git a/vendor/storj.io/drpc/drpcwire/packet.go b/vendor/storj.io/drpc/drpcwire/packet.go deleted file mode 100644 index 8a4fdc538..000000000 --- a/vendor/storj.io/drpc/drpcwire/packet.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcwire - -import "fmt" - -//go:generate stringer -type=Kind -trimprefix=Kind_ -output=packet_string.go - -// Kind is the enumeration of all the different kinds of messages drpc sends. -type Kind uint8 - -const ( - // kindReserved is saved for the future in case we need to extend. - kindReserved Kind = 0 - - // kindCancelDeprecated is a reminder that we once used this kind value. - kindCancelDeprecated Kind = 4 - - // KindInvoke is used to invoke an rpc. The body is the name of the rpc. - KindInvoke Kind = 1 - - // KindMessage is used to send messages. The body is a protobuf. - KindMessage Kind = 2 - - // KindError is used to inform that an error happened. The body is an error - // with a code attached. - KindError Kind = 3 - - // KindClose is used to inform that the rpc is dead. It has no body. - KindClose Kind = 5 - - // KindCloseSend is used to inform that no more messages will be sent. - // It has no body. - KindCloseSend Kind = 6 // body must be empty - - // KindInvokeMetadata includes metadata about the next Invoke packet. - KindInvokeMetadata Kind = 7 -) - -// -// packet id -// - -// ID represents a packet id. -type ID struct { - // Stream is the stream identifier. - Stream uint64 - - // Message is the message identifier. - Message uint64 -} - -// Less returns true if the id is less than the provided one. An ID is less than -// another if the Stream is less, and if the stream is equal, if the Message -// is less. -func (i ID) Less(j ID) bool { - return i.Stream < j.Stream || (i.Stream == j.Stream && i.Message < j.Message) -} - -// String returns a human readable form of the ID. -func (i ID) String() string { return fmt.Sprintf("<%d,%d>", i.Stream, i.Message) } - -// -// data frame -// - -// Frame is a split data frame on the wire. -type Frame struct { - // Data is the payload of bytes. - Data []byte - - // ID is used so that the frame can be reconstructed. - ID ID - - // Kind is the kind of the payload. - Kind Kind - - // Done is true if this is the last frame for the ID. - Done bool - - // Control is true if the frame has the control bit set. - Control bool -} - -// ParseFrame attempts to parse a frame at the beginning of buf. If successful -// then rem contains the unparsed data, fr contains the parsed frame, ok will -// be true, and err will be nil. If there is not enough data for a frame, ok -// will be false and err will be nil. If the data in the buf is malformed, then -// an error is returned. -func ParseFrame(buf []byte) (rem []byte, fr Frame, ok bool, err error) { - var length uint64 - var control byte - if len(buf) < 4 { - goto bad - } - - rem, control = buf[1:], buf[0] - fr.Done = (control & 0b00000001) > 0 - fr.Control = (control & 0b10000000) > 0 - fr.Kind = Kind((control & 0b01111110) >> 1) - rem, fr.ID.Stream, ok, err = ReadVarint(rem) - if !ok || err != nil { - goto bad - } - rem, fr.ID.Message, ok, err = ReadVarint(rem) - if !ok || err != nil { - goto bad - } - rem, length, ok, err = ReadVarint(rem) - if !ok || err != nil || length > uint64(len(rem)) { - goto bad - } - rem, fr.Data = rem[length:], rem[:length] - - return rem, fr, true, nil -bad: - return buf, fr, false, err -} - -// AppendFrame appends a marshaled form of the frame to the provided buffer. -func AppendFrame(buf []byte, fr Frame) []byte { - control := byte(fr.Kind << 1) - if fr.Done { - control |= 0b00000001 - } - if fr.Control { - control |= 0b10000000 - } - - out := buf - out = append(out, control) - out = AppendVarint(out, fr.ID.Stream) - out = AppendVarint(out, fr.ID.Message) - out = AppendVarint(out, uint64(len(fr.Data))) - out = append(out, fr.Data...) - return out -} - -// -// packet -// - -// Packet is a single message sent by drpc. -type Packet struct { - // Data is the payload of the packet. - Data []byte - - // ID is the identifier for the packet. - ID ID - - // Kind is the kind of the packet. - Kind Kind -} - -// String returns a human readable form of the packet. -func (p Packet) String() string { - return fmt.Sprintf("", - p.ID.Stream, p.ID.Message, p.Kind, len(p.Data)) -} diff --git a/vendor/storj.io/drpc/drpcwire/packet_string.go b/vendor/storj.io/drpc/drpcwire/packet_string.go deleted file mode 100644 index 5b7e452f5..000000000 --- a/vendor/storj.io/drpc/drpcwire/packet_string.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by "stringer -type=Kind -trimprefix=Kind_ -output=packet_string.go"; DO NOT EDIT. - -package drpcwire - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[kindReserved-0] - _ = x[kindCancelDeprecated-4] - _ = x[KindInvoke-1] - _ = x[KindMessage-2] - _ = x[KindError-3] - _ = x[KindClose-5] - _ = x[KindCloseSend-6] - _ = x[KindInvokeMetadata-7] -} - -const _Kind_name = "kindReservedKindInvokeKindMessageKindErrorkindCancelDeprecatedKindCloseKindCloseSendKindInvokeMetadata" - -var _Kind_index = [...]uint8{0, 12, 22, 33, 42, 62, 71, 84, 102} - -func (i Kind) String() string { - if i >= Kind(len(_Kind_index)-1) { - return "Kind(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] -} diff --git a/vendor/storj.io/drpc/drpcwire/split.go b/vendor/storj.io/drpc/drpcwire/split.go deleted file mode 100644 index cfe7662b9..000000000 --- a/vendor/storj.io/drpc/drpcwire/split.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcwire - -// SplitN splits the marshaled form of the Packet into a number of -// frames such that each frame is at most n bytes. It calls -// the callback with every such frame. If n is zero, a default of -// 1024 is used. -func SplitN(pkt Packet, n int, cb func(fr Frame) error) error { - switch { - case n == 0: - n = 1024 - case n < 0: - n = 0 - } - - for { - fr := Frame{ - Data: pkt.Data, - ID: pkt.ID, - Kind: pkt.Kind, - Done: true, - } - if len(pkt.Data) > n && n > 0 { - fr.Data, pkt.Data = pkt.Data[:n], pkt.Data[n:] - fr.Done = false - } - if err := cb(fr); err != nil { - return err - } - if fr.Done { - return nil - } - } -} diff --git a/vendor/storj.io/drpc/drpcwire/transport.go b/vendor/storj.io/drpc/drpcwire/transport.go deleted file mode 100644 index 3eacdb8c3..000000000 --- a/vendor/storj.io/drpc/drpcwire/transport.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcwire - -import ( - "bufio" - "io" - "sync" - - "storj.io/drpc" -) - -// -// Writer -// - -// Writer is a helper to buffer and write packets and frames to an io.Writer. -type Writer struct { - w io.Writer - size int - mu sync.Mutex - buf []byte -} - -// NewWriter returns a Writer that will attempt to buffer size data before -// sending it to the io.Writer. -func NewWriter(w io.Writer, size int) *Writer { - if size == 0 { - size = 1024 - } - - return &Writer{ - w: w, - size: size, - buf: make([]byte, 0, size), - } -} - -// WritePacket writes the packet as a single frame, ignoring any size -// constraints. -func (b *Writer) WritePacket(pkt Packet) (err error) { - return b.WriteFrame(Frame{ - Data: pkt.Data, - ID: pkt.ID, - Kind: pkt.Kind, - Done: true, - }) -} - -// WriteFrame appends the frame into the buffer, and if the buffer is larger -// than the configured size, flushes it. -func (b *Writer) WriteFrame(fr Frame) (err error) { - b.mu.Lock() - b.buf = AppendFrame(b.buf, fr) - if len(b.buf) >= b.size { - _, err = b.w.Write(b.buf) - b.buf = b.buf[:0] - } - b.mu.Unlock() - return err -} - -// Flush forces a flush of any buffered data to the io.Writer. It is a no-op if -// there is no data in the buffer. -func (b *Writer) Flush() (err error) { - defer mon.Task()(nil)(&err) - - b.mu.Lock() - if len(b.buf) > 0 { - _, err = b.w.Write(b.buf) - b.buf = b.buf[:0] - } - b.mu.Unlock() - return err -} - -// -// Reader -// - -// SplitFrame is used by bufio.Scanner to split frames out of a stream of bytes. -func SplitFrame(data []byte, atEOF bool) (int, []byte, error) { - rem, _, ok, err := ParseFrame(data) - switch advance := len(data) - len(rem); { - case err != nil: - return 0, nil, err - case len(data) > 0 && !ok && atEOF: - return 0, nil, drpc.ProtocolError.New("truncated frame") - case !ok: - return 0, nil, nil - case advance < 0, len(data) < advance: - return 0, nil, drpc.InternalError.New("scanner issue with advance value") - default: - return advance, data[:advance], nil - } -} - -// Reader reconstructs packets from frames read from an io.Reader. -type Reader struct { - buf *bufio.Scanner - id ID -} - -// NewReader constructs a Reader to read Packets from the io.Reader. -func NewReader(r io.Reader) *Reader { - buf := bufio.NewScanner(r) - buf.Buffer(make([]byte, 4<<10), 1<<20) - buf.Split(SplitFrame) - return &Reader{buf: buf} -} - -// ReadPacket reads a packet from the io.Reader. IDs read from frames -// must be monotonically increasing. When a new ID is read, the old -// data is discarded. This allows for easier asynchronous interrupts. -// If the amount of data in the Packet becomes too large, an error is -// returned. -func (s *Reader) ReadPacket() (pkt Packet, err error) { - defer mon.Task()(nil)(&err) - - for s.buf.Scan() { - rem, fr, ok, err := ParseFrame(s.buf.Bytes()) - switch { - case err != nil: - return Packet{}, drpc.ProtocolError.Wrap(err) - case !ok, len(rem) > 0: - return Packet{}, drpc.InternalError.New("problem with scanner") - case fr.Control: - // Ignore any frames with the control bit set so that we can - // use it in the future to mean things to people who understand - // it. - continue - case fr.ID.Less(s.id): - return Packet{}, drpc.ProtocolError.New("id monotonicity violation") - case s.id.Less(fr.ID): - s.id = fr.ID - pkt = Packet{ - Data: pkt.Data[:0], - ID: fr.ID, - Kind: fr.Kind, - } - case fr.Kind != pkt.Kind: - return Packet{}, drpc.ProtocolError.New("packet kind change") - } - - pkt.Data = append(pkt.Data, fr.Data...) - switch { - case len(pkt.Data) > 4<<20: - return Packet{}, drpc.ProtocolError.New("data overflow") - case fr.Done: - return pkt, nil - } - } - if err := s.buf.Err(); err != nil { - return Packet{}, err - } - return Packet{}, io.EOF -} diff --git a/vendor/storj.io/drpc/drpcwire/varint.go b/vendor/storj.io/drpc/drpcwire/varint.go deleted file mode 100644 index b76d15aea..000000000 --- a/vendor/storj.io/drpc/drpcwire/varint.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package drpcwire - -import "storj.io/drpc" - -// ReadVarint reads a varint encoded integer from the front of buf, returning the -// remaining bytes, the value, and if there was a success. if ok is false, the -// returned buffer is the same as the passed in buffer. -func ReadVarint(buf []byte) (rem []byte, out uint64, ok bool, err error) { - rem = buf - for shift := uint(0); shift < 64; shift += 7 { - if len(rem) == 0 { - return buf, 0, false, nil - } - val := uint64(rem[0]) - out, rem = out|((val&127)<= 128 { - buf = append(buf, byte(x&127|128)) - x >>= 7 - } - return append(buf, byte(x)) -} diff --git a/vendor/storj.io/drpc/go.mod b/vendor/storj.io/drpc/go.mod deleted file mode 100644 index c37f759e3..000000000 --- a/vendor/storj.io/drpc/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module storj.io/drpc - -go 1.13 - -require ( - github.com/gogo/protobuf v1.2.1 - github.com/spacemonkeygo/monkit/v3 v3.0.4 - github.com/zeebo/assert v1.1.0 - github.com/zeebo/errs v1.2.2 -) diff --git a/vendor/storj.io/drpc/go.sum b/vendor/storj.io/drpc/go.sum deleted file mode 100644 index ac65c599f..000000000 --- a/vendor/storj.io/drpc/go.sum +++ /dev/null @@ -1,20 +0,0 @@ -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/spacemonkeygo/monkit/v3 v3.0.4 h1:Ay+PZirv+qfd4sqcT+X/U3BnC7AcIaqp/IXh0oV36k8= -github.com/spacemonkeygo/monkit/v3 v3.0.4/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes= -github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a h1:8+cCjxhToanKmxLIbuyBNe2EnpgwhiivsIaRJstDRFA= -github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a/go.mod h1:ul4bvvnCOPZgq8w0nTkSmWVg/hauVpFS97Am1YM1XXo= -github.com/zeebo/assert v1.1.0 h1:hU1L1vLTHsnO8x8c9KAR5GmM5QscxHg5RNU5z5qbUWY= -github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/errs v1.2.2 h1:5NFypMTuSdoySVTqlNs1dEoU21QVamMQJxW/Fii5O7g= -github.com/zeebo/errs v1.2.2/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/storj.io/drpc/staticcheck.conf b/vendor/storj.io/drpc/staticcheck.conf deleted file mode 100644 index 62ca9d4a4..000000000 --- a/vendor/storj.io/drpc/staticcheck.conf +++ /dev/null @@ -1 +0,0 @@ -checks = ["all", "-ST1008"] diff --git a/vendor/storj.io/uplink/.clabot b/vendor/storj.io/uplink/.clabot deleted file mode 100644 index d8393a410..000000000 --- a/vendor/storj.io/uplink/.clabot +++ /dev/null @@ -1,63 +0,0 @@ -{ - "contributors": [ - "aleitner", - "aligeti", - "Barterio", - "brimstone", - "bryanchriswhite", - "cam-a", - "coyle", - "crawter", - "dylanlott", - "egonelbre", - "fadila82", - "iglesiasbrandon", - "jenlij", - "jhagans3", - "jtolds", - "kaloyan-raev", - "littleskunk", - "mniewrzal", - "mobyvb", - "navillasa", - "nfarah86", - "NikolaiYurchenko", - "phutchins", - "rikysya", - "stefanbenten", - "thepaul", - "wthorp", - "RichardLitt", - "fuskovic", - "keleffew", - "oCroso", - "pgerbes1", - "JessicaGreben", - "benjaminsirb", - "simongui", - "ifraixedes", - "VinozzZ", - "zeebo", - "barlock", - "sndrr", - "BlackDuck888", - "3bl3gamer", - "ethanadams", - "ReneSmeekes", - "VitaliiShpital", - "isaachess", - "azdagron", - "phthano", - "nerdatwork", - "kmozurkewich", - "TopperDEL", - "kristaxox", - "calebcase", - "mbouzi", - "AlexeyALeonov", - "Qweder93", - "cpustejovsky", - "grafael", - "ihaid" - ] -} diff --git a/vendor/storj.io/uplink/.gitignore b/vendor/storj.io/uplink/.gitignore deleted file mode 100644 index 20d5cf778..000000000 --- a/vendor/storj.io/uplink/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -# Mac OS X files -.DS_Store - -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib -*.db - -# Test binary, build with `go test -c` -*.test -*.prof - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# VSCode -/.vscode -debug - -# Visual Studio -/.vs - -# Jetbrains -.idea/ - -*.coverprofile -*.log - -/release/ -*.swp -/bin -resource.syso - -*.resource.go -/.build/ \ No newline at end of file diff --git a/vendor/storj.io/uplink/CODE_OF_CONDUCT.md b/vendor/storj.io/uplink/CODE_OF_CONDUCT.md deleted file mode 100644 index ef2f1b5b8..000000000 --- a/vendor/storj.io/uplink/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,53 +0,0 @@ -# Code of Conduct -Storj strives to create a welcoming and thriving environment. In order to ensure that every community member is respected and supported, we’ve adopted some general community guidelines. - -## Our Pledge - -We value diversity and inclusiveness in our community and encourage participation by fostering an open and welcoming environment. We as contributors and maintainers pledge to keep our community respectful and inclusive. By participating in our project, you pledge to keep our community a harassment-free experience for everyone, regardless of race, color, religion, gender, sexual orientation, national origin, age, disability, pregnancy, marital status, body size, appearance, education, level of experience, education, or socioeconomic status. - -## Our Standards - -### Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -### Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and agree to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for any behavior that they deem inappropriate, threatening, offensive, or harmful. - -## Scope -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported anonymously or by contacting the project team at conduct@storj.io. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership or maintainers. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/vendor/storj.io/uplink/Jenkinsfile b/vendor/storj.io/uplink/Jenkinsfile deleted file mode 100644 index f042e5f17..000000000 --- a/vendor/storj.io/uplink/Jenkinsfile +++ /dev/null @@ -1,134 +0,0 @@ -pipeline { - agent { - docker { - label 'main' - image docker.build("storj-ci", "--pull https://github.com/storj/ci.git").id - args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod' - } - } - options { - timeout(time: 26, unit: 'MINUTES') - } - environment { - NPM_CONFIG_CACHE = '/tmp/npm/cache' - } - stages { - stage('Build') { - steps { - checkout scm - - sh 'mkdir -p .build' - - sh 'service postgresql start' - - sh 'cockroach start-single-node --insecure --store=\'/tmp/crdb\' --listen-addr=localhost:26257 --http-addr=localhost:8080 --cache 512MiB --max-sql-memory 512MiB --background' - } - } - - stage('Verification') { - parallel { - stage('Lint') { - steps { - sh 'check-copyright' - sh 'check-large-files' - sh 'check-imports ./...' - sh 'check-peer-constraints' - sh 'storj-protobuf --protoc=$HOME/protoc/bin/protoc lint' - sh 'storj-protobuf --protoc=$HOME/protoc/bin/protoc check-lock' - sh 'check-atomic-align ./...' - sh 'check-errs ./...' - sh './scripts/check-dependencies.sh' - sh 'staticcheck ./...' - sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run' - sh 'go-licenses check ./...' - sh './scripts/check-libuplink-size.sh' - } - } - - stage('Tests') { - environment { - COVERFLAGS = "${ env.BRANCH_NAME != 'master' ? '' : '-coverprofile=.build/coverprofile -coverpkg=./...'}" - } - steps { - sh 'go vet ./...' - sh 'go test -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 20m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml' - // TODO enable this later - // sh 'check-clean-directory' - } - - post { - always { - sh script: 'cat .build/tests.json | tparse -all -top -slow 100', returnStatus: true - archiveArtifacts artifacts: '.build/tests.json' - junit '.build/tests.xml' - - script { - if(fileExists(".build/coverprofile")){ - sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true - sh script: 'gocov convert .build/clean.coverprofile > .build/cover.json', returnStatus: true - sh script: 'gocov-xml < .build/cover.json > .build/cobertura.xml', returnStatus: true - cobertura coberturaReportFile: '.build/cobertura.xml' - } - } - } - } - } - - stage('Testsuite') { - environment { - STORJ_COCKROACH_TEST = 'cockroach://root@localhost:26257/testcockroach?sslmode=disable' - STORJ_POSTGRES_TEST = 'postgres://postgres@localhost/teststorj?sslmode=disable' - COVERFLAGS = "${ env.BRANCH_NAME != 'master' ? '' : '-coverprofile=.build/coverprofile -coverpkg=./...'}" - } - steps { - sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach;\'' - sh 'psql -U postgres -c \'create database teststorj;\'' - dir('testsuite'){ - sh 'go vet ./...' - sh 'go test -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 20m -json -race ./... 2>&1 | tee ../.build/testsuite.json | xunit -out ../.build/testsuite.xml' - } - // TODO enable this later - // sh 'check-clean-directory' - } - - post { - always { - sh script: 'cat .build/testsuite.json | tparse -all -top -slow 100', returnStatus: true - archiveArtifacts artifacts: '.build/testsuite.json' - junit '.build/testsuite.xml' - } - } - } - - stage('Integration [storj/storj]') { - environment { - STORJ_POSTGRES_TEST = 'postgres://postgres@localhost/teststorj2?sslmode=disable' - STORJ_COCKROACH_TEST = 'omit' - } - steps { - sh 'psql -U postgres -c \'create database teststorj2;\'' - dir('testsuite'){ - sh 'go vet storj.io/storj/...' - sh 'go test -parallel 4 -p 6 -vet=off -timeout 20m -json storj.io/storj/... 2>&1 | tee ../.build/testsuite-storj.json | xunit -out ../.build/testsuite-storj.xml' - } - } - - post { - always { - sh script: 'cat .build/testsuite-storj.json | tparse -all -top -slow 100', returnStatus: true - archiveArtifacts artifacts: '.build/testsuite-storj.json' - junit '.build/testsuite-storj.xml' - } - } - } - } - } - } - - post { - always { - sh "chmod -R 777 ." // ensure Jenkins agent can delete the working directory - deleteDir() - } - } -} diff --git a/vendor/storj.io/uplink/LICENSE b/vendor/storj.io/uplink/LICENSE deleted file mode 100644 index 8d869750c..000000000 --- a/vendor/storj.io/uplink/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2020 Storj Labs, Inc. - -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/storj.io/uplink/MAINTAINERS.md b/vendor/storj.io/uplink/MAINTAINERS.md deleted file mode 100644 index 18b2ca0c1..000000000 --- a/vendor/storj.io/uplink/MAINTAINERS.md +++ /dev/null @@ -1,51 +0,0 @@ -# How to release a new version - -## When to release a new version - -New version should be released when we are ready to make changes generally available. - -New version should not be released if we want to test our latest changes or to make them available to a limited number of users. This can be achieved without releasing a new version. Go modules allow to point to latest master or specific Git commit. However, commits from master are not suitable for use in production unless they are a release tag. Do not use non-release commits in downstream projects in production. - -Consider releasing a new Release Candidate version to make changes available to a larger group of users, if we are not ready to make them available to everyone yet. - -Under no circumstances may releases be done during the weekend or the wee hours of the night. - -## Version numbers - -We follow the rules for semantic versioning, but prefixed with the letter `v`. - -Examples of official releases: -- `v1.0.0` -- `v1.0.3` -- `v1.2.3` -- `v2.1.7` - -Examples of Release Candidates: -- `v1.0.0-rc.4` -- `v2.1.0-rc.1` - -## Step-by-step release process - -1. Clone or fetch latest master of these Git repositories: - - https://github.com/storj/storj - - https://github.com/storj/gateway - - https://github.com/storj/uplink-c - - https://github.com/storj/linksharing -2. For each of them update, `go.mod` and `testsuite/go.mod` to latest master (or the specific Git commit that will be tagged as a new version) of `storj.io/uplink`. Makefile target `bump-dependencies` (available in all listed repositories) can bo used to do this automatically. -3. Use `go mod tidy` to update the respective `go.sum` files. -4. Push a change to Gerrit with the updated `go.mod` and `go.sum` files for each of the Git repositories. -5. Wait for the build to finish. If the build fails for any of the Git repositories, abort the release process. Investigate the issue, fix it, and start over the release process. -6. If all builds are successful, do not merge the changes yet. -7. If you haven't done this yet, announce your intention to make a new release to the #libuplink Slack channel. -8. Wait for a confirmation by at least one maintainer of this project (storj/uplink) before proceeding with the next step. -9. Create a new release from the Github web interface: - - Go to https://github.com/storj/uplink/releases. - - Click the `Draft a new release` button. - - Enter `Tag version` following the rules for the version number, e.g. `v1.2.3`. - - Enter the same value as `Release title`, e.g. `v1.2.3`. - - If there are new commits in master since you executed step 1, do not include them in the release. Change the `Target` from `master` to the specific Git commit used in step 1. - - Describe the changes since the previous release in a human-readable way. Only those changes that affect users. No need to describe refactorings, etc. - - If you are releasing a new Release Candidate, select the `This is a pre-release` checkbox. - - Click the `Publish release` button. -10. Update the Gerrit changes from step 1 with the new official version number. -11. Wait for the build to finish again and merge them. diff --git a/vendor/storj.io/uplink/Makefile b/vendor/storj.io/uplink/Makefile deleted file mode 100644 index ea0968929..000000000 --- a/vendor/storj.io/uplink/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -.PHONY: bump-dependencies -bump-dependencies: - go get storj.io/common@master - go mod tidy - cd testsuite;\ - go get storj.io/common@master storj.io/storj@master storj.io/uplink@master;\ - go mod tidy \ No newline at end of file diff --git a/vendor/storj.io/uplink/README.md b/vendor/storj.io/uplink/README.md deleted file mode 100644 index 0ce19dda6..000000000 --- a/vendor/storj.io/uplink/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Libuplink - -Go library for Storj V3 Network. - -[![Go Report Card](https://goreportcard.com/badge/storj.io/uplink)](https://goreportcard.com/report/storj.io/uplink) -[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://pkg.go.dev/storj.io/uplink) -![Beta](https://img.shields.io/badge/version-beta-green.svg) - - - -Storj is building a decentralized cloud storage network. -[Check out our white paper for more info!](https://storj.io/white-paper) - ----- - -Storj is an S3-compatible platform and suite of decentralized applications that -allows you to store data in a secure and decentralized manner. Your files are -encrypted, broken into little pieces and stored in a global decentralized -network of computers. Luckily, we also support allowing you (and only you) to -retrieve those files! - -### A Note about Versioning - -Our versioning in this repo is intended to primarily support the expectations of the -[Go modules](https://blog.golang.org/using-go-modules) system, so you can expect that -within a major version release, backwards-incompatible changes will be avoided at high -cost. This is not the case with our downstream repo, -[storj/storj](https://github.com/storj/storj/). - -# Documentation - -- [Go Doc](https://pkg.go.dev/storj.io/uplink) -- [Libuplink Walkthrough](https://github.com/storj/storj/wiki/Libuplink-Walkthrough) - -# Language bindings - -- [Uplink-C](https://github.com/storj/uplink-c) - -# License - -This library is distributed under the -[MIT license](https://opensource.org/licenses/MIT) (also known as the Expat license). - -# Support - -If you have any questions or suggestions please reach out to us on [our community forum](https://forum.storj.io/) or file a support ticket at https://support.tardigrade.io. \ No newline at end of file diff --git a/vendor/storj.io/uplink/access.go b/vendor/storj.io/uplink/access.go deleted file mode 100644 index 5a6a1e892..000000000 --- a/vendor/storj.io/uplink/access.go +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - "strings" - "time" - - "github.com/btcsuite/btcutil/base58" - "github.com/zeebo/errs" - - "storj.io/common/encryption" - "storj.io/common/macaroon" - "storj.io/common/paths" - "storj.io/common/pb" - "storj.io/common/storj" - "storj.io/uplink/internal/expose" -) - -// An Access Grant contains everything to access a project and specific buckets. -// It includes a potentially-restricted API Key, a potentially-restricted set -// of encryption information, and information about the Satellite responsible -// for the project's metadata. -type Access struct { - satelliteAddress string - apiKey *macaroon.APIKey - encAccess *encryptionAccess -} - -// SharePrefix defines a prefix that will be shared. -type SharePrefix struct { - Bucket string - // Prefix is the prefix of the shared object keys. - // - // Note: that within a bucket, the hierarchical key derivation scheme is - // delineated by forward slashes (/), so encryption information will be - // included in the resulting access grant to decrypt any key that shares - // the same prefix up until the last slash. - Prefix string -} - -// Permission defines what actions can be used to share. -type Permission struct { - // AllowDownload gives permission to download the object's content. It - // allows getting object metadata, but it does not allow listing buckets. - AllowDownload bool - // AllowUpload gives permission to create buckets and upload new objects. - // It does not allow overwriting existing objects unless AllowDelete is - // granted too. - AllowUpload bool - // AllowList gives permission to list buckets. It allows getting object - // metadata, but it does not allow downloading the object's content. - AllowList bool - // AllowDelete gives permission to delete buckets and objects. Unless - // either AllowDownload or AllowList is granted too, no object metadata and - // no error info will be returned for deleted objects. - AllowDelete bool - // NotBefore restricts when the resulting access grant is valid for. - // If set, the resulting access grant will not work if the Satellite - // believes the time is before NotBefore. - // If set, this value should always be before NotAfter. - NotBefore time.Time - // NotAfter restricts when the resulting access grant is valid for. - // If set, the resulting access grant will not work if the Satellite - // believes the time is after NotAfter. - // If set, this value should always be after NotBefore. - NotAfter time.Time -} - -// ParseAccess parses a serialized access grant string. -// -// This should be the main way to instantiate an access grant for opening a project. -// See the note on RequestAccessWithPassphrase. -func ParseAccess(access string) (*Access, error) { - data, version, err := base58.CheckDecode(access) - if err != nil || version != 0 { - return nil, packageError.New("invalid access grant format") - } - - p := new(pb.Scope) - if err := pb.Unmarshal(data, p); err != nil { - return nil, packageError.New("unable to unmarshal access grant: %v", err) - } - - if len(p.SatelliteAddr) == 0 { - return nil, packageError.New("access grant is missing satellite address") - } - - apiKey, err := macaroon.ParseRawAPIKey(p.ApiKey) - if err != nil { - return nil, packageError.New("access grant has malformed api key: %v", err) - } - - encAccess, err := parseEncryptionAccessFromProto(p.EncryptionAccess) - if err != nil { - return nil, packageError.New("access grant has malformed encryption access: %v", err) - } - - return &Access{ - satelliteAddress: p.SatelliteAddr, - apiKey: apiKey, - encAccess: encAccess, - }, nil -} - -// Serialize serializes an access grant such that it can be used later with -// ParseAccess or other tools. -func (access *Access) Serialize() (string, error) { - switch { - case len(access.satelliteAddress) == 0: - return "", packageError.New("access grant is missing satellite address") - case access.apiKey == nil: - return "", packageError.New("access grant is missing api key") - case access.encAccess == nil: - return "", packageError.New("access grant is missing encryption access") - } - - enc, err := access.encAccess.toProto() - if err != nil { - return "", packageError.Wrap(err) - } - - data, err := pb.Marshal(&pb.Scope{ - SatelliteAddr: access.satelliteAddress, - ApiKey: access.apiKey.SerializeRaw(), - EncryptionAccess: enc, - }) - if err != nil { - return "", packageError.New("unable to marshal access grant: %v", err) - } - - return base58.CheckEncode(data, 0), nil -} - -// RequestAccessWithPassphrase generates a new access grant using a passhprase. -// It must talk to the Satellite provided to get a project-based salt for -// deterministic key derivation. -// -// Note: this is a CPU-heavy function that uses a password-based key derivation function -// (Argon2). This should be a setup-only step. Most common interactions with the library -// should be using a serialized access grant through ParseAccess directly. -func RequestAccessWithPassphrase(ctx context.Context, satelliteAddress, apiKey, passphrase string) (*Access, error) { - return (Config{}).RequestAccessWithPassphrase(ctx, satelliteAddress, apiKey, passphrase) -} - -// RequestAccessWithPassphrase generates a new access grant using a passhprase. -// It must talk to the Satellite provided to get a project-based salt for -// deterministic key derivation. -// -// Note: this is a CPU-heavy function that uses a password-based key derivation function -// (Argon2). This should be a setup-only step. Most common interactions with the library -// should be using a serialized access grant through ParseAccess directly. -func (config Config) RequestAccessWithPassphrase(ctx context.Context, satelliteAddress, apiKey, passphrase string) (*Access, error) { - return requestAccessWithPassphraseAndConcurrency(ctx, config, satelliteAddress, apiKey, passphrase, 8) -} - -func init() { - // expose this method for backcomp package. - expose.RequestAccessWithPassphraseAndConcurrency = requestAccessWithPassphraseAndConcurrency - - // expose this method for private/access package. - expose.EnablePathEncryptionBypass = enablePathEncryptionBypass -} - -// requestAccessWithPassphraseAndConcurrency requests satellite for a new access grant using a passhprase and specific concurrency for the Argon2 key derivation. -// -// NB: when modifying the signature of this func, also update backcomp and internal/expose packages. -func requestAccessWithPassphraseAndConcurrency(ctx context.Context, config Config, satelliteAddress, apiKey, passphrase string, concurrency uint8) (_ *Access, err error) { - parsedAPIKey, err := macaroon.ParseAPIKey(apiKey) - if err != nil { - return nil, packageError.Wrap(err) - } - - metainfo, _, fullNodeURL, err := config.dial(ctx, satelliteAddress, parsedAPIKey) - if err != nil { - return nil, packageError.Wrap(err) - } - defer func() { err = errs.Combine(err, metainfo.Close()) }() - - info, err := metainfo.GetProjectInfo(ctx) - if err != nil { - return nil, convertKnownErrors(err, "", "") - } - - key, err := encryption.DeriveRootKey([]byte(passphrase), info.ProjectSalt, "", concurrency) - if err != nil { - return nil, packageError.Wrap(err) - } - - encAccess := newEncryptionAccessWithDefaultKey(key) - encAccess.setDefaultPathCipher(storj.EncAESGCM) - return &Access{ - satelliteAddress: fullNodeURL, - apiKey: parsedAPIKey, - encAccess: encAccess, - }, nil -} - -// enablePathEncryptionBypass enables path encryption bypass for embedded encryption access. -// -// NB: when modifying the signature of this func, also update private/access and internal/expose packages. -func enablePathEncryptionBypass(access *Access) error { - access.encAccess.Store().EncryptionBypass = true - return nil -} - -// Share creates a new access grant with specific permissions. -// -// Access grants can only have their existing permissions restricted, -// and the resulting access grant will only allow for the intersection of all previous -// Share calls in the access grant construction chain. -// -// Prefixes, if provided, restrict the access grant (and internal encryption information) -// to only contain enough information to allow access to just those prefixes. -func (access *Access) Share(permission Permission, prefixes ...SharePrefix) (*Access, error) { - if permission == (Permission{}) { - return nil, packageError.New("permission is empty") - } - - var notBefore, notAfter *time.Time - if !permission.NotBefore.IsZero() { - notBefore = &permission.NotBefore - } - if !permission.NotAfter.IsZero() { - notAfter = &permission.NotAfter - } - - if notBefore != nil && notAfter != nil && notAfter.Before(*notBefore) { - return nil, packageError.New("invalid time range") - } - - caveat := macaroon.Caveat{ - DisallowReads: !permission.AllowDownload, - DisallowWrites: !permission.AllowUpload, - DisallowLists: !permission.AllowList, - DisallowDeletes: !permission.AllowDelete, - NotBefore: notBefore, - NotAfter: notAfter, - } - - sharedAccess := newEncryptionAccess() - sharedAccess.setDefaultPathCipher(access.encAccess.Store().GetDefaultPathCipher()) - if len(prefixes) == 0 { - sharedAccess.setDefaultKey(access.encAccess.Store().GetDefaultKey()) - } - - for _, prefix := range prefixes { - // If the share prefix ends in a `/` we need to remove this final slash. - // Otherwise, if we the shared prefix is `/bob/`, the encrypted shared - // prefix results in `enc("")/enc("bob")/enc("")`. This is an incorrect - // encrypted prefix, what we really want is `enc("")/enc("bob")`. - unencPath := paths.NewUnencrypted(strings.TrimSuffix(prefix.Prefix, "/")) - - encPath, err := encryption.EncryptPathWithStoreCipher(prefix.Bucket, unencPath, access.encAccess.store) - if err != nil { - return nil, err - } - derivedKey, err := encryption.DerivePathKey(prefix.Bucket, unencPath, access.encAccess.store) - if err != nil { - return nil, err - } - - if err := sharedAccess.store.Add(prefix.Bucket, unencPath, encPath, *derivedKey); err != nil { - return nil, err - } - caveat.AllowedPaths = append(caveat.AllowedPaths, &macaroon.Caveat_Path{ - Bucket: []byte(prefix.Bucket), - EncryptedPathPrefix: []byte(encPath.Raw()), - }) - } - - restrictedAPIKey, err := access.apiKey.Restrict(caveat) - if err != nil { - return nil, err - } - - restrictedAccess := &Access{ - satelliteAddress: access.satelliteAddress, - apiKey: restrictedAPIKey, - encAccess: sharedAccess, - } - return restrictedAccess, nil -} - -// ReadOnlyPermission returns a Permission that allows reading and listing -// (if the parent access grant already allows those things). -func ReadOnlyPermission() Permission { - return Permission{ - AllowDownload: true, - AllowList: true, - } -} - -// WriteOnlyPermission returns a Permission that allows writing and deleting -// (if the parent access grant already allows those things). -func WriteOnlyPermission() Permission { - return Permission{ - AllowUpload: true, - AllowDelete: true, - } -} - -// FullPermission returns a Permission that allows all actions that the -// parent access grant already allows. -func FullPermission() Permission { - return Permission{ - AllowDownload: true, - AllowUpload: true, - AllowList: true, - AllowDelete: true, - } -} diff --git a/vendor/storj.io/uplink/bucket.go b/vendor/storj.io/uplink/bucket.go deleted file mode 100644 index eb4c61566..000000000 --- a/vendor/storj.io/uplink/bucket.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - "errors" - "time" - - "github.com/zeebo/errs" - - "storj.io/common/errs2" - "storj.io/common/rpc/rpcstatus" - "storj.io/common/storj" -) - -// ErrBucketNameInvalid is returned when the bucket name is invalid. -var ErrBucketNameInvalid = errors.New("bucket name invalid") - -// ErrBucketAlreadyExists is returned when the bucket already exists during creation. -var ErrBucketAlreadyExists = errors.New("bucket already exists") - -// ErrBucketNotEmpty is returned when the bucket is not empty during deletion. -var ErrBucketNotEmpty = errors.New("bucket not empty") - -// ErrBucketNotFound is returned when the bucket is not found. -var ErrBucketNotFound = errors.New("bucket not found") - -// Bucket contains information about the bucket. -type Bucket struct { - Name string - Created time.Time -} - -// StatBucket returns information about a bucket. -func (project *Project) StatBucket(ctx context.Context, bucket string) (info *Bucket, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - b, err := project.db.GetBucket(ctx, bucket) - if err != nil { - return nil, convertKnownErrors(err, bucket, "") - } - - return &Bucket{ - Name: b.Name, - Created: b.Created, - }, nil -} - -// CreateBucket creates a new bucket. -// -// When bucket already exists it returns a valid Bucket and ErrBucketExists. -func (project *Project) CreateBucket(ctx context.Context, bucket string) (created *Bucket, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - b, err := project.db.CreateBucket(ctx, bucket) - - if err != nil { - if storj.ErrNoBucket.Has(err) { - return nil, errwrapf("%w (%q)", ErrBucketNameInvalid, bucket) - } - if errs2.IsRPC(err, rpcstatus.AlreadyExists) { - // TODO: Ideally, the satellite should return the existing bucket when this error occurs. - existing, err := project.StatBucket(ctx, bucket) - if err != nil { - return existing, errs.Combine(errwrapf("%w (%q)", ErrBucketAlreadyExists, bucket), convertKnownErrors(err, bucket, "")) - } - return existing, errwrapf("%w (%q)", ErrBucketAlreadyExists, bucket) - } - return nil, convertKnownErrors(err, bucket, "") - } - - return &Bucket{ - Name: b.Name, - Created: b.Created, - }, nil -} - -// EnsureBucket ensures that a bucket exists or creates a new one. -// -// When bucket already exists it returns a valid Bucket and no error. -func (project *Project) EnsureBucket(ctx context.Context, bucket string) (ensured *Bucket, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - ensured, err = project.CreateBucket(ctx, bucket) - if err != nil && !errors.Is(err, ErrBucketAlreadyExists) { - return nil, convertKnownErrors(err, bucket, "") - } - - return ensured, nil -} - -// DeleteBucket deletes a bucket. -// -// When bucket is not empty it returns ErrBucketNotEmpty. -func (project *Project) DeleteBucket(ctx context.Context, bucket string) (deleted *Bucket, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - existing, err := project.db.DeleteBucket(ctx, bucket) - if err != nil { - if errs2.IsRPC(err, rpcstatus.FailedPrecondition) { - return nil, errwrapf("%w (%q)", ErrBucketNotEmpty, bucket) - } - return nil, convertKnownErrors(err, bucket, "") - } - - if existing == (storj.Bucket{}) { - return nil, nil - } - - return &Bucket{ - Name: existing.Name, - Created: existing.Created, - }, nil -} diff --git a/vendor/storj.io/uplink/buckets.go b/vendor/storj.io/uplink/buckets.go deleted file mode 100644 index bc372d243..000000000 --- a/vendor/storj.io/uplink/buckets.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - - "storj.io/common/storj" -) - -// ListBucketsOptions defines bucket listing options. -type ListBucketsOptions struct { - // Cursor sets the starting position of the iterator. The first item listed will be the one after the cursor. - Cursor string -} - -// ListBuckets returns an iterator over the buckets. -func (project *Project) ListBuckets(ctx context.Context, options *ListBucketsOptions) *BucketIterator { - defer mon.Func().RestartTrace(&ctx)(nil) - - opts := storj.BucketListOptions{ - Direction: storj.After, - } - - if options != nil { - opts.Cursor = options.Cursor - } - - buckets := BucketIterator{ - ctx: ctx, - project: project, - options: opts, - } - - return &buckets -} - -// BucketIterator is an iterator over a collection of buckets. -type BucketIterator struct { - ctx context.Context - project *Project - options storj.BucketListOptions - list *storj.BucketList - position int - completed bool - err error -} - -// Next prepares next Bucket for reading. -// It returns false if the end of the iteration is reached and there are no more buckets, or if there is an error. -func (buckets *BucketIterator) Next() bool { - if buckets.err != nil { - buckets.completed = true - return false - } - - if buckets.list == nil { - more := buckets.loadNext() - buckets.completed = !more - return more - } - - if buckets.position >= len(buckets.list.Items)-1 { - if !buckets.list.More { - buckets.completed = true - return false - } - more := buckets.loadNext() - buckets.completed = !more - return more - } - - buckets.position++ - - return true -} - -func (buckets *BucketIterator) loadNext() bool { - list, err := buckets.project.db.ListBuckets(buckets.ctx, buckets.options) - if err != nil { - buckets.err = convertKnownErrors(err, "", "") - return false - } - buckets.list = &list - if list.More { - buckets.options = buckets.options.NextPage(list) - } - buckets.position = 0 - return len(list.Items) > 0 -} - -// Err returns error, if one happened during iteration. -func (buckets *BucketIterator) Err() error { - return packageError.Wrap(buckets.err) -} - -// Item returns the current bucket in the iterator. -func (buckets *BucketIterator) Item() *Bucket { - item := buckets.item() - if item == nil { - return nil - } - return &Bucket{ - Name: item.Name, - Created: item.Created, - } -} - -func (buckets *BucketIterator) item() *storj.Bucket { - if buckets.completed { - return nil - } - - if buckets.err != nil { - return nil - } - - if buckets.list == nil { - return nil - } - - if len(buckets.list.Items) == 0 { - return nil - } - - return &buckets.list.Items[buckets.position] -} diff --git a/vendor/storj.io/uplink/common.go b/vendor/storj.io/uplink/common.go deleted file mode 100644 index 6ab1ed8c6..000000000 --- a/vendor/storj.io/uplink/common.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "errors" - "fmt" - "strings" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/common/errs2" - "storj.io/common/rpc/rpcstatus" - "storj.io/common/storj" -) - -var mon = monkit.Package() - -// Error is default error class for uplink. -var packageError = errs.Class("uplink") - -// ErrTooManyRequests is returned when user has sent too many requests in a given amount of time. -var ErrTooManyRequests = errors.New("too many requests") - -// ErrBandwidthLimitExceeded is returned when project will exceeded bandwidth limit. -var ErrBandwidthLimitExceeded = errors.New("bandwidth limit exceeded") - -func convertKnownErrors(err error, bucket, key string) error { - switch { - case storj.ErrNoBucket.Has(err): - return errwrapf("%w (%q)", ErrBucketNameInvalid, bucket) - case storj.ErrNoPath.Has(err): - return errwrapf("%w (%q)", ErrObjectKeyInvalid, key) - case storj.ErrBucketNotFound.Has(err): - return errwrapf("%w (%q)", ErrBucketNotFound, bucket) - case storj.ErrObjectNotFound.Has(err): - return errwrapf("%w (%q)", ErrObjectNotFound, key) - case errs2.IsRPC(err, rpcstatus.ResourceExhausted): - // TODO is a better way to do this? - message := errs.Unwrap(err).Error() - if message == "Exceeded Usage Limit" { - return packageError.Wrap(ErrBandwidthLimitExceeded) - } else if message == "Too Many Requests" { - return packageError.Wrap(ErrTooManyRequests) - } - case errs2.IsRPC(err, rpcstatus.NotFound): - message := errs.Unwrap(err).Error() - if strings.HasPrefix(message, storj.ErrBucketNotFound.New("").Error()) { - return errwrapf("%w (%q)", ErrBucketNotFound, bucket) - } else if strings.HasPrefix(message, storj.ErrObjectNotFound.New("").Error()) { - return errwrapf("%w (%q)", ErrObjectNotFound, key) - } - } - - return packageError.Wrap(err) -} - -func errwrapf(format string, err error, args ...interface{}) error { - var all []interface{} - all = append(all, err) - all = append(all, args...) - return packageError.Wrap(fmt.Errorf(format, all...)) -} diff --git a/vendor/storj.io/uplink/config.go b/vendor/storj.io/uplink/config.go deleted file mode 100644 index 2f5ba4b90..000000000 --- a/vendor/storj.io/uplink/config.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - "net" - "time" - - "storj.io/common/identity" - "storj.io/common/macaroon" - "storj.io/common/peertls/tlsopts" - "storj.io/common/rpc" - "storj.io/common/storj" - "storj.io/uplink/private/metainfo" -) - -// Config defines configuration for using uplink library. -type Config struct { - UserAgent string - - // DialTimeout defines how long client should wait for establishing - // a connection to peers. - DialTimeout time.Duration - - // DialContext is how sockets are opened and is called to establish - // a connection. If unset, net.Dialer is used. - DialContext func(ctx context.Context, network, address string) (net.Conn, error) -} - -type dialContextFunc func(ctx context.Context, network, address string) (net.Conn, error) - -func (f dialContextFunc) DialContext(ctx context.Context, network, address string) (net.Conn, error) { - return f(ctx, network, address) -} - -func (config Config) dial(ctx context.Context, satelliteAddress string, apiKey *macaroon.APIKey) (_ *metainfo.Client, _ rpc.Dialer, fullNodeURL string, err error) { - ident, err := identity.NewFullIdentity(ctx, identity.NewCAOptions{ - Difficulty: 0, - Concurrency: 1, - }) - if err != nil { - return nil, rpc.Dialer{}, "", packageError.Wrap(err) - } - - tlsConfig := tlsopts.Config{ - UsePeerCAWhitelist: false, - PeerIDVersions: "0", - } - - tlsOptions, err := tlsopts.NewOptions(ident, tlsConfig, nil) - if err != nil { - return nil, rpc.Dialer{}, "", packageError.Wrap(err) - } - - dialer := rpc.NewDefaultDialer(tlsOptions) - dialer.DialTimeout = config.DialTimeout - if config.DialContext != nil { - dialer.Transport = dialContextFunc(config.DialContext) - } - - nodeURL, err := storj.ParseNodeURL(satelliteAddress) - if err != nil { - return nil, rpc.Dialer{}, "", packageError.Wrap(err) - } - - // Node id is required in satelliteNodeID for all unknown (non-storj) satellites. - // For known satellite it will be automatically prepended. - if nodeURL.ID.IsZero() { - nodeID, found := rpc.KnownNodeID(nodeURL.Address) - if !found { - return nil, rpc.Dialer{}, "", packageError.New("node id is required in satelliteNodeURL") - } - satelliteAddress = storj.NodeURL{ - ID: nodeID, - Address: nodeURL.Address, - }.String() - } - - metainfo, err := metainfo.DialNodeURL(ctx, dialer, satelliteAddress, apiKey, config.UserAgent) - - return metainfo, dialer, satelliteAddress, packageError.Wrap(err) -} diff --git a/vendor/storj.io/uplink/doc.go b/vendor/storj.io/uplink/doc.go deleted file mode 100644 index f7e343e17..000000000 --- a/vendor/storj.io/uplink/doc.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -/* -Package uplink is the main entrypoint to interacting with Storj Labs' decentralized -storage network. - -Sign up for an account on a Satellite today! https://tardigrade.io/satellites/ - -Access Grants - -The fundamental unit of access in the Storj Labs storage network is the Access Grant. -An access grant is a serialized structure that is internally comprised of an API Key, -a set of encryption key information, and information about which Storj Labs or -Tardigrade network Satellite is responsible for the metadata. An access grant is -always associated with exactly one Project on one Satellite. - -If you don't already have an access grant, you will need make an account on a -Satellite, generate an API Key, and encapsulate that API Key with encryption -information into an access grant. - -If you don't already have an account on a Satellite, first make one at -https://tardigrade.io/satellites/ and note the Satellite you choose (such as -us-central-1.tardigrade.io, europe-west-1.tardigrade.io, etc). Then, make an -API Key in the web interface. - -The first step to any project is to generate a restricted access grant with the -minimal permissions that are needed. Access grants contains all encryption information -and they should be restricted as much as possible. - -To make an access grant, you can create one using our Uplink CLI tool's 'share' -subcommand (after setting up the Uplink CLI tool), or you can make one as follows: - - access, err := uplink.RequestAccessWithPassphrase(ctx, satelliteAddress, apiKey, rootPassphrase) - if err != nil { - return err - } - - // create an access grant for reading bucket "logs" - permissions := uplink.ReadOnlyPermission() - shared := uplink.SharePrefix{Bucket: "logs"} - restrictedAccess, err := access.Share(permissions, shared) - if err != nil { - return err - } - - // serialize the restricted access - serializedAccess, err := restrictedAccess.Serialize() - if err != nil { - return err - } - -In the above example, 'serializedAccess' is a human-readable string that represents -read-only access to just the "logs" bucket, and is only able to decrypt that one -bucket thanks to hierarchical deterministic key derivation. - -Note: RequestAccessWithPassphrase is CPU-intensive, and your application's normal -lifecycle should avoid it and use ParseAccess where possible instead. - -Projects - -Once you have a valid access grant, you can open a Project with the access that -access grant allows for. - - project, err := uplink.OpenProject(ctx, access) - if err != nil { - return err - } - defer project.Close() - - -Projects allow you to manage buckets and objects within buckets. - -Buckets - -A bucket represents a collection of objects. You can upload, download, list, and delete objects of -any size or shape. Objects within buckets are represented by keys, where keys can optionally be -listed using the "/" delimiter. - -Note: Objects and object keys within buckets are end-to-end encrypted, but bucket names -themselves are not encrypted, so the billing interface on the Satellite can show you bucket line -items. - - buckets := project.ListBuckets(ctx, nil) - for buckets.Next() { - fmt.Println(buckets.Item().Name) - } - if err := buckets.Err(); err != nil { - return err - } - -Download Object - -Objects support a couple kilobytes of arbitrary key/value metadata, and arbitrary-size primary -data streams with the ability to read at arbitrary offsets. - - object, err := project.DownloadObject(ctx, "logs", "2020-04-18/webserver.log", nil) - if err != nil { - return err - } - defer object.Close() - - _, err = io.Copy(w, object) - return err - -If you want to access only a small subrange of the data you uploaded, you can use -`uplink.DownloadOptions` to specify the download range. - - object, err := project.DownloadObject(ctx, "logs", "2020-04-18/webserver.log", - &uplink.DownloadOptions{Offset: 10, Length: 100}) - if err != nil { - return err - } - defer object.Close() - - _, err = io.Copy(w, object) - return err - -List Objects - -Listing objects returns an iterator that allows to walk through all the items: - - objects := project.ListObjects(ctx, "logs", nil) - for objects.Next() { - item := objects.Item() - fmt.Println(item.IsPrefix, item.Key) - } - if err := objects.Err(); err != nil { - return err - } -*/ -package uplink diff --git a/vendor/storj.io/uplink/download.go b/vendor/storj.io/uplink/download.go deleted file mode 100644 index 3491a575b..000000000 --- a/vendor/storj.io/uplink/download.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - - "storj.io/common/storj" - "storj.io/uplink/private/stream" -) - -// DownloadOptions contains additional options for downloading. -type DownloadOptions struct { - Offset int64 - // When Length is negative it will read until the end of the blob. - Length int64 -} - -// DownloadObject starts a download from the specific key. -func (project *Project) DownloadObject(ctx context.Context, bucket, key string, options *DownloadOptions) (download *Download, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - if bucket == "" { - return nil, errwrapf("%w (%q)", ErrBucketNameInvalid, bucket) - } - if key == "" { - return nil, errwrapf("%w (%q)", ErrObjectKeyInvalid, key) - } - - if options == nil { - options = &DownloadOptions{ - Offset: 0, - Length: -1, - } - } - - b := storj.Bucket{Name: bucket} - - obj, err := project.db.GetObject(ctx, b, key) - if err != nil { - return nil, convertKnownErrors(err, bucket, key) - } - - objectStream, err := project.db.GetObjectStream(ctx, b, obj) - if err != nil { - return nil, packageError.Wrap(err) - } - - return &Download{ - download: stream.NewDownloadRange(ctx, objectStream, project.streams, options.Offset, options.Length), - object: convertObject(&obj), - }, nil -} - -// Download is a download from Storj Network. -type Download struct { - download *stream.Download - object *Object -} - -// Info returns the last information about the object. -func (download *Download) Info() *Object { - return download.object -} - -// Read downloads up to len(p) bytes into p from the object's data stream. -// It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. -func (download *Download) Read(p []byte) (n int, err error) { - return download.download.Read(p) -} - -// Close closes the reader of the download. -func (download *Download) Close() error { - return download.download.Close() -} diff --git a/vendor/storj.io/uplink/encryption.go b/vendor/storj.io/uplink/encryption.go deleted file mode 100644 index 502dae948..000000000 --- a/vendor/storj.io/uplink/encryption.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "storj.io/common/encryption" - "storj.io/common/paths" - "storj.io/common/pb" - "storj.io/common/storj" -) - -// encryptionAccess represents an encryption access context. It holds -// information about how various buckets and objects should be -// encrypted and decrypted. -type encryptionAccess struct { - store *encryption.Store -} - -// newEncryptionAccess creates an encryption access context. -func newEncryptionAccess() *encryptionAccess { - store := encryption.NewStore() - return &encryptionAccess{store: store} -} - -// newEncryptionAccessWithDefaultKey creates an encryption access context with -// a default key set. -// Use (*Project).SaltedKeyFromPassphrase to generate a default key. -func newEncryptionAccessWithDefaultKey(defaultKey *storj.Key) *encryptionAccess { - ec := newEncryptionAccess() - ec.setDefaultKey(defaultKey) - return ec -} - -// Store returns the underlying encryption store for the access context. -func (s *encryptionAccess) Store() *encryption.Store { - return s.store -} - -// setDefaultKey sets the default key for the encryption access context. -// Use (*Project).SaltedKeyFromPassphrase to generate a default key. -func (s *encryptionAccess) setDefaultKey(defaultKey *storj.Key) { - s.store.SetDefaultKey(defaultKey) -} - -func (s *encryptionAccess) setDefaultPathCipher(defaultPathCipher storj.CipherSuite) { - s.store.SetDefaultPathCipher(defaultPathCipher) -} - -func (s *encryptionAccess) toProto() (*pb.EncryptionAccess, error) { - var storeEntries []*pb.EncryptionAccess_StoreEntry - err := s.store.IterateWithCipher(func(bucket string, unenc paths.Unencrypted, enc paths.Encrypted, key storj.Key, pathCipher storj.CipherSuite) error { - storeEntries = append(storeEntries, &pb.EncryptionAccess_StoreEntry{ - Bucket: []byte(bucket), - UnencryptedPath: []byte(unenc.Raw()), - EncryptedPath: []byte(enc.Raw()), - Key: key[:], - PathCipher: pb.CipherSuite(pathCipher), - }) - return nil - }) - if err != nil { - return nil, packageError.Wrap(err) - } - - var defaultKey []byte - if key := s.store.GetDefaultKey(); key != nil { - defaultKey = key[:] - } - - return &pb.EncryptionAccess{ - DefaultKey: defaultKey, - StoreEntries: storeEntries, - DefaultPathCipher: pb.CipherSuite(s.store.GetDefaultPathCipher()), - }, nil -} - -func parseEncryptionAccessFromProto(p *pb.EncryptionAccess) (*encryptionAccess, error) { - access := newEncryptionAccess() - if len(p.DefaultKey) > 0 { - if len(p.DefaultKey) != len(storj.Key{}) { - return nil, packageError.New("invalid default key in encryption access") - } - var defaultKey storj.Key - copy(defaultKey[:], p.DefaultKey) - access.setDefaultKey(&defaultKey) - } - - access.setDefaultPathCipher(storj.CipherSuite(p.DefaultPathCipher)) - // Unspecified cipher suite means that most probably access was serialized - // before path cipher was moved to encryption access - if p.DefaultPathCipher == pb.CipherSuite_ENC_UNSPECIFIED { - access.setDefaultPathCipher(storj.EncAESGCM) - } - - for _, entry := range p.StoreEntries { - if len(entry.Key) != len(storj.Key{}) { - return nil, packageError.New("invalid key in encryption access entry") - } - var key storj.Key - copy(key[:], entry.Key) - - err := access.store.AddWithCipher( - string(entry.Bucket), - paths.NewUnencrypted(string(entry.UnencryptedPath)), - paths.NewEncrypted(string(entry.EncryptedPath)), - key, - storj.CipherSuite(entry.PathCipher), - ) - if err != nil { - return nil, packageError.New("invalid encryption access entry: %v", err) - } - } - - return access, nil -} diff --git a/vendor/storj.io/uplink/go.mod b/vendor/storj.io/uplink/go.mod deleted file mode 100644 index 2bd772d82..000000000 --- a/vendor/storj.io/uplink/go.mod +++ /dev/null @@ -1,14 +0,0 @@ -module storj.io/uplink - -go 1.13 - -require ( - github.com/btcsuite/btcutil v1.0.1 - github.com/spacemonkeygo/monkit/v3 v3.0.7-0.20200515175308-072401d8c752 - github.com/stretchr/testify v1.4.0 - github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3 - github.com/zeebo/errs v1.2.2 - go.uber.org/zap v1.10.0 - golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e - storj.io/common v0.0.0-20200611114417-9a3d012fdb62 -) diff --git a/vendor/storj.io/uplink/go.sum b/vendor/storj.io/uplink/go.sum deleted file mode 100644 index 2789bf7ef..000000000 --- a/vendor/storj.io/uplink/go.sum +++ /dev/null @@ -1,101 +0,0 @@ -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.1 h1:GKOz8BnRjYrb/JTKgaOk+zh26NWNdSNvdvv0xoAZMSA= -github.com/btcsuite/btcutil v1.0.1/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/calebcase/tmpfile v1.0.1 h1:vD8FSrbsbexhep39/6mvtbIHS3GzIRqiprDNCF6QqSk= -github.com/calebcase/tmpfile v1.0.1/go.mod h1:iErLeG/iqJr8LaQ/gYRv4GXdqssi3jg4iSzvrA06/lw= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= -github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -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/spacemonkeygo/monkit/v3 v3.0.4 h1:Ay+PZirv+qfd4sqcT+X/U3BnC7AcIaqp/IXh0oV36k8= -github.com/spacemonkeygo/monkit/v3 v3.0.4/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes= -github.com/spacemonkeygo/monkit/v3 v3.0.5 h1:vMW8Ne6WAUU/OMYaSv7KGW9h/sRNgeh6TyBapOSuMhM= -github.com/spacemonkeygo/monkit/v3 v3.0.5/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes= -github.com/spacemonkeygo/monkit/v3 v3.0.7-0.20200515175308-072401d8c752 h1:WcQDknqg0qajLNYKv3mXgbkWlYs5rPgZehGJFWePHVI= -github.com/spacemonkeygo/monkit/v3 v3.0.7-0.20200515175308-072401d8c752/go.mod h1:kj1ViJhlyADa7DiA4xVnTuPA46lFKbM7mxQTrXCuJP4= -github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a h1:8+cCjxhToanKmxLIbuyBNe2EnpgwhiivsIaRJstDRFA= -github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a/go.mod h1:ul4bvvnCOPZgq8w0nTkSmWVg/hauVpFS97Am1YM1XXo= -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/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3 h1:zMsHhfK9+Wdl1F7sIKLyx3wrOFofpb3rWFbA4HgcK5k= -github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3/go.mod h1:R0Gbuw7ElaGSLOZUSwBm/GgVwMd30jWxBDdAyMOeTuc= -github.com/zeebo/admission/v3 v3.0.1 h1:/IWg2jLhfjBOUhhdKcbweSzcY3QlbbE57sqvU72EpqA= -github.com/zeebo/admission/v3 v3.0.1/go.mod h1:BP3isIv9qa2A7ugEratNq1dnl2oZRXaQUGdU7WXKtbw= -github.com/zeebo/assert v1.1.0 h1:hU1L1vLTHsnO8x8c9KAR5GmM5QscxHg5RNU5z5qbUWY= -github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/errs v1.2.2 h1:5NFypMTuSdoySVTqlNs1dEoU21QVamMQJxW/Fii5O7g= -github.com/zeebo/errs v1.2.2/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= -github.com/zeebo/float16 v0.1.0 h1:kRqxv5og6z1emEyz5FpW0/BVHe5VfxEAw6b1ljCZlUc= -github.com/zeebo/float16 v0.1.0/go.mod h1:fssGvvXu+XS8MH57cKmyrLB/cqioYeYX/2mXCN3a5wo= -github.com/zeebo/incenc v0.0.0-20180505221441-0d92902eec54 h1:+cwNE5KJ3pika4HuzmDHkDlK5myo0G9Sv+eO7WWxnUQ= -github.com/zeebo/incenc v0.0.0-20180505221441-0d92902eec54/go.mod h1:EI8LcOBDlSL3POyqwC1eJhOYlMBMidES+613EtmmT5w= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/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-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107144601-ef85f5a75ddf h1:9cZxTVBvFZgOnVi/DobY3JsafbPFPnP2rtN81d4wPpw= -golang.org/x/sys v0.0.0-20200107144601-ef85f5a75ddf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -storj.io/common v0.0.0-20200611114417-9a3d012fdb62 h1:y8vGNQ0HjtD79G8MfCwbs6hct40tSBoDaOnsxWOZpU4= -storj.io/common v0.0.0-20200611114417-9a3d012fdb62/go.mod h1:6S6Ub92/BB+ofU7hbyPcm96b4Q1ayyN0HLog+3u+wGc= -storj.io/drpc v0.0.12 h1:4ei1M4cnWlYxcQheX0Dg4+c12zCD+oJqfweVQVWarsA= -storj.io/drpc v0.0.12/go.mod h1:82nfl+6YwRwF6UG31cEWWUqv/FaKvP5SGqUvoqTxCMA= diff --git a/vendor/storj.io/uplink/internal/expose/exposed.go b/vendor/storj.io/uplink/internal/expose/exposed.go deleted file mode 100644 index d13edfc08..000000000 --- a/vendor/storj.io/uplink/internal/expose/exposed.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package expose - -// RequestAccessWithPassphraseAndConcurrency exposes uplink.requestAccessWithPassphraseAndConcurrency. -// -// func RequestAccessWithPassphraseAndConcurrency(ctx context.Context, config uplink.Config, satelliteNodeURL, apiKey, passphrase string, concurrency uint8) (_ *uplink.Access, err error). -var RequestAccessWithPassphraseAndConcurrency interface{} - -// EnablePathEncryptionBypass exposes uplink.enablePathEncryptionBypass. -// -// func EnablePathEncryptionBypass(access *Access) error. -var EnablePathEncryptionBypass interface{} diff --git a/vendor/storj.io/uplink/internal/telemetryclient/client.go b/vendor/storj.io/uplink/internal/telemetryclient/client.go deleted file mode 100644 index 1aeb759a3..000000000 --- a/vendor/storj.io/uplink/internal/telemetryclient/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -// Package telemetryclient is internal package to support telemetry -// without introducing a direct dependency to the actual implementation. -package telemetryclient - -import ( - "context" - - "go.uber.org/zap" -) - -type contextKey int - -const constructorKey contextKey = iota - -// Constructor creates a new telemetry client. -type Constructor func(log *zap.Logger, satelliteAddress string) (Client, error) - -// Client is the common interface for telemetry. -type Client interface { - Run(ctx context.Context) - Stop() - Report(ctx context.Context) error -} - -// WithConstructor specifies which telemetry to use. -func WithConstructor(ctx context.Context, ctor Constructor) context.Context { - return context.WithValue(ctx, constructorKey, ctor) -} - -// ConstructorFrom loads the telemetry client constructor from context. -func ConstructorFrom(ctx context.Context) (_ Constructor, ok bool) { - v := ctx.Value(constructorKey) - if v == nil { - return nil, false - } - - ctor, ok := v.(Constructor) - return ctor, ok -} diff --git a/vendor/storj.io/uplink/object.go b/vendor/storj.io/uplink/object.go deleted file mode 100644 index 99c145898..000000000 --- a/vendor/storj.io/uplink/object.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - "errors" - "fmt" - "strings" - "time" - "unicode/utf8" - - "github.com/zeebo/errs" - - "storj.io/common/storj" -) - -// ErrObjectKeyInvalid is returned when the object key is invalid. -var ErrObjectKeyInvalid = errors.New("object key invalid") - -// ErrObjectNotFound is returned when the object is not found. -var ErrObjectNotFound = errors.New("object not found") - -// Object contains information about an object. -type Object struct { - Key string - // IsPrefix indicates whether the Key is a prefix for other objects. - IsPrefix bool - - System SystemMetadata - Custom CustomMetadata -} - -// SystemMetadata contains information about the object that cannot be changed directly. -type SystemMetadata struct { - Created time.Time - Expires time.Time - ContentLength int64 -} - -// CustomMetadata contains custom user metadata about the object. -// -// The keys and values in custom metadata are expected to be valid UTF-8. -// -// When choosing a custom key for your application start it with a prefix "app:key", -// as an example application named "Image Board" might use a key "image-board:title". -type CustomMetadata map[string]string - -// Clone makes a deep clone. -func (meta CustomMetadata) Clone() CustomMetadata { - r := CustomMetadata{} - for k, v := range meta { - r[k] = v - } - return r -} - -// Verify verifies whether CustomMetadata contains only "utf-8". -func (meta CustomMetadata) Verify() error { - var invalid []string - for k, v := range meta { - if !utf8.ValidString(k) || !utf8.ValidString(v) { - invalid = append(invalid, fmt.Sprintf("not utf-8 %q=%q", k, v)) - } - if strings.IndexByte(k, 0) >= 0 || strings.IndexByte(v, 0) >= 0 { - invalid = append(invalid, fmt.Sprintf("contains 0 byte: %q=%q", k, v)) - } - if k == "" { - invalid = append(invalid, "empty key") - } - } - - if len(invalid) > 0 { - return errs.New("invalid pairs %v", invalid) - } - - return nil -} - -// StatObject returns information about an object at the specific key. -func (project *Project) StatObject(ctx context.Context, bucket, key string) (info *Object, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - b := storj.Bucket{Name: bucket} - obj, err := project.db.GetObject(ctx, b, key) - if err != nil { - return nil, convertKnownErrors(err, bucket, key) - } - - return convertObject(&obj), nil -} - -// DeleteObject deletes the object at the specific key. -func (project *Project) DeleteObject(ctx context.Context, bucket, key string) (deleted *Object, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - b := storj.Bucket{Name: bucket} - obj, err := project.db.DeleteObject(ctx, b, key) - if err != nil { - return nil, convertKnownErrors(err, bucket, key) - } - return convertObject(&obj), nil -} - -// convertObject converts storj.Object to uplink.Object. -func convertObject(obj *storj.Object) *Object { - if obj.Bucket.Name == "" { // zero object - return nil - } - - return &Object{ - Key: obj.Path, - System: SystemMetadata{ - Created: obj.Created, - Expires: obj.Expires, - ContentLength: obj.Size, - }, - Custom: obj.Metadata, - } -} diff --git a/vendor/storj.io/uplink/objects.go b/vendor/storj.io/uplink/objects.go deleted file mode 100644 index 6f640e9c5..000000000 --- a/vendor/storj.io/uplink/objects.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - - "storj.io/common/storj" -) - -// ListObjectsOptions defines object listing options. -type ListObjectsOptions struct { - // Prefix allows to filter objects by a key prefix. If not empty, it must end with slash. - Prefix string - // Cursor sets the starting position of the iterator. The first item listed will be the one after the cursor. - Cursor string - // Recursive iterates the objects without collapsing prefixes. - Recursive bool - - // System includes SystemMetadata in the results. - System bool - // Custom includes CustomMetadata in the results. - Custom bool -} - -// ListObjects returns an iterator over the objects. -func (project *Project) ListObjects(ctx context.Context, bucket string, options *ListObjectsOptions) *ObjectIterator { - defer mon.Func().RestartTrace(&ctx)(nil) - - b := storj.Bucket{Name: bucket, PathCipher: storj.EncAESGCM} - opts := storj.ListOptions{ - Direction: storj.After, - } - - if options != nil { - opts.Prefix = options.Prefix - opts.Cursor = options.Cursor - opts.Recursive = options.Recursive - } - - objects := ObjectIterator{ - ctx: ctx, - project: project, - bucket: b, - options: opts, - } - - if options != nil { - objects.objOptions = *options - } - - return &objects -} - -// ObjectIterator is an iterator over a collection of objects or prefixes. -type ObjectIterator struct { - ctx context.Context - project *Project - bucket storj.Bucket - options storj.ListOptions - objOptions ListObjectsOptions - list *storj.ObjectList - position int - completed bool - err error -} - -// Next prepares next Object for reading. -// It returns false if the end of the iteration is reached and there are no more objects, or if there is an error. -func (objects *ObjectIterator) Next() bool { - if objects.err != nil { - objects.completed = true - return false - } - - if objects.list == nil { - more := objects.loadNext() - objects.completed = !more - return more - } - - if objects.position >= len(objects.list.Items)-1 { - if !objects.list.More { - objects.completed = true - return false - } - more := objects.loadNext() - objects.completed = !more - return more - } - - objects.position++ - - return true -} - -func (objects *ObjectIterator) loadNext() bool { - list, err := objects.project.db.ListObjects(objects.ctx, objects.bucket, objects.options) - if err != nil { - objects.err = convertKnownErrors(err, objects.bucket.Name, "") - return false - } - objects.list = &list - if list.More { - objects.options = objects.options.NextPage(list) - } - objects.position = 0 - return len(list.Items) > 0 -} - -// Err returns error, if one happened during iteration. -func (objects *ObjectIterator) Err() error { - return packageError.Wrap(objects.err) -} - -// Item returns the current object in the iterator. -func (objects *ObjectIterator) Item() *Object { - item := objects.item() - if item == nil { - return nil - } - - key := item.Path - if len(objects.options.Prefix) > 0 { - key = objects.options.Prefix + item.Path - } - - obj := Object{ - Key: key, - IsPrefix: item.IsPrefix, - } - - // TODO: Make this filtering on the satellite - if objects.objOptions.System { - obj.System = SystemMetadata{ - Created: item.Created, - Expires: item.Expires, - ContentLength: item.Size, - } - } - - // TODO: Make this filtering on the satellite - if objects.objOptions.Custom { - obj.Custom = item.Metadata - } - - return &obj -} - -func (objects *ObjectIterator) item() *storj.Object { - if objects.completed { - return nil - } - - if objects.err != nil { - return nil - } - - if objects.list == nil { - return nil - } - - if len(objects.list.Items) == 0 { - return nil - } - - return &objects.list.Items[objects.position] -} diff --git a/vendor/storj.io/uplink/private/ecclient/client.go b/vendor/storj.io/uplink/private/ecclient/client.go deleted file mode 100644 index 57d3959c0..000000000 --- a/vendor/storj.io/uplink/private/ecclient/client.go +++ /dev/null @@ -1,445 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package ecclient - -import ( - "context" - "io" - "io/ioutil" - "sort" - "sync" - "time" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - "go.uber.org/zap" - - "storj.io/common/encryption" - "storj.io/common/errs2" - "storj.io/common/identity" - "storj.io/common/pb" - "storj.io/common/ranger" - "storj.io/common/rpc" - "storj.io/common/storj" - "storj.io/uplink/private/eestream" - "storj.io/uplink/private/piecestore" -) - -var mon = monkit.Package() - -// Client defines an interface for storing erasure coded data to piece store nodes. -type Client interface { - Put(ctx context.Context, limits []*pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, rs eestream.RedundancyStrategy, data io.Reader, expiration time.Time) (successfulNodes []*pb.Node, successfulHashes []*pb.PieceHash, err error) - PutSingleResult(ctx context.Context, limits []*pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, rs eestream.RedundancyStrategy, data io.Reader, expiration time.Time) (results []*pb.SegmentPieceUploadResult, err error) - Get(ctx context.Context, limits []*pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, es eestream.ErasureScheme, size int64) (ranger.Ranger, error) - WithForceErrorDetection(force bool) Client - // PutPiece is not intended to be used by normal uplinks directly, but is exported to support storagenode graceful exit transfers. - PutPiece(ctx, parent context.Context, limit *pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, data io.ReadCloser) (hash *pb.PieceHash, id *identity.PeerIdentity, err error) -} - -type dialPiecestoreFunc func(context.Context, storj.NodeURL) (*piecestore.Client, error) - -type ecClient struct { - log *zap.Logger - dialer rpc.Dialer - memoryLimit int - forceErrorDetection bool -} - -// NewClient from the given identity and max buffer memory. -func NewClient(log *zap.Logger, dialer rpc.Dialer, memoryLimit int) Client { - return &ecClient{ - log: log, - dialer: dialer, - memoryLimit: memoryLimit, - } -} - -func (ec *ecClient) WithForceErrorDetection(force bool) Client { - ec.forceErrorDetection = force - return ec -} - -func (ec *ecClient) dialPiecestore(ctx context.Context, n storj.NodeURL) (*piecestore.Client, error) { - logger := ec.log.Named(n.ID.String()) - return piecestore.DialNodeURL(ctx, ec.dialer, n, logger, piecestore.DefaultConfig) -} - -func (ec *ecClient) Put(ctx context.Context, limits []*pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, rs eestream.RedundancyStrategy, data io.Reader, expiration time.Time) (successfulNodes []*pb.Node, successfulHashes []*pb.PieceHash, err error) { - defer mon.Task()(&ctx)(&err) - - pieceCount := len(limits) - if pieceCount != rs.TotalCount() { - return nil, nil, Error.New("size of limits slice (%d) does not match total count (%d) of erasure scheme", pieceCount, rs.TotalCount()) - } - - nonNilLimits := nonNilCount(limits) - if nonNilLimits <= rs.RepairThreshold() && nonNilLimits < rs.OptimalThreshold() { - return nil, nil, Error.New("number of non-nil limits (%d) is less than or equal to the repair threshold (%d) of erasure scheme", nonNilLimits, rs.RepairThreshold()) - } - - if !unique(limits) { - return nil, nil, Error.New("duplicated nodes are not allowed") - } - - ec.log.Debug("Uploading to storage nodes", - zap.Int("Erasure Share Size", rs.ErasureShareSize()), - zap.Int("Stripe Size", rs.StripeSize()), - zap.Int("Repair Threshold", rs.RepairThreshold()), - zap.Int("Optimal Threshold", rs.OptimalThreshold()), - ) - - padded := encryption.PadReader(ioutil.NopCloser(data), rs.StripeSize()) - readers, err := eestream.EncodeReader(ctx, ec.log, padded, rs) - if err != nil { - return nil, nil, err - } - - type info struct { - i int - err error - hash *pb.PieceHash - } - infos := make(chan info, pieceCount) - - psCtx, cancel := context.WithCancel(ctx) - defer cancel() - - for i, addressedLimit := range limits { - go func(i int, addressedLimit *pb.AddressedOrderLimit) { - hash, _, err := ec.PutPiece(psCtx, ctx, addressedLimit, privateKey, readers[i]) - infos <- info{i: i, err: err, hash: hash} - }(i, addressedLimit) - } - - successfulNodes = make([]*pb.Node, pieceCount) - successfulHashes = make([]*pb.PieceHash, pieceCount) - var successfulCount, failureCount, cancellationCount int32 - for range limits { - info := <-infos - - if limits[info.i] == nil { - continue - } - - if info.err != nil { - if !errs2.IsCanceled(info.err) { - failureCount++ - } else { - cancellationCount++ - } - ec.log.Debug("Upload to storage node failed", - zap.Stringer("Node ID", limits[info.i].GetLimit().StorageNodeId), - zap.Error(info.err), - ) - continue - } - - successfulNodes[info.i] = &pb.Node{ - Id: limits[info.i].GetLimit().StorageNodeId, - Address: limits[info.i].GetStorageNodeAddress(), - } - successfulHashes[info.i] = info.hash - - successfulCount++ - if int(successfulCount) >= rs.OptimalThreshold() { - ec.log.Debug("Success threshold reached. Cancelling remaining uploads.", - zap.Int("Optimal Threshold", rs.OptimalThreshold()), - ) - cancel() - } - } - - defer func() { - select { - case <-ctx.Done(): - err = Error.New("upload cancelled by user") - default: - } - }() - - mon.IntVal("put_segment_pieces_total").Observe(int64(pieceCount)) - mon.IntVal("put_segment_pieces_optimal").Observe(int64(rs.OptimalThreshold())) - mon.IntVal("put_segment_pieces_successful").Observe(int64(successfulCount)) - mon.IntVal("put_segment_pieces_failed").Observe(int64(failureCount)) - mon.IntVal("put_segment_pieces_canceled").Observe(int64(cancellationCount)) - - if int(successfulCount) <= rs.RepairThreshold() && int(successfulCount) < rs.OptimalThreshold() { - return nil, nil, Error.New("successful puts (%d) less than or equal to repair threshold (%d)", successfulCount, rs.RepairThreshold()) - } - - if int(successfulCount) < rs.OptimalThreshold() { - return nil, nil, Error.New("successful puts (%d) less than success threshold (%d)", successfulCount, rs.OptimalThreshold()) - } - - return successfulNodes, successfulHashes, nil -} - -func (ec *ecClient) PutSingleResult(ctx context.Context, limits []*pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, rs eestream.RedundancyStrategy, data io.Reader, expiration time.Time) (results []*pb.SegmentPieceUploadResult, err error) { - successfulNodes, successfulHashes, err := ec.Put(ctx, limits, privateKey, rs, data, expiration) - if err != nil { - return nil, err - } - - uploadResults := make([]*pb.SegmentPieceUploadResult, 0, len(successfulNodes)) - for i := range successfulNodes { - if successfulNodes[i] == nil { - continue - } - - uploadResults = append(uploadResults, &pb.SegmentPieceUploadResult{ - PieceNum: int32(i), - NodeId: successfulNodes[i].Id, - Hash: successfulHashes[i], - }) - } - - if l := len(uploadResults); l < rs.OptimalThreshold() { - return nil, Error.New("uploaded results (%d) are below the optimal threshold (%d)", l, rs.OptimalThreshold()) - } - - return uploadResults, nil -} - -func (ec *ecClient) PutPiece(ctx, parent context.Context, limit *pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, data io.ReadCloser) (hash *pb.PieceHash, peerID *identity.PeerIdentity, err error) { - nodeName := "nil" - if limit != nil { - nodeName = limit.GetLimit().StorageNodeId.String()[0:8] - } - defer mon.Task()(&ctx, "node: "+nodeName)(&err) - defer func() { err = errs.Combine(err, data.Close()) }() - - if limit == nil { - _, _ = io.Copy(ioutil.Discard, data) - return nil, nil, nil - } - - storageNodeID := limit.GetLimit().StorageNodeId - pieceID := limit.GetLimit().PieceId - ps, err := ec.dialPiecestore(ctx, storj.NodeURL{ - ID: storageNodeID, - Address: limit.GetStorageNodeAddress().Address, - }) - if err != nil { - ec.log.Debug("Failed dialing for putting piece to node", - zap.Stringer("Piece ID", pieceID), - zap.Stringer("Node ID", storageNodeID), - zap.Error(err), - ) - return nil, nil, err - } - defer func() { err = errs.Combine(err, ps.Close()) }() - - peerID, err = ps.GetPeerIdentity() - if err != nil { - ec.log.Debug("Failed getting peer identity from node connection", - zap.Stringer("Node ID", storageNodeID), - zap.Error(err), - ) - return nil, nil, err - } - - hash, err = ps.UploadReader(ctx, limit.GetLimit(), privateKey, data) - if err != nil { - if ctx.Err() == context.Canceled { - // Canceled context means the piece upload was interrupted by user or due - // to slow connection. No error logging for this case. - if parent.Err() == context.Canceled { - ec.log.Info("Upload to node canceled by user", zap.Stringer("Node ID", storageNodeID)) - } else { - ec.log.Debug("Node cut from upload due to slow connection", zap.Stringer("Node ID", storageNodeID)) - } - - // make sure context.Canceled is the primary error in the error chain - // for later errors.Is/errs2.IsCanceled checking - err = errs.Combine(context.Canceled, err) - - } else { - nodeAddress := "" - if limit.GetStorageNodeAddress() != nil { - nodeAddress = limit.GetStorageNodeAddress().GetAddress() - } - - ec.log.Debug("Failed uploading piece to node", - zap.Stringer("Piece ID", pieceID), - zap.Stringer("Node ID", storageNodeID), - zap.String("Node Address", nodeAddress), - zap.Error(err), - ) - } - - return nil, nil, err - } - - return hash, peerID, nil -} - -func (ec *ecClient) Get(ctx context.Context, limits []*pb.AddressedOrderLimit, privateKey storj.PiecePrivateKey, es eestream.ErasureScheme, size int64) (rr ranger.Ranger, err error) { - defer mon.Task()(&ctx)(&err) - - if len(limits) != es.TotalCount() { - return nil, Error.New("size of limits slice (%d) does not match total count (%d) of erasure scheme", len(limits), es.TotalCount()) - } - - if nonNilCount(limits) < es.RequiredCount() { - return nil, Error.New("number of non-nil limits (%d) is less than required count (%d) of erasure scheme", nonNilCount(limits), es.RequiredCount()) - } - - paddedSize := calcPadded(size, es.StripeSize()) - pieceSize := paddedSize / int64(es.RequiredCount()) - - rrs := map[int]ranger.Ranger{} - for i, addressedLimit := range limits { - if addressedLimit == nil { - continue - } - - rrs[i] = &lazyPieceRanger{ - dialPiecestore: ec.dialPiecestore, - limit: addressedLimit, - privateKey: privateKey, - size: pieceSize, - } - } - - rr, err = eestream.Decode(ec.log, rrs, es, ec.memoryLimit, ec.forceErrorDetection) - if err != nil { - return nil, Error.Wrap(err) - } - - ranger, err := encryption.Unpad(rr, int(paddedSize-size)) - return ranger, Error.Wrap(err) -} - -func unique(limits []*pb.AddressedOrderLimit) bool { - if len(limits) < 2 { - return true - } - ids := make(storj.NodeIDList, len(limits)) - for i, addressedLimit := range limits { - if addressedLimit != nil { - ids[i] = addressedLimit.GetLimit().StorageNodeId - } - } - - // sort the ids and check for identical neighbors - sort.Sort(ids) - // sort.Slice(ids, func(i, k int) bool { return ids[i].Less(ids[k]) }) - for i := 1; i < len(ids); i++ { - if ids[i] != (storj.NodeID{}) && ids[i] == ids[i-1] { - return false - } - } - - return true -} - -func calcPadded(size int64, blockSize int) int64 { - mod := size % int64(blockSize) - if mod == 0 { - return size - } - return size + int64(blockSize) - mod -} - -type lazyPieceRanger struct { - dialPiecestore dialPiecestoreFunc - limit *pb.AddressedOrderLimit - privateKey storj.PiecePrivateKey - size int64 -} - -// Size implements Ranger.Size. -func (lr *lazyPieceRanger) Size() int64 { - return lr.size -} - -// Range implements Ranger.Range to be lazily connected. -func (lr *lazyPieceRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - - return &lazyPieceReader{ - ranger: lr, - ctx: ctx, - offset: offset, - length: length, - }, nil -} - -type lazyPieceReader struct { - ranger *lazyPieceRanger - ctx context.Context - offset int64 - length int64 - - mu sync.Mutex - - isClosed bool - piecestore.Downloader - client *piecestore.Client -} - -func (lr *lazyPieceReader) Read(data []byte) (_ int, err error) { - lr.mu.Lock() - defer lr.mu.Unlock() - - if lr.isClosed { - return 0, io.EOF - } - if lr.Downloader == nil { - client, downloader, err := lr.ranger.dial(lr.ctx, lr.offset, lr.length) - if err != nil { - return 0, err - } - lr.Downloader = downloader - lr.client = client - } - - return lr.Downloader.Read(data) -} - -func (lr *lazyPieceRanger) dial(ctx context.Context, offset, length int64) (_ *piecestore.Client, _ piecestore.Downloader, err error) { - defer mon.Task()(&ctx)(&err) - ps, err := lr.dialPiecestore(ctx, storj.NodeURL{ - ID: lr.limit.GetLimit().StorageNodeId, - Address: lr.limit.GetStorageNodeAddress().Address, - }) - if err != nil { - return nil, nil, err - } - - download, err := ps.Download(ctx, lr.limit.GetLimit(), lr.privateKey, offset, length) - if err != nil { - return nil, nil, errs.Combine(err, ps.Close()) - } - return ps, download, nil -} - -func (lr *lazyPieceReader) Close() (err error) { - lr.mu.Lock() - defer lr.mu.Unlock() - - if lr.isClosed { - return nil - } - lr.isClosed = true - - if lr.Downloader != nil { - err = errs.Combine(err, lr.Downloader.Close()) - } - if lr.client != nil { - err = errs.Combine(err, lr.client.Close()) - } - return err -} - -func nonNilCount(limits []*pb.AddressedOrderLimit) int { - total := 0 - for _, limit := range limits { - if limit != nil { - total++ - } - } - return total -} diff --git a/vendor/storj.io/uplink/private/ecclient/common.go b/vendor/storj.io/uplink/private/ecclient/common.go deleted file mode 100644 index 02b04bf03..000000000 --- a/vendor/storj.io/uplink/private/ecclient/common.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package ecclient - -import ( - "github.com/zeebo/errs" -) - -// Error is the errs class of standard Ranger errors. -var Error = errs.Class("ecclient error") diff --git a/vendor/storj.io/uplink/private/eestream/common.go b/vendor/storj.io/uplink/private/eestream/common.go deleted file mode 100644 index de6c489d3..000000000 --- a/vendor/storj.io/uplink/private/eestream/common.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "github.com/zeebo/errs" -) - -// Error is the default eestream errs class. -var Error = errs.Class("eestream error") diff --git a/vendor/storj.io/uplink/private/eestream/decode.go b/vendor/storj.io/uplink/private/eestream/decode.go deleted file mode 100644 index cc871d562..000000000 --- a/vendor/storj.io/uplink/private/eestream/decode.go +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "context" - "io" - "io/ioutil" - "sync" - - "github.com/zeebo/errs" - "go.uber.org/zap" - - "storj.io/common/encryption" - "storj.io/common/errs2" - "storj.io/common/ranger" - "storj.io/common/readcloser" -) - -type decodedReader struct { - log *zap.Logger - ctx context.Context - cancel context.CancelFunc - readers map[int]io.ReadCloser - scheme ErasureScheme - stripeReader *StripeReader - outbuf []byte - err error - currentStripe int64 - expectedStripes int64 - close sync.Once - closeErr error -} - -// DecodeReaders takes a map of readers and an ErasureScheme returning a -// combined Reader. -// -// rs is a map of erasure piece numbers to erasure piece streams. -// expectedSize is the number of bytes expected to be returned by the Reader. -// mbm is the maximum memory (in bytes) to be allocated for read buffers. If -// set to 0, the minimum possible memory will be used. -// if forceErrorDetection is set to true then k+1 pieces will be always -// required for decoding, so corrupted pieces can be detected. -func DecodeReaders(ctx context.Context, cancel func(), log *zap.Logger, rs map[int]io.ReadCloser, es ErasureScheme, expectedSize int64, mbm int, forceErrorDetection bool) io.ReadCloser { - defer mon.Task()(&ctx)(nil) - if expectedSize < 0 { - return readcloser.FatalReadCloser(Error.New("negative expected size")) - } - if expectedSize%int64(es.StripeSize()) != 0 { - return readcloser.FatalReadCloser( - Error.New("expected size (%d) not a factor decoded block size (%d)", - expectedSize, es.StripeSize())) - } - if err := checkMBM(mbm); err != nil { - return readcloser.FatalReadCloser(err) - } - dr := &decodedReader{ - log: log, - readers: rs, - scheme: es, - stripeReader: NewStripeReader(log, rs, es, mbm, forceErrorDetection), - outbuf: make([]byte, 0, es.StripeSize()), - expectedStripes: expectedSize / int64(es.StripeSize()), - } - dr.ctx, dr.cancel = ctx, cancel - // Kick off a goroutine to watch for context cancelation. - go func() { - <-dr.ctx.Done() - _ = dr.Close() - }() - return dr -} - -func (dr *decodedReader) Read(p []byte) (n int, err error) { - ctx := dr.ctx - - if len(dr.outbuf) == 0 { - // if the output buffer is empty, let's fill it again - // if we've already had an error, fail - if dr.err != nil { - return 0, dr.err - } - // return EOF is the expected stripes were read - if dr.currentStripe >= dr.expectedStripes { - dr.err = io.EOF - return 0, dr.err - } - // read the input buffers of the next stripe - may also decode it - dr.outbuf, dr.err = dr.stripeReader.ReadStripe(ctx, dr.currentStripe, dr.outbuf) - if dr.err != nil { - return 0, dr.err - } - dr.currentStripe++ - } - - // copy what data we have to the output - n = copy(p, dr.outbuf) - // slide the remaining bytes to the beginning - copy(dr.outbuf, dr.outbuf[n:]) - // shrink the remaining buffer - dr.outbuf = dr.outbuf[:len(dr.outbuf)-n] - return n, nil -} - -func (dr *decodedReader) Close() (err error) { - ctx := dr.ctx - defer mon.Task()(&ctx)(&err) - // cancel the context to terminate reader goroutines - dr.cancel() - errorThreshold := len(dr.readers) - dr.scheme.RequiredCount() - var closeGroup errs2.Group - // avoid double close of readers - dr.close.Do(func() { - for _, r := range dr.readers { - r := r - closeGroup.Go(func() error { - return errs2.IgnoreCanceled(r.Close()) - }) - } - - // close the stripe reader - closeGroup.Go(dr.stripeReader.Close) - - allErrors := closeGroup.Wait() - errorThreshold -= len(allErrors) - dr.closeErr = errs.Combine(allErrors...) - }) - // TODO this is workaround, we need reorganize to return multiple errors or divide into fatal, non fatal - if errorThreshold < 0 { - return dr.closeErr - } - if dr.closeErr != nil { - dr.log.Debug("decode close non fatal error: ", zap.Error(dr.closeErr)) - } - return nil -} - -type decodedRanger struct { - log *zap.Logger - es ErasureScheme - rrs map[int]ranger.Ranger - inSize int64 - mbm int // max buffer memory - forceErrorDetection bool -} - -// Decode takes a map of Rangers and an ErasureScheme and returns a combined -// Ranger. -// -// rrs is a map of erasure piece numbers to erasure piece rangers. -// mbm is the maximum memory (in bytes) to be allocated for read buffers. If -// set to 0, the minimum possible memory will be used. -// if forceErrorDetection is set to true then k+1 pieces will be always -// required for decoding, so corrupted pieces can be detected. -func Decode(log *zap.Logger, rrs map[int]ranger.Ranger, es ErasureScheme, mbm int, forceErrorDetection bool) (ranger.Ranger, error) { - if err := checkMBM(mbm); err != nil { - return nil, err - } - if len(rrs) < es.RequiredCount() { - return nil, Error.New("not enough readers to reconstruct data!") - } - size := int64(-1) - for _, rr := range rrs { - if size == -1 { - size = rr.Size() - } else if size != rr.Size() { - return nil, Error.New( - "decode failure: range reader sizes don't all match") - } - } - if size == -1 { - return ranger.ByteRanger(nil), nil - } - if size%int64(es.ErasureShareSize()) != 0 { - return nil, Error.New("invalid erasure decoder and range reader combo. "+ - "range reader size (%d) must be a multiple of erasure encoder block size (%d)", - size, es.ErasureShareSize()) - } - return &decodedRanger{ - log: log, - es: es, - rrs: rrs, - inSize: size, - mbm: mbm, - forceErrorDetection: forceErrorDetection, - }, nil -} - -func (dr *decodedRanger) Size() int64 { - blocks := dr.inSize / int64(dr.es.ErasureShareSize()) - return blocks * int64(dr.es.StripeSize()) -} - -func (dr *decodedRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - - ctx, cancel := context.WithCancel(ctx) - // offset and length might not be block-aligned. figure out which - // blocks contain this request - firstBlock, blockCount := encryption.CalcEncompassingBlocks(offset, length, dr.es.StripeSize()) - - // go ask for ranges for all those block boundaries - readers := make(map[int]io.ReadCloser, len(dr.rrs)) - for i, rr := range dr.rrs { - r, err := rr.Range(ctx, firstBlock*int64(dr.es.ErasureShareSize()), blockCount*int64(dr.es.ErasureShareSize())) - if err != nil { - readers[i] = readcloser.FatalReadCloser(err) - } else { - readers[i] = r - } - } - - // decode from all those ranges - r := DecodeReaders(ctx, cancel, dr.log, readers, dr.es, blockCount*int64(dr.es.StripeSize()), dr.mbm, dr.forceErrorDetection) - // offset might start a few bytes in, potentially discard the initial bytes - _, err = io.CopyN(ioutil.Discard, r, offset-firstBlock*int64(dr.es.StripeSize())) - if err != nil { - return nil, Error.Wrap(err) - } - // length might not have included all of the blocks, limit what we return - return readcloser.LimitReadCloser(r, length), nil -} - -func checkMBM(mbm int) error { - if mbm < 0 { - return Error.New("negative max buffer memory") - } - return nil -} diff --git a/vendor/storj.io/uplink/private/eestream/encode.go b/vendor/storj.io/uplink/private/eestream/encode.go deleted file mode 100644 index 474db919d..000000000 --- a/vendor/storj.io/uplink/private/eestream/encode.go +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "context" - "io" - "io/ioutil" - "os" - - "github.com/vivint/infectious" - "go.uber.org/zap" - - "storj.io/common/encryption" - "storj.io/common/fpath" - "storj.io/common/memory" - "storj.io/common/pb" - "storj.io/common/ranger" - "storj.io/common/readcloser" - "storj.io/common/storj" - "storj.io/common/sync2" -) - -// ErasureScheme represents the general format of any erasure scheme algorithm. -// If this interface can be implemented, the rest of this library will work -// with it. -type ErasureScheme interface { - // Encode will take 'in' and call 'out' with erasure coded pieces. - Encode(in []byte, out func(num int, data []byte)) error - - // EncodeSingle will take 'in' with the stripe and fill 'out' with the erasure share for piece 'num'. - EncodeSingle(in, out []byte, num int) error - - // Decode will take a mapping of available erasure coded piece num -> data, - // 'in', and append the combined data to 'out', returning it. - Decode(out []byte, in map[int][]byte) ([]byte, error) - - // ErasureShareSize is the size of the erasure shares that come from Encode - // and are passed to Decode. - ErasureShareSize() int - - // StripeSize is the size the stripes that are passed to Encode and come - // from Decode. - StripeSize() int - - // Encode will generate this many erasure shares and therefore this many pieces. - TotalCount() int - - // Decode requires at least this many pieces. - RequiredCount() int -} - -// RedundancyStrategy is an ErasureScheme with a repair and optimal thresholds. -type RedundancyStrategy struct { - ErasureScheme - repairThreshold int - optimalThreshold int -} - -// NewRedundancyStrategy from the given ErasureScheme, repair and optimal thresholds. -// -// repairThreshold is the minimum repair threshold. -// If set to 0, it will be reset to the TotalCount of the ErasureScheme. -// optimalThreshold is the optimal threshold. -// If set to 0, it will be reset to the TotalCount of the ErasureScheme. -func NewRedundancyStrategy(es ErasureScheme, repairThreshold, optimalThreshold int) (RedundancyStrategy, error) { - if repairThreshold == 0 { - repairThreshold = es.TotalCount() - } - - if optimalThreshold == 0 { - optimalThreshold = es.TotalCount() - } - if repairThreshold < 0 { - return RedundancyStrategy{}, Error.New("negative repair threshold") - } - if repairThreshold > 0 && repairThreshold < es.RequiredCount() { - return RedundancyStrategy{}, Error.New("repair threshold less than required count") - } - if repairThreshold > es.TotalCount() { - return RedundancyStrategy{}, Error.New("repair threshold greater than total count") - } - if optimalThreshold < 0 { - return RedundancyStrategy{}, Error.New("negative optimal threshold") - } - if optimalThreshold > 0 && optimalThreshold < es.RequiredCount() { - return RedundancyStrategy{}, Error.New("optimal threshold less than required count") - } - if optimalThreshold > es.TotalCount() { - return RedundancyStrategy{}, Error.New("optimal threshold greater than total count") - } - if repairThreshold > optimalThreshold { - return RedundancyStrategy{}, Error.New("repair threshold greater than optimal threshold") - } - return RedundancyStrategy{ErasureScheme: es, repairThreshold: repairThreshold, optimalThreshold: optimalThreshold}, nil -} - -// NewRedundancyStrategyFromProto creates new RedundancyStrategy from the given -// RedundancyScheme protobuf. -func NewRedundancyStrategyFromProto(scheme *pb.RedundancyScheme) (RedundancyStrategy, error) { - fc, err := infectious.NewFEC(int(scheme.GetMinReq()), int(scheme.GetTotal())) - if err != nil { - return RedundancyStrategy{}, Error.Wrap(err) - } - es := NewRSScheme(fc, int(scheme.GetErasureShareSize())) - return NewRedundancyStrategy(es, int(scheme.GetRepairThreshold()), int(scheme.GetSuccessThreshold())) -} - -// NewRedundancyStrategyFromStorj creates new RedundancyStrategy from the given -// storj.RedundancyScheme. -func NewRedundancyStrategyFromStorj(scheme storj.RedundancyScheme) (RedundancyStrategy, error) { - fc, err := infectious.NewFEC(int(scheme.RequiredShares), int(scheme.TotalShares)) - if err != nil { - return RedundancyStrategy{}, Error.Wrap(err) - } - es := NewRSScheme(fc, int(scheme.ShareSize)) - return NewRedundancyStrategy(es, int(scheme.RepairShares), int(scheme.OptimalShares)) -} - -// RepairThreshold is the number of available erasure pieces below which -// the data must be repaired to avoid loss. -func (rs *RedundancyStrategy) RepairThreshold() int { - return rs.repairThreshold -} - -// OptimalThreshold is the number of available erasure pieces above which -// there is no need for the data to be repaired. -func (rs *RedundancyStrategy) OptimalThreshold() int { - return rs.optimalThreshold -} - -type encodedReader struct { - log *zap.Logger - ctx context.Context - rs RedundancyStrategy - pieces map[int]*encodedPiece -} - -// EncodeReader takes a Reader and a RedundancyStrategy and returns a slice of -// io.ReadClosers. -func EncodeReader(ctx context.Context, log *zap.Logger, r io.Reader, rs RedundancyStrategy) (_ []io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - - er := &encodedReader{ - log: log, - ctx: ctx, - rs: rs, - pieces: make(map[int]*encodedPiece, rs.TotalCount()), - } - - var pipeReaders []sync2.PipeReader - var pipeWriter sync2.PipeWriter - - tempDir, inmemory, _ := fpath.GetTempData(ctx) - if inmemory { - // TODO what default inmemory size will be enough - pipeReaders, pipeWriter, err = sync2.NewTeeInmemory(rs.TotalCount(), memory.MiB.Int64()) - } else { - if tempDir == "" { - tempDir = os.TempDir() - } - pipeReaders, pipeWriter, err = sync2.NewTeeFile(rs.TotalCount(), tempDir) - } - if err != nil { - return nil, err - } - - readers := make([]io.ReadCloser, 0, rs.TotalCount()) - for i := 0; i < rs.TotalCount(); i++ { - er.pieces[i] = &encodedPiece{ - er: er, - pipeReader: pipeReaders[i], - num: i, - stripeBuf: make([]byte, rs.StripeSize()), - shareBuf: make([]byte, rs.ErasureShareSize()), - } - readers = append(readers, er.pieces[i]) - } - - go er.fillBuffer(ctx, r, pipeWriter) - - return readers, nil -} - -func (er *encodedReader) fillBuffer(ctx context.Context, r io.Reader, w sync2.PipeWriter) { - var err error - defer mon.Task()(&ctx)(&err) - _, err = sync2.Copy(ctx, w, r) - err = w.CloseWithError(err) - if err != nil { - er.log.Error("Error closing buffer pipe", zap.Error(err)) - } -} - -type encodedPiece struct { - er *encodedReader - pipeReader sync2.PipeReader - num int - currentStripe int64 - stripeBuf []byte - shareBuf []byte - available int - err error -} - -func (ep *encodedPiece) Read(p []byte) (n int, err error) { - // No need to trace this function because it's very fast and called many times. - if ep.err != nil { - return 0, ep.err - } - - if ep.available == 0 { - // take the next stripe from the segment buffer - _, err := io.ReadFull(ep.pipeReader, ep.stripeBuf) - if err != nil { - return 0, err - } - - // encode the num-th erasure share - err = ep.er.rs.EncodeSingle(ep.stripeBuf, ep.shareBuf, ep.num) - if err != nil { - return 0, err - } - - ep.currentStripe++ - ep.available = ep.er.rs.ErasureShareSize() - } - - // we have some buffer remaining for this piece. write it to the output - off := len(ep.shareBuf) - ep.available - n = copy(p, ep.shareBuf[off:]) - ep.available -= n - - return n, nil -} - -func (ep *encodedPiece) Close() (err error) { - ctx := ep.er.ctx - defer mon.Task()(&ctx)(&err) - return ep.pipeReader.Close() -} - -// EncodedRanger will take an existing Ranger and provide a means to get -// multiple Ranged sub-Readers. EncodedRanger does not match the normal Ranger -// interface. -type EncodedRanger struct { - log *zap.Logger - rr ranger.Ranger - rs RedundancyStrategy -} - -// NewEncodedRanger from the given Ranger and RedundancyStrategy. See the -// comments for EncodeReader about the repair and success thresholds. -func NewEncodedRanger(log *zap.Logger, rr ranger.Ranger, rs RedundancyStrategy) (*EncodedRanger, error) { - if rr.Size()%int64(rs.StripeSize()) != 0 { - return nil, Error.New("invalid erasure encoder and range reader combo. " + - "range reader size must be a multiple of erasure encoder block size") - } - return &EncodedRanger{ - log: log, - rs: rs, - rr: rr, - }, nil -} - -// OutputSize is like Ranger.Size but returns the Size of the erasure encoded -// pieces that come out. -func (er *EncodedRanger) OutputSize() int64 { - blocks := er.rr.Size() / int64(er.rs.StripeSize()) - return blocks * int64(er.rs.ErasureShareSize()) -} - -// Range is like Ranger.Range, but returns a slice of Readers. -func (er *EncodedRanger) Range(ctx context.Context, offset, length int64) (_ []io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - // the offset and length given may not be block-aligned, so let's figure - // out which blocks contain the request. - firstBlock, blockCount := encryption.CalcEncompassingBlocks( - offset, length, er.rs.ErasureShareSize()) - // okay, now let's encode the reader for the range containing the blocks - r, err := er.rr.Range(ctx, - firstBlock*int64(er.rs.StripeSize()), - blockCount*int64(er.rs.StripeSize())) - if err != nil { - return nil, err - } - readers, err := EncodeReader(ctx, er.log, r, er.rs) - if err != nil { - return nil, err - } - for i, r := range readers { - // the offset might start a few bytes in, so we potentially have to - // discard the beginning bytes - _, err := io.CopyN(ioutil.Discard, r, - offset-firstBlock*int64(er.rs.ErasureShareSize())) - if err != nil { - return nil, Error.Wrap(err) - } - // the length might be shorter than a multiple of the block size, so - // limit it - readers[i] = readcloser.LimitReadCloser(r, length) - } - return readers, nil -} - -// CalcPieceSize calculates what would be the piece size of the encoded data -// after erasure coding data with dataSize using the given ErasureScheme. -func CalcPieceSize(dataSize int64, scheme ErasureScheme) int64 { - const uint32Size = 4 - stripeSize := int64(scheme.StripeSize()) - stripes := (dataSize + uint32Size + stripeSize - 1) / stripeSize - - encodedSize := stripes * int64(scheme.StripeSize()) - pieceSize := encodedSize / int64(scheme.RequiredCount()) - - return pieceSize -} diff --git a/vendor/storj.io/uplink/private/eestream/piecebuf.go b/vendor/storj.io/uplink/private/eestream/piecebuf.go deleted file mode 100644 index abce12157..000000000 --- a/vendor/storj.io/uplink/private/eestream/piecebuf.go +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "io" - "sync" - - "go.uber.org/zap" -) - -// PieceBuffer is a synchronized buffer for storing erasure shares for a piece. -type PieceBuffer struct { - log *zap.Logger - buf []byte - shareSize int - cond *sync.Cond - newDataCond *sync.Cond - rpos, wpos int - full bool - currentShare int64 // current erasure share number - totalwr int64 // total bytes ever written to the buffer - lastwr int64 // total bytes ever written when last notified newDataCond - err error -} - -// NewPieceBuffer creates and initializes a new PieceBuffer using buf as its -// internal content. If new data is written to the buffer, newDataCond will be -// notified. -func NewPieceBuffer(log *zap.Logger, buf []byte, shareSize int, newDataCond *sync.Cond) *PieceBuffer { - return &PieceBuffer{ - log: log, - buf: buf, - shareSize: shareSize, - cond: sync.NewCond(&sync.Mutex{}), - newDataCond: newDataCond, - } -} - -// Read reads the next len(p) bytes from the buffer or until the buffer is -// drained. The return value n is the number of bytes read. If the buffer has -// no data to return and no error is set, the call will block until new data is -// written to the buffer. Otherwise the error will be returned. -func (b *PieceBuffer) Read(p []byte) (n int, err error) { - defer b.cond.Broadcast() - b.cond.L.Lock() - defer b.cond.L.Unlock() - - for b.empty() { - if b.err != nil { - return 0, b.err - } - b.cond.Wait() - } - - if b.rpos >= b.wpos { - nn := copy(p, b.buf[b.rpos:]) - n += nn - b.rpos = (b.rpos + nn) % len(b.buf) - p = p[nn:] - } - - if b.rpos < b.wpos { - nn := copy(p, b.buf[b.rpos:b.wpos]) - n += nn - b.rpos += nn - } - - if n > 0 { - b.full = false - } - - return n, nil -} - -// Skip advances the read pointer with n bytes. It the buffered number of bytes -// are less than n, the method will block until enough data is written to the -// buffer. -func (b *PieceBuffer) Skip(n int) error { - defer b.cond.Broadcast() - b.cond.L.Lock() - defer b.cond.L.Unlock() - - for n > 0 { - for b.empty() { - if b.err != nil { - return b.err - } - b.cond.Wait() - } - - if b.rpos >= b.wpos { - if len(b.buf)-b.rpos > n { - b.rpos = (b.rpos + n) % len(b.buf) - n = 0 - } else { - n -= len(b.buf) - b.rpos - b.rpos = 0 - } - } else { - if b.wpos-b.rpos > n { - b.rpos += n - n = 0 - } else { - n -= b.wpos - b.rpos - b.rpos = b.wpos - } - } - - b.full = false - } - - return nil -} - -// Write writes the contents of p into the buffer. If the buffer is full it -// will block until some data is read from it, or an error is set. The return -// value n is the number of bytes written. If an error was set, it be returned. -func (b *PieceBuffer) Write(p []byte) (n int, err error) { - for n < len(p) { - nn, err := b.write(p[n:]) - n += nn - if err != nil { - return n, err - } - // Notify for new data only if a new complete erasure share is available - b.totalwr += int64(nn) - if b.totalwr/int64(b.shareSize)-b.lastwr/int64(b.shareSize) > 0 { - b.lastwr = b.totalwr - b.notifyNewData() - } - } - return n, nil -} - -// write is a helper method that takes care for the locking on each copy -// iteration. -func (b *PieceBuffer) write(p []byte) (n int, err error) { - defer b.cond.Broadcast() - b.cond.L.Lock() - defer b.cond.L.Unlock() - - for b.full { - if b.err != nil { - return n, b.err - } - b.cond.Wait() - } - - var wr int - if b.wpos < b.rpos { - wr = copy(b.buf[b.wpos:b.rpos], p) - } else { - wr = copy(b.buf[b.wpos:], p) - } - - n += wr - b.wpos = (b.wpos + wr) % len(b.buf) - if b.wpos == b.rpos { - b.full = true - } - - return n, nil -} - -// Close sets io.ErrClosedPipe to the buffer to prevent further writes and -// blocking on read. -func (b *PieceBuffer) Close() error { - b.SetError(io.ErrClosedPipe) - return nil -} - -// SetError sets an error to be returned by Read and Write. Read will return -// the error after all data is read from the buffer. -func (b *PieceBuffer) SetError(err error) { - b.setError(err) - b.notifyNewData() -} - -// setError is a helper method that locks the mutex before setting the error. -func (b *PieceBuffer) setError(err error) { - defer b.cond.Broadcast() - b.cond.L.Lock() - defer b.cond.L.Unlock() - - b.err = err -} - -// getError is a helper method that locks the mutex before getting the error. -func (b *PieceBuffer) getError() error { - b.cond.L.Lock() - defer b.cond.L.Unlock() - - return b.err -} - -// notifyNewData notifies newDataCond that new data is written to the buffer. -func (b *PieceBuffer) notifyNewData() { - b.newDataCond.L.Lock() - defer b.newDataCond.L.Unlock() - - b.newDataCond.Broadcast() -} - -// empty chacks if the buffer is empty. -func (b *PieceBuffer) empty() bool { - return !b.full && b.rpos == b.wpos -} - -// buffered returns the number of bytes that can be read from the buffer -// without blocking. -func (b *PieceBuffer) buffered() int { - b.cond.L.Lock() - defer b.cond.L.Unlock() - - switch { - case b.rpos < b.wpos: - return b.wpos - b.rpos - case b.rpos > b.wpos: - return len(b.buf) + b.wpos - b.rpos - case b.full: - return len(b.buf) - default: // empty - return 0 - } -} - -// HasShare checks if the num-th share can be read from the buffer without -// blocking. If there are older erasure shares in the buffer, they will be -// discarded to leave room for the newer erasure shares to be written. -func (b *PieceBuffer) HasShare(num int64) bool { - if num < b.currentShare { - // we should never get here! - b.log.Fatal("Requested erasure share was already read", - zap.Int64("Requested Erasure Share", num), - zap.Int64("Current Erasure Share", b.currentShare), - ) - } - - if b.getError() != nil { - return true - } - - bufShares := int64(b.buffered() / b.shareSize) - if num-b.currentShare > 0 { - if bufShares > num-b.currentShare { - // TODO: should this error be ignored? - _ = b.discardUntil(num) - } else { - _ = b.discardUntil(b.currentShare + bufShares) - } - bufShares = int64(b.buffered() / b.shareSize) - } - - return bufShares > num-b.currentShare -} - -// ReadShare reads the num-th erasure share from the buffer into p. Any shares -// before num will be discarded from the buffer. -func (b *PieceBuffer) ReadShare(num int64, p []byte) error { - if num < b.currentShare { - // we should never get here! - b.log.Fatal("Requested erasure share was already read", - zap.Int64("Requested Erasure Share", num), - zap.Int64("Current Erasure Share", b.currentShare), - ) - } - - err := b.discardUntil(num) - if err != nil { - return err - } - - _, err = io.ReadFull(b, p) - if err != nil { - return err - } - - b.currentShare++ - - return nil -} - -// discardUntil discards all erasure shares from the buffer until the num-th -// erasure share exclusively. -func (b *PieceBuffer) discardUntil(num int64) error { - if num <= b.currentShare { - return nil - } - - err := b.Skip(int(num-b.currentShare) * b.shareSize) - if err != nil { - return err - } - - b.currentShare = num - - return nil -} diff --git a/vendor/storj.io/uplink/private/eestream/rs.go b/vendor/storj.io/uplink/private/eestream/rs.go deleted file mode 100644 index f2e650f97..000000000 --- a/vendor/storj.io/uplink/private/eestream/rs.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "github.com/vivint/infectious" -) - -type rsScheme struct { - fc *infectious.FEC - erasureShareSize int -} - -// NewRSScheme returns a Reed-Solomon-based ErasureScheme. -func NewRSScheme(fc *infectious.FEC, erasureShareSize int) ErasureScheme { - return &rsScheme{fc: fc, erasureShareSize: erasureShareSize} -} - -func (s *rsScheme) EncodeSingle(input, output []byte, num int) (err error) { - return s.fc.EncodeSingle(input, output, num) -} - -func (s *rsScheme) Encode(input []byte, output func(num int, data []byte)) ( - err error) { - return s.fc.Encode(input, func(s infectious.Share) { - output(s.Number, s.Data) - }) -} - -func (s *rsScheme) Decode(out []byte, in map[int][]byte) ([]byte, error) { - shares := make([]infectious.Share, 0, len(in)) - for num, data := range in { - shares = append(shares, infectious.Share{Number: num, Data: data}) - } - return s.fc.Decode(out, shares) -} - -func (s *rsScheme) ErasureShareSize() int { - return s.erasureShareSize -} - -func (s *rsScheme) StripeSize() int { - return s.erasureShareSize * s.fc.Required() -} - -func (s *rsScheme) TotalCount() int { - return s.fc.Total() -} - -func (s *rsScheme) RequiredCount() int { - return s.fc.Required() -} diff --git a/vendor/storj.io/uplink/private/eestream/stripe.go b/vendor/storj.io/uplink/private/eestream/stripe.go deleted file mode 100644 index 28a873257..000000000 --- a/vendor/storj.io/uplink/private/eestream/stripe.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "context" - "errors" - "fmt" - "io" - "sort" - "strings" - "sync" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/vivint/infectious" - "go.uber.org/zap" -) - -var ( - mon = monkit.Package() -) - -// StripeReader can read and decodes stripes from a set of readers. -type StripeReader struct { - scheme ErasureScheme - cond *sync.Cond - readerCount int - bufs map[int]*PieceBuffer - inbufs map[int][]byte - inmap map[int][]byte - errmap map[int]error - forceErrorDetection bool -} - -// NewStripeReader creates a new StripeReader from the given readers, erasure -// scheme and max buffer memory. -func NewStripeReader(log *zap.Logger, rs map[int]io.ReadCloser, es ErasureScheme, mbm int, forceErrorDetection bool) *StripeReader { - readerCount := len(rs) - - r := &StripeReader{ - scheme: es, - cond: sync.NewCond(&sync.Mutex{}), - readerCount: readerCount, - bufs: make(map[int]*PieceBuffer, readerCount), - inbufs: make(map[int][]byte, readerCount), - inmap: make(map[int][]byte, readerCount), - errmap: make(map[int]error, readerCount), - forceErrorDetection: forceErrorDetection, - } - - bufSize := mbm / readerCount - bufSize -= bufSize % es.ErasureShareSize() - if bufSize < es.ErasureShareSize() { - bufSize = es.ErasureShareSize() - } - - for i := range rs { - r.inbufs[i] = make([]byte, es.ErasureShareSize()) - r.bufs[i] = NewPieceBuffer(log, make([]byte, bufSize), es.ErasureShareSize(), r.cond) - // Kick off a goroutine each reader to be copied into a PieceBuffer. - go func(r io.Reader, buf *PieceBuffer) { - _, err := io.Copy(buf, r) - if err != nil { - buf.SetError(err) - return - } - buf.SetError(io.EOF) - }(rs[i], r.bufs[i]) - } - - return r -} - -// Close closes the StripeReader and all PieceBuffers. -func (r *StripeReader) Close() error { - errs := make(chan error, len(r.bufs)) - for _, buf := range r.bufs { - go func(c io.Closer) { - errs <- c.Close() - }(buf) - } - var first error - for range r.bufs { - err := <-errs - if err != nil && first == nil { - first = Error.Wrap(err) - } - } - return first -} - -var backcompatMon = monkit.ScopeNamed("storj.io/storj/uplink/eestream") - -// ReadStripe reads and decodes the num-th stripe and concatenates it to p. The -// return value is the updated byte slice. -func (r *StripeReader) ReadStripe(ctx context.Context, num int64, p []byte) (_ []byte, err error) { - defer mon.Task()(&ctx, num)(&err) - - for i := range r.inmap { - delete(r.inmap, i) - } - - r.cond.L.Lock() - defer r.cond.L.Unlock() - - for r.pendingReaders() { - for r.readAvailableShares(ctx, num) == 0 { - r.cond.Wait() - } - if r.hasEnoughShares() { - out, err := r.scheme.Decode(p, r.inmap) - if err != nil { - if r.shouldWaitForMore(err) { - continue - } - return nil, err - } - return out, nil - } - } - // could not read enough shares to attempt a decode - backcompatMon.Meter("download_stripe_failed_not_enough_pieces_uplink").Mark(1) //locked - return nil, r.combineErrs(num) -} - -// readAvailableShares reads the available num-th erasure shares from the piece -// buffers without blocking. The return value n is the number of erasure shares -// read. -func (r *StripeReader) readAvailableShares(ctx context.Context, num int64) (n int) { - for i, buf := range r.bufs { - if r.inmap[i] != nil || r.errmap[i] != nil { - continue - } - if buf.HasShare(num) { - err := buf.ReadShare(num, r.inbufs[i]) - if err != nil { - r.errmap[i] = err - } else { - r.inmap[i] = r.inbufs[i] - } - n++ - } - } - return n -} - -// pendingReaders checks if there are any pending readers to get a share from. -func (r *StripeReader) pendingReaders() bool { - goodReaders := r.readerCount - len(r.errmap) - return goodReaders >= r.scheme.RequiredCount() && goodReaders > len(r.inmap) -} - -// hasEnoughShares check if there are enough erasure shares read to attempt -// a decode. -func (r *StripeReader) hasEnoughShares() bool { - return len(r.inmap) >= r.scheme.RequiredCount()+1 || - (!r.forceErrorDetection && len(r.inmap) == r.scheme.RequiredCount() && !r.pendingReaders()) -} - -// shouldWaitForMore checks the returned decode error if it makes sense to wait -// for more erasure shares to attempt an error correction. -func (r *StripeReader) shouldWaitForMore(err error) bool { - // check if the error is due to error detection - if !errors.Is(err, infectious.NotEnoughShares) && - !errors.Is(err, infectious.TooManyErrors) { - return false - } - // check if there are more input buffers to wait for - return r.pendingReaders() -} - -// combineErrs makes a useful error message from the errors in errmap. -// combineErrs always returns an error. -func (r *StripeReader) combineErrs(num int64) error { - if len(r.errmap) == 0 { - return Error.New("programmer error: no errors to combine") - } - errstrings := make([]string, 0, len(r.errmap)) - for i, err := range r.errmap { - errstrings = append(errstrings, fmt.Sprintf("\nerror retrieving piece %02d: %v", i, err)) - } - sort.Strings(errstrings) - return Error.New("failed to download stripe %d: %s", num, strings.Join(errstrings, "")) -} diff --git a/vendor/storj.io/uplink/private/eestream/unsafe_rs.go b/vendor/storj.io/uplink/private/eestream/unsafe_rs.go deleted file mode 100644 index 6e3611497..000000000 --- a/vendor/storj.io/uplink/private/eestream/unsafe_rs.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package eestream - -import ( - "github.com/vivint/infectious" -) - -type unsafeRSScheme struct { - fc *infectious.FEC - erasureShareSize int -} - -// NewUnsafeRSScheme returns a Reed-Solomon-based ErasureScheme without error correction. -func NewUnsafeRSScheme(fc *infectious.FEC, erasureShareSize int) ErasureScheme { - return &unsafeRSScheme{fc: fc, erasureShareSize: erasureShareSize} -} - -func (s *unsafeRSScheme) EncodeSingle(input, output []byte, num int) (err error) { - return s.fc.EncodeSingle(input, output, num) -} - -func (s *unsafeRSScheme) Encode(input []byte, output func(num int, data []byte)) ( - err error) { - return s.fc.Encode(input, func(s infectious.Share) { - output(s.Number, s.Data) - }) -} - -func (s *unsafeRSScheme) Decode(out []byte, in map[int][]byte) ([]byte, error) { - shares := make([]infectious.Share, 0, len(in)) - for num, data := range in { - shares = append(shares, infectious.Share{Number: num, Data: data}) - } - - stripe := make([]byte, s.RequiredCount()*s.ErasureShareSize()) - err := s.fc.Rebuild(shares, func(share infectious.Share) { - copy(stripe[share.Number*s.ErasureShareSize():], share.Data) - }) - if err != nil { - return nil, err - } - - return stripe, nil -} - -func (s *unsafeRSScheme) ErasureShareSize() int { - return s.erasureShareSize -} - -func (s *unsafeRSScheme) StripeSize() int { - return s.erasureShareSize * s.fc.Required() -} - -func (s *unsafeRSScheme) TotalCount() int { - return s.fc.Total() -} - -func (s *unsafeRSScheme) RequiredCount() int { - return s.fc.Required() -} diff --git a/vendor/storj.io/uplink/private/metainfo/batch.go b/vendor/storj.io/uplink/private/metainfo/batch.go deleted file mode 100644 index 4d3c8f52a..000000000 --- a/vendor/storj.io/uplink/private/metainfo/batch.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -import ( - "github.com/zeebo/errs" - - "storj.io/common/pb" - "storj.io/uplink/private/eestream" -) - -var ( - // ErrInvalidType error for inalid response type casting. - ErrInvalidType = errs.New("invalid response type") -) - -// BatchItem represents single request in batch. -type BatchItem interface { - BatchItem() *pb.BatchRequestItem -} - -// BatchResponse single response from batch call. -type BatchResponse struct { - pbRequest interface{} - pbResponse interface{} -} - -// CreateBucket returns BatchResponse for CreateBucket request. -func (resp *BatchResponse) CreateBucket() (CreateBucketResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_BucketCreate) - if !ok { - return CreateBucketResponse{}, ErrInvalidType - } - - createResponse, err := newCreateBucketResponse(item.BucketCreate) - if err != nil { - return CreateBucketResponse{}, err - } - return createResponse, nil -} - -// GetBucket returns response for GetBucket request. -func (resp *BatchResponse) GetBucket() (GetBucketResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_BucketGet) - if !ok { - return GetBucketResponse{}, ErrInvalidType - } - getResponse, err := newGetBucketResponse(item.BucketGet) - if err != nil { - return GetBucketResponse{}, err - } - return getResponse, nil -} - -// ListBuckets returns response for ListBuckets request. -func (resp *BatchResponse) ListBuckets() (ListBucketsResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_BucketList) - if !ok { - return ListBucketsResponse{}, ErrInvalidType - } - return newListBucketsResponse(item.BucketList), nil -} - -// BeginObject returns response for BeginObject request. -func (resp *BatchResponse) BeginObject() (BeginObjectResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_ObjectBegin) - if !ok { - return BeginObjectResponse{}, ErrInvalidType - } - - rs, err := eestream.NewRedundancyStrategyFromProto(item.ObjectBegin.RedundancyScheme) - if err != nil { - return BeginObjectResponse{}, Error.Wrap(err) - } - - return newBeginObjectResponse(item.ObjectBegin, rs), nil -} - -// BeginDeleteObject returns response for BeginDeleteObject request. -func (resp *BatchResponse) BeginDeleteObject() (BeginDeleteObjectResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_ObjectBeginDelete) - if !ok { - return BeginDeleteObjectResponse{}, ErrInvalidType - } - return newBeginDeleteObjectResponse(item.ObjectBeginDelete), nil -} - -// GetObject returns response for GetObject request. -func (resp *BatchResponse) GetObject() (GetObjectResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_ObjectGet) - if !ok { - return GetObjectResponse{}, ErrInvalidType - } - return newGetObjectResponse(item.ObjectGet), nil -} - -// ListObjects returns response for ListObjects request. -func (resp *BatchResponse) ListObjects() (ListObjectsResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_ObjectList) - if !ok { - return ListObjectsResponse{}, ErrInvalidType - } - - requestItem, ok := resp.pbRequest.(*pb.BatchRequestItem_ObjectList) - if !ok { - return ListObjectsResponse{}, ErrInvalidType - } - - return newListObjectsResponse(item.ObjectList, requestItem.ObjectList.EncryptedPrefix, requestItem.ObjectList.Recursive), nil -} - -// BeginSegment returns response for BeginSegment request. -func (resp *BatchResponse) BeginSegment() (BeginSegmentResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_SegmentBegin) - if !ok { - return BeginSegmentResponse{}, ErrInvalidType - } - - return newBeginSegmentResponse(item.SegmentBegin), nil -} - -// BeginDeleteSegment returns response for BeginDeleteSegment request. -func (resp *BatchResponse) BeginDeleteSegment() (BeginDeleteSegmentResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_SegmentBeginDelete) - if !ok { - return BeginDeleteSegmentResponse{}, ErrInvalidType - } - - return newBeginDeleteSegmentResponse(item.SegmentBeginDelete), nil -} - -// ListSegment returns response for ListSegment request. -func (resp *BatchResponse) ListSegment() (ListSegmentsResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_SegmentList) - if !ok { - return ListSegmentsResponse{}, ErrInvalidType - } - return newListSegmentsResponse(item.SegmentList), nil -} - -// DownloadSegment returns response for DownloadSegment request. -func (resp *BatchResponse) DownloadSegment() (DownloadSegmentResponse, error) { - item, ok := resp.pbResponse.(*pb.BatchResponseItem_SegmentDownload) - if !ok { - return DownloadSegmentResponse{}, ErrInvalidType - } - return newDownloadSegmentResponse(item.SegmentDownload), nil -} diff --git a/vendor/storj.io/uplink/private/metainfo/client.go b/vendor/storj.io/uplink/private/metainfo/client.go deleted file mode 100644 index 191d3f3ed..000000000 --- a/vendor/storj.io/uplink/private/metainfo/client.go +++ /dev/null @@ -1,1143 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -import ( - "bytes" - "context" - "time" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/common/errs2" - "storj.io/common/macaroon" - "storj.io/common/pb" - "storj.io/common/rpc" - "storj.io/common/rpc/rpcstatus" - "storj.io/common/storj" - "storj.io/common/uuid" - "storj.io/uplink/private/eestream" -) - -var ( - mon = monkit.Package() - - // Error is the errs class of standard metainfo errors. - Error = errs.Class("metainfo error") -) - -// Client creates a grpcClient. -type Client struct { - conn *rpc.Conn - client pb.DRPCMetainfoClient - apiKeyRaw []byte - - userAgent string -} - -// ListItem is a single item in a listing. -type ListItem struct { - Path storj.Path - Pointer *pb.Pointer - IsPrefix bool -} - -// NewClient creates Metainfo API client. -func NewClient(client pb.DRPCMetainfoClient, apiKey *macaroon.APIKey, userAgent string) *Client { - return &Client{ - client: client, - apiKeyRaw: apiKey.SerializeRaw(), - - userAgent: userAgent, - } -} - -// DialNodeURL dials to metainfo endpoint with the specified api key. -func DialNodeURL(ctx context.Context, dialer rpc.Dialer, nodeURL string, apiKey *macaroon.APIKey, userAgent string) (*Client, error) { - url, err := storj.ParseNodeURL(nodeURL) - if err != nil { - return nil, Error.Wrap(err) - } - - if url.ID.IsZero() { - return nil, Error.New("node ID is required in node URL %q", nodeURL) - } - - conn, err := dialer.DialNodeURL(ctx, url) - if err != nil { - return nil, Error.Wrap(err) - } - - return &Client{ - conn: conn, - client: pb.NewDRPCMetainfoClient(conn), - apiKeyRaw: apiKey.SerializeRaw(), - userAgent: userAgent, - }, nil -} - -// Close closes the dialed connection. -func (client *Client) Close() error { - if client.conn != nil { - return Error.Wrap(client.conn.Close()) - } - return nil -} - -func (client *Client) header() *pb.RequestHeader { - return &pb.RequestHeader{ - ApiKey: client.apiKeyRaw, - UserAgent: []byte(client.userAgent), - } -} - -// GetProjectInfo gets the ProjectInfo for the api key associated with the metainfo client. -func (client *Client) GetProjectInfo(ctx context.Context) (resp *pb.ProjectInfoResponse, err error) { - defer mon.Task()(&ctx)(&err) - - return client.client.ProjectInfo(ctx, &pb.ProjectInfoRequest{ - Header: client.header(), - }) -} - -// CreateBucketParams parameters for CreateBucket method. -type CreateBucketParams struct { - Name []byte - PathCipher storj.CipherSuite - PartnerID []byte - DefaultSegmentsSize int64 - DefaultRedundancyScheme storj.RedundancyScheme - DefaultEncryptionParameters storj.EncryptionParameters -} - -func (params *CreateBucketParams) toRequest(header *pb.RequestHeader) *pb.BucketCreateRequest { - defaultRS := params.DefaultRedundancyScheme - defaultEP := params.DefaultEncryptionParameters - - return &pb.BucketCreateRequest{ - Header: header, - Name: params.Name, - PathCipher: pb.CipherSuite(params.PathCipher), - PartnerId: params.PartnerID, - DefaultSegmentSize: params.DefaultSegmentsSize, - DefaultRedundancyScheme: &pb.RedundancyScheme{ - Type: pb.RedundancyScheme_SchemeType(defaultRS.Algorithm), - MinReq: int32(defaultRS.RequiredShares), - Total: int32(defaultRS.TotalShares), - RepairThreshold: int32(defaultRS.RepairShares), - SuccessThreshold: int32(defaultRS.OptimalShares), - ErasureShareSize: defaultRS.ShareSize, - }, - DefaultEncryptionParameters: &pb.EncryptionParameters{ - CipherSuite: pb.CipherSuite(defaultEP.CipherSuite), - BlockSize: int64(defaultEP.BlockSize), - }, - } -} - -// BatchItem returns single item for batch request. -func (params *CreateBucketParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_BucketCreate{ - BucketCreate: params.toRequest(nil), - }, - } -} - -// TODO potential names *Response/*Out/*Result - -// CreateBucketResponse response for CreateBucket request. -type CreateBucketResponse struct { - Bucket storj.Bucket -} - -func newCreateBucketResponse(response *pb.BucketCreateResponse) (CreateBucketResponse, error) { - bucket, err := convertProtoToBucket(response.Bucket) - if err != nil { - return CreateBucketResponse{}, err - } - return CreateBucketResponse{ - Bucket: bucket, - }, nil -} - -// CreateBucket creates a new bucket. -func (client *Client) CreateBucket(ctx context.Context, params CreateBucketParams) (respBucket storj.Bucket, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.CreateBucket(ctx, params.toRequest(client.header())) - if err != nil { - return storj.Bucket{}, Error.Wrap(err) - } - - respBucket, err = convertProtoToBucket(response.Bucket) - if err != nil { - return storj.Bucket{}, Error.Wrap(err) - } - return respBucket, nil -} - -// GetBucketParams parmaters for GetBucketParams method. -type GetBucketParams struct { - Name []byte -} - -func (params *GetBucketParams) toRequest(header *pb.RequestHeader) *pb.BucketGetRequest { - return &pb.BucketGetRequest{ - Header: header, - Name: params.Name, - } -} - -// BatchItem returns single item for batch request. -func (params *GetBucketParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_BucketGet{ - BucketGet: params.toRequest(nil), - }, - } -} - -// GetBucketResponse response for GetBucket request. -type GetBucketResponse struct { - Bucket storj.Bucket -} - -func newGetBucketResponse(response *pb.BucketGetResponse) (GetBucketResponse, error) { - bucket, err := convertProtoToBucket(response.Bucket) - if err != nil { - return GetBucketResponse{}, err - } - return GetBucketResponse{ - Bucket: bucket, - }, nil -} - -// GetBucket returns a bucket. -func (client *Client) GetBucket(ctx context.Context, params GetBucketParams) (respBucket storj.Bucket, err error) { - defer mon.Task()(&ctx)(&err) - - resp, err := client.client.GetBucket(ctx, params.toRequest(client.header())) - if err != nil { - if errs2.IsRPC(err, rpcstatus.NotFound) { - return storj.Bucket{}, storj.ErrBucketNotFound.Wrap(err) - } - return storj.Bucket{}, Error.Wrap(err) - } - - respBucket, err = convertProtoToBucket(resp.Bucket) - if err != nil { - return storj.Bucket{}, Error.Wrap(err) - } - return respBucket, nil -} - -// DeleteBucketParams parmaters for DeleteBucket method. -type DeleteBucketParams struct { - Name []byte -} - -func (params *DeleteBucketParams) toRequest(header *pb.RequestHeader) *pb.BucketDeleteRequest { - return &pb.BucketDeleteRequest{ - Header: header, - Name: params.Name, - } -} - -// BatchItem returns single item for batch request. -func (params *DeleteBucketParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_BucketDelete{ - BucketDelete: params.toRequest(nil), - }, - } -} - -// DeleteBucket deletes a bucket. -func (client *Client) DeleteBucket(ctx context.Context, params DeleteBucketParams) (_ storj.Bucket, err error) { - defer mon.Task()(&ctx)(&err) - resp, err := client.client.DeleteBucket(ctx, params.toRequest(client.header())) - if err != nil { - if errs2.IsRPC(err, rpcstatus.NotFound) { - return storj.Bucket{}, storj.ErrBucketNotFound.Wrap(err) - } - return storj.Bucket{}, Error.Wrap(err) - } - - respBucket, err := convertProtoToBucket(resp.Bucket) - if err != nil { - return storj.Bucket{}, Error.Wrap(err) - } - return respBucket, nil -} - -// ListBucketsParams parmaters for ListBucketsParams method. -type ListBucketsParams struct { - ListOpts storj.BucketListOptions -} - -func (params *ListBucketsParams) toRequest(header *pb.RequestHeader) *pb.BucketListRequest { - return &pb.BucketListRequest{ - Header: header, - Cursor: []byte(params.ListOpts.Cursor), - Limit: int32(params.ListOpts.Limit), - Direction: int32(params.ListOpts.Direction), - } -} - -// BatchItem returns single item for batch request. -func (params *ListBucketsParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_BucketList{ - BucketList: params.toRequest(nil), - }, - } -} - -// ListBucketsResponse response for ListBucket request. -type ListBucketsResponse struct { - BucketList storj.BucketList -} - -func newListBucketsResponse(response *pb.BucketListResponse) ListBucketsResponse { - bucketList := storj.BucketList{ - More: response.More, - } - bucketList.Items = make([]storj.Bucket, len(response.Items)) - for i, item := range response.GetItems() { - bucketList.Items[i] = storj.Bucket{ - Name: string(item.Name), - Created: item.CreatedAt, - } - } - return ListBucketsResponse{ - BucketList: bucketList, - } -} - -// ListBuckets lists buckets. -func (client *Client) ListBuckets(ctx context.Context, params ListBucketsParams) (_ storj.BucketList, err error) { - defer mon.Task()(&ctx)(&err) - - resp, err := client.client.ListBuckets(ctx, params.toRequest(client.header())) - if err != nil { - return storj.BucketList{}, Error.Wrap(err) - } - resultBucketList := storj.BucketList{ - More: resp.GetMore(), - } - resultBucketList.Items = make([]storj.Bucket, len(resp.GetItems())) - for i, item := range resp.GetItems() { - resultBucketList.Items[i] = storj.Bucket{ - Name: string(item.GetName()), - Created: item.GetCreatedAt(), - } - } - return resultBucketList, nil -} - -func convertProtoToBucket(pbBucket *pb.Bucket) (bucket storj.Bucket, err error) { - if pbBucket == nil { - return storj.Bucket{}, nil - } - - defaultRS := pbBucket.GetDefaultRedundancyScheme() - defaultEP := pbBucket.GetDefaultEncryptionParameters() - - var partnerID uuid.UUID - err = partnerID.UnmarshalJSON(pbBucket.GetPartnerId()) - if err != nil && !partnerID.IsZero() { - return bucket, errs.New("Invalid uuid") - } - - return storj.Bucket{ - Name: string(pbBucket.GetName()), - PartnerID: partnerID, - PathCipher: storj.CipherSuite(pbBucket.GetPathCipher()), - Created: pbBucket.GetCreatedAt(), - DefaultSegmentsSize: pbBucket.GetDefaultSegmentSize(), - DefaultRedundancyScheme: storj.RedundancyScheme{ - Algorithm: storj.RedundancyAlgorithm(defaultRS.GetType()), - ShareSize: defaultRS.GetErasureShareSize(), - RequiredShares: int16(defaultRS.GetMinReq()), - RepairShares: int16(defaultRS.GetRepairThreshold()), - OptimalShares: int16(defaultRS.GetSuccessThreshold()), - TotalShares: int16(defaultRS.GetTotal()), - }, - DefaultEncryptionParameters: storj.EncryptionParameters{ - CipherSuite: storj.CipherSuite(defaultEP.CipherSuite), - BlockSize: int32(defaultEP.BlockSize), - }, - }, nil -} - -// BeginObjectParams parmaters for BeginObject method. -type BeginObjectParams struct { - Bucket []byte - EncryptedPath []byte - Version int32 - Redundancy storj.RedundancyScheme - EncryptionParameters storj.EncryptionParameters - ExpiresAt time.Time -} - -func (params *BeginObjectParams) toRequest(header *pb.RequestHeader) *pb.ObjectBeginRequest { - return &pb.ObjectBeginRequest{ - Header: header, - Bucket: params.Bucket, - EncryptedPath: params.EncryptedPath, - Version: params.Version, - ExpiresAt: params.ExpiresAt, - RedundancyScheme: &pb.RedundancyScheme{ - Type: pb.RedundancyScheme_SchemeType(params.Redundancy.Algorithm), - ErasureShareSize: params.Redundancy.ShareSize, - MinReq: int32(params.Redundancy.RequiredShares), - RepairThreshold: int32(params.Redundancy.RepairShares), - SuccessThreshold: int32(params.Redundancy.OptimalShares), - Total: int32(params.Redundancy.TotalShares), - }, - EncryptionParameters: &pb.EncryptionParameters{ - CipherSuite: pb.CipherSuite(params.EncryptionParameters.CipherSuite), - BlockSize: int64(params.EncryptionParameters.BlockSize), - }, - } -} - -// BatchItem returns single item for batch request. -func (params *BeginObjectParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_ObjectBegin{ - ObjectBegin: params.toRequest(nil), - }, - } -} - -// BeginObjectResponse response for BeginObject request. -type BeginObjectResponse struct { - StreamID storj.StreamID - RedundancyStrategy eestream.RedundancyStrategy - EncryptionParameters storj.EncryptionParameters -} - -func newBeginObjectResponse(response *pb.ObjectBeginResponse, redundancyStrategy eestream.RedundancyStrategy) BeginObjectResponse { - ep := storj.EncryptionParameters{} - if response.EncryptionParameters != nil { - ep = storj.EncryptionParameters{ - CipherSuite: storj.CipherSuite(response.EncryptionParameters.CipherSuite), - BlockSize: int32(response.EncryptionParameters.BlockSize), - } - } - - return BeginObjectResponse{ - StreamID: response.StreamId, - RedundancyStrategy: redundancyStrategy, - EncryptionParameters: ep, - } -} - -// BeginObject begins object creation. -func (client *Client) BeginObject(ctx context.Context, params BeginObjectParams) (_ BeginObjectResponse, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.BeginObject(ctx, params.toRequest(client.header())) - if err != nil { - return BeginObjectResponse{}, Error.Wrap(err) - } - - rs := eestream.RedundancyStrategy{} - if response.RedundancyScheme != nil { - rs, err = eestream.NewRedundancyStrategyFromProto(response.RedundancyScheme) - if err != nil { - return BeginObjectResponse{}, Error.Wrap(err) - } - } - - return newBeginObjectResponse(response, rs), nil -} - -// CommitObjectParams parmaters for CommitObject method. -type CommitObjectParams struct { - StreamID storj.StreamID - - EncryptedMetadataNonce storj.Nonce - EncryptedMetadata []byte -} - -func (params *CommitObjectParams) toRequest(header *pb.RequestHeader) *pb.ObjectCommitRequest { - return &pb.ObjectCommitRequest{ - Header: header, - StreamId: params.StreamID, - EncryptedMetadataNonce: params.EncryptedMetadataNonce, - EncryptedMetadata: params.EncryptedMetadata, - } -} - -// BatchItem returns single item for batch request. -func (params *CommitObjectParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_ObjectCommit{ - ObjectCommit: params.toRequest(nil), - }, - } -} - -// CommitObject commits a created object. -func (client *Client) CommitObject(ctx context.Context, params CommitObjectParams) (err error) { - defer mon.Task()(&ctx)(&err) - - _, err = client.client.CommitObject(ctx, params.toRequest(client.header())) - - return Error.Wrap(err) -} - -// GetObjectParams parameters for GetObject method. -type GetObjectParams struct { - Bucket []byte - EncryptedPath []byte - Version int32 -} - -func (params *GetObjectParams) toRequest(header *pb.RequestHeader) *pb.ObjectGetRequest { - return &pb.ObjectGetRequest{ - Header: header, - Bucket: params.Bucket, - EncryptedPath: params.EncryptedPath, - Version: params.Version, - } -} - -// BatchItem returns single item for batch request. -func (params *GetObjectParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_ObjectGet{ - ObjectGet: params.toRequest(nil), - }, - } -} - -// GetObjectResponse response for GetObject request. -type GetObjectResponse struct { - Info storj.ObjectInfo -} - -func newGetObjectResponse(response *pb.ObjectGetResponse) GetObjectResponse { - return GetObjectResponse{ - Info: newObjectInfo(response.Object), - } -} - -func newObjectInfo(object *pb.Object) storj.ObjectInfo { - if object == nil { - return storj.ObjectInfo{} - } - - info := storj.ObjectInfo{ - Bucket: string(object.Bucket), - Path: storj.Path(object.EncryptedPath), - - StreamID: object.StreamId, - - Created: object.CreatedAt, - Modified: object.CreatedAt, - Expires: object.ExpiresAt, - Metadata: object.EncryptedMetadata, - Stream: storj.Stream{ - Size: object.TotalSize, - EncryptionParameters: storj.EncryptionParameters{ - CipherSuite: storj.CipherSuite(object.EncryptionParameters.CipherSuite), - BlockSize: int32(object.EncryptionParameters.BlockSize), - }, - }, - } - - pbRS := object.RedundancyScheme - if pbRS != nil { - info.Stream.RedundancyScheme = storj.RedundancyScheme{ - Algorithm: storj.RedundancyAlgorithm(pbRS.Type), - ShareSize: pbRS.ErasureShareSize, - RequiredShares: int16(pbRS.MinReq), - RepairShares: int16(pbRS.RepairThreshold), - OptimalShares: int16(pbRS.SuccessThreshold), - TotalShares: int16(pbRS.Total), - } - } - return info -} - -// GetObject gets single object. -func (client *Client) GetObject(ctx context.Context, params GetObjectParams) (_ storj.ObjectInfo, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.GetObject(ctx, params.toRequest(client.header())) - - if err != nil { - if errs2.IsRPC(err, rpcstatus.NotFound) { - return storj.ObjectInfo{}, storj.ErrObjectNotFound.Wrap(err) - } - return storj.ObjectInfo{}, Error.Wrap(err) - } - - getResponse := newGetObjectResponse(response) - return getResponse.Info, nil -} - -// BeginDeleteObjectParams parameters for BeginDeleteObject method. -type BeginDeleteObjectParams struct { - Bucket []byte - EncryptedPath []byte - Version int32 -} - -func (params *BeginDeleteObjectParams) toRequest(header *pb.RequestHeader) *pb.ObjectBeginDeleteRequest { - return &pb.ObjectBeginDeleteRequest{ - Header: header, - Bucket: params.Bucket, - EncryptedPath: params.EncryptedPath, - Version: params.Version, - } -} - -// BatchItem returns single item for batch request. -func (params *BeginDeleteObjectParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_ObjectBeginDelete{ - ObjectBeginDelete: params.toRequest(nil), - }, - } -} - -// BeginDeleteObjectResponse response for BeginDeleteObject request. -type BeginDeleteObjectResponse struct { - StreamID storj.StreamID -} - -func newBeginDeleteObjectResponse(response *pb.ObjectBeginDeleteResponse) BeginDeleteObjectResponse { - return BeginDeleteObjectResponse{ - StreamID: response.StreamId, - } -} - -// BeginDeleteObject begins object deletion process. -func (client *Client) BeginDeleteObject(ctx context.Context, params BeginDeleteObjectParams) (_ storj.StreamID, _ storj.ObjectInfo, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.BeginDeleteObject(ctx, params.toRequest(client.header())) - if err != nil { - if errs2.IsRPC(err, rpcstatus.NotFound) { - return storj.StreamID{}, storj.ObjectInfo{}, storj.ErrObjectNotFound.Wrap(err) - } - return storj.StreamID{}, storj.ObjectInfo{}, Error.Wrap(err) - } - - return response.StreamId, newObjectInfo(response.Object), nil -} - -// FinishDeleteObjectParams parameters for FinishDeleteObject method. -type FinishDeleteObjectParams struct { - StreamID storj.StreamID -} - -func (params *FinishDeleteObjectParams) toRequest(header *pb.RequestHeader) *pb.ObjectFinishDeleteRequest { - return &pb.ObjectFinishDeleteRequest{ - Header: header, - StreamId: params.StreamID, - } -} - -// BatchItem returns single item for batch request. -func (params *FinishDeleteObjectParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_ObjectFinishDelete{ - ObjectFinishDelete: params.toRequest(nil), - }, - } -} - -// FinishDeleteObject finishes object deletion process. -func (client *Client) FinishDeleteObject(ctx context.Context, params FinishDeleteObjectParams) (err error) { - defer mon.Task()(&ctx)(&err) - - _, err = client.client.FinishDeleteObject(ctx, params.toRequest(client.header())) - - return Error.Wrap(err) -} - -// ListObjectsParams parameters for ListObjects method. -type ListObjectsParams struct { - Bucket []byte - EncryptedPrefix []byte - EncryptedCursor []byte - Limit int32 - IncludeMetadata bool - Recursive bool -} - -func (params *ListObjectsParams) toRequest(header *pb.RequestHeader) *pb.ObjectListRequest { - return &pb.ObjectListRequest{ - Header: header, - Bucket: params.Bucket, - EncryptedPrefix: params.EncryptedPrefix, - EncryptedCursor: params.EncryptedCursor, - Limit: params.Limit, - ObjectIncludes: &pb.ObjectListItemIncludes{ - Metadata: params.IncludeMetadata, - }, - Recursive: params.Recursive, - } -} - -// BatchItem returns single item for batch request. -func (params *ListObjectsParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_ObjectList{ - ObjectList: params.toRequest(nil), - }, - } -} - -// ListObjectsResponse response for ListObjects request. -type ListObjectsResponse struct { - Items []storj.ObjectListItem - More bool -} - -func newListObjectsResponse(response *pb.ObjectListResponse, encryptedPrefix []byte, recursive bool) ListObjectsResponse { - objects := make([]storj.ObjectListItem, len(response.Items)) - for i, object := range response.Items { - encryptedPath := object.EncryptedPath - isPrefix := false - if !recursive && len(encryptedPath) != 0 && encryptedPath[len(encryptedPath)-1] == '/' && !bytes.Equal(encryptedPath, encryptedPrefix) { - isPrefix = true - } - - objects[i] = storj.ObjectListItem{ - EncryptedPath: object.EncryptedPath, - Version: object.Version, - Status: int32(object.Status), - StatusAt: object.StatusAt, - CreatedAt: object.CreatedAt, - ExpiresAt: object.ExpiresAt, - EncryptedMetadataNonce: object.EncryptedMetadataNonce, - EncryptedMetadata: object.EncryptedMetadata, - - IsPrefix: isPrefix, - } - } - - return ListObjectsResponse{ - Items: objects, - More: response.More, - } -} - -// ListObjects lists objects according to specific parameters. -func (client *Client) ListObjects(ctx context.Context, params ListObjectsParams) (_ []storj.ObjectListItem, more bool, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.ListObjects(ctx, params.toRequest(client.header())) - if err != nil { - return []storj.ObjectListItem{}, false, Error.Wrap(err) - } - - listResponse := newListObjectsResponse(response, params.EncryptedPrefix, params.Recursive) - return listResponse.Items, listResponse.More, Error.Wrap(err) -} - -// BeginSegmentParams parameters for BeginSegment method. -type BeginSegmentParams struct { - StreamID storj.StreamID - Position storj.SegmentPosition - MaxOrderLimit int64 -} - -func (params *BeginSegmentParams) toRequest(header *pb.RequestHeader) *pb.SegmentBeginRequest { - return &pb.SegmentBeginRequest{ - Header: header, - StreamId: params.StreamID, - Position: &pb.SegmentPosition{ - PartNumber: params.Position.PartNumber, - Index: params.Position.Index, - }, - MaxOrderLimit: params.MaxOrderLimit, - } -} - -// BatchItem returns single item for batch request. -func (params *BeginSegmentParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentBegin{ - SegmentBegin: params.toRequest(nil), - }, - } -} - -// BeginSegmentResponse response for BeginSegment request. -type BeginSegmentResponse struct { - SegmentID storj.SegmentID - Limits []*pb.AddressedOrderLimit - PiecePrivateKey storj.PiecePrivateKey -} - -func newBeginSegmentResponse(response *pb.SegmentBeginResponse) BeginSegmentResponse { - return BeginSegmentResponse{ - SegmentID: response.SegmentId, - Limits: response.AddressedLimits, - PiecePrivateKey: response.PrivateKey, - } -} - -// BeginSegment begins a segment upload. -func (client *Client) BeginSegment(ctx context.Context, params BeginSegmentParams) (_ storj.SegmentID, limits []*pb.AddressedOrderLimit, piecePrivateKey storj.PiecePrivateKey, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.BeginSegment(ctx, params.toRequest(client.header())) - if err != nil { - return storj.SegmentID{}, nil, storj.PiecePrivateKey{}, Error.Wrap(err) - } - - return response.SegmentId, response.AddressedLimits, response.PrivateKey, nil -} - -// CommitSegmentParams parameters for CommitSegment method. -type CommitSegmentParams struct { - SegmentID storj.SegmentID - Encryption storj.SegmentEncryption - SizeEncryptedData int64 - - UploadResult []*pb.SegmentPieceUploadResult -} - -func (params *CommitSegmentParams) toRequest(header *pb.RequestHeader) *pb.SegmentCommitRequest { - return &pb.SegmentCommitRequest{ - Header: header, - SegmentId: params.SegmentID, - - EncryptedKeyNonce: params.Encryption.EncryptedKeyNonce, - EncryptedKey: params.Encryption.EncryptedKey, - SizeEncryptedData: params.SizeEncryptedData, - UploadResult: params.UploadResult, - } -} - -// BatchItem returns single item for batch request. -func (params *CommitSegmentParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentCommit{ - SegmentCommit: params.toRequest(nil), - }, - } -} - -// CommitSegment commits an uploaded segment. -func (client *Client) CommitSegment(ctx context.Context, params CommitSegmentParams) (err error) { - defer mon.Task()(&ctx)(&err) - - _, err = client.client.CommitSegment(ctx, params.toRequest(client.header())) - - return Error.Wrap(err) -} - -// MakeInlineSegmentParams parameters for MakeInlineSegment method. -type MakeInlineSegmentParams struct { - StreamID storj.StreamID - Position storj.SegmentPosition - Encryption storj.SegmentEncryption - EncryptedInlineData []byte -} - -func (params *MakeInlineSegmentParams) toRequest(header *pb.RequestHeader) *pb.SegmentMakeInlineRequest { - return &pb.SegmentMakeInlineRequest{ - Header: header, - StreamId: params.StreamID, - Position: &pb.SegmentPosition{ - PartNumber: params.Position.PartNumber, - Index: params.Position.Index, - }, - EncryptedKeyNonce: params.Encryption.EncryptedKeyNonce, - EncryptedKey: params.Encryption.EncryptedKey, - EncryptedInlineData: params.EncryptedInlineData, - } -} - -// BatchItem returns single item for batch request. -func (params *MakeInlineSegmentParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentMakeInline{ - SegmentMakeInline: params.toRequest(nil), - }, - } -} - -// MakeInlineSegment creates an inline segment. -func (client *Client) MakeInlineSegment(ctx context.Context, params MakeInlineSegmentParams) (err error) { - defer mon.Task()(&ctx)(&err) - - _, err = client.client.MakeInlineSegment(ctx, params.toRequest(client.header())) - - return Error.Wrap(err) -} - -// BeginDeleteSegmentParams parameters for BeginDeleteSegment method. -type BeginDeleteSegmentParams struct { - StreamID storj.StreamID - Position storj.SegmentPosition -} - -func (params *BeginDeleteSegmentParams) toRequest(header *pb.RequestHeader) *pb.SegmentBeginDeleteRequest { - return &pb.SegmentBeginDeleteRequest{ - Header: header, - StreamId: params.StreamID, - Position: &pb.SegmentPosition{ - PartNumber: params.Position.PartNumber, - Index: params.Position.Index, - }, - } -} - -// BatchItem returns single item for batch request. -func (params *BeginDeleteSegmentParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentBeginDelete{ - SegmentBeginDelete: params.toRequest(nil), - }, - } -} - -// BeginDeleteSegmentResponse response for BeginDeleteSegment request. -type BeginDeleteSegmentResponse struct { - SegmentID storj.SegmentID - Limits []*pb.AddressedOrderLimit - PiecePrivateKey storj.PiecePrivateKey -} - -func newBeginDeleteSegmentResponse(response *pb.SegmentBeginDeleteResponse) BeginDeleteSegmentResponse { - return BeginDeleteSegmentResponse{ - SegmentID: response.SegmentId, - Limits: response.AddressedLimits, - PiecePrivateKey: response.PrivateKey, - } -} - -// BeginDeleteSegment begins segment deletion process. -func (client *Client) BeginDeleteSegment(ctx context.Context, params BeginDeleteSegmentParams) (_ storj.SegmentID, limits []*pb.AddressedOrderLimit, _ storj.PiecePrivateKey, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.BeginDeleteSegment(ctx, params.toRequest(client.header())) - if err != nil { - return storj.SegmentID{}, nil, storj.PiecePrivateKey{}, Error.Wrap(err) - } - - return response.SegmentId, response.AddressedLimits, response.PrivateKey, nil -} - -// FinishDeleteSegmentParams parameters for FinishDeleteSegment method. -type FinishDeleteSegmentParams struct { - SegmentID storj.SegmentID - - DeleteResults []*pb.SegmentPieceDeleteResult -} - -func (params *FinishDeleteSegmentParams) toRequest(header *pb.RequestHeader) *pb.SegmentFinishDeleteRequest { - return &pb.SegmentFinishDeleteRequest{ - Header: header, - SegmentId: params.SegmentID, - Results: params.DeleteResults, - } -} - -// BatchItem returns single item for batch request. -func (params *FinishDeleteSegmentParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentFinishDelete{ - SegmentFinishDelete: params.toRequest(nil), - }, - } -} - -// FinishDeleteSegment finishes segment upload process. -func (client *Client) FinishDeleteSegment(ctx context.Context, params FinishDeleteSegmentParams) (err error) { - defer mon.Task()(&ctx)(&err) - - _, err = client.client.FinishDeleteSegment(ctx, params.toRequest(client.header())) - - return Error.Wrap(err) -} - -// DownloadSegmentParams parameters for DownloadSegment method. -type DownloadSegmentParams struct { - StreamID storj.StreamID - Position storj.SegmentPosition -} - -func (params *DownloadSegmentParams) toRequest(header *pb.RequestHeader) *pb.SegmentDownloadRequest { - return &pb.SegmentDownloadRequest{ - Header: header, - StreamId: params.StreamID, - CursorPosition: &pb.SegmentPosition{ - PartNumber: params.Position.PartNumber, - Index: params.Position.Index, - }, - } -} - -// BatchItem returns single item for batch request. -func (params *DownloadSegmentParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentDownload{ - SegmentDownload: params.toRequest(nil), - }, - } -} - -// DownloadSegmentResponse response for DownloadSegment request. -type DownloadSegmentResponse struct { - Info storj.SegmentDownloadInfo - - Limits []*pb.AddressedOrderLimit -} - -func newDownloadSegmentResponse(response *pb.SegmentDownloadResponse) DownloadSegmentResponse { - info := storj.SegmentDownloadInfo{ - SegmentID: response.SegmentId, - Size: response.SegmentSize, - EncryptedInlineData: response.EncryptedInlineData, - PiecePrivateKey: response.PrivateKey, - SegmentEncryption: storj.SegmentEncryption{ - EncryptedKeyNonce: response.EncryptedKeyNonce, - EncryptedKey: response.EncryptedKey, - }, - } - if response.Next != nil { - info.Next = storj.SegmentPosition{ - PartNumber: response.Next.PartNumber, - Index: response.Next.Index, - } - } - - for i := range response.AddressedLimits { - if response.AddressedLimits[i].Limit == nil { - response.AddressedLimits[i] = nil - } - } - return DownloadSegmentResponse{ - Info: info, - Limits: response.AddressedLimits, - } -} - -// DownloadSegment gets information for downloading remote segment or data -// from an inline segment. -func (client *Client) DownloadSegment(ctx context.Context, params DownloadSegmentParams) (_ storj.SegmentDownloadInfo, _ []*pb.AddressedOrderLimit, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.DownloadSegment(ctx, params.toRequest(client.header())) - if err != nil { - if errs2.IsRPC(err, rpcstatus.NotFound) { - return storj.SegmentDownloadInfo{}, nil, storj.ErrObjectNotFound.Wrap(err) - } - return storj.SegmentDownloadInfo{}, nil, Error.Wrap(err) - } - - downloadResponse := newDownloadSegmentResponse(response) - return downloadResponse.Info, downloadResponse.Limits, nil -} - -// ListSegmentsParams parameters for ListSegment method. -type ListSegmentsParams struct { - StreamID storj.StreamID - CursorPosition storj.SegmentPosition - Limit int32 -} - -// ListSegmentsResponse response for ListSegments request. -type ListSegmentsResponse struct { - Items []storj.SegmentListItem - More bool -} - -func (params *ListSegmentsParams) toRequest(header *pb.RequestHeader) *pb.SegmentListRequest { - return &pb.SegmentListRequest{ - Header: header, - StreamId: params.StreamID, - CursorPosition: &pb.SegmentPosition{ - PartNumber: params.CursorPosition.PartNumber, - Index: params.CursorPosition.Index, - }, - Limit: params.Limit, - } -} - -// BatchItem returns single item for batch request. -func (params *ListSegmentsParams) BatchItem() *pb.BatchRequestItem { - return &pb.BatchRequestItem{ - Request: &pb.BatchRequestItem_SegmentList{ - SegmentList: params.toRequest(nil), - }, - } -} - -func newListSegmentsResponse(response *pb.SegmentListResponse) ListSegmentsResponse { - items := make([]storj.SegmentListItem, len(response.Items)) - for i, responseItem := range response.Items { - items[i] = storj.SegmentListItem{ - Position: storj.SegmentPosition{ - PartNumber: responseItem.Position.PartNumber, - Index: responseItem.Position.Index, - }, - } - } - return ListSegmentsResponse{ - Items: items, - More: response.More, - } -} - -// ListSegments lists object segments. -func (client *Client) ListSegments(ctx context.Context, params ListSegmentsParams) (_ []storj.SegmentListItem, more bool, err error) { - defer mon.Task()(&ctx)(&err) - - response, err := client.client.ListSegments(ctx, params.toRequest(client.header())) - if err != nil { - if errs2.IsRPC(err, rpcstatus.NotFound) { - return []storj.SegmentListItem{}, false, storj.ErrObjectNotFound.Wrap(err) - } - return []storj.SegmentListItem{}, false, Error.Wrap(err) - } - - listResponse := newListSegmentsResponse(response) - return listResponse.Items, listResponse.More, Error.Wrap(err) -} - -// Batch sends multiple requests in one batch. -func (client *Client) Batch(ctx context.Context, requests ...BatchItem) (resp []BatchResponse, err error) { - defer mon.Task()(&ctx)(&err) - - batchItems := make([]*pb.BatchRequestItem, len(requests)) - for i, request := range requests { - batchItems[i] = request.BatchItem() - } - response, err := client.client.Batch(ctx, &pb.BatchRequest{ - Header: client.header(), - Requests: batchItems, - }) - if err != nil { - return []BatchResponse{}, Error.Wrap(err) - } - - resp = make([]BatchResponse, len(response.Responses)) - for i, response := range response.Responses { - resp[i] = BatchResponse{ - pbRequest: batchItems[i].Request, - pbResponse: response.Response, - } - } - - return resp, nil -} - -// SetRawAPIKey sets the client's raw API key. Mainly used for testing. -func (client *Client) SetRawAPIKey(key []byte) { - client.apiKeyRaw = key -} diff --git a/vendor/storj.io/uplink/private/metainfo/interface.go b/vendor/storj.io/uplink/private/metainfo/interface.go deleted file mode 100644 index 7a13d2737..000000000 --- a/vendor/storj.io/uplink/private/metainfo/interface.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -import ( - "context" - "time" - - "storj.io/common/storj" -) - -// CreateObject has optional parameters that can be set. -type CreateObject struct { - Metadata map[string]string - ContentType string - Expires time.Time - - storj.RedundancyScheme - storj.EncryptionParameters -} - -// Object converts the CreateObject to an object with unitialized values. -func (create CreateObject) Object(bucket storj.Bucket, path storj.Path) storj.Object { - return storj.Object{ - Bucket: bucket, - Path: path, - Metadata: create.Metadata, - ContentType: create.ContentType, - Expires: create.Expires, - Stream: storj.Stream{ - Size: -1, // unknown - Checksum: nil, // unknown - SegmentCount: -1, // unknown - FixedSegmentSize: -1, // unknown - - RedundancyScheme: create.RedundancyScheme, - EncryptionParameters: create.EncryptionParameters, - }, - } -} - -// ReadOnlyStream is an interface for reading segment information. -type ReadOnlyStream interface { - Info() storj.Object - - // SegmentsAt returns the segment that contains the byteOffset and following segments. - // Limit specifies how much to return at most. - SegmentsAt(ctx context.Context, byteOffset int64, limit int64) (infos []storj.Segment, more bool, err error) - // Segments returns the segment at index. - // Limit specifies how much to return at most. - Segments(ctx context.Context, index int64, limit int64) (infos []storj.Segment, more bool, err error) -} - -// MutableObject is an interface for manipulating creating/deleting object stream. -type MutableObject interface { - // Info gets the current information about the object. - Info() storj.Object - - // CreateStream creates a new stream for the object. - CreateStream(ctx context.Context) (MutableStream, error) - // ContinueStream starts to continue a partially uploaded stream. - ContinueStream(ctx context.Context) (MutableStream, error) - // DeleteStream deletes any information about this objects stream. - DeleteStream(ctx context.Context) error - - // Commit commits the changes to the database. - Commit(ctx context.Context) error -} - -// MutableStream is an interface for manipulating stream information. -type MutableStream interface { - BucketName() string - Path() string - - Expires() time.Time - Metadata() ([]byte, error) - - // AddSegments adds segments to the stream. - AddSegments(ctx context.Context, segments ...storj.Segment) error - // UpdateSegments updates information about segments. - UpdateSegments(ctx context.Context, segments ...storj.Segment) error -} diff --git a/vendor/storj.io/uplink/private/metainfo/metainfo.go b/vendor/storj.io/uplink/private/metainfo/metainfo.go deleted file mode 100644 index 1d9299195..000000000 --- a/vendor/storj.io/uplink/private/metainfo/metainfo.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -import ( - "context" - - "github.com/zeebo/errs" - - "storj.io/common/encryption" - "storj.io/common/storj" -) - -var errClass = errs.Class("metainfo") - -const defaultSegmentLimit = 8 // TODO - -// DB implements metainfo database. -type DB struct { - metainfo *Client - - encStore *encryption.Store -} - -// New creates a new metainfo database. -func New(metainfo *Client, encStore *encryption.Store) *DB { - return &DB{ - metainfo: metainfo, - encStore: encStore, - } -} - -// CreateBucket creates a new bucket with the specified information. -func (db *DB) CreateBucket(ctx context.Context, bucketName string) (newBucket storj.Bucket, err error) { - defer mon.Task()(&ctx)(&err) - - if bucketName == "" { - return storj.Bucket{}, storj.ErrNoBucket.New("") - } - - newBucket, err = db.metainfo.CreateBucket(ctx, CreateBucketParams{ - Name: []byte(bucketName), - }) - return newBucket, storj.ErrBucket.Wrap(err) -} - -// DeleteBucket deletes bucket. -func (db *DB) DeleteBucket(ctx context.Context, bucketName string) (bucket storj.Bucket, err error) { - defer mon.Task()(&ctx)(&err) - - if bucketName == "" { - return storj.Bucket{}, storj.ErrNoBucket.New("") - } - - bucket, err = db.metainfo.DeleteBucket(ctx, DeleteBucketParams{ - Name: []byte(bucketName), - }) - return bucket, storj.ErrBucket.Wrap(err) -} - -// GetBucket gets bucket information. -func (db *DB) GetBucket(ctx context.Context, bucketName string) (bucket storj.Bucket, err error) { - defer mon.Task()(&ctx)(&err) - - if bucketName == "" { - return storj.Bucket{}, storj.ErrNoBucket.New("") - } - - bucket, err = db.metainfo.GetBucket(ctx, GetBucketParams{ - Name: []byte(bucketName), - }) - return bucket, storj.ErrBucket.Wrap(err) -} - -// ListBuckets lists buckets. -func (db *DB) ListBuckets(ctx context.Context, options storj.BucketListOptions) (bucketList storj.BucketList, err error) { - defer mon.Task()(&ctx)(&err) - - bucketList, err = db.metainfo.ListBuckets(ctx, ListBucketsParams{ - ListOpts: options, - }) - return bucketList, storj.ErrBucket.Wrap(err) -} diff --git a/vendor/storj.io/uplink/private/metainfo/objects.go b/vendor/storj.io/uplink/private/metainfo/objects.go deleted file mode 100644 index e9f326e14..000000000 --- a/vendor/storj.io/uplink/private/metainfo/objects.go +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -import ( - "context" - "errors" - "strings" - "time" - - "storj.io/common/encryption" - "storj.io/common/paths" - "storj.io/common/pb" - "storj.io/common/storj" -) - -var contentTypeKey = "content-type" - -// Meta info about a segment. -type Meta struct { - Modified time.Time - Expiration time.Time - Size int64 - Data []byte -} - -// GetObject returns information about an object. -func (db *DB) GetObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (info storj.Object, err error) { - defer mon.Task()(&ctx)(&err) - - _, info, err = db.getInfo(ctx, bucket, path) - - return info, err -} - -// GetObjectStream returns interface for reading the object stream. -func (db *DB) GetObjectStream(ctx context.Context, bucket storj.Bucket, object storj.Object) (stream ReadOnlyStream, err error) { - defer mon.Task()(&ctx)(&err) - - if bucket.Name == "" { - return nil, storj.ErrNoBucket.New("") - } - - if object.Path == "" { - return nil, storj.ErrNoPath.New("") - } - - return &readonlyStream{ - db: db, - info: object, - }, nil -} - -// CreateObject creates an uploading object and returns an interface for uploading Object information. -func (db *DB) CreateObject(ctx context.Context, bucket storj.Bucket, path storj.Path, createInfo *CreateObject) (object MutableObject, err error) { - defer mon.Task()(&ctx)(&err) - - if bucket.Name == "" { - return nil, storj.ErrNoBucket.New("") - } - - if path == "" { - return nil, storj.ErrNoPath.New("") - } - - info := storj.Object{ - Bucket: bucket, - Path: path, - } - - if createInfo != nil { - info.Metadata = createInfo.Metadata - info.ContentType = createInfo.ContentType - info.Expires = createInfo.Expires - info.RedundancyScheme = createInfo.RedundancyScheme - info.EncryptionParameters = createInfo.EncryptionParameters - } - - // TODO: autodetect content type from the path extension - // if info.ContentType == "" {} - - return &mutableObject{ - db: db, - info: info, - }, nil -} - -// ModifyObject modifies a committed object. -func (db *DB) ModifyObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (object MutableObject, err error) { - defer mon.Task()(&ctx)(&err) - return nil, errors.New("not implemented") -} - -// DeleteObject deletes an object from database. -func (db *DB) DeleteObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (_ storj.Object, err error) { - defer mon.Task()(&ctx)(&err) - - if bucket.Name == "" { - return storj.Object{}, storj.ErrNoBucket.New("") - } - - if len(path) == 0 { - return storj.Object{}, storj.ErrNoPath.New("") - } - - encPath, err := encryption.EncryptPathWithStoreCipher(bucket.Name, paths.NewUnencrypted(path), db.encStore) - if err != nil { - return storj.Object{}, err - } - - _, object, err := db.metainfo.BeginDeleteObject(ctx, BeginDeleteObjectParams{ - Bucket: []byte(bucket.Name), - EncryptedPath: []byte(encPath.Raw()), - }) - if err != nil { - return storj.Object{}, err - } - - _, obj, err := objectFromInfo(ctx, bucket, path, encPath, object, db.encStore) - return obj, err -} - -// ModifyPendingObject creates an interface for updating a partially uploaded object. -func (db *DB) ModifyPendingObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (object MutableObject, err error) { - defer mon.Task()(&ctx)(&err) - return nil, errors.New("not implemented") -} - -// ListPendingObjects lists pending objects in bucket based on the ListOptions. -func (db *DB) ListPendingObjects(ctx context.Context, bucket storj.Bucket, options storj.ListOptions) (list storj.ObjectList, err error) { - defer mon.Task()(&ctx)(&err) - return storj.ObjectList{}, errors.New("not implemented") -} - -// ListObjects lists objects in bucket based on the ListOptions. -func (db *DB) ListObjects(ctx context.Context, bucket storj.Bucket, options storj.ListOptions) (list storj.ObjectList, err error) { - defer mon.Task()(&ctx)(&err) - - if bucket.Name == "" { - return storj.ObjectList{}, storj.ErrNoBucket.New("") - } - - if options.Prefix != "" && !strings.HasSuffix(options.Prefix, "/") { - return storj.ObjectList{}, errClass.New("prefix should end with slash") - } - - var startAfter string - switch options.Direction { - // TODO for now we are supporting only storj.After - // case storj.Forward: - // // forward lists forwards from cursor, including cursor - // startAfter = keyBefore(options.Cursor) - case storj.After: - // after lists forwards from cursor, without cursor - startAfter = options.Cursor - default: - return storj.ObjectList{}, errClass.New("invalid direction %d", options.Direction) - } - - // TODO: we should let libuplink users be able to determine what metadata fields they request as well - // metaFlags := meta.All - // if db.pathCipher(bucket) == storj.EncNull || db.pathCipher(bucket) == storj.EncNullBase64URL { - // metaFlags = meta.None - // } - - // TODO use flags with listing - // if metaFlags&meta.Size != 0 { - // Calculating the stream's size require also the user-defined metadata, - // where stream store keeps info about the number of segments and their size. - // metaFlags |= meta.UserDefined - // } - - // Remove the trailing slash from list prefix. - // Otherwise, if we the list prefix is `/bob/`, the encrypted list - // prefix results in `enc("")/enc("bob")/enc("")`. This is an incorrect - // encrypted prefix, what we really want is `enc("")/enc("bob")`. - prefix := PathForKey(options.Prefix) - prefixKey, err := encryption.DerivePathKey(bucket.Name, prefix, db.encStore) - if err != nil { - return storj.ObjectList{}, errClass.Wrap(err) - } - - encPrefix, err := encryption.EncryptPathWithStoreCipher(bucket.Name, prefix, db.encStore) - if err != nil { - return storj.ObjectList{}, errClass.Wrap(err) - } - - // We have to encrypt startAfter but only if it doesn't contain a bucket. - // It contains a bucket if and only if the prefix has no bucket. This is why it is a raw - // string instead of a typed string: it's either a bucket or an unencrypted path component - // and that isn't known at compile time. - needsEncryption := bucket.Name != "" - var base *encryption.Base - if needsEncryption { - _, _, base = db.encStore.LookupEncrypted(bucket.Name, encPrefix) - - startAfter, err = encryption.EncryptPathRaw(startAfter, db.pathCipher(base.PathCipher), prefixKey) - if err != nil { - return storj.ObjectList{}, errClass.Wrap(err) - } - } - - items, more, err := db.metainfo.ListObjects(ctx, ListObjectsParams{ - Bucket: []byte(bucket.Name), - EncryptedPrefix: []byte(encPrefix.Raw()), - EncryptedCursor: []byte(startAfter), - Limit: int32(options.Limit), - Recursive: options.Recursive, - }) - if err != nil { - return storj.ObjectList{}, errClass.Wrap(err) - } - - list = storj.ObjectList{ - Bucket: bucket.Name, - Prefix: options.Prefix, - More: more, - Items: make([]storj.Object, 0, len(items)), - } - - for _, item := range items { - var bucketName string - var unencryptedKey paths.Unencrypted - var itemPath string - - if needsEncryption { - itemPath, err = encryption.DecryptPathRaw(string(item.EncryptedPath), db.pathCipher(base.PathCipher), prefixKey) - if err != nil { - // skip items that cannot be decrypted - if encryption.ErrDecryptFailed.Has(err) { - continue - } - return storj.ObjectList{}, errClass.Wrap(err) - } - - // TODO(jeff): this shouldn't be necessary if we handled trailing slashes - // appropriately. there's some issues with list. - fullPath := prefix.Raw() - if len(fullPath) > 0 && fullPath[len(fullPath)-1] != '/' { - fullPath += "/" - } - fullPath += itemPath - - bucketName = bucket.Name - unencryptedKey = paths.NewUnencrypted(fullPath) - } else { - itemPath = string(item.EncryptedPath) - bucketName = string(item.EncryptedPath) - unencryptedKey = paths.Unencrypted{} - } - - stream, streamMeta, err := TypedDecryptStreamInfo(ctx, bucketName, unencryptedKey, item.EncryptedMetadata, db.encStore) - if err != nil { - // skip items that cannot be decrypted - if encryption.ErrDecryptFailed.Has(err) { - continue - } - return storj.ObjectList{}, errClass.Wrap(err) - } - - object, err := objectFromMeta(bucket, itemPath, item, stream, streamMeta) - if err != nil { - return storj.ObjectList{}, errClass.Wrap(err) - } - - list.Items = append(list.Items, object) - } - - return list, nil -} - -func (db *DB) pathCipher(pathCipher storj.CipherSuite) storj.CipherSuite { - if db.encStore.EncryptionBypass { - return storj.EncNullBase64URL - } - return pathCipher -} - -type object struct { - bucket string - encPath paths.Encrypted - lastSegmentMeta Meta - streamInfo *pb.StreamInfo - streamMeta pb.StreamMeta -} - -func (db *DB) getInfo(ctx context.Context, bucket storj.Bucket, path storj.Path) (obj object, info storj.Object, err error) { - defer mon.Task()(&ctx)(&err) - - if bucket.Name == "" { - return object{}, storj.Object{}, storj.ErrNoBucket.New("") - } - - if path == "" { - return object{}, storj.Object{}, storj.ErrNoPath.New("") - } - - encPath, err := encryption.EncryptPathWithStoreCipher(bucket.Name, paths.NewUnencrypted(path), db.encStore) - if err != nil { - return object{}, storj.Object{}, err - } - - objectInfo, err := db.metainfo.GetObject(ctx, GetObjectParams{ - Bucket: []byte(bucket.Name), - EncryptedPath: []byte(encPath.Raw()), - }) - if err != nil { - return object{}, storj.Object{}, err - } - - return objectFromInfo(ctx, bucket, path, encPath, objectInfo, db.encStore) -} - -func objectFromInfo(ctx context.Context, bucket storj.Bucket, path storj.Path, encPath paths.Encrypted, objectInfo storj.ObjectInfo, encStore *encryption.Store) (object, storj.Object, error) { - if objectInfo.Bucket == "" { // zero objectInfo - return object{}, storj.Object{}, nil - } - - lastSegmentMeta := Meta{ - Modified: objectInfo.Created, - Expiration: objectInfo.Expires, - Size: objectInfo.Size, - Data: objectInfo.Metadata, - } - - streamInfo, streamMeta, err := TypedDecryptStreamInfo(ctx, bucket.Name, paths.NewUnencrypted(path), lastSegmentMeta.Data, encStore) - if err != nil { - return object{}, storj.Object{}, err - } - - info, err := objectStreamFromMeta(bucket, path, objectInfo.StreamID, lastSegmentMeta, streamInfo, streamMeta, objectInfo.Stream.RedundancyScheme) - if err != nil { - return object{}, storj.Object{}, err - } - - return object{ - bucket: bucket.Name, - encPath: encPath, - lastSegmentMeta: lastSegmentMeta, - streamInfo: streamInfo, - streamMeta: streamMeta, - }, info, nil -} - -func objectFromMeta(bucket storj.Bucket, path storj.Path, listItem storj.ObjectListItem, stream *pb.StreamInfo, streamMeta pb.StreamMeta) (storj.Object, error) { - object := storj.Object{ - Version: 0, // TODO: - Bucket: bucket, - Path: path, - IsPrefix: listItem.IsPrefix, - - Created: listItem.CreatedAt, // TODO: use correct field - Modified: listItem.CreatedAt, // TODO: use correct field - Expires: listItem.ExpiresAt, - } - - err := updateObjectWithStream(&object, stream, streamMeta) - if err != nil { - return storj.Object{}, err - } - - return object, nil -} - -func objectStreamFromMeta(bucket storj.Bucket, path storj.Path, streamID storj.StreamID, lastSegment Meta, stream *pb.StreamInfo, streamMeta pb.StreamMeta, redundancyScheme storj.RedundancyScheme) (storj.Object, error) { - var nonce storj.Nonce - var encryptedKey storj.EncryptedPrivateKey - if streamMeta.LastSegmentMeta != nil { - copy(nonce[:], streamMeta.LastSegmentMeta.KeyNonce) - encryptedKey = streamMeta.LastSegmentMeta.EncryptedKey - } - - rv := storj.Object{ - Version: 0, // TODO: - Bucket: bucket, - Path: path, - IsPrefix: false, - - Created: lastSegment.Modified, // TODO: use correct field - Modified: lastSegment.Modified, // TODO: use correct field - Expires: lastSegment.Expiration, // TODO: use correct field - - Stream: storj.Stream{ - ID: streamID, - - RedundancyScheme: redundancyScheme, - EncryptionParameters: storj.EncryptionParameters{ - CipherSuite: storj.CipherSuite(streamMeta.EncryptionType), - BlockSize: streamMeta.EncryptionBlockSize, - }, - LastSegment: storj.LastSegment{ - EncryptedKeyNonce: nonce, - EncryptedKey: encryptedKey, - }, - }, - } - - err := updateObjectWithStream(&rv, stream, streamMeta) - if err != nil { - return storj.Object{}, err - } - - return rv, nil -} - -func updateObjectWithStream(object *storj.Object, stream *pb.StreamInfo, streamMeta pb.StreamMeta) error { - if stream == nil { - return nil - } - - serializableMeta := pb.SerializableMeta{} - err := pb.Unmarshal(stream.Metadata, &serializableMeta) - if err != nil { - return err - } - - // ensure that the map is not nil - if serializableMeta.UserDefined == nil { - serializableMeta.UserDefined = map[string]string{} - } - - _, found := serializableMeta.UserDefined[contentTypeKey] - if !found && serializableMeta.ContentType != "" { - serializableMeta.UserDefined[contentTypeKey] = serializableMeta.ContentType - } - - segmentCount := numberOfSegments(stream, streamMeta) - object.Metadata = serializableMeta.UserDefined - object.Stream.Size = ((segmentCount - 1) * stream.SegmentsSize) + stream.LastSegmentSize - object.Stream.SegmentCount = segmentCount - object.Stream.FixedSegmentSize = stream.SegmentsSize - object.Stream.LastSegment.Size = stream.LastSegmentSize - - return nil -} - -type mutableObject struct { - db *DB - info storj.Object -} - -func (object *mutableObject) Info() storj.Object { return object.info } - -func (object *mutableObject) CreateStream(ctx context.Context) (_ MutableStream, err error) { - defer mon.Task()(&ctx)(&err) - return &mutableStream{ - db: object.db, - info: object.info, - }, nil -} - -func (object *mutableObject) ContinueStream(ctx context.Context) (_ MutableStream, err error) { - defer mon.Task()(&ctx)(&err) - return nil, errors.New("not implemented") -} - -func (object *mutableObject) DeleteStream(ctx context.Context) (err error) { - defer mon.Task()(&ctx)(&err) - return errors.New("not implemented") -} - -func (object *mutableObject) Commit(ctx context.Context) (err error) { - defer mon.Task()(&ctx)(&err) - _, info, err := object.db.getInfo(ctx, object.info.Bucket, object.info.Path) - object.info = info - return err -} - -func numberOfSegments(stream *pb.StreamInfo, streamMeta pb.StreamMeta) int64 { - if streamMeta.NumberOfSegments > 0 { - return streamMeta.NumberOfSegments - } - return stream.DeprecatedNumberOfSegments -} - -// TypedDecryptStreamInfo decrypts stream info. -func TypedDecryptStreamInfo(ctx context.Context, bucket string, unencryptedKey paths.Unencrypted, streamMetaBytes []byte, encStore *encryption.Store) ( - _ *pb.StreamInfo, streamMeta pb.StreamMeta, err error) { - defer mon.Task()(&ctx)(&err) - - err = pb.Unmarshal(streamMetaBytes, &streamMeta) - if err != nil { - return nil, pb.StreamMeta{}, err - } - - if encStore.EncryptionBypass { - return nil, streamMeta, nil - } - - derivedKey, err := encryption.DeriveContentKey(bucket, unencryptedKey, encStore) - if err != nil { - return nil, pb.StreamMeta{}, err - } - - cipher := storj.CipherSuite(streamMeta.EncryptionType) - encryptedKey, keyNonce := getEncryptedKeyAndNonce(streamMeta.LastSegmentMeta) - contentKey, err := encryption.DecryptKey(encryptedKey, cipher, derivedKey, keyNonce) - if err != nil { - return nil, pb.StreamMeta{}, err - } - - // decrypt metadata with the content encryption key and zero nonce - streamInfo, err := encryption.Decrypt(streamMeta.EncryptedStreamInfo, cipher, contentKey, &storj.Nonce{}) - if err != nil { - return nil, pb.StreamMeta{}, err - } - - var stream pb.StreamInfo - if err := pb.Unmarshal(streamInfo, &stream); err != nil { - return nil, pb.StreamMeta{}, err - } - - return &stream, streamMeta, nil -} - -func getEncryptedKeyAndNonce(m *pb.SegmentMeta) (storj.EncryptedPrivateKey, *storj.Nonce) { - if m == nil { - return nil, nil - } - - var nonce storj.Nonce - copy(nonce[:], m.KeyNonce) - - return m.EncryptedKey, &nonce -} - -// PathForKey removes the trailing `/` from the raw path, which is required so -// the derived key matches the final list path (which also has the trailing -// encrypted `/` part of the path removed). -func PathForKey(raw string) paths.Unencrypted { - return paths.NewUnencrypted(strings.TrimSuffix(raw, "/")) -} diff --git a/vendor/storj.io/uplink/private/metainfo/paths.go b/vendor/storj.io/uplink/private/metainfo/paths.go deleted file mode 100644 index 8ab7959d0..000000000 --- a/vendor/storj.io/uplink/private/metainfo/paths.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -// TODO: known issue: -// this is incorrect since there's no good way to get such a path -// since the exact previous key is -// append(previousPrefix(cursor), infinite(0xFF)...) - -// TODO commented until we will decide if we will support direction for objects listing -// func keyBefore(cursor string) string { -// if cursor == "" { -// return "" -// } - -// before := []byte(cursor) -// if before[len(before)-1] == 0 { -// return string(before[:len(before)-1]) -// } -// before[len(before)-1]-- - -// before = append(before, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f) -// return string(before) -// } - -// func keyAfter(cursor string) string { -// return cursor + "\x00" -// } diff --git a/vendor/storj.io/uplink/private/metainfo/stream.go b/vendor/storj.io/uplink/private/metainfo/stream.go deleted file mode 100644 index b398739d6..000000000 --- a/vendor/storj.io/uplink/private/metainfo/stream.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package metainfo - -import ( - "context" - "errors" - "time" - - "storj.io/common/encryption" - "storj.io/common/paths" - "storj.io/common/pb" - "storj.io/common/storj" -) - -var _ ReadOnlyStream = (*readonlyStream)(nil) - -type readonlyStream struct { - db *DB - - info storj.Object -} - -func (stream *readonlyStream) Info() storj.Object { return stream.info } - -func (stream *readonlyStream) SegmentsAt(ctx context.Context, byteOffset int64, limit int64) (infos []storj.Segment, more bool, err error) { - defer mon.Task()(&ctx)(&err) - - if stream.info.FixedSegmentSize <= 0 { - return nil, false, errors.New("not implemented") - } - - index := byteOffset / stream.info.FixedSegmentSize - return stream.Segments(ctx, index, limit) -} - -func (stream *readonlyStream) segment(ctx context.Context, index int64) (segment storj.Segment, err error) { - defer mon.Task()(&ctx)(&err) - - segment = storj.Segment{ - Index: index, - } - - isLastSegment := segment.Index+1 == stream.info.SegmentCount - if isLastSegment { - index = -1 - } - info, limits, err := stream.db.metainfo.DownloadSegment(ctx, DownloadSegmentParams{ - StreamID: stream.Info().ID, - Position: storj.SegmentPosition{ - Index: int32(index), - }, - }) - if err != nil { - return segment, err - } - - segment.Size = stream.info.Size - segment.EncryptedKeyNonce = info.SegmentEncryption.EncryptedKeyNonce - segment.EncryptedKey = info.SegmentEncryption.EncryptedKey - - streamKey, err := encryption.DeriveContentKey(stream.info.Bucket.Name, paths.NewUnencrypted(stream.info.Path), stream.db.encStore) - if err != nil { - return segment, err - } - - contentKey, err := encryption.DecryptKey(segment.EncryptedKey, stream.info.EncryptionParameters.CipherSuite, streamKey, &segment.EncryptedKeyNonce) - if err != nil { - return segment, err - } - - nonce := new(storj.Nonce) - _, err = encryption.Increment(nonce, segment.Index+1) - if err != nil { - return segment, err - } - - if len(info.EncryptedInlineData) != 0 || len(limits) == 0 { - inline, err := encryption.Decrypt(info.EncryptedInlineData, stream.info.EncryptionParameters.CipherSuite, contentKey, nonce) - if err != nil { - return segment, err - } - segment.Inline = inline - } - - return segment, nil -} - -func (stream *readonlyStream) Segments(ctx context.Context, index int64, limit int64) (infos []storj.Segment, more bool, err error) { - defer mon.Task()(&ctx)(&err) - - if index < 0 { - return nil, false, errors.New("invalid argument") - } - if limit <= 0 { - limit = defaultSegmentLimit - } - if index >= stream.info.SegmentCount { - return nil, false, nil - } - - infos = make([]storj.Segment, 0, limit) - for ; index < stream.info.SegmentCount && limit > 0; index++ { - limit-- - segment, err := stream.segment(ctx, index) - if err != nil { - return nil, false, err - } - infos = append(infos, segment) - } - - more = index < stream.info.SegmentCount - return infos, more, nil -} - -type mutableStream struct { - db *DB - info storj.Object -} - -func (stream *mutableStream) BucketName() string { return stream.info.Bucket.Name } -func (stream *mutableStream) Path() string { return stream.info.Path } - -func (stream *mutableStream) Info() storj.Object { return stream.info } - -func (stream *mutableStream) Expires() time.Time { return stream.info.Expires } - -func (stream *mutableStream) Metadata() ([]byte, error) { - if stream.info.ContentType != "" { - if stream.info.Metadata == nil { - stream.info.Metadata = make(map[string]string) - stream.info.Metadata[contentTypeKey] = stream.info.ContentType - } else if _, found := stream.info.Metadata[contentTypeKey]; !found { - stream.info.Metadata[contentTypeKey] = stream.info.ContentType - } - } - if stream.info.Metadata == nil { - return []byte{}, nil - } - return pb.Marshal(&pb.SerializableMeta{ - UserDefined: stream.info.Metadata, - }) -} - -func (stream *mutableStream) AddSegments(ctx context.Context, segments ...storj.Segment) (err error) { - defer mon.Task()(&ctx)(&err) - return errors.New("not implemented") -} - -func (stream *mutableStream) UpdateSegments(ctx context.Context, segments ...storj.Segment) (err error) { - defer mon.Task()(&ctx)(&err) - return errors.New("not implemented") -} diff --git a/vendor/storj.io/uplink/private/piecestore/buffering.go b/vendor/storj.io/uplink/private/piecestore/buffering.go deleted file mode 100644 index 21e4a19c1..000000000 --- a/vendor/storj.io/uplink/private/piecestore/buffering.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package piecestore - -import ( - "bufio" - "context" - "sync" - - "github.com/zeebo/errs" - - "storj.io/common/pb" -) - -// BufferedUpload implements buffering for an Upload. -type BufferedUpload struct { - buffer bufio.Writer - upload *Upload -} - -// NewBufferedUpload creates buffered upload with the specified size. -func NewBufferedUpload(upload *Upload, size int) Uploader { - buffered := &BufferedUpload{} - buffered.upload = upload - buffered.buffer = *bufio.NewWriterSize(buffered.upload, size) - return buffered -} - -// Write writes content to the buffer and flushes it to the upload once enough data has been gathered. -func (upload *BufferedUpload) Write(data []byte) (int, error) { - return upload.buffer.Write(data) -} - -// Cancel aborts the upload. -func (upload *BufferedUpload) Cancel(ctx context.Context) (err error) { - defer mon.Task()(&ctx)(&err) - return upload.upload.Cancel(ctx) -} - -// Commit flushes any remaining content from buffer and commits the upload. -func (upload *BufferedUpload) Commit(ctx context.Context) (_ *pb.PieceHash, err error) { - defer mon.Task()(&ctx)(&err) - flushErr := upload.buffer.Flush() - piece, closeErr := upload.upload.Commit(ctx) - return piece, errs.Combine(flushErr, closeErr) -} - -// LockingUpload adds a lock around upload making it safe to use concurrently. -// TODO: this shouldn't be needed. -type LockingUpload struct { - mu sync.Mutex - upload Uploader -} - -// Write uploads data. -func (upload *LockingUpload) Write(p []byte) (int, error) { - upload.mu.Lock() - defer upload.mu.Unlock() - return upload.upload.Write(p) -} - -// Cancel aborts the upload. -func (upload *LockingUpload) Cancel(ctx context.Context) (err error) { - defer mon.Task()(&ctx)(&err) - upload.mu.Lock() - defer upload.mu.Unlock() - return upload.upload.Cancel(ctx) -} - -// Commit finishes the upload. -func (upload *LockingUpload) Commit(ctx context.Context) (_ *pb.PieceHash, err error) { - defer mon.Task()(&ctx)(&err) - upload.mu.Lock() - defer upload.mu.Unlock() - return upload.upload.Commit(ctx) -} - -// LockingDownload adds a lock around download making it safe to use concurrently. -// TODO: this shouldn't be needed. -type LockingDownload struct { - mu sync.Mutex - download Downloader -} - -// Read downloads content. -func (download *LockingDownload) Read(p []byte) (int, error) { - download.mu.Lock() - defer download.mu.Unlock() - return download.download.Read(p) -} - -// Close closes the deownload. -func (download *LockingDownload) Close() error { - download.mu.Lock() - defer download.mu.Unlock() - return download.download.Close() -} - -// GetHashAndLimit gets the download's hash and original order limit. -func (download *LockingDownload) GetHashAndLimit() (*pb.PieceHash, *pb.OrderLimit) { - return download.download.GetHashAndLimit() -} diff --git a/vendor/storj.io/uplink/private/piecestore/client.go b/vendor/storj.io/uplink/private/piecestore/client.go deleted file mode 100644 index 257aab511..000000000 --- a/vendor/storj.io/uplink/private/piecestore/client.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package piecestore - -import ( - "context" - "io" - - "github.com/zeebo/errs" - "go.uber.org/zap" - - "storj.io/common/identity" - "storj.io/common/memory" - "storj.io/common/pb" - "storj.io/common/rpc" - "storj.io/common/storj" -) - -// Error is the default error class for piecestore client. -var Error = errs.Class("piecestore") - -// Config defines piecestore client parameters for upload and download. -type Config struct { - UploadBufferSize int64 - DownloadBufferSize int64 - - InitialStep int64 - MaximumStep int64 -} - -// DefaultConfig are the default params used for upload and download. -var DefaultConfig = Config{ - UploadBufferSize: 256 * memory.KiB.Int64(), - DownloadBufferSize: 256 * memory.KiB.Int64(), - - InitialStep: 64 * memory.KiB.Int64(), - MaximumStep: 1 * memory.MiB.Int64(), -} - -// Client implements uploading, downloading and deleting content from a piecestore. -type Client struct { - log *zap.Logger - client pb.DRPCPiecestoreClient - conn *rpc.Conn - config Config -} - -// DialNodeURL dials the target piecestore endpoint. -func DialNodeURL(ctx context.Context, dialer rpc.Dialer, nodeURL storj.NodeURL, log *zap.Logger, config Config) (*Client, error) { - conn, err := dialer.DialNodeURL(ctx, nodeURL) - if err != nil { - return nil, Error.Wrap(err) - } - - return &Client{ - log: log, - client: pb.NewDRPCPiecestoreClient(conn), - conn: conn, - config: config, - }, nil -} - -// Retain uses a bloom filter to tell the piece store which pieces to keep. -func (client *Client) Retain(ctx context.Context, req *pb.RetainRequest) (err error) { - defer mon.Task()(&ctx)(&err) - _, err = client.client.Retain(ctx, req) - return Error.Wrap(err) -} - -// Close closes the underlying connection. -func (client *Client) Close() error { - return client.conn.Close() -} - -// GetPeerIdentity gets the connection's peer identity. -func (client *Client) GetPeerIdentity() (*identity.PeerIdentity, error) { - return client.conn.PeerIdentity() -} - -// next allocation step find the next trusted step. -func (client *Client) nextAllocationStep(previous int64) int64 { - // TODO: ensure that this is frame idependent - next := previous * 3 / 2 - if next > client.config.MaximumStep { - next = client.config.MaximumStep - } - return next -} - -// ignoreEOF is an utility func for ignoring EOF error, when it's not important. -func ignoreEOF(err error) error { - if err == io.EOF { - return nil - } - return err -} diff --git a/vendor/storj.io/uplink/private/piecestore/download.go b/vendor/storj.io/uplink/private/piecestore/download.go deleted file mode 100644 index c097f1b08..000000000 --- a/vendor/storj.io/uplink/private/piecestore/download.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package piecestore - -import ( - "context" - "fmt" - "io" - - "github.com/zeebo/errs" - - "storj.io/common/errs2" - "storj.io/common/identity" - "storj.io/common/pb" - "storj.io/common/signing" - "storj.io/common/storj" -) - -// Downloader is interface that can be used for downloading content. -// It matches signature of `io.ReadCloser`, with one extra function, -// GetHashAndLimit(), used for accessing information during GET_REPAIR. -type Downloader interface { - Read([]byte) (int, error) - Close() error - GetHashAndLimit() (*pb.PieceHash, *pb.OrderLimit) -} - -// Download implements downloading from a piecestore. -type Download struct { - client *Client - limit *pb.OrderLimit - privateKey storj.PiecePrivateKey - peer *identity.PeerIdentity - stream downloadStream - ctx context.Context - - read int64 // how much data we have read so far - allocated int64 // how far have we sent orders - downloaded int64 // how much data have we downloaded - downloadSize int64 // how much do we want to download - - // what is the step we consider to upload - allocationStep int64 - - unread ReadBuffer - - // hash and originLimit are received in the event of a GET_REPAIR - hash *pb.PieceHash - originLimit *pb.OrderLimit - - closed bool - closingError error -} - -type downloadStream interface { - CloseSend() error - Send(*pb.PieceDownloadRequest) error - Recv() (*pb.PieceDownloadResponse, error) -} - -// Download starts a new download using the specified order limit at the specified offset and size. -func (client *Client) Download(ctx context.Context, limit *pb.OrderLimit, piecePrivateKey storj.PiecePrivateKey, offset, size int64) (_ Downloader, err error) { - defer mon.Task()(&ctx)(&err) - - peer, err := client.conn.PeerIdentity() - if err != nil { - return nil, ErrInternal.Wrap(err) - } - - stream, err := client.client.Download(ctx) - if err != nil { - return nil, err - } - - err = stream.Send(&pb.PieceDownloadRequest{ - Limit: limit, - Chunk: &pb.PieceDownloadRequest_Chunk{ - Offset: offset, - ChunkSize: size, - }, - }) - if err != nil { - _, recvErr := stream.Recv() - return nil, ErrProtocol.Wrap(errs.Combine(err, recvErr)) - } - - download := &Download{ - client: client, - limit: limit, - privateKey: piecePrivateKey, - peer: peer, - stream: stream, - ctx: ctx, - - read: 0, - - allocated: 0, - downloaded: 0, - downloadSize: size, - - allocationStep: client.config.InitialStep, - } - - return &LockingDownload{download: download}, nil -} - -// Read downloads data from the storage node allocating as necessary. -func (client *Download) Read(data []byte) (read int, err error) { - ctx := client.ctx - defer mon.Task()(&ctx, "node: "+client.peer.ID.String()[0:8])(&err) - - if client.closed { - return 0, io.ErrClosedPipe - } - - for client.read < client.downloadSize { - // read from buffer - n, err := client.unread.Read(data) - client.read += int64(n) - read += n - - // if we have an error return the error - if err != nil { - return read, err - } - // if we are pending for an error, avoid further requests, but try to finish what's in unread buffer. - if client.unread.Errored() { - return read, nil - } - - // do we need to send a new order to storagenode - notYetReceived := client.allocated - client.downloaded - if notYetReceived < client.allocationStep { - newAllocation := client.allocationStep - - // If we have downloaded more than we have allocated - // due to a generous storagenode include this in the next allocation. - if notYetReceived < 0 { - newAllocation += -notYetReceived - } - - // Ensure we don't allocate more than we intend to read. - if client.allocated+newAllocation > client.downloadSize { - newAllocation = client.downloadSize - client.allocated - } - - // send an order - if newAllocation > 0 { - order, err := signing.SignUplinkOrder(ctx, client.privateKey, &pb.Order{ - SerialNumber: client.limit.SerialNumber, - Amount: client.allocated + newAllocation, - }) - if err != nil { - // we are signing so we shouldn't propagate this into close, - // however we should include this as a read error - client.unread.IncludeError(err) - client.closeWithError(nil) - return read, nil - } - - err = client.stream.Send(&pb.PieceDownloadRequest{ - Order: order, - }) - if err != nil { - // other side doesn't want to talk to us anymore or network went down - client.unread.IncludeError(err) - // if it's a cancellation, then we'll just close with context.Canceled - if errs2.IsCanceled(err) { - client.closeWithError(err) - return read, err - } - // otherwise, something else happened and we should try to ask the other side - client.closeAndTryFetchError() - return read, nil - } - - // update our allocation step - client.allocated += newAllocation - client.allocationStep = client.client.nextAllocationStep(client.allocationStep) - } - } - - // we have data, no need to wait for a chunk - if read > 0 { - return read, nil - } - - // we don't have data, wait for a chunk from storage node - response, err := client.stream.Recv() - if response != nil && response.Chunk != nil { - client.downloaded += int64(len(response.Chunk.Data)) - client.unread.Fill(response.Chunk.Data) - } - // This is a GET_REPAIR because we got a piece hash and the original order limit. - if response != nil && response.Hash != nil && response.Limit != nil { - client.hash = response.Hash - client.originLimit = response.Limit - } - - // we may have some data buffered, so we cannot immediately return the error - // we'll queue the error and use the received error as the closing error - if err != nil { - client.unread.IncludeError(err) - client.handleClosingError(err) - } - } - - // all downloaded - if read == 0 { - return 0, io.EOF - } - return read, nil -} - -// handleClosingError should be used for an error that also closed the stream. -func (client *Download) handleClosingError(err error) { - if client.closed { - return - } - client.closed = true - client.closingError = err -} - -// closeWithError is used when we include the err in the closing error and also close the stream. -func (client *Download) closeWithError(err error) { - if client.closed { - return - } - client.closed = true - client.closingError = errs.Combine(err, client.stream.CloseSend()) -} - -// closeAndTryFetchError closes the stream and also tries to fetch the actual error from the stream. -func (client *Download) closeAndTryFetchError() { - if client.closed { - return - } - client.closed = true - - client.closingError = client.stream.CloseSend() - if client.closingError == nil || client.closingError == io.EOF { - _, client.closingError = client.stream.Recv() - } -} - -// Close closes the downloading. -func (client *Download) Close() (err error) { - defer func() { - if err != nil { - details := errs.Class(fmt.Sprintf("(Node ID: %s, Piece ID: %s)", client.peer.ID.String(), client.limit.PieceId.String())) - err = details.Wrap(err) - err = Error.Wrap(err) - } - }() - - client.closeWithError(nil) - return client.closingError -} - -// GetHashAndLimit gets the download's hash and original order limit. -func (client *Download) GetHashAndLimit() (*pb.PieceHash, *pb.OrderLimit) { - return client.hash, client.originLimit -} - -// ReadBuffer implements buffered reading with an error. -type ReadBuffer struct { - data []byte - err error -} - -// Error returns an error if it was encountered. -func (buffer *ReadBuffer) Error() error { return buffer.err } - -// Errored returns whether the buffer contains an error. -func (buffer *ReadBuffer) Errored() bool { return buffer.err != nil } - -// Empty checks whether buffer needs to be filled. -func (buffer *ReadBuffer) Empty() bool { - return len(buffer.data) == 0 && buffer.err == nil -} - -// IncludeError adds error at the end of the buffer. -func (buffer *ReadBuffer) IncludeError(err error) { - buffer.err = errs.Combine(buffer.err, err) -} - -// Fill fills the buffer with the specified bytes. -func (buffer *ReadBuffer) Fill(data []byte) { - buffer.data = data -} - -// Read reads from the buffer. -func (buffer *ReadBuffer) Read(data []byte) (n int, err error) { - if len(buffer.data) > 0 { - n = copy(data, buffer.data) - buffer.data = buffer.data[n:] - return n, nil - } - - if buffer.err != nil { - return 0, buffer.err - } - - return 0, nil -} diff --git a/vendor/storj.io/uplink/private/piecestore/upload.go b/vendor/storj.io/uplink/private/piecestore/upload.go deleted file mode 100644 index 3ade3b783..000000000 --- a/vendor/storj.io/uplink/private/piecestore/upload.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package piecestore - -import ( - "context" - "hash" - "io" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - - "storj.io/common/identity" - "storj.io/common/pb" - "storj.io/common/pkcrypto" - "storj.io/common/signing" - "storj.io/common/storj" - "storj.io/common/sync2" -) - -var mon = monkit.Package() - -// Uploader defines the interface for uploading a piece. -type Uploader interface { - // Write uploads data to the storage node. - Write([]byte) (int, error) - // Cancel cancels the upload. - Cancel(context.Context) error - // Commit finalizes the upload. - Commit(context.Context) (*pb.PieceHash, error) -} - -// Upload implements uploading to the storage node. -type Upload struct { - client *Client - limit *pb.OrderLimit - privateKey storj.PiecePrivateKey - peer *identity.PeerIdentity - stream uploadStream - ctx context.Context - - hash hash.Hash // TODO: use concrete implementation - offset int64 - allocationStep int64 - - // when there's a send error then it will automatically close - finished bool - sendError error -} - -type uploadStream interface { - Context() context.Context - CloseSend() error - Send(*pb.PieceUploadRequest) error - CloseAndRecv() (*pb.PieceUploadResponse, error) -} - -// UploadReader uploads a reader to the storage node. -func (client *Client) UploadReader(ctx context.Context, limit *pb.OrderLimit, piecePrivateKey storj.PiecePrivateKey, data io.Reader) (hash *pb.PieceHash, err error) { - // UploadReader is implemented using deprecated Upload until we can get everything - // to switch to UploadReader directly. - - upload, err := client.Upload(ctx, limit, piecePrivateKey) - if err != nil { - return nil, err - } - defer func() { - if err != nil { - err = errs.Combine(err, upload.Cancel(ctx)) - return - } - hash, err = upload.Commit(ctx) - }() - - _, err = sync2.Copy(ctx, upload, data) - return nil, err -} - -// Upload is deprecated and will be removed. Please use UploadReader. -func (client *Client) Upload(ctx context.Context, limit *pb.OrderLimit, piecePrivateKey storj.PiecePrivateKey) (_ Uploader, err error) { - defer mon.Task()(&ctx, "node: "+limit.StorageNodeId.String()[0:8])(&err) - - peer, err := client.conn.PeerIdentity() - if err != nil { - return nil, ErrInternal.Wrap(err) - } - - stream, err := client.client.Upload(ctx) - if err != nil { - return nil, err - } - - err = stream.Send(&pb.PieceUploadRequest{ - Limit: limit, - }) - if err != nil { - _, closeErr := stream.CloseAndRecv() - switch { - case err != io.EOF && closeErr != nil: - err = ErrProtocol.Wrap(errs.Combine(err, closeErr)) - case closeErr != nil: - err = ErrProtocol.Wrap(closeErr) - } - - return nil, err - } - - upload := &Upload{ - client: client, - limit: limit, - privateKey: piecePrivateKey, - peer: peer, - stream: stream, - ctx: ctx, - - hash: pkcrypto.NewHash(), - offset: 0, - allocationStep: client.config.InitialStep, - } - - if client.config.UploadBufferSize <= 0 { - return &LockingUpload{upload: upload}, nil - } - return &LockingUpload{ - upload: NewBufferedUpload(upload, int(client.config.UploadBufferSize)), - }, nil -} - -// Write sends data to the storagenode allocating as necessary. -func (client *Upload) Write(data []byte) (written int, err error) { - ctx := client.ctx - defer mon.Task()(&ctx, "node: "+client.peer.ID.String()[0:8])(&err) - - if client.finished { - return 0, io.EOF - } - // if we already encountered an error, keep returning it - if client.sendError != nil { - return 0, client.sendError - } - - fullData := data - defer func() { - // write the hash of the data sent to the server - // guaranteed not to return error - _, _ = client.hash.Write(fullData[:written]) - }() - - for len(data) > 0 { - // pick a data chunk to send - var sendData []byte - if client.allocationStep < int64(len(data)) { - sendData, data = data[:client.allocationStep], data[client.allocationStep:] - } else { - sendData, data = data, nil - } - - // create a signed order for the next chunk - order, err := signing.SignUplinkOrder(ctx, client.privateKey, &pb.Order{ - SerialNumber: client.limit.SerialNumber, - Amount: client.offset + int64(len(sendData)), - }) - if err != nil { - return written, ErrInternal.Wrap(err) - } - - // send signed order + data - err = client.stream.Send(&pb.PieceUploadRequest{ - Order: order, - Chunk: &pb.PieceUploadRequest_Chunk{ - Offset: client.offset, - Data: sendData, - }, - }) - if err != nil { - _, closeErr := client.stream.CloseAndRecv() - switch { - case err != io.EOF && closeErr != nil: - err = ErrProtocol.Wrap(errs.Combine(err, closeErr)) - case closeErr != nil: - err = ErrProtocol.Wrap(closeErr) - } - - client.sendError = err - return written, err - } - - // update our offset - client.offset += int64(len(sendData)) - written += len(sendData) - - // update allocation step, incrementally building trust - client.allocationStep = client.client.nextAllocationStep(client.allocationStep) - } - - return written, nil -} - -// Cancel cancels the uploading. -func (client *Upload) Cancel(ctx context.Context) (err error) { - defer mon.Task()(&ctx)(&err) - if client.finished { - return io.EOF - } - client.finished = true - return Error.Wrap(client.stream.CloseSend()) -} - -// Commit finishes uploading by sending the piece-hash and retrieving the piece-hash. -func (client *Upload) Commit(ctx context.Context) (_ *pb.PieceHash, err error) { - defer mon.Task()(&ctx, "node: "+client.peer.ID.String()[0:8])(&err) - if client.finished { - return nil, io.EOF - } - client.finished = true - - if client.sendError != nil { - // something happened during sending, try to figure out what exactly - // since sendError was already reported, we don't need to rehandle it. - _, closeErr := client.stream.CloseAndRecv() - return nil, Error.Wrap(closeErr) - } - - // sign the hash for storage node - uplinkHash, err := signing.SignUplinkPieceHash(ctx, client.privateKey, &pb.PieceHash{ - PieceId: client.limit.PieceId, - PieceSize: client.offset, - Hash: client.hash.Sum(nil), - Timestamp: client.limit.OrderCreation, - }) - if err != nil { - // failed to sign, let's close the sending side, no need to wait for a response - closeErr := client.stream.CloseSend() - // closeErr being io.EOF doesn't inform us about anything - return nil, Error.Wrap(errs.Combine(err, ignoreEOF(closeErr))) - } - - // exchange signed piece hashes - // 1. send our piece hash - sendErr := client.stream.Send(&pb.PieceUploadRequest{ - Done: uplinkHash, - }) - - // 2. wait for a piece hash as a response - response, closeErr := client.stream.CloseAndRecv() - if response == nil || response.Done == nil { - // combine all the errors from before - // sendErr is io.EOF when failed to send, so don't care - // closeErr is io.EOF when storage node closed before sending us a response - return nil, errs.Combine(ErrProtocol.New("expected piece hash"), ignoreEOF(sendErr), ignoreEOF(closeErr)) - } - - // verification - verifyErr := client.client.VerifyPieceHash(client.stream.Context(), client.peer, client.limit, response.Done, uplinkHash.Hash) - - // combine all the errors from before - // sendErr is io.EOF when we failed to send - // closeErr is io.EOF when storage node closed properly - return response.Done, errs.Combine(verifyErr, ignoreEOF(sendErr), ignoreEOF(closeErr)) -} diff --git a/vendor/storj.io/uplink/private/piecestore/verification.go b/vendor/storj.io/uplink/private/piecestore/verification.go deleted file mode 100644 index 7e588d3a8..000000000 --- a/vendor/storj.io/uplink/private/piecestore/verification.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package piecestore - -import ( - "bytes" - "context" - "time" - - "github.com/zeebo/errs" - - "storj.io/common/identity" - "storj.io/common/pb" - "storj.io/common/signing" -) - -const pieceHashExpiration = 24 * time.Hour - -var ( - // ErrInternal is an error class for internal errors. - ErrInternal = errs.Class("internal") - // ErrProtocol is an error class for unexpected protocol sequence. - ErrProtocol = errs.Class("protocol") - // ErrVerifyUntrusted is an error in case there is a trust issue. - ErrVerifyUntrusted = errs.Class("untrusted") - // ErrStorageNodeInvalidResponse is an error when a storage node returns a response with invalid data. - ErrStorageNodeInvalidResponse = errs.Class("storage node has returned an invalid response") -) - -// VerifyPieceHash verifies piece hash which is sent by peer. -func (client *Client) VerifyPieceHash(ctx context.Context, peer *identity.PeerIdentity, limit *pb.OrderLimit, hash *pb.PieceHash, expectedHash []byte) (err error) { - defer mon.Task()(&ctx)(&err) - if peer == nil || limit == nil || hash == nil || len(expectedHash) == 0 { - return ErrProtocol.New("invalid arguments") - } - if limit.PieceId != hash.PieceId { - return ErrProtocol.New("piece id changed") // TODO: report rpc status bad message - } - if !bytes.Equal(hash.Hash, expectedHash) { - return ErrVerifyUntrusted.New("hashes don't match") // TODO: report rpc status bad message - } - - if err := signing.VerifyPieceHashSignature(ctx, signing.SigneeFromPeerIdentity(peer), hash); err != nil { - return ErrVerifyUntrusted.New("invalid hash signature: %v", err) // TODO: report rpc status bad message - } - - if hash.Timestamp.Before(time.Now().Add(-pieceHashExpiration)) { - return ErrStorageNodeInvalidResponse.New("piece has timestamp is too old (%v). Required to be not older than %s", - hash.Timestamp, pieceHashExpiration, - ) - } - - return nil -} diff --git a/vendor/storj.io/uplink/private/storage/segments/common.go b/vendor/storj.io/uplink/private/storage/segments/common.go deleted file mode 100644 index 92be9928f..000000000 --- a/vendor/storj.io/uplink/private/storage/segments/common.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package segments - -import ( - "github.com/zeebo/errs" -) - -// Error is the errs class of standard segment errors. -var Error = errs.Class("segment error") diff --git a/vendor/storj.io/uplink/private/storage/segments/size.go b/vendor/storj.io/uplink/private/storage/segments/size.go deleted file mode 100644 index 3fa8b9305..000000000 --- a/vendor/storj.io/uplink/private/storage/segments/size.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package segments - -import ( - "io" -) - -// SizedReader allows to check the total number of bytes read so far. -type SizedReader struct { - r io.Reader - size int64 -} - -// SizeReader create a new instance of SizedReader. -func SizeReader(r io.Reader) *SizedReader { - return &SizedReader{r: r} -} - -// Read implements io.Reader.Read. -func (r *SizedReader) Read(p []byte) (n int, err error) { - n, err = r.r.Read(p) - r.size += int64(n) - return n, err -} - -// Size returns the total number of bytes read so far. -func (r *SizedReader) Size() int64 { return r.size } diff --git a/vendor/storj.io/uplink/private/storage/segments/store.go b/vendor/storj.io/uplink/private/storage/segments/store.go deleted file mode 100644 index de58f45fc..000000000 --- a/vendor/storj.io/uplink/private/storage/segments/store.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package segments - -import ( - "context" - "io" - "math/rand" - "sync" - "time" - - "github.com/spacemonkeygo/monkit/v3" - - "storj.io/common/pb" - "storj.io/common/ranger" - "storj.io/common/storj" - "storj.io/uplink/private/ecclient" - "storj.io/uplink/private/eestream" - "storj.io/uplink/private/metainfo" -) - -var ( - mon = monkit.Package() -) - -// Store for segments. -type Store interface { - // Ranger creates a ranger for downloading erasure codes from piece store nodes. - Ranger(ctx context.Context, info storj.SegmentDownloadInfo, limits []*pb.AddressedOrderLimit, objectRS storj.RedundancyScheme) (ranger.Ranger, error) - Put(ctx context.Context, data io.Reader, expiration time.Time, limits []*pb.AddressedOrderLimit, piecePrivateKey storj.PiecePrivateKey, rs eestream.RedundancyStrategy) (_ []*pb.SegmentPieceUploadResult, size int64, err error) -} - -type segmentStore struct { - metainfo *metainfo.Client - ec ecclient.Client - rngMu sync.Mutex - rng *rand.Rand -} - -// NewSegmentStore creates a new instance of segmentStore. -func NewSegmentStore(metainfo *metainfo.Client, ec ecclient.Client) Store { - return &segmentStore{ - metainfo: metainfo, - ec: ec, - rng: rand.New(rand.NewSource(time.Now().UnixNano())), - } -} - -// Put uploads a segment to an erasure code client. -func (s *segmentStore) Put(ctx context.Context, data io.Reader, expiration time.Time, limits []*pb.AddressedOrderLimit, piecePrivateKey storj.PiecePrivateKey, rs eestream.RedundancyStrategy) (_ []*pb.SegmentPieceUploadResult, size int64, err error) { - defer mon.Task()(&ctx)(&err) - - sizedReader := SizeReader(data) - results, err := s.ec.PutSingleResult(ctx, limits, piecePrivateKey, rs, sizedReader, expiration) - if err != nil { - return nil, size, Error.Wrap(err) - } - - return results, sizedReader.Size(), nil -} - -// Ranger creates a ranger for downloading erasure codes from piece store nodes. -func (s *segmentStore) Ranger( - ctx context.Context, info storj.SegmentDownloadInfo, limits []*pb.AddressedOrderLimit, objectRS storj.RedundancyScheme, -) (rr ranger.Ranger, err error) { - defer mon.Task()(&ctx, info, limits, objectRS)(&err) - - // no order limits also means its inline segment - if len(info.EncryptedInlineData) != 0 || len(limits) == 0 { - return ranger.ByteRanger(info.EncryptedInlineData), nil - } - - needed := objectRS.DownloadNodes() - selected := make([]*pb.AddressedOrderLimit, len(limits)) - s.rngMu.Lock() - perm := s.rng.Perm(len(limits)) - s.rngMu.Unlock() - - for _, i := range perm { - limit := limits[i] - if limit == nil { - continue - } - - selected[i] = limit - - needed-- - if needed <= 0 { - break - } - } - - redundancy, err := eestream.NewRedundancyStrategyFromStorj(objectRS) - if err != nil { - return nil, err - } - - rr, err = s.ec.Get(ctx, selected, info.PiecePrivateKey, redundancy, info.Size) - return rr, Error.Wrap(err) -} diff --git a/vendor/storj.io/uplink/private/storage/streams/eof.go b/vendor/storj.io/uplink/private/storage/streams/eof.go deleted file mode 100644 index 316954e30..000000000 --- a/vendor/storj.io/uplink/private/storage/streams/eof.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package streams - -import "io" - -// EOFReader holds reader and status of EOF. -type EOFReader struct { - reader io.Reader - eof bool - err error -} - -// NewEOFReader keeps track of the state, has the internal reader reached EOF. -func NewEOFReader(r io.Reader) *EOFReader { - return &EOFReader{reader: r} -} - -func (r *EOFReader) Read(p []byte) (n int, err error) { - n, err = r.reader.Read(p) - if err == io.EOF { - r.eof = true - } else if err != nil && r.err == nil { - r.err = err - } - return n, err -} - -func (r *EOFReader) isEOF() bool { - return r.eof -} - -func (r *EOFReader) hasError() bool { - return r.err != nil -} diff --git a/vendor/storj.io/uplink/private/storage/streams/path.go b/vendor/storj.io/uplink/private/storage/streams/path.go deleted file mode 100644 index 07c904871..000000000 --- a/vendor/storj.io/uplink/private/storage/streams/path.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package streams - -import ( - "strings" - - "storj.io/common/paths" - "storj.io/common/storj" -) - -// Path is a representation of an object path within a bucket. -type Path struct { - bucket string - unencPath paths.Unencrypted - raw []byte -} - -// Bucket returns the bucket part of the path. -func (p Path) Bucket() string { return p.bucket } - -// UnencryptedPath returns the unencrypted path part of the path. -func (p Path) UnencryptedPath() paths.Unencrypted { return p.unencPath } - -// Raw returns the raw data in the path. -func (p Path) Raw() []byte { return append([]byte(nil), p.raw...) } - -// String returns the string form of the raw data in the path. -func (p Path) String() string { return string(p.raw) } - -// ParsePath returns a new Path with the given raw bytes. -func ParsePath(raw storj.Path) Path { - // A path may contain a bucket and an unencrypted path. - parts := strings.SplitN(raw, "/", 2) - path := Path{} - path.bucket = parts[0] - if len(parts) > 1 { - path.unencPath = paths.NewUnencrypted(parts[1]) - } - path.raw = []byte(raw) - return path -} diff --git a/vendor/storj.io/uplink/private/storage/streams/peek.go b/vendor/storj.io/uplink/private/storage/streams/peek.go deleted file mode 100644 index 01ffec82b..000000000 --- a/vendor/storj.io/uplink/private/storage/streams/peek.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package streams - -import ( - "io" - - "github.com/zeebo/errs" -) - -// PeekThresholdReader allows a check to see if the size of a given reader -// exceeds the maximum inline segment size or not. -type PeekThresholdReader struct { - r io.Reader - thresholdBuf []byte - isLargerCalled bool - readCalled bool -} - -// NewPeekThresholdReader creates a new instance of PeekThresholdReader. -func NewPeekThresholdReader(r io.Reader) (pt *PeekThresholdReader) { - return &PeekThresholdReader{r: r} -} - -// Read initially reads bytes from the internal buffer, then continues -// reading from the wrapped data reader. The number of bytes read `n` -// is returned. -func (pt *PeekThresholdReader) Read(p []byte) (n int, err error) { - pt.readCalled = true - - if len(pt.thresholdBuf) == 0 { - return pt.r.Read(p) - } - - n = copy(p, pt.thresholdBuf) - pt.thresholdBuf = pt.thresholdBuf[n:] - return n, nil -} - -// IsLargerThan returns a bool to determine whether a reader's size -// is larger than the given threshold or not. -func (pt *PeekThresholdReader) IsLargerThan(thresholdSize int) (bool, error) { - if pt.isLargerCalled { - return false, errs.New("IsLargerThan can't be called more than once") - } - if pt.readCalled { - return false, errs.New("IsLargerThan can't be called after Read has been called") - } - pt.isLargerCalled = true - buf := make([]byte, thresholdSize+1) - n, err := io.ReadFull(pt.r, buf) - pt.thresholdBuf = buf[:n] - if err == io.EOF || err == io.ErrUnexpectedEOF { - return false, nil - } - if err != nil { - return false, err - } - return true, nil -} diff --git a/vendor/storj.io/uplink/private/storage/streams/shim.go b/vendor/storj.io/uplink/private/storage/streams/shim.go deleted file mode 100644 index 2977e1fef..000000000 --- a/vendor/storj.io/uplink/private/storage/streams/shim.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package streams - -import ( - "context" - "io" - "time" - - "storj.io/common/encryption" - "storj.io/common/ranger" - "storj.io/common/storj" - "storj.io/uplink/private/metainfo" - "storj.io/uplink/private/storage/segments" -) - -// Metadata interface returns the latest metadata for an object. -type Metadata interface { - Metadata() ([]byte, error) -} - -// Store interface methods for streams to satisfy to be a store. -type Store interface { - Get(ctx context.Context, path storj.Path, object storj.Object) (ranger.Ranger, error) - Put(ctx context.Context, path storj.Path, data io.Reader, metadata Metadata, expiration time.Time) (Meta, error) -} - -type shimStore struct { - store typedStore -} - -// NewStreamStore constructs a Store. -func NewStreamStore(metainfo *metainfo.Client, segments segments.Store, segmentSize int64, encStore *encryption.Store, encBlockSize int, cipher storj.CipherSuite, inlineThreshold int, maxEncryptedSegmentSize int64) (Store, error) { - typedStore, err := newTypedStreamStore(metainfo, segments, segmentSize, encStore, encBlockSize, cipher, inlineThreshold, maxEncryptedSegmentSize) - if err != nil { - return nil, err - } - return &shimStore{store: typedStore}, nil -} - -// Get parses the passed in path and dispatches to the typed store. -func (s *shimStore) Get(ctx context.Context, path storj.Path, object storj.Object) (_ ranger.Ranger, err error) { - defer mon.Task()(&ctx)(&err) - - return s.store.Get(ctx, ParsePath(path), object) -} - -// Put parses the passed in path and dispatches to the typed store. -func (s *shimStore) Put(ctx context.Context, path storj.Path, data io.Reader, metadata Metadata, expiration time.Time) (_ Meta, err error) { - defer mon.Task()(&ctx)(&err) - - return s.store.Put(ctx, ParsePath(path), data, metadata, expiration) -} diff --git a/vendor/storj.io/uplink/private/storage/streams/store.go b/vendor/storj.io/uplink/private/storage/streams/store.go deleted file mode 100644 index efd80e275..000000000 --- a/vendor/storj.io/uplink/private/storage/streams/store.go +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package streams - -import ( - "context" - "crypto/rand" - "io" - "io/ioutil" - "time" - - "github.com/spacemonkeygo/monkit/v3" - "github.com/zeebo/errs" - "go.uber.org/zap" - - "storj.io/common/encryption" - "storj.io/common/pb" - "storj.io/common/ranger" - "storj.io/common/storj" - "storj.io/uplink/private/eestream" - "storj.io/uplink/private/metainfo" - "storj.io/uplink/private/storage/segments" -) - -var mon = monkit.Package() - -// Meta info about a stream. -type Meta struct { - Modified time.Time - Expiration time.Time - Size int64 - Data []byte -} - -// Store interface methods for streams to satisfy to be a store. -type typedStore interface { - Get(ctx context.Context, path Path, object storj.Object) (ranger.Ranger, error) - Put(ctx context.Context, path Path, data io.Reader, metadata Metadata, expiration time.Time) (Meta, error) - Delete(ctx context.Context, path Path) (storj.ObjectInfo, error) -} - -// streamStore is a store for streams. It implements typedStore as part of an ongoing migration -// to use typed paths. See the shim for the store that the rest of the world interacts with. -type streamStore struct { - metainfo *metainfo.Client - segments segments.Store - segmentSize int64 - encStore *encryption.Store - encBlockSize int - cipher storj.CipherSuite - inlineThreshold int - maxEncryptedSegmentSize int64 -} - -// newTypedStreamStore constructs a typedStore backed by a streamStore. -func newTypedStreamStore(metainfo *metainfo.Client, segments segments.Store, segmentSize int64, encStore *encryption.Store, encBlockSize int, cipher storj.CipherSuite, inlineThreshold int, maxEncryptedSegmentSize int64) (typedStore, error) { - if segmentSize <= 0 { - return nil, errs.New("segment size must be larger than 0") - } - if encBlockSize <= 0 { - return nil, errs.New("encryption block size must be larger than 0") - } - - return &streamStore{ - metainfo: metainfo, - segments: segments, - segmentSize: segmentSize, - encStore: encStore, - encBlockSize: encBlockSize, - cipher: cipher, - inlineThreshold: inlineThreshold, - maxEncryptedSegmentSize: maxEncryptedSegmentSize, - }, nil -} - -// Put breaks up data as it comes in into s.segmentSize length pieces, then -// store the first piece at s0/, second piece at s1/, and the -// *last* piece at l/. Store the given metadata, along with the number -// of segments, in a new protobuf, in the metadata of l/. -// -// If there is an error, it cleans up any uploaded segment before returning. -func (s *streamStore) Put(ctx context.Context, path Path, data io.Reader, metadata Metadata, expiration time.Time) (_ Meta, err error) { - defer mon.Task()(&ctx)(&err) - derivedKey, err := encryption.DeriveContentKey(path.Bucket(), path.UnencryptedPath(), s.encStore) - if err != nil { - return Meta{}, err - } - encPath, err := encryption.EncryptPathWithStoreCipher(path.Bucket(), path.UnencryptedPath(), s.encStore) - if err != nil { - return Meta{}, err - } - - beginObjectReq := &metainfo.BeginObjectParams{ - Bucket: []byte(path.Bucket()), - EncryptedPath: []byte(encPath.Raw()), - ExpiresAt: expiration, - } - - var ( - streamID storj.StreamID - ) - defer func() { - if err != nil { - s.cancelHandler(context.Background(), path) - return - } - - select { - case <-ctx.Done(): - s.cancelHandler(context.Background(), path) - default: - } - }() - - var ( - currentSegment int64 - contentKey storj.Key - streamSize int64 - lastSegmentSize int64 - encryptedKey []byte - keyNonce storj.Nonce - rs eestream.RedundancyStrategy - - requestsToBatch = make([]metainfo.BatchItem, 0, 2) - ) - - eofReader := NewEOFReader(data) - for !eofReader.isEOF() && !eofReader.hasError() { - // generate random key for encrypting the segment's content - _, err := rand.Read(contentKey[:]) - if err != nil { - return Meta{}, err - } - - // Initialize the content nonce with the current total segment incremented - // by 1 because at this moment the next segment has not been already - // uploaded. - // The increment by 1 is to avoid nonce reuse with the metadata encryption, - // which is encrypted with the zero nonce. - contentNonce := storj.Nonce{} - _, err = encryption.Increment(&contentNonce, currentSegment+1) - if err != nil { - return Meta{}, err - } - - // generate random nonce for encrypting the content key - _, err = rand.Read(keyNonce[:]) - if err != nil { - return Meta{}, err - } - - encryptedKey, err = encryption.EncryptKey(&contentKey, s.cipher, derivedKey, &keyNonce) - if err != nil { - return Meta{}, err - } - - sizeReader := segments.SizeReader(eofReader) - segmentReader := io.LimitReader(sizeReader, s.segmentSize) - peekReader := NewPeekThresholdReader(segmentReader) - // If the data is larger than the inline threshold size, then it will be a remote segment - isRemote, err := peekReader.IsLargerThan(s.inlineThreshold) - if err != nil { - return Meta{}, err - } - - segmentEncryption := storj.SegmentEncryption{} - if s.cipher != storj.EncNull { - segmentEncryption = storj.SegmentEncryption{ - EncryptedKey: encryptedKey, - EncryptedKeyNonce: keyNonce, - } - } - - if isRemote { - encrypter, err := encryption.NewEncrypter(s.cipher, &contentKey, &contentNonce, s.encBlockSize) - if err != nil { - return Meta{}, err - } - - paddedReader := encryption.PadReader(ioutil.NopCloser(peekReader), encrypter.InBlockSize()) - transformedReader := encryption.TransformReader(paddedReader, encrypter, 0) - - beginSegment := &metainfo.BeginSegmentParams{ - MaxOrderLimit: s.maxEncryptedSegmentSize, - Position: storj.SegmentPosition{ - Index: int32(currentSegment), - }, - } - - var responses []metainfo.BatchResponse - if currentSegment == 0 { - responses, err = s.metainfo.Batch(ctx, beginObjectReq, beginSegment) - if err != nil { - return Meta{}, err - } - objResponse, err := responses[0].BeginObject() - if err != nil { - return Meta{}, err - } - streamID = objResponse.StreamID - rs = objResponse.RedundancyStrategy - } else { - beginSegment.StreamID = streamID - responses, err = s.metainfo.Batch(ctx, append(requestsToBatch, beginSegment)...) - requestsToBatch = requestsToBatch[:0] - if err != nil { - return Meta{}, err - } - } - - segResponse, err := responses[1].BeginSegment() - if err != nil { - return Meta{}, err - } - segmentID := segResponse.SegmentID - limits := segResponse.Limits - piecePrivateKey := segResponse.PiecePrivateKey - - uploadResults, size, err := s.segments.Put(ctx, transformedReader, expiration, limits, piecePrivateKey, rs) - if err != nil { - return Meta{}, err - } - - requestsToBatch = append(requestsToBatch, &metainfo.CommitSegmentParams{ - SegmentID: segmentID, - SizeEncryptedData: size, - Encryption: segmentEncryption, - UploadResult: uploadResults, - }) - } else { - data, err := ioutil.ReadAll(peekReader) - if err != nil { - return Meta{}, err - } - cipherData, err := encryption.Encrypt(data, s.cipher, &contentKey, &contentNonce) - if err != nil { - return Meta{}, err - } - - makeInlineSegment := &metainfo.MakeInlineSegmentParams{ - Position: storj.SegmentPosition{ - Index: int32(currentSegment), - }, - Encryption: segmentEncryption, - EncryptedInlineData: cipherData, - } - if currentSegment == 0 { - responses, err := s.metainfo.Batch(ctx, beginObjectReq, makeInlineSegment) - if err != nil { - return Meta{}, err - } - objResponse, err := responses[0].BeginObject() - if err != nil { - return Meta{}, err - } - streamID = objResponse.StreamID - } else { - makeInlineSegment.StreamID = streamID - requestsToBatch = append(requestsToBatch, makeInlineSegment) - } - } - - lastSegmentSize = sizeReader.Size() - streamSize += lastSegmentSize - currentSegment++ - } - - totalSegments := currentSegment - - if eofReader.hasError() { - return Meta{}, eofReader.err - } - - metadataBytes, err := metadata.Metadata() - if err != nil { - return Meta{}, err - } - - streamInfo, err := pb.Marshal(&pb.StreamInfo{ - DeprecatedNumberOfSegments: totalSegments, - SegmentsSize: s.segmentSize, - LastSegmentSize: lastSegmentSize, - Metadata: metadataBytes, - }) - if err != nil { - return Meta{}, err - } - - // encrypt metadata with the content encryption key and zero nonce. - encryptedStreamInfo, err := encryption.Encrypt(streamInfo, s.cipher, &contentKey, &storj.Nonce{}) - if err != nil { - return Meta{}, err - } - - streamMeta := pb.StreamMeta{ - NumberOfSegments: totalSegments, - EncryptedStreamInfo: encryptedStreamInfo, - EncryptionType: int32(s.cipher), - EncryptionBlockSize: int32(s.encBlockSize), - } - - if s.cipher != storj.EncNull { - streamMeta.LastSegmentMeta = &pb.SegmentMeta{ - EncryptedKey: encryptedKey, - KeyNonce: keyNonce[:], - } - } - - objectMetadata, err := pb.Marshal(&streamMeta) - if err != nil { - return Meta{}, err - } - - commitObject := metainfo.CommitObjectParams{ - StreamID: streamID, - EncryptedMetadata: objectMetadata, - } - if len(requestsToBatch) > 0 { - _, err = s.metainfo.Batch(ctx, append(requestsToBatch, &commitObject)...) - } else { - err = s.metainfo.CommitObject(ctx, commitObject) - } - if err != nil { - return Meta{}, err - } - - satStreamID := &pb.SatStreamID{} - err = pb.Unmarshal(streamID, satStreamID) - if err != nil { - return Meta{}, err - } - - resultMeta := Meta{ - Modified: satStreamID.CreationDate, - Expiration: expiration, - Size: streamSize, - Data: metadataBytes, - } - - return resultMeta, nil -} - -// Get returns a ranger that knows what the overall size is (from l/) -// and then returns the appropriate data from segments s0/, s1/, -// ..., l/. -func (s *streamStore) Get(ctx context.Context, path Path, object storj.Object) (rr ranger.Ranger, err error) { - defer mon.Task()(&ctx)(&err) - - info, limits, err := s.metainfo.DownloadSegment(ctx, metainfo.DownloadSegmentParams{ - StreamID: object.ID, - Position: storj.SegmentPosition{ - Index: -1, // Request the last segment - }, - }) - if err != nil { - return nil, err - } - - lastSegmentRanger, err := s.segments.Ranger(ctx, info, limits, object.RedundancyScheme) - if err != nil { - return nil, err - } - - derivedKey, err := encryption.DeriveContentKey(path.Bucket(), path.UnencryptedPath(), s.encStore) - if err != nil { - return nil, err - } - - var rangers []ranger.Ranger - for i := int64(0); i < object.SegmentCount-1; i++ { - var contentNonce storj.Nonce - _, err = encryption.Increment(&contentNonce, i+1) - if err != nil { - return nil, err - } - - rangers = append(rangers, &lazySegmentRanger{ - metainfo: s.metainfo, - segments: s.segments, - streamID: object.ID, - segmentIndex: int32(i), - rs: object.RedundancyScheme, - size: object.FixedSegmentSize, - derivedKey: derivedKey, - startingNonce: &contentNonce, - encBlockSize: int(object.EncryptionParameters.BlockSize), - cipher: object.CipherSuite, - }) - } - - var contentNonce storj.Nonce - _, err = encryption.Increment(&contentNonce, object.SegmentCount) - if err != nil { - return nil, err - } - - decryptedLastSegmentRanger, err := decryptRanger( - ctx, - lastSegmentRanger, - object.LastSegment.Size, - object.CipherSuite, - derivedKey, - info.SegmentEncryption.EncryptedKey, - &info.SegmentEncryption.EncryptedKeyNonce, - &contentNonce, - int(object.EncryptionParameters.BlockSize), - ) - if err != nil { - return nil, err - } - - rangers = append(rangers, decryptedLastSegmentRanger) - return ranger.Concat(rangers...), nil -} - -// Delete all the segments, with the last one last. -func (s *streamStore) Delete(ctx context.Context, path Path) (_ storj.ObjectInfo, err error) { - defer mon.Task()(&ctx)(&err) - - encPath, err := encryption.EncryptPathWithStoreCipher(path.Bucket(), path.UnencryptedPath(), s.encStore) - if err != nil { - return storj.ObjectInfo{}, err - } - - _, object, err := s.metainfo.BeginDeleteObject(ctx, metainfo.BeginDeleteObjectParams{ - Bucket: []byte(path.Bucket()), - EncryptedPath: []byte(encPath.Raw()), - }) - return object, err -} - -// ListItem is a single item in a listing. -type ListItem struct { - Path string - Meta Meta - IsPrefix bool -} - -type lazySegmentRanger struct { - ranger ranger.Ranger - metainfo *metainfo.Client - segments segments.Store - streamID storj.StreamID - segmentIndex int32 - rs storj.RedundancyScheme - size int64 - derivedKey *storj.Key - startingNonce *storj.Nonce - encBlockSize int - cipher storj.CipherSuite -} - -// Size implements Ranger.Size. -func (lr *lazySegmentRanger) Size() int64 { - return lr.size -} - -// Range implements Ranger.Range to be lazily connected. -func (lr *lazySegmentRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error) { - defer mon.Task()(&ctx)(&err) - if lr.ranger == nil { - info, limits, err := lr.metainfo.DownloadSegment(ctx, metainfo.DownloadSegmentParams{ - StreamID: lr.streamID, - Position: storj.SegmentPosition{ - Index: lr.segmentIndex, - }, - }) - if err != nil { - return nil, err - } - - rr, err := lr.segments.Ranger(ctx, info, limits, lr.rs) - if err != nil { - return nil, err - } - - encryptedKey, keyNonce := info.SegmentEncryption.EncryptedKey, info.SegmentEncryption.EncryptedKeyNonce - lr.ranger, err = decryptRanger(ctx, rr, lr.size, lr.cipher, lr.derivedKey, encryptedKey, &keyNonce, lr.startingNonce, lr.encBlockSize) - if err != nil { - return nil, err - } - } - return lr.ranger.Range(ctx, offset, length) -} - -// decryptRanger returns a decrypted ranger of the given rr ranger. -func decryptRanger(ctx context.Context, rr ranger.Ranger, decryptedSize int64, cipher storj.CipherSuite, derivedKey *storj.Key, encryptedKey storj.EncryptedPrivateKey, encryptedKeyNonce, startingNonce *storj.Nonce, encBlockSize int) (decrypted ranger.Ranger, err error) { - defer mon.Task()(&ctx)(&err) - contentKey, err := encryption.DecryptKey(encryptedKey, cipher, derivedKey, encryptedKeyNonce) - if err != nil { - return nil, err - } - - decrypter, err := encryption.NewDecrypter(cipher, contentKey, startingNonce, encBlockSize) - if err != nil { - return nil, err - } - - var rd ranger.Ranger - if rr.Size()%int64(decrypter.InBlockSize()) != 0 { - reader, err := rr.Range(ctx, 0, rr.Size()) - if err != nil { - return nil, err - } - defer func() { err = errs.Combine(err, reader.Close()) }() - cipherData, err := ioutil.ReadAll(reader) - if err != nil { - return nil, err - } - data, err := encryption.Decrypt(cipherData, cipher, contentKey, startingNonce) - if err != nil { - return nil, err - } - return ranger.ByteRanger(data), nil - } - - rd, err = encryption.Transform(rr, decrypter) - if err != nil { - return nil, err - } - return encryption.Unpad(rd, int(rd.Size()-decryptedSize)) -} - -// CancelHandler handles clean up of segments on receiving CTRL+C. -func (s *streamStore) cancelHandler(ctx context.Context, path Path) { - defer mon.Task()(&ctx)(nil) - - // satellite deletes now from 0 to l so we can just use BeginDeleteObject - _, err := s.Delete(ctx, path) - if err != nil { - zap.L().Warn("Failed deleting object", zap.Stringer("path", path), zap.Error(err)) - } -} diff --git a/vendor/storj.io/uplink/private/stream/common.go b/vendor/storj.io/uplink/private/stream/common.go deleted file mode 100644 index a9d33faee..000000000 --- a/vendor/storj.io/uplink/private/stream/common.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package stream - -import ( - "github.com/zeebo/errs" -) - -// Error is the errs class of stream errors. -var Error = errs.Class("stream error") diff --git a/vendor/storj.io/uplink/private/stream/download.go b/vendor/storj.io/uplink/private/stream/download.go deleted file mode 100644 index 23f5bf792..000000000 --- a/vendor/storj.io/uplink/private/stream/download.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package stream - -import ( - "context" - "io" - - "storj.io/common/storj" - "storj.io/uplink/private/metainfo" - "storj.io/uplink/private/storage/streams" -) - -// Download implements Reader, Seeker and Closer for reading from stream. -type Download struct { - ctx context.Context - stream metainfo.ReadOnlyStream - streams streams.Store - reader io.ReadCloser - offset int64 - limit int64 - closed bool -} - -// NewDownload creates new stream download. -func NewDownload(ctx context.Context, stream metainfo.ReadOnlyStream, streams streams.Store) *Download { - return &Download{ - ctx: ctx, - stream: stream, - streams: streams, - limit: stream.Info().Size, - } -} - -// NewDownloadRange creates new stream range download with range from offset to offset+limit. -func NewDownloadRange(ctx context.Context, stream metainfo.ReadOnlyStream, streams streams.Store, offset, limit int64) *Download { - size := stream.Info().Size - if offset > size { - offset = size - } - if limit < 0 || limit+offset > size { - limit = size - offset - } - return &Download{ - ctx: ctx, - stream: stream, - streams: streams, - offset: offset, - limit: limit, - } -} - -// Read reads up to len(data) bytes into data. -// -// If this is the first call it will read from the beginning of the stream. -// Use Seek to change the current offset for the next Read call. -// -// See io.Reader for more details. -func (download *Download) Read(data []byte) (n int, err error) { - if download.closed { - return 0, Error.New("already closed") - } - - if download.reader == nil { - err = download.resetReader() - if err != nil { - return 0, err - } - } - - if download.limit <= 0 { - return 0, io.EOF - } - if download.limit < int64(len(data)) { - data = data[:download.limit] - } - n, err = download.reader.Read(data) - download.limit -= int64(n) - download.offset += int64(n) - - return n, err -} - -// Close closes the stream and releases the underlying resources. -func (download *Download) Close() error { - if download.closed { - return Error.New("already closed") - } - - download.closed = true - - if download.reader == nil { - return nil - } - - return download.reader.Close() -} - -func (download *Download) resetReader() error { - if download.reader != nil { - err := download.reader.Close() - if err != nil { - return err - } - } - - obj := download.stream.Info() - - rr, err := download.streams.Get(download.ctx, storj.JoinPaths(obj.Bucket.Name, obj.Path), obj) - if err != nil { - return err - } - - download.reader, err = rr.Range(download.ctx, download.offset, download.limit) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/storj.io/uplink/private/stream/upload.go b/vendor/storj.io/uplink/private/stream/upload.go deleted file mode 100644 index ee070fd7e..000000000 --- a/vendor/storj.io/uplink/private/stream/upload.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -package stream - -import ( - "context" - "io" - "sync" - - "github.com/zeebo/errs" - "golang.org/x/sync/errgroup" - - "storj.io/common/storj" - "storj.io/uplink/private/metainfo" - "storj.io/uplink/private/storage/streams" -) - -// Upload implements Writer and Closer for writing to stream. -type Upload struct { - ctx context.Context - stream metainfo.MutableStream - streams streams.Store - writer io.WriteCloser - closed bool - errgroup errgroup.Group - - // mu protects meta - mu sync.RWMutex - meta *streams.Meta -} - -// NewUpload creates new stream upload. -func NewUpload(ctx context.Context, stream metainfo.MutableStream, streams streams.Store) *Upload { - reader, writer := io.Pipe() - - upload := Upload{ - ctx: ctx, - stream: stream, - streams: streams, - writer: writer, - } - - upload.errgroup.Go(func() error { - m, err := streams.Put(ctx, storj.JoinPaths(stream.BucketName(), stream.Path()), reader, stream, stream.Expires()) - if err != nil { - return errs.Combine(err, reader.CloseWithError(err)) - } - - upload.mu.Lock() - upload.meta = &m - upload.mu.Unlock() - - return nil - }) - - return &upload -} - -// Write writes len(data) bytes from data to the underlying data stream. -// -// See io.Writer for more details. -func (upload *Upload) Write(data []byte) (n int, err error) { - if upload.closed { - return 0, Error.New("already closed") - } - - return upload.writer.Write(data) -} - -// Close closes the stream and releases the underlying resources. -func (upload *Upload) Close() error { - if upload.closed { - return Error.New("already closed") - } - - upload.closed = true - - err := upload.writer.Close() - - // Wait for streams.Put to commit the upload to the PointerDB - return errs.Combine(err, upload.errgroup.Wait()) -} - -// Meta returns the metadata of the uploaded object. -// -// Will return nil if the upload is still in progress. -func (upload *Upload) Meta() *streams.Meta { - upload.mu.RLock() - defer upload.mu.RUnlock() - - // we can safely return the pointer because it doesn't change after the - // upload finishes - return upload.meta -} diff --git a/vendor/storj.io/uplink/private/testuplink/uplink.go b/vendor/storj.io/uplink/private/testuplink/uplink.go deleted file mode 100644 index 9ed157c4b..000000000 --- a/vendor/storj.io/uplink/private/testuplink/uplink.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package testuplink - -import ( - "context" - - "storj.io/common/memory" -) - -type segmentSizeKey struct{} - -// WithMaxSegmentSize creates context with max segment size for testing purposes. -func WithMaxSegmentSize(ctx context.Context, segmentSize memory.Size) context.Context { - return context.WithValue(ctx, segmentSizeKey{}, segmentSize) -} - -// GetMaxSegmentSize returns max segment size from context if exists. -func GetMaxSegmentSize(ctx context.Context) (memory.Size, bool) { - segmentSize, ok := ctx.Value(segmentSizeKey{}).(memory.Size) - return segmentSize, ok -} diff --git a/vendor/storj.io/uplink/project.go b/vendor/storj.io/uplink/project.go deleted file mode 100644 index a05615ebe..000000000 --- a/vendor/storj.io/uplink/project.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - - "github.com/zeebo/errs" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" - - "storj.io/common/encryption" - "storj.io/common/memory" - "storj.io/common/rpc" - "storj.io/common/storj" - "storj.io/uplink/internal/telemetryclient" - "storj.io/uplink/private/ecclient" - "storj.io/uplink/private/metainfo" - "storj.io/uplink/private/storage/segments" - "storj.io/uplink/private/storage/streams" - "storj.io/uplink/private/testuplink" -) - -// maxSegmentSize can be used to override max segment size with ldflags build parameter. -// Example: go build -ldflags "-X 'storj.io/uplink.maxSegmentSize=1MiB'" storj.io/storj/cmd/uplink. -var maxSegmentSize string - -// Project provides access to managing buckets and objects. -type Project struct { - config Config - access *Access - dialer rpc.Dialer - metainfo *metainfo.Client - db *metainfo.DB - streams streams.Store - - eg *errgroup.Group - telemetry telemetryclient.Client -} - -// OpenProject opens a project with the specific access grant. -func OpenProject(ctx context.Context, access *Access) (*Project, error) { - return (Config{}).OpenProject(ctx, access) -} - -// OpenProject opens a project with the specific access grant. -func (config Config) OpenProject(ctx context.Context, access *Access) (project *Project, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - if access == nil { - return nil, packageError.New("access grant is nil") - } - - var telemetry telemetryclient.Client - if ctor, ok := telemetryclient.ConstructorFrom(ctx); ok { - telemetry, err = ctor(zap.L(), access.satelliteAddress) - if err != nil { - return nil, err - } - - defer func() { - if err != nil { - telemetry.Stop() - } - }() - } - - metainfoClient, dialer, _, err := config.dial(ctx, access.satelliteAddress, access.apiKey) - if err != nil { - return nil, packageError.Wrap(err) - } - - // TODO: All these should be controlled by the satellite and not configured by the uplink. - // For now we need to have these hard coded values that match the satellite configuration - // to be able to create the underlying ecclient, segement store and stream store. - var ( - segmentsSize = 64 * memory.MiB.Int64() - maxInlineSize = 4 * memory.KiB.Int() - ) - - if maxSegmentSize != "" { - segmentsSize, err = memory.ParseString(maxSegmentSize) - if err != nil { - return nil, packageError.Wrap(err) - } - } else { - s, ok := testuplink.GetMaxSegmentSize(ctx) - if ok { - segmentsSize = s.Int64() - } - } - - // TODO: This should come from the EncryptionAccess. For now it's hardcoded to twice the - // stripe size of the default redundancy scheme on the satellite. - encBlockSize := 29 * 256 * memory.B.Int32() - - // TODO: What is the correct way to derive a named zap.Logger from config.Log? - ec := ecclient.NewClient(zap.L().Named("ecclient"), dialer, 0) - segmentStore := segments.NewSegmentStore(metainfoClient, ec) - - encryptionParameters := storj.EncryptionParameters{ - // TODO: the cipher should be provided by the Access, but we don't store it there yet. - CipherSuite: storj.EncAESGCM, - BlockSize: encBlockSize, - } - - maxEncryptedSegmentSize, err := encryption.CalcEncryptedSize(segmentsSize, encryptionParameters) - if err != nil { - return nil, packageError.Wrap(err) - } - - streamStore, err := streams.NewStreamStore(metainfoClient, segmentStore, segmentsSize, access.encAccess.Store(), int(encryptionParameters.BlockSize), encryptionParameters.CipherSuite, maxInlineSize, maxEncryptedSegmentSize) - if err != nil { - return nil, packageError.Wrap(err) - } - - db := metainfo.New(metainfoClient, access.encAccess.Store()) - - var eg errgroup.Group - if telemetry != nil { - eg.Go(func() error { - telemetry.Run(ctx) - return nil - }) - } - - return &Project{ - config: config, - access: access, - dialer: dialer, - metainfo: metainfoClient, - db: db, - streams: streamStore, - eg: &eg, - telemetry: telemetry, - }, nil -} - -// Close closes the project and all associated resources. -func (project *Project) Close() (err error) { - if project.telemetry != nil { - project.telemetry.Stop() - err = errs.Combine( - project.eg.Wait(), - project.telemetry.Report(context.Background()), - ) - } - return packageError.Wrap(errs.Combine(err, project.metainfo.Close())) -} diff --git a/vendor/storj.io/uplink/upload.go b/vendor/storj.io/uplink/upload.go deleted file mode 100644 index 53f218809..000000000 --- a/vendor/storj.io/uplink/upload.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (C) 2020 Storj Labs, Inc. -// See LICENSE for copying information. - -package uplink - -import ( - "context" - "errors" - "sync/atomic" - "time" - - "github.com/zeebo/errs" - - "storj.io/common/pb" - "storj.io/common/storj" - "storj.io/uplink/private/metainfo" - "storj.io/uplink/private/stream" -) - -// ErrUploadDone is returned when either Abort or Commit has already been called. -var ErrUploadDone = errors.New("upload done") - -// UploadOptions contains additional options for uploading. -type UploadOptions struct { - // When Expires is zero, there is no expiration. - Expires time.Time -} - -// UploadObject starts an upload to the specific key. -func (project *Project) UploadObject(ctx context.Context, bucket, key string, options *UploadOptions) (upload *Upload, err error) { - defer mon.Func().RestartTrace(&ctx)(&err) - - if bucket == "" { - return nil, errwrapf("%w (%q)", ErrBucketNameInvalid, bucket) - } - if key == "" { - return nil, errwrapf("%w (%q)", ErrObjectKeyInvalid, key) - } - - if options == nil { - options = &UploadOptions{} - } - - b := storj.Bucket{Name: bucket} - obj, err := project.db.CreateObject(ctx, b, key, nil) - if err != nil { - return nil, convertKnownErrors(err, bucket, key) - } - - info := obj.Info() - mutableStream, err := obj.CreateStream(ctx) - if err != nil { - return nil, packageError.Wrap(err) - } - - ctx, cancel := context.WithCancel(ctx) - - upload = &Upload{ - cancel: cancel, - bucket: bucket, - object: convertObject(&info), - } - upload.upload = stream.NewUpload(ctx, dynamicMetadata{ - MutableStream: mutableStream, - object: upload.object, - expires: options.Expires, - }, project.streams) - return upload, nil -} - -// Upload is an upload to Storj Network. -type Upload struct { - aborted int32 - cancel context.CancelFunc - upload *stream.Upload - bucket string - object *Object -} - -// Info returns the last information about the uploaded object. -func (upload *Upload) Info() *Object { - meta := upload.upload.Meta() - if meta != nil { - upload.object.System.ContentLength = meta.Size - upload.object.System.Created = meta.Modified - } - return upload.object -} - -// Write uploads len(p) bytes from p to the object's data stream. -// It returns the number of bytes written from p (0 <= n <= len(p)) -// and any error encountered that caused the write to stop early. -func (upload *Upload) Write(p []byte) (n int, err error) { - return upload.upload.Write(p) -} - -// Commit commits data to the store. -// -// Returns ErrUploadDone when either Abort or Commit has already been called. -func (upload *Upload) Commit() error { - if atomic.LoadInt32(&upload.aborted) == 1 { - return errwrapf("%w: already aborted", ErrUploadDone) - } - - err := upload.upload.Close() - if err != nil && errs.Unwrap(err).Error() == "already closed" { - return errwrapf("%w: already committed", ErrUploadDone) - } - - return convertKnownErrors(err, upload.bucket, upload.object.Key) -} - -// Abort aborts the upload. -// -// Returns ErrUploadDone when either Abort or Commit has already been called. -func (upload *Upload) Abort() error { - if upload.upload.Meta() != nil { - return errwrapf("%w: already committed", ErrUploadDone) - } - - if !atomic.CompareAndSwapInt32(&upload.aborted, 0, 1) { - return errwrapf("%w: already aborted", ErrUploadDone) - } - - upload.cancel() - return nil -} - -// SetCustomMetadata updates custom metadata to be included with the object. -// If it is nil, it won't be modified. -func (upload *Upload) SetCustomMetadata(ctx context.Context, custom CustomMetadata) error { - if atomic.LoadInt32(&upload.aborted) == 1 { - return errwrapf("%w: upload aborted", ErrUploadDone) - } - if upload.upload.Meta() != nil { - return errwrapf("%w: already committed", ErrUploadDone) - } - - if custom != nil { - if err := custom.Verify(); err != nil { - return packageError.Wrap(err) - } - upload.object.Custom = custom.Clone() - } - - return nil -} - -type dynamicMetadata struct { - metainfo.MutableStream - object *Object - expires time.Time -} - -func (meta dynamicMetadata) Metadata() ([]byte, error) { - return pb.Marshal(&pb.SerializableMeta{ - UserDefined: meta.object.Custom.Clone(), - }) -} - -func (meta dynamicMetadata) Expires() time.Time { - return meta.expires -}